首页改版前

This commit is contained in:
@fawn-nine
2023-09-18 11:21:07 +08:00
parent 46a66c8884
commit 83b209b0c0
5 changed files with 32 additions and 12 deletions

View File

@@ -281,7 +281,7 @@
// 点击购物车
onClick(e) {
console.log(e.content.text)
uni.switchTab({
uni.navigateTo({
url: '../peanut/shopping'
});
},

View File

@@ -37,7 +37,8 @@
<text>{{item.productName}}</text>
</view>
<view class="itemPrice">
<text>{{item.price*item.productAmount}}</text>
<text v-if="item.activityPrice && item.activityPrice > 0">{{item.activityPrice*item.productAmount}}</text>
<text v-else>{{item.price*item.productAmount}}</text>
<u-number-box v-model="item.productAmount" @change="valChange($event, item)" :input-width="50"
:input-height="20" :min="1" :max="item.productStock" integer ></u-number-box>
</view>
@@ -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

View File

@@ -37,7 +37,8 @@
<text>{{item.productName}}</text>
</view>
<view class="itemPrice">
<text>{{item.price*item.productAmount}}</text>
<text v-if="item.activityPrice && item.activityPrice > 0">{{item.activityPrice*item.productAmount}}</text>
<text v-else>{{item.price*item.productAmount}}</text>
<u-number-box v-model="item.productAmount" @change="valChange($event, item)" :input-width="50"
:input-height="20" :min="1" :max="item.productStock" integer ></u-number-box>
</view>
@@ -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