withdrawal.vue 9.7 KB

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