withdrawal.vue 9.2 KB

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