This commit is contained in:
xd 2024-05-14 15:19:02 +08:00
parent fde4edce8e
commit 0f52340a3d
8 changed files with 262 additions and 53 deletions

View File

@ -212,11 +212,15 @@ public class RedBookController extends BaseController
@PostMapping("/saveQuot")
public AjaxResult saveQuot(HttpServletResponse response, @RequestBody OAQuot quot)
{
quot.setQuot_id(UUID.fastUUID().toString());
quot.setQuotCode(IdUtils.createNo("BJD_",2));
quot.setCreateBy(getUsername());
redBookService.insertOAQuot(quot);
if(StringUtils.isEmpty(quot.getQuot_id())){
quot.setQuot_id(UUID.fastUUID().toString());
quot.setQuotCode(IdUtils.createNo("BJD_",2));
quot.setCreateBy(getUsername());
redBookService.insertOAQuot(quot);
}else{
quot.setUpdateBy(getUsername());
redBookService.updateOAQuot(quot);
}
return success(quot);
}

View File

@ -83,6 +83,12 @@ public interface OARedBookMapper
*/
void insertOAQuot(OAQuot quot);
/**
* 修改报价单
* @param quot
*/
void updateOAQuot(OAQuot quot);
/**
* 新增报价单产品信息
* @param list
@ -129,4 +135,5 @@ public interface OARedBookMapper
* @return
*/
String rb_price_version();
}

View File

@ -82,6 +82,12 @@ public interface IRedBookService
*/
void insertOAQuot(OAQuot quot);
/**
* 修改报价单
* @param quot
*/
void updateOAQuot(OAQuot quot);
/**
* 获取调价日期
* @return
@ -121,4 +127,5 @@ public interface IRedBookService
* @return
*/
String rb_price_version();
}

View File

@ -125,6 +125,18 @@ public class RedBookServiceImpl implements IRedBookService
insertOAQuotProduct(quot);
}
/**
* 修改报价单
* @param quot
*/
@Override
public void updateOAQuot(OAQuot quot) {
quot.setUpdateTime(DateUtils.getNowDate());
oaRedBookMapper.updateOAQuot(quot);
oaRedBookMapper.deleteQuotProductsByCusId(quot.getQuot_id());
insertOAQuotProduct(quot);
}
/**
* 新增报价单产品信息
* @param quot

View File

@ -62,7 +62,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from [rb_product_price] A
left join rb_productVersion B on A.version_uid_0=B.uid_0
where B.sta_0=1 and A.type_uid_0 = #{uid_0}
and A.截面 = #{section} and A.型号 = #{name_0} order by A.order_0
<if test="section != null and section != ''">
and A.截面 = #{section}
</if>
and A.型号 = #{name_0} order by A.order_0
</select>
<select id="handleSearchData" resultType="Product" parameterType="String">
@ -108,6 +111,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<update id="updateOAQuot" parameterType="OAQuot">
update OAQuot
<trim prefix="SET" suffixOverrides=",">
<if test="quotCode != null">quotCode = #{quotCode},</if>
<if test="quotCustomer != null and quotCustomer != ''">quotCustomer = #{quotCustomer},</if>
<if test="quotProject != null and quotProject != ''">quotProject = #{quotProject},</if>
<if test="quotLxr != null and quotLxr != ''">quotLxr = #{quotLxr},</if>
<if test="quotLxrdh != null and quotLxrdh != ''">quotLxrdh = #{quotLxrdh},</if>
<if test="totalPrice != null and totalPrice != ''">totalPrice = #{totalPrice},</if>
<if test="rbDateUid != null and rbDateUid != ''">rbDateUid = #{rbDateUid},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = getdate()
</trim>
where quot_id = #{quot_id}
</update>
<insert id="batchOAQuotProduct">
insert into OAQuotProduct(quot_product_id, name_0, name_1, spec, voltage,stu,price,setPrice,count,allPrice,per,per2,quot_id) values
<foreach item="item" index="index" collection="list" separator=",">
@ -157,6 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
order by a.update_time desc
</select>
<resultMap type="OAQuot" id="QuotResult">

View File

@ -18,7 +18,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000
timeout: 60000
})
// request拦截器

View File

@ -84,16 +84,21 @@
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="联系人" prop="quotLxr">
<el-input v-model="form.quotLxr" placeholder="请输入业务联系人" />
<el-input v-model="form.quotLxr" placeholder="请输入联系人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="联系电话" prop="quotLxrdh">
<el-input v-model="form.quotLxrdh" placeholder="请输入联系电话"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="总价">
<el-input class="totalPrice-input" v-model="sumSelectedResultData"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="24">
@ -103,8 +108,8 @@
<el-form-item label="设置折扣率" label-width="100px">
<el-input style="width:65px" v-model="perc" size="small" @blur="changeData"></el-input>
<el-input style="width:65px;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
总价:<span style="color:red;font-size: 15px">{{sumSelectedResultData}} </span>
<el-select v-model="form.rbDateUid" style="width: 235px;margin-left: 20px" :disabled="selectedResultData.length==0">
<!--总价:<span style="color:red;font-size: 15px">{{sumSelectedResultData}} </span>-->
<el-select v-model="form.rbDateUid" style="width: 235px;float: right" :disabled="selectedResultData.length==0">
<el-option
v-for="item in versionList"
:key="item.value"
@ -185,6 +190,11 @@
-webkit-line-clamp: 2;
/* 控制显示的行数 */
}
/*总价输入框设置*/
.totalPrice-input .el-input__inner {
color: red;
}
</style>
<script>
import {toDecimal, productList,versionList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData,saveQuot, madeQuot,updateSelectedResultData} from "@/api/redBook/redBook";
@ -277,8 +287,7 @@
this.tableHeight = (window.innerHeight - 380) + 'px';
},
methods: {
// // ||
// ||
toggleText(id) {
if (this.expandedIndex === id) {
this.expandedIndex = -1;
@ -312,7 +321,6 @@
this.searchResultData = [],
this.selectedModelTag = item.name_0;
console.log(this.selectedModelTag)
//
this.productRemarkList(item.uid_0)
//
@ -321,7 +329,6 @@
//
productList() {
productList().then(response => {
console.log(response)
this.modelList = response;
});
},
@ -359,8 +366,8 @@
this.searchResultPageSize = 10,
this.searchResultData = [],
this.selectedXinghUid = item.uid_0
this.selectedXinghTag = item.name_0;
console.log(this.selectedXinghTag)
//
this.judgeparent(item)
},
@ -421,7 +428,6 @@
this.searchResultData = [],
this.selectedZlTag = item.name_0;
console.log(this.selectedZlTag)
this.productYsxhListCheck(item.uid_0, item.name_0)
},
@ -438,7 +444,6 @@
this.searchResultData = [],
this.selectedYsxhTag = item.name_0;
console.log(this.selectedYsxhTag)
this.productJmListCheck(item.uid_0, item.name_0)
},
//
@ -448,9 +453,8 @@
if (response) {//
this.productJmList(sid, name)
} else {
//
console.log("结果表格输出")
//TODO
this.selectedYsxhTag = this.selectedXinghTag;
this.searchData(this.selectedXinghUid)
}
});
},
@ -465,8 +469,6 @@
//
selJmTag(item) {
this.selectedJmTag = item.section;
console.log(this.selectedYsxhTag)
console.log(this.selectedYsxhUid)
this.searchResultCurrentPage = 1,
this.searchResultPageSize = 10,
@ -480,7 +482,6 @@
searchData(sid, section) {
this.params = {uid_0: sid, section: section, name_0: this.selectedYsxhTag}
searchData(this.params).then(response => {
console.log(response)
this.searchResultData = response;
this.searchResultTotal = this.searchResultData.length;
this.searchResultCurrentPage = 1;
@ -565,11 +566,9 @@
this.searchResultCurrentPage = 1,
this.searchResultPageSize = 10,
this.searchResultData = [],
console.log(this.queryParams)
this.searchResultLoading = true;
handleSearchData(this.queryParams).then(response => {
console.log(response)
this.searchResultData = response;
this.searchResultTotal = this.searchResultData.length;
this.searchResultCurrentPage = 1;
@ -623,7 +622,7 @@
})
},
//
//
handleSaveClick() {
const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0);
this.form.totalPrice = allPrice.toFixed(2);
@ -713,7 +712,7 @@
},
p(s) {
return s < 10 ? '0' + s : s;
},
}
},
updated(){
@ -724,7 +723,6 @@
computed: {
//
searchResultPagedData() {
console.log(this.searchResultData)
const startIndex = (this.searchResultCurrentPage - 1) * this.searchResultPageSize;
const endIndex = startIndex + this.searchResultPageSize;
return this.searchResultData.slice(startIndex, endIndex);

View File

@ -34,9 +34,10 @@
</el-table-column>
<el-table-column label="报价客户" width="200" align="center" prop="quotCustomer" />
<el-table-column label="报价项目" width="200" align="center" prop="quotProject" />
<el-table-column label="联系人"align="center" prop="quotLxr" />
<el-table-column label="联系人电话"align="center" prop="quotLxrdh" />
<el-table-column label="创建日期" width="200" align="center" prop="createTime" />
<el-table-column label="总价" width="100" align="center" prop="totalPrice" />
<el-table-column label="联系人" width="100" align="center" prop="quotLxr" />
<el-table-column label="联系人电话" width="150" align="center" prop="quotLxrdh" />
<el-table-column label="创建日期" width="180" align="center" prop="createTime" />
</el-table>
<!-- 报价详情对话框 -->
@ -45,46 +46,56 @@
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="询价单位" prop="quotCustomer">
<el-input v-model="form.quotCustomer" :disabled="true"/>
<el-input v-model="form.quotCustomer"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目名称" prop="quotProject">
<el-input v-model="form.quotProject" :disabled="true"/>
<el-input v-model="form.quotProject"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="联系人" prop="quotLxr">
<el-input v-model="form.quotLxr" :disabled="true"/>
<el-input v-model="form.quotLxr"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="联系电话" prop="quotLxrdh">
<el-input v-model="form.quotLxrdh" :disabled="true"/>
<el-input v-model="form.quotLxrdh"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="总价">
<el-input class="totalPrice-input" v-model="sumSelectedResultData"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-form-item>
总价:<span style="color:red;font-size: 20px">{{sumSelectedResultData}} </span>
<el-select v-model="form.rbDateUid" style="width: 60%;float: right" :disabled="true">
<el-col :span="24">
<el-form-item label="总金额" prop="totalPrice" v-if="false">
<el-input v-model="form.totalPrice"/>
</el-form-item>
<el-form-item label="设置折扣率" label-width="100px">
<el-input style="width:65px" v-model="perc" size="small" @blur="changeData"></el-input>
<el-input style="width:65px;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
<!--总价:<span style="color:red;font-size: 15px">{{sumSelectedResultData}} </span>-->
<el-select v-model="form.rbDateUid" style="margin-left: 20px;width: 235px;" :disabled="selectedResultData.length==0">
<el-option
v-for="item in versionList"
:key="item.value"
:label="item.label"
:value="item.value"
@click.native="selectRbDate(item.value)"
/>
@click.native="selectRbDate(item.value)"/>
</el-select>
<el-button style="float: right;margin-left: 5px;" size="small" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0">生成报价单</el-button>
<el-button style="float: right;" size="small" type="warning" icon="el-icon-folder" @click="handleSaveClick" :disabled="selectedResultData.length==0">保存</el-button>
</el-form-item>
</el-col>
</el-row>
<el-table width="100%;" :row-class-name="selectedResultIndex" :data="selectedResultData" height="400px">
<el-table v-loading="selectedResultLoading" width="100%;" :row-class-name="selectedResultIndex" :data="selectedResultData" height="350px">
<el-table-column fixed="left" label="" align="center" prop="index" width="50"/>
<el-table-column label="版本uid" align="center" prop="uid_0" v-if="false"/>
<el-table-column fixed="left" label="产品型号" align="center" prop="name_0" width="180" />
@ -93,10 +104,22 @@
<el-table-column label="电压" align="center" prop="voltage"/>
<el-table-column label="红本价(元)" align="center" prop="price"/>
<el-table-column label="单位" align="center" prop="stu"/>
<el-table-column label="一次折扣" align="center" prop="per"/>
<el-table-column label="二次折扣" align="center" prop="per2"/>
<el-table-column label="一次折扣" align="center" prop="per">
<template slot-scope="scope">
<el-input v-model="scope.row.per" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="二次折扣" align="center" prop="per2">
<template slot-scope="scope">
<el-input v-model="scope.row.per2" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="setPrice"/>
<el-table-column label="数量调整" align="center" prop="count"/>
<el-table-column label="数量调整" align="center" prop="count">
<template slot-scope="scope">
<el-input v-model="scope.row.count" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="总价" align="center" prop="allPrice"/>
</el-table>
</el-form>
@ -110,9 +133,13 @@
/>
</div>
</template>
<style>
.totalPrice-input .el-input__inner {
color: red;
}
</style>
<script>
import { versionList,listQuots,getQuotDetail,deleteQuots } from "@/api/redBook/redBook";
import {toDecimal, versionList,listQuots,getQuotDetail,deleteQuots,updateSelectedResultData,madeQuot,saveQuot } from "@/api/redBook/redBook";
export default {
name: "quots",
@ -143,7 +170,12 @@
//
open: false,
//
selectedResultData: []
selectedResultData: [],
//
perc: 0.8,
perc2: '',
selectedResultLoading: false,
}
},
created() {
@ -204,6 +236,135 @@
this.getList();
})
},
//
changeData() {
//
const pattern = /^\d+(\.\d+)?$/;
if(this.perc) {
if (!pattern.test(this.perc)) {
this.$message.warning("折扣率格式错误!");
return;
}
}
if(this.perc2) {
if (!pattern.test(this.perc2)) {
this.$message.warning("折扣率格式错误!");
return;
}
}
//
this.selectedResultData.forEach((row, index) => {
//
this.$set(this.selectedResultData, index, {
...row,
per: this.perc,
per2: this.perc2,
setPrice: toDecimal(row.price * (this.perc?this.perc:1) * (this.perc2?this.perc2:1)),
allPrice: toDecimal(row.count * row.price * (this.perc?this.perc:1) * (this.perc2?this.perc2:1)),
});
})
},
//
changeRowData() {
//
this.selectedResultData.forEach((row, index) => {
//
this.$set(this.selectedResultData, index, {
...row,
setPrice: toDecimal(row.price * (row.per?row.per:1) * (row.per2?row.per2:1)),
allPrice: toDecimal(row.count * row.price * (row.per?row.per:1) * (row.per2?row.per2:1)),
});
})
},
//
selectRbDate(uid){
this.selectedResultData.forEach((row, index) => {
this.$set(this.selectedResultData, index, {
...row,
uid_0: uid // uid
});
});
this.selectedResultLoading = true;
//-
updateSelectedResultData(this.selectedResultData).then(response => {
for (let i = 0; i < this.selectedResultData.length; i++) {
for (let j = 0; j < response.data.length; j++) {
//
if (
this.selectedResultData[i].name_0 === response.data[j].name_0 &&
this.selectedResultData[i].spec === response.data[j].spec &&
this.selectedResultData[i].voltage === response.data[j].voltage
) {
this.selectedResultData[i].price = response.data[j].setPrice;
const setPrice = toDecimal(this.selectedResultData[i].price * (this.selectedResultData[i].per?this.selectedResultData[i].per:1) * (this.selectedResultData[i].per2?this.selectedResultData[i].per2:1));
const allPrice = toDecimal(this.selectedResultData[i].count * this.selectedResultData[i].price * (this.selectedResultData[i].per?this.selectedResultData[i].per:1) * (this.selectedResultData[i].per2?this.selectedResultData[i].per2:1));
this.selectedResultData[i].setPrice = setPrice;
this.selectedResultData[i].allPrice = allPrice;
}
}
}
this.selectedResultLoading = false;
});
},
//
handleSaveClick() {
const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0);
this.form.totalPrice = allPrice.toFixed(2);
this.form.selectedResultData = this.selectedResultData;
saveQuot(this.form).then(response => {
this.$modal.msgSuccess("修改报价单成功");
this.open = false;
this.getList();
})
},
//
handleMadeQuotClick() {
this.form.selectedResultData = this.selectedResultData;
madeQuot(this.form).then(response => {
this.$modal.msgSuccess("生成报价单成功");
//
const content = response;
const blob = new Blob([content]);
const fileName = "BJD_"+this.getTodayCourse()+".xls";
if ("download" in document.createElement("a")) {
// IE
const elink = document.createElement("a");
elink.download = fileName;
elink.style.display = "none";
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href); // URL
document.body.removeChild(elink);
}
else {
// IE10+
navigator.msSaveBlob(blob, fileName);
}
});
},
//
getTodayCourse(){
const myDate = new Date();
//
const year = myDate.getFullYear();
//
const month = myDate.getMonth() + 1;
//
const date = myDate.getDate();
const h = myDate.getHours(); //(0-23)
const m = myDate.getMinutes(); //(0-59)
const s = myDate.getSeconds();
return year + '-' + this.p(month) + "-" + this.p(date) + " " + this.p(h) + ':' + this.p(m) + ":" + this.p(s)
},
p(s) {
return s < 10 ? '0' + s : s;
}
},
computed: {
//