telephone-clients 4.0.0-1-46 → 4.0.0-1-48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,497 +1,497 @@
1
- <template>
2
- <work-busy :is-busy="button_state"></work-busy>
3
- <div v-for="(i, item) in material " class="y-form">
4
- <div class="y-form-head">
5
- <span style="text-align: center">材料{{ $index + 1 }}信息</span>
6
- <button
7
- style="float: right"
8
- class="button_delete button_spacing"
9
- v-if="i>0"
10
- @click.prevent="deleteUserFile(i)"
11
- >删除
12
- </button>
13
- </div>
14
-
15
- <div class="y-form-item">
16
- <label>材料名称</label>
17
- <input-select
18
- class="select select_list y-form-item-input"
19
- :value.sync="item.f_typename"
20
- v-model="item.f_typename"
21
- :options="category.options"
22
- @change="item.f_typenumber = undefined"
23
- :valueSingle="true">
24
- </input-select>
25
- </div>
26
-
27
- <div class="y-form-item">
28
- <label>材料型号</label>
29
- <input-select
30
- class="select select_list y-form-item-input"
31
- :value.sync="item.f_typenumber"
32
- v-model="item.f_typenumber"
33
- :options="category.children[item.f_typename].options"
34
- :valueSingle="true">
35
- </input-select>
36
- </div>
37
- <div class="y-form-item">
38
- <label>单价(元/{{
39
- category.children[item.f_typename].children[item.f_typenumber].unit
40
- }})</label>
41
- <input type="number" class="form-control y-form-item-input" v-model="item.f_material_price"
42
- :value="category.children[item.f_typename].children[item.f_typenumber].f_material_price"
43
- readonly>
44
- </div>
45
- <div class="y-form-item">
46
- <label>数量</label>
47
- <input type="number" class="form-control y-form-item-input" v-model="item.f_material_number">
48
- </div>
49
- <div class="y-form-item">
50
- <label>金额</label>
51
- <input type="number" class="form-control y-form-item-input" v-model="item.f_fee"
52
- :value="smallnum(item.f_material_price,item.f_material_number)" readonly>
53
- </div>
54
- <div class="y-form-item">
55
- <label>备注</label>
56
- <textarea type="text" rows="2" class="form-control y-form-item-input" v-model="item.f_remarks"></textarea>
57
- </div>
58
- </div>
59
- <div style="padding: 10px;display: flex;justify-content: space-around;">
60
- <button type="button" class="btn btn-primary" @click="addUserFile">添加</button>
61
- <button type="button" class="btn btn-primary" @click="saveMaterial" v-if="baocun == 'true'">保存</button>
62
- <button type="button" class="btn btn-primary" @click="showCharge()" v-if="shoufei == 'true'">收费</button>
63
- </div>
64
- <div v-show="showQrCode">
65
- <div class="row">
66
- <label class="text-justify lb-left" style="width: 100px">收款</label>
67
- <div class="row row_sty">
68
- <label class="lab_sty col-xs-4">合计金额</label>
69
- <div class="col-xs-8">
70
- <input type="number" class="form-control" v-model="payNumber" :value.sync="payNumber" readonly>
71
- </div>
72
- </div>
73
- <div class="row row_sty">
74
- <label class="lab_sty col-xs-4">收款方式</label>
75
- <div class="col-xs-8">
76
- <v-select
77
- :width="'100%'"
78
- :value.sync="payType"
79
- v-model="payType"
80
- :options='payTypes'
81
- placeholder='请选择'
82
- close-on-select
83
- :value-single="true"
84
- ></v-select>
85
- </div>
86
- </div>
87
- <div v-if="zfCode" style="margin-top: 20px; text-align: center;">
88
- <div id="qrcode" style="margin-top: 25px;width: 266px;height: 266px"></div>
89
- </div>
90
- </div>
91
- <div style="padding: 10px;display: flex;justify-content: space-around;">
92
- <button type="button" name="button" class="btn btn-primary btn-sm" style="float: right;margin-right:10px;"
93
- @click="beforeSaveCharge()">确认收费
94
- </button>
95
- <button type="button" class="btn btn-primary" @click="cancel">取消</button>
96
- </div>
97
- </div>
98
- </template>
99
- <script>
100
- import Vue from 'vue'
101
- import {HttpResetClass} from 'vue-client'
102
- import QRCode from 'qrcodejs2'
103
- import {getNowDate, isEmpty} from '../../components/Util'
104
-
105
- export default {
106
- title: '材料添加',
107
- props: {
108
- selectdata: {
109
- type: Object
110
- }
111
- },
112
- data() {
113
- return {
114
- baocun: this.$appdata.getSingleValue('材料收费保存'),
115
- shoufei: this.$appdata.getSingleValue('材料收费收费'),
116
- othercharge_id: '',
117
- payState: false,
118
- zfCode: false,
119
- f_out_trade_no: '',
120
- payTypes: this.$appdata.getParam('材料收费方式'),
121
- payType: '',
122
- payNumber: 0,
123
- button_state: false,
124
- category: {},
125
- showFile: false,
126
- material: [],
127
- positions: this.$appdata.getParam('品名及规格'), // 获取材料名称
128
- charge: {
129
- payment_terms: [{f_payment_term: '', f_charge_money: '', f_amount_words: '', f_payment_method: ''}]
130
- }, // 收费内容
131
- timeLeft: 300, // 收费时间
132
- title1: '', // 二维码标题
133
- showQrCode: false, // 二维码显示
134
- order: {}, // 订单信息
135
- f_cost_sum: 0, // 总收费
136
- }
137
- },
138
- ready () {
139
- this.loadOptions()
140
- },
141
- methods: {
142
- cancel () {
143
- this.payNumber = 0
144
- this.othercharge_id = ''
145
- this.payState = false
146
- this.zfCode = false
147
- this.showQrCode = false
148
- this.payType = ''
149
- clearTimeout(this.orderInterval)
150
- },
151
- getChangePayNumber () {
152
- this.payNumber = 0
153
- for (let i = 0; i < this.material.length; i++) {
154
- this.material[i].f_fee = this.material[i].f_material_price * this.material[i].f_material_number
155
- this.payNumber += Number(this.material[i].f_fee)
156
- }
157
- },
158
- // 显示收费界面
159
- async showCharge () {
160
- if (this.material.length == 0) {
161
- return this.$showMessage(`请先添加消耗的材料!`)
162
- }
163
- // 验证材料信息是否完整
164
- for (let index = 0; index < this.material.length; index++) {
165
- const item = this.material[index]
166
- if (!item.f_typename) {
167
- this.$showMessage(`请选择材料${index + 1}的材料名称`)
168
- return;
169
- }
170
- if (!item.f_typenumber) {
171
- this.$showMessage(`请选择材料${index + 1}的材料型号`)
172
- return;
173
- }
174
- if (!item.f_material_price) {
175
- this.$showMessage(`请填写材料${index + 1}的单价`)
176
- return;
177
- }
178
- if (!item.f_material_number || item.f_material_number == 0) {
179
- this.$showMessage(`请填写材料${index + 1}的数量`)
180
- return;
181
- }
182
- }
183
- await this.getChangePayNumber()
184
- this.showQrCode = true
185
- },
186
- // 保存材料信息
187
- async saveMaterial () {
188
- if (this.material.length == 0) {
189
- return this.$showMessage(`请先添加消耗的材料!`)
190
- }
191
- for (let index = 0; index < this.material.length; index++) {
192
- const item = this.material[index]
193
- if (!item.f_typename) {
194
- this.$showMessage(`请选择材料${index + 1}的材料名称`)
195
- return;
196
- }
197
- if (!item.f_typenumber) {
198
- this.$showMessage(`请选择材料${index + 1}的材料型号`)
199
- return;
200
- }
201
- if (!item.f_material_price) {
202
- this.$showMessage(`请填写材料${index + 1}的单价`)
203
- return;
204
- }
205
- if (!item.f_material_number || item.f_material_number == 0) {
206
- this.$showMessage(`请填写材料${index + 1}的数量`)
207
- return;
208
- }
209
- }
210
- await this.saveUserFile('save')
211
- this.$showMessage('材料保存成功!!!')
212
- },
213
- async beforeSaveCharge () {
214
- if (!this.payType) {
215
- this.$showMessage(`请选择缴费方式`)
216
- return;
217
- }
218
- if (this.payType.includes('二维码') && this.payNumber > 0) {
219
- await this.openQrcode()
220
- } else {
221
- this.payState = true
222
- await this.saveUserFile('save')
223
- this.$showMessage('收费成功!!!')
224
- this.cancel()
225
- this.$emit('close')
226
- }
227
- },
228
- loadOptions () {
229
- const data = {
230
- tablename: 't_material_management',
231
- condition: `1=1`
232
- }
233
- this.$resetpost(this.$androidUtil.getProxyUrl() + '/af-telephone/rs/sql/tel_singleTable', {data}, {
234
- resolveMsg: null,
235
- rejectMsg: '获取数据失败'
236
- }).then((res) => {
237
- const categories = []
238
- const types = []
239
- for (let material of res.data) {
240
- if (material.f_material_stype == '分类') {
241
- categories.push(material)
242
- } else if (material.f_material_stype == '型号') {
243
- types.push(material)
244
- }
245
- }
246
- this.category.options = []
247
- for (let category of categories) {
248
- this.category.options.push({
249
- label: category.f_material_name,
250
- value: category.f_material_name
251
- })
252
- }
253
-
254
- this.category.children = {}
255
- for (let category of categories) {
256
- this.category.children[category.f_material_name] = {
257
- options: [],
258
- children: {}
259
- }
260
-
261
- for (let type of types) {
262
- if (type.parent_id == category.id) {
263
- this.category.children[category.f_material_name].options.push({
264
- label: type.f_material_name,
265
- value: type.f_material_name
266
- })
267
- this.category.children[category.f_material_name].children[type.f_material_name] = type
268
- }
269
- }
270
- }
271
- console.log('this.category=', JSON.stringify(this.category))
272
- })
273
- },
274
- // 删除未保存的材料信息
275
- async deleteUserFile (index) {
276
- this.material.splice(index, 1)
277
- },
278
- // 追加材料信息
279
- addUserFile () {
280
- this.material.push({})
281
- },
282
- // 金额计算
283
- smallnum (val, val1) {
284
- let num = Number(val) * Number(val1)
285
- return num
286
- },
287
- qrcode (url) {
288
- new QRCode('qrcode', {
289
- text: url, // 设置二维码内容或跳转地址
290
- width: 266, // 设置宽度,单位像素
291
- height: 266, // 设置高度,单位像素
292
- correctLevel: QRCode.CorrectLevel.L //容错率,L/M/Hs
293
- })
294
- },
295
- clearQrCode () {
296
- if (document.getElementById('qrcode')) {
297
- document.getElementById('qrcode').innerHTML = ''
298
- }
299
- },
300
- async getOrderInformation () {
301
- // 查询订单信息
302
- console.log('查询订单信息!!!')
303
- let http = new HttpResetClass()
304
- let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/wx/rs/weixin/orderStatus`, {
305
- "f_filiale": "wensuxilong",
306
- "out_trade_no": `${this.f_out_trade_no}`
307
- }, {
308
- resolveMsg: null,
309
- rejectMsg: '订单查询失败!!!'
310
- })
311
- // 支付成功
312
- if (res.data.trade_state_desc.includes('成功')) {
313
- this.$showMessage('支付成功!!!')
314
- await this.saveUserFile('save')
315
- this.clearQrCode()
316
- this.cancel()
317
- this.$emit('close')
318
- }
319
- },
320
- async openQrcode () {
321
- this.clearQrCode()
322
- let data = {
323
- tablename: 't_userfiles',
324
- condition: `f_userinfo_id = '${this.selectdata.model.f_userinfo_id}'`
325
- }
326
- let res = await new HttpResetClass().load('post', this.$androidUtil.getProxyUrl() + '/af-telephone/rs/sql/tel_singleTable', {data: data}, {
327
- resolveMsg: null,
328
- rejectMsg: '获取数据失败'
329
- })
330
- let reqdata = {
331
- "filiale": "wensuxilong",
332
- "money": 1,
333
- "str": "材料收费",
334
- "attach": {
335
- "f_userfiles_id": res.data[0].f_userfiles_id,
336
- "f_userinfo_id": this.selectdata.model.f_userinfo_id
337
- }
338
- }
339
- new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/wx/rs/weixin/gasgetcode`, reqdata).then(res => {
340
- if (res.data.code === 200) {
341
- this.f_out_trade_no = res.data.out_trade_no
342
- this.zfCode = true
343
- this.$nextTick(() => {
344
- this.qrcode(res.data.url)
345
- })
346
- this.orderInterval = setInterval(() => {
347
- this.getOrderInformation()
348
- }, 3000)
349
- } else {
350
- this.$showMessage('网络异常。。。')
351
- }
352
- })
353
- },
354
- async saveUserFile (type) {
355
- for (let i = 0; i < this.material.length; i++) {
356
- this.material[i].f_process_id = this.selectdata.f_process_id
357
- this.material[i].f_material_name = this.material[i].f_typename
358
- this.material[i].f_department = Vue.user.f_department_name
359
- this.material[i].f_operator = Vue.user.name
360
- this.material[i].f_filiale = Vue.user.orgid
361
- this.material[i].f_fee = this.material[i].f_material_price * this.material[i].f_material_number
362
- if (isEmpty(this.material[i].f_state)) {
363
- this.material[i].f_state = null
364
- }
365
- }
366
- await this.saveOrder(type)
367
- },
368
- async saveOrder (type) {
369
- console.log('this.material', this.material)
370
- let otherdetail = []
371
- if (this.payNumber == 0) {
372
- otherdetail.push({
373
- f_brand_spec: ['维修'],
374
- f_typename: ['材料费'],
375
- f_typenumber: [],
376
- f_unitprice: 0,
377
- f_number: this.material.length
378
- })
379
- } else {
380
- this.material.forEach((row) => {
381
- otherdetail.push({
382
- f_brand_spec: ['维修'],
383
- f_typename: [`${row.material_type ? row.material_type : '材料费'}`],
384
- f_typenumber: [],
385
- f_unitprice: row.f_material_price,
386
- f_number: row.f_material_number
387
- })
388
- })
389
- }
390
- let param = {
391
- model: this.material,
392
- operator_type: type,
393
- othercharge_id: this.othercharge_id,
394
- f_process_id: this.selectdata.f_process_id,
395
- f_userinfo_id: this.selectdata.model.f_userinfo_id,
396
- other: {
397
- "record_userinfo": this.selectdata.model.f_userinfo_id,
398
- "f_user_name": this.selectdata.model.f_user_name,
399
- "f_address": this.selectdata.model.f_address,
400
- "f_user_type": this.selectdata.model.f_user_type,
401
- "f_gasproperties": "",
402
- "f_collection": this.payNumber,
403
- "f_comments": `${Vue.user.name}进行维修材料收费,收费方式-${this.payType} ${this.order && this.order.f_out_trade_no ? '。支付订单号:' + this.order.f_out_trade_no : ''}`,
404
- "f_payment": this.payType,
405
- "f_voucher_number": this.selectdata.f_process_id,
406
- "f_bill_style": "普通收据",
407
- "f_userinfo_id": this.selectdata.model.f_userinfo_id,
408
- "f_service_person": Vue.user.name,
409
- "f_operat_type": "维修收费",
410
- "f_describe": "",
411
- "f_serial_id": this.order ? this.order.f_out_trade_no : null,
412
- "f_state": '有效',
413
- "f_operator": Vue.user.name,
414
- "f_operatorid": Vue.user.id,
415
- "f_orgid": Vue.user.orgid,
416
- "f_orgname": Vue.user.orgs,
417
- "f_depid": Vue.user.depids,
418
- "f_depname": Vue.user.f_department_name,
419
- "t_userfees": "",
420
- "f_fee_type": "维修费用",
421
- "f_fee_time": "12",
422
- "otherdetail": otherdetail
423
- }
424
-
425
- }
426
- console.log("材料收费保存", param)
427
- let res = await new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/saveMaterialService`, param, {
428
- resolveMsg: null,
429
- rejectMsg: null
430
- })
431
- if (res.data.code == 200) {
432
- if (type !== 'create') {
433
- this.$showMessage('材料保存成功!!!')
434
- }
435
- } else {
436
- this.$showMessage(res.data.msg)
437
- }
438
- },
439
- },
440
- computed: {
441
- paymentMethod () {
442
- return this.$appdata.getParam("付款方式")
443
- },
444
- paymentTerm () {
445
- return this.$appdata.getParam("收费项目")
446
- }
447
- }
448
- }
449
- </script>
450
- <style lang="less" scoped>
451
- .head-but {
452
- margin-left: 5px;
453
- height: 34px;
454
- /*background-color: #6aa6e2;*/
455
- border-radius: 4px;
456
- font-family: PingFang;
457
- color: #ffffff;
458
- }
459
-
460
- /*清除model中的浮动*/
461
- .clearfix:after, .clearfix:before {
462
- display: table;
463
- }
464
-
465
- .clearfix:after {
466
- clear: both;
467
- }
468
-
469
- .y-form {
470
- display: flex;
471
- flex-flow: column;
472
- gap: 10px;
473
- padding: 10px 5px;
474
-
475
- .y-form-head {
476
- background-color: #e8f4ff;
477
- display: flex;
478
- padding: 10px 20px;
479
- align-items: center;
480
- justify-content: space-between;
481
- }
482
-
483
- .y-form-item {
484
- display: flex;
485
- gap: 10px;
486
-
487
- label {
488
- width: 30%;
489
- text-align: right;
490
- }
491
-
492
- .y-form-item-input {
493
- width: 70%;
494
- }
495
- }
496
- }
497
- </style>
1
+ <template>
2
+ <work-busy :is-busy="button_state"></work-busy>
3
+ <div v-for="(i, item) in material " class="y-form">
4
+ <div class="y-form-head">
5
+ <span style="text-align: center">材料{{ $index + 1 }}信息</span>
6
+ <button
7
+ style="float: right"
8
+ class="button_delete button_spacing"
9
+ v-if="i>0"
10
+ @click.prevent="deleteUserFile(i)"
11
+ >删除
12
+ </button>
13
+ </div>
14
+
15
+ <div class="y-form-item">
16
+ <label>材料名称</label>
17
+ <input-select
18
+ class="select select_list y-form-item-input"
19
+ :value.sync="item.f_typename"
20
+ v-model="item.f_typename"
21
+ :options="category.options"
22
+ @change="item.f_typenumber = undefined"
23
+ :valueSingle="true">
24
+ </input-select>
25
+ </div>
26
+
27
+ <div class="y-form-item">
28
+ <label>材料型号</label>
29
+ <input-select
30
+ class="select select_list y-form-item-input"
31
+ :value.sync="item.f_typenumber"
32
+ v-model="item.f_typenumber"
33
+ :options="category.children[item.f_typename].options"
34
+ :valueSingle="true">
35
+ </input-select>
36
+ </div>
37
+ <div class="y-form-item">
38
+ <label>单价(元/{{
39
+ category.children[item.f_typename].children[item.f_typenumber].unit
40
+ }})</label>
41
+ <input type="number" class="form-control y-form-item-input" v-model="item.f_material_price"
42
+ :value="category.children[item.f_typename].children[item.f_typenumber].f_material_price"
43
+ readonly>
44
+ </div>
45
+ <div class="y-form-item">
46
+ <label>数量</label>
47
+ <input type="number" class="form-control y-form-item-input" v-model="item.f_material_number">
48
+ </div>
49
+ <div class="y-form-item">
50
+ <label>金额</label>
51
+ <input type="number" class="form-control y-form-item-input" v-model="item.f_fee"
52
+ :value="smallnum(item.f_material_price,item.f_material_number)" readonly>
53
+ </div>
54
+ <div class="y-form-item">
55
+ <label>备注</label>
56
+ <textarea type="text" rows="2" class="form-control y-form-item-input" v-model="item.f_remarks"></textarea>
57
+ </div>
58
+ </div>
59
+ <div style="padding: 10px;display: flex;justify-content: space-around;">
60
+ <button type="button" class="btn btn-primary" @click="addUserFile">添加</button>
61
+ <button type="button" class="btn btn-primary" @click="saveMaterial" v-if="baocun == 'true'">保存</button>
62
+ <button type="button" class="btn btn-primary" @click="showCharge()" v-if="shoufei == 'true'">收费</button>
63
+ </div>
64
+ <div v-show="showQrCode">
65
+ <div class="row">
66
+ <label class="text-justify lb-left" style="width: 100px">收款</label>
67
+ <div class="row row_sty">
68
+ <label class="lab_sty col-xs-4">合计金额</label>
69
+ <div class="col-xs-8">
70
+ <input type="number" class="form-control" v-model="payNumber" :value.sync="payNumber" readonly>
71
+ </div>
72
+ </div>
73
+ <div class="row row_sty">
74
+ <label class="lab_sty col-xs-4">收款方式</label>
75
+ <div class="col-xs-8">
76
+ <v-select
77
+ :width="'100%'"
78
+ :value.sync="payType"
79
+ v-model="payType"
80
+ :options='payTypes'
81
+ placeholder='请选择'
82
+ close-on-select
83
+ :value-single="true"
84
+ ></v-select>
85
+ </div>
86
+ </div>
87
+ <div v-if="zfCode" style="margin-top: 20px; text-align: center;">
88
+ <div id="qrcode" style="margin-top: 25px;width: 266px;height: 266px"></div>
89
+ </div>
90
+ </div>
91
+ <div style="padding: 10px;display: flex;justify-content: space-around;">
92
+ <button type="button" name="button" class="btn btn-primary btn-sm" style="float: right;margin-right:10px;"
93
+ @click="beforeSaveCharge()">确认收费
94
+ </button>
95
+ <button type="button" class="btn btn-primary" @click="cancel">取消</button>
96
+ </div>
97
+ </div>
98
+ </template>
99
+ <script>
100
+ import Vue from 'vue'
101
+ import {HttpResetClass} from 'vue-client'
102
+ import QRCode from 'qrcodejs2'
103
+ import {getNowDate, isEmpty} from '../../components/Util'
104
+
105
+ export default {
106
+ title: '材料添加',
107
+ props: {
108
+ selectdata: {
109
+ type: Object
110
+ }
111
+ },
112
+ data() {
113
+ return {
114
+ baocun: this.$appdata.getSingleValue('材料收费保存'),
115
+ shoufei: this.$appdata.getSingleValue('材料收费收费'),
116
+ othercharge_id: '',
117
+ payState: false,
118
+ zfCode: false,
119
+ f_out_trade_no: '',
120
+ payTypes: this.$appdata.getParam('材料收费方式'),
121
+ payType: '',
122
+ payNumber: 0,
123
+ button_state: false,
124
+ category: {},
125
+ showFile: false,
126
+ material: [],
127
+ positions: this.$appdata.getParam('品名及规格'), // 获取材料名称
128
+ charge: {
129
+ payment_terms: [{f_payment_term: '', f_charge_money: '', f_amount_words: '', f_payment_method: ''}]
130
+ }, // 收费内容
131
+ timeLeft: 300, // 收费时间
132
+ title1: '', // 二维码标题
133
+ showQrCode: false, // 二维码显示
134
+ order: {}, // 订单信息
135
+ f_cost_sum: 0, // 总收费
136
+ }
137
+ },
138
+ ready () {
139
+ this.loadOptions()
140
+ },
141
+ methods: {
142
+ cancel () {
143
+ this.payNumber = 0
144
+ this.othercharge_id = ''
145
+ this.payState = false
146
+ this.zfCode = false
147
+ this.showQrCode = false
148
+ this.payType = ''
149
+ clearTimeout(this.orderInterval)
150
+ },
151
+ getChangePayNumber () {
152
+ this.payNumber = 0
153
+ for (let i = 0; i < this.material.length; i++) {
154
+ this.material[i].f_fee = this.material[i].f_material_price * this.material[i].f_material_number
155
+ this.payNumber += Number(this.material[i].f_fee)
156
+ }
157
+ },
158
+ // 显示收费界面
159
+ async showCharge () {
160
+ if (this.material.length == 0) {
161
+ return this.$showMessage(`请先添加消耗的材料!`)
162
+ }
163
+ // 验证材料信息是否完整
164
+ for (let index = 0; index < this.material.length; index++) {
165
+ const item = this.material[index]
166
+ if (!item.f_typename) {
167
+ this.$showMessage(`请选择材料${index + 1}的材料名称`)
168
+ return;
169
+ }
170
+ if (!item.f_typenumber) {
171
+ this.$showMessage(`请选择材料${index + 1}的材料型号`)
172
+ return;
173
+ }
174
+ if (!item.f_material_price) {
175
+ this.$showMessage(`请填写材料${index + 1}的单价`)
176
+ return;
177
+ }
178
+ if (!item.f_material_number || item.f_material_number == 0) {
179
+ this.$showMessage(`请填写材料${index + 1}的数量`)
180
+ return;
181
+ }
182
+ }
183
+ await this.getChangePayNumber()
184
+ this.showQrCode = true
185
+ },
186
+ // 保存材料信息
187
+ async saveMaterial () {
188
+ if (this.material.length == 0) {
189
+ return this.$showMessage(`请先添加消耗的材料!`)
190
+ }
191
+ for (let index = 0; index < this.material.length; index++) {
192
+ const item = this.material[index]
193
+ if (!item.f_typename) {
194
+ this.$showMessage(`请选择材料${index + 1}的材料名称`)
195
+ return;
196
+ }
197
+ if (!item.f_typenumber) {
198
+ this.$showMessage(`请选择材料${index + 1}的材料型号`)
199
+ return;
200
+ }
201
+ if (!item.f_material_price) {
202
+ this.$showMessage(`请填写材料${index + 1}的单价`)
203
+ return;
204
+ }
205
+ if (!item.f_material_number || item.f_material_number == 0) {
206
+ this.$showMessage(`请填写材料${index + 1}的数量`)
207
+ return;
208
+ }
209
+ }
210
+ await this.saveUserFile('save')
211
+ this.$showMessage('材料保存成功!!!')
212
+ },
213
+ async beforeSaveCharge () {
214
+ if (!this.payType) {
215
+ this.$showMessage(`请选择缴费方式`)
216
+ return;
217
+ }
218
+ if (this.payType.includes('二维码') && this.payNumber > 0) {
219
+ await this.openQrcode()
220
+ } else {
221
+ this.payState = true
222
+ await this.saveUserFile('save')
223
+ this.$showMessage('收费成功!!!')
224
+ this.cancel()
225
+ this.$emit('close')
226
+ }
227
+ },
228
+ loadOptions () {
229
+ const data = {
230
+ tablename: 't_material_management',
231
+ condition: `1=1`
232
+ }
233
+ this.$resetpost(this.$androidUtil.getProxyUrl() + '/af-telephone/rs/sql/tel_singleTable', {data}, {
234
+ resolveMsg: null,
235
+ rejectMsg: '获取数据失败'
236
+ }).then((res) => {
237
+ const categories = []
238
+ const types = []
239
+ for (let material of res.data) {
240
+ if (material.f_material_stype == '分类') {
241
+ categories.push(material)
242
+ } else if (material.f_material_stype == '型号') {
243
+ types.push(material)
244
+ }
245
+ }
246
+ this.category.options = []
247
+ for (let category of categories) {
248
+ this.category.options.push({
249
+ label: category.f_material_name,
250
+ value: category.f_material_name
251
+ })
252
+ }
253
+
254
+ this.category.children = {}
255
+ for (let category of categories) {
256
+ this.category.children[category.f_material_name] = {
257
+ options: [],
258
+ children: {}
259
+ }
260
+
261
+ for (let type of types) {
262
+ if (type.parent_id == category.id) {
263
+ this.category.children[category.f_material_name].options.push({
264
+ label: type.f_material_name,
265
+ value: type.f_material_name
266
+ })
267
+ this.category.children[category.f_material_name].children[type.f_material_name] = type
268
+ }
269
+ }
270
+ }
271
+ console.log('this.category=', JSON.stringify(this.category))
272
+ })
273
+ },
274
+ // 删除未保存的材料信息
275
+ async deleteUserFile (index) {
276
+ this.material.splice(index, 1)
277
+ },
278
+ // 追加材料信息
279
+ addUserFile () {
280
+ this.material.push({})
281
+ },
282
+ // 金额计算
283
+ smallnum (val, val1) {
284
+ let num = Number(val) * Number(val1)
285
+ return num
286
+ },
287
+ qrcode (url) {
288
+ new QRCode('qrcode', {
289
+ text: url, // 设置二维码内容或跳转地址
290
+ width: 266, // 设置宽度,单位像素
291
+ height: 266, // 设置高度,单位像素
292
+ correctLevel: QRCode.CorrectLevel.L //容错率,L/M/Hs
293
+ })
294
+ },
295
+ clearQrCode () {
296
+ if (document.getElementById('qrcode')) {
297
+ document.getElementById('qrcode').innerHTML = ''
298
+ }
299
+ },
300
+ async getOrderInformation () {
301
+ // 查询订单信息
302
+ console.log('查询订单信息!!!')
303
+ let http = new HttpResetClass()
304
+ let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/wx/rs/weixin/orderStatus`, {
305
+ "f_filiale": "wensuxilong",
306
+ "out_trade_no": `${this.f_out_trade_no}`
307
+ }, {
308
+ resolveMsg: null,
309
+ rejectMsg: '订单查询失败!!!'
310
+ })
311
+ // 支付成功
312
+ if (res.data.trade_state_desc.includes('成功')) {
313
+ this.$showMessage('支付成功!!!')
314
+ await this.saveUserFile('save')
315
+ this.clearQrCode()
316
+ this.cancel()
317
+ this.$emit('close')
318
+ }
319
+ },
320
+ async openQrcode () {
321
+ this.clearQrCode()
322
+ let data = {
323
+ tablename: 't_userfiles',
324
+ condition: `f_userinfo_id = '${this.selectdata.model.f_userinfo_id}'`
325
+ }
326
+ let res = await new HttpResetClass().load('post', this.$androidUtil.getProxyUrl() + '/af-telephone/rs/sql/tel_singleTable', {data: data}, {
327
+ resolveMsg: null,
328
+ rejectMsg: '获取数据失败'
329
+ })
330
+ let reqdata = {
331
+ "filiale": "wensuxilong",
332
+ "money": 1,
333
+ "str": "材料收费",
334
+ "attach": {
335
+ "f_userfiles_id": res.data[0].f_userfiles_id,
336
+ "f_userinfo_id": this.selectdata.model.f_userinfo_id
337
+ }
338
+ }
339
+ new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/wx/rs/weixin/gasgetcode`, reqdata).then(res => {
340
+ if (res.data.code === 200) {
341
+ this.f_out_trade_no = res.data.out_trade_no
342
+ this.zfCode = true
343
+ this.$nextTick(() => {
344
+ this.qrcode(res.data.url)
345
+ })
346
+ this.orderInterval = setInterval(() => {
347
+ this.getOrderInformation()
348
+ }, 3000)
349
+ } else {
350
+ this.$showMessage('网络异常。。。')
351
+ }
352
+ })
353
+ },
354
+ async saveUserFile (type) {
355
+ for (let i = 0; i < this.material.length; i++) {
356
+ this.material[i].f_process_id = this.selectdata.f_process_id
357
+ this.material[i].f_material_name = this.material[i].f_typename
358
+ this.material[i].f_department = Vue.user.f_department_name
359
+ this.material[i].f_operator = Vue.user.name
360
+ this.material[i].f_filiale = Vue.user.orgid
361
+ this.material[i].f_fee = this.material[i].f_material_price * this.material[i].f_material_number
362
+ if (isEmpty(this.material[i].f_state)) {
363
+ this.material[i].f_state = null
364
+ }
365
+ }
366
+ await this.saveOrder(type)
367
+ },
368
+ async saveOrder (type) {
369
+ console.log('this.material', this.material)
370
+ let otherdetail = []
371
+ if (this.payNumber == 0) {
372
+ otherdetail.push({
373
+ f_brand_spec: ['维修'],
374
+ f_typename: ['材料费'],
375
+ f_typenumber: [],
376
+ f_unitprice: 0,
377
+ f_number: this.material.length
378
+ })
379
+ } else {
380
+ this.material.forEach((row) => {
381
+ otherdetail.push({
382
+ f_brand_spec: ['维修'],
383
+ f_typename: [`${row.material_type ? row.material_type : '材料费'}`],
384
+ f_typenumber: [],
385
+ f_unitprice: row.f_material_price,
386
+ f_number: row.f_material_number
387
+ })
388
+ })
389
+ }
390
+ let param = {
391
+ model: this.material,
392
+ operator_type: type,
393
+ othercharge_id: this.othercharge_id,
394
+ f_process_id: this.selectdata.f_process_id,
395
+ f_userinfo_id: this.selectdata.model.f_userinfo_id,
396
+ other: {
397
+ "record_userinfo": this.selectdata.model.f_userinfo_id,
398
+ "f_user_name": this.selectdata.model.f_user_name,
399
+ "f_address": this.selectdata.model.f_address,
400
+ "f_user_type": this.selectdata.model.f_user_type,
401
+ "f_gasproperties": "",
402
+ "f_collection": this.payNumber,
403
+ "f_comments": `${Vue.user.name}进行维修材料收费,收费方式-${this.payType} ${this.order && this.order.f_out_trade_no ? '。支付订单号:' + this.order.f_out_trade_no : ''}`,
404
+ "f_payment": this.payType,
405
+ "f_voucher_number": this.selectdata.f_process_id,
406
+ "f_bill_style": "普通收据",
407
+ "f_userinfo_id": this.selectdata.model.f_userinfo_id,
408
+ "f_service_person": Vue.user.name,
409
+ "f_operat_type": "维修收费",
410
+ "f_describe": "",
411
+ "f_serial_id": this.order ? this.order.f_out_trade_no : null,
412
+ "f_state": '有效',
413
+ "f_operator": Vue.user.name,
414
+ "f_operatorid": Vue.user.id,
415
+ "f_orgid": Vue.user.orgid,
416
+ "f_orgname": Vue.user.orgs,
417
+ "f_depid": Vue.user.depids,
418
+ "f_depname": Vue.user.f_department_name,
419
+ "t_userfees": "",
420
+ "f_fee_type": "维修费用",
421
+ "f_fee_time": "12",
422
+ "otherdetail": otherdetail
423
+ }
424
+
425
+ }
426
+ console.log("材料收费保存", param)
427
+ let res = await new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/saveMaterialService`, param, {
428
+ resolveMsg: null,
429
+ rejectMsg: null
430
+ })
431
+ if (res.data.code == 200) {
432
+ if (type !== 'create') {
433
+ this.$showMessage('材料保存成功!!!')
434
+ }
435
+ } else {
436
+ this.$showMessage(res.data.msg)
437
+ }
438
+ },
439
+ },
440
+ computed: {
441
+ paymentMethod () {
442
+ return this.$appdata.getParam("付款方式")
443
+ },
444
+ paymentTerm () {
445
+ return this.$appdata.getParam("收费项目")
446
+ }
447
+ }
448
+ }
449
+ </script>
450
+ <style lang="less" scoped>
451
+ .head-but {
452
+ margin-left: 5px;
453
+ height: 34px;
454
+ /*background-color: #6aa6e2;*/
455
+ border-radius: 4px;
456
+ font-family: PingFang;
457
+ color: #ffffff;
458
+ }
459
+
460
+ /*清除model中的浮动*/
461
+ .clearfix:after, .clearfix:before {
462
+ display: table;
463
+ }
464
+
465
+ .clearfix:after {
466
+ clear: both;
467
+ }
468
+
469
+ .y-form {
470
+ display: flex;
471
+ flex-flow: column;
472
+ gap: 10px;
473
+ padding: 10px 5px;
474
+
475
+ .y-form-head {
476
+ background-color: #e8f4ff;
477
+ display: flex;
478
+ padding: 10px 20px;
479
+ align-items: center;
480
+ justify-content: space-between;
481
+ }
482
+
483
+ .y-form-item {
484
+ display: flex;
485
+ gap: 10px;
486
+
487
+ label {
488
+ width: 30%;
489
+ text-align: right;
490
+ }
491
+
492
+ .y-form-item-input {
493
+ width: 70%;
494
+ }
495
+ }
496
+ }
497
+ </style>