withdrawal.vue 7.2 KB

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