From ea2b5a4a2779a2a94c4846b110c5507a248ffeb5 Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期三, 20 三月 2024 19:50:25 +0800 Subject: [PATCH] 销售明细发货添加确认完成,格式化列表状态展示 --- src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue | 155 +++++++++++++++++++++++++++++++++++---------------- 1 files changed, 107 insertions(+), 48 deletions(-) diff --git a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue index 20d9d89..c35a201 100644 --- a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue +++ b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue @@ -31,7 +31,20 @@ <!-- </el-col>--> <el-col :span="12"> <el-form-item label="閿�鍞満浼氱紪鍙�" prop="number"> - <WordInput + <el-input + v-if=" + editConfig.title == '缂栬緫' || + (editConfig.title == '鏂板缓' && codenumer && (explain != '' || isIdDisabled)) + " + :disabled="editConfig.title == '缂栬緫'" + v-model="editConfig.infomation.number" + placeholder="璇疯緭鍏ョ紪鐮�" + > + </el-input> + <span v-else-if="editConfig.title == '鏂板缓'" style="color: #f56c6c" + >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span + > + <!-- <WordInput v-if="codenumer && (explain != '' || isIdDisabled) && method == 0" :codenumer="codenumer" :sum="sum" @@ -42,7 +55,7 @@ <span v-else-if="method == 0" style="color: #f56c6c" >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span > - <span v-else>{{ editConfig.title === "鏂板缓" ? "鑷姩鐢熸垚" : editConfig.infomation.number }}</span> + <span v-else>{{ editConfig.title === "鏂板缓" ? "鑷姩鐢熸垚" : editConfig.infomation.number }}</span> --> </el-form-item> </el-col> <el-col :span="12"> @@ -303,23 +316,25 @@ <!-- 浜у搧绠$悊 --> <div class="basic-info-title" style="display: flex"> 浜у搧绠$悊 - <div style="margin-left: 400px"> + <!-- <div style="margin-left: 400px"> 甯佺 <el-select v-model="editConfig.infomation.currency" placeholder="璇烽�夋嫨" size="mini" style="width: 63%"> <el-option v-for="item in currencyOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - </div> + </div> --> </div> <div class="product-view"> <CommonFormTableView - :show-summary="showSummary" - :product-table-list="productTableList" - @inputContent="inputContent" - @addProductClick="addProductClick" - @emptyProductClick="emptyProductClick" - @recalculateProductClick="recalculateProductClick" - @clearupProduct="clearupProduct" + :show-summary="showSummary" + :addTypeIdMultiple="true" + :product-table-list="productTableList" + @inputContent="inputContent" + @addProductClick="addProductClick" + @getSelectArray="getSelectArray" + @emptyProductClick="emptyProductClick" + @recalculateProductClick="recalculateProductClick" + @clearupProduct="clearupProduct" /> </div> @@ -600,10 +615,9 @@ import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog" import { getCityList } from "@/api/common/address" -import WordInput from "@/components/wordInput.vue" -import codeMixin from "@/views/client/followupRecords/mixin/codeMixin" +import codeMixin from "@/components/makepager/mixin/codeMixin" import { getContactList } from "@/api/client/contacts" -import CommonFormTableView from "@/components/makepager/CommonFormTableView.vue"; +import CommonFormTableView from "@/components/makepager/CommonFormTableView.vue" export default { name: "AddSalesOpportunityDialog", mixins: [codeMixin], @@ -619,7 +633,7 @@ } } }, - components: {CommonFormTableView, WordInput, SelectClientDialog, SelectContactDialog }, + components: { CommonFormTableView, SelectClientDialog, SelectContactDialog }, computed: { searchCommonHeight() { return this.$refs.searchCommonView.offsetHeight @@ -634,10 +648,10 @@ dialogWidth: "50%", editConfig: this.editCommonConfig, rules: { - number: [{ required: true, message: "璇疯緭鍏ラ攢鍞満浼氱紪鍙�", trigger: "blur" }], + number: [{ required: true, validator: this.validateCheckCode, trigger: ["blur", "change"] }], name: [{ required: true, message: "璇疯緭鍏ユ満浼氬悕绉�", trigger: "blur" }], - member_id: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }], + member_id: [{ required: true, validator: this.validateMemberId, trigger: "change" }], sale_stage_id: [{ required: true, message: "璇烽�夋嫨閿�鍞樁娈�", trigger: "change" }], currency: [{ required: true, message: "璇烽�夋嫨甯佺", trigger: "change" }], expected_time: [{ required: true, message: "璇烽�夋嫨棰勮鎴愪氦鏃ユ湡", trigger: "change" }], @@ -680,7 +694,7 @@ sumProp: ["Amount", "total"], mergeNumber: 2 }, - productId:1, + productId: 1 } }, created() { @@ -701,9 +715,6 @@ if (val) { this.formInfo() } - }, - "editConfig.infomation.codeStandID"() { - this.formInfo() } }, methods: { @@ -723,10 +734,22 @@ getAllData() .then((res) => { this.memberOptions = res.data.member + if (this.editConfig.title === "鏂板缓") { + let username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1") + this.memberOptions.map((item) => { + if (item.username == username) { + this.$set(this.editConfig.infomation, "member_id", item.id) + } + }) + } this.businessSourceOptions = res.data.sales_source this.businessTypeOptions = res.data.sale_type this.oldCustomerMarketOptions = res.data.regular_customers this.saleStageOptions = res.data.sale_stage + if (this.editConfig.title === "鏂板缓") { + this.editConfig.infomation.sale_stage_id=1 + } + this.provinceOptions = res.data.province this.regionOptions = res.data.region this.possibleOptions = res.data.possibility @@ -747,13 +770,12 @@ // 淇濆瓨 saveClick(formName) { this.$refs[formName].validate((valid) => { - this.validateFormNumber() if (valid) { - const hasProduct = this.tableData.every(ele=>!!ele.name) - if (!hasProduct){ - this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") - return - } + // const hasProduct = this.tableData.every((ele) => !!ele.name) + // if (!hasProduct) { + // this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") + // return + // } const params = this.saveParams() console.log(params) @@ -762,9 +784,14 @@ console.log(res) this.editConfig.visible = false if (res.code === 200) { - this.$message.success("娣诲姞鎴愬姛") - this.$parent.getData() - // } + this.$message.success("娣诲姞鎴愬姛锛�") + if (this.editConfig.title === "鏂板缓" && this.editConfig.infomation?.sourceTitle === "鎺ㄨ繘") { + this.$parent.handleClose() + } else { + this.$parent.getData() + } + } else { + this.$message.error(res.msg ? res.msg : "娣诲姞澶辫触锛�") } }) } else { @@ -772,8 +799,10 @@ console.log(res) this.editConfig.visible = false if (res.code === 200) { - this.$message.success("缂栬緫鎴愬姛") - this.$parent.getData() + this.$message.success("缂栬緫鎴愬姛锛�") + this.$parent?.getData() + } else { + this.$message.error(res.msg ? res.msg : "缂栬緫澶辫触锛�") } }) } @@ -785,6 +814,12 @@ }, saveParams() { let data = this.editConfig.infomation + let products = [] + this.tableData.map((item) => { + if (item.number.length > 0) { + products.push(item) + } + }) let params = { id: this.editConfig.title === "鏂板缓" ? 0 : data.id, advantages: data.advantages || "", @@ -822,8 +857,7 @@ detail_address: data.detail_address || "", codeStandID: data.ID, - codeRule: this.codeRule, - products: this.tableData, + products: products } return params }, @@ -957,8 +991,9 @@ } this.productTableList = { tableData: this.tableData, + isReturn: true, tableColumn: [ - { label: "#", prop: "productId", width: 40 }, + // { label: "#", prop: "productId", width: 40 }, { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true }, { label: "浜у搧缂栧彿", prop: "number" }, { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true }, @@ -969,26 +1004,42 @@ }, // 浜у搧鍒楄〃杈撳叆 inputContent(val, prop, row) { - this.productId = row.productId + // this.productId = row.productId this.tableData.map((item) => { - if (item.productId === row.productId) { + if (item.number === row.number) { item[prop] = val } }) }, // 浜у搧鏂板 addProductClick() { - this.productId++ - this.tableData.push({ - productId: this.productId, - id: 0, - amount: 0, - desc: "", - name: "", - number: "", - price: 0, - total: 0 - }) + // this.productId++ + // this.tableData.push({ + // productId: this.productId, + // id: 0, + // amount: 0, + // desc: "", + // name: "", + // number: "", + // price: 0, + // total: 0 + // }) + // this.showSummary.show = true + }, + // 鏂板鏂瑰紡淇敼 + getSelectArray(val, index) { + if (this.tableData.length == 1 && this.tableData[0].number.length == 0) { + this.tableData = [] + } + if (index < this.tableData.length) { + this.tableData.splice(index, 1) + val.map((item, ind) => { + this.tableData.splice(index + ind, 0, item) + }) + } else { + this.tableData = this.tableData.concat(val) + } + this.productTableList.tableData = this.tableData this.showSummary.show = true }, // 浜у搧娓呯┖ @@ -1013,6 +1064,14 @@ clearupProduct(data) { this.tableData = data this.productTableList.tableData = this.tableData + }, + // 閿�鍞礋璐d汉鑷畾涔夋牎楠岃鍒� + validateMemberId(rule, value, callback) { + if (this.editConfig.infomation?.member_id > 0) { + callback() + } else { + callback(new Error("璇烽�夋嫨閿�鍞礋璐d汉")) + } } } } -- Gitblit v1.8.0