Feat:寻千县万村店铺增加2级分类

This commit is contained in:
LinCyJang
2026-01-31 15:45:51 +08:00
parent 2682ecaecd
commit 7b1ac89b5b
4 changed files with 158 additions and 18 deletions
+105 -6
View File
@@ -175,6 +175,33 @@
</template>
</u-cell>
</view>
<u-form-item prop="isCountyFamous">
<u-cell title="是否县域店铺" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-radio-group
v-model="form.isCountyFamous"
:disabled="reviewing"
placement="row"
@change="countyFamousChange"
>
<u-radio
:name="0"
:customStyle="{marginRight: '16px'}"
active-color="red"
label="否"
/>
<u-radio
:name="1"
active-color="red"
label="是"
/>
</u-radio-group>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="typeText">
<u-cell title="店铺类型" :border="false" isLink>
<template #icon>
@@ -316,7 +343,15 @@
<text class="required">*</text>
</template>
<template #value>
<u--text :text="form.serviceTime + ' - ' + form.serviceEndTime"></u--text>
<u--text
v-if="form.serviceTime && form.serviceEndTime"
:text="form.serviceTime + ' - ' + form.serviceEndTime"
></u--text>
<u--text
v-else
text="请选择营业时间"
color="#c0c4cc"
></u--text>
<tpf-time-range
startTime="00:00"
endTime="23:59"
@@ -414,7 +449,8 @@ import {
getShopInfo,
removeApply,
saveShop,
getHotelInfo
getHotelInfo,
getCountyFamousHotelType
} from '@/api/join'
import {
getCity,
@@ -449,6 +485,8 @@ export default {
qualification: '',
type: 0,
typeText: '',
isCountyFamous: 0,
countyFamousHotelType: null,
phone: '',
captcha: '',
area: '',
@@ -483,6 +521,12 @@ export default {
message: '请上传店铺LOGO',
trigger: ['blur', 'change']
},
'isCountyFamous': {
type: 'number',
required: true,
message: '请选择是否为县域店铺',
trigger: ['blur', 'change']
},
'typeText': {
type: 'string',
required: true,
@@ -539,6 +583,8 @@ export default {
}
},
columnsType: [],
hotelTypeList: [],
countyFamousHotelTypeList: [],
indexType: [0],
district: [],
address: {},
@@ -574,6 +620,8 @@ export default {
qualification: '',
type: 0,
typeText: '',
isCountyFamous: 0,
countyFamousHotelType: null,
phone: '',
captcha: '',
area: '',
@@ -646,9 +694,18 @@ export default {
this.district = data
})
getShopData().then(({data}) => {
this.columnsType = data.hotelTypeList
this.hotelTypeList = data.hotelTypeList || []
this.columnsType = this.hotelTypeList
this.notice = data.merchantApplyNotice
this.initInfo()
getCountyFamousHotelType().then(res => {
const listData = Array.isArray(res.data)
? res.data
: (res.data && (res.data.hotelTypeList || res.data.list || res.data.records)) || []
this.countyFamousHotelTypeList = listData || []
this.initInfo()
}).catch(() => {
this.initInfo()
})
})
},
@@ -685,6 +742,10 @@ export default {
// 店铺图片
this.pics = []
this.form = data.hotelInfo
if (!this.form.serviceTime || !this.form.serviceEndTime) {
this.form.serviceTime = ''
this.form.serviceEndTime = ''
}
this.form.coverVideo = this.form.coverType === 2 ? this.form.cover : ''
const picsTemp = this.form.pics.split(',')
if (picsTemp.length > 0) {
@@ -704,7 +765,16 @@ export default {
}
})
}
this.indexType = this.columnsType.findIndex(item => item.id === this.form.type)
if (this.form.isCountyFamous !== 1 && this.form.isCountyFamous !== 0) {
this.form.isCountyFamous = 0
}
if (this.form.isCountyFamous === 1) {
this.columnsType = this.countyFamousHotelTypeList
this.indexType = this.columnsType.findIndex(item => item.id === this.form.countyFamousHotelType)
} else {
this.columnsType = this.hotelTypeList
this.indexType = this.columnsType.findIndex(item => item.id === this.form.type)
}
if (this.indexType !== -1) {
this.form.typeText = this.columnsType[this.indexType].name
}
@@ -767,13 +837,42 @@ export default {
})
}
},
countyFamousChange(e) {
const value = parseInt(e)
this.form.isCountyFamous = value
if (value === 1) {
if (this.countyFamousHotelTypeList.length === 0) {
getCountyFamousHotelType().then(res => {
const listData = Array.isArray(res.data)
? res.data
: (res.data && (res.data.hotelTypeList || res.data.list || res.data.records)) || []
this.countyFamousHotelTypeList = listData || []
this.columnsType = this.countyFamousHotelTypeList
})
} else {
this.columnsType = this.countyFamousHotelTypeList
}
this.indexType = 0
this.form.typeText = ''
this.form.countyFamousHotelType = null
} else {
this.columnsType = this.hotelTypeList
this.indexType = 0
this.form.typeText = ''
this.form.type = 0
}
},
typeChange(e) {
const idx = parseInt(e.detail.value)
this.columnsType.map((item, index) => {
if (index === idx) {
this.form.typeText = item.name
this.indexType = index
this.form.type = item.id
if (this.form.isCountyFamous === 1) {
this.form.countyFamousHotelType = item.id
} else {
this.form.type = item.id
}
}
})
},