Fix:4971 【商城小程序】体验券详情页—店铺分类无数据时隐藏分类
This commit is contained in:
@@ -173,6 +173,10 @@ export function getExperienceCouponItems(params) {
|
||||
return request.get('/experienceCoupon/items', params, {login: true})
|
||||
}
|
||||
|
||||
export function getExperienceCouponCategoryList(params) {
|
||||
return request.get('/experienceCoupon/categoryList', params, {login: true})
|
||||
}
|
||||
|
||||
export function createExperienceCouponOrder(data) {
|
||||
return request.post('/experienceCoupon/order/create', data, {login: true})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
import { getLatestExperienceCoupon, getExperienceCouponList, getExperienceCouponItems, createExperienceCouponOrder } from '@/api/product'
|
||||
import { getExperienceStoreCategoryList } from '@/api/join'
|
||||
import { getLatestExperienceCoupon, getExperienceCouponList, getExperienceCouponItems, createExperienceCouponOrder, getExperienceCouponCategoryList } from '@/api/product'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -119,6 +118,7 @@ export default {
|
||||
this.endTime = coupon.endTime || ''
|
||||
this.expireDate = this.endTime || this.expireDate
|
||||
this.headerImage = coupon.experienceCouponImage || (this.webUrl + '/experienceCoupon/header.png')
|
||||
this.fetchCategoryList()
|
||||
this.fetchExperienceItems()
|
||||
},
|
||||
fetchExperienceCoupon() {
|
||||
@@ -151,7 +151,12 @@ export default {
|
||||
}).catch(() => {})
|
||||
},
|
||||
fetchCategoryList() {
|
||||
getExperienceStoreCategoryList().then(({ data }) => {
|
||||
if (!this.activeCouponId) {
|
||||
this.categoryList = [{ id: 'all', name: '全部体验' }]
|
||||
return
|
||||
}
|
||||
const params = { couponId: this.activeCouponId }
|
||||
getExperienceCouponCategoryList(params).then(({ data }) => {
|
||||
const list = data || []
|
||||
this.categoryList = [
|
||||
{ id: 'all', name: '全部体验' },
|
||||
@@ -160,7 +165,9 @@ export default {
|
||||
name: item.name
|
||||
}))
|
||||
]
|
||||
}).catch(() => {})
|
||||
}).catch(() => {
|
||||
this.categoryList = [{ id: 'all', name: '全部体验' }]
|
||||
})
|
||||
},
|
||||
fetchExperienceItems() {
|
||||
if (!this.activeCouponId) {
|
||||
|
||||
Reference in New Issue
Block a user