|
| 1 | +<template> |
| 2 | + <ContentWrap> |
| 3 | + <!-- 搜索工作栏 --> |
| 4 | + <el-form |
| 5 | + class="-mb-15px" |
| 6 | + :model="queryParams" |
| 7 | + ref="queryFormRef" |
| 8 | + :inline="true" |
| 9 | + label-width="68px" |
| 10 | + > |
| 11 | + <el-form-item label="砍价状态" prop="status"> |
| 12 | + <el-select |
| 13 | + v-model="queryParams.status" |
| 14 | + placeholder="请选择砍价状态" |
| 15 | + clearable |
| 16 | + class="!w-240px" |
| 17 | + > |
| 18 | + <el-option |
| 19 | + v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_BARGAIN_RECORD_STATUS)" |
| 20 | + :key="dict.value" |
| 21 | + :label="dict.label" |
| 22 | + :value="dict.value" |
| 23 | + /> |
| 24 | + </el-select> |
| 25 | + </el-form-item> |
| 26 | + <el-form-item label="创建时间" prop="createTime"> |
| 27 | + <el-date-picker |
| 28 | + v-model="queryParams.createTime" |
| 29 | + value-format="YYYY-MM-DD HH:mm:ss" |
| 30 | + type="daterange" |
| 31 | + start-placeholder="开始日期" |
| 32 | + end-placeholder="结束日期" |
| 33 | + :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
| 34 | + class="!w-240px" |
| 35 | + /> |
| 36 | + </el-form-item> |
| 37 | + <el-form-item> |
| 38 | + <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |
| 39 | + <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> |
| 40 | + <el-button |
| 41 | + type="primary" |
| 42 | + plain |
| 43 | + @click="openForm('create')" |
| 44 | + v-hasPermi="['promotion:bargain-record:create']" |
| 45 | + > |
| 46 | + <Icon icon="ep:plus" class="mr-5px" /> 新增 |
| 47 | + </el-button> |
| 48 | + <el-button |
| 49 | + type="success" |
| 50 | + plain |
| 51 | + @click="handleExport" |
| 52 | + :loading="exportLoading" |
| 53 | + v-hasPermi="['promotion:bargain-record:export']" |
| 54 | + > |
| 55 | + <Icon icon="ep:download" class="mr-5px" /> 导出 |
| 56 | + </el-button> |
| 57 | + </el-form-item> |
| 58 | + </el-form> |
| 59 | + </ContentWrap> |
| 60 | + |
| 61 | + <!-- 列表 --> |
| 62 | + <ContentWrap> |
| 63 | + <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> |
| 64 | + <el-table-column label="编号" min-width="50" prop="id" /> |
| 65 | + <el-table-column label="发起用户" min-width="120"> |
| 66 | + <template #default="scope"> |
| 67 | + <el-image |
| 68 | + :src="scope.row.avatar" |
| 69 | + class="h-20px w-20px" |
| 70 | + :preview-src-list="[scope.row.avatar]" |
| 71 | + preview-teleported |
| 72 | + /> |
| 73 | + {{ scope.row.nickname }} |
| 74 | + </template> |
| 75 | + </el-table-column> |
| 76 | + <el-table-column |
| 77 | + label="发起时间" |
| 78 | + align="center" |
| 79 | + prop="createTime" |
| 80 | + :formatter="dateFormatter" |
| 81 | + width="180px" |
| 82 | + /> |
| 83 | + <el-table-column label="砍价活动" min-width="150" prop="activity.name" /> |
| 84 | + <el-table-column |
| 85 | + label="最低价" |
| 86 | + min-width="100" |
| 87 | + prop="activity.bargainMinPrice" |
| 88 | + :formatter="fenToYuanFormat" |
| 89 | + /> |
| 90 | + <el-table-column |
| 91 | + label="当前价" |
| 92 | + min-width="100" |
| 93 | + prop="bargainPrice" |
| 94 | + :formatter="fenToYuanFormat" |
| 95 | + /> |
| 96 | + <el-table-column label="总砍价次数" min-width="100" prop="activity.helpMaxCount" /> |
| 97 | + <el-table-column label="剩余砍价次数" min-width="100" prop="helpCount" /> |
| 98 | + <el-table-column label="砍价状态" align="center" prop="status"> |
| 99 | + <template #default="scope"> |
| 100 | + <dict-tag :type="DICT_TYPE.PROMOTION_BARGAIN_RECORD_STATUS" :value="scope.row.status" /> |
| 101 | + </template> |
| 102 | + </el-table-column> |
| 103 | + <el-table-column |
| 104 | + label="结束时间" |
| 105 | + align="center" |
| 106 | + prop="endTime" |
| 107 | + :formatter="dateFormatter" |
| 108 | + width="180px" |
| 109 | + /> |
| 110 | + <el-table-column label="订单编号" align="center" prop="orderId" /> |
| 111 | + <el-table-column label="操作" align="center"> |
| 112 | + <template #default="scope"> |
| 113 | + <el-button |
| 114 | + link |
| 115 | + type="primary" |
| 116 | + @click="openForm('update', scope.row.id)" |
| 117 | + v-hasPermi="['promotion:bargain-record:update']" |
| 118 | + > |
| 119 | + 编辑 |
| 120 | + </el-button> |
| 121 | + </template> |
| 122 | + </el-table-column> |
| 123 | + </el-table> |
| 124 | + <!-- 分页 --> |
| 125 | + <Pagination |
| 126 | + :total="total" |
| 127 | + v-model:page="queryParams.pageNo" |
| 128 | + v-model:limit="queryParams.pageSize" |
| 129 | + @pagination="getList" |
| 130 | + /> |
| 131 | + </ContentWrap> |
| 132 | + |
| 133 | + <!-- 表单弹窗:添加/修改 --> |
| 134 | + <!-- <BargainRecordForm ref="formRef" @success="getList" />--> |
| 135 | +</template> |
| 136 | + |
| 137 | +<script setup lang="ts"> |
| 138 | +import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
| 139 | +import { dateFormatter } from '@/utils/formatTime' |
| 140 | +import * as BargainRecordApi from '@/api/mall/promotion/bargain/bargainRecord' |
| 141 | +import { fenToYuanFormat } from '@/utils/formatter' |
| 142 | +// import BargainRecordForm from './BargainRecordForm.vue' |
| 143 | +
|
| 144 | +defineOptions({ name: 'PromotionBargainRecord' }) |
| 145 | +
|
| 146 | +const message = useMessage() // 消息弹窗 |
| 147 | +const { t } = useI18n() // 国际化 |
| 148 | +
|
| 149 | +const loading = ref(true) // 列表的加载中 |
| 150 | +const total = ref(0) // 列表的总页数 |
| 151 | +const list = ref([]) // 列表的数据 |
| 152 | +const queryParams = reactive({ |
| 153 | + pageNo: 1, |
| 154 | + pageSize: 10, |
| 155 | + status: null, |
| 156 | + createTime: [] |
| 157 | +}) |
| 158 | +const queryFormRef = ref() // 搜索的表单 |
| 159 | +const exportLoading = ref(false) // 导出的加载中 |
| 160 | +
|
| 161 | +/** 查询列表 */ |
| 162 | +const getList = async () => { |
| 163 | + loading.value = true |
| 164 | + try { |
| 165 | + const data = await BargainRecordApi.getBargainRecordPage(queryParams) |
| 166 | + list.value = data.list |
| 167 | + total.value = data.total |
| 168 | + } finally { |
| 169 | + loading.value = false |
| 170 | + } |
| 171 | +} |
| 172 | +
|
| 173 | +/** 搜索按钮操作 */ |
| 174 | +const handleQuery = () => { |
| 175 | + queryParams.pageNo = 1 |
| 176 | + getList() |
| 177 | +} |
| 178 | +
|
| 179 | +/** 重置按钮操作 */ |
| 180 | +const resetQuery = () => { |
| 181 | + queryFormRef.value.resetFields() |
| 182 | + handleQuery() |
| 183 | +} |
| 184 | +
|
| 185 | +/** 添加/修改操作 */ |
| 186 | +const formRef = ref() |
| 187 | +const openForm = (type: string, id?: number) => { |
| 188 | + formRef.value.open(type, id) |
| 189 | +} |
| 190 | +
|
| 191 | +/** 初始化 **/ |
| 192 | +onMounted(() => { |
| 193 | + getList() |
| 194 | +}) |
| 195 | +</script> |
0 commit comments