Commit 388fed7d by 朱继来

添加免运费

parent 327b694b
......@@ -595,6 +595,7 @@ Class AddOrderController extends Controller
$data['cart_id'] = $request->input('cart_ids', '');
$data['user_coupon_id'] = $request->input('user_coupon_id', 0);
$data['send_type'] = $request->input('zy_delivery_type', 1); // 发货方式
$data['is_free_ship'] = $request->input('is_free_ship', ''); // 是否免运费
if ($is_online == 0) {
$data['type'] = 3; // 自营线下
......@@ -686,6 +687,7 @@ Class AddOrderController extends Controller
$data['shipping_type'] = $request->input('shipping_type', 1);
$data['self_consignee'] = $request->input('self_consignee', '');
$data['self_mobile'] = $request->input('self_mobile', '');
$data['is_free_ship'] = $request->input('is_free_ship', '');
if ($data['type'] == 3) { // 自营线下订单
$data['address_name'] = $request->input('address_name');
......
......@@ -732,6 +732,29 @@
form.find('input[type="file"]').trigger('click');
})
// 是否免运费
$('.is_free_ship').change(function() {
var val = $('input[name=is_free_ship]:checked').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); // 确认订单信息
})
// 提交订单
// $('.submit-order').on('click', function() {
$('.submit-order').off().on('click', function() {
......@@ -742,6 +765,7 @@
var cart_ids = [];
var user_id = 0;
var remark = $('#remark').val(); // 订单备注
var is_free_ship = $('input[name=is_free_ship]:checked').val() || ''; // 是否免运费
if (internal_uid) {
user_id = internal_uid;
......@@ -773,6 +797,7 @@
type: type,
cart_ids: cart_ids,
remark: remark,
is_free_ship: is_free_ship,
}
if (type == 3) { // 自营线下订单
......@@ -1197,10 +1222,13 @@
business_type = 0;
}
// 是否免运费
var is_free_ship = $('input[name=is_free_ship]:checked').val() || '';
$.ajax({
type: 'post',
url: '/ajax/confirm',
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},
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, is_free_ship: is_free_ship},
dataType: "json",
success: function(resp){
if (resp.errcode == 0) {
......
......@@ -452,6 +452,33 @@
return tmpStr;
}
// 自定义运费
$('.set_ship_fee').change(function() {
var val = $('input[name=set_ship_fee]:checked').val() || '';
if (val) {
$('.self_freight_fee').show();
} else {
var origin_fee = $('.freight_fee').data('origin_fee'); // 原运费
$('.freight_fee').val(origin_fee);
$('.freight_fee_val').text(origin_fee);
$('.self_freight_fee').hide();
calculate();
}
})
$('.self_freight_fee').keyup(function() {
var val = $(this).val() || 0;
$('.freight_fee').val(val);
$('.freight_fee_val').text(val);
calculate();
})
// 提交表单
$('.checkOrder').click(function(){
var is_newClient = $('input[name=is_newClient]:checked').val();
......@@ -576,8 +603,10 @@
return false;
}
// 若都为自营且商品总额小于1000,则重新计算运费规则
if (is_all_self && goods_amount < 1000) {
var set_ship_fee = $('input[name=set_ship_fee]:checked').val() || '';
// 若没免运费、没自定义运费、都为自营 且 商品总额小于1000,则重新计算运费规则
if (!is_free_ship && !set_ship_fee && is_all_self && goods_amount < 1000) {
if (is_all_self_xm) { // 若全为自营现货,则更新发货方式为现货优先发货
$('.zy_delivery_type').val(1);
msg_txt = '全为自营现货,已更新发货方式为现货优先发货,并重新获取运费金额:';
......
<style>
.user-info h4 { line-height: 30px; border-bottom: 1px dotted #ccc; }
#address{ margin-right: 10px; }
</style>
<form>
......@@ -74,6 +75,8 @@
<span><i class="text-danger">*</i> 选择收货地址:</span>
<select name="address" id="address">
</select>
<label><input type="checkbox" name="is_free_ship" value="1" class="is_free_ship"> 免运费(勾选表示免除自营商品运费)</label>
</div>
</div>
</div>
......
......@@ -395,7 +395,12 @@
<tr>
<th class="check-table-title">运费</th>
<td>
<input class="only_number freight_fee" type="text" name="freight_fee" value="{{ $order_price_info['shipping_price'] }}">
<input class="freight_fee" type="hidden" name="freight_fee" data-origin_fee="{{ $order_price_info['shipping_price'] }}" value="{{ $order_price_info['shipping_price'] }}">
<span class="freight_fee_val">{{ $order_price_info['shipping_price'] }}</span>
<label style="margin: 0 20px;"><input type="checkbox" name="set_ship_fee" value="1" class="set_ship_fee">
<span> 自定义运费</span>
</label>
<input class="only_number self_freight_fee" type="text" name="self_freight_fee" value="" style="display: none;">
</td>
</tr>
......@@ -585,6 +590,7 @@
var pay_preferential = "{{ $order_price_info['pay_preferential'] ? $order_price_info['pay_preferential'] : 0 }}"; // 支付优惠(钱包)
var new_client_price = "{{ $order_price_info['new_client_price'] }}";
var buyers = eval('{!! isset($buyers) ? json_encode($buyers) : '' !!}'); // 采购员集合
var is_free_ship = "{{ $order_temp_info['is_free_ship'] }}"; // 是否免运费
// 明细数目
var item_count = "{{ count($order_items_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