Browse Source

回復pricereview Alpine js

main
10994015 1 year ago
parent
commit
8e81a112f0
  1. 40
      wms/mkt/assets/js/pricereviewAlpine.js

40
wms/mkt/assets/js/pricereviewAlpine.js

@ -21,7 +21,6 @@ const pricereviewCreate = () => {
},
total_spec: total_spec,
options: options,
// orioptions: options,
searchtext: '',
kind: 1,
subkind: 1,
@ -89,8 +88,6 @@ const pricereviewCreate = () => {
uscc: uscc,
person: salesman,
},
attatch1:"",
attatch2:"",
weightArr: {
6: 450,
8: 550,
@ -105,6 +102,8 @@ const pricereviewCreate = () => {
24:1600,
},
is_renovation: is_renovation,
attatch1:"",
attatch2:"",
async getElevatorPrice(idx){
const spec = this.elevators[idx].specifications
const person = this.elevators[idx].person
@ -124,10 +123,11 @@ const pricereviewCreate = () => {
try{
const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model, kind: spec}})
console.log(res.data);
if (res.data == null || res.data == "") {
if(res.data.id == null || res.data.id == ""){
console.log("公司並無提供此規格!!");
}
this.elevators[idx].price = res.data
this.elevators[idx].price = res.data.price
this.elevators[idx].facility_id = res.data.id
}catch (error) {
console.error("Error fetching elevator price:", error);
}
@ -143,15 +143,14 @@ const pricereviewCreate = () => {
model = this.modalElevatorInfo.spec + '-' + this.modalElevatorInfo.person + '*' + this.modalElevatorInfo.stop + '-' + this.modalElevatorInfo.open + this.modalElevatorInfo.speed;
this.modalElevatorInfo.model = this.modalElevatorInfo.spec + '-' + this.modalElevatorInfo.person + '*' + this.modalElevatorInfo.stop + '-' + this.modalElevatorInfo.open + this.modalElevatorInfo.speed;
}
console.log(model);
try{
const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model, kind:kind}})
console.log(res.data);
if (res.data == null || res.data == "") {
if(res.data.id == null || res.data.id == ""){
console.log("公司並無提供此規格!!");
}
this.modalElevatorInfo.price = res.data.price
this.modalElevatorInfo.id = res.data.id
this.modalElevatorInfo.facility_id = res.data.id
}catch (error) {
console.error("Error fetching elevator price:", error);
}
@ -586,8 +585,7 @@ const pricereviewCreate = () => {
num: '',
}
this.otherOptionKey ++;
console.log(this.otherOptions);
this.$refs.closeCreateOtherOptionModalBtn.click();
this.hideCreateOtherOptionModal();
},
totalOtherOptionsPrice(){
return this.otherOptions.reduce((total, option) => {
@ -613,7 +611,7 @@ const pricereviewCreate = () => {
memo:"",
}
this.maintainOptionKey ++;
this.$refs.closeCreateMaintainOptionModalBtn.click();
this.hideCreateMaintainModal();
},
createDemolishOptionFn(){
this.demolishOptions.push({
@ -806,12 +804,12 @@ const pricereviewCreate = () => {
errortext += err+'\n';
})
alert(errortext)
return;
return false;
}
},
submit(){
this.validation();
const validation = this.validation();
if(!validation) return
const form = new FormData();
form.append('contractno', contractno);
form.append('ekind', (is_renovation=="Y") ? "汰改" : "新梯");
@ -855,9 +853,8 @@ const pricereviewCreate = () => {
})
},
save(){
console.log(this.attatch1);
return;
this.validation();
const validation = this.validation();
if(!validation) return
const form = new FormData();
form.append('contractno', contractno);
form.append('ekind', (is_renovation=="Y") ? "汰改" : "新梯");
@ -903,6 +900,8 @@ const pricereviewCreate = () => {
},
}
}
const pricereviewCheck = ()=>{
return {
init(){
@ -927,8 +926,8 @@ const pricereviewCheck = () => {
if(option.option_relate_spec == elevator.item_no){
elevator.optionsTotalPrice += option.option_mi * option.item_qty
this.elevators[idx].options.push({
'id': option.id,
'item_spec': option.item_spec.trim(),
'id': option.id, //<br>()
'item_spec': option.item_spec.trim().replaceAll('&', '').replaceAll('lt;', '').replaceAll('br', '').replaceAll('gt;', '').replaceAll('()', ''),
'item_unit_price': option.item_unit_price,
'item_qty': option.item_qty,
'mi': Math.round(option.option_mi),
@ -1071,6 +1070,7 @@ const pricereviewCheck = () => {
demolishOptions:[],
mid: mid,
user_id: user_id,
reviewcomment:'',
optionsTotalPrice(){
return this.options.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
@ -1111,6 +1111,7 @@ const pricereviewCheck = () => {
form.append('mid', this.mid);
form.append('result', status);
form.append('user_id', this.user_id);
form.append('reviewcomment', this.reviewcomment);
axios.post('./api/postPricereviewSign.php', form).then(res=>{
console.log(res.data);
if(res.data == 1){
@ -1125,6 +1126,5 @@ const pricereviewCheck = () => {
const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}})
return res.data ;
},
}
}
Loading…
Cancel
Save