Ver Fonte

Merge branch 'feature/Feature-copy' into develop

howie há 2 anos atrás
pai
commit
ec5a7a00c5

+ 246 - 246
src/api/policy_list.js

@@ -1,61 +1,58 @@
-import request from "@/utils/request";
+import request from '@/utils/request'
 
 // 销售政策
 export function getList(params) {
   return request({
-    url: "/policy/list",
-    method: "get",
-    params,
-  });
+    url: '/policy/list',
+    method: 'get',
+    params
+  })
 }
-//新增政策
+// 新增政策
 export function addPoliy(params) {
   return request({
-    url: "/policy/add",
-    method: "post",
-    data: params,
-  });
+    url: '/policy/add',
+    method: 'post',
+    data: params
+  })
 }
-//新增政策条件
+// 新增政策条件
 
 export function addPoliyCondition(params) {
   return request({
-    url: "/policy/condition/add",
-    method: "post",
-    data: params,
-  });
+    url: '/policy/condition/add',
+    method: 'post',
+    data: params
+  })
 }
-//政策条件列表
+// 政策条件列表
 export function getConditionList(params) {
   return request({
-    url: "/policy/condition/list",
-    method: "get",
-    params,
-  });
+    url: '/policy/condition/list',
+    method: 'get',
+    params
+  })
 }
 
-//克隆
+// 克隆
 export function cloneList(params) {
   return request({
-    url: "/policy/material/clone",
-    method: "post",
-    params,
-  });
+    url: '/policy/material/clone',
+    method: 'post',
+    params
+  })
 }
 
-
-//弃审
+// 弃审
 export function setAbandon(params) {
   return request({
-    url: "/policy/abandon",
-    method: "post",
-    params,
-  });
+    url: '/policy/abandon',
+    method: 'post',
+    params
+  })
 }
 
-
-
-//物料列表
+// 物料列表
 export function getK3List(params) {
   return request({
     url: '/k3/material/list',
@@ -64,396 +61,399 @@ export function getK3List(params) {
   })
 }
 
-
 // 现金钱包(非返利钱包)
 export function getNoRebateWalletList(params) {
   return request({
-    url: "/wallet/list",
-    method: "get",
-    params,
-  });
+    url: '/wallet/list',
+    method: 'get',
+    params
+  })
 }
 
-
-//政策货品-保存(不传id新增,传id修改)
+// 政策货品-保存(不传id新增,传id修改)
 export function savePolicy(params) {
   return request({
-    url: "/policy/material/save",
-    method: "post",
-    data: params,
-  });
+    url: '/policy/material/save',
+    method: 'post',
+    data: params
+  })
 }
 
-
 export function updatePolicy(params) {
   return request({
-    url: "/policy/update",
-    method: "post",
-    data: params,
-  });
+    url: '/policy/update',
+    method: 'post',
+    data: params
+  })
 }
 
 export function deletePolicy(params) {
   return request({
-    url: "/policy/delete",
-    method: "post",
-    params,
-  });
+    url: '/policy/delete',
+    method: 'post',
+    params
+  })
 }
 
-//修改条件
+// 修改条件
 export function updateCondition(params) {
   return request({
-    url: "/policy/condition/update",
-    method: "post",
-    params,
-  });
+    url: '/policy/condition/update',
+    method: 'post',
+    params
+  })
 }
 
 export function getConditionMaterialDetail(params) {
   return request({
-    url: "/policy/condition/detail",
-    method: "get",
-    params,
-  });
+    url: '/policy/condition/detail',
+    method: 'get',
+    params
+  })
 }
-//政策条件的机型列表
+// 政策条件的机型列表
 export function getConditionMaterialList(params) {
   return request({
-    url: "/policy/condition/material/list",
-    method: "get",
-    params,
-  });
+    url: '/policy/condition/material/list',
+    method: 'get',
+    params
+  })
 }
-//经销商api
+// 经销商api
 
 export function getCrList(params) {
   return request({
-    url: "/customer/list",
-    method: "get",
-    params,
-  });
+    url: '/customer/list',
+    method: 'get',
+    params
+  })
 }
 
-//政策销售商列表
+// 政策销售商列表
 export function getCustomerList(params) {
   return request({
-    url: "/policy/customer/list",
-    method: "get",
-    params,
-  });
+    url: '/policy/customer/list',
+    method: 'get',
+    params
+  })
 }
-//获取销售政策编号
+// 获取销售政策编号
 export function getId(params) {
   return request({
-    url: "/policy/id",
-    method: "get",
-    params,
-  });
+    url: '/policy/id',
+    method: 'get',
+    params
+  })
 }
 
 export function deleteCondition(params) {
   return request({
-    url: "/policy/condition/delete",
-    method: "post",
-    params,
-  });
+    url: '/policy/condition/delete',
+    method: 'post',
+    params
+  })
 }
 export function toExamine(params) {
   return request({
-    url: "/policy/examine",
-    method: "post",
-    params,
-  });
+    url: '/policy/examine',
+    method: 'post',
+    params
+  })
 }
-//导入政策货品
+// 导入政策货品
 // /policy/material/import
 
-//政策货品列表
+// 政策货品列表
 export function getMaterialList(params) {
   return request({
-    url: "/policy/material/list",
-    method: "get",
-    params,
-  });
+    url: '/policy/material/list',
+    method: 'get',
+    params
+  })
 }
-//提审政策
+// 提审政策
 export function getpolicySubmit(params) {
   return request({
-    url: "/policy/policy/submit",
-    method: "post",
-    params,
-  });
+    url: '/policy/policy/submit',
+    method: 'post',
+    params
+  })
 }
 
-//删除政策货品
+// 删除政策货品
 
 export function deleteMaterialPolicy(params) {
   return request({
-    url: "/policy/material/delete",
-    method: "post",
-    params,
-  });
+    url: '/policy/material/delete',
+    method: 'post',
+    params
+  })
 }
 
-//获取经销商详情
+// 获取经销商详情
 export function getPolicyDetail(params) {
   return request({
-    url: "/policy/detail",
-    method: "get",
-    params,
-  });
+    url: '/policy/detail',
+    method: 'get',
+    params
+  })
 }
 
 // 对应经销商
 
 export function getCustomerlist(params) {
   return request({
-    url: "/policy/customer_count/list",
-    method: "get",
-    params,
-  });
+    url: '/policy/customer_count/list',
+    method: 'get',
+    params
+  })
 }
 
 export function eidtBatch(params) {
   return request({
-    url: "/policy/customer_count/batch",
-    method: "post",
-    params,
-  });
+    url: '/policy/customer_count/batch',
+    method: 'post',
+    params
+  })
 }
 
-//销售类型
+// 销售类型
 
 export function getTypeList(params) {
   return request({
-    url: "/sale/type/list",
-    method: "get",
-    params,
-  });
+    url: '/sale/type/list',
+    method: 'get',
+    params
+  })
 }
 
 export function DeleteData(params) {
   return request({
-    url: "/policy/material/delete",
-    method: "psot",
-    params,
-  });
+    url: '/policy/material/delete',
+    method: 'psot',
+    params
+  })
 }
 
 export function addData(params) {
   return request({
-    url: "/sale/type/add",
-    method: "post",
-    data: params,
-  });
+    url: '/sale/type/add',
+    method: 'post',
+    data: params
+  })
 }
 
 export function delTypeData(params) {
   return request({
-    url: "/sale/type/delete",
-    method: "post",
-    params,
-  });
+    url: '/sale/type/delete',
+    method: 'post',
+    params
+  })
 }
 
 export function getDetail(params) {
   return request({
-    url: "/sale/type/detail",
-    method: "post",
-    data: params,
-  });
+    url: '/sale/type/detail',
+    method: 'post',
+    data: params
+  })
 }
 
 export function updateType(params) {
   return request({
-    url: "/sale/type/update",
-    method: "post",
-    data: params,
-  });
+    url: '/sale/type/update',
+    method: 'post',
+    data: params
+  })
 }
 
 // 返利钱包列表
 
 export function getWalletList(params) {
   return request({
-    url: "/wallet/rebate/list",
-    method: "get",
-    params,
-  });
+    url: '/wallet/rebate/list',
+    method: 'get',
+    params
+  })
 }
 
 export function addWallet(params) {
   return request({
-    url: "/wallet/add",
-    method: "post",
-    data: params,
-  });
+    url: '/wallet/add',
+    method: 'post',
+    data: params
+  })
 }
 
 export function getWalletDetail(params) {
   return request({
-    url: "/wallet/rebate/detail",
-    method: "get",
-    params,
-  });
+    url: '/wallet/rebate/detail',
+    method: 'get',
+    params
+  })
 }
 
 export function updateWallet(params) {
   return request({
-    url: "/wallet/update",
-    method: "post",
-    data: params,
-  });
+    url: '/wallet/update',
+    method: 'post',
+    data: params
+  })
 }
 
 // 销售品类
 export function getDictList(params) {
   return request({
-    url: "/common/dict/list",
-    method: "get",
-    params,
-  });
+    url: '/common/dict/list',
+    method: 'get',
+    params
+  })
 }
 
 // 产品类别
 export function getProductList(params) {
   return request({
-    url: "/product-category/list",
-    method: "get",
-    params,
-  });
+    url: '/product-category/list',
+    method: 'get',
+    params
+  })
 }
 
-//政策-作废
+// 政策-作废
 export function cancelPolicy(params) {
   return request({
-    url: "/policy/cancel",
-    method: "post",
-    params,
-  });
+    url: '/policy/cancel',
+    method: 'post',
+    params
+  })
 }
 
-
-//获取轮播图列表
+// 获取轮播图列表
 export function getImgCarouseList(params) {
   return request({
-    url: "/record/list",
-    method: "get",
-    params,
-  });
+    url: '/record/list',
+    method: 'get',
+    params
+  })
 }
 
-//轮播图显示与隐藏
+// 轮播图显示与隐藏
 export function handleImgIsShow(params) {
   return request({
-    url: "/record/updateImgStatus",
-    method: "post",
-    params,
-  });
+    url: '/record/updateImgStatus',
+    method: 'post',
+    params
+  })
 }
 
-//增加轮播图
+// 增加轮播图
 export function addImgCarousel(params) {
   return request({
-    url: "/record/carousel/add",
-    method: "post",
-    data: params,
-  });
+    url: '/record/carousel/add',
+    method: 'post',
+    data: params
+  })
 }
 
-//修改轮播图
+// 修改轮播图
 export function editImgCarousel(params) {
   return request({
-    url: "/record/update",
-    method: "post",
-    data: params,
-  });
+    url: '/record/update',
+    method: 'post',
+    data: params
+  })
 }
 
-//批量删除轮播图
+// 批量删除轮播图
 export function delImgData(params) {
   return request({
-    url: "/record/delete",
-    method: "post",
-    params,
-  });
+    url: '/record/delete',
+    method: 'post',
+    params
+  })
 }
 
-//添加公司信息
+// 添加公司信息
 export function addCompany(params) {
   return request({
-    url: "/record/company/add",
-    method: "post",
-    data: params,
-  });
+    url: '/record/company/add',
+    method: 'post',
+    data: params
+  })
 }
 
-//获取公司数据
+// 获取公司数据
 export function getCompanyList(params) {
   return request({
-    url: "/record/company/list",
-    method: "get",
-    params,
-  });
+    url: '/record/company/list',
+    method: 'get',
+    params
+  })
 }
-//返利钱包销售类型-列表
+// 返利钱包销售类型-列表
 export function getWalletRebateSaletypelist(params) {
   return request({
-    url: "/wallet/rebate_saletype/list",
-    method: "get",
-    params,
-  });
+    url: '/wallet/rebate_saletype/list',
+    method: 'get',
+    params
+  })
 }
-//返利钱包销售类型-新增
+// 返利钱包销售类型-新增
 export function getWalletRebateSaletypeAdd(data) {
   return request({
-    url: "/wallet/rebate_saletype/add",
-    method: "POST",
-    data,
-  });
+    url: '/wallet/rebate_saletype/add',
+    method: 'POST',
+    data
+  })
 }
-//返利钱包销售类型-详情
+// 返利钱包销售类型-详情
 export function getWalletRebateSaletypeDetail(params) {
   return request({
-    url: "/wallet/rebate_saletype/detail",
-    method: "get",
-    params,
-  });
+    url: '/wallet/rebate_saletype/detail',
+    method: 'get',
+    params
+  })
 }
 
-
-//返利钱包列表
+// 返利钱包列表
 export function getWalletRebateList(params) {
   return request({
-    url: "/wallet/rebate/list",
-    method: "get",
-    params,
-  });
+    url: '/wallet/rebate/list',
+    method: 'get',
+    params
+  })
 }
-//返利钱包销售类型-删除
+// 返利钱包销售类型-删除
 export function getWalletRebateSaletypeDelete(params) {
   return request({
-    url: "/wallet/rebate_saletype/delete",
-    method: "post",
-    params,
-  });
+    url: '/wallet/rebate_saletype/delete',
+    method: 'post',
+    params
+  })
 }
-//返利钱包销售类型-修改
+// 返利钱包销售类型-修改
 export function getWalletRebateSaletypeUpdate(data) {
   return request({
-    url: "/wallet/rebate_saletype/update",
-    method: "post",
-    data,
-  });
+    url: '/wallet/rebate_saletype/update',
+    method: 'post',
+    data
+  })
 }
 
 // 经销商购买上限-列表
-
 export function getPolicyList(params) {
   return request({
-    url: "/policy/limit/list",
-    method: "get",
-    params,
-  });
+    url: '/policy/limit/list',
+    method: 'get',
+    params
+  })
 }
+// 政策机型-启用/作废
+export function setStauts(params) {
+  return request({
+    url: '/policy/material/status',
+    method: 'post',
+    params
+  })
+}
+

+ 335 - 307
src/views/sales_policy/components/AddPolicy.vue

@@ -56,7 +56,9 @@
               <el-col :xs="24" :ms="12" :lg="12">
                 <el-form-item label="" prop="type">
                   <div style="height: 30px">
-                    <el-checkbox v-model="searchForm.isFullRebate">返利使用金额需满额使用</el-checkbox>
+                    <el-checkbox
+                      v-model="searchForm.isFullRebate"
+                    >返利使用金额需满额使用</el-checkbox>
                   </div>
                 </el-form-item>
               </el-col>
@@ -85,8 +87,7 @@
                     placeholder="生效日期"
                     default-time="00:00:00"
                     value-format="yyyy-MM-dd HH:mm:ss"
-                  /> </el-form-item
-              ></el-col>
+                  /> </el-form-item></el-col>
               <el-col :xs="24" :ms="12" :lg="12">
                 <el-form-item label="失效日期" prop="endTime">
                   <el-date-picker
@@ -95,8 +96,7 @@
                     placeholder="失效日期"
                     default-time="00:00:00"
                     value-format="yyyy-MM-dd HH:mm:ss"
-                  /> </el-form-item
-              ></el-col>
+                  /> </el-form-item></el-col>
               <el-col :xs="24" :ms="24" :lg="24">
                 <el-form-item label="表头备注" prop="remark">
                   <el-input
@@ -129,26 +129,23 @@
                     :file-list="importFileList"
                     :show-file-list="false"
                   >
-                    <el-button type="primary" size="mini"
-                      >导入货品价格表</el-button
-                    >
+                    <el-button
+                      type="primary"
+                      size="mini"
+                    >导入货品价格表</el-button>
                   </el-upload>
                 </template>
 
                 <el-button
                   type="primary"
                   size="mini"
-                  @click="hanleDownloadFiles"
-                  >下载模板</el-button
-                >
+                  @click="handleDownloadFiles"
+                >下载模板</el-button>
                 <el-button
                   type="primary"
                   size="mini"
                   @click="exportGoods"
-                >导出货品</el-button
-                >
-
-
+                >导出货品</el-button>
               </el-col>
             </el-row>
             <el-divider />
@@ -163,7 +160,6 @@
             fit
             highlight-current-row
             stripe
-
           >
             <el-table-column
               type="index"
@@ -175,11 +171,10 @@
               prop="materialNumber"
               label="物料编码"
               align="left"
-
               min-width="200"
             >
               <template slot-scope="scope">
- <CopyButton :copyText="scope.row.materialNumber" />
+                <CopyButton :copy-text="scope.row.materialNumber" />
 
                 <el-select
                   v-model="scope.row.materialNumber"
@@ -187,10 +182,9 @@
                   :remote-method="(query) => remoteMethod(query, 'number')"
                   filterable
                   remote
-                   style="width: 85%;"
+                  style="width: 85%"
                   @change="handleK3List($event, scope.row)"
                 >
-
                   <el-option
                     v-for="(item, index) in k3List"
                     :key="index"
@@ -208,20 +202,18 @@
               align="left"
             >
               <template slot-scope="scope">
-                <CopyButton :copyText="scope.row.materialName" />
-                <span>{{scope.row.materialName}}</span>
+                <CopyButton :copy-text="scope.row.materialName" />
+                <span>{{ scope.row.materialName }}</span>
               </template>
             </el-table-column>
             <el-table-column
-
               min-width="300"
               prop="specification"
               label="规格型号"
               align="left"
             >
               <template slot-scope="scope">
-
-             <CopyButton :copyText="scope.row.specification" />
+                <CopyButton :copy-text="scope.row.specification" />
 
                 <el-select
                   v-model="scope.row.specification"
@@ -230,11 +222,10 @@
                     (query) => remoteMethod(query, 'specification')
                   "
                   filterable
-                   style="width: 85%;"
+                  style="width: 85%"
                   remote
                   @change="handleK3List($event, scope.row)"
                 >
-
                   <el-option
                     v-for="(item, index) in k3List"
                     :key="index"
@@ -242,7 +233,6 @@
                     :value="item.id"
                   />
                 </el-select>
-
               </template>
             </el-table-column>
             <el-table-column
@@ -279,11 +269,12 @@
             <el-table-column prop="discAmount" label="格力折扣" align="right">
               <template slot-scope="scope">
                 <el-input
-                  class="yinput"
                   v-model.number="scope.row.discAmount"
-                  type="number" @mousewheel.native.prevent
+                  class="yinput"
+                  type="number"
                   placeholder="请输入格力折扣"
                   size="mini"
+                  @mousewheel.native.prevent
                 />
               </template>
             </el-table-column>
@@ -296,11 +287,12 @@
             >
               <template slot-scope="scope">
                 <el-input
-                  class="yinput"
                   v-model.number="scope.row.price"
-                  type="number" @mousewheel.native.prevent
+                  class="yinput"
+                  type="number"
                   placeholder="请输入单价"
                   size="mini"
+                  @mousewheel.native.prevent
                 />
               </template>
             </el-table-column>
@@ -365,20 +357,48 @@
             </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="handleDelete(scope.row.id, scope.$index)"-->
+                <!--                >-->
+                <!--                  <el-button-->
+                <!--                    slot="reference"-->
+                <!--                    type="text"-->
+                <!--                    class="textColor el-popover-left"-->
+                <!--                    >删除</el-button-->
+                <!--                  >-->
+                <!--                </el-popconfirm>-->
                 <el-popconfirm
                   confirm-button-text="好的"
                   cancel-button-text="不用了"
                   icon="el-icon-info"
                   icon-color="red"
-                  title="内容确定删除吗?"
-                  @onConfirm="hanleDelete(scope.row.id, scope.$index)"
+                  title="启用吗?"
+                  @onConfirm="handleStatus(scope.row.id, true)"
                 >
                   <el-button
                     slot="reference"
                     type="text"
                     class="textColor el-popover-left"
-                    >删除</el-button
-                  >
+                  >启用</el-button>
+                </el-popconfirm>
+                <el-popconfirm
+                  confirm-button-text="好的"
+                  cancel-button-text="不用了"
+                  icon="el-icon-info"
+                  icon-color="red"
+                  title="作废吗?"
+                  @onConfirm="handleStatus(scope.row.id, false)"
+                >
+                  <el-button
+                    slot="reference"
+                    type="text"
+                    class="textColor el-popover-left"
+                  >作废</el-button>
                 </el-popconfirm>
               </template>
             </el-table-column>
@@ -392,12 +412,16 @@
             "
           >
             <div>
-              <el-button type="primary" size="mini" @click="handleNewInfo"
-                >添加</el-button
-              >
-              <el-button type="primary" size="mini" @click="handleSave"
-                >保存</el-button
-              >
+              <el-button
+                type="primary"
+                size="mini"
+                @click="handleNewInfo"
+              >添加</el-button>
+              <el-button
+                type="primary"
+                size="mini"
+                @click="handleSave"
+              >保存</el-button>
             </div>
             <!--            <el-pagination-->
             <!--              :current-page="dcurrentPage"-->
@@ -417,10 +441,11 @@
                 <h4 style="display: inline-block; margin-right: 20px">
                   条件信息
                 </h4>
-                <el-button type="primary" size="mini" @click="isCondition = 1"
-                  >添加</el-button
-                ></el-col
-              >
+                <el-button
+                  type="primary"
+                  size="mini"
+                  @click="isCondition = 1"
+                >添加</el-button></el-col>
             </el-row>
             <el-divider />
           </el-row>
@@ -464,14 +489,12 @@
                     scope.row.fang = false;
                     conditName = scope.row.name;
                   "
-                  >编辑</el-button
-                >
+                >编辑</el-button>
                 <el-button
                   type="text"
                   size="mini"
                   @click="handleCondition(scope.row.id, scope.$index)"
-                  >删除</el-button
-                >
+                >删除</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -487,13 +510,13 @@
             <el-divider />
           </el-row>
           <TabelTransfer
+            v-if="searchForm.code"
+            :code="searchForm.code"
             @handlEditPolicy="handleAddPolicy"
             @handleReset="handleReset"
-             v-if="searchForm.code" :code="searchForm.code"
           />
           <!--          <Transfer @handleAddPolicy="handleAddPolicy" @handleReset="handleReset" />-->
         </div>
-
       </div>
     </div>
     <AddCondition
@@ -517,7 +540,9 @@ import {
   getTypeList,
   getWalletRebateList,
   savePolicy,
+  setStauts,
   updateCondition
+
 } from '@/api/policy_list'
 import { downloadFiles, handleImport } from '@/utils/util'
 // import Transfer from './Transfer'
@@ -527,13 +552,11 @@ import ImageUpload from '@/components/Common/image-upload.vue'
 
 export default {
   directives: {
-    "el-select-loadmore": {
+    'el-select-loadmore': {
       bind(el, binding) {
         // 获取element-ui定义好的scroll盒⼦
-        const SELECTWRAP_DOM = el.querySelector(
-          ".el-table__body-wrapper"
-        );
-        SELECTWRAP_DOM.addEventListener("scroll", function () {
+        const SELECTWRAP_DOM = el.querySelector('.el-table__body-wrapper')
+        SELECTWRAP_DOM.addEventListener('scroll', function() {
           /**
            * scrollHeight 获取元素内容⾼度(只读)
            * scrollTop 获取或者设置元素的偏移值,常⽤于, 计算滚动条的位置, 当⼀个元素的容器没有产⽣垂直⽅向的滚动条, 那它的scrollTop的值默认为0.
@@ -542,32 +565,32 @@ export default {
            * ele.scrollHeight - ele.scrollTop === ele.clientHeight;
            */
           const condition =
-            this.scrollHeight - this.scrollTop <= this.clientHeight;
+            this.scrollHeight - this.scrollTop <= this.clientHeight
           if (condition) {
-            binding.value();
+            binding.value()
           }
-        });
-      },
-    },
+        })
+      }
+    }
   },
   mixins: [Minxin],
   data() {
     return {
       fang: false,
-      input: "",
-      baseURL: "",
+      input: '',
+      baseURL: '',
       isCondition: 0,
       searchForm: {
-        code: "",
-        endTime: "",
-        imgSrc: "",
-        remark: "",
-        startTime: "",
-        title: "",
-        mainId: "",
-        mainName: "",
-        type: "",
-        isFullRebate: false,
+        code: '',
+        endTime: '',
+        imgSrc: '',
+        remark: '',
+        startTime: '',
+        title: '',
+        mainId: '',
+        mainName: '',
+        type: '',
+        isFullRebate: false
       },
       dataList: [],
       addList: [],
@@ -578,20 +601,20 @@ export default {
       importFileList: [],
       fileList: [],
       options: {},
-      value: "",
+      value: '',
       typeList: [],
       walletList: [],
       typeOptions: [
         {
-          value: "PROVISION",
-          label: "配提",
+          value: 'PROVISION',
+          label: '配提'
         },
         {
-          value: "LIMIT",
-          label: "限量",
-        },
+          value: 'LIMIT',
+          label: '限量'
+        }
       ],
-      conditName: "",
+      conditName: '',
       conditionList: [],
       dictList: [],
       k3List: [],
@@ -599,20 +622,20 @@ export default {
       sleectBox: { currentPage: 1 },
       dpageSize: 10,
       dcurrentPage: 1,
-      rebateList: [],
-    };
+      rebateList: []
+    }
   },
   computed: {
     ...mapGetters({
-      comCode: "code",
-    }),
+      comCode: 'code'
+    })
   },
 
   mounted() {
-    this.searchForm.code = this.comCode;
+    this.searchForm.code = this.comCode
   },
   updated() {
-    this.searchForm.code = this.comCode;
+    this.searchForm.code = this.comCode
   },
   created() {
     // console.log(this.$store.code);
@@ -621,417 +644,422 @@ export default {
     // }
   },
   methods: {
-    ...mapMutations("sales", ["initData"]),
+    ...mapMutations('sales', ['initData']),
+    handleStatus(id, status) {
+      setStauts({ policyMaterialId: id, status }).then((res) => {
+        this.handletwoList()
+        this.$successMsg(status ? '启用' : '作废')
+      })
+    },
     // 下载excel模板
-    hanleDownloadFiles() {
-      downloadFiles("policy/download");
+    handleDownloadFiles() {
+      downloadFiles('policy/download')
     },
-    exportGoods(){
-      downloadFiles("policy/material/export",{policyId: this.searchForm.code});
+    exportGoods() {
+      downloadFiles('policy/material/export', {
+        policyId: this.searchForm.code
+      })
     },
     handleCondition(id, index) {
       deleteCondition({ id }).then((res) => {
-        this.conditionList.splice(index, 1);
+        this.conditionList.splice(index, 1)
         Object.assign(
           this.$children[9].$data,
           this.$children[9].$options.data()
-        );
-        this.$successMsg("删除成功");
-      });
+        )
+        this.$successMsg('删除成功')
+      })
     },
     // loadmore() {
     //   this.sleectBox.currentPage++;
     //   this.getK3List();
     // },
-    loadmore2(){
-       if(this.dataList.length<this.listTotal){
-        let total = Math.floor(this.listTotal/10)
-          if (this.dcurrentPage<=total) {
-            this.dcurrentPage++
-             this.handletwoList()
-          }
+    loadmore2() {
+      if (this.dataList.length < this.listTotal) {
+        const total = Math.floor(this.listTotal / 10)
+        if (this.dcurrentPage <= total) {
+          this.dcurrentPage++
+          this.handletwoList()
         }
+      }
     },
     getK3List() {
       getK3List({
         pageNum: this.sleectBox.currentPage,
         pageSize: 10,
-        keyword: "",
+        keyword: ''
       }).then((res) => {
-        this.k3List = [...this.k3List, ...res.data.records];
-      });
+        this.k3List = [...this.k3List, ...res.data.records]
+      })
     },
     remoteMethod(query, type) {
-      console.log(query, type);
-      if (query !== "") {
+      console.log(query, type)
+      if (query !== '') {
         getK3List({
           pageNum: 1,
           pageSize: 100,
-          keyword: "",
-          number: type === "number" ? query : "",
-          oldNumber: "",
-          specification: type === "specification" ? query : "",
+          keyword: '',
+          number: type === 'number' ? query : '',
+          oldNumber: '',
+          specification: type === 'specification' ? query : ''
         }).then((res) => {
-          this.k3List = res.data.records;
-        });
+          this.k3List = res.data.records
+        })
       } else {
-        this.sleectBox.currentPage = 1;
-        this.getK3List();
+        this.sleectBox.currentPage = 1
+        this.getK3List()
       }
     },
-   async  getCommonApi() {
+    async getCommonApi() {
       // this.getK3List();
       // 非返利钱包
-       const noRebateWalletData =  await  getNoRebateWalletList({ walletName: "" })
-        this.NoRebateWalletList = noRebateWalletData.data;
+      const noRebateWalletData = await getNoRebateWalletList({
+        walletName: ''
+      })
+      this.NoRebateWalletList = noRebateWalletData.data
 
-     const walletRebateData  = await getWalletRebateList({
+      const walletRebateData = await getWalletRebateList({
         pageNum: 1,
         pageSize: -2,
-        name: "",
-        status: true,
+        name: '',
+        status: true
       })
-      this.rebateList = walletRebateData.data.records;
+      this.rebateList = walletRebateData.data.records
 
       const params = {
         pageNum: 1,
         pageSize: -1,
-        saleCode: "",
-        saleName: "",
-        status: "",
-      };
+        saleCode: '',
+        saleName: '',
+        status: ''
+      }
 
       // 获取销售类型列表
-      const  typeData = await getTypeList(params)
-        this.typeList = typeData.data.records;
-
+      const typeData = await getTypeList(params)
+      this.typeList = typeData.data.records
     },
     handleSalesType(e, row) {
       const item = this.typeList.filter((k) => {
-        return k.id === e;
-      })[0];
-      const linshi = [];
-      const rebateList = [];
+        return k.id === e
+      })[0]
+      const linshi = []
+      const rebateList = []
       this.rebateList.forEach((k) => {
         k.saleTypes.forEach((j) => {
           if (!linshi.includes(j.saleTypeId) && j.saleTypeId === e) {
-            rebateList.push(k);
-            linshi.push(j.saleTypeId);
+            rebateList.push(k)
+            linshi.push(j.saleTypeId)
           }
-        });
-      });
+        })
+      })
       if (rebateList.length) {
-        this.$set(row, "rebateWalletIds", [
-          ...new Set([...row.rebateWalletIds, rebateList[0].walletRebateId]),
-        ]);
+        this.$set(row, 'rebateWalletIds', [
+          ...new Set([...row.rebateWalletIds, rebateList[0].walletRebateId])
+        ])
       }
 
-      this.$set(row, "saleTypeCode", item.saleCode);
-      this.$set(row, "saleTypeName", item.saleName);
+      this.$set(row, 'saleTypeCode', item.saleCode)
+      this.$set(row, 'saleTypeName', item.saleName)
       // this.$set(row,'saleTypeId',item.id)
     },
     // 修改条件名称
     handleConditionName(row) {
-      console.log(row.name);
+      console.log(row.name)
       if (this.conditName !== row.name) {
         updateCondition({ id: row.id, name: row.name }).then((res) => {
-          this.$successMsg("修改成功");
-        });
+          this.$successMsg('修改成功')
+        })
       }
-      row.fang = true;
+      row.fang = true
     },
     // 提交信息
     handleSubmitCon() {
       const params = {
-        policyId: this.comCode,
-      };
+        policyId: this.comCode
+      }
       // 获取条件政策
       getConditionList(params).then((res) => {
         for (let i = 0; i < res.data.length; i++) {
-          res.data[i].fang = true;
+          res.data[i].fang = true
         }
-        this.conditionList = res.data;
-      });
+        this.conditionList = res.data
+      })
     },
     // 视图部分已注释,废弃的功能 fucn
     handelStop() {
       if (this.searchForm.mainId) {
-        this.fang = true;
+        this.fang = true
       } else {
-        this.$errorMsg("请选择产品类别");
+        this.$errorMsg('请选择产品类别')
       }
     },
     // 导入
     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);
+      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)
       // formData.append("mainId", this.searchForm.mainId);
-      const result = await handleImport("policy/material/import", formData);
-      this.importLoading = false;
-      this.importFileList = [];
+      const result = await handleImport('policy/material/import', formData)
+      this.importLoading = false
+      this.importFileList = []
       if (result.code === 200) {
-        this.$alert(result.message, "导入成功", {
-          confirmButtonText: "确定",
-        });
-        this.dataList = [];
-        this.listTotal = 0;
-        this.sleectBox.currentPage = 1;
+        this.$alert(result.message, '导入成功', {
+          confirmButtonText: '确定'
+        })
+        this.dataList = []
+        this.listTotal = 0
+        this.sleectBox.currentPage = 1
         this.dcurrentPage = 1
-        this.handletwoList();
+        this.handletwoList()
       } else {
-        this.$alert(result.message, "导入失败", {
-          confirmButtonText: "确定",
-        });
+        this.$alert(result.message, '导入失败', {
+          confirmButtonText: '确定'
+        })
       }
     },
-   async getList() {
-      await this.getCommonApi();
+    async getList() {
+      await this.getCommonApi()
       if (this.$parent.isFlag) {
-       await  this.handletwoList();
+        await this.handletwoList()
       }
     },
     // 更改每页数量
     handleSizeChange1(val) {
-      this.pageSize = val;
-      this.currentPage = 1;
-      this.handletwoList();
+      this.pageSize = val
+      this.currentPage = 1
+      this.handletwoList()
     },
     // 更改当前页
     handleCurrentChange1(val) {
-      this.currentPage = val;
-      this.handletwoList();
+      this.currentPage = val
+      this.handletwoList()
     },
 
     // 更改每页数量
     handleSizeChange2(val) {
-      this.dpageSize = val;
-      this.dcurrentPage = 1;
+      this.dpageSize = val
+      this.dcurrentPage = 1
 
-      this.handletwoList();
+      this.handletwoList()
     },
     // 更改当前页
     handleCurrentChange2(val) {
-      this.dcurrentPage = val;
-      this.handletwoList();
+      this.dcurrentPage = val
+      this.handletwoList()
     },
     // 获取货品信息
-   async  handletwoList() {
+    async handletwoList() {
       // this.searchForm.type
-      this.listLoading = true;
+      this.listLoading = true
 
       const paramss = {
         pageNum: 1,
         pageSize: -1,
         policyId: this.comCode,
-        saleTypeCode: "",
-      };
+        saleTypeCode: ''
+      }
       try {
-        const {data}  =  await getMaterialList(paramss)
-      this.dataList = data.records
-          data.records.forEach((k) => {
-            k.walletIds = [];
-            k.rebateWalletIds = [];
-            if (!k.specification) {
-              k.materialNumber = k.materialId;
-              k.specification = k.materialId;
-            }
+        const { data } = await getMaterialList(paramss)
+        this.dataList = data.records
+        data.records.forEach((k) => {
+          k.walletIds = []
+          k.rebateWalletIds = []
+          if (!k.specification) {
+            k.materialNumber = k.materialId
+            k.specification = k.materialId
+          }
 
-            for (let i = 0; i < k.walletRelaList.length; i++) {
-              const d =  k.walletRelaList[i];
-              d.id = d.walletId;
-              d.name = d.walletName;
-              if (d.type === "REBATE") {
-                k.rebateWalletIds = [...k.rebateWalletIds, d.walletId];
-              } else {
-                k.walletIds = [...k.walletIds, d.walletId];
-              }
+          for (let i = 0; i < k.walletRelaList.length; i++) {
+            const d = k.walletRelaList[i]
+            d.id = d.walletId
+            d.name = d.walletName
+            if (d.type === 'REBATE') {
+              k.rebateWalletIds = [...k.rebateWalletIds, d.walletId]
+            } else {
+              k.walletIds = [...k.walletIds, d.walletId]
             }
-
-          });
-          this.listTotal = data.total;
-          this.listLoading = false;
+          }
+        })
+        this.listTotal = data.total
+        this.listLoading = false
       } catch (error) {
-          console.error(error);
+        console.error(error)
       }
-
     },
     // 提交审核
-    handleAddPolicy(policyCustomers,region) {
-          console.log(region,'jkjkj')
+    handleAddPolicy(policyCustomers, region) {
+      console.log(region, 'jkjkj')
       if (!this.searchForm.title) {
-        this.$errorMsg("请输入说明");
-        return;
+        this.$errorMsg('请输入说明')
+        return
       }
       if (!this.searchForm.type) {
-        this.$errorMsg("请选择类型");
-        return;
+        this.$errorMsg('请选择类型')
+        return
       }
       if (!this.searchForm.startTime) {
-        this.$errorMsg("请选择生效日期");
-        return;
+        this.$errorMsg('请选择生效日期')
+        return
       }
 
-        const fomrtData = ()=>{
-            var arr = [];
+      const fomrtData = () => {
+        var arr = []
         policyCustomers.forEach((el) => {
           arr.push({
             customerId: el.id,
             customerName: el.name,
             customerNumber: el.number,
-            lastOrderTime: "",
+            lastOrderTime: '',
             limitTakeNum: 0,
             policyId: this.searchForm.code || this.comCode,
-            policyTitle: "",
-            remark: "",
-          });
-        });
+            policyTitle: '',
+            remark: ''
+          })
+        })
         // this.dictList.forEach((k) => {
         //   if (k.dictCode == this.searchForm.mainId) {
         //     this.searchForm.mainName = k.dictValue;
         //   }
         // });
         const params = {
-          adminCompanyId: "",
-          code: "",
+          adminCompanyId: '',
+          code: '',
           customerCount: 0,
-          examineBy: "",
-          examineRemark: "",
-          examineStatus: "",
-          id: "",
+          examineBy: '',
+          examineRemark: '',
+          examineStatus: '',
+          id: '',
           policyCustomers: arr,
-          remark: "",
+          remark: '',
           status: true,
-          title: "",
-          type: "",
+          title: '',
+          type: '',
           ...this.searchForm,
-          flag:region,
-          endTime: this.searchForm.endTime || "2100-01-01 00:00:00",
-          imgSrc: this.fileList.length ? this.fileList[0].url : "",
-        };
-        console.log(this.fileList);
-        addPoliy(params).then((res) => {
-          console.log(res);
-          this.$successMsg("新增成功");
-          this.$parent.getList();
-          this.$parent.isShow = 1;
-        });
+          flag: region,
+          endTime: this.searchForm.endTime || '2100-01-01 00:00:00',
+          imgSrc: this.fileList.length ? this.fileList[0].url : ''
         }
+        console.log(this.fileList)
+        addPoliy(params).then((res) => {
+          console.log(res)
+          this.$successMsg('新增成功')
+          this.$parent.getList()
+          this.$parent.isShow = 1
+        })
+      }
 
-    if (region == 0) {
-      if (policyCustomers.length) {
-        fomrtData()
-         } else {
-        this.$errorMsg("选择经销商 ");
-       }
-      }else{
+      if (region == 0) {
+        if (policyCustomers.length) {
+          fomrtData()
+        } else {
+          this.$errorMsg('选择经销商 ')
+        }
+      } else {
         fomrtData()
       }
-
     },
     // 删除
-    hanleDelete(id, index) {
+    handleDelete(id, index) {
       if (id) {
-        const params = { policyMaterialId: id };
+        const params = { policyMaterialId: id }
         deleteMaterialPolicy(params).then((res) => {
-          this.dataList.splice(index, 1);
-        });
-        return;
+          this.dataList.splice(index, 1)
+        })
+        return
       }
-      this.dataList.splice(index, 1);
+      this.dataList.splice(index, 1)
       // this.listTotal -= 1;
-      this.$successMsg("删除成功");
+      this.$successMsg('删除成功')
     },
     handleNewInfo() {
       // 物料列表
 
       this.dataList.push({
-        id: "",
+        id: '',
         discAmount: 0,
-        materialId: "",
-        materialName: "",
-        materialNumber: "",
+        materialId: '',
+        materialName: '',
+        materialNumber: '',
         policyId: this.comCode,
-        price: "",
-        remark: "",
-        saleTypeCode: "",
-        saleTypeId: "",
-        saleTypeName: "",
-        specification: "",
+        price: '',
+        remark: '',
+        saleTypeCode: '',
+        saleTypeId: '',
+        saleTypeName: '',
+        specification: '',
         rebateWalletIds: [],
         walletIds: [this.NoRebateWalletList[0].id],
-        walletRelaList: [],
-      });
-      this.sleectBox.currentPage = 1;
+        walletRelaList: []
+      })
+      this.sleectBox.currentPage = 1
       // this.listTotal += 1;
       // this.dataList.push(this.addList[this.addList.length-1])
     },
     handleSave() {
       if (!this.dataList.length) {
-        return;
+        return
       }
       for (let i = 0; i < this.dataList.length; i++) {
         if (!this.dataList[i].materialId) {
-          this.$errorMsg("请选择货品");
-          return;
+          this.$errorMsg('请选择货品')
+          return
         }
         if (!this.dataList[i].saleTypeId) {
-          this.$errorMsg("请选择销售类型");
-          return;
+          this.$errorMsg('请选择销售类型')
+          return
         }
 
         if (!this.dataList[i].price) {
-          this.$errorMsg("请输入单价");
-          return;
+          this.$errorMsg('请输入单价')
+          return
         }
         if (!this.dataList[i].walletIds.length) {
-          this.$errorMsg("请选择现金钱包");
-          return;
+          this.$errorMsg('请选择现金钱包')
+          return
         }
       }
 
-
       savePolicy(this.dataList).then((res) => {
-        this.dataList = [];
+        this.dataList = []
         this.dcurrentPage = 1
-        this.sleectBox.currentPage = 1;
-        this.$successMsg("保存成功");
+        this.sleectBox.currentPage = 1
+        this.$successMsg('保存成功')
 
-        this.handletwoList();
-      });
+        this.handletwoList()
+      })
     },
     handleK3List(e, row) {
       const item = this.k3List.filter((k) => {
-        return k.id == e;
-      })[0];
-      this.$set(row, "materialNumber", item.number);
-      this.$set(row, "materialName", item.name);
-      this.$set(row, "specification", item.specification);
-      this.$set(row, "materialId", item.id);
-      this.getK3List();
+        return k.id == e
+      })[0]
+      this.$set(row, 'materialNumber', item.number)
+      this.$set(row, 'materialName', item.name)
+      this.$set(row, 'specification', item.specification)
+      this.$set(row, 'materialId', item.id)
+      this.getK3List()
     },
     handleReset() {
-      Object.assign(this.$data, this.$options.data());
-      this.getCommonApi();
-    },
+      Object.assign(this.$data, this.$options.data())
+      this.getCommonApi()
+    }
   },
   components: {
     TabelTransfer,
     AddCondition,
-    ImageUpload,
-  },
-};
+    ImageUpload
+  }
+}
 </script>
 
 <style lang="scss" scoped>
 h4 {
   margin: 0;
 }
-.yinput{
-  ::v-deep input{
+.yinput {
+  ::v-deep input {
     text-align: right;
   }
 }

+ 356 - 295
src/views/sales_policy/components/editPolicy.vue

@@ -1,13 +1,13 @@
 <template>
   <div>
-    <div class="app-container  mymain-container" v-show="isCondition == 0">
+    <div v-show="isCondition == 0" class="app-container mymain-container">
       <el-header height="50px" class="header">
         <el-page-header
           content="编辑"
           @back="($parent.isShow = 1), ($parent.isFlag = '')"
         />
       </el-header>
-      <div >
+      <div>
         <div class="screen-container">
           <h4>销售政策信息</h4>
           <el-divider />
@@ -57,7 +57,9 @@
               <el-col :xs="24" :ms="12" :lg="12">
                 <el-form-item label="" prop="type">
                   <div style="height: 30px">
-                    <el-checkbox v-model="searchForm.isFullRebate">返利使用金额需满额使用</el-checkbox>
+                    <el-checkbox
+                      v-model="searchForm.isFullRebate"
+                    >返利使用金额需满额使用</el-checkbox>
                   </div>
                 </el-form-item>
               </el-col>
@@ -138,7 +140,7 @@
                 <el-button
                   type="primary"
                   size="mini"
-                  @click="hanleDownloadFiles"
+                  @click="handleDownloadFiles"
                 >下载模板</el-button>
               </el-col>
             </el-row>
@@ -146,221 +148,268 @@
           </el-row>
           <div class="table">
             <!-- v-el-select-loadmore="loadmore2" -->
-          <el-table
-            v-loading="listLoading"
-            :data="dataList"
-            element-loading-text="Loading"
-            max-height="600"
-            border
-            fit
-            highlight-current-row
-            stripe
-
-          >
-            <el-table-column
-              type="index"
-              label="序号"
-              width="50"
-              align="left"
-            />
-            <el-table-column
-
-              min-width="200"
-              prop="materialNumber"
-              label="物料编码"
-              align="left"
-            >
-              <template slot-scope="scope">
-      <CopyButton :copyText="scope.row.materialNumber" />
-                <el-select
-                  v-model="scope.row.materialNumber"
-
-                  size="mini"
-                  :remote-method="(query)=>remoteMethod(query,'number')"
-                  filterable
-                  remote
-                   style="width: 85%;"
-                  @change="handleK3List($event, scope.row)"
-                >
-
-                  <el-option
-                    v-for="item in k3List"
-                    :key="item.id"
-                    :label="item.number"
-                    :value="item.id"
-                  />
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column
-              show-overflow-tooltip
-              min-width="150"
-              prop="materialName"
-              label="产品名称"
-              align="left"
+            <el-table
+              v-loading="listLoading"
+              :data="dataList"
+              element-loading-text="Loading"
+              max-height="600"
+              border
+              fit
+              highlight-current-row
+              stripe
             >
-              <template slot-scope="scope">
-                <CopyButton :copyText="scope.row.materialName" />
-                <span>{{scope.row.materialName}}</span>
-              </template>
-            </el-table-column>
-
-            <el-table-column
-
-              min-width="300"
-              prop="specification"
-              label="规格型号"
-              align="left"
-            >
-              <template slot-scope="scope" >
-             <CopyButton :copyText="scope.row.specification" />
-                <el-select
-                  v-model="scope.row.specification"
-                  size="mini"
-                  :remote-method="(query)=>remoteMethod(query,'specification')"
-                  filterable
-                  remote
-                  style="width: 85%;"
-                  @change="handleK3List($event, scope.row)"
-                >
-
-                  <el-option
-                    v-for="item in k3List"
-                    :key="item.id"
-                    :label="item.specification"
-                    :value="item.id"
-                  />
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column
-              show-overflow-tooltip
-              min-width="150"
-              prop="saleTypeName"
-              label="销售类型"
-              align="left"
-            >
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.saleTypeId"
-                  size="mini"
-                  filterable
-                  @change="handleSalesType($event, scope.row)"
-                >
-                  <el-option
-                    v-for="item in typeList"
-                    :key="item.id"
-                    :label="item.saleName"
-                    :value="item.id"
-                  />
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column
-              show-overflow-tooltip
-              min-width="150"
-              prop="saleTypeCode"
-              label="销售类型编码"
-              align="left"
-            />
+              <el-table-column
+                type="index"
+                label="序号"
+                width="50"
+                align="left"
+              />
+              <el-table-column
+                min-width="200"
+                prop="materialNumber"
+                label="物料编码"
+                align="left"
+              >
+                <template slot-scope="scope">
+                  <CopyButton :copy-text="scope.row.materialNumber" />
+                  <el-select
+                    v-model="scope.row.materialNumber"
+                    size="mini"
+                    :remote-method="(query) => remoteMethod(query, 'number')"
+                    filterable
+                    remote
+                    style="width: 85%"
+                    @change="handleK3List($event, scope.row)"
+                  >
+                    <el-option
+                      v-for="item in k3List"
+                      :key="item.id"
+                      :label="item.number"
+                      :value="item.id"
+                    />
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                show-overflow-tooltip
+                min-width="150"
+                prop="materialName"
+                label="产品名称"
+                align="left"
+              >
+                <template slot-scope="scope">
+                  <CopyButton :copy-text="scope.row.materialName" />
+                  <span>{{ scope.row.materialName }}</span>
+                </template>
+              </el-table-column>
 
-            <el-table-column prop="discAmount" label="格力折扣" align="right">
-              <template slot-scope="scope">
-                <el-input
-                size="mini"
-                  class="yinput"
-                  v-model.number="scope.row.discAmount"
-                  type="number" @mousewheel.native.prevent
-                  placeholder="请输入格力折扣"
+              <el-table-column
+                min-width="300"
+                prop="specification"
+                label="规格型号"
+                align="left"
+              >
+                <template slot-scope="scope">
+                  <CopyButton :copy-text="scope.row.specification" />
+                  <el-select
+                    v-model="scope.row.specification"
+                    size="mini"
+                    :remote-method="
+                      (query) => remoteMethod(query, 'specification')
+                    "
+                    filterable
+                    remote
+                    style="width: 85%"
+                    @change="handleK3List($event, scope.row)"
+                  >
+                    <el-option
+                      v-for="item in k3List"
+                      :key="item.id"
+                      :label="item.specification"
+                      :value="item.id"
+                    />
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                show-overflow-tooltip
+                min-width="150"
+                prop="saleTypeName"
+                label="销售类型"
+                align="left"
+              >
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.saleTypeId"
+                    size="mini"
+                    filterable
+                    @change="handleSalesType($event, scope.row)"
+                  >
+                    <el-option
+                      v-for="item in typeList"
+                      :key="item.id"
+                      :label="item.saleName"
+                      :value="item.id"
+                    />
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                show-overflow-tooltip
+                min-width="150"
+                prop="saleTypeCode"
+                label="销售类型编码"
+                align="left"
+              />
 
-                />
-              </template>
-            </el-table-column>
-            <el-table-column prop="price" label="单价" align="right"  show-overflow-tooltip
-                             min-width="150">
-              <template slot-scope="scope">
-                <el-input
-                  class="yinput"
-                  v-model.number="scope.row.price"
-                  type="number" @mousewheel.native.prevent
-                  placeholder="请输入单价"
-                  size="mini"
-                />
-              </template>
-            </el-table-column>
-            <el-table-column label="返利钱包" align="left"  show-overflow-tooltip
-                             min-width="150">
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.rebateWalletIds"
-                  size="mini"
-                  multiple
-                  filterable
-                >
-                  <el-option
-                    v-for="item in rebateList"
-                    :key="item.walletRebateId"
-                    :label="item.name"
-                    :value="item.walletRebateId"
+              <el-table-column prop="discAmount" label="格力折扣" align="right">
+                <template slot-scope="scope">
+                  <el-input
+                    v-model.number="scope.row.discAmount"
+                    size="mini"
+                    class="yinput"
+                    type="number"
+                    placeholder="请输入格力折扣"
+                    @mousewheel.native.prevent
                   />
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column label="现金钱包" align="left"  show-overflow-tooltip
-                             min-width="150">
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.walletIds"
-                  size="mini"
-                  multiple
-                  filterable
-                >
-                  <el-option
-                    v-for="item in NoRebateWalletList"
-                    :key="item.id"
-                    :label="item.name"
-                    :value="item.id"
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="price"
+                label="单价"
+                align="right"
+                show-overflow-tooltip
+                min-width="150"
+              >
+                <template slot-scope="scope">
+                  <el-input
+                    v-model.number="scope.row.price"
+                    class="yinput"
+                    type="number"
+                    placeholder="请输入单价"
+                    size="mini"
+                    @mousewheel.native.prevent
                   />
-                </el-select>
-                <!-- <el-tag
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="返利钱包"
+                align="left"
+                show-overflow-tooltip
+                min-width="150"
+              >
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.rebateWalletIds"
+                    size="mini"
+                    multiple
+                    filterable
+                  >
+                    <el-option
+                      v-for="item in rebateList"
+                      :key="item.walletRebateId"
+                      :label="item.name"
+                      :value="item.walletRebateId"
+                    />
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="现金钱包"
+                align="left"
+                show-overflow-tooltip
+                min-width="150"
+              >
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.walletIds"
+                    size="mini"
+                    multiple
+                    filterable
+                  >
+                    <el-option
+                      v-for="item in NoRebateWalletList"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    />
+                  </el-select>
+                  <!-- <el-tag
                   style="margin: 5px"
                   type="success"
                   size="mini"
                   v-for="item in scope.row.walletRelaList"
                   >{{ item.walletName }}</el-tag
                 > -->
-              </template>
-            </el-table-column>
-            <el-table-column prop="remark" label="备注" align="left"  show-overflow-tooltip
-                             min-width="150">
-              <template slot-scope="scope">
-                <el-input
-                  v-model="scope.row.remark"
-                  placeholder="备注"
-                  size="mini"
-                />
-              </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, scope.$index)"
-                >
-                  <el-button
-                    slot="reference"
-                    type="text"
-                    class="textColor el-popover-left"
-                  >删除</el-button>
-                </el-popconfirm>
-              </template>
-            </el-table-column>
-
-          </el-table>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="remark"
+                label="备注"
+                align="left"
+                show-overflow-tooltip
+                min-width="150"
+              >
+                <template slot-scope="scope">
+                  <el-input
+                    v-model="scope.row.remark"
+                    placeholder="备注"
+                    size="mini"
+                  />
+                </template>
+              </el-table-column>
+              <el-table-column
+                min-width="100"
+                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="handleDelete(scope.row.id, scope.$index)"-->
+                  <!--                >-->
+                  <!--                  <el-button-->
+                  <!--                    slot="reference"-->
+                  <!--                    type="text"-->
+                  <!--                    class="textColor el-popover-left"-->
+                  <!--                  >删除</el-button>-->
+                  <!--                </el-popconfirm>-->
+                  <el-popconfirm
+                    confirm-button-text="好的"
+                    cancel-button-text="不用了"
+                    icon="el-icon-info"
+                    icon-color="red"
+                    title="启用吗?"
+                    @onConfirm="handleStatus(scope.row.id, true)"
+                  >
+                    <el-button
+                      slot="reference"
+                      type="text"
+                      class="textColor el-popover-left"
+                    >启用</el-button>
+                  </el-popconfirm>
+                  <el-popconfirm
+                    confirm-button-text="好的"
+                    cancel-button-text="不用了"
+                    icon="el-icon-info"
+                    icon-color="red"
+                    title="作废吗?"
+                    @onConfirm="handleStatus(scope.row.id, false)"
+                  >
+                    <el-button
+                      slot="reference"
+                      type="text"
+                      class="textColor el-popover-left"
+                    >作废</el-button>
+                  </el-popconfirm>
+                </template>
+              </el-table-column>
+            </el-table>
           </div>
           <!-- 分页 -->
           <div
@@ -408,7 +457,6 @@
             <el-divider />
           </el-row>
           <el-table
-
             :data="conditionList"
             element-loading-text="Loading"
             border
@@ -426,8 +474,8 @@
             <el-table-column prop="name" label="限定条件" align="left">
               <template slot-scope="scope">
                 <el-input
-                size="mini"
                   v-model="scope.row.name"
+                  size="mini"
                   style="text-align: center"
                   placeholder="请输入名称"
                   :disabled="scope.row.fang"
@@ -445,19 +493,20 @@
                 <el-button
                   type="text"
                   size="mini"
-                  @click="scope.row.fang = false; conditName=scope.row.name"
+                  @click="
+                    scope.row.fang = false;
+                    conditName = scope.row.name;
+                  "
                 >编辑</el-button>
                 <el-button
                   type="text"
                   size="mini"
                   @click="handleCondition(scope.row.id, scope.$index)"
                 >删除</el-button>
-                 <el-button
+                <el-button
                   type="text"
                   size="mini"
-                  @click="
-                  catCond(scope.row)
-                  "
+                  @click="catCond(scope.row)"
                 >查看条件</el-button>
               </template>
             </el-table-column>
@@ -473,18 +522,22 @@
             </el-row>
             <el-divider />
           </el-row>
-          <TabelTransfer v-if="detail && detail.code" :code="detail.code" :yregion="region" @handlEditPolicy="handlEditPolicy" @handleReset="handleReset" />
+          <TabelTransfer
+            v-if="detail && detail.code"
+            :code="detail.code"
+            :yregion="region"
+            @handlEditPolicy="handlEditPolicy"
+            @handleReset="handleReset"
+          />
         </div>
       </div>
     </div>
     <AddCondition
-      ref="comDom"
       v-show="isCondition === 1"
-
+      ref="comDom"
       @handleSubmitCon="handleSubmitCon"
     />
-    <AddCondition ref="cond" v-show="isCondition === 2"   :id="cid"  />
-
+    <AddCondition v-show="isCondition === 2" :id="cid" ref="cond" />
   </div>
 </template>
 
@@ -504,7 +557,7 @@ import {
   savePolicy,
   updateCondition,
   updatePolicy,
-  getConditionMaterialDetail
+  setStauts
 } from '@/api/policy_list'
 import { downloadFiles, handleImport } from '@/utils/util'
 // import Transfer from './Transfer'
@@ -518,10 +571,10 @@ export default {
   directives: {
     'el-select-loadmore': {
       bind(el, binding) {
-          console.log(el);
+        console.log(el)
         // 获取element-ui定义好的scroll盒⼦
         const SELECTWRAP_DOM = el.querySelector(
-          ".el-table__body-wrapper"
+          '.el-table__body-wrapper'
           // '.el-select-dropdown .el-select-dropdown__wrap'
         )
         SELECTWRAP_DOM.addEventListener('scroll', function() {
@@ -558,9 +611,9 @@ export default {
         mainId: '',
         mainName: '',
         type: '',
-        isFullRebate: false,
+        isFullRebate: false
       },
-      conditName:'',
+      conditName: '',
       dataList: [],
       addList: [],
       pageSizeArr: [10, 20, 30, 50],
@@ -592,9 +645,9 @@ export default {
       dcurrentPage: 1,
       detail: {},
       rebateList: [],
-      cid:'',
-      cpolicyId:'',
-      region:0
+      cid: '',
+      cpolicyId: '',
+      region: 0
     }
   },
   computed: {
@@ -604,18 +657,21 @@ export default {
   },
 
   created() {
-
     // console.log(this.$store.code);
-
     // if (this.$parent.isFlag) {
     //   // this.handletwoList()
     // }
-
   },
   methods: {
     ...mapMutations('sales', ['initData']),
+    handleStatus(id, status) {
+      setStauts({ policyMaterialId: id, status }).then((res) => {
+        this.handletwoList()
+        this.$successMsg(status ? '启用' : '作废')
+      })
+    },
     // 下载excel模板
-    hanleDownloadFiles() {
+    handleDownloadFiles() {
       downloadFiles('policy/download')
     },
     handleCondition(id, index) {
@@ -628,18 +684,17 @@ export default {
         this.$successMsg('删除成功')
       })
     },
-    catCond(row){
+    catCond(row) {
       this.cid = row.id
       this.$refs.cond.getCommonApi()
       this.isCondition = 2
 
-            // $refs.cond.getCommonApi(),
-            //         (), (cid = scope.row.id)
-
+      // $refs.cond.getCommonApi(),
+      //         (), (cid = scope.row.id)
     },
     handleAddCondition() {
       this.isCondition = 1
-      console.log(this.conditionList[0].id,this.searchForm.code);
+      console.log(this.conditionList[0].id, this.searchForm.code)
       this.$refs.comDom.getCommonApi(this.conditionList[0].id)
       this.$store.commit('sales/setId', this.searchForm.code)
     },
@@ -647,21 +702,20 @@ export default {
     //   this.sleectBox.currentPage++
     //   this.getK3List()
     // },
-    loadmore2(){
-       if(this.dataList.length<this.listTotal){
-        let total = Math.floor(this.listTotal/10)
-          if (this.dcurrentPage<=total) {
-            this.dcurrentPage++
-           this.handletwoList()
-          }
+    loadmore2() {
+      if (this.dataList.length < this.listTotal) {
+        const total = Math.floor(this.listTotal / 10)
+        if (this.dcurrentPage <= total) {
+          this.dcurrentPage++
+          this.handletwoList()
         }
+      }
     },
     getK3List() {
       getK3List({
         pageNum: this.sleectBox.currentPage,
         pageSize: 10,
         keyword: ''
-
       }).then((res) => {
         this.k3List = [...this.k3List, ...res.data.records]
       })
@@ -684,33 +738,34 @@ export default {
         this.getK3List()
       }
     },
-    async  getCommonApi() {
+    async getCommonApi() {
       // this.getK3List();
       // 非返利钱包
-       const noRebateWalletData =  await  getNoRebateWalletList({ walletName: "" })
-        this.NoRebateWalletList = noRebateWalletData.data;
+      const noRebateWalletData = await getNoRebateWalletList({
+        walletName: ''
+      })
+      this.NoRebateWalletList = noRebateWalletData.data
 
-     const walletRebateData  = await getWalletRebateList({
+      const walletRebateData = await getWalletRebateList({
         pageNum: 1,
         pageSize: -2,
-        name: "",
-        status: true,
+        name: '',
+        status: true
       })
-      this.rebateList = walletRebateData.data.records;
+      this.rebateList = walletRebateData.data.records
 
       const params = {
         pageNum: 1,
         pageSize: -1,
-        saleCode: "",
-        saleName: "",
-        status: "",
-      };
+        saleCode: '',
+        saleName: '',
+        status: ''
+      }
 
       // 获取销售类型列表
-      const  typeData =  await getTypeList(params)
-
-        this.typeList = typeData.data.records;
+      const typeData = await getTypeList(params)
 
+      this.typeList = typeData.data.records
     },
     handleSalesType(e, row) {
       const item = this.typeList.filter((k) => {
@@ -727,7 +782,9 @@ export default {
         })
       })
       if (rebateList.length) {
-        this.$set(row, 'rebateWalletIds', [...new Set([...row.rebateWalletIds, rebateList[0].walletRebateId])])
+        this.$set(row, 'rebateWalletIds', [
+          ...new Set([...row.rebateWalletIds, rebateList[0].walletRebateId])
+        ])
       }
       this.$set(row, 'saleTypeCode', item.saleCode)
       this.$set(row, 'saleTypeName', item.saleName)
@@ -736,7 +793,7 @@ export default {
     // 修改条件名称
     handleConditionName(row) {
       console.log(row.name)
-      if (this.conditName !== row.name){
+      if (this.conditName !== row.name) {
         updateCondition({ id: row.id, name: row.name }).then((res) => {
           this.$successMsg('修改成功')
         })
@@ -754,7 +811,10 @@ export default {
           res.data[i].fang = true
         }
         this.conditionList = res.data
-        Object.assign( this.$refs.comDom.$data,this.$refs.comDom.$options.data())
+        Object.assign(
+          this.$refs.comDom.$data,
+          this.$refs.comDom.$options.data()
+        )
       })
     },
     // 视图部分已注释,废弃的功能 fucn
@@ -792,11 +852,11 @@ export default {
         })
       }
     },
-   async getList() {
-      await  this.getCommonApi()
-     await  getPolicyDetail({ policyId: this.$parent.id }).then( async(res) => {
-        this.detail = res.data
-        this.searchForm = {
+    async getList() {
+      await this.getCommonApi()
+      await getPolicyDetail({ policyId: this.$parent.id }).then(async(res) => {
+        this.detail = res.data;
+        (this.searchForm = {
           code: this.detail.code,
           endTime: this.detail.endTime,
           imgSrc: this.detail.imgSrc,
@@ -804,8 +864,8 @@ export default {
           startTime: this.detail.startTime,
           title: this.detail.title,
           type: this.detail.type
-        },
-        this.region = res.data.flag
+        }),
+        (this.region = res.data.flag)
         this.srcList = [this.$imageUrl + this.detail.imgSrc]
         if (this.$parent.isShow === 5 && this.detail.imgSrc) {
           this.fileList = [
@@ -815,12 +875,12 @@ export default {
             }
           ]
         }
-       await  this.handletwoList()
+        await this.handletwoList()
         // 获取条件政策
-       await  this.handleSubmitCon()
+        await this.handleSubmitCon()
       })
       if (this.$parent.isFlag) {
-       await  this.handletwoList()
+        await this.handletwoList()
       }
     },
 
@@ -855,7 +915,7 @@ export default {
       const paramss = {
         pageNum: 1,
         pageSize: -1,
-         policyId: this.searchForm.code,
+        policyId: this.searchForm.code,
         saleTypeCode: ''
       }
       getMaterialList(paramss)
@@ -869,13 +929,13 @@ export default {
             }
 
             for (let i = 0; i < k.walletRelaList.length; i++) {
-              const d =  k.walletRelaList[i];
-              d.id = d.walletId;
-              d.name = d.walletName;
-              if (d.type === "REBATE") {
-                k.rebateWalletIds = [...k.rebateWalletIds, d.walletId];
+              const d = k.walletRelaList[i]
+              d.id = d.walletId
+              d.name = d.walletName
+              if (d.type === 'REBATE') {
+                k.rebateWalletIds = [...k.rebateWalletIds, d.walletId]
               } else {
-                k.walletIds = [...k.walletIds, d.walletId];
+                k.walletIds = [...k.walletIds, d.walletId]
               }
             }
           })
@@ -889,7 +949,7 @@ export default {
         })
     },
     // 提交审核
-    handlEditPolicy(policyCustomers,region) {
+    handlEditPolicy(policyCustomers, region) {
       if (!this.searchForm.title) {
         this.$errorMsg('请输入说明')
         return
@@ -902,8 +962,8 @@ export default {
         this.$errorMsg('请选择生效日期')
         return
       }
-      const formtData = ()=>{
-       var arr = []
+      const formtData = () => {
+        var arr = []
         policyCustomers.forEach((el) => {
           arr.push({
             customerId: el.customerId || el.customerId,
@@ -924,7 +984,7 @@ export default {
         const params = {
           ...this.detail,
           ...this.searchForm,
-           flag:region,
+          flag: region,
           endTime: this.searchForm.endTime || '2100-01-01 00:00:00',
           policyCustomers: arr,
           imgSrc: this.fileList.length ? this.fileList[0].url : ''
@@ -938,19 +998,18 @@ export default {
         })
       }
 
-      if(region ==0){
-    if (policyCustomers.length) {
- formtData()
+      if (region == 0) {
+        if (policyCustomers.length) {
+          formtData()
+        } else {
+          this.$errorMsg('选择经销商 ')
+        }
       } else {
-        this.$errorMsg('选择经销商 ')
+        formtData()
       }
-      }else{
- formtData()
-      }
-
     },
     // 删除
-    hanleDelete(id, index) {
+    handleDelete(id, index) {
       if (id) {
         const params = { policyMaterialId: id }
         deleteMaterialPolicy(params).then((res) => {
@@ -961,7 +1020,9 @@ export default {
 
       this.dataList.splice(index, 1)
       if (!this.dataList.length) {
-        this.dcurrentPage !== 1 ? this.dcurrentPage -= 1 : this.dcurrentPage = 1
+        this.dcurrentPage !== 1
+          ? (this.dcurrentPage -= 1)
+          : (this.dcurrentPage = 1)
       }
       // this.listTotal -= 1;
       this.$successMsg('删除成功')
@@ -1050,8 +1111,8 @@ export default {
 h4 {
   margin: 0;
 }
-.yinput{
-  ::v-deep input{
+.yinput {
+  ::v-deep input {
     text-align: right;
   }
 }