feat:钱包、设备权限

This commit is contained in:
dzc committed 2025-01-19 11:54:56 +08:00
1 parent 611f1d634d
commit ef3dea40fa
19 files changed
+484 -361

No files matched your search

+50 -43
View File
@@ -1,62 +1,69 @@
<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>
<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 { 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
createdIsNeed: false,
queryForm: {},
pageList: hardCar.getCarByOrderId,
})
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
useTable(state)
// 打开弹窗
const openDialog = (id: string) => {
visible.value = true
if (id) {
state.queryForm.orderId = id
getDataList()
}
};
visible.value = true
if (id) {
state.queryForm.orderId = id
getDataList()
}
}
// 暴露变量
defineExpose({
openDialog
});
</script>
openDialog,
})
</script>
@@ -78,6 +78,7 @@
<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"
>
@@ -1,70 +1,70 @@
<template>
<el-dialog title="拒绝售后" v-model="visible" width="45%" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" label-width="80px" :rules="dataRules" v-loading="loading">
<el-form-item label="审批备注" prop="auditReason">
<el-input v-model="form.auditReason" :rows="3" placeholder="请输入审批备注" type="textarea" />
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="onSubmit">确 定</el-button>
<el-button @click="visible = false">取 消</el-button>
</template>
</el-dialog>
<el-dialog title="拒绝售后" v-model="visible" width="45%" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" label-width="80px" :rules="dataRules" v-loading="loading">
<el-form-item label="审批备注" prop="auditReason">
<el-input v-model="form.auditReason" :rows="3" placeholder="请输入审批备注" type="textarea" />
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="onSubmit">确 定</el-button>
<el-button @click="visible = false">取 消</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="refund-reject">
import { useMessage } from "/@/hooks/message";
import * as hardAfterSaleApi from '/@/api/hard/hard-after-sale'
import { useMessage } from "/@/hooks/message"
import * as hardAfterSaleApi from "/@/api/hard/hard-after-sale"
const emit = defineEmits(['refresh']);
const emit = defineEmits(["refresh"])
// 定义变量内容
const dataFormRef = ref();
const dataFormRef = ref()
const visible = ref(false)
const loading = ref(false)
const form = reactive<any>({
id: undefined,
auditReason: "",
id: undefined,
auditReason: "",
})
// 定义校验规则
const dataRules = ref({
auditReason: [{ required: true, message: '请输入拒绝原因', trigger: 'blur' }],
auditReason: [{ required: true, message: "请输入拒绝原因", trigger: "blur" }],
})
// 打开弹窗
const openDialog = async (id: string) => {
visible.value = true
form.id = ''
if (!id) return
nextTick(() => {
dataFormRef.value?.resetFields();
});
form.id = id
const { data } = await hardAfterSaleApi.detailByOrderId({ orderId: id })
Object.assign(form, data)
};
visible.value = true
form.id = ""
if (!id) return
nextTick(() => {
dataFormRef.value?.resetFields()
})
form.id = id
const { data } = await hardAfterSaleApi.detailByOrderId({ orderId: id })
Object.assign(form, data)
}
// 提交
const onSubmit = async () => {
const valid = await dataFormRef.value.validate().catch(() => { });
if (!valid) return false;
try {
loading.value = true;
await hardAfterSaleApi.disagree(form);
useMessage().success(form.id ? '修改成功' : '添加成功');
visible.value = false;
emit('refresh');
} catch (err: any) {
useMessage().error(err.msg);
} finally {
loading.value = false;
}
};
const valid = await dataFormRef.value.validate().catch(() => {})
if (!valid) return false
try {
loading.value = true
await hardAfterSaleApi.disagree(form)
useMessage().success(form.id ? "修改成功" : "添加成功")
visible.value = false
emit("refresh")
} catch (err: any) {
useMessage().error(err.msg)
} finally {
loading.value = false
}
}
// 暴露变量
defineExpose({
openDialog
});
</script>
openDialog,
})
</script>
+1 -1
View File
@@ -57,7 +57,7 @@
<el-table-column type="index" label="#" width="40" />
<el-table-column prop="id" label="编号" />
<el-table-column prop="name" label="分组名" />
<el-table-column v-if="false" prop="deptName" label="部门" />
<el-table-column prop="deptName" label="部门" />
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button
+24 -12
View File
@@ -4,13 +4,8 @@
<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="name">
<el-input v-model="state.queryForm.name" placeholder="设备名" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="w100" label="设备类型" prop="type">
<dict-select v-model="state.queryForm.type" dict-code="hard_type" />
<el-form-item class="w100" label="用户" prop="userIdChild">
<select-user v-model="state.queryForm.userIdChild" />
</el-form-item>
</el-col>
<el-col :span="4">
@@ -18,6 +13,16 @@
<select-mch v-model="state.queryForm.merchantIds" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="w100" label="设备类型" prop="hardType">
<dict-select v-model="state.queryForm.hardType" dict-code="hard_type" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item class="w100" label="打印时间" prop="createTimeList">
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD" type="daterange" />
</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>
@@ -34,8 +39,18 @@
@sort-change="sortChangeHandle"
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="40" />
<el-table-column label="部门" prop="deptName" />
<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">
<span> {{ row.username }}</span>
<span> {{ row.userMobile }}</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column width="250px" label="设备信息">
<template #default="{ row }">
<div class="status">
@@ -184,17 +199,14 @@ const handleDelete = async (ids: string[]) => {
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;
+22 -4
View File
@@ -103,15 +103,33 @@
@click="formDialogRef.openDialog(row.id)"
>编辑</el-button
>
<el-button icon="TrendCharts" link type="primary" @click="mqformDialogRef.openDialog(row.id)">
<el-button
icon="TrendCharts"
link
type="primary"
v-auth="'hard_hardManager_edit'"
@click="mqformDialogRef.openDialog(row.id)"
>
mq设置
</el-button>
<el-button icon="SetUp" link type="primary" @click="faceFormDialogRef.openDialog(row.id)">
<el-button
icon="SetUp"
link
type="primary"
v-auth="'hard_hardManager_edit'"
@click="faceFormDialogRef.openDialog(row.id)"
>
人脸sdk设置
</el-button>
<el-button icon="delete" text type="primary" v-auth="'hard_hardManager_del'" @click="handleDelete([row.id])"
>删除</el-button
<el-button
icon="delete"
text
type="primary"
v-auth="'hard_hardManager_del'"
@click="handleDelete([row.id])"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
+40 -11
View File
@@ -13,7 +13,12 @@
<select-mch v-model="state.queryForm.mchIds" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="4">
<el-form-item class="w100" label="用户部门" prop="deptIdIdDeepen">
<select-dept v-model="state.queryForm.deptIdIdDeepen" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item class="w100" label="创建时间" prop="payTimeList">
<el-date-picker v-model="state.queryForm.payTimeList" value-format="YYYY-MM-DD" type="daterange" />
</el-form-item>
@@ -42,13 +47,17 @@
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="50" />
<el-table-column prop="username" width="100" label="用户" />
<el-table-column prop="userAvatar" width="100" label="头像">
<el-table-column width="200" label="用户">
<template #default="{ row }">
<preview-image :src="row.userAvatar" />
<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">
<span> {{ row.username }}</span>
<span> {{ row.userMobile }}</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="userMobile" width="120" label="手机号" />
<el-table-column width="200px" label="商品简要信息">
<template #default="{ row }">
<div class="desc">
@@ -167,13 +176,30 @@
</div>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="250">
<el-table-column fixed="right" label="操作" width="200">
<template #default="{ row }">
<el-button icon="Printer" text type="primary" @click="print(row)"> 打印发票 </el-button>
<el-button icon="ShoppingCartFull" text type="primary" @click="shopCarDialogRef.openDialog(row.id)">
购物车
</el-button>
<el-button icon="InfoFilled" link type="primary" @click="doRefund(row)"> 详情 </el-button>
<div class="flex justify-between">
<el-button icon="Printer" text type="primary" @click="print(row)" v-auth="'hard_hardInvoice_admin_print'">
打印发票
</el-button>
<el-button icon="ShoppingCartFull" text type="primary" @click="shopCarDialogRef.openDialog(row.id)">
购物车
</el-button>
</div>
<div class="flex justify-between">
<el-button icon="Money" link type="primary" @click="transactionListRef.openDialog(row.walletId)">
钱包明细
</el-button>
<el-button
icon="InfoFilled"
link
type="primary"
v-auth="'wallet_walletTransaction_update_balance'"
@click="doRefund(row)"
>
订单详情
</el-button>
</div>
<el-button
v-if="false"
icon="edit-pen"
@@ -198,6 +224,7 @@
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
<transaction-list ref="transactionListRef" @refresh="getDataList(false)" />
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
<shop-car ref="shopCarDialogRef" />
</div>
@@ -218,6 +245,7 @@ const { push } = useRouter()
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const ShopCar = defineAsyncComponent(() => import("../components/shop-car.vue"))
const TransactionList = defineAsyncComponent(() => import("/@/views/wallet/components/transaction-list.vue"))
// 定义查询字典
const { hard_pay_type, hard_order_type, hard_order_status, hard_type, hard_refund_status, daily_menu } = useDict(
"hard_pay_type",
@@ -230,6 +258,7 @@ const { hard_pay_type, hard_order_type, hard_order_status, hard_type, hard_refun
// 定义变量内容
const formDialogRef = ref()
const shopCarDialogRef = ref()
const transactionListRef = ref()
const tabList = ref<any>([{}])
const activeName = ref(null)
// 搜索变量