withdrawal.vue 7.7 KB

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