| | |
| | | append-to-body |
| | | custom-class="iframe-dialog" |
| | | > |
| | | <el-form v-if="refreshFlag" |
| | | <el-form |
| | | v-if="refreshFlag" |
| | | ref="form" |
| | | :model="editConfig.infomation" |
| | | :rules="rules" |
| | |
| | | <div class="basic-info-title">机会基本信息</div> |
| | | <div class="basic-info-view"> |
| | | <el-row> |
| | | <!-- <el-col :span="12">--> |
| | | <!-- <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="number"> |
| | | <WordInput |
| | | v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0" |
| | | :codenumer="codenumer" |
| | | :sum="sum" |
| | | :disabled="editConfig.infomation.id || isIdDisabled" |
| | | :inputValue="inputValue" |
| | | @codeList="codeList" |
| | | /> |
| | | <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> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :span="12">--> |
| | | <!-- <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="number"> |
| | | <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" |
| | | :disabled="editConfig.title !== '新建' || isIdDisabled" |
| | | :inputValue="inputValue" |
| | | @codeList="codeList" |
| | | /> |
| | | <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> --> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="机会名称" prop="name"> |
| | | <div class="custom-name"> |
| | | <el-input v-model="editConfig.infomation.name"></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> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客户名称" prop="client_name" ref="clientName"> |
| | | <div class="custom-name"> |
| | |
| | | </div> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="机会名称" prop="name"> |
| | | <div class="custom-name"> |
| | | <el-input v-model="editConfig.infomation.name"></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> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="联系人姓名" prop="contact_name"> |
| | | <div class="custom-name"> |
| | |
| | | " |
| | | value-key="name" |
| | | @select="handleSelectClient('contact', $event)" |
| | | placeholder="请先选择客户名称" |
| | | :disabled="isContact" |
| | | ></el-autocomplete> |
| | | <div class="common-select-btn" @click="selClientClick('contact')"> |
| | | <div v-if="!isContact" class="common-select-btn" @click="selClientClick('contact')"> |
| | | <i class="el-icon-circle-plus-outline" title="选择"></i> |
| | | </div> |
| | | <div |
| | | v-if="editConfig.infomation.contact_name && editConfig.infomation.contact_name.length > 0" |
| | | v-if=" |
| | | editConfig.infomation.contact_name && |
| | | editConfig.infomation.contact_name.length > 0 && |
| | | !isContact |
| | | " |
| | | class="common-select-btn" |
| | | @click="clearupClient('contact')" |
| | | > |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="商机来源" prop="sales_sources_id"> |
| | | <el-form-item label="机会来源" prop="sales_sources_id"> |
| | | <div class="common-select"> |
| | | <el-select |
| | | v-model="editConfig.infomation.sales_sources_id" |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="商机类型" prop="sale_type_id"> |
| | | <el-form-item label="机会类型" prop="sale_type_id"> |
| | | <div class="common-select"> |
| | | <el-select |
| | | v-model="editConfig.infomation.sale_type_id" |
| | |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | |
| | | <!-- 产品管理 --> |
| | | <div class="basic-info-title" style="display: flex"> |
| | | 产品管理 |
| | | <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 class="product-view"> |
| | | <CommonFormTableView |
| | | :show-summary="showSummary" |
| | | :product-table-list="productTableList" |
| | | @inputContent="inputContent" |
| | | @addProductClick="addProductClick" |
| | | @emptyProductClick="emptyProductClick" |
| | | @recalculateProductClick="recalculateProductClick" |
| | | @clearupProduct="clearupProduct" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- 商机七要素 --> |
| | | <div class="basic-info-title">商机七要素(5W2P)</div> |
| | | <div class="basic-info-view"> |
| | |
| | | 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" |
| | | export default { |
| | | name: "AddSalesOpportunityDialog", |
| | | mixins:[codeMixin], |
| | | mixins: [codeMixin], |
| | | props: { |
| | | editCommonConfig: { |
| | | type: Object, |
| | |
| | | } |
| | | } |
| | | }, |
| | | components: {WordInput, SelectClientDialog, SelectContactDialog }, |
| | | components: { CommonFormTableView, SelectClientDialog, SelectContactDialog }, |
| | | computed: { |
| | | searchCommonHeight() { |
| | | return this.$refs.searchCommonView.offsetHeight |
| | | }, |
| | | clientList() { |
| | | return this.$store.state.getClientName.clientList |
| | | }, |
| | | contactNamelist() { |
| | | return this.$store.state.getClientName.contactNamelist |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | refreshFlag:true, |
| | | refreshFlag: true, |
| | | 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: "请选择销售负责人", 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" }], |
| | | projected_amount: [{ required: true, message: "请输入预计合同金额", trigger: "blur" }], |
| | | client_name: [{ required: true, message: "请选择客户", trigger: "change" }], |
| | | client_name: [{ required: true, message: "请选择客户", trigger: "change" }] |
| | | }, |
| | | businessSourceOptions: [], |
| | | memberOptions: [], |
| | |
| | | restaurants: [], |
| | | clientId: this.editCommonConfig.infomation.client_id, |
| | | contactId: this.editCommonConfig.infomation.contact_id, |
| | | objCode: { name: "", page: 0, pageSize: 0, type: "销售机会编码",codeStandID:'' }, |
| | | objCode: { name: "", page: 0, pageSize: 0, type: "销售机会编码", codeStandID: "" }, |
| | | isContact: true, |
| | | contactNamelist: [], |
| | | tableData: [], |
| | | productTableList: {}, |
| | | showSummary: { |
| | | show: true, |
| | | total: true, |
| | | sumProp: ["Amount", "total"], |
| | | mergeNumber: 2 |
| | | }, |
| | | productId: 1 |
| | | } |
| | | }, |
| | | created() { |
| | | this.$store.dispatch("geClient") |
| | | this.$store.dispatch("geContact") |
| | | if (this.editConfig.title !== "新建" && this.editConfig.infomation.province_id !== 0) { |
| | | this.getCityList(this.editConfig.infomation.province_id, "edit") |
| | | } |
| | | this.setTableForm() |
| | | this.getCommonData() |
| | | this.formInfo(); |
| | | this.formInfo() |
| | | if (this.editConfig.title === "编辑") { |
| | | this.isContact = false |
| | | this.getContactList(this.editConfig.infomation.contact_id) |
| | | } |
| | | }, |
| | | watch:{ |
| | | 'editConfig.visible'(val){ |
| | | if(val){ |
| | | watch: { |
| | | "editConfig.visible"(val) { |
| | | if (val) { |
| | | this.formInfo() |
| | | } |
| | | }, |
| | | 'editConfig.infomation.codeStandID'(){ |
| | | this.formInfo() |
| | | } |
| | | }, |
| | | methods: { |
| | | formInfo(){ |
| | | this.objCode.codeStandID = '' |
| | | if(this.editConfig.infomation.codeStandID){ |
| | | this.objCode.codeStandID = this.editConfig.infomation.codeStandID; |
| | | formInfo() { |
| | | this.objCode.codeStandID = "" |
| | | if (this.editConfig.infomation.codeStandID) { |
| | | this.objCode.codeStandID = this.editConfig.infomation.codeStandID |
| | | } |
| | | this.getRCodeStandardList(); |
| | | this.getRCodeStandardList() |
| | | }, |
| | | getCommonData() { |
| | | this.editConfig.infomation.country_id = 1 |
| | |
| | | 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.editConfig.infomation.member_id = item.id |
| | | } |
| | | }) |
| | | } |
| | | this.businessSourceOptions = res.data.sales_source |
| | | this.businessTypeOptions = res.data.sale_type |
| | | this.oldCustomerMarketOptions = res.data.regular_customers |
| | |
| | | saveClick(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | console.log(this.editConfig.infomation) |
| | | const hasProduct = this.tableData.every((ele) => !!ele.name) |
| | | if (!hasProduct) { |
| | | this.$message.error("产品名称不能为空") |
| | | return |
| | | } |
| | | |
| | | const params = this.saveParams() |
| | | console.log(params) |
| | | if (this.editConfig.title === "新建") { |
| | |
| | | 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 { |
| | |
| | | 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 : "编辑失败!") |
| | | } |
| | | }) |
| | | } |
| | |
| | | status_id: data.status_id || 0, |
| | | threats: data.threats || "", |
| | | whether_established: data.whether_established || "", |
| | | |
| | | remark: data.remark || "", |
| | | detail_address: data.detail_address || "", |
| | | |
| | | codeStandID:data.ID, |
| | | codeRule:this.codeRule, |
| | | codeStandID: data.ID, |
| | | products: this.tableData |
| | | } |
| | | return params |
| | | }, |
| | | // 获取联系人列表 |
| | | getContactList(id) { |
| | | getContactList({ |
| | | page: 0, |
| | | pageSize: 0, |
| | | search_map: { |
| | | client_id: id |
| | | } |
| | | }).then((res) => { |
| | | if (res.code == 200) { |
| | | this.contactNamelist = res.data.list |
| | | } |
| | | }) |
| | | }, |
| | | // 选择用户相关方法 |
| | | querySearchAsync(queryString, cb, value) { |
| | |
| | | handleSelectClient(value, item) { |
| | | if (value === "client") { |
| | | this.clientId = item.id |
| | | this.editConfig.infomation.client_name = item.name |
| | | this.editConfig.infomation.contact_name = "" |
| | | this.contactId = 0 |
| | | this.isContact = false |
| | | this.getContactList(item.id) |
| | | } else if (value === "contact") { |
| | | this.editConfig.infomation.contact_name = item.name |
| | | this.contactId = item.id |
| | | } |
| | | this.refresh() |
| | | }, |
| | | selClientClick(value) { |
| | | if (value === "client") { |
| | | this.editSelectClientConfig.editVisible = true |
| | | } else if (value === "contact") { |
| | | this.editSelectContactConfig.editVisible = true |
| | | this.editSelectContactConfig.clientId = this.clientId |
| | | } |
| | | }, |
| | | selClient(row, value) { |
| | |
| | | } else if (value === "client") { |
| | | this.editConfig.infomation.client_name = row.name |
| | | this.clientId = row.id |
| | | this.editConfig.infomation.contact_name = "" |
| | | this.contactId = 0 |
| | | this.isContact = false |
| | | this.getContactList(row.id) |
| | | } |
| | | this.refresh() |
| | | }, |
| | |
| | | * 强制刷新form组件 |
| | | * 外部更改表单值不会触发表单校验,导致即使有值夜被表单校验阻塞住 |
| | | */ |
| | | refresh(){ |
| | | this.refreshFlag=false |
| | | requestAnimationFrame(()=>{ |
| | | this.refreshFlag=true |
| | | refresh() { |
| | | this.refreshFlag = false |
| | | requestAnimationFrame(() => { |
| | | this.refreshFlag = true |
| | | }) |
| | | }, |
| | | // 清除已选择用户 |
| | |
| | | if (value === "client") { |
| | | this.editConfig.infomation.client_name = "" |
| | | this.clientId = 0 |
| | | this.isContact = true |
| | | this.editConfig.infomation.contact_name = "" |
| | | this.contactId = 0 |
| | | } else if (value === "contact") { |
| | | this.editConfig.infomation.contact_name = "" |
| | | this.contactId = 0 |
| | |
| | | }, |
| | | async getCityList(val, value) { |
| | | await getCityList({ province_id: val }).then((res) => { |
| | | console.log(res) |
| | | if (res.data.code === 200) { |
| | | this.cityOptions = res.data.data.list |
| | | if (res.code === 200) { |
| | | this.cityOptions = res.data.list |
| | | if (value === "sel") { |
| | | this.editConfig.infomation.city_id = "" |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | setTableForm() { |
| | | if (this.editConfig.title === "新建" || this.editConfig.infomation.products.length === 0) { |
| | | this.tableData = [ |
| | | { |
| | | 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: "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) { |
| | | this.productId = row.productId |
| | | this.tableData.map((item) => { |
| | | if (item.productId === row.productId) { |
| | | item[prop] = val |
| | | } |
| | | }) |
| | | }, |
| | | // 产品新增 |
| | | addProductClick() { |
| | | this.productId++ |
| | | this.tableData.push({ |
| | | productId: this.productId, |
| | | id: 0, |
| | | amount: 0, |
| | | desc: "", |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | total: 0 |
| | | }) |
| | | this.showSummary.show = true |
| | | }, |
| | | // 产品清空 |
| | | emptyProductClick() { |
| | | this.productId = 1 |
| | | this.tableData = [ |
| | | { |
| | | productId: this.productId, |
| | | id: 0, |
| | | amount: 0, |
| | | desc: "", |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | total: 0 |
| | | } |
| | | ] |
| | | this.productTableList.tableData = this.tableData |
| | | }, |
| | | // 产品重算 |
| | | recalculateProductClick() {}, |
| | | clearupProduct(data) { |
| | | this.tableData = data |
| | | this.productTableList.tableData = this.tableData |
| | | }, |
| | | // 销售负责人自定义校验规则 |
| | | validateMemberId(rule, value, callback) { |
| | | if (this.editConfig.infomation?.member_id > 0) { |
| | | callback() |
| | | } else { |
| | | callback(new Error("请选择销售负责人")) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | flex: 1; |
| | | } |
| | | } |
| | | .custom-name{ |
| | | .el-autocomplete{ |
| | | .custom-name { |
| | | .el-autocomplete { |
| | | flex: 1; |
| | | } |
| | | } |