소스 검색

销售政策对接

howie 3 년 전
부모
커밋
ab2cd71fad

+ 252 - 2
src/api/supply/sales.js

@@ -1,9 +1,259 @@
 import request from '@/utils/request'
 
-// 获取列表
+
+// 销售政策
 export function getList(params) {
   return request({
-    url: '/admin/user/mch/list',
+    url: '/policy/list',
+    method: 'get',
+    params
+  })
+}
+//新增政策
+export function addPoliy(params) {
+  return request({
+    url: '/policy/add',
+    method: 'post',
+    data: params
+  })
+}
+//新增政策条件
+
+export function addPoliyCondition(params) {
+  return request({
+    url: '/policy/condition/add',
+    method: 'post',
+    data: params
+  })
+}
+//政策条件列表
+export function getConditionList(params) {
+  return request({
+    url: '/policy/condition/list',
+    method: 'get',
+    params
+  })
+}
+
+
+
+export function updatePolicy(params) {
+  return request({
+    url: '/policy/update',
+    method: 'post',
+    data:params
+  })
+}
+
+export function deletePolicy(params) {
+  return request({
+    url: '/policy/delete',
+    method: 'post',
+    params
+  })
+}
+
+export function getConditionMaterialDetail(params) {
+  return request({
+    url: '/policy/condition/detail',
+    method: 'get',
+    params
+  })
+}
+//政策条件的机型列表
+export function getConditionMaterialList(params) {
+  return request({
+    url: '/policy/condition/material/list',
+    method: 'get',
+    params
+  })
+}
+//经销商api
+
+export function getCrList(params) {
+  return request({
+    url: '/customer/list',
+    method: 'get',
+    params
+  })
+}
+
+//政策销售商列表
+export function getCustomerList(params) {
+  return request({
+    url: '/policy/customer/list',
+    method: 'get',
+    params
+  })
+}
+//获取销售政策编号
+export function getId(params) {
+  return request({
+    url: '/policy/id',
+    method: 'get',
+    params
+  })
+}
+
+
+export function toExamine(params) {
+  return request({
+    url: '/policy/examine',
+    method: 'post',
+    params
+  })
+}
+//导入政策货品
+// /policy/material/import
+
+//政策货品列表
+
+export function getMaterialList(params) {
+  return request({
+    url: '/policy/material/list',
+    method: 'get',
+    params
+  })
+}
+//提审政策
+export function getpolicySubmit(params) {
+  return request({
+    url: '/policy/policy/submit',
+    method: 'post',
+   params
+  })
+}
+
+//删除政策货品
+
+export function deleteMaterialPolicy(params) {
+  return request({
+    url: '/policy/material/delete',
+    method: 'post',
+    params
+  })
+}
+
+//获取经销商详情
+export function getPolicyDetail(params) {
+  return request({
+    url: '/policy/detail',
+    method: 'get',
+    params
+  })
+}
+
+// 对应经销商
+
+export function getCustomerlist(params) {
+  return request({
+    url: '/policy/customer_count/list',
+    method: 'get',
+    params
+  })
+}
+
+export function eidtBatch(params) {
+  return request({
+    url: '/policy/customer_count/batch',
+    method: 'post',
+    params
+  })
+}
+
+
+
+//销售类型
+
+export function getTypeList(params) {
+  return request({
+    url: '/sale/type/list',
+    method: 'get',
+    params
+  })
+}
+
+export function DeleteData(params) {
+  return request({
+    url: '/policy/material/delete',
+    method: 'psot',
+    params
+  })
+}
+
+export function addData(params) {
+  return request({
+    url: '/sale/type/add',
+    method: 'post',
+    data: params
+  })
+}
+
+export function delTypeData(params) {
+  return request({
+    url: '/sale/type/delete',
+    method: 'post',
+    params
+  })
+}
+
+export function getDetail(params) {
+  return request({
+    url: '/sale/type/detail',
+    method: 'post',
+    data: params
+  })
+}
+
+export function updateType(params) {
+  return request({
+    url: '/sale/type/update',
+    method: 'post',
+    data: params
+  })
+}
+
+// 返利钱包列表
+
+export function getWalletList(params) {
+  return request({
+    url: '/wallet/rebate/list',
+    method: 'get',
+    params
+  })
+}
+
+
+export function addWallet(params) {
+  return request({
+    url: '/wallet/add',
+    method: 'post',
+    data: params
+  })
+}
+
+
+export function getWalletDetail(params) {
+  return request({
+    url: '/wallet/rebate/detail',
+    method: 'get',
+    params
+  })
+}
+
+export function updateWallet(params) {
+  return request({
+    url: '/wallet/update',
+    method: 'post',
+    data: params
+  })
+}
+
+
+// 销售品类
+export function getDictList(params) {
+  return request({
+    url: '/common/dict/list',
     method: 'get',
     params
   })

+ 7 - 0
src/mixin/index.js

@@ -26,6 +26,12 @@ export default {
       this.currentPage = 1;
       this.getList();
     },
+    hanlePagination(val){
+    // 更改每页数量
+    this.handleSizeChange(val)
+    // 更改当前页
+    this.handleCurrentChange(val)
+    },
     // 更改每页数量
     handleSizeChange(val) {
       this.pageSize = val;
@@ -37,6 +43,7 @@ export default {
       this.currentPage = val;
       this.getList();
     },
+
     // Windows全局打印
     hanlePrint() {
       window.print()

+ 108 - 91
src/views/sales_policy/codealer_list.vue

@@ -1,64 +1,77 @@
 <template>
   <el-container v-if="isShow">
     <el-header height="100%" class="mg">
-      <el-row>
-        <el-col :span="6">
-          <el-input
-            v-model="input"
-            placeholder="销售政策编号"
-            size="normal"
-            clearable
-            @change=""
-          ></el-input>
-        </el-col>
-        <el-col :span="6" :push="1">
-          <el-input
-            v-model="input"
-            placeholder="销售政策说明"
-            size="normal"
-            clearable
-            @change=""
-          ></el-input>
-        </el-col>
-        <el-col :span="6" :push="2">
-          <el-input
-            v-model="input"
-            placeholder="表头备注"
-            size="normal"
-            clearable
-            @change=""
-          ></el-input>
-        </el-col>
-        <!-- <el-col :span="6" class="btn">
+      <el-form
+        size="small"
+        :model="searchForm"
+        ref="searchForm"
+        :inline="false"
+      >
+        <el-row :gutter="20">
+          <el-col :xs="24" :sm="8" :lg="8">
+            <el-form-item prop="code">
+              <el-input
+                size="small"
+                v-model="searchForm.code"
+                placeholder="销售政策编号"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="8" :lg="8">
+            <el-form-item prop="remark">
+              <el-input
+                size="small"
+                v-model="searchForm.remark"
+                placeholder="销售政策说明"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="8" :lg="8">
+            <el-form-item prop="title">
+              <el-input
+                size="small"
+                v-model="searchForm.title"
+                placeholder="表头备注"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
 
-        </el-col> -->
-      </el-row>
-      <el-row class="mg">
-        <el-button type="primary" size="default" @click="">查询</el-button>
-        <el-button type="primary" size="default" @click="">重置</el-button>
-        <el-button type="primary" size="default" @click="">导出</el-button>
-      </el-row>
+        <el-row class="mg">
+          <el-button type="primary" size="small" @click="submitScreenForm"
+            >查询</el-button
+          >
+          <el-button type="primary" size="small" @click="resetScreenForm"
+            >重置</el-button
+          >
+          <el-button type="primary" size="small" @click="">导出</el-button>
+        </el-row>
+      </el-form>
     </el-header>
     <el-main>
-      <el-table :data="tableData" border style="width: 100%">
+      <el-table :data="dataList" border style="width: 100%">
         <el-table-column prop="name" label="操作" width="120" align="center">
+          <template slot-scope>
+            <el-button type="text" size="small" @click="">详情</el-button>
+          </template>
         </el-table-column>
-        <el-table-column
-          prop="province"
-          label="状态"
-          width="120"
-          align="center"
-        >
+        <el-table-column prop="status" label="状态" width="120" align="center">
+          <template slot-scope="scope">
+            <el-tag type="success" size="small" v-if="scope.row.status == 1"
+              >已生效</el-tag
+            >
+            <el-tag type="danger" size="small" v-else>未生效</el-tag>
+          </template>
         </el-table-column>
         <el-table-column
-          prop="city"
+          prop="code"
           label="销售政策编号"
           width="150"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="address"
+          prop="title"
           label="销售政策说明"
           width="400"
           align="center"
@@ -67,74 +80,77 @@
         <el-table-column prop="zip" label="表头备注" width="200" align="center">
         </el-table-column>
         <el-table-column
-          prop="zip"
+          prop="customerCount"
           label="关联经销商"
           width="150"
           align="center"
         >
         </el-table-column>
-        <el-table-column prop="zip" label="生效日期" align="center">
+        <el-table-column prop="startTime" label="生效日期" align="center">
         </el-table-column>
-        <el-table-column prop="zip" label="结束日期" align="center">
+        <el-table-column prop="endTime" label="结束日期" align="center">
         </el-table-column>
-        <el-table-column prop="zip" label="制表人" align="center">
+        <el-table-column prop="createBy " label="制表人" align="center">
         </el-table-column>
-        <el-table-column prop="zip" label="制表日期" align="center">
+        <el-table-column prop="createTime" label="制表日期" align="center">
         </el-table-column>
       </el-table>
     </el-main>
-    <Pagination />
+    <!-- 分页 -->
+    <div class="fr">
+      <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="currentPage"
+        :page-sizes="[10, 20, 30, 50]"
+        :page-size="10"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="listTotal"
+      >
+      </el-pagination>
+    </div>
   </el-container>
-  <Distributor v-else/>
+  <Distributor v-else />
 </template>
 
 <script>
-import Pagination from "./components/Pagination";
-import Distributor from './components/Distributor'
+import { getCustomerlist } from "@/api/supply/sales";
+import Minxin from "@/mixin";
+import Distributor from "./components/Distributor";
 export default {
+  mixins: [Minxin],
   data() {
     return {
-      isShow:false,
+      isShow: false,
       input: "",
-      tableData: [
-        {
-          date: "2016-05-02",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          date: "2016-05-04",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1517 弄",
-          zip: 200333,
-        },
-        {
-          date: "2016-05-01",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1519 弄",
-          zip: 200333,
-        },
-        {
-          date: "2016-05-03",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1516 弄",
-          zip: 200333,
-        },
-      ],
+      dataList: [],
+      searchForm: {
+        code: "",
+        remark: "",
+        title: "",
+      },
     };
   },
+  methods: {
+    getList() {
+      this.listLoading = true;
+      const params = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        code: this.searchForm.code,
+        remark: this.searchForm.remark,
+        title: this.searchForm.title,
+      };
+      getCustomerlist(params).then((res) => {
+        console.log(res);
+        this.dataList = res.data.records;
+        this.listLoading = false;
+      });
+    },
+  },
   components: {
-    Pagination,
-    Distributor
+
+    Distributor,
   },
 };
 </script>
@@ -143,6 +159,7 @@ export default {
 .mg {
   margin: 20px 0;
 }
+
 .btn {
   text-align: right;
 }

+ 81 - 72
src/views/sales_policy/components/AddCondition.vue

@@ -8,8 +8,15 @@
     <el-main>
       <el-row>
         <el-row :gutter="50">
-          <el-col :xs="24" :sm="12" :lg="12" class="mgb">
-            <el-row>
+          <el-col
+            :xs="24"
+            :sm="24"
+            :lg="24"
+            class="mgb"
+            v-for="(item, index) in conditionBox"
+            :key="index"
+          >
+            <el-row v-for="col in item">
               <el-row class="pdt">
                 <el-button
                   type="primary"
@@ -23,36 +30,13 @@
                 >
               </el-row>
               <el-row>
-                <el-table style="width: 100%" :data="tableData" border>
+                <el-table style="width: 100%" :data="col" border>
                   <el-table-column type="selection" width="55" align="center">
                   </el-table-column>
-                  <el-table-column label="日期" width="120" align="center">
+                  <el-table-column label="货品名称" width="300" align="center">
                     <template slot-scope="scope">{{ scope.row.date }}</template>
                   </el-table-column>
-                  <el-table-column prop="name" label="姓名" align="center">
-                  </el-table-column>
-                </el-table>
-              </el-row>
-            </el-row>
-          </el-col>
-          <el-col :xs="24" :sm="12" :lg="12" class="mgb">
-            <el-row>
-              <el-row class="pdt">
-                <el-button type="primary" size="small" @click=""
-                  >添加机型</el-button
-                >
-                <el-button type="primary" size="small" @click=""
-                  >删除机型</el-button
-                >
-              </el-row>
-              <el-row>
-                <el-table style="width: 100%" :data="tableData" border>
-                  <el-table-column type="selection" width="55" align="center">
-                  </el-table-column>
-                  <el-table-column label="日期" width="120" align="center">
-                    <template slot-scope="scope">{{ scope.row.date }}</template>
-                  </el-table-column>
-                  <el-table-column prop="name" label="姓名" align="center">
+                  <el-table-column prop="name" label="规格型号" align="center">
                   </el-table-column>
                 </el-table>
               </el-row>
@@ -61,15 +45,15 @@
         </el-row>
         <el-row>
           <el-form label-width="120px" :inline="false" size="small">
-            <el-col :xs="24" :sm="2" :lg="2">
+            <el-row>
               <el-form-item label="配置比例设置"> </el-form-item>
-            </el-col>
-            <el-col :xs="24" :sm="9" :lg="9">
+            </el-row>
+            <el-col :xs="24" :sm="8" :lg="8">
               <el-form-item label="限定机型">
                 <el-input size="small"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :xs="24" :sm="9" :lg="9">
+            <el-col :xs="24" :sm="8" :lg="8" v-for="len in conditionBox">
               <el-form-item label="配提比例">
                 <el-input size="small"></el-input>
               </el-form-item>
@@ -85,61 +69,78 @@
         <el-divider></el-divider>
       </el-row>
     </el-main>
-    <el-footer height="100px">
-      <el-button type="primary" size="small" @click="">保存</el-button>
-      <el-button type="primary" size="small" @click="">重置</el-button>
+    {{id}}{{55}}
+    <el-footer height="100px" v-if="!id">
+      <el-row :gutter="20">
+        <el-col :xs="24" :sm="12" :lg="12" :offset="0">
+          <el-button type="primary" size="small" @click="handleSubmit"
+            >保存</el-button
+          >
+          <el-button type="primary" size="small" @click="">重置</el-button>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="12" :offset="0" class="tr">
+          <el-button type="primary" size="small" @click="hanleAddModel"
+            >添加</el-button
+          >
+        </el-col>
+      </el-row>
     </el-footer>
     <AddModel :centerDialogVisible="centerDialogVisible" />
   </el-container>
 </template>
 
 <script>
+import { getId, addPoliyCondition,getConditionMaterialList,getConditionMaterialDetail } from "@/api/supply/sales";
+import { string } from "yargs";
 import AddModel from "./AddModel";
 export default {
+  props:{
+    id:{
+      type:String,
+      default:''
+    }
+  },
   data() {
     return {
+      base: {
+        id: null,
+        policyConditionMaterials: [
+          {
+            id: null,
+            materialId: "",
+            materialName: "",
+            materialNumber: "",
+            policyConditionId: "",
+            policyId: "",
+            policyMaterialId: "",
+            popType: 0,
+            specification: "",
+            walletType: "",
+          },
+        ],
+        policyId: "",
+        policyName: "",
+        pop: "",
+      },
       centerDialogVisible: false,
-      tableData: [
-        {
-          date: "2016-05-03",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-02",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-04",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-01",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-08",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-06",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-        {
-          date: "2016-05-07",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-      ],
+      conditionBox: [[{}], [{}]],
+
       multipleSelection: [],
+      searchForm: {
+        code: "",
+      },
     };
   },
+  created() {
+    this.getCommonApi();
+  },
   methods: {
+    getCommonApi() {
+      getId().then((res) => {
+        console.log(res.data);
+        this.searchForm.code = res.data;
+      });
+    },
     toggleSelection(rows) {
       if (rows) {
         rows.forEach((row) => {
@@ -149,6 +150,14 @@ export default {
         this.$refs.multipleTable.clearSelection();
       }
     },
+    hanleAddModel() {
+      this.conditionBox.push([{}]);
+    },
+    handleSubmit() {
+      addPoliyCondition().then((res) => {
+        console.log(res);
+      });
+    },
     handleSelectionChange(val) {
       this.multipleSelection = val;
     },

+ 315 - 129
src/views/sales_policy/components/AddPolicy.vue

@@ -4,35 +4,42 @@
       <h4>销售政策信息</h4>
       <el-divider></el-divider>
       <el-form
-        :model="ruleForm"
+        :model="searchForm"
         :rules="rules"
-        ref="ruleForm"
+        ref="searchForm"
         label-width="120px"
         size="small"
-        class="demo-ruleForm"
+        class="demo-searchForm"
       >
         <el-row>
           <el-col :xs="24" :ms="12" :lg="12">
-            <el-form-item label="销售政策编号" prop="name">
+            <el-form-item label="销售政策编号" prop="code">
               <el-input
-                v-model="ruleForm.name"
+                disabled
+                v-model="searchForm.code"
                 placeholder="如未填写,则系统自动生成"
               ></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="12" :lg="12">
-            <el-form-item label="销售政策说明" prop="name">
+            <el-form-item label="销售政策说明" prop="title">
               <el-input
-                v-model="ruleForm.name"
+                v-model="searchForm.title"
                 placeholder="销售政策说明"
               ></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="12" :lg="12">
-            <el-form-item label="销售政策类型" prop="name">
-              <el-select v-model="value" placeholder="请选择">
+            <el-form-item label="销售政策类型" prop="type">
+              <el-select
+                size="small"
+                v-model="searchForm.type"
+                placeholder="销售政策类型"
+                @change="hanleChange"
+                class="select_height"
+              >
                 <el-option
-                  v-for="item in options"
+                  v-for="item in typeOptions"
                   :key="item.value"
                   :label="item.label"
                   :value="item.value"
@@ -45,54 +52,54 @@
             <el-form-item label="支付钱包类型" prop="name">
               <el-select v-model="value" placeholder="请选择">
                 <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+                  v-for="item in walletList"
+                  :key="item.mainId"
+                  :label="item.mainName"
+                  :value="item.mainId"
                 >
                 </el-option>
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :xs="24" :ms="12" :lg="12">
-            <el-form-item label="制单人" prop="name">
-              <el-input
-                v-model="ruleForm.name"
-                placeholder=""
-              ></el-input> </el-form-item
-          ></el-col>
+
           <el-col :xs="24" :ms="12" :lg="12">
             <el-form-item label="制单日期" prop="name">
-              <el-input
-                v-model="ruleForm.name"
-                placeholder="如未填写,则系统自动生成"
-              ></el-input> </el-form-item
+              <el-date-picker
+                v-model="searchForm.name"
+                type="date"
+                placeholder="制单日期"
+              >
+              </el-date-picker> </el-form-item
           ></el-col>
 
           <el-col :xs="24" :ms="12" :lg="12">
-            <el-form-item label="生效日期" prop="name">
-              <el-input
-                v-model="ruleForm.name"
-                placeholder=""
-              ></el-input> </el-form-item
+            <el-form-item label="生效日期" prop="startTime">
+              <el-date-picker
+                v-model="searchForm.startTime"
+                type="date"
+                placeholder="生效日期"
+              >
+              </el-date-picker> </el-form-item
           ></el-col>
           <el-col :xs="24" :ms="12" :lg="12">
-            <el-form-item label="失效日期" prop="name">
-              <el-input
-                v-model="ruleForm.name"
-                placeholder=""
-              ></el-input> </el-form-item
+            <el-form-item label="失效日期" prop="endTime">
+              <el-date-picker
+                v-model="searchForm.endTime"
+                type="date"
+                placeholder="失效日期"
+              >
+              </el-date-picker> </el-form-item
           ></el-col>
           <el-col :xs="24" :ms="24" :lg="24">
-            <el-form-item label="表头备注" prop="name">
+            <el-form-item label="表头备注" prop="remark">
               <el-input
-                v-model="ruleForm.name"
+                v-model="searchForm.remark"
                 placeholder="新风机变频挂机。按提货数量1:3开单"
               ></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="24" :lg="24">
-            <el-form-item label="政策封面图">
+            <el-form-item label="政策封面图" prop="imgSrc">
               <el-upload
                 class="avatar-uploader"
                 action="https://jsonplaceholder.typicode.com/posts/"
@@ -114,10 +121,17 @@
         <el-row type="flex">
           <el-col :span="12">
             <h4 style="display: inline-block; margin-right: 20px">货品信息</h4>
-            <el-button size="small"> 导入货品价格表</el-button></el-col
-          >
-          <el-col :span="12" class="tr">
-            <el-button size="small">管理条件</el-button>
+            <el-upload
+              class="import-btn"
+              :action="baseURL + 'student/import'"
+              :http-request="handleImport"
+              :file-list="importFileList"
+            >
+              <el-button size="small">导入货品价格表</el-button>
+            </el-upload>
+            <el-button size="small" @click="hanleDownloadFiles"
+              >下载模板</el-button
+            >
           </el-col>
         </el-row>
         <el-divider></el-divider>
@@ -139,45 +153,99 @@
           align="center"
         >
         </el-table-column>
-        <el-table-column prop="name" label="货品编码" align="center">
+        <el-table-column prop="materialNumber" label="货品编码" align="center">
         </el-table-column>
-        <el-table-column prop="province" label="货品名称" align="center">
+        <el-table-column prop="materialName" label="货品名称" align="center">
         </el-table-column>
-        <el-table-column prop="city" label="规格型号" align="center">
+        <el-table-column prop="specification" label="规格型号" align="center">
         </el-table-column>
         <el-table-column
-          prop="address"
+          prop="saleTypeCode"
           label="销售类型编码"
           width="500"
           align="center"
         >
         </el-table-column>
-        <el-table-column prop="zip" label="销售类型" align="center">
+        <el-table-column prop="saleTypeName" label="销售类型" align="center">
         </el-table-column>
-        <el-table-column prop="zip" label="单价" align="center">
+        <el-table-column prop="price" label="单价" align="center">
         </el-table-column>
-        <el-table-column prop="zip" label="支付钱包" align="center">
+        <el-table-column label="支付钱包" align="center">
+          <template slot-scope="scope">
+            <el-tag
+              type="danger"
+              size="small"
+              v-if="scope.row.walletCommonly == 1"
+            >
+              允许普通钱包
+            </el-tag>
+            <el-tag type="danger" size="small" v-else
+              >不允许使用普通钱包</el-tag
+            >
+            <el-tag
+              type="danger"
+              size="small"
+              v-if="scope.row.walletDeduct == 1"
+            >
+              允许抵扣钱包</el-tag
+            >
+            <el-tag type="danger" size="small" v-else>不允许抵扣钱包</el-tag>
+            <el-tag
+              type="danger"
+              size="small"
+              v-if="scope.row.walletRebate == 1"
+            >
+              允许返利钱包
+            </el-tag>
+            <el-tag type="danger" size="small" v-else>不允许返利钱包</el-tag>
+            <el-tag
+              type="danger"
+              size="small"
+              v-if="scope.row.walletSpecial == 1"
+              >允许特殊钱包</el-tag
+            >
+            <el-tag type="danger" size="small" v-else> 不允许特殊钱包 </el-tag>
+          </template>
         </el-table-column>
         <el-table-column fixed="right" label="操作" align="center">
           <template slot-scope="scope">
-            <el-button type="text" size="small">删除</el-button>
+            <el-popconfirm
+              title="这是一段内容确定删除吗?"
+              @onConfirm="hnaleDelete(scope.row.id)"
+            >
+              <el-button slot="reference" size="small">删除</el-button>
+            </el-popconfirm>
           </template>
         </el-table-column>
       </el-table>
-      <Pagination />
+        <!-- 分页 -->
+      <div class="fr">
+        <el-pagination
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="currentPage"
+          :page-sizes="[10, 20, 30, 50]"
+          :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="listTotal"
+        >
+        </el-pagination>
+      </div>
       <el-row>
         <el-divider></el-divider>
         <el-row type="flex">
           <el-col :span="12">
             <h4 style="display: inline-block; margin-right: 20px">条件信息</h4>
-            <el-button size="small">添加</el-button></el-col
+            <el-button size="small" @click="$parent.isShow = 3"
+              >管理条件</el-button
+            ></el-col
           >
         </el-row>
         <el-divider></el-divider>
       </el-row>
       <el-table
         v-loading="listLoading"
-        :data="dataList"
+        :data="conditionList"
         element-loading-text="Loading"
         border
         fit
@@ -186,7 +254,7 @@
       >
         <el-table-column
           fixed
-          prop="num"
+          type="index"
           label="序号"
           width="50"
           align="center"
@@ -194,13 +262,8 @@
         </el-table-column>
         <el-table-column prop="name" label="限定条件" align="center">
         </el-table-column>
-        <el-table-column prop="province" label="限定机型" align="center">
-        </el-table-column>
-        <el-table-column prop="city" label="配体机型" align="center">
-        </el-table-column>
-        <el-table-column fixed="right" label="操作" align="center">
+        <el-table-column fixed="right" width="150" label="操作" align="center">
           <template slot-scope="scope">
-            <el-button type="text" size="small">编辑</el-button>
             <el-button type="text" size="small">删除</el-button>
           </template>
         </el-table-column>
@@ -217,27 +280,46 @@
         </el-row>
         <el-divider></el-divider>
       </el-row>
-      <el-row class="radio">
-        <el-radio v-model="radio" label="1">全部经销商</el-radio>
-        <el-radio v-model="radio" label="2">品类</el-radio>
-        <el-radio v-model="radio" label="1">地区</el-radio>
-        <el-radio v-model="radio" label="2">指定</el-radio>
-      </el-row>
-      <Transfer />
+
+      <Transfer @handleAddPolicy="handleAddPolicy" :dataL="customerList" />
     </div>
   </div>
 </template>
 
 <script>
+import {
+  getId,
+  addPoliy,
+  getTypeList,
+  getWalletList,
+  getMaterialList,
+  getConditionList,
+  getCrList,
+} from "@/api/supply/sales";
+import {
+  downloadFiles,
+  handleImport,
+  deleteMaterialPolicy,
+} from "@/utils/util";
+import Minxin from "@/mixin";
 import Pagination from "@/components/Pagination";
 import Transfer from "./Transfer";
 export default {
+  mixins: [Minxin],
   data() {
     return {
       input: "",
-
-      ruleForm: {
+      baseURL: "",
+      searchForm: {
+        code: "",
         name: "",
+        type: "",
+        endTime: "",
+        imgSrc: "",
+        remark: "",
+        startTime: "",
+        title: "",
+        type: "",
       },
       listLoading: false,
       rules: {
@@ -247,76 +329,177 @@ export default {
         ],
       },
       imageUrl: "",
-      dataList: [
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
+      dataList: [],
+      importFileList: [],
+      fileList: [],
+      options: {},
+      value: "",
+      typeList: [],
+      walletList: [],
+      typeOptions: [
         {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
+          vlaue: "PROVISION",
+          label: "配提",
         },
         {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
+          value: "LIMIT",
+          label: "限量",
         },
       ],
-      radio: "",
-      options: {},
-      value: "",
+      conditionList: [],
     };
   },
-
+  created() {
+    this.getCommonApi();
+  },
+  mounted() {},
   methods: {
-    handelLeftCheck(e) {
-      console.log(e);
+    //下载excel模板
+    hanleDownloadFiles() {
+      downloadFiles("/policy/download");
+    },
+    //删除
+    hnaleDelete(id) {
+      deleteMaterialPolicy({ policyMaterialId: id }).then(() => {
+        this.$sccussMsg("删除成功");
+        this.handletwoList();
+      });
+    },
+    getCommonApi() {
+      const params = {
+        pageNum: 1,
+        pageSize: 10,
+        saleCode: "",
+        saleName: "",
+        status: "",
+      };
+      const walletParams = {
+        pageNum: 1,
+        pageSize: 10,
+        mainName: "",
+        saleTypeCode: "",
+        saleTypeName: "",
+        status: "",
+      };
+      const customerParams = {
+        pageNum: 1,
+        pageSize: 10,
+        keyword: "",
+        region: "",
+      };
+      // 获取销售政策编号
+      getId().then((res) => {
+        console.log(res.data);
+        this.searchForm.code = res.data;
+      });
+      // 获取销售类型列表
+      getTypeList(params).then((res) => {
+        this.typeList = res.data.records;
+        console.log(this.typeList, "type");
+      });
+      // 获取钱包列表
+      getWalletList(walletParams).then((res) => {
+        this.walletList = res.data.records;
+      });
+      // 获取经销商列表
+      getCrList(customerParams).then((res) => {
+        this.customerList = res.data.records;
+        console.log(this.customerList, 12345797);
+      });
+    },
+    // 导入
+    async handleImport(param) {
+      this.importLoading = true;
+      const file = param.file;
+      console.log(file, 123);
+      const formData = new FormData();
+      formData.append("file", file);
+      formData.append("policyId", this.searchForm.code);
+      let result = await handleImport("/policy/material/import", formData);
+      this.importLoading = false;
+      this.importFileList = [];
+      if (result.code == 200) {
+        this.$alert(result.message, "导入成功", {
+          confirmButtonText: "确定",
+        });
+        this.getList();
+      } else {
+        this.$alert(result.message, "导入失败", {
+          confirmButtonText: "确定",
+        });
+      }
+    },
+    getList() {
+      const params = {
+        policyId: this.searchForm.code,
+      };
+      // 获取条件政策
+      getConditionList(params).then((res) => {
+        this.conditionList = res.data;
+      });
+      this.handletwoList();
     },
+    //获取政策id调取货品信息
+    hanleChange() {
+      this.handletwoList();
+    },
+    // 获取货品信息
+    handletwoList() {
+      const params = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        policyId: this.searchForm.code,
+        saleTypeCode: this.searchForm.type,
+      };
+      getMaterialList(params)
+        .then((result) => {
+          this.dataList = result.data.records;
+          console.log(result);
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    // 获取图片路径
     beforeAvatarUpload() {},
     handleAvatarSuccess() {},
+    // 提交审核
+    handleAddPolicy(policyCustomers) {
+      console.log(policyCustomers, "选择的经销商");
+      const params = {
+        adminCompanyId: "",
+        code: this.searchForm.code,
+        customerCount: 0,
+        endTime: this.searchForm.endTime,
+        examineBy: this.searchForm.examineBy,
+        examineRemark: this.searchForm.examineRemark,
+        examineStatus: this.searchForm.examineStatus,
+        examineTime: this.searchForm.examineTime,
+        id: null,
+        imgSrc: this.searchForm.imgSrc,
+        policyCustomers: [
+          //       	{
+          // 	"customerId": "",
+          // 	"customerName": "",
+          // 	"customerNumber": "",
+          // 	"id": "",
+          // 	"lastOrderTime": "",
+          // 	"limitTakeNum": 0,
+          // 	"policyId": "",
+          // 	"policyTitle": "",
+          // 	"remark": "",
+          // }
+        ],
+        remark: this.searchForm.remark,
+        startTime: this.searchForm.startTime,
+        status: true,
+        title: this.searchForm.title,
+        type: this.searchForm.type,
+      };
+      addPoliy(params).then((res) => {
+        console.log(res);
+      });
+    },
   },
   components: {
     Transfer,
@@ -332,7 +515,10 @@ h4 {
 .pdt {
   padding-top: 20px;
 }
-
+.import-btn {
+  margin-right: 10px;
+  display: inline-block;
+}
 .radio {
   padding: 20px 0;
 }

+ 168 - 162
src/views/sales_policy/components/Distributor.vue

@@ -1,39 +1,38 @@
 <template>
-  <el-container :direction="vertical">
+  <el-container>
     <el-header height="" class="pdt">
       <el-form
         :model="ruleForm"
-        :rules="rules"
         ref="ruleForm"
         label-width="120px"
         size="small"
         label-position="left"
         class="demo-ruleForm"
       >
-        <el-row type="flex">
-          <el-col :span="9">
-            <el-form-item label="销售政策编号" prop="name">
+        <el-row :gutter="20">
+          <el-col :xs="24" :ms="12" :lg="12">
+            <el-form-item label="销售政策编号" prop="code">
               <el-input
                 v-model="ruleForm.name"
                 placeholder="如未填写,则系统自动生成"
               ></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="15">
-            <el-form-item label="销售政策说明" prop="name">
+          <el-col :xs="24" :ms="12" :lg="12">
+            <el-form-item label="销售政策说明" prop="title">
               <el-input
-                v-model="ruleForm.name"
+                v-model="ruleForm.title"
                 placeholder="销售政策说明"
               ></el-input>
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row type="flex">
-          <el-col :span="9">
-            <el-form-item label="销售政策类型" prop="name">
-              <el-select v-model="value" placeholder="请选择">
+        <el-row :gutter="20">
+          <el-col :xs="24" :ms="12" :lg="12">
+            <el-form-item label="销售政策类型" prop="type">
+              <el-select v-model="ruleForm.type" placeholder="请选择">
                 <el-option
-                  v-for="item in options"
+                  v-for="item in typeOptions"
                   :key="item.value"
                   :label="item.label"
                   :value="item.value"
@@ -42,8 +41,8 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="9">
-            <el-form-item label="部门" prop="name">
+          <el-col :xs="24" :ms="12" :lg="12">
+            <!-- <el-form-item label="部门" prop="name">
               <el-select v-model="value" placeholder="请选择">
                 <el-option
                   v-for="item in options"
@@ -53,227 +52,191 @@
                 >
                 </el-option>
               </el-select>
-            </el-form-item>
+            </el-form-item> -->
           </el-col>
         </el-row>
-        <el-row>
-          <el-form-item label="表头备注" prop="name">
-            <el-input
-              v-model="ruleForm.name"
-              placeholder="新风机变频挂机。按提货数量1:3开单"
-            ></el-input>
-          </el-form-item>
-        </el-row>
-        <el-row>
-          <el-col :span="9">
+        <el-row :gutter="20">
+          <el-col :xs="24" :ms="12" :lg="12">
             <el-form-item label="制单人" prop="name">
-              <el-input
-                v-model="ruleForm.name"
-                placeholder="新风机变频挂机。按提货数量1:3开单"
-              ></el-input>
+              <el-input v-model="ruleForm.name" placeholder=""></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="9">
+          <el-col :xs="24" :ms="12" :lg="12">
             <el-form-item label="制单日期" prop="name">
-              <el-input
-                v-model="ruleForm.name"
-                placeholder="2020-01-23"
-              ></el-input>
+              <el-input v-model="ruleForm.name" placeholder=""></el-input>
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row>
+          <el-form-item label="表头备注" prop="remark">
+            <el-input
+              v-model="ruleForm.remark"
+              placeholder="新风机变频挂机。按提货数量1:3开单"
+            ></el-input>
+          </el-form-item>
+        </el-row>
       </el-form>
     </el-header>
+    <!-- 按钮 -->
+    <div class="btn-group clearfix">
+      <div class="fl">
+        <el-button
+          type="primary"
+          size="small"
+          slot="reference"
+          class="el-popover-left"
+          @click="handleEdit"
+          >批量编辑</el-button
+        >
+      </div>
+    </div>
     <el-main>
       <el-table
         v-loading="listLoading"
         :data="dataList"
         element-loading-text="Loading"
         border
+        @select="hanleSelectAll"
+        @select-all="hanleSelectAll"
         fit
         highlight-current-row
         stripe
       >
+        <el-table-column type="selection" width="55"> </el-table-column>
         <el-table-column
-          fixed
-          prop="num"
-          label="序号"
-          width="50"
-          align="center"
-        >
-        </el-table-column>
-        <el-table-column
-          prop="name"
+          prop="customerNumber"
           label="经销商编码"
           width="300"
           align="center"
         >
-          <template slot-scope="scope">
-            <el-input
-              v-model="input"
-              placeholder=""
-              size="normal"
-              clearable
-              @change=""
-            ></el-input>
-          </template>
         </el-table-column>
         <el-table-column
-          prop="province"
+          prop="customerName"
           label="经销商名称"
           width="300"
           align="center"
         >
-          <template slot-scope="scope">
-            <el-input
-              v-model="input"
-              placeholder=""
-              size="normal"
-              clearable
-              @change=""
-            ></el-input>
-          </template>
         </el-table-column>
         <el-table-column
-          prop="city"
+          prop="limitTakeNum"
           label="最多提货套数"
           width="300"
           align="center"
         >
-          <template slot-scope="scope">
-            <el-input
-              v-model="input"
-              placeholder=""
-              size="normal"
-              clearable
-              @change=""
-            ></el-input>
-          </template>
         </el-table-column>
         <el-table-column
-          prop="address"
+          prop="remark"
           label="表体备注"
           width="300"
           align="center"
         >
-          <template slot-scope="scope">
-            <el-input
-              v-model="input"
-              placeholder=""
-              size="normal"
-              clearable
-              @change=""
-            ></el-input>
-          </template>
         </el-table-column>
         <el-table-column
-          prop="zip"
+          prop="lastOrderTime"
           label="最近订货时间"
           width="300"
           align="center"
         >
         </el-table-column>
-        <el-table-column fixed="right" label="操作" align="center">
+        <el-table-column fixed="right" label="操作" align="center" width="200">
           <template slot-scope="scope">
+            <el-button
+              type="text"
+              size="small"
+              @click="(type = 2), (dialogVisible = true), (id = scope.row.id)"
+              >设置</el-button
+            >
+            <el-button
+              type="text"
+              size="small"
+              @click="(type = 1), (dialogVisible = true), (id = scope.row.id)"
+            >
+              备注</el-button
+            >
             <el-button type="text" size="small">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
+      <!-- 分页 -->
+      <div class="fr" style="margin-top: 20px">
+        <el-pagination
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="currentPage"
+          :page-sizes="[10, 20, 30, 50]"
+          :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="listTotal"
+        >
+        </el-pagination>
+      </div>
     </el-main>
-    <el-footer>
-      <el-row>
-        <el-col :span="12">
-          <el-button type="primary" size="default" @click="">保存</el-button>
-          <el-button type="primary" size="default" @click="">重置</el-button>
-        </el-col>
-        <el-col :span="12" class="text_right">
-          <el-button type="primary" size="default" @click="">添加</el-button>
-          <el-button type="primary" size="default" @click="">删除</el-button>
-        </el-col>
-      </el-row>
-      <!-- <Pagination /> -->
-    </el-footer>
+
+    <el-dialog
+      :visible.sync="dialogVisible"
+      width="30%"
+      :before-close="handleClose"
+    >
+      <el-input
+        v-if="type == 1"
+        v-model="remark"
+        placeholder="备注"
+        size="small"
+      ></el-input>
+      <el-input
+        v-else
+        v-model="limitTakeNum"
+        placeholder="最大提货数量
+"
+        size="small"
+      ></el-input>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="handleInfo">确 定</el-button>
+      </span>
+    </el-dialog>
   </el-container>
 </template>
 
 <script>
 import Pagination from "./Pagination";
 import Transfer from "./Transfer";
+import {
+  getPolicyDetail,
+  getCustomerList,
+  eidtBatch,
+} from "@/api/supply/sales";
+import Minxin from "@/mixin";
+
 export default {
+  mixins: [Minxin],
   data() {
     return {
+      dialogVisible: false,
       input: "",
-
-      ruleForm: {
-        name: "",
-      },
+      ruleForm: {},
       listLoading: false,
-      rules: {
-        name: [
-          { required: true, message: "", trigger: "click" },
-          { min: 3, max: 5, message: "", trigger: "click" },
-        ],
+      remark: "",
+      limitTakeNum: "",
+      searchForm: {
+        code: "",
+        remark: "",
+        title: "",
       },
-
-      dataList: [
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
+      id: "",
+      dataList: [],
+      detail: {},
+      radio: "",
+      typeOptions: [
         {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
+          vlaue: "PROVISION",
+          label: "配提",
         },
         {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
+          value: "LIMIT",
+          label: "限量",
         },
       ],
-      radio: "",
     };
   },
 
@@ -281,6 +244,46 @@ export default {
     handelLeftCheck(e) {
       console.log(e);
     },
+    getList() {
+      this.listLoading = true;
+      const params = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        policyId: "",
+      };
+      getCustomerList(params).then((res) => {
+        this.dataList = res.data.records;
+        this.listLoading = false;
+      });
+      // getPolicyDetail({ policyId: this.$route.query.id||'' }).then((res) => {
+      //   this.ruleForm = res.data;
+      // });
+      // this.listLoading = false;
+    },
+    handleEdit() {
+      if (this.ids.length) {
+        this.type = 2;
+        this.dialogVisible = true;
+        return;
+      }
+      this.$errorMsg("请选编辑项");
+    },
+    handleClose(done) {
+      done();
+    },
+    hanleDelete() {},
+    handleInfo() {
+      let ids = this.id ? [this.id] : this.ids;
+      eidtBatch({
+        policyCustomerIds: ids.join(","),
+        limitTakeNum: this.limitTakeNum,
+        remark: this.remark,
+      }).then((res) => {
+        this.$successMsg("编辑成功");
+        this.dialogVisible = false;
+        this.getList();
+      });
+    },
   },
   components: {
     Transfer,
@@ -297,4 +300,7 @@ export default {
 .text_right {
   text-align: right;
 }
+.el-select {
+  width: 100%;
+}
 </style>

+ 192 - 127
src/views/sales_policy/components/Examine.vue

@@ -3,43 +3,47 @@
     <div class="descriptions">
       <el-row>
         <el-col :span="4">销售政策编号</el-col>
-        <el-col :span="4">1</el-col>
+        <el-col :span="4">{{ detail.code }}</el-col>
         <el-col :span="4">销售政策说明</el-col>
-        <el-col :span="4">1</el-col>
+        <el-col :span="4">{{ detail.title }}</el-col>
         <el-col :span="4">状态</el-col>
-        <el-col :span="4">1</el-col>
+        <el-col :span="4">{{
+          detail.status == 1 ? "已生效" : "未生效"
+        }}</el-col>
       </el-row>
       <el-row>
         <el-col :span="4">销售政策类型</el-col>
-        <el-col :span="4">1</el-col>
-        <el-col :span="4">支付钱包</el-col>
-        <el-col :span="4">1</el-col>
-        <el-col :span="4">家用空调</el-col>
-        <el-col :span="4">1</el-col>
+        <el-col :span="4">{{
+          detail.type == "PROVISION" ? "配提" : "限量"
+        }}</el-col>
+        <el-col :span="4">现金钱包</el-col>
+        <el-col :span="4"></el-col>
+        <el-col :span="4"></el-col>
+        <el-col :span="4"></el-col>
       </el-row>
       <el-row>
         <el-col :span="4">备注</el-col>
-        <el-col :span="20">1</el-col>
+        <el-col :span="20">{{ detail.remark }}</el-col>
       </el-row>
       <el-row>
         <el-col :span="3">制单人</el-col>
-        <el-col :span="3">1</el-col>
+        <el-col :span="3">{{ detail.createBy }}</el-col>
         <el-col :span="3">制单日期</el-col>
-        <el-col :span="3">1</el-col>
+        <el-col :span="3">{{ detail.createTime }}</el-col>
         <el-col :span="3">生效日期</el-col>
-        <el-col :span="3">1</el-col>
+        <el-col :span="3">{{ detail.startTime }}</el-col>
         <el-col :span="3">失败日期</el-col>
-        <el-col :span="3">1</el-col>
+        <el-col :span="3">{{ detail.endTime }}</el-col>
       </el-row>
-      <el-row>
+      <el-row v-if="this.$parent.isShow == 4">
         <el-col :span="3">审核人</el-col>
-        <el-col :span="3">1</el-col>
+        <el-col :span="3">{{ detail.examineBy }}</el-col>
         <el-col :span="3">审核日期</el-col>
-        <el-col :span="3">1</el-col>
+        <el-col :span="3">{{ detail.examineTime }}</el-col>
         <el-col :span="3">关闭人</el-col>
-        <el-col :span="3">1</el-col>
+        <el-col :span="3"></el-col>
         <el-col :span="3">关闭日期</el-col>
-        <el-col :span="3">1</el-col>
+        <el-col :span="3"></el-col>
       </el-row>
     </div>
     <div class="mymain-container">
@@ -48,48 +52,79 @@
         <el-row type="flex">
           <el-col :span="12">
             <h4 style="display: inline-block; margin-right: 20px">货品信息</h4>
-            <el-button size="small">查看</el-button></el-col
-          >
+            <!-- <el-button size="small">查看</el-button> -->
+          </el-col>
+          <el-col :span="12" class="tr">
+              <el-button size="small"   @click="$parent.isShow=3">查看条件</el-button>
+          </el-col>
         </el-row>
         <el-divider></el-divider>
       </el-row>
-      <el-table
-        v-loading="listLoading"
-        :data="dataList"
-        element-loading-text="Loading"
-        border
-        fit
-        highlight-current-row
-        stripe
-      >
+      <el-table :data="dataList" border style="width: 100%">
+        <el-table-column label="状态" width="120" align="center">
+          <template slot-scope="scope">
+            <el-tag v-if="scope.row.examineStatus == 'WAIT'">待审核</el-tag>
+            <el-tag v-else-if="scope.row.examineStatus == 'OK'">通过 </el-tag>
+            <el-tag v-else>失败</el-tag>
+          </template>
+        </el-table-column>
         <el-table-column
-          fixed
-          prop="num"
-          label="序号"
-          width="50"
+          prop="code"
+          label="销售政策编号"
+          width="120"
           align="center"
         >
         </el-table-column>
-        <el-table-column prop="name" label="货品编码" align="center">
+        <el-table-column
+          prop="title"
+          label="销售政策说明"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="province" label="货品名称" align="center">
+        <el-table-column prop="address" label="部门" width="300" align="center">
         </el-table-column>
-        <el-table-column prop="city" label="规格型号" align="center">
+        <el-table-column
+          prop="remark"
+          label="表头备注"
+          width="120"
+          align="center"
+        >
         </el-table-column>
         <el-table-column
-          prop="address"
-          label="销售类型编码"
-          width="500"
+          prop="startTime"
+          label="生效日期"
+          width="120"
           align="center"
         >
         </el-table-column>
-        <el-table-column prop="zip" label="销售类型" align="center">
+        <el-table-column
+          prop="endTime"
+          label="结束日期"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="zip" label="单价" align="center">
+        <el-table-column
+          prop="examineBy"
+          label="制表人"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="zip" label="支付钱包" align="center">
+        <el-table-column
+          prop="examineBy"
+          label="制表日期"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="zip" label="备注" align="center">
+        <el-table-column
+          prop="examineBy"
+          label="审核人"
+          width="120"
+          align="center"
+        >
         </el-table-column>
       </el-table>
       <el-row>
@@ -102,8 +137,7 @@
         <el-divider></el-divider>
       </el-row>
       <el-table
-        v-loading="listLoading"
-        :data="dataList"
+        :data="conditionList"
         element-loading-text="Loading"
         border
         fit
@@ -112,7 +146,7 @@
       >
         <el-table-column
           fixed
-          prop="num"
+          type="index"
           label="序号"
           width="50"
           align="center"
@@ -120,13 +154,9 @@
         </el-table-column>
         <el-table-column prop="name" label="限定条件" align="center">
         </el-table-column>
-        <el-table-column prop="province" label="限定机型" align="center">
-        </el-table-column>
-        <el-table-column prop="city" label="配体机型" align="center">
-        </el-table-column>
-        <el-table-column fixed="right" label="操作" align="center">
+        <el-table-column fixed="right" width="150" label="操作" align="center">
           <template slot-scope="scope">
-            <el-button type="text" size="small">查看</el-button>
+            <el-button type="text" size="small">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -137,14 +167,13 @@
             <h4 style="display: inline-block; margin-right: 20px">
               经销商使用范围
             </h4>
-            <el-button size="small">添加</el-button></el-col
-          >
+          </el-col>
         </el-row>
         <el-divider></el-divider>
       </el-row>
       <el-table
         v-loading="listLoading"
-        :data="dataList"
+        :data="custoList"
         element-loading-text="Loading"
         border
         fit
@@ -153,103 +182,139 @@
       >
         <el-table-column
           fixed
-          prop="num"
+          type="index"
           label="序号"
           width="50"
           align="center"
         >
         </el-table-column>
-        <el-table-column prop="name" label="经销商编码" align="center">
+        <el-table-column
+          prop="customerNumber"
+          label="经销商编码"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="province" label="经销商名称" align="center">
+        <el-table-column prop="customerName" label="经销商名称" align="center">
         </el-table-column>
-
       </el-table>
+      <!-- <div class="descriptions">
+        <el-row>
+          <el-col :span="8">审核人</el-col>
+          <el-col :span="8">{{ detail.code }}</el-col>
+          <el-col :span="8">审核结果</el-col>
+          <el-col :span="8">
+            <template>
+              <el-radio-group v-model="radio">
+                <el-radio :label="3">通过</el-radio>
+                <el-radio :label="6">驳回</el-radio>
+              </el-radio-group>
+            </template>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="4">审批说明</el-col>
+          <el-col :span="4">
+            <el-input
+              type="textarea"
+              autosize
+              placeholder="审批说明"
+              v-model="textarea1"
+            >
+            </el-input>
+          </el-col>
+        </el-row>
+      </div> -->
     </div>
   </div>
 </template>
 
 <script>
+import {
+  getList,
+  updatePolicy,
+  getPolicyDetail,
+  getCustomerList,
+  getConditionList,
+} from "@/api/supply/sales";
+import Minxin from "@/mixin";
+
 export default {
+  mixins: [Minxin],
   name: "examine",
   data() {
     return {
       input: "",
-
-      ruleForm: {
-        name: "",
-      },
+      fileList: [],
       listLoading: false,
-      rules: {
-        name: [
-          { required: true, message: "", trigger: "click" },
-          { min: 3, max: 5, message: "", trigger: "click" },
-        ],
-      },
       imageUrl: "",
-      dataList: [
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-        {
-          num: "2",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
-        },
-      ],
+      dataList: [],
       radio: "",
       options: {},
       value: "",
+      detail: {},
+      screenForm: {
+        code: "",
+        createBy: "",
+        endCreateTime: "",
+        endTime1: "",
+        endTime2: "",
+        examineBy: "",
+        remark: "",
+        startCreateTime: "",
+        startTime1: "",
+        startTime2: "",
+        status: "",
+        title: "",
+        type: "",
+      },
+      conditionList: [],
+      custoList: [],
     };
   },
+  methods: {
+    getList() {
+      getPolicyDetail({ policyId: this.$parent.id }).then((res) => {
+        this.detail = res.data;
+        console.log(this.dataList);
+      });
+      const params = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        code: this.screenForm.code,
+        createBy: this.screenForm.createBy,
+        endCreateTime: this.screenForm.endCreateTime,
+        endTime1: this.screenForm.endTime1,
+        endTime2: this.screenForm.endTime2,
+        examineBy: this.screenForm.examineBy,
+        remark: this.screenForm.remark,
+        startCreateTime: this.screenForm.startCreateTime,
+        startTime1: this.screenForm.startTime1,
+        startTime2: this.screenForm.startTime2,
+        status: this.screenForm.status,
+        title: this.screenForm.title,
+        type: this.screenForm.type,
+      };
+      getList(params).then((res) => {
+        this.dataList = res.data.records;
+      });
+      const condParams = {
+        policyId: this.$parent.id,
+      };
+      // 获取条件政策
+      getConditionList(condParams).then((res) => {
+        this.conditionList = res.data;
+        console.log(res, 46);
+      });
+      const custoParams = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        policyId: this.$parent.id,
+      };
+      getCustomerList(custoParams).then((res) => {
+        this.custoList = res.data.records;
+      });
+    },
+  },
 };
 </script>
 

+ 26 - 23
src/views/sales_policy/components/TabelTransfer.vue

@@ -4,33 +4,22 @@
       <el-form label-width="0" :inline="false" size="small">
         <el-row :gutter="20">
           <el-col :xs="24" :sm="8" :lg="8" :offset="0">
-            <el-form-item label="" >
-              <el-input
-                v-model="input"
-                placeholder="产品编码"
-              ></el-input>
+            <el-form-item label="">
+              <el-input v-model="input" placeholder="产品编码"></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="8" :lg="8" :offset="0">
-            <el-form-item label="" >
-              <el-input
-                v-model="input"
-                placeholder="产品名称"
-
-              ></el-input>
+            <el-form-item label="">
+              <el-input v-model="input" placeholder="产品名称"></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="8" :lg="8" :offset="0">
-            <el-form-item label="" >
-              <el-input
-                v-model="input"
-                placeholder="产品型号"
-
-              ></el-input>
+            <el-form-item label="">
+              <el-input v-model="input" placeholder="产品型号"></el-input>
             </el-form-item>
           </el-col>
 
-          <el-col :xs="24" :sm="8" :lg="8" :offset="0">
+          <!-- <el-col :xs="24" :sm="8" :lg="8" :offset="0">
             <el-form-item label="" >
               <el-date-picker
                 v-model="value1"
@@ -41,11 +30,9 @@
               >
               </el-date-picker>
             </el-form-item>
-          </el-col>
-          <el-form-item label="" >
-            <el-button type="primary"  size="small " @click=""
-              >查询</el-button
-            >
+          </el-col> -->
+          <el-form-item label="">
+            <el-button type="primary" size="small " @click="">查询</el-button>
           </el-form-item>
         </el-row>
       </el-form>
@@ -125,8 +112,11 @@
 </template>
 
 <script>
+import Minxin from "@/mixin";
+import { getConditionMaterialList } from "@/api/supply/sales";
 import Pagination from "./Pagination";
 export default {
+  mixins: [Minxin],
   data() {
     return {
       input: "",
@@ -179,6 +169,19 @@ export default {
     };
   },
   methods: {
+    getList() {
+      const params = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        policyConditionId: "",
+        popType: "",
+      };
+      getConditionMaterialList(params)
+        .then((res) => {
+          console.log(res);
+        })
+        .catch((err) => {});
+    },
     handelLeftCheck(e) {
       console.log(e);
     },

+ 36 - 17
src/views/sales_policy/components/Transfer.vue

@@ -1,17 +1,20 @@
 <template>
   <div>
     <slot name="header">
+      <el-row class="radio">
+        <el-radio-group v-model="radio">
+          <el-radio label="0">全部经销商</el-radio>
+          <el-radio label="1">地区</el-radio>
+          <el-radio label="2">指定</el-radio>
+        </el-radio-group>
+      </el-row>
       <el-row type="flex">
         <el-col>
-          <el-select size="small" v-model="value" class="select_height" placeholder="请选择">
-            <el-option
-              v-for="item in options"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
-            >
-            </el-option>
-          </el-select>
+          <el-input
+            v-model="value"
+            placeholder="查找经销商"
+            size="small"
+          ></el-input>
         </el-col>
         <el-col><el-button size="small">确定</el-button></el-col>
       </el-row>
@@ -28,7 +31,7 @@
             <el-checkbox
               v-for="(item, index) in dataL"
               :key="index"
-              :label="item"
+              :label="item.customerName"
               :disabled="rightDisabled"
             ></el-checkbox>
           </el-checkbox-group>
@@ -36,12 +39,18 @@
         <el-col class="middle_box" :span="6">
           <el-row>
             <el-col>
-              <el-button :disabled="isDisabled" size="small" @click="handleJudge('AddAll')"
+              <el-button
+                :disabled="isDisabled"
+                size="small"
+                @click="handleJudge('AddAll')"
                 >全部添加</el-button
               ></el-col
             >
             <el-col>
-              <el-button :disabled="isDisabled" size="small" @click="handleJudge('AddPart')"
+              <el-button
+                :disabled="isDisabled"
+                size="small"
+                @click="handleJudge('AddPart')"
                 >增加</el-button
               ></el-col
             >
@@ -76,11 +85,11 @@
         </el-col>
       </el-row>
     </div>
-
     <slot name="footer">
       <el-row>
-        <el-button type="primary" size="small" @click="">保存</el-button>
-        <el-button type="primary" size="small" @click="">提交审核</el-button>
+        <el-button type="primary" size="small" @click="handleSubmit"
+          >提交审核</el-button
+        >
         <el-button type="primary" size="small" @click="">重置</el-button>
       </el-row>
     </slot>
@@ -89,10 +98,17 @@
 
 <script>
 export default {
+  props: {
+    dataL: {
+      type: Array,
+      default: [],
+    },
+  },
   data() {
     return {
+      radio: "0",
       leftData: [],
-      dataL: [1, 3, 2],
+      // dataL: [],
       dataR: [],
       rightData: [],
       options: [
@@ -205,7 +221,7 @@ export default {
         this.dataL.forEach((k, d) => {
           this.leftData.forEach((e) => {
             if (e == k) {
-              this.dataL.splice(d, 1);
+              this.dataL.splice(d, this.leftData.length);
               this.leftData = [];
               return;
             }
@@ -250,6 +266,9 @@ export default {
           break;
       }
     },
+    handleSubmit() {
+      this.$emit("handleAddPolicy", { x: 1 });
+    },
   },
 };
 </script>

+ 401 - 188
src/views/sales_policy/policy_list.vue

@@ -1,177 +1,241 @@
 <template>
   <div class="app-container" v-if="isShow == 1">
     <div class="screen-container">
-      <el-form :model="form" ref="form" :inline="false">
-        <el-row :gutter="20">
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="销售政策编号"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
+      <el-form :model="screenForm" ref="screenForm" :inline="false">
+        <el-row>
+          <el-row :gutter="20">
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="code">
+                <el-input
+                  v-model="screenForm.code"
+                  placeholder="销售政策编号"
+                  size="small"
+                ></el-input>
+              </el-form-item>
+            </el-col>
 
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="销售政策说明"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="remark">
+                <el-input
+                  v-model="screenForm.remark"
+                  placeholder="销售政策说明"
+                  size="small"
+                ></el-input>
+              </el-form-item>
+            </el-col>
 
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="表头备注"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="title">
+                <el-input
+                  v-model="screenForm.title"
+                  placeholder="表头备注"
+                  size="small"
+                ></el-input>
+              </el-form-item>
+            </el-col>
 
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="生效日期"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="结束日期"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="制表日期"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="startTime1">
+                <el-date-picker
+                  v-model="screenForm.startTime1"
+                  type="date"
+                  size="small"
+                  placeholder="生效日期"
+                >
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="startTime2">
+                <el-date-picker
+                  v-model="screenForm.startTime2"
+                  type="date"
+                  size="small"
+                  placeholder="结束日期"
+                >
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
 
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="制表人"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="startCreateTime">
+                <el-date-picker
+                  v-model="screenForm.startCreateTime"
+                  type="date"
+                  size="small"
+                  placeholder="制表日期"
+                >
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
 
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="审核人"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="createBy">
+                <el-input
+                  v-model="screenForm.createBy"
+                  placeholder="制表人"
+                  size="small"
+                ></el-input>
+              </el-form-item>
+            </el-col>
 
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="关闭人"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="examineBy">
+                <el-input
+                  v-model="screenForm.examineBy"
+                  placeholder="审核人"
+                  size="small"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="inpu">
+                <el-input
+                  v-model="screenForm.input"
+                  placeholder="关闭人"
+                  size="small"
+                ></el-input>
+              </el-form-item>
+            </el-col>
 
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-select
-                size="small"
-                v-model="value"
-                disabled
-                placeholder="状态"
-                class="select_height"
-              >
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="status">
+                <el-select
+                  size="small"
+                  v-model="screenForm.status"
+                  placeholder="状态"
+                  class="select_height"
                 >
-                </el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
+                  <el-option
+                    v-for="item in statusOptions"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
 
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-select
-                size="small"
-                v-model="value"
-                disabled
-                placeholder="销售政策类型"
-                class="select_height"
-              >
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+            <el-col :xs="24" :ms="6" :lg="6">
+              <el-form-item label="" prop="type">
+                <el-select
+                  size="small"
+                  v-model="screenForm.type"
+                  placeholder="销售政策类型"
+                  class="select_height"
+                >
+                  <el-option
+                    v-for="item in typeOptions"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="24" :ms="6" :lg="6" class="tr">
+              <el-form-item>
+                <el-button type="primary" size="small" @click="submitScreenForm"
+                  >查询</el-button
+                >
+                <el-button size="small" @click="resetScreenForm"
+                  >重置</el-button
                 >
-                </el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="24" :ms="6" :lg="6" class="tr">
-            <el-form-item>
-              <el-button type="primary" size="small">查询</el-button>
-              <el-button size="small">重置</el-button>
-            </el-form-item>
-          </el-col>
+              </el-form-item>
+            </el-col>
+          </el-row>
         </el-row>
       </el-form>
     </div>
     <div class="btn-group">
       <el-row type="flex">
-        <el-button type="primary" class="btn" size="small">新增</el-button>
-        <el-button type="primary" class="btn" size="small">导出</el-button>
-        <el-button type="primary" class="btn" size="small">查询</el-button>
-        <el-button type="primary" class="btn" icon="" size="small"
-          ><i class="el-icon-delete"></i>
-        </el-button>
+        <el-button type="primary" class="btn" size="small" @click="isShow = 2"
+          >新增</el-button
+        >
+        <!-- <el-upload
+          class="import-btn"
+          :action="baseURL + 'student/import'"
+          :http-request="handleImport"
+          :file-list="importFileList"
+        >
+          <el-button type="primary" size="small">导入</el-button>
+        </el-upload>
+        <el-button type="primary" class="btn" size="small" @click="handleExport"
+          >导出</el-button
+        > -->
       </el-row>
     </div>
     <div class="mymain-container">
-      <el-table :data="tableData" border style="width: 100%" height="600">
-        <el-table-column fixed="left" label="操作" width="200" align="center">
+      <el-table :data="dataList" border style="width: 100%" height="600">
+        <el-table-column fixed="left" label="操作" width="250" align="center">
           <template slot-scope="scope">
-            <el-button type="text" size="small">申请</el-button>
-            <el-button type="text" size="small">编辑</el-button>
-            <el-button type="text" size="small">详情</el-button>
-            <el-button type="text" size="small">删除</el-button>
+            <el-button
+              type="text"
+              size="small"
+              @click="(isShow = 5), (id = scope.row.id)"
+              >编辑</el-button
+            >
+            <el-button
+              type="text"
+              size="small"
+              @click="(isShow = 4), (id = scope.row.id)"
+              >详情</el-button
+            >
+            <!-- <el-popconfirm
+              style="margin-left: 10px"
+              title="审核?"
+              @onConfirm="hanleExamine(scope.row)"
+            > -->
+            <el-button
+              type="text"
+              @click="(isShow = 6), (id = scope.row.id)"
+              size="small"
+              >审核</el-button
+            >
+            <!-- </el-popconfirm> -->
+            <el-popconfirm
+              style="margin-left: 10px"
+              title="提审?"
+              @onConfirm="handlesubmit(scope.row)"
+            >
+              <el-button type="text" size="small" slot="reference"
+                >提审</el-button
+              >
+            </el-popconfirm>
+
+            <el-popconfirm
+              style="margin-left: 10px"
+              title="删除吗?"
+              @onConfirm="hanleDelete(scope.row.id)"
+            >
+              <el-button type="text" slot="reference" size="small"
+                >删除</el-button
+              >
+            </el-popconfirm>
           </template>
         </el-table-column>
-        <el-table-column prop="name" label="状态" width="120" align="center">
+        <el-table-column label="状态" width="120" align="center">
+          <template slot-scope="scope">
+            <el-tag v-if="scope.row.examineStatus == 'WAIT'">待审核</el-tag>
+            <el-tag v-else-if="scope.row.examineStatus == 'OK'">通过 </el-tag>
+            <el-tag v-else>失败</el-tag>
+          </template>
         </el-table-column>
         <el-table-column
-          prop="province"
+          prop="code"
           label="销售政策编号"
           width="120"
           align="center"
         >
         </el-table-column>
         <el-table-column
-          prop="city"
+          prop="title"
           label="销售政策说明"
           width="120"
           align="center"
@@ -179,85 +243,231 @@
         </el-table-column>
         <el-table-column prop="address" label="部门" width="300" align="center">
         </el-table-column>
-        <el-table-column prop="zip" label="表头备注" width="120" align="center">
-        </el-table-column>
-        <el-table-column prop="zip" label="生效日期" width="120" align="center">
-        </el-table-column>
-        <el-table-column prop="zip" label="结束日期" width="120" align="center">
-        </el-table-column>
-        <el-table-column prop="zip" label="制表人" width="120" align="center">
+        <el-table-column
+          prop="remark"
+          label="表头备注"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="zip" label="制表日期" width="120" align="center">
+        <el-table-column
+          prop="startTime"
+          label="生效日期"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="zip" label="审核人" width="120" align="center">
+        <el-table-column
+          prop="endTime"
+          label="结束日期"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="zip" label="审核日期" width="120" align="center">
+        <el-table-column
+          prop="examineBy"
+          label="制表人"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="zip" label="关闭人" width="120" align="center">
+        <el-table-column
+          prop="examineBy"
+          label="制表日期"
+          width="120"
+          align="center"
+        >
         </el-table-column>
-        <el-table-column prop="zip" label="关闭日期" width="120" align="center">
+        <el-table-column
+          prop="examineBy"
+          label="审核人"
+          width="120"
+          align="center"
+        >
         </el-table-column>
       </el-table>
     </div>
-    <Pagination />
+    <!-- 分页 -->
+    <div class="fr">
+      <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="currentPage"
+        :page-sizes="[10, 20, 30, 50]"
+        :page-size="10"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="listTotal"
+      >
+      </el-pagination>
+    </div>
   </div>
   <AddPolicy v-else-if="isShow == 2" />
   <AddCondition v-else-if="isShow == 3" />
-  <Examine v-else-if="isShow == 4"/>
-  <AddModel v-else />
+  <Examine v-else />
 </template>
 
 <script>
+import {
+  getList,
+  getTypeList,
+  deletePolicy,
+  getpolicySubmit,
+  toExamine,
+} from "@/api/supply/sales";
+import Minxin from "@/mixin";
+import { downloadFiles, handleImport } from "@/utils/util";
 import AddPolicy from "./components/AddPolicy";
 import AddModel from "./components/AddModel";
 import Pagination from "./components/Pagination";
 import AddCondition from "./components/AddCondition";
-import Examine from './components/Examine'
+import Examine from "./components/Examine";
+
 export default {
+  mixins: [Minxin],
   data() {
     return {
-      input: "",
-      isShow: 4,
-      tableData: [
+      id: "",
+      isShow: 1,
+      dataList: [],
+      screenForm: {
+        code: "",
+        createBy: "",
+        endCreateTime: "",
+        endTime1: "",
+        endTime2: "",
+        examineBy: "",
+        remark: "",
+        startCreateTime: "",
+        startTime1: "",
+        startTime2: "",
+        status: "",
+        title: "",
+        type: "",
+      },
+      fileList: [],
+      statusOptions: [
         {
-          date: "2016-05-02",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1518 弄",
-          zip: 200333,
+          value: 1,
+          label: "已生效",
         },
         {
-          date: "2016-05-04",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1517 弄",
-          zip: 200333,
+          value: 0,
+          label: "未生效",
         },
+      ],
+      typeOptions: [
         {
-          date: "2016-05-01",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1519 弄",
-          zip: 200333,
+          vlaue: "PROVISION",
+          label: "配提",
         },
         {
-          date: "2016-05-03",
-          name: "王小虎",
-          province: "上海",
-          city: "普陀区",
-          address: "上海市普陀区金沙江路 1516 弄",
-          zip: 200333,
+          value: "LIMIT",
+          label: "限量",
         },
       ],
-      form: {},
-      options: {},
+      typeList: [],
       value: "",
-      imageUrl:''
+      imageUrl: "",
+      baseURL: "",
     };
   },
+  methods: {
+    getList() {
+      const params = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        code: this.screenForm.code,
+        createBy: this.screenForm.createBy,
+        endCreateTime: this.screenForm.endCreateTime,
+        endTime1: this.screenForm.endTime1,
+        endTime2: this.screenForm.endTime2,
+        examineBy: this.screenForm.examineBy,
+        remark: this.screenForm.remark,
+        startCreateTime: this.screenForm.startCreateTime,
+        startTime1: this.screenForm.startTime1,
+        startTime2: this.screenForm.startTime2,
+        status: this.screenForm.status,
+        title: this.screenForm.title,
+        type: this.screenForm.type,
+      };
+      getList(params).then((res) => {
+        this.dataList = res.data.records;
+      });
+      const paramsType = {
+        pageNum: 1,
+        pageSize: 10,
+        saleCdoe: "",
+        saleName: "",
+        stauts: "",
+      };
+      getTypeList(paramsType).then((res) => {
+        this.typeList = res.data.records;
+      });
+    },
+    hanleDelete(id) {
+      console.log(555);
+      this.hanleDeleteAllPromise(id).then((ids) => {
+        deletePolicy({
+          id: ids[0],
+        }).then((res) => {
+          this.$successMsg("删除成功");
+          this.getList();
+        });
+      });
+    },
+    // 导出文档
+    handleExport() {
+      let screenData = {
+        customerTel: this.diaLogForm.customerTel,
+        logisticsCompany: this.diaLogForm.logisticsCompany,
+      };
+      downloadFiles("/policy/export", screenData);
+    },
+    importFileList() {},
+    // 导入
+    async handleImport(param) {
+      this.importLoading = true;
+      const file = param.file;
+      console.log(file, 123);
+      const formData = new FormData();
+      formData.append("file", file);
+      let result = await handleImport("/policy/material/import", formData);
+      this.importLoading = false;
+      this.importFileList = [];
+      if (result.code == 200) {
+        this.$alert(result.message, "导入成功", {
+          confirmButtonText: "确定",
+        });
+        this.getList();
+      } else {
+        this.$alert(result.message, "导入失败", {
+          confirmButtonText: "确定",
+        });
+      }
+    },
+    handlesubmit(e) {
+      if (e.examineStatus == "SAVE") {
+        getpolicySubmit({ policyId: e.id }).then((res) => {
+          this.$successMsg("已提交");
+        });
+      } else {
+        this.$errorMsg("未满足条件");
+      }
+    },
+    hanleExamine(e) {
+      if (e.examineStatus == "WAIT") {
+        toExamine({
+          examineRemark: e.id,
+          examineStatus: "WAIT",
+          policyId: e.id,
+        }).then((res) => {
+          this.$successMsg("已提交");
+        });
+      } else {
+        this.$errorMsg("未满足条件");
+      }
+    },
+  },
   components: {
     Examine,
     AddModel,
@@ -280,4 +490,7 @@ export default {
 .select_height {
   width: 100%;
 }
+.import-btn {
+  margin: 0 10px;
+}
 </style>

+ 263 - 170
src/views/sales_rebate/rebate_list.vue

@@ -1,231 +1,324 @@
 <template>
   <div class="app-container">
     <div class="screen-container">
-      <el-form
-        :model="screenForm"
-        ref="screenForm"
-        :inline="false"
-        size="normal"
-      >
+      <el-form ref="screenForm" :model="screenForm" size="small" label-position="left">
         <el-row :gutter="20">
+
           <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="返利品类名称"
-                size="small"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="返利品类"
-                size="small"
-              ></el-input>
+            <el-form-item label="" prop="mainName">
+              <el-input v-model="screenForm.mainName" placeholder="返利品类" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="销售类型编码"
-                size="small"
-              ></el-input>
+            <el-form-item label="" prop="saleTypeCode">
+              <el-input v-model="screenForm.saleTypeCode" placeholder="销售类型编码" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="销售类型名称"
-                size="small"
-              ></el-input>
+            <el-form-item label="" prop="saleTypeName">
+              <el-input v-model="screenForm.saleTypeName" placeholder="销售类型名称" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <!-- <el-select v-model="select" placeholder="请选择" size="small">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
+            <el-form-item prop="status">
+              <el-select v-model="screenForm.status" placeholder="请选择" size="small">
+                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                 </el-option>
-              </el-select> -->
+              </el-select>
             </el-form-item>
           </el-col>
-          <el-col :xs="24" :ms="18" :lg="18" class="tr">
+          <el-col :xs="24" :ms="18" :lg="18">
             <el-form-item>
-              <el-button type="primary" size="small" @click="submitScreenForm"
-                >查询</el-button
-              >
-              <el-button type="primary" size="small" @click="resetScreenForm"
-                >重置</el-button
-              >
+              <el-button type="primary" size="small" @click="dialogVisible = true,type=1,getDictList()">新增</el-button>
+
+              <el-button type="primary" size="small" @click="submitScreenForm">查询</el-button>
+              <el-button type="primary" size="small" @click="resetScreenForm">重置</el-button>
+
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
     </div>
-    <div class="btn-group">
-      <el-button type="primary" size="small" @click="dialogVisible = true"
-        >新增</el-button
-      >
-      <el-button type="primary" size="small" @click="dialogVisible = true"
-        >编辑</el-button
-      >
-      <el-button type="primary" size="small" @click="">删除</el-button>
-      <el-button type="primary" size="small" @click="">导入</el-button>
-      <el-button type="primary" size="small" @click="">导出</el-button>
-    </div>
+
     <div class="mymain-container">
-      <el-table
-        v-loading="listLoading"
-        :data="dataList"
-        element-loading-text="Loading"
-        border
-        fit
-        highlight-current-row
-        stripe
-      >
+      <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row
+        stripe>
         <el-table-column type="selection" width="55" align="center">
         </el-table-column>
         <template v-for="col in columns">
-          <el-table-column
-            align="center"
-            :label="col.lable"
-            :prop="col.prop"
-            :min-width="col.widht"
-            show-overflow-tooltip
-            v-if="col.prop == 'status'"
-          >
+          <el-table-column align="center" :label="col.lable" :prop="col.prop" :min-width="col.widht"
+            show-overflow-tooltip v-if="col.prop == 'status'">
             <template slot-scope="scope">
-              <el-switch
-                v-model="isSwitch"
-                disabled
-                :active-text="isSwitch ? '已啓用' : '已禁用'"
-              >
+              <el-switch v-model="scope.row.status" disabled :active-value='true' :inactive-value='false'
+                :active-text="scope.row.status ? '已启用' : '已禁用'">
               </el-switch>
             </template>
           </el-table-column>
-          <el-table-column
-            v-else
-            align="center"
-            :label="col.lable"
-            :prop="col.prop"
-            :min-width="col.widht"
-            show-overflow-tooltip
-          >
+          <el-table-column v-else align="center" :label="col.lable" :prop="col.prop" :min-width="col.widht"
+            show-overflow-tooltip>
           </el-table-column>
         </template>
 
-        <el-table-column
-          align="center"
-          fixed="right"
-          label="操作"
-          min-width="160"
-        >
+        <el-table-column align="center" fixed="right" label="操作" min-width="160">
           <template slot-scope="scope">
-            <el-button type="text" size="small">查看</el-button>
-            <el-button type="text" size="small">编辑</el-button>
-            <el-button type="text" size="small">编辑</el-button>
+            <el-button type="text" size="small" @click="hanleDateil(scope.row)">查看</el-button>
+            <el-button type="text" size="small" @click="hanleEdit(scope.row)">编辑</el-button>
+            <!-- <el-button type="text" size="small">编辑</el-button> -->
           </template>
         </el-table-column>
       </el-table>
-      <Pagination @pagination="pagination" />
+      <Pagination />
     </div>
     <div>
-      <el-dialog :visible.sync="dialogVisible" width="50%">
-        <el-form
-          :model="dialogForm"
-          ref="dialogForm"
-          label-width="120px"
-          :inline="false"
-          size="normal"
-        >
-          <el-form-item label="返利使用钱包">
-            <el-input v-model="dialogForm.name"></el-input>
+      <el-dialog :visible.sync="dialogVisible" width="50%" @close='hanelclose'>
+        <el-form :model="dialogForm" ref="dialogForm" label-width="120px" :inline="false" size="normal">
+          <el-form-item label="返利使用钱包" prop="name">
+            <el-input v-model="dialogForm.name" :disabled="type==3"></el-input>
           </el-form-item>
-          <el-form-item label="产品使用品类">
-            <el-input v-model="dialogForm.name"></el-input>
+          <el-form-item label="产品使用品类" prop="mainName">
+            <el-select v-model="dialogForm.mainName" :disabled="type==3" placeholder="请选择品类" size="small">
+              <el-option v-for="item in dictListData" :key="item.dictCode" :label="item.dictValue"
+                :value="item.dictCode">
+              </el-option>
+            </el-select>
           </el-form-item>
-          <el-form-item label="销售类型编码">
-            <el-input v-model="dialogForm.name"></el-input>
+          <el-form-item label="销售类型编码" prop="saleTypeCode">
+            <el-select v-model="dialogForm.saleTypeCode" :disabled="type==3" placeholder="请选择类型编码" size="small">
+              <el-option v-for="item in typeList" :key="item.sysDictId" :label="item.dictValue" :value="item.saleCode">
+              </el-option>
+            </el-select>
+
           </el-form-item>
-          <el-form-item label="销售类型名称">
-            <el-input v-model="dialogForm.name"></el-input>
+          <el-form-item label="销售类型名称" prop="saleTypeName">
+            <el-input v-model="dialogForm.saleTypeName" :disabled="type==3"></el-input>
           </el-form-item>
-          <el-form-item label="返利折扣比例">
-            <el-input v-model="dialogForm.name"></el-input>
+          <el-form-item label="返利折扣比例" prop="rabateRate">
+            <el-input placeholder="例如:0.1=1折" :disabled="type==3" v-model="dialogForm.rabateRate"></el-input>
           </el-form-item>
-          <el-form-item label="状态">
-            <el-switch :active-text="true ? '启用' : ''"> </el-switch>
+          <el-form-item label="状态" prop="status">
+            <el-switch v-model="dialogForm.status" :disabled="type==3" :active-value='true' :inactive-value='false'
+              :active-text="dialogForm.status ? '启用' : ''"> </el-switch>
           </el-form-item>
         </el-form>
-        <span slot="footer" class="dialog-footer">
-          <el-button @click="hanleCancel">取 消</el-button>
-          <el-button type="primary" @click="handelInfo">确 定</el-button>
-        </span>
+        <template v-if="type !==3">
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="hanleCancel">取 消</el-button>
+            <el-button type="primary" @click="handelInfo">确 定</el-button>
+          </span>
+        </template>
       </el-dialog>
     </div>
   </div>
 </template>
 
 <script>
-import Mixin from "@/mixin/index";
-import Pagination from "@/components/Pagination";
-export default {
-  mixins: [Mixin],
-  data() {
-    return {
-      input: "",
-      select: "",
-      isSwitch: true,
-      screenForm: {},
-      dialogForm: { name: "" },
+  import Mixin from "@/mixin/index";
+  import Pagination from "@/components/Pagination";
+  import {
+    addWallet,
+    getDictList,
+    getTypeList,
+    updateWallet,
+    getWalletList,
+    getWalletDetail
+  } from "@/api/supply/sales"
 
-      dataList: [
-        {
-          date: "2016-05-02",
-          name: "王小虎",
-          label: "姓名",
-          address: "上海市普陀区金沙江路 1518 弄",
+  export default {
+    mixins: [Mixin],
+    data() {
+      return {
+        type: 0, // 0 1
+        screenForm: {
+          mainName: '',
+          saleTypeCode: '',
+          saleTypeName: '',
+          status: true
+        },
+        dialogForm: {
+          name: "",
+          mainName: '',
+          mainId: '',
+          saleTypeCode: '',
+          saleTypeName: '',
+          rabateRate: '',
+          status: true
         },
-      ],
-      columns: [
-        { prop: "name", lable: "销售类型编码", widht: 160 },
-        { prop: "date", lable: "销售类型名称", widht: 160 },
-        { prop: "date", lable: "返利使用钱包", widht: 160 },
-        { prop: "date", lable: "返利折扣比例", widht: 160 },
-        { prop: "status", lable: "状态", widht: 160 },
-        { prop: "date", lable: "创建人", widht: 160 },
-        { prop: "date", lable: "创建时间", widht: 160 },
-        { prop: "date", lable: "更新人", widht: 160 },
-        { prop: "date", lable: "更新时间", widht: 160 },
-      ],
-    };
-  },
-  methods: {
-    getList() {},
-    pagination(val) {
-      console.log(val, 123);
-      // this.handleCurrentChange(val)
-      // this.handleSizeChange()
+        dataList: [],
+        columns: [{
+            prop: "saleTypeCode",
+            lable: "销售类型编码",
+            widht: 160
+          },
+          {
+            prop: "saleTypeName",
+            lable: "销售类型名称",
+            widht: 160
+          },
+          {
+            prop: "name",
+            lable: "返利使用钱包",
+            widht: 160
+          },
+          {
+            prop: "rabateRate",
+            lable: "返利折扣比例",
+            widht: 160
+          },
+          {
+            prop: "status",
+            lable: "状态",
+            widht: 160
+          },
+          {
+            prop: "createBy",
+            lable: "创建人",
+            widht: 160
+          },
+          {
+            prop: "createTime",
+            lable: "创建时间",
+            widht: 160
+          },
+          {
+            prop: "updateBy",
+            lable: "更新人",
+            widht: 160
+          },
+          {
+            prop: "updateTime",
+            lable: "更新时间",
+            widht: 160
+          },
+        ],
+        options: [{
+            value: true,
+            label: '已启用'
+          },
+          {
+            value: false,
+            label: '已停用'
+          }
+        ],
+        dictListData: [],
+        typeList: []
+      };
     },
-    handelInfo() {
-      this.dialogVisible = false;
+    methods: {
+      getList() {
+        this.listLoading = true
+        const params = {
+          pageNum: this.currentPage,
+          pageSize: this.pageSize,
+          mainName: this.screenForm.mainName,
+          saleTypeCode: this.screenForm.saleTypeCode,
+          saleTypeName: this.screenForm.saleTypeName,
+          status: this.screenForm.status
+        }
+        getWalletList(params).then(res => {
+          this.dataList = res.data.records
+          this.listLoading = false
+        })
+
+      },
+      hanleEdit(item) {
+        this.dialogForm = {
+          id: item.id,
+          name: item.name,
+          mainName: item.mainName,
+          saleTypeCode: item.saleTypeCode,
+          saleTypeName: item.saleTypeName,
+          rabateRate: item.rabateRate,
+          status: item.status
+        }
+        this.getDictList()
+        this.dialogVisible = true
+
+      },
+      getDictList() {
+        getDictList({
+          sysDictEnum: "PRODUCT_TYPE"
+        }).then(res => {
+          console.log(res);
+          this.dictListData = res.data
+        })
+        const params = {
+          pageNum: 1,
+          pageSize: 10,
+          saleCode: '',
+          saleName: '',
+          status: ''
+        }
+        getTypeList(params).then(res => {
+          this.typeList = res.data.records
+        })
+      },
+      hanleDateil(item) {
+        this.type = 3
+        this.dialogVisible = true
+        this.dialogForm = {
+          ...item
+        }
+
+      },
+      hanelclose() {
+        this.hanleReset()
+      },
+      handelInfo() {
+        if (this.type) {
+          this.hanleScreen(this.dialogForm.mainId)
+          const params = {
+            ...this.dialogForm
+          }
+          addWallet(params).then(res => {
+            console.log(res);
+            this.$successMsg("添加成功")
+            this.hanleReset()
+          })
+        } else {
+          const upParams = {
+            ...this.dialogForm
+          }
+          updateType(upParams).then(res => {
+            this.$successMsg("修改成功")
+            this.hanleReset()
+          })
+        }
+      },
+      hanleReset() {
+        this.dialogForm = {
+          name: '',
+          mainId: '',
+          mainName: '',
+          saleTypeCode: '',
+          saleTypeName: '',
+          rabateRate: '',
+          status: true
+        }
+        // this.$refs.dialogForm.resetFields()
+        this.dialogVisible = false
+        this.getList()
+
+      },
+      hanleCancel() {
+        this.hanleReset()
+        this.dialogVisible = false;
+      },
+      hanleScreen(code) {
+        this.dictListData.find(k => {
+          if (k.dictCode == code) {
+            this.dialogForm.mainId = k.dictCode
+            this.dialogForm.mainName = k.dictValue
+            return
+          }
+        })
+      }
+
+
     },
-    hanleCancel() {
-      this.dialogVisible = false;
+    components: {
+      Pagination,
     },
-  },
-  components: {
-    Pagination,
-  },
-};
+  };
 </script>
 
 <style scoped></style>

+ 202 - 131
src/views/sales_rebate/salestype_list.vue

@@ -1,151 +1,94 @@
 <template>
   <div class="app-container">
     <div class="screen-container">
-      <el-form
-        :model="screenForm"
-        ref="screenForm"
-        :inline="false"
-        size="normal"
-      >
+      <el-form ref="screenForm" :model="screenForm" size="small" label-position="left">
         <el-row :gutter="20">
           <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="销售类型编码"
-                size="small"
-              ></el-input>
+            <el-form-item prop='saleCode'>
+              <el-input v-model="screenForm.saleCode" placeholder="销售类型编码" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <el-input
-                v-model="input"
-                placeholder="销售类型名称"
-                size="small"
-              ></el-input>
+            <el-form-item prop='saleName'>
+              <el-input v-model="screenForm.saleName" placeholder="销售类型名称" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="6" :lg="6">
-            <el-form-item label="">
-              <!-- <el-select v-model="select" placeholder="请选择" size="small">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
+            <el-form-item prop='status'>
+              <el-select v-model="screenForm.status" placeholder="请选择" size="small">
+                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                 </el-option>
-              </el-select> -->
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :ms="6" :lg="6" class="tr">
             <el-form-item>
-              <el-button type="primary" size="small" @click="submitScreenForm"
-                >查询</el-button
-              >
-              <el-button type="primary" size="small" @click="resetScreenForm"
-                >重置</el-button
-              >
+              <el-button type="primary" size="small" @click="submitScreenForm">查询</el-button>
+              <el-button type="primary" size="small" @click="resetScreenForm">重置</el-button>
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
     </div>
     <div class="btn-group">
-      <el-button type="primary" size="small" @click="dialogVisible = true"
-        >新增</el-button
-      >
-      <el-button type="primary" size="small" @click="dialogVisible = true"
+      <el-button type="primary" size="small" @click="dialogVisible = true,type=1">新增</el-button>
+      <!--  <el-button type="primary" size="small" @click="dialogVisible = true"
         >编辑</el-button
       >
       <el-button type="primary" size="small" @click="">删除</el-button>
       <el-button type="primary" size="small" @click="">导入</el-button>
-      <el-button type="primary" size="small" @click="">导出</el-button>
+      <el-button type="primary" size="small" @click="">导出</el-button> -->
     </div>
     <div class="mymain-container">
-      <el-table
-        v-loading="listLoading"
-        :data="dataList"
-        element-loading-text="Loading"
-        border
-        fit
-        highlight-current-row
-        stripe
-      >
+      <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row
+        stripe>
         <el-table-column type="selection" width="55" align="center">
         </el-table-column>
         <template v-for="col in columns">
-          <el-table-column
-            align="center"
-            :label="col.lable"
-            :prop="col.prop"
-            :min-width="col.widht"
-            show-overflow-tooltip
-            v-if="col.prop == 'status'"
-          >
+          <el-table-column align="center" :label="col.lable" :prop="col.prop" :min-width="col.widht"
+            show-overflow-tooltip v-if="col.prop == 'status'">
             <template slot-scope="scope">
-              <el-switch
-                v-model="isSwitch"
-                disabled
-                :active-text="isSwitch ? '已啓用' : '已禁用'"
-              >
+              <el-switch v-model="scope.row.status" disabled :active-text="scope.row.status ? '已启用' : '已禁用'">
               </el-switch>
             </template>
           </el-table-column>
-          <el-table-column
-            v-else
-            align="center"
-            :label="col.lable"
-            :prop="col.prop"
-            :min-width="col.widht"
-            show-overflow-tooltip
-          >
+          <el-table-column v-else align="center" :label="col.lable" :prop="col.prop" :min-width="col.widht"
+            show-overflow-tooltip>
           </el-table-column>
         </template>
 
-        <el-table-column
-          align="center"
-          fixed="right"
-          label="操作"
-          min-width="160"
-        >
+        <el-table-column align="center" fixed="right" label="操作" min-width="160">
           <template slot-scope="scope">
-            <el-button type="text" size="small">查看</el-button>
-            <el-button type="text" size="small">编辑</el-button>
-            <el-button type="text" size="small">编辑</el-button>
+            <el-button type="text" size="small" @click="hanleEdit(scope.row)">编辑</el-button>
+            <el-button type="text" size="small" @click="hanleDateil(scope.row)">详情</el-button>
+            <el-popconfirm title="这是一段内容确定删除吗?" style="margin-left: 10px;">
+              <el-button slot="reference" type="text" size="small" @click="hanleDatele(scope.row.id)">删除</el-button>
+            </el-popconfirm>
           </template>
         </el-table-column>
       </el-table>
-      <Pagination @pagination="pagination" />
+      <Pagination />
     </div>
     <div>
       <el-dialog :visible.sync="dialogVisible" width="50%">
-        <el-form
-          :model="dialogForm"
-          ref="dialogForm"
-          label-width="120px"
-          :inline="false"
-          size="normal"
-        >
+        <el-form ref="dialogForm" :model="dialogForm" label-width="120px" :inline="false" size="normal">
           <el-form-item label="销售类型编码">
-            <el-input v-model="dialogForm.name"></el-input>
+            <el-input v-model="dialogForm.saleCode"></el-input>
           </el-form-item>
           <el-form-item label="销售类型名称">
-            <el-input v-model="dialogForm.name"></el-input>
+            <el-input v-model="dialogForm.saleName"></el-input>
           </el-form-item>
           <el-form-item label="品类">
-            <el-input v-model="dialogForm.name"></el-input>
+            <el-input v-model="dialogForm.mainName"></el-input>
           </el-form-item>
           <el-form-item label="状态">
-            <el-switch :active-text="true ? '启用' : ''"> </el-switch>
+            <el-switch v-model="dialogForm.status" :active-value='true' :inactive-value='false'
+              :active-text="dialogForm.status? '启用' : ''"> </el-switch>
           </el-form-item>
         </el-form>
         <span slot="footer" class="dialog-footer">
           <el-button @click="dialogVisible = false">取 消</el-button>
-          <el-button type="primary" @click="dialogVisible = false"
-            >确 定</el-button
-          >
+          <el-button type="primary" @click="handelInfo">确 定</el-button>
         </span>
       </el-dialog>
     </div>
@@ -153,51 +96,179 @@
 </template>
 
 <script>
-import Mixin from "@/mixin/index";
-import Pagination from "@/components/Pagination";
+  import Mixin from "@/mixin/index";
+  import Pagination from "@/components/Pagination";
+  import {
+    getTypeList,
+    delTypeData,
+    addData,
+    updateType,
+    getDetail
+  } from "@/api/supply/sales"
 
-export default {
-  mixins: [Mixin],
-  data() {
-    return {
-      input: "",
-      select: "",
-      isSwitch: true,
-      screenForm: {},
-      dialogForm: { name: "" },
-      dataList: [
-        {
+  export default {
+    mixins: [Mixin],
+    data() {
+      return {
+        type: 0, // 0,1
+        screenForm: {
+          saleCode: '',
+          saleName: '',
+          status: 1
+        },
+        dialogForm: {
+          id: '',
+          saleCode: '',
+          saleName: '',
+          mainName: '',
+          status: true,
+        },
+        dataList: [{
           date: "2016-05-02",
           name: "王小虎",
           label: "姓名",
           address: "上海市普陀区金沙江路 1518 弄",
-        },
-      ],
-      columns: [
-        { prop: "name", lable: "销售类型编码", widht: 160 },
-        { prop: "date", lable: "销售类型名称", widht: 160 },
-        { prop: "date", lable: "出库类型", widht: 160 },
-        { prop: "date", lable: "品类", widht: 160 },
-        { prop: "status", lable: "状态", widht: 160 },
-        { prop: "date", lable: "创建人", widht: 160 },
-        { prop: "date", lable: "创建时间", widht: 160 },
-        { prop: "date", lable: "更新人", widht: 160 },
-        { prop: "date", lable: "更新时间", widht: 160 },
-      ],
-    };
-  },
-  methods: {
-    getList() {},
-    pagination(val) {
-      console.log(val, 123);
-      // this.handleCurrentChange(val)
-      // this.handleSizeChange()
+        }, ],
+        columns: [{
+            prop: "saleCode",
+            lable: "销售类型编码",
+            widht: 160
+          },
+          {
+            prop: "saleName",
+            lable: "销售类型名称",
+            widht: 160
+          },
+          {
+            prop: "outType",
+            lable: "出库类型",
+            widht: 160
+          },
+          {
+            prop: "mainName",
+            lable: "品类",
+            widht: 160
+          },
+          {
+            prop: "status",
+            lable: "状态",
+            widht: 160
+          },
+          {
+            prop: "createBy",
+            lable: "创建人",
+            widht: 160
+          },
+          {
+            prop: "createTime",
+            lable: "创建时间",
+            widht: 160
+          },
+          {
+            prop: "updateBy",
+            lable: "更新人",
+            widht: 160
+          },
+          {
+            prop: "updateTime",
+            lable: "更新时间",
+            widht: 160
+          },
+        ],
+        options: [{
+            value: 1,
+            label: '已启用'
+          },
+          {
+            value: 0,
+            label: '已停用'
+          }
+        ]
+      };
+    },
+    methods: {
+      getList() {
+        this.listLoading = true
+        const params = {
+          pageNum: this.currentPage,
+          pageSize: this.pageSize,
+          saleCode: this.screenForm.saleCode,
+          saleName: this.screenForm.saleName,
+          status: this.screenForm.status
+        }
+        getTypeList(params).then(res => {
+          this.dataList = res.data.records
+          this.listLoading = false
+        })
+      },
+      hanleDatele(id) {
+        this.hanleDeleteAllPromise(id).then(ids => {
+          delTypeData({
+            id: ids[0]
+          }).then(res => {
+            this.$successMsg("删除成功")
+            this.getList()
+          })
+        })
+      },
+      hanleEdit(item) {
+        this.dialogForm = {
+          id: item.id,
+          saleCode: item.saleCode,
+          saleName: item.saleName,
+          mainName: item.mainName,
+          status: item.status,
+        }
+        this.dialogVisible = true
+
+      },
+      hanleDateil(item) {
+        this.dialogVisible = true
+        this.dialogForm = {
+          ...item
+        }
+      },
+      handelInfo() {
+        if (this.type) {
+          const params = {
+            ...this.dialogForm
+          }
+          addData(params).then(res => {
+            console.log(res);
+            this.$successMsg("添加成功")
+
+            this.hanleReset()
+          })
+        } else {
+          const upParams = {
+            ...this.dialogForm
+          }
+          updateType(upParams).then(res => {
+            this.$successMsg("修改成功")
+
+            this.hanleReset()
+          })
+        }
+      },
+      hanleReset() {
+        this.dialogForm = {
+          id: '',
+          saleCode: '',
+          saleName: '',
+          mainName: '',
+          status: true,
+        }
+        // this.$refs.dialogForm.resetFields()
+        this.dialogVisible = false
+        this.getList()
+
+      }
+
+    },
+    components: {
+      Pagination,
     },
-  },
-  components: {
-    Pagination,
-  },
-};
+  };
 </script>
 
 <style scoped></style>