submitOrder.vue
7.21 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
<template>
<view class="container">
<Navbar title="提交工单" canBack></Navbar>
<view class="otherCardCss mr10">
<view class="basisCellCardCss usuallyCard">
<view class="text-lg">
{{ orderObj.fBxlx }}
</view>
<view class="flex justify-between w100 margin-top align-center">
<view class="text-grey">
报修单号:{{orderObj.fGdh || ''}}
</view>
</view>
<view class="flex justify-between w100 margin-top align-center">
<view class="text-grey">
联系人:{{orderObj.fXdxm || ""}}({{orderObj.fLxfs || '136****1234'}})
</view>
<view class="" @click="handlePhone">
<u-image src="/static/images/home/dianhua.png" width="18px" height="18px"></u-image>
</view>
</view>
<view class="flex justify-between w100 margin-top align-center">
<view class="text-grey w80 flex align-start">
<u-icon name="map-fill" color="#8799AC" class="" style="margin:3px 5px 0 0;"></u-icon>
<view class="">
{{orderObj.fLxdzsf || ""}} {{orderObj.fLxdzs || ""}} {{orderObj.fLxdzq || ""}}
{{orderObj.fLxdzjd || ''}} {{orderObj.fLxdzxxdz || ""}}
</view>
</view>
<view class="" @click="handleMap">
<u-image src="/static/images/home/daohang.png" width="18px" height="18px"></u-image>
</view>
</view>
</view>
</view>
<view class="otherCardCss mr10 resultSty">
<view class="basisCellCardCss usuallyCard" style="height: 100%">
<view class="text-lg">
维修结果<text class="text-gray">(必填)</text>
</view>
<view class="flex w100 flex-wrap margin-top-lg">
<view @click="resultTag=item.name"
:style="{ backgroundColor:resultTag==item.name?'#fdeee6':'',color:resultTag==item.name?'#ea5504':''}"
class="tagSty margin-bottom-sm margin-right-sm" v-for="(item,index) of resultList" :key="index">
{{item.name}}
</view>
</view>
<view class="descCss margin-top">
<u--textarea v-model="orderObj.desc" count maxlength="200" height="100"
placeholder="请按照一事一报原则上报问题,将问题情况和具体位置描述准确,更有利于解决。"></u--textarea>
</view>
<view class="uploadCss margin-top">
<view class="flex justify-start align-end">
<view class="">
<u-upload :fileList="fileList" uploadIcon="plus" @afterRead="afterRead" @delete="deletePic"
multiple :maxCount="5"></u-upload>
</view>
<view class="margin-left-sm text-gray text-lg">
{{ fileList.length }}/5
</view>
</view>
</view>
</view>
</view>
<view class="bomBtnCss flex justify-between">
<view class="w40" @click="handCancel">
<u-button>取 消</u-button>
</view>
<view class="w40" @click="handSubmit">
<u-button color="#EA5504">提 交</u-button>
</view>
</view>
</view>
</template>
<script>
export default {
name: "submitOrder",
data() {
return {
resultTag: '',
resultList: [{
name: '灶具、热水器故障,申请关单'
},
{
name: '表前阀漏气,已换阀处结'
},
{
name: '表接头漏气,已处结'
},
{
name: '表后阀漏气,已换阀处结'
},
{
name: '表后管接头漏气,已处结'
},
{
name: '表后波纹管接头漏气,已处结'
},
{
name: '表后波纹管漏气,换管,已处结'
},
{
name: '户外立管活接漏气,已处结'
},
{
name: '外挂表接头漏气,已处结'
},
{
name: '外挂表前阀漏气,已处结'
},
{
name: '外挂表后阀漏气,已处结'
},
],
orderObj: {
desc: '',
},
fileList: [],
type: ""
}
},
onLoad(options) {
if (options.orderParams) {
this.orderObj = JSON.parse(options.orderParams);
}
if (options.type) {
console.log("打开类型", options.type);
this.type = options.type
}
},
methods: {
handlePhone() {
// console.log('电话详情',JSON.parse(JSON.stringify(this.orderObj)));
uni.makePhoneCall({
phoneNumber: this.orderObj.fLxfs, // 电话号码
success: function() {
console.log('拨打电话成功!');
},
fail: function(err) {
console.log('拨打电话失败:' + JSON.stringify(err));
}
});
},
handleMap() {
console.log('地图详情', JSON.parse(JSON.stringify(this.orderObj)));
let jd = this.orderObj.fJd || "";
let wd = this.orderObj.fWd || "";
let ads = this.orderObj.adsName || ""
if (!jd || !wd) {
uni.$u.toast('无定位信息')
return
}
this.$viewMapLocation(jd, wd, ads);
},
handCancel() {
uni.navigateBack({
delta: 1
})
},
async handSubmit() {
if (!this.resultTag) {
uni.$u.toast('请选择维修结果');
return
}
let photoList = this.fileList.map(item => JSON.parse(item.fileObj));
let wttp = JSON.stringify(photoList);
let paramsData = {
wxjg: this.resultTag,
wxbz: this.orderObj.desc,
id: this.orderObj.id,
wxtp: wttp
}
console.log(paramsData);
let editResult;
if (this.type === 'wx') {
console.log("维修提交",paramsData);
editResult = await this.$api.repairOrderApi.createRepairOrder(paramsData);
} else if(this.type === 'aj') {
console.log("安检提交",paramsData);
editResult = await this.$api.repairOrderApi.submitRhaj(paramsData);
}
console.log('打印editResult', editResult);
if (editResult.code == 200) {
uni.navigateTo({
url: '/pages/home/appList/onSiteRepair/successSubmit'
})
this.$modal.msgSuccess('提交工单成功!');
} else {
this.$modal.msgError('提交工单失败!');
}
},
//删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
// 新增图片
async afterRead(event) {
console.log('打印event', event);
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
// 上传案例,根据这个来修改
let file = event.file;
let lists = [].concat(event.file);
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.$api.fileApi.uploadFile(file[i].url);
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: file[0].url,
fileObj: JSON.stringify(result)
}))
fileListLen++
}
console.log('打印this.fileList', this.fileList);
},
}
}
</script>
<style lang="scss" scoped>
.container {
position: relative;
padding-bottom: 50px;
}
.basisCellCardCss {
padding: 20px;
}
.mr10 {
margin: 10px;
}
.resultSty {
height: calc(100vh - 300px);
background-color: #ffffff;
overflow-y: auto;
}
.tagSty {
background-color: #f4f4f4;
padding: 10px;
border-radius: 50px;
color: #8B9197;
}
.descCss .u-textarea {
background: #F8F9FD;
border-radius: 15px;
}
.bomBtnCss {
width: calc(100% - 20px);
position: absolute;
bottom: 10px;
margin: 0 10px;
}
</style>