|
@@ -406,7 +406,14 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { Pay, HelpPayQrcode, Reader, Person, BookDetail, BookCatalog } from "./namespace.js";
|
|
|
+import {
|
|
|
+ Pay,
|
|
|
+ HelpPayQrcode,
|
|
|
+ Reader,
|
|
|
+ Person,
|
|
|
+ BookDetail,
|
|
|
+ BookCatalog
|
|
|
+} from "./namespace.js";
|
|
|
// import product from "../mock/pay.js";
|
|
|
import { MessageBox } from "mint-ui";
|
|
|
import {
|
|
@@ -414,8 +421,11 @@ import {
|
|
|
subscribeByRMB,
|
|
|
recharge,
|
|
|
getUserInfo,
|
|
|
- getOrderCoupon
|
|
|
+ getOrderCoupon,
|
|
|
+ newRefreshTokenF,
|
|
|
+ newDestoryToken
|
|
|
} from "../api";
|
|
|
+import { getKeyByWay, setKeyByWay } from "../util/index.js";
|
|
|
|
|
|
export default {
|
|
|
name: Pay.name,
|
|
@@ -475,7 +485,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.popup()
|
|
|
+ this.popup();
|
|
|
},
|
|
|
methods: {
|
|
|
changeCoupon() {
|
|
@@ -512,16 +522,40 @@ export default {
|
|
|
Number(this.product[this.selectedProduct].price.replace("元", ""))
|
|
|
);
|
|
|
},
|
|
|
- popup() {
|
|
|
+ async popup() {
|
|
|
const from_detail_catalog = this.$route.query.from_detail_catalog; //判断是否是从详情页BookDetail or 目录BookCatalog 跳转到页面 1详情页 2目录 3阅读页
|
|
|
const last_bid = this.$route.query.last_bid; //如果是从上一页跳转,获取上一页bid和cid,跳转到上一页
|
|
|
- const last_cid = this.$route.query.last_cid;
|
|
|
+ const last_cid = this.$route.query.last_cid;
|
|
|
const bid = this.$route.query.bid;
|
|
|
const cid = this.$route.query.cid;
|
|
|
- const send_order_id = this.$route.query.send_order_id || localStorage.getItem("send_order_id");
|
|
|
+ const send_order_id = this.$route.query.send_order_id;
|
|
|
const yun = this.$route.query.yun;
|
|
|
- const sequence = this.$route.query.sequence
|
|
|
- if(this.$route.query.isRecharge){
|
|
|
+ const sequence = this.$route.query.sequence;
|
|
|
+ if (this.$route.query.isRecharge) {
|
|
|
+ let urlToken = this.$route.query.token;
|
|
|
+ let hashUser = this.$route.query.hashuser;
|
|
|
+ if (urlToken) {
|
|
|
+ //先存本地
|
|
|
+ setKeyByWay("token", urlToken);
|
|
|
+ setKeyByWay("hashuser", hashUser);
|
|
|
+ /* try {
|
|
|
+ const { token, hashuser } = await newrefreshToken({
|
|
|
+ hashuser: hashUser,
|
|
|
+ token: urlToken
|
|
|
+ });
|
|
|
+ setKeyByWay("token", token);
|
|
|
+ setKeyByWay("hashuser", hashuser);
|
|
|
+ } catch (e) {
|
|
|
+ this.$Toast(e.data.msg);
|
|
|
+ }
|
|
|
+ //拿到token 先作废旧token在保存新token;
|
|
|
+ try {
|
|
|
+ await newDestoryToken({ destroy_token: urlToken });
|
|
|
+ } catch (e) {
|
|
|
+ this.$Toast(e.data.msg);
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
MessageBox({
|
|
|
title: "支付确认",
|
|
|
message:
|
|
@@ -529,46 +563,57 @@ export default {
|
|
|
confirmButtonText: "已完成支付", //确认按钮的文本
|
|
|
cancelButtonText: "取消", //取消按钮的文本
|
|
|
confirmButtonHighlight: true, // 是否将确认按钮的文本加粗显示
|
|
|
- showCancelButton: true,//是否显示取消按钮
|
|
|
+ showCancelButton: true, //是否显示取消按钮
|
|
|
showConfirmButton: true //是否显示确认按钮
|
|
|
}).then(action => {
|
|
|
if (action === "confirm") {
|
|
|
- if (bid && cid){
|
|
|
- if(from_detail_catalog === '1'){
|
|
|
- this.$router.replace({ // 跳回书籍详情页
|
|
|
- name: BookDetail.name,
|
|
|
- query: {
|
|
|
- id: bid
|
|
|
- }
|
|
|
- })
|
|
|
- }else if (from_detail_catalog === '2') {
|
|
|
- this.$router.replace({ // 跳回目录
|
|
|
- name: BookCatalog.name,
|
|
|
- query: {
|
|
|
- id: bid,
|
|
|
- sequence,
|
|
|
- yun
|
|
|
- }
|
|
|
- })
|
|
|
- }else {
|
|
|
- this.$router.replace({ // 跳回上一章
|
|
|
+ if ((bid && cid) || (last_bid && last_cid)) {
|
|
|
+ if (from_detail_catalog === "1") {
|
|
|
+ this.$router.replace({
|
|
|
+ // 跳回书籍详情页
|
|
|
+ name: BookDetail.name,
|
|
|
+ query: {
|
|
|
+ id: bid,
|
|
|
+ yun
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (from_detail_catalog === "2") {
|
|
|
+ this.$router.replace({
|
|
|
+ // 跳回目录
|
|
|
+ name: BookCatalog.name,
|
|
|
+ query: {
|
|
|
+ id: bid,
|
|
|
+ sequence,
|
|
|
+ yun
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$router.replace({
|
|
|
+ // 跳回上一章
|
|
|
name: Reader.name,
|
|
|
query: {
|
|
|
bid: last_bid,
|
|
|
cid: last_cid,
|
|
|
send_order_id,
|
|
|
yun,
|
|
|
+ token: urlToken,
|
|
|
+ hashuser: hashUser
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
- }else {
|
|
|
- this.$router.replace({ // 跳回个人中心
|
|
|
+ } else {
|
|
|
+ this.$router.replace({
|
|
|
+ // 跳回个人中心
|
|
|
name: Person.name,
|
|
|
+ yun
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ getUserInfo().then(r => {
|
|
|
+ this.balance = r.balance;
|
|
|
+ });
|
|
|
},
|
|
|
pay() {
|
|
|
recharge({
|
|
@@ -580,9 +625,11 @@ export default {
|
|
|
last_bid: this.$route.query.last_bid,
|
|
|
last_cid: this.$route.query.last_cid,
|
|
|
sequence: this.$route.query.sequence,
|
|
|
- send_order_id: this.$route.query.send_order_id,
|
|
|
- yun: this.$route.query.yun
|
|
|
- })
|
|
|
+ send_order_id: getKeyByWay("send_order_id"),
|
|
|
+ yun: this.$route.query.yun,
|
|
|
+ token: getKeyByWay("token"),
|
|
|
+ hashuser: getKeyByWay("hashuser")
|
|
|
+ });
|
|
|
},
|
|
|
payForYear() {
|
|
|
let product_id = this.product[this.product.length - 1].product_id;
|
|
@@ -659,9 +706,6 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- getUserInfo().then(r => {
|
|
|
- this.balance = r.balance;
|
|
|
- });
|
|
|
//用户优惠券
|
|
|
}
|
|
|
};
|
|
@@ -683,7 +727,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
.pay-box__fixed {
|
|
|
- position: fixed;
|
|
|
+ position: fixed;
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|