2024-08-07 09:55:31 +00:00
|
|
|
<template>
|
2024-08-13 10:03:15 +00:00
|
|
|
<div style="height: calc(100vh - 200px)">
|
2024-08-09 10:04:10 +00:00
|
|
|
<obj-table-plus
|
|
|
|
ref="oTable"
|
2024-08-13 10:03:15 +00:00
|
|
|
style="height: 100%"
|
2024-08-09 10:04:10 +00:00
|
|
|
:tableCols="tableCols"
|
2024-08-13 10:03:15 +00:00
|
|
|
:tableProp="tableProp"
|
2024-08-09 10:04:10 +00:00
|
|
|
@query="queryList"
|
|
|
|
v-model="dataList"
|
2024-08-13 10:03:15 +00:00
|
|
|
:tableEvent="tableEvent"
|
2024-08-09 10:04:10 +00:00
|
|
|
>
|
|
|
|
<template slot="tableTop">
|
|
|
|
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
|
|
|
<el-form-item label="平台分类">
|
|
|
|
<el-select v-model="formInline.region" placeholder="活动区域">
|
|
|
|
<el-option label="区域一" value="shanghai"></el-option>
|
|
|
|
<el-option label="区域二" value="beijing"></el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="商户分类">
|
|
|
|
<el-select v-model="formInline.region" placeholder="活动区域">
|
|
|
|
<el-option label="区域一" value="shanghai"></el-option>
|
|
|
|
<el-option label="区域二" value="beijing"></el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="商品搜索">
|
|
|
|
<el-input
|
|
|
|
v-model="formInline.user"
|
|
|
|
placeholder="商品搜索"
|
|
|
|
></el-input>
|
|
|
|
</el-form-item>
|
2024-08-07 09:55:31 +00:00
|
|
|
|
2024-08-09 10:04:10 +00:00
|
|
|
<el-form-item>
|
|
|
|
<el-button type="primary" @click="$refs.oTable.reload()"
|
|
|
|
>查询</el-button
|
|
|
|
>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
2024-08-13 02:47:05 +00:00
|
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
|
<el-tab-pane label="在售" name="在售"></el-tab-pane>
|
2024-08-09 10:04:10 +00:00
|
|
|
<el-tab-pane label="仓库中" name="仓库中"></el-tab-pane>
|
2024-08-13 02:47:05 +00:00
|
|
|
<el-tab-pane label="折扣" name="折扣"></el-tab-pane>
|
2024-08-09 10:04:10 +00:00
|
|
|
</el-tabs>
|
|
|
|
<div class="mb-2">
|
|
|
|
<el-button type="primary" size="small" @click="addProduct"
|
|
|
|
>添加商品</el-button
|
|
|
|
>
|
2024-08-13 10:03:15 +00:00
|
|
|
<el-button
|
|
|
|
:disabled="selectList.length <= 0"
|
|
|
|
type="danger"
|
|
|
|
size="small"
|
|
|
|
@click="deleteProduct"
|
|
|
|
>批量删除</el-button
|
|
|
|
>
|
2024-08-09 10:04:10 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</obj-table-plus>
|
2024-08-13 10:03:15 +00:00
|
|
|
<!-- 添加或编辑 -->
|
2024-08-09 10:04:10 +00:00
|
|
|
<add-or-update ref="addOrUpdate"></add-or-update>
|
2024-08-13 10:03:15 +00:00
|
|
|
<!-- 改价格 -->
|
|
|
|
<AddPrice ref="AddPrice" @queryList="$refs.oTable.reload()"></AddPrice>
|
2024-08-14 09:52:12 +00:00
|
|
|
<!-- 改库存 -->
|
|
|
|
<addStock ref="addStock" @queryList="$refs.oTable.reload()"></addStock>
|
|
|
|
<!-- 打折扣 -->
|
|
|
|
<AddDiscount
|
|
|
|
ref="AddDiscount"
|
|
|
|
@queryList="$refs.oTable.reload()"
|
|
|
|
></AddDiscount>
|
2024-08-09 10:04:10 +00:00
|
|
|
</div>
|
2024-08-07 09:55:31 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-08-14 09:52:12 +00:00
|
|
|
import AddDiscount from "./popup/add-discount.vue";
|
2024-08-13 10:03:15 +00:00
|
|
|
import AddPrice from "./popup/add-price.vue";
|
2024-08-09 10:04:10 +00:00
|
|
|
import AddOrUpdate from "./popup/add-or-update.vue";
|
2024-08-14 09:52:12 +00:00
|
|
|
import addStock from "./popup/add-stock.vue";
|
2024-08-07 09:55:31 +00:00
|
|
|
export default {
|
2024-08-14 09:52:12 +00:00
|
|
|
components: { AddOrUpdate, AddPrice, addStock, AddDiscount },
|
2024-08-09 10:04:10 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
activeName: "出售中",
|
|
|
|
dataList: [],
|
|
|
|
formInline: {
|
|
|
|
user: "",
|
|
|
|
region: "",
|
|
|
|
},
|
2024-08-13 10:03:15 +00:00
|
|
|
tableProp: {
|
|
|
|
"auto-resize": true,
|
|
|
|
border: true,
|
|
|
|
height: "auto",
|
|
|
|
"row-id": "id",
|
|
|
|
},
|
2024-08-13 02:47:05 +00:00
|
|
|
productFilterType: "SALE",
|
2024-08-13 10:03:15 +00:00
|
|
|
selectList: [],
|
2024-08-09 10:04:10 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
addProduct() {
|
|
|
|
this.$refs.addOrUpdate.toggle().add();
|
2024-08-07 09:55:31 +00:00
|
|
|
},
|
2024-08-13 10:03:15 +00:00
|
|
|
deleteProduct() {
|
|
|
|
console.log(this.selectList);
|
|
|
|
let integers = this.selectList.map((item) => {
|
|
|
|
return item.id;
|
|
|
|
});
|
|
|
|
this.$confirm("此操作将删除该商品, 是否继续?", "提示", {
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
type: "warning",
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
this.$api.mer_admin.BatchDeleteProducts(integers).then((res) => {
|
|
|
|
this.$refs.oTable.reload();
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
|
|
|
type: "info",
|
|
|
|
message: "已取消删除",
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
2024-08-09 10:04:10 +00:00
|
|
|
queryList(pageNo, pageSize) {
|
|
|
|
this.$api.mer_admin
|
|
|
|
.getProductPage({
|
|
|
|
p: {
|
|
|
|
pageNumber: pageNo,
|
|
|
|
pageSize: pageSize,
|
|
|
|
},
|
2024-08-13 02:47:05 +00:00
|
|
|
productFilterType: this.productFilterType,
|
|
|
|
merchantId: JSON.parse(sessionStorage.getItem("userInfo")).merchantId,
|
|
|
|
shopId: JSON.parse(sessionStorage.getItem("userInfo")).shopId,
|
|
|
|
productQuerySortParam: [],
|
2024-08-09 10:04:10 +00:00
|
|
|
})
|
|
|
|
.then((res) => {
|
|
|
|
console.log(res);
|
|
|
|
this.$refs.oTable.complete(
|
|
|
|
res.data.data.data,
|
|
|
|
Number(res.data.data.total)
|
|
|
|
);
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.$refs.oTable.complete(false);
|
|
|
|
});
|
2024-08-07 09:55:31 +00:00
|
|
|
},
|
2024-08-13 02:47:05 +00:00
|
|
|
handleClick() {
|
|
|
|
switch (this.activeName) {
|
|
|
|
case "在售":
|
|
|
|
this.productFilterType = "SALE";
|
|
|
|
break;
|
|
|
|
case "仓库中":
|
|
|
|
this.productFilterType = "WAREHOUSE";
|
|
|
|
break;
|
|
|
|
case "折扣":
|
|
|
|
this.productFilterType = "DISCOUNT";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
this.$refs.oTable.reload();
|
|
|
|
},
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
tableCols() {
|
|
|
|
return [
|
2024-08-13 10:03:15 +00:00
|
|
|
{ type: "checkbox", width: "60px", fixed: "left" },
|
|
|
|
// { type: "seq", width: "60px", align: "center", title: "序号" },
|
2024-08-09 10:04:10 +00:00
|
|
|
{
|
|
|
|
title: "商品图",
|
2024-08-13 10:03:15 +00:00
|
|
|
field: "productPhotoList",
|
|
|
|
align: "center",
|
|
|
|
width: "160px",
|
|
|
|
type: "jsx",
|
|
|
|
render: ({ row }) => {
|
|
|
|
if (row.productPhotoList.length > 0) {
|
|
|
|
return <el-image src={row.productPhotoList[0].url}></el-image>;
|
|
|
|
} else {
|
|
|
|
return <span>暂无商品图</span>;
|
|
|
|
}
|
|
|
|
},
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "商品名称",
|
2024-08-13 10:03:15 +00:00
|
|
|
align: "center",
|
|
|
|
field: "name",
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "商品售价",
|
2024-08-13 10:03:15 +00:00
|
|
|
align: "center",
|
|
|
|
field: "minSalePrice",
|
|
|
|
type: "jsx",
|
|
|
|
render: ({ row }) => {
|
|
|
|
if (row.minSalePrice == row.maxSalePrice) {
|
|
|
|
return <span>¥{row.minSalePrice}</span>;
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<span>
|
|
|
|
¥{row.minSalePrice}~¥{row.maxSalePrice}
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
2024-08-14 09:52:12 +00:00
|
|
|
{
|
|
|
|
title: "折扣",
|
|
|
|
align: "center",
|
|
|
|
field: "discountActivity",
|
|
|
|
type: "jsx",
|
|
|
|
render: ({ row }) => {
|
|
|
|
if (row.discountActivity) {
|
|
|
|
return <span>{row.discountActivity.ruleObject.discount}折</span>;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2024-08-09 10:04:10 +00:00
|
|
|
{
|
|
|
|
title: "销量",
|
2024-08-13 10:03:15 +00:00
|
|
|
align: "center",
|
|
|
|
field: "saleNum",
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "库存",
|
2024-08-13 10:03:15 +00:00
|
|
|
align: "center",
|
|
|
|
field: "stockNum",
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "状态",
|
2024-08-13 10:03:15 +00:00
|
|
|
// fixed: "right",
|
|
|
|
type: "jsx",
|
|
|
|
align: "center",
|
|
|
|
"title-suffix": {
|
|
|
|
message: "点击上架/下架切换责任书状态",
|
|
|
|
icon: "vxe-icon-question-circle-fill",
|
|
|
|
},
|
|
|
|
render: ({ row }) => {
|
|
|
|
let Enable = () => {
|
|
|
|
let data = {
|
|
|
|
ids: [row.id],
|
|
|
|
status: "UP",
|
|
|
|
};
|
|
|
|
if (row.status == "UP") {
|
|
|
|
data.status = "DOWN";
|
|
|
|
} else {
|
|
|
|
data.status = "UP";
|
|
|
|
}
|
|
|
|
this.$api.mer_admin.putOnShelvesProducts(data).then((res) => {
|
|
|
|
console.log(res);
|
|
|
|
this.$refs.oTable.reload();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
return (
|
|
|
|
<el-popconfirm
|
|
|
|
title={
|
|
|
|
row.status == "DOWN"
|
|
|
|
? "当前为下架状态,是否更改为上架状态?"
|
|
|
|
: "当前为上架状态,是否更改为下架状态?"
|
|
|
|
}
|
|
|
|
confirmButtonText={
|
|
|
|
row.status == "DOWN" ? "确认上架" : "确认下架"
|
|
|
|
}
|
|
|
|
onConfirm={Enable}
|
|
|
|
>
|
|
|
|
<el-button
|
|
|
|
slot="reference"
|
|
|
|
size="mini"
|
|
|
|
plain
|
|
|
|
type={row.status == "DOWN" ? "info" : "success"}
|
|
|
|
>
|
|
|
|
{row.status == "DOWN" ? "已下架" : "上架中"}
|
|
|
|
</el-button>
|
|
|
|
</el-popconfirm>
|
|
|
|
);
|
|
|
|
},
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "操作",
|
2024-08-13 10:03:15 +00:00
|
|
|
fixed: "right",
|
|
|
|
type: "jsx",
|
|
|
|
align: "center",
|
|
|
|
width: "340px",
|
|
|
|
render: ({ row }) => {
|
|
|
|
const grant = () => {};
|
|
|
|
let edit = () => {};
|
|
|
|
let priceAdjustment = () => {
|
|
|
|
console.log(row);
|
|
|
|
this.$refs.AddPrice.toggle(row).update();
|
|
|
|
};
|
2024-08-14 09:52:12 +00:00
|
|
|
let changeInventory = () => {
|
|
|
|
this.$refs.addStock.toggle(row).update();
|
|
|
|
};
|
|
|
|
let setDiscounts = () => {
|
|
|
|
this.$refs.AddDiscount.toggle(row).update();
|
|
|
|
};
|
2024-08-13 10:03:15 +00:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
disabled={row.status != "DOWN"}
|
|
|
|
type="primary"
|
|
|
|
onClick={edit}
|
|
|
|
>
|
|
|
|
编辑
|
|
|
|
</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
disabled={row.status != "DOWN"}
|
|
|
|
type="primary"
|
|
|
|
onClick={priceAdjustment}
|
|
|
|
>
|
|
|
|
改价
|
|
|
|
</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
disabled={row.status != "DOWN"}
|
|
|
|
type="primary"
|
2024-08-14 09:52:12 +00:00
|
|
|
onClick={changeInventory}
|
2024-08-13 10:03:15 +00:00
|
|
|
>
|
|
|
|
改库存
|
|
|
|
</el-button>
|
|
|
|
<el-button
|
|
|
|
size="mini"
|
|
|
|
disabled={row.status != "DOWN"}
|
|
|
|
type="primary"
|
2024-08-14 09:52:12 +00:00
|
|
|
onClick={setDiscounts}
|
2024-08-13 10:03:15 +00:00
|
|
|
>
|
|
|
|
设置折扣
|
|
|
|
</el-button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
},
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
|
|
|
];
|
2024-08-07 09:55:31 +00:00
|
|
|
},
|
2024-08-13 10:03:15 +00:00
|
|
|
tableEvent() {
|
|
|
|
return {
|
|
|
|
"checkbox-all": ({ records, reserves }) => {
|
|
|
|
this.selectList = [...records, ...reserves];
|
|
|
|
},
|
|
|
|
"checkbox-change": ({ records, reserves }) => {
|
|
|
|
this.selectList = [...records, ...reserves];
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
2024-08-09 10:04:10 +00:00
|
|
|
},
|
|
|
|
};
|
2024-08-07 09:55:31 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped></style>
|