Commit 613d40ed authored by IvyXia123's avatar IvyXia123

20191014-15号发版

parent 845c12a6
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"><meta name=screen-orientation content=portrait><meta name=x5-orientation content=portrait><title>唱唱启蒙英语</title><link rel=stylesheet href=https://at.alicdn.com/t/font_822651_g9r2j7kybxu.css><style>*{
-webkit-overflow-scrolling:touch;
}</style><link href=https://static-cdn.changchangenglish.com/new-sing/static/css/app.5f3583bfe1a035c4f23bb6139d6a7afe.css rel=stylesheet></head><body><div id=app></div><script src=https://res.wx.qq.com/open/js/jweixin-1.3.2.js></script><script></script><script type=text/javascript src=https://static-cdn.changchangenglish.com/new-sing/static/js/manifest.acca5632900f87535f87.js></script><script type=text/javascript src=https://static-cdn.changchangenglish.com/new-sing/static/js/vendor.e524f5cccf757e45c672.js></script><script type=text/javascript src=https://static-cdn.changchangenglish.com/new-sing/static/js/app.d2f6f2a89dceff91d7d3.js></script></body></html>
\ No newline at end of file
}</style><link href=https://static-cdn.changchangenglish.com/new-sing/static/css/app.81ff810b654ae302b7808d851f979733.css rel=stylesheet></head><body><div id=app></div><script src=https://res.wx.qq.com/open/js/jweixin-1.3.2.js></script><script></script><script type=text/javascript src=https://static-cdn.changchangenglish.com/new-sing/static/js/manifest.5d37e9aa5a2bcabafb16.js></script><script type=text/javascript src=https://static-cdn.changchangenglish.com/new-sing/static/js/vendor.7b1120612b542658f62d.js></script><script type=text/javascript src=https://static-cdn.changchangenglish.com/new-sing/static/js/app.d23a4ea1fe38b2429fbb.js></script></body></html>
\ No newline at end of file
File mode changed from 100644 to 100755
......@@ -71,7 +71,7 @@
</div>
<!-- 支付方式选择 -->
<!--<div class="pay-list">
<div class="pay-list">
<div class="pay-choice">支付方式选择</div>
<ul class="pay">
<li v-for="item in payList" :key="item.value" @click="payListClick(item.value)">
......@@ -82,7 +82,7 @@
</div>
</li>
</ul>
</div>-->
</div>
<footer>
<div class="sub-block">
......@@ -210,9 +210,7 @@ export default {
userCourse: {},
payList: [
{ icon: weixin, title: '微信支付', value: 0 },
{ icon: zhifubao, title: '支付宝支付', value: 1 },
{ icon: xinyongka,title: '信用卡分期', value: 2 },
{ icon: fenqi, title: '其他分期', value: 3 },
{ icon: zhifubao, title: '支付宝支付', value: 1 }
],
payIndex: 0,
payUrl: ''
......@@ -380,18 +378,8 @@ export default {
}
this.orderFlag = false;
/*let payTypeArr = ['WX', 'ALI', 'KFQ']
let data = { pay_type: payTypeArr[this.payIndex], return_url: window.location.href, goods_id: json.goods_id, buy_type: this.groupDetail.goods_type, group_order_id: json.group_order_id, order_coupon_id:json.order_coupon_id }
postPayBillApi(data).then(res => {
if(this.payIndex === 0) {
window.location.href = res.pay_url;
}else if(this.payIndex === 1){
this.payUrl = res.pay_url;
}else if(this.payIndex === 2) {
this.payUrl = res.pay_url;
}
})*/
// 微信支付
payApi(json).then(res => {
this.orderNo = res.out_trade_no;
console.log(res)
......@@ -434,11 +422,25 @@ export default {
});
}
})
.catch(res => {
.catch(err => {
// alert(res)
Toast(res.msg);
Toast(err.msg)
this.orderFlag = true;
});
}else {
// 支付宝支付
let data = { pay_type: 'ALI', return_url: window.location.href, buy_type: this.groupDetail.goods_type }
let dataObj = Object.assign({}, data, json)
postPayBillApi(dataObj).then(res => {
let outTradEno = JSON.stringify({ out_trade_no: res.out_trade_no, invite_code: this.$route.query.invite_code, shopId: this.$route.query.shopId, goods_type: this.groupDetail.goods_type, is_subscribe: this.userDetail.open_info.is_subscribe })
localStorage.setItem('out_trade_no', outTradEno);
localStorage.setItem('pay_url', res.pay_url);
location.href = `http://${ window.location.host }/#/guidelines?pay_url=${ encodeURI(res.pay_url) }`
}).catch(err => {
console.log(err)
Toast(err.msg)
})
}
}
},
closeAdd(data) {
......
<template>
<div class="guidelines">
<div class="zhiying" v-if="micromessenger == 0">
<img :src="zhiying" alt="">
</div>
</div>
</template>
<script>
import {getBillRefreshApi, getStatusWechatApi, getCourseInfoApi} from "../../service/api"
import {Popup, Lazyload, Button, Dialog, Toast} from 'vant';
import common from '../../util/common'
import zhiying from "../../assets/punchTheClock/zhiying.png"
import zhufubao from "../../assets/punchTheClock/zhifubaotup.png"
let timer = null;
export default {
name: "guidelines",
data() {
return {
micromessenger: 0, // 判断在微信里还是在浏览器里
zhiying: zhiying, // 图片
zhufubao: zhufubao
}
},
methods: {
outTrade() {
timer = setInterval(() => {
let outTradEno = JSON.parse(window.localStorage.out_trade_no);
getBillRefreshApi({outTradeNo: outTradEno.out_trade_no}).then(res => {
// 支付成功
if (res.status === "SUCCESS") {
getCourseInfoApi().then(response => {
this.userCourse = JSON.parse(JSON.stringify(response));
console.log(this.userCourse)
localStorage.setItem("userCourse", JSON.stringify(this.userCourse));
localStorage.setItem("buyindex", 1);
Dialog.confirm({title: '标题', message: '支付成功', confirmButtonText: '去查看'}).then(() => {
if (response.teacher_alias && response.teacher_alias.substr(0, 1) == 1 && outTradEno.goods_type != 4 && outTradEno.is_subscribe == 1) {
clearInterval(timer);
this.$router.push({name: "guide", query: {shopId: outTradEno.shopId}});
localStorage.removeItem('out_trade_no')
} else {
if (res.buy_type == 1) {
clearInterval(timer);
this.$router.push({name: "buySuccess", query: outTradEno});
localStorage.removeItem('out_trade_no')
} else {
clearInterval(timer);
this.$router.push({name: "success", query: outTradEno});
localStorage.removeItem('out_trade_no')
}
}
}).catch(() => {
clearInterval(timer);
localStorage.removeItem('out_trade_no')
});
});
} else if (res.status === "NO_SYNC") {
Dialog.confirm({title: '标题', message: '您有一笔未支付的订单', confirmButtonText: '去支付'}).then(() => {
clearInterval(timer);
location.href = `http://${window.location.host}/#/guidelines?pay_url=${encodeURI(window.localStorage.pay_url)}&out_trade_no=${window.localStorage.out_trade_no}`
localStorage.removeItem('out_trade_no')
}).catch(() => {
clearInterval(timer);
localStorage.removeItem('out_trade_no')
});
}
})
}, 6000)
}
},
mounted() {
// 0 -> 微信 1 -> 支付宝
this.micromessenger = common.isWeixinBrowser()
// 到浏览器里支付宝支付
if (this.micromessenger == 1) {
location.href = this.$route.query.pay_url
}
if (this.$route.query.out_trade_no) {
localStorage.setItem('out_trade_no', this.$route.query.out_trade_no);
}
this.outTrade()
}
}
</script>
<style scoped lang="less">
@import "../../util/public";
.guidelines {
width: 100%;
height: 100%;
padding-top: 3 * @toVw;
background: #F3F2F7;
text-align: center;
.zhiying {
width: 244 * @toVw;
height: 361 * @toVw;
margin-left: 112 * @toVw;
box-sizing: border-box;
img {
width: 100%;
height: 100%;
}
}
}
</style>
This diff is collapsed.
......@@ -571,6 +571,12 @@ const router = new Router({
name: 'punchTheClock',
component: e => require(['@/components/punchTheClock'], e)
},
// 微信跳转支付宝
{
path: '/guidelines',
name: 'guidelines',
component: e => require(['@/components/buy/guidelines'], e)
},
{
path: '*',
component: () => import('@/components/error'),
......
......@@ -431,3 +431,9 @@ const getNewCashUrl = `${_baseUrl}api/client/new/return/cash/`
export const getNewCashApi = function (element_id, category_id, periods_id, json) {
return Vue.prototype.$fetch(`${getNewCashUrl}${element_id}/${category_id}/${periods_id}`, json)
};
// 订单状态查询
const getBillRefreshUrl = `${_baseUrl}api/client/bill/refresh`
export const getBillRefreshApi = function (json) {
return Vue.prototype.$fetch(getBillRefreshUrl, json)
};
......@@ -118,5 +118,32 @@ export default {
}
}
return newObj;
},
/**
* 判断是否在那个浏览器里
* @returns {number}
*/
isWeixinBrowser() {
var ui = 0
// 0 -> 微信 2 -> 支付宝 1 -> 其他
if (/MicroMessenger/.test(window.navigator.userAgent)) {
ui = 0
} else if (/AlipayClient/.test(window.navigator.userAgent)) {
ui = 2
} else {
ui = 1
}
return ui;
},
/**
* 获取链接后的参数
* @param name
* @param url
* @returns {RegExpExecArray | string}
*/
getParamByName(name, url) {
url = url || window.location;
var match = RegExp('[?&]' + name + '=([^&]*)').exec(url);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '))
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment