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,10 +8,17 @@ Page({ | ||
8 | iurl: os.imghost, | 8 | iurl: os.imghost, |
9 | order: null, | 9 | order: null, |
10 | optionIsGoup: !1, | 10 | optionIsGoup: !1, |
11 | - user_note: "" | 11 | + user_note: "", |
12 | + conf:null, | ||
12 | }, | 13 | }, |
13 | onLoad: function(e) { | 14 | onLoad: function(e) { |
15 | + var th=this; | ||
14 | var r = void 0 !== e.isGoup && e.isGoup; | 16 | var r = void 0 !== e.isGoup && e.isGoup; |
17 | + | ||
18 | + getApp().getConfig2(function (e) { | ||
19 | + th.setData({conf:e}); | ||
20 | + }) | ||
21 | + | ||
15 | this.setData({ | 22 | this.setData({ |
16 | optionIsGoup: r | 23 | optionIsGoup: r |
17 | }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); | 24 | }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); |
@@ -21,7 +28,7 @@ Page({ | @@ -21,7 +28,7 @@ Page({ | ||
21 | this.requestOrderDetail(this.data.order.order_id)); | 28 | this.requestOrderDetail(this.data.order.order_id)); |
22 | }, | 29 | }, |
23 | requestOrderDetail: function(e) { | 30 | requestOrderDetail: function(e) { |
24 | - var o = this,oid=e; | 31 | + var o = this,oid=e,th=this; |
25 | r.get(o.data.url + "/api/weshop/order/get/"+os.stoid+"/"+e, { | 32 | r.get(o.data.url + "/api/weshop/order/get/"+os.stoid+"/"+e, { |
26 | success: function(e) { | 33 | success: function(e) { |
27 | var r = e.data.data; | 34 | var r = e.data.data; |
@@ -75,9 +82,14 @@ Page({ | @@ -75,9 +82,14 @@ Page({ | ||
75 | //----没有相关的退款记录---- | 82 | //----没有相关的退款记录---- |
76 | if (ttd.data.data.total==0){ | 83 | if (ttd.data.data.total==0){ |
77 | r['is_all_return'] = 0; | 84 | r['is_all_return'] = 0; |
85 | + | ||
78 | goodslist.forEach(function (ee, ii) { | 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 | }else{ | 94 | }else{ |
83 | //--------整单退-------- | 95 | //--------整单退-------- |
@@ -348,6 +360,34 @@ Page({ | @@ -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 | \ No newline at end of file | 394 | \ No newline at end of file |
pages/user/order_list/order_list.js
@@ -36,7 +36,7 @@ Page({ | @@ -36,7 +36,7 @@ Page({ | ||
36 | if(t.type!=undefined) this.setData({activeCategoryId:t.type}) | 36 | if(t.type!=undefined) this.setData({activeCategoryId:t.type}) |
37 | s.init(this, "", "orderList"); | 37 | s.init(this, "", "orderList"); |
38 | //this.requestOrderList(e), wx.removeStorageSync("order:order_list:update"); | 38 | //this.requestOrderList(e), wx.removeStorageSync("order:order_list:update"); |
39 | - getApp().getCeonfig2(function (e) { | 39 | + getApp().getConfig2(function (e) { |
40 | th.setData({conf:e}); | 40 | th.setData({conf:e}); |
41 | }) | 41 | }) |
42 | }, | 42 | }, |
@@ -100,7 +100,7 @@ Page({ | @@ -100,7 +100,7 @@ Page({ | ||
100 | //&& ($tpshop_config['refund_type'] eq 0 || ($tpshop_config['refund_type'] eq 1 && ($list['order_amount'] eq 0 | 100 | //&& ($tpshop_config['refund_type'] eq 0 || ($tpshop_config['refund_type'] eq 1 && ($list['order_amount'] eq 0 |
101 | // || $list['user_money'] eq 0))) | 101 | // || $list['user_money'] eq 0))) |
102 | item.goodslist=goodslist; | 102 | item.goodslist=goodslist; |
103 | - if(check_for_return_btn(item) ) { | 103 | + if(th.check_for_return_btn(item) ) { |
104 | goodslist[ii]['return_btn'] = 1; | 104 | goodslist[ii]['return_btn'] = 1; |
105 | } | 105 | } |
106 | } | 106 | } |
@@ -385,6 +385,7 @@ Page({ | @@ -385,6 +385,7 @@ Page({ | ||
385 | 385 | ||
386 | }, | 386 | }, |
387 | 387 | ||
388 | + //--判断是不是可以单个商品退-- | ||
388 | check_for_return_btn:function (item) { | 389 | check_for_return_btn:function (item) { |
389 | if(item.coupon_no) return false; //有用优惠券 | 390 | if(item.coupon_no) return false; //有用优惠券 |
390 | if(item.order_prom_id) return false; //有订单优惠 | 391 | if(item.order_prom_id) return false; //有订单优惠 |