withdrawal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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">可提现{{showType}}</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="请输入提现金额"
  17. placeholder-class="placeholder" />
  18. <view class="buttom butt" @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="#A581FF" :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="#ff0060" :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 == 'alipay'">
  83. <text class="tit">手机号</text>
  84. <input class="input" v-model="alipay_phone" type="number" 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_code" 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_people" placeholder="请输入银行卡姓名"
  95. placeholder-class="placeholder" />
  96. </view>
  97. <view class="row b-b" v-if="type == 'bank'">
  98. <text class="tit">所属银行</text>
  99. <input class="input" type="text" v-model="bank_name" placeholder="请输入所属银行"
  100. placeholder-class="placeholder" />
  101. </view>
  102. <button class="add-btn up" @click="confirm" :class="{'loading': load}">提交申请</button>
  103. <!-- <button class="add-btn " v-if="!weichatBsrowser" @click="navTo('/pages/money/account')">账号管理</button> -->
  104. </view>
  105. </template>
  106. <script>
  107. import {
  108. getMoneyStyle
  109. } from '@/utils/rocessor.js';
  110. import {
  111. extractCash,
  112. extractBank,
  113. setAliInfo,
  114. aliInfo,
  115. bankInfo,
  116. getMoneyType
  117. } from '@/api/wallet.js';
  118. import {
  119. orderData,
  120. getUserInfo
  121. } from '@/api/user.js';
  122. import {
  123. mapState,
  124. mapMutations
  125. } from 'vuex';
  126. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  127. export default {
  128. filters: {
  129. getMoneyStyle
  130. },
  131. components: {
  132. uniNoticeBar
  133. },
  134. computed: {
  135. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  136. },
  137. data() {
  138. return {
  139. load: true,
  140. showType: '',
  141. from: '',
  142. type: 'alipay', //提现方式
  143. money: '0.00', //可提现金额
  144. freeze: '0.0', //冻结金额
  145. withdrawal: '', //提现金额
  146. minPrice: '', //最少提现金额
  147. aliData: {},
  148. bankData: {},
  149. alipay_code: '',
  150. alipay_name: '',
  151. alipay_phone: '',
  152. bank_code: '',
  153. bank_people: '',
  154. bank_name: '',
  155. // #ifdef H5
  156. weichatBsrowser: false
  157. // #endif
  158. };
  159. },
  160. onLoad(options) {
  161. // #ifdef H5
  162. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  163. // #endif
  164. if (options.type) {
  165. this.from = options.type
  166. if (this.from == 'purple') {
  167. this.showType = '阳光积分'
  168. }
  169. if (this.from == 'shop') {
  170. this.showType = '美好积分'
  171. }
  172. }
  173. //加载提现信息
  174. this.loadData();
  175. // // 加载提款账号信息
  176. // this.loadAli();
  177. // this.loadBank();
  178. },
  179. methods: {
  180. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  181. // 加载余额信息
  182. async loadData() {
  183. let obj = this
  184. aliInfo().then(e => {
  185. console.log(e, 'eeee');
  186. obj.alipay_code = e.data.zfb.payment
  187. obj.alipay_name = e.data.zfb.name
  188. obj.alipay_phone = e.data.zfb.phone
  189. });
  190. getUserInfo({})
  191. .then(({
  192. data
  193. }) => {
  194. console.log(data, 'data')
  195. this.setUserInfo(data);
  196. obj.money = data.brokerage_price
  197. obj.load = false
  198. })
  199. .catch(e => {
  200. console.log(e);
  201. });
  202. },
  203. // 跳转
  204. navTo(url) {
  205. uni.navigateTo({
  206. url: url
  207. });
  208. },
  209. // 切换选中对象
  210. tabRadio(e) {
  211. this.type = e.detail.value;
  212. },
  213. // 提交
  214. confirm() {
  215. if (this.load) {
  216. return
  217. }
  218. let zfbData = {
  219. phone: this.alipay_phone,
  220. type: 2,
  221. payment: this.alipay_code,
  222. name: this.alipay_name
  223. }
  224. let data = {
  225. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  226. money: this.withdrawal, //金额
  227. type: this.from == 'purple' ? 1 : 2 //0佣金1余额 1紫积分 2商家积分
  228. };
  229. // if (this.withdrawal % 100 != 0) {
  230. // uni.showToast({
  231. // title: '提现金额为100的倍数',
  232. // duration: 2000,
  233. // mask: false,
  234. // icon: 'none'
  235. // });
  236. // return;
  237. // }
  238. if (this.withdrawal < this.minPrice) {
  239. uni.showToast({
  240. title: '提现金额不可少于' + this.minPrice,
  241. duration: 2000,
  242. mask: false,
  243. icon: 'none'
  244. });
  245. return;
  246. }
  247. if (this.type == 'alipay') {
  248. console.log('alipay');
  249. data.name = this.alipay_name;
  250. data.alipay_code = this.alipay_code;
  251. zfbData.phone = this.alipay_phone;
  252. }
  253. if (this.type == 'bank') {
  254. data.name = this.bank_people;
  255. data.bankname = this.bank_name;
  256. data.cardnum = this.bank_code;
  257. }
  258. this.load = true
  259. getMoneyType(zfbData)
  260. .then(e => {
  261. console.log(e, "eeeeee");
  262. // uni.showToast({
  263. // title: '修改成功',
  264. // duration: 2000,
  265. // position: 'top'
  266. // });
  267. // setTimeout(() => {
  268. // uni.navigateBack({
  269. // url:'pages/user/shopJf'
  270. // })
  271. // },1500)
  272. this.$api.prePage().dataUp()
  273. })
  274. .catch(e => {
  275. console.log(e);
  276. });
  277. extractCash(data)
  278. .then(e => {
  279. console.log(e, 'eeeeee');
  280. this.loadData()
  281. uni.showToast({
  282. title: '提交成功',
  283. duration: 2000,
  284. position: 'top'
  285. });
  286. this.withdrawal = ''
  287. })
  288. .catch(e => {
  289. this.load = false
  290. console.log();
  291. });
  292. }
  293. }
  294. };
  295. </script>
  296. <style lang="scss">
  297. page {
  298. height: 100%;
  299. background: #111111;
  300. }
  301. .content-money {
  302. padding: 30rpx 0;
  303. background: #111111;
  304. }
  305. .flex {
  306. background-color: #111111;
  307. text-align: center;
  308. margin: 0 30rpx;
  309. border-radius: $border-radius-sm;
  310. .buttom {
  311. font-size: $font-lg;
  312. width: 50%;
  313. }
  314. .butt {
  315. font-size: 26rpx;
  316. font-weight: normal;
  317. color: #A581FF;
  318. line-height: 42rpx;
  319. }
  320. .interval {
  321. width: 2px;
  322. height: 60rpx;
  323. background-color: #111111;
  324. }
  325. .icon {
  326. background-size: 100%;
  327. font-size: 42rpx;
  328. color: #fff;
  329. font-weight: bold;
  330. background-repeat: no-repeat;
  331. background-position: center;
  332. }
  333. .text {
  334. color: #fff;
  335. }
  336. }
  337. .row-box {
  338. margin-top: 30rpx;
  339. padding: 20rpx 30rpx;
  340. background: #111111;
  341. .title {
  342. font-size: $font-base + 2rpx;
  343. color: #fff;
  344. }
  345. .row {
  346. display: flex;
  347. align-items: center;
  348. position: relative;
  349. height: 80rpx;
  350. background: #111111;
  351. color: #fff;
  352. .tit {
  353. flex-shrink: 0;
  354. width: 40rpx;
  355. font-size: 30rpx;
  356. color: #fff;
  357. }
  358. .input {
  359. flex: 1;
  360. font-size: 30rpx;
  361. color: #fff;
  362. }
  363. .iconlocation {
  364. font-size: 36rpx;
  365. color: #fff;
  366. }
  367. .buttom {
  368. color: #A581FF;
  369. }
  370. }
  371. }
  372. .add-btn {
  373. &.modified {
  374. color: #ffffff;
  375. }
  376. &.up {
  377. background: linear-gradient(270deg, #6E8DF7, #9977F6);
  378. color: #fff;
  379. }
  380. display: flex;
  381. align-items: center;
  382. justify-content: center;
  383. width: 690rpx;
  384. height: 80rpx;
  385. margin: 0 auto;
  386. margin-top: 30rpx;
  387. font-size: $font-lg;
  388. border-radius: 10rpx;
  389. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  390. }
  391. .list {
  392. padding-left: 30rpx;
  393. margin-top: 30rpx;
  394. // background-color: #ffffff;
  395. background: #111111;
  396. .box {
  397. display: flex;
  398. align-items: center;
  399. width: 100%;
  400. height: 120rpx;
  401. border-bottom: 1px solid $border-color-light;
  402. .icon {
  403. font-size: 48rpx;
  404. padding-right: 20rpx;
  405. .icon-img {
  406. height: 50rpx;
  407. width: 50rpx;
  408. }
  409. }
  410. .iconweixin1 {
  411. color: #18bf16;
  412. }
  413. .iconzhifubao {
  414. color: #08aaec;
  415. }
  416. .title-box {
  417. flex-grow: 1;
  418. text-align: left;
  419. .title {
  420. font-size: $font-base + 2rpx;
  421. color: $font-color-base;
  422. }
  423. .node {
  424. font-size: $font-sm;
  425. color: $font-color-light;
  426. }
  427. }
  428. }
  429. }
  430. /deep/ .uni-radio-input {
  431. width: 45rpx;
  432. height: 45rpx;
  433. }
  434. .row {
  435. display: flex;
  436. align-items: center;
  437. position: relative;
  438. padding: 0 30upx;
  439. height: 110upx;
  440. background: #111111;
  441. .tit {
  442. flex-shrink: 0;
  443. width: 250upx;
  444. font-size: 30upx;
  445. color: #fff;
  446. }
  447. .input {
  448. flex: 1;
  449. font-size: 30upx;
  450. color: #fff;
  451. }
  452. .iconlocation {
  453. font-size: 36upx;
  454. color: $font-color-light;
  455. }
  456. }
  457. .tip {
  458. padding: 20rpx;
  459. color: #fd3b39;
  460. }
  461. .loading {
  462. background: #999;
  463. }
  464. </style>