Commit 4e21243e by 朱继来

Merge branch 'zjl_add_order_20210624'

parents 9975570c 5c7dd2ef
...@@ -590,6 +590,7 @@ Class AddOrderController extends Controller ...@@ -590,6 +590,7 @@ Class AddOrderController extends Controller
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$is_online = $request->input('is_online'); $is_online = $request->input('is_online');
$data['uid'] = $request->input('uid', 0); $data['uid'] = $request->input('uid', 0);
$data['shipping_type'] = $request->input('shipping_type', 1);
$data['address_id'] = $request->input('address_id', 0); $data['address_id'] = $request->input('address_id', 0);
$data['cart_id'] = $request->input('cart_ids', ''); $data['cart_id'] = $request->input('cart_ids', '');
$data['user_coupon_id'] = $request->input('user_coupon_id', 0); $data['user_coupon_id'] = $request->input('user_coupon_id', 0);
...@@ -673,16 +674,18 @@ Class AddOrderController extends Controller ...@@ -673,16 +674,18 @@ Class AddOrderController extends Controller
public function create(Request $request) public function create(Request $request)
{ {
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$data['type'] = $request->input('type'); $data['type'] = $request->input('type');
$data['inv_com_id'] = $request->input('inv_com_id', 0); $data['inv_com_id'] = $request->input('inv_com_id', 0);
$data['uid'] = $request->input('uid'); $data['uid'] = $request->input('uid');
$data['sale_id'] = $request->user->userId; $data['sale_id'] = $request->user->userId;
$data['address_id'] = $request->input('address_id'); $data['address_id'] = $request->input('address_id');
$data['cart_id'] = implode(',', $request->input('cart_ids')); $data['cart_id'] = implode(',', $request->input('cart_ids'));
$data['remark'] = $request->input('remark'); $data['remark'] = $request->input('remark');
$data['com_id'] = $request->input('com_id', 0); $data['com_id'] = $request->input('com_id', 0);
$data['com_name'] = $request->input('com_name', ''); $data['com_name'] = $request->input('com_name', '');
$data['shipping_type'] = $request->input('shipping_type', 1); $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) { // 自营线下订单 if ($data['type'] == 3) { // 自营线下订单
$data['address_name'] = $request->input('address_name'); $data['address_name'] = $request->input('address_name');
......
...@@ -113,12 +113,47 @@ ...@@ -113,12 +113,47 @@
get_user(); 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() { $('.user-info').delegate('#address', 'change', function() {
var user_id = $('.user_id').val(); var user_id = $('.user_id').val();
var address_id = $(this).val(); var address_id = $(this).val();
var user_coupon_id = $('.user_coupon_id').val(); var user_coupon_id = $('.user_coupon_id').val();
var cart_ids = []; var cart_ids = [];
$('.shop-table tbody').find('tr').each(function() { $('.shop-table tbody').find('tr').each(function() {
var cid = $(this).data('cid'); var cid = $(this).data('cid');
...@@ -381,8 +416,10 @@ ...@@ -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>'; 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>'; html += '<td>$<span class="goods-min-price-us">'+data.tiered[i]['price_us']+'</span></td>';
} else {
html += '<td></td>';
} }
} else { } else {
if (data.ac_type && data.ac_type != 5) { if (data.ac_type && data.ac_type != 5) {
...@@ -391,9 +428,11 @@ ...@@ -391,9 +428,11 @@
html += '<td><span>'+data.tiered[i]['purchases']+'</span></td><td>¥<span>'+data.tiered[i]['price_cn']+'</span></td>'; 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>'; html += '<td>$<span>'+data.tiered[i]['price_us']+'</span></td>';
} } else {
html += '<td></td>';
}
} }
html += '</tr>'; html += '</tr>';
...@@ -696,12 +735,13 @@ ...@@ -696,12 +735,13 @@
// 提交订单 // 提交订单
// $('.submit-order').on('click', function() { // $('.submit-order').on('click', function() {
$('.submit-order').off().on('click', function() { $('.submit-order').off().on('click', function() {
var self = $(this); var self = $(this);
var address_id = $('input[name=address_id]').val(); var shipping_type = $('#shipping_type').val(); // 配送方式
var type = self.data('type'); // 1-联营线上,2-自营线上,3-自营线下,4-自营其他业务 var address_id = $('input[name=address_id]').val();
var cart_ids = []; var type = self.data('type'); // 1-联营线上,2-自营线上,3-自营线下,4-自营其他业务
var user_id = 0; var cart_ids = [];
var remark = $('#remark').val(); // 订单备注 var user_id = 0;
var remark = $('#remark').val(); // 订单备注
if (internal_uid) { if (internal_uid) {
user_id = internal_uid; user_id = internal_uid;
...@@ -728,6 +768,7 @@ ...@@ -728,6 +768,7 @@
var datax = { var datax = {
uid: user_id, uid: user_id,
sale_id: sale_id, sale_id: sale_id,
shipping_type: shipping_type,
address_id: address_id, address_id: address_id,
type: type, type: type,
cart_ids: cart_ids, cart_ids: cart_ids,
...@@ -742,12 +783,34 @@ ...@@ -742,12 +783,34 @@
var inv_type = $('input[name=inv_type]:checked').val(); var inv_type = $('input[name=inv_type]:checked').val();
var user_coupon_id = $('.user_coupon_id').val(); var user_coupon_id = $('.user_coupon_id').val();
var zy_delivery_type = $('.zy_delivery_type').val(); var zy_delivery_type = $('.zy_delivery_type').val();
var self_consignee = $('.self_consignee').val() || '';
var self_mobile = $('.self_mobile').val() || '';
if (!address_id) { if (!address_id) {
layer.msg('请选择快递信息'); layer.msg('请选择快递信息');
return false; 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) { if (!zy_delivery_type) {
layer.msg('请选择发货方式'); layer.msg('请选择发货方式');
return false; return false;
...@@ -821,6 +884,8 @@ ...@@ -821,6 +884,8 @@
datax.tax_id = tax_id; datax.tax_id = tax_id;
datax.user_coupon_id = user_coupon_id; datax.user_coupon_id = user_coupon_id;
datax.zy_delivery_type = zy_delivery_type; datax.zy_delivery_type = zy_delivery_type;
datax.self_consignee = self_consignee;
datax.self_mobile = self_mobile;
} }
// 自营线上 // 自营线上
...@@ -1120,6 +1185,7 @@ ...@@ -1120,6 +1185,7 @@
var self = this; var self = this;
var business_type = $('#business_type'); // 自营其他业务 var business_type = $('#business_type'); // 自营其他业务
var zy_delivery_type = $('.zy_delivery_type').val(); // 发货方式 var zy_delivery_type = $('.zy_delivery_type').val(); // 发货方式
var shipping_type = $('#shipping_type').val(); // 配送方式
if (business_type.length > 0) { if (business_type.length > 0) {
business_type = business_type.val(); business_type = business_type.val();
...@@ -1130,7 +1196,7 @@ ...@@ -1130,7 +1196,7 @@
$.ajax({ $.ajax({
type: 'post', type: 'post',
url: '/ajax/confirm', 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", dataType: "json",
success: function(resp){ success: function(resp){
if (resp.errcode == 0) { if (resp.errcode == 0) {
......
...@@ -61,11 +61,15 @@ ...@@ -61,11 +61,15 @@
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<span>收货方式:</span> <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> </div>
<div class="col-sm-6"> <div class="col-sm-6 select-addr">
<div class="form-group"> <div class="form-group">
<span><i class="text-danger">*</i> 选择收货地址:</span> <span><i class="text-danger">*</i> 选择收货地址:</span>
<select name="address" id="address"> <select name="address" id="address">
...@@ -98,7 +102,34 @@ ...@@ -98,7 +102,34 @@
</div> </div>
</div> </div>
</div> </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>
<div class="shipping-info"> <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