|
@ -23,6 +23,7 @@ const pricereviewCreate = ()=>{ |
|
|
pay_method:payment_kind, // 付款方式
|
|
|
pay_method:payment_kind, // 付款方式
|
|
|
startDate:contract_begin_date, //合約開始日期
|
|
|
startDate:contract_begin_date, //合約開始日期
|
|
|
endDate:contract_end_date, // 合約結束日期
|
|
|
endDate:contract_end_date, // 合約結束日期
|
|
|
|
|
|
signDay: signDay, //預計簽約日
|
|
|
brand:brand, |
|
|
brand:brand, |
|
|
modalElevatorInfo:{ |
|
|
modalElevatorInfo:{ |
|
|
spec:'', |
|
|
spec:'', |
|
@ -91,6 +92,7 @@ const pricereviewCreate = ()=>{ |
|
|
qty:1, //電梯數量
|
|
|
qty:1, //電梯數量
|
|
|
sale_price:'', //契約報價
|
|
|
sale_price:'', //契約報價
|
|
|
inspectionFee:0, |
|
|
inspectionFee:0, |
|
|
|
|
|
bonus:'' |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
createElevatorFn(){ |
|
|
createElevatorFn(){ |
|
@ -127,7 +129,8 @@ const pricereviewCreate = ()=>{ |
|
|
price: this.modalElevatorInfo.price, |
|
|
price: this.modalElevatorInfo.price, |
|
|
qty: this.modalElevatorInfo.qty, |
|
|
qty: this.modalElevatorInfo.qty, |
|
|
sale_price: this.modalElevatorInfo.sale_price, |
|
|
sale_price: this.modalElevatorInfo.sale_price, |
|
|
inspectionFee: this.modalElevatorInfo.inspectionFee |
|
|
inspectionFee: this.modalElevatorInfo.inspectionFee, |
|
|
|
|
|
bonus:'' |
|
|
}) |
|
|
}) |
|
|
this.hideCreateElevatorModal(); |
|
|
this.hideCreateElevatorModal(); |
|
|
}, |
|
|
}, |
|
@ -149,6 +152,7 @@ const pricereviewCreate = ()=>{ |
|
|
const qty = this.elevators[idx].qty; |
|
|
const qty = this.elevators[idx].qty; |
|
|
const sale_price = this.elevators[idx].sale_price; |
|
|
const sale_price = this.elevators[idx].sale_price; |
|
|
const inspectionFee = this.elevators[idx].inspectionFee; |
|
|
const inspectionFee = this.elevators[idx].inspectionFee; |
|
|
|
|
|
const bonus = this.elevators[idx].bonus; |
|
|
this.total_spec ++; |
|
|
this.total_spec ++; |
|
|
this.elevators.push({ |
|
|
this.elevators.push({ |
|
|
id: this.total_spec, |
|
|
id: this.total_spec, |
|
@ -169,7 +173,8 @@ const pricereviewCreate = ()=>{ |
|
|
price: price, |
|
|
price: price, |
|
|
qty: qty, |
|
|
qty: qty, |
|
|
sale_price: sale_price, |
|
|
sale_price: sale_price, |
|
|
inspectionFee: inspectionFee |
|
|
inspectionFee: inspectionFee, |
|
|
|
|
|
bonus: bonus |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
removeElevator(id){ |
|
|
removeElevator(id){ |
|
@ -365,8 +370,9 @@ const pricereviewCreate = ()=>{ |
|
|
form.append('brand', this.brand); |
|
|
form.append('brand', this.brand); |
|
|
form.append('num', this.totalElevatorsNum); |
|
|
form.append('num', this.totalElevatorsNum); |
|
|
form.append('salesman', this.salesman); |
|
|
form.append('salesman', this.salesman); |
|
|
form.append('contract_begin_date', this.startDate); |
|
|
form.append('signDay', this.startDate); |
|
|
form.append('contract_end_date', this.endDate); |
|
|
form.append('contract_end_date', this.endDate); |
|
|
|
|
|
form.append('contract_begin_date', this.signDay); |
|
|
form.append('contract_kind', this.contract_status); |
|
|
form.append('contract_kind', this.contract_status); |
|
|
form.append('progress_status', this.progress_status); |
|
|
form.append('progress_status', this.progress_status); |
|
|
form.append('serviceFee', this.serviceFee); |
|
|
form.append('serviceFee', this.serviceFee); |
|
@ -426,6 +432,7 @@ const pricereviewCreate = ()=>{ |
|
|
if(this.case_name == '') this.error.push("請輸入案件名稱"); |
|
|
if(this.case_name == '') this.error.push("請輸入案件名稱"); |
|
|
if(this.startDate == '' || this.startDate == '0000-00-00') this.error.push("請輸入合約開始日期"); |
|
|
if(this.startDate == '' || this.startDate == '0000-00-00') this.error.push("請輸入合約開始日期"); |
|
|
if(this.endDate == '' ||this.endDate == '0000-00-00') this.error.push("請輸入合約結束日期"); |
|
|
if(this.endDate == '' ||this.endDate == '0000-00-00') this.error.push("請輸入合約結束日期"); |
|
|
|
|
|
if(this.signDay == '' ||this.signDay == '0000-00-00') this.error.push("請輸入預計簽約日期"); |
|
|
|
|
|
|
|
|
if(this.error.length > 0){ |
|
|
if(this.error.length > 0){ |
|
|
let errortext = ''; |
|
|
let errortext = ''; |
|
@ -454,6 +461,7 @@ const pricereviewCreate = ()=>{ |
|
|
form.append('salesman', this.salesman); |
|
|
form.append('salesman', this.salesman); |
|
|
form.append('contract_begin_date', this.startDate); |
|
|
form.append('contract_begin_date', this.startDate); |
|
|
form.append('contract_end_date', this.endDate); |
|
|
form.append('contract_end_date', this.endDate); |
|
|
|
|
|
form.append('signDay', this.signDay); |
|
|
form.append('contract_kind', this.contract_status); |
|
|
form.append('contract_kind', this.contract_status); |
|
|
form.append('progress_status', this.progress_status); |
|
|
form.append('progress_status', this.progress_status); |
|
|
form.append('serviceFee', this.serviceFee); |
|
|
form.append('serviceFee', this.serviceFee); |
|
@ -497,7 +505,10 @@ const pricereviewCreate = ()=>{ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
async getBonus(idx){ |
|
|
async getBonus(idx){ |
|
|
|
|
|
if(this.contract_status == "") return alert("請選擇契約性質") |
|
|
let contract_type = ''; |
|
|
let contract_type = ''; |
|
|
|
|
|
let version = ''; |
|
|
|
|
|
let payment_period = ''; |
|
|
if(this.contract_status == 1){ |
|
|
if(this.contract_status == 1){ |
|
|
contract_type = 'new' |
|
|
contract_type = 'new' |
|
|
}else if(this.contract_status == 2){ |
|
|
}else if(this.contract_status == 2){ |
|
@ -505,10 +516,24 @@ const pricereviewCreate = ()=>{ |
|
|
}else if(this.contract_status == 3){ |
|
|
}else if(this.contract_status == 3){ |
|
|
contract_type = 'renew_priceissue' |
|
|
contract_type = 'renew_priceissue' |
|
|
} |
|
|
} |
|
|
|
|
|
this.getBonusVersion(this.signDay) |
|
|
|
|
|
|
|
|
|
|
|
if(this.pay_method == "A40003"){ |
|
|
|
|
|
payment_period = 'monthly' |
|
|
|
|
|
}else if(this.pay_method == "A40004"){ |
|
|
|
|
|
payment_period = "bimonthly" |
|
|
|
|
|
}else if(this.pay_method == "A40007"){ |
|
|
|
|
|
payment_period = "quarterly" |
|
|
|
|
|
}else if(this.pay_method == "A40005"){ |
|
|
|
|
|
payment_period = "semiannually" |
|
|
|
|
|
}else if(this.pay_method == "A40006"){ |
|
|
|
|
|
payment_period = "annually" |
|
|
|
|
|
} |
|
|
const contract_years = this.isDifferenceMoreThanAYear(this.startDate, this.endDate); |
|
|
const contract_years = this.isDifferenceMoreThanAYear(this.startDate, this.endDate); |
|
|
const receivable_date_due = this.getNext25thDate(this.startDate); |
|
|
const receivable_date_due = this.getNext25thDate(this.startDate); |
|
|
const res = await axios.get('./api/maintaenance_contract_bonus.php', {params: |
|
|
const res = await axios.get('./api/maintaenance_contract_bonus.php', {params: |
|
|
{ |
|
|
{ |
|
|
|
|
|
'ver':'2.0', |
|
|
'contract_type':contract_type, |
|
|
'contract_type':contract_type, |
|
|
'contract_years': contract_years, |
|
|
'contract_years': contract_years, |
|
|
'discount': this.discountRate, |
|
|
'discount': this.discountRate, |
|
@ -517,8 +542,9 @@ const pricereviewCreate = ()=>{ |
|
|
'sales_id': user_id, |
|
|
'sales_id': user_id, |
|
|
'region_manger_id': 'M0174', |
|
|
'region_manger_id': 'M0174', |
|
|
'regular_contract_manger_id': 'M0174', |
|
|
'regular_contract_manger_id': 'M0174', |
|
|
|
|
|
'payment_period': payment_period |
|
|
}}) |
|
|
}}) |
|
|
|
|
|
this.elevators[idx].bonus = Number(res.data.bonus_array[0].bonus_amount) |
|
|
console.log(res.data); |
|
|
console.log(res.data); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
@ -527,6 +553,12 @@ const pricereviewCreate = ()=>{ |
|
|
const difference = Math.abs(endDate - startDate); |
|
|
const difference = Math.abs(endDate - startDate); |
|
|
return difference > oneYear ? 'above_two' : 'one'; |
|
|
return difference > oneYear ? 'above_two' : 'one'; |
|
|
}, |
|
|
}, |
|
|
|
|
|
getBonusVersion(dateString) { |
|
|
|
|
|
const targetDate = new Date('2024-04-01'); |
|
|
|
|
|
const dateToCheck = new Date(dateString); |
|
|
|
|
|
|
|
|
|
|
|
return dateToCheck > targetDate ? '2.1' : '2.0'; |
|
|
|
|
|
}, |
|
|
getNext25thDate(dateString) { |
|
|
getNext25thDate(dateString) { |
|
|
// 將傳入的日期字串轉換為 Date 物件
|
|
|
// 將傳入的日期字串轉換為 Date 物件
|
|
|
let date = new Date(dateString); |
|
|
let date = new Date(dateString); |
|
@ -546,7 +578,29 @@ const pricereviewCreate = ()=>{ |
|
|
month = month < 10 ? '0' + month : month; // 確保月份是兩位數
|
|
|
month = month < 10 ? '0' + month : month; // 確保月份是兩位數
|
|
|
|
|
|
|
|
|
return `${year}-${month}-25`; |
|
|
return `${year}-${month}-25`; |
|
|
} |
|
|
}, |
|
|
|
|
|
generateTestData(){ |
|
|
|
|
|
this.modalElevatorInfo = { |
|
|
|
|
|
spec:'MAE100', |
|
|
|
|
|
person:'10', |
|
|
|
|
|
weight:'700', |
|
|
|
|
|
stop:'10', |
|
|
|
|
|
speed:'60', |
|
|
|
|
|
permitNumber:'TEST', //許可證號碼
|
|
|
|
|
|
brand:'永大', //品牌
|
|
|
|
|
|
m1:'N', //贈送M1
|
|
|
|
|
|
months:12, // 保養月數
|
|
|
|
|
|
cycle:'1', // 保養週期
|
|
|
|
|
|
method:'A', //保養方式
|
|
|
|
|
|
checkYear:'100', //竣工檢查年度
|
|
|
|
|
|
lastDate:'2023-01-01', // 上次年檢日期
|
|
|
|
|
|
yearCheckFee:1260, //年檢費用
|
|
|
|
|
|
price:'4400', //公司發布價(月)
|
|
|
|
|
|
qty:1, //電梯數量
|
|
|
|
|
|
sale_price:'2500', //契約報價
|
|
|
|
|
|
inspectionFee:0, //檢驗費
|
|
|
|
|
|
}; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|