withdrawal.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view class="content">
  3. <!-- <uni-notice-bar single="true" text="实际到账98%"></uni-notice-bar> -->
  4. <view class="content-money">
  5. <view class="flex " style="width: 750rpx;justify-content: space-around;margin-left: 0;">
  6. <view class="buttom">
  7. <view class="icon">{{ userInfo.extract_count_price | getMoneyStyle }}</view>
  8. <text class="text">累计提现金额</text>
  9. </view>
  10. <view class="buttom">
  11. <view class="icon">{{ userInfo.brokerage_price | getMoneyStyle }}</view>
  12. <text class="text">可提现现金</text>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="row-box">
  17. <view class="title">提现金额</view>
  18. <view class="row">
  19. <text class="tit">¥</text>
  20. <input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'" placeholder-class="placeholder" />
  21. <view class="buttom" @click="withdrawal = userInfo.brokerage_price">全部提现</view>
  22. </view>
  23. </view>
  24. <view class="tip" v-if="withdrawal != 0">
  25. 实际到账 {{ real || "0"}}元
  26. </view>
  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.fullname">提现至支付宝</text>
  44. <text v-else>请创建支付宝账号</text>
  45. </view>
  46. <view class="node">
  47. <text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
  48. </view>
  49. </view>
  50. <view class="right"><radio value="alipay" color="#fff" :checked="type == 'alipay'" /></view>
  51. </view>
  52. </label> -->
  53. <!-- <label v-if="bank==1">
  54. <view class="box">
  55. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  56. <view class="title-box">
  57. <view class="title">
  58. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  59. <text v-else>请输入银行账号</text>
  60. </view>
  61. <view class="node">
  62. <text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
  63. </view>
  64. </view>
  65. <view class="right"><radio value="bank" color="#fff" :checked="type == 'bank'" /></view>
  66. </view>
  67. </label> -->
  68. </radio-group>
  69. </view>
  70. <!-- <view class="row b-b" v-if="type == 'alipay'">
  71. <text class="tit">支付宝账号</text>
  72. <input class="input" type="text" v-model="alipay_code" placeholder="请输入支付宝账号" placeholder-class="placeholder" />
  73. </view>
  74. <view class="row b-b" v-if="type == 'alipay'">
  75. <text class="tit">支付宝姓名</text>
  76. <input class="input" type="text" v-model="alipay_name" placeholder="请输入支付宝姓名" placeholder-class="placeholder" />
  77. </view> -->
  78. <view class="row b-b" v-if="bank==1">
  79. <text class="tit">银行卡号</text>
  80. <input class="input" type="text" v-model="bank_code" placeholder="请输入银行卡号" placeholder-class="placeholder" />
  81. </view>
  82. <view class="row b-b" v-if="bank==1">
  83. <text class="tit">姓名</text>
  84. <input class="input" type="text" v-model="bank_people" placeholder="请输入银行卡姓名" placeholder-class="placeholder" />
  85. </view>
  86. <view class="row b-b" v-if="bank==1">
  87. <text class="tit">所属银行</text>
  88. <input class="input" type="text" v-model="bank_name" placeholder="请输入所属银行" placeholder-class="placeholder" />
  89. </view>
  90. <button class="add-btn up" @click="confirm">提交申请</button>
  91. <!-- <button class="add-btn modified" v-if="!weichatBsrowser" @click="navTo('/pages/money/account')">账号管理</button> -->
  92. </view>
  93. </template>
  94. <script>
  95. import { getMoneyStyle } from '@/utils/rocessor.js';
  96. import { extractCash, extractBank, aliInfo, bankInfo } from '@/api/wallet.js';
  97. import { orderData, getUserInfo } from '@/api/user.js';
  98. import { mapState, mapMutations } from 'vuex';
  99. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  100. export default {
  101. filters: {
  102. getMoneyStyle
  103. },
  104. components: {
  105. uniNoticeBar
  106. },
  107. computed: {
  108. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  109. real() {
  110. return (this.withdrawal-(this.withdrawal*this.sxf)).toFixed(2) * 1;
  111. }
  112. },
  113. data() {
  114. return {
  115. type: 'bank', //提现方式
  116. money: '0.00', //可提现金额
  117. freeze: '0.0', //冻结金额
  118. withdrawal: '', //提现金额
  119. minPrice: '', //最少提现金额
  120. aliData: {},
  121. sxf:0,
  122. bank:0,
  123. bankData: {},
  124. alipay_code: '',
  125. alipay_name: '',
  126. bank_code: '',
  127. bank_people: '',
  128. bank_name: '',
  129. // #ifdef H5
  130. weichatBsrowser: false
  131. // #endif
  132. };
  133. },
  134. onLoad(options) {
  135. // #ifdef H5
  136. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  137. // #endif
  138. //加载提现信息
  139. this.loadData();
  140. // // 加载提款账号信息
  141. // this.loadAli();
  142. // this.loadBank();
  143. },
  144. methods: {
  145. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  146. // 加载余额信息
  147. async loadData() {
  148. extractBank({}).then(({ data }) => {
  149. console.log(data)
  150. this.sxf=data.sxf;
  151. this.bank=data.bank;
  152. this.minPrice = data.minPrice;
  153. if(data.last_extract) {
  154. let bank = data.last_extract
  155. this.bank_code = bank.bank_code
  156. this.bank_name = bank.bank_address
  157. this.bank_people = bank.real_name
  158. }
  159. });
  160. },
  161. // 跳转
  162. navTo(url) {
  163. uni.navigateTo({
  164. url: url
  165. });
  166. },
  167. // 切换选中对象
  168. tabRadio(e) {
  169. this.type = e.detail.value;
  170. console.log(this.type);
  171. },
  172. // 提交
  173. confirm() {
  174. let data = {
  175. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  176. money: this.withdrawal, //金额
  177. money_type: 0 //0佣金1余额
  178. };
  179. if (this.withdrawal < this.minPrice) {
  180. uni.showToast({
  181. title: '提现金额不可少于' + this.minPrice,
  182. duration: 2000,
  183. mask: false,
  184. icon: 'none'
  185. });
  186. return;
  187. }
  188. if (this.type == 'alipay') {
  189. console.log('alipay');
  190. data.name = this.alipay_name;
  191. data.alipay_code = this.alipay_code;
  192. }
  193. if (this.type == 'bank') {
  194. // console.log(bank,'bank');
  195. data.name = this.bank_people;
  196. data.bankname = this.bank_name;
  197. data.cardnum = this.bank_code;
  198. }
  199. extractCash(data)
  200. .then(e => {
  201. getUserInfo({})
  202. .then(({ data }) => {
  203. this.setUserInfo(data);
  204. })
  205. .catch(e => {
  206. console.log(e);
  207. });
  208. uni.showToast({
  209. title: '申请成功!请等待审核打款',
  210. duration: 2000,
  211. position: 'top'
  212. });
  213. })
  214. .catch(e => {
  215. console.log();
  216. });
  217. }
  218. }
  219. };
  220. </script>
  221. <style lang="scss">
  222. page {
  223. height: 100%;
  224. }
  225. .content-money {
  226. padding: 30rpx 0;
  227. background: #ffffff;
  228. }
  229. .flex {
  230. background-color: #ffffff;
  231. text-align: center;
  232. margin: 0 30rpx;
  233. border-radius: $border-radius-sm;
  234. .buttom {
  235. font-size: $font-lg;
  236. width: 50%;
  237. }
  238. .interval {
  239. width: 2px;
  240. height: 60rpx;
  241. background-color: #eeeeee;
  242. }
  243. .icon {
  244. background-size: 100%;
  245. font-size: 42rpx;
  246. color: $font-color-dark;
  247. font-weight: bold;
  248. background-repeat: no-repeat;
  249. background-position: center;
  250. }
  251. .text {
  252. color: $font-color-light;
  253. }
  254. }
  255. .row-box {
  256. margin-top: 30rpx;
  257. padding: 20rpx 30rpx;
  258. background: #fff;
  259. .title {
  260. font-size: $font-base + 2rpx;
  261. color: $font-color-dark;
  262. }
  263. .row {
  264. display: flex;
  265. align-items: center;
  266. position: relative;
  267. height: 80rpx;
  268. .tit {
  269. flex-shrink: 0;
  270. width: 40rpx;
  271. font-size: 30rpx;
  272. color: $font-color-dark;
  273. }
  274. .input {
  275. flex: 1;
  276. font-size: 30rpx;
  277. color: $font-color-dark;
  278. }
  279. .iconlocation {
  280. font-size: 36rpx;
  281. color: $font-color-light;
  282. }
  283. .buttom {
  284. color: #fff;
  285. font-size: $font-base;
  286. }
  287. }
  288. }
  289. .add-btn {
  290. &.modified {
  291. color: $base-color;
  292. }
  293. &.up {
  294. background-color: #f75022;
  295. color: #fff;
  296. }
  297. display: flex;
  298. align-items: center;
  299. justify-content: center;
  300. width: 690rpx;
  301. height: 80rpx;
  302. margin: 0 auto;
  303. margin-top: 30rpx;
  304. font-size: $font-lg;
  305. border-radius: 10rpx;
  306. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  307. }
  308. .list {
  309. padding-left: 30rpx;
  310. margin-top: 30rpx;
  311. background-color: #ffffff;
  312. .box {
  313. display: flex;
  314. align-items: center;
  315. width: 100%;
  316. height: 120rpx;
  317. border-bottom: 1px solid $border-color-light;
  318. .icon {
  319. font-size: 48rpx;
  320. padding-right: 20rpx;
  321. .icon-img {
  322. height: 50rpx;
  323. width: 50rpx;
  324. }
  325. }
  326. .iconweixin1 {
  327. color: #18bf16;
  328. }
  329. .iconzhifubao {
  330. color: #08aaec;
  331. }
  332. .title-box {
  333. flex-grow: 1;
  334. text-align: left;
  335. .title {
  336. font-size: $font-base + 2rpx;
  337. color: $font-color-base;
  338. }
  339. .node {
  340. font-size: $font-sm;
  341. color: $font-color-light;
  342. }
  343. }
  344. }
  345. }
  346. /deep/ .uni-radio-input {
  347. width: 45rpx;
  348. height: 45rpx;
  349. }
  350. .row {
  351. display: flex;
  352. align-items: center;
  353. position: relative;
  354. padding: 0 30upx;
  355. height: 110upx;
  356. background: #fff;
  357. .tit {
  358. flex-shrink: 0;
  359. width: 250upx;
  360. font-size: 30upx;
  361. color: $font-color-dark;
  362. }
  363. .input {
  364. flex: 1;
  365. font-size: 30upx;
  366. color: $font-color-dark;
  367. }
  368. .iconlocation {
  369. font-size: 36upx;
  370. color: $font-color-light;
  371. }
  372. }
  373. .tip {
  374. padding: 20rpx;
  375. color: #FD3B39;
  376. }
  377. </style>