浏览代码

Merge branch 'feature/Feature-sales' into develop

莫绍宝 3 年之前
父节点
当前提交
935bcc4d0f

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

@@ -1,9 +1,266 @@
 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: 'post',
+    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 deleteCondition(params) {
+  return request({
+    url: '/policy/condition/delete',
+    method: 'post',
+    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
   })

+ 2 - 2
src/layout/components/AppMain.vue

@@ -1,9 +1,9 @@
 <template>
   <section class="app-main">
     <transition name="fade-transform" mode="out-in">
-      <keep-alive :include="cachedViews">
+      <!-- <keep-alive :include="cachedViews"> -->
         <router-view :key="key" />
-      </keep-alive>
+      <!-- </keep-alive> -->
     </transition>
   </section>
 </template>

+ 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;
 }

+ 480 - 65
src/views/sales_policy/components/AddCondition.vue

@@ -1,81 +1,136 @@
 <template>
   <el-container>
-    <el-header class="header">
+    <el-header height="50px" class="header">
+      <el-page-header @back="$parent.isShow = 2" content="详情页面">
+      </el-page-header>
+    </el-header>
+    <div class="line">
       <el-divider></el-divider>
       <h4>限定条件</h4>
       <el-divider></el-divider>
-    </el-header>
-    <el-main>
+    </div>
+    <el-main v-if="!id">
       <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 >
               <el-row class="pdt">
                 <el-button
                   type="primary"
                   size="small"
-                  @click="centerDialogVisible = true"
+                  @click="
+                    (VisibleModle = true), getMaterialLists(), (arrIndex = index)
+                  "
                   >添加机型</el-button
                 >
 
-                <el-button type="primary" size="small" @click=""
+                <el-button type="primary" size="small" @click="handleDeleteRow(), (arrIndex = index)"
                   >删除机型</el-button
                 >
               </el-row>
               <el-row>
-                <el-table style="width: 100%" :data="tableData" border>
+                <el-table style="width: 100%" :data="item" border   @select="hanleSelectAll"
+          @select-all="hanleSelectAll">
                   <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"  prop="materialName">
                     <template slot-scope="scope">{{ scope.row.date }}</template>
                   </el-table-column>
-                  <el-table-column prop="name" label="姓名" align="center">
+                  <el-table-column prop="specification" 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>
+          <el-form label-width="120px" :inline="false" size="small" >
             <el-row>
-              <el-row class="pdt">
-                <el-button type="primary" size="small" @click=""
+              <el-form-item label="配置比例设置"> </el-form-item>
+            </el-row>
+            <el-col :xs="24" :sm="8" :lg="8">
+              <el-form-item label="限定机型">
+                <el-input v-model="limit" size="small"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col
+              :xs="24"
+              :sm="8"
+              :lg="8"
+              v-for="(len, index) in conditionBox"
+            >
+              <el-form-item :label="'配提' + (index + 1) + '比例'">
+                <el-input size="small"  v-model="popArr['line_'+index]"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-form>
+
+
+        </el-row>
+        <el-divider></el-divider>
+      </el-row>
+    </el-main>
+    <el-main v-else>
+      <el-row>
+        <el-row :gutter="50">
+          <el-col
+            :xs="24"
+            :sm="24"
+            :lg="24"
+            class="mgb"
+            v-for="(item, index) in conditionBoxs"
+            :key="index"
+          >
+            <el-row v-for="col in item">
+              <!-- <el-row class="pdt">
+                <el-button
+                  type="primary"
+                  size="small"
+                  @click="VisibleModle = true"
                   >添加机型</el-button
                 >
+
                 <el-button type="primary" size="small" @click=""
                   >删除机型</el-button
                 >
-              </el-row>
+              </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 prop="name" label="规格型号" align="center">
                   </el-table-column>
                 </el-table>
               </el-row>
             </el-row>
           </el-col>
         </el-row>
-        <el-row>
+        <el-row v-if="conditionBoxs.length">
           <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 conditionBoxs">
               <el-form-item label="配提比例">
                 <el-input size="small"></el-input>
               </el-form-item>
             </el-col>
           </el-form>
-
           <el-col class="text_rihgt" v-if="false">
             <el-button type="primary" size="small" @click=""
               >添加限定条件</el-button
@@ -85,61 +140,289 @@
         <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>
+    <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-dialog :visible.sync="VisibleModle" width="70%" center>
+      <div>
+        <el-container>
+          <el-header height="">
+            <el-form label-width="0" :inline="false" size="small">
+              <el-col :xs="24" :sm="8" :lg="8" :offset="0">
+                <el-form-item label="">
+                  <el-input
+                    v-model="saleTypeCode"
+                    placeholder="类型编号"
+                  ></el-input>
+                </el-form-item>
+              </el-col>
+            </el-form>
+          </el-header>
+          <el-main height="">
+            <el-row>
+              <el-row :gutter="50">
+                <el-col :xs="10" :ms="10" :lg="10">
+                  <el-row>
+                    <el-row> </el-row>
+                    <el-row>
+                      <el-row class="title"> 可选产品列表 </el-row>
+                      <el-table
+                        style="width: 100%"
+                        :data="conditList"
+                        border
+                        height="400"
+                        @select-all="handleSelectionAllChange"
+                        @selection-change="handleSelectionChange"
+                      >
+                        <el-table-column
+                          type="selection"
+                          width="55"
+                          align="center"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                          label="产品编码"
+                          prop="materialNumber"
+                          width="120"
+                          align="center"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                          prop="materialName"
+                          label="产品名称"
+                          align="center"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                          prop="specification"
+                          label="产品型号"
+                          align="center"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                          prop="price"
+                          label="产品价格"
+                          align="center"
+                        >
+                        </el-table-column>
+                      </el-table>
+                      <el-row class="mg">
+                        <div>
+                          <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-row>
+                  </el-row>
+                </el-col>
+                <el-col :xs="4" :ms="4" :lg="4" class="middle">
+                  <el-row :gutter="20" justify="center" align="middle">
+                    <el-row class="btn">
+                      <el-button
+                        type="primary"
+                        size="small "
+                        @click="handleAllAdd"
+                        :disabled="type == 2"
+                        >全部添加</el-button
+                      >
+                    </el-row>
+                    <el-row class="btn">
+                      <el-button
+                        type="primary"
+                        size="small "
+                        @click="handleAdd"
+                        :disabled="type == 2"
+                        >增加</el-button
+                      >
+                    </el-row>
+                    <el-row class="btn">
+                      <el-button
+                        type="primary"
+                        size="small "
+                        @click="handleDelete"
+                        :disabled="type == 1"
+                        >删除</el-button
+                      ></el-row
+                    >
+                    <el-row class="btn"
+                      ><el-button
+                        :disabled="type == 1"
+                        type="primary"
+                        size="small  "
+                        @click="handleAllDelete"
+                        >全部删除</el-button
+                      ></el-row
+                    >
+                  </el-row>
+                </el-col>
+                <el-col :xs="10" :ms="10" :lg="10">
+                  <el-row>
+                    <el-row> </el-row>
+                    <el-row>
+                      <el-row class="title"> 已选产品列表 </el-row>
+                      <el-table
+                        style="width: 100%"
+                        :data="conditList2"
+                        @select-all="handleSelectionAllChange2"
+                        @selection-change="handleSelectionChange2"
+                        border
+                        height="400"
+                      >
+                        <el-table-column
+                          type="selection"
+                          width="55"
+                          align="center"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                          label="产品编码"
+                          prop="materialNumber"
+                          width="120"
+                          align="center"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                          prop="materialName"
+                          label="产品名称"
+                          align="center"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                          prop="specification"
+                          label="产品型号"
+                          align="center"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                          prop="price"
+                          label="产品价格"
+                          align="center"
+                        >
+                        </el-table-column>
+                      </el-table>
+                      <el-row class="mg">
+                        <!-- <Pagination /> -->
+                      </el-row>
+                    </el-row>
+                  </el-row>
+                </el-col>
+              </el-row>
+            </el-row>
+          </el-main>
+        </el-container>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="VisibleModle = false">取 消</el-button>
+        <el-button type="primary" @click="handleDiaSubmit">确 定</el-button>
+      </span>
+    </el-dialog>
   </el-container>
 </template>
 
 <script>
+import {
+  getId,
+  addPoliyCondition,
+  getConditionMaterialList,
+  getMaterialList,
+  getConditionMaterialDetail,
+} from "@/api/supply/sales";
+import TabelTransfer from "./TabelTransfer.vue";
+
 import AddModel from "./AddModel";
+import Minxin from "@/mixin";
 export default {
+  mixins: [Minxin],
+  props: {
+    id: {
+      type: String,
+      default: "",
+    },
+  },
   data() {
     return {
-      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 弄",
-        },
-      ],
+      base: {
+        id: null,
+        policyConditionMaterials: [
+          {
+            id: null,
+            materialId: "",
+            materialName: "",
+            materialNumber: "",
+            policyConditionId: "",
+            policyId: "",
+            policyMaterialId: "",
+            popType: 0,
+            specification: "",
+            walletType: "",
+          },
+        ],
+        policyId: "",
+        policyName: "",
+        pop: "",
+      },
+      limit:'',
+      VisibleModle: false,
+      conditionBox: [[], []],
+      conditionBoxs: [],
       multipleSelection: [],
+      searchForm: {
+        code: "",
+      },
+      pop: "",
+      conditList: [],
+      leftData: [],
+      rightData: [],
+      conditList2: [],
+      type: "",
+      saleTypeCode: "",
+      arrIndex: 0,
+      popArr:{}
     };
   },
+  created() {
+    this.getCommonApi();
+    console.log(this.$parent.codeId,'codeid' );
+  },
   methods: {
+    getList(){
+    },
+    getCommonApi() {
+      if (this.id) {
+        var i = 1;
+        getConditionMaterialDetail({ id: this.id }).then((res) => {
+          this.pop = res.data;
+          while (i <= 2) {
+            // getConditionMaterialList({pageNum:1,pageSize:10,policyConditionId:this.id,popType:i}).then((res) => {
+            //   console.log(res, "比值");
+            //   i++;
+            // });
+            console.log(res, "比值");
+            i++;
+          }
+        });
+      }
+    },
     toggleSelection(rows) {
       if (rows) {
         rows.forEach((row) => {
@@ -149,17 +432,119 @@ export default {
         this.$refs.multipleTable.clearSelection();
       }
     },
+    hanleAddModel() {
+      this.conditionBox.push([{}]);
+    },
+    handleSubmit() {
+      console.log(this.popArr);
+      const params = {
+        id: "",
+        policyConditionMaterials: [
+          {
+            id: "",
+            materialId: "234",
+            materialName: "234",
+            materialNumber: "34",
+            policyConditionId: "23423",
+            policyId: "234",
+            policyMaterialId: "2342",
+            popType: 0,
+            specification: "2342",
+            walletType: "23423",
+          },
+        ],
+        policyId: this.$parent.codeId,
+        policyName: "hah",
+        pop: "1:2",
+      };
+      // addPoliyCondition(params).then((res) => {
+      //   this.$successMsg("添加成功");
+      // });
+    },
     handleSelectionChange(val) {
       this.multipleSelection = val;
     },
+    handleDeleteRow(){
+      console.log(this.arrIndex);
+    },
+    getMaterialLists() {
+      getMaterialList({
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        saleTypeCode: this.saleTypeCode,
+        policyId: this.$parent.codeId,
+      }).then((res) => {
+        this.conditList = res.data.records;
+        console.log(4545,this.conditList);
+        this.listTotal = res.data.total;
+      });
+    },
+    handleSelectionAllChange(e) {
+      this.leftData = e;
+      this.type = 1;
+    },
+    handleSelectionChange(e) {
+      this.leftData = e;
+      this.type = 1;
+    },
+    handleSelectionAllChange2(e) {
+      this.rightData = e;
+      this.type = 2;
+    },
+    handleSelectionChange2(e) {
+      this.rightData = e;
+      this.type = 2;
+    },
+    handleAllAdd() {
+      this.conditList2 = this.leftData;
+      this.leftData = []
+    },
+    handleAllDelete() {
+      this.conditList2 = [];
+    },
+    handleAdd() {
+      this.conditList2 = this.leftData;
+    },
+    handleDelete() {
+      if (this.type == 2) {
+        for (let k = 0; k < this.conditList2.length; k++) {
+          for (let i = 0; i < this.rightData.length; i++) {
+            if (this.rightData[i].id == this.rightData[k].id) {
+              this.conditList2.splice(i, 1);
+            }
+          }
+        }
+      }
+    },
+    handleDiaSubmit() {
+      if (this.conditList2.length) {
+        for (let i = 0; i < this.conditionBox.length; i++) {
+          console.log(this.conditionBox[i]);
+          if (i == this.arrIndex) {
+            this.$set(this.conditionBox, i, [
+              ...this.conditList2,
+              ...this.conditionBox[i]
+            ]);
+            console.log(this.conditionBox);
+          }
+        }
+        this.VisibleModle = false
+      } else {
+        this.$errorMsg("请选择内容");
+      }
+    },
   },
   components: {
     AddModel,
+    TabelTransfer,
   },
 };
 </script>
 
 <style lang="scss" scoped>
+.line {
+  margin: 0 20px;
+}
 .mgb {
   margin-bottom: 20px;
 }
@@ -175,4 +560,34 @@ export default {
 .el-main {
   overflow: hidden;
 }
+.btn {
+  margin: 20px 0;
+  text-align: center;
+}
+.query_btn {
+  margin-left: 0;
+}
+.mg {
+  margin: 20px;
+}
+.pdt {
+  margin: 20px 0;
+}
+.el-main {
+  overflow: hidden;
+}
+.middle {
+  height: 430px;
+  display: flex;
+  align-content: center;
+  justify-content: center;
+  align-items: center;
+}
+.title {
+  padding: 10px 0;
+  text-align: center;
+  border-left: 1px solid #ebeef5;
+  border-right: 1px solid #ebeef5;
+  border-top: 1px solid #ebeef5;
+}
 </style>

+ 2 - 16
src/views/sales_policy/components/AddModel.vue

@@ -1,19 +1,5 @@
 <template>
-  <el-dialog
-    :visible.sync="centerDialogVisible"
-    width="70%"
-    center
-  >
-    <div>
-      <TabelTransfer />
-    </div>
-    <span slot="footer" class="dialog-footer">
-      <el-button @click="centerDialogVisible = false">取 消</el-button>
-      <el-button type="primary" @click="centerDialogVisible = false"
-        >确 定</el-button
-      >
-    </span>
-  </el-dialog>
+
 </template>
 
 <script>
@@ -23,7 +9,7 @@ export default {
     return {};
   },
   props: {
-    centerDialogVisible: {
+    VisibleModle: {
       type: Boolean,
       default: false,
     },

+ 502 - 276
src/views/sales_policy/components/AddPolicy.vue

@@ -1,243 +1,356 @@
 <template>
-  <div class="app-container">
-    <div class="screen-container">
-      <h4>销售政策信息</h4>
-      <el-divider></el-divider>
-      <el-form
-        :model="ruleForm"
-        :rules="rules"
-        ref="ruleForm"
-        label-width="120px"
-        size="small"
-        class="demo-ruleForm"
-      >
-        <el-row>
-          <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-col>
-          <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"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
-                </el-option>
-              </el-select>
-            </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-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
+  <div>
+    <el-header height="50px" class="header">
+      <el-page-header @back="$parent.isShow = 1" content="详情页面">
+      </el-page-header>
+    </el-header>
+    <div class="app-container">
+      <div class="screen-container">
+        <h4>销售政策信息</h4>
+        <el-divider></el-divider>
+        <el-form
+          :model="searchForm"
+          :rules="rules"
+          ref="searchForm"
+          label-width="120px"
+          size="small"
+          class="demo-searchForm"
+        >
+          <el-row>
+            <el-col :xs="24" :ms="12" :lg="12">
+              <el-form-item label="销售政策编号" prop="code">
+                <el-input
+                  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="title">
+                <el-input
+                  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="type">
+                <el-select
+                  size="small"
+                  v-model="searchForm.type"
+                  placeholder="销售政策类型"
+                  @change="hanleChange"
+                  class="select_height"
                 >
-                </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-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="12" :lg="12">
+              <el-form-item label="支付钱包类型" prop="name">
+                <el-select v-model="value" placeholder="请选择">
+                  <el-option
+                    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-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="startTime">
+                <el-date-picker
+                  v-model="searchForm.startTime"
+                  type="datetime"
+                  placeholder="生效日期"
+
 
-          <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-col>
-          <el-col :xs="24" :ms="24" :lg="24">
-            <el-form-item label="表头备注" prop="name">
-              <el-input
-                v-model="ruleForm.name"
-                placeholder="新风机变频挂机。按提货数量1:3开单"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="24" :ms="24" :lg="24">
-            <el-form-item label="政策封面图">
+            default-time="00:00:00"
+            value-format="yyyy-MM-dd HH:mm:ss"
+                >
+                </el-date-picker> </el-form-item
+            ></el-col>
+            <el-col :xs="24" :ms="12" :lg="12">
+              <el-form-item label="失效日期" prop="endTime">
+                <el-date-picker
+                  v-model="searchForm.endTime"
+                  type="datetime"
+                  placeholder="失效日期"      default-time="00:00:00"
+            value-format="yyyy-MM-dd HH:mm:ss"
+                >
+                </el-date-picker> </el-form-item
+            ></el-col>
+            <el-col :xs="24" :ms="24" :lg="24">
+              <el-form-item label="表头备注" prop="remark">
+                <el-input
+                  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="政策封面图" prop="imgSrc">
+                <el-upload
+                  class="avatar-uploader"
+                  action="https://jsonplaceholder.typicode.com/posts/"
+                  :show-file-list="false"
+                  :on-success="handleAvatarSuccess"
+                  :before-upload="beforeAvatarUpload"
+                >
+                  <img v-if="imageUrl" :src="imageUrl" class="avatar" />
+                  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+                </el-upload>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+      <div class="mymian-container">
+        <el-row>
+          <el-divider></el-divider>
+          <el-row type="flex">
+            <el-col :span="12">
+              <h4 style="display: inline-block; margin-right: 20px">
+                货品信息
+              </h4>
               <el-upload
-                class="avatar-uploader"
-                action="https://jsonplaceholder.typicode.com/posts/"
-                :show-file-list="false"
-                :on-success="handleAvatarSuccess"
-                :before-upload="beforeAvatarUpload"
+                class="import-btn"
+                :action="baseURL + 'student/import'"
+                :http-request="handleImport"
+                :file-list="importFileList"
               >
-                <img v-if="imageUrl" :src="imageUrl" class="avatar" />
-                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+                <el-button size="small">导入货品价格表</el-button>
               </el-upload>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-    </div>
-    <div class="mymian-container">
-      <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-col :span="12" class="tr">
-            <el-button size="small">管理条件</el-button>
-          </el-col>
+              <el-button size="small" @click="hanleDownloadFiles"
+                >下载模板</el-button
+              >
+            </el-col>
+          </el-row>
+          <el-divider></el-divider>
         </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-column
-          fixed
-          prop="num"
-          label="序号"
-          width="50"
-          align="center"
-        >
-        </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
-          prop="address"
-          label="销售类型编码"
-          width="500"
-          align="center"
+        <el-table
+          v-loading="listLoading"
+          :data="dataList"
+          element-loading-text="Loading"
+          border
+          fit
+          highlight-current-row
+          stripe
         >
-        </el-table-column>
-        <el-table-column prop="zip" label="销售类型" align="center">
-        </el-table-column>
-        <el-table-column prop="zip" label="单价" align="center">
-        </el-table-column>
-        <el-table-column prop="zip" label="支付钱包" align="center">
-        </el-table-column>
-        <el-table-column fixed="right" label="操作" align="center">
-          <template slot-scope="scope">
-            <el-button type="text" size="small">删除</el-button>
-          </template>
-        </el-table-column>
-      </el-table>
-      <Pagination />
-      <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-table-column
+            fixed
+            prop="num"
+            label="序号"
+            width="50"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="materialNumber"
+            label="货品编码"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column prop="materialName" label="货品名称" align="center">
+          </el-table-column>
+          <el-table-column prop="specification" label="规格型号" align="center">
+          </el-table-column>
+          <el-table-column
+            prop="saleTypeCode"
+            label="销售类型编码"
+            width="500"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column prop="saleTypeName" label="销售类型" align="center">
+          </el-table-column>
+          <el-table-column prop="price" label="单价" align="center">
+          </el-table-column>
+          <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-popconfirm
+                confirm-button-text="好的"
+                cancel-button-text="不用了"
+                icon="el-icon-info"
+                icon-color="red"
+                title="内容确定删除吗?"
+                @onConfirm="hanleDelete(scope.row.id)"
+              >
+                <el-button
+                  slot="reference"
+                  type="text"
+                  class="textColor el-popover-left"
+                  >删除</el-button
+                >
+              </el-popconfirm>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!-- 分页 -->
+        <div style="margin: 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-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" @click="$parent.isShow = 3"
+                >管理条件</el-button
+              ></el-col
+            >
+          </el-row>
+          <el-divider></el-divider>
         </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-column
-          fixed
-          prop="num"
-          label="序号"
-          width="50"
-          align="center"
+        <el-table
+          v-loading="listLoading"
+          :data="conditionList"
+          element-loading-text="Loading"
+          border
+          fit
+          highlight-current-row
+          stripe
         >
-        </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">
-          <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>
-    </div>
-
-    <div>
-      <el-row>
-        <el-divider></el-divider>
-        <el-row type="flex" align="middle">
-          <el-col :span="2">
-            <h4>货品信息</h4>
-          </el-col>
+          <el-table-column
+            fixed
+            type="index"
+            label="序号"
+            width="50"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column prop="name" label="限定条件" align="center">
+          </el-table-column>
+          <el-table-column
+            fixed="right"
+            width="150"
+            label="操作"
+            align="center"
+          >
+            <template slot-scope="scope">
+              <el-button type="text" size="small">删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <div>
+        <el-row>
+          <el-divider></el-divider>
+          <el-row type="flex" align="middle">
+            <el-col :span="2">
+              <h4>经销商信息</h4>
+            </el-col>
+          </el-row>
+          <el-divider></el-divider>
         </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" />
+      </div>
     </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: {
-        name: "",
+      baseURL: "",
+      searchForm: {
+        code: "",
+        endTime: "",
+        imgSrc: "",
+        remark: "",
+        startTime: "",
+        title: "",
+        type: "",
       },
       listLoading: false,
       rules: {
@@ -247,76 +360,186 @@ 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");
+    },
+    getCommonApi() {
+      const params = {
+        pageNum: 1,
+        pageSize: 10,
+        saleCode: "",
+        saleName: "",
+        status: "",
+      };
+      const walletParams = {
+        pageNum: 1,
+        pageSize: 10,
+        mainName: "",
+        saleTypeCode: "",
+        saleTypeName: "",
+        status: "",
+      };
+      // 获取销售政策编号
+      getId().then((res) => {
+        console.log(res.data);
+        this.searchForm.code = res.data;
+        this.$parent.codeId = 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;
+      });
+    },
+    // 导入
+    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();
+        this.handletwoList();
+      } else {
+        this.$alert(result.message, "导入失败", {
+          confirmButtonText: "确定",
+        });
+      }
+    },
+    getList() {
+      const params = {
+        policyId: this.searchForm.code,
+      };
+      // 获取条件政策
+      getConditionList(params).then((res) => {
+        this.conditionList = res.data;
+      });
     },
+    //获取政策id调取货品信息
+    hanleChange() {
+      // this.handletwoList();
+    },
+    // 获取货品信息
+    handletwoList() {
+      const paramss = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        policyId: this.searchForm.code,
+        saleTypeCode: this.searchForm.type,
+      };
+      console.log(45454);
+      getMaterialList(paramss)
+        .then((result) => {
+          this.dataList = result.data.records;
+          console.log(result, 9898989);
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    // 获取图片路径
     beforeAvatarUpload() {},
     handleAvatarSuccess() {},
+    // 提交审核
+    handleAddPolicy(policyCustomers) {
+      console.log(policyCustomers, "选择的经销商");
+
+      var arr = [
+        {
+          customerId: "",
+          customerName: "",
+          customerNumber: "",
+          id: "",
+          lastOrderTime: "",
+          limitTakeNum: 0,
+          policyId: "",
+          policyTitle: "",
+          remark: "",
+        },
+      ];
+      policyCustomers.forEach((el) => {
+        arr.push({
+          customerId: "",
+          customerName: el.name,
+          customerNumber: el.number,
+          lastOrderTime: "",
+          limitTakeNum: 0,
+          policyId: this.searchForm.code,
+          policyTitle: "",
+          remark: "",
+        });
+      });
+
+      const params = {
+        adminCompanyId: "",
+        code: "",
+        customerCount: 0,
+
+        examineBy: "",
+        examineRemark: "",
+        examineStatus: "",
+
+        id: "",
+        imgSrc: "",
+        policyCustomers: arr,
+        remark: "",
+
+        status: true,
+        title: "",
+        type: "",
+        ...this.searchForm,
+      };
+      addPoliy(params).then((res) => {
+        console.log(res);
+      });
+    },
+    //删除
+    hanleDelete(id) {
+      const params = { policyMaterialId: id };
+      deleteMaterialPolicy(params).then((res) => {
+        this.$successMsg("删除成功");
+        this.handletwoList();
+      });
+    },
   },
   components: {
     Transfer,
@@ -332,7 +555,10 @@ h4 {
 .pdt {
   padding-top: 20px;
 }
-
+.import-btn {
+  margin-right: 10px;
+  display: inline-block;
+}
 .radio {
   padding: 20px 0;
 }

+ 171 - 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,49 @@ 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();
+      });
+    },
+    hanleSelectAll(){
+
+    }
   },
   components: {
     Transfer,
@@ -297,4 +303,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=6">查看条件</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>
 

+ 16 - 297
src/views/sales_policy/components/TabelTransfer.vue

@@ -1,137 +1,23 @@
 <template>
-  <el-container>
-    <el-header height="">
-      <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>
-          </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>
-          </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>
-          </el-col>
-
-          <el-col :xs="24" :sm="8" :lg="8" :offset="0">
-            <el-form-item label="" >
-              <el-date-picker
-                v-model="value1"
-                type="datetimerange"
-                range-separator="至"
-                start-placeholder="开始日期"
-                end-placeholder="结束日期"
-              >
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
-          <el-form-item label="" >
-            <el-button type="primary"  size="small " @click=""
-              >查询</el-button
-            >
-          </el-form-item>
-        </el-row>
-      </el-form>
-    </el-header>
-    <el-main height="">
-      <el-row>
-        <el-row :gutter="50">
-          <el-col :xs="10" :ms="10" :lg="10">
-            <el-row>
-              <el-row> </el-row>
-              <el-row>
-                <el-row class="title"> 可选产品列表 </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>
-                </el-table>
-                <el-row class="mg">
-                  <Pagination />
-                </el-row>
-              </el-row>
-            </el-row>
-          </el-col>
-          <el-col :xs="4" :ms="4" :lg="4" class="middle">
-            <el-row :gutter="20" justify="center" align="middle">
-              <el-row class="btn">
-                <el-button type="primary" size="small " @click=""
-                  >全部添加</el-button
-                >
-              </el-row>
-              <el-row class="btn">
-                <el-button type="primary" size="small " @click=""
-                  >增加</el-button
-                >
-              </el-row>
-              <el-row class="btn">
-                <el-button type="primary" size="small " @click=""
-                  >删除</el-button
-                ></el-row
-              >
-              <el-row class="btn"
-                ><el-button type="primary" size="small  " @click=""
-                  >全部删除</el-button
-                ></el-row
-              >
-            </el-row>
-          </el-col>
-          <el-col :xs="10" :ms="10" :lg="10">
-            <el-row>
-              <el-row> </el-row>
-              <el-row>
-                <el-row class="title"> 已选产品列表 </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>
-                </el-table>
-                <el-row class="mg">
-                  <Pagination />
-                </el-row>
-              </el-row>
-            </el-row>
-          </el-col>
-        </el-row>
-      </el-row>
-    </el-main>
-  </el-container>
 </template>
 
 <script>
+import Minxin from "@/mixin";
+import { getId, getMaterialList } from "@/api/supply/sales";
 import Pagination from "./Pagination";
 export default {
+  mixins: [Minxin],
+  props: {
+    conditList: {
+      type: Array,
+      default: [],
+    },
+  },
   data() {
     return {
       input: "",
-      leftData: [],
-      rightData: [],
+
       centerDialogVisible: false,
       value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
       tableData: [
@@ -140,154 +26,16 @@ export default {
           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 弄",
-        },
       ],
-      leftData: [],
-      dataL: [1, 3, 2],
-      dataR: [],
-      rightData: [],
-      multipleSelection: [],
+      type:''
     };
   },
+
   methods: {
-    handelLeftCheck(e) {
-      console.log(e);
-    },
-    handelLeftCheck(direction) {},
-    //添加全部数据
-    handleAllData(direction) {
-      if (direction === "left") {
-        if (!this.dataL.length) return;
-        this.dataR = [...this.dataR, ...this.dataL];
-        this.dataL = [];
-        this.leftData = [];
-      } else {
-        if (!this.dataR.length) return;
-        this.dataL = [...this.dataL, ...this.dataR];
-        this.dataR = [];
-        this.rightData = [];
-      }
-    },
-    //添加部分或单个数据
-    handlePartData(direction) {
-      if (direction === "left") {
-        if (!this.dataL.length) return;
-        this.dataR = [...this.dataR, ...this.leftData];
-        this.dataL.forEach((k, d) => {
-          this.leftData.forEach((e) => {
-            if (e == k) {
-              this.dataL.splice(d, 1);
-              this.leftData = [];
-              return;
-            }
-          });
-        });
-      } else {
-        if (!this.dataL.length) return;
-        this.dataL = [...this.dataL, ...this.rightData];
-        this.dataR.forEach((k, d) => {
-          this.rightData.forEach((e) => {
-            if (e == k) {
-              this.dataR.splice(d, 1);
-              this.rightData = [];
-              return;
-            }
-          });
-        });
-      }
-    },
-    //删除全部数据
-    handleAllDelete(direction) {
-      if (direction === "left") {
-        if (!this.dataL.length) return;
-        this.dataL = [];
-        this.leftData = [];
-      } else {
-        if (!this.dataR.length) return;
-        this.dataR = [];
-        this.rightData = [];
-      }
-    },
-    //删除部分或单个数据
-    handlePartDelete(direction) {
-      if (direction === "left") {
-        this.dataL.forEach((k, d) => {
-          this.leftData.forEach((e) => {
-            if (e == k) {
-              this.dataL.splice(d, 1);
-              this.leftData = [];
-              return;
-            }
-          });
-        });
-      } else {
-        this.dataR.forEach((k, d) => {
-          this.rightData.forEach((e) => {
-            if (e == k) {
-              this.dataR.splice(d, 1);
-              this.rightData = [];
-              return;
-            }
-          });
-        });
-      }
-    },
-    // 判断能操作那边框
-    handleJudge(type) {
-      if (this.leftDisabled) {
-        // 左边框功能操作
-        this.hanleType(type, "left");
-      } else {
-        // 右边框功能操作
-        this.hanleType(type, "right");
-      }
-    },
-    // 获取事件类型
-    hanleType(type, direction) {
-      switch (type) {
-        case "AddAll":
-          this.handleAllData(direction);
-          break;
-        case "AddPart":
-          this.handlePartData(direction);
-          break;
-        case "DeleteAll":
-          this.handleAllDelete(direction);
-          break;
-        case "DeletePart":
-          this.handlePartDelete(direction);
-          break;
-      }
+    getList() {
+      // this.getMaterialList();
     },
+
   },
   components: {
     Pagination,
@@ -296,34 +44,5 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.btn {
-  margin: 20px 0;
-  text-align: center;
-}
-.query_btn {
-  margin-left: 0;
-}
-.mg {
-  margin: 20px;
-}
-.pdt {
-  margin: 20px 0;
-}
-.el-main {
-  overflow: hidden;
-}
-.middle {
-  height: 430px;
-  display: flex;
-  align-content: center;
-  justify-content: center;
-  align-items: center;
-}
-.title {
-  padding: 10px 0;
-  text-align: center;
-  border-left: 1px solid #ebeef5;
-  border-right: 1px solid #ebeef5;
-  border-top: 1px solid #ebeef5;
-}
+
 </style>

+ 125 - 173
src/views/sales_policy/components/Transfer.vue

@@ -1,63 +1,90 @@
 <template>
   <div>
     <slot name="header">
+      <el-row class="radio">
+        <el-radio-group v-model="region">
+          <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="keyword"
+            placeholder="查找经销商"
+            size="small"
+          ></el-input>
         </el-col>
-        <el-col><el-button size="small">确定</el-button></el-col>
+        <el-col
+          ><el-button size="small" @click="getcList">确定</el-button></el-col
+        >
       </el-row>
     </slot>
     <div>
       <el-row type="flex" align="moddle" class="transfer">
         <el-col class="left_box" :span="9">
-          <h4 class="transfer_title">可选经销商</h4>
-          <el-checkbox-group
-            v-model="leftData"
-            class="left_box_flex"
-            @change="handelLeftCheck"
-          >
-            <el-checkbox
-              v-for="(item, index) in dataL"
-              :key="index"
-              :label="item"
-              :disabled="rightDisabled"
-            ></el-checkbox>
-          </el-checkbox-group>
+          <div>
+            <h4 class="transfer_title">可选经销商</h4>
+            <el-checkbox-group
+              v-model="leftData"
+              class="left_box_flex"
+              @change="handleLeft"
+            >
+              <el-checkbox
+                v-for="(item, index) in dataL"
+                :key="index"
+                :label="item.id"
+              >
+                {{ item.name }}</el-checkbox
+              >
+            </el-checkbox-group>
+          </div>
+          <!-- 分页 -->
+          <div>
+            <el-pagination
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="currentPage"
+              :page-sizes="[10]"
+              :page-size="10"
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="listTotal"
+            >
+            </el-pagination>
+          </div>
         </el-col>
         <el-col class="middle_box" :span="6">
           <el-row>
             <el-col>
-              <el-button :disabled="isDisabled" size="small" @click="handleJudge('AddAll')"
+              <el-button
+                size="small"
+                @click="handleAllAdd"
+                :disabled="type == 2 || !dataL.length"
                 >全部添加</el-button
               ></el-col
             >
             <el-col>
-              <el-button :disabled="isDisabled" size="small" @click="handleJudge('AddPart')"
+              <el-button
+                size="small"
+                @click="handleAdd"
+                :disabled="type == 2 || !dataL.length"
                 >增加</el-button
               ></el-col
             >
             <el-col>
               <el-button
-                :disabled="isDisabled"
                 size="small"
-                @click="handleJudge('DeletePart')"
+                :disabled="type == 1 || !dataR.length"
+                @click="handleDelete"
                 >删除</el-button
               ></el-col
             >
             <el-col>
               <el-button
-                :disabled="isDisabled"
                 size="small"
-                @click="handleJudge('DeleteAll')"
+                :disabled="type == 1 || !dataR.length"
+                @click="handleAllDelete"
                 >全部删除</el-button
               ></el-col
             >
@@ -65,22 +92,27 @@
         </el-col>
         <el-col class="right_box" :span="9">
           <h4 class="transfer_title">已选经销商</h4>
-          <el-checkbox-group v-model="rightData" class="right_box_flex">
+          <el-checkbox-group
+            v-model="rightData"
+            class="right_box_flex"
+            @change="handleRight"
+          >
             <el-checkbox
               v-for="(item, index) in dataR"
               :key="index"
-              :label="item"
-              :disabled="leftDisabled"
-            ></el-checkbox>
+              :label="item.id"
+            >
+              {{ item.name }}</el-checkbox
+            >
           </el-checkbox-group>
         </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>
@@ -88,11 +120,16 @@
 </template>
 
 <script>
+import Minxin from "@/mixin";
+import { getCrList } from "@/api/supply/sales";
 export default {
+  mixins: [Minxin],
   data() {
     return {
+      type: "",
+      radio: "0",
       leftData: [],
-      dataL: [1, 3, 2],
+      dataL: [],
       dataR: [],
       rightData: [],
       options: [
@@ -100,155 +137,67 @@ export default {
           value: "选项1",
           label: "黄金糕",
         },
-        {
-          value: "选项2",
-          label: "双皮奶",
-        },
-        {
-          value: "选项3",
-          label: "蚵仔煎",
-        },
-        {
-          value: "选项4",
-          label: "龙须面",
-        },
-        {
-          value: "选项5",
-          label: "北京烤鸭",
-        },
       ],
       value: "",
+      region: "0",
+      keyword: "",
     };
   },
-  computed: {
-    /**
-     * @return(bool)  isDisabled
-     *  禁用功能按钮
-     */
-    isDisabled() {
-      return !(this.leftData.length || this.rightData.length);
+  methods: {
+    getList() {
+      this.getcList();
     },
-    /**
-     * @return(bool)  leftDisabled
-     *  禁用左边框选择
-     */
-    leftDisabled() {
-      return this.leftData.some((i) => i !== "");
+    getcList() {
+      const customerParams = {
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+        keyword: this.keyword,
+        region: this.region,
+      };
+      console.log(555);
+      // 获取经销商列表
+      getCrList(customerParams).then((res) => {
+        this.dataL = res.data.records;
+        this.listTotal = res.data.total;
+      });
     },
-    /**
-     * @return(bool)  rightDisabled
-     *  禁用右边框选择
-     */
-    rightDisabled() {
-      return this.rightData.some((i) => i !== "");
+    handleLeft(e) {
+      this.type = 1;
     },
-  },
-  methods: {
-    handelLeftCheck(direction) {},
-    //添加全部数据
-    handleAllData(direction) {
-      if (direction === "left") {
-        if (!this.dataL.length) return;
-        this.dataR = [...this.dataR, ...this.dataL];
-        this.dataL = [];
-        this.leftData = [];
-      } else {
-        if (!this.dataR.length) return;
-        this.dataL = [...this.dataL, ...this.dataR];
-        this.dataR = [];
-        this.rightData = [];
-      }
+    handleRight(e) {
+      this.type = 2;
     },
-    //添加部分或单个数据
-    handlePartData(direction) {
-      if (direction === "left") {
-        if (!this.dataL.length) return;
-        this.dataR = [...this.dataR, ...this.leftData];
-        this.dataL.forEach((k, d) => {
-          this.leftData.forEach((e) => {
-            if (e == k) {
-              this.dataL.splice(d, 1);
-              this.leftData = [];
-              return;
-            }
-          });
-        });
-      } else {
-        if (!this.dataL.length) return;
-        this.dataL = [...this.dataL, ...this.rightData];
-        this.dataR.forEach((k, d) => {
-          this.rightData.forEach((e) => {
-            if (e == k) {
-              this.dataR.splice(d, 1);
-              this.rightData = [];
-              return;
-            }
-          });
-        });
-      }
+    handleAllAdd() {
+      this.dataR = this.dataL;
     },
-    //删除全部数据
-    handleAllDelete(direction) {
-      if (direction === "left") {
-        if (!this.dataL.length) return;
-        this.dataL = [];
-        this.leftData = [];
-      } else {
-        if (!this.dataR.length) return;
-        this.dataR = [];
-        this.rightData = [];
-      }
+    handleAllDelete() {
+      this.dataR = [];
     },
-    //删除部分或单个数据
-    handlePartDelete(direction) {
-      if (direction === "left") {
-        this.dataL.forEach((k, d) => {
-          this.leftData.forEach((e) => {
-            if (e == k) {
-              this.dataL.splice(d, 1);
-              this.leftData = [];
-              return;
-            }
-          });
-        });
-      } else {
-        this.dataR.forEach((k, d) => {
-          this.rightData.forEach((e) => {
-            if (e == k) {
-              this.dataR.splice(d, 1);
-              this.rightData = [];
-              return;
+    handleAdd() {
+      if (this.type == 1) {
+        for (let i = 0; i < this.dataL.length; i++) {
+          for (let k = 0; k < this.leftData.length; k++) {
+            if (this.dataL[i].id == this.leftData[k]) {
+              this.dataR = [...new Set([this.dataL[i], ...this.dataR])];
             }
-          });
-        });
+          }
+        }
+        this.leftData = [];
       }
     },
-    // 判断能操作那边框
-    handleJudge(type) {
-      if (this.leftDisabled) {
-        // 左边框功能操作
-        this.hanleType(type, "left");
-      } else {
-        // 右边框功能操作
-        this.hanleType(type, "right");
+    handleDelete() {
+      if (this.type == 2) {
+        for (let i = 0; i < this.dataR.length; i++) {
+          for (let k = 0; k < this.rightData.length; k++) {
+            if (this.dataR[i].id == this.rightData[k]) {
+              this.dataR.splice(i, 1);
+            }
+          }
+        }
       }
     },
-    // 获取事件类型
-    hanleType(type, direction) {
-      switch (type) {
-        case "AddAll":
-          this.handleAllData(direction);
-          break;
-        case "AddPart":
-          this.handlePartData(direction);
-          break;
-        case "DeleteAll":
-          this.handleAllDelete(direction);
-          break;
-        case "DeletePart":
-          this.handlePartDelete(direction);
-          break;
-      }
+    handleSubmit() {
+      this.$emit("handleAddPolicy", this.dataR);
     },
   },
 };
@@ -262,7 +211,10 @@ export default {
     margin: 20px 20px 0 20px;
   }
   .left_box {
-    width: 430px;
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+    width: 440px;
     height: 450px;
     border: 1px solid #eee;
     &_flex {
@@ -275,7 +227,7 @@ export default {
     }
   }
   .right_box {
-    width: 430px;
+    width: 440px;
     height: 450px;
     border: 1px solid #eee;
     &_flex {

+ 411 - 189
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>
-              </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-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-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%">
+        <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,232 @@
         </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 />
+  <AddCondition v-else-if="isShow == 3 || isShow == 6" :id="id" />
+  <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: "",
+      codeId:'',
+      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 +491,15 @@ export default {
 .select_height {
   width: 100%;
 }
+.import-btn {
+  margin: 0 10px;
+}
+</style>
+
+<style>
+.header {
+  display: flex;
+  height: 50px;
+  align-items: center;
+}
 </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>