withdrawal.vue 9.7 KB

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