SignName.vue
7.48 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
<template>
<view class="order">
<view :class="['order-box']">
<view class="common-title">客户签字</view>
<view class="box">
<scroll-view class="scroll-view" scroll-y="true">
<view class="box-content">
<view class="box-shell pt-32">
<view class="descTextTitle">尊敬的客户,您好!</view>
<view class="h3 descText">本人自愿在门店购买保险。门店已就新车投保项目及服务进行了说明,本人完全理解相关项目的服务流程及细则。</view>
</view>
<view class="box-shell">
<view class="tips descText">请在确认以上信息后,在下方的签字区内签字确认,感谢您的配合!</view>
<view class="title descTextTitle">签字处</view>
<view class="sign-box">
<l-signature disableScroll ref="signatureRef" :penColor="penColor" :penSize="penSize" :openSmooth="openSmooth" @touchstart="onSignatureTouch"></l-signature>
<view v-if="showPlaceHoder" class="placehoder">签字区</view>
<!-- <view @click="fullScreen" class="full_icon flex_scb sprite-icon icon-fullScreen">
</view> -->
<view @click.stop="onClick('clear')" class="delete_icon flex_scb sprite-icon icon-sign_del"></view>
</view>
</view>
</view>
</scroll-view>
<view class="btns flex">
<view class="btn save" @click="back">稍后处理</view>
<view @click="submit" class="btn">已完成</view>
</view>
</view>
</view>
<NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
</view>
</template>
<script>
import utils from '@/utils/utils'
import { UpdateOrderInfo, popupTypeEnum, payTypeList, titleList } from '../contant'
import NoticePopup from '@/components/NoticePopup.vue'
import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import { interceptionMixin } from '@/mixin/index'
export default {
name: 'SignName',
mixins: [interceptionMixin],
components: {
NoticePopup
},
props: {
transmissionOfData: {
type: Object,
default: () => null
}
},
data() {
return {
showUpload: false,
showTips: true,
titleList,
formList: utils.deepClone(UpdateOrderInfo),
valueKey: '',
externalData: [],
popupType: 0,
baseConfigData: {},
landscape: false,
requiredList: [], // 录单设置的必填项
orderObj: {
owner: '',
phone: '',
salesType: '0',
carVin: '',
certificateNo: '',
notes: ''
},
title: 'Hello',
penColor: 'red',
penSize: 5,
url: '',
openSmooth: false,
showPlaceHoder: true
}
},
computed: {
userInfo() {
return uni.$storage.get('userInfo') || {}
}
},
watch: {
transmissionOfData: {
handler(newVal, oldVal) {
if (newVal) {
console.log(newVal, 'newVal')
} else {
console.log(oldVal, 'oldVal')
}
}
}
},
mounted() {
this.initData()
},
methods: {
initData() {
console.log('initData', this.transmissionOfData)
},
// 提交
async submit() {
if (await this.checkDailyReport()) return
this.$refs.signatureRef.canvasToTempFilePath({
success: async res => {
// 是否为空画板 无签名
console.log(res.isEmpty)
// 生成图片的临时路径
// H5 生成的是base64
uni.showLoading({
title: '上传中...',
mask: true
})
console.log(res, 'res')
let url = await uploadFile(res.tempFilePath)
uni.hideLoading()
let params = {
orderId: this.transmissionOfData.paramsData.orderId,
customerNameUrl: url
}
console.log(params, 'params')
uni.showLoading({
title: '提交中...',
mask: true
})
uni.$api.equityApi
.updateCustomerNameUrlAPI(params)
.then(result => {
uni.hideLoading()
console.log(result)
setTimeout(() => {
this.$emit('jump', 'EquityManagement', {})
}, 500)
})
.catch(err => {
uni.hideLoading()
})
},
fail: err => {
uni.hideLoading()
}
})
},
back() {
// 配置弹窗按钮
this.$refs.notice.buttonsList = [
{
text: '确认退出',
type: 'default',
callback: () => {
this.transmissionOfData = null
this.$refs.notice.close()
this.$emit('jump', 'EquityManagement', {})
}
},
{
text: '继续编辑',
type: 'primary',
callback: () => {
this.$refs.notice.close()
}
}
]
// 打开弹窗
this.$refs.notice.open()
},
onClick(type) {
if (type == 'openSmooth') {
this.openSmooth = !this.openSmooth
return
}
if (this.$refs.signatureRef) this.$refs.signatureRef[type]()
},
fullScreen() {
this.landscape = !this.landscape
},
onSignatureTouch(val) {
console.log(val, 'val')
// this.showPlaceHoder = val
// this.$refs.signatureRef.isEmpty
}
}
}
</script>
<style scoped lang="scss">
.order {
height: 100%;
position: relative;
&-box {
visibility: visible;
height: 100%;
}
.hide {
opacity: 0;
visibility: hidden;
}
.upload-box {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
}
.box {
height: calc(100% - #{toRpx(120)});
.scroll-view {
// height: calc(100% - #{toRpx(148)});
}
}
.box-content {
padding: 0 toRpx(48);
}
.box-shell {
width: 100%;
border-radius: toRpx(16);
background: #ffffff;
padding: toRpx(32);
margin-top: toRpx(16);
}
.btns {
position: absolute;
bottom: 0;
width: 100%;
left: 0;
padding: 24rpx 128rpx;
gap: 32rpx;
.save {
background: #3b73ff1a;
color: #4673ff;
font-size: 28rpx;
font-weight: 500;
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
width: toRpx(1130);
height: toRpx(80);
color: #fff;
border-radius: toRpx(48);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
.h3 {
text-indent: 2em;
}
.descTextTitle {
font-weight: 500;
font-size: toRpx(34);
color: #333333;
line-height: toRpx(48);
margin-bottom: toRpx(20);
}
.descText {
font-size: toRpx(28);
color: #333333;
}
.title {
margin-top: toRpx(32);
margin-bottom: toRpx(24);
}
.sign-box {
position: relative;
width: 100%;
height: toRpx(600);
border-radius: toRpx(12);
background: #f4f5f7;
// 全屏样式
&.landscape {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
border-radius: 0;
z-index: 999999;
background: #f4f5f7;
}
}
.full_icon {
position: absolute;
right: toRpx(26);
// top: var(--fontSize16);
top: toRpx(26);
z-index: 10000;
transition: all 0.3s ease;
}
.delete_icon {
position: absolute;
right: toRpx(26);
// top: var(--fontSize16);
bottom: toRpx(26);
z-index: 10000;
}
.placehoder {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-size: toRpx(32);
font-weight: 500;
color: #dfdfdf;
}
</style>