This commit is contained in:
ctw committed 2025-01-09 19:55:48 +08:00
commit 9821ae2345
9 files changed
+476 -46

No files matched your search

+17
View File
@@ -1,5 +1,22 @@
import request from "/@/utils/request"
export function history(query?: Object) {
return request({
url: '/hard/hard-after-sale/history',
method: 'get',
params: query
})
}
export function detailByOrderId(query?: Object) {
return request({
url: '/hard/hard-after-sale/detail-by-order-id',
method: 'get',
params: query
})
}
export function pageJoin(query?: Object) {
return request({
url: '/hard/hard-after-sale/page',
+8
View File
@@ -1,5 +1,13 @@
import request from "/@/utils/request"
export function getCarByOrderId(query?: Object) {
return request({
url: '/hard/hard-car/order-id',
method: 'get',
params: query
})
}
export function pageJoin(query?: Object) {
return request({
url: '/hard/hard-car/page-join',
+8
View File
@@ -1,5 +1,13 @@
import request from '/@/utils/request';
export function pageJoinSelect(query?: Object) {
return request({
url: '/wallet/mch-manage/page-join-select',
method: 'get',
params: query,
});
}
export function pageJoin(query?: Object) {
return request({
url: '/wallet/mch-manage/page-join',
+2 -2
View File
@@ -42,8 +42,8 @@ async function getOptions() {
const _pa = {
...queryForm
}
const { data } = await deptApi.deptTree()
state.options = filterTreeData(data ?? [])
const { data } = await deptApi.deptTree(_pa)
state.options = data ?? []
} finally {
setTimeout(() => state.loading = false, 500);
}
+4 -13
View File
@@ -1,16 +1,7 @@
<template>
<el-select
style="width: 100%"
v-model="state.selectId"
:placeholder="props.placeholder"
clearable
remote-show-suffix
filterable
remote
:remote-method="remoteSearch"
:loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()"
>
<el-select style="width: 100%" v-model="state.selectId" :placeholder="props.placeholder" clearable
remote-show-suffix filterable remote :remote-method="remoteSearch" :loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()">
<el-option v-for="v in state.options" :key="v.id" :label="`${v.name}`" :value="v.id">
<div class="flex items-center">
<div class="color-primary">{{ v.name }}</div>
@@ -65,7 +56,7 @@ async function getOptions() {
const _pa = {
...queryForm,
};
const { data } = await mchApi.pageJoin(_pa);
const { data } = await mchApi.pageJoinSelect(_pa);
state.options = data.records ?? [];
} finally {
setTimeout(() => (state.loading = false), 500);
+62
View File
@@ -0,0 +1,62 @@
<template>
<el-dialog title="购物车" v-model="visible" :close-on-click-modal="false" draggable>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle">
<el-table-column label="商品名" align="center" prop="productName" />
<el-table-column label="商品图片" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="ticketId">
<template #default="{ row }">
<span>{{ displayPrice(row.productPrice) }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" align="center" prop="productCount" />
<el-table-column label="商品总额" align="center" prop="totalPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.totalPrice) }}</span>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<template #footer>
<span class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="shop-car">
import { BasicTableProps, useTable } from "/@/hooks/table";
import * as hardCar from "/@/api/hard/hard-car";
import { displayPrice } from "/@/utils/formatMoney"
// 定义变量内容
const visible = ref(false)
const state: BasicTableProps = reactive<BasicTableProps>({
createdIsNeed: false,
queryForm: {},
pageList: hardCar.getCarByOrderId
})
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
// 打开弹窗
const openDialog = (id: string) => {
visible.value = true
if (id) {
state.queryForm.orderId = id
getDataList()
}
};
// 暴露变量
defineExpose({
openDialog
});
</script>
@@ -0,0 +1,209 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<el-descriptions :column="3" border title="订单信息">
<el-descriptions-item :span="3" label="订单号: ">
{{ globalData.detail.id }}
</el-descriptions-item>
<el-descriptions-item label="订单类型: ">
<dict-tag :options="hard_order_type" :value="globalData.detail.orderType" />
</el-descriptions-item>
<el-descriptions-item label="付款方式: ">
<dict-tag :options="hard_pay_type" :value="globalData.detail.payType" />
</el-descriptions-item>
<el-descriptions-item label="订单状态: ">
<dict-tag :options="hard_order_status" :value="globalData.detail.orderStatus" />
</el-descriptions-item>
<el-descriptions-item label="商户: ">
<span> {{ globalData.detail.merchantName }}</span>
</el-descriptions-item>
<el-descriptions-item label="设备名: ">
<span> {{ globalData.detail.hardName }}</span>
</el-descriptions-item>
<el-descriptions-item label="设备类型: ">
<span> {{ globalData.detail.hardType }}</span>
</el-descriptions-item>
<el-descriptions-item label="商品总价: ">
<span class="color-success">
{{ displayPrice(globalData.detail.totalPrice) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="额外支付: ">
<span class="color-danger">
{{ displayPrice(globalData.detail.extraPrice) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="实际支付: ">
<span class="color-primary">
{{ displayPrice(globalData.detail.payPrice) }}
</span>
</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="1" title="商品信息">
<el-descriptions-item labelClassName="no-colon">
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle">
<el-table-column label="商品名" align="center" prop="productName" />
<el-table-column label="商品图片" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="ticketId">
<template #default="{ row }">
<span>{{ displayPrice(row.productPrice) }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" align="center" prop="productCount" />
<el-table-column label="商品总额" align="center" prop="totalPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.totalPrice) }}</span>
</template>
</el-table-column>
</el-table>
</el-descriptions-item>
</el-descriptions>
<el-descriptions v-if="globalData.afterSaleData.id" title="售后信息">
</el-descriptions>
<el-descriptions v-if="globalData.log && globalData.log.length" title="售后日志">
</el-descriptions>
</div>
</div>
</template>
<script setup lang="ts" name="order-refund">
import { BasicTableProps, useTable } from "/@/hooks/table";
import { useMessage, useMessageBox } from "/@/hooks/message";
import { useDict } from '/@/hooks/dict';
import * as hardOrder from "/@/api/hard/hard-order";
import * as hardCar from "/@/api/hard/hard-car";
import * as hardAfterSaleApi from '/@/api/hard/hard-after-sale'
import * as hardAfterSaleLogApi from '/@/api/hard/hard-after-sale-log'
import { displayPrice } from "/@/utils/formatMoney"
import { data } from "autoprefixer";
// 定义查询字典
const { hard_pay_type, hard_order_type, hard_order_status, hard_type } = useDict("hard_pay_type", "hard_order_type", "hard_order_status", "hard_type")
const { query } = useRoute()
const globalData = reactive<any>({
detail: {},
afterSaleData: {},
log: []
})
const state: BasicTableProps = reactive<BasicTableProps>({
createdIsNeed: false,
queryForm: {},
pagination: {
size: 100,
},
pageList: hardCar.getCarByOrderId
})
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
onMounted(async () => {
await getDetail()
})
const getDetail = async () => {
const id = query.id as unknown as any
if (!id) return
state.queryForm.orderId = id
const { data: orderData } = await hardOrder.getObj(id)
globalData.detail = orderData
getDataList()
const { data: afterSaleData } = await hardAfterSaleApi.detailByOrderId({ orderId: id })
if (afterSaleData && afterSaleData.id) {
globalData.afterSaleData = afterSaleData
const { data: log } = await hardAfterSaleApi.history(afterSaleData.id)
globalData.log = log
}
}
</script>
<style lang="scss" scoped>
:deep(.el-descriptions) {
&:not(:nth-child(1)) {
margin-top: 20px;
}
.el-descriptions__title {
display: flex;
align-items: center;
&::before {
display: inline-block;
width: 3px;
height: 20px;
margin-right: 10px;
background-color: #409eff;
content: '';
}
}
.el-descriptions-item__container {
margin: 0 10px;
.no-colon {
margin: 0;
&::after {
content: '';
}
}
}
}
// 时间线样式调整
:deep(.el-timeline) {
margin: 10px 0 0 160px;
.el-timeline-item__wrapper {
position: relative;
top: -20px;
.el-timeline-item__timestamp {
position: absolute !important;
top: 10px;
left: -150px;
}
}
.el-timeline-right-content {
display: flex;
align-items: center;
min-height: 30px;
padding: 10px;
background-color: var(--app-content-bg-color);
&::before {
position: absolute;
top: 10px;
left: 13px;
border-color: transparent var(--app-content-bg-color) transparent transparent;
/* 尖角颜色,左侧朝向 */
border-style: solid;
border-width: 8px;
/* 调整尖角大小 */
content: '';
}
}
.dot-node-style {
position: absolute;
left: -5px;
display: flex;
width: 20px;
height: 20px;
font-size: 10px;
color: #fff;
border-radius: 50%;
justify-content: center;
align-items: center;
}
}
</style>
+155 -26
View File
@@ -1,35 +1,119 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<el-row>
<div class="mb8" style="width: 100%">
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
v-auth="'hard_hardwareOrder_add'">
新 增
</el-button>
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'hard_hardwareOrder_del'"
@click="handleDelete(selectObjs)">
删除
</el-button>
<right-toolbar v-model:showSearch="showSearch" :export="'hard_hardwareOrder_export'"
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
@queryTable="getDataList"></right-toolbar>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row :gutter="24">
<el-col :span="4">
<el-form-item class="w100" label="用户" prop="userIds">
<select-user v-model="state.queryForm.userIds" />
</el-form-item>
</el-col>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
}}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
</el-form-item>
</el-row>
</el-form>
<el-tabs v-if="tabList && tabList.length" v-model="activeName" @tab-click="handleClick">
<div v-for="(v) in tabList" :key="v.value">
<el-tab-pane :label="v.label" :name="v.value">
<div></div>
</el-tab-pane>
</div>
</el-row>
</el-tabs>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
@sort-change="sortChangeHandle">
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="40" />
<el-table-column prop="userId" label="用户id" show-overflow-tooltip />
<el-table-column prop="merchantId" label="商户id" show-overflow-tooltip />
<el-table-column prop="hardId" label="设备id" show-overflow-tooltip />
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button icon="edit-pen" text type="primary" v-auth="'hard_hardwareOrder_edit'"
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
<el-button icon="delete" text type="primary" v-auth="'hard_hardwareOrder_del'"
@click="handleDelete([scope.row.id])">删除</el-button>
<el-table-column type="index" label="#" width="50" />
<el-table-column prop="username" label="用户" />
<el-table-column prop="userAvatar" label="头像">
<template #default="{ row }">
<preview-image :src="row.userAvatar" />
</template>
</el-table-column>
<el-table-column prop="userMobile" width="120" label="手机号" />
<el-table-column width="200px" label="设备信息">
<template #default="{ row }">
<div class="status">
<span>商户</span>
<span>
{{ row.merchantName }}
</span>
</div>
<div class="status">
<span>设备名</span>
<span>
{{ row.hardName }}
</span>
</div>
<div class="status">
<span>设备类型</span>
<span>
{{ row.hardType }}
</span>
</div>
</template>
</el-table-column>
<el-table-column width="250px" label="订单信息">
<template #default="{ row }">
<div class="status">
<span>订单类型</span>
<span>
<dict-tag :options="hard_order_type" :value="row.orderType" />
</span>
</div>
<div class="status">
<span>支付方式</span>
<span>
<dict-tag :options="hard_pay_type" :value="row.payType" />
</span>
</div>
<div class="status">
<span>订单状态</span>
<span>
<dict-tag :options="hard_order_status" :value="row.orderStatus" />
</span>
</div>
</template>
</el-table-column>
<el-table-column width="200px" label="订单信息">
<template #default="{ row }">
<div class="status">
<span>商品总价</span>
<span class="color-success">
{{ displayPrice(row.totalPrice) }}
</span>
</div>
<div class="status">
<span>额外支付</span>
<span class="color-danger">
{{ displayPrice(row.extraPrice) }}
</span>
</div>
<div class="status">
<span>实际支付</span>
<span class="color-primary">
{{ displayPrice(row.payPrice) }}
</span>
</div>
</template>
</el-table-column>
<el-table-column label="支付时间" align="center" prop="payTime" width="180px" />
<el-table-column label="操作" width="200">
<template #default="{ row }">
<el-button icon="ShoppingCartFull" text type="primary"
@click="shopCarDialogRef.openDialog(row.id)">购物车</el-button>
<el-button icon="WalletFilled"
v-if="!row.payRefundId && row.orderType != 3 && row.orderType != 4 && ['5', '10'].includes(row.orderStatus)"
link type="primary" @click="doRefund(row)">
退款
</el-button>
<el-button v-if="false" icon="edit-pen" text type="primary" v-auth="'hard_hardwareOrder_edit'"
@click="formDialogRef.openDialog(row.id)">编辑</el-button>
<el-button v-if="false" icon="delete" text type="primary" v-auth="'hard_hardwareOrder_del'"
@click="handleDelete([row.id])">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -38,6 +122,7 @@
<!-- 编辑、新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
<shop-car ref="shopCarDialogRef" />
</div>
</template>
@@ -46,15 +131,23 @@
import { BasicTableProps, useTable } from "/@/hooks/table";
import * as hardOrder from "/@/api/hard/hard-order";
import * as hardCar from "/@/api/hard/hard-car";
import { getDicts } from '/@/api/admin/dict';
import { useMessage, useMessageBox } from "/@/hooks/message";
import { useDict } from '/@/hooks/dict';
import { displayPrice } from "/@/utils/formatMoney"
const { push } = useRouter()
// 引入组件
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
const ShopCar = defineAsyncComponent(() => import('../components/shop-car.vue'));
// 定义查询字典
const { hard_pay_type, hard_order_type, hard_order_status, hard_type } = useDict("hard_pay_type", "hard_order_type", "hard_order_status", "hard_type")
// 定义变量内容
const formDialogRef = ref()
const shopCarDialogRef = ref()
const tabList = ref<any>([{}])
const activeName = ref(null)
// 搜索变量
const queryRef = ref()
const showSearch = ref(true)
@@ -77,6 +170,12 @@ const {
tableStyle
} = useTable(state)
onMounted(async () => {
const { data } = await getDicts("hard_order_type")
data.unshift({ label: '全部', value: null })
tabList.value = data
})
// 清空搜索条件
const resetQuery = () => {
// 清空搜索条件
@@ -86,6 +185,15 @@ const resetQuery = () => {
getDataList()
}
const handleClick = (e: any) => {
state.queryForm.orderType = tabList.value[e.index].value
getDataList()
}
const doRefund = (row: any) => {
push({ path: '/hard/hard-after-sale/order-refund', query: { id: row.id } })
}
// 导出excel
const exportExcel = () => {
downBlobFile('/hard/hardwareOrder/export', Object.assign(state.queryForm, { ids: selectObjs }), 'hardwareOrder.xlsx')
@@ -113,4 +221,25 @@ const handleDelete = async (ids: string[]) => {
useMessage().error(err.msg);
}
};
</script>
</script>
<style scoped lang="scss">
.status {
display: flex;
align-items: center;
margin-bottom: 2px;
span {
display: inline-block;
}
span:nth-child(1) {
width: 100px;
text-align: left;
}
span:nth-child(2) {
flex: 1;
}
}
</style>
@@ -43,7 +43,7 @@ import { getObj, putObj } from "/@/api/wallet/wallet-setting"
const dataFormRef = ref();
const loading = ref(false)
// 提交表单数据
const form = reactive({
const form = reactive<any>({
id: undefined,
afterSaleRefundReasons: undefined,
afterSaleReturnReasons: undefined,
@@ -62,13 +62,12 @@ onMounted(() => {
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => { });
if (!valid) return false;
try {
loading.value = true;
const pa = {
...form,
payPrice: storePrice(form.payPrice),
bonusPrice: storePrice(form.bonusPrice),
afterSaleRefundReasons: form.afterSaleRefundReasons?.join(","),
afterSaleReturnReasons: form.afterSaleReturnReasons?.join(",")
}
await putObj(pa)
useMessage().success('修改成功');
@@ -85,7 +84,14 @@ const getwalletRechargePackageData = (id: string) => {
// 获取数据
loading.value = true
getObj(id).then((res: any) => {
Object.assign(form, res.data)
const data: any = res.data;
if (data.afterSaleRefundReasons) {
data.afterSaleRefundReasons = data.afterSaleRefundReasons?.split(",")
}
if (data.afterSaleReturnReasons) {
data.afterSaleReturnReasons = data.afterSaleReturnReasons?.split(",")
}
Object.assign(form, data)
}).finally(() => {
loading.value = false
})