| | |
| | | @getSelectArray="getSelectArray" |
| | | @emptyProductClick="emptyProductClick" |
| | | @clearupProduct="clearupProduct" |
| | | @selTableCol="selTableCol" |
| | | ></CommonFormTableView> |
| | | </div> |
| | | <!-- 选择审批流程 --> |
| | |
| | | import { getDataByType } from "@/api/data" |
| | | import { mapActions } from "vuex" |
| | | import { getQuotationList } from "@/api/sales/quotation" |
| | | import { getSystemSet } from "@/api/systemSet/commonSet" |
| | | |
| | | export default { |
| | | name: "AddSalesDetailsDialog", |
| | |
| | | disabledDate(time) { |
| | | return time.getTime() > Date.now() |
| | | } |
| | | } |
| | | }, |
| | | isRelevancyValue:"是", //是否同步报价单 |
| | | isCollectionPlan:"是", // 是否生成收款计划 |
| | | isBjdRequird : false, |
| | | tableColumn: [ |
| | | // { label: "#", prop: "productId", width: 40 }, |
| | | { label: "产品名称", prop: "name", productName: true, isRequird: true, min: 110 }, |
| | | { label: "规格", prop: "specs" , }, |
| | | { label: "型号", prop: "type" }, |
| | | { label: "产品编号", prop: "number" }, |
| | | { label: "单位", prop: "unit" }, |
| | | { label: "销售单价", prop: "price", inputFloat: !this.isBjdRequird, }, |
| | | { label: "成本单价", prop: "cost", input: !this.isBjdRequird }, |
| | | { label: "毛利", prop: "profit" }, |
| | | { label: "毛利率(%)", prop: "margin", min: 90 }, |
| | | { label: "数量", prop: "amount", inputNumber: true, isRequird: true }, |
| | | { label: "价税合计", prop: "total" } |
| | | ], |
| | | showCol: ["产品名称", "规格", "型号", "产品编号", "单位", "销售单价", "成本单价","毛利","毛利率(%)","数量","价税合计"], |
| | | } |
| | | }, |
| | | mounted(){ |
| | |
| | | this.getQuotation() |
| | | }, |
| | | created() { |
| | | this.getSystemSet() |
| | | if (this.editConfig.title !== "新建") { |
| | | this.productTableList.tableData = [ |
| | | { |
| | |
| | | // }, |
| | | methods: { |
| | | ...mapActions(["getChanceFilter", "getSubunitFliter"]), |
| | | async getSystemSet(){ |
| | | await getSystemSet().then((res) => { |
| | | if (res.code == 200) { |
| | | console.log(res,"resss") |
| | | if (res.data) { |
| | | this.isRelevancyValue = this.checkValueById(res.data.CRM, 5); |
| | | this.isCollectionPlan=this.checkValueById(res.data.CRM, 4); |
| | | console.log(this.isRelevancyValue,"是否关联") |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | setColumnVisible(showCol, tableColumn) { |
| | | return tableColumn.map((ele) => { |
| | | return { |
| | | ...ele, |
| | | isShowColumn: showCol.includes(ele.label) |
| | | } |
| | | }) |
| | | }, |
| | | selTableCol(val) { |
| | | this.showcol = val |
| | | this.productTableList.tableColumn = this.setColumnVisible(val, this.tableColumn) |
| | | }, |
| | | checkValueById(data, id) { |
| | | for (const key in data) { |
| | | if (data.hasOwnProperty(key)) { |
| | | const obj = data[key]; |
| | | if (obj.id === id) { |
| | | return obj.value; |
| | | } |
| | | } |
| | | } |
| | | return null; // 如果没有找到匹配的id,则返回null |
| | | }, |
| | | formInfo() { |
| | | this.objCode.type = "销售明细编码" |
| | | this.objCode.codeStandID = "" |
| | |
| | | amountTotal: this.amountTotal, |
| | | id: res.data.id |
| | | } |
| | | if(this.isCollectionPlan==="是"){ |
| | | this.$emit("addCollectionPlanClick", config) |
| | | }else{ |
| | | this.$parent.getData() |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | console.log("下拉框点击", item) |
| | | this.subbillId = item.id |
| | | this.editConfig.infomation.subbill_name = item.number |
| | | } else if (value === "quotation") { |
| | | } else if (value === "quotation") { //销售报价单 |
| | | if(this.isRelevancyValue==="是"){ |
| | | this.productTableList.tableData = item.products |
| | | this.tableData = item.products |
| | | } |
| | | this.editConfig.infomation.quotation_number = item.number |
| | | this.quotationId = item.id |
| | | //反向 客户名称 |
| | |
| | | this.editSelCommonConfig.editVisible = true |
| | | } |
| | | }, |
| | | // 点击加号 |
| | | selClient(row, value) { |
| | | if (value === "client") { |
| | | this.editConfig.infomation.sale_chance_name = "" |
| | |
| | | this.editConfig.infomation.subbill_name = row.number |
| | | this.subbillId = row.id |
| | | } else if (value === "quotation") { |
| | | if(this.isRelevancyValue==="是"){ |
| | | this.productTableList.tableData = row.products |
| | | this.tableData = row.products |
| | | } |
| | | this.editConfig.infomation.quotation_number = row.number |
| | | //反向 客户名称 |
| | | this.editConfig.infomation.client_name = row.client.name |
| | |
| | | this.editConfig.infomation.quotation_number = "" |
| | | this.quotationId = 0 |
| | | } |
| | | if(this.isRelevancyValue==="是" && value === "quotation"){ |
| | | this.productTableList.tableData = [] |
| | | this.tableData = [] |
| | | }else if(this.isRelevancyValue==="否" && value === "quotation"){ |
| | | console.log("false") |
| | | }else{ |
| | | this.productTableList.tableData = [] |
| | | this.tableData = [] |
| | | } |
| | | }, |
| | | // 添加附件 |
| | | addAnnexClick() {}, |
| | |
| | | this.getQuotation(this.editConfig.infomation.saleChanceId, "全部产品") |
| | | } |
| | | // let productData = this.quotationList.products |
| | | let isBjdRequird = false |
| | | this.isBjdRequird = false |
| | | if (this.autoCodeHeadersObj.Bjd == "yes") { |
| | | isBjdRequird = true |
| | | this.isBjdRequird = true |
| | | } |
| | | this.productTableList = { |
| | | tableData: this.tableData, |
| | | isReturn: true, |
| | | tableColumn: [ |
| | | // { label: "#", prop: "productId", width: 40 }, |
| | | { label: "产品名称", prop: "name", productName: true, isRequird: true, min: 110 }, |
| | | { label: "规格", prop: "specs" }, |
| | | { label: "型号", prop: "type" }, |
| | | { label: "产品编号", prop: "number" }, |
| | | { label: "单位", prop: "unit" }, |
| | | { label: "销售单价", prop: "price", inputFloat: !isBjdRequird, isRequird: true }, |
| | | { label: "成本单价", prop: "cost", input: !isBjdRequird }, |
| | | { label: "毛利", prop: "profit" }, |
| | | { label: "毛利率(%)", prop: "margin", min: 90 }, |
| | | { label: "数量", prop: "amount", inputNumber: true, isRequird: true }, |
| | | { label: "价税合计", prop: "total" } |
| | | ] |
| | | allcol: [], |
| | | showcol: this.showCol, |
| | | // tableColumn: [ |
| | | // // { label: "#", prop: "productId", width: 40 }, |
| | | // { label: "产品名称", prop: "name", productName: true, isRequird: true, min: 110 }, |
| | | // { label: "规格", prop: "specs" }, |
| | | // { label: "型号", prop: "type" }, |
| | | // { label: "产品编号", prop: "number" }, |
| | | // { label: "单位", prop: "unit" }, |
| | | // { label: "销售单价", prop: "price", inputFloat: !this.isBjdRequird, }, |
| | | // { label: "成本单价", prop: "cost", input: !this.isBjdRequird }, |
| | | // { label: "毛利", prop: "profit" }, |
| | | // { label: "毛利率(%)", prop: "margin", min: 90 }, |
| | | // { label: "数量", prop: "amount", inputNumber: true, isRequird: true }, |
| | | // { label: "价税合计", prop: "total" } |
| | | // ], |
| | | tableColumn: this.setColumnVisible(this.showCol, this.tableColumn) |
| | | } |
| | | this.setTableList(this.productTableList) |
| | | }, |
| | | setTableList(productTableList) { |
| | | productTableList.allcol = productTableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label) |
| | | this.searchOptions = [] |
| | | for (let i = 0; i < productTableList.tableColumn.length; i++) { |
| | | const label = productTableList.tableColumn[i].label |
| | | const value = productTableList.tableColumn[i].prop |
| | | this.searchOptions.push({ value: value, label: label }) |
| | | } |
| | | }, |
| | | // 产品列表输入 |