diff --git a/src/pages/goods/banners.vue b/src/pages/goods/banners.vue index 424ba4ad95ccef7495c29bb37815c1645f0bf9b0..91eaabd78f55d962077569fcfaa1fe58848cf7b1 100644 --- a/src/pages/goods/banners.vue +++ b/src/pages/goods/banners.vue @@ -7,7 +7,7 @@ - 提交 + 提交 @@ -22,6 +22,7 @@ import { readGoods, setGoodsBanner } from "@/api/goods" +import { toast } from '@/composables/util' const dialogVisible = ref(false) const form = reactive({ @@ -31,15 +32,30 @@ const form = reactive({ const goodsId = ref(0) const open = (row)=>{ goodsId.value = row.id + row.bannersLoading = true readGoods(goodsId.value) .then(res=>{ form.banners = res.goodsBanner.map(o=>o.url) dialogVisible.value = true }) + .finally(()=>{ + row.bannersLoading = false + } + ) } +const loading = ref(false) const submit = ()=>{ + loading.value = true + setGoodsBanner(goodsId.value, form) + .then(res=>{ + toast("设置轮播图成功") + dialogVisible.value = false + }) + .finally(()=>{ + loading.value = false + }) } diff --git a/src/pages/goods/list.vue b/src/pages/goods/list.vue index 55e48b306c7716fdba2b0a28677b55e1b76c48b6..1b05e290eefced07fe874b5183ab47d281f3a9f8 100644 --- a/src/pages/goods/list.vue +++ b/src/pages/goods/list.vue @@ -77,7 +77,7 @@ 修改 商品规格 设置轮播图 + @click="handleSetGoodsBanners(scope.row)" :loading="scope.row.bannersLoading">设置轮播图 商品详情 @@ -211,7 +211,7 @@ const { getList: getGoodsList, onGetListSuccess: (res) => { tableData.value = res.list.map(o => { - o.statusLoading = false + o.bannersLoading = false return o }) total.value = res.totalCount