Commit 4e21243e by 朱继来

Merge branch 'zjl_add_order_20210624'

parents 9975570c 5c7dd2ef
......@@ -590,6 +590,7 @@ Class AddOrderController extends Controller
if ($request->isMethod('post')) {
$is_online = $request->input('is_online');
$data['uid'] = $request->input('uid', 0);
$data['shipping_type'] = $request->input('shipping_type', 1);
$data['address_id'] = $request->input('address_id', 0);
$data['cart_id'] = $request->input('cart_ids', '');
$data['user_coupon_id'] = $request->input('user_coupon_id', 0);
......@@ -683,6 +684,8 @@ Class AddOrderController extends Controller
$data['com_id'] = $request->input('com_id', 0);
$data['com_name'] = $request->input('com_name', '');
$data['shipping_type'] = $request->input('shipping_type', 1);
$data['self_consignee'] = $request->input('self_consignee', '');
$data['self_mobile'] = $request->input('self_mobile', '');
if ($data['type'] == 3) { // 自营线下订单
$data['address_name'] = $request->input('address_name');
......
......@@ -113,6 +113,41 @@
get_user();
})
// 选择配送方式
$('#shipping_type').change(function() {
var shipping_type = $('#shipping_type').val();
if (shipping_type == 2) {
$('.select-addr').hide();
$('.address-content').hide();
$('.address-content-self').show();
$('.address_id').val(1);
} else {
$('.select-addr').show();
$('.address-content-self').hide();
$('#address').val('');
$('.address_id').val('');
}
var coupon_id = $('#user_coupon').val();
var address_id = $('.address_id').val();
var user_id = $('.user_id').val();
var cart_ids = [];
$('.shop-table tbody').find('tr').each(function() {
var cid = $(this).data('cid');
cart_ids.push(cid);
})
if (coupon_id) {
$('.user_coupon_id').val(coupon_id);
} else {
$('.user_coupon_id').val('');
}
loading.confirm(user_id, address_id, cart_ids, coupon_id, goods_type, is_online); // 确认订单信息
})
// 选择收货地址
$('.user-info').delegate('#address', 'change', function() {
var user_id = $('.user_id').val();
......@@ -381,8 +416,10 @@
html += '<td><span class="goods-min-num">'+data.tiered[i]['purchases']+'</span></td><td>¥<span class="goods-min-price">'+data.tiered[i]['price_cn']+'</span></td>';
}
if (joint_goods_type.indexOf(data.goods_type) != -1) {
if (joint_goods_type.indexOf(data.goods_type) != -1 && data.tiered[i]['price_us']) {
html += '<td>$<span class="goods-min-price-us">'+data.tiered[i]['price_us']+'</span></td>';
} else {
html += '<td></td>';
}
} else {
if (data.ac_type && data.ac_type != 5) {
......@@ -391,8 +428,10 @@
html += '<td><span>'+data.tiered[i]['purchases']+'</span></td><td>¥<span>'+data.tiered[i]['price_cn']+'</span></td>';
}
if (joint_goods_type.indexOf(data.goods_type) != -1) {
if (joint_goods_type.indexOf(data.goods_type) != -1 && data.tiered[i]['price_us']) {
html += '<td>$<span>'+data.tiered[i]['price_us']+'</span></td>';
} else {
html += '<td></td>';
}
}
......@@ -697,6 +736,7 @@
// $('.submit-order').on('click', function() {
$('.submit-order').off().on('click', function() {
var self = $(this);
var shipping_type = $('#shipping_type').val(); // 配送方式
var address_id = $('input[name=address_id]').val();
var type = self.data('type'); // 1-联营线上,2-自营线上,3-自营线下,4-自营其他业务
var cart_ids = [];
......@@ -728,6 +768,7 @@
var datax = {
uid: user_id,
sale_id: sale_id,
shipping_type: shipping_type,
address_id: address_id,
type: type,
cart_ids: cart_ids,
......@@ -742,12 +783,34 @@
var inv_type = $('input[name=inv_type]:checked').val();
var user_coupon_id = $('.user_coupon_id').val();
var zy_delivery_type = $('.zy_delivery_type').val();
var self_consignee = $('.self_consignee').val() || '';
var self_mobile = $('.self_mobile').val() || '';
if (!address_id) {
layer.msg('请选择快递信息');
return false;
}
if (shipping_type == 2 && !self_consignee) {
layer.msg('请填写自提联系人');
return false;
}
if (shipping_type == 2 && !self_mobile) {
layer.msg('请填写自提联系电话');
return false;
}
// if (self_mobile && !(/^1[3456789]\d{9}$/.test(self_mobile))) {
// layer.msg('自提联系电话-手机号码格式错误');
// return false;
// }
if (self_mobile && !(/^((\d{3,4})|\d{3,4}\-|\s)?\d{7,14}$/.test(self_mobile))) {
layer.msg('自提联系电话格式错误');
return false;
}
if (!zy_delivery_type) {
layer.msg('请选择发货方式');
return false;
......@@ -821,6 +884,8 @@
datax.tax_id = tax_id;
datax.user_coupon_id = user_coupon_id;
datax.zy_delivery_type = zy_delivery_type;
datax.self_consignee = self_consignee;
datax.self_mobile = self_mobile;
}
// 自营线上
......@@ -1120,6 +1185,7 @@
var self = this;
var business_type = $('#business_type'); // 自营其他业务
var zy_delivery_type = $('.zy_delivery_type').val(); // 发货方式
var shipping_type = $('#shipping_type').val(); // 配送方式
if (business_type.length > 0) {
business_type = business_type.val();
......@@ -1130,7 +1196,7 @@
$.ajax({
type: 'post',
url: '/ajax/confirm',
data: {uid: user_id, address_id: address_id, cart_ids: cart_ids, user_coupon_id: user_coupon_id, goods_type: goods_type, is_online: is_online, business_type: business_type, zy_delivery_type: zy_delivery_type},
data: {uid: user_id, shipping_type: shipping_type, address_id: address_id, cart_ids: cart_ids, user_coupon_id: user_coupon_id, goods_type: goods_type, is_online: is_online, business_type: business_type, zy_delivery_type: zy_delivery_type},
dataType: "json",
success: function(resp){
if (resp.errcode == 0) {
......
......@@ -61,11 +61,15 @@
<div class="col-sm-6">
<div class="form-group">
<span>收货方式:</span>
<span>快递上门</span>
<!-- <span>快递上门</span> -->
<select name="shipping_type" id="shipping_type">
<option value="1">快递上门</option>
<option value="2">自提</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="col-sm-6 select-addr">
<div class="form-group">
<span><i class="text-danger">*</i> 选择收货地址:</span>
<select name="address" id="address">
......@@ -99,6 +103,33 @@
</div>
</div>
</div>
<!-- 自提展示 -->
<div class="address-content-self" style="display: none;">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span><i class="error">*</i> 联系人:</span>
<input type="text" name="self_consignee" class="self_consignee">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span><i class="error">*</i> 联系电话:</span>
<input type="text" name="self_mobile" class="self_mobile">
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>收货地址:</span>
<span class="address-detail">{{ Config('params.joint_addr') }}</span>
</div>
</div>
</div>
</div>
</div>
<div class="shipping-info">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment