소스 검색

充值跳转终版

zhaoli 3 년 전
부모
커밋
b4916e0d20
5개의 변경된 파일36개의 추가작업 그리고 32개의 파일을 삭제
  1. 3 3
      src/api/index.js
  2. 5 3
      src/view/book-catalog.vue
  3. 1 1
      src/view/book-detail.vue
  4. 19 19
      src/view/pay.vue
  5. 8 6
      src/view/reader.vue

+ 3 - 3
src/api/index.js

@@ -389,9 +389,9 @@ export function recharge({ product_id, bid, cid, use_coupon, from_detail_catalog
       pay_redirect_url: encodeURIComponent(urlFormat(redirect))
     }
   };
-  window.open(urlFormat(href),'微信支付',true)
-  // a.href = urlFormat(href);
-  // a.click();
+  // window.open(urlFormat(href),'微信支付',true)
+  a.href = urlFormat(href);
+  a.click();
 }
 
 //单本消费记录

+ 5 - 3
src/view/book-catalog.vue

@@ -197,8 +197,8 @@ export default {
         chapter_is_vip: vip,
       } = chapter;
       const from_detail_catalog = 2;
+      const last_cid = ''
       if (!this.is_vip && !!vip && chapter_cost > this.balance) {
-        console.log('vip直接跳去付费,第',cid)
         // vip章节 且章节价格>余额
         this.$router.push({
           name: Pay.name,
@@ -209,7 +209,8 @@ export default {
             code: 10021,
             uuids:this.uuids,
             from_detail_catalog,
-            sequence: this.sequence
+            sequence: this.sequence,
+            last_cid
           },
         });
       } else {
@@ -221,7 +222,8 @@ export default {
             uuids:this.uuids,
             sendid:this.$route.query.sendid || localStorage.getItem('sendid') || sessionStorage.getItem('sendid'),
             from_detail_catalog,
-            sequence: this.sequence
+            sequence: this.sequence,
+            last_cid
           },
         });
       }

+ 1 - 1
src/view/book-detail.vue

@@ -70,7 +70,7 @@
     <div class="book-catalog-list">
       <router-link
         class="book-catalog-item"
-        :to="{ name: Reader.name, query: { bid: v.bid, cid: v.chapter_id, from_detail_catalog: 1 } }"
+        :to="{ name: Reader.name, query: { bid: v.bid, cid: v.chapter_id, from_detail_catalog: 1,last_cid: '' } }"
         v-for="v in catalogs"
         :key="v.chapter_id"
       >

+ 19 - 19
src/view/pay.vue

@@ -476,6 +476,7 @@ export default {
   },
   mounted() {
     this.popup()
+    console.log('接受的参数',this.$route.query)
   },
   methods: {
     changeCoupon() {
@@ -513,7 +514,7 @@ export default {
       );
     },
     popup() {
-      const from_detail_catalog = this.$route.query.from_detail_catalog; //判断是否是从详情页BookDetail or 目录BookCatalog 跳转到页面  1详情页  2目录
+      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 bid = this.$route.query.bid;
@@ -534,24 +535,23 @@ export default {
         }).then(action => {
           if (action === "confirm") {
             if (bid && cid){
-              from_detail_catalog === '2' ? console.log('11') : console.log('nono')
-              from_detail_catalog === '1' ? 
-              this.$router.replace({ // 跳回书籍详情页
-                name: BookDetail.name,
-                query: {
-                  id: bid
-                }
-              }) : ( from_detail_catalog === '2' ? 
+              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
-                  }
-                })
-                 :
-                //  console.log('跳回上一章',Reader.name)
+                    name: BookCatalog.name,
+                    query: {
+                      id: bid,
+                      sequence,
+                      yun
+                    }
+                  })
+              }else {
                 this.$router.replace({ // 跳回上一章
                   name: Reader.name,
                   query: {
@@ -561,7 +561,7 @@ export default {
                     yun,
                   }
                 })
-              )
+              }
             }else {
               this.$router.replace({ // 跳回个人中心
                 name: Person.name,

+ 8 - 6
src/view/reader.vue

@@ -393,7 +393,6 @@ export default {
       });
     },
     next() {
-      console.log('上一页cid',this.text)
       // 静默复制
       if (this.text.next_jump) {
         location.href = this.text.next_jump_url;
@@ -409,7 +408,8 @@ export default {
                 this.$route.query.sendid || localStorage.getItem("sendid"),
               yun: this.yun,
               last_bid: this.text.bid,
-              last_cid: this.text.chapter_id,
+              last_cid: this.text.prev_cid,
+              from_detail_catalog:3
             }
           });
         } else if (this.text.next_cid === 0) {
@@ -431,7 +431,8 @@ export default {
             cid: this.text.prev_cid,
             uuids: this.uuids,
             sendid: this.$route.query.sendid || localStorage.getItem("sendid"),
-            yun: this.yun
+            yun: this.yun,
+            from_detail_catalog:3
           },
           params: {
             jump: -1
@@ -498,11 +499,12 @@ export default {
           this.loading = false;
           const data = r.data.data;
           const sequence = this.$route.query.sequence
-          const last_bid = this.$route.query.last_bid
-          const last_cid = this.$route.query.last_cid
+          const last_bid = this.$route.query.bid
+          const last_cid = this.$route.query.cid
+          console.log('接受上一章id',this.$route.query)
+          const from_detail_catalog = this.$route.query.from_detail_catalog
           const sendid = this.$route.query.sendid
           const yun = this.$route.query.yun
-          const from_detail_catalog = 3
           switch (r.data.code) {
             case 10012:
               if (this.is_update) {