withdrawal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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 + '元'"
  17. placeholder-class="placeholder" />
  18. <view class="buttom" @click="withdrawal = money">全部提现</view>
  19. </view>
  20. </view>
  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">
  28. <text v-if="weixin_no">提现至微信</text>
  29. <text v-else>请创建微信账号</text>
  30. </view>
  31. <view class="node">
  32. <text v-if="weixin_no">账号({{ weixin_no }})</text>
  33. </view>
  34. </view>
  35. <view class="right">
  36. <radio value="weixin" color="#c29963" :checked="type == 'weixin'" />
  37. </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">
  53. <radio value="alipay" color="#c29963" :checked="type == 'alipay'" />
  54. </view>
  55. </view>
  56. </label> -->
  57. <label>
  58. <view class="box">
  59. <view class="icon iconfont">
  60. <image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image>
  61. </view>
  62. <view class="title-box">
  63. <view class="title">
  64. <text v-if="bank_name">{{ bank_name + ' ' + bank_code }}</text>
  65. <text v-else>请创建银行账号</text>
  66. </view>
  67. <view class="node">
  68. <text v-if="bank_people">真实姓名({{ bank_people }})</text>
  69. </view>
  70. </view>
  71. <view class="right">
  72. <radio value="bank" color="#c29963" :checked="type == 'bank'" />
  73. </view>
  74. </view>
  75. </label>
  76. </radio-group>
  77. </view>
  78. <!-- <view class="row b-b" v-if="type == 'weixin'">
  79. <text class="tit">微信账号</text>
  80. <input class="input" type="text" v-model="weixin_no" placeholder="请输入微信账号"
  81. placeholder-class="placeholder" />
  82. </view>
  83. <view class="row b-b" v-if="type == 'alipay'">
  84. <text class="tit">支付宝账号</text>
  85. <input class="input" type="text" v-model="alipay_code" placeholder="请输入支付宝账号"
  86. placeholder-class="placeholder" />
  87. </view>
  88. <view class="row b-b" v-if="type == 'alipay'">
  89. <text class="tit">支付宝姓名</text>
  90. <input class="input" type="text" v-model="alipay_name" placeholder="请输入支付宝姓名"
  91. placeholder-class="placeholder" />
  92. </view>
  93. <view class="row b-b" v-if="type == 'bank'">
  94. <text class="tit">银行卡号</text>
  95. <input class="input" type="text" v-model="bank_code" placeholder="请输入银行卡号"
  96. placeholder-class="placeholder" />
  97. </view>
  98. <view class="row b-b" v-if="type == 'bank'">
  99. <text class="tit">姓名</text>
  100. <input class="input" type="text" v-model="bank_people" placeholder="请输入银行卡姓名"
  101. placeholder-class="placeholder" />
  102. </view>
  103. <view class="row b-b" v-if="type == 'bank'">
  104. <text class="tit">所属银行</text>
  105. <input class="input" type="text" v-model="bank_name" placeholder="请输入所属银行"
  106. placeholder-class="placeholder" />
  107. </view>
  108. <view class="row b-b" v-if="type == 'bank'">
  109. <text class="tit">所属支行</text>
  110. <input class="input" type="text" v-model="bank_belonging" placeholder="请输入所属支行"
  111. placeholder-class="placeholder" />
  112. </view> -->
  113. <button class="add-btn modified" v-if="!weichatBsrowser" @click="navTo('/pages/money/account')">账号管理</button>
  114. <button class="add-btn up" @click="confirm">提交申请</button>
  115. </view>
  116. </template>
  117. <script>
  118. import {
  119. getMoneyStyle
  120. } from '@/utils/rocessor.js';
  121. import {
  122. extractCash,
  123. extractBank,
  124. aliInfo,
  125. bankInfo,
  126. setBank,
  127. getBank
  128. } from '@/api/wallet.js';
  129. import {
  130. orderData,
  131. getUserInfo
  132. } from '@/api/user.js';
  133. import {
  134. mapState,
  135. mapMutations
  136. } from 'vuex';
  137. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  138. export default {
  139. filters: {
  140. getMoneyStyle
  141. },
  142. components: {
  143. uniNoticeBar
  144. },
  145. computed: {
  146. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  147. },
  148. data() {
  149. return {
  150. weixin_no: '',
  151. type: 'bank', //提现方式
  152. money: '0.00', //可提现金额
  153. freeze: '0.0', //冻结金额
  154. withdrawal: '', //提现金额
  155. minPrice: '', //最少提现金额
  156. aliData: {},
  157. bankData: {},
  158. weixin: {},
  159. alipay_code: '',
  160. alipay_name: '',
  161. bank_code: '',
  162. bank_people: '',
  163. bank_name: '',
  164. bank_belonging: '',
  165. // #ifdef H5
  166. weichatBsrowser: false,
  167. // #endif
  168. jftype: 0,
  169. };
  170. },
  171. onLoad(options) {
  172. if(options.jftype) {
  173. this.jftype = options.jftype
  174. if(options.jftype == 1) {
  175. uni.setNavigationBarTitle({
  176. title:'静态积分提现'
  177. })
  178. }
  179. if(options.jftype == 2) {
  180. uni.setNavigationBarTitle({
  181. title:'动态积分提现'
  182. })
  183. }
  184. }
  185. // #ifdef H5
  186. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  187. // #endif
  188. if(this.jftype == 1) {
  189. this.money = this.userInfo.integral
  190. }
  191. if(this.jftype == 2) {
  192. this.money = this.userInfo.dynamic_integral
  193. }
  194. //加载提现信息
  195. this.loadData();
  196. // // 加载提款账号信息
  197. // this.loadAli();
  198. // this.loadBank();
  199. this.dataUp()
  200. },
  201. methods: {
  202. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  203. dataUp() {
  204. let obj = this
  205. getBank().then(res => {
  206. if(res.data.bank.length == 0) {
  207. console.log('没有填信息')
  208. }else {
  209. let bank = res.data.bank
  210. obj.bank_people = bank.name;
  211. obj.bank_name = bank.bank;
  212. obj.bank_code = bank.payment;
  213. obj.bank_belonging = bank.bank_name
  214. // obj.name = bank.name
  215. // obj.phone= bank.phone
  216. // obj.payment= bank.payment
  217. // obj.bank= bank.bank
  218. // obj.bank_name= bank.bank_name
  219. }
  220. })
  221. },
  222. // 加载余额信息
  223. async loadData() {
  224. extractBank({}).then(({
  225. data
  226. }) => {
  227. console.log(data, 'data+++++++++')
  228. this.minPrice = data.minPrice;
  229. // this.money = data.brokerage_price
  230. });
  231. },
  232. // 跳转
  233. navTo(url) {
  234. uni.navigateTo({
  235. url: url
  236. });
  237. },
  238. // 切换选中对象
  239. tabRadio(e) {
  240. this.type = e.detail.value;
  241. },
  242. // 提交
  243. confirm() {
  244. let obj = this
  245. let data = {
  246. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  247. money: this.withdrawal, //金额
  248. type: this.jftype //0佣金1余额
  249. };
  250. if (this.withdrawal % 100 != 0) {
  251. uni.showToast({
  252. title: '提现金额为100的倍数',
  253. duration: 2000,
  254. mask: false,
  255. icon: 'none'
  256. });
  257. return;
  258. }
  259. if (this.withdrawal < this.minPrice) {
  260. uni.showToast({
  261. title: '提现金额不可少于' + this.minPrice,
  262. duration: 2000,
  263. mask: false,
  264. icon: 'none'
  265. });
  266. return;
  267. }
  268. if (this.type == 'alipay') {
  269. console.log('alipay');
  270. data.name = this.alipay_name;
  271. data.alipay_code = this.alipay_code;
  272. }
  273. if (this.type == 'bank') {
  274. console.log('bank');
  275. data.name = this.bank_people;
  276. data.bankname = this.bank_name;
  277. data.cardnum = this.bank_code;
  278. data.bank_belonging = this.bank_belonging
  279. }
  280. if(this.type == 'weixin') {
  281. console.log('weixin');
  282. data.weixin = this.weixin_no
  283. }
  284. extractCash(data)
  285. .then(e => {
  286. // obj.loadData()
  287. getUserInfo({})
  288. .then(({
  289. data
  290. }) => {
  291. obj.setUserInfo(data);
  292. if(obj.jftype == 1) {
  293. obj.money = obj.userInfo.integral
  294. }
  295. if(obj.jftype == 2) {
  296. obj.money = obj.userInfo.dynamic_integral
  297. }
  298. })
  299. .catch(e => {
  300. console.log(e);
  301. });
  302. uni.showToast({
  303. title: '提交成功',
  304. duration: 2000,
  305. position: 'top'
  306. });
  307. })
  308. .catch(e => {
  309. console.log();
  310. });
  311. }
  312. }
  313. };
  314. </script>
  315. <style lang="scss">
  316. page {
  317. height: 100%;
  318. }
  319. .content-money {
  320. padding: 30rpx 0;
  321. background: #ffffff;
  322. }
  323. .flex {
  324. background-color: #ffffff;
  325. text-align: center;
  326. margin: 0 30rpx;
  327. border-radius: $border-radius-sm;
  328. .buttom {
  329. font-size: $font-lg;
  330. width: 50%;
  331. }
  332. .interval {
  333. width: 2px;
  334. height: 60rpx;
  335. background-color: #eeeeee;
  336. }
  337. .icon {
  338. background-size: 100%;
  339. font-size: 42rpx;
  340. color: $font-color-dark;
  341. font-weight: bold;
  342. background-repeat: no-repeat;
  343. background-position: center;
  344. }
  345. .text {
  346. color: $font-color-light;
  347. }
  348. }
  349. .row-box {
  350. margin-top: 30rpx;
  351. padding: 20rpx 30rpx;
  352. background: #fff;
  353. .title {
  354. font-size: $font-base + 2rpx;
  355. color: $font-color-dark;
  356. }
  357. .row {
  358. display: flex;
  359. align-items: center;
  360. position: relative;
  361. height: 80rpx;
  362. .tit {
  363. flex-shrink: 0;
  364. width: 40rpx;
  365. font-size: 30rpx;
  366. color: $font-color-dark;
  367. }
  368. .input {
  369. flex: 1;
  370. font-size: 30rpx;
  371. color: $font-color-dark;
  372. }
  373. .iconlocation {
  374. font-size: 36rpx;
  375. color: $font-color-light;
  376. }
  377. .buttom {
  378. color: $font-color-spec;
  379. font-size: $font-base;
  380. }
  381. }
  382. }
  383. .add-btn {
  384. &.modified {
  385. // color: #ffffff;
  386. border:1px solid #bb9159;
  387. color: #bb9159;
  388. }
  389. &.up {
  390. background: linear-gradient(90deg, #bb9159, #e6c79d);
  391. color: #fff;
  392. }
  393. display: flex;
  394. align-items: center;
  395. justify-content: center;
  396. width: 690rpx;
  397. height: 80rpx;
  398. margin: 0 auto;
  399. margin-top: 30rpx;
  400. font-size: $font-lg;
  401. border-radius: 10rpx;
  402. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  403. }
  404. .list {
  405. padding-left: 30rpx;
  406. margin-top: 30rpx;
  407. background-color: #ffffff;
  408. .box {
  409. display: flex;
  410. align-items: center;
  411. width: 100%;
  412. height: 120rpx;
  413. border-bottom: 1px solid $border-color-light;
  414. .icon {
  415. font-size: 48rpx;
  416. padding-right: 20rpx;
  417. .icon-img {
  418. height: 50rpx;
  419. width: 50rpx;
  420. }
  421. }
  422. .iconweixin1 {
  423. color: #18bf16;
  424. }
  425. .iconzhifubao {
  426. color: #08aaec;
  427. }
  428. .title-box {
  429. flex-grow: 1;
  430. text-align: left;
  431. .title {
  432. font-size: $font-base + 2rpx;
  433. color: $font-color-base;
  434. }
  435. .node {
  436. font-size: $font-sm;
  437. color: $font-color-light;
  438. }
  439. }
  440. }
  441. }
  442. /deep/ .uni-radio-input {
  443. width: 45rpx;
  444. height: 45rpx;
  445. }
  446. .row {
  447. display: flex;
  448. align-items: center;
  449. position: relative;
  450. padding: 0 30upx;
  451. height: 110upx;
  452. background: #fff;
  453. .tit {
  454. flex-shrink: 0;
  455. width: 250upx;
  456. font-size: 30upx;
  457. color: $font-color-dark;
  458. }
  459. .input {
  460. flex: 1;
  461. font-size: 30upx;
  462. color: $font-color-dark;
  463. }
  464. .iconlocation {
  465. font-size: 36upx;
  466. color: $font-color-light;
  467. }
  468. }
  469. .tip {
  470. padding: 20rpx;
  471. color: #fd3b39;
  472. }
  473. </style>