JXDS18FUJT 3 mesi fa
parent
commit
c9791406ce
2 ha cambiato i file con 69 aggiunte e 118 eliminazioni
  1. 9 2
      src/api/tool/order.js
  2. 60 116
      src/views/driver/order/index.vue

+ 9 - 2
src/api/tool/order.js

@@ -57,8 +57,15 @@ export function delError(id) {
 export function shareProfit(params){
   return request({
     url: '/order/info/shareProfit/'+params.outTradeNo,
-    method: 'get',
-    params: params
+    method: 'put',
+  })
+}
+
+export function shareProfitBatch(params){
+  return request({
+    url: '/order/info/shareProfitBatch/'+params.ids,
+    method: 'put',
   })
+
 }
 

+ 60 - 116
src/views/driver/order/index.vue

@@ -1,56 +1,25 @@
 <template>
   <div class="app-container">
-    <el-form
-      :model="queryParams"
-      ref="queryForm"
-      :inline="true"
-      v-show="showSearch"
-      label-width="68px"
-    >
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="用户ID" label-width="120px" prop="userId">
-        <el-input
-          v-model="queryParams.userId"
-          placeholder="用户ID"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.userId" placeholder="用户ID" clearable size="small"
+          @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="极速驾培订单ID" label-width="120px" prop="outTradeNo">
-        <el-input
-          v-model="queryParams.outTradeNo"
-          placeholder="极速驾培订单ID"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.outTradeNo" placeholder="极速驾培订单ID" clearable size="small"
+          @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="驾校名称" label-width="120px" prop="school">
-        <el-input
-          v-model="queryParams.schoolName"
-          placeholder="请输入驾校名称"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.schoolName" placeholder="请输入驾校名称" clearable size="small"
+          @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="姓名" label-width="120px" prop="userName">
-        <el-input
-          v-model="queryParams.userName"
-          placeholder="请输入姓名"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.userName" placeholder="请输入姓名" clearable size="small"
+          @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="身份证" label-width="120px" prop="logincode">
-        <el-input
-          v-model="queryParams.logincode"
-          placeholder="请输入身份证"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.logincode" placeholder="请输入身份证" clearable size="small"
+          @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="是否分成" label-width="120px" prop="phoneType">
         <el-select v-model="queryParams.isShare" placeholder="">
@@ -92,13 +61,16 @@
                     @keyup.enter.native="handleQuery" />
             </el-form-item> -->
       <el-form-item>
-        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery"
-          >搜索</el-button
-        >
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
-
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button type="primary" size="mini" @click="handleBatchShareProfit">批量分账</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
     <!-- <el-row :gutter="10" class="mb8">
             <el-col :span="1.5">
                 <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
@@ -115,11 +87,7 @@
             <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row> -->
 
-    <el-table
-      v-loading="loading"
-      :data="errorList"
-      @selection-change="handleSelectionChange"
-    >
+    <el-table v-loading="loading" :data="errorList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
 
       <el-table-column label="用户id" align="center" prop="userId" />
@@ -155,75 +123,29 @@
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            v-if="!scope.row.outRefundNo"
-            :disabled="scope.row.outRefundNo"
-            size="mini"
-            type="text"
-            icon="el-icon-remove-outline"
-            @click="handleRefund(scope.row)"
-            >退款</el-button
-          >
-          <el-popover
-            v-else
-            placement="bottom"
-            title="极速驾培订单退款ID"
-            width="200"
-            trigger="click"
-            :content="scope.row.outRefundNo"
-          >
+          <el-button v-if="!scope.row.outRefundNo" :disabled="scope.row.outRefundNo" size="mini" type="text"
+            icon="el-icon-remove-outline" @click="handleRefund(scope.row)">退款</el-button>
+          <el-popover v-else placement="bottom" title="极速驾培订单退款ID" width="200" trigger="click"
+            :content="scope.row.outRefundNo">
             <el-link type="danger" slot="reference">已退款</el-link>
           </el-popover>
           <div>
-            <el-button
-              v-if="scope.row.isFz == 1"
-             
-              size="mini"
-              type="text"
-            
-              @click="handleShareProfit(scope.row)"
-              >分账</el-button
-            >
-            <el-button
-              v-if="scope.row.isFz == 2"
-              :disabled="scope.row.isFz == 2"
-              size="mini"
-              type="text"
-             
-         
-              >分账完成</el-button
-            >
+            <el-button v-if="scope.row.isFz == 1 && !scope.row.outRefundNo" size="mini" type="text"
+              @click="handleShareProfit(scope.row)">分账</el-button>
+            <el-button v-if="scope.row.isFz == 2 && !scope.row.outRefundNo" :disabled="scope.row.isFz == 2" size="mini"
+              type="text">分账完成</el-button>
 
-            <el-button
-              v-if="scope.row.isFz == 3"
-             
-              size="mini"
-              type="text"
-             
-              @click="handleShareProfit(scope.row)"
-              >重新分账</el-button
-            >
-            <el-button
-              v-if="scope.row.isFz == 4"
-              :disabled="scope.row.isFz == 4"
-              size="mini"
-              type="text"
-             
-              
-              >分账回退</el-button
-            >
+            <el-button v-if="scope.row.isFz == 3 && !scope.row.outRefundNo" size="mini" type="text"
+              @click="handleShareProfit(scope.row)">重新分账</el-button>
+            <el-button v-if="scope.row.isFz == 4" :disabled="scope.row.isFz == 4" size="mini" type="text"><span
+                style="color: #67c23a;">分账回退</span></el-button>
           </div>
         </template>
       </el-table-column>
     </el-table>
 
-    <pagination
-      v-show="total > 0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+      @pagination="getList" />
 
     <!-- 添加或修改错题对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
@@ -253,6 +175,7 @@ import {
   updateError,
   exportError,
   shareProfit,
+  shareProfitBatch
 } from "@/api/tool/order";
 
 export default {
@@ -342,6 +265,29 @@ export default {
         // ,
       };
       this.resetForm("form");
+    },
+    handleBatchShareProfit() {
+      if(this.ids.length==0){
+        this.msgInfo("请勾选列表");
+        return
+      }
+      this.$confirm(`是否批量分账这${this.ids.length}条记录`, "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(res => {
+        return shareProfitBatch({
+          ids: this.ids.join(',')
+        }).then((res) => {
+          console.log(res)
+          this.msgSuccess('分账成功0条,分账失败1条,分账时间不足0条,总计1条。')
+          this.getList();
+          // this.msgSuccess("");
+        });
+      })
+
+
+
     },
     handleShareProfit(row) {
       const outTradeNo = row.outTradeNo;
@@ -352,7 +298,7 @@ export default {
         type: "warning",
       })
         .then(function () {
-          return shareProfit(outTradeNo);
+          return shareProfit({ outTradeNo });
         })
         .then(() => {
           this.getList();
@@ -363,10 +309,8 @@ export default {
       const outTradeNo = row.outTradeNo;
       this.$prompt(
         `确认退款${row.goodsName}吗?
-            请附带退款理由: <div>驾校名称:${row.schoolName}</div><div>学员姓名:${
-          row.userName
-        }</div><div>退款金额:${row.total / 100}元</div> <div>订单号:${
-          row.outTradeNo
+            请附带退款理由: <div>驾校名称:${row.schoolName}</div><div>学员姓名:${row.userName
+        }</div><div>退款金额:${row.total / 100}元</div> <div>订单号:${row.outTradeNo
         }</div> `,
         "警告",
         {