guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 1 | <template> |
| 2 | <view class="pay"> |
| 3 | <u-cell-group> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 4 | <u-cell-item :title="msg.mergingName" :title-style="tstyle" :arrow="false"> |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 5 | <u-image slot="icon" src="./images/cush.png" width="60" height="60" mode="aspectFit"></u-image> |
| 6 | </u-cell-item> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 7 | <u-cell-item title="缴费金额" :arrow="false" :value="msg.mergingSubtotal+'元'" :value-style="vstyle"></u-cell-item> |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 8 | </u-cell-group> |
| 9 | <u-cell-group> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 10 | <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.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 14 | <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.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 17 | </u-cell-group> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 18 | <u-button @click="msg.status=='wip'?query():open()" :custom-style="payBtn" v-if="kind =='unpay'">{{msg.status=='wip'?'查询订单状态':'立即支付'}}</u-button> |
guangchao.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 19 | <u-button @click="notify_hosiptal" :custom-style="payBtn" v-if="kind =='payed'&& msg.notifyStatus == false">通知医院</u-button> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 20 | <!-- 支付密码弹框 --> |
| 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.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 30 | </view> |
| 31 | </template> |
| 32 | |
| 33 | <script> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 34 | 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.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 48 | tstyle: { |
| 49 | marginLeft: '10rpx', |
| 50 | fontWeight: 'bold' |
| 51 | }, |
| 52 | vstyle: { |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 53 | color: '#FF6F6F', |
guangchao.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 54 | fontSize: '30rpx' |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 55 | }, |
| 56 | status_style: { |
| 57 | color: '#18B566', |
guangchao.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 58 | fontSize: '30rpx' |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 59 | }, |
| 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.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 69 | msg: {}, |
guangchao.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 70 | kind: '' |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 71 | } |
| 72 | }, |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 73 | 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.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 128 | 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.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 134 | }) |
| 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.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 141 | if (status == 'wip') { |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 142 | uni.showToast({ |
guangchao.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 143 | icon: 'none', |
| 144 | title: '订单正在支付中,请稍等...' |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 145 | }) |
guangchao.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 146 | } else { |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 147 | 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.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 151 | 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.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 157 | } |
| 158 | }) |
guangchao.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 159 | }, |
| 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.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 177 | } |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 178 | }, |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 179 | onLoad(options) { |
| 180 | let msg = JSON.parse(options.msg) |
| 181 | let id = options.id |
| 182 | this.kind = id |
guangchao.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 183 | if (id == 'unpay') { |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 184 | 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.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 195 | } else if (id == 'payed') { |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 196 | 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.xu | c43cf97 | 2021-01-18 13:37:55 +0800 | [diff] [blame^] | 198 | 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.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 209 | this.msg = msg |
| 210 | } |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 211 | } |
| 212 | } |
| 213 | </script> |
| 214 | |
| 215 | <style lang="scss" scoped> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 216 | .u-cell-box { |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 217 | margin-bottom: 30rpx; |
| 218 | } |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 219 | |
| 220 | .pay { |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 221 | font-family: "PingFang-SC-Medium"; |
| 222 | } |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 223 | |
| 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.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 280 | </style> |