index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view class="main">
  3. <view class="tips">
  4. <text class="icon">&#xe694;</text>
  5. <text>账户余额保障中</text>
  6. </view>
  7. <view class="mcard">
  8. <view class="money">{{ money }}</view>
  9. <view class="desc">账户余额(元)</view>
  10. <view class="flex">
  11. <view class="f">
  12. <button class="btn" style="background-color: #607d8b" @click="go('/pages/user/money/cash_out')">
  13. <text class="icon">&#xe612;</text>
  14. <text>提现</text>
  15. </button>
  16. </view>
  17. <view class="f">
  18. <button class="btn" @click="go('/pages/user/money/add')">
  19. <text class="icon">&#xe7c4;</text>
  20. <text>充值</text>
  21. </button>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="tab">
  26. <u-tabs :list="type" @click="click($event, 'type')"></u-tabs>
  27. </view>
  28. <view class="list">
  29. <view class="item" v-for="(item, index) in list" :key="index" @click="popup(item)">
  30. <view class="title">{{ item.title }}</view>
  31. <view class="desc">
  32. <text v-if="item.state == 0 && item.type == 0" style="color: #f44336">未支付</text>
  33. <text v-if="item.state == 1 && item.type == 0" style="color: #4caf50">充值成功</text>
  34. <text v-if="item.state == 1 && item.type == 1" style="color: #4caf50">兼职支出</text>
  35. <text v-if="item.state == 0 && item.type == 2" style="color: #f44336">提现审核中...</text>
  36. <text v-if="item.state == 1 && item.type == 2" style="color: #4caf50">提现成功</text>
  37. <text v-if="item.state == 1 && item.type == 3" style="color: #4caf50">兼职收入</text>
  38. <text v-if="item.state == 2 && item.type == 2" style="color: #f44336">
  39. <text class="icon" style="padding-right: 5px">&#xe610;</text>
  40. <text>提现失败,退回余额</text>
  41. </text>
  42. <text v-if="item.state == 1 && item.type == 4" style="color: #4caf50">退款成功</text>
  43. <text>{{ item.createTime }}</text>
  44. </view>
  45. <view class="price">
  46. <text v-if="item.type == 0 || item.type == 3 || item.type == 4" style="color: orangered">+{{ item.money }}元</text>
  47. <text v-if="item.type == 1" style="color: darkgray">-{{ item.money }}元</text>
  48. <text v-if="item.type == 2 && item.state == 0" style="color: darkgray">-{{ item.money }}元</text>
  49. <text v-if="item.type == 2 && item.state == 1" style="color: darkgray">-{{ item.money }}元</text>
  50. <text v-if="item.type == 2 && item.state == 2" style="color: #f44336">+{{ item.money }}元</text>
  51. </view>
  52. </view>
  53. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  54. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  55. </view>
  56. <u-popup :show="show" round="15" mode="center" :closeable="true" :customStyle="{ width: '85%' }" @close="show = false">
  57. <view class="popup">
  58. <view class="mtt" v-if="item.type == 0">在线充值</view>
  59. <view class="mtt" v-if="item.type == 1">兼职支出</view>
  60. <view class="mtt" v-if="item.type == 2">余额提现</view>
  61. <view class="mtt" v-if="item.type == 3">兼职收入</view>
  62. <view class="mtt" v-if="item.type == 4">余额退款</view>
  63. <view>
  64. <view class="item">
  65. <text class="tt">操作内容</text>
  66. <text class="la">{{ item.title }}</text>
  67. </view>
  68. <view class="item" v-if="item.type == 0">
  69. <text class="tt">充值金额</text>
  70. <text class="la">¥{{ item.money }}</text>
  71. </view>
  72. <view class="item" v-if="item.type == 1">
  73. <text class="tt">兼职金额</text>
  74. <text class="la">¥{{ (item.money - item.serviceMoney).toFixed(2) }}</text>
  75. </view>
  76. <view class="item" v-if="item.type == 2">
  77. <text class="tt">提现金额</text>
  78. <text class="la">¥{{ item.money }}</text>
  79. </view>
  80. <view class="item" v-if="item.type == 3">
  81. <text class="tt">收入金额</text>
  82. <text class="la">¥{{ item.money }}</text>
  83. </view>
  84. <view class="item" v-if="item.type == 4">
  85. <text class="tt">兼职金额</text>
  86. <text class="la">¥{{ item.money }}</text>
  87. </view>
  88. <view class="item" v-if="item.serviceMoney">
  89. <text class="tt">服务费</text>
  90. <text class="la">¥{{ item.serviceMoney }}</text>
  91. </view>
  92. <view class="item" v-if="item.rate">
  93. <text class="tt">{{ item.type == 1 ? '兼职费率' : '提现费率' }}</text>
  94. <text class="la">{{ item.rate }}%</text>
  95. </view>
  96. <view class="item" v-if="item.type == 1">
  97. <text class="tt">实际扣除</text>
  98. <text class="la">¥{{ item.money }}</text>
  99. </view>
  100. <view class="item" v-if="item.type == 2">
  101. <text class="tt">实际到账</text>
  102. <text class="la">¥{{ (item.money - item.serviceMoney).toFixed(2) }}</text>
  103. </view>
  104. <view class="item">
  105. <text class="tt">操作状态</text>
  106. <text class="la" v-if="item.state == 0 && item.type == 0" style="color: #f44336">未支付</text>
  107. <text class="la" v-if="item.state == 1 && item.type == 0" style="color: #4caf50">充值成功</text>
  108. <text class="la" v-if="item.state == 1 && item.type == 1" style="color: #4caf50">支出成功</text>
  109. <text class="la" v-if="item.state == 0 && item.type == 2" style="color: #f44336">提现审核中...</text>
  110. <text class="la" v-if="item.state == 1 && item.type == 2" style="color: #4caf50">提现成功</text>
  111. <text class="la" v-if="item.state == 1 && item.type == 3" style="color: #4caf50">入账成功</text>
  112. <text class="la" v-if="item.state == 2 && item.type == 2" style="color: #f44336">提现失败,退回余额</text>
  113. <text class="la" v-if="item.state == 1 && item.type == 4" style="color: #4caf50">退款成功</text>
  114. </view>
  115. <view class="item" v-if="item.msg">
  116. <text class="tt">失败原因</text>
  117. <text class="la" style="color: #f44336">{{ item.msg }}</text>
  118. </view>
  119. <view class="item">
  120. <text class="tt">创建时间</text>
  121. <text class="la">{{ item.createTime }}</text>
  122. </view>
  123. <view class="item" v-if="item.completeTime">
  124. <text class="tt">审核时间</text>
  125. <text class="la">{{ item.completeTime }}</text>
  126. </view>
  127. </view>
  128. </view>
  129. </u-popup>
  130. </view>
  131. </template>
  132. <script>
  133. export default {
  134. data() {
  135. return {
  136. money: 0,
  137. current: 0,
  138. type: [
  139. { name: '全部', value: '' },
  140. { name: '充值', value: 0 },
  141. { name: '支出', value: 1 },
  142. { name: '提现', value: 2 },
  143. { name: '收入', value: 3 },
  144. { name: '退款', value: 4 }
  145. ],
  146. list: [],
  147. param: { pageNum: 1, pageSize: 10 },
  148. loadMore: true,
  149. show: false,
  150. item: {}
  151. };
  152. },
  153. onLoad(e) {
  154. this.getInfo();
  155. this.getData();
  156. uni.$on('payMoney', (res) => {
  157. this.getInfo();
  158. this.refresh();
  159. });
  160. },
  161. methods: {
  162. getInfo() {
  163. this.http.request({
  164. url: '/app/user/info',
  165. success: (res) => {
  166. this.money = res.data.data.money;
  167. uni.setStorageSync('money', res.data.data.money || 0);
  168. }
  169. });
  170. },
  171. getData() {
  172. this.http.request({
  173. url: '/app/pay/list',
  174. data: this.param,
  175. loading: 'false',
  176. success: (res) => {
  177. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  178. this.list.push(...res.data.rows);
  179. }
  180. });
  181. },
  182. click(e) {
  183. this.param.type = e.value;
  184. this.refresh();
  185. },
  186. popup(item) {
  187. this.item = item;
  188. this.show = true;
  189. },
  190. go(url) {
  191. uni.navigateTo({ url: url });
  192. },
  193. //刷新数据
  194. refresh() {
  195. this.loadMore = true;
  196. this.param.pageNum = 1;
  197. this.list = [];
  198. this.getData();
  199. }
  200. },
  201. //下拉刷新
  202. onPullDownRefresh() {
  203. setTimeout(() => {
  204. this.refresh();
  205. this.getInfo();
  206. uni.stopPullDownRefresh();
  207. }, 1000);
  208. },
  209. //上拉加载
  210. onReachBottom() {
  211. if (this.loadMore) {
  212. this.param.pageNum++;
  213. this.getData();
  214. }
  215. }
  216. };
  217. </script>
  218. <style lang="scss">
  219. .main {
  220. padding-top: 5px;
  221. }
  222. .tips {
  223. border-radius: 5px;
  224. margin-bottom: 8px;
  225. }
  226. .list {
  227. background-color: white;
  228. border-radius: 8px;
  229. padding: 15px 15px 15px 15px;
  230. .item {
  231. padding: 15px 0px 15px 0px;
  232. border-bottom: 1px solid $line;
  233. padding-bottom: 10px;
  234. &:first-child {
  235. padding-top: 0px;
  236. }
  237. &:last-child {
  238. border: 0px;
  239. padding-bottom: 5px;
  240. }
  241. .title {
  242. width: 70%;
  243. }
  244. .desc {
  245. font-size: 14px;
  246. padding-top: 5px;
  247. color: $font-c;
  248. text {
  249. padding-right: 15px;
  250. }
  251. }
  252. .price {
  253. float: right;
  254. margin-top: -48px;
  255. }
  256. }
  257. }
  258. </style>