withdrawal.vue 11 KB

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