handpos-client 1.0.2 → 1.0.4
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 +1 -1
- package/src/components/garbage/GarbagePayWay.vue +233 -199
- package/src/components/main/CardMain.vue +47 -47
- package/src/service/CheckCard.js +111 -103
- package/src/service/GarbagePayWay.js +101 -101
- package/src/service/GarbageScanNative.js +116 -116
- package/src/service/PayWay.js +121 -121
- package/src/service/ScanNative.js +118 -118
- package/src/service/WriteCard.js +262 -262
- package/src/service/util.js +84 -0
package/package.json
CHANGED
|
@@ -1,199 +1,233 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="mhead">
|
|
4
|
-
<ul>
|
|
5
|
-
<li>
|
|
6
|
-
<text>垃圾费缴费</text>
|
|
7
|
-
</li>
|
|
8
|
-
</ul>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="body">
|
|
11
|
-
<div class="container contentpanel auto">
|
|
12
|
-
<div class="row buypanel">
|
|
13
|
-
<div class="buyform">
|
|
14
|
-
<h3 style="color: red;">订单信息</h3>
|
|
15
|
-
<div>
|
|
16
|
-
<h4>缴费类型:垃圾费</h4>
|
|
17
|
-
</div>
|
|
18
|
-
<div>
|
|
19
|
-
<h4>账期:{{garbageInfo.accountperiod}}</h4>
|
|
20
|
-
</div>
|
|
21
|
-
<div>
|
|
22
|
-
<h4>支付金额:{{garbageInfo.money}} 元</h4>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="horizontal" height="auto">
|
|
26
|
-
<h3 style="color: red;">请选择支付方式</h3>
|
|
27
|
-
<table width="60%" border="0" cellspacing="0" cellpadding="0" align="center">
|
|
28
|
-
<tbody>
|
|
29
|
-
<tr>
|
|
30
|
-
<td align="center" v-if='payBtn1.show' class="col-xs-4 weixin">
|
|
31
|
-
<div @click='pay("1")'>
|
|
32
|
-
<img :src="btn1Path" alt=""/>
|
|
33
|
-
</div>
|
|
34
|
-
</td>
|
|
35
|
-
<td align="center" v-if='payBtn2.show' class="col-xs-4 alipay" >
|
|
36
|
-
<div @click='pay("2")'>
|
|
37
|
-
<img :src="btn2Path " alt=""/>
|
|
38
|
-
</div>
|
|
39
|
-
</td>
|
|
40
|
-
<td align="center" v-if='payBtn3.show' class="col-xs-4 unionpay">
|
|
41
|
-
<div @click='pay("3")'>
|
|
42
|
-
<img :src="btn3Path" alt=""/>
|
|
43
|
-
</div>
|
|
44
|
-
</td>
|
|
45
|
-
</tr>
|
|
46
|
-
</tbody>
|
|
47
|
-
</table>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
<div class="foot" @click="back('toMain')">
|
|
53
|
-
<text>返回</text>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</template>
|
|
57
|
-
<script>
|
|
58
|
-
import Vue from 'vue'
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this.payInfo.
|
|
131
|
-
this.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.payInfo.
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
this.payInfo.
|
|
139
|
-
this.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
let
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
attach.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
HostApp.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="mhead">
|
|
4
|
+
<ul>
|
|
5
|
+
<li>
|
|
6
|
+
<text>垃圾费缴费</text>
|
|
7
|
+
</li>
|
|
8
|
+
</ul>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="body">
|
|
11
|
+
<div class="container contentpanel auto">
|
|
12
|
+
<div class="row buypanel">
|
|
13
|
+
<div class="buyform">
|
|
14
|
+
<h3 style="color: red;">订单信息</h3>
|
|
15
|
+
<div>
|
|
16
|
+
<h4>缴费类型:垃圾费</h4>
|
|
17
|
+
</div>
|
|
18
|
+
<div>
|
|
19
|
+
<h4>账期:{{garbageInfo.accountperiod}}</h4>
|
|
20
|
+
</div>
|
|
21
|
+
<div>
|
|
22
|
+
<h4>支付金额:{{garbageInfo.money}} 元</h4>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="horizontal" height="auto">
|
|
26
|
+
<h3 style="color: red;">请选择支付方式</h3>
|
|
27
|
+
<table width="60%" border="0" cellspacing="0" cellpadding="0" align="center">
|
|
28
|
+
<tbody>
|
|
29
|
+
<tr>
|
|
30
|
+
<td align="center" v-if='payBtn1.show' class="col-xs-4 weixin">
|
|
31
|
+
<div @click='pay("1")'>
|
|
32
|
+
<img :src="btn1Path" alt=""/>
|
|
33
|
+
</div>
|
|
34
|
+
</td>
|
|
35
|
+
<td align="center" v-if='payBtn2.show' class="col-xs-4 alipay" >
|
|
36
|
+
<div @click='pay("2")'>
|
|
37
|
+
<img :src="btn2Path " alt=""/>
|
|
38
|
+
</div>
|
|
39
|
+
</td>
|
|
40
|
+
<td align="center" v-if='payBtn3.show' class="col-xs-4 unionpay">
|
|
41
|
+
<div @click='pay("3")'>
|
|
42
|
+
<img :src="btn3Path" alt=""/>
|
|
43
|
+
</div>
|
|
44
|
+
</td>
|
|
45
|
+
</tr>
|
|
46
|
+
</tbody>
|
|
47
|
+
</table>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="foot" @click="back('toMain')">
|
|
53
|
+
<text>返回</text>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
<script>
|
|
58
|
+
import Vue from 'vue'
|
|
59
|
+
import * as util from '../../service/util.js'
|
|
60
|
+
export default {
|
|
61
|
+
title: '选择支付方式',
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
btn1Path: '',
|
|
65
|
+
btn2Path: '',
|
|
66
|
+
btn3Path: '',
|
|
67
|
+
payBtn1: {
|
|
68
|
+
show: false,
|
|
69
|
+
path: "",
|
|
70
|
+
method: "",
|
|
71
|
+
pay_way: "",
|
|
72
|
+
payment: ""
|
|
73
|
+
},
|
|
74
|
+
payBtn2: {
|
|
75
|
+
show: false,
|
|
76
|
+
path: "",
|
|
77
|
+
method: "",
|
|
78
|
+
pay_way: "",
|
|
79
|
+
payment: ""
|
|
80
|
+
},
|
|
81
|
+
payBtn3: {
|
|
82
|
+
show: false,
|
|
83
|
+
path: "",
|
|
84
|
+
method: "",
|
|
85
|
+
pay_way: "",
|
|
86
|
+
payment: ""
|
|
87
|
+
},
|
|
88
|
+
garbageInfo: {
|
|
89
|
+
accountperiod: '',
|
|
90
|
+
money: 0,
|
|
91
|
+
list: []
|
|
92
|
+
},
|
|
93
|
+
payInfo: {
|
|
94
|
+
pay_way: '',
|
|
95
|
+
f_payment: '',
|
|
96
|
+
url: '',
|
|
97
|
+
f_serial_id: ''
|
|
98
|
+
},
|
|
99
|
+
resolve: undefined,
|
|
100
|
+
reject: undefined,
|
|
101
|
+
obj: undefined
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
methods: {
|
|
105
|
+
// 格式化日期显示
|
|
106
|
+
formatDate(dateStr) {
|
|
107
|
+
if (!dateStr) return ''
|
|
108
|
+
const parts = dateStr.split('-')
|
|
109
|
+
if (parts.length === 2) {
|
|
110
|
+
return `${parts[0]}年${parts[1]}月`
|
|
111
|
+
}
|
|
112
|
+
return dateStr
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
back(para) {
|
|
116
|
+
this.obj.resolve(false)
|
|
117
|
+
this.$back(para)
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
getQR() {
|
|
121
|
+
this.obj.getQR()
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
async pay (str) {
|
|
125
|
+
if (!this.handClick) {
|
|
126
|
+
this.handClick = true
|
|
127
|
+
|
|
128
|
+
// 垃圾费不需要读卡验证,直接进行支付
|
|
129
|
+
if (str === '1') {
|
|
130
|
+
this.payInfo.pay_way = this.payBtn1.pay_way
|
|
131
|
+
this.payInfo.f_payment = this.payBtn1.payment
|
|
132
|
+
this.payMethod(this.payBtn1.unionPayAlias, this.payBtn1.method)
|
|
133
|
+
} else if (str === '2') {
|
|
134
|
+
this.payInfo.pay_way = this.payBtn2.pay_way
|
|
135
|
+
this.payInfo.f_payment = this.payBtn2.payment
|
|
136
|
+
this.payMethod(this.payBtn2.unionPayAlias, this.payBtn2.method)
|
|
137
|
+
} else {
|
|
138
|
+
this.payInfo.pay_way = this.payBtn3.pay_way
|
|
139
|
+
this.payInfo.f_payment = this.payBtn3.payment
|
|
140
|
+
this.payMethod(this.payBtn3.unionPayAlias, this.payBtn3.method)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
payMethod(unionPayAlias, payMethod) {
|
|
146
|
+
if (payMethod === 'qrcode') {
|
|
147
|
+
this.getQR()
|
|
148
|
+
} else if (payMethod === 'card') {
|
|
149
|
+
this.cardPay(unionPayAlias)
|
|
150
|
+
} else {
|
|
151
|
+
this.$showNewMessage('提示', `未知支付方式:${payMethod},请联系管理员`, ['confirm'], 'newmgs')
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
cardPay(unionPayAlias) {
|
|
156
|
+
let attach = this.obj.getAttach()
|
|
157
|
+
let money = Vue.PosUtil.yuan2fen(this.garbageInfo.money)
|
|
158
|
+
//测试环境支付金额统一改为1分
|
|
159
|
+
if (Vue.PosUtil.posParam.isTest) {
|
|
160
|
+
money = 1
|
|
161
|
+
}
|
|
162
|
+
attach.f_revenue = Vue.PosUtil.posParam.revenue
|
|
163
|
+
attach.money = money
|
|
164
|
+
try {
|
|
165
|
+
HostApp.__this__ = this
|
|
166
|
+
HostApp.pay({
|
|
167
|
+
data: attach,
|
|
168
|
+
callback: 'javascript:HostApp.__this__.toSuccess();'
|
|
169
|
+
}, unionPayAlias)
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.log('e', e)
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
print(){
|
|
175
|
+
try {
|
|
176
|
+
let num = 0.00
|
|
177
|
+
this.garbage.list.forEach(item=>{
|
|
178
|
+
num += item.f_money
|
|
179
|
+
})
|
|
180
|
+
let bigNum = util.numberToChinese(num)
|
|
181
|
+
let date = util.getDate()
|
|
182
|
+
let printContent = []
|
|
183
|
+
let textHead = {type: 3, text: '山西华新科莱天然气有限公司垃圾费收费单', fontsize: 3, isbold: true, align: 'center'}
|
|
184
|
+
printContent.push(textHead)
|
|
185
|
+
printContent.push({type: 4, value: 2, unit: 'line'})
|
|
186
|
+
printContent.push({type: 3, text: '收费日期:' + date, fontsize: 2, isbold: false, align: 'left'})
|
|
187
|
+
printContent.push({type: 3, text: '用户编号:' + this.userInfo.f_userinfo_code, fontsize: 2, isbold: false, align: 'left'})
|
|
188
|
+
printContent.push({type: 3, text: '用户姓名:' + this.userInfo.f_user_name, fontsize: 2, isbold: false, align: 'left'})
|
|
189
|
+
printContent.push({type: 3, text: '用气地址:' + this.userInfo.f_address, fontsize: 2, isbold: false, align: 'left'})
|
|
190
|
+
printContent.push({type: 3, text: '收费项目:' + '垃圾费', fontsize: 2, isbold: false, align: 'left'})
|
|
191
|
+
printContent.push({type: 3, text: '垃圾处理费:' + num, fontsize: 2, isbold: false, align: 'left'})
|
|
192
|
+
printContent.push({type: 3, text: '实收金额(大写):' + bigNum, fontsize: 2, isbold: false, align: 'left'})
|
|
193
|
+
printContent.push({type: 3, text: '打票时间:' + date, fontsize: 2, isbold: false, align: 'left'})
|
|
194
|
+
printContent.push({type: 3, text: '收费员:' + Vue.user.name || Vue.PosUtil.Sn, fontsize: 2, isbold: false, align: 'left'})
|
|
195
|
+
printContent.push({type: 4, value: 4, unit: 'line'})
|
|
196
|
+
this.$AndroidPlugin.print(printContent)
|
|
197
|
+
}catch (e) {
|
|
198
|
+
this.$showNewMessage('错误', '收费打印单失败。')
|
|
199
|
+
}
|
|
200
|
+
this.$back('toMain')
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
// 垃圾费支付成功处理
|
|
204
|
+
toSuccess() {
|
|
205
|
+
this.$showNewMessage('错误', '垃圾费缴费成功!是否打印收费单?', ['confirm', 'cancel'], 'newmgs')
|
|
206
|
+
.then((res) => {
|
|
207
|
+
if (res === 'confirm') {
|
|
208
|
+
this.print()
|
|
209
|
+
} else {
|
|
210
|
+
this.$back('toMain')
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
ready() {
|
|
217
|
+
// 从路由参数获取垃圾费信息
|
|
218
|
+
this.garbageInfo = this.garbage
|
|
219
|
+
|
|
220
|
+
// 设置服务对象里的组件对象
|
|
221
|
+
if (this.obj) {
|
|
222
|
+
this.obj.setComponents(this)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.payBtn1 = this.$PosUtil.posParam.PayBtn1
|
|
226
|
+
this.payBtn2 = this.$PosUtil.posParam.PayBtn2
|
|
227
|
+
this.payBtn3 = this.$PosUtil.posParam.PayBtn3
|
|
228
|
+
this.btn1Path = require(`../image/${this.payBtn1.path}`)
|
|
229
|
+
this.btn2Path = require(`../image/${this.payBtn2.path}`)
|
|
230
|
+
this.btn3Path = require(`../image/${this.payBtn3.path}`)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
</script>
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="mhead">
|
|
4
|
-
<ul>
|
|
5
|
-
<li>
|
|
6
|
-
<text>自助缴费机</text>
|
|
7
|
-
</li>
|
|
8
|
-
</ul>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="body" style="background: #f0f0f0;padding: 20%;margin: 0 auto">
|
|
11
|
-
<div>
|
|
12
|
-
<h5>请插好燃气卡,等待自动读卡</h5>
|
|
13
|
-
<img src="../image/readCard.gif">
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
<div class="foot" @click="back('toMain')">
|
|
17
|
-
<text>返回</text>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import CheckCard from '../../service/CheckCard'
|
|
24
|
-
import GetCardInfo from '../../service/GetCardInfo'
|
|
25
|
-
import Vue from 'vue'
|
|
26
|
-
export default {
|
|
27
|
-
title: '读卡',
|
|
28
|
-
name: 'CardMain',
|
|
29
|
-
data () {
|
|
30
|
-
return {
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
methods: {
|
|
34
|
-
back(param) {
|
|
35
|
-
this.$back(param)
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
ready () {
|
|
39
|
-
// 用户进入该组件后,轮询检查卡,如果检查到卡就读卡并查询卡信息后返回用户档案
|
|
40
|
-
let service = [new CheckCard(this), new GetCardInfo(this)]
|
|
41
|
-
service = this.$PosUtil.buildLinked(service)
|
|
42
|
-
Vue.eventBack(service)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
</script>
|
|
46
|
-
<style>
|
|
47
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="mhead">
|
|
4
|
+
<ul>
|
|
5
|
+
<li>
|
|
6
|
+
<text>自助缴费机</text>
|
|
7
|
+
</li>
|
|
8
|
+
</ul>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="body" style="background: #f0f0f0;padding: 20%;margin: 0 auto">
|
|
11
|
+
<div>
|
|
12
|
+
<h5>请插好燃气卡,等待自动读卡</h5>
|
|
13
|
+
<img src="../image/readCard.gif">
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="foot" @click="back('toMain')">
|
|
17
|
+
<text>返回</text>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>service
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import CheckCard from '../../service/CheckCard'
|
|
24
|
+
import GetCardInfo from '../../service/GetCardInfo'
|
|
25
|
+
import Vue from 'vue'
|
|
26
|
+
export default {
|
|
27
|
+
title: '读卡',
|
|
28
|
+
name: 'CardMain',
|
|
29
|
+
data () {
|
|
30
|
+
return {
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
back(param) {
|
|
35
|
+
this.$back(param)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
ready () {
|
|
39
|
+
// 用户进入该组件后,轮询检查卡,如果检查到卡就读卡并查询卡信息后返回用户档案
|
|
40
|
+
let service = [new CheckCard(this), new GetCardInfo(this)]
|
|
41
|
+
service = this.$PosUtil.buildLinked(service)
|
|
42
|
+
Vue.eventBack(service)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
<style>
|
|
47
|
+
</style>
|