Files
xq-ui/src/views/xq/activityShop/index.vue
2024-05-10 23:40:22 +08:00

253 lines
9.1 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="活动标题" prop="activityTitle">
<el-input
v-model="queryParams.activityTitle"
placeholder="请输入活动标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="城市" prop="cityName">
<el-input
v-model="queryParams.cityName"
placeholder="请输入城市"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['xq:activityShop:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['xq:activityShop:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['xq:activityShop:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="activityShopList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="活动标题" align="center" prop="activityTitle" show-overflow-tooltip/>
<el-table-column label="活动展示图片" align="center" prop="activityBanner" >
<template v-slot="scope">
<image-preview :src="scope.row.activityBanner" :height="75" :width="120"/>
</template>
</el-table-column>
<el-table-column label="时间" align="center" prop="startTime" >
<template v-slot="scope">
<span style="font-weight: bold">开始时间:</span><span>{{scope.row.startTime}}</span> <br>
<span style="font-weight: bold">结束时间:</span><span>{{scope.row.endTime}}</span><br>
</template>
</el-table-column>
<el-table-column label="城市名称" align="center" prop="cityName" />
<el-table-column label="详细地址" align="center" prop="address" show-overflow-tooltip/>
<el-table-column label="人数" align="center" prop="womenMaxNum" >
<template v-slot="scope">
<span style="font-weight: bold">男生上限:</span><span>{{scope.row.manMaxNum}}</span> <span style="font-weight: bold">女生上限:</span><span>{{scope.row.womenMaxNum}}</span><br>
<span style="font-weight: bold">已报名():</span><span>{{scope.row.joinManNum}}</span> <span style="font-weight: bold">已报名():</span><span>{{scope.row.joinWomenNum}}</span><br>
<span style="font-weight: bold">人工调整():</span><span>{{scope.row.handManNum}}</span> <span style="font-weight: bold">人工调整():</span><span>{{scope.row.handWomenNum}}</span><br>
<span style="font-weight: bold">显示人数():</span><span>{{scope.row.joinManNum+scope.row.handManNum}}</span> <span style="font-weight: bold">显示人数():</span><span>{{scope.row.joinWomenNum+scope.row.handWomenNum}}</span><br>
</template>
</el-table-column>
<el-table-column label="价格" align="center" prop="joinWomenPrice" >
<template v-slot="scope">
<span style="font-weight: bold">男生价格:</span><span>{{scope.row.joinManPrice}}</span> <span style="font-weight: bold">女生价格:</span><span>{{scope.row.joinWomenPrice}}</span><br>
<span style="font-weight: bold">费用说明:</span><span>{{scope.row.priceText}}</span>
</template>
</el-table-column>
<el-table-column label="权限" align="center" prop="joinWomenPrice" >
<template v-slot="scope">
<span style="font-weight: bold">强制会员:</span><span>{{scope.row.mustVip===1?'强制':'不强制'}}</span> <br>
<span style="font-weight: bold">强制实名:</span><span>{{scope.row.mustAuth===1?'强制':'不强制'}}</span>
</template>
</el-table-column>
<el-table-column label="活动详细说明" align="center" prop="activityText" show-overflow-tooltip/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['xq:activityShop:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdateUser(scope.row)"
v-hasPermi="['xq:activityShop:edit']"
>人数调整</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['xq:activityShop:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<add-activity-shop-dialog v-if="addActivityShopDialogVisible" ref="addActivityShopDialog" @refreshDataList="getList" />
<update-activity-shop-user-dialog v-if="updateUserActivityShopDialogVisible" ref="updateUserActivityShopDialog" @refreshDataList="getList" />
</div>
</template>
<script>
import { delActivityShop, listActivityShop } from '@/api/xq/activityShop'
import AddActivityShopDialog from '@/views/xq/activityShop/add-activity-shop-dialog.vue'
import UpdateActivityShopUserDialog from '@/views/xq/activityShop/update-activity-shop-user-dialog.vue'
export default {
name: "ActivityShop",
components: { AddActivityShopDialog,UpdateActivityShopUserDialog},
data() {
return {
// 遮罩层
loading: true,
addActivityShopDialogVisible: false,
updateActivityShopDialogVisible: false,
updateUserActivityShopDialogVisible: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 相亲会表格数据
activityShopList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
activityTitle: undefined,
cityName: undefined,
deleteFlag: 0
},
};
},
created() {
this.getList();
},
methods: {
/** 查询相亲会列表 */
getList() {
this.loading = true;
listActivityShop(this.queryParams).then(response => {
this.activityShopList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.addActivityShopDialogVisible = true
this.$nextTick(() => {
this.$refs.addActivityShopDialog.init()
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.addActivityShopDialogVisible = true
this.$nextTick(() => {
this.$refs.addActivityShopDialog.init(row.id)
})
},
handleUpdateUser(row) {
this.updateUserActivityShopDialogVisible = true
this.$nextTick(() => {
this.$refs.updateUserActivityShopDialog.init(row.id)
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除相亲会编号为"' + ids + '"的数据项?').then(() => {
this.loading = true;
return delActivityShop(ids);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
}
};
</script>
<style lang="scss" scoped>
.font-red {
color: red;
}
.font-green {
color: green;
}
.font-blue {
color: blue;
}
</style>