Commit 8e054c1c authored by 李超鹏's avatar 李超鹏

Merge remote-tracking branch 'origin/master'

parents d46036e4 f27f2ce8
...@@ -282,26 +282,26 @@ ...@@ -282,26 +282,26 @@
"list": [ "list": [
{ {
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
"iconPath": "static/logo.png", "iconPath": "static/tab/shouye-1@3x.png",
"selectedIconPath": "static/logo.png", "selectedIconPath": "static/tab/shouye-1@3x.png",
"text": "首页" "text": "首页"
}, },
{ {
"pagePath": "pages/order/index", "pagePath": "pages/order/index",
"iconPath": "static/logo.png", "iconPath": "static/tab/dingdan-0@3x.png",
"selectedIconPath": "static/logo.png", "selectedIconPath": "static/tab/dingdan-1@3x.png",
"text": "订单" "text": "订单"
}, },
{ {
"pagePath": "pages/learn/index", "pagePath": "pages/learn/index",
"iconPath": "static/logo.png", "iconPath": "static/tab/xuexi-0@3x.png",
"selectedIconPath": "static/logo.png", "selectedIconPath": "static/tab/xuexi-1@3x.png",
"text": "学习" "text": "学习"
}, },
{ {
"pagePath": "pages/mine/index", "pagePath": "pages/mine/index",
"iconPath": "static/logo.png", "iconPath": "static/tab/wode-0@3x.png",
"selectedIconPath": "static/logo.png", "selectedIconPath": "static/tab/wode-0@3x.png",
"text": "我的" "text": "我的"
} }
] ]
......
...@@ -125,7 +125,9 @@ ...@@ -125,7 +125,9 @@
return process.uniEnv.qn_base_url + 'weiruzhu.png' return process.uniEnv.qn_base_url + 'weiruzhu.png'
}, },
}, },
onLoad() {}, onLoad() {
this.getOrderCount()
},
onShow() { onShow() {
// 每次进入页面都刷新入驻状态 // 每次进入页面都刷新入驻状态
if (this.vuex_token) { if (this.vuex_token) {
...@@ -274,6 +276,29 @@ ...@@ -274,6 +276,29 @@
}); });
} }
}, },
// 获取订单数量
getOrderCount() {
var self = this; // 加载订单列表
self.$u.api.listOrderCount().then((res) => {
if (res.code == 200) {
console.log("===", res.data)
if (res.data) {
var count = 0
for (var i in res.data) {
count += res.data[i]
}
// 修改tab总数
uni.setTabBarBadge({
index: 1,
text: String(count)
})
}
} else {
console.log(res.message, "获取订单数量失败!");
}
});
},
}, },
}; };
</script> </script>
......
...@@ -18,16 +18,21 @@ ...@@ -18,16 +18,21 @@
bar-width="44" :offset="[0,0]" :list="list" count="total" :current="current" @change="change" bar-width="44" :offset="[0,0]" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" font-size="28" bold></u-tabs> :is-scroll="false" font-size="28" bold></u-tabs>
</view> </view>
<NoOrder v-if="noMore" customStyle="margin-top: 100rpx;background-color: #F4F5F7" />
<view v-else class="tab-view">
<view class="tab-view">
<!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> --> <!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> -->
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring> <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring
<view v-for="(item, index) in orderList" :key="item.orderId"> scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
<OrderCell :orderData="item" :type="orderType" :location="dataValue" @click="handleClick(item)" refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh"
@action="handleAction(item)"> </OrderCell> @refresherrestore="onRestore" @refresherabort="onAbort">
</view> <NoOrder v-if="noMore" customStyle="margin-top: 100rpx;background-color: #F4F5F7" />
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore> <template v-else>
<view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell :orderData="item" :type="orderType" :location="dataValue" @click="handleClick(item)"
@action="handleAction(item)"> </OrderCell>
</view>
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</template>
</scroll-view> </scroll-view>
<!-- </swiper-item> --> <!-- </swiper-item> -->
</view> </view>
...@@ -80,16 +85,19 @@ ...@@ -80,16 +85,19 @@
current: 0, current: 0,
loadStatus: 'loading', loadStatus: 'loading',
dataValue: [], dataValue: [],
loaded: false loaded: false,
triggered: false,
_freshing: false,
}; };
}, },
onLoad() { onLoad() {
this._freshing = false;
this.getLocation(); this.getLocation();
// this.getOrderCount(); // this.getOrderCount();
this.getOrderList(0); this.getOrderList(0);
}, },
onShow() { onShow() {
this.getOrderCount() this.getOrderCount()
}, },
computed: { computed: {
subList() { subList() {
...@@ -137,7 +145,7 @@ ...@@ -137,7 +145,7 @@
this.pageNumber = 0 this.pageNumber = 0
this.orderList = [] this.orderList = []
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.getOrderList(index === 0 ? this.currentIndex : 5) this.getOrderList(this.currentIndex)
}, },
// tab栏切换 // tab栏切换
change(index) { change(index) {
...@@ -190,7 +198,7 @@ ...@@ -190,7 +198,7 @@
/*↓↓↓↓↓↓↓↓↓↓测试数据↓↓↓↓↓↓↓↓↓↓*/ /*↓↓↓↓↓↓↓↓↓↓测试数据↓↓↓↓↓↓↓↓↓↓*/
res.data.type = self.orderType res.data.type = self.orderType
if (res.data.list) { if (res.data.list) {
if (res.data.list.length == 0 && res.data.total > 0) { if (res.data.list.length == 0 && res.data.total > 0) {
res.data.total = 15 res.data.total = 15
res.data.list = [{ res.data.list = [{
orderServiceType: '安装', // 服务类型:安装、维修 orderServiceType: '安装', // 服务类型:安装、维修
...@@ -210,12 +218,13 @@ ...@@ -210,12 +218,13 @@
submissionTime: '2021.04.19 16:24:48', // 提交时间 submissionTime: '2021.04.19 16:24:48', // 提交时间
auditResults: {}, // 审核结果 auditResults: {}, // 审核结果
orderBusinessType: 'R', // 业务类型 R 为抢单 orderBusinessType: 'R', // 业务类型 R 为抢单
orderId:'1100000216' orderId: '1100000216'
}] }]
res.data.list = [...res.data.list, ...res.data.list, ...res.data.list, ...res.data res.data.list = [...res.data.list, ...res.data.list, ...res.data.list, ...res.data
.list, .list,
...res.data.list, ...res.data.list, ...res.data.list, ...res.data.list, ...res ...res.data.list, ...res.data.list, ...res.data.list, ...res.data.list, ...
.data.list, ...res.data.list res
.data.list, ...res.data.list
] ]
} }
} }
...@@ -223,6 +232,8 @@ ...@@ -223,6 +232,8 @@
// 后台需要返回type,防止数据返回延迟期间点击了其他的tab // 后台需要返回type,防止数据返回延迟期间点击了其他的tab
if (res.data.type != self.orderType) return if (res.data.type != self.orderType) return
self.triggered = false;
self._freshing = false;
if (res.data.list) { if (res.data.list) {
self.orderList.push(...res.data.list) self.orderList.push(...res.data.list)
if (self.list[self.types[res.data.type]]) { if (self.list[self.types[res.data.type]]) {
...@@ -245,6 +256,7 @@ ...@@ -245,6 +256,7 @@
if (res.code == 200) { if (res.code == 200) {
console.log("===", res.data) console.log("===", res.data)
if (res.data) { if (res.data) {
var count = 0
self.list.forEach(item => { self.list.forEach(item => {
if (item.name === '待预约') { if (item.name === '待预约') {
item.count = res.data.toAppointmentCount item.count = res.data.toAppointmentCount
...@@ -258,9 +270,16 @@ ...@@ -258,9 +270,16 @@
item.count = res.data.exceptionCount item.count = res.data.exceptionCount
} }
}) })
} var count = 0
// 修改tab总数 for (var i in res.data) {
// ... count += res.data[i]
}
// 修改tab总数
uni.setTabBarBadge({
index: 1,
text: String(count)
})
}
} else { } else {
console.log(res.message, "获取订单数量失败!"); console.log(res.message, "获取订单数量失败!");
} }
...@@ -283,6 +302,25 @@ ...@@ -283,6 +302,25 @@
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/search' url: 'pages/order/search'
}) })
},
onPulling(e) {
console.log("onpulling", e);
},
onRefresh() {
if (this._freshing) return;
this._freshing = true;
this.pageNumber = 0
this.orderList = []
this.loadStatus = 'loading'
this.getOrderCount();
this.getOrderList(this.currentIndex);
},
onRestore() {
this.triggered = 'restore'; // 需要重置
console.log("onRestore");
},
onAbort() {
console.log("onAbort");
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment