Commit ad40684d0894e35054bc7879ca3b5ad5b58cc8c2
1 parent
52be705b
订单列表
Showing
1 changed file
with
48 additions
and
2 deletions
pages/user/order_list/order_list.js
| ... | ... | @@ -28,12 +28,17 @@ Page({ | 
| 28 | 28 | |
| 29 | 29 | //已经读取过接口 | 
| 30 | 30 | is_get:0, | 
| 31 | + conf:null, | |
| 31 | 32 | }, | 
| 32 | 33 | onLoad: function(t) { | 
| 34 | + var th=this; | |
| 33 | 35 | //var e = void 0 === t.type ? this.data.activeCategoryId : t.type; | 
| 34 | 36 | if(t.type!=undefined) this.setData({activeCategoryId:t.type}) | 
| 35 | 37 | s.init(this, "", "orderList"); | 
| 36 | 38 | //this.requestOrderList(e), wx.removeStorageSync("order:order_list:update"); | 
| 39 | + getApp().getCeonfig2(function (e) { | |
| 40 | + th.setData({conf:e}); | |
| 41 | + }) | |
| 37 | 42 | }, | 
| 38 | 43 | onShow: function() { | 
| 39 | 44 | //wx.getStorageSync("order:order_list:update") && (wx.setStorageSync("order:order_list:update", !1), | 
| ... | ... | @@ -60,6 +65,7 @@ Page({ | 
| 60 | 65 | case "4": | 
| 61 | 66 | r +="&order_status=2"; break; | 
| 62 | 67 | } | 
| 68 | + | |
| 63 | 69 | this.setData({ activeCategoryId: t }); r = r + "&page=" + e.data.currentPage; | 
| 64 | 70 | s.request(r, function(t) { | 
| 65 | 71 | |
| ... | ... | @@ -83,12 +89,22 @@ Page({ | 
| 83 | 89 | var gtype_num = tt.data.data.total; | 
| 84 | 90 | if(ttd.data.data.pageData == undefined) return false; | 
| 85 | 91 | var goodslist = tt.data.data.pageData; | 
| 92 | + | |
| 86 | 93 | //----没有相关的退款记录---- | 
| 87 | 94 | if (ttd.data.data.total==0){ | 
| 88 | 95 | data[ind]['is_all_return'] = 0; | 
| 89 | 96 | goodslist.forEach(function (ee, ii) { | 
| 90 | - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num>1) | |
| 91 | - goodslist[ii]['return_btn']=1; | |
| 97 | + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num>1){ | |
| 98 | + | |
| 99 | + //empty($list.coupon_no) && empty($list.order_prom_id) && $list.order_status lt 2 && empty($list.is_prom) | |
| 100 | + //&& ($tpshop_config['refund_type'] eq 0 || ($tpshop_config['refund_type'] eq 1 && ($list['order_amount'] eq 0 | |
| 101 | + // || $list['user_money'] eq 0))) | |
| 102 | + item.goodslist=goodslist; | |
| 103 | + if(check_for_return_btn(item) ) { | |
| 104 | + goodslist[ii]['return_btn'] = 1; | |
| 105 | + } | |
| 106 | + } | |
| 107 | + | |
| 92 | 108 | }); | 
| 93 | 109 | }else{ | 
| 94 | 110 | //--------整单退-------- | 
| ... | ... | @@ -367,5 +383,35 @@ Page({ | 
| 367 | 383 | url: "/pages/cart/cart_wk/cart_wk?order_id=" + order_id, | 
| 368 | 384 | }); | 
| 369 | 385 | |
| 386 | + }, | |
| 387 | + | |
| 388 | + check_for_return_btn:function (item) { | |
| 389 | + if(item.coupon_no) return false; //有用优惠券 | |
| 390 | + if(item.order_prom_id) return false; //有订单优惠 | |
| 391 | + if(item.order_status>=2) return false; //订单状态>2 | |
| 392 | + var istrue=true; | |
| 393 | + //----判断是不是有优惠活动和赠送商品---- | |
| 394 | + for (var g in item.goodslist) { | |
| 395 | + var g_item=item.goodslist[g]; | |
| 396 | + if ((g_item.prom_type == 3 && g_item.discount_amount> 0) | |
| 397 | + || (g_item.prom_type== 3 && g_item.goods_price <= 0) | |
| 398 | + ) { | |
| 399 | + istrue=false; break | |
| 400 | + } | |
| 401 | + if (g_item.prom_type== 5) { | |
| 402 | + istrue=false; break | |
| 403 | + } | |
| 404 | + } | |
| 405 | + if(!istrue) return false; | |
| 406 | + var conf=this.data.conf; | |
| 407 | + //判断是不是原路退回 | |
| 408 | + if(conf.refund_type==1) return true; | |
| 409 | + else{ | |
| 410 | + if(item.order_amount==0 || item.user_money==0) return true; | |
| 411 | + } | |
| 412 | + return false; | |
| 370 | 413 | } | 
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 371 | 417 | }); | 
| 372 | 418 | \ No newline at end of file | ... | ... | 
