1
jhzh
2025-04-21 067883c72b282546402064eb1b78d8618d45b74d
src/page/newUser/index.vue
@@ -2,16 +2,22 @@
  <div class="user_page">
    <div class="content">
      <div class="top_icon">
        <div class="right_icon">
          <div @click="goToTopUp()">
          <!-- <div @click="goToTopUp()">
            <img src="@/assets/img/qianbao.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">
            <img src="@/assets/img/kefu.png" alt />
          </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()">
      <div class="users" @click="goWall()" style="display:none">
        <div class="left_tou">
          <div class="left_tx">
            <div>
@@ -31,26 +37,29 @@
          <span>{{ $t('hj49') }}</span>
        </div>
        <div class="num_price" v-if="userInfo.length == 0">
          ¥0
          ﷼0
        </div>
        <div class="num_price" v-if="userInfo.length != 0">
          <p v-if="this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
            class="account">
            ¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
                $store.state.userInfo.userIndexAmt).toFixed(2)
            }}11
            ﷼{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
              $store.state.userInfo.userIndexAmt).toFixed(2)
            }}
          </p>
          <p v-else-if="!this.$store.state.settingForm.indexDisplay && this.$store.state.settingForm.futuresDisplay"
            class="account">
            ¥{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
                $store.state.userInfo.userFuturesAmt).toFixed(2)
            }}22
            ﷼{{ $store.state.hide ? '****' : Number($store.state.userInfo.userAmt +
              $store.state.userInfo.userFuturesAmt).toFixed(2)
            }}
          </p>
          <p v-else-if="!this.$store.state.settingForm.indexDisplay && !this.$store.state.settingForm.futuresDisplay"
            class="account">¥&nbsp;&nbsp;{{ $store.state.hide ? '****' :
                Number($store.state.userInfo.userAmt).toFixed(2)
            class="account">﷼&nbsp;&nbsp;{{ $store.state.hide ? '****' :
              regexNum($store.state.userInfo.userAmt)
            }}</p>
        </div>
        <div style="text-align: center;">Phone: {{ this.$store.state.userInfo.phone }}</div>
        <div class="yk es">
          <div>
            <span>{{ $t('hj55') }}</span>
@@ -65,45 +74,58 @@
        </div>
        <div class="yk as">
          <div>
            <span class="orenge">¥ {{ userInfo.length != 0 ? $store.state.userInfo.allFreezAmt +
                $store.state.userInfo.djzj : 0
            <span class="orenge">﷼ {{ userInfo.length != 0 ? regexNum($store.state.userInfo.allFreezAmt +
              $store.state.userInfo.djzj) : 0
            }}</span>
          </div>
          <div v-if="userInfo.length == 0">
            <span v-if="!selectUserFlag">
              <span>{{ '¥ 0' }}</span>
              <span>{{ '﷼ 0' }}</span>
            </span>
            <span v-else>
              <span>{{ '¥ 0' }}</span>
              <span>{{ '﷼ 0' }}</span>
            </span>
          </div>
          <div v-if="userInfo.length != 0">
            <span v-if="!selectUserFlag">
              <span
                :class="$store.state.userInfo.allIndexProfitAndLose > 0 ? ' red' : $store.state.userInfo.allIndexProfitAndLose < 0 ? ' green' : ''">{{
                    '¥ ' + $store.state.userInfo.allIndexProfitAndLose
                  '﷼ ' + $store.state.userInfo.allIndexProfitAndLose
                }}</span>
            </span>
            <span v-else>
              <span
                :class="$store.state.userInfo.allProfitAndLose > 0 ? ' red' : $store.state.userInfo.allProfitAndLose < 0 ? ' green' : ''">{{
                    '¥ ' + $store.state.userInfo.allProfitAndLose
                  regexNum($store.state.userInfo.allProfitAndLose)
                }}</span>
            </span>
          </div>
          <div v-if="userInfo.length == 0">
            <span class="bzz" v-if="!selectUserFlag">{{ '¥ 0' }}</span>
            <span class="bzz" v-else>{{ '¥ 0' }}</span>
            <span class="bzz" v-if="!selectUserFlag">{{ '﷼ 0' }}</span>
            <span class="bzz" v-else>{{ '﷼ 0' }}</span>
          </div>
          <div v-if="userInfo.length != 0">
            <span class="bzz" v-if="!selectUserFlag">{{ '¥ ' + $store.state.userInfo.userIndexAmt }}</span>
            <span class="bzz" v-else>{{ '¥ ' + $store.state.userInfo.userAmt }}</span>
            <span class="bzz" v-if="!selectUserFlag">{{ '﷼ ' + $store.state.userInfo.enableIndexAmt }}</span>
            <span class="bzz" v-else>{{ '  ' + regexNum($store.state.userInfo.enableAmt) }}</span>
          </div>
        </div>
        <div class="btns" @click="handleZh()" :class="selectUserFlag ? '' : 'active'">
        <!-- <div class="btns" @click="handleZh()" :class="selectUserFlag ? '' : 'active'">
          <span>{{ selectUserFlag ? $t('hj142') : $t('hj143') }}</span>
        </div> -->
      </div>
      <div class="jy" @click="goWall()">
        <div class="left_gn">
          <div class="l_icon">
            <img src="../../assets/img/huazhuan2.png" alt />
          </div>
          <div class="r_title">
            <span>{{ $t('hj256') }}</span>
          </div>
        </div>
        <div class="right_gos">
          <img src="../../assets/img/youjiantou.png" alt />
        </div>
      </div>
      <div class="jy" @click="goToSettings()">
@@ -125,7 +147,7 @@
            <img src="../../assets/img/huazhuan2.png" alt />
          </div>
          <div class="r_title">
            <span>{{ $t('hj145') }}</span>
            <span>{{ $t('subdka') }}</span>
          </div>
        </div>
        <div class="right_gos">
@@ -208,39 +230,61 @@
</template>
<script>
import * as api from "@/axios/api";
import { Toast } from "mint-ui";
import { isNull, pwdReg } from "@/utils/utils";
import { MessageBox } from 'mint-ui'
import * as api from '@/axios/api'
import { Toast, MessageBox } from 'mint-ui'
import { isNull, pwdReg } from '@/utils/utils'
export default {
  name: "newUser",
  name: 'newUser',
  data() {
    return {
      name: "大狗子",
      name: '大狗子',
      selectUserFlag: true,
      settingDialog: false,
      oldPassword: "", // 旧密码
      newPassword: "", // 新密码
      cirNewPassword: "", //确认新密码
      oldPassword: '', // 旧密码
      newPassword: '', // 新密码
      cirNewPassword: '', // 确认新密码
      userInfo: [],
      onlineService: "",
    };
      onlineService: ''
    }
  },
  components: {
  },
  created() {
    this.getUserInfo();
    this.getInfoSite();
    this.getUserInfo()
    this.getInfoSite()
  },
  methods: {
    regexNum(str) {
      console.log(str);
      str = str.toString()
      if (str.indexOf(".") == -1) {
        str = str + ".00"
      }
      var newStr = str.split('.')
      var point = newStr[1]
      if (point.length < 2) {
        point = point + "0"
      }
      var moneyPoint = newStr[0]
      if (moneyPoint.length <= 3) {
        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;
      }
    },
    goOnline() {
      if (navigator.vibrate) {
        // 支持
        navigator.vibrate([55]);
        navigator.vibrate([55])
      }
      window.location.href = this.onlineService;
      this.$router.push('/service')
    },
    async getInfoSite() {
      let data = await api.getInfoSite()
@@ -251,104 +295,104 @@
      }
    },
    goWall() {
      if (this.userInfo.length == 0) {
        this.$store.commit('dialogVisible', true);
        return;
      }
      this.$router.push('/wallet')
      // if (this.userInfo.length === 0) {
      //   this.$store.commit('dialogVisible', true)
      //   return
      // }
      this.$router.push('/recharge')
    },
    handleZh() {
      this.selectUserFlag = !this.selectUserFlag;
      this.selectUserFlag = !this.selectUserFlag
      if (this.userInfo.length == 0) {
        this.$store.commit('dialogVisible', true);
        return;
      if (this.userInfo.length === 0) {
        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() {
      if (this.userInfo.length == 0) {
        this.$store.commit('dialogVisible', true);
        return;
      if (this.userInfo.length === 0) {
        this.$store.commit('dialogVisible', true)
        return
      }
      if (navigator.vibrate) {
        // 支持
        navigator.vibrate([55]);
        navigator.vibrate([55])
      }
      this.$router.push("/wallet");
      this.$router.push('/wallet')
    },
    handleOutLoginClick() {
      // 退出登录
      MessageBox.confirm(this.$t('hj149') + '?',this.$t('hj165'), {
      MessageBox.confirm(this.$t('hj149') + '?', this.$t('hj165'), {
        confirmButtonText: this.$t('hj161'),
        cancelButtonText: this.$t('hj106'),
        cancelButtonText: this.$t('hj106')
      }).then(() => {
        this.toRegister();
        this.toRegister()
      }).catch(() => {
      });
      })
    },
    goToSettings() {
      if (this.userInfo.length == 0) {
        this.$store.commit('dialogVisible', true);
        return;
      }
      // if (this.userInfo.length === 0) {
      //   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.$router.push("/transfers");
      // if (this.userInfo.length === 0) {
      //   this.$store.commit('dialogVisible', true)
      //   return
      // }
      this.$router.push('/RechargeSure')
    },
    handleGoToAuthentication() {
      if (this.userInfo.length == 0) {
        this.$store.commit('dialogVisible', true);
        return;
      }
      this.$router.push("/authentications");
      // if (this.userInfo.length === 0) {
      //   this.$store.commit('dialogVisible', true)
      //   return
      // }
      this.$router.push('/authentications')
    },
    handleGoToBankCard() {
      if (this.userInfo.length == 0) {
        this.$store.commit('dialogVisible', true);
        return;
      }
      this.$router.push("/bankCard");
      // if (this.userInfo.length === 0) {
      //   this.$store.commit('dialogVisible', true)
      //   return
      // }
      this.$router.push('/banklist')
    },
    async toRegister() {
      // 注销登陆
      window.localStorage.clear("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() {
      // 修改密码
@@ -357,39 +401,40 @@
        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);
          }
          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">
@@ -418,15 +463,15 @@
      align-items: center;
      .right_icon {
        width: 25%;
        width: 17%;
        height: 50%;
        display: flex;
        >div {
          width: 50%;
          width: 100%;
          height: 100%;
          display: flex;
          justify-content: center;
          justify-content: space-between;
          align-items: center;
          img {
@@ -506,7 +551,7 @@
      // height: 5.3846rem;
      background-image: linear-gradient(to right bottom, #ffffff, #dfedfc);
      // background-image: linear-gradient(to right, #ffffff , #dfedfc);
      margin-top: 0.5rem;
      // margin-top: 0.5rem;
      border-radius: 0.15rem;
      padding: 0.5rem 0.4rem;
@@ -619,12 +664,12 @@
      margin-top: 0.3rem;
      .left_gn {
        width: 40%;
        // width: 40%;
        height: 60%;
        display: flex;
        .l_icon {
          width: 30%;
          // width: 30%;
          height: 100%;
          display: flex;
          justify-content: center;
@@ -637,12 +682,13 @@
        }
        .r_title {
          width: 70%;
          // width: 70%;
          height: 100%;
          display: flex;
          align-items: center;
          font-size: 0.4046rem;
          color: #404040;
          padding-left: 0.3rem;
          span {
            font-weight: 600;
@@ -651,7 +697,7 @@
      }
      .right_gos {
        width: 20%;
        // width: 20%;
        height: 60%;
        display: flex;
        align-items: center;
@@ -723,4 +769,4 @@
    }
  }
}
</style>
</style>