buyer-confirm.vue
3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<template>
<LayoutApp :show-back="true">
<div class="body">
<TitleComp txt="确认订单" class="title-class"></TitleComp>
<AddressInfo :data="address" class="order-item" :show-tip="false"></AddressInfo>
<ProductInfo :data="orderDetail.good" class="product-info order-item"></ProductInfo>
<Coupon class="order-item" :data="orderDetail.recommendedCouponInfo" @click="onCouponClick"></Coupon>
<BuyerFeeInfo :data="orderDetail.promotionFormulaList" class="order-item"></BuyerFeeInfo>
<div class="tip2 order-item">{{orderDetail.specialTips}}</div>
<div class="tip order-item" v-html="replaceBr(orderDetail.damagesDesc)"></div>
<OrderInfo class="order-item" :pay-way="orderDetail.paymentWay" :delivery-way="orderDetail.deliveryWay"></OrderInfo>
</div>
<OrderFooter class="footer" :amount="orderDetail.amount"></OrderFooter>
</LayoutApp>
</template>
<script>
import ProductInfo from './components/confirm/buyer-product';
import AddressInfo from './components/confirm/address';
import TitleComp from './components/confirm/title';
import BuyerFeeInfo from './components/confirm/buyer-fee';
import OrderInfo from './components/confirm/order-info';
import OrderFooter from './components/confirm/buyer-order-footer';
import Coupon from './components/confirm/coupon';
import { Types, UserType } from 'store/order/order-confirm';
import { get } from 'lodash';
import { createNamespacedHelpers, mapState } from 'vuex';
const { mapState: mapOrderState, mapActions: mapOrderAction, mapMutations: mapOrderMutations } = createNamespacedHelpers('order/orderConfirm');
export default {
name: 'OrderConfirm',
props: ['productId', 'sizeId', 'tradeTypeId'],
data() {
return {};
},
components: {
ProductInfo,
AddressInfo,
TitleComp,
BuyerFeeInfo,
OrderInfo,
OrderFooter,
Coupon
},
async mounted() {
this.fetchUserStatus();
this.fetchOrderAddress({ tabType: UserType.buy });
await this.$store.dispatch('product/getSelectedTradeProduct', {
productId: this.productId,
sizeId: this.sizeId
});
this.fetchPayment({ skup: this.productDetail.skup });
},
computed: {
...mapOrderState(['address', 'orderDetail']),
...mapState({
productDetail: state => {
return {
skup: get(state.product.selectedProductInfo, 'size.skup', '')
};
}
})
},
methods: {
...mapOrderAction(['fetchOrderAddress', 'fetchUserStatus', 'fetchPayList', 'fetchPayment']),
replaceBr(str) {
return str ? str.replace(/\n/g, '<br />') : '';
},
onCouponClick() {
this.$createOrderCouponList({
data: this.orderDetail.couponList
}).show();
}
}
};
</script>
<style lang="scss" scoped>
.footer {
position: absolute;
bottom: 0;
width: 100%;
z-index: 100;
background-color: white;
border-top: 1px solid #eee;
}
.body {
height: 100%;
margin: 0 40px;
padding-bottom: 100px;
overflow-y: auto;
}
.title-class {
margin-bottom: 30px;
}
.order-item {
padding-top: 40px;
padding-bottom: 40px;
border-top: 1px solid #eee;
}
.product-info {
height: 260px;
}
.tip {
font-size: 24px;
color: #999;
}
.tip2 {
font-size: 28px;
}
</style>