withdrawal.vue 10 KB

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