Browse Source

存储优化 续费、服务费

xiaomei 6 months ago
parent
commit
cb4a86816d

+ 20 - 0
src/api/home.js

@@ -1337,4 +1337,24 @@ export default {
       data
     })
   },
+  addPledgeProduct(data) {
+    return request.request({
+      url: '/pledge/addPledgeProduct',
+      method: "post",
+      headers: {
+        'Accept-Language': localStorage.getItem('language') || 'zh-cn',
+      },
+      data
+    })
+  },
+  setRenew(data) {
+    return request.request({
+      url: '/pledge/setRenew',
+      method: "post",
+      headers: {
+        'Accept-Language': localStorage.getItem('language') || 'zh-cn',
+      },
+      data
+    })
+  },
 }

+ 10 - 1
src/language/en.json

@@ -465,5 +465,14 @@
   "lang464": "Paste",
   "lang465": "The time left before the exchange starts is:",
   "lang466": "The time left before the exchange ends is:",
-  "lang467": "The exchange ends"
+  "lang467": "The exchange ends",
+  "lang468": "TeaC available balance:",
+  "lang469": "Payment: XX TeaC, confirm",
+  "lang470": "Please select the payment method for the service fee",
+  "lang471": "Expiration countdown:",
+  "lang472": "Renew",
+  "lang473": "Please select the order number to be cancelled",
+  "lang474": "Confirm cancellation",
+  "lang475": "Expired",
+  "lang476": "Are you sure to renew?"
 }

+ 9 - 9
src/language/zh.json

@@ -466,15 +466,15 @@
   "lang465": "距离开始兑换还有:",
   "lang466": "距离截止兑换还有:",
   "lang467": "截止兑换",
-  "lang468": "",
-  "lang469": "",
-  "lang470": "",
-  "lang471": "",
-  "lang472": "",
-  "lang473": "",
-  "lang474": "",
-  "lang475": "",
-  "lang476": "",
+  "lang468": "TeaC可用余额:",
+  "lang469": "支付:XX TeaC,确认",
+  "lang470": "请选择服务费支付方式",
+  "lang471": "到期倒计时:",
+  "lang472": "续费",
+  "lang473": "请选择要解除的订单号",
+  "lang474": "确认解除",
+  "lang475": "已到期",
+  "lang476": "是否确定续费?",
   "lang477": "",
   "lang478": "",
   "lang479": "",

+ 6 - 2
src/views/exchange/index.vue

@@ -11,13 +11,17 @@
           class="count2"
           v-if="new Date().getTime() < item.start_time * 1000"
           :time="item.start_time * 1000 - new Date().getTime()"
-          :format="`${$t('lang465')} DD ${$t('lang9')} HH ${$t('lang10')} mm ${$t('lang11')} ss ${$t('lang12')}`"
+          :format="item.start_time * 1000 - new Date().getTime() > 86400000
+          ? `${$t('lang465')} DD ${$t('lang9')} HH ${$t('lang10')} mm ${$t('lang11')} ss ${$t('lang12')}`
+          : `${$t('lang465')} HH ${$t('lang10')} mm ${$t('lang11')} ss ${$t('lang12')}`"
         />
         <van-count-down
           v-else-if="new Date().getTime() > item.start_time * 1000 && new Date().getTime() < item.end_time * 1000"
           class="count1"
           :time="item.end_time * 1000 - new Date().getTime()"
-          :format="`${$t('lang466')} DD ${$t('lang9')} HH ${$t('lang10')} mm ${$t('lang11')} ss ${$t('lang12')}`"
+          :format="item.end_time * 1000 - new Date().getTime() > 86400000
+          ? `${$t('lang466')} DD ${$t('lang9')} HH ${$t('lang10')} mm ${$t('lang11')} ss ${$t('lang12')}`
+          : `${$t('lang466')} HH ${$t('lang10')} mm ${$t('lang11')} ss ${$t('lang12')}`"
         />
         <span class="count3" v-else>{{ $t('lang467') }}</span>
       </div>

+ 23 - 1
src/views/storage/mulDetail.vue

@@ -38,6 +38,13 @@
           </div>
           <!-- </van-checkbox-group> -->
         </div>
+        <div class="flex payType">
+          <span class="key">{{ $t('lang398') }}</span>
+          <van-radio-group v-model="pay_type" direction="horizontal" icon-size="17px" checked-color="#21926f">
+            <van-radio name="1">{{$t('lang174')}}:{{ product.token }}</van-radio>
+            <van-radio name="2">TeaC:{{ product.teac }}</van-radio>
+          </van-radio-group>
+        </div>
         <div class="desc" v-html="product.detail"></div>
       </div>
       <div class="btn_box">
@@ -83,6 +90,7 @@ export default {
       product: {},
       order_no: {}, // 存放已选择订单
       show: false,
+      pay_type: -1,
     };
   },
   mounted() {
@@ -143,6 +151,9 @@ export default {
       if (JSON.stringify(this.order_no) == '{}') {
         return this.$toast(this.$t('lang330'));
       }
+      if (this.pay_type == -1) {
+        return this.$toast(this.$t('lang470'));
+      }
       let _this = this;
       Dialog.confirm({
         title: _this.$t('lang136'),
@@ -152,7 +163,7 @@ export default {
       })
         .then(() => {
           _this.show = true
-          let params = { pledge_id: _this.$route.query.id, order_no: Object.assign({}, _this.order_no) };
+          let params = { pledge_id: _this.$route.query.id, pay_type: _this.pay_type, order_no: Object.assign({}, _this.order_no) };
           homeApi.createPledge(params).then(res => {
             if (res.code == 200) {
               _this.show = false
@@ -358,6 +369,17 @@ export default {
       background-color: #fff;
     }
   }
+  .payType {
+    .key {
+      color: #4b4b4b;
+      font-size: 12px;
+    }
+    ::v-deep .van-radio__label {
+      color: #21926f;
+      font-size: 13px;
+      margin-left: 4px;
+    }
+  }
 }
 .flex {
   display: flex;

+ 23 - 1
src/views/storage/singleDetail.vue

@@ -38,6 +38,13 @@
           </div>
           <!-- </van-checkbox-group> -->
         </div>
+        <div class="flex payType">
+          <span class="key">{{ $t('lang398') }}</span>
+          <van-radio-group v-model="pay_type" direction="horizontal" icon-size="17px" checked-color="#21926f">
+            <van-radio name="1">{{$t('lang174')}}:{{ product.token }}</van-radio>
+            <van-radio name="2">TeaC:{{ product.teac }}</van-radio>
+          </van-radio-group>
+        </div>
         <div class="desc" v-html="product.detail"></div>
       </div>
       <div class="btn_box">
@@ -84,6 +91,7 @@ export default {
       product: {},
       order_no: {},
       show: false,
+      pay_type: -1,
     };
   },
   watch: {
@@ -146,6 +154,9 @@ export default {
       if (JSON.stringify(this.order_no) == '{}') {
         return this.$toast(this.$t('lang330'));
       }
+      if (this.pay_type == -1) {
+        return this.$toast(this.$t('lang470'));
+      }
       let _this = this;
       Dialog.confirm({
         title: _this.$t('lang136'),
@@ -155,7 +166,7 @@ export default {
       })
         .then(() => {
           _this.show = true;
-          let params = { pledge_id: _this.$route.query.id, order_no: Object.assign({}, _this.order_no) };
+          let params = { pledge_id: _this.$route.query.id, pay_type: _this.pay_type, order_no: Object.assign({}, _this.order_no) };
           homeApi.createPledge(params).then(res => {
             if (res.code == 200) {
               _this.show = false;
@@ -361,6 +372,17 @@ export default {
       background-color: #fff;
     }
   }
+  .payType {
+    .key {
+      color: #4b4b4b;
+      font-size: 12px;
+    }
+    ::v-deep .van-radio__label {
+      color: #21926f;
+      font-size: 13px;
+      margin-left: 4px;
+    }
+  }
 }
 .flex {
   display: flex;

+ 275 - 5
src/views/storage/storing.vue

@@ -28,11 +28,35 @@
                 <div style="font-size: 13px">{{ item1.order_no.substring(0, 4) + '****' + item1.order_no.substring(item1.order_no.length - 5, item1.order_no.length) }}</div>
               </div>
             </div>
+            <div class="plus f-r" v-if="item.type_id == 1 && JSON.parse(item.details).length < 3" @click="showAddStoring(item)">
+              <svg t="1749447443783" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="27760" width="50" height="50">
+                <path
+                  d="M544.83 557.536l374.19 0.973c17.694 0.046 32.039-14.21 32.085-31.904 0.045-17.74-14.21-32.04-31.904-32.086l-374.258-0.995 0.566-372.561c0.022-17.627-14.256-31.995-31.95-32.041-17.672-0.022-32.018 14.278-32.064 31.973l-0.564 372.47-373.986-0.996c-17.695-0.045-32.04 14.21-32.086 31.904-0.022 8.849 3.552 16.903 9.368 22.719 5.769 5.77 13.734 9.345 22.537 9.367l374.076 0.996-0.565 375.955c-0.023 8.846 3.553 16.856 9.368 22.671 5.793 5.793 13.78 9.346 22.583 9.369 17.672 0.022 31.995-14.256 32.04-31.95L544.83 557.536 544.83 557.536z"
+                  fill="#29b286"
+                  p-id="27761"
+                ></path>
+              </svg>
+            </div>
           </div>
 
-          <div class="btn_box">
+          <div class="btn_box f-sb-n">
+            <div>
+              <div class="count f-r" v-if="item.end_time * 1000 - new Date().getTime() <= 604800000">
+                <van-count-down
+                  class="count"
+                  :time="item.end_time * 1000 - new Date().getTime()"
+                  :format="`DD${$t('lang9')}HH${$t('lang10')}mm${$t('lang11')}ss${$t('lang12')}`"
+                  v-if="item.end_time * 1000 - new Date().getTime() > 0"
+                ></van-count-down>
+                <span class="count end" v-else>{{ $t('lang475') }}</span>
+                <div class="rnew" v-if="item.is_renew == 1" @click="showPayTypeFn(item)">{{ $t('lang472') }} <van-icon name="arrow" color="#29b286" /></div>
+              </div>
+            </div>
             <!-- 按钮 -->
-            <div class="buy" @click="removePledge(item.id)">
+            <div class="buy" @click="showChoose(item)" v-if="item.type_id == 1">
+              <van-button class="buy_btn btn1" type="primary">{{ $t('lang322') }}</van-button>
+            </div>
+            <div class="buy" @click="removePledge(item)" v-else-if="item.type_id == 2">
               <van-button class="buy_btn btn1" type="primary">{{ $t('lang322') }}</van-button>
             </div>
           </div>
@@ -42,6 +66,57 @@
         <span>{{ $t('lang82') }}</span>
       </div>
     </div>
+    <van-popup v-model="showOrders" round closeable>
+      <div class="orderpopup">
+        <div class="orderpopup_title">{{ $t('lang473') }}</div>
+        <van-checkbox-group v-model="checkbox" class="orderpopup_list" v-if="JSON.parse(detail.details).length > 0">
+          <div v-for="(item, index) in JSON.parse(detail.details)" :key="index" class="orderpopup_item f-sb">
+            <span :class="[checkbox.indexOf(item.order_no) >= 0 ? 'radio-active' : '']">
+              {{ item.order_no }}
+            </span>
+            <van-checkbox :name="item.id" icon-size="18px" checked-color="#21926f"></van-checkbox>
+          </div>
+        </van-checkbox-group>
+        <div class="nodata" v-else>
+          <span>{{ $t('lang60') }} </span>
+        </div>
+        <van-button type="default" class="btn" @click="removePledge(detail)">{{ $t('lang474') }}</van-button>
+      </div>
+    </van-popup>
+
+    <van-popup v-model="showAddOrders" round closeable>
+      <div class="orderpopup">
+        <div class="orderpopup_title">{{ $t('lang334') }}</div>
+        <van-checkbox-group v-model="addCheckbox" class="orderpopup_list" v-if="orderlist.length > 0">
+          <div v-for="(item, index) in orderlist" :key="index" class="orderpopup_item f-sb">
+            <span :class="[checkbox.indexOf(item.order_no) >= 0 ? 'radio-active' : '']">
+              {{ item.order_no }}
+            </span>
+            <van-checkbox :name="item.order_no" icon-size="18px" checked-color="#21926f"></van-checkbox>
+          </div>
+        </van-checkbox-group>
+        <div class="nodata" v-else>
+          <span>{{ $t('lang60') }} </span>
+        </div>
+        <van-button type="default" class="btn" @click="addPledgeProduct">{{ $t('lang111') }}</van-button>
+      </div>
+    </van-popup>
+    <van-popup v-model="showPayType" round closeable>
+      <div class="orderpopup">
+        <div class="orderpopup_title">{{ $t('lang470') }}</div>
+        <van-radio-group v-model="pay_type" icon-size="17px" checked-color="#21926f" class="f-c payRadio-box">
+          <div class="payRadio f-sb">
+            <span> {{ $t('lang174') }}:{{ detail.token }} </span>
+            <van-radio name="1"></van-radio>
+          </div>
+          <div class="payRadio f-sb">
+            <span>TeaC:{{ detail.teac }}</span>
+            <van-radio name="2"></van-radio>
+          </div>
+        </van-radio-group>
+        <van-button type="default" class="btn" @click="setRenew">{{ $t('lang111') }}</van-button>
+      </div>
+    </van-popup>
     <van-overlay :show="show">
       <div class="wrapper" @click.stop>
         <van-loading type="spinner" class="loading" color="#29b286" />
@@ -65,6 +140,16 @@ export default {
       nft_list: [],
       timer: null,
       show: false,
+      showOrders: false, //控制显示需要解除的订单号
+      checkbox: [], //存储解除的订单号
+      detail: {
+        details: '[]',
+      },
+      orderlist: [], //持有订单号列表
+      addCheckbox: [], //存储添加的订单号
+      showAddOrders: false, //控制显示持有订单号
+      showPayType: false, //控制显示支付方式
+      pay_type: -1, // 服务费支付方式  1token 2teac
     };
   },
   mounted() {
@@ -94,7 +179,115 @@ export default {
         }
       });
     },
-    removePledge(pledge_id) {
+    showChoose(item) {
+      this.detail = item;
+      this.showOrders = true;
+    },
+    showAddStoring(item) {
+      this.showAddOrders = true;
+      this.detail = item;
+      this.holdProductList(item.product_id);
+    },
+    showPayTypeFn(item) {
+      this.detail = item;
+      this.showPayType = true;
+    },
+    setRenew() {
+      if (this.pay_type == -1) {
+        return this.$toast(this.$t('lang470'));
+      }
+      let _this = this;
+      Dialog.confirm({
+        title: _this.$t('lang136'),
+        message: _this.$t('lang476'),
+        confirmButtonText: _this.$t('lang111'),
+        cancelButtonText: _this.$t('lang135'),
+      })
+        .then(() => {
+          _this.show = true;
+
+          homeApi.setRenew({ pledge_id: _this.detail.id, pay_type: _this.pay_type }).then(res => {
+            if (res.code == 200) {
+              _this.show = false;
+              _this.showPayType = false;
+              _this.detail = {
+                details: '[]',
+              };
+              _this.addCheckbox = [];
+              _this.nft_list = [];
+              clearInterval(this.timer);
+              _this.timer = null;
+              _this.teamine();
+              Notify({ type: 'success', message: _this.$t('lang152') });
+            } else {
+              _this.show = false;
+              this.$toast(res.msg);
+            }
+          });
+        })
+        .catch(() => {
+          // on cancel
+        });
+    },
+    addPledgeProduct() {
+      let _this = this;
+      Dialog.confirm({
+        title: _this.$t('lang136'),
+        message: _this.$t('lang327'),
+        confirmButtonText: _this.$t('lang111'),
+        cancelButtonText: _this.$t('lang135'),
+      })
+        .then(() => {
+          _this.show = true;
+
+          homeApi.addPledgeProduct({ pledge_id: _this.detail.id, order_no: _this.addCheckbox.join(',') }).then(res => {
+            if (res.code == 200) {
+              _this.show = false;
+              _this.showAddOrders = false;
+              _this.detail = {
+                details: '[]',
+              };
+              _this.addCheckbox = [];
+              _this.nft_list = [];
+              clearInterval(this.timer);
+              _this.timer = null;
+              _this.teamine();
+              Notify({ type: 'success', message: _this.$t('lang152') });
+            } else {
+              _this.show = false;
+              this.$toast(res.msg);
+            }
+          });
+        })
+        .catch(() => {
+          // on cancel
+        });
+    },
+    holdProductList(product_id) {
+      homeApi.holdProductList({ product_id }).then(res => {
+        if (res.code == 200) {
+          this.orderlist = res.data;
+        } else {
+          this.$toast(res.msg);
+        }
+      });
+    },
+    removePledge(item) {
+      if (this.detail.type_id == 1 && this.checkbox.length <= 0) {
+        return this.$toast(this.$t('lang473'));
+      }
+
+      let order_id =
+        item.type_id == 1
+          ? this.checkbox.join(',')
+          : JSON.parse(item.details)
+              .map(it => {
+                return it.id;
+              })
+              .join(',');
+
+      console.log(order_id);
+
       let _this = this;
       Dialog.confirm({
         title: _this.$t('lang136'),
@@ -104,12 +297,17 @@ export default {
       })
         .then(() => {
           _this.show = true;
-          homeApi.removePledge({ pledge_id }).then(res => {
+          homeApi.removePledge({ pledge_id: item.id, order_id: order_id }).then(res => {
             if (res.code == 200) {
               _this.show = false;
+              _this.showOrders = false;
+              _this.detail = {
+                details: '[]',
+              };
               _this.nft_list = [];
+              _this.checkbox = [];
               clearInterval(this.timer);
-              this.timer = null;
+              _this.timer = null;
               _this.teamine();
               Notify({ type: 'success', message: _this.$t('lang152') });
             } else {
@@ -196,6 +394,10 @@ export default {
   display: flex;
   align-items: flex-start;
 }
+.f-c {
+  display: flex;
+  flex-direction: column;
+}
 .btn_box {
   padding-top: 14px;
 }
@@ -437,6 +639,31 @@ export default {
       .item {
         margin-right: 6px;
       }
+
+      .plus {
+        width: 60px;
+        height: 60px;
+        justify-content: center;
+        border: 2px solid #5e5e5e;
+        border-radius: 10px;
+        margin: -12px 0 0 10px;
+      }
+    }
+
+    .count {
+      color: #29b286;
+      font-size: 12px;
+    }
+    .end {
+      color: red;
+    }
+    .rnew {
+      color: #29b286;
+      font-size: 11px;
+      padding: 2px 4px 2px 8px;
+      border-radius: 20px;
+      border: 1px solid #29b286;
+      margin-left: 6px;
     }
 
     .buy {
@@ -465,6 +692,49 @@ export default {
       justify-content: flex-end;
     }
   }
+  .orderpopup {
+    width: 300px;
+    height: fit-content;
+    color: #000;
+    padding: 16px 30px 0;
+    &_title {
+      text-align: center;
+    }
+    &_list {
+      margin: 28px 0 10px;
+    }
+    &_item {
+      color: #9b9b9b;
+      font-size: 15px;
+      padding-bottom: 12px;
+      .radio-active {
+        color: #000;
+      }
+    }
+    .btn {
+      width: 100%;
+      color: #21926f;
+      letter-spacing: 2px;
+      border: 0;
+      border-top: 1px solid rgba(#cccccc, 0.8);
+      border-radius: 0;
+      background-color: #fff;
+    }
+    .payRadio-box {
+      padding: 20px 0;
+      .payRadio {
+        font-size: 13px;
+        padding: 15px 0 8px;
+      }
+    }
+  }
+
+  .nodata {
+    font-size: 13px;
+    padding: 60px;
+    color: #4b4b4b;
+    text-align: center;
+  }
 }
 ::v-deep .van-cell {
   padding: 10px 0 !important;

+ 22 - 2
src/views/teacEx/detail.vue

@@ -61,8 +61,11 @@
           <span>{{ $t('lang242') }}</span>
           <van-stepper v-model="number" min="1" />
         </div>
+        <div class="avaliable">
+          {{ $t('lang468') + teac }}
+        </div>
         <div class="submit">
-          <van-button class="submit_btn" type="primary" @click="submitNoarea">{{ $t('lang71') }}</van-button>
+          <van-button class="submit_btn" type="primary" @click="submitNoarea">{{ $t('lang469').replace('XX', Math.floor(product.teac_price * number * 100) / 100) }}</van-button>
         </div>
       </div>
     </van-popup>
@@ -84,10 +87,12 @@ export default {
       loading: false,
       stepperShow: false,
       number: 1,
+      teac: 0, //teac资产
     };
   },
   mounted() {
     this.getTeacExDetail(this.$route.query.id);
+    this.assets();
   },
   methods: {
     goBack() {
@@ -139,6 +144,15 @@ export default {
           // on cancel
         });
     },
+    assets() {
+      homeApi.assets({}).then(res => {
+        if (res.code == 200) {
+          let data = res.data.coin_list;
+          this.teac = data.filter(i => i.coin_key == 'teac')[0].amount;
+        } else {
+        }
+      });
+    },
   },
 };
 </script>
@@ -363,7 +377,13 @@ export default {
   display: flex;
   align-items: center;
   justify-content: space-between;
-  padding: 36px 0 50px;
+  padding: 36px 0 0;
+}
+
+.avaliable {
+  color: #000;
+  font-size: 14px;
+  padding: 36px 0 20px;
 }
 .van-tabbar-item {
   font-size: 14px;