@@ -48,7 +48,9 @@
style="margin-right: 8px;">下架
上架
- 编辑
+ 编辑
+ 删除
@@ -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 @@
-
+