合并后提交

This commit is contained in:
Rhett霍 2026-03-09 08:37:55 +08:00
commit 0f7e77fc8d
2 changed files with 227 additions and 29 deletions

View File

@ -4,41 +4,62 @@
:key="item.saleid" :key="item.saleid"
:class="index % 2 === 0 ? 'card-even' : 'card-odd'" :class="index % 2 === 0 ? 'card-even' : 'card-odd'"
:extra="item.contractcode" :extra="item.contractcode"
:title="item.usernames" :title="`${index+1}、${item.usernames}`"
style="margin: 0;margin-bottom: 20px" style="margin: 0;margin-bottom: 20px"
@click="handleDetail(item)" @click="handleDetail(item)"
> >
<template v-slot:title>
<view
style="display: flex;align-items: center;font-size: 15px;padding: 10px 0;border-bottom: 1px #EBEEF5 solid;">
<view style="flex: 1;display: flex;align-items: center;gap:12px">
<table-checkbox :cell-data="item" @checkboxSelected="handleCheck"/>
<text>{{ index + 1 }}</text>
<text>{{ item.usernames }}</text>
</view>
<view>
<text style="font-size:12px; color:#909399;">{{ item.contractcode }}</text>
</view>
</view>
</template>
<view class="context"> <view class="context">
<view class="label"> <view class="label">
<text>状态:</text> <text>货主:</text>
<text>{{ item.stateText }}</text> <text>{{ item.companyName }}</text>
</view>
<view class="label">
<text>制单日期:</text>
<text>{{ formatDate(item.adddate) }}</text>
</view> </view>
<!-- <view class="label">-->
<!-- <text>状态:</text>-->
<!-- <text>{{ item.stateText }}</text>-->
<!-- </view>-->
<!-- <view class="label">-->
<!-- <text>制单日期:</text>-->
<!-- <text>{{ formatDate(item.adddate) }}</text>-->
<!-- </view>-->
<view class="label"> <view class="label">
<text>订单金额:</text> <text>订单金额:</text>
<text>{{ item.contractmoney.toFixed(2) }}</text> <text>{{ item.contractmoney.toFixed(2) }}</text>
</view> </view>
<view class="label"> <!-- <view class="label">-->
<text>区域:</text> <!-- <text>区域:</text>-->
<text>{{ item.areaName }}</text> <!-- <text>{{ item.areaName }}</text>-->
</view> <!-- </view>-->
</view> </view>
</uni-card> </uni-card>
</template> </template>
<script setup> <script setup>
import {defineOptions, defineProps, getCurrentInstance} from 'vue' import {defineEmits, defineOptions, defineProps, getCurrentInstance} from 'vue'
import UniCard from "../../../uni_modules/uni-card/components/uni-card/uni-card.vue"; import UniCard from "../../../uni_modules/uni-card/components/uni-card/uni-card.vue";
import {formatDate} from "../../../uni_modules/uni-dateformat/components/uni-dateformat/date-format"; import {formatDate} from "../../../uni_modules/uni-dateformat/components/uni-dateformat/date-format";
import TableCheckbox from "../../../uni_modules/uni-table/components/uni-tr/table-checkbox.vue";
defineOptions({ defineOptions({
name: 'ListItem' name: 'ListItem'
}) })
const emit = defineEmits(['checkboxSelected'])
const {proxy} = getCurrentInstance() const {proxy} = getCurrentInstance()
const props = defineProps(['items']) const props = defineProps(['items'])
@ -46,7 +67,17 @@ const props = defineProps(['items'])
const handleDetail = (raw) => { const handleDetail = (raw) => {
proxy.$tab.navigateTo(`/pages/work/BusinessApproval/OrderDetail?id=${raw.saleid}`) proxy.$tab.navigateTo(`/pages/work/BusinessApproval/OrderDetail?id=${raw.saleid}`)
} }
const handleCheck = (e) => {
emit('checkboxSelected', e)
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep() {
.uni-table-checkbox {
display: flex;
justify-content: flex-start;
}
}
</style> </style>

View File

@ -1,10 +1,13 @@
<template> <template>
<view class="container"> <MBLoading
v-if="submitLoading"
style="position: absolute;display: block;z-index: 9999;background: rgb(0 0 0 / 14%);inset: 0px;overflow: hidden;margin: 0;height: 100svh;"/>
<view ref="targetRef" class="container">
<MBCard> <MBCard>
<uni-forms ref="baseForm" :modelValue="queryParams"> <uni-forms ref="baseForm" :modelValue="queryParams">
<uni-forms-item label="支付方式"> <!-- <uni-forms-item label="支付方式">-->
<DictSelect v-model="queryParams.isPayNow" dict="dazhong_paytype" @change="handleQuery"/> <!-- <DictSelect v-model="queryParams.isPayNow" dict="dazhong_paytype" @change="handleQuery"/>-->
</uni-forms-item> <!-- </uni-forms-item>-->
<uni-forms-item label="货主"> <uni-forms-item label="货主">
<ProductionUnit v-model="queryParams.companyId" @change="handleQuery"/> <ProductionUnit v-model="queryParams.companyId" @change="handleQuery"/>
</uni-forms-item> </uni-forms-item>
@ -13,7 +16,62 @@
<MBLoading v-if="loading"/> <MBLoading v-if="loading"/>
<view v-else> <view v-else>
<ListItem v-if="tableData.length > 0" :items="tableData"/> <MBCard v-if="selected.length>0" :style="{
position: 'fixed',
zIndex : 10,
width:'100%',
left: 0,
bottom: 0,
height:'110px'
}
">
<view class="context">
<view class="label">
<text>已选订单数量:</text>
<text>{{ selected.length }}</text>
</view>
<view class="label">
<text>已选订单总金额:</text>
<text>{{ totalMoney.toFixed(2) }}</text>
</view>
</view>
<view :style="{
display:'flex',
marginTop:'15px',
justifyContent:'space-between',
alignItems:'center'
}">
<button class="mini-btn" size="mini" type="success" @click="handleBack">回退</button>
<button class="mini-btn" size="mini" type="primary" @click="handleSubmit">审核</button>
</view>
</MBCard>
<uni-table
v-if="tableData.length > 0"
ref="table"
:loading="loading"
border
emptyText="暂无更多数据"
stripe
type="selection"
@selection-change="selectionChange"
>
<uni-tr>
<uni-th align="center" width="50">序号</uni-th>
<uni-th align="center" width="60">商业公司</uni-th>
<uni-th align="center" width="50">货主</uni-th>
<uni-th align="center" width="60">合同编号</uni-th>
<uni-th align="center" width="60">订单金额</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td align="center">{{ index + 1 }}</uni-td>
<uni-td>{{ item.businessCompany }}</uni-td>
<uni-td align="center">{{ item.companyName }}</uni-td>
<uni-td>{{ item.contractcode }}</uni-td>
<uni-td>{{ item.contractmoney.toFixed(2) }}</uni-td>
</uni-tr>
</uni-table>
<!-- <ListItem v-if="tableData.length > 0" :items="tableData" @checkboxSelected="handleSelect"/>-->
<uni-load-more <uni-load-more
v-else v-else
:contentText="{ :contentText="{
@ -21,13 +79,13 @@
}" }"
:status="'no-more'" :status="'no-more'"
/> />
<MBPagination <!-- <MBPagination-->
v-if="total > 0" <!-- v-if="total > 0"-->
v-model:limit="paging.pageSize" <!-- v-model:limit="paging.pageSize"-->
v-model:page="paging.pageNum" <!-- v-model:page="paging.pageNum"-->
:total="total" <!-- :total="total"-->
@pagination="handleQuery" <!-- @pagination="handleQuery"-->
/> <!-- />-->
</view> </view>
</view> </view>
</template> </template>
@ -37,13 +95,10 @@
import {getCurrentInstance, onMounted, ref} from "vue" import {getCurrentInstance, onMounted, ref} from "vue"
import UniForms from "../../../uni_modules/uni-forms/components/uni-forms/uni-forms.vue"; import UniForms from "../../../uni_modules/uni-forms/components/uni-forms/uni-forms.vue";
import UniFormsItem from "../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue"; import UniFormsItem from "../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue";
import DictSelect from "../../../components/DictSelect/DictSelect.vue";
import ProductionUnit from "../../../components/ProductionUnit/ProductionUnit.vue"; import ProductionUnit from "../../../components/ProductionUnit/ProductionUnit.vue";
import MBCard from "../../../components/MB/MBCard.vue"; import MBCard from "../../../components/MB/MBCard.vue";
import {mangerList} from "../../../api/BusinessApproval"; import {managerConfirm, managerRefuse, mangerList} from "../../../api/BusinessApproval";
import MBPagination from "../../../components/MB/MBPagination.vue";
import MBLoading from "../../../components/MB/MBLoading.vue"; import MBLoading from "../../../components/MB/MBLoading.vue";
import ListItem from "./ListItem.vue";
const {proxy} = getCurrentInstance() const {proxy} = getCurrentInstance()
@ -56,13 +111,16 @@ const loading = ref(true)
const total = ref(0) const total = ref(0)
const paging = ref({ const paging = ref({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 99999,
isAsc: 'descending', isAsc: 'descending',
orderByColumn: 'adddate' orderByColumn: 'adddate'
}) })
const tableData = ref([]) const tableData = ref([])
const submitLoading = ref(false)
const handleQuery = async () => { const handleQuery = async () => {
selected.value = []
totalMoney.value = 0
loading.value = true loading.value = true
const data = await mangerList(queryParams.value, paging.value) const data = await mangerList(queryParams.value, paging.value)
total.value = data.total total.value = data.total
@ -70,9 +128,118 @@ const handleQuery = async () => {
loading.value = false loading.value = false
} }
const selected = ref([])
const totalMoney = ref(0)
const popup = ref()
// const handleSelect = (payload) => {
// const {checked, data} = payload
// const id = data.saleid
//
// if (checked) {
// if (!selected.value.includes(id)) {
// selected.value.push(id)
// }
// } else {
// selected.value = selected.value.filter(item => item !== id)
// }
//
// totalMoney.value = tableData.value.filter(item => selected.value.includes(item.saleid))
// .map(i => i.contractmoney)
// .reduce((a, b) => a + b, 0)
// ?? 0
//
// }
onMounted(async () => { onMounted(async () => {
await handleQuery() await handleQuery()
}) })
const handleBack = async () => {
uni.showModal({
title: '提示',
content: '是否要进行回退?',
success: async function (res) {
if (res.confirm) {
uni.showLoading({
title: '加载中'
});
await Promise.allSettled(
selected.value.map(id =>
managerRefuse({
saleIds: id,
actionType: new Date().getDate() < 25 ? '1' : '0'
})
)
)
selected.value = []
totalMoney.value = 0
await handleQuery()
uni.showToast({
title: '操作成功',
icon: 'none',
duration: 2000
});
uni.hideLoading()
} else if (res.cancel) {
uni.showToast({
title: '用户取消操作',
icon: 'none',
duration: 2000
});
}
}
});
}
const handleSubmit = async () => {
uni.showModal({
title: '提示',
content: '是否要进行审核?',
success: async function (res) {
if (res.confirm) {
uni.showLoading({
title: '加载中'
});
await Promise.allSettled(
selected.value.map(id =>
managerConfirm({
saleIds: id,
actionType: new Date().getDate() < 25 ? '1' : '0'
})
)
)
selected.value = []
totalMoney.value = 0
await handleQuery()
uni.showToast({
title: '操作成功',
icon: 'none',
duration: 2000
});
uni.hideLoading()
} else if (res.cancel) {
uni.showToast({
title: '用户取消操作',
icon: 'none',
duration: 2000
});
}
}
});
}
const selectionChange = (payload) => {
const indexSet = new Set(payload.detail.index)
const filterData = tableData.value.filter((_, i) => indexSet.has(i))
selected.value = filterData.map(item => item.saleid)
totalMoney.value = filterData.map(item => item.contractmoney).reduce((a, b) => a + b, 0) ?? 0
}
</script> </script>