withdrawal.vue 8.3 KB

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