sale-client 4.2.28 → 4.2.30
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.
package/package.json
CHANGED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id='PaymentCode'>
|
|
3
|
+
<modal :show.sync="paymentCodeShow" backdrop="false">
|
|
4
|
+
<header slot="modal-header" class="modal-header">
|
|
5
|
+
<h4 class="modal-title">请扫描用户付款码</h4>
|
|
6
|
+
</header>
|
|
7
|
+
<article slot="modal-body" class="modal-body">
|
|
8
|
+
<div class="form-horizontal">
|
|
9
|
+
<div class="form-group">
|
|
10
|
+
<input type="text" class="form-control" id="paycode" @keyup.enter="ConfirmCode" @blur="paycodefocus"
|
|
11
|
+
v-model="paymentCode" placeholder="请扫描用户付款码" v-el:paycode>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</article>
|
|
15
|
+
<footer slot="modal-footer" class="modal-footer">
|
|
16
|
+
<button type="button" class="btn btn-default" @click='closeCode'>取消</button>
|
|
17
|
+
</footer>
|
|
18
|
+
</modal>
|
|
19
|
+
<work-busy :is-busy="busy"></work-busy>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
name: 'PaymentCode',
|
|
26
|
+
props: {
|
|
27
|
+
// 付款方式
|
|
28
|
+
payment: {},
|
|
29
|
+
// 业务类型
|
|
30
|
+
type: {},
|
|
31
|
+
// 用户信息
|
|
32
|
+
row: {},
|
|
33
|
+
// 付款金额
|
|
34
|
+
money: {}
|
|
35
|
+
},
|
|
36
|
+
data () {
|
|
37
|
+
return {
|
|
38
|
+
// 付款码弹框显示
|
|
39
|
+
paymentCodeShow: false,
|
|
40
|
+
busy: false,
|
|
41
|
+
// 付款码值
|
|
42
|
+
paymentCode: null,
|
|
43
|
+
// 付款码流程控制
|
|
44
|
+
paycoderesolve: null,
|
|
45
|
+
// 付款码返回数据
|
|
46
|
+
paymentCodeReturnData: {},
|
|
47
|
+
// 定时器
|
|
48
|
+
timer: null,
|
|
49
|
+
// 收费成功id
|
|
50
|
+
sellinggasId: null,
|
|
51
|
+
canPayment: this.$appdata.getSingleValue('微信支付付款方式') ? this.$appdata.getSingleValue('微信支付付款方式') : '',
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
created () {
|
|
55
|
+
},
|
|
56
|
+
ready () {
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
// 返回结果为true意味着可以通行
|
|
60
|
+
flowPath () {
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
this.paycoderesolve = resolve
|
|
63
|
+
// 如果是付款码支付则显示界面扫用户付款码收钱
|
|
64
|
+
if (this.canPayment.indexOf(this.payment.toString()) !== -1 || this.payment.toString().indexOf('&') !== -1) {
|
|
65
|
+
this.paymentCodeShow = true
|
|
66
|
+
this.paycodefocus()
|
|
67
|
+
} else {
|
|
68
|
+
this.paycoderesolve({msg: '不是付款码支付', result: true})
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
},
|
|
72
|
+
// 付款码框获得焦点
|
|
73
|
+
paycodefocus () {
|
|
74
|
+
this.$nextTick(() => {
|
|
75
|
+
this.$els.paycode.focus()
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
// 付款码支付流程
|
|
79
|
+
async ConfirmCode () {
|
|
80
|
+
// 扫完一次码之后失去焦点,避免重复扫码
|
|
81
|
+
this.paymentCodeShow = false
|
|
82
|
+
let data = {
|
|
83
|
+
f_userinfo_id: this.row ? this.row.f_userinfo_id : null,
|
|
84
|
+
type: this.type ? this.type : '燃气费',
|
|
85
|
+
f_operatorid: this.$login.f.id,
|
|
86
|
+
f_operator: this.$login.f.name,
|
|
87
|
+
f_orgname: this.$login.f.orgs,
|
|
88
|
+
f_depname:this.$login.f.deps,
|
|
89
|
+
f_user_id: this.row ? this.row.f_user_id : null,
|
|
90
|
+
f_userfiles_id: this.row ? this.row.f_userfiles_id : null,
|
|
91
|
+
money: this.money,
|
|
92
|
+
f_payment: this.payment[0],
|
|
93
|
+
auth_code: this.paymentCode,
|
|
94
|
+
filiale: this.$login.f.orgid,
|
|
95
|
+
body: this.$login.f.orgs
|
|
96
|
+
}
|
|
97
|
+
if (this.type === '其他收费') {
|
|
98
|
+
data.f_details = this.$parent.getBusinessData()
|
|
99
|
+
}
|
|
100
|
+
let res = await this.$resetpost('api/af-revenue/logic/WeiXinPay', data, {resolveMsg: null, rejectMsg: '服务器内部出错,'})
|
|
101
|
+
res.data.f_payment = this.payment[0]
|
|
102
|
+
res.data.f_orgname = this.$login.f.orgs
|
|
103
|
+
res.data.auth_code = this.paymentCode
|
|
104
|
+
res.data.f_depname = this.$login.f.deps
|
|
105
|
+
this.paymentCodeReturnData = res = res.data
|
|
106
|
+
if (res.result_msg == '支付确认成功') {
|
|
107
|
+
this.paycoderesolve({msg: '支付完成', result: true})
|
|
108
|
+
this.$closeAlert()
|
|
109
|
+
this.busy = false
|
|
110
|
+
} else if (res.result_msg == '支付结果未知') {
|
|
111
|
+
// 支付结果未知, 根据商户订单号继续查询
|
|
112
|
+
this.$showAlert(`正在查询用户付款状态,请勿进行任何操作,耐心等待`, 'warning')
|
|
113
|
+
this.busy = true
|
|
114
|
+
console.log(window.document.getElementById('bodymain'))
|
|
115
|
+
let self = this
|
|
116
|
+
// 启动定时器之前先关闭定时器,防止之前的定时器未关闭
|
|
117
|
+
if (this.timer) {
|
|
118
|
+
this.closeTimer()
|
|
119
|
+
}
|
|
120
|
+
let times = 1
|
|
121
|
+
this.timer = setInterval(async () => {
|
|
122
|
+
times++
|
|
123
|
+
let res1 = await self.$resetpost('api/af-revenue/logic/WeiXinPayStatus', res, {resolveMsg: null, rejectMsg: '付款码支付查询出错,'})
|
|
124
|
+
this.paymentCodeReturnData = res1.data
|
|
125
|
+
res1 = res1.data
|
|
126
|
+
// 支付成功关闭定时器
|
|
127
|
+
if (res1.result_msg == '支付确认成功') {
|
|
128
|
+
self.paycoderesolve({msg: '支付完成', result: true})
|
|
129
|
+
self.closeTimer()
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
if (res1.result_msg == '支付失败') {
|
|
133
|
+
this.$showAlert(`支付失败, 请提醒用户重新付款`, 'danger')
|
|
134
|
+
this.closeTimer()
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
if (times > 12) {
|
|
138
|
+
self.$showAlert(`多次查询未成功,请重新扫描用户付款码`, 'danger')
|
|
139
|
+
self.closeTimer()
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}, 5000)
|
|
143
|
+
} else {
|
|
144
|
+
this.$showAlert(`${res.result_msg}, 请重新扫描用户付款码`, 'danger')
|
|
145
|
+
}
|
|
146
|
+
// 清空付款码
|
|
147
|
+
this.paymentCode = ''
|
|
148
|
+
},
|
|
149
|
+
// 付款成功更新收费记录订单号
|
|
150
|
+
async updateSellinggas () {
|
|
151
|
+
if (this.payment.toString().indexOf('&') !== -1) {
|
|
152
|
+
let sqldata = `update t_sellinggas set f_serial_id = '${this.paymentCodeReturnData.transactionId}' where id = '${this.sellinggasId}'`
|
|
153
|
+
await this.$resetpost('api/af-revenue/logic/runSQL', {data: {sql: sqldata}}, {resolveMsg: null, rejectMsg: '更新收费记录订单号失败'})
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
// 关闭定时器
|
|
157
|
+
closeTimer () {
|
|
158
|
+
console.log('关闭定时器')
|
|
159
|
+
this.busy = false
|
|
160
|
+
clearInterval(this.timer)
|
|
161
|
+
this.timer = null
|
|
162
|
+
},
|
|
163
|
+
closeCode () {
|
|
164
|
+
this.$showMessage('取消后无法继续收款,确定取消吗?', ['confirm', 'cancel']).then((res) => {
|
|
165
|
+
if (res == 'confirm') {
|
|
166
|
+
this.paymentCodeShow = false
|
|
167
|
+
this.$closeAlert()
|
|
168
|
+
this.paycoderesolve({msg: '支付取消', result: false})
|
|
169
|
+
this.closeTimer()
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<style lang="less">
|
|
178
|
+
|
|
179
|
+
</style>
|
|
@@ -22,4 +22,6 @@ export default function () {
|
|
|
22
22
|
// 用户基本信息test
|
|
23
23
|
Vue.component('file-user-essential-info', (resolve) => { require(['./UserEssentialInfoTest'], resolve) })
|
|
24
24
|
Vue.component('cards-hand', (resolve) => { require(['./cardsHand'], resolve) })
|
|
25
|
+
// 扫码支付
|
|
26
|
+
Vue.component('payment-code', (resolve) => { require(['./PaymentCode.vue'], resolve) })
|
|
25
27
|
}
|