diff --git a/src/api/brand.ts b/src/api/brand.ts new file mode 100644 index 0000000..b4d0c90 --- /dev/null +++ b/src/api/brand.ts @@ -0,0 +1,35 @@ +import request from '@/utils/request' +/** + * 获取店铺列表 + * @param data 获取店铺列表的参数 + * @param data.keyword 模糊查询店铺 + * @returns 获取店铺列表 + */ +export interface designerListData { + keyword: string +} +export const getDesignerList = (data:designerListData,loading?:boolean) => { + return request({ + url: '/buyer/designer/search', + method: 'get', + params: data, + loading + }) +} + +/** + * 获取店铺详情 + * @param data 获取店铺详情的参数 + * @param data.sellerId 店铺 id + * @returns 获取店铺详情 + */ +export interface designerDetailData { + sellerId?: string +} +export const getDesignerDetail = (data:designerDetailData,loading?:boolean) => { + return request({ + url: `/buyer/designer/shop/${data.sellerId}`, + method: 'get', + loading + }) +} \ No newline at end of file diff --git a/src/api/listing.ts b/src/api/listing.ts new file mode 100644 index 0000000..3611584 --- /dev/null +++ b/src/api/listing.ts @@ -0,0 +1,70 @@ +import request from '@/utils/request' +/** + * 获取店铺商品列表 + * @param data 获取店铺商品列表的参数 + * @param data.sellerId 店铺id + * @param data.designFor 查询类型 female/male/all + * @param data.pageNum 页码 + * @param data.pageSize 页面大小 + * @returns 获取店铺商品列表 + */ +export interface listingListData { + sellerId?: string + designFor?: string + pageNum?: number + pageSize?: number +} +export const getlistingList = (data:listingListData,loading?:boolean) => { + return request({ + url: '/buyer/listing/shop/seller', + method: 'get', + params: data, + loading + }) +} + +/** + * 获取商品详情 + * @param data 获取商品详情的参数 + * @param data.id 商品 id + * @returns 获取商品详情 + */ +export interface listingDetailData { + id?: string +} +export const getListingDetail = (data:listingDetailData,loading?:boolean) => { + return request({ + url: `/buyer/listing/mall/detail`, + method: 'get', + params: data, + loading + }) +} + +/** + * 获取资产数字商品列表 + * @param data 获取资产数字商品列表的参数 + * @param data.designFor 查询类型 female/male/all + * @param data.categories 商品分类 + * @param data.sortField 排序字段 price/salesVolume/updateTime/viewCount/createTime,默认 updateTime + * @param data.sortOrder 排序顺序:asc/desc,默认 desc + * @param data.pageNum 页码 + * @param data.pageSize 页面大小 + * @returns 获取资产数字商品列表 + */ +export interface listingMallData { + designFor: string, + categories: string[], + sortField: string, + sortOrder: string, + pageNum: number, + pageSize: number +} +export const getListingMallList = (data:listingMallData,loading?:boolean) => { + return request({ + url: `/buyer/listing/mall`, + method: 'post', + data, + loading + }) +} \ No newline at end of file diff --git a/src/views/brand/brand-item.vue b/src/views/brand/brand-item.vue index fb837c2..945a12a 100644 --- a/src/views/brand/brand-item.vue +++ b/src/views/brand/brand-item.vue @@ -25,25 +25,25 @@ const {} = toRefs(data);
- +
-
{{ item.name }}
+
{{ item.shopName }}
- {{ item.collectionsName }} | - {{ item?.collections?.length || 0 }} Collections + {{ item.ownerName }} | + {{ item?.listingTotal || 0 }} Collections
View Profile
-
+
-
+
diff --git a/src/views/brand/index.vue b/src/views/brand/index.vue index f2dcbec..ded72e4 100644 --- a/src/views/brand/index.vue +++ b/src/views/brand/index.vue @@ -4,6 +4,8 @@ import { useRouter } from "vue-router"; import myEvent from '@/utils/myEvent' import scListNull from '@/views/shoppingCart/sc-list-null.vue' import brandItem from '@/views/brand/brand-item.vue' +import { getDesignerList } from '@/api/brand' + import img from '@/assets/images/collectionStory/Rectangle.png' //const props = defineProps({ @@ -23,87 +25,89 @@ const getMerchantData = reactive({ isShowMark:false, isNoData:false, }) -const list = ref([ - ' 1', - 'Brand 2', - 'Brand 3', - '1213123 4', - 'Brand 4', - '2222 4', - 'B23rand 4', - 'Bran112222d 4', - ' 4', +const searchHistory = ref([ + ]) let changeSearchBrandTime = null const changeSearchBrand = () => { clearTimeout(changeSearchBrandTime) - changeSearchBrandTime = setTimeout(()=>{ - getMerchantData.pageNum = 1 + getDesignerList({ + keyword: searchBrand.value, + }).then((res)=>{ merchantList.value = [] - getMerchantData.isShowMark = false - getMerchantData.isNoData = false - },300) + merchantList.value.push(...res) + }) + // changeSearchBrandTime = setTimeout(()=>{ + // getMerchantData.pageNum = 1 + // getMerchantData.isShowMark = false + // getMerchantData.isNoData = false + // },300) } -const getBrandList = async () => { - if(getMerchantData.isShowMark && !getMerchantData.isNoData)return - getMerchantData.isShowMark = true - let value = { - pageSize: getMerchantData.pageSize, - pageNum: getMerchantData.pageNum, - status: 1, - } - setTimeout(()=>{ - if(merchantList.value.length >= 5){ - getMerchantData.isNoData = true - merchantList.value = [] - return - } - getMerchantData.pageNum += 1 - merchantList.value.push({ - name:'Roaming Clouds', - portrait: img, - collectionsName:'by Lian Su ', - collections:[ - img,img,img, - ], - }) - getMerchantData.isShowMark = false - },1000) - // await getPublishList(value).then((res)=>{ - // if(res.content.length == 0)getMerchantData.isNoData = true - // getMerchantData.pageNum += 1 - // list.value.push(...res.content) - // }) -} -const vObserve = { - mounted (el,binding) { - getMerchantData.isShowMark = false - getMerchantData.isNoData = false - new IntersectionObserver( - (entries, observer) => { - // 如果不是相交,则直接返回 - // console.log(entries[0]); - if (!entries[0].intersectionRatio) return; - getMerchantData.pageNum += 1 - binding.value() - }, - // { root:worksPage } - ).observe(el); - } -} +// const getBrandList = async () => { +// if(getMerchantData.isShowMark && !getMerchantData.isNoData)return +// getMerchantData.isShowMark = true +// let value = { +// pageSize: getMerchantData.pageSize, +// pageNum: getMerchantData.pageNum, +// status: 1, +// } +// setTimeout(()=>{ +// if(merchantList.value.length >= 5){ +// getMerchantData.isNoData = true +// merchantList.value = [] +// return +// } +// getMerchantData.pageNum += 1 +// merchantList.value.push({ +// name:'Roaming Clouds', +// portrait: img, +// collectionsName:'by Lian Su ', +// collections:[ +// img,img,img, +// ], +// }) +// getMerchantData.isShowMark = false +// },1000) +// // await getPublishList(value).then((res)=>{ +// // if(res.content.length == 0)getMerchantData.isNoData = true +// // getMerchantData.pageNum += 1 +// // list.value.push(...res.content) +// // }) +// } +// const vObserve = { +// mounted (el,binding) { +// getMerchantData.isShowMark = false +// getMerchantData.isNoData = false +// new IntersectionObserver( +// (entries, observer) => { +// // 如果不是相交,则直接返回 +// // console.log(entries[0]); +// if (!entries[0].intersectionRatio) return; +// getMerchantData.pageNum += 1 +// binding.value() +// }, +// // { root:worksPage } +// ).observe(el); +// } +// } const deleteHistory = (item) => { - list.value = list.value.filter((i) => i != item) + searchHistory.value = searchHistory.value.filter((i) => i != item) + localStorage.setItem('brandSearchHistory', JSON.stringify(searchHistory.value)); } const viewProfile = (item) => { + if(!searchHistory.value.includes(searchBrand.value))searchHistory.value.push(searchBrand.value) + localStorage.setItem('brandSearchHistory', JSON.stringify(searchHistory.value)); router.push({ - path:'/brand/1', + path:'/brand/'+item.sellerId, }) } onMounted(()=>{ + const value = localStorage.getItem('brandSearchHistory'); + if(value)searchHistory.value = JSON.parse(value) }) onUnmounted(()=>{ }) @@ -129,10 +133,10 @@ const {} = toRefs(data);
- The End-
-
+
Searching History
-
+
{{item}}
diff --git a/src/views/brandDetail/index.vue b/src/views/brandDetail/index.vue index 4e9bd78..4193851 100644 --- a/src/views/brandDetail/index.vue +++ b/src/views/brandDetail/index.vue @@ -2,36 +2,57 @@ import { ref, onMounted, onUnmounted, reactive, toRefs } from "vue"; import CommodityList from "./commodity-list.vue"; import MerchantInfo from "./merchant-info.vue"; -import { useRouter } from "vue-router"; +import { useRouter, useRoute } from "vue-router"; import myEvent from '@/utils/myEvent' +import { getDesignerDetail } from '@/api/brand' + //const props = defineProps({ //}) //const emit = defineEmits([ //]) const router = useRouter() -let data = reactive({ +const route = useRoute() + +const designerDetail = ref({ + avatar: '', + brandBanner: '', + description: '', + email: '', + mobile: '', + ownerName: '', + shopName: '', + socialLinks: '[]', }) + const addShopping = (item) => { myEvent.emit('addShopping', item) } const openDetail = (item) => { router.push({name: 'digitalDetail', params: {id: item.id}}) } +const getDetail = ()=>{ + let data = { + sellerId: route.params.id, + } + getDesignerDetail(data,true).then((res)=>{ + designerDetail.value = res + }) +} onMounted(()=>{ + getDetail() }) onUnmounted(()=>{ }) defineExpose({}) -const {} = toRefs(data);