|
|
|
@ -19,7 +19,7 @@
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="goodsBox p-2">
|
|
|
|
<div class="goodsBox p-2">
|
|
|
|
<yList height="78vh" ref="yListRef" :apiObj="goods.list" :params="{ ...params, classify_id }">
|
|
|
|
<yList height="78vh" ref="yListRef" :apiObj="goodsApi.list" :params="{ ...params, classify_id }">
|
|
|
|
<template #default="{ list }">
|
|
|
|
<template #default="{ list }">
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div v-for="item of list" class="goods">
|
|
|
|
<div v-for="item of list" class="goods">
|
|
|
|
@ -48,7 +48,9 @@
|
|
|
|
style="margin-right: 8px;">下架</wd-button>
|
|
|
|
style="margin-right: 8px;">下架</wd-button>
|
|
|
|
<wd-button @click="changeS(item)" v-if="item.status !== 1" size="small"
|
|
|
|
<wd-button @click="changeS(item)" v-if="item.status !== 1" size="small"
|
|
|
|
style="margin-right: 8px;">上架</wd-button>
|
|
|
|
style="margin-right: 8px;">上架</wd-button>
|
|
|
|
<wd-button @click="utils.toUrl('/store/goods/edit?id=' + item.id)" size="small">编辑</wd-button>
|
|
|
|
<wd-button style="margin-right: 8px;" @click="utils.toUrl('/store/goods/edit?id=' + item.id)"
|
|
|
|
|
|
|
|
size="small">编辑</wd-button>
|
|
|
|
|
|
|
|
<wd-button type="error" @click="delGoods(item)" size="small">删除</wd-button>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</wd-card>
|
|
|
|
</wd-card>
|
|
|
|
@ -65,6 +67,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<wd-toast />
|
|
|
|
<wd-toast />
|
|
|
|
|
|
|
|
<wd-message-box></wd-message-box>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
@ -72,8 +75,11 @@
|
|
|
|
import { ref } from 'vue'
|
|
|
|
import { ref } from 'vue'
|
|
|
|
import { useToast } from '@/uni_modules/wot-design-uni'
|
|
|
|
import { useToast } from '@/uni_modules/wot-design-uni'
|
|
|
|
import yList from "/components/yList/index.vue"
|
|
|
|
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 utils from '@/utils/utils.js'
|
|
|
|
|
|
|
|
import { useMessage } from '@/uni_modules/wot-design-uni';
|
|
|
|
|
|
|
|
import { useApi } from "@/hooks/useApi.js"
|
|
|
|
|
|
|
|
const message = useMessage();
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
onLoad,
|
|
|
|
onLoad,
|
|
|
|
@ -132,8 +138,10 @@ function changeSearchType({ item, index }) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const changeS = (row) => {
|
|
|
|
const changeS = async (row) => {
|
|
|
|
goods.goodsEditAttribute({
|
|
|
|
const { fetchData } = await useApi(goodsApi.goodsEditAttribute)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fetchData({
|
|
|
|
id: row.id,
|
|
|
|
id: row.id,
|
|
|
|
value: [1, 0][row.status],
|
|
|
|
value: [1, 0][row.status],
|
|
|
|
type: "status"
|
|
|
|
type: "status"
|
|
|
|
@ -143,15 +151,41 @@ const changeS = (row) => {
|
|
|
|
toast.success('操作成功')
|
|
|
|
toast.success('操作成功')
|
|
|
|
row.status = [1, 0][row.status]
|
|
|
|
row.status = [1, 0][row.status]
|
|
|
|
} else {
|
|
|
|
} 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 classifyList = ref([])
|
|
|
|
const getClassify = () => {
|
|
|
|
const getClassify = () => {
|
|
|
|
goods.classify.list().then(res => {
|
|
|
|
goodsApi.classify.list().then(res => {
|
|
|
|
classifyList.value = res.data
|
|
|
|
classifyList.value = res.data
|
|
|
|
classifyList.value.unshift({
|
|
|
|
classifyList.value.unshift({
|
|
|
|
id: 0,
|
|
|
|
id: 0,
|
|
|
|
|