Commit bb093d3be62d521281741395a135af25c9a0b745
Merge branch 'test' into 'qa'
Test See merge request !567
Showing
3 changed files
with
75 additions
and
70 deletions
pages/cart/cart2/cart2.js
| @@ -120,7 +120,8 @@ Page({ | @@ -120,7 +120,8 @@ Page({ | ||
| 120 | wx.setNavigationBarTitle({ title: "填写订单",}) | 120 | wx.setNavigationBarTitle({ title: "填写订单",}) |
| 121 | var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); | 121 | var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); |
| 122 | th.data.param=t; | 122 | th.data.param=t; |
| 123 | - | 123 | + //清理一下,确保最新的系统配置 |
| 124 | + getApp().globalData.config2=null; | ||
| 124 | //清空is_pick_up | 125 | //清空is_pick_up |
| 125 | getApp().request.put("/api/weshop/useraddress/updatePickUp", { | 126 | getApp().request.put("/api/weshop/useraddress/updatePickUp", { |
| 126 | data: {user_id: getApp().globalData.user_id, is_pickup: 0}, | 127 | data: {user_id: getApp().globalData.user_id, is_pickup: 0}, |
| @@ -207,11 +208,13 @@ Page({ | @@ -207,11 +208,13 @@ Page({ | ||
| 207 | },500)--*/ | 208 | },500)--*/ |
| 208 | 209 | ||
| 209 | }); | 210 | }); |
| 210 | - //--更新默认地址--,看一下是不是跳到地址页面 | ||
| 211 | - if(!getApp().globalData.is_cart_old){ | 211 | + var is_card_back=getApp().globalData.is_card_back; |
| 212 | + //--更新默认地址--,看一下是不是跳到地址页面,同时也不是购买等级卡返回的,这里很重要,否则会重新更新收货物流公司 | ||
| 213 | + if(!getApp().globalData.is_cart_old && !is_card_back && !getApp().globalData.plus_buy_back){ | ||
| 212 | this.update_code(); | 214 | this.update_code(); |
| 213 | }else{ | 215 | }else{ |
| 214 | getApp().globalData.is_cart_old=0; | 216 | getApp().globalData.is_cart_old=0; |
| 217 | + getApp().globalData.plus_buy_back=0; | ||
| 215 | } | 218 | } |
| 216 | } | 219 | } |
| 217 | 220 | ||
| @@ -984,7 +987,37 @@ Page({ | @@ -984,7 +987,37 @@ Page({ | ||
| 984 | var o_price=0; | 987 | var o_price=0; |
| 985 | var o_shipping_price=0,goods_weight=-1, goods_piece=-1; | 988 | var o_shipping_price=0,goods_weight=-1, goods_piece=-1; |
| 986 | var item=c_arr[i].goods; //就是每一单的从表的意思 | 989 | var item=c_arr[i].goods; //就是每一单的从表的意思 |
| 987 | - | 990 | + |
| 991 | + //---如果有选择优惠券的情况下--- | ||
| 992 | + var quan_price=0; | ||
| 993 | + var coupon_price=0; | ||
| 994 | + var quan_no= null; | ||
| 995 | + | ||
| 996 | + if(th.data.using_quan[pickid]!=null && th.data.using_quan[pickid]!=undefined) | ||
| 997 | + quan_no=th.data.using_quan[pickid].coupon_no; | ||
| 998 | + | ||
| 999 | + //普通券的时候 | ||
| 1000 | + if(quan_no && th.data.using_quan[pickid].isby!=1){ | ||
| 1001 | + //---获取优惠券优惠--- | ||
| 1002 | + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | ||
| 1003 | + data: { | ||
| 1004 | + storeId: oo.stoid, | ||
| 1005 | + CashRepNo: quan_no, | ||
| 1006 | + WaresSum: cart_item.check_quan_price_list, | ||
| 1007 | + WareIds: cart_item.check_quan_ware_list | ||
| 1008 | + } | ||
| 1009 | + }).then(res => { | ||
| 1010 | + if (res.data.code == 0 && res.data.data.length > 0) { | ||
| 1011 | + var q_data = res.data.data; | ||
| 1012 | + //--存储商品优惠的内容-- | ||
| 1013 | + cart_item.quan_youhui_list = q_data; | ||
| 1014 | + for (var k in q_data) | ||
| 1015 | + quan_price += q_data[k].WareCashSum; | ||
| 1016 | + } | ||
| 1017 | + }) | ||
| 1018 | + } | ||
| 1019 | + | ||
| 1020 | + | ||
| 988 | //--------循环计算总价----------- | 1021 | //--------循环计算总价----------- |
| 989 | for(var j=0;j<item.length;j++){ | 1022 | for(var j=0;j<item.length;j++){ |
| 990 | o_price += item[j].goods_price * item[j].goods_num; | 1023 | o_price += item[j].goods_price * item[j].goods_num; |
| @@ -996,14 +1029,14 @@ Page({ | @@ -996,14 +1029,14 @@ Page({ | ||
| 996 | 1029 | ||
| 997 | //判断包邮券的钱 | 1030 | //判断包邮券的钱 |
| 998 | var q_conditin=0; | 1031 | var q_conditin=0; |
| 999 | - q_conditin=o_price; | 1032 | + q_conditin=o_price-quan_price; |
| 1000 | 1033 | ||
| 1001 | cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 | 1034 | cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 |
| 1002 | //计算物流费用 | 1035 | //计算物流费用 |
| 1003 | cart_item.shipping_price = 0; | 1036 | cart_item.shipping_price = 0; |
| 1004 | 1037 | ||
| 1005 | - //--有不包邮区域,且不免运费,全场的计算-- | ||
| 1006 | - if(no_ex_id && freight_free>0 && o_price>=freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list) ){ | 1038 | + //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额-- |
| 1039 | + if(no_ex_id && freight_free>0 && (o_price-quan_price)>=freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list) ){ | ||
| 1007 | //如果有设置不包邮区域的时候 | 1040 | //如果有设置不包邮区域的时候 |
| 1008 | if(by_qc.region_list!="" && by_qc.region_list!=null && by_qc.region_list!=undefined ){ | 1041 | if(by_qc.region_list!="" && by_qc.region_list!=null && by_qc.region_list!=undefined ){ |
| 1009 | if(th.check_by_area(by_qc.region_list)){ | 1042 | if(th.check_by_area(by_qc.region_list)){ |
| @@ -1055,12 +1088,7 @@ Page({ | @@ -1055,12 +1088,7 @@ Page({ | ||
| 1055 | }) | 1088 | }) |
| 1056 | } | 1089 | } |
| 1057 | } | 1090 | } |
| 1058 | - | ||
| 1059 | - var quan_no=null; | ||
| 1060 | - if(th.data.using_quan[pickid]){ | ||
| 1061 | - quan_no=th.data.using_quan[pickid].coupon_no; | ||
| 1062 | - } | ||
| 1063 | - | 1091 | + |
| 1064 | //如果是包邮券的时候,要看看券的情况 | 1092 | //如果是包邮券的时候,要看看券的情况 |
| 1065 | if(quan_no && th.data.using_quan[pickid].isby==1){ | 1093 | if(quan_no && th.data.using_quan[pickid].isby==1){ |
| 1066 | var quan=th.data.using_quan[pickid]; | 1094 | var quan=th.data.using_quan[pickid]; |
| @@ -1101,7 +1129,7 @@ Page({ | @@ -1101,7 +1129,7 @@ Page({ | ||
| 1101 | } | 1129 | } |
| 1102 | 1130 | ||
| 1103 | //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 | 1131 | //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 |
| 1104 | - if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){ | 1132 | + if(o_price-quan_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){ |
| 1105 | continue; | 1133 | continue; |
| 1106 | } | 1134 | } |
| 1107 | 1135 | ||
| @@ -1140,7 +1168,7 @@ Page({ | @@ -1140,7 +1168,7 @@ Page({ | ||
| 1140 | code=th.data.wu_arr[cart_item.wind].code; | 1168 | code=th.data.wu_arr[cart_item.wind].code; |
| 1141 | cart_item.shipping_price = | 1169 | cart_item.shipping_price = |
| 1142 | th.calculatewuliu(code, o_shipping_price, goods_weight, | 1170 | th.calculatewuliu(code, o_shipping_price, goods_weight, |
| 1143 | - goods_piece,th.data.user_addr, freight_free, o_price, rs); | 1171 | + goods_piece,th.data.user_addr, freight_free, o_price-quan_price, rs); |
| 1144 | 1172 | ||
| 1145 | if(!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby!=1){ | 1173 | if(!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby!=1){ |
| 1146 | if( cart_item.shipping_price ==0) th.data.is_by[pickid]=1; //已经全场包邮,就不要选择券了 | 1174 | if( cart_item.shipping_price ==0) th.data.is_by[pickid]=1; //已经全场包邮,就不要选择券了 |
| @@ -1150,38 +1178,7 @@ Page({ | @@ -1150,38 +1178,7 @@ Page({ | ||
| 1150 | } | 1178 | } |
| 1151 | 1179 | ||
| 1152 | cart_item.shipping_price=cart_item.shipping_price.toFixed(2); | 1180 | cart_item.shipping_price=cart_item.shipping_price.toFixed(2); |
| 1153 | - //---如果有选择优惠券的情况下--- | ||
| 1154 | - var quan_price=0; | ||
| 1155 | - var coupon_price=0; | ||
| 1156 | - var quan_no= null; | ||
| 1157 | - | ||
| 1158 | - if(th.data.using_quan[pickid]!=null && th.data.using_quan[pickid]!=undefined) | ||
| 1159 | - quan_no=th.data.using_quan[pickid].coupon_no; | ||
| 1160 | - | ||
| 1161 | - if(quan_no){ | ||
| 1162 | - //如果不是包邮券的时候 | ||
| 1163 | - if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby!=1) { | ||
| 1164 | - var ui=2; | ||
| 1165 | - //---获取优惠券优惠--- | ||
| 1166 | - await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | ||
| 1167 | - data: { | ||
| 1168 | - storeId: oo.stoid, | ||
| 1169 | - CashRepNo: quan_no, | ||
| 1170 | - WaresSum: cart_item.check_quan_price_list, | ||
| 1171 | - WareIds: cart_item.check_quan_ware_list | ||
| 1172 | - } | ||
| 1173 | - }).then(res => { | ||
| 1174 | - if (res.data.code == 0 && res.data.data.length > 0) { | ||
| 1175 | - var q_data = res.data.data; | ||
| 1176 | - //--存储商品优惠的内容-- | ||
| 1177 | - cart_item.quan_youhui_list = q_data; | ||
| 1178 | - for (var k in q_data) | ||
| 1179 | - quan_price += q_data[k].WareCashSum; | ||
| 1180 | - } | ||
| 1181 | - }) | ||
| 1182 | - } | ||
| 1183 | - } | ||
| 1184 | - | 1181 | + |
| 1185 | //总价计算,总价不包含运费 | 1182 | //总价计算,总价不包含运费 |
| 1186 | cart_item.order_amount= (o_price -quan_price).toFixed(2); | 1183 | cart_item.order_amount= (o_price -quan_price).toFixed(2); |
| 1187 | cart_item.total_amount= f_o_price.toFixed(2); | 1184 | cart_item.total_amount= f_o_price.toFixed(2); |
| @@ -1368,12 +1365,32 @@ Page({ | @@ -1368,12 +1365,32 @@ Page({ | ||
| 1368 | to.getwuliuprice(async function (rs) { | 1365 | to.getwuliuprice(async function (rs) { |
| 1369 | 1366 | ||
| 1370 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 1367 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
| 1368 | + | ||
| 1369 | + //---如果有选择优惠券的情况下--- | ||
| 1370 | + var quan_price=0,bn_pick=th.data.bn_pick; | ||
| 1371 | + var quan_no=null; | ||
| 1372 | + if(th.data.using_quan[bn_pick]!=null && th.data.using_quan[bn_pick]!=undefined) | ||
| 1373 | + quan_no=th.data.using_quan[bn_pick].coupon_no; | ||
| 1374 | + | ||
| 1375 | + if(quan_no){ | ||
| 1376 | + if(th.data.using_quan[bn_pick].isby!=1){ | ||
| 1377 | + //---获取优惠券优惠--- | ||
| 1378 | + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice",{ | ||
| 1379 | + data:{storeId:oo.stoid,CashRepNo:quan_no, WaresSum:th.data.ckeck_quan_price, WareIds:th.data.check_quan_ware_list} | ||
| 1380 | + }).then(res=>{ | ||
| 1381 | + if(res.data.code==0){ | ||
| 1382 | + quan_price=res.data.data[0].WareCashSum; | ||
| 1383 | + } | ||
| 1384 | + }) | ||
| 1385 | + } | ||
| 1386 | + } | ||
| 1387 | + | ||
| 1371 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | 1388 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- |
| 1372 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){ | 1389 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){ |
| 1373 | //看是不是有调用过包邮券 | 1390 | //看是不是有调用过包邮券 |
| 1374 | if(!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh!=1){ | 1391 | if(!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh!=1){ |
| 1375 | - var condition=allpice-cut_price; | ||
| 1376 | - //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额--- | 1392 | + var condition=allpice-cut_price-quan_price; |
| 1393 | + //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- | ||
| 1377 | getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{ | 1394 | getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{ |
| 1378 | data:{store_id:os.stoid,isuse:0,condition:condition,user_id:getApp().globalData.user_id,pageSize:2000} | 1395 | data:{store_id:os.stoid,isuse:0,condition:condition,user_id:getApp().globalData.user_id,pageSize:2000} |
| 1379 | }).then(res=>{ | 1396 | }).then(res=>{ |
| @@ -1417,8 +1434,10 @@ Page({ | @@ -1417,8 +1434,10 @@ Page({ | ||
| 1417 | 1434 | ||
| 1418 | var no_by_data=null; | 1435 | var no_by_data=null; |
| 1419 | var gift_freight_free=freight_free; | 1436 | var gift_freight_free=freight_free; |
| 1437 | + | ||
| 1438 | + | ||
| 1420 | //有不包邮区域,且不免运费 | 1439 | //有不包邮区域,且不免运费 |
| 1421 | - if(no_ex_id && freight_free>0 && freight_free<=allpice-cut_price){ | 1440 | + if(no_ex_id && freight_free>0 && freight_free<= parseFloat(allpice)-cut_price-quan_price){ |
| 1422 | //-----------获取不包邮区域,不包邮商品------- | 1441 | //-----------获取不包邮区域,不包邮商品------- |
| 1423 | await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods",{ | 1442 | await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods",{ |
| 1424 | data:{store_id:os.stoid,id:no_ex_id} | 1443 | data:{store_id:os.stoid,id:no_ex_id} |
| @@ -1447,11 +1466,11 @@ Page({ | @@ -1447,11 +1466,11 @@ Page({ | ||
| 1447 | //--------------开始计算物流------------------ | 1466 | //--------------开始计算物流------------------ |
| 1448 | var shipping_price= | 1467 | var shipping_price= |
| 1449 | th.calculatewuliu(code, o_shipping_price, goods_weight, | 1468 | th.calculatewuliu(code, o_shipping_price, goods_weight, |
| 1450 | - goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs); | 1469 | + goods_piece, th.data.user_addr, freight_free, parseFloat(allpice)-cut_price-quan_price, rs); |
| 1451 | 1470 | ||
| 1452 | //如果有赠品的时候,也要计算赠品的物流费用 | 1471 | //如果有赠品的时候,也要计算赠品的物流费用 |
| 1453 | if(th.data.buy_now_gift_goods){ | 1472 | if(th.data.buy_now_gift_goods){ |
| 1454 | - shipping_price=th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, allpice-cut_price, rs,shipping_price,no_by_data); | 1473 | + shipping_price=th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, parseFloat(allpice)-cut_price-quan_price, rs,shipping_price,no_by_data); |
| 1455 | } | 1474 | } |
| 1456 | 1475 | ||
| 1457 | if(shipping_price<=0){ | 1476 | if(shipping_price<=0){ |
| @@ -1466,26 +1485,12 @@ Page({ | @@ -1466,26 +1485,12 @@ Page({ | ||
| 1466 | var wl_txt = "formData.shipping_price"; | 1485 | var wl_txt = "formData.shipping_price"; |
| 1467 | th.setData({ [wl_txt]: 0, }) | 1486 | th.setData({ [wl_txt]: 0, }) |
| 1468 | } | 1487 | } |
| 1469 | - //---如果有选择优惠券的情况下--- | ||
| 1470 | - var quan_price=0,bn_pick=th.data.bn_pick; | ||
| 1471 | - var quan_no=null; | ||
| 1472 | - if(th.data.using_quan[bn_pick]!=null && th.data.using_quan[bn_pick]!=undefined) | ||
| 1473 | - quan_no=th.data.using_quan[bn_pick].coupon_no; | 1488 | + |
| 1474 | if(quan_no){ | 1489 | if(quan_no){ |
| 1475 | - var aa=1; | ||
| 1476 | if(th.data.using_quan[bn_pick].isby==1){ | 1490 | if(th.data.using_quan[bn_pick].isby==1){ |
| 1477 | shipping_price=0; | 1491 | shipping_price=0; |
| 1478 | var wl_txt = "formData.shipping_price"; | 1492 | var wl_txt = "formData.shipping_price"; |
| 1479 | th.setData({ [wl_txt]: 0, }) | 1493 | th.setData({ [wl_txt]: 0, }) |
| 1480 | - }else{ | ||
| 1481 | - //---获取优惠券优惠--- | ||
| 1482 | - await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice",{ | ||
| 1483 | - data:{storeId:oo.stoid,CashRepNo:quan_no, WaresSum:th.data.ckeck_quan_price, WareIds:th.data.check_quan_ware_list} | ||
| 1484 | - }).then(res=>{ | ||
| 1485 | - if(res.data.code==0){ | ||
| 1486 | - quan_price=res.data.data[0].WareCashSum; | ||
| 1487 | - } | ||
| 1488 | - }) | ||
| 1489 | } | 1494 | } |
| 1490 | } | 1495 | } |
| 1491 | //-----------------支付价,优惠券不减物流----------------- | 1496 | //-----------------支付价,优惠券不减物流----------------- |
pages/goods/goodsInfo/goodsInfo.js
| @@ -2035,7 +2035,7 @@ Page({ | @@ -2035,7 +2035,7 @@ Page({ | ||
| 2035 | if (e.data.code == 0) { | 2035 | if (e.data.code == 0) { |
| 2036 | 2036 | ||
| 2037 | //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | 2037 | //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 |
| 2038 | - if(dd.lat && !th.data.def_pick_store && th.data.bconfig.is_sort_storage){ | 2038 | + if(dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store)=='{}') && th.data.bconfig.is_sort_storage){ |
| 2039 | th.setData({ | 2039 | th.setData({ |
| 2040 | def_pick_store:e.data.data.pageData[0], | 2040 | def_pick_store:e.data.data.pageData[0], |
| 2041 | sto_sele_name: e.data.data.pageData[0].pickup_name, | 2041 | sto_sele_name: e.data.data.pageData[0].pickup_name, |
| @@ -2046,7 +2046,7 @@ Page({ | @@ -2046,7 +2046,7 @@ Page({ | ||
| 2046 | } | 2046 | } |
| 2047 | 2047 | ||
| 2048 | //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- | 2048 | //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- |
| 2049 | - if (th.data.def_pick_store && (g_distr_type==0 || th.data.def_pick_store.distr_type==0 || th.data.def_pick_store.distr_type==g_distr_type )){ | 2049 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store)!='{}' && (g_distr_type==0 || th.data.def_pick_store.distr_type==0 || th.data.def_pick_store.distr_type==g_distr_type )){ |
| 2050 | for (var k = 0; k < e.data.data.pageData.length; k++) { | 2050 | for (var k = 0; k < e.data.data.pageData.length; k++) { |
| 2051 | if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | 2051 | if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { |
| 2052 | e.data.data.pageData.splice(k, 1); //删除 | 2052 | e.data.data.pageData.splice(k, 1); //删除 |
pages/user/order_list/order_list.wxml
| @@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
| 28 | </view> | 28 | </view> |
| 29 | <view class="search-btn search-btn2" bindtap="searchOffline">查询</view> | 29 | <view class="search-btn search-btn2" bindtap="searchOffline">查询</view> |
| 30 | </view> | 30 | </view> |
| 31 | - <view class="fs24 c-9 pdt20">注:读取时段内仅{{total}}笔记录</view> | 31 | + <view class="fs24 c-9 pdt20">注:读取时段内近10笔记录</view> |
| 32 | </view> | 32 | </view> |
| 33 | </view> | 33 | </view> |
| 34 | <!-- 线上订单 --> | 34 | <!-- 线上订单 --> |