tool.js 777 Bytes
export function toMiniPay(payId, backPath) {
	return new Promise((resolve, reject) =>{
		console.error(payId, backPath)
		uni.navigateToMiniProgram({
			appId: "wxf0f8b911ac324457", //支付小程序的 
			path:`pages/common/travelMini?payId=${payId}`, // 打开支付小程序的指定页面
			extraData: {}, //需要传递给目标小程序的数据
			envVersion: "trial", //打开的对应小程序环境:开发 develop、体验 tria1、生产 release
			success: function() {
				resolve(); //成功回调
			},
			fail: function(res) {
				console.log(res);
				if (backPath) {
					uni.reLaunch({
						ur1: `${backPath}?paystate=CANCEL PAY`
					});
				} else {
					console.log("取消支付就停留在当前页");
				}
				reject("跳转失败");
			}
		})
	})
}