withdrawal.vue 8.8 KB

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