zzzz
2024-03-26 0df61bbe45cd6adf9de18074b5e978673247be85
src/page/newUser/index.vue
@@ -1,276 +1,314 @@
<template>
   <div class="user_page">
  <div class="user_page DINPro">
      <div class="content">
         <div class="top_icon">
            <div class="left_icon">
               <div>
                  <img src="../../assets/img/img_log_home.png"
                     style="width: 40px;height: 40px;border-radius: 50px;" />
            <img
              src="../../assets/img/img_log_home.png"
              style="width: 40px; height: 40px; border-radius: 50px"
            />
               </div>
               <div class="top_box">
                  <div class="top_box_top" style="font-weight: 600;">{{userInfo.realName}}</div>
                  <div class="top_box_top" style="margin-top: 2px;">ID:{{userInfo.id}}</div>
            <div class="top_box_top" style="font-weight: 600">
              {{ userInfo.realName }}
            </div>
            <div class="top_box_top" style="margin-top: 2px">
              ID:{{ userInfo.id }}
            </div>
               </div>
            </div>
            <div class="right_icon">
               <div  style="justify-content: flex-end;" @click="goToTopUp()">
          <div style="justify-content: flex-end" @click="goToTopUp()">
                  <img src="@/assets/img/shezhia.png" alt />
               </div>
               <!-- <div style="justify-content: flex-end;">
                  <a href="https://t.me/Mc1992023" target="_blank">
                     <img style="width: 0.5rem;height: 0.5rem;" src="@/assets/img/kefu.png" alt />
                  </a>
               </div> -->
               <!-- <div @click="goOnline" style="justify-content: flex-end;">
            <img style="width: 0.5rem;height: 0.5rem;" src="@/assets/img/kefu.png" alt />
          </div> -->
            </div>
         </div>
         <div class="users" @click="goWall()" style="display:none">
            <div class="left_tou">
               <div class="left_tx">
      <div class="content-box">
        <van-row class="van-row-box">
          <van-col span="24">
            <div class="content-all">
              <span>賬戶總資產(USD)</span>
              <i @click="xy = !xy" class="iconfont xy">&#xe8c7;</i>
            </div>
            <div class="number-all">
              <showHide :text="userInfo.totalAssets" :flg="xy" />
            </div>
          </van-col>
        </van-row>
        <van-row style="margin-top: 18px">
          <div class="van-col van-col--8" style="margin-top: 10px">
            <div class="content-title DINPro">美股總資產(USD)</div>
                  <div>
                     <img src="@/assets/img/eslogo.png" alt />
                  </div>
               </div>
               <div class="right_name">
                  <span>{{ userInfo.realName ? userInfo.realName : userInfo.phone }}</span>
               </div>
            </div>
            <div class="right_go">
               <img src="@/assets/img/youjiantou.png" alt />
            </div>
         </div>
         <div class="center_card">
            <div style="display: flex;flex-direction: column;">
               <div class="keyon">
                  <span>{{ $t('usertop') }}</span>
               </div>
               <div class="num_price" v-if="userInfo.length == 0">
                  ₹0
               </div>
            </div>
            <div class="num_price" v-if="userInfo.length != 0">
               <p class="account">{{regexNum($store.state.userInfo.totalAssets)}}</p>
            </div>
            <div class="title_box">
               <div class="title_box_left">{{$t('titxt')}}</div>
               <div class="title_box_right">{{$t('titxta')}}</div>
            </div>
            <div class="title_box" style="margin-top: 15px;">
               <div class="title_box_left" style="color: #000;">{{$store.state.userInfo.userAmtToUsdt}}</div>
               <div class="title_box_right" style="color: #000;">{{$store.state.userInfo.userIndexAmt}}</div>
            </div>
            <div class="box1_bottom">
               <div class="btn2" @click="gotoa(1)">{{$t('btn1')}}</div>
               <div class="btn1" @click="gotoa(2)">{{$t('btn2')}}</div>
               <div class="btn1" @click="gotoa(3)">{{$t('btn3')}}</div>
            </div>
         </div>
         <div class="cd_box">
            <div class="cd_box_top">
            <img src="../../../static/img/ydgq.png" style="width: 17px;height: 17px;border-radius: 50px;margin-right: 5px;"/>
            {{$t('hhhh')}}</div>
            <div class="cd_box_body">
               <div class="cd_box_body_letf">{{$t('kygp')}}</div>
               <div class="cd_box_body_right">
                  <div class="cd_box_body_right_top">₹ {{$store.state.userInfo.userAmt}}</div>
                  <div class="cd_box_body_right_bottom">≈ ${{$store.state.userInfo.userAmtToUsdt}}</div>
               </div>
            </div>
            <div class="cd_box_body">
               <div class="cd_box_body_letf">{{$t('djgp')}}</div>
               <div class="cd_box_body_right">
                  <div class="cd_box_body_right_top">₹ {{$store.state.userInfo.allFreezAmt}}</div>
                  <div class="cd_box_body_right_bottom">≈ ${{$store.state.userInfo.allFreezAmtToUsdt}}</div>
              <div class="DINPro" style="font-size: 18px">
                <showHide :text="userInfo.usTotalAssets" :flg="xy" />
               </div>
            </div>
         </div>
         <div class="cd_box">
            <div class="cd_box_top">
            <img src="../../../static/img/usgq.png" style="width: 17px;height: 17px;border-radius: 50px;margin-right: 5px;"/>
            {{$t('hhaa')}}</div>
            <div class="cd_box_body">
               <div class="cd_box_body_letf">{{$t('uszh1')}}</div>
               <div class="cd_box_body_right">
                  <div class="cd_box_body_right_top">${{$store.state.userInfo.userIndexAmt}}</div>
               </div>
            </div>
            <div class="cd_box_body">
               <div class="cd_box_body_letf">{{$t('uszh2')}}</div>
               <div class="cd_box_body_right">
                  <div class="cd_box_body_right_top">${{$store.state.userInfo.usAllFreezAmt}}</div>
          <div class="van-col van-col--8" style="margin-top: 10px">
            <div class="content-title">馬股總資產(USD)</div>
            <div>
              <div class="DINPro" style="font-size: 18px">
                <showHide :text="userInfo.masTotalAssets" :flg="xy" />
               </div>
            </div>
         </div>
        </van-row>
        <van-row style="margin-top: 16px">
          <van-col span="8" style="display: flex; justify-content: center">
            <van-button
              @click="$router.push('/recharge')"
              class="btn-two"
              type="primary"
              >充值</van-button
            >
          </van-col>
          <van-col span="8" style="display: flex; justify-content: center">
            <van-button
              @click="$router.push('/RechargeSure')"
              class="btn-two"
              type="default"
              >提款</van-button
            >
          </van-col>
          <!-- transferIndex -->
          <van-col span="8" style="display: flex; justify-content: center">
            <van-button
              @click="$router.push('/transferIndex')"
              class="btn-two"
              type="default"
              >劃轉</van-button
            >
          </van-col>
          <!-- <van-col span="6" style="display: flex; justify-content: center">
            <van-button class="btn-two" type="default">資金明細</van-button>
          </van-col> -->
        </van-row>
      </div>
      <div style="width: 100%;height: 100px;"></div>
      <van-popup v-model="settingDialog" position="bottom" :style="{ height: '40%' }">
         <div class="setting_content">
            <div class="old_password">
               <div class="left_titles">
                  <span>{{ $t('hj150') + ':' }}</span>
      <div class="content-list-box">
        <div class="divider div-shrink"></div>
        <van-tabs
          line-width="22px"
          swipe-threshold="2"
          offset-top="20px"
          @change="tabsChange"
        >
          <van-tab
            v-model="active"
            v-for="(item, index) in listAsstes"
            :title="item.title"
            :key="index"
            :name="item.title"
          >
            <ul class="money">
              <li>
                <div class="li-title">
                  {{ item.title1 }}({{ item.symbolCode }})
               </div>
               <div class="right_password_input">
                  <input type="password" v-model="oldPassword" />
                <div class="li-USDT">
                  <div class="DINPro">
                    {{ item.symbol }} {{ item.availableBalance || "0.00" }}
                  </div>
                  <div class="DINPro">
                    ≈ $ {{ item.availableBalanceUSD || "0.00" }}
               </div>
            </div>
            <div class="old_password">
               <div class="left_titles">
                  <span>{{ $t('hj151') + ':' }}</span>
              </li>
              <li>
                <div class="li-title">
                  {{ item.title2 }}({{ item.symbolCode }})
               </div>
               <div class="right_password_input">
                  <input type="password" v-model="newPassword" />
                <div class="li-USDT">
                  <div class="DINPro">
                    {{ item.symbol }} {{ item.freezeMoney || "0.00" }}
                  </div>
                  <div class="DINPro">≈ $ {{ item.freezeMoney || "0.00" }}</div>
                </div>
              </li>
            </ul>
          </van-tab>
        </van-tabs>
               </div>
            </div>
            <div class="old_password">
               <div class="left_titles">
                  <span>{{ $t('hj152') + ':' }}</span>
               </div>
               <div class="right_password_input">
                  <input type="password" v-model="cirNewPassword" />
               </div>
            </div>
            <div class="btn_setting" @click="changeLoginPsd()">
               <span>{{ $t('hj153') }}</span>
            </div>
         </div>
      </van-popup>
   </div>
</template>
<script>
   import * as api from '@/axios/api'
   import {
      Toast,
      MessageBox
   } from 'mint-ui'
   import {
      isNull,
      pwdReg
   } from '@/utils/utils'
import * as api from "@/axios/api";
import { Toast, MessageBox } from "mint-ui";
import { isNull, pwdReg } from "@/utils/utils";
import showHide from "@/components/showHide";
import Vue from "Vue";
   export default {
      name: 'newUser',
  name: "newUser",
  components: { showHide },
      data() {
         return {
            name: '大狗子',
      // 显示隐藏
      xy: true,
      listAsstes: [
        {
          title: "美股資產",
          title1: "美股可用",
          title2: "美股冻结",
          accectType: "US",
          symbol: "$",
          symbolCode: "USD",
        },
        {
          title: "印股資產",
          title1: "印股可用",
          title2: "印股冻结",
          accectType: "IN",
          symbol: "RM",
          symbolCode: "MYR",
        },
        {
          title: "馬股資產",
          title1: "馬股可用",
          title2: "馬股冻结",
          accectType: "MAS",
          symbol: "RM",
          symbolCode: "MYR",
        },
      ],
      active: "美股資產",
      name: "大狗子",
            selectUserFlag: true,
            settingDialog: false,
            oldPassword: '', // 旧密码
            newPassword: '', // 新密码
            cirNewPassword: '', // 确认新密码
      oldPassword: "", // 旧密码
      newPassword: "", // 新密码
      cirNewPassword: "", // 确认新密码
            userInfo: [],
            onlineService: ''
         }
      onlineService: "",
      moneyList: [],
    };
      },
      components: {},
      created() {
         this.getUserInfo()
         this.getInfoSite()
    this.getUserInfo();
    this.getMoneyData();
    this.getInfoSite();
      },
      methods: {
    async getMoneyData() {
      let data = await api.getMoney();
      console.log(data);
      if (data.status === 0) {
        // 判断是否登录
        this.moneyList = data.data;
        data.data.map((item) => {
          this.listAsstes.map((items) => {
            if (item.accectType === items.accectType) {
              Vue.set(items, "availableBalance", item.availableBalance);
              Vue.set(items, "availableBalanceUSD", item.availableBalanceUSD);
              Vue.set(items, "freezeMoney", item.freezeMoney);
              Vue.set(items, "freezeMoneyUSD", item.freezeMoneyUSD);
              Vue.set(items, "symbol", item.symbol);
              Vue.set(items, "symbolCode", item.symbolCode);
            }
          });
        });
        console.log(this.listAsstes);
      }
    },
    tabsChange(e) {
      console.log(e);
    },
         yebclick() {
            this.$router.push('/yeb')
      this.$router.push("/yeb");
         },
         regexNum(str) {
            console.log(str);
            str = str.toString()
      str = str.toString();
            if (str.indexOf(".") == -1) {
               str = str + ".00"
        str = str + ".00";
            }
            var newStr = str.split('.')
            var point = newStr[1]
      var newStr = str.split(".");
      var point = newStr[1];
            if (point.length < 2) {
               point = point + "0"
        point = point + "0";
            }
            var moneyPoint = newStr[0]
      var moneyPoint = newStr[0];
            if (moneyPoint.length <= 3) {
               return moneyPoint + "." + point
        return moneyPoint + "." + point;
            } else {
               var mPoint = moneyPoint.substr(moneyPoint.length - 3, moneyPoint.length)
               var twoPoint = moneyPoint.substr(0, moneyPoint.length - 3)
               var endString = twoPoint.toString().replace(/(\d)(?=(\d{2})+(?!\d))/g, '$1,')
               return endString + "," + mPoint + '.' + point;
        var mPoint = moneyPoint.substr(
          moneyPoint.length - 3,
          moneyPoint.length
        );
        var twoPoint = moneyPoint.substr(0, moneyPoint.length - 3);
        var endString = twoPoint
          .toString()
          .replace(/(\d)(?=(\d{2})+(?!\d))/g, "$1,");
        return endString + "," + mPoint + "." + point;
            }
         },
         goOnline() {
            if (navigator.vibrate) {
               // 支持
               navigator.vibrate([55])
        navigator.vibrate([55]);
            }
            this.$router.push('/service')
      this.$router.push("/service");
         },
         async getInfoSite() {
            let data = await api.getInfoSite()
      let data = await api.getInfoSite();
            if (data.status === 0) {
               this.onlineService = data.data.onlineService
        this.onlineService = data.data.onlineService;
            } else {
               Toast(data.msg)
        Toast(data.msg);
            }
         },
         goWall() {
            if (this.userInfo.length === 0) {
               this.$store.commit('dialogVisible', true)
               return
        this.$store.commit("dialogVisible", true);
        return;
            }
            this.$router.push('/wallet')
      this.$router.push("/wallet");
         },
         gotoa(e){
            if (this.userInfo.length === 0) {
               this.$store.commit('dialogVisible', true)
               return
        this.$store.commit("dialogVisible", true);
        return;
            }
            if(e==1){
               this.$router.push('/wallet')
        this.$router.push("/wallet");
            }else if(e==2){
               this.$router.push('/tixian')
        this.$router.push("/tixian");
            }else{
               this.$router.push('/transfers')
        this.$router.push("/transfers");
            }
         },
         subclick() {
            this.$router.push('/SubDK')
      this.$router.push("/SubDK");
         },
         subaclick() {
            this.$router.push('/tixian')
      this.$router.push("/tixian");
         },
         handleZh() {
            this.selectUserFlag = !this.selectUserFlag
      this.selectUserFlag = !this.selectUserFlag;
            if (this.userInfo.length === 0) {
               this.$store.commit('dialogVisible', true)
               return
        this.$store.commit("dialogVisible", true);
        return;
            }
            if (navigator.vibrate) {
               // 支持
               navigator.vibrate([55])
        navigator.vibrate([55]);
            }
         },
         async getUserInfo() {
            // 获取用户信息
            let data = await api.getUserInfo()
      let data = await api.getUserInfo();
            if (data.status === 0) {
               // 判断是否登录
               this.$store.commit('dialogVisible', false)
               this.$store.state.userInfo = data.data
               this.userInfo = data.data
        this.$store.commit("dialogVisible", false);
        this.$store.state.userInfo = data.data;
        this.userInfo = data.data;
            } else {
               this.$store.commit('dialogVisible', true)
        this.$store.commit("dialogVisible", true);
            }
         },
         goToTopUp() {
@@ -282,72 +320,72 @@
            //    // 支持
            //    navigator.vibrate([55])
            // }
            this.$router.push('/setting')
      this.$router.push("/setting");
         },
         handleOutLoginClick() {
            // 退出登录
            MessageBox.confirm(this.$t('hj149') + '?', this.$t('hj165'), {
               confirmButtonText: this.$t('hj161'),
               cancelButtonText: this.$t('hj106')
            }).then(() => {
               this.toRegister()
            }).catch(() => {
      MessageBox.confirm(this.$t("hj149") + "?", this.$t("hj165"), {
        confirmButtonText: this.$t("hj161"),
        cancelButtonText: this.$t("hj106"),
            })
        .then(() => {
          this.toRegister();
        })
        .catch(() => {});
         },
         goToSettings() {
            if (this.userInfo.length === 0) {
               this.$store.commit('dialogVisible', true)
               return
        this.$store.commit("dialogVisible", true);
        return;
            }
            // 每次打开dialog 清空密码数据
            this.settingDialog = !this.settingDialog
      this.settingDialog = !this.settingDialog;
            if (this.settingDialog) {
               this.oldPassword = ''
               this.newPassword = ''
               this.cirNewPassword = ''
        this.oldPassword = "";
        this.newPassword = "";
        this.cirNewPassword = "";
            }
         },
         handleGoToTransfer() {
            if (this.userInfo.length === 0) {
               this.$store.commit('dialogVisible', true)
               return
        this.$store.commit("dialogVisible", true);
        return;
            }
            this.$router.push('/transfers')
      this.$router.push("/transfers");
         },
         handleGoToAuthentication() {
            if (this.userInfo.length === 0) {
               this.$store.commit('dialogVisible', true)
               return
        this.$store.commit("dialogVisible", true);
        return;
            }
            this.$router.push('/authentications')
      this.$router.push("/authentications");
         },
         handleGoToAuthenticationaz() {
            if (this.userInfo.length === 0) {
               this.$store.commit('dialogVisible', true)
               return
        this.$store.commit("dialogVisible", true);
        return;
            }
            this.$router.push('/download')
      this.$router.push("/download");
         },
         handleGoToBankCard() {
            if (this.userInfo.length === 0) {
               this.$store.commit('dialogVisible', true)
               return
        this.$store.commit("dialogVisible", true);
        return;
            }
            this.$router.push('/bankCard')
      this.$router.push("/bankCard");
         },
         async toRegister() {
            // 注销登陆
            window.localStorage.removeItem('USERTOKEN') // 清空本地存储 USERTOKEN字段
            this.clearCookie()
            let data = await api.logout()
      window.localStorage.removeItem("USERTOKEN"); // 清空本地存储 USERTOKEN字段
      this.clearCookie();
      let data = await api.logout();
            if (data.status === 0) {
               // Toast(data.msg)
               this.$router.push('/login')
        this.$router.push("/login");
            } else {
               Toast(data.msg)
        Toast(data.msg);
            }
            this.$router.push('/login')
      this.$router.push("/login");
         },
         async changeLoginPsd() {
            // 修改密码
@@ -356,43 +394,170 @@
               isNull(this.newPassword) ||
               isNull(this.cirNewPassword)
            ) {
               Toast(this.$t('hj154'))
               this.settingDialog = false
        Toast(this.$t("hj154"));
        this.settingDialog = false;
            } else if (!pwdReg(this.newPassword)) {
               Toast(this.$t('hj19'))
               this.settingDialog = false
        Toast(this.$t("hj19"));
        this.settingDialog = false;
            } else {
               // 修改密码
               if (this.newPassword === this.cirNewPassword) {
                  let opts = {
                     oldPwd: this.oldPassword,
                     newPwd: this.newPassword
                  }
                  let data = await api.changePassword(opts)
            newPwd: this.newPassword,
          };
          let data = await api.changePassword(opts);
                  if (data.status === 0) {
                     this.changeLoginPsdBox = false
                     Toast(data.msg)
                     this.settingDialog = false
            this.changeLoginPsdBox = false;
            Toast(data.msg);
            this.settingDialog = false;
                  } else {
                     Toast(data.msg)
                     this.settingDialog = false
            Toast(data.msg);
            this.settingDialog = false;
                  }
               } else {
                  Toast(this.$t('hj155'))
                  this.settingDialog = false
          Toast(this.$t("hj155"));
          this.settingDialog = false;
               }
            }
            if (navigator.vibrate) {
               // 支持
               navigator.vibrate([55])
            }
        navigator.vibrate([55]);
         }
      },
   }
  },
};
</script>
<style scoped lang="less">
/deep/ .van-button--primary {
  background-color: #0066ed;
}
/deep/ .van-tab {
  min-width: 2.66667rem;
  height: 1.17333rem;
  font-style: normal;
  font-weight: 400;
  font-size: 0.37333rem;
  text-align: center;
  color: #687284;
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/deep/ .van-tab--active {
  color: #2c2e3b;
}
/deep/ .van-tabs--line .van-tabs__wrap {
  height: auto;
}
/deep/ .van-tabs__line {
  background-color: #0066ed;
  // height: auto;
}
.xy {
  font-size: 28px;
  color: #cfd0d2;
  margin-left: 10px;
  cursor: pointer;
}
.money {
  font-family: "DINPro", serif;
  width: 100%;
  max-width: 25.6rem;
  li {
    width: 100%;
    max-width: 25.6rem;
    height: 1.54667rem;
    border-bottom: 0.02667rem solid #e5e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.4rem;
    box-sizing: border-box;
    text-align: right;
    .li-title {
      font-style: normal;
      font-weight: 500;
      font-size: 0.37333rem;
      color: #2d2f3c;
    }
    .li-USDT {
      font-style: normal;
      font-weight: 500;
      font-size: 0.37333rem;
      color: #2d2f3c;
      line-height: 28px;
    }
  }
}
.content-list-box {
  width: 100%;
  min-height: calc(100vh - 6rem);
  background-color: #fff;
  .divider {
    width: 100%;
    height: 0.13333rem;
    background: #f1f1f1;
  }
}
.content-box {
  width: 100%;
  // min-height: 5.52rem;
  background: #ffffff;
  box-shadow: 0 0.16rem 0.32rem #eaeaea99;
  padding: 0.4rem;
  box-sizing: border-box;
  border-top-left-radius: 0.4rem;
  border-top-right-radius: 0.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  .content-title {
    font-family: "DINPro", serif;
    line-height: 28px;
    font-style: normal;
    font-weight: 400;
    font-size: 0.32rem;
    color: #14181f;
  }
  .btn-two {
    font-style: normal;
    font-weight: 400;
    font-size: 0.37333rem;
    line-height: 0.37333rem;
    width: 88%;
    height: 0.8rem;
    border: 0.01333rem solid #cfd0d2;
    border-radius: 0.05333rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.13333rem;
    box-sizing: border-box;
    overflow: hidden;
  }
}
.van-row-box {
  .content-all {
    font-style: normal;
    font-weight: 400;
    font-size: 0.32rem;
    color: #14181f;
    display: flex;
    line-height: 28px;
    // align-items: center;
  }
  .number-all {
    font-size: 32px;
    font-family: "DINPro", serif;
    line-height: 38px;
  }
}
   .top_box_top{
      color: #fff;
      font-size: 0.4rem;
@@ -456,7 +621,7 @@
      border: 0.5px solid #e5e5e5;
      border-radius: 8px;
      margin-top: 17px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .3);
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
   }
   .cd_box_body{
      display: flex;
@@ -494,12 +659,11 @@
   .user_page {
      width: 100%;
      height: calc(100% - 1.3rem);
      background: linear-gradient(to bottom, #3160FD, #ffffff);
  background: linear-gradient(to bottom, #3160fd, #ffffff);
      .content {
         width: 100%;
         height: 100%;
         padding: 0 0.3rem;
         .top_icon {
            width: 100%;
@@ -507,7 +671,7 @@
            display: flex;
            justify-content: space-between;
            align-items: center;
            // padding: 20px 0;
      padding: 0 0.3rem;
            .right_icon {
               width: 17%;
               height: 50%;
@@ -594,7 +758,7 @@
         .center_card {
            width: 100%;
            box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .3);
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
            // height: 5.3846rem;
            background: #fff;
            // background-image: linear-gradient(to right bottom, #ffffff, #dfedfc);
@@ -818,4 +982,10 @@
         }
      }
   }
/deep/ .el-upload__input {
  display: none !important;
}
input[type="file"] {
  display: none !important;
}
</style>