提交 2bb037a0 编写于 作者: 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:
  修改参数
  测试支付
...@@ -82,7 +82,7 @@ function fliterRoute(query, path) { ...@@ -82,7 +82,7 @@ function fliterRoute(query, path) {
} }
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log('_____href_____', location.href) // 商品页授权登录路由处理
if (to.path === '/goods-detail') { if (to.path === '/goods-detail') {
let searchQuery = querystring(location.search); let searchQuery = querystring(location.search);
if (searchQuery.code) { if (searchQuery.code) {
......
...@@ -77,14 +77,12 @@ const user = { ...@@ -77,14 +77,12 @@ const user = {
}, },
getWxUserInfo({ state, commit }, code) { getWxUserInfo({ state, commit }, code) {
console.log('_______getWxUserInfo__________', code)
const type = 15; const type = 15;
fetch({ fetch({
url: getBaseUrl(`wechats/users/info/${type}/${code}`), url: getBaseUrl(`wechats/users/info/${type}/${code}`),
method: 'get', method: 'get',
headers: { token: state.token } headers: { token: state.token }
}).then(res => { }).then(res => {
console.log('____wx res_____', res.data)
sessionStorage.setItem('wxInfo', JSON.stringify(res.data)); sessionStorage.setItem('wxInfo', JSON.stringify(res.data));
commit('SET_WX_INFO', res.data) commit('SET_WX_INFO', res.data)
}); });
......
...@@ -96,6 +96,11 @@ html,body{ ...@@ -96,6 +96,11 @@ html,body{
zoom:1; zoom:1;
} }
.deep-img-w100 img{
display: block;
width: 100%;
}
.back_img{ .back_img{
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
......
...@@ -122,6 +122,12 @@ export const wechatShare = (option = {}, successCB = () => {}, hideMenu) => { ...@@ -122,6 +122,12 @@ export const wechatShare = (option = {}, successCB = () => {}, hideMenu) => {
} }
}; };
export function chooseWXPay(params) {
wx.ready(() => {
wx.chooseWXPay(params);
})
}
Vue.prototype.wechatShare = wechatShare; Vue.prototype.wechatShare = wechatShare;
Vue.prototype.wxDisabledShare = wxDisabledShare; Vue.prototype.wxDisabledShare = wxDisabledShare;
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<div class="tab-line" :style="{left: `${tabLeft}px`}"></div> <div class="tab-line" :style="{left: `${tabLeft}px`}"></div>
</div> </div>
<!-- 详情 --> <!-- 详情 -->
<div class="detail-box" v-html="tabs[curtTabIdx] && tabs[curtTabIdx]['detail']"></div> <div class="detail-box deep-img-w100" v-html="tabs[curtTabIdx] && tabs[curtTabIdx]['detail']"></div>
<!-- 底部购买 --> <!-- 底部购买 -->
<div class="btn-box"> <div class="btn-box">
<div class="money"> <div class="money">
...@@ -73,8 +73,10 @@ ...@@ -73,8 +73,10 @@
<script> <script>
import { Swipe, SwipeItem } from 'vant'; import { Swipe, SwipeItem } from 'vant';
import { wxConfig, chooseWXPay } from '@/utils/wxShare';
import { getAPPID, getWebPageUrl, isWeiXin, wxOauth, debounce } from '@/utils'; import { getAPPID, getWebPageUrl, isWeiXin, wxOauth, debounce } from '@/utils';
const isWechat = isWeiXin(); const isWechat = isWeiXin();
wxConfig(location.href);
export default { export default {
components: { components: {
...@@ -109,7 +111,7 @@ export default { ...@@ -109,7 +111,7 @@ export default {
}, },
mounted() { mounted() {
this.projectId = this.$route.query.projectId; this.projectId = this.$route.query.projectId;
this.goodsId = this.$route.query.goodsId || 10077; this.goodsId = this.$route.query.goodsId || 74;
this.returnUrl = this.$route.query.returnUrl; this.returnUrl = this.$route.query.returnUrl;
this.getGoodsInfo(); this.getGoodsInfo();
this.getTabW(); this.getTabW();
...@@ -293,6 +295,7 @@ export default { ...@@ -293,6 +295,7 @@ export default {
// 站外微信支付 // 站外微信支付
goWxPayOut(orderId) { goWxPayOut(orderId) {
const data = { const data = {
openId: getAPPID(),
orderId, orderId,
payChannel: 1, payChannel: 1,
tradeType: 3, tradeType: 3,
...@@ -310,14 +313,34 @@ export default { ...@@ -310,14 +313,34 @@ export default {
// 微信内支付 // 微信内支付
goWxPayInner(orderId) { goWxPayInner(orderId) {
const data = { const data = {
openId: getAPPID(), openId: this.wxInfo.openid,
orderId, orderId,
payChannel: 1, payChannel: 1,
tradeType: 1, tradeType: 1,
} }
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") {
console.log('______prepay_____', res.data);
const that = this;
const payData = {
...res.data,
success: function() {
let query = { orderId };
if (that.projectId) {
query.projectId = that.projectId
}
if (that.returnUrl) {
query.returnUrl = that.returnUrl
}
that.$router.push('prezult', query);
},
fail: function() {
that.$toast('支付失败,请重试~');
},
cancel: function() {},
complete: function() {},
};
chooseWXPay(payData);
} else { } else {
this.$toast(res.message); this.$toast(res.message);
} }
...@@ -542,10 +565,6 @@ export default { ...@@ -542,10 +565,6 @@ export default {
font-size: 14px; font-size: 14px;
text-align: justify; text-align: justify;
padding: 15px 15px 75px; padding: 15px 15px 75px;
img{
display: block;
width: 100%;
}
} }
.btn-box{ .btn-box{
display: flex; display: flex;
...@@ -557,6 +576,7 @@ export default { ...@@ -557,6 +576,7 @@ export default {
height: 60px; height: 60px;
padding: 10px 15px; padding: 10px 15px;
box-shadow: 0 -4px 4px rgba(240, 240, 240, 0.5); box-shadow: 0 -4px 4px rgba(240, 240, 240, 0.5);
background-color: #fff;
.money{ .money{
flex: 1; flex: 1;
width: 100px; width: 100px;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册