apply-clients 3.5.6-13 → 3.5.6-14

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