feat(对账): 新增批量对账功能并优化对账流程
- 添加批量对账模式,支持按金额批量选择账单 - 优化rowKey处理逻辑 - 调整对账表单验证规则,增加金额校验 - 修改时间单位从月到天,提高精确度 - 优化选中账单展示,增加标记和计数功能 - 修复SelectDropdownRender组件选项更新问题
This commit is contained in:
@@ -16,12 +16,19 @@ export const reconciliateBillsApi = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人工对账--添加订单后对账
|
* 人工对账--添加订单后对账 -- 单个
|
||||||
*/
|
*/
|
||||||
manualCheckCreated: (data: any) => {
|
manualCheckCreated: (data: any) => {
|
||||||
return requestClient.post('/common/payment/checkoffByAddOrder', { list: data });
|
return requestClient.post('/common/payment/checkoffByAddOrder', { list: data });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人工对账--添加订单后对账 -- 批量
|
||||||
|
*/
|
||||||
|
manualCheckCreatedBatch: (data: any) => {
|
||||||
|
return requestClient.post('/common/payment/checkoffByBatch', data);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动对账
|
* 自动对账
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -34,16 +34,18 @@ const VNodes = defineComponent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const items = ref<{ value: string }[]>(props.options || []);
|
const items = ref<{ value: string }[]>(props.options || []);
|
||||||
const value = ref(props.value);
|
// const value = computed(() => props.value || items.value[0]?.value);
|
||||||
|
const value = ref(props.value || items.value[0]?.value);
|
||||||
const inputRef = ref();
|
const inputRef = ref();
|
||||||
const inputValue = ref('');
|
const inputValue = ref('');
|
||||||
|
|
||||||
// 监听 props.value 变化,更新本地 value
|
// 监听 props.value 变化,更新本地 value
|
||||||
watch(
|
watch(
|
||||||
() => props.value,
|
() => props.options,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
value.value = newValue;
|
value.value = props.value && props.value !== '' ? props.value : newValue.value[0]?.value;
|
||||||
},
|
},
|
||||||
|
{ immediate: true, deep: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
// 监听本地 value 变化,触发 update:value 事件
|
// 监听本地 value 变化,触发 update:value 事件
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ const renderEditComponent = (column: any, row: any) => {
|
|||||||
const options = ref<any[]>([]);
|
const options = ref<any[]>([]);
|
||||||
|
|
||||||
// 创建一个唯一的缓存键,基于 row 的关键属性
|
// 创建一个唯一的缓存键,基于 row 的关键属性
|
||||||
const cacheKey = `${row.paymentId}_${row.come}_${row.orderType}_${row.courseId}`;
|
const cacheKey = `${row.paymentId}_${row[gridOptions.value?.cardConfig?.keyField || 'id']}`;
|
||||||
|
|
||||||
// 检查缓存中是否已有数据
|
// 检查缓存中是否已有数据
|
||||||
if (selectOptionsCache[cacheKey]) {
|
if (selectOptionsCache[cacheKey]) {
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ export interface CardListPagination {
|
|||||||
export interface CardListOptions<T = any> {
|
export interface CardListOptions<T = any> {
|
||||||
/** 列配置 */
|
/** 列配置 */
|
||||||
columns?: CardListColumn<T>[];
|
columns?: CardListColumn<T>[];
|
||||||
|
/** 卡片配置 */
|
||||||
|
cardConfig?: {
|
||||||
|
/** 卡片主键字段名 */
|
||||||
|
keyField?: string;
|
||||||
|
};
|
||||||
/** 数据源 */
|
/** 数据源 */
|
||||||
data?: T[];
|
data?: T[];
|
||||||
/** 是否显示卡片标题 */
|
/** 是否显示卡片标题 */
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ interface RecommendedUser {
|
|||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
errorItem: CreateOrderType[];
|
errorItem: CreateOrderType[];
|
||||||
|
isBatchMode: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
@@ -73,7 +74,7 @@ const gridOptions = computed(() => ({
|
|||||||
paymentId: row.paymentId,
|
paymentId: row.paymentId,
|
||||||
come: row.come,
|
come: row.come,
|
||||||
orderType: row.orderType,
|
orderType: row.orderType,
|
||||||
courseId: row.courseId,
|
courseId: row.courseId ?? '',
|
||||||
vipType: row.vipType ?? '',
|
vipType: row.vipType ?? '',
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
@@ -88,6 +89,7 @@ const gridOptions = computed(() => ({
|
|||||||
field: 'tel',
|
field: 'tel',
|
||||||
title: '用户手机号',
|
title: '用户手机号',
|
||||||
colSpan: 2,
|
colSpan: 2,
|
||||||
|
show: () => !props.isBatchMode,
|
||||||
},
|
},
|
||||||
{ editRender: { name: 'Input' }, field: 'orderMoney', title: '订单金额' },
|
{ editRender: { name: 'Input' }, field: 'orderMoney', title: '订单金额' },
|
||||||
{ editRender: { name: 'Input' }, field: 'realMoney', title: '实际金额' },
|
{ editRender: { name: 'Input' }, field: 'realMoney', title: '实际金额' },
|
||||||
@@ -99,7 +101,8 @@ const gridOptions = computed(() => ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
// 仅VIP 和课程订单 显示
|
// 仅VIP 和课程订单 显示
|
||||||
show: (row: CreateOrderType) => row.orderType === '1' || row.orderType === '2',
|
show: (row: CreateOrderType) =>
|
||||||
|
!props.isBatchMode && (row.orderType === '1' || row.orderType === '2'),
|
||||||
field: 'startTime',
|
field: 'startTime',
|
||||||
title: '开始时间',
|
title: '开始时间',
|
||||||
},
|
},
|
||||||
@@ -108,13 +111,13 @@ const gridOptions = computed(() => ({
|
|||||||
name: 'Select',
|
name: 'Select',
|
||||||
props: {
|
props: {
|
||||||
options: [
|
options: [
|
||||||
{ label: '1个月', value: '1' },
|
{ label: '1个月', value: '30' },
|
||||||
{ label: '3个月', value: '3' },
|
{ label: '3个月', value: '90' },
|
||||||
{ label: '半年', value: '6' },
|
{ label: '半年', value: '180' },
|
||||||
{ label: '一年', value: '12' },
|
{ label: '一年', value: '365' },
|
||||||
{ label: '两年', value: '24' },
|
{ label: '两年', value: '730' },
|
||||||
{ label: '三年', value: '36' },
|
{ label: '三年', value: '1095' },
|
||||||
{ label: '四年', value: '48' },
|
{ label: '四年', value: '1460' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -124,6 +127,9 @@ const gridOptions = computed(() => ({
|
|||||||
title: '到期时间',
|
title: '到期时间',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
cardConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
titleField: 'productName',
|
titleField: 'productName',
|
||||||
gridColumns: 3,
|
gridColumns: 3,
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ const props = withDefaults(
|
|||||||
const emit = defineEmits(['completeCheck', 'deletedChecked']);
|
const emit = defineEmits(['completeCheck', 'deletedChecked']);
|
||||||
|
|
||||||
interface RowType {
|
interface RowType {
|
||||||
productId: number;
|
id: string;
|
||||||
|
productId: string;
|
||||||
year: string;
|
year: string;
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
@@ -34,10 +35,10 @@ function transformData(rows: RowType[]) {
|
|||||||
orderType: '4',
|
orderType: '4',
|
||||||
paymentId: props.payment?.id || '',
|
paymentId: props.payment?.id || '',
|
||||||
productName: row.title,
|
productName: row.title,
|
||||||
productId: row.productId,
|
productId: row.productId.slice(1),
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: '',
|
orderMoney: '',
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
@@ -35,11 +35,11 @@ function transformData(rows: RowType[]) {
|
|||||||
productId: '',
|
productId: '',
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: '',
|
orderMoney: '',
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: props.payment?.ctime || '',
|
startTime: props.payment?.ctime || '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
vipType: row.type,
|
vipType: row.type.slice(1),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ const props = withDefaults(
|
|||||||
const emit = defineEmits(['completeCheck', 'deletedChecked']);
|
const emit = defineEmits(['completeCheck', 'deletedChecked']);
|
||||||
|
|
||||||
interface RowType {
|
interface RowType {
|
||||||
courseId: number;
|
courseId: string;
|
||||||
productId: number;
|
productId: string;
|
||||||
price: number;
|
price: number;
|
||||||
productName: string;
|
productName: string;
|
||||||
}
|
}
|
||||||
@@ -35,10 +35,10 @@ function transformData(rows: RowType[]) {
|
|||||||
orderType: '2',
|
orderType: '2',
|
||||||
paymentId: props.payment?.id || '',
|
paymentId: props.payment?.id || '',
|
||||||
productName: row.productName,
|
productName: row.productName,
|
||||||
productId: row.productId,
|
productId: row.productId.slice(1),
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: String(row.price),
|
orderMoney: String(row.price),
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: props.payment?.ctime || '',
|
startTime: props.payment?.ctime || '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function transformData(rows: RowType[]) {
|
|||||||
productId: '',
|
productId: '',
|
||||||
catalogueId: row.catalogueId,
|
catalogueId: row.catalogueId,
|
||||||
orderMoney: '',
|
orderMoney: '',
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: props.payment?.ctime || '',
|
startTime: props.payment?.ctime || '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const props = withDefaults(
|
|||||||
const emit = defineEmits(['completeCheck', 'deletedChecked']);
|
const emit = defineEmits(['completeCheck', 'deletedChecked']);
|
||||||
|
|
||||||
interface RowType {
|
interface RowType {
|
||||||
id: number;
|
id: string;
|
||||||
price: number;
|
price: number;
|
||||||
productName: string;
|
productName: string;
|
||||||
}
|
}
|
||||||
@@ -34,10 +34,10 @@ function transformData(rows: RowType[]) {
|
|||||||
orderType: '3',
|
orderType: '3',
|
||||||
paymentId: props.payment?.id || '',
|
paymentId: props.payment?.id || '',
|
||||||
productName: row.productName,
|
productName: row.productName,
|
||||||
productId: row.id,
|
productId: row.id.slice(1),
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: String(row.price),
|
orderMoney: String(row.price),
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function transformData(rows: RowType[]) {
|
|||||||
productId: '',
|
productId: '',
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: String(row.point),
|
orderMoney: String(row.point),
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ interface RowType {
|
|||||||
function transformData(rows: RowType[]) {
|
function transformData(rows: RowType[]) {
|
||||||
return rows.map((row) => ({
|
return rows.map((row) => ({
|
||||||
id: row.courseId,
|
id: row.courseId,
|
||||||
courseId: row.courseId || '',
|
courseId: row.courseId.slice(1),
|
||||||
tel: '',
|
tel: '',
|
||||||
come: '0',
|
come: '0',
|
||||||
orderType: '2',
|
orderType: '2',
|
||||||
@@ -37,7 +37,7 @@ function transformData(rows: RowType[]) {
|
|||||||
productId: '',
|
productId: '',
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: '',
|
orderMoney: '',
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: props.payment?.ctime || '',
|
startTime: props.payment?.ctime || '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const props = withDefaults(
|
|||||||
const emit = defineEmits(['completeCheck', 'deletedChecked']);
|
const emit = defineEmits(['completeCheck', 'deletedChecked']);
|
||||||
|
|
||||||
interface RowType {
|
interface RowType {
|
||||||
|
oid: string;
|
||||||
courseFee: string;
|
courseFee: string;
|
||||||
courseId: string;
|
courseId: string;
|
||||||
studyDays: number;
|
studyDays: number;
|
||||||
@@ -29,9 +30,9 @@ interface RowType {
|
|||||||
|
|
||||||
function transformData(rows: RowType[]) {
|
function transformData(rows: RowType[]) {
|
||||||
return rows.map((row) => ({
|
return rows.map((row) => ({
|
||||||
id: row.courseId,
|
id: row.oid,
|
||||||
paymentId: props.payment?.id || 0,
|
paymentId: props.payment?.id || 0,
|
||||||
courseId: row.courseId,
|
courseId: row.courseId.slice(1),
|
||||||
tel: row.cellPhone,
|
tel: row.cellPhone,
|
||||||
come: '0',
|
come: '0',
|
||||||
orderType: '2',
|
orderType: '2',
|
||||||
@@ -39,7 +40,7 @@ function transformData(rows: RowType[]) {
|
|||||||
productId: '',
|
productId: '',
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: '',
|
orderMoney: '',
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: props.payment?.ctime || '',
|
startTime: props.payment?.ctime || '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
@@ -49,7 +50,7 @@ function transformData(rows: RowType[]) {
|
|||||||
const { Grid, cancelCheck, setChecked } = useCardListGrid<RowType, CreateOrderType>({
|
const { Grid, cancelCheck, setChecked } = useCardListGrid<RowType, CreateOrderType>({
|
||||||
payment: computed(() => props.payment),
|
payment: computed(() => props.payment),
|
||||||
selectedData: computed(() => props.selectedData),
|
selectedData: computed(() => props.selectedData),
|
||||||
rowKey: 'courseId',
|
rowKey: 'oid',
|
||||||
rowKeyPrefix: props.tabKey,
|
rowKeyPrefix: props.tabKey,
|
||||||
columns: [
|
columns: [
|
||||||
{ type: 'checkbox', width: 60 },
|
{ type: 'checkbox', width: 60 },
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ function transformData(rows: RowType[]) {
|
|||||||
orderType: '3',
|
orderType: '3',
|
||||||
paymentId: props.payment?.id || '',
|
paymentId: props.payment?.id || '',
|
||||||
productName: row.productName,
|
productName: row.productName,
|
||||||
productId: row.id,
|
productId: row.id.slice(1),
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: String(row.price),
|
orderMoney: String(row.price),
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function transformData(rows: RowType[]) {
|
|||||||
productId: '',
|
productId: '',
|
||||||
catalogueId: '',
|
catalogueId: '',
|
||||||
orderMoney: String(row.point),
|
orderMoney: String(row.point),
|
||||||
realMoney: '',
|
realMoney: String(props.payment?.fee) || '',
|
||||||
districtMoney: '',
|
districtMoney: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ import type { CreateOrderType, PaymentRowType } from '../types';
|
|||||||
|
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
import { Button, Card, message, Modal, notification } from 'ant-design-vue';
|
import { VbenIcon } from '@vben-core/shadcn-ui';
|
||||||
|
|
||||||
|
import { Button, Card, Input, message, Modal, notification } from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { reconciliateBillsApi } from '#/api/posting/reconciliate';
|
import { reconciliateBillsApi } from '#/api/posting/reconciliate';
|
||||||
@@ -11,7 +13,7 @@ import { useSysStore } from '#/store';
|
|||||||
|
|
||||||
import Orders from '../components/Orders.vue';
|
import Orders from '../components/Orders.vue';
|
||||||
import Selected from '../components/Selected.vue';
|
import Selected from '../components/Selected.vue';
|
||||||
import TrainingClassProduct from '../components/TrainingClassProduct.vue';
|
import TrainingClass from '../components/TrainingClass.vue';
|
||||||
import VipProduct from '../components/VipProduct.vue';
|
import VipProduct from '../components/VipProduct.vue';
|
||||||
import WumenCourseProduct from '../components/WumenCourseProduct.vue';
|
import WumenCourseProduct from '../components/WumenCourseProduct.vue';
|
||||||
import WumenCourseRecord from '../components/WumenCourseRecord.vue';
|
import WumenCourseRecord from '../components/WumenCourseRecord.vue';
|
||||||
@@ -45,33 +47,65 @@ const needCreateRecord: Record<string, any> = {
|
|||||||
G: YiluRecharge,
|
G: YiluRecharge,
|
||||||
H: YiluPhysicalProduct,
|
H: YiluPhysicalProduct,
|
||||||
I: VipProduct,
|
I: VipProduct,
|
||||||
J: TrainingClassProduct,
|
J: TrainingClass,
|
||||||
};
|
};
|
||||||
|
|
||||||
const sysStore = useSysStore();
|
const sysStore = useSysStore();
|
||||||
|
|
||||||
|
// 批量模式
|
||||||
|
const isBatchMode = ref(false);
|
||||||
|
|
||||||
const visible = ref(props.show);
|
const visible = ref(props.show);
|
||||||
watch(visible, (val) => {
|
watch(visible, (val) => {
|
||||||
emit('update:show', val);
|
emit('update:show', val);
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentIndex = ref(0);
|
const multipleCurrentIndex = ref<number[]>([0]);
|
||||||
|
const multipleCurrentData = ref<PaymentRowType[]>([]);
|
||||||
|
const selectedAmount = ref();
|
||||||
const pendingData = ref<PaymentRowType[]>([]);
|
const pendingData = ref<PaymentRowType[]>([]);
|
||||||
|
|
||||||
// 监听props.data变化,更新本地pendingData
|
// 监听props.data变化,更新本地pendingData
|
||||||
watch(
|
watch(
|
||||||
() => props.data,
|
() => props.data,
|
||||||
(newData) => {
|
(newData) => {
|
||||||
pendingData.value = [...newData];
|
pendingData.value = newData.toSorted(
|
||||||
currentIndex.value = 0;
|
(a, b) => Number(b.orderFlag === 1) - Number(a.orderFlag === 1),
|
||||||
|
);
|
||||||
|
multipleCurrentIndex.value = [0];
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
function changePendingData(index: number) {
|
function changePendingData(index: number) {
|
||||||
currentIndex.value = index;
|
// 单个模式
|
||||||
|
multipleCurrentIndex.value = [index];
|
||||||
selectedData.value = [];
|
selectedData.value = [];
|
||||||
selectedRef.value?.clearData();
|
selectedRef.value?.clearData();
|
||||||
|
selectedAmount.value = null;
|
||||||
|
isBatchMode.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeBatchSelected() {
|
||||||
|
selectedData.value = [];
|
||||||
|
selectedRef.value?.clearData();
|
||||||
|
|
||||||
|
if (selectedAmount.value || selectedAmount.value === '0') {
|
||||||
|
// 按金额批量选中
|
||||||
|
activeTabKey.value = 'B'; // 批量模式不能选订单和记录,默认到课程商品
|
||||||
|
isBatchMode.value = true;
|
||||||
|
multipleCurrentData.value = pendingData.value.filter(
|
||||||
|
(item) => item.fee === Number.parseFloat(selectedAmount.value),
|
||||||
|
);
|
||||||
|
multipleCurrentIndex.value = multipleCurrentData.value.map((item) =>
|
||||||
|
pendingData.value.indexOf(item),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 取消批量选中
|
||||||
|
activeTabKey.value = '0'; // 切换到订单列表
|
||||||
|
isBatchMode.value = false;
|
||||||
|
changePendingData(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabList = [
|
const tabList = [
|
||||||
@@ -122,6 +156,10 @@ const tabList = [
|
|||||||
];
|
];
|
||||||
const activeTabKey = ref('0');
|
const activeTabKey = ref('0');
|
||||||
function changeRecordTab(key: string) {
|
function changeRecordTab(key: string) {
|
||||||
|
if (isBatchMode.value && ['0', 'A', 'C', 'E', 'G'].includes(key)) {
|
||||||
|
message.warning('批量模式下,不能切换到该选项');
|
||||||
|
return;
|
||||||
|
}
|
||||||
activeTabKey.value = key;
|
activeTabKey.value = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,9 +167,13 @@ function changeRecordTab(key: string) {
|
|||||||
function onCompleteCheck() {
|
function onCompleteCheck() {
|
||||||
notification.success({
|
notification.success({
|
||||||
message: '操作成功',
|
message: '操作成功',
|
||||||
|
duration: 1,
|
||||||
});
|
});
|
||||||
// 删除当前已对账的数据
|
// 删除当前已对账的数据
|
||||||
pendingData.value.splice(currentIndex.value, 1);
|
const currentIndex = multipleCurrentIndex.value[0] || 0;
|
||||||
|
multipleCurrentIndex.value.forEach((index) => {
|
||||||
|
pendingData.value.splice(index, 1);
|
||||||
|
});
|
||||||
|
|
||||||
// 如果没有待对账数据了,关闭弹框
|
// 如果没有待对账数据了,关闭弹框
|
||||||
if (pendingData.value.length === 0) {
|
if (pendingData.value.length === 0) {
|
||||||
@@ -139,10 +181,11 @@ function onCompleteCheck() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果当前索引超出了数据范围,重置到第一条
|
// 清空待处理账单的已选状态
|
||||||
if (currentIndex.value >= pendingData.value.length) {
|
multipleCurrentIndex.value = [];
|
||||||
currentIndex.value = 0;
|
multipleCurrentData.value = [];
|
||||||
}
|
// 如果当前索引超出了数据范围,重置到第一条,否则下一条(删除已处理索引后,currentIndex即是下一条)
|
||||||
|
multipleCurrentIndex.value[0] = Math.min(currentIndex, pendingData.value.length - 1);
|
||||||
}
|
}
|
||||||
// 其他方式--确认对账 --------------
|
// 其他方式--确认对账 --------------
|
||||||
// 已选列表
|
// 已选列表
|
||||||
@@ -172,29 +215,68 @@ function onDeleteChecked(ids: number[]) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function completeSubmitCheck(item: CreateOrderType) {
|
||||||
|
if (!item.realMoney) {
|
||||||
|
message.error(`《${item.productName}》请填写实际金额`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!item.orderMoney) {
|
||||||
|
message.error(`《${item.productName}》请填写订单金额`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 单个模式必须填手机号
|
||||||
|
if (!isBatchMode.value && !item.tel) {
|
||||||
|
message.error(`《${item.productName}》请填写手机号`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 单个模式课程、vip必须填开始时间和结束时间
|
||||||
|
if (!isBatchMode.value && (item.orderType === '1' || item.orderType === '2') && !item.startTime) {
|
||||||
|
message.error(`《${item.productName}》请填写开始时间`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!isBatchMode.value && (item.orderType === '1' || item.orderType === '2') && !item.endTime) {
|
||||||
|
message.error(`《${item.productName}》请填写到期时间`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 批量模式课程、vip必须填到期时间
|
||||||
|
if (isBatchMode.value && (item.orderType === '1' || item.orderType === '2') && !item.endTime) {
|
||||||
|
message.error(`《${item.productName}》请填写到期时间`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// 确认对账
|
// 确认对账
|
||||||
function onCompleteCheckCreated() {
|
async function onCompleteCheckCreated() {
|
||||||
if (selectedData.value.length === 0) {
|
if (multipleCurrentIndex.value.length === 0) {
|
||||||
message.error('请选择数据');
|
message.error('请选择账单');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (selectedData.value.length === 0) {
|
||||||
|
message.error('请选择对账数据');
|
||||||
|
}
|
||||||
|
|
||||||
const selected = selectedRef.value.getData();
|
const selected = selectedRef.value.getData();
|
||||||
|
|
||||||
// 检查已选数据中是否有未填写的表单项
|
// 检查已选数据中是否有未填写的表单项
|
||||||
const emptyItem = selected.find((item: CreateOrderType) => {
|
const emptyItem = selected.find((item: CreateOrderType) => {
|
||||||
if (
|
return completeSubmitCheck(item);
|
||||||
!item.realMoney ||
|
|
||||||
!item.orderMoney ||
|
|
||||||
!item.tel ||
|
|
||||||
((item.orderType === '1' || item.orderType === '2') && (!item.startTime || !item.endTime))
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
if (emptyItem) {
|
if (emptyItem) {
|
||||||
errorData.value = [emptyItem];
|
errorData.value = [emptyItem];
|
||||||
message.error(`《${emptyItem.productName}》有未填写项`);
|
return;
|
||||||
|
} else {
|
||||||
|
errorData.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证订单金额不能小于实际金额
|
||||||
|
const invalidItem = selected.find((item: CreateOrderType) => {
|
||||||
|
return Number.parseFloat(item.orderMoney) < Number.parseFloat(item.realMoney);
|
||||||
|
});
|
||||||
|
if (invalidItem) {
|
||||||
|
errorData.value = [invalidItem];
|
||||||
|
message.error(`《${invalidItem.productName}》订单金额不能小于实际金额`);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
errorData.value = [];
|
errorData.value = [];
|
||||||
@@ -205,7 +287,7 @@ function onCompleteCheckCreated() {
|
|||||||
(acc: number, item: CreateOrderType) => acc + Number.parseFloat(item.realMoney),
|
(acc: number, item: CreateOrderType) => acc + Number.parseFloat(item.realMoney),
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
if (totalRealMoney !== Number.parseFloat(pendingData.value?.[currentIndex.value]?.fee || '0')) {
|
if (totalRealMoney !== pendingData.value?.[multipleCurrentIndex.value[0] ?? 0]?.fee) {
|
||||||
message.error('已选数据填写的实际金额总和与对账单金额不一致');
|
message.error('已选数据填写的实际金额总和与对账单金额不一致');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -218,23 +300,35 @@ function onCompleteCheckCreated() {
|
|||||||
).toString(),
|
).toString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// 只有VIP和课程订单才处理开始时间和结束时间
|
// 单选模式且只有VIP和课程订单才处理开始时间和结束时间
|
||||||
if (item.orderType === '1' || item.orderType === '2') {
|
if (!isBatchMode.value && (item.orderType === '1' || item.orderType === '2')) {
|
||||||
result.startTime = dayjs(item.startTime).format('YYYY-MM-DD'); // 格式化开始时间
|
result.startTime = dayjs(item.startTime).format('YYYY-MM-DD'); // 格式化开始时间
|
||||||
result.endTime = dayjs(item.startTime)
|
result.endTime = dayjs(item.startTime)
|
||||||
.add(Number.parseFloat(item.endTime), 'month')
|
.add(Number.parseFloat(item.endTime), 'day')
|
||||||
.format('YYYY-MM-DD'); // 处理结束时间,根据传入的vb时间和课程时长计算
|
.format('YYYY-MM-DD'); // 处理结束时间,根据传入的vb时间和课程时长计算
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果是多选模式,处理相应数据
|
||||||
|
if (isBatchMode.value) {
|
||||||
|
delete result.paymentId;
|
||||||
|
result.startTime = '';
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const paymentIds = multipleCurrentData.value.map((item) => item.id);
|
||||||
// 调用接口
|
// 调用接口
|
||||||
reconciliateBillsApi.manualCheckCreated(data).then(() => {
|
await (isBatchMode.value
|
||||||
onCompleteCheck();
|
? reconciliateBillsApi.manualCheckCreatedBatch({
|
||||||
// 清空已选列表
|
paymentIds: paymentIds.join(','),
|
||||||
selectedData.value = [];
|
orders: data,
|
||||||
selectedRef.value?.clearData();
|
})
|
||||||
});
|
: reconciliateBillsApi.manualCheckCreated(data));
|
||||||
|
onCompleteCheck();
|
||||||
|
// 清空已选列表
|
||||||
|
selectedData.value = [];
|
||||||
|
selectedRef.value?.clearData();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -249,12 +343,22 @@ function onCompleteCheckCreated() {
|
|||||||
>
|
>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<Card title="待对账列表" class="w-1/4" size="small">
|
<Card title="待对账列表" class="w-1/4" size="small">
|
||||||
<div class="flex flex-col gap-2 overflow-y-auto p-1" style="height: calc(100vh - 120px)">
|
<div class="flex items-center justify-between p-1 pb-2">
|
||||||
|
<Input
|
||||||
|
v-model:value="selectedAmount"
|
||||||
|
addon-before="批量选中金额"
|
||||||
|
allow-clear
|
||||||
|
class="w-60"
|
||||||
|
@change="changeBatchSelected"
|
||||||
|
/>
|
||||||
|
<div class="ml-2">已选中:{{ multipleCurrentIndex.length }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-2 overflow-y-auto px-1" style="height: calc(100vh - 170px)">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in pendingData"
|
v-for="(item, index) in pendingData"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:class="{ active: currentIndex === index }"
|
:class="{ active: multipleCurrentIndex.includes(index) }"
|
||||||
class="pay-order-item"
|
class="pay-order-item relative"
|
||||||
@click="changePendingData(index)"
|
@click="changePendingData(index)"
|
||||||
>
|
>
|
||||||
<div>关联sn号:{{ item.relationSn }}</div>
|
<div>关联sn号:{{ item.relationSn }}</div>
|
||||||
@@ -263,12 +367,19 @@ function onCompleteCheckCreated() {
|
|||||||
<div>金额:{{ item.fee }}</div>
|
<div>金额:{{ item.fee }}</div>
|
||||||
<div>支付方式:{{ sysStore.getDictMap('payment', item.type) }}</div>
|
<div>支付方式:{{ sysStore.getDictMap('payment', item.type) }}</div>
|
||||||
<div>时间:{{ dayjs(item.ctime).format('YYYY-MM-DD HH:mm:ss') }}</div>
|
<div>时间:{{ dayjs(item.ctime).format('YYYY-MM-DD HH:mm:ss') }}</div>
|
||||||
|
|
||||||
|
<VbenIcon
|
||||||
|
v-if="item.orderFlag === 1"
|
||||||
|
icon="ant-design:star-fill"
|
||||||
|
class="absolute right-1 top-1 h-5 w-5 text-red-500"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
<div class="flex w-3/4 flex-1 flex-col gap-2">
|
<div class="flex w-3/4 flex-1 flex-col gap-2">
|
||||||
<Card
|
<Card
|
||||||
:tab-list="tabList"
|
:tab-list="tabList"
|
||||||
|
disabled
|
||||||
:active-tab-key="activeTabKey"
|
:active-tab-key="activeTabKey"
|
||||||
@tab-change="changeRecordTab"
|
@tab-change="changeRecordTab"
|
||||||
class="order-card flex-1"
|
class="order-card flex-1"
|
||||||
@@ -276,7 +387,7 @@ function onCompleteCheckCreated() {
|
|||||||
>
|
>
|
||||||
<Orders
|
<Orders
|
||||||
v-if="activeTabKey === '0'"
|
v-if="activeTabKey === '0'"
|
||||||
:payment-id="pendingData[currentIndex]?.id"
|
:payment-id="pendingData[multipleCurrentIndex[0] ?? 0]?.id"
|
||||||
@complete-check="onCompleteCheck"
|
@complete-check="onCompleteCheck"
|
||||||
/>
|
/>
|
||||||
<component
|
<component
|
||||||
@@ -284,7 +395,7 @@ function onCompleteCheckCreated() {
|
|||||||
v-if="activeTabKey !== '0'"
|
v-if="activeTabKey !== '0'"
|
||||||
ref="needCreateRecordRef"
|
ref="needCreateRecordRef"
|
||||||
:tab-key="activeTabKey"
|
:tab-key="activeTabKey"
|
||||||
:payment="pendingData[currentIndex]"
|
:payment="pendingData[multipleCurrentIndex[0] ?? 0]"
|
||||||
:selected-data="selectedData"
|
:selected-data="selectedData"
|
||||||
@complete-check="onSelectRecord"
|
@complete-check="onSelectRecord"
|
||||||
@deleted-checked="onDeleteChecked"
|
@deleted-checked="onDeleteChecked"
|
||||||
@@ -299,7 +410,12 @@ function onCompleteCheckCreated() {
|
|||||||
<template #extra>
|
<template #extra>
|
||||||
<Button type="primary" size="small" @click="onCompleteCheckCreated()">确认对账</Button>
|
<Button type="primary" size="small" @click="onCompleteCheckCreated()">确认对账</Button>
|
||||||
</template>
|
</template>
|
||||||
<Selected ref="selectedRef" :error-item="errorData" @deleted-checked="onDeleteChecked" />
|
<Selected
|
||||||
|
ref="selectedRef"
|
||||||
|
:error-item="errorData"
|
||||||
|
:is-batch-mode="isBatchMode"
|
||||||
|
@deleted-checked="onDeleteChecked"
|
||||||
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -320,6 +436,7 @@ function onCompleteCheckCreated() {
|
|||||||
}
|
}
|
||||||
:deep(.ant-card-body) {
|
:deep(.ant-card-body) {
|
||||||
padding: 5px !important;
|
padding: 5px !important;
|
||||||
|
padding-bottom: 10px !important;
|
||||||
}
|
}
|
||||||
.order-card {
|
.order-card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
export interface PaymentRowType {
|
export interface PaymentRowType {
|
||||||
checkoff: number;
|
checkoff: number;
|
||||||
ctime: string;
|
ctime: string;
|
||||||
fee: string;
|
fee: number;
|
||||||
|
orderFlag: number;
|
||||||
financeSn: string;
|
financeSn: string;
|
||||||
id: number;
|
id: number;
|
||||||
transactionSn: string;
|
transactionSn: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user