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
+5
View File
@@ -65,6 +65,11 @@ export function getHotelInfo(params) {
return request.get("merchantApply/info/hotel", params, {login: true})
}
// 获取千县名品店铺类型列表
export function getCountyFamousHotelType() {
return request.get("/countyFamous/hotelType", {}, {login: true})
}
/**
* 旅居管家入驻申请详情
*/
+4
View File
@@ -312,3 +312,7 @@ export function getCityNewsCategory() {
export function getCityShopList(params) {
return request.get('/countyFamous/hotel', params, {login: true})
}
export function getCountyFamousHotelType() {
return request.get('/countyFamous/hotelType', {}, {login: true})
}
+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
}
}
})
},
+44 -12
View File
@@ -552,6 +552,16 @@
</view>
</view>
<view class="village-wrap v12-pt-3">
<view class="v12-pa-2 sale-wrap">
<view
v-for="(type, typeIndex) in shopTypeList"
:key="typeIndex"
:class="{ saleActive: shopTypeActive === type.id }"
@click="handleShopType(type)"
>
{{ type.name }}
</view>
</view>
<view v-if="shopList.length > 0" class="village-list">
<view
v-for="(shop, shopIndex) in shopList"
@@ -876,7 +886,8 @@ import {
getSaleList,
getJiaLouList,
getCityNewsCategory,
getCityShopList
getCityShopList,
getCountyFamousHotelType
} from '@/api/qianxian'
import ProductWindow from '@/components/ProductWindow'
import goCartMixin from '@/mixins/goCartMixins'
@@ -966,6 +977,8 @@ export default {
newsCategoryList: [],
newsCurrent: 0,
shopList: [],
shopTypeList: [],
shopTypeActive: '',
}
},
onShareAppMessage() {
@@ -1641,7 +1654,7 @@ export default {
industryTabItemClick(index) {
if (index === this.industryTabIndex) return
this.industryTabIndex = index
if(index === 2) {
if (index === 2) {
const params = {
countyId: this.countyId,
shopType: 'countyFamous',
@@ -1649,23 +1662,42 @@ export default {
page: 1,
limit: 9999
}
console.log(this.inn);
getJiaLouList(params).then(res => {
this.jiaLouList = res.data.records || []
})
}
if(index === 1) {
const params = {
countyFamousDataId: this.id,
page: 1,
limit: 9999
if (index === 1) {
this.shopTypeActive = ''
if (this.shopTypeList.length === 0) {
this.getShopTypeList()
}
getCityShopList(params).then(res => {
this.shopList = res.data.records || []
})
this.getShopList()
}
},
getShopTypeList() {
getCountyFamousHotelType().then(res => {
const listData = Array.isArray(res.data)
? res.data
: (res.data && (res.data.hotelTypeList || res.data.list || res.data.records)) || []
this.shopTypeList = [{ name: '全部', id: '' }].concat(listData || [])
})
},
getShopList() {
const params = {
countyFamousDataId: this.id,
countyFamousHotelType: this.shopTypeActive,
page: 1,
limit: 9999
}
getCityShopList(params).then(res => {
this.shopList = (res.data && (res.data.records || res.data.list)) || []
})
},
handleShopType(type) {
if (this.shopTypeActive === type.id) return
this.shopTypeActive = type.id
this.getShopList()
},
fileItemClick(file) {
const url = file.attachment || ''
if (!url) return