From 4481c6973519ae025e9dcc1be7d4724c64a7bbfc Mon Sep 17 00:00:00 2001
From: huaxinzhu <15565133664@163.com>
Date: Fri, 17 Sep 2021 11:48:33 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7-=E6=8F=90=E6=B5=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/api/module/bankcard.js                 | 19 +++++
 src/views/system/asset/wddetails.vue       |  2 +
 src/views/system/asset/withdraw/index.vue  | 99 ++++++++++------------
 src/views/system/retreat/retreat/index.vue |  6 +-
 4 files changed, 69 insertions(+), 57 deletions(-)

diff --git a/src/api/module/bankcard.js b/src/api/module/bankcard.js
index e073d47..2c68fff 100644
--- a/src/api/module/bankcard.js
+++ b/src/api/module/bankcard.js
@@ -169,3 +169,22 @@ export function addInvoiceData (data) {
     data: data
   });
 }
+
+// 获取验证码
+export function getCheckCodeData(data) {
+  return request({
+    url: '/system/withdrawlog/getCheckCode',
+    method: 'post',
+    data: data
+  })
+}
+
+// 提交 提现申请
+export function applyWithdraw(data) {
+  return request({
+    url: '/system/withdrawlog/applyWithdraw',
+    method: 'post',
+    data: data
+  })
+}
+
diff --git a/src/views/system/asset/wddetails.vue b/src/views/system/asset/wddetails.vue
index 8a6781c..5d25e8b 100644
--- a/src/views/system/asset/wddetails.vue
+++ b/src/views/system/asset/wddetails.vue
@@ -260,6 +260,8 @@
                 let backward4 = strBankcardId.substring(strBankcardId.length-4,strBankcardId.length)
                 this.withdrawInfo.bank_name_all = this.withdrawInfo.bank_name + '\u00a0\u00a0' + Forward4 + '****' + backward4;
               }
+              // 补充发票信息 按钮 是否可以点击
+              this.isSubmitInvoice = this.withdrawInfo.invoice_status == 1 ? true : false;
             }
             // 打款备注
             if(res.data.action_logs && res.data.action_logs.content) {
diff --git a/src/views/system/asset/withdraw/index.vue b/src/views/system/asset/withdraw/index.vue
index 2fbcb6a..b1bdb89 100644
--- a/src/views/system/asset/withdraw/index.vue
+++ b/src/views/system/asset/withdraw/index.vue
@@ -23,29 +23,29 @@
             <el-option v-for="item in bankList" :key="item.id" :label="item.bank_name" :value="item.id"></el-option>
           </el-select>
           <span class="withdraw-tip">
-            您还没有账户,<span>去添加>></span>
+            您还没有账户,<span class="spe-span-a" @click="goToAddBank">去添加</span>
           </span>
         </el-form-item>
 
         <el-form-item label="提现金额:">
           <el-input v-model="withdrawalBalance" disabled placeholder="全部提现金额" style="width:420px;"/>
           <span class="withdraw-tip">
-            不允许手动输入,提现金额必须为全部的可提现余额,
-            手续费将从您的提现金额中扣除,以实际到账为准(开票以实际到账金额开具)
+            提现金额为全部的可提现余额,手续费将从您的提现金额中扣除,以实际到账为准(开票以实际到账金额开具)
           </span>
+          <p class="withdraw-tip-spe">当前提现手续费为:{{ chargeCount }} 元</p>
         </el-form-item>
 
         <el-form-item label="支付密码:" prop="pay_pass">
           <el-input v-model="assetForm.pay_pass" type="password" placeholder="请输入提现密码" style="width:420px;"/>
           <span class="withdraw-tip">
-            忘记支付密码?重新设定
+            忘记支付密码?<span class="spe-span-a" @click="goToSetting">重新设定</span>
           </span>
         </el-form-item>
 
         <el-form-item label="短信验证码:" prop="code" class="spe-code-con-item">
           <el-input v-model="assetForm.code" placeholder="验证码" style="width:420px;">
             <template slot="append">
-              <span v-show="show" @click="getCheckCode">获取验证码</span>
+              <span v-show="show" @click="getCheckCode" style="padding:10px 0;">获取验证码</span>
               <span v-show="!show" class="count">{{count}} s</span>
             </template>
           </el-input>
@@ -61,8 +61,7 @@
   </div>
 </template>
 <script>
-  // import {getSellerInfo, getBankcardList, addWithdrawlog, getCheckCode} from '@/api/module/withdrawlog'
-  import { getMyAssetListData } from '@/api/module/bankcard'
+  import { getMyAssetListData, getCheckCodeData,applyWithdraw } from '@/api/module/bankcard'
 
   export default {
     name: "withdrawlog",
@@ -74,6 +73,7 @@
         count: '',
         timer: null,
 
+        chargeCount: 0, // 手续费
         seller_id: 0,
         currentBalance: 0,
         withdrawalBalance: 0,
@@ -108,6 +108,7 @@
               this.withdrawalBalance = Number(res.data.account_info.new_balance) / 100;
               this.withdrawalProgress = Number(res.data.account_info.new_frozen_money) / 100;
               this.currentBalance = this.add(this.withdrawalBalance,this.withdrawalProgress);
+              this.chargeCount = Number(res.data.account_info.service_fee) / 100;
             }
             // 账户管理
             if(res.data.bank_list) {
@@ -164,10 +165,14 @@
       getCheckCode() {
         let numRegExp = /^[0-9]+(.[0-9]{2})?$/;
 
-        if(this.assetForm.bank_id === '') {
+        if(this.assetForm.bank_id == '') {
           this.$refs.assetForm.validateField("bank_id");
           return;
         }
+        if(this.assetForm.pay_pass ==='') {
+          this.$refs.assetForm.validateField("pay_pass");
+          return;
+        }
 
         if (this.seller_id <= 0) {
           this.msgError("商户信息错误");
@@ -177,12 +182,21 @@
         // 倒计时效果
         this.getCode()
 
-        getCheckCode({seller_id: this.seller_id}).then(response => {
+        getCheckCodeData({seller_id: this.seller_id}).then(response => {
           if (response.code == 0) {
             this.msgSuccess(response.msg);
           }
         });
+      },
 
+      /** 去 资产 首页 添加账户 */
+      goToAddBank() {
+        this.$router.push({ path: "/system/asset/myAsset" });
+      },
+
+      /** 去 设置 密码 */
+      goToSetting() {
+        this.$router.push({ path: "/system/settings/setpsd" });
       },
 
       // 暂时 无用
@@ -219,51 +233,15 @@
 
       /** 提交按钮 */
       submitForm() {
-        this.$refs["form"].validate(valid => {
+        this.$refs["assetForm"].validate(valid => {
           if (valid) {
-            let numberMoney = Number(this.form.amount);
-            let numberCash = Number(this.drawableCash);
-            let numberFee = Number(this.newFee);
-
-            // 提现金额 + 手续费 <= 可提现金额
-            // add   minus
-            // 提现金额 + 手续费
-            let feeAddAmount = this.add(numberFee,numberMoney);
-            let isabled = Number(this.minus( numberCash, feeAddAmount) );
-
-            this.form.seller_id = this.seller_id;
-            // 再次校验 提现信息
-            if(!this.form.seller_id) {
-              this.$message({type: 'error',message: '商户信息有误!'});
-              return;
-            }
-            if(numberMoney < 100 ) {
-              this.$message({type: 'error',message: '提现金额不能小于100'});
-              return;
-            }
-            if( (numberMoney > numberCash) ) {
-              this.$message({type: 'error',message: '提现金额不足!'});
-              return;
-            }
-
-            if( isabled < 0 ) {
-              this.$message({type: 'error',message: '本次操作提现后,【当前余额】不足以支付本次提现的手续费用,请您重新输入提现金额'});
-              return;
-            }
-
-            this.form.amount = Number(this.form.amount);
-
-            // console.log(this.newFee);
-            // console.log(feeAddAmount,isabled);
-            //
-            // return;
-            addWithdrawlog(this.form).then(response => {
-              if (response.code === 1) {
-                this.msgSuccess(response.message);
-                // this.getList();
-              }
-              else {
-                this.$message({type: 'error',message: response.message});
+            applyWithdraw(this.assetForm).then(res => {
+              if (res.code == 1) {
+                this.getMyAssetList()
+                this.resetAssetForm();
+                this.$message({type: 'success',message: '提现成功'});
+              } else {
+                this.$message({type: 'error',message: res.message ? res.message : '提现失败'});
               }
             });
           }
@@ -323,10 +301,25 @@
     box-shadow: 0 -8px 9px 1px rgba(51, 51, 51, 0.06);
   }
 
+  .withdraw-tip-spe {
+    font-size:12px;
+    color: #999;
+    margin: 0;
+  }
+
   .withdraw-tip {
     font-size:12px;
     color: #999;
     margin: 5px;
     line-height: 26px;
   }
+
+  .spe-span-a {
+    color: #409EFF;
+    cursor: pointer;
+  }
+
+  .spe-span-a:hover {
+    /*color: #46a6ff;*/
+  }
 </style>
diff --git a/src/views/system/retreat/retreat/index.vue b/src/views/system/retreat/retreat/index.vue
index 6d8aca8..8e5eacb 100644
--- a/src/views/system/retreat/retreat/index.vue
+++ b/src/views/system/retreat/retreat/index.vue
@@ -46,7 +46,7 @@
           </el-select>
         </el-form-item>
 
-        <el-form-item label="订单号" prop="refund_sn">
+        <el-form-item label="售后订单号" prop="refund_sn">
           <el-input
             v-model="queryParams.refund_sn"
             placeholder="请输入订单号"
@@ -70,7 +70,7 @@
       <el-table class="after-sale-table" :data="afterSaleList" :height="afterSaleHeight">
         <el-table-column label="商品ID" align="center" width="150" prop="goodsId"></el-table-column>
         <el-table-column label="商品名称" align="center" width="180" prop="title"></el-table-column>
-        <el-table-column label="订单号" align="center" width="240" prop="refund_sn"></el-table-column>
+        <el-table-column label="售后订单号" align="center" width="240" prop="refund_sn"></el-table-column>
         <el-table-column label="退换货类型" align="center" width="180">
           <template slot-scope="scope">
             <span v-if="scope.row.refund_type == 1">仅退款</span>
@@ -244,8 +244,6 @@
           refund_sn: '',
           reason: ''
         }
-        // console.log('queryParams:',this.queryParams);
-        //console.log('传向后台的参数:',params);
 
         if( this.queryParams.applyTime.length === 2) {
           params.apply_start_time = new Date(this.queryParams.applyTime[0]).getTime() / 1000
-- 
2.18.1