diff --git a/pages/work/BusinessApproval/ListItem.vue b/pages/work/BusinessApproval/ListItem.vue index 2d44b30..cf51413 100644 --- a/pages/work/BusinessApproval/ListItem.vue +++ b/pages/work/BusinessApproval/ListItem.vue @@ -4,41 +4,62 @@ :key="item.saleid" :class="index % 2 === 0 ? 'card-even' : 'card-odd'" :extra="item.contractcode" - :title="item.usernames" + :title="`${index+1}、${item.usernames}`" style="margin: 0;margin-bottom: 20px" @click="handleDetail(item)" > + + - 状态: - {{ item.stateText }} - - - 制单日期: - {{ formatDate(item.adddate) }} + 货主: + {{ item.companyName }} + + + + + + + + 订单金额: {{ item.contractmoney.toFixed(2) }} - - 区域: - {{ item.areaName }} - + + + + \ No newline at end of file diff --git a/pages/work/BusinessApproval/index.vue b/pages/work/BusinessApproval/index.vue index 7579e56..5b965f8 100644 --- a/pages/work/BusinessApproval/index.vue +++ b/pages/work/BusinessApproval/index.vue @@ -1,10 +1,13 @@ @@ -37,13 +95,10 @@ import {getCurrentInstance, onMounted, ref} from "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 DictSelect from "../../../components/DictSelect/DictSelect.vue"; import ProductionUnit from "../../../components/ProductionUnit/ProductionUnit.vue"; import MBCard from "../../../components/MB/MBCard.vue"; -import {mangerList} from "../../../api/BusinessApproval"; -import MBPagination from "../../../components/MB/MBPagination.vue"; +import {managerConfirm, managerRefuse, mangerList} from "../../../api/BusinessApproval"; import MBLoading from "../../../components/MB/MBLoading.vue"; -import ListItem from "./ListItem.vue"; const {proxy} = getCurrentInstance() @@ -56,13 +111,16 @@ const loading = ref(true) const total = ref(0) const paging = ref({ pageNum: 1, - pageSize: 10, + pageSize: 99999, isAsc: 'descending', orderByColumn: 'adddate' }) const tableData = ref([]) +const submitLoading = ref(false) const handleQuery = async () => { + selected.value = [] + totalMoney.value = 0 loading.value = true const data = await mangerList(queryParams.value, paging.value) total.value = data.total @@ -70,9 +128,118 @@ const handleQuery = async () => { 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 () => { 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 +}