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