Commit 3fbf90a03f6eaa6408ea341bffe78697bf9418fe
1 parent
11b033fa
服务卡项目,限购的优化
Showing
1 changed file
with
20 additions
and
5 deletions
packageA/pages/goodsInfo/goodsInfo.js
... | ... | @@ -853,6 +853,13 @@ Page({ |
853 | 853 | } |
854 | 854 | |
855 | 855 | |
856 | + if(this.data.goodsInputNum==0){ | |
857 | + getApp().my_warnning('请输入购买数量', 1, th, 450); | |
858 | + return false; | |
859 | + } | |
860 | + | |
861 | + | |
862 | + | |
856 | 863 | if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; |
857 | 864 | |
858 | 865 | th.setData({ |
... | ... | @@ -870,6 +877,8 @@ Page({ |
870 | 877 | var limitNum = 0; |
871 | 878 | // 已购买数量 |
872 | 879 | var boughtNum = 0; |
880 | + | |
881 | + var is_ok=1; | |
873 | 882 | |
874 | 883 | // 秒杀活动 |
875 | 884 | if(this.data.prom_type == 1) { |
... | ... | @@ -895,6 +904,7 @@ Page({ |
895 | 904 | // title: '超出活动库存', |
896 | 905 | // }); |
897 | 906 | getApp().my_warnning('超出活动库存', 0, self); |
907 | + is_ok=0; | |
898 | 908 | return false; |
899 | 909 | } else { |
900 | 910 | // 可购买数量>0 |
... | ... | @@ -922,8 +932,9 @@ Page({ |
922 | 932 | // }); |
923 | 933 | getApp().my_warnning('超出活动库存', 0, self); |
924 | 934 | th.setData({ |
925 | - goodsInputNum: res, | |
935 | + goodsInputNum: res || 1 | |
926 | 936 | }); |
937 | + is_ok=0; | |
927 | 938 | return false; |
928 | 939 | }; |
929 | 940 | }; |
... | ... | @@ -935,8 +946,9 @@ Page({ |
935 | 946 | // }); |
936 | 947 | getApp().my_warnning('超出限购数量', 0, self); |
937 | 948 | th.setData({ |
938 | - goodsInputNum: canBuyNum, | |
949 | + goodsInputNum: canBuyNum || 1, | |
939 | 950 | }); |
951 | + is_ok=0; | |
940 | 952 | return false; |
941 | 953 | }; |
942 | 954 | }; |
... | ... | @@ -955,7 +967,10 @@ Page({ |
955 | 967 | }; |
956 | 968 | |
957 | 969 | |
958 | - | |
970 | + if(!is_ok) return false; | |
971 | + | |
972 | + | |
973 | + | |
959 | 974 | if(action=="buy"){ |
960 | 975 | //--------------此时操作的数据------------ |
961 | 976 | var newd = { |
... | ... | @@ -1243,7 +1258,7 @@ Page({ |
1243 | 1258 | // }); |
1244 | 1259 | getApp().my_warnning('超出活动库存', 0, self); |
1245 | 1260 | th.setData({ |
1246 | - goodsInputNum: res, | |
1261 | + goodsInputNum: res || 1, | |
1247 | 1262 | }); |
1248 | 1263 | return false; |
1249 | 1264 | }; |
... | ... | @@ -1256,7 +1271,7 @@ Page({ |
1256 | 1271 | // }); |
1257 | 1272 | getApp().my_warnning('超出限购数量', 0, self); |
1258 | 1273 | th.setData({ |
1259 | - goodsInputNum: canBuyNum, | |
1274 | + goodsInputNum: canBuyNum || 1, | |
1260 | 1275 | }); |
1261 | 1276 | return false; |
1262 | 1277 | }; | ... | ... |