|
|
@ -9,16 +9,16 @@
|
|
|
|
:reset="handleReset"
|
|
|
|
:reset="handleReset"
|
|
|
|
title="活动"
|
|
|
|
title="活动"
|
|
|
|
:total="total"
|
|
|
|
:total="total"
|
|
|
|
@create="handleCreate"
|
|
|
|
@create="handleCreate()"
|
|
|
|
@search="handleSearch"
|
|
|
|
@search="handleSearch"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #search>
|
|
|
|
<template #search>
|
|
|
|
<el-form inline>
|
|
|
|
<el-form inline>
|
|
|
|
<el-form-item label="活动名称" prop="name">
|
|
|
|
<el-form-item label="活动名称" prop="activityName">
|
|
|
|
<el-input v-model="state.condition.name" />
|
|
|
|
<el-input v-model="state.condition.activityName" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="活动状态" prop="status">
|
|
|
|
<el-form-item label="活动状态" prop="activityStatus">
|
|
|
|
<el-select v-model="state.condition.status" :opts="opts.status" />
|
|
|
|
<el-select v-model="state.condition.activityStatus" :opts="opts.status" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -29,16 +29,12 @@
|
|
|
|
<el-input v-model="formState.form.name" />
|
|
|
|
<el-input v-model="formState.form.name" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="活动名称" prop="time">
|
|
|
|
<el-form-item label="活动名称" prop="time">
|
|
|
|
<el-date-picker
|
|
|
|
<el-date-picker v-model="formState.form.time" type="daterange" value-format="YYYY-MM-DD" />
|
|
|
|
v-model="formState.form.time"
|
|
|
|
|
|
|
|
type="datetimerange"
|
|
|
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
<el-button @click="formState.formVisible = false">取消</el-button>
|
|
|
|
<el-button @click="formState.formVisible = false">取消</el-button>
|
|
|
|
<el-button type="primary" @click="handleSave">保存</el-button>
|
|
|
|
<el-button :loading="formState.submitting" type="primary" @click="handleSave">保存</el-button>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -52,7 +48,7 @@
|
|
|
|
const store = useStore();
|
|
|
|
const store = useStore();
|
|
|
|
const loading = ref(false);
|
|
|
|
const loading = ref(false);
|
|
|
|
const code = computed(() => store.state.limitActivity.code);
|
|
|
|
const code = computed(() => store.state.limitActivity.code);
|
|
|
|
const list = computed(() => store.state.limitActivity.list);
|
|
|
|
const list = computed(() => _.cloneDeep(store.state.limitActivity.list));
|
|
|
|
const total = computed(() => store.state.limitActivity.total);
|
|
|
|
const total = computed(() => store.state.limitActivity.total);
|
|
|
|
const opts = computed(() => store.state.limitActivity.opts);
|
|
|
|
const opts = computed(() => store.state.limitActivity.opts);
|
|
|
|
if (!unref(opts).init) {
|
|
|
|
if (!unref(opts).init) {
|
|
|
@ -62,8 +58,8 @@
|
|
|
|
/* 列表查询 */
|
|
|
|
/* 列表查询 */
|
|
|
|
const state = reactive({
|
|
|
|
const state = reactive({
|
|
|
|
condition: {
|
|
|
|
condition: {
|
|
|
|
name: null,
|
|
|
|
activityName: null,
|
|
|
|
status: null,
|
|
|
|
activityStatus: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
watch(
|
|
|
|
watch(
|
|
|
@ -75,8 +71,8 @@
|
|
|
|
);
|
|
|
|
);
|
|
|
|
const handleReset = () => {
|
|
|
|
const handleReset = () => {
|
|
|
|
state.condition = {
|
|
|
|
state.condition = {
|
|
|
|
name: null,
|
|
|
|
activityName: null,
|
|
|
|
status: null,
|
|
|
|
activityStatus: null,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const handleSearch = async () => {
|
|
|
|
const handleSearch = async () => {
|
|
|
@ -86,12 +82,14 @@
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* 表单 */
|
|
|
|
/* 表单 */
|
|
|
|
|
|
|
|
const refsForm = ref(null);
|
|
|
|
const formState = reactive({
|
|
|
|
const formState = reactive({
|
|
|
|
formVisible: false,
|
|
|
|
formVisible: false,
|
|
|
|
refsForm: null,
|
|
|
|
submitting: false,
|
|
|
|
form: {
|
|
|
|
form: {
|
|
|
|
name: null,
|
|
|
|
name: null,
|
|
|
|
time: [],
|
|
|
|
time: [],
|
|
|
|
|
|
|
|
isOnline: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
|
name: [{ required: true, message: '活动名称不能为空' }],
|
|
|
|
name: [{ required: true, message: '活动名称不能为空' }],
|
|
|
@ -107,16 +105,23 @@
|
|
|
|
time: [],
|
|
|
|
time: [],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
formState.formVisible.value = true;
|
|
|
|
formState.formVisible = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 保存
|
|
|
|
// 保存
|
|
|
|
const handleSave = async () => {
|
|
|
|
const handleSave = async () => {
|
|
|
|
|
|
|
|
formState.submitting = true;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await unref(formState.refsForm).validate();
|
|
|
|
await unref(refsForm).validate();
|
|
|
|
|
|
|
|
let data = _.cloneDeep(formState.form);
|
|
|
|
|
|
|
|
data.activityStartTime = data.time[0];
|
|
|
|
|
|
|
|
data.activityEndTime = data.time[1];
|
|
|
|
|
|
|
|
delete data.time;
|
|
|
|
|
|
|
|
await store.dispatch('limitActivity/save', data);
|
|
|
|
formState.formVisible = false;
|
|
|
|
formState.formVisible = false;
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.info('取消保存', e);
|
|
|
|
console.info('取消保存', e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
formState.submitting = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* 操作 */
|
|
|
|
/* 操作 */
|
|
|
@ -129,8 +134,10 @@
|
|
|
|
router.push({ name: 'UpdateLimitProduct', params: { id: row.id } });
|
|
|
|
router.push({ name: 'UpdateLimitProduct', params: { id: row.id } });
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 上下架
|
|
|
|
// 上下架
|
|
|
|
const handleEnable = (row, value) => {
|
|
|
|
const handleEnable = async (row) => {
|
|
|
|
row.enabled = value;
|
|
|
|
loading.value = true;
|
|
|
|
|
|
|
|
await store.dispatch('limitActivity/save', row);
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// 删除
|
|
|
|
// 删除
|
|
|
|
const handleRemove = async (rows) => {
|
|
|
|
const handleRemove = async (rows) => {
|
|
|
@ -160,23 +167,21 @@
|
|
|
|
label: '活动状态',
|
|
|
|
label: '活动状态',
|
|
|
|
width: 160,
|
|
|
|
width: 160,
|
|
|
|
slots: {
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => proxy.$dict(unref(opts).status, row.status),
|
|
|
|
default: ({ row }) => proxy.$dict(unref(opts).status, row.activityState),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: '活动时间',
|
|
|
|
label: '活动时间',
|
|
|
|
width: 360,
|
|
|
|
width: 360,
|
|
|
|
slots: {
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => row.startTime + ' - ' + row.endTime,
|
|
|
|
default: ({ row }) => row.activityStartTime + ' - ' + row.activityEndTime,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: '上线/下线',
|
|
|
|
label: '上线/下线',
|
|
|
|
width: 120,
|
|
|
|
width: 120,
|
|
|
|
slots: {
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => (
|
|
|
|
default: ({ row }) => <ElSwitch v-model={row.isOnline} onChange={() => handleEnable(row)} />,
|
|
|
|
<ElSwitch value={row.isEnable} onChange={(visible) => handleEnable(row, visible)} />
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -192,10 +197,14 @@
|
|
|
|
<ElButton type="text" onClick={() => handleUpdateProduct(row)}>
|
|
|
|
<ElButton type="text" onClick={() => handleUpdateProduct(row)}>
|
|
|
|
设置商品
|
|
|
|
设置商品
|
|
|
|
</ElButton>
|
|
|
|
</ElButton>
|
|
|
|
<ElButton type="text" onClick={() => handleCreate(row)}>
|
|
|
|
<ElButton type="text" disabled={row.activityState !== 1} onClick={() => handleCreate(row)}>
|
|
|
|
编辑
|
|
|
|
编辑
|
|
|
|
</ElButton>
|
|
|
|
</ElButton>
|
|
|
|
<ElButton type="text" onClick={() => handleRemove([row])}>
|
|
|
|
<ElButton
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
disabled={row.activityState !== 1}
|
|
|
|
|
|
|
|
onClick={() => handleRemove([row])}
|
|
|
|
|
|
|
|
>
|
|
|
|
删除
|
|
|
|
删除
|
|
|
|
</ElButton>
|
|
|
|
</ElButton>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|