haoxuan
2023-08-30 53f2ab450f00d2f1ddb9cedfc5823b34af0d5545
采购订单的  价格调整 ,折扣调整 接口对接  采购质检单 列表接口对接
9个文件已修改
271 ■■■■ 已修改文件
src/api/purchaseManage/purchase.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/CommonFormTableView.vue 81 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/TableCommonView.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/commonDialog/SelectCommonDialog.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/DetailSupplier.vue 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/components/AddPurchase.vue 104 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/index.vue 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/quality/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/purchaseManage/purchase.js
@@ -110,4 +110,10 @@
    method: "get",
    data
  })
}
// 质检列表
export const qualityInspectList = async (data) => {
  return await axios.get(`/api/purchase/qualityInspectList`, {
    params: data
  })
}
src/components/makepager/CommonFormTableView.vue
@@ -1,7 +1,11 @@
<template>
  <div class="page-view">
    <el-form ref="form" :model="tableList" :show-message="false" label-position="right">
      <el-table :data="tableList.tableData" style="width: 100%">
    <el-form ref="form" :model="tableList" :show-message="false" label-position="right"
    >
      <el-table :data="tableList.tableData" style="width: 100%"
      :show-summary="showSummary.show"
      :summary-method="getSummaries"
      :span-method="arraySpanMethod">
        <el-table-column type="index" label="编号" width="50" align="center"></el-table-column>
        <el-table-column
          v-for="(item, i) in tableList.tableColumn"
@@ -50,11 +54,14 @@
                    }
                  "
                ></el-autocomplete>
                <div class="common-select-btn" @click="selClientClick(scope.row, item.prop)">
                <div class="common-select-btn" @click="selClientClick(scope.row, item.prop,scope)">
                  <i class="el-icon-circle-plus-outline" title="选择"></i>
                </div>
                <div class="common-select-btn" @click="clearupClient(scope.row)">
                <div class="common-select-btn" @click="clearupClient(scope.row,scope)">
                  <i class="el-icon-remove-outline" title="清除"></i>
                </div>
                <div class="common-select-btn" @click="deleteClient(scope.row,scope)">
                  <i class="el-icon-delete" title="删除"></i>
                </div>
              </div>
            </el-form-item>
@@ -94,6 +101,24 @@
              :prop="'tableData.' + scope.$index + '.' + item.prop"
              :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
            >
             <template v-if="item.multiply">
                <el-input-number
                  :value="scope.row[showSummary.multiply[0]]*scope.row[showSummary.multiply[1]]"
                  placeholder=""
                  :disabled="item.disabled"
                  :min="0"
                  :precision="2"
                  :controls="false"
                  size="mini"
                  style="width: 100%; margin-right: 5px"
                  @input="
                    (val) => {
                      commonInputChange(val, item.prop, scope.row)
                    }
                  "
                ></el-input-number>
             </template>
             <template v-else>
              <el-input-number
                v-model="scope.row[item.prop]"
                placeholder=""
@@ -108,6 +133,7 @@
                  }
                "
              ></el-input-number>
              </template>
            </el-form-item>
            <span v-else>{{ scope.row[item.prop] }}</span>
            <!-- </template> -->
@@ -124,13 +150,14 @@
    <SelectCommonDialog
      v-if="editSelCommonConfig.editVisible"
      :edit-common-config="editSelCommonConfig"
      :sign="sign"
      @selClient="selClient"
    />
  </div>
</template>
<script>
import { getProductListFromGrpc } from "@/api/productManage/product"
import { getProductListFromGrpc,getProductList } from "@/api/productManage/product"
import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
export default {
  name: "CommmonFormTableView",
@@ -139,6 +166,10 @@
    detailEnter: {
      type: Boolean,
      default: false
    },
    sign:{
      type:String,
      default:''
    },
    productTableList: {
      type: Object,
@@ -160,6 +191,7 @@
          total: false,
          refundable: false,
          sumProp: [],
          multiply:[],
          titleProp: ["#", "产品名称"],
          mergeNumber: 1
        }
@@ -168,7 +200,7 @@
    recalculateShow: {
      type: [Boolean],
      defalut: true
    }
    },
  },
  data() {
    return {
@@ -188,10 +220,16 @@
    this.tableList = this.productTableList
  },
  computed: {},
  watch:{
    productTableList(){
      this.tableList = this.productTableList
    }
  },
  methods: {
    // 产品名称
    async getProductList() {
      await getProductListFromGrpc({
      let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc;
      await fn({
        page: 1,
        pageSize: 100
      }).then((res) => {
@@ -259,6 +297,7 @@
        }
        if (column.property === "total") {
          this.total = sums[index]
          this.$emit('getSummaries',this.total)
        }
      })
      return sums
@@ -354,9 +393,9 @@
      }
      this.$emit("selCommonName", selRow)
    },
    selClientClick(row, prop) {
    selClientClick(row, prop,scope) {
      console.log(row, prop)
      this.productIndex = row.productId - 1
      this.productIndex = scope.$index
      this.editSelCommonConfig.title = "产品名称"
      this.editSelCommonConfig.editVisible = true
    },
@@ -379,22 +418,28 @@
        this.tableList.tableData.map((ite, index) => {
          if (index === this.productIndex) {
            ite.name = item.name
            ite.productId = item.ID
            ite.amount = item.amount || 1
            ite.number = item.number
            ite.purchasePrice = item.purchasePrice
            ite.unit = item.unit
            ite.deliveryTime = item.deliveryTime
            ite.shippingDuration = item.shippingDuration
            this.$set(this.tableList.tableData,index,ite)
            this.$forceUpdate()
          }
        })
        console.log(this.tableList.tableData,'=====chanp')
      }
    },
    // 清除已选择用户
    clearupClient(row) {
      this.productIndex = row.productId - 1
    clearupClient(row,scope) {
      this.productIndex = scope.$index
      this.tableList.tableData.map((ite, index) => {
        console.log(row.productId)
        if (row.productId && row.productId >= 0) {
        console.log(scope.$index)
        if (scope.$index  && scope.$index  >= 0) {
          if (index === this.productIndex) {
            ite.name = ""
            ite.amount = 1
@@ -416,10 +461,10 @@
      })
      this.$emit("clearupProduct", this.tableList.tableData)
    },
    // 删除
    deleteClient(row) {
      this.$emit("deleteProduct", row)
    }
    deleteClient(row,scope){
      this.tableList.tableData.splice(scope.$index,1)
    },
  }
}
</script>
@@ -445,7 +490,7 @@
  }
  .el-table__footer-wrapper tbody td.el-table__cell {
    background-color: #fff;
    text-align: right;
    // text-align: right;
    font-weight: bold;
  }
  .el-input--suffix .el-input__inner {
src/components/makepager/TableCommonView.vue
@@ -314,6 +314,7 @@
  .el-table__footer-wrapper  {
    tbody td.el-table__cell{
      background-color: #fff;
      font-weight: bold;
    }
    // .cell{
    //     &:nth-last-child(3){
src/views/other/commonDialog/SelectCommonDialog.vue
@@ -39,7 +39,7 @@
</template>
<script>
import { getProductListFromGrpc } from "@/api/productManage/product"
import { getProductListFromGrpc,getProductList } from "@/api/productManage/product"
export default {
  name: "EditSelCommonDialog",
  props: {
@@ -52,6 +52,10 @@
          tableInfomation: []
        }
      }
    },
    sign:{
      type:String,
      default:''
    }
  },
  components: {},
@@ -105,7 +109,9 @@
    },
    // 产品名称
    async getProductList() {
      await getProductListFromGrpc({
      let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc;
      await  fn({
        page: 1,
        pageSize: 100
      }).then((res) => {
src/views/purchaseManage/purchase/DetailSupplier.vue
@@ -12,10 +12,10 @@
          <span class="header-title">{{ detailConfig.infomation.name }}</span>
        </div>
        <div class="btn" style="float: right; margin-right: 30px">
          <el-button type="primary" size="mini" style="margin-right: 5px"
          <el-button type="primary" size="mini" disabled style="margin-right: 5px"
            >打印</el-button
          >
          <el-button type="primary" size="mini" @click="emailClick"
          <el-button type="primary" disabled size="mini" @click="emailClick"
            >Email通知下单</el-button
          >
@@ -74,7 +74,7 @@
              </ul>
              <div class="business_scope">
                <div class="content-title">{{ "备注信息:" }}</div>
                <div class="content-data">{{ record ? record : "--" }}</div>
                <div class="content-data">{{ remark ? remark : "--" }}</div>
              </div>
            </div>
          </div>
@@ -126,21 +126,21 @@
              <div class="table-bottom">
                <div class="table-bottom-item">
                  <div class="table-bottom-l">
                    整单折扣:直接降价
                    整单折扣:{{ detailConfig.infomation.wholeDiscountType==1?'百分比降价':'直接降价' }}
                  </div>
                  <div class="table-bottom-r">0.00</div>
                  <div class="table-bottom-r">{{detailConfig.infomation.wholeDiscount  }}</div>
                </div>
                <div class="table-bottom-item">
                  <div class="table-bottom-l">
                    调整:增加
                    调整:{{ detailConfig.infomation.priceAdjustmentType==1?'增加':'减少' }}
                  </div>
                  <div class="table-bottom-r">0.00</div>
                  <div class="table-bottom-r">{{ detailConfig.infomation.priceAdjustment }}</div>
                </div>
                <div class="table-bottom-item">
                  <div class="table-bottom-l">
                    合计
                  </div>
                  <div class="table-bottom-r">26000.00</div>
                  <div class="table-bottom-r">{{detailConfig.infomation.realTotalPrice  }}</div>
                </div>
              </div>
            </div>
@@ -178,7 +178,7 @@
      basicInfoList: [],
      isDynamicExpand: true, // 账户信息
      dynamicInfoList: [],
      record: "", // 最新进展
      remark: "", // 最新进展
      noContactDays: 0,
      newContactDays: "",
      isExpandThree: true, //产品信息
@@ -236,7 +236,7 @@
      if (item.FollowRecord && item.FollowRecord.length > 0) {
        this.noContactDays = this.getDiffDay(Date.now(), this.newContactDays);
      }
      this.record =item.record?item.record:''
      this.remark =item.remark?item.remark:''
      this.formInfoList = [
        {
          str: "供应商名称",
@@ -244,15 +244,15 @@
        },
        {
          str: "合计",
          value: "",
          value:item.realTotalPrice,
        },
        {
          str: "已收票金额",
          value: "",
          value: item.invoiceAmount,
        },
        {
          str: "已付金额",
          value: "",
          value: item.paidAmount,
        },
        {
          str: "签约日期",
@@ -260,15 +260,15 @@
        },
        {
          str: "采购负责人",
          value: "",
          value: item.principal,
        },
        {
          str: "未收票金额",
          value: "",
          value: item.unInvoiceAmount,
        },
        {
          str: "应付金额",
          value: "",
          value: item.shouldPayAmount,
        },
      ];
      this.basicInfoList = [
@@ -282,7 +282,7 @@
          leftStr: "采购单状态",
          leftValue: this.getpurchaseStatus(item.status),
          rightStr: "采购负责人",
          rightValue: item.contact_position,
          rightValue: item.principal,
        },
        {
          leftStr: "采购联系人",
@@ -306,19 +306,19 @@
      this.dynamicInfoList = [
        {
          leftStr: "合计",
          leftValue: this.noContactDays,
          leftValue: item.realTotalPrice,
          rightStr: "已收票金额",
          rightValue: this.newContactDays,
          rightValue: item.invoiceAmount,
        },
        {
          leftStr: "已付总额",
          leftValue: "",
          leftValue:item.paidAmount,
          rightStr: "未收票金额",
          rightValue: "",
          rightValue: item.unInvoiceAmount,
        },
        {
          leftStr: "应付金额",
          leftValue: "",
          leftValue: item.shouldPayAmount,
          rightStr: "",
          rightValue: "",
        },
src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -166,7 +166,9 @@
              :show-summary="showSummary"
              :recalculateShow="false"
              :product-table-list="productTableList"
              sign="purchase"
              @inputContent="inputContent"
              @getSummaries="getSummaries"
              @addProductClick="addProductClick"
              @emptyProductClick="emptyProductClick"
              @clearupProduct="clearupProduct"
@@ -180,6 +182,7 @@
                    v-model="editConfig.infomation.wholeDiscountType"
                    placeholder="请选择"
                    filterable
                    @change="getTotal"
                  >
                    <el-option label="百分比降价" :value="1"></el-option>
                    <el-option label="直接降价" :value="2"></el-option>
@@ -191,6 +194,8 @@
                  <el-input
                    v-model="editConfig.infomation.wholeDiscount"
                    size="mini"
                    :disabled="editConfig.infomation.wholeDiscountType?false:true"
                    @change="getTotal"
                    placeholder="请填写"
                  ></el-input>
                </el-form-item>
@@ -203,6 +208,7 @@
                    v-model="editConfig.infomation.priceAdjustmentType"
                    placeholder="请选择"
                    filterable
                    @change="getTotal"
                  >
                    <el-option label="增加" :value="1"></el-option>
                    <el-option label="减少" :value="2"></el-option>
@@ -214,6 +220,8 @@
                  <el-input
                    v-model="editConfig.infomation.priceAdjustment"
                    size="mini"
                    :disabled="editConfig.infomation.priceAdjustmentType?false:true"
                    @change="getTotal"
                    placeholder="请填写"
                  ></el-input>
                </el-form-item>
@@ -221,7 +229,7 @@
            </div>
            <div class="table-bottom-item">
              <div class="table-bottom-l">合计</div>
              <div class="table-bottom-r">{{ editConfig.infomation.realTotalPrice }}</div>
              <div class="table-bottom-r">{{ total }}</div>
            </div>
          </div>
        </div>
@@ -297,7 +305,7 @@
        wholeDiscount: [
          {
            required: false,
            message: "请填写",
            message: "请填写0-100的数字",
            trigger: "change",
          },
          { validator: this.validatorNum, trigger: "change" },
@@ -316,6 +324,7 @@
        show: true,
        total: false,
        sumProp: ["price", "total"],
        multiply:['amount','price'],
        titleProp: [
          "编号",
          "产品名称",
@@ -326,6 +335,7 @@
          "描述",
        ],
        mergeNumber: 4,
        totalName:'小计'
      },
      editSelectSupplierConfig: {
        editVisible: false,
@@ -340,11 +350,13 @@
      plcBrandList:[],
      editRow:{
        isDefault:'pin'
      }
      },
      total:0,
      totalTwo:0,
    };
  },
  created() {
    this.setTableForm();
    this.handleGetBomKindDictList();
  },
  computed: {
  },
@@ -353,26 +365,30 @@
      immediate:true,
      handler:function(){
        
        this.setTableForm();
        this.handleGetBomKindDictList(true);
      }
    }
  },
  methods: {
    validatorNum(rule, value, callback) {
      if (value) {
        if (value == undefined || value == null) {
      if(this.editConfig.infomation.wholeDiscountType==1){
        if(value==undefined||value==null||(!value&&value!=0)){
          callback(new Error("请输入有效数字"));
        } else {
          var reg = /^\+?[0-9]\d*$/;
          if (!reg.test(value)) {
            callback(new Error("请填写不小于0的数字"));
          } else {
            callback();
        }else{
          var reg=/^\+?[0-9]\d*$/
          if(!reg.test(value)){
            callback(new Error('请填写0-100的数字'))
          }else{
            if(Number(value)>100){
              callback(new Error('请填写0-100的数字'))
            }else{
              callback()
            }
          }
        }
      } else {
        callback();
      }
        }
      }else{
        this.validatorNumThree(rule, value, callback)
      }
    },
    validatorNumThree(rule, value, callback){
      if(value){
@@ -397,9 +413,9 @@
    },
    //  PLC配置
    handleGetBomKindDictList(val) {
      console.log(val,'val')
      getPurchaseType().then((res) => {
        this.plcBrandList = res.data;
        this.setTableForm()
        if (val) {
          for (let i in this.plcBrandList) {
            if (this.plcBrandList[i][this.editRow.isDefault]) {
@@ -492,6 +508,13 @@
    },
    saveParams() {
      let data =JSON.parse(JSON.stringify(this.editConfig.infomation));
      if(this.editConfig.infomation.wholeDiscountType==2&&this.editConfig.infomation.wholeDiscount){
        if(Number(this.editConfig.infomation.wholeDiscount)>Number(this.totalTwo)){
            this.$message.error('直接降价不能超过价税合计的总和!')
            return true;
        }
      }
      let params = {
        productList:this.tableData,
        purchase:{
@@ -504,11 +527,12 @@
          name:data.name||'',
          deliveryDate:data.deliveryDate||'',
          contact:data.contact,
          wholeDiscountType:data.wholeDiscountType,
          wholeDiscount:Number(data.wholeDiscount),
          priceAdjustmentType:data.priceAdjustmentType,
          priceAdjustment:Number(data.priceAdjustment),
          realTotalPrice:data.realTotalPrice||'',
          wholeDiscountType:data.wholeDiscountType?data.wholeDiscountType:0,
          wholeDiscount:data.wholeDiscount?Number(data.wholeDiscount):0,
          priceAdjustmentType:data.priceAdjustmentType?data.priceAdjustmentType:0,
          priceAdjustment:data.priceAdjustment?Number(data.priceAdjustment):0,
          realTotalPrice:this.total?Number(this.total):0,
          totalPrice:this.totalTwo?Number(this.totalTwo):0,
        }
      };
      if(data.ID){
@@ -589,11 +613,11 @@
          {
            label: "产品名称",
            prop: "name",
            min: 170,
            min: 180,
            productName: true,
            isRequird: true,
          },
          { label: "产品编号", prop: "number" },
          { label: "产品编号", prop: "number", min: 150,},
          { label: "计量单位", prop: "unit" },
          { label: "规格型号", prop: "specifications" },
          { label: "数量", prop: "amount", inputNumber: true, isRequird: true },
@@ -603,11 +627,12 @@
            inputFloat: true,
            isRequird: true,
          },
          { label: "价税合计", prop: "total", inputFloat: true },
          { label: "价税合计", prop: "total", inputFloat: true,disabled:true,multiply:true, },
          { label: "描述", prop: "remark", input: true },
        ],
      };
      this.handleGetBomKindDictList(true);
      this.toal=this.editConfig.infomation.realTotalPrice
    },
    // 产品列表输入
    inputContent(val, prop, row) {
@@ -617,6 +642,31 @@
          item[prop] = val;
        }
      });
    },
    getSummaries(total){
      this.totalTwo= JSON.parse(JSON.stringify(total));
      this.total=total;
      this.getTotal()
    },
    getTotal(){
      let prie=0
      if(this.editConfig.infomation.priceAdjustmentType==1){
        prie=Number(this.editConfig.infomation.priceAdjustment)
      }else if(this.editConfig.infomation.priceAdjustmentType==2){
        prie=(-1)*Number(this.editConfig.infomation.priceAdjustment)
      }else{
        prie=0
      }
      let t=0
      if(this.editConfig.infomation.wholeDiscountType==1){
        t=this.totalTwo*Number(this.editConfig.infomation.wholeDiscount)/100
      }else if(this.editConfig.infomation.wholeDiscountType==2){
        t=Number(this.editConfig.infomation.wholeDiscount)
      }else{
        t=0
      }
      this.total=this.totalTwo-t+Number(prie)
    },
    // 产品新增
    addProductClick() {
src/views/purchaseManage/purchase/index.vue
@@ -1,6 +1,6 @@
<template>
  <div class="rightContent">
    <div class="content-box">
    <div class="content-box" v-loading="tableLoading">
      <div class="supplier-search">
        <SearchCommonView
          ref="searchCommonView"
@@ -68,6 +68,7 @@
  computed: {},
  data() {
    return {
      tableLoading:false,
      tableList: {}, // 列表
      selValueList: [],
      commonDetail: {
@@ -162,13 +163,20 @@
          signingDate:'',
          deliveryDate:'',
          remark:'',
          wholeDiscountType:null,
          wholeDiscount:0,
          priceAdjustmentType:null,
          priceAdjustment:0,
          realTotalPrice:0,
       }
    },
    
    // 编辑
    editClick(row){
      this.tableLoading=true
      getPurchaseInfo({id:row.ID}).then((res) => {
        if (res.code == 200) {
          this.tableLoading=false
          this.editConfig.visible = true
          this.editConfig.title = "编辑"
          this.editConfig.infomation = { 
@@ -180,6 +188,9 @@
          this.$message.error(res.msg?res.msg+',':''+'获取信息失败!')
        }
      })
      setTimeout(()=>{
        this.tableLoading=false
      },3000)
      // this.editRow = row;
      // this.$refs.add.islook = true;
      
@@ -208,8 +219,10 @@
    // 详情
    selCommonClick(row) {
      console.log(row)
      this.tableLoading=true
      getPurchaseInfo({id:row.ID}).then((res) => {
        if (res.code == 200) {
          this.tableLoading=false
          this.commonDetail.visible = true
          this.commonDetail.infomation = { 
            productList:res.data.productList,
@@ -219,6 +232,9 @@
          this.$message.error(res.msg?res.msg+',':''+'获取信息失败!')
        }
      })
      setTimeout(()=>{
        this.tableLoading=false
      },3000)
    }
  }
}
src/views/purchaseManage/quality/index.vue
@@ -46,7 +46,7 @@
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import {
  getPurchaseList,getPurchaseInfo,submitPurchase,
  qualityInspectList,getPurchaseInfo,submitPurchase,
} from "@/api/purchaseManage/purchase";
import DetailSupplier from "@/views/purchaseManage/quality/DetailSupplier"
import { getDataByType } from "@/api/data";
@@ -103,7 +103,8 @@
    },
    // 请求数据
    async getData() {
      await getPurchaseList({
      await qualityInspectList({
        keyword: this.search,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
vue.config.js
@@ -16,7 +16,7 @@
      "/api": {
        // target: "http://192.168.20.118:8889", // http://192.168.20.119:8002 http://fai365.com:30150/
        // target: "http://192.168.20.120:8889",
        // target: "http://192.168.20.120:8004",
        target: "http://192.168.20.119:8004", // http://192.168.20.119:8004 http://fai365.com:30150/
        ws: true,