SignDialog.vue
8.57 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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<template>
<GLDialog v-if="dialogShow" bigTitle="确认签收" mode="big" :visible.sync="dialogShow" :close-on-click-modal="false" @onCancel="handleDetailClose" @onOk="save">
<div class="detail-info">
<div>
发货单号:
<span>{{ detailInfo.deliveryNumber }}</span>
</div>
<div>
承运公司:
<span>{{ detailInfo.deliveryCompany }}</span>
</div>
<div>
发货时间:
<span>{{ dayjs(detailInfo.deliveryDate).format('YYYY-MM-DD HH:mm:ss') }}</span>
</div>
</div>
<!-- <template v-for="(item, index) in detailInfo.deliveryDetailList"> -->
<div class="table-wrap">
<!-- <div class="detail-info">
<div>
商品名称:
<span>{{ detailInfo.upgradeGoodsName }} {{ detailInfo.specificationData }}</span>
</div>
<div>
发货数量:
<span>{{ membraneTypeList.includes(detailInfo.goodsType) ? `${detailInfo.purchaseNumber}卷` : `${detailInfo.purchaseNumber}件` }}</span>
</div>
<div>
可用库存数量:
<span>{{ detailInfo.stockNum }}{{ membraneTypeList.includes(detailInfo.goodsType) ? `米` : `件` }}</span>
</div>
</div> -->
<!-- <el-form ref="addForm" :model="detailInfo" size="small" v-if="detailInfo.deliveryCardList === null || detailInfo.deliveryCardList.length == 0"> -->
<el-form ref="addForm" :model="detailInfo" size="small">
<GLTable :tableData="detailInfo.deliveryDetailList" :noDataImg="url" :tableParams="tableParams" :hasPage="false">
<!-- <template slot="increaseStockNum" slot-scope="scope">
<span>{{ scope.scope.increaseStockNum || scope.scope.increaseStockNum == 0 ?
(membraneTypeList.includes(scope.scope.goodsType) ? parseFloat(scope.scope.increaseStockNum /
scope.scope.alternateUnits).toFixed(2) : parseFloat(scope.scope.increaseStockNum).toFixed(2)) +
(membraneTypeList.includes(scope.scope.goodsType) ? '卷' : '件') : '-' }}</span>
</template> -->
</GLTable>
</el-form>
<!-- <div v-else class="message">
已自动入库至商户的权益卡管理中,可前往“库存管理-权益卡管理”中查询
</div> -->
<div class="sign-box">
<div class="red-txt">*请在区域内签字完成</div>
<div class="background-text">签字区</div>
<div class="signature-container">
<VueSignaturePad width="100%" height="100%" ref="signaturePad" :options="options" />
</div>
<div class="btns">
<!-- <el-button type="text" size="mini" @click="save">保存</el-button> -->
<el-button type="text" size="mini" @click="clear">清除</el-button>
<el-button type="text" size="mini" @click="undo">撤销</el-button>
</div>
</div>
</div>
</GLDialog>
</template>
<script>
import * as dayjs from 'dayjs'
import { membraneTypeList } from '@/utils/constants.js'
export default {
name: 'DeliverAdd',
props: {
visible: {
type: Boolean,
default: false
},
info: {
type: Object,
default: () => { }
}
},
computed: {
dialogShow: {
get() {
if (this.visible) {
this.getDetail()
}
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
data() {
return {
options: {
penColor: '#000',
minWidth: 1,
maxWidth: 2,
dotSize: 1,
velocityFilterWeight: 0.7,
backgroundColor: 'rgba(255, 255, 255, 0.0)'
},
membraneTypeList: membraneTypeList,
dayjs: dayjs,
goodsList: [],
storeUsageList: [],
refByYqShopList: [],
tableParams: {
tableOption: false,
tableColumns: [
{
label: '商品名称',
prop: 'upgradeGoodsName'
},
{
label: '商品编号',
prop: 'type'
},
{
label: '发货数量',
prop: '',
formatter: cellValue => {
return membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.purchaseNumber}卷` : `${cellValue.purchaseNumber}件`
}
},
{
label: '可用库存数量',
prop: '',
formatter: cellValue => {
return cellValue.stockNum + (membraneTypeList.includes(cellValue.goodsType) ? '米' : '件')
}
}
// {
// label: '入库数量',
// prop: 'increaseStockNum',
// addHtml: 'increaseStockNum'
// },
// {
// label: '入库仓库',
// prop: 'yqMerchantName'
// },
// {
// label: '入库门店',
// prop: 'merchantName'
// }
]
},
tableData: [],
detailInfo: {}
}
},
created() { },
methods: {
undo() {
this.$refs.signaturePad.undoSignature()
},
clear() {
this.$refs.signaturePad.clearSignature()
},
save() {
// if (!this.$refs.signaturePad) {
// this.$message.warning('签名组件未加载')
// return
// }
const { isEmpty, data } = this.$refs.signaturePad.saveSignature()
if (isEmpty) {
this.$message({
message: '请先完成签名',
type: 'warning',
customClass: 'message-Z-zinde'
})
return
}
console.log(data, '保存图片----')
const base64 = 'png@' + data.split('base64,')[1]
this.loading = true
this.$apis.sysBase.uploadImg({ file: base64, fileType: 'image' }).then(res => {
console.log(res, 'res----')
this.deliverySign(res)
}).catch(() => {
this.loading = false
})
},
deliverySign(url) {
const params = {
id: this.info.orderDeliveryId,
signFileUrl: url
}
console.log(params, 'params----')
this.$apis.delivery.deliverySign(params)
.then(res => {
if (res.code == 0) {
this.$message({
message: '签收成功',
type: 'success',
customClass: 'message-Z-zinde'
})
this.$emit('handleConfirm')
} else {
this.$message({
type: 'error',
message: res.message,
customClass: 'message-Z-zinde'
})
}
})
.finally(() => {
this.loading = false
})
},
handleDetailClose() {
this.$emit('handleClose')
},
getDetail() {
this.$apis.delivery.deliverySignDetail({ id: this.info.orderDeliveryId }).then(res => {
const { data } = res
if (res.code == 0) {
this.detailInfo = data
}
})
}
}
}
</script>
<style lang="scss" scoped>
.detail-info {
display: flex;
align-items: center;
justify-content: space-between;
color: #666666ff;
font-size: 14px;
margin-bottom: 16px;
span {
color: #333333ff;
}
.add-btn {
font-size: 14px;
color: #5850ff;
cursor: pointer;
}
}
.table-wrap {
border: 1px solid #e5e5e5;
padding: 16px;
box-sizing: border-box;
margin-top: 16px;
::v-deep .el-form-item__error {
padding-top: 2px;
z-index: 9999999;
position: static;
}
.sign-box {
position: relative;
width: 640px;
height: 226px;
border-radius: 4px;
opacity: 1;
border: 1px solid #e5e5e5;
background: #fafafa;
margin: 24px auto 19px;
.signature-container {
position: relative;
width: 640px;
height: 226px;
}
.background-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
text-align: center;
color: #ededed;
font-size: 88px;
pointer-events: none;
letter-spacing: 32px;
}
::v-deep .vue-signature-pad {
position: relative;
z-index: 2;
}
.red-txt {
position: absolute;
top: 8px;
left: 262.5px;
text-align: center;
color: #eb4e4e;
font-size: 12px;
}
.btns {
position: absolute;
bottom: 8px;
right: 12px;
display: flex;
flex-direction: row-reverse;
.el-button--mini {
margin-left: 0px !important;
}
}
}
}
.look-card-wrap {
max-height: 600px;
overflow-y: scroll;
overflow-x: hidden;
::v-deep.el-table th.el-table__cell > .cell {
padding: 0 16px;
text-align: center;
}
::v-deep.el-table__body td.el-table__cell {
text-align: center;
}
}
</style>