index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <template>
  2. <view class="container">
  3. <view class="top flex">
  4. <view class="icon1 flex" @click="openurl('/pages/user/set/set')">
  5. <image src="/static/image/img01.png" style="width: 139rpx;height: 55rpx;" mode="widthFix"></image>
  6. <view class="myName">我的</view>
  7. </view>
  8. <!-- #ifdef APP -->
  9. <view class="flex" @click="saoma">
  10. <image src="/static/image/img03.png" style="width: 39rpx;height: 36rpx;" mode="widthFix"></image>
  11. <!-- <image src="/static/image/img02.png" style="width: 39rpx;height: 40rpx;" mode="widthFix"></image> -->
  12. </view>
  13. <!-- #endif -->
  14. </view>
  15. <view class="swiper-box">
  16. <u-swiper :list="swiperList" indicator indicatorMode="line" height="280rpx" circular></u-swiper>
  17. </view>
  18. <!-- <view class="flex noteBox">
  19. <view class="flex_item noteTpl">
  20. <image src="/static/image/img04.png" style="width: 42rpx;height: 34rpx;" mode="widthFix"></image>
  21. <view class="clamp textTpl">上线活动的公告等等公告内容上线活动的公告等等公告内容等上线活动的公告等等公告内容等</view>
  22. </view>
  23. <view class="tip"></view>
  24. </view> -->
  25. <view class="flex navList">
  26. <view class="navTpl" @click="openurl('/pages/index/recharge')">
  27. <image src="/static/image/img06.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  28. <view class="navName">充值</view>
  29. </view>
  30. <!-- <view class="navTpl" @click="openurl('/pages/index/personal')">
  31. <image src="/static/image/img07.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  32. <view class="navName">实名认证</view>
  33. </view> -->
  34. <view class="navTpl" @click="openurl('/pages/user/set/transaction')">
  35. <image src="/static/image/img08.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  36. <view class="navName">交易密码</view>
  37. </view>
  38. <view class="navTpl" @click="openurl('/pages/user/set/bindBank')">
  39. <image src="/static/image/img09.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  40. <view class="navName">收款信息</view>
  41. </view>
  42. <view class="navTpl" @click="openKf">
  43. <image src="/static/image/img10.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  44. <view class="navName">联系客服</view>
  45. </view>
  46. </view>
  47. <view class="starBox flex">
  48. <view class="starTpl flex_item">
  49. <image src="/static/image/img12.png" style="width: 75rpx;height: 75rpx;" mode="widthFix"></image>
  50. <view class="starText">
  51. <view class="name">okx(欧易)</view>
  52. <view class="num">{{baseData.ok_price}}</view>
  53. </view>
  54. </view>
  55. <view class="starTpl flex_item">
  56. <image src="/static/image/img13.png" style="width: 75rpx;height: 75rpx;" mode="widthFix"></image>
  57. <view class="starText">
  58. <view class="name">STAR(星空)</view>
  59. <view class="num">{{baseData.us_price}}</view>
  60. </view>
  61. </view>
  62. </view>
  63. <navigator open-type='switchTab' url="/pages/index/pledge">
  64. <image src="/static/image/img11.png" style="width: 692rpx;padding-top: 31rpx;height: 179rpx;" mode="widthFix"></image>
  65. </navigator>
  66. <!-- <view class="titleBox">
  67. <view class="titleTip">累计成交量</view>
  68. </view> -->
  69. <view class="flex totalBox">
  70. <view class="totalTpl">
  71. <view class="totalNum">{{baseData.success_num||0}}</view>
  72. <view class="totalName">24小时成交量(U)</view>
  73. </view>
  74. <view class="totalTpl">
  75. <view class="totalNum">{{baseData.success_order||0}}</view>
  76. <view class="totalName">24小时成单量</view>
  77. </view>
  78. <view class="totalTpl">
  79. <view class="totalNum">{{baseData.success_ratio||0}}</view>
  80. <view class="totalName">交易成功率</view>
  81. </view>
  82. </view>
  83. <view class="titleBox">
  84. <view class="titleTip">平台优势</view>
  85. </view>
  86. <view class="advantageBox flex">
  87. <view class="advantageTpl">
  88. <image src="/static/image/img16.png" style="width:149rpx;height: 127rpx;" mode="widthFix"></image>
  89. <view class="advantageName">简单</view>
  90. </view>
  91. <view class="advantageTpl">
  92. <image src="/static/image/img15.png" style="width:149rpx;height: 127rpx;" mode="widthFix"></image>
  93. <view class="advantageName">安全</view>
  94. </view>
  95. <view class="advantageTpl">
  96. <image src="/static/image/img14.png" style="width:149rpx;height: 127rpx;" mode="widthFix"></image>
  97. <view class="advantageName">省心</view>
  98. </view>
  99. <view class="advantageTpl">
  100. <image src="/static/image/img17.png" style="width:149rpx;height: 127rpx;" mode="widthFix"></image>
  101. <view class="advantageName">极速</view>
  102. </view>
  103. </view>
  104. <uni-popup
  105. ref="popupkf"
  106. type="center">
  107. <view class="popup-box">
  108. <view class="img">
  109. <image
  110. src="/static/image/img24.png"
  111. mode=""></image>
  112. </view>
  113. <view class="mian">
  114. <view class="delivery">
  115. <view class="title">已经为您定制专属客服</view>
  116. <image
  117. src="/static/image/img25.png"
  118. mode=""></image>
  119. </view>
  120. <view class="nocancel">客服VX:{{ kefu }}</view>
  121. <view class="comfirm-box">
  122. <view
  123. class="cancel"
  124. @click="cancel"
  125. >取消</view
  126. >
  127. <view
  128. class="comfirm"
  129. @click="comfirm(kefu)"
  130. >复制微信</view
  131. >
  132. </view>
  133. </view>
  134. </view>
  135. </uni-popup>
  136. </view>
  137. </template>
  138. <script>
  139. import {
  140. getIndex
  141. } from '@/api/index.js';
  142. import {
  143. saveUrl,
  144. interceptor
  145. } from '@/utils/loginUtils.js';
  146. import {
  147. mapState,
  148. mapActions,
  149. mapMutations
  150. } from "vuex";
  151. export default {
  152. data() {
  153. return {
  154. gameList: [],
  155. active_user: '0',
  156. swiperList:['/static/image/img05.png'],
  157. kefu:'ch125221',
  158. baseData:{
  159. ok_price:0,
  160. us_price:0
  161. }
  162. }
  163. },
  164. computed: {
  165. ...mapState({
  166. langList: "langList",
  167. lang: "lang",
  168. }),
  169. ...mapState('user', ['userInfo','hasLogin']),
  170. label() {
  171. const label = this.langList.find((item) => {
  172. console.log(this.lang, item.value);
  173. return item.value == this.lang
  174. }).label;
  175. return label
  176. }
  177. },
  178. onLoad(option) {
  179. // #ifndef MP
  180. if (option.spread) {
  181. // 存储其他邀请人
  182. uni.setStorageSync('spread', option.spread);
  183. }
  184. // #endif
  185. // #ifdef MP
  186. if (option.scene) {
  187. // 存储小程序邀请人
  188. uni.setStorage({
  189. key: 'spread_code',
  190. data: option.scene
  191. });
  192. }
  193. // #endif
  194. },
  195. onShow() {
  196. this.loadData();
  197. },
  198. methods: {
  199. ...mapActions({
  200. setLang: "setLang",
  201. }),
  202. openurl(url){
  203. if(!this.hasLogin){
  204. saveUrl();
  205. interceptor();
  206. return
  207. }
  208. uni.navigateTo({
  209. url: url,
  210. fail: (err) => {
  211. uni.showModal({
  212. title: '错误',
  213. content: err,
  214. showCancel: false,
  215. });
  216. }
  217. });
  218. },
  219. saoma(){
  220. uni.scanCode({
  221. success(data) {
  222. let res = data.result
  223. // uni.navigateTo({
  224. // url: res
  225. // })
  226. window.location.href = res;
  227. },
  228. fail(e) {
  229. console.log(JSON.stringify(e));
  230. console.log("扫码失败");
  231. },
  232. });
  233. },
  234. // 打开客服
  235. openKf() {
  236. this.$refs.popupkf.open();
  237. },
  238. // 关闭客服
  239. cancel() {
  240. this.$refs.popupkf.close();
  241. },
  242. // 请求载入数据
  243. async loadData() {
  244. getIndex({})
  245. .then(({
  246. data
  247. }) => {
  248. this.active_user = data.active_user
  249. this.baseData = data;
  250. console.log(data);
  251. })
  252. .catch(e => {});
  253. },
  254. comfirm(text) {
  255. console.log(text);
  256. const result = this.uniCopy(text);
  257. if (result === false) {
  258. uni.showToast({
  259. title: "不支持",
  260. });
  261. } else {
  262. uni.showToast({
  263. title: "复制成功",
  264. icon: "none",
  265. });
  266. }
  267. this.$refs.popupkf.close();
  268. },
  269. uniCopy(content) {
  270. /**
  271. * 小程序端 和 app端的复制逻辑
  272. */
  273. //#ifndef H5
  274. uni.setClipboardData({
  275. data: content,
  276. success: function () {
  277. console.log("success");
  278. return true;
  279. },
  280. });
  281. //#endif
  282. /**
  283. * H5端的复制逻辑
  284. */
  285. // #ifdef H5
  286. if (!document.queryCommandSupported("copy")) {
  287. //为了兼容有些浏览器 queryCommandSupported 的判断
  288. // 不支持
  289. return false;
  290. }
  291. let textarea = document.createElement("textarea");
  292. textarea.value = content;
  293. textarea.readOnly = "readOnly";
  294. document.body.appendChild(textarea);
  295. textarea.select(); // 选择对象
  296. textarea.setSelectionRange(0, content.length); //核心
  297. let result = document.execCommand("copy"); // 执行浏览器复制命令
  298. textarea.remove();
  299. return result;
  300. // #endif
  301. },
  302. },
  303. }
  304. </script>
  305. <style lang="scss">
  306. .container {
  307. width: 100%;
  308. background-color: #051137;
  309. padding: 0rpx 30rpx;
  310. padding-top: calc(60px + var(--status-bar-height));
  311. padding-bottom: 50rpx;
  312. }
  313. .top {
  314. font-weight: 500;
  315. padding: 40rpx 30rpx 24rpx 30rpx;
  316. line-height: 1;
  317. position: fixed;
  318. top: var(--status-bar-height);
  319. left: 0;
  320. width: 100%;
  321. background: #051137;
  322. z-index: 99;
  323. .icon1 {
  324. line-height: 0;
  325. position: relative;
  326. .myName{
  327. position: absolute;
  328. right: 22rpx;
  329. font-weight: 500;
  330. font-size: 24rpx;
  331. color: #2884FF;
  332. }
  333. }
  334. }
  335. .noteBox{
  336. padding: 46rpx 0rpx;
  337. .noteTpl{
  338. color: #fff;
  339. width: 85%;
  340. .textTpl{
  341. width: calc(100% - 42rpx);
  342. font-family: PingFang SC;
  343. font-weight: 500;
  344. font-size: 26rpx;
  345. color: #FFFFFF;
  346. padding-left: 30rpx;
  347. }
  348. }
  349. .tip{
  350. width: 12rpx;
  351. height: 12rpx;
  352. background: #F7453D;
  353. border-radius: 100%;
  354. }
  355. }
  356. .navList{
  357. text-align: center;
  358. padding:15rpx 0rpx;
  359. .navTpl{
  360. .navName{
  361. padding-top: 23rpx;
  362. font-family: PingFang SC;
  363. font-weight: 500;
  364. font-size: 26rpx;
  365. color: #FFFFFF;
  366. }
  367. }
  368. }
  369. .starBox{
  370. padding-top: 43rpx;
  371. .starTpl{
  372. width: 48%;
  373. background: #1F2A4A;
  374. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50,50,52,0.06);
  375. border-radius: 20rpx;
  376. padding: 20rpx 18rpx;
  377. .starText{
  378. padding-left: 25rpx;
  379. .name{
  380. font-family: PingFang SC;
  381. font-weight: 500;
  382. font-size: 22rpx;
  383. color: #FFFFFF;
  384. line-height: 24rpx;
  385. }
  386. .num{
  387. padding-top: 15rpx;
  388. font-family: PingFang SC;
  389. font-weight: bold;
  390. font-size: 30rpx;
  391. color: #FFA235;
  392. line-height: 24rpx;
  393. }
  394. }
  395. }
  396. }
  397. .titleBox{
  398. text-align: center;
  399. padding: 45rpx 0rpx;
  400. .titleTip{
  401. flex: 1;
  402. display: flex;
  403. justify-content: center;
  404. align-items: center;
  405. height: 100%;
  406. position: relative;
  407. font-weight: bold;
  408. font-size: 42rpx;
  409. color: #FFFFFF;
  410. line-height: 110rpx;
  411. &:after {
  412. content: '';
  413. position: absolute;
  414. left: 50%;
  415. bottom: 0;
  416. transform: translateX(-50%);
  417. width: 44px;
  418. height: 0;
  419. border-bottom: 3px solid #FFFFFF;
  420. border-radius: 25rpx;
  421. }
  422. }
  423. }
  424. .totalBox{
  425. padding-top: 30rpx;
  426. .totalTpl{
  427. width: 45%;
  428. text-align: center;
  429. padding: 45rpx 0rpx;
  430. .totalNum{
  431. font-family: FZCuHeiSongS-B-GB;
  432. font-weight: 400;
  433. font-size: 39rpx;
  434. color: #66FFFF;
  435. text{
  436. font-family: PingFang SC;
  437. font-weight: 500;
  438. font-size: 22rpx;
  439. color: #66FFFF;
  440. }
  441. }
  442. .totalName{
  443. padding-top: 20rpx;
  444. font-family: Source Han Sans CN;
  445. font-weight: bold;
  446. font-size: 26rpx;
  447. color: #FFFFFF;
  448. }
  449. }
  450. }
  451. .advantageBox{
  452. padding-top: 50rpx;
  453. .advantageTpl{
  454. text-align: center;
  455. .advantageName{
  456. padding-top: 25rpx;
  457. font-family: PingFang SC;
  458. font-weight: 500;
  459. font-size: 28rpx;
  460. color: #FFFFFF;
  461. }
  462. }
  463. }
  464. .popup-box {
  465. width: 522rpx;
  466. height: 605rpx;
  467. background-color: #ffffff;
  468. border-radius: 20rpx;
  469. position: relative;
  470. .img {
  471. position: relative;
  472. top: -56rpx;
  473. left: 0;
  474. width: 522rpx;
  475. height: 132rpx;
  476. display: flex;
  477. justify-content: center;
  478. image {
  479. border-radius: 20rpx 20rpx 0 0;
  480. width: 450rpx;
  481. height: 132rpx;
  482. }
  483. }
  484. .mian {
  485. margin-top: -44rpx;
  486. display: flex;
  487. flex-direction: column;
  488. align-items: center;
  489. // padding: 32rpx 32rpx;
  490. background-color: #ffffff;
  491. border-radius: 0 0 20rpx 20rpx;
  492. text-align: center;
  493. .delivery {
  494. font-size: 40rpx;
  495. color: #333333;
  496. display: flex;
  497. align-items: center;
  498. flex-direction: column;
  499. .title {
  500. }
  501. image {
  502. margin-top: 48rpx;
  503. width: 172rpx;
  504. height: 160rpx;
  505. }
  506. }
  507. .nocancel {
  508. font-size: 32rpx;
  509. color: #333333;
  510. margin-top: 14rpx;
  511. }
  512. .comfirm-box {
  513. margin-top: 52rpx;
  514. display: flex;
  515. // margin-bottom: 32rpx;
  516. // justify-content: space-around;
  517. .cancel {
  518. display: flex;
  519. align-items: center;
  520. justify-content: center;
  521. width: 197rpx;
  522. height: 74rpx;
  523. border: 1px solid #dcc786;
  524. border-radius: 38rpx;
  525. font-size: 32rpx;
  526. color: #605128;
  527. }
  528. .comfirm {
  529. margin-left: 32rpx;
  530. display: flex;
  531. align-items: center;
  532. justify-content: center;
  533. width: 197rpx;
  534. height: 74rpx;
  535. background: linear-gradient(
  536. -90deg,
  537. #d1ba77 0%,
  538. #f7e8ad 100%
  539. );
  540. border-radius: 38px;
  541. font-size: 32rpx;
  542. color: #605128;
  543. }
  544. }
  545. }
  546. }
  547. </style>