withdrawal.vue 9.3 KB

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