withdrawal.vue 9.0 KB

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