Parcourir la source

更改销售政策订单、销售政策条件添加

howie il y a 3 ans
Parent
commit
a0fac65a04

+ 32 - 15
src/views/basic_data/material/components/modify_list-apply.vue

@@ -99,7 +99,7 @@
                 <el-button
                   type="text"
                   class="textColor"
-                  @click="hanleDeleInd(scope.$index)"
+                  @click="hanleDeleInd(scope.$index,scope.row.cid)"
                   >删除</el-button
                 >
               </template>
@@ -195,7 +195,7 @@
             >
               <template slot-scope="scope">
                 <el-form-item>
-                  <el-input v-model="scope.row.unit"></el-input>
+                  <el-input disabled  v-model="scope.row.unit"></el-input>
                 </el-form-item>
               </template>
             </el-table-column>
@@ -915,21 +915,23 @@ export default {
   },
   methods: {
     handleSale(e, index,saleTypes) {
+
+      let saleArr = []
       this.rebateList = this.rebateList.filter((k) => {
-        return (
-          this.typeList.filter((i) => {
-               console.log(k,i);
+
+          saleArr = saleTypes.filter((i) => {
             return e == i.mainId;
+          })
+          return saleArr[0].id === k.saleTypeId
 
-          })[0].id === k.saleTypeId
-        );
       });
 
-      this.items[index].mainId = saleArr.mainId
-      this.items[index].mainName = saleArr.mainName
-      this.items[index].saleTypeId = saleArr.id
-      this.items[index].saleTypeName = saleName
-      this.$set(this.items[index], "rebateWallets", this.rebateList);
+      this.items[index].mainId = saleArr[0].mainId
+      this.items[index].mainName = saleArr[0].mainName
+      this.items[index].saleTypeId = saleArr[0].id
+      this.items[index].saleTypeName = saleArr[0].saleName
+      this.$set(this.items[index], "rebateList", this.rebateList);
+      console.log(this.rebateList,this.items[index]);
       this.fang = false;
     },
     // xua
@@ -1013,7 +1015,20 @@ export default {
     indexMethod(index) {
       console.log(index);
     },
-    hanleDeleInd(index) {
+    hanleDeleInd(index,id) {
+        if (id) {
+          const dataArr = JSON.parse(JSON.stringify(this.dataList))
+          for (let j = 0; j < dataArr.length; j++) {
+             if (id== dataArr[j].id) {
+
+                  dataArr[j].disabled = false
+                 this.$set(dataArr[j],'disabled',false)
+            }}
+
+            this.dataList = dataArr
+
+        }
+
       this.items.splice(index, 1);
     },
     handleDetermine() {
@@ -1027,7 +1042,7 @@ export default {
           this.items.push({
             baseUnitId: "",
             batchPrice: "",
-            unit: "",
+            unit: this.selectData[i].baseUnitId,
             billId: "",
             endDate: "",
             isPromote: "",
@@ -1130,8 +1145,10 @@ export default {
      */
     selectable: function (row, index) {
       // row.disabled == undefined 才能被选中
-      if (row.disabled == undefined) {
+      if (row.disabled == undefined || row.disabled == false) {
         return true;
+      }else{
+        return false
       }
       // 函数必须有返回值且是布尔值
       // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)

+ 44 - 51
src/views/sales_policy/components/AddCondition.vue

@@ -533,7 +533,7 @@ export default {
     handleSubmit() {
       var tableData = [];
 
-       this.newConditionBox.push(JSON.parse(JSON.stringify(this.conditionBox)))
+      this.newConditionBox.push(JSON.parse(JSON.stringify(this.conditionBox)));
       for (let i = 0; i < this.conditionBox.length; i++) {
         for (let j = 0; j < this.conditionBox[i].length; j++) {
           this.conditionBox[i][j].popType = i + 1;
@@ -587,15 +587,15 @@ export default {
       console.log(this.ids);
     },
     handleDeleteRow(index) {
-        if (this.arrIndex == index && this.ids.length) {
-          var arr=[];
-          for(var i = 0; i < this.conditionBox[index].length; i++){
-                if(this.ids.indexOf(this.conditionBox[index][i].id) == -1){
-                    arr.push(this.conditionBox[index][i]);
-                }
-            }
-        this.conditionBox[index] = []
-        this.$set(this.conditionBox,index,arr)
+      if (this.arrIndex == index && this.ids.length) {
+        var arr = [];
+        for (var i = 0; i < this.conditionBox[index].length; i++) {
+          if (this.ids.indexOf(this.conditionBox[index][i].id) == -1) {
+            arr.push(this.conditionBox[index][i]);
+          }
+        }
+        this.conditionBox[index] = [];
+        this.$set(this.conditionBox, index, arr);
       }
     },
     // 更改每页数量
@@ -626,49 +626,47 @@ export default {
         for (let j = 0; j < this.conditionBox.length; j++) {
           datas = [...datas, ...this.conditionBox[j]];
         }
-
-          if (this.newConditionBox.length) {
-                 this.conditList = res.data.records;
-            for (let j = 0; j < this.newConditionBox.length; j++) {
-              for (let o = 0; o < this.newConditionBox[j].length; o++) {
-                    if (o==index) {
-                              console.log(this.newConditionBox[j][o],'dier');
-                        for (let i = 0; i < res.data.records.length; i++) {
-                          console.log(this.newConditionBox[j][o],o,index,this.newConditionBox[j]);
-
-                            for (let k = 0; k < this.newConditionBox[j][o].length; k++) {
-                            if (this.newConditionBox[j][o][k].id == res.data.records[i].id) {
+    /**
+     * @value newConditionBox 首页保存的所有选中者,即条件1
+     * @value res.data.records,this.conditList 每次点击添加获取的最新数据
+     * @value disabled 添加条件都进行比较上一个条件或者所有条件当中的限定机型和配提机型,
+     * 如:上一个或者所有条件中已经存在disabled
+     */
+        if (this.newConditionBox.length) {
+          this.conditList = res.data.records;
+          for (let j = 0; j < this.newConditionBox.length; j++) {
+            for (let o = 0; o < this.newConditionBox[j].length; o++) {
+              if (o == index) {
+                console.log(this.newConditionBox[j][o], "dier");
+                for (let i = 0; i < res.data.records.length; i++) {
+                  for (let k = 0; k < this.newConditionBox[j][o].length; k++) {
+                    if (
+                      this.newConditionBox[j][o][k].id == res.data.records[i].id
+                    ) {
                       res.data.records[i].disabled = true;
-
                     }
-                       }
                   }
-
-              }else{
-                  this.conditList = res.data.records;
+                }
+              } else {
+                this.conditList = res.data.records;
               }
-
             }
-
-
           }
-           this.conditList = res.data.records;
-          } else {
-        const newData = datas
-        if (newData.length) {
-          for (let i = 0; i < res.data.records.length; i++) {
-            for (let k = 0; k < newData.length; k++) {
-              if (newData[k].id == res.data.records[i].id) {
-                res.data.records[i].disabled = true;
+          this.conditList = res.data.records;
+        } else {
+          const newData = datas;
+          if (newData.length) {
+            for (let i = 0; i < res.data.records.length; i++) {
+              for (let k = 0; k < newData.length; k++) {
+                if (newData[k].id == res.data.records[i].id) {
+                  res.data.records[i].disabled = true;
+                }
               }
             }
           }
+          this.conditList = res.data.records;
+          this.listTotal = res.data.total;
         }
-        this.conditList = res.data.records;
-        this.listTotal = res.data.total;
-          }
-
-
       });
     },
     handleSelectionAllChange(e) {
@@ -699,18 +697,16 @@ export default {
     },
     //去掉相同数据
     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));
     },
     handleDelete() {
       if (this.type == 2) {
-        this.conditList2 = this.resArr(this.conditList2,this.rightData)
+        this.conditList2 = this.resArr(this.conditList2, this.rightData);
         this.rightData = [];
       }
     },
     handleDiaSubmit() {
-
-
-          if (this.conditList2.length) {
+      if (this.conditList2.length) {
         for (let i = 0; i < this.conditionBox.length; i++) {
           if (i == this.arrIndex) {
             this.$set(this.conditionBox, i, [
@@ -724,9 +720,6 @@ export default {
       } else {
         this.$errorMsg("请选择内容");
       }
-
-
-
     },
     handleresale() {
       Object.assign(this.$data, this.$options.data());

+ 10 - 16
src/views/sales_policy/components/AddPolicy.vue

@@ -14,7 +14,7 @@
           <el-divider></el-divider>
           <el-form
             :model="searchForm"
-            :rules="rules"
+
             ref="searchForm"
             label-width="120px"
             size="small"
@@ -22,7 +22,7 @@
           >
             <el-row>
               <el-col :xs="24" :ms="12" :lg="12">
-                <el-form-item label="销售政策编号" prop="code">
+                <el-form-item label="销售政策编号" >
                   <el-input
                     disabled
                     v-model="searchForm.code"
@@ -67,7 +67,7 @@
                     <el-option
                       v-for="item in dictList"
                       :label="item.dictValue"
-                      :value="item.sysDictId"
+                      :value="item.dictCode"
                     ></el-option>
                   </el-select>
                 </el-form-item>
@@ -103,7 +103,7 @@
                 </el-form-item>
               </el-col>
               <el-col :xs="24" :ms="24" :lg="24">
-                <el-form-item label="政策封面图" prop="imgSrc">
+                <el-form-item label="政策封面图" >
                   <ImageUpload :fileList="fileList" :multiple="false" />
                 </el-form-item>
               </el-col>
@@ -357,12 +357,7 @@ export default {
         type: "",
       },
       listLoading: false,
-      rules: {
-        name: [
-          { required: true, message: "", trigger: "click" },
-          { min: 3, max: 5, message: "", trigger: "click" },
-        ],
-      },
+
       importFileList: [],
       fileList: [],
       options: {},
@@ -537,13 +532,12 @@ export default {
     },
     // 提交审核
     handleAddPolicy(policyCustomers) {
-      if (!this.conditionList.length) {
-           this.$errorMsg("请添加条件信息 ");
-           return
-      }
+      // if (!this.conditionList.length) {
+      //      this.$errorMsg("请添加条件信息 ");
+      //      return
+      // }
       if (policyCustomers.length) {
         var arr = [];
-
         policyCustomers.forEach((el) => {
           arr.push({
             customerId: el.id,
@@ -558,7 +552,7 @@ export default {
           });
         });
         this.dictList.forEach((k) => {
-          if (k.sysDictId == this.searchForm.mainId) {
+          if (k.dictCode == this.searchForm.mainId) {
             this.searchForm.mainName = k.dictValue;
           }
         });

+ 3 - 1
src/views/supply/policy/components/retail_examine.vue

@@ -18,7 +18,7 @@
              <el-date-picker
             v-model="detailData.theTime"
             type="datetime"
-            value-format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd HH:mm:ss"
             style="width: 100%"
             placeholder="选择日期"
           >
@@ -298,6 +298,7 @@ export default {
       mainForm: {
         status: true,
         remark: "",
+        theTime:''
       },
     };
   },
@@ -338,6 +339,7 @@ export default {
         id: this.listItem.id,
         examineStatus: this.mainForm.status ? "OK" : "FAIL",
         examineRemark: this.mainForm.remark,
+        theTime:this.detailData.theTime
       })
         .then((res) => {
           this.$successMsg("审批成功");

+ 177 - 99
src/views/supply/policy/components/retail_form2.vue

@@ -199,7 +199,7 @@
               size="small"
               @change="changeWallet(scope.$index)"
             >
-              <el-option label="全部" value=""></el-option>
+
               <el-option
                 v-for="item in scope.row.rebateWallets"
                 :key="item.customerWalletId"
@@ -253,7 +253,7 @@
               placeholder="选择现金钱包"
               size="small"
             >
-              <el-option label="全部" value=""></el-option>
+
               <el-option
                 v-for="item in scope.row.wallets"
                 :key="item.customerWalletId"
@@ -368,7 +368,7 @@
           <el-date-picker
             v-model="mainForm.date"
             type="datetime"
-            value-format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd HH:mm:ss"
             style="width: 100%"
             placeholder="选择日期"
           >
@@ -455,7 +455,7 @@
                   placeholder="选择销售类型"
                   style="width: 100%"
                 >
-                  <el-option label="全部" value=""></el-option>
+
                   <el-option
                     v-for="item in ztypeList"
                     :key="item.id"
@@ -476,93 +476,172 @@
             </el-col>
           </el-row>
         </el-form>
-        <el-row :gutter="20" style="margin: 10px 0">
-          {{ cusIndex > 0 ? "选择配提机型" : "选择限定机型" }}
-          {{ "(" + pop + ")" }}
-        </el-row>
-        <el-table
-          v-loading="listLoading"
-          :data="popDataArr[cusIndex]"
-          element-loading-text="Loading"
-          border
-          fit
-          highlight-current-row
-          @select-all="handleSelectionChange"
-          @selection-change="handleSelectionChange"
-          stripe
-        >
-          <el-table-column
-            align="center"
-            type="selection"
-            :selectable="selectable"
-            width="55"
+        <template v-if="!dataList.length">
+          <el-row :gutter="20" style="margin: 10px 0">
+            {{ cusIndex > 0 ? "选择配提机型" : "选择限定机型" }}
+            {{ "(" + pop + ")" }}
+          </el-row>
+          <el-table
+            v-loading="listLoading"
+            :data="popDataArr[cusIndex]"
+            element-loading-text="Loading"
+            border
+            fit
+            highlight-current-row
+            @select-all="handleSelectionChange"
+            @selection-change="handleSelectionChange"
+            stripe
           >
-          </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
+              type="selection"
+              :selectable="selectable"
+              width="55"
             >
-              <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 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>
+          <div style="margin: 10px 0">
+            <el-pagination
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="currentPage"
+              :page-sizes="[10]"
+              :page-size="10"
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="total"
             >
-              <template slot-scope="scope">
-                {{ scope.row.qty * scope.row.price || 0 }}
-              </template>
-            </el-table-column>
-            <el-table-column
-              v-else
+            </el-pagination>
+          </div>
+          <span slot="footer" class="dialog-footer">
+            <el-button type="primary" v-if="cusIndex > 0" @click="handleShang"
+              >上一步</el-button
+            >
+            <el-button
+              type="primary"
+              @click="handleCondition"
+              v-if="popArr.length != cusIndex + 1"
+              >下一步</el-button
+            >
+            <el-button
+              type="primary"
+              @click="hanlePopData"
+              v-if="popArr.length == cusIndex + 1"
+              >完成</el-button
+            >
+          </span>
+        </template>
+        <template v-else>
+          <el-table
+            v-loading="listLoading"
+            :data="dataList"
+            element-loading-text="Loading"
+            border
+            fit
+            highlight-current-row
+              @select-all="handleSelectionChange"
+            @selection-change="handleSelectionChange"
+            stripe
+          >
+              <el-table-column
               align="center"
-              :label="col.lable"
-              :prop="col.prop"
-              :min-width="col.widht"
-              show-overflow-tooltip
+              type="selection"
+              :selectable="selectable"
+              width="55"
             >
             </el-table-column>
-          </template>
-        </el-table>
-        <div style="margin: 10px 0">
-          <el-pagination
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page="currentPage"
-            :page-sizes="[10]"
-            :page-size="10"
-            layout="total, sizes, prev, pager, next, jumper"
-            :total="total"
-          >
-          </el-pagination>
-        </div>
-        <span slot="footer" class="dialog-footer">
-          <el-button type="primary" v-if="cusIndex > 0" @click="handleShang"
-            >上一步</el-button
-          >
-          <el-button
-            type="primary"
-            @click="handleCondition"
-            v-if="popArr.length != cusIndex + 1"
-            >下一步</el-button
-          >
-          <el-button
-            type="primary"
-            @click="hanlePopData"
-            v-if="popArr.length == cusIndex + 1"
-            >完成</el-button
-          >
-        </span>
+            <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>
+          <div style="margin: 10px 0">
+            <el-pagination
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="currentPage"
+              :page-sizes="[10]"
+              :page-size="10"
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="total"
+            >
+            </el-pagination>
+          </div>
+            <span slot="footer" class="dialog-footer">
+
+            <el-button
+              type="primary"
+              @click="hanlePopData"
+
+              >完成</el-button
+            >
+          </span>
+        </template>
       </template>
     </el-dialog>
   </div>
@@ -774,20 +853,21 @@ export default {
       });
     },
     hendleEdit(val, index) {
-      let params = {
-        id: this.cid,
-        theTime: this.mainForm.date,
-        mainId: this.mainForm.type,
-        mainName: this.mainForm.mainName,
-        remark: this.mainForm.remark,
-        type: 2,
-        retailOrderItemList: this.goodsList,
-        policyId: this.policyId,
-      };
-      editData(params).then((res) => {
-        this.$successMsg("编辑成功");
-        this.getDetail();
-      });
+      this.dialogVisible = false
+      // let params = {
+      //   id: this.cid,
+      //   theTime: this.mainForm.date,
+      //   mainId: this.mainForm.type,
+      //   mainName: this.mainForm.mainName,
+      //   remark: this.mainForm.remark,
+      //   type: 2,
+      //   retailOrderItemList: this.goodsList,
+      //   policyId: this.policyId,
+      // };
+      // editData(params).then((res) => {
+      //   this.$successMsg("编辑成功");
+      //   this.getDetail();
+      // });
     },
     //获取条件相对应的比列
     handleFactor(e) {
@@ -806,7 +886,7 @@ export default {
       if (this.screenForm.factorId) {
         this.getConditionList(this.policyConditionId, this.cusIndex + 1);
       } else {
-        this.$errorMsg("必须要条件");
+        this.getpolicyTypeList();
       }
     },
     // 获取某一个比例下的数据 ,查询popType 当前 this.cusIndex+1
@@ -996,7 +1076,6 @@ export default {
         type: "COMMONLY",
       }).then((res) => {
         this.xjWalletList = res.data;
-        console.log(res.data, "xxxxx");
       });
 
       getWalletList({
@@ -1004,7 +1083,6 @@ export default {
         type: "REBATE",
       }).then((res) => {
         this.flWalletList = res.data;
-        console.log(this.flWalletList, "xxccc");
       });
     },