ll
liukangdong
2025-02-20 b565a275fe240e2bd8a939c3b4beed98d03767bc
admin/src/views/combo/index.vue
@@ -5,19 +5,52 @@
      <el-button type="primary" @click="handleEdit()">新增</el-button>
    </div>
    <el-table v-loading="loading" :data="list" stripe border>
      <el-table-column prop="code" label="套餐名称" align="center" min-width="120" show-overflow-tooltip />
      <el-table-column prop="" label="套餐类型" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="次数" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="有效期" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="价格" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="总发行数量" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="已售售量" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="销售渠道" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="销售时段" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="状态" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column label="操作" fixed="right" align="center" min-width="80" show-overflow-tooltip>
      <el-table-column prop="name" label="套餐名称" align="center" min-width="120" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span @click="handleDetail(row)" class="primaryColor pointer">查看详情</span>
          <span @click="handleDetail(row)" class="primaryColor pointer">{{ row.name }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="" label="套餐类型" align="center" min-width="100" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span v-if="row.type == 0">期限卡</span>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="" label="次数" align="center" min-width="100" show-overflow-tooltip /> -->
      <el-table-column prop="useDays" label="有效期" align="center" min-width="90" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span>{{ row.useDays }}天</span>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="价格" align="center" min-width="80" show-overflow-tooltip />
      <el-table-column prop="saleLimit" label="总发行数量" align="center" min-width="100" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span>{{ row.saleLimit ? row.saleLimit : '不限额' }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="saleNum" label="已售售量" align="center" min-width="100" show-overflow-tooltip />
      <el-table-column prop="" label="销售渠道" align="center" min-width="100" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span v-if="row.channel == 0">小程序</span>
        </template>
      </el-table-column>
      <el-table-column prop="" label="销售时段" align="center" min-width="120" show-overflow-tooltip>
        <template v-slot="{ row }">
          <div>起:{{ row.startDate }}</div>
          <div>止:{{ row.endDate }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="" fixed="right" label="状态" align="center" min-width="80" show-overflow-tooltip>
        <template v-slot="{ row }">
          <el-switch @change="changeStatus(row)" v-model="row.status" :active-value="0" :inactive-value="1" />
        </template>
      </el-table-column>
      <el-table-column label="操作" fixed="right" align="center" min-width="120" show-overflow-tooltip>
        <template v-slot="{ row }">
          <div>
            <span v-if="row.status == 0" @click="handleEdit(row, 'copy')" class="primaryColor pointer">复制</span>
            <span v-if="row.status == 1" @click="handleEdit(row)" class="primaryColor pointer mr10">编辑</span>
            <span v-if="row.status == 1" @click="handleDetail(row)" class="red pointer">删除</span>
          </div>
        </template>
      </el-table-column>
    </el-table>
@@ -35,6 +68,8 @@
import TableLayout from '@/layouts/TableLayout'
import Edit from './components/Edit'
import ComboDetail from './components/ComboDetail.vue'
import { comboListPost, comboEditPost } from '@/api/business/combo.js'
import { Message } from 'element-ui'
export default {
  extends: BasePageTemp,
  components: {
@@ -55,27 +90,35 @@
            label: '套餐名称',
          },
          {
            filed: 'type',
            filed: 'bikeOrElec',
            type: 'select',
            label: '适用项目',
            labelCode: 'name',
            valueCode: 'id',
            options: []
            options: [
              { name: '自行车', id: 1 },
              { name: '电动车', id: 2 },
            ]
          },
          {
            filed: 'status',
            type: 'select',
            label: '状态',
            options: []
            labelCode: 'name',
            valueCode: 'id',
            options: [
              { name: '正常', id: 0 },
              { name: '停用', id: 1 },
            ]
          },
        ],
        online: true
      },
      list: [{}]
      list: []
    }
  },
  created() {
    // this.getList()
    this.getList()
    // this.initData()
  },
  methods: {
@@ -86,17 +129,27 @@
        }
      })
    },
    handleEdit() {
    changeStatus(row) {
      comboEditPost({ ...row }).then(res => {
        if (res.code == 200) {
          return Message.success('更新成功')
        }
      })
    },
    handleEdit(row, type = 'edit') {
      this.isShowEdit = true
      this.$nextTick(() => {
        this.$refs.EditRef.isShowModal = true
        if (row && row.id) {
          this.$refs.EditRef.getDetail(row.id, type)
        }
      })
    },
    handleDetail(row) {
      this.isShowDetail = true
      this.$nextTick(() => {
        this.$refs.DetailRef.isShowModal = true
        // this.$refs.DetailRef.getDetail(row.id)
        this.$refs.DetailRef.getDetail(row.id)
      })
    },
    handleEx() {
@@ -129,20 +182,15 @@
      const { pagination, filters } = this
      this.loading = true
      if (page) { pagination.page = page }
      ywOutinboundPage({
      comboListPost({
        model: {
          ...filters,
          inOut: 0
          ...filters
        },
        // sorts: [{ direction: 'DESC', property: 'param1' }],
        capacity: pagination.pageSize,
        page: page,
      }).then(res => {
        this.loading = false
        this.list = res.records || []
        this.list.forEach(item => {
          item.typeName = this.StoreTypeOps[item.type].name
        })
        this.pagination.total = res.total || 0
      }, () => {
        this.loading = false