mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-10-30 09:48:44 +08:00 
			
		
		
		
	提交订单列表和详情20230619
This commit is contained in:
		
							
								
								
									
										2
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							| @@ -8,7 +8,7 @@ | ||||
|     "source.fixAll.eslint": true | ||||
|   }, | ||||
|   "[vue]": { | ||||
|     "editor.defaultFormatter": "esbenp.prettier-vscode" | ||||
|     "editor.defaultFormatter": "Vue.volar" | ||||
|   }, | ||||
|   "[javascript]": { | ||||
|     "editor.defaultFormatter": "esbenp.prettier-vscode" | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "yudao-ui-admin-vue3", | ||||
|   "version": "1.7.2-snapshot", | ||||
|   "version": "1.7.3-snapshot", | ||||
|   "description": "基于vue3、vite4、element-plus、typesScript", | ||||
|   "author": "xingyu", | ||||
|   "private": false, | ||||
|   | ||||
| @@ -3,6 +3,7 @@ import { isDark } from '@/utils/is' | ||||
| import { useAppStore } from '@/store/modules/app' | ||||
| import { useDesign } from '@/hooks/web/useDesign' | ||||
| import { CACHE_KEY, useCache } from '@/hooks/web/useCache' | ||||
| import routerSearch from '@/components/RouterSearch/index.vue' | ||||
|  | ||||
| const { getPrefixCls } = useDesign() | ||||
| const prefixCls = getPrefixCls('app') | ||||
| @@ -24,10 +25,12 @@ setDefaultTheme() | ||||
| <template> | ||||
|   <ConfigGlobal :size="currentSize"> | ||||
|     <RouterView :class="greyMode ? `${prefixCls}-grey-mode` : ''" /> | ||||
|     <routerSearch /> | ||||
|   </ConfigGlobal> | ||||
| </template> | ||||
| <style lang="scss"> | ||||
| $prefix-cls: #{$namespace}-app; | ||||
|  | ||||
| .size { | ||||
|   width: 100%; | ||||
|   height: 100%; | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| import request from '@/config/axios' | ||||
|  | ||||
| // 获得交易订单分页 | ||||
| // TODO @xiaobai:改成 getOrderPage | ||||
| export const getOrderList = (params: PageParam) => { | ||||
|   return request.get({ url: '/trade/order/page', params }) | ||||
| } | ||||
|   | ||||
| @@ -1,3 +1,6 @@ | ||||
| // TODO @xiaobai:这个放到 order/index.ts  里哈 | ||||
| // TODO @xiaobai:注释放到变量后面,这样简洁一点 | ||||
| // TODO @xiaobai:这个改成 TradeOrderRespVO | ||||
| export interface TradeOrderPageItemRespVO { | ||||
|   // 订单编号 | ||||
|   id?: number | ||||
| @@ -87,6 +90,7 @@ export interface TradeOrderPageItemRespVO { | ||||
|   user?: MemberUserRespDTO | ||||
| } | ||||
|  | ||||
| // TODO @xiaobai:这个改成 TradeOrderItemRespVO | ||||
| /** | ||||
|  * 交易订单项 Base VO,提供给添加、修改、详细的子 VO 使用 | ||||
|  * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||||
|   | ||||
							
								
								
									
										39
									
								
								src/api/point/config/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/api/point/config/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| import request from '@/config/axios' | ||||
|  | ||||
| export interface ConfigVO { | ||||
|   id: number | ||||
|   tradeDeductEnable: number | ||||
|   tradeDeductUnitPrice: number | ||||
|   tradeDeductMaxPrice: number | ||||
|   tradeGivePoint: number | ||||
| } | ||||
|  | ||||
| // 查询积分设置列表 | ||||
| export const getConfigPage = async (params) => { | ||||
|   return await request.get({ url: `/point/config/page`, params }) | ||||
| } | ||||
|  | ||||
| // 查询积分设置详情 | ||||
| export const getConfig = async (id: number) => { | ||||
|   return await request.get({ url: `/point/config/get?id=` + id }) | ||||
| } | ||||
|  | ||||
| // 新增积分设置 | ||||
| export const createConfig = async (data: ConfigVO) => { | ||||
|   return await request.post({ url: `/point/config/create`, 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 }) | ||||
| } | ||||
							
								
								
									
										47
									
								
								src/api/point/record/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/api/point/record/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
| import request from '@/config/axios' | ||||
|  | ||||
| export interface RecordVO { | ||||
|   id: number | ||||
|   bizId: string | ||||
|   bizType: string | ||||
|   type: string | ||||
|   title: string | ||||
|   description: string | ||||
|   point: number | ||||
|   totalPoint: number | ||||
|   status: number | ||||
|   userId: number | ||||
|   freezingTime: Date | ||||
|   thawingTime: Date | ||||
|   createDate: Date | ||||
| } | ||||
|  | ||||
| // 查询用户积分记录列表 | ||||
| export const getRecordPage = async (params) => { | ||||
|   return await request.get({ url: `/point/record/page`, params }) | ||||
| } | ||||
|  | ||||
| // 查询用户积分记录详情 | ||||
| export const getRecord = async (id: number) => { | ||||
|   return await request.get({ url: `/point/record/get?id=` + id }) | ||||
| } | ||||
|  | ||||
| // 新增用户积分记录 | ||||
| export const createRecord = async (data: RecordVO) => { | ||||
|   return await request.post({ url: `/point/record/create`, data }) | ||||
| } | ||||
|  | ||||
| // 修改用户积分记录 | ||||
| export const updateRecord = async (data: RecordVO) => { | ||||
|   return await request.put({ url: `/point/record/update`, data }) | ||||
| } | ||||
|  | ||||
| // 删除用户积分记录 | ||||
| export const deleteRecord = async (id: number) => { | ||||
|   return await request.delete({ url: `/point/record/delete?id=` + id }) | ||||
| } | ||||
|  | ||||
| // 导出用户积分记录 Excel | ||||
| export const exportRecord = async (params) => { | ||||
|   return await request.download({ url: `/point/record/export-excel`, params }) | ||||
| } | ||||
							
								
								
									
										37
									
								
								src/api/point/signInConfig/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/api/point/signInConfig/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| import request from '@/config/axios' | ||||
|  | ||||
| export interface SignInConfigVO { | ||||
|   id: number | ||||
|   day: number | ||||
|   point: number | ||||
| } | ||||
|  | ||||
| // 查询积分签到规则列表 | ||||
| export const getSignInConfigPage = async (params) => { | ||||
|   return await request.get({ url: `/point/sign-in-config/page`, params }) | ||||
| } | ||||
|  | ||||
| // 查询积分签到规则详情 | ||||
| export const getSignInConfig = async (id: number) => { | ||||
|   return await request.get({ url: `/point/sign-in-config/get?id=` + id }) | ||||
| } | ||||
|  | ||||
| // 新增积分签到规则 | ||||
| export const createSignInConfig = async (data: SignInConfigVO) => { | ||||
|   return await request.post({ url: `/point/sign-in-config/create`, data }) | ||||
| } | ||||
|  | ||||
| // 修改积分签到规则 | ||||
| export const updateSignInConfig = async (data: SignInConfigVO) => { | ||||
|   return await request.put({ url: `/point/sign-in-config/update`, data }) | ||||
| } | ||||
|  | ||||
| // 删除积分签到规则 | ||||
| export const deleteSignInConfig = async (id: number) => { | ||||
|   return await request.delete({ url: `/point/sign-in-config/delete?id=` + id }) | ||||
| } | ||||
|  | ||||
| // 导出积分签到规则 Excel | ||||
| export const exportSignInConfig = async (params) => { | ||||
|   return await request.download({ url: `/point/sign-in-config/export-excel`, params }) | ||||
| } | ||||
							
								
								
									
										38
									
								
								src/api/point/signInRecord/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/api/point/signInRecord/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| import request from '@/config/axios' | ||||
|  | ||||
| export interface SignInRecordVO { | ||||
|   id: number | ||||
|   userId: number | ||||
|   day: number | ||||
|   point: number | ||||
| } | ||||
|  | ||||
| // 查询用户签到积分列表 | ||||
| export const getSignInRecordPage = async (params) => { | ||||
|   return await request.get({ url: `/point/sign-in-record/page`, params }) | ||||
| } | ||||
|  | ||||
| // 查询用户签到积分详情 | ||||
| export const getSignInRecord = async (id: number) => { | ||||
|   return await request.get({ url: `/point/sign-in-record/get?id=` + id }) | ||||
| } | ||||
|  | ||||
| // 新增用户签到积分 | ||||
| export const createSignInRecord = async (data: SignInRecordVO) => { | ||||
|   return await request.post({ url: `/point/sign-in-record/create`, data }) | ||||
| } | ||||
|  | ||||
| // 修改用户签到积分 | ||||
| export const updateSignInRecord = async (data: SignInRecordVO) => { | ||||
|   return await request.put({ url: `/point/sign-in-record/update`, data }) | ||||
| } | ||||
|  | ||||
| // 删除用户签到积分 | ||||
| export const deleteSignInRecord = async (id: number) => { | ||||
|   return await request.delete({ url: `/point/sign-in-record/delete?id=` + id }) | ||||
| } | ||||
|  | ||||
| // 导出用户签到积分 Excel | ||||
| export const exportSignInRecord = async (params) => { | ||||
|   return await request.download({ url: `/point/sign-in-record/export-excel`, params }) | ||||
| } | ||||
							
								
								
									
										76
									
								
								src/components/RouterSearch/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								src/components/RouterSearch/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,76 @@ | ||||
| <template> | ||||
|   <ElDialog v-model="showSearch" :show-close="false" title="菜单搜索"> | ||||
|     <el-select | ||||
|       filterable | ||||
|       :reserve-keyword="false" | ||||
|       remote | ||||
|       placeholder="请输入菜单内容" | ||||
|       :remote-method="remoteMethod" | ||||
|       style="width: 100%" | ||||
|       @change="handleChange" | ||||
|     > | ||||
|       <el-option | ||||
|         v-for="item in options" | ||||
|         :key="item.value" | ||||
|         :label="item.label" | ||||
|         :value="item.value" | ||||
|       /> | ||||
|     </el-select> | ||||
|   </ElDialog> | ||||
| </template> | ||||
|  | ||||
| <script setup lang="ts"> | ||||
| const router = useRouter() // 路由对象 | ||||
| const showSearch = ref(false) // 是否显示弹框 | ||||
| const value: Ref = ref('') // 用户输入的值 | ||||
|  | ||||
| const routers = router.getRoutes() // 路由对象 | ||||
| const options = computed(() => { | ||||
|   // 提示选项 | ||||
|   if (!value.value) { | ||||
|     return [] | ||||
|   } | ||||
|   const list = routers.filter((item: any) => { | ||||
|     if (item.meta.title?.indexOf(value.value) > -1 || item.path.indexOf(value.value) > -1) { | ||||
|       return true | ||||
|     } | ||||
|   }) | ||||
|   return list.map((item) => { | ||||
|     return { | ||||
|       label: `${item.meta.title}${item.path}`, | ||||
|       value: item.path | ||||
|     } | ||||
|   }) | ||||
| }) | ||||
|  | ||||
| function remoteMethod(data) { | ||||
|   // 这里可以执行相应的操作(例如打开搜索框等) | ||||
|   value.value = data | ||||
| } | ||||
|  | ||||
| function handleChange(path) { | ||||
|   router.push({ path }) | ||||
| } | ||||
|  | ||||
| onMounted(() => { | ||||
|   window.addEventListener('keydown', listenKey) | ||||
| }) | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   window.removeEventListener('keydown', listenKey) | ||||
| }) | ||||
|  | ||||
| // 监听 ctrl + k | ||||
| function listenKey(event) { | ||||
|   if ((event.ctrlKey || event.metaKey) && event.key === 'k') { | ||||
|     showSearch.value = !showSearch.value | ||||
|     // 这里可以执行相应的操作(例如打开搜索框等) | ||||
|   } | ||||
| } | ||||
|  | ||||
| defineExpose({ | ||||
|   openSearch: () => { | ||||
|     showSearch.value = true | ||||
|   } | ||||
| }) | ||||
| </script> | ||||
| @@ -371,7 +371,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ | ||||
|     }, | ||||
|     children: [ | ||||
|       { | ||||
|         path: 'productSpuAdd', // TODO @puhui999:最好拆成 add 和 edit 两个路由;添加商品;修改商品 fix | ||||
|         path: 'spu/add', | ||||
|         component: () => import('@/views/mall/product/spu/addForm.vue'), | ||||
|         name: 'ProductSpuAdd', | ||||
|         meta: { | ||||
| @@ -384,9 +384,9 @@ const remainingRouter: AppRouteRecordRaw[] = [ | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         path: 'productSpuEdit/:spuId(\\d+)', | ||||
|         path: 'spu/edit/:spuId(\\d+)', | ||||
|         component: () => import('@/views/mall/product/spu/addForm.vue'), | ||||
|         name: 'productSpuEdit', | ||||
|         name: 'ProductSpuEdit', | ||||
|         meta: { | ||||
|           noCache: true, | ||||
|           hidden: true, | ||||
| @@ -397,9 +397,9 @@ const remainingRouter: AppRouteRecordRaw[] = [ | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         path: 'productSpuDetail/:spuId(\\d+)', | ||||
|         path: 'spu/detail/:spuId(\\d+)', | ||||
|         component: () => import('@/views/mall/product/spu/addForm.vue'), | ||||
|         name: 'productSpuDetail', | ||||
|         name: 'ProductSpuDetail', | ||||
|         meta: { | ||||
|           noCache: true, | ||||
|           hidden: true, | ||||
|   | ||||
| @@ -145,23 +145,31 @@ export enum DICT_TYPE { | ||||
|   MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型 | ||||
|   MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型 | ||||
|  | ||||
|   // ========== MALL - PROMOTION 模块 ========== | ||||
|   PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型 | ||||
|   PROMOTION_PRODUCT_SCOPE = 'promotion_product_scope', // 营销的商品范围 | ||||
|   PROMOTION_COUPON_TEMPLATE_VALIDITY_TYPE = 'promotion_coupon_template_validity_type', // 优惠劵模板的有限期类型 | ||||
|   PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态 | ||||
|   PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式 | ||||
|   PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态 | ||||
|   PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举 | ||||
|   // ========== MALL - 会员模块 ========== | ||||
|   // 积分模块 TODO 芋艿:改成 member_ 前缀;包括枚举和值; | ||||
|   POINT_BIZ_TYPE = 'point_biz_type', | ||||
|   POINT_STATUS = 'point_status', | ||||
|  | ||||
|   //===add by 20230530==== | ||||
|   // ========== MALL - ORDER 模块 ========== | ||||
|   // ========== MALL - 商品模块 ========== | ||||
|   PRODUCT_UNIT = 'product_unit', // 商品单位 | ||||
|   PRODUCT_SPU_STATUS = 'product_spu_status', //商品状态 | ||||
|  | ||||
|   // ========== MALL - 交易模块 ========== | ||||
|   EXPRESS_CHARGE_MODE = 'trade_delivery_express_charge_mode', //快递的计费方式 | ||||
|   TRADE_AFTER_SALE_STATUS = 'trade_after_sale_status', // 售后 - 状态 | ||||
|   TRADE_AFTER_SALE_WAY = 'trade_after_sale_way', // 售后 - 方式 | ||||
|   TRADE_AFTER_SALE_TYPE = 'trade_after_sale_type', // 售后 - 类型 | ||||
|   TRADE_ORDER_TYPE = 'trade_order_type', // 订单 - 类型 | ||||
|   TRADE_ORDER_STATUS = 'trade_order_status', // 订单 - 状态 | ||||
|   TRADE_ORDER_ITEM_AFTER_SALE_STATUS = 'trade_order_item_after_sale_status', // 订单项 - 售后状态 | ||||
|   TERMINAL = 'terminal', // 终端 | ||||
|  | ||||
|   TERMINAL = 'terminal' | ||||
|   // ========== MALL - 营销模块 ========== | ||||
|   PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型 | ||||
|   PROMOTION_PRODUCT_SCOPE = 'promotion_product_scope', // 营销的商品范围 | ||||
|   PROMOTION_COUPON_TEMPLATE_VALIDITY_TYPE = 'promotion_coupon_template_validity_type', // 优惠劵模板的有限期类型 | ||||
|   PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态 | ||||
|   PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式 | ||||
|   PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态 | ||||
|   PROMOTION_CONDITION_TYPE = 'promotion_condition_type' // 营销的条件类型枚举 | ||||
| } | ||||
|   | ||||
| @@ -104,7 +104,7 @@ const getDetail = async () => { | ||||
|     formLoading.value = true | ||||
|     try { | ||||
|       const res = (await ProductSpuApi.getSpu(id)) as ProductSpuApi.Spu | ||||
|       res.skus!.forEach((item) => { | ||||
|       res.skus?.forEach((item) => { | ||||
|         // 回显价格分转元 | ||||
|         item.price = formatToFraction(item.price) | ||||
|         item.marketPrice = formatToFraction(item.marketPrice) | ||||
|   | ||||
| @@ -14,7 +14,6 @@ | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <el-col :span="12"> | ||||
|         <!-- TODO @puhui999:只能选根节点 fix: 已完善--> | ||||
|         <el-form-item label="商品分类" prop="categoryId"> | ||||
|           <el-tree-select | ||||
|             v-model="formData.categoryId" | ||||
| @@ -166,8 +165,7 @@ | ||||
|   </Descriptions> | ||||
|  | ||||
|   <!-- 商品属性添加 Form 表单 --> | ||||
|   <!-- TODO @puhui999: ProductPropertyAddForm 是不是更合适呀 --> | ||||
|   <ProductAttributesAddForm ref="attributesAddFormRef" :propertyList="propertyList" /> | ||||
|   <ProductPropertyAddForm ref="attributesAddFormRef" :propertyList="propertyList" /> | ||||
| </template> | ||||
| <script lang="ts" name="ProductSpuBasicInfoForm" setup> | ||||
| import { PropType } from 'vue' | ||||
| @@ -178,7 +176,7 @@ import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/uti | ||||
| import { createImageViewer } from '@/components/ImageViewer' | ||||
| import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' | ||||
| import { UploadImg, UploadImgs } from '@/components/UploadFile' | ||||
| import { ProductAttributes, ProductAttributesAddForm, SkuList } from './index' | ||||
| import { ProductAttributes, ProductPropertyAddForm, SkuList } from './index' | ||||
| import { basicInfoSchema } from './spu.data' | ||||
| import type { Spu } from '@/api/mall/product/spu' | ||||
| import * as ProductCategoryApi from '@/api/mall/product/category' | ||||
| @@ -258,7 +256,7 @@ watch( | ||||
|       return | ||||
|     } | ||||
|     copyValueToTarget(formData, data) | ||||
|     formData.sliderPicUrls = data['sliderPicUrls'].map((item) => ({ | ||||
|     formData.sliderPicUrls = data['sliderPicUrls']?.map((item) => ({ | ||||
|       url: item | ||||
|     })) | ||||
|     // 只有是多规格才处理 | ||||
| @@ -267,16 +265,16 @@ watch( | ||||
|     } | ||||
|     //  直接拿返回的 skus 属性逆向生成出 propertyList | ||||
|     const properties = [] | ||||
|     formData.skus.forEach((sku) => { | ||||
|       sku.properties.forEach(({ propertyId, propertyName, valueId, valueName }) => { | ||||
|     formData.skus?.forEach((sku) => { | ||||
|       sku.properties?.forEach(({ propertyId, propertyName, valueId, valueName }) => { | ||||
|         // 添加属性 | ||||
|         if (!properties.some((item) => item.id === propertyId)) { | ||||
|         if (!properties?.some((item) => item.id === propertyId)) { | ||||
|           properties.push({ id: propertyId, name: propertyName, values: [] }) | ||||
|         } | ||||
|         // 添加属性值 | ||||
|         const index = properties.findIndex((item) => item.id === propertyId) | ||||
|         if (!properties[index].values.some((value) => value.id === valueId)) { | ||||
|           properties[index].values.push({ id: valueId, name: valueName }) | ||||
|         const index = properties?.findIndex((item) => item.id === propertyId) | ||||
|         if (!properties[index].values?.some((value) => value.id === valueId)) { | ||||
|           properties[index].values?.push({ id: valueId, name: valueName }) | ||||
|         } | ||||
|       }) | ||||
|     }) | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
|     </template> | ||||
|   </Dialog> | ||||
| </template> | ||||
| <script lang="ts" name="ProductPropertyForm" setup> | ||||
| <script lang="ts" name="ProductPropertyAddForm" setup> | ||||
| import * as PropertyApi from '@/api/mall/product/property' | ||||
| 
 | ||||
| const { t } = useI18n() // 国际化 | ||||
| @@ -23,7 +23,6 @@ | ||||
|         min-width="120" | ||||
|       > | ||||
|         <template #default="{ row }"> | ||||
|           <!-- TODO puhui999:展示成蓝色,有点区分度哈 fix--> | ||||
|           <span style="font-weight: bold; color: #40aaff"> | ||||
|             {{ row.properties[index]?.valueName }} | ||||
|           </span> | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import BasicInfoForm from './BasicInfoForm.vue' | ||||
| import DescriptionForm from './DescriptionForm.vue' | ||||
| import OtherSettingsForm from './OtherSettingsForm.vue' | ||||
| import ProductAttributes from './ProductAttributes.vue' | ||||
| import ProductAttributesAddForm from './ProductAttributesAddForm.vue' | ||||
| import ProductPropertyAddForm from './ProductPropertyAddForm.vue' | ||||
| import SkuList from './SkuList.vue' | ||||
|  | ||||
| export { | ||||
| @@ -10,6 +10,6 @@ export { | ||||
|   DescriptionForm, | ||||
|   OtherSettingsForm, | ||||
|   ProductAttributes, | ||||
|   ProductAttributesAddForm, | ||||
|   ProductPropertyAddForm, | ||||
|   SkuList | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import { CrudSchema } from '@/hooks/web/useCrudSchemas' | ||||
|  | ||||
| // TODO @puhui999:如果只要 detail,可以不用 CrudSchema,只要描述的 Schema | ||||
| export const basicInfoSchema = reactive<CrudSchema[]>([ | ||||
|   { | ||||
|     label: '商品名称', | ||||
|   | ||||
| @@ -396,18 +396,18 @@ const resetQuery = () => { | ||||
| const openForm = (id?: number) => { | ||||
|   // 修改 | ||||
|   if (typeof id === 'number') { | ||||
|     push('/product/productSpuEdit/' + id) | ||||
|     push('/product/spu/edit/' + id) | ||||
|     return | ||||
|   } | ||||
|   // 新增 | ||||
|   push('/product/productSpuAdd') | ||||
|   push({ name: 'ProductSpuAdd' }) | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 查看商品详情 | ||||
|  */ | ||||
| const openDetail = (id?: number) => { | ||||
|   push('/product/productSpuDetail/' + id) | ||||
|   push('/product/spu/detail/' + id) | ||||
| } | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
|         <el-select class="!w-280px" v-model="queryParams.status" clearable placeholder="全部"> | ||||
|           <el-option | ||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.TRADE_ORDER_STATUS)" | ||||
|             :key="dict.value" | ||||
|             :key="(dict.value as string)" | ||||
|             :label="dict.label" | ||||
|             :value="dict.value" | ||||
|           /> | ||||
| @@ -27,7 +27,7 @@ | ||||
|         > | ||||
|           <el-option | ||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.PAY_CHANNEL_CODE_TYPE)" | ||||
|             :key="dict.value" | ||||
|             :key="(dict.value as string)" | ||||
|             :label="dict.label" | ||||
|             :value="dict.value" | ||||
|           /> | ||||
| @@ -48,7 +48,7 @@ | ||||
|         <el-select class="!w-280px" v-model="queryParams.terminal" clearable placeholder="全部"> | ||||
|           <el-option | ||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.TERMINAL)" | ||||
|             :key="dict.value" | ||||
|             :key="(dict.value as string)" | ||||
|             :label="dict.label" | ||||
|             :value="dict.value" | ||||
|           /> | ||||
| @@ -58,7 +58,7 @@ | ||||
|         <el-select class="!w-280px" v-model="queryParams.type" clearable placeholder="全部"> | ||||
|           <el-option | ||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.TRADE_ORDER_TYPE)" | ||||
|             :key="dict.value" | ||||
|             :key="(dict.value as string)" | ||||
|             :label="dict.label" | ||||
|             :value="dict.value" | ||||
|           /> | ||||
| @@ -363,7 +363,6 @@ const handleDropType = (command: string) => { | ||||
|   } | ||||
|   //所有页按钮 | ||||
|   if (command === '2') { | ||||
|     initSelect() //重置之前选中的类容清空 | ||||
|     orderSelect.selectAllFlag = !orderSelect.selectAllFlag | ||||
|  | ||||
|     if (orderSelect.selectAllFlag) { | ||||
| @@ -379,6 +378,7 @@ const handleDropType = (command: string) => { | ||||
|       for (i; i < list.value.length; i++) { | ||||
|         list.value[i]['itemSelect'] = false | ||||
|       } | ||||
|       initSelect() //重置之前选中的类容清空 | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -494,54 +494,6 @@ const getList = async () => { | ||||
|   } | ||||
| } | ||||
|  | ||||
| // const getList = async () => { | ||||
| //   loading.value = true | ||||
| //   try { | ||||
| //     const data = await TradeOrderApi.getOrderList(queryParams) | ||||
| //     list.value = data.list | ||||
| //     total.value = data.total | ||||
| //     let i = 0 | ||||
| //     //给数组添加选中属性 itemSelect 默认为false 当前状态如果时全选 则新加载的页面都为选中状态 | ||||
|  | ||||
| //     if (orderSelect.selectAllFlag) { | ||||
| //       if (orderSelect.selectData && orderSelect.selectData.has(queryParams.pageNo)) { | ||||
| //         //页面已经加载过了 | ||||
| //         for (i = 0; i < list.value.length; i++) { | ||||
| //           if (orderSelect.selectData.get(queryParams.pageNo)!.has(list.value[i].id)) { | ||||
| //             list.value[i]['itemSelect'] = true //之前已经选取过了 | ||||
| //           } else { | ||||
| //             list.value[i]['itemSelect'] = false | ||||
| //           } | ||||
| //         } | ||||
| //       } else { | ||||
| //         //首次加载页面 默认全部选中 | ||||
| //         orderSelect.selectData.set(queryParams.pageNo, new Set<string>()) | ||||
| //         for (i = 0; i < list.value.length; i++) { | ||||
| //           list.value[i]['itemSelect'] = true | ||||
| //           orderSelect.selectData.get(queryParams.pageNo)!.add(list.value[i].id) | ||||
| //         } | ||||
| //       } | ||||
| //     } else { | ||||
| //       if (orderSelect.selectData && orderSelect.selectData.has(queryParams.pageNo)) { | ||||
| //         //页面已经加载过了 | ||||
| //         for (i = 0; i < list.value.length; i++) { | ||||
| //           if (orderSelect.selectData.get(queryParams.pageNo)!.has(list.value[i].id)) { | ||||
| //             list.value[i]['itemSelect'] = true //之前已经选取过了 | ||||
| //           } else { | ||||
| //             list.value[i]['itemSelect'] = false | ||||
| //           } | ||||
| //         } | ||||
| //       } else { | ||||
| //         for (i; i < list.value.length; i++) { | ||||
| //           list.value[i]['itemSelect'] = false //设置状态为未选中状态 | ||||
| //         } | ||||
| //       } | ||||
| //     } | ||||
| //   } finally { | ||||
| //     loading.value = false | ||||
| //   } | ||||
| // } | ||||
|  | ||||
| /** | ||||
|  * 跳转订单详情 | ||||
|  */ | ||||
|   | ||||
| @@ -124,11 +124,14 @@ | ||||
|           parseFloat((order.adjustPrice / 100.0) as unknown as string).toFixed(2) | ||||
|         }}</el-descriptions-item | ||||
|       > | ||||
|  | ||||
|       <el-descriptions-item> | ||||
|         <template #label><span style="color: red">商品优惠: </span></template> | ||||
|         <!-- 没理解TODO  order.totalPrice - order.totalPrice --> | ||||
|         ¥{{ | ||||
|           parseFloat((order.totalPrice - order.totalPrice / 100.0) as unknown as string).toFixed(2) | ||||
|           parseFloat(((order.totalPrice - order.totalPrice) / 100.0) as unknown as string).toFixed( | ||||
|             2 | ||||
|           ) | ||||
|         }} | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item> | ||||
| @@ -163,6 +166,7 @@ | ||||
|         </el-descriptions-item> | ||||
|  | ||||
|         <!-- 物流信息 --> | ||||
|         <!-- TODO @xiaobai:改成一个包裹哈;目前只允许发货一次 --> | ||||
|         <el-descriptions-item v-if="group.key === 'expressInfo'" labelClassName="no-colon"> | ||||
|           <!-- 循环包裹物流信息 --> | ||||
|           <div v-show="(pkgInfo = detailInfo[group.key]) !== null" style="border: 1px dashed"> | ||||
| @@ -222,6 +226,7 @@ | ||||
|   </ContentWrap> | ||||
| </template> | ||||
| <script lang="ts" name="TradeOrderDetail" setup> | ||||
| // TODO @xiaobai:在 order 下创建一个 order/detail,然后改名为 index.vue | ||||
| import { DICT_TYPE } from '@/utils/dict' | ||||
| import * as TradeOrderApi from '@/api/mall/trade/order' | ||||
| const message = useMessage() // 消息弹窗 | ||||
| @@ -235,7 +240,7 @@ const loading = ref(false) | ||||
| const order = ref<any>({ | ||||
|   items: [], | ||||
|   user: {} | ||||
| }) //详情数据 | ||||
| }) // 详情数据 | ||||
|  | ||||
| const detailGroups = ref([ | ||||
|   { | ||||
| @@ -301,7 +306,7 @@ const detailInfo = ref({ | ||||
|   ], | ||||
|   goodsInfo: [] // 商品详情tableData | ||||
| }) | ||||
| //暂考虑一次性加载详情页面所有数据 | ||||
| // 暂考虑一次性加载详情页面所有数据 TODO | ||||
| const getlist = async () => { | ||||
|   dialogVisible.value = true | ||||
|   loading.value = true | ||||
| @@ -327,9 +332,11 @@ const clipboardSuccess = () => { | ||||
|   &:not(:nth-child(1)) { | ||||
|     margin-top: 20px; | ||||
|   } | ||||
|  | ||||
|   .el-descriptions__title { | ||||
|     display: flex; | ||||
|     align-items: center; | ||||
|  | ||||
|     &::before { | ||||
|       content: ''; | ||||
|       display: inline-block; | ||||
| @@ -339,10 +346,13 @@ const clipboardSuccess = () => { | ||||
|       background-color: #409eff; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .el-descriptions-item__container { | ||||
|     margin: 0 10px; | ||||
|  | ||||
|     .no-colon { | ||||
|       margin: 0; | ||||
|  | ||||
|       &::after { | ||||
|         content: ''; | ||||
|       } | ||||
|   | ||||
							
								
								
									
										122
									
								
								src/views/point/config/ConfigForm.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								src/views/point/config/ConfigForm.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,122 @@ | ||||
| <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 setup lang="ts"> | ||||
| 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> | ||||
							
								
								
									
										199
									
								
								src/views/point/config/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										199
									
								
								src/views/point/config/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,199 @@ | ||||
| <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 setup lang="ts" name="PointConfig"> | ||||
| import { dateFormatter } from '@/utils/formatTime' | ||||
| import download from '@/utils/download' | ||||
| import * as ConfigApi from '@/api/point/config' | ||||
| import ConfigForm from './ConfigForm.vue' | ||||
| 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> | ||||
							
								
								
									
										179
									
								
								src/views/point/record/RecordForm.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								src/views/point/record/RecordForm.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,179 @@ | ||||
| <template> | ||||
|   <Dialog :title="dialogTitle" v-model="dialogVisible"> | ||||
|     <el-form | ||||
|       ref="formRef" | ||||
|       :model="formData" | ||||
|       :rules="formRules" | ||||
|       label-width="120px" | ||||
|       v-loading="formLoading" | ||||
|     > | ||||
|       <el-form-item label="业务编码" prop="bizId"> | ||||
|         <el-input v-model="formData.bizId" placeholder="请输入业务编码" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="业务类型" prop="bizType"> | ||||
|         <el-select v-model="formData.bizType" placeholder="请选择业务类型"> | ||||
|           <el-option | ||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.POINT_BIZ_TYPE)" | ||||
|             :key="dict.value" | ||||
|             :label="dict.label" | ||||
|             :value="dict.value" | ||||
|           /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="操作类型" prop="type"> | ||||
|         <el-select v-model="formData.type" placeholder="操作类型"> | ||||
|           <el-option label="增加" value="1" /> | ||||
|           <el-option label="扣减" value="0" /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="积分标题" prop="title"> | ||||
|         <el-input v-model="formData.title" placeholder="请输入积分标题" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="积分描述"> | ||||
|         <Editor :model-value="formData.description" height="150px" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="积分" prop="point"> | ||||
|         <el-input v-model="formData.point" placeholder="请输入积分" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="变动后的积分" prop="totalPoint"> | ||||
|         <el-input v-model="formData.totalPoint" placeholder="请输入变动后的积分" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="积分状态" prop="status"> | ||||
|         <el-select v-model="formData.status" placeholder="积分状态"> | ||||
|           <el-option | ||||
|             v-for="dict in getIntDictOptions(DICT_TYPE.POINT_STATUS)" | ||||
|             :key="dict.value" | ||||
|             :label="dict.label" | ||||
|             :value="dict.value" | ||||
|           /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="用户id" prop="userId"> | ||||
|         <el-input v-model="formData.userId" placeholder="请输入用户id" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="冻结时间" prop="freezingTime"> | ||||
|         <el-date-picker | ||||
|           v-model="formData.freezingTime" | ||||
|           type="date" | ||||
|           value-format="x" | ||||
|           placeholder="选择冻结时间" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="解冻时间" prop="thawingTime"> | ||||
|         <el-date-picker | ||||
|           v-model="formData.thawingTime" | ||||
|           type="date" | ||||
|           value-format="x" | ||||
|           placeholder="选择解冻时间" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="发生时间" prop="createDate"> | ||||
|         <el-date-picker | ||||
|           v-model="formData.createDate" | ||||
|           type="date" | ||||
|           value-format="x" | ||||
|           placeholder="选择发生时间" | ||||
|         /> | ||||
|       </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 setup lang="ts"> | ||||
| import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' | ||||
| import * as RecordApi from '@/api/point/record' | ||||
|  | ||||
| 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, | ||||
|   bizId: undefined, | ||||
|   bizType: undefined, | ||||
|   type: undefined, | ||||
|   title: undefined, | ||||
|   description: undefined, | ||||
|   point: undefined, | ||||
|   totalPoint: undefined, | ||||
|   status: undefined, | ||||
|   userId: undefined, | ||||
|   freezingTime: undefined, | ||||
|   thawingTime: undefined, | ||||
|   createDate: undefined | ||||
| }) | ||||
| const formRules = reactive({ | ||||
|   totalPoint: [{ required: true, message: '变动后的积分不能为空', trigger: 'blur' }] | ||||
| }) | ||||
| const formRef = ref() // 表单 Ref | ||||
|  | ||||
| /** 打开弹窗 */ | ||||
| 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 RecordApi.getRecord(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 RecordApi.RecordVO | ||||
|     if (formType.value === 'create') { | ||||
|       await RecordApi.createRecord(data) | ||||
|       message.success(t('common.createSuccess')) | ||||
|     } else { | ||||
|       await RecordApi.updateRecord(data) | ||||
|       message.success(t('common.updateSuccess')) | ||||
|     } | ||||
|     dialogVisible.value = false | ||||
|     // 发送操作成功的事件 | ||||
|     emit('success') | ||||
|   } finally { | ||||
|     formLoading.value = false | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** 重置表单 */ | ||||
| const resetForm = () => { | ||||
|   formData.value = { | ||||
|     id: undefined, | ||||
|     bizId: undefined, | ||||
|     bizType: undefined, | ||||
|     type: undefined, | ||||
|     title: undefined, | ||||
|     description: undefined, | ||||
|     point: undefined, | ||||
|     totalPoint: undefined, | ||||
|     status: undefined, | ||||
|     userId: undefined, | ||||
|     freezingTime: undefined, | ||||
|     thawingTime: undefined, | ||||
|     createDate: undefined | ||||
|   } | ||||
|   formRef.value?.resetFields() | ||||
| } | ||||
| </script> | ||||
							
								
								
									
										259
									
								
								src/views/point/record/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										259
									
								
								src/views/point/record/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,259 @@ | ||||
| <template> | ||||
|   <ContentWrap> | ||||
|     <!-- 搜索工作栏 --> | ||||
|     <el-form | ||||
|       class="-mb-15px" | ||||
|       :model="queryParams" | ||||
|       ref="queryFormRef" | ||||
|       :inline="true" | ||||
|       label-width="68px" | ||||
|     > | ||||
|       <el-form-item label="业务编码" prop="bizId"> | ||||
|         <el-input | ||||
|           v-model="queryParams.bizId" | ||||
|           placeholder="请输入业务编码" | ||||
|           clearable | ||||
|           @keyup.enter="handleQuery" | ||||
|           class="!w-240px" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="业务类型" prop="bizType"> | ||||
|         <el-select | ||||
|           v-model="queryParams.bizType" | ||||
|           placeholder="请选择业务类型" | ||||
|           clearable | ||||
|           class="!w-240px" | ||||
|         > | ||||
|           <el-option | ||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.POINT_BIZ_TYPE)" | ||||
|             :key="dict.value" | ||||
|             :label="dict.label" | ||||
|             :value="dict.value" | ||||
|           /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="操作类型" prop="type"> | ||||
|         <el-select v-model="queryParams.type" placeholder="操作类型" clearable class="!w-240px"> | ||||
|           <el-option label="增加" value="1" /> | ||||
|           <el-option label="扣减" value="0" /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="积分标题" prop="title"> | ||||
|         <el-input | ||||
|           v-model="queryParams.title" | ||||
|           placeholder="请输入积分标题" | ||||
|           clearable | ||||
|           @keyup.enter="handleQuery" | ||||
|           class="!w-240px" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="积分状态" prop="status"> | ||||
|         <el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px"> | ||||
|           <el-option | ||||
|             v-for="dict in getIntDictOptions(DICT_TYPE.POINT_STATUS)" | ||||
|             :key="dict.value" | ||||
|             :label="dict.label" | ||||
|             :value="dict.value" | ||||
|           /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="发生时间" prop="createDate"> | ||||
|         <el-date-picker | ||||
|           v-model="queryParams.createDate" | ||||
|           value-format="YYYY-MM-DD HH:mm:ss" | ||||
|           type="daterange" | ||||
|           start-placeholder="开始日期" | ||||
|           end-placeholder="结束日期" | ||||
|           :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" | ||||
|           class="!w-240px" | ||||
|         /> | ||||
|       </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: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> | ||||
|   </ContentWrap> | ||||
|  | ||||
|   <!-- 列表 --> | ||||
|   <ContentWrap> | ||||
|     <el-table v-loading="loading" :data="list"> | ||||
|       <el-table-column label="序号" align="center" prop="id" /> | ||||
|       <el-table-column label="业务编码" align="center" prop="bizId" /> | ||||
|       <el-table-column label="业务类型" align="center" prop="bizType"> | ||||
|         <template #default="scope"> | ||||
|           <dict-tag :type="DICT_TYPE.POINT_BIZ_TYPE" :value="scope.row.bizType" /> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column | ||||
|         label="操作类型" | ||||
|         align="center" | ||||
|         prop="type" | ||||
|         :formatter=" | ||||
|           (a, b, c) => { | ||||
|             return c === '1' ? '增加' : '扣减' | ||||
|           } | ||||
|         " | ||||
|       /> | ||||
|       <el-table-column label="积分标题" align="center" prop="title" /> | ||||
|       <el-table-column label="积分描述" align="center" prop="description" /> | ||||
|       <el-table-column label="积分" align="center" prop="point" /> | ||||
|       <el-table-column label="变动后的积分" align="center" prop="totalPoint" /> | ||||
|       <el-table-column label="状态" align="center" prop="status"> | ||||
|         <template #default="scope"> | ||||
|           <dict-tag :type="DICT_TYPE.POINT_STATUS" :value="scope.row.status" /> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="用户id" align="center" prop="userId" /> | ||||
|       <el-table-column | ||||
|         label="冻结时间" | ||||
|         align="center" | ||||
|         prop="freezingTime" | ||||
|         :formatter="dateFormatter" | ||||
|       /> | ||||
|       <el-table-column | ||||
|         label="解冻时间" | ||||
|         align="center" | ||||
|         prop="thawingTime" | ||||
|         :formatter="dateFormatter" | ||||
|       /> | ||||
|       <el-table-column | ||||
|         label="发生时间" | ||||
|         align="center" | ||||
|         prop="createDate" | ||||
|         :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> | ||||
|     <!-- 分页 --> | ||||
|     <Pagination | ||||
|       :total="total" | ||||
|       v-model:page="queryParams.pageNo" | ||||
|       v-model:limit="queryParams.pageSize" | ||||
|       @pagination="getList" | ||||
|     /> | ||||
|   </ContentWrap> | ||||
|  | ||||
|   <!-- 表单弹窗:添加/修改 --> | ||||
|   <RecordForm ref="formRef" @success="getList" /> | ||||
| </template> | ||||
|  | ||||
| <script setup lang="ts" name="PointRecord"> | ||||
| import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict' | ||||
| import { dateFormatter } from '@/utils/formatTime' | ||||
| import download from '@/utils/download' | ||||
| import * as RecordApi from '@/api/point/record' | ||||
| import RecordForm from './RecordForm.vue' | ||||
| const message = useMessage() // 消息弹窗 | ||||
| const { t } = useI18n() // 国际化 | ||||
|  | ||||
| const loading = ref(true) // 列表的加载中 | ||||
| const total = ref(0) // 列表的总页数 | ||||
| const list = ref([]) // 列表的数据 | ||||
| const queryParams = reactive({ | ||||
|   pageNo: 1, | ||||
|   pageSize: 10, | ||||
|   bizId: null, | ||||
|   bizType: null, | ||||
|   type: null, | ||||
|   title: null, | ||||
|   status: null, | ||||
|   createDate: [] | ||||
| }) | ||||
| const queryFormRef = ref() // 搜索的表单 | ||||
| const exportLoading = ref(false) // 导出的加载中 | ||||
|  | ||||
| /** 查询列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true | ||||
|   try { | ||||
|     const data = await RecordApi.getRecordPage(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 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(() => { | ||||
|   getList() | ||||
| }) | ||||
| </script> | ||||
							
								
								
									
										97
									
								
								src/views/point/signInConfig/SignInConfigForm.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								src/views/point/signInConfig/SignInConfigForm.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,97 @@ | ||||
| <template> | ||||
|   <Dialog :title="dialogTitle" v-model="dialogVisible"> | ||||
|     <el-form | ||||
|       ref="formRef" | ||||
|       :model="formData" | ||||
|       :rules="formRules" | ||||
|       label-width="100px" | ||||
|       v-loading="formLoading" | ||||
|     > | ||||
|       <el-form-item label="签到天数" prop="day"> | ||||
|         <el-input-number v-model="formData.day" :min="1" :max="7" :precision="0" /> | ||||
|         <el-text class="mx-1" style="margin-left: 10px" type="danger"> | ||||
|           只允许设置1-7,默认签到7天为一个周期</el-text | ||||
|         > | ||||
|       </el-form-item> | ||||
|       <el-form-item label="签到分数" prop="point"> | ||||
|         <el-input-number v-model="formData.point" :precision="0" /> | ||||
|       </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 setup lang="ts"> | ||||
| import * as SignInConfigApi from '@/api/point/signInConfig' | ||||
|  | ||||
| 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, | ||||
|   day: undefined, | ||||
|   point: undefined | ||||
| }) | ||||
| const formRules = reactive({}) | ||||
| const formRef = ref() // 表单 Ref | ||||
|  | ||||
| /** 打开弹窗 */ | ||||
| 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 SignInConfigApi.getSignInConfig(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 SignInConfigApi.SignInConfigVO | ||||
|     if (formType.value === 'create') { | ||||
|       await SignInConfigApi.createSignInConfig(data) | ||||
|       message.success(t('common.createSuccess')) | ||||
|     } else { | ||||
|       await SignInConfigApi.updateSignInConfig(data) | ||||
|       message.success(t('common.updateSuccess')) | ||||
|     } | ||||
|     dialogVisible.value = false | ||||
|     // 发送操作成功的事件 | ||||
|     emit('success') | ||||
|   } finally { | ||||
|     formLoading.value = false | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** 重置表单 */ | ||||
| const resetForm = () => { | ||||
|   formData.value = { | ||||
|     id: undefined, | ||||
|     day: undefined, | ||||
|     point: undefined | ||||
|   } | ||||
|   formRef.value?.resetFields() | ||||
| } | ||||
| </script> | ||||
							
								
								
									
										171
									
								
								src/views/point/signInConfig/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										171
									
								
								src/views/point/signInConfig/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,171 @@ | ||||
| <template> | ||||
|   <ContentWrap> | ||||
|     <!-- 搜索工作栏 --> | ||||
|     <el-form | ||||
|       class="-mb-15px" | ||||
|       :model="queryParams" | ||||
|       ref="queryFormRef" | ||||
|       :inline="true" | ||||
|       label-width="68px" | ||||
|     > | ||||
|       <el-form-item label="签到天数" prop="day"> | ||||
|         <el-input | ||||
|           v-model="queryParams.day" | ||||
|           placeholder="请输入签到天数" | ||||
|           clearable | ||||
|           @keyup.enter="handleQuery" | ||||
|           class="!w-240px" | ||||
|         /> | ||||
|       </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" | ||||
|           plain | ||||
|           @click="openForm('create')" | ||||
|           v-hasPermi="['point:sign-in-config:create']" | ||||
|         > | ||||
|           <Icon icon="ep:plus" class="mr-5px" /> 新增 | ||||
|         </el-button> | ||||
|         <el-button | ||||
|           type="success" | ||||
|           plain | ||||
|           @click="handleExport" | ||||
|           :loading="exportLoading" | ||||
|           v-hasPermi="['point:sign-in-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" v-if="false" /> | ||||
|       <el-table-column label="签到天数" align="center" prop="day" /> | ||||
|       <el-table-column label="签到分数" align="center" prop="point" /> | ||||
|       <el-table-column | ||||
|         label="创建时间" | ||||
|         align="center" | ||||
|         prop="createTime" | ||||
|         :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:sign-in-config:update']" | ||||
|           > | ||||
|             编辑 | ||||
|           </el-button> | ||||
|           <el-button | ||||
|             link | ||||
|             type="danger" | ||||
|             @click="handleDelete(scope.row.id)" | ||||
|             v-hasPermi="['point:sign-in-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> | ||||
|  | ||||
|   <!-- 表单弹窗:添加/修改 --> | ||||
|   <SignInConfigForm ref="formRef" @success="getList" /> | ||||
| </template> | ||||
|  | ||||
| <script setup lang="ts" name="SignInConfig"> | ||||
| import { dateFormatter } from '@/utils/formatTime' | ||||
| import download from '@/utils/download' | ||||
| import * as SignInConfigApi from '@/api/point/signInConfig' | ||||
| import SignInConfigForm from './SignInConfigForm.vue' | ||||
| const message = useMessage() // 消息弹窗 | ||||
| const { t } = useI18n() // 国际化 | ||||
|  | ||||
| const loading = ref(true) // 列表的加载中 | ||||
| const total = ref(0) // 列表的总页数 | ||||
| const list = ref([]) // 列表的数据 | ||||
| const queryParams = reactive({ | ||||
|   pageNo: 1, | ||||
|   pageSize: 10, | ||||
|   day: null | ||||
| }) | ||||
| const queryFormRef = ref() // 搜索的表单 | ||||
| const exportLoading = ref(false) // 导出的加载中 | ||||
|  | ||||
| /** 查询列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true | ||||
|   try { | ||||
|     const data = await SignInConfigApi.getSignInConfigPage(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 SignInConfigApi.deleteSignInConfig(id) | ||||
|     message.success(t('common.delSuccess')) | ||||
|     // 刷新列表 | ||||
|     await getList() | ||||
|   } catch {} | ||||
| } | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = async () => { | ||||
|   try { | ||||
|     // 导出的二次确认 | ||||
|     await message.exportConfirm() | ||||
|     // 发起导出 | ||||
|     exportLoading.value = true | ||||
|     const data = await SignInConfigApi.exportSignInConfig(queryParams) | ||||
|     download.excel(data, '积分签到规则.xls') | ||||
|   } catch { | ||||
|   } finally { | ||||
|     exportLoading.value = false | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** 初始化 **/ | ||||
| onMounted(() => { | ||||
|   getList() | ||||
| }) | ||||
| </script> | ||||
							
								
								
									
										99
									
								
								src/views/point/signInRecord/SignInRecordForm.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								src/views/point/signInRecord/SignInRecordForm.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,99 @@ | ||||
| <template> | ||||
|   <Dialog :title="dialogTitle" v-model="dialogVisible"> | ||||
|     <el-form | ||||
|       ref="formRef" | ||||
|       :model="formData" | ||||
|       :rules="formRules" | ||||
|       label-width="100px" | ||||
|       v-loading="formLoading" | ||||
|     > | ||||
|       <el-form-item label="签到用户" prop="userId"> | ||||
|         <el-input v-model="formData.userId" placeholder="请输入签到用户" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="签到天数" prop="day"> | ||||
|         <el-input v-model="formData.day" placeholder="请输入签到天数" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="签到的分数" prop="point"> | ||||
|         <el-input v-model="formData.point" placeholder="请输入签到的分数" /> | ||||
|       </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 setup lang="ts"> | ||||
| import * as SignInRecordApi from '@/api/point/signInRecord' | ||||
|  | ||||
| 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, | ||||
|   userId: undefined, | ||||
|   day: undefined, | ||||
|   point: undefined | ||||
| }) | ||||
| const formRules = reactive({}) | ||||
| const formRef = ref() // 表单 Ref | ||||
|  | ||||
| /** 打开弹窗 */ | ||||
| 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 SignInRecordApi.getSignInRecord(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 SignInRecordApi.SignInRecordVO | ||||
|     if (formType.value === 'create') { | ||||
|       await SignInRecordApi.createSignInRecord(data) | ||||
|       message.success(t('common.createSuccess')) | ||||
|     } else { | ||||
|       await SignInRecordApi.updateSignInRecord(data) | ||||
|       message.success(t('common.updateSuccess')) | ||||
|     } | ||||
|     dialogVisible.value = false | ||||
|     // 发送操作成功的事件 | ||||
|     emit('success') | ||||
|   } finally { | ||||
|     formLoading.value = false | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** 重置表单 */ | ||||
| const resetForm = () => { | ||||
|   formData.value = { | ||||
|     id: undefined, | ||||
|     userId: undefined, | ||||
|     day: undefined, | ||||
|     point: undefined | ||||
|   } | ||||
|   formRef.value?.resetFields() | ||||
| } | ||||
| </script> | ||||
							
								
								
									
										194
									
								
								src/views/point/signInRecord/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										194
									
								
								src/views/point/signInRecord/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,194 @@ | ||||
| <template> | ||||
|   <ContentWrap> | ||||
|     <!-- 搜索工作栏 --> | ||||
|     <el-form | ||||
|       class="-mb-15px" | ||||
|       :model="queryParams" | ||||
|       ref="queryFormRef" | ||||
|       :inline="true" | ||||
|       label-width="68px" | ||||
|     > | ||||
|       <el-form-item label="签到用户" prop="userId"> | ||||
|         <el-input | ||||
|           v-model="queryParams.userId" | ||||
|           placeholder="请输入签到用户" | ||||
|           clearable | ||||
|           @keyup.enter="handleQuery" | ||||
|           class="!w-240px" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="签到天数" prop="day"> | ||||
|         <el-input | ||||
|           v-model="queryParams.day" | ||||
|           placeholder="请输入签到天数" | ||||
|           clearable | ||||
|           @keyup.enter="handleQuery" | ||||
|           class="!w-240px" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="签到时间" prop="createTime"> | ||||
|         <el-date-picker | ||||
|           v-model="queryParams.createTime" | ||||
|           value-format="YYYY-MM-DD HH:mm:ss" | ||||
|           type="daterange" | ||||
|           start-placeholder="开始日期" | ||||
|           end-placeholder="结束日期" | ||||
|           :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" | ||||
|           class="!w-240px" | ||||
|         /> | ||||
|       </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"--> | ||||
|         <!--          plain--> | ||||
|         <!--          @click="openForm('create')"--> | ||||
|         <!--          v-hasPermi="['point:sign-in-record:create']"--> | ||||
|         <!--        >--> | ||||
|         <!--          <Icon icon="ep:plus" class="mr-5px" /> 新增--> | ||||
|         <!--        </el-button>--> | ||||
|         <el-button | ||||
|           type="success" | ||||
|           plain | ||||
|           @click="handleExport" | ||||
|           :loading="exportLoading" | ||||
|           v-hasPermi="['point:sign-in-record: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="userId" /> | ||||
|       <el-table-column label="签到天数" align="center" prop="day" /> | ||||
|       <el-table-column label="签到的分数" align="center" prop="point" /> | ||||
|       <el-table-column | ||||
|         label="签到时间" | ||||
|         align="center" | ||||
|         prop="createTime" | ||||
|         :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:sign-in-record:update']"--> | ||||
|           <!--          >--> | ||||
|           <!--            编辑--> | ||||
|           <!--          </el-button>--> | ||||
|           <el-button | ||||
|             link | ||||
|             type="danger" | ||||
|             @click="handleDelete(scope.row.id)" | ||||
|             v-hasPermi="['point:sign-in-record: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> | ||||
|  | ||||
|   <!-- 表单弹窗:添加/修改 --> | ||||
|   <SignInRecordForm ref="formRef" @success="getList" /> | ||||
| </template> | ||||
|  | ||||
| <script setup lang="ts" name="SignInRecord"> | ||||
| import { dateFormatter } from '@/utils/formatTime' | ||||
| import download from '@/utils/download' | ||||
| import * as SignInRecordApi from '@/api/point/signInRecord' | ||||
| import SignInRecordForm from './SignInRecordForm.vue' | ||||
| const message = useMessage() // 消息弹窗 | ||||
| const { t } = useI18n() // 国际化 | ||||
|  | ||||
| const loading = ref(true) // 列表的加载中 | ||||
| const total = ref(0) // 列表的总页数 | ||||
| const list = ref([]) // 列表的数据 | ||||
| const queryParams = reactive({ | ||||
|   pageNo: 1, | ||||
|   pageSize: 10, | ||||
|   userId: null, | ||||
|   day: null, | ||||
|   createTime: [] | ||||
| }) | ||||
| const queryFormRef = ref() // 搜索的表单 | ||||
| const exportLoading = ref(false) // 导出的加载中 | ||||
|  | ||||
| /** 查询列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true | ||||
|   try { | ||||
|     const data = await SignInRecordApi.getSignInRecordPage(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 SignInRecordApi.deleteSignInRecord(id) | ||||
|     message.success(t('common.delSuccess')) | ||||
|     // 刷新列表 | ||||
|     await getList() | ||||
|   } catch {} | ||||
| } | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = async () => { | ||||
|   try { | ||||
|     // 导出的二次确认 | ||||
|     await message.exportConfirm() | ||||
|     // 发起导出 | ||||
|     exportLoading.value = true | ||||
|     const data = await SignInRecordApi.exportSignInRecord(queryParams) | ||||
|     download.excel(data, '用户签到积分.xls') | ||||
|   } catch { | ||||
|   } finally { | ||||
|     exportLoading.value = false | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** 初始化 **/ | ||||
| onMounted(() => { | ||||
|   getList() | ||||
| }) | ||||
| </script> | ||||
| @@ -11,7 +11,7 @@ | ||||
|         <el-input v-model="formData.title" placeholder="请输入公告标题" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="公告内容" prop="content"> | ||||
|         <Editor :model-value="formData.content" height="150px" /> | ||||
|         <Editor v-model="formData.content" height="150px" /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="公告类型" prop="type"> | ||||
|         <el-select v-model="formData.type" clearable placeholder="请选择公告类型"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 xiaobai
					xiaobai