From c1adf27fbabbff1d76b60993521c765ef1ed79ef Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期二, 15 八月 2023 20:03:21 +0800 Subject: [PATCH] 新建客户管理 客户名称查重 --- src/views/sales/refundForm/AddRefundFormDialog.vue | 274 +++++++++++++++++++++++++++++------------------------- 1 files changed, 148 insertions(+), 126 deletions(-) diff --git a/src/views/sales/refundForm/AddRefundFormDialog.vue b/src/views/sales/refundForm/AddRefundFormDialog.vue index f600c21..2d4e02b 100644 --- a/src/views/sales/refundForm/AddRefundFormDialog.vue +++ b/src/views/sales/refundForm/AddRefundFormDialog.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,11 +24,20 @@ <div class="basic-info-view"> <el-row> <el-col :span="12"> - <el-form-item label="瀹㈡埛鍚嶇О" prop="clientId"> + <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.clientId"></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="querySearchAsync" + value-key="name" + @select="handleSelectClient" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div class="common-select-btn" @click="clearupClient"> + <i class="el-icon-edit-outline" title="娓呴櫎"></i> + </div> </div> </el-form-item> </el-col> @@ -35,7 +46,7 @@ <el-input v-model="editConfig.infomation.number"></el-input> </el-form-item> </el-col> - <el-col :span="12"> + <!-- <el-col :span="12"> <el-form-item label="閫夋嫨婧愬崟" prop="selSourceOrder"> <el-select v-model="editConfig.infomation.selSourceOrder" size="mini" style="width: 63%"> <el-option @@ -47,7 +58,7 @@ </el-option> </el-select> </el-form-item> - </el-col> + </el-col> --> <el-col :span="12"> <el-form-item label="閿�鍞礋璐d汉" prop="memberId"> <el-select @@ -56,22 +67,27 @@ size="mini" style="width: 63%" > - <el-option v-for="item in memberOptions" :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="refundDate"> - <el-date-picker v-model="editConfig.infomation.refundDate" type="date" placeholder="閫夋嫨鏃ユ湡"> + <el-date-picker + v-model="editConfig.infomation.refundDate" + value-format="yyyy-MM-dd" + type="date" + placeholder="閫夋嫨鏃ユ湡" + > </el-date-picker> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="浠樻鏂瑰紡" prop="refundMethod"> + <el-form-item label="浠樻鏂瑰紡" prop="paymentTypeId"> <div class="common-select"> <el-select - v-model="editConfig.infomation.refundMethod" + v-model="editConfig.infomation.paymentTypeId" placeholder="璇烽�夋嫨" class="common-select-sel" size="mini" @@ -79,7 +95,7 @@ <el-option v-for="item in refundMethodOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -95,7 +111,7 @@ <el-option v-for="item in accountOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -108,10 +124,9 @@ class="common-select-sel" size="mini" > - <el-option v-for="item in isInvoiceOptions" :key="item.id" :label="item.name" :value="item.id"> - </el-option> + <el-option v-for="item in isInvoiceOptions" :key="item" :label="item" :value="item"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -133,7 +148,7 @@ </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"> @@ -158,7 +173,7 @@ </el-form-item> </el-col> </el-row> - </div> + </div> --> <!-- 浜у搧绠$悊 --> <div class="basic-info-title" style="display: flex"> 浜у搧绠$悊 @@ -222,9 +237,15 @@ </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="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" + /> </el-dialog> </div> </template> @@ -233,6 +254,7 @@ import CommonFormTableView from "@/components/makepager/CommonFormTableView" import { getAllData } from "@/api/client/client" import { getAddSalesRefund, getUpdateSalesRefund } from "@/api/sales/refundForm" +import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" export default { name: "AddRefundFormDialog", props: { @@ -247,8 +269,12 @@ } } }, - components: { CommonFormTableView }, - computed: {}, + components: { CommonFormTableView, SelectClientDialog }, + computed: { + clientList() { + return this.$store.state.getClientName.clientList + } + }, data() { return { dialogWidth: "80%", @@ -261,25 +287,11 @@ account: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }] }, memberOptions: [], - selSourceOrderOptions: [{ value: "1", label: "閿�鍞��璐у崟" }], // 閫夋嫨婧愬崟 - refundMethodOptions: [ - { value: "1", label: "鐜伴噾" }, - { value: "2", label: "鏀エ" }, - { value: "3", label: "鐢垫眹" }, - { value: "4", label: "閭斂姹囨" }, - { value: "5", label: "缃戜笂閾惰" }, - { value: "6", label: "鍏朵粬" } - ], // 浠樻鏂瑰紡 - accountOptions: [{ value: "1", label: "浜烘皯甯佽处鎴�" }], // 璐︽埛 - isInvoiceOptions: [ - { value: "1", label: "鏈紑" }, - { value: "2", label: "宸插紑" } - ], // 鏄惁寮�绁� - currencyOptions: [ - { value: "1", label: "浜烘皯甯�(楼)" }, - { value: "2", label: "鑻遍晳(拢)" }, - { value: "3", label: "娆у厓(鈧�)" } - ], // 甯佺 + // selSourceOrderOptions: [{ value: "1", label: "閿�鍞��璐у崟" }], // 閫夋嫨婧愬崟 + refundMethodOptions: [], // 浠樻鏂瑰紡 + accountOptions: [], // 璐︽埛 + isInvoiceOptions: ["鏄�", "鍚�"], // 鏄惁寮�绁� + currencyOptions: [], // 甯佺 approvalWorkflowOptions: [], // 瀹℃壒娴佺▼ productTableList: {}, showSummary: { @@ -287,10 +299,17 @@ total: true, sumProp: ["other1", "other2", "other3", "other4"], mergeNumber: 5 - } + }, + editSelectClientConfig: { + editVisible: false, + title: "", + infomation: {} + }, + clientId: this.editCommonConfig.infomation.client_id } }, created() { + this.$store.dispatch("geClient") this.setTableForm() this.getCommonData() }, @@ -299,6 +318,10 @@ getAllData() .then((res) => { this.memberOptions = res.data.member + this.refundMethodOptions = res.data.refundMethod + this.accountOptions = res.data.accountId + // this.isInvoiceOptions = res.data.isInvoice + this.currencyOptions = res.data.currency }) .catch((err) => { console.log(err) @@ -312,37 +335,23 @@ const params = this.saveParams() console.log(params) if (this.editConfig.title === "鏂板缓") { - getAddSalesRefund(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) - }) + getAddSalesRefund(params).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("娣诲姞鎴愬姛") + this.$parent.getData() + } + }) } else { - getUpdateSalesRefund(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) - }) + getUpdateSalesRefund(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") @@ -356,21 +365,11 @@ id: this.editConfig.title === "鏂板缓" ? 0 : data.id, salesRefund: { accountId: data.accountId || 0, - clientId: data.clientId || 0, - isInvoice: data.isInvoice || 0, + clientId: this.clientId || 0, + isInvoice: data.isInvoice || "", memberId: data.memberId || 0, number: data.number || "", - products: [ - { - amount: 0, - desc: "", - id: 0, - name: "", - number: "", - price: 0, - total: 0 - } - ], + products: data.products || [], reason: data.reason || "", refundDate: data.refundDate || "", refundMethod: data.refundMethod || "" @@ -380,6 +379,33 @@ }, handleClose() { this.editConfig.visible = false + }, + // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶 + querySearchAsync(queryString, cb) { + var restaurants = this.clientList + var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants + cb(results) + }, + createStateFilter(queryString) { + return (state) => { + return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + } + }, + handleSelectClient(item) { + this.clientId = item.id + }, + selClientClick() { + this.editSelectClientConfig.editVisible = true + }, + selClient(row) { + console.log(row) + this.editConfig.infomation.client_name = row.name + this.clientId = row.id + }, + // 娓呴櫎宸查�夋嫨鐢ㄦ埛 + clearupClient() { + this.editConfig.infomation.client_name = "" + this.clientId = 0 }, // 娣诲姞闄勪欢 addAnnexClick() {}, @@ -423,58 +449,54 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> -.add-refund-form { - .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 { - display: flex; - .common-select-btn { - margin-left: 5px; - font-size: 18px; +::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; + } } } - .common-select { + .annex-view { display: flex; - .common-select-sel { - width: 270px; - } - .common-select-btn { - margin-left: 5px; - font-size: 16px; - cursor: pointer; + color: #6166d3; + .setFormat { + margin-left: 10px; } } } - .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