Browse Source

业务员展示

howie 3 years ago
parent
commit
39ef5df6a4

+ 105 - 107
src/api/supply/policy.js

@@ -1,223 +1,221 @@
-import request from '@/utils/request'
+import request from "@/utils/request";
 
 // 获取列表
 export function getList(params) {
   return request({
-    url: '/retail/list',
-    method: 'get',
-    params
-  })
+    url: "/retail/list",
+    method: "get",
+    params,
+  });
 }
 
 // 获取详情
 export function getDetail(params) {
   return request({
-    url: '/retail/detail',
-    method: 'get',
-    params
-  })
+    url: "/retail/detail",
+    method: "get",
+    params,
+  });
 }
 
 // 关闭
 export function closeData(params) {
   return request({
-    url: '/retail/close',
-    method: 'post',
-    params
-  })
+    url: "/retail/close",
+    method: "post",
+    params,
+  });
 }
 
 // 审批
 export function examineData(params) {
   return request({
-    url: '/retail/examine',
-    method: 'post',
-    params
-  })
+    url: "/retail/examine",
+    method: "post",
+    params,
+  });
 }
 
 // 退订
 export function returnData(params) {
   return request({
-    url: '/retail/return',
-    method: 'post',
-    params
-  })
+    url: "/retail/return",
+    method: "post",
+    params,
+  });
 }
 
 // 提交审核
 export function submitData(params) {
   return request({
-    url: '/retail/submit',
-    method: 'post',
-    params
-  })
+    url: "/retail/submit",
+    method: "post",
+    params,
+  });
 }
 
 // 新增
 export function addData(params) {
   return request({
-    url: '/retail/add',
-    method: 'post',
-    data: params
-  })
+    url: "/retail/add",
+    method: "post",
+    data: params,
+  });
 }
 
 // 编辑
 export function editData(params) {
   return request({
-    url: '/retail/update',
-    method: 'post',
-    data: params
-  })
+    url: "/retail/update",
+    method: "post",
+    data: params,
+  });
 }
 
 // 获取销售类型列表
 export function getSalesTypeList(params) {
   return request({
-    url: '/sale/type/list',
-    method: 'get',
-    params
-  })
+    url: "/sale/type/list",
+    method: "get",
+    params,
+  });
 }
 
 // 获取产品列表
 export function getGoodsList(params) {
   return request({
-    url: '/retail/product/list',
-    method: 'get',
-    params
-  })
+    url: "/retail/product/list",
+    method: "get",
+    params,
+  });
 }
 
 // 获取钱包列表
 export function getWalletList(params) {
   return request({
-    url: '/wallet/customer/list',
-    method: 'get',
-    params
-  })
+    url: "/wallet/customer/list",
+    method: "get",
+    params,
+  });
 }
 
 // 获取仓库列表
 export function getWarehouseList(params) {
   return request({
-    url: '/stock/manager/listStock',
-    method: 'get',
-    params
-  })
+    url: "/stock/manager/listStock",
+    method: "get",
+    params,
+  });
 }
 
 // 检查库存
 export function checkStock(params) {
   return request({
-    url: '/stock/manager/stockStatus',
-    method: 'get',
-    params
-  })
+    url: "/stock/manager/stockStatus",
+    method: "get",
+    params,
+  });
 }
 
-
 export function submitCancel(params) {
   return request({
-    url: '/retail/submit/cancel',
-    method: 'post',
-    params
-  })
+    url: "/retail/submit/cancel",
+    method: "post",
+    params,
+  });
 }
 // 销售类型
 export function typeList(params) {
   return request({
-    url: '/sale/type/list',
-    method: 'get',
-    params
-  })
+    url: "/sale/type/list",
+    method: "get",
+    params,
+  });
 }
 
-
 // 销售政策
 export function policyList(params) {
   return request({
-    url: '/policy/list',
-    method: 'get',
-    params
-  })
+    url: "/policy/list",
+    method: "get",
+    params,
+  });
 }
 
 // 根据政策id和物料id反查政策条件
 export function getpolicyList(params) {
   return request({
-    url: '/policy/condition/get',
-    method: 'get',
-    params
-  })
+    url: "/policy/condition/get",
+    method: "get",
+    params,
+  });
 }
 
-//政策条件的机型列表
+// 政策条件的机型列表
 export function getConditionList(params) {
   return request({
-    url: '/policy/condition/material/list',
-    method: 'get',
-    params
-  })
+    url: "/policy/condition/material/list",
+    method: "get",
+    params,
+  });
 }
 
-
-
 export function getpolicyTypeList(params) {
   return request({
-    url: '/policy/type1/material/list',
-    method: 'get',
-    params
-  })
+    url: "/policy/type1/material/list",
+    method: "get",
+    params,
+  });
 }
 
-
-
 export function getMaterialTypeList(params) {
   return request({
-    url: '/policy/material/list',
-    method: 'get',
-    params
-  })
+    url: "/policy/material/list",
+    method: "get",
+    params,
+  });
 }
 
 // 弃审
 export function abandonData(params) {
   return request({
-    url: '/retail/abandon',
-    method: 'post',
-    params
-  })
+    url: "/retail/abandon",
+    method: "post",
+    params,
+  });
 }
 
-
-
 export function getConditionDetail(params) {
   return request({
-    url: '/policy/condition/detail',
-    method: 'get',
-    params
-  })
+    url: "/policy/condition/detail",
+    method: "get",
+    params,
+  });
 }
 
-
 // 政策条件
 
 export function getPolicyConditionList(params) {
   return request({
-    url: '/policy/condition/list',
-    method: 'get',
-    params
-  })
+    url: "/policy/condition/list",
+    method: "get",
+    params,
+  });
 }
 
 // 业务员
 export function getUserList(params) {
   return request({
-    url:'/admin/user/list',
-    method: 'get',
-    params
-  })
+    url: "/admin/user/list",
+    method: "get",
+    params,
+  });
 }
 
+export function deleteList(params) {
+  return request({
+    url: "/retail/delete",
+    method: "post",
+    params,
+  });
+}

+ 8 - 8
src/views/sales_policy/components/AddCondition.vue

@@ -401,15 +401,15 @@
 <script>
 import {
   addPoliyCondition,
-  getConditionMaterialList,
-  getMaterialList,
   getConditionMaterialDetail,
-} from "@/api/policy_list";
-import TabelTransfer from "./TabelTransfer.vue";
+  getConditionMaterialList,
+  getMaterialList
+} from '@/api/policy_list'
+import TabelTransfer from './TabelTransfer.vue'
 
-import { mapState } from "vuex";
-import AddModel from "./AddModel";
-import Minxin from "@/mixin";
+import { mapState } from 'vuex'
+import AddModel from './AddModel'
+import Minxin from '@/mixin'
 
 export default {
   mixins: [Minxin],
@@ -471,7 +471,7 @@ export default {
     this.getCommonApi();
   },
   computed: mapState({
-    comCode: (state) => state.sales.code,
+    comCode: (state) => state.sales.code ,
   }),
   updated() {},
   methods: {

+ 1 - 4
src/views/sales_policy/components/AddPolicy.vue

@@ -861,10 +861,7 @@ export default {
           this.$errorMsg('请选择销售类型')
           return
         }
-        if (!this.dataList[i].discAmount) {
-          this.$errorMsg('请输入格力折扣')
-          return
-        }
+   
         if (!this.dataList[i].price) {
           this.$errorMsg('请输入单价')
           return

+ 238 - 274
src/views/sales_policy/components/Examine.vue

@@ -3,10 +3,9 @@
     <div v-if="isEdit == 1">
       <el-header height="50px" class="header">
         <el-page-header
-          @back="($parent.isShow = 1), ($parent.id = '')"
           :content="comTitle"
-        >
-        </el-page-header>
+          @back="($parent.isShow = 1), ($parent.id = '')"
+        />
       </el-header>
       <div class="app-container">
         <div class="diy-table-1">
@@ -21,7 +20,7 @@
                 <el-input
                   v-model="detail.title"
                   placeholder="请输入政策说明"
-                ></el-input>
+                />
               </div>
             </el-col>
             <el-col :span="8" class="item">
@@ -56,7 +55,7 @@
                 <el-input
                   v-model="detail.remark"
                   placeholder="请输入备注"
-                ></el-input>
+                />
               </div>
             </el-col>
 
@@ -74,7 +73,7 @@
                   default-time="00:00:00"
                   value-format="yyyy-MM-dd HH:mm:ss"
                 />
-                </div>
+              </div>
             </el-col>
             <el-col :span="8" class="item">
               <div class="label">生效日期</div>
@@ -86,7 +85,7 @@
                   default-time="00:00:00"
                   value-format="yyyy-MM-dd HH:mm:ss"
                 /> </el-form-item>
-                </div>
+              </div>
             </el-col>
             <el-col :span="24" class="item">
               <div class="label">失败日期</div>
@@ -98,10 +97,10 @@
                   default-time="00:00:00"
                   value-format="yyyy-MM-dd HH:mm:ss"
                 /> </el-form-item>
-               </div>
+              </div>
             </el-col>
           </el-row>
-          <el-row class="img-box" v-if="detail.imgSrc && $parent.isShow !== 5">
+          <el-row v-if="detail.imgSrc && $parent.isShow !== 5" class="img-box">
             <el-col :span="8" class="item">
               <div class="label" style="height: 150px">政策封面图</div>
               <div class="value" style="height: 150px">
@@ -110,7 +109,7 @@
                   :src="$imageUrl + detail.imgSrc"
                   fit="fill"
                   :preview-src-list="srcList"
-                ></el-image>
+                />
               </div>
             </el-col>
           </el-row>
@@ -118,7 +117,7 @@
             <el-col :span="24" class="item">
               <div class="label" style="height: 150px">政策封面图</div>
               <div class="value" style="height: 150px">
-                <ImageUpload :fileList="fileList" :multiple="false" />
+                <ImageUpload :file-list="fileList" :multiple="false" />
               </div>
             </el-col>
           </el-row>
@@ -127,23 +126,23 @@
               <div class="label">审核人</div>
               <div class="value">{{ detail.examineBy }}</div>
             </el-col>
-            <el-col :span="8" class="item">
+            <el-col :span="16" class="item">
               <div class="label">审核日期</div>
               <div class="value">{{ detail.examineTime }}</div>
             </el-col>
-            <el-col :span="8" class="item">
-              <div class="label">关闭人</div>
-              <div class="value"></div>
-            </el-col>
-            <el-col :span="8" class="item">
-              <div class="label">关闭日期</div>
-              <div class="value"></div>
-            </el-col>
+            <!--            <el-col :span="8" class="item">-->
+            <!--              <div class="label">关闭人</div>-->
+            <!--              <div class="value"></div>-->
+            <!--            </el-col>-->
+            <!--            <el-col :span="24" class="item">-->
+            <!--              <div class="label">关闭日期</div>-->
+            <!--              <div class="value"></div>-->
+            <!--            </el-col>-->
           </el-row>
         </div>
         <div class="mymain-container">
           <el-row>
-            <el-divider></el-divider>
+            <el-divider />
             <el-row type="flex">
               <el-col :span="12">
                 <h4 style="display: inline-block; margin-right: 20px">
@@ -166,7 +165,7 @@
               > -->
               </el-col>
             </el-row>
-            <el-divider></el-divider>
+            <el-divider />
           </el-row>
           <el-table
             v-loading="listLoading"
@@ -183,49 +182,41 @@
               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="销售类型编码"
               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 prop="price" label="单价" align="center" />
             <el-table-column label="支付钱包" align="center">
               <template slot-scope="scope">
                 <el-tag
+                  v-for="item in scope.row.walletRelaList"
                   style="margin: 5px"
                   type="success"
                   size="small"
-                  v-for="item in scope.row.walletRelaList"
-                  >{{ item.walletName }}</el-tag
-                >
+                >{{ item.walletName }}</el-tag>
               </template>
             </el-table-column>
             <!-- <el-table-column
@@ -256,18 +247,17 @@
           <!-- 分页 -->
           <div style="margin: 20px 0">
             <el-pagination
-              @size-change="handleSizeChange2"
-              @current-change="handleCurrentChange2"
               :current-page="dcurrentPage"
               :page-sizes="[10, 20, 30, 50]"
               :page-size="10"
               layout="total, sizes, prev, pager, next, jumper"
               :total="dlistTotal"
-            >
-            </el-pagination>
+              @size-change="handleSizeChange2"
+              @current-change="handleCurrentChange2"
+            />
           </div>
           <el-row>
-            <el-divider></el-divider>
+            <el-divider />
             <el-row type="flex">
               <el-col :span="12">
                 <h4 style="display: inline-block; margin-right: 20px">
@@ -275,7 +265,7 @@
                 </h4>
               </el-col>
             </el-row>
-            <el-divider></el-divider>
+            <el-divider />
           </el-row>
           <el-table
             :data="conditionList"
@@ -291,8 +281,7 @@
               label="序号"
               width="50"
               align="center"
-            >
-            </el-table-column>
+            />
             <el-table-column prop="name" label="限定条件" align="center">
               <template slot-scope="scope">
                 {{ scope.row.name }}
@@ -305,8 +294,7 @@
                     type="text"
                     size="small"
                     @click="getCommonApi(scope.row)"
-                    >编辑</el-button
-                  >
+                  >编辑</el-button>
                   <el-popconfirm
                     confirm-button-text="好的"
                     cancel-button-text="不用了"
@@ -319,8 +307,7 @@
                       slot="reference"
                       type="text"
                       class="textColor el-popover-left"
-                      >删除</el-button
-                    >
+                    >删除</el-button>
                   </el-popconfirm>
                 </template>
                 <el-button
@@ -330,13 +317,12 @@
                   @click="
                     ($parent.isShow = 10), ($parent.policyId = scope.row.id)
                   "
-                  >查看条件</el-button
-                >
+                >查看条件</el-button>
               </template>
             </el-table-column>
           </el-table>
           <el-row>
-            <el-divider></el-divider>
+            <el-divider />
             <el-row type="flex">
               <el-col :span="12">
                 <h4 style="display: inline-block; margin-right: 20px">
@@ -344,7 +330,7 @@
                 </h4>
               </el-col>
             </el-row>
-            <el-divider></el-divider>
+            <el-divider />
           </el-row>
           <template v-if="$parent.isShow != 5">
             <el-table
@@ -362,33 +348,29 @@
                 label="序号"
                 width="50"
                 align="center"
-              >
-              </el-table-column>
+              />
               <el-table-column
                 prop="customerNumber"
                 label="经销商编码"
                 align="center"
-              >
-              </el-table-column>
+              />
               <el-table-column
                 prop="customerName"
                 label="经销商名称"
                 align="center"
-              >
-              </el-table-column>
+              />
             </el-table>
             <!-- 分页 -->
             <div style="margin: 20px 0">
               <el-pagination
-                @size-change="handleSizeChanges"
-                @current-change="handleCurrentChanges"
                 :current-page="currentPages"
                 :page-sizes="[10, 20, 30, 50]"
                 :page-size="10"
                 layout="total, sizes, prev, pager, next, jumper"
                 :total="clistTotals"
-              >
-              </el-pagination>
+                @size-change="handleSizeChanges"
+                @current-change="handleCurrentChanges"
+              />
             </div>
           </template>
           <template v-else>
@@ -398,13 +380,13 @@
                 <el-divider
                   direction="horizontal"
                   content-position="left"
-                ></el-divider>
+                />
 
                 <el-table
+                  ref="multipleTable"
                   :data="dataL"
                   element-loading-text="Loading"
                   border
-                  ref="multipleTable"
                   height="480px"
                   fit
                   highlight-current-row
@@ -416,75 +398,63 @@
                     width="55"
                     :selectable="selectable"
                     align="center"
-                  >
-                  </el-table-column>
+                  />
                   <el-table-column
                     prop="number"
                     label="经销商编码"
                     align="center"
-                  >
-                  </el-table-column>
+                  />
                   <el-table-column
                     prop="name"
                     label="经销商名称"
                     align="center"
-                  >
-                  </el-table-column>
+                  />
                 </el-table>
                 <!-- 分页 -->
                 <div style="margin: 20px 0">
                   <el-pagination
-                    @size-change="handleSizeChanges"
-                    @current-change="handleCurrentChanges"
                     :current-page="currentPages"
                     :page-sizes="[10, 20, 30, 50]"
                     :page-size="10"
                     layout="total, sizes, prev, pager, next, jumper"
                     :total="clistTotal"
-                  >
-                  </el-pagination>
+                    @size-change="handleSizeChanges"
+                    @current-change="handleCurrentChanges"
+                  />
                 </div>
               </el-col>
               <el-col :span="4" class="middle_box" :offset="0">
                 <el-col>
                   <el-button
                     size="small"
-                    @click="handleAllAdd"
                     :disabled="type == 2"
-                    >全部添加</el-button
-                  ></el-col
-                >
+                    @click="handleAllAdd"
+                  >全部添加</el-button></el-col>
                 <el-col>
                   <el-button
                     size="small"
-                    @click="handleAdd"
                     :disabled="type == 2"
-                    >增加</el-button
-                  ></el-col
-                >
+                    @click="handleAdd"
+                  >增加</el-button></el-col>
                 <el-col>
                   <el-button
                     size="small"
                     :disabled="type == 1"
                     @click="handleDelete"
-                    >删除</el-button
-                  ></el-col
-                >
+                  >删除</el-button></el-col>
                 <el-col>
                   <el-button
                     size="small"
                     :disabled="type == 1"
                     @click="handleAllDelete"
-                    >全部删除</el-button
-                  ></el-col
-                >
+                  >全部删除</el-button></el-col>
               </el-col>
               <el-col :span="10" :offset="0">
                 <h5>已选经销商</h5>
                 <el-divider
                   direction="horizontal"
                   content-position="left"
-                ></el-divider>
+                />
 
                 <el-table
                   v-loading="listLoading"
@@ -498,20 +468,17 @@
                   @select-all="handleSelectionAllChange2"
                   @selection-change="handleSelectionChange2"
                 >
-                  <el-table-column type="selection" width="55" align="center">
-                  </el-table-column>
+                  <el-table-column type="selection" width="55" align="center" />
                   <el-table-column
                     prop="customerNumber"
                     label="经销商编码"
                     align="center"
-                  >
-                  </el-table-column>
+                  />
                   <el-table-column
                     prop="customerName"
                     label="经销商名称"
                     align="center"
-                  >
-                  </el-table-column>
+                  />
                 </el-table>
                 <!-- 分页 -->
                 <!-- <div style="margin: 20px 0">
@@ -530,8 +497,8 @@
             </el-row>
           </template>
           <div
-            class="descriptions"
             v-if="$parent.isShow == 8 && detail.examineStatus == 'WAIT'"
+            class="descriptions"
           >
             <el-row>
               <el-col :span="6">审核人</el-col>
@@ -550,32 +517,32 @@
               <el-col :span="4">审批说明</el-col>
               <el-col :span="20" class="col value" style="padding: 0">
                 <el-input
+                  v-model="remark"
                   size="small"
                   placeholder="请输入内容"
-                  v-model="remark"
-                >
-                </el-input>
+                />
               </el-col>
             </el-row>
             <el-row>
-              <el-button type="primary" size="small" @click="handleSubmit"
-                >审核通过</el-button
-              >
+              <el-button
+                type="primary"
+                size="small"
+                @click="handleSubmit"
+              >审核通过</el-button>
             </el-row>
           </div>
         </div>
         <div>
           <el-button
-            type="primary"
             v-if="$parent.isShow == 5"
+            type="primary"
             size="default"
             @click="handleSave"
-            >保存</el-button
-          >
+          >保存</el-button>
         </div>
       </div>
     </div>
-    <EditCondition v-else :id="cid" :policyId="cpolicyId" />
+    <EditCondition v-else :id="cid" :policy-id="cpolicyId" />
   </div>
 </template>
 
@@ -599,52 +566,52 @@ import { handleImport } from '@/utils/util'
 import Minxin from '@/mixin'
 
 export default {
-  mixins: [Minxin],
-  name: "examine",
+  name: 'Examine',
   components: {
     EditCondition,
-    ImageUpload,
+    ImageUpload
   },
+  mixins: [Minxin],
   data() {
     return {
-      baseURL: "",
+      baseURL: '',
       dcurrentPage: 1,
       dpageSize: 10,
       dlistTotal: 0,
       currentPages: 1, // 当前页码
       pageSizes: 10, // 每页数量
       clistTotal: 0,
-      input: "",
-      remark: "",
+      input: '',
+      remark: '',
       fileList: [],
       listLoading: false,
-      imageUrl: "",
+      imageUrl: '',
       dataList: [],
-      examineStatus: "OK",
+      examineStatus: 'OK',
       options: {},
-      value: "",
+      value: '',
       detail: {},
       srcList: [],
       screenForm: {
-        code: "",
-        createBy: "",
-        endCreateTime: "",
-        endTime1: "",
-        endTime2: "",
-        examineBy: "",
-        remark: "",
-        startCreateTime: "",
-        startTime1: "",
-        startTime2: "",
-        status: "",
-        title: "",
-        type: "",
+        code: '',
+        createBy: '',
+        endCreateTime: '',
+        endTime1: '',
+        endTime2: '',
+        examineBy: '',
+        remark: '',
+        startCreateTime: '',
+        startTime1: '',
+        startTime2: '',
+        status: '',
+        title: '',
+        type: ''
       },
       conditionList: [],
       custoList: [],
       isEdit: 1,
-      cid: "",
-      cpolicyId: "",
+      cid: '',
+      cpolicyId: '',
       dataL: [],
       clistTotal: 0,
       clistTotals: 0,
@@ -662,128 +629,125 @@ export default {
           value: 'LIMIT',
           label: '限量'
         }
-      ],
-    };
+      ]
+    }
   },
-  created() {},
   computed: {
     comTitle() {
-      let title = "详情页";
+      let title = '详情页'
       if (this.$parent.isShow == 5) {
-        title = "编辑页";
+        title = '编辑页'
       } else if (this.$parent.isShow == 8) {
-        title = "审核页";
+        title = '审核页'
       } else {
-        title = "详情页";
+        title = '详情页'
       }
-      return title;
-    },
+      return title
+    }
   },
+  created() {},
   methods: {
     getList() {
-      this.listLoading = true;
+      this.listLoading = true
       getPolicyDetail({ policyId: this.$parent.id }).then((res) => {
-        this.detail = res.data;
-        this.srcList = [this.$imageUrl + this.detail.imgSrc];
+        this.detail = res.data
+        this.srcList = [this.$imageUrl + this.detail.imgSrc]
         if (this.$parent.isShow == 5 && this.detail.imgSrc) {
           this.fileList = [
             {
-              hover: "",
-              url: this.detail.imgSrc,
-            },
-          ];
+              hover: '',
+              url: this.detail.imgSrc
+            }
+          ]
         }
-        this.handletwoList();
+        this.handletwoList()
         // 获取条件政策
-        this.getConditionList();
-        this.getCond();
-      });
+        this.getConditionList()
+        this.getCond()
+      })
     },
 
     getCrList() {
       const customerParams = {
         pageNum: this.currentPage,
         pageSize: this.pageSize,
-        keyword: this.region == 1 || this.region == "" ? "" : this.keyword,
-        region: this.region == 1 ? this.keyword : "",
-      };
+        keyword: this.region == 1 || this.region == '' ? '' : this.keyword,
+        region: this.region == 1 ? this.keyword : ''
+      }
       // 获取经销商列表
       getCrList(customerParams).then((res) => {
         for (let j = 0; j < this.custoList.length; j++) {
           for (let i = 0; i < res.data.records.length; i++) {
             if (res.data.records[i].id == this.custoList[j].customerId) {
-              res.data.records[i].disabled = true;
+              res.data.records[i].disabled = true
             }
           }
         }
-        this.dataL = res.data.records;
+        this.dataL = res.data.records
         for (let k = 0; k < this.dataL.length; k++) {
           (this.dataL[k].customerId = this.dataL[k].id),
-            (this.dataL[k].customerName = this.dataL[k].name),
-            (this.dataL[k].customerNumber = this.dataL[k].number);
+          (this.dataL[k].customerName = this.dataL[k].name),
+          (this.dataL[k].customerNumber = this.dataL[k].number)
         }
 
-        console.log(this.dataL, "获取经销商列表");
-        this.clistTotal = res.data.total;
-      });
+        console.log(this.dataL, '获取经销商列表')
+        this.clistTotal = res.data.total
+      })
     },
     // 更改每页数量
     handleSizeChanges(val) {
-      this.pageSizes = val;
-      this.currentPages = 1;
-      this.getCond();
+      this.pageSizes = val
+      this.currentPages = 1
+      this.getCond()
     },
     // 更改当前页
     handleCurrentChanges(val) {
-      this.currentPages = val;
-      this.getCond();
+      this.currentPages = val
+      this.getCond()
     },
     // 更改每页数量
     handleSizeChange2(val) {
-
-    this.dpageSize = val;
-      this.dcurrentPage = 1;
-      this.handletwoList();
+      this.dpageSize = val
+      this.dcurrentPage = 1
+      this.handletwoList()
     },
     // 更改当前页
     handleCurrentChange2(val) {
-
-
-      this.dcurrentPage = val;
-      this.handletwoList();
+      this.dcurrentPage = val
+      this.handletwoList()
     },
     getCommonApi(row) {
-      (this.isEdit = 2), (this.cid = row.id), (this.cpolicyId = row.policyId);
+      (this.isEdit = 2), (this.cid = row.id), (this.cpolicyId = row.policyId)
       console.log(
         this.cpolicyId,
         this.detail.code,
         this.cpolicyId == this.detail.code
-      );
+      )
     },
     getCond() {
-      this.listLoading = true;
+      this.listLoading = true
       const custoParams = {
         pageNum: this.currentPages,
         pageSize: this.pageSizes,
-        policyId: this.detail.code,
-      };
+        policyId: this.detail.code
+      }
       getCustomerList(custoParams).then((res) => {
-        this.custoList = res.data.records;
-        this.clistTotals = res.data.total;
-        this.listLoading = false;
-        this.getCrList();
-      });
+        this.custoList = res.data.records
+        this.clistTotals = res.data.total
+        this.listLoading = false
+        this.getCrList()
+      })
     },
     handleSubmit() {
       toExamine({
         examineStatus: this.examineStatus,
         policyId: this.$parent.id,
-        examineRemark: this.remark,
+        examineRemark: this.remark
       }).then((res) => {
-        this.$successMsg("已提交审核");
-        this.$parent.isShow = 1;
-        this.$parent.getList();
-      });
+        this.$successMsg('已提交审核')
+        this.$parent.isShow = 1
+        this.$parent.getList()
+      })
     },
     // 获取货品信息
     handletwoList() {
@@ -792,40 +756,40 @@ export default {
         pageNum: this.dcurrentPage,
         pageSize: this.dpageSize,
         policyId: this.detail.code,
-        saleTypeCode: "",
-      };
+        saleTypeCode: ''
+      }
       getMaterialList(paramss)
         .then((result) => {
-          this.dataList = result.data.records;
-          this.dlistTotal = result.data.total;
-          this.listLoading = false;
+          this.dataList = result.data.records
+          this.dlistTotal = result.data.total
+          this.listLoading = false
         })
         .catch((err) => {
-          console.error(err);
-        });
+          console.error(err)
+        })
     },
     // 导入
     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.detail.code);
+      this.importLoading = true
+      const file = param.file
+      console.log(file, 123)
+      const formData = new FormData()
+      formData.append('file', file)
+      formData.append('policyId', this.detail.code)
       // formData.append("mainId", this.detail.mainId);
-      let 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.$alert(result.message, '导入成功', {
+          confirmButtonText: '确定'
+        })
 
-        this.handletwoList();
+        this.handletwoList()
       } else {
-        this.$alert(result.message, "导入失败", {
-          confirmButtonText: "确定",
-        });
+        this.$alert(result.message, '导入失败', {
+          confirmButtonText: '确定'
+        })
       }
     },
     handleCondition(id, index) {
@@ -835,25 +799,25 @@ export default {
         //   this.$children[9].$data,
         //   this.$children[9].$options.data()
         // );
-        this.getConditionList();
-        this.$successMsg("删除成功");
-      });
+        this.getConditionList()
+        this.$successMsg('删除成功')
+      })
     },
     getConditionList() {
       const condParams = {
-        policyId: this.detail.code,
-      };
+        policyId: this.detail.code
+      }
       getConditionList(condParams).then((res) => {
-        this.conditionList = res.data;
-      });
+        this.conditionList = res.data
+      })
     },
-    //删除
+    // 删除
     hanleDelete(id) {
-      const params = { policyMaterialId: id };
+      const params = { policyMaterialId: id }
       deleteMaterialPolicy(params).then((res) => {
-        this.$successMsg("删除成功");
-        this.handletwoList();
-      });
+        this.$successMsg('删除成功')
+        this.handletwoList()
+      })
     },
     /**
      * 根据条件禁用行复选框
@@ -862,52 +826,52 @@ export default {
      * @param {String} index - 索引值
      * @return Boolean
      */
-    selectable: function (row, index) {
+    selectable: function(row, index) {
       // row.disabled == undefined 才能被选中
       if (row.disabled == undefined || row.disabled == false) {
-        return true;
+        return true
       } else {
-        return false;
+        return false
       }
       // 函数必须有返回值且是布尔值
       // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
       // 如果没有返回值则默认返回false(全部无法选中)
     },
     handleSelectionAllChange(e) {
-      this.leftData = e;
-      this.type = 1;
+      this.leftData = e
+      this.type = 1
     },
     handleSelectionChange(e) {
-      this.leftData = e;
-      this.type = 1;
+      this.leftData = e
+      this.type = 1
     },
     handleSelectionAllChange2(e) {
-      this.rightData = e;
-      this.type = 2;
+      this.rightData = e
+      this.type = 2
     },
     handleSelectionChange2(e) {
-      this.rightData = e;
-      this.type = 2;
+      this.rightData = e
+      this.type = 2
     },
     handleLeft(e) {
-      this.type = 1;
+      this.type = 1
     },
     handleRight(e) {
-      this.type = 2;
+      this.type = 2
     },
     handleAllAdd() {
       if (this.type == 1 && this.leftData.length) {
         for (let i = 0; i < this.dataL.length; i++) {
           for (let j = 0; j < this.leftData.length; j++) {
             if (this.dataL[i].id == this.leftData[j].id) {
-              this.dataL[i].disabled = true;
+              this.dataL[i].disabled = true
             }
           }
         }
-        this.custoList = [...this.custoList, ...this.leftData];
-        this.$refs.multipleTable.clearSelection();
+        this.custoList = [...this.custoList, ...this.leftData]
+        this.$refs.multipleTable.clearSelection()
       } else {
-        this.$errorMsg("请选择要添加的经销商");
+        this.$errorMsg('请选择要添加的经销商')
       }
     },
     handleAllDelete() {
@@ -915,14 +879,14 @@ export default {
         for (let i = 0; i < this.dataL.length; i++) {
           for (let j = 0; j < this.rightData.length; j++) {
             if (this.dataL[i].id == this.rightData[j].customerId) {
-              this.$set(this.dataL[i], "disabled", false);
+              this.$set(this.dataL[i], 'disabled', false)
             }
           }
         }
-        const arr = this.resArr(this.custoList, this.rightData);
-        this.custoList = arr;
+        const arr = this.resArr(this.custoList, this.rightData)
+        this.custoList = arr
       } else {
-        this.$errorMsg("请选择要删除的经销商");
+        this.$errorMsg('请选择要删除的经销商')
       }
     },
     handleAdd() {
@@ -930,15 +894,15 @@ export default {
         for (let i = 0; i < this.dataL.length; i++) {
           for (let j = 0; j < this.leftData.length; j++) {
             if (this.dataL[i].id == this.leftData[j].id) {
-              this.dataL[i].disabled = true;
+              this.dataL[i].disabled = true
             }
           }
         }
-        this.custoList = [...this.custoList, ...this.leftData];
-        this.leftData = [];
-        this.$refs.multipleTable.clearSelection();
+        this.custoList = [...this.custoList, ...this.leftData]
+        this.leftData = []
+        this.$refs.multipleTable.clearSelection()
       } else {
-        this.$errorMsg("请选择要添加的经销商");
+        this.$errorMsg('请选择要添加的经销商')
       }
     },
     handleDelete() {
@@ -946,50 +910,50 @@ export default {
         for (let i = 0; i < this.dataL.length; i++) {
           for (let j = 0; j < this.rightData.length; j++) {
             if (this.dataL[i].id == this.rightData[j].customerId) {
-              this.$set(this.dataL[i], "disabled", false);
+              this.$set(this.dataL[i], 'disabled', false)
             }
           }
         }
-        const arr = this.resArr(this.custoList, this.rightData);
-        this.custoList = arr;
+        const arr = this.resArr(this.custoList, this.rightData)
+        this.custoList = arr
       } else {
-        this.$errorMsg("请选择要删除的经销商");
+        this.$errorMsg('请选择要删除的经销商')
       }
     },
-    //去掉相同数据
+    // 去掉相同数据
     resArr(arr1, arr2) {
-      return arr1.filter((v) => arr2.every((val) => val.id != v.id));
+      return arr1.filter((v) => arr2.every((val) => val.id != v.id))
     },
     async handleSave() {
       if (this.custoList.length) {
-        var arr = [];
+        var arr = []
         this.custoList.forEach((el) => {
           arr.push({
             customerId: el.customerId,
             customerName: el.customerName,
             customerNumber: el.customerNumber,
-            lastOrderTime: "",
+            lastOrderTime: '',
             limitTakeNum: 0,
             policyId: this.detail.code,
-            policyTitle: "",
-            remark: "",
-          });
-        });
+            policyTitle: '',
+            remark: ''
+          })
+        })
 
         const params = {
           ...this.detail,
           policyCustomers: arr,
-          imgSrc: this.fileList.length ? this.fileList[0].url : "",
-        };
-        await updatePolicy(params);
-        await this.getCond();
-        this.$successMsg("编辑成功");
-        this.fileList = [];
-        this.$parent.isShow = 1;
+          imgSrc: this.fileList.length ? this.fileList[0].url : ''
+        }
+        await updatePolicy(params)
+        await this.getCond()
+        this.$successMsg('编辑成功')
+        this.fileList = []
+        this.$parent.isShow = 1
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>

+ 127 - 24
src/views/sales_policy/components/TabelTransfer.vue

@@ -1,11 +1,129 @@
-<template>
+<template v-else>
+  <el-row :gutter="20">
+    <el-col :span="10" :offset="0">
+      <h5>未选经销商</h5>
+      <el-divider
+        direction="horizontal"
+        content-position="left"
+      />
 
-</template>
+      <el-table
+        ref="multipleTable"
+        :data="dataL"
+        element-loading-text="Loading"
+        border
+        height="480px"
+        fit
+        highlight-current-row
+        @select-all="handleSelectionAllChange"
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          :selectable="selectable"
+          align="center"
+        />
+        <el-table-column
+          prop="number"
+          label="经销商编码"
+          align="center"
+        />
+        <el-table-column
+          prop="name"
+          label="经销商名称"
+          align="center"
+        />
+      </el-table>
+      <!-- 分页 -->
+      <div style="margin: 20px 0">
+        <el-pagination
+          :current-page="currentPages"
+          :page-sizes="[10, 20, 30, 50]"
+          :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="clistTotal"
+          @size-change="handleSizeChanges"
+          @current-change="handleCurrentChanges"
+        />
+      </div>
+    </el-col>
+    <el-col :span="4" class="middle_box" :offset="0">
+      <el-col>
+        <el-button
+          size="small"
+          :disabled="type == 2"
+          @click="handleAllAdd"
+        >全部添加</el-button></el-col>
+      <el-col>
+        <el-button
+          size="small"
+          :disabled="type == 2"
+          @click="handleAdd"
+        >增加</el-button></el-col>
+      <el-col>
+        <el-button
+          size="small"
+          :disabled="type == 1"
+          @click="handleDelete"
+        >删除</el-button></el-col>
+      <el-col>
+        <el-button
+          size="small"
+          :disabled="type == 1"
+          @click="handleAllDelete"
+        >全部删除</el-button></el-col>
+    </el-col>
+    <el-col :span="10" :offset="0">
+      <h5>已选经销商</h5>
+      <el-divider
+        direction="horizontal"
+        content-position="left"
+      />
 
+      <el-table
+        v-loading="listLoading"
+        :data="custoList"
+        element-loading-text="Loading"
+        border
+        height="480px"
+        fit
+        highlight-current-row
+        stripe
+        @select-all="handleSelectionAllChange2"
+        @selection-change="handleSelectionChange2"
+      >
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column
+          prop="customerNumber"
+          label="经销商编码"
+          align="center"
+        />
+        <el-table-column
+          prop="customerName"
+          label="经销商名称"
+          align="center"
+        />
+      </el-table>
+      <!-- 分页 -->
+      <!-- <div style="margin: 20px 0">
+        <el-pagination
+          @size-change="handleSizeChanges"
+          @current-change="handleCurrentChanges"
+          :current-page="currentPages"
+          :page-sizes="[10, 20, 30, 50]"
+          :page-size="10"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="clistTotals"
+        >
+        </el-pagination>
+      </div> -->
+    </el-col>
+  </el-row>
+</template>
 <script>
-import Minxin from "@/mixin";
-import { getId, getMaterialList } from "@/api/policy_list";
-import Pagination from "./Pagination";
+import Minxin from '@/mixin'
+
 export default {
   mixins: [Minxin],
   props: {
@@ -16,30 +134,15 @@ export default {
   },
   data() {
     return {
-      input: "",
-
-      centerDialogVisible: false,
-      value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
-      tableData: [
-        {
-          date: "2016-05-03",
-          name: "王小虎",
-          address: "上海市普陀区金沙江路 1518 弄",
-        },
-      ],
-      type:''
+
     };
   },
 
   methods: {
-    getList() {
-      // this.getMaterialList();
-    },
 
-  },
-  components: {
-    Pagination,
-  },
+
+  }
+
 };
 </script>
 

+ 964 - 0
src/views/sales_policy/components/editPolicy.vue

@@ -0,0 +1,964 @@
+<template>
+  <div>
+    <div v-show="isCondition == 0">
+      <el-header height="50px" class="header">
+        <el-page-header
+          content="编辑"
+          @back="($parent.isShow = 1), ($parent.isFlag = '')"
+        />
+      </el-header>
+      <div class="app-container">
+        <div class="screen-container">
+          <h4>销售政策信息</h4>
+          <el-divider />
+          <el-form
+            ref="form"
+            :model="searchForm"
+            label-width="120px"
+            size="small"
+            class="demo-searchForm"
+          >
+            <el-row>
+              <el-col :xs="24" :ms="12" :lg="12">
+                <el-form-item label="销售政策编号">
+                  <el-input
+                    v-model="searchForm.code"
+                    disabled
+                    placeholder="如未填写,则系统自动生成"
+                  />
+                </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-form-item>
+              </el-col>
+              <el-col :xs="24" :ms="12" :lg="12">
+                <el-form-item label="销售政策类型" prop="type">
+                  <el-select
+                    v-model="searchForm.type"
+                    size="small"
+                    placeholder="销售政策类型"
+                    class="select_height"
+                  >
+                    <el-option
+                      v-for="(item, index) in typeOptions"
+                      :key="index"
+                      :label="item.label"
+                      :value="item.value"
+                    />
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <!-- <el-col :xs="24" :ms="12" :lg="12">
+                <el-form-item label="产品品类" prop="mainId">
+                  <el-select
+                    v-model="searchForm.mainId"
+                    :disabled="dataList.length ? true : false"
+                    placeholder="请选择"
+                    @change="handelStop"
+                  >
+                    <el-option
+                      v-for="item in dictList"
+                      :label="item.dictValue"
+                      :value="item.dictCode"
+                    ></el-option>
+                  </el-select>
+                </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="生效日期"
+                    default-time="00:00:00"
+                    value-format="yyyy-MM-dd HH:mm:ss"
+                  /> </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-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-form-item>
+              </el-col>
+              <el-col :xs="24" :ms="24" :lg="24">
+                <el-form-item label="政策封面图">
+                  <ImageUpload :file-list="fileList" :multiple="false" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </div>
+        <div class="mymian-container">
+          <el-row>
+            <el-divider />
+            <el-row type="flex">
+              <el-col :span="12">
+                <h4 style="display: inline-block; margin-right: 20px">
+                  货品信息
+                </h4>
+                <template>
+                  <el-upload
+                    class="import-btn"
+                    :action="baseURL + 'student/import'"
+                    :http-request="handleImport"
+                    :file-list="importFileList"
+                    :show-file-list="false"
+                  >
+                    <el-button
+                      type="primary"
+                      size="small"
+                    >导入货品价格表</el-button>
+                  </el-upload>
+                </template>
+
+                <el-button
+                  type="primary"
+                  size="small"
+                  @click="hanleDownloadFiles"
+                >下载模板</el-button>
+              </el-col>
+            </el-row>
+            <el-divider />
+          </el-row>
+          <el-table
+            v-loading="listLoading"
+            :data="dataList"
+            element-loading-text="Loading"
+            border
+            fit
+            highlight-current-row
+            stripe
+          >
+            <el-table-column
+              type="index"
+              label="序号"
+              width="50"
+              align="center"
+            />
+            <el-table-column
+              prop="materialNumber"
+              label="货品编码"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.materialNumber"
+                  v-el-select-loadmore="loadmore"
+                  size="small"
+                  :remote-method="(query)=>remoteMethod(query,'number')"
+                  filterable
+                  remote
+                  @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
+              prop="materialName"
+              label="货品名称"
+              align="center"
+            />
+            <el-table-column
+              prop="specification"
+              label="规格型号"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.specification"
+                  size="small"
+                  :remote-method="(query)=>remoteMethod(query,'specification')"
+                  filterable
+                  remote
+                  @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
+              prop="saleTypeName"
+              label="销售类型"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.saleTypeId"
+                  size="small"
+                  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
+              prop="saleTypeCode"
+              label="销售类型编码"
+              align="center"
+            />
+
+            <el-table-column prop="discAmount" label="格力折扣" align="center">
+              <template slot-scope="scope">
+                <el-input
+                  v-model.number="scope.row.discAmount"
+                  type="number"
+                  placeholder="请输入格力折扣"
+                  size="small"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column prop="price" label="单价" align="center">
+              <template slot-scope="scope">
+                <el-input
+                  v-model.number="scope.row.price"
+                  type="number"
+                  placeholder="请输入单价"
+                  size="small"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column label="支付钱包" align="center">
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.walletIds"
+                  size="small"
+                  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="small"
+                  v-for="item in scope.row.walletRelaList"
+                  >{{ item.walletName }}</el-tag
+                > -->
+              </template>
+            </el-table-column>
+            <el-table-column prop="remark" label="备注" align="center">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.remark"
+                  placeholder="备注"
+                  size="small"
+                />
+              </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>
+          <!-- 分页 -->
+          <div
+            style="
+              margin: 20px 20px 20px 0;
+              display: flex;
+              justify-content: space-between;
+            "
+          >
+            <div>
+              <el-button
+                type="primary"
+                size="small"
+                @click="handleNewInfo"
+              >添加</el-button>
+              <el-button
+                type="primary"
+                size="small"
+                @click="handleSave"
+              >保存</el-button>
+            </div>
+            <el-pagination
+              :current-page="dcurrentPage"
+              :page-sizes="pageSizeArr"
+              :page-size="size"
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="listTotal"
+              @size-change="handleSizeChange2"
+              @current-change="handleCurrentChange2"
+            />
+          </div>
+
+          <el-row>
+            <el-divider />
+            <el-row type="flex">
+              <el-col :span="12">
+                <h4 style="display: inline-block; margin-right: 20px">
+                  条件信息
+                </h4>
+                <el-button
+                  type="primary"
+                  size="small"
+                  @click="addCondition"
+                >添加</el-button></el-col>
+            </el-row>
+            <el-divider />
+          </el-row>
+          <el-table
+            v-loading="listLoading"
+            :data="conditionList"
+            element-loading-text="Loading"
+            border
+            fit
+            highlight-current-row
+            stripe
+          >
+            <el-table-column
+              fixed
+              type="index"
+              label="序号"
+              width="50"
+              align="center"
+            />
+            <el-table-column prop="name" label="限定条件" align="center">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.name"
+                  style="text-align: center"
+                  placeholder="请输入名称"
+                  :disabled="scope.row.fang"
+                  @blur="handleConditionName(scope.row)"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column
+              fixed="right"
+              width="150"
+              label="操作"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  type="text"
+                  size="small"
+                  @click="scope.row.fang = false"
+                >编辑</el-button>
+                <el-button
+                  type="text"
+                  size="small"
+                  @click="handleCondition(scope.row.id, scope.$index)"
+                >删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div>
+          <el-row>
+            <el-divider />
+            <el-row type="flex" align="middle">
+              <el-col :span="2">
+                <h4>经销商信息</h4>
+              </el-col>
+            </el-row>
+            <el-divider />
+          </el-row>
+          <Transfer @handleAddPolicy="handleAddPolicy" @handleReset="handleReset" />
+        </div>
+      </div>
+    </div>
+    <AddCondition
+      v-show="isCondition == 1"
+      @handleSubmitCon="handleSubmitCon"
+    />
+  </div>
+</template>
+
+<script>
+import { mapGetters, mapMutations } from 'vuex'
+import Minxin from '@/mixin'
+import {
+  addPoliy,
+  deleteCondition,
+  deleteMaterialPolicy,
+  getConditionList,
+  getK3List,
+  getMaterialList,
+  getNoRebateWalletList,
+  getPolicyDetail,
+  getTypeList,
+  savePolicy,
+  updateCondition
+} from '@/api/policy_list'
+import { downloadFiles, handleImport } from '@/utils/util'
+import Transfer from './Transfer'
+import AddCondition from './AddCondition'
+import ImageUpload from '@/components/Common/image-upload.vue'
+
+export default {
+  directives: {
+    'el-select-loadmore': {
+      bind(el, binding) {
+        // 获取element-ui定义好的scroll盒⼦
+        const SELECTWRAP_DOM = el.querySelector(
+          '.el-select-dropdown .el-select-dropdown__wrap'
+        )
+        SELECTWRAP_DOM.addEventListener('scroll', function() {
+          /**
+           * scrollHeight 获取元素内容⾼度(只读)
+           * scrollTop 获取或者设置元素的偏移值,常⽤于, 计算滚动条的位置, 当⼀个元素的容器没有产⽣垂直⽅向的滚动条, 那它的scrollTop的值默认为0.
+           * clientHeight 读取元素的可见⾼度(只读)
+           * 如果元素滚动到底, 下⾯等式返回true, 没有则返回false:
+           * ele.scrollHeight - ele.scrollTop === ele.clientHeight;
+           */
+          const condition =
+            this.scrollHeight - this.scrollTop <= this.clientHeight
+          if (condition) {
+            binding.value()
+          }
+        })
+      }
+    }
+  },
+  mixins: [Minxin],
+  data() {
+    return {
+      fang: false,
+      input: '',
+      baseURL: '',
+      isCondition: 0,
+      searchForm: {
+        code: '',
+        endTime: '',
+        imgSrc: '',
+        remark: '',
+        startTime: '',
+        title: '',
+        mainId: '',
+        mainName: '',
+        type: ''
+      },
+      dataList: [],
+      addList: [],
+      pageSizeArr: [10, 20, 30, 50],
+      size: 10,
+      listLoading: false,
+      dialogVisible: false,
+      importFileList: [],
+      fileList: [],
+      options: {},
+      value: '',
+      typeList: [],
+      walletList: [],
+      typeOptions: [
+        {
+          value: 'PROVISION',
+          label: '配提'
+        },
+        {
+          value: 'LIMIT',
+          label: '限量'
+        }
+      ],
+      conditionList: [],
+      dictList: [],
+      k3List: [],
+      NoRebateWalletList: [],
+      sleectBox: { currentPage: 1 },
+      dpageSize: 10,
+      dcurrentPage: 1
+    }
+  },
+  computed: {
+    ...mapGetters({
+      comCode: 'code'
+    })
+  },
+
+  created() {
+    this.getCommonApi()
+
+    // console.log(this.$store.code);
+
+    if (this.$parent.isFlag) {
+      // this.handletwoList()
+    }
+  },
+  methods: {
+    ...mapMutations('sales', ['initData']),
+    // 下载excel模板
+    hanleDownloadFiles() {
+      downloadFiles('/policy/download')
+    },
+    handleCondition(id, index) {
+      deleteCondition({ id }).then((res) => {
+        this.conditionList.splice(index, 1)
+        Object.assign(
+          this.$children[9].$data,
+          this.$children[9].$options.data()
+        )
+        this.$successMsg('删除成功')
+      })
+    },
+    addCondition() {
+      this.isCondition = 1
+      this.$store.commit('sales/setId', this.searchForm.code)
+    },
+    loadmore() {
+      this.sleectBox.currentPage++
+      this.getK3List()
+    },
+    getK3List() {
+      getK3List({
+        pageNum: this.sleectBox.currentPage,
+        pageSize: 10,
+        keyword: ''
+
+      }).then((res) => {
+        this.k3List = [...this.k3List, ...res.data.records]
+      })
+    },
+    remoteMethod(query, type) {
+      console.log(query, type)
+      if (query !== '') {
+        getK3List({
+          pageNum: 1,
+          pageSize: -1,
+          keyword: '',
+          number: type === 'number' ? query : '',
+          oldNumber: '',
+          specification: type === 'specification' ? query : ''
+        }).then((res) => {
+          this.k3List = res.data.records
+        })
+      } else {
+        this.sleectBox.currentPage = 1
+        this.getK3List()
+      }
+    },
+    getCommonApi() {
+      this.getK3List()
+      // 非返利钱包
+      getNoRebateWalletList({ walletName: '' }).then((res) => {
+        this.NoRebateWalletList = res.data
+        console.log(this.NoRebateWalletList, 'kkkk')
+      })
+      const params = {
+        pageNum: 1,
+        pageSize: -1,
+        saleCode: '',
+        saleName: '',
+        status: ''
+      }
+      // 获取销售类型列表
+      getTypeList(params).then((res) => {
+        this.typeList = res.data.records
+      })
+      // this.handletwoList()
+      // const params = {
+      //   pageNum: 1,
+      //   pageSize: 10,
+      //   saleCode: "",
+      //   saleName: "",
+      //   status: "",
+      // };
+      // const walletParams = {
+      //   pageNum: 1,
+      //   pageSize: 10,
+      //   mainName: "",
+      //   saleTypeCode: "",
+      //   saleTypeName: "",
+      //   status: "",
+      // };
+      // // 获取钱包列表
+      // getWalletList(walletParams).then((res) => {
+      //   this.walletList = res.data.records;
+      // });
+      // getDictList({ sysDictEnum: "PRODUCT_TYPE" }).then((res) => {
+      //   this.dictList = res.data;
+      // });
+    },
+    handleSalesType(e, row) {
+      const item = this.typeList.filter((k) => {
+        return k.id == e
+      })[0]
+      this.$set(row, 'saleTypeCode', item.saleCode)
+      this.$set(row, 'saleTypeName', item.saleName)
+      // this.$set(row,'saleTypeId',item.id)
+    },
+    // 修改条件名称
+    handleConditionName(row) {
+      console.log(row.name)
+      updateCondition({ id: row.id, name: row.name }).then((res) => {
+        this.$successMsg('修改成功')
+        row.fang = true
+      })
+    },
+    // 提交信息
+    handleSubmitCon() {
+      const params = {
+        policyId: this.searchForm.code
+      }
+      // 获取条件政策
+      getConditionList(params).then((res) => {
+        for (let i = 0; i < res.data.length; i++) {
+          res.data[i].fang = true
+        }
+        this.conditionList = res.data
+      })
+    },
+    // 视图部分已注释,废弃的功能 fucn
+    handelStop() {
+      if (this.searchForm.mainId) {
+        this.fang = true
+      } else {
+        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)
+      // formData.append("mainId", this.searchForm.mainId);
+      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.handletwoList()
+      } else {
+        this.$alert(result.message, '导入失败', {
+          confirmButtonText: '确定'
+        })
+      }
+    },
+    getList() {
+      getPolicyDetail({ policyId: this.$parent.id }).then((res) => {
+        this.detail = res.data
+
+        this.searchForm = {
+          code: this.detail.code,
+          endTime: this.detail.endTime,
+          imgSrc: this.detail.imgSrc,
+          remark: this.detail.remark,
+          startTime: this.detail.startTime,
+          title: this.detail.title,
+          type: this.detail.type
+        },
+
+        this.srcList = [this.$imageUrl + this.detail.imgSrc]
+        if (this.$parent.isShow == 5 && this.detail.imgSrc) {
+          this.fileList = [
+            {
+              hover: '',
+              url: this.detail.imgSrc
+            }
+          ]
+        }
+        this.handletwoList()
+        // 获取条件政策
+        this.handleSubmitCon()
+        this.getCond()
+      })
+      if (this.$parent.isFlag) {
+        this.handletwoList()
+      }
+    },
+
+    // 更改每页数量
+    handleSizeChange1(val) {
+      this.pageSize = val
+      this.currentPage = 1
+      this.handletwoList()
+    },
+    // 更改当前页
+    handleCurrentChange1(val) {
+      this.currentPage = val
+      this.handletwoList()
+    },
+
+    // 更改每页数量
+    handleSizeChange2(val) {
+      this.dpageSize = val
+      this.dcurrentPage = 1
+
+      this.handletwoList()
+    },
+    // 更改当前页
+    handleCurrentChange2(val) {
+      this.dcurrentPage = val
+      this.handletwoList()
+    },
+    // 获取货品信息
+    handletwoList() {
+      // this.searchForm.type
+      const paramss = {
+        pageNum: this.dcurrentPage,
+        pageSize: this.dpageSize,
+        policyId: this.searchForm.code,
+        saleTypeCode: ''
+      }
+
+      getMaterialList(paramss)
+        .then((result) => {
+          result.data.records.forEach((k) => {
+            k.walletIds = []
+            if (!k.specification) {
+              k.materialNumber = k.materialId
+              k.specification = k.materialId
+            } else {
+              k.materialNumber = k.materialNumber
+              k.specification = k.specification
+            }
+
+            k.materialId = k.materialId
+            k.walletRelaList.forEach((l) => {
+              l.id = l.walletId
+              l.name = l.walletName
+              k.walletIds = [...k.walletIds, l.walletId]
+            })
+          })
+          // this.dataList=[]
+          this.dataList = result.data.records
+          this.listTotal = result.data.total
+        })
+        .catch((err) => {
+          console.error(err)
+        })
+    },
+    // 提交审核
+    handleAddPolicy(policyCustomers) {
+      if (!this.searchForm.title) {
+        this.$errorMsg('请输入说明')
+        return
+      }
+      if (!this.searchForm.type) {
+        this.$errorMsg('请选择类型')
+        return
+      }
+      if (!this.searchForm.startTime) {
+        this.$errorMsg('请选择生效日期')
+        return
+      }
+
+      if (policyCustomers.length) {
+        var arr = []
+        policyCustomers.forEach((el) => {
+          arr.push({
+            customerId: el.id,
+            customerName: el.name,
+            customerNumber: el.number,
+            lastOrderTime: '',
+            limitTakeNum: 0,
+            policyId: this.searchForm.code,
+            policyTitle: '',
+            remark: ''
+          })
+        })
+        // this.dictList.forEach((k) => {
+        //   if (k.dictCode == this.searchForm.mainId) {
+        //     this.searchForm.mainName = k.dictValue;
+        //   }
+        // });
+        const params = {
+          adminCompanyId: '',
+          code: '',
+          customerCount: 0,
+          examineBy: '',
+          examineRemark: '',
+          examineStatus: '',
+          id: '',
+          policyCustomers: arr,
+          remark: '',
+          status: true,
+          title: '',
+          type: '',
+          ...this.searchForm,
+          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
+        })
+      } else {
+        this.$errorMsg('选择经销商 ')
+      }
+    },
+    // 删除
+    hanleDelete(id, index) {
+      if (id) {
+        const params = { policyMaterialId: id }
+        deleteMaterialPolicy(params).then((res) => {
+          this.dataList.splice(index, 1)
+        })
+        return
+      }
+      
+      this.dataList.splice(index, 1)
+      if (!this.dataList.length) {
+        this.dcurrentPage !== 1 ? this.dcurrentPage -= 1 : this.dcurrentPage = 1
+      }
+      // this.listTotal -= 1;
+      this.$successMsg('删除成功')
+    },
+    handleNewInfo() {
+      // 物料列表
+
+      this.dataList.push({
+        id: '',
+        discAmount: '',
+        materialId: '',
+        materialName: '',
+        materialNumber: '',
+        policyId: this.searchForm.code,
+        price: '',
+        remark: '',
+        saleTypeCode: '',
+        saleTypeId: '',
+        saleTypeName: '',
+        specification: '',
+        walletIds: [this.NoRebateWalletList[0].id],
+        walletRelaList: []
+      })
+      this.sleectBox.currentPage = 1
+      // this.listTotal += 1;
+      // this.dataList.push(this.addList[this.addList.length-1])
+    },
+    handleSave() {
+      if (!this.dataList.length) {
+        return
+      }
+      for (let i = 0; i < this.dataList.length; i++) {
+        if (!this.dataList[i].materialId) {
+          this.$errorMsg('请选择货品')
+          return
+        }
+        if (!this.dataList[i].saleTypeId) {
+          this.$errorMsg('请选择销售类型')
+          return
+        }
+
+        if (!this.dataList[i].price) {
+          this.$errorMsg('请输入单价')
+          return
+        }
+        if (!this.dataList[i].walletIds.length) {
+          this.$errorMsg('请选择钱包')
+          return
+        }
+      }
+
+      savePolicy(this.dataList).then((res) => {
+        this.dataList = []
+        this.sleectBox.currentPage = 1
+        this.dcurrentPage = 1
+        this.$successMsg('保存成功')
+        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()
+    },
+    handleReset() {
+      Object.assign(this.$data, this.$options.data())
+    }
+  },
+  components: {
+    Transfer,
+    AddCondition,
+    ImageUpload
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+h4 {
+  margin: 0;
+}
+.pdt {
+  padding-top: 20px;
+}
+.import-btn {
+  margin-right: 10px;
+  display: inline-block;
+}
+.radio {
+  padding: 20px 0;
+}
+.el-divider--horizontal {
+  margin: 20px 0;
+}
+.el-container .el-divider--horizontal {
+  margin: 10px;
+}
+
+.el-select {
+  width: 100%;
+}
+
+.footer {
+  margin-bottom: 20px;
+}
+</style>

+ 35 - 27
src/views/sales_policy/policy_list.vue

@@ -311,45 +311,48 @@
         >
         </el-table-column>
       </el-table>
+      <!-- 分页 -->
+      <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>
-    <!-- 分页 -->
-    <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 == 10" :id="id" :policyId="policyId" />
+  <EditPolicy  v-else-if="isShow == 5"/>
   <Examine v-else />
 </template>
 
 <script>
 import {
-  getId,
-  getList,
-  getTypeList,
   cancelPolicy,
+  cloneList,
   deletePolicy,
+  getId,
+  getList,
   getpolicySubmit,
-  toExamine,
-  cloneList
-} from "@/api/policy_list";
-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 { mapState } from "vuex";
+  getTypeList,
+  toExamine
+} from '@/api/policy_list'
+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 EditPolicy from './components/editPolicy'
+import { mapState } from 'vuex'
 
 export default {
   mixins: [Minxin],
@@ -539,7 +542,9 @@ export default {
     AddModel,
     AddPolicy,
     Pagination,
+    EditPolicy,
     AddCondition,
+
   },
 };
 </script>
@@ -567,4 +572,7 @@ export default {
   height: 50px;
   align-items: center;
 }
+.fr{
+  margin: 20px 0;
+}
 </style>

+ 29 - 14
src/views/supply/policy/components/retail_form.vue

@@ -253,7 +253,7 @@
               placeholder="选择现金钱包"
               clearable
               size="small"
-              @change="handleWallets($event, scope.row)"
+              @change="handleWallets($event, scope.row,scope.$index)"
             >
               <el-option
                 v-for="item in scope.row.wallets"
@@ -963,14 +963,23 @@ export default {
       this.$emit('backListFormDetail')
     },
 
-    handleWallets(e, row) {
-      const service = row.wallets.filter((k) => {
-        return e == k.customerWalletId
-      })[0]
-
-      if (e && service.serviceId) {
+    handleWallets(e, row,index) {
+      if (e) {
+        const service = row.wallets.filter((k) => {
+          return e == k.customerWalletId
+        })[0]
         this.$set(this.mainForm, 'k3ServiceId', service.serviceId)
-        this.$set(this.mainForm, 'k3ServiceName', service.serviceId)
+        this.$set(this.mainForm, 'k3ServiceName', service.serviceName)
+        this.$set(row, 'serviceId', service.serviceId)
+        this.$set(row, 'serviceName', service.serviceName)
+      }else {
+        console.log(index)
+          if (index ===0){
+            this.$set(this.mainForm, 'k3ServiceId', '')
+            this.$set(this.mainForm, 'k3ServiceName', '')
+          }
+        this.$set(row, 'serviceId', '')
+        this.$set(row, 'serviceName', '')
       }
     },
     // 选择销售政策获取政策条件列表
@@ -1276,6 +1285,9 @@ export default {
         for (let i = 0; i < this.multipleData.length; i++) {
           if (this.multipleData[i].wallets && this.multipleData[i].wallets.length) {
             this.$set(this.multipleData[i], 'customerWalletId', this.multipleData[i].wallets[0].customerWalletId)
+            this.$set(this.multipleData[i], 'serviceName', this.multipleData[i].wallets[0].serviceName)
+            this.$set(this.multipleData[i], 'serviceId', this.multipleData[i].wallets[0].serviceId)
+
           }
           arrData = [...arrData, ...this.multipleData[i]]
         }
@@ -1299,11 +1311,13 @@ export default {
         })
 
         if (this.goodsList.length && this.goodsList[0].wallets.length) {
+          console.log(555555)
           this.mainForm.k3ServiceName =
-            this.goodsList[0].wallets[0].k3ServiceName || ''
+            this.goodsList[0].wallets[0].serviceName || ''
           this.mainForm.k3ServiceId =
             this.goodsList[0].wallets[0].serviceId || ''
         }
+
         // if (this.goodsList.length>4) {
         //     this.newGoodsList = this.goodsList
         //     this.newGoodsList.length = 4
@@ -1326,6 +1340,8 @@ export default {
             this.multipleSelections[i][j].disabled = true
             if (this.multipleSelections[i][j].wallets.length) {
               this.$set(this.multipleSelections[i][j], 'customerWalletId', this.multipleSelections[i][j].wallets[0].customerWalletId)
+              this.$set(this.multipleSelections[i][j], 'serviceName', this.multipleSelections[i][j].wallets[0].serviceName)
+              this.$set(this.multipleSelections[i][j], 'serviceId', this.multipleSelections[i][j].wallets[0].serviceId)
             }
             arrData = [...arrData, this.multipleSelections[i][j]]
           }
@@ -1338,7 +1354,7 @@ export default {
 
         if (this.goodsList.length && this.goodsList[0].wallets.length) {
           this.mainForm.k3ServiceName =
-            this.goodsList[0].wallets[0].k3ServiceName || ''
+            this.goodsList[0].wallets[0].serviceName || ''
           this.mainForm.k3ServiceId =
             this.goodsList[0].wallets[0].serviceId || ''
         }
@@ -1384,9 +1400,9 @@ export default {
           this.mainForm.remark = data.remark
           this.mainForm.policyId = data.policyId
           this.policyId = data.policyId
-          this.mainForm.k3ServiceName = data.k3ServiceName
-          this.mainForm.k3ServiceId = data.k3ServiceId
-
+   
+          this.mainForm.k3ServiceName = data.retailOrderItemList[0].wallets[0].serviceName
+          this.mainForm.k3ServiceId = data.retailOrderItemList[0].wallets[0].serviceId
           data.retailOrderItemList.forEach((item) => {
             item.status1 = ''
             item.status2 = ''
@@ -1399,7 +1415,6 @@ export default {
               }
             })
           })
-          console.log(data.retailOrderItemList)
           this.goodsList = data.retailOrderItemList
         })
       })

+ 170 - 175
src/views/supply/policy/policy_list.vue

@@ -25,8 +25,7 @@
                     v-for="(item, index) in statusList"
                     :key="index"
                     :label="item.value"
-                    >{{ item.label }}</el-radio-button
-                  >
+                  >{{ item.label }}</el-radio-button>
                 </el-radio-group>
               </el-form-item>
             </el-col>
@@ -35,7 +34,7 @@
                 <el-input
                   v-model="screenForm.orderNum"
                   placeholder="请输入订单号"
-                ></el-input>
+                />
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -43,7 +42,7 @@
                 <el-input
                   v-model="screenForm.policyCode"
                   placeholder="请输入销售政策编号"
-                ></el-input>
+                />
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -51,7 +50,7 @@
                 <el-input
                   v-model="screenForm.policyRemark"
                   placeholder="请输入销售政策说明"
-                ></el-input>
+                />
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -59,7 +58,7 @@
                 <el-input
                   v-model="screenForm.jxsName"
                   placeholder="请输入经销商"
-                ></el-input>
+                />
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -80,8 +79,7 @@
                   value-format="yyyy-MM-dd HH:mm:ss"
                   start-placeholder="开始日期"
                   end-placeholder="结束日期"
-                >
-                </el-date-picker>
+                />
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -89,7 +87,7 @@
                 <el-input
                   v-model="screenForm.zbMan"
                   placeholder="请输入制表人"
-                ></el-input>
+                />
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -97,18 +95,21 @@
                 <el-input
                   v-model="screenForm.shMan"
                   placeholder="请输入审核人"
-                ></el-input>
+                />
               </el-form-item>
             </el-col>
 
             <el-col :xs="24" :sm="12" :lg="6" class="tr">
               <el-form-item label="">
-                <el-button size="small" @click="resetScreenForm"
-                  >清空</el-button
-                >
-                <el-button size="small" type="primary" @click="submitScreenForm"
-                  >搜索</el-button
-                >
+                <el-button
+                  size="small"
+                  @click="resetScreenForm"
+                >清空</el-button>
+                <el-button
+                  size="small"
+                  type="primary"
+                  @click="submitScreenForm"
+                >搜索</el-button>
               </el-form-item>
             </el-col>
           </el-row>
@@ -118,16 +119,15 @@
         <div class="btn-group clearfix">
           <div class="fl">
             <el-button
+              v-if="$checkBtnRole('add', $route.meta.roles)"
               size="small"
               type="primary"
               icon="el-icon-plus"
-              v-if="$checkBtnRole('add', $route.meta.roles)"
               @click="toForm()"
-              >新增</el-button
-            >
+            >新增</el-button>
           </div>
           <div class="fr">
-            <ExportButton :exUrl="'retail/export'" :exParams="exParams" />
+            <ExportButton :ex-url="'retail/export'" :ex-params="exParams" />
           </div>
         </div>
         <div class="table">
@@ -157,7 +157,7 @@
               prop="id"
               min-width="180"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="订单日期"
@@ -169,12 +169,12 @@
                 <div>
                   <span>{{ scope.row.theTime | dateToDayFilter }}</span>
                   <el-button
-                  v-if="$checkBtnRole('date', $route.meta.roles)"
+                    v-if="$checkBtnRole('date', $route.meta.roles)"
                     type="text"
                     icon="el-icon-edit"
                     style="padding: 0; margin-left: 6px"
                     @click="editDate(scope.row)"
-                  ></el-button>
+                  />
                 </div>
               </template>
             </el-table-column>
@@ -184,49 +184,49 @@
               prop="policyCode"
               min-width="100"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="销售政策说明"
               prop="policyTitle"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="经销商"
               prop="customerName"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品编码"
               prop="materialCode"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="产品名称"
               prop="materialName"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="规格型号"
               prop="specification"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="计量单位"
               prop="unit"
               min-width="100"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="是否直调"
@@ -244,7 +244,7 @@
               prop="qty"
               min-width="100"
               show-overflow-tooltip
-            ></el-table-column>
+            />
 
             <el-table-column
               align="center"
@@ -253,7 +253,7 @@
               min-width="100"
               show-overflow-tooltip
             >
-                <template slot-scope="scope">
+              <template slot-scope="scope">
                 {{ scope.row.price | numToFixed }}
               </template>
             </el-table-column>
@@ -264,7 +264,7 @@
               min-width="100"
               show-overflow-tooltip
             >
-               <template slot-scope="scope">
+              <template slot-scope="scope">
                 {{ scope.row.payAmount | numToFixed }}
               </template>
             </el-table-column>
@@ -277,9 +277,9 @@
             >
               <template slot-scope="scope">
                 <el-tag
+                  v-if="scope.row.customerWalletName2"
                   type="success"
                   size="small"
-                  v-if="scope.row.customerWalletName2"
                 >
                   {{ scope.row.customerWalletName2 }}
                 </el-tag>
@@ -293,9 +293,9 @@
               min-width="100"
               show-overflow-tooltip
             >
-                <template slot-scope="scope">
-                <div>{{scope.row.rebateAmount | numToFixed}}</div>
-                <div>(实际:{{scope.row.payRebateAmount | numToFixed}})</div>
+              <template slot-scope="scope">
+                <div>{{ scope.row.rebateAmount | numToFixed }}</div>
+                <div>(实际:{{ scope.row.payRebateAmount | numToFixed }})</div>
               </template>
             </el-table-column>
             <el-table-column
@@ -306,7 +306,7 @@
               show-overflow-tooltip
             >
 
-             <template slot-scope="scope">
+              <template slot-scope="scope">
                 {{ scope.row.totalDiscAmount | numToFixed }}
               </template></el-table-column>
             <el-table-column
@@ -315,49 +315,49 @@
               prop="directTransferQty"
               min-width="100"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="出库数量"
               prop="hasSendQty"
               min-width="100"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="业务员"
               prop="k3ServiceName"
               min-width="100"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="制表人"
               prop="createName"
               min-width="100"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="制表日期"
               prop="createTime"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="审核人"
               prop="examineName"
               min-width="100"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="审核日期"
               prop="examineTime"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            />
             <el-table-column
               align="center"
               label="审核状态"
@@ -387,28 +387,29 @@
                 <el-button
                   v-if="
                     scope.row.examineStatus == 'WAIT' &&
-                    $checkBtnRole('examine', $route.meta.roles)
+                      $checkBtnRole('examine', $route.meta.roles)
                   "
                   type="text"
                   @click="toExamine(scope.row)"
-                  >审核</el-button
-                >
+                >审核</el-button>
+                <el-popconfirm v-if="$checkBtnRole('delete', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" style="margin-left: 10px;" title="确定删除吗?" @onConfirm="handleDelete(scope.row.id)">
+                  <el-button slot="reference" type="text">删除</el-button>
+                </el-popconfirm>
                 <el-button
-                  type="text"
                   v-if="
                     scope.row.examineStatus === 'SAVE' &&
-                    $checkBtnRole('edit', $route.meta.roles)
+                      $checkBtnRole('edit', $route.meta.roles)
                   "
+                  type="text"
                   @click="toForm(scope.row)"
-                  >编辑</el-button
-                >
-                      <el-popconfirm style="margin-left: 10px;" title="确定弃审吗?" @onConfirm="handleAbandon(scope.row.id)" v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
+                >编辑</el-button>
+                <el-popconfirm v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" style="margin-left: 10px;" title="确定弃审吗?" @onConfirm="handleAbandon(scope.row.id)">
                   <el-button slot="reference" type="text">弃审</el-button>
                 </el-popconfirm>
                 <el-popconfirm
                   v-if="
                     scope.row.examineStatus == 'WAIT' &&
-                    $checkBtnRole('apply', $route.meta.roles)
+                      $checkBtnRole('apply', $route.meta.roles)
                   "
                   style="margin-left: 10px"
                   title="确定撤回?"
@@ -420,26 +421,24 @@
                   style="margin-left: 10px"
                   type="text"
                   @click="toDetail(scope.row)"
-                  >详情</el-button
-                >
+                >详情</el-button>
 
                 <el-button
-                  type="text"
-                  @click="toReturn(scope.row)"
                   v-if="
                     scope.row.examineStatus === 'OK' &&
-                    $checkBtnRole('examine', $route.meta.roles)
+                      $checkBtnRole('examine', $route.meta.roles)
                   "
-                  >退订</el-button
-                >
+                  type="text"
+                  @click="toReturn(scope.row)"
+                >退订</el-button>
                 <el-popconfirm
-                  style="margin-left: 10px"
-                  title="确定关闭吗?"
-                  @onConfirm="handleClose(scope.row.id)"
                   v-if="
                     scope.row.examineStatus === 'SAVE' &&
-                    $checkBtnRole('examine', $route.meta.roles)
+                      $checkBtnRole('examine', $route.meta.roles)
                   "
+                  style="margin-left: 10px"
+                  title="确定关闭吗?"
+                  @onConfirm="handleClose(scope.row.id)"
                 >
                   <el-button slot="reference" type="text">关闭</el-button>
                 </el-popconfirm>
@@ -451,74 +450,66 @@
       <div class="pagination clearfix">
         <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>
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+          />
         </div>
       </div>
     </div>
     <RetailDetail
-      :listItem="queryItem"
       v-if="isShowDetail"
+      :list-item="queryItem"
       @backListFormDetail="backList"
     />
     <RetailForm
-      :listItem="queryItem"
       v-if="isShowForm"
+      :list-item="queryItem"
       @backListFormDetail="backList"
     />
     <RetailExamine
-      :listItem="queryItem"
       v-if="isShowExamine"
+      :list-item="queryItem"
       @backListFormDetail="backList"
     />
     <RetailReturn
-      :listItem="queryItem"
       v-if="isShowReturn"
+      :list-item="queryItem"
       @backListFormDetail="backList"
     />
     <EditDateDialog
-      :isShow.sync="isShowEditDateDialog"
-      :dateForm.sync="dateForm"
+      :is-show.sync="isShowEditDateDialog"
+      :date-form.sync="dateForm"
     />
   </div>
 </template>
 
 <script>
-import {
-  getList,
-  editData,
-  closeData,
-  submitData,
-  abandonData,
-  submitCancel,
-} from "@/api/supply/policy";
-import RetailDetail from "./components/retail_detail";
-import RetailForm from "./components/retail_form";
-import RetailExamine from "./components/retail_examine";
-import RetailReturn from "./components/retail_return";
-import EditDateDialog from "@/components/Common/edit-date-dialog";
+import { abandonData, closeData, deleteList, editData, getList, submitCancel, submitData } from '@/api/supply/policy'
+import RetailDetail from './components/retail_detail'
+import RetailForm from './components/retail_form'
+import RetailExamine from './components/retail_examine'
+import RetailReturn from './components/retail_return'
+import EditDateDialog from '@/components/Common/edit-date-dialog'
 
-let that;
+let that
 export default {
   components: {
     RetailDetail,
     RetailForm,
     RetailExamine,
     RetailReturn,
-    EditDateDialog,
+    EditDateDialog
   },
   filters: {
     statusFilter(val) {
-      let obj = that.statusList.find((o) => o.value == val);
-      return obj ? obj.label : "";
-    },
+      const obj = that.statusList.find((o) => o.value == val)
+      return obj ? obj.label : ''
+    }
   },
   data() {
     return {
@@ -529,20 +520,20 @@ export default {
       listLoading: false, // 列表加载loading
       screenForm: {
         // 筛选表单数据
-        orderNum: "",
-        policyCode: "",
-        policyRemark: "",
-        jxsName: "",
-        date: "",
-        zbMan: "",
-        shMan: "",
-        status: "",
+        orderNum: '',
+        policyCode: '',
+        policyRemark: '',
+        jxsName: '',
+        date: '',
+        zbMan: '',
+        shMan: '',
+        status: ''
       },
       statusList: [
-        { label: "已保存", value: "SAVE" },
-        { label: "待审核", value: "WAIT" },
-        { label: "审核通过", value: "OK" },
-        { label: "审核驳回", value: "FAIL" },
+        { label: '已保存', value: 'SAVE' },
+        { label: '待审核', value: 'WAIT' },
+        { label: '审核通过', value: 'OK' },
+        { label: '审核驳回', value: 'FAIL' }
       ],
       queryItem: {},
       isShowDetail: false,
@@ -551,9 +542,9 @@ export default {
       isShowReturn: false,
       isShowEditDateDialog: false,
       dateForm: {
-        date: "",
-      },
-    };
+        date: ''
+      }
+    }
   },
   computed: {
     exParams() {
@@ -563,21 +554,21 @@ export default {
         policyCode: this.screenForm.policyCode,
         policyRemark: this.screenForm.policyRemark,
         customer: this.screenForm.jxsName,
-        startTime: this.screenForm.date ? this.screenForm.date[0] : "",
-        endTime: this.screenForm.date ? this.screenForm.date[1] : "",
+        startTime: this.screenForm.date ? this.screenForm.date[0] : '',
+        endTime: this.screenForm.date ? this.screenForm.date[1] : '',
         createBy: this.screenForm.zbMan,
         examineBy: this.screenForm.shMan,
-        type: 2, // 1:普通零售单,2:政策零售单
-      };
-    },
+        type: 2 // 1:普通零售单,2:政策零售单
+      }
+    }
   },
 
   beforeCreate() {
-    that = this;
+    that = this
   },
 
   created() {
-    this.getList();
+    this.getList()
   },
 
   methods: {
@@ -587,13 +578,17 @@ export default {
       // if(!btnRole) {return true}
       // let index = btnRole.indexOf(value);
       // return index >= 0;
-      return true;
+      return true
+    },
+    handleDelete(id) {
+      deleteList({ id }).then(res => {
+        this.$successMsg('删除成功')
+      })
     },
-
     // 查询列表
     getList() {
-      this.listLoading = true;
-      let params = {
+      this.listLoading = true
+      const params = {
         pageNum: this.currentPage,
         pageSize: this.pageSize,
         examineStatus: this.screenForm.status,
@@ -601,127 +596,127 @@ export default {
         policyCode: this.screenForm.policyCode,
         policyRemark: this.screenForm.policyRemark,
         customer: this.screenForm.jxsName,
-        startTime: this.screenForm.date ? this.screenForm.date[0] : "",
-        endTime: this.screenForm.date ? this.screenForm.date[1] : "",
+        startTime: this.screenForm.date ? this.screenForm.date[0] : '',
+        endTime: this.screenForm.date ? this.screenForm.date[1] : '',
         createBy: this.screenForm.zbMan,
         status: true,
         examineBy: this.screenForm.shMan,
-        type: 2, // 1:普通零售单,2:政策零售单
-      };
+        type: 2 // 1:普通零售单,2:政策零售单
+      }
       getList(params).then((res) => {
-        this.dataList = res.data.records;
-        this.listTotal = res.data.total;
-        this.listLoading = false;
-      });
+        this.dataList = res.data.records
+        this.listTotal = res.data.total
+        this.listLoading = false
+      })
     },
 
     // 提交筛选表单
     submitScreenForm() {
-      this.currentPage = 1;
-      this.getList();
+      this.currentPage = 1
+      this.getList()
     },
 
     // 重置筛选表单
     resetScreenForm() {
-      this.$refs.screenForm.resetFields();
-      this.currentPage = 1;
-      this.getList();
+      this.$refs.screenForm.resetFields()
+      this.currentPage = 1
+      this.getList()
     },
 
     // 更改每页数量
     handleSizeChange(val) {
-      this.pageSize = val;
-      this.currentPage = 1;
-      this.getList();
+      this.pageSize = val
+      this.currentPage = 1
+      this.getList()
     },
 
     // 更改当前页
     handleCurrentChange(val) {
-      this.currentPage = val;
-      this.getList();
+      this.currentPage = val
+      this.getList()
     },
 
     // 进入表单
     toForm(item) {
-      this.queryItem = item;
+      this.queryItem = item
 
-      this.isShowForm = true;
+      this.isShowForm = true
     },
 
     // 进入详情
     toDetail(item) {
-      this.queryItem = item;
-      this.isShowDetail = true;
+      this.queryItem = item
+      this.isShowDetail = true
     },
 
     // 进入审批
     toExamine(item) {
-      this.queryItem = item;
-      this.isShowExamine = true;
+      this.queryItem = item
+      this.isShowExamine = true
     },
 
     // 进入退订
     toReturn(item) {
-      this.queryItem = item;
-      this.isShowReturn = true;
+      this.queryItem = item
+      this.isShowReturn = true
     },
-// 弃审
+    // 弃审
     handleAbandon(id) {
-      abandonData({id}).then(res => {
-        this.$successMsg();
-        this.getList();
+      abandonData({ id }).then(res => {
+        this.$successMsg()
+        this.getList()
       })
     },
     backList() {
-      this.queryItem = {};
-      this.isShowDetail = false;
-      this.isShowForm = false;
-      this.isShowExamine = false;
-      this.isShowReturn = false;
+      this.queryItem = {}
+      this.isShowDetail = false
+      this.isShowForm = false
+      this.isShowExamine = false
+      this.isShowReturn = false
     },
 
     // 关闭
     handleClose(id) {
       closeData({ id }).then((res) => {
-        this.$successMsg();
-        this.getList();
-      });
+        this.$successMsg()
+        this.getList()
+      })
     },
 
     // 提审
     handleSubmit(id) {
       submitData({ id }).then((res) => {
-        this.$successMsg();
-        this.getList();
-      });
+        this.$successMsg()
+        this.getList()
+      })
     },
-    //撤回
+    // 撤回
     handleCancel(id) {
       submitCancel({ id }).then((res) => {
-        this.$successMsg();
-        this.getList();
-      });
+        this.$successMsg()
+        this.getList()
+      })
     },
     // 打开 修改订单日期
     editDate(item) {
-      this.editId = item.id;
-      this.dateForm.date = item.theTime.slice(0, 10);
-      this.isShowEditDateDialog = true;
+      this.editId = item.id
+      this.dateForm.date = item.theTime.slice(0, 10)
+      this.isShowEditDateDialog = true
     },
 
     // 提交 修改订单日期
     submitDateForm() {
       editData({
         id: this.editId,
-        theTime: this.dateForm.date + " 00:00:00",
+        theTime: this.dateForm.date + ' 00:00:00'
       }).then((res) => {
-        this.isShowEditDateDialog = false;
-        this.getList();
-        this.$successMsg("修改成功");
-      });
-    },
-  },
-};
+        this.isShowEditDateDialog = false
+        this.getList()
+        this.$successMsg('修改成功')
+      })
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped></style>