Commit 567644cfb2574d12341b1a0d6bbfa3af860a1057

Authored by yvan.ni
1 parent 209289bb

团购活动 指定用户参与

components/diy_goodsGroup/diy_goodsGroup.js
... ... @@ -541,6 +541,9 @@ Component({
541 541 th.data.requestData.push(item);
542 542 })
543 543 } else {
  544 + item.prom_type = 0;
  545 + item.prom_id = 0;
  546 + item.prom_price = null;
544 547 th.data.requestData.push(item);
545 548 }
546 549 }
... ...
components/diy_serviceCard/diy_serviceCard.js
... ... @@ -508,6 +508,9 @@ Component({
508 508 case 1:
509 509 url+="&prom_type=1&prom_id="+arr[0].act_id;
510 510 break;
  511 + case 2:
  512 + url="/packageG/pages/group_buy/goodsInfo/goodsInfo?goods_id="+gid+"&prom_id="+arr2[0].act_id;
  513 + break;
511 514 case 6:
512 515 url = `/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?goods_id=${gid}&prom_type=${arr2[0].prom_type}&prom_id=${arr[0].act_id}`;
513 516 break;
... ...
packageA/pages/distribution/shop/shop.wxml
... ... @@ -235,7 +235,7 @@
235 235 <view class="pd20 fs26">
236 236 <view class="ellipsis-2 h68 mgb20">{{item.goods_name}}</view>
237 237 <!-- 判断是否有活动价 -->
238   - <block wx:if="{{(item.prom_price>0 || item.prom_integral>0) && item.prom_type!=2 && item.prom_id>0}}">
  238 + <block wx:if="{{(item.prom_price>0 || item.prom_integral>0) && item.prom_id>0 && item.prom_type!=7 && item.prom_type!=10}}">
239 239 <view class="flex xc-wc">
240 240 <text wx:if="{{item.prom_integral}}">
241 241 <text class="fs30" style="font-weight: bold;">{{item.prom_integral}}</text>
... ...
packageG/pages/group_buy/goodsInfo/goodsInfo.js
... ... @@ -871,60 +871,63 @@ Page({
871 871 var boughtNum = 0;
872 872 var is_ok = 1;
873 873  
874   - // 获取redis当前可以购买的数量
875   - // 如果数量为0,设置和显示已抢光
876   - // 否则,进一步判断是否超出限购或超出库存
877   - await this.getactLen().then(async function (res) {
878   - redisNums = res;
879   - let curNum = th.data.goodsInputNum;
880   - // res: redis可购买数量
881   - console.log('当前可以购买的数量:', res);
882   - if (res <= 0) {
883   - // 可购买数量<=0, 设置和显示已抢光
884   - th.setData({
885   - prom_r_null: 1,
886   - });
887   - getApp().my_warnning('超出活动库存', 0, self);
888   - is_ok = 0;
889   - return false;
890   - } else {
891   -
892   - if(curNum>redisNums){
  874 + if(this.data.prom_type == 2) {
  875 +
  876 + // 获取redis当前可以购买的数量
  877 + // 如果数量为0,设置和显示已抢光
  878 + // 否则,进一步判断是否超出限购或超出库存
  879 + await this.getactLen().then(async function (res) {
  880 + redisNums = res;
  881 + let curNum = th.data.goodsInputNum;
  882 + // res: redis可购买数量
  883 + console.log('当前可以购买的数量:', res);
  884 + if (res <= 0) {
  885 + // 可购买数量<=0, 设置和显示已抢光
  886 + th.setData({
  887 + prom_r_null: 1,
  888 + });
893 889 getApp().my_warnning('超出活动库存', 0, self);
894 890 is_ok = 0;
895 891 return false;
896   - }
897   - // 可购买数量>0
898   - // 计算自己还可以购买的数量
899   - // 自己还可购买的数量c = 每人活动限购数量a - 自己已经购买的数量b
900   - // 如果限购数量a>redis可购买数量d,当增加数量t>d, 提示超出库存
901   - // 如果限购数量a<=redis可购买数量d, 当增加数量t>a,提示超出限购
902   - let actInfo = th.data.sele_g;
903   - if(actInfo.buy_limit>0){
904   - await th.get_buy_num2().then(function (data) {
905   - let limited = actInfo.buy_limit; // 限购数量a
906   - let promcardbuynum = data.data.data.promcardbuynum;
907   - let canBuyNum = limited - promcardbuynum; // 自己还可购买的数量c
908   -
909   - limitNum = limited;
910   - boughtNum = promcardbuynum;
  892 + } else {
911 893  
912   - if (canBuyNum <= 0) {
913   - canBuyNum = 0;
914   - }
  894 + if (curNum > redisNums) {
  895 + getApp().my_warnning('超出活动库存', 0, self);
  896 + is_ok = 0;
  897 + return false;
  898 + }
  899 + // 可购买数量>0
  900 + // 计算自己还可以购买的数量
  901 + // 自己还可购买的数量c = 每人活动限购数量a - 自己已经购买的数量b
  902 + // 如果限购数量a>redis可购买数量d,当增加数量t>d, 提示超出库存
  903 + // 如果限购数量a<=redis可购买数量d, 当增加数量t>a,提示超出限购
  904 + let actInfo = th.data.sele_g;
  905 + if (actInfo.buy_limit > 0) {
  906 + await th.get_buy_num2().then(function (data) {
  907 + let limited = actInfo.buy_limit; // 限购数量a
  908 + let promcardbuynum = data.data.data.promcardbuynum;
  909 + let canBuyNum = limited - promcardbuynum; // 自己还可购买的数量c
  910 +
  911 + limitNum = limited;
  912 + boughtNum = promcardbuynum;
  913 +
  914 + if (canBuyNum <= 0) {
  915 + canBuyNum = 0;
  916 + }
915 917  
916   - if (curNum > canBuyNum) {
917   - getApp().my_warnning('超出限购数量', 0, self);
918   - th.setData({
919   - goodsInputNum: canBuyNum || 1,
920   - });
921   - is_ok = 0;
922   - return false;
923   - }
924   - })
  918 + if (curNum > canBuyNum) {
  919 + getApp().my_warnning('超出限购数量', 0, self);
  920 + th.setData({
  921 + goodsInputNum: canBuyNum || 1,
  922 + });
  923 + is_ok = 0;
  924 + return false;
  925 + }
  926 + })
  927 + }
925 928 }
926   - }
927   - })
  929 + })
  930 + }
928 931  
929 932 if (!is_ok) return false;
930 933  
... ...
pages/goods/categoryList/categoryList.js
... ... @@ -1068,10 +1068,11 @@ Page({
1068 1068  
1069 1069 requestGoodsList: function (t) {
1070 1070 var that = this;
  1071 + var user=getApp().globalData.user_id || 0;
1071 1072 that.data.requestUrl = t;
1072 1073 console.error(666666);
1073   - e.get("/api/weshop/goods/page?1=1", {
1074   - data: { page: that.data.stylePage, cat_id: that.data.cat_id, parent_id: 0, orderField: 'sort', orderType: 'asc', is_mainshow: 1, isonsale: 1, store_id: oo.stoid, is_recommend: 1 },
  1074 + e.get("/api/weshop/goods/page?1=1&isnewwhere=1", {
  1075 + data: { page: that.data.stylePage, cat_id: that.data.cat_id, parent_id: 0, orderField: 'sort', orderType: 'asc', is_mainshow: 1, isonsale: 1, store_id: oo.stoid, is_recommend: 1,user_id:user_id },
1075 1076 success: function (data) {
1076 1077 console.log(data.data.data.pageData)
1077 1078 that.setData({
... ... @@ -1173,8 +1174,9 @@ Page({
1173 1174 console.log("cid:=" + cid)
1174 1175 console.log("cid:=" + this.data.cat_id);
1175 1176 var s = this
1176   - e.get("/api/weshop/goods/page?1=1", {
1177   - data: { page: page, cat_id: cid, parent_id: 0, orderField: 'sort', orderType: 'asc', is_mainshow: 1, isonsale: 1, store_id: oo.stoid, is_recommend: 1 },
  1177 + var user_id=getApp().globalData.user_id || 0;
  1178 + e.get("/api/weshop/goods/page?1=1&isnewwhere=1", {
  1179 + data: { page: page, cat_id: cid, parent_id: 0, orderField: 'sort', orderType: 'asc', is_mainshow: 1, isonsale: 1, store_id: oo.stoid, is_recommend: 1,user_id:user_id },
1178 1180 success: function (e) {
1179 1181 console.log('上拉加载。。。。。。。。。');
1180 1182 console.log(e.data.data.pageData)
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -4771,7 +4771,7 @@ Page({
4771 4771 prom_r_null: 1
4772 4772 });
4773 4773 //拿取价格并且判断时间--
4774   - getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gid + "/" + prom_id, {
  4774 + getApp().request.get("/api/weshop/goods/groupBuy/getNewActInfo/" + os.stoid + "/" + gid + "/" + prom_id+"/"+user_id, {
4775 4775 success: function (t) {
4776 4776 if (t.data.code != 0) {
4777 4777 ee.get_normal(gid);
... ... @@ -9027,10 +9027,20 @@ Page({
9027 9027 },
9028 9028  
9029 9029 get_normal(gid) {
9030   - this.setData({
9031   - prom_type: 0,
9032   - isshow: 1,
9033   - });
  9030 +
  9031 + var set_ob={};
  9032 + if (this.data.data.pick_up_lists && this.data.data.pick_up_lists.length) {
  9033 + set_ob={
  9034 + ['data.pickup_ids']:this.data.data.pick_up_lists,
  9035 + ['sele_g.pickup_ids']:this.data.data.pick_up_lists,
  9036 + ['front_g.pickup_ids']:this.data.data.pick_up_lists,
  9037 + }
  9038 + }
  9039 + set_ob.prom_type= 0;
  9040 + set_ob.isshow=1;
  9041 + this.setData(set_ob);
  9042 +
  9043 +
9034 9044 this.get_sku(os.stoid, this.data.data, gid);
9035 9045 this.get_sto();
9036 9046 if (!this.data.data.whsle_id)
... ...
pages/template/index.json
... ... @@ -27,7 +27,8 @@
27 27 "floatingWindow": "/components/diy_floatingWindow/diy_floatingWindow",
28 28 "floatingBox": "/components/diy_floatingBox/diy_floatingBox",
29 29 "div_tab_bar": "/custom-tab-bar/index",
30   - "presell": "/components/diy_pregoods/diy_pregoods"
  30 + "presell": "/components/diy_pregoods/diy_pregoods",
  31 + "serviceCard": "/components/diy_serviceCard/diy_serviceCard"
31 32 },
32 33 "enablePullDownRefresh": false,
33 34 "onReachBottomDistance":300,
... ...
pages/template/index.wxml
... ... @@ -177,6 +177,12 @@
177 177 <!-- <luckyGo object="{{item.content}}"></luckyGo> -->
178 178 <diy_public object="{{item.content}}" prom_type="9"></diy_public>
179 179 </block>
  180 +
  181 + <!-- 服务卡项 -->
  182 + <block wx:if="{{item.ename=='servicecategory'}}">
  183 + <serviceCard object="{{item.content}}" sticky="{{template_arr[0].content.is_top}}"></serviceCard>
  184 + </block>
  185 +
180 186 </view>
181 187  
182 188 </block>
... ...