From 22a5b9651060152bfc1919f9134aa6df8f0c8920 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Tue, 6 Jan 2026 19:00:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/WineSceneOrder/index.js | 74 ++++- pages/order/WineSceneOrder/index.json | 3 +- pages/order/WineSceneOrder/index.wxml | 11 +- pages/order/WineSceneOrder/index.wxss | 1 + pages/order/components/address/index.js | 5 +- pages/order/components/address/index.wxml | 2 +- pages/order/components/coupon/index.js | 195 ++++++------ pages/order/components/coupon/index.wxml | 8 +- pages/order/components/coupon/index.wxss | 18 +- pages/order/components/smoothlyOrder/index.js | 291 ++++++++++++++++++ .../order/components/smoothlyOrder/index.json | 6 + .../order/components/smoothlyOrder/index.wxml | 78 +++++ .../order/components/smoothlyOrder/index.wxss | 201 ++++++++++++ pages/order/food/index.js | 66 +++- pages/order/food/index.json | 3 +- pages/order/food/index.wxml | 12 +- pages/order/showOrderNew/index.js | 66 +++- pages/order/showOrderNew/index.json | 3 +- pages/order/showOrderNew/index.wxml | 11 +- pages/order/showOrderNew/index.wxss | 1 + project.private.config.json | 27 +- 21 files changed, 958 insertions(+), 124 deletions(-) create mode 100644 pages/order/components/smoothlyOrder/index.js create mode 100644 pages/order/components/smoothlyOrder/index.json create mode 100644 pages/order/components/smoothlyOrder/index.wxml create mode 100644 pages/order/components/smoothlyOrder/index.wxss diff --git a/pages/order/WineSceneOrder/index.js b/pages/order/WineSceneOrder/index.js index d218f29..b486f69 100644 --- a/pages/order/WineSceneOrder/index.js +++ b/pages/order/WineSceneOrder/index.js @@ -42,7 +42,10 @@ Page({ showDate:false, showDate2:false, showYhq:null, - couponFlag:false + couponFlag:false, + + smoothlyTotal: 0, + maxCouponObject: null }, /** @@ -77,7 +80,8 @@ Page({ } this.setData({singlePrice: this.data.product.sku.price}) - this.showAllPrice() + // this.showAllPrice() + this.totalPrice(this.data.singlePrice) console.log(this.data); console.log(this.data.product.product.ZTPoint) @@ -86,7 +90,18 @@ Page({ }, - + // 子组件发生改变时更新价格 + handleUpdateTotalPrice(e) { + this.setData({ + smoothlyTotal: e.detail.total + }); + // 重新计算总价 + this.totalPrice(this.data.singlePrice) + }, + // 调用子组件清除优惠券方法 + callOtherCompMethod: function(e) { + this.couponCom.setNullCoupon() + }, showBookingInfo: function (e) { this.setData({ bookingInfo: this.data.product.sku.sku_model, @@ -230,15 +245,21 @@ Page({ this.totalPrice(this.data.singlePrice) }, totalPrice(price) { - let allPrice + let allPrice = this.data.singlePrice * this.data.productNum + let prices = 0 + console.log(this.data.smoothlyTotal,111111) + // 顺手购价格 + allPrice += this.data.smoothlyTotal || 0; + prices = allPrice + if (this.data.coupon) { if (this.data.coupon.activity.discount_type == 'pricebreak') { - allPrice = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money + allPrice = allPrice - this.data.coupon.activity.money } else { - allPrice =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10 + allPrice =(allPrice * this.data.coupon.activity.fold)/ 10 } } else { - allPrice = this.data.singlePrice * this.data.productNum + allPrice = allPrice } // allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) @@ -254,10 +275,40 @@ Page({ }) } console.log('singlePrice',this.data.singlePrice); + + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + const skuIds = [] + skuIds.push(this.data.product.sku.id) + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSkuIds = smoothlyComp.hasSelectedGoods(); + if(hasSkuIds) { + skuIds.push(...smoothlyComp.emitSkuIds()) + } + } + this.setData({ + maxCouponObject: { + price: prices, + skuIds: skuIds.toString() + } + }) }, order:function() { + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSelected = smoothlyComp.hasSelectedGoods(); + if(hasSelected && !smoothlyComp.data.address) { + wx.showToast({ + title: '请选择收货地址', + icon: 'none' + }) + return; + } + } + let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product; let linkmanIds = []; @@ -282,6 +333,12 @@ Page({ team_id: app.globalData.team_id, } + + // 顺手购下单参数 + if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) { + data.product_list.push(...smoothlyComp.emitOrder()) + } + if (app.globalData.from) { data.system_name = app.globalData.from; } @@ -383,7 +440,8 @@ Page({ this.setData({ coupon:e.detail }) - this.showAllPrice() + // this.showAllPrice() + this.totalPrice(this.data.singlePrice) }, /** diff --git a/pages/order/WineSceneOrder/index.json b/pages/order/WineSceneOrder/index.json index 6e93399..42dca0a 100644 --- a/pages/order/WineSceneOrder/index.json +++ b/pages/order/WineSceneOrder/index.json @@ -3,6 +3,7 @@ "title":"/pages/component/TitleHeader", "contact":"../components/contact/index", "coupon":"../components/coupon/index", - "notice":"/pages/component/notice/notice" + "notice":"/pages/component/notice/notice", + "smoothly-order": "/pages/order/components/smoothlyOrder/index" } } \ No newline at end of file diff --git a/pages/order/WineSceneOrder/index.wxml b/pages/order/WineSceneOrder/index.wxml index e2f5348..7be6e64 100644 --- a/pages/order/WineSceneOrder/index.wxml +++ b/pages/order/WineSceneOrder/index.wxml @@ -38,9 +38,16 @@ + money="{{singlePrice * productNum}}" sku="{{product.sku.id}}" couponFlag="{{couponFlag}}" maxCouponObject="{{maxCouponObject}}"> - + + 合计: diff --git a/pages/order/WineSceneOrder/index.wxss b/pages/order/WineSceneOrder/index.wxss index 3e49fea..91703eb 100644 --- a/pages/order/WineSceneOrder/index.wxss +++ b/pages/order/WineSceneOrder/index.wxss @@ -1,6 +1,7 @@ /* pages/.wxss */ page { background: #f6f6f6; + padding-bottom: 150rpx; } .group-order { diff --git a/pages/order/components/address/index.js b/pages/order/components/address/index.js index b105bf0..6f7e6cd 100644 --- a/pages/order/components/address/index.js +++ b/pages/order/components/address/index.js @@ -11,7 +11,10 @@ Component({ addGlobalClass: true }, properties: { - + showSelect: { + type: Boolean, + value: true + }, }, /** diff --git a/pages/order/components/address/index.wxml b/pages/order/components/address/index.wxml index ad0299e..9609703 100644 --- a/pages/order/components/address/index.wxml +++ b/pages/order/components/address/index.wxml @@ -1,4 +1,4 @@ - + 收货地址 选择 diff --git a/pages/order/components/coupon/index.js b/pages/order/components/coupon/index.js index 883a94b..7b6cf8a 100644 --- a/pages/order/components/coupon/index.js +++ b/pages/order/components/coupon/index.js @@ -2,93 +2,112 @@ import commonApi from "../../../../utils/https/common" let app = getApp() Component({ - /** - * 组件的属性列表 - */ - properties: { - money:{ - type:String, - value:"0" - }, - sku:{ - type:String, - value:"" - }, - couponFlag:{ - type:Boolean, - value:false, - observer(nv, ov) { - console.log(nv,ov) - if (nv) { - app.globalData.couponInfo = null - this.setData({ - coupon:null - }) - } - } - } - }, + /** + * 组件的属性列表 + */ + properties: { + money: { + type: String, + value: "0" + }, + sku: { + type: String, + value: "" + }, + couponFlag: { + type: Boolean, + value: false, + observer(nv, ov) { + console.log(nv, ov) + if (nv) { + app.globalData.couponInfo = null + this.setData({ + coupon: null + }) + } + } + }, + maxCouponObject: { + type: Object, + value: null, + observer(nv, ov) { + console.log(111, nv, ov) + this.getMaxPrice() + } + } + }, - /** - * 组件的初始数据 - */ - data: { - coupon:null - }, - pageLifetimes: { - show: function() { - this.getMaxCoupon() - } - }, - lifetimes:{ - attached(){ - }, - }, - /** - * 组件的方法列表 - */ - methods: { - setNullCoupon:function(){ - app.globalData.couponInfo = null - this.setData({ - coupon:null - }) - }, - getMaxCoupon(){ - // console.log(app.globalData.couponInfo); - console.log(this.data.coupon); - if (app.globalData.couponInfo===false) { - this.setData({ - coupon:null - }) - this.triggerEvent('getNewCoupon',null); - }else{ - commonApi.user_post('coupon/use_max_coupon_list',{ - money:this.data.money, - sku_ids:this.data.sku - }).then(res=>{ - if (app.globalData.couponInfo&&app.globalData.couponInfo.hasOwnProperty('SubCoupon')) { - this.setData({ - coupon:app.globalData.couponInfo - }) - this.triggerEvent('getNewCoupon',app.globalData.couponInfo); - console.log("我用的原来的数据"); - }else{ - console.log("我用的新的数据"); - console.log('123123132',res.data); - if ( Object.keys(res.data).length!=0) { - app.globalData.couponInfo = res.data - this.setData({ - coupon:res.data - }) - console.log(this.data.coupon); - this.triggerEvent('getNewCoupon',res.data); - } - } - }) - } + /** + * 组件的初始数据 + */ + data: { + coupon: null, + maxCouponPrice: 0 + }, + pageLifetimes: { + show: function() { + this.getMaxCoupon() + } + }, + lifetimes: { + attached() {}, + }, + /** + * 组件的方法列表 + */ + methods: { + setNullCoupon: function() { + console.log(44154) + app.globalData.couponInfo = null + this.setData({ + coupon: null + }) + }, + getMaxCoupon() { + // console.log(app.globalData.couponInfo); + console.log(this.data.coupon); + if (app.globalData.couponInfo === false) { + this.setData({ + coupon: null + }) + this.triggerEvent('getNewCoupon', null); + } else { + commonApi.user_post('coupon/use_max_coupon_list', { + money: this.data.money, + sku_ids: this.data.sku + }).then(res => { + if (app.globalData.couponInfo && app.globalData.couponInfo.hasOwnProperty( + 'SubCoupon')) { + this.setData({ + coupon: app.globalData.couponInfo + }) + this.triggerEvent('getNewCoupon', app.globalData.couponInfo); + console.log("我用的原来的数据"); + } else { + console.log("我用的新的数据"); + console.log('123123132', res.data); + if (Object.keys(res.data).length != 0) { + app.globalData.couponInfo = res.data + this.setData({ + coupon: res.data + }) + console.log(this.data.coupon); + this.triggerEvent('getNewCoupon', res.data); + } + } + }) + } + }, + getMaxPrice() { + commonApi.user_post('coupon/use_max_coupon_list', { + money: this.data.maxCouponObject.price, + sku_ids: this.data.maxCouponObject.skuIds + }).then(res => { + this.setData({ + maxCouponPrice: res.data.activity.money + }) + }) + } + }, - } - }, - -}) +}) \ No newline at end of file diff --git a/pages/order/components/coupon/index.wxml b/pages/order/components/coupon/index.wxml index d93a9e6..c4cf7d2 100644 --- a/pages/order/components/coupon/index.wxml +++ b/pages/order/components/coupon/index.wxml @@ -2,14 +2,18 @@ 优惠券 + + ¥{{maxCouponPrice / 100}}优惠券可用 + - -{{coupon.activity.money/100}} + -¥{{coupon.activity.money/100}} {{coupon.activity.fold}}折 - 请选择 + + > diff --git a/pages/order/components/coupon/index.wxss b/pages/order/components/coupon/index.wxss index 0a1745c..15d6205 100644 --- a/pages/order/components/coupon/index.wxss +++ b/pages/order/components/coupon/index.wxss @@ -8,17 +8,27 @@ height: 113rpx; margin: 0 20rpx; font-size: 31rpx; - color: #000; + color: #E30000; font-weight: 500; display: flex; align-items: center; } .coupon-btn { - width: 138rpx; + width: 50rpx; line-height: 56rpx; - border: 1px solid #333333; + /* border: 1px solid #333333; */ border-radius: 29rpx; text-align: center; font-size: 28rpx; - color: #000; + color: #333333; +} +.coupon-left { + line-height: 40rpx; + background: #FFDEDE; + border-radius: 13rpx; + padding: 0 18rpx; + font-weight: 500; + font-size: 24rpx; + color: #E30000; + margin-right: 20rpx; } \ No newline at end of file diff --git a/pages/order/components/smoothlyOrder/index.js b/pages/order/components/smoothlyOrder/index.js new file mode 100644 index 0000000..34310b5 --- /dev/null +++ b/pages/order/components/smoothlyOrder/index.js @@ -0,0 +1,291 @@ +import commonApi from "../../../../utils/https/common" +let app = getApp() +Component({ + properties: { + productId: { + type: [String, Number], + value: '' + }, + postId: { + type: [String, Number], + value: '' + }, + type: { + type: String, + value: '' + } + }, + data: { + addressList: [], + addressIndex: -1, + address: null, + smoothlyList: [], + sommthlyIndex: 0, + showAddressPopup: false, + showItem: null, + showSkuPopup: false + }, + lifetimes: { + attached() { + this.setData({ + sommthlyIndex: 0 + }) + this.getList() + } + }, + observers: { + 'type': function(newVal, oldVal) { + // 当从邮寄切换到自提时 + if (oldVal === 'post' && newVal !== 'post') { + // 重置所有商品邮费 + const smoothlyList = this.data.smoothlyList.map(item => ({ + ...item, + postMoney: 0 + })) + this.setData({ + smoothlyList, + addressIndex: -1 + }) + // 重新计算总价 + this.calculateTotalPrice() + } else if (newVal === 'post') { + // 切换到邮寄时重新计算邮费 + this.showPostMoney() + } + }, + 'postId': function(newVal, oldVal) { + // 只有当当前是邮寄类型时,才重新计算邮费 + if (this.data.type === 'post' && newVal !== oldVal) { + this.showPostMoney() + } + } + }, + onload() { + this.couponCom = this.selectAllComponents("#coupon")[0]; + }, + methods: { + // 是否有选中商品 + hasSelectedGoods() { + return this.data.smoothlyList.some(item => (item.buyNum || 0) > 0); + }, + // 规格id + emitSkuIds() { + let skuIds = [] + this.data.smoothlyList.forEach(item => { + if (item.buyNum > 0) { + skuIds.push(item.sku_id) + } + }); + return skuIds; + }, + // 下单参数 + emitOrder() { + let orderList = [] + this.data.smoothlyList.forEach(item => { + if (item.buyNum > 0) { + orderList.push({ + type: item.type, + product_id: item.id, + sku_id: item.sku_id, + post: this.data.type == 'post' ? this.data.postId : (this.data.address ? + this.data + .address.id : ''), + product_num: item.buyNum, + use_type: 0, + is_batch_shipment: 0, + }) + } + }) + return orderList + }, + switchSmoothlyList() { + const { + smoothlyList, + sommthlyIndex + } = this.data + // 重置当前商品数量 + smoothlyList[sommthlyIndex].buyNum = 0 + + // 更新索引 + const newIndex = sommthlyIndex < smoothlyList.length - 1 ? sommthlyIndex + 1 : 0 + this.setData({ + smoothlyList, + sommthlyIndex: newIndex + }) + + this.showPostMoney().then(() => { + this.calculateTotalPrice() + }) + }, + setNullCoupons() { + if (app.globalData.couponInfo != null) { + wx.showToast({ + title: '订单价格发生变化,请重新选择优惠券', + icon: 'none' + }) + + this.triggerEvent('callOtherComp', { + methodName: 'setNullCoupon', // 要调用的子组件B的方法名 + }); + } + }, + setAddress(e) { + console.log(e.detail); + this.setData({ + address: e.detail + }) + this.showPostMoney().then(() => { + this.calculateTotalPrice() + }) + }, + showAddress() { + const childComp = this.selectComponent('#addressComp'); + if (!childComp) { + wx.showToast({ + title: '组件未加载完成', + icon: 'none' + }); + return; + } + childComp.showLinkman() + }, + showImg(img) { + if (!img) { + return img + } + if (img.indexOf('https://') != -1 || img.indexOf('http://') != -1) { + return img; + } else { + // return "https://test.api.cloud.sz-trip.com"+img + return "https://static.ticket.sz-trip.com" + img; + } + }, + getList() { + commonApi.user_post('product/get_convenient_purchase', { + page: 1, + limit: 100, + product_id: this.data.productId + }).then(res => { + if (res.data) { + const smoothlyList = res.data.map(i => ({ + ...i, + headimg: this.showImg(i.headimg), + buyNum: 0, + postMoney: 0 + })); + this.setData({ + smoothlyList + }); + } + }) + }, + showPostMoney() { + const { + type, + postId, + addressList, + addressIndex, + smoothlyList + } = this.data + + if (type == 'post') { + if (!postId) return Promise.resolve() + } else { + if (!this.data.address) return Promise.resolve() + } + + const promises = smoothlyList.map(item => { + if (item.buyNum > 0) { + return commonApi.user_post("order/get_post_price", { + sku_id: item.sku_id, + num: item.buyNum, + consignee_id: type == 'post' ? postId : (this.data.address ? this.data + .address.id : '') + }).then(res => { + if (res) { + // 更新对应商品的邮费 + const newList = [...smoothlyList] + const idx = newList.findIndex(i => i.sku_id === item.sku_id) + if (idx > -1) { + newList[idx].postMoney = res.data.price + this.setData({ + smoothlyList: newList + }) + } + } + }) + } + return Promise.resolve() + }) + + return Promise.all(promises) + }, + decreaseSkuNum(e) { + const item = e.currentTarget.dataset.item + const { + smoothlyList + } = this.data + + if (item.buyNum > 0) { + // 找到对应商品并更新数量 + const newList = smoothlyList.map(i => { + if (i.sku_id === item.sku_id) { + return { + ...i, + buyNum: i.buyNum - 1 + } + } + return i + }) + + this.setData({ + smoothlyList: newList + }) + this.setNullCoupons() + this.showPostMoney().then(() => { + this.calculateTotalPrice() + }) + } + }, + + increaseSkuNum(e) { + const item = e.currentTarget.dataset.item + const { + smoothlyList + } = this.data + + // 找到对应商品并更新数量 + const newList = smoothlyList.map(i => { + if (i.sku_id === item.sku_id) { + return { + ...i, + buyNum: i.buyNum + 1 + } + } + return i + }) + + this.setData({ + smoothlyList: newList + }) + + this.showPostMoney().then(() => { + this.calculateTotalPrice() + }) + }, + // 计算总价 + calculateTotalPrice() { + let total = 0; + this.data.smoothlyList.forEach(item => { + if (item.buyNum > 0) { + const itemPrice = parseFloat(item.price) * item.buyNum; + total += itemPrice + item.postMoney; + } + }); + this.triggerEvent('updateTotalPrice', { + total + }); + return total; + }, + } +}) \ No newline at end of file diff --git a/pages/order/components/smoothlyOrder/index.json b/pages/order/components/smoothlyOrder/index.json new file mode 100644 index 0000000..0111e85 --- /dev/null +++ b/pages/order/components/smoothlyOrder/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "address":"../../components/address/index" + } +} \ No newline at end of file diff --git a/pages/order/components/smoothlyOrder/index.wxml b/pages/order/components/smoothlyOrder/index.wxml new file mode 100644 index 0000000..6df6936 --- /dev/null +++ b/pages/order/components/smoothlyOrder/index.wxml @@ -0,0 +1,78 @@ + + + + 顺手带一件 + + + 换一换 + + + + + + + + + 收货地址 点击填写收货地址 + + + + + + + 收货地址 + + + {{address.name}}{{address.tel}} + + + {{address.address}} + + + + + + + + + + + + {{item.title}} + + + {{item.sku_name}} + + {{item.price / 100}}(另需运费¥{{item.postMoney / 100}}) + + + + {{item.buyNum}} + + + + + + + + + +
+ + +
\ No newline at end of file diff --git a/pages/order/components/smoothlyOrder/index.wxss b/pages/order/components/smoothlyOrder/index.wxss new file mode 100644 index 0000000..4860b23 --- /dev/null +++ b/pages/order/components/smoothlyOrder/index.wxss @@ -0,0 +1,201 @@ +.flex-between { + display: flex; + justify-content: space-between; + align-items: center; +} + +.container { + width: 750rpx; +} + +.box { + width: 700rpx; + background: #FFFFFF; + border-radius: 9.33rpx; + padding: 0 21.33rpx 46.67rpx; + margin: 0 auto; + box-sizing: border-box; +} + +.top-title { + height: 110rpx; + font-weight: bold; + font-size: 30.67rpx; + color: #000000; + display: flex; + justify-content: space-between; + align-items: center; +} + +.refresh-btn { + font-weight: bold; + font-size: 28rpx; + color: #0B898E; + display: flex; + align-items: center; +} + +.refresh-btn image { + width: 32rpx; + margin-right: 13.33rpx; +} + +.address-box { + width: 655.33rpx; + height: 80rpx; + background: rgba(11, 137, 142, .06); + border-radius: 13.33rpx; + padding: 0 21.33rpx; + font-weight: 500; + font-size: 26.67rpx; + color: #0B898E; + display: flex; + justify-content: space-between; + align-items: center; + box-sizing: border-box; +} + +.address-box .location { + width: 42.67rpx; + margin-right: 26.67rpx; +} + +.address-box .rightIcon { + width: 20rpx; +} + +.address-boxs { + width: 655.33rpx; + height: 133.33rpx; + background: #F7F7F7; + border-radius: 13.33rpx; + padding: 13.33rpx 21.33rpx; + display: flex; + justify-content: space-between; + align-items: center; + box-sizing: border-box; +} + +.address-boxs .location { + width: 42.67rpx; + margin-right: 26.67rpx; +} + +.address-boxs .content { + display: flex; + align-items: center; + margin-right: 33.33rpx; +} + +.address-boxs .content .left { + font-weight: 500; + font-size: 26.67rpx; + color: #000000; +} + +.address-boxs .content .right { + width: 333.33rpx; + margin-left: 16.67rpx; +} + +.address-boxs .content .right .top { + font-weight: 400; + font-size: 30.67rpx; + color: #000000; +} + +.address-boxs .content .right .top text { + font-weight: 500; + font-size: 24rpx; + color: #666666; + margin-left: 33.33rpx; +} + +.address-boxs .content .right .bottom { + margin-top: 6.67rpx + font-weight: 500; + font-size: 24rpx; + color: #666666; +} + +.address-boxs .rightIcon { + width: 33.33rpx; +} + +.product-item { + height: 153.33rpx; + display: flex; + width: 100%; + margin-top: 40rpx; +} + +.product-item .product-img { + width: 153.33rpx; + height: 153.33rpx; + border-radius: 13.33rpx; + margin-right: 20rpx; +} + +.product-item .product-content { + flex: 1; + height: 153.33rpx; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.product-item .product-content .title-boxs { + display: flex; + justify-content: space-between; + align-items: center; +} + +.product-item .product-content .title-boxs .title { + width: 445.33rpx; + font-weight: 500; + font-size: 28rpx; + color: #000000; +} + +.product-item .product-content .title-boxs image { + width: 20rpx; +} + +.product-item .product-content .subtitle { + font-weight: 500; + font-size: 24rpx; + color: #999999; +} + +.product-item .product-content .price { + font-weight: 500; + font-size: 33.33rpx; + color: #E30000; +} + +.product-item .product-content .price::before { + content: '¥'; + font-size: 24rpx; +} + +.product-item .product-content .price text { + font-weight: 500; + font-size: 24rpx; + color: #E30000; + margin-left: 6.67rpx; +} + +.product-item .product-content .product-btn { + width: 160rpx; + font-weight: bold; + font-size: 28rpx; + color: #111111; + display: flex; + justify-content: space-between; + align-items: center; +} + +.product-item .product-content .product-btn image { + width: 46.67rpx; + flex-shrink: 0; +} \ No newline at end of file diff --git a/pages/order/food/index.js b/pages/order/food/index.js index 1a3cf66..d22db10 100644 --- a/pages/order/food/index.js +++ b/pages/order/food/index.js @@ -16,6 +16,8 @@ Page({ showNoticeFlag:false, coupon:null, price: 0, + smoothlyTotal: 0, + maxCouponObject: null }, /** @@ -37,6 +39,18 @@ Page({ console.log(app.globalData.product) this.showAllPrice() }, + // 子组件发生改变时更新价格 + handleUpdateTotalPrice(e) { + this.setData({ + smoothlyTotal: e.detail.total + }); + // 重新计算总价 + this.showAllPrice(); + }, + // 调用子组件清除优惠券方法 + callOtherCompMethod: function(e) { + this.couponCom.setNullCoupon() + }, showNotice:function(){ this.setData({ showNoticeFlag:true @@ -58,22 +72,44 @@ Page({ showAllPrice () { console.log('couponInfo',app.globalData.couponInfo); - let price + let price = this.data.product.sku.price * this.data.productNum + let allPrice = 0 + + // 顺手购价格 + price += this.data.smoothlyTotal || 0; + allPrice = price + if (this.data.coupon) { if (this.data.coupon.activity.discount_type == 'pricebreak') { - price = this.data.product.sku.price * this.data.productNum - this.data.coupon.activity.money + price = price - this.data.coupon.activity.money } else { - price =(this.data.product.sku.price * this.data.productNum * this.data.coupon.activity.fold)/ 10 + price =(price * this.data.coupon.activity.fold)/ 10 } } else { - price = this.data.product.sku.price * this.data.productNum + price = price } if (price >0) { this.setData({ price:price/100}) }else { this.setData({ price:0 }) } - + + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + const skuIds = [] + skuIds.push(this.data.product.sku.id) + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSkuIds = smoothlyComp.hasSelectedGoods(); + if(hasSkuIds) { + skuIds.push(...smoothlyComp.emitSkuIds()) + } + } + this.setData({ + maxCouponObject: { + price: allPrice, + skuIds: skuIds.toString() + } + }) }, /** @@ -116,6 +152,20 @@ Page({ }) }, order:function(){ + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + console.log(smoothlyComp,smoothlyComp.emitOrder()) + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSelected = smoothlyComp.hasSelectedGoods(); + if(hasSelected && !smoothlyComp.data.address) { + wx.showToast({ + title: '请选择收货地址', + icon: 'none' + }) + return; + } + } + // if(!this.data.user){ // wx.showToast({ // title: '请输入联系人', @@ -143,6 +193,12 @@ Page({ source:"WECHATXCX", coupon_id:this.data.coupon?this.data.coupon.id:null }; + + // 顺手购下单参数 + if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) { + product_list.push(...smoothlyComp.emitOrder()) + } + if(app.globalData.from){ data.system_name = app.globalData.from; } diff --git a/pages/order/food/index.json b/pages/order/food/index.json index fe0a5a2..84c6148 100644 --- a/pages/order/food/index.json +++ b/pages/order/food/index.json @@ -2,6 +2,7 @@ "usingComponents": { "title":"/pages/component/TitleHeader", "notice":"/pages/component/notice/notice", - "coupon":"/pages/order/components/coupon/index" + "coupon":"/pages/order/components/coupon/index", + "smoothly-order": "/pages/order/components/smoothlyOrder/index" } } \ No newline at end of file diff --git a/pages/order/food/index.wxml b/pages/order/food/index.wxml index 4f4c5c3..814418d 100644 --- a/pages/order/food/index.wxml +++ b/pages/order/food/index.wxml @@ -28,7 +28,17 @@
- + + + + + diff --git a/pages/order/showOrderNew/index.js b/pages/order/showOrderNew/index.js index 99eff0f..2552622 100644 --- a/pages/order/showOrderNew/index.js +++ b/pages/order/showOrderNew/index.js @@ -46,6 +46,8 @@ Page({ showDate2:false, showYhq:null, couponFlag:false, + smoothlyTotal: 0, + maxCouponObject: null }, /** @@ -115,6 +117,18 @@ Page({ // showDate: true, // }) // }, + // 子组件发生改变时更新价格 + handleUpdateTotalPrice(e) { + this.setData({ + smoothlyTotal: e.detail.total + }); + // 重新计算总价 + this.totalPrice(this.data.singlePrice) + }, + // 调用子组件清除优惠券方法 + callOtherCompMethod: function(e) { + this.couponCom.setNullCoupon() + }, hideDate: function () { this.setData({ showDate: false @@ -281,15 +295,20 @@ Page({ this.totalPrice(this.data.singlePrice) }, totalPrice(price) { - let allPrice + let allPrice = this.data.singlePrice * this.data.productNum + let prices = 0 + console.log(this.data.smoothlyTotal,111111) + // 顺手购价格 + allPrice += this.data.smoothlyTotal || 0; + prices = allPrice if (this.data.coupon) { if (this.data.coupon.activity.discount_type == 'pricebreak') { - allPrice = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money + allPrice = allPrice - this.data.coupon.activity.money } else { - allPrice =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10 + allPrice =(allPrice * this.data.coupon.activity.fold)/ 10 } } else { - allPrice = this.data.singlePrice * this.data.productNum + allPrice = allPrice } // allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) @@ -305,6 +324,23 @@ Page({ }) } console.log('singlePrice',this.data.singlePrice); + + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + const skuIds = [] + skuIds.push(this.data.product.sku.id) + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSkuIds = smoothlyComp.hasSelectedGoods(); + if(hasSkuIds) { + skuIds.push(...smoothlyComp.emitSkuIds()) + } + } + this.setData({ + maxCouponObject: { + price: prices, + skuIds: skuIds.toString() + } + }) }, changeDate: function (e) { console.log('打印',e); @@ -372,6 +408,19 @@ Page({ this.hideDate() }, order:function() { + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSelected = smoothlyComp.hasSelectedGoods(); + if(hasSelected && !smoothlyComp.data.address) { + wx.showToast({ + title: '请选择收货地址', + icon: 'none' + }) + return; + } + } + let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product; let linkmanIds = []; if (linkmanList.length==0 && this.data.is_authentication == 1) { @@ -432,6 +481,12 @@ Page({ team_id: app.globalData.team_id, linkmanList:this.data.is_authentication == 1?this.data.linkmanList:[] } + + // 顺手购下单参数 + if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) { + data.product_list.push(...smoothlyComp.emitOrder()) + } + if (app.globalData.from) { data.system_name = app.globalData.from; } @@ -609,7 +664,8 @@ Page({ coupon:e.detail }) - this.showAllPrice() + // this.showAllPrice() + this.totalPrice(this.data.singlePrice) }, /** diff --git a/pages/order/showOrderNew/index.json b/pages/order/showOrderNew/index.json index 19927e7..54c1962 100644 --- a/pages/order/showOrderNew/index.json +++ b/pages/order/showOrderNew/index.json @@ -4,6 +4,7 @@ "contact":"../components/contact/index", "coupon":"../components/coupon/index", "notice":"/pages/component/notice/notice", - "date":"/pages/order/components/date" + "date":"/pages/order/components/date", + "smoothly-order": "/pages/order/components/smoothlyOrder/index" } } \ No newline at end of file diff --git a/pages/order/showOrderNew/index.wxml b/pages/order/showOrderNew/index.wxml index 380b633..9d0a16c 100644 --- a/pages/order/showOrderNew/index.wxml +++ b/pages/order/showOrderNew/index.wxml @@ -46,7 +46,16 @@ --> + money="{{singlePrice * productNum}}" sku="{{product.sku.id}}" couponFlag="{{couponFlag}}" maxCouponObject="{{maxCouponObject}}"> + + + diff --git a/pages/order/showOrderNew/index.wxss b/pages/order/showOrderNew/index.wxss index 3780f39..478a9a6 100644 --- a/pages/order/showOrderNew/index.wxss +++ b/pages/order/showOrderNew/index.wxss @@ -1,6 +1,7 @@ /* pages/.wxss */ page { background: #f6f6f6; + padding-bottom: 150rpx; } .group-order { diff --git a/project.private.config.json b/project.private.config.json index e6ba547..b8dc83d 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -6,12 +6,33 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/info/showInfo/index", + "pathName": "pages/info/showInfo/index", + "query": "id=465394", + "scene": null, + "launchMode": "default" + }, + { + "name": "pages/info/postProductInfo/index", + "pathName": "pages/info/postProductInfo/index", + "query": "id=460201&ZTPoint=%E7%94%84%E9%80%89%E6%99%AF%E9%85%92%E5%A5%97%E9%A4%90", + "launchMode": "default", + "scene": null + }, + { + "name": "subPackages/foodNew/index", + "pathName": "subPackages/foodNew/index", + "query": "id=914667", + "launchMode": "default", + "scene": null + }, { "name": "pages/info/roadInfo/index", "pathName": "pages/info/roadInfo/index", "query": "id=457033", - "scene": null, - "launchMode": "default" + "launchMode": "default", + "scene": null }, { "name": "pages/info/roadInfo/index", @@ -109,5 +130,5 @@ }, "projectname": "%E8%8B%8F%E5%B7%9E%E6%96%87%E6%97%85", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "libVersion": "3.9.3" + "libVersion": "3.7.12" } \ No newline at end of file From 8c539c15af812088f32bf801583e36724be49352 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Mon, 12 Jan 2026 10:15:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=A1=BA=E6=89=8B=E8=B4=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/components/smoothlyOrder/index.js | 20 ++++- .../order/components/smoothlyOrder/index.wxml | 16 ++-- .../order/components/smoothlyOrder/index.wxss | 55 ++++++++++++- pages/order/postOrder/index.js | 65 ++++++++++++++- pages/order/postOrder/index.json | 3 +- pages/order/postOrder/index.wxml | 14 +++- pages/order/postOrder/index.wxss | 1 + pages/order/roadOrder/index.js | 81 ++++++++++++++++++- pages/order/roadOrder/index.json | 3 +- pages/order/roadOrder/index.wxml | 13 ++- pages/order/roadOrder/index.wxss | 1 + project.private.config.json | 18 ++++- 12 files changed, 268 insertions(+), 22 deletions(-) diff --git a/pages/order/components/smoothlyOrder/index.js b/pages/order/components/smoothlyOrder/index.js index 34310b5..879ec6d 100644 --- a/pages/order/components/smoothlyOrder/index.js +++ b/pages/order/components/smoothlyOrder/index.js @@ -23,7 +23,8 @@ Component({ sommthlyIndex: 0, showAddressPopup: false, showItem: null, - showSkuPopup: false + showSkuPopup: false, + content: '' }, lifetimes: { attached() { @@ -64,6 +65,20 @@ Component({ this.couponCom = this.selectAllComponents("#coupon")[0]; }, methods: { + // 查看规格信息 + showSkuInfo(e) { + this.setData({ + showItem: e.currentTarget.dataset.item, + showSkuPopup: true, + content: '' + }) + console.log(this.data.showItem) + }, + closePopup() { + this.setData({ + showSkuPopup: false + }) + }, // 是否有选中商品 hasSelectedGoods() { return this.data.smoothlyList.some(item => (item.buyNum || 0) > 0); @@ -202,10 +217,11 @@ Component({ consignee_id: type == 'post' ? postId : (this.data.address ? this.data .address.id : '') }).then(res => { - if (res) { + if (res.code == 1) { // 更新对应商品的邮费 const newList = [...smoothlyList] const idx = newList.findIndex(i => i.sku_id === item.sku_id) + console.log(res.data.price) if (idx > -1) { newList[idx].postMoney = res.data.price this.setData({ diff --git a/pages/order/components/smoothlyOrder/index.wxml b/pages/order/components/smoothlyOrder/index.wxml index 6df6936..476dbf4 100644 --- a/pages/order/components/smoothlyOrder/index.wxml +++ b/pages/order/components/smoothlyOrder/index.wxml @@ -1,4 +1,5 @@ - + + 顺手带一件 @@ -38,7 +39,7 @@ - @@ -67,12 +68,13 @@
-
- --> +
\ No newline at end of file diff --git a/pages/order/components/smoothlyOrder/index.wxss b/pages/order/components/smoothlyOrder/index.wxss index 4860b23..993b443 100644 --- a/pages/order/components/smoothlyOrder/index.wxss +++ b/pages/order/components/smoothlyOrder/index.wxss @@ -112,7 +112,7 @@ } .address-boxs .content .right .bottom { - margin-top: 6.67rpx + margin-top: 6.67rpx; font-weight: 500; font-size: 24rpx; color: #666666; @@ -198,4 +198,57 @@ .product-item .product-content .product-btn image { width: 46.67rpx; flex-shrink: 0; +} + +.sku-box { + width: 100vw; + height: 100vh; + background: rgba(0, 0, 0, 0.3); + position: fixed; + z-index: 99; + left: 0; + bottom: 0; +} + +.sku-popup { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + height: 60vh; + background-color: #fff; + padding: 20rpx; + box-sizing: border-box; + overflow-x: hidden; +} + +.sku-name { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 35rpx; + font-weight: bold; + height: 80rpx; + padding: 0 20rpx; + box-sizing: border-box; +} +.sku-name span { + font-weight: 400; +} + +.sku-content { + width: 100%; + height: 50vh; + overflow-y: auto; + overflow-x: hidden; + max-width: 100%; +} + +.sz-xcx-fwb-img { + width: 100% !important; + height: auto !important; + display: block !important; + margin: 0 auto !important; + object-fit: contain !important; + max-width: 100% !important; } \ No newline at end of file diff --git a/pages/order/postOrder/index.js b/pages/order/postOrder/index.js index c9e6397..c1b21ad 100644 --- a/pages/order/postOrder/index.js +++ b/pages/order/postOrder/index.js @@ -29,12 +29,16 @@ Page({ showYhq:null, pickupIndex: null, + + smoothlyTotal: 0, + maxCouponObject: null }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + console.log(this.data.product) this.setData({ from: options.from, kjId: app.globalData.kjId, @@ -45,8 +49,21 @@ Page({ showYhq:app.globalData.listName?false:true }) this.handleProduct() + console.log(this.data.product) + }, + + // 子组件发生改变时更新价格 + handleUpdateTotalPrice(e) { + this.setData({ + smoothlyTotal: e.detail.total + }); + // 重新计算总价 + this.changePrice(); + }, + // 调用子组件清除优惠券方法 + callOtherCompMethod: function(e) { + this.couponCom.setNullCoupon() }, - handleProduct () { app.globalData.postProduct.forEach((item,index) => { item.keyIndex = index @@ -218,7 +235,12 @@ Page({ this.changePrice() }, changePrice: function () { - let product = this.data.product, price = 0; + let product = this.data.product, price = 0, allPrice = 0; + + // 顺手购价格 + price += this.data.smoothlyTotal || 0; + allPrice = price + product.map(item => { price = price + item.sku.price * item.productNum; if (this.data.allowance_data && this.data.select_allowance && this.data.allowance_price) { @@ -242,8 +264,38 @@ Page({ this.setData({ showPrice: app.globalData.kjId ? 0 : price }) + + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + const skuIds = [] + skuIds.push(this.data.sku_id) + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSkuIds = smoothlyComp.hasSelectedGoods(); + if(hasSkuIds) { + skuIds.push(...smoothlyComp.emitSkuIds()) + } + } + this.setData({ + maxCouponObject: { + price: allPrice, + skuIds: skuIds.toString() + } + }) }, order: function () { + // 顺手带一件是否选择收货地址 + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + if(smoothlyComp && this.data.product[0].user_select_type == 1) { + // 检查是否有选中的顺手购商品 + const hasSelected = smoothlyComp.hasSelectedGoods(); + if(hasSelected && !smoothlyComp.data.address) { + wx.showToast({ + title: '请选择收货地址', + icon: 'none' + }) + return; + } + } for(let info of this.data.product) { if (info.user_select_type == 0) { @@ -327,6 +379,12 @@ Page({ gp_id: app.globalData.gp_id, team_id: app.globalData.team_id }; + + // 顺手购下单参数 + if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) { + product_list.push(...smoothlyComp.emitOrder()) + } + if (this.data.select_allowance) data.is_allowance = 1 if (app.globalData.from) { data.system_name = app.globalData.from; @@ -348,10 +406,11 @@ Page({ data.channel = ZTPointProduct.product.ZTPoint } console.log(app.globalData.list,this.data.flag) + if(!app.globalData.list || app.globalData.list.length == 0){ // 判断混合下单 let use_type = product_list[0].use_type - if (product_list.some(x=>x.use_type!=use_type)) { + if (product_list.some(x=>x.use_type!=use_type) && !(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length)) { app.globalData.productPrice = (this.data.showPrice + this.data.postFee - (this.data.coupon?this.data.coupon.activity.money:0))/100; app.globalData.createDate = data wx.redirectTo({ diff --git a/pages/order/postOrder/index.json b/pages/order/postOrder/index.json index e69fb76..7cfd16d 100644 --- a/pages/order/postOrder/index.json +++ b/pages/order/postOrder/index.json @@ -2,6 +2,7 @@ "usingComponents": { "title":"/pages/component/TitleHeader", "address":"../components/address/index", - "coupon":"../components/coupon/index" + "coupon":"../components/coupon/index", + "smoothly-order": "/pages/order/components/smoothlyOrder/index" } } \ No newline at end of file diff --git a/pages/order/postOrder/index.wxml b/pages/order/postOrder/index.wxml index 582fcf4..2f51bb5 100644 --- a/pages/order/postOrder/index.wxml +++ b/pages/order/postOrder/index.wxml @@ -114,7 +114,19 @@
- + + + + + diff --git a/pages/order/postOrder/index.wxss b/pages/order/postOrder/index.wxss index 5cb30b8..f82157b 100644 --- a/pages/order/postOrder/index.wxss +++ b/pages/order/postOrder/index.wxss @@ -1,6 +1,7 @@ /* pages/order/post/index.wxss */ page { background: #f6f6f6; + padding-bottom: 150rpx; } .sendwayArea{ diff --git a/pages/order/roadOrder/index.js b/pages/order/roadOrder/index.js index ed17b65..118d93f 100644 --- a/pages/order/roadOrder/index.js +++ b/pages/order/roadOrder/index.js @@ -22,13 +22,16 @@ Page({ price:0, coupon:app.globalData.couponInfo, sku_ids:"", - prizeId:null + prizeId:null, + smoothlyTotal: 0, + maxCouponObject: null }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + this.couponCom = this.selectAllComponents("#coupon")[0]; this.setData({ prizeId:wx.getStorageSync('prizeId') }) @@ -54,8 +57,62 @@ Page({ console.log(this.data) // 获取默认联系人 this.getLinkmanList() + // this.showAllPrice() + }, + // 子组件发生改变时更新价格 + handleUpdateTotalPrice(e) { + this.setData({ + smoothlyTotal: e.detail.total + }); + // 重新计算总价 + this.showAllPrice(); + }, + // 调用子组件清除优惠券方法 + callOtherCompMethod: function(e) { + this.couponCom.setNullCoupon() + }, + showAllPrice() { + let price = app.globalData.product.price + let allPrice = 0 + + // 顺手购价格 + price += this.data.smoothlyTotal || 0; + allPrice = price + + if (this.data.coupon) { + if (this.data.coupon.activity.discount_type == 'pricebreak') { + price = price - this.data.coupon.activity.money + } else { + price =(price * this.data.coupon.activity.fold)/ 10 + } + } else { + price = price + } + if (price >0) { + this.setData({ price:price/100}) + }else { + this.setData({ price:0 }) + } + + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + const skuIds = [] + skuIds.push(this.data.sku_ids) + console.log(skuIds) + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSkuIds = smoothlyComp.hasSelectedGoods(); + if(hasSkuIds) { + skuIds.push(...smoothlyComp.emitSkuIds()) + } + } + this.setData({ + maxCouponObject: { + price: allPrice, + skuIds: skuIds.toString() + } + }) + console.log(this.data.maxCouponObject) }, - showLinkman:function(e){ if(!this.data.linkmanFlag) { let skuIndex = e.currentTarget.dataset.index,linkmans = this.data.linkmans[skuIndex],linkmanList = this.data.linkmanList; @@ -200,6 +257,19 @@ Page({ }) }, order:function(){ + const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); + if(smoothlyComp) { + // 检查是否有选中的顺手购商品 + const hasSelected = smoothlyComp.hasSelectedGoods(); + if(hasSelected && !smoothlyComp.data.address) { + wx.showToast({ + title: '请选择收货地址', + icon: 'none' + }) + return; + } + } + let sku = this.data.sku,product = this.data.product,linkmans = this.data.linkmans,product_list = [],reserve_mobile = this.data.reserve_mobile; if(!reserve_mobile) { wx.showToast({ @@ -246,6 +316,12 @@ Page({ if(orderFlag==false){ return; } + + // 顺手购下单参数 + if(smoothlyComp && smoothlyComp.emitOrder() && smoothlyComp.emitOrder().length) { + product_list.push(...smoothlyComp.emitOrder()) + } + let data = { product_list:product_list, coupon_id:this.data.coupon?this.data.coupon.id:null, @@ -281,6 +357,7 @@ Page({ this.setData({ coupon:e.detail }) + this.showAllPrice() }, // 一日游合同确认签字 // ondayConfirm:function(){ diff --git a/pages/order/roadOrder/index.json b/pages/order/roadOrder/index.json index 8172ad6..f35301a 100644 --- a/pages/order/roadOrder/index.json +++ b/pages/order/roadOrder/index.json @@ -1,6 +1,7 @@ { "usingComponents": { "title":"/pages/component/TitleHeader", - "coupon":"/pages/order/components/coupon/index" + "coupon":"/pages/order/components/coupon/index", + "smoothly-order": "/pages/order/components/smoothlyOrder/index" } } \ No newline at end of file diff --git a/pages/order/roadOrder/index.wxml b/pages/order/roadOrder/index.wxml index 52331d5..0b7f40f 100644 --- a/pages/order/roadOrder/index.wxml +++ b/pages/order/roadOrder/index.wxml @@ -29,7 +29,16 @@ - + + + + - + 合计: ¥{{price}} @@ -58,4 +58,8 @@ + \ No newline at end of file diff --git a/pages/order/WineSceneOrder/index.wxss b/pages/order/WineSceneOrder/index.wxss index 91703eb..6676d7b 100644 --- a/pages/order/WineSceneOrder/index.wxss +++ b/pages/order/WineSceneOrder/index.wxss @@ -451,4 +451,23 @@ page { .s-price::before { content: "¥"; font-size: 24rpx; + } + + .tishi { + width: 100%; + height: 67rpx; + background: #FFDEDE; + font-weight: bold; + font-size: 27rpx; + color: #D62828; + display: flex; + align-items: center; + position: fixed; + left: 0; + bottom: 113rpx; + } + .tishi image { + width: 26.67rpx; + height: 26.67rpx; + margin: 0 12rpx 0 26rpx; } \ No newline at end of file diff --git a/pages/order/components/coupon/index.wxml b/pages/order/components/coupon/index.wxml index c4cf7d2..e37cf14 100644 --- a/pages/order/components/coupon/index.wxml +++ b/pages/order/components/coupon/index.wxml @@ -2,9 +2,9 @@ 优惠券 - + -¥{{coupon.activity.money/100}} diff --git a/pages/order/components/smoothlyOrder/index.js b/pages/order/components/smoothlyOrder/index.js index 879ec6d..1441696 100644 --- a/pages/order/components/smoothlyOrder/index.js +++ b/pages/order/components/smoothlyOrder/index.js @@ -32,6 +32,11 @@ Component({ sommthlyIndex: 0 }) this.getList() + + // 组件初始化时,通知父组件重置价格为 0 + this.triggerEvent('updateTotalPrice', { + total: 0 + }); } }, observers: { @@ -67,10 +72,11 @@ Component({ methods: { // 查看规格信息 showSkuInfo(e) { + console.log(e) this.setData({ showItem: e.currentTarget.dataset.item, showSkuPopup: true, - content: '' + content: e.currentTarget.dataset.item.content }) console.log(this.data.showItem) }, diff --git a/pages/order/components/smoothlyOrder/index.wxml b/pages/order/components/smoothlyOrder/index.wxml index 476dbf4..3a6c7d6 100644 --- a/pages/order/components/smoothlyOrder/index.wxml +++ b/pages/order/components/smoothlyOrder/index.wxml @@ -53,13 +53,13 @@ wx:if="{{item.postMoney > 0}}">(另需运费¥{{item.postMoney / 100}}) + catchtap="decreaseSkuNum" data-item="{{item}}" wx:if="{{item.buyNum > 0}}" mode="widthFix" /> {{item.buyNum}} + catchtap="increaseSkuNum" data-item="{{item}}" mode="widthFix" /> diff --git a/pages/order/food/index.js b/pages/order/food/index.js index d22db10..003669e 100644 --- a/pages/order/food/index.js +++ b/pages/order/food/index.js @@ -17,7 +17,8 @@ Page({ coupon:null, price: 0, smoothlyTotal: 0, - maxCouponObject: null + maxCouponObject: null, + couponCom: null }, /** @@ -50,6 +51,9 @@ Page({ // 调用子组件清除优惠券方法 callOtherCompMethod: function(e) { this.couponCom.setNullCoupon() + this.setData({ + coupon:null + }) }, showNotice:function(){ this.setData({ @@ -75,10 +79,13 @@ Page({ let price = this.data.product.sku.price * this.data.productNum let allPrice = 0 - // 顺手购价格 - price += this.data.smoothlyTotal || 0; allPrice = price + // 顺手购价格 + if (!this.data.coupon) { + price += this.data.smoothlyTotal || 0; + } + if (this.data.coupon) { if (this.data.coupon.activity.discount_type == 'pricebreak') { price = price - this.data.coupon.activity.money @@ -153,7 +160,6 @@ Page({ }, order:function(){ const smoothlyComp = this.selectComponent("#smoothlyOrderComp"); - console.log(smoothlyComp,smoothlyComp.emitOrder()) if(smoothlyComp) { // 检查是否有选中的顺手购商品 const hasSelected = smoothlyComp.hasSelectedGoods(); diff --git a/pages/order/food/index.wxml b/pages/order/food/index.wxml index 814418d..4e2da04 100644 --- a/pages/order/food/index.wxml +++ b/pages/order/food/index.wxml @@ -32,18 +32,23 @@ - + 订单金额:¥{{price}} 提交订单 - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/order/food/index.wxss b/pages/order/food/index.wxss index f9ec664..33525e4 100644 --- a/pages/order/food/index.wxss +++ b/pages/order/food/index.wxss @@ -132,4 +132,23 @@ margin-top: 30rpx; color: #D62828; font-size: 36rpx; margin-left: 10rpx; +} + +.tishi { + width: 100%; + height: 67rpx; + background: #FFDEDE; + font-weight: bold; + font-size: 27rpx; + color: #D62828; + display: flex; + align-items: center; + position: fixed; + left: 0; + bottom: 113rpx; +} +.tishi image { + width: 26.67rpx; + height: 26.67rpx; + margin: 0 12rpx 0 26rpx; } \ No newline at end of file diff --git a/pages/order/postOrder/index.js b/pages/order/postOrder/index.js index c1b21ad..a13f797 100644 --- a/pages/order/postOrder/index.js +++ b/pages/order/postOrder/index.js @@ -57,12 +57,16 @@ Page({ this.setData({ smoothlyTotal: e.detail.total }); + console.log(123456) // 重新计算总价 this.changePrice(); }, // 调用子组件清除优惠券方法 callOtherCompMethod: function(e) { this.couponCom.setNullCoupon() + this.setData({ + coupon: null + }) }, handleProduct () { app.globalData.postProduct.forEach((item,index) => { @@ -212,6 +216,15 @@ Page({ }, minus: function (e) { + if(this.data.coupon){ + wx.showToast({ + title: '订单价格发生变化,请重新选择优惠券', + icon: 'none' + }) + } + this.couponCom.setNullCoupon() + app.globalData.couponInfo = null; + let index = e.currentTarget.dataset.index, product = this.data.product; let productNum = product[index].productNum; if (productNum <= 1) return; @@ -237,10 +250,6 @@ Page({ changePrice: function () { let product = this.data.product, price = 0, allPrice = 0; - // 顺手购价格 - price += this.data.smoothlyTotal || 0; - allPrice = price - product.map(item => { price = price + item.sku.price * item.productNum; if (this.data.allowance_data && this.data.select_allowance && this.data.allowance_price) { @@ -248,19 +257,27 @@ Page({ price -= this.data.allowance_price * item.productNum < spread_price ? this.data.allowance_price * item.productNum : spread_price } }) - if (this.data.coupon && this.data.showPrice != price) { - wx.showToast({ - title: '订单价格发生变化,请重新选择优惠券', - icon: 'none' - }) - app.globalData.couponInfo = null; - if (!this.data.kjId && !this.data.gp_id) { - this.couponCom.setNullCoupon() - } - this.setData({ - coupon: null - }) - } + + allPrice = price + + // 顺手购价格 + if (!this.data.coupon) { + price += this.data.smoothlyTotal || 0; + } + + // if (this.data.coupon && this.data.showPrice != price) { + // wx.showToast({ + // title: '订单价格发生变化,请重新选择优惠券', + // icon: 'none' + // }) + // app.globalData.couponInfo = null; + // if (!this.data.kjId && !this.data.gp_id) { + // this.couponCom.setNullCoupon() + // } + // this.setData({ + // coupon: null + // }) + // } this.setData({ showPrice: app.globalData.kjId ? 0 : price }) @@ -568,6 +585,8 @@ Page({ this.setData({ coupon:e.detail }) + + this.changePrice() }, /** diff --git a/pages/order/postOrder/index.wxml b/pages/order/postOrder/index.wxml index 2f51bb5..00ed078 100644 --- a/pages/order/postOrder/index.wxml +++ b/pages/order/postOrder/index.wxml @@ -118,7 +118,7 @@ - + @@ -155,4 +155,9 @@ postId="{{address.id}}" {{allowance_data.title}} - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/order/postOrder/index.wxss b/pages/order/postOrder/index.wxss index f82157b..aea3156 100644 --- a/pages/order/postOrder/index.wxss +++ b/pages/order/postOrder/index.wxss @@ -312,4 +312,22 @@ page { width: 26.67rpx; height: 26.67rpx; margin-right: 12rpx; +} +.tishi { + width: 100%; + height: 67rpx; + background: #FFDEDE; + font-weight: bold; + font-size: 27rpx; + color: #D62828; + display: flex; + align-items: center; + position: fixed; + left: 0; + bottom: 113rpx; +} +.tishi image { + width: 26.67rpx; + height: 26.67rpx; + margin: 0 12rpx 0 26rpx; } \ No newline at end of file diff --git a/pages/order/roadOrder/index.js b/pages/order/roadOrder/index.js index 118d93f..e81d26c 100644 --- a/pages/order/roadOrder/index.js +++ b/pages/order/roadOrder/index.js @@ -70,14 +70,18 @@ Page({ // 调用子组件清除优惠券方法 callOtherCompMethod: function(e) { this.couponCom.setNullCoupon() + this.setData({ + coupon: null, + }) }, showAllPrice() { let price = app.globalData.product.price - let allPrice = 0 + let allPrice = price // 顺手购价格 - price += this.data.smoothlyTotal || 0; - allPrice = price + if (!this.data.coupon) { + price += this.data.smoothlyTotal || 0; + } if (this.data.coupon) { if (this.data.coupon.activity.discount_type == 'pricebreak') { diff --git a/pages/order/roadOrder/index.wxml b/pages/order/roadOrder/index.wxml index 0b7f40f..193d220 100644 --- a/pages/order/roadOrder/index.wxml +++ b/pages/order/roadOrder/index.wxml @@ -33,7 +33,7 @@ 设为默认出行人 - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/order/roadOrder/index.wxss b/pages/order/roadOrder/index.wxss index 301c4a0..b5e17e3 100644 --- a/pages/order/roadOrder/index.wxss +++ b/pages/order/roadOrder/index.wxss @@ -185,4 +185,23 @@ page { padding-left: 25rpx; box-shadow: 0px 0px 16rpx 0px rgba(6, 0, 1, 0.1); z-index: 1; +} + +.tishi { + width: 100%; + height: 67rpx; + background: #FFDEDE; + font-weight: bold; + font-size: 27rpx; + color: #D62828; + display: flex; + align-items: center; + position: fixed; + left: 0; + bottom: 113rpx; +} +.tishi image { + width: 26.67rpx; + height: 26.67rpx; + margin: 0 12rpx 0 26rpx; } \ No newline at end of file diff --git a/pages/order/showOrderNew/index.js b/pages/order/showOrderNew/index.js index 2552622..abf846d 100644 --- a/pages/order/showOrderNew/index.js +++ b/pages/order/showOrderNew/index.js @@ -127,7 +127,10 @@ Page({ }, // 调用子组件清除优惠券方法 callOtherCompMethod: function(e) { - this.couponCom.setNullCoupon() + this.selectAllComponents("#coupon")[0].setNullCoupon() + this.setData({ + coupon: null, + }) }, hideDate: function () { this.setData({ @@ -296,11 +299,11 @@ Page({ }, totalPrice(price) { let allPrice = this.data.singlePrice * this.data.productNum - let prices = 0 - console.log(this.data.smoothlyTotal,111111) + let prices = allPrice // 顺手购价格 - allPrice += this.data.smoothlyTotal || 0; - prices = allPrice + if (!this.data.coupon) { + allPrice += this.data.smoothlyTotal || 0; + } if (this.data.coupon) { if (this.data.coupon.activity.discount_type == 'pricebreak') { allPrice = allPrice - this.data.coupon.activity.money @@ -338,7 +341,7 @@ Page({ this.setData({ maxCouponObject: { price: prices, - skuIds: skuIds.toString() + skuIds: skuIds.toString() } }) }, diff --git a/pages/order/showOrderNew/index.wxml b/pages/order/showOrderNew/index.wxml index 9d0a16c..6ff55d1 100644 --- a/pages/order/showOrderNew/index.wxml +++ b/pages/order/showOrderNew/index.wxml @@ -50,7 +50,7 @@ + + + + 合计:¥0 合计: diff --git a/pages/order/showOrderNew/index.wxss b/pages/order/showOrderNew/index.wxss index 478a9a6..baf7582 100644 --- a/pages/order/showOrderNew/index.wxss +++ b/pages/order/showOrderNew/index.wxss @@ -455,4 +455,23 @@ text-align: center; .s-price::before { content: "¥"; font-size: 24rpx; +} + +.tishi { + width: 100%; + height: 67rpx; + background: #FFDEDE; + font-weight: bold; + font-size: 27rpx; + color: #D62828; + display: flex; + align-items: center; + position: fixed; + left: 0; + bottom: 113rpx; +} +.tishi image { + width: 26.67rpx; + height: 26.67rpx; + margin: 0 12rpx 0 26rpx; } \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index d508dad..cecb42b 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -9,7 +9,7 @@ { "name": "pages/info/postProductInfo/index", "pathName": "pages/info/postProductInfo/index", - "query": "id=464888", + "query": "id=464726", "scene": null, "launchMode": "default" }, @@ -20,6 +20,13 @@ "launchMode": "default", "scene": null }, + { + "name": "pages/info/roadInfo/index", + "pathName": "pages/info/roadInfo/index", + "query": "id=463608", + "launchMode": "default", + "scene": null + }, { "name": "pages/info/showInfo/index", "pathName": "pages/info/showInfo/index", diff --git a/utils/util.js b/utils/util.js index 8620a24..5f6b883 100644 --- a/utils/util.js +++ b/utils/util.js @@ -207,7 +207,7 @@ const gotoDetail = (item,isPagePoint,queryStr="") =>{ } console.log(item) - + let tempUrl = '' switch(item.type){ case "tenscenic": @@ -221,7 +221,9 @@ const gotoDetail = (item,isPagePoint,queryStr="") =>{ pagePointData.event='ticket_detail_click' pagePoint(pagePointData,1) } + // tempUrl = detailDomain+`/ScenicDetail?id=${item.scene_id || item.id}` wx.navigateTo({ + // url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl), url: '/pages/info/sceneProductInfo/index?id='+(item.scene_id || item.id)+queryStr }) break; @@ -310,7 +312,7 @@ const gotoDetail = (item,isPagePoint,queryStr="") =>{ break; case "movie": // 产品 电影票 - let tempUrl = 'https://m.cloud.sz-trip.com'+`/MovieInfo?id=${item.third_id || item.id}`+'&title='+item.title+queryStr + tempUrl = 'https://m.cloud.sz-trip.com'+`/MovieInfo?id=${item.third_id || item.id}`+'&title='+item.title+queryStr wx.navigateTo({ url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl), // url: '/pages/list/movieticket/list/info/index?id='+(item.third_id || item.id)+'&title='+item.title @@ -328,7 +330,9 @@ const gotoDetail = (item,isPagePoint,queryStr="") =>{ pagePointData.event='ticket_detail_click' pagePoint(pagePointData,1) } + // tempUrl = detailDomain+`/ScenicDetail?id=${item.scene_id || item.id}` wx.navigateTo({ + // url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl), url: '/pages/info/sceneProductInfo/index?id='+(item.scene_id || item.id)+queryStr }) break;