移动系统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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<!-- 商家中心 -->
<template>
    <view class="">
        <u-toast ref="uToast" /><u-no-network></u-no-network>
        <!-- 商家信息 -->
        <u-sticky>
            <view class="head-box">
                <view class="head-wrap">
                    <view class="titleNav coreshop-padding-left-15 coreshop-padding-right-15">
                        <view class="status-bar"></view>
                        <text class="nav-title coreshop-flex coreshop-align-center">商家中心</text>
                    </view>
                    <view class="coreshop-padding-top-25 coreshop-flex coreshop-justify-between">
                        <view class="coreshop-padding-left-15">
                            <view class="coreshop-width-fit-content coreshop-margin-bottom-10">
                                <u-icon name="arrow-down" color="#FFF" size="17" :label="storeDetail.storeName" labelPos="left" labelColor="#FFF" @tap="goStoreList"></u-icon>
                            </view>
                            <view class="coreshop-font-12" @tap="goMapDetails(storeDetail.id, storeDetail.latitude, storeDetail.longitude)">
                                {{ storeDetail.address || '' }}
                            </view>
                        </view>
                        <view class="coreshop-padding-top-5 coreshop-padding-right-10">
                            <u-button :plain="true" size="mini" icon="share-square" text="切换个人中心" @click="goUserCenter()"></u-button>
                        </view>
                    </view>
                </view>
            </view>
        </u-sticky>
        <!--业务列表-->
        <view class="coreshop-tools-list-box coreshop-bg-white coreshop-padding-bottom-10 coreshop-solid-bottom">
            <u-row>
                <u-col span="3" @click="goTakeDelivery">
                    <u-icon name="order" :size="23" color="#666" label="提货单列表" labelPos="bottom" labelSize="13" space="25" top="15"></u-icon>
                </u-col>
                <u-col span="3" @click="goRoute('/pages/member/merchant/takeDelivery/index')">
                    <u-icon name="fingerprint" :size="23" color="#666" label="提货单核销" labelPos="bottom" labelSize="13" space="25" top="15"></u-icon>
                </u-col>
                <u-col span="3" @click="goServiceVerification">
                    <u-icon name="coupon" :size="23" color="#666" label="服务券列表" labelPos="bottom" labelSize="13" space="25" top="15"></u-icon>
                </u-col>
                <u-col span="3" @click="goRoute('/pages/member/merchant/serviceVerification/index')">
                    <u-icon name="grid" :size="23" color="#666" label="核验服务券" labelPos="bottom" labelSize="13" space="25" top="15"></u-icon>
                </u-col>
            </u-row>
        </view>
 
        <view class="coreshop-padding-top-10 coreshop-padding-bottom-10 coreshop-padding-left-15 coreshop-padding-right-15 coreshop-bg-white">
            <u-search placeholder="请输订单号、收货人手机号、收货人姓名" v-model="keyword" shape="square" :show-action="true" action-text="搜索" @custom="goSearch" @search="goSearch"></u-search>
        </view>
 
        <!-- 统计及切换信息 -->
        <view class="statistics-box">
            <view class="statistics-nav coreshop-flex coreshop-align-center">
                <view class="nav-item coreshop-flex coreshop-align-center" v-for="nav in cancelTypeList" :key="nav.id" @tap="onNav(nav.type)">
                    <view class="coreshop-flex coreshop-flex-direction coreshop-align-center coreshop-percent-100">
                        <view class="item-title coreshop-flex coreshop-align-center" :class="{ 'title-active': cancelType === nav.type }">
                            <text class="coreshop-font-13 coreshop-margin-right-10">{{ nav.title }}</text>
                            <view :class="{ 'icon-active': cancelType === nav.type }">
                                <u-icon name="arrow-down-fill" size="11"></u-icon>
                            </view>
                        </view>
                        <text class="nav-line" :class="{ 'line-active': cancelType === nav.type }"></text>
                    </view>
                </view>
                <!-- 下拉窗 -->
                <view class="drop-down-box">
                    <view class="drop-down-item coreshop-flex coreshop-justify-between" v-for="(item, index) in dropDown[cancelType]" :key="index" @tap="onFilter(item.value, item.title)">
                        <text class="item-title">{{ item.title }}</text>
                        <text class="cuIcon-check" v-if="filter[cancelType] == item.value"></text>
                    </view>
                </view>
            </view>
            <!-- 销量 -->
            <view class="sales-volume-box coreshop-flex coreshop-justify-between pa30">
                <view class="sales-volume x-c">订单量(单):{{ orderTotalCount || 0 }}</view>
                <view class="sales-volume x-c">交易额(元):{{ orderTotalMoney || 0 }}</view>
            </view>
        </view>
        <!-- 订单列表 -->
        <view class="order-list" v-for="order in storeOrderList" :key="order.orderId" @tap.stop="goOrderDetail(order.orderId)">
            <view class="order-head coreshop-flex coreshop-justify-between coreshop-align-center">
                <text class="no">
                    编号:{{ order.orderId }}
                </text>
                <text class="state">{{ order.shipStatusText }}</text>
                <view class="coreshop-width-fit-content">
                    <u-button type="primary" size="mini" v-if="order.receiptType==1">物流快递</u-button>
                    <u-button type="success" size="mini" v-if="order.receiptType==2">同城配送</u-button>
                    <u-button type="warning" size="mini" v-if="order.receiptType==3">门店自提</u-button>
                </view>
            </view>
            <view class="goods-order" v-for="item in order.items" :key="item.id">
                <view class="order-content">
                    <view class="goods-box coreshop-flex coreshop-align-start">
                        <view class="coreshop-margin-right-10">
                            <u--image :showLoading="true" :src="item.imageUrl || ''" width="80px" height="80px" mode="aspectFill"></u--image>
                        </view>
                        <view class="coreshop-flex coreshop-flex-direction coreshop-align-start">
                            <view class="goods-title more-t u-line-2">{{ item.name || '' }}</view>
                            <view class="order-tip one-t">
                                <text class="order-num">数量:{{ item.nums || 0 }};</text>
                                {{ item.addon ? item.addon : '' }}
                            </view>
                            <view class="order-goods coreshop-flex coreshop-align-center ">
                                <text class="order-price">¥{{ item.amount || 0 }}</text>
                                <!--<button class="cu-btn status-btn" v-if="detail.status_name">{{ item.status_name }}</button>-->
                            </view>
                        </view>
                    </view>
                </view>
            </view>
 
            <view class="order-bottom coreshop-flex coreshop-justify-between coreshop-solid-bottom coreshop-align-center">
                <text class="coreshop-font-12 tips-color">{{$u.timeFormat(order.createTime, 'yyyy-mm-dd hh:MM:ss')}}</text>
                <text class="coreshop-font-12 tips-color">{{ order.shipName }}【{{ order.shipMobile }}】</text>
            </view>
 
            <view class="order-bottom coreshop-flex coreshop-justify-between coreshop-align-center">
                <view v-if="order.status === 1">
                    <u-button type="success" size="mini">订单正常</u-button>
                </view>
                <view v-else-if="order.status === 2">
                    <u-button type="primary" size="mini">订单完成</u-button>
                </view>
                <view v-else-if="order.status === 3">
                    <u-button size="mini">订单取消</u-button>
                </view>
                <view v-else></view>
                <view>
                    <text class="coreshop-font-12">{{ order.payStatusText }}</text>
                    <text class="coreshop-font-12" v-if="order.paymentCodeText">【{{order.paymentCodeText}}】</text>
                </view>
                <view>
                    <text class="total-price-title">实付款:</text>
                    <text class="total-price">{{ order.payedAmount }}</text>
                </view>
            </view>
 
        </view>
 
        <!-- 无数据时默认显示 -->
        <view class="coreshop-emptybox" v-if="storeOrderList.length<=0">
            <u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/order.png'" icon-size="150" text="当前时间暂无订单数据" mode="list"></u-empty>
        </view>
 
        <!-- 更多 -->
        <u-loadmore v-if="storeOrderList.length" height="40px" :status="loadStatus" icon-type="flower" color="#ccc" />
 
        <!-- 日期选择 -->
        <u-calendar v-model="showCalendar"
                    :mode="mode"
                    :start-text="startText"
                    :end-text="endText"
                    :range-color="rangeColor"
                    :range-bg-color="rangeBgColor"
                    :active-bg-color="activeBgColor"
                    btnType="success"
                    @change="selDate"></u-calendar>
    </view>
</template>
 
<script>
    import { mapMutations, mapActions, mapState } from 'vuex';
 
    export default {
 
        components: {},
        data() {
            return {
                keyword: '',
                storeId: 0,
                storeOrderList: [], //订单商品列表
                orderTotalCount: 0, //订单统计信息
                orderTotalMoney: 0, //订单金额统计信息
                storeDetail: {}, //门店信息
                cancelType: '', //分类
                cancelTypeList: [
                    {
                        id: 0,
                        title: '全部',
                        type: 'date'
                    },
                    {
                        id: 1,
                        title: '全部',
                        type: 'status'
                    },
                    {
                        id: 2,
                        title: '全部',
                        type: 'receiptType'
                    }
                ],
                showCalendar: false, //日期选择
                mode: 'range',
                result: '请选择日期',
                startText: '开始',
                endText: '结束',
                rangeColor: '#4CB89D',
                rangeBgColor: 'rgba(76,184,157,0.13)',
                activeBgColor: '#4CB89D',
                filter: {
                    date: 'all',
                    status: '0',
                    receiptType: '0',
                    custom: []
                },
                dropDown: {
                    date: [
                        { title: '全部', value: 'all', isChecked: false },
                        { title: '今日', value: 'today', isChecked: false },
                        { title: '昨日', value: 'yesterday', isChecked: false },
                        { title: '本周', value: 'week', isChecked: false },
                        { title: '本月', value: 'month', isChecked: false },
                        { title: '自定义', value: 'custom', isChecked: false }
                    ],
                    status: [
                        { title: '全部', value: '0', isChecked: false },
                        { title: '待付款', value: '1', isChecked: false },
                        { title: '待发货', value: '2', isChecked: false },
                        { title: '待收货', value: '3', isChecked: false },
                        { title: '待评价', value: '4', isChecked: false },
                        { title: '已完成', value: '6', isChecked: false },
                        { title: '已取消', value: '7', isChecked: false }
                    ],
                    receiptType: [
                        { title: '全部', value: '0', isChecked: false },
                        { title: '物流快递', value: '1', isChecked: false },
                        { title: '同城配送', value: '2', isChecked: false },
                        { title: '门店自提', value: '3', isChecked: true },
                    ]
                },
                loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
                currentPage: 1,
                lastPage: 1,
            };
        },
        computed: {},
        onLoad(options) {
            if (options.storeId) {
                this.storeId = options.storeId;
            }
            this.getStoreDetail();
            this.getStoreOrder();
        },
        onPullDownRefresh() {
            this.storeOrderList = [];
            this.currentPage = 1;
            this.getStoreOrder();
        },
        onReachBottom() {
            if (this.currentPage < this.lastPage) {
                this.currentPage += 1;
                this.getStoreOrder();
            }
        },
        methods: {
            goSearch() {
                if (this.keyword) {
                    this.$u.route({
                        url: '/pages/member/merchant/search/index',
                        params: {
                            keyword: this.keyword,
                            storeId: this.storeId
                        }
                    })
                } else {
                    this.$refs.uToast.show({ message: '请输订单号、收货人手机号、收货人姓名', type: 'warning', })
                }
            },
            // 选择门店
            goStoreList() {
                this.$u.route('/pages/member/merchant/storeList/storeList');
            },
            // 订单详情
            goOrderDetail(id) {
                this.$u.route({
                    url: '/pages/member/merchant/detail/detail',
                    params: {
                        orderId: id
                    }
                });
            },
            // 服务器核销列表
            goServiceVerification() {
                this.$u.route({
                    url: '/pages/member/merchant/serviceVerification/list',
                    params: {
                        storeId: this.storeId
                    }
                });
            },
            // 提货单列表
            goTakeDelivery() {
                this.$u.route({
                    url: '/pages/member/merchant/takeDelivery/list',
                    params: {
                        storeId: this.storeId
                    }
                });
            },
            // 获取门店信息
            getStoreDetail() {
                let that = this;
                let data = {
                    id: this.storeId
                }
                this.$u.api.getStoreByUserId(data).then(e => {
                    if (e.status) {
                        that.storeDetail = e.data;
                    } else {
                        that.$refs.uToast.show({ message: e.msg, type: 'error', })
                    }
                });
            },
            // 门店订单列表
            getStoreOrder() {
                let that = this;
                that.loadStatus = 'loading';
 
                let data = {
                    dateType: that.filter.date,
                    date: that.filter.custom,
                    status: that.filter.status,
                    receiptType: that.filter.receiptType,
                    page: that.currentPage,
                    limit: 10,
                    storeId: that.storeId
                }
 
                this.$u.api.getOrderPageByMerchant(data).then(res => {
                    if (res.status) {
                        uni.stopPullDownRefresh();
                        that.storeOrderList = [...that.storeOrderList, ...res.data.pages];
                        that.orderTotalCount = res.data.totalCount;
                        that.orderTotalMoney = res.data.totalMoney;
                        that.lastPage = res.data.totalPages;
                        if (that.currentPage < res.data.totalPages) {
                            that.loadStatus = 'loadmore';
                        } else {
                            that.loadStatus = 'nomore';
                        }
                    }
                });
            },
            // 切换核销分类
            onNav(type) {
                this.cancelType = this.cancelType == type ? '' : type;
            },
            // 选择日期
            selDate(e) {
                this.filter.custom.push(e.startDate);
                this.filter.custom.push(e.endDate);
                this.cancelTypeList[0].title = `${e.startDate.replace(/-/g, ':')}-${e.endDate.replace(/-/g, ':')}`;
                this.storeOrderList = [];
                this.currentPage = 1;
                this.getStoreOrder();
            },
            // 下拉筛选
            onHideDropDown() {
                this.cancelType = '';
            },
            // 选择筛选
            onFilter(val, title) {
                if (val == 'custom') {
                    this.showCalendar = true;
                }
                if (this.cancelType == 'date') {
                    this.cancelTypeList[0].title = title;
                }
                if (this.cancelType == 'status') {
                    this.cancelTypeList[1].title = title;
                }
                if (this.cancelType == 'receiptType') {
                    this.cancelTypeList[2].title = title;
                }
                this.filter[this.cancelType] = val;
                this.storeOrderList = [];
                this.currentPage = 1;
                this.getStoreOrder();
                this.cancelType = '';
            },
        }
    };
</script>
 
<style lang="scss" scoped>
    @import 'index.scss';
</style>