withdrawal.vue 9.0 KB

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