Commit 3fbf90a03f6eaa6408ea341bffe78697bf9418fe

Authored by yvan.ni
1 parent 11b033fa

服务卡项目,限购的优化

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