withdrawal.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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: 'weixin', //提现方式
  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. aliInfo({}).then(e => {
  118. this.aliData = e.data;
  119. });
  120. },
  121. // 加载银行卡信息
  122. async loadBank() {
  123. bankInfo({}).then(e => {
  124. this.bankData = e.data;
  125. });
  126. },
  127. // 加载余额信息
  128. async loadData() {
  129. extractBank({}).then(({ data }) => {
  130. this.money = data.commissionCount;
  131. this.minPrice = data.minPrice;
  132. this.freeze = data.incommissionCount;
  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. let data = {
  148. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  149. money: this.withdrawal, //金额
  150. money_type: 0 //0佣金1余额
  151. };
  152. if (this.withdrawal < this.minPrice) {
  153. uni.showToast({
  154. title: '提现金额不可少于'+this.minPrice,
  155. duration: 2000,
  156. mask: false,
  157. icon: 'none',
  158. })
  159. return;
  160. }
  161. if (this.type == 'alipay') {
  162. data.name = this.aliData.fullname;
  163. data.alipay_code = this.aliData.alino;
  164. }
  165. if (this.type == 'bank') {
  166. data.name = this.bankData.fullname;
  167. data.bankname = this.bankData.bank;
  168. data.cardnum = this.bankData.bankno;
  169. }
  170. extractCash(data)
  171. .then(e => {
  172. uni.showToast({
  173. title: '提交成功',
  174. duration: 2000,
  175. position: 'top'
  176. });
  177. })
  178. .catch(e => {
  179. console.log();
  180. });
  181. }
  182. }
  183. };
  184. </script>
  185. <style lang="scss">
  186. page {
  187. height: 100%;
  188. }
  189. .content-money {
  190. padding: 30rpx 0;
  191. background: #ffffff;
  192. }
  193. .flex {
  194. background-color: #ffffff;
  195. text-align: center;
  196. margin: 0 30rpx;
  197. border-radius: $border-radius-sm;
  198. .buttom {
  199. font-size: $font-lg;
  200. width: 50%;
  201. }
  202. .interval {
  203. width: 2px;
  204. height: 60rpx;
  205. background-color: #eeeeee;
  206. }
  207. .icon {
  208. background-size: 100%;
  209. font-size: 42rpx;
  210. color: $font-color-dark;
  211. font-weight: bold;
  212. background-repeat: no-repeat;
  213. background-position: center;
  214. }
  215. .text {
  216. color: $font-color-light;
  217. }
  218. }
  219. .row-box {
  220. margin-top: 30rpx;
  221. padding: 20rpx 30rpx;
  222. background: #fff;
  223. .title {
  224. font-size: $font-base + 2rpx;
  225. color: $font-color-dark;
  226. }
  227. .row {
  228. display: flex;
  229. align-items: center;
  230. position: relative;
  231. height: 80rpx;
  232. .tit {
  233. flex-shrink: 0;
  234. width: 40rpx;
  235. font-size: 30rpx;
  236. color: $font-color-dark;
  237. }
  238. .input {
  239. flex: 1;
  240. font-size: 30rpx;
  241. color: $font-color-dark;
  242. }
  243. .iconlocation {
  244. font-size: 36rpx;
  245. color: $font-color-light;
  246. }
  247. .buttom {
  248. color: $font-color-spec;
  249. font-size: $font-base;
  250. }
  251. }
  252. }
  253. .add-btn {
  254. &.modified {
  255. color: $base-color;
  256. }
  257. &.up {
  258. background-color: $base-color;
  259. color: #fff;
  260. }
  261. display: flex;
  262. align-items: center;
  263. justify-content: center;
  264. width: 690rpx;
  265. height: 80rpx;
  266. margin: 0 auto;
  267. margin-top: 30rpx;
  268. font-size: $font-lg;
  269. border-radius: 10rpx;
  270. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  271. }
  272. .list {
  273. padding-left: 30rpx;
  274. margin-top: 30rpx;
  275. background-color: #ffffff;
  276. .box {
  277. display: flex;
  278. align-items: center;
  279. width: 100%;
  280. height: 120rpx;
  281. border-bottom: 1px solid $border-color-light;
  282. .icon {
  283. font-size: 48rpx;
  284. padding-right: 20rpx;
  285. .icon-img {
  286. height: 50rpx;
  287. width: 50rpx;
  288. }
  289. }
  290. .iconweixin1 {
  291. color: #18bf16;
  292. }
  293. .iconzhifubao {
  294. color: #08aaec;
  295. }
  296. .title-box {
  297. flex-grow: 1;
  298. text-align: left;
  299. .title {
  300. font-size: $font-base + 2rpx;
  301. color: $font-color-base;
  302. }
  303. .node {
  304. font-size: $font-sm;
  305. color: $font-color-light;
  306. }
  307. }
  308. }
  309. }
  310. /deep/ .uni-radio-input {
  311. width: 45rpx;
  312. height: 45rpx;
  313. }
  314. </style>