提交订单列表和详情20230619

This commit is contained in:
xiaobai 2023-06-19 15:57:20 +08:00
commit ca01b16096
30 changed files with 1626 additions and 95 deletions

View File

@ -8,7 +8,7 @@
"source.fixAll.eslint": true
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "Vue.volar"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"

View File

@ -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,

View File

@ -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%;

View File

@ -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 })
}

View File

@ -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

View 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 })
}

View 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 })
}

View 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 })
}

View 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 })
}

View 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>

View File

@ -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,

View File

@ -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' // 营销的条件类型枚举
}

View File

@ -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)

View File

@ -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 })
}
})
})

View File

@ -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() //

View File

@ -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>

View File

@ -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
}

View File

@ -1,6 +1,5 @@
import { CrudSchema } from '@/hooks/web/useCrudSchemas'
// TODO @puhui999如果只要 detail可以不用 CrudSchema只要描述的 Schema
export const basicInfoSchema = reactive<CrudSchema[]>([
{
label: '商品名称',

View File

@ -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)
}
/** 导出按钮操作 */

View File

@ -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
// }
// }
/**
* 跳转订单详情
*/

View File

@ -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: '';
}

View 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) // 12
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>

View 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>

View 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) // 12
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>

View 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>

View 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) // 12
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>

View 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>

View 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) // 12
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>

View 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>

View File

@ -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="请选择公告类型">