index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view>
  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>{{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'><input placeholder='请输入持卡人姓名' placeholder-class='placeholder' name="name"></input></view>
  17. </view>
  18. <view class='item acea-row row-between-wrapper'>
  19. <view class='name'>卡号</view>
  20. <view class='input'><input type='number' placeholder='请填写卡号' placeholder-class='placeholder' name="cardnum"></input></view>
  21. </view>
  22. <view class='item acea-row row-between-wrapper'>
  23. <view class='name'>银行</view>
  24. <view class='input'>
  25. <picker @change="bindPickerChange" :value="index" :range="array">
  26. <text class='Bank'>{{array[index]}}</text>
  27. <text class='iconfont icon-qiepian38'></text>
  28. </picker>
  29. </view>
  30. </view>
  31. <view class='item acea-row row-between-wrapper'>
  32. <view class='name'>提现</view>
  33. <view class='input'><input :placeholder='"最低提现金额"+minPrice' placeholder-class='placeholder' name="money" type='digit'></input></view>
  34. </view>
  35. <view class='tip'>
  36. 当前可提现金额: <text class="price">¥{{userInfo.commissionCount}},</text>冻结佣金:¥{{userInfo.broken_commission}}
  37. </view>
  38. <view class='tip'>
  39. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  40. </view>
  41. <button formType="submit" class='bnt bg-color'>提现</button>
  42. </form>
  43. </view>
  44. <view :hidden='currentTab != 1' class='list'>
  45. <form @submit="subCash" report-submit='true'>
  46. <view class='item acea-row row-between-wrapper'>
  47. <view class='name'>账号</view>
  48. <view class='input'><input placeholder='请填写您的微信账号' placeholder-class='placeholder' name="name"></input></view>
  49. </view>
  50. <view class='item acea-row row-between-wrapper'>
  51. <view class='name'>提现</view>
  52. <view class='input'><input :placeholder='"最低提现金额"+minPrice' placeholder-class='placeholder' name="money" type='digit'></input></view>
  53. </view>
  54. <view class='tip'>
  55. 当前可提现金额: <text class="price">¥{{userInfo.commissionCount}},</text>冻结佣金:¥{{userInfo.broken_commission}}
  56. </view>
  57. <view class='tip'>
  58. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  59. </view>
  60. <button formType="submit" class='bnt bg-color'>提现</button>
  61. </form>
  62. </view>
  63. <view :hidden='currentTab != 2' class='list'>
  64. <form @submit="subCash" report-submit='true'>
  65. <view class='item acea-row row-between-wrapper'>
  66. <view class='name'>账号</view>
  67. <view class='input'><input placeholder='请填写您的支付宝账号' placeholder-class='placeholder' name="name"></input></view>
  68. </view>
  69. <view class='item acea-row row-between-wrapper'>
  70. <view class='name'>提现</view>
  71. <view class='input'><input :placeholder='"最低提现金额"+minPrice' placeholder-class='placeholder' name="money" type='digit'></input></view>
  72. </view>
  73. <view class='tip'>
  74. 当前可提现金额: <text class="price">¥{{userInfo.commissionCount}},</text>冻结佣金:¥{{userInfo.broken_commission}}
  75. </view>
  76. <view class='tip'>
  77. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  78. </view>
  79. <button formType="submit" class='bnt bg-color'>提现</button>
  80. </form>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- #ifdef MP -->
  85. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  86. <!-- #endif -->
  87. </view>
  88. </template>
  89. <script>
  90. import {
  91. extractCash,
  92. extractBank,
  93. getUserInfo
  94. } from '@/api/user.js';
  95. import {
  96. toLogin
  97. } from '@/libs/login.js';
  98. import {
  99. mapGetters
  100. } from "vuex";
  101. // #ifdef MP
  102. import authorize from '@/components/Authorize';
  103. // #endif
  104. export default {
  105. components: {
  106. // #ifdef MP
  107. authorize
  108. // #endif
  109. },
  110. data() {
  111. return {
  112. navList: [{
  113. 'name': '银行卡',
  114. 'icon': 'icon-yinhangqia'
  115. },
  116. {
  117. 'name': '微信',
  118. 'icon': 'icon-weixin2'
  119. },
  120. {
  121. 'name': '支付宝',
  122. 'icon': 'icon-icon34'
  123. }
  124. ],
  125. currentTab: 0,
  126. index: 0,
  127. array: [], //提现银行
  128. minPrice: 0.00, //最低提现金额
  129. userInfo: [],
  130. isClone: false,
  131. isAuto: false, //没有授权的不会自动授权
  132. isShowAuth: false //是否隐藏授权
  133. };
  134. },
  135. computed: mapGetters(['isLogin']),
  136. onLoad() {
  137. if (this.isLogin) {
  138. this.getUserInfo();
  139. this.getUserExtractBank();
  140. } else {
  141. // #ifdef H5 || APP-PLUS
  142. toLogin();
  143. // #endif
  144. // #ifdef MP
  145. this.isAuto = true;
  146. this.$set(this, 'isShowAuth', true);
  147. // #endif
  148. }
  149. },
  150. methods: {
  151. onLoadFun: function() {
  152. this.getUserInfo();
  153. this.getUserExtractBank();
  154. },
  155. // 授权关闭
  156. authColse: function(e) {
  157. this.isShowAuth = e
  158. },
  159. getUserExtractBank: function() {
  160. let that = this;
  161. extractBank().then(res => {
  162. let array = res.data.extractBank;
  163. array.unshift("请选择银行");
  164. that.$set(that, 'array', array);
  165. that.minPrice = res.data.minPrice;
  166. });
  167. },
  168. /**
  169. * 获取个人用户信息
  170. */
  171. getUserInfo: function() {
  172. let that = this;
  173. getUserInfo().then(res => {
  174. that.userInfo = res.data;
  175. });
  176. },
  177. swichNav: function(current) {
  178. this.currentTab = current;
  179. },
  180. bindPickerChange: function(e) {
  181. this.index = e.detail.value;
  182. },
  183. subCash: function(e) {
  184. let that = this,
  185. value = e.detail.value;
  186. if (that.currentTab == 0) { //银行卡
  187. if (value.name.length == 0) return this.$util.Tips({
  188. title: '请填写持卡人姓名'
  189. });
  190. if (value.cardnum.length == 0) return this.$util.Tips({
  191. title: '请填写卡号'
  192. });
  193. if (that.index == 0) return this.$util.Tips({
  194. title: "请选择银行"
  195. });
  196. value.extract_type = 'bank';
  197. value.bankname = that.array[that.index];
  198. } else if (that.currentTab == 1) { //微信
  199. value.extract_type = 'weixin';
  200. if (value.name.length == 0) return this.$util.Tips({
  201. title: '请填写微信号'
  202. });
  203. value.weixin = value.name;
  204. } else if (that.currentTab == 2) { //支付宝
  205. value.extract_type = 'alipay';
  206. if (value.name.length == 0) return this.$util.Tips({
  207. title: '请填写账号'
  208. });
  209. value.alipay_code = value.name;
  210. }
  211. if (value.money.length == 0) return this.$util.Tips({
  212. title: '请填写提现金额'
  213. });
  214. if (value.money < that.minPrice) return this.$util.Tips({
  215. title: '提现金额不能低于' + that.minPrice
  216. });
  217. extractCash(value).then(res => {
  218. that.getUserInfo();
  219. return this.$util.Tips({
  220. title: res.msg,
  221. icon: 'success'
  222. });
  223. }).catch(err => {
  224. return this.$util.Tips({
  225. title: err
  226. });
  227. });
  228. }
  229. }
  230. }
  231. </script>
  232. <style lang="scss">
  233. page {
  234. background-color: #fff !important;
  235. }
  236. .cash-withdrawal .nav {
  237. height: 130rpx;
  238. box-shadow: 0 10rpx 10rpx #f8f8f8;
  239. }
  240. .cash-withdrawal .nav .item {
  241. font-size: 26rpx;
  242. flex: 1;
  243. text-align: center;
  244. }
  245. .cash-withdrawal .nav .item~.item {
  246. border-left: 1px solid #f0f0f0;
  247. }
  248. .cash-withdrawal .nav .item .iconfont {
  249. width: 40rpx;
  250. height: 40rpx;
  251. border-radius: 50%;
  252. border: 2rpx solid #e93323;
  253. text-align: center;
  254. line-height: 37rpx;
  255. margin: 0 auto 6rpx auto;
  256. font-size: 22rpx;
  257. box-sizing: border-box;
  258. }
  259. .cash-withdrawal .nav .item .iconfont.on {
  260. background-color: #e93323;
  261. color: #fff;
  262. border-color: #e93323;
  263. }
  264. .cash-withdrawal .nav .item .line {
  265. width: 2rpx;
  266. height: 20rpx;
  267. margin: 0 auto;
  268. transition: height 0.3s;
  269. }
  270. .cash-withdrawal .nav .item .line.on {
  271. height: 39rpx;
  272. }
  273. .cash-withdrawal .wrapper .list {
  274. padding: 0 30rpx;
  275. }
  276. .cash-withdrawal .wrapper .list .item {
  277. border-bottom: 1rpx solid #eee;
  278. height: 107rpx;
  279. font-size: 30rpx;
  280. color: #333;
  281. }
  282. .cash-withdrawal .wrapper .list .item .name {
  283. width: 130rpx;
  284. }
  285. .cash-withdrawal .wrapper .list .item .input {
  286. width: 505rpx;
  287. }
  288. .cash-withdrawal .wrapper .list .item .input .placeholder {
  289. color: #bbb;
  290. }
  291. .cash-withdrawal .wrapper .list .tip {
  292. font-size: 26rpx;
  293. color: #999;
  294. margin-top: 25rpx;
  295. }
  296. .cash-withdrawal .wrapper .list .bnt {
  297. font-size: 32rpx;
  298. color: #fff;
  299. width: 690rpx;
  300. height: 90rpx;
  301. text-align: center;
  302. border-radius: 50rpx;
  303. line-height: 90rpx;
  304. margin: 64rpx auto;
  305. }
  306. .cash-withdrawal .wrapper .list .tip2 {
  307. font-size: 26rpx;
  308. color: #999;
  309. text-align: center;
  310. margin: 44rpx 0 20rpx 0;
  311. }
  312. .cash-withdrawal .wrapper .list .value {
  313. height: 135rpx;
  314. line-height: 135rpx;
  315. border-bottom: 1rpx solid #eee;
  316. width: 690rpx;
  317. margin: 0 auto;
  318. }
  319. .cash-withdrawal .wrapper .list .value input {
  320. font-size: 80rpx;
  321. color: #282828;
  322. height: 135rpx;
  323. text-align: center;
  324. }
  325. .cash-withdrawal .wrapper .list .value .placeholder2 {
  326. color: #bbb;
  327. }
  328. .price {
  329. color: $theme-color;
  330. }
  331. </style>