|
|
|
|
@@ -1,16 +1,27 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<template v-if="isA">
|
|
|
|
|
<!-- 搜索 -->
|
|
|
|
|
<page-search ref="searchRef" :search-config="searchConfig" @query-click="handleQueryClick"
|
|
|
|
|
@reset-click="handleResetClick" />
|
|
|
|
|
<page-search
|
|
|
|
|
ref="searchRef"
|
|
|
|
|
:search-config="searchConfig"
|
|
|
|
|
@query-click="handleQueryClick"
|
|
|
|
|
@reset-click="handleResetClick"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 顶部数据 -->
|
|
|
|
|
<Statistics></Statistics>
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick"
|
|
|
|
|
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
|
|
|
|
|
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
|
|
|
|
|
<page-content
|
|
|
|
|
ref="contentRef"
|
|
|
|
|
:content-config="contentConfig"
|
|
|
|
|
@add-click="handleAddClick"
|
|
|
|
|
@edit-click="handleEditClick"
|
|
|
|
|
@export-click="handleExportClick"
|
|
|
|
|
@search-click="handleSearchClick"
|
|
|
|
|
@toolbar-click="handleToolbarClick"
|
|
|
|
|
@operat-click="handleOperatClick"
|
|
|
|
|
@filter-change="handleFilterChange"
|
|
|
|
|
>
|
|
|
|
|
<!-- <template #status="scope">
|
|
|
|
|
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
|
|
|
|
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
|
|
|
|
@@ -23,12 +34,20 @@
|
|
|
|
|
<DictLabel v-model="scope.row[scope.prop]" code="gender" />
|
|
|
|
|
</template>
|
|
|
|
|
<template #shangjia="scope">
|
|
|
|
|
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
|
|
|
|
@click="handleSwitchChange(scope.row)"></el-switch>
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="scope.row[scope.prop]"
|
|
|
|
|
:active-value="1"
|
|
|
|
|
:inactive-value="0"
|
|
|
|
|
@click="handleSwitchChange(scope.row)"
|
|
|
|
|
></el-switch>
|
|
|
|
|
</template>
|
|
|
|
|
<template #mobile="scope">
|
|
|
|
|
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
|
|
|
|
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
|
|
|
|
|
<copy-button
|
|
|
|
|
v-if="scope.row[scope.prop]"
|
|
|
|
|
:text="scope.row[scope.prop]"
|
|
|
|
|
style="margin-left: 2px"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</page-content>
|
|
|
|
|
|
|
|
|
|
@@ -40,7 +59,11 @@
|
|
|
|
|
</page-modal>
|
|
|
|
|
|
|
|
|
|
<!-- 编辑 -->
|
|
|
|
|
<page-modal ref="editModalRef" :modal-config="editModalConfig" @submit-click="handleSubmitClick">
|
|
|
|
|
<page-modal
|
|
|
|
|
ref="editModalRef"
|
|
|
|
|
:modal-config="editModalConfig"
|
|
|
|
|
@submit-click="handleSubmitClick"
|
|
|
|
|
>
|
|
|
|
|
<template #gender="scope">
|
|
|
|
|
<Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" />
|
|
|
|
|
</template>
|
|
|
|
|
@@ -54,22 +77,12 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</MyDialog>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<!-- <page-content ref="contentRef" :content-config="contentConfig2" @operat-click="handleOperatClick">
|
|
|
|
|
<template #status="scope">
|
|
|
|
|
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
|
|
|
|
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</page-content> -->
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import UserAPI from "@/api/product/index";
|
|
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
import { useRouter } from "vue-router";
|
|
|
|
|
import type { IObject, IOperatData } from "@/components/CURD/types";
|
|
|
|
|
import usePage from "@/components/CURD/usePage";
|
|
|
|
|
import addModalConfig from "./indexconfig/add";
|
|
|
|
|
@@ -96,11 +109,11 @@ const {
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
const form = reactive({
|
|
|
|
|
num: '',
|
|
|
|
|
})
|
|
|
|
|
num: "",
|
|
|
|
|
});
|
|
|
|
|
// 新增
|
|
|
|
|
async function handleAddClick() {
|
|
|
|
|
router.push({ name: 'addgoods' });
|
|
|
|
|
router.push({ name: "addgoods" });
|
|
|
|
|
// addModalRef.value?.setModalVisible();
|
|
|
|
|
// 加载上级规格下拉数据源
|
|
|
|
|
// addModalConfig.formItems[2]!.attrs!.data = await UserAPI.getPage({ name: "" });
|
|
|
|
|
@@ -110,35 +123,41 @@ async function handleAddClick() {
|
|
|
|
|
// 上架
|
|
|
|
|
function handleSwitchChange(data: any) {
|
|
|
|
|
let obj = {
|
|
|
|
|
type: data.isGrounding ? 'sku' : 'product',
|
|
|
|
|
type: data.isGrounding ? "sku" : "product",
|
|
|
|
|
id: data.id,
|
|
|
|
|
isSale: data.isSale
|
|
|
|
|
}
|
|
|
|
|
isSale: data.isSale,
|
|
|
|
|
};
|
|
|
|
|
UserAPI.onOff(obj);
|
|
|
|
|
}
|
|
|
|
|
// 编辑
|
|
|
|
|
async function handleEditClick(row: IObject) {
|
|
|
|
|
router.push({ name: 'addgoods', query: { goods_id: row.id } });
|
|
|
|
|
router.push({ name: "addgoods", query: { goods_id: row.id } });
|
|
|
|
|
}
|
|
|
|
|
const myDialogRef = ref(null)
|
|
|
|
|
const myDialogRef = ref(null);
|
|
|
|
|
// 其他工具栏
|
|
|
|
|
function handleToolbarClick(name: string) {
|
|
|
|
|
console.log(name);
|
|
|
|
|
if (name === "custom1") {
|
|
|
|
|
// ElMessage.success("点击了自定义1按钮");
|
|
|
|
|
myDialogRef.value.open()
|
|
|
|
|
myDialogRef.value.open();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function confirm() {
|
|
|
|
|
console.log(form, 'debug')
|
|
|
|
|
console.log(form, "debug");
|
|
|
|
|
}
|
|
|
|
|
// 商品规格
|
|
|
|
|
function typeFilter(item: any) {
|
|
|
|
|
if (item == 'single') { return '单规格' }
|
|
|
|
|
else if (item == 'sku') { return '多规格' }
|
|
|
|
|
else if (item == 'package') { return '套餐商品' }
|
|
|
|
|
else if (item == 'weight') { return '称重商品' }
|
|
|
|
|
else if (item == 'coupon') { return '团购券' }
|
|
|
|
|
if (item == "single") {
|
|
|
|
|
return "单规格";
|
|
|
|
|
} else if (item == "sku") {
|
|
|
|
|
return "多规格";
|
|
|
|
|
} else if (item == "package") {
|
|
|
|
|
return "套餐商品";
|
|
|
|
|
} else if (item == "weight") {
|
|
|
|
|
return "称重商品";
|
|
|
|
|
} else if (item == "coupon") {
|
|
|
|
|
return "团购券";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 其他操作列
|
|
|
|
|
async function handleOperatClick(data: IOperatData) {
|
|
|
|
|
@@ -175,6 +194,11 @@ async function handleOperatClick(data: IOperatData) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 切换示例
|
|
|
|
|
const isA = ref(true);
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
console.log(route.query);
|
|
|
|
|
if (route.query.id) {
|
|
|
|
|
contentRef.value?.fetchPageData({ id: route.query.id });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|