You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

415 lines
11 KiB

3 months ago
  1. <template>
  2. <view :data-theme="theme">
  3. <view class='cash-withdrawal'>
  4. <view class='nav acea-row'>
  5. <view v-for="(item,index) in navList" :key="index" class='item font-color' @click="swichNav(index)">
  6. <view class='line bg_color' :class='currentTab==index ? "on":""'></view>
  7. <view class='iconfont' :class='item.icon+" "+(currentTab==index ? "on":"")'></view>
  8. <view class="tab_text">{{item.name}}</view>
  9. </view>
  10. </view>
  11. <view class='wrapper'>
  12. <view :hidden='currentTab != 0' class='list'>
  13. <form @submit="subCash" report-submit='true'>
  14. <view class='item acea-row row-between-wrapper'>
  15. <view class='name'>持卡人</view>
  16. <view class='input'>
  17. <input placeholder='请输入持卡人姓名' placeholder-class='placeholder' name="name" maxlength="20"></input>
  18. </view>
  19. </view>
  20. <view class='item acea-row row-between-wrapper'>
  21. <view class='name'>卡号</view>
  22. <view class='input'>
  23. <input type='number' placeholder='请填写卡号' placeholder-class='placeholder' name="cardum" maxlength="19"></input>
  24. </view>
  25. </view>
  26. <view class='item acea-row row-between-wrapper'>
  27. <view class='name'>银行</view>
  28. <view class='input'>
  29. <picker @change="bindPickerChange" :value="index" :range="array">
  30. <text class='Bank'>{{array[index]}}</text>
  31. <text class='iconfont icon-qiepian38'></text>
  32. </picker>
  33. </view>
  34. </view>
  35. <view class='item acea-row row-between-wrapper'>
  36. <view class='name'>提现</view>
  37. <view class='input'><input :placeholder='"最低提现金额"+minPrice' placeholder-class='placeholder' name="money" type='digit'></input></view>
  38. </view>
  39. <view class='tip'>
  40. 当前可提现金额: <text class="price">{{commission.commissionCount}},</text>冻结佣金{{commission.brokenCommission}}
  41. </view>
  42. <view class='tip'>
  43. 说明: 每笔佣金的冻结期为{{commission.brokenDay}}到期后可提现
  44. </view>
  45. <button formType="submit" class='bnt bg-color'>提现</button>
  46. </form>
  47. </view>
  48. <view :hidden='currentTab != 1' class='list'>
  49. <form @submit="subCash" report-submit='true'>
  50. <view class='item acea-row row-between-wrapper'>
  51. <view class='name'>账号</view>
  52. <view class='input'>
  53. <input placeholder='请填写您的微信账号' placeholder-class='placeholder' name="name" maxlength="20"></input>
  54. </view>
  55. </view>
  56. <view class='item acea-row row-between-wrapper'>
  57. <view class='name'>提现</view>
  58. <view class='input'>
  59. <input :placeholder='"最低提现金额"+minPrice' placeholder-class='placeholder' name="money" type='digit' maxlength="5"></input>
  60. </view>
  61. </view>
  62. <view class='item acea-row row-top row-between'>
  63. <view class='name'>收款码</view>
  64. <view class="input acea-row">
  65. <view class="picEwm" v-if="qrcodeUrlW">
  66. <image :src="qrcodeUrlW"></image>
  67. <text class='iconfont icon-guanbi1 font-color' @click='DelPicW'></text>
  68. </view>
  69. <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic("W")' v-else>
  70. <text class='iconfont icon-icon25201'></text>
  71. <view>上传图片</view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class='tip'>
  76. 当前可提现金额: <text class="price">{{commission.commissionCount}},</text>冻结佣金{{commission.brokenCommission}}
  77. </view>
  78. <view class='tip'>
  79. 说明: 每笔佣金的冻结期为{{commission.brokenDay}}到期后可提现
  80. </view>
  81. <button formType="submit" class='bnt bg-color'>提现</button>
  82. </form>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import {
  90. extractCash,
  91. extractBank,
  92. extractUser
  93. } from '@/api/user.js';
  94. import {
  95. toLogin
  96. } from '@/libs/login.js';
  97. import {
  98. mapGetters
  99. } from "vuex";
  100. import {Debounce} from '@/utils/validate.js'
  101. let app = getApp();
  102. export default {
  103. data() {
  104. return {
  105. navList: [{
  106. 'name': '银行卡',
  107. 'icon': 'icon-yinhangqia'
  108. },
  109. {
  110. 'name': '微信',
  111. 'icon': 'icon-weixin2'
  112. },
  113. ],
  114. currentTab: 0,
  115. index: 0,
  116. array: [], //提现银行
  117. minPrice: 0.00, //最低提现金额
  118. userInfo: [],
  119. isClone: false,
  120. commission:{},
  121. qrcodeUrlW:"",
  122. qrcodeUrlZ:"",
  123. isCommitted: false, //防止多次提交
  124. theme:app.globalData.theme,
  125. };
  126. },
  127. computed: mapGetters(['isLogin']),
  128. watch:{
  129. isLogin:{
  130. handler:function(newV,oldV){
  131. if(newV){
  132. this.getUserExtractBank();
  133. this.getExtractUser();
  134. }
  135. },
  136. deep:true
  137. }
  138. },
  139. onLoad() {
  140. if (this.isLogin) {
  141. this.getUserExtractBank();
  142. this.getExtractUser();
  143. } else {
  144. toLogin();
  145. }
  146. },
  147. methods: {
  148. uploadpic: function (type) {
  149. let that = this;
  150. that.$util.uploadImageOne({
  151. url: 'upload/image',
  152. name: 'multipart',
  153. model: "user",
  154. pid: 1
  155. }, function(res) {
  156. if(type==='W'){
  157. that.qrcodeUrlW = res.data.url;
  158. }else{
  159. that.qrcodeUrlZ = res.data.url;
  160. }
  161. });
  162. },
  163. /**
  164. * 删除图片
  165. *
  166. */
  167. DelPicW: function () {
  168. this.qrcodeUrlW = "";
  169. },
  170. DelPicZ: function () {
  171. this.qrcodeUrlZ = "";
  172. },
  173. getExtractUser(){
  174. extractUser().then(res=>{
  175. this.commission = res.data;
  176. this.minPrice = res.data.minPrice;
  177. })
  178. },
  179. getUserExtractBank: function() {
  180. let that = this;
  181. extractBank().then(res => {
  182. let array = res.data;
  183. array.unshift("请选择银行");
  184. that.$set(that, 'array', array);
  185. });
  186. },
  187. swichNav: function(current) {
  188. this.currentTab = current;
  189. },
  190. bindPickerChange: function(e) {
  191. this.index = e.detail.value;
  192. },
  193. moneyInput(e) {
  194. //正则表达试
  195. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  196. //重新赋值给input
  197. this.$nextTick(() => {
  198. this.money= e.target.value
  199. })
  200. },
  201. subCash: Debounce(function(e) {
  202. let that = this,
  203. value = e.detail.value;
  204. if (that.currentTab == 0) { //银行卡
  205. if (value.name.length == 0) return this.$util.Tips({
  206. title: '请填写持卡人姓名'
  207. });
  208. if (value.cardum.length == 0) return this.$util.Tips({
  209. title: '请填写卡号'
  210. });
  211. if (that.index == 0) return this.$util.Tips({
  212. title: "请选择银行"
  213. });
  214. value.extractType = 'bank';
  215. value.bankName = that.array[that.index];
  216. } else if (that.currentTab == 1) { //微信
  217. value.extractType = 'weixin';
  218. if (value.name.length == 0) return this.$util.Tips({
  219. title: '请填写微信号'
  220. });
  221. value.wechat = value.name;
  222. value.qrcodeUrl = that.qrcodeUrlW;
  223. }
  224. if (value.money.length == 0) return this.$util.Tips({
  225. title: '请填写提现金额'
  226. });
  227. if (!(/^(\d?)+(\.\d{0,2})?$/.test(value.money))) return this.$util.Tips({
  228. title: '提现金额保留2位小数'
  229. });
  230. if (value.money < that.minPrice) return this.$util.Tips({
  231. title: '提现金额不能低于' + that.minPrice
  232. });
  233. if(this.isCommitted==false){
  234. this.isCommitted=true;
  235. extractCash(value).then(res => {
  236. return this.$util.Tips({
  237. title: "提现成功",
  238. icon: 'success'
  239. },{ tab: 2, url: '/pages/promoter/user_spread_user/index' });
  240. this.isCommitted=false;
  241. }).catch(err => {
  242. this.isCommitted=false;
  243. return this.$util.Tips({
  244. title: err
  245. });
  246. });
  247. }
  248. })
  249. }
  250. }
  251. </script>
  252. <style lang="scss">
  253. page {
  254. background-color: #fff !important;
  255. }
  256. .cash-withdrawal .nav {
  257. height: 130rpx;
  258. box-shadow: 0 10rpx 10rpx #f8f8f8;
  259. }
  260. .cash-withdrawal .nav .item {
  261. font-size: 26rpx;
  262. flex: 1;
  263. text-align: center;
  264. }
  265. .cash-withdrawal .nav .item~.item {
  266. border-left: 1px solid #f0f0f0;
  267. }
  268. .cash-withdrawal .nav .item .iconfont {
  269. width: 40rpx;
  270. height: 40rpx;
  271. border-radius: 50%;
  272. @include coupons_border_color(theme);
  273. @include main_color(theme);
  274. text-align: center;
  275. line-height: 37rpx;
  276. margin: 0 auto 6rpx auto;
  277. font-size: 22rpx;
  278. box-sizing: border-box;
  279. }
  280. .cash-withdrawal .nav .item .iconfont.on {
  281. @include main_bg_color(theme);
  282. color: #fff !important;
  283. @include coupons_border_color(theme);
  284. // border-color: $theme-color;
  285. }
  286. .cash-withdrawal .nav .item .line {
  287. width: 2rpx;
  288. height: 20rpx;
  289. margin: 0 auto;
  290. transition: height 0.3s;
  291. }
  292. .tab_text{
  293. @include main_color(theme);
  294. }
  295. .bg_color{
  296. @include main_bg_color(theme);
  297. }
  298. .cash-withdrawal .nav .item .line.on {
  299. height: 39rpx;
  300. }
  301. .cash-withdrawal .wrapper .list {
  302. padding: 0 30rpx;
  303. }
  304. .cash-withdrawal .wrapper .list .item {
  305. border-bottom: 1rpx solid #eee;
  306. min-height: 28rpx;
  307. font-size: 30rpx;
  308. color: #333;
  309. padding: 39rpx 0;
  310. }
  311. .cash-withdrawal .wrapper .list .item .name {
  312. width: 130rpx;
  313. }
  314. .cash-withdrawal .wrapper .list .item .input {
  315. width: 505rpx;
  316. }
  317. .cash-withdrawal .wrapper .list .item .input .placeholder {
  318. color: #bbb;
  319. }
  320. .cash-withdrawal .wrapper .list .item .picEwm,.cash-withdrawal .wrapper .list .item .pictrue{
  321. width:140rpx;
  322. height:140rpx;
  323. border-radius:3rpx;
  324. position: relative;
  325. margin-right: 23rpx;
  326. }
  327. .cash-withdrawal .wrapper .list .item .picEwm image{
  328. width:100%;
  329. height:100%;
  330. border-radius:3rpx;
  331. }
  332. .cash-withdrawal .wrapper .list .item .picEwm .icon-guanbi1{
  333. position:absolute;
  334. right: -14rpx;
  335. top: -16rpx;
  336. font-size:40rpx;
  337. }
  338. .cash-withdrawal .wrapper .list .item .pictrue{
  339. border:1px solid rgba(221,221,221,1);
  340. font-size:22rpx;
  341. color: #BBBBBB;
  342. }
  343. .cash-withdrawal .wrapper .list .item .pictrue .icon-icon25201{
  344. font-size: 47rpx;
  345. color: #DDDDDD;
  346. margin-bottom: 3px;
  347. }
  348. .cash-withdrawal .wrapper .list .tip {
  349. font-size: 26rpx;
  350. color: #999;
  351. margin-top: 25rpx;
  352. }
  353. .cash-withdrawal .wrapper .list .bnt {
  354. font-size: 32rpx;
  355. color: #fff;
  356. width: 690rpx;
  357. height: 90rpx;
  358. text-align: center;
  359. border-radius: 50rpx;
  360. line-height: 90rpx;
  361. margin: 64rpx auto;
  362. @include main_bg_color(theme);
  363. }
  364. .cash-withdrawal .wrapper .list .tip2 {
  365. font-size: 26rpx;
  366. color: #999;
  367. text-align: center;
  368. margin: 44rpx 0 20rpx 0;
  369. }
  370. .cash-withdrawal .wrapper .list .value {
  371. height: 135rpx;
  372. line-height: 135rpx;
  373. border-bottom: 1rpx solid #eee;
  374. width: 690rpx;
  375. margin: 0 auto;
  376. }
  377. .cash-withdrawal .wrapper .list .value input {
  378. font-size: 80rpx;
  379. color: #282828;
  380. height: 135rpx;
  381. text-align: center;
  382. }
  383. .cash-withdrawal .wrapper .list .value .placeholder2 {
  384. color: #bbb;
  385. }
  386. .price {
  387. @include price_color(theme);
  388. }
  389. </style>