diff --git a/src/views/SellerDashboard/MyListings/createSelectItem/index.vue b/src/views/SellerDashboard/MyListings/createSelectItem/index.vue index 9944930d..32b7c9ed 100644 --- a/src/views/SellerDashboard/MyListings/createSelectItem/index.vue +++ b/src/views/SellerDashboard/MyListings/createSelectItem/index.vue @@ -45,8 +45,8 @@ const next = ()=>{ router.push({ path:'/home/seller/myListings/edit', state: { - id:route.params.collectionId, designItemIds, + type:'create' } }) } diff --git a/src/views/SellerDashboard/MyListings/main/content.vue b/src/views/SellerDashboard/MyListings/main/content.vue index 67634495..4bf01e5b 100644 --- a/src/views/SellerDashboard/MyListings/main/content.vue +++ b/src/views/SellerDashboard/MyListings/main/content.vue @@ -5,6 +5,8 @@ import contentItem from "./contentItem.vue" import selectMenu from '@/component/modules/selectMenu.vue' import deleteDrafts from './deleteDrafts.vue' import { Https } from '@/tool/https' +import { message } from 'ant-design-vue' +import { useRouter } from 'vue-router' //const props = defineProps({ //}) @@ -63,10 +65,13 @@ const domSizeList = ref([ const visible = ref(false) const deleteDraftsRef = ref(null) +const router = useRouter() const deleteDraft = (item: any)=>{ - deleteDraftsRef.value.open(()=>{ - list2.value = list2.value.filter((v: any)=>v.id != item.id) + deleteDraftsRef.value.open(item,()=>{ + putListingStatus(item,2).then(()=>{ + list2.value = list2.value.filter((v: any)=>v.id != item.id) + }) }) } @@ -99,6 +104,7 @@ const getPublishedData = async ()=>{ } await getPublishList(value).then((res)=>{ if(res.content.length == 0)publishData.isNoData = true + publishData.pageNum += 1 list.value.push(...res.content) }) publishData.isShowMark = false @@ -113,6 +119,7 @@ const getNoPublishedData = async ()=>{ } await getPublishList(value).then((res)=>{ if(res.content.length == 0)noPublishData.isNoData = true + noPublishData.pageNum += 1 list2.value.push(...res.content) }) noPublishData.isShowMark = false @@ -127,28 +134,46 @@ const getPublishList = (data:any)=>{ }) } -const putListingStatus = ()=>{ - let data = { - id:'', - status:'', - } - Https.axiosPut(Https.httpUrls.putListingStatus,data).then((res:any)=>{ +const putListingStatus = async (item,status:number)=>{ + return new Promise((resolve, reject) => { + let data = { + id:item.id, + status:status, + } + Https.axiosPut(Https.httpUrls.putListingStatus,data).then((res:any)=>{ + resolve(res) + }).catch((err:any)=>{ + reject(err) + }) }) } -const draftListing = (item: any)=>{ +const draftListing = async (item: any)=>{ //数组前面添加item - list2.value.unshift(item) - list.value = list.value.filter((v: any)=>v.id != item.id) + await putListingStatus(item,0).then(()=>{ + list2.value.unshift(item) + list.value = list.value.filter((v: any)=>v.id != item.id) + }) + message.success('Product moved to drafts and stats reset.') } -const publishListing = (item: any)=>{ - list.value.unshift(item) - list2.value = list2.value.filter((v: any)=>v.id != item.id) +const publishListing = async (item: any)=>{ + await putListingStatus(item,1).then(()=>{ + list.value.unshift(item) + list2.value = list2.value.filter((v: any)=>v.id != item.id) + }) + message.success('Item is now live on the Marketplace.') } const editListing = (item: any)=>{ + router.push({ + path:'/home/seller/myListings/edit', + state: { + id:item.id, + type:'edit' + } + }) } diff --git a/src/views/SellerDashboard/MyListings/main/contentItem.vue b/src/views/SellerDashboard/MyListings/main/contentItem.vue index f190ffcb..4ed9161e 100644 --- a/src/views/SellerDashboard/MyListings/main/contentItem.vue +++ b/src/views/SellerDashboard/MyListings/main/contentItem.vue @@ -32,7 +32,7 @@ const {} = toRefs(data);