# Conflicts:
#	src/components/DiyEditor/components/mobile/PromotionCombination/index.vue
#	src/views/ai/mindmap/manager/index.vue
pull/541/MERGE
YunaiV 2024-09-07 16:53:40 +08:00
commit 3e55015d77
50 changed files with 2337 additions and 2005 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
import { getAccessToken } from '@/utils/auth'
import { fetchEventSource } from '@microsoft/fetch-event-source'
import { config } from '@/config/axios/config'
import request from '@/config/axios'
import request from '@/config/axios' // AI 思维导图 VO
// AI 思维导图 VO
export interface MindMapVO {

View File

@ -74,7 +74,7 @@ export function getCouponTemplatePage(params: PageParam) {
}
// 获得优惠劵模板分页
export function getCouponTemplateList(ids: number[]) {
export function getCouponTemplateList(ids: number[]): Promise<CouponTemplateVO[]> {
return request.get({
url: `/promotion/coupon-template/list?ids=${ids}`
})

View File

@ -1,34 +1,39 @@
import request from '@/config/axios'
export interface DiscountActivityVO {
export interface RewardActivityVO {
id?: number
name?: string
startTime?: Date
endTime?: Date
startAndEndTime?: Date[] // 只前端使用
remark?: string
conditionType?: number
productScope?: number
rules: RewardRule[]
// 如下仅用于表单,不提交
productScopeValues?: number[] // 商品范围:值为品类编号列表、商品编号列表
productCategoryIds?: number[]
productSpuIds?: number[]
rules?: DiscountProductVO[]
}
// 优惠规则
export interface DiscountProductVO {
limit: number
discountPrice: number
freeDelivery: boolean
export interface RewardRule {
limit?: number
discountPrice?: number
freeDelivery?: boolean
point: number
couponIds: number[]
couponCounts: number[]
giveCouponTemplateCounts?: {
[key: number]: number
}
}
// 新增满减送活动
export const createRewardActivity = async (data: DiscountActivityVO) => {
export const createRewardActivity = async (data: RewardActivityVO) => {
return await request.post({ url: '/promotion/reward-activity/create', data })
}
// 更新满减送活动
export const updateRewardActivity = async (data: DiscountActivityVO) => {
export const updateRewardActivity = async (data: RewardActivityVO) => {
return await request.put({ url: '/promotion/reward-activity/update', data })
}

View File

@ -46,8 +46,3 @@ export const updateUserLevel = async (data: any) => {
export const updateUserPoint = async (data: any) => {
return await request.put({ url: `/member/user/update-point`, data })
}
// 修改会员用户余额
export const updateUserBalance = async (data: any) => {
return await request.put({ url: `/member/user/update-balance`, data })
}

View File

@ -4,6 +4,7 @@ import request from '@/config/axios'
export interface PayWalletUserReqVO {
userId: number
}
/** 钱包 VO */
export interface WalletVO {
id: number
@ -20,7 +21,12 @@ export const getWallet = async (params: PayWalletUserReqVO) => {
return await request.get<WalletVO>({ url: `/pay/wallet/get`, params })
}
// 查询会员钱包列表
export const getWalletPage = async (params) => {
/** 查询会员钱包列表 */
export const getWalletPage = async (params: any) => {
return await request.get({ url: `/pay/wallet/page`, params })
}
/** 修改会员钱包余额 */
export const updateWalletBalance = async (data: any) => {
return await request.put({ url: `/pay/wallet/update-balance`, data })
}

View File

@ -1,9 +1,9 @@
<script lang="tsx">
import { defineComponent, PropType, computed } from 'vue'
import { computed, defineComponent, PropType } from 'vue'
import { isHexColor } from '@/utils/color'
import { ElTag } from 'element-plus'
import { DictDataType, getDictOptions } from '@/utils/dict'
import { isArray, isString, isNumber, isBoolean } from '@/utils/is'
import { isArray, isBoolean, isNumber, isString } from '@/utils/is'
export default defineComponent({
name: 'DictTag',

View File

@ -67,15 +67,15 @@
class="text-16px"
:style="{ color: property.fields.price.color }"
>
{{ spu.price }}
{{ fenToYuan(spu.price) }}
</span>
<!-- 市场价 -->
<span
v-if="property.fields.marketPrice.show && spu.marketPrice"
class="ml-4px text-10px line-through"
:style="{ color: property.fields.marketPrice.color }"
>{{ spu.marketPrice }}</span
>
>{{ fenToYuan(spu.marketPrice) }}
</span>
</div>
<div class="text-12px">
<!-- 销量 -->
@ -117,6 +117,7 @@
<script setup lang="ts">
import { ProductCardProperty } from './config'
import * as ProductSpuApi from '@/api/mall/product/spu'
import { fenToYuan } from '../../../../../utils'
/** 商品卡片 */
defineOptions({ name: 'ProductCard' })

View File

@ -54,7 +54,7 @@
class="text-12px"
:style="{ color: property.fields.price.color }"
>
{{ spu.price }}
{{ fenToYuan(spu.price) }}
</span>
</div>
</div>
@ -65,6 +65,7 @@
<script setup lang="ts">
import { ProductListProperty } from './config'
import * as ProductSpuApi from '@/api/mall/product/spu'
import { fenToYuan } from './index'
/** 商品栏 */
defineOptions({ name: 'ProductList' })

View File

@ -1,35 +1,35 @@
<template>
<el-scrollbar class="z-1 min-h-30px" wrap-class="w-full" ref="containerRef">
<el-scrollbar ref="containerRef" class="z-1 min-h-30px" wrap-class="w-full">
<!-- 商品网格 -->
<div
class="grid overflow-x-auto"
:style="{
gridGap: `${property.space}px`,
gridTemplateColumns,
width: scrollbarWidth
}"
class="grid overflow-x-auto"
>
<!-- 商品 -->
<div
class="relative box-content flex flex-row flex-wrap overflow-hidden bg-white"
v-for="(spu, index) in spuList"
:key="index"
:style="{
borderTopLeftRadius: `${property.borderRadiusTop}px`,
borderTopRightRadius: `${property.borderRadiusTop}px`,
borderBottomLeftRadius: `${property.borderRadiusBottom}px`,
borderBottomRightRadius: `${property.borderRadiusBottom}px`
}"
v-for="(spu, index) in spuList"
:key="index"
class="relative box-content flex flex-row flex-wrap overflow-hidden bg-white"
>
<!-- 角标 -->
<div
v-if="property.badge.show"
class="absolute left-0 top-0 z-1 items-center justify-center"
>
<el-image fit="cover" :src="property.badge.imgUrl" class="h-26px w-38px" />
<el-image :src="property.badge.imgUrl" class="h-26px w-38px" fit="cover" />
</div>
<!-- 商品封面图 -->
<el-image fit="cover" :src="spu.picUrl" :style="{ width: imageSize, height: imageSize }" />
<el-image :src="spu.picUrl" :style="{ width: imageSize, height: imageSize }" fit="cover" />
<div
:class="[
'flex flex-col gap-8px p-8px box-border',
@ -42,8 +42,8 @@
<!-- 商品名称 -->
<div
v-if="property.fields.name.show"
class="truncate text-12px"
:style="{ color: property.fields.name.color }"
class="truncate text-12px"
>
{{ spu.name }}
</div>
@ -51,8 +51,8 @@
<!-- 商品价格 -->
<span
v-if="property.fields.price.show"
class="text-12px"
:style="{ color: property.fields.price.color }"
class="text-12px"
>
{{ fenToYuan(spu.seckillPrice || spu.price || 0) }}
</span>
@ -62,11 +62,11 @@
</div>
</el-scrollbar>
</template>
<script setup lang="ts">
<script lang="ts" setup>
import { PromotionSeckillProperty } from './config'
import * as ProductSpuApi from '@/api/mall/product/spu'
import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
import { Spu } from '@/api/mall/product/spu'
import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
import { SeckillProductVO } from '@/api/mall/promotion/seckill/seckillActivity'
import { fenToYuan } from '@/utils'
@ -132,4 +132,4 @@ onMounted(() => {
})
</script>
<style scoped lang="scss"></style>
<style lang="scss" scoped></style>

View File

@ -11,6 +11,10 @@ const props = defineProps({
modelValue: {
require: false,
type: String
},
clearable: {
require: false,
type: Boolean
}
})
const emit = defineEmits<{ (e: 'update:modelValue', v: string) }>()
@ -92,6 +96,12 @@ function onCurrentChange(page) {
currentPage.value = page
}
function clearIcon() {
icon.value = ''
emit('update:modelValue', '')
visible.value = false
}
watch(
() => {
return props.modelValue
@ -115,7 +125,7 @@ watch(
<template>
<div class="selector">
<ElInput v-model="inputValue" @click="visible = !visible">
<ElInput v-model="inputValue" @click="visible = !visible" :clearable="props.clearable" @clear="clearIcon">
<template #append>
<ElPopover
:popper-options="{

View File

@ -1,5 +1,5 @@
<template>
<div class="upload-file">
<div v-if="!disabled" class="upload-file">
<el-upload
ref="uploadRef"
v-model:file-list="fileList"
@ -20,11 +20,11 @@
class="upload-file-uploader"
name="file"
>
<el-button v-if="!disabled" type="primary">
<el-button type="primary">
<Icon icon="ep:upload-filled" />
选取文件
</el-button>
<template v-if="isShowTip && !disabled" #tip>
<template v-if="isShowTip" #tip>
<div style="font-size: 8px">
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
</div>
@ -32,7 +32,6 @@
格式为 <b style="color: #f56c6c">{{ fileType.join('/') }}</b> 的文件
</div>
</template>
<!-- TODO @puhui9991表单展示的时候位置会偏掉已发微信2disable 的时候应该把删除按钮也隐藏掉 -->
<template #file="row">
<div class="flex items-center">
<span>{{ row.file.name }}</span>
@ -54,6 +53,18 @@
</template>
</el-upload>
</div>
<!-- 上传操作禁用时 -->
<div v-if="disabled" class="upload-file">
<div v-for="(file, index) in fileList" :key="index" class="flex items-center file-list-item">
<span>{{ file.name }}</span>
<div class="ml-10px">
<el-link :href="file.url" :underline="false" download target="_blank" type="primary">
下载
</el-link>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { propTypes } from '@/utils/propTypes'
@ -211,4 +222,9 @@ const emitUpdateModelValue = () => {
:deep(.ele-upload-list__item-content-action .el-link) {
margin-right: 10px;
}
.file-list-item {
border: 1px dashed var(--el-border-color-darker);
border-radius: 8px;
}
</style>

View File

@ -206,15 +206,12 @@ const refreshToken = async () => {
const handleAuthorized = () => {
const { t } = useI18n()
if (!isRelogin.show) {
// 如果已经到重新登录页面则不进行弹窗提示
if (window.location.href.includes('login?redirect=')) {
return
}
isRelogin.show = true
ElMessageBox.confirm(t('sys.api.timeoutMessage'), t('common.confirmTitle'), {
showCancelButton: false,
closeOnClickModal: false,
showClose: false,
closeOnPressEscape: false,
confirmButtonText: t('login.relogin'),
type: 'warning'
}).then(() => {

View File

@ -1,7 +1,7 @@
<script lang="ts" setup>
import { onMounted, watch, computed, unref, ref, nextTick } from 'vue'
import { useRouter } from 'vue-router'
import { computed, nextTick, onMounted, ref, unref, watch } from 'vue'
import type { RouteLocationNormalizedLoaded, RouterLinkProps } from 'vue-router'
import { useRouter } from 'vue-router'
import { usePermissionStore } from '@/store/modules/permission'
import { useTagsViewStore } from '@/store/modules/tagsView'
import { useAppStore } from '@/store/modules/app'
@ -273,16 +273,28 @@ watch(
@click="move(-200)"
>
<Icon
icon="ep:d-arrow-left"
color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
color="var(--el-text-color-placeholder)"
icon="ep:d-arrow-left"
/>
</span>
<div class="flex-1 overflow-hidden">
<ElScrollbar ref="scrollbarRef" class="h-full" @scroll="scroll">
<div class="h-[var(--tags-view-height)] flex">
<ContextMenu
v-for="item in visitedViews"
:key="item.fullPath"
:ref="itemRefs.set"
:class="[
`${prefixCls}__item`,
tagsViewImmerse ? `${prefixCls}__item--immerse` : '',
tagsViewIcon ? `${prefixCls}__item--icon` : '',
tagsViewImmerse && tagsViewIcon ? `${prefixCls}__item--immerse--icon` : '',
item?.meta?.affix ? `${prefixCls}__item--affix` : '',
{
'is-active': isActive(item)
}
]"
:schema="[
{
icon: 'ep:refresh',
@ -340,26 +352,14 @@ watch(
}
}
]"
v-for="item in visitedViews"
:key="item.fullPath"
:tag-item="item"
:class="[
`${prefixCls}__item`,
tagsViewImmerse ? `${prefixCls}__item--immerse` : '',
tagsViewIcon ? `${prefixCls}__item--icon` : '',
tagsViewImmerse && tagsViewIcon ? `${prefixCls}__item--immerse--icon` : '',
item?.meta?.affix ? `${prefixCls}__item--affix` : '',
{
'is-active': isActive(item)
}
]"
@visible-change="visibleChange"
>
<div>
<router-link :ref="tagLinksRefs.set" :to="{ ...item }" custom v-slot="{ navigate }">
<router-link :ref="tagLinksRefs.set" v-slot="{ navigate }" :to="{ ...item }" custom>
<div
@click="navigate"
:class="`h-full flex items-center justify-center whitespace-nowrap pl-15px ${prefixCls}__item--label`"
@click="navigate"
>
<Icon
v-if="
@ -376,9 +376,9 @@ watch(
{{ t(item?.meta?.title as string) }}
<Icon
:class="`${prefixCls}__item--close`"
:size="12"
color="#333"
icon="ep:close"
:size="12"
@click.prevent.stop="closeSelectedTag(item)"
/>
</div>
@ -394,9 +394,9 @@ watch(
@click="move(200)"
>
<Icon
icon="ep:d-arrow-right"
color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
color="var(--el-text-color-placeholder)"
icon="ep:d-arrow-right"
/>
</span>
<span
@ -405,13 +405,12 @@ watch(
@click="refreshSelectedTag(selectedTag)"
>
<Icon
icon="ep:refresh-right"
color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
color="var(--el-text-color-placeholder)"
icon="ep:refresh-right"
/>
</span>
<ContextMenu
trigger="click"
:schema="[
{
icon: 'ep:refresh',
@ -463,15 +462,16 @@ watch(
}
}
]"
trigger="click"
>
<span
:class="tagsViewImmerse ? '' : `${prefixCls}__tool`"
class="block h-[var(--tags-view-height)] w-[var(--tags-view-height)] flex cursor-pointer items-center justify-center"
>
<Icon
icon="ep:menu"
color="var(--el-text-color-placeholder)"
:hover-color="isDark ? '#fff' : 'var(--el-color-black)'"
color="var(--el-text-color-placeholder)"
icon="ep:menu"
/>
</span>
</ContextMenu>
@ -532,6 +532,7 @@ $prefix-cls: #{$namespace}-tags-view;
display: none;
transform: translate(0, -50%);
}
&:not(.#{$prefix-cls}__item--affix):hover {
.#{$prefix-cls}__item--close {
display: block;
@ -553,6 +554,7 @@ $prefix-cls: #{$namespace}-tags-view;
color: var(--el-color-white);
background-color: var(--el-color-primary);
border: 1px solid var(--el-color-primary);
.#{$prefix-cls}__item--close {
:deep(span) {
color: var(--el-color-white) !important;
@ -568,9 +570,11 @@ $prefix-cls: #{$namespace}-tags-view;
border: none !important;
-webkit-mask-box-image: url("data:image/svg+xml,%3Csvg width='68' height='34' viewBox='0 0 68 34' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m27,0c-7.99582,0 -11.95105,0.00205 -12,12l0,6c0,8.284 -0.48549,16.49691 -8.76949,16.49691l54.37857,-0.11145c-8.284,0 -8.60908,-8.10146 -8.60908,-16.38546l0,-6c0.11145,-12.08445 -4.38441,-12 -12,-12l-13,0z' fill='%23409eff'/%3E%3C/svg%3E")
12 27 15;
.#{$prefix-cls}__item--label {
padding-left: 35px;
}
.#{$prefix-cls}__item--close {
right: 20px;
}
@ -584,6 +588,7 @@ $prefix-cls: #{$namespace}-tags-view;
&:hover {
color: var(--el-color-white);
background-color: var(--el-color-primary);
.#{$prefix-cls}__item--close {
:deep(span) {
color: var(--el-color-white) !important;
@ -617,6 +622,7 @@ $prefix-cls: #{$namespace}-tags-view;
color: var(--el-color-white);
background-color: var(--el-color-primary);
border: 1px solid var(--el-color-primary);
.#{$prefix-cls}__item--close {
:deep(span) {
color: var(--el-color-white) !important;

View File

@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import { store } from '../index'
import { setCssVar, humpToUnderline } from '@/utils'
import { humpToUnderline, setCssVar } from '@/utils'
import { ElMessage } from 'element-plus'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { ElementPlusSize } from '@/types/elementPlus'

View File

@ -18,8 +18,8 @@ export const isObject = (val: any): val is Record<any, any> => {
return val !== null && is(val, 'Object')
}
export const isEmpty = <T = unknown>(val: T): val is T => {
if (val === null) {
export const isEmpty = (val: any): boolean => {
if (val === null || val === undefined || typeof val === 'undefined') {
return true
}
if (isArray(val) || isString(val)) {

View File

@ -114,9 +114,9 @@
</el-checkbox>
</el-col>
<el-col :offset="6" :span="12">
<el-link style="float: right" type="primary">{{
t('login.forgetPassword')
}}</el-link>
<el-link style="float: right" type="primary"
>{{ t('login.forgetPassword') }}
</el-link>
</el-col>
</el-row>
</el-form-item>

View File

@ -1,5 +1,5 @@
<template>
<el-row class="login-form" v-show="getShow" style="margin-right: -10px; margin-left: -10px">
<el-row v-show="getShow" class="login-form" style="margin-right: -10px; margin-left: -10px">
<el-col :span="24" style="padding-right: 10px; padding-left: 10px">
<LoginFormTitle style="width: 100%" />
</el-col>

View File

@ -4,7 +4,7 @@
<h3 class="m-0 px-7 shrink-0 flex items-center justify-between">
<span>思维导图预览</span>
<!-- 展示在右上角 -->
<el-button type="primary" v-show="isEnd" @click="downloadImage" size="small">
<el-button v-show="isEnd" size="small" type="primary" @click="downloadImage">
<template #icon>
<Icon icon="ph:copy-bold" />
</template>
@ -20,14 +20,14 @@
</div>
<div ref="mindMapRef" class="wh-full">
<svg ref="svgRef" class="w-full" :style="{ height: `${contentAreaHeight}px` }" />
<svg ref="svgRef" :style="{ height: `${contentAreaHeight}px` }" class="w-full" />
<div ref="toolBarRef" class="absolute bottom-[10px] right-5"></div>
</div>
</div>
</el-card>
</template>
<script setup lang="ts">
<script lang="ts" setup>
import { Markmap } from 'markmap-view'
import { Transformer } from 'markmap-lib'
import { Toolbar } from 'markmap-toolbar'
@ -137,6 +137,7 @@ defineExpose({
height: 0;
}
}
.my-card {
display: flex;
flex-direction: column;
@ -149,13 +150,16 @@ defineExpose({
@extend .hide-scroll-bar;
}
}
// markmaptool
:deep(.markmap) {
width: 100%;
}
:deep(.mm-toolbar-brand) {
display: none;
}
:deep(.mm-toolbar) {
display: flex;
flex-direction: row;

View File

@ -3,9 +3,9 @@
<!--表单区域-->
<Left
ref="leftRef"
:is-generating="isGenerating"
@submit="submit"
@direct-generate="directGenerate"
:is-generating="isGenerating"
/>
<!--右边生成思维导图区域-->
<Right
@ -18,7 +18,7 @@
</div>
</template>
<script setup lang="ts">
<script lang="ts" setup>
import Left from './components/Left.vue'
import Right from './components/Right.vue'
import { AiMindMapApi, AiMindMapGenerateReqVO } from '@/api/ai/mindmap'

View File

@ -2,8 +2,8 @@
<!-- 定义 tab 组件撰写/回复等 -->
<DefineTab v-slot="{ active, text, itemClick }">
<span
class="inline-block w-1/2 rounded-full cursor-pointer text-center leading-[30px] relative z-1 text-[5C6370] hover:text-black"
:class="active ? 'text-black shadow-md' : 'hover:bg-[#DDDFE3]'"
class="inline-block w-1/2 rounded-full cursor-pointer text-center leading-[30px] relative z-1 text-[5C6370] hover:text-black"
@click="itemClick"
>
{{ text }}
@ -14,9 +14,9 @@
<h3 class="mt-5 mb-3 flex items-center justify-between text-[14px]">
<span>{{ label }}</span>
<span
@click="hintClick"
v-if="hint"
class="flex items-center text-[12px] text-[#846af7] cursor-pointer select-none"
@click="hintClick"
>
<Icon icon="ep:question-filled" />
{{ hint }}
@ -29,17 +29,17 @@
<div class="w-full pt-2 bg-[#f5f7f9] flex justify-center">
<div class="w-[303px] rounded-full bg-[#DDDFE3] p-1 z-10">
<div
class="flex items-center relative after:content-[''] after:block after:bg-white after:h-[30px] after:w-1/2 after:absolute after:top-0 after:left-0 after:transition-transform after:rounded-full"
:class="
selectedTab === AiWriteTypeEnum.REPLY && 'after:transform after:translate-x-[100%]'
"
class="flex items-center relative after:content-[''] after:block after:bg-white after:h-[30px] after:w-1/2 after:absolute after:top-0 after:left-0 after:transition-transform after:rounded-full"
>
<ReuseTab
v-for="tab in tabs"
:key="tab.value"
:text="tab.text"
:active="tab.value === selectedTab"
:itemClick="() => switchTab(tab.value)"
:text="tab.text"
/>
</div>
</div>
@ -49,36 +49,36 @@
>
<div>
<template v-if="selectedTab === 1">
<ReuseLabel label="写作内容" hint="示例" :hint-click="() => example('write')" />
<ReuseLabel :hint-click="() => example('write')" hint="示例" label="写作内容" />
<el-input
type="textarea"
:rows="5"
:maxlength="500"
v-model="formData.prompt"
:maxlength="500"
:rows="5"
placeholder="请输入写作内容"
showWordLimit
type="textarea"
/>
</template>
<template v-else>
<ReuseLabel label="原文" hint="示例" :hint-click="() => example('reply')" />
<ReuseLabel :hint-click="() => example('reply')" hint="示例" label="原文" />
<el-input
type="textarea"
:rows="5"
:maxlength="500"
v-model="formData.originalContent"
:maxlength="500"
:rows="5"
placeholder="请输入原文"
showWordLimit
type="textarea"
/>
<ReuseLabel label="回复内容" />
<el-input
type="textarea"
:rows="5"
:maxlength="500"
v-model="formData.prompt"
:maxlength="500"
:rows="5"
placeholder="请输入回复内容"
showWordLimit
type="textarea"
/>
</template>
@ -93,14 +93,14 @@
<div class="flex items-center justify-center mt-3">
<el-button :disabled="isWriting" @click="reset"></el-button>
<el-button :loading="isWriting" @click="submit" color="#846af7">生成</el-button>
<el-button :loading="isWriting" color="#846af7" @click="submit"></el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
<script lang="ts" setup>
import { createReusableTemplate } from '@vueuse/core'
import { ref } from 'vue'
import Tag from './Tag.vue'

View File

@ -11,9 +11,9 @@
@click="handleClick(item.routerName)"
>
<CountTo
:prefix="item.prefix"
:end-val="item.value"
:decimals="item.decimals"
:end-val="item.value"
:prefix="item.prefix"
class="text-3xl"
/>
<span class="text-center">{{ item.name }}</span>

View File

@ -180,17 +180,17 @@
</el-table-column>
<el-table-column align="center" label="销售价(元)" min-width="80">
<template #default="{ row }">
{{ row.price }}
{{ formatToFraction(row.price) }}
</template>
</el-table-column>
<el-table-column align="center" label="市场价(元)" min-width="80">
<template #default="{ row }">
{{ row.marketPrice }}
{{ formatToFraction(row.marketPrice) }}
</template>
</el-table-column>
<el-table-column align="center" label="成本价(元)" min-width="80">
<template #default="{ row }">
{{ row.costPrice }}
{{ formatToFraction(row.costPrice) }}
</template>
</el-table-column>
<el-table-column align="center" label="库存" min-width="80">
@ -211,12 +211,12 @@
<template v-if="formData!.subCommissionType">
<el-table-column align="center" label="一级返佣(元)" min-width="80">
<template #default="{ row }">
{{ row.firstBrokeragePrice }}
{{ formatToFraction(row.firstBrokeragePrice) }}
</template>
</el-table-column>
<el-table-column align="center" label="二级返佣(元)" min-width="80">
<template #default="{ row }">
{{ row.secondBrokeragePrice }}
{{ formatToFraction(row.secondBrokeragePrice) }}
</template>
</el-table-column>
</template>
@ -260,17 +260,17 @@
</el-table-column>
<el-table-column align="center" label="销售价(元)" min-width="80">
<template #default="{ row }">
{{ row.price }}
{{ formatToFraction(row.price) }}
</template>
</el-table-column>
<el-table-column align="center" label="市场价(元)" min-width="80">
<template #default="{ row }">
{{ row.marketPrice }}
{{ formatToFraction(row.marketPrice) }}
</template>
</el-table-column>
<el-table-column align="center" label="成本价(元)" min-width="80">
<template #default="{ row }">
{{ row.costPrice }}
{{ formatToFraction(row.costPrice) }}
</template>
</el-table-column>
<el-table-column align="center" label="库存" min-width="80">
@ -284,7 +284,7 @@
</template>
<script lang="ts" setup>
import { PropType, Ref } from 'vue'
import { copyValueToTarget } from '@/utils'
import { copyValueToTarget, formatToFraction } from '@/utils'
import { propTypes } from '@/utils/propTypes'
import { UploadImg } from '@/components/UploadFile'
import type { Property, Sku, Spu } from '@/api/mall/product/spu'

View File

@ -19,19 +19,19 @@
{{ value.name }}
</el-tag>
<el-select
v-show="inputVisible(index)"
:id="`input${index}`"
:ref="setInputRef"
v-show="inputVisible(index)"
v-model="inputValue"
filterable
allow-create
default-first-option
:reserve-keyword="false"
size="small"
allow-create
class="!w-30"
default-first-option
filterable
size="small"
@blur="handleInputConfirm(index, item.id)"
@keyup.enter="handleInputConfirm(index, item.id)"
@change="handleInputConfirm(index, item.id)"
@keyup.enter="handleInputConfirm(index, item.id)"
>
<el-option
v-for="item2 in attributeOptions"

View File

@ -12,12 +12,12 @@
<el-form-item label="属性名称" prop="name">
<el-select
v-model="formData.name"
filterable
allow-create
default-first-option
:reserve-keyword="false"
placeholder="请选择属性名称。如果不存在,可手动输入选择"
allow-create
class="!w-360px"
default-first-option
filterable
placeholder="请选择属性名称。如果不存在,可手动输入选择"
>
<el-option
v-for="item in attributeOptions"

View File

@ -2,11 +2,11 @@
<template>
<el-form
ref="formRef"
v-loading="formLoading"
:disabled="isDetail"
:model="formData"
:rules="rules"
label-width="120px"
v-loading="formLoading"
>
<el-form-item label="分销类型" props="subCommissionType">
<el-radio-group

View File

@ -29,15 +29,14 @@
</el-table-column>
<el-table-column align="center" label="销量" min-width="90" prop="salesCount" />
<el-table-column align="center" label="库存" min-width="90" prop="stock" />
<el-table-column v-if="spuData.length > 1 && isDelete" align="center" label="操作" min-width="90" >
<el-table-column
v-if="spuData.length > 1 && isDelete"
align="center"
label="操作"
min-width="90"
>
<template #default="scope">
<el-button
type="primary"
link
@click="deleteSpu(scope.row.id)"
>
删除
</el-button>
<el-button type="primary" link @click="deleteSpu(scope.row.id)"> </el-button>
</template>
</el-table-column>
</el-table>
@ -57,7 +56,7 @@ const props = defineProps<{
spuList: T[]
ruleConfig: RuleConfig[]
spuPropertyListP: SpuProperty<T>[]
isDelete?: boolean //spu
isDelete?: boolean // SPU TODO deletable
}>()
const spuData = ref<Spu[]>([]) // spu
@ -96,12 +95,12 @@ const emits = defineEmits<{
(e: 'delete', spuId: number): void
}>()
/** 多选时可以删除spu **/
/** 多选时可以删除 SPU **/
const deleteSpu = async (spuId: number) => {
await message.confirm('是否删除商品编号为' + spuId + '的数据?')
let index = spuData.value.findIndex((item) => item.id == spuId)
spuData.value.splice(index,1);
emits('delete',spuId)
const index = spuData.value.findIndex((item) => item.id == spuId)
spuData.value.splice(index, 1)
emits('delete', spuId)
}
/**

View File

@ -33,32 +33,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="优惠券状态" prop="status">
<el-select
v-model="queryParams.status"
class="!w-240px"
clearable
placeholder="请选择优惠券状态"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
: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-240px"
end-placeholder="结束日期"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery">
<Icon class="mr-5px" icon="ep:search" />
@ -118,13 +92,6 @@
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column
:formatter="dateFormatter"
align="center"
label="创建时间"
prop="createTime"
width="180"
/>
</el-table>
<!-- 分页 -->
<Pagination
@ -148,16 +115,17 @@ import {
takeLimitCountFormat,
validityTypeFormat
} from '@/views/mall/promotion/coupon/formatter'
import { dateFormatter } from '@/utils/formatTime'
import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
defineOptions({ name: 'CouponSelect' })
defineProps<{
multipleSelection: CouponTemplateApi.CouponTemplateVO[]
const props = defineProps<{
multipleSelection?: CouponTemplateApi.CouponTemplateVO[]
takeType: number //
}>()
const emit = defineEmits<{
(e: 'update:multipleSelection', v: CouponTemplateApi.CouponTemplateVO[])
(e: 'update:multipleSelection', v: CouponTemplateApi.CouponTemplateVO[]): void
(e: 'change', v: CouponTemplateApi.CouponTemplateVO[]): void
}>()
const dialogVisible = ref(false) //
const dialogTitle = ref('选择优惠卷') //
@ -169,18 +137,18 @@ const queryParams = reactive({
pageNo: 1,
pageSize: 10,
name: null,
status: null,
discountType: null,
type: null,
createTime: []
canTakeTypes: null
})
const queryFormRef = ref() //
const selectedCouponList = ref<CouponTemplateApi.CouponTemplateVO[]>([]) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
//
queryParams.canTakeTypes = [props.takeType] as any
const data = await CouponTemplateApi.getCouponTemplatePage(queryParams)
list.value = data.list
total.value = data.total
@ -209,11 +177,15 @@ const open = async () => {
defineExpose({ open }) // open
const handleSelectionChange = (val: CouponTemplateApi.CouponTemplateVO[]) => {
emit('update:multipleSelection', val)
if (props.multipleSelection) {
emit('update:multipleSelection', val)
return
}
selectedCouponList.value = val
}
const submitForm = () => {
dialogVisible.value = false
emit('change', selectedCouponList.value)
}
// TODO @puhui999 todo
</script>

View File

@ -49,7 +49,7 @@ import { cloneDeep } from 'lodash-es'
import * as DiscountActivityApi from '@/api/mall/promotion/discount/discountActivity'
import * as ProductSpuApi from '@/api/mall/product/spu'
import { getPropertyList, RuleConfig } from '@/views/mall/product/spu/components'
import {formatToFraction} from "@/utils";
import { formatToFraction } from '@/utils'
defineOptions({ name: 'PromotionDiscountActivityForm' })
@ -68,7 +68,7 @@ const spuAndSkuListRef = ref() // sku 限时折扣 配置组件Ref
const ruleConfig: RuleConfig[] = []
const spuList = ref<DiscountActivityApi.SpuExtension[]>([]) // spu
const spuPropertyList = ref<SpuProperty<DiscountActivityApi.SpuExtension>[]>([])
const spuIds = ref<number[]>([]);
const spuIds = ref<number[]>([])
const selectSpu = (spuId: number, skuIds: number[]) => {
getSpuDetails(spuId, skuIds)
}
@ -81,12 +81,12 @@ const getSpuDetails = async (
products?: DiscountActivityApi.DiscountProductVO[],
type?: string
) => {
//spu
if(spuIds.value.includes(spuId)){
if(type !== "load"){
message.error("数据重复选择!")
// SPU
if (spuIds.value.includes(spuId)) {
if (type !== 'load') {
message.error('数据重复选择!')
}
return;
return
}
spuIds.value.push(spuId)
const res = (await ProductSpuApi.getSpuDetailList([spuId])) as DiscountActivityApi.SpuExtension[]
@ -143,7 +143,12 @@ const open = async (type: string, id?: number) => {
)) as DiscountActivityApi.DiscountActivityVO
for (let productsKey in data.products) {
const supId = data.products[productsKey].spuId
await getSpuDetails(supId!, data.products?.map((sku) => sku.skuId), data.products,"load")
await getSpuDetails(
supId!,
data.products?.map((sku) => sku.skuId),
data.products,
'load'
)
}
formRef.value.setValues(data)
} finally {
@ -164,21 +169,23 @@ const submitForm = async () => {
formLoading.value = true
try {
const data = formRef.value.formModel as DiscountActivityApi.DiscountActivityVO
//
//
const products = cloneDeep(spuAndSkuListRef.value.getSkuConfigs('productConfig'))
let timp = false;
//
// TODO @puhui999 youzan
let discountInvalid = false
products.forEach((item: DiscountActivityApi.DiscountProductVO) => {
if(item.discountPrice != null && item.discountPrice > 0){
if (item.discountPrice != null && item.discountPrice > 0) {
item.discountType = 1
}else if(item.discountPercent != null && item.discountPercent > 0){
} else if (item.discountPercent != null && item.discountPercent > 0) {
item.discountType = 2
}else{
timp = true
} else {
discountInvalid = true
}
})
if(timp){
message.error("优惠金额和折扣百分比需要填写一个");
return;
if (discountInvalid) {
message.error('优惠金额和折扣百分比需要填写一个')
return
}
data.products = products
//
@ -207,10 +214,16 @@ const resetForm = async () => {
}
/**
* 删除spu
* 删除 SPU
*/
const deleteSpu = (spuId: number) => {
spuIds.value.splice(spuIds.value.findIndex((item) => item == spuId), 1)
spuPropertyList.value.splice(spuPropertyList.value.findIndex((item) => item.spuId == spuId), 1)
spuIds.value.splice(
spuIds.value.findIndex((item) => item == spuId),
1
)
spuPropertyList.value.splice(
spuPropertyList.value.findIndex((item) => item.spuId == spuId),
1
)
}
</script>

View File

@ -1,11 +1,11 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<Dialog v-model="dialogVisible" :title="dialogTitle" width="65%">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="80px"
v-loading="formLoading"
>
<el-form-item label="活动名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入活动名称" />
@ -13,10 +13,11 @@
<el-form-item label="活动时间" prop="startAndEndTime">
<el-date-picker
v-model="formData.startAndEndTime"
type="datetimerange"
range-separator="-"
:start-placeholder="t('common.startTimeText')"
:end-placeholder="t('common.endTimeText')"
:start-placeholder="t('common.startTimeText')"
range-separator="-"
type="datetimerange"
value-format="x"
/>
</el-form-item>
<el-form-item label="条件类型" prop="conditionType">
@ -24,187 +25,83 @@
<el-radio
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_CONDITION_TYPE)"
:key="dict.value"
:value="dict.value"
:label="dict.value"
>
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="优惠设置">
<template v-for="(item, index) in formData.rules" :key="index">
<el-row type="flex">
<el-col :span="24" style="display: flex; font-weight: bold">
活动层级{{ index + 1 }}
<el-button
link
type="danger"
style="margin-left: auto"
v-if="index != 0"
@click="deleteActivityRule(index)"
>
删除
</el-button>
</el-col>
<el-form :ref="'formRef' + index" :model="item">
<el-form-item
label="优惠门槛:"
prop="limit"
label-width="100px"
style="padding-left: 50px"
>
<el-input
style="width: 150px; padding: 0 10px"
v-model="item.limit"
type="number"
placeholder=""
/>
</el-form-item>
<el-form-item label="优惠内容:" label-width="100px" style="padding-left: 50px">
<el-checkbox-group v-model="activityRules[index]" style="width: 100%">
<el-col :span="24">
<el-checkbox label="订单金额优惠" value="订单金额优惠" name="type" />
<el-form-item v-if="activityRules[index].includes('订单金额优惠')">
<el-input
style="width: 150px; padding: 0 20px"
v-model="item.discountPrice"
type="number"
placeholder=""
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-checkbox
v-model="item.freeDelivery"
label="包邮"
value="包邮"
name="type"
/>
</el-col>
<el-col :span="24">
<el-checkbox label="送积分" value="送积分" name="type" />
<el-form-item v-if="activityRules[index].includes('送积分')">
<el-input
style="width: 150px; padding: 0 20px"
v-model="item.point"
type="number"
placeholder=""
/>
积分
</el-form-item>
</el-col>
<!-- 优惠券待处理 也可以参考优惠劵的SpuShowcase-->
<!-- TODO 待实现-->
<el-col :span="24">
<el-checkbox label="送优惠券" value="送优惠券" name="type" />
</el-col>
</el-checkbox-group>
</el-form-item>
</el-form>
</el-row>
</template>
<!-- TODO 实现建议改成放在每一个活动层级的下面有点类似主子表 -->
<el-button type="primary" @click="addActivityStratum"></el-button>
<RewardRule ref="rewardRuleRef" v-model="formData" />
</el-form-item>
<el-form-item label="活动商品" prop="productScope">
<el-form-item label="活动范围" prop="productScope">
<el-radio-group v-model="formData.productScope">
<el-radio
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_PRODUCT_SCOPE)"
:key="dict.value"
:value="dict.value"
:label="dict.value"
>
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- TODO活动商品的开发可以参考优惠劵的已经搞好啦 -->
<el-form-item
v-if="formData.productScope === PromotionProductScopeEnum.SPU.scope"
prop="productSpuIds"
>
<el-select
v-model="formData.productSpuIds"
placeholder="请选择活动商品"
clearable
size="small"
multiple
filterable
style="width: 400px"
>
<el-option v-for="item in productSpus" :key="item.id" :label="item.name" :value="item.id">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; font-size: 13px; color: #8492a6">
{{ (item.price / 100.0).toFixed(2) }}
</span>
</el-option>
</el-select>
<SpuShowcase v-model="formData.productSpuIds" />
</el-form-item>
<el-form-item
v-if="formData.productScope === PromotionProductScopeEnum.CATEGORY.scope"
label="分类"
prop="productCategoryIds"
>
<ProductCategorySelect v-model="formData.productCategoryIds" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script lang="ts" setup>
import { getSpuSimpleList } from '@/api/mall/product/spu'
import RewardRule from './components/RewardRule.vue'
import SpuShowcase from '@/views/mall/product/spu/components/SpuShowcase.vue'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as RewardActivityApi from '@/api/mall/promotion/reward/rewardActivity'
import { PromotionConditionTypeEnum, PromotionProductScopeEnum } from '@/utils/constants'
import ProductCategorySelect from '@/views/mall/product/category/components/ProductCategorySelect.vue'
import { cloneDeep } from 'lodash-es'
import { fenToYuan, yuanToFen } from '@/utils'
/** 初始化 **/
onMounted(() => {
getSpuSimpleList().then((response) => {
productSpus.value = response
})
})
defineOptions({ name: 'ProductBrandForm' })
const { t } = useI18n() //
const message = useMessage() //
const productSpus = ref<any[]>([]) //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
name: undefined,
startAndEndTime: undefined,
startTime: undefined,
endTime: undefined,
const formData = ref<RewardActivityApi.RewardActivityVO>({
conditionType: PromotionConditionTypeEnum.PRICE.type,
remark: undefined,
productScope: PromotionProductScopeEnum.ALL.scope,
productSpuIds: undefined,
rules: [
{
limit: undefined,
discountPrice: undefined,
freeDelivery: undefined,
point: undefined,
couponIds: [],
couponCounts: []
}
]
})
const activityRules = reactive([]) // []
rules: []
} as RewardActivityApi.RewardActivityVO)
const formRules = reactive({
name: [{ required: true, message: '活动名称不能为空', trigger: 'blur' }],
startAndEndTime: [{ required: true, message: '活动时间不能为空', trigger: 'blur' }],
conditionType: [{ required: true, message: '条件类型不能为空', trigger: 'change' }],
productScope: [{ required: true, message: '商品范围不能为空', trigger: 'blur' }],
productSpuIds: [{ required: true, message: '商品范围不能为空', trigger: 'blur' }]
productSpuIds: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
productCategoryIds: [{ required: true, message: '商品分类不能为空', trigger: 'blur' }]
})
const formRef = ref([]) // Ref
const formRef = ref() // Ref
const rewardRuleRef = ref<InstanceType<typeof RewardRule>>() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
@ -216,24 +113,16 @@ const open = async (type: string, id?: number) => {
if (id) {
formLoading.value = true
try {
let data = await RewardActivityApi.getReward(id)
data.startAndEndTime = [new Date(data.startTime), new Date(data.endTime)]
activityRules.splice(0, activityRules.length)
data.rules.forEach((item) => {
// TODO reactive []
let array: string[] = reactive([])
if (item.freeDelivery) {
array.push('包邮')
}
if (item.point) {
array.push('送积分')
}
if (item.discountPrice) {
array.push('订单金额优惠')
}
activityRules.push(array)
const data = await RewardActivityApi.getReward(id)
//
data.startAndEndTime = [data.startTime, data.endTime]
//
data.rules?.forEach((item: any) => {
item.discountPrice = fenToYuan(item.discountPrice || 0)
})
formData.value = data
//
await getProductScope()
} finally {
formLoading.value = false
}
@ -245,26 +134,26 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
if (!formRef.value) return
const valid = await formRef.value.validate()
if (!valid) return
//
formData.value.startTime = +new Date(formData.value.startAndEndTime[0])
formData.value.endTime = +new Date(formData.value.startAndEndTime[1])
activityRules.forEach((item, index) => {
formData.value.rules[index].freeDelivery = !!item.includes('包邮')
if (!item.includes('送积分')) {
formData.value.rules[index].point = undefined
}
if (!item.includes('订单金额优惠')) {
formData.value.rules[index].discountPrice = undefined
}
})
//
formLoading.value = true
try {
const data = formData.value as RewardActivityApi.DiscountActivityVO
//
rewardRuleRef.value?.setRuleCoupon()
const data = cloneDeep(formData.value)
//
data.startTime = data.startAndEndTime![0]
data.endTime = data.startAndEndTime![1]
delete data.startAndEndTime
//
data.rules.forEach((item) => {
item.discountPrice = yuanToFen(item.discountPrice || 0)
})
//
setProductScopeValues(data)
if (formType.value === 'create') {
await RewardActivityApi.createRewardActivity(data)
message.success(t('common.createSuccess'))
@ -280,51 +169,50 @@ const submitForm = async () => {
}
}
const addActivityStratum = () => {
formData.value.rules.push({
limit: undefined,
discountPrice: undefined,
freeDelivery: undefined,
point: undefined,
couponIds: [],
couponCounts: []
})
activityRules.push([])
}
const deleteActivityRule = (index) => {
formData.value.rules.splice(index, 1)
activityRules.splice(index, 1)
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
name: undefined,
startAndEndTime: undefined,
startTime: undefined,
endTime: undefined,
conditionType: PromotionConditionTypeEnum.PRICE.type,
remark: undefined,
productScope: PromotionProductScopeEnum.ALL.scope,
productSpuIds: undefined,
rules: [
{
limit: undefined,
discountPrice: undefined,
freeDelivery: undefined,
point: undefined,
couponIds: [],
couponCounts: []
rules: []
} as RewardActivityApi.RewardActivityVO
}
/** 获得商品范围 */
const getProductScope = async () => {
switch (formData.value.productScope) {
case PromotionProductScopeEnum.SPU.scope:
//
formData.value.productSpuIds = formData.value.productScopeValues
break
case PromotionProductScopeEnum.CATEGORY.scope:
await nextTick()
let productCategoryIds = formData.value.productScopeValues as any
if (Array.isArray(productCategoryIds) && productCategoryIds.length > 0) {
// 使
productCategoryIds = productCategoryIds[0]
}
]
//
formData.value.productCategoryIds = productCategoryIds
break
default:
break
}
}
/** 设置商品范围 */
function setProductScopeValues(data: any) {
switch (formData.value.productScope) {
case PromotionProductScopeEnum.SPU.scope:
data.productScopeValues = formData.value.productSpuIds
break
case PromotionProductScopeEnum.CATEGORY.scope:
data.productScopeValues = Array.isArray(formData.value.productCategoryIds)
? formData.value.productCategoryIds
: [formData.value.productCategoryIds]
break
default:
break
}
activityRules.splice(0, activityRules.length)
activityRules.push(reactive([]))
//
nextTick(() => {
formRef.value?.resetFields()
})
}
</script>

View File

@ -0,0 +1,127 @@
<template>
<!-- 满减送活动规则组件 -->
<el-row>
<template v-if="formData.rules">
<el-col v-for="(rule, index) in formData.rules" :key="index" :span="24">
<span class="font-bold">活动层级{{ index + 1 }}</span>
<el-button v-if="index !== 0" link type="danger" @click="deleteRule(index)">
删除
</el-button>
<el-form ref="formRef" :model="rule">
<el-form-item label="优惠门槛:" label-width="100px" prop="limit">
<el-input
v-model="rule.limit"
:min="0"
class="w-150px! p-x-20px!"
placeholder=""
type="number"
/>
<!-- TODO @puhui999走字典数据 -->
{{ PromotionConditionTypeEnum.PRICE.type === formData.conditionType ? '元' : '件' }}
</el-form-item>
<el-form-item label="优惠内容:" label-width="100px">
<el-col :span="24">
订单金额优惠
<el-form-item>
<el-input-number
v-model="rule.discountPrice"
:min="0"
:precision="2"
:step="0.1"
class="w-150px! p-x-20px!"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<span>包邮</span>
<el-switch
v-model="rule.freeDelivery"
active-text="是"
inactive-text="否"
inline-prompt
/>
</el-col>
<el-col :span="24">
<span>送积分</span>
<el-form-item>
<el-input
v-model="rule.point"
class="w-150px! p-x-20px!"
placeholder=""
type="number"
/>
积分
</el-form-item>
</el-col>
<el-col :span="24">
<span>送优惠券</span>
<RewardRuleCouponSelect ref="rewardRuleCouponSelectRef" v-model="rule!" />
</el-col>
</el-form-item>
</el-form>
</el-col>
</template>
<el-col :span="24" class="mt-10px">
<el-button type="primary" @click="addRule"></el-button>
</el-col>
<el-col :span="24">
<el-tag type="warning"> 赠送积分为 0 时不赠送未选优惠券时不赠送</el-tag>
</el-col>
</el-row>
</template>
<script lang="ts" setup>
import RewardRuleCouponSelect from './RewardRuleCouponSelect.vue'
import { RewardActivityVO } from '@/api/mall/promotion/reward/rewardActivity'
import { PromotionConditionTypeEnum } from '@/utils/constants'
import { useVModel } from '@vueuse/core'
import { isEmpty } from '@/utils/is'
defineOptions({ name: 'RewardRule' })
const props = defineProps<{
modelValue: RewardActivityVO
}>()
const emits = defineEmits<{
(e: 'update:modelValue', v: any): void
(e: 'deleteRule', v: number): void
}>()
const formData = useVModel(props, 'modelValue', emits) //
const rewardRuleCouponSelectRef = ref<InstanceType<typeof RewardRuleCouponSelect>[]>() // Ref
/** 删除优惠规则 */
const deleteRule = (ruleIndex: number) => {
formData.value.rules.splice(ruleIndex, 1)
}
/** 添加优惠规则 */
const addRule = () => {
if (isEmpty(formData.value.rules)) {
formData.value.rules = []
}
formData.value.rules.push({
limit: 0,
discountPrice: 0,
freeDelivery: false,
point: 0
})
}
/** 设置规则优惠券-提交时 */
const setRuleCoupon = () => {
if (isEmpty(rewardRuleCouponSelectRef.value)) {
return
}
rewardRuleCouponSelectRef.value?.forEach((item) => item.setGiveCouponList())
}
defineExpose({ setRuleCoupon })
</script>

View File

@ -0,0 +1,136 @@
<template>
<el-button class="ml-10px" type="text" @click="selectCoupon"></el-button>
<div
v-for="(item, index) in list"
:key="item.id"
class="coupon-list-item p-x-10px mb-10px flex justify-between"
>
<div class="coupon-list-item-left flex items-center flex-wrap">
<div class="mr-10px"> 优惠券名称{{ item.name }}</div>
<div class="mr-10px">
范围
<dict-tag :type="DICT_TYPE.PROMOTION_PRODUCT_SCOPE" :value="item.productScope" />
</div>
<div class="flex items-center">
优惠
<dict-tag :type="DICT_TYPE.PROMOTION_DISCOUNT_TYPE" :value="item.discountType" />
{{ discountFormat(item) }}
</div>
</div>
<div class="coupon-list-item-right">
<el-input v-model="item.giveCount" class="w-150px! p-x-20px!" placeholder="" type="number" />
<el-button class="ml-20px" link type="danger" @click="deleteCoupon(index)"></el-button>
</div>
</div>
<!-- 优惠券选择 -->
<CouponSelect
ref="couponSelectRef"
:take-type="CouponTemplateTakeTypeEnum.ADMIN.type"
@change="handleCouponChange"
/>
</template>
<script lang="ts" setup>
import { CouponSelect } from '@/views/mall/promotion/coupon/components'
import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
import { RewardRule } from '@/api/mall/promotion/reward/rewardActivity'
import { DICT_TYPE } from '@/utils/dict'
import { CouponTemplateTakeTypeEnum } from '@/utils/constants'
import { discountFormat } from '@/views/mall/promotion/coupon/formatter'
import { isEmpty } from '@/utils/is'
import { useVModel } from '@vueuse/core'
defineOptions({ name: 'RewardRuleCouponSelect' })
const props = defineProps<{
modelValue: RewardRule
}>()
const emits = defineEmits<{
(e: 'update:modelValue', v: any): void
}>()
const rewardRule = useVModel(props, 'modelValue', emits) //
const list = ref<GiveCouponVO[]>([]) //
/** 选择赠送的优惠卷类型拓展 */
interface GiveCouponVO extends CouponTemplateApi.CouponTemplateVO {
giveCount?: number
}
/** 选择优惠券 */
const couponSelectRef = ref<InstanceType<typeof CouponSelect>>() //
const selectCoupon = () => {
couponSelectRef.value?.open()
}
/** 选择优惠券后的回调 */
const handleCouponChange = (val: CouponTemplateApi.CouponTemplateVO[]) => {
for (const item of val) {
if (list.value.some((v) => v.id === item.id)) {
continue
}
list.value.push(item)
}
}
/** 删除优惠券 */
const deleteCoupon = (index: number) => {
list.value.splice(index, 1)
}
/** 初始化赠送的优惠券列表 */
const initGiveCouponList = async () => {
//
if (isEmpty(rewardRule.value) || isEmpty(rewardRule.value.giveCouponTemplateCounts)) {
return
}
const tempLateIds = Object.keys(rewardRule.value.giveCouponTemplateCounts!).map((item) =>
parseInt(item)
)
const data = await CouponTemplateApi.getCouponTemplateList(tempLateIds)
if (!data) {
return
}
//
data.forEach((coupon) => {
list.value.push({
...coupon,
giveCount: rewardRule.value.giveCouponTemplateCounts![coupon.id]
})
})
}
/** 设置赠送的优惠券 */
const setGiveCouponList = () => {
if (isEmpty(rewardRule.value) || isEmpty(list.value)) {
return
}
//
list.value.forEach((rule) => {
if (!rewardRule.value.giveCouponTemplateCounts) {
rewardRule.value.giveCouponTemplateCounts = {}
}
rewardRule.value.giveCouponTemplateCounts[rule.id] = rule.giveCount!
})
}
defineExpose({ setGiveCouponList })
/** 组件初始化 */
onMounted(async () => {
await nextTick()
await initGiveCouponList()
})
</script>
<style lang="scss" scoped>
.coupon-list-item {
border: 1px dashed var(--el-border-color-darker);
border-radius: 8px;
}
</style>

View File

@ -4,27 +4,27 @@
<!-- 搜索工作栏 -->
<ContentWrap>
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
:model="queryParams"
class="-mb-15px"
label-width="68px"
>
<el-form-item label="活动名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入活动名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
clearable
placeholder="请输入活动名称"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="活动状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择活动状态"
clearable
class="!w-240px"
clearable
placeholder="请选择活动状态"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_ACTIVITY_STATUS)"
@ -37,24 +37,31 @@
<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"
end-placeholder="活动结束日期"
start-placeholder="活动开始日期"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</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 @click="handleQuery">
<Icon class="mr-5px" icon="ep:search" />
搜索
</el-button>
<el-button @click="resetQuery">
<Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
<el-button
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['product:brand:create']"
plain
type="primary"
@click="openForm('create')"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
<Icon class="mr-5px" icon="ep:plus" />
新增
</el-button>
</el-form-item>
</el-form>
@ -62,47 +69,47 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" row-key="id" default-expand-all>
<el-table v-loading="loading" :data="list" default-expand-all row-key="id">
<el-table-column label="活动名称" prop="name" />
<el-table-column
label="活动开始时间"
align="center"
prop="startTime"
:formatter="dateFormatter"
align="center"
label="活动开始时间"
prop="startTime"
/>
<el-table-column
label="活动结束时间"
align="center"
prop="endTime"
:formatter="dateFormatter"
align="center"
label="活动结束时间"
prop="endTime"
/>
<el-table-column label="状态" align="center" prop="status">
<el-table-column align="center" label="状态" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PROMOTION_ACTIVITY_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column
label="创建时间"
:formatter="dateFormatter"
align="center"
label="创建时间"
prop="createTime"
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="操作" align="center">
<el-table-column align="center" label="操作">
<template #default="scope">
<el-button
v-hasPermi="['product:brand:update']"
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['product:brand:update']"
>
编辑
</el-button>
<el-button
v-hasPermi="['product:brand:delete']"
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['product:brand:delete']"
>
删除
</el-button>
@ -111,9 +118,9 @@
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>
@ -168,9 +175,9 @@ const resetQuery = () => {
}
/** 添加/修改操作 */
const formRef = ref()
const formRef = ref<InstanceType<typeof RewardForm>>()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
formRef.value?.open(type, id)
}
/** 删除按钮操作 */

View File

@ -135,7 +135,7 @@
</div>
</template>
</el-table-column>
<el-table-column align="center" label="订单金额" prop="refundPrice" min-width="120">
<el-table-column align="center" label="订单金额" min-width="120" prop="refundPrice">
<template #default="scope">
<span>{{ fenToYuan(scope.row.refundPrice) }} </span>
</template>

View File

@ -0,0 +1,144 @@
<template>
<Dialog v-model="dialogVisible" title="修改用户余额" width="600">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="130px"
>
<el-form-item label="用户编号" prop="id">
<el-input v-model="formData.id" class="!w-240px" disabled />
</el-form-item>
<el-form-item label="用户昵称" prop="nickname">
<el-input v-model="formData.nickname" class="!w-240px" disabled />
</el-form-item>
<el-form-item label="变动前余额(元)" prop="balance">
<el-input :model-value="formData.balance" class="!w-240px" disabled />
</el-form-item>
<el-form-item label="变动类型" prop="changeType">
<el-radio-group v-model="formData.changeType">
<el-radio :label="1">增加</el-radio>
<el-radio :label="-1">减少</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="变动余额(元)" prop="changeBalance">
<el-input-number
v-model="formData.changeBalance"
:min="0"
:precision="2"
:step="0.1"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="变动后余额(元)">
<el-input :model-value="balanceResult" class="!w-240px" disabled />
</el-form-item>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script lang="ts" setup>
import * as UserApi from '@/api/member/user'
import * as WalletApi from '@/api/pay/wallet/balance'
import { convertToInteger, formatToFraction } from '@/utils'
/** 修改用户余额表单 */
defineOptions({ name: 'UpdateBalanceForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const formLoading = ref(false) // 12
const formData = ref({
id: undefined,
nickname: undefined,
balance: '0',
changeBalance: 0,
changeType: 1
})
const formRules = reactive({
changeBalance: [{ required: true, message: '变动余额不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (id?: number) => {
dialogVisible.value = true
resetForm()
//
if (id) {
formLoading.value = true
try {
const user = await UserApi.getUser(id)
const wallet = await WalletApi.getWallet({ userId: user.id || 0 })
formData.value.id = user.id
formData.value.nickname = user.nickname
formData.value.balance = formatToFraction(wallet.balance)
formData.value.changeType = 1 //
formData.value.changeBalance = 0 // 0
} 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
if (formData.value.changeBalance <= 0) {
message.error('变动余额不能为零')
return
}
if (convertToInteger(balanceResult.value) < 0) {
message.error('变动后的余额不能小于 0')
return
}
//
formLoading.value = true
try {
await WalletApi.updateWalletBalance({
userId: formData.value.id,
balance: convertToInteger(formData.value.changeBalance) * formData.value.changeType
})
message.success(t('common.updateSuccess'))
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
nickname: undefined,
balance: '0',
changeBalance: 0,
changeType: 1
}
formRef.value?.resetFields()
}
/** 变动后的余额 */
const balanceResult = computed(() =>
formatToFraction(
convertToInteger(formData.value.balance) +
convertToInteger(formData.value.changeBalance) * formData.value.changeType
)
)
</script>

View File

@ -1,11 +1,11 @@
<template>
<Dialog title="修改用户积分" v-model="dialogVisible" width="600">
<Dialog v-model="dialogVisible" title="修改用户积分" width="600">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="用户编号" prop="id">
<el-input v-model="formData.id" class="!w-240px" disabled />
@ -23,19 +23,19 @@
</el-radio-group>
</el-form-item>
<el-form-item label="变动积分" prop="changePoint">
<el-input-number v-model="formData.changePoint" class="!w-240px" :min="0" :precision="0" />
<el-input-number v-model="formData.changePoint" :min="0" :precision="0" class="!w-240px" />
</el-form-item>
<el-form-item label="变动后积分">
<el-input-number v-model="pointResult" class="!w-240px" disabled />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
<script lang="ts" setup>
import * as UserApi from '@/api/member/user'
/** 修改用户积分表单 */
@ -115,8 +115,9 @@ const resetForm = () => {
formData.value = {
id: undefined,
nickname: undefined,
levelId: undefined,
reason: undefined
point: 0,
changePoint: 0,
changeType: 1
}
formRef.value?.resetFields()
}

View File

@ -1,14 +0,0 @@
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'BalanceList'
})
</script>
<!-- TODO @芋艿未来实现等周建的 -->
<template>
<div>余额列表</div>
</template>
<style scoped lang="scss"></style>

View File

@ -2,57 +2,57 @@
<el-descriptions :column="2">
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 等级 " icon="svg-icon:member_level" />
<descriptions-item-label icon="svg-icon:member_level" label=" 等级 " />
</template>
{{ user.levelName || '无' }}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 成长值 " icon="ep:suitcase" />
<descriptions-item-label icon="ep:suitcase" label=" 成长值 " />
</template>
{{ user.experience || 0 }}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 当前积分 " icon="ep:coin" />
<descriptions-item-label icon="ep:coin" label=" 当前积分 " />
</template>
{{ user.point || 0 }}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 总积分 " icon="ep:coin" />
<descriptions-item-label icon="ep:coin" label=" 总积分 " />
</template>
{{ user.totalPoint || 0 }}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 当前余额 " icon="svg-icon:member_balance" />
<descriptions-item-label icon="svg-icon:member_balance" label=" 当前余额 " />
</template>
{{ fenToYuan(wallet.balance || 0) }}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 支出金额 " icon="svg-icon:member_expenditure_balance" />
<descriptions-item-label icon="svg-icon:member_expenditure_balance" label=" 支出金额 " />
</template>
{{ fenToYuan(wallet.totalExpense || 0) }}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 充值金额 " icon="svg-icon:member_recharge_balance" />
<descriptions-item-label icon="svg-icon:member_recharge_balance" label=" 充值金额 " />
</template>
{{ fenToYuan(wallet.totalRecharge || 0) }}
</el-descriptions-item>
</el-descriptions>
</template>
<script setup lang="ts">
<script lang="ts" setup>
import { DescriptionsItemLabel } from '@/components/Descriptions'
import * as UserApi from '@/api/member/user'
import * as WalletApi from '@/api/pay/wallet/balance'
import { UserTypeEnum } from '@/utils/constants'
import { fenToYuan } from '@/utils'
const props = defineProps<{ user: UserApi.UserVO; wallet: WalletApi.WalletVO }>() //
defineProps<{ user: UserApi.UserVO; wallet: WalletApi.WalletVO }>() //
</script>
<style scoped lang="scss">
<style lang="scss" scoped>
.cell-item {
display: inline;
}

View File

@ -133,7 +133,7 @@
</div>
</template>
</el-table-column>
<el-table-column align="center" label="订单金额" prop="refundPrice" min-width="120">
<el-table-column align="center" label="订单金额" min-width="120" prop="refundPrice">
<template #default="scope">
<span>{{ fenToYuan(scope.row.refundPrice) }} </span>
</template>
@ -153,7 +153,7 @@
<dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_WAY" :value="scope.row.way" />
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="160">
<el-table-column align="center" fixed="right" label="操作" width="120">
<template #default="{ row }">
<el-button link type="primary" @click="openAfterSaleDetail(row.id)">退</el-button>
</template>
@ -180,7 +180,7 @@ import { fenToYuan } from '@/utils'
defineOptions({ name: 'UserAfterSaleList' })
const { push } = useRouter() //
const { userId } = defineProps<{
const props = defineProps<{
userId: number
}>()
const loading = ref(true) //
@ -197,14 +197,14 @@ const queryFormRef = ref() // 搜索的表单
const queryParams = ref({
pageNo: 1,
pageSize: 10,
userId,
no: null,
status: '0',
orderNo: null,
spuName: null,
createTime: [],
way: null,
type: null
type: null,
userId: null
})
/** 查询列表 */
@ -217,7 +217,9 @@ const getList = async () => {
delete data.status
}
//
// TODO @userId
if (props.userId) {
data.userId = props.userId as any
}
const res = await AfterSaleApi.getAfterSalePage(data)
list.value = res.list as AfterSaleApi.TradeAfterSaleVO[]
total.value = res.total
@ -235,13 +237,12 @@ const handleQuery = async () => {
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields()
queryParams.value.userId = userId
handleQuery()
}
/** tab 切换 */
const tabClick = async (tab: TabsPaneContext) => {
queryParams.value.status = tab.paneName
queryParams.value.status = tab.paneName as any
await getList()
}

View File

@ -1,28 +1,27 @@
<template>
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="钱包编号" align="center" prop="walletId" />
<el-table-column label="关联业务标题" align="center" prop="title" />
<el-table-column label="交易金额" align="center" prop="price">
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" label="编号" prop="id" />
<el-table-column align="center" label="关联业务标题" prop="title" />
<el-table-column align="center" label="交易金额" prop="price">
<template #default="{ row }"> {{ fenToYuan(row.price) }} </template>
</el-table-column>
<el-table-column label="钱包余额" align="center" prop="balance">
<el-table-column align="center" label="钱包余额" prop="balance">
<template #default="{ row }"> {{ fenToYuan(row.balance) }} </template>
</el-table-column>
<el-table-column
label="交易时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
align="center"
label="交易时间"
prop="createTime"
width="180px"
/>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>
@ -32,8 +31,9 @@
import { dateFormatter } from '@/utils/formatTime'
import * as WalletTransactionApi from '@/api/pay/wallet/transaction'
import { fenToYuan } from '@/utils'
defineOptions({ name: 'UserBalanceList' })
const { walletId }: { walletId: number } = defineProps({
const props = defineProps({
walletId: {
type: Number,
required: false
@ -52,7 +52,7 @@ const list = ref([]) // 列表的数据
const getList = async () => {
loading.value = true
try {
queryParams.walletId = walletId
queryParams.walletId = props.walletId as any
const data = await WalletTransactionApi.getWalletTransactionPage(queryParams)
list.value = data.list
total.value = data.total
@ -65,4 +65,3 @@ onMounted(() => {
getList()
})
</script>
<style scoped lang="scss"></style>

View File

@ -7,7 +7,7 @@
<template #header>
<div class="card-header">
<CardTitle title="基本信息" />
<el-button type="primary" size="small" text @click="openForm('update')">
<el-button size="small" text type="primary" @click="openForm('update')">
编辑
</el-button>
</div>
@ -16,16 +16,16 @@
</el-col>
<!-- 右上角账户信息 -->
<el-col :span="10" class="detail-info-item">
<el-card shadow="never" class="h-full">
<el-card class="h-full" shadow="never">
<template #header>
<CardTitle title="账户信息" />
</template>
<UserAccountInfo :user="user" :wallet="wallet"/>
<UserAccountInfo :user="user" :wallet="wallet" />
</el-card>
</el-col>
<!-- 下边账户明细 -->
<!-- TODO 芋艿订单管理售后管理收藏记录-->
<el-card header="账户明细" style="width: 100%; margin-top: 20px" shadow="never">
<el-card header="账户明细" shadow="never" style="width: 100%; margin-top: 20px">
<template #header>
<CardTitle title="账户明细" />
</template>
@ -39,7 +39,6 @@
<el-tab-pane label="成长值" lazy>
<UserExperienceRecordList :user-id="id" />
</el-tab-pane>
<!-- TODO @jason增加一个余额变化 -->
<el-tab-pane label="余额" lazy>
<UserBalanceList :wallet-id="wallet.id" />
</el-tab-pane>
@ -69,7 +68,7 @@
<!-- 表单弹窗添加/修改 -->
<UserForm ref="formRef" @success="getUserData(id)" />
</template>
<script setup lang="ts">
<script lang="ts" setup>
import * as WalletApi from '@/api/pay/wallet/balance'
import * as UserApi from '@/api/member/user'
import { useTagsViewStore } from '@/store/modules/tagsView'
@ -85,6 +84,7 @@ import UserPointList from './UserPointList.vue'
import UserSignList from './UserSignList.vue'
import UserFavoriteList from './UserFavoriteList.vue'
import UserAfterSaleList from './UserAftersaleList.vue'
import UserBalanceList from './UserBalanceList.vue'
import { CardTitle } from '@/components/Card/index'
import { ElMessage } from 'element-plus'
@ -142,7 +142,7 @@ onMounted(() => {
getUserWallet()
})
</script>
<style scoped lang="css">
<style lang="css" scoped>
.detail-info-item:first-child {
padding-left: 0 !important;
}

View File

@ -172,7 +172,7 @@
v-if="checkPermi(['member:user:update-balance'])"
command="handleUpdateBlance"
>
修改余额(WIP)
修改余额
</el-dropdown-item>
</el-dropdown-menu>
</template>
@ -196,6 +196,8 @@
<UserLevelUpdateForm ref="updateLevelFormRef" @success="getList" />
<!-- 修改用户积分弹窗 -->
<UserPointUpdateForm ref="updatePointFormRef" @success="getList" />
<!-- 修改用户余额弹窗 -->
<UserBalanceUpdateForm ref="UpdateBalanceFormRef" @success="getList" />
<!-- 发送优惠券弹窗 -->
<CouponSendForm ref="couponSendFormRef" />
</template>
@ -207,8 +209,9 @@ import UserForm from './UserForm.vue'
import MemberTagSelect from '@/views/member/tag/components/MemberTagSelect.vue'
import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue'
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
import UserLevelUpdateForm from './UserLevelUpdateForm.vue'
import UserPointUpdateForm from './UserPointUpdateForm.vue'
import UserLevelUpdateForm from './components/UserLevelUpdateForm.vue'
import UserPointUpdateForm from './components/UserPointUpdateForm.vue'
import UserBalanceUpdateForm from './components/UserBalanceUpdateForm.vue'
import { CouponSendForm } from '@/views/mall/promotion/coupon/components'
import { checkPermi } from '@/utils/permission'
@ -233,6 +236,7 @@ const queryParams = reactive({
const queryFormRef = ref() //
const updateLevelFormRef = ref() //
const updatePointFormRef = ref() //
const UpdateBalanceFormRef = ref() //
const selectedIds = ref<number[]>([]) // ID
/** 查询列表 */
@ -299,7 +303,7 @@ const handleCommand = (command: string, row: UserApi.UserVO) => {
updatePointFormRef.value.open(row.id)
break
case 'handleUpdateBlance':
// todo @jason
UpdateBalanceFormRef.value.open(row.id)
break
default:
break

View File

@ -1,22 +1,22 @@
<template>
<div>
<Dialog v-model="dialogVisible" :title="dialogTitle" @closed="close" width="830px">
<Dialog v-model="dialogVisible" :title="dialogTitle" width="830px" @closed="close">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label-width="180px" label="渠道费率" prop="feeRate">
<el-input v-model="formData.feeRate" placeholder="请输入渠道费率" clearable>
<el-form-item label="渠道费率" label-width="180px" prop="feeRate">
<el-input v-model="formData.feeRate" clearable placeholder="请输入渠道费率">
<template #append>%</template>
</el-input>
</el-form-item>
<el-form-item label-width="180px" label="开放平台 APPID" prop="config.appId">
<el-input v-model="formData.config.appId" placeholder="请输入开放平台 APPID" clearable />
<el-form-item label="开放平台 APPID" label-width="180px" prop="config.appId">
<el-input v-model="formData.config.appId" clearable placeholder="请输入开放平台 APPID" />
</el-form-item>
<el-form-item label-width="180px" label="渠道状态" prop="status">
<el-form-item label="渠道状态" label-width="180px" prop="status">
<el-radio-group v-model="formData.status">
<el-radio
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
@ -27,7 +27,7 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="180px" label="网关地址" prop="config.serverUrl">
<el-form-item label="网关地址" label-width="180px" prop="config.serverUrl">
<el-radio-group v-model="formData.config.serverUrl">
<el-radio value="https://openapi.alipay.com/gateway.do">线上环境</el-radio>
<el-radio value="https://openapi-sandbox.dl.alipaydev.com/gateway.do">
@ -35,145 +35,148 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="180px" label="算法类型" prop="config.signType">
<el-form-item label="算法类型" label-width="180px" prop="config.signType">
<el-radio-group v-model="formData.config.signType">
<el-radio key="RSA2" value="RSA2">RSA2</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="180px" label="公钥类型" prop="config.mode">
<el-form-item label="公钥类型" label-width="180px" prop="config.mode">
<el-radio-group v-model="formData.config.mode">
<el-radio key="公钥模式" :value="1">公钥模式</el-radio>
<el-radio key="证书模式" :value="2">证书模式</el-radio>
</el-radio-group>
</el-form-item>
<div v-if="formData.config.mode === 1">
<el-form-item label-width="180px" label="应用私钥" prop="config.privateKey">
<el-form-item label="应用私钥" label-width="180px" prop="config.privateKey">
<el-input
type="textarea"
:autosize="{ minRows: 8, maxRows: 8 }"
v-model="formData.config.privateKey"
placeholder="请输入应用私钥"
clearable
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
clearable
placeholder="请输入应用私钥"
type="textarea"
/>
</el-form-item>
<el-form-item label-width="180px" label="支付宝公钥" prop="config.alipayPublicKey">
<el-form-item label="支付宝公钥" label-width="180px" prop="config.alipayPublicKey">
<el-input
type="textarea"
:autosize="{ minRows: 8, maxRows: 8 }"
v-model="formData.config.alipayPublicKey"
placeholder="请输入支付宝公钥"
clearable
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
clearable
placeholder="请输入支付宝公钥"
type="textarea"
/>
</el-form-item>
</div>
<div v-if="formData.config.mode === 2">
<el-form-item label-width="180px" label="应用私钥" prop="config.privateKey">
<el-form-item label="应用私钥" label-width="180px" prop="config.privateKey">
<el-input
type="textarea"
:autosize="{ minRows: 8, maxRows: 8 }"
v-model="formData.config.privateKey"
placeholder="请输入应用私钥"
clearable
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
clearable
placeholder="请输入应用私钥"
type="textarea"
/>
</el-form-item>
<el-form-item label-width="180px" label="商户公钥应用证书" prop="config.appCertContent">
<el-form-item label="商户公钥应用证书" label-width="180px" prop="config.appCertContent">
<el-input
v-model="formData.config.appCertContent"
type="textarea"
placeholder="请上传商户公钥应用证书"
readonly
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
placeholder="请上传商户公钥应用证书"
readonly
type="textarea"
/>
</el-form-item>
<el-form-item label-width="180px" label="">
<el-form-item label="" label-width="180px">
<el-upload
action=""
ref="privateKeyContentFile"
:limit="1"
:accept="fileAccept"
:http-request="appCertUpload"
:before-upload="fileBeforeUpload"
:http-request="appCertUpload"
:limit="1"
action=""
>
<el-button type="primary">
<Icon icon="ep:upload" class="mr-5px" /> 点击上传
<Icon class="mr-5px" icon="ep:upload" />
点击上传
</el-button>
</el-upload>
</el-form-item>
<el-form-item
label-width="180px"
label="支付宝公钥证书"
label-width="180px"
prop="config.alipayPublicCertContent"
>
<el-input
v-model="formData.config.alipayPublicCertContent"
type="textarea"
placeholder="请上传支付宝公钥证书"
readonly
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
placeholder="请上传支付宝公钥证书"
readonly
type="textarea"
/>
</el-form-item>
<el-form-item label-width="180px" label="">
<el-form-item label="" label-width="180px">
<el-upload
ref="privateCertContentFile"
action=""
:limit="1"
:accept="fileAccept"
:before-upload="fileBeforeUpload"
:http-request="alipayPublicCertUpload"
:limit="1"
action=""
>
<el-button type="primary">
<Icon icon="ep:upload" class="mr-5px" /> 点击上传
<Icon class="mr-5px" icon="ep:upload" />
点击上传
</el-button>
</el-upload>
</el-form-item>
<el-form-item label-width="180px" label="根证书" prop="config.rootCertContent">
<el-form-item label="根证书" label-width="180px" prop="config.rootCertContent">
<el-input
v-model="formData.config.rootCertContent"
type="textarea"
placeholder="请上传根证书"
readonly
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
placeholder="请上传根证书"
readonly
type="textarea"
/>
</el-form-item>
<el-form-item label-width="180px" label="">
<el-form-item label="" label-width="180px">
<el-upload
ref="privateCertContentFile"
:limit="1"
:accept="fileAccept"
action=""
:before-upload="fileBeforeUpload"
:http-request="rootCertUpload"
:limit="1"
action=""
>
<el-button type="primary">
<Icon icon="ep:upload" class="mr-5px" /> 点击上传
<Icon class="mr-5px" icon="ep:upload" />
点击上传
</el-button>
</el-upload>
</el-form-item>
</div>
<el-form-item label-width="180px" label="接口内容加密方式" prop="config.encryptType">
<el-form-item label="接口内容加密方式" label-width="180px" prop="config.encryptType">
<el-radio-group v-model="formData.config.encryptType">
<el-radio key="NONE" label="">无加密</el-radio>
<el-radio key="AES" label="AES">AES</el-radio>
</el-radio-group>
</el-form-item>
<div v-if="formData.config.encryptType === 'AES'">
<el-form-item label-width="180px" label="接口内容加密密钥" prop="config.encryptKey">
<el-form-item label="接口内容加密密钥" label-width="180px" prop="config.encryptKey">
<el-input
v-model="formData.config.encryptKey"
placeholder="请输入接口内容加密密钥"
clearable
placeholder="请输入接口内容加密密钥"
/>
</el-form-item>
</div>
<el-form-item label-width="180px" label="备注" prop="remark">
<el-form-item label="备注" label-width="180px" prop="remark">
<el-input v-model="formData.remark" :style="{ width: '100%' }" />
</el-form-item>
</el-form>

View File

@ -3,12 +3,12 @@
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label-width="180px" label="渠道状态" prop="status">
<el-form-item label="渠道状态" label-width="180px" prop="status">
<el-radio-group v-model="formData.status">
<el-radio
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
@ -19,7 +19,7 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="180px" label="备注" prop="remark">
<el-form-item label="备注" label-width="180px" prop="remark">
<el-input v-model="formData.remark" :style="{ width: '100%' }" />
</el-form-item>
</el-form>

View File

@ -3,12 +3,12 @@
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label-width="180px" label="渠道状态" prop="status">
<el-form-item label="渠道状态" label-width="180px" prop="status">
<el-radio-group v-model="formData.status">
<el-radio
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
@ -19,7 +19,7 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="180px" label="备注" prop="remark">
<el-form-item label="备注" label-width="180px" prop="remark">
<el-input v-model="formData.remark" :style="{ width: '100%' }" />
</el-form-item>
</el-form>

View File

@ -3,33 +3,33 @@
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="120px"
v-loading="formLoading"
>
<el-form-item label-width="180px" label="渠道费率" prop="feeRate">
<el-form-item label="渠道费率" label-width="180px" prop="feeRate">
<el-input
v-model="formData.feeRate"
placeholder="请输入渠道费率"
clearable
:style="{ width: '100%' }"
clearable
placeholder="请输入渠道费率"
>
<template #append>%</template>
</el-input>
</el-form-item>
<el-form-item label-width="180px" label="微信 APPID" prop="config.appId">
<el-form-item label="微信 APPID" label-width="180px" prop="config.appId">
<el-input
v-model="formData.config.appId"
placeholder="请输入微信 APPID"
clearable
:style="{ width: '100%' }"
clearable
placeholder="请输入微信 APPID"
/>
</el-form-item>
<el-form-item label-width="180px" label="商户号" prop="config.mchId">
<el-form-item label="商户号" label-width="180px" prop="config.mchId">
<el-input v-model="formData.config.mchId" :style="{ width: '100%' }" />
</el-form-item>
<el-form-item label-width="180px" label="渠道状态" prop="status">
<el-form-item label="渠道状态" label-width="180px" prop="status">
<el-radio-group v-model="formData.status">
<el-radio
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
@ -40,91 +40,91 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="180px" label="API 版本" prop="config.apiVersion">
<el-form-item label="API 版本" label-width="180px" prop="config.apiVersion">
<el-radio-group v-model="formData.config.apiVersion">
<el-radio value="v2">v2</el-radio>
<el-radio value="v3">v3</el-radio>
</el-radio-group>
</el-form-item>
<div v-if="formData.config.apiVersion === 'v2'">
<el-form-item label-width="180px" label="商户密钥" prop="config.mchKey">
<el-input v-model="formData.config.mchKey" placeholder="请输入商户密钥" clearable />
<el-form-item label="商户密钥" label-width="180px" prop="config.mchKey">
<el-input v-model="formData.config.mchKey" clearable placeholder="请输入商户密钥" />
</el-form-item>
<el-form-item
label-width="180px"
label="apiclient_cert.p12 证书"
label-width="180px"
prop="config.keyContent"
>
<el-input
v-model="formData.config.keyContent"
type="textarea"
placeholder="请上传 apiclient_cert.p12 证书"
readonly
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
placeholder="请上传 apiclient_cert.p12 证书"
readonly
type="textarea"
/>
</el-form-item>
<el-form-item label-width="180px" label="">
<el-form-item label="" label-width="180px">
<el-upload
:before-upload="p12FileBeforeUpload"
:http-request="keyContentUpload"
:limit="1"
accept=".p12"
action=""
:before-upload="p12FileBeforeUpload"
:http-request="keyContentUpload"
>
<el-button type="primary">
<Icon icon="ep:upload" class="mr-5px" />
<Icon class="mr-5px" icon="ep:upload" />
点击上传
</el-button>
</el-upload>
</el-form-item>
</div>
<div v-if="formData.config.apiVersion === 'v3'">
<el-form-item label-width="180px" label="API V3 密钥" prop="config.apiV3Key">
<el-form-item label="API V3 密钥" label-width="180px" prop="config.apiV3Key">
<el-input
v-model="formData.config.apiV3Key"
placeholder="请输入 API V3 密钥"
clearable
placeholder="请输入 API V3 密钥"
/>
</el-form-item>
<el-form-item
label-width="180px"
label="apiclient_key.pem 证书"
label-width="180px"
prop="config.privateKeyContent"
>
<el-input
v-model="formData.config.privateKeyContent"
type="textarea"
placeholder="请上传 apiclient_key.pem 证书"
readonly
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
placeholder="请上传 apiclient_key.pem 证书"
readonly
type="textarea"
/>
</el-form-item>
<el-form-item label-width="180px" label="" prop="privateKeyContentFile">
<el-form-item label="" label-width="180px" prop="privateKeyContentFile">
<el-upload
ref="privateKeyContentFile"
:before-upload="pemFileBeforeUpload"
:http-request="privateKeyContentUpload"
:limit="1"
accept=".pem"
action=""
:before-upload="pemFileBeforeUpload"
:http-request="privateKeyContentUpload"
>
<el-button type="primary">
<Icon icon="ep:upload" class="mr-5px" />
<Icon class="mr-5px" icon="ep:upload" />
点击上传
</el-button>
</el-upload>
</el-form-item>
<el-form-item label-width="180px" label="证书序列号" prop="config.certSerialNo">
<el-form-item label="证书序列号" label-width="180px" prop="config.certSerialNo">
<el-input
v-model="formData.config.certSerialNo"
placeholder="请输入证书序列号"
clearable
placeholder="请输入证书序列号"
/>
</el-form-item>
</div>
<el-form-item label-width="180px" label="备注" prop="remark">
<el-form-item label="备注" label-width="180px" prop="remark">
<el-input v-model="formData.remark" :style="{ width: '100%' }" />
</el-form-item>
</el-form>

View File

@ -3,27 +3,27 @@
<!-- 搜索 -->
<ContentWrap>
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
:model="queryParams"
class="-mb-15px"
label-width="68px"
>
<el-form-item label="应用名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入应用名"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
clearable
placeholder="请输入应用名"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="开启状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择开启状态"
clearable
class="!w-240px"
clearable
placeholder="请选择开启状态"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
@ -36,25 +36,25 @@
<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"
end-placeholder="结束日期"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" />
<Icon class="mr-5px" icon="ep:search" />
搜索
</el-button>
<el-button @click="resetQuery">
<Icon icon="ep:refresh" class="mr-5px" />
<Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
<el-button type="primary" plain @click="openForm('create')" v-hasPermi="['pay:app:create']">
<Icon icon="ep:plus" class="mr-5px" />
<el-button v-hasPermi="['pay:app:create']" plain type="primary" @click="openForm('create')">
<Icon class="mr-5px" icon="ep:plus" />
新增
</el-button>
</el-form-item>
@ -64,9 +64,9 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column label="应用标识" align="center" prop="appKey" />
<el-table-column label="应用名" align="center" prop="name" min-width="90" />
<el-table-column label="开启状态" align="center" prop="status">
<el-table-column align="center" label="应用标识" prop="appKey" />
<el-table-column align="center" label="应用名" min-width="90" prop="name" />
<el-table-column align="center" label="开启状态" prop="status">
<template #default="scope">
<el-switch
v-model="scope.row.status"
@ -76,28 +76,28 @@
/>
</template>
</el-table-column>
<el-table-column label="支付宝配置" align="center">
<el-table-column align="center" label="支付宝配置">
<el-table-column
:label="channel.name.replace('支付宝', '')"
align="center"
v-for="channel in alipayChannels"
:key="channel.code"
:label="channel.name.replace('支付宝', '')"
align="center"
>
<template #default="scope">
<el-button
type="success"
v-if="isChannelExists(scope.row.channelCodes, channel.code)"
@click="openChannelForm(scope.row, channel.code)"
circle
size="small"
type="success"
@click="openChannelForm(scope.row, channel.code)"
>
<Icon icon="ep:check" />
</el-button>
<el-button
v-else
type="danger"
circle
size="small"
type="danger"
@click="openChannelForm(scope.row, channel.code)"
>
<Icon icon="ep:close" />
@ -105,28 +105,28 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="微信配置" align="center">
<el-table-column align="center" label="微信配置">
<el-table-column
:label="channel.name.replace('微信', '')"
align="center"
v-for="channel in wxChannels"
:key="channel.code"
:label="channel.name.replace('微信', '')"
align="center"
>
<template #default="scope">
<el-button
type="success"
v-if="isChannelExists(scope.row.channelCodes, channel.code)"
@click="openChannelForm(scope.row, channel.code)"
circle
size="small"
type="success"
@click="openChannelForm(scope.row, channel.code)"
>
<Icon icon="ep:check" />
</el-button>
<el-button
v-else
type="danger"
circle
size="small"
type="danger"
@click="openChannelForm(scope.row, channel.code)"
>
<Icon icon="ep:close" />
@ -134,23 +134,23 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="钱包支付配置" align="center">
<el-table-column align="center" label="钱包支付配置">
<el-table-column :label="PayChannelEnum.WALLET.name" align="center">
<template #default="scope">
<el-button
type="success"
v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.WALLET.code)"
circle
size="small"
v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.WALLET.code)"
type="success"
@click="openChannelForm(scope.row, PayChannelEnum.WALLET.code)"
>
<Icon icon="ep:check" />
</el-button>
<el-button
v-else
type="danger"
circle
size="small"
type="danger"
@click="openChannelForm(scope.row, PayChannelEnum.WALLET.code)"
>
<Icon icon="ep:close" />
@ -158,23 +158,23 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="模拟支付配置" align="center">
<el-table-column align="center" label="模拟支付配置">
<el-table-column :label="PayChannelEnum.MOCK.name" align="center">
<template #default="scope">
<el-button
type="success"
v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.MOCK.code)"
circle
size="small"
v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.MOCK.code)"
type="success"
@click="openChannelForm(scope.row, PayChannelEnum.MOCK.code)"
>
<Icon icon="ep:check" />
</el-button>
<el-button
v-else
type="danger"
circle
size="small"
type="danger"
@click="openChannelForm(scope.row, PayChannelEnum.MOCK.code)"
>
<Icon icon="ep:close" />
@ -182,21 +182,21 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="操作" align="center" min-width="110" fixed="right">
<el-table-column align="center" fixed="right" label="操作" min-width="110">
<template #default="scope">
<el-button
v-hasPermi="['pay:app:update']"
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['pay:app:update']"
>
编辑
</el-button>
<el-button
v-hasPermi="['pay:app:delete']"
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['pay:app:delete']"
>
删除
</el-button>
@ -205,9 +205,9 @@
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>

View File

@ -1,28 +1,28 @@
<template>
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="钱包编号" align="center" prop="walletId" />
<el-table-column label="关联业务标题" align="center" prop="title" />
<el-table-column label="交易金额" align="center" prop="price">
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" label="编号" prop="id" />
<el-table-column align="center" label="钱包编号" prop="walletId" />
<el-table-column align="center" label="关联业务标题" prop="title" />
<el-table-column align="center" label="交易金额" prop="price">
<template #default="{ row }"> {{ fenToYuan(row.price) }} </template>
</el-table-column>
<el-table-column label="钱包余额" align="center" prop="balance">
<el-table-column align="center" label="钱包余额" prop="balance">
<template #default="{ row }"> {{ fenToYuan(row.balance) }} </template>
</el-table-column>
<el-table-column
label="交易时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
align="center"
label="交易时间"
prop="createTime"
width="180px"
/>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>
@ -31,12 +31,18 @@
<script lang="ts" setup>
import { dateFormatter } from '@/utils/formatTime'
import * as WalletTransactionApi from '@/api/pay/wallet/transaction'
import * as WalletApi from '@/api/pay/wallet/balance'
import { fenToYuan } from '@/utils'
defineOptions({ name: 'WalletTransactionList' })
const { walletId }: { walletId: number } = defineProps({
const props = defineProps({
walletId: {
type: Number,
required: false
},
userId: {
type: Number,
required: false
}
})
@ -52,7 +58,12 @@ const list = ref([]) // 列表的数据
const getList = async () => {
loading.value = true
try {
queryParams.walletId = walletId
if (props.userId) {
const wallet = await WalletApi.getWallet({ userId: props.userId })
queryParams.walletId = wallet.id as any
} else {
queryParams.walletId = props.walletId as any
}
const data = await WalletTransactionApi.getWalletTransactionPage(queryParams)
list.value = data.list
total.value = data.total
@ -65,4 +76,4 @@ onMounted(() => {
getList()
})
</script>
<style scoped lang="scss"></style>
<style lang="scss" scoped></style>

View File

@ -1,85 +1,85 @@
import { resolve } from 'path'
import { loadEnv } from 'vite'
import type { UserConfig, ConfigEnv } from 'vite'
import { createVitePlugins } from './build/vite'
import { include, exclude } from "./build/vite/optimize"
import {resolve} from 'path'
import type {ConfigEnv, UserConfig} from 'vite'
import {loadEnv} from 'vite'
import {createVitePlugins} from './build/vite'
import {exclude, include} from "./build/vite/optimize"
// 当前执行node命令时文件夹的地址(工作目录)
const root = process.cwd()
// 路径查找
function pathResolve(dir: string) {
return resolve(root, '.', dir)
return resolve(root, '.', dir)
}
// https://vitejs.dev/config/
export default ({ command, mode }: ConfigEnv): UserConfig => {
let env = {} as any
const isBuild = command === 'build'
if (!isBuild) {
env = loadEnv((process.argv[3] === '--mode' ? process.argv[4] : process.argv[3]), root)
} else {
env = loadEnv(mode, root)
}
return {
base: env.VITE_BASE_PATH,
root: root,
// 服务端渲染
server: {
port: env.VITE_PORT, // 端口号
host: "0.0.0.0",
open: env.VITE_OPEN === 'true',
// 本地跨域代理. 目前注释的原因暂时没有用途server 端已经支持跨域
// proxy: {
// ['/admin-api']: {
// target: env.VITE_BASE_URL,
// ws: false,
// changeOrigin: true,
// rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''),
// },
// },
},
// 项目使用的vite插件。 单独提取到build/vite/plugin中管理
plugins: createVitePlugins(),
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/styles/variables.scss";',
javascriptEnabled: true
}
}
},
resolve: {
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.scss', '.css'],
alias: [
{
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js'
export default ({command, mode}: ConfigEnv): UserConfig => {
let env = {} as any
const isBuild = command === 'build'
if (!isBuild) {
env = loadEnv((process.argv[3] === '--mode' ? process.argv[4] : process.argv[3]), root)
} else {
env = loadEnv(mode, root)
}
return {
base: env.VITE_BASE_PATH,
root: root,
// 服务端渲染
server: {
port: env.VITE_PORT, // 端口号
host: "0.0.0.0",
open: env.VITE_OPEN === 'true',
// 本地跨域代理. 目前注释的原因暂时没有用途server 端已经支持跨域
// proxy: {
// ['/admin-api']: {
// target: env.VITE_BASE_URL,
// ws: false,
// changeOrigin: true,
// rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''),
// },
// },
},
{
find: /\@\//,
replacement: `${pathResolve('src')}/`
}
]
},
build: {
minify: 'terser',
outDir: env.VITE_OUT_DIR || 'dist',
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
// brotliSize: false,
terserOptions: {
compress: {
drop_debugger: env.VITE_DROP_DEBUGGER === 'true',
drop_console: env.VITE_DROP_CONSOLE === 'true'
}
},
rollupOptions: {
output: {
manualChunks: {
echarts: ['echarts'] // 将 echarts 单独打包,参考 https://gitee.com/yudaocode/yudao-ui-admin-vue3/issues/IAB1SX 讨论
}
// 项目使用的vite插件。 单独提取到build/vite/plugin中管理
plugins: createVitePlugins(),
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/styles/variables.scss";',
javascriptEnabled: true
}
}
},
},
},
optimizeDeps: { include, exclude }
}
resolve: {
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.scss', '.css'],
alias: [
{
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js'
},
{
find: /\@\//,
replacement: `${pathResolve('src')}/`
}
]
},
build: {
minify: 'terser',
outDir: env.VITE_OUT_DIR || 'dist',
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
// brotliSize: false,
terserOptions: {
compress: {
drop_debugger: env.VITE_DROP_DEBUGGER === 'true',
drop_console: env.VITE_DROP_CONSOLE === 'true'
}
},
rollupOptions: {
output: {
manualChunks: {
echarts: ['echarts'] // 将 echarts 单独打包,参考 https://gitee.com/yudaocode/yudao-ui-admin-vue3/issues/IAB1SX 讨论
}
},
},
},
optimizeDeps: {include, exclude}
}
}