| | |
| | | <script setup lang="ts"> |
| | | import IconWeixin from '../../../assets/icon-weixin-pay.png'; |
| | | import IconAliPay from '../../../assets/icon-alipay.png'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { |
| | | useLifeRechargeContext, |
| | | SetLifePayOrderPayTypeInput, |
| | |
| | | name: 'SelectPayTypeView', |
| | | }); |
| | | |
| | | // type Props = {}; |
| | | type Props = { |
| | | orderNo?: string; |
| | | lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum; |
| | | }; |
| | | |
| | | // const props = withDefaults(defineProps<Props>(), {}); |
| | | const props = withDefaults(defineProps<Props>(), {}); |
| | | |
| | | const emit = defineEmits<{ |
| | | (e: 'paySuccess', id: number): void; |
| | | ( |
| | | e: 'paySuccess', |
| | | orderNo: string, |
| | | lifePayOrderType: LifeRechargeConstants.LifePayOrderTypeEnum |
| | | ): void; |
| | | }>(); |
| | | |
| | | const router = Taro.useRouter(); |
| | | const orderNo = router.params?.orderNo ?? ''; |
| | | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | |
| | | async function setLifePayOrderPayType(lifePayType: LifeRechargeConstants.LifePayTypeEnum) { |
| | | try { |
| | | let params: SetLifePayOrderPayTypeInput = { |
| | | orderNo: orderNo, |
| | | orderNo: props.orderNo, |
| | | lifePayType: lifePayType, |
| | | }; |
| | | return await blLifeRecharge.services.setLifePayOrderPayType(params); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | // useQuery({ |
| | | // queryKey: ['platformServicePayServices/getPlaformServicePayQRCode', orderNo], |
| | | // queryFn: async () => { |
| | | // return await blLifeRecharge.services.getPayStatusByOrderNo( |
| | | // { |
| | | // orderNo, |
| | | // }, |
| | | // { |
| | | // showLoading: false, |
| | | // } |
| | | // ); |
| | | // }, |
| | | // onSuccess(data) { |
| | | // if (data === blLifeRecharge.constants.LifePayStatusEnum.已支付) { |
| | | // } |
| | | // }, |
| | | // refetchInterval: 1000 * 3, |
| | | // }); |
| | | useQuery({ |
| | | queryKey: ['platformServicePayServices/getPayStatusByOrderNo', props.orderNo], |
| | | queryFn: async () => { |
| | | return await blLifeRecharge.services.getPayStatusByOrderNo( |
| | | { |
| | | orderNo: props.orderNo, |
| | | }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | }, |
| | | onSuccess(data) { |
| | | if (data === blLifeRecharge.constants.LifePayStatusEnum.已支付) { |
| | | emit('paySuccess', props.orderNo, props.lifePayOrderType); |
| | | } |
| | | }, |
| | | refetchInterval: 1000 * 3, |
| | | }); |
| | | </script> |