fix
This commit is contained in:
@@ -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<void>((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'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user