TANGSHIZHE 4 rokov pred
rodič
commit
c55c089e7c

+ 38 - 0
jydocs-pc/src/api/modules/purchase.js

@@ -0,0 +1,38 @@
+import httpRequest from '@/api'
+import mockRequest from '@/api/mock'
+import qs from 'qs'
+
+let request = httpRequest
+if (process.env.NODE_ENV === 'development' && process.env.VUE_APP_MOCK === 'true') {
+  // @ts-ignore
+  request = mockRequest
+}
+
+// 文档购买
+export function getDocPays (data) {
+  data = qs.stringify(data)
+  return request({
+    url: '/user/buy',
+    method: 'post',
+    data: data
+  })
+}
+
+// 积分详情
+export function getJYchannel (data) {
+  data = qs.stringify(data)
+  return request({
+    url: '/getList',
+    method: 'post',
+    data: data
+  })
+}
+
+export function getDetails (data) {
+  data = qs.stringify(data)
+  return request({
+    url: '/detail',
+    method: 'post',
+    data: data
+  })
+}

+ 3 - 3
jydocs-pc/src/router.js

@@ -1,6 +1,6 @@
 import Vue from 'vue'
 import Router from 'vue-router'
-import Home from './views/Home.vue'
+// import Home from './views/Home.vue'
 
 Vue.use(Router)
 
@@ -10,8 +10,8 @@ export default new Router({
   routes: [
     {
       path: '/',
-      name: 'home',
-      component: Home
+      name: 'purchase',
+      component: () => import('@/views/purchase/purchase.vue')
     },
     {
       path: '/content/:id',

+ 60 - 11
jydocs-pc/src/views/purchase/purchase.vue

@@ -21,22 +21,22 @@
             </div>
             <div class="doc_c_right">
               <div class="doc_c_infor">
-                <div class="doc_in_title">优化招投标市场营商环境与国企采购人主体负责人</div>
-                <div class="doc_in_author">贡献者:张三</div>
+                <div class="doc_in_title">{{response.docName}}</div>
+                <!-- <div class="doc_in_author">贡献者:张三</div> -->
                 <div class="doc_in_actions">
-                  <span class="doc_download">2022次下载</span>
-                  <span class="doc_pages"> | 共18页 | </span>
-                  <span class="doc_readhot">220k</span>
+                  <span class="doc_download">{{response.downTimes}}次下载</span>
+                  <span class="doc_pages"> | 共{{response.docPageSize}}页 | </span>
+                  <span class="doc_readhot">{{response.docFileSize}}k</span>
                 </div>
               </div>
               <div class="doc_abstract">
-                本次股票发行后拟在科创板市场上市,该市场具有较高的投资风险。科创板公司具有研发投入大、经营风险高、业绩不稳定、退市风险高等特点该市场具有较高的投资风险。科创板公司具有研发投入大、经营风险高、业绩不稳定、退市风险高等特点,投资者面临较大的市场风险。投资者应充分了解科创板市场的投资...
+                {{response.docSummary}}
               </div>
             </div>
           </div>
           <div class="doc_content_actical">
             <span class="icon_jianyu"></span>
-            <span class="jianyumoney">500</span>
+            <span class="jianyumoney">{{response.price}}</span>
           </div>
         </div>
         <div class="doc_bindphone">
@@ -45,20 +45,20 @@
         </div>
         <div class="doc_balance">
           <span class="balance_label">剑鱼币余额:</span>
-          <span class="balance_num">3200</span>
+          <span class="balance_num">{{response.channel}}</span>
         </div>
         <div class="doc_setment">
           <span class="setment_label">兑换所需剑鱼币:</span>
           <div class="setment_num">
             <span class="icon_jianyu"></span>
-            <span class="setmoney">500</span>
+            <span class="setmoney">{{response.price}}</span>
           </div>
         </div>
         <div class="doc_agreement">
           <el-checkbox v-model="checked" >我已阅读并同意<a href="javascript:;" class="agree_link">《剑鱼标讯线上购买与服务条款》</a></el-checkbox>
         </div>
         <div class="doc_surepur">
-          <button class="btnsure" id="btnsure">确定兑换</button>
+          <button class="btnsure" @click="setExhange()" :disabled="!this.checked" id="btnsure">确定兑换</button>
         </div>
       </div>
     </div>
@@ -67,6 +67,7 @@
 
 <script>
 import { checkbox } from 'element-ui'
+import { getDocPays, getJYchannel, getDetails } from '../../api/modules/purchase'
 
 export default {
   name: 'purchasePage',
@@ -75,10 +76,55 @@ export default {
   },
   data () {
     return {
-      checked: true
+      checked: true,
+      response: {
+        docName: '',
+        price: '',
+        downTimes: '',
+        docFileSize: '',
+        docPageSize: '',
+        previewImgId: '',
+        docSummary: '',
+        channel: ''
+      }
     }
   },
+  created () {
+    this.getWordDetail()
+  },
   methods: {
+    // 文档信息
+    async getWordDetail () {
+      getDetails({ docId: '4e9cf3a8-8853-11eb-8699-0050568f51e7', phone: '18439509554' }).then((res) => {
+        console.log(res)
+        const item = res.data.detail
+        if (res.error_code === 0) {
+          this.response.docName = item.docName
+          this.response.price = item.price
+          this.response.downTimes = item.downTimes
+          this.response.docFileSize = item.docFileSize
+          this.response.docPageSize = item.docPageSize
+          this.response.previewImgId = item.previewImgId
+          this.response.docSummary = item.docSummary
+        }
+      })
+      getJYchannel({ B: true }).then((res) => {
+        console.log(res)
+        if (res.error_code === 0) {
+          this.response.channel = res.points.balance
+        }
+      })
+    },
+    // 确定兑换
+    setExhange () {
+      console.log(111)
+      getDocPays({ docId: '4f6c00ba-8882-11eb-8699-0050568f51e7', phone: '18439509554' }).then((res) => {
+        console.log(res)
+        if (res.data === 'success') {
+          this.$router.push('/purchasesuccess')
+        }
+      })
+    }
   }
 }
 </script>
@@ -329,6 +375,9 @@ export default {
           color: #FFFFFF;
           font-size: 16px;
         }
+        .btnsure:disabled{
+          opacity: 0.5;
+        }
       }
     }
   }