mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-18 08:25:55 +08:00
提交im 优化app 中余额支付
This commit is contained in:
@@ -226,13 +226,18 @@
|
||||
const paymentMethod = payment;
|
||||
// 客户端类型 APP/NATIVE/JSAPI/H5
|
||||
const paymentClient = this.paymentClient;
|
||||
|
||||
|
||||
uni.showLoading({
|
||||
title: "正在唤起支付...",
|
||||
mask:true
|
||||
});
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
//APP pay
|
||||
// 初始化支付签名
|
||||
await API_Trade.initiatePay(paymentMethod, paymentClient, params).then(
|
||||
(signXml) => {
|
||||
|
||||
uni.hideLoading();
|
||||
//如果支付异常
|
||||
if (!signXml.data.success) {
|
||||
uni.showToast({
|
||||
@@ -241,33 +246,39 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let payForm = signXml.data.result;
|
||||
|
||||
|
||||
let paymentType = paymentMethod === "WECHAT" ? "wxpay" : "alipay";
|
||||
uni.requestPayment({
|
||||
provider: paymentType,
|
||||
orderInfo: payForm,
|
||||
success: (e) => {
|
||||
console.log(e);
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "支付成功!",
|
||||
});
|
||||
|
||||
this.callback(paymentMethod)
|
||||
|
||||
|
||||
},
|
||||
fail: (e) => {
|
||||
console.log(this);
|
||||
this.exception = e;
|
||||
uni.showModal({
|
||||
content: "支付失败,如果您已支付,请勿反复支付",
|
||||
showCancel: false,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
if(paymentMethod === "WALLET"){
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "支付成功!",
|
||||
});
|
||||
this.callback(paymentMethod)
|
||||
}
|
||||
else{
|
||||
uni.requestPayment({
|
||||
provider: paymentType,
|
||||
orderInfo: payForm || '',
|
||||
success: (e) => {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "支付成功!",
|
||||
});
|
||||
this.callback(paymentMethod)
|
||||
},
|
||||
fail: (e) => {
|
||||
console.log(this);
|
||||
this.exception = e;
|
||||
uni.showModal({
|
||||
content: "支付失败,如果您已支付,请勿反复支付",
|
||||
showCancel: false,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
//APP pay
|
||||
|
||||
@@ -382,7 +382,6 @@ import popupGoods from "@/components/m-buy/goods"; //购物车商品的模块
|
||||
import popupAddress from "./product/popup/address"; //地址选择模块
|
||||
import shares from "@/components/m-share/index"; //分享
|
||||
import popups from "@/components/popups/popups"; //气泡框
|
||||
|
||||
import setup from "./product/popup/popup";
|
||||
export default {
|
||||
components: {
|
||||
@@ -527,7 +526,8 @@ export default {
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
computed: {
|
||||
// udesk IM
|
||||
IM() {
|
||||
return this.IMLink + this.storeDetail.merchantEuid;
|
||||
},
|
||||
@@ -708,40 +708,49 @@ export default {
|
||||
},
|
||||
|
||||
linkMsgDetail() {
|
||||
if (this.storeDetail.merchantEuid) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/tabbar/home/web-view?src=${this.IM}`,
|
||||
});
|
||||
} else {
|
||||
// 客服
|
||||
// #ifdef MP-WEIXIN
|
||||
const params = {
|
||||
storeName: this.storeDetail.storeName,
|
||||
goodsName: this.goodsDetail.goodsName,
|
||||
goodsId: this.goodsDetail.goodsId,
|
||||
goodsImg: this.goodsDetail.thumbnail,
|
||||
price: this.goodsDetail.promotionPrice || this.goodsDetail.price,
|
||||
// originalPrice: this.goodsDetail.original || this.goodsDetail.price,
|
||||
uuid: storage.getUuid(),
|
||||
token: storage.getAccessToken(),
|
||||
sign: this.storeDetail.yzfSign,
|
||||
mpSign: this.storeDetail.yzfMpSign,
|
||||
};
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pages/product/customerservice/index?params=" +
|
||||
encodeURIComponent(JSON.stringify(params)),
|
||||
});
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
const sign = this.storeDetail.yzfSign;
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
|
||||
sign,
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
// lili 基础客服
|
||||
|
||||
uni.navigateTo({
|
||||
url: `/pages/tabbar/home/web-view?IM=${this.storeDetail.storeId}`,
|
||||
});
|
||||
|
||||
// udesk 代码
|
||||
// if (this.storeDetail.merchantEuid) {
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/tabbar/home/web-view?src=${this.IM}`,
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
// 客服 云智服代码
|
||||
// // #ifdef MP-WEIXIN
|
||||
// const params = {
|
||||
// storeName: this.storeDetail.storeName,
|
||||
// goodsName: this.goodsDetail.goodsName,
|
||||
// goodsId: this.goodsDetail.goodsId,
|
||||
// goodsImg: this.goodsDetail.thumbnail,
|
||||
// price: this.goodsDetail.promotionPrice || this.goodsDetail.price,
|
||||
// // originalPrice: this.goodsDetail.original || this.goodsDetail.price,
|
||||
// uuid: storage.getUuid(),
|
||||
// token: storage.getAccessToken(),
|
||||
// sign: this.storeDetail.yzfSign,
|
||||
// mpSign: this.storeDetail.yzfMpSign,
|
||||
// };
|
||||
// uni.navigateTo({
|
||||
// url:
|
||||
// "/pages/product/customerservice/index?params=" +
|
||||
// encodeURIComponent(JSON.stringify(params)),
|
||||
// });
|
||||
// // #endif
|
||||
// // #ifndef MP-WEIXIN
|
||||
// const sign = this.storeDetail.yzfSign;
|
||||
// uni.navigateTo({
|
||||
// url:
|
||||
// "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
|
||||
// sign,
|
||||
// });
|
||||
// // #endif
|
||||
|
||||
},
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
formatPrice(val) {
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import configs from "@/config/config";
|
||||
import storage from "@/utils/storage";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
configs,
|
||||
storage,
|
||||
webviewStyles: {
|
||||
progress: {
|
||||
color: this.$lightColor,
|
||||
@@ -17,7 +21,12 @@ export default {
|
||||
};
|
||||
},
|
||||
onLoad(params) {
|
||||
this.src = decodeURIComponent(params.src);
|
||||
params.IM
|
||||
? (this.src = `${configs.imWebSrc}?token=${storage.getAccessToken()}&id=${
|
||||
params.IM
|
||||
}`)
|
||||
: (this.src = decodeURIComponent(params.src));
|
||||
console.log(this.src);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -29,4 +38,4 @@ export default {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user