Commit 48cc32ee9d8b58d59f18e744b992b198a39c8be6
1 parent
acdf3638
~~~ 判断有没有 新增地址, 公共函数抽取 ~~
Showing
11 changed files
with
36 additions
and
17 deletions
app.js
@@ -1319,6 +1319,17 @@ App({ | @@ -1319,6 +1319,17 @@ App({ | ||
1319 | th.goto(url); | 1319 | th.goto(url); |
1320 | 1320 | ||
1321 | }) | 1321 | }) |
1322 | + }, | ||
1323 | + | ||
1324 | + //-- 如果是新会员没有地址的时候,自提的时候可以不用管 -- | ||
1325 | + is_no_addr(th,exp_type){ | ||
1326 | + exp_type=parseInt(exp_type+''); | ||
1327 | + if ( [0,2].indexOf(exp_type)>-1 && th.data.user_addr == null) { | ||
1328 | + th.setData({ submit: 0}); | ||
1329 | + return true; | ||
1330 | + } | ||
1331 | + return false; | ||
1332 | + | ||
1322 | } | 1333 | } |
1323 | 1334 | ||
1324 | }); | 1335 | }); |
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -2324,7 +2324,8 @@ Page({ | @@ -2324,7 +2324,8 @@ Page({ | ||
2324 | //------------立即购买------------- | 2324 | //------------立即购买------------- |
2325 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | 2325 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { |
2326 | 2326 | ||
2327 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { | 2327 | + //if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { |
2328 | + if(getApp().is_no_addr(th,th.data.bn_exp_type)){ | ||
2328 | ff = false; | 2329 | ff = false; |
2329 | getApp().my_warnning("请选择收货地址", 0, th); | 2330 | getApp().my_warnning("请选择收货地址", 0, th); |
2330 | th.data.is_summit_ing = 0; | 2331 | th.data.is_summit_ing = 0; |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -1195,7 +1195,8 @@ Page({ | @@ -1195,7 +1195,8 @@ Page({ | ||
1195 | // console.log("buy_new"); | 1195 | // console.log("buy_new"); |
1196 | 1196 | ||
1197 | //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 | 1197 | //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 |
1198 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == | 1198 | + //if (th.data.bn_exp_type == 0 && th.data.user_addr == null |
1199 | + if (getApp().is_no_addr(th,th.data.bn_exp_type) && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == | ||
1199 | 1)) { | 1200 | 1)) { |
1200 | ff = false; | 1201 | ff = false; |
1201 | getApp().my_warnning("请选择收货地址", 0, this); | 1202 | getApp().my_warnning("请选择收货地址", 0, this); |
packageC/pages/payForAnother/payForAnother.js
@@ -2038,7 +2038,8 @@ Page({ | @@ -2038,7 +2038,8 @@ Page({ | ||
2038 | //------------立即购买------------- | 2038 | //------------立即购买------------- |
2039 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | 2039 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { |
2040 | 2040 | ||
2041 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { | 2041 | + //if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { |
2042 | + if(getApp().is_no_addr(th,th.data.bn_exp_type)){ | ||
2042 | ff = false; | 2043 | ff = false; |
2043 | getApp().my_warnning("请选择收货地址", 0, th); | 2044 | getApp().my_warnning("请选择收货地址", 0, th); |
2044 | th.data.is_summit_ing = 0; | 2045 | th.data.is_summit_ing = 0; |
packageC/pages/presell/cart/cart.js
@@ -2392,10 +2392,8 @@ Page({ | @@ -2392,10 +2392,8 @@ Page({ | ||
2392 | }, | 2392 | }, |
2393 | //选择支付方式 | 2393 | //选择支付方式 |
2394 | set_pay_type: function (e) { | 2394 | set_pay_type: function (e) { |
2395 | - | ||
2396 | if(this.data.paying) return false; | 2395 | if(this.data.paying) return false; |
2397 | this.data.paying=1; | 2396 | this.data.paying=1; |
2398 | - | ||
2399 | var type = e.currentTarget.dataset.type; | 2397 | var type = e.currentTarget.dataset.type; |
2400 | this.to_pay_type(type); | 2398 | this.to_pay_type(type); |
2401 | }, | 2399 | }, |
@@ -2404,12 +2402,11 @@ Page({ | @@ -2404,12 +2402,11 @@ Page({ | ||
2404 | to_pay_type: function (ind) { | 2402 | to_pay_type: function (ind) { |
2405 | var th = this; | 2403 | var th = this; |
2406 | //--物流支付时要有地址-- | 2404 | //--物流支付时要有地址-- |
2407 | - if (th.data.exp_type == 0 && th.data.user_addr == null) { | 2405 | + //if (th.data.exp_type == 0 && th.data.user_addr == null) { |
2406 | + if(getApp().is_no_addr(th,th.data.exp_type)){ | ||
2407 | + this.data.paying=0; | ||
2408 | return getApp().my_warnning("请选择收货地址", 0, th); | 2408 | return getApp().my_warnning("请选择收货地址", 0, th); |
2409 | } | 2409 | } |
2410 | - | ||
2411 | - | ||
2412 | - | ||
2413 | th.data.exp_type=parseInt(th.data.exp_type+''); | 2410 | th.data.exp_type=parseInt(th.data.exp_type+''); |
2414 | //---支付参数-- | 2411 | //---支付参数-- |
2415 | var dd = { | 2412 | var dd = { |
packageC/pages/presell/cart/cart2.js
@@ -1116,11 +1116,13 @@ Page({ | @@ -1116,11 +1116,13 @@ Page({ | ||
1116 | //------------立即购买------------- | 1116 | //------------立即购买------------- |
1117 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | 1117 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { |
1118 | 1118 | ||
1119 | - if( [0,2].indexOf(th.data.bn_exp_type)>-1 && th.data.user_addr == null) { | 1119 | + //if( [0,2].indexOf(th.data.bn_exp_type)>-1 && th.data.user_addr == null) { |
1120 | + if(getApp().is_no_addr(th,th.data.bn_exp_type)){ | ||
1120 | ff = false; | 1121 | ff = false; |
1121 | getApp().my_warnning("请选择收货地址", 0, th); | 1122 | getApp().my_warnning("请选择收货地址", 0, th); |
1122 | th.data.is_summit_ing = 0; | 1123 | th.data.is_summit_ing = 0; |
1123 | } | 1124 | } |
1125 | + | ||
1124 | if (!ff) return false; | 1126 | if (!ff) return false; |
1125 | var addr = th.data.user_addr; | 1127 | var addr = th.data.user_addr; |
1126 | if (th.data.bn_exp_type == 1) addr = null; | 1128 | if (th.data.bn_exp_type == 1) addr = null; |
packageC/pages/presell/cart/cart2_pre.js
@@ -719,7 +719,8 @@ Page({ | @@ -719,7 +719,8 @@ Page({ | ||
719 | //------------立即购买------------- | 719 | //------------立即购买------------- |
720 | 720 | ||
721 | //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 | 721 | //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 |
722 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | 722 | + //th.data.bn_exp_type == 0 && th.data.user_addr == null |
723 | + if (getApp().is_no_addr(th,th.data.bn_exp_type) && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | ||
723 | ff = false; | 724 | ff = false; |
724 | getApp().my_warnning("请选择收货地址", 0, this); | 725 | getApp().my_warnning("请选择收货地址", 0, this); |
725 | this.data.is_summit_ing = 0; | 726 | this.data.is_summit_ing = 0; |
packageE/pages/cart/cart2/cart2.js
@@ -3815,7 +3815,8 @@ Page({ | @@ -3815,7 +3815,8 @@ Page({ | ||
3815 | var ff = true; | 3815 | var ff = true; |
3816 | //------------立即购买------------- | 3816 | //------------立即购买------------- |
3817 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | 3817 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { |
3818 | - if ( [0,2].indexOf(th.data.bn_exp_type)>-1 && th.data.user_addr == null) { | 3818 | + //if ( [0,2].indexOf(th.data.bn_exp_type)>-1 && th.data.user_addr == null) { |
3819 | + if(getApp().is_no_addr(th,th.data.bn_exp_type)){ | ||
3819 | ff = false; | 3820 | ff = false; |
3820 | getApp().my_warnning("请选择收货地址", 0, th); | 3821 | getApp().my_warnning("请选择收货地址", 0, th); |
3821 | th.data.is_summit_ing = 0; | 3822 | th.data.is_summit_ing = 0; |
packageE/pages/cart/cart2_inte/cart2_inte.js
@@ -1001,7 +1001,7 @@ Page({ | @@ -1001,7 +1001,7 @@ Page({ | ||
1001 | } | 1001 | } |
1002 | }) | 1002 | }) |
1003 | if(!is_next){ | 1003 | if(!is_next){ |
1004 | - th.setData({is_show_sub:1, submit: 0,same_ok:0 }) | 1004 | + th.setData({is_show_sub:1, submit: 0,same_ok:0,show_submit:1}) |
1005 | return false | 1005 | return false |
1006 | } | 1006 | } |
1007 | 1007 | ||
@@ -1081,10 +1081,12 @@ Page({ | @@ -1081,10 +1081,12 @@ Page({ | ||
1081 | //------------立即购买------------- | 1081 | //------------立即购买------------- |
1082 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | 1082 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { |
1083 | 1083 | ||
1084 | - if ([0,2].indexOf(th.data.bn_exp_type)>-1 && th.data.user_addr == null) { | 1084 | + //if ([0,2].indexOf(th.data.bn_exp_type)>-1 && th.data.user_addr == null) { |
1085 | + if(getApp().is_no_addr(th,th.data.bn_exp_type)){ | ||
1085 | ff = false; getApp().my_warnning("请选择收货地址", 0, th); | 1086 | ff = false; getApp().my_warnning("请选择收货地址", 0, th); |
1086 | th.data.is_summit_ing = 0; | 1087 | th.data.is_summit_ing = 0; |
1087 | } | 1088 | } |
1089 | + | ||
1088 | if (!ff) return false; | 1090 | if (!ff) return false; |
1089 | var addr = th.data.user_addr; | 1091 | var addr = th.data.user_addr; |
1090 | if (th.data.bn_exp_type == 1) addr = null; | 1092 | if (th.data.bn_exp_type == 1) addr = null; |
pages/cart/cart2_pt/cart2_pt.js
@@ -1084,7 +1084,8 @@ Page({ | @@ -1084,7 +1084,8 @@ Page({ | ||
1084 | console.log("buy_new"); | 1084 | console.log("buy_new"); |
1085 | 1085 | ||
1086 | //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 | 1086 | //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 |
1087 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | 1087 | + //th.data.bn_exp_type == 0 && th.data.user_addr == null |
1088 | + if (getApp().is_no_addr(th,th.data.bn_exp_type) && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | ||
1088 | ff = false; | 1089 | ff = false; |
1089 | getApp().my_warnning("请选择收货地址", 0, this); | 1090 | getApp().my_warnning("请选择收货地址", 0, this); |
1090 | this.data.is_summit_ing = 0; | 1091 | this.data.is_summit_ing = 0; |
pages/cart/cart_wk/cart_wk.js
@@ -570,11 +570,12 @@ Page({ | @@ -570,11 +570,12 @@ Page({ | ||
570 | to_pay_type: function (ind) { | 570 | to_pay_type: function (ind) { |
571 | var th = this; | 571 | var th = this; |
572 | //--物流支付时要有地址-- | 572 | //--物流支付时要有地址-- |
573 | - if (th.data.exp_type == 0 && th.data.user_addr == null) { | 573 | + //if (th.data.exp_type == 0 && th.data.user_addr == null) { |
574 | + if (getApp().is_no_addr(th,th.data.exp_type)) { | ||
575 | + this.data.paying=0; | ||
574 | return getApp().my_warnning("请选择收货地址", 0, th); | 576 | return getApp().my_warnning("请选择收货地址", 0, th); |
575 | } | 577 | } |
576 | 578 | ||
577 | - | ||
578 | th.data.exp_type=parseInt(th.data.exp_type+''); | 579 | th.data.exp_type=parseInt(th.data.exp_type+''); |
579 | //---支付参数-- | 580 | //---支付参数-- |
580 | var dd = { | 581 | var dd = { |