setting.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div class="mine">
  3. <div class="head">
  4. <img @click="back" src="@/assets/images/back.png" class="arrow_img" />
  5. <span>{{ $t('lang44') }}</span>
  6. </div>
  7. <div class="content">
  8. <div class="list">
  9. <div @click="showPopup(0)" class="li">
  10. <div class="li_left">
  11. <span>{{ $t('lang97') }}</span>
  12. </div>
  13. <span style="color: #aaaaaa" v-if="userinfo.nickname">{{ userinfo.nickname }}</span>
  14. <span style="color: #aaaaaa" v-else>{{ $t('lang98') }}</span>
  15. </div>
  16. <div @click="showPopup(1)" class="li">
  17. <div class="li_left">
  18. <span>{{ $t('lang99') }}</span>
  19. </div>
  20. <span style="color: #aaaaaa" v-if="userinfo.name">{{ userinfo.name }}</span>
  21. <span style="color: #aaaaaa" v-else>{{ $t('lang98') }}</span>
  22. </div>
  23. <div @click="showPopup(2)" class="li">
  24. <div class="li_left">
  25. <span>{{ $t('lang100') }}</span>
  26. </div>
  27. <span style="color: #aaaaaa" v-if="userinfo.phone">{{ userinfo.phone }}</span>
  28. <span style="color: #aaaaaa" v-else>{{ $t('lang98') }}</span>
  29. </div>
  30. <div @click="switchovers('language')" class="li">
  31. <div class="li_left">
  32. <span>{{ $t('lang101') }}</span>
  33. </div>
  34. <van-icon name="arrow" color="#aaaaaa" size="16" />
  35. </div>
  36. </div>
  37. </div>
  38. <div class="content">
  39. <div class="list">
  40. <div @click="switchovers()" class="li">
  41. <div class="li_left">
  42. <span>{{ $t('lang102') }}</span>
  43. </div>
  44. <van-icon name="arrow" color="#aaaaaa" size="16" />
  45. </div>
  46. <div @click="switchovers()" class="li">
  47. <div class="li_left">
  48. <span>{{ $t('lang103') }}</span>
  49. </div>
  50. <van-icon name="arrow" color="#aaaaaa" size="16" />
  51. </div>
  52. <div @click="switchovers()" class="li">
  53. <div class="li_left">
  54. <span>{{ $t('lang104') }}</span>
  55. </div>
  56. <span style="color: #aaaaaa">V1.0</span>
  57. </div>
  58. </div>
  59. </div>
  60. <van-popup v-model="editShow" round style="width: 80%" :close-on-click-overlay="true" @close="editShow = false">
  61. <div class="bind_box">
  62. <van-icon name="cross" class="close" size="20" @click="editShow = false" />
  63. <div class="title" v-if="editType == 0">{{ $t('lang105') }}</div>
  64. <div class="title" v-if="editType == 1">{{ $t('lang106') }}</div>
  65. <div class="title" v-if="editType == 2">{{ $t('lang107') }}</div>
  66. <div class="address_field">
  67. <van-field v-model="inputValue" type="text" rows="1" autosize :placeholder="$t('lang108')" v-if="editType == 0" />
  68. <van-field v-model="inputValue" type="text" rows="1" autosize :placeholder="$t('lang109')" v-if="editType == 1" />
  69. <van-field v-model="inputValue" type="text" rows="1" autosize :placeholder="$t('lang110')" v-if="editType == 2" />
  70. </div>
  71. <div class="bind_button" @click="editUserInfo">
  72. <span>{{ $t('lang111') }}</span>
  73. </div>
  74. </div>
  75. </van-popup>
  76. </div>
  77. </template>
  78. <script>
  79. import Superior from './superiorPopup.vue';
  80. import { Notify } from 'vant';
  81. import { usApi, newsLetterApi, walletApi, homeApi } from '@/api/index';
  82. import { mapState } from 'vuex';
  83. import union from '../../api/union';
  84. import Clipboard from 'clipboard';
  85. import Web3 from 'web3';
  86. export default {
  87. data() {
  88. return {
  89. withdrawShow: false, //提现弹窗状态
  90. total: 0,
  91. team_level_name: '',
  92. userinfo: {
  93. address: undefined,
  94. nickname: undefined,
  95. avatar: undefined,
  96. team_level_id: undefined,
  97. seso_url: undefined,
  98. submit_limit: 0,
  99. },
  100. order_count: {
  101. pay: 0,
  102. sell: 0,
  103. success: 0,
  104. cancel: 0,
  105. },
  106. withdrawAmount: 0, // 提现金额
  107. feeObj: {
  108. usdt: 0,
  109. withdraw_fee_rate: 0,
  110. withdraw_min_amount: 0,
  111. },
  112. receiptAmount: 0, // 实际到账金额
  113. editShow: false, //
  114. editType: 0, // 0修改昵称 1真实姓名 2手机号码
  115. inputValue: '',
  116. };
  117. },
  118. created() {
  119. this.init();
  120. },
  121. mounted() {
  122. // this.init();
  123. },
  124. methods: {
  125. //返回上一页
  126. back() {
  127. this.$router.back();
  128. },
  129. init() {
  130. if (this.account) {
  131. this.userinfo = JSON.parse(localStorage.getItem('userinfo'));
  132. this.userinfo.addressEncrypt = this.userinfo.address.substring(0, 5) + '****' + this.userinfo.address.substring(this.userinfo.address.length - 5, this.userinfo.address.length);
  133. this.getUserInfo();
  134. }
  135. },
  136. editUserInfo() {
  137. if (this.editType == 0 && !this.inputValue) {
  138. return this.$toast(this.$t('lang169'));
  139. } else if (this.editType == 1 && !this.inputValue) {
  140. return this.$toast(this.$t('lang170'));
  141. } else if ((this.editType == 2 && !this.inputValue) || (this.editType == 2 && this.inputValue.length < 11)) {
  142. return this.$toast(this.$t('lang171'));
  143. }
  144. let params = {};
  145. if (this.editType == 0) {
  146. params.nickname = this.inputValue;
  147. } else if (this.editType == 1) {
  148. params.name = this.inputValue;
  149. } else if (this.editType == 2) {
  150. params.phone = this.inputValue;
  151. }
  152. homeApi.setUserInfo(params).then(res => {
  153. if (res.code == 200) {
  154. this.editShow = false;
  155. this.inputValue = '';
  156. this.getUserInfo();
  157. Notify({ type: 'success', message: this.$t('lang172') });
  158. }
  159. });
  160. },
  161. switchovers(router) {
  162. if (router == '') {
  163. // window.location.href = this.userinfo.seso_url;
  164. this.superiorShow = true;
  165. } else if (router == '1') {
  166. this.$toast(this.$t('lang2'));
  167. } else {
  168. this.$router.push({ name: router });
  169. }
  170. },
  171. reckoningClick(name) {
  172. this.$router.push({ name: name });
  173. },
  174. showPopup(type) {
  175. this.editType = type;
  176. this.editShow = true;
  177. },
  178. getUserInfo() {
  179. homeApi.getUserInfo({}).then(res => {
  180. if (res.code == 200) {
  181. this.userinfo = res.data;
  182. this.order_count = res.data.order_count;
  183. this.userinfo.addressEncrypt = this.userinfo.address.substring(0, 5) + '****' + this.userinfo.address.substring(this.userinfo.address.length - 5, this.userinfo.address.length);
  184. }
  185. });
  186. },
  187. },
  188. computed: {
  189. ...mapState(['account']),
  190. },
  191. watch: {
  192. account() {
  193. this.init();
  194. },
  195. withdrawAmount(e) {
  196. // this.receiptAmount = 0;
  197. this.receiptAmount = Number(e) - Number(e) * Number(this.feeObj.withdraw_fee_rate);
  198. },
  199. },
  200. components: {
  201. Superior,
  202. },
  203. };
  204. </script>
  205. <style lang="less" scoped>
  206. .mine {
  207. min-height: 100vh;
  208. padding: 50px 0 0;
  209. .head {
  210. position: fixed;
  211. top: 0;
  212. left: 0;
  213. width: 100%;
  214. display: flex;
  215. align-items: center;
  216. justify-content: center;
  217. color: rgba(#000, 0.8);
  218. letter-spacing: 1.5px;
  219. font-weight: 550;
  220. background: #fff;
  221. padding: 14px 0;
  222. .arrow_img {
  223. position: absolute;
  224. left: 20px;
  225. width: 10px;
  226. height: 16px;
  227. // transform: translate(0, -50%);
  228. }
  229. }
  230. .flex-col {
  231. display: flex;
  232. flex-direction: column;
  233. }
  234. .flex-ac {
  235. align-items: center;
  236. justify-content: center;
  237. }
  238. .flex-row {
  239. display: flex;
  240. align-items: center;
  241. }
  242. .content {
  243. padding: 0 20px;
  244. color: #000;
  245. background-color: #fff;
  246. .list {
  247. margin-bottom: 16px;
  248. border-radius: 10px;
  249. background-color: rgba(255, 255, 255, 1);
  250. .li {
  251. display: flex;
  252. align-items: center;
  253. justify-content: space-between;
  254. font-size: 14px;
  255. color: rgb(36, 36, 36);
  256. padding: 22px 0;
  257. // margin-bottom: 10px;
  258. // box-shadow: 4px 4px 15px 0px rgba(180, 212, 212, 0.29);
  259. .li_left {
  260. display: flex;
  261. align-items: center;
  262. .imgbox {
  263. width: 20px;
  264. height: 20px;
  265. margin-right: 12px;
  266. }
  267. .li_img {
  268. width: 20px;
  269. height: 20px;
  270. }
  271. }
  272. .right {
  273. width: 7px;
  274. height: 12px;
  275. }
  276. }
  277. }
  278. }
  279. .withdrawPopup {
  280. padding: 20px 30px;
  281. color: #666666;
  282. font-size: 14px;
  283. .title {
  284. display: flex;
  285. justify-content: center;
  286. padding-bottom: 20px;
  287. font-weight: bold;
  288. font-size: 16px;
  289. color: #000000;
  290. }
  291. .tip {
  292. font-size: 12px;
  293. display: flex;
  294. flex-direction: column;
  295. }
  296. .btn {
  297. color: #fff;
  298. padding: 16px 0;
  299. text-align: center;
  300. line-height: 50%;
  301. border-radius: 20px;
  302. margin-top: 18px;
  303. background-color: #7938cf;
  304. }
  305. .close—icon {
  306. position: absolute;
  307. bottom: -40px;
  308. left: 45%;
  309. }
  310. }
  311. }
  312. .bind_box {
  313. font-size: 15px;
  314. text-align: center;
  315. color: #000;
  316. .close {
  317. position: absolute;
  318. right: 20px;
  319. top: 20px;
  320. }
  321. .title {
  322. padding: 20px 20px 26px;
  323. }
  324. .address_field {
  325. padding: 10px 0;
  326. margin: 0 30px 20px;
  327. }
  328. .bind_button {
  329. color: #29b286;
  330. text-align: center;
  331. border: none;
  332. padding: 16px 0;
  333. border-top: 1px solid #cccccc9d;
  334. }
  335. }
  336. </style>