From 3416b87d42c157f71c8d0b8fc4f5a9e4367a03a3 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Fri, 22 Aug 2025 10:36:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E5=90=88=E4=BA=A7=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/info/roadInfo/index.js | 51 ++++++++++- pages/info/roadInfo/index.wxml | 36 +++++++- pages/info/roadInfo/index.wxss | 152 ++++++++++++++++++++++++++++++++- utils/util.js | 74 ++++++++++++++++ 4 files changed, 310 insertions(+), 3 deletions(-) diff --git a/pages/info/roadInfo/index.js b/pages/info/roadInfo/index.js index 212fa51..1fab188 100644 --- a/pages/info/roadInfo/index.js +++ b/pages/info/roadInfo/index.js @@ -23,7 +23,11 @@ Page({ showShareFlag: false, showQrCode: false, wxqrcode: null, - ZTPoint:'' + ZTPoint:'', + + skuIndex: 0, + skuFlag: false, + producNum: 1, }, /** @@ -159,6 +163,15 @@ Page({ }, order: function () { + // todo 判断组合产品 + // if (this.data.info.is_compose == 1) { + // if (true) { + // // 打开规格弹窗 + // this.setData({skuFlag: true}) + // return + // } + + commonApi.user_post('wx/get_user_keep', { jumpurl: '/pages/info/roadInfo/index?id=' + this.data.id, title: this.data.info.title, @@ -196,6 +209,21 @@ Page({ }, + + // 组合产品获取购买的sku + getComposeSku () { + commonApi.user_post("product/get_sku_compose_list", { + sku_id: "190720" + }).then(res => { + if (res&&Array.isArray(res.data)&&res.data.length>0) { + res.data.forEach(v => { + v.sku.is_compose = 1 + }); + util.orderByShoppingCart(res.data,app) + } + }) + }, + pagePoint: function (e) { util.pagePoint(e) }, @@ -467,6 +495,27 @@ Page({ } }, + + setSimpleValue: function (e) { + let keyname = e.currentTarget.dataset.keyname + let val = e.currentTarget.dataset.val + let param = {} + param[keyname] = val + this.setData(param) + }, + minus: function () { + if (this.data.producNum == 1) return; + this.setData({ + producNum: this.data.producNum - 1 + }) + }, + add: function () { + this.setData({ + producNum: this.data.producNum + 1 + }) + }, + + /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/info/roadInfo/index.wxml b/pages/info/roadInfo/index.wxml index bfc2df6..7e1118c 100644 --- a/pages/info/roadInfo/index.wxml +++ b/pages/info/roadInfo/index.wxml @@ -120,4 +120,38 @@ - \ No newline at end of file + + + + + + + + + + + {{info.sku[skuIndex].price/100}} + + + 已选择:{{info.sku[skuIndex].sku_name}} + + + + {{item.sku_name}} + + + 数量 + + {{producNum}} + + + + + 立即购买 + 该商品已下架 + + + \ No newline at end of file diff --git a/pages/info/roadInfo/index.wxss b/pages/info/roadInfo/index.wxss index 991d6dd..32680b5 100644 --- a/pages/info/roadInfo/index.wxss +++ b/pages/info/roadInfo/index.wxss @@ -441,4 +441,154 @@ page { font-size: 31rpx; font-weight: 500; margin-top: 50rpx; -} \ No newline at end of file +} + + + + +.sku-info-box { + margin: 50rpx 40rpx; + display: flex; + justify-content: space-between; + } + + .sku-info-box image { + width: 218rpx; + height: 180rpx; + border-radius: 13rpx; + display: block; + margin-right: 40rpx; + flex-shrink: 0; + } + + .sku-info { + flex: 1; + } + + .sku-price { + font-size: 40rpx; + font-weight: 500; + color: #D62828; + margin: 20rpx 0; + display: flex; + justify-content: flex-start; + align-items: center; + } + + .sku-price::before { + content: "¥"; + font-weight: 400; + font-size: 27rpx; + vertical-align: baseline; + } + + .sku-price view { + font-size: 24rpx; + color: #FFFFFF; + background-color: #D62828; + border-radius: 22rpx; + line-height: 44rpx; + margin-left: 7rpx; + padding: 0 20rpx; + } + + .sku-name { + font-size: 27rpx; + color: #666666; + } + + .sku-names { + display: flex; + font-size: 29rpx; + color: #333; + margin: 0 40rpx; + text-align: center; + flex-wrap: wrap; + margin-bottom: 20rpx; + justify-content: space-between; + } + + .sku-name-item { + background: #EFEFEF; + border: 1rpx solid #EFEFEF; + /* width: 318rpx; */ + line-height: 77rpx; + border-radius: 14rpx; + margin-bottom: 25rpx; + margin-right: 30rpx; + max-width: 100%; + padding: 0 15rpx; + min-width: 270rpx; + } + + .sku-name-item:nth-child(2n) { + margin-right: 0; + } + + .sku-name-item.active { + color: #0B898E; + border-color: #0B898E; + background: rgba(11, 137, 142, 0.1); + } + + .number-box { + display: flex; + align-items: center; + border-top: 1rpx solid #ccc; + justify-content: space-between; + margin: 0 40rpx; + padding: 40rpx 0; + } + + .number-box text { + flex: 1; + font-size: 29rpx; + color: #333; + } + + .number-box view { + border: 1rpx solid #666; + border-radius: 7rpx; + text-align: center; + width: 67rpx; + line-height: 67rpx; + font-size: 33rpx; + color: #000; + } + + .number-box view.disable { + border-color: #ccc; + color: #999; + } + + .number-box view.number { + width: 94rpx; + margin: 0 15rpx; + } + + .btn-box { + height: 138rpx; + background: #FFFFFF; + box-shadow: 0px 0px 16rpx 0px rgba(6, 0, 1, 0.1); + display: flex; + align-items: center; + justify-content: center; + position: fixed; + left: 0; + right: 0; + bottom: 0; + } + .mask-btn { + width: 670rpx; + line-height: 78rpx; + background: #D62828; + border-radius: 39rpx; + color: #fff; + text-align: center; + font-size: 33rpx; + font-weight: 500; + } + + .mask-btn.disable { + background: #ccc; + } \ No newline at end of file diff --git a/utils/util.js b/utils/util.js index 80d287f..1609034 100644 --- a/utils/util.js +++ b/utils/util.js @@ -561,6 +561,79 @@ const detailPagePoint = function (url, res) { } +// app 要传进来 util 获取不到 +const orderByShoppingCart = function (listData, app) { + let productType,flag,isCar; + commonApi.user_post('wx/get_user_keep', { + jumpurl: '/pages/user/cartlist/list', + title: '购物车', + type: 'mini' + }).then(res => { + if (res.data.subscribe == 0) { + this.setData({ + wxqrcode: res.data.qrcode, + showQrCode: true + }) + } else { + app.globalData.couponInfo = null; + let list = listData, product = [], product1 = [] + list.map(item => { + // item.product.type="post"; + if (item.product.type == 'post') { + product.push({ + product: item.product, + sku: item.sku, + productNum: item.num + }) + } else { + product1.push(item) + app.globalData.list = product1 + } + if (item.product.type.includes('post')) { + productType = 'post' + } + }) + if (product.length == 0 && product1.length == 0) { + wx.showToast({ + title: '请先选择产品', + icon: 'none' + }) + return; + } + if (product.length > 0 && product1.length > 0) { + flag = "mix"; + isCar = "multiple" + } + if (product1.length > 1) { + isCar = "multiple" + } else { + isCar = "single" + } + console.log(product1,'product1'); + + app.globalData.listName = null + if (product1.length>0) { + app.globalData.listName = 'car' + } + + app.globalData.postProduct = product; + if (app.globalData.list) { + app.globalData.index = 0 + app.globalData.product = app.globalData.list[app.globalData.index] + } + if (productType == 'post') { + wx.navigateTo({ + url: '/pages/order/postOrder/index?from=cart&flag=' + flag, + }) + } else { + wx.navigateTo({ + url: '/subPackages/gwcOrder/index?isCar=' + isCar, + }) + } + } + }) +} + module.exports = { formatTime: formatTime, @@ -586,4 +659,5 @@ module.exports = { getGlobalPagePoint: getGlobalPagePoint, clearGlobalPagePoint: clearGlobalPagePoint, detailPagePoint: detailPagePoint, + orderByShoppingCart: orderByShoppingCart, }