588 lines
23 KiB
Vue
588 lines
23 KiB
Vue
<template>
|
|
<div class="p-2">
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
<div v-show="showSearch" class="mb-[10px]">
|
|
<el-card shadow="hover">
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
<el-form-item label="任务名称" prop="name">
|
|
<el-input v-model="queryParams.name" placeholder="请输入任务名称" clearable @keyup.enter="handleQuery" />
|
|
</el-form-item>
|
|
<el-form-item label="任务状态" prop="category">
|
|
<el-select v-model="queryParams.status" class="inputWidth" placeholder="请选择发布状态" clearable>
|
|
<el-option v-for="dict in note_publish_list" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-card>
|
|
</div>
|
|
</transition>
|
|
|
|
<el-card shadow="never">
|
|
<template #header>
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button v-hasPermi="['manage:mkJigsaw:add']" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
|
</el-col>
|
|
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
|
</el-row>
|
|
</template>
|
|
|
|
<el-table v-loading="loading" :data="mkJigsawList">
|
|
<el-table-column label="任务名称" align="center" prop="name" />
|
|
<el-table-column label="任务类别" align="center" prop="category">
|
|
<template #default="scope">
|
|
<dict-tag :options="mk_jigsaw_task_catagory" :value="scope.row.category" />
|
|
</template>
|
|
</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">
|
|
<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">
|
|
<span>{{ parseTime(scope.row.startDate, '{y}.{m}.{d}') }}~{{ parseTime(scope.row.endDate, '{y}.{m}.{d}') }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="拼图数量" align="center" prop="jigsawConfigCount" />
|
|
<el-table-column label="设置得奖人数" align="center" prop="awardConfigCount" />
|
|
<el-table-column label="参与人数" align="center" prop="joinCount" />
|
|
<el-table-column label="实际得奖人数" align="center" prop="awardCount" />
|
|
<el-table-column label="拼图碎片获得人数" align="center" prop="awardCount">
|
|
<template #default="scope">
|
|
<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 @click="handleUpdate(scope.row, 1)">查看详情</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="发布状态" align="center" prop="status">
|
|
<template #default="scope">
|
|
<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="createName" />
|
|
<el-table-column label="创建时间" align="center" prop="createTime" />
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px">
|
|
<template #default="scope">
|
|
<el-button v-if="scope.row.status == 0" v-hasPermi="['manage:mkJigsaw:edit']" link type="primary" @click="handleUpdate(scope.row, 2)"
|
|
>编辑</el-button
|
|
>
|
|
<el-button v-if="scope.row.status == 0" v-hasPermi="['manage:mkJigsaw:remove']" link type="primary" @click="handleDelete(scope.row)"
|
|
>删除</el-button
|
|
>
|
|
<el-button v-if="scope.row.status == 0" v-hasPermi="['manage:mkJigsaw:remove']" link type="primary" @click="saveupdate(scope.row, 1)"
|
|
>发布</el-button
|
|
>
|
|
<el-button v-if="scope.row.status == 2" v-hasPermi="['manage:mkJigsaw:remove']" link type="primary" @click="saveupdate(scope.row, 2)"
|
|
>撤销发布</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
|
</el-card>
|
|
<!-- 添加或修改拼图游戏对话框 -->
|
|
<el-dialog v-model="dialog.visible" :title="dialog.title" width="50%" append-to-body>
|
|
<el-form ref="mkJigsawFormRef" :model="form" :rules="rules" label-width="140px">
|
|
<el-form-item label="任务名称" prop="name">
|
|
<el-input v-model="form.name" placeholder="请输入任务名称" style="width: 300px" />
|
|
</el-form-item>
|
|
<el-form-item label="任务类别" prop="category">
|
|
<el-select v-model="form.category" placeholder="请选择任务类别" style="width: 300px">
|
|
<el-option v-for="dict in mk_jigsaw_task_catagory" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="选择商品" prop="productId">
|
|
<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>
|
|
<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"
|
|
:picker-options="{ disabledDate: dateOptions }"
|
|
@change="mkdatetime"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="设置拼图数量" prop="jigsawConfigCount">
|
|
<el-input v-model="form.jigsawConfigCount" placeholder="请输入拼图配置数量" style="width: 300px" disabled />
|
|
</el-form-item>
|
|
<el-form-item label="得奖人数" prop="awardConfigCount">
|
|
<el-input v-model="form.awardConfigCount" placeholder="请输入得奖人数" style="width: 300px" />
|
|
</el-form-item>
|
|
<el-form-item label="控制得奖拼图" prop="controlJigsawIndex">
|
|
<el-select v-model="form.controlJigsawIndex" placeholder="请选择控制得奖拼图" style="width: 300px" @change="selectnumlist">
|
|
<el-option v-for="dict in numlist" :key="dict.label" :label="dict.label" :value="dict.label"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<div class="numlistclasss">
|
|
<div v-for="item in numlistdata" :key="item.name">
|
|
<el-form-item :label="`${item.name}:可获得概率`">
|
|
<el-input v-model="item.probability" placeholder="请输入概率" style="width: 100px" />%
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
</el-form>
|
|
<template #footer>
|
|
<div class="dialog-footer">
|
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</template>
|
|
</el-dialog>
|
|
<!-- 查看拼图游戏对话框 -->
|
|
<el-dialog v-model="mksave.visible" :title="mksave.title" width="50%" append-to-body>
|
|
<el-form ref="mkJigsawFormRef" :model="form" label-width="140px">
|
|
<el-form-item label="任务名称">
|
|
<div>{{ form.name }}</div>
|
|
</el-form-item>
|
|
<el-form-item label="任务类别">
|
|
<el-select v-model="form.category" placeholder="请选择任务类别" style="width: 300px" disabled>
|
|
<el-option v-for="dict in mk_jigsaw_task_catagory" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="选择商品">
|
|
<el-select v-model="form.productId" placeholder="请选择商品" style="width: 300px" disabled @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>
|
|
<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">
|
|
<div>{{ form.startDate }}~{{ form.endDate }}</div>
|
|
</el-form-item>
|
|
<el-form-item label="设置拼图数量">
|
|
<div>{{form.jigsawConfigCount}}</div>
|
|
</el-form-item>
|
|
<el-form-item label="得奖人数">
|
|
<div>{{form.awardConfigCount}}</div>
|
|
</el-form-item>
|
|
<el-form-item label="控制得奖拼图">
|
|
<el-select v-model="form.controlJigsawIndex" placeholder="请选择控制得奖拼图" style="width: 300px" @change="selectnumlist" disabled>
|
|
<el-option v-for="dict in numlist" :key="dict.label" :label="dict.label" :value="dict.label"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<div class="numlistclasss">
|
|
<div v-for="item in numlistdata" :key="item.name">
|
|
<el-form-item :label="`${item.name}:可获得概率`">
|
|
<div>{{item.probability}}%</div>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
</el-form>
|
|
</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,
|
|
productall,
|
|
mkJigsawDetaillist,
|
|
productCategoryall
|
|
} from '@/api/manage/mkJigsaw';
|
|
import { MkJigsawVO, MkJigsawQuery, MkJigsawForm } from '@/api/manage/mkJigsaw/types';
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { mk_jigsaw_task_catagory } = toRefs<any>(proxy?.useDict('mk_jigsaw_task_catagory'));
|
|
|
|
const mkJigsawList = ref<MkJigsawVO[]>([]);
|
|
const buttonLoading = ref(false);
|
|
const loading = ref(true);
|
|
const showSearch = ref(true);
|
|
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 note_publish_list = ref([
|
|
{ label: '已发布', value: 2 },
|
|
{ label: '审核中', value: 1 },
|
|
{ label: '未发布', value: 0 }
|
|
// { label: '草稿', value: 1 }
|
|
]);
|
|
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' },
|
|
{ value: '3', label: '片数3' },
|
|
{ value: '4', label: '片数4' },
|
|
{ value: '5', label: '片数5' },
|
|
{ value: '6', label: '片数6' },
|
|
{ value: '7', label: '片数7' },
|
|
{ value: '8', label: '片数8' },
|
|
{ value: '9', label: '片数9' }
|
|
]);
|
|
const numlistdata = ref([
|
|
{ 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' }
|
|
]);
|
|
const initFormData: MkJigsawForm = {
|
|
id: undefined,
|
|
name: undefined,
|
|
category: undefined,
|
|
productId: undefined,
|
|
productName: undefined,
|
|
startDate: undefined,
|
|
endDate: undefined,
|
|
jigsawConfigCount: 9,
|
|
awardConfigCount: undefined,
|
|
controlJigsawIndex: undefined,
|
|
joinCount: undefined,
|
|
awardCount: undefined,
|
|
status: undefined
|
|
};
|
|
const data = reactive<PageData<MkJigsawForm, MkJigsawQuery>>({
|
|
form: { ...initFormData },
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
name: undefined,
|
|
category: undefined,
|
|
productId: undefined,
|
|
productName: undefined,
|
|
startDate: undefined,
|
|
endDate: undefined,
|
|
jigsawConfigCount: undefined,
|
|
awardConfigCount: undefined,
|
|
controlJigsawIndex: undefined,
|
|
joinCount: undefined,
|
|
awardCount: undefined,
|
|
status: undefined,
|
|
params: {}
|
|
},
|
|
rules: {
|
|
id: [{ required: true, message: 'ID不能为空', trigger: 'blur' }],
|
|
name: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
|
category: [{ required: true, message: '任务类别 0-普适拼图任务 1-心愿拼图任务不能为空', trigger: 'change' }],
|
|
productId: [{ required: true, message: '商品ID不能为空', trigger: 'blur' }],
|
|
productName: [{ required: true, message: '商品名称不能为空', trigger: 'blur' }],
|
|
startDate: [{ required: true, message: '活动开始时间不能为空', trigger: 'blur' }],
|
|
endDate: [{ required: true, message: '活动结束时间不能为空', trigger: 'blur' }],
|
|
jigsawConfigCount: [{ required: true, message: '拼图配置数量不能为空', trigger: 'blur' }],
|
|
awardConfigCount: [{ required: true, message: '得奖配置人数不能为空', trigger: 'blur' }],
|
|
controlJigsawIndex: [{ required: true, message: '控制得奖拼图不能为空', trigger: 'blur' }],
|
|
joinCount: [{ required: true, message: '参与人数不能为空', trigger: 'blur' }],
|
|
awardCount: [{ required: true, message: '实际得奖人数不能为空', trigger: 'blur' }],
|
|
status: [{ required: true, message: '发布状态不能为空', trigger: 'change' }]
|
|
}
|
|
});
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
/** 查询拼图游戏列表 */
|
|
const getList = async () => {
|
|
loading.value = true;
|
|
const res = await listMkJigsaw(queryParams.value);
|
|
mkJigsawList.value = res.rows;
|
|
total.value = res.total;
|
|
loading.value = false;
|
|
};
|
|
|
|
/** 取消按钮 */
|
|
const cancel = () => {
|
|
reset();
|
|
dialog.visible = false;
|
|
};
|
|
|
|
/** 表单重置 */
|
|
const reset = () => {
|
|
form.value = { ...initFormData };
|
|
mkJigsawFormRef.value?.resetFields();
|
|
};
|
|
|
|
/** 搜索按钮操作 */
|
|
const handleQuery = () => {
|
|
queryParams.value.pageNum = 1;
|
|
getList();
|
|
};
|
|
|
|
/** 重置按钮操作 */
|
|
const resetQuery = () => {
|
|
queryParams.value.status = '';
|
|
queryFormRef.value?.resetFields();
|
|
handleQuery();
|
|
};
|
|
|
|
/** 多选框选中数据 */
|
|
const handleSelectionChange = (selection: MkJigsawVO[]) => {
|
|
ids.value = selection.map((item) => item.id);
|
|
single.value = selection.length != 1;
|
|
multiple.value = !selection.length;
|
|
};
|
|
|
|
/** 新增按钮操作 */
|
|
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, 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];
|
|
}
|
|
if (type == 1) {
|
|
mksave.visible = true;
|
|
} else {
|
|
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;
|
|
if (form.value.id) {
|
|
await updateMkJigsaw(form.value).finally(() => (buttonLoading.value = false));
|
|
} else {
|
|
await addMkJigsaw(form.value).finally(() => (buttonLoading.value = false));
|
|
}
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
dialog.visible = false;
|
|
await getList();
|
|
}
|
|
});
|
|
};
|
|
// 发布撤销发布
|
|
const saveupdate = async (row?: MkJigsawVO, type) => {
|
|
const _id = row?.id || ids.value[0];
|
|
const res = await getMkJigsaw(_id);
|
|
Object.assign(form.value, res.data);
|
|
form.value.status = type == 1 ? 1 : 0;
|
|
const test = type == 1 ? '发布' : '撤销发布';
|
|
const _ids = row?.name || ids.value;
|
|
await proxy?.$modal.confirm('是否确认' + test + '拼图游戏名称为' + _ids + '的数据项?').finally(() => (loading.value = false));
|
|
await updateMkJigsaw(form.value).finally(() => (buttonLoading.value = false));
|
|
proxy?.$modal.msgSuccess(test + '成功');
|
|
await getList();
|
|
// await updateActivity(form.value).finally(() => (buttonLoading.value = false));
|
|
};
|
|
/** 删除按钮操作 */
|
|
const handleDelete = async (row?: MkJigsawVO) => {
|
|
const _ids = row?.id || ids.value;
|
|
const _idsname = row?.name || ids.value;
|
|
|
|
await proxy?.$modal.confirm('是否确认删除拼图游戏名称为"' + _idsname + '"的数据项?').finally(() => (loading.value = false));
|
|
await delMkJigsaw(_ids);
|
|
proxy?.$modal.msgSuccess('删除成功');
|
|
await getList();
|
|
};
|
|
|
|
/** 导出按钮操作 */
|
|
const handleExport = () => {
|
|
proxy?.download(
|
|
'manage/mkJigsaw/export',
|
|
{
|
|
...queryParams.value
|
|
},
|
|
`mkJigsaw_${new Date().getTime()}.xlsx`
|
|
);
|
|
};
|
|
const selectnumlist = () => {
|
|
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' }
|
|
];
|
|
console.log(form.value.controlJigsawIndex);
|
|
numlistdata.value = numlistdata.value.filter((i) => i.name !== form.value.controlJigsawIndex);
|
|
};
|
|
/*商品列表*/
|
|
const getproductall = async () => {
|
|
const res = await productall({ status: 1 });
|
|
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.map((item, index) => {
|
|
return {
|
|
...item,
|
|
probability: index == 0 ? `${item.probability}人` : `${item.probability}%`
|
|
};
|
|
});
|
|
};
|
|
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;
|
|
};
|
|
// 选择今天及今天以后的日期
|
|
const dateOptions = (time) => {
|
|
return time.getTime() < Date.now() - 8.64e6;
|
|
};
|
|
const mkdatetime = () => {
|
|
if (value2.value.length > 0) {
|
|
form.value.startDate = value2.value[0];
|
|
form.value.endDate = value2.value[1];
|
|
}
|
|
};
|
|
onMounted(() => {
|
|
getList();
|
|
getproductall();
|
|
goodleibie();
|
|
});
|
|
</script>
|
|
<style>
|
|
.numlistclasss {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
> div {
|
|
width: 33%;
|
|
}
|
|
}
|
|
</style>
|