index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="container">
  3. <view class="b">
  4. <view class="l">可提现金额:{{ cash }}</view>
  5. <view class="r">
  6. <view class="btn active" @tap="btnCashout" v-if="cash > 0">申请提现</view>
  7. </view>
  8. </view>
  9. <view class="no-order" v-if="list.length <= 0">
  10. <view class="c">
  11. <text>还没有任何提现记录呢</text>
  12. </view>
  13. </view>
  14. <view class="orders">
  15. <view class="order" v-for="(item, index) in list" :key="index">
  16. <view class="h">
  17. <view class="l">提现金额:{{ item.amount }}</view>
  18. <view class="r">状态:{{ item.status }}</view>
  19. </view>
  20. <view class="goods">
  21. <view class="info">
  22. <text class="number">申请时间:{{ item.addTime }}</text>
  23. <text class="number">备注:{{ item.confirmMemo }}</text>
  24. </view>
  25. <view class="status"></view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. var util = require('../../../../utils/util.js');
  33. var api = require('../../../../config/api.js');
  34. export default {
  35. data() {
  36. return {
  37. list: [],
  38. cash: 0,
  39. //可提现金额
  40. page: 1,
  41. limit: 10,
  42. totalPages: 1
  43. };
  44. },
  45. onLoad: function (options) {
  46. // 页面初始化 options为页面跳转所带来的参数
  47. this.setData({
  48. cash: options.m
  49. });
  50. this.getList();
  51. },
  52. onPullDownRefresh() {
  53. uni.showNavigationBarLoading(); //在标题栏中显示加载
  54. this.getList();
  55. uni.hideNavigationBarLoading(); //完成停止加载
  56. uni.stopPullDownRefresh(); //停止下拉刷新
  57. },
  58. onReady: function () {
  59. // 页面渲染完成
  60. },
  61. onShow: function () {
  62. // 页面显示
  63. },
  64. onHide: function () {
  65. // 页面隐藏
  66. },
  67. onUnload: function () {
  68. // 页面关闭
  69. },
  70. onReachBottom: function () {
  71. if (this.totalPages > this.page) {
  72. this.setData({
  73. page: this.page + 1
  74. });
  75. this.getList();
  76. } else {
  77. uni.showToast({
  78. title: '没有更多提现申请了',
  79. icon: 'none',
  80. duration: 2000
  81. });
  82. return false;
  83. }
  84. },
  85. methods: {
  86. getList: function () {
  87. uni.showLoading({
  88. title: '加载中'
  89. });
  90. setTimeout(function () {
  91. uni.hideLoading();
  92. }, 2000);
  93. let that = this;
  94. util.request(api.DisCashoutList, {
  95. page: that.page,
  96. limit: that.limit
  97. }).then(function (res) {
  98. if (res.errno === 0) {
  99. console.log(res.data);
  100. that.setData({
  101. list: that.list.concat(res.data.list),
  102. totalPages: res.data.pages
  103. });
  104. }
  105. uni.hideLoading();
  106. });
  107. },
  108. btnCashout: function () {
  109. //提现申请
  110. let that = this;
  111. uni.showModal({
  112. title: '',
  113. content: '确定要申请提现? 提现金额:' + that.cash,
  114. success: function (res) {
  115. if (res.confirm) {
  116. util.request(
  117. api.DisCashoutApply,
  118. {
  119. amount: that.cash
  120. },
  121. 'GET'
  122. ).then(function (res) {
  123. if (res.errno === 0) {
  124. uni.showToast({
  125. title: '提现申请成功,请等待管理员处理'
  126. });
  127. setTimeout(function () {
  128. that.setData({
  129. page: 1,
  130. limit: 0,
  131. list: [],
  132. cash: 0
  133. });
  134. that.getList();
  135. }, 2000);
  136. } else {
  137. util.showErrorToast(res.errmsg);
  138. }
  139. });
  140. }
  141. }
  142. });
  143. }
  144. }
  145. };
  146. </script>
  147. <style>
  148. page {
  149. height: 100%;
  150. width: 100%;
  151. background: #f4f4f4;
  152. }
  153. .orders-switch {
  154. width: 100%;
  155. background: #fff;
  156. height: 84rpx;
  157. /* border-bottom: 1px solid rgba(0,0,0,.15); */
  158. }
  159. .orders-switch .item {
  160. display: inline-block;
  161. height: 82rpx;
  162. width: 18%;
  163. padding: 0 15rpx;
  164. text-align: center;
  165. }
  166. .orders-switch .item .txt {
  167. display: inline-block;
  168. height: 82rpx;
  169. padding: 0 20rpx;
  170. line-height: 82rpx;
  171. color: #9a9ba1;
  172. font-size: 30rpx;
  173. width: 170rpx;
  174. }
  175. .orders-switch .item.active .txt {
  176. color: #ab956d;
  177. border-bottom: 4rpx solid #ab956d;
  178. }
  179. .no-order {
  180. width: 100%;
  181. height: auto;
  182. margin: 0 auto;
  183. }
  184. .no-order .c {
  185. width: 100%;
  186. height: auto;
  187. margin-top: 400rpx;
  188. }
  189. .no-order .c text {
  190. margin: 0 auto;
  191. display: block;
  192. width: 258rpx;
  193. height: 29rpx;
  194. line-height: 29rpx;
  195. text-align: center;
  196. font-size: 29rpx;
  197. color: #999;
  198. }
  199. .orders {
  200. height: auto;
  201. width: 100%;
  202. overflow: hidden;
  203. }
  204. .order {
  205. margin-top: 20rpx;
  206. background: #fff;
  207. }
  208. .order .h {
  209. height: 83.3rpx;
  210. line-height: 83.3rpx;
  211. margin-left: 31.25rpx;
  212. padding-right: 31.25rpx;
  213. border-bottom: 1px solid #f4f4f4;
  214. font-size: 30rpx;
  215. color: #333;
  216. }
  217. .order .h .l {
  218. float: left;
  219. }
  220. .order .h .r {
  221. float: right;
  222. color: #b4282d;
  223. font-size: 24rpx;
  224. }
  225. .order .goods {
  226. display: flex;
  227. align-items: center;
  228. height: 159rpx;
  229. margin-left: 31.25rpx;
  230. }
  231. .order .goods .info {
  232. height: 105.83rpx;
  233. flex: 1;
  234. padding-left: 20rpx;
  235. }
  236. .order .goods .name {
  237. display: block;
  238. height: 44rpx;
  239. line-height: 44rpx;
  240. color: #333;
  241. font-size: 30rpx;
  242. }
  243. .order .goods .number {
  244. display: block;
  245. height: 37rpx;
  246. line-height: 37rpx;
  247. color: #666;
  248. font-size: 25rpx;
  249. }
  250. .order .goods .status {
  251. width: 105rpx;
  252. color: #b4282d;
  253. font-size: 25rpx;
  254. }
  255. .b {
  256. height: 103rpx;
  257. line-height: 53rpx;
  258. padding-left: 31.25rpx;
  259. padding-top: 20rpx;
  260. padding-right: 31.25rpx;
  261. border-top: 1px solid #f4f4f4;
  262. font-size: 30rpx;
  263. background: #fff;
  264. }
  265. .b .l {
  266. float: left;
  267. }
  268. .b .r {
  269. float: right;
  270. color: red;
  271. }
  272. .btn {
  273. height: 64.5rpx;
  274. line-height: 64.5rpx;
  275. text-align: center;
  276. padding: 0 20rpx;
  277. border-radius: 5rpx;
  278. font-size: 28rpx;
  279. color: #fff;
  280. background: #b4282d;
  281. }
  282. </style>