diff --git a/api/config.js b/api/config.js
index 7200afa..393d7e6 100644
--- a/api/config.js
+++ b/api/config.js
@@ -1,3 +1,4 @@
// export const base_url = 'http://121.37.100.169:9090'
-export const base_url = 'https://ma.zdtap.com'
+// export const base_url = 'https://ma.zdtap.com'
+export const base_url = 'https://pipi.zdtap.com'
// export const base_url = 'http://39.104.21.219:28082'
\ No newline at end of file
diff --git a/api/request.js b/api/request.js
index 7bec5e2..0ac86a6 100644
--- a/api/request.js
+++ b/api/request.js
@@ -20,7 +20,7 @@ export default (params) => {
// }
return new Promise((resolve, reject) => {
uni.request({
- url: base_url + url,
+ url: base_url +'/api'+ url,
method: method,
header: header,
data: data,
diff --git a/pages/activityList/styleSelection.vue b/pages/activityList/styleSelection.vue
index 78f859a..c922ae9 100644
--- a/pages/activityList/styleSelection.vue
+++ b/pages/activityList/styleSelection.vue
@@ -1,72 +1,119 @@
-
-
-
-
-
-
-
-
- 共{{}}款在售酒款
-
-
-
-
-
-
-
-
-
-
-
-
- {{it.beerName}}
-
- {{ it.beerStyles}}
-
- {{ it.brandName}}
-
-
-
-
+
+
+
+
+
+ {{ tab.title }}
+
- 更多新品发布信息,敬请关注更新~
+
+
+
+
+
+ 共 {{totalBeers}} 款在售酒款
+
+
+
+
+
+
+
+
+
+ {{beer.beerName}}
+ {{beer.beerStyles}}
+ {{beer.brandName}}
+
+
+
+
+
+
+
+
+
+ 暂无相关酒款
+
+
+
+
+
+
+ 加载中...
+
+ 没有更多了
+
-
-
-
-
-
- {{ item.beerStyles}}
-
-
+
+
+
+
-
- 清除筛选
-
-
@@ -76,289 +123,365 @@
getLastSixMonth,
getNewBeerListByMonth,
popularStyle,
+ getBrands,
+ getBeerStyles,
} from "@/api/platform.js"
import CustomNavBar from '@/components/CustomNavBar.vue'
import Sieving from '@/components/sieving/index.vue'
+
export default {
+ name: 'StyleSelection',
components: {
CustomNavBar,
Sieving
},
data() {
return {
- dataList: [],
- currentMonth: [],
- currentMonthIndex: 0,
+ // 列表数据
+ beerList: [],
+ totalBeers: 0,
+ loading: false,
+ isRefreshing: false,
+ hasMore: true,
+
+ // 筛选相关
+ selectedStyle: '',
popularStyleList: [],
- queryForm: {
- num: null
+
+ // 查询参数
+ queryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ sortType: 'latest',
+ style: ''
},
- bgcolor:'#19367A',
+
+ // 筛选配置
dropdownMenuList: [
- {
- title: '类型',
- type: 'cell',
- prop: 'god1',
- showAll: true,
- showIcon: true,
- value: '2', // 默认内容2
- options: [
- { label: '综合排序', value: '1' },
- // { label: '下拉列表项1', value: '1', suffix: '可插入副标题' },
- { label: '好评最多', value: '2' },
- { label: '距离最近', value: '3' },
- ],
- },
-
- {
- title: '口味',
- type: 'filter',
- prop: 'god4',
- // 默认选中单选2、多选2、3、滑动30
- value: { ft1: '2', ft2: ['2', '3'], ft3: 30 },
- options: [
- {
- title: '口味(单选)',
- type: 'radio',
- prop: 'ft1',
- options: [
- { label: '酱香', value: '1' },
- { label: '麻辣', value: '2' },
- { label: '特辣', value: '3' },
- { label: '微微辣', value: '4' },
- ],
- },
- {
- title: '配菜(可多选)',
- type: 'checkbox',
- prop: 'ft2',
- options: [
- { label: '香菜', value: '1' },
- { label: '辣椒', value: '2' },
- { label: '折耳根', value: '3' },
- { label: '蒜泥', value: '4' },
- { label: '耗油', value: '5' },
- { label: '精品牛肉酱', value: '6' },
- ],
- },
- {
- title: '糖度',
- type: 'slider',
- prop: 'ft3',
- componentProps: {
- min: 0,
- max: 100,
- step: 1,
- showValue: true,
- },
- },
- ],
- },
- {
- title: '区域',
- type: 'picker',
- prop: 'god5',
- showAll: true,
- showIcon: true,
- field: {
- label: 'label',
- value: 'value',
- children: 'children',
- },
- value: ['2', '2-2'], // 默认选中 级联X22
- options: [{
- label: '广东省',
- value: '1',
- children: [
- {
- label: '佛山市',
- value: '1-1',
- },
- {
- label: '深圳市',
- value: '1-2',
- }
- ],
- },
- {
- label: '海南省',
- value: '2',
- children: [
- {
- label: '海口市',
- value: '2-1',
- },
- {
- label: '儋州市',
- value: '2-2',
- },
- {
- label: '三亚市',
- value: '2-3',
- },
- ],
- },
- {
- label: '浙江省',
- value: '3',
- children: [
- {
- label: '杭州市',
- value: '3-1',
- },
- {
- label: '宁波市',
- value: '3-2',
- },
- {
- label: '嘉兴市',
- value: '3-3',
- },
- ],
- }],
- },
- {
- title: '日期',
- type: 'daterange',
- prop: 'god6',
- // 默认选中 2022-01-01到2022-02-01
- value: { start: '2022-01-01', end: '2022-02-01' },
- },
- // {
- // title: '插槽',
- // type: 'slot2',
- // prop: 'god2',
- // showArrow: true,
- // },
- // {
- // title: '排序',
- // type: 'sort',
- // prop: 'god3',
- // value: 'asc', // 默认升序
- // },
+ {
+ title: '品牌',
+ type: 'cell',
+ prop: 'brand',
+ value: '',
+ options: [],
+ showIcon: true,
+ activeColor: '#D42E78'
+ },
+ {
+ title: '风格',
+ type: 'cell',
+ prop: 'style',
+ value: '',
+ options: [],
+ showIcon: true,
+ activeColor: '#D42E78'
+ },
+ {
+ title: '价格',
+ type: 'slider',
+ prop: 'price',
+ value: {
+ min: 100,
+ max: 3000
+ },
+ showIcon: true,
+ activeColor: '#D42E78'
+ },
+ {
+ title: '排序',
+ type: 'cell',
+ prop: 'sort',
+ value: 'comprehensive',
+ showIcon: true,
+ activeColor: '#D42E78',
+ options: [
+ { label: '不限', value: 'comprehensive' },
+ { label: '高分优先', value: 'rating' },
+ { label: '热门优先', value: 'popular' },
+ { label: '最新发布', value: 'latest' }
+ ]
+ }
],
- };
+ }
},
- onLoad() {
- this.getPopularStyle()
- this.getLastSixMonthFun()
+ created() {
+ this.initData()
},
methods: {
+ // 初始化数据
+ async initData() {
+ try {
+ await Promise.all([
+ this.getPopularStyles(),
+ this.getBeerList()
+ ])
+ } catch (error) {
+ console.error('初始化数据失败:', error)
+ uni.showToast({
+ title: '加载失败,请重试',
+ icon: 'none'
+ })
+ }
+ },
+
// 获取热门风格
- getPopularStyle() {
- popularStyle().then(res => {
- console.log(res)
- this.popularStyleList = res.data
- })
+ async getPopularStyles() {
+ try {
+ const res = await popularStyle()
+ this.popularStyleList = res.data || []
+ } catch (error) {
+ console.error('获取热门风格失败:', error)
+ }
},
- changeMonth(item, index) {
- this.currentMonthIndex = index
- this.currentMonth = item.beers
- this.queryForm.num = index
- this.getNewBeerListByMonthFun()
+
+ // 获取啤酒列表
+ async getBeerList(isRefresh = false) {
+ if (this.loading) return
+
+ try {
+ this.loading = true
+ if (isRefresh) {
+ this.queryParams.pageNum = 1
+ this.beerList = []
+ }
+
+ const res = await getNewBeerListByMonth(this.queryParams)
+ const newList = res.data || []
+
+ this.beerList = isRefresh ?
+ newList : [...this.beerList, ...newList]
+ this.totalBeers = res.total || 0
+ this.hasMore = newList.length >= this.queryParams.pageSize
+
+ } catch (error) {
+ console.error('获取啤酒列表失败:', error)
+ uni.showToast({
+ title: '加载失败,请重试',
+ icon: 'none'
+ })
+ } finally {
+ this.loading = false
+ this.isRefreshing = false
+ }
},
- getLastSixMonthFun() {
- getLastSixMonth().then(res => {
- console.log(res)
- this.dataList = res.data
- this.queryForm.num = 0
- this.getNewBeerListByMonthFun()
- })
+
+ // 筛选相关方法
+ handleFilterConfirm(value, allValues) {
+ const { brand, style, price, sort } = allValues
+
+ this.queryParams = {
+ ...this.queryParams,
+ brandId: brand,
+ styleId: style,
+ priceMin: price?.min,
+ priceMax: price?.max,
+ sortType: sort
+ }
+
+ if (sort === 'comprehensive') {
+ this.queryParams.weights = {
+ popular: 0.5,
+ rating: 0.3,
+ latest: 0.2
+ }
+ } else {
+ delete this.queryParams.weights
+ }
+
+ this.getBeerList(true)
},
- // 跳转酒款详情
- toBeer(item) {
+
+ handleFilterOpen(tabName) {
+ this.queryParams.style = tabName
+ },
+
+ handleFilterClose() {
+ this.queryParams.style = ''
+ },
+
+ selectStyle(style) {
+ this.selectedStyle = style.beerStyles
+ this.queryParams.style = style.beerStyles
+ this.getBeerList(true)
+ this.$refs.stylePopup.close()
+ },
+
+ clearFilter() {
+ this.selectedStyle = ''
+ this.queryParams.style = ''
+ this.getBeerList(true)
+ this.$refs.stylePopup.close()
+ },
+
+ // 列表相关方法
+ loadMore() {
+ if (!this.hasMore || this.loading) return
+ this.queryParams.pageNum++
+ this.getBeerList()
+ },
+
+ async onRefresh() {
+ this.isRefreshing = true
+ await this.getBeerList(true)
+ },
+
+ // 导航方法
+ navigateToBeerDetail(beer) {
uni.navigateTo({
- url: '/pages/index/review?beerId=' + item.id
+ url: `/pages/index/review?beerId=${beer.id}`
})
- },
- showStyle() {
- this.$refs.popup.open()
- },
- searchByStyle(item) {
- this.queryForm.style = item.beerStyles
- this.getNewBeerListByMonthFun()
- this.$refs.popup.close()
- },
- // 获取新酒列表
- getNewBeerListByMonthFun() {
- getNewBeerListByMonth(this.queryForm).then(res => {
- console.log(res)
- this.currentMonth = res.data
- })
- },
- clear() {
- delete this.queryForm.style
- this.$refs.popup.close()
- this.getNewBeerListByMonthFun()
- },
- handleConfirm(v, selectedValue) {
- console.log('当前项: ', v)
- console.log('---------------')
- console.log('全部项目(所有): ', selectedValue)
- },
- handleClose(v, callbackMenuList) {
- // console.log('handleClose ==>', v, callbackMenuList)
- },
- handleOpen(v) {
- // console.log('handleOpen ==>', v)
- },
+ }
}
}
\ No newline at end of file
diff --git a/pages/index/newBeer.vue b/pages/index/newBeer.vue
index 71a5153..42e170f 100644
--- a/pages/index/newBeer.vue
+++ b/pages/index/newBeer.vue
@@ -1,71 +1,89 @@
-
-
- 新酒上市
+
+
+
+ 新酒
+ 上市
-
-
- {{ it.month}}月
- 共{{ it.beerCount}}款
-
-
-
-
-
-
-
-
- 筛选
-
-
-
-
-
-
-
- {{ it.launchDate.slice(8, 10)}}/{{ it.launchDate.slice(5, 7)}}月
-
-
-
-
-
-
-
- {{it.beerName}}
-
- {{ it.beerStyles}}
-
- {{ it.brandName}}
+
+
+
+
+ {{it.month}}月
+ 共{{it.beerCount}}款
-
-
-
-
- 更多新品发布信息,敬请关注更新~
-
-
-
-
-
+
+
+
+
+ {{ item.label }}
+
+
- 清除筛选
- -->
+
+
+
+
+
+
+
+
+
+
+
+
+ {{it.beerName}}
+
+ {{it.beerStyles}}
+ {{it.brandName}}
+
+
+
+
+
+
+
+
+ 更多新品发布信息,敬请关注更新~
+
+
@@ -75,34 +93,31 @@
getNewBeerListByMonth,
popularStyle,
} from "@/api/platform.js"
- import shaiXuan from '@/components/shaiXuan.vue';
+
export default {
- components: {
- shaiXuan,
- },
data() {
return {
dataList: [],
currentMonth: [],
currentMonthIndex: 0,
- popularStyleList: [],
+ currentStyle: 'all',
+ styleList: [
+ { label: '全部', value: 'all' },
+ { label: 'IPA', value: 'ipa' },
+ { label: '拉格', value: 'lager' },
+ { label: '艾尔', value: 'ale' },
+ { label: '西打', value: 'cider' },
+ { label: '其他', value: 'other' }
+ ],
queryForm: {
num: null
}
};
},
onLoad() {
- this.getPopularStyle()
this.getLastSixMonthFun()
},
methods: {
- // 获取热门风格
- getPopularStyle() {
- popularStyle().then(res => {
- console.log(res)
- this.popularStyleList = res.data
- })
- },
changeMonth(item, index) {
this.currentMonthIndex = index
this.currentMonth = item.beers
@@ -117,30 +132,32 @@
this.getNewBeerListByMonthFun()
})
},
- // 跳转酒款详情
toBeer(item) {
uni.navigateTo({
url: '/pages/index/review?beerId=' + item.id
})
},
- showStyle() {
- this.$refs.popup.open()
- },
- searchByStyle(item) {
- this.queryForm.style = item.beerStyles
- this.getNewBeerListByMonthFun()
- this.$refs.popup.close()
- },
- // 获取新酒列表
getNewBeerListByMonthFun() {
getNewBeerListByMonth(this.queryForm).then(res => {
console.log(res)
this.currentMonth = res.data
})
},
- clear() {
- delete this.queryForm.style
- this.$refs.popup.close()
+ handleStyleChange(item) {
+ if (this.currentStyle === item.value) return
+ this.currentStyle = item.value
+
+ // 根据选择的风格类型设置查询参数
+ if (item.value === 'all') {
+ this.queryForm.style = ''
+ } else if (item.value === 'other') {
+ // 其他类别:排除主要类别
+ this.queryForm.style = '!ipa,!lager,!ale,!cider'
+ } else {
+ // 主要类别:直接使用对应的值
+ this.queryForm.style = item.value
+ }
+
this.getNewBeerListByMonthFun()
}
}
@@ -148,92 +165,348 @@
\ No newline at end of file