Commit a1d00f34546d08cc328b976ca0c7f22d571b75dd
1 parent
7ee9e88f
OA单优惠促销增加每月礼包
Showing
6 changed files
with
110 additions
and
16 deletions
packageE/pages/cart/cart2/cart2.js
| ... | ... | @@ -5,7 +5,7 @@ var regeneratorRuntime = require('../../../../utils/runtime.js'); |
| 5 | 5 | var util_pay = require("../../../../utils/pay.js"); |
| 6 | 6 | var zh_calc = require("zh_calculate.js"); |
| 7 | 7 | var ladder_calc = require("ladder_calculate.js"); |
| 8 | -// 防抖函数用定时器 | |
| 8 | +// 防抖函数用定时器 | |
| 9 | 9 | let timer; |
| 10 | 10 | Page({ |
| 11 | 11 | data: { |
| ... | ... | @@ -1833,7 +1833,7 @@ Page({ |
| 1833 | 1833 | }, |
| 1834 | 1834 | |
| 1835 | 1835 | calc_per: async function (c_arr) { |
| 1836 | - debugger | |
| 1836 | + | |
| 1837 | 1837 | var send_gf = {}; |
| 1838 | 1838 | var duo_zp_num_arr = {}; |
| 1839 | 1839 | var th = this; |
| ... | ... | @@ -2067,7 +2067,7 @@ Page({ |
| 2067 | 2067 | } |
| 2068 | 2068 | } |
| 2069 | 2069 | |
| 2070 | - debugger | |
| 2070 | + | |
| 2071 | 2071 | var arr = Object.keys(send_gf); |
| 2072 | 2072 | var arr2 = Object.keys(th.data.send_gf); |
| 2073 | 2073 | if (arr2.length > 0) return false; |
| ... | ... | @@ -2082,7 +2082,7 @@ Page({ |
| 2082 | 2082 | |
| 2083 | 2083 | |
| 2084 | 2084 | calclate_lbNum(r_data) { |
| 2085 | - debugger | |
| 2085 | + | |
| 2086 | 2086 | if(!r_data) return false; |
| 2087 | 2087 | |
| 2088 | 2088 | let send_lb = this.data.send_lb; |
| ... | ... | @@ -3681,6 +3681,15 @@ Page({ |
| 3681 | 3681 | ob = JSON.stringify(ob); |
| 3682 | 3682 | th.setData({ [l_txt]: good.zx_libao, [l_txt1]: ob }); |
| 3683 | 3683 | } |
| 3684 | + //每月礼包 | |
| 3685 | + if (good.month_libao) { | |
| 3686 | + var l_txt = "formData.give_monthlb_id"; | |
| 3687 | + //这个是json格式的 | |
| 3688 | + var l_txt1 = "formData.g_monthlb_num"; | |
| 3689 | + var ob = [{ "num": good.month_lb_num, "l_id": good.month_libao }]; | |
| 3690 | + ob = JSON.stringify(ob); | |
| 3691 | + th.setData({ [l_txt]: good.month_libao, [l_txt1]: ob }); | |
| 3692 | + } | |
| 3684 | 3693 | |
| 3685 | 3694 | wx.hideLoading(); |
| 3686 | 3695 | |
| ... | ... | @@ -3965,6 +3974,12 @@ Page({ |
| 3965 | 3974 | order_prom_list.give_zxlb_id = th.data.formData.give_zxlb_id; |
| 3966 | 3975 | order_prom_list.g_zxlb_num = th.data.formData.g_zxlb_num; |
| 3967 | 3976 | } |
| 3977 | + //--- 每月礼包 --- | |
| 3978 | + if (th.data.formData.give_monthlb_id > 0) { | |
| 3979 | + order_prom_list.give_monthlb_id = th.data.formData.give_monthlb_id; | |
| 3980 | + order_prom_list.g_monthlb_num = th.data.formData.g_monthlb_num; | |
| 3981 | + // order_prom_list.g_monthlb_num = [{ "num": good.month_lb_num, "l_id": th.data.formData.month_libao_id }]; | |
| 3982 | + } | |
| 3968 | 3983 | |
| 3969 | 3984 | item.order_prom_list = order_prom_list; |
| 3970 | 3985 | |
| ... | ... | @@ -4273,6 +4288,23 @@ Page({ |
| 4273 | 4288 | order_prom_list.g_zxlb_num = JSON.stringify(t_item.g_zxlb_num); |
| 4274 | 4289 | } |
| 4275 | 4290 | |
| 4291 | + //-- 送每月礼包的时候 -- | |
| 4292 | + if (t_item.monthlibao) { | |
| 4293 | + order_prom_list.give_monthlb_id = t_item.monthlibao; | |
| 4294 | + let marr=[]; | |
| 4295 | + if (t_item.g_monthlb_num && t_item.g_monthlb_num.length>0) { | |
| 4296 | + t_item.g_monthlb_num.map(ite=>{ | |
| 4297 | + let obj={ | |
| 4298 | + num:ite.monthnum, | |
| 4299 | + l_id:ite.month_id, | |
| 4300 | + monthlbtitle:ite.monthlbtitle | |
| 4301 | + } | |
| 4302 | + marr.push(obj) | |
| 4303 | + }) | |
| 4304 | + } | |
| 4305 | + order_prom_list.g_monthlb_num = JSON.stringify(marr); | |
| 4306 | + } | |
| 4307 | + | |
| 4276 | 4308 | if (Object.keys(order_prom_list).length > 0) { |
| 4277 | 4309 | if (order_prom_list.discount_amount) |
| 4278 | 4310 | order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2); |
| ... | ... | @@ -4581,10 +4613,10 @@ Page({ |
| 4581 | 4613 | }) |
| 4582 | 4614 | // pdata.keyid = th.data.bn_goods.keyid |
| 4583 | 4615 | } |
| 4584 | - | |
| 4616 | + // debugger | |
| 4585 | 4617 | var str = JSON.stringify(pdata); |
| 4586 | 4618 | console.log(str,'aaaaaaaaaaaaaaa'); |
| 4587 | - //return false; | |
| 4619 | + // return false; | |
| 4588 | 4620 | |
| 4589 | 4621 | wx.showLoading({ title: "加载中" }); |
| 4590 | 4622 | th.setData({ submit: 1, }) |
| ... | ... | @@ -5865,6 +5897,7 @@ Page({ |
| 5865 | 5897 | } |
| 5866 | 5898 | }).then(res => { |
| 5867 | 5899 | if (res.data.code == 0) { |
| 5900 | + | |
| 5868 | 5901 | var get_data = res.data.data; |
| 5869 | 5902 | arr.is_bz = prom.is_bz; //是不是倍增 |
| 5870 | 5903 | arr.is_xz_yh = arr.is_xz_yh ? arr.is_xz_yh : prom.is_xz_yh; //是不是优惠 |
| ... | ... | @@ -5902,6 +5935,11 @@ Page({ |
| 5902 | 5935 | arr.zxlbtitle = get_data.zxlbtitle; |
| 5903 | 5936 | arr.zx_libao = get_data.zxlibao; |
| 5904 | 5937 | arr.zx_lb_num = get_data.zxlb_num; |
| 5938 | + //立即购买,每月礼包 | |
| 5939 | + arr.monthlbtitle = get_data.monthlbtitle; | |
| 5940 | + arr.month_libao = get_data.monthlibao; | |
| 5941 | + arr.month_lb_num = get_data.monthlb_num; | |
| 5942 | + //----end------- | |
| 5905 | 5943 | |
| 5906 | 5944 | arr.prom_id = prom_id; |
| 5907 | 5945 | |
| ... | ... | @@ -5985,7 +6023,7 @@ Page({ |
| 5985 | 6023 | var pickid = item.pick_id; |
| 5986 | 6024 | var map = th.data.prom_goods_map; |
| 5987 | 6025 | var obj = map[pickid]; |
| 5988 | - debugger | |
| 6026 | + | |
| 5989 | 6027 | if (map[pickid]) { |
| 5990 | 6028 | if (map[pickid][item.prom_id]) { |
| 5991 | 6029 | |
| ... | ... | @@ -6099,7 +6137,7 @@ Page({ |
| 6099 | 6137 | check_is_youhui: function (r_data, pick_id) { |
| 6100 | 6138 | let send_lb = this.data.send_lb; |
| 6101 | 6139 | let lodash = null; |
| 6102 | - debugger | |
| 6140 | + | |
| 6103 | 6141 | r_data.forEach(item => { |
| 6104 | 6142 | if (send_lb[pick_id]) { |
| 6105 | 6143 | for (let i = 0; i < send_lb[pick_id].length; i++) { |
| ... | ... | @@ -6242,7 +6280,7 @@ Page({ |
| 6242 | 6280 | |
| 6243 | 6281 | if (flag == 2) { // flag =2 控制跳转到每月礼包 |
| 6244 | 6282 | // url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; |
| 6245 | - url = `/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo?isBuy=1&id=${id}`; | |
| 6283 | + url = `/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo?isBuy=1&id=${id}&is_act=1`; | |
| 6246 | 6284 | }else if (flag == 1) { |
| 6247 | 6285 | url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 |
| 6248 | 6286 | } else { | ... | ... |
packageE/pages/cart/cart2/cart2.wxml
| ... | ... | @@ -430,7 +430,7 @@ |
| 430 | 430 | |
| 431 | 431 | <!-- 有送礼包 --> |
| 432 | 432 | <view wx:if="{{bn_goods.s_libao}}"> |
| 433 | - <view class="coupon-mes flex jc_sb" style="margin: 10rpx 0; padding-right: 35rpx" data-id="{{bn_goods.s_libao}}" bindtap="viewLbDetails"> | |
| 433 | + <view class="coupon-mes flex jc_sb" style="margin: 10rpx 0; padding-right: 35rpx" data-id="{{bn_goods.s_libao}}" data-flag="1" bindtap="viewLbDetails"> | |
| 434 | 434 | <view class="flex ai_c"> |
| 435 | 435 | <view class="circle1">赠</view>{{bn_goods.lbtitle}} |
| 436 | 436 | <!-- <view class="circle1" wx:if="{{item.zxlb_id>0}}">赠</view>{{item.zxlbtitle}} --> |
| ... | ... | @@ -442,7 +442,7 @@ |
| 442 | 442 | </view> |
| 443 | 443 | <!-- 有送专享礼包 --> |
| 444 | 444 | <view wx:if="{{bn_goods.zx_libao}}"> |
| 445 | - <view class="coupon-mes flex jc_sb" style="margin: 10rpx 0; padding-right: 35rpx" data-id="{{bn_goods.zx_libao}}" data-flag="1" bindtap="viewLbDetails"> | |
| 445 | + <view class="coupon-mes flex jc_sb" style="margin: 10rpx 0; padding-right: 35rpx" data-id="{{bn_goods.zx_libao}}" bindtap="viewLbDetails"> | |
| 446 | 446 | <view class="flex ai_c"> |
| 447 | 447 | <view class="circle1">赠</view>{{bn_goods.zxlbtitle}} |
| 448 | 448 | <!-- <view class="circle1" wx:if="{{item.zxlb_id>0}}">赠</view>{{item.zxlbtitle}} --> |
| ... | ... | @@ -452,6 +452,18 @@ |
| 452 | 452 | </view> |
| 453 | 453 | </view> |
| 454 | 454 | </view> |
| 455 | + <!-- 有送每月礼包 --> | |
| 456 | + <view wx:if="{{bn_goods.month_libao}}"> | |
| 457 | + <view class="coupon-mes flex jc_sb" style="margin: 10rpx 0; padding-right: 35rpx" data-id="{{bn_goods.month_libao}}" data-flag="2" bindtap="viewLbDetails"> | |
| 458 | + <view class="flex ai_c"> | |
| 459 | + <view class="circle1">赠</view>{{bn_goods.monthlbtitle}} | |
| 460 | + <!-- <view class="circle1" wx:if="{{item.zxlb_id>0}}">赠</view>{{item.zxlbtitle}} --> | |
| 461 | + </view> | |
| 462 | + <view class="flex ai_c"> | |
| 463 | + x{{bn_goods.month_lb_num}}<text class="bg_jj"></text> | |
| 464 | + </view> | |
| 465 | + </view> | |
| 466 | + </view> | |
| 455 | 467 | |
| 456 | 468 | |
| 457 | 469 | <!-- 赠品的显示 --> | ... | ... |
packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
| ... | ... | @@ -214,6 +214,43 @@ Page({ |
| 214 | 214 | url: '/packageE/pages/togoin/togoin', |
| 215 | 215 | }) |
| 216 | 216 | }, |
| 217 | + getListInfo: function (e) { | |
| 218 | + var th = this; | |
| 219 | + getApp().request.get(`/api/weshop/marketing/marketingMonthgiftbagForm/get/${a.stoid}/${th.data.params.id}`, { | |
| 220 | + isShowLoading: true, | |
| 221 | + data: { | |
| 222 | + // store_id: a.stoid, //商家ID | |
| 223 | + // user_id: d.user_id, //用户ID | |
| 224 | + // page: 1, | |
| 225 | + // pageSize: 10, | |
| 226 | + // is_end:0, | |
| 227 | + // timetype:1, | |
| 228 | + // id:th.data.params.id | |
| 229 | + }, | |
| 230 | + success: function (res) { | |
| 231 | + if (res.data.code == 0) { | |
| 232 | + // th.data.curpage++; | |
| 233 | + // var arr1 = th.data.wareCard; | |
| 234 | + let obj = res.data.data; | |
| 235 | + let monthgiftbag={ | |
| 236 | + remark:obj.remark, | |
| 237 | + cover_img:obj.imageurl, | |
| 238 | + giftTitle:obj.act_name, | |
| 239 | + lbPrice:obj.oldPrice | |
| 240 | + } | |
| 241 | + let remark=monthgiftbag.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"') | |
| 242 | + monthgiftbag.remark=remark | |
| 243 | + th.setData({ | |
| 244 | + monthgiftbag: monthgiftbag, | |
| 245 | + }) | |
| 246 | + }else { | |
| 247 | + getApp().my_warnning("获取活动失败", 0, th); | |
| 248 | + } | |
| 249 | + | |
| 250 | + } | |
| 251 | + }) | |
| 252 | + | |
| 253 | + }, | |
| 217 | 254 | getList: function (e) { |
| 218 | 255 | var th = this; |
| 219 | 256 | getApp().request.get('/api/weshop/marketing/marketingMonthgiftbagForm/page', { |
| ... | ... | @@ -367,7 +404,11 @@ Page({ |
| 367 | 404 | getApp().goto('/packageE/pages/togoin/togoin'); |
| 368 | 405 | return false; |
| 369 | 406 | } |
| 370 | - this.getList(); | |
| 407 | + if (th.data.params && th.data.params.is_act) { | |
| 408 | + this.getListInfo() | |
| 409 | + }else{ | |
| 410 | + this.getList(); | |
| 411 | + } | |
| 371 | 412 | }) |
| 372 | 413 | |
| 373 | 414 | setTimeout(()=>{ | ... | ... |
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml
| ... | ... | @@ -149,7 +149,7 @@ |
| 149 | 149 | |
| 150 | 150 | <view class="foot_empty data-v-3a5b7e36"></view> |
| 151 | 151 | |
| 152 | - <block wx:if="{{flag != 1}}"> | |
| 152 | + <block wx:if="{{flag != 1 && (params && !params.is_act)}}"> | |
| 153 | 153 | <block wx:if="{{getUserID && monthgiftbag.giftTitle}}"> |
| 154 | 154 | <block wx:if="{{isStart==1}}"> |
| 155 | 155 | <view class="foot_button data-v-3a5b7e36"> |
| ... | ... | @@ -229,7 +229,9 @@ |
| 229 | 229 | <!-- 弹出框扫描 --> |
| 230 | 230 | <qr_code id="qc_com"></qr_code> |
| 231 | 231 | <!-- 制作一个圆球导航 --> |
| 232 | -<nav_b id="nav_b"></nav_b> | |
| 232 | +<block wx:if="{{!params || (params && params.is_act !=1)}}"> | |
| 233 | + <nav_b id="nav_b" ></nav_b> | |
| 234 | +</block> | |
| 233 | 235 | |
| 234 | 236 | <include src="../public/buy_com.wxml"></include> |
| 235 | 237 | <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if="{{!canvasHidden}}"></canvas> | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -7925,7 +7925,7 @@ Page({ |
| 7925 | 7925 | let flag = e.currentTarget.dataset.flag; |
| 7926 | 7926 | let url = ''; |
| 7927 | 7927 | if (flag == 2) { // flag =1 控制跳转到专享礼包 |
| 7928 | - url = `/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo?isBuy=1&id=${id}`; | |
| 7928 | + url = `/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo?isBuy=1&id=${id}&is_act=1`; | |
| 7929 | 7929 | // url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; |
| 7930 | 7930 | } else if (flag == 1) { // flag =1 控制跳转到专享礼包 |
| 7931 | 7931 | url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; | ... | ... |