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: { classify: {
list(data) { list(data) {
return request({ return request({

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

@ -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('/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> </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>
@ -74,6 +77,8 @@ 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/mall/goods.js' import goods from '@/api/mall/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"
import { import {
onLoad, onLoad,
@ -81,6 +86,7 @@ import {
} from "@dcloudio/uni-app"; } from "@dcloudio/uni-app";
const toast = useToast() const toast = useToast()
const message = useMessage();
const classify_id = ref(0) 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 classifyList = ref([])
const getClassify = () => { const getClassify = () => {
goods.classify.list().then(res => { goods.classify.list().then(res => {

@ -49,9 +49,7 @@
<wd-swipe-action class="rounded-xl overflow-hidden mb-3 "> <wd-swipe-action class="rounded-xl overflow-hidden mb-3 ">
<view class="couponCart relative " style="background-color: #fff; <view class="couponCart relative bg-red-700">
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="w-[76%] bg-red-600 absolute top-0 bottom-0 left-0" style="z-index: 0;"></view> <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>
<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"> size="small">
<span v-if="coupon.limit_type == 1"></span> <span v-if="coupon.limit_type == 1"></span>
<span v-if="coupon.limit_type == 2"></span> <span v-if="coupon.limit_type == 2"></span>

@ -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,

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

Loading…
Cancel
Save