apply-clients 3.5.4-66 → 3.5.4-67

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.
Files changed (44) hide show
  1. package/build/dev-server.js +19 -7
  2. package/package.json +1 -1
  3. package/src/App.vue +25 -25
  4. package/src/components/product/Function/Service/FunctionServiceControl.vue +497 -497
  5. package/src/components/product/MaterialsManage/MaterialsBase.vue +181 -181
  6. package/src/components/product/MaterialsManage/MaterialsManage.vue +60 -60
  7. package/src/components/product/Process/Processes/chargeManagement.vue +656 -656
  8. package/src/components/product/ServiceView.vue +1026 -1025
  9. package/src/components/product/Supervisory/SupervisoryControl.vue +141 -141
  10. package/src/components/product/Supervisory/SupervisoryList.vue +452 -452
  11. package/src/filiale/gongyi/android/AppDisclosurerecord.vue +214 -214
  12. package/src/filiale/gongyi/android/AppInstallationDetails.vue +500 -500
  13. package/src/filiale/gongyi/android/AppLegacyIssues.vue +309 -309
  14. package/src/filiale/gongyi/android/AppSign.vue +170 -157
  15. package/src/filiale/gongyi/android/AppSupplementalAgreement.vue +298 -298
  16. package/src/filiale/gongyi/android.js +18 -18
  17. package/src/filiale/gongyi/pc/ApplyUpload.vue +371 -378
  18. package/src/filiale/gongyi/pc/PcAddLogs.vue +221 -217
  19. package/src/filiale/gongyi/pc/PcDisclosurerecord.vue +218 -218
  20. package/src/filiale/gongyi/pc/PcLegacyIssues.vue +309 -314
  21. package/src/filiale/gongyi/pc/SupervisoryServiceControl.vue +894 -894
  22. package/src/filiale/gongyi/pc/SupervisoryServiceView.vue +1005 -1005
  23. package/src/filiale/gongyi/pc/addMaterialScience.vue +575 -564
  24. package/src/filiale/gongyi/pc/chargeManagement.vue +765 -763
  25. package/src/filiale/gongyi/pc/supplementalAgreement.vue +277 -277
  26. package/src/filiale/gongyi/pc.js +24 -24
  27. package/src/filiale/hongda/pc/SupervisoryList.vue +422 -422
  28. package/src/filiale/yangchunboneng/android/AppExplorationUser.vue +518 -518
  29. package/src/filiale/yangchunboneng/android/AppInstallationMaterial.vue +1081 -1081
  30. package/src/filiale/yangchunboneng/android/AppSuperServiceControl.vue +1524 -1524
  31. package/src/filiale/yangchunboneng/android/AppUpload.vue +205 -205
  32. package/src/filiale/yangchunboneng/android/MaterIialOne.vue +156 -156
  33. package/src/filiale/yangchunboneng/android.js +20 -20
  34. package/src/filiale/yangchunboneng/pc/ApplyUpload.vue +392 -392
  35. package/src/filiale/yangchunboneng/pc/ExplorationUser.vue +191 -191
  36. package/src/filiale/yangchunboneng/pc/InstallInfoSelect.vue +365 -365
  37. package/src/filiale/yangchunboneng/pc/SupervisoryControlNew.vue +142 -142
  38. package/src/filiale/yangchunboneng/pc/SupervisoryList.vue +590 -590
  39. package/src/filiale/yangchunboneng/pc/SupervisoryListNew.vue +628 -628
  40. package/src/filiale/yangchunboneng/pc/SupervisoryServiceControl.vue +902 -902
  41. package/src/filiale/yangchunboneng/pc/SupervisoryServiceControlNew.vue +901 -901
  42. package/src/filiale/yangchunboneng/pc/SupervisoryServiceView.vue +1117 -1117
  43. package/src/filiale/yangchunboneng/pc.js +24 -24
  44. package/src/main.js +1 -1
@@ -1,1081 +1,1081 @@
1
- <template>
2
- <work-busy :is-busy="button_state"></work-busy>
3
- <div>
4
- <div style="height: auto;width: 100%;margin: 30px 0" v-if="showQrCode">
5
- <div partial>
6
- <div class="" align="center">
7
- <div style="margin-bottom:10px "><img src="../../../assets/scanCode.png">请扫描下方二维码进行付款</div>
8
- <div class="row app-row">
9
- <div class="col-xs-12">
10
- <label class="font text-left">订单编号:{{ order.body.tradeNo }}</label>
11
- </div>
12
- <!-- <div class="col-xs-8">
13
- <input type="text" class ="search_input input-font" v-model="order.body.tradeNo" />
14
- </div>-->
15
- </div>
16
- <!-- <div class="row app-row">
17
- <div class="col-xs-4">
18
- <label class="font text-left">订单状态:</label>
19
- </div>
20
- <div class="col-xs-8">
21
- <input type="text" class ="search_input input-font" v-model="orderstatus.msg" />
22
- </div>
23
- </div>-->
24
- <!--<div @click="callBack('支付成功')">返回</div>-->
25
- </div>
26
- <div class="" align="center">
27
- <div class="QR-code" v-if="payType=='二维码支付'">
28
- <img src="../../../assets/qrcode_no.png" v-show="isTimeout" style="width: 266px;height: 266px"/>
29
- <div id="qrcode" style="margin-top: 25px;width: 266px;height: 266px"></div>
30
- </div>
31
- </div>
32
- </div>
33
- </div>
34
- <div v-show="!showQrCode">
35
- <apply-material-one v-for="(i, item) in material " :index="$index" :item="item"
36
- :materialnameandcode="materialnameandcode"
37
- :newmaterialnameandcode="newmaterialnameandcode"
38
- :newmaterialnameandtype="newmaterialnameandtype"
39
- :typenumbers="materialtypenumber" @number_chenge="getChangePayNumber"
40
- @delete_material="delete_material"></apply-material-one>
41
- <div style="padding: 10px;display: flex;justify-content: space-around;">
42
- <button type="button" class="btn btn-primary" @click="addUserFile">添加</button>
43
- </div>
44
-
45
- <div class="row">
46
- <label class="text-justify lb-left" style="width: 100px">收款</label>
47
- <!-- <div class="row">
48
-
49
- <data-grid partial='list' v-ref:grid :model="{rows:summarize}" v-show="summarize.length>0" class="list_area table_sy">
50
- <template partial='head'>
51
- <tr>
52
- <th>
53
- <nobr>收费类型</nobr>
54
- </th>
55
- <th>
56
- <nobr>数量</nobr>
57
- </th>
58
- <th>
59
- <nobr>总金额</nobr>
60
- </th>
61
- </tr>
62
- </template>
63
- <template partial='body'>
64
- <td style="text-align: center;">
65
- <nobr>{{row.material_type }}</nobr>
66
- </td>
67
- <td style="text-align: center;">
68
- <nobr>{{ row.amount }}</nobr>
69
- </td>
70
- <td style="text-align: center;">
71
- <nobr>{{ row.money }}</nobr>
72
- </td>
73
- </template>
74
- </data-grid>
75
- &lt;!&ndash; <div v-for="item in summarize" style="display: flex;justify-content: center;">
76
- {{item.}} - {{item.}} - {{item.}}
77
- </div>&ndash;&gt;
78
- </div>-->
79
- <div class="row row_sty">
80
- <label class="lab_sty col-xs-4">收费优惠金额</label>
81
- <div class="col-xs-8">
82
- <input type="number" class="form-control" v-model="f_discounts_money_materials" :value.sync="f_discounts_money_materials" @change="getChangePayNumber()">
83
- </div>
84
- </div>
85
- <div class="row row_sty">
86
- <label class="lab_sty col-xs-4">总优惠金额</label>
87
- <div class="col-xs-8">
88
- <input type="number" class="form-control" v-model="f_discounts_money" :value.sync="f_discounts_money" readonly>
89
- </div>
90
- </div>
91
- <div class="row row_sty">
92
- <label class="lab_sty col-xs-4">合计金额</label>
93
- <div class="col-xs-8">
94
- <input type="number" class="form-control" v-model="payNumber" :value.sync="payNumber" readonly>
95
- </div>
96
- </div>
97
- <div class="row row_sty">
98
- <label class="lab_sty col-xs-4">收款方式</label>
99
- <div class="col-xs-8">
100
- <v-select
101
- :width="'100%'"
102
- :value.sync="payType"
103
- v-model="payType"
104
- :options='payTypes'
105
- placeholder='请选择'
106
- close-on-select
107
- :value-single="true"
108
- ></v-select>
109
- </div>
110
- </div>
111
- <!-- <div class="y-form-item" v-if="payType=='二维码支付'">
112
- <div id="qrcode" class="qrcode" v-ref:qrcode></div>
113
- </div>-->
114
- </div>
115
- <div style="padding: 10px;display: flex;justify-content: space-around;">
116
- <button type="button" name="button" class="btn btn-primary btn-sm" style="float: right;margin-right:10px;"
117
- @click="beforeSaveCharge()">保存
118
- </button>
119
- <button type="button" class="btn btn-primary" @click="cancel">取消</button>
120
- </div>
121
- </div>
122
- </div>
123
- </template>
124
-
125
- <script>
126
- import Vue from 'vue'
127
- import {HttpResetClass} from 'vue-client'
128
- import QRCode from 'qrcodejs2'
129
- import {isEmpty} from '../../../components/Util'
130
-
131
- export default {
132
- title: '材料添加',
133
- props: {
134
- selectdata: {
135
- type: Object
136
- }
137
- },
138
- data() {
139
- return {
140
- f_discounts_money_materials:0,
141
- f_discounts_money:0,
142
- materialname: [],
143
- materialTYPE: [],
144
- materialnameandcode: [],
145
- newmaterialnameandcode: [],
146
- materialtypenumber: [],
147
- newmaterialnameandtype: [],
148
- category: {},
149
- //支付方式
150
- payType: '',
151
- //支付总额
152
- payNumber: 0,
153
- newPayNumber: 0,
154
- //支付方式选择框
155
- // payTypes: [{label: '现金', value: '现金'}, {label: '二维码支付', value: '二维码支付'}],
156
- payTypes: [{label: '现金', value: '现金'},{label: '扫码支付', value: '扫码支付'}],
157
- materialImges: [],
158
- showFile: false,
159
- material: [],
160
- positions: this.$appdata.getParam('品名及规格'), // 获取材料名称
161
- charge: {
162
- payment_terms: [{f_payment_term: '', f_charge_money: '', f_amount_words: '', f_payment_method: ''}]
163
- }, // 收费内容
164
- showCharge: false, // 收费显示
165
- timeLeft: 300, // 收费时间
166
- title1: '', // 二维码标题
167
- showQrCode: false, // 二维码显示
168
- order: {}, // 订单信息
169
- f_cost_sum: 0, // 总收费
170
- othercharge_id: '',
171
- button_state: false,
172
- summarize: []//材料收费方式汇总
173
- }
174
- },
175
- ready() {
176
-
177
- //this.search()
178
- this.getAllMaterial()
179
- // this.getmaterial()
180
- // this.getmaterialTYPE()
181
-
182
- },
183
- methods: {
184
- delete_material(i) {
185
- console.log('删除项====', i)
186
- this.material.splice(i, 1)
187
- this.getChangePayNumber()
188
- },
189
- async beforeSaveCharge() {
190
- console.log("977666")
191
- if (this.material.length == 0) {
192
- return this.$showMessage(`请先添加消耗的材料!`)
193
- }
194
- for (let index = 0; index < this.material.length; index++) {
195
- const item = this.material[index]
196
- if (!item.f_material_name) {
197
- this.$showMessage(`请选择材料${index + 1}的材料名称`)
198
- return;
199
- }
200
- if (!item.f_typenumber) {
201
- this.$showMessage(`请选择材料${index + 1}的型号`)
202
- return;
203
- }
204
- if (!item.f_material_price) {
205
- this.$showMessage(`请填写材料${index + 1}的单价`)
206
- return;
207
- }
208
- if (!item.f_material_number || item.f_material_number == 0) {
209
- this.$showMessage(`请填写材料${index + 1}的数量`)
210
- return;
211
- }
212
- }
213
- /*if(this.materialImges.length===0){
214
- this.$showMessage(`至少有一张材料照片`)
215
- return;
216
- }*/
217
- if (!this.payType) {
218
- this.$showMessage(`请选择缴费方式`)
219
- return;
220
- }
221
- this.button_state = true
222
- try {
223
- if (this.payType.indexOf('现金') != -1) {
224
- await this.saveUserFile('save')
225
- } else {
226
- await this.openQrCode()
227
- }
228
- this.button_state = false
229
- } catch (e) {
230
- this.$showMessage(`材料收费失败!请检查网络`)
231
- this.button_state = false
232
- }
233
- },
234
- cancel() {
235
- this.$emit('aftersave')
236
- },
237
- getAllMaterial() {
238
- new HttpResetClass().load('POST', this.$androidUtil.getProxyUrl() + `/rs/sql/tel_singleTable_OrderBy?pageNo=1&pageSize=99999`, {
239
- data: {
240
- items: '*',
241
- tablename: 't_material_info',
242
- condition: `org_id = '${Vue.user.orgid}'`,
243
- orderitem: 'id desc'
244
- }
245
- }, {resolveMsg: null, rejectMsg: null}).then(res => {
246
- const typeNames = res.data.filter((item) => item.type === '报建')
247
- const materialNames = res.data.filter((item) => item.type === '材料')
248
- const materialNumbers = res.data.filter((item) => item.type === '型号')
249
- console.log(typeNames, materialNames, materialNumbers)
250
- const newMaterialNames = materialNames.map((item) => {
251
- const typeName = typeNames.filter((res) => {
252
- return res.id == item.parent_id
253
- })
254
- return {
255
- id: item.id,
256
- typeName: typeName[0],
257
- materialName: item
258
- }
259
- })
260
- //所有材料
261
- console.log("988", newMaterialNames)
262
- for (let i = 0; i < newMaterialNames.length ; i++) {
263
- this.newmaterialnameandcode.push({
264
- label: newMaterialNames[i].materialName.name,
265
- value: newMaterialNames[i].materialName,
266
- })
267
- }
268
- // 所有型号
269
- this.newmaterialnameandtype =materialNumbers
270
- }).catch((e) => {
271
- console.log("933", e)
272
- })
273
- },
274
- sortArrayByCodeAscending(dataArray) {
275
- // Convert the "code" property to a number for sorting
276
- dataArray.forEach(item => {
277
- item.newCode = parseFloat(item.code);
278
- });
279
-
280
- // Sort the array based on the "code" property
281
- dataArray.sort((a, b) => a.newCode - b.newCode);
282
-
283
- return dataArray;
284
- },
285
- getChangePayNumber() {
286
- this.payNumber = 0
287
- this.summarize = []
288
- this.f_discounts_money = 0
289
- for (let i = 0; i < this.material.length; i++) {
290
- this.material[i].f_fee = (this.material[i].f_material_price * this.material[i].f_material_number) + (this.material[i].f_overlength_unitprice * this.material[i].f_overlength_number) - this.material[i].f_discounts_money_detail
291
- this.payNumber += Number(this.material[i].f_fee)
292
- this.f_discounts_money += Number(this.material[i].f_discounts_money_detail)
293
- // let res=this.checkSummarize(this.material[i].material_type)
294
- /* if(res.has){
295
- this.summarize[res.idx].amount+= 1
296
- this.summarize[res.idx].money+= Number(this.material[i].f_fee)
297
- }else{
298
- this.summarize.push({material_type:this.material[i].material_type,amount:1,money:this.material[i].f_fee})
299
- } */
300
- }
301
- this.payNumber -= Number(this.f_discounts_money_materials)
302
- this.f_discounts_money += Number(this.f_discounts_money_materials)
303
- console.log('this.summarize------------', this.summarize)
304
- },
305
- checkSummarize(name) {
306
- let result = {idx: null, has: false}
307
- this.summarize.forEach((item, idx) => {
308
- if (item.material_type == name) {
309
- result.idx = idx
310
- result.has = true
311
- }
312
- })
313
- console.log('result', result)
314
- return result
315
- },
316
- getsutitle(val) {
317
- return val
318
- },
319
- loadOptions(index) {
320
- // const data = {
321
- // tablename: 't_material_info',
322
- // condition: "1 = 1 and code = '" + this.material[index].f_material_code + "'"
323
- // }
324
- // this.$resetpost(this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data}, {
325
- // resolveMsg: null,
326
- // rejectMsg: '获取数据失败'
327
- // }).then((res) => {
328
- // for (let material of res.data) {
329
- // switch (material.type) {
330
- // case '分类' :
331
- // this.$set('material[' + index + '].f_typename', material.name)
332
- // break
333
- // case '品名' :
334
- // this.$set('material[' + index + '].f_material_name', material.name)
335
- // break
336
- // case '型号' :
337
- // this.$set('material[' + index + '].f_typenumber', material.name)
338
- // this.$set('material[' + index + '].unit', material.unit)
339
- // this.$set('material[' + index + '].f_material_price', material.price)
340
- // break
341
- // }
342
- // }
343
- // this.$set('material', JSON.parse(JSON.stringify(this.material)))
344
- // })
345
- const data = {
346
- code: this.material[index].f_material_code
347
- }
348
- this.$resetpost(this.$androidUtil.getProxyUrl() + '/rs/sql/getMaterialByCode', {data}, {
349
- resolveMsg: null,
350
- rejectMsg: '获取数据失败'
351
- }).then((res) => {
352
- for (let material of res.data) {
353
- this.$set('material[' + index + '].f_typename', material.f_typename)
354
- this.$set('material[' + index + '].f_material_name', material.f_material_name)
355
- this.$set('material[' + index + '].f_typenumber', material.f_typenumber)
356
- this.$set('material[' + index + '].unit', material.unit)
357
- this.$set('material[' + index + '].f_material_price', material.f_material_price)
358
- }
359
- this.$set('material', JSON.parse(JSON.stringify(this.material)))
360
- })
361
-
362
- },
363
- // 删除未保存的材料信息
364
- async deleteUserFile(index) {
365
- this.material.splice(index, 1)
366
- },
367
- // 追加材料信息
368
- addUserFile() {
369
- this.material.push({
370
- f_material_name: "",
371
- unit: 0,
372
- f_material_price: 0,
373
- f_typenumber: "",
374
- f_typename: "",
375
- material_type: "",
376
- f_overlength_unitprice:"0",
377
- f_overlength_number:"0",
378
- f_discounts_money_detail:"0",
379
- f_actual_materials_detail:"0"
380
- })
381
- },
382
- getmaterialTYPE() {
383
- let http = new HttpResetClass()
384
- let data = {
385
- tablename: 't_material_service',
386
- condition: `1=1`
387
- }
388
- http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
389
- resolveMsg: null,
390
- rejectMsg: '获取数据失败'
391
- }).then(res => {
392
- console.log("XXX", res.data.length)
393
- for (let i = 0; i < res.data.length; i++) {
394
-
395
- this.materialTYPE.push({
396
- label: res.data[i].f_typenumber,
397
- value: res.data[i].f_typenumber
398
- })
399
- }
400
- if (this.materialTYPE.length <= 0) {
401
- this.materialTYPE = [{}]
402
- }
403
- this.materialtypenumber = Array.from(new Set(this.materialTYPE.map(item => item.label)))
404
- .map(label => {
405
- return this.materialTYPE.find(item => item.label === label);
406
- })
407
- console.log("XXX", this.materialtypenumber)
408
- })
409
- return this.materialtypenumber
410
- },
411
- getmaterial() {
412
- let http = new HttpResetClass()
413
- let data = {
414
- tablename: 't_material_service',
415
- condition: `1=1`
416
- }
417
- http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
418
- resolveMsg: null,
419
- rejectMsg: '获取数据失败'
420
- }).then(res => {
421
- console.log("XXX", res.data.length)
422
- for (var i = 0; i < res.data.length; i++) {
423
-
424
- this.materialname.push({
425
- label: '[' + res.data[i].f_material_code + ']' + res.data[i].f_material_name,
426
- value: res.data[i].f_material_name
427
- }
428
- )
429
- }
430
- if (this.materialname.length <= 0) {
431
- this.materialname = [{}]
432
- }
433
- this.materialnameandcode = Array.from(new Set(this.materialname.map(item => item.label)))
434
- .map(label => {
435
- return this.materialname.find(item => item.label === label);
436
- })
437
- this.materialname = this.materialname.map(item => {
438
- item.label = item.label.replace(/null/g, "空")
439
- return item;
440
- });
441
- console.log("XXX", this.materialnameandcode)
442
- })
443
- return this.materialnameandcode
444
- },
445
- search() {
446
- let http = new HttpResetClass()
447
- let data = {
448
- tablename: 't_material_service',
449
- condition: `f_process_id = '${this.selectdata.f_process_id}'`
450
- }
451
- http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
452
- resolveMsg: null,
453
- rejectMsg: '获取数据失败'
454
- }).then(res => {
455
- this.material = res.data
456
- if (this.material.length <= 0) {
457
- this.addUserFile()
458
- } else {
459
- this.getAllMaterialImg()
460
- this.getChangePayNumber()
461
- }
462
- })
463
-
464
-
465
- },
466
- getAllMaterialImg() {
467
- let http = new HttpResetClass()
468
- let data = {
469
- tablename: 't_material_img',
470
- condition: `f_process_id = '${this.selectdata.f_process_id}'`
471
- }
472
- http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
473
- resolveMsg: null,
474
- rejectMsg: '获取数据失败'
475
- }).then(result => {
476
- let tempArr = []
477
- let tempArrary = []
478
- result = result.data
479
- for (let i = 0; i < result.length; i++) {
480
-
481
- if (!tempArr.includes(result[i].f_path)) {
482
- let temp = {}
483
- temp.id = result[i].id
484
- temp.android_file = result[i].f_path
485
- temp.imgpath = ''
486
- temp.path = 'http://newimg/storage/emulated/0/Download/safecheck/' + result[i].f_path
487
- tempArr.push(result[i].f_path)
488
- tempArrary.push(temp)
489
- }
490
- }
491
- this.materialImges = tempArrary
492
- })
493
- },
494
- // 获取品名规格
495
- setTypename(i, val) {
496
- let ac = this.$appdata.getParam(val)
497
- this.$set('material[' + i + '].typeNameList', ac)
498
- this.$set('material[' + i + '].typeNumberList', [])
499
- this.$set('material[' + i + '].f_typenumber', null)
500
- this.$set('material[' + i + '].f_material_price', 0)
501
- },
502
- // 获取类型
503
- setTypenumber(i, val) {
504
- let ac = this.$appdata.getParam(val)
505
- this.$set('material[' + i + '].typeNumberList', ac)
506
- this.$set('material[' + i + '].f_material_price', 0)
507
- },
508
- // 获取单价
509
- setmaterialprice(i, val) {
510
- var num
511
- if (val == null) {
512
- num = 0
513
- }
514
- num = this.$appdata.getSingleValue(val)
515
- this.$set('material[' + i + '].f_material_price', num)
516
- },
517
- // 金额计算
518
- smallnum(val, val1) {
519
- let num = Number(val) * Number(val1)
520
- return num
521
- },
522
- getCheckMessage() {
523
- let tempArr = this.material
524
- if (!tempArr.length > 0) {
525
- return '请选择材料后上传'
526
- }
527
- for (let i = 0; i < tempArr.length; i++) {
528
- if (tempArr[i].f_process_id) {
529
- continue
530
- }
531
-
532
- if (!tempArr[i].f_material_price) {
533
- return '请输入材料单价'
534
- }
535
- if (!tempArr[i].f_material_number) {
536
- return '请输入材料数量'
537
- }
538
- }
539
- /* if (this.materialImges.length == 0) {
540
- return '材料清单需拍照'
541
- } */
542
- return null
543
-
544
- },
545
- /*async saveUserFile1() {
546
- let message = this.getCheckMessage()
547
- if (message) {
548
- this.$showMessage(message)
549
- return
550
- }
551
- let imgs = []
552
- for (let i = 0; i < this.materialImges.length; i++) {
553
- let it = {}
554
- if (this.materialImges[i].id) {
555
- it = {
556
- f_path: this.materialImges[i].path,
557
- id: this.materialImges[i].id,
558
- f_process_id: this.selectdata.f_process_id
559
- }
560
- } else {
561
- it = {
562
- f_path: this.materialImges[i].path,
563
- f_process_id: this.selectdata.f_process_id
564
- }
565
- }
566
- imgs.push(it)
567
- }
568
- for (let i = 0; i < this.material.length; i++) {
569
- this.material[i].f_process_id = this.selectdata.f_process_id
570
- if (isEmpty(this.material[i].f_state)) {
571
- this.material[i].f_state = '未收费'
572
- }
573
- }
574
- let data = {
575
- model: this.material,
576
- imgs: imgs,
577
- f_process_id: this.selectdata.f_process_id
578
- }
579
- console.log('------------------',data)
580
- new HttpResetClass().load('POST',this.$androidUtil.getProxyUrl() +`/rs/logic/saveMaterialService`, data,{resolveMsg:null,rejectMsg:null}).then(res=>{
581
- console.log(res)
582
- this.model.rows=res.data
583
- }).catch((e)=>{
584
- console.log("933",e)
585
- })
586
- /!* console.log('------------------',data)
587
- HostApp.__this__ = this
588
- HostApp.logicWithHint({
589
- // logic别名,key必须为logic
590
- 'logic': 'saveMaterialServiceAndroid',
591
- // 回调执行方法名,key必须为callback
592
- 'callback': 'javascript:HostApp.__this__.uploadCallback1()',
593
- // logic执行需要的业务参数
594
- 'data': data,
595
- // 固定key,代表是否将logic执行结果作为参数传入回调方法,1代表true,0代表false,
596
- // 执行回调方法传入key为backresult
597
- // 如需额外拼接参数,写在logic返回值的params,例如xxlogic返回:{"params": "success"}
598
- 'backresult': 1
599
- }) *!/
600
- },*/
601
- uploadCallback1(result) {
602
-
603
- if (result.state == 'ok' && JSON.parse(result.result).code == 200) {
604
- this.$showMessage('材料保存成功!!!')
605
- } else {
606
- this.$showMessage(JSON.parse(result.result).msg)
607
- }
608
- },
609
- async saveUserFile(type) {
610
- for (let i = 0; i < this.material.length; i++) {
611
- this.material[i].f_material_name=this.material[i].f_material_name.name
612
- this.material[i].f_typenumber=this.material[i].f_typenumber.name
613
- this.material[i].f_process_id = this.selectdata.f_process_id
614
- this.material[i].f_department = Vue.user.f_department_name
615
- this.material[i].f_fee = this.material[i].f_material_price * this.material[i].f_material_number
616
- if (isEmpty(this.material[i].f_state)) {
617
- this.material[i].f_state = null
618
- }
619
- }
620
- await this.saveOrder(type)
621
- },
622
- async saveOrder(type) {
623
- console.log('this.material', this.material)
624
- let otherdetail = []
625
- if (this.payNumber == 0) {
626
- otherdetail.push({
627
- f_brand_spec: ['维修'],
628
- f_typename: ['材料费'],
629
- f_typenumber: [],
630
- f_unitprice: 0,
631
- f_number: this.material.length
632
- })
633
- } else {
634
- this.material.forEach((row) => {
635
- if (row.f_material_price != 0) {
636
- otherdetail.push({
637
- f_brand_spec: [`${row.material_type? row.material_type : '材料费'}`],
638
- f_typename: [`${row.f_material_name.name}`],
639
- f_typenumber: [`${row.f_typenumber.name}`],
640
- f_unitprice: row.f_material_price,
641
- f_number: row.f_material_number,
642
- f_overlength_unitprice:row.f_overlength_unitprice,
643
- f_overlength_number:row.f_overlength_number,
644
- f_discounts_money_detail:row.f_discounts_money_detail,
645
- f_actual_materials_detail:row.f_actual_materials_detail
646
- })
647
- }
648
- })
649
- }
650
-
651
- let param = {
652
- model: this.material,
653
- operator_type: type,
654
- othercharge_id: this.othercharge_id,
655
- f_process_id: this.selectdata.f_process_id,
656
- other: {
657
- "record_userinfo": this.selectdata.model.f_userinfo_id,
658
- //"f_userfiles_id": '',
659
- //"f_user_id": '',
660
- "f_user_name": this.selectdata.model.f_user_name,
661
- "f_address": this.selectdata.model.f_address,
662
- "f_user_type": this.selectdata.model.f_user_type,
663
- "f_gasproperties": "",
664
- "f_collection": this.payNumber,
665
- "f_comments": `${Vue.user.name}进行维修材料收费,收费方式-${this.payType} ${this.order.body && this.order.body.tradeNo ? '。支付订单号:' + this.order.body.tradeNo : ''}`,
666
- "f_payment": this.payType,
667
- "f_voucher_number": this.selectdata.f_process_id,
668
- "f_bill_style": "普通收据",
669
- "f_userinfo_id": this.selectdata.model.f_userinfo_id,
670
- "f_service_person": Vue.user.name,
671
- "f_operat_type": "维修收费",
672
- "f_describe": "",
673
- "f_serial_id": this.order.body ? this.order.body.tradeNo : null,
674
- "f_state": type == 'create' ? '无效' : '有效',
675
- "f_operator": Vue.user.name,
676
- "f_discounts_money_materials": this.f_discounts_money_materials,
677
- "f_discounts_money": this.f_discounts_money,
678
- "f_operatorid": Vue.user.id,
679
- "f_orgid": Vue.user.orgid,
680
- "f_orgname": Vue.user.orgs,
681
- "f_depid": Vue.user.depids,
682
- "f_depname": Vue.user.f_department_name,
683
- "t_userfees": "",
684
- "f_fee_type": "维修费用",
685
- "f_fee_time": "12",
686
- "otherdetail": otherdetail
687
- }
688
- }
689
- console.log("要保存了666-------data2", param)
690
- let res = await new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/logic/saveMaterialService`, param, {
691
- resolveMsg: null,
692
- rejectMsg: null
693
- })
694
- console.log('res.data', res.data)
695
- if (res.data.code == 200) {
696
- if (type === 'create') {
697
- // this.$showMessage('收费记录创建成功!!!')
698
- this.othercharge_id = res.data.othercharge_id
699
- // this.$emit('aftersave')
700
- } else {
701
- this.$showMessage('材料保存成功!!!')
702
- this.$emit('aftersave')
703
- }
704
-
705
- } else {
706
- this.$showMessage(res.data.msg)
707
- }
708
- },
709
- uploadCallback(result) {
710
- if (result.state == 'ok' && JSON.parse(result.result).code == 200) {
711
- this.$showMessage('材料保存成功!!!')
712
- } else {
713
- this.$showMessage(JSON.parse(result.result).msg)
714
- }
715
- },
716
- // 关闭对话框
717
- closeModal() {
718
- this.showCharge = false
719
- this.charge = {
720
- payment_terms: [{
721
- f_payment_term: '',
722
- f_charge_money: '',
723
- f_amount_words: '',
724
- f_payment_method: this.charge.f_payment_method
725
- }]
726
- }
727
- },
728
- // 金额转大写
729
- handleInput(index) {
730
- // 通过正则过滤小数点后两位
731
- console.log('-----------------------')
732
- this.charge.payment_terms[index].f_charge_money = (this.charge.payment_terms[index].f_charge_money.match(/^\d*(\.?\d{0,2})/g)[0]) || null
733
- this.charge.payment_terms[index].f_amount_words = this.smalltoBIG(this.charge.payment_terms[index].f_charge_money)
734
- },
735
- // 金额转大写
736
- smalltoBIG(n) {
737
- let fraction = ['角', '分'];
738
- let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
739
- let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
740
- let head = n < 0 ? '欠' : '';
741
- n = Math.abs(n);
742
-
743
- let s = '';
744
-
745
- for (var i = 0; i < fraction.length; i++) {
746
- s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
747
- }
748
- s = s || '整';
749
- n = Math.floor(n);
750
-
751
- for (var i = 0; i < unit[0].length && n > 0; i++) {
752
- let p = '';
753
- for (var j = 0; j < unit[1].length && n > 0; j++) {
754
- p = digit[n % 10] + unit[1][j] + p;
755
- n = Math.floor(n / 10);
756
- }
757
- s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
758
- }
759
- return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
760
- },
761
- moneyChange(index) {
762
- console.log(`当前下标----${index}`)
763
- if (isEmpty(this.charge.payment_terms[index].f_charge_money) || Number(this.charge.payment_terms[index].f_charge_money) === 0) {
764
- this.$showMessage('单笔收费不能为0元!!!', 'warning', 3000)
765
- this.charge.payment_terms[index].f_charge_money = null
766
- return
767
- }
768
- },
769
- async TimeQrCode() {
770
- this.qrcodeTimer = setTimeout(() => {
771
- // 关闭二维码
772
- this.clearQrCode()
773
- // 将定时器清除
774
- this.qrcodeTimer = null;
775
- clearInterval(this.orderInterval)
776
- }, 60 * 1000)
777
-
778
- },
779
- generateRandomString(length) {
780
- let result = new Date().getTime().toString()
781
- const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
782
- const charactersLength = characters.length;
783
- for (let i = 0; i < length; i++) {
784
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
785
- }
786
- return result.substring(0, 30);
787
- },
788
- // 打开二维码
789
- async openQrCode() {
790
- const merchantMsg = Vue.config.telephone.ApproveConfig.merchantMsg
791
- if (!merchantMsg){
792
- this.$showMessage('未配备商户号,请联系管理员!')
793
- return
794
- }
795
- const outTradeNo = this.generateRandomString(30)
796
- // 下订单
797
- let http = new HttpResetClass()
798
- const val = {
799
- "body": "燃气费",
800
- "detail": "燃气费",
801
- "totalAmount": (this.payNumber * 100).toString(),
802
- "merchantMsg": merchantMsg,//商户id
803
- "outTradeNo": outTradeNo,//随机数30位
804
- "service": "nativePay",//死值
805
- "tradeType": "wechat_jsapi"//死值
806
- }
807
- try {
808
- let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/bank/rs/logic/BC_10001`, {data: val}, {
809
- resolveMsg: null,
810
- rejectMsg: null
811
- })
812
- if (res.data.status === 200) {
813
- console.log("调用结果", res.data, res.data.body.url)
814
- try {
815
- this.order = res.data
816
- this.othercharge_id = ''
817
- await this.saveOrder('create')
818
- if (this.othercharge_id) {
819
- this.isTimeout = false
820
- this.showQrCode = true
821
- console.log(this.order)
822
- this.$nextTick(() => {
823
- this.qrcode(res.data.body.url)
824
- })
825
- if (this.order.body.tradeNo) {
826
- this.timer1 = window.setInterval(this.getOrderInformation, 3000)
827
- }
828
- } else {
829
- this.$showMessage('创建订单失败!')
830
- }
831
- } catch (e) {
832
- this.$showMessage('创建订单失败!')
833
- }
834
- } else {
835
- this.$showMessage('获取二维码失败!')
836
- }
837
-
838
- } catch (e) {
839
- this.$showMessage('获取二维码失败,请检查网络!')
840
- }
841
- },
842
- qrcode(url) {
843
- new QRCode('qrcode', {
844
- text: url, // 设置二维码内容或跳转地址
845
- width: 266, // 设置宽度,单位像素
846
- height: 266, // 设置高度,单位像素
847
- correctLevel: QRCode.CorrectLevel.L //容错率,L/M/Hs
848
- })
849
- },
850
- // 获取订单信息
851
- async getOrderInformation() {
852
- const merchantMsg = Vue.config.telephone.ApproveConfig.merchantMsg
853
- // 查询订单信息
854
- console.log('查询订单信息!!!', this.order)
855
- try {
856
- let http = new HttpResetClass()
857
- let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/bank/rs/logic/BC_10003`, {
858
- data: {
859
- "service": "queryOrder",
860
- "outTradeNo": this.order.body.outTradeNo,
861
- "merchantMsg": merchantMsg,
862
- "tradeNo": ""
863
- }
864
- }, {
865
- resolveMsg: null,
866
- rejectMsg: null
867
- })
868
- // 支付成功
869
- this.orderstatus = res.data
870
- console.log('查询结果=======', res.data)
871
- if (res.data.status == '200') {
872
- window.clearInterval(this.timer1)
873
- console.log('支付成功', this.orderstatus)
874
- this.saveUserFile('update')
875
- this.order = {}
876
- }
877
- } catch (e) {
878
- window.clearInterval(this.timer1)
879
- this.$showMessage('创建订单失败!')
880
- this.order = {}
881
- }
882
- },
883
- getPaymentTerm() {
884
- let term = ''
885
- this.charge.payment_terms.forEach((row) => {
886
- term += `${row.f_payment_term} `
887
- })
888
- return term
889
- },
890
- closeQRCode() {
891
- clearTimeout(this.paymentInterval)
892
- clearTimeout(this.orderInterval)
893
- this.timeLeft = 300
894
- this.closeOrder()
895
- // 清除二维码
896
- this.clearQrCode()
897
- this.showQrCode = false
898
- },
899
- clearQrCode() {
900
- document.getElementById('qrcode').innerHTML = ''
901
- },
902
- /* async closeOrder() {
903
- let data = {
904
- "flag": "JsApiWeiNan",
905
- "f_filiale": "weinanchengtou",
906
- "f_out_trade_no": this.order.f_out_trade_no,// 商户单号
907
- "isClose": "是",
908
- "f_sys_trace": this.order.f_sys_trace // 交易流水号
909
- }
910
- let http = new HttpResetClass()
911
- let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/wx/rs/pay/microPayOrderStatus`, data, {
912
- resolveMsg: null,
913
- rejectMsg: '关闭失败!!!'
914
- })
915
- },*/
916
- async update() {
917
- let http = new HttpResetClass()
918
- for (let i = 0; i < this.material.length; i++) {
919
- if (this.material[i].f_state == '未收费') {
920
- this.material[i].f_state = '已收费'
921
- }
922
- }
923
- let data = {
924
- model: this.material
925
- }
926
- let res = await http.load('post', this.$androidUtil.getProxyUrl() + '/rs/logic/saveweinanmaterial', {data: data}, {
927
- resolveMsg: null,
928
- rejectMsg: '保存失败'
929
- })
930
- this.search()
931
- },
932
- async saveother() {
933
- let http = new HttpResetClass()
934
- let data1 = {
935
- tablename: 't_material_service',
936
- condition: `f_process_id = '${this.selectdata.f_process_id}' and f_state = '未收费'`
937
- }
938
- let res1 = await http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data1}, {
939
- resolveMsg: null,
940
- rejectMsg: '获取数据失败'
941
- })
942
- let data = {
943
- tablename: 't_userfiles',
944
- condition: `f_userinfo_id = '${this.selectdata.model.f_userinfo_id}'`
945
- }
946
- let res = await http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
947
- resolveMsg: null,
948
- rejectMsg: '获取数据失败'
949
- })
950
- let otherdetails = []
951
- for (let i = 0; i < res1.data.length; i++) {
952
- otherdetails.push(
953
- {
954
- "f_brand_spec": [res1.data[i].f_material_name],
955
- "f_unitprice": res1.data[i].f_material_price,
956
- "f_typename": [res1.data[i].f_typename],
957
- "f_typenumber": [res1.data[i].f_typenumber],
958
- "f_number": res1.data[i].f_material_number
959
- }
960
- )
961
- }
962
-
963
- console.log("查询的用户信息", otherdetails)
964
- let data2 = {
965
- "record_userinfo": this.selectdata.model.f_userinfo_id,
966
- "f_userfiles_id": res.data[0].f_userfiles_id,
967
- "f_user_id": res.data[0].f_user_id,
968
- "f_user_name": this.selectdata.model.f_user_name,
969
- "f_address": this.selectdata.model.f_address,
970
- "f_user_type": this.selectdata.model.f_user_type,
971
- "f_gasproperties": "",
972
- "f_collection": this.f_cost_sum,
973
- "f_comments": "",
974
- "f_payment": this.charge.f_payment_method,
975
- "f_voucher_number": "",
976
- "f_bill_style": "普通收据",
977
- "f_userinfo_id": this.selectdata.model.f_userinfo_id,
978
- "f_service_person": Vue.user.name,
979
- "f_operat_type": "其他收费",
980
- "f_describe": "",
981
- "f_state": "有效",
982
- "f_operator": Vue.user.name,
983
- "f_operatorid": Vue.user.id,
984
- "f_orgid": Vue.user.orgid,
985
- "f_orgname": Vue.user.orgs,
986
- "f_depid": Vue.user.depids,
987
- "f_depname": Vue.user.f_department_name,
988
- "t_userfees": "",
989
- "f_fee_type": "其他费用",
990
- "f_fee_time": "12",
991
- "otherdetail": otherdetails
992
- }
993
-
994
- let res2 = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/logic/sale_othercharge_logic`, {data: data2}, {
995
- resolveMsg: null,
996
- rejectMsg: '保存数据失败'
997
- })
998
- },
999
- async shoufei() {
1000
- let http = new HttpResetClass()
1001
- let data = {
1002
- tablename: 't_material_service',
1003
- condition: `f_process_id = '${this.selectdata.f_process_id}' and f_state = '未收费'`
1004
- }
1005
- let res = await http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
1006
- resolveMsg: null,
1007
- rejectMsg: '获取数据失败'
1008
- })
1009
- if (res.data.length <= 0) {
1010
- this.$showMessage('请先添加未收费的材料!!!')
1011
- return
1012
- }
1013
- this.f_cost_sum = 0
1014
- for (let i = 0; i < res.data.length; i++) {
1015
- this.f_cost_sum += Number(res.data[i].f_fee)
1016
- }
1017
- this.showCharge = true
1018
- this.charge.payment_terms[0].f_charge_money = this.f_cost_sum
1019
- },
1020
- accMul(arg1, arg2) {
1021
- let m = 0, s1 = arg1.toString(), s2 = arg2.toString();
1022
- try {
1023
- m += s1.split(".")[1].length
1024
- } catch (e) {
1025
- }
1026
- try {
1027
- m += s2.split(".")[1].length
1028
- } catch (e) {
1029
- }
1030
- return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
1031
- },
1032
- },
1033
- beforeDestroy() {
1034
- console.log('销毁了-----111', this.timer1)
1035
- window.clearInterval(this.timer1)
1036
- },
1037
- events: {},
1038
- computed: {
1039
- paymentMethod() {
1040
- return this.$appdata.getParam("付款方式")
1041
- },
1042
- paymentTerm() {
1043
- return this.$appdata.getParam("收费项目")
1044
- }
1045
- },
1046
- watch: {}
1047
- }
1048
- </script>
1049
- <style lang="less" scoped>
1050
- .head-but {
1051
- margin-left: 5px;
1052
- height: 34px;
1053
- /*background-color: #6aa6e2;*/
1054
- border-radius: 4px;
1055
- font-family: PingFang;
1056
- color: #ffffff;
1057
- }
1058
-
1059
- /*清除model中的浮动*/
1060
- .clearfix:after, .clearfix:before {
1061
- display: table;
1062
- }
1063
-
1064
- .clearfix:after {
1065
- clear: both;
1066
- }
1067
-
1068
- .lab_sty {
1069
- margin-bottom: 0;
1070
- display: flex;
1071
- flex-direction: row-reverse;
1072
- align-items: center;
1073
- }
1074
-
1075
- .row_sty {
1076
- display: flex;
1077
- align-items: center;
1078
- margin: 5px;
1079
- }
1080
-
1081
- </style>
1
+ <template>
2
+ <work-busy :is-busy="button_state"></work-busy>
3
+ <div>
4
+ <div style="height: auto;width: 100%;margin: 30px 0" v-if="showQrCode">
5
+ <div partial>
6
+ <div class="" align="center">
7
+ <div style="margin-bottom:10px "><img src="../../../assets/scanCode.png">请扫描下方二维码进行付款</div>
8
+ <div class="row app-row">
9
+ <div class="col-xs-12">
10
+ <label class="font text-left">订单编号:{{ order.body.tradeNo }}</label>
11
+ </div>
12
+ <!-- <div class="col-xs-8">
13
+ <input type="text" class ="search_input input-font" v-model="order.body.tradeNo" />
14
+ </div>-->
15
+ </div>
16
+ <!-- <div class="row app-row">
17
+ <div class="col-xs-4">
18
+ <label class="font text-left">订单状态:</label>
19
+ </div>
20
+ <div class="col-xs-8">
21
+ <input type="text" class ="search_input input-font" v-model="orderstatus.msg" />
22
+ </div>
23
+ </div>-->
24
+ <!--<div @click="callBack('支付成功')">返回</div>-->
25
+ </div>
26
+ <div class="" align="center">
27
+ <div class="QR-code" v-if="payType=='二维码支付'">
28
+ <img src="../../../assets/qrcode_no.png" v-show="isTimeout" style="width: 266px;height: 266px"/>
29
+ <div id="qrcode" style="margin-top: 25px;width: 266px;height: 266px"></div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ <div v-show="!showQrCode">
35
+ <apply-material-one v-for="(i, item) in material " :index="$index" :item="item"
36
+ :materialnameandcode="materialnameandcode"
37
+ :newmaterialnameandcode="newmaterialnameandcode"
38
+ :newmaterialnameandtype="newmaterialnameandtype"
39
+ :typenumbers="materialtypenumber" @number_chenge="getChangePayNumber"
40
+ @delete_material="delete_material"></apply-material-one>
41
+ <div style="padding: 10px;display: flex;justify-content: space-around;">
42
+ <button type="button" class="btn btn-primary" @click="addUserFile">添加</button>
43
+ </div>
44
+
45
+ <div class="row">
46
+ <label class="text-justify lb-left" style="width: 100px">收款</label>
47
+ <!-- <div class="row">
48
+
49
+ <data-grid partial='list' v-ref:grid :model="{rows:summarize}" v-show="summarize.length>0" class="list_area table_sy">
50
+ <template partial='head'>
51
+ <tr>
52
+ <th>
53
+ <nobr>收费类型</nobr>
54
+ </th>
55
+ <th>
56
+ <nobr>数量</nobr>
57
+ </th>
58
+ <th>
59
+ <nobr>总金额</nobr>
60
+ </th>
61
+ </tr>
62
+ </template>
63
+ <template partial='body'>
64
+ <td style="text-align: center;">
65
+ <nobr>{{row.material_type }}</nobr>
66
+ </td>
67
+ <td style="text-align: center;">
68
+ <nobr>{{ row.amount }}</nobr>
69
+ </td>
70
+ <td style="text-align: center;">
71
+ <nobr>{{ row.money }}</nobr>
72
+ </td>
73
+ </template>
74
+ </data-grid>
75
+ &lt;!&ndash; <div v-for="item in summarize" style="display: flex;justify-content: center;">
76
+ {{item.}} - {{item.}} - {{item.}}
77
+ </div>&ndash;&gt;
78
+ </div>-->
79
+ <div class="row row_sty">
80
+ <label class="lab_sty col-xs-4">收费优惠金额</label>
81
+ <div class="col-xs-8">
82
+ <input type="number" class="form-control" v-model="f_discounts_money_materials" :value.sync="f_discounts_money_materials" @change="getChangePayNumber()">
83
+ </div>
84
+ </div>
85
+ <div class="row row_sty">
86
+ <label class="lab_sty col-xs-4">总优惠金额</label>
87
+ <div class="col-xs-8">
88
+ <input type="number" class="form-control" v-model="f_discounts_money" :value.sync="f_discounts_money" readonly>
89
+ </div>
90
+ </div>
91
+ <div class="row row_sty">
92
+ <label class="lab_sty col-xs-4">合计金额</label>
93
+ <div class="col-xs-8">
94
+ <input type="number" class="form-control" v-model="payNumber" :value.sync="payNumber" readonly>
95
+ </div>
96
+ </div>
97
+ <div class="row row_sty">
98
+ <label class="lab_sty col-xs-4">收款方式</label>
99
+ <div class="col-xs-8">
100
+ <v-select
101
+ :width="'100%'"
102
+ :value.sync="payType"
103
+ v-model="payType"
104
+ :options='payTypes'
105
+ placeholder='请选择'
106
+ close-on-select
107
+ :value-single="true"
108
+ ></v-select>
109
+ </div>
110
+ </div>
111
+ <!-- <div class="y-form-item" v-if="payType=='二维码支付'">
112
+ <div id="qrcode" class="qrcode" v-ref:qrcode></div>
113
+ </div>-->
114
+ </div>
115
+ <div style="padding: 10px;display: flex;justify-content: space-around;">
116
+ <button type="button" name="button" class="btn btn-primary btn-sm" style="float: right;margin-right:10px;"
117
+ @click="beforeSaveCharge()">保存
118
+ </button>
119
+ <button type="button" class="btn btn-primary" @click="cancel">取消</button>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </template>
124
+
125
+ <script>
126
+ import Vue from 'vue'
127
+ import {HttpResetClass} from 'vue-client'
128
+ import QRCode from 'qrcodejs2'
129
+ import {isEmpty} from '../../../components/Util'
130
+
131
+ export default {
132
+ title: '材料添加',
133
+ props: {
134
+ selectdata: {
135
+ type: Object
136
+ }
137
+ },
138
+ data() {
139
+ return {
140
+ f_discounts_money_materials:0,
141
+ f_discounts_money:0,
142
+ materialname: [],
143
+ materialTYPE: [],
144
+ materialnameandcode: [],
145
+ newmaterialnameandcode: [],
146
+ materialtypenumber: [],
147
+ newmaterialnameandtype: [],
148
+ category: {},
149
+ //支付方式
150
+ payType: '',
151
+ //支付总额
152
+ payNumber: 0,
153
+ newPayNumber: 0,
154
+ //支付方式选择框
155
+ // payTypes: [{label: '现金', value: '现金'}, {label: '二维码支付', value: '二维码支付'}],
156
+ payTypes: [{label: '现金', value: '现金'},{label: '扫码支付', value: '扫码支付'}],
157
+ materialImges: [],
158
+ showFile: false,
159
+ material: [],
160
+ positions: this.$appdata.getParam('品名及规格'), // 获取材料名称
161
+ charge: {
162
+ payment_terms: [{f_payment_term: '', f_charge_money: '', f_amount_words: '', f_payment_method: ''}]
163
+ }, // 收费内容
164
+ showCharge: false, // 收费显示
165
+ timeLeft: 300, // 收费时间
166
+ title1: '', // 二维码标题
167
+ showQrCode: false, // 二维码显示
168
+ order: {}, // 订单信息
169
+ f_cost_sum: 0, // 总收费
170
+ othercharge_id: '',
171
+ button_state: false,
172
+ summarize: []//材料收费方式汇总
173
+ }
174
+ },
175
+ ready() {
176
+
177
+ //this.search()
178
+ this.getAllMaterial()
179
+ // this.getmaterial()
180
+ // this.getmaterialTYPE()
181
+
182
+ },
183
+ methods: {
184
+ delete_material(i) {
185
+ console.log('删除项====', i)
186
+ this.material.splice(i, 1)
187
+ this.getChangePayNumber()
188
+ },
189
+ async beforeSaveCharge() {
190
+ console.log("977666")
191
+ if (this.material.length == 0) {
192
+ return this.$showMessage(`请先添加消耗的材料!`)
193
+ }
194
+ for (let index = 0; index < this.material.length; index++) {
195
+ const item = this.material[index]
196
+ if (!item.f_material_name) {
197
+ this.$showMessage(`请选择材料${index + 1}的材料名称`)
198
+ return;
199
+ }
200
+ if (!item.f_typenumber) {
201
+ this.$showMessage(`请选择材料${index + 1}的型号`)
202
+ return;
203
+ }
204
+ if (!item.f_material_price) {
205
+ this.$showMessage(`请填写材料${index + 1}的单价`)
206
+ return;
207
+ }
208
+ if (!item.f_material_number || item.f_material_number == 0) {
209
+ this.$showMessage(`请填写材料${index + 1}的数量`)
210
+ return;
211
+ }
212
+ }
213
+ /*if(this.materialImges.length===0){
214
+ this.$showMessage(`至少有一张材料照片`)
215
+ return;
216
+ }*/
217
+ if (!this.payType) {
218
+ this.$showMessage(`请选择缴费方式`)
219
+ return;
220
+ }
221
+ this.button_state = true
222
+ try {
223
+ if (this.payType.indexOf('现金') != -1) {
224
+ await this.saveUserFile('save')
225
+ } else {
226
+ await this.openQrCode()
227
+ }
228
+ this.button_state = false
229
+ } catch (e) {
230
+ this.$showMessage(`材料收费失败!请检查网络`)
231
+ this.button_state = false
232
+ }
233
+ },
234
+ cancel() {
235
+ this.$emit('aftersave')
236
+ },
237
+ getAllMaterial() {
238
+ new HttpResetClass().load('POST', this.$androidUtil.getProxyUrl() + `/rs/sql/tel_singleTable_OrderBy?pageNo=1&pageSize=99999`, {
239
+ data: {
240
+ items: '*',
241
+ tablename: 't_material_info',
242
+ condition: `org_id = '${Vue.user.orgid}'`,
243
+ orderitem: 'id desc'
244
+ }
245
+ }, {resolveMsg: null, rejectMsg: null}).then(res => {
246
+ const typeNames = res.data.filter((item) => item.type === '报建')
247
+ const materialNames = res.data.filter((item) => item.type === '材料')
248
+ const materialNumbers = res.data.filter((item) => item.type === '型号')
249
+ console.log(typeNames, materialNames, materialNumbers)
250
+ const newMaterialNames = materialNames.map((item) => {
251
+ const typeName = typeNames.filter((res) => {
252
+ return res.id == item.parent_id
253
+ })
254
+ return {
255
+ id: item.id,
256
+ typeName: typeName[0],
257
+ materialName: item
258
+ }
259
+ })
260
+ //所有材料
261
+ console.log("988", newMaterialNames)
262
+ for (let i = 0; i < newMaterialNames.length ; i++) {
263
+ this.newmaterialnameandcode.push({
264
+ label: newMaterialNames[i].materialName.name,
265
+ value: newMaterialNames[i].materialName,
266
+ })
267
+ }
268
+ // 所有型号
269
+ this.newmaterialnameandtype =materialNumbers
270
+ }).catch((e) => {
271
+ console.log("933", e)
272
+ })
273
+ },
274
+ sortArrayByCodeAscending(dataArray) {
275
+ // Convert the "code" property to a number for sorting
276
+ dataArray.forEach(item => {
277
+ item.newCode = parseFloat(item.code);
278
+ });
279
+
280
+ // Sort the array based on the "code" property
281
+ dataArray.sort((a, b) => a.newCode - b.newCode);
282
+
283
+ return dataArray;
284
+ },
285
+ getChangePayNumber() {
286
+ this.payNumber = 0
287
+ this.summarize = []
288
+ this.f_discounts_money = 0
289
+ for (let i = 0; i < this.material.length; i++) {
290
+ this.material[i].f_fee = (this.material[i].f_material_price * this.material[i].f_material_number) + (this.material[i].f_overlength_unitprice * this.material[i].f_overlength_number) - this.material[i].f_discounts_money_detail
291
+ this.payNumber += Number(this.material[i].f_fee)
292
+ this.f_discounts_money += Number(this.material[i].f_discounts_money_detail)
293
+ // let res=this.checkSummarize(this.material[i].material_type)
294
+ /* if(res.has){
295
+ this.summarize[res.idx].amount+= 1
296
+ this.summarize[res.idx].money+= Number(this.material[i].f_fee)
297
+ }else{
298
+ this.summarize.push({material_type:this.material[i].material_type,amount:1,money:this.material[i].f_fee})
299
+ } */
300
+ }
301
+ this.payNumber -= Number(this.f_discounts_money_materials)
302
+ this.f_discounts_money += Number(this.f_discounts_money_materials)
303
+ console.log('this.summarize------------', this.summarize)
304
+ },
305
+ checkSummarize(name) {
306
+ let result = {idx: null, has: false}
307
+ this.summarize.forEach((item, idx) => {
308
+ if (item.material_type == name) {
309
+ result.idx = idx
310
+ result.has = true
311
+ }
312
+ })
313
+ console.log('result', result)
314
+ return result
315
+ },
316
+ getsutitle(val) {
317
+ return val
318
+ },
319
+ loadOptions(index) {
320
+ // const data = {
321
+ // tablename: 't_material_info',
322
+ // condition: "1 = 1 and code = '" + this.material[index].f_material_code + "'"
323
+ // }
324
+ // this.$resetpost(this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data}, {
325
+ // resolveMsg: null,
326
+ // rejectMsg: '获取数据失败'
327
+ // }).then((res) => {
328
+ // for (let material of res.data) {
329
+ // switch (material.type) {
330
+ // case '分类' :
331
+ // this.$set('material[' + index + '].f_typename', material.name)
332
+ // break
333
+ // case '品名' :
334
+ // this.$set('material[' + index + '].f_material_name', material.name)
335
+ // break
336
+ // case '型号' :
337
+ // this.$set('material[' + index + '].f_typenumber', material.name)
338
+ // this.$set('material[' + index + '].unit', material.unit)
339
+ // this.$set('material[' + index + '].f_material_price', material.price)
340
+ // break
341
+ // }
342
+ // }
343
+ // this.$set('material', JSON.parse(JSON.stringify(this.material)))
344
+ // })
345
+ const data = {
346
+ code: this.material[index].f_material_code
347
+ }
348
+ this.$resetpost(this.$androidUtil.getProxyUrl() + '/rs/sql/getMaterialByCode', {data}, {
349
+ resolveMsg: null,
350
+ rejectMsg: '获取数据失败'
351
+ }).then((res) => {
352
+ for (let material of res.data) {
353
+ this.$set('material[' + index + '].f_typename', material.f_typename)
354
+ this.$set('material[' + index + '].f_material_name', material.f_material_name)
355
+ this.$set('material[' + index + '].f_typenumber', material.f_typenumber)
356
+ this.$set('material[' + index + '].unit', material.unit)
357
+ this.$set('material[' + index + '].f_material_price', material.f_material_price)
358
+ }
359
+ this.$set('material', JSON.parse(JSON.stringify(this.material)))
360
+ })
361
+
362
+ },
363
+ // 删除未保存的材料信息
364
+ async deleteUserFile(index) {
365
+ this.material.splice(index, 1)
366
+ },
367
+ // 追加材料信息
368
+ addUserFile() {
369
+ this.material.push({
370
+ f_material_name: "",
371
+ unit: 0,
372
+ f_material_price: 0,
373
+ f_typenumber: "",
374
+ f_typename: "",
375
+ material_type: "",
376
+ f_overlength_unitprice:"0",
377
+ f_overlength_number:"0",
378
+ f_discounts_money_detail:"0",
379
+ f_actual_materials_detail:"0"
380
+ })
381
+ },
382
+ getmaterialTYPE() {
383
+ let http = new HttpResetClass()
384
+ let data = {
385
+ tablename: 't_material_service',
386
+ condition: `1=1`
387
+ }
388
+ http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
389
+ resolveMsg: null,
390
+ rejectMsg: '获取数据失败'
391
+ }).then(res => {
392
+ console.log("XXX", res.data.length)
393
+ for (let i = 0; i < res.data.length; i++) {
394
+
395
+ this.materialTYPE.push({
396
+ label: res.data[i].f_typenumber,
397
+ value: res.data[i].f_typenumber
398
+ })
399
+ }
400
+ if (this.materialTYPE.length <= 0) {
401
+ this.materialTYPE = [{}]
402
+ }
403
+ this.materialtypenumber = Array.from(new Set(this.materialTYPE.map(item => item.label)))
404
+ .map(label => {
405
+ return this.materialTYPE.find(item => item.label === label);
406
+ })
407
+ console.log("XXX", this.materialtypenumber)
408
+ })
409
+ return this.materialtypenumber
410
+ },
411
+ getmaterial() {
412
+ let http = new HttpResetClass()
413
+ let data = {
414
+ tablename: 't_material_service',
415
+ condition: `1=1`
416
+ }
417
+ http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
418
+ resolveMsg: null,
419
+ rejectMsg: '获取数据失败'
420
+ }).then(res => {
421
+ console.log("XXX", res.data.length)
422
+ for (var i = 0; i < res.data.length; i++) {
423
+
424
+ this.materialname.push({
425
+ label: '[' + res.data[i].f_material_code + ']' + res.data[i].f_material_name,
426
+ value: res.data[i].f_material_name
427
+ }
428
+ )
429
+ }
430
+ if (this.materialname.length <= 0) {
431
+ this.materialname = [{}]
432
+ }
433
+ this.materialnameandcode = Array.from(new Set(this.materialname.map(item => item.label)))
434
+ .map(label => {
435
+ return this.materialname.find(item => item.label === label);
436
+ })
437
+ this.materialname = this.materialname.map(item => {
438
+ item.label = item.label.replace(/null/g, "空")
439
+ return item;
440
+ });
441
+ console.log("XXX", this.materialnameandcode)
442
+ })
443
+ return this.materialnameandcode
444
+ },
445
+ search() {
446
+ let http = new HttpResetClass()
447
+ let data = {
448
+ tablename: 't_material_service',
449
+ condition: `f_process_id = '${this.selectdata.f_process_id}'`
450
+ }
451
+ http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
452
+ resolveMsg: null,
453
+ rejectMsg: '获取数据失败'
454
+ }).then(res => {
455
+ this.material = res.data
456
+ if (this.material.length <= 0) {
457
+ this.addUserFile()
458
+ } else {
459
+ this.getAllMaterialImg()
460
+ this.getChangePayNumber()
461
+ }
462
+ })
463
+
464
+
465
+ },
466
+ getAllMaterialImg() {
467
+ let http = new HttpResetClass()
468
+ let data = {
469
+ tablename: 't_material_img',
470
+ condition: `f_process_id = '${this.selectdata.f_process_id}'`
471
+ }
472
+ http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
473
+ resolveMsg: null,
474
+ rejectMsg: '获取数据失败'
475
+ }).then(result => {
476
+ let tempArr = []
477
+ let tempArrary = []
478
+ result = result.data
479
+ for (let i = 0; i < result.length; i++) {
480
+
481
+ if (!tempArr.includes(result[i].f_path)) {
482
+ let temp = {}
483
+ temp.id = result[i].id
484
+ temp.android_file = result[i].f_path
485
+ temp.imgpath = ''
486
+ temp.path = 'http://newimg/storage/emulated/0/Download/safecheck/' + result[i].f_path
487
+ tempArr.push(result[i].f_path)
488
+ tempArrary.push(temp)
489
+ }
490
+ }
491
+ this.materialImges = tempArrary
492
+ })
493
+ },
494
+ // 获取品名规格
495
+ setTypename(i, val) {
496
+ let ac = this.$appdata.getParam(val)
497
+ this.$set('material[' + i + '].typeNameList', ac)
498
+ this.$set('material[' + i + '].typeNumberList', [])
499
+ this.$set('material[' + i + '].f_typenumber', null)
500
+ this.$set('material[' + i + '].f_material_price', 0)
501
+ },
502
+ // 获取类型
503
+ setTypenumber(i, val) {
504
+ let ac = this.$appdata.getParam(val)
505
+ this.$set('material[' + i + '].typeNumberList', ac)
506
+ this.$set('material[' + i + '].f_material_price', 0)
507
+ },
508
+ // 获取单价
509
+ setmaterialprice(i, val) {
510
+ var num
511
+ if (val == null) {
512
+ num = 0
513
+ }
514
+ num = this.$appdata.getSingleValue(val)
515
+ this.$set('material[' + i + '].f_material_price', num)
516
+ },
517
+ // 金额计算
518
+ smallnum(val, val1) {
519
+ let num = Number(val) * Number(val1)
520
+ return num
521
+ },
522
+ getCheckMessage() {
523
+ let tempArr = this.material
524
+ if (!tempArr.length > 0) {
525
+ return '请选择材料后上传'
526
+ }
527
+ for (let i = 0; i < tempArr.length; i++) {
528
+ if (tempArr[i].f_process_id) {
529
+ continue
530
+ }
531
+
532
+ if (!tempArr[i].f_material_price) {
533
+ return '请输入材料单价'
534
+ }
535
+ if (!tempArr[i].f_material_number) {
536
+ return '请输入材料数量'
537
+ }
538
+ }
539
+ /* if (this.materialImges.length == 0) {
540
+ return '材料清单需拍照'
541
+ } */
542
+ return null
543
+
544
+ },
545
+ /*async saveUserFile1() {
546
+ let message = this.getCheckMessage()
547
+ if (message) {
548
+ this.$showMessage(message)
549
+ return
550
+ }
551
+ let imgs = []
552
+ for (let i = 0; i < this.materialImges.length; i++) {
553
+ let it = {}
554
+ if (this.materialImges[i].id) {
555
+ it = {
556
+ f_path: this.materialImges[i].path,
557
+ id: this.materialImges[i].id,
558
+ f_process_id: this.selectdata.f_process_id
559
+ }
560
+ } else {
561
+ it = {
562
+ f_path: this.materialImges[i].path,
563
+ f_process_id: this.selectdata.f_process_id
564
+ }
565
+ }
566
+ imgs.push(it)
567
+ }
568
+ for (let i = 0; i < this.material.length; i++) {
569
+ this.material[i].f_process_id = this.selectdata.f_process_id
570
+ if (isEmpty(this.material[i].f_state)) {
571
+ this.material[i].f_state = '未收费'
572
+ }
573
+ }
574
+ let data = {
575
+ model: this.material,
576
+ imgs: imgs,
577
+ f_process_id: this.selectdata.f_process_id
578
+ }
579
+ console.log('------------------',data)
580
+ new HttpResetClass().load('POST',this.$androidUtil.getProxyUrl() +`/rs/logic/saveMaterialService`, data,{resolveMsg:null,rejectMsg:null}).then(res=>{
581
+ console.log(res)
582
+ this.model.rows=res.data
583
+ }).catch((e)=>{
584
+ console.log("933",e)
585
+ })
586
+ /!* console.log('------------------',data)
587
+ HostApp.__this__ = this
588
+ HostApp.logicWithHint({
589
+ // logic别名,key必须为logic
590
+ 'logic': 'saveMaterialServiceAndroid',
591
+ // 回调执行方法名,key必须为callback
592
+ 'callback': 'javascript:HostApp.__this__.uploadCallback1()',
593
+ // logic执行需要的业务参数
594
+ 'data': data,
595
+ // 固定key,代表是否将logic执行结果作为参数传入回调方法,1代表true,0代表false,
596
+ // 执行回调方法传入key为backresult
597
+ // 如需额外拼接参数,写在logic返回值的params,例如xxlogic返回:{"params": "success"}
598
+ 'backresult': 1
599
+ }) *!/
600
+ },*/
601
+ uploadCallback1(result) {
602
+
603
+ if (result.state == 'ok' && JSON.parse(result.result).code == 200) {
604
+ this.$showMessage('材料保存成功!!!')
605
+ } else {
606
+ this.$showMessage(JSON.parse(result.result).msg)
607
+ }
608
+ },
609
+ async saveUserFile(type) {
610
+ for (let i = 0; i < this.material.length; i++) {
611
+ this.material[i].f_material_name=this.material[i].f_material_name.name
612
+ this.material[i].f_typenumber=this.material[i].f_typenumber.name
613
+ this.material[i].f_process_id = this.selectdata.f_process_id
614
+ this.material[i].f_department = Vue.user.f_department_name
615
+ this.material[i].f_fee = this.material[i].f_material_price * this.material[i].f_material_number
616
+ if (isEmpty(this.material[i].f_state)) {
617
+ this.material[i].f_state = null
618
+ }
619
+ }
620
+ await this.saveOrder(type)
621
+ },
622
+ async saveOrder(type) {
623
+ console.log('this.material', this.material)
624
+ let otherdetail = []
625
+ if (this.payNumber == 0) {
626
+ otherdetail.push({
627
+ f_brand_spec: ['维修'],
628
+ f_typename: ['材料费'],
629
+ f_typenumber: [],
630
+ f_unitprice: 0,
631
+ f_number: this.material.length
632
+ })
633
+ } else {
634
+ this.material.forEach((row) => {
635
+ if (row.f_material_price != 0) {
636
+ otherdetail.push({
637
+ f_brand_spec: [`${row.material_type? row.material_type : '材料费'}`],
638
+ f_typename: [`${row.f_material_name.name}`],
639
+ f_typenumber: [`${row.f_typenumber.name}`],
640
+ f_unitprice: row.f_material_price,
641
+ f_number: row.f_material_number,
642
+ f_overlength_unitprice:row.f_overlength_unitprice,
643
+ f_overlength_number:row.f_overlength_number,
644
+ f_discounts_money_detail:row.f_discounts_money_detail,
645
+ f_actual_materials_detail:row.f_actual_materials_detail
646
+ })
647
+ }
648
+ })
649
+ }
650
+
651
+ let param = {
652
+ model: this.material,
653
+ operator_type: type,
654
+ othercharge_id: this.othercharge_id,
655
+ f_process_id: this.selectdata.f_process_id,
656
+ other: {
657
+ "record_userinfo": this.selectdata.model.f_userinfo_id,
658
+ //"f_userfiles_id": '',
659
+ //"f_user_id": '',
660
+ "f_user_name": this.selectdata.model.f_user_name,
661
+ "f_address": this.selectdata.model.f_address,
662
+ "f_user_type": this.selectdata.model.f_user_type,
663
+ "f_gasproperties": "",
664
+ "f_collection": this.payNumber,
665
+ "f_comments": `${Vue.user.name}进行维修材料收费,收费方式-${this.payType} ${this.order.body && this.order.body.tradeNo ? '。支付订单号:' + this.order.body.tradeNo : ''}`,
666
+ "f_payment": this.payType,
667
+ "f_voucher_number": this.selectdata.f_process_id,
668
+ "f_bill_style": "普通收据",
669
+ "f_userinfo_id": this.selectdata.model.f_userinfo_id,
670
+ "f_service_person": Vue.user.name,
671
+ "f_operat_type": "维修收费",
672
+ "f_describe": "",
673
+ "f_serial_id": this.order.body ? this.order.body.tradeNo : null,
674
+ "f_state": type == 'create' ? '无效' : '有效',
675
+ "f_operator": Vue.user.name,
676
+ "f_discounts_money_materials": this.f_discounts_money_materials,
677
+ "f_discounts_money": this.f_discounts_money,
678
+ "f_operatorid": Vue.user.id,
679
+ "f_orgid": Vue.user.orgid,
680
+ "f_orgname": Vue.user.orgs,
681
+ "f_depid": Vue.user.depids,
682
+ "f_depname": Vue.user.f_department_name,
683
+ "t_userfees": "",
684
+ "f_fee_type": "维修费用",
685
+ "f_fee_time": "12",
686
+ "otherdetail": otherdetail
687
+ }
688
+ }
689
+ console.log("要保存了666-------data2", param)
690
+ let res = await new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/logic/saveMaterialService`, param, {
691
+ resolveMsg: null,
692
+ rejectMsg: null
693
+ })
694
+ console.log('res.data', res.data)
695
+ if (res.data.code == 200) {
696
+ if (type === 'create') {
697
+ // this.$showMessage('收费记录创建成功!!!')
698
+ this.othercharge_id = res.data.othercharge_id
699
+ // this.$emit('aftersave')
700
+ } else {
701
+ this.$showMessage('材料保存成功!!!')
702
+ this.$emit('aftersave')
703
+ }
704
+
705
+ } else {
706
+ this.$showMessage(res.data.msg)
707
+ }
708
+ },
709
+ uploadCallback(result) {
710
+ if (result.state == 'ok' && JSON.parse(result.result).code == 200) {
711
+ this.$showMessage('材料保存成功!!!')
712
+ } else {
713
+ this.$showMessage(JSON.parse(result.result).msg)
714
+ }
715
+ },
716
+ // 关闭对话框
717
+ closeModal() {
718
+ this.showCharge = false
719
+ this.charge = {
720
+ payment_terms: [{
721
+ f_payment_term: '',
722
+ f_charge_money: '',
723
+ f_amount_words: '',
724
+ f_payment_method: this.charge.f_payment_method
725
+ }]
726
+ }
727
+ },
728
+ // 金额转大写
729
+ handleInput(index) {
730
+ // 通过正则过滤小数点后两位
731
+ console.log('-----------------------')
732
+ this.charge.payment_terms[index].f_charge_money = (this.charge.payment_terms[index].f_charge_money.match(/^\d*(\.?\d{0,2})/g)[0]) || null
733
+ this.charge.payment_terms[index].f_amount_words = this.smalltoBIG(this.charge.payment_terms[index].f_charge_money)
734
+ },
735
+ // 金额转大写
736
+ smalltoBIG(n) {
737
+ let fraction = ['角', '分'];
738
+ let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
739
+ let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
740
+ let head = n < 0 ? '欠' : '';
741
+ n = Math.abs(n);
742
+
743
+ let s = '';
744
+
745
+ for (var i = 0; i < fraction.length; i++) {
746
+ s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
747
+ }
748
+ s = s || '整';
749
+ n = Math.floor(n);
750
+
751
+ for (var i = 0; i < unit[0].length && n > 0; i++) {
752
+ let p = '';
753
+ for (var j = 0; j < unit[1].length && n > 0; j++) {
754
+ p = digit[n % 10] + unit[1][j] + p;
755
+ n = Math.floor(n / 10);
756
+ }
757
+ s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
758
+ }
759
+ return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
760
+ },
761
+ moneyChange(index) {
762
+ console.log(`当前下标----${index}`)
763
+ if (isEmpty(this.charge.payment_terms[index].f_charge_money) || Number(this.charge.payment_terms[index].f_charge_money) === 0) {
764
+ this.$showMessage('单笔收费不能为0元!!!', 'warning', 3000)
765
+ this.charge.payment_terms[index].f_charge_money = null
766
+ return
767
+ }
768
+ },
769
+ async TimeQrCode() {
770
+ this.qrcodeTimer = setTimeout(() => {
771
+ // 关闭二维码
772
+ this.clearQrCode()
773
+ // 将定时器清除
774
+ this.qrcodeTimer = null;
775
+ clearInterval(this.orderInterval)
776
+ }, 60 * 1000)
777
+
778
+ },
779
+ generateRandomString(length) {
780
+ let result = new Date().getTime().toString()
781
+ const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
782
+ const charactersLength = characters.length;
783
+ for (let i = 0; i < length; i++) {
784
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
785
+ }
786
+ return result.substring(0, 30);
787
+ },
788
+ // 打开二维码
789
+ async openQrCode() {
790
+ const merchantMsg = Vue.config.telephone.ApproveConfig.merchantMsg
791
+ if (!merchantMsg){
792
+ this.$showMessage('未配备商户号,请联系管理员!')
793
+ return
794
+ }
795
+ const outTradeNo = this.generateRandomString(30)
796
+ // 下订单
797
+ let http = new HttpResetClass()
798
+ const val = {
799
+ "body": "燃气费",
800
+ "detail": "燃气费",
801
+ "totalAmount": (this.payNumber * 100).toString(),
802
+ "merchantMsg": merchantMsg,//商户id
803
+ "outTradeNo": outTradeNo,//随机数30位
804
+ "service": "nativePay",//死值
805
+ "tradeType": "wechat_jsapi"//死值
806
+ }
807
+ try {
808
+ let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/bank/rs/logic/BC_10001`, {data: val}, {
809
+ resolveMsg: null,
810
+ rejectMsg: null
811
+ })
812
+ if (res.data.status === 200) {
813
+ console.log("调用结果", res.data, res.data.body.url)
814
+ try {
815
+ this.order = res.data
816
+ this.othercharge_id = ''
817
+ await this.saveOrder('create')
818
+ if (this.othercharge_id) {
819
+ this.isTimeout = false
820
+ this.showQrCode = true
821
+ console.log(this.order)
822
+ this.$nextTick(() => {
823
+ this.qrcode(res.data.body.url)
824
+ })
825
+ if (this.order.body.tradeNo) {
826
+ this.timer1 = window.setInterval(this.getOrderInformation, 3000)
827
+ }
828
+ } else {
829
+ this.$showMessage('创建订单失败!')
830
+ }
831
+ } catch (e) {
832
+ this.$showMessage('创建订单失败!')
833
+ }
834
+ } else {
835
+ this.$showMessage('获取二维码失败!')
836
+ }
837
+
838
+ } catch (e) {
839
+ this.$showMessage('获取二维码失败,请检查网络!')
840
+ }
841
+ },
842
+ qrcode(url) {
843
+ new QRCode('qrcode', {
844
+ text: url, // 设置二维码内容或跳转地址
845
+ width: 266, // 设置宽度,单位像素
846
+ height: 266, // 设置高度,单位像素
847
+ correctLevel: QRCode.CorrectLevel.L //容错率,L/M/Hs
848
+ })
849
+ },
850
+ // 获取订单信息
851
+ async getOrderInformation() {
852
+ const merchantMsg = Vue.config.telephone.ApproveConfig.merchantMsg
853
+ // 查询订单信息
854
+ console.log('查询订单信息!!!', this.order)
855
+ try {
856
+ let http = new HttpResetClass()
857
+ let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/bank/rs/logic/BC_10003`, {
858
+ data: {
859
+ "service": "queryOrder",
860
+ "outTradeNo": this.order.body.outTradeNo,
861
+ "merchantMsg": merchantMsg,
862
+ "tradeNo": ""
863
+ }
864
+ }, {
865
+ resolveMsg: null,
866
+ rejectMsg: null
867
+ })
868
+ // 支付成功
869
+ this.orderstatus = res.data
870
+ console.log('查询结果=======', res.data)
871
+ if (res.data.status == '200') {
872
+ window.clearInterval(this.timer1)
873
+ console.log('支付成功', this.orderstatus)
874
+ this.saveUserFile('update')
875
+ this.order = {}
876
+ }
877
+ } catch (e) {
878
+ window.clearInterval(this.timer1)
879
+ this.$showMessage('创建订单失败!')
880
+ this.order = {}
881
+ }
882
+ },
883
+ getPaymentTerm() {
884
+ let term = ''
885
+ this.charge.payment_terms.forEach((row) => {
886
+ term += `${row.f_payment_term} `
887
+ })
888
+ return term
889
+ },
890
+ closeQRCode() {
891
+ clearTimeout(this.paymentInterval)
892
+ clearTimeout(this.orderInterval)
893
+ this.timeLeft = 300
894
+ this.closeOrder()
895
+ // 清除二维码
896
+ this.clearQrCode()
897
+ this.showQrCode = false
898
+ },
899
+ clearQrCode() {
900
+ document.getElementById('qrcode').innerHTML = ''
901
+ },
902
+ /* async closeOrder() {
903
+ let data = {
904
+ "flag": "JsApiWeiNan",
905
+ "f_filiale": "weinanchengtou",
906
+ "f_out_trade_no": this.order.f_out_trade_no,// 商户单号
907
+ "isClose": "是",
908
+ "f_sys_trace": this.order.f_sys_trace // 交易流水号
909
+ }
910
+ let http = new HttpResetClass()
911
+ let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/wx/rs/pay/microPayOrderStatus`, data, {
912
+ resolveMsg: null,
913
+ rejectMsg: '关闭失败!!!'
914
+ })
915
+ },*/
916
+ async update() {
917
+ let http = new HttpResetClass()
918
+ for (let i = 0; i < this.material.length; i++) {
919
+ if (this.material[i].f_state == '未收费') {
920
+ this.material[i].f_state = '已收费'
921
+ }
922
+ }
923
+ let data = {
924
+ model: this.material
925
+ }
926
+ let res = await http.load('post', this.$androidUtil.getProxyUrl() + '/rs/logic/saveweinanmaterial', {data: data}, {
927
+ resolveMsg: null,
928
+ rejectMsg: '保存失败'
929
+ })
930
+ this.search()
931
+ },
932
+ async saveother() {
933
+ let http = new HttpResetClass()
934
+ let data1 = {
935
+ tablename: 't_material_service',
936
+ condition: `f_process_id = '${this.selectdata.f_process_id}' and f_state = '未收费'`
937
+ }
938
+ let res1 = await http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data1}, {
939
+ resolveMsg: null,
940
+ rejectMsg: '获取数据失败'
941
+ })
942
+ let data = {
943
+ tablename: 't_userfiles',
944
+ condition: `f_userinfo_id = '${this.selectdata.model.f_userinfo_id}'`
945
+ }
946
+ let res = await http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
947
+ resolveMsg: null,
948
+ rejectMsg: '获取数据失败'
949
+ })
950
+ let otherdetails = []
951
+ for (let i = 0; i < res1.data.length; i++) {
952
+ otherdetails.push(
953
+ {
954
+ "f_brand_spec": [res1.data[i].f_material_name],
955
+ "f_unitprice": res1.data[i].f_material_price,
956
+ "f_typename": [res1.data[i].f_typename],
957
+ "f_typenumber": [res1.data[i].f_typenumber],
958
+ "f_number": res1.data[i].f_material_number
959
+ }
960
+ )
961
+ }
962
+
963
+ console.log("查询的用户信息", otherdetails)
964
+ let data2 = {
965
+ "record_userinfo": this.selectdata.model.f_userinfo_id,
966
+ "f_userfiles_id": res.data[0].f_userfiles_id,
967
+ "f_user_id": res.data[0].f_user_id,
968
+ "f_user_name": this.selectdata.model.f_user_name,
969
+ "f_address": this.selectdata.model.f_address,
970
+ "f_user_type": this.selectdata.model.f_user_type,
971
+ "f_gasproperties": "",
972
+ "f_collection": this.f_cost_sum,
973
+ "f_comments": "",
974
+ "f_payment": this.charge.f_payment_method,
975
+ "f_voucher_number": "",
976
+ "f_bill_style": "普通收据",
977
+ "f_userinfo_id": this.selectdata.model.f_userinfo_id,
978
+ "f_service_person": Vue.user.name,
979
+ "f_operat_type": "其他收费",
980
+ "f_describe": "",
981
+ "f_state": "有效",
982
+ "f_operator": Vue.user.name,
983
+ "f_operatorid": Vue.user.id,
984
+ "f_orgid": Vue.user.orgid,
985
+ "f_orgname": Vue.user.orgs,
986
+ "f_depid": Vue.user.depids,
987
+ "f_depname": Vue.user.f_department_name,
988
+ "t_userfees": "",
989
+ "f_fee_type": "其他费用",
990
+ "f_fee_time": "12",
991
+ "otherdetail": otherdetails
992
+ }
993
+
994
+ let res2 = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/logic/sale_othercharge_logic`, {data: data2}, {
995
+ resolveMsg: null,
996
+ rejectMsg: '保存数据失败'
997
+ })
998
+ },
999
+ async shoufei() {
1000
+ let http = new HttpResetClass()
1001
+ let data = {
1002
+ tablename: 't_material_service',
1003
+ condition: `f_process_id = '${this.selectdata.f_process_id}' and f_state = '未收费'`
1004
+ }
1005
+ let res = await http.load('post', this.$androidUtil.getProxyUrl() + '/rs/sql/tel_singleTable', {data: data}, {
1006
+ resolveMsg: null,
1007
+ rejectMsg: '获取数据失败'
1008
+ })
1009
+ if (res.data.length <= 0) {
1010
+ this.$showMessage('请先添加未收费的材料!!!')
1011
+ return
1012
+ }
1013
+ this.f_cost_sum = 0
1014
+ for (let i = 0; i < res.data.length; i++) {
1015
+ this.f_cost_sum += Number(res.data[i].f_fee)
1016
+ }
1017
+ this.showCharge = true
1018
+ this.charge.payment_terms[0].f_charge_money = this.f_cost_sum
1019
+ },
1020
+ accMul(arg1, arg2) {
1021
+ let m = 0, s1 = arg1.toString(), s2 = arg2.toString();
1022
+ try {
1023
+ m += s1.split(".")[1].length
1024
+ } catch (e) {
1025
+ }
1026
+ try {
1027
+ m += s2.split(".")[1].length
1028
+ } catch (e) {
1029
+ }
1030
+ return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
1031
+ },
1032
+ },
1033
+ beforeDestroy() {
1034
+ console.log('销毁了-----111', this.timer1)
1035
+ window.clearInterval(this.timer1)
1036
+ },
1037
+ events: {},
1038
+ computed: {
1039
+ paymentMethod() {
1040
+ return this.$appdata.getParam("付款方式")
1041
+ },
1042
+ paymentTerm() {
1043
+ return this.$appdata.getParam("收费项目")
1044
+ }
1045
+ },
1046
+ watch: {}
1047
+ }
1048
+ </script>
1049
+ <style lang="less" scoped>
1050
+ .head-but {
1051
+ margin-left: 5px;
1052
+ height: 34px;
1053
+ /*background-color: #6aa6e2;*/
1054
+ border-radius: 4px;
1055
+ font-family: PingFang;
1056
+ color: #ffffff;
1057
+ }
1058
+
1059
+ /*清除model中的浮动*/
1060
+ .clearfix:after, .clearfix:before {
1061
+ display: table;
1062
+ }
1063
+
1064
+ .clearfix:after {
1065
+ clear: both;
1066
+ }
1067
+
1068
+ .lab_sty {
1069
+ margin-bottom: 0;
1070
+ display: flex;
1071
+ flex-direction: row-reverse;
1072
+ align-items: center;
1073
+ }
1074
+
1075
+ .row_sty {
1076
+ display: flex;
1077
+ align-items: center;
1078
+ margin: 5px;
1079
+ }
1080
+
1081
+ </style>