goodsVerification.vue
6.2 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<template>
<div
class="layout"
v-if="flag"
>
<div class="box order">
<div class="title">订单信息</div>
<template v-for="(i,index) in orderObj">
<div
class="item"
:key="index"
>
<div class="label">{{i.label}}:</div>
<div class="value">
<template v-if="i.format">
{{ i.format(detail)}}
</template>
<template v-else>
{{detail[i.key] || ''}}
</template>
</div>
</div>
</template>
</div>
<div class="box">
<div class="title">订单商品</div>
<div class="subtitle">{{detail.merchantName}}</div>
<div class="goods-box">
<template v-for="(i,index) in detail.orderGoods">
<div
class="item flex"
:key="index"
>
<img
:src="i.goodsImage"
class="icon"
>
<div class="info flex">
<div class="name">{{i.goodsName}}</div>
<div class="price flex">
¥ {{i.activityPrice ||i.retailPrice || 0}}
<div class="num">x{{i.goodsNumber || 1}}</div>
</div>
</div>
</div>
</template>
</div>
</div>
<div class="box order-price">
<div class="title">订单金额</div>
<div class="flex item">
<div class="label">商品总价:</div>
<div class="value">¥{{price}}</div>
</div>
<div class="flex item">
<div class="label">运费:</div>
<div class="value">¥{{detail.expressFee}}</div>
</div>
<div class="total flex item">
<div class="label">订单金额:</div>
<div class="value">
<span class="unit">¥</span>{{total}}
</div>
</div>
</div>
<div
class="btn text-center"
@click="submit"
v-if="!hideBtn"
>确认核销</div>
</div>
</template>
<script type='text/ecmascript-6'>
import { shopmallApi } from '@/api'
export default {
name: '',
data () {
return {
flag: false,
hideBtn: false,
detail: {},
total: 0,
price: 0,
orderObj: [
{
label: '客户姓名',
key: 'customerName'
},
{
label: '下单日期',
format (item) {
return new Date(item.createdDate).format('yyyy.MM.dd hh:mm')
}
},
{
label: '订单编号',
key: 'orderCode'
},
{
label: '收货地址',
key: 'shipAddress'
},
{
label: '订单状态',
format (item) {
return {
1: '待付款',
2: '已支付',
3: '已关闭',
4: '已发货',
5: '已收货',
6: '待发货',
7: '待安装',
8: '已安装',
9: '售后中',
10: '售后完成'
}[item.orderStatus]
}
}
]
}
},
activated () {
let { verficationCode, orderCode } = this.getParams()
this.showLoading()
if (orderCode) this.getGoodsDetail(orderCode)
else shopmallApi
.getGoodsVerficationDetail(verficationCode)
.then(res => {
this.setData(res)
})
},
mounted () {
},
deactivated () {
Object.assign(this.$data, this.$options.data.call(this))
},
methods: {
setData (res) {
res.orderGoods.map(e => (this.price += e.activityPrice ? e.activityPrice : e.retailPrice))
this.detail = res
this.flag = true
this.total = this.price + res.expressFee
this.hideLoading()
},
getGoodsDetail (orderCode) {
shopmallApi.getGoodsDetail(orderCode).then(res => {
this.setData(res)
this.hideBtn = true
})
},
submit () {
let { verficationCode } = this.getParams()
this.showLoading()
shopmallApi
.verficationGoods(verficationCode)
.then(res => {
this.hideLoading()
if (res) {
this.$route.params.isGoods = true
this.showToast('已核销', () => {
this.$router.back()
})
}
})
}
}
}
</script>
<style scoped lang='scss'>
.layout {
padding: 0 16px 60px;
.box {
background: linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
border-radius: 4px;
padding: 12px;
margin-top: 10px;
font-size: 12px;
.title {
font-size: 16px;
font-weight: 500;
color: #282829;
margin-bottom: 12px;
}
.subtitle {
color: #2d2d2e;
margin-bottom: 16px;
}
.goods-box {
.item {
margin-bottom: 20px;
.icon {
width: 80px;
height: 80px;
margin-right: 10px;
}
.info {
width: calc(100% - 90px);
height: 80px;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
.name {
font-size: 15px;
font-weight: 500;
color: #333333;
}
.price {
font-size: 14px;
color: #3975c6;
width: 100%;
.num {
margin-left: auto;
color: #656566;
}
}
}
&:last-of-type {
margin-bottom: 0;
}
}
}
}
.order {
.item {
display: flex;
color: #282829;
line-height: 24px;
.label {
width: 70px;
flex-shrink: 0;
}
.value {
width: 246px;
color: #656566;
}
}
}
.order-price {
.item {
justify-content: space-between;
font-size: 12px;
color: #656566;
line-height: 30px;
.value {
font-weight: 600;
font-size: 14px;
color: #3975c6;
.unit {
font-size: 12px;
}
}
}
.total {
margin-bottom: 2px;
border-top: 1px solid #e3e3e6;
}
}
.btn {
position: fixed;
width: 343px;
left: 50%;
bottom: 16px;
transform: translateX(-50%);
height: 42px;
font-size: 14px;
border-radius: 21px;
box-sizing: border-box;
}
}
</style>