Browse Source

模拟数据

TANGSHIZHE 4 years ago
parent
commit
a1ed6fdbfb

+ 13 - 3
jydocs-mobile/src/api/main.ts

@@ -21,9 +21,9 @@ export function getHomeActivity (data: any) {
 export function getCashOutInfo (data: any) {
   data = qs.stringify(data)
   return $request({
-    url: '/distribution/cashout/lastMsg',
-    method: 'get',
-    params: data
+    url: '/buy',
+    method: 'post',
+    data: data
   })
 }
 
@@ -44,3 +44,13 @@ export function getDetails (data: any) {
     params: data
   })
 }
+
+// 文库购买
+export function getDocPay (data: any) {
+  //   data = qs.stringify(data)
+  return $request({
+    url: '/user/buy',
+    method: 'post',
+    params: data
+  })
+}

+ 9 - 1
jydocs-mobile/src/store/modules/main.ts

@@ -4,7 +4,8 @@ import {
   getHomeHot,
   getHomeActivity,
   getCashOutInfo,
-  submitCashOutInfo
+  submitCashOutInfo,
+  getDocPay
 } from '@/api/main'
 
 interface InterfaceStore<S> extends StoreOptions<S> {
@@ -97,6 +98,13 @@ const modulesOption: modulesOption = {
         }
       })
     },
+    // 文库购买
+    async getDocPay (state, data) {
+      try {
+        const res = await getDocPay(data)
+        return res.data
+      } catch (error) {}
+    },
     // 提现查询
     async getCashOutInfo (state, data) {
       try {

+ 12 - 13
jydocs-mobile/src/views/purchase/purchase.vue

@@ -20,7 +20,7 @@
       </div>
       <div class="docs_phone">
         <van-cell-group>
-          <van-field v-model="tel" type="tel" label="手机号码" placeholder="请输入手机号码" />
+          <van-field v-model="tel" type="number" label="手机号码" placeholder="请输入手机号码" />
         </van-cell-group>
       </div>
     </div>
@@ -41,41 +41,40 @@
         <button class="apply_button" :disabled="!this.checked" @click="exchange()">确定兑换</button>
       </div>
     </div>
-    <RechargeHave></RechargeHave>
   </div>
 </template>
 
 <script lang="ts">
 import { Component, Vue } from 'vue-property-decorator'
 import { Checkbox, CheckboxGroup, Field, CellGroup } from 'vant'
-import { mapActions, mapMutations } from 'vuex'
-import RechargeHave from '../../components/RechargeHave.vue'
+import { mapActions } from 'vuex'
+import { getDocPay } from '../../api/main'
 @Component({
   name: 'purchase-page',
   components: {
-    RechargeHave,
     [Checkbox.name]: Checkbox,
     [CheckboxGroup.name]: CheckboxGroup,
     [Field.name]: Field,
     [CellGroup.name]: CellGroup
   },
   methods: {
-    ...mapMutations({
-      saveLogout: 'logout/setLogout'
-    }),
     ...mapActions({
-      sureLogout: 'logout/sureLogout'
+      getDocPay: 'main/getDocPay'
     })
   }
 })
 export default class extends Vue {
-  protected sureLogout!: any
-  protected saveLogout!: any
+  // protected getDocPay!: any
   checked = false
-  tel = 1
+  tel = ''
   $router: any
+
+  // 确定兑换
   exchange () {
-    this.$router.push('/purchasesuccess')
+    getDocPay({ docId: 'RJ82241sM3DyHwrupW7w', phone: '18439509554' }).then((res: any) => {
+      console.log(res)
+    })
+    // this.$router.push('/purchasesuccess')
   }
 
   // 剑鱼标讯服务条款

+ 0 - 5
jydocs-mobile/src/views/purchase/purchasesuccess.vue

@@ -27,7 +27,6 @@
             <div class="infor_value">6489798765465465</div>
           </div>
         </div>
-      <SharePopup></SharePopup>
       </div>
     </div>
     <div class="j-footer apply_footer">
@@ -39,16 +38,12 @@
 <script lang="ts">
 import { Component, Vue } from 'vue-property-decorator'
 // import { mapState } from 'vuex'
-import { fen2Yuan } from '../../utils/globalFunctions'
-import SharePopup from '../../components/SharePopup.vue'
 
 @Component({
   name: 'test',
   components: {
-    SharePopup
   },
   methods: {
-    fen2Yuan
   },
   computed: {
     // ...mapState('logout', {