Pārlūkot izejas kodu

fix:全部完成

sunChengjie 11 mēneši atpakaļ
vecāks
revīzija
e560dd54fa

+ 13 - 6
src/pages/components/ScrollRefresh.vue

@@ -3,15 +3,15 @@
         <van-pull-refresh v-model="refreshLoading" @refresh="onRefresh">
             <slot v-bind:list="list"></slot>
             <template v-if="!refreshLoading && list.length > 0">
-                <div class="bottom_text" v-if="loading">
+                <div class="bottom_text" style="margin: 20px;" v-if="loading">
                     加载中...
                 </div>
-                <div class="bottom_text" v-else-if="noData">
+                <div class="bottom_text" style="margin: 20px;" v-else-if="noData">
                     已经到底啦...
                 </div>
             </template>
             <template v-if="list.length === 0">
-                <div>数据为空!</div>
+                <div class="bottom_text" style="margin-top: 40px;">数据为空!</div>
             </template>
         </van-pull-refresh>
 
@@ -35,16 +35,23 @@ export default {
         request: {
             required: true,
             type: Function,
-        }
+        },
+        defaultLimit: {
+            required: false,
+            type: Number,
+            default: function () {
+                return 3
+            }
+        },
     },
-    data() {
+    data(aaa) {
         return {
             noData: false,
             loading: false,
             refreshLoading: false,
             pagination: {
                 page: 1,
-                limit: 3
+                limit: this.defaultLimit
             },
             list: []
         };

+ 27 - 86
src/pages/components/Sented.vue

@@ -4,11 +4,9 @@
             <van-search style="width: 100%;" v-model="params.search" placeholder="请输入批次号" />
             <van-icon @click="onSearch" size="20" style="margin: 19px 8px 0 0px;" name="search" />
         </div>
-
-        <div class="batch_box" @scroll.passive="getScroll($event)"
-            style=" height: calc(100vh - 154px);overflow-y: auto;">
-            <van-pull-refresh v-model="refreshLoading" @refresh="onRefresh">
-                <div class="onther" v-for="(item, index) in waiteList" :key="index">
+        <ScrollRefresh height="calc(100vh - 99px)" ref="scrollRefresh" :request="request" :defaultLimit="6">
+            <template v-slot="slotProps">
+                <div class="onther" v-for="(item, index) in  slotProps.list" :key="index">
                     <div class="onther-top">
                         <div style="font-size: 16px;">批次号:{{ item.dispatchBatchNo
                             }}
@@ -17,17 +15,17 @@
                     </div>
                     <div class="onther-middel">
                         <div class="onther-middel-text">
-                            <div class="onther-middel-text-style">批次完成时间:{{ item.year }}-{{ item.month }}-{{
-                item.day }} {{ item.hour }}:{{ item.minute }}:{{ item.second }}</div>
+                            <div class="onther-middel-text-style">批次完成时间:{{ item.time }}</div>
                         </div>
                     </div>
                     <div class="onther-bottom">
-                        <van-cell style="color: aqua;" is-link @click="showPopup(item)">展示弹出层</van-cell>
+                        <van-cell is-link @click="showPopup(item)"><span
+                                style="color: #169bd5;">展开查看详情</span></van-cell>
                     </div>
                 </div>
-            </van-pull-refresh>
-        </div>
+            </template>
 
+        </ScrollRefresh>
 
         <van-popup v-model="show" style="width: 100%; height: 60%;">
             <div class="batch-middel" v-for="(item, index) in popupList" :key="index">
@@ -44,7 +42,7 @@
                             {{ item.signinStatus == 0 ? '待签收' : `${item.signinStatus == 1 ?
                 '已签收' : `${item.signinStatus == 2 ? '代收' : `${item.signinStatus == 3 ? '拒收' : '延迟'}`}`}` }}
                         </span>
-                        <span style="color: #1989fa;">查看</span>
+                        <!-- <span style="color: #1989fa;">查看</span> -->
                     </div>
                     <div class="batch-middel-text-style">签收时间:{{ item.signatureTime == undefined ? '' :
                 item.signatureTime.date.year }}-{{ item.signatureTime == undefined ? '' :
@@ -64,106 +62,49 @@
 
 <script>
 import { appOutboundInquiry, appGetTheDetails } from '@/api/index'
+import ScrollRefresh from './ScrollRefresh.vue';
 export default {
     name: 'waitsent',
+    components: {
+        ScrollRefresh
+    },
     data() {
         return {
-            refreshLoading: false, // 刷新loading
-            loading: false, // 加载更多loading
-            noData: false, // 没有更多数据
-            waiteList: [],
-            uploader: [{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' }],
             show: false,
             params: {
-                search: '', //'SF202303221917',
-                page: 1,
-                limit: 6
+                search: ''
             },
-            // timeList: []
             popupList: [],//点击弹框后的
         };
     },
-    mounted() {
-        // 获取数据
-        this.getData();
-    },
     methods: {
-        // 刷新
-        async onRefresh() {
-            this.params.page = 1;
-            this.params.limit = 6;
-            this.refreshLoading = true;
-            await this.getData(true)
-            this.refreshLoading = false
-        },
-        // 搜索批次号
-        async onSearch() {
-            // 每次查询都查询第一页
-            this.params.page = 1;
-            this.getData(true)
-        },
-        async getData(isClear) {
-            this.loading = true
+
+        async request(_params) {
             let parmas = {
                 dispatchBatchNo: this.params.search, // 批次号
                 deliveryPeopleId: localStorage.getItem('courierId'), //派送员id
                 isFinish: '1',//完成 1已完成 2未完成
-                page: this.params.page, //  页数,
-                limit: this.params.limit, // 条数
+                ..._params
 
             }
             const res = await appOutboundInquiry({ ...parmas }, { emulateJSON: true })
-            let waiteList = res.data.map((item) => {
+            res.data = res.data.map((item) => {
+                const date = item.signatureTime.date
+                const time = item.signatureTime.time
                 return {
                     ...item,
                     openCard: false,
+                    time: `${date.year}-${date.month}-${date.day} ${time.hour}:${time.minute}:${time.second}`
                 }
             })
-            let timeListA = res.data.map((item) => {
-                return item.signatureTime.date
-            })
-            let timeListB = res.data.map((item) => {
-                return item.signatureTime.time
-            })
-            this.timeList = timeListA.map((obj1, index) => ({
-                ...obj1,
-                ...timeListB[index] // 注意:这里假设两个数组长度相同且索引匹配  
-            }));
-
-            let waiteListA = waiteList.map((obj1, index) => ({
-                ...obj1,
-                ...this.timeList[index] // 注意:这里假设两个数组长度相同且索引匹配  
-            }));
-
-            console.log(waiteListA, 'this.timeList===============')
-
-            if (isClear) {
-                this.waiteList = waiteListA
-            } else {
-                this.waiteList.push(...waiteListA)
-            }
-
-            this.loading = false
-            if (this.params.page * this.params.limit >= res.count) {
-                this.noData = true;
-            } else {
-                this.noData = false;
-            }
-
+            return res
         },
-        // 滚动事件
-        getScroll(event) {
-            let scrollBottom =
-                event.target.scrollHeight -
-                event.target.scrollTop -
-                event.target.clientHeight;
-            // 距离底部20px以内 && 还有数据 && 没有正在加载中
-            if (scrollBottom <= 20 && !this.noData && !this.loading) {
-                this.params.page += 1;
-                this.getData();
-            }
+
+        // 搜索批次号
+        async onSearch() {
+            this.$refs.scrollRefresh.onRefresh()
         },
-        // 展示弹出层
+        // 展开查看详情
         async showPopup(value) {
             this.show = true;
             const res = await appGetTheDetails({ dispatchBatchNo: value.dispatchBatchNo })

+ 15 - 7
src/pages/components/Waitsent.vue

@@ -4,7 +4,7 @@
             <van-search style="width: 100%;" v-model="params.search" placeholder="请输入批次号" />
             <van-icon @click="onSearch" size="20" style="margin: 19px 8px 0 0px;" name="search" />
         </div>
-        <ScrollRefresh height="calc(100vh - 154px)" ref="scrollRefresh" :request="request">
+        <ScrollRefresh height="calc(100vh - 99px)" ref="scrollRefresh" :request="request">
             <template v-slot="slotProps">
                 <div class="batch" v-for="(item, index) in slotProps.list" :key="index">
                     <div class="batch-top">
@@ -68,7 +68,7 @@
                 </van-popup>
                 <van-field v-if="wer == '他人签收'" v-model="getOtherPhone" :rules="[{ required: true }]" label="代取手机号"
                     placeholder="请输入代取手机号" />
-                <van-field name="uploader" label="签收照片">
+                <van-field name="uploader" :rules="[{ required: true }]" label="签收照片">
                     <template #input>
                         <van-uploader v-model="uploader" :after-read="afterRead" :before-read="beforeRead"
                             :max-count="1" />
@@ -154,7 +154,7 @@ export default {
 
         // 搜索批次号
         async onSearch() {
-            this.$refs.scrollRefresh.loadData(true)
+            this.$refs.scrollRefresh.onRefresh()
         },
         async request(_params) {
             let parmas = {
@@ -190,7 +190,6 @@ export default {
 
             this.onSureRetentionVlaue = value
             this.retention = true;
-            console.log(this.onSureRetentionVlaue, type, 'this.onSureRetentionVlaue')
         },
         // 确定滞留
         async onSetRetention(value) {
@@ -203,7 +202,12 @@ export default {
                 params.sendRemark = this.otherCause
             }
             const res = await appSetStrands({ ...params })
-            console.log(res, '........')
+            if (res.code == 0) {
+                this.$toast('滞留完成')
+                this.retention = false
+                // this.request()
+                this.$router.push('/DeliveryInquiry')
+            }
         },
         // 原因
         onRetention(value) {
@@ -244,13 +248,17 @@ export default {
             if (value.picker == '他人签收') {
                 params.collectAgentNumber = this.getOtherPhone
             }
-
             const res = await appDelivery({ ...params })
+            if (res.code == 0) {
+                this.$toast('签收完成')
+                this.receiving = false
+                this.$refs.scrollRefresh.onRefresh()
+            }
         },
         // 展开
         async onUnfold(waite) {
             const data = await appGetTheDetails({ dispatchBatchNo: waite.dispatchBatchNo })
-            waite.list = [...data.data, ...data.data, ...data.data]
+            waite.list = data.data
             this.$set(waite, "openCard", !waite.openCard)
         }
     },

+ 5 - 1
src/pages/new/removal.vue

@@ -1,7 +1,7 @@
 <template>
     <div>
         <div class="container" v-if="isRemoval">
-            <van-search v-model="keyWorld" placeholder="请输入快递单号" />
+            <van-search v-model="keyWorld" @search="onSearch" placeholder="请输入快递单号" />
             <img @click="onImg" src="@/assets/user/u4.png" alt="">
             <div style="padding: 12px;" v-if="show">
                 <div style="margin-bottom: 10px;">已添加快件:</div>
@@ -66,6 +66,10 @@ export default {
                 }
             });
         },
+        onSearch() {
+            console.log('123')
+            this.callback(this.keyWorld)
+        },
         callback(code) {
             if (this.codes.length < 15) {
                 this.codes.push(code)