|
|
@@ -8,6 +8,7 @@
|
|
|
|
|
|
<view class="list-wrap">
|
|
|
<view class="table-header">
|
|
|
+ <text class="col-index-header">序号</text>
|
|
|
<text class="col-name">名称</text>
|
|
|
<text class="col-phone">电话</text>
|
|
|
<text class="col-address">地址</text>
|
|
|
@@ -16,10 +17,24 @@
|
|
|
<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" style="font-size:26upx;">{{ customItem.address }}</text>
|
|
|
+ <view class="custom-row" v-for="(customItems, index) in distItem.orderList" :key="index" @click="handleRowClick(customItems)">
|
|
|
+ <view class="row-content">
|
|
|
+ <block v-if="customItems.length === 1">
|
|
|
+ <text class="col-index">{{ index + 1 }}</text>
|
|
|
+ <text class="col-name">{{ customItems[0].name }}</text>
|
|
|
+ <text class="col-phone">{{ customItems[0].phone }}</text>
|
|
|
+ <text class="col-address">{{ customItems[0].address }}</text>
|
|
|
+ </block>
|
|
|
+ <block v-else-if="customItems.length > 1">
|
|
|
+ <text class="col-index">{{ index + 1 }}</text>
|
|
|
+ <text class="col-name" style="color: #07c160;">{{ customItems[0].name }}</text>
|
|
|
+ <text class="col-phone" style="color: #07c160;">{{ customItems[0].phone }}</text>
|
|
|
+ <text class="col-address" style="color: #07c160;">{{ customItems[0].address }}</text>
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
+ <view class="row-remark" v-if="customItems[0].remark">
|
|
|
+ <text style="color: #666;font-size: 28upx;">备注:</text>{{ customItems[0].remark }}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</block>
|
|
|
@@ -29,6 +44,28 @@
|
|
|
</view>
|
|
|
|
|
|
<NotLogin></NotLogin>
|
|
|
+
|
|
|
+ <!-- 弹窗 -->
|
|
|
+ <view class="popup-mask" v-if="showPopup" @click="closePopup">
|
|
|
+ <view class="popup-content" @click.stop>
|
|
|
+ <view class="popup-header">
|
|
|
+ <text class="popup-title">{{ popupList.length }}条订单</text>
|
|
|
+ <view class="popup-close" @click="closePopup">×</view>
|
|
|
+ </view>
|
|
|
+ <scroll-view scroll-y class="popup-list">
|
|
|
+ <view class="popup-item" v-for="item in popupList" :key="item.id" @click="goToDetail(item.id)">
|
|
|
+ <view class="row-content">
|
|
|
+ <text class="col-name-popup">{{ item.name }}</text>
|
|
|
+ <text class="col-phone-popup">{{ item.phone }}</text>
|
|
|
+ <text class="col-address-popup">{{ item.address }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="row-remark" v-if="item.remark">
|
|
|
+ <text style="color: #666;font-size: 28upx;">备注:</text>{{ item.remark }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -55,7 +92,9 @@ export default {
|
|
|
{ name: '昨天', value: 'yesterday' },
|
|
|
{ name: '今天', value: 'today' },
|
|
|
{ name: '本周', value: 'thisWeek' }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ showPopup: false,
|
|
|
+ popupList: []
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
|
@@ -95,13 +134,6 @@ export default {
|
|
|
// 接口标准返回:{ totalNum, list, shop, shopExt }
|
|
|
if (data && Array.isArray(data.list)) {
|
|
|
result = data.list.map((item, index) => this.normalizeDistItem(item, index)).filter(item => !this.$util.isEmpty(item.orderList));
|
|
|
- } else if (Array.isArray(data)) {
|
|
|
- result = data.map((item, index) => this.normalizeDistItem(item, index)).filter(item => !this.$util.isEmpty(item.orderList));
|
|
|
- } else if (typeof data === 'object') {
|
|
|
- result = 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));
|
|
|
}
|
|
|
|
|
|
const unpartitionedIndex = result.findIndex(item => item.distName === '未分区');
|
|
|
@@ -113,10 +145,22 @@ export default {
|
|
|
return result;
|
|
|
},
|
|
|
normalizeDistItem(item, index) {
|
|
|
- const orderListRaw = item.list || [];
|
|
|
- const orderList = Array.isArray(orderListRaw)
|
|
|
- ? orderListRaw.map(order => this.normalizeCustomItem(order))
|
|
|
- : [];
|
|
|
+ const orderListRaw = item.list || {};
|
|
|
+ const orderList = [];
|
|
|
+
|
|
|
+ if (typeof orderListRaw === 'object' && !Array.isArray(orderListRaw)) {
|
|
|
+ Object.keys(orderListRaw).forEach(key => {
|
|
|
+ const items = orderListRaw[key] || [];
|
|
|
+ if (Array.isArray(items) && items.length > 0) {
|
|
|
+ orderList.push(items.map(order => this.normalizeCustomItem(order)));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (Array.isArray(orderListRaw)) {
|
|
|
+ orderListRaw.forEach(order => {
|
|
|
+ orderList.push([this.normalizeCustomItem(order)]);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
distKey:item.distId || 999999 + index,
|
|
|
distName: item.distName || '未分区',
|
|
|
@@ -128,11 +172,25 @@ export default {
|
|
|
id: item.id || item.customId || '',
|
|
|
name: item.name || '--',
|
|
|
phone: item.mobile || '--',
|
|
|
- address: item.fullAddress || '--'
|
|
|
+ address: item.fullAddress || '--',
|
|
|
+ remark: item.remark || ''
|
|
|
};
|
|
|
},
|
|
|
+ handleRowClick(customItems) {
|
|
|
+ if (customItems.length === 1) {
|
|
|
+ this.goToDetail(customItems[0].id);
|
|
|
+ } else if (customItems.length > 1) {
|
|
|
+ this.popupList = customItems;
|
|
|
+ this.showPopup = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ closePopup() {
|
|
|
+ this.showPopup = false;
|
|
|
+ this.popupList = [];
|
|
|
+ },
|
|
|
goToDetail(id) {
|
|
|
if (id) {
|
|
|
+ this.showPopup = false;
|
|
|
uni.navigateTo({
|
|
|
url: `/pagesOrder/detail?id=${id}`
|
|
|
});
|
|
|
@@ -194,26 +252,140 @@ export default {
|
|
|
|
|
|
.custom-row {
|
|
|
display: flex;
|
|
|
- align-items: center;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
min-height: 88upx;
|
|
|
- padding: 0 20upx;
|
|
|
+ padding: 20upx;
|
|
|
font-size: 28upx;
|
|
|
color: #333;
|
|
|
border-top: 1upx solid #e8e8e8;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
|
|
|
+.row-content {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.row-remark {
|
|
|
+ font-size: 26upx;
|
|
|
+ color: #999;
|
|
|
+ margin-top: 10upx;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.col-index-header {
|
|
|
+ width: 14%;
|
|
|
+ margin-right: 1%;
|
|
|
+}
|
|
|
+
|
|
|
+.col-index {
|
|
|
+ width: 4%;
|
|
|
+ margin-right: 2%;
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+
|
|
|
.col-name {
|
|
|
width: 24%;
|
|
|
+ margin-right: 1%;
|
|
|
}
|
|
|
|
|
|
.col-phone {
|
|
|
- width: 30%;
|
|
|
+ width: 29%;
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
.col-address {
|
|
|
+ width: 42%;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.col-name-popup {
|
|
|
+ width: 24%;
|
|
|
+ margin-right: 1%;
|
|
|
+}
|
|
|
+
|
|
|
+.col-phone-popup {
|
|
|
+ width: 30%;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.col-address-popup {
|
|
|
width: 46%;
|
|
|
text-align: center;
|
|
|
}
|
|
|
+
|
|
|
+.popup-mask {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ z-index: 999;
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-content {
|
|
|
+ width: 96%;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 16upx;
|
|
|
+ overflow: hidden;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ max-height: 80vh;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-header {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ height: 100upx;
|
|
|
+ border-bottom: 1upx solid #eee;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-title {
|
|
|
+ font-size: 32upx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-close {
|
|
|
+ position: absolute;
|
|
|
+ right: 0;
|
|
|
+ top: 0;
|
|
|
+ width: 100upx;
|
|
|
+ height: 100upx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ font-size: 40upx;
|
|
|
+ color: #999;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-list {
|
|
|
+ flex: 1;
|
|
|
+ padding: 0 20upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ min-height: 88upx;
|
|
|
+ padding: 20upx 0;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #333;
|
|
|
+ border-bottom: 1upx solid #eee;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-item:last-child {
|
|
|
+ border-bottom: none;
|
|
|
+}
|
|
|
</style>
|