index.vue 12 KB

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