withdrawal.vue 10 KB

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