|
@@ -146,6 +146,7 @@ export default { |
|
|
created() { |
|
|
created() { |
|
|
this.getAuth(); |
|
|
this.getAuth(); |
|
|
this.getParams(); |
|
|
this.getParams(); |
|
|
|
|
|
this.getCode(); |
|
|
//this.getWxAutograph(); |
|
|
//this.getWxAutograph(); |
|
|
// 套餐列表 |
|
|
// 套餐列表 |
|
|
this.getDevicePayPackage(); |
|
|
this.getDevicePayPackage(); |
|
@@ -153,8 +154,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
// 根据code获取openId |
|
|
// 根据code获取openId |
|
|
getOpenId() { |
|
|
|
|
|
let code = this.$store.getters.wxAuthCode; |
|
|
|
|
|
|
|
|
getOpenId(code) { |
|
|
APIPay.getOpenId(code).then(res => { |
|
|
APIPay.getOpenId(code).then(res => { |
|
|
let data= res.data; |
|
|
let data= res.data; |
|
|
if(data.code === 20000) { |
|
|
if(data.code === 20000) { |
|
@@ -170,11 +170,21 @@ export default { |
|
|
this.$store.commit("gatewayToken", res.data.data); |
|
|
this.$store.commit("gatewayToken", res.data.data); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
getCode() { |
|
|
|
|
|
let url = window.location.href.split("?code=")[1]; |
|
|
|
|
|
console.log("url", url); |
|
|
|
|
|
if (isNotNull(url) ||window.location.href.indexOf("code") > -1) { |
|
|
|
|
|
let code = url.split("&")[0]; |
|
|
|
|
|
if (isNotNull(code)) { |
|
|
|
|
|
this.getOpenId(code); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
// 获取url传过来的参数 |
|
|
// 获取url传过来的参数 |
|
|
getParams() { |
|
|
getParams() { |
|
|
let params = this.$route.query; |
|
|
let params = this.$route.query; |
|
|
|
|
|
console.log("params", params); |
|
|
if (params) { |
|
|
if (params) { |
|
|
//this.getOpenId(); |
|
|
|
|
|
this.params = {...params}; |
|
|
this.params = {...params}; |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
@@ -286,7 +296,7 @@ export default { |
|
|
this.aliPay(data); |
|
|
this.aliPay(data); |
|
|
} else { |
|
|
} else { |
|
|
// 微信 |
|
|
// 微信 |
|
|
let openId = this.$store.getters.openId; |
|
|
|
|
|
|
|
|
let openId = this.openId; |
|
|
this.payProductId = payTypeToPackAgeId.filter(item => { |
|
|
this.payProductId = payTypeToPackAgeId.filter(item => { |
|
|
return item.payType === '1' || item.payType === 1 |
|
|
return item.payType === '1' || item.payType === 1 |
|
|
})[0].productId; |
|
|
})[0].productId; |
|
@@ -310,7 +320,7 @@ export default { |
|
|
console.log("微信支付", data); |
|
|
console.log("微信支付", data); |
|
|
let orderData = data; |
|
|
let orderData = data; |
|
|
let reqBody = { |
|
|
let reqBody = { |
|
|
openId: this.$store.getters.openId || this.openId, //openId |
|
|
|
|
|
|
|
|
openId: this.openId, //openId |
|
|
imei: this.params.imei, //imei |
|
|
imei: this.params.imei, //imei |
|
|
iccid: this.params.iccid, |
|
|
iccid: this.params.iccid, |
|
|
productId: this.payProductId, //套餐id |
|
|
productId: this.payProductId, //套餐id |
|
@@ -463,7 +473,7 @@ export default { |
|
|
}); |
|
|
}); |
|
|
let orderData = data; |
|
|
let orderData = data; |
|
|
let reqBody = { |
|
|
let reqBody = { |
|
|
openId: this.$store.getters.openId, //openId |
|
|
|
|
|
|
|
|
openId: this.openId, //openId |
|
|
imei: this.params.imei, //imei |
|
|
imei: this.params.imei, //imei |
|
|
iccid: this.params.iccid, |
|
|
iccid: this.params.iccid, |
|
|
productId: this.payProductId, //套餐id |
|
|
productId: this.payProductId, //套餐id |
|
|