freight-web/src/pagesReceive/payReview.vue

365 lines
8.8 KiB
Vue
Raw Normal View History

2024-03-04 07:10:11 +00:00
<template>
<view class="search">
<view v-if="!isShowSearch" @click="isShowSearch = true">
<u-icon color="#C1C1C1" name="search"></u-icon
><text>请输入供应商名称</text>
</view>
<u-search
v-else
placeholder="请输入供应商名称"
v-model="keyword"
:focus="true"
bgColor="#fff"
:clearabled="true"
:showAction="false"
placeholderColor="#C1C1C1"
2024-03-25 06:19:03 +00:00
@search="handleSearch()"
2024-03-04 07:10:11 +00:00
></u-search>
</view>
<view class="card-box">
<view class="c-tab">
<text
v-for="(item, index) in tabList"
:key="index"
2024-03-09 12:37:17 +00:00
:class="{ active: currentTab === item.key }"
2024-03-04 07:10:11 +00:00
@click="handleTab(item)"
>
{{ item.name }}
</text>
</view>
2024-03-22 05:45:34 +00:00
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="ScaleStatus.Paid === currentTab ? 160 : 240 "
:isLoading="pageList.isLoading"
>
<block v-for="(item, index) in pageList.list" :key="index">
<view class="c-layout">
<view style="min-width: 20px;">
<checkbox
v-if="
ScaleStatus.ToBeReview === currentTab ||
ScaleStatus.ToBePay === currentTab
"
value="cb"
:color="'#00D2E3'"
:checked="item.isChecked"
style="transform: scale(0.5)"
@click="item.isChecked = !item.isChecked"
/></view>
<view class="inner-box">
<view class="top-flex-box">
2024-03-05 06:00:47 +00:00
<view>
2024-03-22 05:45:34 +00:00
<view>
<text class="number">收货单号{{ item.receiptNumber }}</text>
</view>
<view>
<text class="name">{{ item.userName }}</text>
</view>
2024-03-05 06:00:47 +00:00
</view>
2024-03-04 07:10:11 +00:00
</view>
2024-03-22 05:45:34 +00:00
<view class="bottom-flex-box">
2024-03-05 06:00:47 +00:00
<view>
2024-03-22 05:45:34 +00:00
<view>
<text class="desc"
>过磅总净重{{ item.netWeight || 0 }}KG</text
>
</view>
<view class="flex-box">
<text>货款金额{{ item.balanceTotalPrice || 0 }}</text>
</view>
2024-03-05 06:00:47 +00:00
</view>
2024-03-22 05:45:34 +00:00
<view>
<text class="btn">
<text
v-if="currentTab === 2"
@click="handleReview(item.id as number, 2, '去审核')"
>去审核</text
>
<text
v-if="currentTab === 3"
@click="handleReview(item.id as number, 3, '去支付')"
>去支付</text
>
<text
v-if="currentTab === 4"
@click="handleReview(item.id as number, 4, '查看详情')"
>查看</text
>
</text>
2024-03-05 06:00:47 +00:00
</view>
2024-03-04 07:10:11 +00:00
</view>
</view>
</view>
2024-03-22 05:45:34 +00:00
<u-gap
height="10"
bgColor="#f8f8f8"
v-if="index < pageList.list.length - 1"
></u-gap>
</block>
</page-view>
2024-03-04 07:10:11 +00:00
</view>
2024-03-22 05:45:34 +00:00
<view
class="btn-box"
v-if="(currentTab === 2 || currentTab === 3) && pageList.list.length > 0"
>
2024-03-04 07:10:11 +00:00
<u-button
text="全选/取消"
color="#fff"
:customStyle="{ color: '#00DCEE', border: '1px solid #00DCEE' }"
2024-03-09 12:37:17 +00:00
@click="handleSelect"
2024-03-04 07:10:11 +00:00
></u-button>
2024-03-22 05:45:34 +00:00
<u-button
type="primary"
:text="`${currentTab === 2 ? '批量审核' : '批量支付'}`"
@click="handleReviewOrPay(currentTab)"
></u-button>
2024-03-04 07:10:11 +00:00
</view>
</template>
<script setup lang="ts">
2024-03-09 12:37:17 +00:00
import { ReceiveApi } from "@/services/index";
import { onLoad } from "@dcloudio/uni-app";
2024-03-22 05:45:34 +00:00
import PageView from "@/components/PageView/index.vue";
import { ScaleStatus } from "@/utils/enum";
2024-03-09 12:37:17 +00:00
// scaleStatus
const pageList: PageResult<Order> = reactive({
2024-03-22 05:45:34 +00:00
isLoading: false,
noMoreData: false,
2024-03-09 12:37:17 +00:00
total: 0,
list: [],
pageNum: 1,
pageSize: 10,
});
2024-03-25 06:19:03 +00:00
const keyword = ref('');
2024-03-04 07:10:11 +00:00
const isShowSearch = ref(false);
2024-03-09 12:37:17 +00:00
const state = reactive<{
[attrName: string]: any;
}>({
isAll: false,
});
2024-03-04 07:10:11 +00:00
const tabList = reactive([
{
name: "等待审核",
2024-03-09 12:37:17 +00:00
key: 2,
2024-03-04 07:10:11 +00:00
},
{
name: "已审未付",
2024-03-09 12:37:17 +00:00
key: 3,
2024-03-04 07:10:11 +00:00
},
{
name: "已审已付",
2024-03-09 12:37:17 +00:00
key: 4,
2024-03-04 07:10:11 +00:00
},
]);
2024-03-22 05:45:34 +00:00
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 10;
};
2024-03-09 12:37:17 +00:00
const currentTab = ref(2);
2024-03-04 07:10:11 +00:00
const handleTab = (item: any) => {
2024-03-09 12:37:17 +00:00
currentTab.value = item.key;
2024-03-22 05:45:34 +00:00
resetPageList();
getList();
2024-03-04 07:10:11 +00:00
};
2024-03-25 06:19:03 +00:00
const handleSearch = () => {
resetPageList();
getList();
}
2024-03-22 05:45:34 +00:00
const handleReview = (id: number, scaleStatus: number, title: string) => {
2024-03-05 06:00:47 +00:00
uni.navigateTo({
2024-03-22 05:45:34 +00:00
url:
"/pagesReceive/review/index?id=" +
id +
`&scaleStatus=` +
scaleStatus +
`&title=${title}`, // 要跳转到的页面路径
});
};
const handleReviewOrPay = (status: number) => {
// 批量审核
if (ScaleStatus.ToBeReview === status) {
updateStatus(ScaleStatus.ToBePay);
} else if (ScaleStatus.ToBePay === status) {
// 批量支付
updateStatus(ScaleStatus.Paid);
}
};
const updateStatus = (status: number) => {
const list = pageList.list
.filter((item) => item.isChecked)
.map((item) => {
return { ...item, scaleStatus: status };
});
ReceiveApi.updateOrderIn({ orderInPos: list }).then((res) => {
if (res.code === 200) {
resetPageList();
getList();
}
2024-03-05 06:00:47 +00:00
});
};
2024-03-09 12:37:17 +00:00
const handleSelect = () => {
state.isAll = !state.isAll;
2024-03-22 05:45:34 +00:00
console.log(state.isAll);
pageList.list = pageList.list.map((item) => {
return { ...item, isChecked: state.isAll };
2024-03-09 12:37:17 +00:00
});
};
2024-03-25 06:19:03 +00:00
2024-03-22 05:45:34 +00:00
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
2024-03-25 06:19:03 +00:00
pageList.isLoading = true;
2024-03-22 05:45:34 +00:00
ReceiveApi.getOrderPage({
pageSize: pageList.pageSize,
pageNumber: pageList.pageNum,
scaleStatus: currentTab.value,
2024-03-25 06:19:03 +00:00
userName: keyword.value
2024-03-22 05:45:34 +00:00
}).then((res) => {
if (res.code === 200) {
(pageList as any).list = (res.data.list as any).map((item: any) => {
return { ...item, isChecked: false };
});
pageList.total = (res.data as any).total;
2024-03-25 06:19:03 +00:00
pageList.isLoading = false;
2024-03-09 12:37:17 +00:00
}
2024-03-22 05:45:34 +00:00
});
2024-03-09 12:37:17 +00:00
};
onMounted(() => {
2024-03-22 05:45:34 +00:00
getList();
2024-03-09 12:37:17 +00:00
});
onLoad((option) => {
currentTab.value = parseInt((option as any).scaleStatus);
2024-03-22 05:45:34 +00:00
});
2024-03-04 07:10:11 +00:00
</script>
<style lang="scss" scoped>
.search {
box-shadow: 0rpx 3rpx 16rpx 5rpx rgba(0, 0, 0, 0.2);
border-radius: 28rpx;
background: rgba(255, 255, 255, 0.86);
width: 80%;
margin: 0px auto;
margin-top: 30rpx;
font-weight: 400;
2024-03-09 12:37:17 +00:00
font-size: 26rpx;
2024-03-04 07:10:11 +00:00
color: #c1c1c1;
> view {
line-height: 60rpx;
text-align: center;
display: flex;
justify-content: center;
}
text {
margin-left: 15rpx;
}
}
.card-box {
.c-tab {
font-family: Source Han Sans CN;
font-weight: 400;
2024-03-09 12:37:17 +00:00
font-size: 26rpx;
2024-03-04 07:10:11 +00:00
color: #999999;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-around;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
text {
padding: 16rpx;
}
.active {
color: $u-primary;
border-bottom: 5rpx solid $u-primary;
border-radius: 5rpx;
}
}
2024-03-05 06:00:47 +00:00
.c-layout {
display: flex;
justify-content: space-between;
padding: 30rpx 25rpx 30rpx 0rpx;
}
2024-03-04 07:10:11 +00:00
.inner-box {
2024-03-05 06:00:47 +00:00
width: 100%;
// padding: 40rpx 40rpx;
2024-03-04 07:10:11 +00:00
.bottom-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;
}
}
}
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;
2024-03-09 12:37:17 +00:00
font-size: 26rpx;
2024-03-04 07:10:11 +00:00
color: #000000;
line-height: 41rpx;
.desc {
2024-03-09 12:37:17 +00:00
font-size: 24rpx;
2024-03-04 07:10:11 +00:00
color: #999999;
margin-top: 30rpx;
display: inline-block;
}
.name {
2024-03-09 12:37:17 +00:00
font-size: 26rpx;
2024-03-04 07:10:11 +00:00
color: #000000;
2024-03-09 12:37:17 +00:00
font-weight: bold;
2024-03-04 07:10:11 +00:00
}
.flex-box {
2024-03-09 12:37:17 +00:00
font-weight: bold;
2024-03-04 07:10:11 +00:00
color: #000000;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
}
.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;
2024-03-13 02:41:39 +00:00
position: fixed;
2024-03-04 07:10:11 +00:00
bottom: 0rpx;
width: calc(100vw - 100rpx);
::v-deep button {
border-radius: 43rpx;
}
::v-deep button + button {
margin-left: 50rpx;
}
}
</style>