update: 更新出货明细

This commit is contained in:
admin 2024-03-28 11:20:21 +08:00
parent c13e89055d
commit 5262b3e78f
3 changed files with 375 additions and 134 deletions

View File

@ -7,6 +7,7 @@
@close="handleClose"
>
<view class="box">
<view v-if="!isShipment">
<u-cell-group :border="false">
<u-cell
v-for="(item, index) in formAttrList"
@ -37,7 +38,6 @@
: ''
"
@click="currentSpl = item.key"
></u-button>
</view>
</view>
@ -67,6 +67,44 @@
></u-input
></view>
</view>
</view>
<!-- 出货参数 -->
<view v-else>
<u-cell-group :border="false">
<u-cell
v-for="(item, index) in formAttrList1"
: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 deliveryMethodBtnList" :key="index">
<u-button
:text="item.name"
plain
shape="circle"
type="info"
size="small"
:customStyle="
item.key === deliveryMethod
? { border: '1px solid #00dcee', color: '#00dcee' }
: ''
"
@click="deliveryMethod = item.key"
></u-button>
</view>
</view>
</view>
<view class="btn-box1">
<u-button
@ -76,7 +114,12 @@
shape="circle"
@click="resetState"
></u-button>
<u-button type="primary" text="确定" shape="circle" @click="getFilter()"></u-button>
<u-button
type="primary"
text="确定"
shape="circle"
@click="getFilter()"
></u-button>
</view>
</view>
@ -90,13 +133,24 @@
:closeOnClickAction="true"
></u-action-sheet>
</block>
<block v-for="(item, index) in formAttrList1" :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 { CustomerApi, GoodsApi, ProfileApi, SupplierApi } from "@/services";
import _ from "underscore";
const props = defineProps<{
show: boolean;
isShipment: boolean
}>();
const emit = defineEmits(["handleDialog", "handleOk"]);
const handleClose = () => {
@ -110,7 +164,7 @@ const state = reactive({
productId: null, // id,
productName: "", //
minPrice: null,
maxPrice: null
maxPrice: null,
});
const currentSpl = ref<any>(null);
const splBtnList = [
@ -118,6 +172,12 @@ const splBtnList = [
{ key: false, name: "补单" },
{ key: true, name: "未补单" },
];
const deliveryMethod = ref<any>(null);
const deliveryMethodBtnList = [
{ key: null, name: "全部" },
{ key: 0, name: "送货" },
{ key: 1, name: "自提" },
];
const formAttrList = reactive<any>([
{
name: "供应商",
@ -145,6 +205,25 @@ const formAttrList = reactive<any>([
},
},
]);
const formAttrList1 = reactive<any>([
{
name: "客户",
childKey: "customer",
fn: () => {
contrlModalParams.customer.isShow = true;
contrlModalParams.customer.title = "客户";
},
},
{
name: "出货产品",
childKey: "shipmentProduct",
fn: () => {
contrlModalParams.shipmentProduct.isShow = true;
contrlModalParams.shipmentProduct.title = "出货产品";
},
},
]);
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "supplier") {
@ -156,6 +235,12 @@ const handleSelect = (key: string, v: any) => {
} else if (key === "user") {
state.pricingUserName = v.name;
state.pricingUserId = v.id;
} else if (key === "customer") {
state.userName = v.name;
state.userId = v.id;
} else if (key === "shipmentProduct") {
state.productName = v.name;
state.productId = v.id;
}
};
const getValue = (v: string) => {
@ -165,6 +250,10 @@ const getValue = (v: string) => {
return state.productName;
} else if (v === "定价人") {
return state.pricingUserName;
} else if (v === "客户") {
return state.userName;
} else if (v === "出货产品") {
return state.productName;
}
};
const contrlModalParams = reactive<any>({
@ -183,17 +272,30 @@ const contrlModalParams = reactive<any>({
title: "标题",
list: [],
},
customer: {
isShow: false,
title: "标题",
list: [],
},
shipmentProduct: {
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(
@ -204,6 +306,24 @@ GoodsApi.getReceiveProductList().then((res: any) => {
);
}
});
//
CustomerApi.getCustomUserList({}).then((res) => {
if (res.code === 200) {
contrlModalParams.customer.list = res.data;
}
});
//
GoodsApi.getShipmentProductList().then((res) => {
if (res.code === 200) {
contrlModalParams.shipmentProduct.list = _.map(
res.data as any,
function (item: any) {
return { name: item.shmProductsName, ...item };
}
);
}
});
//
const resetState = () => {
@ -216,17 +336,18 @@ const resetState = () => {
state.minPrice = null;
state.maxPrice = null;
currentSpl.value = null;
deliveryMethod.value = null
};
const getFilter = () => {
emit("handleOk", {...state, repairFlag: currentSpl.value});
emit("handleOk", { ...state, repairFlag: currentSpl.value, deliveryMethod: deliveryMethod.value });
emit("handleDialog", false);
}
};
</script>
<style lang="scss" scoped>
.box {
padding: 60rpx 30rpx;
::v-deep .u-cell__value{
::v-deep .u-cell__value {
font-size: 26rpx;
}
.title {

View File

@ -130,6 +130,7 @@
<!-- 筛选 -->
<FilterDialog
:show="showDialog.showFilter"
:isShipment="false"
@handleOk="handleOk"
@handleDialog="(v:boolean) => {handleDialog('showFilter', v)}"
/>
@ -418,7 +419,8 @@ onMounted(() => {
font-weight: 400;
font-size: 26rpx;
color: #000000;
margin: 30rpx 0rpx 0rpx 0rpx;
margin: 30rpx 0rpx 0rpx 30rpx;
}
.box + .box {
margin-top: 30rpx;

View File

@ -8,23 +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="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">筛选</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>
@ -67,7 +87,16 @@
{{ item.buttonType === 0 ? cItem.unit : "%" }}
</text>
</block>
<block v-if="cItem.name !== '扣杂'">
<block v-else-if="cItem.name === '送货方式'">
<text v-if="cItem.name">{{ cItem.name }}</text
><text
>{{ cItem.isBefore ? cItem.unit : "" }}
<text v-if="item[cItem.enName as string] === DeliveryMethod.Deliver">送货</text>
<text v-if="item[cItem.enName as string] === DeliveryMethod.SelfPickup">自提</text>
{{ cItem.isBefore ? "" : cItem.unit }}
</text>
</block>
<block v-else>
<text v-if="cItem.name">{{ cItem.name }}</text
><text
>{{ cItem.isBefore ? cItem.unit : "" }}
@ -78,6 +107,7 @@
</view>
</view>
</view>
</page-view>
</view>
<u-action-sheet
@ -87,6 +117,7 @@
:title="'单据状态'"
:show="state.isShowStatus"
@select="handleSelectStatus"
@close="state.isShowStatus = false"
></u-action-sheet>
<u-action-sheet
:closeOnClickOverlay="true"
@ -95,12 +126,58 @@
: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"
:isShipment="true"
@handleOk="handleOk"
@handleDialog="(v:boolean) => {handleDialog('showFilter', v)}"
/>
</template>
<script setup lang="ts">
import { ShipmentApi } from "@/services";
import { ScaleStatus } from "@/utils/enum";
import { ReceiveApi, ShipmentApi } from "@/services";
import { DeliveryMethod, 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,
@ -137,16 +214,19 @@ const state = reactive({
key: "update_time",
},
],
params: {},
});
const handleSelectStatus = (v: any) => {
state.isShowStatus = false;
state.currentScaleStatus = v.key;
getOrderList();
resetPageList();
getList();
};
const handleSelectSort = (v: any) => {
state.isShowSort = false;
state.currentSortName = v.key;
getOrderList();
resetPageList();
getList();
};
const keyword = ref("");
@ -238,7 +318,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) => {
@ -260,35 +340,73 @@ const handleAdd = () => {
url: "/pagesApp/shipmentSpl", //
});
};
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;
}
if (state.currentSortName !== undefined) {
params.sortName = state.currentSortName;
}
ShipmentApi.getOrderPage(params).then((res) => {
if (keyword.value !== undefined) {
params.orderNumber = keyword.value;
}
pageList.isLoading = true;
ShipmentApi.getOrderPage({
...params,
...filterNullUndefined(state.params),
}).then((res: any) => {
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>
@ -335,7 +453,7 @@ onMounted(() => {
font-weight: 400;
font-size: 26rpx;
color: #000000;
margin: 30rpx 0rpx;
margin: 30rpx 0rpx 0rpx 30rpx;
}
.box + .box {
margin-top: 30rpx;