shizhongqi 3 месяцев назад
Родитель
Сommit
1ecfe8d763

+ 2 - 1
ghsApp/src/admin/home/apply.vue

@@ -98,7 +98,8 @@ export default {
                         {name: "售后记录",img: `${this.$constant.hostUrl}/image/ghs/home/kcyjs.png`,url: "/pagesOrder/refundAllList"},
                         {name: "预订汇总",img: `${this.$constant.hostUrl}/image/ghs/home/kcyjs.png`,url: "/admin/order/statBook"},
                         {name: "预订客户",img: `${this.$constant.hostUrl}/image/ghs/home/kcyjs.png`,url: "/admin/book/custom"},
-                        {name: "预订明细",img: `${this.$constant.hostUrl}/image/ghs/home/kcyjs.png`,url: "/admin/book/itemCustom"}
+                        {name: "预订明细",img: `${this.$constant.hostUrl}/image/ghs/home/kcyjs.png`,url: "/admin/book/itemCustom"},
+                        {name: "片区订单",img: `${this.$constant.hostUrl}/image/ghs/home/kcyjs.png`,url: "/admin/order/orderListByDist"}
                     ]
                 },
                 {

+ 212 - 0
ghsApp/src/admin/order/orderListByDist.vue

@@ -0,0 +1,212 @@
+<template>
+  <view class="app-main app-content">
+    <view class="input-wrap_box">
+      <view class="select-dn_bx">
+        <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" defaultShowName="今天" :isShowMonth="false" :customDateOption="myCustomDateOption" :maxDays="7" />
+      </view>
+    </view>
+
+    <view class="list-wrap">
+      <view class="table-header">
+        <text class="col-name">名称</text>
+        <text class="col-phone">电话</text>
+        <text class="col-address">地址</text>
+      </view>
+
+      <block v-if="!$util.isEmpty(distList)">
+        <view class="dist-block" v-for="distItem in distList" :key="distItem.distKey">
+          <view class="dist-title">{{ distItem.distName }}</view>
+          <view class="custom-row" v-for="customItem in distItem.orderList" :key="customItem.id" @click="goToDetail(customItem.id)">
+            <text class="col-name">{{ customItem.name }}</text>
+            <text class="col-phone">{{ customItem.phone }}</text>
+            <text class="col-address">{{ customItem.address }}</text>
+          </view>
+        </view>
+      </block>
+      <block v-else>
+        <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(distList)" />
+      </block>
+    </view>
+
+    <NotLogin></NotLogin>
+  </view>
+</template>
+
+<script>
+import DateSelect from '@/components/module/dateSelect';
+import NotLogin from '@/components/not-login';
+import AppWrapperEmpty from '@/components/app-wrapper-empty';
+import { getOrderListByDist } from '@/api/order';
+
+export default {
+  name: 'orderListByDist',
+  components: {
+    DateSelect,
+    NotLogin,
+    AppWrapperEmpty
+  },
+  data() {
+    return {
+      searchTime: '今天',
+      startTime: '',
+      endTime: '',
+      distList: [],
+      myCustomDateOption: [
+        { name: '昨天', value: 'yesterday' },
+        { name: '今天', value: 'today' },
+        { name: '本周', value: 'thisWeek' }
+      ]
+    };
+  },
+  onLoad() {
+    this.getListData();
+  },
+  onPullDownRefresh() {
+    this.getListData().finally(() => {
+      uni.stopPullDownRefresh();
+    });
+  },
+  methods: {
+    init() {},
+    selectDateFn(val) {
+      this.searchTime = val.searchTime || '';
+      this.startTime = val.startTime || '';
+      this.endTime = val.endTime || '';
+      this.getListData();
+    },
+    getListData() {
+      return getOrderListByDist({
+        searchTime: this.searchTime,
+        startTime: this.startTime,
+        endTime: this.endTime
+      })
+        .then((res) => {
+          this.distList = this.normalizeDistList(res.data);
+        })
+        .catch(() => {
+          this.distList = [];
+        });
+    },
+    normalizeDistList(data) {
+      if (this.$util.isEmpty(data)) {
+        return [];
+      }
+      // 接口标准返回:{ totalNum, list, shop, shopExt }
+      if (data && Array.isArray(data.list)) {
+        return data.list.map((item, index) => this.normalizeDistItem(item, index)).filter(item => !this.$util.isEmpty(item.orderList));
+      }
+      if (Array.isArray(data)) {
+        return data.map((item, index) => this.normalizeDistItem(item, index)).filter(item => !this.$util.isEmpty(item.orderList));
+      }
+      if (typeof data === 'object') {
+        return Object.keys(data)
+          .filter((key) => Array.isArray(data[key]))
+          .map((distName, index) => this.normalizeDistItem({ distName, orderList: data[distName] }, index))
+          .filter(item => !this.$util.isEmpty(item.orderList));
+      }
+      return [];
+    },
+    normalizeDistItem(item, index) {
+      const orderListRaw = item.list || [];
+      const orderList = Array.isArray(orderListRaw)
+        ? orderListRaw.map(order => this.normalizeCustomItem(order))
+        : [];
+      return {
+        distKey:item.distId,
+        distName: item.distName || '未分区',
+        orderList
+      };
+    },
+    normalizeCustomItem(item) {
+      return {
+        id: item.id || item.customId || '',
+        name: item.name || '--',
+        phone: item.mobile || '--',
+        address: item.fullAddress || '--'
+      };
+    },
+    goToDetail(id) {
+      if (id) {
+        uni.navigateTo({
+          url: `/pagesOrder/detail?id=${id}`
+        });
+      }
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.app-content {
+  min-height: 100vh;
+  background-color: #f7f7f7;
+}
+
+.input-wrap_box {
+  position: fixed;
+  top: 0;
+  z-index: 10;
+  width: 100%;
+  height: 100upx;
+  background-color: #fff;
+  display: flex;
+  align-items: center;
+  padding: 0 20upx;
+  box-sizing: border-box;
+
+  .select-dn_bx {
+    width: 100%;
+  }
+}
+
+.list-wrap {
+  padding: 120upx 10upx 20upx;
+  box-sizing: border-box;
+}
+
+.table-header {
+  display: flex;
+  align-items: center;
+  min-height: 70upx;
+  padding: 0 20upx;
+  color: #8d96b0;
+  font-size: 30upx;
+  background-color: #eceef3;
+}
+
+.dist-block {
+  background-color: #fff;
+}
+
+.dist-title {
+  padding: 30upx 20upx 20upx;
+  font-size: 28upx;
+  color: #333;
+  font-weight: 600;
+}
+
+.custom-row {
+  display: flex;
+  align-items: center;
+  min-height: 88upx;
+  padding: 0 20upx;
+  font-size: 28upx;
+  color: #333;
+  border-top: 1upx solid #e8e8e8;
+  box-sizing: border-box;
+}
+
+.col-name {
+  width: 24%;
+}
+
+.col-phone {
+  width: 30%;
+  text-align: center;
+}
+
+.col-address {
+  width: 46%;
+  text-align: center;
+}
+</style>

+ 7 - 0
ghsApp/src/api/order/index.js

@@ -68,6 +68,13 @@ export const getNewOrderList = data => {
 	return https.get("/order/new-order-list", data)
 }
 
+/**
+ * 片区订单列表
+ */
+export const getOrderListByDist = data => {
+	return https.get("/order/list-by-dist", data)
+}
+
 /** *
  * 订单详情 m
  */

+ 36 - 6
ghsApp/src/components/module/dateSelect.vue

@@ -19,7 +19,7 @@
                     </view>
                 </view>
 
-                <view class="select-item-box">
+                <view class="select-item-box" v-if="isShowMonth">
                     <view class="title">选月份</view>
                     <picker mode="date" :value="date" :start="startDate" :end="endDate" fields="month" @change="bindMonthChange" >
                         <view class="item-child_box">
@@ -32,7 +32,7 @@
                     <view class="title">快捷选项</view>
                     <view class="item-child_box">
                         <button
-                            v-for="(item,index) in getDictionariesInfo.dateDefaultOption"
+                            v-for="(item,index) in dateOptions"
                             :key="index"
                             @click="changeDateOption(item)"
                             :class="['admin-button-com','mini-btn',selectItemId === item.id?'blue':'default']">
@@ -87,7 +87,19 @@ export default {
         },
         defaultShowName:{
             type: String,
-            default: '今天'
+            default: '日期'
+        },
+        isShowMonth: {
+            type: Boolean,
+            default: true
+        },
+        customDateOption: {
+            type: Array,
+            default: () => []
+        },
+        maxDays: {
+            type: Number,
+            default: 0
         }
     },
     data(){
@@ -112,7 +124,10 @@ export default {
         }
     },
     computed:{
-        ...mapGetters(["getDictionariesInfo"])
+        ...mapGetters(["getDictionariesInfo"]),
+        dateOptions() {
+            return this.customDateOption && this.customDateOption.length > 0 ? this.customDateOption : (this.getDictionariesInfo.dateDefaultOption || []);
+        }
     },
     mounted(){
         let nowDate = new Date();
@@ -154,11 +169,26 @@ export default {
                 return false
             }
             if(this.$util.isEmpty(this.endDate)){
-                this.$msg('请选择开始日期')
+                this.$msg('请选择结束日期')
+                return false
+            }
+            
+            let start = new Date(this.startDate.replace(/-/g, '/')).getTime();
+            let end = new Date(this.endDate.replace(/-/g, '/')).getTime();
+            if (end < start) {
+                this.$msg('结束日期不能小于开始日期')
                 return false
             }
+            if (this.maxDays > 0) {
+                let days = (end - start) / (1000 * 60 * 60 * 24);
+                if (days > this.maxDays - 1) {
+                    this.$msg(`最多只能选择${this.maxDays}天`)
+                    return false
+                }
+            }
+
             this.dropdownShow = false
-            this.defaultDateName = this.startDate == this.endDate ?  this.startDate : '选时段' 
+            this.defaultDateName = this.startDate == this.endDate ?  this.startDate.substring(5) : this.startDate.substring(5) + ' ~ ' + this.endDate.substring(5) 
             this.$emit('selectDateFn',{searchTime:'custom',startTime:this.startDate,endTime:this.endDate})
         },
         cancelPicker(){

+ 2 - 1
ghsApp/src/pages.json

@@ -507,7 +507,8 @@
 				{"path": "statBook","style": {"navigationBarTitleText": "预订汇总","enablePullDownRefresh": true}},
 				{"path": "statKhBook","style": {"navigationBarTitleText": "详情"}},
 				{"path": "freight","style": {"navigationBarTitleText": "运费设置"}},
-				{"path": "callExpress","style": {"navigationBarTitleText": "呼叫跑腿"}}
+				{"path": "callExpress","style": {"navigationBarTitleText": "呼叫跑腿"}},
+				{"path": "orderListByDist","style": {"navigationBarTitleText": "片区订单"}}
 			]
 		},
 		{