| | |
| | | <img class="select-pay-type-view-item-icon" :src="IconAliPay" /> |
| | | <div class="select-pay-type-view-item-text">支付宝支付</div> |
| | | </div> |
| | | <div class="select-pay-type-view-item" v-if="showWeixinPay" @click="handleWeixinPayByJsApi"> |
| | | <div class="select-pay-type-view-item" v-if="showWeixinPay" @click="handleWeixinPay"> |
| | | <img class="select-pay-type-view-item-icon" :src="IconWeixin" /> |
| | | <div class="select-pay-type-view-item-text">微信支付</div> |
| | | </div> |
| | | <NutToast :msg="state.msg" v-model:visible="state.show" type="warn" cover /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | GetPayOrderForJsAPIInput, |
| | | } from '@life-payment/core-vue'; |
| | | import { useQuery } from '@tanstack/vue-query'; |
| | | import { Toast as NutToast } from '@nutui/nutui-taro'; |
| | | import { reactive } from 'vue'; |
| | | |
| | | defineOptions({ |
| | | name: 'SelectPayTypeView', |
| | |
| | | (e: 'payOrderForJsAPISuccess'): void; |
| | | }>(); |
| | | |
| | | const state = reactive({ |
| | | show: false, |
| | | msg: '', |
| | | }); |
| | | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | async function handleAliPay() { |
| | |
| | | if (props.isInWeChat) { |
| | | handleWeixinPayByJsApi(); |
| | | } else { |
| | | try { |
| | | let res = await setLifePayOrderPayType(blLifeRecharge.constants.LifePayTypeEnum.WxPay); |
| | | if (res) { |
| | | location.href = res; |
| | | } |
| | | } catch (error) {} |
| | | // try { |
| | | // let res = await setLifePayOrderPayType(blLifeRecharge.constants.LifePayTypeEnum.WxPay); |
| | | // if (res) { |
| | | // location.href = res; |
| | | // } |
| | | // } catch (error) {} |
| | | state.msg = '请在微信中打开'; |
| | | state.show = true; |
| | | } |
| | | } |
| | | } |
| | |
| | | // 使用以上方式判断前端返回,微信团队郑重提示: |
| | | //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠,商户需进一步调用后端查单确认支付结果。 |
| | | } |
| | | }, |
| | | function (res) { |
| | | console.log('res: ', res); |
| | | } |
| | | ); |
| | | } |
| | |
| | | ); |
| | | }, |
| | | onSuccess(data) { |
| | | if (data === blLifeRecharge.constants.LifePayStatusEnum.已支付) { |
| | | if (data !== blLifeRecharge.constants.LifePayStatusEnum.未支付) { |
| | | emit('paySuccess', props.orderNo, props.lifePayOrderType); |
| | | } |
| | | }, |