merge
This commit is contained in:
@@ -2,39 +2,49 @@
|
||||
<view>
|
||||
<oct-pay :price="price" :coins="coins" :payNo="payNo" color="#34CE98" price-color="#e6576b"
|
||||
:payPlatform="platform" @onPay="pay" />
|
||||
<payKeyboard v-if="showKeyBoard" title="Mi安全键盘" @success="enterSuccess" @close="close"></payKeyboard>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
import payKeyboard from '@/components/mi-payKeyboard/mi-payKeyboard.vue'
|
||||
import eventBus from '../../utils/eventBus.js';
|
||||
import {
|
||||
wxPAY,
|
||||
alPAY,
|
||||
dtPAY
|
||||
dtPAY,
|
||||
payIndex
|
||||
} from '@/apis/interfaces/pay'
|
||||
export default {
|
||||
export default {
|
||||
components: { payKeyboard },
|
||||
data() {
|
||||
return {
|
||||
payNo: "",
|
||||
price: "",
|
||||
coins: "",
|
||||
platform: ['dtpay'],
|
||||
oepnType: '',
|
||||
canpay:true,
|
||||
oepnType: '',
|
||||
canpay: true,
|
||||
has_transfer_password: true,
|
||||
password: '',
|
||||
showKeyBoard: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.payNo = this.$Route.query.orderNo
|
||||
this.price = Number(this.$Route.query.price).toFixed(2)
|
||||
this.coins = this.$Route.query.coins
|
||||
if (this.$Route.query.oepnType === 'order') {
|
||||
this.oepnType = this.$Route.query.oepnType
|
||||
}
|
||||
|
||||
},
|
||||
onShow() {
|
||||
this.payIndex();
|
||||
},
|
||||
methods: {
|
||||
pay(e) {
|
||||
if (e.platform === 'dtpay') return this.getDTPAY(e.platform);
|
||||
uni.getProvider({
|
||||
if (e.platform === 'dtpay') return this.inputPassword();
|
||||
uni.getProvider({
|
||||
service: 'payment',
|
||||
success: res => {
|
||||
if (res.provider.findIndex(val => val === e.platform) < 0) {
|
||||
@@ -48,7 +58,7 @@
|
||||
case 'alipay':
|
||||
uni.showToast({
|
||||
title: '支付失败,您暂未安装支付宝',
|
||||
icon: 'none'
|
||||
icon: 'none'
|
||||
})
|
||||
break;
|
||||
}
|
||||
@@ -59,81 +69,136 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
//获取支付
|
||||
|
||||
payIndex() {
|
||||
payIndex().then(res => {
|
||||
console.log(res);
|
||||
this.has_transfer_password = res.has_transfer_password;
|
||||
this.coins = res.score
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: "none",
|
||||
mask: true,
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
// 输入支付密码
|
||||
inputPassword() {
|
||||
if (!this.has_transfer_password) {
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: '是否现在就去设置支付密码',
|
||||
confirmText: '立即设置',
|
||||
confirmColor: "#34CE98",
|
||||
cancelText: '再想想',
|
||||
cancelColor: "#666666",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$Router.push({
|
||||
name: "AccountResetPassword"
|
||||
})
|
||||
}
|
||||
this.canpay = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.showKeyBoard = true
|
||||
}
|
||||
},
|
||||
|
||||
// 输入正确的回调
|
||||
enterSuccess(password) {
|
||||
console.log(password) // 输入的密码
|
||||
this.password = password
|
||||
this.showKeyBoard = false
|
||||
this.getDTPAY();
|
||||
},
|
||||
// 点击[取消] 关闭输入框 的回调
|
||||
close(){
|
||||
this.showKeyBoard = false;
|
||||
this.canpay = true;
|
||||
},
|
||||
|
||||
// 调用 dt 支付
|
||||
getDTPAY() {
|
||||
console.log('dt 支付。。。')
|
||||
if(this.canpay){
|
||||
console.log('dt 支付。。。')
|
||||
if (this.canpay) {
|
||||
this.canpay = false
|
||||
dtPAY(this.payNo).then(res => {
|
||||
if (res.state === 'warning') {
|
||||
uni.showModal({
|
||||
title: '当前DT积分不足',
|
||||
content: '不能支付该订单,是否放弃当前支付',
|
||||
confirmText: '立即充值',
|
||||
confirmColor: "#34CE98",
|
||||
cancelText: '放弃支付',
|
||||
cancelColor: "#666666",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$Router.push({
|
||||
name: "AccountRecharge"
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
this.canpay = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (this.oepnType === 'order') {
|
||||
uni.showModal({
|
||||
title: '支付成功',
|
||||
content: '该订单已支付成功',
|
||||
confirmText: ' 返回订单',
|
||||
confirmColor: "#34CE98",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$Router.back();
|
||||
eventBus.$emit('paySuccess', this.payNo);
|
||||
}
|
||||
this.canpay = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '支付成功',
|
||||
content: '该订单已支付成功',
|
||||
confirmText: '我的订单',
|
||||
confirmColor: "#34CE98",
|
||||
cancelText: '再逛逛',
|
||||
cancelColor: "#666666",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$Router.push({
|
||||
name: "Order",
|
||||
params: {
|
||||
index: 0
|
||||
},
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
this.canpay = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: "none",
|
||||
mask: true,
|
||||
})
|
||||
this.canpay = true
|
||||
})
|
||||
|
||||
}
|
||||
console.log(this.password,this.payNo,'//////////')
|
||||
dtPAY(this.payNo, this.password).then(res => {
|
||||
if (res.state === 'warning') {
|
||||
uni.showModal({
|
||||
title: '当前DT积分不足',
|
||||
content: '不能支付该订单,是否放弃当前支付',
|
||||
confirmText: '立即充值',
|
||||
confirmColor: "#34CE98",
|
||||
cancelText: '放弃支付',
|
||||
cancelColor: "#666666",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$Router.push({
|
||||
name: "AccountRecharge"
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
this.canpay = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (this.oepnType === 'order') {
|
||||
uni.showModal({
|
||||
title: '支付成功',
|
||||
content: '该订单已支付成功',
|
||||
confirmText: ' 返回订单',
|
||||
confirmColor: "#34CE98",
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$Router.back();
|
||||
eventBus.$emit('paySuccess', this.payNo);
|
||||
}
|
||||
this.canpay = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '支付成功',
|
||||
content: '该订单已支付成功',
|
||||
confirmText: '我的订单',
|
||||
confirmColor: "#34CE98",
|
||||
cancelText: '再逛逛',
|
||||
cancelColor: "#666666",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$Router.push({
|
||||
name: "Order",
|
||||
params: {
|
||||
index: 0
|
||||
},
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
this.canpay = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: "none",
|
||||
mask: true,
|
||||
})
|
||||
this.canpay = true
|
||||
})
|
||||
}
|
||||
},
|
||||
getALPAY(payType) {
|
||||
alPAY(this.payNo).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user