index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view :data-theme="theme">
  3. <view class='bill-details'>
  4. <view class='nav acea-row'>
  5. <view class='item' :class='type==="all" ? "on":""' @click='changeType("all")'>全部</view>
  6. <view class='item' :class='type==="expenditure" ? "on":""' @click='changeType("expenditure")'>支出</view>
  7. <view class='item' :class='type==="recharge" ? "on":""' @click='changeType("recharge")'>充值</view>
  8. <view class='item' :class='type==="income" ? "on":""' @click='changeType("income")'>收入</view>
  9. </view>
  10. <view class='sign-record'>
  11. <view class='list borderPad' v-for="(item,index) in userBillList" :key="index">
  12. <view class='item'>
  13. <view class='data'>{{item.month}}</view>
  14. <view class='listn borRadius14'>
  15. <view class="itemn" v-for="(vo,indexn) in item.list" :key="indexn">
  16. <view class='acea-row row-between-wrapper'>
  17. <view>
  18. <view class='name line1' v-if="vo.linkType === 'withdraw'">提现操作</view>
  19. <view class='name line1' v-if="vo.linkType === 'order'">订单消费</view>
  20. <view class='name line1' v-if="vo.linkType === 'recharge'">充值入账</view>
  21. <view class='name line1' v-if="vo.linkType === 'system'">系统后台</view>
  22. <view class='name line1' v-if="vo.linkType === 'brokerage'">佣金转余额</view>
  23. <view class='name line1' v-if="vo.linkType === 'svip'">购买VIO</view>
  24. <view>{{vo.createTime}}</view>
  25. </view>
  26. <view class="right-box">
  27. <view class='num font_color' v-if="vo.type == 1"><span style="font-size: 15px;color: #999;">+sL</span> {{vo.amount}}</view>
  28. <view class='num' v-else><span style="font-size: 15px;color: #999;">-sL</span> {{vo.amount}}</view>
  29. <!-- 状态标签示例,请自行添加判断逻辑 -->
  30. <!-- <view class="status-txt success">提现成功</view> -->
  31. <!-- <view class="status-txt processing">提现中</view> -->
  32. <!-- <view class="status-txt failure">提现失败</view> -->
  33. <view class="status-txt success" v-if="vo.withdrawStatus === 1">提现成功</view>
  34. <view class="status-txt processing" v-if="vo.withdrawStatus === 0">提现中</view>
  35. <view class="status-txt failure" v-if="vo.withdrawStatus === 2">提现失败</view>
  36. </view>
  37. </view>
  38. <view class="remark">说明:{{vo.remark}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class='loadingicon acea-row row-center-wrapper'>
  44. <text class='loading iconfont icon-jiazai'
  45. :hidden='loading==false'></text>{{userBillList.length > 0?loadTitle:''}}
  46. </view>
  47. <view v-if="userBillList.length == 0 && !loading">
  48. <emptyPage title="暂无账单的记录哦~" :imgSrc="urlDomain+'crmebimage/presets/noJilu.png'"></emptyPage>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. // +----------------------------------------------------------------------
  56. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  57. // +----------------------------------------------------------------------
  58. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  59. // +----------------------------------------------------------------------
  60. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  61. // +----------------------------------------------------------------------
  62. // | Author: CRMEB Team <admin@crmeb.com>
  63. // +----------------------------------------------------------------------
  64. import {
  65. getBillList
  66. } from '@/api/user.js';
  67. import {
  68. toLogin
  69. } from '@/libs/login.js';
  70. import {
  71. mapGetters
  72. } from "vuex";
  73. import emptyPage from '@/components/emptyPage.vue';
  74. let app = getApp();
  75. export default {
  76. components: {
  77. emptyPage
  78. },
  79. data() {
  80. return {
  81. urlDomain: this.$Cache.get("imgHost"),
  82. loadTitle: '加载更多',
  83. loading: true,
  84. loadend: false,
  85. page: 1,
  86. limit: 12,
  87. type: 'all',
  88. userBillList: [],
  89. theme: app.globalData.theme,
  90. };
  91. },
  92. computed: mapGetters(['isLogin']),
  93. onShow() {
  94. if (this.isLogin) {
  95. this.getUserBillList();
  96. } else {
  97. toLogin();
  98. }
  99. },
  100. /**
  101. * 生命周期函数--监听页面加载
  102. */
  103. onLoad: function(options) {
  104. this.type = options.type;
  105. },
  106. /**
  107. * 页面上拉触底事件的处理函数
  108. */
  109. onReachBottom: function() {
  110. this.getUserBillList();
  111. },
  112. methods: {
  113. remarkFormat: function(remark,rate) {
  114. return remark.replace(/\d+(\.\d+)?/g, rate).replace("元"," sLGNS").replace("余额","余额 ");
  115. },
  116. /**
  117. * 获取账户明细
  118. */
  119. getUserBillList: function() {
  120. let that = this;
  121. if (that.loadend) return;
  122. that.loading = true;
  123. that.loadTitle = "";
  124. let data = {
  125. page: that.page,
  126. limit: that.limit,
  127. type: that.type
  128. }
  129. getBillList(data).then(function(res) {
  130. let list = res.data.list ? res.data.list : [],
  131. loadend = res.data.totalPage <= that.page;
  132. for (let i = 0; i < list.length; i++) {
  133. let time1 = list[i].month;
  134. let array1 = list[i].list;
  135. let isEquals = false;
  136. for (let j = 0; j < that.userBillList.length; j++) {
  137. let time2 = that.userBillList[j].month;
  138. let array2 = that.userBillList[j].list;
  139. if (time1 == time2) {
  140. array2.push.apply(array2, array1);
  141. that.userBillList[j].list = array2;
  142. isEquals = true;
  143. break;
  144. }
  145. }
  146. if (!isEquals) {
  147. that.userBillList.push({
  148. month: time1,
  149. list: array1
  150. })
  151. }
  152. }
  153. that.$set(that, 'userBillList', that.userBillList);
  154. that.page += 1;
  155. that.loadend = loadend;
  156. that.loadTitle = loadend ? "到底了~~" : "加载更多";
  157. that.loading = false;
  158. }, function(res) {
  159. that.loadTitle = '加载更多';
  160. that.loading = false;
  161. });
  162. },
  163. /**
  164. * 切换导航
  165. */
  166. changeType: function(type) {
  167. this.type = type;
  168. this.loadend = false;
  169. this.page = 1;
  170. this.$set(this, 'userBillList', []);
  171. this.getUserBillList();
  172. },
  173. }
  174. }
  175. </script>
  176. <style scoped lang='scss'>
  177. .remark {
  178. font-size: 24rpx;
  179. margin-top: 10rpx;
  180. }
  181. .bill-details .nav {
  182. background-color: #fff;
  183. height: 90rpx;
  184. width: 100%;
  185. line-height: 90rpx;
  186. }
  187. .bill-details .nav .item {
  188. flex: 1;
  189. text-align: center;
  190. font-size: 30rpx;
  191. color: #282828;
  192. }
  193. .bill-details .nav .item.on {
  194. @include main_color(theme);
  195. @include tab_border_bottom(theme);
  196. }
  197. .font_color {
  198. color: #E93323 !important;
  199. }
  200. .right-box {
  201. display: flex;
  202. flex-direction: column;
  203. align-items: flex-end;
  204. .num {
  205. margin-bottom: 5rpx;
  206. }
  207. .status-txt {
  208. font-size: 28rpx;
  209. &.success {
  210. color: #0987fc; // 绿色
  211. }
  212. &.processing {
  213. color: #4B67AF; // 蓝色
  214. }
  215. &.failure {
  216. color: red; // 红色
  217. }
  218. }
  219. }
  220. </style>