checkout.vue
5 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<template>
<view class="container">
<!-- 收货地址选择 -->
<yd-address-select :address="address"></yd-address-select>
<!-- 订单商品信息 -->
<view class="checkout-goods">
<yd-order-goods :goods-list="checkoutList"></yd-order-goods>
</view>
<view class="freight-coupon-box">
<vidw class="box-row">
<view class="title">运费</view>
<yd-text-price class="freight-fee" size="15" :price="freightAmount"></yd-text-price>
</vidw>
<vidw class="box-row">
<view class="coupon-wrap">
<view class="coupon-title-tag">
<view class="title">优惠券</view>
<scroll-view class="coupon-tag-list" scroll-x="true">
<view v-for="item in couponList" :key="item.couponId" class="coupon-tag-item">{{ item.couponTag }}</view>
</scroll-view>
</view>
<yd-text-price class="coupon-fee" color="red" size="15" symbol="-¥" :price="couponAmount"></yd-text-price>
</view>
<u-icon name="arrow-right"></u-icon>
</vidw>
</view>
<!-- 订单备注信息 -->
<view class="user-remark-box">
<view class="title">订单备注</view>
<u--input maxlength="50" border="none" fontSize="14" v-model="remark" placeholder="如您需要请备注"></u--input>
</view>
<view class="cart-btn-container">
<view class="order-total-wrap">
<view class="order-total-info">
<view class="info-text">合计:</view>
<view>
<yd-text-price color="red" size="15" intSize="20" :price="totalAmount"></yd-text-price>
</view>
</view>
<view class="cart-btn-group">
<u-button style="margin-left: 10px" class="main-btn" type="primary" shape="circle" size="small" text="提交订单" @click="handleSubmitOrder"></u-button>
</view>
</view>
<u-safe-bottom customStyle="background: #ffffff"></u-safe-bottom>
</view>
</view>
</template>
<script>
import { checkoutCartProduct } from '../../api/order'
export default {
components: {},
data() {
return {
checkedProduct: [],
address: {
name: '客户',
mobile: '139****6563',
area: 'XXX市XXX区',
detail: 'XXX街道XXX小区XXX号楼XX-XXX'
},
checkoutList: [],
couponList: [
{
couponId: 3,
couponTag: '6元运费券'
}
],
totalAmount: 0,
freightAmount: 6,
couponAmount: 6,
remark: ''
}
},
onLoad(e) {
const checkedProduct = e.checkedProduct
if (checkedProduct) {
this.checkedProduct = JSON.parse(checkedProduct)
this.loadCheckoutProductData()
} else {
uni.$u.toast('请求参数错误')
}
},
methods: {
loadCheckoutProductData() {
checkoutCartProduct(this.checkedProduct)
.then(res => {
this.checkoutList = res.data.checkoutList || []
this.totalAmount = res.data.totalAmount || 0
})
.catch(err => {
console.log(err)
})
}
}
}
</script>
<style lang="scss" scoped>
.container {
background-color: $custom-bg-color;
height: 100vh;
overflow-x: scroll;
}
.checkout-goods {
background-color: #fff;
margin-top: 20rpx;
padding: 20rpx;
border-radius: 20rpx;
}
.freight-coupon-box {
background-color: #fff;
margin-top: 20rpx;
padding: 20rpx 30rpx;
border-radius: 20rpx;
.box-row {
@include flex-space-between;
padding: 10rpx 0;
.coupon-wrap {
@include flex-space-between;
width: 670rpx;
.coupon-title-tag {
@include flex-left;
.coupon-tag-list {
@include flex-left;
overflow-x: scroll;
width: 360rpx;
.coupon-tag-item {
display: inline-block;
font-size: 22rpx;
color: red;
border: 1rpx solid red;
padding: 1px 6rpx;
margin-right: 10rpx;
border-radius: 5rpx;
}
}
}
}
.title {
font-weight: 700;
font-size: 30rpx;
color: #333;
margin-right: 30rpx;
}
.freight-fee {
margin-right: 50rpx;
}
.coupon-fee {
margin-right: 20rpx;
}
}
}
.user-remark-box {
@include flex-space-between;
background-color: #fff;
margin-top: 20rpx;
padding: 30rpx;
border-radius: 20rpx;
.title {
font-weight: 700;
font-size: 30rpx;
color: #333;
margin-right: 30rpx;
}
}
.cart-btn-container {
position: fixed;
bottom: 0;
left: 0;
.order-total-wrap {
background: $custom-bg-color;
border-top: $custom-border-style;
width: 750rpx;
@include flex-space-between();
height: 100rpx;
.order-total-info {
@include flex-left;
.info-text {
margin-left: 20rpx;
font-size: 26rpx;
font-weight: bold;
color: #666666;
}
}
.cart-btn-group {
@include flex-right();
width: 360rpx;
padding-right: 10px;
.btn-gap {
width: 20rpx;
}
}
}
}
</style>