diff --git a/api/mall/goods.js b/api/mall/goods.js index b715f1b..543b7c5 100644 --- a/api/mall/goods.js +++ b/api/mall/goods.js @@ -21,6 +21,15 @@ export default { }); }, + goodsDel(data) { + return request({ + url: "/shop/shopGoods/goodsDel", + method: "POST", + data, + type: "mall", + }); + }, + classify: { list(data) { return request({ diff --git a/api/store/goods.js b/api/store/goods.js index f003915..1bcd5a4 100644 --- a/api/store/goods.js +++ b/api/store/goods.js @@ -21,6 +21,15 @@ export default { }); }, + goodsDel(data) { + return request({ + url: "/admin/goods/goodsDel", + method: "POST", + data, + type: 'store' + }); + }, + classify: { list(data) { return request({ diff --git a/mall/goods/index.vue b/mall/goods/index.vue index 21ba325..75bf1b6 100644 --- a/mall/goods/index.vue +++ b/mall/goods/index.vue @@ -48,7 +48,9 @@ style="margin-right: 8px;">下架 上架 - 编辑 + 编辑 + 删除 @@ -65,6 +67,7 @@ + @@ -74,6 +77,8 @@ import { useToast } from '@/uni_modules/wot-design-uni' import yList from "/components/yList/index.vue" import goods from '@/api/mall/goods.js' import utils from '@/utils/utils.js' +import { useMessage } from '@/uni_modules/wot-design-uni'; +import { useApi } from "@/hooks/useApi.js" import { onLoad, @@ -81,6 +86,7 @@ import { } from "@dcloudio/uni-app"; const toast = useToast() +const message = useMessage(); const classify_id = ref(0) @@ -149,6 +155,31 @@ const changeS = (row) => { }) } +const delGoods = (row) => { + message + .confirm({ + title: '删除商品', + }) + .then(async (resp) => { + const { fetchData } = await useApi(goods.goodsDel) + + fetchData({ + id: row.id, + }).then(res => { + if (res.code == 0) { + toast.success('操作成功') + search({ value: params.value.keywords }) + } else { + toast.error('出错了') + } + + }) + }) + .catch((error) => { + console.log(error); + }); +} + const classifyList = ref([]) const getClassify = () => { goods.classify.list().then(res => { diff --git a/store/coupon/index.vue b/store/coupon/index.vue index 59edcb9..c9474d3 100644 --- a/store/coupon/index.vue +++ b/store/coupon/index.vue @@ -49,9 +49,7 @@ - + @@ -122,9 +120,9 @@ - + - 不限 每天一次 diff --git a/store/goods/index.vue b/store/goods/index.vue index 37a44bd..2ecd532 100644 --- a/store/goods/index.vue +++ b/store/goods/index.vue @@ -19,7 +19,7 @@
- + @@ -65,6 +67,7 @@
+
@@ -72,8 +75,11 @@ import { ref } from 'vue' import { useToast } from '@/uni_modules/wot-design-uni' import yList from "/components/yList/index.vue" -import goods from '@/api/store/goods.js' +import goodsApi from '@/api/store/goods.js' import utils from '@/utils/utils.js' +import { useMessage } from '@/uni_modules/wot-design-uni'; +import { useApi } from "@/hooks/useApi.js" +const message = useMessage(); import { onLoad, @@ -132,8 +138,10 @@ function changeSearchType({ item, index }) { }) } -const changeS = (row) => { - goods.goodsEditAttribute({ +const changeS = async (row) => { + const { fetchData } = await useApi(goodsApi.goodsEditAttribute) + + fetchData({ id: row.id, value: [1, 0][row.status], type: "status" @@ -143,15 +151,41 @@ const changeS = (row) => { toast.success('操作成功') row.status = [1, 0][row.status] } else { - showNotify({ type: 'error', message: '出错了' }) + toast.error('出错了') } }) } + +const delGoods = (row) => { + message + .confirm({ + title: '删除商品', + }) + .then(async (resp) => { + const { fetchData } = await useApi(goodsApi.goodsDel) + + fetchData({ + id: row.id, + }).then(res => { + if (res.code == 0) { + toast.success('操作成功') + search({ value: params.value.keywords }) + } else { + toast.error('出错了') + } + + }) + }) + .catch((error) => { + console.log(error); + }); +} + const classifyList = ref([]) const getClassify = () => { - goods.classify.list().then(res => { + goodsApi.classify.list().then(res => { classifyList.value = res.data classifyList.value.unshift({ id: 0, diff --git a/store/user/editMember.vue b/store/user/editMember.vue index c7f8c75..41ea3f0 100644 --- a/store/user/editMember.vue +++ b/store/user/editMember.vue @@ -20,7 +20,7 @@ - +