integrateBalance.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <view>
  3. <navbar :config="config"></navbar>
  4. <view class="top-box">
  5. <text class="title">积分余额</text>
  6. <text class="integral">{{ $addDecimals(integral_able , 8) }}</text>
  7. <text class="worth">当前积分价值:{{ pointconfigInfo.point_price }}元</text>
  8. <view class="integral-btns">
  9. <text class="integral-btn" @click.stop="exchangeIntegral()">兑换余额</text>
  10. <text class="integral-btn" @click.stop="goIntegralTransferred()" v-if="openProxy == true">积分转赠</text>
  11. </view>
  12. </view>
  13. <view class="content-box">
  14. <view class="list-box">
  15. <view class="list-box-title">
  16. <text @click.stop="activeType = 1"
  17. :class="['list-title' , activeType == 1 ? 'active-list-title' : '']">积分详情</text>
  18. <text @click.stop="activeType = 2"
  19. :class="['list-title' , activeType == 2 ? 'active-list-title' : '']">积分明细</text>
  20. </view>
  21. <view class="list-item-box">
  22. <template v-if="activeType === 1">
  23. <block v-for="item in integralInfo">
  24. <view class="list-item list-info-item">
  25. <image class="list-info-img" :src="item.icon" mode=""></image>
  26. <view class="list-info-text">
  27. <text class="text-title">{{ item.name }}</text>
  28. <text v-if="item.way"
  29. class="text-num">{{ $addDecimals(subtractionNum(pointconfigInfo[item.key_1] , pointconfigInfo[item.key_2]) , item.length) }}</text>
  30. <!-- <text v-if="item.way" class="text-num">{{ pointconfigInfo[item.key_1] }}</text> -->
  31. <text v-else class="text-num">{{ $addDecimals(pointconfigInfo[item.key] , item.length) }}</text>
  32. </view>
  33. </view>
  34. </block>
  35. </template>
  36. <template v-if="activeType === 2">
  37. <block v-for="(item, index) in pointsList" :key="index">
  38. <view class="list-item">
  39. <view class="list-item-text">
  40. {{item.mode}}
  41. </view>
  42. <view class="list-item-val">
  43. <text class="list-item-time">{{ item.create_time }}</text>
  44. <text class="list-item-nums">
  45. {{ item.bill_type == 1 ? '+' : '-'}}{{ $addDecimals(item.value) }}积分
  46. </text>
  47. </view>
  48. </view>
  49. </block>
  50. <loadMore v-if="pointsList.length>0" :status="status"></loadMore>
  51. <nodata v-else :config="{ top: 1, content: '暂无数据~' }"></nodata>
  52. </template>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. getAccountInfo
  61. } from "@/api/login.js"
  62. import math from "@/common/math.js"
  63. import {
  64. pointconfig,
  65. destroyIntegral
  66. } from "@/api/personal-center.js"
  67. import {
  68. detailedInfo
  69. } from "@/api/notice.js";
  70. export default {
  71. data() {
  72. return {
  73. activeType: 2,
  74. config: {
  75. back: true, //false是tolbar页面 是则不写
  76. title: '我的积分',
  77. color: '#FFFFFF',
  78. // autoBack:true,
  79. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  80. backgroundColor: [1, "#3775F6"],
  81. statusBarFontColor: '#FFFFFF'
  82. },
  83. // 积分余额
  84. integral_able: 0,
  85. pointsList: [],
  86. pointconfigInfo: {
  87. platform_total_point: 0,
  88. every_day_put_int_point: 0,
  89. point_price: 0
  90. },
  91. params: {
  92. page: 1,
  93. limit: 10
  94. },
  95. status: 'loading', //more|loading|noMore
  96. integralInfo: [{
  97. icon: '../../static/personal/integral1.png',
  98. name: '平台空投总积分数量',
  99. key: 'platform_total_point',
  100. length: 8,
  101. },
  102. {
  103. icon: '../../static/personal/integral2.png',
  104. name: '平台未释放积分数量',
  105. way: true,
  106. length: 8,
  107. // key_1 - key_2
  108. key_1: 'platform_total_point',
  109. key_2: 'give_total_point',
  110. },
  111. {
  112. icon: '../../static/personal/integral3.png',
  113. name: '每日权重空投数量',
  114. key: 'every_day_put_int_point',
  115. length: 8
  116. },
  117. {
  118. icon: '../../static/personal/integral4.png',
  119. name: '当前积分价值(元)',
  120. key: 'point_price',
  121. length: 2
  122. },
  123. {
  124. icon: '../../static/personal/integral5.png',
  125. name: '已空投积分数',
  126. key: 'give_total_point',
  127. length: 8
  128. },
  129. {
  130. icon: '../../static/personal/destroy.png',
  131. name: '已销毁积分数',
  132. key: 'all_handling_fee',
  133. length: 8
  134. }
  135. ],
  136. openProxy: false, // 是否开启区域代理
  137. }
  138. },
  139. onShow() {
  140. this.pointsList = [];
  141. this.getUserInfo()
  142. this.getMydetailed();
  143. this.isOpenProxy()
  144. },
  145. onLoad() {
  146. this.getPointconfig()
  147. // this.getDestoryPoint()
  148. },
  149. onReachBottom() {
  150. if (this.activeType === 2 && this.status !== 'loading' && this.status !== 'noMore') {
  151. this.params.page++
  152. this.getMydetailed()
  153. }
  154. },
  155. onPullDownRefresh() {
  156. this.params.page = 1
  157. this.pointsList = []
  158. this.getMydetailed()
  159. this.isOpenProxy()
  160. },
  161. methods: {
  162. //获取个人信息
  163. getUserInfo() {
  164. this.$http.get(getAccountInfo).then(res => {
  165. if (res && res.code == 200) {
  166. this.integral_able = res.data.integral_able;
  167. uni.setStorageSync("personal", res.data)
  168. } else {
  169. this.isLogin = false
  170. }
  171. })
  172. },
  173. // 计算 平台未释放积分数量
  174. subtractionNum(num_1 = 0, num_2 = 0) {
  175. return math.subtract(num_1, num_2)
  176. },
  177. // 获取积分详情
  178. getPointconfig() {
  179. this.$http.get(pointconfig).then((res) => {
  180. if (res && res.code == 200) {
  181. uni.stopPullDownRefresh()
  182. this.pointconfigInfo = res.data
  183. this.getDestoryPoint()
  184. }
  185. });
  186. },
  187. getDestoryPoint() {
  188. this.$http.get(destroyIntegral).then((res) => {
  189. if (res && res.code == 200) {
  190. uni.stopPullDownRefresh()
  191. this.pointconfigInfo.all_handling_fee = res.data.all_handling_fee
  192. }
  193. });
  194. },
  195. // 获取积分明细
  196. getMydetailed() {
  197. this.status = 'loading';
  198. this.$http.get(detailedInfo, this.params).then((res) => {
  199. if (res && res.code == 200) {
  200. uni.stopPullDownRefresh()
  201. this.pointsList = this.pointsList.concat(res.page.list);
  202. if (res.page.totalPage <= res.page.currPage) {
  203. this.status = 'noMore'
  204. } else {
  205. this.status = 'more'
  206. }
  207. }
  208. });
  209. },
  210. // 兑换余额
  211. exchangeIntegral() {
  212. uni.navigateTo({
  213. url: "/pages/user/exchange"
  214. })
  215. },
  216. // 积分转赠
  217. goIntegralTransferred() {
  218. uni.navigateTo({
  219. url: "/pages/user/Integral-transferred"
  220. })
  221. },
  222. isOpenProxy() {
  223. this.$http.get('/saleconfig/openPayment').then(res => {
  224. if (res && res.code == 200) {
  225. this.openProxy = res.openPayment;
  226. }
  227. });
  228. }
  229. }
  230. }
  231. </script>
  232. <style lang="scss" scoped>
  233. .top-box {
  234. width: 100%;
  235. min-height: 354rpx;
  236. padding: 50rpx 60rpx 90rpx;
  237. background-color: #FA6138;
  238. display: flex;
  239. flex-direction: column;
  240. justify-content: center;
  241. align-items: center;
  242. font-family: PingFang SC, PingFang SC-Regular;
  243. font-weight: 400;
  244. color: #ffffff;
  245. .worth,
  246. .title {
  247. font-size: 28rpx;
  248. color: #ffffff;
  249. }
  250. .integral {
  251. font-size: 50rpx;
  252. }
  253. .integral-btns {
  254. display: flex;
  255. align-items: center;
  256. margin-top: 40rpx;
  257. .integral-btn {
  258. width: 270rpx;
  259. height: 72rpx;
  260. background: #FA6138;
  261. border: 1rpx solid #ffffff;
  262. border-radius: 36rpx;
  263. text-align: center;
  264. line-height: 70rpx;
  265. margin-right: 30rpx;
  266. font-size: 26rpx;
  267. &:last-child {
  268. margin: 0 0 0 30rpx;
  269. background-color: #fff;
  270. color: #FA6138;
  271. }
  272. }
  273. }
  274. }
  275. .content-box {
  276. width: 100%;
  277. position: relative;
  278. }
  279. .list-box {
  280. width: 100%;
  281. position: absolute;
  282. top: -40rpx;
  283. // transform: translateY(-40rpx);
  284. border-radius: 40rpx 40rpx 0 0;
  285. background-color: #fff;
  286. font-family: PingFang SC, PingFang SC-Regular;
  287. font-weight: 400;
  288. .list-box-title {
  289. width: 100%;
  290. height: 103.5rpx;
  291. display: flex;
  292. justify-content: space-around;
  293. align-items: center;
  294. padding: 0 60rpx;
  295. font-size: 32rpx;
  296. color: #1a1a1a;
  297. border-bottom: 1rpx solid #e6e6e6;
  298. .list-title {
  299. height: 100%;
  300. line-height: 103rpx;
  301. // border-bottom: 4rpx solid #1a1a1a;
  302. }
  303. .active-list-title {
  304. font-size: 32rpx;
  305. font-weight: 700;
  306. color: #FA6138;
  307. position: relative;
  308. &:before {
  309. content: '';
  310. position: absolute;
  311. left: 0;
  312. bottom: 0;
  313. width: 100%;
  314. height: 4rpx;
  315. border-radius: 2rpx;
  316. background-color: #FA6138;
  317. }
  318. }
  319. }
  320. .list-item-box {
  321. width: 100%;
  322. padding: 0 60rpx;
  323. font-family: PingFang SC, PingFang SC-Regular;
  324. font-weight: 400;
  325. }
  326. .list-item {
  327. width: 100%;
  328. // min-height: 161rpx;
  329. padding: 40rpx 0;
  330. border-bottom: 1rpx solid #e6e6e6;
  331. // text-align: left;
  332. display: flex;
  333. flex-direction: column;
  334. // align-items: center;
  335. justify-content: center;
  336. .list-item-text {
  337. // opacity: 0.9;
  338. font-size: 28rpx;
  339. color: #1a1a1a;
  340. }
  341. .list-item-val {
  342. padding-top: 14rpx;
  343. display: flex;
  344. justify-content: space-between;
  345. align-content: center;
  346. align-items: center;
  347. .list-item-time {
  348. font-size: 24rpx;
  349. color: #999999;
  350. flex-shrink: 0;
  351. }
  352. .list-item-nums {
  353. padding-left: 10px;
  354. font-size: 30rpx;
  355. color: #FA6138;
  356. }
  357. }
  358. }
  359. .list-info-item {
  360. width: 100%;
  361. display: flex;
  362. flex-direction: row;
  363. align-items: center;
  364. .list-info-img {
  365. width: 71rpx;
  366. height: 71rpx;
  367. }
  368. .list-info-text {
  369. width: calc(100% - 71rpx);
  370. padding-left: 22rpx;
  371. display: flex;
  372. flex-direction: column;
  373. .text-title {
  374. font-size: 28rpx;
  375. color: #1a1a1a;
  376. }
  377. .text-num {
  378. padding-top: 6rpx;
  379. font-size: 24rpx;
  380. color: #666666;
  381. }
  382. }
  383. }
  384. }
  385. </style>