pull/4/head
张宇 2 years ago
parent 850a5a9838
commit 1d62674b69

@ -21,6 +21,15 @@ export default {
});
},
goodsDel(data) {
return request({
url: "/shop/shopGoods/goodsDel",
method: "POST",
data,
type: "mall",
});
},
classify: {
list(data) {
return request({

@ -21,6 +21,15 @@ export default {
});
},
goodsDel(data) {
return request({
url: "/admin/goods/goodsDel",
method: "POST",
data,
type: 'store'
});
},
classify: {
list(data) {
return request({

@ -48,7 +48,9 @@
style="margin-right: 8px;">下架</wd-button>
<wd-button @click="changeS(item)" v-if="item.status !== 1" size="small"
style="margin-right: 8px;">上架</wd-button>
<wd-button @click="utils.toUrl('/mall/goods/edit?id=' + item.id)" size="small">编辑</wd-button>
<wd-button style="margin-right: 8px;" @click="utils.toUrl('/mall/goods/edit?id=' + item.id)"
size="small">编辑</wd-button>
<wd-button type="error" @click="delGoods(item)" size="small">删除</wd-button>
</view>
</template>
</wd-card>
@ -65,6 +67,7 @@
</div>
<wd-toast />
<wd-message-box></wd-message-box>
</view>
</template>
@ -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 => {

@ -49,9 +49,7 @@
<wd-swipe-action class="rounded-xl overflow-hidden mb-3 ">
<view class="couponCart relative " style="background-color: #fff;
background-image: linear-gradient(135deg,#ff552d 10%,#0000 0,#0000 50%,#fe4b26 0,#ff702c 60%,#0000 0,#0000);
background-size: 9.09px 9.09px;">
<view class="couponCart relative bg-red-700">
<view class="w-[76%] bg-red-600 absolute top-0 bottom-0 left-0" style="z-index: 0;"></view>
@ -122,9 +120,9 @@
</view>
<view class="mt-4 text-white flex items-center justify-center absolute top-0 right-[24%] ">
<view class="mt-4 text-white flex items-center justify-center absolute top-0 right-0">
<view class="bg-red-700 px-4 py-2 font-bold text-[13px] rounded-l-full " :round="false"
<view class="bg-red-600 px-4 py-2 font-bold text-[13px] rounded-l-full " :round="false"
size="small">
<span v-if="coupon.limit_type == 1"></span>
<span v-if="coupon.limit_type == 2"></span>

@ -19,7 +19,7 @@
</view>
<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 }">
<div>
<div v-for="item of list" class="goods">
@ -48,7 +48,9 @@
style="margin-right: 8px;">下架</wd-button>
<wd-button @click="changeS(item)" v-if="item.status !== 1" size="small"
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>
</template>
</wd-card>
@ -65,6 +67,7 @@
</div>
<wd-toast />
<wd-message-box></wd-message-box>
</view>
</template>
@ -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,

@ -20,7 +20,7 @@
</wd-form-item>
<wd-form-item label="等级名称" prop="name">
<wd-input v-model="dataForm.name" placeholder="请输入分类名称"></wd-input>
<wd-input v-model="dataForm.name" placeholder="请输入等级名称"></wd-input>
</wd-form-item>
<wd-form-item label="升级条件" prop="money">
<wd-input placeholder="请输入内容" v-model.number="dataForm.money" use-prefix-slot use-suffix-slot>

Loading…
Cancel
Save