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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handpos-client",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "手持POS",
5
5
  "main": "src/index.js",
6
6
  "directories": {
@@ -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}} &nbsp;&nbsp;元</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
- export default {
60
- title: '选择支付方式',
61
- data() {
62
- return {
63
- btn1Path: '',
64
- btn2Path: '',
65
- btn3Path: '',
66
- payBtn1: {
67
- show: false,
68
- path: "",
69
- method: "",
70
- pay_way: "",
71
- payment: ""
72
- },
73
- payBtn2: {
74
- show: false,
75
- path: "",
76
- method: "",
77
- pay_way: "",
78
- payment: ""
79
- },
80
- payBtn3: {
81
- show: false,
82
- path: "",
83
- method: "",
84
- pay_way: "",
85
- payment: ""
86
- },
87
- garbageInfo: {
88
- accountperiod: '',
89
- money: 0,
90
- list: []
91
- },
92
- payInfo: {
93
- pay_way: '',
94
- f_payment: '',
95
- url: '',
96
- f_serial_id: ''
97
- },
98
- resolve: undefined,
99
- reject: undefined,
100
- obj: undefined
101
- }
102
- },
103
- methods: {
104
- // 格式化日期显示
105
- formatDate(dateStr) {
106
- if (!dateStr) return ''
107
- const parts = dateStr.split('-')
108
- if (parts.length === 2) {
109
- return `${parts[0]}年${parts[1]}月`
110
- }
111
- return dateStr
112
- },
113
-
114
- back(para) {
115
- this.obj.resolve(false)
116
- this.$back(para)
117
- },
118
-
119
- getQR() {
120
- this.obj.getQR()
121
- },
122
-
123
- async pay (str) {
124
- if (!this.handClick) {
125
- this.handClick = true
126
-
127
- // 垃圾费不需要读卡验证,直接进行支付
128
- if (str === '1') {
129
- this.payInfo.pay_way = this.payBtn1.pay_way
130
- this.payInfo.f_payment = this.payBtn1.payment
131
- this.payMethod(this.payBtn1.unionPayAlias, this.payBtn1.method)
132
- } else if (str === '2') {
133
- this.payInfo.pay_way = this.payBtn2.pay_way
134
- this.payInfo.f_payment = this.payBtn2.payment
135
- this.payMethod(this.payBtn2.unionPayAlias, this.payBtn2.method)
136
- } else {
137
- this.payInfo.pay_way = this.payBtn3.pay_way
138
- this.payInfo.f_payment = this.payBtn3.payment
139
- this.payMethod(this.payBtn3.unionPayAlias, this.payBtn3.method)
140
- }
141
- }
142
- },
143
-
144
- payMethod(unionPayAlias, payMethod) {
145
- if (payMethod === 'qrcode') {
146
- this.getQR()
147
- } else if (payMethod === 'card') {
148
- this.cardPay(unionPayAlias)
149
- } else {
150
- this.$showNewMessage('提示', `未知支付方式:${payMethod},请联系管理员`, ['confirm'], 'newmgs')
151
- }
152
- },
153
-
154
- cardPay(unionPayAlias) {
155
- let attach = this.obj.getAttach()
156
- let money = Vue.PosUtil.yuan2fen(this.garbageInfo.money)
157
- //测试环境支付金额统一改为1分
158
- if (Vue.PosUtil.posParam.isTest) {
159
- money = 1
160
- }
161
- attach.f_revenue = Vue.PosUtil.posParam.revenue
162
- attach.money = money
163
- try {
164
- HostApp.__this__ = this
165
- HostApp.pay({
166
- data: attach,
167
- callback: 'javascript:HostApp.__this__.toSuccess();'
168
- }, unionPayAlias)
169
- } catch (e) {
170
- console.log('e', e)
171
- }
172
- },
173
-
174
- // 垃圾费支付成功处理
175
- toSuccess() {
176
- this.$showNewMessage('提示', '垃圾费缴费成功!', ['confirm'], 'newmgs', () => {
177
- this.$back('toMain')
178
- })
179
- }
180
- },
181
-
182
- ready() {
183
- // 从路由参数获取垃圾费信息
184
- this.garbageInfo = this.garbage
185
-
186
- // 设置服务对象里的组件对象
187
- if (this.obj) {
188
- this.obj.setComponents(this)
189
- }
190
-
191
- this.payBtn1 = this.$PosUtil.posParam.PayBtn1
192
- this.payBtn2 = this.$PosUtil.posParam.PayBtn2
193
- this.payBtn3 = this.$PosUtil.posParam.PayBtn3
194
- this.btn1Path = require(`../image/${this.payBtn1.path}`)
195
- this.btn2Path = require(`../image/${this.payBtn2.path}`)
196
- this.btn3Path = require(`../image/${this.payBtn3.path}`)
197
- }
198
- }
199
- </script>
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}} &nbsp;&nbsp;元</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>