Merge remote-tracking branch 'yudao/dev' into dev-to-dev

This commit is contained in:
puhui999 2023-06-17 21:21:33 +08:00
commit ee698fd8b2
28 changed files with 2857 additions and 52 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

@ -38,14 +38,14 @@
| 框架 | 说明 | 版本 |
|----------------------------------------------------------------------|------------------|--------|
| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.47 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 4.3.1 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.3.3 |
| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.3.4 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 4.3.8 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.3.4 |
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 的超集 | 5.0.4 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.35 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 10.1.0 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.1.3 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 10.1.2 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 |
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.1.6 |
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.2.1 |
| [windicss](https://cn.windicss.org/) | 下一代工具优先的 CSS 框架 | 3.5.6 |
| [iconify](https://icon-sets.iconify.design/) | 在线图标库 | 3.1.0 |
| [wangeditor](https://www.wangeditor.com/) | 富文本编辑器 | 5.1.23 |

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,
@ -18,6 +18,7 @@
"serve:pro": "vite preview --mode pro",
"serve:dev": "vite preview --mode dev",
"serve:test": "vite preview --mode test",
"preview": "pnpm build && vite preview",
"npm:check": "npx npm-check-updates",
"clean": "npx rimraf node_modules",
"clean:cache": "npx rimraf node_modules/.cache",
@ -33,12 +34,12 @@
"@form-create/element-ui": "^3.1.17",
"@iconify/iconify": "^3.1.0",
"@videojs-player/vue": "^1.0.0",
"@vueuse/core": "^10.1.0",
"@vueuse/core": "^10.1.2",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.10",
"@zxcvbn-ts/core": "^2.2.1",
"@zxcvbn-ts/core": "^3.0.1",
"animate.css": "^4.1.1",
"axios": "^1.3.6",
"axios": "^1.4.0",
"benz-amr-recorder": "^1.1.5",
"bpmn-js-token-simulation": "^0.10.0",
"camunda-bpmn-moddle": "^7.0.1",
@ -48,35 +49,35 @@
"diagram-js": "^11.6.0",
"echarts": "^5.4.2",
"echarts-wordcloud": "^2.1.0",
"element-plus": "2.3.3",
"element-plus": "2.3.4",
"fast-xml-parser": "^4.2.2",
"highlight.js": "^11.7.0",
"highlight.js": "^11.8.0",
"intro.js": "^7.0.1",
"jsencrypt": "^3.3.2",
"lodash-es": "^4.17.21",
"min-dash": "^4.1.0",
"min-dash": "^4.1.1",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
"pinia": "^2.0.35",
"pinia": "^2.1.3",
"qrcode": "^1.5.3",
"qs": "^6.11.1",
"qs": "^6.11.2",
"steady-xml": "^0.1.0",
"url": "^0.11.0",
"video.js": "^8.3.0",
"vue": "3.3.4",
"vue-dompurify-html": "^4.1.4",
"vue-i18n": "9.2.2",
"vue-router": "^4.1.6",
"vue-types": "^5.0.2",
"vue-router": "^4.2.1",
"vue-types": "^5.0.3",
"vuedraggable": "^4.1.0",
"web-storage-cache": "^1.1.1",
"xe-utils": "^3.5.7",
"xml-js": "^1.6.11"
},
"devDependencies": {
"@commitlint/cli": "^17.6.1",
"@commitlint/config-conventional": "^17.6.1",
"@iconify/json": "^2.2.54",
"@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.3",
"@iconify/json": "^2.2.67",
"@intlify/unplugin-vue-i18n": "^0.10.0",
"@purge-icons/generated": "^0.9.0",
"@types/intro.js": "^5.1.1",
@ -85,39 +86,39 @@
"@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.0",
"@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"@vitejs/plugin-legacy": "^4.0.2",
"@vitejs/plugin-vue": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"@vitejs/plugin-legacy": "^4.0.3",
"@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"autoprefixer": "^10.4.14",
"bpmn-js": "^8.9.0",
"bpmn-js-properties-panel": "^0.46.0",
"consola": "^3.1.0",
"eslint": "^8.39.0",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.8.0",
"eslint-define-config": "^1.18.0",
"eslint-define-config": "^1.20.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.11.0",
"lint-staged": "^13.2.1",
"eslint-plugin-vue": "^9.13.0",
"lint-staged": "^13.2.2",
"postcss": "^8.4.23",
"postcss-html": "^1.5.0",
"postcss-scss": "^4.0.6",
"prettier": "^2.8.8",
"rimraf": "^5.0.0",
"rollup": "^3.20.7",
"sass": "^1.62.0",
"stylelint": "^15.6.0",
"rimraf": "^5.0.1",
"rollup": "^3.22.0",
"sass": "^1.62.1",
"stylelint": "^15.6.2",
"stylelint-config-html": "^1.1.0",
"stylelint-config-recommended": "^12.0.0",
"stylelint-config-standard": "^33.0.0",
"stylelint-order": "^6.0.3",
"terser": "^5.17.1",
"terser": "^5.17.4",
"typescript": "5.0.4",
"unplugin-auto-import": "^0.15.3",
"unplugin-auto-import": "^0.16.0",
"unplugin-element-plus": "^0.7.1",
"unplugin-vue-components": "^0.24.1",
"vite": "4.3.1",
"vite": "4.3.8",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-ejs": "^1.6.4",
"vite-plugin-eslint": "^1.8.1",
@ -126,8 +127,8 @@
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-top-level-await": "^1.3.0",
"vite-plugin-vue-setup-extend-plus": "^0.1.0",
"vite-plugin-windicss": "^1.8.10",
"vue-tsc": "^1.4.4",
"vite-plugin-windicss": "^1.9.0",
"vue-tsc": "^1.6.5",
"windicss": "^3.5.6"
},
"engines": {

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

@ -0,0 +1,12 @@
import request from '@/config/axios'
// 获得交易订单分页
// TODO @xiaobai改成 getOrderPage
export const getOrderList = (params: PageParam) => {
return request.get({ url: '/trade/order/page', params })
}
// 获得交易订单详情
export const getOrderDetail = (id: number) => {
return request.get({ url: '/trade/order/get-detail?id=' + id })
}

View File

@ -0,0 +1,187 @@
// TODO @xiaobai这个放到 order/index.ts 里哈
// TODO @xiaobai注释放到变量后面这样简洁一点
// TODO @xiaobai这个改成 TradeOrderRespVO
export interface TradeOrderPageItemRespVO {
// 订单编号
id: number
// 订单流水号
no: string
// 下单时间
createTime: Date
// 订单类型
type: number
// 订单来源
terminal: number
// 用户编号
userId: number
// 用户 IP
userIp: string
// 用户备注
userRemark: string
// 订单状态
status: number
// 购买的商品数量
productCount: number
// 订单完成时间
finishTime?: Date
// 订单取消时间
cancelTime?: Date
// 取消类型
cancelType?: number
// 商家备注
remark?: string
// 支付订单编号
payOrderId: number
// 是否已支付
payed: boolean
// 付款时间
payTime?: Date
// 支付渠道
payChannelCode: string
// 商品原价(总)
originalPrice: number
// 订单原价(总)
orderPrice: number
// 订单优惠(总)
discountPrice: number
// 运费金额
deliveryPrice: number
// 订单调价(总)
adjustPrice: number
// 应付金额(总)
payPrice: number
// 配送模板编号
deliveryTemplateId?: number
// 发货物流公司编号
logisticsId?: number
// 发货物流单号
logisticsNo?: string
// 发货状态
deliveryStatus: number
// 发货时间
deliveryTime?: Date
// 收货时间
receiveTime?: Date
// 收件人名称
receiverName: string
// 收件人手机
receiverMobile: string
// 收件人地区编号
receiverAreaId: number
// 收件人邮编
receiverPostCode: number
// 收件人详细地址
receiverDetailAddress: string
// 售后状态
afterSaleStatus?: number
// 退款金额
refundPrice: number
// 优惠劵编号
couponId?: number
// 优惠劵减免金额
couponPrice: number
// 积分抵扣的金额
pointPrice: number
//收件人地区名字
receiverAreaName: string
// 订单项列表
items: TradeOrderItemBaseVO[]
}
// TODO @xiaobai这个改成 TradeOrderItemRespVO
/**
* Base VO VO 使
* VO Swagger
*/
export interface TradeOrderItemBaseVO {
// ========== 订单项基本信息 ==========
/**
*
*/
id: number
/**
*
*/
userId: number
/**
*
*/
orderId: number
// ========== 商品基本信息 ==========
/**
* SPU
*/
spuId: number
/**
* SPU
*/
spuName: string
/**
* SKU
*/
skuId: number
/**
*
*/
picUrl: string
/**
*
*/
count: number
// ========== 价格 + 支付基本信息 ==========
/**
*
*/
originalPrice: number
/**
*
*/
originalUnitPrice: number
/**
*
*/
discountPrice: number
/**
*
*/
payPrice: number
/**
*
*/
orderPartPrice: number
/**
*
*/
orderDividePrice: number
// ========== 营销基本信息 ==========
// TODO 芋艿:在捉摸一下
// ========== 售后基本信息 ==========
/**
*
*/
afterSaleStatus: number
//属性数组
properties: ProductPropertyValueDetailRespVO[]
}
/**
* - Response VO
*/
export interface ProductPropertyValueDetailRespVO {
/**
*
*/
propertyId: number
/**
*
*/
propertyName: string
/**
*
*/
valueId: number
/**
*
*/
valueName: string
}

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

@ -6,7 +6,8 @@ import {
PieChart,
MapChart,
PictorialBarChart,
RadarChart
RadarChart,
GaugeChart
} from 'echarts/charts'
import {
@ -16,7 +17,8 @@ import {
PolarComponent,
AriaComponent,
ParallelComponent,
LegendComponent
LegendComponent,
ToolboxComponent
} from 'echarts/components'
import { CanvasRenderer } from 'echarts/renderers'
@ -25,6 +27,7 @@ echarts.use([
LegendComponent,
TitleComponent,
TooltipComponent,
ToolboxComponent,
GridComponent,
PolarComponent,
AriaComponent,
@ -35,7 +38,8 @@ echarts.use([
MapChart,
CanvasRenderer,
PictorialBarChart,
RadarChart
RadarChart,
GaugeChart
])
export default echarts

View File

@ -195,6 +195,22 @@ const remainingRouter: AppRouteRecordRaw[] = [
noTagsView: true
}
},
{
path: '/trade/order',
component: Layout,
name: 'order',
meta: {
hidden: true
},
children: [
{
path: 'detail',
name: 'TradeOrderDetail',
component: () => import('@/views/mall/trade/order/tradeOrderDetail.vue'),
meta: { title: '订单详情', hidden: true }
}
]
},
{
path: '/403',
component: () => import('@/views/Error/403.vue'),

View File

@ -33,7 +33,6 @@ export const getIntDictOptions = (dictType: string) => {
value: parseInt(dict.value + '')
})
})
return dictOption
}
@ -146,8 +145,26 @@ export enum DICT_TYPE {
MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型
MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型
// ========== MALL - PROMOTION 模块 ==========
// ========== MALL - 会员模块 ==========
// 积分模块 TODO 芋艿:改成 member_ 前缀;包括枚举和值;
POINT_BIZ_TYPE = 'point_biz_type',
POINT_STATUS = 'point_status',
// ========== 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', // 终端
// ========== MALL - 营销模块 ==========
PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型
PROMOTION_PRODUCT_SCOPE = 'promotion_product_scope', // 营销的商品范围
PROMOTION_COUPON_TEMPLATE_VALIDITY_TYPE = 'promotion_coupon_template_validity_type', // 优惠劵模板的有限期类型

View File

@ -63,9 +63,6 @@
</el-scrollbar>
</template>
<script setup lang="ts">
import echarts from '@/plugins/echarts'
import { GaugeChart } from 'echarts/charts'
import { ToolboxComponent } from 'echarts/components'
import * as RedisApi from '@/api/infra/redis'
import { RedisMonitorInfoVO } from '@/api/infra/redis/types'
const cache = ref<RedisMonitorInfoVO>()
@ -77,7 +74,7 @@ const readRedisInfo = async () => {
}
// 使
const usedmemoryEchartChika = reactive({
const usedmemoryEchartChika = reactive<any>({
title: {
//
text: '内存使用情况',
@ -263,8 +260,6 @@ const usedMemoryInstance = async () => {
/** 初始化 **/
onMounted(() => {
echarts.use([ToolboxComponent])
echarts.use([GaugeChart])
// redis
readRedisInfo()
//

View File

@ -1,7 +1,5 @@
import { CrudSchema } from '@/hooks/web/useCrudSchemas'
// TODO @puhui999如果只要 detail可以不用 CrudSchema只要描述的 Schema
// fix: useCrudSchemas 中没有单独处理的情况且只要 detail 的情况只要 spu 这里有使用 如果改动得添加/修改代码
export const basicInfoSchema = reactive<CrudSchema[]>([
{
label: '商品名称',

View File

@ -0,0 +1,517 @@
<template>
<!-- 搜索 -->
<ContentWrap>
<el-form
ref="queryFormRef"
:model="queryParams"
class="-mb-15px"
label-width="68px"
:inline="true"
>
<el-form-item label="订单状态" prop="status">
<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"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="支付方式" prop="payChannelCode">
<el-select
v-model="queryParams.payChannelCode"
class="!w-280px"
clearable
placeholder="全部"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.PAY_CHANNEL_CODE_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-280px"
start-placeholder="自定义时间"
end-placeholder="自定义时间"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
<el-form-item label="订单来源" prop="terminal">
<el-select class="!w-280px" v-model="queryParams.terminal" clearable placeholder="全部TODO">
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.TERMINAL)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="订单类型" prop="type">
<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"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="订单搜索" prop="searchValue">
<!-- item 绑定 2 个变量用于 reset 时没法重置 -->
<el-form-item class="!w-280px" prop="searchType">
<el-input
class="!w-280px"
v-model="queryParams.searchValue"
clearable
placeholder="请输入TODO"
>
<template #prepend>
<el-select
style="width: 100px"
v-model="queryParams.searchType"
clearable
placeholder="全部"
>
<el-option
v-for="dict in searchList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
</el-input>
</el-form-item>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery">
<Icon class="mr-5px" icon="ep:search" />
搜索
</el-button>
<el-button @click="resetQuery">
<Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
<!-- v-hasPermi="['trade:order:export']" TODO 待开发
需要将选中的数据存入orderSelect.multipleSelection中
需要考虑全选时数据如何处理-->
<el-button type="success" plain @click="handleExport" :loading="exportLoading">
<Icon icon="ep:download" class="mr-5px" /> 导出TODO
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column type="expand" fixed="left">
<template #default="scope">
<el-descriptions class="mx-40">
<el-descriptions-item label="商品原价(总): ">{{
'¥ ' + parseFloat(scope.row.originalPrice / 100).toFixed(2) + ' 元'
}}</el-descriptions-item>
<el-descriptions-item label="下单时间: ">
{{ formatDate(scope.row.createTime) }}</el-descriptions-item
>
<el-descriptions-item label="推广人: ">TODO</el-descriptions-item>
<el-descriptions-item label="用户备注: ">{{
scope.row.userRemark
}}</el-descriptions-item>
<el-descriptions-item label="商家备注: ">{{ scope.row.remark }}</el-descriptions-item>
</el-descriptions>
</template>
</el-table-column>
<!-- <el-table-column label="全选" type="selection" width="55" fixed="left">x</el-table-column> -->
<el-table-column width="100" fixed="left">
<template #header>
<el-dropdown icon="eq:search" @command="handleDropType">
<el-button link type="primary">全选({{ orderSelect.checkTotal }}) </el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="1">当前页</el-dropdown-item>
<el-dropdown-item command="2">所有页</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<template #default="scope">
<el-checkbox v-model="scope.row.itemSelect" @change="handcheckclick(scope.row)" />
</template>
</el-table-column>
<el-table-column label="订单号" align="center" min-width="110">
<template #default="scope">
<el-button link type="primary" @click="showOrderDetail(scope.row)">{{
scope.row.no
}}</el-button>
</template>
</el-table-column>
<el-table-column label="订单类型" align="center" min-width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="订单来源" align="center" min-width="100">
<template #default="scope">
<dict-tag
v-if="scope.row.terminal"
:type="DICT_TYPE.TERMINAL"
:value="scope.row.terminal"
/>
<span v-else>{{ scope.terminal }}</span>
</template>
</el-table-column>
<el-table-column label="用户信息" align="center" min-width="100">
<!-- TODO xiaobai展示昵称跳转到用户详情 -->
<template #default="scope">
<el-button link type="primary" @click="goUserDetail(scope.row)">{{
scope.row.userId
}}</el-button>
</template>
</el-table-column>
<el-table-column label="商品信息" align="left" min-width="200" prop="items">
<template #default="scope">
<el-popover
ref="popover"
placement="bottom"
:title="'订单:' + scope.row.no"
:width="400"
trigger="hover"
>
<template #reference>
<div>
<div v-for="item in scope.row.items" :key="item">
<el-image
style="width: 36px; height: 36px"
:src="item.picUrl"
:preview-src-list="[item.picUrl]"
fit="cover"
@click="imagePreview(item.picUrl)"
/>
<span class="m-2">{{ item.spuName }}</span>
</div>
</div>
</template>
<div v-for="item in scope.row.items" :key="item">
<div>
<p>{{ item.spuName }}</p>
<!-- TODO @xiaobai不用 parseFloat 操作直接 / 100.0 -->
<p>{{
'¥ ' + parseFloat(item.payPrice / 100).toFixed(2) + '元 x ' + item.count
}}</p>
</div>
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column label="实际支付(元)" align="center" prop="payPrice" min-width="100">
<template #default="scope">
{{ '¥ ' + parseFloat(scope.row.payPrice / 100).toFixed(2) }}
</template>
</el-table-column>
<el-table-column
:formatter="dateFormatter"
align="center"
label="支付时间"
prop="payTime"
min-width="180"
/>
<!-- TODO @xiaobai增加一个 createTime 时间的展示 -->
<el-table-column label="支付类型" align="center" min-width="100" prop="payChannelCode">
<template #default="scope">
<dict-tag
v-if="scope.row.payChannelCode"
:type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE"
:value="scope.row.payChannelCode"
/>
</template>
</el-table-column>
<el-table-column label="订单状态" align="center" prop="status" min-width="100">
<template #default="scope">
<!-- TODO @xiaobai不用做判断直接 dict-tag 渲染就好列 -->
<dict-tag
v-if="scope.row.status === ''"
:type="DICT_TYPE.TRADE_ORDER_STATUS"
:value="scope.row.status"
/>
<span v-else>{{ scope.status }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" min-width="150">
<template #default="scope">
<el-button v-if="scope.row.status === 0" link type="primary" @click="sendXX(scope.row)">
待支付
</el-button>
<el-button v-if="scope.row.status === 10" link type="primary" @click="sendXX(scope.row)">
发货
</el-button>
<el-button link type="primary" @click="showOrderDetail(scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>
<el-image-viewer
v-if="imgViewVisible"
:url-list="imageViewerList"
@close="imgViewVisible = false"
/>
</template>
<script setup lang="ts" name="OrderList">
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as TradeOrderApi from '@/api/mall/trade/order'
import { dateFormatter, formatDate } from '@/utils/formatTime'
import download from '@/utils/download'
const message = useMessage() //
const { push } = useRouter() //
interface CurrentType {
checkTotal: number //
currentType: string //, 0-noPage 1-currentPage 2-allPage
selectAll: boolean //
multipleSelection: [] // , ,使,
pageNoList: [] // list
}
const orderSelect: CurrentType = reactive({
checkTotal: 0,
currentType: '0',
selectAll: false,
multipleSelection: [],
pageNoList: []
})
const loading = ref(false) //
const total = ref(0) //
const list = ref<any>([]) //
const queryFormRef = ref() //
const queryParams = ref({
pageNo: 1, //
pageSize: 10, //
tabIndex: 0 //
})
const exportLoading = ref(false) //
//
const searchList = ref([
{
value: 'orderNo',
label: '订单号'
},
{
value: 'userId',
label: '用户UID'
},
{
value: 'userName', // TODO @xiaobaiuserNickname
label: '用户姓名'
},
{
value: 'userTel', // TODO @xiaobaiuserMobile
label: '用户电话'
},
{
value: 'itemName', // TODO @xiaobai
label: '商品名称'
},
{
value: 'itemCount', // TODO @xiaobai
label: '商品件数'
}
])
const imgViewVisible = ref(false) //
const imageViewerList = ref<string[]>([]) //
// TODO @xiaobai
/**当前页 所有页 暂不考虑数据本地化 会导致选中当前页 从后台重新拉取数据时出现数据不一致*/
const handleDropType = (command: string) => {
orderSelect.currentType = command
let i = 0
if (command === '1') {
// pageNoList
//
var index = orderSelect.pageNoList.indexOf(queryParams.value.pageNo)
if (index > -1) {
for (i; i < list.value.length; i++) {
if (list.value[i]['itemSelect'] === true) {
list.value[i]['itemSelect'] = false
orderSelect.checkTotal = orderSelect.checkTotal - 1
}
}
orderSelect.pageNoList.splice(index, 1)
} else {
for (i; i < list.value.length; i++) {
if (list.value[i]['itemSelect'] === false) {
list.value[i]['itemSelect'] = true
orderSelect.checkTotal = orderSelect.checkTotal + 1
}
}
orderSelect.pageNoList.splice(0, 0, queryParams.value.pageNo)
}
}
if (command === '2') {
orderSelect.selectAll = !orderSelect.selectAll
// list
if (orderSelect.selectAll) {
//
for (i; i < list.value.length; i++) {
list.value[i]['itemSelect'] = true
}
//
const array1: [] = Array.from(
{ length: total.value / queryParams.value.pageSize + 1 },
(item, idx) => idx + 1
)
orderSelect.pageNoList = [] //
orderSelect.pageNoList = [].concat(array1)
orderSelect.checkTotal = total.value
} else {
//
for (i; i < list.value.length; i++) {
list.value[i]['itemSelect'] = false
}
orderSelect.pageNoList = [] //
orderSelect.checkTotal = 0
}
}
}
/***复选框选中 */
const handcheckclick = (row: any) => {
//1
if (!row.itemSelect) {
// -1
orderSelect.checkTotal = orderSelect.checkTotal - 1
//
} else {
// +1
orderSelect.checkTotal = orderSelect.checkTotal + 1
}
}
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await TradeOrderApi.getOrderList(queryParams.value)
list.value = data.list
total.value = data.total
let i = 0
// itemSelect false
if (
orderSelect.currentType === '2' || //
orderSelect.pageNoList.indexOf(queryParams.value.pageNo) > -1 //
) {
for (i; i < list.value.length; i++) {
list.value[i]['itemSelect'] = true
}
} else {
//?
for (i; i < list.value.length; i++) {
list.value[i]['itemSelect'] = false //, ,
}
}
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
//
orderSelect.checkTotal = 0
orderSelect.currentType = '0'
orderSelect.multipleSelection = []
orderSelect.pageNoList = []
orderSelect.selectAll = false
// queryParams.pageNo = 1 TODO @xiaobai
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
//
orderSelect.checkTotal = 0
orderSelect.currentType = '0'
orderSelect.multipleSelection = []
orderSelect.pageNoList = []
orderSelect.selectAll = false
queryFormRef.value.resetFields()
handleQuery()
}
/**
* 导出数据
*/
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
//TODO(?)
download.excel(orderSelect.multipleSelection as any, '订单信息.xls') //
} catch {
} finally {
exportLoading.value = false
}
//TODO
exportLoading.value = false
}
/**
* 跳转订单详情
*/
const showOrderDetail = (row: any) => {
push({
name: 'TradeOrderDetail',
query: {
id: row.id
}
})
}
/**
* 跳转用户详情 TODO
*/
const goUserDetail = (row: any) => {
console.log('TODO User Detail: ' + row.userId)
}
/**
* 发货 TODO
*/
const sendXX = (row: any) => {
console.log('TODO Send XX: ' + row.no)
}
// TOPDO @xiaobaihttps://kailong110120130.gitee.io/vue-element-plus-admin-doc/components/image-viewer.html 使
/**
* 商品图预览
* @param imgUrl
*/
const imagePreview = (imgUrl: string) => {
imageViewerList.value = [imgUrl]
imgViewVisible.value = true
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

View File

@ -0,0 +1,141 @@
<template>
<el-drawer v-model="drawerVisiable" width="50%">
<el-form inline="true">
<el-form-item>
<div>
<span text="普通订单:">普通订单:</span>
<span text="订单号: ">1111112546</span>
</div>
</el-form-item>
<el-form-item> <el-button type="primary" icon="search">发送货</el-button></el-form-item>
<el-form-item><el-button type="success" icon="search">小票打印</el-button> </el-form-item>
<el-form-item>
<el-dropdown @command="handleCommand">
<el-button> ... </el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="remark">订单备注</el-dropdown-item>
<el-dropdown-item command="b">立即退款</el-dropdown-item>
<el-dropdown-item command="print">打印配货单</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-form-item>
</el-form>
<el-descriptions class="m-10" direction="vertical" column="4">
<el-descriptions-item label="订单状态">未发货TODO</el-descriptions-item>
<el-descriptions-item label="实际支付">1000 TODO</el-descriptions-item>
<el-descriptions-item label="支付方式">手机支付</el-descriptions-item>
<el-descriptions-item label="支付时间"> {{ formatDate(Date()) }}</el-descriptions-item>
</el-descriptions>
<el-tabs @tab-click="handleClick">
<el-tab-pane label="订单信息">
<el-descriptions title="订单信息">
<el-descriptions-item label="用户UID: ">kooriookami</el-descriptions-item>
<el-descriptions-item label="用户昵称: ">18100000000</el-descriptions-item>
<el-descriptions-item label="绑定电话: ">Suzhou</el-descriptions-item>
</el-descriptions>
<el-divider border-style="dashed" />
<el-descriptions title="收货信息" column="1">
<el-descriptions-item label="收货人: ">kooriookami</el-descriptions-item>
<el-descriptions-item label="收货电话: ">18100000000</el-descriptions-item>
<el-descriptions-item label="收货地址: ">{{ detailData }}</el-descriptions-item>
</el-descriptions>
<el-divider border-style="dashed" />
<el-descriptions title="供应商信息">
<el-descriptions-item label="供应商: ">kooriookami</el-descriptions-item>
<el-descriptions-item label="供应商姓名: ">18100000000</el-descriptions-item>
<el-descriptions-item label="联系方式: ">Suzhou</el-descriptions-item>
<el-descriptions-item label="供应商邮箱: ">Suzhou</el-descriptions-item>
</el-descriptions>
<el-divider border-style="dashed" />
<el-descriptions title="订单信息">
<el-descriptions-item label="创建时间: "> {{ formatDate(Date()) }} </el-descriptions-item>
<el-descriptions-item label="商品总数: ">18100000000</el-descriptions-item>
<el-descriptions-item label="商品总价: ¥">200.00 </el-descriptions-item>
<el-descriptions-item label="优惠券金额: ¥">200.00 </el-descriptions-item>
<el-descriptions-item label="积分抵扣: ">200.00</el-descriptions-item>
<el-descriptions-item label="支付邮费: ¥">200.00 </el-descriptions-item>
<el-descriptions-item label="会员商品优惠: ¥">200.00 </el-descriptions-item>
<el-descriptions-item label="推广人: ¥">200.00 </el-descriptions-item>
<el-descriptions-item label="支付时间: "> {{ formatDate(Date()) }} </el-descriptions-item>
<el-descriptions-item label="支付方式: ¥">200.00 </el-descriptions-item>
</el-descriptions>
<el-divider v-if="true" border-style="dashed" />
<el-descriptions v-if="true" title="订单备注">
<el-descriptions-item label="备注: ">TODO</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="商品信息">
<el-descriptions title="商品信息">
<el-descriptions-item label="用户UID: ">kooriookami</el-descriptions-item>
<el-descriptions-item label="用户昵称: ">18100000000</el-descriptions-item>
<el-descriptions-item label="绑定电话: ">Suzhou</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="订单记录">
<el-descriptions title="订单记录">
<el-descriptions-item label="用户UID: ">kooriookami</el-descriptions-item>
<el-descriptions-item label="用户昵称: ">18100000000</el-descriptions-item>
<el-descriptions-item label="绑定电话: ">Suzhou</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="发货记录">
<el-descriptions title="发货记录">
<el-descriptions-item label="用户UID: ">kooriookami</el-descriptions-item>
<el-descriptions-item label="用户昵称: ">18100000000</el-descriptions-item>
<el-descriptions-item label="绑定电话: ">Suzhou</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
</el-tabs>
</el-drawer>
</template>
<script lang="ts" name="tradeOrderDetail-crmeb" setup>
import { formatDate } from '@/utils/formatTime'
import * as TradeOrderApi from '@/api/mall/trade/order'
const message = useMessage() //
const drawerVisiable = ref(false)
let detailData = reactive<any>({
items: [],
user: {}
}) //
const handleClick = () => {}
const handleCommand = (command: string) => {
console.log(command)
}
//
const queryDetail = async (no: string) => {
try {
const res = await TradeOrderApi.getOrderDetail(no)
console.log(res)
detailData.value = res
console.log(detailData.value)
} catch {
message.error('获取详情数据失败')
}
}
//
const show = async (no: string) => {
drawerVisiable.value = true
try {
queryDetail(no)
} finally {
}
}
defineExpose({ show }) //
</script>
<style>
.el-dropdown-link {
cursor: pointer;
color: #409eff;
}
.el-icon-arrow-down {
font-size: 12px;
}
</style>

View File

@ -0,0 +1,357 @@
<template>
<ContentWrap>
<!-- 订单信息 -->
<el-descriptions title="订单信息">
<el-descriptions-item label="订单号: ">{{ order.no }}</el-descriptions-item>
<el-descriptions-item label="配送方式: ">物流配送</el-descriptions-item>
<!-- TODO 芋艿待实现 -->
<el-descriptions-item label="营销活动: ">物流配送</el-descriptions-item>
<!-- TODO 芋艿待实现 -->
<el-descriptions-item label="订单类型: ">
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="order.type" />
</el-descriptions-item>
<el-descriptions-item label="收货人: ">{{ order.receiverName }}</el-descriptions-item>
<el-descriptions-item label="买家留言: ">{{ order.userRemark }}</el-descriptions-item>
<el-descriptions-item label="订单来源: ">
<dict-tag :type="DICT_TYPE.TERMINAL" :value="order.terminal" />
</el-descriptions-item>
<el-descriptions-item label="联系电话: ">{{ order.receiverMobile }}</el-descriptions-item>
<el-descriptions-item label="商家备注: ">{{ order.remark }}</el-descriptions-item>
<el-descriptions-item label="支付单号: ">{{ order.payOrderId }}</el-descriptions-item>
<el-descriptions-item label="付款方式: ">
<dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="order.payChannelCode" />
</el-descriptions-item>
<el-descriptions-item label="买家: ">{{ order.user.nickname }}</el-descriptions-item>
<!-- TODO 芋艿待实现跳转会员 -->
<el-descriptions-item label="收货地址: ">
{{ order.receiverAreaName }} " "{{ order.receiverDetailAddress }} " "
<el-link
v-clipboard:copy="order.receiverAreaName + ' ' + order.receiverDetailAddress"
v-clipboard:success="clipboardSuccess"
icon="ep:document-copy"
type="primary"
/>
</el-descriptions-item>
</el-descriptions>
<!-- 订单状态 -->
<el-descriptions title="订单状态" :column="1">
<el-descriptions-item label="订单状态: ">
<dict-tag :type="DICT_TYPE.TRADE_ORDER_STATUS" :value="order.status" />
</el-descriptions-item>
<el-descriptions-item label-class-name="no-colon">
<el-button type="primary" size="small">调整价格</el-button>
<!-- TODO 芋艿待实现 -->
<el-button type="primary" size="small">备注</el-button>
<!-- TODO 芋艿待实现 -->
<el-button type="primary" size="small">发货</el-button>
<!-- TODO 芋艿待实现 -->
<el-button type="primary" size="small">关闭订单</el-button>
<!-- TODO 芋艿待实现 -->
<el-button type="primary" size="small">修改地址</el-button>
<!-- TODO 芋艿待实现 -->
<el-button type="primary" size="small">打印电子面单</el-button>
<!-- TODO 芋艿待实现 -->
<el-button type="primary" size="small">打印发货单</el-button>
<!-- TODO 芋艿待实现 -->
<el-button type="primary" size="small">确认收货</el-button>
<!-- TODO 芋艿待实现 -->
</el-descriptions-item>
<el-descriptions-item>
<template #label><span style="color: red">提醒: </span></template>
买家付款成功后货款将直接进入您的商户号微信支付宝<br />
请及时关注你发出的包裹状态确保可以配送至买家手中 <br />
如果买家表示没收到货或货物有问题请及时联系买家处理友好协商
</el-descriptions-item>
</el-descriptions>
<!-- 物流信息 TODO -->
<!-- 商品信息 -->
<el-descriptions title="商品信息" column="6">
<el-descriptions-item labelClassName="no-colon">
<el-row :gutter="20">
<el-col :span="10">
<el-table :data="order.items" border>
<el-table-column prop="spuName" label="商品" width="400">
<template #default="{ row }">
{{ row.spuName }}
<el-tag
size="medium"
v-for="property in row.properties"
:key="property.propertyId"
>
{{ property.propertyName }}{{ property.valueName }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="originalUnitPrice" label="单价(元)" width="180">
<template #default="{ row }">
{{ (row.originalUnitPrice / 100.0).toFixed(2) }}
</template>
</el-table-column>
<el-table-column prop="count" label="数量" width="100" />
<el-table-column prop="originalPrice" label="小计(元)" width="100">
<template #default="{ row }">
{{ (row.originalPrice / 100.0).toFixed(2) }}
</template>
</el-table-column>
<el-table-column prop="afterSaleStatus" label="退款状态">
<template #default="{ row }">
<dict-tag
:type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS"
:value="row.afterSaleStatus"
/>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="10" />
</el-row>
</el-descriptions-item>
<!-- 占位 -->
<!-- <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> -->
</el-descriptions>
<el-descriptions column="6">
<el-descriptions-item label="商品总额: ">
{{ (order.originalPrice / 100.0).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item label="运费金额: ">
{{ (order.deliveryPrice / 100.0).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item label="订单调价: ">
{{ (order.adjustPrice / 100.0).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template #label><span style="color: red">商品优惠: </span></template>
{{ ((order.originalPrice - order.originalPrice) / 100.0).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template #label><span style="color: red">订单优惠: </span></template>
{{ (order.discountPrice / 100.0).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template #label><span style="color: red">积分抵扣: </span></template>
{{ (order.pointPrice / 100.0).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" />
<!-- 占位 -->
<el-descriptions-item label="应付金额: ">
{{ (order.payPrice / 100.0).toFixed(2) }}
</el-descriptions-item>
</el-descriptions>
<div v-for="group in detailGroups" :key="group.title">
<el-descriptions v-bind="group.groupProps" :title="group.title">
<!-- 订单操作日志 -->
<el-descriptions-item v-if="group.key === 'orderLog'" labelClassName="no-colon">
<el-timeline>
<el-timeline-item
v-for="activity in detailInfo[group.key]"
:key="activity.timestamp"
:timestamp="activity.timestamp"
>
{{ activity.content }}
</el-timeline-item>
</el-timeline>
</el-descriptions-item>
<!-- 物流信息 -->
<!-- TODO @xiaobai改成一个包裹哈目前只允许发货一次 -->
<el-descriptions-item v-if="group.key === 'expressInfo'" labelClassName="no-colon">
<el-tabs type="card">
<!-- 循环包裹物流信息 -->
<el-tab-pane
v-for="pkgInfo in detailInfo[group.key]"
:key="pkgInfo.label"
:label="pkgInfo.label"
>
<!-- 包裹详情 -->
<el-descriptions>
<el-descriptions-item
v-for="(pkgChild, pkgCIdx) in group.children"
v-bind="pkgChild.childProps"
:key="`pkgChild_${pkgCIdx}`"
:label="pkgChild.label"
>
<!-- 包裹商品列表 -->
<template v-if="pkgChild.valueKey === 'goodsList' && pkgInfo[pkgChild.valueKey]">
<div
v-for="(goodInfo, goodInfoIdx) in pkgInfo[pkgChild.valueKey]"
:key="`goodInfo_${goodInfoIdx}`"
style="display: flex"
>
<el-image
style="width: 100px; height: 100px; flex: none"
:src="goodInfo.imgUrl"
/>
<el-descriptions :column="1">
<el-descriptions-item labelClassName="no-colon">
{{goodInfo.name }}
</el-descriptions-item>
<el-descriptions-item label="数量">
{{goodInfo.count }}
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<!-- 包裹物流详情 -->
<template v-else-if="pkgChild.valueKey === 'wlxq'">
<el-row :gutter="10">
<el-col :span="6" :offset="1">
<el-timeline>
<el-timeline-item
v-for="(activity, index) in pkgInfo[pkgChild.valueKey]"
:key="index"
:timestamp="activity.timestamp"
>
{{ activity.content }}
</el-timeline-item>
</el-timeline>
</el-col>
</el-row>
</template>
<template v-else>
{{ pkgInfo[pkgChild.valueKey] }}
</template>
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
</el-tabs>
</el-descriptions-item>
</el-descriptions>
</div>
</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() //
const { query } = useRoute()
const queryParams = reactive({
id: query.id
})
const dialogVisible = ref(false)
const loading = ref(false)
const order = ref<any>({
items: [],
user: {}
}) //
const detailGroups = ref([
{
title: '物流信息',
key: 'expressInfo',
children: [
{ label: '发货时间: ', valueKey: 'fhsj' },
{ label: '物流公司: ', valueKey: 'wlgs' },
{ label: '运单号: ', valueKey: 'ydh' },
{ label: '物流状态: ', valueKey: 'wlzt', childProps: { span: 3 } },
{ label: '物流详情: ', valueKey: 'wlxq' }
]
},
{
title: '订单操作日志',
key: 'orderLog'
}
])
const detailInfo = ref({
expressInfo: [
//
{
label: '包裹1',
name: 'bg1',
fhsj: '2022-11-03 16:50:45',
wlgs: '极兔',
ydh: '2132123',
wlzt: '不支持此快递公司',
wlxq: [
{
content: '正在派送途中,请您准备签收(派件人:王涛,电话:13854563814)',
timestamp: '2018-04-15 15:00:16'
},
{
content: '快件到达 【烟台龙口东江村委营业点】',
timestamp: '2018-04-13 14:54:19'
},
{
content: '快件已发车',
timestamp: '2018-04-11 12:55:52'
},
{
content: '快件已发车',
timestamp: '2018-04-11 12:55:52'
},
{
content: '快件已发车',
timestamp: '2018-04-11 12:55:52'
}
]
}
],
orderLog: [
//
{
content: '买家【乌鸦】关闭了订单',
timestamp: '2018-04-15 15:00:16'
},
{
content: '买家【乌鸦】下单了',
timestamp: '2018-04-15 15:00:16'
}
],
goodsInfo: [] // tableData
})
// TODO @xiaobaigetDetail
const getlist = async () => {
dialogVisible.value = true
loading.value = true
try {
const res = await TradeOrderApi.getOrderDetail(queryParams.id)
order.value = res
} catch {
message.error('获取详情数据失败')
} finally {
loading.value = false
}
}
onMounted(async () => {
await getlist()
})
const clipboardSuccess = () => {
message.success('复制成功')
}
</script>
<style lang="scss" scoped>
:deep(.el-descriptions) {
&:not(:nth-child(1)) {
margin-top: 20px;
}
.el-descriptions__title {
display: flex;
align-items: center;
&::before {
content: '';
display: inline-block;
margin-right: 10px;
width: 3px;
height: 20px;
background-color: #409eff;
}
}
.el-descriptions-item__container {
margin: 0 10px;
.no-colon {
margin: 0;
&::after {
content: '';
}
}
}
}
</style>

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