withdrawal.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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="buttom1">
  7. <view class="icon">{{ money | getMoneyStyle }}</view>
  8. <text class="text">可提现余额</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="row-box">
  13. <view class="title">提现金额</view>
  14. <view class="row">
  15. <text class="tit">¥</text>
  16. <input class="input" type="number" v-model="withdrawal" placeholder="请输入提现金额" placeholder-class="placeholder" />
  17. <view class="buttom" @click="withdrawal = money">全部提现</view>
  18. </view>
  19. </view>
  20. <view class="tip" v-if="withdrawal != 0">实际到账{{ (withdrawal * (1 - sxfl) * 1).toFixed(2) }}元,手续费{{ (withdrawal * sxfl * 1).toFixed(2) }}元</view>
  21. <!-- <view class="row-box">
  22. <view class="title">手续费</view>
  23. <view class="row">
  24. <text class="tit">¥</text>
  25. <view class="placeholder">{{ withdrawal * 0.01*charge }}</view>
  26. </view>
  27. </view> -->
  28. <!-- #ifndef MP-WEIXIN -->
  29. <view class="list">
  30. <radio-group @change="tabRadio">
  31. <label>
  32. <view class="box">
  33. <view class="icon iconfont iconweixin1"></view>
  34. <view class="title-box">
  35. <view class="title"><text>提现至微信</text></view>
  36. </view>
  37. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  38. </view>
  39. </label>
  40. <label>
  41. <view class="box">
  42. <view class="icon iconfont iconzhifubao"></view>
  43. <view class="title-box">
  44. <view class="title">
  45. <text v-if="aliData.fullname">提现至支付宝</text>
  46. <text v-else>请创建支付宝账号</text>
  47. </view>
  48. <view class="node">
  49. <text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
  50. </view>
  51. </view>
  52. <view class="right"><radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" /></view>
  53. </view>
  54. </label>
  55. <label>
  56. <view class="box">
  57. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  58. <view class="title-box">
  59. <view class="title">
  60. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  61. <text v-else>请创建银行账号</text>
  62. </view>
  63. <view class="node">
  64. <text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
  65. </view>
  66. </view>
  67. <view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
  68. </view>
  69. </label>
  70. </radio-group>
  71. </view>
  72. <!-- #endif -->
  73. <!-- <view class="row b-b" v-if="type == 'weixin'">
  74. <text class="tit">输入微信账号</text>
  75. <input class="input" type="text" v-model="weixin" placeholder="请输入微信账号" placeholder-class="placeholder" />
  76. </view> -->
  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 { mapState, mapMutations } from 'vuex';
  83. import { getMoneyStyle } from '@/utils/rocessor.js';
  84. import { extractCash, extractBank, aliInfo, bankInfo, userBalance } from '@/api/wallet.js';
  85. import { extract, storeIndex } from '@/api/merchant.js';
  86. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  87. export default {
  88. filters: {
  89. getMoneyStyle
  90. },
  91. components: {
  92. uniNoticeBar
  93. },
  94. data() {
  95. return {
  96. isTing: false,
  97. type: 'alipay', //提现方式
  98. money: '0.00', //可提现余额
  99. withdrawal: '', //提现金额
  100. reall: '', //实际到账
  101. sxfl: '', //手续费率
  102. aliData: {},
  103. bankData: {},
  104. weixin: '',
  105. charge: 0,
  106. // #ifdef H5
  107. weichatBsrowser: false
  108. // #endif
  109. };
  110. },
  111. onLoad(options) {
  112. // #ifdef H5
  113. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  114. // #endif
  115. //加载提现信息
  116. this.loadData();
  117. // 加载提款账号信息
  118. this.loadAli();
  119. this.loadBank();
  120. },
  121. computed: {
  122. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  123. },
  124. methods: {
  125. // 更新数据
  126. dataUp() {
  127. this.loadAli();
  128. this.loadBank();
  129. },
  130. //加载数据
  131. async loadAli(source) {
  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. storeIndex({}).then(({ data }) => {
  145. this.money = data.balance;
  146. this.sxfl = ((data.store_info.commission * 1) / 100).toFixed(2);
  147. });
  148. },
  149. // 跳转
  150. navTo(url) {
  151. uni.navigateTo({
  152. url: url
  153. });
  154. },
  155. // 切换选中对象
  156. tabRadio(e) {
  157. this.type = e.detail.value;
  158. },
  159. // 提交
  160. confirm() {
  161. let obj = this;
  162. if (obj.isTing) {
  163. console.log('jing');
  164. return;
  165. }
  166. let data;
  167. if (obj.type1 == 'brokerage_price') {
  168. data = {
  169. extract_type: obj.type, //bank -银行卡 alipay-支付宝 weixin-微信
  170. money: obj.withdrawal //金额
  171. };
  172. } else {
  173. data = {
  174. extract_type: obj.type, //bank -银行卡 alipay-支付宝 weixin-微信
  175. money: obj.withdrawal //金额
  176. };
  177. }
  178. if (+obj.withdrawal < +obj.minPrice) {
  179. uni.showToast({
  180. title: '提现金额不可少于' + obj.minPrice,
  181. duration: 2000,
  182. mask: false,
  183. icon: 'none'
  184. });
  185. return;
  186. }
  187. if (obj.type == 'alipay') {
  188. data.name = obj.aliData.fullname;
  189. data.alipay_code = obj.aliData.alino;
  190. }
  191. if (obj.type == 'weixin') {
  192. data.weixin = '123456';
  193. }
  194. if (obj.type == 'bank') {
  195. data.name = obj.bankData.fullname;
  196. data.bankname = obj.bankData.bank;
  197. data.cardnum = obj.bankData.bankno;
  198. }
  199. obj.isTing = true;
  200. extract(data)
  201. .then(e => {
  202. uni.showToast({
  203. title: '提交成功',
  204. duration: 2000,
  205. position: 'top'
  206. });
  207. obj.isTing = false;
  208. // 清空提现金额
  209. obj.withdrawal = '';
  210. })
  211. .catch(e => {
  212. obj.isTing = false;
  213. console.log();
  214. });
  215. }
  216. }
  217. };
  218. </script>
  219. <style lang="scss">
  220. page {
  221. height: 100%;
  222. }
  223. .content-money {
  224. padding: 30rpx 0;
  225. background: #ffffff;
  226. }
  227. .flex {
  228. background-color: #ffffff;
  229. text-align: center;
  230. margin: 0 30rpx;
  231. border-radius: $border-radius-sm;
  232. .buttom {
  233. font-size: $font-lg;
  234. width: 50%;
  235. }
  236. .buttom1 {
  237. font-size: $font-lg;
  238. width: 100%;
  239. }
  240. .interval {
  241. width: 2px;
  242. height: 60rpx;
  243. background-color: #eeeeee;
  244. }
  245. .icon {
  246. background-size: 100%;
  247. font-size: 42rpx;
  248. color: $font-color-dark;
  249. font-weight: bold;
  250. background-repeat: no-repeat;
  251. background-position: center;
  252. }
  253. .text {
  254. font-size: 30rpx;
  255. color: $font-color-light;
  256. }
  257. }
  258. .row-box {
  259. margin-top: 30rpx;
  260. padding: 20rpx 30rpx;
  261. background: #fff;
  262. .title {
  263. font-size: $font-base + 2rpx;
  264. color: $font-color-dark;
  265. }
  266. .row {
  267. display: flex;
  268. align-items: center;
  269. position: relative;
  270. height: 80rpx;
  271. .tit {
  272. flex-shrink: 0;
  273. width: 40rpx;
  274. font-size: 30rpx;
  275. color: $font-color-dark;
  276. }
  277. .input {
  278. flex: 1;
  279. font-size: 30rpx;
  280. color: $font-color-dark;
  281. }
  282. .iconlocation {
  283. font-size: 36rpx;
  284. color: $font-color-light;
  285. }
  286. .buttom {
  287. color: $font-color-spec;
  288. font-size: $font-base;
  289. }
  290. }
  291. }
  292. .tip {
  293. padding: 20rpx;
  294. color: #e51c23;
  295. }
  296. .add-btn {
  297. &.modified {
  298. color: $base-color;
  299. }
  300. &.up {
  301. background-color: $base-color;
  302. color: #fff;
  303. }
  304. display: flex;
  305. align-items: center;
  306. justify-content: center;
  307. width: 690rpx;
  308. height: 80rpx;
  309. margin: 0 auto;
  310. margin-top: 30rpx;
  311. font-size: $font-lg;
  312. border-radius: 10rpx;
  313. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  314. }
  315. .list {
  316. padding-left: 30rpx;
  317. margin-top: 30rpx;
  318. background-color: #ffffff;
  319. .box {
  320. display: flex;
  321. align-items: center;
  322. width: 100%;
  323. height: 120rpx;
  324. border-bottom: 1px solid $border-color-light;
  325. .icon {
  326. font-size: 48rpx;
  327. padding-right: 20rpx;
  328. .icon-img {
  329. height: 50rpx;
  330. width: 50rpx;
  331. }
  332. }
  333. .iconweixin1 {
  334. color: #18bf16;
  335. }
  336. .iconzhifubao {
  337. color: #08aaec;
  338. }
  339. .title-box {
  340. flex-grow: 1;
  341. text-align: left;
  342. .title {
  343. font-size: $font-base + 2rpx;
  344. color: $font-color-base;
  345. }
  346. .node {
  347. font-size: $font-sm;
  348. color: $font-color-light;
  349. }
  350. }
  351. }
  352. }
  353. /deep/ .uni-radio-input {
  354. width: 45rpx;
  355. height: 45rpx;
  356. }
  357. .row {
  358. display: flex;
  359. align-items: center;
  360. position: relative;
  361. padding: 0 30upx;
  362. height: 110upx;
  363. background: #fff;
  364. .tit {
  365. flex-shrink: 0;
  366. width: 250upx;
  367. font-size: 30upx;
  368. color: $font-color-dark;
  369. }
  370. .input {
  371. flex: 1;
  372. font-size: 30upx;
  373. color: $font-color-dark;
  374. }
  375. .iconlocation {
  376. font-size: 36upx;
  377. color: $font-color-light;
  378. }
  379. }
  380. </style>