240 lines
6.0 KiB
Vue
240 lines
6.0 KiB
Vue
<template>
|
||
<page-view
|
||
@loadList="
|
||
(v) => {
|
||
getList(v);
|
||
}
|
||
"
|
||
:noMoreData="pageList.noMoreData"
|
||
:list="pageList.list"
|
||
:height="0"
|
||
:isLoading="pageList.isLoading"
|
||
>
|
||
<view class="card-box" v-for="(item, index) in pageList.list" :key="index">
|
||
<view class="top-flex-box">
|
||
<view>
|
||
<view>
|
||
<text class="address">{{ item.deviceName || "-" }}</text>
|
||
</view>
|
||
<view>
|
||
<text class="number">收货单号:{{ item.receiptNumber }}</text>
|
||
</view>
|
||
<view>
|
||
<text class="name">{{ item.userName }}</text>
|
||
</view>
|
||
</view>
|
||
<view>
|
||
<u-button
|
||
:customStyle="{ border: '1px solid #00dcee', color: '#00dcee' }"
|
||
@click="handleScenePhoto(item.id as number)"
|
||
text="现场照片"
|
||
plain
|
||
shape="circle"
|
||
type="success"
|
||
size="small"
|
||
></u-button>
|
||
</view>
|
||
</view>
|
||
<view>
|
||
<text class="desc">过毛时间:{{ item.grossTime }}</text>
|
||
</view>
|
||
<view class="flex-box">
|
||
<text>毛重:{{ item.grossWeight }}kg</text>
|
||
<text
|
||
>单价:{{
|
||
state.scaleStatus === 0 ? "未定价" : item.price + "元/KG"
|
||
}}</text
|
||
>
|
||
</view>
|
||
<view class="btn-box">
|
||
<u-button
|
||
text="点击作废"
|
||
color="#E8E8E8"
|
||
:customStyle="{ color: '#999' }"
|
||
@click="handleModal(true, item.id as number)"
|
||
></u-button>
|
||
<u-button
|
||
type="primary"
|
||
:text="state.scaleStatus === 0 ? '点击定价' : '点击编辑'"
|
||
@click="pricingDetail(item.id as number)"
|
||
></u-button>
|
||
</view>
|
||
</view>
|
||
</page-view>
|
||
|
||
<SmallModal
|
||
:title="'确认作废吗?'"
|
||
:content="'确认作废后,该订单不能恢复!'"
|
||
:okText="'确认作废'"
|
||
:isMain="true"
|
||
:show="isShowCancelModal"
|
||
@handleModal="(v:boolean) => {handleModal(v, deleteId)}"
|
||
@handleOk="handleOk()"
|
||
/>
|
||
</template>
|
||
<script setup lang="ts">
|
||
import { ReceiveApi } from "@/services/index";
|
||
import SmallModal from "@/components/Modal/smallModal.vue";
|
||
import PageView from "@/components/PageView/index.vue";
|
||
import { onLoad } from "@dcloudio/uni-app";
|
||
import { ScaleStatus } from "@/utils/enum";
|
||
|
||
const pageList: PageResult<Order> = reactive({
|
||
isLoading: false,
|
||
noMoreData: false,
|
||
total: 0,
|
||
list: [],
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
});
|
||
const resetPageList = () => {
|
||
pageList.noMoreData = false;
|
||
pageList.total = 0;
|
||
pageList.list = [];
|
||
pageList.pageNum = 1;
|
||
pageList.pageSize = 10;
|
||
};
|
||
const state = reactive({
|
||
scaleStatus: 0,
|
||
});
|
||
const isShowCancelModal = ref(false);
|
||
const deleteId = ref(0);
|
||
const handleModal = (v: boolean, id: number) => {
|
||
isShowCancelModal.value = v;
|
||
deleteId.value = id;
|
||
};
|
||
const handleScenePhoto = (imagesId: number) => {
|
||
uni.navigateTo({
|
||
url: `/pagesScenePhoto/index?orderType=1&id=${imagesId}&imagesType=1`, // 要跳转到的页面路径
|
||
});
|
||
};
|
||
const pricingDetail = (id: number) => {
|
||
// 待过皮的时候 编辑前先查询当前状态 若是待过皮,则可继续编辑 否则提示该数据已处理 刷新当前页面
|
||
ReceiveApi.getDetailById({ id: id }).then((res: any) => {
|
||
if (res.code === 200) {
|
||
if (res.data.scaleStatus > 1) {
|
||
uni.showToast({title : '当前订单已处理'});
|
||
resetPageList();
|
||
getList();
|
||
} else {
|
||
uni.redirectTo({
|
||
url: "/pagesReceive/form/pricingForm?id=" + id, // 要跳转到的页面路径
|
||
});
|
||
}
|
||
}
|
||
});
|
||
};
|
||
|
||
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,
|
||
scaleStatus: state.scaleStatus,
|
||
};
|
||
pageList.isLoading = true;
|
||
ReceiveApi.getOrderPage(params).then((res) => {
|
||
if (res.code === 200) {
|
||
pageList.isLoading = false;
|
||
(pageList as any).list = pageList.list.concat(res.data.list);
|
||
pageList.total = (res.data as any).total;
|
||
}
|
||
});
|
||
};
|
||
const handleOk = () => {
|
||
ReceiveApi.deleteOrder({ ids: [deleteId.value] }).then((res) => {
|
||
if (res.code === 200) {
|
||
getList();
|
||
}
|
||
});
|
||
};
|
||
|
||
onMounted(() => {
|
||
getList();
|
||
});
|
||
|
||
onLoad((option) => {
|
||
// 接收传递的标题参数
|
||
state.scaleStatus = parseInt((option as any).scaleStatus);
|
||
// 设置页面标题
|
||
if (state.scaleStatus === ScaleStatus.ToBePriced) {
|
||
uni.setNavigationBarTitle({
|
||
title: "待定价",
|
||
});
|
||
} else if (state.scaleStatus === ScaleStatus.ToBeTare) {
|
||
uni.setNavigationBarTitle({
|
||
title: "待过皮重",
|
||
});
|
||
}
|
||
});
|
||
</script>
|
||
<style lang="scss" scoped>
|
||
.card-box {
|
||
padding: 38rpx 50rpx;
|
||
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
|
||
border-radius: 13rpx;
|
||
margin: 0rpx 25rpx;
|
||
margin-top: 35rpx;
|
||
font-family: Source Han Sans CN;
|
||
font-weight: 400;
|
||
font-size: 26rpx;
|
||
color: #000000;
|
||
line-height: 41rpx;
|
||
.top-flex-box {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
.btn {
|
||
border-radius: 24rpx;
|
||
border: 1px solid #00dcee;
|
||
padding: 10rpx 30rpx;
|
||
font-weight: 500;
|
||
font-size: 24rpx;
|
||
color: #00dcee;
|
||
line-height: 41rpx;
|
||
cursor: pointer;
|
||
}
|
||
}
|
||
.address {
|
||
margin-right: 30rpx;
|
||
}
|
||
.desc {
|
||
font-size: 24rpx;
|
||
color: #999999;
|
||
margin-top: 30rpx;
|
||
display: inline-block;
|
||
}
|
||
.name {
|
||
font-size: 26rpx;
|
||
color: #000000;
|
||
font-weight: bold;
|
||
}
|
||
.flex-box {
|
||
font-weight: 400;
|
||
font-size: 26rpx;
|
||
color: #000000;
|
||
line-height: 41rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
.btn-box {
|
||
margin-top: 60rpx;
|
||
display: flex;
|
||
::v-deep button {
|
||
border-radius: 43rpx;
|
||
}
|
||
::v-deep button + button {
|
||
margin-left: 50rpx;
|
||
}
|
||
}
|
||
}
|
||
</style>
|