Commit c0725d86 authored by liuzeheng's avatar liuzeheng

报价单有效时间限制范围

parent e290f8a3
......@@ -418,7 +418,8 @@
</div>
<div class="form-section">
<el-form-item :label="$t('预计结束时间')" prop="stopTime">
<el-date-picker v-model="form.stopTime" value-format="yyyy-MM-dd HH:mm:ss" class="w-200"></el-date-picker>
<!-- <el-date-picker v-model="form.stopTime" value-format="yyyy-MM-dd HH:mm:ss" class="w-200"></el-date-picker> -->
<el-date-picker v-model="form.stopTime" value-format="yyyy-MM-dd" class="w-200" :picker-options="stopDate" ></el-date-picker>
</el-form-item>
<el-form-item :label="$t('是否控货')" prop="control">
<dict-selector :type="DICT_TYPE.INFRA_BOOLEAN_STRING" formatter="bool" v-model="form.control" form-type="radio" />
......@@ -434,10 +435,12 @@
</div>
<div class="form-section">
<el-form-item :label="$t('价格有效时间')" prop="startTime">
<el-date-picker v-model="form.startTime" placeholder="" value-format="yyyy-MM-dd HH:mm:ss" class="w-200"></el-date-picker>
<!-- <el-date-picker v-model="form.startTime" placeholder="" value-format="yyyy-MM-dd HH:mm:ss" class="w-200"></el-date-picker> -->
<el-date-picker v-model="form.startTime" placeholder="" value-format="yyyy-MM-dd" class="w-200" :picker-options="startDate"></el-date-picker>
</el-form-item>
<el-form-item label="" prop="endTime">
<el-date-picker v-model="form.endTime" placeholder="" value-format="yyyy-MM-dd HH:mm:ss" class="w-200"></el-date-picker>
<!-- <el-date-picker v-model="form.endTime" placeholder="" value-format="yyyy-MM-dd HH:mm:ss" class="w-200"></el-date-picker> -->
<el-date-picker v-model="form.endTime" placeholder="" value-format="yyyy-MM-dd" class="w-200" :picker-options="endDate"></el-date-picker>
</el-form-item>
</div>
......@@ -591,7 +594,32 @@ export default {
couponTotalAmountList: [], // 优惠总额
contactChooseType: null, // 联系人选择对象consignor(发货人) 或者 consignee(收货人)
quickCreateType: null, // 快速新建客户类型,1发货人,2收货人
getOpenedRouterListHandler: undefined
getOpenedRouterListHandler: undefined,
//预计结束时间,用于日历框校验
stopDate:{
disabledDate: time => {
return Date.now() - 8.64e7 >= time.getTime() // 加- 8.64e7则表示包当天
}
},
//有效起始时间
startDate: {
disabledDate: time => {
return Date.now() - 8.64e7 >= time.getTime() // 加- 8.64e7则表示包当天
}
},
//有效结束时间
endDate: {
disabledDate: time => {
if (this.form.startTime) {
return (
new Date( this.form.startTime).getTime() - 8.64e7 >=time.getTime()
)
} else {
return time.getTime() >= Date.now() - 8.64e7 // 加- 8.64e7则表示包当天
}
}
}
};
},
......@@ -604,17 +632,14 @@ export default {
switch (this.form.relation) {
case 1:
if(this.$route.query.customer.defaultContactName !=null){
// document.getElementById("defaultContactName2").value="";
// document.getElementById("defaultContactName").value=this.$route.query.customer.defaultContactName
//this.form.consignorName = this.$route.query.customer.defaultContactName
this.form.consignorName = this.$route.query.customer.defaultContactName
this.form.consigneeName = ""
this.form.consignorId = this.$route.query.customer.defaultContactId
}
if(this.$route.query.customer.company !=null){
// document.getElementById("company").value =this.$route.query.customer.company;
// document.getElementById("company2").value="";
this.form.consignorCompany = this.$route.query.customer.company
this.form.consigneeCompany = ""
}
......@@ -622,28 +647,24 @@ export default {
this.form.consignorPhone = this.$route.query.customer.defaultContactPhone
this.form.consigneePhone = ""
this.form.consigeeCountryCode =""
// document.getElementById("defaultContactPhone").value =this.$route.query.customer.defaultContactPhone;
// document.getElementById("defaultContactPhone2").value="";
}
if(this.$route.query.customer.defaultEmail!=null){
this.form.consignorEmail = this.$route.query.customer.defaultEmail;
this.form.consigneeEmail = ""
// document.getElementById("defaultEmail2").value="";
// document.getElementById("defaultEmail").value =this.$route.query.customer.defaultEmail;
}
return;
case 2:
if(this.$route.query.customer.defaultContactName !=null){
//document.getElementById("defaultContactName").value="";
// document.getElementById("defaultContactName2").value =this.$route.query.customer.defaultContactName;
this.form.consignorName = ""
this.form.consigneeName = this.$route.query.customer.defaultContactName
this.form.consigneeId = this.$route.query.customer.defaultContactId
}
if(this.$route.query.customer.company !=null){
// document.getElementById("company").value="";
// document.getElementById("company2").value =this.$route.query.customer.company;
this.form.consignorCompany = ""
this.form.consigneeCompany = this.$route.query.customer.company
}
......@@ -651,14 +672,12 @@ export default {
this.form.consignorPhone = ""
this.form.consignorCountryCode =""
this.form.consigneePhone = this.$route.query.customer.defaultContactPhone
// document.getElementById("defaultContactPhone").value="";
// document.getElementById("defaultContactPhone2").value =this.$route.query.customer.defaultContactPhone;
}
if(this.$route.query.customer.defaultEmail!=null){
this.form.consignorEmail = ""
this.form.consigneeEmail = this.$route.query.customer.defaultEmail;
// document.getElementById("defaultEmail").value="";
// document.getElementById("defaultEmail2").value =this.$route.query.customer.defaultEmail;
}
return ;
......@@ -1165,6 +1184,21 @@ export default {
this.form.transportVO.packageType = this.form.transportVO.packageTypeArr.join(',')
}
let endTime = new Date(this.form.endTime)
let startTime = new Date(this.form.startTime)
if(endTime.getTime()<startTime.getTime()){
return this.$message.error(this.$t('价格有效结束时间不能小于开始时间'));
}
let time2 = new Date().setDate(new Date().getDate() + 30) ;
if(endTime> time2){
return this.$message.error(this.$t('价格有效结束时间不能超过当前时间30天'));
}
// 修改的提交
if (this.form.offerId != null) {
let data = Object.assign({}, this.form, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment