瀏覽代碼

购买状态接口

natasha 1 年之前
父節點
當前提交
178f414096

+ 2 - 2
src/api/ajax.js

@@ -14,9 +14,9 @@ export function getLogin(MethodName, data) {
         data
     })
 }
-export function getNoToken(MethodName, data) {
+export function getNoToken(MethodName, data, access_token) {
     return request({
-        url: `${MethodName}`,
+        url: `${MethodName}?AccessToken=${access_token}`,
         method: 'post',
         data
     })

+ 60 - 19
src/views/bookShelf/bookItem.vue

@@ -216,7 +216,7 @@ import Payment from "./components/Payment.vue"
 import TreeList from "./components/TreeList"
 import CourseList from "./components/CourseList.vue"
 import { cutMoneyFiter } from '@/utils/defined';
-import { getLogin } from "@/api/ajax";
+import { getLogin, getNoToken } from "@/api/ajax";
 import { getToken } from '@/utils/auth'
 
 export default {
@@ -482,29 +482,70 @@ export default {
                     this.info = res.data
                     this.issueChnList = res.data.chn_art_data
                 }
-                
-                this.isBuy = res.buy_info.is_buy
-                this.sales = res.buy_info.total_buy_count
-                if(this.sales<1000){
-                    this.salesCn = ''
-                }else if(1000<=this.sales&&this.sales<10000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'000+'
-                }else if(10000<=this.sales&&this.sales<100000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'万+'
-                }else if(100000<=this.sales&&this.sales<1000000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'0万+'
-                }else if(1000000<=this.sales&&this.sales<10000000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'00万+'
-                }else if(10000000<=this.sales&&this.sales<100000000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'000万+'
-                }else if(100000000<=this.sales){
-                    this.salesCn = this.sales.toString().substring(0,1)+'亿+'
-                }
             }
         })
         .catch(() => {
             
         }); 
+        if(this.userMessage){
+            getLogin('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                goods_type: this.bookType==='LB'?0:this.bookType==='baozhi'?2:null,
+                goods_id: this.id
+            })
+            .then((res) => {
+                if(res.status===1){
+                    this.isBuy = res.buy_info.is_buy
+                    this.sales = res.data.sold_count
+                    if(this.sales<1000){
+                        this.salesCn = ''
+                    }else if(1000<=this.sales&&this.sales<10000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'000+'
+                    }else if(10000<=this.sales&&this.sales<100000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'万+'
+                    }else if(100000<=this.sales&&this.sales<1000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'0万+'
+                    }else if(1000000<=this.sales&&this.sales<10000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'00万+'
+                    }else if(10000000<=this.sales&&this.sales<100000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'000万+'
+                    }else if(100000000<=this.sales){
+                        this.salesCn = this.sales.toString().substring(0,1)+'亿+'
+                    }
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }else{
+            getNoToken('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                goods_type: this.bookType==='LB'?0:this.bookType==='baozhi'?2:null,
+                goods_id: this.id
+            }, 'VOID')
+            .then((res) => {
+                if(res.status===1){
+                    this.isBuy = res.buy_info.is_buy
+                    this.sales = res.data.sold_count
+                    if(this.sales<1000){
+                        this.salesCn = ''
+                    }else if(1000<=this.sales&&this.sales<10000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'000+'
+                    }else if(10000<=this.sales&&this.sales<100000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'万+'
+                    }else if(100000<=this.sales&&this.sales<1000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'0万+'
+                    }else if(1000000<=this.sales&&this.sales<10000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'00万+'
+                    }else if(10000000<=this.sales&&this.sales<100000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'000万+'
+                    }else if(100000000<=this.sales){
+                        this.salesCn = this.sales.toString().substring(0,1)+'亿+'
+                    }
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }
     },
     // 处理授课时长 小于1分钟的按1分钟 之后个位数四舍五入
     handleCourseLength(list){

+ 60 - 18
src/views/bookShelf/bookPeruseItem.vue

@@ -120,7 +120,7 @@ import Payment from "./components/Payment.vue"
 import TreeList from "./components/TreeList"
 import CourseList from "./components/CourseList.vue"
 import { cutMoneyFiter } from '@/utils/defined';
-import { getLogin } from "@/api/ajax";
+import { getLogin, getNoToken } from "@/api/ajax";
 import { getToken } from '@/utils/auth'
 
 export default {
@@ -195,28 +195,70 @@ export default {
         .then((res) => {
             if(res.status===1){
                 this.info = res.data
-                this.isBuy = res.buy_info.is_buy
-                this.sales = res.data.sold_count
-                if(this.sales<1000){
-                    this.salesCn = ''
-                }else if(1000<=this.sales&&this.sales<10000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'000+'
-                }else if(10000<=this.sales&&this.sales<100000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'万+'
-                }else if(100000<=this.sales&&this.sales<1000000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'0万+'
-                }else if(1000000<=this.sales&&this.sales<10000000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'00万+'
-                }else if(10000000<=this.sales&&this.sales<100000000){
-                    this.salesCn = this.sales.toString().substring(0,1)+'000万+'
-                }else if(100000000<=this.sales){
-                    this.salesCn = this.sales.toString().substring(0,1)+'亿+'
-                }
             }
         })
         .catch(() => {
             
         }); 
+        if(this.userMessage){
+            getLogin('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                goods_type: 3,
+                goods_id: this.id
+            })
+            .then((res) => {
+                if(res.status===1){
+                    this.isBuy = res.buy_info.is_buy
+                    this.sales = res.data.sold_count
+                    if(this.sales<1000){
+                        this.salesCn = ''
+                    }else if(1000<=this.sales&&this.sales<10000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'000+'
+                    }else if(10000<=this.sales&&this.sales<100000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'万+'
+                    }else if(100000<=this.sales&&this.sales<1000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'0万+'
+                    }else if(1000000<=this.sales&&this.sales<10000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'00万+'
+                    }else if(10000000<=this.sales&&this.sales<100000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'000万+'
+                    }else if(100000000<=this.sales){
+                        this.salesCn = this.sales.toString().substring(0,1)+'亿+'
+                    }
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }else{
+            getNoToken('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                goods_type: 3,
+                goods_id: this.id
+            }, 'VOID')
+            .then((res) => {
+                if(res.status===1){
+                    this.isBuy = res.buy_info.is_buy
+                    this.sales = res.data.sold_count
+                    if(this.sales<1000){
+                        this.salesCn = ''
+                    }else if(1000<=this.sales&&this.sales<10000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'000+'
+                    }else if(10000<=this.sales&&this.sales<100000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'万+'
+                    }else if(100000<=this.sales&&this.sales<1000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'0万+'
+                    }else if(1000000<=this.sales&&this.sales<10000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'00万+'
+                    }else if(10000000<=this.sales&&this.sales<100000000){
+                        this.salesCn = this.sales.toString().substring(0,1)+'000万+'
+                    }else if(100000000<=this.sales){
+                        this.salesCn = this.sales.toString().substring(0,1)+'亿+'
+                    }
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }
     },
     // 生成订单
     handleOrder(){

+ 30 - 2
src/views/bookShelf/courseDetail.vue

@@ -59,7 +59,8 @@ import Header from "../../components/Header.vue";
 import LessonCatalog from "./components/LessonCatalog.vue"
 import AudioLine from "@/components/common/AudioLine.vue"
 import ResourcesList from "./components/ResourcesList.vue"
-import { getLogin } from "@/api/ajax";
+import { getLogin, getNoToken } from "@/api/ajax";
+import { getToken } from '@/utils/auth'
 
 export default {
   //import引入的组件需要注入到对象中才能使用
@@ -84,6 +85,7 @@ export default {
         isBuy: false,
         lessonInfo: null,
         play_total_count: null,
+        userMessage: getToken()?JSON.parse(getToken()):null,
     }
   },
   //计算属性 类似于data概念
@@ -141,7 +143,6 @@ export default {
                     }
                 });
                 this.lessonCatalogEdsc = JSON.parse(JSON.stringify(this.lessonCatalog)).reverse()
-                this.isBuy = res.buy_info.is_buy==='true'?true:false
                 let sales = res.play_info.play_total_count
                 if(sales<1000){
                     this.play_total_count = sales
@@ -159,6 +160,33 @@ export default {
         .catch(() => {
             
         }); 
+        if(this.userMessage){
+            getLogin('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                goods_type: 0,
+                goods_id: this.courseId
+            })
+            .then((res) => {
+                if(res.status===1){
+                    this.isBuy = res.buy_info.is_buy==='true'?true:false
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }else{
+            getNoToken('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                goods_type: 0,
+                goods_id: this.courseId
+            }, 'VOID')
+            .then((res) => {
+                if(res.status===1){
+                    this.isBuy = res.buy_info.is_buy==='true'?true:false
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }
     },
     // 获取课节信息
     getLessonInfo(index){

+ 31 - 3
src/views/bookShelf/videoDetail.vue

@@ -67,7 +67,8 @@ import Player from 'xgplayer';
 import 'xgplayer/dist/index.min.css';
 import Danmu from 'xgplayer/es/plugins/danmu'
 import "xgplayer/es/plugins/danmu/index.css"
-import { getLogin } from "@/api/ajax";
+import { getLogin, getNoToken } from "@/api/ajax";
+import { getToken } from '@/utils/auth'
 
 export default {
   //import引入的组件需要注入到对象中才能使用
@@ -109,7 +110,8 @@ export default {
             }
         },
         play_total_count: null,
-        timer: null
+        timer: null,
+        userMessage: getToken()?JSON.parse(getToken()):null,
     }
   },
   //计算属性 类似于data概念
@@ -212,7 +214,6 @@ export default {
                     }
                 });
                 this.lessonCatalogEdsc = JSON.parse(JSON.stringify(this.lessonCatalog)).reverse()
-                this.isBuy = res.buy_info.is_buy==='true'?true:false
                 let sales = res.play_info.play_total_count
                 if(sales<1000){
                     this.play_total_count = sales
@@ -230,6 +231,33 @@ export default {
         .catch(() => {
             
         }); 
+        if(this.userMessage){
+            getLogin('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                goods_type: 0,
+                goods_id: this.courseId
+            })
+            .then((res) => {
+                if(res.status===1){
+                    this.isBuy = res.buy_info.is_buy==='true'?true:false
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }else{
+            getNoToken('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                goods_type: 0,
+                goods_id: this.courseId
+            }, 'VOID')
+            .then((res) => {
+                if(res.status===1){
+                    this.isBuy = res.buy_info.is_buy==='true'?true:false
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }
     },
     // 获取课节信息
     getLessonInfo(index){

+ 6 - 0
src/views/bookStore/index.vue

@@ -116,6 +116,12 @@ export default {
         },
         {
             skeleton: true
+        },
+        {
+            skeleton: true
+        },
+        {
+            skeleton: true
         }
       ], // 录播课列表
       IssueList: [