This commit is contained in:
2020-07-30 20:33:16 +08:00
parent 04adc72d92
commit 6d00107944
17 changed files with 241 additions and 124 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view class="order">
<view class="info-address" @click="changeAddress">
<view class="info-address" @click="changeAddress" v-if="JSON.stringify(addressInfo) != '{}'">
<image src="../static/image/2.png" class="address-icon"></image>
<view class="address">
<view class="user-info">
@@ -11,6 +11,7 @@
</view>
<image src="../static/image/1.png" class="right"></image>
</view>
<view v-else class="address-none" @click="changeAddress">请选择地址</view>
<view class="main">
<view v-for="(item, index) in orderInfo.store_cart_list" :key="index">
<view class="goods-info">
@@ -147,17 +148,18 @@ export default {
this.orderType = this.$store.state.orderType;
this.orderInfo = this.$store.state.orderInfo;
// console.log(this.orderType);
console.log(this.orderInfo);
// console.log(this.orderInfo);
this.getGoodsClass();
this.setTotalPrice();
},
onShow() {
this.storeCoupon = {};
this.choiceCoupon = {};
// 判断是不是从选择地址页面返回
if(JSON.stringify(this.$store.state.orderAddress) == '{}') {
this.$store.commit('updateAddress', this.orderInfo.address_info);
if(this.orderInfo.address_info) this.$store.commit('updateAddress', this.orderInfo.address_info);
} else {
this.addressInfo = this.$store.state.orderAddress;
if(this.$store.getters.getOrderAddress) this.addressInfo = this.$store.state.orderAddress;
}
},
beforeDestroy() {
@@ -166,22 +168,8 @@ export default {
watch: {
'$store.state.orderAddress'(value) {
this.addressInfo = value;
this.getFreight();
if(JSON.stringify(value) != '{}') this.getFreight();
},
// storeCoupon: {
// deep: true,
// handler() {
// console.log(222);
// this.setTotalPrice(); // 计算总价
// }
// },
// choiceCoupon: {
// deep: true,
// handler() {
// console.log(111);
// this.setTotalPrice(); // 计算总价
// }
// },
},
methods: {
// 如果有pintuangroup_headid为参团不然为开团
@@ -242,6 +230,11 @@ export default {
if(JSON.stringify(this.choiceCoupon) != '{}') {
coupon.push(0 + '|' + this.choiceCoupon.voucher_id)
}
// 验证是否选择地址
if(!this.addressInfo || JSON.stringify(this.addressInfo) == '{}') {
this.$u.toast('收货地址不能为空');
return false;
}
let params = {
ifcart: ifcart,
cart_id: id,
@@ -304,6 +297,7 @@ export default {
},
setTotalPrice() {
const goods = this.orderInfo.store_goods_total;
console.log(this.freight);
const freight = this.freight;
let price = 0;
// 商品价格加上运费
@@ -398,6 +392,14 @@ export default {
height: 22rpx;
}
}
.address-none {
height: 150rpx;
line-height: 150rpx;
margin-bottom: 10rpx;
background:rgba(255,255,255,1);
text-align: center;
color: #333;
}
.main {
margin-bottom: 50rpx;
> view {