#
whycq
2024-12-04 e815bda1b6c2e6202dc3683064b7bce8785b8d9d
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
<template>
    <view>
        <view class="code">
            <uni-search-bar :focus="searchValueFocus" v-model="searchValue" 
                maxlength="500" ancel="cancel" @confirm="searchValueInput2()" @clear="clear" placeholder="输入 / 扫描 订单号">
            </uni-search-bar>
            <view class="list" v-for="(item,index) in dataList">
                <view class="list-left">
                    <view >
                        <text style="">单据编号:</text>
                        <text style="font-size: 18px;font-weight: 600;color: #333;">{{item.orderNo}}</text>
                    </view>
                    <view>类型:{{item.docType$}}</view>
                    <view>创建时间:{{item.createTime$}}</view>
                </view>
                <view class="list-right" @click="toDetls(index)">
                    <uni-icons type="right" size="25"  color="#55aaff"></uni-icons>
                </view>
            </view>
        </view>
        <view style="height: 20px;"></view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                searchValue: '',
                searchValueFocus: false,
                dataList: [],
                data: {
                    curr: 1,
                    limit: 10,
                    order_no: '',
                    
                }
            }
        },
        onShow() {
            this.baseUrl = uni.getStorageSync('baseUrl');
            this.token = uni.getStorageSync('token');
            this.getOrder()
        },
        // 下拉刷新
        onReachBottom() {
            this.status = 'more';
            this.getOrder(this.searchValue,10);
        },
        methods: {
            getOrder(threeCode,limit) {
                let _this = this
                _this.data.order_no = threeCode
                _this.data.limit = limit
                uni.request({
                    url: `${_this.baseUrl}/orderGift/head/page/auth`,
                    header: {'token': uni.getStorageSync('token')},
                    data: _this.data,
                    method:'GET',
                    success(res) {
                        res = res.data
                        console.log(res);
                        if (res.code === 200) {
                            let list = res.data.records
                            _this.dataList =  _this.dataList.concat(list);
                            _this.data.curr = _this.data.curr + 1
                        }
                    }
                })
            },
            searchValueInput2() {
                this.dataList = []
                this.data.curr = 1
                if (this.searchValue.length == 0) {
                    this.getOrder(this.searchValue,10)
                } else {
                    this.getOrder(this.searchValue,10)
                }
                
            },
            clear() {
                this.dataList = []
                this.data.curr = 1
                setTimeout(()=> {
                    this.getOrder(this.searchValue,10)
                },300)
            },
            toDetls(index) {
                let _this = this
                uni.navigateTo({
                    url: './orderGiftDetls',
                    success(res) {
                        res.eventChannel.emit('item', {
                            item: _this.dataList[index]
                        })
                    },
                })
            }
        }
    }
</script>
 
<style>
    .list {
        margin: 20rpx;
        font-size: 14px;
        background-color: #fff;
        border-radius: 20rpx;
        border: 1px solid #eeeeee;
        display: flex;
        position: relative;
    }
    .list-left {
        flex: 1;
        padding: 20rpx;
        position: relative;
    }
    .list-right {
        width: 70rpx;
        border-left: 1px solid #eeeeee;
        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>