update: 收货明细

This commit is contained in:
admin 2024-03-28 10:07:15 +08:00
parent 270ca68aae
commit c13e89055d
7 changed files with 693 additions and 110 deletions

View File

@ -169,7 +169,7 @@ onMounted(() => {
font-size: 28rpx;
color: #000000;
::v-deep .u-input {
padding: 0rpx 16.03rpx !important;
padding: 0rpx 16rpx !important;
input {
font-family: Source Han Sans CN;
font-weight: 400;

View File

@ -0,0 +1,269 @@
<template>
<u-popup
:show="show"
mode="bottom"
:round="10"
:closeable="false"
@close="handleClose"
>
<view class="box">
<u-cell-group :border="false">
<u-cell
v-for="(item, index) in formAttrList"
:key="index"
:title="item.name"
:titleStyle="{
fontSize: '26rpx',
color: 'rgba(0, 0, 0, 1)',
fontWeight: 'bold',
}"
isLink
@click="item.fn"
:value="getValue(item.name)"
></u-cell>
</u-cell-group>
<view class="title">收货单类型</view>
<view class="btn-box">
<view v-for="(item, index) in splBtnList" :key="index">
<u-button
:text="item.name"
plain
shape="circle"
type="info"
size="small"
:customStyle="
item.key === currentSpl
? { border: '1px solid #00dcee', color: '#00dcee' }
: ''
"
@click="currentSpl = item.key"
></u-button>
</view>
</view>
<view class="title">收货单价区间</view>
<view class="range">
<view>
<u-input
shape="circle"
:fontSize="12"
:placeholderStyle="{ fontSize: '12px' }"
placeholder="最低价"
type="number"
size="small"
v-model="state.minPrice"
></u-input
></view>
-
<view>
<u-input
shape="circle"
:fontSize="12"
:placeholderStyle="{ fontSize: '12px' }"
placeholder="最高价"
type="number"
size="small"
v-model="state.maxPrice"
></u-input
></view>
</view>
<view class="btn-box1">
<u-button
text="重置"
color="#E8E8E8"
:customStyle="{ color: '#999' }"
shape="circle"
@click="resetState"
></u-button>
<u-button type="primary" text="确定" shape="circle" @click="getFilter()"></u-button>
</view>
</view>
<block v-for="(item, index) in formAttrList" :key="index">
<u-action-sheet
: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>
</u-popup>
</template>
<script setup lang="ts">
import { GoodsApi, ProfileApi, SupplierApi } from "@/services";
import _ from "underscore";
const props = defineProps<{
show: boolean;
}>();
const emit = defineEmits(["handleDialog", "handleOk"]);
const handleClose = () => {
emit("handleDialog", false);
};
const state = reactive({
userId: null, // ID
userName: "", //
pricingUserId: null, // id
pricingUserName: "", //
productId: null, // id,
productName: "", //
minPrice: null,
maxPrice: null
});
const currentSpl = ref<any>(null);
const splBtnList = [
{ key: null, name: "全部" },
{ key: false, name: "补单" },
{ key: true, name: "未补单" },
];
const formAttrList = reactive<any>([
{
name: "供应商",
childKey: "supplier",
fn: () => {
console.log("********");
contrlModalParams.supplier.isShow = true;
contrlModalParams.supplier.title = "供应商";
},
},
{
name: "收货产品",
childKey: "product",
fn: () => {
contrlModalParams.product.isShow = true;
contrlModalParams.product.title = "收货产品";
},
},
{
name: "定价人",
childKey: "user",
fn: () => {
contrlModalParams.user.isShow = true;
contrlModalParams.user.title = "定价人";
},
},
]);
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "supplier") {
state.userName = v.name;
state.userId = v.id;
} else if (key === "product") {
state.productName = v.name;
state.productId = v.id;
} else if (key === "user") {
state.pricingUserName = v.name;
state.pricingUserId = v.id;
}
};
const getValue = (v: string) => {
if (v === "供应商") {
return state.userName;
} else if (v === "收货产品") {
return state.productName;
} else if (v === "定价人") {
return state.pricingUserName;
}
};
const contrlModalParams = reactive<any>({
supplier: {
isShow: false,
title: "标题",
list: [],
},
product: {
isShow: false,
title: "标题",
list: [],
},
user: {
isShow: false,
title: "标题",
list: [],
},
});
ProfileApi.getUserList({}).then((res: any) => {
if (res.code === 200) {
contrlModalParams.user.list = res.data;
}
});
SupplierApi.getSupplierUserList({}).then((res: any) => {
if (res.code === 200) {
contrlModalParams.supplier.list = res.data;
}
});
GoodsApi.getReceiveProductList().then((res: any) => {
if (res.code === 200) {
contrlModalParams.product.list = _.map(
res.data as any,
function (item: any) {
return { name: item.reProductsName, ...item };
}
);
}
});
//
const resetState = () => {
state.userId = null; // ID
state.userName = ""; //
state.pricingUserId = null; // id
state.pricingUserName = ""; //
state.productId = null; // id,
state.productName = ""; //
state.minPrice = null;
state.maxPrice = null;
currentSpl.value = null;
};
const getFilter = () => {
emit("handleOk", {...state, repairFlag: currentSpl.value});
emit("handleDialog", false);
}
</script>
<style lang="scss" scoped>
.box {
padding: 60rpx 30rpx;
::v-deep .u-cell__value{
font-size: 26rpx;
}
.title {
font-size: 26rpx;
color: rgba(0, 0, 0, 1);
font-weight: bold;
padding-left: 30rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.btn-box {
flex-direction: row;
display: flex;
align-items: center;
padding-left: 30rpx;
> view + view {
margin-left: 20rpx;
}
}
.range {
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 30rpx;
> view {
width: 40%;
}
}
.btn-box1 {
flex-direction: row;
display: flex;
align-items: center;
margin-top: 30rpx;
::v-deep button + button {
margin-left: 50rpx;
}
}
}
</style>

View File

@ -0,0 +1,180 @@
<template>
<u-popup
:show="show"
mode="bottom"
:round="10"
:closeable="true"
@close="handleClose"
>
<view class="c-dialog">
<view class="box"><text>常用时间选择</text></view>
<view class="box-btn">
<text
v-for="(item, index) in state.statusList"
:key="index"
:class="{ active: state.currentStates === item.id }"
@click="handleSelect(item)"
>{{ item.name }}</text
></view
>
<view class="box box-border"
><text>其它时间选择</text
><text class="btn" @click="handleCustom()">自定义</text></view
>
<view v-if="showCalendar">
<view class="line"></view>
<view class="box">
<text @click="showCalendar = false">取消</text>
<text class="btn" @click="confirm()">完成</text>
</view>
<view>{{ state.startTime }} - {{ state.endTime }}</view>
<uni-calendar
:insert="true"
:lunar="true"
:start-date="'2014-1-1'"
:end-date="'2034-1-1'"
:range="true"
@change="handleChangeDate"
color="#00D2E3"
/>
</view>
</view>
</u-popup>
</template>
<script setup lang="ts">
import { formatDate, getCurrentMonthStartAndEnd, getCurrentYearStartAndEnd } from "@/utils";
const props = defineProps<{
show: boolean;
}>();
const state = reactive<any>({
startTime: "",
endTime: "",
currentStates: -1,
statusList: [
{
id: 1,
name: "今日",
},
{
id: 2,
name: "昨日",
},
{
id: 3,
name: "本月",
},
{
id: 4,
name: "本年",
},
],
});
const emit = defineEmits(["handleDialog", "changeTime"]);
const handleClose = () => {
emit("handleDialog", false);
};
const handleCustom = () => {
showCalendar.value = true
state.currentStates = -1
}
const handleSelect = (item: any) => {
const today = new Date();
const yesterday = new Date((today as any) - (24 * 60 * 60 * 1000));
state.currentStates = item.id;
console.log(item);
if (item.id === 1) {
state.startTime = formatDate(today, "{y}-{m}-{d}");
state.endTime = formatDate(today, "{y}-{m}-{d}");
} else if (item.id === 2) {
state.startTime = formatDate(yesterday, "{y}-{m}-{d}");
state.endTime = formatDate(yesterday, "{y}-{m}-{d}");
} else if (item.id === 3) {
state.startTime = formatDate(getCurrentMonthStartAndEnd().start, "{y}-{m}-{d}");
state.endTime = formatDate(getCurrentMonthStartAndEnd().end, "{y}-{m}-{d}");
} else if (item.id === 4) {
state.startTime = formatDate(getCurrentYearStartAndEnd().start, "{y}-{m}-{d}");
state.endTime = formatDate(getCurrentYearStartAndEnd().end, "{y}-{m}-{d}");
}
emit("changeTime", {startTime: state.startTime, endTime: state.endTime, name: item.name});
emit("handleDialog", false);
};
const showCalendar = ref(false);
const handleChangeDate = (v: any) => {
const time1 = v.range.before;
const time2 = v.range.after;
if (time1 && time2) {
const date1 = new Date(time1);
const date2 = new Date(time2);
if (date1 < date2) {
state.startTime = formatDate(time1, "{y}-{m}-{d}");
state.endTime = formatDate(time2, "{y}-{m}-{d}");
} else if (date1 > date2) {
state.startTime = formatDate(time2, "{y}-{m}-{d}");
state.endTime = formatDate(time1, "{y}-{m}-{d}");
} else {
state.startTime = formatDate(time1, "{y}-{m}-{d}");
state.endTime = formatDate(time2, "{y}-{m}-{d}");
}
}
};
const confirm = () => {
showCalendar.value = false
emit("changeTime", {startTime: state.startTime, endTime: state.endTime, name: '自定义'});
emit("handleDialog", false);
}
</script>
<style lang="scss" scoped>
::v-deep .u-popup__content {
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 32rpx 32rpx 0rpx 0rpx;
}
.c-dialog {
margin: 65.38rpx 44.87rpx;
font-family: Source Han Sans CN;
font-weight: 500;
font-size: 26rpx;
color: #000000;
.box-btn,
.box {
line-height: 80rpx;
display: flex;
justify-content: space-between;
}
.box-btn {
line-height: 40rpx;
margin-bottom: 30rpx;
text {
font-weight: 400;
font-size: 26rpx;
color: #999999;
width: 140rpx;
background: #ffffff;
border-radius: 6rpx;
border: 1px solid rgba(153, 153, 153, 0.64);
text-align: center;
cursor: pointer;
}
.active {
border-color: $u-primary;
color: $u-primary;
}
}
.btn {
font-weight: 500;
font-size: 26rpx;
color: $u-primary;
}
.box-border {
border-top: 1px solid rgba(233, 233, 233, 0.76);
}
.line {
height: 18rpx;
background: #f8f8f8;
}
}
</style>

View File

@ -8,19 +8,43 @@
: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><text>本月</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 @click="state.isShowSort = true"><text>排序</text><u-icon name="arrow-down"></u-icon></view>
<view class="btn">筛选</view>
<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 @click="state.isShowSort = true"
><text>排序</text><u-icon name="arrow-down"></u-icon
></view>
<view class="btn" @click="handleDialog('showFilter', true)">筛选</view>
</view>
<view class="time">2024-01-01</view>
<view class="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="200"
:isLoading="pageList.isLoading"
>
<view class="box" v-for="(item, index) in pageList.list" :key="index">
<view class="base">
<view>
@ -53,11 +77,14 @@
>
<block v-if="cItem.name === '扣杂'">
<text v-if="cItem.name">
{{ item.buttonType === 0 ? '扣杂' : '扣点' }}
</text
{{ item.buttonType === 0 ? "扣杂" : "扣点" }} </text
><text>
{{ item.buttonType === 0 ? item[cItem.enName as string] : item['points'] }}
{{ item.buttonType === 0 ? cItem.unit : '%' }}
{{
item.buttonType === 0
? item[cItem.enName as string]
: item["points"]
}}
{{ item.buttonType === 0 ? cItem.unit : "%" }}
</text>
</block>
<block v-if="cItem.name !== '扣杂'">
@ -71,54 +98,122 @@
</view>
</view>
</view>
</page-view>
</view>
<u-action-sheet :closeOnClickOverlay="true" :closeOnClickAction="true" :actions="state.statusList" :title="'单据状态'" :show="state.isShowStatus" @select="handleSelectStatus"></u-action-sheet>
<u-action-sheet :closeOnClickOverlay="true" :closeOnClickAction="true" :actions="state.sortList" :title="'排序'" :show="state.isShowSort" @select="handleSelectSort"></u-action-sheet>
<u-action-sheet
:closeOnClickOverlay="true"
:closeOnClickAction="true"
:actions="state.statusList"
:title="'单据状态'"
:show="state.isShowStatus"
@select="handleSelectStatus"
@close="state.isShowStatus = false"
></u-action-sheet>
<u-action-sheet
:closeOnClickOverlay="true"
:closeOnClickAction="true"
:actions="state.sortList"
:title="'排序'"
:show="state.isShowSort"
@select="handleSelectSort"
@close="state.isShowSort = false"
></u-action-sheet>
<!-- 时间弹框 -->
<TimeDialog
ref="timeDialog"
:show="showDialog.showTime"
@handleDialog="(v:boolean) => {handleDialog('showTime', v)}"
@changeTime="changeTime"
/>
<!-- 筛选 -->
<FilterDialog
:show="showDialog.showFilter"
@handleOk="handleOk"
@handleDialog="(v:boolean) => {handleDialog('showFilter', v)}"
/>
</template>
<script setup lang="ts">
import { ReceiveApi } from "@/services";
import { ScaleStatus } from "@/utils/enum";
import PageView from "@/components/PageView/index.vue";
import { formatDate, getCurrentMonthStartAndEnd, filterNullUndefined } from "@/utils";
import TimeDialog from "./components/TimeDialog.vue";
import FilterDialog from "./components/FilterDialog.vue";
const showDialog = <
{
[key: string]: boolean;
}
>reactive({
showTime: false,
showFilter: false,
});
const handleDialog = (key: string, v: boolean) => {
showDialog[key] = v;
};
const changeTime = (obj: any) => {
state.startTime = obj.startTime;
state.endTime = obj.endTime;
state.name = obj.name;
resetPageList();
getList();
};
const state = reactive({
startTime: formatDate(getCurrentMonthStartAndEnd().start, "{y}-{m}-{d}"),
endTime: formatDate(getCurrentMonthStartAndEnd().end, "{y}-{m}-{d}"),
name: "本月",
currentScaleStatus: undefined,
currentSortName: undefined,
isShowStatus: false,
statusList: [{
name: '待定价',
key: 0
},{
name: '待过皮',
key: 1
},{
name: '待审核',
key: 2
},{
name: '已审核待支付',
key: 3
},{
name: '已支付',
key: 4
}],
isShowSort: false,
sortList: [{
name: '按创建时间降序',
key: 'create_time'
statusList: [
{
name: "待定价",
key: 0,
},
{
name: '按更新时间降序',
key: 'update_time'
}]
})
name: "待过皮",
key: 1,
},
{
name: "待审核",
key: 2,
},
{
name: "已审核待支付",
key: 3,
},
{
name: "已支付",
key: 4,
},
],
isShowSort: false,
sortList: [
{
name: "按创建时间降序",
key: "create_time",
},
{
name: "按更新时间降序",
key: "update_time",
},
],
params: {},
});
const handleSelectStatus = (v: any) => {
state.isShowStatus = false
state.currentScaleStatus = v.key
getOrderList()
}
state.isShowStatus = false;
state.currentScaleStatus = v.key;
resetPageList();
getList();
};
const handleSelectSort = (v: any) => {
state.isShowSort = false
state.currentSortName = v.key
getOrderList()
}
state.isShowSort = false;
state.currentSortName = v.key;
resetPageList();
getList();
};
const keyword = ref("");
const gridList1 = reactive([
@ -191,7 +286,7 @@ const gridList1 = reactive([
]);
const handleScenePhoto = (id: string) => {
uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&id=" + id, //
url: "/pagesScenePhoto/index?orderType=1&imagesType=1&id=" + id, //
});
};
const getScaleStatus = (type: number) => {
@ -212,37 +307,71 @@ const handleAdd = () => {
uni.navigateTo({
url: "/pagesApp/receiveSpl", //
});
}
interface PageResult<T> {
total: number;
list: T[];
pageNum: number;
pageSize: number;
}
};
const pageList: PageResult<Order> = reactive({
isLoading: false,
noMoreData: false,
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
const getOrderList = () => {
let params: any = { pageNumber: 1, pageSize: 10}
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
const handleOk = (obj: any) => {
state.params = obj;
resetPageList();
getList();
};
const handleSearch = () => {
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",
};
if (state.currentScaleStatus !== undefined) {
params.scaleStatus = state.currentScaleStatus
params.scaleStatus = state.currentScaleStatus;
}
if (state.currentSortName !== undefined) {
params.sortName = state.currentSortName
params.sortName = state.currentSortName;
}
ReceiveApi.getOrderPage(params).then((res) => {
if (keyword.value !== undefined) {
params.receiptNumber = keyword.value;
}
pageList.isLoading = true;
ReceiveApi.getOrderPage({ ...params, ...filterNullUndefined(state.params) }).then((res) => {
if (res.code === 200) {
(pageList as any).list = res.data.list;
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(() => {
getOrderList();
getList();
});
</script>
<style lang="scss" scoped>
@ -289,7 +418,7 @@ onMounted(() => {
font-weight: 400;
font-size: 26rpx;
color: #000000;
margin: 30rpx 0rpx;
margin: 30rpx 0rpx 0rpx 0rpx;
}
.box + .box {
margin-top: 30rpx;

View File

@ -106,14 +106,12 @@ const getList = (v?: boolean) => {
name: state.name,
};
ProfileApi.getUserListByPage(params).then((res) => {
if (res.code === 200) {
if (res.code === 200) {
(pageList as any).list = (pageList as any).list.concat(
(res.data as any).list
);
pageList.total = (res.data as any).total;
}
}
});
};

View File

@ -123,9 +123,7 @@ const getList = (v?: boolean) => {
ReceiveApi.getOrderPage(params).then((res) => {
if (res.code === 200) {
pageList.isLoading = false;
(pageList as any).list = (pageList as any).list = (
pageList as any
).list.concat(res.data.list);
(pageList as any).list = pageList.list.concat(res.data.list);
pageList.total = (res.data as any).total;
}
});

View File

@ -128,3 +128,12 @@ export function pageListInit() {
pageSize: 10,
};
}
// 过滤掉属性值为null的
export function filterNullUndefined(obj: Object) {
return Object.entries(obj).reduce((acc:any, [key, value]) => {
if (value !== null && value !== undefined && value !=='') {
acc[key] = value;
}
return acc;
}, {});
}