| | |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input type="textarea" :autosize="{ minRows: 2 }" v-model="editConfig.infomation.notes"></el-input> |
| | | <el-input |
| | | type="textarea" |
| | | :autosize="{ minRows: 2 }" |
| | | v-model="editConfig.infomation.remark" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | @addProductClick="addProductClick" |
| | | @emptyProductClick="emptyProductClick" |
| | | @recalculateProductClick="recalculateProductClick" |
| | | @clearupProduct="clearupProduct" |
| | | /> |
| | | </div> |
| | | <!-- 选择审批流程 --> |
| | |
| | | showSummary: { |
| | | show: true, |
| | | total: true, |
| | | sumProp: ["other1", "other7"], |
| | | sumProp: ["Amount", "total"], |
| | | mergeNumber: 2 |
| | | }, |
| | | editSelectClientConfig: { |
| | |
| | | }, |
| | | clientId: this.editCommonConfig.infomation.client_id, |
| | | saleChanceId: this.editCommonConfig.infomation.saleChanceId, |
| | | productId: 1 |
| | | productId: 1, |
| | | isNoProduct: true |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | console.log(this.editConfig.infomation) |
| | | const params = this.saveParams() |
| | | console.log(params) |
| | | if (this.editConfig.title === "新建") { |
| | | getAddSalesDetails(params).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("添加成功") |
| | | this.$parent.getData() |
| | | } |
| | | }) |
| | | for (let i = 0; i < this.tableData.length; i++) { |
| | | if (this.tableData[i].name.length === 0) { |
| | | this.isNoProduct = true |
| | | break |
| | | } else { |
| | | this.isNoProduct = false |
| | | } |
| | | } |
| | | if (this.isNoProduct) { |
| | | this.$message.error("产品名称不能为空") |
| | | } else { |
| | | getUpdateSalesDetails(params).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("编辑成功") |
| | | this.$parent.getData() |
| | | } |
| | | }) |
| | | const params = this.saveParams() |
| | | console.log(params) |
| | | if (this.editConfig.title === "新建") { |
| | | getAddSalesDetails(params).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("添加成功") |
| | | this.$parent.getData() |
| | | } |
| | | }) |
| | | } else { |
| | | getUpdateSalesDetails(params).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("编辑成功") |
| | | this.$parent.getData() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | console.log("error submit") |
| | |
| | | memberId: data.memberId || 0, |
| | | number: data.number || "", |
| | | phone: data.phone || "", |
| | | products: [ |
| | | { |
| | | amount: 0, |
| | | desc: "", |
| | | id: 0, |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | total: 0 |
| | | } |
| | | ], |
| | | products: this.tableData, |
| | | remark: data.remark || "", |
| | | saleChanceId: this.saleChanceId || 0, |
| | | saleType: data.saleType || 0, |
| | |
| | | } |
| | | }, |
| | | selClient(row, value) { |
| | | if (value === "contact") { |
| | | this.editConfig.infomation.contact_name = row.name |
| | | this.contactId = row.id |
| | | if (value === "client") { |
| | | this.editConfig.infomation.client_name = row.name |
| | | this.clientId = row.id |
| | | } else if (value === "chance") { |
| | | this.editConfig.infomation.sale_chance_name = row.name |
| | | this.saleChanceId = row.id |
| | |
| | | if (this.editConfig.title === "新建") { |
| | | this.tableData = [ |
| | | { |
| | | id: 1, |
| | | Amount: 0, |
| | | IsSale: true, |
| | | MaterialMode: "", |
| | | MinInventory: 0, |
| | | Name: "", |
| | | Number: "", |
| | | PurchaseType: "", |
| | | SalePrice: 0, |
| | | Unit: "" |
| | | productId: this.productId, |
| | | id: 0, |
| | | amount: 0, |
| | | desc: "", |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | total: 0 |
| | | } |
| | | ] |
| | | } else { |
| | | this.tableData = this.editConfig.infomation.products |
| | | this.tableData.map((item, index) => { |
| | | item.productId = index + 1 |
| | | }) |
| | | } |
| | | this.productTableList = { |
| | | tableData: this.tableData, |
| | | tableColumn: [ |
| | | { label: "#", prop: "id", width: 40 }, |
| | | { label: "产品名称", prop: "Name", input: true, isRequird: true }, |
| | | { label: "产品编号", prop: "Number" }, |
| | | { label: "数量", prop: "Amount", input: true, isRequird: true }, |
| | | { label: "销售单价", prop: "Unit", input: true }, |
| | | { label: "价税合计", prop: "total", input: true }, |
| | | { label: "描述", prop: "other8" } |
| | | { label: "#", prop: "productId", width: 40 }, |
| | | { label: "产品名称", prop: "name", productName: true, isRequird: true }, |
| | | { label: "产品编号", prop: "number" }, |
| | | { label: "数量", prop: "amount", inputNumber: true, isRequird: true }, |
| | | { label: "销售单价", prop: "price", inputFloat: true }, |
| | | { label: "价税合计", prop: "total", inputFloat: true } |
| | | ] |
| | | } |
| | | }, |
| | | // 产品列表输入 |
| | | inputContent(val, prop, row) { |
| | | console.log("aaaaaaaa") |
| | | console.log(val, prop) |
| | | this.productId = row.id |
| | | this.productId = row.productId |
| | | this.tableData.map((item) => { |
| | | if (item.id === row.id) { |
| | | if (item.productId === row.productId) { |
| | | item[prop] = val |
| | | } |
| | | }) |
| | | console.log(this.tableData) |
| | | }, |
| | | // 产品新增 |
| | | addProductClick() { |
| | | this.productId++ |
| | | this.tableData.push({ |
| | | id: this.productId, |
| | | Amount: 0, |
| | | IsSale: true, |
| | | MaterialMode: "", |
| | | MinInventory: 0, |
| | | Name: "", |
| | | Number: "", |
| | | PurchaseType: "", |
| | | SalePrice: 0, |
| | | Unit: "" |
| | | productId: this.productId, |
| | | id: 0, |
| | | amount: 0, |
| | | desc: "", |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | total: 0 |
| | | }) |
| | | this.showSummary.show = true |
| | | }, |
| | | // 产品清空 |
| | | emptyProductClick() { |
| | | this.productId = 1 |
| | | this.tableData = [ |
| | | { |
| | | id: 1, |
| | | Amount: 0, |
| | | IsSale: true, |
| | | MaterialMode: "", |
| | | MinInventory: 0, |
| | | Name: "", |
| | | Number: "", |
| | | PurchaseType: "", |
| | | SalePrice: 0, |
| | | Unit: "" |
| | | productId: this.productId, |
| | | id: 0, |
| | | amount: 0, |
| | | desc: "", |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | total: 0 |
| | | } |
| | | ] |
| | | this.productTableList.tableData = this.tableData |
| | | }, |
| | | // 产品重算 |
| | | recalculateProductClick() {} |
| | | recalculateProductClick() {}, |
| | | clearupProduct(data) { |
| | | this.tableData = data |
| | | this.productTableList.tableData = this.tableData |
| | | } |
| | | } |
| | | } |
| | | </script> |