informationEntry.vue
6.88 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
<!--
* @Description:
* @Author: huyue
* @Date: 2024-04-07 14:54:28
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-04-18 11:24:22
-->
<template>
<view class="information-entry">
<view class="information-tips"
>建议同步采集凭证,若接待工作繁忙可在提单环节再进行补充。</view
>
<view class="information-box">
<view
class="information-item"
v-for="(item, index) in infoList"
:key="item.title"
>
<view class="upload-img" v-if="item.imgUrl">
<image
class="img"
:src="item.imgUrl"
mode="aspectFill"
@click="preview(index)"
/>
<view class="upload-close" @click="close(index)"
><glsx-image src="detail/icon-close.png" mode="scaleToFill"
/></view>
<!-- <uni-icons
class="upload-close"
type="clear"
:size="20"
@click="close(index)"
></uni-icons> -->
</view>
<view v-else class="icon" @tap="choose(index)">
<view class="icon-upload sprite-icon icon-icon-upload"></view>
</view>
<view class="information-title">{{ item.title }} </view>
</view>
</view>
<view class="information-done" @click="done()">完成接待</view>
<!-- <uni-popup ref="preview" type="center" border-radius="10px 10px 0 0">
<image class="preview-img" :src="previewImg" mode="aspectFit" />
</uni-popup> -->
<MessageBox
ref="tipBox"
@cancel="tipCancel"
@confirm="tipConfirm"
content="系统检测到您在当前页面停留较久,是否仍在客户接待中?"
cancelBtnText="否"
confirmBtnText="是"
></MessageBox>
<finish-step ref="stepRef" @submit="submit" />
<update-box />
</view>
</template>
<script>
import upload from "@/utils/ossUploadFile/uploadFile.js";
import utils from "@/utils/utils";
const INFO_LIST = [
{
id: 1,
title: "客户付款凭证",
},
{
id: 2,
title: "客户购车发票",
},
{
id: 3,
title: "客户延保合同",
},
];
import myClick from "@/mixin/click";
import { mapMutations } from "vuex";
import FinishStep from "@/components/FinishStep.vue";
export default {
components: { FinishStep },
mixins: [myClick],
data() {
return {
infoList: INFO_LIST,
previewImg: "",
isPreview: false,
};
},
onLoad(options) {
const text = options.text;
uni.setNavigationBarTitle({
title: text,
});
},
onBackPress() {
this.infoList = this.infoList.map((item) => {
if (item.imgUrl) {
delete item.imgUrl;
}
return item;
});
},
methods: {
...mapMutations("audio", ["setBooks"]),
// 上传图
async choose(index) {
const result = await this.$permision.requestAndroidPermission(
"android.permission.CAMERA"
);
if (result !== 1) {
uni.showToast({
title: "为了访问您的相机和图库,请打开相机权限",
icon: "none",
});
return;
}
uni.chooseImage({
count: 1,
success: async (res) => {
// await upload(res.tempFilePath)
this.$set(
this.infoList[index],
"imgUrl",
await upload(res.tempFilePaths[0])
);
},
fail: (err) => {
console.log(err);
},
});
},
// 删除图
close(index) {
this.$set(this.infoList[index], "imgUrl");
},
// 完成接待按钮
done() {
this.$refs.stepRef.open();
},
submit() {
this.$refs.stepRef.close();
this.setBooks(utils.deepClone(this.infoList));
this.stopAudio();
this.infoList = INFO_LIST.map((item) => delete item.imgUrl);
setTimeout(() => {
uni.reLaunch({
url: "/pages/home/home",
});
}, 1500);
},
// 预览图片
preview(index) {
this.isPreview = true;
this.previewImg = this.infoList[index].imgUrl;
uni.previewImage({
urls: [this.infoList[index].imgUrl],
longPressActions: {
// itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
console.log(
"选中了第" +
(data.tapIndex + 1) +
"个按钮,第" +
(data.index + 1) +
"张图片"
);
},
fail: function (err) {
console.log(err.errMsg);
},
},
});
// this.$refs.preview.open("center");
},
},
};
</script>
<style lang="scss" scoped>
.information-entry {
position: relative;
background-color: #fff;
height: 100vh;
.information-tips {
background: rgba(44, 102, 247, 0.1);
color: #2c66f7;
padding: 32rpx 0 24rpx 80rpx;
font-size: 28rpx;
}
.information-box {
display: flex;
padding: 40rpx 80rpx;
.information-item {
display: flex;
flex-direction: column;
width: 264rpx;
margin-right: 48rpx;
.icon {
background-color: #f4f5f7;
border: 2rpx solid #eff0f2;
border-radius: 16rpx;
.icon-upload {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 128rpx;
height: 128rpx;
}
}
.icon,
.upload-img {
position: relative;
width: 264rpx;
height: 264rpx;
}
.upload-img {
.img {
border-radius: 16rpx;
width: 100%;
height: 100%;
}
.upload-close {
position: absolute;
right: 0;
top: 0;
width: 40rpx;
height: 40rpx;
// transform: translate(50%, -50%);
// text-align: center;
// font-size: 36rpx;
// line-height: 40rpx;
// display: flex;
// align-items: center;
// justify-content: center;
// background-color: #fff;
// border-radius: 50%;
// padding: 0;
}
}
.information-title {
margin-top: 24rpx;
font-weight: 500;
font-size: 28rpx;
color: #222222;
letter-spacing: 0;
line-height: 48rpx;
text-align: center;
}
}
}
}
.information-done {
position: absolute;
bottom: 30rpx;
left: 50%;
transform: translateX(-50%);
width: calc(100% - 240rpx);
height: 80rpx;
font-weight: 500;
font-size: 32rpx;
color: #ffffff;
text-align: center;
line-height: 80rpx;
background-color: #2c66f7;
border-radius: 40rpx;
}
.preview-img {
height: 1300rpx;
}
</style>