Commit db857767ff2872e9b404aeda6e1826f2f390257d

Authored by yvan.ni
1 parent 8da54d01

预存使用的优化

packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... ... @@ -320,7 +320,8 @@ Page({
320 320 let obj = {
321 321 wareno: ite.goods_sn,
322 322 price: ite.goods_price,
323   - qty: ite.goods_num
  323 + qty: ite.goods_num,
  324 + sumprice:ite.sumprice
324 325 }
325 326 listform.push(obj)
326 327 })
... ... @@ -1148,6 +1149,7 @@ Page({
1148 1149 goods_sn: th.data.bn_goods.goods_sn,
1149 1150 goods_price: th.data.param.goods_price || th.data.bn_goods.shop_price || th.data.bn_goods.goods_price,
1150 1151 goods_num: th.data.bn_goods.buynum || th.data.bn_goods.goods_num,
  1152 + sumprice:parseFloat(allpice).toFixed(2) //幸运购没有优惠券
1151 1153 }],
1152 1154 sto: {
1153 1155 keyid: th.data.bn_goods.keyid
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -548,7 +548,8 @@ Page({
548 548 let obj = {
549 549 wareno: ite.goods_sn,
550 550 price: ite.goods_price,
551   - qty: ite.goods_num
  551 + qty: ite.goods_num,
  552 + sumprice: ite.sumprice
552 553 }
553 554 listform.push(obj)
554 555 })
... ... @@ -777,6 +778,7 @@ Page({
777 778 goods_sn: th.data.bn_goods.goods_sn,
778 779 goods_price: th.data.bn_goods.shop_price || th.data.bn_goods.goods_price,
779 780 goods_num: th.data.bn_goods.buynum || th.data.bn_goods.goods_num,
  781 + sumprice:parseFloat(allpice).toFixed(2)
780 782 }],
781 783 sto: {
782 784 keyid: th.data.bn_goods.keyid
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -527,6 +527,8 @@ Page({
527 527 let obj = {
528 528 goods_sn:ite.goods_sn,
529 529 goods_id: ite.goods_id,
  530 + prom_type: ite.prom_type,
  531 + prom_id: ite.id,
530 532 goods_price: ite.goods_price, //account是平摊后的实收价格
531 533 goods_num: ite.goods_num,
532 534 sumgoods_price: ite.account_fir * ite.goods_num - ite.account_yu_fir-(ite.quan_num?ite.quan_num:0) //-- 优惠后的实收 --
... ... @@ -553,8 +555,8 @@ Page({
553 555 })
554 556 if (pt_res) {
555 557 for (let io = 0; io <new_arr.length ; io++) {
556   - new_arr[io].account_yc = this.arr_get_goods(new_arr[io].goods_id, pt_res).fisrt_account;
557   - new_arr[io].account_yc_yu = this.arr_get_goods(new_arr[io].goods_id, pt_res).fisrt_account_yu;
  558 + new_arr[io].account_yc = this.arr_get_goods_n(new_arr[io], pt_res).fisrt_account;
  559 + new_arr[io].account_yc_yu = this.arr_get_goods_n(new_arr[io], pt_res).fisrt_account_yu;
558 560 }
559 561 }
560 562  
... ... @@ -7118,6 +7120,15 @@ Page({
7118 7120 }
7119 7121 },
7120 7122  
  7123 +
  7124 + //从优惠的映射中拿出商品从表的item
  7125 + arr_get_goods_n: function (good, arr) {
  7126 + for (var i in arr) {
  7127 + if (arr[i].goods_id == good.goods_id && arr[i].prom_id == good.prom_id && arr[i].prom_type == good.prom_type ) return arr[i];
  7128 + }
  7129 + },
  7130 +
  7131 +
7121 7132 //检查是不是有其他门店的订单在选择了券
7122 7133 check_other_use: function (iter, pkid) {
7123 7134 var using = this.data.using_quan;
... ...
packageE/pages/cart/cart2_inte/cart2_inte.js
... ... @@ -357,7 +357,8 @@ Page({
357 357 let obj = {
358 358 wareno: ite.goods_sn,
359 359 price: ite.goods_price,
360   - qty: ite.goods_num
  360 + qty: ite.goods_num,
  361 + sumprice:ite.sumprice
361 362 }
362 363 listform.push(obj)
363 364 })
... ... @@ -970,6 +971,79 @@ Page({
970 971 }
971 972 })
972 973 }
  974 +
  975 +
  976 +
  977 + //判断是否同城配送,而且没有调用过
  978 + if(th.data.bn_exp_type==2 && th.data.user_addr) {
  979 +
  980 + var lon=0;var lat=0;
  981 + //-- 获取距离 --
  982 + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", {
  983 + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address,store_id:os.stoid}
  984 + }).then(res=>{
  985 + if(res.data.code==0){
  986 + var data= JSON.parse(res.data.data);
  987 + if(data.status==0){
  988 + lon=data.result.location.lng;
  989 + lat=data.result.location.lat;
  990 + }
  991 + }
  992 + })
  993 +
  994 +
  995 + var gd_w = good['weight'] * good['buynum'];
  996 + //-- 获取距离 --
  997 + var req_data = {
  998 + store_id: os.stoid,
  999 + order_amount: order_m,
  1000 + lon: lon, lat: lat,
  1001 + pickup_id: bn_pick,
  1002 + goods_weight: gd_w
  1003 + }
  1004 +
  1005 + var is_next=1;
  1006 + //获取同城配送参数
  1007 + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", {
  1008 + is_json: 1,
  1009 + data: req_data
  1010 + }).then(res => {
  1011 + if (res.data.code == 0) {
  1012 + var wl_txt = "formData.shipping_price";
  1013 + th.setData({ [wl_txt]: res.data.data, })
  1014 + }else{
  1015 + is_next=0;
  1016 + wx.showToast({
  1017 + title: res.data.msg, icon: 'none', duration: 2000
  1018 + })
  1019 + }
  1020 + })
  1021 + if(!is_next){
  1022 + th.setData({is_show_sub:1, submit: 0,same_ok:0,show_submit:1})
  1023 + return false
  1024 + }
  1025 +
  1026 + th.data.lon=lon;
  1027 + th.data.lat=lat;
  1028 + th.data.bn_gd_w=gd_w;
  1029 + th.data.bn_samecity_order_amount=req_data.order_amount;
  1030 +
  1031 + }
  1032 +
  1033 +
  1034 +
  1035 + var yc_order_m=order_m;
  1036 +
  1037 + //--看一下有没有订单优惠--0
  1038 + total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
  1039 + order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price);
  1040 + var atxt = "formData.total_amount";
  1041 + th.setData({ [atxt]: total_m, })
  1042 +
  1043 + var txt = "formData.user_money";
  1044 + var txt2 = "formData.order_amount";
  1045 + var txt4 = "formData.integral";
  1046 +
973 1047 if (th.data.bn_goods.keyid) {
974 1048 let cart_yc = await th.beforAdvancesum({
975 1049 order_amount: order_m,
... ... @@ -977,6 +1051,7 @@ Page({
977 1051 goods_sn: th.data.bn_goods.goods_sn,
978 1052 goods_price: th.data.bn_goods.shop_price || th.data.bn_goods.goods_price,
979 1053 goods_num: th.data.bn_goods.buynum || th.data.bn_goods.goods_num,
  1054 + sumprice:parseFloat(yc_order_m).toFixed(2)
980 1055 }],
981 1056 sto: {
982 1057 keyid: th.data.bn_goods.keyid
... ... @@ -1044,73 +1119,7 @@ Page({
1044 1119 })
1045 1120 }
1046 1121  
1047   - //判断是否同城配送,而且没有调用过
1048   - if(th.data.bn_exp_type==2 && th.data.user_addr) {
1049 1122  
1050   - var lon=0;var lat=0;
1051   - //-- 获取距离 --
1052   - await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", {
1053   - is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address,store_id:os.stoid}
1054   - }).then(res=>{
1055   - if(res.data.code==0){
1056   - var data= JSON.parse(res.data.data);
1057   - if(data.status==0){
1058   - lon=data.result.location.lng;
1059   - lat=data.result.location.lat;
1060   - }
1061   - }
1062   - })
1063   -
1064   -
1065   - var gd_w = good['weight'] * good['buynum'];
1066   - //-- 获取距离 --
1067   - var req_data = {
1068   - store_id: os.stoid,
1069   - order_amount: order_m,
1070   - lon: lon, lat: lat,
1071   - pickup_id: bn_pick,
1072   - goods_weight: gd_w
1073   - }
1074   -
1075   - var is_next=1;
1076   - //获取同城配送参数
1077   - await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", {
1078   - is_json: 1,
1079   - data: req_data
1080   - }).then(res => {
1081   - if (res.data.code == 0) {
1082   - var wl_txt = "formData.shipping_price";
1083   - th.setData({ [wl_txt]: res.data.data, })
1084   - }else{
1085   - is_next=0;
1086   - wx.showToast({
1087   - title: res.data.msg, icon: 'none', duration: 2000
1088   - })
1089   - }
1090   - })
1091   - if(!is_next){
1092   - th.setData({is_show_sub:1, submit: 0,same_ok:0,show_submit:1})
1093   - return false
1094   - }
1095   -
1096   - th.data.lon=lon;
1097   - th.data.lat=lat;
1098   - th.data.bn_gd_w=gd_w;
1099   - th.data.bn_samecity_order_amount=req_data.order_amount;
1100   -
1101   - }
1102   -
1103   -
1104   -
1105   - //--看一下有没有订单优惠--0
1106   - total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
1107   - order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price);
1108   - var atxt = "formData.total_amount";
1109   - th.setData({ [atxt]: total_m, })
1110   -
1111   - var txt = "formData.user_money";
1112   - var txt2 = "formData.order_amount";
1113   - var txt4 = "formData.integral";
1114 1123  
1115 1124  
1116 1125 //-- 最后的金额小于佣金 --
... ...
packageE/pages/cart/cart2_pt/cart2_pt.js
... ... @@ -260,7 +260,8 @@ Page({
260 260 let obj = {
261 261 wareno: ite.goods_sn,
262 262 price: ite.goods_price,
263   - qty: ite.goods_num
  263 + qty: ite.goods_num,
  264 + sumprice:ite.sumprice
264 265 }
265 266 listform.push(obj)
266 267 })
... ... @@ -1042,6 +1043,7 @@ Page({
1042 1043 goods_sn: th.data.bn_goods.goods_sn,
1043 1044 goods_price: th.data.bn_goods.shop_price || th.data.bn_goods.goods_price,
1044 1045 goods_num: th.data.bn_goods.buynum || th.data.bn_goods.goods_num,
  1046 + sumprice:parseFloat(allpice).toFixed(2)
1045 1047 }],
1046 1048 sto: {
1047 1049 keyid: th.data.bn_goods.keyid
... ...