金诚优选前端代码
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.

363 lines
9.7 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="提现" :showIcon="true" bgColor="#fff"></lf-nav>
  4. <view class="tabs">
  5. <view class="tab" v-for="(item, index) in tab_list" :key="index">
  6. <view class="name"
  7. :class="{'active-tab': current == index}"
  8. @click="switchTab(index)">{{ item }}
  9. </view>
  10. </view>
  11. </view>
  12. <view class="content">
  13. <!-- 店铺信息 -->
  14. <view class="card">
  15. <view class="lf-flex">
  16. <image class="shop-avatar" mode="aspectFill" :src="brand.logo"></image>
  17. <view class="shop-name">{{ brand.name }}</view>
  18. </view>
  19. </view>
  20. <!-- 收款信息 - 提现到支付宝 -->
  21. <view class="card" v-if="current == 0">
  22. <view class="lf-font-28 lf-color-222">支付宝姓名</view>
  23. <view class="list">
  24. <view class="lf-flex">
  25. <input class="input" placeholder="请输入您的姓名" v-model="alipay_name" />
  26. </view>
  27. <view class="clear" v-if="alipay_name.length" @click="alipay_name = ''">
  28. <text class="lf-iconfont icon-cuo1"></text>
  29. </view>
  30. </view>
  31. <view class="lf-font-28 lf-color-222 lf-m-t-50">支付宝账号</view>
  32. <view class="list">
  33. <view class="lf-flex">
  34. <input class="input" placeholder="请输入支付宝账号" v-model="alipay_account" />
  35. </view>
  36. <view class="clear" v-if="alipay_account.length" @click="alipay_account = ''">
  37. <text class="lf-iconfont icon-cuo1"></text>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 收款信息 - 提现到银行卡 -->
  42. <view class="card" v-else-if="current == 1">
  43. <view class="lf-font-28 lf-color-222">银行名称</view>
  44. <view class="list">
  45. <view class="lf-flex">
  46. <input class="input" placeholder="请输入您的银行名称" v-model="bank_name" />
  47. </view>
  48. <view class="clear" v-if="bank_name.length" @click="bank_name = ''">
  49. <text class="lf-iconfont icon-cuo1"></text>
  50. </view>
  51. </view>
  52. <view class="lf-font-28 lf-color-222 lf-m-t-50">所属支行</view>
  53. <view class="list">
  54. <view class="lf-flex">
  55. <input class="input" placeholder="请输入银行卡所属支行" v-model="bank_sub_branch" />
  56. </view>
  57. <view class="clear" v-if="bank_sub_branch.length" @click="bank_sub_branch = ''">
  58. <text class="lf-iconfont icon-cuo1"></text>
  59. </view>
  60. </view>
  61. <view class="lf-font-28 lf-color-222 lf-m-t-50">银行卡号</view>
  62. <view class="list">
  63. <view class="lf-flex">
  64. <input class="input" placeholder="请输入银行卡号码" v-model="bank_number" />
  65. </view>
  66. <view class="clear" v-if="bank_number.length" @click="bank_number = ''">
  67. <text class="lf-iconfont icon-cuo1"></text>
  68. </view>
  69. </view>
  70. <view class="lf-font-28 lf-color-222 lf-m-t-50">开户名</view>
  71. <view class="list">
  72. <view class="lf-flex">
  73. <input class="input" placeholder="请输入银行卡开户名" v-model="bank_account_name" />
  74. </view>
  75. <view class="clear" v-if="bank_account_name.length" @click="bank_account_name = ''">
  76. <text class="lf-iconfont icon-cuo1"></text>
  77. </view>
  78. </view>
  79. </view>
  80. <!-- 提现金额 -->
  81. <view class="card">
  82. <view class="lf-font-28 lf-color-222">
  83. <text class="lf-m-r-10">提现金额</text>
  84. <text class="lf-font-24">(当前可用余额{{ balance }})</text>
  85. </view>
  86. <view class="list money-list">
  87. <view class="lf-flex">
  88. <view class="symbol"></view>
  89. <input class="input" type="number" v-model="money" />
  90. </view>
  91. <view class="clear" v-if="money.length" @click="money = ''">
  92. <text class="lf-iconfont icon-cuo1"></text>
  93. </view>
  94. </view>
  95. <view class="lf-font-28 lf-m-t-30" style="color: #F63434;" v-if="isMoney">输入金额超过可用余额</view>
  96. </view>
  97. <!-- 提现说明 -->
  98. <view class="card" v-if="remark.length">
  99. <view class="lf-font-28 lf-color-555 lf-m-b-20">提现说明</view>
  100. <view class="lf-font-28 lf-color-222">
  101. <view v-for="(item, index) in remark" :key="index">{{ item }}</view>
  102. </view>
  103. </view>
  104. <button class="confirm" hover-class="lf-opacity" @click="confirm">确认提现</button>
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. export default {
  110. data(){
  111. return {
  112. tab_list: ['支付宝', '银行卡'],
  113. current: 0, // 支付宝0、银行卡1
  114. alipay_name: '', // 支付宝姓名
  115. alipay_account: '', // 支付宝账号
  116. bank_name: '', // 银行名称
  117. bank_sub_branch: '', // 银行卡所属支行
  118. bank_number: '', // 银行卡号
  119. bank_account_name: '', // 银行卡开户名
  120. money: '', // 提现金额
  121. token: '',
  122. remark: [], // 提现说明
  123. brand: {}, // 商家信息
  124. balance: 0 // 当前可用余额
  125. }
  126. },
  127. computed: {
  128. isMoney(){
  129. return Number(this.money) > this.balance;
  130. }
  131. },
  132. onLoad(){
  133. let token = this.$cookieStorage.get('store_token');
  134. this.token = token;
  135. this.getApplyInfo();
  136. },
  137. methods: {
  138. // 提现申请信息获取
  139. getApplyInfo(){
  140. this.$http.get({
  141. api: 'api/supplier/apply_info',
  142. header: {
  143. token: this.token
  144. }
  145. }).then(res => {
  146. this.balance = res.data.data.balance;
  147. this.brand = res.data.data.brand;
  148. this.remark = res.data.data.remark;
  149. })
  150. },
  151. // 切换tab
  152. switchTab(index){
  153. this.current = index;
  154. },
  155. confirm(){
  156. if(this.current == 0){
  157. // 提现到支付宝
  158. if(!this.alipay_name) return this.$msg('请输入支付宝姓名');
  159. if(!this.alipay_account) return this.$msg('请输入支付宝账号');
  160. if(!this.money) return this.$msg('请输入提现金额');
  161. if(this.isMoney) return this.$msg('提现金额超出当前余额');
  162. if(this.money <= 0) return this.$msg('提现金额需大于0');
  163. this.launch('alipay');
  164. }else if(this.current == 1){
  165. // 提现到银行卡
  166. if(!this.bank_name) return this.$msg('请输入银行名称');
  167. if(!this.bank_sub_branch) return this.$msg('请输入银行卡所属支行');
  168. if(!this.bank_number) return this.$msg('请输入银行卡号');
  169. if(!this.bank_account_name) return this.$msg('请输入银行卡开户名');
  170. if(!this.money) return this.$msg('请输入提现金额');
  171. if(this.isMoney) return this.$msg('提现金额超出当前余额');
  172. if(this.money <= 0) return this.$msg('提现金额需大于0');
  173. this.launch('bankcard');
  174. }
  175. },
  176. launch(type_name){
  177. uni.showLoading({
  178. title: '正在提现中'
  179. })
  180. let par = {
  181. type: type_name,
  182. value: this.money
  183. };
  184. if(type_name == 'bankcard'){
  185. par.bank_name = this.bank_name;
  186. par.bank_branch = this.bank_sub_branch;
  187. par.bank_number = this.bank_number;
  188. par.bank_username = this.bank_account_name;
  189. }else if(type_name == 'alipay'){
  190. par.alipay_name = this.alipay_name;
  191. par.alipay_account = this.alipay_account;
  192. }
  193. this.$http.post({
  194. api: 'api/supplier/cash_apply',
  195. data: par,
  196. header: {
  197. token: this.token
  198. }
  199. }).then(res => {
  200. if(res.data.code == 200){
  201. if(type_name == 'bankcard'){
  202. this.bank_name = '';
  203. this.bank_sub_branch = '';
  204. this.bank_number = '';
  205. this.bank_account_name = '';
  206. }else if(type_name == 'alipay'){
  207. this.alipay_name = '';
  208. this.alipay_account = '';
  209. }
  210. this.money = '';
  211. this.$msg('提现成功', {icon: 'success', duration: 2500});
  212. this.getApplyInfo();
  213. }
  214. uni.hideLoading();
  215. }).catch(err => uni.hideLoading());
  216. }
  217. }
  218. }
  219. </script>
  220. <style>
  221. page{
  222. background-color: #F8F8F8;
  223. }
  224. </style>
  225. <style lang="scss" scoped="scoped">
  226. .tabs{
  227. height: 80rpx;
  228. width: 750rpx;
  229. display: flex;
  230. border-bottom: 1rpx solid #e5e5e5;
  231. background-color: #FFFFFF;
  232. align-items: center;
  233. .tab{
  234. width: 50%;
  235. height: 100%;
  236. display: flex;
  237. justify-content: center;
  238. align-items: center;
  239. .name{
  240. width: max-content;
  241. height: 100%;
  242. font-size: 28rpx;
  243. color: #777777;
  244. display: flex;
  245. align-items: center;
  246. }
  247. .active-tab{
  248. color: #0D2E9A;
  249. font-weight: bold;
  250. position: relative;
  251. &::after{
  252. content: '';
  253. position: absolute;
  254. bottom: 0;
  255. left: calc(50% - 40rpx);
  256. width: 80rpx;
  257. height: 10rpx;
  258. background: #0D2E9A;
  259. border-radius: 8rpx 8rpx 0rpx 0rpx;
  260. }
  261. }
  262. }
  263. }
  264. .content{
  265. padding: 30rpx 32rpx;
  266. }
  267. .card{
  268. padding: 30rpx;
  269. box-sizing: border-box;
  270. width: 686rpx;
  271. height: max-content;
  272. background: #FFFFFF;
  273. border-radius: 20rpx;
  274. transition: all 1s;
  275. &:nth-child(n+2){
  276. margin-top: 30rpx;
  277. }
  278. .shop-avatar{
  279. width: 100rpx;
  280. height: 100rpx;
  281. border-radius: 50%;
  282. margin-right: 20rpx;
  283. }
  284. .shop-name{
  285. width: 502rpx;
  286. height: max-content;
  287. font-size: 36rpx;
  288. color: #222222;
  289. font-weight: bold;
  290. }
  291. .list{
  292. height: 90rpx;
  293. width: 100%;
  294. border-bottom: 1rpx solid #e5e5e5;
  295. display: flex;
  296. justify-content: space-between;
  297. align-items: center;
  298. margin-top: 10rpx;
  299. .input{
  300. width: 540rpx;
  301. height: 80rpx;
  302. font-size: 28rpx;
  303. }
  304. .input-code{
  305. width: 430rpx;
  306. }
  307. .clear{
  308. padding: 20rpx;
  309. }
  310. .code{
  311. min-width: 180rpx;
  312. max-width: 220rpx;
  313. height: 64rpx;
  314. padding: 0 4rpx;
  315. font-size: 24rpx;
  316. color: #15716E;
  317. display: flex;
  318. justify-content: center;
  319. align-items: center;
  320. border-radius: 32rpx;
  321. border: 2rpx solid #15716E;
  322. }
  323. .active-bg{
  324. background: #efefef;
  325. }
  326. .symbol{
  327. width: 30rpx;
  328. height: 90rpx;
  329. font-size: 36rpx;
  330. color: #222222;
  331. display: flex;
  332. align-items: flex-end;
  333. }
  334. }
  335. .money-list{
  336. height: 140rpx;
  337. .input{
  338. width: 500rpx;
  339. height: 130rpx;
  340. font-size: 72rpx;
  341. font-weight: bold;
  342. margin-left: 20rpx;
  343. }
  344. }
  345. }
  346. .confirm{
  347. width: 550rpx;
  348. height: 100rpx;
  349. background: #0D2E9A;
  350. border-radius: 50rpx;
  351. color: #FFFFFF;
  352. line-height: 100rpx;
  353. margin-top: 50rpx;
  354. font-size: 32rpx;
  355. }
  356. </style>