|
|
@ -37,21 +37,12 @@
|
|
|
|
/* 列表查询 */
|
|
|
|
/* 列表查询 */
|
|
|
|
const state = reactive({
|
|
|
|
const state = reactive({
|
|
|
|
condition: {
|
|
|
|
condition: {
|
|
|
|
name: null,
|
|
|
|
activityId: route.params.id,
|
|
|
|
status: null,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
watch(
|
|
|
|
|
|
|
|
() => state.condition,
|
|
|
|
|
|
|
|
(value) => {
|
|
|
|
|
|
|
|
store.commit('limitTime/setCondition', _.cloneDeep(value));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ immediate: true, deep: true }
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
const handleReset = () => {
|
|
|
|
const handleReset = () => {
|
|
|
|
state.condition = {
|
|
|
|
state.condition = {
|
|
|
|
name: null,
|
|
|
|
activityId: route.params.id,
|
|
|
|
status: null,
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const handleSearch = async () => {
|
|
|
|
const handleSearch = async () => {
|
|
|
@ -59,13 +50,26 @@
|
|
|
|
await store.dispatch('limitTime/search');
|
|
|
|
await store.dispatch('limitTime/search');
|
|
|
|
loading.value = false;
|
|
|
|
loading.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
onActivated(() => {
|
|
|
|
|
|
|
|
if (state.condition.activityId !== route.params.id) {
|
|
|
|
|
|
|
|
handleReset();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
|
|
() => state.condition,
|
|
|
|
|
|
|
|
(value) => {
|
|
|
|
|
|
|
|
store.commit('limitTime/setCondition', _.cloneDeep(value));
|
|
|
|
|
|
|
|
handleSearch();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ immediate: true, deep: true }
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/* 操作 */
|
|
|
|
/* 操作 */
|
|
|
|
// 新增
|
|
|
|
// 新增
|
|
|
|
const handleCreate = () => {
|
|
|
|
const handleCreate = () => {
|
|
|
|
store.commit('limitTime/setList', [
|
|
|
|
store.commit('limitTime/setList', [
|
|
|
|
...unref(list),
|
|
|
|
...unref(list),
|
|
|
|
{ edit: true, name: null, startTime: null, endTime: null, enabled: true },
|
|
|
|
{ edit: true, timeName: null, startTime: null, endTime: null, isEnable: true, activityId: route.params.id },
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 设置商品
|
|
|
|
// 设置商品
|
|
|
@ -73,11 +77,18 @@
|
|
|
|
router.push({ name: 'UpdateLimitProduct', params: { id: route.params.id } });
|
|
|
|
router.push({ name: 'UpdateLimitProduct', params: { id: route.params.id } });
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 启用
|
|
|
|
// 启用
|
|
|
|
const handleEnable = (row, value) => {
|
|
|
|
const handleEnable = async (row) => {
|
|
|
|
row.enabled = value;
|
|
|
|
if (row.id) {
|
|
|
|
|
|
|
|
loading.value = true;
|
|
|
|
|
|
|
|
await store.dispatch('limitTime/enable', row);
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 编辑
|
|
|
|
// 编辑
|
|
|
|
const handleUpdate = (row) => {
|
|
|
|
const handleUpdate = (row) => {
|
|
|
|
|
|
|
|
if (row.edit) {
|
|
|
|
|
|
|
|
store.dispatch('limitTime/save', row);
|
|
|
|
|
|
|
|
}
|
|
|
|
row.edit = !row.edit;
|
|
|
|
row.edit = !row.edit;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 删除
|
|
|
|
// 删除
|
|
|
@ -96,30 +107,30 @@
|
|
|
|
label: '秒杀时段名称',
|
|
|
|
label: '秒杀时段名称',
|
|
|
|
minWidth: 160,
|
|
|
|
minWidth: 160,
|
|
|
|
slots: {
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => (row.edit ? <ElInput v-model={row.name} /> : row.name),
|
|
|
|
default: ({ row }) => (row.edit ? <ElInput v-model={row.timeName} /> : row.timeName),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: '开始时间',
|
|
|
|
label: '开始时间',
|
|
|
|
width: 160,
|
|
|
|
width: 160,
|
|
|
|
slots: {
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => (row.edit ? <ElTimePicker v-model={row.startTime} /> : row.startTime),
|
|
|
|
default: ({ row }) =>
|
|
|
|
|
|
|
|
row.edit ? <ElTimePicker v-model={row.startTime} value-format="HH:mm:ss" /> : row.startTime,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: '活动状态',
|
|
|
|
label: '结束时间',
|
|
|
|
width: 160,
|
|
|
|
width: 160,
|
|
|
|
slots: {
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => (row.edit ? <ElTimePicker v-model={row.endTime} /> : row.endTime),
|
|
|
|
default: ({ row }) =>
|
|
|
|
|
|
|
|
row.edit ? <ElTimePicker v-model={row.endTime} value-format="HH:mm:ss" /> : row.endTime,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: '启用',
|
|
|
|
label: '启用',
|
|
|
|
width: 100,
|
|
|
|
width: 100,
|
|
|
|
slots: {
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => (
|
|
|
|
default: ({ row }) => <ElSwitch v-model={row.isEnable} onChange={() => handleEnable(row)} />,
|
|
|
|
<ElSwitch value={row.enabled} onChange={(enabled) => handleEnable(row, enabled)} />
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -129,10 +140,18 @@
|
|
|
|
slots: {
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => (
|
|
|
|
default: ({ row }) => (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<ElButton type="text" onClick={() => handleUpdate(row)}>
|
|
|
|
<ElButton
|
|
|
|
|
|
|
|
disabled={row.state !== 1 && !row.edit}
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
onClick={() => handleUpdate(row)}
|
|
|
|
|
|
|
|
>
|
|
|
|
{row.edit ? '保存' : '编辑'}
|
|
|
|
{row.edit ? '保存' : '编辑'}
|
|
|
|
</ElButton>
|
|
|
|
</ElButton>
|
|
|
|
<ElButton type="text" onClick={() => handleRemove([row])}>
|
|
|
|
<ElButton
|
|
|
|
|
|
|
|
disabled={row.state !== 1 && !row.edit}
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
onClick={() => handleRemove([row])}
|
|
|
|
|
|
|
|
>
|
|
|
|
删除
|
|
|
|
删除
|
|
|
|
</ElButton>
|
|
|
|
</ElButton>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|