《业务需求》uniApp跳外部链接支付,并返回页面逻辑

321 阅读1分钟

Let's GO~

下单页面

下单

addPackageOrder({
		packageId,
		num,
		remark
		}).then(res => {
			if(res.data.code === 200){
				const orderInfo = res.data.data;
                		// 直接跳外部链接支付
                		location.href = orderInfo.payLink;				
			} else {
				toast(res.data.msg)
			}
})

跳到新建页面,并且访问外部链接

等客户支付完毕会跳到订单详情路径由后台返回

例如:pages/mine/MyOrderDetails/MyOrderDetails?orderId=1323175783287296002&shopId=14

自定义头部: 如果支付进入去掉所有历史 去首页, 如果是订单列表进来 返回上一页

	template
    
	<nv  :config="{'title':'订单详情'}" :isPayIn="isPayIn" />
   	
   	onLoad() {
    	this.isPayIn = this.$mp.query.isPayIn ? true : false;
    }
    // 返回方式

			howToBack(){
				console.log(this.isPayIn);
				if(this.isPayIn){
					// 跳商品首页
					uni.reLaunch({
					    url: '/'
					});
				} else {
					uni.navigateBack({
					    delta: 1
					});
				}
			}