feat: 新增营销优惠券管理模块
Former-commit-id: 4f09599f46bfa63c1c7be10b799ae72d52c30435
This commit is contained in:
@@ -41,34 +41,35 @@ import { ElCascaderPanel, ElMessage } from 'element-plus';
|
||||
import { CaretRight } from '@element-plus/icons-vue';
|
||||
|
||||
// API 引用
|
||||
import { listCascadeCategories } from '@/api/pms/category';
|
||||
import { listCategoryOptions } from '@/api/pms/category';
|
||||
import { computed } from '@vue/reactivity';
|
||||
import { Option } from '@/types/common';
|
||||
|
||||
const emit = defineEmits(['next', 'update:modelValue']);
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
default: () => {}
|
||||
}
|
||||
});
|
||||
|
||||
const goodsInfo: any = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value) => {
|
||||
set: value => {
|
||||
emit('update:modelValue', value);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
const state = reactive({
|
||||
categoryOptions: [],
|
||||
pathLabels: [],
|
||||
categoryOptions: [] as Option[],
|
||||
pathLabels: []
|
||||
});
|
||||
|
||||
const { categoryOptions, pathLabels } = toRefs(state);
|
||||
|
||||
function loadData() {
|
||||
listCascadeCategories().then((response) => {
|
||||
state.categoryOptions = response.data;
|
||||
listCategoryOptions().then(({ data }) => {
|
||||
state.categoryOptions = data;
|
||||
if (goodsInfo.value.id) {
|
||||
nextTick(() => {
|
||||
handleCategoryChange();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- setup 无法设置组件名称,组件名称keepAlive必须 -->
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'goods',
|
||||
name: 'goods'
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -16,12 +16,13 @@ import {
|
||||
Edit,
|
||||
Refresh,
|
||||
Delete,
|
||||
View,
|
||||
View
|
||||
} from '@element-plus/icons-vue';
|
||||
import { listSpuPages, deleteSpu } from '@/api/pms/goods';
|
||||
import { listCascadeCategories } from '@/api/pms/category';
|
||||
import { listCategoryOptions } from '@/api/pms/category';
|
||||
import { GoodsItem, GoodsQueryParam } from '@/types/api/pms/goods';
|
||||
import { moneyFormatter } from '@/utils/filter';
|
||||
import { Option } from '@/types/common';
|
||||
|
||||
const dataTableRef = ref(ElTable);
|
||||
const router = useRouter();
|
||||
@@ -38,12 +39,12 @@ const state = reactive({
|
||||
total: 0,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 10
|
||||
} as GoodsQueryParam,
|
||||
goodsList: [] as GoodsItem[],
|
||||
categoryOptions: [],
|
||||
categoryOptions: [] as Option[],
|
||||
goodDetail: undefined,
|
||||
dialogVisible: false,
|
||||
dialogVisible: false
|
||||
});
|
||||
|
||||
const {
|
||||
@@ -54,7 +55,7 @@ const {
|
||||
categoryOptions,
|
||||
goodDetail,
|
||||
total,
|
||||
dialogVisible,
|
||||
dialogVisible
|
||||
} = toRefs(state);
|
||||
|
||||
function handleQuery() {
|
||||
@@ -71,7 +72,7 @@ function resetQuery() {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
categoryId: undefined,
|
||||
categoryId: undefined
|
||||
};
|
||||
handleQuery();
|
||||
}
|
||||
@@ -88,7 +89,7 @@ function handleAdd() {
|
||||
function handleUpdate(row: any) {
|
||||
router.push({
|
||||
path: 'goods-detail',
|
||||
query: { goodsId: row.id, categoryId: row.categoryId },
|
||||
query: { goodsId: row.id, categoryId: row.categoryId }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,7 +98,7 @@ function handleDelete(row: any) {
|
||||
ElMessageBox.confirm('是否确认删除选中的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(function () {
|
||||
return deleteSpu(ids);
|
||||
@@ -119,8 +120,8 @@ function handleSelectionChange(selection: any) {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
listCascadeCategories({}).then((response) => {
|
||||
state.categoryOptions = ref(response.data);
|
||||
listCategoryOptions().then(({ data }) => {
|
||||
categoryOptions.value = data;
|
||||
});
|
||||
handleQuery();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user