mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
Live chat method updated , Alipay payment gatewat integrated
This commit is contained in:
parent
bf838eb78a
commit
b636872ecd
@ -661,8 +661,19 @@ export const getOrderList = (user, status) => {
|
||||
}
|
||||
|
||||
|
||||
//支付宝支付二维码
|
||||
export const generateOrderAlipay = (data) => {
|
||||
return fetch('generateOrderAlipay', data, 'POST' )
|
||||
}
|
||||
//支付宝支付二维码
|
||||
export const generateOrderAlipay = (orderNo, payType) => {
|
||||
//Dictionary : 1: PC, 2: Mobile
|
||||
let url = 'generateOrderAlipayPC';
|
||||
if(payType == 2) {
|
||||
url = 'generateOrderAlipayPhone'
|
||||
}
|
||||
var data = {
|
||||
orderNo:orderNo
|
||||
}
|
||||
return fetch(url, data)
|
||||
//let ret = { "code": 1, "msg": "操作成功!", "success": true, "data": "<form name=\"punchout_form\" method=\"post\" action=\"https://openapi.alipay.com/gateway.do?charset=utf-8&method=alipay.trade.wap.pay&sign=GK1NjnOYPh%2BHTcTtuZg4YunsBNGPHiyc9BwXLx%2FG4G6Z7S8ILYy2E6VmxkGVwZEwZ1G5PA3u2eZxJN3ysyynL9uwG7L4jGQcOB6I2m1763VBi7euNiyMhimv5AYeXP4KiDtmZNDIAdyi3eKWemKTq74AfS0TTubYvKL8aqhJHTQy2GtYdXA89v53ZeFkXjoqpylwCf2j%2FJWD1nV1eO0a0PB5MFqPaZB5Eif69XkT1TNAt1eZiwIn4AO6yqMFJ41gGN5ymmLQUVcUgc5dxlGkMNgY4FUsI6mFYucQ%2BRPPmuH78YJTFU6VS5E%2BZ%2BCL%2BGLxeJs068n%2BLAPqpPqDbhveYg%3D%3D&return_url=https%3A%2F%2Fshop.royalcanin.com.cn¬ify_url=https%3A%2F%2Fshop.royalcanin.com.cn%2Froyalcanin%2Froyalcanin%2Froyalcanin%2FupdateOrderAliPay&version=1.0&app_id=2021003108690157&sign_type=RSA2×tamp=2022-02-14+15%3A08%3A05&alipay_sdk=alipay-sdk-java-dynamicVersionNo&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{"out_trade_no":"02110014172230000","total_amount":"138.0","subject":"皇家宠物食品官方商城"}\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>" };
|
||||
//ret = JSON.parse(ret);
|
||||
//return ret;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ export default {
|
||||
},
|
||||
methods:{
|
||||
...mapMutations(["checkIsLogin"]),
|
||||
lianxi(item,index){
|
||||
lianxi(item,index) {
|
||||
this.checkIsLogin();
|
||||
let user = this.$store.state.userInfo;
|
||||
let curMemberId = (user?user.data.id:'');
|
||||
@ -63,7 +63,8 @@ export default {
|
||||
//this.customerServerStop = true;
|
||||
/* Stop until 2022-2-10 */
|
||||
var option = {
|
||||
customer: {id: '', name: '', email: '', mobile: '', memberId: curMemberId}
|
||||
customer: {id: '', name: '', email: '', mobile: '', memberId: curMemberId, types:'14054'},
|
||||
type:3
|
||||
}
|
||||
dis_livchat(option);
|
||||
_hmt.push([
|
||||
@ -91,7 +92,8 @@ export default {
|
||||
//this.customerServerStop = true;
|
||||
/* Stop until 2022-2-10*/
|
||||
var option = {
|
||||
customer: {id: '', name: '', email: '', mobile: '', memberId: curMemberId}
|
||||
customer: {id: '', name: '', email: '', mobile: '', memberId: curMemberId, types:'14053'},
|
||||
type:3
|
||||
}
|
||||
dis_livchat(option);
|
||||
_hmt.push([
|
||||
|
@ -15,7 +15,7 @@ export default {
|
||||
script: [
|
||||
//{ src: '/js/rem.js' },
|
||||
// { src: '/js/flexible.js', type: 'text/javascript', charset: 'utf-8'},
|
||||
{ src: 'https://ocstest.royalcanin.com.cn:8081/livechat/chatapp/customer/branch/RoyalCanin/14053/index.js' },
|
||||
{ src: 'https://ocstest.royalcanin.com.cn:8081/livechat/chatapp/customer/branch/RoyalCanin/14054/index.js' },
|
||||
//{ src: 'https://ocs.royalcanin.com.cn:8081/livechat/chatapp/customer/branch/RoyalCanin/14053/index.js' },
|
||||
//{ src: 'https://ocstest.royalcanin.com.cn:8081/livechat/chatapp/customer/branch/RoyalCanin/14054/index.js' },
|
||||
{ innerHTML: trackingScript, type: 'text/javascript', charset: 'utf-8'},
|
||||
|
@ -93,10 +93,7 @@
|
||||
<p>请返回商品结算页面重新支付</p>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<div style="display:none">
|
||||
<form :action="this.h5PayUrl" method="post" ref="h5SubmitForm">
|
||||
<input type="hidden" v-model="h5payRedirectUrl">
|
||||
</form>
|
||||
<div style="display:none" ref="h5SubmitForm">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -114,7 +111,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
util,
|
||||
h5payRedirectUrl:'',
|
||||
activeIndex: 0,
|
||||
paymentTimer:undefined,
|
||||
isSucess: false,
|
||||
@ -148,28 +144,44 @@ export default {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
let isWx = this.util.isWX();
|
||||
if(!isWx) {
|
||||
this.disableAlipay = false;
|
||||
}
|
||||
let stype=this.$route.query.stype;
|
||||
|
||||
this.userPayData = JSON.parse(this.$route.query.userPayData);
|
||||
this.defaultHandlePayment();
|
||||
},
|
||||
methods: {
|
||||
detectQrcodeDisplay(){
|
||||
let payType = this.util.pickPaytype();
|
||||
switch(payType) {
|
||||
case 1:
|
||||
this.disableQrcode=false;
|
||||
break;
|
||||
case 2:
|
||||
this.disableQrcode=true;
|
||||
break;
|
||||
case 3:
|
||||
//TODO raise WX jsapi pay
|
||||
break;
|
||||
}
|
||||
},
|
||||
defaultHandlePayment() {
|
||||
let isMobile = this.util.isMobile();
|
||||
let isWx = this.util.isWX();
|
||||
let payType = this.util.pickPaytype();
|
||||
if(!this.userPayData.wxPay || this.userPayData.wxPay.length<4)
|
||||
throw new Error("订单信息错误,请删除商品后再次购买");
|
||||
|
||||
this.detectQrcodeDisplay();
|
||||
//Dictionary : 1: scan qrcode, 2:redirect 3: raise local app
|
||||
switch(payType) {
|
||||
case 1:
|
||||
this.disableQrcode=false;
|
||||
this.qrtext=this.userPayData.wxPay;
|
||||
this.payOrderWX();
|
||||
this.updateOrderNotification();
|
||||
break;
|
||||
case 2:
|
||||
this.disableQrcode=true;
|
||||
this.$refs["h5SubmitForm"].innerHTML = '<form action="'+this.userPayData.wxPay+'" method="post"><form>';
|
||||
break;
|
||||
case 3:
|
||||
//TODO raise WX jsapi pay
|
||||
@ -185,13 +197,12 @@ export default {
|
||||
])
|
||||
},
|
||||
goPayH5() {
|
||||
let isMobile = this.util.isMobile();
|
||||
if(this.userPayData.wxPay && isMobile) {
|
||||
if(this.userPayData.wxPay) {
|
||||
//this.$refs["h5SubmitForm"].action="http://47.96.75.242:10086/royalcanin/royalcanin/redirectUrlWXH5";
|
||||
this.$refs["h5SubmitForm"].action=this.userPayData.wxPay;
|
||||
this.$refs["h5SubmitForm"].submit();
|
||||
//window.location.href=this.userPayData.wxPay;;
|
||||
this.disableQrcode=true;
|
||||
//this.$refs["h5SubmitForm"].action=this.userPayData.wxPay;
|
||||
this.$refs["h5SubmitForm"].children[0].submit()
|
||||
//window.location.href=this.userPayData.wxPay;
|
||||
//this.disableQrcode=true;
|
||||
} else {
|
||||
throw new Error("订单信息错误,请删除商品后再次购买");
|
||||
}
|
||||
@ -217,21 +228,25 @@ export default {
|
||||
this.paytype = item.paytype;
|
||||
if (index == 1) {
|
||||
//支付宝
|
||||
let res = await generateOrderAlipay(this.userPayData.orderId);
|
||||
this.qrtext = '';
|
||||
let isMobile = this.util.isMobile();
|
||||
isMobile = (isMobile?2:1);
|
||||
let res = await generateOrderAlipay(this.userPayData.orderId, isMobile);
|
||||
if (res.success) {
|
||||
|
||||
this.qrtext=res.data;
|
||||
this.disableQrcode = true;
|
||||
let virtualForm = res.data;
|
||||
virtualForm = virtualForm.substr(0,virtualForm.indexOf("</form>")+7);
|
||||
this.$refs["h5SubmitForm"].innerHTML = virtualForm;
|
||||
}
|
||||
|
||||
} else {
|
||||
this.userPayData = JSON.parse(this.$route.query.userPayData);
|
||||
this.qrtext=this.userPayData.wxPay
|
||||
this.qrtext=this.userPayData.wxPay;
|
||||
this.$refs["h5SubmitForm"].innerHTML = '<form method="get" action="'+this.userPayData.wxPay+'"></form>';
|
||||
this.detectQrcodeDisplay();
|
||||
}
|
||||
},
|
||||
//支付监听
|
||||
|
||||
async payOrderWX() {
|
||||
async updateOrderNotification() {
|
||||
let res = await monitorOrderNotify(this.userPayData.orderId);
|
||||
if (res.success) {
|
||||
this.qrtext = '成功加入群的二维码';
|
||||
@ -250,7 +265,7 @@ export default {
|
||||
} else {
|
||||
let _self = this;
|
||||
this.paymentTimer = setTimeout(function(){
|
||||
_self.payOrderWX()
|
||||
_self.updateOrderNotification()
|
||||
},5000);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user