withdraw.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <view class="item">
  5. <uni-list class="list">
  6. <uni-list-item title="选择提现方式"
  7. :show-arrow="true"
  8. :rightText="item.bank_name"
  9. :showArrow="true"
  10. @click="open"/>
  11. </uni-list>
  12. </view>
  13. <view class="main">
  14. <view class="main-content">
  15. <view class="msg">
  16. <text>提现金额</text>
  17. </view>
  18. <view class="msg-type">
  19. <text>¥</text>
  20. </view>
  21. <view class="msg-input">
  22. <input class="uni-input" type="number" @input="input" :value="amount" placeholder-class="placeholder" focus placeholder="请输提现金额"/>
  23. </view>
  24. <view class="msg-introduce">
  25. <text class="first">零钱余额¥{{user_info.money}},<text class="all" @tap="allWithDraw">全部提现</text></text>
  26. </view>
  27. <view class="button">
  28. <button class="withdraw" type="button" @tap="withdrawMoney">确认提现</button>
  29. </view>
  30. <view class="withdraw-msg">
  31. <text>提现手续费为{{withdraw.fee}},最低提现费用为{{withdraw.min_amount}}元</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <uni-popup ref="popup" type="list">
  37. <uni-popup-list title="请选择渠道" @select="select" :bottomData ="bottomData" :selectList ="selectList"></uni-popup-list>
  38. </uni-popup>
  39. </view>
  40. </template>
  41. <script>
  42. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  43. import UniPopupList from '@/components/uni-popup/uni-popup-list.vue';
  44. import _get from '../../../common/_get';
  45. import _hook from '../../../common/_hook';
  46. import _data from '../../../common/_data';
  47. export default {
  48. data() {
  49. return {
  50. item:{
  51. bank_name:'请选择提现方式'
  52. },
  53. user_info:{
  54. money:0.00
  55. },
  56. withdraw:{
  57. fee:'0%',
  58. min_amount:0
  59. },
  60. bottomData:[],
  61. amount:"",
  62. selectList:0,
  63. }
  64. },
  65. components:{
  66. uniPopup,
  67. UniPopupList
  68. },
  69. onShow(){
  70. let _this = this;
  71. _hook.routeTabBarHook();
  72. _this.user_info = _data.data('user_info');
  73. /** 监听新的个人数据 */
  74. uni.$on('data_user_info', function (data) {
  75. _this.user_info = data;
  76. });
  77. _this.getUserbankList();
  78. uni.$on("update_bank_list_data",this.updateBankList);
  79. _get.getWithDrawConfig({},function (ret) {
  80. _this.withdraw.min_amount = ret.user_min_withdraw;
  81. _this.withdraw.fee = ret.user_withdraw_fee * 100 + "%";
  82. });
  83. },
  84. methods: {
  85. open(){
  86. this.$refs.popup.open()
  87. },
  88. updateBankList(bank){
  89. return bank && this.bottomData.concat([{
  90. 'bank_name':bank.bank_name,
  91. 'bank_info':bank.bank_info,
  92. 'account':bank.account,
  93. 'id':bank.id,
  94. 'icon':'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-8.png',
  95. }])
  96. },
  97. getUserbankList(){
  98. let _this = this;
  99. _get.getUserbankList({},function (data) {
  100. _this.bottomData = data;
  101. if(_this.bottomData.length){
  102. _this.selectList = _this.bottomData[0].id;
  103. _this.bottomData = _this.bottomData.map(item => {
  104. return {
  105. 'bank_name':item.bank_name,
  106. 'bank_info':item.bank_info,
  107. 'account':item.account,
  108. 'id':item.id,
  109. 'icon':'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-8.png',
  110. }
  111. })
  112. }
  113. })
  114. },
  115. select(val,cb){
  116. if(!this.bottomData.length){
  117. uni.navigateTo({
  118. 'url':'alipay_set'
  119. });
  120. return false;
  121. }
  122. this.item = val;
  123. this.selectList = val.id;
  124. console.log(this.item)
  125. if(cb){
  126. cb();
  127. }
  128. },
  129. input(e){
  130. console.log(e.detail.value)
  131. return this.amount = e.detail.value;
  132. },
  133. withdrawMoney(){
  134. //微信和支付宝待
  135. if(!this.item.id)return uni.showToast({'title':'最选择提现方式','icon':'none'});
  136. if(this.amount < this.withdraw.min_amount)
  137. return uni.showToast({'title':'最少提现'+this.withdraw.min_amount+'元','icon':'none'});
  138. _get.withDrawMoney({amount:this.amount,'bank_id':this.item.id},function (ret) {
  139. uni.showToast({
  140. title: '提现成功,请等待审核',
  141. duration: 1000,
  142. icon:"none"
  143. });
  144. },function (ret) {
  145. uni.showToast({
  146. title: ret.msg,
  147. duration: 1000,
  148. icon:"none"
  149. });
  150. })
  151. },
  152. allWithDraw(){
  153. return this.amount = this.user_info.money;
  154. }
  155. }
  156. }
  157. </script>
  158. <style>
  159. .main-content .msg-type text{
  160. font-size: 20px !important;
  161. font-weight: 600;
  162. }
  163. .main-content .msg{
  164. font-weight: 500;
  165. font-size: 16px;
  166. }
  167. .main-content .msg,.msg-type,.msg-input,.msg-introduce,.withdraw-msg{
  168. margin-left: 40upx;
  169. padding-bottom: 30upx;
  170. }
  171. .msg-introduce .first,.withdraw-msg text{
  172. color: #929292;
  173. /*626880*/
  174. }
  175. .main-content .button{
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. padding-bottom: 30upx;
  180. }
  181. .withdraw{
  182. background-color: #5693ee;
  183. color: white;
  184. height: 80upx;
  185. line-height: 80upx;
  186. border-radius: 50upx;
  187. width: 90%;
  188. }
  189. .msg-introduce .all{
  190. color: #5f5c77;
  191. margin-left: 40upx;
  192. }
  193. .content .list{
  194. margin-top: 25upx;
  195. }
  196. .content .main{
  197. display: flex;
  198. padding: 10upx;
  199. margin-top: 20upx;
  200. justify-content: center;
  201. align-items: center;
  202. }
  203. .main .main-content{
  204. display: flex;
  205. width: 95%;
  206. background-color: white;
  207. flex-direction: column;
  208. border-radius: 5upx;
  209. padding-top: 40upx;
  210. padding-bottom: 40upx;
  211. }
  212. .uni-input{
  213. border-bottom: 1px solid #f2f2f2;
  214. padding-left: 0px !important;
  215. width: 90%;
  216. font-size: 18px;
  217. }
  218. .uni-list-item__extra-text{
  219. font-size: 14px !important;
  220. margin-right: 20upx;
  221. }
  222. </style>