123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <template>
- <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
- :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
- :operation="operation" :exportList="exportList" :operationColumnWidth="210">
- <div slot="moreSearch">
- <el-radio-group v-model="type" size="mini" @change="changeType">
- <el-radio-button label="">全部({{ statistics.all || 0 }})</el-radio-button>
- <el-radio-button :label="1">进行中({{ statistics.jxz || 0 }})</el-radio-button>
- <el-radio-button :label="0">已结束({{ statistics.yjs || 0 }})</el-radio-button>
- </el-radio-group>
- <br><br>
- </div>
- </template-page>
- </template>
- <script>
- import TemplatePage from '@/components/template/template-page-1.vue'
- import import_mixin from '@/components/template/import_mixin.js'
- import { promotionGroupListPageV2, promotionGroupPageExport, getActivityCount, changeStatus } from '@/api/groupbuy'
- import { downloadFiles } from '@/utils/util'
- export default {
- components: { TemplatePage },
- mixins: [import_mixin],
- data() {
- return {
- type: "",
- statistics: {},
- // 事件组合
- optionsEvensGroup: [
- [
- [
- {
- name: '添加团购活动',
- isRole: true,
- click: () => {
- this.$router.push({
- name: "groupbuy_add",
- query: {}
- })
- }
- }
- ],
- ],
- ],
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: false
- },
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- // 勾选选中行
- recordSelected: [],
- }
- },
- computed: {
- // 更多参数
- moreParameters() {
- return []
- },
- },
- methods: {
- // 切换状态
- changeType(val) {
- this.$refs.pageRef.refreshList()
- },
- // 列表请求函数
- getList(p) {
- try {
- var pam = JSON.parse(JSON.stringify(p))
- if (this.type) {
- pam.status = this.type
- pam.params.push({ "param": "a.status", "compare": "=", "value": this.type })
- }
- return promotionGroupListPageV2(pam)
- } catch (error) {
- console.log(error)
- } finally {
- getActivityCount().then(res => {
- this.statistics = res.data
- })
- }
- },
- // 列表导出函数
- exportList: promotionGroupPageExport,
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- return defaultData
- },
- // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- // 表格操作列
- operation(h, { row, index, column }) {
- return (
- <div class='operation-btns'>
- <el-popconfirm
- title={`是否确定${Number(row.status) ? "关闭" : "开启"}?`}
- onConfirm={() => {
- changeStatus({ promotionGroupId: row.promotionGroupId, status: Number(row.status) ? 0 : 1 }).then(res => {
- this.$message({ type: 'success', message: `${Number(row.status) ? "关闭" : "开启"}成功!` })
- this.$refs.pageRef.refreshList()
- })
- }}
- >
- <el-button type="text" slot="reference">{Number(row.status) ? "关闭" : "开启"}</el-button>
- </el-popconfirm>
- <el-button type="text" onClick={() => {
- this.$router.push({
- name: "groupbuy_add",
- query: {
- id: row.promotionGroupId
- }
- })
- }}>编辑</el-button>
- <el-button type="text" onClick={() => {
- this.$router.push({
- name: "groupbuy_detail",
- query: {
- id: row.promotionGroupId
- }
- })
- }}>拼团详情</el-button>
- <el-button type="text" onClick={() => {
- let screenData = {
- promotionGroupId: row.promotionGroupId
- };
- downloadFiles('order/export', screenData);
- }}>导出订单</el-button>
- </div>
- )
- },
- }
- }
- </script>
- <style lang="scss" scoped></style>
|