withdrawal.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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. onShow() {
  156. this.loadData();
  157. },
  158. methods: {
  159. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  160. // 加载余额信息
  161. async loadData() {
  162. let obj = this;
  163. // aliInfo().then(e => {
  164. // console.log(e, 'eeee');
  165. // this.aliData = e.data;
  166. // });
  167. getUserInfo({})
  168. .then(({ data }) => {
  169. console.log(data, 'data');
  170. this.setUserInfo(data);
  171. obj.money = data.brokerage_price;
  172. obj.aliData.fullname = obj.userInfo.alipay_name;
  173. obj.aliData.alino = obj.userInfo.alipay_code;
  174. obj.load = false;
  175. })
  176. .catch(e => {
  177. console.log(e);
  178. });
  179. },
  180. // 跳转
  181. navTo(url) {
  182. uni.navigateTo({
  183. url: url
  184. });
  185. },
  186. // 切换选中对象
  187. tabRadio(e) {
  188. this.type = e.detail.value;
  189. },
  190. // 提交
  191. confirm() {
  192. if (this.load) {
  193. return;
  194. }
  195. let zfbData = {
  196. phone: this.alipay_phone,
  197. type: 2,
  198. payment: this.aliData.alino,
  199. name: this.aliData.fullname
  200. };
  201. let data = {
  202. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  203. money: this.withdrawal, //金额
  204. type: this.from == 'purple' ? 1 : 2 //0佣金1余额 1紫积分 2商家积分
  205. };
  206. // if (this.withdrawal % 100 != 0) {
  207. // uni.showToast({
  208. // title: '提现金额为100的倍数',
  209. // duration: 2000,
  210. // mask: false,
  211. // icon: 'none'
  212. // });
  213. // return;
  214. // }
  215. if (this.withdrawal < this.minPrice) {
  216. uni.showToast({
  217. title: '提现金额不可少于' + this.minPrice,
  218. duration: 2000,
  219. mask: false,
  220. icon: 'none'
  221. });
  222. return;
  223. }
  224. if (this.type == 'alipay') {
  225. console.log('alipay');
  226. data.name = this.aliData.fullname;
  227. data.alipay_code = this.aliData.alino;
  228. zfbData.phone = this.alipay_phone;
  229. }
  230. if (this.type == 'bank') {
  231. data.name = this.bank_people;
  232. data.bankname = this.bank_name;
  233. data.cardnum = this.bank_code;
  234. }
  235. this.load = true;
  236. extractCash(data)
  237. .then(e => {
  238. console.log(e, 'eeeeee');
  239. this.loadData();
  240. uni.showToast({
  241. title: '提交成功',
  242. duration: 2000,
  243. position: 'top'
  244. });
  245. this.withdrawal = '';
  246. })
  247. .catch(e => {
  248. this.load = false;
  249. console.log();
  250. });
  251. }
  252. }
  253. };
  254. </script>
  255. <style lang="scss">
  256. page {
  257. height: 100%;
  258. }
  259. .content-money {
  260. padding: 30rpx 0;
  261. }
  262. .flex {
  263. text-align: center;
  264. margin: 0 30rpx;
  265. border-radius: $border-radius-sm;
  266. .buttom {
  267. font-size: $font-lg;
  268. width: 50%;
  269. }
  270. .butt {
  271. font-size: 26rpx;
  272. font-weight: normal;
  273. color: #fdd58a;
  274. line-height: 42rpx;
  275. }
  276. .interval {
  277. width: 2px;
  278. height: 60rpx;
  279. background-color: #111111;
  280. }
  281. .icon {
  282. background-size: 100%;
  283. font-size: 42rpx;
  284. color: #fff;
  285. font-weight: bold;
  286. background-repeat: no-repeat;
  287. background-position: center;
  288. }
  289. .text {
  290. color: #fff;
  291. }
  292. }
  293. .row-box {
  294. margin-top: 30rpx;
  295. padding: 20rpx 30rpx;
  296. background: #111111;
  297. .title {
  298. font-size: $font-base + 2rpx;
  299. color: #fff;
  300. }
  301. .row {
  302. display: flex;
  303. align-items: center;
  304. position: relative;
  305. height: 80rpx;
  306. background: #111111;
  307. color: #fff;
  308. .tit {
  309. flex-shrink: 0;
  310. width: 40rpx;
  311. font-size: 30rpx;
  312. color: #fff;
  313. }
  314. .input {
  315. flex: 1;
  316. font-size: 30rpx;
  317. color: #fff;
  318. }
  319. .iconlocation {
  320. font-size: 36rpx;
  321. color: #fff;
  322. }
  323. .buttom {
  324. color: #fdd58a;
  325. }
  326. }
  327. }
  328. .add-btn {
  329. &.modified {
  330. color: #ffffff;
  331. }
  332. &.up {
  333. background: $bgBaseBg;
  334. color: #9f570e;
  335. }
  336. color: #ffd395;
  337. display: flex;
  338. align-items: center;
  339. justify-content: center;
  340. width: 690rpx;
  341. height: 80rpx;
  342. margin: 0 auto;
  343. margin-top: 30rpx;
  344. font-size: $font-lg;
  345. border-radius: 10rpx;
  346. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  347. }
  348. .list {
  349. padding-left: 30rpx;
  350. margin-top: 30rpx;
  351. // background-color: #ffffff;
  352. background: #111111;
  353. .box {
  354. display: flex;
  355. align-items: center;
  356. width: 100%;
  357. height: 120rpx;
  358. border-bottom: 1px solid $border-color-light;
  359. .icon {
  360. font-size: 48rpx;
  361. padding-right: 20rpx;
  362. .icon-img {
  363. height: 50rpx;
  364. width: 50rpx;
  365. }
  366. }
  367. .iconweixin1 {
  368. color: #18bf16;
  369. }
  370. .iconzhifubao {
  371. color: #08aaec;
  372. }
  373. .title-box {
  374. flex-grow: 1;
  375. text-align: left;
  376. .title {
  377. font-size: $font-base + 2rpx;
  378. color: $font-color-base;
  379. }
  380. .node {
  381. font-size: $font-sm;
  382. color: $font-color-light;
  383. }
  384. }
  385. }
  386. }
  387. /deep/ .uni-radio-input {
  388. width: 45rpx;
  389. height: 45rpx;
  390. }
  391. .row {
  392. display: flex;
  393. align-items: center;
  394. position: relative;
  395. padding: 0 30upx;
  396. height: 110upx;
  397. background: #111111;
  398. .tit {
  399. flex-shrink: 0;
  400. width: 250upx;
  401. font-size: 30upx;
  402. color: #fff;
  403. }
  404. .input {
  405. flex: 1;
  406. font-size: 30upx;
  407. color: #fff;
  408. }
  409. .iconlocation {
  410. font-size: 36upx;
  411. color: $font-color-light;
  412. }
  413. }
  414. .tip {
  415. padding: 20rpx;
  416. color: #fd3b39;
  417. }
  418. .loading {
  419. background: #999;
  420. }
  421. </style>