From 83b209b0c0777a6f9c9e2e17084f9a98711939e7 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Mon, 18 Sep 2023 11:21:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=94=B9=E7=89=88=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/bookShop/commodityDetail.vue | 2 +- pages/bookShop/settlement.vue | 16 +++++++++++++--- pages/bookShop/settlementBook.vue | 15 ++++++++++++--- pages/peanut/home.vue | 8 ++++---- pages/peanut/shopping.vue | 3 ++- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/pages/bookShop/commodityDetail.vue b/pages/bookShop/commodityDetail.vue index ee206b2..219c4d6 100644 --- a/pages/bookShop/commodityDetail.vue +++ b/pages/bookShop/commodityDetail.vue @@ -281,7 +281,7 @@ // 点击购物车 onClick(e) { console.log(e.content.text) - uni.switchTab({ + uni.navigateTo({ url: '../peanut/shopping' }); }, diff --git a/pages/bookShop/settlement.vue b/pages/bookShop/settlement.vue index 762041f..f5d0ade 100644 --- a/pages/bookShop/settlement.vue +++ b/pages/bookShop/settlement.vue @@ -37,7 +37,8 @@ {{item.productName}} - ¥{{item.price*item.productAmount}} + ¥{{item.activityPrice*item.productAmount}} + ¥{{item.price*item.productAmount}} @@ -403,12 +404,17 @@ this.$http .post('book/shopproduct/info/' + e) .then(res => { + console.log(res) let prodCont = {} prodCont.productId = res.shopProduct.productId prodCont.image = res.shopProduct.productImages prodCont.productName = res.shopProduct.productName prodCont.productAmount = 1 - prodCont.price = res.shopProduct.price + if(res.shopProduct.activityPrice && res.shopProduct.activityPrice > 0){ + prodCont.price = res.shopProduct.activityPrice + }else{ + prodCont.price = res.shopProduct.price + } prodCont.weight = res.shopProduct.weight this.cartList.push(prodCont) this.getCourpe() @@ -467,7 +473,11 @@ let allprice = 0; this.cartList.forEach((item, index) => { let price = 0; - price = item.productAmount * item.price; + if(item.activityPrice && item.activityPrice > 0){ + price = item.productAmount * item.activityPrice; + }else{ + price = item.productAmount * item.price; + } allprice += price }) this.totalPrice = allprice diff --git a/pages/bookShop/settlementBook.vue b/pages/bookShop/settlementBook.vue index 4e13ff4..fd9c881 100644 --- a/pages/bookShop/settlementBook.vue +++ b/pages/bookShop/settlementBook.vue @@ -37,7 +37,8 @@ {{item.productName}} - ¥{{item.price*item.productAmount}} + ¥{{item.activityPrice*item.productAmount}} + ¥{{item.price*item.productAmount}} @@ -430,7 +431,11 @@ prodCont.image = res.shopProduct.productImages prodCont.productName = res.shopProduct.productName prodCont.productAmount = 1 - prodCont.price = res.shopProduct.price + if(res.shopProduct.activityPrice && res.shopProduct.activityPrice > 0){ + prodCont.price = res.shopProduct.activityPrice + }else{ + prodCont.price = res.shopProduct.price + } prodCont.weight = res.shopProduct.weight this.cartList.push(prodCont) this.getCourpe() @@ -489,7 +494,11 @@ let allprice = 0; this.cartList.forEach((item, index) => { let price = 0; - price = item.productAmount * item.price; + if(item.activityPrice && item.activityPrice > 0){ + price = item.productAmount * item.activityPrice; + }else{ + price = item.productAmount * item.price; + } allprice += price }) this.totalPrice = allprice diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue index d09e9a9..86ed14d 100644 --- a/pages/peanut/home.vue +++ b/pages/peanut/home.vue @@ -16,9 +16,9 @@ 搜索 - + @@ -633,9 +633,9 @@ background-position: center center; background-repeat: no-repeat; background-size: cover; - padding: 100rpx 20rpx 40rpx 20rpx; + padding: 20rpx; position: relative; - height: 400rpx; margin-bottom: 130rpx; + // height: 400rpx; margin-bottom: 130rpx; .icon_hua_1 { // margin: 0 auto; width: 150rpx; diff --git a/pages/peanut/shopping.vue b/pages/peanut/shopping.vue index 2491169..f8c4581 100644 --- a/pages/peanut/shopping.vue +++ b/pages/peanut/shopping.vue @@ -15,7 +15,8 @@ {{item.productName}} - ¥{{item.price*item.productAmount}} + ¥{{item.activityPrice*item.productAmount}} + ¥{{item.price*item.productAmount}}