Commit 1a94a0666e4a61ade1efb02829fdf8d9f11e0cf5

Authored by 泉州测试
2 parents 9c0ca7e1 d3963a46

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -1374,11 +1374,13 @@ Page({ @@ -1374,11 +1374,13 @@ Page({
1374 o_price += item[j].goods_price * item[j].goods_num; 1374 o_price += item[j].goods_price * item[j].goods_num;
1375 1375
1376 //判断是否有设置限制重量包邮 1376 //判断是否有设置限制重量包邮
1377 - if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){ 1377 + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2){
1378 if (goods_weight < 0) goods_weight = 0; 1378 if (goods_weight < 0) goods_weight = 0;
1379 //累积商品重量 每种商品的重量 * 数量 1379 //累积商品重量 每种商品的重量 * 数量
1380 goods_weight += item[j]['weight'] * item[j]['goods_num']; 1380 goods_weight += item[j]['weight'] * item[j]['goods_num'];
1381 - out_of_weight = (weight_free*1000) - goods_weight; 1381 + if(weight_free > 0){
  1382 + out_of_weight = (weight_free*1000) - goods_weight;
  1383 + }
1382 } 1384 }
1383 } 1385 }
1384 //判断是不是有组合购的金额 1386 //判断是不是有组合购的金额
@@ -1898,6 +1900,7 @@ Page({ @@ -1898,6 +1900,7 @@ Page({
1898 if (res.data.data[0].region_list) { 1900 if (res.data.data[0].region_list) {
1899 if (th.check_by_area(res.data.data[0].region_list)) { 1901 if (th.check_by_area(res.data.data[0].region_list)) {
1900 freight_free = 0; 1902 freight_free = 0;
  1903 + out_of_weight=0;
1901 th.data.is_no_by[th.data.bn_pick] = 1; 1904 th.data.is_no_by[th.data.bn_pick] = 1;
1902 } 1905 }
1903 } 1906 }
@@ -1905,6 +1908,7 @@ Page({ @@ -1905,6 +1908,7 @@ Page({
1905 if (res.data.data[0].goods_list && freight_free) { 1908 if (res.data.data[0].goods_list && freight_free) {
1906 if (th.check_by_goods(res.data.data[0].goods_list)) { 1909 if (th.check_by_goods(res.data.data[0].goods_list)) {
1907 freight_free = 0; 1910 freight_free = 0;
  1911 + out_of_weight=0;
1908 th.data.is_no_by[th.data.bn_pick] = 1; 1912 th.data.is_no_by[th.data.bn_pick] = 1;
1909 } 1913 }
1910 } 1914 }
@@ -3791,6 +3795,7 @@ Page({ @@ -3791,6 +3795,7 @@ Page({
3791 if (no_by_data && no_by_data.region_list) { 3795 if (no_by_data && no_by_data.region_list) {
3792 if (th.check_by_area(no_by_data.region_list)) { 3796 if (th.check_by_area(no_by_data.region_list)) {
3793 gift_freight_free = 0; 3797 gift_freight_free = 0;
  3798 + out_of_weight=0;
3794 th.data.is_no_by[th.data.bn_pick] = 1; 3799 th.data.is_no_by[th.data.bn_pick] = 1;
3795 } 3800 }
3796 } 3801 }
@@ -3798,12 +3803,13 @@ Page({ @@ -3798,12 +3803,13 @@ Page({
3798 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 3803 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
3799 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 3804 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
3800 gift_freight_free = 0; 3805 gift_freight_free = 0;
  3806 + out_of_weight=0;
3801 //th.data.is_no_by[th.data.bn_pick]=1; 3807 //th.data.is_no_by[th.data.bn_pick]=1;
3802 } 3808 }
3803 } 3809 }
3804 3810
3805 var t_shipping_price = 3811 var t_shipping_price =
3806 - this.calculatewuliu(code, gift_shipping_price, goods_weight, 3812 + this.calculatewuliu(code, gift_shipping_price, goods_weight,out_of_weight,
3807 goods_piece, user_addr, gift_freight_free, allpice, rs); 3813 goods_piece, user_addr, gift_freight_free, allpice, rs);
3808 return t_shipping_price; 3814 return t_shipping_price;
3809 3815
packageC/pages/presell/cart/cart.js
@@ -112,34 +112,34 @@ Page({ @@ -112,34 +112,34 @@ Page({
112 tabs: ['门店自提', '快递邮寄'], 112 tabs: ['门店自提', '快递邮寄'],
113 currentTabIndex: 1, 113 currentTabIndex: 1,
114 114
115 - order_sn:'',  
116 - order_id:'', 115 + order_sn: '',
  116 + order_id: '',
117 117
118 }, 118 },
119 onLoad: function (t) { 119 onLoad: function (t) {
120 -  
121 - if(t.order_id) this.data.order_id=t.order_id;  
122 - if(t.order_sn) this.data.order_sn=t.order_sn;  
123 120
124 - wx.setNavigationBarTitle({title: "订单详情",}) 121 + if (t.order_id) this.data.order_id = t.order_id;
  122 + if (t.order_sn) this.data.order_sn = t.order_sn;
  123 +
  124 + wx.setNavigationBarTitle({ title: "订单详情", })
125 var th = this; 125 var th = this;
126 - this.setData({is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); 126 + this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, });
127 th.data.param = t; 127 th.data.param = t;
128 //清理一下,确保最新的系统配置 128 //清理一下,确保最新的系统配置
129 getApp().globalData.config2 = null; 129 getApp().globalData.config2 = null;
130 //清空is_pick_up 130 //清空is_pick_up
131 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 131 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
132 - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, 132 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
133 success: function (s) { 133 success: function (s) {
134 } 134 }
135 }); 135 });
136 - if(!getApp().globalData.userInfo){ 136 + if (!getApp().globalData.userInfo) {
137 getApp().goto("/pages/togoin/togoin"); 137 getApp().goto("/pages/togoin/togoin");
138 } 138 }
139 139
140 }, 140 },
141 onUnload: function () { 141 onUnload: function () {
142 - this.setData({isclose: 1}) 142 + this.setData({ isclose: 1 })
143 }, 143 },
144 onHide: function () { 144 onHide: function () {
145 this.setData({ 145 this.setData({
@@ -152,13 +152,13 @@ Page({ @@ -152,13 +152,13 @@ Page({
152 //----------子页返回父页触发---------- 152 //----------子页返回父页触发----------
153 onShow: function () { 153 onShow: function () {
154 var th = this; 154 var th = this;
155 - th.setData({show_submit: 0}); //让提交先掩藏 155 + th.setData({ show_submit: 0 }); //让提交先掩藏
156 th.data.g_cart_q_time = null; 156 th.data.g_cart_q_time = null;
157 if (th.data.isclose == 0) { 157 if (th.data.isclose == 0) {
158 wx.navigateTo({ 158 wx.navigateTo({
159 - url:"/pages/index/index/index" 159 + url: "/pages/index/index/index"
160 }) 160 })
161 - }else{ 161 + } else {
162 this.getuser_addr(function (ie) { 162 this.getuser_addr(function (ie) {
163 //地址切换要把包邮券清空 163 //地址切换要把包邮券清空
164 if (!th.data.user_addr || !ie || th.data.user_addr.address_id != ie.address_id) { 164 if (!th.data.user_addr || !ie || th.data.user_addr.address_id != ie.address_id) {
@@ -178,16 +178,16 @@ Page({ @@ -178,16 +178,16 @@ Page({
178 th.data.prom_goods_map = {}; 178 th.data.prom_goods_map = {};
179 th.data.is_summit_ing = 0; 179 th.data.is_summit_ing = 0;
180 //更换地址回来要重新调用计算价钱的接口 180 //更换地址回来要重新调用计算价钱的接口
181 - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id){  
182 - th.setData({user_addr: ie});  
183 - th.setData({add_back: 1});  
184 - th.calculatePrice2(); 181 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  182 + th.setData({ user_addr: ie });
  183 + th.setData({ add_back: 1 });
  184 + th.calculatePrice2();
185 } else { 185 } else {
186 - th.setData({user_addr: ie}); 186 + th.setData({ user_addr: ie });
187 } 187 }
188 var going = 0; 188 var going = 0;
189 }); 189 });
190 - 190 +
191 var is_card_back = getApp().globalData.is_card_back; 191 var is_card_back = getApp().globalData.is_card_back;
192 //--更新默认地址--,看一下是不是跳到地址页面,同时也不是购买等级卡返回的,这里很重要,否则会重新更新收货物流公司 192 //--更新默认地址--,看一下是不是跳到地址页面,同时也不是购买等级卡返回的,这里很重要,否则会重新更新收货物流公司
193 if (!getApp().globalData.is_cart_old && !is_card_back && !getApp().globalData.plus_buy_back) { 193 if (!getApp().globalData.is_cart_old && !is_card_back && !getApp().globalData.plus_buy_back) {
@@ -210,7 +210,7 @@ Page({ @@ -210,7 +210,7 @@ Page({
210 sales_rules: ee.sales_rules, 210 sales_rules: ee.sales_rules,
211 rank_switch: json_d.rank_switch, 211 rank_switch: json_d.rank_switch,
212 is_default_logistics: is_default_logistics, 212 is_default_logistics: is_default_logistics,
213 - sys_switch:json_d, 213 + sys_switch: json_d,
214 }); 214 });
215 215
216 var rank_switch = json_d.rank_switch; 216 var rank_switch = json_d.rank_switch;
@@ -223,34 +223,34 @@ Page({ @@ -223,34 +223,34 @@ Page({
223 //-- 获取所有的等级卡, -- 223 //-- 获取所有的等级卡, --
224 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, 224 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
225 {}).then(res => { 225 {}).then(res => {
226 - if (res.data.code == 0) {  
227 - var plusCard = res.data.data;  
228 - //-- 循环判断,拿到最贵的那张卡 --  
229 - for (var ih in plusCard) {  
230 - if (plusCard[ih].IsStopBuy == true) {  
231 - continue;  
232 - }  
233 - if (max_price < 0) {  
234 - max_price = plusCard[ih].CardFee;  
235 - name = 'card' + plusCard[ih]['CorrPrice'];  
236 - show_card = plusCard[ih];  
237 - } else {  
238 - if (max_price < plusCard[ih].CardFee) { 226 + if (res.data.code == 0) {
  227 + var plusCard = res.data.data;
  228 + //-- 循环判断,拿到最贵的那张卡 --
  229 + for (var ih in plusCard) {
  230 + if (plusCard[ih].IsStopBuy == true) {
  231 + continue;
  232 + }
  233 + if (max_price < 0) {
239 max_price = plusCard[ih].CardFee; 234 max_price = plusCard[ih].CardFee;
240 name = 'card' + plusCard[ih]['CorrPrice']; 235 name = 'card' + plusCard[ih]['CorrPrice'];
241 show_card = plusCard[ih]; 236 show_card = plusCard[ih];
  237 + } else {
  238 + if (max_price < plusCard[ih].CardFee) {
  239 + max_price = plusCard[ih].CardFee;
  240 + name = 'card' + plusCard[ih]['CorrPrice'];
  241 + show_card = plusCard[ih];
  242 + }
242 } 243 }
243 } 244 }
244 - }  
245 245
246 - if (show_card) {  
247 - name = name.toLowerCase();  
248 - th.setData({card_name: name, show_card: show_card}) 246 + if (show_card) {
  247 + name = name.toLowerCase();
  248 + th.setData({ card_name: name, show_card: show_card })
  249 + }
249 } 250 }
250 - }  
251 - //-----先获取物流,再获取用户信息,再展示页面-----  
252 - th.get_wuliu(th.get_info(th.show_page));  
253 - }) 251 + //-----先获取物流,再获取用户信息,再展示页面-----
  252 + th.get_wuliu(th.get_info(th.show_page));
  253 + })
254 } else { 254 } else {
255 //-----先获取物流,再获取用户信息,再展示页面----- 255 //-----先获取物流,再获取用户信息,再展示页面-----
256 th.get_wuliu(th.get_info(th.show_page)); 256 th.get_wuliu(th.get_info(th.show_page));
@@ -270,10 +270,10 @@ Page({ @@ -270,10 +270,10 @@ Page({
270 if (th.data.is_default_logistics) { 270 if (th.data.is_default_logistics) {
271 //如果第一个不是开启默认,说明要让用户自己选 271 //如果第一个不是开启默认,说明要让用户自己选
272 if (!e[0].is_default) { 272 if (!e[0].is_default) {
273 - th.setData({is_default_logistics: 0}); 273 + th.setData({ is_default_logistics: 0 });
274 } 274 }
275 } 275 }
276 - th.setData({wu_arr: e}) 276 + th.setData({ wu_arr: e })
277 typeof func == "function" && func(); 277 typeof func == "function" && func();
278 }) 278 })
279 }, 279 },
@@ -287,9 +287,9 @@ Page({ @@ -287,9 +287,9 @@ Page({
287 getuser_addr: function (func) { 287 getuser_addr: function (func) {
288 var th = this; 288 var th = this;
289 a.get("/api/weshop/useraddress/page", { 289 a.get("/api/weshop/useraddress/page", {
290 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, 290 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() },
291 success: function (su) { 291 success: function (su) {
292 - 292 +
293 var item = null; 293 var item = null;
294 if (su.data.code == 0 && su.data.data && su.data.data.pageData) { 294 if (su.data.code == 0 && su.data.data && su.data.data.pageData) {
295 var user_addr = su.data.data.pageData; 295 var user_addr = su.data.data.pageData;
@@ -308,7 +308,7 @@ Page({ @@ -308,7 +308,7 @@ Page({
308 } 308 }
309 309
310 if (item == undefined) item = null; 310 if (item == undefined) item = null;
311 - if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 311 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存
312 312
313 func(item); 313 func(item);
314 } 314 }
@@ -336,7 +336,7 @@ Page({ @@ -336,7 +336,7 @@ Page({
336 }); 336 });
337 } 337 }
338 //获取立即购买的商品信息 338 //获取立即购买的商品信息
339 - th.get_buy_goods(th.data.order_id,th.data.order_sn); 339 + th.get_buy_goods(th.data.order_id, th.data.order_sn);
340 }); 340 });
341 //获取提现金额 341 //获取提现金额
342 getApp().request.get("/api/weshop/withdrawals/summoney", { 342 getApp().request.get("/api/weshop/withdrawals/summoney", {
@@ -360,30 +360,30 @@ Page({ @@ -360,30 +360,30 @@ Page({
360 }, 360 },
361 361
362 //-----获取商品------ 362 //-----获取商品------
363 - async get_buy_goods(ord,o_sn) { 363 + async get_buy_goods(ord, o_sn) {
364 var order = null, 364 var order = null,
365 order_goods = null, 365 order_goods = null,
366 goods = null, 366 goods = null,
367 pickup = null, 367 pickup = null,
368 distr_type = 0, 368 distr_type = 0,
369 exp_type = 0, 369 exp_type = 0,
370 - presell=null, //订单从表  
371 - pre_arr=null, //订单内容  
372 - act=null, //订单内容 370 + presell = null, //订单从表
  371 + pre_arr = null, //订单内容
  372 + act = null, //订单内容
373 th = this; 373 th = this;
374 374
375 375
376 - if(o_sn){ 376 + if (o_sn) {
377 //获取order信息根据订单编号order_sn 377 //获取order信息根据订单编号order_sn
378 await getApp().request.promiseGet("/api/weshop/order/page", { 378 await getApp().request.promiseGet("/api/weshop/order/page", {
379 - data: { store_id: os.stoid, order_sn: o_sn,} 379 + data: { store_id: os.stoid, order_sn: o_sn, }
380 }).then(res => { 380 }).then(res => {
381 order = res.data.data.pageData[0]; 381 order = res.data.data.pageData[0];
382 }) 382 })
383 383
384 384
385 - ord=order.order_id;  
386 - }else{ 385 + ord = order.order_id;
  386 + } else {
387 //---获取订单--- 387 //---获取订单---
388 await getApp().request.promiseGet("/api/weshop/order/get/" + oo.stoid + "/" + ord, {}).then(res => { 388 await getApp().request.promiseGet("/api/weshop/order/get/" + oo.stoid + "/" + ord, {}).then(res => {
389 order = res.data.data; 389 order = res.data.data;
@@ -399,94 +399,94 @@ Page({ @@ -399,94 +399,94 @@ Page({
399 order_goods = res.data.data.pageData[0]; 399 order_goods = res.data.data.pageData[0];
400 }); 400 });
401 401
402 - await getApp().request.promiseGet("/api/weshop/order/orderPresell/get/"+oo.stoid+"/"+order.order_id, {}).then(res => { 402 + await getApp().request.promiseGet("/api/weshop/order/orderPresell/get/" + oo.stoid + "/" + order.order_id, {}).then(res => {
403 presell = res.data.data; 403 presell = res.data.data;
404 }); 404 });
405 405
406 //等待定金 406 //等待定金
407 - if(order.order_status<2 && presell.deposit_pay_time<=0 ){  
408 - th.setData({wait_dj:1}) 407 + if (order.order_status < 2 && presell.deposit_pay_time <= 0) {
  408 + th.setData({ wait_dj: 1 })
409 } 409 }
410 //等待尾款 410 //等待尾款
411 - if(order.order_status<2 && presell.deposit_pay_time>0 && presell.tail_pay_state==0 && presell.presell_type!=1){  
412 - th.setData({wait_wk:1})  
413 - wx.setNavigationBarTitle({title: "支付尾款",}) 411 + if (order.order_status < 2 && presell.deposit_pay_time > 0 && presell.tail_pay_state == 0 && presell.presell_type != 1) {
  412 + th.setData({ wait_wk: 1 })
  413 + wx.setNavigationBarTitle({ title: "支付尾款", })
414 } 414 }
415 //等待发货 415 //等待发货
416 - if(order.pay_status==1 && order.shipping_status==0){  
417 - th.setData({wait_fh:1}) 416 + if (order.pay_status == 1 && order.shipping_status == 0) {
  417 + th.setData({ wait_fh: 1 })
418 } 418 }
419 419
420 - if(order.pay_status==1 && order.shipping_status==1 && order.order_status<2){  
421 - th.setData({wait_sh:1}) 420 + if (order.pay_status == 1 && order.shipping_status == 1 && order.order_status < 2) {
  421 + th.setData({ wait_sh: 1 })
422 } 422 }
423 //------获取预售主表---------- 423 //------获取预售主表----------
424 - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellForm/get/"+os.stoid+"/"+presell.prom_id, {}).then(res => { 424 + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + presell.prom_id, {}).then(res => {
425 if (res.data.code == 0 && res.data.data) { 425 if (res.data.code == 0 && res.data.data) {
426 - act=res.data.data; 426 + act = res.data.data;
427 427
428 th.setData({ 428 th.setData({
429 - act: res.data.data, 429 + act: res.data.data,
430 }); 430 });
431 } 431 }
432 }) 432 })
433 433
434 //-- 判断一下会员的身份 -- 434 //-- 判断一下会员的身份 --
435 - if(order.pay_status==0){  
436 - var pre_data = { store_id: os.stoid, presell_id: presell.prom_id,timetype: 12, goods_id: order_goods.goods_id }; 435 + if (order.pay_status == 0) {
  436 + var pre_data = { store_id: os.stoid, presell_id: presell.prom_id, timetype: 12, goods_id: order_goods.goods_id };
437 pre_data.user_id = order.user_id; 437 pre_data.user_id = order.user_id;
438 - var isok=1; 438 + var isok = 1;
439 await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { 439 await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
440 data: pre_data, 440 data: pre_data,
441 }).then(e => { 441 }).then(e => {
442 if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { 442 if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
443 pre_arr = e.data.data.pageData[0]; 443 pre_arr = e.data.data.pageData[0];
444 - }else{  
445 - isok=0; 444 + } else {
  445 + isok = 0;
446 } 446 }
447 }) 447 })
448 448
449 - if(!isok){ 449 + if (!isok) {
450 getApp().confirmBox("会员身份不符合"); 450 getApp().confirmBox("会员身份不符合");
451 return false; 451 return false;
452 } 452 }
453 453
454 - if(th.data.wait_dj){  
455 - if(act.is_end) { 454 + if (th.data.wait_dj) {
  455 + if (act.is_end) {
456 getApp().confirmBox("活动已经结束"); 456 getApp().confirmBox("活动已经结束");
457 return false; 457 return false;
458 } 458 }
459 - if(!act.isuse) { 459 + if (!act.isuse) {
460 getApp().confirmBox("活动未启用"); 460 getApp().confirmBox("活动未启用");
461 return false; 461 return false;
462 } 462 }
463 - if(th.data.act.end_time<ut.gettimestamp()) {  
464 - getApp().confirmBox("活动的定金时间已经结束",function () { 463 + if (th.data.act.end_time < ut.gettimestamp()) {
  464 + getApp().confirmBox("活动的定金时间已经结束", function () {
465 ut.wx_back(); 465 ut.wx_back();
466 }); 466 });
467 return false; 467 return false;
468 } 468 }
469 469
470 } 470 }
471 - if(th.data.wait_wk){  
472 - if(th.data.act.pay_enddate<ut.gettimestamp()) {  
473 - getApp().confirmBox("活动的尾款时间已经结束",function () { 471 + if (th.data.wait_wk) {
  472 + if (th.data.act.pay_enddate < ut.gettimestamp()) {
  473 + getApp().confirmBox("活动的尾款时间已经结束", function () {
474 ut.wx_back(); 474 ut.wx_back();
475 }); 475 });
476 return false; 476 return false;
477 } 477 }
478 } 478 }
479 } 479 }
480 - else{  
481 - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/list",{  
482 - data:{store_id:os.stoid,goods_id:order_goods.goods_id,presell_id:order_goods.prom_id}  
483 - }).then(re=>{ 480 + else {
  481 + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/list", {
  482 + data: { store_id: os.stoid, goods_id: order_goods.goods_id, presell_id: order_goods.prom_id }
  483 + }).then(re => {
484 if (re.data.code == 0 && re.data.data && re.data.data.length > 0) { 484 if (re.data.code == 0 && re.data.data && re.data.data.length > 0) {
485 pre_arr = re.data.data[0]; 485 pre_arr = re.data.data[0];
486 } 486 }
487 }) 487 })
488 488
489 - if(!pre_arr){ 489 + if (!pre_arr) {
490 getApp().confirmBox("未找到商品"); 490 getApp().confirmBox("未找到商品");
491 return false; 491 return false;
492 } 492 }
@@ -498,28 +498,29 @@ Page({ @@ -498,28 +498,29 @@ Page({
498 order.market_price = goods.market_price; 498 order.market_price = goods.market_price;
499 order.show_img = oo.imghost + goods.original_img; 499 order.show_img = oo.imghost + goods.original_img;
500 }); 500 });
501 -  
502 -  
503 - var g_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id+"&pre_id="+pre_arr.id;  
504 - if(act.is_end || th.data.act.end_time<ut.gettimestamp()) {  
505 -  
506 - if(goods.prom_type==8 && goods.prom_id==act.id){  
507 - g_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id;  
508 - getApp().request.put("/api/weshop/goods/update",  
509 - { data:{goods_id:order_goods.goods_id,store_id:os.stoid,prom_id:0,prom_type:0},  
510 - success: function(e) {}  
511 - });  
512 - }else{  
513 - g_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id;  
514 - if(goods.prom_type==8){  
515 - g_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id+"&prom_id="+goods.prom_id;  
516 - }  
517 -  
518 - }  
519 -  
520 - }  
521 -  
522 - 501 +
  502 +
  503 + var g_url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id + "&pre_id=" + pre_arr.id;
  504 + if (act.is_end || th.data.act.end_time < ut.gettimestamp()) {
  505 +
  506 + if (goods.prom_type == 8 && goods.prom_id == act.id) {
  507 + g_url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id;
  508 + getApp().request.put("/api/weshop/goods/update",
  509 + {
  510 + data: { goods_id: order_goods.goods_id, store_id: os.stoid, prom_id: 0, prom_type: 0 },
  511 + success: function (e) { }
  512 + });
  513 + } else {
  514 + g_url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id;
  515 + if (goods.prom_type == 8) {
  516 + g_url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id + "&prom_id=" + goods.prom_id;
  517 + }
  518 +
  519 + }
  520 +
  521 + }
  522 +
  523 +
523 //判断使用优惠券的接口需要 524 //判断使用优惠券的接口需要
524 th.data.check_quan_ware_list = goods.erpwareid; 525 th.data.check_quan_ware_list = goods.erpwareid;
525 //---获取门店--- 526 //---获取门店---
@@ -529,30 +530,32 @@ Page({ @@ -529,30 +530,32 @@ Page({
529 530
530 order['is_all_return'] = 0; 531 order['is_all_return'] = 0;
531 //------------对比一下有没有退款记录------------ 532 //------------对比一下有没有退款记录------------
532 - await getApp().request.promiseGet("/api/weshop/order/returngoods/page",{  
533 - data: { order_id: order.order_id, store_id: oo.stoid,  
534 - user_id:order.user_id, pageSize: 200 }  
535 - }).then(rss=>{  
536 - var ttd=rss; 533 + await getApp().request.promiseGet("/api/weshop/order/returngoods/page", {
  534 + data: {
  535 + order_id: order.order_id, store_id: oo.stoid,
  536 + user_id: order.user_id, pageSize: 200
  537 + }
  538 + }).then(rss => {
  539 + var ttd = rss;
537 //----没有相关的退款记录---- 540 //----没有相关的退款记录----
538 - if (ttd.data.data.total==0){ 541 + if (ttd.data.data.total == 0) {
539 order['is_all_return'] = 0; 542 order['is_all_return'] = 0;
540 - }else{ 543 + } else {
541 var eea = ttd.data.data.pageData[0]; 544 var eea = ttd.data.data.pageData[0];
542 //1.退款正在进行中, 545 //1.退款正在进行中,
543 //2.退款被拒绝就要显示可以退款 546 //2.退款被拒绝就要显示可以退款
544 //3.退款已经完成 547 //3.退款已经完成
545 - order['is_all_return']=1; 548 + order['is_all_return'] = 1;
546 order['is_all_return_status'] = ttd.data.data.pageData[0].status; 549 order['is_all_return_status'] = ttd.data.data.pageData[0].status;
547 550
548 if (order['order_status'] == 1 && order['pay_status'] == 1) { 551 if (order['order_status'] == 1 && order['pay_status'] == 1) {
549 switch (eea.status) { 552 switch (eea.status) {
550 case 0: 553 case 0:
551 case 1: 554 case 1:
552 - order.order_status_detail="退款中"; 555 + order.order_status_detail = "退款中";
553 order['return_btn'] = 2; break; 556 order['return_btn'] = 2; break;
554 case 2: 557 case 2:
555 - order.order_status_detail="退款完成"; 558 + order.order_status_detail = "退款完成";
556 order['return_btn'] = 4; break; 559 order['return_btn'] = 4; break;
557 case 3: 560 case 3:
558 order['return_btn'] = 3; break; 561 order['return_btn'] = 3; break;
@@ -563,8 +566,8 @@ Page({ @@ -563,8 +566,8 @@ Page({
563 } 566 }
564 }) 567 })
565 568
566 - var price=presell.presell_price;  
567 - if(!goods) return false; 569 + var price = presell.presell_price;
  570 + if (!goods) return false;
568 //--判断物流-- 571 //--判断物流--
569 if (goods.distr_type) 572 if (goods.distr_type)
570 distr_type = goods.distr_type; 573 distr_type = goods.distr_type;
@@ -587,50 +590,50 @@ Page({ @@ -587,50 +590,50 @@ Page({
587 } 590 }
588 591
589 //等待发货的时候 592 //等待发货的时候
590 - if(th.data.wait_fh){  
591 - var send_time=th.data.act.delivery_date;  
592 - if(th.data.act.delivery_type==2){  
593 - send_time=ut.gettimestamp()+th.data.act.delivery_daynum*3600*24;  
594 - } 593 + if (th.data.wait_fh) {
  594 + var send_time = th.data.act.delivery_date;
  595 + if (th.data.act.delivery_type == 2) {
  596 + send_time = ut.gettimestamp() + th.data.act.delivery_daynum * 3600 * 24;
  597 + }
595 } 598 }
596 599
597 order.order_goods = order_goods; 600 order.order_goods = order_goods;
598 - var tail_pay=pre_arr.presell_price*order_goods.goods_num-presell.presell_deposit; 601 + var tail_pay = pre_arr.presell_price * order_goods.goods_num - presell.presell_deposit;
599 this.setData({ 602 this.setData({
600 order: order, 603 order: order,
601 distr_type: distr_type, 604 distr_type: distr_type,
602 pickup: pickup, 605 pickup: pickup,
603 exp_type: exp_type, 606 exp_type: exp_type,
604 goods: goods, 607 goods: goods,
605 - presell:presell,  
606 - pre_arr:pre_arr,  
607 - show_submit:1,  
608 - userInfo:getApp().globalData.userInfo,  
609 - tail_pay:tail_pay,  
610 - order_goods:order_goods,  
611 - all_price:pre_arr.presell_price*order_goods.goods_num,  
612 - pickup_id:pickup.pickup_id,  
613 - send_time:send_time,  
614 - g_url:g_url 608 + presell: presell,
  609 + pre_arr: pre_arr,
  610 + show_submit: 1,
  611 + userInfo: getApp().globalData.userInfo,
  612 + tail_pay: tail_pay,
  613 + order_goods: order_goods,
  614 + all_price: pre_arr.presell_price * order_goods.goods_num,
  615 + pickup_id: pickup.pickup_id,
  616 + send_time: send_time,
  617 + g_url: g_url
615 }); 618 });
616 th.get_diff(); 619 th.get_diff();
617 //统一进行计算金额 620 //统一进行计算金额
618 th.calculatePrice2(); 621 th.calculatePrice2();
619 //如果可以 622 //如果可以
620 - if(th.data.act.is_usecoupon){ 623 + if (th.data.act.is_usecoupon) {
621 th.get_buy_now_quan(); 624 th.get_buy_now_quan();
622 } 625 }
623 }, 626 },
624 627
625 628
626 - async calculatePrice2(){  
627 - var th=this;  
628 - if(!this.data.pre_arr) return false; 629 + async calculatePrice2() {
  630 + var th = this;
  631 + if (!this.data.pre_arr) return false;
629 //--计算物流-- 632 //--计算物流--
630 if (this.data.exp_type == 0) { 633 if (this.data.exp_type == 0) {
631 this.calculate_wuliu(); 634 this.calculate_wuliu();
632 } else { 635 } else {
633 - var allpice =this.data.pre_arr.presell_price*this.data.order_goods.goods_num; 636 + var allpice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num;
634 allpice = allpice.toFixed(2); 637 allpice = allpice.toFixed(2);
635 //--看一下有没有订单优惠-- 638 //--看一下有没有订单优惠--
636 var o_condition = parseFloat(allpice); 639 var o_condition = parseFloat(allpice);
@@ -654,37 +657,37 @@ Page({ @@ -654,37 +657,37 @@ Page({
654 quan_price = res.data.data[0].WareCashSum; 657 quan_price = res.data.data[0].WareCashSum;
655 } 658 }
656 }) 659 })
657 - }else{  
658 - th.setData({quan_price:0});  
659 - if(th.data.using_quan && th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby==1){  
660 - var txt="using_quan["+bn_pick+"]";  
661 - th.setData({[txt]:{}}); 660 + } else {
  661 + th.setData({ quan_price: 0 });
  662 + if (th.data.using_quan && th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby == 1) {
  663 + var txt = "using_quan[" + bn_pick + "]";
  664 + th.setData({ [txt]: {} });
662 } 665 }
663 666
664 } 667 }
665 668
666 - if(quan_price>0){  
667 - if (quan_price < th.data.tail_pay) th.setData({quan_price: quan_price})  
668 - else {  
669 - th.setData({quan_price: th.data.tail_pay})  
670 - }  
671 - o_condition=o_condition-quan_price; 669 + if (quan_price > 0) {
  670 + if (quan_price < th.data.tail_pay) th.setData({ quan_price: quan_price })
  671 + else {
  672 + th.setData({ quan_price: th.data.tail_pay })
  673 + }
  674 + o_condition = o_condition - quan_price;
672 675
673 - }else{  
674 - th.setData({quan_price: 0}) 676 + } else {
  677 + th.setData({ quan_price: 0 })
675 } 678 }
676 - if(o_condition<0) o_condition=0; 679 + if (o_condition < 0) o_condition = 0;
677 680
678 //如果同意参与订单优惠 681 //如果同意参与订单优惠
679 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { 682 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) {
680 th.check_is_order_prom(o_condition, function (ord_price) { 683 th.check_is_order_prom(o_condition, function (ord_price) {
681 - var bn_pick=th.data.pickup.pickup_id 684 + var bn_pick = th.data.pickup.pickup_id
682 var order_prom_amount = 0; 685 var order_prom_amount = 0;
683 var order_prom_id = 0; 686 var order_prom_id = 0;
684 - var o_condition1=0; 687 + var o_condition1 = 0;
685 if (th.data.order_prom[bn_pick]) { 688 if (th.data.order_prom[bn_pick]) {
686 var ord_prom = th.data.order_prom[bn_pick]; 689 var ord_prom = th.data.order_prom[bn_pick];
687 - if(!ord_prom.is_xz_yh || quan_price<=0) { 690 + if (!ord_prom.is_xz_yh || quan_price <= 0) {
688 order_prom_id = ord_prom['id']; 691 order_prom_id = ord_prom['id'];
689 switch (ord_prom['type']) { 692 switch (ord_prom['type']) {
690 case 0: 693 case 0:
@@ -703,19 +706,19 @@ Page({ @@ -703,19 +706,19 @@ Page({
703 var order_prom_txt1 = "order_prom_id"; 706 var order_prom_txt1 = "order_prom_id";
704 var order_prom_txt2 = "order_prom_amount"; 707 var order_prom_txt2 = "order_prom_amount";
705 if (order_prom_id > 0) { 708 if (order_prom_id > 0) {
706 - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})  
707 - }else{  
708 - o_condition1=ord_price;  
709 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) 709 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
  710 + } else {
  711 + o_condition1 = ord_price;
  712 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
710 } 713 }
711 -  
712 - o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit);  
713 - if(o_condition1<0) o_condition1=0;  
714 - th.setData({ exp_price: 0, order_m: o_condition1 }) 714 +
  715 + o_condition1 = parseFloat(o_condition1) - parseFloat(th.data.presell.presell_deposit);
  716 + if (o_condition1 < 0) o_condition1 = 0;
  717 + th.setData({ exp_price: 0, order_m: o_condition1 })
715 }) 718 })
716 - }else{  
717 - o_condition=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit);  
718 - if(o_condition<0) o_condition=0; 719 + } else {
  720 + o_condition = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit);
  721 + if (o_condition < 0) o_condition = 0;
719 th.setData({ exp_price: 0, order_m: o_condition }) 722 th.setData({ exp_price: 0, order_m: o_condition })
720 } 723 }
721 } 724 }
@@ -725,14 +728,14 @@ Page({ @@ -725,14 +728,14 @@ Page({
725 checkAddressList: function () { 728 checkAddressList: function () {
726 var t = this; 729 var t = this;
727 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 730 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
728 - title: "请先填写或选择收货地址~",  
729 - success: function (a) {  
730 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
731 - },  
732 - fail: function () {  
733 - wx.navigateBack();  
734 - }  
735 - }), !1); 731 + title: "请先填写或选择收货地址~",
  732 + success: function (a) {
  733 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  734 + },
  735 + fail: function () {
  736 + wx.navigateBack();
  737 + }
  738 + }), !1);
736 }, 739 },
737 showInvoice: function () { 740 showInvoice: function () {
738 this.setData({ 741 this.setData({
@@ -752,7 +755,7 @@ Page({ @@ -752,7 +755,7 @@ Page({
752 keyUpChangeNum: function (t) { 755 keyUpChangeNum: function (t) {
753 this.setData({ 756 this.setData({
754 maxWord: t.detail.value.length, 757 maxWord: t.detail.value.length,
755 - user_note:t.detail.value 758 + user_note: t.detail.value
756 }); 759 });
757 }, 760 },
758 761
@@ -781,7 +784,7 @@ Page({ @@ -781,7 +784,7 @@ Page({
781 } 784 }
782 } 785 }
783 var set_txt = "cartlist[" + iter + "].can_num"; 786 var set_txt = "cartlist[" + iter + "].can_num";
784 - th.setData({[set_txt]: num}); 787 + th.setData({ [set_txt]: num });
785 } 788 }
786 }, 789 },
787 useCoupon: function () { 790 useCoupon: function () {
@@ -798,7 +801,7 @@ Page({ @@ -798,7 +801,7 @@ Page({
798 }); 801 });
799 }, 802 },
800 enterAddressPage: function () { 803 enterAddressPage: function () {
801 - if(!this.data.wait_wk) return false; 804 + if (!this.data.wait_wk) return false;
802 805
803 getApp().globalData.is_cart_old = 1; 806 getApp().globalData.is_cart_old = 1;
804 this.data.isget_by_quan = {}; 807 this.data.isget_by_quan = {};
@@ -811,9 +814,9 @@ Page({ @@ -811,9 +814,9 @@ Page({
811 setexptype: function (t) { 814 setexptype: function (t) {
812 var th = this; 815 var th = this;
813 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; 816 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code;
814 - th.setData({bn_exp_type: ty}); 817 + th.setData({ bn_exp_type: ty });
815 if (ty == 0) { 818 if (ty == 0) {
816 - th.setData({is_all_zt: 0}); 819 + th.setData({ is_all_zt: 0 });
817 } 820 }
818 821
819 //当物流为空的时候。 822 //当物流为空的时候。
@@ -826,7 +829,7 @@ Page({ @@ -826,7 +829,7 @@ Page({
826 if (ty == 1) { 829 if (ty == 1) {
827 th.data.isget_by_quan = {}; 830 th.data.isget_by_quan = {};
828 if (th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby == 1) { 831 if (th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby == 1) {
829 - th.setData({using_quan: {}}); 832 + th.setData({ using_quan: {} });
830 } 833 }
831 } 834 }
832 835
@@ -836,7 +839,7 @@ Page({ @@ -836,7 +839,7 @@ Page({
836 if (wu_arr != null && wu_arr != "") { 839 if (wu_arr != null && wu_arr != "") {
837 for (var i = 0; i < wu_arr.length; i++) { 840 for (var i = 0; i < wu_arr.length; i++) {
838 if (wu_arr[i].shipping_code == def_exp_code) { 841 if (wu_arr[i].shipping_code == def_exp_code) {
839 - th.setData({index: i}); 842 + th.setData({ index: i });
840 } 843 }
841 } 844 }
842 } 845 }
@@ -848,16 +851,16 @@ Page({ @@ -848,16 +851,16 @@ Page({
848 //--------立即购买时,使用余额-------- 851 //--------立即购买时,使用余额--------
849 set_bn_useyuer: function () { 852 set_bn_useyuer: function () {
850 var th = this; 853 var th = this;
851 - th.setData({bn_use_money: !th.data.bn_use_money}); 854 + th.setData({ bn_use_money: !th.data.bn_use_money });
852 th.calculatePrice2(); 855 th.calculatePrice2();
853 }, 856 },
854 - //-------------------计算物流---------------  
855 - calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,  
856 - goods_piece, user_addr, freight_free, o_price, rs) { 857 + //-----------------计算物流-------------
  858 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  859 + goods_piece, user_addr, freight_free, o_price, rs, pickid) {
857 var price = 0, th = this; 860 var price = 0, th = this;
858 price += parseFloat(o_shipping_price); 861 price += parseFloat(o_shipping_price);
859 //如果是包邮 862 //如果是包邮
860 - if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { 863 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
861 return 0; 864 return 0;
862 } 865 }
863 if (user_addr == null) { 866 if (user_addr == null) {
@@ -884,7 +887,7 @@ Page({ @@ -884,7 +887,7 @@ Page({
884 } 887 }
885 } 888 }
886 //------超出重量---------- 889 //------超出重量----------
887 - if(out_of_weight < 0 && o_price >= freight_free){ 890 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
888 fw_price = parseFloat(item['money']); 891 fw_price = parseFloat(item['money']);
889 var out_of_weight = Math.abs(out_of_weight); 892 var out_of_weight = Math.abs(out_of_weight);
890 if (out_of_weight > item['first_weight']) { 893 if (out_of_weight > item['first_weight']) {
@@ -930,7 +933,7 @@ Page({ @@ -930,7 +933,7 @@ Page({
930 //----------立即购买,选择物流------------- 933 //----------立即购买,选择物流-------------
931 bindPickerChange: function (e) { 934 bindPickerChange: function (e) {
932 var ind = e.detail.value 935 var ind = e.detail.value
933 - this.setData({index: ind}); 936 + this.setData({ index: ind });
934 this.calculatePrice2(); 937 this.calculatePrice2();
935 }, 938 },
936 /*----券的所有操作----*/ 939 /*----券的所有操作----*/
@@ -943,7 +946,7 @@ Page({ @@ -943,7 +946,7 @@ Page({
943 946
944 947
945 if (bn == 1) { 948 if (bn == 1) {
946 - th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); 949 + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 });
947 } else { 950 } else {
948 //---多单打开券的时候,就要判断券在其他门店是否有使用--- 951 //---多单打开券的时候,就要判断券在其他门店是否有使用---
949 var quanlist = th.data.cartlist[cindx].quan_list; 952 var quanlist = th.data.cartlist[cindx].quan_list;
@@ -969,9 +972,9 @@ Page({ @@ -969,9 +972,9 @@ Page({
969 else 972 else
970 get_by_quan_list_cart[i].show_red = 0; 973 get_by_quan_list_cart[i].show_red = 0;
971 } 974 }
972 - th.setData({by_quan_list_cart: get_by_quan_list_cart}); 975 + th.setData({ by_quan_list_cart: get_by_quan_list_cart });
973 } else { 976 } else {
974 - th.setData({by_quan_list_cart: null}); 977 + th.setData({ by_quan_list_cart: null });
975 } 978 }
976 979
977 th.setData({ 980 th.setData({
@@ -986,7 +989,7 @@ Page({ @@ -986,7 +989,7 @@ Page({
986 }, 989 },
987 close_coupon: function (e) { 990 close_coupon: function (e) {
988 var th = this; 991 var th = this;
989 - th.setData({open_quan: 0, disabled: 0}); 992 + th.setData({ open_quan: 0, disabled: 0 });
990 }, 993 },
991 994
992 //---判断券时候在已经选择的列表中--- 995 //---判断券时候在已经选择的列表中---
@@ -1016,14 +1019,14 @@ Page({ @@ -1016,14 +1019,14 @@ Page({
1016 for (var i in quanlist) { 1019 for (var i in quanlist) {
1017 quanlist[i].show_red = 0; 1020 quanlist[i].show_red = 0;
1018 } 1021 }
1019 - this.setData({selected_quan_list: quanlist}); 1022 + this.setData({ selected_quan_list: quanlist });
1020 var by_quanlist = this.data.get_by_quan_list; 1023 var by_quanlist = this.data.get_by_quan_list;
1021 if (by_quanlist) { 1024 if (by_quanlist) {
1022 //---所有的券的显示红色选择都清理一遍--- 1025 //---所有的券的显示红色选择都清理一遍---
1023 for (var inb in by_quanlist) { 1026 for (var inb in by_quanlist) {
1024 by_quanlist[inb].show_red = 0; 1027 by_quanlist[inb].show_red = 0;
1025 } 1028 }
1026 - this.setData({get_by_quan_list: by_quanlist}); 1029 + this.setData({ get_by_quan_list: by_quanlist });
1027 } 1030 }
1028 1031
1029 var by_cart_list = this.data.by_quan_list_cart; 1032 var by_cart_list = this.data.by_quan_list_cart;
@@ -1032,7 +1035,7 @@ Page({ @@ -1032,7 +1035,7 @@ Page({
1032 for (var inc in by_cart_list) { 1035 for (var inc in by_cart_list) {
1033 by_cart_list[inc].show_red = 0; 1036 by_cart_list[inc].show_red = 0;
1034 } 1037 }
1035 - this.setData({by_quan_list_cart: by_cart_list}); 1038 + this.setData({ by_quan_list_cart: by_cart_list });
1036 } 1039 }
1037 1040
1038 var using_quan = this.data.using_quan; 1041 var using_quan = this.data.using_quan;
@@ -1043,9 +1046,9 @@ Page({ @@ -1043,9 +1046,9 @@ Page({
1043 using_quan[pickid].is_nouse_red = 1; 1046 using_quan[pickid].is_nouse_red = 1;
1044 } 1047 }
1045 else { 1048 else {
1046 - using_quan[pickid] = {is_nouse_red: 1}; 1049 + using_quan[pickid] = { is_nouse_red: 1 };
1047 } 1050 }
1048 - this.setData({using_quan: using_quan, is_coupon: 2222}); 1051 + this.setData({ using_quan: using_quan, is_coupon: 2222 });
1049 return; 1052 return;
1050 } 1053 }
1051 1054
@@ -1062,9 +1065,9 @@ Page({ @@ -1062,9 +1065,9 @@ Page({
1062 using_quan[pickid].is_nouse_red = 0; 1065 using_quan[pickid].is_nouse_red = 0;
1063 } 1066 }
1064 else { 1067 else {
1065 - using_quan[pickid] = {is_nouse_red: 0}; 1068 + using_quan[pickid] = { is_nouse_red: 0 };
1066 } 1069 }
1067 - this.setData({using_quan: using_quan}); 1070 + this.setData({ using_quan: using_quan });
1068 1071
1069 }, 1072 },
1070 /*----- 点击选择包邮券 -----*/ 1073 /*----- 点击选择包邮券 -----*/
@@ -1077,7 +1080,7 @@ Page({ @@ -1077,7 +1080,7 @@ Page({
1077 for (var ind in by_quanlist) { 1080 for (var ind in by_quanlist) {
1078 by_quanlist[ind].show_red = 0; 1081 by_quanlist[ind].show_red = 0;
1079 } 1082 }
1080 - this.setData({get_by_quan_list: by_quanlist}); 1083 + this.setData({ get_by_quan_list: by_quanlist });
1081 } 1084 }
1082 1085
1083 //--购物车过来的包邮券-- 1086 //--购物车过来的包邮券--
@@ -1087,7 +1090,7 @@ Page({ @@ -1087,7 +1090,7 @@ Page({
1087 for (var ind in by_cart_list) { 1090 for (var ind in by_cart_list) {
1088 by_cart_list[ind].show_red = 0; 1091 by_cart_list[ind].show_red = 0;
1089 } 1092 }
1090 - this.setData({by_quan_list_cart: by_cart_list}); 1093 + this.setData({ by_quan_list_cart: by_cart_list });
1091 } 1094 }
1092 //普通券 1095 //普通券
1093 var quanlist = this.data.selected_quan_list; 1096 var quanlist = this.data.selected_quan_list;
@@ -1096,7 +1099,7 @@ Page({ @@ -1096,7 +1099,7 @@ Page({
1096 for (var ind in quanlist) { 1099 for (var ind in quanlist) {
1097 quanlist[ind].show_red = 0; 1100 quanlist[ind].show_red = 0;
1098 } 1101 }
1099 - this.setData({selected_quan_list: quanlist}); 1102 + this.setData({ selected_quan_list: quanlist });
1100 } 1103 }
1101 1104
1102 var th = this; 1105 var th = this;
@@ -1107,9 +1110,9 @@ Page({ @@ -1107,9 +1110,9 @@ Page({
1107 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 1110 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
1108 } 1111 }
1109 else { 1112 else {
1110 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 1113 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
1111 } 1114 }
1112 - this.setData({using_quan: using_quan, is_coupon: 2222}); 1115 + this.setData({ using_quan: using_quan, is_coupon: 2222 });
1113 return; 1116 return;
1114 } 1117 }
1115 1118
@@ -1120,20 +1123,20 @@ Page({ @@ -1120,20 +1123,20 @@ Page({
1120 var txt1 = ""; 1123 var txt1 = "";
1121 var quan_item = null; 1124 var quan_item = null;
1122 1125
1123 - quan_item = this.data.get_by_quan_list[ind];  
1124 - txt = "get_by_quan_list[" + ind + "].show_red";  
1125 - var obj = {};  
1126 - obj[txt] = 1;  
1127 - this.setData(obj); 1126 + quan_item = this.data.get_by_quan_list[ind];
  1127 + txt = "get_by_quan_list[" + ind + "].show_red";
  1128 + var obj = {};
  1129 + obj[txt] = 1;
  1130 + this.setData(obj);
1128 1131
1129 1132
1130 if (using_quan[th.data.selected_quan_pick]) { 1133 if (using_quan[th.data.selected_quan_pick]) {
1131 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 1134 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
1132 } 1135 }
1133 else { 1136 else {
1134 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 1137 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
1135 } 1138 }
1136 - this.setData({using_quan: using_quan}); 1139 + this.setData({ using_quan: using_quan });
1137 }, 1140 },
1138 //--确认使用券--- 1141 //--确认使用券---
1139 confirm_quan: function () { 1142 confirm_quan: function () {
@@ -1190,10 +1193,10 @@ Page({ @@ -1190,10 +1193,10 @@ Page({
1190 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 1193 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券
1191 if (using_quan[pickid]) { 1194 if (using_quan[pickid]) {
1192 if (using_quan[pickid].is_nouse_red == 1) { 1195 if (using_quan[pickid].is_nouse_red == 1) {
1193 - using_quan[pickid] = {is_nouse_red: 1}; 1196 + using_quan[pickid] = { is_nouse_red: 1 };
1194 th.calculatePrice2(); 1197 th.calculatePrice2();
1195 - th.setData({open_quan: 0});  
1196 - th.setData({using_quan: using_quan}); 1198 + th.setData({ open_quan: 0 });
  1199 + th.setData({ using_quan: using_quan });
1197 } 1200 }
1198 } 1201 }
1199 1202
@@ -1214,12 +1217,12 @@ Page({ @@ -1214,12 +1217,12 @@ Page({
1214 }; 1217 };
1215 using_quan[pickid].isby = 1; 1218 using_quan[pickid].isby = 1;
1216 } else { 1219 } else {
1217 - using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; 1220 + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
1218 using_quan[pickid].isby = 0; 1221 using_quan[pickid].isby = 0;
1219 } 1222 }
1220 - this.setData({using_quan: using_quan}); 1223 + this.setData({ using_quan: using_quan });
1221 th.calculatePrice2(); 1224 th.calculatePrice2();
1222 - th.setData({open_quan: 0}); 1225 + th.setData({ open_quan: 0 });
1223 }, 1226 },
1224 1227
1225 cart_set_err: function (e) { 1228 cart_set_err: function (e) {
@@ -1256,7 +1259,7 @@ Page({ @@ -1256,7 +1259,7 @@ Page({
1256 var wu_arr_txt = e.currentTarget.dataset.txt; 1259 var wu_arr_txt = e.currentTarget.dataset.txt;
1257 var w_sele_index = e.currentTarget.dataset.w_sele_index; 1260 var w_sele_index = e.currentTarget.dataset.w_sele_index;
1258 var is_express = null; 1261 var is_express = null;
1259 - var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; 1262 + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 };
1260 1263
1261 //--如果是多个门店的时候-- 1264 //--如果是多个门店的时候--
1262 if (w_sele_index != undefined) { 1265 if (w_sele_index != undefined) {
@@ -1267,21 +1270,21 @@ Page({ @@ -1267,21 +1270,21 @@ Page({
1267 }, 1270 },
1268 // 关闭物流的弹窗 1271 // 关闭物流的弹窗
1269 close_express: function () { 1272 close_express: function () {
1270 - this.setData({open_express: 0, disabled: 0}); 1273 + this.setData({ open_express: 0, disabled: 0 });
1271 }, 1274 },
1272 // 选择物流 1275 // 选择物流
1273 click_express_name: function (e) { 1276 click_express_name: function (e) {
1274 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; 1277 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
1275 var index = e.currentTarget.dataset.idxe; 1278 var index = e.currentTarget.dataset.idxe;
1276 - var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; 1279 + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 };
1277 ob[this.data.wu_arr_txt] = index; 1280 ob[this.data.wu_arr_txt] = index;
1278 this.setData(ob); 1281 this.setData(ob);
1279 }, 1282 },
1280 1283
1281 //点击确定物流 1284 //点击确定物流
1282 determine_expres: function (e) { 1285 determine_expres: function (e) {
1283 - this.setData({open_express: 0});  
1284 - this.calculatePrice2(); 1286 + this.setData({ open_express: 0 });
  1287 + this.calculatePrice2();
1285 }, 1288 },
1286 1289
1287 //点击打开优惠券使用说明 1290 //点击打开优惠券使用说明
@@ -1297,7 +1300,7 @@ Page({ @@ -1297,7 +1300,7 @@ Page({
1297 obj[txt] = is_open; 1300 obj[txt] = is_open;
1298 1301
1299 this.setData(obj); 1302 this.setData(obj);
1300 - this.setData({disabled: 1}) 1303 + this.setData({ disabled: 1 })
1301 }, 1304 },
1302 1305
1303 clik_coupons2: function (e) { 1306 clik_coupons2: function (e) {
@@ -1312,7 +1315,7 @@ Page({ @@ -1312,7 +1315,7 @@ Page({
1312 obj[txt] = is_open; 1315 obj[txt] = is_open;
1313 1316
1314 this.setData(obj); 1317 this.setData(obj);
1315 - this.setData({disabled: 1}) 1318 + this.setData({ disabled: 1 })
1316 }, 1319 },
1317 1320
1318 1321
@@ -1321,11 +1324,11 @@ Page({ @@ -1321,11 +1324,11 @@ Page({
1321 var th = this; 1324 var th = this;
1322 var is_shipping_code = this.data.is_shipping_code 1325 var is_shipping_code = this.data.is_shipping_code
1323 getApp().request.put("/api/weshop/users/update", { 1326 getApp().request.put("/api/weshop/users/update", {
1324 - data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, 1327 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
1325 success: function (rse) { 1328 success: function (rse) {
1326 if (rse.data.code == 0) { 1329 if (rse.data.code == 0) {
1327 getApp().globalData.userInfo.def_exp_code = is_shipping_code; 1330 getApp().globalData.userInfo.def_exp_code = is_shipping_code;
1328 - th.setData({open_express: 0}); 1331 + th.setData({ open_express: 0 });
1329 //----计算此时购物车的价格---- 1332 //----计算此时购物车的价格----
1330 th.calculatePrice2(); 1333 th.calculatePrice2();
1331 1334
@@ -1335,7 +1338,7 @@ Page({ @@ -1335,7 +1338,7 @@ Page({
1335 }, 1338 },
1336 1339
1337 //更新下默认,在onshow里面 1340 //更新下默认,在onshow里面
1338 - update_code(){ 1341 + update_code() {
1339 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; 1342 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
1340 //--定时器,判断wu_arr不未空-- 1343 //--定时器,判断wu_arr不未空--
1341 var uii = setInterval(function () { 1344 var uii = setInterval(function () {
@@ -1349,7 +1352,7 @@ Page({ @@ -1349,7 +1352,7 @@ Page({
1349 } 1352 }
1350 //--如果是立即购买-- 1353 //--如果是立即购买--
1351 if (th.data.is_b_now == 1) { 1354 if (th.data.is_b_now == 1) {
1352 - th.setData({index: m_wind, is_express: m_wind}); 1355 + th.setData({ index: m_wind, is_express: m_wind });
1353 } else { 1356 } else {
1354 var ui = setInterval(function () { 1357 var ui = setInterval(function () {
1355 if (th.data.cartlist) { 1358 if (th.data.cartlist) {
@@ -1357,7 +1360,7 @@ Page({ @@ -1357,7 +1360,7 @@ Page({
1357 for (var i in c_arr) { 1360 for (var i in c_arr) {
1358 c_arr[i].wind = m_wind; 1361 c_arr[i].wind = m_wind;
1359 } 1362 }
1360 - th.setData({cartlist: c_arr, is_express: m_wind}) 1363 + th.setData({ cartlist: c_arr, is_express: m_wind })
1361 clearInterval(ui); 1364 clearInterval(ui);
1362 } 1365 }
1363 }, 500) 1366 }, 500)
@@ -1458,10 +1461,10 @@ Page({ @@ -1458,10 +1461,10 @@ Page({
1458 if (th.data.is_b_now) { 1461 if (th.data.is_b_now) {
1459 if (arr && arr.length > 0) { 1462 if (arr && arr.length > 0) {
1460 var quanlist = arr[0].quan_list; 1463 var quanlist = arr[0].quan_list;
1461 - th.setData({selected_quan_list: quanlist, cartlist: arr}) 1464 + th.setData({ selected_quan_list: quanlist, cartlist: arr })
1462 } 1465 }
1463 } else { 1466 } else {
1464 - th.setData({cartlist: arr}) 1467 + th.setData({ cartlist: arr })
1465 th.set_can_num(); 1468 th.set_can_num();
1466 } 1469 }
1467 }, 1470 },
@@ -1469,14 +1472,14 @@ Page({ @@ -1469,14 +1472,14 @@ Page({
1469 //------ 获取立即购买的购物车的劵 -------- 1472 //------ 获取立即购买的购物车的劵 --------
1470 get_buy_now_quan: function () { 1473 get_buy_now_quan: function () {
1471 var quanlist = null, th = this, frozenQuan = null; 1474 var quanlist = null, th = this, frozenQuan = null;
1472 - var allprice =this.data.pre_arr.presell_price*this.data.order_goods.goods_num; 1475 + var allprice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num;
1473 th.data.ckeck_quan_price = allprice; 1476 th.data.ckeck_quan_price = allprice;
1474 1477
1475 //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- 1478 //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券--
1476 if (th.data.is_close_quan != 1) { 1479 if (th.data.is_close_quan != 1) {
1477 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 1480 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
1478 var url = "/api/weshop/couponList/getUseCouponList"; 1481 var url = "/api/weshop/couponList/getUseCouponList";
1479 - app.request.promiseGet(url0, {1: 1}).then(res => { 1482 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
1480 if (res.data.code == 0) { 1483 if (res.data.code == 0) {
1481 frozenQuan = res.data.data; 1484 frozenQuan = res.data.data;
1482 th.data.frozenQuan = frozenQuan; 1485 th.data.frozenQuan = frozenQuan;
@@ -1494,7 +1497,7 @@ Page({ @@ -1494,7 +1497,7 @@ Page({
1494 quanlist = res.data.data.pageData; 1497 quanlist = res.data.data.pageData;
1495 if (quanlist) { 1498 if (quanlist) {
1496 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); 1499 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan);
1497 - th.setData({selected_quan_list: quanlist}) 1500 + th.setData({ selected_quan_list: quanlist })
1498 } 1501 }
1499 } 1502 }
1500 } 1503 }
@@ -1522,7 +1525,7 @@ Page({ @@ -1522,7 +1525,7 @@ Page({
1522 if (!goods_id) goods_id = this.data.bn_goods.goods_id; 1525 if (!goods_id) goods_id = this.data.bn_goods.goods_id;
1523 for (var i in arr) { 1526 for (var i in arr) {
1524 var item = arr[i]; 1527 var item = arr[i];
1525 - if (goods_id == item) return 0; 1528 + if (goods_id == item) return 0;
1526 } 1529 }
1527 return 1; 1530 return 1;
1528 }, 1531 },
@@ -1544,14 +1547,14 @@ Page({ @@ -1544,14 +1547,14 @@ Page({
1544 pick = this.data.pickup.pickup_id; 1547 pick = this.data.pickup.pickup_id;
1545 //---获取订单优惠--- 1548 //---获取订单优惠---
1546 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { 1549 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
1547 - data: {store_id: os.stoid, orderAmount: condition} 1550 + data: { store_id: os.stoid, orderAmount: condition }
1548 }).then(res => { 1551 }).then(res => {
1549 if (res.data.code == 0) { 1552 if (res.data.code == 0) {
1550 var data = res.data.data; 1553 var data = res.data.data;
1551 th.data.order_prom[pick] = data; 1554 th.data.order_prom[pick] = data;
1552 - }else{  
1553 - th.data.order_prom[pick] = null;  
1554 - } 1555 + } else {
  1556 + th.data.order_prom[pick] = null;
  1557 + }
1555 func(condition); 1558 func(condition);
1556 }) 1559 })
1557 }, 1560 },
@@ -1568,7 +1571,7 @@ Page({ @@ -1568,7 +1571,7 @@ Page({
1568 var ob = map[pickid][item.prom_id]; 1571 var ob = map[pickid][item.prom_id];
1569 ob.price += item.goods_price * item.goods_num; 1572 ob.price += item.goods_price * item.goods_num;
1570 ob.goods_num += item.goods_num; 1573 ob.goods_num += item.goods_num;
1571 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 1574 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
1572 1575
1573 } else { 1576 } else {
1574 var prom = null; 1577 var prom = null;
@@ -1584,7 +1587,7 @@ Page({ @@ -1584,7 +1587,7 @@ Page({
1584 ob.is_bz = prom.is_bz; 1587 ob.is_bz = prom.is_bz;
1585 ob.is_xz_yh = prom.is_xz_yh; 1588 ob.is_xz_yh = prom.is_xz_yh;
1586 ob.goods = new Array(); 1589 ob.goods = new Array();
1587 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 1590 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
1588 map[pickid][item.prom_id] = ob; 1591 map[pickid][item.prom_id] = ob;
1589 } 1592 }
1590 } else { 1593 } else {
@@ -1601,7 +1604,7 @@ Page({ @@ -1601,7 +1604,7 @@ Page({
1601 ob.is_bz = prom.is_bz; 1604 ob.is_bz = prom.is_bz;
1602 ob.is_xz_yh = prom.is_xz_yh; 1605 ob.is_xz_yh = prom.is_xz_yh;
1603 ob.goods = new Array(); 1606 ob.goods = new Array();
1604 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 1607 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
1605 1608
1606 var obj = {}; 1609 var obj = {};
1607 obj[item.prom_id] = ob; 1610 obj[item.prom_id] = ob;
@@ -1645,6 +1648,7 @@ Page({ @@ -1645,6 +1648,7 @@ Page({
1645 if (no_by_data && no_by_data.region_list) { 1648 if (no_by_data && no_by_data.region_list) {
1646 if (th.check_by_area(no_by_data.region_list)) { 1649 if (th.check_by_area(no_by_data.region_list)) {
1647 gift_freight_free = 0; 1650 gift_freight_free = 0;
  1651 + out_of_weight = 0;
1648 th.data.is_no_by[bn_pick] = 1; 1652 th.data.is_no_by[bn_pick] = 1;
1649 } 1653 }
1650 } 1654 }
@@ -1652,12 +1656,14 @@ Page({ @@ -1652,12 +1656,14 @@ Page({
1652 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 1656 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
1653 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 1657 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
1654 gift_freight_free = 0; 1658 gift_freight_free = 0;
  1659 + out_of_weight = 0;
  1660 + th.data.is_no_by[bn_pick] = 1;
1655 } 1661 }
1656 } 1662 }
1657 1663
1658 var t_shipping_price = 1664 var t_shipping_price =
1659 - this.calculatewuliu(code, gift_shipping_price, goods_weight,  
1660 - goods_piece, user_addr, gift_freight_free, allpice, rs); 1665 + this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight,
  1666 + goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick);
1661 return t_shipping_price; 1667 return t_shipping_price;
1662 1668
1663 }, 1669 },
@@ -1717,13 +1723,13 @@ Page({ @@ -1717,13 +1723,13 @@ Page({
1717 goods_weight = -1, 1723 goods_weight = -1,
1718 goods_piece = -1, 1724 goods_piece = -1,
1719 good = th.data.goods, 1725 good = th.data.goods,
1720 - quan_price=0,  
1721 - exp_price=0; 1726 + quan_price = 0,
  1727 + exp_price = 0;
1722 1728
1723 var quan_no = null; 1729 var quan_no = null;
1724 - var bn_pick=th.data.pickup.pickup_id;  
1725 - var allpice =th.data.all_price;  
1726 - var out_of_weight=null; //超出多少重量 1730 + var bn_pick = th.data.pickup.pickup_id;
  1731 + var allpice = th.data.all_price;
  1732 + var out_of_weight = null; //超出多少重量
1727 var freight_free = ee.freight_free; //全场满多少包邮 1733 var freight_free = ee.freight_free; //全场满多少包邮
1728 var weight_free = ee.weight_free; //多少kg内包邮 1734 var weight_free = ee.weight_free; //多少kg内包邮
1729 1735
@@ -1747,19 +1753,19 @@ Page({ @@ -1747,19 +1753,19 @@ Page({
1747 }) 1753 })
1748 1754
1749 if (quan_price > 0) { 1755 if (quan_price > 0) {
1750 - if (quan_price < th.data.tail_pay) th.setData({quan_price: quan_price}) 1756 + if (quan_price < th.data.tail_pay) th.setData({ quan_price: quan_price })
1751 else { 1757 else {
1752 - th.setData({quan_price: th.data.tail_pay}) 1758 + th.setData({ quan_price: th.data.tail_pay })
1753 quan_price = th.data.tail_pay; 1759 quan_price = th.data.tail_pay;
1754 } 1760 }
1755 } else { 1761 } else {
1756 - th.setData({quan_price: 0}) 1762 + th.setData({ quan_price: 0 })
1757 } 1763 }
1758 - }else{  
1759 - th.setData({quan_price: 0}) 1764 + } else {
  1765 + th.setData({ quan_price: 0 })
1760 } 1766 }
1761 - }else{  
1762 - th.setData({quan_price: 0}) 1767 + } else {
  1768 + th.setData({ quan_price: 0 })
1763 } 1769 }
1764 1770
1765 //-----------当地址不为空,且是物流时,计算物流费用---------- 1771 //-----------当地址不为空,且是物流时,计算物流费用----------
@@ -1788,15 +1794,15 @@ Page({ @@ -1788,15 +1794,15 @@ Page({
1788 arr.push(item); 1794 arr.push(item);
1789 } 1795 }
1790 if (arr) { 1796 if (arr) {
1791 - th.setData({get_by_quan_list: arr}); 1797 + th.setData({ get_by_quan_list: arr });
1792 } 1798 }
1793 th.data.isget_by_quan[bn_pick] = 1; 1799 th.data.isget_by_quan[bn_pick] = 1;
1794 } 1800 }
1795 }) 1801 })
1796 } 1802 }
1797 if (quan_no && th.data.using_quan[bn_pick].isby == 1) { 1803 if (quan_no && th.data.using_quan[bn_pick].isby == 1) {
1798 - exp_price=0;  
1799 - }else{ 1804 + exp_price = 0;
  1805 + } else {
1800 switch (good['exp_sum_type']) { 1806 switch (good['exp_sum_type']) {
1801 case 1: 1807 case 1:
1802 //统一运费 1808 //统一运费
@@ -1806,8 +1812,8 @@ Page({ @@ -1806,8 +1812,8 @@ Page({
1806 if (goods_weight < 0) goods_weight = 0; 1812 if (goods_weight < 0) goods_weight = 0;
1807 //累积商品重量 每种商品的重量 * 数量 1813 //累积商品重量 每种商品的重量 * 数量
1808 goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; 1814 goods_weight += good['weight'] * th.data.order.order_goods['goods_num'];
1809 - if(weight_free > 0){  
1810 - out_of_weight = (weight_free * 1000 ) - goods_weight; 1815 + if (weight_free > 0) {
  1816 + out_of_weight = (weight_free * 1000) - goods_weight;
1811 } 1817 }
1812 break; 1818 break;
1813 case 3: 1819 case 3:
@@ -1819,33 +1825,33 @@ Page({ @@ -1819,33 +1825,33 @@ Page({
1819 1825
1820 var code = th.data.wu_arr[th.data.index].code; 1826 var code = th.data.wu_arr[th.data.index].code;
1821 var shipping_price = 1827 var shipping_price =
1822 - th.calculatewuliu(code, o_shipping_price, goods_weight, 1828 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
1823 goods_piece, th.data.user_addr, freight_free, allpice, rs); 1829 goods_piece, th.data.user_addr, freight_free, allpice, rs);
1824 exp_price = parseFloat(shipping_price).toFixed(2); 1830 exp_price = parseFloat(shipping_price).toFixed(2);
1825 } 1831 }
1826 - th.wuliu_next(allpice,quan_price,exp_price); 1832 + th.wuliu_next(allpice, quan_price, exp_price);
1827 } else { 1833 } else {
1828 - th.wuliu_next(allpice,quan_price,exp_price); 1834 + th.wuliu_next(allpice, quan_price, exp_price);
1829 } 1835 }
1830 }); 1836 });
1831 }); 1837 });
1832 }, 1838 },
1833 //相同的东西统一在一起 1839 //相同的东西统一在一起
1834 - wuliu_next( allpice,quan_price,exp_price){  
1835 - var th=this;  
1836 - var o_condition =parseFloat(allpice)-parseFloat(quan_price);  
1837 - if(o_condition<0) o_condition=0; 1840 + wuliu_next(allpice, quan_price, exp_price) {
  1841 + var th = this;
  1842 + var o_condition = parseFloat(allpice) - parseFloat(quan_price);
  1843 + if (o_condition < 0) o_condition = 0;
1838 //如果同意参与订单优惠 1844 //如果同意参与订单优惠
1839 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { 1845 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) {
1840 th.check_is_order_prom(o_condition, function (ord_price) { 1846 th.check_is_order_prom(o_condition, function (ord_price) {
1841 - var bn_pick=th.data.pickup.pickup_id 1847 + var bn_pick = th.data.pickup.pickup_id
1842 var order_prom_amount = 0; 1848 var order_prom_amount = 0;
1843 var order_prom_id = 0; 1849 var order_prom_id = 0;
1844 - var order_m=0; 1850 + var order_m = 0;
1845 if (th.data.order_prom[bn_pick]) { 1851 if (th.data.order_prom[bn_pick]) {
1846 var ord_prom = th.data.order_prom[bn_pick]; 1852 var ord_prom = th.data.order_prom[bn_pick];
1847 //么有使用券,或者活动没有限制使用优惠券 1853 //么有使用券,或者活动没有限制使用优惠券
1848 - if(quan_price<=0 || !ord_prom.is_xz_yh) { 1854 + if (quan_price <= 0 || !ord_prom.is_xz_yh) {
1849 order_prom_id = ord_prom['id']; 1855 order_prom_id = ord_prom['id'];
1850 switch (ord_prom['type']) { 1856 switch (ord_prom['type']) {
1851 case 0: 1857 case 0:
@@ -1865,37 +1871,37 @@ Page({ @@ -1865,37 +1871,37 @@ Page({
1865 if (order_prom_id > 0) { 1871 if (order_prom_id > 0) {
1866 var order_prom_txt1 = "order_prom_id"; 1872 var order_prom_txt1 = "order_prom_id";
1867 var order_prom_txt2 = "order_prom_amount"; 1873 var order_prom_txt2 = "order_prom_amount";
1868 - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})  
1869 - }else{  
1870 - var order_prom_txt1 = "order_prom_id";  
1871 - var order_prom_txt2 = "order_prom_amount";  
1872 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0})  
1873 - }  
1874 -  
1875 -  
1876 - ord_price=parseFloat(ord_price)-parseFloat(th.data.presell.presell_deposit);  
1877 - if(ord_price<0) ord_price=0;  
1878 - th.setData({ exp_price: exp_price, order_m: ord_price +parseFloat(exp_price) }) 1874 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
  1875 + } else {
  1876 + var order_prom_txt1 = "order_prom_id";
  1877 + var order_prom_txt2 = "order_prom_amount";
  1878 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
  1879 + }
  1880 +
  1881 +
  1882 + ord_price = parseFloat(ord_price) - parseFloat(th.data.presell.presell_deposit);
  1883 + if (ord_price < 0) ord_price = 0;
  1884 + th.setData({ exp_price: exp_price, order_m: ord_price + parseFloat(exp_price) })
1879 1885
1880 }) 1886 })
1881 - }else{  
1882 -  
1883 - var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit);  
1884 - if(o_condition1<0) o_condition1=0;  
1885 - th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1)+parseFloat(exp_price) }) 1887 + } else {
  1888 +
  1889 + var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit);
  1890 + if (o_condition1 < 0) o_condition1 = 0;
  1891 + th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1) + parseFloat(exp_price) })
1886 } 1892 }
1887 }, 1893 },
1888 1894
1889 //-- 获取时间差 -- 1895 //-- 获取时间差 --
1890 - get_diff(){ 1896 + get_diff() {
1891 1897
1892 switch (this.data.act.presell_type) { 1898 switch (this.data.act.presell_type) {
1893 //部分定金 1899 //部分定金
1894 case 0: 1900 case 0:
1895 if (this.data.act.pay_begindate > ut.gettimestamp()) { 1901 if (this.data.act.pay_begindate > ut.gettimestamp()) {
1896 - this.setData({no_start: 1}) 1902 + this.setData({ no_start: 1 })
1897 } else if (this.data.act.pay_enddate < ut.gettimestamp()) { 1903 } else if (this.data.act.pay_enddate < ut.gettimestamp()) {
1898 - this.setData({is_end: 1}) 1904 + this.setData({ is_end: 1 })
1899 } else { 1905 } else {
1900 var end_time = this.data.act.pay_enddate; 1906 var end_time = this.data.act.pay_enddate;
1901 var e_str = ut.formatTime(end_time); 1907 var e_str = ut.formatTime(end_time);
@@ -1906,15 +1912,15 @@ Page({ @@ -1906,15 +1912,15 @@ Page({
1906 var hours = parseInt(difftime / 3600) - 24 * days; // 小时 60*60 总小时数-过去的小时数=现在的小时数 1912 var hours = parseInt(difftime / 3600) - 24 * days; // 小时 60*60 总小时数-过去的小时数=现在的小时数
1907 var minutes = parseInt(difftime % 3600 / 60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数 1913 var minutes = parseInt(difftime % 3600 / 60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数
1908 var seconds = parseInt(difftime % 60); // 以60秒为一整份 取余 剩下秒数 1914 var seconds = parseInt(difftime % 60); // 以60秒为一整份 取余 剩下秒数
1909 - this.setData({days: days, hours: hours, minutes: minutes, seconds: seconds}) 1915 + this.setData({ days: days, hours: hours, minutes: minutes, seconds: seconds })
1910 } 1916 }
1911 break; 1917 break;
1912 //全额付款 1918 //全额付款
1913 case 1: 1919 case 1:
1914 if (this.data.act.start_time > ut.gettimestamp()) { 1920 if (this.data.act.start_time > ut.gettimestamp()) {
1915 - this.setData({no_start: 1}) 1921 + this.setData({ no_start: 1 })
1916 } else if (this.data.act.end_time < ut.gettimestamp()) { 1922 } else if (this.data.act.end_time < ut.gettimestamp()) {
1917 - this.setData({is_end: 1}) 1923 + this.setData({ is_end: 1 })
1918 } else { 1924 } else {
1919 var end_time = this.data.act.end_time; 1925 var end_time = this.data.act.end_time;
1920 var e_str = ut.formatTime(end_time); 1926 var e_str = ut.formatTime(end_time);
@@ -1925,7 +1931,7 @@ Page({ @@ -1925,7 +1931,7 @@ Page({
1925 var hours = parseInt(difftime / 3600) - 24 * days; // 小时 60*60 总小时数-过去的小时数=现在的小时数 1931 var hours = parseInt(difftime / 3600) - 24 * days; // 小时 60*60 总小时数-过去的小时数=现在的小时数
1926 var minutes = parseInt(difftime % 3600 / 60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数 1932 var minutes = parseInt(difftime % 3600 / 60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数
1927 var seconds = parseInt(difftime % 60); // 以60秒为一整份 取余 剩下秒数 1933 var seconds = parseInt(difftime % 60); // 以60秒为一整份 取余 剩下秒数
1928 - this.setData({days: days, hours: hours, minutes: minutes, seconds: seconds}) 1934 + this.setData({ days: days, hours: hours, minutes: minutes, seconds: seconds })
1929 } 1935 }
1930 break; 1936 break;
1931 1937
@@ -1936,16 +1942,16 @@ Page({ @@ -1936,16 +1942,16 @@ Page({
1936 //显示支付选择 1942 //显示支付选择
1937 show_pay: function () { 1943 show_pay: function () {
1938 //不用钱直接支付 1944 //不用钱直接支付
1939 - if(this.data.order_m<=0){ 1945 + if (this.data.order_m <= 0) {
1940 this.to_pay_type(1); 1946 this.to_pay_type(1);
1941 - }else{  
1942 - this.setData({show_pay_type: 1}); 1947 + } else {
  1948 + this.setData({ show_pay_type: 1 });
1943 } 1949 }
1944 1950
1945 }, 1951 },
1946 //关闭支付 1952 //关闭支付
1947 close_show_pay: function () { 1953 close_show_pay: function () {
1948 - this.setData({show_pay_type: 0}); 1954 + this.setData({ show_pay_type: 0 });
1949 }, 1955 },
1950 //--弹起支付框-- 1956 //--弹起支付框--
1951 to_pay() { 1957 to_pay() {
@@ -1954,7 +1960,7 @@ Page({ @@ -1954,7 +1960,7 @@ Page({
1954 return getApp().my_warnning("请选择收货地址", 0, this); 1960 return getApp().my_warnning("请选择收货地址", 0, this);
1955 } 1961 }
1956 1962
1957 - this.setData({show_pay_type: 1}); 1963 + this.setData({ show_pay_type: 1 });
1958 }, 1964 },
1959 1965
1960 //选择支付方式 1966 //选择支付方式
@@ -1990,26 +1996,26 @@ Page({ @@ -1990,26 +1996,26 @@ Page({
1990 dd.addressid = th.data.user_addr.address_id; 1996 dd.addressid = th.data.user_addr.address_id;
1991 } 1997 }
1992 1998
1993 - if(th.data.order_prom_amount>0){  
1994 - var e={  
1995 - order_prom_id:th.data.order_prom_id,  
1996 - order_prom_amount:th.data.order_prom_amount, 1999 + if (th.data.order_prom_amount > 0) {
  2000 + var e = {
  2001 + order_prom_id: th.data.order_prom_id,
  2002 + order_prom_amount: th.data.order_prom_amount,
1997 } 2003 }
1998 - dd.order_prom_list=e; 2004 + dd.order_prom_list = e;
1999 } 2005 }
2000 2006
2001 - var bn_pick=th.data.pickup_id;  
2002 - var quan_no=''; 2007 + var bn_pick = th.data.pickup_id;
  2008 + var quan_no = '';
2003 if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) 2009 if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined)
2004 quan_no = th.data.using_quan[bn_pick].coupon_no; 2010 quan_no = th.data.using_quan[bn_pick].coupon_no;
2005 - if(quan_no){  
2006 - dd.coupon_no=quan_no;  
2007 - if(th.data.quan_price) dd.coupon_price=th.data.quan_price; 2011 + if (quan_no) {
  2012 + dd.coupon_no = quan_no;
  2013 + if (th.data.quan_price) dd.coupon_price = th.data.quan_price;
2008 } 2014 }
2009 - if(th.data.user_note){  
2010 - dd.user_note=th.data.user_note; 2015 + if (th.data.user_note) {
  2016 + dd.user_note = th.data.user_note;
2011 } 2017 }
2012 - dd.order_amount= parseFloat(th.data.order_m).toFixed(2); 2018 + dd.order_amount = parseFloat(th.data.order_m).toFixed(2);
2013 2019
2014 console.log(JSON.stringify(dd)); 2020 console.log(JSON.stringify(dd));
2015 wx.request({ 2021 wx.request({
@@ -2029,25 +2035,25 @@ Page({ @@ -2029,25 +2035,25 @@ Page({
2029 function () { 2035 function () {
2030 //---用余额支付--- 2036 //---用余额支付---
2031 getApp().my_warnning("支付成功", 1, th); 2037 getApp().my_warnning("支付成功", 1, th);
2032 - var send_time=th.data.pre_arr.delivery_date;  
2033 - if(th.data.pre_arr.delivery_type==2){  
2034 - send_time=th.data.pre_arr.delivery_daynum*3600;  
2035 - }  
2036 - th.setData({isclose: 0,'order.order_status':1,'order.pay_status':1,'wait_wk':0,'presell.tail_pay_state':1,'wait_fh':1,send_time:send_time});  
2037 - 2038 + var send_time = th.data.pre_arr.delivery_date;
  2039 + if (th.data.pre_arr.delivery_type == 2) {
  2040 + send_time = th.data.pre_arr.delivery_daynum * 3600;
  2041 + }
  2042 + th.setData({ isclose: 0, 'order.order_status': 1, 'order.pay_status': 1, 'wait_wk': 0, 'presell.tail_pay_state': 1, 'wait_fh': 1, send_time: send_time });
  2043 +
2038 }, function () { 2044 }, function () {
2039 getApp().my_warnning("支付失败", 0, th); 2045 getApp().my_warnning("支付失败", 0, th);
2040 }) 2046 })
2041 } else { 2047 } else {
2042 if (t.data.code == 0) { 2048 if (t.data.code == 0) {
2043 - var send_time=th.data.pre_arr.delivery_date;  
2044 - if(th.data.pre_arr.delivery_type==2){  
2045 - send_time=th.data.pre_arr.delivery_daynum*3600; 2049 + var send_time = th.data.pre_arr.delivery_date;
  2050 + if (th.data.pre_arr.delivery_type == 2) {
  2051 + send_time = th.data.pre_arr.delivery_daynum * 3600;
2046 } 2052 }
2047 //---用余额支付--- 2053 //---用余额支付---
2048 - getApp().my_warnning("支付成功", 1, th);  
2049 - th.setData({isclose: 0,'order.order_status':1,'order.pay_status':1,'wait_wk':0,'presell.tail_pay_state':1,'wait_fh':1,send_time:send_time});  
2050 - 2054 + getApp().my_warnning("支付成功", 1, th);
  2055 + th.setData({ isclose: 0, 'order.order_status': 1, 'order.pay_status': 1, 'wait_wk': 0, 'presell.tail_pay_state': 1, 'wait_fh': 1, send_time: send_time });
  2056 +
2051 } else { 2057 } else {
2052 getApp().my_warnning(t.data.msg, 1, th); 2058 getApp().my_warnning(t.data.msg, 1, th);
2053 } 2059 }
@@ -2072,17 +2078,17 @@ Page({ @@ -2072,17 +2078,17 @@ Page({
2072 }, 2078 },
2073 fail: function (n) { 2079 fail: function (n) {
2074 console.log(n), "requestPayment:fail" == n.errMsg ? getApp().my_warnning("支付失败", 0, th) : "requestPayment:fail cancel" == n.errMsg ? getApp().my_warnning("您已取消支付", 0, th) : getApp().my_warnning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length), 0, th), 2080 console.log(n), "requestPayment:fail" == n.errMsg ? getApp().my_warnning("支付失败", 0, th) : "requestPayment:fail cancel" == n.errMsg ? getApp().my_warnning("您已取消支付", 0, th) : getApp().my_warnning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length), 0, th),
2075 - "function" == typeof fail && fail(); 2081 + "function" == typeof fail && fail();
2076 } 2082 }
2077 }); 2083 });
2078 }, 2084 },
2079 2085
2080 2086
2081 - show_liuyan:function () {  
2082 - this.setData({sh_liuyan:true}) 2087 + show_liuyan: function () {
  2088 + this.setData({ sh_liuyan: true })
2083 }, 2089 },
2084 - close_liuyan(){  
2085 - this.setData({sh_liuyan:false}) 2090 + close_liuyan() {
  2091 + this.setData({ sh_liuyan: false })
2086 }, 2092 },
2087 2093
2088 //--------点击选择---------- 2094 //--------点击选择----------
@@ -2096,83 +2102,83 @@ Page({ @@ -2096,83 +2102,83 @@ Page({
2096 2102
2097 //--------立即支付---------- 2103 //--------立即支付----------
2098 async jumpToCart4(e) { 2104 async jumpToCart4(e) {
2099 - var th=this;  
2100 - if(this.data.optionIsGoup) 2105 + var th = this;
  2106 + if (this.data.optionIsGoup)
2101 wx.navigateTo({ 2107 wx.navigateTo({
2102 url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true" 2108 url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true"
2103 }) 2109 })
2104 - var order=this.data.order;  
2105 - var order_goods=this.data.order_goods;  
2106 - var user_id=getApp().globalData.userInfo.user_id;  
2107 -  
2108 - var wlist="";  
2109 -  
2110 - var good=order_goods;  
2111 - //线下取价功能已经关闭或者过期  
2112 - if(!th.data.is_open_offline && good.offline_cut>0){  
2113 - wx.showModal({  
2114 - title: '提示',  
2115 - content: '线下取价功能已经关闭或者过期!'  
2116 - });  
2117 - return false;  
2118 - }  
2119 - //如果不是小程序有的功能,直接提示要去3.0处理  
2120 - if(good.prom_type==2 ){  
2121 - wx.showModal({  
2122 - title: '提示',  
2123 - content: '小程序还未有该活动,请到3.0公众号支付'  
2124 - });  
2125 - return false;  
2126 - } 2110 + var order = this.data.order;
  2111 + var order_goods = this.data.order_goods;
  2112 + var user_id = getApp().globalData.userInfo.user_id;
  2113 +
  2114 + var wlist = "";
  2115 +
  2116 + var good = order_goods;
  2117 + //线下取价功能已经关闭或者过期
  2118 + if (!th.data.is_open_offline && good.offline_cut > 0) {
  2119 + wx.showModal({
  2120 + title: '提示',
  2121 + content: '线下取价功能已经关闭或者过期!'
  2122 + });
  2123 + return false;
  2124 + }
  2125 + //如果不是小程序有的功能,直接提示要去3.0处理
  2126 + if (good.prom_type == 2) {
  2127 + wx.showModal({
  2128 + title: '提示',
  2129 + content: '小程序还未有该活动,请到3.0公众号支付'
  2130 + });
  2131 + return false;
  2132 + }
2127 2133
2128 - //要每件每件的商品进行检查,看有么有超出库存,超出限购  
2129 - var goodsbuynum=0,promgoodsbuynum=0,gg=null;  
2130 - //获取单品的现在的活动状态  
2131 - await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {  
2132 - }).then(res=>{  
2133 - gg=res.data.data;  
2134 - })  
2135 - var limit = gg.viplimited;  
2136 - var store_count = gg.store_count;  
2137 - good.erpwareid=gg.erpwareid; 2134 + //要每件每件的商品进行检查,看有么有超出库存,超出限购
  2135 + var goodsbuynum = 0, promgoodsbuynum = 0, gg = null;
  2136 + //获取单品的现在的活动状态
  2137 + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {
  2138 + }).then(res => {
  2139 + gg = res.data.data;
  2140 + })
  2141 + var limit = gg.viplimited;
  2142 + var store_count = gg.store_count;
  2143 + good.erpwareid = gg.erpwareid;
2138 2144
2139 - //---要获得商品,该用户买了多少件,同步应用---  
2140 - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {  
2141 - data: {  
2142 - store_id: os.stoid,  
2143 - user_id: getApp().globalData.user_id,  
2144 - goods_id: good.goods_id,  
2145 - prom_type: good.prom_type,  
2146 - prom_id: good.prom_id  
2147 - },  
2148 - }).then(res => {  
2149 - var buy_num_data = res.data.data;  
2150 - if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;  
2151 - goodsbuynum = buy_num_data.goodsbuynum;  
2152 - }) 2145 + //---要获得商品,该用户买了多少件,同步应用---
  2146 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  2147 + data: {
  2148 + store_id: os.stoid,
  2149 + user_id: getApp().globalData.user_id,
  2150 + goods_id: good.goods_id,
  2151 + prom_type: good.prom_type,
  2152 + prom_id: good.prom_id
  2153 + },
  2154 + }).then(res => {
  2155 + var buy_num_data = res.data.data;
  2156 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  2157 + goodsbuynum = buy_num_data.goodsbuynum;
  2158 + })
2153 2159
2154 - var buyed_mum2=goodsbuynum+good.goods_num;  
2155 - if (buyed_mum2 > limit && limit > 0) { 2160 + var buyed_mum2 = goodsbuynum + good.goods_num;
  2161 + if (buyed_mum2 > limit && limit > 0) {
2156 2162
2157 - var content=gg.goods_name+'购买数量超出商品限购,请取消订单';  
2158 - th.toast(content);  
2159 - return false;  
2160 - } 2163 + var content = gg.goods_name + '购买数量超出商品限购,请取消订单';
  2164 + th.toast(content);
  2165 + return false;
  2166 + }
2161 2167
2162 2168
2163 2169
2164 //如果是预售的时候, 2170 //如果是预售的时候,
2165 - if(good.prom_type==8){  
2166 - await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum",{  
2167 - data: {store_id: os.stoid, user_id: user_id, goods_id: good.goods_id, prom_id: good.prom_id},  
2168 - }).then(e=>{ 2171 + if (good.prom_type == 8) {
  2172 + await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum", {
  2173 + data: { store_id: os.stoid, user_id: user_id, goods_id: good.goods_id, prom_id: good.prom_id },
  2174 + }).then(e => {
2169 if (e.data.code == 0) { 2175 if (e.data.code == 0) {
2170 - promgoodsbuynum=e.data.data.sumgoodsnum; 2176 + promgoodsbuynum = e.data.data.sumgoodsnum;
2171 } 2177 }
2172 }) 2178 })
2173 2179
2174 - var presell_id =good.prom_id;  
2175 - var presellList=null; 2180 + var presell_id = good.prom_id;
  2181 + var presellList = null;
2176 var url = "/api/weshop/marketing/marketingPresellList/list" 2182 var url = "/api/weshop/marketing/marketingPresellList/list"
2177 var rd = { 2183 var rd = {
2178 store_id: os.stoid, 2184 store_id: os.stoid,
@@ -2185,13 +2191,13 @@ Page({ @@ -2185,13 +2191,13 @@ Page({
2185 }).then(res => { 2191 }).then(res => {
2186 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { 2192 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
2187 var arr = res.data.data[0]; 2193 var arr = res.data.data[0];
2188 - presellList=arr 2194 + presellList = arr
2189 } 2195 }
2190 }) 2196 })
2191 2197
2192 - if(presellList){ 2198 + if (presellList) {
2193 2199
2194 - if(good.goods_num>presellList.presell_sumqty-presellList.buy_goodnum){ 2200 + if (good.goods_num > presellList.presell_sumqty - presellList.buy_goodnum) {
2195 var content = gg.goods_name + '购买数量超出商品库存,请取消订单'; 2201 var content = gg.goods_name + '购买数量超出商品库存,请取消订单';
2196 th.toast(content); 2202 th.toast(content);
2197 return false; 2203 return false;
@@ -2207,247 +2213,248 @@ Page({ @@ -2207,247 +2213,248 @@ Page({
2207 } 2213 }
2208 2214
2209 2215
2210 - //如果优惠促销和搭配购的时候  
2211 - if((good.prom_type==3 || good.prom_type==5) && good.is_collocation!=1 && good.is_gift!=1){  
2212 - var p_ok=1;  
2213 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => {  
2214 - if(res.data.code==0){  
2215 - var r_data=res.data.data;  
2216 - if(!r_data.collocationPromList && good.prom_type==5){  
2217 -  
2218 - var content=good.goods_name+'未找到活动,请取消订单重新购买';  
2219 - th.toast(content);  
2220 - p_ok=0;  
2221 - }  
2222 - if(!r_data.promGoodsLists && good.prom_type==3){  
2223 -  
2224 - var content=good.goods_name+'未找到活动,请取消订单重新购买';  
2225 - th.toast(content);  
2226 - p_ok=0;  
2227 - }  
2228 - }else{ 2216 + //如果优惠促销和搭配购的时候
  2217 + if ((good.prom_type == 3 || good.prom_type == 5) && good.is_collocation != 1 && good.is_gift != 1) {
  2218 + var p_ok = 1;
  2219 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => {
  2220 + if (res.data.code == 0) {
  2221 + var r_data = res.data.data;
  2222 + if (!r_data.collocationPromList && good.prom_type == 5) {
2229 2223
2230 - var content=good.goods_name+'未找到活动,请取消订单重新购买'; 2224 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
2231 th.toast(content); 2225 th.toast(content);
2232 - p_ok=0; 2226 + p_ok = 0;
2233 } 2227 }
2234 - })  
2235 - if(!p_ok) return false;  
2236 - } 2228 + if (!r_data.promGoodsLists && good.prom_type == 3) {
2237 2229
2238 - //商品的普通购买 ,不要进行判断  
2239 - if((good.prom_type==1 || good.prom_type==6 || good.prom_type==4) && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal){  
2240 - if(gg.prom_type!=good.prom_type) { 2230 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
  2231 + th.toast(content);
  2232 + p_ok = 0;
  2233 + }
  2234 + } else {
2241 2235
2242 - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; 2236 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
2243 th.toast(content); 2237 th.toast(content);
2244 - return false; 2238 + p_ok = 0;
2245 } 2239 }
2246 - }else{  
2247 - if((gg.prom_type==1 || gg.prom_type==3 || gg.prom_type==5 || gg.prom_type==6 || gg.prom_type==4)  
2248 - && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {  
2249 - var prom=null;  
2250 - //---如果是活动的时候---  
2251 - var prom=null,th=this;  
2252 - if(gg.prom_type==1){  
2253 - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+gg.prom_id,{  
2254 - }).then(res=>{  
2255 - if(res.data.code==0){  
2256 - prom=res.data.data;  
2257 - }  
2258 - })  
2259 - }  
2260 - if(gg.prom_type==6){  
2261 - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+gg.prom_id,{  
2262 - }).then(res=>{  
2263 - if(res.data.code==0){  
2264 - prom=res.data.data;  
2265 - }  
2266 - })  
2267 - }  
2268 -  
2269 - if(gg.prom_type==4){  
2270 - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{  
2271 - data:{store_id:os.stoid,goods_id:gg.goods_id}  
2272 - }).then(res=>{  
2273 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){  
2274 - prom=res.data.data.pageData[0];  
2275 - }  
2276 - })  
2277 - } 2240 + })
  2241 + if (!p_ok) return false;
  2242 + }
2278 2243
2279 - if(prom){  
2280 - var t_now=ut.gettimestamp();  
2281 - if(prom.is_end==0 && prom.start_time<t_now && prom.end_time>t_now){ 2244 + //商品的普通购买 ,不要进行判断
  2245 + if ((good.prom_type == 1 || good.prom_type == 6 || good.prom_type == 4) && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) {
  2246 + if (gg.prom_type != good.prom_type) {
2282 2247
2283 - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买';  
2284 - th.toast(content);  
2285 - return false; 2248 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  2249 + th.toast(content);
  2250 + return false;
  2251 + }
  2252 + } else {
  2253 + if ((gg.prom_type == 1 || gg.prom_type == 3 || gg.prom_type == 5 || gg.prom_type == 6 || gg.prom_type == 4)
  2254 + && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {
  2255 + var prom = null;
  2256 + //---如果是活动的时候---
  2257 + var prom = null, th = this;
  2258 + if (gg.prom_type == 1) {
  2259 + await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + gg.prom_id, {
  2260 + }).then(res => {
  2261 + if (res.data.code == 0) {
  2262 + prom = res.data.data;
2286 } 2263 }
2287 - } 2264 + })
  2265 + }
  2266 + if (gg.prom_type == 6) {
  2267 + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + gg.prom_id, {
  2268 + }).then(res => {
  2269 + if (res.data.code == 0) {
  2270 + prom = res.data.data;
  2271 + }
  2272 + })
2288 } 2273 }
2289 - else{  
2290 - //不是赠品的时候  
2291 - if(!good.is_gift && good.prom_type!=3){  
2292 - var t_ok=1;  
2293 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => {  
2294 - if(res.data.code==0){  
2295 - var r_data=res.data.data;  
2296 - //-- 参加了全局的优惠活动 --  
2297 - if(r_data.promGoodsLists){  
2298 -  
2299 - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买';  
2300 - th.toast(content);  
2301 - t_ok=0;  
2302 - }  
2303 - }  
2304 - })  
2305 - if(!t_ok) return false;  
2306 - }  
2307 2274
2308 - //-- 如果有参加线下取价 --  
2309 - if(good.offline_cut>0) wlist+=encodeURIComponent(gg.erpwareid)+","; 2275 + if (gg.prom_type == 4) {
  2276 + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1", {
  2277 + data: { store_id: os.stoid, goods_id: gg.goods_id }
  2278 + }).then(res => {
  2279 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
  2280 + prom = res.data.data.pageData[0];
  2281 + }
  2282 + })
2310 } 2283 }
2311 - //赠品和搭配购不判断商品金额  
2312 - var isok=1;  
2313 - var card_field=th.data.card_field;  
2314 - //如果会员是等级会员,商品有等级价,且不是活动商品  
2315 - if(!good.is_gift && !good.is_collocation && good.prom_type!=8) {  
2316 - if (card_field && gg[card_field] > 0) {  
2317 - if (good.goods_price != gg[card_field] && good.offline_cut<=0) isok = 0;  
2318 - if (good.goods_price >gg[card_field] && good.offline_cut>0) isok = 0; //如果线下价格比较贵,则不通过  
2319 2284
2320 - } else {  
2321 - if (good.goods_price != gg.shop_price && good.offline_cut<=0) isok = 0;  
2322 - if (good.goods_price> gg.shop_price && good.offline_cut>0) isok = 0; //如果线下价格比较贵,则不通过  
2323 - }  
2324 - var is_h=0;  
2325 - if (!isok) { 2285 + if (prom) {
  2286 + var t_now = ut.gettimestamp();
  2287 + if (prom.is_end == 0 && prom.start_time < t_now && prom.end_time > t_now) {
2326 2288
2327 - var content=gg.goods_name + '商品的价格发生了变化,请取消订单重新购买'; 2289 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
2328 th.toast(content); 2290 th.toast(content);
2329 return false; 2291 return false;
2330 } 2292 }
2331 } 2293 }
  2294 + }
  2295 + else {
  2296 + //不是赠品的时候
  2297 + if (!good.is_gift && good.prom_type != 3) {
  2298 + var t_ok = 1;
  2299 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => {
  2300 + if (res.data.code == 0) {
  2301 + var r_data = res.data.data;
  2302 + //-- 参加了全局的优惠活动 --
  2303 + if (r_data.promGoodsLists) {
2332 2304
  2305 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  2306 + th.toast(content);
  2307 + t_ok = 0;
  2308 + }
  2309 + }
  2310 + })
  2311 + if (!t_ok) return false;
  2312 + }
2333 2313
2334 - if(good.goods_num>store_count){  
2335 -  
2336 - var content=gg.goods_name+'商品的库存不足,请取消订单';  
2337 - th.toast(content);  
2338 - return false;  
2339 - } 2314 + //-- 如果有参加线下取价 --
  2315 + if (good.offline_cut > 0) wlist += encodeURIComponent(gg.erpwareid) + ",";
  2316 + }
  2317 + //赠品和搭配购不判断商品金额
  2318 + var isok = 1;
  2319 + var card_field = th.data.card_field;
  2320 + //如果会员是等级会员,商品有等级价,且不是活动商品
  2321 + if (!good.is_gift && !good.is_collocation && good.prom_type != 8) {
  2322 + if (card_field && gg[card_field] > 0) {
  2323 + if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
  2324 + if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
2340 2325
  2326 + } else {
  2327 + if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
  2328 + if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
  2329 + }
  2330 + var is_h = 0;
  2331 + if (!isok) {
2341 2332
  2333 + var content = gg.goods_name + '商品的价格发生了变化,请取消订单重新购买';
  2334 + th.toast(content);
  2335 + return false;
  2336 + }
2342 } 2337 }
2343 2338
2344 - console.log("------------------------------------");  
2345 - //---如果是活动的时候---  
2346 - var prom=null,goodsinfo=good,th=this;  
2347 - if(goodsinfo.prom_type==1){  
2348 - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+goodsinfo.prom_id,{  
2349 - }).then(res=>{  
2350 - if(res.data.code==0){  
2351 - prom=res.data.data;  
2352 - }  
2353 - }) 2339 +
  2340 + if (good.goods_num > store_count) {
  2341 +
  2342 + var content = gg.goods_name + '商品的库存不足,请取消订单';
  2343 + th.toast(content);
  2344 + return false;
2354 } 2345 }
2355 - if(goodsinfo.prom_type==6 && !good.is_pd_normal){  
2356 - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+goodsinfo.prom_id,{  
2357 - }).then(res=>{  
2358 - if(res.data.code==0){  
2359 - prom=res.data.data;  
2360 - }  
2361 - }) 2346 +
  2347 +
  2348 + }
  2349 +
  2350 + console.log("------------------------------------");
  2351 + //---如果是活动的时候---
  2352 + var prom = null, goodsinfo = good, th = this;
  2353 + if (goodsinfo.prom_type == 1) {
  2354 + await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + goodsinfo.prom_id, {
  2355 + }).then(res => {
  2356 + if (res.data.code == 0) {
  2357 + prom = res.data.data;
  2358 + }
  2359 + })
  2360 + }
  2361 + if (goodsinfo.prom_type == 6 && !good.is_pd_normal) {
  2362 + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + goodsinfo.prom_id, {
  2363 + }).then(res => {
  2364 + if (res.data.code == 0) {
  2365 + prom = res.data.data;
  2366 + }
  2367 + })
  2368 + }
  2369 +
  2370 + if (goodsinfo.prom_type == 4 && !good.is_integral_normal) {
  2371 + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1", {
  2372 + data: { store_id: os.stoid, goods_id: goodsinfo.goods_id }
  2373 + }).then(res => {
  2374 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
  2375 + prom = res.data.data.pageData[0];
  2376 + }
  2377 + })
  2378 + }
  2379 +
  2380 + //----------如果有活动,并且在进行中,就不计算线下库存---------------
  2381 + if (prom) {
  2382 + var now = ut.gettimestamp();
  2383 + if (prom.is_end == 1 && prom.end_time < now) {
  2384 +
  2385 + var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单重新购买';
  2386 + th.toast(content);
  2387 + return false;
2362 } 2388 }
2363 2389
2364 - if(goodsinfo.prom_type==4 && !good.is_integral_normal){  
2365 - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{  
2366 - data:{store_id:os.stoid,goods_id:goodsinfo.goods_id}  
2367 - }).then(res=>{  
2368 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){  
2369 - prom=res.data.data.pageData[0];  
2370 - }  
2371 - }) 2390 + buyed_mum2 = promgoodsbuynum + good.goods_num;
  2391 + if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) {
  2392 +
  2393 + var content = goodsinfo.goods_name + '购买数量超出商品活动限购,请取消订单重新购买';
  2394 + th.toast(content);
  2395 + return false;
2372 } 2396 }
2373 2397
2374 - //----------如果有活动,并且在进行中,就不计算线下库存---------------  
2375 - if(prom){  
2376 - var now=ut.gettimestamp();  
2377 - if(prom.is_end==1 && prom.end_time<now){ 2398 + if (goodsinfo.prom_type == 4) {
  2399 + if (good.goods_num > prom.limitqty - prom.buy_num) {
2378 2400
2379 - var content=goodsinfo.goods_name+'商品的活动已经结束,请取消订单重新购买'; 2401 + var content = goodsinfo.goods_name + '购买数量超出商品活动库存,请取消订单';
2380 th.toast(content); 2402 th.toast(content);
2381 return false; 2403 return false;
2382 } 2404 }
  2405 + } else {
  2406 + var redis_num = 0;
  2407 + //------判断活动是否抢光-----
  2408 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  2409 + os.stoid + "/" + goodsinfo.prom_type + "/" + goodsinfo.prom_id, {
  2410 + }).then(res => {
  2411 + redis_num = res.data.data;
  2412 + });
2383 2413
2384 - buyed_mum2=promgoodsbuynum+good.goods_num;  
2385 - if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) { 2414 + if (good.goods_num > redis_num) {
2386 2415
2387 - var content=goodsinfo.goods_name+'购买数量超出商品活动限购,请取消订单重新购买'; 2416 + var content = gg.goods_name + '超出商品活动库存,请取消订单';
2388 th.toast(content); 2417 th.toast(content);
2389 return false; 2418 return false;
2390 } 2419 }
2391 -  
2392 - if(goodsinfo.prom_type==4){  
2393 - if (good.goods_num > prom.limitqty-prom.buy_num) {  
2394 -  
2395 - var content=goodsinfo.goods_name+'购买数量超出商品活动库存,请取消订单';  
2396 - th.toast(content);  
2397 - return false;  
2398 - }  
2399 - }else{  
2400 - var redis_num = 0;  
2401 - //------判断活动是否抢光-----  
2402 - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +  
2403 - os.stoid + "/" + goodsinfo.prom_type + "/" + goodsinfo.prom_id, {  
2404 - }).then(res => {  
2405 - redis_num = res.data.data;  
2406 - });  
2407 -  
2408 - if (good.goods_num > redis_num) {  
2409 -  
2410 - var content=gg.goods_name+'超出商品活动库存,请取消订单';  
2411 - th.toast(content);  
2412 - return false;  
2413 - }  
2414 - }  
2415 -  
2416 } 2420 }
2417 2421
  2422 + }
  2423 +
2418 2424
2419 2425
2420 //-- 要判断一下线下取价价格是不是发生改变 -- 2426 //-- 要判断一下线下取价价格是不是发生改变 --
2421 - if(wlist!="" && th.data.is_open_offline && th.data.is_open_offline>0){  
2422 - wlist=ut.sub_last(wlist);  
2423 - var keyid=order.pickup_id;  
2424 - var user_info=getApp().globalData.userInfo;  
2425 - if(!keyid) return false;  
2426 - var offarr=null; 2427 + if (wlist != "" && th.data.is_open_offline && th.data.is_open_offline > 0) {
  2428 + wlist = ut.sub_last(wlist);
  2429 + var keyid = order.pickup_id;
  2430 + var user_info = getApp().globalData.userInfo;
  2431 + if (!keyid) return false;
  2432 + var offarr = null;
2427 await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", { 2433 await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", {
2428 - data:{  
2429 - VIPId:encodeURIComponent(user_info.erpvipid),  
2430 - store_id:os.stoid,  
2431 - PickupId:keyid,  
2432 - WareIds:wlist}, 2434 + data: {
  2435 + VIPId: encodeURIComponent(user_info.erpvipid),
  2436 + store_id: os.stoid,
  2437 + PickupId: keyid,
  2438 + WareIds: wlist
2433 }, 2439 },
2434 - ).then(res=>{  
2435 - if(res.data.code==0 && res.data.data && res.data.data.length>0){  
2436 - offarr=res.data.data; 2440 + },
  2441 + ).then(res => {
  2442 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  2443 + offarr = res.data.data;
2437 } 2444 }
2438 }) 2445 })
2439 - if(!offarr && offarr.length<=0 ){  
2440 - wx.showModal({ title: '获取线下取价失败',}); 2446 + if (!offarr && offarr.length <= 0) {
  2447 + wx.showModal({ title: '获取线下取价失败', });
2441 } 2448 }
2442 - var newarr=ut.convert_arr_key(offarr,'WareId'); 2449 + var newarr = ut.convert_arr_key(offarr, 'WareId');
2443 //-- 循环判断线下的价格 -- 2450 //-- 循环判断线下的价格 --
2444 - for(var k in order_goods){  
2445 - var good=order_goods[k]; 2451 + for (var k in order_goods) {
  2452 + var good = order_goods[k];
2446 //判断线下取价是不是一样 2453 //判断线下取价是不是一样
2447 - if(newarr[good.erpwareid] &&  
2448 - parseFloat(newarr[good.erpwareid].WarePrice)!=parseFloat(good.goods_price)){ 2454 + if (newarr[good.erpwareid] &&
  2455 + parseFloat(newarr[good.erpwareid].WarePrice) != parseFloat(good.goods_price)) {
2449 2456
2450 - var content=good.goods_name + '商品的价格发生了变化,请取消订单重新购买'; 2457 + var content = good.goods_name + '商品的价格发生了变化,请取消订单重新购买';
2451 th.toast(content); 2458 th.toast(content);
2452 return false; 2459 return false;
2453 } 2460 }
@@ -2462,30 +2469,30 @@ Page({ @@ -2462,30 +2469,30 @@ Page({
2462 type: 1 //正常单 2469 type: 1 //正常单
2463 }, 1);--*/ 2470 }, 1);--*/
2464 2471
2465 - util_pay.pay(this.data.order.order_sn, function() {  
2466 - wx.showToast({title: '支付成功'}) 2472 + util_pay.pay(this.data.order.order_sn, function () {
  2473 + wx.showToast({ title: '支付成功' })
2467 wx.navigateBack(); 2474 wx.navigateBack();
2468 - },null,os.stoid,1); 2475 + }, null, os.stoid, 1);
2469 2476
2470 2477
2471 }, 2478 },
2472 2479
2473 //--------取消订单--------- 2480 //--------取消订单---------
2474 - cancelOrder: function(e) {  
2475 - var t = this,th=t, ord_id = this.data.order.order_id,order=this.data.order; 2481 + cancelOrder: function (e) {
  2482 + var t = this, th = t, ord_id = this.data.order.order_id, order = this.data.order;
2476 2483
2477 wx.showModal({ 2484 wx.showModal({
2478 title: "是否取消订单?", 2485 title: "是否取消订单?",
2479 - success: function(e) {  
2480 - if(!e.confirm) return false; 2486 + success: function (e) {
  2487 + if (!e.confirm) return false;
2481 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单 2488 //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单
2482 //if(is_skill==1 || is_zsorder>=2){ 2489 //if(is_skill==1 || is_zsorder>=2){
2483 - getApp().request.post("/api/weshop/order/cancelOrder/"+os.stoid+"/"+ord_id+"/"+getApp().globalData.user_id,{  
2484 - data:{},  
2485 - success: function(t) {  
2486 - if(t.data.code==0){  
2487 - th.setData({'order.order_status':3});  
2488 - wx.setStorageSync("order:order_list:update", !0); 2490 + getApp().request.post("/api/weshop/order/cancelOrder/" + os.stoid + "/" + ord_id + "/" + getApp().globalData.user_id, {
  2491 + data: {},
  2492 + success: function (t) {
  2493 + if (t.data.code == 0) {
  2494 + th.setData({ 'order.order_status': 3 });
  2495 + wx.setStorageSync("order:order_list:update", !0);
2489 } 2496 }
2490 2497
2491 }, 2498 },
@@ -2497,36 +2504,36 @@ Page({ @@ -2497,36 +2504,36 @@ Page({
2497 2504
2498 2505
2499 //-----删除订单----- 2506 //-----删除订单-----
2500 - deleteOrderData: function(t) {  
2501 - var th=this;  
2502 - var order_id=this.data.order.order_id;  
2503 - var up_data={  
2504 - order_id: order_id,isdel:1 2507 + deleteOrderData: function (t) {
  2508 + var th = this;
  2509 + var order_id = this.data.order.order_id;
  2510 + var up_data = {
  2511 + order_id: order_id, isdel: 1
2505 }; 2512 };
2506 - if(th.data.order.order_status!=6){  
2507 - up_data.order_status=5; 2513 + if (th.data.order.order_status != 6) {
  2514 + up_data.order_status = 5;
2508 } 2515 }
2509 wx.showModal({ 2516 wx.showModal({
2510 title: "是否删除订单?", 2517 title: "是否删除订单?",
2511 - success: function(tt) { 2518 + success: function (tt) {
2512 tt.confirm && getApp().request.put("/api/weshop/order/updatebyId", { 2519 tt.confirm && getApp().request.put("/api/weshop/order/updatebyId", {
2513 data: up_data, 2520 data: up_data,
2514 success: function (t) { 2521 success: function (t) {
2515 - getApp().my_warnning("删除成功",1,th); 2522 + getApp().my_warnning("删除成功", 1, th);
2516 setTimeout(function () { 2523 setTimeout(function () {
2517 getApp().goto("/pages/user/order_list/order_list"); 2524 getApp().goto("/pages/user/order_list/order_list");
2518 - },1000); 2525 + }, 1000);
2519 } 2526 }
2520 }) 2527 })
2521 } 2528 }
2522 }); 2529 });
2523 }, 2530 },
2524 2531
2525 - go_goods:function (e) {  
2526 - var url=e.currentTarget.dataset.url; 2532 + go_goods: function (e) {
  2533 + var url = e.currentTarget.dataset.url;
2527 getApp().goto(url); 2534 getApp().goto(url);
2528 }, 2535 },
2529 - toast(msg){ 2536 + toast(msg) {
2530 wx.showToast({ 2537 wx.showToast({
2531 title: msg, 2538 title: msg,
2532 icon: 'none', 2539 icon: 'none',
@@ -2534,15 +2541,15 @@ Page({ @@ -2534,15 +2541,15 @@ Page({
2534 }) 2541 })
2535 }, 2542 },
2536 //--------确认收货--------- 2543 //--------确认收货---------
2537 - confirmOrder: function(e) {  
2538 - var th=this;  
2539 - var o = this.data.order.order_id,order=this.data.order; 2544 + confirmOrder: function (e) {
  2545 + var th = this;
  2546 + var o = this.data.order.order_id, order = this.data.order;
2540 wx.showModal({ 2547 wx.showModal({
2541 title: "是否确认收货?", 2548 title: "是否确认收货?",
2542 - success: function(t) {  
2543 - t.confirm && getApp().request.post("/api/weshop/order/confirmOrder/"+os.stoid+"/"+o+"/"+getApp().globalData.user_id,{  
2544 - success:function (e) {  
2545 - if(e.data.code==0){ 2549 + success: function (t) {
  2550 + t.confirm && getApp().request.post("/api/weshop/order/confirmOrder/" + os.stoid + "/" + o + "/" + getApp().globalData.user_id, {
  2551 + success: function (e) {
  2552 + if (e.data.code == 0) {
2546 th.setData({}) 2553 th.setData({})
2547 } 2554 }
2548 } 2555 }
@@ -2553,13 +2560,13 @@ Page({ @@ -2553,13 +2560,13 @@ Page({
2553 2560
2554 2561
2555 //---------联系客服------------ 2562 //---------联系客服------------
2556 - contactService: function() {  
2557 - getApp().getConfig(function(t) { 2563 + contactService: function () {
  2564 + getApp().getConfig(function (t) {
2558 if (t.store_tel == undefined) { 2565 if (t.store_tel == undefined) {
2559 getApp().request.get("/api/weshop/store/get/" + os.stoid, { 2566 getApp().request.get("/api/weshop/store/get/" + os.stoid, {
2560 isShowLoading: 1, 2567 isShowLoading: 1,
2561 data: {}, 2568 data: {},
2562 - success: function(rs) { 2569 + success: function (rs) {
2563 getApp().globalData.config = rs.data.data; 2570 getApp().globalData.config = rs.data.data;
2564 if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { 2571 if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
2565 getApp().my_warnning("商家未设置电话", 0, th); 2572 getApp().my_warnning("商家未设置电话", 0, th);
@@ -2575,13 +2582,13 @@ Page({ @@ -2575,13 +2582,13 @@ Page({
2575 }, 2582 },
2576 2583
2577 //---------联系微信客服------------ 2584 //---------联系微信客服------------
2578 - con_weixin:function () {  
2579 - var url=this.data.sys_switch.weapp_customertype_url;  
2580 - var id=this.data.sys_switch.weapp_customertype_appid; 2585 + con_weixin: function () {
  2586 + var url = this.data.sys_switch.weapp_customertype_url;
  2587 + var id = this.data.sys_switch.weapp_customertype_appid;
2581 wx.openCustomerServiceChat({ 2588 wx.openCustomerServiceChat({
2582 - extInfo: {url: url}, 2589 + extInfo: { url: url },
2583 corpId: id, 2590 corpId: id,
2584 - success(res) {} 2591 + success(res) { }
2585 }) 2592 })
2586 } 2593 }
2587 2594
packageC/pages/presell/cart/cart2.js
@@ -121,25 +121,25 @@ Page({ @@ -121,25 +121,25 @@ Page({
121 tabs: ['门店自提', '快递邮寄'], 121 tabs: ['门店自提', '快递邮寄'],
122 currentTabIndex: 1, 122 currentTabIndex: 1,
123 123
124 - in_zhact_gdmap:{}, //不同门店参与同一活动的限购  
125 - hid_inp:1,  
126 - user_note:{}, 124 + in_zhact_gdmap: {}, //不同门店参与同一活动的限购
  125 + hid_inp: 1,
  126 + user_note: {},
127 }, 127 },
128 onLoad: function (t) { 128 onLoad: function (t) {
129 - wx.setNavigationBarTitle({title: "填写订单",}) 129 + wx.setNavigationBarTitle({ title: "填写订单", })
130 var th = this; 130 var th = this;
131 //清理一下,确保最新的系统配置 131 //清理一下,确保最新的系统配置
132 getApp().globalData.config2 = null; 132 getApp().globalData.config2 = null;
133 //清空is_pick_up 133 //清空is_pick_up
134 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 134 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
135 - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, 135 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
136 success: function (s) { 136 success: function (s) {
137 } 137 }
138 }); 138 });
139 139
140 }, 140 },
141 onUnload: function () { 141 onUnload: function () {
142 - this.setData({isclose: 1}) 142 + this.setData({ isclose: 1 })
143 }, 143 },
144 onHide: function () { 144 onHide: function () {
145 this.setData({ 145 this.setData({
@@ -152,7 +152,7 @@ Page({ @@ -152,7 +152,7 @@ Page({
152 //----------子页返回父页触发---------- 152 //----------子页返回父页触发----------
153 onShow: function () { 153 onShow: function () {
154 var th = this; 154 var th = this;
155 - th.setData({show_submit: 0}); //让提交先掩藏 155 + th.setData({ show_submit: 0 }); //让提交先掩藏
156 th.data.g_cart_q_time = null; 156 th.data.g_cart_q_time = null;
157 157
158 if (th.data.isclose == 0) { 158 if (th.data.isclose == 0) {
@@ -182,20 +182,20 @@ Page({ @@ -182,20 +182,20 @@ Page({
182 th.data.is_summit_ing = 0; 182 th.data.is_summit_ing = 0;
183 //更换地址回来要重新调用计算价钱的接口 183 //更换地址回来要重新调用计算价钱的接口
184 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { 184 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
185 - th.setData({user_addr: ie}); 185 + th.setData({ user_addr: ie });
186 if (th.data.is_b_now == 1) { 186 if (th.data.is_b_now == 1) {
187 if (th.data.bn_goods) { 187 if (th.data.bn_goods) {
188 - th.setData({add_back: 1}); 188 + th.setData({ add_back: 1 });
189 //th.calculatePrice2(); 189 //th.calculatePrice2();
190 } 190 }
191 } else { 191 } else {
192 if (th.data.cartlist) { 192 if (th.data.cartlist) {
193 - th.setData({add_back: 1}); 193 + th.setData({ add_back: 1 });
194 //th.calculatePrice(); 194 //th.calculatePrice();
195 } 195 }
196 } 196 }
197 } else { 197 } else {
198 - th.setData({user_addr: ie}); 198 + th.setData({ user_addr: ie });
199 } 199 }
200 var going = 0; 200 var going = 0;
201 201
@@ -234,34 +234,34 @@ Page({ @@ -234,34 +234,34 @@ Page({
234 //-- 获取所有的等级卡, -- 234 //-- 获取所有的等级卡, --
235 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, 235 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
236 {}).then(res => { 236 {}).then(res => {
237 - if (res.data.code == 0) {  
238 - var plusCard = res.data.data;  
239 - //-- 循环判断,拿到最贵的那张卡 --  
240 - for (var ih in plusCard) {  
241 - if (plusCard[ih].IsStopBuy == true) {  
242 - continue;  
243 - }  
244 - if (max_price < 0) {  
245 - max_price = plusCard[ih].CardFee;  
246 - name = 'card' + plusCard[ih]['CorrPrice'];  
247 - show_card = plusCard[ih];  
248 - } else {  
249 - if (max_price < plusCard[ih].CardFee) { 237 + if (res.data.code == 0) {
  238 + var plusCard = res.data.data;
  239 + //-- 循环判断,拿到最贵的那张卡 --
  240 + for (var ih in plusCard) {
  241 + if (plusCard[ih].IsStopBuy == true) {
  242 + continue;
  243 + }
  244 + if (max_price < 0) {
250 max_price = plusCard[ih].CardFee; 245 max_price = plusCard[ih].CardFee;
251 name = 'card' + plusCard[ih]['CorrPrice']; 246 name = 'card' + plusCard[ih]['CorrPrice'];
252 show_card = plusCard[ih]; 247 show_card = plusCard[ih];
  248 + } else {
  249 + if (max_price < plusCard[ih].CardFee) {
  250 + max_price = plusCard[ih].CardFee;
  251 + name = 'card' + plusCard[ih]['CorrPrice'];
  252 + show_card = plusCard[ih];
  253 + }
253 } 254 }
254 } 255 }
255 - }  
256 256
257 - if (show_card) {  
258 - name = name.toLowerCase();  
259 - th.setData({card_name: name, show_card: show_card}) 257 + if (show_card) {
  258 + name = name.toLowerCase();
  259 + th.setData({ card_name: name, show_card: show_card })
  260 + }
260 } 261 }
261 - }  
262 - //-----先获取物流,再获取用户信息,再展示页面-----  
263 - th.get_wuliu(th.get_info(th.show_page));  
264 - }) 262 + //-----先获取物流,再获取用户信息,再展示页面-----
  263 + th.get_wuliu(th.get_info(th.show_page));
  264 + })
265 } else { 265 } else {
266 //-----先获取物流,再获取用户信息,再展示页面----- 266 //-----先获取物流,再获取用户信息,再展示页面-----
267 th.get_wuliu(th.get_info(th.show_page)); 267 th.get_wuliu(th.get_info(th.show_page));
@@ -281,10 +281,10 @@ Page({ @@ -281,10 +281,10 @@ Page({
281 if (th.data.is_default_logistics) { 281 if (th.data.is_default_logistics) {
282 //如果第一个不是开启默认,说明要让用户自己选 282 //如果第一个不是开启默认,说明要让用户自己选
283 if (!e[0].is_default) { 283 if (!e[0].is_default) {
284 - th.setData({is_default_logistics: 0}); 284 + th.setData({ is_default_logistics: 0 });
285 } 285 }
286 } 286 }
287 - th.setData({wu_arr: e}) 287 + th.setData({ wu_arr: e })
288 typeof func == "function" && func(); 288 typeof func == "function" && func();
289 }) 289 })
290 }, 290 },
@@ -298,7 +298,7 @@ Page({ @@ -298,7 +298,7 @@ Page({
298 getuser_addr: function (func) { 298 getuser_addr: function (func) {
299 var th = this; 299 var th = this;
300 a.get("/api/weshop/useraddress/page", { 300 a.get("/api/weshop/useraddress/page", {
301 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, 301 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() },
302 success: function (su) { 302 success: function (su) {
303 /*--- 303 /*---
304 var user_addr=[ 304 var user_addr=[
@@ -323,7 +323,7 @@ Page({ @@ -323,7 +323,7 @@ Page({
323 } 323 }
324 324
325 if (item == undefined) item = null; 325 if (item == undefined) item = null;
326 - if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 326 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存
327 327
328 func(item); 328 func(item);
329 } 329 }
@@ -338,32 +338,32 @@ Page({ @@ -338,32 +338,32 @@ Page({
338 //会员的信息,要获取最新 338 //会员的信息,要获取最新
339 var user = getApp().globalData.userInfo; 339 var user = getApp().globalData.userInfo;
340 getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { 340 getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
341 - data: {r: Math.random()}, 341 + data: { r: Math.random() },
342 success: function (e) { 342 success: function (e) {
343 getApp().globalData.userInfo = e.data.data; 343 getApp().globalData.userInfo = e.data.data;
344 - th.setData({userinfo: e.data.data}); 344 + th.setData({ userinfo: e.data.data });
345 345
346 //选获取地址 346 //选获取地址
347 th.getuser_addr(function (addr) { 347 th.getuser_addr(function (addr) {
348 - th.setData({user_addr: addr});  
349 - //--------------------------立即购买------------------  
350 - //读取门店  
351 - to.get_allsto(function (e) {  
352 - th.setData({allsto: e});  
353 - //获取立即购买的商品信息  
354 - th.get_buy_goods();  
355 - }); 348 + th.setData({ user_addr: addr });
  349 + //--------------------------立即购买------------------
  350 + //读取门店
  351 + to.get_allsto(function (e) {
  352 + th.setData({ allsto: e });
  353 + //获取立即购买的商品信息
  354 + th.get_buy_goods();
  355 + });
356 356
357 }); 357 });
358 358
359 //获取提现金额 359 //获取提现金额
360 getApp().request.get("/api/weshop/withdrawals/summoney", { 360 getApp().request.get("/api/weshop/withdrawals/summoney", {
361 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, status: 0}, 361 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
362 success: function (su) { 362 success: function (su) {
363 if (su.data.code == 0) { 363 if (su.data.code == 0) {
364 var yuer = parseFloat(th.data.userinfo.user_money - 364 var yuer = parseFloat(th.data.userinfo.user_money -
365 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); 365 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
366 - th.setData({txmon: su.data.data.summoney, yuer: yuer}); 366 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
367 } 367 }
368 } 368 }
369 }); 369 });
@@ -379,127 +379,127 @@ Page({ @@ -379,127 +379,127 @@ Page({
379 th.data.gg = to.get_b_now(); 379 th.data.gg = to.get_b_now();
380 //--------如果goods_id一样,就是要立即购买----- 380 //--------如果goods_id一样,就是要立即购买-----
381 getApp().request.get("/api/weshop/goods/get/" + oo.stoid + "/" + th.data.gg.goods_id, { 381 getApp().request.get("/api/weshop/goods/get/" + oo.stoid + "/" + th.data.gg.goods_id, {
382 - success: async function (t) {  
383 - var gd = t.data.data;  
384 - if (!gd) return false;  
385 -  
386 - t.data.data.original_img = oo.imghost + t.data.data.original_img;  
387 - t.data.data['buynum'] = th.data.gg.goods_num;  
388 - var distr_t = 0, et = 0  
389 - if (t.data.data.distr_type == 0) {  
390 - distr_t = th.data.gg.pick_dis;  
391 - } else {  
392 - distr_t = t.data.data.distr_type;  
393 - } 382 + success: async function (t) {
  383 + var gd = t.data.data;
  384 + if (!gd) return false;
  385 +
  386 + t.data.data.original_img = oo.imghost + t.data.data.original_img;
  387 + t.data.data['buynum'] = th.data.gg.goods_num;
  388 + var distr_t = 0, et = 0
  389 + if (t.data.data.distr_type == 0) {
  390 + distr_t = th.data.gg.pick_dis;
  391 + } else {
  392 + distr_t = t.data.data.distr_type;
  393 + }
394 394
395 - switch (distr_t) {  
396 - case 0:  
397 - et = 1;  
398 - //-- 系统后台有设置要默认的 --  
399 - if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;  
400 - break;  
401 - case 1:  
402 - et = 1;  
403 - break;  
404 - case 2:  
405 - et = 0;  
406 - break;  
407 - } 395 + switch (distr_t) {
  396 + case 0:
  397 + et = 1;
  398 + //-- 系统后台有设置要默认的 --
  399 + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;
  400 + break;
  401 + case 1:
  402 + et = 1;
  403 + break;
  404 + case 2:
  405 + et = 0;
  406 + break;
  407 + }
408 408
409 409
410 - var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;  
411 - if (et == 0 && def_exp_code) {  
412 - for (var k = 0; k < th.data.wu_arr.length; k++) {  
413 - var item = th.data.wu_arr[k];  
414 - if (def_exp_code == item.code) {  
415 - m_wind = k;  
416 - } 410 + var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  411 + if (et == 0 && def_exp_code) {
  412 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  413 + var item = th.data.wu_arr[k];
  414 + if (def_exp_code == item.code) {
  415 + m_wind = k;
417 } 416 }
418 } 417 }
  418 + }
419 419
420 - if (th.data.bn_goods) {  
421 - et = th.data.bn_exp_type;  
422 - m_wind = th.data.index;  
423 - } 420 + if (th.data.bn_goods) {
  421 + et = th.data.bn_exp_type;
  422 + m_wind = th.data.index;
  423 + }
424 424
425 - //---是不是购买等级卡成功的返回---等级卡显示的判断---  
426 - var is_card_back = getApp().globalData.is_card_back;  
427 - if (is_card_back) {  
428 - th.data.card_name = th.data.userinfo.card_field;  
429 - th.data.gg.goods_price = gd[th.data.card_name];  
430 - getApp().globalData.is_card_back = 0;  
431 - th.setData({card_cut_price: 0});  
432 - //如果是秒杀的返回  
433 - if (gd.prom_type == 1) gd.prom_type = 0;  
434 - } else {  
435 - //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格  
436 - //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --  
437 - if (!th.data.gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && th.data.gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {  
438 - var cut_p = (th.data.gg.goods_price - gd[th.data.card_name]) * th.data.gg.goods_num;  
439 - th.setData({card_cut_price: cut_p});  
440 - } 425 + //---是不是购买等级卡成功的返回---等级卡显示的判断---
  426 + var is_card_back = getApp().globalData.is_card_back;
  427 + if (is_card_back) {
  428 + th.data.card_name = th.data.userinfo.card_field;
  429 + th.data.gg.goods_price = gd[th.data.card_name];
  430 + getApp().globalData.is_card_back = 0;
  431 + th.setData({ card_cut_price: 0 });
  432 + //如果是秒杀的返回
  433 + if (gd.prom_type == 1) gd.prom_type = 0;
  434 + } else {
  435 + //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格
  436 + //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --
  437 + if (!th.data.gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && th.data.gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {
  438 + var cut_p = (th.data.gg.goods_price - gd[th.data.card_name]) * th.data.gg.goods_num;
  439 + th.setData({ card_cut_price: cut_p });
441 } 440 }
  441 + }
442 442
443 - //定义变量  
444 - var gg = th.data.gg,act = null,prelist = null;  
445 - var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id;  
446 - await getApp().request.promiseGet(url, {}).then(res => {  
447 - if (res.data.code == 0) {  
448 - act = res.data.data;  
449 - }  
450 - })  
451 - if (!act) {  
452 - wx.showToast({title: "未找到活动", icon: 'none', duration: 3000});  
453 - return false;  
454 - }  
455 - if (act.is_end==1 ) {  
456 - wx.showToast({title:'活动已经结束' , icon: 'none', duration: 3000});  
457 - return false;  
458 - }  
459 - if( ut.gettimestamp()>act.end_time){  
460 - wx.showToast({title:"活动定金支付时间已过期" , icon: 'none', duration: 3000});  
461 - return false; 443 + //定义变量
  444 + var gg = th.data.gg, act = null, prelist = null;
  445 + var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id;
  446 + await getApp().request.promiseGet(url, {}).then(res => {
  447 + if (res.data.code == 0) {
  448 + act = res.data.data;
462 } 449 }
  450 + })
  451 + if (!act) {
  452 + wx.showToast({ title: "未找到活动", icon: 'none', duration: 3000 });
  453 + return false;
  454 + }
  455 + if (act.is_end == 1) {
  456 + wx.showToast({ title: '活动已经结束', icon: 'none', duration: 3000 });
  457 + return false;
  458 + }
  459 + if (ut.gettimestamp() > act.end_time) {
  460 + wx.showToast({ title: "活动定金支付时间已过期", icon: 'none', duration: 3000 });
  461 + return false;
  462 + }
463 463
464 - var url = "/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + gg.presell_list_id;  
465 - await getApp().request.promiseGet(url, {}).then(res => {  
466 - if (res.data.code == 0) {  
467 - prelist = res.data.data;  
468 - }  
469 - })  
470 - if (!prelist) {  
471 - wx.showToast({title: "未找到商品", icon: 'none', duration: 3000});  
472 - return false; 464 + var url = "/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + gg.presell_list_id;
  465 + await getApp().request.promiseGet(url, {}).then(res => {
  466 + if (res.data.code == 0) {
  467 + prelist = res.data.data;
473 } 468 }
  469 + })
  470 + if (!prelist) {
  471 + wx.showToast({ title: "未找到商品", icon: 'none', duration: 3000 });
  472 + return false;
  473 + }
474 474
475 - //这个位置要拿活动的预售价  
476 - t.data.data.shop_price = prelist.presell_money;  
477 - th.setData({  
478 - bn_goods: t.data.data,  
479 - bn_pickname: gg.pick_name,  
480 - bn_exp_type: et,  
481 - index: m_wind,  
482 - bn_pick: gg.pick_id,  
483 - bn_t_exp_t: distr_t,  
484 - bn_exp_type: et,  
485 - act:act  
486 - }); 475 + //这个位置要拿活动的预售价
  476 + t.data.data.shop_price = prelist.presell_money;
  477 + th.setData({
  478 + bn_goods: t.data.data,
  479 + bn_pickname: gg.pick_name,
  480 + bn_exp_type: et,
  481 + index: m_wind,
  482 + bn_pick: gg.pick_id,
  483 + bn_t_exp_t: distr_t,
  484 + bn_exp_type: et,
  485 + act: act
  486 + });
487 487
488 - if(act.is_usecoupon==1){  
489 - th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;  
490 - th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";  
491 - th.data.check_quan_ware_list = t.data.data.erpwareid + "";  
492 - } 488 + if (act.is_usecoupon == 1) {
  489 + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
  490 + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
  491 + th.data.check_quan_ware_list = t.data.data.erpwareid + "";
  492 + }
493 493
494 494
495 - //计算价格  
496 - th.calculatePrice2();  
497 - //获取优惠券,如果有券的钱,就调用  
498 - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); 495 + //计算价格
  496 + th.calculatePrice2();
  497 + //获取优惠券,如果有券的钱,就调用
  498 + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
499 499
500 500
501 - },  
502 - }); 501 + },
  502 + });
503 503
504 }, 504 },
505 505
@@ -507,14 +507,14 @@ Page({ @@ -507,14 +507,14 @@ Page({
507 checkAddressList: function () { 507 checkAddressList: function () {
508 var t = this; 508 var t = this;
509 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 509 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
510 - title: "请先填写或选择收货地址~",  
511 - success: function (a) {  
512 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
513 - },  
514 - fail: function () {  
515 - wx.navigateBack();  
516 - }  
517 - }), !1); 510 + title: "请先填写或选择收货地址~",
  511 + success: function (a) {
  512 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  513 + },
  514 + fail: function () {
  515 + wx.navigateBack();
  516 + }
  517 + }), !1);
518 }, 518 },
519 showInvoice: function () { 519 showInvoice: function () {
520 this.setData({ 520 this.setData({
@@ -533,7 +533,7 @@ Page({ @@ -533,7 +533,7 @@ Page({
533 }, 533 },
534 keyUpChangeNum: function (t) { 534 keyUpChangeNum: function (t) {
535 var index = t.currentTarget.dataset.index; 535 var index = t.currentTarget.dataset.index;
536 - var txt="user_note."+index; 536 + var txt = "user_note." + index;
537 this.setData({ 537 this.setData({
538 maxWord: t.detail.value.length, 538 maxWord: t.detail.value.length,
539 [txt]: t.detail.value 539 [txt]: t.detail.value
@@ -564,7 +564,7 @@ Page({ @@ -564,7 +564,7 @@ Page({
564 } 564 }
565 } 565 }
566 var set_txt = "cartlist[" + iter + "].can_num"; 566 var set_txt = "cartlist[" + iter + "].can_num";
567 - th.setData({[set_txt]: num}); 567 + th.setData({ [set_txt]: num });
568 } 568 }
569 }, 569 },
570 570
@@ -595,10 +595,10 @@ Page({ @@ -595,10 +595,10 @@ Page({
595 595
596 allpice = parseFloat(allpice).toFixed(2); 596 allpice = parseFloat(allpice).toFixed(2);
597 var txt = "formData.all_price"; 597 var txt = "formData.all_price";
598 - th.setData({[txt]: allpice,}); 598 + th.setData({ [txt]: allpice, });
599 if (cut_price) { 599 if (cut_price) {
600 var c_txt = "formData.cut_price"; 600 var c_txt = "formData.cut_price";
601 - th.setData({[c_txt]: cut_price,}); 601 + th.setData({ [c_txt]: cut_price, });
602 602
603 } 603 }
604 604
@@ -612,7 +612,7 @@ Page({ @@ -612,7 +612,7 @@ Page({
612 to.getwuliuprice(async function (rs) { 612 to.getwuliuprice(async function (rs) {
613 613
614 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 614 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
615 - var out_of_weight=null; //超出多少重量 615 + var out_of_weight = null; //超出多少重量
616 var freight_free = ee.freight_free; //全场满多少包邮 616 var freight_free = ee.freight_free; //全场满多少包邮
617 var weight_free = ee.weight_free; //多少kg内包邮 617 var weight_free = ee.weight_free; //多少kg内包邮
618 var no_ex_id = ee.no_ex_id; 618 var no_ex_id = ee.no_ex_id;
@@ -666,7 +666,7 @@ Page({ @@ -666,7 +666,7 @@ Page({
666 arr.push(item); 666 arr.push(item);
667 } 667 }
668 if (arr) { 668 if (arr) {
669 - th.setData({get_by_quan_list: arr}); 669 + th.setData({ get_by_quan_list: arr });
670 } 670 }
671 th.data.isget_by_quan[th.data.bn_pick] = 1; 671 th.data.isget_by_quan[th.data.bn_pick] = 1;
672 } 672 }
@@ -682,7 +682,9 @@ Page({ @@ -682,7 +682,9 @@ Page({
682 if (goods_weight < 0) goods_weight = 0; 682 if (goods_weight < 0) goods_weight = 0;
683 //累积商品重量 每种商品的重量 * 数量 683 //累积商品重量 每种商品的重量 * 数量
684 goods_weight += good['weight'] * good['buynum']; 684 goods_weight += good['weight'] * good['buynum'];
685 - out_of_weight = (weight_free * 1000 ) - goods_weight; 685 + if (weight_free > 0) {
  686 + out_of_weight = (weight_free * 1000) - goods_weight;
  687 + }
686 break; 688 break;
687 case 3: 689 case 3:
688 if (goods_piece < 0) goods_piece = 0; 690 if (goods_piece < 0) goods_piece = 0;
@@ -693,18 +695,17 @@ Page({ @@ -693,18 +695,17 @@ Page({
693 695
694 var code = ""; 696 var code = "";
695 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; 697 if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
696 - 698 +
697 th.data.is_no_by[th.data.bn_pick] = 0; 699 th.data.is_no_by[th.data.bn_pick] = 0;
698 700
699 var no_by_data = null; 701 var no_by_data = null;
700 var gift_freight_free = freight_free; 702 var gift_freight_free = freight_free;
701 703
702 -  
703 //有不包邮区域,且不免运费 704 //有不包邮区域,且不免运费
704 if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { 705 if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) {
705 //-----------获取不包邮区域,不包邮商品------- 706 //-----------获取不包邮区域,不包邮商品-------
706 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { 707 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
707 - data: {store_id: os.stoid, id: no_ex_id} 708 + data: { store_id: os.stoid, id: no_ex_id }
708 }).then(res => { 709 }).then(res => {
709 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { 710 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
710 no_by_data = res.data.data[0]; 711 no_by_data = res.data.data[0];
@@ -712,6 +713,8 @@ Page({ @@ -712,6 +713,8 @@ Page({
712 if (res.data.data[0].region_list) { 713 if (res.data.data[0].region_list) {
713 if (th.check_by_area(res.data.data[0].region_list)) { 714 if (th.check_by_area(res.data.data[0].region_list)) {
714 freight_free = 0; 715 freight_free = 0;
  716 + out_of_weight = 0;
  717 + weight_free=-1;
715 th.data.is_no_by[th.data.bn_pick] = 1; 718 th.data.is_no_by[th.data.bn_pick] = 1;
716 } 719 }
717 } 720 }
@@ -719,6 +722,8 @@ Page({ @@ -719,6 +722,8 @@ Page({
719 if (res.data.data[0].goods_list && freight_free) { 722 if (res.data.data[0].goods_list && freight_free) {
720 if (th.check_by_goods(res.data.data[0].goods_list)) { 723 if (th.check_by_goods(res.data.data[0].goods_list)) {
721 freight_free = 0; 724 freight_free = 0;
  725 + out_of_weight = 0;
  726 + weight_free=-1;
722 th.data.is_no_by[th.data.bn_pick] = 1; 727 th.data.is_no_by[th.data.bn_pick] = 1;
723 } 728 }
724 } 729 }
@@ -729,13 +734,13 @@ Page({ @@ -729,13 +734,13 @@ Page({
729 th.data.is_by[th.data.bn_pick] = 0; 734 th.data.is_by[th.data.bn_pick] = 0;
730 //--------------开始计算物流------------------ 735 //--------------开始计算物流------------------
731 var shipping_price = 736 var shipping_price =
732 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,  
733 - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); 737 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  738 + goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs,th.data.bn_pick);
734 739
735 //如果有赠品的时候,也要计算赠品的物流费用 740 //如果有赠品的时候,也要计算赠品的物流费用
736 if (th.data.buy_now_gift_goods) { 741 if (th.data.buy_now_gift_goods) {
737 - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight,gift_weight_free,  
738 - parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); 742 + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, out_of_weight, gift_weight_free,
  743 + parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece,th.data.bn_pick);
739 } 744 }
740 745
741 if (shipping_price <= 0) { 746 if (shipping_price <= 0) {
@@ -744,18 +749,18 @@ Page({ @@ -744,18 +749,18 @@ Page({
744 749
745 shipping_price = parseFloat(shipping_price).toFixed(2); 750 shipping_price = parseFloat(shipping_price).toFixed(2);
746 var wl_txt = "formData.shipping_price"; 751 var wl_txt = "formData.shipping_price";
747 - th.setData({[wl_txt]: shipping_price,}) 752 + th.setData({ [wl_txt]: shipping_price, })
748 753
749 } else { 754 } else {
750 var wl_txt = "formData.shipping_price"; 755 var wl_txt = "formData.shipping_price";
751 - th.setData({[wl_txt]: 0,}) 756 + th.setData({ [wl_txt]: 0, })
752 } 757 }
753 758
754 if (quan_no) { 759 if (quan_no) {
755 if (th.data.using_quan[bn_pick].isby == 1) { 760 if (th.data.using_quan[bn_pick].isby == 1) {
756 shipping_price = 0; 761 shipping_price = 0;
757 var wl_txt = "formData.shipping_price"; 762 var wl_txt = "formData.shipping_price";
758 - th.setData({[wl_txt]: 0,}) 763 + th.setData({ [wl_txt]: 0, })
759 } 764 }
760 } 765 }
761 //-----------------支付价,优惠券不减物流----------------- 766 //-----------------支付价,优惠券不减物流-----------------
@@ -774,7 +779,7 @@ Page({ @@ -774,7 +779,7 @@ Page({
774 var order_prom_id = 0; 779 var order_prom_id = 0;
775 if (th.data.order_prom[th.data.bn_pick]) { 780 if (th.data.order_prom[th.data.bn_pick]) {
776 var ord_prom = th.data.order_prom[th.data.bn_pick]; 781 var ord_prom = th.data.order_prom[th.data.bn_pick];
777 - if(!ord_prom.is_xz_yh || quan_price<=0) { 782 + if (!ord_prom.is_xz_yh || quan_price <= 0) {
778 order_prom_id = ord_prom['id']; 783 order_prom_id = ord_prom['id'];
779 switch (ord_prom['type']) { 784 switch (ord_prom['type']) {
780 case 0: 785 case 0:
@@ -792,7 +797,7 @@ Page({ @@ -792,7 +797,7 @@ Page({
792 if (order_prom_id > 0) { 797 if (order_prom_id > 0) {
793 var order_prom_txt1 = "formData.order_prom_id"; 798 var order_prom_txt1 = "formData.order_prom_id";
794 var order_prom_txt2 = "formData.order_prom_amount"; 799 var order_prom_txt2 = "formData.order_prom_amount";
795 - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) 800 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
796 } 801 }
797 802
798 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 803 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
@@ -802,7 +807,7 @@ Page({ @@ -802,7 +807,7 @@ Page({
802 order_m = order_m.toFixed(2); 807 order_m = order_m.toFixed(2);
803 808
804 var atxt = "formData.total_amount"; 809 var atxt = "formData.total_amount";
805 - th.setData({[atxt]: total_m,}) 810 + th.setData({ [atxt]: total_m, })
806 811
807 var txt = "formData.user_money"; 812 var txt = "formData.user_money";
808 var txt2 = "formData.order_amount"; 813 var txt2 = "formData.order_amount";
@@ -812,43 +817,43 @@ Page({ @@ -812,43 +817,43 @@ Page({
812 if (th.data.bn_use_money == 1) { 817 if (th.data.bn_use_money == 1) {
813 if (amoney > order_m) { 818 if (amoney > order_m) {
814 order_m = parseFloat(order_m).toFixed(2); 819 order_m = parseFloat(order_m).toFixed(2);
815 - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) 820 + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 })
816 } else { 821 } else {
817 order_m = parseFloat(order_m) - parseFloat(amoney); 822 order_m = parseFloat(order_m) - parseFloat(amoney);
818 order_m = order_m.toFixed(2); 823 order_m = order_m.toFixed(2);
819 - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 824 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
820 } 825 }
821 } else { 826 } else {
822 - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 827 + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
823 } 828 }
824 //优惠活动送积分 829 //优惠活动送积分
825 if (good.s_intValue) { 830 if (good.s_intValue) {
826 txt = "formData.give_integral"; 831 txt = "formData.give_integral";
827 - th.setData({[txt]: good.s_intValue}); 832 + th.setData({ [txt]: good.s_intValue });
828 } 833 }
829 //优惠送券 834 //优惠送券
830 if (good.s_coupon_id) { 835 if (good.s_coupon_id) {
831 var i_txt = "formData.give_coupon_id"; 836 var i_txt = "formData.give_coupon_id";
832 //这个是json格式的 837 //这个是json格式的
833 var i_txt1 = "formData.g_coupon_num"; 838 var i_txt1 = "formData.g_coupon_num";
834 - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; 839 + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }];
835 ob = JSON.stringify(ob); 840 ob = JSON.stringify(ob);
836 - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); 841 + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob });
837 } 842 }
838 //优惠礼包 843 //优惠礼包
839 if (good.s_libao) { 844 if (good.s_libao) {
840 var l_txt = "formData.give_lb_id"; 845 var l_txt = "formData.give_lb_id";
841 //这个是json格式的 846 //这个是json格式的
842 var l_txt1 = "formData.g_lb_num"; 847 var l_txt1 = "formData.g_lb_num";
843 - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; 848 + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
844 ob = JSON.stringify(ob); 849 ob = JSON.stringify(ob);
845 - th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); 850 + th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob });
846 } 851 }
847 }) 852 })
848 } else { 853 } else {
849 var order_prom_txt1 = "formData.order_prom_id"; 854 var order_prom_txt1 = "formData.order_prom_id";
850 var order_prom_txt2 = "formData.order_prom_amount"; 855 var order_prom_txt2 = "formData.order_prom_amount";
851 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) 856 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
852 857
853 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 858 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
854 order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); 859 order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price);
@@ -857,7 +862,7 @@ Page({ @@ -857,7 +862,7 @@ Page({
857 total_m = total_m.toFixed(2); 862 total_m = total_m.toFixed(2);
858 order_m = order_m.toFixed(2); 863 order_m = order_m.toFixed(2);
859 864
860 - th.setData({[atxt]: total_m,}) 865 + th.setData({ [atxt]: total_m, })
861 866
862 var txt = "formData.user_money"; 867 var txt = "formData.user_money";
863 var txt2 = "formData.order_amount"; 868 var txt2 = "formData.order_amount";
@@ -867,37 +872,37 @@ Page({ @@ -867,37 +872,37 @@ Page({
867 if (th.data.bn_use_money == 1) { 872 if (th.data.bn_use_money == 1) {
868 if (amoney > order_m) { 873 if (amoney > order_m) {
869 order_m = parseFloat(order_m).toFixed(2); 874 order_m = parseFloat(order_m).toFixed(2);
870 - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) 875 + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 })
871 } else { 876 } else {
872 order_m = parseFloat(order_m) - parseFloat(amoney); 877 order_m = parseFloat(order_m) - parseFloat(amoney);
873 order_m = order_m.toFixed(2); 878 order_m = order_m.toFixed(2);
874 - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 879 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
875 } 880 }
876 } else { 881 } else {
877 - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 882 + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
878 } 883 }
879 //优惠活动送积分 884 //优惠活动送积分
880 if (good.s_intValue) { 885 if (good.s_intValue) {
881 txt = "formData.give_integral"; 886 txt = "formData.give_integral";
882 - th.setData({[txt]: good.s_intValue}); 887 + th.setData({ [txt]: good.s_intValue });
883 } 888 }
884 //优惠送券 889 //优惠送券
885 if (good.s_coupon_id) { 890 if (good.s_coupon_id) {
886 var i_txt = "formData.give_coupon_id"; 891 var i_txt = "formData.give_coupon_id";
887 //这个是json格式的 892 //这个是json格式的
888 var i_txt1 = "formData.g_coupon_num"; 893 var i_txt1 = "formData.g_coupon_num";
889 - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; 894 + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }];
890 ob = JSON.stringify(ob); 895 ob = JSON.stringify(ob);
891 - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); 896 + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob });
892 } 897 }
893 //优惠礼包 898 //优惠礼包
894 if (good.s_libao) { 899 if (good.s_libao) {
895 var l_txt = "formData.give_lb_id"; 900 var l_txt = "formData.give_lb_id";
896 //这个是json格式的 901 //这个是json格式的
897 var l_txt1 = "formData.g_lb_num"; 902 var l_txt1 = "formData.g_lb_num";
898 - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; 903 + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
899 ob = JSON.stringify(ob); 904 ob = JSON.stringify(ob);
900 - th.setData({[l_txt]: good.s_coupon_id, [l_txt1]: ob}); 905 + th.setData({ [l_txt]: good.s_coupon_id, [l_txt1]: ob });
901 } 906 }
902 } 907 }
903 908
@@ -908,7 +913,7 @@ Page({ @@ -908,7 +913,7 @@ Page({
908 }, 913 },
909 914
910 //--------------------提交订单----------------------- 915 //--------------------提交订单-----------------------
911 - async submitForm(t){ 916 + async submitForm(t) {
912 var sub_value = t; 917 var sub_value = t;
913 918
914 if (this.data.is_summit_ing == 1) return false; //--提交中退出-- 919 if (this.data.is_summit_ing == 1) return false; //--提交中退出--
@@ -981,7 +986,7 @@ Page({ @@ -981,7 +986,7 @@ Page({
981 } 986 }
982 987
983 //--判断优惠活动的提交-- 988 //--判断优惠活动的提交--
984 - if (th.data.formData.cut_price > 0 ) { 989 + if (th.data.formData.cut_price > 0) {
985 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); 990 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2);
986 var ob = [{ 991 var ob = [{
987 "prom_id": th.data.bn_goods.prom_id, 992 "prom_id": th.data.bn_goods.prom_id,
@@ -1044,7 +1049,7 @@ Page({ @@ -1044,7 +1049,7 @@ Page({
1044 goods.guide_id = gg.guide_id; 1049 goods.guide_id = gg.guide_id;
1045 goods.guide_type = gg.guide_type; 1050 goods.guide_type = gg.guide_type;
1046 //调用接口判断是不是会员 1051 //调用接口判断是不是会员
1047 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { 1052 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
1048 if (res.data.code == 0) { 1053 if (res.data.code == 0) {
1049 goods.guide_name = res.data.data.salesman; 1054 goods.guide_name = res.data.data.salesman;
1050 goods.guide_sn = res.data.data.salesman_no; 1055 goods.guide_sn = res.data.data.salesman_no;
@@ -1096,7 +1101,7 @@ Page({ @@ -1096,7 +1101,7 @@ Page({
1096 } 1101 }
1097 1102
1098 var pt_res = null; 1103 var pt_res = null;
1099 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 1104 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
1100 is_json: 1, 1105 is_json: 1,
1101 data: pt_data 1106 data: pt_data
1102 }).then(res => { 1107 }).then(res => {
@@ -1216,14 +1221,14 @@ Page({ @@ -1216,14 +1221,14 @@ Page({
1216 order_prom_list.order_prom_amount = t_item.order_prom_amount; 1221 order_prom_list.order_prom_amount = t_item.order_prom_amount;
1217 } 1222 }
1218 1223
1219 - order_prom_list.discount_amount =0; 1224 + order_prom_list.discount_amount = 0;
1220 //--判断优惠活动的提交-- 1225 //--判断优惠活动的提交--
1221 if (t_item.cut_price > 0) { 1226 if (t_item.cut_price > 0) {
1222 order_prom_list.discount_amount += t_item.cut_price; 1227 order_prom_list.discount_amount += t_item.cut_price;
1223 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); 1228 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json);
1224 } 1229 }
1225 //--判断组合优惠活动的提交-- 1230 //--判断组合优惠活动的提交--
1226 - if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { 1231 + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price < 0) {
1227 order_prom_list.discount_amount += t_item.zh_cut_price; 1232 order_prom_list.discount_amount += t_item.zh_cut_price;
1228 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); 1233 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json);
1229 } 1234 }
@@ -1238,11 +1243,11 @@ Page({ @@ -1238,11 +1243,11 @@ Page({
1238 order_prom_list.give_lb_id = t_item.s_libao; 1243 order_prom_list.give_lb_id = t_item.s_libao;
1239 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); 1244 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num);
1240 } 1245 }
1241 - if (Object.keys(order_prom_list).length > 0){  
1242 - if(order_prom_list.discount_amount)  
1243 - order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2);  
1244 - if(order_prom_list.order_prom_amount)  
1245 - order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); 1246 + if (Object.keys(order_prom_list).length > 0) {
  1247 + if (order_prom_list.discount_amount)
  1248 + order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2);
  1249 + if (order_prom_list.order_prom_amount)
  1250 + order_prom_list.order_prom_amount = parseFloat(order_prom_list.order_prom_amount).toFixed(2);
1246 item.order_prom_list = order_prom_list; 1251 item.order_prom_list = order_prom_list;
1247 } 1252 }
1248 1253
@@ -1266,7 +1271,7 @@ Page({ @@ -1266,7 +1271,7 @@ Page({
1266 //-------------让商品添加到商品列表-------------------- 1271 //-------------让商品添加到商品列表--------------------
1267 for (var k = 0; k < t_item.goods.length; k++) { 1272 for (var k = 0; k < t_item.goods.length; k++) {
1268 var g_item = t_item.goods[k]; 1273 var g_item = t_item.goods[k];
1269 - if(g_item.goods_num<=0) continue; 1274 + if (g_item.goods_num <= 0) continue;
1270 var goods = { 1275 var goods = {
1271 'goods_id': g_item.goods_id, 1276 'goods_id': g_item.goods_id,
1272 'goods_name': g_item.goods_name, 1277 'goods_name': g_item.goods_name,
@@ -1279,7 +1284,7 @@ Page({ @@ -1279,7 +1284,7 @@ Page({
1279 }; 1284 };
1280 1285
1281 //-- 线下取价也要写入,组合购的商品不能去线下价格 -- 1286 //-- 线下取价也要写入,组合购的商品不能去线下价格 --
1282 - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type!=7) { 1287 + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) {
1283 goods.goods_price = g_item.offline_price; 1288 goods.goods_price = g_item.offline_price;
1284 goods.member_goods_price = g_item.offline_price; 1289 goods.member_goods_price = g_item.offline_price;
1285 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); 1290 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
@@ -1290,7 +1295,7 @@ Page({ @@ -1290,7 +1295,7 @@ Page({
1290 if (t_item.quan_youhui_list && t_item.coupon_price) { 1295 if (t_item.quan_youhui_list && t_item.coupon_price) {
1291 for (var kk in t_item.quan_youhui_list) { 1296 for (var kk in t_item.quan_youhui_list) {
1292 var you_item = t_item.quan_youhui_list[kk]; 1297 var you_item = t_item.quan_youhui_list[kk];
1293 - if (g_item.prom_type!=7 && g_item.erpwareid == you_item.WareId) { 1298 + if (g_item.prom_type != 7 && g_item.erpwareid == you_item.WareId) {
1294 goods.quan_num = you_item.WareCashSum; 1299 goods.quan_num = you_item.WareCashSum;
1295 goods.quan_no = you_item.CashRepNo; 1300 goods.quan_no = you_item.CashRepNo;
1296 } 1301 }
@@ -1341,7 +1346,7 @@ Page({ @@ -1341,7 +1346,7 @@ Page({
1341 } 1346 }
1342 1347
1343 //把优惠的平摊结果写进去 1348 //把优惠的平摊结果写进去
1344 - if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account!=undefined)) { 1349 + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) {
1345 if (g_item.account >= 0) goods.account = g_item.account; 1350 if (g_item.account >= 0) goods.account = g_item.account;
1346 if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; 1351 if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu;
1347 item.is_discount_amount = 1; 1352 item.is_discount_amount = 1;
@@ -1352,7 +1357,7 @@ Page({ @@ -1352,7 +1357,7 @@ Page({
1352 goods.guide_id = g_item.guide_id; 1357 goods.guide_id = g_item.guide_id;
1353 goods.guide_type = g_item.guide_type; 1358 goods.guide_type = g_item.guide_type;
1354 //调用接口判断是不是会员 1359 //调用接口判断是不是会员
1355 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { 1360 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => {
1356 if (res.data.code == 0) { 1361 if (res.data.code == 0) {
1357 goods.guide_name = res.data.data.salesman; 1362 goods.guide_name = res.data.data.salesman;
1358 goods.guide_sn = res.data.data.salesman_no; 1363 goods.guide_sn = res.data.data.salesman_no;
@@ -1378,7 +1383,7 @@ Page({ @@ -1378,7 +1383,7 @@ Page({
1378 if (pdata.length == 0) return; 1383 if (pdata.length == 0) return;
1379 var str = JSON.stringify(pdata); 1384 var str = JSON.stringify(pdata);
1380 1385
1381 - wx.showLoading({title: "加载中"}); 1386 + wx.showLoading({ title: "加载中" });
1382 wx.request({ 1387 wx.request({
1383 url: oo.url + '/api/weshop/order/createWxdOrder', 1388 url: oo.url + '/api/weshop/order/createWxdOrder',
1384 data: str, 1389 data: str,
@@ -1409,7 +1414,7 @@ Page({ @@ -1409,7 +1414,7 @@ Page({
1409 }) 1414 })
1410 //要进行判断,如果是用微信支付,就要跳转到支付界面 1415 //要进行判断,如果是用微信支付,就要跳转到支付界面
1411 if (order_amount > 0) { 1416 if (order_amount > 0) {
1412 - th.setData({isclose: 0}); 1417 + th.setData({ isclose: 0 });
1413 //void e.jumpToCart4({ 1418 //void e.jumpToCart4({
1414 // order_sn: data.data, 1419 // order_sn: data.data,
1415 //}, 1); 1420 //}, 1);
@@ -1424,12 +1429,12 @@ Page({ @@ -1424,12 +1429,12 @@ Page({
1424 }, function () { 1429 }, function () {
1425 //支付失败 1430 //支付失败
1426 setTimeout(function () { 1431 setTimeout(function () {
1427 - var cps=getCurrentPages();  
1428 - if(cps.length>1){  
1429 - wx.navigateBack({delta: 1})  
1430 - }else{  
1431 - getApp().goto("/pages/index/index/index");  
1432 - } 1432 + var cps = getCurrentPages();
  1433 + if (cps.length > 1) {
  1434 + wx.navigateBack({ delta: 1 })
  1435 + } else {
  1436 + getApp().goto("/pages/index/index/index");
  1437 + }
1433 1438
1434 }, 1000) 1439 }, 1000)
1435 }, oo.stoid); 1440 }, oo.stoid);
@@ -1447,7 +1452,7 @@ Page({ @@ -1447,7 +1452,7 @@ Page({
1447 if (t.data.code == 0) { 1452 if (t.data.code == 0) {
1448 //app.my_warnning("支付成功",1,th); 1453 //app.my_warnning("支付成功",1,th);
1449 //setTimeout(function () { 1454 //setTimeout(function () {
1450 - th.setData({isclose: 0}); 1455 + th.setData({ isclose: 0 });
1451 wx.redirectTo({ 1456 wx.redirectTo({
1452 url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, 1457 url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data,
1453 }) 1458 })
@@ -1472,7 +1477,7 @@ Page({ @@ -1472,7 +1477,7 @@ Page({
1472 cancelText: '取消', 1477 cancelText: '取消',
1473 confirmText: '确定', 1478 confirmText: '确定',
1474 showCancel: true, 1479 showCancel: true,
1475 - success(res){ 1480 + success(res) {
1476 if (res.cancel) { 1481 if (res.cancel) {
1477 return; 1482 return;
1478 } else if (res.confirm) { 1483 } else if (res.confirm) {
@@ -1506,11 +1511,11 @@ Page({ @@ -1506,11 +1511,11 @@ Page({
1506 1511
1507 }, 1512 },
1508 //---确认线下门店的数量足不足--- 1513 //---确认线下门店的数量足不足---
1509 - async check_store_num(goods_id, pick, goods_num, func){ 1514 + async check_store_num(goods_id, pick, goods_num, func) {
1510 var lock = 0, pick_no, plist, erpwareid; 1515 var lock = 0, pick_no, plist, erpwareid;
1511 //先读取门店的lock 1516 //先读取门店的lock
1512 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 1517 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
1513 - data: {store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000} 1518 + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }
1514 }).then(res => { 1519 }).then(res => {
1515 if (res.data.code == 0 && res.data.data.total > 0) { 1520 if (res.data.code == 0 && res.data.data.total > 0) {
1516 for (var i in res.data.data.pageData) 1521 for (var i in res.data.data.pageData)
@@ -1519,7 +1524,7 @@ Page({ @@ -1519,7 +1524,7 @@ Page({
1519 }) 1524 })
1520 //先获取门店的编号 1525 //先获取门店的编号
1521 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { 1526 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
1522 - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} 1527 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
1523 }).then(res => { 1528 }).then(res => {
1524 if (res.data.code == 0) { 1529 if (res.data.code == 0) {
1525 pick_no = res.data.data.pickup_no; 1530 pick_no = res.data.data.pickup_no;
@@ -1527,7 +1532,7 @@ Page({ @@ -1527,7 +1532,7 @@ Page({
1527 }) 1532 })
1528 //先获取商品的线下库存 1533 //先获取商品的线下库存
1529 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { 1534 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
1530 - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} 1535 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
1531 }).then(res => { 1536 }).then(res => {
1532 if (res.data.code == 0) { 1537 if (res.data.code == 0) {
1533 erpwareid = res.data.data.erpwareid; 1538 erpwareid = res.data.data.erpwareid;
@@ -1535,7 +1540,7 @@ Page({ @@ -1535,7 +1540,7 @@ Page({
1535 }) 1540 })
1536 //读取线下的门店库存 1541 //读取线下的门店库存
1537 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { 1542 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
1538 - data: {storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000} 1543 + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 }
1539 }).then(res => { 1544 }).then(res => {
1540 if (res.data.code == 0) { 1545 if (res.data.code == 0) {
1541 plist = res.data.data.pageData[0]; 1546 plist = res.data.data.pageData[0];
@@ -1577,11 +1582,11 @@ Page({ @@ -1577,11 +1582,11 @@ Page({
1577 wl_txt = t.currentTarget.dataset.wl_txt, 1582 wl_txt = t.currentTarget.dataset.wl_txt,
1578 ont = t.currentTarget.dataset.ont; 1583 ont = t.currentTarget.dataset.ont;
1579 1584
1580 - th.setData({[txt]: ty}); 1585 + th.setData({ [txt]: ty });
1581 var iszt = 1; 1586 var iszt = 1;
1582 1587
1583 if (ty == 0) { 1588 if (ty == 0) {
1584 - th.setData({is_all_zt: 0}); 1589 + th.setData({ is_all_zt: 0 });
1585 } else { 1590 } else {
1586 for (var i = 0; i < th.data.cartlist.length; i++) { 1591 for (var i = 0; i < th.data.cartlist.length; i++) {
1587 var item = th.data.cartlist[i]; 1592 var item = th.data.cartlist[i];
@@ -1591,7 +1596,7 @@ Page({ @@ -1591,7 +1596,7 @@ Page({
1591 } 1596 }
1592 } 1597 }
1593 1598
1594 - th.setData({is_all_zt: iszt}); 1599 + th.setData({ is_all_zt: iszt });
1595 1600
1596 var ind = t.currentTarget.dataset.ind; 1601 var ind = t.currentTarget.dataset.ind;
1597 var c_item = th.data.cartlist[ind]; 1602 var c_item = th.data.cartlist[ind];
@@ -1599,7 +1604,7 @@ Page({ @@ -1599,7 +1604,7 @@ Page({
1599 1604
1600 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) { 1605 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) {
1601 th.data.using_quan[pickid] = {}; 1606 th.data.using_quan[pickid] = {};
1602 - th.setData({using_quan: th.data.using_quan}); 1607 + th.setData({ using_quan: th.data.using_quan });
1603 } 1608 }
1604 1609
1605 1610
@@ -1611,7 +1616,7 @@ Page({ @@ -1611,7 +1616,7 @@ Page({
1611 for (var i = 0; i < wu_arr.length; i++) { 1616 for (var i = 0; i < wu_arr.length; i++) {
1612 if (wu_arr[i].shipping_code == def_exp_code) { 1617 if (wu_arr[i].shipping_code == def_exp_code) {
1613 var set_txt = "cartlist" 1618 var set_txt = "cartlist"
1614 - th.setData({wl_txt: i}); 1619 + th.setData({ wl_txt: i });
1615 } 1620 }
1616 } 1621 }
1617 } 1622 }
@@ -1624,9 +1629,9 @@ Page({ @@ -1624,9 +1629,9 @@ Page({
1624 setexptype: function (t) { 1629 setexptype: function (t) {
1625 var th = this; 1630 var th = this;
1626 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; 1631 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code;
1627 - th.setData({bn_exp_type: ty}); 1632 + th.setData({ bn_exp_type: ty });
1628 if (ty == 0) { 1633 if (ty == 0) {
1629 - th.setData({is_all_zt: 0}); 1634 + th.setData({ is_all_zt: 0 });
1630 } 1635 }
1631 1636
1632 //当物流为空的时候。 1637 //当物流为空的时候。
@@ -1639,7 +1644,7 @@ Page({ @@ -1639,7 +1644,7 @@ Page({
1639 if (ty == 1) { 1644 if (ty == 1) {
1640 th.data.isget_by_quan = {}; 1645 th.data.isget_by_quan = {};
1641 if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { 1646 if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) {
1642 - th.setData({using_quan: {}}); 1647 + th.setData({ using_quan: {} });
1643 } 1648 }
1644 } 1649 }
1645 1650
@@ -1649,7 +1654,7 @@ Page({ @@ -1649,7 +1654,7 @@ Page({
1649 if (wu_arr != null && wu_arr != "") { 1654 if (wu_arr != null && wu_arr != "") {
1650 for (var i = 0; i < wu_arr.length; i++) { 1655 for (var i = 0; i < wu_arr.length; i++) {
1651 if (wu_arr[i].shipping_code == def_exp_code) { 1656 if (wu_arr[i].shipping_code == def_exp_code) {
1652 - th.setData({index: i}); 1657 + th.setData({ index: i });
1653 } 1658 }
1654 } 1659 }
1655 } 1660 }
@@ -1661,21 +1666,21 @@ Page({ @@ -1661,21 +1666,21 @@ Page({
1661 //--------立即购买时,使用余额-------- 1666 //--------立即购买时,使用余额--------
1662 set_bn_useyuer: function () { 1667 set_bn_useyuer: function () {
1663 var th = this; 1668 var th = this;
1664 - th.setData({bn_use_money: !th.data.bn_use_money}); 1669 + th.setData({ bn_use_money: !th.data.bn_use_money });
1665 th.calculatePrice2(); 1670 th.calculatePrice2();
1666 }, 1671 },
1667 set_js_useyuer: function () { 1672 set_js_useyuer: function () {
1668 var th = this; 1673 var th = this;
1669 - th.setData({js_use_money: !th.data.js_use_money}); 1674 + th.setData({ js_use_money: !th.data.js_use_money });
1670 th.calculatePrice(); 1675 th.calculatePrice();
1671 }, 1676 },
1672 //-------------------计算物流--------------- 1677 //-------------------计算物流---------------
1673 - calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,  
1674 - goods_piece, user_addr, freight_free, o_price, rs) { 1678 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  1679 + goods_piece, user_addr, freight_free, o_price, rs,pickid) {
1675 var price = 0, th = this; 1680 var price = 0, th = this;
1676 price += parseFloat(o_shipping_price); 1681 price += parseFloat(o_shipping_price);
1677 //如果是包邮 1682 //如果是包邮
1678 - if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) { 1683 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
1679 return 0; 1684 return 0;
1680 } 1685 }
1681 if (user_addr == null) { 1686 if (user_addr == null) {
@@ -1702,8 +1707,8 @@ Page({ @@ -1702,8 +1707,8 @@ Page({
1702 } 1707 }
1703 } 1708 }
1704 1709
1705 - //------超出重量----------  
1706 - if(out_of_weight < 0 && o_price >= freight_free){ 1710 + //------超出重量----------
  1711 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
1707 fw_price = parseFloat(item['money']); 1712 fw_price = parseFloat(item['money']);
1708 var out_of_weight = Math.abs(out_of_weight); 1713 var out_of_weight = Math.abs(out_of_weight);
1709 var n = Math.ceil(out_of_weight / item['second_weight']) 1714 var n = Math.ceil(out_of_weight / item['second_weight'])
@@ -1746,13 +1751,13 @@ Page({ @@ -1746,13 +1751,13 @@ Page({
1746 //----------立即购买,选择物流------------- 1751 //----------立即购买,选择物流-------------
1747 bindPickerChange: function (e) { 1752 bindPickerChange: function (e) {
1748 var ind = e.detail.value 1753 var ind = e.detail.value
1749 - this.setData({index: ind}); 1754 + this.setData({ index: ind });
1750 this.calculatePrice2(); 1755 this.calculatePrice2();
1751 }, 1756 },
1752 //----------购物车结算,选择物流------------- 1757 //----------购物车结算,选择物流-------------
1753 bindPickerChange_w: function (e) { 1758 bindPickerChange_w: function (e) {
1754 var ind = e.detail.value, txt = e.currentTarget.dataset.txt; 1759 var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
1755 - this.setData({[txt]: ind}); 1760 + this.setData({ [txt]: ind });
1756 this.calculatePrice(); 1761 this.calculatePrice();
1757 }, 1762 },
1758 1763
@@ -1766,7 +1771,7 @@ Page({ @@ -1766,7 +1771,7 @@ Page({
1766 1771
1767 1772
1768 if (bn == 1) { 1773 if (bn == 1) {
1769 - th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); 1774 + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 });
1770 } else { 1775 } else {
1771 //---多单打开券的时候,就要判断券在其他门店是否有使用--- 1776 //---多单打开券的时候,就要判断券在其他门店是否有使用---
1772 var quanlist = th.data.cartlist[cindx].quan_list; 1777 var quanlist = th.data.cartlist[cindx].quan_list;
@@ -1792,9 +1797,9 @@ Page({ @@ -1792,9 +1797,9 @@ Page({
1792 else 1797 else
1793 get_by_quan_list_cart[i].show_red = 0; 1798 get_by_quan_list_cart[i].show_red = 0;
1794 } 1799 }
1795 - th.setData({by_quan_list_cart: get_by_quan_list_cart}); 1800 + th.setData({ by_quan_list_cart: get_by_quan_list_cart });
1796 } else { 1801 } else {
1797 - th.setData({by_quan_list_cart: null}); 1802 + th.setData({ by_quan_list_cart: null });
1798 } 1803 }
1799 1804
1800 console.log("2222222券的列表", quanlist); 1805 console.log("2222222券的列表", quanlist);
@@ -1810,7 +1815,7 @@ Page({ @@ -1810,7 +1815,7 @@ Page({
1810 }, 1815 },
1811 close_coupon: function (e) { 1816 close_coupon: function (e) {
1812 var th = this; 1817 var th = this;
1813 - th.setData({open_quan: 0, disabled: 0}); 1818 + th.setData({ open_quan: 0, disabled: 0 });
1814 }, 1819 },
1815 1820
1816 //---判断券时候在已经选择的列表中--- 1821 //---判断券时候在已经选择的列表中---
@@ -1881,14 +1886,14 @@ Page({ @@ -1881,14 +1886,14 @@ Page({
1881 for (var i in quanlist) { 1886 for (var i in quanlist) {
1882 quanlist[i].show_red = 0; 1887 quanlist[i].show_red = 0;
1883 } 1888 }
1884 - this.setData({selected_quan_list: quanlist}); 1889 + this.setData({ selected_quan_list: quanlist });
1885 var by_quanlist = this.data.get_by_quan_list; 1890 var by_quanlist = this.data.get_by_quan_list;
1886 if (by_quanlist) { 1891 if (by_quanlist) {
1887 //---所有的券的显示红色选择都清理一遍--- 1892 //---所有的券的显示红色选择都清理一遍---
1888 for (var inb in by_quanlist) { 1893 for (var inb in by_quanlist) {
1889 by_quanlist[inb].show_red = 0; 1894 by_quanlist[inb].show_red = 0;
1890 } 1895 }
1891 - this.setData({get_by_quan_list: by_quanlist}); 1896 + this.setData({ get_by_quan_list: by_quanlist });
1892 } 1897 }
1893 1898
1894 var by_cart_list = this.data.by_quan_list_cart; 1899 var by_cart_list = this.data.by_quan_list_cart;
@@ -1897,7 +1902,7 @@ Page({ @@ -1897,7 +1902,7 @@ Page({
1897 for (var inc in by_cart_list) { 1902 for (var inc in by_cart_list) {
1898 by_cart_list[inc].show_red = 0; 1903 by_cart_list[inc].show_red = 0;
1899 } 1904 }
1900 - this.setData({by_quan_list_cart: by_cart_list}); 1905 + this.setData({ by_quan_list_cart: by_cart_list });
1901 } 1906 }
1902 1907
1903 var using_quan = this.data.using_quan; 1908 var using_quan = this.data.using_quan;
@@ -1909,9 +1914,9 @@ Page({ @@ -1909,9 +1914,9 @@ Page({
1909 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 1914 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
1910 } 1915 }
1911 else { 1916 else {
1912 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 1917 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
1913 } 1918 }
1914 - this.setData({using_quan: using_quan, is_coupon: 2222}); 1919 + this.setData({ using_quan: using_quan, is_coupon: 2222 });
1915 return; 1920 return;
1916 } 1921 }
1917 1922
@@ -1928,9 +1933,9 @@ Page({ @@ -1928,9 +1933,9 @@ Page({
1928 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 1933 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
1929 } 1934 }
1930 else { 1935 else {
1931 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 1936 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
1932 } 1937 }
1933 - this.setData({using_quan: using_quan}); 1938 + this.setData({ using_quan: using_quan });
1934 1939
1935 }, 1940 },
1936 1941
@@ -1945,7 +1950,7 @@ Page({ @@ -1945,7 +1950,7 @@ Page({
1945 for (var ind in by_quanlist) { 1950 for (var ind in by_quanlist) {
1946 by_quanlist[ind].show_red = 0; 1951 by_quanlist[ind].show_red = 0;
1947 } 1952 }
1948 - this.setData({get_by_quan_list: by_quanlist}); 1953 + this.setData({ get_by_quan_list: by_quanlist });
1949 } 1954 }
1950 1955
1951 //--购物车过来的包邮券-- 1956 //--购物车过来的包邮券--
@@ -1955,7 +1960,7 @@ Page({ @@ -1955,7 +1960,7 @@ Page({
1955 for (var ind in by_cart_list) { 1960 for (var ind in by_cart_list) {
1956 by_cart_list[ind].show_red = 0; 1961 by_cart_list[ind].show_red = 0;
1957 } 1962 }
1958 - this.setData({by_quan_list_cart: by_cart_list}); 1963 + this.setData({ by_quan_list_cart: by_cart_list });
1959 } 1964 }
1960 //普通券 1965 //普通券
1961 var quanlist = this.data.selected_quan_list; 1966 var quanlist = this.data.selected_quan_list;
@@ -1964,7 +1969,7 @@ Page({ @@ -1964,7 +1969,7 @@ Page({
1964 for (var ind in quanlist) { 1969 for (var ind in quanlist) {
1965 quanlist[ind].show_red = 0; 1970 quanlist[ind].show_red = 0;
1966 } 1971 }
1967 - this.setData({selected_quan_list: quanlist}); 1972 + this.setData({ selected_quan_list: quanlist });
1968 } 1973 }
1969 1974
1970 var th = this; 1975 var th = this;
@@ -1975,9 +1980,9 @@ Page({ @@ -1975,9 +1980,9 @@ Page({
1975 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 1980 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
1976 } 1981 }
1977 else { 1982 else {
1978 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 1983 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
1979 } 1984 }
1980 - this.setData({using_quan: using_quan, is_coupon: 2222}); 1985 + this.setData({ using_quan: using_quan, is_coupon: 2222 });
1981 return; 1986 return;
1982 } 1987 }
1983 1988
@@ -1988,20 +1993,20 @@ Page({ @@ -1988,20 +1993,20 @@ Page({
1988 var txt1 = ""; 1993 var txt1 = "";
1989 var quan_item = null; 1994 var quan_item = null;
1990 1995
1991 - quan_item = this.data.get_by_quan_list[ind];  
1992 - txt = "get_by_quan_list[" + ind + "].show_red";  
1993 - var obj = {};  
1994 - obj[txt] = 1;  
1995 - this.setData(obj); 1996 + quan_item = this.data.get_by_quan_list[ind];
  1997 + txt = "get_by_quan_list[" + ind + "].show_red";
  1998 + var obj = {};
  1999 + obj[txt] = 1;
  2000 + this.setData(obj);
1996 2001
1997 2002
1998 if (using_quan[th.data.selected_quan_pick]) { 2003 if (using_quan[th.data.selected_quan_pick]) {
1999 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 2004 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
2000 } 2005 }
2001 else { 2006 else {
2002 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 2007 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
2003 } 2008 }
2004 - this.setData({using_quan: using_quan}); 2009 + this.setData({ using_quan: using_quan });
2005 }, 2010 },
2006 2011
2007 //--确认使用券--- 2012 //--确认使用券---
@@ -2061,14 +2066,14 @@ Page({ @@ -2061,14 +2066,14 @@ Page({
2061 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 2066 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券
2062 if (using_quan[pickid]) { 2067 if (using_quan[pickid]) {
2063 if (using_quan[pickid].is_nouse_red == 1) { 2068 if (using_quan[pickid].is_nouse_red == 1) {
2064 - using_quan[pickid] = {is_nouse_red: 1};  
2065 - th.setData({using_quan: using_quan}); 2069 + using_quan[pickid] = { is_nouse_red: 1 };
  2070 + th.setData({ using_quan: using_quan });
2066 if (th.data.is_b_now == 1) { 2071 if (th.data.is_b_now == 1) {
2067 th.calculatePrice2(); 2072 th.calculatePrice2();
2068 } else { 2073 } else {
2069 th.calculatePrice(); 2074 th.calculatePrice();
2070 } 2075 }
2071 - th.setData({open_quan: 0}); 2076 + th.setData({ open_quan: 0 });
2072 return; 2077 return;
2073 } 2078 }
2074 } 2079 }
@@ -2087,13 +2092,13 @@ Page({ @@ -2087,13 +2092,13 @@ Page({
2087 }; 2092 };
2088 using_quan[pickid].isby = 1; 2093 using_quan[pickid].isby = 1;
2089 } else { 2094 } else {
2090 - using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; 2095 + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
2091 using_quan[pickid].isby = 0; 2096 using_quan[pickid].isby = 0;
2092 } 2097 }
2093 - this.setData({using_quan: using_quan}); 2098 + this.setData({ using_quan: using_quan });
2094 th.calculatePrice2(); 2099 th.calculatePrice2();
2095 2100
2096 - th.setData({open_quan: 0}); 2101 + th.setData({ open_quan: 0 });
2097 }, 2102 },
2098 2103
2099 cart_set_err: function (e) { 2104 cart_set_err: function (e) {
@@ -2130,7 +2135,7 @@ Page({ @@ -2130,7 +2135,7 @@ Page({
2130 var wu_arr_txt = e.currentTarget.dataset.txt; 2135 var wu_arr_txt = e.currentTarget.dataset.txt;
2131 var w_sele_index = e.currentTarget.dataset.w_sele_index; 2136 var w_sele_index = e.currentTarget.dataset.w_sele_index;
2132 var is_express = null; 2137 var is_express = null;
2133 - var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; 2138 + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 };
2134 2139
2135 //--如果是多个门店的时候-- 2140 //--如果是多个门店的时候--
2136 if (w_sele_index != undefined) { 2141 if (w_sele_index != undefined) {
@@ -2141,20 +2146,20 @@ Page({ @@ -2141,20 +2146,20 @@ Page({
2141 }, 2146 },
2142 // 关闭物流的弹窗 2147 // 关闭物流的弹窗
2143 close_express: function () { 2148 close_express: function () {
2144 - this.setData({open_express: 0, disabled: 0}); 2149 + this.setData({ open_express: 0, disabled: 0 });
2145 }, 2150 },
2146 // 选择物流 2151 // 选择物流
2147 click_express_name: function (e) { 2152 click_express_name: function (e) {
2148 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; 2153 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
2149 var index = e.currentTarget.dataset.idxe; 2154 var index = e.currentTarget.dataset.idxe;
2150 - var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; 2155 + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 };
2151 ob[this.data.wu_arr_txt] = index; 2156 ob[this.data.wu_arr_txt] = index;
2152 this.setData(ob); 2157 this.setData(ob);
2153 }, 2158 },
2154 2159
2155 //点击确定物流 2160 //点击确定物流
2156 determine_expres: function (e) { 2161 determine_expres: function (e) {
2157 - this.setData({open_express: 0}); 2162 + this.setData({ open_express: 0 });
2158 if (this.data.is_b_now == 1) 2163 if (this.data.is_b_now == 1)
2159 this.calculatePrice2(); 2164 this.calculatePrice2();
2160 else 2165 else
@@ -2174,7 +2179,7 @@ Page({ @@ -2174,7 +2179,7 @@ Page({
2174 obj[txt] = is_open; 2179 obj[txt] = is_open;
2175 2180
2176 this.setData(obj); 2181 this.setData(obj);
2177 - this.setData({disabled: 1}) 2182 + this.setData({ disabled: 1 })
2178 }, 2183 },
2179 2184
2180 clik_coupons2: function (e) { 2185 clik_coupons2: function (e) {
@@ -2189,7 +2194,7 @@ Page({ @@ -2189,7 +2194,7 @@ Page({
2189 obj[txt] = is_open; 2194 obj[txt] = is_open;
2190 2195
2191 this.setData(obj); 2196 this.setData(obj);
2192 - this.setData({disabled: 1}) 2197 + this.setData({ disabled: 1 })
2193 }, 2198 },
2194 2199
2195 2200
@@ -2198,11 +2203,11 @@ Page({ @@ -2198,11 +2203,11 @@ Page({
2198 var th = this; 2203 var th = this;
2199 var is_shipping_code = this.data.is_shipping_code 2204 var is_shipping_code = this.data.is_shipping_code
2200 getApp().request.put("/api/weshop/users/update", { 2205 getApp().request.put("/api/weshop/users/update", {
2201 - data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, 2206 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
2202 success: function (rse) { 2207 success: function (rse) {
2203 if (rse.data.code == 0) { 2208 if (rse.data.code == 0) {
2204 getApp().globalData.userInfo.def_exp_code = is_shipping_code; 2209 getApp().globalData.userInfo.def_exp_code = is_shipping_code;
2205 - th.setData({open_express: 0}); 2210 + th.setData({ open_express: 0 });
2206 //----计算此时购物车的价格---- 2211 //----计算此时购物车的价格----
2207 if (th.data.is_b_now == 1) th.calculatePrice2(); 2212 if (th.data.is_b_now == 1) th.calculatePrice2();
2208 else th.calculatePrice(); 2213 else th.calculatePrice();
@@ -2212,7 +2217,7 @@ Page({ @@ -2212,7 +2217,7 @@ Page({
2212 }, 2217 },
2213 2218
2214 //更新下默认,在onshow里面 2219 //更新下默认,在onshow里面
2215 - update_code(){ 2220 + update_code() {
2216 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; 2221 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
2217 //--定时器,判断wu_arr不未空-- 2222 //--定时器,判断wu_arr不未空--
2218 var uii = setInterval(function () { 2223 var uii = setInterval(function () {
@@ -2226,7 +2231,7 @@ Page({ @@ -2226,7 +2231,7 @@ Page({
2226 } 2231 }
2227 //--如果是立即购买-- 2232 //--如果是立即购买--
2228 if (th.data.is_b_now == 1) { 2233 if (th.data.is_b_now == 1) {
2229 - th.setData({index: m_wind, is_express: m_wind}); 2234 + th.setData({ index: m_wind, is_express: m_wind });
2230 } else { 2235 } else {
2231 var ui = setInterval(function () { 2236 var ui = setInterval(function () {
2232 if (th.data.cartlist) { 2237 if (th.data.cartlist) {
@@ -2234,7 +2239,7 @@ Page({ @@ -2234,7 +2239,7 @@ Page({
2234 for (var i in c_arr) { 2239 for (var i in c_arr) {
2235 c_arr[i].wind = m_wind; 2240 c_arr[i].wind = m_wind;
2236 } 2241 }
2237 - th.setData({cartlist: c_arr, is_express: m_wind}) 2242 + th.setData({ cartlist: c_arr, is_express: m_wind })
2238 clearInterval(ui); 2243 clearInterval(ui);
2239 } 2244 }
2240 }, 500) 2245 }, 500)
@@ -2335,10 +2340,10 @@ Page({ @@ -2335,10 +2340,10 @@ Page({
2335 if (th.data.is_b_now) { 2340 if (th.data.is_b_now) {
2336 if (arr && arr.length > 0) { 2341 if (arr && arr.length > 0) {
2337 var quanlist = arr[0].quan_list; 2342 var quanlist = arr[0].quan_list;
2338 - th.setData({selected_quan_list: quanlist, cartlist: arr}) 2343 + th.setData({ selected_quan_list: quanlist, cartlist: arr })
2339 } 2344 }
2340 } else { 2345 } else {
2341 - th.setData({cartlist: arr}) 2346 + th.setData({ cartlist: arr })
2342 th.set_can_num(); 2347 th.set_can_num();
2343 } 2348 }
2344 2349
@@ -2358,7 +2363,7 @@ Page({ @@ -2358,7 +2363,7 @@ Page({
2358 if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) { 2363 if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) {
2359 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 2364 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
2360 var url = "/api/weshop/couponList/getUseCouponList"; 2365 var url = "/api/weshop/couponList/getUseCouponList";
2361 - app.request.promiseGet(url0, {1: 1}).then(res => { 2366 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
2362 if (res.data.code == 0) { 2367 if (res.data.code == 0) {
2363 frozenQuan = res.data.data; 2368 frozenQuan = res.data.data;
2364 th.data.frozenQuan = frozenQuan; 2369 th.data.frozenQuan = frozenQuan;
@@ -2376,7 +2381,7 @@ Page({ @@ -2376,7 +2381,7 @@ Page({
2376 quanlist = res.data.data.pageData; 2381 quanlist = res.data.data.pageData;
2377 if (quanlist) { 2382 if (quanlist) {
2378 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); 2383 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan);
2379 - th.setData({selected_quan_list: quanlist}) 2384 + th.setData({ selected_quan_list: quanlist })
2380 } 2385 }
2381 } 2386 }
2382 } 2387 }
@@ -2404,7 +2409,7 @@ Page({ @@ -2404,7 +2409,7 @@ Page({
2404 if (!goods_id) goods_id = this.data.bn_goods.goods_id; 2409 if (!goods_id) goods_id = this.data.bn_goods.goods_id;
2405 for (var i in arr) { 2410 for (var i in arr) {
2406 var item = arr[i]; 2411 var item = arr[i];
2407 - if (goods_id == item) return 0; 2412 + if (goods_id == item) return 0;
2408 } 2413 }
2409 return 1; 2414 return 1;
2410 }, 2415 },
@@ -2475,7 +2480,7 @@ Page({ @@ -2475,7 +2480,7 @@ Page({
2475 pick = this.data.bn_pick; 2480 pick = this.data.bn_pick;
2476 //---获取订单优惠--- 2481 //---获取订单优惠---
2477 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { 2482 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
2478 - data: {store_id: os.stoid, orderAmount: condition} 2483 + data: { store_id: os.stoid, orderAmount: condition }
2479 }).then(res => { 2484 }).then(res => {
2480 if (res.data.code == 0) { 2485 if (res.data.code == 0) {
2481 var data = res.data.data; 2486 var data = res.data.data;
@@ -2497,7 +2502,7 @@ Page({ @@ -2497,7 +2502,7 @@ Page({
2497 var ob = map[pickid][item.prom_id]; 2502 var ob = map[pickid][item.prom_id];
2498 ob.price += item.goods_price * item.goods_num; 2503 ob.price += item.goods_price * item.goods_num;
2499 ob.goods_num += item.goods_num; 2504 ob.goods_num += item.goods_num;
2500 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 2505 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
2501 2506
2502 } else { 2507 } else {
2503 var prom = null; 2508 var prom = null;
@@ -2513,7 +2518,7 @@ Page({ @@ -2513,7 +2518,7 @@ Page({
2513 ob.is_bz = prom.is_bz; 2518 ob.is_bz = prom.is_bz;
2514 ob.is_xz_yh = prom.is_xz_yh; 2519 ob.is_xz_yh = prom.is_xz_yh;
2515 ob.goods = new Array(); 2520 ob.goods = new Array();
2516 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 2521 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
2517 map[pickid][item.prom_id] = ob; 2522 map[pickid][item.prom_id] = ob;
2518 } 2523 }
2519 } else { 2524 } else {
@@ -2530,7 +2535,7 @@ Page({ @@ -2530,7 +2535,7 @@ Page({
2530 ob.is_bz = prom.is_bz; 2535 ob.is_bz = prom.is_bz;
2531 ob.is_xz_yh = prom.is_xz_yh; 2536 ob.is_xz_yh = prom.is_xz_yh;
2532 ob.goods = new Array(); 2537 ob.goods = new Array();
2533 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 2538 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
2534 2539
2535 var obj = {}; 2540 var obj = {};
2536 obj[item.prom_id] = ob; 2541 obj[item.prom_id] = ob;
@@ -2540,7 +2545,7 @@ Page({ @@ -2540,7 +2545,7 @@ Page({
2540 }, 2545 },
2541 2546
2542 //计算立即购买赠品的物流费用 2547 //计算立即购买赠品的物流费用
2543 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free,out_of_weight,allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { 2548 + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, gift_weight_free, out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1,pickid) {
2544 var good = this.data.buy_now_gift_goods; 2549 var good = this.data.buy_now_gift_goods;
2545 var goods_weight = -1, goods_piece = -1; 2550 var goods_weight = -1, goods_piece = -1;
2546 var gift_shipping_price = 0; 2551 var gift_shipping_price = 0;
@@ -2556,7 +2561,7 @@ Page({ @@ -2556,7 +2561,7 @@ Page({
2556 //累积商品重量 每种商品的重量 * 数量 2561 //累积商品重量 每种商品的重量 * 数量
2557 goods_weight += good['weight'] * good['buynum']; 2562 goods_weight += good['weight'] * good['buynum'];
2558 if (goods_weight1 > 0) { 2563 if (goods_weight1 > 0) {
2559 - out_of_weight = gift_weight_free - goods_weight; 2564 + out_of_weight = gift_weight_free - goods_weight;
2560 //不能调换位置 下面goods_weight会变大 2565 //不能调换位置 下面goods_weight会变大
2561 goods_weight += goods_weight1; 2566 goods_weight += goods_weight1;
2562 } 2567 }
@@ -2576,6 +2581,7 @@ Page({ @@ -2576,6 +2581,7 @@ Page({
2576 if (no_by_data && no_by_data.region_list) { 2581 if (no_by_data && no_by_data.region_list) {
2577 if (th.check_by_area(no_by_data.region_list)) { 2582 if (th.check_by_area(no_by_data.region_list)) {
2578 gift_freight_free = 0; 2583 gift_freight_free = 0;
  2584 + out_of_weight = 0;
2579 th.data.is_no_by[th.data.bn_pick] = 1; 2585 th.data.is_no_by[th.data.bn_pick] = 1;
2580 } 2586 }
2581 } 2587 }
@@ -2583,13 +2589,14 @@ Page({ @@ -2583,13 +2589,14 @@ Page({
2583 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 2589 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
2584 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 2590 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
2585 gift_freight_free = 0; 2591 gift_freight_free = 0;
2586 - //th.data.is_no_by[th.data.bn_pick]=1; 2592 + out_of_weight = 0;
  2593 + th.data.is_no_by[th.data.bn_pick]=1;
2587 } 2594 }
2588 } 2595 }
2589 2596
2590 var t_shipping_price = 2597 var t_shipping_price =
2591 - this.calculatewuliu(code, gift_shipping_price, goods_weight,  
2592 - goods_piece, user_addr, gift_freight_free, allpice, rs); 2598 + this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight,
  2599 + goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick);
2593 return t_shipping_price; 2600 return t_shipping_price;
2594 2601
2595 }, 2602 },
@@ -2646,7 +2653,7 @@ Page({ @@ -2646,7 +2653,7 @@ Page({
2646 2653
2647 //跳转关闭弹出框的显示 2654 //跳转关闭弹出框的显示
2648 close_offline: function () { 2655 close_offline: function () {
2649 - this.setData({is_offline_show: 0}); 2656 + this.setData({ is_offline_show: 0 });
2650 }, 2657 },
2651 2658
2652 //立即购买显示弹出框 2659 //立即购买显示弹出框
@@ -2654,7 +2661,7 @@ Page({ @@ -2654,7 +2661,7 @@ Page({
2654 var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price; 2661 var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price;
2655 //是不是线下 2662 //是不是线下
2656 var is_get_offline = this.data.bn_goods.is_offline; 2663 var is_get_offline = this.data.bn_goods.is_offline;
2657 - this.setData({is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline}); 2664 + this.setData({ is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline });
2658 }, 2665 },
2659 2666
2660 //确定使用线下取价 2667 //确定使用线下取价
@@ -2662,14 +2669,14 @@ Page({ @@ -2662,14 +2669,14 @@ Page({
2662 var bn_goods = this.data.bn_goods; 2669 var bn_goods = this.data.bn_goods;
2663 if (bn_goods && bn_goods.prom_type == 0) { 2670 if (bn_goods && bn_goods.prom_type == 0) {
2664 bn_goods.is_offline = 1; 2671 bn_goods.is_offline = 1;
2665 - this.setData({is_offline_show: 0, bn_goods: bn_goods}); 2672 + this.setData({ is_offline_show: 0, bn_goods: bn_goods });
2666 this.calculatePrice2(); 2673 this.calculatePrice2();
2667 } 2674 }
2668 //就是购物车结算时的 2675 //就是购物车结算时的
2669 else { 2676 else {
2670 var index = this.data.pop_offline_index; 2677 var index = this.data.pop_offline_index;
2671 var txt = "cartlist[" + index + "].is_offline"; 2678 var txt = "cartlist[" + index + "].is_offline";
2672 - this.setData({[txt]: 1, is_offline_show: 0,}); 2679 + this.setData({ [txt]: 1, is_offline_show: 0, });
2673 this.data.old_cartlist[index].is_offline = 1; 2680 this.data.old_cartlist[index].is_offline = 1;
2674 this.calculatePrice(); 2681 this.calculatePrice();
2675 } 2682 }
@@ -2682,14 +2689,14 @@ Page({ @@ -2682,14 +2689,14 @@ Page({
2682 var bn_goods = this.data.bn_goods; 2689 var bn_goods = this.data.bn_goods;
2683 if (bn_goods && bn_goods.prom_type == 0) { 2690 if (bn_goods && bn_goods.prom_type == 0) {
2684 bn_goods.is_offline = 0; 2691 bn_goods.is_offline = 0;
2685 - this.setData({is_offline_show: 0, bn_goods: bn_goods}); 2692 + this.setData({ is_offline_show: 0, bn_goods: bn_goods });
2686 this.calculatePrice2(); 2693 this.calculatePrice2();
2687 } 2694 }
2688 //就是购物车结算时的 2695 //就是购物车结算时的
2689 else { 2696 else {
2690 var index = this.data.pop_offline_index; 2697 var index = this.data.pop_offline_index;
2691 var txt = "cartlist[" + index + "].is_offline"; 2698 var txt = "cartlist[" + index + "].is_offline";
2692 - this.setData({[txt]: 0, is_offline_show: 0,}) 2699 + this.setData({ [txt]: 0, is_offline_show: 0, })
2693 this.data.old_cartlist[index].is_offline = 0; 2700 this.data.old_cartlist[index].is_offline = 0;
2694 this.calculatePrice(); 2701 this.calculatePrice();
2695 } 2702 }
@@ -2710,16 +2717,16 @@ Page({ @@ -2710,16 +2717,16 @@ Page({
2710 }); 2717 });
2711 }, 2718 },
2712 2719
2713 - set_hid_inp:function (e) { 2720 + set_hid_inp: function (e) {
2714 var index = e.currentTarget.dataset.index; 2721 var index = e.currentTarget.dataset.index;
2715 var txt = "cartlist[" + index + "].focus"; 2722 var txt = "cartlist[" + index + "].focus";
2716 - this.setData({[txt]:1}) 2723 + this.setData({ [txt]: 1 })
2717 }, 2724 },
2718 2725
2719 - clear_hid_inp:function (e) { 2726 + clear_hid_inp: function (e) {
2720 var index = e.currentTarget.dataset.index; 2727 var index = e.currentTarget.dataset.index;
2721 var txt = "cartlist[" + index + "].focus"; 2728 var txt = "cartlist[" + index + "].focus";
2722 - this.setData({[txt]:0}) 2729 + this.setData({ [txt]: 0 })
2723 }, 2730 },
2724 2731
2725 2732
packageC/pages/presell/cart/cart2_pre.js
1 -var t = getApp(),app=t, a = t.request, ut = require("../../../../utils/util.js");  
2 -var os=t.globalData.setting; 1 +var t = getApp(), app = t, a = t.request, ut = require("../../../../utils/util.js");
  2 +var os = t.globalData.setting;
3 var regeneratorRuntime = require('../../../../utils/runtime.js'); 3 var regeneratorRuntime = require('../../../../utils/runtime.js');
4 var util_pay = require("../../../../utils/pay.js"); 4 var util_pay = require("../../../../utils/pay.js");
5 5
@@ -20,132 +20,132 @@ Page({ @@ -20,132 +20,132 @@ Page({
20 enterAddressPage: !1, 20 enterAddressPage: !1,
21 firstEnter: !0, 21 firstEnter: !0,
22 //页面获取的参数 22 //页面获取的参数
23 - param:null,  
24 - postdata:null, 23 + param: null,
  24 + postdata: null,
25 //提交订单的格式 25 //提交订单的格式
26 formData: { 26 formData: {
27 - order_amount:0,//支付金额  
28 - total_amount:0,//总价  
29 - all_price:0,//商品卖的总价 27 + order_amount: 0,//支付金额
  28 + total_amount: 0,//总价
  29 + all_price: 0,//商品卖的总价
30 pay_points: 0,//使用积分 30 pay_points: 0,//使用积分
31 user_money: 0,//使用余额 31 user_money: 0,//使用余额
32 couponCode: "",//使用优惠券(多单就用逗号隔开) 32 couponCode: "",//使用优惠券(多单就用逗号隔开)
33 - shipping_price:0,//物流费用 33 + shipping_price: 0,//物流费用
34 }, 34 },
35 35
36 /*----------------立即购买---------------------*/ 36 /*----------------立即购买---------------------*/
37 - is_b_now:0, //0是购物车结算 1立即购买  
38 - bn_goods:null, //立即购买时候的调用商品  
39 - bn_use_money:0,//是否使用余额  
40 - bn_exp_type:1, //0是物流 1自提  
41 - bn_pick:0, //选择的门店 37 + is_b_now: 0, //0是购物车结算 1立即购买
  38 + bn_goods: null, //立即购买时候的调用商品
  39 + bn_use_money: 0,//是否使用余额
  40 + bn_exp_type: 1, //0是物流 1自提
  41 + bn_pick: 0, //选择的门店
42 bn_pickname: "", //选择的门店名称 42 bn_pickname: "", //选择的门店名称
43 - bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流 43 + bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
44 /*------------------------*/ 44 /*------------------------*/
45 - user_addr:null,//物流  
46 - userinfo:null, //获取会员 45 + user_addr: null,//物流
  46 + userinfo: null, //获取会员
47 /*----------物流选择--------*/ 47 /*----------物流选择--------*/
48 - wu_arr:null,  
49 - index:0, 48 + wu_arr: null,
  49 + index: 0,
50 50
51 //判断页面是返回回来的还是 首次进入的 51 //判断页面是返回回来的还是 首次进入的
52 - isclose:1,  
53 - is_express:0,//选择物流的控制器  
54 - yuer:0,  
55 - agree_no_ref:0 52 + isclose: 1,
  53 + is_express: 0,//选择物流的控制器
  54 + yuer: 0,
  55 + agree_no_ref: 0
56 }, 56 },
57 - onLoad: function(t) { 57 + onLoad: function (t) {
58 wx.setNavigationBarTitle({ 58 wx.setNavigationBarTitle({
59 title: "填写订单", 59 title: "填写订单",
60 }); 60 });
61 - var th = this; this.setData({ is_b_now: 1});  
62 - th.data.postdata=getApp().get_b_now();  
63 - th.data.param=t;  
64 - 61 + var th = this; this.setData({ is_b_now: 1 });
  62 + th.data.postdata = getApp().get_b_now();
  63 + th.data.param = t;
  64 +
65 }, 65 },
66 - onUnload: function () { this.setData({ isclose: 1 })}, 66 + onUnload: function () { this.setData({ isclose: 1 }) },
67 67
68 //------获取会员信息-----先获取用户信息,在进行下一步--- 68 //------获取会员信息-----先获取用户信息,在进行下一步---
69 - get_info:function(func){  
70 - var user_id = t.globalData.user_id;  
71 - app.auth.get_u(func); 69 + get_info: function (func) {
  70 + var user_id = t.globalData.user_id;
  71 + app.auth.get_u(func);
72 }, 72 },
73 73
74 //-------------------获取物流--------------- 74 //-------------------获取物流---------------
75 get_wuliu(func) { 75 get_wuliu(func) {
76 - var th = this;  
77 - app.getwuliu(function (e) {  
78 - if (th.data.is_default_logistics) {  
79 - //如果第一个不是开启默认,说明要让用户自己选  
80 - if (!e[0].is_default) {  
81 - th.setData({ is_default_logistics: 0 });  
82 - }  
83 - }  
84 - th.setData({ wu_arr: e })  
85 - typeof func == "function" && func();  
86 - }) 76 + var th = this;
  77 + app.getwuliu(function (e) {
  78 + if (th.data.is_default_logistics) {
  79 + //如果第一个不是开启默认,说明要让用户自己选
  80 + if (!e[0].is_default) {
  81 + th.setData({ is_default_logistics: 0 });
  82 + }
  83 + }
  84 + th.setData({ wu_arr: e })
  85 + typeof func == "function" && func();
  86 + })
87 }, 87 },
88 88
89 //------获取会员收货地址----- 89 //------获取会员收货地址-----
90 - getuser_addr:function(func){  
91 - if (app.globalData.baddr!=null){  
92 - var user_addr =app.globalData.baddr;  
93 - app.globalData.baddr=null;  
94 - func(user_addr);  
95 - }else{  
96 - a.get("/api/weshop/useraddress/page", {  
97 - data: { user_id:app.globalData.user_id, store_id: os.stoid, pageSize: 600 },  
98 - success: function (su) {  
99 -  
100 - var user_addr = su.data.data.pageData;  
101 - var item = null;  
102 - var def_item=null;  
103 - for (var i = 0; i < user_addr.length; i++) {  
104 - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }  
105 - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }  
106 - }  
107 - if (item == null) item = def_item;  
108 - if (item == null) item = user_addr[0];  
109 - if (item == undefined) item = null;  
110 - func(item);  
111 - }  
112 - });  
113 - } 90 + getuser_addr: function (func) {
  91 + if (app.globalData.baddr != null) {
  92 + var user_addr = app.globalData.baddr;
  93 + app.globalData.baddr = null;
  94 + func(user_addr);
  95 + } else {
  96 + a.get("/api/weshop/useraddress/page", {
  97 + data: { user_id: app.globalData.user_id, store_id: os.stoid, pageSize: 600 },
  98 + success: function (su) {
  99 +
  100 + var user_addr = su.data.data.pageData;
  101 + var item = null;
  102 + var def_item = null;
  103 + for (var i = 0; i < user_addr.length; i++) {
  104 + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
  105 + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
  106 + }
  107 + if (item == null) item = def_item;
  108 + if (item == null) item = user_addr[0];
  109 + if (item == undefined) item = null;
  110 + func(item);
  111 + }
  112 + });
  113 + }
114 }, 114 },
115 //----------------展示页面,是再获取用户信息之后-------------- 115 //----------------展示页面,是再获取用户信息之后--------------
116 - show_page:function(){  
117 - var th=this;  
118 - var user=getApp().globalData.userInfo;  
119 - getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + user.user_id, {  
120 - data:{r:Math.random()},  
121 - success: function (e) {  
122 -  
123 - getApp().globalData.userInfo = e.data.data;  
124 - th.setData({userinfo:e.data.data});  
125 - //获取立即购买的商品信息  
126 - th.get_buy_goods();  
127 -  
128 - //获取提现金额  
129 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
130 - data: { user_id:app.globalData.user_id, store_id: os.stoid, status: 0 },  
131 - success: function (su) {  
132 - if (su.data.code == 0) {  
133 - var yuer = parseFloat(th.data.userinfo.user_money -  
134 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
135 - if(yuer<0) yuer=0;  
136 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
137 - }  
138 - }  
139 - });  
140 - }  
141 - }); 116 + show_page: function () {
  117 + var th = this;
  118 + var user = getApp().globalData.userInfo;
  119 + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + user.user_id, {
  120 + data: { r: Math.random() },
  121 + success: function (e) {
  122 +
  123 + getApp().globalData.userInfo = e.data.data;
  124 + th.setData({ userinfo: e.data.data });
  125 + //获取立即购买的商品信息
  126 + th.get_buy_goods();
  127 +
  128 + //获取提现金额
  129 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  130 + data: { user_id: app.globalData.user_id, store_id: os.stoid, status: 0 },
  131 + success: function (su) {
  132 + if (su.data.code == 0) {
  133 + var yuer = parseFloat(th.data.userinfo.user_money -
  134 + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
  135 + if (yuer < 0) yuer = 0;
  136 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  137 + }
  138 + }
  139 + });
  140 + }
  141 + });
142 }, 142 },
143 143
144 //-----获取立即购买的商品信息---- 144 //-----获取立即购买的商品信息----
145 get_buy_goods: async function () { 145 get_buy_goods: async function () {
146 var th = this, a = getApp().request; 146 var th = this, a = getApp().request;
147 //定义变量 147 //定义变量
148 - var gg = th.data.postdata,act = null,prelist = null; 148 + var gg = th.data.postdata, act = null, prelist = null;
149 var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id; 149 var url = "/api/weshop/marketing/marketingPresellForm/get/" + os.stoid + "/" + gg.prom_id;
150 await getApp().request.promiseGet(url, {}).then(res => { 150 await getApp().request.promiseGet(url, {}).then(res => {
151 if (res.data.code == 0) { 151 if (res.data.code == 0) {
@@ -153,15 +153,15 @@ Page({ @@ -153,15 +153,15 @@ Page({
153 } 153 }
154 }) 154 })
155 if (!act) { 155 if (!act) {
156 - wx.showToast({title: "未找到活动", icon: 'none', duration: 3000}); 156 + wx.showToast({ title: "未找到活动", icon: 'none', duration: 3000 });
157 return false; 157 return false;
158 } 158 }
159 - if (act.is_end==1 ) {  
160 - wx.showToast({title:'活动已经结束' , icon: 'none', duration: 3000}); 159 + if (act.is_end == 1) {
  160 + wx.showToast({ title: '活动已经结束', icon: 'none', duration: 3000 });
161 return false; 161 return false;
162 } 162 }
163 - if( ut.gettimestamp()>act.end_time){  
164 - wx.showToast({title:"活动定金支付时间已过期" , icon: 'none', duration: 3000}); 163 + if (ut.gettimestamp() > act.end_time) {
  164 + wx.showToast({ title: "活动定金支付时间已过期", icon: 'none', duration: 3000 });
165 return false; 165 return false;
166 } 166 }
167 167
@@ -172,7 +172,7 @@ Page({ @@ -172,7 +172,7 @@ Page({
172 } 172 }
173 }) 173 })
174 if (!prelist) { 174 if (!prelist) {
175 - wx.showToast({title: "未找到商品", icon: 'none', duration: 3000}); 175 + wx.showToast({ title: "未找到商品", icon: 'none', duration: 3000 });
176 return false; 176 return false;
177 } 177 }
178 //-- 调用商品 -- 178 //-- 调用商品 --
@@ -191,7 +191,7 @@ Page({ @@ -191,7 +191,7 @@ Page({
191 distr_t = t.data.data.distr_type; 191 distr_t = t.data.data.distr_type;
192 } 192 }
193 193
194 - if(act.presell_type==1){ 194 + if (act.presell_type == 1) {
195 switch (distr_t) { 195 switch (distr_t) {
196 case 0: 196 case 0:
197 et = 1; 197 et = 1;
@@ -205,13 +205,13 @@ Page({ @@ -205,13 +205,13 @@ Page({
205 et = 0; 205 et = 0;
206 break; 206 break;
207 } 207 }
208 - }else{  
209 - et=1; //要付定金的时候 208 + } else {
  209 + et = 1; //要付定金的时候
210 } 210 }
211 211
212 t.data.data.shop_price = prelist.presell_money; 212 t.data.data.shop_price = prelist.presell_money;
213 th.setData({ 213 th.setData({
214 - bn_goods: t.data.data, bn_pickname: gg.pick_name,prelist:prelist,act:act, 214 + bn_goods: t.data.data, bn_pickname: gg.pick_name, prelist: prelist, act: act,
215 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et 215 bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
216 }); 216 });
217 //计算价格 217 //计算价格
@@ -222,270 +222,269 @@ Page({ @@ -222,270 +222,269 @@ Page({
222 222
223 //----------子页返回父页触发---------- 223 //----------子页返回父页触发----------
224 onShow: function () { 224 onShow: function () {
225 - var th = this;  
226 - if (th.data.isclose == 0) {  
227 - wx.navigateTo({  
228 - url: "/pages/index/index/index"  
229 - })  
230 - } else {  
231 - this.getuser_addr(function (ie) {  
232 - //更换地址回来要重新调用计算价钱的接口  
233 - th.setData({ user_addr: ie });  
234 - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {  
235 - th.setData({ add_back: 1 });  
236 - if (this.data.bn_goods) th.calculatePrice2();  
237 - }  
238 - })  
239 - //--更新默认地址--,看一下是不是跳到地址页面  
240 - if (!getApp().globalData.is_cart_old) {  
241 - this.update_code(); 225 + var th = this;
  226 + if (th.data.isclose == 0) {
  227 + wx.navigateTo({
  228 + url: "/pages/index/index/index"
  229 + })
242 } else { 230 } else {
243 - getApp().globalData.is_cart_old = 0;  
244 - }  
245 - }  
246 -  
247 - //先获取是否有关闭使用优惠券  
248 - getApp().getConfig2(function (ee) {  
249 - var json_d = JSON.parse(ee.switch_list);  
250 - th.data.json_d = json_d;  
251 - th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
252 - var is_default_logistics = json_d.is_default_logistics;  
253 -  
254 - th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });  
255 -  
256 - var rank_switch = json_d.rank_switch;  
257 - var max_price = -1;  
258 - var show_card = null;  
259 - var name = "";  
260 - //如果有开等级卡的时候,  
261 - //因为都是调接口,要返回在计算  
262 - if (rank_switch == 2) {  
263 - //-- 获取所有的等级卡, --  
264 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
265 - {}).then(res => {  
266 - if (res.data.code == 0) {  
267 - var plusCard = res.data.data;  
268 - //-- 循环判断,拿到最贵的那张卡 --  
269 - for (var ih in plusCard) {  
270 - if (plusCard[ih].IsStopBuy == true) { continue; }  
271 - if (max_price < 0) {  
272 - max_price = plusCard[ih].CardFee;  
273 - name = 'card' + plusCard[ih]['CorrPrice'];  
274 - show_card = plusCard[ih];  
275 - } else {  
276 - if (max_price < plusCard[ih].CardFee) {  
277 - max_price = plusCard[ih].CardFee;  
278 - name = 'card' + plusCard[ih]['CorrPrice'];  
279 - show_card = plusCard[ih];  
280 - }  
281 - }  
282 - }  
283 -  
284 - if (show_card) {  
285 - name = name.toLowerCase();  
286 - th.setData({ card_name: name, show_card: show_card }) 231 + this.getuser_addr(function (ie) {
  232 + //更换地址回来要重新调用计算价钱的接口
  233 + th.setData({ user_addr: ie });
  234 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  235 + th.setData({ add_back: 1 });
  236 + if (this.data.bn_goods) th.calculatePrice2();
287 } 237 }
288 - }  
289 - //-----先获取物流,再获取用户信息,再展示页面-----  
290 - th.get_wuliu(th.get_info(th.show_page));  
291 }) 238 })
292 - } else {  
293 - //-----先获取物流,再获取用户信息,再展示页面-----  
294 - th.get_wuliu(th.get_info(th.show_page)); 239 + //--更新默认地址--,看一下是不是跳到地址页面
  240 + if (!getApp().globalData.is_cart_old) {
  241 + this.update_code();
  242 + } else {
  243 + getApp().globalData.is_cart_old = 0;
  244 + }
295 } 245 }
296 - }, 1) 246 +
  247 + //先获取是否有关闭使用优惠券
  248 + getApp().getConfig2(function (ee) {
  249 + var json_d = JSON.parse(ee.switch_list);
  250 + th.data.json_d = json_d;
  251 + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  252 + var is_default_logistics = json_d.is_default_logistics;
  253 +
  254 + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });
  255 +
  256 + var rank_switch = json_d.rank_switch;
  257 + var max_price = -1;
  258 + var show_card = null;
  259 + var name = "";
  260 + //如果有开等级卡的时候,
  261 + //因为都是调接口,要返回在计算
  262 + if (rank_switch == 2) {
  263 + //-- 获取所有的等级卡, --
  264 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  265 + {}).then(res => {
  266 + if (res.data.code == 0) {
  267 + var plusCard = res.data.data;
  268 + //-- 循环判断,拿到最贵的那张卡 --
  269 + for (var ih in plusCard) {
  270 + if (plusCard[ih].IsStopBuy == true) { continue; }
  271 + if (max_price < 0) {
  272 + max_price = plusCard[ih].CardFee;
  273 + name = 'card' + plusCard[ih]['CorrPrice'];
  274 + show_card = plusCard[ih];
  275 + } else {
  276 + if (max_price < plusCard[ih].CardFee) {
  277 + max_price = plusCard[ih].CardFee;
  278 + name = 'card' + plusCard[ih]['CorrPrice'];
  279 + show_card = plusCard[ih];
  280 + }
  281 + }
  282 + }
  283 +
  284 + if (show_card) {
  285 + name = name.toLowerCase();
  286 + th.setData({ card_name: name, show_card: show_card })
  287 + }
  288 + }
  289 + //-----先获取物流,再获取用户信息,再展示页面-----
  290 + th.get_wuliu(th.get_info(th.show_page));
  291 + })
  292 + } else {
  293 + //-----先获取物流,再获取用户信息,再展示页面-----
  294 + th.get_wuliu(th.get_info(th.show_page));
  295 + }
  296 + }, 1)
297 297
298 }, 298 },
299 //---------------检查是否有收货地址------------------- 299 //---------------检查是否有收货地址-------------------
300 - checkAddressList: function() { 300 + checkAddressList: function () {
301 var t = this; 301 var t = this;
302 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 302 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
303 title: "请先填写或选择收货地址~", 303 title: "请先填写或选择收货地址~",
304 - success: function(a) { 304 + success: function (a) {
305 a.confirm ? t.enterAddressPage() : wx.navigateBack(); 305 a.confirm ? t.enterAddressPage() : wx.navigateBack();
306 }, 306 },
307 - fail: function() { 307 + fail: function () {
308 wx.navigateBack(); 308 wx.navigateBack();
309 } 309 }
310 }), !1); 310 }), !1);
311 }, 311 },
312 - showInvoice: function() { 312 + showInvoice: function () {
313 this.setData({ 313 this.setData({
314 invoiceToggle: !this.data.invoiceToggle 314 invoiceToggle: !this.data.invoiceToggle
315 }); 315 });
316 }, 316 },
317 - keyUpChangePay1: function(t) { 317 + keyUpChangePay1: function (t) {
318 this.setData({ 318 this.setData({
319 payWithUserMoney: !(t.detail.value.length > 0) 319 payWithUserMoney: !(t.detail.value.length > 0)
320 }); 320 });
321 }, 321 },
322 - keyUpChangePay2: function(t) { 322 + keyUpChangePay2: function (t) {
323 this.setData({ 323 this.setData({
324 payWithPoints: !(t.detail.value.length > 0) 324 payWithPoints: !(t.detail.value.length > 0)
325 }); 325 });
326 }, 326 },
327 - keyUpChangeNum: function(t) { 327 + keyUpChangeNum: function (t) {
328 this.setData({ 328 this.setData({
329 maxWord: t.detail.value.length 329 maxWord: t.detail.value.length
330 }); 330 });
331 }, 331 },
332 //---------计算立即购买---------- 332 //---------计算立即购买----------
333 calculatePrice2: function () { 333 calculatePrice2: function () {
334 - console.log('calculatePrice2');  
335 - var th = this, good = this.data.bn_goods;  
336 - //-----------计算商品总价--------------  
337 - var allpice = good.shop_price * good.buynum;  
338 - allpice=parseFloat(allpice).toFixed(2);  
339 - var txt = "formData.all_price";  
340 - th.setData({ [txt]: allpice, });  
341 - console.log(th.data.formData);  
342 -  
343 - app.getConfig2(function (ee) {  
344 - app.getwuliuprice(function (rs) { 334 + console.log('calculatePrice2');
  335 + var th = this, good = this.data.bn_goods;
  336 + //-----------计算商品总价--------------
  337 + var allpice = good.shop_price * good.buynum;
  338 + allpice = parseFloat(allpice).toFixed(2);
  339 + var txt = "formData.all_price";
  340 + th.setData({ [txt]: allpice, });
  341 + console.log(th.data.formData);
  342 +
  343 + app.getConfig2(function (ee) {
  344 + app.getwuliuprice(function (rs) {
345 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 345 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
346 - var out_of_weight=null; //超出多少重量 346 + var out_of_weight = null; //超出多少重量
347 var freight_free = ee.freight_free; //全场满多少包邮 347 var freight_free = ee.freight_free; //全场满多少包邮
348 var weight_free = ee.weight_free; //多少kg内包邮 348 var weight_free = ee.weight_free; //多少kg内包邮
349 var no_ex_id = ee.no_ex_id; 349 var no_ex_id = ee.no_ex_id;
350 - //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------  
351 - if (th.data.user_addr != null && th.data.bn_exp_type == 0  
352 - && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){  
353 - switch (good['exp_sum_type']) {  
354 - case 1:  
355 - //统一运费  
356 - o_shipping_price += good['uniform_exp_sum']; break;  
357 - case 2:  
358 - if (goods_weight < 0) goods_weight = 0;  
359 - //累积商品重量 每种商品的重量 * 数量  
360 - goods_weight += good['weight'] * good['buynum'];  
361 - if(weight_free > 0){  
362 - out_of_weight = (weight_free * 1000 ) - goods_weight;  
363 - }  
364 - break;  
365 - case 3:  
366 - if (goods_piece < 0) goods_piece = 0;  
367 - //累积商品数量  
368 - goods_piece += good['buynum']; break;  
369 - }  
370 -  
371 - var code = th.data.wu_arr[th.data.index].code;  
372 - var shipping_price=  
373 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, 350 + //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
  351 + if (th.data.user_addr != null && th.data.bn_exp_type == 0
  352 + && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  353 + switch (good['exp_sum_type']) {
  354 + case 1:
  355 + //统一运费
  356 + o_shipping_price += good['uniform_exp_sum']; break;
  357 + case 2:
  358 + if (goods_weight < 0) goods_weight = 0;
  359 + //累积商品重量 每种商品的重量 * 数量
  360 + goods_weight += good['weight'] * good['buynum'];
  361 + if (weight_free > 0) {
  362 + out_of_weight = (weight_free * 1000) - goods_weight;
  363 + }
  364 + break;
  365 + case 3:
  366 + if (goods_piece < 0) goods_piece = 0;
  367 + //累积商品数量
  368 + goods_piece += good['buynum']; break;
  369 + }
  370 +
  371 + var code = th.data.wu_arr[th.data.index].code;
  372 + var shipping_price =
  373 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
374 goods_piece, th.data.user_addr, freight_free, allpice, rs); 374 goods_piece, th.data.user_addr, freight_free, allpice, rs);
375 375
376 - shipping_price = parseFloat(shipping_price).toFixed(2);  
377 - var wl_txt = "formData.shipping_price";  
378 - th.setData({ [wl_txt]: shipping_price, })  
379 -  
380 - }else{  
381 - var wl_txt = "formData.shipping_price";  
382 - th.setData({ [wl_txt]: 0, })  
383 - }  
384 - //-----------------总价-----------------  
385 - var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price);  
386 - total_m = parseFloat(total_m).toFixed(2);  
387 -  
388 - var atxt= "formData.total_amount";  
389 - th.setData({ [atxt]: total_m, })  
390 - var order_m = total_m;  
391 -  
392 - var txt = "formData.user_money";  
393 - var txt2 = "formData.order_amount";  
394 - //--------------如果使用余额---------------------  
395 - if (th.data.bn_use_money == 1 && th.data.yuer>0) {  
396 - if ( parseFloat(th.data.yuer) > total_m) {  
397 - th.setData({ [txt]: total_m, [txt2]:0 })  
398 - }else{  
399 - order_m = parseFloat(order_m) - parseFloat(th.data.yuer);  
400 - order_m = order_m.toFixed(2);  
401 - th.setData({ [txt]: th.data.yuer, [txt2]: order_m })  
402 - }  
403 - }else{ 376 + shipping_price = parseFloat(shipping_price).toFixed(2);
  377 + var wl_txt = "formData.shipping_price";
  378 + th.setData({ [wl_txt]: shipping_price, })
  379 +
  380 + } else {
  381 + var wl_txt = "formData.shipping_price";
  382 + th.setData({ [wl_txt]: 0, })
  383 + }
  384 + //-----------------总价-----------------
  385 + var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price);
  386 + total_m = parseFloat(total_m).toFixed(2);
  387 +
  388 + var atxt = "formData.total_amount";
  389 + th.setData({ [atxt]: total_m, })
  390 + var order_m = total_m;
  391 +
  392 + var txt = "formData.user_money";
  393 + var txt2 = "formData.order_amount";
  394 + //--------------如果使用余额---------------------
  395 + if (th.data.bn_use_money == 1 && th.data.yuer > 0) {
  396 + if (parseFloat(th.data.yuer) > total_m) {
  397 + th.setData({ [txt]: total_m, [txt2]: 0 })
  398 + } else {
  399 + order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
  400 + order_m = order_m.toFixed(2);
  401 + th.setData({ [txt]: th.data.yuer, [txt2]: order_m })
  402 + }
  403 + } else {
404 th.setData({ [txt]: 0, [txt2]: order_m }) 404 th.setData({ [txt]: 0, [txt2]: order_m })
405 - } 405 + }
406 406
407 - });  
408 - }); 407 + });
  408 + });
409 }, 409 },
410 410
411 // -- 支付的下一步 -- 411 // -- 支付的下一步 --
412 - submitForm_next:async function(t){  
413 - if(this.data.is_summit_ing==1) return false; //--提交中退出--  
414 - this.data.is_summit_ing=1; 412 + submitForm_next: async function (t) {
  413 + if (this.data.is_summit_ing == 1) return false; //--提交中退出--
  414 + this.data.is_summit_ing = 1;
415 415
416 - var th=this,pdata=new Array();  
417 - var ff=true; 416 + var th = this, pdata = new Array();
  417 + var ff = true;
418 //------------立即购买------------- 418 //------------立即购买-------------
419 419
420 //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 420 //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候
421 - if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ 421 + if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
422 ff = false; 422 ff = false;
423 - getApp().my_warnning("请选择收货地址",0,this); 423 + getApp().my_warnning("请选择收货地址", 0, this);
424 this.data.is_summit_ing = 0; 424 this.data.is_summit_ing = 0;
425 } 425 }
426 if (!ff) return false; 426 if (!ff) return false;
427 var addr = th.data.user_addr; 427 var addr = th.data.user_addr;
428 - if (th.data.bn_exp_type == 1) addr=null; 428 + if (th.data.bn_exp_type == 1) addr = null;
429 429
430 - if(th.data.bn_exp_type==0 && (th.data.kt_type!=3)) { 430 + if (th.data.bn_exp_type == 0 && (th.data.kt_type != 3)) {
431 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { 431 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
432 - getApp().my_warnning("读取物流失败",0,this); 432 + getApp().my_warnning("读取物流失败", 0, this);
433 this.data.is_summit_ing = 0; 433 this.data.is_summit_ing = 0;
434 return false; 434 return false;
435 } 435 }
436 } 436 }
437 437
438 //阶梯团强制带1,自提~~~ 438 //阶梯团强制带1,自提~~~
439 - if(th.data.kt_type==3 ){  
440 - th.data.bn_exp_type=1; 439 + if (th.data.kt_type == 3) {
  440 + th.data.bn_exp_type = 1;
441 } 441 }
442 442
443 - var item={  
444 - 'user_id':app.globalData.user_id, 443 + var item = {
  444 + 'user_id': app.globalData.user_id,
445 'consignee': addr == null ? "" : addr.consignee, 445 'consignee': addr == null ? "" : addr.consignee,
446 'province': addr == null ? 0 : addr.province, 446 'province': addr == null ? 0 : addr.province,
447 'city': addr == null ? 0 : addr.city, 447 'city': addr == null ? 0 : addr.city,
448 'district': addr == null ? 0 : addr.district, 448 'district': addr == null ? 0 : addr.district,
449 'twon': addr == null ? 0 : addr.twon, 449 'twon': addr == null ? 0 : addr.twon,
450 - 'address': addr == null ? "": addr.address, 450 + 'address': addr == null ? "" : addr.address,
451 'more_address': addr == null ? "" : addr.more_address, 451 'more_address': addr == null ? "" : addr.more_address,
452 - 'mobile': addr == null ? th.data.userinfo.mobile:addr.mobile,  
453 - 'email':'',  
454 - 'invoice_title':'', 452 + 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile,
  453 + 'email': '',
  454 + 'invoice_title': '',
455 'goods_price': th.data.formData.all_price, //商品总价 455 'goods_price': th.data.formData.all_price, //商品总价
456 'shipping_price': th.data.formData.shipping_price, //物流金额 456 'shipping_price': th.data.formData.shipping_price, //物流金额
457 'user_money': th.data.formData.user_money, //使用余额 457 'user_money': th.data.formData.user_money, //使用余额
458 'total_amount': th.data.formData.total_amount, //订单总价 458 'total_amount': th.data.formData.total_amount, //订单总价
459 'order_amount': th.data.formData.order_amount, //应付 459 'order_amount': th.data.formData.order_amount, //应付
460 'user_note': t.detail.value.user_note, //用户备注 460 'user_note': t.detail.value.user_note, //用户备注
461 - 'store_id':os.stoid, //商家 461 + 'store_id': os.stoid, //商家
462 'pickup_id': th.data.bn_pick, //门店 462 'pickup_id': th.data.bn_pick, //门店
463 - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 463 + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型
464 'prom_id': th.data.bn_goods.prom_id, //促销活动id 464 'prom_id': th.data.bn_goods.prom_id, //促销活动id
465 - 'order_goods':new Array(), 465 + 'order_goods': new Array(),
466 }; 466 };
467 467
468 //老会员成为分销下线需要的参数 468 //老会员成为分销下线需要的参数
469 - if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){ 469 + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {
470 //判断一下分享人是不是分享商 470 //判断一下分享人是不是分享商
471 - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{  
472 - if(res.data.code==0){  
473 - var user= res.data.data;  
474 - if(user.is_distribut==1){  
475 - item.first_leader=parseInt(getApp().globalData.first_leader); 471 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => {
  472 + if (res.data.code == 0) {
  473 + var user = res.data.data;
  474 + if (user.is_distribut == 1) {
  475 + item.first_leader = parseInt(getApp().globalData.first_leader);
476 } 476 }
477 } 477 }
478 }) 478 })
479 } 479 }
480 480
481 - if(th.data.qh!='')  
482 - {  
483 - item.team_qh=th.data.qh;  
484 - item.pt_listno=th.data.qh; 481 + if (th.data.qh != '') {
  482 + item.team_qh = th.data.qh;
  483 + item.pt_listno = th.data.qh;
485 } 484 }
486 485
487 - var gg =app.get_b_now();  
488 - var goods={ 486 + var gg = app.get_b_now();
  487 + var goods = {
489 'goods_id': gg.goods_id, 488 'goods_id': gg.goods_id,
490 'goods_name': gg.goods_name, 489 'goods_name': gg.goods_name,
491 'goods_sn': gg.goods_sn, 490 'goods_sn': gg.goods_sn,
@@ -494,37 +493,37 @@ Page({ @@ -494,37 +493,37 @@ Page({
494 'goods_price': th.data.bn_goods.shop_price, 493 'goods_price': th.data.bn_goods.shop_price,
495 'member_goods_price': th.data.bn_goods.shop_price, 494 'member_goods_price': th.data.bn_goods.shop_price,
496 'store_id': os.stoid, 495 'store_id': os.stoid,
497 - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 496 + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型
498 'prom_id': th.data.bn_goods.prom_id, //促销活动id 497 'prom_id': th.data.bn_goods.prom_id, //促销活动id
499 }; 498 };
500 499
501 //--导购分享过来的id-- 500 //--导购分享过来的id--
502 - if(gg.guide_id){  
503 - goods.guide_id=gg.guide_id;  
504 - goods.guide_type=gg.guide_type; 501 + if (gg.guide_id) {
  502 + goods.guide_id = gg.guide_id;
  503 + goods.guide_type = gg.guide_type;
505 //调用接口判断是不是会员 504 //调用接口判断是不是会员
506 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+os.stoid+"/"+gg.guide_id,{}).then(res=>{  
507 - if(res.data.code==0){  
508 - goods.guide_name=res.data.data.salesman;  
509 - goods.guide_sn=res.data.data.salesman_no; 505 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + os.stoid + "/" + gg.guide_id, {}).then(res => {
  506 + if (res.data.code == 0) {
  507 + goods.guide_name = res.data.data.salesman;
  508 + goods.guide_sn = res.data.data.salesman_no;
510 } 509 }
511 }) 510 })
512 } 511 }
513 512
514 //--商品的房间号-- 513 //--商品的房间号--
515 - if(gg.room_id && gg.room_id>0){  
516 - item.room_ids=gg.room_id;  
517 - goods.room_id=gg.room_id; 514 + if (gg.room_id && gg.room_id > 0) {
  515 + item.room_ids = gg.room_id;
  516 + goods.room_id = gg.room_id;
518 } 517 }
519 518
520 - if(th.data.bn_goods.is_normal){goods.is_pd_normal=1;} 519 + if (th.data.bn_goods.is_normal) { goods.is_pd_normal = 1; }
521 520
522 item.order_goods.push(goods); 521 item.order_goods.push(goods);
523 pdata.push(item); 522 pdata.push(item);
524 523
525 - if (pdata.length==0) return; 524 + if (pdata.length == 0) return;
526 var str = JSON.stringify(pdata); 525 var str = JSON.stringify(pdata);
527 - wx.showLoading({title: "加载中"}); 526 + wx.showLoading({ title: "加载中" });
528 wx.request({ 527 wx.request({
529 url: os.url + '/api/weshop/order/createWxdOrder', 528 url: os.url + '/api/weshop/order/createWxdOrder',
530 data: str, 529 data: str,
@@ -536,8 +535,8 @@ Page({ @@ -536,8 +535,8 @@ Page({
536 535
537 wx.hideLoading(); 536 wx.hideLoading();
538 if (res.statusCode == 200) { 537 if (res.statusCode == 200) {
539 - var data=res.data;  
540 - if(data.code==0){ 538 + var data = res.data;
  539 + if (data.code == 0) {
541 console.log(th.data.is_b_now); 540 console.log(th.data.is_b_now);
542 //如果是购物车结算,还要删除购物车 541 //如果是购物车结算,还要删除购物车
543 if (th.data.is_b_now == 0) { 542 if (th.data.is_b_now == 0) {
@@ -555,11 +554,11 @@ Page({ @@ -555,11 +554,11 @@ Page({
555 //要进行判断,如果是用微信支付,就要跳转到支付界面 554 //要进行判断,如果是用微信支付,就要跳转到支付界面
556 if (order_amount > 0) { 555 if (order_amount > 0) {
557 th.setData({ isclose: 0 }); 556 th.setData({ isclose: 0 });
558 - util_pay.pay(data.data, function() {  
559 - var url="/packageC/pages/presell/cart/cart?order_sn="+data.data; 557 + util_pay.pay(data.data, function () {
  558 + var url = "/packageC/pages/presell/cart/cart?order_sn=" + data.data;
560 setTimeout(function () { 559 setTimeout(function () {
561 - wx.reLaunch({ url: url,})  
562 - },1000) 560 + wx.reLaunch({ url: url, })
  561 + }, 1000)
563 }, function () { 562 }, function () {
564 //支付失败 563 //支付失败
565 setTimeout(function () { 564 setTimeout(function () {
@@ -567,9 +566,9 @@ Page({ @@ -567,9 +566,9 @@ Page({
567 wx.reLaunch({ 566 wx.reLaunch({
568 url: "/pages/user/order_list/order_list", 567 url: "/pages/user/order_list/order_list",
569 }) 568 })
570 - },1000) 569 + }, 1000)
571 570
572 - },os.stoid,1); 571 + }, os.stoid, 1);
573 572
574 } else { 573 } else {
575 var dd = { 574 var dd = {
@@ -582,15 +581,15 @@ Page({ @@ -582,15 +581,15 @@ Page({
582 data: dd, 581 data: dd,
583 success: function (t) { 582 success: function (t) {
584 console.log(t); 583 console.log(t);
585 - app.my_warnning("支付成功",1,th); 584 + app.my_warnning("支付成功", 1, th);
586 setTimeout(function () { 585 setTimeout(function () {
587 th.setData({ isclose: 0 }); 586 th.setData({ isclose: 0 });
588 587
589 588
590 - var url="/packageC/pages/presell/cart/cart?order_sn="+data.data;  
591 - wx.reLaunch({  
592 - url: url  
593 - }) 589 + var url = "/packageC/pages/presell/cart/cart?order_sn=" + data.data;
  590 + wx.reLaunch({
  591 + url: url
  592 + })
594 593
595 594
596 595
@@ -599,54 +598,54 @@ Page({ @@ -599,54 +598,54 @@ Page({
599 }); 598 });
600 } 599 }
601 } 600 }
602 - else{  
603 - th.data.is_summit_ing=0; //是否提交中 601 + else {
  602 + th.data.is_summit_ing = 0; //是否提交中
604 getApp().confirmBox(data.msg); 603 getApp().confirmBox(data.msg);
605 } 604 }
606 } else { 605 } else {
607 - th.data.is_summit_ing=0; //是否提交中 606 + th.data.is_summit_ing = 0; //是否提交中
608 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); 607 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
609 } 608 }
610 }, 609 },
611 fail: function () { 610 fail: function () {
612 - th.data.is_summit_ing=0; //是否提交中 611 + th.data.is_summit_ing = 0; //是否提交中
613 wx.hideLoading(); 612 wx.hideLoading();
614 console.log("index.js wx.request CheckCallUser fail"); 613 console.log("index.js wx.request CheckCallUser fail");
615 }, 614 },
616 - complete: function () {} 615 + complete: function () { }
617 }) 616 })
618 }, 617 },
619 618
620 619
621 //--------------------提交订单----------------------- 620 //--------------------提交订单-----------------------
622 - submitForm: function(t){  
623 - var th=this; 621 + submitForm: function (t) {
  622 + var th = this;
624 //如果是部分定金,商家不同意退定金, 623 //如果是部分定金,商家不同意退定金,
625 - if(this.data.act.presell_type!=1 && !this.data.act.is_refundmoney && !th.agree_no_ref){ 624 + if (this.data.act.presell_type != 1 && !this.data.act.is_refundmoney && !th.agree_no_ref) {
626 wx.showModal({ 625 wx.showModal({
627 content: ' 预售商品不允许退定金!是否继续下单?', 626 content: ' 预售商品不允许退定金!是否继续下单?',
628 showCancel: true,//是否显示取消按钮 627 showCancel: true,//是否显示取消按钮
629 - cancelText:"我在想想",//默认是“取消”  
630 - confirmText:"继续下单",//默认是“确定” 628 + cancelText: "我在想想",//默认是“取消”
  629 + confirmText: "继续下单",//默认是“确定”
631 success: function (res) { 630 success: function (res) {
632 if (res.cancel) { 631 if (res.cancel) {
633 //点击取消,默认隐藏弹框 632 //点击取消,默认隐藏弹框
634 } else { 633 } else {
635 - th.setData({agree_no_ref:1})  
636 - th.submitForm_next(t) 634 + th.setData({ agree_no_ref: 1 })
  635 + th.submitForm_next(t)
637 } 636 }
638 }, 637 },
639 }) 638 })
640 639
641 - }else{  
642 - this.submitForm_next(t); 640 + } else {
  641 + this.submitForm_next(t);
643 } 642 }
644 }, 643 },
645 644
646 - useCoupon: function() { 645 + useCoupon: function () {
647 if (this.data.order.couponNum <= 0) { 646 if (this.data.order.couponNum <= 0) {
648 //return t.showWarning("无可用优惠券"); 647 //return t.showWarning("无可用优惠券");
649 - getApp().my_warnning("无可用优惠券",0,this); 648 + getApp().my_warnning("无可用优惠券", 0, this);
650 return; 649 return;
651 } 650 }
652 var a = { 651 var a = {
@@ -656,158 +655,158 @@ Page({ @@ -656,158 +655,158 @@ Page({
656 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a) 655 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
657 }); 656 });
658 }, 657 },
659 - enterAddressPage: function() {  
660 - getApp().globalData.is_cart_old=1; 658 + enterAddressPage: function () {
  659 + getApp().globalData.is_cart_old = 1;
661 this.data.enterAddressPage = !0, wx.navigateTo({ 660 this.data.enterAddressPage = !0, wx.navigateTo({
662 url: "/pages/user/address_list/address_list" 661 url: "/pages/user/address_list/address_list"
663 }); 662 });
664 }, 663 },
665 664
666 - //--------立即购买时,选择自提和物流-----------  
667 - setexptype_w:function(t){  
668 - var th=this;  
669 - var ty = t.currentTarget.dataset.t,txt = t.currentTarget.dataset.txt;  
670 - th.setData({ [txt]: ty });  
671 - var iszt=1;  
672 - if(ty==0){  
673 - th.setData({ is_all_zt: 0 });  
674 - }else{  
675 - for(var i=0;i<th.data.cartlist.length;i++){  
676 - var item = th.data.cartlist[i];  
677 - if (item.exp_type==0){ iszt=0;break;}  
678 - }  
679 - th.setData({ is_all_zt: iszt });  
680 - }  
681 - //----计算此时购物车的价格----  
682 - th.calculatePrice(); 665 + //--------立即购买时,选择自提和物流-----------
  666 + setexptype_w: function (t) {
  667 + var th = this;
  668 + var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt;
  669 + th.setData({ [txt]: ty });
  670 + var iszt = 1;
  671 + if (ty == 0) {
  672 + th.setData({ is_all_zt: 0 });
  673 + } else {
  674 + for (var i = 0; i < th.data.cartlist.length; i++) {
  675 + var item = th.data.cartlist[i];
  676 + if (item.exp_type == 0) { iszt = 0; break; }
  677 + }
  678 + th.setData({ is_all_zt: iszt });
  679 + }
  680 + //----计算此时购物车的价格----
  681 + th.calculatePrice();
683 }, 682 },
684 683
685 //--------立即购买时,选择自提和物流---------- 684 //--------立即购买时,选择自提和物流----------
686 - setexptype:function(t){  
687 - var th=this;  
688 - var ty = t.currentTarget.dataset.t;  
689 - th.setData({ bn_exp_type:ty});  
690 - //当物流为空的时候。  
691 - if (ty == 0 && th.data.wu_arr==null){  
692 - return th.get_wuliu(th.calculatePrice2());  
693 - }  
694 - th.calculatePrice2()  
695 - console.log('setexptype');  
696 - },  
697 -  
698 - //--------立即购买时,使用余额--------  
699 - set_bn_useyuer:function(){  
700 - var th=this;  
701 - th.setData({ bn_use_money: !th.data.bn_use_money});  
702 - th.calculatePrice2();  
703 - },  
704 - set_js_useyuer:function(){  
705 - var th = this;  
706 - th.setData({ js_use_money: !th.data.js_use_money });  
707 - th.calculatePrice();  
708 - },  
709 -  
710 - //-------------------计算物流---------------  
711 - calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight,  
712 - goods_piece,user_addr, freight_free, o_price, rs){  
713 - var price =0,th=this;  
714 - price +=parseFloat(o_shipping_price);  
715 - //如果是包邮  
716 - if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;}  
717 - if (user_addr==null) { return 0; }  
718 - //计算物流的config item;  
719 - var item=null;  
720 - //先根据 镇 县 区找计算的config  
721 - item = th.get_wuliu_config(user_addr.district,code,rs);  
722 - if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);  
723 - if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);  
724 - if (item == null) item = th.get_wuliu_default(code,rs);  
725 - if (item == null) return o_shipping_price;  
726 - var fw_price = 0, fp_price=0;  
727 - item=item.config;  
728 - if (item == null) return o_shipping_price;  
729 - //------按重量----------  
730 - if (goods_weight >= 0 && item['money']) {  
731 - fw_price =parseFloat(item['money']);  
732 - if (goods_weight > item['first_weight']){  
733 - var fw = goods_weight - item['first_weight'];  
734 - var n = Math.ceil(fw/item['second_weight'])  
735 - fw_price = fw_price + n * parseFloat(item['add_money']);  
736 - }  
737 - }  
738 - //------超出重量----------  
739 - if(out_of_weight < 0 && o_price >= freight_free){  
740 - fw_price = parseFloat(item['money']);  
741 - var out_of_weight = Math.abs(out_of_weight);  
742 - if (out_of_weight > item['first_weight']) {  
743 - var fw = out_of_weight - item['first_weight'];  
744 - var n = Math.ceil(fw / item['second_weight'])  
745 - fw_price = fw_price + n * parseFloat(item['add_money']); 685 + setexptype: function (t) {
  686 + var th = this;
  687 + var ty = t.currentTarget.dataset.t;
  688 + th.setData({ bn_exp_type: ty });
  689 + //当物流为空的时候。
  690 + if (ty == 0 && th.data.wu_arr == null) {
  691 + return th.get_wuliu(th.calculatePrice2());
746 } 692 }
747 - }  
748 - //------按件数----------  
749 - if (goods_piece > 0) {  
750 - fp_price = parseFloat(item['piecemoney']);  
751 - if (goods_piece > item['first_piece']) {  
752 - var fp = goods_piece - item['first_piece'];  
753 - var m = Math.ceil(fp / item['second_piece'])  
754 - fp_price = fp_price + m * parseFloat(item['add_piecemoney']);  
755 - }  
756 - }  
757 - var rspice =parseFloat(price + fw_price + fp_price);  
758 - return rspice;  
759 - },  
760 -  
761 - //------------循环获取config-----------  
762 - get_wuliu_config:function(region_id,code,rs){  
763 - var item=null,rslist = rs.pageData;  
764 - for (var i = 0; i < rslist.length;i++){  
765 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];}  
766 - }  
767 - return item;  
768 - },  
769 - //-------循环获取config,code default-------  
770 - get_wuliu_default: function (code, rs) {  
771 - var item = null, rslist=rs.pageData;  
772 - for (var i = 0; i < rslist.length; i++) {  
773 - if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }  
774 - }  
775 - return item;  
776 - },  
777 -  
778 - //----------立即购买,选择物流-------------  
779 - bindPickerChange:function(e){  
780 - var ind = e.detail.value  
781 - this.setData({ index: ind });  
782 - this.calculatePrice2();  
783 - },  
784 -  
785 - //----------购物车结算,选择物流-------------  
786 - bindPickerChange_w: function (e) {  
787 - var ind=e.detail.value, txt = e.currentTarget.dataset.txt; 693 + th.calculatePrice2()
  694 + console.log('setexptype');
  695 + },
  696 +
  697 + //--------立即购买时,使用余额--------
  698 + set_bn_useyuer: function () {
  699 + var th = this;
  700 + th.setData({ bn_use_money: !th.data.bn_use_money });
  701 + th.calculatePrice2();
  702 + },
  703 + set_js_useyuer: function () {
  704 + var th = this;
  705 + th.setData({ js_use_money: !th.data.js_use_money });
  706 + th.calculatePrice();
  707 + },
  708 +
  709 + //-------------------计算物流---------------
  710 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  711 + goods_piece, user_addr, freight_free, o_price, rs) {
  712 + var price = 0, th = this;
  713 + price += parseFloat(o_shipping_price);
  714 + //如果是包邮
  715 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; }
  716 + if (user_addr == null) { return 0; }
  717 + //计算物流的config item;
  718 + var item = null;
  719 + //先根据 镇 县 区找计算的config
  720 + item = th.get_wuliu_config(user_addr.district, code, rs);
  721 + if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs);
  722 + if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs);
  723 + if (item == null) item = th.get_wuliu_default(code, rs);
  724 + if (item == null) return o_shipping_price;
  725 + var fw_price = 0, fp_price = 0;
  726 + item = item.config;
  727 + if (item == null) return o_shipping_price;
  728 + //------按重量----------
  729 + if (goods_weight >= 0 && item['money']) {
  730 + fw_price = parseFloat(item['money']);
  731 + if (goods_weight > item['first_weight']) {
  732 + var fw = goods_weight - item['first_weight'];
  733 + var n = Math.ceil(fw / item['second_weight'])
  734 + fw_price = fw_price + n * parseFloat(item['add_money']);
  735 + }
  736 + }
  737 + //------超出重量----------
  738 + if (out_of_weight < 0 && o_price >= freight_free) {
  739 + fw_price = parseFloat(item['money']);
  740 + var out_of_weight = Math.abs(out_of_weight);
  741 + if (out_of_weight > item['first_weight']) {
  742 + var fw = out_of_weight - item['first_weight'];
  743 + var n = Math.ceil(fw / item['second_weight'])
  744 + fw_price = fw_price + n * parseFloat(item['add_money']);
  745 + }
  746 + }
  747 + //------按件数----------
  748 + if (goods_piece > 0) {
  749 + fp_price = parseFloat(item['piecemoney']);
  750 + if (goods_piece > item['first_piece']) {
  751 + var fp = goods_piece - item['first_piece'];
  752 + var m = Math.ceil(fp / item['second_piece'])
  753 + fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
  754 + }
  755 + }
  756 + var rspice = parseFloat(price + fw_price + fp_price);
  757 + return rspice;
  758 + },
  759 +
  760 + //------------循环获取config-----------
  761 + get_wuliu_config: function (region_id, code, rs) {
  762 + var item = null, rslist = rs.pageData;
  763 + for (var i = 0; i < rslist.length; i++) {
  764 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }
  765 + }
  766 + return item;
  767 + },
  768 + //-------循环获取config,code default-------
  769 + get_wuliu_default: function (code, rs) {
  770 + var item = null, rslist = rs.pageData;
  771 + for (var i = 0; i < rslist.length; i++) {
  772 + if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
  773 + }
  774 + return item;
  775 + },
  776 +
  777 + //----------立即购买,选择物流-------------
  778 + bindPickerChange: function (e) {
  779 + var ind = e.detail.value
  780 + this.setData({ index: ind });
  781 + this.calculatePrice2();
  782 + },
  783 +
  784 + //----------购物车结算,选择物流-------------
  785 + bindPickerChange_w: function (e) {
  786 + var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
788 this.setData({ [txt]: ind }); 787 this.setData({ [txt]: ind });
789 this.calculatePrice(); 788 this.calculatePrice();
790 - },  
791 -  
792 - cart_set_err: function (e) {  
793 - var txt = e.currentTarget.dataset.err;  
794 - var ob = {};  
795 - ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";  
796 - this.setData(ob);  
797 - }, 789 + },
  790 +
  791 + cart_set_err: function (e) {
  792 + var txt = e.currentTarget.dataset.err;
  793 + var ob = {};
  794 + ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
  795 + this.setData(ob);
  796 + },
798 797
799 //// 开启物流的弹窗 798 //// 开启物流的弹窗
800 - show_wu_arr:function(e){  
801 - this.setData({ open_express: 1}); 799 + show_wu_arr: function (e) {
  800 + this.setData({ open_express: 1 });
802 }, 801 },
803 802
804 //更新下默认,在onshow里面 803 //更新下默认,在onshow里面
805 - update_code(){  
806 - var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code; 804 + update_code() {
  805 + var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
807 806
808 - var uii=setInterval(function () {  
809 - if(th.data.wu_arr){  
810 - clearInterval(uii); 807 + var uii = setInterval(function () {
  808 + if (th.data.wu_arr) {
  809 + clearInterval(uii);
811 for (var k = 0; k < th.data.wu_arr.length; k++) { 810 for (var k = 0; k < th.data.wu_arr.length; k++) {
812 var item = th.data.wu_arr[k]; 811 var item = th.data.wu_arr[k];
813 if (def_exp_code == item.code) { 812 if (def_exp_code == item.code) {
@@ -815,37 +814,37 @@ Page({ @@ -815,37 +814,37 @@ Page({
815 } 814 }
816 } 815 }
817 //--如果是立即购买-- 816 //--如果是立即购买--
818 - th.setData({ index: m_wind, is_express: m_wind}); 817 + th.setData({ index: m_wind, is_express: m_wind });
819 } 818 }
820 - },500) 819 + }, 500)
821 }, 820 },
822 821
823 // 关闭物流的弹窗 822 // 关闭物流的弹窗
824 - close_express:function(){  
825 - this.setData({ open_express:0 }); 823 + close_express: function () {
  824 + this.setData({ open_express: 0 });
826 }, 825 },
827 // 选择物流 826 // 选择物流
828 - click_express_name:function(e){ 827 + click_express_name: function (e) {
829 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; 828 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
830 - var index=e.currentTarget.dataset.idxe;  
831 - var ob={ is_express: index, is_shipping_code: shippingcode,index:index}; 829 + var index = e.currentTarget.dataset.idxe;
  830 + var ob = { is_express: index, is_shipping_code: shippingcode, index: index };
832 this.setData(ob); 831 this.setData(ob);
833 }, 832 },
834 833
835 //点击确定物流 834 //点击确定物流
836 - determine_expres:function(e){  
837 - this.setData({ open_express: 0}); 835 + determine_expres: function (e) {
  836 + this.setData({ open_express: 0 });
838 this.calculatePrice2(); 837 this.calculatePrice2();
839 }, 838 },
840 //设置默认物流 839 //设置默认物流
841 select_default_logistics: function () { 840 select_default_logistics: function () {
842 - var th=this;  
843 - var is_shipping_code=this.data.is_shipping_code  
844 - getApp().request.put("/api/weshop/users/update",{  
845 - data: { user_id: getApp().globalData.user_id, store_id: os.stoid, def_exp_code: is_shipping_code},  
846 - success:function(rse){  
847 - if (rse.data.code==0){  
848 - getApp().globalData.userInfo.def_exp_code=is_shipping_code; 841 + var th = this;
  842 + var is_shipping_code = this.data.is_shipping_code
  843 + getApp().request.put("/api/weshop/users/update", {
  844 + data: { user_id: getApp().globalData.user_id, store_id: os.stoid, def_exp_code: is_shipping_code },
  845 + success: function (rse) {
  846 + if (rse.data.code == 0) {
  847 + getApp().globalData.userInfo.def_exp_code = is_shipping_code;
849 th.setData({ open_express: 0 }); 848 th.setData({ open_express: 0 });
850 //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19---- 849 //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----
851 //if(th.data.is_b_now==1) th.calculatePrice2(); 850 //if(th.data.is_b_now==1) th.calculatePrice2();
@@ -858,14 +857,14 @@ Page({ @@ -858,14 +857,14 @@ Page({
858 857
859 858
860 //跳转到购买卡 859 //跳转到购买卡
861 - buycard:function(){  
862 - getApp().goto("/pages/user/plus/plus");  
863 - getApp().globalData.plus_buy_back=1;  
864 - },  
865 -  
866 - switchChange:function (e) {  
867 - console.log(e,111);  
868 - this.setData({agree_no_ref:e.detail.value}); 860 + buycard: function () {
  861 + getApp().goto("/pages/user/plus/plus");
  862 + getApp().globalData.plus_buy_back = 1;
  863 + },
  864 +
  865 + switchChange: function (e) {
  866 + console.log(e, 111);
  867 + this.setData({ agree_no_ref: e.detail.value });
869 } 868 }
870 - 869 +
871 }); 870 });
pages/cart/cart/cart.wxml
@@ -41,7 +41,8 @@ @@ -41,7 +41,8 @@
41 <!-- 编辑 --> 41 <!-- 编辑 -->
42 <view class="padding flex-vertical-between fs30 Storenum store" style="justify-content:space-between"> 42 <view class="padding flex-vertical-between fs30 Storenum store" style="justify-content:space-between">
43 <view wx:if="{{freight_free}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free"> 43 <view wx:if="{{freight_free}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
44 - <text>全场满{{freight_free}}元可享包邮({{weight_free}}kg内)</text> 44 + <text wx:if="{{weight_free <=0}}">全场满{{freight_free}}元可享包邮</text>
  45 + <text wx:else>全场满{{freight_free}}元可享包邮({{weight_free}}kg内)</text>
45 </view> 46 </view>
46 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view> 47 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view>
47 <view wx:else bindtap="edit_cart" data-type="0">完成</view> 48 <view wx:else bindtap="edit_cart" data-type="0">完成</view>
pages/cart/cart2/cart2.js
@@ -123,46 +123,47 @@ Page({ @@ -123,46 +123,47 @@ Page({
123 tabs: ['门店自提', '快递邮寄'], 123 tabs: ['门店自提', '快递邮寄'],
124 currentTabIndex: 1, 124 currentTabIndex: 1,
125 125
126 - in_zhact_gdmap:{}, //不同门店参与同一活动的限购  
127 - hid_inp:1,  
128 - user_note:"",  
129 - zhhe_act_map:{}, //组合活动的map表  
130 - zuhe_map_good:{}, //组合购的map表  
131 - ladder_map:{}, //阶梯促销的map表  
132 -  
133 - state:0, //阶梯促销的的立即购买也走购物车流程state=1 126 + in_zhact_gdmap: {}, //不同门店参与同一活动的限购
  127 + hid_inp: 1,
  128 + user_note: "",
  129 + zhhe_act_map: {}, //组合活动的map表
  130 + zuhe_map_good: {}, //组合购的map表
  131 + ladder_map: {}, //阶梯促销的map表
  132 + is_no_past: 1,
  133 + state: 0, //阶梯促销的的立即购买也走购物车流程state=1
134 }, 134 },
135 onLoad: function (t) { 135 onLoad: function (t) {
136 - wx.setNavigationBarTitle({title: "填写订单",}) 136 + wx.setNavigationBarTitle({ title: "填写订单", })
137 var th = this; 137 var th = this;
138 - this.setData({is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); 138 + this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, });
139 th.data.param = t; 139 th.data.param = t;
140 //清理一下,确保最新的系统配置 140 //清理一下,确保最新的系统配置
141 getApp().globalData.config2 = null; 141 getApp().globalData.config2 = null;
142 //清空is_pick_up 142 //清空is_pick_up
143 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 143 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
144 - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, 144 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
145 success: function (s) { 145 success: function (s) {
146 } 146 }
147 }); 147 });
148 148
149 //阶梯购 或者 组合购的立即购买 149 //阶梯购 或者 组合购的立即购买
150 - if(t.state){  
151 - th.data.state=1; 150 + if (t.state) {
  151 + th.data.state = 1;
152 } 152 }
153 getApp().promiseGet("/api/wx/weappSendlist/page", { 153 getApp().promiseGet("/api/wx/weappSendlist/page", {
154 data: { 154 data: {
155 store_id: os.stoid, 155 store_id: os.stoid,
156 typeid: "1001" 156 typeid: "1001"
157 - }}).then(res=>{ 157 + }
  158 + }).then(res => {
158 if (res.data.code == 0 && res.data.data.pageData.length > 0) { 159 if (res.data.code == 0 && res.data.data.pageData.length > 0) {
159 var template_id = res.data.data.pageData[0].template_id; 160 var template_id = res.data.data.pageData[0].template_id;
160 - th.setData({template_id:template_id}); 161 + th.setData({ template_id: template_id });
161 } 162 }
162 }) 163 })
163 }, 164 },
164 onUnload: function () { 165 onUnload: function () {
165 - this.setData({isclose: 1}) 166 + this.setData({ isclose: 1 })
166 }, 167 },
167 onHide: function () { 168 onHide: function () {
168 this.setData({ 169 this.setData({
@@ -175,7 +176,7 @@ Page({ @@ -175,7 +176,7 @@ Page({
175 //----------子页返回父页触发---------- 176 //----------子页返回父页触发----------
176 onShow: function () { 177 onShow: function () {
177 var th = this; 178 var th = this;
178 - th.setData({show_submit: 0}); //让提交先掩藏 179 + th.setData({ show_submit: 0 }); //让提交先掩藏
179 th.data.g_cart_q_time = null; 180 th.data.g_cart_q_time = null;
180 181
181 if (th.data.isclose == 0) { 182 if (th.data.isclose == 0) {
@@ -208,20 +209,20 @@ Page({ @@ -208,20 +209,20 @@ Page({
208 th.data.is_summit_ing = 0; 209 th.data.is_summit_ing = 0;
209 //更换地址回来要重新调用计算价钱的接口 210 //更换地址回来要重新调用计算价钱的接口
210 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { 211 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
211 - th.setData({user_addr: ie}); 212 + th.setData({ user_addr: ie });
212 if (th.data.is_b_now == 1) { 213 if (th.data.is_b_now == 1) {
213 if (th.data.bn_goods) { 214 if (th.data.bn_goods) {
214 - th.setData({add_back: 1}); 215 + th.setData({ add_back: 1 });
215 //th.calculatePrice2(); 216 //th.calculatePrice2();
216 } 217 }
217 } else { 218 } else {
218 if (th.data.cartlist) { 219 if (th.data.cartlist) {
219 - th.setData({add_back: 1}); 220 + th.setData({ add_back: 1 });
220 //th.calculatePrice(); 221 //th.calculatePrice();
221 } 222 }
222 } 223 }
223 } else { 224 } else {
224 - th.setData({user_addr: ie}); 225 + th.setData({ user_addr: ie });
225 } 226 }
226 var going = 0; 227 var going = 0;
227 228
@@ -275,34 +276,34 @@ Page({ @@ -275,34 +276,34 @@ Page({
275 //-- 获取所有的等级卡, -- 276 //-- 获取所有的等级卡, --
276 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, 277 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
277 {}).then(res => { 278 {}).then(res => {
278 - if (res.data.code == 0) {  
279 - var plusCard = res.data.data;  
280 - //-- 循环判断,拿到最贵的那张卡 --  
281 - for (var ih in plusCard) {  
282 - if (plusCard[ih].IsStopBuy == true) {  
283 - continue;  
284 - }  
285 - if (max_price < 0) {  
286 - max_price = plusCard[ih].CardFee;  
287 - name = 'card' + plusCard[ih]['CorrPrice'];  
288 - show_card = plusCard[ih];  
289 - } else {  
290 - if (max_price < plusCard[ih].CardFee) { 279 + if (res.data.code == 0) {
  280 + var plusCard = res.data.data;
  281 + //-- 循环判断,拿到最贵的那张卡 --
  282 + for (var ih in plusCard) {
  283 + if (plusCard[ih].IsStopBuy == true) {
  284 + continue;
  285 + }
  286 + if (max_price < 0) {
291 max_price = plusCard[ih].CardFee; 287 max_price = plusCard[ih].CardFee;
292 name = 'card' + plusCard[ih]['CorrPrice']; 288 name = 'card' + plusCard[ih]['CorrPrice'];
293 show_card = plusCard[ih]; 289 show_card = plusCard[ih];
  290 + } else {
  291 + if (max_price < plusCard[ih].CardFee) {
  292 + max_price = plusCard[ih].CardFee;
  293 + name = 'card' + plusCard[ih]['CorrPrice'];
  294 + show_card = plusCard[ih];
  295 + }
294 } 296 }
295 } 297 }
296 - }  
297 298
298 - if (show_card) {  
299 - name = name.toLowerCase();  
300 - th.setData({card_name: name, show_card: show_card}) 299 + if (show_card) {
  300 + name = name.toLowerCase();
  301 + th.setData({ card_name: name, show_card: show_card })
  302 + }
301 } 303 }
302 - }  
303 - //-----先获取物流,再获取用户信息,再展示页面-----  
304 - th.get_wuliu(th.get_info(th.show_page));  
305 - }) 304 + //-----先获取物流,再获取用户信息,再展示页面-----
  305 + th.get_wuliu(th.get_info(th.show_page));
  306 + })
306 } else { 307 } else {
307 //-----先获取物流,再获取用户信息,再展示页面----- 308 //-----先获取物流,再获取用户信息,再展示页面-----
308 th.get_wuliu(th.get_info(th.show_page)); 309 th.get_wuliu(th.get_info(th.show_page));
@@ -321,10 +322,10 @@ Page({ @@ -321,10 +322,10 @@ Page({
321 if (th.data.is_default_logistics) { 322 if (th.data.is_default_logistics) {
322 //如果第一个不是开启默认,说明要让用户自己选 323 //如果第一个不是开启默认,说明要让用户自己选
323 if (!e[0].is_default) { 324 if (!e[0].is_default) {
324 - th.setData({is_default_logistics: 0}); 325 + th.setData({ is_default_logistics: 0 });
325 } 326 }
326 } 327 }
327 - th.setData({wu_arr: e}) 328 + th.setData({ wu_arr: e })
328 typeof func == "function" && func(); 329 typeof func == "function" && func();
329 }) 330 })
330 }, 331 },
@@ -338,7 +339,7 @@ Page({ @@ -338,7 +339,7 @@ Page({
338 getuser_addr: function (func) { 339 getuser_addr: function (func) {
339 var th = this; 340 var th = this;
340 a.get("/api/weshop/useraddress/page", { 341 a.get("/api/weshop/useraddress/page", {
341 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, 342 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() },
342 success: function (su) { 343 success: function (su) {
343 /*--- 344 /*---
344 var user_addr=[ 345 var user_addr=[
@@ -363,7 +364,7 @@ Page({ @@ -363,7 +364,7 @@ Page({
363 } 364 }
364 365
365 if (item == undefined) item = null; 366 if (item == undefined) item = null;
366 - if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 367 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存
367 368
368 func(item); 369 func(item);
369 } 370 }
@@ -378,19 +379,19 @@ Page({ @@ -378,19 +379,19 @@ Page({
378 //会员的信息,要获取最新 379 //会员的信息,要获取最新
379 var user = getApp().globalData.userInfo; 380 var user = getApp().globalData.userInfo;
380 getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { 381 getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
381 - data: {r: Math.random()}, 382 + data: { r: Math.random() },
382 success: function (e) { 383 success: function (e) {
383 getApp().globalData.userInfo = e.data.data; 384 getApp().globalData.userInfo = e.data.data;
384 - th.setData({userinfo: e.data.data}); 385 + th.setData({ userinfo: e.data.data });
385 386
386 //选获取地址 387 //选获取地址
387 th.getuser_addr(function (addr) { 388 th.getuser_addr(function (addr) {
388 - th.setData({user_addr: addr}); 389 + th.setData({ user_addr: addr });
389 //--------------------------立即购买------------------ 390 //--------------------------立即购买------------------
390 if (ta.is_bnow == 1) { 391 if (ta.is_bnow == 1) {
391 //读取门店 392 //读取门店
392 to.get_allsto(function (e) { 393 to.get_allsto(function (e) {
393 - th.setData({allsto: e}); 394 + th.setData({ allsto: e });
394 //获取立即购买的商品信息 395 //获取立即购买的商品信息
395 th.get_buy_goods(ta.goods_id); 396 th.get_buy_goods(ta.goods_id);
396 }); 397 });
@@ -398,7 +399,7 @@ Page({ @@ -398,7 +399,7 @@ Page({
398 //------------------------购物车结算---------------------- 399 //------------------------购物车结算----------------------
399 //读取门店 400 //读取门店
400 to.get_allsto(function (e) { 401 to.get_allsto(function (e) {
401 - th.setData({allsto: e}); 402 + th.setData({ allsto: e });
402 //-------获取购物车已经选择的商品-------- 403 //-------获取购物车已经选择的商品--------
403 th.get_cart(); 404 th.get_cart();
404 }) 405 })
@@ -407,12 +408,12 @@ Page({ @@ -407,12 +408,12 @@ Page({
407 408
408 //获取提现金额 409 //获取提现金额
409 getApp().request.get("/api/weshop/withdrawals/summoney", { 410 getApp().request.get("/api/weshop/withdrawals/summoney", {
410 - data: {user_id: to.globalData.user_id, store_id: oo.stoid, status: 0}, 411 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
411 success: function (su) { 412 success: function (su) {
412 if (su.data.code == 0) { 413 if (su.data.code == 0) {
413 var yuer = parseFloat(th.data.userinfo.user_money - 414 var yuer = parseFloat(th.data.userinfo.user_money -
414 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); 415 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
415 - th.setData({txmon: su.data.data.summoney, yuer: yuer}); 416 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
416 } 417 }
417 } 418 }
418 }); 419 });
@@ -426,8 +427,8 @@ Page({ @@ -426,8 +427,8 @@ Page({
426 //-----真的获取购物车,入口-------- 427 //-----真的获取购物车,入口--------
427 get_cart: function () { 428 get_cart: function () {
428 var th = this, app = getApp(); 429 var th = this, app = getApp();
429 - var state=0;  
430 - if(th.data.state) state=1; 430 + var state = 0;
  431 + if (th.data.state) state = 1;
431 a.get("/api/weshop/cart/list", { 432 a.get("/api/weshop/cart/list", {
432 data: { 433 data: {
433 user_id: to.globalData.user_id, selected: 1, state: state, 434 user_id: to.globalData.user_id, selected: 1, state: state,
@@ -438,7 +439,7 @@ Page({ @@ -438,7 +439,7 @@ Page({
438 var arr = new Array(); 439 var arr = new Array();
439 var carr = su.data.data.pageData; 440 var carr = su.data.data.pageData;
440 th.data.cartlist_y = carr; //存储原始购物车列表 441 th.data.cartlist_y = carr; //存储原始购物车列表
441 - th.data.in_zhact_gdmap={}; 442 + th.data.in_zhact_gdmap = {};
442 443
443 //---是不是购买等级卡成功的返回---等级卡显示的判断--- 444 //---是不是购买等级卡成功的返回---等级卡显示的判断---
444 var is_card_back = getApp().globalData.is_card_back; 445 var is_card_back = getApp().globalData.is_card_back;
@@ -447,7 +448,7 @@ Page({ @@ -447,7 +448,7 @@ Page({
447 var item1 = carr[i]; 448 var item1 = carr[i];
448 //把已经购买了多少见的内容填入 449 //把已经购买了多少见的内容填入
449 450
450 - var goodsbuynum=0,promgoodsbuynum=0; 451 + var goodsbuynum = 0, promgoodsbuynum = 0;
451 //--要获得商品,该用户买了多少件,同步应用-- 452 //--要获得商品,该用户买了多少件,同步应用--
452 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { 453 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
453 data: { 454 data: {
@@ -465,7 +466,7 @@ Page({ @@ -465,7 +466,7 @@ Page({
465 goodsbuynum = buy_num_data.goodsbuynum; 466 goodsbuynum = buy_num_data.goodsbuynum;
466 }) 467 })
467 //如果有购买活动 468 //如果有购买活动
468 - item1.promgoodsbuynum=promgoodsbuynum; 469 + item1.promgoodsbuynum = promgoodsbuynum;
469 470
470 //要把优惠活动加入,prom_goods_map中,赠品不要运算 471 //要把优惠活动加入,prom_goods_map中,赠品不要运算
471 if (item1.prom_type == 3 && item1.is_gift != 1) { 472 if (item1.prom_type == 3 && item1.is_gift != 1) {
@@ -473,8 +474,8 @@ Page({ @@ -473,8 +474,8 @@ Page({
473 } 474 }
474 475
475 //要把组合购的东西拿出来算一下 476 //要把组合购的东西拿出来算一下
476 - if(item1.prom_type == 7) {  
477 - if(!th.data.zuhe_map_good[item1.prom_id]) { 477 + if (item1.prom_type == 7) {
  478 + if (!th.data.zuhe_map_good[item1.prom_id]) {
478 var isok = 1; 479 var isok = 1;
479 var is_flag = 1; 480 var is_flag = 1;
480 //如果有组合购 481 //如果有组合购
@@ -523,50 +524,49 @@ Page({ @@ -523,50 +524,49 @@ Page({
523 } 524 }
524 }) 525 })
525 } 526 }
526 - else  
527 - {  
528 - item1.act = th.data.zhhe_act_map[item1.prom_id]; 527 + else {
  528 + item1.act = th.data.zhhe_act_map[item1.prom_id];
529 } 529 }
530 } 530 }
531 - if(item1.prom_type==10){  
532 - if(!th.data.ladder_map[item1.prom_id]){ 531 + if (item1.prom_type == 10) {
  532 + if (!th.data.ladder_map[item1.prom_id]) {
533 //如果有组合购 533 //如果有组合购
534 var isok = 1; 534 var isok = 1;
535 - var is_flag=1;  
536 - var act=null;  
537 - var url="/api/weshop/prom/ladderForm/get/"+os.stoid+"/"+item1.prom_id; 535 + var is_flag = 1;
  536 + var act = null;
  537 + var url = "/api/weshop/prom/ladderForm/get/" + os.stoid + "/" + item1.prom_id;
538 await getApp().request.promiseGet(url, {}).then(res => { 538 await getApp().request.promiseGet(url, {}).then(res => {
539 - console.log(res,1000);  
540 - if(res.data.code==0 && res.data.data){  
541 - if(res.data.data.isuse!=1){  
542 - isok=0; 539 + console.log(res, 1000);
  540 + if (res.data.code == 0 && res.data.data) {
  541 + if (res.data.data.isuse != 1) {
  542 + isok = 0;
543 } 543 }
544 //如果活动已经结束 544 //如果活动已经结束
545 - if(res.data.data.is_end==1){  
546 - isok=0; 545 + if (res.data.data.is_end == 1) {
  546 + isok = 0;
547 } 547 }
548 //已经结束 548 //已经结束
549 - if(ut.gettimestamp()>res.data.data.end_time){  
550 - isok=0; 549 + if (ut.gettimestamp() > res.data.data.end_time) {
  550 + isok = 0;
551 } 551 }
552 //还未开始 552 //还未开始
553 - if(ut.gettimestamp()<res.data.data.start_time){  
554 - isok=0; 553 + if (ut.gettimestamp() < res.data.data.start_time) {
  554 + isok = 0;
555 } 555 }
556 - act=res.data.data; 556 + act = res.data.data;
557 557
558 - }else{ 558 + } else {
559 //未找到商品的活动 559 //未找到商品的活动
560 is_flag = 0; 560 is_flag = 0;
561 } 561 }
562 }) 562 })
563 - if (!isok){ 563 + if (!isok) {
564 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; 564 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
565 getApp().request.delete(url, {}); 565 getApp().request.delete(url, {});
566 - th.data.ladder_map[item1.prom_id]=-1; 566 + th.data.ladder_map[item1.prom_id] = -1;
567 continue; 567 continue;
568 } 568 }
569 - th.data.ladder_map[item1.prom_id]=act; 569 + th.data.ladder_map[item1.prom_id] = act;
570 570
571 //-- 获取阶梯规则 -- 571 //-- 获取阶梯规则 --
572 var url1 = "/api/weshop/prom/ladderList/list"; 572 var url1 = "/api/weshop/prom/ladderList/list";
@@ -577,9 +577,9 @@ Page({ @@ -577,9 +577,9 @@ Page({
577 await getApp().request.promiseGet(url1, { 577 await getApp().request.promiseGet(url1, {
578 data: req_data 578 data: req_data
579 }).then(rs1 => { 579 }).then(rs1 => {
580 - if (rs1.data.code==0 && rs1.data.data) { 580 + if (rs1.data.code == 0 && rs1.data.data) {
581 var gdlist = rs1.data.data; 581 var gdlist = rs1.data.data;
582 - th.data.ladder_map[item1.prom_id].ladder_list=gdlist; 582 + th.data.ladder_map[item1.prom_id].ladder_list = gdlist;
583 } 583 }
584 }) 584 })
585 } 585 }
@@ -616,7 +616,7 @@ Page({ @@ -616,7 +616,7 @@ Page({
616 616
617 item.original_img = oo.imghost + item.original_img; 617 item.original_img = oo.imghost + item.original_img;
618 618
619 - var car_item=item; 619 + var car_item = item;
620 /*----接口要弄出来的,先顶着-----*/ 620 /*----接口要弄出来的,先顶着-----*/
621 var pcid = car_item.pick_id; 621 var pcid = car_item.pick_id;
622 var find = 0; 622 var find = 0;
@@ -625,7 +625,7 @@ Page({ @@ -625,7 +625,7 @@ Page({
625 if (arr.length > 0) { 625 if (arr.length > 0) {
626 for (var j = 0; j < arr.length; j++) { 626 for (var j = 0; j < arr.length; j++) {
627 if (arr[j].pickup_id == pcid) { 627 if (arr[j].pickup_id == pcid) {
628 - if(item.is_gift!=1){ 628 + if (item.is_gift != 1) {
629 //确定配送方式 629 //确定配送方式
630 if (arr[j].distr_t == 0) { 630 if (arr[j].distr_t == 0) {
631 arr[j].distr_t = car_item.distr_type; 631 arr[j].distr_t = car_item.distr_type;
@@ -644,8 +644,8 @@ Page({ @@ -644,8 +644,8 @@ Page({
644 break; 644 break;
645 } 645 }
646 arr[j].exp_type = e_t; 646 arr[j].exp_type = e_t;
647 - if (e_t == 0) th.setData({is_all_zt: 0});  
648 - else if(e_t==1) th.setData({is_all_zt: 1}); 647 + if (e_t == 0) th.setData({ is_all_zt: 0 });
  648 + else if (e_t == 1) th.setData({ is_all_zt: 1 });
649 } 649 }
650 650
651 //-- 把等级卡会优惠多少钱装进去 -- 651 //-- 把等级卡会优惠多少钱装进去 --
@@ -688,8 +688,8 @@ Page({ @@ -688,8 +688,8 @@ Page({
688 break; 688 break;
689 } 689 }
690 //如果是物流的话,全部自提的控制要弄成0 690 //如果是物流的话,全部自提的控制要弄成0
691 - if (e_t == 0) th.setData({is_all_zt: 0});  
692 - else th.setData({is_all_zt: 1}); 691 + if (e_t == 0) th.setData({ is_all_zt: 0 });
  692 + else th.setData({ is_all_zt: 1 });
693 693
694 var narr = new Array(); 694 var narr = new Array();
695 narr.push(car_item); 695 narr.push(car_item);
@@ -748,11 +748,11 @@ Page({ @@ -748,11 +748,11 @@ Page({
748 var offline_price = 0; 748 var offline_price = 0;
749 var offline_num = 0; 749 var offline_num = 0;
750 for (var c = 0; c < item.length; c++) { 750 for (var c = 0; c < item.length; c++) {
751 - if(th.data.sales_rules!=2){  
752 - item[c].offline_price=0; 751 + if (th.data.sales_rules != 2) {
  752 + item[c].offline_price = 0;
753 } 753 }
754 //-- 如果这个商品是线下取价的时候 -- 754 //-- 如果这个商品是线下取价的时候 --
755 - if (item[c].offline_price > 0 && item[c].prom_type != 7 ) { 755 + if (item[c].offline_price > 0 && item[c].prom_type != 7) {
756 offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num; 756 offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num;
757 offline_num += item[c].goods_num; 757 offline_num += item[c].goods_num;
758 } 758 }
@@ -778,7 +778,7 @@ Page({ @@ -778,7 +778,7 @@ Page({
778 var h_item = obj[var1]; 778 var h_item = obj[var1];
779 var gdlist = th.data.zuhe_map_good[h_item.prom_id]; 779 var gdlist = th.data.zuhe_map_good[h_item.prom_id];
780 //获取活动需要的商品列表 780 //获取活动需要的商品列表
781 - u_item.zh_prom_goods[h_item.prom_id] = {gdlist: gdlist, act: h_item.act}; 781 + u_item.zh_prom_goods[h_item.prom_id] = { gdlist: gdlist, act: h_item.act };
782 } 782 }
783 zh_calc.fir_set_arr(u_item, th); 783 zh_calc.fir_set_arr(u_item, th);
784 } 784 }
@@ -792,10 +792,10 @@ Page({ @@ -792,10 +792,10 @@ Page({
792 //存储不同阶梯促销活动的商品列表 792 //存储不同阶梯促销活动的商品列表
793 u_item.ladder_map = {}; 793 u_item.ladder_map = {};
794 for (let var1 in obj) { 794 for (let var1 in obj) {
795 - var h_item=obj[var1];  
796 - var act= th.data.ladder_map[h_item.prom_id]; 795 + var h_item = obj[var1];
  796 + var act = th.data.ladder_map[h_item.prom_id];
797 //获取活动需要的商品列表 797 //获取活动需要的商品列表
798 - u_item.ladder_map[h_item.prom_id] =act; 798 + u_item.ladder_map[h_item.prom_id] = act;
799 } 799 }
800 ladder_calc.fir_set_arr(u_item, th); 800 ladder_calc.fir_set_arr(u_item, th);
801 } 801 }
@@ -809,7 +809,7 @@ Page({ @@ -809,7 +809,7 @@ Page({
809 setTimeout(function () { 809 setTimeout(function () {
810 var frozenQuan = null; 810 var frozenQuan = null;
811 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 811 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
812 - app.request.promiseGet(url0, {1: 1}).then(res => { 812 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
813 if (res.data.code == 0) { 813 if (res.data.code == 0) {
814 frozenQuan = res.data.data; 814 frozenQuan = res.data.data;
815 th.data.frozenQuan = frozenQuan; 815 th.data.frozenQuan = frozenQuan;
@@ -880,7 +880,7 @@ Page({ @@ -880,7 +880,7 @@ Page({
880 th.data.card_name = th.data.userinfo.card_field; 880 th.data.card_name = th.data.userinfo.card_field;
881 gg.goods_price = gd[th.data.card_name]; 881 gg.goods_price = gd[th.data.card_name];
882 getApp().globalData.is_card_back = 0; 882 getApp().globalData.is_card_back = 0;
883 - th.setData({card_cut_price: 0}); 883 + th.setData({ card_cut_price: 0 });
884 //如果是秒杀的返回 884 //如果是秒杀的返回
885 if (gd.prom_type == 1) gd.prom_type = 0; 885 if (gd.prom_type == 1) gd.prom_type = 0;
886 } else { 886 } else {
@@ -888,12 +888,12 @@ Page({ @@ -888,12 +888,12 @@ Page({
888 //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- 888 //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --
889 if (!gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) { 889 if (!gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {
890 var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num; 890 var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num;
891 - th.setData({card_cut_price: cut_p}); 891 + th.setData({ card_cut_price: cut_p });
892 } 892 }
893 } 893 }
894 894
895 - gd.prom_type=gg.prom_type?gg.prom_type:0;  
896 - gd.prom_id=gg.prom_id?gg.prom_id:0; 895 + gd.prom_type = gg.prom_type ? gg.prom_type : 0;
  896 + gd.prom_id = gg.prom_id ? gg.prom_id : 0;
897 897
898 switch (gd.prom_type) { 898 switch (gd.prom_type) {
899 case 0: 899 case 0:
@@ -956,7 +956,7 @@ Page({ @@ -956,7 +956,7 @@ Page({
956 ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式 956 ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式
957 ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额 957 ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额
958 958
959 - th.setData({buy_now_gift_goods: ob}); 959 + th.setData({ buy_now_gift_goods: ob });
960 } 960 }
961 } 961 }
962 962
@@ -990,7 +990,7 @@ Page({ @@ -990,7 +990,7 @@ Page({
990 t.data.data.guide_id = gg.guide_id; 990 t.data.data.guide_id = gg.guide_id;
991 t.data.data.guide_type = gg.guide_type; 991 t.data.data.guide_type = gg.guide_type;
992 } 992 }
993 - th.setData({collocation_goods: gg.collocation_goods}); 993 + th.setData({ collocation_goods: gg.collocation_goods });
994 994
995 var cart_arr = new Array(); 995 var cart_arr = new Array();
996 //var narr=gg.collocation_goods; 996 //var narr=gg.collocation_goods;
@@ -1003,9 +1003,9 @@ Page({ @@ -1003,9 +1003,9 @@ Page({
1003 et = 1; 1003 et = 1;
1004 distr_t = 0; // 配送方式 0=用户自选 1=自提 2=物流 1004 distr_t = 0; // 配送方式 0=用户自选 1=自提 2=物流
1005 for (var hi in narr) { 1005 for (var hi in narr) {
1006 - var dis_t = narr[hi].distr_type; 1006 + var dis_t = narr[hi].distr_type;
1007 if (dis_t == 2) { 1007 if (dis_t == 2) {
1008 - th.setData({is_all_zt: 0}); 1008 + th.setData({ is_all_zt: 0 });
1009 et = 0; 1009 et = 0;
1010 } 1010 }
1011 if (dis_t > 0) { 1011 if (dis_t > 0) {
@@ -1046,7 +1046,7 @@ Page({ @@ -1046,7 +1046,7 @@ Page({
1046 if (gg.prom_type == 5) { 1046 if (gg.prom_type == 5) {
1047 var frozenQuan = null; 1047 var frozenQuan = null;
1048 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 1048 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
1049 - app.request.promiseGet(url0, {1: 1}).then(res => { 1049 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
1050 if (res.data.code == 0) { 1050 if (res.data.code == 0) {
1051 frozenQuan = res.data.data; 1051 frozenQuan = res.data.data;
1052 th.data.frozenQuan = frozenQuan; 1052 th.data.frozenQuan = frozenQuan;
@@ -1056,7 +1056,7 @@ Page({ @@ -1056,7 +1056,7 @@ Page({
1056 th.get_cart_quan(); 1056 th.get_cart_quan();
1057 }); 1057 });
1058 1058
1059 - 1059 +
1060 1060
1061 } else { 1061 } else {
1062 //计算价格 1062 //计算价格
@@ -1070,13 +1070,13 @@ Page({ @@ -1070,13 +1070,13 @@ Page({
1070 case 1: //---秒杀----- 1070 case 1: //---秒杀-----
1071 var quanlist = null; 1071 var quanlist = null;
1072 getApp().request.get("/api/weshop/activitylist/getSJGoodsPriceNew/" + gd.store_id 1072 getApp().request.get("/api/weshop/activitylist/getSJGoodsPriceNew/" + gd.store_id
1073 - + "/" + gd.goods_id + "/1/" + gd.prom_id+"/"+app.globalData.user_id, { 1073 + + "/" + gd.goods_id + "/1/" + gd.prom_id + "/" + app.globalData.user_id, {
1074 success: async function (tt) { 1074 success: async function (tt) {
1075 if (tt.data.code == 0) { 1075 if (tt.data.code == 0) {
1076 //t.data.data.shop_price = tt.data.data.prom_price; 1076 //t.data.data.shop_price = tt.data.data.prom_price;
1077 t.data.data.shop_price = tt.data.data.prom_user_price; 1077 t.data.data.shop_price = tt.data.data.prom_user_price;
1078 - th.data.ckeck_quan_price=0;  
1079 - gd.is_xz_yh=1; 1078 + th.data.ckeck_quan_price = 0;
  1079 + gd.is_xz_yh = 1;
1080 } else { 1080 } else {
1081 t.data.data.prom_id = 0; 1081 t.data.data.prom_id = 0;
1082 t.data.data.prom_type = 0; 1082 t.data.data.prom_type = 0;
@@ -1098,7 +1098,7 @@ Page({ @@ -1098,7 +1098,7 @@ Page({
1098 //计算价格 1098 //计算价格
1099 th.calculatePrice2(); 1099 th.calculatePrice2();
1100 //获取优惠券,如果有券的钱,就调用 1100 //获取优惠券,如果有券的钱,就调用
1101 - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); 1101 + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
1102 } 1102 }
1103 }); 1103 });
1104 1104
@@ -1106,7 +1106,7 @@ Page({ @@ -1106,7 +1106,7 @@ Page({
1106 1106
1107 case 2: //--- 团购 --- 1107 case 2: //--- 团购 ---
1108 var quanlist = null; 1108 var quanlist = null;
1109 - getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gd.goods_id+"/"+ gd.prom_id, { 1109 + getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, {
1110 success: async function (tt) { 1110 success: async function (tt) {
1111 if (tt.data.code == 0) { 1111 if (tt.data.code == 0) {
1112 //t.data.data.shop_price = tt.data.data.prom_price; 1112 //t.data.data.shop_price = tt.data.data.prom_price;
@@ -1116,12 +1116,12 @@ Page({ @@ -1116,12 +1116,12 @@ Page({
1116 t.data.data.prom_type = 0; 1116 t.data.data.prom_type = 0;
1117 } 1117 }
1118 1118
1119 - if(tt.data.data.isQuan){ 1119 + if (tt.data.data.isQuan) {
1120 th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; 1120 th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
1121 th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; 1121 th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
1122 th.data.check_quan_ware_list = t.data.data.erpwareid + ""; 1122 th.data.check_quan_ware_list = t.data.data.erpwareid + "";
1123 - }else{  
1124 - gd.is_xz_yh=1; 1123 + } else {
  1124 + gd.is_xz_yh = 1;
1125 } 1125 }
1126 1126
1127 th.setData({ 1127 th.setData({
@@ -1137,7 +1137,7 @@ Page({ @@ -1137,7 +1137,7 @@ Page({
1137 //-- 计算价格 -- 1137 //-- 计算价格 --
1138 th.calculatePrice2(); 1138 th.calculatePrice2();
1139 //获取优惠券,如果有券的钱,就调用 1139 //获取优惠券,如果有券的钱,就调用
1140 - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); 1140 + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
1141 } 1141 }
1142 }); 1142 });
1143 1143
@@ -1152,14 +1152,14 @@ Page({ @@ -1152,14 +1152,14 @@ Page({
1152 checkAddressList: function () { 1152 checkAddressList: function () {
1153 var t = this; 1153 var t = this;
1154 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 1154 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
1155 - title: "请先填写或选择收货地址~",  
1156 - success: function (a) {  
1157 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
1158 - },  
1159 - fail: function () {  
1160 - wx.navigateBack();  
1161 - }  
1162 - }), !1); 1155 + title: "请先填写或选择收货地址~",
  1156 + success: function (a) {
  1157 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  1158 + },
  1159 + fail: function () {
  1160 + wx.navigateBack();
  1161 + }
  1162 + }), !1);
1163 }, 1163 },
1164 showInvoice: function () { 1164 showInvoice: function () {
1165 this.setData({ 1165 this.setData({
@@ -1178,7 +1178,7 @@ Page({ @@ -1178,7 +1178,7 @@ Page({
1178 }, 1178 },
1179 keyUpChangeNum: function (t) { 1179 keyUpChangeNum: function (t) {
1180 var index = t.currentTarget.dataset.index; 1180 var index = t.currentTarget.dataset.index;
1181 - var txt="user_note."+index; 1181 + var txt = "user_note." + index;
1182 this.setData({ 1182 this.setData({
1183 maxWord: t.detail.value.length, 1183 maxWord: t.detail.value.length,
1184 [txt]: t.detail.value 1184 [txt]: t.detail.value
@@ -1268,7 +1268,7 @@ Page({ @@ -1268,7 +1268,7 @@ Page({
1268 } 1268 }
1269 1269
1270 var pt_res = null; 1270 var pt_res = null;
1271 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 1271 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
1272 is_json: 1, 1272 is_json: 1,
1273 data: pt_data 1273 data: pt_data
1274 }).then(res => { 1274 }).then(res => {
@@ -1323,11 +1323,11 @@ Page({ @@ -1323,11 +1323,11 @@ Page({
1323 if (item_map.s_coupon_id) { 1323 if (item_map.s_coupon_id) {
1324 if (!cart_item.s_coupon_id) { 1324 if (!cart_item.s_coupon_id) {
1325 cart_item.s_coupon_id = item_map.s_coupon_id + ""; 1325 cart_item.s_coupon_id = item_map.s_coupon_id + "";
1326 - cart_item.g_coupon_num = [{'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}]; 1326 + cart_item.g_coupon_num = [{ 'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num }];
1327 } 1327 }
1328 else { 1328 else {
1329 cart_item.s_coupon_id += "," + item_map.s_coupon_id; 1329 cart_item.s_coupon_id += "," + item_map.s_coupon_id;
1330 - cart_item.g_coupon_num.push({'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}) 1330 + cart_item.g_coupon_num.push({ 'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num })
1331 } 1331 }
1332 } 1332 }
1333 1333
@@ -1335,11 +1335,11 @@ Page({ @@ -1335,11 +1335,11 @@ Page({
1335 if (item_map.s_libao) { 1335 if (item_map.s_libao) {
1336 if (!cart_item.s_libao) { 1336 if (!cart_item.s_libao) {
1337 cart_item.s_libao = item_map.s_libao + ""; 1337 cart_item.s_libao = item_map.s_libao + "";
1338 - cart_item.g_lb_num = [{'l_id': item_map.s_libao, "num": item_map.s_lb_num}]; 1338 + cart_item.g_lb_num = [{ 'l_id': item_map.s_libao, "num": item_map.s_lb_num }];
1339 } 1339 }
1340 else { 1340 else {
1341 cart_item.s_libao += "," + item_map.s_libao; 1341 cart_item.s_libao += "," + item_map.s_libao;
1342 - cart_item.g_lb_num.push({'l_id': item_map.s_libao, "num": item_map.s_lb_num}) 1342 + cart_item.g_lb_num.push({ 'l_id': item_map.s_libao, "num": item_map.s_lb_num })
1343 } 1343 }
1344 } 1344 }
1345 } 1345 }
@@ -1348,7 +1348,7 @@ Page({ @@ -1348,7 +1348,7 @@ Page({
1348 }, 1348 },
1349 1349
1350 //-------------------计算订单价格------------------- 1350 //-------------------计算订单价格-------------------
1351 - calculatePrice : function (t, s) { 1351 + calculatePrice: function (t, s) {
1352 var th = this; 1352 var th = this;
1353 to.getConfig2(function (ee) { 1353 to.getConfig2(function (ee) {
1354 to.getwuliuprice(async function (rs) { 1354 to.getwuliuprice(async function (rs) {
@@ -1372,11 +1372,11 @@ Page({ @@ -1372,11 +1372,11 @@ Page({
1372 var no_ex_id = ee.no_ex_id; 1372 var no_ex_id = ee.no_ex_id;
1373 var no_ex_good = null; 1373 var no_ex_good = null;
1374 var by_qc = {}; 1374 var by_qc = {};
1375 - var out_of_weight=0; //超出多少重量 1375 + var out_of_weight = 0; //超出多少重量
1376 if (no_ex_id && freight_free > 0) { 1376 if (no_ex_id && freight_free > 0) {
1377 //-----------获取不包邮区域,不包邮商品------- 1377 //-----------获取不包邮区域,不包邮商品-------
1378 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { 1378 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
1379 - data: {store_id: os.stoid, id: no_ex_id} 1379 + data: { store_id: os.stoid, id: no_ex_id }
1380 }).then(res => { 1380 }).then(res => {
1381 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { 1381 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
1382 by_qc = res.data.data[0]; 1382 by_qc = res.data.data[0];
@@ -1395,9 +1395,9 @@ Page({ @@ -1395,9 +1395,9 @@ Page({
1395 //调用函数计算每件商品的单价 1395 //调用函数计算每件商品的单价
1396 await th.calc_per(c_arr); 1396 await th.calc_per(c_arr);
1397 //调用函数计算每件组合购商品的单价, 1397 //调用函数计算每件组合购商品的单价,
1398 - await zh_calc.calc_zh_split_price(c_arr,th); 1398 + await zh_calc.calc_zh_split_price(c_arr, th);
1399 //调用函数计算每件阶梯促销商品的单价, 1399 //调用函数计算每件阶梯促销商品的单价,
1400 - await ladder_calc.calc_split_price(c_arr,th); 1400 + await ladder_calc.calc_split_price(c_arr, th);
1401 //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品 1401 //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品
1402 await th.get_cart_quan(c_arr); 1402 await th.get_cart_quan(c_arr);
1403 //---循环购物车--- 1403 //---循环购物车---
@@ -1420,7 +1420,7 @@ Page({ @@ -1420,7 +1420,7 @@ Page({
1420 var cart_item = c_arr[i]; //就是每一单的意思 1420 var cart_item = c_arr[i]; //就是每一单的意思
1421 var pickid = cart_item.pickup_id; 1421 var pickid = cart_item.pickup_id;
1422 var o_price = 0; 1422 var o_price = 0;
1423 - var o_price_no_zh=0; //参与订单优惠叠加--组合购的金额汇总 1423 + var o_price_no_zh = 0; //参与订单优惠叠加--组合购的金额汇总
1424 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 1424 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
1425 var item = c_arr[i].goods; //就是每一单的从表的意思 1425 var item = c_arr[i].goods; //就是每一单的从表的意思
1426 1426
@@ -1428,11 +1428,11 @@ Page({ @@ -1428,11 +1428,11 @@ Page({
1428 var quan_price = 0; 1428 var quan_price = 0;
1429 var coupon_price = 0; 1429 var coupon_price = 0;
1430 var quan_no = null; 1430 var quan_no = null;
1431 - var is_has_zh=c_arr[i].is_has_zh;  
1432 - var is_has_ladder=c_arr[i].is_has_ladder; 1431 + var is_has_zh = c_arr[i].is_has_zh;
  1432 + var is_has_ladder = c_arr[i].is_has_ladder;
1433 1433
1434 - var zh_prom_goods=c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间  
1435 - var ladder_prom_goods=c_arr[i].ladder_prom_goods; //组合购计算的原始数据存储空间 1434 + var zh_prom_goods = c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间
  1435 + var ladder_prom_goods = c_arr[i].ladder_prom_goods; //组合购计算的原始数据存储空间
1436 1436
1437 if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined) 1437 if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined)
1438 quan_no = th.data.using_quan[pickid].coupon_no; 1438 quan_no = th.data.using_quan[pickid].coupon_no;
@@ -1461,64 +1461,65 @@ Page({ @@ -1461,64 +1461,65 @@ Page({
1461 //--------循环计算总价----------- 1461 //--------循环计算总价-----------
1462 for (var j = 0; j < item.length; j++) { 1462 for (var j = 0; j < item.length; j++) {
1463 1463
1464 - var is_no_zh=0;  
1465 - if(item[j].prom_type!=7 && item[j].prom_type!=10 ) is_no_zh=1; 1464 + var is_no_zh = 0;
  1465 + if (item[j].prom_type != 7 && item[j].prom_type != 10) is_no_zh = 1;
1466 1466
1467 //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 1467 //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加
1468 - if(item[j].prom_type==7 && th.data.zhhe_act_map && th.data.zhhe_act_map[item[j].prom_id]  
1469 - && th.data.zhhe_act_map[item[j].prom_id].is_orderyh )  
1470 - {  
1471 - is_no_zh=1; 1468 + if (item[j].prom_type == 7 && th.data.zhhe_act_map && th.data.zhhe_act_map[item[j].prom_id]
  1469 + && th.data.zhhe_act_map[item[j].prom_id].is_orderyh) {
  1470 + is_no_zh = 1;
1472 } 1471 }
1473 //阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 1472 //阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加
1474 - if(item[j].prom_type==10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id]  
1475 - && th.data.ladder_map[item[j].prom_id].is_useorderyh )  
1476 - {  
1477 - is_no_zh=1; 1473 + if (item[j].prom_type == 10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id]
  1474 + && th.data.ladder_map[item[j].prom_id].is_useorderyh) {
  1475 + is_no_zh = 1;
1478 } 1476 }
1479 1477
1480 - if(is_no_zh){ 1478 + if (is_no_zh) {
1481 o_price_no_zh += item[j].goods_price * item[j].goods_num; 1479 o_price_no_zh += item[j].goods_price * item[j].goods_num;
1482 } 1480 }
1483 o_price += item[j].goods_price * item[j].goods_num; 1481 o_price += item[j].goods_price * item[j].goods_num;
1484 1482
1485 //判断是否有设置限制重量包邮,先看商品有没有包邮 1483 //判断是否有设置限制重量包邮,先看商品有没有包邮
1486 - if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){ 1484 + if (item[j]['is_past'] !== 1 && item[j]['exp_sum_type'] == 2) {
1487 if (goods_weight < 0) goods_weight = 0; 1485 if (goods_weight < 0) goods_weight = 0;
1488 - //累积商品重量 每种商品的重量 * 数量 1486 + //累积商品重量 每种商品的重量 * 数量
1489 goods_weight += item[j]['weight'] * item[j]['goods_num']; 1487 goods_weight += item[j]['weight'] * item[j]['goods_num'];
1490 - out_of_weight = (weight_free*1000) - goods_weight; 1488 + if (weight_free > 0) {
  1489 + out_of_weight = (weight_free * 1000) - goods_weight;
  1490 + }
1491 } 1491 }
  1492 +
1492 } 1493 }
1493 //判断是不是有组合购的金额 1494 //判断是不是有组合购的金额
1494 var f_o_price = o_price; 1495 var f_o_price = o_price;
1495 //如果又优惠的钱,就要减价 1496 //如果又优惠的钱,就要减价
1496 - if (c_arr[i].cut_price > 0){ 1497 + if (c_arr[i].cut_price > 0) {
1497 o_price -= c_arr[i].cut_price; 1498 o_price -= c_arr[i].cut_price;
1498 - o_price_no_zh-=c_arr[i].cut_price; 1499 + o_price_no_zh -= c_arr[i].cut_price;
1499 } 1500 }
1500 //如果有组合购优惠的钱,就要减价 1501 //如果有组合购优惠的钱,就要减价
1501 - if (c_arr[i].zh_cut_price>0 || c_arr[i].zh_cut_price<0){ 1502 + if (c_arr[i].zh_cut_price > 0 || c_arr[i].zh_cut_price < 0) {
1502 o_price -= c_arr[i].zh_cut_price; 1503 o_price -= c_arr[i].zh_cut_price;
1503 - if(o_price_no_zh>0){ 1504 + if (o_price_no_zh > 0) {
1504 //找到那些可以订单优惠叠加的 1505 //找到那些可以订单优惠叠加的
1505 - for(let ij in zh_prom_goods){  
1506 - let kitem=zh_prom_goods[ij];  
1507 - if(kitem.act.is_orderyh)  
1508 - o_price_no_zh-=kitem.cut_price; 1506 + for (let ij in zh_prom_goods) {
  1507 + let kitem = zh_prom_goods[ij];
  1508 + if (kitem.act.is_orderyh)
  1509 + o_price_no_zh -= kitem.cut_price;
1509 } 1510 }
1510 } 1511 }
1511 } 1512 }
1512 1513
1513 //如果有组合购优惠的钱,就要减价 1514 //如果有组合购优惠的钱,就要减价
1514 - if (c_arr[i].ladder_cut_price>0 || c_arr[i].ladder_cut_price<0){ 1515 + if (c_arr[i].ladder_cut_price > 0 || c_arr[i].ladder_cut_price < 0) {
1515 o_price -= c_arr[i].ladder_cut_price; 1516 o_price -= c_arr[i].ladder_cut_price;
1516 - if(o_price_no_zh>0){ 1517 + if (o_price_no_zh > 0) {
1517 //找到那些可以订单优惠叠加的 1518 //找到那些可以订单优惠叠加的
1518 - for(let ij in ladder_prom_goods){  
1519 - let kitem=ladder_prom_goods[ij];  
1520 - if(th.data.ladder_map[ij].is_useorderyh )  
1521 - o_price_no_zh-=kitem.cut_price; 1519 + for (let ij in ladder_prom_goods) {
  1520 + let kitem = ladder_prom_goods[ij];
  1521 + if (th.data.ladder_map[ij].is_useorderyh)
  1522 + o_price_no_zh -= kitem.cut_price;
1522 } 1523 }
1523 } 1524 }
1524 } 1525 }
@@ -1526,30 +1527,37 @@ Page({ @@ -1526,30 +1527,37 @@ Page({
1526 //-- 计算线下取价的功能 -- 1527 //-- 计算线下取价的功能 --
1527 if (cart_item.is_offline == 1) { 1528 if (cart_item.is_offline == 1) {
1528 o_price = o_price - cart_item.offline_price; 1529 o_price = o_price - cart_item.offline_price;
1529 - o_price_no_zh-=c_arr[i].offline_price; 1530 + o_price_no_zh -= c_arr[i].offline_price;
1530 } 1531 }
1531 //判断包邮券的钱,组合购的商品不使用优惠券 1532 //判断包邮券的钱,组合购的商品不使用优惠券
1532 var q_conditin = 0; 1533 var q_conditin = 0;
1533 q_conditin = o_price - quan_price; 1534 q_conditin = o_price - quan_price;
1534 - if(is_has_zh){ 1535 + if (is_has_zh) {
1535 q_conditin = o_price_no_zh - quan_price; 1536 q_conditin = o_price_no_zh - quan_price;
1536 } 1537 }
1537 cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 1538 cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算
1538 //计算物流费用 1539 //计算物流费用
1539 cart_item.shipping_price = 0; 1540 cart_item.shipping_price = 0;
1540 1541
  1542 + th.data.is_no_past = 1; //不包邮标识符
  1543 +
1541 //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额-- 1544 //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额--
1542 - 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) && out_of_weight >= 0) { 1545 + 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)) {
1543 //如果有设置不包邮区域的时候 1546 //如果有设置不包邮区域的时候
1544 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { 1547 if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) {
1545 if (th.check_by_area(by_qc.region_list)) { 1548 if (th.check_by_area(by_qc.region_list)) {
1546 freight_free = 0; 1549 freight_free = 0;
  1550 + goods_weight = -1;
  1551 + out_of_weight = 0;
1547 th.data.is_no_by[pickid] = 1; 1552 th.data.is_no_by[pickid] = 1;
1548 } 1553 }
1549 } 1554 }
1550 //如果有设置不包邮区商品 1555 //如果有设置不包邮区商品
1551 if (by_qc.goods_list != "" && by_qc.goods_list != undefined && by_qc != null && freight_free > 0) { 1556 if (by_qc.goods_list != "" && by_qc.goods_list != undefined && by_qc != null && freight_free > 0) {
1552 freight_free = 0; 1557 freight_free = 0;
  1558 + goods_weight = -1;
  1559 + out_of_weight = 0;
  1560 + th.data.is_no_by[pickid] = 1;
1553 no_ex_good = by_qc.goods_list; 1561 no_ex_good = by_qc.goods_list;
1554 } 1562 }
1555 } 1563 }
@@ -1564,7 +1572,7 @@ Page({ @@ -1564,7 +1572,7 @@ Page({
1564 store_id: os.stoid, 1572 store_id: os.stoid,
1565 isuse: 0, 1573 isuse: 0,
1566 //condition: q_conditin, 1574 //condition: q_conditin,
1567 - condition:cart_item.ckeck_quan_price, 1575 + condition: cart_item.ckeck_quan_price,
1568 user_id: getApp().globalData.user_id, 1576 user_id: getApp().globalData.user_id,
1569 pageSize: 2000 1577 pageSize: 2000
1570 } 1578 }
@@ -1589,7 +1597,7 @@ Page({ @@ -1589,7 +1597,7 @@ Page({
1589 } 1597 }
1590 if (arr) { 1598 if (arr) {
1591 th.data.get_by_quan_list_cart[pickid] = arr; 1599 th.data.get_by_quan_list_cart[pickid] = arr;
1592 - th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart}); 1600 + th.setData({ get_by_quan_list_cart: th.data.get_by_quan_list_cart });
1593 //if (th.data.is_b_now) { 1601 //if (th.data.is_b_now) {
1594 // th.setData({get_by_quan_list: arr}); 1602 // th.setData({get_by_quan_list: arr});
1595 //} 1603 //}
@@ -1614,7 +1622,7 @@ Page({ @@ -1614,7 +1622,7 @@ Page({
1614 if (ut.isContained(arr, arr2)) { 1622 if (ut.isContained(arr, arr2)) {
1615 getApp().my_warnning("全场不包邮商品和包邮券的重复", 0, th); 1623 getApp().my_warnning("全场不包邮商品和包邮券的重复", 0, th);
1616 th.data.using_quan[pickid] = {}; 1624 th.data.using_quan[pickid] = {};
1617 - th.setData({using_quan: th.data.using_quan}) 1625 + th.setData({ using_quan: th.data.using_quan })
1618 return false; 1626 return false;
1619 } 1627 }
1620 var n_arr = ut.mergeArray(arr, arr2); 1628 var n_arr = ut.mergeArray(arr, arr2);
@@ -1653,7 +1661,7 @@ Page({ @@ -1653,7 +1661,7 @@ Page({
1653 if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); 1661 if (no_ex_good) no_ex_good_arr = no_ex_good.split(',');
1654 1662
1655 //----------------如果是选择了物流--------------------- 1663 //----------------如果是选择了物流---------------------
1656 - if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0 && (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') > -1 )) { 1664 + if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0 && (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') > -1)) {
1657 1665
1658 //如果地址不为空 1666 //如果地址不为空
1659 if (th.data.user_addr != null) { 1667 if (th.data.user_addr != null) {
@@ -1662,13 +1670,15 @@ Page({ @@ -1662,13 +1670,15 @@ Page({
1662 //统一运费 1670 //统一运费
1663 o_shipping_price += item[j]['uniform_exp_sum']; 1671 o_shipping_price += item[j]['uniform_exp_sum'];
1664 break; 1672 break;
1665 - // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮  
1666 - // +''  
1667 - // if (goods_weight < 0) goods_weight = 0;  
1668 - // //累积商品重量 每种商品的重量 * 数量  
1669 - // goods_weight += item[j]['weight'] * item[j]['goods_num'];  
1670 - // out_of_weight = (weight_free*1000) - goods_weight;  
1671 - // break; 1673 + case 2:
  1674 + +''
  1675 + if (goods_weight < 0) goods_weight = 0;
  1676 + //累积商品重量 每种商品的重量 * 数量
  1677 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
  1678 + if (weight_free > 0) {
  1679 + out_of_weight = (weight_free * 1000) - goods_weight;
  1680 + }
  1681 + break;
1672 case 3: 1682 case 3:
1673 if (goods_piece < 0) goods_piece = 0; 1683 if (goods_piece < 0) goods_piece = 0;
1674 //累积商品数量 1684 //累积商品数量
@@ -1676,14 +1686,6 @@ Page({ @@ -1676,14 +1686,6 @@ Page({
1676 break; 1686 break;
1677 } 1687 }
1678 } 1688 }
1679 - }else{  
1680 - if(item[j]['exp_sum_type']==2){  
1681 - if(out_of_weight !==0){  
1682 - goods_weight=-1;  
1683 - out_of_weight=0;  
1684 - }  
1685 - }  
1686 -  
1687 } 1689 }
1688 } 1690 }
1689 1691
@@ -1694,8 +1696,8 @@ Page({ @@ -1694,8 +1696,8 @@ Page({
1694 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) 1696 if (th.data.wu_arr && th.data.wu_arr[cart_item.wind])
1695 code = th.data.wu_arr[cart_item.wind].code; 1697 code = th.data.wu_arr[cart_item.wind].code;
1696 cart_item.shipping_price = 1698 cart_item.shipping_price =
1697 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,  
1698 - goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs); 1699 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  1700 + goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs, pickid);
1699 1701
1700 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { 1702 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
1701 if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 1703 if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了
@@ -1714,26 +1716,26 @@ Page({ @@ -1714,26 +1716,26 @@ Page({
1714 var order_prom_id = 0; 1716 var order_prom_id = 0;
1715 var o_condition = cart_item.order_amount; 1717 var o_condition = cart_item.order_amount;
1716 //看一下是不是不用组合购的订单优惠的叠加 1718 //看一下是不是不用组合购的订单优惠的叠加
1717 - if(is_has_zh){  
1718 - o_condition=o_price_no_zh-quan_price; 1719 + if (is_has_zh) {
  1720 + o_condition = o_price_no_zh - quan_price;
1719 } 1721 }
1720 1722
1721 //看一下是不是不用组合购的订单优惠的叠加 1723 //看一下是不是不用组合购的订单优惠的叠加
1722 - if(is_has_ladder){  
1723 - o_condition=o_price_no_zh-quan_price; 1724 + if (is_has_ladder) {
  1725 + o_condition = o_price_no_zh - quan_price;
1724 } 1726 }
1725 1727
1726 1728
1727 1729
1728 var order_m = 0; 1730 var order_m = 0;
1729 //---判断是不是有订单优惠--- 1731 //---判断是不是有订单优惠---
1730 - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {  
1731 - data: {store_id: os.stoid, orderAmount: o_condition} 1732 + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
  1733 + data: { store_id: os.stoid, orderAmount: o_condition }
1732 }).then(res => { 1734 }).then(res => {
1733 if (res.data.code == 0) { 1735 if (res.data.code == 0) {
1734 var ord_prom = res.data.data; 1736 var ord_prom = res.data.data;
1735 //么有使用券,或者活动没有限制使用优惠券 1737 //么有使用券,或者活动没有限制使用优惠券
1736 - if(quan_price<=0 || !ord_prom.is_xz_yh) { 1738 + if (quan_price <= 0 || !ord_prom.is_xz_yh) {
1737 order_prom_id = ord_prom['id']; 1739 order_prom_id = ord_prom['id'];
1738 switch (ord_prom['type']) { 1740 switch (ord_prom['type']) {
1739 case 0: 1741 case 0:
@@ -1877,13 +1879,13 @@ Page({ @@ -1877,13 +1879,13 @@ Page({
1877 } 1879 }
1878 } 1880 }
1879 var set_txt = "cartlist[" + iter + "].can_num"; 1881 var set_txt = "cartlist[" + iter + "].can_num";
1880 - th.setData({[set_txt]: num}); 1882 + th.setData({ [set_txt]: num });
1881 } 1883 }
1882 }, 1884 },
1883 1885
1884 1886
1885 //---------计算立即购买---------- 1887 //---------计算立即购买----------
1886 - calculatePrice2 : function () { 1888 + calculatePrice2: function () {
1887 var th = this, good = this.data.bn_goods; 1889 var th = this, good = this.data.bn_goods;
1888 1890
1889 if (!good) return false; 1891 if (!good) return false;
@@ -1909,10 +1911,10 @@ Page({ @@ -1909,10 +1911,10 @@ Page({
1909 1911
1910 allpice = parseFloat(allpice).toFixed(2); 1912 allpice = parseFloat(allpice).toFixed(2);
1911 var txt = "formData.all_price"; 1913 var txt = "formData.all_price";
1912 - th.setData({[txt]: allpice,}); 1914 + th.setData({ [txt]: allpice, });
1913 if (cut_price) { 1915 if (cut_price) {
1914 var c_txt = "formData.cut_price"; 1916 var c_txt = "formData.cut_price";
1915 - th.setData({[c_txt]: cut_price,}); 1917 + th.setData({ [c_txt]: cut_price, });
1916 1918
1917 } 1919 }
1918 1920
@@ -1925,8 +1927,8 @@ Page({ @@ -1925,8 +1927,8 @@ Page({
1925 to.getConfig2(function (ee) { 1927 to.getConfig2(function (ee) {
1926 to.getwuliuprice(async function (rs) { 1928 to.getwuliuprice(async function (rs) {
1927 1929
1928 - var o_shipping_price = 0,goods_weight = -1,goods_piece = -1;  
1929 - var out_of_weight=null; //超出多少重量 1930 + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
  1931 + var out_of_weight = null; //超出多少重量
1930 var freight_free = ee.freight_free; //全场满多少包邮 1932 var freight_free = ee.freight_free; //全场满多少包邮
1931 var weight_free = ee.weight_free; //多少kg内包邮 1933 var weight_free = ee.weight_free; //多少kg内包邮
1932 var no_ex_id = ee.no_ex_id; 1934 var no_ex_id = ee.no_ex_id;
@@ -1981,7 +1983,7 @@ Page({ @@ -1981,7 +1983,7 @@ Page({
1981 arr.push(item); 1983 arr.push(item);
1982 } 1984 }
1983 if (arr) { 1985 if (arr) {
1984 - th.setData({get_by_quan_list: arr}); 1986 + th.setData({ get_by_quan_list: arr });
1985 } 1987 }
1986 th.data.isget_by_quan[th.data.bn_pick] = 1; 1988 th.data.isget_by_quan[th.data.bn_pick] = 1;
1987 } 1989 }
@@ -1998,8 +2000,8 @@ Page({ @@ -1998,8 +2000,8 @@ Page({
1998 //dw 2000 //dw
1999 //累积商品重量 每种商品的重量 * 数量 2001 //累积商品重量 每种商品的重量 * 数量
2000 goods_weight += good['weight'] * good['buynum']; 2002 goods_weight += good['weight'] * good['buynum'];
2001 - if(weight_free > 0){  
2002 - out_of_weight = (weight_free * 1000 ) - goods_weight; 2003 + if (weight_free > 0) {
  2004 + out_of_weight = (weight_free * 1000) - goods_weight;
2003 } 2005 }
2004 break; 2006 break;
2005 case 3: 2007 case 3:
@@ -2022,7 +2024,7 @@ Page({ @@ -2022,7 +2024,7 @@ Page({
2022 if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { 2024 if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) {
2023 //-----------获取不包邮区域,不包邮商品------- 2025 //-----------获取不包邮区域,不包邮商品-------
2024 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { 2026 await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
2025 - data: {store_id: os.stoid, id: no_ex_id} 2027 + data: { store_id: os.stoid, id: no_ex_id }
2026 }).then(res => { 2028 }).then(res => {
2027 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { 2029 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
2028 no_by_data = res.data.data[0]; 2030 no_by_data = res.data.data[0];
@@ -2030,6 +2032,7 @@ Page({ @@ -2030,6 +2032,7 @@ Page({
2030 if (res.data.data[0].region_list) { 2032 if (res.data.data[0].region_list) {
2031 if (th.check_by_area(res.data.data[0].region_list)) { 2033 if (th.check_by_area(res.data.data[0].region_list)) {
2032 freight_free = 0; 2034 freight_free = 0;
  2035 + out_of_weight = 0;
2033 th.data.is_no_by[th.data.bn_pick] = 1; 2036 th.data.is_no_by[th.data.bn_pick] = 1;
2034 } 2037 }
2035 } 2038 }
@@ -2037,6 +2040,7 @@ Page({ @@ -2037,6 +2040,7 @@ Page({
2037 if (res.data.data[0].goods_list && freight_free) { 2040 if (res.data.data[0].goods_list && freight_free) {
2038 if (th.check_by_goods(res.data.data[0].goods_list)) { 2041 if (th.check_by_goods(res.data.data[0].goods_list)) {
2039 freight_free = 0; 2042 freight_free = 0;
  2043 + out_of_weight = 0;
2040 th.data.is_no_by[th.data.bn_pick] = 1; 2044 th.data.is_no_by[th.data.bn_pick] = 1;
2041 } 2045 }
2042 } 2046 }
@@ -2047,12 +2051,12 @@ Page({ @@ -2047,12 +2051,12 @@ Page({
2047 th.data.is_by[th.data.bn_pick] = 0; 2051 th.data.is_by[th.data.bn_pick] = 0;
2048 //--------------开始计算物流------------------ 2052 //--------------开始计算物流------------------
2049 var shipping_price = 2053 var shipping_price =
2050 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,  
2051 - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); 2054 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  2055 + goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs, th.data.bn_pick);
2052 2056
2053 //如果有赠品的时候,也要计算赠品的物流费用 2057 //如果有赠品的时候,也要计算赠品的物流费用
2054 if (th.data.buy_now_gift_goods) { 2058 if (th.data.buy_now_gift_goods) {
2055 - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight, 2059 + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, out_of_weight,
2056 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); 2060 parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece);
2057 } 2061 }
2058 2062
@@ -2062,18 +2066,18 @@ Page({ @@ -2062,18 +2066,18 @@ Page({
2062 2066
2063 shipping_price = parseFloat(shipping_price).toFixed(2); 2067 shipping_price = parseFloat(shipping_price).toFixed(2);
2064 var wl_txt = "formData.shipping_price"; 2068 var wl_txt = "formData.shipping_price";
2065 - th.setData({[wl_txt]: shipping_price,}) 2069 + th.setData({ [wl_txt]: shipping_price, })
2066 2070
2067 } else { 2071 } else {
2068 var wl_txt = "formData.shipping_price"; 2072 var wl_txt = "formData.shipping_price";
2069 - th.setData({[wl_txt]: 0,}) 2073 + th.setData({ [wl_txt]: 0, })
2070 } 2074 }
2071 2075
2072 if (quan_no) { 2076 if (quan_no) {
2073 if (th.data.using_quan[bn_pick].isby == 1) { 2077 if (th.data.using_quan[bn_pick].isby == 1) {
2074 shipping_price = 0; 2078 shipping_price = 0;
2075 var wl_txt = "formData.shipping_price"; 2079 var wl_txt = "formData.shipping_price";
2076 - th.setData({[wl_txt]: 0,}) 2080 + th.setData({ [wl_txt]: 0, })
2077 } 2081 }
2078 } 2082 }
2079 //-----------------支付价,优惠券不减物流----------------- 2083 //-----------------支付价,优惠券不减物流-----------------
@@ -2093,7 +2097,7 @@ Page({ @@ -2093,7 +2097,7 @@ Page({
2093 if (th.data.order_prom[th.data.bn_pick]) { 2097 if (th.data.order_prom[th.data.bn_pick]) {
2094 var ord_prom = th.data.order_prom[th.data.bn_pick]; 2098 var ord_prom = th.data.order_prom[th.data.bn_pick];
2095 //么有使用券,或者活动没有限制使用优惠券 2099 //么有使用券,或者活动没有限制使用优惠券
2096 - if(coupon_price<=0 || !ord_prom.is_xz_yh) { 2100 + if (coupon_price <= 0 || !ord_prom.is_xz_yh) {
2097 order_prom_id = ord_prom['id']; 2101 order_prom_id = ord_prom['id'];
2098 switch (ord_prom['type']) { 2102 switch (ord_prom['type']) {
2099 case 0: 2103 case 0:
@@ -2111,9 +2115,9 @@ Page({ @@ -2111,9 +2115,9 @@ Page({
2111 var order_prom_txt1 = "formData.order_prom_id"; 2115 var order_prom_txt1 = "formData.order_prom_id";
2112 var order_prom_txt2 = "formData.order_prom_amount"; 2116 var order_prom_txt2 = "formData.order_prom_amount";
2113 if (order_prom_id > 0) { 2117 if (order_prom_id > 0) {
2114 - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})  
2115 - }else{  
2116 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) 2118 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
  2119 + } else {
  2120 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
2117 } 2121 }
2118 2122
2119 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 2123 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
@@ -2123,7 +2127,7 @@ Page({ @@ -2123,7 +2127,7 @@ Page({
2123 order_m = order_m.toFixed(2); 2127 order_m = order_m.toFixed(2);
2124 2128
2125 var atxt = "formData.total_amount"; 2129 var atxt = "formData.total_amount";
2126 - th.setData({[atxt]: total_m,}) 2130 + th.setData({ [atxt]: total_m, })
2127 2131
2128 var txt = "formData.user_money"; 2132 var txt = "formData.user_money";
2129 var txt2 = "formData.order_amount"; 2133 var txt2 = "formData.order_amount";
@@ -2133,44 +2137,44 @@ Page({ @@ -2133,44 +2137,44 @@ Page({
2133 if (th.data.bn_use_money == 1) { 2137 if (th.data.bn_use_money == 1) {
2134 if (amoney > order_m) { 2138 if (amoney > order_m) {
2135 order_m = parseFloat(order_m).toFixed(2); 2139 order_m = parseFloat(order_m).toFixed(2);
2136 - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) 2140 + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 })
2137 } else { 2141 } else {
2138 order_m = parseFloat(order_m) - parseFloat(amoney); 2142 order_m = parseFloat(order_m) - parseFloat(amoney);
2139 order_m = order_m.toFixed(2); 2143 order_m = order_m.toFixed(2);
2140 - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 2144 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
2141 } 2145 }
2142 } else { 2146 } else {
2143 - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 2147 + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
2144 } 2148 }
2145 //优惠活动送积分 2149 //优惠活动送积分
2146 if (good.s_intValue) { 2150 if (good.s_intValue) {
2147 txt = "formData.give_integral"; 2151 txt = "formData.give_integral";
2148 - th.setData({[txt]: good.s_intValue}); 2152 + th.setData({ [txt]: good.s_intValue });
2149 } 2153 }
2150 //优惠送券 2154 //优惠送券
2151 if (good.s_coupon_id) { 2155 if (good.s_coupon_id) {
2152 var i_txt = "formData.give_coupon_id"; 2156 var i_txt = "formData.give_coupon_id";
2153 //这个是json格式的 2157 //这个是json格式的
2154 var i_txt1 = "formData.g_coupon_num"; 2158 var i_txt1 = "formData.g_coupon_num";
2155 - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; 2159 + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }];
2156 ob = JSON.stringify(ob); 2160 ob = JSON.stringify(ob);
2157 - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); 2161 + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob });
2158 } 2162 }
2159 //优惠礼包 2163 //优惠礼包
2160 if (good.s_libao) { 2164 if (good.s_libao) {
2161 var l_txt = "formData.give_lb_id"; 2165 var l_txt = "formData.give_lb_id";
2162 //这个是json格式的 2166 //这个是json格式的
2163 var l_txt1 = "formData.g_lb_num"; 2167 var l_txt1 = "formData.g_lb_num";
2164 - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; 2168 + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
2165 ob = JSON.stringify(ob); 2169 ob = JSON.stringify(ob);
2166 - th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); 2170 + th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob });
2167 } 2171 }
2168 }) 2172 })
2169 } else { 2173 } else {
2170 2174
2171 var order_prom_txt1 = "formData.order_prom_id"; 2175 var order_prom_txt1 = "formData.order_prom_id";
2172 var order_prom_txt2 = "formData.order_prom_amount"; 2176 var order_prom_txt2 = "formData.order_prom_amount";
2173 - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) 2177 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
2174 2178
2175 2179
2176 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 2180 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
@@ -2180,7 +2184,7 @@ Page({ @@ -2180,7 +2184,7 @@ Page({
2180 total_m = total_m.toFixed(2); 2184 total_m = total_m.toFixed(2);
2181 order_m = order_m.toFixed(2); 2185 order_m = order_m.toFixed(2);
2182 2186
2183 - th.setData({[atxt]: total_m,}) 2187 + th.setData({ [atxt]: total_m, })
2184 2188
2185 var txt = "formData.user_money"; 2189 var txt = "formData.user_money";
2186 var txt2 = "formData.order_amount"; 2190 var txt2 = "formData.order_amount";
@@ -2190,37 +2194,37 @@ Page({ @@ -2190,37 +2194,37 @@ Page({
2190 if (th.data.bn_use_money == 1) { 2194 if (th.data.bn_use_money == 1) {
2191 if (amoney > order_m) { 2195 if (amoney > order_m) {
2192 order_m = parseFloat(order_m).toFixed(2); 2196 order_m = parseFloat(order_m).toFixed(2);
2193 - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) 2197 + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 })
2194 } else { 2198 } else {
2195 order_m = parseFloat(order_m) - parseFloat(amoney); 2199 order_m = parseFloat(order_m) - parseFloat(amoney);
2196 order_m = order_m.toFixed(2); 2200 order_m = order_m.toFixed(2);
2197 - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 2201 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
2198 } 2202 }
2199 } else { 2203 } else {
2200 - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) 2204 + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 })
2201 } 2205 }
2202 //优惠活动送积分 2206 //优惠活动送积分
2203 if (good.s_intValue) { 2207 if (good.s_intValue) {
2204 txt = "formData.give_integral"; 2208 txt = "formData.give_integral";
2205 - th.setData({[txt]: good.s_intValue}); 2209 + th.setData({ [txt]: good.s_intValue });
2206 } 2210 }
2207 //优惠送券 2211 //优惠送券
2208 if (good.s_coupon_id) { 2212 if (good.s_coupon_id) {
2209 var i_txt = "formData.give_coupon_id"; 2213 var i_txt = "formData.give_coupon_id";
2210 //这个是json格式的 2214 //这个是json格式的
2211 var i_txt1 = "formData.g_coupon_num"; 2215 var i_txt1 = "formData.g_coupon_num";
2212 - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; 2216 + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }];
2213 ob = JSON.stringify(ob); 2217 ob = JSON.stringify(ob);
2214 - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); 2218 + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob });
2215 } 2219 }
2216 //优惠礼包 2220 //优惠礼包
2217 if (good.s_libao) { 2221 if (good.s_libao) {
2218 var l_txt = "formData.give_lb_id"; 2222 var l_txt = "formData.give_lb_id";
2219 //这个是json格式的 2223 //这个是json格式的
2220 var l_txt1 = "formData.g_lb_num"; 2224 var l_txt1 = "formData.g_lb_num";
2221 - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; 2225 + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
2222 ob = JSON.stringify(ob); 2226 ob = JSON.stringify(ob);
2223 - th.setData({[l_txt]: good.s_coupon_id, [l_txt1]: ob}); 2227 + th.setData({ [l_txt]: good.s_coupon_id, [l_txt1]: ob });
2224 } 2228 }
2225 } 2229 }
2226 2230
@@ -2230,17 +2234,17 @@ Page({ @@ -2230,17 +2234,17 @@ Page({
2230 }); 2234 });
2231 }, 2235 },
2232 2236
2233 - requestSubscribe(){  
2234 - const th=this; 2237 + requestSubscribe() {
  2238 + const th = this;
2235 const template_id = this.data.template_id; 2239 const template_id = this.data.template_id;
2236 wx.getSetting({ 2240 wx.getSetting({
2237 - withSubscriptions:true,  
2238 - success(res){  
2239 - let itemSettings=res.subscriptionsSetting.itemSettings;  
2240 - if(itemSettings && itemSettings[template_id]=="accept"){ 2241 + withSubscriptions: true,
  2242 + success(res) {
  2243 + let itemSettings = res.subscriptionsSetting.itemSettings;
  2244 + if (itemSettings && itemSettings[template_id] == "accept") {
2241 th.submit_func(); 2245 th.submit_func();
2242 - }else{  
2243 - th.sendsm(function(){ 2246 + } else {
  2247 + th.sendsm(function () {
2244 th.submit_func(); 2248 th.submit_func();
2245 }) 2249 })
2246 } 2250 }
@@ -2249,12 +2253,12 @@ Page({ @@ -2249,12 +2253,12 @@ Page({
2249 }, 2253 },
2250 2254
2251 //--------------------提交订单----------------------- 2255 //--------------------提交订单-----------------------
2252 - async submit_func(){ 2256 + async submit_func() {
2253 if (this.data.is_summit_ing == 1) return false; //--提交中退出-- 2257 if (this.data.is_summit_ing == 1) return false; //--提交中退出--
2254 this.data.is_summit_ing = 1; 2258 this.data.is_summit_ing = 1;
2255 var th = this, pdata = new Array(); 2259 var th = this, pdata = new Array();
2256 var ff = true; 2260 var ff = true;
2257 - 2261 +
2258 //------------立即购买------------- 2262 //------------立即购买-------------
2259 if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { 2263 if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) {
2260 if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { 2264 if (th.data.bn_exp_type == 0 && th.data.user_addr == null) {
@@ -2271,7 +2275,7 @@ Page({ @@ -2271,7 +2275,7 @@ Page({
2271 th.data.is_summit_ing = 0; 2275 th.data.is_summit_ing = 0;
2272 return false; 2276 return false;
2273 } 2277 }
2274 - 2278 +
2275 var item = { 2279 var item = {
2276 'user_id': to.globalData.user_id, 2280 'user_id': to.globalData.user_id,
2277 'consignee': addr == null ? "" : addr.consignee, 2281 'consignee': addr == null ? "" : addr.consignee,
@@ -2292,7 +2296,7 @@ Page({ @@ -2292,7 +2296,7 @@ Page({
2292 'user_money': th.data.formData.user_money, //使用余额 2296 'user_money': th.data.formData.user_money, //使用余额
2293 'total_amount': th.data.formData.total_amount, //订单总价 2297 'total_amount': th.data.formData.total_amount, //订单总价
2294 'order_amount': th.data.formData.order_amount, //应付 2298 'order_amount': th.data.formData.order_amount, //应付
2295 - 'user_note': th.data.user_note['0']?th.data.user_note['0']:0, //用户备注 2299 + 'user_note': th.data.user_note['0'] ? th.data.user_note['0'] : 0, //用户备注
2296 'store_id': oo.stoid, //商家 2300 'store_id': oo.stoid, //商家
2297 'pickup_id': th.data.bn_pick, //门店 2301 'pickup_id': th.data.bn_pick, //门店
2298 'exp_type': th.data.bn_exp_type, //配送方式 2302 'exp_type': th.data.bn_exp_type, //配送方式
@@ -2318,7 +2322,7 @@ Page({ @@ -2318,7 +2322,7 @@ Page({
2318 } 2322 }
2319 2323
2320 //--判断优惠活动的提交-- 2324 //--判断优惠活动的提交--
2321 - if (th.data.formData.cut_price > 0 ) { 2325 + if (th.data.formData.cut_price > 0) {
2322 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); 2326 order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2);
2323 var ob = [{ 2327 var ob = [{
2324 "prom_id": th.data.bn_goods.prom_id, 2328 "prom_id": th.data.bn_goods.prom_id,
@@ -2381,7 +2385,7 @@ Page({ @@ -2381,7 +2385,7 @@ Page({
2381 goods.guide_id = gg.guide_id; 2385 goods.guide_id = gg.guide_id;
2382 goods.guide_type = gg.guide_type; 2386 goods.guide_type = gg.guide_type;
2383 //调用接口判断是不是会员 2387 //调用接口判断是不是会员
2384 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { 2388 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
2385 if (res.data.code == 0) { 2389 if (res.data.code == 0) {
2386 goods.guide_name = res.data.data.salesman; 2390 goods.guide_name = res.data.data.salesman;
2387 goods.guide_sn = res.data.data.salesman_no; 2391 goods.guide_sn = res.data.data.salesman_no;
@@ -2433,7 +2437,7 @@ Page({ @@ -2433,7 +2437,7 @@ Page({
2433 } 2437 }
2434 2438
2435 var pt_res = null; 2439 var pt_res = null;
2436 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 2440 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
2437 is_json: 1, 2441 is_json: 1,
2438 data: pt_data 2442 data: pt_data
2439 }).then(res => { 2443 }).then(res => {
@@ -2482,8 +2486,8 @@ Page({ @@ -2482,8 +2486,8 @@ Page({
2482 //调用接口判断是不是会员 2486 //调用接口判断是不是会员
2483 await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { 2487 await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
2484 if (res.data.code == 0) { 2488 if (res.data.code == 0) {
2485 - g_goods.guide_name = res.data.salesman;  
2486 - g_goods.guide_sn = res.data.salesman_no; 2489 + g_goods.guide_name = res.data.data.salesman;
  2490 + g_goods.guide_sn = res.data.data.salesman_no;
2487 } 2491 }
2488 }) 2492 })
2489 } 2493 }
@@ -2491,7 +2495,7 @@ Page({ @@ -2491,7 +2495,7 @@ Page({
2491 } 2495 }
2492 pdata.push(item); 2496 pdata.push(item);
2493 } else { 2497 } else {
2494 - 2498 +
2495 //---------购物车的结算--------- 2499 //---------购物车的结算---------
2496 if (th.data.is_all_zt == 0 && th.data.user_addr == null) { 2500 if (th.data.is_all_zt == 0 && th.data.user_addr == null) {
2497 th.data.is_summit_ing = 0; 2501 th.data.is_summit_ing = 0;
@@ -2512,7 +2516,7 @@ Page({ @@ -2512,7 +2516,7 @@ Page({
2512 return false; 2516 return false;
2513 } 2517 }
2514 2518
2515 - var order_prom_list_cart =  th.data.order_prom_list_cart;; 2519 + var order_prom_list_cart = th.data.order_prom_list_cart;;
2516 console.log('xxxxxxxxxxxxxxxx', order_prom_list_cart) 2520 console.log('xxxxxxxxxxxxxxxx', order_prom_list_cart)
2517 //--组装推送数据-- 2521 //--组装推送数据--
2518 for (var i = 0; i < order_prom_list_cart.length; i++) { 2522 for (var i = 0; i < order_prom_list_cart.length; i++) {
@@ -2565,23 +2569,23 @@ Page({ @@ -2565,23 +2569,23 @@ Page({
2565 order_prom_list.order_prom_amount = t_item.order_prom_amount; 2569 order_prom_list.order_prom_amount = t_item.order_prom_amount;
2566 } 2570 }
2567 2571
2568 - order_prom_list.discount_amount =0; 2572 + order_prom_list.discount_amount = 0;
2569 //--判断优惠活动的提交-- 2573 //--判断优惠活动的提交--
2570 if (t_item.cut_price > 0) { 2574 if (t_item.cut_price > 0) {
2571 order_prom_list.discount_amount += t_item.cut_price; 2575 order_prom_list.discount_amount += t_item.cut_price;
2572 } 2576 }
2573 //--判断组合优惠活动的提交-- 2577 //--判断组合优惠活动的提交--
2574 - if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { 2578 + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price < 0) {
2575 order_prom_list.discount_amount += t_item.zh_cut_price; 2579 order_prom_list.discount_amount += t_item.zh_cut_price;
2576 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); 2580 order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json);
2577 } 2581 }
2578 2582
2579 //--判断阶梯优惠活动的提交-- 2583 //--判断阶梯优惠活动的提交--
2580 - if (t_item.ladder_cut_price > 0 || t_item.ladder_cut_price<0) { 2584 + if (t_item.ladder_cut_price > 0 || t_item.ladder_cut_price < 0) {
2581 order_prom_list.discount_amount += t_item.ladder_cut_price; 2585 order_prom_list.discount_amount += t_item.ladder_cut_price;
2582 } 2586 }
2583 2587
2584 - if(t_item.prom_pt_json){ 2588 + if (t_item.prom_pt_json) {
2585 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); 2589 order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json);
2586 } 2590 }
2587 2591
@@ -2596,11 +2600,11 @@ Page({ @@ -2596,11 +2600,11 @@ Page({
2596 order_prom_list.give_lb_id = t_item.s_libao; 2600 order_prom_list.give_lb_id = t_item.s_libao;
2597 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); 2601 order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num);
2598 } 2602 }
2599 - if (Object.keys(order_prom_list).length > 0){  
2600 - if(order_prom_list.discount_amount)  
2601 - order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2);  
2602 - if(order_prom_list.order_prom_amount)  
2603 - order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); 2603 + if (Object.keys(order_prom_list).length > 0) {
  2604 + if (order_prom_list.discount_amount)
  2605 + order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2);
  2606 + if (order_prom_list.order_prom_amount)
  2607 + order_prom_list.order_prom_amount = parseFloat(order_prom_list.order_prom_amount).toFixed(2);
2604 item.order_prom_list = order_prom_list; 2608 item.order_prom_list = order_prom_list;
2605 } 2609 }
2606 2610
@@ -2622,18 +2626,18 @@ Page({ @@ -2622,18 +2626,18 @@ Page({
2622 //房间号的ids 2626 //房间号的ids
2623 var room_ids = ""; 2627 var room_ids = "";
2624 2628
2625 - //-- 把券的钱,写入从表 ---  
2626 - if (t_item.quan_youhui_list && t_item.coupon_price) { 2629 + //-- 把券的钱,写入从表 ---
  2630 + if (t_item.quan_youhui_list && t_item.coupon_price) {
2627 for (var kk in t_item.quan_youhui_list) { 2631 for (var kk in t_item.quan_youhui_list) {
2628 var you_item = t_item.quan_youhui_list[kk]; 2632 var you_item = t_item.quan_youhui_list[kk];
2629 //-- 对券的价格进行平摊 -- 2633 //-- 对券的价格进行平摊 --
2630 - await th.split_set_goods_quanprice(you_item,t_item); 2634 + await th.split_set_goods_quanprice(you_item, t_item);
2631 } 2635 }
2632 } 2636 }
2633 //-------------让商品添加到商品列表-------------------- 2637 //-------------让商品添加到商品列表--------------------
2634 for (var k = 0; k < t_item.goods.length; k++) { 2638 for (var k = 0; k < t_item.goods.length; k++) {
2635 var g_item = t_item.goods[k]; 2639 var g_item = t_item.goods[k];
2636 - if(g_item.goods_num<=0) continue; 2640 + if (g_item.goods_num <= 0) continue;
2637 var goods = { 2641 var goods = {
2638 'goods_id': g_item.goods_id, 2642 'goods_id': g_item.goods_id,
2639 'goods_name': g_item.goods_name, 2643 'goods_name': g_item.goods_name,
@@ -2646,20 +2650,20 @@ Page({ @@ -2646,20 +2650,20 @@ Page({
2646 }; 2650 };
2647 2651
2648 //-- 线下取价也要写入,组合购的商品不能去线下价格 -- 2652 //-- 线下取价也要写入,组合购的商品不能去线下价格 --
2649 - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type!=7) { 2653 + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) {
2650 goods.goods_price = g_item.offline_price; 2654 goods.goods_price = g_item.offline_price;
2651 goods.member_goods_price = g_item.offline_price; 2655 goods.member_goods_price = g_item.offline_price;
2652 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); 2656 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
2653 goods.pricing_type = g_item.pricing_type; 2657 goods.pricing_type = g_item.pricing_type;
2654 } 2658 }
2655 - if(g_item.quan_num){  
2656 - goods.quan_num=g_item.quan_num;  
2657 - goods.quan_no=g_item.quan_no; 2659 + if (g_item.quan_num) {
  2660 + goods.quan_num = g_item.quan_num;
  2661 + goods.quan_no = g_item.quan_no;
2658 } 2662 }
2659 //--判断活动的类型-- 2663 //--判断活动的类型--
2660 switch (g_item.prom_type) { 2664 switch (g_item.prom_type) {
2661 case 1: 2665 case 1:
2662 - case 2: 2666 + case 2:
2663 case 10: 2667 case 10:
2664 goods.prom_type = g_item.prom_type; 2668 goods.prom_type = g_item.prom_type;
2665 goods.prom_id = g_item.prom_id; 2669 goods.prom_id = g_item.prom_id;
@@ -2702,7 +2706,7 @@ Page({ @@ -2702,7 +2706,7 @@ Page({
2702 } 2706 }
2703 2707
2704 //把优惠的平摊结果写进去 2708 //把优惠的平摊结果写进去
2705 - if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account!=undefined)) { 2709 + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) {
2706 if (g_item.account >= 0) goods.account = g_item.account; 2710 if (g_item.account >= 0) goods.account = g_item.account;
2707 if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; 2711 if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu;
2708 item.is_discount_amount = 1; 2712 item.is_discount_amount = 1;
@@ -2713,7 +2717,7 @@ Page({ @@ -2713,7 +2717,7 @@ Page({
2713 goods.guide_id = g_item.guide_id; 2717 goods.guide_id = g_item.guide_id;
2714 goods.guide_type = g_item.guide_type; 2718 goods.guide_type = g_item.guide_type;
2715 //调用接口判断是不是会员 2719 //调用接口判断是不是会员
2716 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { 2720 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => {
2717 if (res.data.code == 0) { 2721 if (res.data.code == 0) {
2718 goods.guide_name = res.data.data.salesman; 2722 goods.guide_name = res.data.data.salesman;
2719 goods.guide_sn = res.data.data.salesman_no; 2723 goods.guide_sn = res.data.data.salesman_no;
@@ -2727,8 +2731,8 @@ Page({ @@ -2727,8 +2731,8 @@ Page({
2727 } 2731 }
2728 2732
2729 //如果有阶梯促销 2733 //如果有阶梯促销
2730 - if(g_item.ladder_list_id){  
2731 - goods.ladder_list_id=g_item.ladder_list_id; 2734 + if (g_item.ladder_list_id) {
  2735 + goods.ladder_list_id = g_item.ladder_list_id;
2732 } 2736 }
2733 2737
2734 item.order_goods.push(goods); 2738 item.order_goods.push(goods);
@@ -2741,11 +2745,11 @@ Page({ @@ -2741,11 +2745,11 @@ Page({
2741 2745
2742 2746
2743 } 2747 }
2744 - 2748 +
2745 if (pdata.length == 0) return; 2749 if (pdata.length == 0) return;
2746 var str = JSON.stringify(pdata); 2750 var str = JSON.stringify(pdata);
2747 2751
2748 - wx.showLoading({title: "加载中"}); 2752 + wx.showLoading({ title: "加载中" });
2749 wx.request({ 2753 wx.request({
2750 url: oo.url + '/api/weshop/order/createWxdOrder', 2754 url: oo.url + '/api/weshop/order/createWxdOrder',
2751 data: str, 2755 data: str,
@@ -2774,7 +2778,7 @@ Page({ @@ -2774,7 +2778,7 @@ Page({
2774 }) 2778 })
2775 //要进行判断,如果是用微信支付,就要跳转到支付界面 2779 //要进行判断,如果是用微信支付,就要跳转到支付界面
2776 if (order_amount > 0) { 2780 if (order_amount > 0) {
2777 - th.setData({isclose: 0}); 2781 + th.setData({ isclose: 0 });
2778 //void e.jumpToCart4({ 2782 //void e.jumpToCart4({
2779 // order_sn: data.data, 2783 // order_sn: data.data,
2780 //}, 1); 2784 //}, 1);
@@ -2789,12 +2793,12 @@ Page({ @@ -2789,12 +2793,12 @@ Page({
2789 }, function () { 2793 }, function () {
2790 //支付失败 2794 //支付失败
2791 setTimeout(function () { 2795 setTimeout(function () {
2792 - var cps=getCurrentPages();  
2793 - if(cps.length>1){  
2794 - wx.navigateBack({delta: 1})  
2795 - }else{  
2796 - getApp().goto("/pages/index/index/index");  
2797 - } 2796 + var cps = getCurrentPages();
  2797 + if (cps.length > 1) {
  2798 + wx.navigateBack({ delta: 1 })
  2799 + } else {
  2800 + getApp().goto("/pages/index/index/index");
  2801 + }
2798 2802
2799 }, 1000) 2803 }, 1000)
2800 }, oo.stoid); 2804 }, oo.stoid);
@@ -2812,7 +2816,7 @@ Page({ @@ -2812,7 +2816,7 @@ Page({
2812 if (t.data.code == 0) { 2816 if (t.data.code == 0) {
2813 //app.my_warnning("支付成功",1,th); 2817 //app.my_warnning("支付成功",1,th);
2814 //setTimeout(function () { 2818 //setTimeout(function () {
2815 - th.setData({isclose: 0}); 2819 + th.setData({ isclose: 0 });
2816 wx.redirectTo({ 2820 wx.redirectTo({
2817 url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, 2821 url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data,
2818 }) 2822 })
@@ -2837,7 +2841,7 @@ Page({ @@ -2837,7 +2841,7 @@ Page({
2837 cancelText: '取消', 2841 cancelText: '取消',
2838 confirmText: '确定', 2842 confirmText: '确定',
2839 showCancel: true, 2843 showCancel: true,
2840 - success(res){ 2844 + success(res) {
2841 if (res.cancel) { 2845 if (res.cancel) {
2842 return; 2846 return;
2843 } else if (res.confirm) { 2847 } else if (res.confirm) {
@@ -2871,11 +2875,11 @@ Page({ @@ -2871,11 +2875,11 @@ Page({
2871 2875
2872 }, 2876 },
2873 //---确认线下门店的数量足不足--- 2877 //---确认线下门店的数量足不足---
2874 - async check_store_num(goods_id, pick, goods_num, func){ 2878 + async check_store_num(goods_id, pick, goods_num, func) {
2875 var lock = 0, pick_no, plist, erpwareid; 2879 var lock = 0, pick_no, plist, erpwareid;
2876 //先读取门店的lock 2880 //先读取门店的lock
2877 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 2881 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
2878 - data: {store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000} 2882 + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }
2879 }).then(res => { 2883 }).then(res => {
2880 if (res.data.code == 0 && res.data.data.total > 0) { 2884 if (res.data.code == 0 && res.data.data.total > 0) {
2881 for (var i in res.data.data.pageData) 2885 for (var i in res.data.data.pageData)
@@ -2884,7 +2888,7 @@ Page({ @@ -2884,7 +2888,7 @@ Page({
2884 }) 2888 })
2885 //先获取门店的编号 2889 //先获取门店的编号
2886 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { 2890 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
2887 - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} 2891 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
2888 }).then(res => { 2892 }).then(res => {
2889 if (res.data.code == 0) { 2893 if (res.data.code == 0) {
2890 pick_no = res.data.data.pickup_no; 2894 pick_no = res.data.data.pickup_no;
@@ -2892,7 +2896,7 @@ Page({ @@ -2892,7 +2896,7 @@ Page({
2892 }) 2896 })
2893 //先获取商品的线下库存 2897 //先获取商品的线下库存
2894 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { 2898 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
2895 - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} 2899 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
2896 }).then(res => { 2900 }).then(res => {
2897 if (res.data.code == 0) { 2901 if (res.data.code == 0) {
2898 erpwareid = res.data.data.erpwareid; 2902 erpwareid = res.data.data.erpwareid;
@@ -2900,7 +2904,7 @@ Page({ @@ -2900,7 +2904,7 @@ Page({
2900 }) 2904 })
2901 //读取线下的门店库存 2905 //读取线下的门店库存
2902 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { 2906 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
2903 - data: {storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000} 2907 + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 }
2904 }).then(res => { 2908 }).then(res => {
2905 if (res.data.code == 0) { 2909 if (res.data.code == 0) {
2906 plist = res.data.data.pageData[0]; 2910 plist = res.data.data.pageData[0];
@@ -2942,11 +2946,11 @@ Page({ @@ -2942,11 +2946,11 @@ Page({
2942 wl_txt = t.currentTarget.dataset.wl_txt, 2946 wl_txt = t.currentTarget.dataset.wl_txt,
2943 ont = t.currentTarget.dataset.ont; 2947 ont = t.currentTarget.dataset.ont;
2944 2948
2945 - th.setData({[txt]: ty}); 2949 + th.setData({ [txt]: ty });
2946 var iszt = 1; 2950 var iszt = 1;
2947 2951
2948 if (ty == 0) { 2952 if (ty == 0) {
2949 - th.setData({is_all_zt: 0}); 2953 + th.setData({ is_all_zt: 0 });
2950 } else { 2954 } else {
2951 for (var i = 0; i < th.data.cartlist.length; i++) { 2955 for (var i = 0; i < th.data.cartlist.length; i++) {
2952 var item = th.data.cartlist[i]; 2956 var item = th.data.cartlist[i];
@@ -2956,7 +2960,7 @@ Page({ @@ -2956,7 +2960,7 @@ Page({
2956 } 2960 }
2957 } 2961 }
2958 2962
2959 - th.setData({is_all_zt: iszt}); 2963 + th.setData({ is_all_zt: iszt });
2960 2964
2961 var ind = t.currentTarget.dataset.ind; 2965 var ind = t.currentTarget.dataset.ind;
2962 var c_item = th.data.cartlist[ind]; 2966 var c_item = th.data.cartlist[ind];
@@ -2964,7 +2968,7 @@ Page({ @@ -2964,7 +2968,7 @@ Page({
2964 2968
2965 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) { 2969 if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) {
2966 th.data.using_quan[pickid] = {}; 2970 th.data.using_quan[pickid] = {};
2967 - th.setData({using_quan: th.data.using_quan}); 2971 + th.setData({ using_quan: th.data.using_quan });
2968 } 2972 }
2969 2973
2970 2974
@@ -2976,7 +2980,7 @@ Page({ @@ -2976,7 +2980,7 @@ Page({
2976 for (var i = 0; i < wu_arr.length; i++) { 2980 for (var i = 0; i < wu_arr.length; i++) {
2977 if (wu_arr[i].shipping_code == def_exp_code) { 2981 if (wu_arr[i].shipping_code == def_exp_code) {
2978 var set_txt = "cartlist" 2982 var set_txt = "cartlist"
2979 - th.setData({wl_txt: i}); 2983 + th.setData({ wl_txt: i });
2980 } 2984 }
2981 } 2985 }
2982 } 2986 }
@@ -2989,9 +2993,9 @@ Page({ @@ -2989,9 +2993,9 @@ Page({
2989 setexptype: function (t) { 2993 setexptype: function (t) {
2990 var th = this; 2994 var th = this;
2991 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; 2995 var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code;
2992 - th.setData({bn_exp_type: ty}); 2996 + th.setData({ bn_exp_type: ty });
2993 if (ty == 0) { 2997 if (ty == 0) {
2994 - th.setData({is_all_zt: 0}); 2998 + th.setData({ is_all_zt: 0 });
2995 } 2999 }
2996 3000
2997 //当物流为空的时候。 3001 //当物流为空的时候。
@@ -3004,7 +3008,7 @@ Page({ @@ -3004,7 +3008,7 @@ Page({
3004 if (ty == 1) { 3008 if (ty == 1) {
3005 th.data.isget_by_quan = {}; 3009 th.data.isget_by_quan = {};
3006 if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { 3010 if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) {
3007 - th.setData({using_quan: {}}); 3011 + th.setData({ using_quan: {} });
3008 } 3012 }
3009 } 3013 }
3010 3014
@@ -3014,7 +3018,7 @@ Page({ @@ -3014,7 +3018,7 @@ Page({
3014 if (wu_arr != null && wu_arr != "") { 3018 if (wu_arr != null && wu_arr != "") {
3015 for (var i = 0; i < wu_arr.length; i++) { 3019 for (var i = 0; i < wu_arr.length; i++) {
3016 if (wu_arr[i].shipping_code == def_exp_code) { 3020 if (wu_arr[i].shipping_code == def_exp_code) {
3017 - th.setData({index: i}); 3021 + th.setData({ index: i });
3018 } 3022 }
3019 } 3023 }
3020 } 3024 }
@@ -3026,21 +3030,21 @@ Page({ @@ -3026,21 +3030,21 @@ Page({
3026 //--------立即购买时,使用余额-------- 3030 //--------立即购买时,使用余额--------
3027 set_bn_useyuer: function () { 3031 set_bn_useyuer: function () {
3028 var th = this; 3032 var th = this;
3029 - th.setData({bn_use_money: !th.data.bn_use_money}); 3033 + th.setData({ bn_use_money: !th.data.bn_use_money });
3030 th.calculatePrice2(); 3034 th.calculatePrice2();
3031 }, 3035 },
3032 set_js_useyuer: function () { 3036 set_js_useyuer: function () {
3033 var th = this; 3037 var th = this;
3034 - th.setData({js_use_money: !th.data.js_use_money}); 3038 + th.setData({ js_use_money: !th.data.js_use_money });
3035 th.calculatePrice(); 3039 th.calculatePrice();
3036 }, 3040 },
3037 //-------------------计算物流--------------- 3041 //-------------------计算物流---------------
3038 - calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,  
3039 - goods_piece, user_addr, freight_free, o_price, rs) { 3042 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  3043 + goods_piece, user_addr, freight_free, o_price, rs, pickid) {
3040 var price = 0, th = this; 3044 var price = 0, th = this;
3041 price += parseFloat(o_shipping_price); 3045 price += parseFloat(o_shipping_price);
3042 //如果是包邮 3046 //如果是包邮
3043 - if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { 3047 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) {
3044 return 0; 3048 return 0;
3045 } 3049 }
3046 if (user_addr == null) { 3050 if (user_addr == null) {
@@ -3067,7 +3071,7 @@ Page({ @@ -3067,7 +3071,7 @@ Page({
3067 } 3071 }
3068 } 3072 }
3069 //------超出重量---------- 3073 //------超出重量----------
3070 - if(out_of_weight < 0 && o_price >= freight_free){ 3074 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
3071 fw_price = parseFloat(item['money']); 3075 fw_price = parseFloat(item['money']);
3072 var out_of_weight = Math.abs(out_of_weight); 3076 var out_of_weight = Math.abs(out_of_weight);
3073 if (out_of_weight > item['first_weight']) { 3077 if (out_of_weight > item['first_weight']) {
@@ -3113,13 +3117,13 @@ Page({ @@ -3113,13 +3117,13 @@ Page({
3113 //----------立即购买,选择物流------------- 3117 //----------立即购买,选择物流-------------
3114 bindPickerChange: function (e) { 3118 bindPickerChange: function (e) {
3115 var ind = e.detail.value 3119 var ind = e.detail.value
3116 - this.setData({index: ind}); 3120 + this.setData({ index: ind });
3117 this.calculatePrice2(); 3121 this.calculatePrice2();
3118 }, 3122 },
3119 //----------购物车结算,选择物流------------- 3123 //----------购物车结算,选择物流-------------
3120 bindPickerChange_w: function (e) { 3124 bindPickerChange_w: function (e) {
3121 var ind = e.detail.value, txt = e.currentTarget.dataset.txt; 3125 var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
3122 - this.setData({[txt]: ind}); 3126 + this.setData({ [txt]: ind });
3123 this.calculatePrice(); 3127 this.calculatePrice();
3124 }, 3128 },
3125 3129
@@ -3133,7 +3137,7 @@ Page({ @@ -3133,7 +3137,7 @@ Page({
3133 3137
3134 3138
3135 if (bn == 1) { 3139 if (bn == 1) {
3136 - th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); 3140 + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 });
3137 } else { 3141 } else {
3138 //---多单打开券的时候,就要判断券在其他门店是否有使用--- 3142 //---多单打开券的时候,就要判断券在其他门店是否有使用---
3139 var quanlist = th.data.cartlist[cindx].quan_list; 3143 var quanlist = th.data.cartlist[cindx].quan_list;
@@ -3159,9 +3163,9 @@ Page({ @@ -3159,9 +3163,9 @@ Page({
3159 else 3163 else
3160 get_by_quan_list_cart[i].show_red = 0; 3164 get_by_quan_list_cart[i].show_red = 0;
3161 } 3165 }
3162 - th.setData({by_quan_list_cart: get_by_quan_list_cart}); 3166 + th.setData({ by_quan_list_cart: get_by_quan_list_cart });
3163 } else { 3167 } else {
3164 - th.setData({by_quan_list_cart: null}); 3168 + th.setData({ by_quan_list_cart: null });
3165 } 3169 }
3166 3170
3167 console.log("2222222券的列表", quanlist); 3171 console.log("2222222券的列表", quanlist);
@@ -3177,7 +3181,7 @@ Page({ @@ -3177,7 +3181,7 @@ Page({
3177 }, 3181 },
3178 close_coupon: function (e) { 3182 close_coupon: function (e) {
3179 var th = this; 3183 var th = this;
3180 - th.setData({open_quan: 0, disabled: 0}); 3184 + th.setData({ open_quan: 0, disabled: 0 });
3181 }, 3185 },
3182 3186
3183 //---判断券时候在已经选择的列表中--- 3187 //---判断券时候在已经选择的列表中---
@@ -3248,14 +3252,14 @@ Page({ @@ -3248,14 +3252,14 @@ Page({
3248 for (var i in quanlist) { 3252 for (var i in quanlist) {
3249 quanlist[i].show_red = 0; 3253 quanlist[i].show_red = 0;
3250 } 3254 }
3251 - this.setData({selected_quan_list: quanlist}); 3255 + this.setData({ selected_quan_list: quanlist });
3252 var by_quanlist = this.data.get_by_quan_list; 3256 var by_quanlist = this.data.get_by_quan_list;
3253 if (by_quanlist) { 3257 if (by_quanlist) {
3254 //---所有的券的显示红色选择都清理一遍--- 3258 //---所有的券的显示红色选择都清理一遍---
3255 for (var inb in by_quanlist) { 3259 for (var inb in by_quanlist) {
3256 by_quanlist[inb].show_red = 0; 3260 by_quanlist[inb].show_red = 0;
3257 } 3261 }
3258 - this.setData({get_by_quan_list: by_quanlist}); 3262 + this.setData({ get_by_quan_list: by_quanlist });
3259 } 3263 }
3260 3264
3261 var by_cart_list = this.data.by_quan_list_cart; 3265 var by_cart_list = this.data.by_quan_list_cart;
@@ -3264,7 +3268,7 @@ Page({ @@ -3264,7 +3268,7 @@ Page({
3264 for (var inc in by_cart_list) { 3268 for (var inc in by_cart_list) {
3265 by_cart_list[inc].show_red = 0; 3269 by_cart_list[inc].show_red = 0;
3266 } 3270 }
3267 - this.setData({by_quan_list_cart: by_cart_list}); 3271 + this.setData({ by_quan_list_cart: by_cart_list });
3268 } 3272 }
3269 3273
3270 var using_quan = this.data.using_quan; 3274 var using_quan = this.data.using_quan;
@@ -3276,9 +3280,9 @@ Page({ @@ -3276,9 +3280,9 @@ Page({
3276 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 3280 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
3277 } 3281 }
3278 else { 3282 else {
3279 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 3283 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
3280 } 3284 }
3281 - this.setData({using_quan: using_quan, is_coupon: th.is_coupon}); 3285 + this.setData({ using_quan: using_quan, is_coupon: th.is_coupon });
3282 return; 3286 return;
3283 } 3287 }
3284 3288
@@ -3295,9 +3299,9 @@ Page({ @@ -3295,9 +3299,9 @@ Page({
3295 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 3299 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
3296 } 3300 }
3297 else { 3301 else {
3298 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 3302 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
3299 } 3303 }
3300 - this.setData({using_quan: using_quan}); 3304 + this.setData({ using_quan: using_quan });
3301 3305
3302 }, 3306 },
3303 3307
@@ -3312,7 +3316,7 @@ Page({ @@ -3312,7 +3316,7 @@ Page({
3312 for (var ind in by_quanlist) { 3316 for (var ind in by_quanlist) {
3313 by_quanlist[ind].show_red = 0; 3317 by_quanlist[ind].show_red = 0;
3314 } 3318 }
3315 - this.setData({get_by_quan_list: by_quanlist}); 3319 + this.setData({ get_by_quan_list: by_quanlist });
3316 } 3320 }
3317 3321
3318 //--购物车过来的包邮券-- 3322 //--购物车过来的包邮券--
@@ -3322,7 +3326,7 @@ Page({ @@ -3322,7 +3326,7 @@ Page({
3322 for (var ind in by_cart_list) { 3326 for (var ind in by_cart_list) {
3323 by_cart_list[ind].show_red = 0; 3327 by_cart_list[ind].show_red = 0;
3324 } 3328 }
3325 - this.setData({by_quan_list_cart: by_cart_list}); 3329 + this.setData({ by_quan_list_cart: by_cart_list });
3326 } 3330 }
3327 //普通券 3331 //普通券
3328 var quanlist = this.data.selected_quan_list; 3332 var quanlist = this.data.selected_quan_list;
@@ -3331,7 +3335,7 @@ Page({ @@ -3331,7 +3335,7 @@ Page({
3331 for (var ind in quanlist) { 3335 for (var ind in quanlist) {
3332 quanlist[ind].show_red = 0; 3336 quanlist[ind].show_red = 0;
3333 } 3337 }
3334 - this.setData({selected_quan_list: quanlist}); 3338 + this.setData({ selected_quan_list: quanlist });
3335 } 3339 }
3336 3340
3337 var th = this; 3341 var th = this;
@@ -3342,9 +3346,9 @@ Page({ @@ -3342,9 +3346,9 @@ Page({
3342 using_quan[th.data.selected_quan_pick].is_nouse_red = 1; 3346 using_quan[th.data.selected_quan_pick].is_nouse_red = 1;
3343 } 3347 }
3344 else { 3348 else {
3345 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; 3349 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 };
3346 } 3350 }
3347 - this.setData({using_quan: using_quan, is_coupon: th.is_coupon}); 3351 + this.setData({ using_quan: using_quan, is_coupon: th.is_coupon });
3348 return; 3352 return;
3349 } 3353 }
3350 3354
@@ -3373,9 +3377,9 @@ Page({ @@ -3373,9 +3377,9 @@ Page({
3373 using_quan[th.data.selected_quan_pick].is_nouse_red = 0; 3377 using_quan[th.data.selected_quan_pick].is_nouse_red = 0;
3374 } 3378 }
3375 else { 3379 else {
3376 - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; 3380 + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 };
3377 } 3381 }
3378 - this.setData({using_quan: using_quan}); 3382 + this.setData({ using_quan: using_quan });
3379 }, 3383 },
3380 3384
3381 //--确认使用券--- 3385 //--确认使用券---
@@ -3435,14 +3439,14 @@ Page({ @@ -3435,14 +3439,14 @@ Page({
3435 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 3439 //选择了的券,看是不是点击了不使用券,点击了不使用优惠券
3436 if (using_quan[pickid]) { 3440 if (using_quan[pickid]) {
3437 if (using_quan[pickid].is_nouse_red == 1) { 3441 if (using_quan[pickid].is_nouse_red == 1) {
3438 - using_quan[pickid] = {is_nouse_red: 1};  
3439 - th.setData({using_quan: using_quan}); 3442 + using_quan[pickid] = { is_nouse_red: 1 };
  3443 + th.setData({ using_quan: using_quan });
3440 if (th.data.is_b_now == 1) { 3444 if (th.data.is_b_now == 1) {
3441 th.calculatePrice2(); 3445 th.calculatePrice2();
3442 } else { 3446 } else {
3443 th.calculatePrice(); 3447 th.calculatePrice();
3444 } 3448 }
3445 - th.setData({open_quan: 0}); 3449 + th.setData({ open_quan: 0 });
3446 return; 3450 return;
3447 } 3451 }
3448 } 3452 }
@@ -3461,16 +3465,16 @@ Page({ @@ -3461,16 +3465,16 @@ Page({
3461 }; 3465 };
3462 using_quan[pickid].isby = 1; 3466 using_quan[pickid].isby = 1;
3463 } else { 3467 } else {
3464 - using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; 3468 + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
3465 using_quan[pickid].isby = 0; 3469 using_quan[pickid].isby = 0;
3466 } 3470 }
3467 - this.setData({using_quan: using_quan}); 3471 + this.setData({ using_quan: using_quan });
3468 if (th.data.is_b_now == 1) { 3472 if (th.data.is_b_now == 1) {
3469 th.calculatePrice2(); 3473 th.calculatePrice2();
3470 } else { 3474 } else {
3471 th.calculatePrice(); 3475 th.calculatePrice();
3472 } 3476 }
3473 - th.setData({open_quan: 0}); 3477 + th.setData({ open_quan: 0 });
3474 }, 3478 },
3475 3479
3476 cart_set_err: function (e) { 3480 cart_set_err: function (e) {
@@ -3507,7 +3511,7 @@ Page({ @@ -3507,7 +3511,7 @@ Page({
3507 var wu_arr_txt = e.currentTarget.dataset.txt; 3511 var wu_arr_txt = e.currentTarget.dataset.txt;
3508 var w_sele_index = e.currentTarget.dataset.w_sele_index; 3512 var w_sele_index = e.currentTarget.dataset.w_sele_index;
3509 var is_express = null; 3513 var is_express = null;
3510 - var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; 3514 + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 };
3511 3515
3512 //--如果是多个门店的时候-- 3516 //--如果是多个门店的时候--
3513 if (w_sele_index != undefined) { 3517 if (w_sele_index != undefined) {
@@ -3518,20 +3522,20 @@ Page({ @@ -3518,20 +3522,20 @@ Page({
3518 }, 3522 },
3519 // 关闭物流的弹窗 3523 // 关闭物流的弹窗
3520 close_express: function () { 3524 close_express: function () {
3521 - this.setData({open_express: 0, disabled: 0}); 3525 + this.setData({ open_express: 0, disabled: 0 });
3522 }, 3526 },
3523 // 选择物流 3527 // 选择物流
3524 click_express_name: function (e) { 3528 click_express_name: function (e) {
3525 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; 3529 var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
3526 var index = e.currentTarget.dataset.idxe; 3530 var index = e.currentTarget.dataset.idxe;
3527 - var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; 3531 + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 };
3528 ob[this.data.wu_arr_txt] = index; 3532 ob[this.data.wu_arr_txt] = index;
3529 this.setData(ob); 3533 this.setData(ob);
3530 }, 3534 },
3531 3535
3532 //点击确定物流 3536 //点击确定物流
3533 determine_expres: function (e) { 3537 determine_expres: function (e) {
3534 - this.setData({open_express: 0}); 3538 + this.setData({ open_express: 0 });
3535 if (this.data.is_b_now == 1) 3539 if (this.data.is_b_now == 1)
3536 this.calculatePrice2(); 3540 this.calculatePrice2();
3537 else 3541 else
@@ -3551,7 +3555,7 @@ Page({ @@ -3551,7 +3555,7 @@ Page({
3551 obj[txt] = is_open; 3555 obj[txt] = is_open;
3552 3556
3553 this.setData(obj); 3557 this.setData(obj);
3554 - this.setData({disabled: 1}) 3558 + this.setData({ disabled: 1 })
3555 }, 3559 },
3556 3560
3557 clik_coupons2: function (e) { 3561 clik_coupons2: function (e) {
@@ -3566,7 +3570,7 @@ Page({ @@ -3566,7 +3570,7 @@ Page({
3566 obj[txt] = is_open; 3570 obj[txt] = is_open;
3567 3571
3568 this.setData(obj); 3572 this.setData(obj);
3569 - this.setData({disabled: 1}) 3573 + this.setData({ disabled: 1 })
3570 }, 3574 },
3571 3575
3572 3576
@@ -3575,11 +3579,11 @@ Page({ @@ -3575,11 +3579,11 @@ Page({
3575 var th = this; 3579 var th = this;
3576 var is_shipping_code = this.data.is_shipping_code 3580 var is_shipping_code = this.data.is_shipping_code
3577 getApp().request.put("/api/weshop/users/update", { 3581 getApp().request.put("/api/weshop/users/update", {
3578 - data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, 3582 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
3579 success: function (rse) { 3583 success: function (rse) {
3580 if (rse.data.code == 0) { 3584 if (rse.data.code == 0) {
3581 getApp().globalData.userInfo.def_exp_code = is_shipping_code; 3585 getApp().globalData.userInfo.def_exp_code = is_shipping_code;
3582 - th.setData({open_express: 0}); 3586 + th.setData({ open_express: 0 });
3583 //----计算此时购物车的价格---- 3587 //----计算此时购物车的价格----
3584 if (th.data.is_b_now == 1) th.calculatePrice2(); 3588 if (th.data.is_b_now == 1) th.calculatePrice2();
3585 else th.calculatePrice(); 3589 else th.calculatePrice();
@@ -3589,7 +3593,7 @@ Page({ @@ -3589,7 +3593,7 @@ Page({
3589 }, 3593 },
3590 3594
3591 //更新下默认,在onshow里面 3595 //更新下默认,在onshow里面
3592 - update_code(){ 3596 + update_code() {
3593 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; 3597 var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
3594 //--定时器,判断wu_arr不未空-- 3598 //--定时器,判断wu_arr不未空--
3595 var uii = setInterval(function () { 3599 var uii = setInterval(function () {
@@ -3603,7 +3607,7 @@ Page({ @@ -3603,7 +3607,7 @@ Page({
3603 } 3607 }
3604 //--如果是立即购买-- 3608 //--如果是立即购买--
3605 if (th.data.is_b_now == 1) { 3609 if (th.data.is_b_now == 1) {
3606 - th.setData({index: m_wind, is_express: m_wind}); 3610 + th.setData({ index: m_wind, is_express: m_wind });
3607 } else { 3611 } else {
3608 var ui = setInterval(function () { 3612 var ui = setInterval(function () {
3609 if (th.data.cartlist) { 3613 if (th.data.cartlist) {
@@ -3611,7 +3615,7 @@ Page({ @@ -3611,7 +3615,7 @@ Page({
3611 for (var i in c_arr) { 3615 for (var i in c_arr) {
3612 c_arr[i].wind = m_wind; 3616 c_arr[i].wind = m_wind;
3613 } 3617 }
3614 - th.setData({cartlist: c_arr, is_express: m_wind}) 3618 + th.setData({ cartlist: c_arr, is_express: m_wind })
3615 clearInterval(ui); 3619 clearInterval(ui);
3616 } 3620 }
3617 }, 500) 3621 }, 500)
@@ -3623,7 +3627,7 @@ Page({ @@ -3623,7 +3627,7 @@ Page({
3623 get_cart_quan: async function (order_prom_list_cart) { 3627 get_cart_quan: async function (order_prom_list_cart) {
3624 var th = this; 3628 var th = this;
3625 var is_xz_yh = 1; 3629 var is_xz_yh = 1;
3626 - var user_id=getApp().globalData.user_id; 3630 + var user_id = getApp().globalData.user_id;
3627 //等待值的出现 3631 //等待值的出现
3628 //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { 3632 //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () {
3629 //var arr=th.data.order_prom_list_cart; 3633 //var arr=th.data.order_prom_list_cart;
@@ -3642,8 +3646,8 @@ Page({ @@ -3642,8 +3646,8 @@ Page({
3642 var ckeck_quan_price = 0, 3646 var ckeck_quan_price = 0,
3643 check_quan_price_list = '', 3647 check_quan_price_list = '',
3644 check_quan_ware_list = '', 3648 check_quan_ware_list = '',
3645 - check_quan_price_list_arr=[],  
3646 - check_quan_ware_list_arr=[]; 3649 + check_quan_price_list_arr = [],
  3650 + check_quan_ware_list_arr = [];
3647 3651
3648 for (var i in goodlist) { 3652 for (var i in goodlist) {
3649 var gd = goodlist[i]; 3653 var gd = goodlist[i];
@@ -3653,25 +3657,25 @@ Page({ @@ -3653,25 +3657,25 @@ Page({
3653 } 3657 }
3654 3658
3655 //--如果是团购,要判断有没有限制使用优惠券 3659 //--如果是团购,要判断有没有限制使用优惠券
3656 - if(gd.prom_type == 2){  
3657 - var prom1=null; 3660 + if (gd.prom_type == 2) {
  3661 + var prom1 = null;
3658 await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, { 3662 await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, {
3659 }).then(res => { 3663 }).then(res => {
3660 if (res.data.code == 0) prom1 = res.data.data; 3664 if (res.data.code == 0) prom1 = res.data.data;
3661 }) 3665 })
3662 - if(prom1 && !prom1.isQuan){ 3666 + if (prom1 && !prom1.isQuan) {
3663 continue; 3667 continue;
3664 } 3668 }
3665 } 3669 }
3666 3670
3667 //--如果是团购,要判断有没有限制使用优惠券 3671 //--如果是团购,要判断有没有限制使用优惠券
3668 - if(gd.prom_type == 10){  
3669 - var prom1=null;  
3670 - await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/"+ os.stoid +"/"+user_id+"/"+ gd.prom_id, { 3672 + if (gd.prom_type == 10) {
  3673 + var prom1 = null;
  3674 + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + gd.prom_id, {
3671 }).then(res => { 3675 }).then(res => {
3672 if (res.data.code == 0) prom1 = res.data.data; 3676 if (res.data.code == 0) prom1 = res.data.data;
3673 }) 3677 })
3674 - if(prom1 && prom1.isuse && prom1. is_usecoupon){ 3678 + if (prom1 && prom1.isuse && prom1.is_usecoupon) {
3675 continue; 3679 continue;
3676 } 3680 }
3677 } 3681 }
@@ -3683,43 +3687,43 @@ Page({ @@ -3683,43 +3687,43 @@ Page({
3683 } 3687 }
3684 is_xz_yh = 0; 3688 is_xz_yh = 0;
3685 3689
3686 - var item_price = gd.goods_price * gd.goods_num;  
3687 - var item_price2=item_price; 3690 + var item_price = gd.goods_price * gd.goods_num;
  3691 + var item_price2 = item_price;
3688 3692
3689 //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- 3693 //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 --
3690 if (gd.account_fir != null && gd.account_fir != undefined) { 3694 if (gd.account_fir != null && gd.account_fir != undefined) {
3691 item_price2 = gd.account_fir * gd.goods_num; 3695 item_price2 = gd.account_fir * gd.goods_num;
3692 } 3696 }
3693 3697
3694 - if(gd.ld_account){ 3698 + if (gd.ld_account) {
3695 item_price2 = gd.ld_account * gd.goods_num; 3699 item_price2 = gd.ld_account * gd.goods_num;
3696 } 3700 }
3697 3701
3698 ckeck_quan_price += item_price; 3702 ckeck_quan_price += item_price;
3699 //如果商品有重复的过滤,一般是组合购和阶梯购的情况下 3703 //如果商品有重复的过滤,一般是组合购和阶梯购的情况下
3700 - var idx=check_quan_ware_list_arr.findIndex(function(ele){  
3701 - return ele== encodeURIComponent(gd['erpwareid']); 3704 + var idx = check_quan_ware_list_arr.findIndex(function (ele) {
  3705 + return ele == encodeURIComponent(gd['erpwareid']);
3702 }) 3706 })
3703 3707
3704 - if(idx>-1){  
3705 - check_quan_price_list_arr[idx]+=item_price2;  
3706 - }else{ 3708 + if (idx > -1) {
  3709 + check_quan_price_list_arr[idx] += item_price2;
  3710 + } else {
3707 check_quan_ware_list_arr.push(encodeURIComponent(gd['erpwareid'])); 3711 check_quan_ware_list_arr.push(encodeURIComponent(gd['erpwareid']));
3708 check_quan_price_list_arr.push(item_price2); 3712 check_quan_price_list_arr.push(item_price2);
3709 } 3713 }
3710 - //--组装价格list--  
3711 - /*--  
3712 - if (check_quan_price_list) {  
3713 - check_quan_price_list += "," + item_price;  
3714 - } else {  
3715 - check_quan_price_list = item_price;  
3716 - }  
3717 - //--组装商品的线下erpwareid--  
3718 - if (check_quan_ware_list) {  
3719 - check_quan_ware_list += "," + encodeURIComponent(gd['erpwareid']);  
3720 - } else {  
3721 - check_quan_ware_list = encodeURIComponent(gd['erpwareid']);  
3722 - }---*/ 3714 + //--组装价格list--
  3715 + /*--
  3716 + if (check_quan_price_list) {
  3717 + check_quan_price_list += "," + item_price;
  3718 + } else {
  3719 + check_quan_price_list = item_price;
  3720 + }
  3721 + //--组装商品的线下erpwareid--
  3722 + if (check_quan_ware_list) {
  3723 + check_quan_ware_list += "," + encodeURIComponent(gd['erpwareid']);
  3724 + } else {
  3725 + check_quan_ware_list = encodeURIComponent(gd['erpwareid']);
  3726 + }---*/
3723 } 3727 }
3724 //优惠券优惠的金额要控制到优惠券的选择条件 3728 //优惠券优惠的金额要控制到优惠券的选择条件
3725 var cut_price = 0; 3729 var cut_price = 0;
@@ -3730,16 +3734,16 @@ Page({ @@ -3730,16 +3734,16 @@ Page({
3730 } 3734 }
3731 } 3735 }
3732 3736
3733 - var prom_pt_json= ep.prom_pt_json;  
3734 - if(prom_pt_json){  
3735 - for(let oj in prom_pt_json){  
3736 - let item_j=prom_pt_json[oj]; 3737 + var prom_pt_json = ep.prom_pt_json;
  3738 + if (prom_pt_json) {
  3739 + for (let oj in prom_pt_json) {
  3740 + let item_j = prom_pt_json[oj];
3737 3741
3738 //要对一下阶梯优惠促销的功能 3742 //要对一下阶梯优惠促销的功能
3739 - if(item_j.ladder_prom_id){ 3743 + if (item_j.ladder_prom_id) {
3740 3744
3741 //看一下要不要限制使用优惠券 3745 //看一下要不要限制使用优惠券
3742 - if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon){ 3746 + if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon) {
3743 continue; 3747 continue;
3744 } 3748 }
3745 3749
@@ -3748,10 +3752,10 @@ Page({ @@ -3748,10 +3752,10 @@ Page({
3748 } 3752 }
3749 } 3753 }
3750 3754
3751 - if(check_quan_price_list_arr.length) check_quan_price_list=check_quan_price_list_arr.join(',');  
3752 - if(check_quan_ware_list_arr.length) check_quan_ware_list=check_quan_ware_list_arr.join(',') 3755 + if (check_quan_price_list_arr.length) check_quan_price_list = check_quan_price_list_arr.join(',');
  3756 + if (check_quan_ware_list_arr.length) check_quan_ware_list = check_quan_ware_list_arr.join(',')
3753 3757
3754 - arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price?cut_price:0); 3758 + arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price ? cut_price : 0);
3755 arr[ind].check_quan_ware_list = check_quan_ware_list; 3759 arr[ind].check_quan_ware_list = check_quan_ware_list;
3756 arr[ind].check_quan_price_list = check_quan_price_list; 3760 arr[ind].check_quan_price_list = check_quan_price_list;
3757 arr[ind].is_xz_yh = is_xz_yh; 3761 arr[ind].is_xz_yh = is_xz_yh;
@@ -3781,10 +3785,10 @@ Page({ @@ -3781,10 +3785,10 @@ Page({
3781 if (th.data.is_b_now) { 3785 if (th.data.is_b_now) {
3782 if (arr && arr.length > 0) { 3786 if (arr && arr.length > 0) {
3783 var quanlist = arr[0].quan_list; 3787 var quanlist = arr[0].quan_list;
3784 - th.setData({selected_quan_list: quanlist, cartlist: arr}) 3788 + th.setData({ selected_quan_list: quanlist, cartlist: arr })
3785 } 3789 }
3786 } else { 3790 } else {
3787 - th.setData({cartlist: arr}) 3791 + th.setData({ cartlist: arr })
3788 th.set_can_num(); 3792 th.set_can_num();
3789 } 3793 }
3790 3794
@@ -3804,7 +3808,7 @@ Page({ @@ -3804,7 +3808,7 @@ Page({
3804 if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) { 3808 if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) {
3805 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 3809 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
3806 var url = "/api/weshop/couponList/getUseCouponList"; 3810 var url = "/api/weshop/couponList/getUseCouponList";
3807 - app.request.promiseGet(url0, {1: 1}).then(res => { 3811 + app.request.promiseGet(url0, { 1: 1 }).then(res => {
3808 if (res.data.code == 0) { 3812 if (res.data.code == 0) {
3809 frozenQuan = res.data.data; 3813 frozenQuan = res.data.data;
3810 th.data.frozenQuan = frozenQuan; 3814 th.data.frozenQuan = frozenQuan;
@@ -3822,7 +3826,7 @@ Page({ @@ -3822,7 +3826,7 @@ Page({
3822 quanlist = res.data.data.pageData; 3826 quanlist = res.data.data.pageData;
3823 if (quanlist) { 3827 if (quanlist) {
3824 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); 3828 quanlist = th.check_is_frozenQuan(quanlist, frozenQuan);
3825 - th.setData({selected_quan_list: quanlist}) 3829 + th.setData({ selected_quan_list: quanlist })
3826 } 3830 }
3827 } 3831 }
3828 } 3832 }
@@ -3850,7 +3854,7 @@ Page({ @@ -3850,7 +3854,7 @@ Page({
3850 if (!goods_id) goods_id = this.data.bn_goods.goods_id; 3854 if (!goods_id) goods_id = this.data.bn_goods.goods_id;
3851 for (var i in arr) { 3855 for (var i in arr) {
3852 var item = arr[i]; 3856 var item = arr[i];
3853 - if (goods_id == item) return 0; 3857 + if (goods_id == item) return 0;
3854 } 3858 }
3855 return 1; 3859 return 1;
3856 }, 3860 },
@@ -3921,7 +3925,7 @@ Page({ @@ -3921,7 +3925,7 @@ Page({
3921 if (this.data.is_b_now == 1) pick = this.data.bn_pick; 3925 if (this.data.is_b_now == 1) pick = this.data.bn_pick;
3922 //---获取订单优惠--- 3926 //---获取订单优惠---
3923 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { 3927 getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
3924 - data: {store_id: os.stoid, orderAmount: condition} 3928 + data: { store_id: os.stoid, orderAmount: condition }
3925 }).then(res => { 3929 }).then(res => {
3926 if (res.data.code == 0) { 3930 if (res.data.code == 0) {
3927 var data = res.data.data; 3931 var data = res.data.data;
@@ -3943,7 +3947,7 @@ Page({ @@ -3943,7 +3947,7 @@ Page({
3943 var ob = map[pickid][item.prom_id]; 3947 var ob = map[pickid][item.prom_id];
3944 ob.price += item.goods_price * item.goods_num; 3948 ob.price += item.goods_price * item.goods_num;
3945 ob.goods_num += item.goods_num; 3949 ob.goods_num += item.goods_num;
3946 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 3950 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
3947 3951
3948 } else { 3952 } else {
3949 var prom = null; 3953 var prom = null;
@@ -3959,7 +3963,7 @@ Page({ @@ -3959,7 +3963,7 @@ Page({
3959 ob.is_bz = prom.is_bz; 3963 ob.is_bz = prom.is_bz;
3960 ob.is_xz_yh = prom.is_xz_yh; 3964 ob.is_xz_yh = prom.is_xz_yh;
3961 ob.goods = new Array(); 3965 ob.goods = new Array();
3962 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 3966 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
3963 map[pickid][item.prom_id] = ob; 3967 map[pickid][item.prom_id] = ob;
3964 } 3968 }
3965 } else { 3969 } else {
@@ -3976,7 +3980,7 @@ Page({ @@ -3976,7 +3980,7 @@ Page({
3976 ob.is_bz = prom.is_bz; 3980 ob.is_bz = prom.is_bz;
3977 ob.is_xz_yh = prom.is_xz_yh; 3981 ob.is_xz_yh = prom.is_xz_yh;
3978 ob.goods = new Array(); 3982 ob.goods = new Array();
3979 - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); 3983 + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num });
3980 3984
3981 var obj = {}; 3985 var obj = {};
3982 obj[item.prom_id] = ob; 3986 obj[item.prom_id] = ob;
@@ -3986,12 +3990,12 @@ Page({ @@ -3986,12 +3990,12 @@ Page({
3986 }, 3990 },
3987 3991
3988 //计算立即购买赠品的物流费用 3992 //计算立即购买赠品的物流费用
3989 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { 3993 + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
3990 var good = this.data.buy_now_gift_goods; 3994 var good = this.data.buy_now_gift_goods;
3991 var goods_weight = -1, goods_piece = -1; 3995 var goods_weight = -1, goods_piece = -1;
3992 var gift_shipping_price = 0; 3996 var gift_shipping_price = 0;
3993 var th = this; 3997 var th = this;
3994 - var out_of_weight=null; 3998 + var out_of_weight = null;
3995 switch (good['exp_sum_type']) { 3999 switch (good['exp_sum_type']) {
3996 case 1: 4000 case 1:
3997 //统一运费 4001 //统一运费
@@ -4003,7 +4007,7 @@ Page({ @@ -4003,7 +4007,7 @@ Page({
4003 //累积商品重量 每种商品的重量 * 数量 4007 //累积商品重量 每种商品的重量 * 数量
4004 goods_weight += good['weight'] * good['buynum']; 4008 goods_weight += good['weight'] * good['buynum'];
4005 if (goods_weight1 > 0) { 4009 if (goods_weight1 > 0) {
4006 - out_of_weight = gift_weight_free - goods_weight; 4010 + out_of_weight = gift_weight_free - goods_weight;
4007 //不能调换位置 下面goods_weight会变大 4011 //不能调换位置 下面goods_weight会变大
4008 goods_weight += goods_weight1; 4012 goods_weight += goods_weight1;
4009 } 4013 }
@@ -4023,6 +4027,7 @@ Page({ @@ -4023,6 +4027,7 @@ Page({
4023 if (no_by_data && no_by_data.region_list) { 4027 if (no_by_data && no_by_data.region_list) {
4024 if (th.check_by_area(no_by_data.region_list)) { 4028 if (th.check_by_area(no_by_data.region_list)) {
4025 gift_freight_free = 0; 4029 gift_freight_free = 0;
  4030 + out_of_weight = 0
4026 th.data.is_no_by[th.data.bn_pick] = 1; 4031 th.data.is_no_by[th.data.bn_pick] = 1;
4027 } 4032 }
4028 } 4033 }
@@ -4030,13 +4035,14 @@ Page({ @@ -4030,13 +4035,14 @@ Page({
4030 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 4035 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
4031 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 4036 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
4032 gift_freight_free = 0; 4037 gift_freight_free = 0;
4033 - //th.data.is_no_by[th.data.bn_pick]=1; 4038 + out_of_weight = 0
  4039 + th.data.is_no_by[th.data.bn_pick]=1;
4034 } 4040 }
4035 } 4041 }
4036 4042
4037 var t_shipping_price = 4043 var t_shipping_price =
4038 - this.calculatewuliu(code, gift_shipping_price, goods_weight,out_of_weight,  
4039 - goods_piece, user_addr, gift_freight_free, allpice, rs); 4044 + this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight,
  4045 + goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick);
4040 return t_shipping_price; 4046 return t_shipping_price;
4041 4047
4042 }, 4048 },
@@ -4093,7 +4099,7 @@ Page({ @@ -4093,7 +4099,7 @@ Page({
4093 4099
4094 //跳转关闭弹出框的显示 4100 //跳转关闭弹出框的显示
4095 close_offline: function () { 4101 close_offline: function () {
4096 - this.setData({is_offline_show: 0}); 4102 + this.setData({ is_offline_show: 0 });
4097 }, 4103 },
4098 4104
4099 //立即购买显示弹出框 4105 //立即购买显示弹出框
@@ -4101,7 +4107,7 @@ Page({ @@ -4101,7 +4107,7 @@ Page({
4101 var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price; 4107 var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price;
4102 //是不是线下 4108 //是不是线下
4103 var is_get_offline = this.data.bn_goods.is_offline; 4109 var is_get_offline = this.data.bn_goods.is_offline;
4104 - this.setData({is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline}); 4110 + this.setData({ is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline });
4105 }, 4111 },
4106 4112
4107 //确定使用线下取价 4113 //确定使用线下取价
@@ -4109,14 +4115,14 @@ Page({ @@ -4109,14 +4115,14 @@ Page({
4109 var bn_goods = this.data.bn_goods; 4115 var bn_goods = this.data.bn_goods;
4110 if (bn_goods && bn_goods.prom_type == 0) { 4116 if (bn_goods && bn_goods.prom_type == 0) {
4111 bn_goods.is_offline = 1; 4117 bn_goods.is_offline = 1;
4112 - this.setData({is_offline_show: 0, bn_goods: bn_goods}); 4118 + this.setData({ is_offline_show: 0, bn_goods: bn_goods });
4113 this.calculatePrice2(); 4119 this.calculatePrice2();
4114 } 4120 }
4115 //就是购物车结算时的 4121 //就是购物车结算时的
4116 else { 4122 else {
4117 var index = this.data.pop_offline_index; 4123 var index = this.data.pop_offline_index;
4118 var txt = "cartlist[" + index + "].is_offline"; 4124 var txt = "cartlist[" + index + "].is_offline";
4119 - this.setData({[txt]: 1, is_offline_show: 0,}); 4125 + this.setData({ [txt]: 1, is_offline_show: 0, });
4120 this.data.old_cartlist[index].is_offline = 1; 4126 this.data.old_cartlist[index].is_offline = 1;
4121 this.calculatePrice(); 4127 this.calculatePrice();
4122 } 4128 }
@@ -4128,14 +4134,14 @@ Page({ @@ -4128,14 +4134,14 @@ Page({
4128 var bn_goods = this.data.bn_goods; 4134 var bn_goods = this.data.bn_goods;
4129 if (bn_goods && bn_goods.prom_type == 0) { 4135 if (bn_goods && bn_goods.prom_type == 0) {
4130 bn_goods.is_offline = 0; 4136 bn_goods.is_offline = 0;
4131 - this.setData({is_offline_show: 0, bn_goods: bn_goods}); 4137 + this.setData({ is_offline_show: 0, bn_goods: bn_goods });
4132 this.calculatePrice2(); 4138 this.calculatePrice2();
4133 } 4139 }
4134 //就是购物车结算时的 4140 //就是购物车结算时的
4135 else { 4141 else {
4136 var index = this.data.pop_offline_index; 4142 var index = this.data.pop_offline_index;
4137 var txt = "cartlist[" + index + "].is_offline"; 4143 var txt = "cartlist[" + index + "].is_offline";
4138 - this.setData({[txt]: 0, is_offline_show: 0,}) 4144 + this.setData({ [txt]: 0, is_offline_show: 0, })
4139 this.data.old_cartlist[index].is_offline = 0; 4145 this.data.old_cartlist[index].is_offline = 0;
4140 this.calculatePrice(); 4146 this.calculatePrice();
4141 } 4147 }
@@ -4168,34 +4174,34 @@ Page({ @@ -4168,34 +4174,34 @@ Page({
4168 // this.setData({[txt]:0}) 4174 // this.setData({[txt]:0})
4169 // }, 4175 // },
4170 4176
4171 - go_url:function (e) { 4177 + go_url: function (e) {
4172 var url = e.currentTarget.dataset.url; 4178 var url = e.currentTarget.dataset.url;
4173 getApp().goto(url); 4179 getApp().goto(url);
4174 }, 4180 },
4175 4181
4176 - //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表  
4177 - split_set_goods_quanprice:async function (you_item,t_item) {  
4178 - var coupon_price=you_item.WareCashSum;  
4179 - var goods=t_item.goods;  
4180 - var arr=[]; 4182 + //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表
  4183 + split_set_goods_quanprice: async function (you_item, t_item) {
  4184 + var coupon_price = you_item.WareCashSum;
  4185 + var goods = t_item.goods;
  4186 + var arr = [];
4181 //判断是不是有goods_id重复 4187 //判断是不是有goods_id重复
4182 - for(var i=0;i<goods.length;i++){  
4183 - if(goods[i].prom_type!=7 && goods[i].erpwareid==you_item.WareId){  
4184 - var gg_ite={  
4185 - goods_id:goods[i].goods_id,  
4186 - goods_num:goods[i].goods_num,  
4187 - goods_price:goods[i].goods_price, 4188 + for (var i = 0; i < goods.length; i++) {
  4189 + if (goods[i].prom_type != 7 && goods[i].erpwareid == you_item.WareId) {
  4190 + var gg_ite = {
  4191 + goods_id: goods[i].goods_id,
  4192 + goods_num: goods[i].goods_num,
  4193 + goods_price: goods[i].goods_price,
4188 }; 4194 };
4189 - if(goods[i].account) gg_ite.goods_price=goods[i].account;  
4190 - gg_ite.idx=i;arr.push(gg_ite); 4195 + if (goods[i].account) gg_ite.goods_price = goods[i].account;
  4196 + gg_ite.idx = i; arr.push(gg_ite);
4191 } 4197 }
4192 } 4198 }
4193 4199
4194 - if(arr.length<=0) return false;  
4195 - if(arr.length==1){  
4196 - var idx=arr[0].idx;  
4197 - t_item.goods[idx].quan_num =Math.floor(coupon_price* 100) / 100;  
4198 - t_item.goods[idx].quan_no=t_item.quan_no; 4200 + if (arr.length <= 0) return false;
  4201 + if (arr.length == 1) {
  4202 + var idx = arr[0].idx;
  4203 + t_item.goods[idx].quan_num = Math.floor(coupon_price * 100) / 100;
  4204 + t_item.goods[idx].quan_no = t_item.quan_no;
4199 return false; 4205 return false;
4200 } 4206 }
4201 4207
@@ -4205,7 +4211,7 @@ Page({ @@ -4205,7 +4211,7 @@ Page({
4205 } 4211 }
4206 4212
4207 var pt_res = null; 4213 var pt_res = null;
4208 - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { 4214 + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
4209 is_json: 1, 4215 is_json: 1,
4210 data: pt_data 4216 data: pt_data
4211 }).then(res => { 4217 }).then(res => {
@@ -4218,21 +4224,21 @@ Page({ @@ -4218,21 +4224,21 @@ Page({
4218 for (var i in pt_res) { 4224 for (var i in pt_res) {
4219 var idx = pt_res[i].idx; 4225 var idx = pt_res[i].idx;
4220 //有account的实收价,就要用account实收价 4226 //有account的实收价,就要用account实收价
4221 - var price=(t_item.goods[idx].account?t_item.goods[idx].account:t_item.goods[idx].goods_price);  
4222 - price=(price - pt_res[i].fisrt_account)* t_item.goods[idx].goods_num;  
4223 - t_item.goods[idx].quan_num =price; 4227 + var price = (t_item.goods[idx].account ? t_item.goods[idx].account : t_item.goods[idx].goods_price);
  4228 + price = (price - pt_res[i].fisrt_account) * t_item.goods[idx].goods_num;
  4229 + t_item.goods[idx].quan_num = price;
4224 4230
4225 - t_item.goods[idx].quan_num =Math.floor(t_item.goods[idx].quan_num * 100) / 100;  
4226 - t_item.goods[idx].quan_no=t_item.quan_no; 4231 + t_item.goods[idx].quan_num = Math.floor(t_item.goods[idx].quan_num * 100) / 100;
  4232 + t_item.goods[idx].quan_no = t_item.quan_no;
4227 q_s_num += t_item.goods[idx].quan_num; 4233 q_s_num += t_item.goods[idx].quan_num;
4228 } 4234 }
4229 4235
4230 - if (q_s_num > parseFloat(coupon_price) || q_s_num < parseFloat(coupon_price)){ 4236 + if (q_s_num > parseFloat(coupon_price) || q_s_num < parseFloat(coupon_price)) {
4231 for (var ik in arr) { 4237 for (var ik in arr) {
4232 if (arr[ik].goods_num == 1) { 4238 if (arr[ik].goods_num == 1) {
4233 var id = arr[ik].idx; 4239 var id = arr[ik].idx;
4234 - var pri=Math.floor(coupon_price*100)/100-Math.floor(q_s_num*100)/100  
4235 - t_item.goods[id].quan_num+=pri; 4240 + var pri = Math.floor(coupon_price * 100) / 100 - Math.floor(q_s_num * 100) / 100
  4241 + t_item.goods[id].quan_num += pri;
4236 break; 4242 break;
4237 } 4243 }
4238 } 4244 }
@@ -4240,8 +4246,7 @@ Page({ @@ -4240,8 +4246,7 @@ Page({
4240 } 4246 }
4241 }, 4247 },
4242 //订阅消息提醒 4248 //订阅消息提醒
4243 - sendsm:function(func)  
4244 - { 4249 + sendsm: function (func) {
4245 var template_id = this.data.template_id; 4250 var template_id = this.data.template_id;
4246 // //授权订阅 4251 // //授权订阅
4247 wx.requestSubscribeMessage({ 4252 wx.requestSubscribeMessage({
pages/cart/cart2_inte/cart2_inte.js
1 -var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"),  
2 - s = require("../../../utils/util.js"),ut=s, o = require("../../../utils/md5.js"), to = getApp();  
3 -var oo=t.globalData.setting,os=oo; 1 +var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"),
  2 + s = require("../../../utils/util.js"), ut = s, o = require("../../../utils/md5.js"), to = getApp();
  3 +var oo = t.globalData.setting, os = oo;
4 var regeneratorRuntime = require('../../../utils/runtime.js'); 4 var regeneratorRuntime = require('../../../utils/runtime.js');
5 var util_pay = require("../../../utils/pay.js"); 5 var util_pay = require("../../../utils/pay.js");
6 6
7 -Page({ 7 +Page({
8 data: { 8 data: {
9 - url: t.globalData.setting.url, 9 + url: t.globalData.setting.url,
10 imgUrl: t.globalData.setting.imghost, 10 imgUrl: t.globalData.setting.imghost,
11 goods: null, 11 goods: null,
12 order: null, 12 order: null,
@@ -20,361 +20,361 @@ Page({ @@ -20,361 +20,361 @@ Page({
20 enterAddressPage: !1, 20 enterAddressPage: !1,
21 firstEnter: !0, 21 firstEnter: !0,
22 //页面获取的参数 22 //页面获取的参数
23 - param:null, 23 + param: null,
24 //提交订单的格式 24 //提交订单的格式
25 formData: { 25 formData: {
26 - order_amount:0,//支付金额  
27 - total_amount:0,//总价  
28 - all_price:0,//商品卖的总价 26 + order_amount: 0,//支付金额
  27 + total_amount: 0,//总价
  28 + all_price: 0,//商品卖的总价
29 pay_points: 0,//使用积分 29 pay_points: 0,//使用积分
30 user_money: 0,//使用余额 30 user_money: 0,//使用余额
31 couponCode: "",//使用优惠券(多单就用逗号隔开) 31 couponCode: "",//使用优惠券(多单就用逗号隔开)
32 - shipping_price:0,//物流费用 32 + shipping_price: 0,//物流费用
33 }, 33 },
34 34
35 35
36 /*----------------立即购买---------------------*/ 36 /*----------------立即购买---------------------*/
37 - is_b_now:1, //0是购物车结算 1立即购买  
38 - bn_goods:null, //立即购买时候的调用商品  
39 - bn_use_money:0,//是否使用余额  
40 - bn_exp_type:1, //0是物流 1自提  
41 - bn_pick:0, //选择的门店 37 + is_b_now: 1, //0是购物车结算 1立即购买
  38 + bn_goods: null, //立即购买时候的调用商品
  39 + bn_use_money: 0,//是否使用余额
  40 + bn_exp_type: 1, //0是物流 1自提
  41 + bn_pick: 0, //选择的门店
42 bn_pickname: "", //选择的门店名称 42 bn_pickname: "", //选择的门店名称
43 - bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流  
44 -  
45 - bn_plus_cut_price:0, //显示等级卡会优惠多少钱 43 + bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
  44 +
  45 + bn_plus_cut_price: 0, //显示等级卡会优惠多少钱
46 /*------------------------*/ 46 /*------------------------*/
47 - user_addr:null,//物流  
48 - userinfo:null, //获取会员 47 + user_addr: null,//物流
  48 + userinfo: null, //获取会员
49 /*----------物流选择--------*/ 49 /*----------物流选择--------*/
50 - wu_arr:null,  
51 - index:0,  
52 - w_sele_index:0, 50 + wu_arr: null,
  51 + index: 0,
  52 + w_sele_index: 0,
53 53
54 //判断页面是返回回来的还是 首次进入的 54 //判断页面是返回回来的还是 首次进入的
55 - isclose:1, 55 + isclose: 1,
56 //申请提现的金额 56 //申请提现的金额
57 - txmon:0,  
58 - yuer:0, 57 + txmon: 0,
  58 + yuer: 0,
59 //提交中,不重复提交 59 //提交中,不重复提交
60 - is_summit_ing:0,  
61 -  
62 - disabled:0,  
63 - open_express:0,//控制选择物流名列表 的属性  
64 -  
65 - is_express:0, //选中物流的属性  
66 - expres_name:"", //点击选定  
67 - is_shipping_code:"",//插入用户默认地址  
68 - wu_arr_txt:"", //要更新的物流的字段  
69 -  
70 - //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券  
71 - is_no_by:{},  
72 - is_by:{},  
73 - is_quan_by:{}, 60 + is_summit_ing: 0,
  61 +
  62 + disabled: 0,
  63 + open_express: 0,//控制选择物流名列表 的属性
  64 +
  65 + is_express: 0, //选中物流的属性
  66 + expres_name: "", //点击选定
  67 + is_shipping_code: "",//插入用户默认地址
  68 + wu_arr_txt: "", //要更新的物流的字段
  69 +
  70 + //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券
  71 + is_no_by: {},
  72 + is_by: {},
  73 + is_quan_by: {},
74 //--购买赠送的商品-- 74 //--购买赠送的商品--
75 - buy_now_gift_goods:null, 75 + buy_now_gift_goods: null,
76 //--订单优惠-- 76 //--订单优惠--
77 - order_prom:{},  
78 - show_submit:0, //提交按钮变正常显示 77 + order_prom: {},
  78 + show_submit: 0, //提交按钮变正常显示
79 79
80 }, 80 },
81 - onLoad: function(t) {  
82 - wx.setNavigationBarTitle({ title: "填写订单",})  
83 - var th = this;  
84 - th.data.param=t; 81 + onLoad: function (t) {
  82 + wx.setNavigationBarTitle({ title: "填写订单", })
  83 + var th = this;
  84 + th.data.param = t;
85 //清空is_pick_up 85 //清空is_pick_up
86 getApp().request.put("/api/weshop/useraddress/updatePickUp", { 86 getApp().request.put("/api/weshop/useraddress/updatePickUp", {
87 - data: {user_id: getApp().globalData.user_id, is_pickup: 0},  
88 - success: function (s) {  
89 - } 87 + data: { user_id: getApp().globalData.user_id, is_pickup: 0 },
  88 + success: function (s) {
  89 + }
90 }); 90 });
91 -  
92 - //先获取是否有关闭使用优惠券  
93 - getApp().getConfig2(function (ee) {  
94 - var json_d = JSON.parse(ee.switch_list);  
95 - th.data.json_d=json_d;  
96 - th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
97 - var is_default_logistics=json_d.is_default_logistics;  
98 - th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch,is_default_logistics:is_default_logistics});  
99 -  
100 - var rank_switch=json_d.rank_switch;  
101 - var max_price=-1;  
102 - var show_card=null;  
103 - var name="";  
104 - //如果有开等级卡的时候,  
105 - //因为都是调接口,要返回在计算  
106 - if(rank_switch==2){  
107 - //-- 获取所有的等级卡, --  
108 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
109 - {}).then(res => {  
110 - if(res.data.code==0){  
111 - var plusCard = res.data.data;  
112 - //-- 循环判断,拿到最贵的那张卡 --  
113 - for(var ih in plusCard){  
114 - if(plusCard[ih].IsStopBuy == true){ continue; }  
115 - if(max_price<0){  
116 - max_price=plusCard[ih].CardFee;  
117 - name='card'+plusCard[ih]['CorrPrice'];  
118 - show_card=plusCard[ih];  
119 - }else{  
120 - if(max_price<plusCard[ih].CardFee){  
121 - max_price=plusCard[ih].CardFee;  
122 - name='card'+plusCard[ih]['CorrPrice'];  
123 - show_card=plusCard[ih];  
124 - }  
125 - }  
126 - }  
127 -  
128 - if(show_card){  
129 - name=name.toLowerCase();  
130 - th.setData({card_name:name,show_card:show_card})  
131 - }  
132 - }  
133 - //-----先获取物流,再获取用户信息,再展示页面-----  
134 - th.get_wuliu(th.get_info(th.show_page));  
135 - })  
136 - }else{  
137 - //-----先获取物流,再获取用户信息,再展示页面-----  
138 - th.get_wuliu(th.get_info(th.show_page));  
139 - }  
140 - },1);  
141 -  
142 - 91 +
  92 + //先获取是否有关闭使用优惠券
  93 + getApp().getConfig2(function (ee) {
  94 + var json_d = JSON.parse(ee.switch_list);
  95 + th.data.json_d = json_d;
  96 + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  97 + var is_default_logistics = json_d.is_default_logistics;
  98 + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });
  99 +
  100 + var rank_switch = json_d.rank_switch;
  101 + var max_price = -1;
  102 + var show_card = null;
  103 + var name = "";
  104 + //如果有开等级卡的时候,
  105 + //因为都是调接口,要返回在计算
  106 + if (rank_switch == 2) {
  107 + //-- 获取所有的等级卡, --
  108 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  109 + {}).then(res => {
  110 + if (res.data.code == 0) {
  111 + var plusCard = res.data.data;
  112 + //-- 循环判断,拿到最贵的那张卡 --
  113 + for (var ih in plusCard) {
  114 + if (plusCard[ih].IsStopBuy == true) { continue; }
  115 + if (max_price < 0) {
  116 + max_price = plusCard[ih].CardFee;
  117 + name = 'card' + plusCard[ih]['CorrPrice'];
  118 + show_card = plusCard[ih];
  119 + } else {
  120 + if (max_price < plusCard[ih].CardFee) {
  121 + max_price = plusCard[ih].CardFee;
  122 + name = 'card' + plusCard[ih]['CorrPrice'];
  123 + show_card = plusCard[ih];
  124 + }
  125 + }
  126 + }
  127 +
  128 + if (show_card) {
  129 + name = name.toLowerCase();
  130 + th.setData({ card_name: name, show_card: show_card })
  131 + }
  132 + }
  133 + //-----先获取物流,再获取用户信息,再展示页面-----
  134 + th.get_wuliu(th.get_info(th.show_page));
  135 + })
  136 + } else {
  137 + //-----先获取物流,再获取用户信息,再展示页面-----
  138 + th.get_wuliu(th.get_info(th.show_page));
  139 + }
  140 + }, 1);
  141 +
  142 +
143 }, 143 },
144 - onUnload: function () { this.setData({ isclose: 1 })}, 144 + onUnload: function () { this.setData({ isclose: 1 }) },
145 onHide: function () { 145 onHide: function () {
146 - this.setData({  
147 - is_no_by:{},  
148 - is_by:{}  
149 - }) 146 + this.setData({
  147 + is_no_by: {},
  148 + is_by: {}
  149 + })
150 }, 150 },
151 151
152 //----------子页返回父页触发---------- 152 //----------子页返回父页触发----------
153 - onShow: function() {  
154 - var th=this;  
155 - th.data.g_cart_q_time=null;  
156 -  
157 - if (th.data.isclose==0){ 153 + onShow: function () {
  154 + var th = this;
  155 + th.data.g_cart_q_time = null;
  156 +
  157 + if (th.data.isclose == 0) {
158 wx.navigateTo({ 158 wx.navigateTo({
159 url: "/pages/index/index/index" 159 url: "/pages/index/index/index"
160 }) 160 })
161 161
162 - }else{  
163 - this.getuser_addr(function(ie){  
164 - /*--  
165 - //地址切换要把包邮券清空  
166 - if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){  
167 - var using_quan=th.data.using_quan;  
168 - for(var i in using_quan){  
169 - var item=using_quan[i];  
170 - if(item.isby==1){  
171 - var ob={},txt="using_quan["+i+"]";ob[txt]={};  
172 - th.setData(ob);  
173 - } 162 + } else {
  163 + this.getuser_addr(function (ie) {
  164 + /*--
  165 + //地址切换要把包邮券清空
  166 + if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){
  167 + var using_quan=th.data.using_quan;
  168 + for(var i in using_quan){
  169 + var item=using_quan[i];
  170 + if(item.isby==1){
  171 + var ob={},txt="using_quan["+i+"]";ob[txt]={};
  172 + th.setData(ob);
  173 + }
  174 + }
  175 +
  176 + }--*/
  177 +
  178 + //th.data.prom_goods_map={};
  179 + //更换地址回来要重新调用计算价钱的接口
  180 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  181 + th.setData({ user_addr: ie, show_submit: 0 });
  182 + if (th.data.is_b_now == 1) {
  183 + if (th.data.bn_goods) {
  184 + th.setData({ add_back: 1 });
  185 + th.calculatePrice2();
174 } 186 }
175 -  
176 - }--*/  
177 -  
178 - //th.data.prom_goods_map={};  
179 - //更换地址回来要重新调用计算价钱的接口  
180 - if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){  
181 - th.setData({user_addr: ie,show_submit:0 });  
182 - if (th.data.is_b_now == 1) {  
183 - if(th.data.bn_goods) {  
184 - th.setData({add_back:1});  
185 - th.calculatePrice2();  
186 - }  
187 - }  
188 - }else{  
189 - th.setData({user_addr: ie });  
190 - }  
191 - var going=0;  
192 -  
193 - });  
194 - //--更新默认地址--,看一下是不是跳到地址页面  
195 - if(!getApp().globalData.is_cart_old){  
196 - this.update_code();  
197 - }else{  
198 - getApp().globalData.is_cart_old=0; 187 + }
  188 + } else {
  189 + th.setData({ user_addr: ie });
199 } 190 }
  191 + var going = 0;
  192 +
  193 + });
  194 + //--更新默认地址--,看一下是不是跳到地址页面
  195 + if (!getApp().globalData.is_cart_old) {
  196 + this.update_code();
  197 + } else {
  198 + getApp().globalData.is_cart_old = 0;
  199 + }
200 } 200 }
201 - 201 +
202 }, 202 },
203 203
204 //-------------------获取物流--------------- 204 //-------------------获取物流---------------
205 get_wuliu(func) { 205 get_wuliu(func) {
206 var th = this; 206 var th = this;
207 to.getwuliu(function (e) { 207 to.getwuliu(function (e) {
208 - if(th.data.is_default_logistics){  
209 - //如果第一个不是开启默认,说明要让用户自己选  
210 - if(!e[0].is_default){  
211 - th.setData({is_default_logistics:0});  
212 - }  
213 - }  
214 - th.setData({ wu_arr: e })  
215 - typeof func == "function" && func(); 208 + if (th.data.is_default_logistics) {
  209 + //如果第一个不是开启默认,说明要让用户自己选
  210 + if (!e[0].is_default) {
  211 + th.setData({ is_default_logistics: 0 });
  212 + }
  213 + }
  214 + th.setData({ wu_arr: e })
  215 + typeof func == "function" && func();
216 }) 216 })
217 }, 217 },
218 //------获取会员信息-----先获取用户信息,在进行下一步--- 218 //------获取会员信息-----先获取用户信息,在进行下一步---
219 - get_info:function(func){ 219 + get_info: function (func) {
220 var user_id = t.globalData.user_id; 220 var user_id = t.globalData.user_id;
221 to.auth.get_u(func); 221 to.auth.get_u(func);
222 }, 222 },
223 223
224 //------获取会员收货地址----- 224 //------获取会员收货地址-----
225 - getuser_addr:function(func){  
226 - var th=this;  
227 - a.get("/api/weshop/useraddress/page", {  
228 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600,t:Math.random()},  
229 - success: function (su) {  
230 -  
231 - var item = null;  
232 - if(su.data.code==0 && su.data.data && su.data.data.pageData){  
233 - var user_addr = su.data.data.pageData;  
234 - var def_item=null;  
235 - for (var i = 0; i < user_addr.length; i++) {  
236 - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i];}  
237 - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }  
238 - }  
239 -  
240 - if (item == null) item = def_item;  
241 - if (item == null) item = user_addr[0];  
242 - }  
243 -  
244 - if(item==undefined) item=null;  
245 - if(!item) th.setData({user_addr:null}); //地址为空的时候,要清空,因为返回的时候,有缓存  
246 - func(item); 225 + getuser_addr: function (func) {
  226 + var th = this;
  227 + a.get("/api/weshop/useraddress/page", {
  228 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() },
  229 + success: function (su) {
  230 +
  231 + var item = null;
  232 + if (su.data.code == 0 && su.data.data && su.data.data.pageData) {
  233 + var user_addr = su.data.data.pageData;
  234 + var def_item = null;
  235 + for (var i = 0; i < user_addr.length; i++) {
  236 + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
  237 + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
  238 + }
  239 +
  240 + if (item == null) item = def_item;
  241 + if (item == null) item = user_addr[0];
247 } 242 }
248 - }); 243 +
  244 + if (item == undefined) item = null;
  245 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存
  246 + func(item);
  247 + }
  248 + });
249 }, 249 },
250 - 250 +
251 //----------------展示页面,是再获取用户信息之后-------------- 251 //----------------展示页面,是再获取用户信息之后--------------
252 - show_page:function(){  
253 - var th=this,ta = this.data.param; 252 + show_page: function () {
  253 + var th = this, ta = this.data.param;
254 //th.setData({ userinfo: getApp().globalData.userInfo,}); 254 //th.setData({ userinfo: getApp().globalData.userInfo,});
255 -  
256 - var user=getApp().globalData.userInfo;  
257 - getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {  
258 - data:{r:Math.random()},  
259 - success: function (e) {  
260 -  
261 - getApp().globalData.userInfo = e.data.data;  
262 - th.setData({userinfo:e.data.data});  
263 -  
264 - //选获取地址  
265 - th.getuser_addr(function(addr){  
266 - th.setData({user_addr: addr});  
267 - //--------------------------立即购买------------------  
268 - if(ta.is_bnow== 1){  
269 - //读取门店  
270 - to.get_allsto(function (e) {  
271 - th.setData({ allsto: e });  
272 - //获取立即购买的商品信息  
273 - th.get_buy_goods(ta.goods_id);  
274 - });  
275 - }  
276 - });  
277 - //获取提现金额  
278 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
279 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },  
280 - success: function (su) {  
281 - if (su.data.code == 0) {  
282 - var yuer = parseFloat(th.data.userinfo.user_money -  
283 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
284 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
285 - }  
286 - }  
287 - });  
288 -  
289 - },  
290 - })  
291 -  
292 - 255 +
  256 + var user = getApp().globalData.userInfo;
  257 + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
  258 + data: { r: Math.random() },
  259 + success: function (e) {
  260 +
  261 + getApp().globalData.userInfo = e.data.data;
  262 + th.setData({ userinfo: e.data.data });
  263 +
  264 + //选获取地址
  265 + th.getuser_addr(function (addr) {
  266 + th.setData({ user_addr: addr });
  267 + //--------------------------立即购买------------------
  268 + if (ta.is_bnow == 1) {
  269 + //读取门店
  270 + to.get_allsto(function (e) {
  271 + th.setData({ allsto: e });
  272 + //获取立即购买的商品信息
  273 + th.get_buy_goods(ta.goods_id);
  274 + });
  275 + }
  276 + });
  277 + //获取提现金额
  278 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  279 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
  280 + success: function (su) {
  281 + if (su.data.code == 0) {
  282 + var yuer = parseFloat(th.data.userinfo.user_money -
  283 + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
  284 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  285 + }
  286 + }
  287 + });
  288 +
  289 + },
  290 + })
  291 +
  292 +
293 }, 293 },
294 - 294 +
295 //-----获取立即购买的商品信息,入口---- 295 //-----获取立即购买的商品信息,入口----
296 - get_buy_goods: function (e){  
297 - var th=this; 296 + get_buy_goods: function (e) {
  297 + var th = this;
298 var gg = to.get_b_now(); 298 var gg = to.get_b_now();
299 //--------如果goods_id一样,就是要立即购买----- 299 //--------如果goods_id一样,就是要立即购买-----
300 - if(e==gg.goods_id){  
301 - a.get("/api/weshop/goods/get/" + oo.stoid+"/"+e, {  
302 - success:async function (t) { 300 + if (e == gg.goods_id) {
  301 + a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, {
  302 + success: async function (t) {
303 var gd = t.data.data; 303 var gd = t.data.data;
304 - if(!gd) return false; 304 + if (!gd) return false;
305 305
306 t.data.data.original_img = oo.imghost + t.data.data.original_img; 306 t.data.data.original_img = oo.imghost + t.data.data.original_img;
307 t.data.data['buynum'] = gg.goods_num; 307 t.data.data['buynum'] = gg.goods_num;
308 - var distr_t=0,et=0  
309 - if (t.data.data.distr_type==0){ 308 + var distr_t = 0, et = 0
  309 + if (t.data.data.distr_type == 0) {
310 distr_t = gg.pick_dis; 310 distr_t = gg.pick_dis;
311 - }else{ 311 + } else {
312 distr_t = t.data.data.distr_type; 312 distr_t = t.data.data.distr_type;
313 } 313 }
314 - switch (distr_t){ 314 + switch (distr_t) {
315 case 0: 315 case 0:
316 - et=1;  
317 - //-- 系统后台有设置要默认的 --  
318 - if(th.data.json_d.pickupway && th.data.json_d.pickupway==1) et=0;  
319 - break; 316 + et = 1;
  317 + //-- 系统后台有设置要默认的 --
  318 + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;
  319 + break;
320 case 1: et = 1; break; 320 case 1: et = 1; break;
321 case 2: et = 0; break; 321 case 2: et = 0; break;
322 } 322 }
323 -  
324 - if(th.data.bn_goods) et=th.data.bn_exp_type  
325 -  
326 - var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;  
327 - if(et==0 && def_exp_code){  
328 - for(var k=0;k<th.data.wu_arr.length;k++){  
329 - var item=th.data.wu_arr[k]; if(def_exp_code==item.code){ m_wind=k; }  
330 - } 323 +
  324 + if (th.data.bn_goods) et = th.data.bn_exp_type
  325 +
  326 + var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  327 + if (et == 0 && def_exp_code) {
  328 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  329 + var item = th.data.wu_arr[k]; if (def_exp_code == item.code) { m_wind = k; }
  330 + }
  331 + }
  332 +
  333 + //---是不是购买等级卡成功的返回---等级卡显示的判断---
  334 + var is_card_back = getApp().globalData.is_card_back;
  335 + if (is_card_back) {
  336 + th.data.card_name = th.data.userinfo.card_field;
  337 + gg.goods_price = gd[th.data.card_name];
  338 + getApp().globalData.is_card_back = 0;
  339 + th.setData({ card_cut_price: 0 });
  340 + //如果是秒杀的返回
  341 + if (gd.prom_type == 4) gd.prom_type = 0;
  342 + } else {
  343 + //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格
  344 + //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --
  345 + if (!gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {
  346 + var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num;
  347 + th.setData({ card_cut_price: cut_p });
  348 + }
331 } 349 }
332 -  
333 - //---是不是购买等级卡成功的返回---等级卡显示的判断---  
334 - var is_card_back=getApp().globalData.is_card_back;  
335 - if(is_card_back){  
336 - th.data.card_name=th.data.userinfo.card_field;  
337 - gg.goods_price=gd[th.data.card_name];  
338 - getApp().globalData.is_card_back=0;  
339 - th.setData({card_cut_price:0});  
340 - //如果是秒杀的返回  
341 - if(gd.prom_type==4) gd.prom_type=0;  
342 - }else{  
343 - //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格  
344 - //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --  
345 - if(!gg.collocation_goods && gd['prom_type']!=6 && th.data.card_name && gd[th.data.card_name]>0 && gg.goods_price>gd[th.data.card_name] && !th.data.userinfo.card_field){  
346 - var cut_p= (gg.goods_price-gd[th.data.card_name])*gg.goods_num;  
347 - th.setData({card_cut_price:cut_p});  
348 - }  
349 - }  
350 -  
351 - switch (gd.prom_type){ 350 +
  351 + switch (gd.prom_type) {
352 case 0: 352 case 0:
353 case 2: 353 case 2:
354 case 3: 354 case 3:
355 case 5: 355 case 5:
356 case 6: 356 case 6:
357 - getApp().my_warnning("商品不是积分活动",0,th);  
358 - wx.navigateBack();  
359 - break; 357 + getApp().my_warnning("商品不是积分活动", 0, th);
  358 + wx.navigateBack();
  359 + break;
360 case 4: //-- 积分购 -- 360 case 4: //-- 积分购 --
361 - getApp().request.get("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{  
362 - data:{store_id:os.stoid,goods_id:gg.goods_id}, 361 + getApp().request.get("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1", {
  362 + data: { store_id: os.stoid, goods_id: gg.goods_id },
363 success: async function (tt) { 363 success: async function (tt) {
364 - if(tt.data.code==0 && tt.data.data && tt.data.data.pageData){  
365 - var inte_data=tt.data.data.pageData[0];  
366 - t.data.data.shop_price=inte_data.addmoney;  
367 - t.data.data.integral=inte_data.integral;  
368 - th.setData({  
369 - bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind,  
370 - bn_pick: gg.pick_id, bn_t_exp_t: distr_t,bn_exp_type: et  
371 - });  
372 - //计算价格  
373 - th.calculatePrice2();  
374 - }else{  
375 - getApp().my_warnning("商品不是积分活动",0,th);  
376 - wx.navigateBack();  
377 - } 364 + if (tt.data.code == 0 && tt.data.data && tt.data.data.pageData) {
  365 + var inte_data = tt.data.data.pageData[0];
  366 + t.data.data.shop_price = inte_data.addmoney;
  367 + t.data.data.integral = inte_data.integral;
  368 + th.setData({
  369 + bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, index: m_wind,
  370 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
  371 + });
  372 + //计算价格
  373 + th.calculatePrice2();
  374 + } else {
  375 + getApp().my_warnning("商品不是积分活动", 0, th);
  376 + wx.navigateBack();
  377 + }
378 } 378 }
379 }); 379 });
380 break; 380 break;
@@ -385,34 +385,34 @@ Page({ @@ -385,34 +385,34 @@ Page({
385 }, 385 },
386 386
387 //---------------检查是否有收货地址------------------- 387 //---------------检查是否有收货地址-------------------
388 - checkAddressList: function() { 388 + checkAddressList: function () {
389 var t = this; 389 var t = this;
390 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 390 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
391 title: "请先填写或选择收货地址~", 391 title: "请先填写或选择收货地址~",
392 - success: function(a) { 392 + success: function (a) {
393 a.confirm ? t.enterAddressPage() : wx.navigateBack(); 393 a.confirm ? t.enterAddressPage() : wx.navigateBack();
394 }, 394 },
395 - fail: function() { 395 + fail: function () {
396 wx.navigateBack(); 396 wx.navigateBack();
397 } 397 }
398 }), !1); 398 }), !1);
399 }, 399 },
400 - showInvoice: function() { 400 + showInvoice: function () {
401 this.setData({ 401 this.setData({
402 invoiceToggle: !this.data.invoiceToggle 402 invoiceToggle: !this.data.invoiceToggle
403 }); 403 });
404 }, 404 },
405 - keyUpChangePay1: function(t) { 405 + keyUpChangePay1: function (t) {
406 this.setData({ 406 this.setData({
407 payWithUserMoney: !(t.detail.value.length > 0) 407 payWithUserMoney: !(t.detail.value.length > 0)
408 }); 408 });
409 }, 409 },
410 - keyUpChangePay2: function(t) { 410 + keyUpChangePay2: function (t) {
411 this.setData({ 411 this.setData({
412 payWithPoints: !(t.detail.value.length > 0) 412 payWithPoints: !(t.detail.value.length > 0)
413 }); 413 });
414 }, 414 },
415 - keyUpChangeNum: function(t) { 415 + keyUpChangeNum: function (t) {
416 this.setData({ 416 this.setData({
417 maxWord: t.detail.value.length 417 maxWord: t.detail.value.length
418 }); 418 });
@@ -421,33 +421,33 @@ Page({ @@ -421,33 +421,33 @@ Page({
421 421
422 //---------计算立即购买---------- 422 //---------计算立即购买----------
423 calculatePrice2: function () { 423 calculatePrice2: function () {
424 - var th = this, good = this.data.bn_goods;  
425 - wx.showLoading({ title:"处理中.",}) 424 + var th = this, good = this.data.bn_goods;
  425 + wx.showLoading({ title: "处理中.", })
426 //-----------计算商品总价-------------- 426 //-----------计算商品总价--------------
427 var allpice = good.shop_price * good.buynum; 427 var allpice = good.shop_price * good.buynum;
428 - var all_integral=good.integral * good.buynum;  
429 -  
430 - var cut_price=0;  
431 - if(good.prom_type==3 && good.prom_price!==null){  
432 - cut_price=allpice-good.prom_price; 428 + var all_integral = good.integral * good.buynum;
  429 +
  430 + var cut_price = 0;
  431 + if (good.prom_type == 3 && good.prom_price !== null) {
  432 + cut_price = allpice - good.prom_price;
433 } 433 }
434 - allpice=parseFloat(allpice).toFixed(2); 434 + allpice = parseFloat(allpice).toFixed(2);
435 var txt = "formData.all_price"; 435 var txt = "formData.all_price";
436 th.setData({ [txt]: allpice, }); 436 th.setData({ [txt]: allpice, });
437 - if(cut_price){  
438 - var c_txt="formData.cut_price"; 437 + if (cut_price) {
  438 + var c_txt = "formData.cut_price";
439 th.setData({ [c_txt]: cut_price, }); 439 th.setData({ [c_txt]: cut_price, });
440 } 440 }
441 to.getConfig2(function (ee) { 441 to.getConfig2(function (ee) {
442 to.getwuliuprice(async function (rs) { 442 to.getwuliuprice(async function (rs) {
443 443
444 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 444 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
445 - var out_of_weight=null; //超出多少重量 445 + var out_of_weight = null; //超出多少重量
446 var freight_free = ee.freight_free; //全场满多少包邮 446 var freight_free = ee.freight_free; //全场满多少包邮
447 var weight_free = ee.weight_free; //多少kg内包邮 447 var weight_free = ee.weight_free; //多少kg内包邮
448 //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- 448 //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮----------
449 - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){  
450 - 449 + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) {
  450 +
451 switch (good['exp_sum_type']) { 451 switch (good['exp_sum_type']) {
452 case 1: 452 case 1:
453 //统一运费 453 //统一运费
@@ -456,8 +456,8 @@ Page({ @@ -456,8 +456,8 @@ Page({
456 if (goods_weight < 0) goods_weight = 0; 456 if (goods_weight < 0) goods_weight = 0;
457 //累积商品重量 每种商品的重量 * 数量 457 //累积商品重量 每种商品的重量 * 数量
458 goods_weight += good['weight'] * good['buynum']; 458 goods_weight += good['weight'] * good['buynum'];
459 - if(weight_free > 0){  
460 - out_of_weight = (weight_free * 1000 ) - goods_weight; 459 + if (weight_free > 0) {
  460 + out_of_weight = (weight_free * 1000) - goods_weight;
461 } 461 }
462 break; 462 break;
463 case 3: 463 case 3:
@@ -466,92 +466,94 @@ Page({ @@ -466,92 +466,94 @@ Page({
466 goods_piece += good['buynum']; break; 466 goods_piece += good['buynum']; break;
467 } 467 }
468 468
469 - var code ="";  
470 - if(th.data.wu_arr && th.data.wu_arr[th.data.index]) code=th.data.wu_arr[th.data.index].code;  
471 - var no_ex_id=ee.no_ex_id;  
472 - th.data.is_no_by[th.data.bn_pick]=0;  
473 -  
474 - var no_by_data=null;  
475 - var gift_freight_free=freight_free;  
476 - //有不包邮区域,且不免运费  
477 - if(no_ex_id && freight_free>0 && freight_free<=allpice-cut_price){  
478 - //-----------获取不包邮区域,不包邮商品-------  
479 - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods",{  
480 - data:{store_id:os.stoid,id:no_ex_id}  
481 - }).then(res=>{  
482 - if(res.data.code==0){  
483 - no_by_data=res.data.data[0];  
484 - //如果有设置不包邮区域的时候  
485 - if(res.data.data[0].region_list){  
486 - if(th.check_by_area(res.data.data[0].region_list)){  
487 - freight_free=0;  
488 - th.data.is_no_by[th.data.bn_pick]=1;  
489 - }  
490 - }  
491 - //如果有设置不包邮商品  
492 - if(res.data.data[0].goods_list && freight_free){  
493 - if(th.check_by_goods(res.data.data[0].goods_list)){  
494 - freight_free=0;  
495 - th.data.is_no_by[th.data.bn_pick]=1;  
496 - }  
497 - }  
498 - }  
499 - })  
500 - }  
501 -  
502 - th.data.is_by[th.data.bn_pick]=0;  
503 - //--------------开始计算物流------------------  
504 - var shipping_price=  
505 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,  
506 - goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs);  
507 - if(shipping_price<=0){  
508 - th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券 469 + var code = "";
  470 + if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
  471 + var no_ex_id = ee.no_ex_id;
  472 + th.data.is_no_by[th.data.bn_pick] = 0;
  473 + var no_by_data = null;
  474 + var gift_freight_free = freight_free;
  475 + //有不包邮区域,且不免运费
  476 + if (no_ex_id && freight_free > 0 && freight_free <= allpice - cut_price) {
  477 + //-----------获取不包邮区域,不包邮商品-------
  478 + await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
  479 + data: { store_id: os.stoid, id: no_ex_id }
  480 + }).then(res => {
  481 + if (res.data.code == 0) {
  482 + no_by_data = res.data.data[0];
  483 + //如果有设置不包邮区域的时候
  484 + if (res.data.data[0].region_list) {
  485 + if (th.check_by_area(res.data.data[0].region_list)) {
  486 + freight_free = 0;
  487 + out_of_weight = 0;
  488 + weight_free = -1;
  489 + th.data.is_no_by[th.data.bn_pick] = 1;
  490 + }
  491 + }
  492 + //如果有设置不包邮商品
  493 + if (res.data.data[0].goods_list && freight_free) {
  494 + if (th.check_by_goods(res.data.data[0].goods_list)) {
  495 + freight_free = 0;
  496 + out_of_weight = 0;
  497 + weight_free = -1;
  498 + th.data.is_no_by[th.data.bn_pick] = 1;
  499 + }
  500 + }
  501 + }
  502 + })
  503 + }
  504 +
  505 + //--------------开始计算物流------------------
  506 + var shipping_price =
  507 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  508 + goods_piece, th.data.user_addr, freight_free, allpice - cut_price, rs, th.data.bn_pick);
  509 + if (shipping_price <= 0) {
  510 + th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券
509 } 511 }
510 512
511 shipping_price = parseFloat(shipping_price).toFixed(2); 513 shipping_price = parseFloat(shipping_price).toFixed(2);
512 var wl_txt = "formData.shipping_price"; 514 var wl_txt = "formData.shipping_price";
513 th.setData({ [wl_txt]: shipping_price, }) 515 th.setData({ [wl_txt]: shipping_price, })
514 -  
515 - }else{ 516 +
  517 + } else {
516 var wl_txt = "formData.shipping_price"; 518 var wl_txt = "formData.shipping_price";
517 th.setData({ [wl_txt]: 0, }) 519 th.setData({ [wl_txt]: 0, })
518 } 520 }
519 //---如果有选择优惠券的情况下--- 521 //---如果有选择优惠券的情况下---
520 - var quan_price=0,bn_pick=th.data.bn_pick;  
521 -  
522 - //-----------------支付价,优惠券不减物流----------------- 522 + var quan_price = 0, bn_pick = th.data.bn_pick;
  523 +
  524 + //-----------------支付价,优惠券不减物流-----------------
523 var total_m = (parseFloat(allpice)).toFixed(2); 525 var total_m = (parseFloat(allpice)).toFixed(2);
524 - var order_m = (parseFloat(allpice-cut_price)-quan_price).toFixed(2);  
525 - var coupon_price=quan_price; //优惠券优惠了多少钱  
526 - if(order_m<0) {  
527 - order_m=0;coupon_price=parseFloat(order_m).toFixed(2); 526 + var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2);
  527 + var coupon_price = quan_price; //优惠券优惠了多少钱
  528 + if (order_m < 0) {
  529 + order_m = 0; coupon_price = parseFloat(order_m).toFixed(2);
528 } 530 }
529 -  
530 - //--看一下有没有订单优惠--  
531 - total_m= parseFloat( total_m)+ parseFloat( th.data.formData.shipping_price);  
532 - order_m = parseFloat(order_m)+ parseFloat( th.data.formData.shipping_price);  
533 - var atxt= "formData.total_amount";  
534 - th.setData({ [atxt]: total_m, })  
535 -  
536 - var txt = "formData.user_money";  
537 - var txt2 = "formData.order_amount";  
538 - var txt4="formData.integral";  
539 -  
540 - var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money);  
541 - //--------------如果使用余额---------------------  
542 - if (th.data.bn_use_money == 1) {  
543 - if (amoney> order_m) {  
544 - order_m = order_m.toFixed(2);  
545 - th.setData({ [txt]: order_m, [txt2]:0,[txt4]:all_integral,show_submit:1 })  
546 - }else{  
547 - order_m =parseFloat(order_m - amoney);  
548 - order_m = order_m.toFixed(2);  
549 - th.setData({ [txt]: amoney, [txt2]: order_m,[txt4]:all_integral,show_submit:1 })  
550 - }  
551 - }else{  
552 - th.setData({ [txt]: 0, [txt2]: order_m,[txt4]:all_integral, show_submit:1 })  
553 - }  
554 - 531 +
  532 + //--看一下有没有订单优惠--0
  533 + total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
  534 + order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price);
  535 + var atxt = "formData.total_amount";
  536 + th.setData({ [atxt]: total_m, })
  537 +
  538 + var txt = "formData.user_money";
  539 + var txt2 = "formData.order_amount";
  540 + var txt4 = "formData.integral";
  541 +
  542 + var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money);
  543 + //--------------如果使用余额---------------------
  544 + if (th.data.bn_use_money == 1) {
  545 + if (amoney > order_m) {
  546 + order_m = order_m.toFixed(2);
  547 + th.setData({ [txt]: order_m, [txt2]: 0, [txt4]: all_integral, show_submit: 1 })
  548 + } else {
  549 + order_m = parseFloat(order_m - amoney);
  550 + order_m = order_m.toFixed(2);
  551 + th.setData({ [txt]: amoney, [txt2]: order_m, [txt4]: all_integral, show_submit: 1 })
  552 + }
  553 + } else {
  554 + th.setData({ [txt]: 0, [txt2]: order_m, [txt4]: all_integral, show_submit: 1 })
  555 + }
  556 +
555 wx.hideLoading(); 557 wx.hideLoading();
556 558
557 }); 559 });
@@ -559,104 +561,104 @@ Page({ @@ -559,104 +561,104 @@ Page({
559 }, 561 },
560 562
561 //--------------------提交订单----------------------- 563 //--------------------提交订单-----------------------
562 - async submitForm(t){  
563 - var sub_value=t; 564 + async submitForm(t) {
  565 + var sub_value = t;
564 566
565 - if(this.data.is_summit_ing==1) return false; //--提交中退出--  
566 - this.data.is_summit_ing=1;  
567 - var th=this,pdata=new Array();  
568 - var ff=true; 567 + if (this.data.is_summit_ing == 1) return false; //--提交中退出--
  568 + this.data.is_summit_ing = 1;
  569 + var th = this, pdata = new Array();
  570 + var ff = true;
569 //------------立即购买------------- 571 //------------立即购买-------------
570 - if (th.data.is_b_now==1 && th.data.bn_goods.prom_type!=5){ 572 + if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) {
571 573
572 - if(th.data.bn_exp_type == 0 && th.data.user_addr==null ){  
573 - ff = false; getApp().my_warnning("请选择收货地址",0,th);  
574 - th.data.is_summit_ing = 0; 574 + if (th.data.bn_exp_type == 0 && th.data.user_addr == null) {
  575 + ff = false; getApp().my_warnning("请选择收货地址", 0, th);
  576 + th.data.is_summit_ing = 0;
575 } 577 }
576 if (!ff) return false; 578 if (!ff) return false;
577 var addr = th.data.user_addr; 579 var addr = th.data.user_addr;
578 - if (th.data.bn_exp_type == 1) addr=null; 580 + if (th.data.bn_exp_type == 1) addr = null;
579 581
580 - if(th.data.bn_exp_type==0)  
581 - if(th.data.wu_arr==null || th.data.wu_arr.length<=0){  
582 - getApp().my_warnning("读取物流失败",0,th);  
583 - th.data.is_summit_ing = 0; 582 + if (th.data.bn_exp_type == 0)
  583 + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
  584 + getApp().my_warnning("读取物流失败", 0, th);
  585 + th.data.is_summit_ing = 0;
584 return false; 586 return false;
585 } 587 }
586 -  
587 -  
588 - var integrals=0;  
589 - var get_datas= {  
590 - user_id:getApp().globalData.user_id, store_id:o.stoid,  
591 - };  
592 - await getApp().request.promiseGet("/api/weshop/users/getAllPoints", {  
593 - data: get_datas  
594 - }).then(res => {  
595 - if(res.data.code==0){  
596 - integrals=res.data.data.Integral;  
597 - }  
598 - })  
599 -  
600 - //判断积分的情况  
601 - if(th.data.formData.integral && parseFloat(th.data.formData.integral)< parseFloat(integrals) ){  
602 - getApp().my_warnning("积分不足",0,th);  
603 - th.data.is_summit_ing = 0;  
604 - return false;  
605 - }  
606 -  
607 -  
608 - var item={ 588 +
  589 +
  590 + var integrals = 0;
  591 + var get_datas = {
  592 + user_id: getApp().globalData.user_id, store_id: o.stoid,
  593 + };
  594 + await getApp().request.promiseGet("/api/weshop/users/getAllPoints", {
  595 + data: get_datas
  596 + }).then(res => {
  597 + if (res.data.code == 0) {
  598 + integrals = res.data.data.Integral;
  599 + }
  600 + })
  601 +
  602 + //判断积分的情况
  603 + if (th.data.formData.integral && parseFloat(th.data.formData.integral) < parseFloat(integrals)) {
  604 + getApp().my_warnning("积分不足", 0, th);
  605 + th.data.is_summit_ing = 0;
  606 + return false;
  607 + }
  608 +
  609 +
  610 + var item = {
609 'user_id': to.globalData.user_id, 611 'user_id': to.globalData.user_id,
610 'consignee': addr == null ? "" : addr.consignee, 612 'consignee': addr == null ? "" : addr.consignee,
611 'province': addr == null ? 0 : addr.province, 613 'province': addr == null ? 0 : addr.province,
612 'city': addr == null ? 0 : addr.city, 614 'city': addr == null ? 0 : addr.city,
613 'district': addr == null ? 0 : addr.district, 615 'district': addr == null ? 0 : addr.district,
614 'twon': addr == null ? 0 : addr.twon, 616 'twon': addr == null ? 0 : addr.twon,
615 - 'address': addr == null ? "": addr.address, 617 + 'address': addr == null ? "" : addr.address,
616 'more_address': addr == null ? "" : addr.more_address, 618 'more_address': addr == null ? "" : addr.more_address,
617 //'mobile': th.data.userinfo.mobile, 619 //'mobile': th.data.userinfo.mobile,
618 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile, 620 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile,
619 - 'email':'', 621 + 'email': '',
620 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code, 622 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code,
621 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name, 623 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name,
622 - 'invoice_title':'', 624 + 'invoice_title': '',
623 'goods_price': th.data.formData.all_price, //商品总价 625 'goods_price': th.data.formData.all_price, //商品总价
624 'shipping_price': th.data.formData.shipping_price, //物流金额 626 'shipping_price': th.data.formData.shipping_price, //物流金额
625 'user_money': th.data.formData.user_money, //使用余额 627 'user_money': th.data.formData.user_money, //使用余额
626 'total_amount': th.data.formData.total_amount, //订单总价 628 'total_amount': th.data.formData.total_amount, //订单总价
627 'order_amount': th.data.formData.order_amount, //应付 629 'order_amount': th.data.formData.order_amount, //应付
628 'user_note': t.detail.value.user_note, //用户备注 630 'user_note': t.detail.value.user_note, //用户备注
629 - 'store_id':oo.stoid, //商家 631 + 'store_id': oo.stoid, //商家
630 'pickup_id': th.data.bn_pick, //门店 632 'pickup_id': th.data.bn_pick, //门店
631 'exp_type': th.data.bn_exp_type, //配送方式 633 'exp_type': th.data.bn_exp_type, //配送方式
632 - 'order_goods':new Array(),  
633 - 'integral': th.data.formData.integral, 634 + 'order_goods': new Array(),
  635 + 'integral': th.data.formData.integral,
634 }; 636 };
635 //是不是重新提交 637 //是不是重新提交
636 - if(th.data.is_continue==1) item.is_continue=1; 638 + if (th.data.is_continue == 1) item.is_continue = 1;
637 639
638 //获取立即购买的商品的信息 640 //获取立即购买的商品的信息
639 var gg = to.get_b_now(); 641 var gg = to.get_b_now();
640 //--商品的房间号-- 642 //--商品的房间号--
641 - if(gg.room_id && gg.room_id>0){  
642 - item.room_ids=gg.room_id; 643 + if (gg.room_id && gg.room_id > 0) {
  644 + item.room_ids = gg.room_id;
  645 + }
  646 +
  647 + //老会员成为分销下线需要的参数
  648 + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {
  649 + //判断一下分享人是不是分享商
  650 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => {
  651 + if (res.data.code == 0) {
  652 + var user = res.data.data;
  653 + if (user.is_distribut == 1) {
  654 + item.first_leader = parseInt(getApp().globalData.first_leader);
  655 + }
  656 + }
  657 + })
643 } 658 }
644 -  
645 - //老会员成为分销下线需要的参数  
646 - if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){  
647 - //判断一下分享人是不是分享商  
648 - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{  
649 - if(res.data.code==0){  
650 - var user= res.data.data;  
651 - if(user.is_distribut==1){  
652 - item.first_leader=parseInt(getApp().globalData.first_leader);  
653 - }  
654 - }  
655 - })  
656 - }  
657 -  
658 -  
659 - var goods={ 659 +
  660 +
  661 + var goods = {
660 'goods_id': gg.goods_id, 662 'goods_id': gg.goods_id,
661 'goods_name': gg.goods_name, 663 'goods_name': gg.goods_name,
662 'goods_sn': gg.goods_sn, 664 'goods_sn': gg.goods_sn,
@@ -665,37 +667,37 @@ Page({ @@ -665,37 +667,37 @@ Page({
665 'goods_price': th.data.bn_goods.shop_price, 667 'goods_price': th.data.bn_goods.shop_price,
666 'member_goods_price': th.data.bn_goods.shop_price, 668 'member_goods_price': th.data.bn_goods.shop_price,
667 'store_id': oo.stoid, 669 'store_id': oo.stoid,
668 - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 670 + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型
669 'prom_id': th.data.bn_goods.prom_id, //促销活动id 671 'prom_id': th.data.bn_goods.prom_id, //促销活动id
670 }; 672 };
671 673
672 //-- 把导购的信息填入-- 674 //-- 把导购的信息填入--
673 - if(gg.guide_id){  
674 - goods.guide_id=gg.guide_id;  
675 - goods.guide_type=gg.guide_type;  
676 - //调用接口判断是不是会员  
677 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{  
678 - if(res.data.code==0){  
679 - goods.guide_name=res.data.data.salesman;  
680 - goods.guide_sn=res.data.data.salesman_no;  
681 - }  
682 - }) 675 + if (gg.guide_id) {
  676 + goods.guide_id = gg.guide_id;
  677 + goods.guide_type = gg.guide_type;
  678 + //调用接口判断是不是会员
  679 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
  680 + if (res.data.code == 0) {
  681 + goods.guide_name = res.data.data.salesman;
  682 + goods.guide_sn = res.data.data.salesman_no;
  683 + }
  684 + })
683 } 685 }
684 686
685 //--商品的房间号-- 687 //--商品的房间号--
686 - if(gg.room_id && gg.room_id>0){  
687 - goods.room_id=gg.room_id; 688 + if (gg.room_id && gg.room_id > 0) {
  689 + goods.room_id = gg.room_id;
688 } 690 }
689 - 691 +
690 item.order_goods.push(goods); 692 item.order_goods.push(goods);
691 - pdata.push(item); 693 + pdata.push(item);
692 } 694 }
693 -  
694 695
695 - if (pdata.length==0) return; 696 +
  697 + if (pdata.length == 0) return;
696 var str = JSON.stringify(pdata); 698 var str = JSON.stringify(pdata);
697 -  
698 - wx.showLoading({title: "加载中"}); 699 +
  700 + wx.showLoading({ title: "加载中" });
699 wx.request({ 701 wx.request({
700 url: oo.url + '/api/weshop/order/createWxdOrder', 702 url: oo.url + '/api/weshop/order/createWxdOrder',
701 data: str, 703 data: str,
@@ -705,11 +707,11 @@ Page({ @@ -705,11 +707,11 @@ Page({
705 },// 设置请求的 header 707 },// 设置请求的 header
706 success: function (res) { 708 success: function (res) {
707 709
708 - th.data.is_summit_ing=0; //是否提交中 710 + th.data.is_summit_ing = 0; //是否提交中
709 wx.hideLoading(); 711 wx.hideLoading();
710 if (res.statusCode == 200) { 712 if (res.statusCode == 200) {
711 - var data=res.data;  
712 - if(data.code==0){ 713 + var data = res.data;
  714 + if (data.code == 0) {
713 console.log(th.data.is_b_now); 715 console.log(th.data.is_b_now);
714 //如果是购物车结算,还要删除购物车 716 //如果是购物车结算,还要删除购物车
715 if (th.data.is_b_now == 0) { 717 if (th.data.is_b_now == 0) {
@@ -730,20 +732,20 @@ Page({ @@ -730,20 +732,20 @@ Page({
730 //void e.jumpToCart4({ 732 //void e.jumpToCart4({
731 // order_sn: data.data, 733 // order_sn: data.data,
732 //}, 1); 734 //}, 1);
733 - util_pay.pay(data.data, function() {  
734 - //app.my_warnning("支付成功",1,th);  
735 - //setTimeout(function () {  
736 - wx.redirectTo({  
737 - url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data  
738 - })  
739 - //},1000)  
740 -  
741 - }, function () {  
742 - //支付失败  
743 - setTimeout(function () {  
744 - wx.navigateBack({ delta: 1 })  
745 - },1000)  
746 - },oo.stoid); 735 + util_pay.pay(data.data, function () {
  736 + //app.my_warnning("支付成功",1,th);
  737 + //setTimeout(function () {
  738 + wx.redirectTo({
  739 + url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data
  740 + })
  741 + //},1000)
  742 +
  743 + }, function () {
  744 + //支付失败
  745 + setTimeout(function () {
  746 + wx.navigateBack({ delta: 1 })
  747 + }, 1000)
  748 + }, oo.stoid);
747 749
748 } else { 750 } else {
749 var dd = { 751 var dd = {
@@ -755,110 +757,110 @@ Page({ @@ -755,110 +757,110 @@ Page({
755 data: dd, 757 data: dd,
756 success: function (t) { 758 success: function (t) {
757 //console.log(t); 759 //console.log(t);
758 - if(t.data.code==0){  
759 - //app.my_warnning("支付成功",1,th);  
760 - //setTimeout(function () {  
761 - th.setData({ isclose: 0 });  
762 - wx.redirectTo({  
763 - url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data,  
764 - })  
765 - //}, 1000) 760 + if (t.data.code == 0) {
  761 + //app.my_warnning("支付成功",1,th);
  762 + //setTimeout(function () {
  763 + th.setData({ isclose: 0 });
  764 + wx.redirectTo({
  765 + url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data,
  766 + })
  767 + //}, 1000)
766 } 768 }
767 }, 769 },
768 - fail:function () { 770 + fail: function () {
769 771
770 } 772 }
771 }); 773 });
772 } 774 }
773 775
774 } 776 }
775 - else{  
776 - //--内容换行--  
777 - var msg=data.msg;  
778 - //赠品活动已经取消,无法赠送,是否继续买单?  
779 - if(msg.indexOf("是否继续买单")>0){  
780 - wx.showModal({  
781 - title:"提示",  
782 - content: data.msg,  
783 - cancelText:'取消',  
784 - confirmText:'确定',  
785 - showCancel: true,  
786 - success(res){  
787 - if(res.cancel){  
788 - return;  
789 - }else if(res.confirm){  
790 - th.data.is_continue=1;  
791 - th.submitForm(sub_value);  
792 - }  
793 - }  
794 - })  
795 - return;  
796 - }  
797 - if(msg.length>13){  
798 - msg=msg.slice(0, 13) + "\r\n"+ msg.slice(13);  
799 - }  
800 - getApp().confirmBox(msg);  
801 - }  
802 - }else{  
803 - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); 777 + else {
  778 + //--内容换行--
  779 + var msg = data.msg;
  780 + //赠品活动已经取消,无法赠送,是否继续买单?
  781 + if (msg.indexOf("是否继续买单") > 0) {
  782 + wx.showModal({
  783 + title: "提示",
  784 + content: data.msg,
  785 + cancelText: '取消',
  786 + confirmText: '确定',
  787 + showCancel: true,
  788 + success(res) {
  789 + if (res.cancel) {
  790 + return;
  791 + } else if (res.confirm) {
  792 + th.data.is_continue = 1;
  793 + th.submitForm(sub_value);
  794 + }
  795 + }
  796 + })
  797 + return;
  798 + }
  799 + if (msg.length > 13) {
  800 + msg = msg.slice(0, 13) + "\r\n" + msg.slice(13);
  801 + }
  802 + getApp().confirmBox(msg);
  803 + }
  804 + } else {
  805 + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
804 } 806 }
805 }, 807 },
806 fail: function () { 808 fail: function () {
807 - th.data.is_summit_ing=0; 809 + th.data.is_summit_ing = 0;
808 wx.hideLoading(); 810 wx.hideLoading();
809 console.log("index.js wx.request CheckCallUser fail"); 811 console.log("index.js wx.request CheckCallUser fail");
810 }, 812 },
811 - complete: function () {} 813 + complete: function () { }
812 }) 814 })
813 815
814 }, 816 },
815 - 817 +
816 //---确认线下门店的数量足不足--- 818 //---确认线下门店的数量足不足---
817 - async check_store_num(goods_id,pick,goods_num,func){  
818 - var lock=0,pick_no,plist,erpwareid;  
819 - //先读取门店的lock  
820 - await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{  
821 - data:{store_id:os.stoid,wareId:goods_id,storageId:pick,pageSize:1000}  
822 - }).then(res=>{  
823 - if(res.data.code==0 && res.data.data.total>0){  
824 - for(var i in res.data.data.pageData)  
825 - lock+=res.data.data.pageData[i].outQty;  
826 - }  
827 - })  
828 - //先获取门店的编号  
829 - await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+pick,{  
830 - data:{storeId:os.stoid,goodsId:t.goods_id,pickupId:pick}  
831 - }).then(res=>{  
832 - if(res.data.code==0){  
833 - pick_no=res.data.data.pickup_no;  
834 - }  
835 - })  
836 - //先获取商品的线下库存  
837 - await getApp().request.promiseGet("/api/weshop/goods/get/"+os.stoid+"/"+goods_id,{  
838 - data:{storeId:os.stoid,goodsId:t.goods_id,pickupId:pick}  
839 - }).then(res=>{  
840 - if(res.data.code==0){  
841 - erpwareid=res.data.data.erpwareid;  
842 - }  
843 - })  
844 - //读取线下的门店库存  
845 - await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{  
846 - data:{storageNos:pick_no,wareIds:encodeURIComponent(erpwareid),storeId:os.stoid}  
847 - }).then(res=>{  
848 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){  
849 - plist=res.data.data.pageData[0];  
850 - }  
851 - })  
852 - var isok=1;  
853 - if(goods_num>plist.CanOutQty-lock){  
854 - isok=0;  
855 - }  
856 - func(isok); 819 + async check_store_num(goods_id, pick, goods_num, func) {
  820 + var lock = 0, pick_no, plist, erpwareid;
  821 + //先读取门店的lock
  822 + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
  823 + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }
  824 + }).then(res => {
  825 + if (res.data.code == 0 && res.data.data.total > 0) {
  826 + for (var i in res.data.data.pageData)
  827 + lock += res.data.data.pageData[i].outQty;
  828 + }
  829 + })
  830 + //先获取门店的编号
  831 + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
  832 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
  833 + }).then(res => {
  834 + if (res.data.code == 0) {
  835 + pick_no = res.data.data.pickup_no;
  836 + }
  837 + })
  838 + //先获取商品的线下库存
  839 + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
  840 + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
  841 + }).then(res => {
  842 + if (res.data.code == 0) {
  843 + erpwareid = res.data.data.erpwareid;
  844 + }
  845 + })
  846 + //读取线下的门店库存
  847 + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
  848 + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid }
  849 + }).then(res => {
  850 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
  851 + plist = res.data.data.pageData[0];
  852 + }
  853 + })
  854 + var isok = 1;
  855 + if (goods_num > plist.CanOutQty - lock) {
  856 + isok = 0;
  857 + }
  858 + func(isok);
857 }, 859 },
858 860
859 - useCoupon: function() { 861 + useCoupon: function () {
860 if (this.data.order.couponNum <= 0) { 862 if (this.data.order.couponNum <= 0) {
861 - getApp().my_warnning("无可用优惠券",0,this); 863 + getApp().my_warnning("无可用优惠券", 0, this);
862 return; 864 return;
863 } 865 }
864 866
@@ -869,97 +871,97 @@ Page({ @@ -869,97 +871,97 @@ Page({
869 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a) 871 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
870 }); 872 });
871 }, 873 },
872 - enterAddressPage: function() {  
873 - getApp().globalData.is_cart_old=1;  
874 - this.data.isget_by_quan={}; 874 + enterAddressPage: function () {
  875 + getApp().globalData.is_cart_old = 1;
  876 + this.data.isget_by_quan = {};
875 this.data.enterAddressPage = !0, wx.navigateTo({ 877 this.data.enterAddressPage = !0, wx.navigateTo({
876 url: "/pages/user/address_list/address_list" 878 url: "/pages/user/address_list/address_list"
877 }); 879 });
878 }, 880 },
879 881
880 - 882 +
881 883
882 //--------立即购买时,选择自提和物流---------- 884 //--------立即购买时,选择自提和物流----------
883 - setexptype:function(t){  
884 - var th=this;  
885 - var ty = t.currentTarget.dataset.t,def_exp_code= getApp().globalData.userInfo.def_exp_code;  
886 - th.setData({ bn_exp_type:ty}); 885 + setexptype: function (t) {
  886 + var th = this;
  887 + var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  888 + th.setData({ bn_exp_type: ty });
887 //当物流为空的时候。 889 //当物流为空的时候。
888 - if (ty == 0 && th.data.wu_arr==null){  
889 - th.data.isget_by_quan={}; 890 + if (ty == 0 && th.data.wu_arr == null) {
  891 + th.data.isget_by_quan = {};
890 return th.get_wuliu(th.calculatePrice2()); 892 return th.get_wuliu(th.calculatePrice2());
891 } 893 }
892 894
893 //--自提就要把包邮券清理掉-- 895 //--自提就要把包邮券清理掉--
894 - if(ty==1){  
895 - th.data.isget_by_quan={};  
896 - if(th.data.using_quan && th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby==1){  
897 - th.setData({using_quan:{}}); 896 + if (ty == 1) {
  897 + th.data.isget_by_quan = {};
  898 + if (th.data.using_quan && th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) {
  899 + th.setData({ using_quan: {} });
898 } 900 }
899 } 901 }
900 902
901 - //判断有没有默认的物流地址值  
902 - if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) {  
903 - var wu_arr=this.data.wu_arr;  
904 - if (wu_arr!= null && wu_arr!=""){  
905 - for(var i=0;i<wu_arr.length;i++){  
906 - if (wu_arr[i].shipping_code == def_exp_code){  
907 - th.setData({index:i});  
908 - }  
909 - } 903 + //判断有没有默认的物流地址值
  904 + if (def_exp_code != "" && def_exp_code != null && def_exp_code != undefined) {
  905 + var wu_arr = this.data.wu_arr;
  906 + if (wu_arr != null && wu_arr != "") {
  907 + for (var i = 0; i < wu_arr.length; i++) {
  908 + if (wu_arr[i].shipping_code == def_exp_code) {
  909 + th.setData({ index: i });
910 } 910 }
  911 + }
911 } 912 }
912 - th.calculatePrice2() 913 + }
  914 + th.calculatePrice2()
913 915
914 }, 916 },
915 917
916 //--------立即购买时,使用余额-------- 918 //--------立即购买时,使用余额--------
917 - set_bn_useyuer:function(){  
918 - var th=this;  
919 - th.setData({ bn_use_money: !th.data.bn_use_money}); 919 + set_bn_useyuer: function () {
  920 + var th = this;
  921 + th.setData({ bn_use_money: !th.data.bn_use_money });
920 th.calculatePrice2(); 922 th.calculatePrice2();
921 }, 923 },
922 - set_js_useyuer:function(){ 924 + set_js_useyuer: function () {
923 var th = this; 925 var th = this;
924 th.setData({ js_use_money: !th.data.js_use_money }); 926 th.setData({ js_use_money: !th.data.js_use_money });
925 th.calculatePrice(); 927 th.calculatePrice();
926 }, 928 },
927 //-------------------计算物流--------------- 929 //-------------------计算物流---------------
928 - calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight,  
929 - goods_piece,user_addr, freight_free, o_price, rs){  
930 - var price =0,th=this;  
931 - price +=parseFloat(o_shipping_price); 930 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  931 + goods_piece, user_addr, freight_free, o_price, rs, pickid = null) {
  932 + var price = 0, th = this;
  933 + price += parseFloat(o_shipping_price);
932 //如果是包邮 934 //如果是包邮
933 - if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;}  
934 - if (user_addr==null) { return 0; } 935 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; }
  936 + if (user_addr == null) { return 0; }
935 //计算物流的config item; 937 //计算物流的config item;
936 - var item=null; 938 + var item = null;
937 //先根据 镇 县 区找计算的config 939 //先根据 镇 县 区找计算的config
938 - item = th.get_wuliu_config(user_addr.district,code,rs);  
939 - if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);  
940 - if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);  
941 - if (item == null) item = th.get_wuliu_default(code,rs); 940 + item = th.get_wuliu_config(user_addr.district, code, rs);
  941 + if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs);
  942 + if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs);
  943 + if (item == null) item = th.get_wuliu_default(code, rs);
  944 + if (item == null) return o_shipping_price;
  945 + var fw_price = 0, fp_price = 0;
  946 + item = item.config;
942 if (item == null) return o_shipping_price; 947 if (item == null) return o_shipping_price;
943 - var fw_price = 0, fp_price=0;  
944 - item=item.config;  
945 - if (item == null) return o_shipping_price;  
946 //------按重量---------- 948 //------按重量----------
947 if (goods_weight >= 0 && item['money']) { 949 if (goods_weight >= 0 && item['money']) {
948 - fw_price =parseFloat(item['money']);  
949 - if (goods_weight > item['first_weight']){ 950 + fw_price = parseFloat(item['money']);
  951 + if (goods_weight > item['first_weight']) {
950 var fw = goods_weight - item['first_weight']; 952 var fw = goods_weight - item['first_weight'];
951 - var n = Math.ceil(fw/item['second_weight']) 953 + var n = Math.ceil(fw / item['second_weight'])
952 fw_price = fw_price + n * parseFloat(item['add_money']); 954 fw_price = fw_price + n * parseFloat(item['add_money']);
953 } 955 }
954 } 956 }
955 - //------超出重量----------  
956 - if(out_of_weight < 0 && o_price >= freight_free){ 957 + //------超出重量----------
  958 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
957 fw_price = parseFloat(item['money']); 959 fw_price = parseFloat(item['money']);
958 var out_of_weight = Math.abs(out_of_weight); 960 var out_of_weight = Math.abs(out_of_weight);
959 if (out_of_weight > item['first_weight']) { 961 if (out_of_weight > item['first_weight']) {
960 - var fw = out_of_weight - item['first_weight'];  
961 - var n = Math.ceil(fw / item['second_weight'])  
962 - fw_price = fw_price + n * parseFloat(item['add_money']); 962 + var fw = out_of_weight - item['first_weight'];
  963 + var n = Math.ceil(fw / item['second_weight'])
  964 + fw_price = fw_price + n * parseFloat(item['add_money']);
963 } 965 }
964 } 966 }
965 //------按件数---------- 967 //------按件数----------
@@ -971,21 +973,21 @@ Page({ @@ -971,21 +973,21 @@ Page({
971 fp_price = fp_price + m * parseFloat(item['add_piecemoney']); 973 fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
972 } 974 }
973 } 975 }
974 - var rspice =parseFloat(price + fw_price + fp_price); 976 + var rspice = parseFloat(price + fw_price + fp_price);
975 return rspice; 977 return rspice;
976 }, 978 },
977 979
978 //------------循环获取config----------- 980 //------------循环获取config-----------
979 - get_wuliu_config:function(region_id,code,rs){  
980 - var item=null,rslist = rs.pageData;  
981 - for (var i = 0; i < rslist.length;i++){  
982 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];} 981 + get_wuliu_config: function (region_id, code, rs) {
  982 + var item = null, rslist = rs.pageData;
  983 + for (var i = 0; i < rslist.length; i++) {
  984 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }
983 } 985 }
984 return item; 986 return item;
985 }, 987 },
986 //-------循环获取config,code default------- 988 //-------循环获取config,code default-------
987 get_wuliu_default: function (code, rs) { 989 get_wuliu_default: function (code, rs) {
988 - var item = null, rslist=rs.pageData; 990 + var item = null, rslist = rs.pageData;
989 for (var i = 0; i < rslist.length; i++) { 991 for (var i = 0; i < rslist.length; i++) {
990 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; } 992 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
991 } 993 }
@@ -993,141 +995,140 @@ Page({ @@ -993,141 +995,140 @@ Page({
993 }, 995 },
994 996
995 //----------立即购买,选择物流------------- 997 //----------立即购买,选择物流-------------
996 - bindPickerChange:function(e){ 998 + bindPickerChange: function (e) {
997 var ind = e.detail.value 999 var ind = e.detail.value
998 this.setData({ index: ind }); 1000 this.setData({ index: ind });
999 this.calculatePrice2(); 1001 this.calculatePrice2();
1000 }, 1002 },
1001 //----------购物车结算,选择物流------------- 1003 //----------购物车结算,选择物流-------------
1002 bindPickerChange_w: function (e) { 1004 bindPickerChange_w: function (e) {
1003 - var ind=e.detail.value, txt = e.currentTarget.dataset.txt; 1005 + var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
1004 this.setData({ [txt]: ind }); 1006 this.setData({ [txt]: ind });
1005 this.calculatePrice(); 1007 this.calculatePrice();
1006 }, 1008 },
1007 1009
1008 - cart_set_err:function(e){  
1009 - var txt = e.currentTarget.dataset.err;  
1010 - var ob={};  
1011 - ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";  
1012 - this.setData(ob); 1010 + cart_set_err: function (e) {
  1011 + var txt = e.currentTarget.dataset.err;
  1012 + var ob = {};
  1013 + ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
  1014 + this.setData(ob);
1013 }, 1015 },
1014 - 1016 +
1015 //// 开启物流的弹窗 1017 //// 开启物流的弹窗
1016 - show_wu_arr:function(e){  
1017 - var wu_arr_txt=e.currentTarget.dataset.txt;  
1018 - var w_sele_index=e.currentTarget.dataset.w_sele_index;  
1019 - var is_express=null;  
1020 - var ob={open_express: 1,wu_arr_txt:wu_arr_txt,disabled:1}; 1018 + show_wu_arr: function (e) {
  1019 + var wu_arr_txt = e.currentTarget.dataset.txt;
  1020 + var w_sele_index = e.currentTarget.dataset.w_sele_index;
  1021 + var is_express = null;
  1022 + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 };
1021 1023
1022 //--如果是多个门店的时候-- 1024 //--如果是多个门店的时候--
1023 - if(w_sele_index!=undefined){  
1024 - is_express=this.data.cartlist[w_sele_index].wind;  
1025 - ob['is_express']=is_express; 1025 + if (w_sele_index != undefined) {
  1026 + is_express = this.data.cartlist[w_sele_index].wind;
  1027 + ob['is_express'] = is_express;
1026 } 1028 }
1027 this.setData(ob); 1029 this.setData(ob);
1028 }, 1030 },
1029 - // 关闭物流的弹窗  
1030 - close_express:function(){  
1031 - this.setData({ open_express:0,disabled:0 }); 1031 + // 关闭物流的弹窗
  1032 + close_express: function () {
  1033 + this.setData({ open_express: 0, disabled: 0 });
  1034 + },
  1035 + // 选择物流
  1036 + click_express_name: function (e) {
  1037 + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
  1038 + var index = e.currentTarget.dataset.idxe;
  1039 + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 };
  1040 + ob[this.data.wu_arr_txt] = index;
  1041 + this.setData(ob);
1032 }, 1042 },
1033 - // 选择物流  
1034 - click_express_name:function(e){  
1035 - var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;  
1036 - var index=e.currentTarget.dataset.idxe;  
1037 - var ob={ is_express: index, is_shipping_code: shippingcode,disabled:0};  
1038 - ob[this.data.wu_arr_txt]=index;  
1039 - this.setData(ob);  
1040 - },  
1041 1043
1042 - //点击确定物流  
1043 - determine_expres:function(e){  
1044 - this.setData({ open_express: 0});  
1045 - this.calculatePrice2(); 1044 + //点击确定物流
  1045 + determine_expres: function (e) {
  1046 + this.setData({ open_express: 0 });
  1047 + this.calculatePrice2();
1046 }, 1048 },
1047 - 1049 +
1048 //设置默认物流 1050 //设置默认物流
1049 select_default_logistics: function () { 1051 select_default_logistics: function () {
1050 - var th=this;  
1051 - var is_shipping_code=this.data.is_shipping_code  
1052 - getApp().request.put("/api/weshop/users/update",{  
1053 - data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code},  
1054 - success:function(rse){  
1055 - if (rse.data.code==0){  
1056 - getApp().globalData.userInfo.def_exp_code=is_shipping_code; 1052 + var th = this;
  1053 + var is_shipping_code = this.data.is_shipping_code
  1054 + getApp().request.put("/api/weshop/users/update", {
  1055 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
  1056 + success: function (rse) {
  1057 + if (rse.data.code == 0) {
  1058 + getApp().globalData.userInfo.def_exp_code = is_shipping_code;
1057 th.setData({ open_express: 0 }); 1059 th.setData({ open_express: 0 });
1058 //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19-------- 1060 //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19--------
1059 //if(th.data.is_b_now==1) th.calculatePrice2(); 1061 //if(th.data.is_b_now==1) th.calculatePrice2();
1060 //else th.calculatePrice(); 1062 //else th.calculatePrice();
1061 th.calculatePrice2(); 1063 th.calculatePrice2();
1062 - } 1064 + }
1063 } 1065 }
1064 }) 1066 })
1065 }, 1067 },
1066 1068
1067 //更新下默认,在onshow里面 1069 //更新下默认,在onshow里面
1068 - update_code(){  
1069 - var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;  
1070 - //--定时器,判断wu_arr不未空--  
1071 - var uii=setInterval(function () {  
1072 - if(th.data.wu_arr)  
1073 - {  
1074 - clearInterval(uii);  
1075 - for (var k = 0; k < th.data.wu_arr.length; k++) {  
1076 - var item = th.data.wu_arr[k];  
1077 - if (def_exp_code == item.code) { m_wind = k; }  
1078 - }  
1079 - //--如果是立即购买--  
1080 - th.setData({index: m_wind,is_express:m_wind});  
1081 -  
1082 - }  
1083 - },500); 1070 + update_code() {
  1071 + var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  1072 + //--定时器,判断wu_arr不未空--
  1073 + var uii = setInterval(function () {
  1074 + if (th.data.wu_arr) {
  1075 + clearInterval(uii);
  1076 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  1077 + var item = th.data.wu_arr[k];
  1078 + if (def_exp_code == item.code) { m_wind = k; }
  1079 + }
  1080 + //--如果是立即购买--
  1081 + th.setData({ index: m_wind, is_express: m_wind });
  1082 +
  1083 + }
  1084 + }, 500);
1084 }, 1085 },
1085 - 1086 +
1086 //检查区域是不是包邮 1087 //检查区域是不是包邮
1087 - check_area:function(arr){  
1088 - var user_addr=this.data.user_addr;  
1089 - for(var i in arr){  
1090 - var item=arr[i];  
1091 - if(user_addr.twon==item || user_addr.district==item  
1092 - || user_addr.city==item|| user_addr.province==item ){  
1093 - return 0;  
1094 - }  
1095 - }  
1096 - return 1; 1088 + check_area: function (arr) {
  1089 + var user_addr = this.data.user_addr;
  1090 + for (var i in arr) {
  1091 + var item = arr[i];
  1092 + if (user_addr.twon == item || user_addr.district == item
  1093 + || user_addr.city == item || user_addr.province == item) {
  1094 + return 0;
  1095 + }
  1096 + }
  1097 + return 1;
1097 }, 1098 },
1098 - 1099 +
1099 //检查立即购买的商品是不是不包邮 1100 //检查立即购买的商品是不是不包邮
1100 - check_good:function(arr,goods_id){  
1101 - if(!goods_id) goods_id=this.data.bn_goods.goods_id;  
1102 - for(var i in arr){  
1103 - var item=arr[i];  
1104 - if(goods_id==item) return 0;  
1105 - }  
1106 - return 1; 1101 + check_good: function (arr, goods_id) {
  1102 + if (!goods_id) goods_id = this.data.bn_goods.goods_id;
  1103 + for (var i in arr) {
  1104 + var item = arr[i];
  1105 + if (goods_id == item) return 0;
  1106 + }
  1107 + return 1;
1107 }, 1108 },
1108 - check_by_area:function(region_list){  
1109 - var arr=region_list.split(",");  
1110 - var check=this.check_area(arr);  
1111 - return !check; 1109 + check_by_area: function (region_list) {
  1110 + var arr = region_list.split(",");
  1111 + var check = this.check_area(arr);
  1112 + return !check;
1112 }, 1113 },
1113 - check_by_goods:function(goods_list,goods_id){  
1114 - var arr=goods_list.split(",");  
1115 - var check=this.check_good(arr,goods_id);  
1116 - return !check; 1114 + check_by_goods: function (goods_list, goods_id) {
  1115 + var arr = goods_list.split(",");
  1116 + var check = this.check_good(arr, goods_id);
  1117 + return !check;
1117 }, 1118 },
1118 -  
1119 1119
1120 - //从优惠的映射中拿出商品从表的item  
1121 - arr_get_goods:function(goods_id,arr){  
1122 - for(var i in arr){  
1123 - if(arr[i].goods_id==goods_id) return arr[i];  
1124 - }  
1125 - },  
1126 -  
1127 - //跳转到购买卡  
1128 - buycard:function(){  
1129 - getApp().goto("/pages/user/plus/plus");  
1130 - getApp().globalData.plus_buy_back=1;  
1131 - } 1120 +
  1121 + //从优惠的映射中拿出商品从表的item
  1122 + arr_get_goods: function (goods_id, arr) {
  1123 + for (var i in arr) {
  1124 + if (arr[i].goods_id == goods_id) return arr[i];
  1125 + }
  1126 + },
  1127 +
  1128 + //跳转到购买卡
  1129 + buycard: function () {
  1130 + getApp().goto("/pages/user/plus/plus");
  1131 + getApp().globalData.plus_buy_back = 1;
  1132 + }
1132 1133
1133 }); 1134 });
pages/cart/cart2_pt/cart2_pt.js
1 -var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"), 1 +var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"),
2 s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp(); 2 s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp();
3 -var oo=t.globalData.setting,os=oo; 3 +var oo = t.globalData.setting, os = oo;
4 var regeneratorRuntime = require('../../../utils/runtime.js'); 4 var regeneratorRuntime = require('../../../utils/runtime.js');
5 var util_pay = require("../../../utils/pay.js"); 5 var util_pay = require("../../../utils/pay.js");
6 6
7 Page({ 7 Page({
8 - data: {  
9 - url: t.globalData.setting.url,  
10 - resourceUrl: t.globalData.setting.resourceUrl,  
11 - imgUrl: t.globalData.setting.imghost,  
12 - goods: null,  
13 - order: null,  
14 - orderPrices: null,  
15 - coupons: null,  
16 - coupon: null,  
17 - invoiceToggle: !0,  
18 - payWithUserMoney: !0,  
19 - payWithPoints: !0,  
20 - maxWord: 0,  
21 - enterAddressPage: !1,  
22 - firstEnter: !0,  
23 - //页面获取的参数  
24 - param:null,  
25 - postdata:null,  
26 - //提交订单的格式  
27 - formData: {  
28 - order_amount:0,//支付金额  
29 - total_amount:0,//总价  
30 - all_price:0,//商品卖的总价  
31 - pay_points: 0,//使用积分  
32 - user_money: 0,//使用余额  
33 - couponCode: "",//使用优惠券(多单就用逗号隔开)  
34 - shipping_price:0,//物流费用  
35 - },  
36 -  
37 - /*----------------立即购买---------------------*/  
38 - is_b_now:0, //0是购物车结算 1立即购买  
39 - bn_goods:null, //立即购买时候的调用商品  
40 - bn_use_money:0,//是否使用余额  
41 - bn_exp_type:1, //0是物流 1自提  
42 - bn_pick:0, //选择的门店  
43 - bn_pickname: "", //选择的门店名称  
44 - bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流  
45 - /*------------------------*/  
46 - user_addr:null,//物流  
47 - userinfo:null, //获取会员  
48 - /*----------物流选择--------*/  
49 - wu_arr:null,  
50 - index:0,  
51 -  
52 - //判断页面是返回回来的还是 首次进入的  
53 - isclose:1,  
54 - kt_type:0, //开团类型  
55 - is_pt_tz:0,//是否开团团长  
56 - qh:'', //期号  
57 - pt_listno:'',//期号  
58 - is_normal:0,  
59 - is_express:0,//选择物流的控制器  
60 - yuer:0,  
61 -  
62 - rank_switch:0, //是不是开同等级卡  
63 - show_card:null, //显示的等级卡  
64 - card_name:'', //显示的卡的名称  
65 - card_cut_price:null,//减价多少钱 8 + data: {
  9 + url: t.globalData.setting.url,
  10 + resourceUrl: t.globalData.setting.resourceUrl,
  11 + imgUrl: t.globalData.setting.imghost,
  12 + goods: null,
  13 + order: null,
  14 + orderPrices: null,
  15 + coupons: null,
  16 + coupon: null,
  17 + invoiceToggle: !0,
  18 + payWithUserMoney: !0,
  19 + payWithPoints: !0,
  20 + maxWord: 0,
  21 + enterAddressPage: !1,
  22 + firstEnter: !0,
  23 + //页面获取的参数
  24 + param: null,
  25 + postdata: null,
  26 + //提交订单的格式
  27 + formData: {
  28 + order_amount: 0,//支付金额
  29 + total_amount: 0,//总价
  30 + all_price: 0,//商品卖的总价
  31 + pay_points: 0,//使用积分
  32 + user_money: 0,//使用余额
  33 + couponCode: "",//使用优惠券(多单就用逗号隔开)
  34 + shipping_price: 0,//物流费用
66 }, 35 },
67 - onLoad: function(t) {  
68 - console.log("onLoad_pt_cart");  
69 - var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,});  
70 - var appD=getApp().get_b_now();  
71 -  
72 - th.data.postdata=appD;  
73 - //如果期号有值  
74 - if(appD.qh){  
75 - th.data.qh=appD.qh;  
76 - th.data.pt_listno=appD.qh;  
77 - }  
78 - //th.data.kt_type=appD.kt_type;  
79 - th.setData({kt_type:appD.kt_type});  
80 - if(appD.is_pt_tz) th.data.is_pt_tz=appD.is_pt_tz;  
81 - th.data.param=t;  
82 - //先获取物流,再获取用户信息,再展示页面  
83 - //th.get_wuliu(th.get_info(th.show_page));  
84 - },  
85 - onUnload: function () { this.setData({ isclose: 1 })},  
86 36
87 - //------获取会员信息-----先获取用户信息,在进行下一步---  
88 - get_info:function(func){  
89 - var user_id = t.globalData.user_id;  
90 - to.auth.get_u(func);  
91 - }, 37 + /*----------------立即购买---------------------*/
  38 + is_b_now: 0, //0是购物车结算 1立即购买
  39 + bn_goods: null, //立即购买时候的调用商品
  40 + bn_use_money: 0,//是否使用余额
  41 + bn_exp_type: 1, //0是物流 1自提
  42 + bn_pick: 0, //选择的门店
  43 + bn_pickname: "", //选择的门店名称
  44 + bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
  45 + /*------------------------*/
  46 + user_addr: null,//物流
  47 + userinfo: null, //获取会员
  48 + /*----------物流选择--------*/
  49 + wu_arr: null,
  50 + index: 0,
  51 +
  52 + //判断页面是返回回来的还是 首次进入的
  53 + isclose: 1,
  54 + kt_type: 0, //开团类型
  55 + is_pt_tz: 0,//是否开团团长
  56 + qh: '', //期号
  57 + pt_listno: '',//期号
  58 + is_normal: 0,
  59 + is_express: 0,//选择物流的控制器
  60 + yuer: 0,
  61 +
  62 + rank_switch: 0, //是不是开同等级卡
  63 + show_card: null, //显示的等级卡
  64 + card_name: '', //显示的卡的名称
  65 + card_cut_price: null,//减价多少钱
  66 + },
  67 + onLoad: function (t) {
  68 + console.log("onLoad_pt_cart");
  69 + var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, });
  70 + var appD = getApp().get_b_now();
  71 +
  72 + th.data.postdata = appD;
  73 + //如果期号有值
  74 + if (appD.qh) {
  75 + th.data.qh = appD.qh;
  76 + th.data.pt_listno = appD.qh;
  77 + }
  78 + //th.data.kt_type=appD.kt_type;
  79 + th.setData({ kt_type: appD.kt_type });
  80 + if (appD.is_pt_tz) th.data.is_pt_tz = appD.is_pt_tz;
  81 + th.data.param = t;
  82 + //先获取物流,再获取用户信息,再展示页面
  83 + //th.get_wuliu(th.get_info(th.show_page));
  84 + },
  85 + onUnload: function () { this.setData({ isclose: 1 }) },
92 86
93 - //-------------------获取物流---------------  
94 - get_wuliu(func) {  
95 - var th = this;  
96 - console.log("getwuliu4545");  
97 - to.getwuliu(function (e) {  
98 - if (th.data.is_default_logistics) {  
99 - //如果第一个不是开启默认,说明要让用户自己选  
100 - if (!e[0].is_default) {  
101 - th.setData({ is_default_logistics: 0 });  
102 - } 87 + //------获取会员信息-----先获取用户信息,在进行下一步---
  88 + get_info: function (func) {
  89 + var user_id = t.globalData.user_id;
  90 + to.auth.get_u(func);
  91 + },
  92 +
  93 + //-------------------获取物流---------------
  94 + get_wuliu(func) {
  95 + var th = this;
  96 + console.log("getwuliu4545");
  97 + to.getwuliu(function (e) {
  98 + if (th.data.is_default_logistics) {
  99 + //如果第一个不是开启默认,说明要让用户自己选
  100 + if (!e[0].is_default) {
  101 + th.setData({ is_default_logistics: 0 });
103 } 102 }
104 - th.setData({ wu_arr: e })  
105 - typeof func == "function" && func();  
106 - })  
107 - }, 103 + }
  104 + th.setData({ wu_arr: e })
  105 + typeof func == "function" && func();
  106 + })
  107 + },
108 108
109 - //------获取会员收货地址-----  
110 - getuser_addr:function(func){  
111 - if (to.globalData.baddr!=null){  
112 - var user_addr = to.globalData.baddr;  
113 - to.globalData.baddr=null;  
114 - func(user_addr);  
115 - }else{  
116 - a.get("/api/weshop/useraddress/page", {  
117 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600 }, 109 + //------获取会员收货地址-----
  110 + getuser_addr: function (func) {
  111 + if (to.globalData.baddr != null) {
  112 + var user_addr = to.globalData.baddr;
  113 + to.globalData.baddr = null;
  114 + func(user_addr);
  115 + } else {
  116 + a.get("/api/weshop/useraddress/page", {
  117 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600 },
  118 + success: function (su) {
  119 +
  120 + var user_addr = su.data.data.pageData;
  121 + var item = null;
  122 + var def_item = null;
  123 + for (var i = 0; i < user_addr.length; i++) {
  124 + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }
  125 + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; }
  126 + }
  127 + if (item == null) item = def_item;
  128 + if (item == null) item = user_addr[0];
  129 + if (item == undefined) item = null;
  130 + func(item);
  131 + }
  132 + });
  133 + }
  134 + },
  135 + //----------------展示页面,是再获取用户信息之后--------------
  136 + show_page: function () {
  137 + var th = this;
  138 + //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取
  139 + var user = getApp().globalData.userInfo;
  140 + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {
  141 + data: { r: Math.random() },
  142 + success: function (e) {
  143 +
  144 + getApp().globalData.userInfo = e.data.data;
  145 + th.setData({ userinfo: e.data.data });
  146 + //获取立即购买的商品信息
  147 + th.get_buy_goods();
  148 +
  149 + //获取提现金额
  150 + getApp().request.get("/api/weshop/withdrawals/summoney", {
  151 + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
118 success: function (su) { 152 success: function (su) {
119 -  
120 - var user_addr = su.data.data.pageData;  
121 - var item = null;  
122 - var def_item=null;  
123 - for (var i = 0; i < user_addr.length; i++) {  
124 - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; }  
125 - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } 153 + if (su.data.code == 0) {
  154 + var yuer = parseFloat(th.data.userinfo.user_money -
  155 + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
  156 + if (yuer < 0) yuer = 0;
  157 + th.setData({ txmon: su.data.data.summoney, yuer: yuer });
126 } 158 }
127 - if (item == null) item = def_item;  
128 - if (item == null) item = user_addr[0];  
129 - if (item == undefined) item = null;  
130 - func(item);  
131 } 159 }
132 }); 160 });
133 } 161 }
134 - },  
135 - //----------------展示页面,是再获取用户信息之后--------------  
136 - show_page:function(){  
137 - var th=this;  
138 - //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取  
139 - var user=getApp().globalData.userInfo;  
140 - getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, {  
141 - data:{r:Math.random()},  
142 - success: function (e) {  
143 -  
144 - getApp().globalData.userInfo = e.data.data;  
145 - th.setData({userinfo:e.data.data});  
146 - //获取立即购买的商品信息  
147 - th.get_buy_goods();  
148 -  
149 - //获取提现金额  
150 - getApp().request.get("/api/weshop/withdrawals/summoney", {  
151 - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },  
152 - success: function (su) {  
153 - if (su.data.code == 0) {  
154 - var yuer = parseFloat(th.data.userinfo.user_money -  
155 - (th.data.userinfo.frozen_money>0?th.data.userinfo.frozen_money:0) - su.data.data.summoney).toFixed(2);  
156 - if(yuer<0) yuer=0;  
157 - th.setData({ txmon: su.data.data.summoney, yuer: yuer });  
158 - }  
159 - }  
160 - });  
161 - }  
162 - });  
163 - }, 162 + });
  163 + },
164 164
165 - //-----获取立即购买的商品信息----  
166 - get_buy_goods: function (){  
167 - var th=this,a=getApp().request;  
168 - var gg = th.data.postdata;  
169 - //调用商品  
170 - a.get("/api/weshop/goods/get/" + oo.stoid+"/"+gg.goods_id, {  
171 - success: function (t) {  
172 - var gd = t.data.data;  
173 - if(!gd) return false;  
174 -  
175 - t.data.data.original_img = oo.imghost + t.data.data.original_img;  
176 - t.data.data['buynum'] = gg.goods_num;  
177 - console.log(t.data.data);  
178 - var distr_t = 0, et = 0  
179 - if (t.data.data.distr_type == 0) {  
180 - distr_t = gg.pick_dis;  
181 - } else {  
182 - distr_t = t.data.data.distr_type;  
183 - }  
184 - switch (distr_t) {  
185 - case 0:  
186 - et = 1;  
187 - //-- 系统后台有设置要默认的 --  
188 - if(th.data.json_d.pickupway && th.data.json_d.pickupway==1) et=0;  
189 - break;  
190 - case 1:  
191 - et = 1;  
192 - break;  
193 - case 2:  
194 - et = 0;  
195 - break;  
196 - }  
197 -  
198 - t.data.data.shop_price=gg.goods_price;  
199 - //--如果是普通购买的时候--  
200 - if(gg.is_normal==1){  
201 - t.data.data.prom_id = 0;  
202 - t.data.data.prom_type = 0;  
203 - t.data.data.is_normal=1;  
204 -  
205 - var gd=t.data.data;  
206 - //-- 用商品的手店价来显示 --  
207 - gg.goods_price=gd.shop_price;  
208 - //---是不是购买等级卡成功的返回---等级卡显示的判断---  
209 - var is_card_back=getApp().globalData.is_card_back;  
210 - if(is_card_back){  
211 - gg.goods_price=gd[th.data.card_name];  
212 - t.data.data.shop_price=gg.goods_price;  
213 - getApp().globalData.is_card_back=0;  
214 - th.setData({card_cut_price:0});  
215 - }else{  
216 - //--- 商品不能是搭配购,商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格  
217 - if(th.data.card_name && gd[th.data.card_name]>0 && gg.goods_price>gd[th.data.card_name] && !th.data.userinfo.card_field){  
218 - var cut_p= gg.goods_price-gd[th.data.card_name];  
219 - th.setData({card_cut_price:cut_p});  
220 - }  
221 - }  
222 -  
223 - if(th.data.bn_goods){  
224 - et=th.data.bn_exp_type;  
225 - }  
226 -  
227 -  
228 - th.setData({  
229 - bn_goods: t.data.data, bn_pickname: gg.pick_name,  
230 - bn_pick: gg.pick_id, bn_t_exp_t: distr_t, is_normal:1,bn_exp_type:et  
231 - });  
232 -  
233 -  
234 -  
235 - th.calculatePrice2();  
236 - }else{  
237 -  
238 - //--阶梯团很特殊,不能用总表来拿价格--  
239 - getApp().request.get("/api/weshop/teamlist/get/"+oo.stoid+"/"+gd.prom_id, {  
240 - success: function (tt) {  
241 -  
242 - if (tt.data.code == 0) {  
243 - var pt_data=tt.data.data;  
244 - var now=s.gettimestamp();  
245 -  
246 - if(pt_data.is_end==1){  
247 - t.data.data.prom_id = 0;  
248 - t.data.data.prom_type = 0;  
249 - t.data.data.is_normal=1;  
250 - }else if(now>pt_data.end_time){  
251 - t.data.data.prom_id = 0;  
252 - t.data.data.prom_type = 0;  
253 - t.data.data.is_normal=1;  
254 - }else{  
255 - t.data.data.shop_price = tt.data.data.price; //活动价格  
256 - t.data.data.is_normal=0;  
257 - if(pt_data.kttype==3){  
258 - t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买  
259 - }  
260 - }  
261 - } else {  
262 - t.data.data.prom_id = 0;  
263 - t.data.data.prom_type = 0;  
264 - t.data.data.is_normal=1;  
265 - }  
266 -  
267 - if(th.data.bn_goods){  
268 - et=th.data.bn_exp_type;  
269 - }  
270 -  
271 - th.setData({  
272 - bn_goods: t.data.data, bn_pickname: gg.pick_name,  
273 - bn_pick: gg.pick_id, bn_t_exp_t: distr_t,bn_exp_type:et  
274 - });  
275 -  
276 -  
277 - //计算价格  
278 - th.calculatePrice2();  
279 - }  
280 - });  
281 - }  
282 - }  
283 - });  
284 - }, 165 + //-----获取立即购买的商品信息----
  166 + get_buy_goods: function () {
  167 + var th = this, a = getApp().request;
  168 + var gg = th.data.postdata;
  169 + //调用商品
  170 + a.get("/api/weshop/goods/get/" + oo.stoid + "/" + gg.goods_id, {
  171 + success: function (t) {
  172 + var gd = t.data.data;
  173 + if (!gd) return false;
  174 +
  175 + t.data.data.original_img = oo.imghost + t.data.data.original_img;
  176 + t.data.data['buynum'] = gg.goods_num;
  177 + console.log(t.data.data);
  178 + var distr_t = 0, et = 0
  179 + if (t.data.data.distr_type == 0) {
  180 + distr_t = gg.pick_dis;
  181 + } else {
  182 + distr_t = t.data.data.distr_type;
  183 + }
  184 + switch (distr_t) {
  185 + case 0:
  186 + et = 1;
  187 + //-- 系统后台有设置要默认的 --
  188 + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0;
  189 + break;
  190 + case 1:
  191 + et = 1;
  192 + break;
  193 + case 2:
  194 + et = 0;
  195 + break;
  196 + }
285 197
286 - //----------子页返回父页触发----------  
287 - onShow: function () {  
288 - var th = this;  
289 - if (th.data.isclose == 0) {  
290 - wx.navigateTo({  
291 - url: "/pages/index/index/index"  
292 - })  
293 - } else {  
294 - this.getuser_addr(function (ie) {  
295 - //更换地址回来要重新调用计算价钱的接口  
296 - th.setData({ user_addr: ie });  
297 - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {  
298 - th.setData({ add_back: 1 });  
299 - if (th.data.bn_goods) th.calculatePrice2(); 198 + t.data.data.shop_price = gg.goods_price;
  199 + //--如果是普通购买的时候--
  200 + if (gg.is_normal == 1) {
  201 + t.data.data.prom_id = 0;
  202 + t.data.data.prom_type = 0;
  203 + t.data.data.is_normal = 1;
  204 +
  205 + var gd = t.data.data;
  206 + //-- 用商品的手店价来显示 --
  207 + gg.goods_price = gd.shop_price;
  208 + //---是不是购买等级卡成功的返回---等级卡显示的判断---
  209 + var is_card_back = getApp().globalData.is_card_back;
  210 + if (is_card_back) {
  211 + gg.goods_price = gd[th.data.card_name];
  212 + t.data.data.shop_price = gg.goods_price;
  213 + getApp().globalData.is_card_back = 0;
  214 + th.setData({ card_cut_price: 0 });
  215 + } else {
  216 + //--- 商品不能是搭配购,商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格
  217 + if (th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) {
  218 + var cut_p = gg.goods_price - gd[th.data.card_name];
  219 + th.setData({ card_cut_price: cut_p });
  220 + }
300 } 221 }
301 - })  
302 - //--更新默认地址--,看一下是不是跳到地址页面  
303 - if (!getApp().globalData.is_cart_old) {  
304 - this.update_code(); 222 +
  223 + if (th.data.bn_goods) {
  224 + et = th.data.bn_exp_type;
  225 + }
  226 +
  227 +
  228 + th.setData({
  229 + bn_goods: t.data.data, bn_pickname: gg.pick_name,
  230 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, is_normal: 1, bn_exp_type: et
  231 + });
  232 +
  233 +
  234 +
  235 + th.calculatePrice2();
305 } else { 236 } else {
306 - getApp().globalData.is_cart_old = 0; 237 +
  238 + //--阶梯团很特殊,不能用总表来拿价格--
  239 + getApp().request.get("/api/weshop/teamlist/get/" + oo.stoid + "/" + gd.prom_id, {
  240 + success: function (tt) {
  241 +
  242 + if (tt.data.code == 0) {
  243 + var pt_data = tt.data.data;
  244 + var now = s.gettimestamp();
  245 +
  246 + if (pt_data.is_end == 1) {
  247 + t.data.data.prom_id = 0;
  248 + t.data.data.prom_type = 0;
  249 + t.data.data.is_normal = 1;
  250 + } else if (now > pt_data.end_time) {
  251 + t.data.data.prom_id = 0;
  252 + t.data.data.prom_type = 0;
  253 + t.data.data.is_normal = 1;
  254 + } else {
  255 + t.data.data.shop_price = tt.data.data.price; //活动价格
  256 + t.data.data.is_normal = 0;
  257 + if (pt_data.kttype == 3) {
  258 + t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买
  259 + }
  260 + }
  261 + } else {
  262 + t.data.data.prom_id = 0;
  263 + t.data.data.prom_type = 0;
  264 + t.data.data.is_normal = 1;
  265 + }
  266 +
  267 + if (th.data.bn_goods) {
  268 + et = th.data.bn_exp_type;
  269 + }
  270 +
  271 + th.setData({
  272 + bn_goods: t.data.data, bn_pickname: gg.pick_name,
  273 + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
  274 + });
  275 +
  276 +
  277 + //计算价格
  278 + th.calculatePrice2();
  279 + }
  280 + });
  281 + }
  282 + }
  283 + });
  284 + },
  285 +
  286 + //----------子页返回父页触发----------
  287 + onShow: function () {
  288 + var th = this;
  289 + if (th.data.isclose == 0) {
  290 + wx.navigateTo({
  291 + url: "/pages/index/index/index"
  292 + })
  293 + } else {
  294 + this.getuser_addr(function (ie) {
  295 + //更换地址回来要重新调用计算价钱的接口
  296 + th.setData({ user_addr: ie });
  297 + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
  298 + th.setData({ add_back: 1 });
  299 + if (th.data.bn_goods) th.calculatePrice2();
307 } 300 }
  301 + })
  302 + //--更新默认地址--,看一下是不是跳到地址页面
  303 + if (!getApp().globalData.is_cart_old) {
  304 + this.update_code();
  305 + } else {
  306 + getApp().globalData.is_cart_old = 0;
308 } 307 }
  308 + }
309 309
310 310
311 - //先获取是否有关闭使用优惠券  
312 - getApp().getConfig2(function (ee) {  
313 - var json_d = JSON.parse(ee.switch_list);  
314 - th.data.json_d = json_d;  
315 - th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值  
316 - var is_default_logistics = json_d.is_default_logistics;  
317 -  
318 - th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });  
319 -  
320 - var rank_switch = json_d.rank_switch;  
321 - var max_price = -1;  
322 - var show_card = null;  
323 - var name = "";  
324 - //如果有开等级卡的时候,  
325 - //因为都是调接口,要返回在计算  
326 - if (rank_switch == 2) {  
327 - //-- 获取所有的等级卡, --  
328 - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,  
329 - {}).then(res => {  
330 - if (res.data.code == 0) {  
331 - var plusCard = res.data.data;  
332 - //-- 循环判断,拿到最贵的那张卡 --  
333 - for (var ih in plusCard) {  
334 - if (plusCard[ih].IsStopBuy == true) { continue; }  
335 - if (max_price < 0) { 311 + //先获取是否有关闭使用优惠券
  312 + getApp().getConfig2(function (ee) {
  313 + var json_d = JSON.parse(ee.switch_list);
  314 + th.data.json_d = json_d;
  315 + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
  316 + var is_default_logistics = json_d.is_default_logistics;
  317 +
  318 + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics });
  319 +
  320 + var rank_switch = json_d.rank_switch;
  321 + var max_price = -1;
  322 + var show_card = null;
  323 + var name = "";
  324 + //如果有开等级卡的时候,
  325 + //因为都是调接口,要返回在计算
  326 + if (rank_switch == 2) {
  327 + //-- 获取所有的等级卡, --
  328 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
  329 + {}).then(res => {
  330 + if (res.data.code == 0) {
  331 + var plusCard = res.data.data;
  332 + //-- 循环判断,拿到最贵的那张卡 --
  333 + for (var ih in plusCard) {
  334 + if (plusCard[ih].IsStopBuy == true) { continue; }
  335 + if (max_price < 0) {
  336 + max_price = plusCard[ih].CardFee;
  337 + name = 'card' + plusCard[ih]['CorrPrice'];
  338 + show_card = plusCard[ih];
  339 + } else {
  340 + if (max_price < plusCard[ih].CardFee) {
336 max_price = plusCard[ih].CardFee; 341 max_price = plusCard[ih].CardFee;
337 name = 'card' + plusCard[ih]['CorrPrice']; 342 name = 'card' + plusCard[ih]['CorrPrice'];
338 show_card = plusCard[ih]; 343 show_card = plusCard[ih];
339 - } else {  
340 - if (max_price < plusCard[ih].CardFee) {  
341 - max_price = plusCard[ih].CardFee;  
342 - name = 'card' + plusCard[ih]['CorrPrice'];  
343 - show_card = plusCard[ih];  
344 - }  
345 } 344 }
346 } 345 }
  346 + }
347 347
348 - if (show_card) {  
349 - name = name.toLowerCase();  
350 - th.setData({ card_name: name, show_card: show_card })  
351 - } 348 + if (show_card) {
  349 + name = name.toLowerCase();
  350 + th.setData({ card_name: name, show_card: show_card })
352 } 351 }
353 - //-----先获取物流,再获取用户信息,再展示页面-----  
354 - th.get_wuliu(th.get_info(th.show_page));  
355 - }) 352 + }
  353 + //-----先获取物流,再获取用户信息,再展示页面-----
  354 + th.get_wuliu(th.get_info(th.show_page));
  355 + })
  356 + } else {
  357 + //-----先获取物流,再获取用户信息,再展示页面-----
  358 + th.get_wuliu(th.get_info(th.show_page));
  359 + }
  360 + }, 1)
  361 +
  362 + },
  363 + //---------------检查是否有收货地址-------------------
  364 + checkAddressList: function () {
  365 + var t = this;
  366 + return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
  367 + title: "请先填写或选择收货地址~",
  368 + success: function (a) {
  369 + a.confirm ? t.enterAddressPage() : wx.navigateBack();
  370 + },
  371 + fail: function () {
  372 + wx.navigateBack();
  373 + }
  374 + }), !1);
  375 + },
  376 + showInvoice: function () {
  377 + this.setData({
  378 + invoiceToggle: !this.data.invoiceToggle
  379 + });
  380 + },
  381 + keyUpChangePay1: function (t) {
  382 + this.setData({
  383 + payWithUserMoney: !(t.detail.value.length > 0)
  384 + });
  385 + },
  386 + keyUpChangePay2: function (t) {
  387 + this.setData({
  388 + payWithPoints: !(t.detail.value.length > 0)
  389 + });
  390 + },
  391 + keyUpChangeNum: function (t) {
  392 + this.setData({
  393 + maxWord: t.detail.value.length
  394 + });
  395 + },
  396 + //---------计算立即购买----------
  397 + calculatePrice2: function () {
  398 + var th = this, good = this.data.bn_goods;
  399 + //-----------计算商品总价--------------
  400 + var allpice = good.shop_price * good.buynum;
  401 + allpice = parseFloat(allpice).toFixed(2);
  402 + var txt = "formData.all_price";
  403 + th.setData({ [txt]: allpice, });
  404 + console.log(th.data.formData);
  405 +
  406 + to.getConfig2(function (ee) {
  407 + to.getwuliuprice(function (rs) {
  408 + console.log('calculatePrice2222');
  409 + console.log(rs);
  410 + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
  411 + var out_of_weight = null; //超出多少重量
  412 + var freight_free = ee.freight_free; //全场满多少包邮
  413 + var weight_free = ee.weight_free; //多少kg内包邮
  414 + //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
  415 + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  416 + switch (good['exp_sum_type']) {
  417 + case 1:
  418 + //统一运费
  419 + o_shipping_price += good['uniform_exp_sum']; break;
  420 + case 2:
  421 + if (goods_weight < 0) goods_weight = 0;
  422 + //累积商品重量 每种商品的重量 * 数量
  423 + goods_weight += good['weight'] * good['buynum'];
  424 + if (weight_free > 0) {
  425 + out_of_weight = (weight_free * 1000) - goods_weight;
  426 + }
  427 + break;
  428 + case 3:
  429 + if (goods_piece < 0) goods_piece = 0;
  430 + //累积商品数量
  431 + goods_piece += good['buynum']; break;
  432 + }
  433 +
  434 + console.log(o_shipping_price + ":" + goods_weight + ":" + goods_piece);
  435 + console.log(th.data.wu_arr);
  436 + var code = th.data.wu_arr[th.data.index].code;
  437 + var freight_free = ee.freight_free; //全场满多少包邮
  438 + var shipping_price =
  439 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  440 + goods_piece, th.data.user_addr, freight_free, allpice, rs);
  441 +
  442 + shipping_price = parseFloat(shipping_price).toFixed(2);
  443 + var wl_txt = "formData.shipping_price";
  444 + th.setData({ [wl_txt]: shipping_price, })
  445 +
356 } else { 446 } else {
357 - //-----先获取物流,再获取用户信息,再展示页面-----  
358 - th.get_wuliu(th.get_info(th.show_page)); 447 + var wl_txt = "formData.shipping_price";
  448 + th.setData({ [wl_txt]: 0, })
  449 + }
  450 + //-----------------总价-----------------
  451 + var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price);
  452 + total_m = parseFloat(total_m).toFixed(2);
  453 +
  454 + var atxt = "formData.total_amount";
  455 + th.setData({ [atxt]: total_m, })
  456 + var order_m = total_m;
  457 +
  458 + var txt = "formData.user_money";
  459 + var txt2 = "formData.order_amount";
  460 + //--------------如果使用余额---------------------
  461 + if (th.data.bn_use_money == 1 && th.data.yuer > 0) {
  462 + if (parseFloat(th.data.yuer) > total_m) {
  463 + th.setData({ [txt]: total_m, [txt2]: 0 })
  464 + } else {
  465 + order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
  466 + order_m = order_m.toFixed(2);
  467 + th.setData({ [txt]: th.data.yuer, [txt2]: order_m })
  468 + }
  469 + } else {
  470 + th.setData({ [txt]: 0, [txt2]: order_m })
359 } 471 }
360 - }, 1)  
361 -  
362 - },  
363 - //---------------检查是否有收货地址-------------------  
364 - checkAddressList: function() {  
365 - var t = this;  
366 - return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({  
367 - title: "请先填写或选择收货地址~",  
368 - success: function(a) {  
369 - a.confirm ? t.enterAddressPage() : wx.navigateBack();  
370 - },  
371 - fail: function() {  
372 - wx.navigateBack();  
373 - }  
374 - }), !1);  
375 - },  
376 - showInvoice: function() {  
377 - this.setData({  
378 - invoiceToggle: !this.data.invoiceToggle  
379 - });  
380 - },  
381 - keyUpChangePay1: function(t) {  
382 - this.setData({  
383 - payWithUserMoney: !(t.detail.value.length > 0)  
384 - });  
385 - },  
386 - keyUpChangePay2: function(t) {  
387 - this.setData({  
388 - payWithPoints: !(t.detail.value.length > 0)  
389 - });  
390 - },  
391 - keyUpChangeNum: function(t) {  
392 - this.setData({  
393 - maxWord: t.detail.value.length  
394 - });  
395 - },  
396 - //---------计算立即购买----------  
397 - calculatePrice2: function () {  
398 - var th = this, good = this.data.bn_goods;  
399 - //-----------计算商品总价--------------  
400 - var allpice = good.shop_price * good.buynum;  
401 - allpice=parseFloat(allpice).toFixed(2);  
402 - var txt = "formData.all_price";  
403 - th.setData({ [txt]: allpice, });  
404 - console.log(th.data.formData);  
405 -  
406 - to.getConfig2(function (ee) {  
407 - to.getwuliuprice(function (rs) {  
408 - console.log('calculatePrice2222');  
409 - console.log(rs);  
410 - var o_shipping_price = 0,goods_weight = -1,goods_piece = -1;  
411 - var out_of_weight=null; //超出多少重量  
412 - var freight_free = ee.freight_free; //全场满多少包邮  
413 - var weight_free = ee.weight_free; //多少kg内包邮  
414 - //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------  
415 - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){  
416 - switch (good['exp_sum_type']) {  
417 - case 1:  
418 - //统一运费  
419 - o_shipping_price += good['uniform_exp_sum']; break;  
420 - case 2:  
421 - if (goods_weight < 0) goods_weight = 0;  
422 - //累积商品重量 每种商品的重量 * 数量  
423 - goods_weight += good['weight'] * good['buynum'];  
424 - if(weight_free > 0){  
425 - out_of_weight = (weight_free * 1000 ) - goods_weight;  
426 - }  
427 - break;  
428 - // goods_weight += good['weight'] * good['buynum'];break;  
429 - case 3:  
430 - if (goods_piece < 0) goods_piece = 0;  
431 - //累积商品数量  
432 - goods_piece += good['buynum']; break;  
433 - }  
434 -  
435 - console.log(o_shipping_price + ":" + goods_weight + ":" + goods_piece);  
436 - console.log(th.data.wu_arr);  
437 - var code = th.data.wu_arr[th.data.index].code;  
438 - var freight_free = ee.freight_free; //全场满多少包邮  
439 - var shipping_price=  
440 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,  
441 - goods_piece, th.data.user_addr, freight_free, allpice, rs);  
442 -  
443 - shipping_price = parseFloat(shipping_price).toFixed(2);  
444 - var wl_txt = "formData.shipping_price";  
445 - th.setData({ [wl_txt]: shipping_price, })  
446 -  
447 - }else{  
448 - var wl_txt = "formData.shipping_price";  
449 - th.setData({ [wl_txt]: 0, })  
450 - }  
451 - //-----------------总价-----------------  
452 - var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price);  
453 - total_m = parseFloat(total_m).toFixed(2);  
454 -  
455 - var atxt= "formData.total_amount";  
456 - th.setData({ [atxt]: total_m, })  
457 - var order_m = total_m;  
458 -  
459 - var txt = "formData.user_money";  
460 - var txt2 = "formData.order_amount";  
461 - //--------------如果使用余额---------------------  
462 - if (th.data.bn_use_money == 1 && th.data.yuer>0) {  
463 - if ( parseFloat(th.data.yuer) > total_m) {  
464 - th.setData({ [txt]: total_m, [txt2]:0 })  
465 - }else{  
466 - order_m = parseFloat(order_m) - parseFloat(th.data.yuer);  
467 - order_m = order_m.toFixed(2);  
468 - th.setData({ [txt]: th.data.yuer, [txt2]: order_m })  
469 - }  
470 - }else{  
471 - th.setData({ [txt]: 0, [txt2]: order_m })  
472 - }  
473 472
474 - });  
475 }); 473 });
476 - },  
477 - //--------------------提交订单-----------------------  
478 - submitForm: async function(t){  
479 - if(this.data.is_summit_ing==1) return false; //--提交中退出--  
480 - this.data.is_summit_ing=1;  
481 -  
482 - var th=this,pdata=new Array();  
483 - var ff=true;  
484 - //------------立即购买-------------  
485 - console.log("buy_new");  
486 -  
487 - //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候  
488 - if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){  
489 - ff = false;  
490 - getApp().my_warnning("请选择收货地址",0,this);  
491 - this.data.is_summit_ing = 0;  
492 - }  
493 - if (!ff) return false;  
494 - var addr = th.data.user_addr;  
495 - if (th.data.bn_exp_type == 1) addr=null;  
496 -  
497 - console.log(th.data.formData);  
498 - console.log(th.data.wu_arr);  
499 - console.log(th.data.bn_exp_type);  
500 -  
501 - if(th.data.bn_exp_type==0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1)) {  
502 - if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {  
503 - getApp().my_warnning("读取物流失败",0,this);  
504 - this.data.is_summit_ing = 0;  
505 - return false; 474 + });
  475 + },
  476 + //--------------------提交订单-----------------------
  477 + submitForm: async function (t) {
  478 + if (this.data.is_summit_ing == 1) return false; //--提交中退出--
  479 + this.data.is_summit_ing = 1;
  480 +
  481 + var th = this, pdata = new Array();
  482 + var ff = true;
  483 + //------------立即购买-------------
  484 + console.log("buy_new");
  485 +
  486 + //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候
  487 + if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  488 + ff = false;
  489 + getApp().my_warnning("请选择收货地址", 0, this);
  490 + this.data.is_summit_ing = 0;
  491 + }
  492 + if (!ff) return false;
  493 + var addr = th.data.user_addr;
  494 + if (th.data.bn_exp_type == 1) addr = null;
  495 +
  496 + console.log(th.data.formData);
  497 + console.log(th.data.wu_arr);
  498 + console.log(th.data.bn_exp_type);
  499 +
  500 + if (th.data.bn_exp_type == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  501 + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
  502 + getApp().my_warnning("读取物流失败", 0, this);
  503 + this.data.is_summit_ing = 0;
  504 + return false;
  505 + }
  506 + }
  507 +
  508 + //阶梯团强制带1,自提~~~
  509 + if (th.data.kt_type == 3) {
  510 + th.data.bn_exp_type = 1;
  511 + }
  512 +
  513 + var item = {
  514 + 'user_id': to.globalData.user_id,
  515 + 'consignee': addr == null ? "" : addr.consignee,
  516 + 'province': addr == null ? 0 : addr.province,
  517 + 'city': addr == null ? 0 : addr.city,
  518 + 'district': addr == null ? 0 : addr.district,
  519 + 'twon': addr == null ? 0 : addr.twon,
  520 + 'address': addr == null ? "" : addr.address,
  521 + 'more_address': addr == null ? "" : addr.more_address,
  522 + 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile,
  523 + 'email': '',
  524 + 'invoice_title': '',
  525 + 'goods_price': th.data.formData.all_price, //商品总价
  526 + 'shipping_price': th.data.formData.shipping_price, //物流金额
  527 + 'user_money': th.data.formData.user_money, //使用余额
  528 + 'total_amount': th.data.formData.total_amount, //订单总价
  529 + 'order_amount': th.data.formData.order_amount, //应付
  530 + 'user_note': t.detail.value.user_note, //用户备注
  531 + 'store_id': oo.stoid, //商家
  532 + 'pickup_id': th.data.bn_pick, //门店
  533 + 'exp_type': th.data.bn_exp_type, //配送方式
  534 + 'is_normal': th.data.bn_goods.is_normal, //是否是普通购买
  535 + 'pt_prom_id': th.data.bn_goods.prom_id, //拼单ID
  536 + 'is_pt_tz': th.data.is_pt_tz, //开团类型
  537 + 'order_goods': new Array(),
  538 + };
  539 +
  540 + //如果不是阶梯团,或者是普通购买,
  541 + if ((th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  542 + item['shipping_code'] = th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;
  543 + item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;
  544 + }
  545 +
  546 + if (!th.data.bn_goods.is_normal) {
  547 + item.is_zsorder = th.data.kt_type + 1; //开团类型
  548 + }
  549 + //老会员成为分销下线需要的参数
  550 + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {
  551 + //判断一下分享人是不是分享商
  552 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => {
  553 + if (res.data.code == 0) {
  554 + var user = res.data.data;
  555 + if (user.is_distribut == 1) {
  556 + item.first_leader = parseInt(getApp().globalData.first_leader);
506 } 557 }
507 } 558 }
508 -  
509 - //阶梯团强制带1,自提~~~  
510 - if(th.data.kt_type==3 ){  
511 - th.data.bn_exp_type=1;  
512 - }  
513 -  
514 - var item={  
515 - 'user_id': to.globalData.user_id,  
516 - 'consignee': addr == null ? "" : addr.consignee,  
517 - 'province': addr == null ? 0 : addr.province,  
518 - 'city': addr == null ? 0 : addr.city,  
519 - 'district': addr == null ? 0 : addr.district,  
520 - 'twon': addr == null ? 0 : addr.twon,  
521 - 'address': addr == null ? "": addr.address,  
522 - 'more_address': addr == null ? "" : addr.more_address,  
523 - 'mobile': addr == null ? th.data.userinfo.mobile:addr.mobile,  
524 - 'email':'',  
525 - 'invoice_title':'',  
526 - 'goods_price': th.data.formData.all_price, //商品总价  
527 - 'shipping_price': th.data.formData.shipping_price, //物流金额  
528 - 'user_money': th.data.formData.user_money, //使用余额  
529 - 'total_amount': th.data.formData.total_amount, //订单总价  
530 - 'order_amount': th.data.formData.order_amount, //应付  
531 - 'user_note': t.detail.value.user_note, //用户备注  
532 - 'store_id':oo.stoid, //商家  
533 - 'pickup_id': th.data.bn_pick, //门店  
534 - 'exp_type': th.data.bn_exp_type, //配送方式  
535 - 'is_normal':th.data.bn_goods.is_normal, //是否是普通购买  
536 - 'pt_prom_id':th.data.bn_goods.prom_id, //拼单ID  
537 - 'is_pt_tz':th.data.is_pt_tz, //开团类型  
538 - 'order_goods':new Array(),  
539 - };  
540 -  
541 - //如果不是阶梯团,或者是普通购买,  
542 - if((th.data.kt_type!=3 || th.data.bn_goods.is_normal==1)){  
543 - item['shipping_code']= th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;  
544 - item['shipping_name']= th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;  
545 - }  
546 -  
547 - if(!th.data.bn_goods.is_normal){  
548 - item.is_zsorder=th.data.kt_type+1; //开团类型  
549 - }  
550 - //老会员成为分销下线需要的参数  
551 - if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){  
552 - //判断一下分享人是不是分享商  
553 - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{  
554 - if(res.data.code==0){  
555 - var user= res.data.data;  
556 - if(user.is_distribut==1){  
557 - item.first_leader=parseInt(getApp().globalData.first_leader);  
558 - }  
559 - }  
560 - })  
561 - }  
562 -  
563 - if(th.data.qh!='')  
564 - {  
565 - item.team_qh=th.data.qh;  
566 - item.pt_listno=th.data.qh;  
567 - }  
568 -  
569 - var gg = to.get_b_now();  
570 - var goods={  
571 - 'goods_id': gg.goods_id,  
572 - 'goods_name': gg.goods_name,  
573 - 'goods_sn': gg.goods_sn,  
574 - 'goods_num': gg.goods_num,  
575 - 'market_price': th.data.bn_goods.market_price,  
576 - 'goods_price': th.data.bn_goods.shop_price,  
577 - 'member_goods_price': th.data.bn_goods.shop_price,  
578 - 'store_id': oo.stoid,  
579 - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型  
580 - 'prom_id': th.data.bn_goods.prom_id, //促销活动id  
581 - };  
582 -  
583 - //--导购分享过来的id--  
584 - if(gg.guide_id){  
585 - goods.guide_id=gg.guide_id;  
586 - goods.guide_type=gg.guide_type;  
587 - //调用接口判断是不是会员  
588 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{  
589 - if(res.data.code==0){  
590 - goods.guide_name=res.data.data.salesman;  
591 - goods.guide_sn=res.data.data.salesman_no;  
592 - }  
593 - })  
594 - }  
595 -  
596 - //--商品的房间号--  
597 - if(gg.room_id && gg.room_id>0){  
598 - item.room_ids=gg.room_id;  
599 - goods.room_id=gg.room_id; 559 + })
  560 + }
  561 +
  562 + if (th.data.qh != '') {
  563 + item.team_qh = th.data.qh;
  564 + item.pt_listno = th.data.qh;
  565 + }
  566 +
  567 + var gg = to.get_b_now();
  568 + var goods = {
  569 + 'goods_id': gg.goods_id,
  570 + 'goods_name': gg.goods_name,
  571 + 'goods_sn': gg.goods_sn,
  572 + 'goods_num': gg.goods_num,
  573 + 'market_price': th.data.bn_goods.market_price,
  574 + 'goods_price': th.data.bn_goods.shop_price,
  575 + 'member_goods_price': th.data.bn_goods.shop_price,
  576 + 'store_id': oo.stoid,
  577 + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型
  578 + 'prom_id': th.data.bn_goods.prom_id, //促销活动id
  579 + };
  580 +
  581 + //--导购分享过来的id--
  582 + if (gg.guide_id) {
  583 + goods.guide_id = gg.guide_id;
  584 + goods.guide_type = gg.guide_type;
  585 + //调用接口判断是不是会员
  586 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
  587 + if (res.data.code == 0) {
  588 + goods.guide_name = res.data.data.salesman;
  589 + goods.guide_sn = res.data.data.salesman_no;
600 } 590 }
601 -  
602 - if(th.data.bn_goods.is_normal){goods.is_pd_normal=1;}  
603 -  
604 - item.order_goods.push(goods);  
605 - pdata.push(item);  
606 -  
607 - if (pdata.length==0) return;  
608 - var str = JSON.stringify(pdata);  
609 - console.log("支付数据");  
610 - console.log(str);  
611 - //return false;  
612 - wx.showLoading({title: "加载中"});  
613 - wx.request({  
614 - url: oo.url + '/api/weshop/order/createWxdOrder',  
615 - data: str,  
616 - method: 'POST',  
617 - header: {  
618 - 'content-type': 'application/json'  
619 - },// 设置请求的 header  
620 - success: function (res) {  
621 -  
622 - wx.hideLoading();  
623 - if (res.statusCode == 200) {  
624 - var data=res.data;  
625 - if(data.code==0){  
626 - console.log(th.data.is_b_now);  
627 - //如果是购物车结算,还要删除购物车  
628 - if (th.data.is_b_now == 0) {  
629 - console.log(th.data.cartlist_y);  
630 - var list = th.data.cartlist_y;  
631 - for (var i = 0; i < list.length; i++) {  
632 - //删除购物车  
633 - getApp().request.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {});  
634 - }  
635 - }  
636 - var order_amount = 0;  
637 - pdata.forEach(function (em, ind) {  
638 - order_amount += em.order_amount;  
639 - })  
640 - //要进行判断,如果是用微信支付,就要跳转到支付界面  
641 - if (order_amount > 0) { 591 + })
  592 + }
  593 +
  594 +
  595 + //--商品的房间号--
  596 + if (gg.room_id && gg.room_id > 0) {
  597 + item.room_ids = gg.room_id;
  598 + goods.room_id = gg.room_id;
  599 + }
  600 +
  601 + if (th.data.bn_goods.is_normal) { goods.is_pd_normal = 1; }
  602 +
  603 + item.order_goods.push(goods);
  604 + pdata.push(item);
  605 +
  606 + if (pdata.length == 0) return;
  607 + var str = JSON.stringify(pdata);
  608 + console.log("支付数据");
  609 + console.log(str);
  610 + //return false;
  611 + wx.showLoading({ title: "加载中" });
  612 + wx.request({
  613 + url: oo.url + '/api/weshop/order/createWxdOrder',
  614 + data: str,
  615 + method: 'POST',
  616 + header: {
  617 + 'content-type': 'application/json'
  618 + },// 设置请求的 header
  619 + success: function (res) {
  620 +
  621 + wx.hideLoading();
  622 + if (res.statusCode == 200) {
  623 + var data = res.data;
  624 + if (data.code == 0) {
  625 + console.log(th.data.is_b_now);
  626 + //如果是购物车结算,还要删除购物车
  627 + if (th.data.is_b_now == 0) {
  628 + console.log(th.data.cartlist_y);
  629 + var list = th.data.cartlist_y;
  630 + for (var i = 0; i < list.length; i++) {
  631 + //删除购物车
  632 + getApp().request.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {});
  633 + }
  634 + }
  635 + var order_amount = 0;
  636 + pdata.forEach(function (em, ind) {
  637 + order_amount += em.order_amount;
  638 + })
  639 + //要进行判断,如果是用微信支付,就要跳转到支付界面
  640 + if (order_amount > 0) {
  641 + th.setData({ isclose: 0 });
  642 + //void e.jumpToCart4({
  643 + // order_sn: data.data,
  644 + // type:1,
  645 + // }, 1);
  646 + util_pay.pay(data.data, function () {
  647 + setTimeout(function () {
  648 + wx.reLaunch({
  649 + //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,
  650 + url: "/pages/team/team_success/team_success?ordersn=" + data.data,
  651 + })
  652 + }, 1000)
  653 + }, function () {
  654 + //支付失败
  655 + setTimeout(function () {
  656 + //wx.navigateBack({ delta: 1 })
  657 + wx.reLaunch({
  658 + url: "/pages/user/order_list/order_list",
  659 + })
  660 + }, 1000)
  661 +
  662 + }, oo.stoid, 1);
  663 +
  664 + } else {
  665 + var dd = {
  666 + parent_sn: data.data,
  667 + store_id: oo.stoid,
  668 + type: 1,
  669 + };
  670 + //return false;
  671 + getApp().request.post("/api/weshop/order/pay/createOrder", {
  672 + data: dd,
  673 + success: function (t) {
  674 + console.log(t);
  675 + app.my_warnning("支付成功", 1, th);
  676 + setTimeout(function () {
642 th.setData({ isclose: 0 }); 677 th.setData({ isclose: 0 });
643 - //void e.jumpToCart4({  
644 - // order_sn: data.data,  
645 - // type:1,  
646 - // }, 1);  
647 - util_pay.pay(data.data, function() {  
648 - setTimeout(function () {  
649 - wx.reLaunch({  
650 - //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,  
651 - url: "/pages/team/team_success/team_success?ordersn=" + data.data,  
652 - })  
653 - },1000)  
654 - }, function () {  
655 - //支付失败  
656 - setTimeout(function () {  
657 - //wx.navigateBack({ delta: 1 })  
658 - wx.reLaunch({  
659 - url: "/pages/user/order_list/order_list",  
660 - })  
661 - },1000)  
662 -  
663 - },oo.stoid,1);  
664 678
665 - } else {  
666 - var dd = {  
667 - parent_sn: data.data,  
668 - store_id: oo.stoid,  
669 - type: 1,  
670 - };  
671 - //return false;  
672 - getApp().request.post("/api/weshop/order/pay/createOrder", {  
673 - data: dd,  
674 - success: function (t) {  
675 - console.log(t);  
676 - app.my_warnning("支付成功",1,th);  
677 - setTimeout(function () {  
678 - th.setData({ isclose: 0 });  
679 -  
680 - if(th.data.is_normal==1){  
681 - /*--  
682 - wx.navigateTo({  
683 - url: "/pages/user/order_list/order_list",  
684 - })--*/  
685 - var url="/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data;  
686 - wx.reLaunch({  
687 - url: url  
688 - })  
689 -  
690 - }else{  
691 - wx.reLaunch({  
692 - url: "/pages/team/team_success/team_success?ordersn=" + data.data,  
693 - })  
694 - }  
695 -  
696 -  
697 - }, 1000) 679 + if (th.data.is_normal == 1) {
  680 + /*--
  681 + wx.navigateTo({
  682 + url: "/pages/user/order_list/order_list",
  683 + })--*/
  684 + var url = "/pages/payment/pay_success/pay_success?type=1&order_sn=" + data.data;
  685 + wx.reLaunch({
  686 + url: url
  687 + })
  688 +
  689 + } else {
  690 + wx.reLaunch({
  691 + url: "/pages/team/team_success/team_success?ordersn=" + data.data,
  692 + })
698 } 693 }
699 - }); 694 +
  695 +
  696 + }, 1000)
700 } 697 }
701 - }  
702 - else{  
703 - th.data.is_summit_ing=0; //是否提交中  
704 - getApp().confirmBox(data.msg);  
705 - }  
706 - } else {  
707 - th.data.is_summit_ing=0; //是否提交中  
708 - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); 698 + });
  699 + }
709 } 700 }
710 - },  
711 - fail: function () {  
712 - th.data.is_summit_ing=0; //是否提交中  
713 - wx.hideLoading();  
714 - console.log("index.js wx.request CheckCallUser fail");  
715 - },  
716 - complete: function () {}  
717 - })  
718 - },  
719 - useCoupon: function() {  
720 - if (this.data.order.couponNum <= 0) {  
721 - //return t.showWarning("无可用优惠券");  
722 - getApp().my_warnning("无可用优惠券",0,this);  
723 - return; 701 + else {
  702 + th.data.is_summit_ing = 0; //是否提交中
  703 + getApp().confirmBox(data.msg);
  704 + }
  705 + } else {
  706 + th.data.is_summit_ing = 0; //是否提交中
  707 + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
724 } 708 }
725 - var a = {  
726 - lid: this.data.coupon ? this.data.coupon.id : "0"  
727 - };  
728 - wx.navigateTo({  
729 - url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)  
730 - });  
731 - },  
732 - enterAddressPage: function() {  
733 - getApp().globalData.is_cart_old=1;  
734 - this.data.enterAddressPage = !0, wx.navigateTo({  
735 - url: "/pages/user/address_list/address_list"  
736 - });  
737 - }, 709 + },
  710 + fail: function () {
  711 + th.data.is_summit_ing = 0; //是否提交中
  712 + wx.hideLoading();
  713 + console.log("index.js wx.request CheckCallUser fail");
  714 + },
  715 + complete: function () { }
  716 + })
  717 + },
  718 + useCoupon: function () {
  719 + if (this.data.order.couponNum <= 0) {
  720 + //return t.showWarning("无可用优惠券");
  721 + getApp().my_warnning("无可用优惠券", 0, this);
  722 + return;
  723 + }
  724 + var a = {
  725 + lid: this.data.coupon ? this.data.coupon.id : "0"
  726 + };
  727 + wx.navigateTo({
  728 + url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
  729 + });
  730 + },
  731 + enterAddressPage: function () {
  732 + getApp().globalData.is_cart_old = 1;
  733 + this.data.enterAddressPage = !0, wx.navigateTo({
  734 + url: "/pages/user/address_list/address_list"
  735 + });
  736 + },
738 737
739 - //--------立即购买时,选择自提和物流-----------  
740 - setexptype_w:function(t){  
741 - var th=this;  
742 - var ty = t.currentTarget.dataset.t,txt = t.currentTarget.dataset.txt;  
743 - th.setData({ [txt]: ty });  
744 - var iszt=1;  
745 - if(ty==0){  
746 - th.setData({ is_all_zt: 0 });  
747 - }else{  
748 - for(var i=0;i<th.data.cartlist.length;i++){  
749 - var item = th.data.cartlist[i];  
750 - if (item.exp_type==0){ iszt=0;break;}  
751 - }  
752 - th.setData({ is_all_zt: iszt }); 738 + //--------立即购买时,选择自提和物流-----------
  739 + setexptype_w: function (t) {
  740 + var th = this;
  741 + var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt;
  742 + th.setData({ [txt]: ty });
  743 + var iszt = 1;
  744 + if (ty == 0) {
  745 + th.setData({ is_all_zt: 0 });
  746 + } else {
  747 + for (var i = 0; i < th.data.cartlist.length; i++) {
  748 + var item = th.data.cartlist[i];
  749 + if (item.exp_type == 0) { iszt = 0; break; }
753 } 750 }
754 - //----计算此时购物车的价格----  
755 - th.calculatePrice();  
756 - }, 751 + th.setData({ is_all_zt: iszt });
  752 + }
  753 + //----计算此时购物车的价格----
  754 + th.calculatePrice();
  755 + },
757 756
758 - //--------立即购买时,选择自提和物流----------  
759 - setexptype:function(t){  
760 - var th=this;  
761 - var ty = t.currentTarget.dataset.t;  
762 - th.setData({ bn_exp_type:ty});  
763 - //当物流为空的时候。  
764 - if (ty == 0 && th.data.wu_arr==null){  
765 - return th.get_wuliu(th.calculatePrice2());  
766 - }  
767 - th.calculatePrice2()  
768 - console.log('setexptype');  
769 - }, 757 + //--------立即购买时,选择自提和物流----------
  758 + setexptype: function (t) {
  759 + var th = this;
  760 + var ty = t.currentTarget.dataset.t;
  761 + th.setData({ bn_exp_type: ty });
  762 + //当物流为空的时候。
  763 + if (ty == 0 && th.data.wu_arr == null) {
  764 + return th.get_wuliu(th.calculatePrice2());
  765 + }
  766 + th.calculatePrice2()
  767 + console.log('setexptype');
  768 + },
770 769
771 - //--------立即购买时,使用余额--------  
772 - set_bn_useyuer:function(){  
773 - var th=this;  
774 - th.setData({ bn_use_money: !th.data.bn_use_money});  
775 - th.calculatePrice2();  
776 - },  
777 - set_js_useyuer:function(){  
778 - var th = this;  
779 - th.setData({ js_use_money: !th.data.js_use_money });  
780 - th.calculatePrice();  
781 - }, 770 + //--------立即购买时,使用余额--------
  771 + set_bn_useyuer: function () {
  772 + var th = this;
  773 + th.setData({ bn_use_money: !th.data.bn_use_money });
  774 + th.calculatePrice2();
  775 + },
  776 + set_js_useyuer: function () {
  777 + var th = this;
  778 + th.setData({ js_use_money: !th.data.js_use_money });
  779 + th.calculatePrice();
  780 + },
782 781
783 //-------------------计算物流--------------- 782 //-------------------计算物流---------------
784 - calculatewuliu:function(code, o_shipping_price, goods_weight,  
785 - goods_piece,user_addr, freight_free, o_price, rs){  
786 - var price =0,th=this;  
787 - price +=parseFloat(o_shipping_price);  
788 - //如果是包邮  
789 - if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;}  
790 - if (user_addr==null) { return 0; }  
791 - //计算物流的config item;  
792 - var item=null;  
793 - //先根据 镇 县 区找计算的config  
794 - item = th.get_wuliu_config(user_addr.district,code,rs);  
795 - if (item==null) item = th.get_wuliu_config(user_addr.city, code, rs);  
796 - if (item==null) item = th.get_wuliu_config(user_addr.province, code, rs);  
797 - if (item == null) item = th.get_wuliu_default(code,rs); 783 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
  784 + goods_piece, user_addr, freight_free, o_price, rs, pickid) {
  785 + var price = 0, th = this;
  786 + price += parseFloat(o_shipping_price);
  787 + //如果是包邮
  788 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; }
  789 + if (user_addr == null) { return 0; }
  790 + //计算物流的config item;
  791 + var item = null;
  792 + //先根据 镇 县 区找计算的config
  793 + item = th.get_wuliu_config(user_addr.district, code, rs);
  794 + if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs);
  795 + if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs);
  796 + if (item == null) item = th.get_wuliu_default(code, rs);
  797 + if (item == null) return o_shipping_price;
  798 + var fw_price = 0, fp_price = 0;
  799 + item = item.config;
798 if (item == null) return o_shipping_price; 800 if (item == null) return o_shipping_price;
799 - var fw_price = 0, fp_price=0;  
800 - item=item.config;  
801 - if (item == null) return o_shipping_price;  
802 //------按重量---------- 801 //------按重量----------
803 if (goods_weight >= 0 && item['money']) { 802 if (goods_weight >= 0 && item['money']) {
804 - fw_price =parseFloat(item['money']);  
805 - if (goods_weight > item['first_weight']){  
806 - var fw = goods_weight - item['first_weight'];  
807 - var n = Math.ceil(fw/item['second_weight'])  
808 - fw_price = fw_price + n * parseFloat(item['add_money']);  
809 - } 803 + fw_price = parseFloat(item['money']);
  804 + if (goods_weight > item['first_weight']) {
  805 + var fw = goods_weight - item['first_weight'];
  806 + var n = Math.ceil(fw / item['second_weight'])
  807 + fw_price = fw_price + n * parseFloat(item['add_money']);
  808 + }
810 } 809 }
811 - //------超出重量----------  
812 - if(out_of_weight < 0 && o_price >= freight_free){ 810 + //------超出重量----------
  811 + if (out_of_weight < 0 && o_price >= freight_free) {
813 fw_price = parseFloat(item['money']); 812 fw_price = parseFloat(item['money']);
814 var out_of_weight = Math.abs(out_of_weight); 813 var out_of_weight = Math.abs(out_of_weight);
815 if (out_of_weight > item['first_weight']) { 814 if (out_of_weight > item['first_weight']) {
816 - var fw = out_of_weight - item['first_weight'];  
817 - var n = Math.ceil(fw / item['second_weight'])  
818 - fw_price = fw_price + n * parseFloat(item['add_money']); 815 + var fw = out_of_weight - item['first_weight'];
  816 + var n = Math.ceil(fw / item['second_weight'])
  817 + fw_price = fw_price + n * parseFloat(item['add_money']);
819 } 818 }
820 } 819 }
821 //------按件数---------- 820 //------按件数----------
822 - if (goods_piece > 0 ) { 821 + if (goods_piece > 0) {
823 fp_price = parseFloat(item['piecemoney']); 822 fp_price = parseFloat(item['piecemoney']);
824 if (goods_piece > item['first_piece']) { 823 if (goods_piece > item['first_piece']) {
825 - var fp = goods_piece - item['first_piece'];  
826 - var m = Math.ceil(fp / item['second_piece']) 824 + var fp = goods_piece - item['first_piece'];
  825 + var m = Math.ceil(fp / item['second_piece'])
827 fp_price = fp_price + m * parseFloat(item['add_piecemoney']); 826 fp_price = fp_price + m * parseFloat(item['add_piecemoney']);
828 } 827 }
829 } 828 }
830 - var rspice =parseFloat(price + fw_price + fp_price); 829 + var rspice = parseFloat(price + fw_price + fp_price);
831 return rspice; 830 return rspice;
832 }, 831 },
833 832
834 //------------循环获取config----------- 833 //------------循环获取config-----------
835 - get_wuliu_config:function(region_id,code,rs){  
836 - var item=null,rslist = rs.pageData;  
837 - for (var i = 0; i < rslist.length;i++){  
838 - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i];}  
839 - }  
840 - return item; 834 + get_wuliu_config: function (region_id, code, rs) {
  835 + var item = null, rslist = rs.pageData;
  836 + for (var i = 0; i < rslist.length; i++) {
  837 + if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; }
  838 + }
  839 + return item;
841 }, 840 },
842 //-------循环获取config,code default------- 841 //-------循环获取config,code default-------
843 get_wuliu_default: function (code, rs) { 842 get_wuliu_default: function (code, rs) {
844 - var item = null, rslist=rs.pageData; 843 + var item = null, rslist = rs.pageData;
845 for (var i = 0; i < rslist.length; i++) { 844 for (var i = 0; i < rslist.length; i++) {
846 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; } 845 if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; }
847 } 846 }
848 return item; 847 return item;
849 }, 848 },
850 849
851 - //----------立即购买,选择物流-------------  
852 - bindPickerChange:function(e){  
853 - var ind = e.detail.value  
854 - this.setData({ index: ind });  
855 - this.calculatePrice2();  
856 - },  
857 -  
858 - //----------购物车结算,选择物流-------------  
859 - bindPickerChange_w: function (e) {  
860 - var ind=e.detail.value, txt = e.currentTarget.dataset.txt;  
861 - this.setData({ [txt]: ind });  
862 - this.calculatePrice();  
863 - },  
864 - 850 + //----------立即购买,选择物流-------------
  851 + bindPickerChange: function (e) {
  852 + var ind = e.detail.value
  853 + this.setData({ index: ind });
  854 + this.calculatePrice2();
  855 + },
  856 +
  857 + //----------购物车结算,选择物流-------------
  858 + bindPickerChange_w: function (e) {
  859 + var ind = e.detail.value, txt = e.currentTarget.dataset.txt;
  860 + this.setData({ [txt]: ind });
  861 + this.calculatePrice();
  862 + },
  863 +
865 cart_set_err: function (e) { 864 cart_set_err: function (e) {
866 var txt = e.currentTarget.dataset.err; 865 var txt = e.currentTarget.dataset.err;
867 var ob = {}; 866 var ob = {};
@@ -869,70 +868,70 @@ Page({ @@ -869,70 +868,70 @@ Page({
869 this.setData(ob); 868 this.setData(ob);
870 }, 869 },
871 870
872 - //// 开启物流的弹窗  
873 - show_wu_arr:function(e){  
874 - this.setData({ open_express: 1});  
875 - }, 871 + //// 开启物流的弹窗
  872 + show_wu_arr: function (e) {
  873 + this.setData({ open_express: 1 });
  874 + },
876 875
877 - //更新下默认,在onshow里面  
878 - update_code(){  
879 - var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code;  
880 -  
881 - var uii=setInterval(function () {  
882 - if(th.data.wu_arr){  
883 - clearInterval(uii);  
884 - for (var k = 0; k < th.data.wu_arr.length; k++) {  
885 - var item = th.data.wu_arr[k];  
886 - if (def_exp_code == item.code) {  
887 - m_wind = k;  
888 - }  
889 - }  
890 - //--如果是立即购买--  
891 - th.setData({ index: m_wind, is_express: m_wind});  
892 - }  
893 - },500)  
894 - }, 876 + //更新下默认,在onshow里面
  877 + update_code() {
  878 + var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code;
  879 +
  880 + var uii = setInterval(function () {
  881 + if (th.data.wu_arr) {
  882 + clearInterval(uii);
  883 + for (var k = 0; k < th.data.wu_arr.length; k++) {
  884 + var item = th.data.wu_arr[k];
  885 + if (def_exp_code == item.code) {
  886 + m_wind = k;
  887 + }
  888 + }
  889 + //--如果是立即购买--
  890 + th.setData({ index: m_wind, is_express: m_wind });
  891 + }
  892 + }, 500)
  893 + },
895 894
896 - // 关闭物流的弹窗  
897 - close_express:function(){  
898 - this.setData({ open_express:0 });  
899 - },  
900 - // 选择物流  
901 - click_express_name:function(e){  
902 - var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;  
903 - var index=e.currentTarget.dataset.idxe;  
904 - var ob={ is_express: index, is_shipping_code: shippingcode,index:index};  
905 - this.setData(ob);  
906 - }, 895 + // 关闭物流的弹窗
  896 + close_express: function () {
  897 + this.setData({ open_express: 0 });
  898 + },
  899 + // 选择物流
  900 + click_express_name: function (e) {
  901 + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode;
  902 + var index = e.currentTarget.dataset.idxe;
  903 + var ob = { is_express: index, is_shipping_code: shippingcode, index: index };
  904 + this.setData(ob);
  905 + },
907 906
908 - //点击确定物流  
909 - determine_expres:function(e){  
910 - this.setData({ open_express: 0});  
911 - this.calculatePrice2();  
912 - },  
913 - //设置默认物流  
914 - select_default_logistics: function () {  
915 - var th=this;  
916 - var is_shipping_code=this.data.is_shipping_code  
917 - getApp().request.put("/api/weshop/users/update",{  
918 - data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code},  
919 - success:function(rse){  
920 - if (rse.data.code==0){  
921 - getApp().globalData.userInfo.def_exp_code=is_shipping_code;  
922 - th.setData({ open_express: 0 });  
923 - //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----  
924 - //if(th.data.is_b_now==1) th.calculatePrice2();  
925 - //else th.calculatePrice();  
926 - th.calculatePrice2();  
927 - }  
928 - }  
929 - })  
930 - }, 907 + //点击确定物流
  908 + determine_expres: function (e) {
  909 + this.setData({ open_express: 0 });
  910 + this.calculatePrice2();
  911 + },
  912 + //设置默认物流
  913 + select_default_logistics: function () {
  914 + var th = this;
  915 + var is_shipping_code = this.data.is_shipping_code
  916 + getApp().request.put("/api/weshop/users/update", {
  917 + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code },
  918 + success: function (rse) {
  919 + if (rse.data.code == 0) {
  920 + getApp().globalData.userInfo.def_exp_code = is_shipping_code;
  921 + th.setData({ open_express: 0 });
  922 + //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19----
  923 + //if(th.data.is_b_now==1) th.calculatePrice2();
  924 + //else th.calculatePrice();
  925 + th.calculatePrice2();
  926 + }
  927 + }
  928 + })
  929 + },
931 930
932 931
933 - //跳转到购买卡  
934 - buycard:function(){  
935 - getApp().goto("/pages/user/plus/plus");  
936 - getApp().globalData.plus_buy_back=1;  
937 - } 932 + //跳转到购买卡
  933 + buycard: function () {
  934 + getApp().goto("/pages/user/plus/plus");
  935 + getApp().globalData.plus_buy_back = 1;
  936 + }
938 }); 937 });
pages/cart/cart_wk/cart_wk.js
@@ -449,7 +449,7 @@ Page({ @@ -449,7 +449,7 @@ Page({
449 //--全部金额-- 449 //--全部金额--
450 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; 450 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money;
451 var shipping_price = 451 var shipping_price =
452 - th.calculatewuliu(code, o_shipping_price, goods_weight, 452 + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
453 goods_piece, th.data.user_addr, freight_free, allpice, rs); 453 goods_piece, th.data.user_addr, freight_free, allpice, rs);
454 var exp_price = parseFloat(shipping_price).toFixed(2); 454 var exp_price = parseFloat(shipping_price).toFixed(2);
455 allpice = parseFloat(exp_price) + parseFloat(allpice); 455 allpice = parseFloat(exp_price) + parseFloat(allpice);
@@ -467,7 +467,7 @@ Page({ @@ -467,7 +467,7 @@ Page({
467 }, 467 },
468 468
469 //----------------计算物流--------------- 469 //----------------计算物流---------------
470 - calculatewuliu: function (code, o_shipping_price, goods_weight, 470 + calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,
471 goods_piece, user_addr, freight_free, o_price, rs) { 471 goods_piece, user_addr, freight_free, o_price, rs) {
472 var price = 0, th = this; 472 var price = 0, th = this;
473 price += parseFloat(o_shipping_price); 473 price += parseFloat(o_shipping_price);
pages/goods/goodsInfo/goodsInfo.js
@@ -2246,7 +2246,7 @@ Page({ @@ -2246,7 +2246,7 @@ Page({
2246 ) { 2246 ) {
2247 url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; 2247 url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1";
2248 } 2248 }
2249 - 2249 + console.log(url,500);
2250 var ob = { 2250 var ob = {
2251 title: price + "元 " + title, 2251 title: price + "元 " + title,
2252 path: url, 2252 path: url,
@@ -2271,7 +2271,6 @@ Page({ @@ -2271,7 +2271,6 @@ Page({
2271 2271
2272 ob.title = text + " " + name; 2272 ob.title = text + " " + name;
2273 } 2273 }
2274 -  
2275 //-- 页面不能刷新 -- 2274 //-- 页面不能刷新 --
2276 this.data.show_prew_img=1; 2275 this.data.show_prew_img=1;
2277 return ob; 2276 return ob;
@@ -4168,7 +4167,7 @@ Page({ @@ -4168,7 +4167,7 @@ Page({
4168 var item = this.data.teamgroup[ind]; 4167 var item = this.data.teamgroup[ind];
4169 var id = item.id; 4168 var id = item.id;
4170 var th = this; 4169 var th = this;
4171 - 4170 + var goods_id=this.data.data.goods_id;
4172 getApp().request.get("/api/weshop/order/page", { 4171 getApp().request.get("/api/weshop/order/page", {
4173 data: { 4172 data: {
4174 pt_prom_id: item.team_id, 4173 pt_prom_id: item.team_id,
@@ -4211,14 +4210,14 @@ Page({ @@ -4211,14 +4210,14 @@ Page({
4211 4210
4212 } else { 4211 } else {
4213 wx.navigateTo({ 4212 wx.navigateTo({
4214 - url: "/pages/team/team_show/team_show?tg_id=" + id, 4213 + url: `/pages/team/team_show/team_show?tg_id=${id}&goods_id=${goods_id}`,
4215 }); 4214 });
4216 } 4215 }
4217 } 4216 }
4218 //--跳转到参团-- 4217 //--跳转到参团--
4219 else { 4218 else {
4220 wx.navigateTo({ 4219 wx.navigateTo({
4221 - url: "/pages/team/team_show/team_show?tg_id=" + id, 4220 + url: `/pages/team/team_show/team_show?tg_id=${id}&goods_id=${goods_id}`,
4222 }); 4221 });
4223 } 4222 }
4224 } 4223 }
pages/team/team_success/team_success.js
@@ -820,7 +820,7 @@ Page({ @@ -820,7 +820,7 @@ Page({
820 var th=this; 820 var th=this;
821 var scene=this.data.teamgroup.id; 821 var scene=this.data.teamgroup.id;
822 var goods_id=this.data.teamlist.goods_id; 822 var goods_id=this.data.teamlist.goods_id;
823 - var url="/pages/team/team_show/team_show?tg_id="+scene+"&goods_id"+goods_id; 823 + var url="/pages/team/team_show/team_show?tg_id="+scene+"&goods_id="+goods_id;
824 //--分享图片-- 824 //--分享图片--
825 var img=th.data.iurl+th.data.teamlist.share_imgurl; 825 var img=th.data.iurl+th.data.teamlist.share_imgurl;
826 //--把会员分享出去-- 826 //--把会员分享出去--