guoyujie
2025-10-13 a3ef00def72882e9f28f2813a861c477220dab2d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<script setup>
import {onMounted, reactive, ref} from "vue";
import request from "@/utils/request.js";
import userInfo from '@/stores/userInfo'
import footSum from "@/hook/footSum";
import OrderDetailView from "@/views/order/OrderDetailView.vue";
 
const user=userInfo()
const value = ref(["",""])
const xGrid = ref()
const dialogVisible = ref(false)
const checkOrderId = ref(null)
const gridOptions = reactive({
  loading:false,
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {height: 30,isCurrent:true},//鼠标移动或选择高亮
  id: 'OrderReport',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    remote: true
  },
  customConfig: {
    storage: true
  },
  columns:[
    {field: 'orderId',minWidth:120, title: '订单编号'},
    {field: 'project',minWidth:120, title: '项目名称'},
    {field: 'quantity',minWidth:120, title: '数量'},
    {field: 'area',minWidth:120, title: '结算面积'},
    {field: 'money',minWidth:120, title: '总金额'},
    {field: 'createTime',minWidth:120, title: '下单日期'},
    {field: 'deliveryDate',minWidth:120, title: '发货日期'},
    {field: 'contacts',minWidth:120, title: '联系人 '},
    {field: 'contactNumber',minWidth:120, title: '联系电话'},
    {field: 'deliveryAddress',minWidth:120, title: '送货地址'}
 
  ],//表头按钮
  toolbarConfig: {
    buttons: [],
    slots: {
      buttons: "toolbaruttons"
    }
  },
  data:  [
  ],//table body实际数据
  footerMethod ({ columns, data }) {//页脚函数
    const list = ['quantity', 'area', 'money']
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '合计'
        }
        if (list.includes(column.field)) {
          return footSum(data, column.field)
        }
        return ''
      })
    ]
  }
 
})
const gridEvents = {
  cellClick({ row }){
    dialogVisible.value = true
    checkOrderId.value = row.orderId
  }
}
 
onMounted(()=>{
  getOrderHistory()
})
const getOrderHistory = () => {
  const params = {
    customerId:user.user.customerId,
    searchDate:value.value
  }
  request.post('/order/getFinishedOrder',params).then(res=>{
    if (res.code === 200) {
      xGrid.value.reloadData(res.data.orders)
      value.value = res.data.searchDate
    }
  })
}
 
const sumNum = (list, field) => {
  let count = 0
  list.forEach(item => {
    count += Number(item[field])
  })
  return count.toFixed(2)
}
</script>
 
<template>
  <div class="page" >
 
    <vxe-grid
        @filter-change="filterChanged"
        height="100%"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
    >
      <template #toolbaruttons>
        <el-date-picker
            @change="getOrderHistory"
            v-model="value"
            type="daterange"
            start-placeholder=""
            end-placeholder=""
            value-format="YYYY-MM-DD"
        />
      </template>
 
    </vxe-grid>
 
    <el-dialog v-model="dialogVisible" fullscreen>
      <template #header>
        <el-text size="large" style="font-weight: bolder">详情</el-text>
      </template>
      <order-detail-view
          :orderId = "checkOrderId"/>
    </el-dialog>
 
  </div>
</template>
 
<style scoped>
.page{
  width: 100%;
  height:calc(100vh - 5.5rem);
}
:deep(.el-dialog__body){
  height: 90vh;
  width: 100%;
}
</style>