【类 型】:fix

【原  因】:传值到 付款页面  由于提前清空购物车  导致商品价格没有累计
【过  程】:清空购物车前 记录商品总价格 到一个变量
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
sszdot 2024-12-12 19:40:48 +08:00
parent 88610e5b43
commit 44a4d393c6
2 changed files with 15 additions and 5 deletions

View File

@ -127,7 +127,7 @@
},
//
total() {
return this.totalPrice(this.$store.state.cartList)
return Number(this.totalPrice(this.$store.state.cartList))
},
//
transportPrice() {
@ -149,7 +149,7 @@
},
//
fullPrice() {
return this.total + this.transportPrice + this.packPrice
return Number(this.total) + Number(this.transportPrice) + Number(this.packPrice)
},
//
userInfo() {
@ -182,11 +182,12 @@
}).then(res => {
//
if (res.data.status === 1) {
let fullPrice = String(this.fullPrice)
//
this.$store.commit('clearCartList')
//
uni.navigateTo({
url: `/pages/shop/pay?order_sn=${res.data.order_sn}`
url: `/pages/shop/pay?order_sn=${res.data.order_sn}&fullPrice=${fullPrice}`
});
} else if (res.data.status === -1) {
uni.removeStorage({ //

View File

@ -7,23 +7,32 @@
</view>
</u-navbar>
<!-- 价格 -->
<view></view>
<view>{{fullPrice | formatPrice}}</view>
<button @click="pay" type="primary" style="margin-top:200rpx;">确认支付</button>
</view>
</template>
<script>
import {
formatPrice
} from '@/utils/index.js'
export default {
data() {
return {
order_sn: '' //
order_sn: '', //
fullPrice: 0,//
}
},
onLoad(options) {
this.order_sn = options.order_sn; //
this.fullPrice = Number(options.fullPrice); //
},
computed(){
},
filters: {
formatPrice, //
},
methods: {
//