withdrawal.vue 8.6 KB

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