This commit is contained in:
helen 2024-12-25 09:05:03 +08:00
parent cae7bcf062
commit 3e9f45c99e
5 changed files with 224 additions and 41 deletions

View File

@ -65,10 +65,33 @@ export const delMkJigsaw = (id: string | number | Array<string | number>) => {
*
* @param query
*/
export const productall = (query: Array<string | number>) => {
export const productall = (query?: MkJigsawQuery): AxiosPromise<MkJigsawVO[]> => {
return request({
url: '/manage/product/all',
method: 'gte',
method: 'get',
params: query
});
};
/**
*
* @param query
*/
export const mkJigsawDetaillist = (query?: MkJigsawQuery): AxiosPromise<MkJigsawVO[]> => {
return request({
url: '/manage/mkJigsawDetail/list',
method: 'get',
params: query
});
};
/**
*
* @param query
*/
export const productCategoryall = (query?: MkJigsawQuery): AxiosPromise<MkJigsawVO[]> => {
return request({
url: '/manage/productCategory/all',
method: 'get',
params: query
});
};

View File

@ -72,9 +72,10 @@
</el-table-column>
<el-table-column label="发布状态" align="center" prop="status" width="100px">
<template #default="scope">
<el-tag v-if="scope.row.status == 1" type="primary">审核中</el-tag>
<el-tag v-if="scope.row.status == 2" type="success">发布</el-tag>
<el-tag v-if="scope.row.status == 0" type="info">未发布</el-tag>
<el-tag v-if="scope.row.status == 1" type="warning">草稿</el-tag>
<el-tag v-if="scope.row.status == 2" type="success">审核中</el-tag>
<el-tag v-if="scope.row.status == 3" type="primary">已发布</el-tag>
</template>
</el-table-column>
<el-table-column label="发布时间" align="center" prop="publishTime" />
@ -83,15 +84,28 @@
<el-table-column label="操作时间" align="center" prop="updateTime" width="180px" />
<el-table-column label="操作" align="center" width="150px" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="编辑" placement="top">
<el-button v-hasPermi="['system:article:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
</el-tooltip>
<!-- <el-tooltip content="发布" placement="top">-->
<!-- <el-button v-hasPermi="['system:article:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>-->
<!-- </el-tooltip>-->
<el-tooltip content="删除" placement="top">
<el-button v-hasPermi="['system:article:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
</el-tooltip>
<el-button
v-if="scope.row.status == 0 || scope.row.status == 1"
v-hasPermi="['system:article:edit']"
link
type="primary"
@click="handleUpdate(scope.row)"
>编辑</el-button
>
<el-button v-if="scope.row.status == 0" v-hasPermi="['system:article:edit']" link type="primary" @click="handleUpdate(scope.row)"
>发布</el-button
>
<el-button v-if="scope.row.status == 3" v-hasPermi="['system:article:edit']" link type="primary" @click="handleUpdate(scope.row)"
>撤销发布</el-button
>
<el-button
v-if="scope.row.status == 0 || scope.row.status == 1"
v-hasPermi="['system:article:remove']"
link
type="primary"
@click="handleDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@ -238,9 +252,10 @@ const publisherAddress = ref({});
const Mapvalue = ref({});
const Mapvaluetwo = ref({});
const note_publish_list = ref([
{ value: 3, label: '已发布' },
{ value: 0, label: '未发布' },
{ value: 1, label: '草稿' }
{ label: '已发布', value: 3 },
{ label: '审核中', value: 2 },
{ label: '未发布', value: 0 },
{ label: '草稿', value: 1 }
]);
const activityFormRef = ref<ElFormInstance>();
const getMapValue = (value: any) => {

View File

@ -40,7 +40,11 @@
</el-table-column>
<el-table-column label="商品ID" align="center" prop="productId" />
<el-table-column label="商品名称" align="center" prop="productName" />
<el-table-column label="商品类别" align="center" prop="productCategory" />
<el-table-column label="商品类别" align="center" prop="productCategory">
<template #default="scope">
<span>{{ goodsleibiesave(scope.row.productCategory) }}</span>
</template>
</el-table-column>
<el-table-column label="商品图片" align="center" prop="productImage" />
<el-table-column label="活动时间" align="center" prop="startDate" width="180">
<template #default="scope">
@ -53,29 +57,28 @@
<el-table-column label="实际得奖人数" align="center" prop="awardCount" />
<el-table-column label="拼图碎片获得人数" align="center" prop="awardCount">
<template #default="scope">
<el-button type="primary" link>查看详情</el-button>
<el-button type="primary" link @click="imagesui(scope.row)">查看详情</el-button>
</template>
</el-table-column>
<el-table-column label="拼图详情" align="center" prop="awardCount">
<template #default="scope">
<el-button type="primary" link>查看详情</el-button>
<el-button type="primary" link @click="handleUpdate(scope.row, 1)">查看详情</el-button>
</template>
</el-table-column>
<el-table-column label="发布状态" align="center" prop="status">
<template #default="scope">
<span>{{ scope.row.status }}</span>
<el-tag v-if="scope.row.status == 0" type="info">未发布</el-tag>
<!-- <el-tag v-if="scope.row.status == 1" type="warning">草稿</el-tag>-->
<el-tag v-if="scope.row.status == 1" type="success">审核中</el-tag>
<el-tag v-if="scope.row.status == 2" type="primary">已发布</el-tag>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="awardCount" />
<el-table-column label="创建时间" align="center" prop="awardCount" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button v-hasPermi="['manage:mkJigsaw:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button v-hasPermi="['manage:mkJigsaw:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
</el-tooltip>
<el-button v-hasPermi="['manage:mkJigsaw:edit']" link type="primary" @click="handleUpdate(scope.row, 2)">编辑</el-button>
<el-button v-hasPermi="['manage:mkJigsaw:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -94,11 +97,33 @@
</el-select>
</el-form-item>
<el-form-item label="选择商品" prop="productId">
<el-input v-model="form.productId" placeholder="请选择商品" style="width: 300px" />
<el-select v-model="form.productId" placeholder="请选择商品" style="width: 300px" @change="goodssave">
<el-option v-for="item in imagegoodsoptions" :key="item.id" :label="item.productName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="活动时间" prop="startDate">
<el-date-picker v-model="form.startDate" clearable type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择活动开始时间">
</el-date-picker>
<el-form-item>
<el-table :data="goodsdata" border style="width: 100%">
<el-table-column prop="id" label="商品ID" width="180" />
<el-table-column prop="productName" label="商品名称" width="180" />
<el-table-column prop="categoryId" label="商品类别">
<template #default="scope">
<span>{{ goodsleibiesave(scope.row.categoryId) }}</span>
</template>
</el-table-column>
<el-table-column prop="" label="商品图片" />
</el-table>
</el-form-item>
<el-form-item label="活动时间" prop="startDate" style="width: 500px">
<el-date-picker
v-model="value2"
type="datetimerange"
start-placeholder="选择开始时间"
end-placeholder="选择结束时间"
format="YYYY-MM-DD HH:mm:ss"
date-format="YYYY/MM/DD ddd"
time-format="A hh:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
<el-form-item label="设置拼图数量" prop="jigsawConfigCount">
<el-input v-model="form.jigsawConfigCount" placeholder="请输入拼图配置数量" style="width: 300px" disabled />
@ -126,11 +151,28 @@
</div>
</template>
</el-dialog>
<!-- 拼图碎片获得人数-->
<el-dialog v-model="imagedialog.visible" :title="imagedialog.title" width="50%" append-to-body>
<el-table :data="imagelistdata" border style="width: 100%">
<el-table-column prop="name" label="名称" width="180" />
<el-table-column prop="probability" label="设置概率/人数" width="180" />
<el-table-column prop="joinCount" label="获得人数" />
</el-table>
</el-dialog>
</div>
</template>
<script setup name="MkJigsaw" lang="ts">
import { listMkJigsaw, getMkJigsaw, delMkJigsaw, addMkJigsaw, updateMkJigsaw } from '@/api/manage/mkJigsaw';
import {
listMkJigsaw,
getMkJigsaw,
delMkJigsaw,
addMkJigsaw,
updateMkJigsaw,
productall,
mkJigsawDetaillist,
productCategoryall
} from '@/api/manage/mkJigsaw';
import { MkJigsawVO, MkJigsawQuery, MkJigsawForm } from '@/api/manage/mkJigsaw/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -144,14 +186,27 @@ const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const value2 = ref('');
const queryFormRef = ref<ElFormInstance>();
const mkJigsawFormRef = ref<ElFormInstance>();
const imagegoodsoptions = ref([]);
const goodsdata = ref([]);
const imagelistdata = ref([]);
const goodleibielist = ref([]);
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const mksave = reactive<DialogOption>({
visible: false,
title: '拼图详情'
});
const imagedialog = reactive<DialogOption>({
visible: false,
title: '拼图碎片获得人数'
});
const mktype = ref('');
const numlist = ref([
{ value: '1', label: '片数1' },
{ value: '2', label: '片数2' },
@ -271,21 +326,55 @@ const handleSelectionChange = (selection: MkJigsawVO[]) => {
const handleAdd = () => {
reset();
dialog.visible = true;
goodsdata.value = [];
value2.value = [];
numlistdata.value = [
{ probability: '', name: '片数1' },
{ probability: '', name: '片数2' },
{ probability: '', name: '片数3' },
{ probability: '', name: '片数4' },
{ probability: '', name: '片数5' },
{ probability: '', name: '片数6' },
{ probability: '', name: '片数7' },
{ probability: '', name: '片数8' },
{ probability: '', name: '片数9' }
];
dialog.title = '添加拼图任务';
};
/** 修改按钮操作 */
const handleUpdate = async (row?: MkJigsawVO) => {
const handleUpdate = async (row?: MkJigsawVO, type) => {
reset();
mktype.value = type;
const _id = row?.id || ids.value[0];
const res = await getMkJigsaw(_id);
Object.assign(form.value, res.data);
numlistdata.value = form.value.jigsawDetailList;
goodsdata.value = [];
const foundObject = findObjectById(imagegoodsoptions.value, form.value.productId);
console.log(foundObject);
goodsdata.value.push(foundObject);
if (form.value.startDate && form.value.endDate) {
value2.value = [form.value.startDate, form.value.endDate];
// form.value.endDate = value2.value[1];
}
dialog.visible = true;
dialog.title = '修改拼图任务';
};
/** 提交按钮 */
const submitForm = () => {
console.log(value2.value);
if (value2.value.length > 0) {
form.value.startDate = value2.value[0];
form.value.endDate = value2.value[1];
}
form.value.jigsawDetailList = numlistdata.value;
form.value.productName = goodsdata.value[0].productName;
form.value.productCategory = goodsdata.value[0].categoryId;
// console.log(goodsdata.value,form.value);
// form.value.controlJigsawIndex = parseFloat(form.value.controlJigsawIndex);
mkJigsawFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
@ -321,7 +410,7 @@ const handleExport = () => {
);
};
const selectnumlist = () => {
numlistdata.value = ([
numlistdata.value = [
{ probability: '', name: '片数1' },
{ probability: '', name: '片数2' },
{ probability: '', name: '片数3' },
@ -331,13 +420,57 @@ const selectnumlist = () => {
{ probability: '', name: '片数7' },
{ probability: '', name: '片数8' },
{ probability: '', name: '片数9' }
]);
];
console.log(form.value.controlJigsawIndex);
numlistdata.value = numlistdata.value.filter((i) => i.name !== form.value.controlJigsawIndex);
};
/*商品列表*/
const getproductall = async () => {
const res = await productall();
console.log(res);
imagegoodsoptions.value = res.data;
};
//
const goodssave = () => {
goodsdata.value = [];
const foundObject = findObjectById(imagegoodsoptions.value, form.value.productId);
console.log(foundObject);
goodsdata.value.push(foundObject);
};
const findObjectById = (array, id) => {
for (let i = 0; i < array.length; i++) {
if (array[i].id === id) {
return array[i];
}
}
return null;
};
//
const imagesui = async (row) => {
imagedialog.visible = true;
console.log(row);
const res = await mkJigsawDetaillist({ jigsawId: row.id });
console.log(res);
imagelistdata.value = res.data;
};
const goodleibie = async () => {
const res = await productCategoryall();
goodleibielist.value = res.data;
};
const goodsleibiesave = (id) => {
for (let i = 0; i < goodleibielist.value.length; i++) {
console.log(goodleibielist.value[i].id);
if (goodleibielist.value[i].id === id) {
return goodleibielist.value[i].category;
}
}
return null;
};
onMounted(() => {
getList();
getproductall();
goodleibie();
});
</script>
<style>

View File

@ -6,7 +6,7 @@
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="笔记标题" prop="id">
<el-input v-model="queryParams.id" placeholder="请输入笔记标题" clearable @keyup.enter="handleQuery" />
<el-input v-model="queryParams.title" placeholder="请输入笔记标题" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="发布人" prop="title">
<el-input v-model="queryParams.title" placeholder="请输入发布人" clearable @keyup.enter="handleQuery" />

View File

@ -91,10 +91,10 @@
@click="handleDelete(scope.row)"
>删除</el-button
>
<el-button v-if="scope.row.status == 0" v-hasPermi="['system:Route:remove']" link type="primary" @click="handleDelete(scope.row)"
<el-button v-if="scope.row.status == 0" v-hasPermi="['system:Route:remove']" link type="primary" @click="savelistrow(scope.row)"
>发布</el-button
>
<el-button v-if="scope.row.status == 3" v-hasPermi="['system:Route:remove']" link type="primary" @click="handleDelete(scope.row)"
<el-button v-if="scope.row.status == 3" v-hasPermi="['system:Route:remove']" link type="primary" @click="savelistrow(scope.row)"
>撤销发布</el-button
>
</template>
@ -530,7 +530,7 @@ const handleUpdate = async (row?: RouteVO) => {
Object.assign(form.value, res.data);
dialog.visible = true;
bookrouteDetailsList.value = form.value.routeDetailsList;
tagvalue.value =form.value.tagId==''?'': form.value.tagId.split(',');
tagvalue.value = form.value.tagId == '' ? '' : form.value.tagId.split(',');
treevalue.value = JSON.parse(form.value.region);
dialog.title = '修改路线';
};
@ -666,6 +666,18 @@ const yulanform = () => {
const yulanquxiao = () => {
yulandialog.visible = false;
};
const savelistrow = async (row) => {
reset();
// tagvalue.value=[]
const _id = row?.id || ids.value[0];
const res = await getRoute(_id);
Object.assign(form.value, res.data);
form.value.status = Number(res.data.status == 3 ? 0 : 2);
console.log(form.value);
await updateRoute(form.value).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
await getList();
};
//
const linkontent = async (row?: RouteVO) => {
// reset();