chore(package): fix lint caused error

This commit is contained in:
woody 2025-06-04 09:09:18 +08:00
parent 0890b44385
commit 158525544e
3 changed files with 14935 additions and 16406 deletions

30979
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -99,18 +99,18 @@
"@dcloudio/webpack-uni-pages-loader": "^2.0.2-3081220230817001",
"@vue/cli-plugin-babel": "~4.5.13",
"@vue/cli-service": "~4.5.13",
"@vue/eslint-config-standard": "^9.0.1",
"@vue/eslint-config-standard": "^8.0.1",
"babel-plugin-import": "^1.11.0",
"cross-env": "^7.0.2",
"eslint": "^9.27.0",
"eslint-config-prettier": "^10.1.5",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^10.1.0",
"eslint-plugin-vue": "^9.27.0",
"jest": "^25.4.0",
"less": "^3.9.0",
"less-loader": "^4.1.0",
"postcss-comment": "^2.0.0",
"prettier": "^3.5.3",
"prettier": "^2.8.8",
"sass": "^1.67.0",
"sass-loader": "^10.4.1",
"vue-template-compiler": "^2.6.11"

View File

@ -13,187 +13,197 @@
<template>
<view>
<u-picker @cancel='pickershow=false'
:show="pickershow"
ref="uPicker"
:defaultIndex="defaultIndex"
:columns="columns"
@confirm="confirm"
keyName='name'
@change="changeHandler"></u-picker>
<u-picker
@cancel="pickershow = false"
:show="pickershow"
ref="uPicker"
:defaultIndex="defaultIndex"
:columns="columns"
@confirm="confirm"
keyName="name"
@change="changeHandler"
></u-picker>
</view>
</template>
<script>
import * as api from '@/api/goods'
export default {
data() {
return {
columns: [],
pickershow: false,
provinceList: [],
cityList: [],
quList: [],
diqu: '',
form: {},
defaultIndex: [],
user: '',
}
},
props: {
defaultCode: {
type: Array,
default: [],
import * as api from '@/api/goods';
export default {
data() {
return {
columns: [],
pickershow: false,
provinceList: [],
cityList: [],
quList: [],
diqu: '',
form: {},
defaultIndex: [],
user: '',
};
},
},
watch: {
defaultCode: {
deep: true,
handler(n) {
if (this.cityList.length > 0) {
this.getDefaultIndex(n)
} else {
this.getAllAreaList(uni.getStorageSync('pkCountry')||this.user.pkSettleCountry).then((res) => {
if (res) {
this.getDefaultIndex(n)
}
})
}
props: {
defaultCode: {
type: Array,
default: [],
},
},
},
created() {
this.user = uni.getStorageSync('User')
this.getAllAreaList(uni.getStorageSync('pkCountry')||this.user.pkSettleCountry)
},
methods: {
getDefaultIndex(arr) {
let a = this.provinceList.findIndex((item) => item.pkId == arr[0])
let b = this.cityList[a].arrList.findIndex((item) => item.pkId == arr[1])
let c = this.quList.findIndex((item) => item.pkId == arr[1])
let d = this.quList[c].arrList.findIndex((item) => item.pkId == arr[2])
this.columns = [
this.provinceList,
this.cityList[a].arrList,
this.quList[c].arrList,
]
let diqu
this.defaultIndex = [a, b, d > -1 ? d : 0]
if (d > -1) {
diqu = `${this.provinceList[a].name}-${this.cityList[a].arrList[b].name}-${this.quList[c].arrList[d].name}`
} else {
diqu = `${this.provinceList[a].name}-${this.cityList[a].arrList[b].name}`
}
this.$emit('getAddressData', diqu)
},
setShow() {
this.pickershow = true
},
getAllAreaList(pkCountry) {
return new Promise((reslove, reject) => {
api
.getAllAreaList({
pkCountry: pkCountry,
})
.then((res) => {
this.provinceList = res.data.provinceList
//
let cityList = []
res.data.provinceList.forEach((element, index) => {
cityList.push({
pkId: element.pkId,
arrList: [],
})
res.data.cityList.forEach((item, cndex) => {
if (element.pkId == item.parent) {
cityList[index].arrList.push(item)
}
})
})
this.cityList = cityList
//
let quList = []
res.data.cityList.forEach((element, index) => {
quList.push({
pkId: element.pkId,
arrList: [],
})
res.data.countyList.forEach((item, cndex) => {
if (element.pkId == item.parent) {
quList[index].arrList.push(item)
}
})
})
this.quList = quList
this.columns = [
res.data.provinceList,
cityList[0].arrList,
quList[0].arrList,
]
reslove(true)
})
})
},
changeHandler(e) {
const {
columnIndex,
value,
values, // values
index,
indexs,
// pickerref
picker = this.$refs.uPicker,
} = e
// ()
if (columnIndex === 0) {
picker.setColumnValues(1, this.cityList[indexs[0]].arrList)
let arr = []
this.quList.forEach((item) => {
if (item.pkId == this.cityList[indexs[0]].arrList[0].pkId) {
arr = item.arrList
watch: {
defaultCode: {
deep: true,
handler(n) {
if (this.cityList.length > 0) {
this.getDefaultIndex(n);
} else {
this.getAllAreaList(
uni.getStorageSync('pkCountry') || this.user.pkSettleCountry
).then((res) => {
if (res) {
this.getDefaultIndex(n);
}
});
}
})
picker.setColumnValues(2, arr)
// pickerthis
} else if (columnIndex === 1) {
let arr = []
this.quList.forEach((item) => {
if (item.pkId == this.cityList[indexs[0]].arrList[index].pkId) {
arr = item.arrList
}
})
picker.setColumnValues(2, arr)
}
},
},
},
// columnIndexvaluevalues
confirm(e) {
this.pickershow = false
if (e.value[2]) {
this.diqu = `${e.value[0].name}-${e.value[1].name}-${e.value[2].name}`
this.form.province = e.value[0].pkId
this.form.city = e.value[1].pkId
this.form.county = e.value[2].pkId
} else {
this.diqu = `${e.value[0].name}-${e.value[1].name}`
this.form.province = e.value[0].pkId
this.form.city = e.value[1].pkId
this.form.county = ''
}
this.$emit('addressData', this.diqu, this.form)
created() {
this.user = uni.getStorageSync('User');
this.getAllAreaList(
uni.getStorageSync('pkCountry') || this.user.pkSettleCountry
);
},
},
}
methods: {
getDefaultIndex(arr) {
const a = this.provinceList.findIndex((item) => item.pkId == arr[0]);
const b = this.cityList[a].arrList.findIndex(
(item) => item.pkId == arr[1]
);
const c = this.quList.findIndex((item) => item.pkId == arr[1]);
const d = this.quList[c].arrList.findIndex(
(item) => item.pkId == arr[2]
);
this.columns = [
this.provinceList,
this.cityList[a].arrList,
this.quList[c].arrList,
];
let diqu;
this.defaultIndex = [a, b, d > -1 ? d : 0];
if (d > -1) {
diqu = `${this.provinceList[a].name}-${this.cityList[a].arrList[b].name}-${this.quList[c].arrList[d].name}`;
} else {
diqu = `${this.provinceList[a].name}-${this.cityList[a].arrList[b].name}`;
}
this.$emit('getAddressData', diqu);
},
setShow() {
this.pickershow = true;
},
getAllAreaList(pkCountry) {
return new Promise((reslove, reject) => {
api
.getAllAreaList({
pkCountry,
})
.then((res) => {
this.provinceList = res.data.provinceList;
//
const cityList = [];
res.data.provinceList.forEach((element, index) => {
cityList.push({
pkId: element.pkId,
arrList: [],
});
res.data.cityList.forEach((item, cndex) => {
if (element.pkId == item.parent) {
cityList[index].arrList.push(item);
}
});
});
this.cityList = cityList;
//
const quList = [];
res.data.cityList.forEach((element, index) => {
quList.push({
pkId: element.pkId,
arrList: [],
});
res.data.countyList.forEach((item, cndex) => {
if (element.pkId == item.parent) {
quList[index].arrList.push(item);
}
});
});
this.quList = quList;
this.columns = [
res.data.provinceList,
cityList[0].arrList,
quList[0].arrList,
];
reslove(true);
});
});
},
changeHandler(e) {
const {
columnIndex,
value,
values, // values
index,
indexs,
// pickerref
picker = this.$refs.uPicker,
} = e;
// ()
if (columnIndex === 0) {
picker.setColumnValues(1, this.cityList[indexs[0]].arrList);
let arr = [];
this.quList.forEach((item) => {
if (item.pkId == this.cityList[indexs[0]].arrList[0].pkId) {
arr = item.arrList;
}
});
picker.setColumnValues(2, arr);
// pickerthis
} else if (columnIndex === 1) {
let arr = [];
this.quList.forEach((item) => {
if (item.pkId == this.cityList[indexs[0]].arrList[index].pkId) {
arr = item.arrList;
}
});
picker.setColumnValues(2, arr);
}
},
// columnIndexvaluevalues
confirm(e) {
this.pickershow = false;
if (e.value[2]) {
this.diqu = `${e.value[0].name}-${e.value[1].name}-${e.value[2].name}`;
this.form.province = e.value[0].pkId;
this.form.city = e.value[1].pkId;
this.form.county = e.value[2].pkId;
} else {
this.diqu = `${e.value[0].name}-${e.value[1].name}`;
this.form.province = e.value[0].pkId;
this.form.city = e.value[1].pkId;
this.form.county = '';
}
this.$emit('addressData', this.diqu, this.form);
},
},
};
</script>
<style lang="scss" scoped>
.picker {
display: flex;
justify-content: space-between;
width: 100%;
border-width: 0.5px !important;
border-color: #dadbde !important;
border-style: solid;
border-radius: 4px;
padding: 6px 9px;
}
.picker {
display: flex;
justify-content: space-between;
width: 100%;
border-width: 0.5px !important;
border-color: #dadbde !important;
border-style: solid;
border-radius: 4px;
padding: 6px 9px;
}
</style>