From 29b5ffe318b8ab32865ebebedd865ea2aa3f6c7e Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 06 九月 2023 17:45:31 +0800
Subject: [PATCH] 供应商列表相关bug修复及样式调整
---
src/views/purchaseManage/purchase/components/AddPurchase.vue | 401 ++++++++++++++++++++++++++++++++++----------------------
1 files changed, 243 insertions(+), 158 deletions(-)
diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index 816cb6d..c3cda91 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -3,7 +3,7 @@
<el-dialog
:title="editCommonConfig.title + '閲囪喘鍗�'"
:visible.sync="editConfig.visible"
- :width="dialogWidth"
+ width="50%"
:before-close="handleClose"
append-to-body
custom-class="iframe-dialog"
@@ -26,20 +26,21 @@
<el-col :span="12">
<el-form-item
label="閲囪喘绫诲瀷"
- prop="brand"
- class="form-item float_left"
+ prop="purchaseTypeId"
+ class="float_left"
+ style="width:100%;"
>
<el-select
placeholder="璇烽�夋嫨閲囪喘绫诲瀷"
- v-model="editConfig.infomation.client_name"
+ v-model="editConfig.infomation.purchaseTypeId"
clearable
style="width: calc(100% - 30px)"
>
<el-option
v-for="ele in plcBrandList"
- :key="ele.id"
+ :key="ele.name"
:label="ele.name"
- :value="ele.name"
+ :value="ele.ID"
></el-option>
</el-select>
<i
@@ -51,11 +52,11 @@
</el-col>
<el-col :span="12">
- <el-form-item label="渚涘簲鍟嗗悕绉�" prop="client_name">
+ <el-form-item label="渚涘簲鍟嗗悕绉�" prop="supplierName">
<div class="custom-name">
<el-autocomplete
style="width: calc(100% - 40px)"
- v-model="editConfig.infomation.client_name"
+ v-model="editConfig.infomation.supplierName"
:fetch-suggestions="
(queryString, callback) => {
querySearchAsync(queryString, callback, 'client');
@@ -73,8 +74,8 @@
</div>
<div
v-if="
- editConfig.infomation.client_name &&
- editConfig.infomation.client_name.length > 0
+ editConfig.infomation.supplierName &&
+ editConfig.infomation.supplierName.length > 0
"
class="common-select-btn"
@click="clearupClient('client')"
@@ -85,43 +86,48 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍗曟嵁鏉ユ簮" prop="number">
+ <el-form-item label="鍗曟嵁鏉ユ簮" prop="orderSource">
<el-input
- v-model="editConfig.infomation.number"
+ v-model="editConfig.infomation.orderSource"
+ disabled
placeholder="璇峰~鍐�"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="閲囪喘鍗曞悕绉�" prop="number">
+ <el-form-item label="閲囪喘鍗曞悕绉�" prop="name">
<el-input
- v-model="editConfig.infomation.number"
+ v-model="editConfig.infomation.name"
placeholder="璇峰~鍐�"
+ clearable
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="渚涘簲鍟嗚仈绯讳汉" prop="number">
+ <el-form-item label="渚涘簲鍟嗚仈绯讳汉" prop="contact">
<el-input
- v-model="editConfig.infomation.number"
+ v-model="editConfig.infomation.contact"
placeholder="璇峰~鍐�"
+ clearable
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鑱旂郴鐢佃瘽" prop="contact_phone">
+ <el-form-item label="鑱旂郴鐢佃瘽" prop="phone">
<el-input
- v-model="editConfig.infomation.contact_phone"
+ v-model="editConfig.infomation.phone"
placeholder="璇峰~鍐�"
+ clearable
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="绛剧害鏃ユ湡" prop="validity_date">
+ <el-form-item label="绛剧害鏃ユ湡" prop="signingDate">
<el-date-picker
- v-model="editConfig.infomation.validity_date"
+ v-model="editConfig.infomation.signingDate"
style="width: 100%"
type="date"
+ clearable
placeholder="閫夋嫨鏃ユ湡"
value-format="yyyy-MM-dd"
>
@@ -129,11 +135,12 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="浜や粯鏃ユ湡" prop="validity_date">
+ <el-form-item label="浜や粯鏃ユ湡" prop="deliveryDate">
<el-date-picker
- v-model="editConfig.infomation.validity_date"
+ v-model="editConfig.infomation.deliveryDate"
style="width: 100%"
type="date"
+ clearable
placeholder="閫夋嫨鏃ユ湡"
value-format="yyyy-MM-dd"
>
@@ -141,13 +148,13 @@
</el-form-item>
</el-col>
<el-col :span="24">
- <el-form-item label="澶囨敞淇℃伅" prop="member_id">
+ <el-form-item label="澶囨敞淇℃伅" prop="remark">
<el-input
type="textarea"
:autosize="{ minRows: 3, maxRows: 4 }"
maxlength="500"
clearable
- v-model="editConfig.infomation.member_id"
+ v-model="editConfig.infomation.remark"
></el-input>
</el-form-item>
</el-col>
@@ -160,10 +167,11 @@
:show-summary="showSummary"
:recalculateShow="false"
:product-table-list="productTableList"
+ sign="purchase"
@inputContent="inputContent"
+ @getSummaries="getSummaries"
@addProductClick="addProductClick"
@emptyProductClick="emptyProductClick"
- @recalculateProductClick="recalculateProductClick"
@clearupProduct="clearupProduct"
/>
</div>
@@ -172,9 +180,10 @@
<div class="table-bottom-l">
<el-form-item label="鏁村崟鎶樻墸" prop="member_id">
<el-select
- v-model="editConfig.infomation.fieldName"
+ v-model="editConfig.infomation.wholeDiscountType"
placeholder="璇烽�夋嫨"
filterable
+ @change="getTotal"
>
<el-option label="鐧惧垎姣旈檷浠�" :value="1"></el-option>
<el-option label="鐩存帴闄嶄环" :value="2"></el-option>
@@ -184,8 +193,10 @@
<div class="table-bottom-r">
<el-form-item label="" prop="member_id">
<el-input
- v-model="editConfig.infomation.number"
+ v-model="editConfig.infomation.wholeDiscount"
size="mini"
+ :disabled="editConfig.infomation.wholeDiscountType?false:true"
+ @change="getTotal"
placeholder="璇峰~鍐�"
></el-input>
</el-form-item>
@@ -195,9 +206,10 @@
<div class="table-bottom-l">
<el-form-item label="璋冩暣" prop="member_id">
<el-select
- v-model="editConfig.infomation.fieldName"
+ v-model="editConfig.infomation.priceAdjustmentType"
placeholder="璇烽�夋嫨"
filterable
+ @change="getTotal"
>
<el-option label="澧炲姞" :value="1"></el-option>
<el-option label="鍑忓皯" :value="2"></el-option>
@@ -207,8 +219,10 @@
<div class="table-bottom-r">
<el-form-item label="" prop="member_id">
<el-input
- v-model="editConfig.infomation.number"
+ v-model="editConfig.infomation.priceAdjustment"
size="mini"
+ :disabled="editConfig.infomation.priceAdjustmentType?false:true"
+ @change="getTotal"
placeholder="璇峰~鍐�"
></el-input>
</el-form-item>
@@ -216,7 +230,7 @@
</div>
<div class="table-bottom-item">
<div class="table-bottom-l">鍚堣</div>
- <div class="table-bottom-r">26000.00</div>
+ <div class="table-bottom-r">{{ total }}</div>
</div>
</div>
</div>
@@ -230,10 +244,10 @@
>鍙栨秷</el-button
>
</div>
- <!-- 閫夋嫨瀹㈡埛 -->
- <SelectClientDialog
- v-if="editSelectClientConfig.editVisible"
- :edit-common-config="editSelectClientConfig"
+ <!-- 閫夋嫨渚涘簲鍟嗗悕绉�-->
+ <SelectSupplierDialog
+ v-if="editSelectSupplierConfig.editVisible"
+ :edit-common-config="editSelectSupplierConfig"
@selClient="selClient"
/>
</el-dialog>
@@ -241,6 +255,7 @@
ref="editDialog"
@sucessSet="handleGetBomKindDictList"
@handleConfirmSave="handleConfirmSave"
+ :editRow="editRow"
:workList="plcBrandList"
title="閲囪喘绫诲瀷"
></BomDialog>
@@ -249,19 +264,19 @@
<script>
import CommonFormTableView from "@/components/makepager/CommonFormTableView";
-import BomDialog from "@/views/purchaseManage/purchase/components/BomDialog";
+import BomDialog from "@/components/makepager/BomDialog";
+
import {
- getAddQuotation,
- getUpdateQuotation,
- getAllData,
+ addPurchase,
+ updatePurchase,
+ savePurchaseType,
+ getPurchaseType,
} from "@/api/purchaseManage/purchase";
-// import {
-// postGetUnitDictList,
-// postGetSaveSUnitDict,
-// } from "@/api/purchaseManage/purchase";
-import SelectClientDialog from "@/views/purchaseManage/purchase/components/SelectClientDialog";
+
+import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog";
export default {
name: "QuotationDialog",
+ components: { SelectSupplierDialog, CommonFormTableView,BomDialog },
props: {
editCommonConfig: {
type: Object,
@@ -274,46 +289,43 @@
},
},
},
- components: { SelectClientDialog, CommonFormTableView,BomDialog },
- computed: {
- searchCommonHeight() {
- return this.$refs.searchCommonView.offsetHeight;
- },
- contactNamelist() {
- return this.$store.state.getClientName.contactNamelist;
- },
- },
data() {
return {
- dialogWidth: "50%",
editConfig: this.editCommonConfig,
rules: {
- 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" },
- ],
- contact_phone: [
+ purchaseTypeId:[{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ supplierName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ phone: [
{
- required: true,
+ required: false,
message: "璇峰~鍐�",
trigger: "change",
},
{ validator: this.validatorPhone, trigger: "change" },
],
+ wholeDiscount: [
+ {
+ required: false,
+ message: "璇峰~鍐�0-100鐨勬暟瀛�",
+ trigger: "change",
+ },
+ { validator: this.validatorNum, trigger: "change" },
+ ],
+ priceAdjustment: [
+ {
+ required: false,
+ message: "璇峰~鍐�",
+ trigger: "change",
+ },
+ { validator: this.validatorNumThree, trigger: "change" },
+ ],
},
- memberOptions: [],
- quotationStatusOptions: [{ id: 1, name: "涓嶇煡閬�" }], // 鎶ヤ环鍗曠姸鎬�
- currencyOptions: [{ id: 1, name: "浜烘皯甯�" }], // 甯佺
- approvalWorkflowOptions: [], // 瀹℃壒娴佺▼
productTableList: {},
showSummary: {
show: true,
total: false,
- sumProp: ["Amount", "total"],
+ sumProp: ["price", "total"],
+ multiply:['amount','price'],
titleProp: [
"缂栧彿",
"浜у搧鍚嶇О",
@@ -324,62 +336,113 @@
"鎻忚堪",
],
mergeNumber: 4,
+ totalName:'灏忚'
},
- editSelectClientConfig: {
+ editSelectSupplierConfig: {
editVisible: false,
title: "",
infomation: {},
},
- clientId: this.editCommonConfig.infomation.client_id,
- contactId: this.editCommonConfig.infomation.contact_id,
- saleChanceId: this.editCommonConfig.infomation.sale_chance_id,
+ supplierId: this.editCommonConfig.infomation.supplierId,
tableData: [],
productId: 1,
isNoProduct: true,
clientList: [],
plcBrandList:[],
+ editRow:{
+ isDefault:'pin'
+ },
+ total:0,
+ totalTwo:0,
};
},
created() {
- this.setTableForm();
- this.getCommonData();
+ this.handleGetBomKindDictList();
+ },
+ computed: {
+ },
+ watch:{
+ 'editCommonConfig.visible':{
+ immediate:true,
+ handler:function(){
+
+ this.handleGetBomKindDictList(true);
+ }
+ }
},
methods: {
+ validatorNum(rule, value, callback) {
+ if(this.editConfig.infomation.wholeDiscountType==1){
+ if(value==undefined||value==null||(!value&&value!=0)){
+ callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
+ }else{
+ var reg=/^\+?[0-9]\d*$/
+ if(!reg.test(value)){
+ callback(new Error('璇峰~鍐�0-100鐨勬暟瀛�'))
+ }else{
+ if(Number(value)>100){
+ callback(new Error('璇峰~鍐�0-100鐨勬暟瀛�'))
+ }else{
+ callback()
+ }
+ }
+ }
+ }else{
+ this.validatorNumThree(rule, value, callback)
+ }
+ },
+ validatorNumThree(rule, value, callback){
+ if(value){
+ if(value==undefined||value==null){
+ callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
+ }else{
+ let reg2=/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
+ if(!reg2.test(value)){
+ callback(new Error('璇峰~鍐�2浣嶅皬鏁扮殑鏁板瓧'))
+ }else{
+ callback()
+ }
+ }
+ }else{
+ callback()
+ }
+ },
// PLC閰嶇疆璁剧疆
handleShow() {
- // this.handleGetBomKindDictList();
+ this.handleGetBomKindDictList();
this.$refs.editDialog.editDialogVisible = true;
},
// PLC閰嶇疆
handleGetBomKindDictList(val) {
- console.log(val,'val')
- // postGetUnitDictList().then((res) => {
- // this.plcBrandList = res.data;
- // if (val) {
- // for (let i in this.plcBrandList) {
- // if (this.plcBrandList[i].isDefault) {
- // this.form.unit = this.form.unit
- // ? this.form.unit
- // : this.plcBrandList[i].name;
- // this.$set(this.form, "unit", this.form.unit);
- // break;
- // }
- // }
- // }
- // });
+ getPurchaseType().then((res) => {
+ this.plcBrandList = res.data;
+ this.setTableForm()
+ if (val) {
+ for (let i in this.plcBrandList) {
+ if (this.plcBrandList[i][this.editRow.isDefault]) {
+ this.editConfig.infomation.purchaseTypeId = this.editConfig.infomation.purchaseTypeId
+ ? this.editConfig.infomation.purchaseTypeId
+ : this.plcBrandList[i].ID;
+ this.$set(this.editConfig.infomation, "purchaseTypeId", this.editConfig.infomation.purchaseTypeId);
+
+ break;
+ }
+ }
+ }
+ });
},
handleConfirmSave(data) {
console.log(data,'data')
- // postGetSaveSUnitDict({ data: data }).then((res) => {
- // if (res.code == 200) {
- // this.$message({
- // message: "鎿嶄綔鎴愬姛锛�",
- // type: "success",
- // });
- // this.$refs.editDialog.editDialogVisible = false;
- // this.handleGetBomKindDictList();
- // }
- // });
+ savePurchaseType(data).then((res) => {
+ if (res.code == 200) {
+ this.$message({
+ message: "鎿嶄綔鎴愬姛锛�",
+ type: "success",
+ });
+ this.$refs.editDialog.editDialogVisible = false;
+ this.handleGetBomKindDictList(true);
+ }
+ });
},
validatorPhone(rule, value, callback) {
if (value) {
@@ -402,17 +465,6 @@
callback();
}
},
- 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) => {
@@ -431,7 +483,7 @@
const params = this.saveParams();
console.log(params);
if (this.editConfig.title === "鍒涘缓") {
- getAddQuotation(params).then((res) => {
+ addPurchase(params).then((res) => {
console.log(res);
this.editConfig.visible = false;
if (res.code === 200) {
@@ -440,7 +492,7 @@
}
});
} else {
- getUpdateQuotation(params).then((res) => {
+ updatePurchase(params).then((res) => {
this.editConfig.visible = false;
if (res.code === 200) {
this.$message.success("缂栬緫鎴愬姛");
@@ -456,20 +508,37 @@
});
},
saveParams() {
- let data = this.editConfig.infomation;
+ let data =JSON.parse(JSON.stringify(this.editConfig.infomation));
+
+ if(this.editConfig.infomation.wholeDiscountType==2&&this.editConfig.infomation.wholeDiscount){
+ if(Number(this.editConfig.infomation.wholeDiscount)>Number(this.totalTwo)){
+ this.$message.error('鐩存帴闄嶄环涓嶈兘瓒呰繃浠风◣鍚堣鐨勬�诲拰锛�')
+ return true;
+ }
+ }
let params = {
- id: this.editConfig.title === "鍒涘缓" ? 0 : data.id,
- client_id: this.clientId || 0,
- conditions: data.conditions || "",
- contact_id: 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: this.saleChanceId || 0,
- validity_date: data.validity_date || "",
- products: this.tableData,
+ productList:this.tableData,
+ purchase:{
+ supplierId:this.supplierId||0,
+ signingDate:data.signingDate||'',
+ remark:data.remark,
+ orderSource:data.orderSource||'',
+ purchaseTypeId:data.purchaseTypeId||0,
+ phone:data.phone||'',
+ name:data.name||'',
+ deliveryDate:data.deliveryDate||'',
+ contact:data.contact,
+ wholeDiscountType:data.wholeDiscountType?data.wholeDiscountType:0,
+ wholeDiscount:data.wholeDiscount?Number(data.wholeDiscount):0,
+ priceAdjustmentType:data.priceAdjustmentType?data.priceAdjustmentType:0,
+ priceAdjustment:data.priceAdjustment?Number(data.priceAdjustment):0,
+ realTotalPrice:this.total?Number(this.total):0,
+ totalPrice:this.totalTwo?Number(this.totalTwo):0,
+ }
};
+ if(data.ID){
+ params.purchase.id=data.ID
+ }
return params;
},
handleClose() {
@@ -480,9 +549,7 @@
var restaurants = [];
if (value === "client") {
restaurants = this.clientList;
- } else if (value === "contact") {
- restaurants = this.contactNamelist;
- }
+ }
var results = queryString
? restaurants.filter(this.createStateFilter(queryString))
: restaurants;
@@ -498,37 +565,30 @@
handleSelectClient(value, item) {
console.log(value);
if (value === "client") {
- this.clientId = item.id;
- } else if (value === "chance") {
- this.saleChanceId = item.id;
- } else {
- this.contactId = item.id;
+ this.supplierId = item.id;
}
},
selClientClick() {
- this.editSelectClientConfig.editVisible = true;
+ this.editSelectSupplierConfig.editVisible = true;
},
selClient(row) {
- this.editConfig.infomation.client_name = row.name;
- this.clientId = row.id;
+ this.$set(this.editConfig.infomation,'supplierName',row.name)
+ this.editConfig.infomation.contact = row.contact;
+ this.editConfig.infomation.phone = row.phone;
+ this.supplierId = row.ID;
},
// 娓呴櫎宸查�夋嫨鐢ㄦ埛
clearupClient(value) {
if (value == "client") {
- this.editConfig.infomation.client_name = "";
- this.$set(this.editConfig.infomation, "client_name", "");
- this.clientId = null;
+ this.$set(this.editConfig.infomation, "supplierName", "");
+ this.supplierId = null;
this.$forceUpdate();
}
},
- // 娣诲姞闄勪欢
- addAnnexClick() {},
- // 璁剧疆鍏佽涓婁紶鏂囦欢鏍煎紡
- setFormatClick() {},
setTableForm() {
if (
- this.editConfig.title === "鍒涘缓" ||
- this.editConfig.infomation.products.length === 0
+ !this.editConfig.infomation.ID ||
+ this.editConfig.infomation.productList.length === 0
) {
this.tableData = [
{
@@ -543,24 +603,24 @@
},
];
} else {
- this.tableData = this.editConfig.infomation.products;
- this.tableData.map((item, index) => {
- item.productId = index + 1;
- });
+ this.tableData = this.editConfig.infomation.productList;
+ // this.tableData.map((item, index) => {
+ // item.productId = index + 1;
+ // });
}
this.productTableList = {
tableData: this.tableData,
tableColumn: [
- { label: "缂栧彿", prop: "productId", width: 40 },
{
label: "浜у搧鍚嶇О",
prop: "name",
+ min: 180,
productName: true,
isRequird: true,
},
- { label: "浜у搧缂栧彿", prop: "number" },
- { label: "璁¢噺鍗曚綅", prop: "number" },
- { label: "瑙勬牸鍨嬪彿", prop: "number" },
+ { label: "浜у搧缂栧彿", prop: "number", min: 150,},
+ { label: "璁¢噺鍗曚綅", prop: "unit" },
+ { label: "瑙勬牸鍨嬪彿", prop: "specifications" },
{ label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
{
label: "閲囪喘鍗曚环",
@@ -568,10 +628,12 @@
inputFloat: true,
isRequird: true,
},
- { label: "浠风◣鍚堣", prop: "total", inputFloat: true },
- { label: "鎻忚堪", prop: "name", input: true },
+ { label: "浠风◣鍚堣", prop: "total", inputFloat: true,disabled:true,multiply:true, },
+ { label: "鎻忚堪", prop: "remark", input: true },
],
};
+ this.toal=this.editConfig.infomation.realTotalPrice
+
},
// 浜у搧鍒楄〃杈撳叆
inputContent(val, prop, row) {
@@ -581,6 +643,31 @@
item[prop] = val;
}
});
+
+ },
+ getSummaries(total){
+ this.totalTwo= JSON.parse(JSON.stringify(total));
+ this.total=total;
+ this.getTotal()
+ },
+ getTotal(){
+ let prie=0
+ if(this.editConfig.infomation.priceAdjustmentType==1){
+ prie=Number(this.editConfig.infomation.priceAdjustment)
+ }else if(this.editConfig.infomation.priceAdjustmentType==2){
+ prie=(-1)*Number(this.editConfig.infomation.priceAdjustment)
+ }else{
+ prie=0
+ }
+ let t=0
+ if(this.editConfig.infomation.wholeDiscountType==1){
+ t=this.totalTwo*Number(this.editConfig.infomation.wholeDiscount)/100
+ }else if(this.editConfig.infomation.wholeDiscountType==2){
+ t=Number(this.editConfig.infomation.wholeDiscount)
+ }else{
+ t=0
+ }
+ this.total=this.totalTwo-t+Number(prie)
},
// 浜у搧鏂板
addProductClick() {
@@ -609,13 +696,11 @@
name: "",
number: "",
price: 0,
- total: 0,
+ total: 0
},
];
this.productTableList.tableData = this.tableData;
},
- // 浜у搧閲嶇畻
- recalculateProductClick() {},
clearupProduct(data) {
this.tableData = data;
this.productTableList.tableData = this.tableData;
--
Gitblit v1.8.0