Commit a1d00f34546d08cc328b976ca0c7f22d571b75dd

Authored by 前端开发-罗建龙
1 parent 7ee9e88f

OA单优惠促销增加每月礼包

packageE/pages/cart/cart2/cart2.js
@@ -5,7 +5,7 @@ var regeneratorRuntime = require('../../../../utils/runtime.js'); @@ -5,7 +5,7 @@ var regeneratorRuntime = require('../../../../utils/runtime.js');
5 var util_pay = require("../../../../utils/pay.js"); 5 var util_pay = require("../../../../utils/pay.js");
6 var zh_calc = require("zh_calculate.js"); 6 var zh_calc = require("zh_calculate.js");
7 var ladder_calc = require("ladder_calculate.js"); 7 var ladder_calc = require("ladder_calculate.js");
8 -// 防抖函数用定时器 8 +// 防抖函数用定时器
9 let timer; 9 let timer;
10 Page({ 10 Page({
11 data: { 11 data: {
@@ -1833,7 +1833,7 @@ Page({ @@ -1833,7 +1833,7 @@ Page({
1833 }, 1833 },
1834 1834
1835 calc_per: async function (c_arr) { 1835 calc_per: async function (c_arr) {
1836 - debugger 1836 +
1837 var send_gf = {}; 1837 var send_gf = {};
1838 var duo_zp_num_arr = {}; 1838 var duo_zp_num_arr = {};
1839 var th = this; 1839 var th = this;
@@ -2067,7 +2067,7 @@ Page({ @@ -2067,7 +2067,7 @@ Page({
2067 } 2067 }
2068 } 2068 }
2069 2069
2070 - debugger 2070 +
2071 var arr = Object.keys(send_gf); 2071 var arr = Object.keys(send_gf);
2072 var arr2 = Object.keys(th.data.send_gf); 2072 var arr2 = Object.keys(th.data.send_gf);
2073 if (arr2.length > 0) return false; 2073 if (arr2.length > 0) return false;
@@ -2082,7 +2082,7 @@ Page({ @@ -2082,7 +2082,7 @@ Page({
2082 2082
2083 2083
2084 calclate_lbNum(r_data) { 2084 calclate_lbNum(r_data) {
2085 - debugger 2085 +
2086 if(!r_data) return false; 2086 if(!r_data) return false;
2087 2087
2088 let send_lb = this.data.send_lb; 2088 let send_lb = this.data.send_lb;
@@ -3681,6 +3681,15 @@ Page({ @@ -3681,6 +3681,15 @@ Page({
3681 ob = JSON.stringify(ob); 3681 ob = JSON.stringify(ob);
3682 th.setData({ [l_txt]: good.zx_libao, [l_txt1]: ob }); 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 wx.hideLoading(); 3694 wx.hideLoading();
3686 3695
@@ -3965,6 +3974,12 @@ Page({ @@ -3965,6 +3974,12 @@ Page({
3965 order_prom_list.give_zxlb_id = th.data.formData.give_zxlb_id; 3974 order_prom_list.give_zxlb_id = th.data.formData.give_zxlb_id;
3966 order_prom_list.g_zxlb_num = th.data.formData.g_zxlb_num; 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 item.order_prom_list = order_prom_list; 3984 item.order_prom_list = order_prom_list;
3970 3985
@@ -4273,6 +4288,23 @@ Page({ @@ -4273,6 +4288,23 @@ Page({
4273 order_prom_list.g_zxlb_num = JSON.stringify(t_item.g_zxlb_num); 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 if (Object.keys(order_prom_list).length > 0) { 4308 if (Object.keys(order_prom_list).length > 0) {
4277 if (order_prom_list.discount_amount) 4309 if (order_prom_list.discount_amount)
4278 order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2); 4310 order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2);
@@ -4581,10 +4613,10 @@ Page({ @@ -4581,10 +4613,10 @@ Page({
4581 }) 4613 })
4582 // pdata.keyid = th.data.bn_goods.keyid 4614 // pdata.keyid = th.data.bn_goods.keyid
4583 } 4615 }
4584 - 4616 + // debugger
4585 var str = JSON.stringify(pdata); 4617 var str = JSON.stringify(pdata);
4586 console.log(str,'aaaaaaaaaaaaaaa'); 4618 console.log(str,'aaaaaaaaaaaaaaa');
4587 - //return false; 4619 + // return false;
4588 4620
4589 wx.showLoading({ title: "加载中" }); 4621 wx.showLoading({ title: "加载中" });
4590 th.setData({ submit: 1, }) 4622 th.setData({ submit: 1, })
@@ -5865,6 +5897,7 @@ Page({ @@ -5865,6 +5897,7 @@ Page({
5865 } 5897 }
5866 }).then(res => { 5898 }).then(res => {
5867 if (res.data.code == 0) { 5899 if (res.data.code == 0) {
  5900 +
5868 var get_data = res.data.data; 5901 var get_data = res.data.data;
5869 arr.is_bz = prom.is_bz; //是不是倍增 5902 arr.is_bz = prom.is_bz; //是不是倍增
5870 arr.is_xz_yh = arr.is_xz_yh ? arr.is_xz_yh : prom.is_xz_yh; //是不是优惠 5903 arr.is_xz_yh = arr.is_xz_yh ? arr.is_xz_yh : prom.is_xz_yh; //是不是优惠
@@ -5902,6 +5935,11 @@ Page({ @@ -5902,6 +5935,11 @@ Page({
5902 arr.zxlbtitle = get_data.zxlbtitle; 5935 arr.zxlbtitle = get_data.zxlbtitle;
5903 arr.zx_libao = get_data.zxlibao; 5936 arr.zx_libao = get_data.zxlibao;
5904 arr.zx_lb_num = get_data.zxlb_num; 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 arr.prom_id = prom_id; 5944 arr.prom_id = prom_id;
5907 5945
@@ -5985,7 +6023,7 @@ Page({ @@ -5985,7 +6023,7 @@ Page({
5985 var pickid = item.pick_id; 6023 var pickid = item.pick_id;
5986 var map = th.data.prom_goods_map; 6024 var map = th.data.prom_goods_map;
5987 var obj = map[pickid]; 6025 var obj = map[pickid];
5988 - debugger 6026 +
5989 if (map[pickid]) { 6027 if (map[pickid]) {
5990 if (map[pickid][item.prom_id]) { 6028 if (map[pickid][item.prom_id]) {
5991 6029
@@ -6099,7 +6137,7 @@ Page({ @@ -6099,7 +6137,7 @@ Page({
6099 check_is_youhui: function (r_data, pick_id) { 6137 check_is_youhui: function (r_data, pick_id) {
6100 let send_lb = this.data.send_lb; 6138 let send_lb = this.data.send_lb;
6101 let lodash = null; 6139 let lodash = null;
6102 - debugger 6140 +
6103 r_data.forEach(item => { 6141 r_data.forEach(item => {
6104 if (send_lb[pick_id]) { 6142 if (send_lb[pick_id]) {
6105 for (let i = 0; i < send_lb[pick_id].length; i++) { 6143 for (let i = 0; i < send_lb[pick_id].length; i++) {
@@ -6242,7 +6280,7 @@ Page({ @@ -6242,7 +6280,7 @@ Page({
6242 6280
6243 if (flag == 2) { // flag =2 控制跳转到每月礼包 6281 if (flag == 2) { // flag =2 控制跳转到每月礼包
6244 // url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; 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 }else if (flag == 1) { 6284 }else if (flag == 1) {
6247 url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 6285 url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮
6248 } else { 6286 } else {
packageE/pages/cart/cart2/cart2.wxml
@@ -430,7 +430,7 @@ @@ -430,7 +430,7 @@
430 430
431 <!-- 有送礼包 --> 431 <!-- 有送礼包 -->
432 <view wx:if="{{bn_goods.s_libao}}"> 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 <view class="flex ai_c"> 434 <view class="flex ai_c">
435 <view class="circle1">赠</view>{{bn_goods.lbtitle}} 435 <view class="circle1">赠</view>{{bn_goods.lbtitle}}
436 <!-- <view class="circle1" wx:if="{{item.zxlb_id>0}}">赠</view>{{item.zxlbtitle}} --> 436 <!-- <view class="circle1" wx:if="{{item.zxlb_id>0}}">赠</view>{{item.zxlbtitle}} -->
@@ -442,7 +442,7 @@ @@ -442,7 +442,7 @@
442 </view> 442 </view>
443 <!-- 有送专享礼包 --> 443 <!-- 有送专享礼包 -->
444 <view wx:if="{{bn_goods.zx_libao}}"> 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 <view class="flex ai_c"> 446 <view class="flex ai_c">
447 <view class="circle1">赠</view>{{bn_goods.zxlbtitle}} 447 <view class="circle1">赠</view>{{bn_goods.zxlbtitle}}
448 <!-- <view class="circle1" wx:if="{{item.zxlb_id>0}}">赠</view>{{item.zxlbtitle}} --> 448 <!-- <view class="circle1" wx:if="{{item.zxlb_id>0}}">赠</view>{{item.zxlbtitle}} -->
@@ -452,6 +452,18 @@ @@ -452,6 +452,18 @@
452 </view> 452 </view>
453 </view> 453 </view>
454 </view> 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
@@ -297,7 +297,8 @@ Page({ @@ -297,7 +297,8 @@ Page({
297 page: th.data.curpage, 297 page: th.data.curpage,
298 pageSize: th.data.pageSize, 298 pageSize: th.data.pageSize,
299 is_end:0, 299 is_end:0,
300 - timetype:1 300 + timetype:1,
  301 + is_act:0
301 }, 302 },
302 success: function (res) { 303 success: function (res) {
303 if (res.data.code == 0) { 304 if (res.data.code == 0) {
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
@@ -214,6 +214,43 @@ Page({ @@ -214,6 +214,43 @@ Page({
214 url: '/packageE/pages/togoin/togoin', 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 getList: function (e) { 254 getList: function (e) {
218 var th = this; 255 var th = this;
219 getApp().request.get('/api/weshop/marketing/marketingMonthgiftbagForm/page', { 256 getApp().request.get('/api/weshop/marketing/marketingMonthgiftbagForm/page', {
@@ -367,7 +404,11 @@ Page({ @@ -367,7 +404,11 @@ Page({
367 getApp().goto('/packageE/pages/togoin/togoin'); 404 getApp().goto('/packageE/pages/togoin/togoin');
368 return false; 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 setTimeout(()=>{ 414 setTimeout(()=>{
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml
@@ -149,7 +149,7 @@ @@ -149,7 +149,7 @@
149 149
150 <view class="foot_empty data-v-3a5b7e36"></view> 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 <block wx:if="{{getUserID && monthgiftbag.giftTitle}}"> 153 <block wx:if="{{getUserID && monthgiftbag.giftTitle}}">
154 <block wx:if="{{isStart==1}}"> 154 <block wx:if="{{isStart==1}}">
155 <view class="foot_button data-v-3a5b7e36"> 155 <view class="foot_button data-v-3a5b7e36">
@@ -229,7 +229,9 @@ @@ -229,7 +229,9 @@
229 <!-- 弹出框扫描 --> 229 <!-- 弹出框扫描 -->
230 <qr_code id="qc_com"></qr_code> 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 <include src="../public/buy_com.wxml"></include> 236 <include src="../public/buy_com.wxml"></include>
235 <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if="{{!canvasHidden}}"></canvas> 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,7 +7925,7 @@ Page({
7925 let flag = e.currentTarget.dataset.flag; 7925 let flag = e.currentTarget.dataset.flag;
7926 let url = ''; 7926 let url = '';
7927 if (flag == 2) { // flag =1 控制跳转到专享礼包 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 // url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; 7929 // url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`;
7930 } else if (flag == 1) { // flag =1 控制跳转到专享礼包 7930 } else if (flag == 1) { // flag =1 控制跳转到专享礼包
7931 url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; 7931 url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`;