withdrawal.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view class="content">
  3. <!-- <uni-notice-bar single="true" text="每月25号到月底可提现上月结算余额"></uni-notice-bar> -->
  4. <view class="content-money">
  5. <view class="flex ">
  6. <view class="buttom">
  7. <view class="icon">{{ money | getMoneyStyle }}</view>
  8. <text class="text">可提现金额</text>
  9. </view>
  10. <view class="interval"></view>
  11. <view class="buttom">
  12. <view class=" icon">{{ freeze | getMoneyStyle }}</view>
  13. <text class="text">待审核提现金额</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="row-box">
  18. <view class="title">提现金额</view>
  19. <view class="row">
  20. <text class="tit">¥</text>
  21. <input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'"
  22. placeholder-class="placeholder" />
  23. <view class="buttom" @click="withdrawal = money">全部提现</view>
  24. </view>
  25. </view>
  26. <!-- #ifndef MP-WEIXIN -->
  27. <view class="list">
  28. <radio-group @change="tabRadio">
  29. <!-- <label>
  30. <view class="box">
  31. <view class="icon iconfont iconweixin1"></view>
  32. <view class="title-box">
  33. <view class="title"><text>提现至微信</text></view>
  34. </view>
  35. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  36. </view>
  37. </label> -->
  38. <label>
  39. <view class="box">
  40. <view class="icon iconfont iconzhifubao"></view>
  41. <view class="title-box">
  42. <view class="title">
  43. <text v-if="aliData.name">提现至支付宝</text>
  44. <text v-else>请创建支付宝账号</text>
  45. </view>
  46. <view class="node">
  47. <text v-if="aliData.name">真实姓名({{ aliData.name }})</text>
  48. </view>
  49. </view>
  50. <view class="right">
  51. <radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" />
  52. </view>
  53. </view>
  54. </label>
  55. <label>
  56. <view class="box">
  57. <view class="icon iconfont">
  58. <image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image>
  59. </view>
  60. <view class="title-box">
  61. <view class="title">
  62. <text v-if="bankData.payment">{{ bankData.bank + ' ' + bankData.payment }}</text>
  63. <text v-else>请创建银行账号</text>
  64. </view>
  65. <view class="node">
  66. <text v-if="bankData.name">真实姓名({{ bankData.name }})</text>
  67. </view>
  68. </view>
  69. <view class="right">
  70. <radio value="bank" color="#5dbc7c" :checked="type == 'bank'" />
  71. </view>
  72. </view>
  73. </label>
  74. </radio-group>
  75. </view>
  76. <!-- #endif -->
  77. <button class="add-btn up" @click="confirm">提交申请</button>
  78. <button class="add-btn modified" @click="navTo('/pages/collection/collection')">账号管理</button>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. getMoneyStyle
  84. } from '@/utils/rocessor.js';
  85. import {
  86. extractCash,
  87. extractBank,
  88. pay_list
  89. } from '@/api/wallet.js';
  90. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  91. export default {
  92. filters: {
  93. getMoneyStyle
  94. },
  95. components: {
  96. uniNoticeBar
  97. },
  98. data() {
  99. return {
  100. way: 'now_money',
  101. type: 'ali', //提现方式
  102. money: '0.00', //可提现金额
  103. freeze: '0.0', //冻结金额
  104. withdrawal: '', //提现金额
  105. minPrice: '', //最少提现金额
  106. aliData: {},
  107. bankData: {},
  108. // #ifdef H5
  109. weichatBsrowser: false
  110. // #endif
  111. };
  112. },
  113. onLoad(options) {
  114. if (options.way) {
  115. this.way = options.way
  116. }
  117. // #ifdef H5
  118. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  119. // #endif
  120. //加载提现信息
  121. this.loadData();
  122. // 加载提款账号信息
  123. this.loadinfo();
  124. },
  125. methods: {
  126. //加载数据
  127. async loadinfo(source) {
  128. pay_list().then(({
  129. data
  130. }) => {
  131. this.aliData = data.zfb
  132. this.bankData = data.bank
  133. console.log(this.aliData, 7894513);
  134. })
  135. },
  136. // 加载余额信息
  137. async loadData() {
  138. extractBank({
  139. type: this.way
  140. }).then(({
  141. data
  142. }) => {
  143. this.money = data.commissionCount; //可提现余额
  144. this.minPrice = data.minPrice; //最小提现
  145. this.freeze = data.inmoneyCount //提现中的余额
  146. });
  147. },
  148. // 跳转
  149. navTo(url) {
  150. uni.navigateTo({
  151. url: url
  152. });
  153. },
  154. // 切换选中对象
  155. tabRadio(e) {
  156. this.type = e.detail.value;
  157. },
  158. // 提交
  159. confirm() {
  160. if (this.withdrawal * 1 % 1000 != 0) {
  161. return this.$api.msg('提现金额请输入1000的倍数')
  162. }
  163. let data = {
  164. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  165. money: this.withdrawal, //金额
  166. money_type: 1, //0佣金1余额
  167. type: this.way
  168. }
  169. if (this.type == 'alipay') {
  170. data.name = this.aliData.name;
  171. data.alipay_code = this.aliData.payment;
  172. }
  173. if (this.type == 'bank') {
  174. console.log(111);
  175. data.name = this.bankData.name;
  176. data.bankname = this.bankData.bank_name;
  177. data.cardnum = this.bankData.payment;
  178. }
  179. console.log(data, 'info');
  180. extractCash(data)
  181. .then(e => {
  182. uni.showToast({
  183. title: '提交成功',
  184. duration: 2000,
  185. position: 'top'
  186. });
  187. })
  188. .catch(e => {
  189. console.log();
  190. });
  191. }
  192. }
  193. };
  194. </script>
  195. <style lang="scss">
  196. page {
  197. height: 100%;
  198. }
  199. .content-money {
  200. padding: 30rpx 0;
  201. background: #ffffff;
  202. }
  203. .flex {
  204. background-color: #ffffff;
  205. text-align: center;
  206. margin: 0 30rpx;
  207. border-radius: $border-radius-sm;
  208. .buttom {
  209. font-size: $font-lg;
  210. color: $font-color-dark;
  211. width: 50%;
  212. }
  213. .interval {
  214. width: 2px;
  215. height: 60rpx;
  216. background-color: #eeeeee;
  217. }
  218. .icon {
  219. background-size: 100%;
  220. font-size: 42rpx;
  221. color: $font-color-dark;
  222. font-weight: bold;
  223. background-repeat: no-repeat;
  224. background-position: center;
  225. }
  226. .text {
  227. color: $font-color-light;
  228. }
  229. }
  230. .row-box {
  231. margin-top: 30rpx;
  232. padding: 20rpx 30rpx;
  233. background: #fff;
  234. .title {
  235. font-size: $font-base + 2rpx;
  236. color: $font-color-dark;
  237. }
  238. .row {
  239. display: flex;
  240. align-items: center;
  241. position: relative;
  242. height: 80rpx;
  243. .tit {
  244. flex-shrink: 0;
  245. width: 40rpx;
  246. font-size: 30rpx;
  247. color: $font-color-dark;
  248. }
  249. .input {
  250. flex: 1;
  251. font-size: 30rpx;
  252. color: $font-color-dark;
  253. }
  254. .iconlocation {
  255. font-size: 36rpx;
  256. color: $font-color-light;
  257. }
  258. .buttom {
  259. color: #dc262b;
  260. font-size: $font-base;
  261. }
  262. }
  263. }
  264. .add-btn {
  265. &.modified {
  266. color: $base-color;
  267. }
  268. &.up {
  269. background-color: $base-color;
  270. color: #fff;
  271. }
  272. display: flex;
  273. align-items: center;
  274. justify-content: center;
  275. width: 690rpx;
  276. height: 80rpx;
  277. margin: 0 auto;
  278. margin-top: 30rpx;
  279. font-size: $font-lg;
  280. border-radius: 10rpx;
  281. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  282. }
  283. .list {
  284. padding-left: 30rpx;
  285. margin-top: 30rpx;
  286. background-color: #ffffff;
  287. .box {
  288. display: flex;
  289. align-items: center;
  290. width: 100%;
  291. height: 120rpx;
  292. border-bottom: 1px solid $border-color-light;
  293. .icon {
  294. font-size: 48rpx;
  295. padding-right: 20rpx;
  296. .icon-img {
  297. height: 50rpx;
  298. width: 50rpx;
  299. }
  300. }
  301. .iconweixin1 {
  302. color: #18bf16;
  303. }
  304. .iconzhifubao {
  305. color: #08aaec;
  306. }
  307. .title-box {
  308. flex-grow: 1;
  309. text-align: left;
  310. .title {
  311. font-size: $font-base + 2rpx;
  312. color: $font-color-base;
  313. }
  314. .node {
  315. font-size: $font-sm;
  316. color: $font-color-light;
  317. }
  318. }
  319. }
  320. }
  321. /deep/ .uni-radio-input {
  322. width: 45rpx;
  323. height: 45rpx;
  324. }
  325. </style>