Browse Source

提交购买优化 ,日期显示逻辑调整

wenmenghao 1 năm trước cách đây
mục cha
commit
2e4ccc9728

+ 8 - 5
jydocs-mobile/src/views/details/details.vue

@@ -36,7 +36,7 @@
       <div class="foot-ad">
         <div class="warm_text" v-if="warmShow && isrenew">
           <van-icon :name="'diy-warmclose'" @click="warmShow = false"></van-icon>
-          <div class="middle_text">您的文库会员将于{{Remainingtime}}天后到期,续费即享下载特权!</div>
+          <div class="middle_text">您的文库会员将于{{Remainingtime}}到期,续费即享下载特权!</div>
           <div class="warm_btn" @click="bottomBtn('续费文库会员')">去续费</div>
         </div>
         <div class="ad-box" v-if="showAd && !isrenew">
@@ -256,7 +256,7 @@ export default class extends Vue {
   docIds = ''
   fixed = false
   coins: any = []
-  Remainingtime = 0
+  Remainingtime = ''
   use = ''
   surplus = ''
   pdfPage = {
@@ -419,7 +419,6 @@ export default class extends Vue {
   getNumPages (url: string) {
     const loadingTask = pdf.createLoadingTask(url)
     loadingTask.promise.then((pdf: any) => {
-      console.log(pdf)
       this.pdfPage.url = loadingTask
       this.pdfPage.pageNum = pdf.numPages
     }).catch((err: any) => {
@@ -437,12 +436,16 @@ export default class extends Vue {
     if (Remainingtime <= sevenDay && this.power.docStatus > 0) {
       this.isrenew = true
     }
-    this.Remainingtime = this.timestampToDays(Remainingtime)
+    this.Remainingtime = this.timestampToDays(Remainingtime) as string
   }
 
   timestampToDays (timestamp: number) {
     const oneDay = 24 * 60 * 60 * 1 // 每天的秒数
-    return Math.round(timestamp / oneDay) // 计算天数,并四舍五入
+    if ((timestamp / oneDay) < 1) {
+      return '今天'
+    } else {
+      return (timestamp / oneDay).toFixed(0) + '天后'
+    }
   }
 
   async getShareUrl () {

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

@@ -183,7 +183,12 @@ export default class extends Vue {
 
   // 确定兑换
   exchange () {
+    this.$toast.loading({
+      forbidClick: true,
+      duration: 0
+    })
     this.getDocPay({ docId: this.sessioninfor.query, phone: this.tel, payType: this.payType || '1' }).then((res: any) => {
+      this.$toast.clear()
       console.log(res)
       if (res.error_code === 0) {
         this.sessioninfor.balance = res.data.balance