integral.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <template>
  2. <view>
  3. <view class="top-cont">
  4. <!-- 背景图片 -->
  5. <image class="bg"
  6. src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/ed4a8ff0406747a68e40988b210d1c78.png"
  7. mode=""></image>
  8. <view class="top-inner">
  9. <!-- 这里是状态栏 -->
  10. <view class="fixed-top-box" :style="{ background: bg }">
  11. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  12. <view class="back-box" @click="back">
  13. <text class="title">我的芳华币</text>
  14. <text></text>
  15. </view>
  16. </view>
  17. <!-- 顶部固定后站位元素 -->
  18. <view style="padding-bottom: 88upx;">
  19. <view :style="{height: statusBarHeight}"></view>
  20. </view>
  21. <!-- 可用芳华币 -->
  22. <view class="available-points">
  23. <text class="label">可用芳华币</text>
  24. <text class="num">{{integral}}</text>
  25. </view>
  26. <view class="content">
  27. <!-- 芳华币列表 -->
  28. <view class="points-cont">
  29. <!-- tab切换 -->
  30. <!-- <view class="pub-tab-box">
  31. <view class="tab-inner">
  32. <view
  33. v-for="(item,index) in tags"
  34. :key="index"
  35. :class="tabIndex == item.value?'item active':'item'"
  36. @click="tabChange(item)">
  37. <view class="text">
  38. {{ item.lable }}
  39. <image v-show="tabIndex == item.value" class="tab-bg" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/1828ea6b3b124b5f84e3556267a8d9ef.png" mode=""></image>
  40. </view>
  41. </view>
  42. </view>
  43. </view> -->
  44. <!-- 列表 -->
  45. <view class="point-list">
  46. <view v-for="(item,index) in list" :key="index" class="item">
  47. <view class="left">
  48. <text class="title">
  49. {{item.logTypeName}}
  50. </text>
  51. <view class="time">{{item.createTime}}</view>
  52. </view>
  53. <view class="right">
  54. <text v-if="item.integral<0" class="less">{{item.integral}}</text>
  55. <text v-else class="add">+{{item.integral}}</text>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import {
  67. getUserIntegralInfo
  68. } from '@/api/living.js' // 芳华币
  69. // import {getDictByKey} from '@/api/common.js'
  70. // import {getUserSign,getUserIntegralLogsList,doSign} from '@/api/integral';
  71. export default {
  72. comments() {
  73. Loading
  74. },
  75. data() {
  76. return {
  77. typeOptions: [],
  78. top: 0,
  79. integral: 0,
  80. sign: [],
  81. // 状态栏的高度
  82. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  83. // tab切换
  84. // {lable:'获得',value:1},{lable:'消耗',value:2}
  85. // tags: [{lable:'最近十条',value:0},],
  86. // 选中的tab
  87. tabIndex: 0,
  88. current: 0,
  89. page: {
  90. type: 0,
  91. page: 1,
  92. pageSize: 10
  93. },
  94. list: [],
  95. loaded: false,
  96. loading: false
  97. };
  98. },
  99. onLoad(option) {
  100. this.getUserIntegralInfo()
  101. },
  102. computed: {
  103. // 计算属性的 getter
  104. bg: function() {
  105. return 'rgba(255,142,60, ' + this.top / 30 + ')';
  106. },
  107. },
  108. methods: {
  109. // 芳华币
  110. getUserIntegralInfo() {
  111. uni.showLoading({
  112. title: "正在加载中..."
  113. })
  114. getUserIntegralInfo().then(res => {
  115. uni.hideLoading()
  116. if (res.code == 200) {
  117. console.log("芳华币>>", res)
  118. // 处理列表数据,将"积分"替换为"芳华币"
  119. this.list = res.data.logs.map(item => {
  120. return {
  121. ...item,
  122. logTypeName: item.logTypeName ? item.logTypeName.replace(/积分/g, '芳华币') : item.logTypeName
  123. }
  124. })
  125. this.integral = res.data.integral
  126. }
  127. }).catch(error => {
  128. console.error("获取芳华币数据失败:", error);
  129. });
  130. },
  131. getDictByKey(key) {
  132. var data = {
  133. key: key
  134. }
  135. getDictByKey(data).then(
  136. res => {
  137. if (res.code == 200) {
  138. this.typeOptions = res.data;
  139. }
  140. },
  141. err => {}
  142. );
  143. },
  144. // doSign(){
  145. // var data={};
  146. // uni.showLoading({
  147. // title:"正在加载中..."
  148. // })
  149. // doSign(data).then(
  150. // res => {
  151. // uni.hideLoading()
  152. // if(res.code==200){
  153. // uni.showToast({
  154. // icon:'success',
  155. // title: res.msg,
  156. // });
  157. // this.list=[];
  158. // this.page.page=1;
  159. // this.list=[];
  160. // this.loaded=false;
  161. // this.loading=false;
  162. // this.getUserIntegralLogsList();
  163. // this.getUserSign();
  164. // }else{
  165. // uni.showToast({
  166. // icon:'none',
  167. // title: res.msg,
  168. // });
  169. // }
  170. // },
  171. // rej => {}
  172. // );
  173. // },
  174. // getUserSign(){
  175. // getUserSign().then(
  176. // res => {
  177. // if(res.code==200){
  178. // this.data=res.member;
  179. // this.integral=res.integral;
  180. // this.sign=JSON.parse(res.sign);
  181. // }else{
  182. // uni.showToast({
  183. // icon:'none',
  184. // title: "请求失败",
  185. // });
  186. // }
  187. // },
  188. // rej => {}
  189. // );
  190. // },
  191. // getUserIntegralLogsList() {
  192. // let that = this;
  193. // if (that.loaded == true || that.loading == true) return;
  194. // that.loading = true;
  195. // uni.showLoading({
  196. // title:"加载中..."
  197. // })
  198. // getUserIntegralLogsList(that.page).then(
  199. // res => {
  200. // that.loading = false;
  201. // that.loaded = res.data.list.length < that.page.pageSize;
  202. // that.page.page = that.page.page + 1;
  203. // that.list.push.apply(that.list, res.data.list);
  204. // uni.hideLoading()
  205. // },
  206. // err => {
  207. // uni.hideLoading()
  208. // uni.showToast({
  209. // title: err.msg ,
  210. // icon: 'none',
  211. // duration: 2000
  212. // });
  213. // }
  214. // );
  215. // },
  216. // 返回上一页
  217. back() {
  218. uni.navigateBack()
  219. },
  220. // tab选择
  221. // tabChange(item) {
  222. // console.log(item)
  223. // this.tabIndex = item.value
  224. // this.page.type=this.tabIndex;
  225. // this.page.page=1;
  226. // this.list=[];
  227. // this.loaded=false;
  228. // this.loading=false;
  229. // this.getUserIntegralLogsList();
  230. // }
  231. }
  232. }
  233. </script>
  234. <style lang="scss">
  235. .fixed-top-box {
  236. width: 100%;
  237. position: fixed;
  238. top: 0;
  239. left: 0;
  240. z-index: 1000;
  241. transition: all 0.5s;
  242. }
  243. .top-cont {
  244. width: 100%;
  245. height: 654upx;
  246. position: relative;
  247. .bg {
  248. width: 100%;
  249. height: 100%;
  250. position: absolute;
  251. top: 0;
  252. left: 0;
  253. z-index: 1;
  254. }
  255. .top-inner {
  256. width: 100%;
  257. height: 100%;
  258. position: absolute;
  259. top: 0;
  260. left: 0;
  261. z-index: 2;
  262. .back-box {
  263. height: 88upx;
  264. padding-left: 22upx;
  265. display: flex;
  266. align-items: center;
  267. justify-content: space-between;
  268. padding: 0 20upx;
  269. image {
  270. width: 40upx;
  271. height: 40upx;
  272. }
  273. .title {
  274. font-size: 36upx;
  275. font-family: PingFang SC;
  276. font-weight: 500;
  277. color: #FFFFFF;
  278. }
  279. }
  280. .available-points {
  281. margin-top: 140upx;
  282. display: flex;
  283. flex-direction: column;
  284. align-items: center;
  285. justify-content: center;
  286. .label {
  287. font-size: 30upx;
  288. font-family: PingFang SC;
  289. font-weight: bold;
  290. color: #FFFFFF;
  291. line-height: 1;
  292. }
  293. .num {
  294. font-size: 80upx;
  295. font-family: Gilroy;
  296. font-weight: 500;
  297. color: #FFFFFF;
  298. line-height: 1;
  299. margin-top: 28upx;
  300. }
  301. }
  302. .singn-content {
  303. padding: 0 20upx;
  304. margin-top: 50upx;
  305. }
  306. .sign-in-box {
  307. height: 380upx;
  308. background: #FFFFFF;
  309. border-radius: 16upx;
  310. .inner {
  311. padding: 40upx 30upx;
  312. .title-box {
  313. font-size: 26upx;
  314. font-family: PingFang SC;
  315. font-weight: 500;
  316. color: #666666;
  317. line-height: 1;
  318. .num {
  319. font-size: 32upx;
  320. font-family: PingFang SC;
  321. font-weight: Bold;
  322. color: #FF7511;
  323. margin: 0 10upx;
  324. line-height: 1;
  325. }
  326. }
  327. .sign-list {
  328. display: flex;
  329. align-items: center;
  330. justify-content: space-between;
  331. margin-top: 40upx;
  332. .item {
  333. display: flex;
  334. justify-content: center;
  335. .right {
  336. display: flex;
  337. flex-direction: column;
  338. align-items: center;
  339. justify-content: center;
  340. image {
  341. width: 44upx;
  342. height: 44upx;
  343. margin-bottom: 20upx;
  344. }
  345. .text {
  346. font-size: 24upx;
  347. font-family: PingFang SC;
  348. font-weight: 500;
  349. color: #FF7511;
  350. line-height: 1;
  351. white-space: nowrap;
  352. }
  353. }
  354. .line {
  355. width: 34upx;
  356. height: 4upx;
  357. background: #F6CDA7;
  358. border-radius: 2upx;
  359. margin-top: 22upx;
  360. }
  361. &:first-child {
  362. .line {
  363. display: none;
  364. }
  365. }
  366. &.active {
  367. .line {
  368. background: #FF8E3C;
  369. }
  370. }
  371. }
  372. }
  373. }
  374. .sign-btn-box {
  375. padding: 0 14upx;
  376. .btn {
  377. width: 100%;
  378. height: 88upx;
  379. box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.05);
  380. background-color: #FF7511;
  381. border-radius: 44rpx;
  382. display: flex;
  383. justify-content: center;
  384. align-items: center;
  385. image {
  386. width: 32upx;
  387. height: 32upx;
  388. }
  389. .text {
  390. font-size: 30upx;
  391. font-family: PingFang SC;
  392. font-weight: bold;
  393. color: #FFFFFF;
  394. line-height: 1;
  395. }
  396. }
  397. }
  398. }
  399. }
  400. }
  401. .content {
  402. margin-top: 20upx;
  403. padding: 0 20upx 40upx;
  404. .points-cont {
  405. background-color: #FFFFFF;
  406. border-radius: 16upx;
  407. .pub-tab-box {
  408. padding: 0 80upx;
  409. .tab-inner {
  410. height: 88upx;
  411. line-height: 88upx;
  412. display: flex;
  413. align-items: center;
  414. justify-content: space-between;
  415. }
  416. .item {
  417. font-size: 28upx;
  418. white-space: nowrap;
  419. line-height: 1;
  420. font-family: PingFang SC;
  421. font-weight: 500;
  422. color: #666666;
  423. display: flex;
  424. align-items: center;
  425. justify-content: center;
  426. &.active {
  427. font-weight: bold;
  428. color: #333333;
  429. }
  430. .text {
  431. position: relative;
  432. z-index: 1;
  433. }
  434. .tab-bg {
  435. width: 72upx;
  436. height: 28upx;
  437. position: absolute;
  438. top: 17upx;
  439. left: 50%;
  440. transform: translateX(-36upx);
  441. z-index: -1;
  442. }
  443. }
  444. }
  445. .point-list {
  446. padding: 0 30upx;
  447. .item {
  448. padding: 30upx 0;
  449. display: flex;
  450. align-items: center;
  451. justify-content: space-between;
  452. border-bottom: 1px solid #F0F0F0;
  453. &:last-child {
  454. border-bottom: none;
  455. }
  456. .left {
  457. .title {
  458. font-size: 28upx;
  459. font-family: PingFang SC;
  460. font-weight: 500;
  461. color: #111111;
  462. line-height: 1;
  463. }
  464. .time {
  465. font-size: 24upx;
  466. font-family: PingFang SC;
  467. font-weight: 500;
  468. color: #999999;
  469. line-height: 1;
  470. margin-top: 22upx;
  471. }
  472. }
  473. .right {
  474. .add {
  475. font-size: 28upx;
  476. font-family: PingFang SC;
  477. font-weight: 500;
  478. color: #111111;
  479. }
  480. .less {
  481. font-size: 28upx;
  482. font-family: PingFang SC;
  483. font-weight: 500;
  484. color: #F56C6C;
  485. }
  486. }
  487. }
  488. }
  489. }
  490. }
  491. </style>