From acdff03246ce648082192dfb069c3a006a7fbee6 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期三, 09 八月 2023 18:46:06 +0800 Subject: [PATCH] 客户管理模块 批量删除、推进、跟进接口联调 --- src/views/sales/quotation/AddQuotationDialog.vue | 402 +++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 287 insertions(+), 115 deletions(-) diff --git a/src/views/sales/quotation/AddQuotationDialog.vue b/src/views/sales/quotation/AddQuotationDialog.vue index 156e70b..fe44f26 100644 --- a/src/views/sales/quotation/AddQuotationDialog.vue +++ b/src/views/sales/quotation/AddQuotationDialog.vue @@ -5,6 +5,8 @@ :visible.sync="editConfig.visible" :width="dialogWidth" :before-close="handleClose" + append-to-body + custom-class="iframe-dialog" > <el-form ref="form" @@ -22,64 +24,99 @@ <div class="basic-info-view"> <el-row> <el-col :span="12"> - <el-form-item label="瀹㈡埛鍚嶇О" prop="customName"> + <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.customName"></el-input> - <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> - <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> + <el-autocomplete + v-model="editConfig.infomation.client_name" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'client') + } + " + value-key="name" + @select="handleSelectClient('client', $event)" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('client')"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div class="common-select-btn" @click="clearupClient('client')"> + <i class="el-icon-edit-outline" title="娓呴櫎"></i> + </div> </div> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鎶ヤ环缂栧彿" prop="quotationNo"> - <el-input v-model="editConfig.infomation.quotationNo"></el-input> + <el-form-item label="鎶ヤ环缂栧彿" prop="number"> + <el-input v-model="editConfig.infomation.number"></el-input> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鎶ヤ环鍗曠姸鎬�" prop="quotationStatus"> - <CommonSelectView - :common-value="editConfig.infomation.quotationStatus" - :common-options="quotationStatusOptions" - /> + <el-form-item label="鎶ヤ环鍗曠姸鎬�" prop="quotation_status_id"> + <div class="common-select"> + <el-select + v-model="editConfig.infomation.quotation_status_id" + placeholder="璇烽�夋嫨" + class="common-select-sel" + size="mini" + > + <el-option + v-for="item in quotationStatusOptions" + :key="item.id" + :label="item.name" + :value="item.id" + > + </el-option> + </el-select> + <!-- @click="editDropdownBox" --> + <div class="common-select-btn"><i class="el-icon-setting"></i></div> + </div> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鏈夋晥鏈熻嚦" prop="validTo"> - <el-date-picker v-model="editConfig.infomation.validTo" type="date" placeholder="閫夋嫨鏃ユ湡"> + <el-form-item label="鏈夋晥鏈熻嚦" prop="validity_date"> + <el-date-picker v-model="editConfig.infomation.validity_date" type="date" placeholder="閫夋嫨鏃ユ湡"> </el-date-picker> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鑱旂郴浜哄鍚�" prop="contactName"> + <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_id"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.contactName"></el-input> - <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> - <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> + <el-autocomplete + v-model="editConfig.infomation.contact_name" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'contact') + } + " + value-key="name" + @select="handleSelectClient('contact', $event)" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('contact')"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div class="common-select-btn" @click="clearupClient('contact')"> + <i class="el-icon-edit-outline" title="娓呴櫎"></i> + </div> </div> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="閿�鍞礋璐d汉" prop="salesHead"> + <el-form-item label="閿�鍞礋璐d汉" prop="member_id"> <el-select - v-model="editConfig.infomation.salesHead" + v-model="editConfig.infomation.member_id" placeholder="璇烽�夋嫨" size="mini" style="width: 63%" > - <el-option - v-for="item in salesHeadOptions" - :key="item.value" - :label="item.label" - :value="item.value" - > + <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> </el-option> </el-select> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="閿�鍞満浼�" prop="salesOpportunity"> + <el-form-item label="閿�鍞満浼�" prop="sale_chance_id"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.salesOpportunity"></el-input> + <el-input v-model="editConfig.infomation.sale_chance_id"></el-input> <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> </div> @@ -89,21 +126,21 @@ </div> <!-- 鏉℃涓庢潯浠� --> <div class="basic-info-title">鏉℃涓庢潯浠�</div> - <div class="address-view"> + <div class="basic-info-view"> <el-row> <el-col :span="24"> - <el-form-item label="鏉℃涓庢潯浠�" prop="termsTreaty"> + <el-form-item label="鏉℃涓庢潯浠�" prop="conditions"> <el-input type="textarea" :autosize="{ minRows: 4 }" - v-model="editConfig.infomation.termsTreaty" + v-model="editConfig.infomation.conditions" ></el-input> </el-form-item> </el-col> </el-row> </div> <!-- 闄勪欢淇℃伅 --> - <div class="basic-info-title">闄勪欢淇℃伅</div> + <!-- <div class="basic-info-title">闄勪欢淇℃伅</div> <div class="basic-info-view"> <el-row> <el-col :span="12"> @@ -128,9 +165,9 @@ </el-form-item> </el-col> </el-row> - </div> + </div> --> <!-- 浜у搧绠$悊 --> - <div class="basic-info-title" style="display: flex"> + <!-- <div class="basic-info-title" style="display: flex"> 浜у搧绠$悊 <div style="margin-left: 400px"> 甯佺 @@ -142,9 +179,9 @@ </div> <div class="product-view"> <CommonFormTableView :show-summary="showSummary" :product-table-list="productTableList" /> - </div> + </div> --> <!-- 閫夋嫨瀹℃壒娴佺▼ --> - <div class="basic-info-title">閫夋嫨瀹℃壒娴佺▼</div> + <!-- <div class="basic-info-title">閫夋嫨瀹℃壒娴佺▼</div> <div class="basic-info-view"> <el-row> <el-col :span="20"> @@ -181,22 +218,36 @@ </el-form-item> </el-col> </el-row> - </div> + </div> --> </div> </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> - <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆瓨</el-button> + <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> --> + <el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button> <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button> </div> + <!-- 閫夋嫨瀹㈡埛 --> + <SelectClientDialog + v-if="editSelectClientConfig.editVisible" + :edit-common-config="editSelectClientConfig" + @selClient="selClient" + /> + <!-- 閫夋嫨鑱旂郴浜� --> + <SelectContactDialog + v-if="editSelectContactConfig.editVisible" + :edit-common-config="editSelectContactConfig" + @selClient="selClient" + /> </el-dialog> </div> </template> <script> -import CommonSelectView from "@/components/makepager/CommonSelectView" -import CommonFormTableView from "@/components/makepager/CommonFormTableView" +// import CommonFormTableView from "@/components/makepager/CommonFormTableView" +import { getAllData } from "@/api/client/client" +import { getAddQuotation, getUpdateQuotation } from "@/api/sales/quotation" +import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" +import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog" export default { name: "QuotationDialog", props: { @@ -206,28 +257,21 @@ return { visible: false, title: "鏂板缓", - infomation: { - customName: "", - quotationNo: "AC6521", - quotationStatus: "", - validTo: "", - contactName: "", - salesHead: "", - salesOpportunity: "", - termsTreaty: "", - approvalWorkflow: "", - approvalSteps: "", - approvalPerson: "", - approvalOpinion: "" - } + infomation: {} } } } }, - components: { CommonSelectView, CommonFormTableView }, + components: { SelectClientDialog, SelectContactDialog }, computed: { searchCommonHeight() { return this.$refs.searchCommonView.offsetHeight + }, + clientList() { + return this.$store.state.getClientName.clientList + }, + contactNamelist() { + return this.$store.state.getClientName.contactNamelist } }, data() { @@ -235,27 +279,14 @@ dialogWidth: "80%", editConfig: this.editCommonConfig, rules: { - customName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - quotationNo: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - quotationStatus: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - salesHead: [{ required: true, message: "璇烽�夋嫨璐熻矗浜�", trigger: "change" }] + client_id: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + number: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + quotation_status_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], + member_id: [{ required: true, message: "璇烽�夋嫨璐熻矗浜�", trigger: "change" }] }, - salesHeadOptions: [ - // 閿�鍞礋璐d汉 - { value: "1", label: "BOSS" }, - { value: "2", label: "Mia" }, - { value: "3", label: "璐㈠姟" }, - { value: "4", label: "甯傚満" }, - { value: "5", label: "绯荤粺绠$悊鍛�" }, - { value: "6", label: "閿�鍞�" }, - { value: "7", label: "閿�鍞�荤洃" } - ], - quotationStatusOptions: [], // 鎶ヤ环鍗曠姸鎬� - currencyOptions: [ - { value: "1", label: "浜烘皯甯�(楼)" }, - { value: "2", label: "鑻遍晳(拢)" }, - { value: "3", label: "娆у厓(鈧�)" } - ], // 甯佺 + memberOptions: [], + quotationStatusOptions: [{ id: 1, name: "涓嶇煡閬�" }], // 鎶ヤ环鍗曠姸鎬� + currencyOptions: [], // 甯佺 approvalWorkflowOptions: [], // 瀹℃壒娴佺▼ productTableList: {}, showSummary: { @@ -263,15 +294,153 @@ total: true, sumProp: ["other1", "other2", "other3", "other4"], mergeNumber: 3 - } + }, + editSelectClientConfig: { + editVisible: false, + title: "", + infomation: {} + }, + editSelectContactConfig: { + editVisible: false, + title: "", + infomation: {} + }, + clientId: this.editCommonConfig.infomation.client_id, + contactId: this.editCommonConfig.infomation.contact_id } }, created() { + this.$store.dispatch("geClient") + this.$store.dispatch("geContact") this.setTableForm() + this.getCommonData() }, methods: { + getCommonData() { + getAllData() + .then((res) => { + this.memberOptions = res.data.member + this.quotationStatusOptions = res.data.quotationStatus + }) + .catch((err) => { + console.log(err) + }) + }, + // 淇濆瓨 + saveClick(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + console.log(this.editConfig.infomation) + const params = this.saveParams() + console.log(params) + if (this.editConfig.title === "鏂板缓") { + getAddQuotation(params) + .then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message({ + message: "娣诲姞鎴愬姛", + type: "success" + }) + this.$parent.getData() + } + }) + .catch((err) => { + console.log(err) + }) + } else { + getUpdateQuotation(params) + .then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message({ + message: "缂栬緫鎴愬姛", + type: "success" + }) + this.$parent.getData() + } + }) + .catch((err) => { + console.log(err) + }) + } + } else { + console.log("error submit") + return false + } + }) + }, + saveParams() { + let data = this.editConfig.infomation + let params = { + id: this.editConfig.title === "鏂板缓" ? 0 : data.id, + client_id: parseInt(this.clientId) || 0, + conditions: data.conditions || "", + contact_id: parseInt(this.contactId) || 0, + file: data.file || "", + member_id: data.member_id || 0, + number: data.number || "", + quotation_status_id: data.quotation_status_id || 0, + sale_chance_id: data.sale_chance_id || 0, + validity_date: data.validity_date || "" + } + return params + }, handleClose() { this.editConfig.visible = false + }, + // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶 + querySearchAsync(queryString, cb, value) { + var restaurants = [] + if (value === "client") { + restaurants = this.clientList + } else if (value === "contact") { + restaurants = this.contactNamelist + } + var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants + cb(results) + }, + createStateFilter(queryString) { + return (state) => { + return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + } + }, + handleSelectClient(value, item) { + console.log(value) + if (value === "client") { + this.clientId = item.id + } else { + this.contactId = item.id + } + }, + selClientClick(value) { + if (value === "client") { + this.editSelectClientConfig.editVisible = true + } else if (value === "contact") { + this.editSelectContactConfig.editVisible = true + } + }, + selClient(row, value) { + console.log(value) + if (value === "contact") { + this.editConfig.infomation.contact_name = row.name + this.contactId = row.id + } else { + this.editConfig.infomation.client_name = row.name + this.clientId = row.id + } + }, + // 娓呴櫎宸查�夋嫨鐢ㄦ埛 + clearupClient(value) { + if (value === "client") { + this.editConfig.infomation.client_name = "" + this.clientId = 0 + } else { + this.editConfig.infomation.contact_name = "" + this.contactId = 0 + } }, // 娣诲姞闄勪欢 addAnnexClick() {}, @@ -315,51 +484,54 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> -.add-quotation { - .basic-info { - .basic-info-title { - background-color: #f4f8fe; - padding-left: 10px; - font-size: 15px; - font-weight: bold; - color: #666; - height: 42px; - line-height: 42px; - } - .basic-info-view { - margin-top: 10px; - padding-right: 40px; - .custom-name { +::v-deep { + .iframe-dialog .el-dialog__body { + .basic-info { + .basic-info-title { + background-color: #f4f8fe; + padding-left: 10px; + font-size: 15px; + font-weight: bold; + color: #666; + height: 42px; + line-height: 42px; + } + .basic-info-view { + margin-top: 10px; + padding-right: 40px; + .custom-name, + .common-select { + display: flex; + .common-select-sel { + width: 270px; + } + .common-select-btn { + margin-left: 5px; + font-size: 16px; + cursor: pointer; + } + } + } + .annex-view { display: flex; - .common-select-btn { - margin-left: 5px; - font-size: 18px; + color: #6166d3; + .setFormat { + margin-left: 10px; } } } - .address-view { - margin-top: 10px; - padding-right: 40px; - } - .annex-view { + .unflod-collapse { display: flex; + height: 30px; + justify-content: center; + align-items: center; color: #6166d3; - .setFormat { - margin-left: 10px; - } } - } - .unflod-collapse { - display: flex; - height: 30px; - justify-content: center; - align-items: center; - color: #6166d3; - } - .dialog-footer { - background-color: #f5f5f5; - height: 55px; - line-height: 55px; + .dialog-footer { + background-color: #f5f5f5; + height: 55px; + line-height: 55px; + } } } </style> -- Gitblit v1.8.0