|
@@ -0,0 +1,265 @@
|
|
|
+<!-- eslint-disable no-tabs -->
|
|
|
+<template>
|
|
|
+ <div class="container card clearfix">
|
|
|
+ <div class="card-content">
|
|
|
+ <div class="card-title" v-if="subType === 2 || subType === 3">
|
|
|
+ <div class="card-pay-text">¥{{ payAmount }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="card-mains">
|
|
|
+ <div class="card-form-text">已发送至手机号 {{ phoneNumbe }}</div>
|
|
|
+ <div class="card-form">
|
|
|
+ <van-field
|
|
|
+ class="card-input"
|
|
|
+ v-model="codeParams.bindCode"
|
|
|
+ @input="handleInput"
|
|
|
+ type="number"
|
|
|
+ maxlength="6"
|
|
|
+ placeholder="请输入短信验证码"
|
|
|
+ />
|
|
|
+ <div
|
|
|
+ class="card-form-code"
|
|
|
+ :class="isMobileDisabled ? 'disabled' : ''"
|
|
|
+ @click.stop="handleMobileCode"
|
|
|
+ >
|
|
|
+ <span>{{ mobileCodeText }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="card-mains-btn">
|
|
|
+ <van-button
|
|
|
+ class="add-btn"
|
|
|
+ :disabled="disabled"
|
|
|
+ :class="[disabled ? 'disabled' : '']"
|
|
|
+ @click="handleAddCard"
|
|
|
+ >
|
|
|
+ {{ suBbtnText }}
|
|
|
+ </van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { orderPayQuickPay, orderPayQuickBindCard } from '@/api/institutionApi/pay'
|
|
|
+export default {
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ orderId: 0,
|
|
|
+ params: {},
|
|
|
+ payAmount: '',
|
|
|
+ isMobileDisabled: true, // 手机验证码按钮控制
|
|
|
+ mobilCount: '', // 倒计时
|
|
|
+ mobileCodeText: '重新发送',
|
|
|
+ mobilTime: null,
|
|
|
+ codeParams: {
|
|
|
+ orderId: '',
|
|
|
+ infoId: '',
|
|
|
+ bindCode: '',
|
|
|
+ flag: 1 // 1绑卡 2 付款
|
|
|
+ },
|
|
|
+ skeletonShow: true,
|
|
|
+ suBbtnText: '确认绑定'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.initOption()
|
|
|
+ },
|
|
|
+ filters: {},
|
|
|
+ computed: {
|
|
|
+ phoneNumbe () {
|
|
|
+ // 手机号仅显示前三位及后四位数字,隐藏信息用*代替
|
|
|
+ return this.params.quickPayMobile.substr(0, 3) + '****' + this.params.quickPayMobile.substring(7)
|
|
|
+ },
|
|
|
+ disabled () {
|
|
|
+ return !(this.codeParams.bindCode.length > 4)
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return JSON.parse(this.$route.query.data)
|
|
|
+ },
|
|
|
+ subType () { // 1直接绑卡 2//首次绑卡并支付 3//确认支付
|
|
|
+ return this.$route.query.type * 1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initOption () {
|
|
|
+ this.params = this.data.params
|
|
|
+ this.codeParams = Object.assign(this.codeParams, this.data.payData)
|
|
|
+ if (this.subType === 1) {
|
|
|
+ this.codeParams.flag = 1
|
|
|
+ } else {
|
|
|
+ this.codeParams.flag = 2
|
|
|
+ this.orderId = this.data.orderId
|
|
|
+ this.payAmount = this.params.quickPayFlag === 2 ? this.data.payAmount : this.params.payAmount
|
|
|
+ }
|
|
|
+ this.handleCodeTime()
|
|
|
+ this.handleBbtnText(this.subType)
|
|
|
+ },
|
|
|
+ handleCodeTime () {
|
|
|
+ // 倒计时
|
|
|
+ const TIME_COUNT = 60
|
|
|
+ if (!this.mobilTime) {
|
|
|
+ this.mobilCount = TIME_COUNT
|
|
|
+ this.isMobileDisabled = true
|
|
|
+ this.mobilTime = setInterval(() => {
|
|
|
+ if (this.mobilCount > 1 && this.mobilCount <= TIME_COUNT) {
|
|
|
+ this.mobilCount--
|
|
|
+ this.mobileCodeText = this.mobilCount + '秒后重发'
|
|
|
+ } else {
|
|
|
+ this.isMobileDisabled = false
|
|
|
+ clearInterval(this.mobilTime)
|
|
|
+ this.mobilTime = null
|
|
|
+ this.mobileCodeText = '重新发送'
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleBbtnText (value) {
|
|
|
+ const textMap = {
|
|
|
+ 1: '确认绑定',
|
|
|
+ 2: '确认绑定支付',
|
|
|
+ 3: '确认支付'
|
|
|
+ }
|
|
|
+ this.suBbtnText = textMap[value]
|
|
|
+ },
|
|
|
+ async handleAddCard () {
|
|
|
+ // 提交绑定或支付
|
|
|
+ try {
|
|
|
+ const loadText = this.subType === 1 ? '绑定中...' : '支付中...'
|
|
|
+ const successMsg = this.subType === 1 ? '绑定成功' : '支付成功'
|
|
|
+ await this.PayService.orderPayQuickBindCode(this.codeParams, loadText)
|
|
|
+ this.$util.msg(successMsg, 2000, true, 'success')
|
|
|
+ setTimeout(() => {
|
|
|
+ this.handleSuccessHref()
|
|
|
+ }, 2000)
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ this.$util.msg(error.msg, 2000)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSuccessHref () {
|
|
|
+ // tiaozhuan
|
|
|
+ if (this.subType === 1) {
|
|
|
+ this.$api.navigateBack(2)
|
|
|
+ } else {
|
|
|
+ if (this.params.quickPayFlag === 1) {
|
|
|
+ const linkData = {
|
|
|
+ payAmount: this.params.payAmount,
|
|
|
+ shopOrderId: this.shopOrderId,
|
|
|
+ orderId: this.orderId,
|
|
|
+ type: 'success'
|
|
|
+ }
|
|
|
+ this.$api.redirectTo(`/order-success?data=${JSON.stringify({ data: linkData })}`)
|
|
|
+ } else {
|
|
|
+ this.$api.redirectTo('/pages/user/member/member')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleMobileCode () {
|
|
|
+ // 获取短信验证码
|
|
|
+ this.isMobileDisabled = true
|
|
|
+ if (this.subType === 1) {
|
|
|
+ this.orderPayQuickBindCard()
|
|
|
+ } else {
|
|
|
+ this.orderPayQuickPay()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async orderPayQuickBindCard () {
|
|
|
+ // 直只绑卡
|
|
|
+ try {
|
|
|
+ await orderPayQuickBindCard(this.params)
|
|
|
+ this.handleCodeTime()
|
|
|
+ } catch (error) {
|
|
|
+ this.isMobileDisabled = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async orderPayQuickPay () {
|
|
|
+ // 绑卡并支付
|
|
|
+ try {
|
|
|
+ await orderPayQuickPay(this.params)
|
|
|
+ this.handleCodeTime()
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ this.isMobileDisabled = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.container-cash{
|
|
|
+ width: 100%;
|
|
|
+ .container-wrapper{
|
|
|
+ width:100%;
|
|
|
+ height: auto;
|
|
|
+ padding: 6vw 1.2vw 0 1.2vw;
|
|
|
+ box-sizing: border-box;
|
|
|
+ .cash-icon{
|
|
|
+ width: 100%;
|
|
|
+ height: 4.5vw;
|
|
|
+ text-align: center;
|
|
|
+ .iconfont{
|
|
|
+ font-size: 4vw;
|
|
|
+ &.icon-wancheng{
|
|
|
+ color:#00BE6F;
|
|
|
+ }
|
|
|
+ &.icon-shibai{
|
|
|
+ color:#F94B4B;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .cash-text{
|
|
|
+ width: 100%;
|
|
|
+ height: 4.5vw;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 1.4vw;
|
|
|
+ color: #333333;
|
|
|
+ line-height: 4.5vw;
|
|
|
+ padding-bottom: 2vw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .container-amount{
|
|
|
+ width: 100%;
|
|
|
+ height: 6.5vw;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 1.2vw;
|
|
|
+ margin-bottom: 1.2vw;
|
|
|
+ font-size: 1.4vw;
|
|
|
+ color: #333333;
|
|
|
+ line-height: 4.5vw;
|
|
|
+ border-top: 1vw solid #F7F7F7;
|
|
|
+ border-bottom: 1vw solid #F7F7F7;
|
|
|
+ .amount-label{
|
|
|
+ float: left;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .amount-money{
|
|
|
+ float: right;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .container-button{
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 4vw 3.75vw;
|
|
|
+ .btn{
|
|
|
+ width: 100%;
|
|
|
+ height: 4.5vw;
|
|
|
+ border-radius: 2.5vw;
|
|
|
+ line-height: 4.5vw;
|
|
|
+ box-sizing: border-box;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 1.4vw;
|
|
|
+ color: #FFFFFF;
|
|
|
+ margin: 1.2vw 0;
|
|
|
+ &.btn-open{
|
|
|
+ background:#FFFFFF;
|
|
|
+ border: 1px solid #FF5B00;
|
|
|
+ color: #FF5B00;
|
|
|
+ }
|
|
|
+ &.btn-home{
|
|
|
+ background: linear-gradient(90deg, #FF9300 0%, #FF5B00 100%);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|