withdrawal.vue 8.8 KB

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