fix: address

This commit is contained in:
puriphatt 2024-09-24 11:23:16 +07:00
parent ea28bd7e2b
commit 2fd669b573
3 changed files with 13 additions and 17 deletions

View file

@ -67,37 +67,31 @@ const addrOptions = reactive<{
const { t } = useI18n();
const fullAddress = computed(() => {
const addressParts = [address.value];
const addressParts = [`${address.value},`];
const province = provinceOptions.value.find((v) => v.id === provinceId.value);
const district = districtOptions.value.find((v) => v.id === districtId.value);
const sDistrict = subDistrictOptions.value.find(
(v) => v.id === subDistrictId.value,
);
if (moo.value) addressParts.push(`${t('form.moo')} ${moo.value}`);
if (soi.value) addressParts.push(`${t('form.soi')} ${soi.value}`);
if (street.value) addressParts.push(`${t('form.road')} ${street.value}`);
if (moo.value) addressParts.push(`${t('form.moo')} ${moo.value},`);
if (soi.value) addressParts.push(`${t('form.soi')} ${soi.value},`);
if (street.value) addressParts.push(`${t('form.road')} ${street.value},`);
if (subDistrictId.value && sDistrict) {
addressParts.push(
typeof sDistrict.name === 'string'
? `${t('form.subDistrict')} ${sDistrict.name}`
: '',
typeof sDistrict.name === 'string' ? `${sDistrict.name},` : '',
);
}
if (districtId.value && district)
addressParts.push(
typeof district.name === 'string'
? `${t('form.district')} ${district.name}`
: '',
typeof district.name === 'string' ? `${district.name},` : '',
);
if (provinceId.value && province) {
addressParts.push(
typeof province.name === 'string'
? `${t('form.province')} ${province.name}`
: '',
typeof province.name === 'string' ? `${province.name}` : '',
);
sDistrict &&
addressParts.push(