You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
225 lines
8.0 KiB
225 lines
8.0 KiB
const pricereviewCreate = ()=>{
|
|
return {
|
|
init(){
|
|
console.log(123);
|
|
},
|
|
modalShow:{
|
|
elevator: false,
|
|
other:false,
|
|
otherToElevator:false,
|
|
},
|
|
total_spec:0,
|
|
elevators:[],
|
|
modalElevatorInfo:{
|
|
spec:'',
|
|
person:'',
|
|
weight:'',
|
|
stop:'',
|
|
speed:'',
|
|
permitNumber:'', //許可證號碼
|
|
brand:'', //品牌
|
|
m1:0, //贈送M1
|
|
months:12, //保養月數(月)
|
|
cycle:'EM', // 保養週期
|
|
checkYear:'', //竣工檢查年度
|
|
lastDate:'', // 上次年檢日期
|
|
yearCheckFee:'', //年檢費用
|
|
price:'', //公司發布價(月)
|
|
qty:1, //電梯數量
|
|
sale_price:'', //契約報價
|
|
},
|
|
otherOptions: [],
|
|
modalOtherOptionInfo:{
|
|
pr_no:"",
|
|
name:"",
|
|
price: 0,
|
|
num:"",
|
|
},
|
|
otherOptionKey:0,
|
|
currentOtherOptionKey:'',
|
|
toElevators:[],
|
|
toElevatorNo:'',
|
|
openCreateElevatorModal(){
|
|
this.modalShow.elevator = true;
|
|
body.style.overflow = 'hidden';
|
|
},
|
|
hideCreateElevatorModal(){
|
|
this.modalShow.elevator = false;
|
|
body.style.overflow = 'auto';
|
|
this.modalElevatorInfo = {
|
|
spec:'',
|
|
person:'',
|
|
weight:'',
|
|
stop:'',
|
|
speed:'',
|
|
permitNumber:'',
|
|
brand:'',
|
|
m1:0,
|
|
startDate:'',
|
|
endDate:'',
|
|
cycle:'',
|
|
checkYear:'',
|
|
lastDate:'',
|
|
yearCheckFee:'',
|
|
price:'',
|
|
qty:1,
|
|
sale_price:'',
|
|
};
|
|
},
|
|
createElevatorFn(){
|
|
this.total_spec ++;
|
|
this.elevators.push({
|
|
id: this.total_spec,
|
|
spec: this.modalElevatorInfo.spec,
|
|
person: this.modalElevatorInfo.person,
|
|
weight: this.modalElevatorInfo.weight,
|
|
stop: this.modalElevatorInfo.stop,
|
|
speed: this.modalElevatorInfo.speed,
|
|
permitNumber: this.modalElevatorInfo.permitNumber,
|
|
brand: this.modalElevatorInfo.brand,
|
|
m1: this.modalElevatorInfo.m1,
|
|
months: this.modalElevatorInfo.months,
|
|
cycle: this.modalElevatorInfo.cycle,
|
|
checkYear: this.modalElevatorInfo.checkYear,
|
|
lastDate: this.modalElevatorInfo.lastDate,
|
|
yearCheckFee: this.modalElevatorInfo.yearCheckFee,
|
|
price: this.modalElevatorInfo.price,
|
|
qty: this.modalElevatorInfo.qty,
|
|
sale_price: this.modalElevatorInfo.sale_price
|
|
})
|
|
this.hideCreateElevatorModal();
|
|
},
|
|
copyElevator(idx){
|
|
const spec = this.elevators[idx].spec;
|
|
const person = this.elevators[idx].person;
|
|
const stop = this.elevators[idx].stop;
|
|
const weight = this.elevators[idx].weight
|
|
const speed = this.elevators[idx].speed;
|
|
const permitNumber = this.elevators[idx].permitNumber;
|
|
const brand = this.elevators[idx].brand;
|
|
const m1 = this.elevators[idx].m1;
|
|
const months = this.elevators[idx].months;
|
|
const cycle = this.elevators[idx].cycle;
|
|
const checkYear = this.elevators[idx].checkYear;
|
|
const lastDate = this.elevators[idx].lastDate;
|
|
const yearCheckFee = this.elevators[idx].yearCheckFee;
|
|
const price = this.elevators[idx].price;
|
|
const qty = this.elevators[idx].qty;
|
|
const sale_price = this.elevators[idx].sale_price;
|
|
|
|
this.total_spec ++;
|
|
this.elevators.push({
|
|
id: this.total_spec,
|
|
spec: spec,
|
|
person: person,
|
|
stop: stop,
|
|
weight:weight,
|
|
speed: speed,
|
|
permitNumber: permitNumber,
|
|
brand: brand,
|
|
m1: m1,
|
|
months: months,
|
|
cycle: cycle,
|
|
checkYear: checkYear,
|
|
lastDate: lastDate,
|
|
yearCheckFee: yearCheckFee,
|
|
price: price,
|
|
qty: qty,
|
|
sale_price: sale_price
|
|
})
|
|
},
|
|
removeElevator(id){
|
|
this.elevators = this.elevators.filter(elevator=> elevator.id != id)
|
|
},
|
|
openCreateOtherOptionFn(){
|
|
this.modalShow.other = true
|
|
body.style.overflow = 'hidden'
|
|
},
|
|
createOtherOptionFn(){
|
|
this.otherOptionKey ++;
|
|
this.otherOptions.push({
|
|
id: this.otherOptionKey,
|
|
pr_no: this.modalOtherOptionInfo.pr_no,
|
|
name: this.modalOtherOptionInfo.name,
|
|
price: this.modalOtherOptionInfo.price,
|
|
num: this.modalOtherOptionInfo.num,
|
|
toElevator:[],
|
|
})
|
|
this.modalOtherOptionInfo = {
|
|
pr_no: '',
|
|
name: '',
|
|
price: 0,
|
|
num: '',
|
|
}
|
|
this.hideCreateOtherOptionModal();
|
|
},
|
|
hideCreateOtherOptionModal(){
|
|
this.modalShow.other = false
|
|
// this.$refs.createOtherOptionModal.style.display = 'none';
|
|
body.style.overflow = 'auto'
|
|
},
|
|
addOtherOptionToElevator(id){
|
|
this.currentOtherOptionKey = id;
|
|
this.toElevators = [];
|
|
this.toElevatorNo = "";
|
|
const matchElevators = this.otherOptions.filter(option=> option.id == id)[0].toElevator.map(elevator=> elevator.id)
|
|
this.toElevatorNo = matchElevators[0]
|
|
console.log(this.elevators);
|
|
this.elevators.forEach(elevator=>{
|
|
if(elevator.price > 0){
|
|
let model = ''
|
|
model = elevator.spec
|
|
this.toElevators.push({
|
|
id: elevator.id,
|
|
model: model,
|
|
checked: matchElevators.includes(elevator.id) ? 1: 0,
|
|
})
|
|
}
|
|
})
|
|
|
|
this.modalShow.otherToElevator = true
|
|
body.style.overflow = 'hidden'
|
|
},
|
|
hideToOtherOptionElevatorModal(){
|
|
this.modalShow.otherToElevator = false
|
|
body.style.overflow = 'auto'
|
|
},
|
|
copyOtherOption(id){
|
|
this.otherOptionKey++;
|
|
const copyOption = this.otherOptions.filter(option=> option.id === id)[0]
|
|
console.log(copyOption);
|
|
this.otherOptions.push({
|
|
id: this.otherOptionKey,
|
|
name: copyOption.name,
|
|
price: copyOption.price,
|
|
num: copyOption.num,
|
|
toElevator: [],
|
|
pr_no: copyOption.pr_no
|
|
})
|
|
console.log(this.otherOptions);
|
|
},
|
|
chkOtherOptionToElevators(){
|
|
const checkedOptions = [];
|
|
|
|
const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0]
|
|
console.log(matchElevators);
|
|
checkedOptions.push({
|
|
id: this.toElevatorNo,
|
|
model: matchElevators['spec'],
|
|
})
|
|
this.otherOptions.forEach(option=>{
|
|
if(option.id == this.currentOtherOptionKey){
|
|
option.toElevator = [];
|
|
option.toElevator.push(...checkedOptions)
|
|
}
|
|
})
|
|
console.log(this.otherOptions);
|
|
this.currentOtherOptionKey = ''
|
|
|
|
this.hideToOtherOptionElevatorModal();
|
|
},
|
|
removeOtherOption(id){
|
|
this.otherOptions = this.otherOptions.filter(option=> option.id != id)
|
|
},
|
|
}
|
|
}
|