update: 收入明细更新

This commit is contained in:
admin 2024-04-10 10:26:11 +08:00
parent afdefbb2f4
commit b1906b02b0
8 changed files with 857 additions and 18 deletions

View File

@ -430,7 +430,20 @@
"style": { "style": {
"navigationBarTitleText": "支付详情" "navigationBarTitleText": "支付详情"
} }
},
{
"path": "components/addIncomeDetail",
"style": {
"navigationBarTitleText": "新增收入明细"
} }
},
{
"path": "components/incomeContent",
"style": {
"navigationBarTitleText": "收入详情"
}
}
] ]
} }
// { // {

View File

@ -3,7 +3,7 @@
<view class="c-dialog-filter"> <view class="c-dialog-filter">
<view class="title">筛选</view> <view class="title">筛选</view>
<u-list height="200"> <u-list height="200">
<u-list-item> <u-list-item v-if="!isShipment">
<u-cell <u-cell
:title="`类型`" :title="`类型`"
@click="state.isShowStatus = true" @click="state.isShowStatus = true"
@ -14,7 +14,7 @@
</u-list-item> </u-list-item>
<u-list-item boder="none"> <u-list-item boder="none">
<u-cell <u-cell
:title="`${state.type.key ? '供应商': '客户'}`" :title="`${(state.type.key === 2 || isShipment) ? '客户' : '供应商'}`"
@click="handleDialog('showSupplier', true)" @click="handleDialog('showSupplier', true)"
:value="state.user.name" :value="state.user.name"
> >
@ -47,7 +47,7 @@
:show="showDialog.showSupplier" :show="showDialog.showSupplier"
@handleDialog="(v:boolean) => {handleDialog('showSupplier', v)}" @handleDialog="(v:boolean) => {handleDialog('showSupplier', v)}"
@changeUser="changeUser" @changeUser="changeUser"
:isShipment="state.type.key === 2 ? true : false" :isShipment="(state.type.key === 2 || isShipment) ? true : false"
></SupplierDialog> ></SupplierDialog>
<!-- 客户类型 --> <!-- 客户类型 -->
<u-action-sheet <u-action-sheet
@ -62,9 +62,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import SupplierDialog from "./SupplierDialog.vue"; import SupplierDialog from "./SupplierDialog.vue";
const props = defineProps<{ const props = defineProps<{
show: boolean; show: boolean;
isShipment: boolean
}>(); }>();
const emit = defineEmits(["handleDialog", "changeOther"]); const emit = defineEmits(["handleDialog", "changeOther"]);
const handleClose = () => { const handleClose = () => {

View File

@ -0,0 +1,399 @@
<template>
<view class="c-card">
<u-form
labelPosition="left"
:model="model1"
:rules="rules"
ref="form"
:labelWidth="80"
:labelStyle="{ padding: '0rpx 10rpx' }"
:errorType="'border-bottom'"
>
<u-form-item
:prop="`order.${item.key}`"
:label="item.name"
:required="item.required"
v-for="(item, index) in formAttrList"
:key="index"
@click="item.fn"
>
<u-textarea
v-if="item.type === 'textarea'"
v-model="(model1.order as any)[item.key]"
:placeholder="`请输入${item.name}`"
></u-textarea>
<u-input
v-if="item.type === 'select' || item.type === 'input'"
v-model="(model1.order as any)[item.key]"
:placeholder="`${item.type === 'select' ? '选择' : '输入'}${
item.name
}`"
:clearable="true"
:customStyle="{}"
border="none"
:disabled="item.disabled"
>
<template #suffix>
<text>
{{ item.unit }}
</text>
</template>
</u-input>
<!-- @afterRead="afterRead"
@delete="deletePic" -->
<uni-file-picker
v-if="item.type === 'upload'"
v-model="model1.order.fileLists"
limit="9"
title="最多可上传9张图片"
:auto-upload="false"
fileMediatype="image"
mode="grid"
ref="filesRef"
@delete="handleDelete"
></uni-file-picker>
<u-radio-group
v-if="item.type === 'radio'"
v-model="(model1.order as any)[item.key]"
placement="row"
>
<u-radio activeColor="#00DCEE" label="供应商" :name="3"></u-radio>
&nbsp;&nbsp;&nbsp;
<u-radio activeColor="#00DCEE" label="客户" :name="2"></u-radio>
</u-radio-group>
<template #right v-if="item.type === 'select'">
<u-icon name="arrow-right"></u-icon>
</template>
</u-form-item>
</u-form>
<u-datetime-picker
:show="contrlModalParams.isShowSplTime"
v-model="contrlModalParams.settlementTime"
mode="datetime"
@confirm="(v: any) => {handleTime(v)}"
@cancel="contrlModalParams.isShowSplTime = false"
></u-datetime-picker>
<block
v-for="(item, index) in formAttrList"
:key="index"
>
<u-action-sheet
v-if="item.type === 'select' && item.key !== 'settlementTime'"
:actions="contrlModalParams[item.childKey].list"
:title="contrlModalParams[item.childKey].title"
:show="contrlModalParams[item.childKey].isShow"
@select="(v: any) => handleSelect(item.childKey, v)"
@close="contrlModalParams[item.childKey].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
</view>
<view class="btn-box">
<u-button type="primary" text="保存" @click="save()"></u-button>
</view>
</template>
<script setup lang="ts">
import {
CustomerApi,
DeviceApi,
FinanceApi,
PictureApi,
ProfileApi,
ReceiveApi,
ReceiveProductApi,
SupplierApi,
} from "@/services";
import { formatDate } from "@/utils";
import { DeviceType, ImagesType, OrderType } from "@/utils/enum";
import _ from "underscore";
const model1 = reactive<any>({
order: {
buttonType: 3,
fileLists: [],
settlementTime: "",
},
supplierList: [],
customerList: []
});
const rules = reactive({
"order.supCusName": {
type: "string",
required: true,
message: "请选择客户",
trigger: ["blur", "change"],
},
"order.settlementTime": {
type: "string",
required: true,
message: "请选择结算时间",
trigger: ["blur", "change"],
},
"order.incidentals": {
type: "string",
required: true,
message: "请输入jin",
trigger: ["blur", "change"],
},
"order.freight": {
type: "string",
required: true,
message: "请输入运费",
trigger: ["blur", "change"],
},
"order.paymentMethodName": {
type: "string",
required: true,
message: "请选择结算方式",
trigger: ["blur", "change"],
},
});
const contrlModalParams = reactive<any>({
isShowSplTime: false,
spltime: "",
user: {
isShow: false,
title: "标题",
list: [],
},
paySelect: {
isShow: false,
title: "标题",
list: [
{
name: "微信",
id: 3,
},
{
name: "现金",
id: 1,
},
{
name: "支付宝",
id: 4,
},
{
name: "转账",
id: 2,
},
],
},
});
const formAttrList = reactive<any>([
{
name: "客户",
key: "customerName",
type: "select",
childKey: "user",
required: true,
unit: "",
fn: () => {
contrlModalParams.user.isShow = true;
contrlModalParams.user.title = "客户";
},
},
{
name: "结算时间",
key: "settlementTime",
type: "select",
unit: "",
required: true,
fn: () => {
contrlModalParams.isShowSplTime = true;
},
},
{
name: "金额",
key: "totalPrice",
type: "input",
required: true,
unit: "元",
},
{
name: "结算方式",
key: "paymentMethodName",
type: "select",
childKey: "paySelect",
required: true,
unit: "",
fn: () => {
contrlModalParams.paySelect.isShow = true;
contrlModalParams.paySelect.title = "结算方式";
},
},
{
name: "备注",
key: "remakes",
type: "textarea",
},
{
name: "支付单据",
key: "photo",
type: "upload",
},
]);
//
watch(
[
() => model1.order.buttonType,
],
([buttonTypeNew]) => {
if (buttonTypeNew === 3) {
contrlModalParams.user.list = model1.supplierList;
} else if (buttonTypeNew === 2) {
contrlModalParams.user.list = model1.customerList;
}
}
);
const handleDelete = (e: any) => {
console.log(model1.order.fileLists);
if (e.tempFile.fileID) {
PictureApi.deleteById({ id: e.tempFile.fileID }).then((res) => {
if (res.code === 200) {
uni.showToast({ title: "已删除" });
}
});
}
};
const filesRef = ref();
const handleUpload = () => {
// console.log(event.tempFilePaths)
return filesRef.value[0].filesList.map((item: any, index: number) => {
if (item.fileID) {
return;
}
return new Promise((resolve) => {
PictureApi.upload({
files: item,
path: item.path,
})
.then((res) => {
if (res.code === 200) {
resolve({
...(res.data as any),
businessId: model1.order.id,
imagesType: ImagesType.NORMARL, //
orderType: OrderType.Income, //
});
}
})
.catch((e) => {
return;
});
});
});
};
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "user") {
model1.order.customerName = v.name;
model1.order.customerId = v.id;
} else if (key === "paySelect") {
model1.order.paymentMethodName = v.name;
model1.order.paymentMethod = v.id;
}
};
//
// SupplierApi.getSupplierUserList({}).then((res) => {
// if (res.code === 200) {
// model1.supplierList = res.data;
// contrlModalParams.user.list = res.data;
// }
// });
//
CustomerApi.getCustomUserList({}).then((res) => {
if (res.code === 200) {
model1.customerList = res.data;
contrlModalParams.user.list = res.data;
}
});
const upload = () => {
Promise.all(handleUpload()).then((res) => {
//
if (res.length > 0) {
PictureApi.addListAnnex({ annexPos: res }).then((res1) => {
if (res1.code === 200) {
console.log("*** 资源文件更新成功");
}
});
}
});
};
/**
* 校验
*/
const form = ref();
const check = () => {
return new Promise((resolve) => {
form.value
.validate()
.then((res: boolean) => {
resolve(res);
})
.catch((errors: any) => {
resolve(false);
uni.showToast({
icon: "none",
title: errors[0].message || "校验失败",
});
});
});
};
const save = () => {
check().then((res) => {
if (res) {
startSave();
}
});
};
const startSave = () => {
model1.order.paymentType = 1 //
FinanceApi.addIncome(model1.order).then((res) => {
if (res.code === 200) {
model1.order.id = res.data;
upload();
uni.redirectTo({
url: "/pagesHome/index", //
});
}
});
};
const handleTime = (v: any) => {
model1.order.settlementTime = formatDate(v.value, "{y}-{m}-{d} {h}:{i}:{s}");
contrlModalParams.isShowSplTime = false;
};
</script>
<style lang="scss" scoped>
.c-card {
background: #ffffff;
// box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 30rpx 25rpx;
padding: 0rpx 20rpx;
::v-deep .u-form-item {
height: auto;
}
::v-deep .u-form-item + .u-form-item {
border-top: 1rpx solid rgba(233, 233, 233, 0.76);
}
}
.btn-box {
margin-top: 60rpx;
display: flex;
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 56, 93, 0.12);
border-radius: 13rpx 13rpx 0rpx 0rpx;
padding: 25rpx 50rpx;
position: sticky;
bottom: 0rpx;
z-index: 999;
::v-deep button {
border-radius: 43rpx;
}
}
</style>

View File

@ -0,0 +1,76 @@
<template>
<view class="box">
<view>{{ obj.supCusName }}</view>
<view
>结算时间<text>{{ obj.settlementTime }}</text></view
>
<view
>单据编号<text>{{ obj.revenueNumber }}</text></view
>
<view
>收款类型<text>{{ getPayment(obj) }}</text></view
>
<view
>结算金额<text
> {{ obj.totalPrice }}</text
>
</view>
<view
>结算方式<text>{{ getPaymentMethod(obj) }}</text></view
>
<view
>收款人<text>{{ obj.revenueName }}</text></view
>
<view
>出货单号
<text>{{ obj.orderNumber }}</text></view
>
<up-image :show-loading="true" v-for="(item, index) in obj.fileLists" :key="index" :src="item.url" width="80px" height="80px"></up-image>
</view>
</template>
<script setup lang="ts">
import { FinanceApi, PictureApi } from "@/services";
import { ImagesType, OrderType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app";
const obj = ref<any>({});
const getPayment = (item: any) => {
return ["出货单收款", "其他收款"][
item.paymentType
];
};
const getPaymentMethod = (item: any) => {
return ["", "现金", "转账", "微信", "支付宝"][item.paymentMethod];
};
onLoad((option: any) => {
//
FinanceApi.getRevenueDetailsById({ id: option.id }).then((res) => {
if (res.code === 200) {
obj.value = res.data;
}
});
PictureApi.getAnnex({
businessId: option.id,
orderType: OrderType.Income,
imagesType: ImagesType.NORMARL,
}).then((res) => {
if (res.code === 200) {
obj.value.fileLists = res.data;
}
});
});
</script>
<style lang="scss" scoped>
.box {
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
font-size: 26rpx;
margin: 26rpx;
padding: 26rpx;
line-height: 50rpx;
text {
font-size: 24rpx;
color: rgba(0, 0, 0, 0.7);
}
}
</style>

View File

@ -43,7 +43,7 @@ const getPayment = (item: any) => {
]; ];
}; };
const getPaymentMethod = (item: any) => { const getPaymentMethod = (item: any) => {
return ["", "现金", "转账", "微信", "支付宝"][item.paymentType]; return ["", "现金", "转账", "微信", "支付宝"][item.paymentMethod];
}; };
onLoad((option: any) => { onLoad((option: any) => {
// //

View File

@ -1,5 +1,333 @@
<template> <template>
123 <view class="search">
<u-search
placeholder="请输入出货单号"
v-model="keyword"
:showAction="false"
:bgColor="'#fff'"
:borderColor="'rgba(0, 0, 0, 0.1)'"
:placeholderColor="'#C1C1C1'"
@search="handleSearch()"
></u-search>
<view class="btn" @click="handleAdd()"> 创建 </view>
</view>
<view class="filter">
<!-- -->
<view @click="handleDialog('showTime', true)"
><text>{{ state.name }}</text
><u-icon name="arrow-down"></u-icon
></view>
<view @click="state.isShowStatus = true"
><text>费用类型</text><u-icon name="arrow-down"></u-icon
></view>
<view class="btn" @click="handleDialog('showFilter', true)">筛选</view>
</view>
<view class="show-time">
<view v-if="state.name === '昨日' || state.name === '今日'">{{
state.startTime
}}</view>
<view v-else>{{ state.startTime }} - {{ state.endTime }}</view>
</view>
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="140"
:isLoading="pageList.isLoading"
>
<view class="list">
<u-swipe-action>
<u-swipe-action-item
:options="options1"
v-for="(item, index) in pageList.list"
:key="index"
@click="handleItem(item)"
>
<view
class="item"
:style="{ border: index === 0 ? 'none' : '' }"
@click="getDetail(item)"
>
<u-row justify="space-between">
<u-col span="9">
<view class="">
<view class=""> {{ item.customerName || "-" }} </view>
<view class=""> {{ item.revenueNumber }} </view>
<view class="time">
结算时间{{ item.settlementTime }}
</view>
</view>
</u-col>
<u-col span="3">
<view class="amount">
<view> {{ item.totalPrice }}</view>
<view class="tip">{{ getPayment(item) }}</view>
</view>
</u-col>
</u-row>
</view>
</u-swipe-action-item>
</u-swipe-action>
</view>
</page-view>
<!-- 时间弹框 -->
<TimeDialog
ref="timeDialog"
:show="showDialog.showTime"
@handleDialog="(v:boolean) => {handleDialog('showTime', v)}"
@changeTime="changeTime"
/>
<!-- 费用类型 -->
<u-action-sheet
:closeOnClickOverlay="true"
:closeOnClickAction="true"
:actions="state.statusList"
:title="'单据状态'"
:show="state.isShowStatus"
@select="handleSelectStatus"
@close="state.isShowStatus = false"
></u-action-sheet>
<!-- 筛选弹框 -->
<FilterDialog
:show="showDialog.showFilter"
@handleDialog="(v:boolean) => {handleDialog('showFilter', v)}"
@changeOther="changeOther"
:isShipment="true"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { FinanceApi } from "@/services";
import PageView from "@/components/PageView/index.vue";
import { formatDate, getCurrentMonthStartAndEnd } from "@/utils";
import TimeDialog from "./components/TimeDialog.vue";
import FilterDialog from "./components/CustomFilterDialog.vue";
const options1 = ref([
{
text: "删除",
style: {
backgroundColor: "rgba(217, 4, 30, 1)",
fontSize: "24rpx",
},
},
]);
const keyword = ref("");
const state = reactive({
startTime: formatDate(getCurrentMonthStartAndEnd().start, "{y}-{m}-{d}"),
endTime: formatDate(getCurrentMonthStartAndEnd().end, "{y}-{m}-{d}"),
name: "本月",
currentPaymentType: -1,
isShowStatus: false,
statusList: [
{
name: "全部",
key: -1,
},
{
name: "出货单收款",
key: 0,
},
{
name: "其他收款",
key: 1,
}
],
userId: -1,
userType: -1,
params: {},
});
const getPayment = (item: any) => {
return ["出货单收款", "其他收款"][
item.paymentType
];
};
const showDialog = <
{
[key: string]: boolean;
}
>reactive({
showTime: false,
showFilter: false,
});
const handleDialog = (key: string, v: boolean) => {
showDialog[key] = v;
};
const handleSelectStatus = (v: any) => {
state.isShowStatus = false;
state.currentPaymentType = v.key;
resetPageList();
getList();
};
const changeOther = (obj: any) => {
state.userId = obj.userId;
state.userType = obj.type;
resetPageList();
getList();
};
const pageList: PageResult<any> = reactive({
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const handleSearch = () => {
resetPageList();
getList();
};
const handleAdd = () => {
uni.navigateTo({
url: "/pagesApp/components/addIncomeDetail", //
});
};
//
const handleItem = (item: any) => {
FinanceApi.deleteRevenueDes({ id: item.id }).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "删除成功",
});
resetPageList();
getList();
}
});
};
//
const getDetail = (item: any) => {
uni.navigateTo({
url: "/pagesApp/components/incomeContent?id=" + item.id, //
});
};
const changeTime = (obj: any) => {
state.startTime = obj.startTime;
state.endTime = obj.endTime;
state.name = obj.name;
resetPageList();
getList();
};
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
let params: any = {
pageSize: pageList.pageSize,
pageNumber: pageList.pageNum,
startTime: state.startTime + " 00:00:00",
endTime: state.endTime + " 23:59:59",
oddNumbers: keyword.value,
};
if (state.currentPaymentType > -1) {
params.paymentType = state.currentPaymentType;
}
if (state.userId > -1) {
params.customerId = state.userId;
}
pageList.isLoading = true;
FinanceApi.getRevenueDetailsPage(params).then((res: any) => {
if (res.code === 200) {
pageList.isLoading = false;
(pageList as any).list = (pageList as any).list = pageList.list.concat(
res.data.list
);
pageList.total = (res.data as any).total;
}
});
};
onMounted(() => {
getList();
});
</script> </script>
<style lang="scss" scoped>
.search {
display: flex;
align-items: center;
justify-content: space-between;
margin: 26rpx 26rpx 0rpx 26rpx;
.btn {
background: #00dcee;
border-radius: 24rpx;
border: 1px solid #00dcee;
font-weight: 500;
font-size: 26rpx;
color: #ffffff;
margin-left: 50rpx;
padding: 6rpx 30rpx;
}
}
.filter {
margin: 0rpx 26rpx 0rpx 26rpx;
padding: 18rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 400;
font-size: 26rpx;
color: #000000;
> view {
display: inline-block;
display: flex;
align-items: center;
text {
margin-right: 10rpx;
}
}
.btn {
font-size: 26rpx;
color: #00dcee;
}
}
.show-time {
font-weight: 400;
font-size: 26rpx;
color: #000000;
margin: 0rpx 26rpx 20rpx 50rpx;
}
.list {
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
margin: 0rpx 26rpx;
padding: 0rpx 18rpx;
.item {
font-size: 26rpx;
line-height: 40rpx;
border-top: 1px solid rgba(233, 233, 233, 0.76);
padding: 26rpx 26rpx;
.time {
font-size: 24rpx;
color: #999;
}
}
.amount {
text-align: right;
.tip {
font-size: 24rpx;
color: #ff7e20;
}
}
}
</style>

View File

@ -340,4 +340,3 @@ onMounted(() => {
} }
} }
</style> </style>
./components/CustomFilterDialog.vue

View File

@ -37,15 +37,6 @@ export const deletePaymentDs = (data: any) => {
} }
// 收入明细新增
export const addRevenueDes = (data: any) => {
return http({
method: 'POST',
url: '/api/recategory/addRevenueDes',
data,
})
}
// 分页查询支付明细 // 分页查询支付明细
export const getPaymentDetailsPage = (data: any) => { export const getPaymentDetailsPage = (data: any) => {
return http({ return http({
@ -62,3 +53,36 @@ export const getByPaymentId = (data: any) => {
data, data,
}) })
} }
// 收货明细分页查询
export const getRevenueDetailsPage = (data: any) => {
return http({
method: 'GET',
url: '/api/revenuedetails/getRevenueDetailsPage',
data,
})
}
// 收入明细查看详情
export const getRevenueDetailsById = (data: any) => {
return http({
method: 'GET',
url: '/api/revenuedetails/getRevenueDetailsById',
data,
})
}
// 收入明细新增
export const addIncome = (data: any) => {
return http({
method: 'POST',
url: '/api/revenuedetails/addRevenueDes',
data,
})
}
// 收入明细逻辑删除
export const deleteRevenueDes = (data: any) => {
return http({
method: 'POST',
url: '/api/revenuedetails/deleteRevenueDes',
data,
})
}