freight-web/src/pagesShipment/review/index.vue

692 lines
16 KiB
Vue
Raw Normal View History

2024-03-11 05:30:11 +00:00
<template>
<view class="c-card">
<view class="box">
<view class="base">
<view>
<view class="supplier"> {{ state.order.deviceName || "-" }} </view>
</view>
</view>
<view class="flex-box1">
<view class="type">{{ state.order.productName || "" }}</view>
<view class="btn">
<view
><u-tag
text="现场照片"
plain
shape="circle"
:bgColor="'rgba(237, 254, 255, 1)'"
@click="handleScenePhoto(state.order.imagesId as number)"
></u-tag
></view>
<view
><u-tag
text="收货单作废"
plain
shape="circle"
:borderColor="'rgba(255, 147, 68, 1) !important'"
:bgColor="'rgba(255, 240, 229, 1)'"
:color="'rgba(255, 157, 85, 1) !important'"
@click="handleModal(true, state.order.id as string)"
></u-tag
></view>
2024-03-12 05:34:36 +00:00
<!-- 点击待出货结算-->
2024-03-12 06:42:34 +00:00
<view
v-if="
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement
"
2024-03-11 05:30:11 +00:00
><u-tag
text="编辑信息"
plain
shape="circle"
:borderColor="'rgba(0, 238, 78, 1) !important'"
:bgColor="'rgba(227, 255, 236, 1)'"
:color="'rgba(0, 238, 78, 1) !important'"
@click="handleUpdateOrder"
></u-tag
></view>
</view>
</view>
<!-- 出库 过磅时间对应过皮时间 -->
2024-03-12 06:42:34 +00:00
<view
class="flex-box"
v-if="
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement ||
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay
"
>
2024-03-11 05:30:11 +00:00
<text>审核人{{ state.order.pricingUserName || "-" }}</text>
<text>过磅时间{{ state.order.tareTime }}</text>
</view>
<!-- <view class="flex-box" v-if="getIsShow()" style="border: none">
<text>过磅时间{{ state.order.grossTime || "-" }}</text>
</view>
<view class="flex-box" v-if="getIsShow()">
<text>定价人{{ state.order.pricingUserName || "-" }}</text>
<text>审核人{{ state.order.reviewerUserName || "-" }}</text>
</view> -->
<view class="more">
2024-03-12 06:42:34 +00:00
<view
v-if="
state.scaleStatusBtnType ===
ScaleStatusBtnType.ShipmentSettlement ||
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay
"
>
出货单号{{ state.order.orderNumber }}
</view>
<view
v-if="
state.scaleStatusBtnType ===
ScaleStatusBtnType.ShipmentSettlement ||
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay
"
></view>
2024-03-11 05:30:11 +00:00
<view v-for="(item, index) in gridList1" :key="index">
<text v-if="item.name">{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }}
{{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view>
</view>
<!-- <u-gap height="10" bgColor="#F8F8F8"></u-gap> -->
<view class="mt-30">
<u-line></u-line>
</view>
2024-03-12 06:42:34 +00:00
<view
class="more"
v-if="
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement
"
>
2024-03-11 05:30:11 +00:00
<view v-for="(item, index) in gridList2" :key="index">
<text v-if="item.name">{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }}
{{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view>
</view>
2024-03-12 05:34:36 +00:00
2024-03-12 06:42:34 +00:00
<view
class="more"
v-if="
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay ||
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentPay
"
>
2024-03-12 05:34:36 +00:00
<view v-for="(item, index) in gridList3" :key="index">
<text v-if="item.name">{{ item.name }}</text
><text
>{{ item.isBefore ? item.unit : "" }}
{{ item.num }}
{{ item.isBefore ? "" : item.unit }}
</text>
</view>
</view>
2024-03-11 05:30:11 +00:00
</view>
<view class="op-btn">
2024-03-12 06:42:34 +00:00
<view
class="c-btn-review"
v-if="
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement
"
>
2024-03-11 05:30:11 +00:00
<view @click="handleReviewNoPay"> 出货未结算 </view>
<view class="active" @click="handleReviewPay"> 出货并结算 </view>
</view>
2024-03-12 06:42:34 +00:00
<view
v-if="
state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentSettlement
"
>
2024-03-11 05:30:11 +00:00
<u-button
text="重新过毛"
plain
:customStyle="{
color: 'rgba(0, 220, 238, 1)',
border: '1px solid #00DCEE',
'border-radius': '43rpx',
}"
2024-03-12 06:42:34 +00:00
@click="handleReWeight()"
2024-03-11 05:30:11 +00:00
></u-button>
</view>
2024-03-12 05:34:36 +00:00
<view>
2024-03-11 05:30:11 +00:00
<u-button
2024-03-12 06:42:34 +00:00
v-if="state.scaleStatusBtnType === ScaleStatusBtnType.ShipmentNoPay"
@click="handleSettlement"
2024-03-12 05:34:36 +00:00
text="立即结算"
2024-03-11 05:30:11 +00:00
type="primary"
:customStyle="{ 'border-radius': '43rpx' }"
></u-button>
</view>
<view>
<u-button
text="打印"
type="primary"
:customStyle="{ 'border-radius': '43rpx' }"
></u-button>
</view>
</view>
</view>
<!-- 支付方式 -->
<block v-for="(item, index) in state.sheetList" :key="index">
<u-action-sheet
:actions="contrlModalParams[item.key].list"
:title="contrlModalParams[item.key].title"
:show="contrlModalParams[item.key].isShow"
@select="(v: any) => handleSelect(item.key, v)"
@close="contrlModalParams[item.key].isShow = false"
:closeOnClickAction="true"
></u-action-sheet>
</block>
<SmallModal
:title="'确认作废吗?'"
:content="'确认作废后,该订单不能恢复!'"
:okText="'确认作废'"
:isMain="true"
:show="isShowCancelModal"
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
@handleOk="handleOk()"
/>
</template>
<script setup lang="ts">
import { ShipmentApi } from "@/services/index";
2024-03-12 05:34:36 +00:00
import { ScaleStatusBtnType } from "@/utils/enum";
2024-03-11 05:30:11 +00:00
import { onLoad } from "@dcloudio/uni-app";
const keyword = ref("");
const contrlModalParams = reactive<{ [attrName: string]: any }>({
paySelect: {
isShow: false,
title: "请选择支付方式",
// 1:现金支付2银行卡支付3线上支付微信4支付宝
list: [
{
name: "微信",
key: 3,
},
{
name: "现金",
key: 1,
},
{
name: "支付宝",
key: 4,
},
{
name: "转账",
key: 2,
},
],
},
printSelect: {
isShow: false,
title: "请选择打印设备",
list: [
{
name: "打印设备1",
key: 1,
},
{
name: "打印设备2",
key: 2,
},
{
name: "打印设备3",
key: 3,
},
{
name: "打印设备4",
key: 4,
},
],
},
});
const state = reactive<{
order: Shipment;
[attrName: string]: any;
}>({
2024-03-12 05:34:36 +00:00
order: {
2024-03-12 06:42:34 +00:00
id: "",
2024-03-12 05:34:36 +00:00
buttonType: 0,
netWeight: 0,
},
2024-03-11 05:30:11 +00:00
sheetList: [
{
key: "paySelect",
},
{
key: "printSelect",
},
],
2024-03-12 05:34:36 +00:00
scaleStatusBtnType: 0,
2024-03-11 05:30:11 +00:00
});
const gridList1 = reactive([
{
name: "毛重",
enName: "grossWeight",
num: "",
unit: "KG",
isBefore: false,
},
{
name: "皮重",
enName: "tare",
num: "",
unit: "KG",
isBefore: false,
},
{
name: "净重",
enName: "netWeight",
num: "",
unit: "KG",
isBefore: false,
},
]);
const gridList2 = reactive([
{
name: "客户名称",
enName: "userName",
num: "",
isBefore: false,
},
{},
{
name: "签收时间",
enName: "signTime",
num: "",
isBefore: false,
},
{},
{
name: "毛重",
2024-03-12 05:34:36 +00:00
enName: "settlementGross",
2024-03-11 05:30:11 +00:00
num: "",
unit: "KG",
isBefore: false,
},
{
name: "皮重",
2024-03-12 05:34:36 +00:00
enName: "settlementTare",
2024-03-11 05:30:11 +00:00
num: "",
unit: "KG",
isBefore: false,
},
{
name: "结算重量",
2024-03-12 05:34:36 +00:00
enName: "settlementWeight",
2024-03-11 05:30:11 +00:00
num: "",
unit: "KG",
isBefore: false,
},
{
name: "单价",
enName: "unitPrice",
num: "",
unit: "元/KG",
isBefore: false,
},
{
name: "预估总价",
enName: "estimatePrice",
num: "",
unit: "元",
isBefore: false,
},
{
name: "结算金额",
enName: "totalPrice",
num: "",
unit: "元",
isBefore: false,
},
{
name: "运费",
enName: "freight",
num: "",
unit: "元",
isBefore: false,
},
{
name: "杂费",
enName: "incidentals",
num: "",
unit: "元",
isBefore: false,
},
]);
2024-03-12 05:34:36 +00:00
const gridList3 = reactive([
{
name: "客户名称",
enName: "userName",
num: "",
isBefore: false,
},
{
name: "结算人",
enName: "userName",
num: "",
isBefore: false,
},
{
name: "结算时间",
enName: "signTime",
num: "",
isBefore: false,
},
{},
{
name: "结算重量",
enName: "settlementWeight",
num: 0,
unit: "KG",
isBefore: false,
},
{
name: "结算单价",
enName: "unitPrice",
num: "",
unit: "元/KG",
isBefore: false,
},
{
name: "预估总价",
enName: "estimatePrice",
num: "",
unit: "元",
isBefore: false,
},
{
name: "结算金额",
enName: "totalPrice",
num: "",
unit: "元",
isBefore: false,
},
{
name: "运费",
enName: "freight",
num: "",
unit: "元",
isBefore: false,
},
{
name: "杂费",
enName: "incidentals",
num: "",
unit: "元",
isBefore: false,
},
{
name: "实际收入",
enName: "incidentals",
num: "",
unit: "元",
isBefore: false,
},
{},
// 客户过磅净重-机器过磅净重
{
name: "净重误差",
enName: "netWeightError",
num: "",
unit: "KG",
isBefore: false,
},
]);
// 立即结算 // 先填写结算信息后更新状态为4
const handleSettlement = () => {
uni.navigateTo({
2024-03-12 06:42:34 +00:00
url:
"/pagesShipment/form/settlementForm?id=" +
state.order.id +
`&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentPay}`, // 要跳转到的页面路径
2024-03-12 05:34:36 +00:00
});
2024-03-12 06:42:34 +00:00
};
2024-03-11 05:30:11 +00:00
const handleScenePhoto = (imagesId: number) => {
uni.navigateTo({
url: "/pagesScenePhoto/index?orderType=1&id=" + imagesId, // 要跳转到的页面路径
});
};
// 出货未结算 // 先填写结算信息后更新状态为3
const handleReviewNoPay = () => {
uni.navigateTo({
2024-03-12 06:42:34 +00:00
url:
"/pagesShipment/form/settlementForm?id=" +
state.order.id +
`&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentNoPay}`, // 要跳转到的页面路径
2024-03-11 05:30:11 +00:00
});
// ShipmentApi.updateOrderIn({ ...state.order, scaleStatus: 3 }).then((res) => {
// if (res.code === 200) {
// uni.navigateTo({
// url: "/pagesShipment/shipmentSettlement?scaleStatus=3", // 要跳转到的页面路径
// });
// }
// });
};
// 审核立即支付
const handleReviewPay = () => {
2024-03-12 05:34:36 +00:00
uni.navigateTo({
2024-03-12 06:42:34 +00:00
url:
"/pagesShipment/form/settlementForm?id=" +
state.order.id +
`&scaleStatusBtnType=${ScaleStatusBtnType.ShipmentPay}`, // 要跳转到的页面路径
2024-03-12 05:34:36 +00:00
});
2024-03-11 05:30:11 +00:00
};
const handleSelect = (key: string, v: any) => {
contrlModalParams[key].isShow = false;
if (key === "paySelect") {
// 修改订单状态
// ShipmentApi.updateOne({
// ...state.order,
// scaleStatus: 4,
// paymentMethod: v.key,
// }).then((res) => {
// if (res.code === 200) {
// uni.showToast({
// title: "支付成功",
// icon: "success",
// });
// uni.navigateTo({
// url: "/pagesReceive/payReview?scaleStatus=4", // 要跳转到的页面路径
// });
// }
// });
} else if (key === "printSelect") {
// 打印
}
};
const isShowCancelModal = ref(false);
const deleteId = ref("0");
// 打开确认作废对话框
const handleModal = (v: boolean, id: string) => {
isShowCancelModal.value = v;
deleteId.value = id;
};
const handleOk = () => {
ShipmentApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
if (res.code === 200) {
uni.navigateTo({
url: "/pagesShipment/shipmentSettlement?scaleStatus=2", // 要跳转到的页面路径
});
}
});
};
const handleUpdateOrder = () => {
uni.navigateTo({
url: "/pagesShipment/form/shipmentForm?id=" + state.order.id, // 要跳转到的页面路径
});
};
2024-03-12 05:34:36 +00:00
2024-03-12 06:42:34 +00:00
// 重新过毛
const handleReWeight = () => {
ShipmentApi.reGrossWeight({ id: state.order.id }).then((res) => {
if (res.code === 200) {
uni.navigateTo({
url: "/pagesShipment/grossWeight", // 要跳转到的页面路径
});
}
});
};
onLoad((option) => {
2024-03-11 05:30:11 +00:00
state.order.id = (option as any).id;
2024-03-12 05:34:36 +00:00
state.scaleStatusBtnType = parseInt((option as any).scaleStatusBtnType);
2024-03-11 05:30:11 +00:00
if (state.order.id) {
ShipmentApi.getDetailById({ id: state.order.id }).then((res) => {
if (res.code === 200) {
state.order = res.data;
2024-03-12 05:34:36 +00:00
gridList1.map((item) => {
// if (item.name === "扣杂" || item.name === "扣点") {
// if (state.order.buttonType === 0) {
// item.name = "扣杂";
// item.enName = "buckleMiscellaneous";
// item.unit = "KG";
// } else if (state.order.buttonType === 1) {
// item.name = "扣点";
// item.enName = "points";
// item.unit = "%";
// }
// }
item.num = state.order[item.enName as string];
});
gridList2.map((item) => {
item.num = state.order[item.enName as string];
});
gridList3.map((item) => {
2024-03-12 06:42:34 +00:00
if (item.name === "净重误差") {
item.num =
(state.order as any).netWeight -
(state.order as any).settlementNet;
2024-03-12 05:34:36 +00:00
}
item.num = state.order[item.enName as string];
});
2024-03-11 05:30:11 +00:00
}
});
}
});
</script>
<style lang="scss" scoped>
.c-card {
margin: 30rpx 25rpx;
.box {
background: #ffffff;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
border-radius: 13rpx;
padding: 30rpx;
.base {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 400;
font-size: 26rpx;
color: #000000;
.btn {
border-radius: 24rpx;
border: 1px solid #00dcee;
padding: 10rpx 30rpx;
font-weight: 500;
font-size: 24rpx;
color: #00dcee;
line-height: 41rpx;
}
}
.name {
font-weight: 400;
font-size: 26rpx;
color: #000000;
margin: 15rpx 0rpx;
text {
background-color: #ffaf75;
font-weight: 500;
font-size: 26rpx;
color: #ffffff;
padding: 5rpx 20rpx;
margin-left: 20rpx;
}
}
.flex-box1 {
display: flex;
align-items: center;
justify-content: space-between;
margin: 20rpx 0rpx;
.type {
font-weight: 400;
font-size: 26rpx;
color: #ec0f3e;
}
.btn {
display: flex;
> view + view {
margin-left: 10rpx;
}
}
}
.flex-box {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 400;
font-size: 24rpx;
color: #999999;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
padding-bottom: 20rpx;
}
}
.more {
display: grid;
grid-template-columns: repeat(2, 1fr);
flex: 1;
font-weight: 400;
font-size: 26rpx;
color: #000000;
padding: 25rpx 0rpx 0rpx 0rpx;
> view {
line-height: 50rpx;
width: max-content;
}
}
.op-btn {
width: 80%;
margin: 0px auto;
margin-top: 100rpx;
.c-btn-review {
display: flex;
justify-content: space-between;
align-items: center;
background: #f5f5f5;
border-radius: 38rpx;
text-align: center;
margin-bottom: 80rpx;
> view {
width: 50%;
text-align: center;
font-weight: 500;
font-size: 26rpx;
color: #999999;
}
.active {
background: #00dcee;
border-radius: 38rpx;
font-weight: 500;
font-size: 26rpx;
color: #ffffff;
padding: 20rpx 30rpx;
}
}
> view + view {
margin-top: 30rpx;
}
}
}
</style>