index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <block>
  3. <view class="content">
  4. <view class="cashInfo">
  5. <view class="cTitle">提现金额</view>
  6. <view class="cPrice" style="font-size: 24rpx;">
  7. <view>
  8. 可提现金额
  9. <text class="cWeight">{{ info.money }}</text>
  10. </view>
  11. <view @tap="cashAll">全部提现</view>
  12. </view>
  13. </view>
  14. <view class="cInput">
  15. <view>¥</view>
  16. <input type="number" @input="cashinput" placeholder="请输入提现金额" placeholder-class="placeClass"
  17. :value="cashmoney" />
  18. </view>
  19. <!-- <view class="cItem">
  20. <view class="cTip">
  21. <view>税收(6%):</view>
  22. <view>*平台代缴纳</view>
  23. </view>
  24. <view class="cNum">¥{{lessMoney}}</view>
  25. </view>
  26. <view class="cItem">
  27. <view class="cTip">
  28. <view>实际到账:</view>
  29. </view>
  30. <view class="cNum">¥{{realMoney}}</view>
  31. </view> -->
  32. <view class="cItem">
  33. <view class="cTip">
  34. <view>到账银行卡:</view>
  35. </view>
  36. <picker v-if="banklist.length" mode="selector" @change="bindBankConfirm" range-key="showtitle"
  37. :value="bankindex" :range="banklist">
  38. <view class="cNum fweigh">{{ bankTitle ? bankTitle : '请选择提现银行卡' }}</view>
  39. </picker>
  40. <view class="cNum fweigh" v-else @tap="toPage" data-url="/pages/Withdrawal/addbank" :data-type="type">
  41. {{ bankTitle ? bankTitle : '请先添加银行卡' }}</view>
  42. <image v-if="banklist.length"
  43. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/3c95e397fd285160c474c52ed2e3e4d1.png"
  44. mode="widthFix" class="leftArrow"></image>
  45. </view>
  46. </view>
  47. <view class="btn" @tap="confirm">立即提现</view>
  48. </block>
  49. </template>
  50. <script>
  51. var app = getApp(); // a = app.requirejs('core');
  52. var loading = false;
  53. export default {
  54. data() {
  55. return {
  56. info: {
  57. money: ''
  58. },
  59. cashmoney: '',
  60. banklist: [],
  61. bankindex: 0,
  62. bankTitle: '',
  63. name: '',
  64. lessMoney:0,
  65. realMoney:0
  66. };
  67. },
  68. onLoad: function(e) {},
  69. onShow() {
  70. this.getinfo();
  71. this.getbank();
  72. },
  73. onPullDownRefresh: function() {},
  74. onReachBottom: function() {},
  75. methods: {
  76. async confirm() {
  77. var that = this;
  78. if (!this.cashmoney) {
  79. uni.showToast({
  80. title: '请先填写提现金额',
  81. icon: 'none'
  82. });
  83. return false;
  84. }
  85. if (!this.bankTitle) {
  86. uni.showToast({
  87. title: '请先选择银行卡',
  88. icon: 'none'
  89. });
  90. return false;
  91. }
  92. let result = await this.$api.request('/withdraw/add', 'POST', {money:that.cashmoney,bid:that.banklist[that.bankindex].id});
  93. console.log(result)
  94. if (result) {
  95. this.$api.msg('添加成功');
  96. uni.redirectTo({
  97. url:'/pages/wallet/index'
  98. })
  99. }
  100. },
  101. bindBankConfirm(e) {
  102. console.log(e);
  103. this.bankindex = e.detail.value,
  104. this.bankTitle = this.banklist[e.detail.value].showtitle
  105. },
  106. async getbank() {
  107. var that = this;
  108. let res = await this.$api.request('/bank/index', 'GET', {
  109. page: 1,
  110. pagesize: 20
  111. });
  112. console.log(res)
  113. if (res) {
  114. if (res.length > 0) {
  115. res.map(function(item) {
  116. return item.showtitle = item.bank + '(' + item.card.substr(item.card.length - 4) +
  117. ')'
  118. })
  119. this.banklist = this.banklist.concat(res);
  120. this.page++;
  121. } else {
  122. this.loaded = true
  123. this.$api.msg('没有更多数据');
  124. }
  125. }
  126. },
  127. toPage(e) {
  128. app.globalData.toPage(e);
  129. },
  130. cashAll() {
  131. this.cashmoney = this.info.money
  132. },
  133. cashinput(e) {
  134. this.cashmoney = e.detail.value
  135. },
  136. async getinfo() {
  137. let data = await this.$api.request('/wallet/index');
  138. console.log(data)
  139. this.info = data;
  140. },
  141. }
  142. };
  143. </script>
  144. <style>
  145. page {
  146. background: #f4f5f9;
  147. }
  148. .content {
  149. padding: 36rpx 44rpx 0;
  150. background: #fff;
  151. }
  152. .cashInfo {
  153. display: flex;
  154. align-items: center;
  155. padding-bottom: 60rpx;
  156. justify-content: space-between;
  157. }
  158. .cTitle {
  159. font-size: 28rpx;
  160. font-weight: 700;
  161. }
  162. .cPrice {
  163. display: flex;
  164. align-items: center;
  165. }
  166. .cPrice>view:nth-child(2) {
  167. color: #253f8e;
  168. margin-left: 30rpx;
  169. }
  170. .cWeight {
  171. font-weight: 700;
  172. font-size: 30rpx;
  173. }
  174. .cInput {
  175. display: flex;
  176. align-items: center;
  177. padding-bottom: 30rpx;
  178. border-bottom: 1px solid #e4e5ee;
  179. }
  180. .cInput>view {
  181. font-size: 54rpx;
  182. color: #011b33;
  183. font-weight: 700;
  184. }
  185. .cInput>input {
  186. font-size: 54rpx;
  187. color: #011b33;
  188. font-weight: 700;
  189. }
  190. .placeClass {
  191. font-size: 35rpx;
  192. font-weight: 500;
  193. padding-left: 40rpx;
  194. }
  195. .cItem {
  196. padding: 30rpx 0;
  197. border-bottom: 1px solid #e4e5ee;
  198. display: flex;
  199. align-items: center;
  200. position: relative;
  201. }
  202. .cItem:last-child {
  203. border-bottom: none;
  204. }
  205. .cTip>view:nth-child(1) {
  206. font-size: 28rpx;
  207. }
  208. .cTip>view:nth-child(2) {
  209. margin-top: 8rpx;
  210. color: #ff4c34;
  211. font-size: 22rpx;
  212. }
  213. .cNum {
  214. margin-left: 40rpx;
  215. font-size: 36rpx;
  216. }
  217. .fweigh {
  218. font-size: 28rpx;
  219. font-weight: 700;
  220. }
  221. .leftArrow {
  222. position: absolute;
  223. right: 0;
  224. width: 14rpx;
  225. }
  226. .btn {
  227. width: 614rpx;
  228. height: 88rpx;
  229. display: flex;
  230. align-items: center;
  231. justify-content: center;
  232. background: linear-gradient(to right, #F8A52B, #F8C657);
  233. color: #fff;
  234. font-size: 30rpx;
  235. border-radius: 40rpx;
  236. margin: 72rpx auto;
  237. }
  238. picker {
  239. flex: 1;
  240. }
  241. view {
  242. font-size: 24rpx;
  243. }
  244. </style>