订单管理

This commit is contained in:
Rhett霍 2026-02-10 16:39:04 +08:00
parent da443dc7ed
commit 6afc735e7e
7 changed files with 745 additions and 728 deletions

View File

@ -8,6 +8,16 @@ export function listsalemain(data,query) {
})
}
// 新增订单时获取货主/system/dept/productListWithUserId
export function productListWithUserId() {
return request({
url: '/system/dept/productListWithUserId',
method: 'get',
isEncrypt: false
})
}
// 查询s生产单位列表
export function listproductList(data,query) {
return request({
@ -35,6 +45,16 @@ export function getsalemaincheckAmount(queryParams) {
// isEncrypt: false
})
}
// 获取当前商业用户票扣列表
// 相当于补差
export function salemainpiAoKouList(data) {
return request({
url: '/bussiness/salemain/piAoKouLiSt',
method: 'post',
data: data,
isEncrypt: false
})
}
// 新增
export function addsalemain(data) {
return request({
@ -73,7 +93,6 @@ export function businessManagerReviewGoodsList(salemainId) {
}
// 删除
export function delsalemain(id) {
return request({

View File

@ -1,6 +1,6 @@
{
"dependencies": {
"pinia-plugin-persistedstate": "^4.5.0",
"pinia-plugin-persistedstate": "^4.7.1",
"radash": "^12.1.1"
}
}

View File

@ -740,7 +740,7 @@ const toShowBucha = () => {
.goods-header {
background: #409eff;
color: white;
padding: 10px 16px;
padding: 5px 8px;
display: flex;
align-items: center;
gap: 12px;

View File

@ -448,7 +448,7 @@ const goCancel = () => {
.goods-header {
background: #409eff;
color: white;
padding: 10px 16px;
padding: 5px 8px;
display: flex;
align-items: center;
gap: 12px;

File diff suppressed because it is too large Load Diff

View File

@ -26,8 +26,17 @@ export default {
piaokoutype: "运费补差",
shortname: "MPT20",
goodsname: "盐酸丙卡特罗片(美普清)20",
piaokou: 8.00
piaokou: 10000.01
},
{
piaokouid: 102,
goodsid: 3, // 对应盐酸丙卡特罗片(美普清)20
applydate: "2024-01-17",
piaokoutype: "运费补差",
shortname: "MPT20",
goodsname: "盐酸丙卡特罗片(美普清)20",
piaokou: 20000.02
},
{
piaokouid: 3,
goodsid: 5, // 对应瑞巴派特片(膜固思达)24

View File

@ -1,9 +1,8 @@
<template>
<view class="container">
<view class="example">
<uni-forms ref="baseForm" :modelValue="baseFormData" label-width="20vw">
<uni-forms-item label="生产单位">
<MBCard>
<uni-forms ref="baseForm" :modelValue="queryParams">
<uni-forms-item label="货主">
<uni-data-select
v-model="queryParams.CompanyId"
:clear="true"
@ -11,71 +10,44 @@
text-field="deptName"
value-field="deptId"
@change="getTableData"
/>
</uni-forms-item>
<uni-forms-item label="状态">
<uni-data-select
v-model="queryParams.state"
:clear="true"
:localdata="stateList"
@change="getTableData"
></uni-data-select>
</uni-forms-item>
<uni-forms-item label="合同编号">
<input
v-model="queryParams.contractcode"
class="uni-input custom-input"
placeholder="请输入合同编号"
@confirm="getTableData"/>
</uni-forms-item>
<!-- <uni-forms-item label="合同编号" >
<view class="uni-form-item uni-column">
<input class="uni-input" focus placeholder="自动获得焦点" />
</view>
</uni-forms-item> -->
<uni-forms-item label="状态">
<uni-data-select
v-model="queryParams.state"
:clear="true"
:localdata="stateList"
@change="getTableData"
></uni-data-select>
</uni-forms-item>
<uni-forms-item label="合同编号">
<input
v-model="queryParams.contractcode"
class="uni-input custom-input"
placeholder="请输入合同编号"
@confirm="getTableData"/>
</uni-forms-item>
</uni-forms>
<button type="primary" @click="gotoNewAdd">新增</button>
</view>
<view v-if="filteredContracts.length === 0" class="no-data">
<text>暂无匹配的合同数据</text>
</view>
<button
type="primary"
@click="gotoNewAdd"
v-if="userType === '01' || userType === '02'"
>
新增
</button>
</MBCard>
<MBLoading v-if="loading"/>
<view v-else>
<uni-card
v-for="(contract, index) in filteredContracts"
:key="contract.saleid"
:class="index % 2 === 0 ? 'card-even' : 'card-odd'"
:title="contract.usernames"
@click="gotoDetail(contract)"
>
<uni-row class="demo-uni-row">
<uni-col :span="12">
<view class="demo-uni-col dark">生产单位: {{ contract.companyName }}</view>
</uni-col>
<uni-col :span="12">
<view class="demo-uni-col light">合同编号: {{ contract.contractcode }}</view>
</uni-col>
</uni-row>
<uni-row class="demo-uni-row">
<uni-col :span="12">
<view class="demo-uni-col dark">制单日期: {{ formatDate(contract.adddate) }}</view>
</uni-col>
<uni-col :span="12">
<view class="demo-uni-col light">订单金额: {{ contract.contractmoney.toFixed(2) }}</view>
</uni-col>
</uni-row>
<uni-row class="demo-uni-row">
<uni-col :span="12">
<view class="demo-uni-col dark">状态: {{ contract.stateText }}</view>
</uni-col>
<uni-col :span="12" style="display: flex;">
<view class="demo-uni-col light">订单类型:</view>
<dict-tag :options="orderTypeList" :value="contract.type" style="color: red;"/>
</uni-col>
</uni-row>
</uni-card>
<ListItem :items="tableData" />
<MBPagination
v-if="total > 0"
v-model:limit="paging.pageSize"
v-model:page="paging.pageNum"
:total="total"
@pagination="handleQuery"
/>
</view>
</view>
</template>
@ -84,9 +56,17 @@
import {listproductList, listsalemain} from "../../../api/orderManager/index.js"
import {computed, getCurrentInstance, onMounted, ref} from "vue"
import {getDicts} from "../../../api/system/dict/data.js"
// import DictTag from '@/components/dict-tag/dict-tag.vue';
import {useOrderManagerStore} from "../../../store/modules/orderManager.js"
// import { log } from "console"
import MBCard from "../../../components/MB/MBCard.vue";
import MBPagination from "../../../components/MB/MBPagination.vue";
import MBLoading from "../../../components/MB/MBLoading.vue";
import ListItem from "./ListItem.vue";
import { getUserProfile } from "@/api/system/user"
const userType = ref()
const {proxy} = getCurrentInstance()
//
const baseFormData = ref({})
@ -94,11 +74,15 @@ const baseFormData = ref({})
const orderTypeList = ref([])
const paymentValue = ref(0)
const companyValue = ref(0)
//
const loading = ref(true)
const total = ref(0)
const paging = ref({
//
pageNum: 1,
//
pageSize: 999,
pageSize: 2,
isAsc: 'descending',
orderByColumn: 'adddate'
})
@ -107,47 +91,30 @@ const queryParams = ref({
state: "0,1,-1,2,-2,3,-3,9,10,11,12,-12,13,-13,14,15,16",
}
})
//
// const stateList = ref([
// { value: '0', text: "" },
// { value: '1', text: "" },
// { value: '-1', text: "退" },
// { value: '2', text: "" },
// { value: '-2', text: "退" },
// { value:'3', text: "" },
// { value: '-3', text: "退" },
// { value: '9', text: "" },
// { value: '10', text: "" },
// { value: '11', text: "" },
// ])
const stateList = ref([])
const companyOptions = ref([])
//
const contracts = ref([])
//
const filteredContracts = computed(() => {
let result = contracts.value
//
if (companyValue.value === 1) {
result = result.filter(contract => contract.companyName.includes('浙江'))
} else if (companyValue.value === 2) {
result = result.filter(contract => contract.companyName.includes('广东'))
}
//
return result
})
const tableData = ref([])
//
onMounted(() => {
getDictData()
getTableData()
getDeptLists()
onMounted(async () => {
try {
loading.value = true
await getDictData()
await getDeptLists()
await getUser()
await getTableData()
} finally {
loading.value = false
}
})
function getUser() {
getUserProfile().then(response => {
userType.value = response.data.userType
})
}
//
function formatDate(dateString) {
@ -156,49 +123,55 @@ function formatDate(dateString) {
}
//
const getDictData = () => {
getDicts("order_state").then(res => {
console.log('order_state', res.data)
stateList.value = res.data.map(item => {
const getDictData = async () => {
try {
const [stateRes, typeRes] = await Promise.all([
getDicts("order_state"),
getDicts("dazhong_dingdan_type")
])
stateList.value = stateRes.data.map(item => {
return {
value: item.dictValue,
text: item.dictLabel
}
})
})
getDicts("dazhong_dingdan_type").then(res => {
console.log('dazhong_dingdan_type', res.data)
orderTypeList.value = res.data
})
orderTypeList.value = typeRes.data
} catch (error) {
console.error('获取字典数据失败:', error)
}
}
//
const getTableData = () => {
console.log(queryParams.value)
listsalemain(queryParams.value, paging.value).then(res => {
contracts.value = res.rows
// total.value = res.total;
});
const getTableData = async () => {
try {
loading.value = true
const data = await listsalemain(queryParams.value, paging.value)
total.value = data.total
tableData.value = data.rows
} catch (error) {
console.error('获取数据失败:', error)
} finally {
loading.value = false
}
}
const getDeptLists = () => {
listproductList().then(res => {
const getDeptLists = async () => {
try {
const res = await listproductList()
companyOptions.value = res.data.map(item => {
return {
value: item.deptId,
text: item.deptName
}
})
console.log('companyOptions.value', companyOptions.value)
});
} catch (error) {
console.error('获取部门列表失败:', error)
}
}
//
function filterContracts(e) {
function filtertableData(e) {
console.log("筛选条件变化:", e)
//
}
@ -211,9 +184,6 @@ const handleInput = (e) => {
//
function gotoDetail(contract) {
console.log("查看合同详情:", contract)
// proxy.$tab.navigateTo('/pages/work/yonghu/detail')
// proxy.$tab.navigateTo(`/pages/work/yonghu/detail?saleid=${contract.saleid}`)
// proxy.$tab.navigateTo('pages/work/OrderManager/OrderDetail')
//pinia
useOrderManagerStore().addOrder(contract)
console.log('数据', useOrderManagerStore().orders)
@ -226,7 +196,6 @@ function gotoDetail(contract) {
url: "/pages/work/OrderManager/components/LookData"
});
}
}
const gotoNewAdd = () => {
@ -234,14 +203,43 @@ const gotoNewAdd = () => {
url: "/pages/work/OrderManager/components/NewAdd"
});
}
const handleQuery = async () => {
try {
loading.value = true
const data = await listsalemain(queryParams.value, paging.value)
total.value = data.total
tableData.value = data.rows
} catch (error) {
console.error('获取数据失败:', error)
} finally {
loading.value = false
}
}
</script>
<style lang="scss" scoped>
/* 加载动画容器 */
.loading-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 40px 0;
min-height: 300px;
}
.loading-text {
margin-top: 10px;
color: #666;
font-size: 14px;
}
.custom-input {
border: 1px solid #ccc;
border-radius: 4px;
padding: 5px;
height: 35px;
font-size: 12px;
}
.container {