| | |
| | | <el-form-item |
| | | label="采购类型" |
| | | prop="purchaseTypeId" |
| | | class="form-item float_left" |
| | | class="float_left" |
| | | style="width:100%;" |
| | | > |
| | | <el-select |
| | | :disabled="editConfig.isDisabled" |
| | | placeholder="请选择采购类型" |
| | | v-model="editConfig.infomation.purchaseTypeId" |
| | | clearable |
| | |
| | | > |
| | | <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 |
| | | v-if="!editConfig.isDisabled" |
| | | class="el-icon-setting margin_left_10px cursor_pointer" |
| | | style="font-size: 20px; color: #333" |
| | | @click="handleShow" |
| | |
| | | <el-form-item label="供应商名称" prop="supplierName"> |
| | | <div class="custom-name"> |
| | | <el-autocomplete |
| | | :disabled="editConfig.isDisabled" |
| | | style="width: calc(100% - 40px)" |
| | | v-model="editConfig.infomation.supplierName" |
| | | :fetch-suggestions=" |
| | | (queryString, callback) => { |
| | | querySearchAsync(queryString, callback, 'client'); |
| | | querySearchAsync(queryString, callback, 'supplier'); |
| | | } |
| | | " |
| | | value-key="name" |
| | |
| | | @select="handleSelectClient('client', $event)" |
| | | ></el-autocomplete> |
| | | <div |
| | | v-if="!editConfig.isDisabled" |
| | | class="common-select-btn" |
| | | @click="selClientClick('client')" |
| | | > |
| | |
| | | class="common-select-btn" |
| | | @click="clearupClient('client')" |
| | | > |
| | | <i class="el-icon-remove-outline" title="清除"></i> |
| | | <i class="el-icon-remove-outline" |
| | | v-if="!editConfig.isDisabled" title="清除"></i> |
| | | </div> |
| | | </div> |
| | | </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-col :span="12"> |
| | | <el-form-item label="采购单名称" prop="name"> |
| | | <el-input |
| | | :disabled="editConfig.isDisabled" |
| | | v-model="editConfig.infomation.name" |
| | | placeholder="请填写" |
| | | clearable |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="供应商联系人" prop="contact"> |
| | | <el-input |
| | | :disabled="editConfig.isDisabled" |
| | | v-model="editConfig.infomation.contact" |
| | | placeholder="请填写" |
| | | clearable |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="联系电话" prop="phone"> |
| | | <el-input |
| | | :disabled="editConfig.isDisabled" |
| | | v-model="editConfig.infomation.phone" |
| | | placeholder="请填写" |
| | | clearable |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="签约日期" prop="signingDate"> |
| | | <el-date-picker |
| | | :disabled="editConfig.isDisabled" |
| | | v-model="editConfig.infomation.signingDate" |
| | | style="width: 100%" |
| | | type="date" |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="交付日期" prop="deliveryDate"> |
| | | <el-date-picker |
| | | :disabled="editConfig.isDisabled" |
| | | v-model="editConfig.infomation.deliveryDate" |
| | | style="width: 100%" |
| | | type="date" |
| | |
| | | <el-col :span="24"> |
| | | <el-form-item label="备注信息" prop="remark"> |
| | | <el-input |
| | | :disabled="editConfig.isDisabled" |
| | | type="textarea" |
| | | :autosize="{ minRows: 3, maxRows: 4 }" |
| | | maxlength="500" |
| | |
| | | :show-summary="showSummary" |
| | | :recalculateShow="false" |
| | | :product-table-list="productTableList" |
| | | sign="purchase" |
| | | @inputContent="inputContent" |
| | | @getSummaries="getSummaries" |
| | | @addProductClick="addProductClick" |
| | | @emptyProductClick="emptyProductClick" |
| | | @clearupProduct="clearupProduct" |
| | |
| | | <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="请选择" |
| | | :disabled="editConfig.isDisabled" |
| | | filterable |
| | | @change="getTotal" |
| | | > |
| | | <el-option label="百分比降价" :value="1"></el-option> |
| | | <el-option label="直接降价" :value="2"></el-option> |
| | |
| | | <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.isDisabled" |
| | | @change="getTotal" |
| | | placeholder="请填写" |
| | | ></el-input> |
| | | </el-form-item> |
| | |
| | | <div class="table-bottom-l"> |
| | | <el-form-item label="调整" prop="member_id"> |
| | | <el-select |
| | | v-model="editConfig.infomation.fieldName" |
| | | :disabled="editConfig.isDisabled" |
| | | v-model="editConfig.infomation.priceAdjustmentType" |
| | | placeholder="请选择" |
| | | filterable |
| | | @change="getTotal" |
| | | > |
| | | <el-option label="增加" :value="1"></el-option> |
| | | <el-option label="减少" :value="2"></el-option> |
| | |
| | | <div class="table-bottom-r"> |
| | | <el-form-item label="" prop="member_id"> |
| | | <el-input |
| | | v-model="editConfig.infomation.number" |
| | | :disabled="editConfig.isDisabled" |
| | | v-model="editConfig.infomation.priceAdjustment" |
| | | size="mini" |
| | | @change="getTotal" |
| | | placeholder="请填写" |
| | | ></el-input> |
| | | </el-form-item> |
| | |
| | | </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> |
| | |
| | | ref="editDialog" |
| | | @sucessSet="handleGetBomKindDictList" |
| | | @handleConfirmSave="handleConfirmSave" |
| | | :editRow="editRow" |
| | | :workList="plcBrandList" |
| | | title="采购类型" |
| | | ></BomDialog> |
| | |
| | | <script> |
| | | import CommonFormTableView from "@/components/makepager/CommonFormTableView"; |
| | | import BomDialog from "@/components/makepager/BomDialog"; |
| | | import { getProductList } from "@/api/productManage/product" |
| | | |
| | | import { |
| | | addPurchase, |
| | | updatePurchase, |
| | | savePurchaseType, |
| | | getPurchaseType, |
| | | } from "@/api/purchaseManage/purchase"; |
| | | // import { |
| | | // postGetUnitDictList, |
| | | // postGetSaveSUnitDict, |
| | | // } from "@/api/purchaseManage/purchase"; |
| | | |
| | | import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog"; |
| | | export default { |
| | | name: "QuotationDialog", |
| | |
| | | return { |
| | | editConfig: this.editCommonConfig, |
| | | rules: { |
| | | purchaseTypeId:[{ required: true, message: "请选择", trigger: "change" }], |
| | | supplierName: [{ required: true, message: "请选择", trigger: "change" }], |
| | | phone: [ |
| | | { |
| | |
| | | }, |
| | | { 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" }, |
| | | ], |
| | | }, |
| | | productTableList: {}, |
| | | showSummary: { |
| | | show: true, |
| | | total: false, |
| | | sumProp: ["price", "total"], |
| | | multiply:['amount','price'], |
| | | titleProp: [ |
| | | "编号", |
| | | "产品名称", |
| | |
| | | "描述", |
| | | ], |
| | | mergeNumber: 4, |
| | | totalName:'小计' |
| | | }, |
| | | editSelectSupplierConfig: { |
| | | editVisible: false, |
| | |
| | | isNoProduct: true, |
| | | clientList: [], |
| | | plcBrandList:[], |
| | | editRow:{ |
| | | isDefault:'pin' |
| | | }, |
| | | total:0, |
| | | totalTwo:0, |
| | | }; |
| | | }, |
| | | created() { |
| | | this.setTableForm(); |
| | | this.handleGetBomKindDictList(); |
| | | this.$store.dispatch("getSupplier") |
| | | }, |
| | | computed: { |
| | | supplierList() { |
| | | return this.$store.state.getSupplierName.supplierList |
| | | } |
| | | }, |
| | | watch:{ |
| | | 'editCommonConfig.visible':{ |
| | | immediate:true, |
| | | handler:function(){ |
| | | this.setTableForm(); |
| | | |
| | | 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(); |
| | | // } |
| | | // }); |
| | | data.forEach(ele=>{ |
| | | delete ele.created_at |
| | | }) |
| | | |
| | | savePurchaseType(data).then((res) => { |
| | | if (res.code === 200) { |
| | | this.$message({ |
| | | message: "操作成功!", |
| | | type: "success", |
| | | }); |
| | | this.$refs.editDialog.editDialogVisible = false; |
| | | this.handleGetBomKindDictList(true); |
| | | } |
| | | },(err)=>{ |
| | | console.error(err) |
| | | this.$message({ |
| | | message: "操作失败!", |
| | | type: "warning", |
| | | }); |
| | | }); |
| | | }, |
| | | validatorPhone(rule, value, callback) { |
| | | if (value) { |
| | |
| | | this.$message.error("产品名称不能为空"); |
| | | } else { |
| | | const params = this.saveParams(); |
| | | console.log(params); |
| | | if (this.editConfig.title === "创建") { |
| | | addPurchase(params).then((res) => { |
| | | console.log(res); |
| | | this.editConfig.visible = false; |
| | | if (res.code === 200) { |
| | | this.$message.success("添加成功"); |
| | |
| | | }); |
| | | }, |
| | | saveParams() { |
| | | debugger |
| | | 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 = { |
| | | productList:this.tableData, |
| | | purchase:{ |
| | | supplierId:this.supplierId||0, |
| | | supplierId:data.supplierId, |
| | | signingDate:data.signingDate||'', |
| | | remark:data.remark, |
| | | purchaseTypeId:this.purchaseTypeId||0, |
| | | orderSource:data.orderSource||'', |
| | | purchaseTypeId:data.purchaseTypeId||0, |
| | | phone:data.phone||'', |
| | | name:data.name||'', |
| | | deliveryDate:data.deliveryDate||'', |
| | | contact:data.contact |
| | | 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){ |
| | |
| | | }, |
| | | // 选择客户相关方法 |
| | | querySearchAsync(queryString, cb, value) { |
| | | this.productTableList.tableProductList=[] |
| | | var restaurants = []; |
| | | if (value === "client") { |
| | | restaurants = this.clientList; |
| | | if (value === "supplier") { |
| | | restaurants = this.supplierList; |
| | | } |
| | | var results = queryString |
| | | ? restaurants.filter(this.createStateFilter(queryString)) |
| | |
| | | ); |
| | | }; |
| | | }, |
| | | handleSelectClient(value, item) { |
| | | console.log(value); |
| | | async handleSelectClient(value, item) { |
| | | this.productTableList.supplierId=item.ID |
| | | if (value === "client") { |
| | | this.supplierId = item.id; |
| | | this.editConfig.infomation.supplierId=item.ID |
| | | } |
| | | await getProductList({ |
| | | supplierId:item.ID, |
| | | page:1, |
| | | pageSize:100 |
| | | }).then((res)=>{ |
| | | if(res.data.code===200){ |
| | | this.productTableList.tableProductList = res.data.data.list |
| | | console.log(this.productTableList.tableProductList,"pop") |
| | | } |
| | | }) |
| | | }, |
| | | selClientClick() { |
| | | this.editSelectSupplierConfig.editVisible = true; |
| | |
| | | }, |
| | | // 清除已选择用户 |
| | | clearupClient(value) { |
| | | this.emptyProductClick() |
| | | if (value == "client") { |
| | | this.$set(this.editConfig.infomation, "supplierName", ""); |
| | | this.supplierId = null; |
| | |
| | | // }); |
| | | } |
| | | this.productTableList = { |
| | | tableProductList:[], |
| | | supplierId:undefined, |
| | | tableData: this.tableData, |
| | | disabled:this.editConfig.isDisabled, |
| | | tableColumn: [ |
| | | { |
| | | label: "产品名称", |
| | | prop: "name", |
| | | min: 180, |
| | | productName: true, |
| | | isRequird: true, |
| | | disabled:this.editConfig.isDisabled, |
| | | }, |
| | | { label: "产品编号", prop: "number" }, |
| | | { label: "产品编号", prop: "number", min: 150,}, |
| | | { label: "计量单位", prop: "unit" }, |
| | | { label: "规格型号", prop: "specifications" }, |
| | | { label: "数量", prop: "amount", inputNumber: true, isRequird: true }, |
| | | { label: "规格型号", prop: "specifications",}, |
| | | { label: "数量", prop: "amount", inputNumber: true,disabled:this.editConfig.isDisabled, }, |
| | | { |
| | | label: "采购单价", |
| | | prop: "price", |
| | | inputFloat: true, |
| | | isRequird: true, |
| | | disabled:this.editConfig.isDisabled, |
| | | }, |
| | | { label: "价税合计", prop: "total", inputFloat: true }, |
| | | { label: "描述", prop: "remark", input: true }, |
| | | { label: "价税合计", prop: "total", inputFloat: true,disabled:this.editConfig.isDisabled,multiply:true, }, |
| | | { label: "描述", prop: "remark", input: true,disabled:this.editConfig.isDisabled}, |
| | | ], |
| | | }; |
| | | this.toal=this.editConfig.infomation.realTotalPrice |
| | | |
| | | }, |
| | | // 产品列表输入 |
| | | inputContent(val, prop, row) { |
| | |
| | | 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() { |