mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-08-14 18:11:53 +08:00
【代码优化】分支合并
This commit is contained in:
@@ -2,81 +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 }>() // 用户信息
|
||||
const WALLET_INIT_DATA = {
|
||||
balance: 0,
|
||||
totalExpense: 0,
|
||||
totalRecharge: 0
|
||||
} as WalletApi.WalletVO // 钱包初始化数据
|
||||
const wallet = ref<WalletApi.WalletVO>(WALLET_INIT_DATA) // 钱包信息
|
||||
|
||||
/** 查询用户钱包信息 */
|
||||
const getUserWallet = async () => {
|
||||
if (!props.user.id) {
|
||||
wallet.value = WALLET_INIT_DATA
|
||||
return
|
||||
}
|
||||
const params = { userId: props.user.id }
|
||||
wallet.value = (await WalletApi.getWallet(params)) || WALLET_INIT_DATA
|
||||
}
|
||||
|
||||
/** 监听用户编号变化 */
|
||||
watch(
|
||||
() => props.user.id,
|
||||
() => getUserWallet(),
|
||||
{ immediate: true }
|
||||
)
|
||||
defineProps<{ user: UserApi.UserVO; wallet: WalletApi.WalletVO }>() // 用户信息
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
.cell-item {
|
||||
display: inline;
|
||||
}
|
||||
|
276
src/views/member/user/detail/UserAftersaleList.vue
Normal file
276
src/views/member/user/detail/UserAftersaleList.vue
Normal file
@@ -0,0 +1,276 @@
|
||||
<template>
|
||||
<!-- 搜索 -->
|
||||
<ContentWrap>
|
||||
<el-form ref="queryFormRef" :inline="true" :model="queryParams" label-width="68px">
|
||||
<el-form-item label="商品名称" prop="spuName">
|
||||
<el-input
|
||||
v-model="queryParams.spuName"
|
||||
class="!w-280px"
|
||||
clearable
|
||||
placeholder="请输入商品 SPU 名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="退款编号" prop="no">
|
||||
<el-input
|
||||
v-model="queryParams.no"
|
||||
class="!w-280px"
|
||||
clearable
|
||||
placeholder="请输入退款编号"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单编号" prop="orderNo">
|
||||
<el-input
|
||||
v-model="queryParams.orderNo"
|
||||
class="!w-280px"
|
||||
clearable
|
||||
placeholder="请输入订单编号"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="售后状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
class="!w-280px"
|
||||
clearable
|
||||
placeholder="请选择售后状态"
|
||||
>
|
||||
<el-option label="全部" value="0" />
|
||||
<el-option
|
||||
v-for="dict in getDictOptions(DICT_TYPE.TRADE_AFTER_SALE_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="售后方式" prop="way">
|
||||
<el-select
|
||||
v-model="queryParams.way"
|
||||
class="!w-280px"
|
||||
clearable
|
||||
placeholder="请选择售后方式"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getDictOptions(DICT_TYPE.TRADE_AFTER_SALE_WAY)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="售后类型" prop="type">
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
class="!w-280px"
|
||||
clearable
|
||||
placeholder="请选择售后类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getDictOptions(DICT_TYPE.TRADE_AFTER_SALE_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-260px"
|
||||
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" />
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
重置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-tabs v-model="queryParams.status" @tab-click="tabClick">
|
||||
<el-tab-pane
|
||||
v-for="item in statusTabs"
|
||||
:key="item.label"
|
||||
:label="item.label"
|
||||
:name="item.value"
|
||||
/>
|
||||
</el-tabs>
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column align="center" label="退款编号" min-width="200" prop="no" />
|
||||
<el-table-column align="center" label="订单编号" min-width="200" prop="orderNo">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="openOrderDetail(row.orderId)">
|
||||
{{ row.orderNo }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息" min-width="600" prop="spuName">
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center">
|
||||
<el-image
|
||||
:src="row.picUrl"
|
||||
class="mr-10px h-30px w-30px"
|
||||
@click="imagePreview(row.picUrl)"
|
||||
/>
|
||||
<span class="mr-10px">{{ row.spuName }}</span>
|
||||
<el-tag v-for="property in row.properties" :key="property.propertyId" class="mr-10px">
|
||||
{{ property.propertyName }}: {{ property.valueName }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="订单金额" min-width="120" prop="refundPrice">
|
||||
<template #default="scope">
|
||||
<span>{{ fenToYuan(scope.row.refundPrice) }} 元</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="申请时间" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ formatDate(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="售后状态" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="售后方式">
|
||||
<template #default="scope">
|
||||
<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="120">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="openAfterSaleDetail(row.id)">处理退款</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as AfterSaleApi from '@/api/mall/trade/afterSale/index'
|
||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { createImageViewer } from '@/components/ImageViewer'
|
||||
import { TabsPaneContext } from 'element-plus'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { fenToYuan } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'UserAfterSaleList' })
|
||||
|
||||
const { push } = useRouter() // 路由跳转
|
||||
const props = defineProps<{
|
||||
userId: number
|
||||
}>()
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const list = ref<AfterSaleApi.TradeAfterSaleVO[]>([]) // 列表的数据
|
||||
const statusTabs = ref([
|
||||
{
|
||||
label: '全部',
|
||||
value: '0'
|
||||
}
|
||||
])
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
// 查询参数
|
||||
const queryParams = ref({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
no: null,
|
||||
status: '0',
|
||||
orderNo: null,
|
||||
spuName: null,
|
||||
createTime: [],
|
||||
way: null,
|
||||
type: null,
|
||||
userId: null
|
||||
})
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = cloneDeep(queryParams.value)
|
||||
// 处理掉全部的状态,不传就是全部
|
||||
if (data.status === '0') {
|
||||
delete data.status
|
||||
}
|
||||
// 执行查询
|
||||
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
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = async () => {
|
||||
queryParams.value.pageNo = 1
|
||||
await getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** tab 切换 */
|
||||
const tabClick = async (tab: TabsPaneContext) => {
|
||||
queryParams.value.status = tab.paneName as any
|
||||
await getList()
|
||||
}
|
||||
|
||||
/** 处理退款 */
|
||||
const openAfterSaleDetail = (id: number) => {
|
||||
push({ name: 'TradeAfterSaleDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 查看订单详情 */
|
||||
const openOrderDetail = (id: number) => {
|
||||
push({ name: 'TradeOrderDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 商品图预览 */
|
||||
const imagePreview = (imgUrl: string) => {
|
||||
createImageViewer({
|
||||
urlList: [imgUrl]
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
// 设置 statuses 过滤
|
||||
for (const dict of getDictOptions(DICT_TYPE.TRADE_AFTER_SALE_STATUS)) {
|
||||
statusTabs.value.push({
|
||||
label: dict.label,
|
||||
value: dict.value
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
68
src/views/member/user/detail/UserBalanceList.vue
Normal file
68
src/views/member/user/detail/UserBalanceList.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<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 align="center" label="钱包余额" prop="balance">
|
||||
<template #default="{ row }"> {{ fenToYuan(row.balance) }} 元</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="交易时间"
|
||||
prop="createTime"
|
||||
width="180px"
|
||||
/>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as WalletTransactionApi from '@/api/pay/wallet/transaction'
|
||||
import { fenToYuan } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'UserBalanceList' })
|
||||
const props = defineProps({
|
||||
walletId: {
|
||||
type: Number,
|
||||
required: false
|
||||
}
|
||||
})
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
walletId: null
|
||||
})
|
||||
const list = ref([]) // 列表的数据
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
queryParams.walletId = props.walletId as any
|
||||
const data = await WalletTransactionApi.getWalletTransactionPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
@@ -20,7 +20,7 @@
|
||||
<template #header>
|
||||
<CardTitle title="账户信息" />
|
||||
</template>
|
||||
<UserAccountInfo :user="user" />
|
||||
<UserAccountInfo :user="user" :wallet="wallet" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- 下边:账户明细 -->
|
||||
@@ -40,7 +40,7 @@
|
||||
<UserExperienceRecordList :user-id="id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="余额" lazy>
|
||||
<WalletTransactionList :user-id="id" />
|
||||
<UserBalanceList :wallet-id="wallet.id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="收货地址" lazy>
|
||||
<UserAddressList :user-id="id" />
|
||||
@@ -49,7 +49,7 @@
|
||||
<UserOrderList :user-id="id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="售后管理" lazy>
|
||||
<TradeAfterSale :user-id="id" />
|
||||
<UserAfterSaleList :user-id="id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="收藏记录" lazy>
|
||||
<UserFavoriteList :user-id="id" />
|
||||
@@ -69,6 +69,7 @@
|
||||
<UserForm ref="formRef" @success="getUserData(id)" />
|
||||
</template>
|
||||
<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'
|
||||
import UserForm from '@/views/member/user/UserForm.vue'
|
||||
@@ -82,8 +83,8 @@ import UserOrderList from './UserOrderList.vue'
|
||||
import UserPointList from './UserPointList.vue'
|
||||
import UserSignList from './UserSignList.vue'
|
||||
import UserFavoriteList from './UserFavoriteList.vue'
|
||||
import WalletTransactionList from '@/views/pay/wallet/transaction/WalletTransactionList.vue'
|
||||
import TradeAfterSale from '@/views/mall/trade/afterSale/index.vue'
|
||||
import UserAfterSaleList from './UserAftersaleList.vue'
|
||||
import UserBalanceList from './UserBalanceList.vue'
|
||||
import { CardTitle } from '@/components/Card/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
@@ -113,6 +114,24 @@ const { currentRoute } = useRouter() // 路由
|
||||
const { delView } = useTagsViewStore() // 视图操作
|
||||
const route = useRoute()
|
||||
const id = Number(route.params.id)
|
||||
/* 用户钱包相关信息 */
|
||||
const WALLET_INIT_DATA = {
|
||||
balance: 0,
|
||||
totalExpense: 0,
|
||||
totalRecharge: 0
|
||||
} as WalletApi.WalletVO // 钱包初始化数据
|
||||
const wallet = ref<WalletApi.WalletVO>(WALLET_INIT_DATA) // 钱包信息
|
||||
|
||||
/** 查询用户钱包信息 */
|
||||
const getUserWallet = async () => {
|
||||
if (!id) {
|
||||
wallet.value = WALLET_INIT_DATA
|
||||
return
|
||||
}
|
||||
const params = { userId: id }
|
||||
wallet.value = (await WalletApi.getWallet(params)) || WALLET_INIT_DATA
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (!id) {
|
||||
ElMessage.warning('参数错误,会员编号不能为空!')
|
||||
@@ -120,6 +139,7 @@ onMounted(() => {
|
||||
return
|
||||
}
|
||||
getUserData(id)
|
||||
getUserWallet()
|
||||
})
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
Reference in New Issue
Block a user