withdrawal.vue 7.5 KB

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