withdrawal.vue 7.4 KB

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