移动系统liao
2025-02-17 557c2711a3e103ebc3d0492344eca9730d5e92b2
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<template>
    <view>
        <u-toast ref="uToast" /><u-no-network></u-no-network>
        <u-navbar title="代理订单" safeAreaInsetTop fixed placeholder>
            <view class="coreshop-navbar-left-slot" slot="left">
                <u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
                <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
                <u-icon name="home" size="22" @click="goHome"></u-icon>
            </view>
            <view slot="right">
            </view>
        </u-navbar>
        <u-sticky customNavHeight="48">
            <view class="head_box coreshop-bg-blue">
                <!-- 团队数据总览 -->
                <view class="team-data-box coreshop-flex coreshop-justify-between">
                    <view class="data-card">
                        <view class="total-item">
                            <view class="item-title">总订单数量(单)</view>
                            <view class="total-num">{{ orderInfo.allOrder }}</view>
                        </view>
                        <view class="category-item coreshop-flex coreshop-justify-between">
                            <view class="coreshop-flex coreshop-flex-direction coreshop-align-start flex-sub">
                                <view class="item-title">代购订单</view>
                                <view class="category-num">{{ orderInfo.procurementServiceOrder }}</view>
                            </view>
                            <view class="coreshop-flex coreshop-flex-direction coreshop-align-start flex-sub">
                                <view class="item-title">客户订单</view>
                                <view class="category-num">{{ orderInfo.customerOrder }}</view>
                            </view>
                        </view>
                    </view>
                    <view class="data-card">
                        <view class="total-item">
                            <view class="item-title">总订单金额(元)</view>
                            <view class="total-num">{{ orderInfo.allOrderMoney || '0.00' }}</view>
                        </view>
                        <view class="category-item coreshop-flex coreshop-justify-between">
                            <view class="coreshop-flex coreshop-flex-direction coreshop-align-start flex-sub">
                                <view class="item-title">代购订单</view>
                                <view class="category-num">{{ orderInfo.procurementServiceOrderMoney || '0.00' }}</view>
                            </view>
                            <view class="coreshop-flex coreshop-flex-direction coreshop-align-start">
                                <view class="item-title">客户订单</view>
                                <view class="category-num">{{ orderInfo.customerOrderMoney || '0.00' }}</view>
                            </view>
                        </view>
                    </view>
                </view>
 
                <!-- 直推 -->
                <view class="direct-box coreshop-flex coreshop-justify-between">
                    <view class="direct-item ">
                        <view class="item-title">本月订单总数(单)</view>
                        <view class="item-value">{{ orderInfo.monthOrder || '0'  }}</view>
                    </view>
                    <view class="direct-item">
                        <view class="item-title">本月订单金额(元)</view>
                        <view class="item-value">{{ orderInfo.monthOrderMoney || '0'  }}</view>
                    </view>
                </view>
 
                <!-- 状态分类 -->
                <view class="coreshop-flex coreshop-justify-between nav-box">
                    <view class="state-item flex-sub " v-for="(state, index) in statusList" :key="state.value" @tap="onTab(state.value)">
                        <text class="state-title" :class="{ 'title-active': stateCurrent === state.value }">{{ state.name }}</text>
                        <text class="underline" :class="{ 'underline-active': stateCurrent === state.value }"></text>
                    </view>
                </view>
            </view>
        </u-sticky>
        <view class="content_box">
            <!-- 订单列表 -->
            <view class="order-list" v-for="item in list" :key="item.id" v-if="list.length > 0">
                <view class="order-head coreshop-flex coreshop-justify-between coreshop-solid-bottom">
                    <text class="order-code">订单编号:{{ item.orderId }}</text>
                    <text class="order-state">{{ item.userId==item.buyUserId?'代购订单':'推广订单' }}</text>
                </view>
                <view class="order-from coreshop-flex coreshop-justify-between coreshop-solid-bottom">
                    <view class="from-user coreshop-flex coreshop-align-center">
                        <text>下单人:</text>
                        <u-avatar :src="item.buyUserAvatar" size="20"></u-avatar>
                        <text class="user-name">{{ item.buyUserNickName }}</text>
                    </view>
                    <view class="order-time">{{ $u.timeFormat(item.createTime, ' yyyy.mm.dd hh:MM ') }}</view>
                </view>
                <view class="goods-card coreshop-flex coreshop-align-center coreshop-solid-bottom" v-for="goods in item.agentOrderDetails" :key="goods.id">
                    <view class="goods-img-box"><image class="goods-img" :src="goods.imageUrl" mode=""></image></view>
                    <view class="goods-info coreshop-flex coreshop-flex-direction coreshop-align-center coreshop-justify-between">
                        <view class="goods-title more-t">{{ goods.name }}</view>
                        <view class="goods-sku">数量: {{ goods.productNums }};{{ goods.addon || '' }}</view>
                        <view class="total-box  coreshop-flex coreshop-align-center coreshop-justify-between">
                            <view class="goods-price">
                                {{ goods.productPrice * goods.productNums }}
                                <text class="goods-state">未结算</text>
                            </view>
                            <view class="coreshop-flex coreshop-align-center">
                                <text class="name">佣金:</text>
                                <text class="commission-num">{{ goods.amount }}</text>
                            </view>
                        </view>
                    </view>
                </view>
                <view class="total-box coreshop-flex coreshop-align-center coreshop-justify-between coreshop-padding-left-10 coreshop-padding-right-10">
                    <view class="num-price">商品总价:¥{{ item.goodsAmount }}, 实付款:¥{{ item.payedAmount }}, 优惠金额:¥{{ Math.round(item.goodsAmount-item.payedAmount).toFixed(2) }}</view>
                    <view class="x-f"></view>
                </view>
                <view class="total-box coreshop-flex coreshop-justify-between  coreshop-padding-left-10 coreshop-padding-right-10">
                    <view class="num-price coreshop-flex coreshop-align-center">提成:¥{{ item.amount || '0'}}</view>
                    <view class="coreshop-flex coreshop-align-center">{{item.isSettlement==1?'已结算':item.isSettlement==2?'未结算':'已退款'}}</view>
                </view>
            </view>
            <!-- 无数据时默认显示 -->
            <view class="coreshop-emptybox" v-else>
                <u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/data.png'" icon-size="150" text="当前日明细" mode="list"></u-empty>
            </view>
            <!-- 更多 -->
            <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="20" margin-bottom="20" v-if="list.length" />
        </view>
    </view>
</template>
 
<script>
 
    export default {
 
        data() {
            return {
                orderInfo: {
                    allOrder: 0,
                    procurementServiceOrder: 0,
                    customerOrder: 0,
                    monthOrder: 0,
                    allOrderMoney: 0,
                    procurementServiceOrderMoney: 0,
                    customerOrderMoney: 0,
                    monthOrderMoney: 0,
                },
                page: 1,
                limit: 10,
                list: [], // 商品浏览足迹
                status: 'loadmore',
                iconType: 'flower',
                loadText: {
                    loadmore: '轻轻上拉',
                    loading: '努力加载中',
                    nomore: '实在没有了'
                },
                stateCurrent: '0', //默认
                statusList: [
                    {
                        name: '全部',
                        value: '0'
                    },
                    {
                        name: '已结算',
                        value: '1'
                    },
                    {
                        name: '未结算',
                        value: '2'
                    },
                    {
                        name: '已退款',
                        value: '3'
                    }
                ],
                viewHeight: 0,
            };
        },
        onLoad() {
            this.getAgentOrderSum();
            this.getAgentOrder();
        },
        onReachBottom() {
            if (this.status === 'loadmore') {
                this.getAgentOrder()
            }
        },
        methods: {
            // 切换分类
            onTab(state) {
                uni.showLoading({
                    title: '加载中'
                });
                this.list = [];
                this.stateCurrent = state;
                this.page = 1;
                this.$u.debounce(this.getAgentOrder);
            },
            getAgentOrderSum() {
                this.$u.api.getAgentOrderSum(null).then(res => {
                    if (res.status) {
                        this.orderInfo.allOrder = res.data.allOrder;
                        this.orderInfo.procurementServiceOrder = res.data.procurementServiceOrder;
                        this.orderInfo.customerOrder = res.data.customerOrder;
                        this.orderInfo.monthOrder = res.data.monthOrder;
                        this.orderInfo.allOrderMoney = res.data.allOrderMoney;
                        this.orderInfo.procurementServiceOrderMoney = res.data.procurementServiceOrderMoney;
                        this.orderInfo.customerOrderMoney = res.data.customerOrderMoney;
                        this.orderInfo.monthOrderMoney = res.data.monthOrderMoney;
                    } else {
                        this.$u.toast(res.msg)
                    }
                });
            },
            getAgentOrder() {
                let data = {
                    page: this.page,
                    limit: this.limit,
                    id: this.stateCurrent
                }
                this.status = 'loading'
                this.$u.api.getAgentOrder(data).then(res => {
                    uni.hideLoading();
                    if (res.status) {
                        let _list = res.data
                        if (_list) {
                            _list.forEach(item => {
                                this.$set(item, 'slide_x', 0)
                            })
                            this.list = [...this.list, ..._list]
                        }
                        if (res.code > this.list.length) {
                            this.page++
                            this.status = 'loadmore'
                        } else {
                            this.status = 'nomore'
                        }
                    } else {
                        this.$u.toast(res.msg)
                    }
                })
                uni.hideLoading();
            },
        }
    };
</script>
 
<style lang="scss" scoped>
    @import "order.scss";
</style>