Commit ee0bbe7c6c8dbeb6611984667930fc93bb5b6d0f
1 parent
ce2775e4
预售订单流程的优化
Showing
16 changed files
with
1643 additions
and
4095 deletions
packageC/pages/presell/cart/cart.js
... | ... | @@ -3,7 +3,6 @@ var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common. |
3 | 3 | var oo = t.globalData.setting, os = oo; |
4 | 4 | var regeneratorRuntime = require('../../../../utils/runtime.js'); |
5 | 5 | var util_pay = require("../../../../utils/pay.js"); |
6 | -var zh_calc = require("zh_calculate.js"); | |
7 | 6 | |
8 | 7 | Page({ |
9 | 8 | data: { |
... | ... | @@ -24,15 +23,6 @@ Page({ |
24 | 23 | //页面获取的参数 |
25 | 24 | param: null, |
26 | 25 | //提交订单的格式 |
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 | 26 | /*-----------当是购物车结算的时候-------------*/ |
37 | 27 | cartlist: null, |
38 | 28 | old_cartlist: null, |
... | ... | @@ -69,7 +59,7 @@ Page({ |
69 | 59 | ckeck_quan_price: 0, |
70 | 60 | check_quan_price_list: '', |
71 | 61 | check_quan_ware_list: '', |
72 | - | |
62 | + isget_by_quan: {}, //是否调用了接口获取包邮券 | |
73 | 63 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
74 | 64 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
75 | 65 | using_quan: {}, |
... | ... | @@ -120,8 +110,16 @@ Page({ |
120 | 110 | |
121 | 111 | tabs: ['门店自提', '快递邮寄'], |
122 | 112 | currentTabIndex: 1, |
113 | + | |
114 | + order_sn:'', | |
115 | + order_id:'', | |
116 | + | |
123 | 117 | }, |
124 | 118 | onLoad: function (t) { |
119 | + | |
120 | + if(t.order_id) this.data.order_id=t.order_id; | |
121 | + if(t.order_sn) this.data.order_sn=t.order_sn; | |
122 | + | |
125 | 123 | wx.setNavigationBarTitle({title: "填写订单",}) |
126 | 124 | var th = this; |
127 | 125 | this.setData({is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); |
... | ... | @@ -134,7 +132,9 @@ Page({ |
134 | 132 | success: function (s) { |
135 | 133 | } |
136 | 134 | }); |
137 | - | |
135 | + if(!getApp().globalData.userInfo){ | |
136 | + getApp().goto("/pages/togoin/togoin"); | |
137 | + } | |
138 | 138 | |
139 | 139 | }, |
140 | 140 | onUnload: function () { |
... | ... | @@ -153,18 +153,12 @@ Page({ |
153 | 153 | var th = this; |
154 | 154 | th.setData({show_submit: 0}); //让提交先掩藏 |
155 | 155 | th.data.g_cart_q_time = null; |
156 | - | |
157 | 156 | if (th.data.isclose == 0) { |
158 | 157 | wx.navigateTo({ |
159 | - url: "/pages/index/index/index" | |
158 | + url:"/pages/index/index/index" | |
160 | 159 | }) |
161 | - | |
162 | - } else { | |
160 | + }else{ | |
163 | 161 | this.getuser_addr(function (ie) { |
164 | - | |
165 | - console.log("getuser_addr") | |
166 | - console.log(ie) | |
167 | - | |
168 | 162 | //地址切换要把包邮券清空 |
169 | 163 | if (!th.data.user_addr || !ie || th.data.user_addr.address_id != ie.address_id) { |
170 | 164 | var using_quan = th.data.using_quan; |
... | ... | @@ -183,40 +177,16 @@ Page({ |
183 | 177 | th.data.prom_goods_map = {}; |
184 | 178 | th.data.is_summit_ing = 0; |
185 | 179 | //更换地址回来要重新调用计算价钱的接口 |
186 | - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { | |
187 | - th.setData({user_addr: ie}); | |
188 | - if (th.data.is_b_now == 1) { | |
189 | - if (th.data.bn_goods) { | |
190 | - th.setData({add_back: 1}); | |
191 | - //th.calculatePrice2(); | |
192 | - } | |
193 | - } else { | |
194 | - if (th.data.cartlist) { | |
195 | - th.setData({add_back: 1}); | |
196 | - //th.calculatePrice(); | |
197 | - } | |
198 | - } | |
180 | + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id){ | |
181 | + th.setData({user_addr: ie}); | |
182 | + th.setData({add_back: 1}); | |
183 | + th.calculatePrice2(); | |
199 | 184 | } else { |
200 | 185 | th.setData({user_addr: ie}); |
201 | 186 | } |
202 | 187 | var going = 0; |
203 | - | |
204 | - | |
205 | - //使用计时器,避免空现象 | |
206 | - /*--- | |
207 | - var jishi= setInterval(function () { | |
208 | - if (th.data.is_b_now == 1 && going==0) { | |
209 | - if(th.data.bn_goods) { | |
210 | - th.calculatePrice2();going=1;clearInterval(jishi); | |
211 | - } | |
212 | - }else if(going==0) { | |
213 | - if (th.data.cartlist){ | |
214 | - th.calculatePrice();going = 1; clearInterval(jishi); | |
215 | - } | |
216 | - } | |
217 | - },500)--*/ | |
218 | - | |
219 | 188 | }); |
189 | + | |
220 | 190 | var is_card_back = getApp().globalData.is_card_back; |
221 | 191 | //--更新默认地址--,看一下是不是跳到地址页面,同时也不是购买等级卡返回的,这里很重要,否则会重新更新收货物流公司 |
222 | 192 | if (!getApp().globalData.is_cart_old && !is_card_back && !getApp().globalData.plus_buy_back) { |
... | ... | @@ -238,7 +208,8 @@ Page({ |
238 | 208 | is_close_quan: json_d.is_close_quan, |
239 | 209 | sales_rules: ee.sales_rules, |
240 | 210 | rank_switch: json_d.rank_switch, |
241 | - is_default_logistics: is_default_logistics | |
211 | + is_default_logistics: is_default_logistics, | |
212 | + sys_switch:json_d, | |
242 | 213 | }); |
243 | 214 | |
244 | 215 | var rank_switch = json_d.rank_switch; |
... | ... | @@ -317,11 +288,7 @@ Page({ |
317 | 288 | a.get("/api/weshop/useraddress/page", { |
318 | 289 | data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, |
319 | 290 | success: function (su) { |
320 | - /*--- | |
321 | - var user_addr=[ | |
322 | - { 'address_id': 882, 'user_id': 2661, 'consignee': '测试测试测', 'province': 3102, 'city': 3431, 'district': 3466, | |
323 | - 'address': 'ed', 'more_address': '山西-长治市-襄垣县-虎(音si)亭镇', 'mobile': 13012345678,'is_default':1}, | |
324 | - ];---*/ | |
291 | + | |
325 | 292 | var item = null; |
326 | 293 | if (su.data.code == 0 && su.data.data && su.data.data.pageData) { |
327 | 294 | var user_addr = su.data.data.pageData; |
... | ... | @@ -349,634 +316,260 @@ Page({ |
349 | 316 | |
350 | 317 | //----------------展示页面,是再获取用户信息之后-------------- |
351 | 318 | show_page: function () { |
352 | - var th = this, ta = this.data.param; | |
353 | - //th.setData({ userinfo: getApp().globalData.userInfo,}); //这个余额被缓存了 | |
354 | - | |
355 | - //会员的信息,要获取最新 | |
356 | - var user = getApp().globalData.userInfo; | |
357 | - getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { | |
358 | - data: {r: Math.random()}, | |
359 | - success: function (e) { | |
360 | - getApp().globalData.userInfo = e.data.data; | |
361 | - th.setData({userinfo: e.data.data}); | |
362 | - | |
363 | - //选获取地址 | |
364 | - th.getuser_addr(function (addr) { | |
365 | - th.setData({user_addr: addr}); | |
366 | - //--------------------------立即购买------------------ | |
367 | - if (ta.is_bnow == 1) { | |
368 | - //读取门店 | |
369 | - to.get_allsto(function (e) { | |
370 | - th.setData({allsto: e}); | |
371 | - //获取立即购买的商品信息 | |
372 | - th.get_buy_goods(ta.goods_id); | |
373 | - }); | |
374 | - } else { | |
375 | - //------------------------购物车结算---------------------- | |
376 | - //读取门店 | |
377 | - to.get_allsto(function (e) { | |
378 | - th.setData({allsto: e}); | |
379 | - //-------获取购物车已经选择的商品-------- | |
380 | - th.get_cart(); | |
381 | - }) | |
382 | - } | |
383 | - }); | |
319 | + var th = this, | |
320 | + to = getApp(); | |
321 | + th.setData({ | |
322 | + userinfo: to.globalData.userInfo, | |
323 | + }); | |
324 | + //选获取地址 | |
325 | + th.getuser_addr(function (addr) { | |
384 | 326 | |
385 | - //获取提现金额 | |
386 | - getApp().request.get("/api/weshop/withdrawals/summoney", { | |
387 | - data: {user_id: to.globalData.user_id, store_id: oo.stoid, status: 0}, | |
388 | - success: function (su) { | |
389 | - if (su.data.code == 0) { | |
390 | - var yuer = parseFloat(th.data.userinfo.user_money - | |
391 | - (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); | |
392 | - th.setData({txmon: su.data.data.summoney, yuer: yuer}); | |
393 | - } | |
394 | - } | |
327 | + if (addr == null || addr == undefined || addr.length == 0) { | |
328 | + th.setData({ | |
329 | + enterAddressPage: 1, | |
395 | 330 | }); |
396 | 331 | |
397 | - }, | |
332 | + } else { | |
333 | + th.setData({ | |
334 | + user_addr: addr, enterAddressPage: 0, | |
335 | + }); | |
336 | + } | |
337 | + //获取立即购买的商品信息 | |
338 | + th.get_buy_goods(th.data.order_id,th.data.order_sn); | |
398 | 339 | }); |
399 | - | |
400 | - }, | |
401 | - | |
402 | - | |
403 | - //-----真的获取购物车,入口-------- | |
404 | - get_cart: function () { | |
405 | - var th = this, app = getApp(); | |
406 | - a.get("/api/weshop/cart/list", { | |
340 | + //获取提现金额 | |
341 | + getApp().request.get("/api/weshop/withdrawals/summoney", { | |
407 | 342 | data: { |
408 | - user_id: to.globalData.user_id, selected: 1, state: 0, | |
409 | - store_id: oo.stoid, pageSize: 600 | |
343 | + user_id: to.globalData.user_id, | |
344 | + store_id: oo.stoid, | |
345 | + status: 0 | |
410 | 346 | }, |
411 | - success: async function (su) { | |
412 | - //按门店分类的数组 | |
413 | - var arr = new Array(); | |
414 | - var carr = su.data.data.pageData; | |
415 | - th.data.cartlist_y = carr; //存储原始购物车列表 | |
416 | - | |
417 | - //---是不是购买等级卡成功的返回---等级卡显示的判断--- | |
418 | - var is_card_back = getApp().globalData.is_card_back; | |
419 | - | |
420 | - for (var i = 0; i < carr.length; i++) { | |
421 | - var item1 = carr[i]; | |
422 | - //把已经购买了多少见的内容填入 | |
423 | - | |
424 | - var goodsbuynum=0,promgoodsbuynum=0; | |
425 | - //--要获得商品,该用户买了多少件,同步应用-- | |
426 | - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | |
427 | - data: { | |
428 | - store_id: os.stoid, | |
429 | - user_id: getApp().globalData.user_id, | |
430 | - goods_id: item1.goods_id, | |
431 | - prom_type: item1.prom_type, | |
432 | - prom_id: item1.prom_id | |
433 | - }, | |
434 | - }).then(res => { | |
435 | - var buy_num_data = res.data.data; | |
436 | - if (buy_num_data.promgoodsbuynum) { | |
437 | - promgoodsbuynum = buy_num_data.promgoodsbuynum; | |
438 | - } | |
439 | - goodsbuynum = buy_num_data.goodsbuynum; | |
440 | - }) | |
441 | - //如果有购买活动 | |
442 | - item1.promgoodsbuynum=promgoodsbuynum; | |
443 | - | |
444 | - //要把优惠活动加入,prom_goods_map中,赠品不要运算 | |
445 | - if (item1.prom_type == 3 && item1.is_gift != 1) { | |
446 | - await th.add_prom_goods_map(item1); | |
447 | - } | |
448 | - | |
449 | - //要把组合购的东西拿出来算一下 | |
450 | - if (item1.prom_type == 7) { | |
451 | - var isok = 1; | |
452 | - //如果有组合购 | |
453 | - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item1.prom_id+'/'+getApp().globalData.userInfo.user_id; | |
454 | - await getApp().request.promiseGet(url, {}).then(res => { | |
455 | - if (res.data.code == 0 && res.data.data) { | |
456 | - //如果活动已经结束 | |
457 | - if (res.data.data.is_end == 1) { | |
458 | - isok = 0; | |
459 | - } | |
460 | - if (ut.gettimestamp() > res.data.data.end_time) { | |
461 | - isok = 0; | |
462 | - } | |
463 | - } else { | |
464 | - //未找到商品的活动 | |
465 | - isok = 0; | |
466 | - } | |
467 | - item1.act = res.data.data; | |
468 | - }) | |
469 | - | |
470 | - if (!isok) { | |
471 | - getApp().my_warnning("组合购的活动已经过期", 0, th); | |
472 | - return false; | |
473 | - } | |
474 | - | |
475 | - } | |
347 | + success: function (su) { | |
348 | + console.log("withdrawals"); | |
349 | + if (su.data.code == 0) { | |
350 | + var yuer = parseFloat(th.data.userinfo.user_money - | |
351 | + th.data.userinfo.frozen_money - su.data.data.summoney).toFixed(2); | |
352 | + th.setData({ | |
353 | + txmon: su.data.data.summoney, | |
354 | + yuer: yuer | |
355 | + }); | |
476 | 356 | } |
357 | + } | |
358 | + }); | |
359 | + }, | |
477 | 360 | |
478 | - //在分组的时候,就不要再调用接口,await | |
479 | - for (var i = 0; i < carr.length; i++) { | |
480 | - var item = carr[i]; | |
481 | - | |
482 | - //-- 如果是等级会员注册返回 -- | |
483 | - if (is_card_back) { | |
484 | - th.data.card_name = th.data.userinfo.card_field; | |
485 | - //如果是秒杀的返回,就要把活动弄回0 | |
486 | - if (item['prom_type'] == 1) { | |
487 | - item['prom_type'] = 0; | |
488 | - item['prom_id'] = 0; | |
489 | - } | |
490 | - // 拼团,搭配购不计算,赠品也不计算 | |
491 | - if (item['prom_type'] != 5 && item['prom_type'] != 6 && !item.is_gift && !item['is_collocation'] && item.goods_price > item[th.data.card_name]) { | |
492 | - item.goods_price = item[th.data.card_name]; | |
493 | - carr[i].goods_price = item[th.data.card_name]; | |
494 | - | |
495 | - } | |
496 | - } else { | |
497 | - // 拼团,搭配购不计算,赠品也不计算,同时会员还未购买等级会员 | |
498 | - if (item[th.data.card_name] > 0 && item['prom_type'] != 5 && item['prom_type'] != 6 && !th.data.userinfo.card_field | |
499 | - && !item.is_gift && !item['is_collocation'] && item.goods_price > item[th.data.card_name]) { | |
500 | - item.cut_price1 = item.goods_price - item[th.data.card_name]; | |
501 | - carr[i].cut_price1 = (item.goods_price - item[th.data.card_name]) * item.goods_num; | |
502 | - } | |
503 | - | |
504 | - } | |
361 | + //-----获取商品------ | |
362 | + async get_buy_goods(ord,o_sn) { | |
363 | + var order = null, | |
364 | + order_goods = null, | |
365 | + goods = null, | |
366 | + pickup = null, | |
367 | + distr_type = 0, | |
368 | + exp_type = 0, | |
369 | + presell=null, //订单从表 | |
370 | + pre_arr=null, //订单内容 | |
371 | + th = this; | |
372 | + | |
373 | + | |
374 | + if(o_sn){ | |
375 | + //获取order信息根据订单编号order_sn | |
376 | + await getApp().request.promiseGet("/api/weshop/order/page", { | |
377 | + data: { store_id: os.stoid, order_sn: o_sn,} | |
378 | + }).then(res => { | |
379 | + order = res.data.data.pageData[0]; | |
380 | + }) | |
505 | 381 | |
506 | - item.original_img = oo.imghost + item.original_img; | |
507 | - | |
508 | - var car_item=item; | |
509 | - /*----接口要弄出来的,先顶着-----*/ | |
510 | - var pcid = car_item.pick_id; | |
511 | - var find = 0; | |
512 | - //----如果有就加进去,没有就新增一个---- | |
513 | - //-----------循环查找门店------------- | |
514 | - if (arr.length > 0) { | |
515 | - for (var j = 0; j < arr.length; j++) { | |
516 | - if (arr[j].pickup_id == pcid) { | |
517 | - //if(item.is_gift!=1){ | |
518 | - //确定配送方式 | |
519 | - if (arr[j].distr_t == 0) { | |
520 | - arr[j].distr_t = car_item.distr_type; | |
521 | - } | |
522 | - var e_t = 0 | |
523 | - switch (arr[j].distr_t) { | |
524 | - case 0: | |
525 | - e_t = 1; | |
526 | - if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) e_t = 0; | |
527 | - break; | |
528 | - case 1: | |
529 | - e_t = 1; | |
530 | - break; | |
531 | - case 2: | |
532 | - e_t = 0; | |
533 | - break; | |
534 | - } | |
535 | - arr[j].exp_type = e_t; | |
536 | - if (e_t == 0) th.setData({is_all_zt: 0}); | |
537 | - //} | |
538 | 382 | |
539 | - //-- 把等级卡会优惠多少钱装进去 -- | |
540 | - if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; | |
383 | + ord=order.order_id; | |
384 | + }else{ | |
385 | + //---获取订单--- | |
386 | + await getApp().request.promiseGet("/api/weshop/order/get/" + oo.stoid + "/" + ord, {}).then(res => { | |
387 | + order = res.data.data; | |
388 | + }); | |
389 | + } | |
390 | + //---获取订单从表--- | |
391 | + await getApp().request.promiseGet("/api/weshop/ordergoods/page", { | |
392 | + data: { | |
393 | + store_id: oo.stoid, | |
394 | + order_id: ord | |
395 | + } | |
396 | + }).then(res => { | |
397 | + order_goods = res.data.data.pageData[0]; | |
398 | + }); | |
541 | 399 | |
542 | - arr[j].goods.push(car_item); | |
543 | - find = 1; | |
544 | - break; | |
545 | - } | |
546 | - } | |
547 | - } | |
548 | - //------如果没有找到----- | |
549 | - if (find == 0) { | |
550 | - var pikname = '', sto = null; | |
551 | - //----找到门店名称----- | |
552 | - for (var k = 0; k < th.data.allsto.length; k++) { | |
553 | - if (pcid == th.data.allsto[k].pickup_id) { | |
554 | - pikname = th.data.allsto[k].pickup_name; | |
555 | - sto = th.data.allsto[k]; | |
556 | - break; | |
557 | - } | |
558 | - } | |
559 | - var e_t = 0, dis_t = 0;//物流方式,配送方式 | |
560 | - if (item.distr_type == 0) { | |
561 | - dis_t = sto.distr_type; | |
562 | - } else { | |
563 | - dis_t = item.distr_type; | |
564 | - } | |
565 | - switch (dis_t) { | |
566 | - case 0: | |
567 | - e_t = 1; | |
568 | - //-- 系统后台有设置要默认的 -- | |
569 | - if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) e_t = 0; | |
570 | - break; | |
571 | - case 1: | |
572 | - e_t = 1; | |
573 | - break; | |
574 | - case 2: | |
575 | - e_t = 0; | |
576 | - break; | |
577 | - } | |
578 | - //如果是物流的话,全部自提的控制要弄成0 | |
579 | - if (e_t == 0) th.setData({is_all_zt: 0}); | |
580 | - | |
581 | - var narr = new Array(); | |
582 | - narr.push(car_item); | |
583 | - | |
584 | - //-----------拼装购物车结算的数组,如果有默认物流时要用默认物流编号,计算默认的物流,不管是不是自提都算一下----------------- | |
585 | - var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
586 | - if (def_exp_code) { | |
587 | - for (var k = 0; k < th.data.wu_arr.length; k++) { | |
588 | - var item = th.data.wu_arr[k]; | |
589 | - if (def_exp_code == item.code) { | |
590 | - m_wind = k; | |
591 | - } | |
592 | - } | |
593 | - } | |
594 | 400 | |
595 | - var ie = { | |
596 | - pickup_id: pcid, | |
597 | - pname: pikname, | |
598 | - goods: narr, | |
599 | - wind: m_wind, | |
600 | - distr_t: dis_t, | |
601 | - card_cut_price: 0, | |
602 | - exp_type: e_t, | |
603 | - goods_price: 0, | |
604 | - shipping_price: 0, | |
605 | - user_money: 0, | |
606 | - total_amount: 0, | |
607 | - order_amount: 0, | |
608 | - user_note: 0 | |
609 | - }; | |
610 | - | |
611 | - //-- 把等级卡会优惠多少钱装进去 -- | |
612 | - if (car_item.cut_price1) ie.card_cut_price += car_item.cut_price1; | |
613 | - arr.push(ie); | |
401 | + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: order_goods.goods_id }; | |
402 | + pre_data.user_id = order.user_id; | |
403 | + var isok=1; | |
404 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { | |
405 | + data: pre_data, | |
406 | + }).then(e => { | |
407 | + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
408 | + pre_arr = e.data.data.pageData[0]; | |
409 | + }else{ | |
410 | + isok=0; | |
411 | + } | |
412 | + }) | |
413 | + if(!isok){ | |
414 | + getApp().confirmBox("活动已经结束,或者会员身份不符合"); | |
415 | + return false; | |
416 | + } | |
417 | + await getApp().request.promiseGet("/api/weshop/order/orderPresell/get/"+oo.stoid+"/"+order.order_id, {}).then(res => { | |
418 | + presell = res.data.data; | |
419 | + }); | |
614 | 420 | |
615 | - } | |
616 | - } | |
617 | - //-- 如果是回退回来的情况 -- | |
618 | - if (th.data.cartlist && th.data.cartlist.length > 0) { | |
619 | - for (var kj in th.data.cartlist) { | |
620 | - for (var ih in arr) { | |
621 | - var ie = arr[ih]; | |
622 | - if (ie.pickup_id == th.data.cartlist[kj].pickup_id) { | |
623 | - ie.exp_type = parseInt(th.data.cartlist[kj].exp_type); | |
624 | - ie.wind = parseInt(th.data.cartlist[kj].wind); | |
625 | - break; | |
626 | - } | |
627 | - } | |
628 | - } | |
629 | - } | |
421 | + //等待定金 | |
422 | + if(order.order_status<2 && presell.deposit_pay_time<=0 ){ | |
423 | + th.setData({wait_dj:1}) | |
424 | + } | |
425 | + //等待尾款 | |
426 | + if(order.order_status<2 && presell.deposit_pay_time>0 && presell.tail_pay_state==0){ | |
427 | + th.setData({wait_wk:1}) | |
428 | + } | |
429 | + //等待发货 | |
430 | + if(order.pay_status==1 && order.shipping_status==0){ | |
431 | + th.setData({wait_fh:1}) | |
432 | + } | |
630 | 433 | |
631 | - //-- 循环计算一下线下取价 -- | |
632 | - for (var k = 0; k < arr.length; k++) { | |
633 | - var c_item = arr[k]; | |
634 | - var item = arr[k].goods; | |
635 | - var offline_price = 0; | |
636 | - var offline_num = 0; | |
637 | - for (var c = 0; c < item.length; c++) { | |
638 | - if(th.data.sales_rules!=2){ | |
639 | - item[c].offline_price=0; | |
640 | - } | |
641 | - //-- 如果这个商品是线下取价的时候 -- | |
642 | - if (item[c].offline_price > 0 && item[c].prom_type != 7 ) { | |
643 | - offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num; | |
644 | - offline_num += item[c].goods_num; | |
645 | - } | |
646 | - } | |
647 | - if (offline_price > 0) { | |
648 | - c_item.offline_price = offline_price; | |
649 | - c_item.offline_num = offline_num; | |
650 | - c_item.is_offline = 1; | |
651 | - } | |
652 | - } | |
434 | + //---获取商品--- | |
435 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + order_goods.goods_id, {}).then(res => { | |
436 | + goods = res.data.data; | |
437 | + order.market_price = goods.market_price; | |
438 | + order.show_img = oo.imghost + goods.original_img; | |
439 | + }); | |
440 | + //判断使用优惠券的接口需要 | |
441 | + th.data.check_quan_ware_list = goods.erpwareid; | |
442 | + //---获取门店--- | |
443 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + oo.stoid + "/" + order.pickup_id, {}).then(res => { | |
444 | + pickup = res.data.data; | |
445 | + }); | |
653 | 446 | |
654 | - //每一个门店内的组合购要进行拆分, | |
655 | - //还得把组合商品的多余商品的线下价格算一算 | |
656 | - for (let var1 in arr) { | |
657 | - var u_item = arr[var1]; | |
658 | - //把组合购进行分组 | |
659 | - var obj = zh_calc.find_split(u_item); | |
660 | - if (!obj) continue; | |
661 | - //存储不同活动的商品列表 | |
662 | - u_item.zh_prom_goods = {}; | |
663 | - for (let var1 in obj) { | |
664 | - var h_item = obj[var1]; | |
665 | - var gdlist = null; | |
666 | - var url1 = "/api/weshop/prom/zhbuyGoods/page"; | |
667 | - var req_data = { | |
668 | - page: 1, | |
669 | - pageSize: 2000, | |
670 | - store_id: os.stoid, | |
671 | - zh_id: h_item.prom_id, | |
672 | - } | |
673 | - await getApp().request.promiseGet(url1, { | |
674 | - data: req_data | |
675 | - }).then(res => { | |
676 | - if (ut.ajax_ok(res)) { | |
677 | - gdlist = res.data.data.pageData; | |
678 | - } | |
679 | - }) | |
680 | - //获取活动需要的商品列表 | |
681 | - u_item.zh_prom_goods[h_item.prom_id] = {gdlist: gdlist, act: h_item.act}; | |
682 | - } | |
683 | - zh_calc.fir_set_arr(u_item, th); | |
684 | - } | |
685 | - //深拷贝 | |
686 | - th.data.old_cartlist = JSON.parse(JSON.stringify(arr)); | |
687 | - th.setData({ | |
688 | - cartlist: arr, | |
689 | - }); | |
690 | - //--- 获取一下看有没有优惠券 ---- | |
691 | - setTimeout(function () { | |
692 | - var frozenQuan = null; | |
693 | - var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; | |
694 | - app.request.promiseGet(url0, {1: 1}).then(res => { | |
695 | - if (res.data.code == 0) { | |
696 | - frozenQuan = res.data.data; | |
697 | - th.data.frozenQuan = frozenQuan; | |
698 | - } | |
699 | - th.calculatePrice(); | |
700 | - th.get_cart_quan(); | |
701 | - }) | |
447 | + var price=presell.presell_price; | |
448 | + if(!goods) return false; | |
449 | + //--判断物流-- | |
450 | + if (goods.distr_type) | |
451 | + distr_type = goods.distr_type; | |
452 | + else | |
453 | + distr_type = pickup.distr_type; | |
454 | + | |
455 | + switch (distr_type) { | |
456 | + case 0: | |
457 | + exp_type = 1; | |
458 | + //-- 系统后台有设置要默认的 -- | |
459 | + if (th.data.sys_switch.pickupway && th.data.sys_switch.pickupway == 1) exp_type = 0; | |
460 | + break; //自选 | |
461 | + case 1: | |
462 | + exp_type = 1; | |
702 | 463 | |
703 | - }, 500) | |
464 | + break //自提 | |
465 | + case 2: | |
466 | + exp_type = 0; | |
467 | + break; //物流 | |
468 | + } | |
704 | 469 | |
705 | - } | |
470 | + order.order_goods = order_goods; | |
471 | + var tail_pay=pre_arr.presell_price*order_goods.goods_num-presell.presell_deposit; | |
472 | + this.setData({ | |
473 | + order: order, | |
474 | + distr_type: distr_type, | |
475 | + pickup: pickup, | |
476 | + exp_type: exp_type, | |
477 | + goods: goods, | |
478 | + presell:presell, | |
479 | + pre_arr:pre_arr, | |
480 | + show_submit:1, | |
481 | + userInfo:getApp().globalData.userInfo, | |
482 | + tail_pay:tail_pay, | |
483 | + order_goods:order_goods, | |
484 | + all_price:pre_arr.presell_price*order_goods.goods_num, | |
485 | + pickup_id:pickup.pickup_id | |
706 | 486 | }); |
487 | + th.get_diff(); | |
488 | + //统一进行计算金额 | |
489 | + th.calculatePrice2(); | |
490 | + //如果可以 | |
491 | + if(pre_arr.is_usecoupon){ | |
492 | + th.get_buy_now_quan(); | |
493 | + } | |
707 | 494 | }, |
708 | 495 | |
709 | - //-----获取立即购买的商品信息,入口---- | |
710 | - get_buy_goods: function (e) { | |
711 | - var th = this; | |
712 | - var gg = to.get_b_now(); | |
713 | - //--------如果goods_id一样,就是要立即购买----- | |
714 | - if (e == gg.goods_id) { | |
715 | - a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { | |
716 | - success: async function (t) { | |
717 | - var gd = t.data.data; | |
718 | - if (!gd) return false; | |
719 | - | |
720 | - t.data.data.original_img = oo.imghost + t.data.data.original_img; | |
721 | - t.data.data['buynum'] = gg.goods_num; | |
722 | - var distr_t = 0, et = 0 | |
723 | - if (t.data.data.distr_type == 0) { | |
724 | - distr_t = gg.pick_dis; | |
725 | - } else { | |
726 | - distr_t = t.data.data.distr_type; | |
727 | - } | |
728 | 496 | |
729 | - switch (distr_t) { | |
730 | - case 0: | |
731 | - et = 1; | |
732 | - //-- 系统后台有设置要默认的 -- | |
733 | - if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0; | |
734 | - break; | |
735 | - case 1: | |
736 | - et = 1; | |
737 | - break; | |
738 | - case 2: | |
739 | - et = 0; | |
740 | - break; | |
497 | + async calculatePrice2(){ | |
498 | + var th=this; | |
499 | + if(!this.data.pre_arr) return false; | |
500 | + //--计算物流-- | |
501 | + if (this.data.exp_type == 0) { | |
502 | + this.calculate_wuliu(); | |
503 | + } else { | |
504 | + var allpice =this.data.pre_arr.presell_price*this.data.order_goods.goods_num; | |
505 | + allpice = allpice.toFixed(2); | |
506 | + //--看一下有没有订单优惠-- | |
507 | + var o_condition = parseFloat(allpice); | |
508 | + //---如果有选择优惠券的情况下--- | |
509 | + var quan_price = 0, bn_pick = th.data.pickup.pickup_id; | |
510 | + var quan_no = null; | |
511 | + if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | |
512 | + quan_no = th.data.using_quan[bn_pick].coupon_no; | |
513 | + //-- 如果使用的券不是包邮券的时候 -- | |
514 | + if (quan_no && th.data.using_quan[bn_pick].isby != 1) { | |
515 | + //---获取优惠券优惠--- | |
516 | + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | |
517 | + data: { | |
518 | + storeId: oo.stoid, | |
519 | + CashRepNo: quan_no, | |
520 | + WaresSum: th.data.ckeck_quan_price, | |
521 | + WareIds: th.data.check_quan_ware_list | |
741 | 522 | } |
742 | - | |
743 | - | |
744 | - var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
745 | - if (et == 0 && def_exp_code) { | |
746 | - for (var k = 0; k < th.data.wu_arr.length; k++) { | |
747 | - var item = th.data.wu_arr[k]; | |
748 | - if (def_exp_code == item.code) { | |
749 | - m_wind = k; | |
750 | - } | |
751 | - } | |
523 | + }).then(res => { | |
524 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
525 | + quan_price = res.data.data[0].WareCashSum; | |
752 | 526 | } |
527 | + }) | |
528 | + } | |
753 | 529 | |
754 | - if (th.data.bn_goods) { | |
755 | - et = th.data.bn_exp_type; | |
756 | - m_wind = th.data.index; | |
530 | + if(quan_price>0){ | |
531 | + if (quan_price < o_condition) th.setData({quan_price: quan_price}) | |
532 | + else { | |
533 | + th.setData({quan_price: o_condition}) | |
757 | 534 | } |
535 | + o_condition=o_condition-quan_price; | |
758 | 536 | |
759 | - //---是不是购买等级卡成功的返回---等级卡显示的判断--- | |
760 | - var is_card_back = getApp().globalData.is_card_back; | |
761 | - if (is_card_back) { | |
762 | - th.data.card_name = th.data.userinfo.card_field; | |
763 | - gg.goods_price = gd[th.data.card_name]; | |
764 | - getApp().globalData.is_card_back = 0; | |
765 | - th.setData({card_cut_price: 0}); | |
766 | - //如果是秒杀的返回 | |
767 | - if (gd.prom_type == 1) gd.prom_type = 0; | |
768 | - } else { | |
769 | - //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格 | |
770 | - //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- | |
771 | - 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) { | |
772 | - var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num; | |
773 | - th.setData({card_cut_price: cut_p}); | |
537 | + }else{ | |
538 | + th.setData({quan_price: 0}) | |
539 | + } | |
540 | + if(o_condition<0) o_condition=0; | |
541 | + | |
542 | + //如果同意参与订单优惠 | |
543 | + if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { | |
544 | + th.check_is_order_prom(o_condition, function () { | |
545 | + var bn_pick=th.data.pickup.pickup_id | |
546 | + var order_prom_amount = 0; | |
547 | + var order_prom_id = 0; | |
548 | + if (th.data.order_prom[bn_pick]) { | |
549 | + var ord_prom = th.data.order_prom[bn_pick]; | |
550 | + order_prom_id = ord_prom['id']; | |
551 | + switch (ord_prom['type']) { | |
552 | + case 0: | |
553 | + o_condition = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
554 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
555 | + break; | |
556 | + case 1: | |
557 | + o_condition = o_condition - ord_prom['expression'];//满额优惠金额 | |
558 | + order_prom_amount = ord_prom['expression']; | |
559 | + break; | |
774 | 560 | } |
775 | 561 | } |
776 | - | |
777 | - switch (gd.prom_type) { | |
778 | - case 0: | |
779 | - case 2: | |
780 | - case 3: | |
781 | - case 4: | |
782 | - case 5: | |
783 | - case 6: | |
784 | - case 7: | |
785 | - //--此时开始计算商品的使用券相关,如果有等级价还要计算和等级价相关的, | |
786 | - // 如果有优惠促销,还要把促销的部分计算在内,因为促销还有不能使用优惠券-- | |
787 | - t.data.data.shop_price = gg.goods_price; | |
788 | - t.data.data.goods_price = gg.goods_price; | |
789 | - t.data.data.goods_num = gg.goods_num; | |
790 | - th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; | |
791 | - th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; | |
792 | - th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | |
793 | - | |
794 | - //-- 如果有线下取价的时候 -- | |
795 | - if (gg.offline_price) { | |
796 | - t.data.data.offline_price = gg.offline_price; | |
797 | - t.data.data.pricing_type = gg.pricing_type; | |
798 | - t.data.data.is_offline = 1; | |
799 | - | |
800 | - th.data.ckeck_quan_price = t.data.data.offline_price * gg.goods_num; | |
801 | - th.data.check_quan_price_list = t.data.data.offline_price * gg.goods_num + ""; | |
802 | - th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | |
803 | - } | |
804 | - | |
805 | - t.data.data.prom_id = 0; | |
806 | - t.data.data.prom_type = 0; | |
807 | - | |
808 | - //如果立即购买那边过来,就要读取接口,查看活动的优惠内容 | |
809 | - if (gg.prom_type == 3) { | |
810 | - t.data.data.prom_id = gg.prom_id; | |
811 | - t.data.data.prom_type = 3; | |
812 | - //如果是优惠活动,就要调用活动,计算价格 | |
813 | - th.buy_now_prom_goods(gg.prom_id, t.data.data, function (data) { | |
814 | - //判断一下购买商品的数量是不是超过 | |
815 | - if (data.gift_goods_id) { | |
816 | - var num = 1; | |
817 | - if (data.is_bz == 1) { | |
818 | - num = data.bs; | |
819 | - if (num > data.gift_limit_num) num = 0; | |
820 | - } | |
821 | - //如果赠品数量超出礼品库存,就取消 | |
822 | - if (num > data['gift_storecount']) num = 0; | |
823 | - if (num > 0) { | |
824 | - var ob = {}; | |
825 | - ob.is_gift = 1; | |
826 | - ob.prom_id = data.prom_id; | |
827 | - ob.goods_id = data.gift_goods_id; | |
828 | - ob.goods_name = data.gift_goods_name; | |
829 | - ob.goods_color = data.gift_goods_color; | |
830 | - ob.goods_spec = data.gift_goods_spec; | |
831 | - ob.original_img = os.imghost + data.gift_original_img; | |
832 | - ob.market_price = data.gift_market_price; | |
833 | - ob.gift_id = data.gift_id; | |
834 | - ob.shop_price = 0; | |
835 | - ob.buynum = num; | |
836 | - ob.weight = data.gift_weight; //商品的重量 | |
837 | - ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式 | |
838 | - ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额 | |
839 | - | |
840 | - th.setData({buy_now_gift_goods: ob}); | |
841 | - } | |
842 | - } | |
843 | - | |
844 | - th.setData({ | |
845 | - bn_goods: data, bn_pickname: gg.pick_name, index: m_wind, | |
846 | - bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et | |
847 | - }); | |
848 | - | |
849 | - //计算价格 | |
850 | - th.calculatePrice2(); | |
851 | - //获取优惠券 | |
852 | - th.get_buy_now_quan(); | |
853 | - | |
854 | - }) | |
855 | - } else { | |
856 | - //--看是不是搭配促销-- | |
857 | - if (gg.prom_type == 5) { | |
858 | - t.data.data.prom_id = gg.prom_id; | |
859 | - t.data.data.prom_type = 5; | |
860 | - if (gg.room_id) { | |
861 | - t.data.data.room_id = gg.room_id; | |
862 | - } | |
863 | - //--主商品要有导购id和导购类型-- | |
864 | - if (gg.guide_id) { | |
865 | - t.data.data.guide_id = gg.guide_id; | |
866 | - t.data.data.guide_type = gg.guide_type; | |
867 | - } | |
868 | - th.setData({collocation_goods: gg.collocation_goods}); | |
869 | - | |
870 | - var cart_arr = new Array(); | |
871 | - //var narr=gg.collocation_goods; | |
872 | - //修改成深拷贝,确保返回是数据正确 | |
873 | - var narr = JSON.parse(JSON.stringify(gg.collocation_goods)); | |
874 | - | |
875 | - narr.push(t.data.data); | |
876 | - | |
877 | - //-- 搭配促销的门店配送方式的修复 -- | |
878 | - et = 1; | |
879 | - distr_t = 0; | |
880 | - for (var hi in narr) { | |
881 | - var dis_t = narr[hi].distr_type; | |
882 | - if (dis_t == 2) { | |
883 | - th.setData({is_all_zt: 0}); | |
884 | - et = 0; | |
885 | - } | |
886 | - if (dis_t > 0) { | |
887 | - distr_t = dis_t; | |
888 | - } | |
889 | - } | |
890 | - | |
891 | - //自选的时候,系统配置了默认的配送方式是物流的时候 | |
892 | - if (distr_t == 0 && th.data.json_d.pickupway && th.data.json_d.pickupway == 1) { | |
893 | - et = 0; | |
894 | - } | |
895 | - | |
896 | - | |
897 | - var ie = { | |
898 | - pickup_id: gg.pick_id, | |
899 | - pname: gg.pick_name, | |
900 | - goods: narr, | |
901 | - exp_type: et, | |
902 | - wind: m_wind, | |
903 | - distr_t: distr_t, | |
904 | - bn_t_exp_t: distr_t, | |
905 | - goods_price: 0, | |
906 | - shipping_price: 0, | |
907 | - user_money: 0, | |
908 | - total_amount: 0, | |
909 | - order_amount: 0, | |
910 | - user_note: 0 | |
911 | - }; | |
912 | - cart_arr.push(ie); | |
913 | - th.data.old_cartlist = cart_arr; | |
914 | - } | |
915 | - th.setData({ | |
916 | - bn_goods: t.data.data, bn_pickname: gg.pick_name, index: m_wind, | |
917 | - bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et | |
918 | - }); | |
919 | - | |
920 | - | |
921 | - //--搭配促销也是按照购物车的方式来计算优惠券-- | |
922 | - if (gg.prom_type == 5) { | |
923 | - var frozenQuan = null; | |
924 | - var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; | |
925 | - app.request.promiseGet(url0, {1: 1}).then(res => { | |
926 | - if (res.data.code == 0) { | |
927 | - frozenQuan = res.data.data; | |
928 | - th.data.frozenQuan = frozenQuan; | |
929 | - } | |
930 | - //计算价格 | |
931 | - th.calculatePrice2(); | |
932 | - th.get_cart_quan(); | |
933 | - }); | |
934 | - } else { | |
935 | - //计算价格 | |
936 | - th.calculatePrice2(); | |
937 | - //获取优惠券, | |
938 | - th.get_buy_now_quan(); | |
939 | - } | |
940 | - } | |
941 | - | |
942 | - break; | |
943 | - case 1: //---秒杀----- | |
944 | - var quanlist = null; | |
945 | - getApp().request.get("/api/weshop/activitylist/getSJGoodsPrice/" + gd.store_id | |
946 | - + "/" + gd.goods_id + "/1/" + gd.prom_id, { | |
947 | - success: async function (tt) { | |
948 | - if (tt.data.code == 0) { | |
949 | - t.data.data.shop_price = tt.data.data.prom_price; | |
950 | - } else { | |
951 | - t.data.data.prom_id = 0; | |
952 | - t.data.data.prom_type = 0; | |
953 | - | |
954 | - th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; | |
955 | - th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; | |
956 | - th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | |
957 | - } | |
958 | - | |
959 | - th.setData({ | |
960 | - bn_goods: t.data.data, | |
961 | - bn_pickname: gg.pick_name, | |
962 | - bn_exp_type: et, | |
963 | - index: m_wind, | |
964 | - bn_pick: gg.pick_id, | |
965 | - bn_t_exp_t: distr_t, | |
966 | - bn_exp_type: et | |
967 | - }); | |
968 | - | |
969 | - //计算价格 | |
970 | - th.calculatePrice2(); | |
971 | - //获取优惠券,如果有券的钱,就调用 | |
972 | - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); | |
973 | - } | |
974 | - }); | |
975 | - | |
976 | - break; | |
562 | + //--订单优惠的显示-- | |
563 | + if (order_prom_id > 0) { | |
564 | + var order_prom_txt1 = "order_prom_id"; | |
565 | + var order_prom_txt2 = "order_prom_amount"; | |
566 | + th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) | |
977 | 567 | } |
978 | - }, | |
979 | - }); | |
568 | + th.setData({ exp_price: 0, order_m: o_condition }) | |
569 | + }) | |
570 | + }else{ | |
571 | + th.setData({ exp_price: 0, order_m: o_condition }) | |
572 | + } | |
980 | 573 | } |
981 | 574 | }, |
982 | 575 | |
... | ... | @@ -1010,7 +603,8 @@ Page({ |
1010 | 603 | }, |
1011 | 604 | keyUpChangeNum: function (t) { |
1012 | 605 | this.setData({ |
1013 | - maxWord: t.detail.value.length | |
606 | + maxWord: t.detail.value.length, | |
607 | + user_note:t.detail.value | |
1014 | 608 | }); |
1015 | 609 | }, |
1016 | 610 | |
... | ... | @@ -1176,453 +770,7 @@ Page({ |
1176 | 770 | } |
1177 | 771 | }, |
1178 | 772 | |
1179 | - //-------------------计算订单价格------------------- | |
1180 | - calculatePrice: function (t, s) { | |
1181 | - var th = this; | |
1182 | - to.getConfig2(function (ee) { | |
1183 | - to.getwuliuprice(async function (rs) { | |
1184 | - wx.showLoading({ | |
1185 | - title: "处理中." | |
1186 | - }) | |
1187 | - var all_price = 0; //所有的商品总价 | |
1188 | - var all_shipping_m = 0; //所有的物流总价 | |
1189 | - var all_total_m = 0; //所有的订单应付总价 | |
1190 | - var all_order_m = 0; //所有的订单应付总价 | |
1191 | - var all_user_m = 0; //所有的订单用户使用金额 | |
1192 | - var all_coupon_price_m = 0; //所有的订单用户使用优惠券价格 | |
1193 | - var all_cutprice = 0; //所有的优惠减 | |
1194 | - var all_zh_cutprice = 0; //所有的组合优惠减 | |
1195 | - var all_order_prom = 0; //所有的订单优惠 | |
1196 | - | |
1197 | - var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); | |
1198 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
1199 | - var no_ex_id = ee.no_ex_id; | |
1200 | - var no_ex_good = null; | |
1201 | - var by_qc = {}; | |
1202 | - | |
1203 | - if (no_ex_id && freight_free > 0) { | |
1204 | - //-----------获取不包邮区域,不包邮商品------- | |
1205 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | |
1206 | - data: {store_id: os.stoid, id: no_ex_id} | |
1207 | - }).then(res => { | |
1208 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
1209 | - by_qc = res.data.data[0]; | |
1210 | - } | |
1211 | - }) | |
1212 | - } | |
1213 | - ; | |
1214 | - var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist)); | |
1215 | - | |
1216 | - if (th.data.cartlist && th.data.cartlist.length > 0) { | |
1217 | - for (var i = 0; i < c_arr.length; i++) { | |
1218 | - c_arr[i].exp_type = th.data.cartlist[i].exp_type; | |
1219 | - c_arr[i].wind = th.data.cartlist[i].wind; | |
1220 | - } | |
1221 | - } | |
1222 | - | |
1223 | - //调用函数计算每件商品的单价 | |
1224 | - await th.calc_per(c_arr); | |
1225 | - //调用函数计算每件组合购商品的单价, | |
1226 | - await zh_calc.calc_zh_split_price(c_arr,th); | |
1227 | - //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品 | |
1228 | - await th.get_cart_quan(c_arr); | |
1229 | - //---循环购物车--- | |
1230 | - for (var i in c_arr) { | |
1231 | - //因为搭配购买也是再这里计算,搭配购的is_b_now==1 | |
1232 | - if (th.data.is_b_now == 0) { | |
1233 | - //此时物流的选择方式要用th.data.cartlist; | |
1234 | - c_arr[i].exp_type = th.data.cartlist[i].exp_type; | |
1235 | - c_arr[i].wind = th.data.cartlist[i].wind; | |
1236 | - if (th.data.cartlist[i].check_quan_price_list) c_arr[i].check_quan_price_list = th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格 | |
1237 | - if (th.data.cartlist[i].check_quan_ware_list) c_arr[i].check_quan_ware_list = th.data.cartlist[i].check_quan_ware_list; //优惠券优惠什么商品 | |
1238 | - } else { | |
1239 | - c_arr[i].exp_type = th.data.bn_exp_type; //配送方式 | |
1240 | - c_arr[i].wind = th.data.index; //立即购买选择的物流 | |
1241 | - //c_arr[i].=th.data. //立即购买的使用余额 | |
1242 | - if (th.data.cartlist) c_arr[i].check_quan_price_list = th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格 | |
1243 | - if (th.data.cartlist) c_arr[i].check_quan_ware_list = th.data.cartlist[i].check_quan_ware_list; //优惠券优惠什么商品 | |
1244 | - } | |
1245 | - | |
1246 | - var cart_item = c_arr[i]; //就是每一单的意思 | |
1247 | - var pickid = cart_item.pickup_id; | |
1248 | - var o_price = 0; | |
1249 | - var o_price_no_zh=0; //不包含限制优惠叠加组合购的金额汇总 | |
1250 | - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
1251 | - var item = c_arr[i].goods; //就是每一单的从表的意思 | |
1252 | - | |
1253 | - //---如果有选择优惠券的情况下--- | |
1254 | - var quan_price = 0; | |
1255 | - var coupon_price = 0; | |
1256 | - var quan_no = null; | |
1257 | - var is_has_zh=c_arr[i].is_has_zh; | |
1258 | - var zh_prom_goods=c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间 | |
1259 | - | |
1260 | - if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined) | |
1261 | - quan_no = th.data.using_quan[pickid].coupon_no; | |
1262 | - | |
1263 | - //普通券的时候 | |
1264 | - if (quan_no && th.data.using_quan[pickid].isby != 1) { | |
1265 | - //---获取优惠券优惠--- | |
1266 | - await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | |
1267 | - data: { | |
1268 | - storeId: oo.stoid, | |
1269 | - CashRepNo: quan_no, | |
1270 | - WaresSum: cart_item.check_quan_price_list, | |
1271 | - WareIds: cart_item.check_quan_ware_list | |
1272 | - } | |
1273 | - }).then(res => { | |
1274 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
1275 | - var q_data = res.data.data; | |
1276 | - //--存储商品优惠的内容-- | |
1277 | - cart_item.quan_youhui_list = q_data; | |
1278 | - for (var k in q_data) | |
1279 | - quan_price += q_data[k].WareCashSum; | |
1280 | - } | |
1281 | - }) | |
1282 | - } | |
1283 | - | |
1284 | - //--------循环计算总价----------- | |
1285 | - for (var j = 0; j < item.length; j++) { | |
1286 | - if(item[j].prom_type!=7){ | |
1287 | - o_price_no_zh += item[j].goods_price * item[j].goods_num; | |
1288 | - } | |
1289 | - //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 | |
1290 | - else if(zh_prom_goods && zh_prom_goods[item[j].prom_id] && zh_prom_goods[item[j].prom_id].act.is_orderyh ) | |
1291 | - { | |
1292 | - o_price_no_zh += item[j].goods_price * item[j].goods_num; | |
1293 | - } | |
1294 | - o_price += item[j].goods_price * item[j].goods_num; | |
1295 | - } | |
1296 | - //判断是不是有组合购的金额 | |
1297 | - var f_o_price = o_price; | |
1298 | - //如果又优惠的钱,就要减价 | |
1299 | - if (c_arr[i].cut_price > 0){ | |
1300 | - o_price -= c_arr[i].cut_price; | |
1301 | - o_price_no_zh-=c_arr[i].cut_price; | |
1302 | - } | |
1303 | - //如果有组合购优惠的钱,就要减价 | |
1304 | - if (c_arr[i].zh_cut_price>0 || c_arr[i].zh_cut_price<0){ | |
1305 | - o_price -= c_arr[i].zh_cut_price; | |
1306 | - if(o_price_no_zh>0){ | |
1307 | - //找到那些可以订单优惠叠加的 | |
1308 | - for(let ij in zh_prom_goods){ | |
1309 | - let kitem=zh_prom_goods[ij]; | |
1310 | - if(kitem.act.is_orderyh) continue; | |
1311 | - o_price_no_zh-=kitem.cut_price; | |
1312 | - } | |
1313 | - } | |
1314 | - } | |
1315 | - | |
1316 | - //-- 计算线下取价的功能 -- | |
1317 | - if (cart_item.is_offline == 1) { | |
1318 | - o_price = o_price - cart_item.offline_price; | |
1319 | - o_price_no_zh-=c_arr[i].offline_price; | |
1320 | - } | |
1321 | - //判断包邮券的钱,组合购的商品不使用优惠券 | |
1322 | - var q_conditin = 0; | |
1323 | - q_conditin = o_price - quan_price; | |
1324 | - if(is_has_zh){ | |
1325 | - q_conditin = o_price_no_zh - quan_price; | |
1326 | - } | |
1327 | - cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 | |
1328 | - //计算物流费用 | |
1329 | - cart_item.shipping_price = 0; | |
1330 | - | |
1331 | - | |
1332 | - //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额-- | |
1333 | - 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)) { | |
1334 | - //如果有设置不包邮区域的时候 | |
1335 | - if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { | |
1336 | - if (th.check_by_area(by_qc.region_list)) { | |
1337 | - freight_free = 0; | |
1338 | - th.data.is_no_by[pickid] = 1; | |
1339 | - } | |
1340 | - } | |
1341 | - //如果有设置不包邮区商品 | |
1342 | - if (by_qc.goods_list != "" && by_qc.goods_list != undefined && by_qc != null && freight_free > 0) { | |
1343 | - freight_free = 0; | |
1344 | - no_ex_good = by_qc.goods_list; | |
1345 | - } | |
1346 | - } | |
1347 | - | |
1348 | - //--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额-- | |
1349 | - if (cart_item.exp_type == 0 && th.data.user_addr != null) { | |
1350 | - //看是不是有调用过包邮券 | |
1351 | - if (!th.data.isget_by_quan[pickid]) { | |
1352 | - //--判断要不要显示包邮券,调用接口,因为有for循环--- | |
1353 | - await getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { | |
1354 | - data: { | |
1355 | - store_id: os.stoid, | |
1356 | - isuse: 0, | |
1357 | - condition: q_conditin, | |
1358 | - user_id: getApp().globalData.user_id, | |
1359 | - pageSize: 2000 | |
1360 | - } | |
1361 | - }).then(res => { | |
1362 | - if (res.data.code == 0 && res.data.data.total > 0) { | |
1363 | - //此时要循环判断包邮的地区,不包邮商品是不是符合 | |
1364 | - var arr = [], quanlist = res.data.data.pageData; | |
1365 | - quanlist = th.check_is_frozenQuan(quanlist, th.data.frozenQuan, 1); | |
1366 | - for (var i in quanlist) { | |
1367 | - var item = quanlist[i]; | |
1368 | - var goods = cart_item.goods; | |
1369 | - var g_arr = []; | |
1370 | - for (var ii in goods) { | |
1371 | - g_arr.push(goods[ii].goods_id); | |
1372 | - } | |
1373 | - if (item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域 | |
1374 | - if (item.goods_list) { | |
1375 | - var no_goods_arr = item.goods_list.split(","); | |
1376 | - if (ut.isContained(no_goods_arr, g_arr)) continue; //如果是不包邮商品 | |
1377 | - } | |
1378 | - arr.push(item); | |
1379 | - } | |
1380 | - if (arr) { | |
1381 | - th.data.get_by_quan_list_cart[pickid] = arr; | |
1382 | - //th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart}); | |
1383 | - if (th.data.is_b_now) { | |
1384 | - th.setData({get_by_quan_list: arr}); | |
1385 | - } | |
1386 | - } | |
1387 | - th.data.isget_by_quan[pickid] = 1; | |
1388 | - } | |
1389 | - }) | |
1390 | - } | |
1391 | - } | |
1392 | - | |
1393 | - //如果是包邮券的时候,要看看券的情况 | |
1394 | - if (quan_no && th.data.using_quan[pickid].isby == 1) { | |
1395 | - var quan = th.data.using_quan[pickid]; | |
1396 | - if (!quan.goods_list) { | |
1397 | - th.data.is_quan_by[pickid] = 1; //专门给券的判断用的 | |
1398 | - } else { | |
1399 | - th.data.is_quan_by[pickid] = 0; | |
1400 | - //看有没有模板的包邮 | |
1401 | - if (no_ex_good) { | |
1402 | - var arr = no_ex_good.split(","); | |
1403 | - var arr2 = quan.goods_list.split(","); | |
1404 | - if (ut.isContained(arr, arr2)) { | |
1405 | - getApp().my_warnning("全场不包邮商品和包邮券的重复", 0, th); | |
1406 | - th.data.using_quan[pickid] = {}; | |
1407 | - th.setData({using_quan: th.data.using_quan}) | |
1408 | - return false; | |
1409 | - } | |
1410 | - var n_arr = ut.mergeArray(arr, arr2); | |
1411 | - no_ex_good = n_arr.join(","); | |
1412 | - } else { | |
1413 | - no_ex_good = quan.goods_list; | |
1414 | - } | |
1415 | - } | |
1416 | - } else { | |
1417 | - th.data.is_quan_by[pickid] = 0; //专门给券的判断用的 | |
1418 | - } | |
1419 | - | |
1420 | - //--------循环计算总价----------- | |
1421 | - for (var j = 0; j < item.length; j++) { | |
1422 | - //如果都包邮,都没必要等级数量了 | |
1423 | - if (th.data.is_quan_by[pickid]) continue; | |
1424 | - //如果是优惠活动是包邮,就不用计算包邮的费用了 | |
1425 | - if (item[j].is_past) continue; | |
1426 | - //是不是不包邮的商品 | |
1427 | - var is_good_no_by = 0; | |
1428 | - if (no_ex_good) { | |
1429 | - is_good_no_by = th.check_by_goods(no_ex_good, item[j].goods_id); | |
1430 | - } | |
1431 | - | |
1432 | - //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 | |
1433 | - if (o_price - quan_price >= freight_free && freight_free > 0 && !is_good_no_by && th.data.is_no_by[pickid] != 1) { | |
1434 | - continue; | |
1435 | - } | |
1436 | - | |
1437 | - //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- | |
1438 | - if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && !is_good_no_by) { | |
1439 | - continue; | |
1440 | - } | |
1441 | - | |
1442 | - var no_ex_good_arr = null; | |
1443 | - if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); | |
1444 | - | |
1445 | - //----------------如果是选择了物流--------------------- | |
1446 | - 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 )) { | |
1447 | - | |
1448 | - //如果地址不为空 | |
1449 | - if (th.data.user_addr != null) { | |
1450 | - switch (item[j]['exp_sum_type']) { | |
1451 | - case 1: | |
1452 | - //统一运费 | |
1453 | - o_shipping_price += item[j]['uniform_exp_sum']; | |
1454 | - break; | |
1455 | - case 2: | |
1456 | - +'' | |
1457 | - if (goods_weight < 0) goods_weight = 0; | |
1458 | - //累积商品重量 每种商品的重量 * 数量 | |
1459 | - goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
1460 | - | |
1461 | - break; | |
1462 | - case 3: | |
1463 | - if (goods_piece < 0) goods_piece = 0; | |
1464 | - //累积商品数量 | |
1465 | - goods_piece += item[j]['goods_num']; | |
1466 | - break; | |
1467 | - } | |
1468 | - } | |
1469 | - | |
1470 | - } | |
1471 | - } | |
1472 | - | |
1473 | - //计算物流价格 | |
1474 | - if (cart_item.exp_type == 0) { | |
1475 | - //freight_free=0; //后面不在进行判断 | |
1476 | - var code = ""; | |
1477 | - if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) | |
1478 | - code = th.data.wu_arr[cart_item.wind].code; | |
1479 | - cart_item.shipping_price = | |
1480 | - th.calculatewuliu(code, o_shipping_price, goods_weight, | |
1481 | - goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs); | |
1482 | - | |
1483 | - if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { | |
1484 | - if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 | |
1485 | - } | |
1486 | - } else { | |
1487 | - cart_item.shipping_price = 0; | |
1488 | - } | |
1489 | - | |
1490 | - cart_item.shipping_price = cart_item.shipping_price.toFixed(2); | |
1491 | - | |
1492 | - //总价计算,总价不包含运费 | |
1493 | - cart_item.order_amount = (o_price - quan_price).toFixed(2); | |
1494 | - cart_item.total_amount = f_o_price.toFixed(2); | |
1495 | - | |
1496 | - var order_prom_amount = 0; | |
1497 | - var order_prom_id = 0; | |
1498 | - var o_condition = cart_item.order_amount; | |
1499 | - //看一下是不是不用组合购的订单优惠的叠加 | |
1500 | - if(is_has_zh){ | |
1501 | - o_condition=o_price_no_zh-quan_price; | |
1502 | - } | |
1503 | - | |
1504 | - var order_m = 0; | |
1505 | - //---判断是不是有订单优惠--- | |
1506 | - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
1507 | - data: {store_id: os.stoid, orderAmount: o_condition} | |
1508 | - }).then(res => { | |
1509 | - if (res.data.code == 0) { | |
1510 | - var ord_prom = res.data.data; | |
1511 | - order_prom_id = ord_prom['id']; | |
1512 | - switch (ord_prom['type']) { | |
1513 | - case 0: | |
1514 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
1515 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
1516 | - break; | |
1517 | - case 1: | |
1518 | - //order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
1519 | - order_prom_amount = ord_prom['expression']; | |
1520 | - break; | |
1521 | - } | |
1522 | - } | |
1523 | - }) | |
1524 | - | |
1525 | - cart_item.order_prom_amount = 0; | |
1526 | - //--订单优惠的显示-- | |
1527 | - if (order_prom_id > 0) { | |
1528 | - cart_item.order_amount = (o_price - quan_price - order_prom_amount).toFixed(2); | |
1529 | - cart_item.order_prom_id = order_prom_id; | |
1530 | - cart_item.order_prom_amount = order_prom_amount; | |
1531 | - } | |
1532 | - coupon_price = quan_price; | |
1533 | - if (cart_item.order_amount < 0) { | |
1534 | - cart_item.order_amount = 0; | |
1535 | - coupon_price = o_price; | |
1536 | - } | |
1537 | - | |
1538 | - cart_item.total_amount = parseFloat(cart_item.total_amount) + parseFloat(cart_item.shipping_price); //总金额 | |
1539 | - cart_item.order_amount = parseFloat(cart_item.order_amount) + parseFloat(cart_item.shipping_price); //总金额 | |
1540 | - cart_item.total_amount = cart_item.total_amount.toFixed(2); | |
1541 | - cart_item.order_amount = cart_item.order_amount.toFixed(2); | |
1542 | - | |
1543 | - //搭配购在使用余额 | |
1544 | - if (th.data.bn_use_money == 1 && th.data.is_b_now == 1) { | |
1545 | - | |
1546 | - if (umoney > cart_item.order_amount) { | |
1547 | - cart_item.user_money = cart_item.order_amount; | |
1548 | - umoney = umoney - cart_item.order_amount; | |
1549 | - } else { | |
1550 | - cart_item.user_money = umoney; | |
1551 | - umoney = 0; | |
1552 | - } | |
1553 | - | |
1554 | - } else { | |
1555 | - //--------------如果使用余额,购物车购买--------------------- | |
1556 | - if (th.data.js_use_money == 1) { | |
1557 | - if (umoney > cart_item.order_amount) { | |
1558 | - cart_item.user_money = cart_item.order_amount; | |
1559 | - umoney = umoney - cart_item.order_amount; | |
1560 | - } else { | |
1561 | - cart_item.user_money = umoney; | |
1562 | - umoney = 0; | |
1563 | - } | |
1564 | - } else { | |
1565 | - cart_item.user_money = 0; | |
1566 | - } | |
1567 | - } | |
1568 | - | |
1569 | - cart_item.user_money = parseFloat(cart_item.user_money).toFixed(2); | |
1570 | - if (coupon_price > 0) cart_item.coupon_price = coupon_price.toFixed(2); | |
1571 | - else cart_item.coupon_price = coupon_price | |
1572 | - if (quan_no) cart_item.quan_no = quan_no; | |
1573 | - | |
1574 | - | |
1575 | - //cart_item.goods_price = o_price.toFixed(2); | |
1576 | - cart_item.order_amount = cart_item.order_amount - cart_item.user_money; //会员使用余额 | |
1577 | - | |
1578 | - | |
1579 | - all_price += parseFloat(f_o_price); | |
1580 | - all_total_m += parseFloat(cart_item.total_amount); | |
1581 | - all_shipping_m += parseFloat(cart_item.shipping_price); | |
1582 | - all_order_m += parseFloat(cart_item.order_amount); | |
1583 | - all_user_m += parseFloat(cart_item.user_money); | |
1584 | - all_coupon_price_m += parseFloat(cart_item.coupon_price); | |
1585 | - all_cutprice += parseFloat(cart_item.cut_price); | |
1586 | - all_zh_cutprice += parseFloat(cart_item.zh_cut_price); | |
1587 | - all_order_prom += parseFloat(cart_item.order_prom_amount); | |
1588 | - } | |
1589 | - | |
1590 | - all_shipping_m = parseFloat(all_shipping_m).toFixed(2); | |
1591 | - all_total_m = parseFloat(all_total_m).toFixed(2); | |
1592 | - all_order_m = parseFloat(all_order_m).toFixed(2); | |
1593 | - all_price = parseFloat(all_price).toFixed(2); | |
1594 | - all_user_m = parseFloat(all_user_m).toFixed(2); | |
1595 | - all_total_m = parseFloat(all_total_m).toFixed(2); | |
1596 | - all_coupon_price_m = parseFloat(all_coupon_price_m).toFixed(2); | |
1597 | - all_cutprice = all_cutprice.toFixed(2); | |
1598 | - all_order_prom = all_order_prom.toFixed(2); | |
1599 | - all_zh_cutprice = parseFloat(all_zh_cutprice).toFixed(2); | |
1600 | - | |
1601 | - var atxt = "formData.total_amount"; | |
1602 | - var atxt1 = "formData.order_amount"; | |
1603 | - var atxt2 = "formData.all_price"; | |
1604 | - var atxt3 = "formData.user_money"; | |
1605 | - var atxt4 = "formData.shipping_price"; | |
1606 | - var atxt5 = "formData.coupon_price"; | |
1607 | - var atxt6 = "formData.cut_price"; | |
1608 | - var atxt7 = "formData.order_prom_amount"; | |
1609 | - var atxt8 = "formData.zh_cut_price"; | |
1610 | - | |
1611 | - th.setData({ | |
1612 | - [atxt]: all_total_m, [atxt1]: all_order_m, | |
1613 | - [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, | |
1614 | - [atxt5]: all_coupon_price_m, [atxt6]: all_cutprice, | |
1615 | - [atxt7]: all_order_prom, show_submit: 1, [atxt8]: all_zh_cutprice | |
1616 | - }) | |
1617 | - th.data.order_prom_list_cart = c_arr; | |
1618 | - th.set_can_num(); | |
1619 | - wx.hideLoading(); | |
1620 | - | |
1621 | - }); | |
1622 | - }); | |
1623 | - }, | |
1624 | - | |
1625 | - set_can_num: function () { | |
773 | + set_can_num: function () { | |
1626 | 774 | var th = this; |
1627 | 775 | //-- 这个地方,循环计算几张优惠券可用-- |
1628 | 776 | for (var iter in th.data.cartlist) { |
... | ... | @@ -1634,994 +782,22 @@ Page({ |
1634 | 782 | for (var iter1 in c_item.quan_list) { |
1635 | 783 | //判断是不是其他订单有选用 |
1636 | 784 | var is_other_is_use = th.check_other_use(c_item.quan_list[iter1], pkid); |
1637 | - if (!is_other_is_use) num++; | |
1638 | - } | |
1639 | - } | |
1640 | - //-- 包邮券 -- | |
1641 | - var by_quan = th.data.get_by_quan_list_cart[pkid]; | |
1642 | - if (by_quan) { | |
1643 | - for (var iter2 in by_quan) { | |
1644 | - //判断是不是其他订单有选用 | |
1645 | - var is_other_is_use = th.check_other_use_by(by_quan[iter2], pkid); | |
1646 | - if (!is_other_is_use) num++; | |
1647 | - } | |
1648 | - } | |
1649 | - var set_txt = "cartlist[" + iter + "].can_num"; | |
1650 | - th.setData({[set_txt]: num}); | |
1651 | - } | |
1652 | - }, | |
1653 | - | |
1654 | - | |
1655 | - //---------计算立即购买---------- | |
1656 | - calculatePrice2: function () { | |
1657 | - var th = this, good = this.data.bn_goods; | |
1658 | - | |
1659 | - if (!good) return false; | |
1660 | - | |
1661 | - //搭配的计算要用购物的车计算方法 | |
1662 | - if (good.prom_type == 5) { | |
1663 | - th.calculatePrice(); | |
1664 | - return false; | |
1665 | - } | |
1666 | - | |
1667 | - wx.showLoading({ | |
1668 | - title: "处理中." | |
1669 | - }) | |
1670 | - //-----------计算商品总价-------------- | |
1671 | - var allpice = good.shop_price * good.buynum; | |
1672 | - var cut_price = 0; | |
1673 | - var allpice1 = allpice; | |
1674 | - | |
1675 | - | |
1676 | - if (good.prom_type == 3 && good.prom_price !== null) { | |
1677 | - cut_price = allpice - good.prom_price; | |
1678 | - } | |
1679 | - | |
1680 | - allpice = parseFloat(allpice).toFixed(2); | |
1681 | - var txt = "formData.all_price"; | |
1682 | - th.setData({[txt]: allpice,}); | |
1683 | - if (cut_price) { | |
1684 | - var c_txt = "formData.cut_price"; | |
1685 | - th.setData({[c_txt]: cut_price,}); | |
1686 | - | |
1687 | - } | |
1688 | - | |
1689 | - //如果有线下取价的时候 | |
1690 | - if (good.is_offline) { | |
1691 | - allpice = good.offline_price * good.buynum; | |
1692 | - } | |
1693 | - | |
1694 | - | |
1695 | - to.getConfig2(function (ee) { | |
1696 | - to.getwuliuprice(async function (rs) { | |
1697 | - | |
1698 | - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
1699 | - | |
1700 | - //---如果有选择优惠券的情况下--- | |
1701 | - var quan_price = 0, bn_pick = th.data.bn_pick; | |
1702 | - var quan_no = null; | |
1703 | - if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | |
1704 | - quan_no = th.data.using_quan[bn_pick].coupon_no; | |
1705 | - | |
1706 | - if (quan_no) { | |
1707 | - if (th.data.using_quan[bn_pick].isby != 1) { | |
1708 | - //---获取优惠券优惠--- | |
1709 | - await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | |
1710 | - data: { | |
1711 | - storeId: oo.stoid, | |
1712 | - CashRepNo: quan_no, | |
1713 | - WaresSum: th.data.ckeck_quan_price, | |
1714 | - WareIds: th.data.check_quan_ware_list | |
1715 | - } | |
1716 | - }).then(res => { | |
1717 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
1718 | - quan_price = res.data.data[0].WareCashSum; | |
1719 | - } | |
1720 | - }) | |
1721 | - } | |
1722 | - } | |
1723 | - | |
1724 | - //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | |
1725 | - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) { | |
1726 | - //看是不是有调用过包邮券 | |
1727 | - if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1) { | |
1728 | - var condition = allpice - cut_price - quan_price; | |
1729 | - //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- | |
1730 | - getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { | |
1731 | - data: { | |
1732 | - store_id: os.stoid, | |
1733 | - isuse: 0, | |
1734 | - condition: condition, | |
1735 | - user_id: getApp().globalData.user_id, | |
1736 | - pageSize: 2000 | |
1737 | - } | |
1738 | - }).then(res => { | |
1739 | - if (res.data.code == 0 && res.data.data.total > 0) { | |
1740 | - //此时要循环判断包邮的地区,不包邮商品是不是符合 | |
1741 | - var arr = [], quanlist = res.data.data.pageData; | |
1742 | - quanlist = th.check_is_frozenQuan(quanlist, th.data.frozenQuan, 1); | |
1743 | - for (var i in quanlist) { | |
1744 | - var item = quanlist[i]; | |
1745 | - if (item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域 | |
1746 | - if (item.goods_list && th.check_by_goods(item.goods_list)) continue; //如果是不包邮商品 | |
1747 | - arr.push(item); | |
1748 | - } | |
1749 | - if (arr) { | |
1750 | - th.setData({get_by_quan_list: arr}); | |
1751 | - } | |
1752 | - th.data.isget_by_quan[th.data.bn_pick] = 1; | |
1753 | - } | |
1754 | - }) | |
1755 | - } | |
1756 | - | |
1757 | - switch (good['exp_sum_type']) { | |
1758 | - case 1: | |
1759 | - //统一运费 | |
1760 | - o_shipping_price += good['uniform_exp_sum']; | |
1761 | - break; | |
1762 | - case 2: | |
1763 | - if (goods_weight < 0) goods_weight = 0; | |
1764 | - //累积商品重量 每种商品的重量 * 数量 | |
1765 | - goods_weight += good['weight'] * good['buynum']; | |
1766 | - break; | |
1767 | - case 3: | |
1768 | - if (goods_piece < 0) goods_piece = 0; | |
1769 | - //累积商品数量 | |
1770 | - goods_piece += good['buynum']; | |
1771 | - break; | |
1772 | - } | |
1773 | - | |
1774 | - var code = ""; | |
1775 | - if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | |
1776 | - var freight_free = ee.freight_free; //全场满多少包邮 | |
1777 | - var no_ex_id = ee.no_ex_id; | |
1778 | - th.data.is_no_by[th.data.bn_pick] = 0; | |
1779 | - | |
1780 | - var no_by_data = null; | |
1781 | - var gift_freight_free = freight_free; | |
1782 | - | |
1783 | - | |
1784 | - //有不包邮区域,且不免运费 | |
1785 | - if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { | |
1786 | - //-----------获取不包邮区域,不包邮商品------- | |
1787 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | |
1788 | - data: {store_id: os.stoid, id: no_ex_id} | |
1789 | - }).then(res => { | |
1790 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
1791 | - no_by_data = res.data.data[0]; | |
1792 | - //如果有设置不包邮区域的时候 | |
1793 | - if (res.data.data[0].region_list) { | |
1794 | - if (th.check_by_area(res.data.data[0].region_list)) { | |
1795 | - freight_free = 0; | |
1796 | - th.data.is_no_by[th.data.bn_pick] = 1; | |
1797 | - } | |
1798 | - } | |
1799 | - //如果有设置不包邮商品 | |
1800 | - if (res.data.data[0].goods_list && freight_free) { | |
1801 | - if (th.check_by_goods(res.data.data[0].goods_list)) { | |
1802 | - freight_free = 0; | |
1803 | - th.data.is_no_by[th.data.bn_pick] = 1; | |
1804 | - } | |
1805 | - } | |
1806 | - } | |
1807 | - }) | |
1808 | - } | |
1809 | - | |
1810 | - th.data.is_by[th.data.bn_pick] = 0; | |
1811 | - //--------------开始计算物流------------------ | |
1812 | - var shipping_price = | |
1813 | - th.calculatewuliu(code, o_shipping_price, goods_weight, | |
1814 | - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); | |
1815 | - | |
1816 | - //如果有赠品的时候,也要计算赠品的物流费用 | |
1817 | - if (th.data.buy_now_gift_goods) { | |
1818 | - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, | |
1819 | - parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); | |
1820 | - } | |
1821 | - | |
1822 | - if (shipping_price <= 0) { | |
1823 | - th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | |
1824 | - } | |
1825 | - | |
1826 | - shipping_price = parseFloat(shipping_price).toFixed(2); | |
1827 | - var wl_txt = "formData.shipping_price"; | |
1828 | - th.setData({[wl_txt]: shipping_price,}) | |
1829 | - | |
1830 | - } else { | |
1831 | - var wl_txt = "formData.shipping_price"; | |
1832 | - th.setData({[wl_txt]: 0,}) | |
1833 | - } | |
1834 | - | |
1835 | - if (quan_no) { | |
1836 | - if (th.data.using_quan[bn_pick].isby == 1) { | |
1837 | - shipping_price = 0; | |
1838 | - var wl_txt = "formData.shipping_price"; | |
1839 | - th.setData({[wl_txt]: 0,}) | |
1840 | - } | |
1841 | - } | |
1842 | - //-----------------支付价,优惠券不减物流----------------- | |
1843 | - var total_m = (parseFloat(allpice1)).toFixed(2); | |
1844 | - var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2); | |
1845 | - var coupon_price = quan_price; //优惠券优惠了多少钱 | |
1846 | - if (order_m < 0) { | |
1847 | - order_m = 0; | |
1848 | - coupon_price = parseFloat(order_m).toFixed(2); | |
1849 | - } | |
1850 | - //--看一下有没有订单优惠-- | |
1851 | - var o_condition = parseFloat(order_m); | |
1852 | - if (o_condition > 0) { | |
1853 | - th.check_is_order_prom(o_condition, function () { | |
1854 | - var order_prom_amount = 0; | |
1855 | - var order_prom_id = 0; | |
1856 | - if (th.data.order_prom[th.data.bn_pick]) { | |
1857 | - var ord_prom = th.data.order_prom[th.data.bn_pick]; | |
1858 | - order_prom_id = ord_prom['id']; | |
1859 | - switch (ord_prom['type']) { | |
1860 | - case 0: | |
1861 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
1862 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
1863 | - break; | |
1864 | - case 1: | |
1865 | - order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
1866 | - order_prom_amount = ord_prom['expression']; | |
1867 | - break; | |
1868 | - } | |
1869 | - } | |
1870 | - //--订单优惠的显示-- | |
1871 | - if (order_prom_id > 0) { | |
1872 | - var order_prom_txt1 = "formData.order_prom_id"; | |
1873 | - var order_prom_txt2 = "formData.order_prom_amount"; | |
1874 | - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) | |
1875 | - } | |
1876 | - | |
1877 | - total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
1878 | - order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
1879 | - | |
1880 | - total_m = total_m.toFixed(2); | |
1881 | - order_m = order_m.toFixed(2); | |
1882 | - | |
1883 | - var atxt = "formData.total_amount"; | |
1884 | - th.setData({[atxt]: total_m,}) | |
1885 | - | |
1886 | - var txt = "formData.user_money"; | |
1887 | - var txt2 = "formData.order_amount"; | |
1888 | - var txt3 = "formData.coupon_price"; | |
1889 | - var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
1890 | - //--------------如果使用余额--------------------- | |
1891 | - if (th.data.bn_use_money == 1) { | |
1892 | - if (amoney > order_m) { | |
1893 | - order_m = parseFloat(order_m).toFixed(2); | |
1894 | - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) | |
1895 | - } else { | |
1896 | - order_m = parseFloat(order_m) - parseFloat(amoney); | |
1897 | - order_m = order_m.toFixed(2); | |
1898 | - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
1899 | - } | |
1900 | - } else { | |
1901 | - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
1902 | - } | |
1903 | - //优惠活动送积分 | |
1904 | - if (good.s_intValue) { | |
1905 | - txt = "formData.give_integral"; | |
1906 | - th.setData({[txt]: good.s_intValue}); | |
1907 | - } | |
1908 | - //优惠送券 | |
1909 | - if (good.s_coupon_id) { | |
1910 | - var i_txt = "formData.give_coupon_id"; | |
1911 | - //这个是json格式的 | |
1912 | - var i_txt1 = "formData.g_coupon_num"; | |
1913 | - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; | |
1914 | - ob = JSON.stringify(ob); | |
1915 | - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); | |
1916 | - } | |
1917 | - //优惠礼包 | |
1918 | - if (good.s_libao) { | |
1919 | - var l_txt = "formData.give_lb_id"; | |
1920 | - //这个是json格式的 | |
1921 | - var l_txt1 = "formData.g_lb_num"; | |
1922 | - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; | |
1923 | - ob = JSON.stringify(ob); | |
1924 | - th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); | |
1925 | - } | |
1926 | - }) | |
1927 | - } else { | |
1928 | - total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
1929 | - order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
1930 | - var atxt = "formData.total_amount"; | |
1931 | - | |
1932 | - total_m = total_m.toFixed(2); | |
1933 | - order_m = order_m.toFixed(2); | |
1934 | - | |
1935 | - th.setData({[atxt]: total_m,}) | |
1936 | - | |
1937 | - var txt = "formData.user_money"; | |
1938 | - var txt2 = "formData.order_amount"; | |
1939 | - var txt3 = "formData.coupon_price"; | |
1940 | - var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
1941 | - //--------------如果使用余额--------------------- | |
1942 | - if (th.data.bn_use_money == 1) { | |
1943 | - if (amoney > order_m) { | |
1944 | - order_m = parseFloat(order_m).toFixed(2); | |
1945 | - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) | |
1946 | - } else { | |
1947 | - order_m = parseFloat(order_m) - parseFloat(amoney); | |
1948 | - order_m = order_m.toFixed(2); | |
1949 | - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
1950 | - } | |
1951 | - } else { | |
1952 | - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
1953 | - } | |
1954 | - //优惠活动送积分 | |
1955 | - if (good.s_intValue) { | |
1956 | - txt = "formData.give_integral"; | |
1957 | - th.setData({[txt]: good.s_intValue}); | |
1958 | - } | |
1959 | - //优惠送券 | |
1960 | - if (good.s_coupon_id) { | |
1961 | - var i_txt = "formData.give_coupon_id"; | |
1962 | - //这个是json格式的 | |
1963 | - var i_txt1 = "formData.g_coupon_num"; | |
1964 | - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; | |
1965 | - ob = JSON.stringify(ob); | |
1966 | - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); | |
1967 | - } | |
1968 | - //优惠礼包 | |
1969 | - if (good.s_libao) { | |
1970 | - var l_txt = "formData.give_lb_id"; | |
1971 | - //这个是json格式的 | |
1972 | - var l_txt1 = "formData.g_lb_num"; | |
1973 | - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; | |
1974 | - ob = JSON.stringify(ob); | |
1975 | - th.setData({[l_txt]: good.s_coupon_id, [l_txt1]: ob}); | |
1976 | - } | |
1977 | - } | |
1978 | - | |
1979 | - wx.hideLoading(); | |
1980 | - | |
1981 | - }); | |
1982 | - }); | |
1983 | - }, | |
1984 | - | |
1985 | - //--------------------提交订单----------------------- | |
1986 | - async submitForm(t){ | |
1987 | - var sub_value = t; | |
1988 | - | |
1989 | - if (this.data.is_summit_ing == 1) return false; //--提交中退出-- | |
1990 | - this.data.is_summit_ing = 1; | |
1991 | - var th = this, pdata = new Array(); | |
1992 | - var ff = true; | |
1993 | - //------------立即购买------------- | |
1994 | - if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | |
1995 | - | |
1996 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { | |
1997 | - ff = false; | |
1998 | - getApp().my_warnning("请选择收货地址", 0, th); | |
1999 | - th.data.is_summit_ing = 0; | |
2000 | - } | |
2001 | - if (!ff) return false; | |
2002 | - var addr = th.data.user_addr; | |
2003 | - if (th.data.bn_exp_type == 1) addr = null; | |
2004 | - | |
2005 | - if (th.data.bn_exp_type == 0) | |
2006 | - if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { | |
2007 | - getApp().my_warnning("读取物流失败", 0, th); | |
2008 | - th.data.is_summit_ing = 0; | |
2009 | - return false; | |
2010 | - } | |
2011 | - | |
2012 | - var item = { | |
2013 | - 'user_id': to.globalData.user_id, | |
2014 | - 'consignee': addr == null ? "" : addr.consignee, | |
2015 | - 'province': addr == null ? 0 : addr.province, | |
2016 | - 'city': addr == null ? 0 : addr.city, | |
2017 | - 'district': addr == null ? 0 : addr.district, | |
2018 | - 'twon': addr == null ? 0 : addr.twon, | |
2019 | - 'address': addr == null ? "" : addr.address, | |
2020 | - 'more_address': addr == null ? "" : addr.more_address, | |
2021 | - //'mobile': th.data.userinfo.mobile, | |
2022 | - 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile, | |
2023 | - 'email': '', | |
2024 | - 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code, | |
2025 | - 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name, | |
2026 | - 'invoice_title': '', | |
2027 | - 'goods_price': th.data.formData.all_price, //商品总价 | |
2028 | - 'shipping_price': th.data.formData.shipping_price, //物流金额 | |
2029 | - 'user_money': th.data.formData.user_money, //使用余额 | |
2030 | - 'total_amount': th.data.formData.total_amount, //订单总价 | |
2031 | - 'order_amount': th.data.formData.order_amount, //应付 | |
2032 | - 'user_note': t.detail.value.user_note, //用户备注 | |
2033 | - 'store_id': oo.stoid, //商家 | |
2034 | - 'pickup_id': th.data.bn_pick, //门店 | |
2035 | - 'exp_type': th.data.bn_exp_type, //配送方式 | |
2036 | - 'order_goods': new Array(), | |
2037 | - }; | |
2038 | - //是不是重新提交 | |
2039 | - if (th.data.is_continue == 1) item.is_continue = 1; | |
2040 | - | |
2041 | - //获取立即购买的商品的信息 | |
2042 | - var gg = to.get_b_now(); | |
2043 | - //--商品的房间号-- | |
2044 | - if (gg.room_id && gg.room_id > 0) { | |
2045 | - item.room_ids = gg.room_id; | |
2046 | - } | |
2047 | - | |
2048 | - var order_prom_list = {}; | |
2049 | - //--判断有没有优惠活动-- | |
2050 | - if (th.data.order_prom[item.pickup_id]) { | |
2051 | - if (th.data.formData.order_prom_amount > 0) { | |
2052 | - order_prom_list.order_prom_id = th.data.formData.order_prom_id; | |
2053 | - order_prom_list.order_prom_amount = th.data.formData.order_prom_amount; | |
2054 | - } | |
2055 | - } | |
2056 | - | |
2057 | - //--判断优惠活动的提交-- | |
2058 | - if (th.data.formData.cut_price > 0 ) { | |
2059 | - order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); | |
2060 | - var ob = [{ | |
2061 | - "prom_id": th.data.bn_goods.prom_id, | |
2062 | - "dis": parseFloat(th.data.formData.cut_price).toFixed(2), | |
2063 | - "ispt": 0 | |
2064 | - }] | |
2065 | - order_prom_list.prom_pt_json = JSON.stringify(ob); | |
2066 | - } | |
2067 | - if (th.data.formData.give_integral > 0) { | |
2068 | - order_prom_list.give_integral = th.data.formData.give_integral; | |
2069 | - } | |
2070 | - if (th.data.formData.give_coupon_id > 0) { | |
2071 | - order_prom_list.give_coupon_id = th.data.formData.give_coupon_id; | |
2072 | - order_prom_list.g_coupon_num = th.data.formData.g_coupon_num; | |
2073 | - } | |
2074 | - if (th.data.formData.give_lb_id > 0) { | |
2075 | - order_prom_list.give_lb_id = th.data.formData.give_lb_id; | |
2076 | - order_prom_list.g_lb_num = th.data.formData.g_lb_num; | |
2077 | - } | |
2078 | - item.order_prom_list = order_prom_list; | |
2079 | - | |
2080 | - //组装优惠券的钱 | |
2081 | - if (parseFloat(th.data.formData.coupon_price) > 0) { | |
2082 | - item.coupon_price = th.data.formData.coupon_price; | |
2083 | - item.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | |
2084 | - } | |
2085 | - if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].coupon_no && th.data.using_quan[th.data.bn_pick].isby) { | |
2086 | - item.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | |
2087 | - item.coupon_price = 0; | |
2088 | - } | |
2089 | - | |
2090 | - //老会员成为分销下线需要的参数 | |
2091 | - if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { | |
2092 | - //判断一下分享人是不是分享商 | |
2093 | - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => { | |
2094 | - if (res.data.code == 0) { | |
2095 | - var user = res.data.data; | |
2096 | - if (user.is_distribut == 1) { | |
2097 | - item.first_leader = parseInt(getApp().globalData.first_leader); | |
2098 | - } | |
2099 | - } | |
2100 | - }) | |
2101 | - } | |
2102 | - | |
2103 | - var goods = { | |
2104 | - 'goods_id': gg.goods_id, | |
2105 | - 'goods_name': gg.goods_name, | |
2106 | - 'goods_sn': gg.goods_sn, | |
2107 | - 'goods_num': gg.goods_num, | |
2108 | - 'market_price': th.data.bn_goods.market_price, | |
2109 | - 'goods_price': th.data.bn_goods.shop_price, | |
2110 | - 'member_goods_price': th.data.bn_goods.shop_price, | |
2111 | - 'store_id': oo.stoid, | |
2112 | - 'prom_type': th.data.bn_goods.prom_type, //促销活动类型 | |
2113 | - 'prom_id': th.data.bn_goods.prom_id, //促销活动id | |
2114 | - }; | |
2115 | - | |
2116 | - //-- 把导购的信息填入-- | |
2117 | - if (gg.guide_id) { | |
2118 | - goods.guide_id = gg.guide_id; | |
2119 | - goods.guide_type = gg.guide_type; | |
2120 | - //调用接口判断是不是会员 | |
2121 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { | |
2122 | - if (res.data.code == 0) { | |
2123 | - goods.guide_name = res.data.data.salesman; | |
2124 | - goods.guide_sn = res.data.data.salesman_no; | |
2125 | - } | |
2126 | - }) | |
2127 | - } | |
2128 | - | |
2129 | - //--商品的房间号-- | |
2130 | - if (gg.room_id && gg.room_id > 0) { | |
2131 | - goods.room_id = gg.room_id; | |
2132 | - } | |
2133 | - | |
2134 | - //积分购,先要带is_integral_normal=1 | |
2135 | - if (gg.is_integral_normal) goods.is_integral_normal = 1; | |
2136 | - | |
2137 | - //先要带is_pd_normal=1 | |
2138 | - if (gg.is_pd_normal) goods.is_pd_normal = 1; | |
2139 | - | |
2140 | - //如果不立即购买或者秒杀,如果是线下库存购买的时候 | |
2141 | - if (goods.prom_type != 1 && goods.prom_type != 6 && th.data.sales_rules == 2) { | |
2142 | - var isok = 1; | |
2143 | - await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { | |
2144 | - isok = res; | |
2145 | - }); | |
2146 | - if (!isok) { | |
2147 | - getApp().confirmBox("商品的门店库存不足"); | |
2148 | - th.data.is_summit_ing = 0; | |
2149 | - return false; | |
2150 | - } | |
2151 | - } | |
2152 | - | |
2153 | - //-- 如果有线下取价的话 -- | |
2154 | - if (th.data.bn_goods.is_offline) { | |
2155 | - item.sum_offline_cut = (th.data.bn_goods.shop_price - th.data.bn_goods.offline_price).toFixed(2); | |
2156 | - goods.offline_cut = item.sum_offline_cut; | |
2157 | - goods.pricing_type = th.data.bn_goods.pricing_type; | |
2158 | - goods.goods_price = th.data.bn_goods.offline_price; | |
2159 | - goods.member_goods_price = th.data.bn_goods.offline_price; | |
2160 | - } | |
2161 | - | |
2162 | - //--- 如果有优惠促销的金额,要把金额先平摊下去 --- | |
2163 | - if (th.data.formData.cut_price > 0 && !th.data.ispt_goods) { | |
2164 | - var g_arr = new Array(); | |
2165 | - g_arr.push(goods); | |
2166 | - var pt_data = { | |
2167 | - 'prom_id': goods.prom_id, | |
2168 | - 'dis': parseFloat(th.data.formData.cut_price), | |
2169 | - 'goods': g_arr, | |
2170 | - } | |
2171 | - | |
2172 | - var pt_res = null; | |
2173 | - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { | |
2174 | - is_json: 1, | |
2175 | - data: pt_data | |
2176 | - }).then(res => { | |
2177 | - if (res.data.code == 0) { | |
2178 | - pt_res = res.data.data; | |
2179 | - } | |
2180 | - }) | |
2181 | - if (pt_res) { | |
2182 | - //平摊赋值 | |
2183 | - goods.account = pt_res[0].fisrt_account; | |
2184 | - goods.account_yu = pt_res[0].fisrt_account_yu; | |
2185 | - item.is_discount_amount = 1; | |
2186 | - } | |
2187 | - } | |
2188 | - | |
2189 | - //--组装优惠券的钱-- | |
2190 | - if (th.data.formData.coupon_price) { | |
2191 | - item.coupon_price = th.data.formData.coupon_price; | |
2192 | - item.coupon_no = th.data.using_quan[th.data.bn_pick].coupon_no; | |
2193 | - goods.quan_num = th.data.formData.coupon_price; | |
2194 | - goods.quan_no = item.coupon_no; | |
2195 | - } | |
2196 | - | |
2197 | - item.order_goods.push(goods); | |
2198 | - | |
2199 | - //--如果有赠品的时候,赠品也要提交--- | |
2200 | - if (th.data.buy_now_gift_goods) { | |
2201 | - var gift_gg = th.data.buy_now_gift_goods; | |
2202 | - var g_goods = { | |
2203 | - 'goods_id': gift_gg.goods_id, | |
2204 | - 'goods_name': gift_gg.goods_name, | |
2205 | - 'goods_sn': gift_gg.goods_sn, | |
2206 | - 'goods_num': gift_gg.buynum, | |
2207 | - 'market_price': gift_gg.market_price, | |
2208 | - 'goods_price': 0, | |
2209 | - 'member_goods_price': 0, | |
2210 | - 'store_id': oo.stoid, | |
2211 | - 'is_gift': 1, | |
2212 | - 'gift_id': gift_gg.gift_id, | |
2213 | - 'prom_id': gift_gg.prom_id, | |
2214 | - }; | |
2215 | - item.order_goods.push(g_goods); | |
2216 | - } | |
2217 | - pdata.push(item); | |
2218 | - | |
2219 | - console.log(pdata); | |
2220 | - } else { | |
2221 | - //---------购物车的结算--------- | |
2222 | - if (th.data.is_all_zt == 0 && th.data.user_addr == null) { | |
2223 | - th.data.is_summit_ing = 0; | |
2224 | - ff = false; | |
2225 | - getApp().confirmBox("请新建收货地址"); | |
2226 | - } | |
2227 | - if (!ff) return false; | |
2228 | - | |
2229 | - var addr = th.data.user_addr; | |
2230 | - if (th.data.is_all_zt == 1) addr = null; | |
2231 | - var val_arr = t.detail.value; | |
2232 | - | |
2233 | - | |
2234 | - if (th.data.is_all_zt != 1) | |
2235 | - if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { | |
2236 | - th.data.is_summit_ing = 0; | |
2237 | - getApp().confirmBox("读取物流失败"); | |
2238 | - return false; | |
2239 | - } | |
2240 | - | |
2241 | - var order_prom_list_cart = th.data.order_prom_list_cart; | |
2242 | - | |
2243 | - //--组装推送数据-- | |
2244 | - for (var i = 0; i < order_prom_list_cart.length; i++) { | |
2245 | - var t_item = order_prom_list_cart[i]; | |
2246 | - var item = { | |
2247 | - 'user_id': to.globalData.user_id, | |
2248 | - 'consignee': addr == null ? th.data.userinfo.mobile : addr.consignee, | |
2249 | - 'province': addr == null ? 0 : addr.province, | |
2250 | - 'city': addr == null ? 0 : addr.city, | |
2251 | - 'district': addr == null ? 0 : addr.district, | |
2252 | - 'twon': addr == null ? 0 : addr.twon, | |
2253 | - 'address': addr == null ? "" : addr.address, | |
2254 | - 'more_address': addr == null ? "" : addr.more_address, | |
2255 | - 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile, | |
2256 | - 'email': '', | |
2257 | - 'shipping_code': th.data.is_all_zt == 1 ? 0 : th.data.wu_arr[t_item.wind].code, | |
2258 | - 'shipping_name': th.data.is_all_zt == 1 ? '' : th.data.wu_arr[t_item.wind].name, | |
2259 | - 'invoice_title': '', | |
2260 | - 'goods_price': t_item.goods_price, //商品总价 | |
2261 | - 'shipping_price': t_item.shipping_price, //物流金额 | |
2262 | - 'user_money': t_item.user_money, //使用余额 | |
2263 | - 'total_amount': t_item.total_amount, //订单总价 | |
2264 | - 'order_amount': t_item.order_amount, //应付 | |
2265 | - 'user_note': val_arr['user_note_' + t_item.pickup_id], //用户备注 | |
2266 | - 'store_id': oo.stoid, //商家 | |
2267 | - 'pickup_id': t_item.pickup_id, //门店 | |
2268 | - 'exp_type': t_item.exp_type, //配送方式 | |
2269 | - 'order_goods': new Array(), | |
2270 | - }; | |
2271 | - //是不是重新提交 | |
2272 | - if (th.data.is_continue == 1) item.is_continue = 1; | |
2273 | - //----- 如果有线下取价的话 ---- | |
2274 | - if (t_item.is_offline == 1) { | |
2275 | - item.sum_offline_cut = t_item.offline_price.toFixed(2); | |
2276 | - } | |
2277 | - | |
2278 | - //组装优惠券的钱 | |
2279 | - if (t_item.coupon_price) { | |
2280 | - item.coupon_price = t_item.coupon_price; | |
2281 | - item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no; | |
2282 | - } else if (t_item.quan_no) { | |
2283 | - item.coupon_no = t_item.quan_no; | |
2284 | - item.coupon_price = 0; | |
2285 | - } | |
2286 | - | |
2287 | - var order_prom_list = {}; | |
2288 | - //--判断有没有优惠活动-- | |
2289 | - if (t_item.order_prom_amount > 0) { | |
2290 | - order_prom_list.order_prom_id = t_item.order_prom_id; | |
2291 | - order_prom_list.order_prom_amount = t_item.order_prom_amount; | |
2292 | - } | |
2293 | - | |
2294 | - order_prom_list.discount_amount =0; | |
2295 | - //--判断优惠活动的提交-- | |
2296 | - if (t_item.cut_price > 0) { | |
2297 | - order_prom_list.discount_amount += t_item.cut_price; | |
2298 | - order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); | |
2299 | - } | |
2300 | - //--判断组合优惠活动的提交-- | |
2301 | - if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { | |
2302 | - order_prom_list.discount_amount += t_item.zh_cut_price; | |
2303 | - order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); | |
2304 | - } | |
2305 | - if (t_item.s_intValue > 0) { | |
2306 | - order_prom_list.give_integral = t_item.s_intValue; | |
2307 | - } | |
2308 | - if (t_item.s_coupon_id) { | |
2309 | - order_prom_list.give_coupon_id = t_item.s_coupon_id; | |
2310 | - order_prom_list.g_coupon_num = JSON.stringify(t_item.g_coupon_num); | |
2311 | - } | |
2312 | - if (t_item.s_libao) { | |
2313 | - order_prom_list.give_lb_id = t_item.s_libao; | |
2314 | - order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); | |
2315 | - } | |
2316 | - if (Object.keys(order_prom_list).length > 0){ | |
2317 | - if(order_prom_list.discount_amount) | |
2318 | - order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2); | |
2319 | - if(order_prom_list.order_prom_amount) | |
2320 | - order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); | |
2321 | - item.order_prom_list = order_prom_list; | |
2322 | - } | |
2323 | - | |
2324 | - | |
2325 | - //老会员成为分销下线需要的参数 | |
2326 | - if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { | |
2327 | - //判断一下分享人是不是分享商 | |
2328 | - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => { | |
2329 | - if (res.data.code == 0) { | |
2330 | - var user = res.data.data; | |
2331 | - if (user.is_distribut == 1) { | |
2332 | - item.first_leader = parseInt(getApp().globalData.first_leader); | |
2333 | - } | |
2334 | - } | |
2335 | - }) | |
2336 | - } | |
2337 | - | |
2338 | - | |
2339 | - //房间号的ids | |
2340 | - var room_ids = ""; | |
2341 | - //-------------让商品添加到商品列表-------------------- | |
2342 | - for (var k = 0; k < t_item.goods.length; k++) { | |
2343 | - var g_item = t_item.goods[k]; | |
2344 | - var goods = { | |
2345 | - 'goods_id': g_item.goods_id, | |
2346 | - 'goods_name': g_item.goods_name, | |
2347 | - 'goods_sn': g_item.goods_sn, | |
2348 | - 'goods_num': g_item.goods_num, | |
2349 | - 'market_price': g_item.market_price, | |
2350 | - 'goods_price': g_item.goods_price, | |
2351 | - 'member_goods_price': g_item.goods_price, | |
2352 | - 'store_id': oo.stoid, | |
2353 | - }; | |
2354 | - | |
2355 | - //-- 线下取价也要写入,组合购的商品不能去线下价格 -- | |
2356 | - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type!=7) { | |
2357 | - goods.goods_price = g_item.offline_price; | |
2358 | - goods.member_goods_price = g_item.offline_price; | |
2359 | - goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); | |
2360 | - goods.pricing_type = g_item.pricing_type; | |
2361 | - } | |
2362 | - | |
2363 | - //--把券的钱,写入从表--- | |
2364 | - if (t_item.quan_youhui_list && t_item.coupon_price) { | |
2365 | - for (var kk in t_item.quan_youhui_list) { | |
2366 | - var you_item = t_item.quan_youhui_list[kk]; | |
2367 | - if (g_item.prom_type!=7 && g_item.erpwareid == you_item.WareId) { | |
2368 | - goods.quan_num = you_item.WareCashSum; | |
2369 | - goods.quan_no = you_item.CashRepNo; | |
2370 | - } | |
2371 | - } | |
2372 | - } | |
2373 | - | |
2374 | - //--判断活动的类型-- | |
2375 | - switch (g_item.prom_type) { | |
2376 | - case 1: | |
2377 | - goods.prom_type = g_item.prom_type; | |
2378 | - goods.prom_id = g_item.prom_id; | |
2379 | - break; | |
2380 | - case 3: | |
2381 | - goods.prom_type = 3; | |
2382 | - goods.prom_id = g_item.prom_id; | |
2383 | - if (g_item.is_gift) { | |
2384 | - goods.is_gift = g_item.is_gift; | |
2385 | - goods.gift_id = g_item.gift_id; | |
2386 | - } | |
2387 | - break; | |
2388 | - case 5: | |
2389 | - goods.prom_type = 5; | |
2390 | - goods.prom_id = g_item.prom_id; | |
2391 | - if (g_item.is_collocation) { | |
2392 | - goods.is_collocation = g_item.is_collocation; | |
2393 | - } | |
2394 | - break | |
2395 | - case 7: | |
2396 | - goods.prom_type = 7; | |
2397 | - goods.prom_id = g_item.prom_id; | |
2398 | - break | |
2399 | - default: | |
2400 | - goods.prom_type = 0; | |
2401 | - goods.prom_id = 0; | |
2402 | - } | |
2403 | - | |
2404 | - //如果不立即购买或者秒杀,如果是线下库存购买的时候 | |
2405 | - if (goods.prom_type == 0 && th.data.sales_rules == 2) { | |
2406 | - var isok = 1; | |
2407 | - await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { | |
2408 | - isok = res; | |
2409 | - }); | |
2410 | - if (!isok) { | |
2411 | - getApp().confirmBox(goods.goods_name + "的门店库存不足"); | |
2412 | - th.data.is_summit_ing = 0; | |
2413 | - return false; | |
2414 | - } | |
2415 | - } | |
2416 | - | |
2417 | - //把优惠的平摊结果写进去 | |
2418 | - if (g_item.account >= 0 || g_item.account_yu != 0) { | |
2419 | - if (g_item.account >= 0) goods.account = g_item.account; | |
2420 | - if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; | |
2421 | - item.is_discount_amount = 1; | |
2422 | - } | |
2423 | - | |
2424 | - //导购ID | |
2425 | - if (g_item.guide_id) { | |
2426 | - goods.guide_id = g_item.guide_id; | |
2427 | - goods.guide_type = g_item.guide_type; | |
2428 | - //调用接口判断是不是会员 | |
2429 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { | |
2430 | - if (res.data.code == 0) { | |
2431 | - goods.guide_name = res.data.data.salesman; | |
2432 | - goods.guide_sn = res.data.data.salesman_no; | |
2433 | - } | |
2434 | - }) | |
2435 | - } | |
2436 | - //如果房间号不为空的时候 | |
2437 | - if (g_item.room_id) { | |
2438 | - goods.room_id = g_item.room_id; | |
2439 | - room_ids += g_item.room_id + ","; | |
2440 | - } | |
2441 | - item.order_goods.push(goods); | |
2442 | - } | |
2443 | - | |
2444 | - //如果房间号不为空的时候 | |
2445 | - if (room_ids != "") item.room_ids = ut.sub_last(room_ids); | |
2446 | - pdata.push(item); | |
2447 | - } | |
2448 | - | |
2449 | - | |
2450 | - } | |
2451 | - | |
2452 | - if (pdata.length == 0) return; | |
2453 | - var str = JSON.stringify(pdata); | |
2454 | - | |
2455 | - wx.showLoading({title: "加载中"}); | |
2456 | - wx.request({ | |
2457 | - url: oo.url + '/api/weshop/order/createWxdOrder', | |
2458 | - data: str, | |
2459 | - method: 'POST', | |
2460 | - header: { | |
2461 | - 'content-type': 'application/json' | |
2462 | - },// 设置请求的 header | |
2463 | - success: function (res) { | |
2464 | - | |
2465 | - | |
2466 | - wx.hideLoading(); | |
2467 | - if (res.statusCode == 200) { | |
2468 | - var data = res.data; | |
2469 | - if (data.code == 0) { | |
2470 | - console.log(th.data.is_b_now); | |
2471 | - //如果是购物车结算,还要删除购物车 | |
2472 | - if (th.data.is_b_now == 0) { | |
2473 | - console.log(th.data.cartlist_y); | |
2474 | - var list = th.data.cartlist_y; | |
2475 | - for (var i = 0; i < list.length; i++) { | |
2476 | - //删除购物车 | |
2477 | - a.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {}); | |
2478 | - } | |
2479 | - } | |
2480 | - var order_amount = 0; | |
2481 | - pdata.forEach(function (em, ind) { | |
2482 | - order_amount += em.order_amount; | |
2483 | - }) | |
2484 | - //要进行判断,如果是用微信支付,就要跳转到支付界面 | |
2485 | - if (order_amount > 0) { | |
2486 | - th.setData({isclose: 0}); | |
2487 | - //void e.jumpToCart4({ | |
2488 | - // order_sn: data.data, | |
2489 | - //}, 1); | |
2490 | - util_pay.pay(data.data, function () { | |
2491 | - //app.my_warnning("支付成功",1,th); | |
2492 | - //setTimeout(function () { | |
2493 | - wx.redirectTo({ | |
2494 | - url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data | |
2495 | - }) | |
2496 | - //},1000) | |
2497 | - | |
2498 | - }, function () { | |
2499 | - //支付失败 | |
2500 | - setTimeout(function () { | |
2501 | - var cps=getCurrentPages(); | |
2502 | - if(cps.length>1){ | |
2503 | - wx.navigateBack({delta: 1}) | |
2504 | - }else{ | |
2505 | - getApp().goto("/pages/index/index/index"); | |
2506 | - } | |
2507 | - | |
2508 | - }, 1000) | |
2509 | - }, oo.stoid); | |
2510 | - | |
2511 | - } else { | |
2512 | - var dd = { | |
2513 | - parent_sn: data.data, | |
2514 | - store_id: oo.stoid, | |
2515 | - type: 2, | |
2516 | - }; | |
2517 | - a.post("/api/weshop/order/pay/createOrder", { | |
2518 | - data: dd, | |
2519 | - success: function (t) { | |
2520 | - //console.log(t); | |
2521 | - if (t.data.code == 0) { | |
2522 | - //app.my_warnning("支付成功",1,th); | |
2523 | - //setTimeout(function () { | |
2524 | - th.setData({isclose: 0}); | |
2525 | - wx.redirectTo({ | |
2526 | - url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, | |
2527 | - }) | |
2528 | - //}, 1000) | |
2529 | - } | |
2530 | - }, | |
2531 | - fail: function () { | |
2532 | - | |
2533 | - } | |
2534 | - }); | |
2535 | - } | |
2536 | - | |
2537 | - } | |
2538 | - else { | |
2539 | - //--内容换行-- | |
2540 | - var msg = data.msg; | |
2541 | - //赠品活动已经取消,无法赠送,是否继续买单? | |
2542 | - if (msg.indexOf("是否继续买单") > 0) { | |
2543 | - wx.showModal({ | |
2544 | - title: "提示", | |
2545 | - content: data.msg, | |
2546 | - cancelText: '取消', | |
2547 | - confirmText: '确定', | |
2548 | - showCancel: true, | |
2549 | - success(res){ | |
2550 | - if (res.cancel) { | |
2551 | - return; | |
2552 | - } else if (res.confirm) { | |
2553 | - th.data.is_continue = 1; | |
2554 | - th.data.is_summit_ing = 0; //是否提交中 | |
2555 | - th.submitForm(sub_value); | |
2556 | - } | |
2557 | - } | |
2558 | - }) | |
2559 | - return; | |
2560 | - } | |
2561 | - if (msg.length > 13) { | |
2562 | - msg = msg.slice(0, 13) + "\r\n" + msg.slice(13); | |
2563 | - } | |
2564 | - getApp().confirmBox(msg); | |
2565 | - th.data.is_summit_ing = 0; //是否提交中 | |
2566 | - } | |
2567 | - } else { | |
2568 | - th.data.is_summit_ing = 0; //是否提交中 | |
2569 | - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); | |
785 | + if (!is_other_is_use) num++; | |
2570 | 786 | } |
2571 | - }, | |
2572 | - fail: function () { | |
2573 | - th.data.is_summit_ing = 0; | |
2574 | - wx.hideLoading(); | |
2575 | - console.log("index.js wx.request CheckCallUser fail"); | |
2576 | - }, | |
2577 | - complete: function () { | |
2578 | - } | |
2579 | - }) | |
2580 | - | |
2581 | - }, | |
2582 | - //---确认线下门店的数量足不足--- | |
2583 | - async check_store_num(goods_id, pick, goods_num, func){ | |
2584 | - var lock = 0, pick_no, plist, erpwareid; | |
2585 | - //先读取门店的lock | |
2586 | - await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | |
2587 | - data: {store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000} | |
2588 | - }).then(res => { | |
2589 | - if (res.data.code == 0 && res.data.data.total > 0) { | |
2590 | - for (var i in res.data.data.pageData) | |
2591 | - lock += res.data.data.pageData[i].outQty; | |
2592 | - } | |
2593 | - }) | |
2594 | - //先获取门店的编号 | |
2595 | - await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { | |
2596 | - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} | |
2597 | - }).then(res => { | |
2598 | - if (res.data.code == 0) { | |
2599 | - pick_no = res.data.data.pickup_no; | |
2600 | - } | |
2601 | - }) | |
2602 | - //先获取商品的线下库存 | |
2603 | - await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { | |
2604 | - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} | |
2605 | - }).then(res => { | |
2606 | - if (res.data.code == 0) { | |
2607 | - erpwareid = res.data.data.erpwareid; | |
2608 | 787 | } |
2609 | - }) | |
2610 | - //读取线下的门店库存 | |
2611 | - await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | |
2612 | - data: {storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000} | |
2613 | - }).then(res => { | |
2614 | - if (res.data.code == 0) { | |
2615 | - plist = res.data.data.pageData[0]; | |
788 | + //-- 包邮券 -- | |
789 | + var by_quan = th.data.get_by_quan_list_cart[pkid]; | |
790 | + if (by_quan) { | |
791 | + for (var iter2 in by_quan) { | |
792 | + //判断是不是其他订单有选用 | |
793 | + var is_other_is_use = th.check_other_use_by(by_quan[iter2], pkid); | |
794 | + if (!is_other_is_use) num++; | |
795 | + } | |
2616 | 796 | } |
2617 | - }) | |
2618 | - var isok = 1; | |
2619 | - if (goods_num > plist.CanOutQty - lock) { | |
2620 | - isok = 0; | |
797 | + var set_txt = "cartlist[" + iter + "].can_num"; | |
798 | + th.setData({[set_txt]: num}); | |
2621 | 799 | } |
2622 | - func(isok); | |
2623 | 800 | }, |
2624 | - | |
2625 | 801 | useCoupon: function () { |
2626 | 802 | if (this.data.order.couponNum <= 0) { |
2627 | 803 | getApp().my_warnning("无可用优惠券", 0, this); |
... | ... | @@ -2643,57 +819,6 @@ Page({ |
2643 | 819 | }); |
2644 | 820 | }, |
2645 | 821 | |
2646 | - //--------购物车购买时,选择自提和物流----------- | |
2647 | - setexptype_w: function (t) { | |
2648 | - | |
2649 | - var def_exp_code = getApp().globalData.userInfo.def_exp_code, th = this; | |
2650 | - var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, | |
2651 | - wl_txt = t.currentTarget.dataset.wl_txt, | |
2652 | - ont = t.currentTarget.dataset.ont; | |
2653 | - | |
2654 | - th.setData({[txt]: ty}); | |
2655 | - var iszt = 1; | |
2656 | - | |
2657 | - if (ty == 0) { | |
2658 | - th.setData({is_all_zt: 0}); | |
2659 | - } else { | |
2660 | - for (var i = 0; i < th.data.cartlist.length; i++) { | |
2661 | - var item = th.data.cartlist[i]; | |
2662 | - if (item.exp_type == 0) { | |
2663 | - iszt = 0; | |
2664 | - break; | |
2665 | - } | |
2666 | - } | |
2667 | - | |
2668 | - th.setData({is_all_zt: iszt}); | |
2669 | - | |
2670 | - var ind = t.currentTarget.dataset.ind; | |
2671 | - var c_item = th.data.cartlist[ind]; | |
2672 | - var pickid = c_item.pickup_id; | |
2673 | - | |
2674 | - if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) { | |
2675 | - th.data.using_quan[pickid] = {}; | |
2676 | - th.setData({using_quan: th.data.using_quan}); | |
2677 | - } | |
2678 | - | |
2679 | - | |
2680 | - } | |
2681 | - //判断有没有默认的物流地址值 | |
2682 | - if (def_exp_code != "" && def_exp_code != null && def_exp_code != undefined) { | |
2683 | - var wu_arr = this.data.wu_arr; | |
2684 | - if (wu_arr != null && wu_arr != "") { | |
2685 | - for (var i = 0; i < wu_arr.length; i++) { | |
2686 | - if (wu_arr[i].shipping_code == def_exp_code) { | |
2687 | - var set_txt = "cartlist" | |
2688 | - th.setData({wl_txt: i}); | |
2689 | - } | |
2690 | - } | |
2691 | - } | |
2692 | - } | |
2693 | - //----计算此时购物车的价格---- | |
2694 | - th.calculatePrice(); | |
2695 | - }, | |
2696 | - | |
2697 | 822 | //--------立即购买时,选择自提和物流---------- |
2698 | 823 | setexptype: function (t) { |
2699 | 824 | var th = this; |
... | ... | @@ -2712,7 +837,7 @@ Page({ |
2712 | 837 | //--自提就要把包邮券清理掉-- |
2713 | 838 | if (ty == 1) { |
2714 | 839 | th.data.isget_by_quan = {}; |
2715 | - if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { | |
840 | + if (th.data.using_quan[bn_pick] && th.data.using_quan[bn_pick].isby == 1) { | |
2716 | 841 | th.setData({using_quan: {}}); |
2717 | 842 | } |
2718 | 843 | } |
... | ... | @@ -2738,11 +863,6 @@ Page({ |
2738 | 863 | th.setData({bn_use_money: !th.data.bn_use_money}); |
2739 | 864 | th.calculatePrice2(); |
2740 | 865 | }, |
2741 | - set_js_useyuer: function () { | |
2742 | - var th = this; | |
2743 | - th.setData({js_use_money: !th.data.js_use_money}); | |
2744 | - th.calculatePrice(); | |
2745 | - }, | |
2746 | 866 | //-------------------计算物流--------------- |
2747 | 867 | calculatewuliu: function (code, o_shipping_price, goods_weight, |
2748 | 868 | goods_piece, user_addr, freight_free, o_price, rs) { |
... | ... | @@ -2815,13 +935,6 @@ Page({ |
2815 | 935 | this.setData({index: ind}); |
2816 | 936 | this.calculatePrice2(); |
2817 | 937 | }, |
2818 | - //----------购物车结算,选择物流------------- | |
2819 | - bindPickerChange_w: function (e) { | |
2820 | - var ind = e.detail.value, txt = e.currentTarget.dataset.txt; | |
2821 | - this.setData({[txt]: ind}); | |
2822 | - this.calculatePrice(); | |
2823 | - }, | |
2824 | - | |
2825 | 938 | /*----券的所有操作----*/ |
2826 | 939 | open_coupon_list: function (e) { |
2827 | 940 | var th = this; |
... | ... | @@ -2863,7 +976,6 @@ Page({ |
2863 | 976 | th.setData({by_quan_list_cart: null}); |
2864 | 977 | } |
2865 | 978 | |
2866 | - console.log("2222222券的列表", quanlist); | |
2867 | 979 | th.setData({ |
2868 | 980 | sele_cart_ind: cindx, |
2869 | 981 | sele_exp_type: exp_type, |
... | ... | @@ -2896,51 +1008,10 @@ Page({ |
2896 | 1008 | |
2897 | 1009 | /*--点击选择券--*/ |
2898 | 1010 | sele_quan_item: function (e) { |
2899 | - | |
1011 | + var th = this; | |
2900 | 1012 | var ind = e.currentTarget.dataset.ind; |
2901 | 1013 | var quan_item = this.data.selected_quan_list[ind]; |
2902 | - var pickid = this.data.selected_quan_pick; //现在选择的是哪一个门店 | |
2903 | - //--如果券是单品使用的时候-- | |
2904 | - if (quan_item && quan_item.UseObjectType && quan_item.UseObjectType == "20") { | |
2905 | - //---只有多件购买的时候才要计算,//购物车购买和搭配勾的时候--- | |
2906 | - var gg = getApp().get_b_now(); | |
2907 | - if (this.data.is_b_now == 0 || gg.prom_type == 5) { | |
2908 | - var arr = this.data.order_prom_list_cart; | |
2909 | - var t_pk_item = null; | |
2910 | - for (var ii in arr) { | |
2911 | - var ep = arr[ii]; | |
2912 | - if (pickid == ep.pickup_id) { | |
2913 | - t_pk_item = ep; | |
2914 | - break; | |
2915 | - } | |
2916 | - } | |
2917 | - //--寻找券指定的商品-- | |
2918 | - var gd = null; | |
2919 | - if (t_pk_item) { | |
2920 | - var goods = t_pk_item.goods; | |
2921 | - for (var gid in goods) { | |
2922 | - if (quan_item.UseObjectID == goods[gid].erpwareid) { | |
2923 | - gd = goods[gid]; | |
2924 | - } | |
2925 | - } | |
2926 | - } | |
2927 | - if (!gd) { | |
2928 | - getApp().my_warnning("未找到指定商品使用", 0, this, 600); | |
2929 | - return false; | |
2930 | - } | |
2931 | - //计算价格,如果有平摊的实收要计算实收的金额 | |
2932 | - var item_price = gd.goods_price * gd.goods_num; | |
2933 | - //-- 如果有平摊下去,有实收价格的时候,就要用account_fir来计算价格 -- | |
2934 | - if (gd.account_fir != null && gd.account_fir != undefined) { | |
2935 | - item_price = gd.account_fir * gd.goods_num; | |
2936 | - } | |
2937 | - | |
2938 | - if (item_price < parseFloat(quan_item.BuySum)) { | |
2939 | - getApp().my_warnning("该单品金额没有大于等于" + quan_item.BuySum + "元时不能使用优惠券", 0, this, 600); | |
2940 | - return false; | |
2941 | - } | |
2942 | - } | |
2943 | - } | |
1014 | + var pickid = this.data.pickup.pickup_id; //现在选择的是哪一个门店 | |
2944 | 1015 | |
2945 | 1016 | var no_use = e.currentTarget.dataset.no, quanlist = this.data.selected_quan_list; |
2946 | 1017 | //---所有的券的显示红色选择都清理一遍--- |
... | ... | @@ -2967,15 +1038,14 @@ Page({ |
2967 | 1038 | } |
2968 | 1039 | |
2969 | 1040 | var using_quan = this.data.using_quan; |
2970 | - var th = this; | |
1041 | + | |
2971 | 1042 | //---如果是不使用优惠券--- |
2972 | 1043 | if (no_use == 1) { |
2973 | - console.log("有进来吗券", no_use); | |
2974 | - if (using_quan[th.data.selected_quan_pick]) { | |
2975 | - using_quan[th.data.selected_quan_pick].is_nouse_red = 1; | |
1044 | + if (using_quan[pickid]) { | |
1045 | + using_quan[pickid].is_nouse_red = 1; | |
2976 | 1046 | } |
2977 | 1047 | else { |
2978 | - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; | |
1048 | + using_quan[pickid] = {is_nouse_red: 1}; | |
2979 | 1049 | } |
2980 | 1050 | this.setData({using_quan: using_quan, is_coupon: 2222}); |
2981 | 1051 | return; |
... | ... | @@ -2990,17 +1060,15 @@ Page({ |
2990 | 1060 | } |
2991 | 1061 | this.setData(obj); |
2992 | 1062 | console.log(this.data.selected_quan_list, "选中的券的下标", quan_item, "数据都在这里", txt); |
2993 | - if (using_quan[th.data.selected_quan_pick]) { | |
2994 | - using_quan[th.data.selected_quan_pick].is_nouse_red = 0; | |
1063 | + if (using_quan[pickid]) { | |
1064 | + using_quan[pickid].is_nouse_red = 0; | |
2995 | 1065 | } |
2996 | 1066 | else { |
2997 | - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; | |
1067 | + using_quan[pickid] = {is_nouse_red: 0}; | |
2998 | 1068 | } |
2999 | 1069 | this.setData({using_quan: using_quan}); |
3000 | 1070 | |
3001 | 1071 | }, |
3002 | - | |
3003 | - | |
3004 | 1072 | /*----- 点击选择包邮券 -----*/ |
3005 | 1073 | sele_quan_item_by: function (e) { |
3006 | 1074 | var no_use = e.currentTarget.dataset.no; |
... | ... | @@ -3076,17 +1144,14 @@ Page({ |
3076 | 1144 | } |
3077 | 1145 | this.setData({using_quan: using_quan}); |
3078 | 1146 | }, |
3079 | - | |
3080 | 1147 | //--确认使用券--- |
3081 | 1148 | confirm_quan: function () { |
3082 | 1149 | var using_quan = this.data.using_quan; //正在使用中的券列表 |
3083 | - var pickid = this.data.selected_quan_pick; //选中的门店ID | |
1150 | + var pickid = this.data.pickup.pickup_id; //选中的门店ID | |
3084 | 1151 | var th = this; |
3085 | 1152 | var selected_quan_list = this.data.selected_quan_list; //选择了那个门店的券列表 |
3086 | 1153 | var get_by_quan_list = this.data.get_by_quan_list; //立即购买的包邮券列表 |
3087 | 1154 | var by_quan_list_cart = this.data.by_quan_list_cart; //购物车购买的包邮券列表 |
3088 | - //选择了的券 | |
3089 | - var sele_quan = null; | |
3090 | 1155 | |
3091 | 1156 | //循环普通的券 |
3092 | 1157 | for (var i in selected_quan_list) { |
... | ... | @@ -3135,16 +1200,14 @@ Page({ |
3135 | 1200 | if (using_quan[pickid]) { |
3136 | 1201 | if (using_quan[pickid].is_nouse_red == 1) { |
3137 | 1202 | using_quan[pickid] = {is_nouse_red: 1}; |
3138 | - th.setData({using_quan: using_quan}); | |
3139 | - if (th.data.is_b_now == 1) { | |
3140 | - th.calculatePrice2(); | |
3141 | - } else { | |
3142 | - th.calculatePrice(); | |
3143 | - } | |
1203 | + th.calculatePrice2(); | |
3144 | 1204 | th.setData({open_quan: 0}); |
3145 | - return; | |
1205 | + th.setData({using_quan: using_quan}); | |
3146 | 1206 | } |
3147 | 1207 | } |
1208 | + | |
1209 | + | |
1210 | + | |
3148 | 1211 | }, |
3149 | 1212 | |
3150 | 1213 | //----把券插入之后的操作,同时还要重新计算价格---- |
... | ... | @@ -3164,11 +1227,7 @@ Page({ |
3164 | 1227 | using_quan[pickid].isby = 0; |
3165 | 1228 | } |
3166 | 1229 | this.setData({using_quan: using_quan}); |
3167 | - if (th.data.is_b_now == 1) { | |
3168 | - th.calculatePrice2(); | |
3169 | - } else { | |
3170 | - th.calculatePrice(); | |
3171 | - } | |
1230 | + th.calculatePrice2(); | |
3172 | 1231 | th.setData({open_quan: 0}); |
3173 | 1232 | }, |
3174 | 1233 | |
... | ... | @@ -3230,11 +1289,8 @@ Page({ |
3230 | 1289 | |
3231 | 1290 | //点击确定物流 |
3232 | 1291 | determine_expres: function (e) { |
3233 | - this.setData({open_express: 0}); | |
3234 | - if (this.data.is_b_now == 1) | |
3235 | - this.calculatePrice2(); | |
3236 | - else | |
3237 | - this.calculatePrice(); | |
1292 | + this.setData({open_express: 0}); | |
1293 | + this.calculatePrice2(); | |
3238 | 1294 | }, |
3239 | 1295 | |
3240 | 1296 | //点击打开优惠券使用说明 |
... | ... | @@ -3280,8 +1336,8 @@ Page({ |
3280 | 1336 | getApp().globalData.userInfo.def_exp_code = is_shipping_code; |
3281 | 1337 | th.setData({open_express: 0}); |
3282 | 1338 | //----计算此时购物车的价格---- |
3283 | - if (th.data.is_b_now == 1) th.calculatePrice2(); | |
3284 | - else th.calculatePrice(); | |
1339 | + th.calculatePrice2(); | |
1340 | + | |
3285 | 1341 | } |
3286 | 1342 | } |
3287 | 1343 | }) |
... | ... | @@ -3417,21 +1473,16 @@ Page({ |
3417 | 1473 | th.setData({cartlist: arr}) |
3418 | 1474 | th.set_can_num(); |
3419 | 1475 | } |
3420 | - | |
3421 | - //}) | |
3422 | 1476 | }, |
3423 | 1477 | |
3424 | 1478 | //------ 获取立即购买的购物车的劵 -------- |
3425 | 1479 | get_buy_now_quan: function () { |
3426 | 1480 | var quanlist = null, th = this, frozenQuan = null; |
3427 | - var good = this.data.bn_goods; | |
3428 | - if (good.prom_price) { | |
3429 | - th.data.ckeck_quan_price = good.prom_price; //如果有优惠价,就用优惠价 | |
3430 | - } else if (good.is_offline) { | |
3431 | - th.data.ckeck_quan_price = good.offline_price; //如果有线下取价,就用线下价 | |
3432 | - } | |
1481 | + var allprice =this.data.pre_arr.presell_price*this.data.order_goods.goods_num; | |
1482 | + th.data.ckeck_quan_price = allprice; | |
1483 | + | |
3433 | 1484 | //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- |
3434 | - if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) { | |
1485 | + if (th.data.is_close_quan != 1) { | |
3435 | 1486 | var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; |
3436 | 1487 | var url = "/api/weshop/couponList/getUseCouponList"; |
3437 | 1488 | app.request.promiseGet(url0, {1: 1}).then(res => { |
... | ... | @@ -3494,61 +1545,12 @@ Page({ |
3494 | 1545 | var check = this.check_good(arr, goods_id); |
3495 | 1546 | return !check; |
3496 | 1547 | }, |
3497 | - //立即购买获取优惠活动的内容 | |
3498 | - buy_now_prom_goods: function (prom_id, arr, func) { | |
3499 | - var price = arr.shop_price * arr.goods_num; | |
3500 | - var prom = null; | |
3501 | - getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + prom_id, {}).then(res => { | |
3502 | - if (res.data.code == 0) { | |
3503 | - prom = res.data.data; | |
3504 | - return getApp().request.promiseGet("/api/weshop/goods/getDiscount", { | |
3505 | - data: { | |
3506 | - price: price, | |
3507 | - prom_id: prom_id, | |
3508 | - goods_num: arr.goods_num, | |
3509 | - user_id: getApp().globalData.user_id, | |
3510 | - is_bz: prom.is_bz | |
3511 | - } | |
3512 | - }) | |
3513 | - } else { | |
3514 | - func(arr); | |
3515 | - } | |
3516 | - }).then(res => { | |
3517 | - if (res.data.code == 0) { | |
3518 | - var get_data = res.data.data; | |
3519 | - arr.is_bz = prom.is_bz; //是不是倍增 | |
3520 | - arr.is_xz_yh = prom.is_xz_yh; //是不是优惠 | |
3521 | - arr.bs = get_data.bs; //是不是倍数 | |
3522 | - arr.is_past = get_data.is_past; //是不是包邮 | |
3523 | - arr.prom_price = get_data.price >= 0 ? get_data.price : price; | |
3524 | - arr.s_intValue = get_data.intValue; | |
3525 | - arr.s_coupon_id = get_data.coupon_id; | |
3526 | - arr.s_coupon_num = get_data.coupon_num; | |
3527 | - //-- 看是不是有赠品 -- | |
3528 | - if (get_data.gift_id) { | |
3529 | - arr.gift_id = get_data.gift_id; | |
3530 | - arr.gift_goods_id = get_data.goods_id; | |
3531 | - arr.gift_goods_name = get_data.goods_name; | |
3532 | - arr.gift_goods_color = get_data.goodsinfo.goods_color; | |
3533 | - arr.gift_goods_spec = get_data.goodsinfo.goods_spec; | |
3534 | - arr.gift_original_img = get_data.goodsinfo.original_img; | |
3535 | - arr.gift_weight = get_data.goodsinfo.weight; | |
3536 | - arr.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; | |
3537 | - arr.gift_uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; | |
3538 | - arr.gift_limit_num = get_data.limit_num; | |
3539 | - arr.gift_storecount = get_data.gift_storecount; | |
3540 | - } | |
3541 | - arr.s_libao = get_data.libao; | |
3542 | - arr.s_lb_num = get_data.lb_num; | |
3543 | - arr.prom_id = prom_id; | |
3544 | - } | |
3545 | - func(arr); | |
3546 | - }) | |
3547 | - }, | |
1548 | + | |
1549 | + | |
3548 | 1550 | //--检查订单优惠-- |
3549 | 1551 | check_is_order_prom: function (condition, func, pick) { |
3550 | 1552 | var th = this; |
3551 | - if (this.data.is_b_now == 1) pick = this.data.bn_pick; | |
1553 | + pick = this.data.pickup.pickup_id; | |
3552 | 1554 | //---获取订单优惠--- |
3553 | 1555 | getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
3554 | 1556 | data: {store_id: os.stoid, orderAmount: condition} |
... | ... | @@ -3650,14 +1652,13 @@ Page({ |
3650 | 1652 | if (no_by_data && no_by_data.region_list) { |
3651 | 1653 | if (th.check_by_area(no_by_data.region_list)) { |
3652 | 1654 | gift_freight_free = 0; |
3653 | - th.data.is_no_by[th.data.bn_pick] = 1; | |
1655 | + th.data.is_no_by[bn_pick] = 1; | |
3654 | 1656 | } |
3655 | 1657 | } |
3656 | 1658 | //如果有设置不包邮商品 |
3657 | 1659 | if (no_by_data && no_by_data.goods_list && gift_freight_free) { |
3658 | 1660 | if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { |
3659 | 1661 | gift_freight_free = 0; |
3660 | - //th.data.is_no_by[th.data.bn_pick]=1; | |
3661 | 1662 | } |
3662 | 1663 | } |
3663 | 1664 | |
... | ... | @@ -3712,82 +1713,342 @@ Page({ |
3712 | 1713 | return is_use; |
3713 | 1714 | }, |
3714 | 1715 | |
3715 | - //跳转到购买卡 | |
3716 | - buycard: function () { | |
3717 | - getApp().goto("/pages/user/plus/plus"); | |
3718 | - getApp().globalData.plus_buy_back = 1; | |
3719 | - }, | |
3720 | 1716 | |
3721 | - //跳转关闭弹出框的显示 | |
3722 | - close_offline: function () { | |
3723 | - this.setData({is_offline_show: 0}); | |
1717 | + | |
1718 | + //----计算物流的钱---- | |
1719 | + calculate_wuliu() { | |
1720 | + var to = getApp(), th = this; | |
1721 | + to.getConfig2(function (ee) { | |
1722 | + to.getwuliuprice(async function (rs) { | |
1723 | + var o_shipping_price = 0, | |
1724 | + goods_weight = -1, | |
1725 | + goods_piece = -1, | |
1726 | + good = th.data.goods, | |
1727 | + quan_price=0, | |
1728 | + exp_price=0; | |
1729 | + | |
1730 | + var quan_no = null; | |
1731 | + var bn_pick=th.data.pickup.pickup_id; | |
1732 | + var allpice =th.data.all_price; | |
1733 | + | |
1734 | + if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | |
1735 | + quan_no = th.data.using_quan[bn_pick].coupon_no; | |
1736 | + | |
1737 | + if (quan_no) { | |
1738 | + if (th.data.using_quan[bn_pick].isby != 1) { | |
1739 | + //---获取优惠券优惠--- | |
1740 | + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | |
1741 | + data: { | |
1742 | + storeId: oo.stoid, | |
1743 | + CashRepNo: quan_no, | |
1744 | + WaresSum: th.data.ckeck_quan_price, | |
1745 | + WareIds: th.data.check_quan_ware_list | |
1746 | + } | |
1747 | + }).then(res => { | |
1748 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
1749 | + quan_price = res.data.data[0].WareCashSum; | |
1750 | + } | |
1751 | + }) | |
1752 | + | |
1753 | + if(quan_price>0) { | |
1754 | + if (quan_price < allpice) th.setData({quan_price: quan_price}) | |
1755 | + else { | |
1756 | + th.setData({quan_price: allpice}) | |
1757 | + } | |
1758 | + }else{ | |
1759 | + th.setData({quan_price: 0}) | |
1760 | + } | |
1761 | + } | |
1762 | + }else{ | |
1763 | + th.setData({quan_price: 0}) | |
1764 | + } | |
1765 | + | |
1766 | + //-----------当地址不为空,且是物流时,计算物流费用---------- | |
1767 | + if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { | |
1768 | + //看是不是有调用过包邮券,如果活动可以使用优化券的情况下 | |
1769 | + if (!th.data.isget_by_quan[bn_pick] && th.data.is_usecoupon) { | |
1770 | + var condition = allpice - quan_price; | |
1771 | + //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- | |
1772 | + getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { | |
1773 | + data: { | |
1774 | + store_id: os.stoid, | |
1775 | + isuse: 0, | |
1776 | + condition: condition, | |
1777 | + user_id: getApp().globalData.user_id, | |
1778 | + pageSize: 2000 | |
1779 | + } | |
1780 | + }).then(res => { | |
1781 | + if (res.data.code == 0 && res.data.data.total > 0) { | |
1782 | + //此时要循环判断包邮的地区,不包邮商品是不是符合 | |
1783 | + var arr = [], quanlist = res.data.data.pageData; | |
1784 | + quanlist = th.check_is_frozenQuan(quanlist, th.data.frozenQuan, 1); | |
1785 | + for (var i in quanlist) { | |
1786 | + var item = quanlist[i]; | |
1787 | + if (item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域 | |
1788 | + if (item.goods_list && th.check_by_goods(item.goods_list)) continue; //如果是不包邮商品 | |
1789 | + arr.push(item); | |
1790 | + } | |
1791 | + if (arr) { | |
1792 | + th.setData({get_by_quan_list: arr}); | |
1793 | + } | |
1794 | + th.data.isget_by_quan[bn_pick] = 1; | |
1795 | + } | |
1796 | + }) | |
1797 | + } | |
1798 | + if (quan_no && th.data.using_quan[bn_pick].isby == 1) { | |
1799 | + exp_price=0; | |
1800 | + }else{ | |
1801 | + switch (good['exp_sum_type']) { | |
1802 | + case 1: | |
1803 | + //统一运费 | |
1804 | + o_shipping_price += good['uniform_exp_sum']; | |
1805 | + break; | |
1806 | + case 2: | |
1807 | + if (goods_weight < 0) goods_weight = 0; | |
1808 | + //累积商品重量 每种商品的重量 * 数量 | |
1809 | + goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; | |
1810 | + break; | |
1811 | + case 3: | |
1812 | + if (goods_piece < 0) goods_piece = 0; | |
1813 | + //累积商品数量 | |
1814 | + goods_piece += th.data.order.order_goods['goods_num']; | |
1815 | + break; | |
1816 | + } | |
1817 | + | |
1818 | + var code = th.data.wu_arr[th.data.index].code; | |
1819 | + var freight_free = ee.freight_free; //全场满多少包邮 | |
1820 | + var shipping_price = | |
1821 | + th.calculatewuliu(code, o_shipping_price, goods_weight, | |
1822 | + goods_piece, th.data.user_addr, freight_free, allpice, rs); | |
1823 | + exp_price = parseFloat(shipping_price).toFixed(2); | |
1824 | + } | |
1825 | + th.wuliu_next(allpice,quan_price,exp_price); | |
1826 | + } else { | |
1827 | + th.wuliu_next(allpice,quan_price,exp_price); | |
1828 | + } | |
1829 | + }); | |
1830 | + }); | |
3724 | 1831 | }, |
1832 | + //相同的东西统一在一起 | |
1833 | + wuliu_next( allpice,quan_price,exp_price){ | |
1834 | + var th=this; | |
1835 | + var o_condition =parseFloat(allpice)-parseFloat(quan_price); | |
1836 | + if(o_condition<0) o_condition=0; | |
1837 | + //如果同意参与订单优惠 | |
1838 | + if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { | |
1839 | + th.check_is_order_prom(o_condition, function () { | |
1840 | + var bn_pick=th.data.pickup.pickup_id | |
1841 | + var order_prom_amount = 0; | |
1842 | + var order_prom_id = 0; | |
1843 | + var order_m=0; | |
1844 | + if (th.data.order_prom[bn_pick]) { | |
1845 | + var ord_prom = th.data.order_prom[bn_pick]; | |
1846 | + order_prom_id = ord_prom['id']; | |
1847 | + switch (ord_prom['type']) { | |
1848 | + case 0: | |
1849 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
1850 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
1851 | + break; | |
1852 | + case 1: | |
1853 | + order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
1854 | + order_prom_amount = ord_prom['expression']; | |
1855 | + break; | |
1856 | + } | |
1857 | + o_condition=order_m; | |
1858 | + } | |
3725 | 1859 | |
3726 | - //立即购买显示弹出框 | |
3727 | - bn_pop_offline: function () { | |
3728 | - var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price; | |
3729 | - //是不是线下 | |
3730 | - var is_get_offline = this.data.bn_goods.is_offline; | |
3731 | - this.setData({is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline}); | |
1860 | + //--订单优惠的显示-- | |
1861 | + if (order_prom_id > 0) { | |
1862 | + var order_prom_txt1 = "order_prom_id"; | |
1863 | + var order_prom_txt2 = "order_prom_amount"; | |
1864 | + th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) | |
1865 | + } | |
1866 | + | |
1867 | + th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition) +parseFloat(exp_price) }) | |
1868 | + | |
1869 | + }) | |
1870 | + }else{ | |
1871 | + th.setData({ exp_price: exp_price, order_m: o_condition+exp_price }) | |
1872 | + } | |
3732 | 1873 | }, |
3733 | 1874 | |
3734 | - //确定使用线下取价 | |
3735 | - sure_offline: function () { | |
3736 | - var bn_goods = this.data.bn_goods; | |
3737 | - if (bn_goods && bn_goods.prom_type == 0) { | |
3738 | - bn_goods.is_offline = 1; | |
3739 | - this.setData({is_offline_show: 0, bn_goods: bn_goods}); | |
3740 | - this.calculatePrice2(); | |
1875 | + //-- 获取时间差 -- | |
1876 | + get_diff(){ | |
1877 | + if(this.data.presell.kw_start_time>ut.gettimestamp()){ | |
1878 | + this.setData({no_start:1}) | |
1879 | + }else if(this.data.presell.kw_end_time<ut.gettimestamp()){ | |
1880 | + this.setData({is_end:1}) | |
1881 | + }else { | |
1882 | + var end_time=this.data.presell.kw_end_time; | |
1883 | + var e_str=ut.formatTime(end_time); | |
1884 | + var new_date = new Date(); //新建一个日期对象,默认现在的时间 | |
1885 | + var old_date = new Date(e_str.replace(/-/g,'/')); //设置过去的一个时间点,"yyyy-MM-dd HH:mm:ss"格式化日期 | |
1886 | + var difftime = (new_date - old_date)/1000; //计算时间差,并把毫秒转换成秒 | |
1887 | + var days = parseInt(difftime/86400); // 天 24*60*60*1000 | |
1888 | + var hours = parseInt(difftime/3600)-24*days; // 小时 60*60 总小时数-过去的小时数=现在的小时数 | |
1889 | + var minutes = parseInt(difftime%3600/60); // 分钟 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数 | |
1890 | + var seconds = parseInt(difftime%60); // 以60秒为一整份 取余 剩下秒数 | |
1891 | + this.setData({days:days,hours:hours,minutes:minutes,seconds:seconds}) | |
3741 | 1892 | } |
3742 | - //就是购物车结算时的 | |
3743 | - else { | |
3744 | - var index = this.data.pop_offline_index; | |
3745 | - var txt = "cartlist[" + index + "].is_offline"; | |
3746 | - this.setData({[txt]: 1, is_offline_show: 0,}); | |
3747 | - this.data.old_cartlist[index].is_offline = 1; | |
3748 | - this.calculatePrice(); | |
1893 | + }, | |
1894 | + | |
1895 | + | |
1896 | + //显示支付选择 | |
1897 | + show_pay: function () { | |
1898 | + this.setData({show_pay_type: 1}); | |
1899 | + }, | |
1900 | + //关闭支付 | |
1901 | + close_show_pay: function () { | |
1902 | + this.setData({show_pay_type: 0}); | |
1903 | + }, | |
1904 | + //--弹起支付框-- | |
1905 | + to_pay() { | |
1906 | + //--物流支付时要有地址-- | |
1907 | + if (this.data.exp_type == 0 && this.data.user_addr == null) { | |
1908 | + return getApp().my_warnning("请选择收货地址", 0, this); | |
3749 | 1909 | } |
1910 | + | |
1911 | + this.setData({show_pay_type: 1}); | |
3750 | 1912 | }, |
3751 | 1913 | |
1914 | + //选择支付方式 | |
1915 | + set_pay_type: function (e) { | |
1916 | + var type = e.currentTarget.dataset.type; | |
1917 | + this.to_pay_type(type); | |
1918 | + }, | |
1919 | + | |
1920 | + //--立即支付-- | |
1921 | + to_pay_type: function (ind) { | |
1922 | + var th = this; | |
1923 | + //--物流支付时要有地址-- | |
1924 | + if (th.data.exp_type == 0 && th.data.user_addr == null) { | |
1925 | + return getApp().my_warnning("请选择收货地址", 0, th); | |
1926 | + } | |
1927 | + | |
1928 | + //---支付参数-- | |
1929 | + var dd = { | |
1930 | + order_sn: th.data.order.order_sn, | |
1931 | + order_id: th.data.order.order_id, | |
1932 | + store_id: oo.stoid, | |
1933 | + exp_type: th.data.exp_type, | |
1934 | + user_id: getApp().globalData.userInfo.user_id, | |
1935 | + prom_id: th.data.pre_arr.presell_id, | |
1936 | + tail_pay_type: ind,//0微信支付 1余额支付 | |
1937 | + }; | |
3752 | 1938 | |
3753 | - //取消使用线下取价 | |
3754 | - cancle_offline: function () { | |
3755 | - //判断是不是立即购买 | |
3756 | - var bn_goods = this.data.bn_goods; | |
3757 | - if (bn_goods && bn_goods.prom_type == 0) { | |
3758 | - bn_goods.is_offline = 0; | |
3759 | - this.setData({is_offline_show: 0, bn_goods: bn_goods}); | |
3760 | - this.calculatePrice2(); | |
1939 | + if (th.data.exp_type == 0) { | |
1940 | + var index = th.data.index; | |
1941 | + dd.shipping_code = th.data.wu_arr[index].code; | |
1942 | + dd.shipping_name = th.data.wu_arr[index].name; | |
1943 | + dd.shipping_price = parseFloat(th.data.exp_price); | |
1944 | + dd.addressid = th.data.user_addr.address_id; | |
3761 | 1945 | } |
3762 | - //就是购物车结算时的 | |
3763 | - else { | |
3764 | - var index = this.data.pop_offline_index; | |
3765 | - var txt = "cartlist[" + index + "].is_offline"; | |
3766 | - this.setData({[txt]: 0, is_offline_show: 0,}) | |
3767 | - this.data.old_cartlist[index].is_offline = 0; | |
3768 | - this.calculatePrice(); | |
1946 | + | |
1947 | + if(th.data.order_prom_amount>0){ | |
1948 | + var e={ | |
1949 | + order_prom_id:th.data.order_prom_id, | |
1950 | + order_prom_amount:th.data.order_prom_amount, | |
1951 | + } | |
1952 | + dd.order_prom_list=e; | |
1953 | + } | |
1954 | + | |
1955 | + var bn_pick=th.data.pickup_id; | |
1956 | + var quan_no=''; | |
1957 | + if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | |
1958 | + quan_no = th.data.using_quan[bn_pick].coupon_no; | |
1959 | + if(quan_no){ | |
1960 | + dd.coupon_no=quan_no; | |
1961 | + if(th.data.quan_price) dd.coupon_price=th.data.quan_price; | |
1962 | + } | |
1963 | + if(th.data.user_note){ | |
1964 | + dd.user_note=th.data.user_note; | |
3769 | 1965 | } |
1966 | + dd.order_amount=th.data.order_m-th.data.presell.presell_deposit; | |
1967 | + | |
1968 | + console.log(JSON.stringify(dd)); | |
1969 | + wx.request({ | |
1970 | + url: oo.url + '/api/weshop/order/pay/payPresellWk', | |
1971 | + data: JSON.stringify(dd), | |
1972 | + method: 'POST', | |
1973 | + header: { | |
1974 | + 'content-type': 'application/json' | |
1975 | + },// 设置请求的 header | |
1976 | + success: function (t) { | |
1977 | + th.close_show_pay(); | |
1978 | + | |
1979 | + //---用微信支付--- | |
1980 | + if (dd.tail_pay_type == 0) { | |
1981 | + var n = t.data.data; | |
1982 | + th.weixinPay(n, | |
1983 | + function () { | |
1984 | + //---用余额支付--- | |
1985 | + getApp().my_warnning("支付成功", 1, th); | |
1986 | + setTimeout(function () { | |
1987 | + th.setData({isclose: 0}); | |
1988 | + th.onShow(); | |
1989 | + }, 1000) | |
1990 | + | |
1991 | + | |
1992 | + }, function () { | |
1993 | + getApp().my_warnning("支付失败", 0, th); | |
1994 | + }) | |
1995 | + } else { | |
1996 | + if (t.data.code == 0) { | |
1997 | + //---用余额支付--- | |
1998 | + getApp().my_warnning("支付成功", 1, th); | |
1999 | + setTimeout(function () { | |
2000 | + th.setData({isclose: 0}); | |
2001 | + | |
2002 | + th.onShow(); | |
2003 | + }, 1000) | |
2004 | + } else { | |
2005 | + getApp().my_warnning(t.data.msg, 1, th); | |
2006 | + } | |
2007 | + } | |
2008 | + } | |
2009 | + }); | |
2010 | + }, | |
2011 | + | |
2012 | + //------调起支付框-------- | |
2013 | + weixinPay: function (n, success, fail) { | |
2014 | + if (!n) return false; | |
2015 | + var th = this; | |
2016 | + wx.requestPayment({ | |
2017 | + timeStamp: String(n.timeStamp), | |
2018 | + nonceStr: n.nonceStr, | |
2019 | + package: n.packageValue, | |
2020 | + signType: n.signType, | |
2021 | + paySign: n.paySign, | |
2022 | + success: function (n) { | |
2023 | + console.log(n), getApp().showSuccess("支付成功!"); | |
2024 | + "function" == typeof success && success(); | |
2025 | + }, | |
2026 | + fail: function (n) { | |
2027 | + 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), | |
2028 | + "function" == typeof fail && fail(); | |
2029 | + } | |
2030 | + }); | |
2031 | + }, | |
2032 | + | |
2033 | + | |
2034 | + show_liuyan:function () { | |
2035 | + this.setData({sh_liuyan:true}) | |
2036 | + }, | |
2037 | + close_liuyan(){ | |
2038 | + this.setData({sh_liuyan:false}) | |
3770 | 2039 | }, |
3771 | 2040 | |
3772 | - //-- 弹出购物车选择是不是要店铺优惠 -- | |
3773 | - cart_pop_offline: function (e) { | |
3774 | - var index = e.currentTarget.dataset.index; | |
3775 | - var item = this.data.cartlist[index]; | |
3776 | - var off_price = item.offline_price; | |
3777 | - //是不是线下 | |
3778 | - var is_get_offline = item.is_offline; | |
2041 | + //--------点击选择---------- | |
2042 | + set_wuliu: function (e) { | |
2043 | + var type = e.currentTarget.dataset.type; | |
3779 | 2044 | this.setData({ |
3780 | - pop_offline_index: index, | |
3781 | - is_offline_show: 1, | |
3782 | - show_off_price: off_price.toFixed(2), | |
3783 | - is_get_offline: is_get_offline | |
2045 | + exp_type: type | |
3784 | 2046 | }); |
2047 | + this.calculatePrice2(); | |
3785 | 2048 | }, |
3786 | - | |
3787 | - // 是否同意预售商品不退定金 | |
3788 | - switchChange(e) { | |
3789 | - let isSwitchOn = e.detail; | |
3790 | - } | |
2049 | + | |
2050 | + | |
2051 | + | |
3791 | 2052 | |
3792 | 2053 | |
3793 | 2054 | }); | ... | ... |
packageC/pages/presell/cart/cart.wxml
... | ... | @@ -2,368 +2,145 @@ |
2 | 2 | <wxs src="filter.wxs" module="util"></wxs> |
3 | 3 | <wxs module="filters" src="../../../../utils/filter.wxs"></wxs> |
4 | 4 | |
5 | -<form bindsubmit="submitForm"> | |
5 | +<form bindsubmit="submitForm" wx:if="{{show_submit}}"> | |
6 | 6 | <view class="container"> |
7 | - | |
8 | 7 | <!-- 支付进度 --> |
9 | 8 | <view class="information bdr14 mgt20"> |
10 | 9 | <view class="item ai-center" style="justify-content: flex-start;"> |
11 | 10 | <view class="pdr20"><text class="iconfont icon-qianbao fs60"></text></view> |
12 | - <!-- <view class=""> | |
11 | + | |
12 | + <view wx:if="{{wait_dj}}"> | |
13 | + <view>等待买家付定金</view> | |
14 | + <view>{{filters.format_time(presell.kw_start_time,1)}} - {{filters.format_time(presell.kw_end_time,1)}}</view> | |
15 | + </view> | |
16 | + | |
17 | + <view wx:if="{{no_start}}"> | |
13 | 18 | <view>等待尾款支付开始</view> |
14 | - <view>2021.10.01 00:00:00 - 2021.10.10 23:59:59</view> | |
15 | - </view> --> | |
16 | - <view class=""> | |
19 | + <view>{{filters.format_time(presell.kw_start_time,1)}} - {{filters.format_time(presell.kw_end_time,1)}}</view> | |
20 | + </view> | |
21 | + | |
22 | + <view wx:if="{{wait_wk && !no_start}}"> | |
17 | 23 | <view>等待买家付尾款</view> |
18 | - <view class="fs22">请于*天**小时**分**秒内付款完成,超时订单将自动取消</view> | |
24 | + <view class="fs22">请于{{days}}天{{hours}}小时{{minutes}}分{{seconds}}秒内付款完成,超时订单将自动取消</view> | |
25 | + </view> | |
26 | + <view wx:if="{{wait_fh}}"> | |
27 | + <view>等待商家发货</view> | |
28 | + <view class="fs22">将在2022-12-1 10:10:00后发货</view> | |
29 | + </view> | |
30 | + <view wx:if="{{order.order_status==2}}"> | |
31 | + <view>待评价</view> | |
32 | + </view> | |
33 | + <view wx:if="{{order.order_status==3}}"> | |
34 | + <view>已取消</view> | |
19 | 35 | </view> |
36 | + <view wx:if="{{order.order_status==4}}"> | |
37 | + <view>已完成</view> | |
38 | + </view> | |
39 | + <view wx:if="{{order.order_status==5}}"> | |
40 | + <view>已作废</view> | |
41 | + </view> | |
42 | + <view wx:if="{{order.order_status==6}}"> | |
43 | + <view>退款退货完成</view> | |
44 | + </view> | |
45 | + | |
20 | 46 | </view> |
47 | + | |
48 | + | |
21 | 49 | <view class="pdb20 flex t-c fs22 c-7b"> |
22 | 50 | <view class="f1"> |
23 | 51 | <view>付定金</view> |
24 | - <view class="box"> | |
25 | - <text class="iconfont icon-yes"></text> | |
26 | - </view> | |
52 | + <view wx:if="{{presell.deposit_pay_time>0}}" class="box"><text class="iconfont icon-yes"></text></view> | |
53 | + <view wx:else class="box"><text class="iconfont icon-yes"></text></view> | |
27 | 54 | </view> |
28 | 55 | <view class="f1"> |
29 | 56 | <view>付尾款</view> |
30 | - <view class="box line"><text class="circle"></text></view> | |
57 | + <view wx:if="{{presell.tail_pay_state==1}}" class="box"><text class="iconfont icon-yes"></text></view> | |
58 | + <view wx:else class="box line"><text class="circle1"></text></view> | |
31 | 59 | </view> |
32 | 60 | <view class="f1"> |
33 | 61 | <view>商家发货</view> |
34 | - <view class="box line"><text class="circle"></text></view> | |
62 | + <view wx:if="{{order.order_status==2 || order.order_status==4}}" class="box line"><text class="circle1"></text></view> | |
63 | + <view wx:else class="box line"><text class="circle1"></text></view> | |
35 | 64 | </view> |
36 | 65 | <view class="f1"> |
37 | 66 | <view>交易完成</view> |
38 | - <view class="box line"><text class="circle"></text></view> | |
67 | + <view wx:if="{{order.order_status==4}}" class="box"><text class="iconfont icon-yes"></text></view> | |
68 | + <view wx:else class="box line"><text class="circle1"></text></view> | |
39 | 69 | </view> |
40 | 70 | </view> |
41 | 71 | </view> |
42 | - | |
72 | + | |
43 | 73 | <!-- 退款完成 --> |
74 | + <!-- | |
44 | 75 | <view class="information bdr14 mgt20"> |
45 | 76 | <view class="item ai-center" style="justify-content: flex-start;"> |
46 | 77 | <view class="pdr20"><text class="iconfont icon-tkcg fs60"></text></view> |
47 | 78 | <view class="">退款完成(定金)</view> |
48 | 79 | </view> |
49 | - </view> | |
50 | - | |
80 | + </view>--> | |
51 | 81 | <!-- 立即购买的时候 --> |
52 | - <block wx:if="{{is_b_now==1}}"> | |
53 | - <view class="tab-container"> | |
54 | - <view class="tab-wrapper"> | |
55 | - <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}" | |
56 | - data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> | |
57 | - | |
58 | - <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" | |
59 | - data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> | |
60 | - | |
61 | - </view> | |
62 | - </view> | |
63 | - </block> | |
64 | - <!-- 购物购买只有一单的时候 --> | |
65 | - <block wx:if="{{is_b_now==0 && cartlist.length==1}}"> | |
66 | - <view class="tab-container"> | |
67 | - <view class="tab-wrapper"> | |
68 | - <view hidden="{{cartlist[0].distr_t==2}}" bindtap='setexptype_w' data-ind="0" data-t='1' class="tab {{cartlist[0].exp_type == 1? 'active':''}}" | |
69 | - data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> | |
70 | - | |
71 | - <view hidden="{{cartlist[0].distr_t==1}}" bindtap='setexptype_w' data-ind="0" data-t='0' class="tab {{cartlist[0].exp_type== 0 ? 'active':''}}" | |
72 | - data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> | |
73 | - | |
74 | - </view> | |
75 | - </view> | |
76 | - </block> | |
77 | - | |
78 | - | |
79 | - <!--要进行判断地址是否显示----> | |
80 | - <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> | |
81 | - <!---默认地址显示------> | |
82 | - <block wx:if="{{user_addr!=null}}"> | |
82 | + <view class="tab-wrapper" wx:if="{{presell.deposit_pay_time>0 && presell.tail_pay_state==0 && !no_start}}"> | |
83 | + <view hidden="{{distr_type==2}}" bindtap='set_wuliu' data-type='1' class="tab {{exp_type == 1? 'active':''}}" | |
84 | + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> | |
83 | 85 | |
86 | + <view hidden="{{distr_type==1}}" bindtap='set_wuliu' data-type='0' class="tab {{exp_type== 0 ? 'active':''}}" | |
87 | + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> | |
88 | + </view> | |
89 | + | |
90 | + | |
91 | + <!----要进行判断地址是否显示----> | |
92 | + <view bindtap="enterAddressPage" class="user-mes mgt20" | |
93 | + hidden='{{exp_type==1 }}'> | |
94 | + <!-----默认地址显示----> | |
95 | + <block wx:if="{{user_addr!=null}}"> | |
84 | 96 | <view class="user-contact"> |
85 | 97 | <text class="bold fs36 pdr20">{{user_addr.consignee}}</text> |
86 | 98 | <text class="fs28">{{user_addr.mobile}}</text> |
87 | 99 | </view> |
88 | - <view class="location"> | |
89 | - <view class="address fs26 pdt20"> | |
90 | - <view class="pos-icon"> | |
91 | - <image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/goodscategory/new_position.png"></image> | |
92 | - </view> | |
93 | - {{user_addr.more_address}}{{' '}}{{user_addr.address}} | |
100 | + <view class="location flex ai_c" style="font-size: 28rpx"> | |
101 | + <view class="pos-icon"> | |
102 | + <image class="wh100" style="vertical-align: top" src="{{imgUrl}}/miniapp/images/goodscategory/new_position.png"></image> | |
94 | 103 | </view> |
95 | - | |
104 | + <view class="address">{{user_addr.more_address}}{{' '}}{{user_addr.address}}</view> | |
105 | + | |
96 | 106 | </view> |
97 | 107 | <view class="update-logistics"> |
98 | - <!-- <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/new_position.png"></image> --> | |
99 | - <view class="xc-right"></view> | |
108 | + <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/icon-arrowdown.png"></image> | |
100 | 109 | </view> |
101 | 110 | </block> |
102 | - <!---先增地址------> | |
111 | + <!-----先增地址------> | |
103 | 112 | <block wx:else> |
104 | 113 | <view class="add_new"> |
105 | 114 | <image class="addr_jia" src="{{imgUrl}}/miniapp/images/jia.png"></image>添加地址 |
106 | 115 | </view> |
107 | 116 | </block> |
108 | - <!-- <view class="border-img"> | |
109 | - <image class="wh100" src="{{imgUrl}}/miniapp/images/order/new_dividing_line.png"></image> | |
110 | - </view> --> | |
111 | - </view> | |
112 | 117 | |
113 | - <!-- -------------------购物车进来,有可能多单-------------------- --> | |
114 | - <block wx:if="{{is_b_now==0}}"> | |
115 | - <!-- <view class="xc-border main-top"></view> --> | |
116 | - <view wx:for="{{cartlist}}" wx:for-index="pidx"> | |
117 | - <view class="use-item bfff bdr_t-14 mgt20"> | |
118 | - <image class="dp" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'></image> | |
119 | - <!-- <view>门店:{{item.pname}}</view> --> | |
120 | - <view>{{item.pname}}</view> | |
121 | - </view> | |
122 | - <view class="order-detail" wx:for="{{item.goods}}" wx:for-index="idx" wx:for-item="items"> | |
123 | - <!----商品图片-----> | |
124 | - <view class="goods-img" style="position: relative"> | |
125 | - <image wx:if="{{items.is_gift}}" src="{{imgUrl}}/miniapp/images/giveaway.png" class="gift_image"></image> | |
126 | - <image class="wh100 bdr14" src="{{items.original_img}}" binderror='cart_set_err' data-err='cartlist[{{pidx}}].goods[{{idx}}].original_img'></image> | |
127 | - </view> | |
128 | - <!----商品名称规格----> | |
129 | - <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{items.goods_id}}"> | |
130 | - <view class="goods-name ellipsis-2">{{items.goods_name}}</view> | |
131 | - <!-- 商品属性 --> | |
132 | - <view class="flex-vertical fs28 color-gray n_guige"> | |
133 | - <view class="goods-color"> | |
134 | - <block><text>{{filters.show_gui_ge(items.goods_spec,items.goods_color)}}</text></block> | |
135 | - <!--<block wx:if="{{!items.goods_spec && !items.goods_color}}"><text>规格1</text></block>--> | |
136 | - <!--<block wx:else>--> | |
137 | - <!--<text wx:if="{{items.goods_spec!=''}}">{{items.goods_spec}}<text wx:if="{{items.goods_color}}">/</text></text>--> | |
138 | - <!--<text wx:if="{{items.goods_color}}">{{items.goods_color}}</text>--> | |
139 | - <!--</block>--> | |
140 | - </view> | |
141 | - </view> | |
142 | - | |
143 | - | |
144 | - <!-----商品名称规格------> | |
145 | - <view class="order-num flex-space-between"> | |
146 | - <view class="co-red">¥<text class="fs36">{{filters.toFix(items.goods_price,2)}}</text></view> | |
147 | - <view class="goods-num">x{{items.goods_num}}</view> | |
148 | - </view> | |
149 | - </navigator> | |
150 | - </view> | |
151 | - | |
152 | - <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> | |
153 | - <view class="plus_buy fs28" wx:if="{{item.card_cut_price>0}}"> | |
154 | - <view class="flex"> | |
155 | - <view class="card_bg ellipsis-1" style="margin-right: 10rpx;"> | |
156 | - <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image> | |
157 | - <text class="card_name">{{show_card.CardName}}</text> | |
158 | - </view> | |
159 | - <view>立减 <text style="color:#f23030;">{{filters.toFix(item.card_cut_price,2) }}</text> 元</view> | |
160 | - </view> | |
161 | - <view> | |
162 | - <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text> | |
163 | - </view> | |
164 | - <!-- 三角形 --> | |
165 | - <view class="car_tri_up"></view> | |
166 | - <!-- 立即开通跳转 --> | |
167 | - <view bindtap="buycard" class="card_op">立即开通</view> | |
168 | - </view> | |
169 | - | |
170 | - | |
171 | - <!-----使用优惠券------> | |
172 | - <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null}}" | |
173 | - data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> | |
174 | - <view class="work-frame flex-space-between"> | |
175 | - <view class="work">优惠券<text class="quan_num_show fs20">{{item.can_num}}张可用</text></view> | |
176 | - <view class="xc-right-frame"> | |
177 | - <text wx:if="{{using_quan[item.pickup_id].is_nouse}}">不使用</text> | |
178 | - <text wx:if="{{using_quan[item.pickup_id].money}}">¥{{using_quan[item.pickup_id].money}}元优惠券</text> | |
179 | - <text wx:if="{{using_quan[item.pickup_id].isby}}">包邮券</text> | |
180 | - <view class="xc-right"></view> | |
181 | - </view> | |
182 | - </view> | |
183 | - </view> | |
184 | - | |
185 | - | |
186 | - <view class="set-mes bdr_b-14"> | |
187 | - <view wx:if="{{order.store_prom}}"> | |
188 | - <icon color="#f23030" size="16" type="info"></icon> | |
189 | - {{order.store_prom}} | |
190 | - </view> | |
191 | - | |
192 | - <!-- 当是物流很多单的时候 --> | |
193 | - <view class="use-item flex-space-between" wx:if="{{cartlist.length>1}}"> | |
194 | - <view class="flex-vertical" > | |
195 | - <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' | |
196 | - style="padding-right:26rpx;display:{{item.distr_t==2?'none':'flex;align-items: center'}};"> | |
197 | - <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> --> | |
198 | - | |
199 | - <block wx:if="{{item.exp_type==1}}"> | |
200 | - <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> | |
201 | - <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> | |
202 | - </block> | |
203 | - <block wx:else> | |
204 | - <view class="circle xc-hookts on"></view> | |
205 | - </block> | |
206 | - <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view> | |
207 | - </view> | |
208 | - | |
209 | - <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};"> | |
210 | - <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> --> | |
211 | - <block wx:if="{{item.exp_type==0}}"> | |
212 | - <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> | |
213 | - <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> | |
214 | - </block> | |
215 | - <block wx:else> | |
216 | - <view class="circle xc-hookts on"></view> | |
217 | - </block> | |
218 | - | |
219 | - <view bindtap='setexptype_w' data-t='0' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind' | |
220 | - class="yu_er">快递邮寄</view> | |
221 | - </view> | |
222 | - </view> | |
223 | - | |
224 | - | |
225 | - <!-- 点击显示物流选择,如果是默认使用的情况不成立 --> | |
226 | - <view wx:if="{{!is_default_logistics && item.exp_type!=1}}" class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;"> | |
227 | - <view>{{wu_arr[item.wind].name}}</view> | |
228 | - <view class="xc-right"></view> | |
229 | - </view> | |
230 | - | |
231 | - </view> | |
232 | - | |
233 | - <!-- 当是物流,只有一单的时候 --> | |
234 | - <block wx:else > | |
235 | - <view class="use-item flex-space-between" wx:if="{{item.exp_type==0 && !is_default_logistics}}"> | |
236 | - <view class="flex jc_sb" style="width: 100%; padding: 0 13rpx;"> | |
237 | - <view>选择物流</view> | |
238 | - <view class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;"> | |
239 | - <view>{{wu_arr[item.wind].name}}</view> | |
240 | - <view class="xc-right"></view> | |
241 | - </view> | |
242 | - </view> | |
243 | - </view> | |
244 | - </block> | |
245 | - | |
246 | - | |
247 | - </view> | |
248 | - | |
249 | - <!-- 留言 --> | |
250 | - <view class="coupon-mes flex-vertical"> | |
251 | - <view>留言</view> | |
252 | - <view class="leave-word"> | |
253 | - <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}" | |
254 | - class="word-box" maxlength="100" name="user_note_{{item.pickup_id}}"></input> | |
255 | - | |
256 | - </view> | |
257 | - </view> | |
258 | - | |
259 | - <!-- 是否参与店铺优惠 --> | |
260 | - <view class="coupon-mes flex-vertical" data-index="{{index}}" bindtap="cart_pop_offline" wx:if="{{item.offline_price}}"> | |
261 | - <view>店铺优惠</view> | |
262 | - <view class="leave-word fs32" style="color: #999;"> | |
263 | - 省{{filters.toFix(item.offline_price,2)}}元 | |
264 | - </view> | |
265 | - <block wx:if="{{item.is_offline}}"> | |
266 | - <text style="color: #d7642b;">-¥{{filters.toFix(item.offline_price,2)}}</text> | |
267 | - </block> | |
268 | - <block wx:else> | |
269 | - <text style="color: #d7642b;">不使用优惠</text> | |
270 | - </block> | |
271 | - <!-- 右边点击 --> | |
272 | - <view class="xc-right" style="margin-right: 12rpx; border-color: #d7642b;"></view> | |
273 | - </view> | |
274 | - | |
275 | - </view> | |
276 | - | |
277 | - <!-- ---使用余额---- --> | |
278 | - <view class="set-mes bdr_t-14" wx:if="{{yuer>0}}"> | |
279 | - <view class="use-item" bindtap='set_js_useyuer'> | |
280 | - <icon color="{{js_use_money?'red':'gray'}}" size="16" type="success"></icon> | |
281 | - <view class="yu_er">使用余额 :¥{{yuer}} </view> | |
282 | - </view> | |
283 | - </view> | |
284 | - | |
285 | - </block> | |
118 | + </view> | |
286 | 119 | |
287 | - <!-- ----立即购买------ --> | |
288 | - <!-- <view class="xc-border xc-border"></view> --> | |
289 | - <block wx:if="{{is_b_now==1}}"> | |
290 | 120 | <view class="use-item bfff bdr_t-14 mgt20"> |
291 | 121 | <image class="dp" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'> </image> |
292 | - <view>{{bn_pickname}}</view> | |
293 | - <!-- <view>门店:{{bn_pickname}}</view> --> | |
122 | + <view>{{pickup.pickup_name}}</view> | |
294 | 123 | </view> |
295 | 124 | <view class="order-detail"> |
296 | 125 | <view class="goods-img"> |
297 | - <image class="wh100 bdr14" src="{{bn_goods.original_img}}" binderror='cart_set_err' data-err="bn_goods.original_img"></image> | |
126 | + <image class="wh100 bdr14" src="{{imgUrl}}{{goods.original_img}}" binderror='cart_set_err' data-err="goods.original_img"></image> | |
298 | 127 | </view> |
299 | - <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{bn_goods.goods_id}}"> | |
300 | - <view class="goods-name ellipsis-2">{{bn_goods.goods_name}}</view> | |
128 | + <navigator class="order-cont" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{goods.goods_id}}&pre_id={{pre_arr.id}}"> | |
129 | + <view class="goods-name ellipsis-2">{{goods.goods_name}}</view> | |
301 | 130 | <!-- 商品属性 --> |
302 | 131 | <view class="flex-vertical fs28 xc-ash color-gray n_guige"> |
303 | 132 | <view class="goods-color"> |
304 | - <block><text>{{filters.show_gui_ge(bn_goods.goods_spec,bn_goods.goods_color)}}</text></block> | |
305 | - <!--<block wx:if="{{!bn_goods.goods_spec && !bn_goods.goods_color}}"><text>规格1</text></block>--> | |
306 | - <!--<block wx:else>--> | |
307 | - <!--<text wx:if="{{bn_goods.goods_spec!=''}}">{{bn_goods.goods_spec}}<text wx:if="{{bn_goods.goods_color}}">/</text></text>--> | |
308 | - <!--<text wx:if="{{bn_goods.goods_color}}">{{bn_goods.goods_color}}</text>--> | |
309 | - <!--</block>--> | |
133 | + <block><text>{{filters.show_gui_ge(goods.goods_spec,goods.goods_color)}}</text></block> | |
310 | 134 | </view> |
311 | 135 | </view> |
312 | - | |
313 | 136 | <!-- ---商品名称规格---- --> |
314 | 137 | <view class="order-num flex-space-between"> |
315 | - <view class="co-red">¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></view> | |
316 | - <view class="goods-num">x{{bn_goods.buynum}}</view> | |
138 | + <view class="co-red">¥<text class="fs36">{{filters.toFix(pre_arr.presell_price,2)}}</text></view> | |
139 | + <view class="goods-num">×{{order.order_goods.goods_num}}</view> | |
317 | 140 | </view> |
318 | 141 | </navigator> |
319 | 142 | |
320 | 143 | </view> |
321 | - <!-- 赠品的显示 --> | |
322 | - <view class="order-detail" wx:if="{{buy_now_gift_goods}}"> | |
323 | - <view class="goods-img" style="position: relative"> | |
324 | - <image src="{{imgUrl}}/miniapp/images/giveaway.png" class="gift_image"></image> | |
325 | - | |
326 | - <image class="wh100 bdr14" src="{{buy_now_gift_goods.original_img}}" binderror='cart_set_err' data-err="buy_now_gift_goods.original_img"></image> | |
327 | - </view> | |
328 | - <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{buy_now_gift_goods.goods_id}}"> | |
329 | - <view class="goods-name ellipsis-2">{{buy_now_gift_goods.goods_name}}</view> | |
330 | - <!-- 商品属性 --> | |
331 | - <view class="flex-vertical fs28 xc-ash color-gray n_guige"> | |
332 | - <view class="goods-color"> | |
333 | - <block><text>{{filters.show_gui_ge(buy_now_gift_goods.goods_spec,buy_now_gift_goods.goods_color)}}</text></block> | |
334 | - </view> | |
335 | - </view> | |
336 | - <!-- ---商品名称规格---- --> | |
337 | - <view class="order-num flex-space-between"> | |
338 | - <view class="co-red">¥<text class="fs36">0</text></view> | |
339 | - <view class="goods-num">x{{buy_now_gift_goods.buynum}}</view> | |
340 | - </view> | |
341 | - </navigator> | |
342 | - </view> | |
343 | - | |
344 | - | |
345 | - <block wx:if="{{collocation_goods}}"> | |
346 | - <!-- 搭配购买的功能实现 --> | |
347 | - <view class="order-detail" wx:for="{{collocation_goods}}"> | |
348 | - <view class="goods-img"> | |
349 | - <image class="wh100 bdr14" src="{{imgUrl+item.original_img}}" binderror='err_img_collocation' data-err="item.original_img"></image> | |
350 | - </view> | |
351 | - <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | |
352 | - <view class="goods-name ellipsis-2">{{item.goods_name}}</view> | |
353 | - <!-- 商品属性 --> | |
354 | - <view class="flex-vertical fs28 xc-ash color-gray n_guige"> | |
355 | - <view class="goods-color"> | |
356 | - <block><text>{{filters.show_gui_ge(item.goods_spec,item.goods_color)}}</text></block> | |
357 | - </view> | |
358 | - </view> | |
359 | - <!-- ---商品名称规格---- --> | |
360 | - <view class="order-num flex-space-between"> | |
361 | - <view class="co-red">¥<text class="fs36">{{item.price}}</text></view> | |
362 | - <view class="goods-num">x{{item.goods_num}}</view> | |
363 | - </view> | |
364 | - </navigator> | |
365 | - </view> | |
366 | - </block> | |
367 | 144 | |
368 | 145 | <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> |
369 | 146 | <view class="plus_buy fs28" wx:if="{{card_cut_price>0}}"> |
... | ... | @@ -389,16 +166,16 @@ |
389 | 166 | <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} |
390 | 167 | </view> |
391 | 168 | |
392 | - <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}"> | |
169 | + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{pickup_id}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}"> | |
393 | 170 | <view class="work-frame flex-space-between"> |
394 | 171 | <view class="work"> |
395 | 172 | 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text> |
396 | 173 | </view> |
397 | 174 | <view class="xc-right-frame"> |
398 | - <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> | |
175 | + <text wx:if="{{using_quan[pickup_id].is_nouse_red}}">不使用</text> | |
399 | 176 | <block wx:else> |
400 | - <text wx:if="{{using_quan[bn_pick].money}}">¥{{using_quan[bn_pick].money}}元优惠券</text> | |
401 | - <text wx:if="{{using_quan[bn_pick].isby}}">包邮券</text> | |
177 | + <text wx:if="{{using_quan[pickup_id].money}}">¥{{using_quan[pickup_id].money}}元优惠券</text> | |
178 | + <text wx:if="{{using_quan[pickup_id].isby}}">包邮券</text> | |
402 | 179 | </block> |
403 | 180 | <view class="xc-right"></view> |
404 | 181 | </view> |
... | ... | @@ -418,10 +195,15 @@ |
418 | 195 | <!-- 留言 --> |
419 | 196 | <view class="coupon-mes flex-vertical"> |
420 | 197 | <view>留言</view> |
421 | - <view class="leave-word"> | |
422 | - <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}" | |
198 | + <view class="leave-word" wx:if="{{sh_liuyan}}"> | |
199 | + <input placeholder-class="fs28" bindblur="close_liuyan" focus="{{sh_liuyan}}" bindinput="keyUpChangeNum" value="{{user_note}}" | |
423 | 200 | class="word-box" maxlength="100" name="user_note"></input> |
424 | 201 | </view> |
202 | + | |
203 | + <view wx:if="{{!sh_liuyan}}" bindtap="show_liuyan"> | |
204 | + <text class="fs26 {{user_note?'':'gray'}} note_text">{{user_note?user_note:'给商家留言,最多100字'}}</text> | |
205 | + </view> | |
206 | + | |
425 | 207 | </view> |
426 | 208 | |
427 | 209 | <!-- 是否参与店铺优惠 --> |
... | ... | @@ -441,81 +223,51 @@ |
441 | 223 | </view> |
442 | 224 | |
443 | 225 | |
444 | - <!-----使用余额------> | |
445 | - <view class="set-mes bdr_t-14" wx:if="{{yuer>0}}"> | |
446 | - <view class="use-item" bindtap='set_bn_useyuer'> | |
447 | - <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> | |
448 | - <view class="yu_er">使用余额 :¥{{yuer}} </view> | |
449 | - </view> | |
450 | - </view> | |
451 | - | |
452 | - </block> | |
453 | - | |
454 | 226 | <view class="information bdr14"> |
455 | - <view class="item" wx:if="{{formData.all_price>0}}"> | |
227 | + <view class="item" wx:if="{{allpice>0}}"> | |
456 | 228 | <view>商品金额</view> |
457 | - <view class="co-red">¥ {{formData.all_price}}元</view> | |
229 | + <view class="co-red">¥ {{filters.toFix(allpice,2)}}元</view> | |
458 | 230 | </view> |
459 | - <view class="item" wx:if="{{formData.shipping_price>0}}"> | |
231 | + <view class="item" wx:if="{{exp_price>0}}"> | |
460 | 232 | <view>配送费用</view> |
461 | - <view class="co-red">¥ {{formData.shipping_price}}元</view> | |
233 | + <view class="co-red">¥ {{filters.toFix(exp_price,2)}}元</view> | |
462 | 234 | </view> |
463 | - <view class="item" wx:if="{{formData.coupon_price>0}}"> | |
464 | - <view>使用优惠券</view> | |
465 | - <view class="co-red">- ¥ {{formData.coupon_price}}元</view> | |
466 | - </view> | |
467 | - <!-- 优惠活动优惠金额 --> | |
468 | - <view class="item" wx:if="{{formData.cut_price>0}}"> | |
469 | - <view>优惠活动</view> | |
470 | - <view class="co-red">- ¥ {{filters.toFix(formData.cut_price,2)}}元</view> | |
471 | - </view> | |
472 | - <!-- 组合购优惠金额 --> | |
473 | - <view class="item" wx:if="{{formData.zh_cut_price>0 || formData.zh_cut_price<0}}"> | |
474 | - <view>组合购优惠</view> | |
475 | - <view class="co-red">- ¥ {{filters.toFix(formData.zh_cut_price,2)}}元</view> | |
235 | + | |
236 | + <view class="item" wx:if="{{quan_price>0}}"> | |
237 | + <view>优惠券优惠</view> | |
238 | + <view class="co-red">¥ -{{filters.toFix(quan_price,2)}}元</view> | |
476 | 239 | </view> |
477 | 240 | |
478 | - <!-- 订单优惠优惠金额 --> | |
479 | - <view class="item" wx:if="{{formData.order_prom_amount>0}}"> | |
241 | + <view class="item" wx:if="{{order_prom_amount>0}}"> | |
480 | 242 | <view>订单优惠</view> |
481 | - <view class="co-red">- ¥ {{filters.toFix(formData.order_prom_amount,2)}}元</view> | |
482 | - </view> | |
483 | - <view class="item" wx:if="{{formData.user_money>0}}"> | |
484 | - <view>使用余额</view> | |
485 | - <view class="co-red">- ¥ {{formData.user_money}}元</view> | |
243 | + <view class="co-red">¥ -{{filters.toFix(order_prom_amount,2)}}元</view> | |
486 | 244 | </view> |
245 | + | |
487 | 246 | </view> |
488 | 247 | |
489 | 248 | <view class="information bdr14 mgt20"> |
490 | 249 | <view class="item"> |
491 | 250 | <view>阶段一:定金(待付款)</view> |
492 | - <view class="co-red">¥9.99元</view> | |
251 | + <view class="co-red">¥{{filters.toFix(pre_arr.presell_money*order.order_goods.goods_num,2)}}元</view> | |
493 | 252 | </view> |
494 | 253 | <view class="item"> |
495 | 254 | <view>阶段二:尾款</view> |
496 | - <view class="co-red">¥88元</view> | |
255 | + <view class="co-red">¥{{filters.toFix(tail_pay,2)}}元</view> | |
497 | 256 | </view> |
498 | 257 | </view> |
499 | - | |
500 | - <view class="information bdr14 mgt20"> | |
501 | - <view class="item ai-center"> | |
502 | - <view>我同意预售商品不退定金</view> | |
503 | - <switch type="switch" checked="" bindchange="switchChange"/> | |
504 | - </view> | |
505 | - </view> | |
506 | - | |
507 | 258 | </view> |
508 | 259 | |
509 | - <view class="fixedToBottom shadow-1" wx:if="{{show_submit}}"> | |
510 | - <!-- <view class="date-container">尾款时间:2021.10.01 00:00:00 - 2021.10.10 23:59:59</view> --> | |
511 | - <view class="date-container">请于*天**小时**分**秒内付款完成,超时订单将自动取消</view> | |
512 | - <view class="btn-wrap"> | |
260 | + <view class="fixedToBottom shadow-1" wx:if="{{wait_wk}}" > | |
261 | + <view wx:if="{{no_start}}" class="date-container">尾款时间{{filters.format_time(presell.kw_start_time,1)}} - {{filters.format_time(presell.kw_end_time,1)}}</view> | |
262 | + <view wx:elif="{{is_end}}" class="date-container">尾款时间已经结束</view> | |
263 | + <view wx:elif="{{wait_wk && !no_start}}" class="date-container">请于{{days}}天{{hours}}小时{{minutes}}分{{seconds}}秒内付款完成,超时订单将自动取消</view> | |
264 | + | |
265 | + <view class="btn-wrap" > | |
513 | 266 | <view class="pay-amount"> |
514 | - <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view> | |
515 | - <!-- 预售 --> | |
516 | - <!-- <view class="payable">尾款:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view> --> | |
267 | + <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{filters.toFix(order_m-presell.presell_deposit,2)}}</text></view> | |
517 | 268 | </view> |
518 | - <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
269 | + <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray" >提交订单</button> | |
270 | + <button wx:else class="tips-btn" bindtap="show_pay" >提交订单</button> | |
519 | 271 | <!-- 预售 --> |
520 | 272 | <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> --> |
521 | 273 | </view> |
... | ... | @@ -687,6 +439,7 @@ |
687 | 439 | </view> |
688 | 440 | </view> |
689 | 441 | </view> |
442 | + | |
690 | 443 | <!----弹起选择物流名的列表----> |
691 | 444 | <view wx:if='{{open_express==1}}'> |
692 | 445 | <view class="cover-layer flex-center " bindtap='close_express'> |
... | ... | @@ -729,20 +482,29 @@ |
729 | 482 | </view> |
730 | 483 | </view> |
731 | 484 | <warn id="warn"></warn> |
732 | -<!-- 是不是使用店铺优惠pop --> | |
733 | -<view class="cover-layer flex ai-center" bindtap="close_offline" wx:if="{{is_offline_show}}"> | |
734 | - <view style="background-color: #fff; width: 540rpx; margin: 0 auto; border-radius: 20rpx;"> | |
735 | - <view class="fs32" style="text-align: center;height: 80rpx; line-height: 80rpx;">店铺优惠</view> | |
736 | - <view class="flex jc_sb ai-center fs28" style="height: 80rpx; width: 400rpx; margin-left: 70rpx;"> | |
737 | - <view catchtap="sure_offline" class="flex ai-center" >优惠¥{{show_off_price}} | |
738 | - <icon style="margin-left: 10rpx;" color="{{is_get_offline?'red':'gray'}}" size="14" type="success" role="img"></icon></view> | |
739 | - <view catchtap="cancle_offline" class="flex ai-center" >不用优惠 | |
740 | - <icon style="margin-left: 10rpx;" color="{{is_get_offline!=1?'red':'gray'}}" size="14" type="success" role="img"></icon> </view> | |
741 | - </view> | |
742 | - </view> | |
743 | -</view> | |
485 | + | |
744 | 486 | |
745 | 487 | <!-- 客服 --> |
746 | 488 | <view class="kefu-container shadow-1"> |
747 | - <text class="iconfont icon-kefu fs60 co-red"></text> | |
489 | + <block wx:if="{{sys_switch.weapp_customertype}}" > | |
490 | + <button wx:if="{{sys_switch.weapp_customertype}}" class="kefu-btn" | |
491 | + open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | |
492 | + <text class="iconfont icon-kefu fs60 co-red"></text> | |
493 | + </button> | |
494 | + </block> | |
495 | + <block wx:else> | |
496 | + <text class="iconfont icon-kefu fs60 co-red"></text> | |
497 | + </block> | |
748 | 498 | </view> |
499 | + | |
500 | +<!--支付的方式选择,0微信支付 1余额支付--> | |
501 | +<block wx:if="{{show_pay_type}}"> | |
502 | + <view class="cover-layer" bindtap="close_show_pay"></view> | |
503 | + <view class="pay_type_view"> | |
504 | + <view class="title">请选择支付方式</view> | |
505 | + <view class="anniu_view"> | |
506 | + <view bindtap="set_pay_type" data-type="0" >微信支付</view> | |
507 | + <view bindtap="set_pay_type" data-type="1" >余额支付</view> | |
508 | + </view> | |
509 | + </view> | |
510 | +</block> | ... | ... |
packageC/pages/presell/cart/cart.wxss
... | ... | @@ -42,13 +42,17 @@ page { |
42 | 42 | |
43 | 43 | .tab-wrapper { |
44 | 44 | background-color: #ccc; |
45 | - display: flex; | |
46 | - border-radius: 40rpx; | |
47 | - overflow: hidden; | |
45 | + display: flex; | |
46 | + border-radius: 40rpx; | |
47 | + overflow: hidden; | |
48 | + width: auto; | |
49 | + margin-top: 20rpx; | |
50 | + align-self: baseline; | |
51 | + font-size: 30rpx; | |
48 | 52 | } |
49 | 53 | |
50 | 54 | .tab { |
51 | - padding: 20rpx 30rpx; | |
55 | + padding: 15rpx 25rpx; | |
52 | 56 | |
53 | 57 | } |
54 | 58 | |
... | ... | @@ -320,6 +324,10 @@ margin:auto; */ |
320 | 324 | margin-right: 0; |
321 | 325 | } |
322 | 326 | |
327 | +.tips-btn.gray{ | |
328 | +background-color:#e5e5e5;color: #666; | |
329 | +} | |
330 | + | |
323 | 331 | .pay-amount { |
324 | 332 | /* float: right; |
325 | 333 | display: flex; |
... | ... | @@ -996,12 +1004,22 @@ margin-left: 20rpx; |
996 | 1004 | } |
997 | 1005 | |
998 | 1006 | |
1007 | + | |
1008 | +.circle1 { | |
1009 | + display: block; | |
1010 | + width: 10rpx; | |
1011 | + height: 10rpx; | |
1012 | + border-radius: 50%; | |
1013 | + margin: 0 auto; | |
1014 | + background-color: #ccc; | |
1015 | +} | |
1016 | + | |
1017 | + | |
999 | 1018 | .circle { |
1000 | 1019 | display: block; |
1001 | 1020 | width: 10rpx; |
1002 | 1021 | height: 10rpx; |
1003 | 1022 | border-radius: 50%; |
1004 | - background-color: #ccc; | |
1005 | 1023 | margin: 0 auto; |
1006 | 1024 | } |
1007 | 1025 | |
... | ... | @@ -1056,7 +1074,25 @@ margin-left: 20rpx; |
1056 | 1074 | box-shadow: 0 4rpx 12px #e7e9eb; |
1057 | 1075 | } |
1058 | 1076 | |
1059 | -/* .icon-kefu { | |
1060 | - font-size: 40rpx; | |
1077 | +.kefu-btn{ | |
1078 | + width: 100%; | |
1079 | + height: 100%; | |
1080 | + text-align: center; | |
1081 | + line-height: 100rpx; | |
1082 | + border: none; | |
1083 | + background: none; | |
1084 | + border-radius: 50rpx; | |
1085 | +} | |
1086 | + | |
1087 | +.pay_type_view{width: 500rpx;height: 220rpx; position: fixed; background: #fff;z-index: 12; | |
1088 | + left: 50%; margin-left: -250rpx; top: 50%; margin-top: -110rpx; text-align: center; border-radius: 12rpx;} | |
1089 | +.pay_type_view .title{ height:100rpx; line-height: 100rpx; border-bottom: 1rpx solid #ededed;} | |
1090 | +.anniu_view{display: flex;height: 120rpx; line-height: 120rpx;} | |
1091 | +.anniu_view>view{width: 50%; border-right:1rpx solid #ededed;} | |
1092 | + | |
1093 | +.gray{color:#aaa} | |
1094 | +.note_text{ | |
1095 | + width: 300rpx;margin-left: 20rpx;height: 52rpx; line-height: 52rpx; display: inline-block | |
1061 | 1096 | } |
1062 | - */ | |
1097 | + | |
1098 | + | ... | ... |
packageC/pages/presell/cart/cart2_pre.js
... | ... | @@ -52,7 +52,7 @@ Page({ |
52 | 52 | isclose:1, |
53 | 53 | is_express:0,//选择物流的控制器 |
54 | 54 | yuer:0, |
55 | - | |
55 | + agree_no_ref:0 | |
56 | 56 | }, |
57 | 57 | onLoad: function(t) { |
58 | 58 | var th = this; this.setData({ is_b_now: 1}); |
... | ... | @@ -241,7 +241,6 @@ Page({ |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | - | |
245 | 244 | //先获取是否有关闭使用优惠券 |
246 | 245 | getApp().getConfig2(function (ee) { |
247 | 246 | var json_d = JSON.parse(ee.switch_list); |
... | ... | @@ -398,8 +397,9 @@ Page({ |
398 | 397 | }); |
399 | 398 | }); |
400 | 399 | }, |
401 | - //--------------------提交订单----------------------- | |
402 | - submitForm: async function(t){ | |
400 | + | |
401 | + // -- 支付的下一步 -- | |
402 | + submitForm_next:async function(t){ | |
403 | 403 | if(this.data.is_summit_ing==1) return false; //--提交中退出-- |
404 | 404 | this.data.is_summit_ing=1; |
405 | 405 | |
... | ... | @@ -409,217 +409,230 @@ Page({ |
409 | 409 | |
410 | 410 | //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 |
411 | 411 | if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ |
412 | - ff = false; | |
413 | - getApp().my_warnning("请选择收货地址",0,this); | |
414 | - this.data.is_summit_ing = 0; | |
412 | + ff = false; | |
413 | + getApp().my_warnning("请选择收货地址",0,this); | |
414 | + this.data.is_summit_ing = 0; | |
415 | 415 | } |
416 | 416 | if (!ff) return false; |
417 | 417 | var addr = th.data.user_addr; |
418 | 418 | if (th.data.bn_exp_type == 1) addr=null; |
419 | 419 | |
420 | 420 | if(th.data.bn_exp_type==0 && (th.data.kt_type!=3)) { |
421 | - if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { | |
422 | - getApp().my_warnning("读取物流失败",0,this); | |
423 | - this.data.is_summit_ing = 0; | |
424 | - return false; | |
425 | - } | |
421 | + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { | |
422 | + getApp().my_warnning("读取物流失败",0,this); | |
423 | + this.data.is_summit_ing = 0; | |
424 | + return false; | |
425 | + } | |
426 | 426 | } |
427 | - | |
428 | - //阶梯团强制带1,自提~~~ | |
429 | - if(th.data.kt_type==3 ){ | |
430 | - th.data.bn_exp_type=1; | |
431 | - } | |
432 | - | |
427 | + | |
428 | + //阶梯团强制带1,自提~~~ | |
429 | + if(th.data.kt_type==3 ){ | |
430 | + th.data.bn_exp_type=1; | |
431 | + } | |
432 | + | |
433 | 433 | var item={ |
434 | - 'user_id':app.globalData.user_id, | |
435 | - 'consignee': addr == null ? "" : addr.consignee, | |
436 | - 'province': addr == null ? 0 : addr.province, | |
437 | - 'city': addr == null ? 0 : addr.city, | |
438 | - 'district': addr == null ? 0 : addr.district, | |
439 | - 'twon': addr == null ? 0 : addr.twon, | |
440 | - 'address': addr == null ? "": addr.address, | |
441 | - 'more_address': addr == null ? "" : addr.more_address, | |
442 | - 'mobile': addr == null ? th.data.userinfo.mobile:addr.mobile, | |
443 | - 'email':'', | |
444 | - 'invoice_title':'', | |
445 | - 'goods_price': th.data.formData.all_price, //商品总价 | |
446 | - 'shipping_price': th.data.formData.shipping_price, //物流金额 | |
447 | - 'user_money': th.data.formData.user_money, //使用余额 | |
448 | - 'total_amount': th.data.formData.total_amount, //订单总价 | |
449 | - 'order_amount': th.data.formData.order_amount, //应付 | |
450 | - 'user_note': t.detail.value.user_note, //用户备注 | |
451 | - 'store_id':os.stoid, //商家 | |
452 | - 'pickup_id': th.data.bn_pick, //门店 | |
453 | - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 | |
454 | - 'prom_id': th.data.bn_goods.prom_id, //促销活动id | |
455 | - 'order_goods':new Array(), | |
456 | - }; | |
457 | - | |
458 | - //老会员成为分销下线需要的参数 | |
459 | - if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){ | |
460 | - //判断一下分享人是不是分享商 | |
461 | - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{ | |
462 | - if(res.data.code==0){ | |
463 | - var user= res.data.data; | |
464 | - if(user.is_distribut==1){ | |
465 | - item.first_leader=parseInt(getApp().globalData.first_leader); | |
466 | - } | |
467 | - } | |
468 | - }) | |
469 | - } | |
470 | - | |
471 | - if(th.data.qh!='') | |
472 | - { | |
473 | - item.team_qh=th.data.qh; | |
474 | - item.pt_listno=th.data.qh; | |
475 | - } | |
476 | - | |
477 | - var gg =app.get_b_now(); | |
478 | - var goods={ | |
479 | - 'goods_id': gg.goods_id, | |
480 | - 'goods_name': gg.goods_name, | |
481 | - 'goods_sn': gg.goods_sn, | |
482 | - 'goods_num': gg.goods_num, | |
483 | - 'market_price': th.data.bn_goods.market_price, | |
484 | - 'goods_price': th.data.bn_goods.shop_price, | |
485 | - 'member_goods_price': th.data.bn_goods.shop_price, | |
486 | - 'store_id': os.stoid, | |
487 | - 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 | |
488 | - 'prom_id': th.data.bn_goods.prom_id, //促销活动id | |
489 | - }; | |
490 | - | |
491 | - //--导购分享过来的id-- | |
492 | - if(gg.guide_id){ | |
434 | + 'user_id':app.globalData.user_id, | |
435 | + 'consignee': addr == null ? "" : addr.consignee, | |
436 | + 'province': addr == null ? 0 : addr.province, | |
437 | + 'city': addr == null ? 0 : addr.city, | |
438 | + 'district': addr == null ? 0 : addr.district, | |
439 | + 'twon': addr == null ? 0 : addr.twon, | |
440 | + 'address': addr == null ? "": addr.address, | |
441 | + 'more_address': addr == null ? "" : addr.more_address, | |
442 | + 'mobile': addr == null ? th.data.userinfo.mobile:addr.mobile, | |
443 | + 'email':'', | |
444 | + 'invoice_title':'', | |
445 | + 'goods_price': th.data.formData.all_price, //商品总价 | |
446 | + 'shipping_price': th.data.formData.shipping_price, //物流金额 | |
447 | + 'user_money': th.data.formData.user_money, //使用余额 | |
448 | + 'total_amount': th.data.formData.total_amount, //订单总价 | |
449 | + 'order_amount': th.data.formData.order_amount, //应付 | |
450 | + 'user_note': t.detail.value.user_note, //用户备注 | |
451 | + 'store_id':os.stoid, //商家 | |
452 | + 'pickup_id': th.data.bn_pick, //门店 | |
453 | + 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 | |
454 | + 'prom_id': th.data.bn_goods.prom_id, //促销活动id | |
455 | + 'order_goods':new Array(), | |
456 | + }; | |
457 | + | |
458 | + //老会员成为分销下线需要的参数 | |
459 | + if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){ | |
460 | + //判断一下分享人是不是分享商 | |
461 | + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{ | |
462 | + if(res.data.code==0){ | |
463 | + var user= res.data.data; | |
464 | + if(user.is_distribut==1){ | |
465 | + item.first_leader=parseInt(getApp().globalData.first_leader); | |
466 | + } | |
467 | + } | |
468 | + }) | |
469 | + } | |
470 | + | |
471 | + if(th.data.qh!='') | |
472 | + { | |
473 | + item.team_qh=th.data.qh; | |
474 | + item.pt_listno=th.data.qh; | |
475 | + } | |
476 | + | |
477 | + var gg =app.get_b_now(); | |
478 | + var goods={ | |
479 | + 'goods_id': gg.goods_id, | |
480 | + 'goods_name': gg.goods_name, | |
481 | + 'goods_sn': gg.goods_sn, | |
482 | + 'goods_num': gg.goods_num, | |
483 | + 'market_price': th.data.bn_goods.market_price, | |
484 | + 'goods_price': th.data.bn_goods.shop_price, | |
485 | + 'member_goods_price': th.data.bn_goods.shop_price, | |
486 | + 'store_id': os.stoid, | |
487 | + 'prom_type':th.data.bn_goods.prom_type, //促销活动类型 | |
488 | + 'prom_id': th.data.bn_goods.prom_id, //促销活动id | |
489 | + }; | |
490 | + | |
491 | + //--导购分享过来的id-- | |
492 | + if(gg.guide_id){ | |
493 | 493 | goods.guide_id=gg.guide_id; |
494 | 494 | goods.guide_type=gg.guide_type; |
495 | 495 | //调用接口判断是不是会员 |
496 | 496 | await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/"+os.stoid+"/"+gg.guide_id,{}).then(res=>{ |
497 | - if(res.data.code==0){ | |
498 | - goods.guide_name=res.data.data.salesman; | |
499 | - goods.guide_sn=res.data.data.salesman_no; | |
500 | - } | |
501 | - }) | |
502 | - } | |
497 | + if(res.data.code==0){ | |
498 | + goods.guide_name=res.data.data.salesman; | |
499 | + goods.guide_sn=res.data.data.salesman_no; | |
500 | + } | |
501 | + }) | |
502 | + } | |
503 | 503 | |
504 | 504 | //--商品的房间号-- |
505 | 505 | if(gg.room_id && gg.room_id>0){ |
506 | 506 | item.room_ids=gg.room_id; |
507 | 507 | goods.room_id=gg.room_id; |
508 | 508 | } |
509 | - | |
510 | - if(th.data.bn_goods.is_normal){goods.is_pd_normal=1;} | |
511 | - | |
512 | - item.order_goods.push(goods); | |
513 | - pdata.push(item); | |
514 | - | |
515 | - if (pdata.length==0) return; | |
516 | - var str = JSON.stringify(pdata); | |
517 | - wx.showLoading({title: "加载中"}); | |
518 | - wx.request({ | |
519 | - url: os.url + '/api/weshop/order/createWxdOrder', | |
520 | - data: str, | |
521 | - method: 'POST', | |
522 | - header: { | |
523 | - 'content-type': 'application/json' | |
524 | - },// 设置请求的 header | |
525 | - success: function (res) { | |
526 | - | |
527 | - wx.hideLoading(); | |
528 | - if (res.statusCode == 200) { | |
529 | - var data=res.data; | |
530 | - if(data.code==0){ | |
531 | - console.log(th.data.is_b_now); | |
532 | - //如果是购物车结算,还要删除购物车 | |
533 | - if (th.data.is_b_now == 0) { | |
534 | - console.log(th.data.cartlist_y); | |
535 | - var list = th.data.cartlist_y; | |
536 | - for (var i = 0; i < list.length; i++) { | |
537 | - //删除购物车 | |
538 | - getApp().request.delete("/api/weshop/cart/del/" + os.stoid + "/" + list[i].id, {}); | |
539 | - } | |
540 | - } | |
541 | - var order_amount = 0; | |
542 | - pdata.forEach(function (em, ind) { | |
543 | - order_amount += em.order_amount; | |
544 | - }) | |
545 | - //要进行判断,如果是用微信支付,就要跳转到支付界面 | |
546 | - if (order_amount > 0) { | |
547 | - th.setData({ isclose: 0 }); | |
548 | - //void e.jumpToCart4({ | |
549 | - // order_sn: data.data, | |
550 | - // type:1, | |
551 | - // }, 1); | |
552 | - util_pay.pay(data.data, function() { | |
553 | - setTimeout(function () { | |
554 | - wx.reLaunch({ | |
555 | - //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data, | |
556 | - url: "/pages/team/team_success/team_success?ordersn=" + data.data, | |
557 | - }) | |
558 | - },1000) | |
559 | - }, function () { | |
560 | - //支付失败 | |
561 | - setTimeout(function () { | |
562 | - //wx.navigateBack({ delta: 1 }) | |
563 | - wx.reLaunch({ | |
564 | - url: "/pages/user/order_list/order_list", | |
565 | - }) | |
566 | - },1000) | |
567 | - | |
568 | - },os.stoid,1); | |
569 | 509 | |
570 | - } else { | |
571 | - var dd = { | |
572 | - parent_sn: data.data, | |
573 | - store_id: os.stoid, | |
574 | - type: 1, | |
575 | - }; | |
576 | - //return false; | |
577 | - getApp().request.post("/api/weshop/order/pay/createOrder", { | |
578 | - data: dd, | |
579 | - success: function (t) { | |
580 | - console.log(t); | |
581 | - app.my_warnning("支付成功",1,th); | |
582 | - setTimeout(function () { | |
583 | - th.setData({ isclose: 0 }); | |
584 | - | |
585 | - if(th.data.is_normal==1){ | |
586 | - /*-- | |
587 | - wx.navigateTo({ | |
588 | - url: "/pages/user/order_list/order_list", | |
589 | - })--*/ | |
590 | - var url="/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data; | |
591 | - wx.reLaunch({ | |
592 | - url: url | |
593 | - }) | |
594 | - | |
595 | - }else{ | |
596 | - wx.reLaunch({ | |
597 | - url: "/pages/team/team_success/team_success?ordersn=" + data.data, | |
598 | - }) | |
510 | + if(th.data.bn_goods.is_normal){goods.is_pd_normal=1;} | |
511 | + | |
512 | + item.order_goods.push(goods); | |
513 | + pdata.push(item); | |
514 | + | |
515 | + if (pdata.length==0) return; | |
516 | + var str = JSON.stringify(pdata); | |
517 | + wx.showLoading({title: "加载中"}); | |
518 | + wx.request({ | |
519 | + url: os.url + '/api/weshop/order/createWxdOrder', | |
520 | + data: str, | |
521 | + method: 'POST', | |
522 | + header: { | |
523 | + 'content-type': 'application/json' | |
524 | + },// 设置请求的 header | |
525 | + success: function (res) { | |
526 | + | |
527 | + wx.hideLoading(); | |
528 | + if (res.statusCode == 200) { | |
529 | + var data=res.data; | |
530 | + if(data.code==0){ | |
531 | + console.log(th.data.is_b_now); | |
532 | + //如果是购物车结算,还要删除购物车 | |
533 | + if (th.data.is_b_now == 0) { | |
534 | + console.log(th.data.cartlist_y); | |
535 | + var list = th.data.cartlist_y; | |
536 | + for (var i = 0; i < list.length; i++) { | |
537 | + //删除购物车 | |
538 | + getApp().request.delete("/api/weshop/cart/del/" + os.stoid + "/" + list[i].id, {}); | |
539 | + } | |
540 | + } | |
541 | + var order_amount = 0; | |
542 | + pdata.forEach(function (em, ind) { | |
543 | + order_amount += em.order_amount; | |
544 | + }) | |
545 | + //要进行判断,如果是用微信支付,就要跳转到支付界面 | |
546 | + if (order_amount > 0) { | |
547 | + th.setData({ isclose: 0 }); | |
548 | + util_pay.pay(data.data, function() { | |
549 | + var url="/packageC/pages/presell/cart/cart?order_sn="+data.data; | |
550 | + setTimeout(function () { | |
551 | + wx.reLaunch({ url: url,}) | |
552 | + },1000) | |
553 | + }, function () { | |
554 | + //支付失败 | |
555 | + setTimeout(function () { | |
556 | + //wx.navigateBack({ delta: 1 }) | |
557 | + wx.reLaunch({ | |
558 | + url: "/pages/user/order_list/order_list", | |
559 | + }) | |
560 | + },1000) | |
561 | + | |
562 | + },os.stoid,1); | |
563 | + | |
564 | + } else { | |
565 | + var dd = { | |
566 | + parent_sn: data.data, | |
567 | + store_id: os.stoid, | |
568 | + type: 1, | |
569 | + }; | |
570 | + //return false; | |
571 | + getApp().request.post("/api/weshop/order/pay/createOrder", { | |
572 | + data: dd, | |
573 | + success: function (t) { | |
574 | + console.log(t); | |
575 | + app.my_warnning("支付成功",1,th); | |
576 | + setTimeout(function () { | |
577 | + th.setData({ isclose: 0 }); | |
578 | + | |
579 | + | |
580 | + var url="/packageC/pages/presell/cart/cart?order_sn="+data.data; | |
581 | + wx.reLaunch({ | |
582 | + url: url | |
583 | + }) | |
584 | + | |
585 | + | |
586 | + | |
587 | + }, 1000) | |
588 | + } | |
589 | + }); | |
599 | 590 | } |
600 | - | |
601 | - }, 1000) | |
602 | 591 | } |
603 | - }); | |
592 | + else{ | |
593 | + th.data.is_summit_ing=0; //是否提交中 | |
594 | + getApp().confirmBox(data.msg); | |
595 | + } | |
596 | + } else { | |
597 | + th.data.is_summit_ing=0; //是否提交中 | |
598 | + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); | |
604 | 599 | } |
605 | - } | |
606 | - else{ | |
607 | - th.data.is_summit_ing=0; //是否提交中 | |
608 | - getApp().confirmBox(data.msg); | |
609 | - } | |
610 | - } else { | |
611 | - th.data.is_summit_ing=0; //是否提交中 | |
612 | - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); | |
613 | - } | |
614 | - }, | |
615 | - fail: function () { | |
616 | - th.data.is_summit_ing=0; //是否提交中 | |
617 | - wx.hideLoading(); | |
618 | - console.log("index.js wx.request CheckCallUser fail"); | |
619 | - }, | |
620 | - complete: function () {} | |
621 | - }) | |
600 | + }, | |
601 | + fail: function () { | |
602 | + th.data.is_summit_ing=0; //是否提交中 | |
603 | + wx.hideLoading(); | |
604 | + console.log("index.js wx.request CheckCallUser fail"); | |
605 | + }, | |
606 | + complete: function () {} | |
607 | + }) | |
622 | 608 | }, |
609 | + | |
610 | + | |
611 | + //--------------------提交订单----------------------- | |
612 | + submitForm: function(t){ | |
613 | + var th=this; | |
614 | + //如果商家不同意退定义 | |
615 | + if(!this.data.act.is_refundmoney && !th.agree_no_ref){ | |
616 | + wx.showModal({ | |
617 | + content: ' 预售商品不允许退定金!是否继续下单?', | |
618 | + showCancel: true,//是否显示取消按钮 | |
619 | + cancelText:"我在想想",//默认是“取消” | |
620 | + confirmText:"继续下单",//默认是“确定” | |
621 | + success: function (res) { | |
622 | + if (res.cancel) { | |
623 | + //点击取消,默认隐藏弹框 | |
624 | + } else { | |
625 | + th.setData({agree_no_ref:1}) | |
626 | + th.submitForm_next(t) | |
627 | + } | |
628 | + }, | |
629 | + }) | |
630 | + | |
631 | + }else{ | |
632 | + this.submitForm_next(t); | |
633 | + } | |
634 | + }, | |
635 | + | |
623 | 636 | useCoupon: function() { |
624 | 637 | if (this.data.order.couponNum <= 0) { |
625 | 638 | //return t.showWarning("无可用优惠券"); |
... | ... | @@ -828,5 +841,11 @@ Page({ |
828 | 841 | buycard:function(){ |
829 | 842 | getApp().goto("/pages/user/plus/plus"); |
830 | 843 | getApp().globalData.plus_buy_back=1; |
831 | - } | |
844 | + }, | |
845 | + | |
846 | + switchChange:function (e) { | |
847 | + console.log(e,111); | |
848 | + this.setData({agree_no_ref:e.detail.value}); | |
849 | + } | |
850 | + | |
832 | 851 | }); | ... | ... |
packageC/pages/presell/cart/cart2_pre.wxml
1 | -<wxs module="filters" src="../../../utils/filter.wxs"></wxs> | |
1 | +<wxs module="filters" src="../../../../utils/filter.wxs"></wxs> | |
2 | 2 | <form bindsubmit="submitForm"> |
3 | 3 | <view class="container"> |
4 | 4 | <view class="tab-container" wx:if="{{act.presell_type==1}}"> |
... | ... | @@ -99,7 +99,6 @@ |
99 | 99 | </view> |
100 | 100 | </view> |
101 | 101 | </block> |
102 | - | |
103 | 102 | <!--阶梯团是不显示的 |
104 | 103 | <block wx:if="{{kt_type!=3 || is_normal==1 }}"> |
105 | 104 | <view class="use-item" hidden='{{bn_exp_type==1}}'> |
... | ... | @@ -109,7 +108,6 @@ |
109 | 108 | </picker> |
110 | 109 | </view> |
111 | 110 | </block>--> |
112 | - | |
113 | 111 | </view> |
114 | 112 | |
115 | 113 | |
... | ... | @@ -122,6 +120,14 @@ |
122 | 120 | </view> |
123 | 121 | </block> |
124 | 122 | |
123 | + <!-- 不下单的时候退款定金 --> | |
124 | + <view class="information bdr14" style="margin-bottom: 20rpx" wx:if="{{!act.is_refundmoney}}"> | |
125 | + <view class="item ai-center"> | |
126 | + <view>我同意预售商品不退定金</view> | |
127 | + <switch style="transform: scale(0.7);position: relative; right: -24rpx" type="switch" checked="{{agree_no_ref?true:false}}" bindchange="switchChange"/> | |
128 | + </view> | |
129 | + </view> | |
130 | + | |
125 | 131 | <view class="information bdr14"> |
126 | 132 | <!-----使用余额------> |
127 | 133 | <view class="set-mes" wx:if="{{userinfo.user_money>0 && yuer>0}}"> | ... | ... |
packageC/pages/presell/cart/cart2_pre.wxss
packageC/pages/presell/cart/zh_calculate.js deleted
1 | -var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
2 | -module.exports = { | |
3 | - //主要的作用,就是把组合购多余的商品进行拆分, | |
4 | - //如果没有达成组合购的要求,所有的商品都打回原价购买 | |
5 | - fir_set_arr: function (c_item) { | |
6 | - //组合活动,以及组合活动从表的商品 | |
7 | - let zh_prom_goods = c_item.zh_prom_goods; | |
8 | - let goods = c_item.goods; //一个门店中所有的商品 | |
9 | - let tfeel = 0,cut_price=0, offline_price = 0, offline_num = 0; | |
10 | - let txt_ite = c_item.need_list; | |
11 | - //多个活动要拿来循环一下 | |
12 | - for (let i in zh_prom_goods) { | |
13 | - let title = ""; //提示语; | |
14 | - //其中的一个活动 | |
15 | - let act_item = zh_prom_goods[i]; | |
16 | - let act_goos = act_item.gdlist; | |
17 | - let act = act_item.act; | |
18 | - | |
19 | - let all_num = 0; //商品数量之和 | |
20 | - let all_price0 = 0; //商品数量之和 | |
21 | - let aprice=0; //达到活动条件的购买价格 | |
22 | - let need_to_buy = 0; | |
23 | - let all_zhqty = 0; //所有商品要求起购数之和 | |
24 | - let no_in_arr = []; //剩余的未加入组合购 | |
25 | - let out_arr=[]; //超出活动限购的商品放入 | |
26 | - | |
27 | - //-- 寻找一下 -- | |
28 | - function get_num2(ite) { | |
29 | - for (let v2 in goods) { | |
30 | - var vh = goods[v2]; | |
31 | - if (vh.goods_id == ite.goods_id) { | |
32 | - return vh; | |
33 | - } | |
34 | - } | |
35 | - return 0; | |
36 | - } | |
37 | - | |
38 | - for (let j in act_goos) { | |
39 | - let item = act_goos[j]; | |
40 | - let item_j = goods.find(function (ele) { | |
41 | - return ele.goods_id == act_goos[j].goods_id; | |
42 | - }) | |
43 | - //-- 如果有找到的话 -- | |
44 | - if (item_j) { | |
45 | - act_goos[j].num = item_j.goods_num; | |
46 | - act_goos[j].goods_price = item_j.goods_price; | |
47 | - var cart_num=item.cart_num =item_j.goods_num; | |
48 | - var zh_b_num=item_j.promgoodsbuynum; | |
49 | - if(item.buyqty>0){ | |
50 | - var cbuy=item.buyqty-zh_b_num; | |
51 | - //当可买的数量为0 | |
52 | - if(cbuy<=0){ | |
53 | - item.num=0; | |
54 | - out_arr.push({ | |
55 | - price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num | |
56 | - }) | |
57 | - }else{ | |
58 | - if(cbuy>=cart_num) item.num =cart_num; | |
59 | - else{ | |
60 | - item.num =cbuy; | |
61 | - out_arr.push({ | |
62 | - price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num-cbuy | |
63 | - }) | |
64 | - } | |
65 | - } | |
66 | - } | |
67 | - | |
68 | - all_num += item.num; | |
69 | - //当有起购数的控制的时候 | |
70 | - if (item.zhqty) { | |
71 | - all_zhqty += item.zhqty; | |
72 | - if (item.num < item.zhqty) { | |
73 | - need_to_buy += item.zhqty - item.num; | |
74 | - } | |
75 | - if (item.num > item.zhqty) { | |
76 | - for (let i = 0; i < item.num - item.zhqty; i++) { | |
77 | - no_in_arr.push({ | |
78 | - price: item.goods_price, goods_id: item.goods_id, offline_price: item_j.offline_price | |
79 | - }) | |
80 | - } | |
81 | - } | |
82 | - } else { | |
83 | - for (let j = 0; j < item.num; j++) { | |
84 | - no_in_arr.push({ | |
85 | - price: item.goods_price, goods_id: item.goods_id, offline_price: item_j.offline_price | |
86 | - }) | |
87 | - } | |
88 | - } | |
89 | - } else { | |
90 | - if (item.zhqty) { | |
91 | - title = "必买商品未加购,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】"; | |
92 | - need_to_buy += item.zhqty; | |
93 | - } | |
94 | - } | |
95 | - | |
96 | - } | |
97 | - | |
98 | - //当满足组合的要求:总数要满足,起购数要满足 | |
99 | - if (all_num >= act.zhbuyqty && !need_to_buy) { | |
100 | - function sortData(a, b) { | |
101 | - return a.price - b.price | |
102 | - } | |
103 | - | |
104 | - if(no_in_arr.length>0) no_in_arr.sort(sortData); | |
105 | - | |
106 | - aprice = act.zhprice; | |
107 | - if (act.zhbuyqty > all_zhqty) { | |
108 | - for (let n = 0; n < act.zhbuyqty-all_zhqty; n++) { | |
109 | - no_in_arr.pop(); | |
110 | - } | |
111 | - } | |
112 | - //看一下剩下的数量有没有满足组合购的要求,以及要不要倍增 | |
113 | - if (act.is_bz && no_in_arr.length >= act.zhbuyqty) { | |
114 | - //看一下是几倍 | |
115 | - let be = parseInt(no_in_arr.length / act.zhbuyqty); | |
116 | - aprice += be * act.zhprice; | |
117 | - for (let m = 0; m < be * act.zhbuyqty; m++) { | |
118 | - no_in_arr.pop(); | |
119 | - } | |
120 | - } | |
121 | - | |
122 | - | |
123 | - let goods_map = {}; | |
124 | - //算一下剩余的商品 | |
125 | - if(no_in_arr.length) { | |
126 | - for (let ii in no_in_arr) { | |
127 | - let item = no_in_arr[ii]; | |
128 | - if (item.offline_price) { | |
129 | - offline_price += item.price - item.offline_price; | |
130 | - offline_num += 1; | |
131 | - } | |
132 | - if (goods_map[item.goods_id]) { | |
133 | - var num = goods_map[item.goods_id]; | |
134 | - goods_map[item.goods_id] = ++num; | |
135 | - } else { | |
136 | - goods_map[item.goods_id] = 1; | |
137 | - } | |
138 | - } | |
139 | - } | |
140 | - | |
141 | - //超量的部分也要计算一下 | |
142 | - if(out_arr.length){ | |
143 | - for (var m in out_arr) { | |
144 | - var item = out_arr[m]; | |
145 | - if (item.offline_price) { | |
146 | - offline_price += (item.price - item.offline_price)*item.num; | |
147 | - offline_num += item.num; | |
148 | - } | |
149 | - if (goods_map[item.goods_id]) { | |
150 | - var num = goods_map[item.goods_id]; | |
151 | - num+=item.num | |
152 | - goods_map[item.goods_id] =num; | |
153 | - } else { | |
154 | - goods_map[item.goods_id] = item.num; | |
155 | - } | |
156 | - } | |
157 | - } | |
158 | - | |
159 | - if(Object.keys(goods_map).length) { | |
160 | - //这里就开始拆分提交订单时的列表 | |
161 | - for (let j in goods_map) { | |
162 | - //map中存的就是商品的数量 | |
163 | - let num = goods_map[j]; | |
164 | - //找到相应的商品 | |
165 | - let idx = goods.findIndex(function (ele) { | |
166 | - return ele.goods_id == j; | |
167 | - }) | |
168 | - goods[idx].goods_num -= num; | |
169 | - let new_g = JSON.parse(JSON.stringify(goods[idx])); | |
170 | - new_g.goods_num = num; | |
171 | - new_g.prom_type = 0; | |
172 | - new_g.prom_id = 0; | |
173 | - goods.push(new_g); | |
174 | - } | |
175 | - } | |
176 | - | |
177 | - | |
178 | - //-- 只统计是参与活动的商品 -- | |
179 | - for(var ij in goods){ | |
180 | - var iter=goods[ij]; | |
181 | - if(iter.prom_type!=7 || iter.prom_id!=act.id){ continue; } | |
182 | - all_price0+=iter.goods_num*iter.goods_price; | |
183 | - } | |
184 | - //-- 活动的条件已经满足 -- | |
185 | - c_item.zh_prom_goods[act.id].is_has_zh = 1; | |
186 | - c_item.is_has_zh = 1; | |
187 | - c_item.zh_prom_goods[act.id].actual_price = aprice; | |
188 | - c_item.zh_prom_goods[act.id].cut_price =all_price0-aprice; | |
189 | - | |
190 | - //-- 设置还需要购买多少件,享受活动,前段显示 -- | |
191 | - let need_to = c_item.need_list; | |
192 | - let index = this.find_need_to(need_to, act); | |
193 | - if (index > -1) { | |
194 | - need_to.splice(index, 1); | |
195 | - txt_ite = need_to | |
196 | - } | |
197 | - | |
198 | - | |
199 | - } else { | |
200 | - for (let ii in goods) { | |
201 | - let item = goods[ii]; | |
202 | - if (item.prom_type != 7) continue; | |
203 | - if (item.prom_id != act.id) continue; | |
204 | - if (item.offline_price) { | |
205 | - offline_price += item.goods_price - item.offline_price; | |
206 | - offline_num += 1; | |
207 | - } | |
208 | - item.prom_type = 0; | |
209 | - item.prom_id = 0; | |
210 | - } | |
211 | - if (act.zhbuyqty - all_num > need_to_buy) { | |
212 | - need_to_buy = act.zhbuyqty - all_num; | |
213 | - } | |
214 | - //-- 设置还需要购买多少件享受活动,前端显示 -- | |
215 | - let need_to = c_item.need_list; | |
216 | - let index = this.find_need_to(need_to, act); | |
217 | - if (title == '') title = "再买" + need_to_buy + "件,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】"; | |
218 | - if (index != -1) { | |
219 | - need_to[index].title = title; | |
220 | - } else { | |
221 | - if (!need_to) need_to = []; | |
222 | - let it = { | |
223 | - id: act.id, | |
224 | - pickup_id: c_item.pickup_id, | |
225 | - title: title | |
226 | - }; | |
227 | - need_to.push(it); | |
228 | - } | |
229 | - txt_ite = need_to; | |
230 | - } | |
231 | - tfeel += aprice; | |
232 | - cut_price+=all_price0-aprice;; | |
233 | - } | |
234 | - | |
235 | - c_item.zh_all_price = tfeel; | |
236 | - c_item.zh_cut_price = cut_price; | |
237 | - | |
238 | - if (c_item.is_offline == 1) { | |
239 | - c_item.offline_price += offline_price; | |
240 | - c_item.offline_num += offline_num; | |
241 | - } else { | |
242 | - c_item.is_offline == 1; | |
243 | - c_item.offline_price = offline_price; | |
244 | - c_item.offline_num = offline_num; | |
245 | - } | |
246 | - | |
247 | - }, | |
248 | - //筛选组合购,纯粹的数组按活动id分组 | |
249 | - find_split: function (arr) { | |
250 | - //过滤只有团购的商品 | |
251 | - let oarr = arr.goods.filter(function (ele) { | |
252 | - return ele.prom_type == 7 | |
253 | - }) | |
254 | - if (!oarr || oarr.length == 0) return null; | |
255 | - //看一下有多少个不同的团购 | |
256 | - let map = {}, | |
257 | - dest = []; | |
258 | - for (let i = 0; i < oarr.length; i++) { | |
259 | - let ai = oarr[i]; | |
260 | - let index = map[ai.prom_id] | |
261 | - if (!index) { | |
262 | - dest.push({ | |
263 | - prom_id: ai.prom_id, | |
264 | - act: ai.act, | |
265 | - data: [ai] | |
266 | - }); | |
267 | - map[ai.prom_id] = dest.length; //存储下标 | |
268 | - } else { | |
269 | - let dj = dest[index - 1]; | |
270 | - dj.data.push(ai); | |
271 | - } | |
272 | - } | |
273 | - return dest; | |
274 | - }, | |
275 | - | |
276 | - find_need_to: function (list, iter) { | |
277 | - if (!list || list.length <= 0) return -1; | |
278 | - for (var i in list) { | |
279 | - var item = list[i]; | |
280 | - if (item.id == iter.id) { | |
281 | - return i; | |
282 | - } | |
283 | - } | |
284 | - return -1; | |
285 | - }, | |
286 | - //-- 平摊组合购的价格 -- | |
287 | - calc_zh_split_price: async function (c_arr, th) { | |
288 | - //-- 循环处理 -- | |
289 | - for (var k in c_arr) { | |
290 | - var cart_item = c_arr[k]; //就是每一单的意思 | |
291 | - var ord_goods = c_arr[k].goods; //就是每一单的从表的意思 | |
292 | - | |
293 | - var zh_prom_goods = cart_item.zh_prom_goods; //一单中所有的组合购的集合 | |
294 | - var item_map = {}; | |
295 | - for (let i in zh_prom_goods) { | |
296 | - let item = zh_prom_goods[i]; | |
297 | - let prom_id = i; | |
298 | - //如果这个活动还没有达到要求,继续下一个计算 | |
299 | - if (!item.is_has_zh) continue; | |
300 | - //过滤出相应组合购活动的商品 | |
301 | - let glist = ord_goods.filter(function (ele) { | |
302 | - return ele.prom_type == 7 && ele.prom_id == i; | |
303 | - }) | |
304 | - var all_good_price = 0; | |
305 | - var post_gd=[]; | |
306 | - for (let j in glist) { | |
307 | - let item = glist[j]; | |
308 | - all_good_price += item.goods_price * item.goods_num; | |
309 | - var gitem={ | |
310 | - goods_id:item.goods_id, | |
311 | - goods_num:item.goods_num, | |
312 | - goods_price:item.goods_price | |
313 | - } | |
314 | - post_gd.push(gitem); | |
315 | - } | |
316 | - //要进行优惠的计算 | |
317 | - if (all_good_price - item.actual_price) { | |
318 | - if (cart_item.prom_pt_json) { | |
319 | - cart_item.prom_pt_json.push({ | |
320 | - "zhprom_id": prom_id, | |
321 | - "dis": (all_good_price - item.actual_price).toFixed(2), | |
322 | - "ispt": 0 | |
323 | - }) | |
324 | - } else { | |
325 | - cart_item.prom_pt_json = [{ | |
326 | - "zhprom_id": prom_id, | |
327 | - "dis": (all_good_price - item.actual_price).toFixed(2), | |
328 | - "ispt": 0 | |
329 | - }]; | |
330 | - } | |
331 | - } | |
332 | - | |
333 | - //-- 如果系统要平摊到单品 -- | |
334 | - var pt_data = { | |
335 | - 'prom_id': prom_id, | |
336 | - 'dis': parseFloat(all_good_price - item.actual_price).toFixed(2), | |
337 | - 'goods': post_gd | |
338 | - } | |
339 | - var pt_res = null; | |
340 | - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { | |
341 | - is_json: 1, | |
342 | - data: pt_data | |
343 | - }).then(res => { | |
344 | - if (res.data.code == 0) { | |
345 | - pt_res = res.data.data; | |
346 | - } | |
347 | - }) | |
348 | - if (pt_res) { | |
349 | - for (var io in glist) { | |
350 | - var goods_id = glist[io].goods_id; | |
351 | - item_map[goods_id]={}; | |
352 | - //平摊赋值 | |
353 | - item_map[goods_id].account_fir = th.arr_get_goods(goods_id, pt_res).fisrt_account; | |
354 | - item_map[goods_id].account_yu_fir = th.arr_get_goods(goods_id, pt_res).fisrt_account_yu; | |
355 | - if (!th.data.ispt_goods) { | |
356 | - item_map[goods_id].account = item_map[goods_id].account_fir; | |
357 | - item_map[goods_id].account_yu = item_map[goods_id].account_yu_fir; | |
358 | - } | |
359 | - } | |
360 | - } | |
361 | - } | |
362 | - | |
363 | - //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- | |
364 | - for (var jj = 0; jj < ord_goods.length; jj++) { | |
365 | - if (ord_goods[jj].is_gift) continue; | |
366 | - if (ord_goods[jj].prom_type == 7 && item_map[ord_goods[jj].goods_id]) { | |
367 | - ord_goods[jj].account_fir = item_map[ord_goods[jj].goods_id].account_fir; | |
368 | - ord_goods[jj].account_yu_fir = item_map[ord_goods[jj].goods_id].account_yu_fir; | |
369 | - ord_goods[jj].account = item_map[ord_goods[jj].goods_id].account; | |
370 | - ord_goods[jj].account_yu = item_map[ord_goods[jj].goods_id].account_yu; | |
371 | - } | |
372 | - } | |
373 | - } | |
374 | - | |
375 | - | |
376 | - } | |
377 | - | |
378 | - | |
379 | -} |
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -305,8 +305,9 @@ Page({ |
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | - this.data.gid = gid; | |
309 | - this.data.pre_id = pre_id; | |
308 | + this.setData({ | |
309 | + gid:gid,pre_id:pre_id | |
310 | + }) | |
310 | 311 | |
311 | 312 | if (first_leader) { |
312 | 313 | console.log("log---".first_leader); |
... | ... | @@ -659,6 +660,8 @@ Page({ |
659 | 660 | |
660 | 661 | //-- 把商品的赋值 -- |
661 | 662 | ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); |
663 | + ee.data.sele_g_id=t.data.data.goods_id; | |
664 | + ee.data.sele_g=t.data.data; | |
662 | 665 | |
663 | 666 | //获取用户的默认门店 |
664 | 667 | getApp().get_user_store(function (e) { |
... | ... | @@ -1011,7 +1014,6 @@ Page({ |
1011 | 1014 | } |
1012 | 1015 | |
1013 | 1016 | //让商品带上房间号 |
1014 | - //让商品带上房间号 | |
1015 | 1017 | if (th.data.sys_switch.is_skuroom_id == 1) { |
1016 | 1018 | if (th.data.data.goods_id == getApp().globalData.room_goods_id) { |
1017 | 1019 | newd.room_id = getApp().globalData.room_id; |
... | ... | @@ -1020,10 +1022,6 @@ Page({ |
1020 | 1022 | if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id; |
1021 | 1023 | } |
1022 | 1024 | |
1023 | - //如果是积分够,is_integral_normal就要有积分购普通购买字段 | |
1024 | - if (o.prom_type == 4) { | |
1025 | - newd.is_integral_normal = 1; | |
1026 | - } | |
1027 | 1025 | |
1028 | 1026 | //如果有线下取价 |
1029 | 1027 | if (o.offline_price) { |
... | ... | @@ -1033,7 +1031,7 @@ Page({ |
1033 | 1031 | |
1034 | 1032 | newd.goods_price = th.data.prom_price; |
1035 | 1033 | newd.member_goods_price = th.data.prom_price, |
1036 | - newd.prom_type = 8; | |
1034 | + newd.prom_type = 8; | |
1037 | 1035 | newd.prom_id = o.prom_id; |
1038 | 1036 | |
1039 | 1037 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); |
... | ... | @@ -1164,20 +1162,6 @@ Page({ |
1164 | 1162 | this.checkCartNum(Number(t.detail.value)); |
1165 | 1163 | }, |
1166 | 1164 | |
1167 | - //----------增加购买数量----------- | |
1168 | - addCartNum_inte: function (t) { | |
1169 | - this.checkCartNum_inte(this.data.goodsInputNum + 1); | |
1170 | - }, | |
1171 | - //----------减少购买数量----------- | |
1172 | - subCartNum_inte: function (t) { | |
1173 | - this.checkCartNum_inte(this.data.goodsInputNum - 1); | |
1174 | - }, | |
1175 | - //----------输入框输入购买数量----------- | |
1176 | - inputCartNum_inte: function (t) { | |
1177 | - this.checkCartNum_inte(Number(t.detail.value)); | |
1178 | - }, | |
1179 | - | |
1180 | - | |
1181 | 1165 | //------检查数量是不是超出限购------ |
1182 | 1166 | checkCartNum: function (t) { |
1183 | 1167 | var th = this; |
... | ... | @@ -1214,18 +1198,7 @@ Page({ |
1214 | 1198 | } |
1215 | 1199 | } |
1216 | 1200 | |
1217 | - | |
1218 | - | |
1219 | 1201 | var e = th.data.sele_g.store_count; |
1220 | - var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 | |
1221 | - if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { | |
1222 | - if (!th.data.def_pick_store) { | |
1223 | - wx.showModal({ title: '请选择门店', }); | |
1224 | - return false; | |
1225 | - } else { | |
1226 | - e = th.data.def_pick_store.CanOutQty; | |
1227 | - } | |
1228 | - } | |
1229 | 1202 | if (!e) e = 0; |
1230 | 1203 | //库存不足,不增加 |
1231 | 1204 | if (e < t) { |
... | ... | @@ -1235,90 +1208,11 @@ Page({ |
1235 | 1208 | } |
1236 | 1209 | t > e || 0 == e ? t = e : t < 1 && (t = 1); |
1237 | 1210 | th.setData({ goodsInputNum: t }); |
1238 | - th.is_show_more_buy(); | |
1239 | - | |
1240 | - }) | |
1241 | - }, | |
1242 | - | |
1243 | - //----- 检查一下积分购的限购之类的问题 ----- | |
1244 | - checkCartNum_inte: function (t) { | |
1245 | - var th = this; | |
1246 | - this.get_buy_num(this.data.data, async function () { | |
1247 | - | |
1248 | - //--判断商品是否超出限购-- | |
1249 | - if (th.data.g_buy_num != null && th.data.data.viplimited > 0) { | |
1250 | - | |
1251 | - var gd_buy_num = th.data.g_buy_num.get(th.data.sele_g.goods_id); | |
1252 | - | |
1253 | - if (t + gd_buy_num > th.data.sele_g.viplimited) { | |
1254 | - wx.showModal({ | |
1255 | - title: '超出商品限购', | |
1256 | - }); | |
1257 | - | |
1258 | - var num = th.data.sele_g.viplimited - gd_buy_num; | |
1259 | - if (num < 0) num = 0; | |
1260 | - th.setData({ goodsInputNum: num }) | |
1261 | - return false; | |
1262 | - } | |
1263 | - } | |
1211 | + //th.is_show_more_buy(); | |
1264 | 1212 | |
1265 | - //--判断商品是否超出活动限购-- | |
1266 | - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) { | |
1267 | - if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { | |
1268 | - wx.showModal({ | |
1269 | - title: '超出商品活动限购', | |
1270 | - }); | |
1271 | - | |
1272 | - var num = th.data.prom_buy_limit - th.data.prom_buy_num; | |
1273 | - if (num < 0) num = 0; | |
1274 | - th.setData({ goodsInputNum: num }) | |
1275 | - return false; | |
1276 | - } | |
1277 | - } | |
1278 | - | |
1279 | - if (th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) { | |
1280 | - var redis_num = 0; | |
1281 | - //------判断活动是否抢光----- | |
1282 | - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | |
1283 | - os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, { | |
1284 | - 1: 1 | |
1285 | - }).then(res => { | |
1286 | - redis_num = res.data.data; | |
1287 | - }); | |
1288 | - | |
1289 | - if (t > redis_num) { | |
1290 | - wx.showModal({ | |
1291 | - title: '超出商品活动库存', | |
1292 | - }); | |
1293 | - th.setData({ goodsInputNum: redis_num }) | |
1294 | - return false; | |
1295 | - } | |
1296 | - | |
1297 | - } | |
1298 | - | |
1299 | - var e = th.data.sele_g.store_count; | |
1300 | - var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 | |
1301 | - if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { | |
1302 | - if (!th.data.def_pick_store) { | |
1303 | - wx.showModal({ title: '请选择门店', }); | |
1304 | - return false; | |
1305 | - } else { | |
1306 | - e = th.data.def_pick_store.CanOutQty; | |
1307 | - } | |
1308 | - } | |
1309 | - if (!e) e = 0; | |
1310 | - //库存不足,不增加 | |
1311 | - if (e < t) { | |
1312 | - wx.showModal({ title: '库存不足', }); | |
1313 | - if (e < 0) e = 0; | |
1314 | - th.setData({ goodsInputNum: e }); return false; | |
1315 | - } | |
1316 | - t > e || 0 == e ? t = e : t < 1 && (t = 1); | |
1317 | - th.setData({ goodsInputNum: t }); | |
1318 | 1213 | }) |
1319 | 1214 | }, |
1320 | 1215 | |
1321 | - | |
1322 | 1216 | closeSpecModal: function () { |
1323 | 1217 | if (this.data.openSpecModal_pt && this.data.is_normal) { |
1324 | 1218 | this.get_sto(); |
... | ... | @@ -1852,59 +1746,32 @@ Page({ |
1852 | 1746 | |
1853 | 1747 | //选择了不同的规格的时候要判断是不是有活动正在进行中 |
1854 | 1748 | async sele_spec_chech_activity() { |
1855 | - //---如果是活动的时候--- | |
1856 | - var prom = null, goodsinfo = this.data.sele_g, th = this; | |
1857 | - if (goodsinfo.prom_type == 1) { | |
1858 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + goodsinfo.prom_id, { | |
1859 | - }).then(res => { | |
1860 | - if (res.data.code == 0) { | |
1861 | - prom = res.data.data; | |
1862 | - } | |
1863 | - }) | |
1864 | - } | |
1865 | - if (goodsinfo.prom_type == 6) { | |
1866 | - await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + goodsinfo.prom_id, { | |
1867 | - }).then(res => { | |
1868 | - if (res.data.code == 0) { | |
1869 | - prom = res.data.data; | |
1870 | - } | |
1871 | - }) | |
1872 | - } | |
1873 | - | |
1874 | - if (goodsinfo.prom_type == 4) { | |
1875 | - await getApp().request.promiseGet("/api/weshop/integralbuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, { | |
1876 | - }).then(res => { | |
1877 | - if (res.data.code == 0) { | |
1878 | - prom = res.data.data; | |
1879 | - } | |
1880 | - }) | |
1881 | - } | |
1882 | - | |
1883 | - //----------如果有活动,并且在进行中,就不计算线下库存--------------- | |
1884 | - var now = ut.gettimestamp(); | |
1885 | - if (prom) { | |
1886 | - if (prom.is_end == 0 && prom.end_time > now && prom.start_time < now) { | |
1887 | - th.setData({ | |
1888 | - prom_type: goodsinfo.prom_type, | |
1889 | - prom_price: prom.price, | |
1890 | - prom_buy_limit: prom.buy_limit, | |
1891 | - prom_end_time: prom.end_time, | |
1892 | - prom_start_time: prom.start_time, | |
1893 | - prom_st: 1, | |
1894 | - }) | |
1895 | - return false; | |
1749 | + var prom = null, goodsinfo = this.data.sele_g, th = this; | |
1750 | + | |
1751 | + var all_pre_goods=th.data.all_pre_goods; | |
1752 | + if(all_pre_goods){ | |
1753 | + var userInfo = getApp().globalData.userInfo; | |
1754 | + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid }; | |
1755 | + if (userInfo) { | |
1756 | + pre_data.user_id = userInfo.user_id; | |
1757 | + } | |
1758 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { | |
1759 | + data: pre_data, | |
1760 | + }).then(e => { | |
1761 | + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
1762 | + all_pre_goods=e.data.data.pageData; | |
1763 | + th.data.all_pre_goods=e.data.data.pageData; | |
1764 | + } | |
1765 | + }) | |
1896 | 1766 | } |
1897 | - } | |
1898 | - //---设置普通商品--- | |
1899 | - th.setData({ | |
1900 | - prom_type: 0, | |
1901 | - prom_price: null, | |
1902 | - prom_buy_limit: null, | |
1903 | - prom_end_time: null, | |
1904 | - prom_start_time: null, | |
1905 | - prom_st: null, | |
1906 | - }) | |
1907 | 1767 | |
1768 | + | |
1769 | + var idx=all_pre_goods.findIndex(function (ele) { | |
1770 | + return ele.goods_id==goodsinfo.goods_id; | |
1771 | + }) | |
1772 | + var pre_arr =all_pre_goods[idx]; | |
1773 | + th.setData({ pre_arr: pre_arr }) | |
1774 | + th.data.prom_buy_limit=pre_arr.vip_butyqty; | |
1908 | 1775 | }, |
1909 | 1776 | |
1910 | 1777 | |
... | ... | @@ -3987,54 +3854,6 @@ Page({ |
3987 | 3854 | }); |
3988 | 3855 | }, |
3989 | 3856 | |
3990 | - is_show_more_buy: function () { | |
3991 | - var prom_goods = this.data.prom_goods; | |
3992 | - var per_price = this.data.sele_g.shop_price | |
3993 | - if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) { | |
3994 | - per_price = this.data.sele_g[this.data.card_field]; | |
3995 | - } | |
3996 | - var all_price = per_price * this.data.goodsInputNum; | |
3997 | - var con = null; | |
3998 | - for (var i in prom_goods) { | |
3999 | - var item = prom_goods[i]; | |
4000 | - if (item.prom_type == 1) { | |
4001 | - if (item.condition > this.data.goodsInputNum) { | |
4002 | - con = item; | |
4003 | - con.need = (item.condition - this.data.goodsInputNum).toFixed(2) + "件"; | |
4004 | - break; | |
4005 | - } | |
4006 | - } else { | |
4007 | - if (item.condition > all_price) { | |
4008 | - con = item; | |
4009 | - con.need = (item.condition - all_price).toFixed(2) + "元"; | |
4010 | - break; | |
4011 | - } | |
4012 | - } | |
4013 | - } | |
4014 | - | |
4015 | - this.setData({ hui_condition: con }); | |
4016 | - | |
4017 | - }, | |
4018 | - | |
4019 | - closeSpecModal_inte: function () { | |
4020 | - this.setData({ openSpecModal_inte: 0 }); | |
4021 | - }, | |
4022 | - closeSpecModal_inte_normal: function () { | |
4023 | - this.setData({ openSpecModal_inte_normal: 0 }); | |
4024 | - //要进行还原 | |
4025 | - this.get_sto(); | |
4026 | - this.setData({ | |
4027 | - sele_g: this.data.data, | |
4028 | - gid: this.data.data.goods_id | |
4029 | - }) | |
4030 | - | |
4031 | - this.sele_spec_chech_activity(); | |
4032 | - }, | |
4033 | - | |
4034 | - addCart_inte: function (t) { | |
4035 | - this.add_cart_func_inte(t); | |
4036 | - }, | |
4037 | - | |
4038 | 3857 | |
4039 | 3858 | onShareTimeline() { |
4040 | 3859 | var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; |
... | ... | @@ -4080,6 +3899,7 @@ Page({ |
4080 | 3899 | }) |
4081 | 3900 | }, |
4082 | 3901 | |
3902 | + //获取预售的信息 | |
4083 | 3903 | async get_pre_prom(func) { |
4084 | 3904 | var th = this; |
4085 | 3905 | var presell_id = null; |
... | ... | @@ -4108,7 +3928,7 @@ Page({ |
4108 | 3928 | } |
4109 | 3929 | }) |
4110 | 3930 | var userInfo = getApp().globalData.userInfo; |
4111 | - var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid }; | |
3931 | + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1,prom_type:8,prom_id:presell_id }; | |
4112 | 3932 | if (userInfo) { |
4113 | 3933 | pre_data.user_id = userInfo.user_id; |
4114 | 3934 | } |
... | ... | @@ -4116,8 +3936,17 @@ Page({ |
4116 | 3936 | data: pre_data, |
4117 | 3937 | }).then(e => { |
4118 | 3938 | if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { |
4119 | - pre_arr = e.data.data.pageData[0]; | |
3939 | + | |
3940 | + th.data.all_pre_goods=e.data.data.pageData; | |
3941 | + | |
3942 | + var idx=e.data.data.pageData.findIndex(function (ele) { | |
3943 | + return ele.id== th.data.pre_id; | |
3944 | + }) | |
3945 | + pre_arr = e.data.data.pageData[idx]; | |
4120 | 3946 | th.setData({ pre_arr: pre_arr }) |
3947 | + th.data.prom_buy_limit=pre_arr.vip_butyqty; | |
3948 | + | |
3949 | + | |
4121 | 3950 | } |
4122 | 3951 | }) |
4123 | 3952 | if (!pre_arr) { | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.wxml
... | ... | @@ -534,29 +534,15 @@ |
534 | 534 | 券后¥<text class="fs32">{{sele_g.offline_price}}</text> |
535 | 535 | </view> |
536 | 536 | </view> |
537 | - <block wx:if="{{prom_type==0}}"> | |
538 | - <view class="flex"> | |
539 | - <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view> | |
540 | - <block wx:if="{{sales_rules==2}}"> | |
541 | - <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}"> | |
542 | - 可售:{{def_pick_store.CanOutQty}} | |
543 | - </view> | |
544 | - <view class="spec-goods-stock" wx:else>可售:0</view> | |
545 | - </block> | |
546 | - <block wx:else> | |
547 | - <view class="spec-goods-stock">可售:{{sele_g.store_count}}</view> | |
548 | - </block> | |
549 | - </view> | |
550 | - </block> | |
551 | - <block wx:if="{{prom_type==1}}"> | |
537 | + | |
552 | 538 | <view class="flex"> |
553 | - <view class="spec-goods-stock" wx:if="{{prom_st>0}}"> | |
554 | - 已售:{{prom_act.buy_num+prom_act.virtual}} | |
539 | + <view class="spec-goods-stock"> | |
540 | + 已售:{{pre_arr.buy_goodnum+pre_arr.virtual_qty}} | |
555 | 541 | </view> |
556 | - <view class="spec-goods-stock" wx:else>已售:{{prom_act.buy_num}}</view> | |
557 | - <view class="spec-goods-stock">可售:{{prom_act.goods_num-prom_act.buy_num}}</view> | |
542 | + <view class="spec-goods-stock">可售:{{pre_arr.presell_sumqty-pre_arr.buy_goodnum}}</view> | |
558 | 543 | </view> |
559 | - </block> | |
544 | + | |
545 | + | |
560 | 546 | </view> |
561 | 547 | <!-- 选择门店模块 --> |
562 | 548 | <view class="flex-space-between address ai_end xc-width "> |
... | ... | @@ -653,7 +639,7 @@ |
653 | 639 | <block wx:else> |
654 | 640 | <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" |
655 | 641 | data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy"> |
656 | - 支付定金(¥{{presellList.presell_money}}) | |
642 | + 支付定金(¥{{pre_arr.presell_money}}) | |
657 | 643 | </view> |
658 | 644 | </block> |
659 | 645 | ... | ... |
pages/cart/cart_wk/cart_wk.js
pages/cart/cart_wk/cart_wk.wxml
... | ... | @@ -46,7 +46,6 @@ |
46 | 46 | |
47 | 47 | <!--商品图片显示--> |
48 | 48 | <view class='center'> |
49 | - | |
50 | 49 | <view class='cen_img'> |
51 | 50 | <image src="{{order.show_img}}" binderror="bind_bnerr" data-errorimg="order.show_img"></image> |
52 | 51 | </view> |
... | ... | @@ -61,22 +60,6 @@ |
61 | 60 | |
62 | 61 | </view> |
63 | 62 | |
64 | -<!--取货方式--> | |
65 | - | |
66 | -<!-- <view class='quhou bdr_b-14'> | |
67 | - <view bindtap="set_wuliu" data-type="1" class='qu_fs' wx:if="{{distr_type==0 || distr_type==1}}"> | |
68 | - <image wx:if="{{exp_type==0}}" src='{{imgUrl}}/miniapp/images/kon.png'></image> | |
69 | - <image wx:if="{{exp_type==1}}" src='{{imgUrl}}/miniapp/images/dd.png'></image> | |
70 | - <text class='qu_wz'>门店自提</text> | |
71 | - </view> | |
72 | - | |
73 | - <view bindtap="set_wuliu" data-type="0" class='qu_fs' wx:if="{{distr_type==0 || distr_type==2}}"> | |
74 | - <image wx:if="{{exp_type==0}}" src='{{imgUrl}}/miniapp/images/dd.png'></image> | |
75 | - <image wx:if="{{exp_type==1}}" src='{{imgUrl}}/miniapp/images/kon.png'></image> | |
76 | - <text class='qu_wz'>快递邮寄</text> | |
77 | - </view> | |
78 | -</view> --> | |
79 | - | |
80 | 63 | <view class="use-item bdr_b-14 jc_sb" wx:if='{{exp_type==0 && !is_default_logistics}}'> |
81 | 64 | <view>选择物流:</view> |
82 | 65 | <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;"> | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
... | ... | @@ -900,6 +900,7 @@ |
900 | 900 | <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> |
901 | 901 | <view>客服</view> |
902 | 902 | </view> |
903 | + | |
903 | 904 | <view bindtap="collectGoods" class="custom-service cart-ico new_split"> |
904 | 905 | <image hidden="{{is_collect}}" class="cs-img" src="{{iurl}}/miniapp/images/heart.png"></image> |
905 | 906 | <image hidden="{{!is_collect}}" class="cs-img" src="{{iurl}}/miniapp/images/heart-h.png"></image> | ... | ... |
pages/index/index/index.wxml
... | ... | @@ -181,9 +181,8 @@ |
181 | 181 | |
182 | 182 | |
183 | 183 | <!--预售--> |
184 | - <!-- | |
185 | 184 | <view class="seckill" wx:if="{{preGoods!=null && preGoods.length!=0 }}"> |
186 | - <navigator url="/packageC/pages/presell/list/list" hover-class="none"> | |
185 | + <navigator bindtap="go_pre" data-url="/packageC/pages/presell/list/list" hover-class="none"> | |
187 | 186 | <view class="seckill-time"> |
188 | 187 | <view class="classname flex ai_c"> |
189 | 188 | <i class="iconfont icon-presell"></i> |
... | ... | @@ -198,7 +197,9 @@ |
198 | 197 | <view class="seckill-list"> |
199 | 198 | <swiper class="s_prom" indicator-dots="{{false}}" bindchange="flashSwiperChange" next-margin="25rpx"> |
200 | 199 | <swiper-item wx:for="{{preGoods}}" wx:key="*this" class="p_swiper" > |
201 | - <navigator class="nav" hover-class="none" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&title={{aitem.goods_name}}" wx:for="{{item}}" wx:key="item" wx:for-item="aitem" wx:for-index="aind"> | |
200 | + <navigator bindtap="go_pre" class="nav" hover-class="none" | |
201 | + data-url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&pre_id={{aitem.id}}" | |
202 | + wx:for="{{item}}" wx:key="item" wx:for-item="aitem" wx:for-index="aind"> | |
202 | 203 | <view class="imgview presell"> |
203 | 204 | <image src="{{url+aitem.original_img}}" mode="aspectFill" lazy-load="true" data-errorimg="preGoods[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3" data-img="{{aitem.original_img}}"></image> |
204 | 205 | </view> |
... | ... | @@ -215,7 +216,7 @@ |
215 | 216 | </swiper> |
216 | 217 | </view> |
217 | 218 | </view> |
218 | - - --> | |
219 | + | |
219 | 220 | |
220 | 221 | |
221 | 222 | <!----拼单----> | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -135,150 +135,171 @@ Page({ |
135 | 135 | }, |
136 | 136 | |
137 | 137 | |
138 | - /*---------获取订单列表--------*/ | |
139 | - requestOrderList: function (t) { | |
140 | - var rd = Math.random() * 100; | |
141 | - var e = this, th = e, r = e.data.url + "/api/weshop/order/page?rd=" + rd, a = ""; | |
142 | - switch (t) { | |
143 | - case "1": | |
144 | - r += "&wait_status=0"; break; | |
145 | - case "2": | |
146 | - r += "&wait_status=1"; break; | |
147 | - case "3": | |
148 | - r += "&wait_status=2"; break; | |
149 | - case "4": | |
150 | - r += "&order_status=2"; break; | |
151 | - } | |
152 | - r+="&isdel=0"; | |
153 | - if(this.data.searchContent) { | |
154 | - r+="&keyWord=" + this.data.searchContent; | |
155 | - } | |
156 | - this.setData({ activeCategoryId: t }); r = r + "&page=" + e.data.currentPage; | |
157 | - s.request(r, function (t) { | |
158 | - | |
159 | - th.setData({ is_get: 1 }); | |
160 | - var data = e.data.orderList; | |
161 | - data.forEach(async function (item, ind) { | |
162 | - var tt = null; | |
163 | - await getApp().request.promiseGet('/api/weshop/ordergoods/list', { | |
164 | - data: { order_id: item.order_id, store_id: os.stoid, pageSize: 600 }, | |
165 | - }).then(res => { | |
166 | - tt = res; | |
167 | - }) | |
168 | - | |
169 | - var glist = tt.data.data.pageData; | |
170 | - for(var i in glist){ | |
171 | - if(glist[i].is_gift){ | |
172 | - data[ind].is_prom=1; | |
173 | - } | |
138 | + /*---------获取订单列表--------*/ | |
139 | + requestOrderList: function (t) { | |
140 | + var rd = Math.random() * 100; | |
141 | + var e = this, th = e, r = e.data.url + "/api/weshop/order/page?rd=" + rd, a = ""; | |
142 | + switch (t) { | |
143 | + case "1": | |
144 | + r += "&wait_status=0"; | |
145 | + break; | |
146 | + case "2": | |
147 | + r += "&wait_status=1"; | |
148 | + break; | |
149 | + case "3": | |
150 | + r += "&wait_status=2"; | |
151 | + break; | |
152 | + case "4": | |
153 | + r += "&order_status=2"; | |
154 | + break; | |
174 | 155 | } |
175 | - | |
176 | - | |
177 | - //------------对比一下有没有退款记录------------ | |
178 | - await getApp().request.promiseGet("/api/weshop/order/returngoods/page", { | |
179 | - data: { | |
180 | - order_id: item.order_id, store_id: os.stoid, | |
181 | - user_id: oo.user_id, pageSize: 20 | |
182 | - } | |
183 | - }).then(rs => { | |
184 | - var ttd = rs; | |
185 | - //--看一下订单的总数量-- | |
186 | - var gtype_num = tt.data.data.total; | |
187 | - if (ttd.data.data.pageData == undefined) return false; | |
188 | - var goodslist = tt.data.data.pageData; | |
189 | - | |
190 | - //----没有相关的退款记录---- | |
191 | - if (ttd.data.data.total == 0) { | |
192 | - data[ind]['is_all_return'] = 0; | |
193 | - goodslist.forEach(function (ee, ii) { | |
194 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num > 1) { | |
195 | - item.goodslist = goodslist; | |
196 | - if (th.check_for_return_btn(item)) { | |
197 | - goodslist[ii]['return_btn'] = 1; | |
156 | + r += "&isdel=0"; | |
157 | + if (this.data.searchContent) { | |
158 | + r += "&keyWord=" + this.data.searchContent; | |
159 | + } | |
160 | + this.setData({activeCategoryId: t}); | |
161 | + r = r + "&page=" + e.data.currentPage; | |
162 | + s.request(r, function (t) { | |
163 | + | |
164 | + th.setData({is_get: 1}); | |
165 | + var data = e.data.orderList; | |
166 | + data.forEach(async function (item, ind) { | |
167 | + var tt = null; | |
168 | + await getApp().request.promiseGet('/api/weshop/ordergoods/list', { | |
169 | + data: {order_id: item.order_id, store_id: os.stoid, pageSize: 600}, | |
170 | + }).then(res => { | |
171 | + tt = res; | |
172 | + }) | |
173 | + var glist = tt.data.data.pageData; | |
174 | + for (var i in glist) { | |
175 | + if (glist[i].is_gift) { | |
176 | + data[ind].is_prom = 1; | |
177 | + } | |
198 | 178 | } |
199 | - } | |
200 | 179 | |
201 | - }); | |
202 | - } else { | |
203 | - //--------整单退-------- | |
204 | - if (ttd.data.data.pageData[0]['goods_id_list'] != null | |
205 | - && ttd.data.data.pageData[0]['goods_id_list'] != '') { | |
206 | - var eea = ttd.data.data.pageData[0]; | |
207 | - //1.退款正在进行中, | |
208 | - //2.退款被拒绝就要显示可以退款 | |
209 | - //3.退款已经完成 | |
210 | - data[ind]['is_all_return'] = 1; | |
211 | - data[ind]['is_all_return_status'] = ttd.data.data.pageData[0].status; | |
212 | - | |
213 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { | |
214 | - switch (eea.status) { | |
215 | - case 0: | |
216 | - case 1: | |
217 | - data[ind]['return_btn'] = 2; break; | |
218 | - case 2: | |
219 | - data[ind]['return_btn'] = 4; break; | |
220 | - case 3: | |
221 | - data[ind]['return_btn'] = 3; break; | |
222 | - default: | |
223 | - data[ind]['return_btn'] = 0; | |
180 | + data[ind]['ord_url']='/pages/user/order_detail/order_detail'; | |
181 | + //-- 如果是优惠活动 -- | |
182 | + if(glist[0].prom_type==8){ | |
183 | + await getApp().request.promiseGet('/api/weshop/order/orderPresell/get/'+os.stoid+'/'+item.order_id, { | |
184 | + }).then(res => { | |
185 | + if(res.data.code==0){ | |
186 | + data[ind]['presell'] = res.data.data; | |
187 | + data[ind]['ord_url']='/packageC/pages/presell/cart/cart'; | |
188 | + } | |
189 | + }) | |
224 | 190 | } |
225 | - } | |
226 | - } else { | |
227 | - //1.退款正在进行中, | |
228 | - //2.退款被拒绝就要显示可以退款 | |
229 | - //3.退款已经完成 | |
230 | - data[ind]['is_all_return'] = 0; | |
231 | - var rt_ok_num = 0; | |
232 | - //if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { | |
233 | - goodslist.forEach(function (eeb, iii) { | |
234 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) | |
235 | - goodslist[iii]['return_btn'] = 1; //申请退款 | |
236 | - ttd.data.data.pageData.forEach(function (eea, ii) { | |
237 | - var st = eea.status; | |
238 | - if (eea.goods_id == eeb.goods_id) { | |
239 | - switch (eea.status) { | |
240 | - case 0: | |
241 | - case 1://退款处理中 | |
242 | - data[ind]['has_rt'] = 1; //有部分退 | |
243 | - goodslist[iii]['return_btn'] = 2; break; | |
244 | - case 2://退款完成 | |
245 | - data[ind]['has_rt'] = 1; //有部分退 | |
246 | - goodslist[iii]['return_btn'] = 4; rt_ok_num++; break; | |
247 | - case 3://已拒绝,重新退款 | |
248 | - goodslist[iii]['return_btn'] = 3; break; | |
249 | - default: | |
250 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) | |
251 | - goodslist[iii]['return_btn'] = 1; //申请退款 | |
191 | + //------------对比一下有没有退款记录------------ | |
192 | + await getApp().request.promiseGet("/api/weshop/order/returngoods/page", { | |
193 | + data: { | |
194 | + order_id: item.order_id, store_id: os.stoid, | |
195 | + user_id: oo.user_id, pageSize: 20 | |
196 | + } | |
197 | + }).then(rs => { | |
198 | + var ttd = rs; | |
199 | + //--看一下订单的总数量-- | |
200 | + var gtype_num = tt.data.data.total; | |
201 | + if (ttd.data.data.pageData == undefined) return false; | |
202 | + var goodslist = tt.data.data.pageData; | |
203 | + | |
204 | + //----没有相关的退款记录---- | |
205 | + if (ttd.data.data.total == 0) { | |
206 | + data[ind]['is_all_return'] = 0; | |
207 | + goodslist.forEach(function (ee, ii) { | |
208 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num > 1) { | |
209 | + item.goodslist = goodslist; | |
210 | + if (th.check_for_return_btn(item)) { | |
211 | + goodslist[ii]['return_btn'] = 1; | |
212 | + } | |
213 | + } | |
214 | + | |
215 | + }); | |
216 | + } else { | |
217 | + //--------整单退-------- | |
218 | + if (ttd.data.data.pageData[0]['goods_id_list'] != null | |
219 | + && ttd.data.data.pageData[0]['goods_id_list'] != '') { | |
220 | + var eea = ttd.data.data.pageData[0]; | |
221 | + //1.退款正在进行中, | |
222 | + //2.退款被拒绝就要显示可以退款 | |
223 | + //3.退款已经完成 | |
224 | + data[ind]['is_all_return'] = 1; | |
225 | + data[ind]['is_all_return_status'] = ttd.data.data.pageData[0].status; | |
226 | + | |
227 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { | |
228 | + switch (eea.status) { | |
229 | + case 0: | |
230 | + case 1: | |
231 | + data[ind]['return_btn'] = 2; | |
232 | + break; | |
233 | + case 2: | |
234 | + data[ind]['return_btn'] = 4; | |
235 | + break; | |
236 | + case 3: | |
237 | + data[ind]['return_btn'] = 3; | |
238 | + break; | |
239 | + default: | |
240 | + data[ind]['return_btn'] = 0; | |
241 | + } | |
242 | + } | |
243 | + } else { | |
244 | + //1.退款正在进行中, | |
245 | + //2.退款被拒绝就要显示可以退款 | |
246 | + //3.退款已经完成 | |
247 | + data[ind]['is_all_return'] = 0; | |
248 | + var rt_ok_num = 0; | |
249 | + //if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { | |
250 | + goodslist.forEach(function (eeb, iii) { | |
251 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) | |
252 | + goodslist[iii]['return_btn'] = 1; //申请退款 | |
253 | + ttd.data.data.pageData.forEach(function (eea, ii) { | |
254 | + var st = eea.status; | |
255 | + if (eea.goods_id == eeb.goods_id) { | |
256 | + switch (eea.status) { | |
257 | + case 0: | |
258 | + case 1://退款处理中 | |
259 | + data[ind]['has_rt'] = 1; //有部分退 | |
260 | + goodslist[iii]['return_btn'] = 2; | |
261 | + break; | |
262 | + case 2://退款完成 | |
263 | + data[ind]['has_rt'] = 1; //有部分退 | |
264 | + goodslist[iii]['return_btn'] = 4; | |
265 | + rt_ok_num++; | |
266 | + break; | |
267 | + case 3://已拒绝,重新退款 | |
268 | + goodslist[iii]['return_btn'] = 3; | |
269 | + break; | |
270 | + default: | |
271 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) | |
272 | + goodslist[iii]['return_btn'] = 1; //申请退款 | |
273 | + } | |
274 | + return; | |
275 | + } | |
276 | + }); | |
277 | + }); | |
278 | + //} | |
279 | + } | |
252 | 280 | } |
253 | - return; | |
254 | - } | |
255 | - }); | |
256 | - }); | |
257 | - //} | |
258 | - } | |
259 | - } | |
260 | 281 | |
261 | - //--如果是全部退款,也就可以删除-- | |
262 | - if (rt_ok_num == goodslist.length) { | |
263 | - data[ind]['is_all_return_status'] = 2; | |
264 | - } | |
282 | + //--如果是全部退款,也就可以删除-- | |
283 | + if (rt_ok_num == goodslist.length) { | |
284 | + data[ind]['is_all_return_status'] = 2; | |
285 | + } | |
265 | 286 | |
266 | 287 | |
267 | - data[ind]['order_goods'] = goodslist; | |
268 | - var g_num = 0; | |
269 | - goodslist.forEach(function (ee, ii) { | |
270 | - if (ee.return_btn != 4) | |
271 | - g_num += ee.goods_num; | |
272 | - }); | |
273 | - data[ind]['g_num'] = g_num; | |
274 | - }) | |
275 | - th.setData({ orderList: data, }); | |
288 | + data[ind]['order_goods'] = goodslist; | |
289 | + var g_num = 0; | |
290 | + goodslist.forEach(function (ee, ii) { | |
291 | + if (ee.return_btn != 4) | |
292 | + g_num += ee.goods_num; | |
293 | + }); | |
294 | + data[ind]['g_num'] = g_num; | |
295 | + }) | |
296 | + th.setData({orderList: data,}); | |
276 | 297 | |
277 | - }); | |
278 | - e.data.currentPage++ , | |
279 | - wx.stopPullDownRefresh(); | |
280 | - }, null, { store_id: os.stoid, user_id: oo.user_id }); | |
281 | - }, | |
298 | + }); | |
299 | + e.data.currentPage++ , | |
300 | + wx.stopPullDownRefresh(); | |
301 | + }, null, {store_id: os.stoid, user_id: oo.user_id}); | |
302 | + }, | |
282 | 303 | //滑倒底部 |
283 | 304 | onReachBottom: function() { |
284 | 305 | if(this.data.currentIndex == 0) { |
... | ... | @@ -433,398 +454,387 @@ Page({ |
433 | 454 | }); |
434 | 455 | }, |
435 | 456 | |
436 | - /*----------跳转支付-----------*/ | |
437 | - async jumpToCart4(t) { | |
438 | - var o_index = t.currentTarget.dataset.idx; | |
439 | - var e = this.data.orderList[o_index]; | |
440 | - var th = this; | |
441 | - var order=e ; | |
442 | - var order_goods=e.order_goods; | |
443 | - | |
444 | - var wlist=""; | |
445 | - for(var i in order_goods){ | |
446 | - var good=order_goods[i]; | |
447 | - //线下取价功能已经关闭或者过期 | |
448 | - if(!th.data.is_open_offline && good.offline_cut>0){ | |
449 | - wx.showModal({ | |
450 | - title: '提示', | |
451 | - content: '线下取价功能已经关闭或者过期!' | |
452 | - }); | |
453 | - return false; | |
454 | - } | |
455 | - //如果不是小程序有的功能,直接提示要去3.0处理 | |
456 | - if(good.prom_type==2 ){ | |
457 | - wx.showModal({ | |
458 | - title: '提示', | |
459 | - content: '小程序还未有该活动,请到3.0公众号支付' | |
460 | - }); | |
461 | - return false; | |
462 | - } | |
463 | - //要每件每件的商品进行检查,看有么有超出库存,超出限购 | |
464 | - var good= order_goods[i],goodsbuynum=0,promgoodsbuynum=0,gg=null; | |
465 | - //获取单品的现在的活动状态 | |
466 | - await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, { | |
467 | - }).then(res=>{ | |
468 | - gg=res.data.data; | |
469 | - }) | |
470 | - var limit = gg.viplimited; | |
471 | - var store_count = gg.store_count; | |
472 | - good.erpwareid=gg.erpwareid; | |
473 | - | |
474 | - //---要获得商品,该用户买了多少件,同步应用--- | |
475 | - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | |
476 | - data: { | |
477 | - store_id: os.stoid, | |
478 | - user_id: getApp().globalData.user_id, | |
479 | - goods_id: good.goods_id, | |
480 | - prom_type: good.prom_type, | |
481 | - prom_id: good.prom_id | |
482 | - }, | |
483 | - }).then(res => { | |
484 | - var buy_num_data = res.data.data; | |
485 | - if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; | |
486 | - goodsbuynum = buy_num_data.goodsbuynum; | |
487 | - }) | |
488 | - | |
489 | - var buyed_mum2=goodsbuynum+good.goods_num; | |
490 | - if (buyed_mum2 > limit && limit > 0) { | |
491 | - var content=gg.goods_name+'购买数量超出商品限购,请取消订单'; | |
492 | - th.toast(content); | |
493 | - return false; | |
494 | - } | |
457 | + /*----------跳转支付-----------*/ | |
458 | + async jumpToCart4(t) { | |
459 | + var o_index = t.currentTarget.dataset.idx; | |
460 | + var e = this.data.orderList[o_index]; | |
461 | + var th = this; | |
462 | + var order = e; | |
463 | + var order_goods = e.order_goods; | |
464 | + | |
465 | + var wlist = ""; | |
466 | + for (var i in order_goods) { | |
467 | + var good = order_goods[i]; | |
468 | + //线下取价功能已经关闭或者过期 | |
469 | + if (!th.data.is_open_offline && good.offline_cut > 0) { | |
470 | + wx.showModal({ | |
471 | + title: '提示', | |
472 | + content: '线下取价功能已经关闭或者过期!' | |
473 | + }); | |
474 | + return false; | |
475 | + } | |
476 | + //如果不是小程序有的功能,直接提示要去3.0处理 | |
477 | + if (good.prom_type == 2) { | |
478 | + wx.showModal({ | |
479 | + title: '提示', | |
480 | + content: '小程序还未有该活动,请到3.0公众号支付' | |
481 | + }); | |
482 | + return false; | |
483 | + } | |
484 | + //要每件每件的商品进行检查,看有么有超出库存,超出限购 | |
485 | + var good = order_goods[i], goodsbuynum = 0, promgoodsbuynum = 0, gg = null; | |
486 | + //获取单品的现在的活动状态 | |
487 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {}).then(res => { | |
488 | + gg = res.data.data; | |
489 | + }) | |
490 | + var limit = gg.viplimited; | |
491 | + var store_count = gg.store_count; | |
492 | + good.erpwareid = gg.erpwareid; | |
493 | + | |
494 | + //---要获得商品,该用户买了多少件,同步应用--- | |
495 | + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | |
496 | + data: { | |
497 | + store_id: os.stoid, | |
498 | + user_id: getApp().globalData.user_id, | |
499 | + goods_id: good.goods_id, | |
500 | + prom_type: good.prom_type, | |
501 | + prom_id: good.prom_id | |
502 | + }, | |
503 | + }).then(res => { | |
504 | + var buy_num_data = res.data.data; | |
505 | + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; | |
506 | + goodsbuynum = buy_num_data.goodsbuynum; | |
507 | + }) | |
508 | + | |
509 | + var buyed_mum2 = goodsbuynum + good.goods_num; | |
510 | + if (buyed_mum2 > limit && limit > 0) { | |
511 | + var content = gg.goods_name + '购买数量超出商品限购,请取消订单'; | |
512 | + th.toast(content); | |
513 | + return false; | |
514 | + } | |
495 | 515 | |
496 | - //当是组合优惠的时候 | |
497 | - if(good.prom_type==7){ | |
498 | - //如果有组合购 | |
499 | - var isok = 1; | |
500 | - var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+good.prom_id+"/"+getApp().globalData.userInfo.user_id; | |
501 | - await getApp().request.promiseGet(url, {}).then(res => { | |
502 | - if(res.data.code==0 && res.data.data){ | |
503 | - if(res.data.data.is_show!=1){ | |
504 | - isok=0; | |
516 | + //当是组合优惠的时候 | |
517 | + if (good.prom_type == 7) { | |
518 | + //如果有组合购 | |
519 | + var isok = 1; | |
520 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + good.prom_id + "/" + getApp().globalData.userInfo.user_id; | |
521 | + await getApp().request.promiseGet(url, {}).then(res => { | |
522 | + if (res.data.code == 0 && res.data.data) { | |
523 | + if (res.data.data.is_show != 1) { | |
524 | + isok = 0; | |
525 | + } | |
526 | + //如果活动已经结束 | |
527 | + if (res.data.data.is_end == 1) { | |
528 | + isok = 0; | |
529 | + } | |
530 | + //已经结束 | |
531 | + if (ut.gettimestamp() > res.data.data.end_time) { | |
532 | + isok = 0; | |
533 | + } | |
534 | + //还未开始 | |
535 | + if (ut.gettimestamp() < res.data.data.start_time) { | |
536 | + isok = 0; | |
537 | + } | |
538 | + | |
539 | + } else { | |
540 | + //未找到商品的活动 | |
541 | + isok = 0; | |
505 | 542 | } |
506 | - //如果活动已经结束 | |
507 | - if(res.data.data.is_end==1){ | |
508 | - isok=0; | |
543 | + | |
544 | + }) | |
545 | + if (!isok) { | |
546 | + var content = gg.goods_name + '活动已经结束,请取消订单'; | |
547 | + th.toast(content); | |
548 | + return false; | |
549 | + } | |
550 | + | |
551 | + var url1 = "/api/weshop/prom/zhbuyGoods/page"; | |
552 | + var req_data = { | |
553 | + page: 1, | |
554 | + pageSize: 1, | |
555 | + store_id: os.stoid, | |
556 | + zh_id: good.prom_id, | |
557 | + goods_id: good.goods_id | |
558 | + } | |
559 | + await getApp().request.promiseGet(url1, { | |
560 | + data: req_data | |
561 | + }).then(res => { | |
562 | + if (ut.ajax_ok(res)) { | |
563 | + var gdlist = res.data.data.pageData[0]; | |
564 | + good.buyqty = gdlist.buyqty; | |
509 | 565 | } |
510 | - //已经结束 | |
511 | - if(ut.gettimestamp()>res.data.data.end_time){ | |
512 | - isok=0; | |
566 | + }) | |
567 | + | |
568 | + var num = good['buyqty']; | |
569 | + console.log(1111); | |
570 | + console.log(num); | |
571 | + //---- 要计算商品的限购 ----- | |
572 | + if (good['buyqty'] > 0) { | |
573 | + if (good.goods_num + promgoodsbuynum > good['buyqty']) { | |
574 | + | |
575 | + var content = good['goods_name'] + "超出活动限购\n"; | |
576 | + th.toast(content); | |
577 | + return false; | |
513 | 578 | } |
514 | - //还未开始 | |
515 | - if(ut.gettimestamp()<res.data.data.start_time){ | |
516 | - isok=0; | |
579 | + } | |
580 | + } | |
581 | + | |
582 | + //如果优惠促销和搭配购的时候 | |
583 | + if ((good.prom_type == 3 || good.prom_type == 5) && good.is_gift != 1 && good.is_collocation != 1) { | |
584 | + var p_ok = 1; | |
585 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { | |
586 | + if (res.data.code == 0) { | |
587 | + var r_data = res.data.data; | |
588 | + if (!r_data.collocationPromList && good.prom_type == 5) { | |
589 | + | |
590 | + var content = good.goods_name + '未找到活动,请取消订单重新购买'; | |
591 | + th.toast(content) | |
592 | + | |
593 | + p_ok = 0; | |
594 | + } | |
595 | + if (!r_data.promGoodsLists && good.prom_type == 3) { | |
596 | + | |
597 | + var content = good.goods_name + '未找到活动,请取消订单重新购买'; | |
598 | + th.toast(content); | |
599 | + p_ok = 0; | |
600 | + } | |
601 | + } else { | |
602 | + | |
603 | + var content = good.goods_name + '未找到活动,请取消订单重新购买' | |
604 | + th.toast(content); | |
605 | + p_ok = 0; | |
517 | 606 | } |
607 | + }) | |
608 | + if (!p_ok) return false; | |
609 | + } | |
518 | 610 | |
519 | - }else{ | |
520 | - //未找到商品的活动 | |
521 | - isok = 0; | |
611 | + //商品的普通购买 ,不要进行判断 | |
612 | + if ((good.prom_type == 1 || good.prom_type == 6 || good.prom_type == 4 || good.prom_type == 8) | |
613 | + && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) { | |
614 | + if (gg.prom_type != good.prom_type) { | |
615 | + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; | |
616 | + th.toast(content); | |
617 | + return false; | |
522 | 618 | } |
523 | 619 | |
524 | - }) | |
525 | - if (!isok){ | |
526 | - var content=gg.goods_name+'活动已经结束,请取消订单'; | |
527 | - th.toast(content); | |
528 | - return false; | |
620 | + } else { | |
621 | + if ((gg.prom_type == 1 || gg.prom_type == 3 || gg.prom_type == 5 || gg.prom_type == 6 || gg.prom_type == 4) | |
622 | + && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) { | |
623 | + var prom = null; | |
624 | + //---如果是活动的时候--- | |
625 | + var prom = null, th = this; | |
626 | + if (gg.prom_type == 1) { | |
627 | + await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | |
628 | + if (res.data.code == 0) { | |
629 | + prom = res.data.data; | |
630 | + } | |
631 | + }) | |
632 | + } | |
633 | + if (gg.prom_type == 6) { | |
634 | + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | |
635 | + if (res.data.code == 0) { | |
636 | + prom = res.data.data; | |
637 | + } | |
638 | + }) | |
639 | + } | |
640 | + | |
641 | + if (gg.prom_type == 4) { | |
642 | + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1", { | |
643 | + data: {store_id: os.stoid, goods_id: gg.goods_id} | |
644 | + }).then(res => { | |
645 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | |
646 | + prom = res.data.data.pageData[0]; | |
647 | + } | |
648 | + }) | |
649 | + } | |
650 | + | |
651 | + if (prom) { | |
652 | + var t_now = ut.gettimestamp(); | |
653 | + if (prom.is_end == 0 && prom.start_time < t_now && prom.end_time > t_now) { | |
654 | + | |
655 | + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; | |
656 | + th.toast(content); | |
657 | + return false; | |
658 | + } | |
659 | + } | |
660 | + } | |
661 | + else { | |
662 | + if (!good.is_gift && good.prom_type != 3) { | |
663 | + var t_ok = 1; | |
664 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { | |
665 | + if (res.data.code == 0) { | |
666 | + var r_data = res.data.data; | |
667 | + //-- 参加了全局的优惠活动 -- | |
668 | + if (r_data.promGoodsLists) { | |
669 | + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; | |
670 | + th.toast(content); | |
671 | + t_ok = 0; | |
672 | + } | |
673 | + } | |
674 | + }) | |
675 | + if (!t_ok) return false; | |
676 | + } | |
677 | + //-- 如果有参加线下取价 -- | |
678 | + if (good.offline_cut > 0) wlist += encodeURIComponent(gg.erpwareid) + ","; | |
679 | + } | |
680 | + //赠品和搭配购不判断商品金额 | |
681 | + var isok = 1; | |
682 | + var card_field = th.data.card_field; | |
683 | + | |
684 | + //-- 如果会员是等级会员,商品有等级价,且不是活动商品,同时线下取价的要放在最后来判断 -- | |
685 | + if (!good.is_gift && !good.is_collocation) { | |
686 | + if (card_field && gg[card_field] > 0) { | |
687 | + if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; | |
688 | + if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
689 | + | |
690 | + } else { | |
691 | + if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0; | |
692 | + if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
693 | + } | |
694 | + var is_h = 0; | |
695 | + if (!isok) { | |
696 | + | |
697 | + var content = gg.goods_name + '商品的价格发生了变化,请取消订单重新购买1' | |
698 | + th.toast(content); | |
699 | + return false; | |
700 | + } | |
701 | + } | |
702 | + | |
703 | + //--如果是线下库存的时候-- | |
704 | + if (th.data.conf.sales_rules == 2) { | |
705 | + var ob = {}; | |
706 | + await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) { | |
707 | + ob = obj; | |
708 | + }) | |
709 | + if (ob.code == -1) { | |
710 | + | |
711 | + var content = gg.goods_name + '门店库存不足,请取消订单'; | |
712 | + th.toast(content); | |
713 | + return false; | |
714 | + } | |
715 | + | |
716 | + } else { | |
717 | + if (good.goods_num > store_count) { | |
718 | + | |
719 | + var content = gg.goods_name + '商品的库存不足,请取消订单'; | |
720 | + th.toast(content); | |
721 | + return false; | |
722 | + } | |
723 | + | |
724 | + } | |
725 | + } | |
726 | + | |
727 | + console.log("------------------------------------"); | |
728 | + //---如果是活动的时候--- | |
729 | + var prom = null, goodsinfo = good, th = this; | |
730 | + if (goodsinfo.prom_type == 1) { | |
731 | + await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + goodsinfo.prom_id, {}).then(res => { | |
732 | + if (res.data.code == 0) { | |
733 | + prom = res.data.data; | |
734 | + } | |
735 | + }) | |
736 | + } | |
737 | + if (goodsinfo.prom_type == 6 && !good.is_pd_normal) { | |
738 | + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + goodsinfo.prom_id, {}).then(res => { | |
739 | + if (res.data.code == 0) { | |
740 | + prom = res.data.data; | |
741 | + } | |
742 | + }) | |
529 | 743 | } |
530 | 744 | |
531 | - var url1 = "/api/weshop/prom/zhbuyGoods/page"; | |
532 | - var req_data = { | |
533 | - page: 1, | |
534 | - pageSize: 1, | |
535 | - store_id: os.stoid, | |
536 | - zh_id: good.prom_id, | |
537 | - goods_id:good.goods_id | |
745 | + if (goodsinfo.prom_type == 4 && !good.is_integral_normal) { | |
746 | + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1", { | |
747 | + data: {store_id: os.stoid, goods_id: goodsinfo.goods_id} | |
748 | + }).then(res => { | |
749 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | |
750 | + prom = res.data.data.pageData[0]; | |
751 | + } | |
752 | + }) | |
538 | 753 | } |
539 | - await getApp().request.promiseGet(url1, { | |
540 | - data: req_data | |
541 | - }).then(res => { | |
542 | - if (ut.ajax_ok(res)) { | |
543 | - var gdlist = res.data.data.pageData[0]; | |
544 | - good.buyqty=gdlist.buyqty; | |
754 | + | |
755 | + //----------如果有活动,并且在进行中,就不计算线下库存--------------- | |
756 | + if (prom) { | |
757 | + var now = ut.gettimestamp(); | |
758 | + if (prom.is_end == 1 && prom.end_time < now) { | |
759 | + | |
760 | + var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单' | |
761 | + th.toast(content); | |
762 | + return false; | |
545 | 763 | } |
546 | - }) | |
547 | 764 | |
548 | - var num=good['buyqty']; | |
549 | - console.log(1111); | |
550 | - console.log(num); | |
551 | - //---- 要计算商品的限购 ----- | |
552 | - if(good['buyqty']>0){ | |
553 | - if(good.goods_num+promgoodsbuynum>good['buyqty']){ | |
765 | + buyed_mum2 = promgoodsbuynum + good.goods_num; | |
766 | + if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) { | |
554 | 767 | |
555 | - var content= good['goods_name']+"超出活动限购\n"; | |
768 | + var content = goodsinfo.goods_name + '购买数量超出商品活动限购,请取消订单' | |
556 | 769 | th.toast(content); |
557 | 770 | return false; |
558 | 771 | } |
559 | - } | |
560 | - } | |
561 | 772 | |
773 | + if (goodsinfo.prom_type == 4) { | |
774 | + if (good.goods_num > prom.limitqty - prom.buy_num) { | |
562 | 775 | |
563 | - | |
564 | - //如果优惠促销和搭配购的时候 | |
565 | - if((good.prom_type==3 || good.prom_type==5) && good.is_gift!=1 && good.is_collocation!=1){ | |
566 | - var p_ok=1; | |
567 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => { | |
568 | - if(res.data.code==0){ | |
569 | - var r_data=res.data.data; | |
570 | - if(!r_data.collocationPromList && good.prom_type==5){ | |
571 | - | |
572 | - var content=good.goods_name+'未找到活动,请取消订单重新购买'; | |
573 | - th.toast(content) | |
574 | - | |
575 | - p_ok=0; | |
576 | - } | |
577 | - if(!r_data.promGoodsLists && good.prom_type==3){ | |
578 | - | |
579 | - var content=good.goods_name+'未找到活动,请取消订单重新购买'; | |
580 | - th.toast(content); | |
581 | - p_ok=0; | |
582 | - } | |
583 | - }else{ | |
584 | - | |
585 | - var content=good.goods_name+'未找到活动,请取消订单重新购买' | |
586 | - th.toast(content); | |
587 | - p_ok=0; | |
588 | - } | |
589 | - }) | |
590 | - if(!p_ok) return false; | |
591 | - } | |
592 | - | |
593 | - //商品的普通购买 ,不要进行判断 | |
594 | - if((good.prom_type==1 || good.prom_type==6 || good.prom_type==4 ) | |
595 | - && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal){ | |
596 | - if(gg.prom_type!=good.prom_type) { | |
597 | - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; | |
598 | - th.toast(content); | |
599 | - return false; | |
600 | - } | |
601 | - | |
602 | - }else{ | |
603 | - if((gg.prom_type==1 || gg.prom_type==3 || gg.prom_type==5 || gg.prom_type==6 || gg.prom_type==4) | |
604 | - && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) { | |
605 | - var prom=null; | |
606 | - //---如果是活动的时候--- | |
607 | - var prom=null,th=this; | |
608 | - if(gg.prom_type==1){ | |
609 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+gg.prom_id,{ | |
610 | - }).then(res=>{ | |
611 | - if(res.data.code==0){ | |
612 | - prom=res.data.data; | |
613 | - } | |
614 | - }) | |
615 | - } | |
616 | - if(gg.prom_type==6){ | |
617 | - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+gg.prom_id,{ | |
618 | - }).then(res=>{ | |
619 | - if(res.data.code==0){ | |
620 | - prom=res.data.data; | |
621 | - } | |
622 | - }) | |
623 | - } | |
624 | - | |
625 | - if(gg.prom_type==4){ | |
626 | - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{ | |
627 | - data:{store_id:os.stoid,goods_id:gg.goods_id} | |
628 | - }).then(res=>{ | |
629 | - if(res.data.code==0 && res.data.data && res.data.data.pageData){ | |
630 | - prom=res.data.data.pageData[0]; | |
631 | - } | |
632 | - }) | |
633 | - } | |
634 | - | |
635 | - if(prom){ | |
636 | - var t_now=ut.gettimestamp(); | |
637 | - if(prom.is_end==0 && prom.start_time<t_now && prom.end_time>t_now){ | |
638 | - | |
639 | - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; | |
640 | - th.toast(content); | |
641 | - return false; | |
642 | - } | |
643 | - } | |
644 | - } | |
645 | - else{ | |
646 | - if(!good.is_gift && good.prom_type!=3 ){ | |
647 | - var t_ok=1; | |
648 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => { | |
649 | - if(res.data.code==0){ | |
650 | - var r_data=res.data.data; | |
651 | - //-- 参加了全局的优惠活动 -- | |
652 | - if(r_data.promGoodsLists){ | |
653 | - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; | |
654 | - th.toast(content); | |
655 | - t_ok=0; | |
656 | - } | |
657 | - } | |
658 | - }) | |
659 | - if(!t_ok) return false; | |
660 | - } | |
661 | - //-- 如果有参加线下取价 -- | |
662 | - if(good.offline_cut>0) wlist+=encodeURIComponent(gg.erpwareid)+","; | |
663 | - } | |
664 | - //赠品和搭配购不判断商品金额 | |
665 | - var isok=1; | |
666 | - var card_field=th.data.card_field; | |
667 | - | |
668 | - //-- 如果会员是等级会员,商品有等级价,且不是活动商品,同时线下取价的要放在最后来判断 -- | |
669 | - if(!good.is_gift && !good.is_collocation) { | |
670 | - if (card_field && gg[card_field] > 0) { | |
671 | - if (good.goods_price != gg[card_field] && good.offline_cut<=0) isok = 0; | |
672 | - if (good.goods_price >gg[card_field] && good.offline_cut>0) isok = 0; //如果线下价格比较贵,则不通过 | |
673 | - | |
674 | - } else { | |
675 | - if (good.goods_price != gg.shop_price && good.offline_cut<=0) isok = 0; | |
676 | - if (good.goods_price> gg.shop_price && good.offline_cut>0) isok = 0; //如果线下价格比较贵,则不通过 | |
677 | - } | |
678 | - var is_h=0; | |
679 | - if (!isok) { | |
680 | - | |
681 | - var content=gg.goods_name + '商品的价格发生了变化,请取消订单重新购买' | |
682 | - th.toast(content); | |
683 | - return false; | |
684 | - } | |
685 | - } | |
686 | - | |
687 | - //--如果是线下库存的时候-- | |
688 | - if(th.data.conf.sales_rules==2){ | |
689 | - var ob={}; | |
690 | - await th.check_down_line_next(gg,good.goods_num,order.pickup_id,function(obj){ | |
691 | - ob=obj; | |
692 | - }) | |
693 | - if(ob.code==-1){ | |
694 | - | |
695 | - var content=gg.goods_name+'门店库存不足,请取消订单'; | |
696 | - th.toast(content); | |
697 | - return false; | |
698 | - } | |
699 | - | |
700 | - }else{ | |
701 | - if(good.goods_num>store_count){ | |
702 | - | |
703 | - var content=gg.goods_name+'商品的库存不足,请取消订单'; | |
704 | - th.toast(content); | |
705 | - return false; | |
706 | - } | |
707 | - | |
708 | - } | |
709 | - } | |
710 | - | |
711 | - console.log("------------------------------------"); | |
712 | - //---如果是活动的时候--- | |
713 | - var prom=null,goodsinfo=good,th=this; | |
714 | - if(goodsinfo.prom_type==1){ | |
715 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+goodsinfo.prom_id,{ | |
716 | - }).then(res=>{ | |
717 | - if(res.data.code==0){ | |
718 | - prom=res.data.data; | |
719 | - } | |
720 | - }) | |
721 | - } | |
722 | - if(goodsinfo.prom_type==6 && !good.is_pd_normal){ | |
723 | - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+goodsinfo.prom_id,{ | |
724 | - }).then(res=>{ | |
725 | - if(res.data.code==0){ | |
726 | - prom=res.data.data; | |
727 | - } | |
728 | - }) | |
729 | - } | |
730 | - | |
731 | - if(goodsinfo.prom_type==4 && !good.is_integral_normal){ | |
732 | - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1",{ | |
733 | - data:{store_id:os.stoid,goods_id:goodsinfo.goods_id} | |
734 | - }).then(res=>{ | |
735 | - if(res.data.code==0 && res.data.data && res.data.data.pageData){ | |
736 | - prom=res.data.data.pageData[0]; | |
737 | - } | |
738 | - }) | |
739 | - } | |
740 | - | |
741 | - //----------如果有活动,并且在进行中,就不计算线下库存--------------- | |
742 | - if(prom){ | |
743 | - var now=ut.gettimestamp(); | |
744 | - if(prom.is_end==1 && prom.end_time<now){ | |
745 | - | |
746 | - var content=goodsinfo.goods_name+'商品的活动已经结束,请取消订单' | |
747 | - th.toast(content); | |
748 | - return false; | |
749 | - } | |
750 | - | |
751 | - buyed_mum2=promgoodsbuynum+good.goods_num; | |
752 | - if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) { | |
753 | - | |
754 | - var content=goodsinfo.goods_name+'购买数量超出商品活动限购,请取消订单' | |
755 | - th.toast(content); | |
756 | - return false; | |
757 | - } | |
758 | - | |
759 | - if(goodsinfo.prom_type==4){ | |
760 | - if (good.goods_num > prom.limitqty-prom.buy_num) { | |
761 | - | |
762 | - var content=goodsinfo.goods_name+'购买数量超出商品活动库存,请取消订单' | |
763 | - th.toast(content); | |
764 | - return false; | |
765 | - } | |
766 | - }else{ | |
767 | - var redis_num = 0; | |
768 | - //------判断活动是否抢光----- | |
769 | - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | |
770 | - os.stoid + "/" + goodsinfo.prom_type + "/" + goodsinfo.prom_id, { | |
771 | - }).then(res => { | |
772 | - redis_num = res.data.data; | |
773 | - }); | |
774 | - | |
775 | - if (good.goods_num > redis_num) { | |
776 | - | |
777 | - var content=gg.goods_name+'超出商品活动库存,请取消订单'; | |
778 | - th.toast(content); | |
779 | - return false; | |
780 | - } | |
781 | - } | |
782 | - | |
783 | - } | |
784 | - } | |
785 | - | |
786 | - //-- 要判断一下线下取价价格是不是发生改变 -- | |
787 | - if(wlist!="" && th.data.is_open_offline && th.data.is_open_offline>0){ | |
788 | - wlist=ut.sub_last(wlist); | |
789 | - var keyid=order.pickup_id; | |
790 | - var user_info=getApp().globalData.userInfo; | |
791 | - if(!keyid) return false; | |
792 | - var offarr=null; | |
793 | - await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", { | |
794 | - data:{ | |
795 | - VIPId:encodeURIComponent(user_info.erpvipid), | |
796 | - store_id:os.stoid, | |
797 | - PickupId:keyid, | |
798 | - WareIds:wlist}, | |
799 | - }, | |
800 | - ).then(res=>{ | |
801 | - if(res.data.code==0 && res.data.data && res.data.data.length>0){ | |
802 | - offarr=res.data.data; | |
803 | - } | |
804 | - }) | |
805 | - if(!offarr && offarr.length<=0){ | |
806 | - th.toast('获取线下取价失败'); | |
807 | - } | |
808 | - var newarr=ut.convert_arr_key(offarr,'WareId'); | |
809 | - //-- 循环判断线下的价格 -- | |
810 | - for(var k in order_goods){ | |
811 | - var good=order_goods[k]; | |
812 | - //判断线下取价是不是一样 | |
813 | - if(newarr[good.erpwareid] && | |
814 | - parseFloat(newarr[good.erpwareid].WarePrice)!=parseFloat(good.goods_price)){ | |
815 | - | |
816 | - var content=good.goods_name + '商品的价格发生了变化,请取消订单重新购买'; | |
817 | - th.toast(content); | |
818 | - return false; | |
819 | - } | |
820 | - } | |
821 | - | |
822 | - } | |
776 | + var content = goodsinfo.goods_name + '购买数量超出商品活动库存,请取消订单' | |
777 | + th.toast(content); | |
778 | + return false; | |
779 | + } | |
780 | + } else { | |
781 | + var redis_num = 0; | |
782 | + //------判断活动是否抢光----- | |
783 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | |
784 | + os.stoid + "/" + goodsinfo.prom_type + "/" + goodsinfo.prom_id, {}).then(res => { | |
785 | + redis_num = res.data.data; | |
786 | + }); | |
787 | + | |
788 | + if (good.goods_num > redis_num) { | |
789 | + | |
790 | + var content = gg.goods_name + '超出商品活动库存,请取消订单'; | |
791 | + th.toast(content); | |
792 | + return false; | |
793 | + } | |
794 | + } | |
823 | 795 | |
824 | - return false; | |
825 | - | |
826 | - th.pay_next(e,o_index); | |
827 | - }, | |
796 | + } | |
797 | + } | |
798 | + | |
799 | + //-- 要判断一下线下取价价格是不是发生改变 -- | |
800 | + if (wlist != "" && th.data.is_open_offline && th.data.is_open_offline > 0) { | |
801 | + wlist = ut.sub_last(wlist); | |
802 | + var keyid = order.pickup_id; | |
803 | + var user_info = getApp().globalData.userInfo; | |
804 | + if (!keyid) return false; | |
805 | + var offarr = null; | |
806 | + await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", { | |
807 | + data: { | |
808 | + VIPId: encodeURIComponent(user_info.erpvipid), | |
809 | + store_id: os.stoid, | |
810 | + PickupId: keyid, | |
811 | + WareIds: wlist | |
812 | + }, | |
813 | + }, | |
814 | + ).then(res => { | |
815 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
816 | + offarr = res.data.data; | |
817 | + } | |
818 | + }) | |
819 | + if (!offarr && offarr.length <= 0) { | |
820 | + th.toast('获取线下取价失败'); | |
821 | + } | |
822 | + var newarr = ut.convert_arr_key(offarr, 'WareId'); | |
823 | + //-- 循环判断线下的价格 -- | |
824 | + for (var k in order_goods) { | |
825 | + var good = order_goods[k]; | |
826 | + //判断线下取价是不是一样 | |
827 | + if (newarr[good.erpwareid] && | |
828 | + parseFloat(newarr[good.erpwareid].WarePrice) != parseFloat(good.goods_price)) { | |
829 | + | |
830 | + var content = good.goods_name + '商品的价格发生了变化,请取消订单重新购买'; | |
831 | + th.toast(content); | |
832 | + return false; | |
833 | + } | |
834 | + } | |
835 | + } | |
836 | + th.pay_next(e, o_index); | |
837 | + }, | |
828 | 838 | |
829 | 839 | |
830 | 840 | pay_next(e,o_index){ | ... | ... |
pages/user/order_list/order_list.wxml
... | ... | @@ -40,27 +40,46 @@ |
40 | 40 | <text selectable='true'>订单编号:{{item.order_sn}}</text> |
41 | 41 | <!-- 商品评价状态 --> |
42 | 42 | <view class="flex-center c-r"> |
43 | - <!-- 订单状态 --> | |
44 | - <view wx:if="{{item.pt_status==1 && item.pt_prom_id>0}}">组团中</view> | |
45 | - <view wx:if="{{(item.order_status==0&&item.pay_status==0)}}">未支付</view> | |
46 | - <block wx:if="{{!(item.is_all_return_status==0 || item.is_all_return_status==1)}}"> | |
47 | - <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0)}}">待发货</view> | |
48 | - <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">待收货</view> | |
49 | - <view wx:if="{{(item.order_status==2)}}">待评价</view> | |
50 | - <view wx:if="{{item.order_status==4}}">已评价</view> | |
51 | - <view wx:if="{{item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> | |
52 | - <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | |
53 | - </view> | |
54 | - <view wx:if="{{item.pt_status==2 && item.pt_tail_money>0}}">待支付尾款</view> | |
55 | - <view wx:if="{{item.order_status==6}}">退款成功</view> | |
56 | - <view wx:if="{{item.pt_status==6}}"><text style="font-size: 26rpx;">支付尾款失败</text></view> | |
57 | - </block> | |
58 | - <block wx:else>退款中</block> | |
59 | - <!-- | |
60 | - <view class="flex" wx:if="{{(item.order_status==0&&item.pay_status==0)}}"> | |
61 | - <view class="lin"></view> | |
62 | - <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | |
63 | - </view>--> | |
43 | + | |
44 | + <block wx:if="{{item.presell}}"> | |
45 | + <block wx:if="{{item.order_status==3}}"> | |
46 | + <text wx:if="{{item.presell.tail_pay_state==2}}">尾款支付失败</text> | |
47 | + </block> | |
48 | + <block wx:else> | |
49 | + <text wx:if="{{!item.presell.deposit_pay_time}}">待支付定金</text> | |
50 | + <text wx:if="{{item.presell.deposit_pay_time && !item.presell.tail_pay_state}}">待尾款</text> | |
51 | + </block> | |
52 | + | |
53 | + <block wx:if="{{!(item.is_all_return_status==0 || item.is_all_return_status==1)}}"> | |
54 | + <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0)}}">待发货</view> | |
55 | + <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">待收货</view> | |
56 | + <view wx:if="{{(item.order_status==2)}}">待评价</view> | |
57 | + <view wx:if="{{item.order_status==4}}">已评价</view> | |
58 | + <view wx:if="{{item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> | |
59 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | |
60 | + </view> | |
61 | + </block> | |
62 | + <block wx:else>退款中</block> | |
63 | + | |
64 | + </block> | |
65 | + <block wx:else> | |
66 | + <!-- 订单状态 --> | |
67 | + <view wx:if="{{item.pt_status==1 && item.pt_prom_id>0}}">组团中</view> | |
68 | + <view wx:if="{{(item.order_status==0&&item.pay_status==0)}}">未支付</view> | |
69 | + <block wx:if="{{!(item.is_all_return_status==0 || item.is_all_return_status==1)}}"> | |
70 | + <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==0)}}">待发货</view> | |
71 | + <view wx:if="{{(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">待收货</view> | |
72 | + <view wx:if="{{(item.order_status==2)}}">待评价</view> | |
73 | + <view wx:if="{{item.order_status==4}}">已评价</view> | |
74 | + <view wx:if="{{item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view> | |
75 | + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image> | |
76 | + </view> | |
77 | + <view wx:if="{{item.pt_status==2 && item.pt_tail_money>0}}">待支付尾款</view> | |
78 | + <view wx:if="{{item.order_status==6}}">退款成功</view> | |
79 | + <view wx:if="{{item.pt_status==6}}"><text style="font-size: 26rpx;">支付尾款失败</text></view> | |
80 | + </block> | |
81 | + <block wx:else>退款中</block> | |
82 | + </block> | |
64 | 83 | |
65 | 84 | </view> |
66 | 85 | </view> |
... | ... | @@ -70,7 +89,7 @@ |
70 | 89 | <!-- 单个商品 --> |
71 | 90 | <!-- wx:if="{{goods.return_btn!=4}}" --> |
72 | 91 | <view> |
73 | - <navigator class="detail_commodity flex-vertical padding" wx:for="{{item.order_goods}}" wx:for-item="goods" wx:for-index="pinx" url="/pages/user/order_detail/order_detail?order_id={{item.order_id}}"> | |
92 | + <navigator class="detail_commodity flex-vertical padding" wx:for="{{item.order_goods}}" wx:for-item="goods" wx:for-index="pinx" url="{{item.ord_url}}?order_id={{item.order_id}}"> | |
74 | 93 | <!-- 商品图片 --> |
75 | 94 | <navigator class="rel"> |
76 | 95 | <image src="{{resourceUrl+goods.original_img}}" binderror="bind_bnerr" lazy-load="{{true}}" data-errorimg="orderList[{{index}}].order_goods[{{pinx}}].original_img"></image> |
... | ... | @@ -173,15 +192,22 @@ |
173 | 192 | </block> |
174 | 193 | <navigator class="commodity_To_evaluate flex-level View_evaluation" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==1)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator> |
175 | 194 | <navigator class="commodity_To_evaluate flex-level View_evaluation" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==2)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator> |
176 | - <navigator class="commodity_To_evaluate flex-level View_evaluation" url="/pages/user/order_detail/order_detail?order_id={{item.order_id}}">订单详情</navigator> | |
195 | + | |
196 | + <navigator class="commodity_To_evaluate flex-level View_evaluation" url="{{item.ord_url}}?order_id={{item.order_id}}">订单详情</navigator> | |
177 | 197 | |
178 | 198 | <block wx:if="{{!(item.has_rt || item.return_btn==2 || item.return_btn==4)}}"> |
179 | 199 | <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="commodity_To_evaluate flex-level comment_go" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">确认收货</view> |
180 | 200 | <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="commodity_To_evaluate flex-level comment_go" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==2)}}">确认收货</view> |
181 | 201 | </block> |
182 | - | |
183 | - | |
184 | - <block wx:if="{{item.order_status==2 && item.is_zsorder!=4}}"> | |
202 | + | |
203 | + <block wx:if="{{item.presell}}"> | |
204 | + <navigator class="commodity_To_evaluate flex-level comment_go" url="/packageC/pages/presell/cart/cart?order_id={{item.order_id}}" data-idx="{{index}}" wx:if="{{item.order_status<3 && item.presell.deposit_pay_time>0 && item.presell.tail_pay_state==0}}">支付尾款</navigator> | |
205 | + | |
206 | + </block> | |
207 | + | |
208 | + | |
209 | + | |
210 | + <block wx:if="{{item.order_status==2 && item.is_zsorder!=4}}"> | |
185 | 211 | <navigator wx:if="{{item.order_goods.length>1}}" class="order-btn white" |
186 | 212 | url="/packageB/pages/user/comment/comment?status=0&order_id={{item.order_id}}">评价</navigator> |
187 | 213 | <navigator wx:else class="order-btn white red-b" |
... | ... | @@ -193,10 +219,15 @@ |
193 | 219 | <navigator class="commodity_To_evaluate flex-level comment_go" bindtap="jumpToCart4" data-idx="{{index}}" wx:if="{{(item.order_status==0&&item.pay_status==0)}}">立即支付</navigator> |
194 | 220 | |
195 | 221 | <!-- 积分购 拼团 搭配购没有有再来一单 --> |
196 | - <block wx:if="{{(item.pay_status==1 || item.order_status==3) && item.pt_prom_id<=0 && item.integral<=0 && item.order_goods[0].prom_type!=5 }}"> | |
222 | + <block wx:if="{{(item.pay_status==1 || item.order_status==3) && !item.presell && item.pt_prom_id<=0 && item.integral<=0 && item.order_goods[0].prom_type!=5 }}"> | |
197 | 223 | <view bindtap="moreOrder" class="commodity_To_evaluate flex-level comment_go" |
198 | 224 | data-index="{{index}}" >再来一单</view> |
199 | 225 | </block> |
226 | + | |
227 | + | |
228 | + | |
229 | + | |
230 | + | |
200 | 231 | |
201 | 232 | </view> |
202 | 233 | </view> | ... | ... |
pages/user/order_list/order_list.wxss
... | ... | @@ -533,11 +533,14 @@ page { |
533 | 533 | } |
534 | 534 | .search-btn { |
535 | 535 | color: white; |
536 | - font-size: 14px; | |
536 | + font-size: 28rpx; | |
537 | 537 | background-color: #FF3B3D; |
538 | - padding: 8px 20px; | |
539 | - border-radius: 0 4px 4px 0; | |
538 | + padding: 6rpx 40rpx; | |
539 | + border-radius: 0 4px 4px 0; | |
540 | + line-height: 60rpx; | |
540 | 541 | } |
542 | + | |
543 | + | |
541 | 544 | .picker-container { |
542 | 545 | padding-right: 10rpx; |
543 | 546 | align-items: center; | ... | ... |