index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="balance">
  3. <view class="header-box">
  4. <view class="balance-header">
  5. <view class="header-top">
  6. <view class="price-left">
  7. <text>{{ financeInfo.voucherWithdrawal || 0 }}</text>
  8. <text>可提现</text>
  9. </view>
  10. <view class="price-right" @click="navigateTo(`/pages_module/withdrawal/index`)">提现</view>
  11. </view>
  12. <view class="header-bottom">
  13. <view class="text-box">
  14. <text>提现中</text>
  15. <text>{{ financeInfo.voucherWithdrawalIn || 0 }}</text>
  16. </view>
  17. <view class="text-box">
  18. <text>已提现</text>
  19. <text>{{ financeInfo.voucherWithdrawn }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="header-tool">
  24. <view class="tool-item" @click="goShow(1)">去充值</view>
  25. <view class="tool-item" @click="goShow(0)">去转赠</view>
  26. </view>
  27. </view>
  28. <view class="balance-container">
  29. <view class="text-tab">
  30. <view
  31. v-for="(item, index) in tabList"
  32. :key="item"
  33. :class="idx == index ? 'active' : ''"
  34. @click="changeTab(index)"
  35. >{{ item }}</view
  36. >
  37. </view>
  38. <view v-show="idx == 0">
  39. <template v-if="recordList.length > 0">
  40. <view class="record-list">
  41. <view class="record-item" v-for="item in recordList" :key="item">
  42. <view class="item-left">
  43. <text>提现支出</text>
  44. <text>{{ item.time }}</text>
  45. </view>
  46. <template v-if="item.state == 0">
  47. <view class="item-right">+{{ item.income }}</view>
  48. </template>
  49. <template v-else>
  50. <view class="item-right">-{{ item.expenditure }}</view>
  51. </template>
  52. </view>
  53. <view class="no-more">没有更多啦</view>
  54. </view>
  55. </template>
  56. <template v-else>
  57. <view class="empty">
  58. <image class="" src="@/static/image/order/empty.png" />
  59. <text>暂无提现记录</text>
  60. </view>
  61. </template>
  62. </view>
  63. <view v-show="idx == 1">
  64. <template v-if="withdrawalList.length > 0">
  65. <view class="record-list">
  66. <view
  67. class="record-item"
  68. v-for="item in withdrawalList"
  69. :key="item"
  70. >
  71. <view class="item-left">
  72. <text>提现支出</text>
  73. <text>{{ item.time }}</text>
  74. </view>
  75. <template v-if="item.state == 0">
  76. <view class="item-right">+{{ item.income }}</view>
  77. </template>
  78. <template v-else>
  79. <view class="item-right">-{{ item.expenditure }}</view>
  80. </template>
  81. </view>
  82. <view class="no-more">没有更多啦</view>
  83. </view>
  84. </template>
  85. <template v-else>
  86. <view class="empty">
  87. <image class="" src="@/static/image/order/empty.png" />
  88. <text>暂无提现记录</text>
  89. </view>
  90. </template>
  91. </view>
  92. </view>
  93. <tui-bottom-popup
  94. :zIndex="1000"
  95. backgroundColor="#FFFFFF"
  96. :show="showPopup"
  97. @close="clonePopup"
  98. >
  99. <template v-if="isShowComponent == 0">
  100. <transferPopup
  101. :voucherWithdrawalIn="financeInfo.voucherWithdrawalIn"
  102. @cancel="clonePopup"
  103. />
  104. </template>
  105. <template v-else>
  106. <rechargePopup @cancel="clonePopup" />
  107. </template>
  108. </tui-bottom-popup>
  109. </view>
  110. </template>
  111. <script>
  112. import { getFinanceCount, getWithdrawal } from "@/config/index.js";
  113. import transferPopup from "./components/transferPopup/index.vue";
  114. import rechargePopup from "./components/rechargePopup/index.vue";
  115. export default {
  116. onLoad(option) {
  117. // 获取流水接口
  118. this.getFinance();
  119. // 获取提现记录
  120. this.getWithList();
  121. },
  122. components: {
  123. transferPopup,
  124. rechargePopup,
  125. },
  126. data() {
  127. return {
  128. idx: 0,
  129. tabList: ["收支明细", "提现记录"],
  130. // 提现记录的请求参数
  131. queryData: {
  132. page: 1,
  133. pageSize: 10,
  134. withdrawalType: 3,
  135. },
  136. // 提现记录的请求参数
  137. withdeQuery: {
  138. page: 1,
  139. pageSize: 10,
  140. withdrawalType: 3,
  141. },
  142. // 提现记录列表
  143. withdrawalList: [],
  144. // 流水信息
  145. financeInfo: {},
  146. // 收支明细列表
  147. recordList: [],
  148. // 控制 转赠 弹框
  149. showPopup: false,
  150. // 控制显示组件
  151. isShowComponent: 1,
  152. };
  153. },
  154. methods: {
  155. // 获取流水
  156. async getFinance() {
  157. this.$loading.show("加载中");
  158. try {
  159. let res = await getFinanceCount(this.queryData);
  160. this.financeInfo = res.data;
  161. // 对于数据进行处理 如果有支出的话就加上这一个支出
  162. let list = res.data.finances.reduce((prev, item, index) => {
  163. prev.push({ ...item, state: 0 });
  164. if (item.expenditure > 0) {
  165. prev.push({ ...item });
  166. }
  167. return prev;
  168. }, []);
  169. this.recordList = list;
  170. } finally {
  171. this.$loading.hide();
  172. }
  173. },
  174. // 获取体现记录
  175. async getWithList() {
  176. let res = await getWithdrawal(this.withdeQuery);
  177. this.withdrawalList = res.data;
  178. console.log(res);
  179. },
  180. // 获取体现记录
  181. changeTab(idx) {
  182. this.idx = idx;
  183. },
  184. // 关闭转赠弹框
  185. clonePopup() {
  186. this.showPopup = false;
  187. },
  188. goShow(val) {
  189. this.isShowComponent = val;
  190. this.showPopup = true;
  191. },
  192. },
  193. };
  194. </script>
  195. <style lang="scss" scoped>
  196. @import "./index.scss";
  197. </style>