@ -24,12 +24,11 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
< script src = "https://cdnjs.cloudflare.com/ajax/libs/axios/1.5.0/axios.min.js" integrity = "sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin = "anonymous" referrerpolicy = "no-referrer" > < / script >
< script src = "https://cdnjs.cloudflare.com/ajax/libs/axios/1.5.0/axios.min.js" integrity = "sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin = "anonymous" referrerpolicy = "no-referrer" > < / script >
< div class = "contract-input-component" x-data = "{
< div class = "contract-input-component" x-data = "{
async init(){
init(){
$('select.dropdown')
$('.contract-input-component .form .dropdown').dropdown();
.dropdown();
await a xios.get('./twzip.json').then(res=>{
axios.get('./twzip.json').then(res=>{
this.cities = res.data.cities
this.cities = res.data.cities
console.log(this.cities);
})
})
},
},
cities:[],
cities:[],
@ -55,7 +54,8 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
partyAphone:'', //業務聯繫人電話
partyAphone:'', //業務聯繫人電話
partyAemail:'', //業務聯繫人email
partyAemail:'', //業務聯繫人email
files:[], //附件檔案
files:[], //附件檔案
spec:'', //規格
spec:'', //機種
brand:'', //廠牌
weight: '', //載重
weight: '', //載重
numberofpassenger: '', //人乘
numberofpassenger: '', //人乘
numberofstop:'', //樓停
numberofstop:'', //樓停
@ -73,52 +73,28 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
isLoading:false,
isLoading:false,
fail_arr:[],
fail_arr:[],
nextStepFn(){
nextStepFn(){
if(this.data.contractno == '') return alert('請輸入合約號');
if(this.step==1){
this.isLoading = true
if(this.data.contractno == '') return alert('請輸入合約號');
axios.get('./api/getContractData.php?contractno=' + this.data.contractno).then(res=>{
this.isLoading = true
console.log(res)
this.getContractDate();
}else if(this.step == 2){
if(!this.customize){
this.step = 3
this.data.total_price = res.data.sold_price
}
this.data.salesman = res.data.salesman
this.data.contract_begin_date = res.data.contract_begin_date
this.data.contract_end_date = res.data.contract_end_date
this.data.address = res.data.address
this.data.customer = res.data.customer
this.data.partyA = res.data.customer
this.data.partyAaddress = res.data.address
this.data.spec = res.data.spec
this.data.weight = res.data.weight
this.data.numberofpassenger = res.data.persons
this.data.numberofstop = res.data.stop
this.data.numberoffloor = res.data.floors
this.data.speed = res.data.speed
this.data.takecertificatedate = res.data.contract_begin_date
let cityIndex = this.data.address.indexOf('市');
if (cityIndex > 1) {
// 獲取''市''前面的兩個字
let city = this.data.address.substring(cityIndex - 2, cityIndex + 1);
this.data.area = city;
console.log(this.data.area);
} else {
this.data.area = ''
console.log('沒有找到或者格式不正確');
}
}
this.step = 2
this.isLoading = false
}).catch(err=>{
console.error(err)
this.isLoading = false
})
},
},
nextStepKeyupFn(e){
nextStepKeyupFn(e){
if(e.keyCode !== 13) return
if(e.keyCode !== 13) return
if(this.contractno == '') return alert('請輸入合約號');
if(this.step==1){
this.isLoading = true
if(this.data.contractno == '') return alert('請輸入合約號');
this.isLoading = true
this.getContractDate();
}else if(this.step == 2){
this.step = 3
}
},
getContractDate(){
axios.get('./api/getContractData.php?contractno=' + this.data.contractno).then(res=>{
axios.get('./api/getContractData.php?contractno=' + this.data.contractno).then(res=>{
console.log(res)
if(!this.customize){
if(!this.customize){
console.log(res.data);
this.data.total_price = res.data.sold_price
this.data.total_price = res.data.sold_price
this.data.salesman = res.data.salesman
this.data.salesman = res.data.salesman
this.data.contract_begin_date = res.data.contract_begin_date
this.data.contract_begin_date = res.data.contract_begin_date
@ -139,10 +115,8 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
// 獲取''市''前面的兩個字
// 獲取''市''前面的兩個字
let city = this.data.address.substring(cityIndex - 2, cityIndex + 1);
let city = this.data.address.substring(cityIndex - 2, cityIndex + 1);
this.data.area = city;
this.data.area = city;
console.log(this.data.area);
} else {
} else {
this.data.area = ''
this.data.area = ''
console.log('沒有找到或者格式不正確');
}
}
}
}
this.step = 2
this.step = 2
@ -153,22 +127,30 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
})
})
},
},
preStepFn(){
preStepFn(){
this.data.total_price = ''
if(this.step==2){
this.data.salesman = ''
if(confirm('回到上一頁會將本頁資料清空,確定返回嗎?')){
this.data.contract_begin_date = ''
this.step = 1
this.data.contract_end_date = ''
this.data.total_price = ''
this.data.address = ''
this.data.salesman = ''
this.data.customer = ''
this.data.contract_begin_date = ''
this.data.partyA = ''
this.data.contract_end_date = ''
this.data.partyAaddress = ''
this.data.address = ''
this.data.spec = ''
this.data.customer = ''
this.data.weight = ''
this.data.partyA = ''
this.data.numberofpassenger = ''
this.data.partyAaddress = ''
this.data.numberofstop = ''
this.data.spec = ''
this.data.numberoffloor = ''
this.data.weight = ''
this.data.speed = ''
this.data.numberofpassenger = ''
this.data.takecertificatedate = ''
this.data.numberofstop = ''
this.step = 1
this.data.numberoffloor = ''
this.data.speed = ''
this.data.takecertificatedate = ''
this.step = 1
return;
}
}else if(this.step == 3){
this.step = 2
}
},
},
save(){
save(){
this.isLoading = true
this.isLoading = true
@ -233,7 +215,7 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
},
},
uploadFiles(e){
uploadFiles(e){
this.data.files = e.target.files
this.data.files = e.target.files
}
},
}">
}">
< div class = "form" method = "post" id = "form" enctype = "multipart/form-data" >
< div class = "form" method = "post" id = "form" enctype = "multipart/form-data" >
< input type = "hidden" name = 'form_name' value = "main_form" / >
< input type = "hidden" name = 'form_name' value = "main_form" / >
@ -282,7 +264,7 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
< / td >
< / td >
< td style = "vertical-align: middle" > 營業員< / td >
< td style = "vertical-align: middle" > 營業員< / td >
< td >
< td >
< select class = "ui search dropdown" name = "promiser" x-model = "data.salesman" >
< select class = "ui fluid search dropdown" name = "promiser" x-model = "data.salesman" >
< option value = "" > 選擇營業員< / option >
< option value = "" > 選擇營業員< / option >
<?php foreach ( $contractpersons as $person ){ ?>
<?php foreach ( $contractpersons as $person ){ ?>
< option value = " <?php echo $person [ 'accountid' ] ?> " > <?php echo $person [ 'name' ] ?> </ option >
< option value = " <?php echo $person [ 'accountid' ] ?> " > <?php echo $person [ 'name' ] ?> </ option >
@ -302,10 +284,10 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
< / td >
< / td >
< / tr >
< / tr >
< tr >
< tr >
< td style = "vertical-align: middle" > 合約總價 < / td >
< td style = "vertical-align: middle" > 電梯台數 < / td >
< td >
< td >
< input class = "form-control " type = "number" name = "total_pirce" x-model = "data.total_price" >
< input class = "form-control disabled_select " type = "number" x-model = "data.num" >
< p class = "alerttext" x-show = "data.total_price ==''" > 未填寫< / p >
< p class = "alerttext" x-show = "data.num ==''" > 未填寫< / p >
< / td >
< / td >
< td style = "vertical-align: middle" > 統一編號/身分證< / td >
< td style = "vertical-align: middle" > 統一編號/身分證< / td >
@ -393,6 +375,28 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
< p class = "alerttext" x-show = "data.partyAemail==''" > 未填寫< / p >
< p class = "alerttext" x-show = "data.partyAemail==''" > 未填寫< / p >
< / td >
< / td >
< / tr >
< / tr >
< tr >
< td style = "vertical-align: middle" > 廠牌< / td >
< td >
< input type = "text" x-model = "data.brand" class = "form-control" / >
< p class = "alerttext" x-show = "data.brand==''" > 未填寫< / p >
< / td >
< td style = "vertical-align: middle" > 區域< / td >
< td >
< select class = "ui search dropdown" x-model = "data.area" >
< option value = "" > 選擇區域< / option >
< template x-for = "city in cities" :key = "city.code" >
< option x-bind:selected = "city.name === data.area" x-text = "city.name" :value = "city.name" > < / option >
< / template >
< / select >
< p class = "alerttext" x-show = "data.area==''" > 未填寫< / p >
< / td >
< td style = "vertical-align: middle" > 詳細地址< / td >
< td colspan = "3" >
< input type = "text" x-model = "data.address" / >
< p class = "alerttext" x-show = "data.address==''" > 未填寫< / p >
< / td >
< / tr >
< tr >
< tr >
< td style = "vertical-align: middle" > 保養別< / td >
< td style = "vertical-align: middle" > 保養別< / td >
< td >
< td >
@ -414,16 +418,21 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
< input class = "form-control disabled_select" type = "date" x-model = "data.licensedate" >
< input class = "form-control disabled_select" type = "date" x-model = "data.licensedate" >
< p class = "alerttext" x-show = "data.licensedate==''" > 未填寫< / p >
< p class = "alerttext" x-show = "data.licensedate==''" > 未填寫< / p >
< / td >
< / td >
< td style = "vertical-align: middle" > 附件< / td >
< td style = "vertical-align: middle" > 電梯數量< / td >
< td >
< td >
< input type = "file" name = "file[]" multiple draggable = "true" @ change = "uploadFiles($event)" / >
< input class = "form-control " type = "number" x-model = "data.num" >
< p class = "alerttext" x-show = "data.files==''" > 未填寫< / p >
< p class = "alerttext" x-show = "data.num==''" > 未填寫< / p >
< / td >
< / td >
< / tr >
< / tr >
< tr >
< tr >
< td style = "vertical-align: middle" > 規格< / td >
< / tr >
< / tbody >
< / template >
< template x-if = "step==3" >
< tbody style = "font-weight: bolder;margin-bottom: 20px" x-show = "step==3" >
< tr >
< td style = "vertical-align: middle" > 機種< / td >
< td >
< td >
< select class = "ui search dropdown" name = "spec" x-model = "data.spec" >
< select class = "ui search dropdown" name = "spec" x-model = "data.spec" >
< option value = "" > 選擇規格< / option >
< option value = "" > 選擇規格< / option >
@ -456,7 +465,7 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
< tr >
< tr >
< td style = "vertical-align: middle" > 樓停< / td >
< td style = "vertical-align: middle" > 樓停< / td >
< td >
< td >
< input type = "text " x-model = "data.numberofstop" / >
< input type = "number" class = "form-control " x-model = "data.numberofstop" / >
< p class = "alerttext" x-show = "data.numberofstop==''" > 未填寫< / p >
< p class = "alerttext" x-show = "data.numberofstop==''" > 未填寫< / p >
< / td >
< / td >
< td style = "vertical-align: middle" > 樓層< / td >
< td style = "vertical-align: middle" > 樓層< / td >
@ -475,45 +484,23 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
< input type = "text" x-model = "data.longitude" / >
< input type = "text" x-model = "data.longitude" / >
< p class = "alerttext" x-show = "data.longitude==''" > 未填寫< / p >
< p class = "alerttext" x-show = "data.longitude==''" > 未填寫< / p >
< / td >
< / td >
< / tr >
< / tr >
< tr >
< / tbody >
< td style = "vertical-align: middle" > 區域< / td >
< td >
< select class = "ui search dropdown" x-model = "data.area" >
< option value = "" > 選擇區域< / option >
< template x-for = "city in cities" :key = "city.code" >
< option x-bind:selected = "city.name === data.area" x-text = "city.name" :value = "city.name" > < / option >
< / template >
< / select >
< p class = "alerttext" x-show = "data.area==''" > 未填寫< / p >
< / td >
< td style = "vertical-align: middle" > 詳細地址< / td >
< td colspan = "3" >
< input type = "text" x-model = "data.address" / >
< p class = "alerttext" x-show = "data.address==''" > 未填寫< / p >
< / td >
< td style = "vertical-align: middle" > 附件< / td >
< td >
< input type = "file" name = "file[]" multiple draggable = "true" @ change = "uploadFiles($event)" / >
< p class = "alerttext" x-show = "data.files==''" > 未填寫< / p >
< / td >
< / tr >
< / tbody >
< / template >
< / template >
< / table >
< / table >
< button x-show = "step==1" @ click = "nextStepFn()" type = "button" class = "btn btn-primary btn-lg pull-right savebtn" :disabled = "isLoading" >
< button x-show = "step==3" @ click = "save()" :disabled = "isLoading" type = "button" class = "btn btn-primary btn-lg pull-right savebtn" >
< template x-if = "!isLoading" >
< template x-if = "!isLoading" >
< span > 下一步 < / span >
< span > 存檔< / span >
< / template >
< / template >
< template x-if = "isLoading" >
< template x-if = "isLoading" >
< div class = "loader" > < / div >
< div class = "loader" > < / div >
< / template >
< / template >
< / button >
< / button >
< button x-show = "step= =2" @ click = "save()" :disabled = "isLoading" type = "button" class = "btn btn-primary btn-lg pull-right savebtn " >
< button x-show = "step<=2" @ click = "nextStepFn()" type = "button" class = "btn btn-primary btn-lg pull-right savebtn" :disabled = "isLoading" >
< template x-if = "!isLoading" >
< template x-if = "!isLoading" >
< span > 存檔 < / span >
< span > 下一步< / span >
< / template >
< / template >
< template x-if = "isLoading" >
< template x-if = "isLoading" >
< div class = "loader" > < / div >
< div class = "loader" > < / div >
@ -536,3 +523,6 @@ $facilityno = $createFacilityNo->makeTFacilityNo("T", 'X', 5);
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous">< / script >
crossorigin="anonymous">< / script >
< script src = "semantic/dist/semantic.min.js" > < / script >
< script src = "semantic/dist/semantic.min.js" > < / script >
< script >
< / script >