index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <view :data-theme="theme">
  3. <view class='my-account mb-40rpx pt-20 relative'>
  4. <!-- #ifdef MP -->
  5. <view class="relative">
  6. <nav-bar :isBackgroundColor="false" ref="navBarRef" navTitle='我的账户' :isShowMenu="false" :backgroundColor="backgroundColor">
  7. </nav-bar>
  8. </view>
  9. <!-- #endif -->
  10. <view class='wrapper borderPad'>
  11. <!-- 新版头部 -->
  12. <view class="new-header">
  13. <!-- 顶部:实时汇率 -->
  14. <!--
  15. <view class="rate-card-top">
  16. <view style="
  17. background: linear-gradient(to top, rgb(255, 107, 159,0.3), rgb(255, 255, 255,0.25));
  18. border-radius: 10px;
  19. padding: 20rpx 20rpx;
  20. ">
  21. <view class="rate-title-row">
  22. <view class="title xuxian">实时汇率</view>
  23. <view class="refresh-icon" @click="refreshRate">
  24. <text class="iconfont icon-shuaxin1"></text>
  25. </view>
  26. </view>
  27. <view class="rate-content">
  28. <view class="rate-info">
  29. <view class="rate-row">
  30. <text class="label">sLGNS:</text>
  31. <text class="value">¥{{globalData.daibiRateLgnsCny || '0.00'}}</text>
  32. </view>
  33. </view>
  34. <view class="coin-img">
  35. <image src="/static/tabBar/2026-01-29_145708_158.png" mode="aspectFit"></image>
  36. </view>
  37. </view>
  38. </view>
  39. </view>-->
  40. <!-- 底部:余额信息 -->
  41. <view class="rate-card-bottom">
  42. <view class="balance-main">
  43. <!-- 去掉RMB显示
  44. <view class="balance-item border-right">
  45. <view class="label">账户余额(元)</view>
  46. <view class="num">{{parseFloat((statistics.nowMoney * rate).toFixed(2)) || '0.00'}}</view>
  47. <view class="btn" v-if="statistics.rechargeSwitch" @click="openSubscribe('/pages/users/user_payment/index')">充值</view>
  48. </view>
  49. -->
  50. <view class="balance-item">
  51. <view class="label">sLGNS余额</view>
  52. <view class="num">{{statistics.nowMoney || 0}}</view>
  53. <view style="display: flex">
  54. <view class="btn" style="margin-right: 50rpx;" v-if="statistics.rechargeSwitch" @click="openSubscribe('/pages/users/user_payment/index')">充值</view>
  55. <view class="btn btn-outline" :class="{disabled: !withdrawNumber.status}" @click="onWithdrawClick">提现</view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="withdraw-tip">
  60. 7天只能3次提现已用({{withdrawNumber.dailyCountAgo}}),今天只能2次提现已用({{withdrawNumber.dailyCount}})
  61. </view>
  62. <view class="balance-sub">
  63. <view class="sub-item">
  64. <text class="sub-label">余额充值(sL)</text>
  65. <text class="sub-value">{{statistics.recharge || '0.00'}}</text>
  66. </view>
  67. <view class="sub-item">
  68. <text class="sub-label">余额消费(sL)</text>
  69. <text class="sub-value">{{statistics.monetary || '0.00'}}</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class='nav acea-row row-between-wrapper mt20'>
  75. <navigator class='item acea-row row-between-wrapper' hover-class='none' url='/pages/users/user_bill/index?type=expenditure'>
  76. <view class="left">
  77. <view class="name">消费记录</view>
  78. <view>赚积分抵现金</view>
  79. </view>
  80. <view class="pictrue">
  81. <image src="../static/images/xiaofeijilu.png"></image>
  82. </view>
  83. </navigator>
  84. <navigator v-if="statistics.rechargeSwitch" class='item acea-row row-between-wrapper' hover-class='none' url='/pages/users/user_bill/index?type=recharge'>
  85. <view class="left">
  86. <view class="name">充值记录</view>
  87. <view>满减享优惠</view>
  88. </view>
  89. <view class="pictrue">
  90. <image src="../static/images/chongzhijilu.png"></image>
  91. </view>
  92. </navigator>
  93. </view>
  94. </view>
  95. </view>
  96. <recommend ref="recommendIndex" @getRecommendLength="getRecommendLength"></recommend>
  97. <view class='noCommodity' v-if="isNoCommodity">
  98. <view class='pictrue'>
  99. <image :src="urlDomain+'crmebimage/presets/noShopper.png'"></image>
  100. </view>
  101. <text class="text-ccc">暂无商品</text>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. // +----------------------------------------------------------------------
  107. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  108. // +----------------------------------------------------------------------
  109. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  110. // +----------------------------------------------------------------------
  111. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  112. // +----------------------------------------------------------------------
  113. // | Author: CRMEB Team <admin@crmeb.com>
  114. // +----------------------------------------------------------------------
  115. import {
  116. getMyAccountApi,
  117. getPaymentUserNumber
  118. } from '@/api/user.js';
  119. import {
  120. toLogin
  121. } from '@/libs/login.js';
  122. import {
  123. mapGetters
  124. } from "vuex";
  125. import {
  126. alipayQueryPayResult
  127. } from '@/api/order.js';
  128. import recommend from "@/components/base/recommend.vue";
  129. import navBar from '@/components/navBar';
  130. import {rmbToLgns,getRmbToLgnsRate} from "@/utils";
  131. let app = getApp();
  132. export default {
  133. components: {
  134. recommend,
  135. navBar
  136. },
  137. data() {
  138. return {
  139. urlDomain: this.$Cache.get("imgHost"),
  140. isClose: false,
  141. activity: {},
  142. hotScroll: false,
  143. statistics: {},
  144. hotPage: 1,
  145. rate: 0,
  146. hotLimit: 10,
  147. withdrawNumber: {},
  148. theme: app.globalData.theme,
  149. isNoCommodity: false,
  150. backgroundColor: '',
  151. rechargeSwitch: false, // 充值开关
  152. };
  153. },
  154. computed: mapGetters(['isLogin', 'userInfo', 'globalData']),
  155. watch: {
  156. isLogin: {
  157. handler: function(newV, oldV) {
  158. if (newV) {
  159. this.userDalance();
  160. }
  161. },
  162. deep: true
  163. }
  164. },
  165. onLoad() {
  166. if (this.isLogin) {
  167. // #ifdef H5
  168. var url = window.location.search;
  169. if (url) {
  170. var theRequest = new Object();
  171. if (url.indexOf("?") != -1) {
  172. var str = url.substr(1);
  173. var strs = str.split("&");
  174. for (var i = 0; i < strs.length; i++) {
  175. theRequest[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
  176. }
  177. }
  178. this.orderId = theRequest.out_trade_no; //返回的订单号
  179. this.alipayQueryPay();
  180. }
  181. // #endif
  182. this.userDalance();
  183. } else {
  184. toLogin();
  185. }
  186. },
  187. onReachBottom() {
  188. this.$refs.recommendIndex.get_host_product();
  189. },
  190. // 滚动监听
  191. onPageScroll(e) {
  192. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  193. uni.$emit('scroll');
  194. // #ifdef MP
  195. if (e.scrollTop > 50) {
  196. this.backgroundColor = '#fff';
  197. this.iconColor = '#333333'
  198. } else if (e.scrollTop < 50) {
  199. this.backgroundColor = '';
  200. this.iconColor = '#fff'
  201. }
  202. // #endif
  203. },
  204. methods: {
  205. rmbToLgns(e) {
  206. return rmbToLgns(e,"floor");
  207. },
  208. getRecommendLength(e) {
  209. this.isNoCommodity = e == 0 ? true : false;
  210. },
  211. /**
  212. * 支付宝充值结果查询
  213. */
  214. alipayQueryPay() {
  215. uni.showLoading({
  216. title: '查询中...'
  217. });
  218. alipayQueryPayResult(this.orderId).then(res => {
  219. this.userDalance();
  220. return this.$util.Tips({
  221. title: '充值成功'
  222. });
  223. uni.hideLoading();
  224. }).catch(err => {
  225. uni.hideLoading();
  226. return this.$util.Tips({
  227. title: err
  228. });
  229. })
  230. },
  231. userDalance() {
  232. getMyAccountApi().then(res => {
  233. this.rate = getRmbToLgnsRate();
  234. this.statistics = res.data;
  235. console.log(this.statistics)
  236. })
  237. // 调用测试接口并打印
  238. getPaymentUserNumber().then(res => {
  239. this.withdrawNumber = res.data;
  240. });
  241. },
  242. openSubscribe(page) {
  243. uni.navigateTo({
  244. url: page,
  245. });
  246. },
  247. onWithdrawClick() {
  248. if (!this.withdrawNumber.status) return this.$util.Tips({title: '当前暂时无法提现'});
  249. this.openSubscribe('/pages/users/user_withd_slgns/index?lgns=' + this.statistics.nowMoney);
  250. }
  251. }
  252. }
  253. </script>
  254. <style scoped lang="scss">
  255. .btn.disabled {
  256. opacity: 0.5;
  257. background: rgba(255, 255, 255, 0.1) !important;
  258. border-color: rgba(255, 255, 255, 0.3) !important;
  259. color: rgba(255, 255, 255, 0.6) !important;
  260. pointer-events: none; // 禁止点击
  261. }
  262. .my-account{
  263. @include shallow-gradient(theme);
  264. }
  265. /* 新版UI样式 */
  266. .new-header {
  267. width: 100%;
  268. margin: 0 auto;
  269. color: #fff;
  270. filter: drop-shadow(0 4rpx 10rpx rgba(255, 77, 140, 0.3));
  271. }
  272. .rate-card-top {
  273. // 上半部分渐变:根据图示调整为更亮的粉色渐变
  274. background: linear-gradient(90deg, #ff6b9f 0%, #FF4D8C 100%);
  275. border-radius: 24rpx 24rpx 24rpx 24rpx; // 上部卡片其实也可以全圆角,看起来是两张卡叠在一起
  276. padding: 25rpx 25rpx 25rpx 25rpx;
  277. position: relative;
  278. z-index: 2;
  279. margin-bottom: 20rpx; // 给中间螺旋效果留空隙,或者实际上是紧贴的但通过z-index处理
  280. margin-bottom: 14rpx; // 微调间距适应螺旋
  281. }
  282. .rate-title-row {
  283. display: flex;
  284. justify-content: space-between;
  285. align-items: center;
  286. margin-bottom: 24rpx;
  287. .title {
  288. font-size: 30rpx;
  289. font-weight: bold;
  290. padding-bottom: 4rpx;
  291. display: inline-block;
  292. letter-spacing: 1px;
  293. }
  294. .refresh-icon {
  295. width: 40rpx;
  296. height: 40rpx;
  297. display: flex;
  298. align-items: center;
  299. justify-content: center;
  300. .iconfont {
  301. font-size: 34rpx;
  302. font-weight: bold;
  303. }
  304. }
  305. }
  306. .rate-content {
  307. display: flex;
  308. justify-content: space-between;
  309. align-items: flex-start;
  310. position: relative;
  311. .rate-info {
  312. flex: 1;
  313. z-index: 2;
  314. }
  315. .rate-row {
  316. display: flex;
  317. align-items: center;
  318. font-size: 26rpx;
  319. margin-bottom: 14rpx;
  320. line-height: 1.2;
  321. .label {
  322. width: 100rpx;
  323. font-size: 30rpx;
  324. opacity: 0.85;
  325. font-weight: 100;
  326. }
  327. .value {
  328. margin: 0 6rpx 0 20rpx; // value紧跟label后,还是有固定间距,看图是靠左
  329. font-size: 30rpx;
  330. min-width: 100rpx;
  331. font-weight: 300;
  332. }
  333. .percent {
  334. font-weight: 300;
  335. font-size: 30rpx;
  336. margin-right: 4rpx;
  337. &.up { color: #fff; }
  338. &.down { color: #fff; }
  339. }
  340. .trend-icon {
  341. width: 24rpx;
  342. height: 24rpx;
  343. margin-top: 4rpx;
  344. margin-left: 6rpx;
  345. }
  346. .icon-up { display: inline-block; }
  347. .icon-down { display: inline-block; }
  348. }
  349. .coin-img {
  350. width: 160rpx;
  351. height: 140rpx;
  352. position: absolute;
  353. right: 0;
  354. top: -80rpx;
  355. z-index: 1;
  356. image {
  357. width: 100%;
  358. height: 100%;
  359. }
  360. }
  361. }
  362. // 螺旋视觉效果容器
  363. .spiral-binding {
  364. position: absolute;
  365. bottom: -24rpx; // 调整位置以连接上下两部分
  366. left: 0;
  367. width: 100%;
  368. height: 48rpx;
  369. display: flex;
  370. justify-content: center;
  371. align-items: center;
  372. z-index: 10;
  373. image {
  374. width: 92%; // 根据实际图片宽度微调,留一点边距看起来更自然
  375. height: 100%;
  376. }
  377. }
  378. .rate-card-bottom {
  379. // 下半部分渐变:稍微红一点
  380. background: linear-gradient(135deg, #FF79A8 0%, #FF5993 100%);
  381. border-radius: 24rpx 24rpx 24rpx 24rpx;
  382. position: relative;
  383. z-index: 1;
  384. display: flex;
  385. flex-direction: column;
  386. justify-content: space-between;
  387. min-height: 340rpx; // 保证高度一致
  388. }
  389. .balance-main {
  390. display: flex;
  391. align-items: center;
  392. padding: 30rpx 0 20rpx 0;
  393. flex: 1;
  394. .balance-item {
  395. flex: 1;
  396. text-align: center;
  397. position: relative;
  398. display: flex;
  399. flex-direction: column;
  400. align-items: center;
  401. // 中间分割线
  402. &.border-right::after {
  403. content: '';
  404. position: absolute;
  405. right: 0;
  406. top: 50%;
  407. transform: translateY(-50%);
  408. height: 60rpx;
  409. width: 2rpx;
  410. background: rgba(255,255,255,0.2);
  411. }
  412. .label {
  413. font-size: 30rpx;
  414. opacity: 0.8;
  415. margin-bottom: 10rpx;
  416. font-weight: 100;
  417. }
  418. .num {
  419. font-size: 45rpx; // 金额大号字体
  420. font-weight: bold;
  421. // font-family: 'DIN', sans-serif; // 如果有数字字体
  422. margin-bottom: 24rpx;
  423. text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.05);
  424. }
  425. .btn {
  426. width: 200rpx;
  427. height: 60rpx;
  428. line-height: 56rpx; // 扣除border
  429. border-radius: 34rpx;
  430. border: 2rpx solid #fff;
  431. font-size: 28rpx;
  432. text-align: center;
  433. background: rgba(255,255,255,0.15);
  434. backdrop-filter: blur(4rpx);
  435. box-sizing: border-box;
  436. &.btn-outline {
  437. background: rgba(255,255,255,0.15); // 统一样式
  438. }
  439. &:active {
  440. opacity: 0.8;
  441. transform: scale(0.98);
  442. }
  443. }
  444. }
  445. }
  446. .withdraw-tip {
  447. text-align: center;
  448. color: rgba(255, 255, 255, 0.8); // 颜色淡一点
  449. font-size: 24rpx;
  450. font-weight: 300; // 细体
  451. margin-bottom: 20rpx;
  452. letter-spacing: 1px;
  453. }
  454. .balance-sub {
  455. display: flex;
  456. justify-content: space-between;
  457. align-items: center;
  458. background: rgba(0, 0, 0, 0.05); // 底部深色条
  459. padding: 24rpx 40rpx;
  460. border-radius: 0 0 24rpx 24rpx; // 仅底部圆角
  461. .sub-item {
  462. font-size: 24rpx;
  463. display: flex;
  464. align-items: center;
  465. .sub-label {
  466. opacity: 0.9;
  467. margin-right: 20rpx;
  468. font-weight: 100;
  469. font-size: 28rpx;
  470. }
  471. .sub-value {
  472. font-weight: 500;
  473. font-size: 28rpx;
  474. }
  475. }
  476. }
  477. .my-account .wrapper .nav .item {
  478. font-size: 24rpx;
  479. color: #999;
  480. width: 342rpx;
  481. height: 152rpx;
  482. background: linear-gradient(180deg, #FFF7F0 0%, #FFFFFF 100%);
  483. border-radius: 24rpx;
  484. border: 4rpx solid #fff;
  485. padding: 0 31rpx;
  486. box-sizing: border-box;
  487. .name{
  488. font-size: 28rpx;
  489. color: #333;
  490. font-weight: 500;
  491. margin-bottom: 8rpx;
  492. }
  493. }
  494. .my-account .wrapper .nav .item .pictrue {
  495. width: 96rpx;
  496. height: 96rpx;
  497. image{
  498. width: 100%;
  499. height: 100%;
  500. }
  501. }
  502. </style>