变更
This commit is contained in:
parent
ba00059e71
commit
73e7049b71
2657
package-lock.json
generated
2657
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -3,8 +3,8 @@
|
|||
<div>
|
||||
<el-input style="width: 200px; height: 30px; margin-right: 10px;" suffix-icon="Search" placeholder="请输入商品名称" v-model="username"></el-input>
|
||||
<el-form-item label="商品类型" style="width: 200px; margin-right: 10px;display: inline-block">
|
||||
<el-select v-model="resources" placeholder="请选择">
|
||||
<el-option label="材料包" value="材料包" />
|
||||
<el-select v-model="types" placeholder="请选择">type
|
||||
<el-option label="材料包" value="材料包" />type
|
||||
<el-option label="手持物" value="手持物" />
|
||||
<el-option label="头饰" value="头饰" />
|
||||
<el-option label="定制" value="定制" />
|
||||
|
@ -43,14 +43,14 @@
|
|||
<el-table-column label="商品编号" width="80">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<span style="align-items: center">{{ scope.row.selectedItems }}</span>
|
||||
<span style="align-items: center">{{ scope.row.id }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品图片">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<img :src="scope.row.img" alt="" style="height: 50px;">
|
||||
<img :src="scope.row.goodImg" alt="" style="height: 50px;">
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -71,21 +71,21 @@
|
|||
<el-table-column label="商品类型">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<span style="margin-left: 10px">{{ scope.row.resource }}</span>
|
||||
<span style="margin-left: 10px">{{ scope.row.type }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品数量">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<span style="margin-left: 10px">{{ scope.row.quantity }}</span>
|
||||
<span style="margin-left: 10px">{{ scope.row.inventory }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品状态">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<span style="margin-left: 10px">{{ scope.row.state }}</span>
|
||||
<span style="margin-left: 10px">{{ scope.row.isShelvesisShelves }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -136,11 +136,11 @@
|
|||
<el-dialog v-model="detailDialogVisible" title="商品详情">
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="商品编号">
|
||||
<el-input v-model="selectedProduct.selectedItems" disabled></el-input>
|
||||
<el-input v-model="selectedProduct.id" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片">
|
||||
<div v-if="selectedProduct.img">
|
||||
<img :src="selectedProduct.img" alt="类别图标" class="thumbnail" style="width: 100px; height: 100px;"/>
|
||||
<div v-if="selectedProduct.goodImg">
|
||||
<img :src="selectedProduct.goodImg" alt="类别图标" class="thumbnail" style="width: 100px; height: 100px;"/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称">
|
||||
|
@ -150,7 +150,7 @@
|
|||
<el-input v-model="selectedProduct.price" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品类型">
|
||||
<el-select v-model="selectedProduct.resource" placeholder="请选择" disabled>
|
||||
<el-select v-model="selectedProduct.type" placeholder="请选择" disabled>
|
||||
<el-option label="材料包" value="材料包" />
|
||||
<el-option label="手持物" value="手持物" />
|
||||
<el-option label="头饰" value="头饰" />
|
||||
|
@ -159,10 +159,10 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品数量">
|
||||
<el-input v-model="selectedProduct.quantity" disabled></el-input>
|
||||
<el-input v-model="selectedProduct.inventory" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品状态">
|
||||
<el-select v-model="selectedProduct.state" placeholder="请选择" disabled>
|
||||
<el-select v-model="selectedProduct.isShelves" placeholder="请选择" disabled>
|
||||
<el-option label="上架" value="上架" />
|
||||
<el-option label="下架" value="下架" />
|
||||
</el-select>
|
||||
|
@ -177,7 +177,7 @@
|
|||
<el-input v-model="selectedProduct.label" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品描述">
|
||||
<el-input type="textarea" v-model="selectedProduct.desc" disabled></el-input>
|
||||
<el-input type="textarea" v-model="selectedProduct.introDetailintroDetail" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
@ -190,7 +190,7 @@
|
|||
<el-dialog v-model="editDialogVisible" title="商品编辑">
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="商品编号">
|
||||
<el-input v-model="editForm.selectedItems"></el-input>
|
||||
<el-input v-model="editForm.id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片">
|
||||
<el-upload action="#" list-type="picture" :auto-upload="false">
|
||||
|
@ -207,7 +207,7 @@
|
|||
<el-input v-model="editForm.price"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品类型">
|
||||
<el-select v-model="editForm.resource" placeholder="请选择">
|
||||
<el-select v-model="editForm.type" placeholder="请选择">
|
||||
<el-option label="材料包" value="材料包" />
|
||||
<el-option label="手持物" value="手持物" />
|
||||
<el-option label="头饰" value="头饰" />
|
||||
|
@ -216,10 +216,10 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品数量">
|
||||
<el-input v-model="editForm.quantity"></el-input>
|
||||
<el-input v-model="editForm.inventory"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品状态">
|
||||
<el-select v-model="editForm.state" disabled>
|
||||
<el-select v-model="editForm.isShelves" disabled>
|
||||
<el-option label="上架" value="上架" />
|
||||
<el-option label="下架" value="下架" />
|
||||
</el-select>
|
||||
|
@ -234,7 +234,7 @@
|
|||
<el-input v-model="editForm.label"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品描述">
|
||||
<el-input type="textarea" v-model="editForm.desc"></el-input>
|
||||
<el-input type="textarea" v-model="editForm.introDetail"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
@ -249,34 +249,35 @@
|
|||
<script setup lang="ts">
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import myAxios from "@/api/myAxios";
|
||||
const pageNum = ref(0);
|
||||
const pageSize = ref(0);
|
||||
const total = ref(0);
|
||||
const selectedItems = ref([]);
|
||||
const id = ref([]);
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
const handleSelectionChange = (row: any) => {
|
||||
selectedItems.value = JSON.parse(JSON.stringify(row));
|
||||
id.value = JSON.parse(JSON.stringify(row));
|
||||
};
|
||||
const username = ref('');
|
||||
const detailDialogVisible = ref(false);
|
||||
const editDialogVisible = ref(false);
|
||||
const resources = ref('');
|
||||
const types = ref('');
|
||||
const Region = ref('');
|
||||
let selectedProduct = ref('');
|
||||
let editForm = ref({
|
||||
selectedItems: '',
|
||||
img: '',
|
||||
id: '',
|
||||
goodImg: '',
|
||||
name: '',
|
||||
price: '',
|
||||
resource: '',
|
||||
quantity: '',
|
||||
state: '',
|
||||
type: '',
|
||||
inventory: '',
|
||||
isShelves: '',
|
||||
attribute:'',
|
||||
region: '',
|
||||
label: '',
|
||||
desc: '',
|
||||
introDetail: '',
|
||||
});
|
||||
const handleView = (index: number, row: any) => {
|
||||
selectedProduct = row;
|
||||
|
@ -289,13 +290,16 @@ const handleRevise = (index: number, row: any) => {
|
|||
};
|
||||
const handleOff = (index: number, row: any) => {
|
||||
if (row.attribute === '上架') {
|
||||
row.state = '上架';
|
||||
row.isShelves = '上架';
|
||||
row.attribute = '下架';
|
||||
} else if (row.attribute === '下架') {
|
||||
row.state = '下架';
|
||||
row.isShelves = '下架';
|
||||
row.attribute = '上架';
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
getTableData()
|
||||
})
|
||||
const handleDelete = (index: number, row: any) => {
|
||||
const confirmDelete = window.confirm('您确定要删除该商品吗?');
|
||||
if (confirmDelete) {
|
||||
|
@ -306,35 +310,40 @@ const handleDelete = (index: number, row: any) => {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
const searchParams: any = ref({})
|
||||
const getTableData = async ()=>{
|
||||
const res = await myAxios.post('/api/goods/update',{...tableData.value})
|
||||
if(res.data.code === 1){
|
||||
tableData.value = res.data.data.records;
|
||||
}else{
|
||||
ElMessage({
|
||||
message:'获取数据失败'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const tableData = ref([
|
||||
{
|
||||
selectedItems: '001',
|
||||
img: 'https://s21.ax1x.com/2024/10/24/pAdzjZ6.png',
|
||||
name: '随便起的',
|
||||
price: '300rmb',
|
||||
resource: '头饰',
|
||||
quantity: '10',
|
||||
state: '上架',
|
||||
region: '是',
|
||||
label: '送礼好物',
|
||||
desc: '描述',
|
||||
attribute:'下架',
|
||||
id: '',
|
||||
goodImg: '',
|
||||
name: '',
|
||||
price: '',
|
||||
type: '',
|
||||
inventory: '',//库存
|
||||
isShelves: '',
|
||||
region: '',
|
||||
label: '',//
|
||||
introDetail: '',//商品详情介绍
|
||||
attribute:'',
|
||||
},
|
||||
]);
|
||||
const list = {
|
||||
region: '',
|
||||
label: [],
|
||||
desc: '',
|
||||
};
|
||||
const reset = () => {
|
||||
username.value = '';
|
||||
resources.value = '';
|
||||
types.value = '';
|
||||
Region.value = '';
|
||||
};
|
||||
const saveEdit = () => {
|
||||
const indexToUpdate = tableData.findIndex(item => item.selectedItems === editForm.value.selectedItems);
|
||||
const indexToUpdate = tableData.findIndex(item => item.id === editForm.value.id);
|
||||
if (indexToUpdate!== -1) {
|
||||
tableData[indexToUpdate] = {
|
||||
...tableData[indexToUpdate],
|
||||
|
|
Loading…
Reference in New Issue
Block a user