提交 8a1da1b6 编写于 作者: guangjun.yang's avatar guangjun.yang

Merge branch 'dev-purchase-0901' of...

Merge branch 'dev-purchase-0901' of http://192.168.110.53/com.pica.cloud.education.frontend/pica-professional-exam into dev-purchase-0901

* 'dev-purchase-0901' of http://192.168.110.53/com.pica.cloud.education.frontend/pica-professional-exam:
  修改授权s
  修改参数
  修改参数
  修改支付类型
  添加userId
  修改参数
  修改接口
  修改授权
  修改appid
...@@ -78,8 +78,9 @@ const user = { ...@@ -78,8 +78,9 @@ const user = {
getWxUserInfo({ state, commit }, code) { getWxUserInfo({ state, commit }, code) {
const type = 15; const type = 15;
let url = process.env.BUILD_ENV === 'dev' ? `https://sc.yunqueyi.com/wechats/users/info/${type}/${code}` : getBaseUrl(`wechats/users/info/${type}/${code}`);
fetch({ fetch({
url: getBaseUrl(`wechats/users/info/${type}/${code}`), url,
method: 'get', method: 'get',
headers: { token: state.token } headers: { token: state.token }
}).then(res => { }).then(res => {
......
...@@ -47,7 +47,7 @@ export const envConfig = { ...@@ -47,7 +47,7 @@ export const envConfig = {
webPageUrl: 'https://dev-phome.yunqueyi.com/', webPageUrl: 'https://dev-phome.yunqueyi.com/',
hactiveUrl: 'https://dev-hactive.yunqueyi.com', hactiveUrl: 'https://dev-hactive.yunqueyi.com',
fileUrl: 'https://dev-www.yunqueyi.com', fileUrl: 'https://dev-www.yunqueyi.com',
appId: 'wx08b383d002c73f26', // 用于微信授权登录 appId: 'wx2c577552a2d28550', // 用于微信授权登录
}, },
test: { test: {
baseUrl: 'https://test1-sc.yunqueyi.com/', baseUrl: 'https://test1-sc.yunqueyi.com/',
......
...@@ -8,7 +8,8 @@ export const wxConfig = (link) => { ...@@ -8,7 +8,8 @@ export const wxConfig = (link) => {
// const params = { resetURI: true, url: encodeURIComponent(location.href) }; // const params = { resetURI: true, url: encodeURIComponent(location.href) };
// 上线前是需要把域名改为线上的sc // 上线前是需要把域名改为线上的sc
let baseUrl = getBaseUrl(""); let baseUrl = getBaseUrl("");
request({ url: `https://sc.yunqueyi.com/wechats/signs?url=${encodeURIComponent(link)}` }).then(res => { let type = process.env.BUILD_ENV === 'dev' ? '&type=15' : '';
request({ url: `https://sc.yunqueyi.com/wechats/signs?url=${encodeURIComponent(link)}${type}` }).then(res => {
// request({ url: `${baseUrl}/wechats/signs?url=${encodeURIComponent(link)}` }).then(res => { // request({ url: `${baseUrl}/wechats/signs?url=${encodeURIComponent(link)}` }).then(res => {
let configs = res.data.signMap; let configs = res.data.signMap;
wx.config({ wx.config({
......
...@@ -125,9 +125,6 @@ export default { ...@@ -125,9 +125,6 @@ export default {
// 记录参数,授权登录返回时重新赋值,在main.js // 记录参数,授权登录返回时重新赋值,在main.js
sessionStorage.setItem('goodsDetailParams', JSON.stringify(this.$route.query)) sessionStorage.setItem('goodsDetailParams', JSON.stringify(this.$route.query))
}, },
beforeDestroy() {
this.countTotalPrice = null;
},
methods: { methods: {
// tab切换 // tab切换
tabToggle(index) { tabToggle(index) {
...@@ -260,6 +257,7 @@ export default { ...@@ -260,6 +257,7 @@ export default {
} }
// 微信内先去授权 // 微信内先去授权
if (isWechat && !this.wxInfo.openid) { if (isWechat && !this.wxInfo.openid) {
this.$toast('微信授权中');
wxOauth(); wxOauth();
return; return;
} }
...@@ -279,11 +277,11 @@ export default { ...@@ -279,11 +277,11 @@ export default {
this.POST('trade/center/order/createV2', orderData).then(res => { this.POST('trade/center/order/createV2', orderData).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
const orderId = res.data.orderId; const orderId = res.data.orderId;
// if (isWechat) { if (isWechat) {
this.goWxPayInner(orderId); this.goWxPayInner(orderId);
// } else { } else {
// this.goWxPayOut(orderId); this.goWxPayOut(orderId);
// } }
if (this.projectId) { if (this.projectId) {
this.createRelation(this.projectId, orderId); this.createRelation(this.projectId, orderId);
} }
...@@ -295,18 +293,20 @@ export default { ...@@ -295,18 +293,20 @@ export default {
// 站外微信支付 // 站外微信支付
goWxPayOut(orderId) { goWxPayOut(orderId) {
const data = { const data = {
openId: getAPPID(), // openId: getAPPID(),
orderId, orderId,
payChannel: 1, payChannel: 1,
tradeType: 3, tradeType: 3,
} }
this.POST('trade/center/mweb_prepay', data).then(res => { this.POST('trade/center/mweb_prepay', data).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
if (res.data) {
let redirectUrl = this.getRedirectUrl(orderId); let redirectUrl = this.getRedirectUrl(orderId);
let jumpLink = res.data + '&redirect_url=' + encodeURIComponent(redirectUrl); let jumpLink = res.data + '&redirect_url=' + encodeURIComponent(redirectUrl);
window.location.href = jumpLink; window.location.href = jumpLink;
}
} else { } else {
this.$toast(res.message); this.$toast(res.message || '暂时不能支付');
} }
}) })
}, },
...@@ -316,14 +316,17 @@ export default { ...@@ -316,14 +316,17 @@ export default {
openId: this.wxInfo.openid, openId: this.wxInfo.openid,
orderId, orderId,
payChannel: 1, payChannel: 1,
tradeType: 1, tradeType: 4,
userId: this.$store.state.user.info.id
} }
this.POST('trade/center/jsapi_prepay', data).then(res => { this.POST('trade/center/jsapi_prepay', data).then(res => {
if (res.code == "000000") { if (res.code == "000000" && res.data) {
console.log('______prepay_____', res.data); // console.log('______prepay_____', res.data);
const that = this; const that = this;
const payData = { const payData = {
...res.data, ...res.data,
appid: res.data.appId,
timestamp: res.data.timeStamp,
success: function() { success: function() {
let query = { orderId }; let query = { orderId };
if (that.projectId) { if (that.projectId) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册