From 7f414b5800e34a9e508cacc193b96b79b866bbc6 Mon Sep 17 00:00:00 2001 From: caichunsheng Date: Sat, 12 Nov 2022 16:43:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81,=E7=BA=BF=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/info/sceneProductInfo/index.js | 84 ++++++++++++++------------ pages/info/sceneProductInfo/index.wxml | 8 +-- pages/info/sceneProductInfo/index.wxss | 3 + pages/order/road/index.js | 1 + 4 files changed, 54 insertions(+), 42 deletions(-) diff --git a/pages/info/sceneProductInfo/index.js b/pages/info/sceneProductInfo/index.js index 4303194..aad07af 100644 --- a/pages/info/sceneProductInfo/index.js +++ b/pages/info/sceneProductInfo/index.js @@ -74,8 +74,8 @@ Page({ // 如果带有指定skuid的话 那么取指定的sku展示 if (options.skuid) { let pItem = null; - for (let i = 0; i < res.data.product.length; i++) { - for (let j = 0; j < res.data.product[i].sku.length; j++) { + for (let i = 0; i < res.data.product.length; i++) {//3 + for (let j = 0; j < res.data.product[i].sku.length; j++) {//4 if (res.data.product[i].sku[j].id == options.skuid) { res.data.product[i].sku = [res.data.product[i].sku[j]]; pItem = res.data.product[i]; @@ -274,7 +274,6 @@ Page({ }) return; } else { - app.globalData.postProduct = [] app.globalData.list = [] if (this.data.skuFlag == 'order') { @@ -302,9 +301,10 @@ Page({ ...sku, ...product } - wx.navigateTo({ - url: '/pages/order/scene/index', - }) + + wx.navigateTo({ + url: '/pages/order/scene/index', + }) } else { commonApi.user_post("cart/add_sku", { sku_id: this.data.skuList[this.data.skuIndex].id, @@ -313,7 +313,7 @@ Page({ if (res.code == 1) { commonApi.user_post('cart/get_list', {}).then(res => { this.setData({ - cartCount: res.data.length + cartCount: res.data.length//5 }) }) // 加动效 @@ -661,6 +661,12 @@ Page({ }) return; } + if (this.data.info.product[0].type=='line') { + wx.navigateTo({ + url: '/pages/order/road/index?id=' + this.data.info.product[0].id + }) + return + } this.setData({ skuFlag: 'order' }) @@ -687,7 +693,7 @@ Page({ onShow: function () { commonApi.user_post('cart/get_list', {}).then(res => { this.setData({ - cartCount: res.data.length + cartCount: res.data.length//1 }) }) if (!wx.getStorageSync('jstrip_token')) { @@ -695,36 +701,38 @@ Page({ } if (this.data.info && this.data.info.id) { this.drawImg() - // 获取补贴 - if (this.data.product.length == 1) { - commonApi.user_post("product/getProductAllowancePrice", { - product_code: this.data.product[0].product.product_code - }).then(resTwo => { - if (resTwo && resTwo.code == 1) { - this.setData({ - allowance_data: resTwo.data - }) - let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price) - let sInfo = this.data.product[0].sku - if (spread_price > 0) { - if (spread_price < this.data.allowance_data.discount_rate / 100 * sInfo.price) { - this.setData({ - allowance_price: spread_price - }) - } else { - this.setData({ - allowance_price: this.data.allowance_data.discount_rate / 100 * sInfo.price - }) - } - this.changePrice() - } else { - this.setData({ - allowance_price: 0 - }) - } - } - }) - } + //// 获取补贴 + // if (this.data.product.length == 1) { + // commonApi.user_post("product/getProductAllowancePrice", { + // product_code: this.data.product[0].product.product_code + // }).then(resTwo => { + // if (resTwo && resTwo.code == 1) { + // this.setData({ + // allowance_data: resTwo.data + // }) + // let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price) + // let sInfo = this.data.product[0].sku + // if (spread_price > 0) { + // if (spread_price < this.data.allowance_data.discount_rate / 100 * sInfo.price) { + // this.setData({ + // allowance_price: spread_price + // }) + // } else { + // this.setData({ + // allowance_price: this.data.allowance_data.discount_rate / 100 * sInfo.price + // }) + // } + // this.changePrice() + // } else { + // this.setData({ + // allowance_price: 0 + // }) + // } + // } + // }) + // } + //// 获取补贴结束 + } else { setTimeout(() => { this.onShow() diff --git a/pages/info/sceneProductInfo/index.wxml b/pages/info/sceneProductInfo/index.wxml index 57b1e32..6c68ef6 100644 --- a/pages/info/sceneProductInfo/index.wxml +++ b/pages/info/sceneProductInfo/index.wxml @@ -26,9 +26,9 @@ 开园时间:{{info.open_time}} 优待政策 | 景点介绍 - + 地址:{{info.address}} - + {{info.garden_flag_text}} @@ -69,8 +69,8 @@ - 加入购物车 - 立即预订 + 加入购物车 + 立即预订 该商品已下架 diff --git a/pages/info/sceneProductInfo/index.wxss b/pages/info/sceneProductInfo/index.wxss index 982711e..6afe625 100644 --- a/pages/info/sceneProductInfo/index.wxss +++ b/pages/info/sceneProductInfo/index.wxss @@ -840,4 +840,7 @@ page { color: #666; font-size: 24rpx; margin-top: 8rpx; +} +.btn-r{ + border-radius: 39rpx !important; } \ No newline at end of file diff --git a/pages/order/road/index.js b/pages/order/road/index.js index 793ffdc..12379be 100644 --- a/pages/order/road/index.js +++ b/pages/order/road/index.js @@ -26,6 +26,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + console.log(options.skuid); this.setData({ id:options.id })