From 705201a2b90edb28fa2e145cce31bdfd99be2a66 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Wed, 12 Apr 2023 10:57:39 +0800 Subject: [PATCH] 促销多活动的优化 --- components/promate_pop/promate_pop.js | 10 +++++++--- components/promate_pop/promate_pop.wxml | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ components/promate_pop/promate_pop.wxss | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- packageE/pages/cart/cart2/cart2.js | 44 +++++++++++++++++++++++++++++++------------- pages/goods/goodsInfo/goodsInfo.js | 5 +++++ pages/goods/goodsInfo/goodsInfo.wxml | 5 +++-- 6 files changed, 210 insertions(+), 22 deletions(-) diff --git a/components/promate_pop/promate_pop.js b/components/promate_pop/promate_pop.js index 18abf5f..b264dac 100644 --- a/components/promate_pop/promate_pop.js +++ b/components/promate_pop/promate_pop.js @@ -1,13 +1,17 @@ Component({ /*** 页面的初始数据***/ data: { - type:0,// 0只显示再商品详情页面 1显示再有选择按钮 + type:0, //0只显示再商品详情页面 1显示再有选择按钮 + pro_pop:0, //是否弹出 }, methods: { - //-- 初始化弹出框 -- - set_init(){ + set_init(type){ + if(!type) type=0; + this.setData({ + type:type,pro_pop:1 + }) }, /*----pop的开关---*/ diff --git a/components/promate_pop/promate_pop.wxml b/components/promate_pop/promate_pop.wxml index 498a0ca..054d7db 100644 --- a/components/promate_pop/promate_pop.wxml +++ b/components/promate_pop/promate_pop.wxml @@ -9,6 +9,81 @@ + + + 优惠 + + 优惠促销 + + + + 消费满100元享受优惠 + + 减价10元 + 减价10元 + 减价10元 + 减价10元 + 减价10元 + 减价10元 + 减价10元 + + + + + + 详情 + + + + + 搭配 + + 搭配促销 + + + + 活动名称 + 搭配价:¥101.00-210.00 + + 2022.12.19 00:00:00 至 2022.12.31 23:59:59 + + + 详情 + + + + + 组合 + + 组合购 + + + + 活动名称 + + 2022.12.19 00:00:00 至 2022.12.31 23:59:59 + + + 详情 + + + + + 阶梯 + + 阶梯促销 + + + + 第1件8折,第2件7折,第3件6折 + + 2022.12.19 00:00:00 至 2022.12.31 23:59:59 + + + 详情 + + + diff --git a/components/promate_pop/promate_pop.wxss b/components/promate_pop/promate_pop.wxss index 470a6ca..b4b094b 100644 --- a/components/promate_pop/promate_pop.wxss +++ b/components/promate_pop/promate_pop.wxss @@ -1,4 +1,3 @@ -@import '../../app.wxss'; /* 自定义弹出窗口 */ .cx-popup { width: 100%; @@ -9,6 +8,20 @@ position: fixed; bottom: 0; } + +.cx-popup .top { + font-size: 32rpx; + padding: 20rpx 0; + border-bottom: 2rpx solid #ebedf0; +} + +.cx-popup .top-frame { + /* width: 100%; + display: flex; + justify-content: center; + overflow: hidden; */ +} + .xc-top-content { width: 88%; height: 85rpx; @@ -21,9 +34,7 @@ padding-top: 24rpx; overflow: hidden; } -.xc-frame { - padding: 20rpx; -} + .xc-frame .list-frame { width: 90%; height: 100%; @@ -103,6 +114,27 @@ margin-top: 50rpx; } +.cx-confirm { + width: 100%; + padding: 20rpx; + box-sizing: border-box; + /* height: 160rpx; */ + +} + + + +.cx-confirm .confirm { + /* width: 372rpx; + height: 60rpx; */ + background-color: #f40026; + color: #fff; + border-radius: 10rpx; + line-height: 80rpx; + font-size: 28rpx; + +} + .xc-not-Selection { width: 60rpx; height: 60rpx; @@ -136,3 +168,56 @@ transform: translateY(550rpx); } } + +.item_pro{ + background-color: #fceeee;height: 170rpx; position: relative; +} + +.item_pro~.item_pro{ + margin-top: 20rpx; +} + +.item_pro .item_pro_left{ + width:170rpx;flex-shrink: 0; position: relative; +} + +.item_pro .item_pro_right{ + position: relative; +} + + +.tick { + position: relative; +} + +.tick:before { + content: ''; + display: inline-block; + vertical-align: middle; + margin-top: -4rpx; + margin-right: 8rpx; + width: 22rpx; + height: 22rpx; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAMAAADzapwJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUdwTPInDPInDPgoDfMnDPYqEvInDPInDPInDP87NPUoDv8vEvMoDPInDPIoDPMnDvInDPInDPInDPIoDPQoDfInDEON4KMAAAAVdFJOUwD45yawG4zz3gQ0DmLOfECQZpPlS54kMQ4AAAC0SURBVBjTbZFREoMgDERDS0xQQNHu/a/alEGtaIYfHrBhs0S1pujVifo40VkhC+BUHSDzQTlBhjHY8bjogXmDZ+orJKwXwMUeUoa/0PeGbH8Q4Y5CJopYOjosiOQxdpRGk1UXOkrBKdkimtN8UrKrJBVXdzsllSYSjR/0J9JaGn81WluWtonYKQ0op51P3M2L2bmZN9n8MKoVqTph/RsseyjfYxAkfgot/82CpuJVLOLSIv4Cd5AJ37BgpFwAAAAASUVORK5CYII=) no-repeat; + background-size: 22rpx auto; +} +.xq_btn{ + position: absolute; + right: 18rpx; + top:52rpx; + width: 100rpx; + height: 60rpx; + background-color: #e03033; + color: #fff; text-align: center; line-height: 60rpx; + border-radius:10rpx ; +} +.left_f_box{ + width:80rpx;font-weight: bolder; color:#d9001b; line-height: 44rpx;text-align: center; +} +.tab_bx{ + position: absolute;top: 0; left: 0; width: 60rpx; height: 40rpx; + background-color: #f5bcc1;color: #d9001b; display: flex; justify-content: center;align-items: center; +} + + +@import '../../app.wxss'; diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 246b62e..ab2ae56 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -1822,7 +1822,8 @@ Page({ var ob = th.data.prom_goods_map[pickid]; for (var ii in ob) { var item_map = ob[ii]; - if (item_map.bs == undefined || item_map.bs == null) { + //if (item_map.bs == undefined || item_map.bs == null) { + if (item_map.hasOwnProperty('cy_cx')) { //等待,获取一下优惠活动的信息 await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { data: { @@ -1833,6 +1834,7 @@ Page({ }).then(res => { if (res.data.code == 0 && res.data.data.condition) { var get_data = res.data.data; + item_map.cy_cx=1; item_map.is_bz = get_data.is_bz; //是不是倍增 item_map.bs = get_data.bs; //是不是倍数 item_map.is_past = get_data.is_past; //是不是包邮 @@ -1896,6 +1898,7 @@ Page({ } } } + else item_map.cy_cx=0; }) } @@ -1951,17 +1954,23 @@ Page({ if (!item_map.is_xz_yh) q_conditin = o_price; } - //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- - for (var j = 0; j < ord_goods.length; j++) { - if (ord_goods[j].is_gift) continue; - if (ord_goods[j].whsle_id) continue; - if (ord_goods[j].prom_type == 3 && ord_goods[j].prom_id == item_map.prom_id) { - ord_goods[j].is_xz_yh = ord_goods[j].is_xz_yh ? ord_goods[j].is_xz_yh : item_map.is_xz_yh; - ord_goods[j].is_past = item_map.is_past; - ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir; - ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir; - ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account; - ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu; + //-- 如果有参与促销才来进行计算 -- + if(item_map.cy_cx) { + //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- + for (var j = 0; j < ord_goods.length; j++) { + if (ord_goods[j].is_gift) continue; + if (ord_goods[j].whsle_id) continue; + if (ord_goods[j].prom_type == 3 && ord_goods[j].prom_id == item_map.prom_id) { + ord_goods[j].is_xz_yh = ord_goods[j].is_xz_yh ? ord_goods[j].is_xz_yh : item_map.is_xz_yh; + ord_goods[j].is_past = item_map.is_past; + ord_goods[j].is_order_yh = item_map.is_order_yh; + ord_goods[j].is_post_temp = item_map.is_post_temp; + + ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir; + ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir; + ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account; + ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu; + } } } @@ -2253,7 +2262,7 @@ Page({ o_price += item[jc].goods_price * item[jc].goods_num; //--- 秒杀, 团购的时候,判断有没有订单优惠和包邮模板的叠加 --- - if( [1,2,6].indexOf(item[jc].prom_type)>-1){ + if( [1,2,3,6].indexOf(item[jc].prom_type)>-1){ if(!item[jc].is_order_yh && !item[jc].whsle_id){ no_order_yh+=item[jc].goods_price * item[jc].goods_num; if(item[jc].quan_num) no_order_yh-=item[jc].quan_num; //券要把他补回去 @@ -5632,6 +5641,7 @@ Page({ if (res.data.code == 0) { prom = res.data.data; + if(prom && prom.limit_num*1){ let user_pre_buynum=await th.getUserBuyPromNum_pre(prom.id) if (user_pre_buynum>=prom.limit_num) { @@ -5719,6 +5729,11 @@ Page({ }).then(res => { if (res.data.code == 0) { var get_data = res.data.data; + + //只有在活动已经开始参与优惠促销的时候 + th.data.bn_is_order_yh=prom.is_order_yh; + th.data.bn_is_post_temp=prom.is_post_temp; + arr.is_bz = prom.is_bz; //是不是倍增 arr.is_xz_yh = arr.is_xz_yh ? arr.is_xz_yh : prom.is_xz_yh; //是不是优惠 arr.bs = get_data.bs; //是不是倍数 @@ -5895,6 +5910,9 @@ Page({ ob.goods_num = item.goods_num; ob.is_bz = prom.is_bz; ob.is_xz_yh = prom.is_xz_yh; + ob.is_xz_yh = prom.is_xz_yh; + ob.is_order_yh = prom.is_order_yh; + ob.is_post_temp = prom.is_post_temp; ob.goods = new Array(); ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); map[pickid][item.prom_id] = ob; diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index bb09d54..a6bedcb 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1207,6 +1207,11 @@ Page({ this.data.enterAddressPage && (this.data.enterAddressPage = !1); + setTimeout(()=>{ + var pro_pop = this.selectComponent("#pro_pop"); //组件的id + pro_pop.set_init(); + },1500) + diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index 6cef940..06e2a66 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -1,3 +1,6 @@ + + + @@ -1794,6 +1797,4 @@ - - -- libgit2 0.21.4