pointsMall.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <template>
  2. <view>
  3. <view class="top-cont">
  4. <!-- 背景图片 -->
  5. <!-- <image class="bg" src="../../static/images/user/jifen_bg.png" mode=""></image> -->
  6. <view class="top-inner" style="background-image: url('https://user.test.ylrztop.com/images/jifen_bg.png')">
  7. <!-- 这里是状态栏 -->
  8. <view class="fixed-top-box" :style="{ background: bg }">
  9. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  10. <view class="back-box" @click="back">
  11. <image src="../../static/images/back.png" mode=""></image>
  12. <text class="title">积分商城</text>
  13. <text></text>
  14. </view>
  15. </view>
  16. <!-- 顶部固定后站位元素 -->
  17. <view style="padding-bottom: 88upx;">
  18. <view :style="{height: statusBarHeight}"></view>
  19. </view>
  20. <!-- 可用积分 -->
  21. <!-- <view class="available-points">
  22. <text class="label">可用积分</text>
  23. <text class="num">{{integral}}</text>
  24. </view> -->
  25. <!-- 签到 -->
  26. <view class="singn-content">
  27. <view class="sign-in-box">
  28. <view class="inner">
  29. <view class="top-box">
  30. <view class="left">
  31. <view class="align-center">
  32. <image class="w32 h32" src="../../static/images/user/jifen_icon.png" mode=""></image>
  33. <text>我的积分</text>
  34. </view>
  35. <view class="num">{{integral}}</view>
  36. </view>
  37. <view class="guize">积分规则</view>
  38. </view>
  39. <view class="bottom-box">
  40. <view class="ttbg"></view>
  41. <view class="align-center justify-between h100">
  42. <view class="t-left">
  43. <image src="../../static/images/user/points_details_icon.png" mode=""></image>
  44. <view>积分明细</view>
  45. </view>
  46. <view class="t-right">
  47. <image src="../../static/images/user/exchange_records_icon16.png" mode=""></image>
  48. <view>兑换记录</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="content">
  56. <!-- 积分列表 -->
  57. <view class="points-cont">
  58. <!-- tab切换 -->
  59. <view class="pub-tab-box">
  60. <view class="tab-inner">
  61. <view
  62. v-for="(item,index) in tags"
  63. :key="index"
  64. :class="tabIndex == item.value?'item active':'item'"
  65. @click="tabChange(item)"
  66. >
  67. {{ item.lable }}
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 列表 -->
  72. <view class="point-list">
  73. <view class="item" v-for="(item,index) in list" :key="index" >
  74. <view class="img-box">
  75. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/fs/20250724/09f377c4b9c34d60bbc7fd55fe3c0b65.png" mode=""></image>
  76. </view>
  77. <view class="info-box">
  78. <view class="title ellipsis2">{{ item.title }}</view>
  79. <view class="old">¥{{item.price.toFixed(2)}}</view>
  80. <view class="price-box">
  81. <view class="now">
  82. <view class="num">{{item.number}}</view>
  83. <text>积分</text>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <Loading :loaded="loaded" :loading="loading"></Loading>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import {getUserSign,getIntegral,doSign} from '@/api/userSign'
  98. import Loading from "@/components/Loading";
  99. export default {
  100. components: {
  101. Loading,
  102. },
  103. data() {
  104. return {
  105. isDaySign:false,
  106. top:0,
  107. signNum:0,
  108. integral:0,
  109. sign:[],
  110. // 状态栏的高度
  111. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  112. // tab切换
  113. tags: [{lable:'全部',value:-1},{lable:'生活用品',value:1},{lable:'养生保健',value:0}],
  114. // 选中的tab
  115. tabIndex: -1,
  116. current: 0,
  117. page: {
  118. billType:-1,
  119. page: 1,
  120. pageSize: 10
  121. },
  122. list: [
  123. {title:'电子血压计',number:5990,price:23.23},
  124. {title:'一次性无菌采血针',number:6990,price:23.23},
  125. {title:'电子血压计',number:4990,price:23.23},
  126. ],
  127. loaded: false,
  128. loading: false
  129. };
  130. },
  131. onLoad(option) {
  132. // this.getUserSign()
  133. // this.getIntegral()
  134. },
  135. onReachBottom() {
  136. !this.loading && this.getIntegral();
  137. },
  138. onPageScroll(e) {
  139. if(e.scrollTop > 30) {
  140. this.topFixed = true
  141. } else {
  142. this.topFixed = false
  143. }
  144. },
  145. onPageScroll(e) {
  146. this.top=e.scrollTop;
  147. },
  148. computed: {
  149. // 计算属性的 getter
  150. bg: function() {
  151. return 'rgba(245, 221, 193, ' + this.top / 30 + ')';
  152. },
  153. },
  154. methods: {
  155. doSign(){
  156. var data={};
  157. uni.showLoading({
  158. title:"正在加载中..."
  159. })
  160. doSign(data).then(
  161. res => {
  162. uni.hideLoading()
  163. if(res.code==200){
  164. uni.showToast({
  165. icon:'success',
  166. title: res.msg,
  167. });
  168. this.list=[];
  169. this.page.page=1;
  170. this.list=[];
  171. this.loaded=false;
  172. this.loading=false;
  173. this.getIntegral();
  174. this.getUserSign();
  175. }else{
  176. uni.showToast({
  177. icon:'none',
  178. title: res.msg,
  179. });
  180. }
  181. },
  182. rej => {}
  183. );
  184. },
  185. getUserSign(){
  186. getUserSign().then(
  187. res => {
  188. if(res.code==200){
  189. this.data=res.member;
  190. this.signNum=res.signNum;
  191. this.isDaySign=res.isDaySign;
  192. this.integral=res.integral;
  193. this.sign=JSON.parse(res.sign);
  194. }else{
  195. uni.showToast({
  196. icon:'none',
  197. title: "请求失败",
  198. });
  199. }
  200. },
  201. rej => {}
  202. );
  203. },
  204. getIntegral() {
  205. let that = this;
  206. if (that.loaded == true || that.loading == true) return;
  207. that.loading = true;
  208. uni.showLoading({
  209. title:"加载中..."
  210. })
  211. getIntegral(that.page).then(
  212. res => {
  213. that.loading = false;
  214. that.loaded = res.data.list.length < that.page.pageSize;
  215. that.page.page = that.page.page + 1;
  216. that.list.push.apply(that.list, res.data.list);
  217. uni.hideLoading()
  218. },
  219. err => {
  220. uni.hideLoading()
  221. uni.showToast({
  222. title: err.msg ,
  223. icon: 'none',
  224. duration: 2000
  225. });
  226. }
  227. );
  228. },
  229. // 返回上一页
  230. back() {
  231. uni.navigateBack()
  232. },
  233. // tab选择
  234. tabChange(item) {
  235. console.log(item)
  236. this.tabIndex = item.value
  237. this.page.billType=this.tabIndex;
  238. this.page.page=1;
  239. this.list=[];
  240. this.loaded=false;
  241. this.loading=false;
  242. this.getIntegral();
  243. }
  244. }
  245. }
  246. </script>
  247. <style lang="scss">
  248. page{
  249. background: #EFF3F7 ;
  250. }
  251. .fixed-top-box{
  252. width: 100%;
  253. position: fixed;
  254. top: 0;
  255. left: 0;
  256. z-index: 1000;
  257. transition: all 0.5s;
  258. }
  259. .top-cont{
  260. width: 100%;
  261. height: 654upx;
  262. position: relative;
  263. .bg{
  264. width: 100%;
  265. height: 100%;
  266. position: absolute;
  267. top: 0;
  268. left: 0;
  269. z-index: 1;
  270. }
  271. .top-inner{
  272. width: 100%;
  273. height: 100%;
  274. position: absolute;
  275. top: 0;
  276. left: 0;
  277. z-index: 2;
  278. background-repeat: no-repeat;
  279. background-size: cover;
  280. // background: linear-gradient( rgba(238,209,179,0.5) 0%, #F5DDC1 49%, #EFF3F7 100%);
  281. .back-box{
  282. height: 88upx;
  283. padding-left: 22upx;
  284. display: flex;
  285. align-items: center;
  286. justify-content: space-between;
  287. padding: 0 20upx;
  288. image{
  289. width: 40upx;
  290. height: 40upx;
  291. }
  292. .title{
  293. font-size: 32upx;
  294. font-family: PingFang SC;
  295. font-weight: 500;
  296. // color: #FFFFFF;
  297. }
  298. }
  299. .available-points{
  300. margin-top: 40upx;
  301. display: flex;
  302. flex-direction: column;
  303. align-items: center;
  304. justify-content: center;
  305. .label{
  306. font-size: 30upx;
  307. font-family: PingFang SC;
  308. font-weight: bold;
  309. color: #FFFFFF;
  310. line-height: 1;
  311. }
  312. .num{
  313. font-size: 80upx;
  314. font-family: Gilroy;
  315. font-weight: 500;
  316. color: #FFFFFF;
  317. line-height: 1;
  318. margin-top: 28upx;
  319. }
  320. }
  321. .singn-content{
  322. padding: 0 20upx;
  323. margin-top: 50upx;
  324. }
  325. .sign-in-box{
  326. margin-bottom: 40rpx;
  327. .inner{
  328. // padding: 40upx 30upx;
  329. .top-box{
  330. padding: 30rpx;
  331. margin: 0 30rpx;
  332. display: flex;
  333. align-items: flex-start;
  334. justify-content: space-between;
  335. background: #FFFFFF;
  336. border-radius: 24rpx 24rpx 0rpx 0rpx;
  337. .left{
  338. display: flex;
  339. flex-direction: column;
  340. align-items: flex-start;
  341. text{
  342. margin-left: 12rpx;
  343. font-family: PingFang SC, PingFang SC;
  344. font-weight: 400;
  345. font-size: 26rpx;
  346. color: #626468;
  347. text-align: left;
  348. }
  349. .num{
  350. font-family: Roboto, Roboto;
  351. font-weight: 500;
  352. font-size: 64rpx;
  353. color: #222426;
  354. text-align: left;
  355. }
  356. }
  357. .guize{
  358. position: absolute;
  359. right: 50rpx;
  360. width: 148rpx;
  361. height: 56rpx;
  362. line-height: 56rpx;
  363. text-align: center;
  364. font-weight: 400;
  365. font-size: 24rpx;
  366. color: #222426;
  367. background: #F9E6C5;
  368. border-radius: 28rpx 0rpx 0rpx 28rpx;
  369. }
  370. }
  371. .bottom-box{
  372. background: #FCF8F5;
  373. border-radius: 24rpx 24rpx 24rpx 24rpx;
  374. height: 150rpx;
  375. z-index: -1;
  376. position: relative;
  377. margin-top: -50rpx;
  378. .ttbg{
  379. width: 100%;
  380. height: 50rpx;
  381. background: #D4A178;
  382. border-radius: 24rpx 24rpx 24rpx 24rpx;
  383. }
  384. .t-left{
  385. flex:1;
  386. display: flex;
  387. align-items: center;
  388. justify-content: center;
  389. font-family: PingFang SC, PingFang SC;
  390. font-weight: 400;
  391. font-size: 24rpx;
  392. color: #AF6020;
  393. border-right: 2rpx solid rgba(175,96,32,0.4);
  394. image{
  395. width: 40rpx;
  396. height: 40rpx;
  397. margin-right: 12rpx;
  398. }
  399. }
  400. .t-right{
  401. flex:1;
  402. display: flex;
  403. align-items: center;
  404. justify-content: center;
  405. font-family: PingFang SC, PingFang SC;
  406. font-weight: 400;
  407. font-size: 24rpx;
  408. color: #AF6020;
  409. image{
  410. width: 32rpx;
  411. height: 32rpx;
  412. margin-right: 12rpx;
  413. }
  414. }
  415. }
  416. }
  417. .sign-btn-box{
  418. padding: 0 14upx;
  419. .btn{
  420. width: 100%;
  421. height: 120upx;
  422. background-image: url(../../static/images/org_btn.png);
  423. background-repeat: no-repeat;
  424. background-size: 100% 100%;
  425. display: flex;
  426. justify-content: center;
  427. image{
  428. width: 32upx;
  429. height: 32upx;
  430. margin-top: 32upx;
  431. margin-right: 16upx;
  432. }
  433. .text{
  434. font-size: 30upx;
  435. font-family: PingFang SC;
  436. font-weight: bold;
  437. color: #FFFFFF;
  438. line-height: 1;
  439. margin-top: 36upx;
  440. }
  441. }
  442. }
  443. }
  444. }
  445. }
  446. .content{
  447. margin-top: 20upx;
  448. padding: 0 20upx 40upx;
  449. .points-cont{
  450. // background-color: #FFFFFF;
  451. // border-radius: 16upx;
  452. .pub-tab-box{
  453. // padding: 0 80upx;
  454. .tab-inner{
  455. height: 72upx;
  456. line-height: 72upx;
  457. display: flex;
  458. align-items: center;
  459. position: relative;
  460. // justify-content: space-between;
  461. }
  462. .item{
  463. font-size: 28upx;
  464. white-space: nowrap;
  465. line-height: 1;
  466. font-family: PingFang SC;
  467. font-weight: 400;
  468. font-size: 32rpx;
  469. margin-right: 48rpx;
  470. color: #222426;
  471. display: flex;
  472. align-items: center;
  473. justify-content: center;
  474. &.active{
  475. font-weight: bold;
  476. font-size: 36rpx;
  477. &::after{
  478. content: "";
  479. width: 72rpx;
  480. height: 8rpx;
  481. background: #C19760;
  482. position: absolute;
  483. bottom: 0;
  484. border-radius: 4rpx;
  485. }
  486. }
  487. .text{
  488. position: relative;
  489. z-index: 1;
  490. }
  491. .tab-bg{
  492. width: 72upx;
  493. height: 28upx;
  494. position: absolute;
  495. top: 17upx;
  496. left: 50%;
  497. transform: translateX(-36upx);
  498. z-index: -1;
  499. }
  500. }
  501. }
  502. .point-list{
  503. display: flex;
  504. flex-wrap: wrap;
  505. margin-top: 40rpx;
  506. .item{
  507. margin-right: 20rpx;
  508. margin-bottom: 20rpx;
  509. width: 345rpx;
  510. background: #FFFFFF;
  511. box-shadow: 0px 0px 10rpx 4rpx rgba(199, 199, 199, 0.22);
  512. border-radius: 20rpx;
  513. overflow: hidden;
  514. &:nth-child(2n) {
  515. margin-right: 0;
  516. }
  517. .img-box{
  518. width: 100%;
  519. height: 334upx;
  520. image{
  521. width: 100%;
  522. height: 100%;
  523. }
  524. }
  525. .info-box{
  526. box-sizing: border-box;
  527. height: 182upx;
  528. padding: 20upx 20upx 30upx;
  529. display: flex;
  530. flex-direction: column;
  531. justify-content: space-between;
  532. .title{
  533. font-size: 28upx;
  534. font-family: PingFang SC;
  535. font-weight: 500;
  536. color: #111111;
  537. line-height: 40upx;
  538. }
  539. .old{
  540. font-size: 28upx;
  541. font-family: PingFang SC;
  542. font-weight: 400;
  543. text-decoration: line-through;
  544. color: #898E91;
  545. // line-height: 1.1;
  546. }
  547. .price-box{
  548. display: flex;
  549. align-items: flex-end;
  550. .now{
  551. display: flex;
  552. align-items: flex-end;
  553. margin-right: 20upx;
  554. .num{
  555. font-family: PingFang SC, PingFang SC;
  556. font-weight: 500;
  557. font-size: 32rpx;
  558. color: #AF6020;
  559. text-align: left;
  560. }
  561. text{
  562. margin-left: 6rpx;
  563. font-weight: 400;
  564. font-size: 24rpx;
  565. color: #AF6020;
  566. text-align: left;
  567. }
  568. }
  569. }
  570. }
  571. }
  572. }
  573. }
  574. }
  575. </style>