blob: 5c9ebe51fc3d27171147b66b1e76762fd648d9ad [file] [log] [blame]
guangchao.xu070005a2020-12-07 09:56:40 +08001<template>
2 <view class="pay">
3 <u-cell-group>
guangchao.xu50e42382021-01-04 17:53:47 +08004 <u-cell-item :title="msg.mergingName" :title-style="tstyle" :arrow="false">
guangchao.xu070005a2020-12-07 09:56:40 +08005 <u-image slot="icon" src="./images/cush.png" width="60" height="60" mode="aspectFit"></u-image>
6 </u-cell-item>
guangchao.xu50e42382021-01-04 17:53:47 +08007 <u-cell-item title="缴费金额" :arrow="false" :value="msg.mergingSubtotal+'元'" :value-style="vstyle"></u-cell-item>
guangchao.xu070005a2020-12-07 09:56:40 +08008 </u-cell-group>
9 <u-cell-group>
guangchao.xu50e42382021-01-04 17:53:47 +080010 <u-cell-item title="医院名称" :arrow="false" :value="msg.hospitalName"></u-cell-item>
11 <u-cell-item title="订单号" :arrow="false" :value="msg.billNo"></u-cell-item>
12 <u-cell-item title="就诊日期" :arrow="false" :value="msg.date"></u-cell-item>
13 <!-- <u-cell-item title="截止日期" :arrow="false" value="2020/10/28 23:29:29"></u-cell-item> -->
guangchao.xuc43cf972021-01-18 13:37:55 +080014 <u-cell-item title="交易状态" :arrow="false" :value="msg.status_ok" :value-style="msg.status=='wip'|| msg.status==undefined?status_style:vstyle"></u-cell-item>
15 <u-cell-item title="退款状态" :arrow="false" :value="msg.refundflag_ok" :value-style="msg.refundflag=='refund'?status_style:vstyle"
16 v-if="msg.refundflag == 'wip' || msg.refundflag == 'refund'"></u-cell-item>
guangchao.xu070005a2020-12-07 09:56:40 +080017 </u-cell-group>
guangchao.xu50e42382021-01-04 17:53:47 +080018 <u-button @click="msg.status=='wip'?query():open()" :custom-style="payBtn" v-if="kind =='unpay'">{{msg.status=='wip'?'查询订单状态':'立即支付'}}</u-button>
guangchao.xuc43cf972021-01-18 13:37:55 +080019 <u-button @click="notify_hosiptal" :custom-style="payBtn" v-if="kind =='payed'&& msg.notifyStatus == false">通知医院</u-button>
guangchao.xu50e42382021-01-04 17:53:47 +080020 <!-- 支付密码弹框 -->
21 <uni-popup ref="showPassword" class="pwd-wrapper">
22 <view class="uni-tip uni-pwd">
23 <text class="uni-tip-title">请输入支付密码</text>
24 <view class="pwd-text-wrap">
25 <password-input @tap="openKeyBoard('number')" :length="length" :gutter="0" :list="numberList"></password-input>
26 </view>
27 </view>
28 </uni-popup>
29 <keyboard-package ref="number" @onInput="onInput" @onDelete="onDelete" @onConfirm="onConfirm" :disableDot="true" />
guangchao.xu070005a2020-12-07 09:56:40 +080030 </view>
31</template>
32
33<script>
guangchao.xu50e42382021-01-04 17:53:47 +080034 import keyboardPackage from "./z_components/keyboard-package/keyboard-package.vue"
35 import passwordInput from "./z_components/password-input/password-input.vue"
36 import uniPopup from './z_components/uni-popup/uni-popup.vue'
37 export default {
38 components: {
39 uniPopup,
40 keyboardPackage,
41 passwordInput
42 },
43 data() {
44 return {
45 numberList: [],
46 length: 6,
47 type: 'number',
guangchao.xu070005a2020-12-07 09:56:40 +080048 tstyle: {
49 marginLeft: '10rpx',
50 fontWeight: 'bold'
51 },
52 vstyle: {
guangchao.xu50e42382021-01-04 17:53:47 +080053 color: '#FF6F6F',
guangchao.xuc43cf972021-01-18 13:37:55 +080054 fontSize: '30rpx'
guangchao.xu50e42382021-01-04 17:53:47 +080055 },
56 status_style: {
57 color: '#18B566',
guangchao.xuc43cf972021-01-18 13:37:55 +080058 fontSize: '30rpx'
guangchao.xu070005a2020-12-07 09:56:40 +080059 },
60 payBtn: {
61 backgroundColor: ' #2FA8E1',
62 padding: '50rpx 0',
63 color: '#FFFFFF',
64 width: ' 600rpx',
65 fontSize: '30rpx',
66 border: '1px solid #2FA8E1',
67 marginTop: '50rpx'
68 },
guangchao.xu50e42382021-01-04 17:53:47 +080069 msg: {},
guangchao.xuc43cf972021-01-18 13:37:55 +080070 kind: ''
guangchao.xu070005a2020-12-07 09:56:40 +080071 }
72 },
guangchao.xu50e42382021-01-04 17:53:47 +080073 methods: {
74 // 呼起键盘
75 openKeyBoard(key) {
76 this.type = key;
77 this.$refs[key].open();
78 },
79 // 输入密码
80 onInput(val) {
81 this.numberList.push(val)
82 if (this.numberList.length == this.length) {
83 this.$refs.showPassword.close()
84 this.$refs[this.type].close()
85 this.pay()
86 }
87 },
88 //完成输入点击完成
89 onConfirm() {
90 let length = this.numberList.length
91 if (length == this.length) {
92 this.$refs.showPassword.close()
93 this.$refs[this.type].close()
94 } else {
95 this.numberList = []
96 uni.showToast({
97 title: '密码错误',
98 icon: 'none'
99 })
100 }
101 },
102 //删除密码
103 onDelete(val) {
104 this.numberList.pop(val)
105 },
106 //打开密码输入框
107 open() {
108 this.numberList = []
109 this.$refs.showPassword.open()
110 this.openKeyBoard('number')
111 },
112 pay() {
113 let that = this
114 let pwd = ''
115 let billno = that.msg.billNo
116 that.numberList.forEach(item => {
117 pwd += item + ''
118 })
119 let param = {
120 paypwd: pwd,
121 billno
122 }
123 that.$u.post('/medicalapi/pay', param).then(res => {
124 let status = res.status
125 let obj = that.msg
126 let date = res.transdate.substr(0, 4) +
127 "-" + res.transdate.substr(4, 2) + "-" + res.transdate.substr(6, 2) + " " + res.transtime.substr(0, 2) + ":" +
guangchao.xuc43cf972021-01-18 13:37:55 +0800128 res.transtime.substr(2, 2) + ":" + res.transtime.substr(4, 2)
129 setTimeout(() => {
130 uni.navigateTo({
131 url: `/pages/sub_medical/payResult?status=${status}&msg=${JSON.stringify(obj)}&date=${date}`
132 })
133 }, 1500)
guangchao.xu50e42382021-01-04 17:53:47 +0800134 })
135 },
136 query() {
137 let that = this
138 let billno = that.msg.billNo
139 that.$u.post('/medicalapi/pay/query/' + billno, {}).then(res => {
140 let status = res.status
guangchao.xuc43cf972021-01-18 13:37:55 +0800141 if (status == 'wip') {
guangchao.xu50e42382021-01-04 17:53:47 +0800142 uni.showToast({
guangchao.xuc43cf972021-01-18 13:37:55 +0800143 icon: 'none',
144 title: '订单正在支付中,请稍等...'
guangchao.xu50e42382021-01-04 17:53:47 +0800145 })
guangchao.xuc43cf972021-01-18 13:37:55 +0800146 } else {
guangchao.xu50e42382021-01-04 17:53:47 +0800147 let status = res.status
148 let obj = that.msg
149 let date = res.transdate.substr(0, 4) +
150 "-" + res.transdate.substr(4, 2) + "-" + res.transdate.substr(6, 2) + " " + res.transtime.substr(0, 2) + ":" +
guangchao.xuc43cf972021-01-18 13:37:55 +0800151 res.transtime.substr(2, 2) + ":" + res.transtime.substr(4, 2)
152 setTimeout(() => {
153 uni.navigateTo({
154 url: `/pages/sub_medical/payResult?status=${status}&msg=${JSON.stringify(obj)}&date=${date}`
155 })
156 }, 1500)
guangchao.xu50e42382021-01-04 17:53:47 +0800157 }
158 })
guangchao.xuc43cf972021-01-18 13:37:55 +0800159 },
160 notify_hosiptal() {
161 let that = this
162 let billno = that.msg.billno
163 that.$u.post('/medicalapi/pay/notify/' + billno).then(res => {
164 uni.showToast({
165 title: res.msg,
166 icon: 'none',
167 duration:800,
168 success(ret) {
169 setTimeout(() => {
170 uni.navigateBack({
171 delta: 1
172 })
173 }, 1500)
174 }
175 })
176 })
guangchao.xu50e42382021-01-04 17:53:47 +0800177 }
guangchao.xu070005a2020-12-07 09:56:40 +0800178 },
guangchao.xu50e42382021-01-04 17:53:47 +0800179 onLoad(options) {
180 let msg = JSON.parse(options.msg)
181 let id = options.id
182 this.kind = id
guangchao.xuc43cf972021-01-18 13:37:55 +0800183 if (id == 'unpay') {
guangchao.xu50e42382021-01-04 17:53:47 +0800184 msg.date = msg.medicalDate.substr(0, 4) + '-' + msg.medicalDate.substr(4, 2) + '-' + msg.medicalDate.substr(6, 2) +
185 ' ' + msg.medicalDate.substr(8, 2) + ':' + msg.medicalDate.substr(10, 2) + ':' + msg.medicalDate.substr(12, 2)
186 switch (msg.status) {
187 case 'init':
188 msg.status_ok = '未支付';
189 break
190 case 'wip':
191 msg.status_ok = '订单正在支付中...'
192 break
193 }
194 this.msg = msg
guangchao.xuc43cf972021-01-18 13:37:55 +0800195 } else if (id == 'payed') {
guangchao.xu50e42382021-01-04 17:53:47 +0800196 msg.date = msg.medicaldate.substr(0, 4) + '-' + msg.medicaldate.substr(4, 2) + '-' + msg.medicaldate.substr(6, 2) +
197 ' ' + msg.medicaldate.substr(8, 2) + ':' + msg.medicaldate.substr(10, 2) + ':' + msg.medicaldate.substr(12, 2)
guangchao.xuc43cf972021-01-18 13:37:55 +0800198 msg.billNo = msg.billno
199 msg.mergingSubtotal = msg.mergingsubtotal
200 msg.mergingName = msg.mergingname
201 msg.status_ok = '已完成'
202 switch (msg.refundflag) {
203 case 'wip':
204 msg.refundflag_ok = '退款处理中...';
205 break
206 case 'refund':
207 msg.refundflag_ok = '已退款';
208 }
guangchao.xu50e42382021-01-04 17:53:47 +0800209 this.msg = msg
210 }
guangchao.xu070005a2020-12-07 09:56:40 +0800211 }
212 }
213</script>
214
215<style lang="scss" scoped>
guangchao.xu50e42382021-01-04 17:53:47 +0800216 .u-cell-box {
guangchao.xu070005a2020-12-07 09:56:40 +0800217 margin-bottom: 30rpx;
218 }
guangchao.xu50e42382021-01-04 17:53:47 +0800219
220 .pay {
guangchao.xu070005a2020-12-07 09:56:40 +0800221 font-family: "PingFang-SC-Medium";
222 }
guangchao.xu50e42382021-01-04 17:53:47 +0800223
224 .pwd-wrapper {
225 background: rgba(0, 0, 0, .4);
226 z-index: 1;
227
228 /deep/.uni-popup__wrapper.uni-custom.center {
229 .uni-popup__wrapper-box {
230 position: unset;
231 max-width: none;
232 max-height: none;
233 overflow-y: hidden;
234 background: none;
235 margin-top: -70rpx;
236 padding: 60rpx 30rpx 30rpx;
237 }
238
239 .pwd-text-wrap {
240 width: 100%;
241 padding: 50rpx 43rpx 60rpx;
242 box-sizing: border-box;
243 }
244 }
245
246 .uni-tip {
247 /* #ifndef APP-NVUE */
248 display: flex;
249 flex-direction: column;
250 /* #endif */
251 margin-top: -60rpx;
252 width: 570rpx;
253 background-color: #fff;
254 border-radius: 12rpx;
255 position: relative;
256 }
257
258 .uni-pwd {
259 width: 630rpx;
260 }
261
262 .uni-tip-icon-wrap {
263 text-align: center;
264 }
265
266 .uni-tip-content {
267 padding: 31rpx 40rpx 60rpx;
268 font-size: 30rpx;
269 color: #6F737A;
270 }
271 }
272
273 .uni-tip-title {
274 margin-top: 30rpx;
275 text-align: center;
276 font-weight: 500;
277 font-size: 34rpx;
278 color: $uni-text-color;
279 }
guangchao.xu070005a2020-12-07 09:56:40 +0800280</style>