index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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">{{ item.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 + item.serviceMoney).toFixed(2) }}</text>
  79. </view>
  80. <view class="item" v-if="item.serviceMoney">
  81. <text class="tt">服务费</text>
  82. <text class="la">¥{{ item.serviceMoney }}</text>
  83. </view>
  84. <view class="item" v-if="item.rate">
  85. <text class="tt">{{ item.type == 1 ? '兼职费率' : '提现费率' }}</text>
  86. <text class="la">{{ item.rate }}%</text>
  87. </view>
  88. <view class="item" v-if="item.type == 1">
  89. <text class="tt">实际扣除</text>
  90. <text class="la">¥{{ item.money }}</text>
  91. </view>
  92. <view class="item" v-if="item.type == 2">
  93. <text class="tt">实际到账</text>
  94. <text class="la">¥{{ item.money }}</text>
  95. </view>
  96. <view class="item">
  97. <text class="tt">操作状态</text>
  98. <text class="la" v-if="item.state == 0 && item.type == 0" style="color: #f44336">未支付</text>
  99. <text class="la" v-if="item.state == 1 && item.type == 0" style="color: #4caf50">充值成功</text>
  100. <text class="la" v-if="item.state == 1 && item.type == 1" style="color: #4caf50">支出成功</text>
  101. <text class="la" v-if="item.state == 0 && item.type == 2" style="color: #f44336">提现审核中...</text>
  102. <text class="la" v-if="item.state == 1 && item.type == 2" style="color: #4caf50">提现成功</text>
  103. <text class="la" v-if="item.state == 1 && item.type == 3" style="color: #4caf50">兼职收入</text>
  104. <text class="la" v-if="item.state == 2 && item.type == 2" style="color: #f44336">提现失败,退回余额</text>
  105. <text class="la" v-if="item.state == 1 && item.type == 4" style="color: #4caf50">退款成功</text>
  106. </view>
  107. <view class="item">
  108. <text class="tt">创建时间</text>
  109. <text class="la">{{ item.createTime }}</text>
  110. </view>
  111. <view class="item" v-if="item.completeTime">
  112. <text class="tt">审核时间</text>
  113. <text class="la">{{ item.completeTime }}</text>
  114. </view>
  115. </view>
  116. </view>
  117. </u-popup>
  118. </view>
  119. </template>
  120. <script>
  121. export default {
  122. data() {
  123. return {
  124. item: {},
  125. current: 0,
  126. type: [
  127. { name: '全部', value: '' },
  128. { name: '充值', value: 0 },
  129. { name: '支出', value: 1 },
  130. { name: '提现', value: 2 },
  131. { name: '收入', value: 3 },
  132. { name: '退款', value: 4 }
  133. ],
  134. list: [],
  135. param: { pageNum: 1, pageSize: 10 },
  136. loadMore: true,
  137. show: false,
  138. item: {}
  139. };
  140. },
  141. onLoad(e) {
  142. this.getInfo();
  143. this.getData();
  144. uni.$on('payMoney', (res) => {
  145. this.getInfo();
  146. this.refresh();
  147. });
  148. },
  149. methods: {
  150. getInfo() {
  151. this.http.request({
  152. url: '/app/user/info',
  153. success: (res) => {
  154. this.item = res.data.data;
  155. uni.setStorageSync('money', res.data.data.money || 0);
  156. }
  157. });
  158. },
  159. getData() {
  160. this.http.request({
  161. url: '/app/pay/list',
  162. data: this.param,
  163. loading: 'false',
  164. success: (res) => {
  165. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  166. this.list.push(...res.data.rows);
  167. }
  168. });
  169. },
  170. click(e) {
  171. this.param.type = e.value;
  172. this.refresh();
  173. },
  174. popup(item) {
  175. this.item = item;
  176. this.show = true;
  177. },
  178. go(url) {
  179. uni.navigateTo({ url: url });
  180. },
  181. //刷新数据
  182. refresh() {
  183. this.loadMore = true;
  184. this.param.pageNum = 1;
  185. this.list = [];
  186. this.getData();
  187. }
  188. },
  189. //下拉刷新
  190. onPullDownRefresh() {
  191. setTimeout(() => {
  192. this.refresh();
  193. this.getInfo();
  194. uni.stopPullDownRefresh();
  195. }, 1000);
  196. },
  197. //上拉加载
  198. onReachBottom() {
  199. if (this.loadMore) {
  200. this.param.pageNum++;
  201. this.getData();
  202. }
  203. }
  204. };
  205. </script>
  206. <style lang="scss">
  207. .main {
  208. padding-top: 5px;
  209. }
  210. .tips {
  211. border-radius: 5px;
  212. margin-bottom: 8px;
  213. }
  214. .list {
  215. background-color: white;
  216. border-radius: 8px;
  217. padding: 15px 15px 15px 15px;
  218. .item {
  219. padding: 15px 0px 15px 0px;
  220. border-bottom: 1px solid $line;
  221. padding-bottom: 10px;
  222. &:first-child {
  223. padding-top: 0px;
  224. }
  225. &:last-child {
  226. border: 0px;
  227. padding-bottom: 5px;
  228. }
  229. .title {
  230. width: 70%;
  231. }
  232. .desc {
  233. font-size: 14px;
  234. padding-top: 5px;
  235. color: $font-c;
  236. text {
  237. padding-right: 15px;
  238. }
  239. }
  240. .price {
  241. float: right;
  242. margin-top: -48px;
  243. }
  244. }
  245. }
  246. </style>