setUserinfo.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. <template>
  2. <div class="user">
  3. <div class="user-wrap">
  4. <div class="u-item flex">
  5. <div class="base">用户名</div>
  6. <div class="base">{{userInfo.username}}</div>
  7. <el-button type="text" @click="dlVisible= true">修改密码</el-button>
  8. </div>
  9. <div class="u-item flex">
  10. <div class="base">用户ID</div>
  11. <div class="base">{{userInfo.id}}</div>
  12. </div>
  13. <div class="u-item flex">
  14. <div class="base">用户编号</div>
  15. <div class="base">{{userInfo.user_code}}</div>
  16. </div>
  17. <!-- <div class="u-item flex">
  18. <div class="base">地址</div>
  19. <div>
  20. <span style="display: inline-block;margin-right: 20px;">{{userInfo.address}}</span>
  21. <el-button type="text" @click="adVisible = true">设置地址</el-button>
  22. </div>
  23. </div> -->
  24. <div class="u-item flex">
  25. <div class="base">余额</div>
  26. <div>
  27. <span style="display: inline-block;margin-right: 20px;">{{userInfo.money}}</span>
  28. <el-button type="text" @click="czVisible = true">充值</el-button>
  29. <el-button type="text" @click="txVisible = true">提现</el-button>
  30. <el-button type="text" @click="zzVisible = true">转账</el-button>
  31. </div>
  32. </div>
  33. <div class="u-item flex">
  34. <div class="base">交易密码</div>
  35. <div @click="jyVisible = true">
  36. <el-button type="text" v-if="!userInfo.transaction">设置交易密码</el-button>
  37. <el-button type="text" v-else>修改交易密码</el-button>
  38. </div>
  39. </div>
  40. <div class="u-item flex">
  41. <div>
  42. <div class="base">开通二次验证</div>
  43. <el-tag type="danger">开通二次验证可以保障你的资金安全 否则被盗号所产生的一切问题,自行负责</el-tag>
  44. </div>
  45. <div>
  46. <el-button type="text" v-if="userInfo.is_binding == 1">已开通</el-button>
  47. <el-button type="text" v-else @click="getga">立即开通</el-button>
  48. </div>
  49. </div>
  50. <div class="u-item flex" v-if="userInfo.agent_id != 1">
  51. <div class="base">自动下单</div>
  52. <div>
  53. <el-button type="text" v-if="!userInfo.auto_order == 1" @click="xdVisible = true">立即开通</el-button>
  54. <el-button type="text" v-else>已开通</el-button>
  55. </div>
  56. </div>
  57. <div class="u-item flex" v-if="userInfo.agent_id != 1">
  58. <div class="base">账号有效时间</div>
  59. <div style="display: flex;flex-direction: column;align-items: flex-end;">
  60. <el-button type="text" @click="xfVisible = true">点击续费</el-button>
  61. <div>到期时间:{{showTime(userInfo.order_create_endtime) }}</div>
  62. </div>
  63. </div>
  64. </div>
  65. <!-- <el-card>
  66. <div class="wrap">
  67. <el-form :model="form" style="width: 500px;">
  68. <el-form-item label="头像" :label-width="formLabelWidth">
  69. <el-upload
  70. class="avatar-uploader"
  71. action="http://www.pingguozhushou.shop/api/common/upload"
  72. :show-file-list="false"
  73. :headers="token"
  74. :on-success="handleAvatarSuccess"
  75. :before-upload="beforeAvatarUpload">
  76. <img v-if="form.avatar" :src="form.avatar" class="avatar">
  77. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  78. </el-upload>
  79. </el-form-item>
  80. <el-form-item label="ID" :label-width="formLabelWidth">
  81. <el-input v-model="form.id" type="text" disabled
  82. width="300px"></el-input>
  83. </el-form-item>
  84. <el-form-item label="账号" :label-width="formLabelWidth">
  85. <el-input v-model="form.username" type="text" disabled
  86. width="300px"></el-input>
  87. </el-form-item>
  88. <el-form-item label="昵称" :label-width="formLabelWidth">
  89. <el-input v-model="form.nickname" type="text"
  90. placeholder="请输入昵称" width="300px"></el-input>
  91. </el-form-item>
  92. </el-form>
  93. <div class="dialog-footer">
  94. <el-button type="primary" @click="setInfo">确 定</el-button>
  95. </div>
  96. </div>
  97. </el-card> -->
  98. <el-dialog title="充值" :visible.sync="czVisible" width="350px">
  99. <el-form :model="form">
  100. <el-form-item label="充值金额" :label-width="formLabelWidth">
  101. <div class="flex">
  102. <el-input v-model="czForm.recharge_num" type="text"></el-input>
  103. </div>
  104. </el-form-item>
  105. </el-form>
  106. <div slot="footer" class="dialog-footer">
  107. <el-button @click="czVisible = false">取 消</el-button>
  108. <el-button type="primary" @click="getInfo">确 定</el-button>
  109. </div>
  110. </el-dialog>
  111. <el-dialog title="充值" :visible.sync="cztVisible" width="500px">
  112. <div class="biaoti">
  113. 温馨提示
  114. </div>
  115. <div class="tis" style="color: red;">
  116. 充值地址请以当前地址为准,如转错地址导致货币丢失,责任自负
  117. </div>
  118. <div class="biaoti">
  119. 钱包二维码
  120. </div>
  121. <div class="tis">
  122. <vueQrCode :size=qrCodeSize :text="czForm.address"> </vueQrCode>
  123. <div v-if="timer && time.isend == false" style="color: red;">充值剩余时间 :
  124. {{time.minutes + ':' + time.seconds }}</div>
  125. <div v-if="timer && time.isend" style="color: red;">当前地址已过期</div>
  126. </div>
  127. <div class="biaoti">
  128. 钱包地址
  129. </div>
  130. <div class="flex tis">
  131. <el-input v-model="czForm.address" type="text" disabled></el-input>
  132. <el-button @click="onCopy(czForm.address)" style="margin-left: 20px;">复制地址</el-button>
  133. </div>
  134. <div class="biaoti">
  135. 充值金额
  136. </div>
  137. <div class="tis">
  138. <el-input v-model="czForm.recharge_num" type="text" disabled></el-input>
  139. </div>
  140. <div class="biaoti">
  141. 充值金额提示
  142. </div>
  143. <div style="color: red;">
  144. 请按照实际到账金额(扣除手续费之后的到账):{{czForm.recharge_num}}进行充值,错误到账金额不予到账!
  145. </div>
  146. <div class="dialog-footer">
  147. <el-button @click="cztVisible = false">取 消</el-button>
  148. <el-button type="primary" @click="cztVisible = false">确 定</el-button>
  149. </div>
  150. </el-dialog>
  151. <!-- 账号续费 -->
  152. <el-dialog title="提示" :visible.sync="xfVisible" width="350px">
  153. <span style="display: block; padding: 0 0 20px 20px;">账号续费需支付{{baseInfo.code_price}}元</span>
  154. <el-form v-if="userInfo.is_binding == 1">
  155. <el-form-item label="动态口令">
  156. <el-input v-model="dtkl" type="number"></el-input>
  157. </el-form-item>
  158. </el-form>
  159. <span slot="footer" class="dialog-footer" style="width: 300px;">
  160. <el-button @click="xfVisible = false">取 消</el-button>
  161. <el-button type="primary" @click="xfzh">确 定</el-button>
  162. </span>
  163. </el-dialog>
  164. <!-- 添加地址 -->
  165. <el-dialog title="设置地址" :visible.sync="adVisible" @close="closeAd" width="600px">
  166. <el-form :model="adForm" style="width: 500px;">
  167. <el-form-item label="地址" :label-width="formLabelWidth">
  168. <el-input v-model="adForm.address" type="text" placeholder="请输入地址"></el-input>
  169. </el-form-item>
  170. <el-form-item label="动态口令" :label-width="formLabelWidth" v-if="userInfo.is_binding == 1">
  171. <el-input v-model="adForm.code" type="text" placeholder="请输入动态口令" width="300px"></el-input>
  172. </el-form-item>
  173. </el-form>
  174. <div class="dialog-footer">
  175. <el-button @click="closeAd">取 消</el-button>
  176. <el-button type="primary" @click="goAd">确 定</el-button>
  177. </div>
  178. </el-dialog>
  179. <!-- 登录密码 -->
  180. <el-dialog title="登录密码" :visible.sync="dlVisible" @close="closeDl" width="600px">
  181. <el-form :model="dlForm" style="width: 500px;">
  182. <el-form-item label="旧登录密码" :label-width="formLabelWidth">
  183. <el-input v-model="dlForm.oldpassword" type="password" placeholder="请输入旧登录密码"></el-input>
  184. </el-form-item>
  185. <el-form-item label="新登录密码" :label-width="formLabelWidth">
  186. <el-input v-model="dlForm.newpassword" type="password" placeholder="请输入新登录密码"
  187. width="300px"></el-input>
  188. </el-form-item>
  189. </el-form>
  190. <div class="dialog-footer">
  191. <el-button @click="closeDl">取 消</el-button>
  192. <el-button type="primary" @click="goDl">确 定</el-button>
  193. </div>
  194. </el-dialog>
  195. <!-- 自动下单 -->
  196. <el-dialog title="提示" :visible.sync="xdVisible" width="350px">
  197. <span style="display: block; padding: 0 0 20px 20px;">开通自动下单需支付{{baseInfo.auto_order}}元</span>
  198. <el-form v-if="userInfo.is_binding == 1">
  199. <el-form-item label="动态口令">
  200. <el-input v-model="dtkl" type="number"></el-input>
  201. </el-form-item>
  202. </el-form>
  203. <span slot="footer" class="dialog-footer" style="width: 300px;">
  204. <el-button @click="xdVisible = false">取 消</el-button>
  205. <el-button type="primary" @click="ktAuto">确 定</el-button>
  206. </span>
  207. </el-dialog>
  208. <!-- 谷歌校验 -->
  209. <el-dialog title="动态口令" :visible.sync="dtVisible" @close="closeDt" width="600px">
  210. <el-form :model="dtForm" style="width: 500px;">
  211. <el-form-item label="绑定二维码" :label-width="formLabelWidth">
  212. <img :src="images" alt="">
  213. </el-form-item>
  214. <el-form-item label="密钥" :label-width="formLabelWidth">
  215. <el-input v-model="dtForm.secret" type="text" placeholder="" width="300px"></el-input>
  216. </el-form-item>
  217. <el-form-item label="绑定口令" :label-width="formLabelWidth">
  218. <el-input v-model="dtForm.code" type="text" placeholder="请输入绑定口令" width="300px"></el-input>
  219. </el-form-item>
  220. </el-form>
  221. <div class="dialog-footer">
  222. <el-button type="primary" @click="goDt">确 定</el-button>
  223. </div>
  224. </el-dialog>
  225. <!-- 设置交易密码 -->
  226. <el-dialog title="交易密码" :visible.sync="jyVisible" @close="closeJy" width="600px">
  227. <el-form :model="jyForm" style="width: 500px;">
  228. <el-form-item label="新交易密码" :label-width="formLabelWidth">
  229. <el-input v-model="jyForm.newpassword" type="password" maxlength="30" minlength="6"
  230. placeholder="请输入新交易密码(6~30位任意字符)" width="300px"></el-input>
  231. </el-form-item>
  232. <el-form-item label="旧交易密码" :label-width="formLabelWidth" v-if="userInfo.transaction">
  233. <el-input v-model="jyForm.oldpassword" type="password" maxlength="30" minlength="6"
  234. placeholder="请输入旧交易密码"></el-input>
  235. </el-form-item>
  236. </el-form>
  237. <div class="dialog-footer">
  238. <el-button @click="closeJy">取 消</el-button>
  239. <el-button type="primary" @click="goJy">确 定</el-button>
  240. </div>
  241. </el-dialog>
  242. <!-- 转账 -->
  243. <el-dialog title="转账" :visible.sync="zzVisible" @close="closeZz" width="600px">
  244. <el-form :model="zzForm">
  245. <el-form-item label="收款用户ID" :label-width="formLabelWidth">
  246. <el-input v-model="zzForm.to_user_id" type="number"></el-input>
  247. </el-form-item>
  248. <el-form-item label="转账金额" :label-width="formLabelWidth">
  249. <el-input v-model="zzForm.transfer_num" type="number"></el-input>
  250. </el-form-item>
  251. <el-form-item label="动态口令" :label-width="formLabelWidth" v-if="userInfo.is_binding == 1">
  252. <el-input v-model="zzForm.code" type="number"></el-input>
  253. </el-form-item>
  254. </el-form>
  255. <div class="t-r">
  256. 当前余额: {{userInfo.money*1}}元
  257. </div>
  258. <div slot="footer" class="dialog-footer">
  259. <el-button @click="closeZz">取 消</el-button>
  260. <el-button type="primary" @click="goZz">确 定</el-button>
  261. </div>
  262. </el-dialog>
  263. <!-- 提现 -->
  264. <el-dialog title="提现" :visible.sync="txVisible" @close="closeTx" width="600px">
  265. <el-form :model="txForm">
  266. <el-form-item label="提现地址" :label-width="formLabelWidth">
  267. <el-input v-model="txForm.address" type="text"></el-input>
  268. </el-form-item>
  269. <el-form-item label="提现金额" :label-width="formLabelWidth">
  270. <el-input v-model="txForm.withdraw_num" type="number"></el-input>
  271. </el-form-item>
  272. <el-form-item label="动态口令" :label-width="formLabelWidth" v-if="userInfo.is_binding == 1">
  273. <el-input v-model="txForm.code" type="number"></el-input>
  274. </el-form-item>
  275. </el-form>
  276. <div class="t-r">
  277. 到账: {{((txForm.withdraw_num*1 || 0)/(baseInfo.to_rmb*1)).toFixed(2)}}U
  278. </div>
  279. <div class="t-r">
  280. 当前余额: {{userInfo.money*1}}元
  281. </div>
  282. <div slot="footer" class="dialog-footer">
  283. <el-button @click="closeTx">取 消</el-button>
  284. <el-button type="primary" @click="goTx">确 定</el-button>
  285. </div>
  286. </el-dialog>
  287. <!-- 充值 -->
  288. <!-- <el-dialog title="充值" :visible.sync="czVisible" @close="closeCz" width="600px">
  289. <el-form :model="czForm">
  290. <el-form-item label="充值二维码" :label-width="formLabelWidth">
  291. <vueQrCode :size=qrCodeSize :text="qrCodeText"> </vueQrCode>
  292. </el-form-item>
  293. <el-form-item label="TRC20地址" :label-width="formLabelWidth">
  294. <div class="flex">
  295. <el-input v-model="qrCodeText" type="text" disabled></el-input>
  296. <el-button @click="onCopy(qrCodeText)" style="margin-left: 20px;">复制地址</el-button>
  297. </div>
  298. </el-form-item>
  299. <el-form-item label="充值凭证" :label-width="formLabelWidth">
  300. <el-upload class="avatar-uploader" action="http://www.pingguozhushou.shop/api/common/upload"
  301. :show-file-list="false" :headers="headers" :on-success="handleCzSuccess"
  302. :before-upload="beforeAvatarUpload">
  303. <img v-if="czForm.image" :src="czForm.image" class="czimg">
  304. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  305. </el-upload>
  306. </el-form-item>
  307. </el-form>
  308. </el-dialog> -->
  309. </div>
  310. </template>
  311. <script>
  312. import vueQrCode from "@/components/vueQrCode.vue";
  313. import {
  314. mapState,
  315. mapMutations
  316. } from 'vuex';
  317. import {
  318. setTransaction,
  319. getIndex
  320. } from '@/request/agent.js'
  321. import {
  322. setUserInfo,
  323. getUserInfo,
  324. rechange,
  325. withdrawal,
  326. transfer,
  327. getga,
  328. checkCode,
  329. payAuto,
  330. repwd,
  331. address,
  332. xfZh,
  333. getrecharge
  334. } from '@/request/user.js'
  335. import {
  336. showTime,
  337. timeComputed
  338. } from '@/assets/js/tools.js'
  339. export default {
  340. name: 'Order',
  341. components: {
  342. vueQrCode,
  343. },
  344. data() {
  345. return {
  346. time: {},
  347. timer: '',
  348. xfVisible: false,
  349. cztVisible: false,
  350. dtkl: '',
  351. xdVisible: false,
  352. images: '',
  353. qrCodeSize: 150,
  354. qrCodeText: '',
  355. headers: {},
  356. dtVisible: false,
  357. dtForm: {
  358. code: '',
  359. secret: ''
  360. },
  361. czVisible: false,
  362. czForm: {
  363. recharge_num: '',
  364. // image: ''
  365. },
  366. txVisible: false,
  367. txForm: {
  368. withdraw_num: '',
  369. address: '',
  370. code: ''
  371. },
  372. zzVisible: false,
  373. zzForm: {
  374. to_user_id: '',
  375. transfer_num: '',
  376. code: ''
  377. },
  378. jyVisible: false,
  379. jyForm: {
  380. newpassword: '',
  381. oldpassword: ''
  382. },
  383. dlVisible: false,
  384. dlForm: {
  385. newpassword: '',
  386. oldpassword: ''
  387. },
  388. adVisible: false,
  389. adForm: {
  390. address: '',
  391. code: ''
  392. },
  393. token: {},
  394. formLabelWidth: '120px',
  395. form: {
  396. avatar: '',
  397. id: '',
  398. nickname: '',
  399. username: ''
  400. },
  401. dialogTableVisible: false,
  402. queryInfo: {
  403. keyword: '',
  404. page: 1,
  405. limit: 10
  406. },
  407. list: [],
  408. total: 0,
  409. loading: false,
  410. czloading: false,
  411. txloading: false,
  412. zzloading: false,
  413. jyloading: false,
  414. dtloading: false,
  415. dlloading: false,
  416. adloading: false
  417. }
  418. },
  419. computed: {
  420. ...mapState(['userInfo', 'baseInfo'])
  421. },
  422. created() {
  423. console.log(this.userInfo);
  424. if (this.userInfo.address) {
  425. this.txForm.address = this.userInfo.address
  426. }
  427. this.headers['token'] = window.localStorage.getItem('token')
  428. this.form = {
  429. avatar: this.userInfo.avatar,
  430. id: this.userInfo.id,
  431. nickname: this.userInfo.nickname,
  432. username: this.userInfo.username
  433. }
  434. this.getIndex()
  435. this.getUserInfo()
  436. // this.getga()
  437. },
  438. methods: {
  439. showTime,
  440. ...mapMutations(['setUserInfo', 'setBaseInfo']),
  441. getInfo() {
  442. this.timer = null
  443. this.time = {}
  444. getrecharge(this.czForm).then(res => {
  445. console.log(res);
  446. this.czVisible = false
  447. this.cztVisible = true
  448. this.czForm = res.data
  449. this.qrCodeText = res.data.address
  450. if (this.timer) {
  451. clearInterval(this.timer)
  452. }
  453. this.timer = setInterval(() => {
  454. this.time = timeComputed(res.data.endtime * 1000)
  455. }, 1000)
  456. })
  457. },
  458. xfzh() {
  459. let that = this
  460. if (that.baseInfo.code_price * 1 > that.userInfo.money * 1) {
  461. return that.$msg.error('您的账号余额不足,请充值后操作')
  462. }
  463. xfZh().then(res => {
  464. that.$msg.success('续费成功')
  465. that.getUserInfo()
  466. that.xfVisible = false
  467. })
  468. },
  469. closeAd() {
  470. this.adVisible = false
  471. this.adForm.address = ''
  472. this.adForm.code = ''
  473. this.adloding = false
  474. },
  475. goAd() {
  476. let that = this
  477. if (!that.adForm.address) {
  478. return that.$msg.error('请输入地址')
  479. }
  480. address(that.adForm).then(res => {
  481. that.$msg.success('设置成功')
  482. that.closeAd()
  483. that.getUserInfo()
  484. that.adloding = false
  485. }).catch(err => {
  486. that.adloding = false
  487. })
  488. },
  489. ktAuto() {
  490. let that = this
  491. if (that.userInfo.money * 1 < that.baseInfo.auto_order * 1) {
  492. return that.$msg.error('您当前余额不足')
  493. }
  494. payAuto({
  495. code: that.dtkl
  496. }).then(res => {
  497. that.getUserInfo()
  498. that.xdVisible = false
  499. //自动下单启动
  500. })
  501. },
  502. getga() {
  503. getga().then(res => {
  504. console.log(res);
  505. this.dtForm.secret = res.data.secret
  506. this.images = res.data.qrCodeUrl
  507. this.dtVisible = true
  508. })
  509. },
  510. closeDt() {
  511. this.dtVisible = false
  512. this.dtForm.code = ''
  513. },
  514. goDt() {
  515. if (this.dtloading) {
  516. return
  517. }
  518. this.dtloading = true
  519. checkCode({
  520. code: this.dtForm.code
  521. }).then(res => {
  522. this.$msg.success('绑定成功')
  523. this.closeDt()
  524. this.dtloading = false
  525. }).then(err => {
  526. this.dtloading = false
  527. })
  528. },
  529. getIndex() {
  530. getIndex().then(res => {
  531. this.setBaseInfo(res.data)
  532. // this.qrCodeText = res.data.trc20
  533. })
  534. },
  535. //关闭设置交易密码
  536. closeJy() {
  537. this.jyVisible = false
  538. this.jyForm = {
  539. newpassword: '',
  540. oldpassword: ''
  541. }
  542. },
  543. goJy() {
  544. let that = this
  545. if (that.jyloading) {
  546. return
  547. }
  548. if (!that.jyForm.newpassword) {
  549. return that.$msg.error('请输入新交易密码')
  550. }
  551. setTransaction(that.jyForm).then(res => {
  552. that.$msg.success('交易密码设置成功')
  553. that.closeJy()
  554. that.jyloading = false
  555. }).catch(err => {
  556. that.jyloading = false
  557. })
  558. },
  559. //
  560. closeDl() {
  561. this.dlVisible = false
  562. this.dlForm = {
  563. newpassword: '',
  564. oldpassword: ''
  565. }
  566. },
  567. goDl() {
  568. let that = this
  569. if (that.dlloading) {
  570. return
  571. }
  572. if (!that.dlForm.newpassword) {
  573. return that.$msg.error('请输入旧登录密码')
  574. }
  575. if (!that.dlForm.newpassword) {
  576. return that.$msg.error('请输入新登录密码')
  577. }
  578. repwd(that.dlForm).then(res => {
  579. that.$msg.success('登录密码设置成功')
  580. that.closeDl()
  581. that.dlloading = false
  582. }).catch(err => {
  583. that.dlloading = false
  584. })
  585. },
  586. //关闭转账
  587. closeZz() {
  588. this.zzVisible = false
  589. this.zzForm = {
  590. to_user_id: '',
  591. transfer_num: '',
  592. code: ''
  593. }
  594. },
  595. goZz() {
  596. let that = this
  597. if (that.zzloading) {
  598. return
  599. }
  600. if (!that.zzForm.to_user_id) {
  601. return that.$msg.error('请输入收款人ID')
  602. }
  603. if (!that.zzForm.transfer_num) {
  604. return that.$msg.error('请输入转账金额')
  605. }
  606. if (that.userInfo.money < that.zzForm.transfer_num * 1) {
  607. return that.$msg.error('您的余额不足本次转账')
  608. }
  609. that.zzloading = true
  610. transfer(that.zzForm).then(res => {
  611. console.log(res);
  612. that.$msg.success('转账成功')
  613. that.zzloading = false
  614. that.closeZz()
  615. that.getUserInfo()
  616. }).catch(err => {
  617. that.zzloading = false
  618. })
  619. },
  620. //关闭提现
  621. closeTx() {
  622. this.txVisible = false
  623. this.txForm = {
  624. withdraw_num: '',
  625. address: '',
  626. code: ''
  627. }
  628. },
  629. goTx() {
  630. let that = this
  631. if (that.txloading) {
  632. return
  633. }
  634. if (!that.txForm.withdraw_num) {
  635. return that.$msg.error('请输入提现金额')
  636. }
  637. if (that.txForm.address == '') {
  638. return that.$msg.error('请输入提现地址')
  639. }
  640. if (that.userInfo.money * 1 < that.txForm.withdraw_num * 1) {
  641. return that.$msg.error('您当前账号的余额不足')
  642. }
  643. that.txloading = true
  644. withdrawal(that.txForm).then(res => {
  645. that.$msg.success('提交成功,请等待审核')
  646. that.txloading = false
  647. that.closeTx()
  648. that.getUserInfo()
  649. }).catch(err => {
  650. that.txloading = false
  651. })
  652. },
  653. //关闭充值
  654. closeCz() {
  655. this.czVisible = false
  656. this.czForm = {
  657. recharge_num: '',
  658. image: ''
  659. }
  660. },
  661. // 充值提交
  662. goCz() {
  663. let that = this
  664. if (that.czloading) {
  665. return
  666. }
  667. if (!that.czForm.recharge_num) {
  668. return that.$msg.error('请输入充值金额')
  669. }
  670. if (!that.czForm.image) {
  671. return that.$msg.error('请上传充值凭证')
  672. }
  673. that.czloading = true
  674. rechange(that.czForm).then(res => {
  675. that.$msg.success('提交成功,请等待审核')
  676. that.czVisible = false
  677. that.czloading = false
  678. that.closeCz()
  679. }).catch(err => {
  680. that.czloading = false
  681. })
  682. },
  683. handleAvatarSuccess(res, file) {
  684. this.form.avatar = res.data.fullurl;
  685. },
  686. handleCzSuccess(res, file) {
  687. this.czForm.image = res.data.fullurl;
  688. },
  689. beforeAvatarUpload(file) {
  690. // const isJPG = file.type === 'image/jpeg/png';
  691. // const isLt2M = file.size / 1024 / 1024 < 2;
  692. // if (!isJPG) {
  693. // this.$message.error('上传头像图片只能是 JPG 格式!');
  694. // }
  695. // if (!isLt2M) {
  696. // this.$message.error('上传头像图片大小不能超过 2MB!');
  697. // }
  698. // return isJPG && isLt2M;
  699. return true
  700. },
  701. handleAvatarError() {
  702. },
  703. openBuy() {
  704. this.dialogTableVisible = true
  705. },
  706. getUserInfo() {
  707. getUserInfo().then(res => {
  708. this.setUserInfo(res.data)
  709. this.qrCodeText = res.data.withdraw_trc_address
  710. })
  711. },
  712. setInfo() {
  713. let that = this
  714. if (that.form.avatar == '') {
  715. return that.$msg.error('请选择头像')
  716. }
  717. if (that.form.nickname == '') {
  718. return that.$msg.error('请选择输入昵称')
  719. }
  720. setUserInfo({
  721. avatar: that.form.avatar,
  722. nickname: that.form.nickname
  723. }).then(res => {
  724. that.$msg.success('修改成功')
  725. that.getUserInfo()
  726. })
  727. },
  728. handleSizeChange(newPageSize) {
  729. this.queryInfo.limit = newPageSize
  730. this.getList()
  731. },
  732. handleCurrentChange(newPageNum) {
  733. this.queryInfo.page = newPageNum
  734. this.getList()
  735. },
  736. onCopy(text) {
  737. this.$copyText(text).then(
  738. e => {
  739. console.log('复制成功:', e);
  740. },
  741. e => {
  742. console.log('复制失败:', e);
  743. }
  744. )
  745. }
  746. },
  747. }
  748. </script>
  749. <style scoped lang="scss">
  750. /*
  751. /deep/ .el-card__body {
  752. display: flex;
  753. justify-content: center;
  754. align-items: center;
  755. }
  756. .avatar-uploader .el-upload {
  757. border: 1px dashed #d9d9d9;
  758. border-radius: 6px;
  759. cursor: pointer;
  760. position: relative;
  761. overflow: hidden;
  762. }
  763. .avatar-uploader .el-upload:hover {
  764. border-color: #409EFF;
  765. }
  766. .avatar {
  767. width: 178px;
  768. height: 178px;
  769. display: block;
  770. } */
  771. .dialog-footer {
  772. display: flex;
  773. justify-content: flex-end;
  774. // width: 500px;
  775. }
  776. .avatar-uploader-icon {
  777. font-size: 28px;
  778. color: #8c939d;
  779. width: 178px;
  780. height: 178px;
  781. line-height: 178px;
  782. text-align: center;
  783. border: 1px dashed #d9d9d9;
  784. border-radius: 10px;
  785. }
  786. .user-wrap {
  787. width: 700px;
  788. background-color: #fff;
  789. margin: auto;
  790. .u-item {
  791. padding: 10px 15px;
  792. justify-content: space-between;
  793. align-items: flex-start;
  794. border-bottom: 1px solid #f0f0f0;
  795. .base {
  796. padding: 12px 0;
  797. }
  798. }
  799. }
  800. .t-r {
  801. text-align: right;
  802. padding-top: 10px;
  803. }
  804. .czimg {
  805. width: 178px;
  806. height: 178px;
  807. }
  808. .biaoti {
  809. font-size: 18px;
  810. color: #000;
  811. font-weight: bold;
  812. padding: 20px 0;
  813. }
  814. </style>