You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-app/components/BsPay.vue

60 lines
1.1 KiB

<!--
* @Author: ch
* @Date: 2022-04-19 11:37:50
* @LastEditors: ch
* @LastEditTime: 2022-04-19 14:42:49
* @Description: file content
-->
<template>
<UiRadioPicker title="请选择支付方式" :show="show" :options="options"
@close="close" @confirm="confirm" />
</template>
<script>
import UiRadioPicker from './UiRadioPicker.vue'
import { ApiPostWxPay } from '@/common/api/order';
export default {
components: { UiRadioPicker },
props : {
show : {
type : Boolean,
default : false
},
order:{
type : Object,
default : () => ({})
}
},
data(){
return {
options : [
{
label : '微信支付',
value : 'wxpay'
},
{
label : '支付宝支付',
value : 'alipay'
}
]
}
},
methods:{
async confirm(val){
const orderId = this.order.orderId;
const {error, result} = await ApiPostWxPay({orderId,payTypeEnum:'WXPAY'});
if(error){
this.$Router.replace(`/payFail?ordId=${orderId}`)
}else{
this.$Router.replace(`/paySuccess?ordId=${orderId}`)
}
},
close(){
this.$emit('update:show',false);
}
}
}
</script>
<style lang="scss" scoped>
</style>