Commit 3adebc5cc747cb6e246cc5b78077c0ebcaba7201
1 parent
b76ce575
关于退款的单个退和整单退的判断
Showing
2 changed files
with
47 additions
and
6 deletions
pages/user/order_detail/order_detail.js
... | ... | @@ -8,10 +8,17 @@ Page({ |
8 | 8 | iurl: os.imghost, |
9 | 9 | order: null, |
10 | 10 | optionIsGoup: !1, |
11 | - user_note: "" | |
11 | + user_note: "", | |
12 | + conf:null, | |
12 | 13 | }, |
13 | 14 | onLoad: function(e) { |
15 | + var th=this; | |
14 | 16 | var r = void 0 !== e.isGoup && e.isGoup; |
17 | + | |
18 | + getApp().getConfig2(function (e) { | |
19 | + th.setData({conf:e}); | |
20 | + }) | |
21 | + | |
15 | 22 | this.setData({ |
16 | 23 | optionIsGoup: r |
17 | 24 | }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); |
... | ... | @@ -21,7 +28,7 @@ Page({ |
21 | 28 | this.requestOrderDetail(this.data.order.order_id)); |
22 | 29 | }, |
23 | 30 | requestOrderDetail: function(e) { |
24 | - var o = this,oid=e; | |
31 | + var o = this,oid=e,th=this; | |
25 | 32 | r.get(o.data.url + "/api/weshop/order/get/"+os.stoid+"/"+e, { |
26 | 33 | success: function(e) { |
27 | 34 | var r = e.data.data; |
... | ... | @@ -75,9 +82,14 @@ Page({ |
75 | 82 | //----没有相关的退款记录---- |
76 | 83 | if (ttd.data.data.total==0){ |
77 | 84 | r['is_all_return'] = 0; |
85 | + | |
78 | 86 | goodslist.forEach(function (ee, ii) { |
79 | - if (r['order_status'] == 1 && r['pay_status'] == 1 && gtype_num>1) | |
80 | - goodslist[ii]['return_btn']=1; | |
87 | + if (r['order_status'] == 1 && r['pay_status'] == 1 && gtype_num>1){ | |
88 | + //是不是可以单个商品退款 | |
89 | + if(th.check_for_return_btn(r) ) { | |
90 | + goodslist[ii]['return_btn']=1; | |
91 | + } | |
92 | + } | |
81 | 93 | }); |
82 | 94 | }else{ |
83 | 95 | //--------整单退-------- |
... | ... | @@ -348,6 +360,34 @@ Page({ |
348 | 360 | }); |
349 | 361 | }, |
350 | 362 | |
363 | + //--判断是不是可以单个商品退-- | |
364 | + check_for_return_btn:function (item) { | |
365 | + if(item.coupon_no) return false; //有用优惠券 | |
366 | + if(item.order_prom_id) return false; //有订单优惠 | |
367 | + if(item.order_status>=2) return false; //订单状态>2 | |
368 | + var istrue=true; | |
369 | + //----判断是不是有优惠活动和赠送商品---- | |
370 | + for (var g in item.order_goods) { | |
371 | + var g_item=item.order_goods[g]; | |
372 | + if ((g_item.prom_type == 3 && g_item.discount_amount> 0) | |
373 | + || (g_item.prom_type== 3 && g_item.goods_price <= 0) | |
374 | + ) { | |
375 | + istrue=false; break | |
376 | + } | |
377 | + if (g_item.prom_type== 5) { | |
378 | + istrue=false; break | |
379 | + } | |
380 | + } | |
381 | + if(!istrue) return false; | |
382 | + var conf=this.data.conf; | |
383 | + //判断是不是原路退回 | |
384 | + if(conf.refund_type==1) return true; | |
385 | + else{ | |
386 | + if(item.order_amount==0 || item.user_money==0) return true; | |
387 | + } | |
388 | + return false; | |
389 | + } | |
390 | + | |
351 | 391 | |
352 | 392 | |
353 | 393 | }); |
354 | 394 | \ No newline at end of file | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -36,7 +36,7 @@ Page({ |
36 | 36 | if(t.type!=undefined) this.setData({activeCategoryId:t.type}) |
37 | 37 | s.init(this, "", "orderList"); |
38 | 38 | //this.requestOrderList(e), wx.removeStorageSync("order:order_list:update"); |
39 | - getApp().getCeonfig2(function (e) { | |
39 | + getApp().getConfig2(function (e) { | |
40 | 40 | th.setData({conf:e}); |
41 | 41 | }) |
42 | 42 | }, |
... | ... | @@ -100,7 +100,7 @@ Page({ |
100 | 100 | //&& ($tpshop_config['refund_type'] eq 0 || ($tpshop_config['refund_type'] eq 1 && ($list['order_amount'] eq 0 |
101 | 101 | // || $list['user_money'] eq 0))) |
102 | 102 | item.goodslist=goodslist; |
103 | - if(check_for_return_btn(item) ) { | |
103 | + if(th.check_for_return_btn(item) ) { | |
104 | 104 | goodslist[ii]['return_btn'] = 1; |
105 | 105 | } |
106 | 106 | } |
... | ... | @@ -385,6 +385,7 @@ Page({ |
385 | 385 | |
386 | 386 | }, |
387 | 387 | |
388 | + //--判断是不是可以单个商品退-- | |
388 | 389 | check_for_return_btn:function (item) { |
389 | 390 | if(item.coupon_no) return false; //有用优惠券 |
390 | 391 | if(item.order_prom_id) return false; //有订单优惠 | ... | ... |