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> --> |
| 14 | <u-cell-item title="交易状态" :arrow="false" :value="msg.status_ok" :value-style="msg.status=='wip'?status_style:vstyle"></u-cell-item> |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 15 | </u-cell-group> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 16 | <u-button @click="msg.status=='wip'?query():open()" :custom-style="payBtn" v-if="kind =='unpay'">{{msg.status=='wip'?'查询订单状态':'立即支付'}}</u-button> |
| 17 | <u-button @click="" :custom-style="payBtn" v-if="kind =='payed'&& msg.notifyStatus == false">通知医院</u-button> |
| 18 | <!-- 支付密码弹框 --> |
| 19 | <uni-popup ref="showPassword" class="pwd-wrapper"> |
| 20 | <view class="uni-tip uni-pwd"> |
| 21 | <text class="uni-tip-title">请输入支付密码</text> |
| 22 | <view class="pwd-text-wrap"> |
| 23 | <password-input @tap="openKeyBoard('number')" :length="length" :gutter="0" :list="numberList"></password-input> |
| 24 | </view> |
| 25 | </view> |
| 26 | </uni-popup> |
| 27 | <keyboard-package ref="number" @onInput="onInput" @onDelete="onDelete" @onConfirm="onConfirm" :disableDot="true" /> |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 28 | </view> |
| 29 | </template> |
| 30 | |
| 31 | <script> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 32 | import keyboardPackage from "./z_components/keyboard-package/keyboard-package.vue" |
| 33 | import passwordInput from "./z_components/password-input/password-input.vue" |
| 34 | import uniPopup from './z_components/uni-popup/uni-popup.vue' |
| 35 | export default { |
| 36 | components: { |
| 37 | uniPopup, |
| 38 | keyboardPackage, |
| 39 | passwordInput |
| 40 | }, |
| 41 | data() { |
| 42 | return { |
| 43 | numberList: [], |
| 44 | length: 6, |
| 45 | type: 'number', |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 46 | tstyle: { |
| 47 | marginLeft: '10rpx', |
| 48 | fontWeight: 'bold' |
| 49 | }, |
| 50 | vstyle: { |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 51 | color: '#FF6F6F', |
| 52 | fontSize:'30rpx' |
| 53 | }, |
| 54 | status_style: { |
| 55 | color: '#18B566', |
| 56 | fontSize:'30rpx' |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 57 | }, |
| 58 | payBtn: { |
| 59 | backgroundColor: ' #2FA8E1', |
| 60 | padding: '50rpx 0', |
| 61 | color: '#FFFFFF', |
| 62 | width: ' 600rpx', |
| 63 | fontSize: '30rpx', |
| 64 | border: '1px solid #2FA8E1', |
| 65 | marginTop: '50rpx' |
| 66 | }, |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 67 | msg: {}, |
| 68 | kind:'' |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 69 | } |
| 70 | }, |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 71 | methods: { |
| 72 | // 呼起键盘 |
| 73 | openKeyBoard(key) { |
| 74 | this.type = key; |
| 75 | this.$refs[key].open(); |
| 76 | }, |
| 77 | // 输入密码 |
| 78 | onInput(val) { |
| 79 | this.numberList.push(val) |
| 80 | if (this.numberList.length == this.length) { |
| 81 | this.$refs.showPassword.close() |
| 82 | this.$refs[this.type].close() |
| 83 | this.pay() |
| 84 | } |
| 85 | }, |
| 86 | //完成输入点击完成 |
| 87 | onConfirm() { |
| 88 | let length = this.numberList.length |
| 89 | if (length == this.length) { |
| 90 | this.$refs.showPassword.close() |
| 91 | this.$refs[this.type].close() |
| 92 | } else { |
| 93 | this.numberList = [] |
| 94 | uni.showToast({ |
| 95 | title: '密码错误', |
| 96 | icon: 'none' |
| 97 | }) |
| 98 | } |
| 99 | }, |
| 100 | //删除密码 |
| 101 | onDelete(val) { |
| 102 | this.numberList.pop(val) |
| 103 | }, |
| 104 | //打开密码输入框 |
| 105 | open() { |
| 106 | this.numberList = [] |
| 107 | this.$refs.showPassword.open() |
| 108 | this.openKeyBoard('number') |
| 109 | }, |
| 110 | pay() { |
| 111 | let that = this |
| 112 | let pwd = '' |
| 113 | let billno = that.msg.billNo |
| 114 | that.numberList.forEach(item => { |
| 115 | pwd += item + '' |
| 116 | }) |
| 117 | let param = { |
| 118 | paypwd: pwd, |
| 119 | billno |
| 120 | } |
| 121 | that.$u.post('/medicalapi/pay', param).then(res => { |
| 122 | let status = res.status |
| 123 | let obj = that.msg |
| 124 | let date = res.transdate.substr(0, 4) + |
| 125 | "-" + res.transdate.substr(4, 2) + "-" + res.transdate.substr(6, 2) + " " + res.transtime.substr(0, 2) + ":" + |
| 126 | res.transtime.substr(2, 2) + ":" + res.transtime.substr(4, 2) |
| 127 | setTimeout(()=>{ |
| 128 | uni.navigateTo({ |
| 129 | url: `/pages/sub_medical/payResult?status=${status}&msg=${JSON.stringify(obj)}&date=${date}` |
| 130 | }) |
| 131 | },1500) |
| 132 | }) |
| 133 | }, |
| 134 | query() { |
| 135 | let that = this |
| 136 | let billno = that.msg.billNo |
| 137 | that.$u.post('/medicalapi/pay/query/' + billno, {}).then(res => { |
| 138 | let status = res.status |
| 139 | if(status == 'wip'){ |
| 140 | uni.showToast({ |
| 141 | icon:'none', |
| 142 | title:'订单正在支付中,请稍等...' |
| 143 | }) |
| 144 | }else{ |
| 145 | let status = res.status |
| 146 | let obj = that.msg |
| 147 | let date = res.transdate.substr(0, 4) + |
| 148 | "-" + res.transdate.substr(4, 2) + "-" + res.transdate.substr(6, 2) + " " + res.transtime.substr(0, 2) + ":" + |
| 149 | res.transtime.substr(2, 2) + ":" + res.transtime.substr(4, 2) |
| 150 | setTimeout(()=>{ |
| 151 | uni.navigateTo({ |
| 152 | url: `/pages/sub_medical/payResult?status=${status}&msg=${JSON.stringify(obj)}&date=${date}` |
| 153 | }) |
| 154 | },1500) |
| 155 | } |
| 156 | }) |
| 157 | } |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 158 | }, |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 159 | onLoad(options) { |
| 160 | let msg = JSON.parse(options.msg) |
| 161 | let id = options.id |
| 162 | this.kind = id |
| 163 | if(id == 'unpay'){ |
| 164 | msg.date = msg.medicalDate.substr(0, 4) + '-' + msg.medicalDate.substr(4, 2) + '-' + msg.medicalDate.substr(6, 2) + |
| 165 | ' ' + msg.medicalDate.substr(8, 2) + ':' + msg.medicalDate.substr(10, 2) + ':' + msg.medicalDate.substr(12, 2) |
| 166 | switch (msg.status) { |
| 167 | case 'init': |
| 168 | msg.status_ok = '未支付'; |
| 169 | break |
| 170 | case 'wip': |
| 171 | msg.status_ok = '订单正在支付中...' |
| 172 | break |
| 173 | } |
| 174 | this.msg = msg |
| 175 | }else if(id == 'payed'){ |
| 176 | msg.date = msg.medicaldate.substr(0, 4) + '-' + msg.medicaldate.substr(4, 2) + '-' + msg.medicaldate.substr(6, 2) + |
| 177 | ' ' + msg.medicaldate.substr(8, 2) + ':' + msg.medicaldate.substr(10, 2) + ':' + msg.medicaldate.substr(12, 2) |
| 178 | msg.billNo = msg.billno |
| 179 | msg.mergingSubtotal = msg.mergingsubtotal |
| 180 | msg.mergingName = msg.mergingname |
| 181 | msg.status_ok = '已完成' |
| 182 | msg.hospitalName = msg.hospitalname |
| 183 | this.msg = msg |
| 184 | } |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | </script> |
| 188 | |
| 189 | <style lang="scss" scoped> |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 190 | .u-cell-box { |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 191 | margin-bottom: 30rpx; |
| 192 | } |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 193 | |
| 194 | .pay { |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 195 | font-family: "PingFang-SC-Medium"; |
| 196 | } |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame^] | 197 | |
| 198 | .pwd-wrapper { |
| 199 | background: rgba(0, 0, 0, .4); |
| 200 | z-index: 1; |
| 201 | |
| 202 | /deep/.uni-popup__wrapper.uni-custom.center { |
| 203 | .uni-popup__wrapper-box { |
| 204 | position: unset; |
| 205 | max-width: none; |
| 206 | max-height: none; |
| 207 | overflow-y: hidden; |
| 208 | background: none; |
| 209 | margin-top: -70rpx; |
| 210 | padding: 60rpx 30rpx 30rpx; |
| 211 | } |
| 212 | |
| 213 | .pwd-text-wrap { |
| 214 | width: 100%; |
| 215 | padding: 50rpx 43rpx 60rpx; |
| 216 | box-sizing: border-box; |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | .uni-tip { |
| 221 | /* #ifndef APP-NVUE */ |
| 222 | display: flex; |
| 223 | flex-direction: column; |
| 224 | /* #endif */ |
| 225 | margin-top: -60rpx; |
| 226 | width: 570rpx; |
| 227 | background-color: #fff; |
| 228 | border-radius: 12rpx; |
| 229 | position: relative; |
| 230 | } |
| 231 | |
| 232 | .uni-pwd { |
| 233 | width: 630rpx; |
| 234 | } |
| 235 | |
| 236 | .uni-tip-icon-wrap { |
| 237 | text-align: center; |
| 238 | } |
| 239 | |
| 240 | .uni-tip-content { |
| 241 | padding: 31rpx 40rpx 60rpx; |
| 242 | font-size: 30rpx; |
| 243 | color: #6F737A; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | .uni-tip-title { |
| 248 | margin-top: 30rpx; |
| 249 | text-align: center; |
| 250 | font-weight: 500; |
| 251 | font-size: 34rpx; |
| 252 | color: $uni-text-color; |
| 253 | } |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 254 | </style> |