Преглед на файлове

【新增】家用工程订单-添加产品

莫绍宝 преди 3 години
родител
ревизия
397b940e9b

+ 8 - 8
src/views/supply/adjust/components/adjust_detail.vue

@@ -30,6 +30,10 @@
             <div class="value">{{detailData.orderType | typeFilter}}</div>
           </el-col>
           <el-col :span="8" class="item">
+            <div class="label">工程编号</div>
+            <div class="value">{{detailData.projectNo}}</div>
+          </el-col>
+          <el-col :span="16" class="item">
             <div class="label">经销商名称</div>
             <div class="value">{{detailData.customerName}}</div>
           </el-col>
@@ -38,10 +42,6 @@
             <div class="value">{{detailData.serviceName}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">工程编号</div>
-            <div class="value">{{detailData.projectNo}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
             <div class="label">币种</div>
             <div class="value">{{detailData.amountType}}</div>
           </el-col>
@@ -61,15 +61,15 @@
             <div class="label">项目名称</div>
             <div class="value">{{detailData.projectName}}</div>
           </el-col>
-          <el-col :span="16" class="item">
-            <div class="label">备注</div>
-            <div class="value">{{detailData.remark}}</div>
-          </el-col>
           <el-col :span="8" class="item">
             <div class="label">厂工程编码</div>
             <div class="value">{{detailData.factoryNo}}</div>
           </el-col>
           <el-col :span="16" class="item">
+            <div class="label">备注</div>
+            <div class="value">{{detailData.remark}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
             <div class="label">文件编号</div>
             <div class="value">{{detailData.fileNo}}</div>
           </el-col>

+ 2 - 2
src/views/supply/apply/components/apply_detail.vue

@@ -24,7 +24,7 @@
           <div class="label">经销商编号</div>
           <div class="value">{{detailData.customerNumber}}</div>
         </el-col>
-        <el-col :span="8" class="item">
+        <el-col :span="16" class="item">
           <div class="label">经销商名称</div>
           <div class="value">{{detailData.customerName}}</div>
         </el-col>
@@ -32,7 +32,7 @@
           <div class="label">仓库</div>
           <div class="value">{{detailData.correspondName}}</div>
         </el-col>
-        <el-col :span="24" class="item">
+        <el-col :span="16" class="item">
           <div class="label">备注</div>
           <div class="value">{{detailData.remark}}</div>
         </el-col>

+ 2 - 2
src/views/supply/apply/components/apply_examine.vue

@@ -24,7 +24,7 @@
           <div class="label">经销商编号</div>
           <div class="value">{{detailData.customerNumber}}</div>
         </el-col>
-        <el-col :span="8" class="item">
+        <el-col :span="16" class="item">
           <div class="label">经销商名称</div>
           <div class="value">{{detailData.customerName}}</div>
         </el-col>
@@ -32,7 +32,7 @@
           <div class="label">仓库</div>
           <div class="value">{{detailData.correspondName}}</div>
         </el-col>
-        <el-col :span="24" class="item">
+        <el-col :span="16" class="item">
           <div class="label">备注</div>
           <div class="value">{{detailData.remark}}</div>
         </el-col>

+ 313 - 41
src/views/supply/engin/components/home_form.vue

@@ -145,6 +145,8 @@
           <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
         </el-select>
         <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
+        <el-divider direction="vertical"></el-divider>
+        <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
       </div>
     </div>
 
@@ -321,11 +323,91 @@
       </div>
     </el-dialog>
 
+    <el-dialog title="添加产品" :visible.sync="isShowGoodsDialog" width="80%">
+      <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
+        <el-row :gutter="20">
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item prop="proNum">
+              <el-input v-model="goodsScreenForm.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="goodsScreenForm.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="goodsScreenForm.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="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%"></el-input>
+              <span> - </span>
+              <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="24" :lg="24" class="tr">
+            <el-form-item label="">
+              <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
+              <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div class="tables">
+        <div class="table">
+          <el-table :data="leftGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="leftSelectionChange">
+            <el-table-column align="center" type="selection" width="55" :selectable='checkboxSelect'></el-table-column>
+            <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="产品名称" prop="name" 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="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
+          </el-table>
+          <div class="pagination clearfix" style="margin-top: 10px">
+            <div class="fr">
+              <el-pagination
+                @current-change="handleTableCurrentChange"
+                :current-page="currentPage"
+                :page-size="10"
+                background
+                layout="prev, pager, next"
+                :total="listTotal">
+              </el-pagination>
+            </div>
+          </div>
+        </div>
+        <div class="buttons">
+          <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
+          <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
+          <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
+          <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
+        </div>
+        <div class="table">
+          <el-table :data="rightGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="rightSelectionChange">
+            <el-table-column align="center" type="selection" width="55"></el-table-column>
+            <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="产品名称" prop="name" 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="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
+          </el-table>
+        </div>
+      </div>
+
+
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeDialog">取 消</el-button>
+        <el-button type="primary" @click="submitAddGoods">确 定</el-button>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import { getOrderDetail, getHomeLoginList, getHomeLoginDetail, getWarehouseList, addHome, editHome, submitHome, checkStock, getWalletList } from "@/api/supply/engin";
+import { getOrderDetail, getHomeLoginList, getHomeLoginDetail, getWarehouseList, addHome, editHome, submitHome, checkStock, getRetailProductList } from "@/api/supply/engin";
 import { getDictList, getTypeList } from '@/api/common'
 
 let that
@@ -407,6 +489,23 @@ export default {
 
       warehouseList: [],
       warehouseValue: '',
+
+      isShowGoodsDialog: false,
+      goodsScreenForm: {
+        proNum: '',
+        proName: '',
+        proModel: '',
+        price1: '',
+        price2: '',
+      },
+      currentPage: 1,
+      listTotal: 0,
+
+      leftGoodsList: [],
+      rightGoodsList: [],
+
+      leftSelection: [],
+      rightSelection: [],
     }
   },
 
@@ -482,46 +581,6 @@ export default {
       })
     },
 
-    // 获取详情
-    getDetail() {
-      getOrderDetail({id: this.editId}).then(res => {
-        let data = res.data;
-        this.mainForm.orderNum = data.enginOrderId;
-        this.mainForm.orderDate = data.orderDate;
-        this.mainForm.type = data.mainId;
-        this.mainForm.jxsNum = data.customerNumber;
-        this.mainForm.jxsName = data.customerName;
-        this.mainForm.loginNum = data.refEnginRecordNo;
-        this.mainForm.enginName = data.refProjectName;
-        this.mainForm.loginType = data.refPromiseStatus;
-        this.mainForm.factoryNum = data.refFactoryNo;
-        this.mainForm.company = data.refUseUnit;
-        this.mainForm.saleType = data.saleTypeId;
-        this.mainForm.contactMan = data.refLinkman;
-        this.mainForm.tel = data.refTel;
-        this.mainForm.phone = data.refPhone;
-        this.mainForm.address = data.refInstallAddress;
-        this.mainForm.greeRemark = data.note2;
-        this.mainForm.greeReply = data.note1;
-        this.mainForm.remark = data.remark;
-        this.mainForm.createMan = data.createName;
-        this.mainForm.createDate = data.createTime;
-        this.mainForm.fileNum = data.fileNo;
-
-        data.items.forEach(item => {
-          item.status1 = '';
-          item.status2 = '';
-          item.rebateWallets = item.customerWalletList.filter(item => {
-            return item.type === 'REBATE';
-          });
-          item.wallets = item.customerWalletList.filter(item => {
-            return item.type === 'COMMONLY';
-          });
-        })
-        this.goodsList = data.items;
-      })
-    },
-
     // 工程登录列表 - 获取列表
     getHomeLoginList() {
       getHomeLoginList({
@@ -664,6 +723,201 @@ export default {
       }
     },
 
+
+
+    // 获取详情
+    getDetail() {
+      getOrderDetail({id: this.editId}).then(res => {
+        let data = res.data;
+        this.mainForm.orderNum = data.enginOrderId;
+        this.mainForm.orderDate = data.orderDate;
+        this.mainForm.type = data.mainId;
+        this.mainForm.jxsNum = data.customerNumber;
+        this.mainForm.jxsName = data.customerName;
+        this.mainForm.loginNum = data.refEnginRecordNo;
+        this.mainForm.enginName = data.refProjectName;
+        this.mainForm.loginType = data.refPromiseStatus;
+        this.mainForm.factoryNum = data.refFactoryNo;
+        this.mainForm.company = data.refUseUnit;
+        this.mainForm.saleType = data.saleTypeId;
+        this.mainForm.contactMan = data.refLinkman;
+        this.mainForm.tel = data.refTel;
+        this.mainForm.phone = data.refPhone;
+        this.mainForm.address = data.refInstallAddress;
+        this.mainForm.greeRemark = data.note2;
+        this.mainForm.greeReply = data.note1;
+        this.mainForm.remark = data.remark;
+        this.mainForm.createMan = data.createName;
+        this.mainForm.createDate = data.createTime;
+        this.mainForm.fileNum = data.fileNo;
+
+        data.items.forEach(item => {
+          item.status1 = '';
+          item.status2 = '';
+          item.rebateWallets = item.customerWalletList.filter(item => {
+            return item.type === 'REBATE';
+          });
+          item.wallets = item.customerWalletList.filter(item => {
+            return item.type === 'COMMONLY';
+          });
+        })
+        this.goodsList = data.items;
+      })
+    },
+
+
+
+    // 获取商品列表
+    getGoodsList() {
+      getRetailProductList({
+        pageNum: this.currentPage,
+        pageSize: 10,
+        saleId: this.mainForm.saleType,
+        materialCode: this.goodsScreenForm.proNum,
+        materialName: this.goodsScreenForm.proName,
+        specification: this.goodsScreenForm.proModel,
+        price1: this.goodsScreenForm.price1,
+        price2: this.goodsScreenForm.price2,
+      }).then(res => {
+        let oldGoodsList = this.goodsList;
+        let newGoodsList = res.data.records;
+        for(let i = 0; i < oldGoodsList.length; i++) {
+          let oldItem = oldGoodsList[i]
+          for(let j = 0; j < newGoodsList.length; j++) {
+            let newItem = newGoodsList[j]
+            if(newItem.id === oldItem.id){
+              newGoodsList[j].selected = true;
+              break;
+            }
+          }
+        }
+        res.data.records.forEach(item => {
+          item.materialName = item.name;
+          item.materialCode = item.number;
+          item.saleTypeName = item.saleName;
+          item.unit = item.baseUnit;
+          item.price = item.batchPrice;
+          item.tax = item.taxRate;
+          item.isDirectTransfer = false;
+          item.directTransferQty = '';
+          item.status1 = '';
+          item.status2 = '';
+          item.rebateAmount = '';
+          item.rebateRate = '';
+          item.productPriceId = item.id;
+        });
+        this.leftGoodsList = res.data.records;
+        this.listTotal = res.data.total;
+      })
+    },
+
+    // 查询重复值并禁选
+    checkboxSelect(row, rowIndex) {
+      if (row.selected) {
+        return false // 禁用
+      }else{
+        return true // 不禁用
+      }
+    },
+
+    // 点击 选择商品
+    openDialog() {
+      if(!this.mainForm.saleType) {
+        return this.$errorMsg('请先选择销售类型');
+      }
+      this.isShowGoodsDialog = true;
+      this.getGoodsList();
+    },
+
+    // 提交筛选表单
+    submitGoodsScreenForm() {
+      this.currentPage = 1;
+      this.getGoodsList();
+    },
+
+    // 重置筛选表单
+    resetGoodsScreenForm() {
+      this.$refs.goodsScreenForm.resetFields();
+      this.currentPage = 1;
+      this.getGoodsList();
+    },
+
+    // 更改列表当前页
+    handleTableCurrentChange(val) {
+      this.currentPage = val;
+      this.getGoodsList();
+    },
+
+    // 关闭 弹窗
+    closeDialog() {
+      this.isShowGoodsDialog = 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].id == newArr[j].id){ // 让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;
+      let rightSelection = this.rightSelection;
+      for(let i = 0; i < rightGoodsList.length; i++) {
+        for(let j = 0; j < rightSelection.length; j++) {
+          if(rightSelection[j].materialId == rightGoodsList[i].materialId){
+            this.rightGoodsList.splice(i, 1);
+          }
+        }
+      }
+    },
+
+    // 全部删除
+    deleteAllGoods() {
+      this.rightGoodsList = [];
+    },
+
+    // 确定 添加产品
+    submitAddGoods() {
+      // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
+      this.goodsList = this.goodsList.concat(this.rightGoodsList);
+      this.isShowGoodsDialog = false;
+      this.leftGoodsList = [];
+      this.rightGoodsList = [];
+    },
+
     // 检查库存
     checkStock() {
       if(!this.warehouseValue) {
@@ -784,6 +1038,24 @@ export default {
       padding-left: 10px;
     }
   }
+  .tables {
+    display: flex;
+    margin-top: 10px;
+    .table {
+      width: 45%;
+    }
+    .buttons {
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
+      align-items: center;
+      padding: 0 10px;
+      button {
+        margin: 0;
+        margin-top: 10px;
+      }
+    }
+  }
 
   ::v-deep input::-webkit-outer-spin-button,
   ::v-deep input::-webkit-inner-spin-button {

+ 6 - 6
src/views/supply/sales/components/sales_detail.vue

@@ -21,18 +21,18 @@
           <div class="value">{{detailData.examineStatus | statusFilter}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">仓库</div>
-            <div class="value">{{detailData.correspondName}}</div>
-          </el-col>
-          <el-col :span="8" class="item">
             <div class="label">发货单号</div>
             <div class="value">{{detailData.orderNo}}</div>
           </el-col>
-          <el-col :span="8" class="item">
+          <el-col :span="16" class="item">
             <div class="label">经销商</div>
             <div class="value">{{detailData.customerName}}</div>
           </el-col>
-          <el-col :xs="24" :sm="24" :lg="24" class="item">
+          <el-col :span="8" class="item">
+            <div class="label">仓库</div>
+            <div class="value">{{detailData.correspondName}}</div>
+          </el-col>
+          <el-col :span="16" class="item">
             <div class="label">备注</div>
             <div class="value">{{detailData.remark}}</div>
           </el-col>

+ 6 - 6
src/views/supply/sales/components/sales_examine.vue

@@ -20,18 +20,18 @@
         <div class="value">{{detailData.examineStatus | statusFilter}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">仓库</div>
-          <div class="value">{{detailData.correspondName}}</div>
-        </el-col>
-        <el-col :span="8" class="item">
           <div class="label">发货单号</div>
           <div class="value">{{detailData.orderNo}}</div>
         </el-col>
-        <el-col :span="8" class="item">
+        <el-col :span="16" class="item">
           <div class="label">经销商</div>
           <div class="value">{{detailData.customerName}}</div>
         </el-col>
-        <el-col :xs="24" :sm="24" :lg="24" class="item">
+        <el-col :span="8" class="item">
+          <div class="label">仓库</div>
+          <div class="value">{{detailData.correspondName}}</div>
+        </el-col>
+        <el-col :span="16" class="item">
           <div class="label">备注</div>
           <div class="value">{{detailData.remark}}</div>
         </el-col>