From 5108b2e6989cfa9ff99a32d39b728bb602eef0c0 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Thu, 9 Oct 2025 15:38:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/components/coupon/index.js | 46 +++++++++++++++++++-- pages/order/components/coupon/index.wxml | 2 +- pages/order/coupon/index.js | 51 ++++++++++++++++++++++-- pages/order/coupon/index.wxml | 29 +++++++++----- pages/order/coupon/index.wxss | 26 +++++++++--- pages/order/orderList/index.js | 2 +- pages/order/orderList/index.wxml | 2 +- pages/order/scene/index.js | 13 ++++-- pages/user/cartlist/list.js | 2 + 9 files changed, 146 insertions(+), 27 deletions(-) diff --git a/pages/order/components/coupon/index.js b/pages/order/components/coupon/index.js index 883a94b..51c09e6 100644 --- a/pages/order/components/coupon/index.js +++ b/pages/order/components/coupon/index.js @@ -26,7 +26,11 @@ Component({ }) } } - } + }, + sourceFrom: { + type:String, + value:"" + }, }, /** @@ -63,9 +67,45 @@ Component({ }) this.triggerEvent('getNewCoupon',null); }else{ - commonApi.user_post('coupon/use_max_coupon_list',{ + let postList = app.globalData.postProduct || [] + let ticketList = app.globalData.list || [] + let signleProduct = app.globalData.product || null + + let listData = [] + if (this.properties.sourceFrom == 'cart') { + postList.forEach(v=>{ + listData.push({ + sku_id: v.sku.id, + price: v.sku.price, + sell_price: v.sku.price, + num: v.productNum, + }) + }) + ticketList.forEach(v=>{ + listData.push({ + sku_id: v.sku.id, + price: v.sku.price, + sell_price: v.sku.price, + num: v.num, + use_date: v.time&&v.time.sale_date?v.time.sale_date:'' + }) + }) + } else { + if (signleProduct) { + listData.push({ + sku_id: signleProduct.sku.id, + price: signleProduct.sku.price, + sell_price: signleProduct.sku.price, + num: signleProduct.productNum, + use_date: signleProduct.date&&signleProduct.date.date?signleProduct.date.date:'' + }) + } + } + + commonApi.user_post('coupon/use_max_coupon_listv2',{ money:this.data.money, - sku_ids:this.data.sku + sku_ids:this.data.sku, + cart_data: listData }).then(res=>{ if (app.globalData.couponInfo&&app.globalData.couponInfo.hasOwnProperty('SubCoupon')) { this.setData({ diff --git a/pages/order/components/coupon/index.wxml b/pages/order/components/coupon/index.wxml index 0db1d8a..d93a9e6 100644 --- a/pages/order/components/coupon/index.wxml +++ b/pages/order/components/coupon/index.wxml @@ -1,5 +1,5 @@ - + 优惠券 diff --git a/pages/order/coupon/index.js b/pages/order/coupon/index.js index b11d16a..964bf84 100644 --- a/pages/order/coupon/index.js +++ b/pages/order/coupon/index.js @@ -9,7 +9,9 @@ Page({ */ data: { list:[], - moreFlag:true + moreFlag:true, + + productList: [], }, /** @@ -17,13 +19,53 @@ Page({ */ onLoad: function (options) { + console.log(app.globalData.postProduct,app.globalData.list,app.globalData.product) + let sourceFrom = options.sourceFrom + let postList = app.globalData.postProduct || [] + let ticketList = app.globalData.list || [] + let signleProduct = app.globalData.product || null + + let listData = [] + if (sourceFrom == 'cart') { + postList.forEach(v=>{ + listData.push({ + sku_id: v.sku.id, + price: v.sku.price, + sell_price: v.sku.price, + num: v.productNum, + }) + }) + ticketList.forEach(v=>{ + listData.push({ + sku_id: v.sku.id, + price: v.sku.price, + sell_price: v.sku.price, + num: v.num, + use_date: v.time&&v.time.sale_date?v.time.sale_date:'' + }) + }) + } else { + if (signleProduct) { + listData.push({ + sku_id: signleProduct.sku.id, + price: signleProduct.sku.price, + sell_price: signleProduct.sku.price, + num: signleProduct.productNum, + use_date: signleProduct.date&&signleProduct.date.date?signleProduct.date.date:'' + }) + } + } + this.setData({ + productList: listData + }) this.getList(options) }, getList:function(options){ if(!this.data.moreFlag) return commonApi.user_post('coupon/use_coupon_listv3',{ money:options.money, - sku_ids:options.sku + sku_ids:options.sku, + cart_data: this.data.productList }).then(res=>{ res.data.map(item=>{ item.selected = false; @@ -36,9 +78,10 @@ Page({ }, //获取最高优惠 getMaxC(options){ - commonApi.user_post('coupon/use_max_coupon_list',{ + commonApi.user_post('coupon/use_max_coupon_listv2',{ money:options.money, - sku_ids:options.sku + sku_ids:options.sku, + cart_data: this.data.productList }).then(res=>{ console.log(app.globalData.couponInfo); diff --git a/pages/order/coupon/index.wxml b/pages/order/coupon/index.wxml index 7bca12b..3aa31a5 100644 --- a/pages/order/coupon/index.wxml +++ b/pages/order/coupon/index.wxml @@ -1,17 +1,28 @@ - - {{item.activity.money/100}} - - {{item.activity.fold}} + + + {{item.activity.money/100}} + + {{item.activity.fold}} + + + {{item.activity.name}} + {{item.end_time}}到期 + + + 不可用 - - {{item.activity.name}} - {{item.end_time}}到期 + + 不可用原因 + {{item.reason}} - - + + + + + 确定 diff --git a/pages/order/coupon/index.wxss b/pages/order/coupon/index.wxss index a8cfad0..8c2c2e9 100644 --- a/pages/order/coupon/index.wxss +++ b/pages/order/coupon/index.wxss @@ -2,20 +2,27 @@ page { background: #f6f6f6; } +.coupon-item-box{ + width: 700rpx; + margin: 26rpx auto; + background: white; + border-radius: 7rpx; + box-sizing: border-box; + padding:0 26rpx; +} + .coupon-item { + width: 100%; display: flex; align-items: center; justify-content: space-between; - margin: 26rpx; - background: white; - border-radius: 7rpx; + height: 136rpx; - padding-right: 27rpx; } .coupon-item .money { color: #D62828; font-size: 67rpx; - width: 187rpx; + width: 147rpx; text-align: center; font-weight: 500; flex-shrink: 0; @@ -68,4 +75,13 @@ page { font-size: 36rpx; font-weight: 500; text-align: center; +} + +.no-reason{ + width: 100%; + border-top: 1px dashed #e0e0e0; + padding: 20rpx 0; + color: #666; + font-size: 24rpx; + box-sizing: border-box; } \ No newline at end of file diff --git a/pages/order/orderList/index.js b/pages/order/orderList/index.js index 3fe0fed..6715052 100644 --- a/pages/order/orderList/index.js +++ b/pages/order/orderList/index.js @@ -41,7 +41,7 @@ Page({ // showCoupon: (app.globalData.list || []).length<=0, // linkmanList: app.globalData.linkmanList }) - console.log('-------------',this.data.ticketList); + console.log('-------------',this.data.ticketList, this.data.goodsList); // debugger let price = 0, sku_id = [] ,postFee= 0; app.globalData.postProduct.map(item => { diff --git a/pages/order/orderList/index.wxml b/pages/order/orderList/index.wxml index 2245a77..b571935 100644 --- a/pages/order/orderList/index.wxml +++ b/pages/order/orderList/index.wxml @@ -56,7 +56,7 @@ 订单备注: --> - + diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 6d9a940..8638f01 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -367,16 +367,17 @@ Page({ } console.log('singlePrice',this.data.singlePrice); }, - changeDate: function (e) { +changeDate: function (e) { console.log('打印',e); let sku_id = e.detail.sku_id; + app.globalData.product.date = e.detail this.setData({ showDate:true }) // debugger // this.showAllPrice() this.totalPrice(e.detail.price) - if (e.detail.price != this.data.singlePrice && this.data.coupon) { + if (this.data.coupon) { wx.showToast({ title: '订单价格发生变化,请重新选择优惠券', icon: 'none' @@ -386,7 +387,12 @@ Page({ singlePrice:e.detail.price }) if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1 && this.data.type!='museum') { - this.couponCom.setNullCoupon() + try { + this.couponCom = this.selectAllComponents("#coupon")[0]; + this.couponCom.setNullCoupon() + } catch (e) { + + } } app.globalData.couponInfo = null; } @@ -415,6 +421,7 @@ Page({ this.setData({ time: e.detail }) + }, changeAllowance: function () { this.setData({ diff --git a/pages/user/cartlist/list.js b/pages/user/cartlist/list.js index cae4009..55d0b1c 100644 --- a/pages/user/cartlist/list.js +++ b/pages/user/cartlist/list.js @@ -396,7 +396,9 @@ Page({ app.globalData.index = 0 app.globalData.productPrice = 0 app.globalData.ticketPrice = 0 + app.globalData.product = null this.data.productType = '' + console.log(app.globalData) }, /**