819527061@qq.com
2024-05-11 f73ed7862edc9c3cb78a2610486643a2fa079fde
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<template>
    <view class="order-wrap">
        <view class="order-wrap-inside">
            <view class="data-box">
                <view>
                    <u-input
                       placeholder="请选择开始日期"
                       clearable
                       disabled
                       class="dataInput"
                       v-model="startTime" 
                       :border="true" 
                       @click="startShow = true" />
                    <u-picker 
                       mode="time"
                       v-model="startShow" 
                       :params="params"
                       :safe-area-inset-bottom = "true"
                       @confirm="startConfirmBtn"
                       @cancel="cancelBtn">
                    </u-picker>
                </view>
                <view class="xian">—</view>
                <view> 
                    <u-input
                       placeholder="请选择结束日期"
                       clearable
                       disabled
                       class="dataInput"
                       v-model="endTime" 
                       :border="true" 
                       @click="endShow = true" />
                    <u-picker 
                       mode="time"
                       v-model="endShow" 
                       :params="params"
                       :safe-area-inset-bottom = "true"
                       @confirm="endConfirmBtn"
                       @cancel="cancelBtn">
                    </u-picker>
                </view>
                <u-button @click="shaixuanBtn">筛选</u-button>
            </view>
            <view class="table-box">
                <u-table>
                    <u-tr>
                        <u-th>配送时间</u-th>
                        <u-th>条数</u-th>
                        <u-th>操作</u-th>
                    </u-tr>
                    <u-tr v-if="tableList.length > 0" v-for="item in tableList" :key="item.id">
                        <u-td>{{item.sendDate}}</u-td>
                        <u-td>{{item.num}}条</u-td>
                        <u-td>
                            <u-button plain size="small" @click="gotoOrderDetail(item)">查看</u-button>
                        </u-td>
                    </u-tr>
                    <u-empty class="zanwuData" v-if="tableList.length == 0" text="暂无数据" mode="data"></u-empty>
                </u-table>
            </view>
        </view>
        <orderDetail v-if="orderDetailVisiable" ref="orderDetail" @refeshOrderDetail="refeshOrderDetail"></orderDetail>
    </view>
</template>
 
<script>
    export default {
        provide(){
            return {
                orderId: this.passData
            }
        },
        data() {
            return {
                passData: {
                    orderId:'',
                },
                tableList:[],
                params: {
                    year: true,
                    month: true,
                    day: true,
                    hour: false,
                    minute: false,
                    second: false
                },
                startTime:'',
                endTime:'',
                // pageNumber:1,
                pageSize:31,
                startShow: false,  //开始时间控件
                endShow: false,  //结束时间控件
                orderDetailVisiable:false, //详情弹框
            }
        },
        onShow() {
            this.orderDetailVisiable = false   //切换页面关闭弹框
            this.getOrderList()
        },
        onPullDownRefresh() {  //下拉刷新
            this.getOrderList()
        },
        methods: {
            refeshOrderDetail() {
                this.orderDetailVisiable = false
                this.getOrderList()
            },
            getOrderList() {  //获取订单列表
                let params = {
                    // pageNumber:this.pageNumber,
                    pageSize:this.pageSize,
                    customerId:this.$store.state.customerId,
                    endTime:this.endTime,
                    startTime:this.startTime
                }
                this.$u.api.getOrderList(params).then(res => {
                    if(res.code == 200) {
                        this.tableList = res.result
                        uni.stopPullDownRefresh()  //停止下拉刷新
                    }
                }) 
            },
            shaixuanBtn() {  //点击筛选按钮
                this.getOrderList()
            },
            startConfirmBtn(val) {  //开始
                console.log('val',val)
                this.startTime = val.year + '-' + val.month + '-' + val.day
            },
            endConfirmBtn(val) { //结束
                this.endTime = val.year + '-' +val.month + '-' +val.day
            },
            gotoOrderDetail(item) {  //跳转详情页面
               console.log('item1',item)
                this.passData.orderId = item.id
                console.log('this.passData.orderId===',this.passData.orderId)
                this.orderDetailVisiable = true
                this.$nextTick(() => {
                    this.$refs.orderDetail.init(item)
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    /deep/ .u-table{
        border-left:none!important;
    }
    /deep/ u-td:first-child {
        border-left: solid 1px #e4e7ed;
    }
    .order-wrap-inside{
        width: 100%;
        padding: 32rpx;
        box-sizing: border-box;
    }
    .orderDetail /deep/ .u-btn--default{
            border:none;
            color: #1F9F4C;
            background-color: transparent;
    }
    .order-wrap-inside{
        /deep/ .u-input{
            width: 230rpx;
            margin-right: 20rpx;
        }
        /deep/ .u-btn--default{
            border:none;
            color: #1F9F4C;
            background-color: transparent;
        }
        /deep/ .u-size-default{
            height: 64rpx!important;
            line-height: 64rpx!important;
            width: 136rpx;
            color: #1F9F4C!important;
        }
    }
    
    
    .table-box{
        /deep/.u-btn--default{
            color: none;
        }
        
        /deep/.u-hairline-border::after{
            border:none!important;
            border-style:none;
        }
        /deep/ .u-btn--default{
            font-size: 28rpx;
        }
        /deep/ .u-th{
            background-color: #1F9F4C;
            color: #FFFFFF;
            font-weight: light;
        }
    }
    .data-box{
        display: flex;
        align-items: center;
        
    }
    .xian{
        margin-right: 20rpx;
        color: #CCCCCC;
    }
    .table-box{
        margin-top: 40rpx;
    }
    .zanwuData{
        margin-top: 80rpx;
    }
</style>