Browse Source

政策订单

howie 3 years ago
parent
commit
c4200b221b

+ 61 - 1
src/api/supply/retail.js

@@ -125,7 +125,7 @@ export function submitCancel(params) {
     params
   })
 }
-
+// 销售类型
 export function typeList(params) {
   return request({
     url: '/sale/type/list',
@@ -133,3 +133,63 @@ export function typeList(params) {
     params
   })
 }
+
+
+
+// 销售政策
+export function policyList(params) {
+  return request({
+    url: '/policy/list',
+    method: 'get',
+    params
+  })
+}
+
+// 根据政策id和物料id反查政策条件
+export function getpolicyList(params) {
+  return request({
+    url: '/policy/condition/get',
+    method: 'get',
+    params
+  })
+}
+
+//政策条件的机型列表
+export function getConditionList(params) {
+  return request({
+    url: '/policy/condition/material/list',
+    method: 'get',
+    params
+  })
+}
+
+
+
+export function getpolicyTypeList(params) {
+  return request({
+    url: '/policy/type1/material/list',
+    method: 'get',
+    params
+  })
+}
+
+
+
+export function getMaterialTypeList(params) {
+  return request({
+    url: '/policy/material/list',
+    method: 'get',
+    params
+  })
+}
+
+
+
+
+export function getConditionDetail(params) {
+  return request({
+    url: '/policy/condition/detail',
+    method: 'get',
+    params
+  })
+}

+ 3 - 2
src/views/basic_data/warehouse/warehouse_site.vue

@@ -212,6 +212,7 @@
           <el-select
             v-model="diaLogForm.stockIds"
             multiple
+             filterable
             placeholder="请选择"
           >
             <el-option
@@ -311,8 +312,8 @@ export default {
       this.showDialogForm = true;
       this.type = 1;
       const params = {
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
+        pageNum: 1,
+        pageSize: -1,
         name: "",
       };
       getList(params).then((res) => {

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

@@ -441,11 +441,11 @@ export default {
         getConditionMaterialDetail({ id: this.id }).then((res) => {
           this.pop = res.data;
           while (i <= 2) {
-            // getConditionMaterialList({pageNum:1,pageSize:10,policyConditionId:this.id,popType:i}).then((res) => {
-            //   console.log(res, "比值");
-            //   i++;
-            // });
-            console.log(res, "比值");
+            getConditionMaterialList({pageNum:1,pageSize:10,policyConditionId:this.id,popType:i}).then((res) => {
+                this.conditionBoxs = res.data.records
+              i++;
+            });
+
             i++;
           }
         });
@@ -472,6 +472,7 @@ export default {
           this.conditionBox[i][j].popType = i + 1;
                this.conditionBox[i][j].policyId = this.comCode
                this.conditionBox[i][j].id = ''
+                  //  this.conditionBox[i][j].policyMaterialId =this.conditionBox[i][j].materialId
         }
         tableData = [...tableData, ...this.conditionBox[i]];
       }
@@ -524,12 +525,11 @@ export default {
     },
     getMaterialLists(index) {
       this.arrIndex = index;
-
       getMaterialList({
         pageNum: this.currentPage,
         pageSize: this.pageSize,
         saleTypeCode: this.saleTypeCode,
-        policyId: this.$parent.codeId,
+        policyId: this.comCode,
       }).then((res) => {
         this.conditList = res.data.records;
 

+ 5 - 48
src/views/sales_policy/components/AddPolicy.vue

@@ -68,16 +68,6 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <!-- <el-col :xs="24" :ms="12" :lg="12">
-            <el-form-item label="制单日期" prop="name">
-              <el-date-picker
-                v-model="searchForm.name"
-                type="date"
-                placeholder="制单日期"
-              >
-              </el-date-picker> </el-form-item
-          ></el-col> -->
-
             <el-col :xs="24" :ms="12" :lg="12">
               <el-form-item label="生效日期" prop="startTime">
                 <el-date-picker
@@ -179,41 +169,7 @@
           </el-table-column>
           <el-table-column label="支付钱包" align="center">
             <template slot-scope="scope">
-              <el-tag
-                type="danger"
-                size="small"
-                v-if="scope.row.walletCommonly == 1"
-              >
-                允许普通钱包
-              </el-tag>
-              <el-tag type="danger" size="small" v-else
-                >不允许使用普通钱包</el-tag
-              >
-              <el-tag
-                type="danger"
-                size="small"
-                v-if="scope.row.walletDeduct == 1"
-              >
-                允许抵扣钱包</el-tag
-              >
-              <el-tag type="danger" size="small" v-else>不允许抵扣钱包</el-tag>
-              <el-tag
-                type="danger"
-                size="small"
-                v-if="scope.row.walletRebate == 1"
-              >
-                允许返利钱包
-              </el-tag>
-              <el-tag type="danger" size="small" v-else>不允许返利钱包</el-tag>
-              <el-tag
-                type="danger"
-                size="small"
-                v-if="scope.row.walletSpecial == 1"
-                >允许特殊钱包</el-tag
-              >
-              <el-tag type="danger" size="small" v-else>
-                不允许特殊钱包
-              </el-tag>
+                <el-tag type="success" size="small" v-for=" item  in  scope.row.walletRelaList">{{item.walletName}}</el-tag>
             </template>
           </el-table-column>
           <el-table-column fixed="right" label="操作" align="center">
@@ -379,7 +335,7 @@ export default {
     },
   }),
   created() {
-    console.log("vshow");
+
     this.getCommonApi();
     if (this.$parent.isFlag) {
       const params = {
@@ -388,7 +344,7 @@ export default {
       // 获取条件政策
       getConditionList(params).then((res) => {
         this.conditionList = res.data;
-        console.log(789, "jsfdkljslkj");
+        console.log(res.data, "jsfdkljslkj");
       });
       // this.handletwoList()
     }
@@ -523,7 +479,7 @@ export default {
           examineStatus: "",
 
           id: "",
-          imgSrc: this.fileList[0].url,
+          imgSrc: this.fileList.length?this.fileList[0].url:'',
           policyCustomers: arr,
           remark: "",
           status: true,
@@ -535,6 +491,7 @@ export default {
           console.log(res);
           this.$successMsg("新增成功");
           this.fileList = [];
+          this.$parent.getList()
           this.$parent.isShow = 1;
         });
         return;

+ 2 - 3
src/views/supply/policy/components/retail_detail.vue

@@ -1,7 +1,6 @@
 <template>
   <div class="detail-container">
     <el-page-header @back="goBack" content="详情"></el-page-header>
-
     <div class="main-title">
       <div class="title">提货进度</div>
     </div>
@@ -115,7 +114,7 @@
         </el-row>
       </div>
     </div>
-    
+
     <div class="page-footer">
       <div class="footer" :class="classObj">
         <el-button type="primary" @click="openDeliverDialog">直调发货</el-button>
@@ -305,4 +304,4 @@ export default {
       width: 500px;
     }
   }
-</style>
+</style>

+ 469 - 191
src/views/supply/policy/components/retail_form.vue

@@ -20,7 +20,34 @@
       <el-row :gutter="20">
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="订单号" prop="id">
-            <el-input v-model="mainForm.id" placeholder="订单号"></el-input>
+            <el-input
+              v-model="mainForm.id"
+              placeholder="订单号"
+              readonly
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col
+          :xs="24"
+          :sm="12"
+          :lg="8"
+          v-if="!listItem"
+          @click.native="handleShow"
+        >
+          <el-form-item label="销售政策编号" prop="policyCode">
+            <el-input
+              v-model="mainForm.policyCode"
+              placeholder="销售政策编号"
+              readonly
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8" v-else>
+          <el-form-item label="销售政策编号" prop="policyCode">
+            <el-input
+              v-model="mainForm.policyCode"
+              placeholder="销售政策编号"
+            ></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
@@ -51,33 +78,17 @@
             </el-select>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row :gutter="20">
-        <el-col
-          :xs="24"
-          :sm="12"
-          :lg="8"
-          v-if="!listItem"
-          @click.native="handleShow"
-        >
-          <el-form-item label="销售政策编号" prop="policyCode"   >
-            <el-input
-
-              v-model="mainForm.policyCode"
-              placeholder="销售政策编号"
-              readonly
-            ></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :xs="24" :sm="12" :lg="8" v-else>
-          <el-form-item label="销售政策编号" prop="policyCode">
+        <el-col :xs="24" :sm="16" :lg="16">
+          <el-form-item label="备注" prop="remark">
             <el-input
-              v-model="mainForm.policyCode"
-              placeholder="销售政策编号"
+              v-model="mainForm.remark"
+              placeholder="请输入备注"
             ></el-input>
           </el-form-item>
         </el-col>
-
+      </el-row>
+      <el-row :gutter="20">
+        <!--
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="销售政策" prop="id">
             <el-select
@@ -101,9 +112,9 @@
               placeholder="销售政策说明"
             ></el-input>
           </el-form-item>
-        </el-col>
+        </el-col> -->
       </el-row>
-
+      <!--
       <el-row :gutter="20">
         <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="业务员" prop="serviceName">
@@ -121,7 +132,7 @@
             ></el-input>
           </el-form-item>
         </el-col>
-      </el-row>
+      </el-row> -->
     </el-form>
 
     <div class="main-title">
@@ -413,100 +424,267 @@
       </div>
     </div>
 
-    <el-dialog title="添加产品" :visible.sync="isShowDialog" width="80%">
-      <el-form
-        ref="screenForm"
-        :model="screenForm"
-        size="small"
-        label-position="left"
-      >
-        <el-row :gutter="20">
-          <el-col :xs="12" :sm="6" :lg="6">
-            <el-form-item prop="type">
-              <el-select
-                v-model="screenForm.type"
-                placeholder="选择品类"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in typeList"
-                  :key="item.dictCode"
-                  :label="item.dictValue"
-                  :value="item.dictCode"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="12" :sm="6" :lg="6">
-            <el-form-item prop="salesType">
-              <el-select
-                v-model="screenForm.salesType"
-                placeholder="选择销售类型"
-                style="width: 100%"
+    <el-dialog :visible.sync="isShowDialog" width="80%">
+      <template v-if="!cusIndex">
+        <el-form
+          :model="screenForm"
+          ref="screenForm"
+          label-width="120px"
+          size="small"
+        >
+          <el-row :gutter="20">
+            <el-col :xs="24" :sm="8" :lg="8">
+              <el-form-item label="销售政策">
+                <el-select
+                  v-model="screenForm.policyId"
+                  placeholder="选择销售政策"
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in policyList"
+                    :key="item.code"
+                    :label="item.title"
+                    :value="item.code"
+                  ></el-option>
+                </el-select> </el-form-item
+            ></el-col>
+            <el-col :xs="24" :sm="8" :lg="8">
+              <el-form-item label="销售类型">
+                <el-select
+                  v-model="screenForm.saleTypeCode"
+                  placeholder="选择销售类型"
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in ztypeList"
+                    :key="item.id"
+                    :label="item.saleName"
+                    :value="item.id"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="24" :sm="8" :lg="8" class="tr">
+              <el-button
+                type="primary"
+                size="small"
+                @click="handlePolicyTypeList"
+                >查询</el-button
               >
-                <el-option
-                  v-for="item in salesTypeList"
-                  :key="item.id"
-                  :label="item.saleName"
-                  :value="item.id"
-                ></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="12" :sm="6" :lg="6">
-            <el-form-item prop="proNum">
-              <el-input
-                v-model="screenForm.proNum"
-                placeholder="请输入产品编码"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="12" :sm="6" :lg="6">
-            <el-form-item prop="proName">
-              <el-input
-                v-model="screenForm.proName"
-                placeholder="请输入产品名称"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="12" :sm="6" :lg="6">
-            <el-form-item prop="proModel">
-              <el-input
-                v-model="screenForm.proModel"
-                placeholder="请输入产品型号"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="12" :sm="6" :lg="6">
-            <el-form-item prop="price1" style="display: flex">
-              <el-input
-                v-model="screenForm.price1"
-                placeholder="请输入价格"
-                style="width: 46%"
-              ></el-input>
-              <span> - </span>
-              <el-input
-                v-model="screenForm.price2"
-                placeholder="请输入价格"
-                style="width: 46%"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="12" :sm="12" :lg="12" 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-col>
+          </el-row>
+        </el-form>
+        <el-row :gutter="20" style="margin: 10px 0"> 选择限定机型 </el-row>
+        <el-table
+          v-loading="listLoading"
+          :data="dataList"
+          element-loading-text="Loading"
+          border
+          fit
+          highlight-current-row
+          stripe
+        >
+          <el-table-column align="center" width="55"
+            ><template slot-scope="scope">
+              <el-radio
+                v-model="radio"
+                :label="
+                  scope.row.id +
+                  '&' +
+                  scope.row.policyId +
+                  '&' +
+                  scope.row.materialId +
+                  '&' +
+                  scope.row.policyConditionId
+                "
+                >{{ "" }}</el-radio
               >
-            </el-form-item>
-          </el-col>
+            </template>
+          </el-table-column>
+          <template v-for="col in columns">
+            <el-table-column
+              v-if="col.num"
+              align="center"
+              :label="col.lable"
+              :prop="col.prop"
+              :min-width="col.widht"
+              show-overflow-tooltip
+            >
+              <template slot-scope="scope">
+                <el-input v-model="scope.row.qty" size="small"></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column
+              v-else-if="col.jie"
+              align="center"
+              :label="col.lable"
+              :prop="col.prop"
+              :min-width="col.widht"
+              show-overflow-tooltip
+            >
+              <template slot-scope="scope">
+                {{ scope.row.qty * scope.row.price || 0 }}
+              </template>
+            </el-table-column>
+            <el-table-column
+              v-else
+              align="center"
+              :label="col.lable"
+              :prop="col.prop"
+              :min-width="col.widht"
+              show-overflow-tooltip
+            >
+            </el-table-column>
+          </template>
+        </el-table>
+        <span slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitAddGoods">下一步</el-button>
+        </span>
+      </template>
+      <template v-else>
+        <el-form
+          :model="screenForm"
+          ref="screenForm"
+          label-width="120px"
+          size="small"
+        >
+          <el-row :gutter="20">
+            <el-col :xs="24" :sm="8" :lg="8">
+              <el-form-item label="销售政策">
+                <el-select
+                  v-model="screenForm.policyId"
+                  placeholder="选择销售政策"
+                  disabled
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in policyList"
+                    :key="item.code"
+                    :label="item.title"
+                    :value="item.code"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="24" :sm="8" :lg="8">
+              <el-form-item>
+                <el-input
+                  v-model="screenForm.type"
+                  placeholder="产品编码"
+                  size="small"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="24" :sm="8" :lg="8">
+              <el-form-item>
+                <el-input
+                  v-model="screenForm.type"
+                  placeholder="产品名称"
+                  size="small"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="24" :sm="8" :lg="8">
+              <el-form-item label="销售类型">
+                <el-select
+                  v-model="screenForm.type"
+                  placeholder="选择销售类型"
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in ztypeList"
+                    :key="item.id"
+                    :label="item.saleName"
+                    :value="item.id"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="24" :sm="8" :lg="8" class="tr">
+              <el-button type="primary" size="small">查询</el-button>
+            </el-col>
+          </el-row>
+        </el-form>
+        <el-row type="flex" :gutter="20">
+          <el-col>已选择限定机型</el-col>
+          <el-col></el-col>
+          <el-col></el-col>
+          <el-col></el-col>
+          <el-col></el-col>
         </el-row>
-      </el-form>
-
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="closeDialog">取 消</el-button>
-        <el-button type="primary" @click="submitAddGoods">确 定</el-button>
-      </span>
+        <template v-for="(item, index) in popArr">
+          <el-table
+            v-if="index + 1 == cusIndex"
+            v-loading="listLoading"
+            :data="popDataArr[cusIndex - 1]"
+            element-loading-text="Loading"
+            border
+            fit
+            highlight-current-row
+            stripe
+          >
+            <el-table-column align="center" width="55"
+              ><template slot-scope="scope">
+                <el-radio
+                  v-model="radioObj['radio' + cusIndex]"
+                  :label="scope.row.id"
+                  >{{ "" }}</el-radio
+                >
+              </template>
+            </el-table-column>
+            <template v-for="col in columns">
+              <el-table-column
+                v-if="col.num"
+                align="center"
+                :label="col.lable"
+                :prop="col.prop"
+                :min-width="col.widht"
+                show-overflow-tooltip
+              >
+                <template slot-scope="scope">
+                  <el-input v-model="scope.row.qty" size="small"></el-input>
+                </template>
+              </el-table-column>
+              <el-table-column
+                v-else-if="col.jie"
+                align="center"
+                :label="col.lable"
+                :prop="col.prop"
+                :min-width="col.widht"
+                show-overflow-tooltip
+              >
+                <template slot-scope="scope">
+                  {{ scope.row.qty * scope.row.price || 0 }}
+                </template>
+              </el-table-column>
+              <el-table-column
+                v-else
+                align="center"
+                :label="col.lable"
+                :prop="col.prop"
+                :min-width="col.widht"
+                show-overflow-tooltip
+              >
+              </el-table-column>
+            </template>
+          </el-table>
+        </template>
+        <span slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="cusIndex -= 1">上一步</el-button>
+          <el-button
+            type="primary"
+            @click="handleCondition()"
+            v-if="popArr.length != cusIndex"
+            >下一步</el-button
+          >
+          <el-button
+            type="primary"
+            @click="hanlePopData"
+            v-if="popArr.length == cusIndex"
+            >完成</el-button
+          >
+        </span>
+      </template>
     </el-dialog>
   </div>
 </template>
@@ -520,8 +698,13 @@ import {
   getGoodsList,
   getWalletList,
   getWarehouseList,
+  policyList,
   checkStock,
   typeList,
+  getpolicyList,
+  getConditionList,
+  getConditionDetail,
+  getpolicyTypeList,
 } from "@/api/supply/retail";
 import { getDictList } from "@/api/common";
 import { findElem } from "@/utils/util";
@@ -550,6 +733,17 @@ export default {
   },
   data() {
     return {
+      tableData: [
+        {
+          date: "2016-05-03",
+          name: "王小虎",
+          address: "上海市普陀区金沙江路 1518 弄",
+        },
+      ],
+      cusIndex: 0,
+      radio: "",
+      pop: "",
+      popArr: [],
       mainForm: {
         id: "",
         date: "",
@@ -558,6 +752,7 @@ export default {
         remark: "",
         policyCode: "",
         policyRemark: "",
+        policyId: "",
       },
       mainFormRules: {
         date: [
@@ -566,18 +761,12 @@ export default {
         type: [{ required: true, message: "请选择品类", trigger: "change" }],
       },
       goodsList: [],
-
       warehouseList: [],
       warehouseValue: "",
       isShowDialog: false,
       screenForm: {
-        type: "",
-        salesType: "",
-        proNum: "",
-        proName: "",
-        proModel: "",
-        price1: "",
-        price2: "",
+        policyId: "",
+        saleTypeCode: "",
       },
       currentPage: 1,
       listTotal: 0,
@@ -586,12 +775,49 @@ export default {
       ztypeList: [],
       leftGoodsList: [],
       rightGoodsList: [],
-
       leftSelection: [],
       rightSelection: [],
-
+      policyList: [],
       xjWalletList: [],
       flWalletList: [],
+      dataList: [],
+      columns: [
+        {
+          prop: "saleTypeName",
+          lable: "销售类型",
+          widht: 160,
+        },
+        {
+          prop: "materialName",
+          lable: "货品名称",
+          widht: 160,
+        },
+        {
+          prop: "specification",
+          lable: "规格型号",
+          widht: 160,
+        },
+
+        {
+          prop: "qty",
+          lable: "数量",
+          widht: 160,
+          num: true,
+        },
+        {
+          prop: "price",
+          lable: "单价",
+          widht: 160,
+        },
+        {
+          prop: "zong",
+          lable: "金额",
+          jie: true,
+        },
+      ],
+      listLoading: false,
+      popDataArr: [],
+      radioObj: {},
     };
   },
 
@@ -611,6 +837,7 @@ export default {
     this.getDictList();
     this.getWalletList();
     this.getWarehouseList();
+    this.getPolicyList();
     this.getTypeList();
     if (this.listItem) {
       this.getDetail();
@@ -622,7 +849,6 @@ export default {
     goBack() {
       this.$emit("backListFormDetail");
     },
-
     // 获取详情
     getDetail() {
       getDetail({ id: this.listItem.id }).then((res) => {
@@ -637,6 +863,15 @@ export default {
         this.goodsList = data.retailOrderItemList;
       });
     },
+    getPolicyList() {
+      policyList({
+        pageNum: 1,
+        pageSize: -1,
+      }).then((res) => {
+        console.log(res, "tyep");
+        this.policyList = res.data.records;
+      });
+    },
     getTypeList() {
       const params = {
         pageNum: 1,
@@ -649,6 +884,12 @@ export default {
         this.ztypeList = res.data.records;
       });
     },
+    handleSelectiontAllChange(e) {
+      console.log(e);
+    },
+    handleSelectionChange(e) {
+      console.log(e);
+    },
     // 获取仓库列表
     getWarehouseList() {
       getWarehouseList({
@@ -658,9 +899,35 @@ export default {
         this.warehouseList = res.data.records;
       });
     },
-    handleShow(){
-      this.isShowDialog = true
-      console.log(11111);
+    // 获取限定机型
+    getpolicyTypeList() {
+      getpolicyTypeList({
+        pageNum: 1,
+        pageSize: 10,
+        policyId: this.screenForm.policyId,
+        saleTypeCode: this.screenForm.saleTypeCode,
+      }).then((res) => {
+        for (let i = 0; i < res.data.records.length; i++) {
+          res.data.records[i].qty = 1;
+        }
+        this.dataList = res.data.records;
+      });
+    },
+    getMaterialTypeList() {
+      getMaterialTypeList({
+        pageNum: 1,
+        pageSize: 10,
+        policyId: this.screenForm.policyId,
+        saleTypeCode: this.screenForm.saleTypeCode,
+      }).then((res) => {
+        console.log(res, 1111);
+      });
+    },
+    handlePolicyTypeList() {
+      this.getpolicyTypeList();
+    },
+    handleShow() {
+      this.isShowDialog = true;
     },
     // 获取钱包列表
     getWalletList() {
@@ -779,54 +1046,6 @@ export default {
       this.isShowDialog = false;
     },
 
-    // 左侧列表选择
-    leftSelectionChange(val) {
-      this.leftSelection = val;
-    },
-
-    // 右侧列表选择
-    rightSelectionChange(val) {
-      this.rightSelection = val;
-    },
-
-    // 数组去重
-    delRepeat(arr1, arr2) {
-      let allArr = arr1.concat(arr2); // 两个数组对象合并
-      let newArr = []; // 存放去重后数据的新数组
-      for (let i = 0; i < allArr.length; i++) {
-        // 循环allArr数组对象的内容
-        let flag = true; // 建立标记,判断数据是否重复,true为不重复
-        for (let j = 0; j < newArr.length; j++) {
-          // 循环新数组的内容
-          if (allArr[i].materialId == newArr[j].materialId) {
-            // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
-            flag = false;
-          }
-        }
-        if (flag) {
-          // 判断是否重复
-          newArr.push(allArr[i]); // 不重复的放入新数组。  新数组的内容会继续进行上边的循环。
-        }
-      }
-      return newArr;
-    },
-
-    // 全部添加
-    addAllGoods() {
-      this.rightGoodsList = this.delRepeat(
-        this.leftGoodsList,
-        this.rightGoodsList
-      );
-    },
-
-    // 添加
-    addGoods() {
-      this.rightGoodsList = this.delRepeat(
-        this.leftSelection,
-        this.rightGoodsList
-      );
-    },
-
     // 删除
     deleteGoods() {
       let rightGoodsList = this.rightGoodsList;
@@ -839,20 +1058,78 @@ export default {
         }
       }
     },
-
-    // 全部删除
-    deleteAllGoods() {
-      this.rightGoodsList = [];
+    handleCondition() {
+      if (Object.values(this.radioObj)[this.cusIndex - 1] !== "") {
+        this.popArr.length >= this.cusIndex ? (this.cusIndex += 1) : "";
+        const params = this.radio.split("&");
+        this.getConditionList(params[3], this.cusIndex);
+        return;
+      } else {
+        this.$errorMsg("请选择");
+      }
     },
-
     // 确定 添加产品
     submitAddGoods() {
-      this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
-      this.isShowDialog = false;
-      this.leftGoodsList = [];
-      this.rightGoodsList = [];
+      if (this.radio) {
+        const params = this.radio.split("&");
+        this.screenForm.policyId = params[1];
+        this.mainForm.policyId = params[1];
+        this.cusIndex += 1;
+        getpolicyList({
+          materialId: params[2],
+          policyId: params[1],
+        }).then((res) => {
+          this.pop = res.data.pop;
+          this.popArr = res.data.pop.split(":");
+          for (let i = 0; i < this.popArr.length; i++) {
+            this.$set(this.radioObj, "radio" + (i + 1), "");
+          }
+          console.log(this.radioObj);
+          this.getConditionList(params[3], this.cusIndex);
+        });
+      } else {
+        this.$errorMsg("请选择");
+      }
+    },
+    getConditionList(policyConditionId, popType) {
+      getConditionList({
+        pageNum: 1,
+        pageSize: 10,
+        policyConditionId,
+        popType,
+      }).then((res) => {
+        for (let i = 0; i < res.data.records.length; i++) {
+          res.data.records[i].qty = 1;
+        }
+        if (this.popDataArr.length) {
+          this.popDataArr.splice(this.cusIndex - 1, 1);
+        }
+        if (this.cusIndex == 0) {
+          this.popDataArr = [];
+        }
+        this.popDataArr.push(res.data.records);
+        console.log(this.popDataArr, "[]", this.radioObj);
+      });
+    },
+    hanlePopData() {
+      if (!Object.values(this.radioObj).includes("")) {
+        let arrData = [];
+        for (let i = 0; i < this.popDataArr.length; i++) {
+          arrData = [...arrData, ...this.popDataArr[i]];
+        }
+        for (let j = 0; j < arrData.length; j++) {
+          for (const key in this.radioObj) {
+            if (arrData[j].id == this.radioObj[key]) {
+              this.goodsList = [...this.goodsList, arrData[j]];
+            }
+          }
+        }
+        this.cusIndex = 0
+        this.isShowDialog = false;
+      } else {
+        this.$errorMsg("请选择");
+      }
     },
-
     // 删除产品
     deleteItem(index) {
       this.goodsList.splice(index, 1);
@@ -915,8 +1192,9 @@ export default {
             mainId: this.mainForm.type,
             mainName,
             remark: this.mainForm.remark,
-            type: 1, // 1:普通零售单,2:政策零售单
+            type: 2, // 1:普通零售单,2:政策零售单
             retailOrderItemList: this.goodsList,
+            policyId: this.screenForm.policyId,
           };
           if (this.listItem) {
             params.id = this.listItem.id;

+ 1 - 1
src/views/supply/policy/policy_list.vue

@@ -893,7 +893,7 @@ export default {
         endTime: this.screenForm.date ? this.screenForm.date[1] : "",
         createBy: this.screenForm.zbMan,
         examineBy: this.screenForm.shMan,
-        type: 1, // 1:普通零售单,2:政策零售单
+        type: 2, // 1:普通零售单,2:政策零售单
       };
       getList(params).then((res) => {
         this.dataList = res.data.records;

+ 7 - 7
src/views/supply/retail/components/retail_form.vue

@@ -8,11 +8,11 @@
 
     <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="80px" size="small" label-position="right">
       <el-row :gutter="20">
-        <el-col :xs="24" :sm="12" :lg="8" v-if="listItem">
+        <!-- <el-col :xs="24" :sm="12" :lg="8" v-if="listItem">
           <el-form-item label="订单号" prop="id">
             <el-input v-model="listItem.id" readonly></el-input>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
           <el-form-item label="单据日期" prop="date">
             <el-date-picker
@@ -151,7 +151,7 @@
         </el-table-column>
       </el-table>
     </div>
-    
+
     <div class="page-footer">
       <div class="footer" :class="classObj">
         <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
@@ -248,7 +248,7 @@
         </div>
       </div>
 
-      
+
       <span slot="footer" class="dialog-footer">
         <el-button @click="closeDialog">取 消</el-button>
         <el-button type="primary" @click="submitAddGoods">确 定</el-button>
@@ -318,7 +318,7 @@ export default {
       listTotal: 0,
       salesTypeList: [],
       typeList: [],
-      
+
       leftGoodsList: [],
       rightGoodsList: [],
 
@@ -602,7 +602,7 @@ export default {
         }
       })
     },
-    
+
     // 保存
     clickSubmitForm() {
       this.$refs.mainForm.validate((valid) => {
@@ -681,4 +681,4 @@ export default {
       }
     }
   }
-</style>
+</style>