mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-10-31 02:08:45 +08:00 
			
		
		
		
	| @@ -8,32 +8,12 @@ export interface ConfigVO { | |||||||
|   tradeGivePoint: number |   tradeGivePoint: number | ||||||
| } | } | ||||||
|  |  | ||||||
| // 查询积分设置列表 |  | ||||||
| export const getConfigPage = async (params) => { |  | ||||||
|   return await request.get({ url: `/point/config/page`, params }) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // 查询积分设置详情 | // 查询积分设置详情 | ||||||
| export const getConfig = async (id: number) => { | export const getConfig = async () => { | ||||||
|   return await request.get({ url: `/point/config/get?id=` + id }) |   return await request.get({ url: `/point/config/get` }) | ||||||
| } | } | ||||||
|  |  | ||||||
| // 新增积分设置 | // 新增修改积分设置 | ||||||
| export const createConfig = async (data: ConfigVO) => { | export const saveConfig = async (data: ConfigVO) => { | ||||||
|   return await request.post({ url: `/point/config/create`, data }) |   return await request.put({ url: `/point/config/save`, data }) | ||||||
| } |  | ||||||
|  |  | ||||||
| // 修改积分设置 |  | ||||||
| export const updateConfig = async (data: ConfigVO) => { |  | ||||||
|   return await request.put({ url: `/point/config/update`, data }) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // 删除积分设置 |  | ||||||
| export const deleteConfig = async (id: number) => { |  | ||||||
|   return await request.delete({ url: `/point/config/delete?id=` + id }) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // 导出积分设置 Excel |  | ||||||
| export const exportConfig = async (params) => { |  | ||||||
|   return await request.download({ url: `/point/config/export-excel`, params }) |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -147,8 +147,8 @@ export enum DICT_TYPE { | |||||||
|  |  | ||||||
|   // ========== MALL - 会员模块 ========== |   // ========== MALL - 会员模块 ========== | ||||||
|   // 积分模块 TODO 芋艿:改成 member_ 前缀;包括枚举和值; |   // 积分模块 TODO 芋艿:改成 member_ 前缀;包括枚举和值; | ||||||
|   POINT_BIZ_TYPE = 'point_biz_type', |   MEMBER_POINT_BIZ_TYPE = 'member_point_biz_type', | ||||||
|   POINT_STATUS = 'point_status', |   MEMBER_POINT_STATUS = 'member_point_status', | ||||||
|  |  | ||||||
|   // ========== MALL - 商品模块 ========== |   // ========== MALL - 商品模块 ========== | ||||||
|   PRODUCT_UNIT = 'product_unit', // 商品单位 |   PRODUCT_UNIT = 'product_unit', // 商品单位 | ||||||
|   | |||||||
							
								
								
									
										88
									
								
								src/views/member/point/config/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								src/views/member/point/config/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | |||||||
|  | <template> | ||||||
|  |   <ContentWrap> | ||||||
|  |     <el-form | ||||||
|  |       ref="formRef" | ||||||
|  |       :model="formData" | ||||||
|  |       :rules="formRules" | ||||||
|  |       label-width="120px" | ||||||
|  |       v-loading="formLoading" | ||||||
|  |     > | ||||||
|  |       <el-form-item label="hideId" v-show="false"> | ||||||
|  |         <el-input v-model="formData.id" /> | ||||||
|  |       </el-form-item> | ||||||
|  |       <el-form-item label="积分抵扣" prop="tradeDeductEnable"> | ||||||
|  |         <el-switch v-model="formData.tradeDeductEnable" /> | ||||||
|  |       </el-form-item> | ||||||
|  |       <el-form-item label="抵扣单位(分)" prop="tradeDeductUnitPrice"> | ||||||
|  |         <el-input-number | ||||||
|  |           v-model="formData.tradeDeductUnitPrice" | ||||||
|  |           placeholder="请输入抵扣单位(分)" | ||||||
|  |           style="width: 300px" | ||||||
|  |         /> | ||||||
|  |       </el-form-item> | ||||||
|  |       <el-form-item label="积分抵扣最大值" prop="tradeDeductMaxPrice"> | ||||||
|  |         <el-input-number | ||||||
|  |           v-model="formData.tradeDeductMaxPrice" | ||||||
|  |           placeholder="请输入积分抵扣最大值" | ||||||
|  |           style="width: 300px" | ||||||
|  |         /> | ||||||
|  |       </el-form-item> | ||||||
|  |       <el-form-item label="1元赠送多少分" prop="tradeGivePoint"> | ||||||
|  |         <el-input-number | ||||||
|  |           v-model="formData.tradeGivePoint" | ||||||
|  |           placeholder="请输入1元赠送多少积分" | ||||||
|  |           style="width: 300px" | ||||||
|  |         /> | ||||||
|  |       </el-form-item> | ||||||
|  |       <el-form-item> | ||||||
|  |         <el-button type="primary" @click="onSubmit">提交</el-button> | ||||||
|  |       </el-form-item> | ||||||
|  |     </el-form> | ||||||
|  |   </ContentWrap> | ||||||
|  | </template> | ||||||
|  | <script lang="ts" setup> | ||||||
|  | import * as ConfigApi from '@/api/point/config' | ||||||
|  |  | ||||||
|  | const { t } = useI18n() // 国际化 | ||||||
|  | const message = useMessage() // 消息弹窗 | ||||||
|  |  | ||||||
|  | const dialogVisible = ref(false) // 弹窗的是否展示 | ||||||
|  | const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 | ||||||
|  | const formData = ref({ | ||||||
|  |   id: undefined, | ||||||
|  |   tradeDeductEnable: undefined, | ||||||
|  |   tradeDeductUnitPrice: undefined, | ||||||
|  |   tradeDeductMaxPrice: undefined, | ||||||
|  |   tradeGivePoint: undefined | ||||||
|  | }) | ||||||
|  | const formRules = reactive({}) | ||||||
|  | const formRef = ref() // 表单 Ref | ||||||
|  |  | ||||||
|  | const onSubmit = async () => { | ||||||
|  |   // 校验表单 | ||||||
|  |   if (!formRef) return | ||||||
|  |   const valid = await formRef.value.validate() | ||||||
|  |   if (!valid) return | ||||||
|  |   // 提交请求 | ||||||
|  |   formLoading.value = true | ||||||
|  |   try { | ||||||
|  |     const data = formData.value as unknown as ConfigApi.ConfigVO | ||||||
|  |     await ConfigApi.saveConfig(data) | ||||||
|  |     message.success(t('common.updateSuccess')) | ||||||
|  |     dialogVisible.value = false | ||||||
|  |   } finally { | ||||||
|  |     formLoading.value = false | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | const getConfig = async () => { | ||||||
|  |   try { | ||||||
|  |     const data = await ConfigApi.getConfig() | ||||||
|  |     formData.value = data | ||||||
|  |   } finally { | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | onMounted(() => { | ||||||
|  |   getConfig() | ||||||
|  | }) | ||||||
|  | </script> | ||||||
| @@ -13,7 +13,7 @@ | |||||||
|       <el-form-item label="业务类型" prop="bizType"> |       <el-form-item label="业务类型" prop="bizType"> | ||||||
|         <el-select v-model="formData.bizType" placeholder="请选择业务类型"> |         <el-select v-model="formData.bizType" placeholder="请选择业务类型"> | ||||||
|           <el-option |           <el-option | ||||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.POINT_BIZ_TYPE)" |             v-for="dict in getStrDictOptions(DICT_TYPE.MEMBER_POINT_BIZ_TYPE)" | ||||||
|             :key="dict.value" |             :key="dict.value" | ||||||
|             :label="dict.label" |             :label="dict.label" | ||||||
|             :value="dict.value" |             :value="dict.value" | ||||||
| @@ -41,7 +41,7 @@ | |||||||
|       <el-form-item label="积分状态" prop="status"> |       <el-form-item label="积分状态" prop="status"> | ||||||
|         <el-select v-model="formData.status" placeholder="积分状态"> |         <el-select v-model="formData.status" placeholder="积分状态"> | ||||||
|           <el-option |           <el-option | ||||||
|             v-for="dict in getIntDictOptions(DICT_TYPE.POINT_STATUS)" |             v-for="dict in getIntDictOptions(DICT_TYPE.MEMBER_POINT_STATUS)" | ||||||
|             :key="dict.value" |             :key="dict.value" | ||||||
|             :label="dict.label" |             :label="dict.label" | ||||||
|             :value="dict.value" |             :value="dict.value" | ||||||
| @@ -25,7 +25,7 @@ | |||||||
|           class="!w-240px" |           class="!w-240px" | ||||||
|         > |         > | ||||||
|           <el-option |           <el-option | ||||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.POINT_BIZ_TYPE)" |             v-for="dict in getStrDictOptions(DICT_TYPE.MEMBER_POINT_BIZ_TYPE)" | ||||||
|             :key="dict.value" |             :key="dict.value" | ||||||
|             :label="dict.label" |             :label="dict.label" | ||||||
|             :value="dict.value" |             :value="dict.value" | ||||||
| @@ -50,7 +50,7 @@ | |||||||
|       <el-form-item label="积分状态" prop="status"> |       <el-form-item label="积分状态" prop="status"> | ||||||
|         <el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px"> |         <el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px"> | ||||||
|           <el-option |           <el-option | ||||||
|             v-for="dict in getIntDictOptions(DICT_TYPE.POINT_STATUS)" |             v-for="dict in getIntDictOptions(DICT_TYPE.MEMBER_POINT_STATUS)" | ||||||
|             :key="dict.value" |             :key="dict.value" | ||||||
|             :label="dict.label" |             :label="dict.label" | ||||||
|             :value="dict.value" |             :value="dict.value" | ||||||
| @@ -71,18 +71,6 @@ | |||||||
|       <el-form-item> |       <el-form-item> | ||||||
|         <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |         <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> | ||||||
|         <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> |         <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> | ||||||
|         <el-button type="primary" @click="openForm('create')" v-hasPermi="['point:record:create']"> |  | ||||||
|           <Icon icon="ep:plus" class="mr-5px" /> 新增 |  | ||||||
|         </el-button> |  | ||||||
|         <el-button |  | ||||||
|           type="success" |  | ||||||
|           plain |  | ||||||
|           @click="handleExport" |  | ||||||
|           :loading="exportLoading" |  | ||||||
|           v-hasPermi="['point:record:export']" |  | ||||||
|         > |  | ||||||
|           <Icon icon="ep:download" class="mr-5px" /> 导出 |  | ||||||
|         </el-button> |  | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|     </el-form> |     </el-form> | ||||||
|   </ContentWrap> |   </ContentWrap> | ||||||
| @@ -94,7 +82,7 @@ | |||||||
|       <el-table-column label="业务编码" align="center" prop="bizId" /> |       <el-table-column label="业务编码" align="center" prop="bizId" /> | ||||||
|       <el-table-column label="业务类型" align="center" prop="bizType"> |       <el-table-column label="业务类型" align="center" prop="bizType"> | ||||||
|         <template #default="scope"> |         <template #default="scope"> | ||||||
|           <dict-tag :type="DICT_TYPE.POINT_BIZ_TYPE" :value="scope.row.bizType" /> |           <dict-tag :type="DICT_TYPE.MEMBER_POINT_BIZ_TYPE" :value="scope.row.bizType" /> | ||||||
|         </template> |         </template> | ||||||
|       </el-table-column> |       </el-table-column> | ||||||
|       <el-table-column |       <el-table-column | ||||||
| @@ -113,7 +101,7 @@ | |||||||
|       <el-table-column label="变动后的积分" align="center" prop="totalPoint" /> |       <el-table-column label="变动后的积分" align="center" prop="totalPoint" /> | ||||||
|       <el-table-column label="状态" align="center" prop="status"> |       <el-table-column label="状态" align="center" prop="status"> | ||||||
|         <template #default="scope"> |         <template #default="scope"> | ||||||
|           <dict-tag :type="DICT_TYPE.POINT_STATUS" :value="scope.row.status" /> |           <dict-tag :type="DICT_TYPE.MEMBER_POINT_STATUS" :value="scope.row.status" /> | ||||||
|         </template> |         </template> | ||||||
|       </el-table-column> |       </el-table-column> | ||||||
|       <el-table-column label="用户id" align="center" prop="userId" /> |       <el-table-column label="用户id" align="center" prop="userId" /> | ||||||
| @@ -135,26 +123,6 @@ | |||||||
|         prop="createDate" |         prop="createDate" | ||||||
|         :formatter="dateFormatter" |         :formatter="dateFormatter" | ||||||
|       /> |       /> | ||||||
|       <el-table-column label="操作" align="center"> |  | ||||||
|         <template #default="scope"> |  | ||||||
|           <el-button |  | ||||||
|             link |  | ||||||
|             type="primary" |  | ||||||
|             @click="openForm('update', scope.row.id)" |  | ||||||
|             v-hasPermi="['point:record:update']" |  | ||||||
|           > |  | ||||||
|             编辑 |  | ||||||
|           </el-button> |  | ||||||
|           <el-button |  | ||||||
|             link |  | ||||||
|             type="danger" |  | ||||||
|             @click="handleDelete(scope.row.id)" |  | ||||||
|             v-hasPermi="['point:record:delete']" |  | ||||||
|           > |  | ||||||
|             删除 |  | ||||||
|           </el-button> |  | ||||||
|         </template> |  | ||||||
|       </el-table-column> |  | ||||||
|     </el-table> |     </el-table> | ||||||
|     <!-- 分页 --> |     <!-- 分页 --> | ||||||
|     <Pagination |     <Pagination | ||||||
| @@ -172,15 +140,11 @@ | |||||||
| <script lang="ts" setup> | <script lang="ts" setup> | ||||||
| import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' | import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' | ||||||
| import { dateFormatter } from '@/utils/formatTime' | import { dateFormatter } from '@/utils/formatTime' | ||||||
| import download from '@/utils/download' |  | ||||||
| import * as RecordApi from '@/api/point/record' | import * as RecordApi from '@/api/point/record' | ||||||
| import RecordForm from './RecordForm.vue' | import RecordForm from './RecordForm.vue' | ||||||
| 
 | 
 | ||||||
| defineOptions({ name: 'PointRecord' }) | defineOptions({ name: 'PointRecord' }) | ||||||
| 
 | 
 | ||||||
| const message = useMessage() // 消息弹窗 |  | ||||||
| const { t } = useI18n() // 国际化 |  | ||||||
| 
 |  | ||||||
| const loading = ref(true) // 列表的加载中 | const loading = ref(true) // 列表的加载中 | ||||||
| const total = ref(0) // 列表的总页数 | const total = ref(0) // 列表的总页数 | ||||||
| const list = ref([]) // 列表的数据 | const list = ref([]) // 列表的数据 | ||||||
| @@ -195,7 +159,6 @@ const queryParams = reactive({ | |||||||
|   createDate: [] |   createDate: [] | ||||||
| }) | }) | ||||||
| const queryFormRef = ref() // 搜索的表单 | const queryFormRef = ref() // 搜索的表单 | ||||||
| const exportLoading = ref(false) // 导出的加载中 |  | ||||||
| 
 | 
 | ||||||
| /** 查询列表 */ | /** 查询列表 */ | ||||||
| const getList = async () => { | const getList = async () => { | ||||||
| @@ -221,40 +184,6 @@ const resetQuery = () => { | |||||||
|   handleQuery() |   handleQuery() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 添加/修改操作 */ |  | ||||||
| const formRef = ref() |  | ||||||
| const openForm = (type: string, id?: number) => { |  | ||||||
|   formRef.value.open(type, id) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /** 删除按钮操作 */ |  | ||||||
| const handleDelete = async (id: number) => { |  | ||||||
|   try { |  | ||||||
|     // 删除的二次确认 |  | ||||||
|     await message.delConfirm() |  | ||||||
|     // 发起删除 |  | ||||||
|     await RecordApi.deleteRecord(id) |  | ||||||
|     message.success(t('common.delSuccess')) |  | ||||||
|     // 刷新列表 |  | ||||||
|     await getList() |  | ||||||
|   } catch {} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /** 导出按钮操作 */ |  | ||||||
| const handleExport = async () => { |  | ||||||
|   try { |  | ||||||
|     // 导出的二次确认 |  | ||||||
|     await message.exportConfirm() |  | ||||||
|     // 发起导出 |  | ||||||
|     exportLoading.value = true |  | ||||||
|     const data = await RecordApi.exportRecord(queryParams) |  | ||||||
|     download.excel(data, '用户积分记录.xls') |  | ||||||
|   } catch { |  | ||||||
|   } finally { |  | ||||||
|     exportLoading.value = false |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /** 初始化 **/ | /** 初始化 **/ | ||||||
| onMounted(() => { | onMounted(() => { | ||||||
|   getList() |   getList() | ||||||
| @@ -1,122 +0,0 @@ | |||||||
| <template> |  | ||||||
|   <Dialog :title="dialogTitle" v-model="dialogVisible" style="width: 600px"> |  | ||||||
|     <el-form |  | ||||||
|       ref="formRef" |  | ||||||
|       :model="formData" |  | ||||||
|       :rules="formRules" |  | ||||||
|       label-width="120px" |  | ||||||
|       v-loading="formLoading" |  | ||||||
|     > |  | ||||||
|       <el-form-item label="积分抵扣" prop="tradeDeductEnable"> |  | ||||||
|         <el-select v-model="formData.tradeDeductEnable" placeholder="请选择是否开启"> |  | ||||||
|           <el-option |  | ||||||
|             v-for="dict in options" |  | ||||||
|             :key="dict.value" |  | ||||||
|             :label="dict.label" |  | ||||||
|             :value="dict.value" |  | ||||||
|           /> |  | ||||||
|         </el-select> |  | ||||||
|       </el-form-item> |  | ||||||
|       <el-form-item label="抵扣单位(元)" prop="tradeDeductUnitPrice"> |  | ||||||
|         <el-input v-model="formData.tradeDeductUnitPrice" placeholder="请输入抵扣单位(元)" /> |  | ||||||
|       </el-form-item> |  | ||||||
|       <el-form-item label="积分抵扣最大值" prop="tradeDeductMaxPrice"> |  | ||||||
|         <el-input v-model="formData.tradeDeductMaxPrice" placeholder="请输入积分抵扣最大值" /> |  | ||||||
|       </el-form-item> |  | ||||||
|       <el-form-item label="1元赠送多少分" prop="tradeGivePoint"> |  | ||||||
|         <el-input v-model="formData.tradeGivePoint" placeholder="请输入1元赠送多少分" /> |  | ||||||
|       </el-form-item> |  | ||||||
|     </el-form> |  | ||||||
|     <template #footer> |  | ||||||
|       <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button> |  | ||||||
|       <el-button @click="dialogVisible = false">取 消</el-button> |  | ||||||
|     </template> |  | ||||||
|   </Dialog> |  | ||||||
| </template> |  | ||||||
| <script lang="ts" setup> |  | ||||||
| import * as ConfigApi from '@/api/point/config' |  | ||||||
|  |  | ||||||
| const { t } = useI18n() // 国际化 |  | ||||||
| const message = useMessage() // 消息弹窗 |  | ||||||
|  |  | ||||||
| const dialogVisible = ref(false) // 弹窗的是否展示 |  | ||||||
| const dialogTitle = ref('') // 弹窗的标题 |  | ||||||
| const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |  | ||||||
| const formType = ref('') // 表单的类型:create - 新增;update - 修改 |  | ||||||
| const formData = ref({ |  | ||||||
|   id: undefined, |  | ||||||
|   tradeDeductEnable: undefined, |  | ||||||
|   tradeDeductUnitPrice: undefined, |  | ||||||
|   tradeDeductMaxPrice: undefined, |  | ||||||
|   tradeGivePoint: undefined |  | ||||||
| }) |  | ||||||
| const formRules = reactive({}) |  | ||||||
| const formRef = ref() // 表单 Ref |  | ||||||
|  |  | ||||||
| const options = [ |  | ||||||
|   { |  | ||||||
|     value: '1', |  | ||||||
|     label: '是' |  | ||||||
|   }, |  | ||||||
|   { |  | ||||||
|     value: '0', |  | ||||||
|     label: '否' |  | ||||||
|   } |  | ||||||
| ] |  | ||||||
|  |  | ||||||
| /** 打开弹窗 */ |  | ||||||
| const open = async (type: string, id?: number) => { |  | ||||||
|   dialogVisible.value = true |  | ||||||
|   dialogTitle.value = t('action.' + type) |  | ||||||
|   formType.value = type |  | ||||||
|   resetForm() |  | ||||||
|   // 修改时,设置数据 |  | ||||||
|   if (id) { |  | ||||||
|     formLoading.value = true |  | ||||||
|     try { |  | ||||||
|       formData.value = await ConfigApi.getConfig(id) |  | ||||||
|     } finally { |  | ||||||
|       formLoading.value = false |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |  | ||||||
|  |  | ||||||
| /** 提交表单 */ |  | ||||||
| const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |  | ||||||
| const submitForm = async () => { |  | ||||||
|   // 校验表单 |  | ||||||
|   if (!formRef) return |  | ||||||
|   const valid = await formRef.value.validate() |  | ||||||
|   if (!valid) return |  | ||||||
|   // 提交请求 |  | ||||||
|   formLoading.value = true |  | ||||||
|   try { |  | ||||||
|     const data = formData.value as unknown as ConfigApi.ConfigVO |  | ||||||
|     if (formType.value === 'create') { |  | ||||||
|       await ConfigApi.createConfig(data) |  | ||||||
|       message.success(t('common.createSuccess')) |  | ||||||
|     } else { |  | ||||||
|       await ConfigApi.updateConfig(data) |  | ||||||
|       message.success(t('common.updateSuccess')) |  | ||||||
|     } |  | ||||||
|     dialogVisible.value = false |  | ||||||
|     // 发送操作成功的事件 |  | ||||||
|     emit('success') |  | ||||||
|   } finally { |  | ||||||
|     formLoading.value = false |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** 重置表单 */ |  | ||||||
| const resetForm = () => { |  | ||||||
|   formData.value = { |  | ||||||
|     id: undefined, |  | ||||||
|     tradeDeductEnable: undefined, |  | ||||||
|     tradeDeductUnitPrice: undefined, |  | ||||||
|     tradeDeductMaxPrice: undefined, |  | ||||||
|     tradeGivePoint: undefined |  | ||||||
|   } |  | ||||||
|   formRef.value?.resetFields() |  | ||||||
| } |  | ||||||
| </script> |  | ||||||
| @@ -1,202 +0,0 @@ | |||||||
| <template> |  | ||||||
|   <ContentWrap> |  | ||||||
|     <!-- 搜索工作栏 --> |  | ||||||
|     <el-form |  | ||||||
|       class="-mb-15px" |  | ||||||
|       :model="queryParams" |  | ||||||
|       ref="queryFormRef" |  | ||||||
|       :inline="true" |  | ||||||
|       label-width="68px" |  | ||||||
|     > |  | ||||||
|       <el-form-item label="是否开启" prop="tradeDeductEnable"> |  | ||||||
|         <el-select |  | ||||||
|           v-model="queryParams.tradeDeductEnable" |  | ||||||
|           placeholder="请选择是否开启" |  | ||||||
|           clearable |  | ||||||
|           class="!w-240px" |  | ||||||
|         > |  | ||||||
|           <el-option |  | ||||||
|             v-for="dict in options" |  | ||||||
|             :key="dict.value" |  | ||||||
|             :label="dict.label" |  | ||||||
|             :value="dict.value" |  | ||||||
|           /> |  | ||||||
|         </el-select> |  | ||||||
|       </el-form-item> |  | ||||||
|       <el-form-item> |  | ||||||
|         <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |  | ||||||
|         <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> |  | ||||||
|         <el-button type="primary" @click="openForm('create')" v-hasPermi="['point:config:create']"> |  | ||||||
|           <Icon icon="ep:plus" class="mr-5px" /> 新增 |  | ||||||
|         </el-button> |  | ||||||
|         <el-button |  | ||||||
|           type="success" |  | ||||||
|           plain |  | ||||||
|           @click="handleExport" |  | ||||||
|           :loading="exportLoading" |  | ||||||
|           v-hasPermi="['point:config:export']" |  | ||||||
|         > |  | ||||||
|           <Icon icon="ep:download" class="mr-5px" /> 导出 |  | ||||||
|         </el-button> |  | ||||||
|       </el-form-item> |  | ||||||
|     </el-form> |  | ||||||
|   </ContentWrap> |  | ||||||
|  |  | ||||||
|   <!-- 列表 --> |  | ||||||
|   <ContentWrap> |  | ||||||
|     <el-table v-loading="loading" :data="list"> |  | ||||||
|       <el-table-column label="序号" align="center" prop="id" /> |  | ||||||
|       <el-table-column |  | ||||||
|         label="积分抵扣(是否开启)" |  | ||||||
|         align="center" |  | ||||||
|         prop="tradeDeductEnable" |  | ||||||
|         :formatter="tradeDeductFormat" |  | ||||||
|       /> |  | ||||||
|       <el-table-column label="抵扣单位(元)" align="center" prop="tradeDeductUnitPrice" /> |  | ||||||
|       <el-table-column label="积分抵扣最大值" align="center" prop="tradeDeductMaxPrice" /> |  | ||||||
|       <el-table-column label="1元赠送多少分" align="center" prop="tradeGivePoint" /> |  | ||||||
|       <el-table-column |  | ||||||
|         label="创建时间" |  | ||||||
|         align="center" |  | ||||||
|         prop="createTime" |  | ||||||
|         :formatter="dateFormatter" |  | ||||||
|       /> |  | ||||||
|       <el-table-column |  | ||||||
|         label="变更时间" |  | ||||||
|         align="center" |  | ||||||
|         prop="updateTime" |  | ||||||
|         :formatter="dateFormatter" |  | ||||||
|       /> |  | ||||||
|       <el-table-column label="操作" align="center"> |  | ||||||
|         <template #default="scope"> |  | ||||||
|           <el-button |  | ||||||
|             link |  | ||||||
|             type="primary" |  | ||||||
|             @click="openForm('update', scope.row.id)" |  | ||||||
|             v-hasPermi="['point:config:update']" |  | ||||||
|           > |  | ||||||
|             编辑 |  | ||||||
|           </el-button> |  | ||||||
|           <el-button |  | ||||||
|             link |  | ||||||
|             type="danger" |  | ||||||
|             @click="handleDelete(scope.row.id)" |  | ||||||
|             v-hasPermi="['point:config:delete']" |  | ||||||
|           > |  | ||||||
|             删除 |  | ||||||
|           </el-button> |  | ||||||
|         </template> |  | ||||||
|       </el-table-column> |  | ||||||
|     </el-table> |  | ||||||
|     <!-- 分页 --> |  | ||||||
|     <Pagination |  | ||||||
|       :total="total" |  | ||||||
|       v-model:page="queryParams.pageNo" |  | ||||||
|       v-model:limit="queryParams.pageSize" |  | ||||||
|       @pagination="getList" |  | ||||||
|     /> |  | ||||||
|   </ContentWrap> |  | ||||||
|  |  | ||||||
|   <!-- 表单弹窗:添加/修改 --> |  | ||||||
|   <ConfigForm ref="formRef" @success="getList" /> |  | ||||||
| </template> |  | ||||||
|  |  | ||||||
| <script lang="ts" setup> |  | ||||||
| import { dateFormatter } from '@/utils/formatTime' |  | ||||||
| import download from '@/utils/download' |  | ||||||
| import * as ConfigApi from '@/api/point/config' |  | ||||||
| import ConfigForm from './ConfigForm.vue' |  | ||||||
|  |  | ||||||
| defineOptions({ name: 'PointConfig' }) |  | ||||||
|  |  | ||||||
| const message = useMessage() // 消息弹窗 |  | ||||||
| const { t } = useI18n() // 国际化 |  | ||||||
|  |  | ||||||
| const loading = ref(true) // 列表的加载中 |  | ||||||
| const total = ref(0) // 列表的总页数 |  | ||||||
| const list = ref([]) // 列表的数据 |  | ||||||
| const queryParams = reactive({ |  | ||||||
|   pageNo: 1, |  | ||||||
|   pageSize: 10, |  | ||||||
|   tradeDeductEnable: null |  | ||||||
| }) |  | ||||||
| const queryFormRef = ref() // 搜索的表单 |  | ||||||
| const exportLoading = ref(false) // 导出的加载中 |  | ||||||
|  |  | ||||||
| const options = [ |  | ||||||
|   { |  | ||||||
|     value: '1', |  | ||||||
|     label: '是' |  | ||||||
|   }, |  | ||||||
|   { |  | ||||||
|     value: '0', |  | ||||||
|     label: '否' |  | ||||||
|   } |  | ||||||
| ] |  | ||||||
|  |  | ||||||
| const tradeDeductFormat = (row, column, cellValue) => { |  | ||||||
|   return cellValue === 1 ? '是' : '否' |  | ||||||
| } |  | ||||||
| /** 查询列表 */ |  | ||||||
| const getList = async () => { |  | ||||||
|   loading.value = true |  | ||||||
|   try { |  | ||||||
|     const data = await ConfigApi.getConfigPage(queryParams) |  | ||||||
|     list.value = data.list |  | ||||||
|     total.value = data.total |  | ||||||
|   } finally { |  | ||||||
|     loading.value = false |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** 搜索按钮操作 */ |  | ||||||
| const handleQuery = () => { |  | ||||||
|   queryParams.pageNo = 1 |  | ||||||
|   getList() |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** 重置按钮操作 */ |  | ||||||
| const resetQuery = () => { |  | ||||||
|   queryFormRef.value.resetFields() |  | ||||||
|   handleQuery() |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** 添加/修改操作 */ |  | ||||||
| const formRef = ref() |  | ||||||
| const openForm = (type: string, id?: number) => { |  | ||||||
|   formRef.value.open(type, id) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** 删除按钮操作 */ |  | ||||||
| const handleDelete = async (id: number) => { |  | ||||||
|   try { |  | ||||||
|     // 删除的二次确认 |  | ||||||
|     await message.delConfirm() |  | ||||||
|     // 发起删除 |  | ||||||
|     await ConfigApi.deleteConfig(id) |  | ||||||
|     message.success(t('common.delSuccess')) |  | ||||||
|     // 刷新列表 |  | ||||||
|     await getList() |  | ||||||
|   } catch {} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** 导出按钮操作 */ |  | ||||||
| const handleExport = async () => { |  | ||||||
|   try { |  | ||||||
|     // 导出的二次确认 |  | ||||||
|     await message.exportConfirm() |  | ||||||
|     // 发起导出 |  | ||||||
|     exportLoading.value = true |  | ||||||
|     const data = await ConfigApi.exportConfig(queryParams) |  | ||||||
|     download.excel(data, '积分设置.xls') |  | ||||||
|   } catch { |  | ||||||
|   } finally { |  | ||||||
|     exportLoading.value = false |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** 初始化 **/ |  | ||||||
| onMounted(() => { |  | ||||||
|   getList() |  | ||||||
| }) |  | ||||||
| </script> |  | ||||||
		Reference in New Issue
	
	Block a user
	 芋道源码
					芋道源码