6ec243d6
wuxw
v1.9 点击提交后,成功提示没有...
|
1
|
<template>
|
72de60dc
wuxw
优化报修完成
|
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
|
<div class="finish-repair-container">
<el-card class="box-card">
<div slot="header" class="flex justify-between">
<span>{{ $t('finishRepair.title') }}</span>
</div>
<el-row :gutter="20">
<el-col :span="24">
<div class="form-wrapper">
<el-form label-width="120px">
<el-form-item :label="$t('finishRepair.materialUsage')" v-if="finishRepairInfo.repairObjType != '004'">
<el-select v-model="finishRepairInfo.maintenanceType"
:placeholder="$t('finishRepair.selectMaterialUsage')" style="width:100%">
<template v-for="(item, index) in finishRepairInfo.maintenanceTypes">
<el-option :key="index" :label="item.name" :value="item.statusCd"
v-if="item.statusCd != '1001' && item.statusCd != '1002'">
</el-option>
</template>
</el-select>
</el-form-item>
<el-form-item :label="$t('finishRepair.repairType')" v-if="finishRepairInfo.repairObjType == '004'">
<el-select v-model="finishRepairInfo.maintenanceType" :placeholder="$t('finishRepair.selectRepairType')"
style="width:100%">
<template v-for="(item, index) in finishRepairInfo.maintenanceTypes">
<el-option :key="index" :label="item.name" :value="item.statusCd"
v-if="item.statusCd != '1003' && item.statusCd != '1004'">
</el-option>
</template>
</el-select>
</el-form-item>
<el-form-item
v-if="finishRepairInfo.maintenanceType == '1001' || finishRepairInfo.maintenanceType == '1003'">
<el-button type="primary" @click="openChooseSingleResourceModel">
<i class="el-icon-plus"></i>{{ $t('finishRepair.selectGoods') }}
</el-button>
</el-form-item>
<!-- 商品列表展示 -->
<div
v-if="(finishRepairInfo.maintenanceType == '1001' || finishRepairInfo.maintenanceType == '1003') && finishRepairInfo.choosedGoodsList.length > 0">
<el-form-item :label="$t('finishRepair.usedGoods')">
<el-table :data="finishRepairInfo.choosedGoodsList" border>
|
0b10c798
wuxw
v1.9 优化报修相关bug
|
45
46
47
|
<el-table-column prop="rstName" :label="$t('finishRepair.category')" ></el-table-column>
<el-table-column prop="resName" :label="$t('finishRepair.goods')"></el-table-column>
<el-table-column prop="price" :label="$t('finishRepair.price')"
|
72de60dc
wuxw
优化报修完成
|
48
49
50
51
52
53
54
55
56
57
58
|
v-if="finishRepairInfo.maintenanceType == '1001'">
<template slot-scope="scope">
<el-input-number v-model="scope.row.price"
:disabled="!scope.row.isCustom && scope.row.outHighPrice == scope.row.outLowPrice"
@change="updateTotalPrice" :min="scope.row.outLowPrice" :max="scope.row.outHighPrice">
</el-input-number>
<span v-if="!scope.row.isCustom && scope.row.outHighPrice != scope.row.outLowPrice">
({{ scope.row.outLowPrice }} - {{ scope.row.outHighPrice }})
</span>
</template>
</el-table-column>
|
0b10c798
wuxw
v1.9 优化报修相关bug
|
59
|
<el-table-column :label="$t('finishRepair.quantity')" >
|
72de60dc
wuxw
优化报修完成
|
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
|
<template slot-scope="scope">
<el-input-number v-model="scope.row.useNumber" @change="updateTotalPrice" :min="1">
</el-input-number>
</template>
</el-table-column>
<el-table-column prop="miniUnitCodeName" :label="$t('finishRepair.unit')"
width="80"></el-table-column>
<el-table-column prop="specName" :label="$t('finishRepair.spec')" width="80"></el-table-column>
<el-table-column :label="$t('finishRepair.operation')" width="120">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="removeChoosedGoodsItem(scope.$index)">
<i class="el-icon-delete"></i>{{ $t('common.remove') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
</div>
<el-form-item :label="$t('finishRepair.totalAmount')" v-if="finishRepairInfo.maintenanceType == '1001'">
<el-input v-model="finishRepairInfo.totalPrice" disabled></el-input>
</el-form-item>
<el-form-item :label="$t('finishRepair.paymentMethod')" v-if="finishRepairInfo.maintenanceType == '1001'">
<el-select v-model="finishRepairInfo.payType" :placeholder="$t('finishRepair.selectPaymentMethod')"
style="width:100%">
<el-option v-for="(item, index) in finishRepairInfo.payTypes" :key="index" :label="item.name"
:value="item.statusCd">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('finishRepair.suggestion')">
<el-input type="textarea" :rows="4" :placeholder="$t('finishRepair.inputSuggestion')"
v-model="finishRepairInfo.context">
</el-input>
</el-form-item>
<el-form-item :label="$t('finishRepair.beforeRepairPhoto')">
<upload-image-url ref="beforeRepairUpload" @notifyUploadCoverImage="handleBeforeRepairImage">
</upload-image-url>
</el-form-item>
<el-form-item :label="$t('finishRepair.afterRepairPhoto')">
<upload-image-url ref="afterRepairUpload" @notifyUploadCoverImage="handleAfterRepairImage">
</upload-image-url>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitFinishRepair">{{ $t('common.submit') }}</el-button>
<el-button @click="backToList">{{ $t('common.back') }}</el-button>
</el-form-item>
</el-form>
</div>
</el-col>
</el-row>
</el-card>
|
0b10c798
wuxw
v1.9 优化报修相关bug
|
118
|
<choose-single-resource ref="chooseSingleResource" @choose-single-resource="chooseSingleResource"></choose-single-resource>
|
72de60dc
wuxw
优化报修完成
|
119
120
121
122
123
124
125
|
</div>
</template>
<script>
import { getDict } from '@/api/community/communityApi'
import { getCommunityId } from '@/api/community/communityApi'
import { repairFinish } from '@/api/work/finishRepairApi'
|
0b10c798
wuxw
v1.9 优化报修相关bug
|
126
|
import {getUserName} from '@/api/user/userApi'
|
72de60dc
wuxw
优化报修完成
|
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
|
import UploadImageUrl from '@/components/upload/UploadImageUrl'
import ChooseSingleResource from '@/components/work/chooseSingleResource'
export default {
name: 'FinishRepairList',
components: {
UploadImageUrl,
ChooseSingleResource
},
data() {
return {
finishRepairInfo: {
repairId: '',
repairType: '',
context: '',
feeFlag: '200',
repairObjType: '',
publicArea: '',
repairChannel: '',
maintenanceTypes: [],
maintenanceType: '',
totalPrice: 0,
choosedGoodsList: [],
beforeRepairPhotos: [],
afterRepairPhotos: [],
payTypes: [],
payType: ''
},
communityId: ''
}
},
created() {
this.communityId = getCommunityId()
this.initData()
},
methods: {
|
0b10c798
wuxw
v1.9 优化报修相关bug
|
163
164
165
166
|
chooseSingleResource(goods) {
this.finishRepairInfo.choosedGoodsList.push(goods)
this.updateTotalPrice()
},
|
72de60dc
wuxw
优化报修完成
|
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
|
async initData() {
this.finishRepairInfo.repairType = this.$route.query.repairType
this.finishRepairInfo.repairId = this.$route.query.repairId
this.finishRepairInfo.repairObjType = this.$route.query.repairObjType
this.finishRepairInfo.publicArea = this.$route.query.publicArea
this.finishRepairInfo.repairChannel = this.$route.query.repairChannel
try {
const maintenanceTypes = await getDict('r_repair_pool', 'maintenance_type')
this.finishRepairInfo.maintenanceTypes = maintenanceTypes
const payTypes = await getDict('r_repair_pool', 'pay_type')
this.finishRepairInfo.payTypes = payTypes
} catch (error) {
console.error('获取字典数据失败:', error)
}
},
openChooseSingleResourceModel() {
this.$refs.chooseSingleResource.open({
maintenanceType: this.finishRepairInfo.maintenanceType
})
},
handleBeforeRepairImage(photos) {
this.finishRepairInfo.beforeRepairPhotos = photos.map(item => ({
photo: item
}))
},
handleAfterRepairImage(photos) {
this.finishRepairInfo.afterRepairPhotos = photos.map(item => ({
photo: item
}))
},
removeChoosedGoodsItem(index) {
this.finishRepairInfo.choosedGoodsList.splice(index, 1)
this.updateTotalPrice()
},
updateTotalPrice() {
let totalPrice = 0
this.finishRepairInfo.choosedGoodsList.forEach(item => {
totalPrice += item.price * item.useNumber
})
this.finishRepairInfo.totalPrice = totalPrice.toFixed(2)
},
validateForm() {
if (!this.finishRepairInfo.repairId) {
this.$message.error(this.$t('finishRepair.validate.repairIdRequired'))
return false
}
if (!this.finishRepairInfo.maintenanceType) {
this.$message.error(this.$t('finishRepair.validate.maintenanceTypeRequired'))
return false
}
if (!this.finishRepairInfo.context) {
this.$message.error(this.$t('finishRepair.validate.contextRequired'))
return false
}
if (this.finishRepairInfo.beforeRepairPhotos.length === 0) {
this.$message.error(this.$t('finishRepair.validate.beforePhotoRequired'))
return false
}
if (this.finishRepairInfo.afterRepairPhotos.length === 0) {
this.$message.error(this.$t('finishRepair.validate.afterPhotoRequired'))
return false
}
if ((this.finishRepairInfo.maintenanceType === '1001' || this.finishRepairInfo.maintenanceType === '1003') &&
this.finishRepairInfo.choosedGoodsList.length === 0) {
this.$message.error(this.$t('finishRepair.validate.goodsRequired'))
return false
}
if (this.finishRepairInfo.maintenanceType === '1001' && !this.finishRepairInfo.payType) {
this.$message.error(this.$t('finishRepair.validate.paymentMethodRequired'))
return false
}
return true
},
async submitFinishRepair() {
if (!this.validateForm()) return
try {
const params = {
...this.finishRepairInfo,
|
0b10c798
wuxw
v1.9 优化报修相关bug
|
248
249
|
communityId: this.communityId,
userName:getUserName()
|
72de60dc
wuxw
优化报修完成
|
250
251
252
|
}
const res = await repairFinish(params)
if (res.code === 0) {
|
6ec243d6
wuxw
v1.9 点击提交后,成功提示没有...
|
253
|
this.$message.success(this.$t('common.operationSuccess'))
|
72de60dc
wuxw
优化报修完成
|
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
|
this.backToList()
} else {
this.$message.error(res.msg)
}
} catch (error) {
this.$message.error(this.$t('finishRepair.submitError'))
}
},
backToList() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.finish-repair-container {
padding: 20px;
}
.box-card {
margin-bottom: 20px;
}
.form-wrapper {
padding: 20px;
}
</style>
|