Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-08-29 17:30:11 +08:00
commit 3acd23bc7f
18 files changed
+525 -258

No files matched your search

+8
View File
@@ -8,6 +8,14 @@ export function adminRefund(data?: Object) {
})
}
export function adminReinforceRefund(data?: Object) {
return request({
url: "/hard/hard-after-sale/admin-reinforce-refund",
method: "post",
data,
})
}
export function history(query?: Object) {
return request({
url: "/hard/hard-after-sale/history",
+42 -35
View File
@@ -1,57 +1,64 @@
import request from "/@/utils/request"
export function getCarByOrderId(query?: Object) {
return request({
url: '/hard/hard-car/order-id',
method: 'get',
params: query
})
return request({
url: "/hard/hard-car/order-id",
method: "get",
params: query,
})
}
export function refundCar(query?: Object) {
return request({
url: "/hard/hard-car/refund-car",
method: "get",
params: query,
})
}
export function pageJoin(query?: Object) {
return request({
url: '/hard/hard-car/page-join',
method: 'get',
params: query
})
return request({
url: "/hard/hard-car/page-join",
method: "get",
params: query,
})
}
export function fetchList(query?: Object) {
return request({
url: '/hard/hard-car/page',
method: 'get',
params: query
})
return request({
url: "/hard/hard-car/page",
method: "get",
params: query,
})
}
export function addObj(obj?: Object) {
return request({
url: '/hard/hard-car',
method: 'post',
data: obj
})
return request({
url: "/hard/hard-car",
method: "post",
data: obj,
})
}
export function getObj(id?: string) {
return request({
url: '/hard/hard-car/' + id,
method: 'get'
})
return request({
url: "/hard/hard-car/" + id,
method: "get",
})
}
export function delObjs(ids?: Object) {
return request({
url: '/hard/hard-car',
method: 'delete',
data: ids
})
return request({
url: "/hard/hard-car",
method: "delete",
data: ids,
})
}
export function putObj(obj?: Object) {
return request({
url: '/hard/hard-car',
method: 'put',
data: obj
})
return request({
url: "/hard/hard-car",
method: "put",
data: obj,
})
}
+2 -2
View File
@@ -203,13 +203,13 @@ export function useTable(options?: BasicTableProps) {
* 刷新后不跳转第一页,则入参 getDataList(false)
* @param refresh 是否刷新当前页码
*/
const getDataList = (refresh?: any) => {
const getDataList = async (refresh?: any) => {
// 如果需要刷新,则将state.pagination.current重置为1
if (refresh !== false) {
state.pagination!.current = 1
}
// 再次发起查询操作
query()
await query()
}
/**
+6
View File
@@ -9,6 +9,12 @@ export function displayPrice(price: any, suffix: string = "元", fixed = 2) {
return (parsedNumber / 100.0).toFixed(fixed) + suffix
}
export function displayWeight(price: any, fixed = 2) {
if (typeof price === "undefined") return "0"
const parsedNumber = typeof price === "string" ? parseFloat(price) : price
return parsedNumber.toFixed(fixed)
}
/**
* 把显示价格改为分
* @param price
+4 -1
View File
@@ -331,6 +331,7 @@ export function handleBlobFile(response: any, fileName: string) {
blob = new Blob(safeData, { type: "application/octet-stream" })
}
} catch (error) {
console.error("导出错误", error)
useMessage().error("文件数据格式错误")
return
}
@@ -353,8 +354,10 @@ export function handleBlobFile(response: any, fileName: string) {
"image/jpeg",
"image/png",
// "application/zip" // 添加 ZIP 文件类型支持
"application/octet-stream"
"application/octet-stream",
"text/xml",
]
if (!allowedTypes.includes(blob.type) && blob.type !== "") {
useMessage().error("不支持的文件类型")
return
+2 -2
View File
@@ -246,12 +246,12 @@ const taskSubmitEvent = () => {
// 导出excel
const exportExcel = () => {
const _data = { ...state.queryForm }
if (_data.role) {
if (_data.role && !Array.isArray(_data.role)) {
_data.role = [_data.role]
} else {
_data.role = []
}
postDownBlobFile("/admin/user/export", Object.assign(_data, { ids: selectObjs }), "用户管理.xlsx")
postDownBlobFile("/admin/user/export", Object.assign(_data, { ids: selectObjs.value }), "用户管理.xlsx")
}
// 是否可以多选
+17 -23
View File
@@ -10,23 +10,19 @@
<dict-select v-model="state.queryForm.status" dict-code="hard_sale_status" />
</el-form-item>
<el-form-item style="width: 300px" label="申请时间" prop="createTimeList">
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD" type="daterange" />
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD"
type="daterange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<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-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 :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="username" label="用户" />
@@ -58,27 +54,25 @@
<el-table-column label="申请时间" align="center" width="180px" prop="createTime" />
<el-table-column label="操作" width="200">
<template #default="{ row }">
<el-button icon="ShoppingCartFull" text type="primary" @click="shopCarDialogRef.openDialog(row.orderId)">购物车</el-button>
<el-button icon="WalletFilled" v-auth="'hard_hardAfterSale_detail_view'" link type="primary" @click="doRefund(row)">
<el-button icon="ShoppingCartFull" text type="primary"
@click="shopCarDialogRef.openDialog(row.orderId)">购物车</el-button>
<el-button icon="WalletFilled" v-auth="'hard_hardAfterSale_detail_view'" link type="primary"
@click="doRefund(row)">
退款
</el-button>
<el-button
v-if="false"
icon="edit-pen"
text
type="primary"
v-auth="'hard_hardAfterSale_edit'"
@click="formDialogRef.openDialog(row.id)"
>
<el-button v-if="false" icon="edit-pen" text type="primary" v-auth="'hard_hardAfterSale_edit'"
@click="formDialogRef.openDialog(row.id)">
编辑
</el-button>
<el-button v-if="false" icon="delete" text type="primary" v-auth="'hard_hardAfterSale_del'" @click="handleDelete([row.id])">
<el-button v-if="false" icon="delete" text type="primary" v-auth="'hard_hardAfterSale_del'"
@click="handleDelete([row.id])">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
@@ -41,14 +41,8 @@
</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 :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 }">
@@ -75,16 +69,13 @@
<el-descriptions-item :column="1" label="退款状态: ">
<dict-tag :options="hard_sale_status" :value="globalData.afterSaleData.status" />
</el-descriptions-item>
<el-descriptions-item
:column="1"
<el-descriptions-item :column="1"
v-if="globalData.type == 'apply' && globalData.afterSaleData.status == 10"
v-auth="'hard_hardAfterSale_change'"
label="操作: "
label-class-name="no-colon"
>
v-auth="'hard_hardAfterSale_change'" label="操作: " label-class-name="no-colon">
<div class="flex justify-evenly">
<el-button type="primary" @click="agree"> 同意售后 </el-button>
<el-button type="danger" @click="refundRejectRef.openDialog(globalData.detail.id)"> 拒绝售后 </el-button>
<el-button type="danger" @click="refundRejectRef.openDialog(globalData.detail.id)"> 拒绝售后
</el-button>
</div>
</el-descriptions-item>
</el-descriptions>
+6 -1
View File
@@ -3,7 +3,12 @@
<div class="layout-padding-auto layout-padding-view">
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
:defaultTreeWidth="20" :nodeClickable="false">
:defaultTreeWidth="20" :nodeClickable="false" :props="{
label: 'name',
children: 'children',
value: 'id',
disabled: 'isLockNone',
}">
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
+28 -35
View File
@@ -1,16 +1,14 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<DraggableDepTree
ref="draggableDepTreeRef"
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
:defaultTreeWidth="20" :nodeClickable="false" :props="{
label: 'name',
children: 'children',
value: 'id',
disabled: 'isLockNone',
}">
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
@@ -24,30 +22,27 @@
<dict-select v-model="state.queryForm.hardType" dict-code="hard_type" />
</el-form-item>
<el-form-item style="width: 300px" label="打印时间" prop="createTimeList">
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD" type="daterange" />
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD"
type="daterange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<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-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 :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="60" />
<el-table-column width="200" label="用户">
<template #default="{ row }">
<div class="flex flex-row items-center justify-center">
<preview-image width="50px" height="50px" :src="row.userAvatar" />
<div class="flex flex-col ml-2 items-start cursor-pointer hover:underline hover:text-blue-500">
<div
class="flex flex-col ml-2 items-start cursor-pointer hover:underline hover:text-blue-500">
<span> {{ row.username }}</span>
<span> {{ row.userMobile }}</span>
</div>
@@ -89,23 +84,18 @@
<el-table-column prop="createTime" label="打印时间" />
<el-table-column label="操作" width="150">
<template #default="{ row }">
<el-button icon="InfoFilled" link type="primary" @click="doRefund(row)"> 订单详情 </el-button>
<el-button
v-if="false"
icon="edit-pen"
text
type="primary"
<el-button icon="InfoFilled" link type="primary" @click="doRefund(row)"> 订单详情
</el-button>
<el-button v-if="false" icon="edit-pen" text type="primary"
v-auth="'hard_hardInvoice_edit'"
@click="formDialogRef.openDialog(row.id)"
>编辑</el-button
>
<el-button v-if="false" icon="delete" text type="primary" v-auth="'hard_hardInvoice_del'" @click="handleDelete([row.id])"
>删除</el-button
>
@click="formDialogRef.openDialog(row.id)">编辑</el-button>
<el-button v-if="false" icon="delete" text type="primary"
v-auth="'hard_hardInvoice_del'" @click="handleDelete([row.id])">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
</template>
</DraggableDepTree>
</div>
@@ -209,14 +199,17 @@ const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepT
display: flex;
align-items: center;
margin-bottom: 2px;
span {
display: inline-block;
}
span:nth-child(1) {
min-width: 60px;
max-width: 100px;
text-align: left;
}
span:nth-child(2) {
flex: 1;
min-width: 50px;
@@ -32,7 +32,8 @@
</el-form>
</template>
<script setup lang="ts">
<script setup lang="ts" name="RefundForm">
import { useMessage } from "/@/hooks/message"
import * as walletSettingApi from "/@/api/wallet/wallet-setting"
// 定义变量内容
@@ -80,11 +81,21 @@ const getSetting = async () => {
// 提交
const validate = async () => {
const valid = await dataFormRef.value.validate().catch(() => { })
if (!valid) return false
if (!valid) {
if (!form.applyReason) {
useMessage().error("请选择退款原因")
}
return false
}
return form
}
const resetFields = async () => {
await dataFormRef.value.resetFields()
}
defineExpose({
validate,
resetFields
})
</script>
@@ -4,8 +4,8 @@
<el-tab-pane v-for="(v) in data.tabs" :key="v.name" :label="v.label" :name="v.name" />
</el-tabs>
<div class="container" v-loading="loading">
<refund-form ref="refundFormRef" v-if="state.currentTab === 'INFO'" />
<refund-table ref="refundTableRef" v-if="state.currentTab === 'CAR'" />
<refund-form ref="refundFormRef" v-show="state.currentTab === 'INFO'" />
<refund-table ref="refundTableRef" v-show="state.currentTab === 'CAR'" />
</div>
<template #footer>
<span class="dialog-footer">
@@ -56,19 +56,27 @@ const state = reactive<any>({
const openDialog = (id: string) => {
visible.value = true
state.orderId = id
nextTick(async () => {
loading.value = true
await new Promise((resolve) => setTimeout(() => resolve(true), 500))
state.currentTab = data.tabs[0].name
refundTableRef.value?.getCarList(state.orderId)
refundFormRef.value?.resetFields()
loading.value = false
})
}
function tabClick(e: any) {
console.log("tabClick", e);
nextTick(async () => {
loading.value = true
try {
await new Promise((resolve) => setTimeout(() => resolve(true), 250))
switch (e.paneName) {
case "CAR":
refundTableRef.value?.getCarList(state.orderId)
break
}
// switch (e.paneName) {
// case "CAR":
// refundTableRef.value?.getCarList(state.orderId)
// break
// }
await new Promise((resolve) => setTimeout(() => resolve(true), 250))
} catch (error: any) {
console.log(error);
@@ -80,11 +88,20 @@ function tabClick(e: any) {
// 提交
const onSubmit = async () => {
// 校验
const formValidate = await refundFormRef.value?.validate()
if (formValidate === false) return
// 判断有没有选择退款商品
const tableValidate = await refundTableRef.value?.validate()
if (tableValidate === false) return
try {
loading.value = true
const _data = {}
await hardAfterSaleApi.adminRefund(_data)
const _data = {
...formValidate,
orderId: state.orderId,
carList: tableValidate
}
await hardAfterSaleApi.adminReinforceRefund(_data)
useMessage().success("退款成功")
visible.value = false
emit("refresh")
@@ -1,32 +1,147 @@
<template>
<el-table :data="state.dataList" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle" show-summary
:summary-method="getSummaries">
<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" />
<div v-else class="w-[50px] h-[50px]" />
<div class="refund-table">
<el-descriptions :column="1" title="购物车商品">
<el-descriptions-item labelClassName="no-colon">
<el-table :data="state.dataList" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle" show-summary
:summary-method="getSummaries">
<el-table-column label="商品名" width="120" align="center" prop="productName" />
<el-table-column label="商品图片" width="120" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
<div v-else class="w-[60px] h-[60px]" />
</template>
</el-table-column>
<el-table-column width="120" label="商品类型" align="center" prop="productName">
<template #default="{ row }">
<dict-tag :options="supermarket_nature" :value="row.productNature" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="productPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.productPrice) }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" align="center" prop="productCount">
<template #default="{ row }">
<span v-if="row.productNature == 1">{{ row.productCount }}</span>
<span v-if="row.productNature == 2">{{ displayWeight(row.productWeight) }}kg</span>
</template>
</el-table-column>
<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 :column="1" title="已退款商品">
<el-descriptions-item labelClassName="no-colon">
<el-table :data="refundSuccessList" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle" show-summary
:summary-method="getSummaries">
<el-table-column label="商品名" width="120" align="center" prop="productName" />
<el-table-column label="商品图片" width="120" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
<div v-else class="w-[60px] h-[60px]" />
</template>
</el-table-column>
<el-table-column label="商品类型" width="120" align="center" prop="productName">
<template #default="{ row }">
<dict-tag :options="supermarket_nature" :value="row.productNature" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="productPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.productPrice) }}</span>
</template>
</el-table-column>
<el-table-column label="已退款商品数量" align="center" prop="productCount">
<template #default="{ row }">
<span v-if="row.productNature == 1">{{ row.productCount }}</span>
<span v-if="row.productNature == 2">{{ displayWeight(row.productWeight) }}kg</span>
</template>
</el-table-column>
<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 :column="1" title="退款商品">
<template #extra>
<el-button type="primary" text @click="handleAllRefund">全部退款</el-button>
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="productPrice">
<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 labelClassName="no-colon">
<el-table :data="disposeDataList" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle" show-summary
:summary-method="getSummaries">
<el-table-column label="商品名" width="120" align="center" prop="productName" />
<el-table-column label="商品图片" width="120" align="center" prop="code">
<template #default="{ row }">
<preview-image v-if="row.productPic" :src="row.productPic" />
<div v-else class="w-[60px] h-[60px]" />
</template>
</el-table-column>
<el-table-column label="商品类型" width="120" align="center" prop="productName">
<template #default="{ row }">
<dict-tag :options="supermarket_nature" :value="row.productNature" />
</template>
</el-table-column>
<el-table-column label="商品价格" align="center" prop="productPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.productPrice) }}</span>
</template>
</el-table-column>
<el-table-column label="退款商品数量" align="center" prop="refundProductCount">
<template #default="{ row }">
<div class="w-full h-full">
<!-- start 重量商品 start -->
<el-input-number size="small" v-if="row.productNature == 2"
v-model="row.refundProductWeight" :min="0" :max="row.maxRefundProductWeight"
:step="0.01" @change="handleRefundProductCount($event, row)" />
<!-- end 重量商品 end -->
<!-- start 数量商品 start -->
<el-input-number size="small" v-else v-model="row.refundProductCount" :min="0"
:max="row.maxRefundProductCount" @change="handleRefundProductCount($event, row)" />
<!-- end 数量商品 end -->
<div class="h-4">
<div v-if="row.productNature == 1 && row.refundProductCount >= row.maxRefundProductCount"
class="color-danger text-xs">
该商品已全部退款
</div>
<div v-if="row.productNature == 2 && row.refundProductWeight >= row.maxRefundProductWeight"
class="color-danger text-xs">
该商品已全部退款
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="退款商品总额" align="center" prop="refundTotalPrice">
<template #default="{ row }">
<span>{{ displayPrice(row.refundTotalPrice) }}</span>
</template>
</el-table-column>
</el-table>
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script setup lang="ts">
<script setup lang="ts" name="RefundTable">
import { useMessage } from "/@/hooks/message"
import { BasicTableProps, useTable } from "/@/hooks/table"
import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
import { displayPrice, displayWeight } from "/@/utils/formatMoney"
import * as hardCar from "/@/api/hard/hard-car"
@@ -36,16 +151,166 @@ const state: BasicTableProps = reactive<BasicTableProps>({
pageList: hardCar.getCarByOrderId,
})
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
const refundSuccessList = ref<any>([])
const disposeDataList = ref<any>([])
const getCarList = (orderId: string) => {
const { supermarket_nature } = useDict("supermarket_nature")
// table hook
const { getDataList, sortChangeHandle, tableStyle } = useTable(state)
const getCarList = async (orderId: string) => {
state.queryForm.orderId = orderId
getDataList()
// 获取订单商品列表
await getDataList()
if (!state.dataList || !state.dataList.length) {
return
}
// 获取已退款的商品
const { data } = await hardCar.refundCar({ orderId })
if (!data || !data.length) {
disposeDataList.value = state.dataList.map((item) => {
if (!item) return null
return {
...item,
refundProductCount: 0,
maxRefundProductCount: item.productCount,
refundProductWeight: 0,
maxRefundProductWeight: displayWeight(item.productWeight),
refundTotalPrice: 0,
}
}).filter(Boolean)
return
}
refundSuccessList.value = data
// 计算出需要退款的商品
const refundViewList = [...state.dataList]
disposeDataList.value = refundViewList.map((item) => {
if (!item) return null
const target = data.find((v: any) => v.productId == item.productId)
return {
...item,
refundProductCount: 0,
maxRefundProductCount: item.productCount - (target?.productCount ?? 0),
refundProductWeight: 0,
maxRefundProductWeight: displayWeight(item.productWeight - (target?.productWeight ?? 0)),
refundTotalPrice: 0,
}
}).filter(Boolean)
console.log("disposeDataList:", disposeDataList.value);
}
const handleRefundProductCount = (value: any, row: any) => {
const target = disposeDataList.value.find((item: any) => item.id == row.id)
if (!target) return
const { productPrice } = target
target.refundTotalPrice = productPrice * value
}
// 全部退款
const handleAllRefund = () => {
if (!state.dataList || !state.dataList.length) return
const _list = [...disposeDataList.value]
for (const v of _list) {
const target = state.dataList.find((item: any) => item.id == v.id)
if (!target) continue
v.refundProductCount = target.productCount
v.refundProductWeight = displayWeight(target.productWeight)
v.refundTotalPrice = target.totalPrice
}
console.log("全部:", _list);
disposeDataList.value = _list
}
const getSummaries = (param: any) => {
const { columns, data } = param
const totalColumns = ["totalPrice", "totalPrice", "refundTotalPrice"]
const totalRow = Array.from({ length: columns.length }, () => "")
totalRow[0] = "合计"
columns.forEach((i: any, index: number) => {
if (totalColumns.includes(i.property)) {
const total = data
.filter((v: any) => v[i.property] != null)
.map((v: any) => Number(v[i.property]))
.reduce((pren: number, next: number) => pren + next, 0)
if (i.property.includes("Price")) {
totalRow[index] = displayPrice(total)
} else {
totalRow[index] = total
}
}
})
return totalRow
}
// 提交
const validate = async () => {
let valid = false
for (const v of disposeDataList.value) {
if (v.refundProductCount > 0 || v.refundProductWeight > 0) {
valid = true
break
}
}
if (!valid) {
useMessage().error("退款商品列表不能为空")
return false
}
// 处理一下
return disposeDataList.value.map((item: any) => {
return {
...item,
productCount: item.refundProductCount,
productWeight: displayWeight(item.refundProductWeight),
totalPrice: item.refundTotalPrice,
}
})
}
// 暴露变量
defineExpose({
getCarList,
validate,
})
</script>
</script>
<style lang="scss" scoped>
.refund-table {
padding: 0 10px;
}
: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: "";
}
}
}
}
</style>
+9 -5
View File
@@ -3,7 +3,12 @@
<div class="layout-padding-auto layout-padding-view">
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
:defaultTreeWidth="20" :nodeClickable="false">
:defaultTreeWidth="20" :nodeClickable="false" :props="{
label: 'name',
children: 'children',
value: 'id',
disabled: 'isLockNone',
}">
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
@@ -54,7 +59,8 @@
</div>
<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" :show-summary="false" :summary-method="getSummaries">
@sort-change="sortChangeHandle" :show-summary="false" :summary-method="getSummaries"
row-key="id">
<el-table-column type="selection" width="60" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column width="200" label="用户">
@@ -223,8 +229,7 @@
v-auth="'hard_hardwareOrder_edit'" @click="formDialogRef.openDialog(row.id)">
编辑
</el-button>
<el-button
v-if="!row.payRefundId && row.orderType !== '5' && !['5', '6', '8'].includes(row.payType)"
<el-button v-if="row.orderType !== '5' && !['5', '6', '8'].includes(row.payType)"
icon="stamp" text type="primary" v-auth="'hard_hardAfterSale_adminRefund'"
@click="adminRefundDailogRef.openDialog(row.id)">
退款
@@ -242,7 +247,6 @@
</template>
</DraggableDepTree>
</div>
<!-- 编辑、新增 -->
<transaction-list ref="transactionListRef" @refresh="getDataList(false)" />
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
+18 -32
View File
@@ -1,16 +1,14 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<DraggableDepTree
ref="draggableDepTreeRef"
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
:defaultTreeWidth="20" :nodeClickable="false" :props="{
label: 'name',
children: 'children',
value: 'id',
disabled: 'isLockNone',
}">
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
@@ -18,38 +16,26 @@
<dict-select v-model="state.queryForm.hourType" dict-code="daily_menu" />
</el-form-item>
<el-form-item style="width: 450px" label="创建时间" prop="payTimeList">
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<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-row>
<div class="mb8" style="width: 100%">
<right-toolbar
:search="false"
v-model:showSearch="showSearch"
:export="'hard_hardTotal_export_payType'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
></right-toolbar>
<right-toolbar :search="false" v-model:showSearch="showSearch"
:export="'hard_hardTotal_export_payType'" @exportExcel="exportExcel" class="ml10 mr20"
style="float: right" @queryTable="getDataList"></right-toolbar>
</div>
</el-row>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
:summary-method="getSummaries"
show-summary
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" :summary-method="getSummaries" show-summary
@selection-change="selectionChangHandle" @sort-change="sortChangeHandle">
<el-table-column type="selection" width="80" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column label="支付方式" align="center">
+18 -32
View File
@@ -1,16 +1,14 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<DraggableDepTree
ref="draggableDepTreeRef"
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
:defaultTreeWidth="20" :nodeClickable="false" :props="{
label: 'name',
children: 'children',
value: 'id',
disabled: 'isLockNone',
}">
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
@@ -18,38 +16,26 @@
<dict-select v-model="state.queryForm.hourType" dict-code="daily_menu" />
</el-form-item>
<el-form-item style="width: 450px" label="创建时间" prop="payTimeList">
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<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-row>
<div class="mb8" style="width: 100%">
<right-toolbar
:search="false"
v-model:showSearch="showSearch"
:export="'wallet_walletTransaction_export'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
></right-toolbar>
<right-toolbar :search="false" v-model:showSearch="showSearch"
:export="'wallet_walletTransaction_export'" @exportExcel="exportExcel" class="ml10 mr20"
style="float: right" @queryTable="getDataList"></right-toolbar>
</div>
</el-row>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
:summary-method="getSummaries"
show-summary
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" :summary-method="getSummaries" show-summary
@selection-change="selectionChangHandle" @sort-change="sortChangeHandle">
<el-table-column type="selection" width="80" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column label="设备名" align="center">
+20 -33
View File
@@ -1,16 +1,14 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<DraggableDepTree
ref="draggableDepTreeRef"
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
:defaultTreeWidth="20" :nodeClickable="false" :props="{
label: 'name',
children: 'children',
value: 'id',
disabled: 'isLockNone',
}">
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
@@ -24,38 +22,26 @@
<select-mch v-model="state.queryForm.merchantId" :apiParams="{ parentIsNull: false }" />
</el-form-item>
<el-form-item style="width: 450px" label="创建时间" prop="payTimeList">
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<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-row>
<div class="mb8" style="width: 100%">
<right-toolbar
:search="false"
v-model:showSearch="showSearch"
:export="'wallet_walletTransaction_export'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
></right-toolbar>
<right-toolbar :search="false" v-model:showSearch="showSearch"
:export="'wallet_walletTransaction_export'" @exportExcel="exportExcel" class="ml10 mr20"
style="float: right" @queryTable="getDataList"></right-toolbar>
</div>
</el-row>
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:summary-method="getSummaries"
show-summary
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table :data="state.dataList" v-loading="state.loading" border :summary-method="getSummaries"
show-summary :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle" @sort-change="sortChangeHandle">
<el-table-column type="selection" width="80" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column label="商户" align="center" prop="merchantName" />
@@ -104,7 +90,8 @@
<el-table-column label="操作" align="center" width="120">
<template #default="{ row }">
<el-tooltip class="box-item" effect="dark" content="只有合作商家能结账" placement="top">
<el-button icon="Tickets" text :disabled="row.merchantType != 2" type="primary" @click="doCheckout(row)">
<el-button icon="Tickets" text :disabled="row.merchantType != 2" type="primary"
@click="doCheckout(row)">
商户结账
</el-button>
</el-tooltip>
+5 -1
View File
@@ -90,7 +90,11 @@
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="联系电话:" prop="phone">
<el-form-item prop="phone">
<template #label>
<span>联系电话:</span>
<tip content="多个联系电话用/分隔" />
</template>
<el-input v-model.trim="form.phone" placeholder="请输入联系电话" />
</el-form-item>
</el-col>