Browse Source

福利兑换
提现确定提示

xiaomei 6 months ago
parent
commit
ce1e47a6c7

+ 22 - 0
src/api/home.js

@@ -1238,4 +1238,26 @@ export default {
       data
     })
   },
+  // 福利兑换
+  getWelfareRedeConfig(data) {
+    return request.request({
+      url: '/ledger/getWelfareRedeConfig',
+      method: "post",
+      headers: {
+        'Accept-Language': localStorage.getItem('language') || 'zh-cn',
+      },
+      data
+    })
+  },
+  // 福利兑换提交
+  submitWelfare(data) {
+    return request.request({
+      url: '/ledger/submitWelfare',
+      method: "post",
+      headers: {
+        'Accept-Language': localStorage.getItem('language') || 'zh-cn',
+      },
+      data
+    })
+  },
 }

BIN
src/assets/images/index/ex.png


BIN
src/assets/images/tabbar/storage-active.png


BIN
src/assets/images/tabbar/storage-active1.png


BIN
src/assets/images/tabbar/storage.png


+ 1 - 0
src/components/BottomNavigation.vue

@@ -22,6 +22,7 @@ export default {
       menuList: [],
       navigationList: [
         { img: require('@/assets/images/tabbar/home.png'), bright: require('@/assets/images/tabbar/home-active.png'), text: this.$t('lang47'), name: 'Index' },
+        { img: require('@/assets/images/tabbar/storage.png'), bright: require('@/assets/images/tabbar/storage-active.png'), text: this.$t('lang220'), name: 'storage' },
         // { img: require('@/assets/images/tabbar/buy.png'), bright: require('@/assets/images/tabbar/buy-active.png'), text: this.$t('lang48'), name: 'trade' },
         { img: require('@/assets/images/tabbar/shichang.png'), bright: require('@/assets/images/tabbar/shichang-active.png'), text: this.$t('lang243'), name: 'transfer' },
         // { img: require('@/assets/images/tabbar/cha.png'), bright: require('@/assets/images/tabbar/cha-active.png'), text: this.$t('lang50'), name: '' },

+ 13 - 1
src/language/en.json

@@ -437,5 +437,17 @@
   "lang436": "Unit price:",
   "lang437": "Purchase in progress",
   "lang438": "Selling in progress",
-  "lang439": "Cancel sale"
+  "lang439": "Cancel sale",
+  "lang440": "Please enter the wallet address for transferring tokens",
+  "lang441": "Please enter the wallet address for transferring USDT",
+  "lang442": "Transfer address",
+  "lang443": "Token currency",
+  "lang444": "Token transfer address",
+  "lang445": "USDT transfer address",
+  "lang446": "Submit exchange",
+  "lang447": "Benefit exchange",
+  "lang448": "Are you sure to withdraw CCXX?",
+  "lang449": "Copy",
+  "lang450": "Are you sure to submit the exchange?",
+  "lang451": "Please select the token currency"
 }

+ 21 - 1
src/language/zh.json

@@ -437,5 +437,25 @@
   "lang436": "单价:",
   "lang437": "求购中",
   "lang438": "出售中",
-  "lang439": "取消出售"
+  "lang439": "取消出售",
+  "lang440": "请输入转代币的钱包地址",
+  "lang441": "请输入转USDT的钱包地址",
+  "lang442": "转入地址",
+  "lang443": "代币币种",
+  "lang444": "代币转账地址",
+  "lang445": "USDT转账地址",
+  "lang446": "提交兑换",
+  "lang447": "福利兑换",
+  "lang448": "您确认提现CCXX吗?",
+  "lang449": "复制",
+  "lang450": "是否确定提交兑换?",
+  "lang451": "请选择代币币种",
+  "lang452": "",
+  "lang453": "",
+  "lang454": "",
+  "lang455": "",
+  "lang456": "",
+  "lang457": "",
+  "lang458": "",
+  "lang459": ""
 }

+ 9 - 0
src/router/index.js

@@ -55,6 +55,7 @@ import frozenTransfer from '../views/mine/frozenTransfer.vue'; //转账标记茶
 import C2CList from '../views/c2c/list.vue'; //c2c列表
 import teacSell from '../views/c2c/sell.vue'; //c2c出售
 import teacBuy from '../views/c2c/buy.vue'; //c2c求购
+import exchange from '../views/mine/exchange.vue';  //兑换
 Vue.use(VueRouter);
 const routes = [
 
@@ -405,6 +406,14 @@ const routes = [
           requiresAuth: true
         }
       },
+      {
+        path: 'exchange',
+        name: 'exchange',
+        component: exchange,
+        meta: {
+          requiresAuth: true
+        }
+      },
     ],
   },
 ];

+ 3 - 3
src/views/index/index.vue

@@ -222,9 +222,9 @@ export default {
           url: '',
         },
         {
-          text: this.$t('lang262'),
-          icon: require('@/assets/images/index/fx.png'),
-          url: 'invite',
+          text: this.$t('lang447'),
+          icon: require('@/assets/images/index/ex.png'),
+          url: 'exchange',
         },
       ],
     };

+ 398 - 0
src/views/mine/exchange.vue

@@ -0,0 +1,398 @@
+<template>
+  <div class="assets">
+    <div class="head">
+      <img @click="back" src="@/assets/images/back.png" class="arrow_img" />
+      <span>{{ dataInfo.title }}</span>
+    </div>
+    <div class="pd">
+      <div class="">
+        <div class="total_box">
+          <img :src="dataInfo.product_image" alt="" />
+        </div>
+
+        <div class="list">
+          <div class="box">
+            <div class="box_item">
+              <span class="left black operate" v-html="dataInfo.operate_introd"></span>
+            </div>
+            <div class="box_item">
+              <span class="left black">{{ $t('lang442') }}</span>
+              <div class="address">
+                <span>{{ dataInfo.transfer_address }}</span>
+                <span class="copys" @click="copy" :data-clipboard-text="this.dataInfo.transfer_address">{{ $t('lang449') }}</span>
+              </div>
+            </div>
+            <div class="box_item">
+              <span class="left">{{ $t('lang443') }}</span>
+              <van-radio-group v-model="coin" class="f-sb right">
+                <van-radio v-for="(item, index) in dataInfo.currency" :key="index" :name="item" icon-size="16" checked-color="#29b286" shape="square">{{ item }}</van-radio>
+              </van-radio-group>
+            </div>
+            <div class="box_item">
+              <span class="left">{{ $t('lang444') }}</span>
+              <van-field v-model="coin_from_address" type="textarea" :placeholder="$t('lang440')" rows="1" autosize class="input" input-align="right" />
+            </div>
+            <div class="box_item">
+              <span class="left">{{ $t('lang445') }}</span>
+              <van-field v-model="usdt_from_address" type="textarea" :placeholder="$t('lang441')" rows="1" autosize class="input" input-align="right" />
+            </div>
+          </div>
+        </div>
+        <div class="buy" @click="withdrawCash">
+          <van-button class="buy_btn" type="primary">{{ $t('lang446') }}</van-button>
+        </div>
+        <div class="tips">
+          <div>{{ $t('lang116') }}</div>
+          <div v-html="dataInfo.operate_desc"></div>
+        </div>
+      </div>
+    </div>
+    <van-overlay :show="show">
+      <div class="wrapper" @click.stop>
+        <van-loading type="spinner" class="loading" />
+      </div>
+    </van-overlay>
+  </div>
+</template>
+
+<script>
+import { homeApi } from '@/api/index';
+import { dateFormat } from '@/utils/formatTool.js';
+import Web3 from 'web3';
+import { Dialog, Notify } from 'vant';
+import Clipboard from 'clipboard';
+export default {
+  data() {
+    return {
+      page: 0,
+      total: 1,
+      assets: 0,
+      amount: '',
+      // type: 1, // 1udst奖励 2teac奖励
+      coin_from_address: '',
+      usdt_from_address: '',
+      dataInfo: {
+        title: this.$t('lang447'),
+        product_image: '',
+        operate_introd: '',
+        operate_desc: '',
+        transfer_address: '',
+        currency: {
+          1: '',
+          2: '',
+        },
+        currency_price: {
+          S1: 0,
+          RAC: 0,
+          USDT: 0,
+        },
+      },
+      show: false,
+      coin: '',
+    };
+  },
+  mounted() {
+    this.getWelfareRedeConfig();
+  },
+  methods: {
+    //返回上一页
+    back() {
+      this.$router.back();
+    },
+    navigation(name) {
+      this.$router.push({ name });
+    },
+    changeNav(item, index) {
+      this.navIndex = index;
+    },
+
+    getWelfareRedeConfig() {
+      homeApi.getWelfareRedeConfig().then(res => {
+        if (res.code == 200) {
+          this.dataInfo = res.data;
+        } else {
+        }
+      });
+    },
+
+    copy() {
+      if (this.dataInfo.transfer_address) {
+        var clipboard = new Clipboard('.copys');
+        clipboard.on('success', e => {
+          this.$toast(this.$t('lang45'));
+          clipboard.destroy(); // 释放内存
+        });
+        clipboard.on('error', e => {
+          this.$toast(this.$t('lang46'));
+          clipboard.destroy(); // 释放内存
+        });
+      }
+    },
+    withdrawCash() {
+      if (!this.coin) {
+        this.$toast(this.$t('lang451'));
+        return;
+      }
+      if (!this.coin_from_address) {
+        this.$toast(this.$t('lang440'));
+        return;
+      }
+      if (!this.usdt_from_address) {
+        this.$toast(this.$t('lang441'));
+        return;
+      }
+      let _this = this;
+      Dialog.confirm({
+        title: _this.$t('lang136'),
+        message: _this.$t('lang450'),
+        confirmButtonText: _this.$t('lang111'),
+        cancelButtonText: _this.$t('lang135'),
+      })
+        .then(() => {
+          _this.show = true;
+          let params = {
+            coin: _this.coin,
+            coin_from_address: _this.coin_from_address,
+            usdt_from_address: _this.usdt_from_address,
+          };
+          homeApi
+            .submitWelfare(params)
+            .then(res => {
+              _this.show = false;
+              if (res.code == 200) {
+                _this.currency = '';
+                _this.coin_from_address = '';
+                _this.usdt_from_address = '';
+                _this.getWelfareRedeConfig();
+                Notify({ type: 'success', message: res.msg });
+              } else {
+                // Notify({ message: res.msg });
+              }
+            })
+            .catch(err => {
+              _this.show = false;
+            });
+        })
+        .catch(() => {
+          // on cancel
+        });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.head {
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  color: rgba(#000, 0.8);
+  letter-spacing: 1.5px;
+  font-weight: 550;
+  background: #fff;
+  padding: 15px 0;
+  z-index: 99;
+  .arrow_img {
+    position: absolute;
+    left: 20px;
+    width: 10px;
+    height: 16px;
+    // transform: translate(0, -50%);
+  }
+}
+.f-sb {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+.f-sa {
+  display: flex;
+  align-items: center;
+  justify-content: space-around;
+}
+.f-sb-n {
+  display: flex;
+  align-items: flex-end;
+  justify-content: space-between;
+}
+.f-col {
+  display: flex;
+  flex-direction: column;
+}
+.f {
+  display: flex;
+  align-items: center;
+}
+.assets {
+  min-height: 100vh;
+  padding: 50px 0 0;
+  background-color: #f6f6f6;
+  .top {
+    color: #000;
+    padding-bottom: 16px;
+    margin: 0 6px;
+  }
+  .pd {
+    padding: 4px;
+    margin-top: 4px;
+    // background-color: #fff;
+  }
+  .total_box {
+    font-size: 13px;
+    color: #fff;
+    // height: 140px;
+    // border-radius: 16px;
+    box-sizing: border-box;
+    border-radius: 10px;
+    margin: 0 10px 10px;
+    img {
+      width: 100%;
+      border-radius: 16px;
+    }
+  }
+
+  .bare {
+    text-align: center;
+    font-size: 14px;
+    padding: 60px 14px;
+    color: #888;
+  }
+  .list {
+    box-shadow: 0 0 10px rgba(#c5c5c5, 0.4);
+    border-radius: 10px;
+    padding: 0 16px;
+    margin: 10px 6px;
+    background-color: #fff;
+
+    .box {
+      width: 100%;
+      color: #3b3b3b;
+      // padding: 18px 0 18px;
+      .box_item:last-child {
+        border-bottom: none;
+        // align-items: flex-start;
+      }
+      &_item {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        padding: 18px 0;
+        border-bottom: 0.5px solid rgba(190, 190, 190, 0.15);
+
+        .key {
+          color: #aaa;
+          font-size: 12px;
+        }
+        .left {
+          font-size: 13px;
+        }
+        .address {
+          font-size: 12px;
+          width: 200px;
+          text-align: right;
+          word-wrap: break-word;
+        }
+        .right {
+          width: 120px;
+          /deep/.van-radio__label {
+            font-size: 13px;
+            color: #3b3b3b;
+          }
+          /deep/.van-icon {
+            border-radius: 2px !important;
+          }
+        }
+        .operate {
+          width: 100%;
+          word-break: break-all;
+          letter-spacing: 1px;
+          // overflow-wrap: break-word;
+        }
+        .black {
+          color: #000;
+          font-weight: 600;
+        }
+        .copys {
+          color: #29b286;
+          padding-left: 4px;
+        }
+        .mobile {
+          font-size: 14px;
+          color: #000;
+          font-weight: 550;
+        }
+        .input {
+          font-size: 13px;
+          width: 180px;
+        }
+        /deep/.van-field__control::placeholder {
+          font-size: 12px;
+          letter-spacing: 1px;
+          overflow: hidden; //超出的文本隐藏
+          text-overflow: ellipsis; //溢出用省略号显示
+          white-space: nowrap; //溢出不换行
+        }
+        /deep/.van-field__control::-webkit-input-placeholder {
+          font-size: 12px;
+          letter-spacing: 1px;
+          overflow: hidden; //超出的文本隐藏
+          text-overflow: ellipsis; //溢出用省略号显示
+          white-space: nowrap; //溢出不换行
+        }
+        /deep/.van-field__control::-moz-placeholder {
+          font-size: 12px;
+          letter-spacing: 1px;
+          overflow: hidden; //超出的文本隐藏
+          text-overflow: ellipsis; //溢出用省略号显示
+          white-space: nowrap; //溢出不换行
+        }
+        /deep/.van-field__control::-ms-input-placeholder {
+          font-size: 12px;
+          letter-spacing: 1px;
+          overflow: hidden; //超出的文本隐藏
+          text-overflow: ellipsis; //溢出用省略号显示
+          white-space: nowrap; //溢出不换行
+        }
+      }
+    }
+  }
+  .buy {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    margin-top: 20px;
+    &_btn {
+      width: 70%;
+      height: 40px;
+      line-height: 40px;
+      font-size: 14px;
+      font-weight: 600;
+      letter-spacing: 1px;
+      background-color: #29b286;
+      border: none;
+      padding: 0 10px;
+      white-space: nowrap;
+      border-radius: 30px;
+    }
+  }
+  .tips {
+    color: #616161;
+    font-size: 12px;
+    line-height: 180%;
+    padding: 14px;
+  }
+}
+.wrapper {
+  // display: flex;
+  // justify-content: center;
+  .loading {
+    position: absolute;
+    left: 46%;
+    top: 46%;
+  }
+}
+</style>

+ 58 - 29
src/views/mine/withdraw.vue

@@ -57,8 +57,7 @@
         </div>
         <div class="tips">
           <div>{{ $t('lang116') }}</div>
-          <div v-html="dataInfo.describe">
-          </div>
+          <div v-html="dataInfo.describe"></div>
         </div>
       </div>
     </div>
@@ -74,7 +73,7 @@
 import { homeApi } from '@/api/index';
 import { dateFormat } from '@/utils/formatTool.js';
 import Web3 from 'web3';
-import { Notify } from 'vant';
+import { Dialog, Notify, Toast } from 'vant';
 export default {
   data() {
     return {
@@ -146,35 +145,65 @@ export default {
         this.$toast(`${this.$t('lang166')} ${this.dataInfo.withdraw_min_amount}`);
         return;
       }
-      this.show = true;
-      let web3 = new Web3(window.web3.currentProvider);
-      web3.eth.personal
-        .sign(web3.utils.fromUtf8('withdraw'), this.out_address, (err, res) => {
-          let params = {
-            amount: this.amount,
-            sign: res,
-            to_address: this.out_address,
-          };
-          homeApi
-            .withdrawCash(params)
-            .then(res => {
-              this.show = false;
-              if (res.code == 200) {
-                this.amount = '';
-                this.out_address = '';
-                this.getUserInfo();
-                Notify({ type: 'success', message: res.msg });
-              } else {
-                Notify({ message: res.msg });
-              }
+      let _this = this;
+      Dialog.confirm({
+        title: _this.$t('lang136'),
+        message: _this
+          .$t('lang448')
+          .replace('XX', _this.amount)
+          .replace(
+            'CC',
+            `<svg width="12" height="22" viewBox="28 -20 50 96" xmlns="http://www.w3.org/2000/svg">
+                  <path
+                    d="M70,35
+           C56,28 38,40 40,54
+           C40,64 50,74 70,66"
+                    fill="none"
+                    stroke="#646566"
+                    stroke-width="6"
+                    stroke-linecap="round"
+                  />
+                  <line x1="52" y1="29" x2="52" y2="73" stroke="#646566" stroke-width="5.2" stroke-linecap="round" />
+                  <line x1="63" y1="29" x2="63" y2="73" stroke="#646566" stroke-width="5.2" stroke-linecap="round" />
+                </svg>`
+          ),
+        confirmButtonText: _this.$t('lang111'),
+        cancelButtonText: _this.$t('lang135'),
+      })
+        .then(() => {
+          _this.show = true;
+          let web3 = new Web3(window.web3.currentProvider);
+          web3.eth.personal
+            .sign(web3.utils.fromUtf8('withdraw'), _this.out_address, (err, res) => {
+              let params = {
+                amount: _this.amount,
+                sign: res,
+                to_address: _this.out_address,
+              };
+              homeApi
+                .withdrawCash(params)
+                .then(res => {
+                  _this.show = false;
+                  if (res.code == 200) {
+                    _this.amount = '';
+                    _this.out_address = '';
+                    _this.getUserInfo();
+                    Notify({ type: 'success', message: res.msg });
+                  } else {
+                    Notify({ message: res.msg });
+                  }
+                })
+                .catch(err => {
+                  _this.show = false;
+                });
             })
             .catch(err => {
-              this.show = false;
+              _this.$toast(err);
+              _this.show = false;
             });
         })
-        .catch(err => {
-          this.$toast(err);
-          this.show = false;
+        .catch(() => {
+          // on cancel
         });
     },
   },
@@ -195,7 +224,7 @@ export default {
   font-weight: 550;
   background: #fff;
   padding: 15px 0;
-  // z-index: 99;
+  z-index: 99;
   .arrow_img {
     position: absolute;
     left: 20px;

+ 10 - 4
src/views/storage/list.vue

@@ -1,9 +1,9 @@
 <template>
   <div>
-    <div class="head">
+    <!-- <div class="head">
       <img @click="back" src="@/assets/images/back.png" class="arrow_img" />
       <span>{{ $t('lang217') }}</span>
-    </div>
+    </div> -->
     <div class="btn_box">
       <van-button
         :class="[typeIndex == 2 ? 'cc_btn cc_active' : 'cc_btn']"
@@ -68,6 +68,7 @@
         <span>{{ $t('lang60') }}</span>
       </div>
     </div>
+    <BottomNavigation></BottomNavigation>
   </div>
 </template>
 
@@ -75,6 +76,7 @@
 import { mapState } from 'vuex';
 import { homeApi } from '@/api/index';
 import { dateFormat } from '@/utils/formatTool.js';
+import BottomNavigation from '@/components/BottomNavigation.vue';
 export default {
   data() {
     return {
@@ -86,6 +88,9 @@ export default {
       current: parseInt(new Date().getTime() / 1000), //1743648326
     };
   },
+  components: {
+    BottomNavigation,
+  },
   mounted() {
     this.init();
   },
@@ -181,7 +186,8 @@ export default {
   width: 100%;
   box-sizing: border-box;
   position: fixed;
-  top: 52px;
+  top: 0;
+  z-index: 99;
   display: flex;
   align-items: center;
   justify-content: space-between;
@@ -213,7 +219,7 @@ export default {
   }
 }
 .home_page {
-  padding: 100px 0 30px;
+  padding: 58px 0 80px;
   height: 100vh;
   overflow: auto;