feat: 新增pc端 商品下架功能

master
Yer 2023-05-10 13:51:24 +08:00
parent 724922dddc
commit 1c765f37cf
3 changed files with 26 additions and 5 deletions

View File

@ -7,6 +7,7 @@
alt="" alt=""
/> />
<p v-if="_Title">{{ _Title }}</p> <p v-if="_Title">{{ _Title }}</p>
<slot></slot>
</div> </div>
</template> </template>

View File

@ -12,7 +12,7 @@
{{ item.name }} {{ item.name }}
</BreadcrumbItem> </BreadcrumbItem>
</Breadcrumb> </Breadcrumb>
<div class="store-collect"> <div class="store-collect" v-if="!takeDownSale">
<span class="mr_10" v-if="goodsMsg.data"> <span class="mr_10" v-if="goodsMsg.data">
<router-link :to="'Merchant?id=' + goodsMsg.data.storeId">{{ <router-link :to="'Merchant?id=' + goodsMsg.data.storeId">{{
goodsMsg.data.storeName goodsMsg.data.storeName
@ -32,6 +32,12 @@
<!-- 商品详细展示 --> <!-- 商品详细展示 -->
<ShowGoodsDetail v-if="goodsMsg.data" :detail="goodsMsg"></ShowGoodsDetail> <ShowGoodsDetail v-if="goodsMsg.data" :detail="goodsMsg"></ShowGoodsDetail>
<empty _Title='当前商品已下架' v-if="takeDownSale">
<div class="sale-btn">
<Button size="small" class="mr_10" @click="target('/')"></Button>
<Button size="small" @click="target('goodsList')"></Button>
</div>
</empty>
<Spin size="large" fix v-if="isLoading"></Spin> <Spin size="large" fix v-if="isLoading"></Spin>
<BaseFooter></BaseFooter> <BaseFooter></BaseFooter>
</div> </div>
@ -41,6 +47,7 @@
import Search from "@/components/Search"; import Search from "@/components/Search";
import ShopHeader from "@/components/header/ShopHeader"; import ShopHeader from "@/components/header/ShopHeader";
import ShowGoods from "@/components/goodsDetail/ShowGoods"; import ShowGoods from "@/components/goodsDetail/ShowGoods";
import empty from "@/components/empty/Main";
import ShowGoodsDetail from "@/components/goodsDetail/ShowGoodsDetail"; import ShowGoodsDetail from "@/components/goodsDetail/ShowGoodsDetail";
import { goodsSkuDetail } from "@/api/goods"; import { goodsSkuDetail } from "@/api/goods";
import { import {
@ -68,11 +75,16 @@ export default {
categoryBar: [], // categoryBar: [], //
storeCollected: false, // storeCollected: false, //
storeMsg: {}, // storeMsg: {}, //
takeDownSale:false, //
}; };
}, },
methods: { methods: {
//
target(url){
this.$router.push({path: url})
},
// //
targetClickSku (val) { targetClickSku (val) {
this.getGoodsDetail(val); this.getGoodsDetail(val);
@ -139,11 +151,14 @@ export default {
} }
} else { } else {
this.$Message.error(res.message); this.$Message.error(res.message);
this.$router.push("/"); this.isLoading = false
} }
}) })
.catch((e) => { .catch((e) => {
this.$router.push("/"); this.isLoading = false
if(e.code === 11001){
this.takeDownSale = true
}
}); });
}, },
goGoodsList (currIndex) { goGoodsList (currIndex) {
@ -179,6 +194,7 @@ export default {
ShopHeader, ShopHeader,
ShowGoods, ShowGoods,
ShowGoodsDetail, ShowGoodsDetail,
empty
}, },
}; };
</script> </script>
@ -209,4 +225,8 @@ export default {
} }
} }
} }
.sale-btn{
margin:10px 0
}
</style> </style>

View File

@ -160,7 +160,7 @@ service.interceptors.response.use(
Message.error(errorData.message || _message); Message.error(errorData.message || _message);
} }
} }
return Promise.reject(error); return Promise.reject(errorData);
} }
); );