Commit 36dcc902 authored by 刘用法's avatar 刘用法

首页推荐订单

parent 8d78ae70
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<view> <view>
<view v-if="showCountTime" class="bottom-left-view"> <view v-if="showCountTime" class="bottom-left-view">
<view :class="['bottom-tag-view', {'timeout': timeout}]"><text>{{tagText}}</text></view> <view :class="['bottom-tag-view', {'timeout': timeout}]"><text>{{tagText}}</text></view>
<u-count-down :timestamp="timestamp" font-size="44" <u-count-down :timestamp="timestamp" font-size="44" show-days
:color="timeout ? '#FA5A49' : '#FF930D'" @change="handleChange" ref="order-count-down"></u-count-down> :color="timeout ? '#FA5A49' : '#FF930D'" @change="handleChange" ref="order-count-down"></u-count-down>
</view> </view>
<view v-else-if="showTime"> <view v-else-if="showTime">
...@@ -99,41 +99,11 @@ ...@@ -99,41 +99,11 @@
return { return {
timeout: false, timeout: false,
timestamp: 0, timestamp: 0,
orderType: 0
}; };
}, },
computed: { computed: {
/*
orderStatus:
待接单 orderStatus<31 工单状态小于31
待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空
待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空
待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80
审核中 orderStatus ==85 or orderStatus == 87 工单状态 等于85 或者 等于有87
异常 orderStatus ==86 or orderStatus == 88 工单状态 等于86 或者 等于有88
已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110
*/
orderText() { // 按钮文字 orderText() { // 按钮文字
if (!this.orderType) {
if (this.orderData.orderStatus < 31) {
this.orderType = 0
} else if (this.orderData.orderStatus == 31) {
if (this.orderData.appointmentDatetime) {
return this.orderType = 2
} else {
this.orderType = 1
}
} else if (this.orderData.orderStatus > 31 && this.orderData.orderStatus < 80) {
this.orderType = 3
} else if (this.orderData.orderStatus == 85 && this.orderData.orderStatus == 87) {
this.orderType = 4
} else if (this.orderData.orderStatus == 86 && this.orderData.orderStatus == 88) {
this.orderType = 5
} else if ([80, 81, 89, 110].indexOf(this.orderData.orderStatus) != -1) {
this.orderType = 6
} else {
this.orderType = 0
}
}
return this.typeTexts[this.orderType] return this.typeTexts[this.orderType]
}, },
buttonStyle() { // 按钮样式 buttonStyle() { // 按钮样式
...@@ -229,12 +199,43 @@ ...@@ -229,12 +199,43 @@
'exception': 5, // 异常单、 'exception': 5, // 异常单、
'finish': 6, //已完工 'finish': 6, //已完工
} }
},
orderType() {
return this.types[this.type]
} }
}, },
created() { created() {
/*
orderStatus:
待接单 orderStatus<31 工单状态小于31
待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空
待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空
待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80
审核中 orderStatus ==85 or orderStatus == 87 工单状态 等于85 或者 等于有87
异常 orderStatus ==86 or orderStatus == 88 工单状态 等于86 或者 等于有88
已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110
*/
if (!this.type) {
if (this.orderData.orderStatus < 31) {
this.orderType = 0
} else if (this.orderData.orderStatus == 31) {
if (this.orderData.appointmentDatetime) {
return this.orderType = 2
} else {
this.orderType = 1
}
} else if (this.orderData.orderStatus > 31 && this.orderData.orderStatus < 80) {
this.orderType = 3
} else if (this.orderData.orderStatus == 85 && this.orderData.orderStatus == 87) {
this.orderType = 4
} else if (this.orderData.orderStatus == 86 && this.orderData.orderStatus == 88) {
this.orderType = 5
} else if ([80, 81, 89, 110].indexOf(this.orderData.orderStatus) != -1) {
this.orderType = 6
} else {
this.orderType = 0
}
} else {
this.orderType = this.types[this.type]
}
this.timeout = this.orderData.currentOverTime < new Date().getTime() this.timeout = this.orderData.currentOverTime < new Date().getTime()
this.timestamp = Math.round(Math.abs(this.orderData.currentOverTime - new Date().getTime()) / 1000) this.timestamp = Math.round(Math.abs(this.orderData.currentOverTime - new Date().getTime()) / 1000)
}, },
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</view> </view>
</view> </view>
<!-- 订单推荐吸顶 --> <!-- 订单推荐吸顶 -->
<u-sticky offset-top="60"> <u-sticky offset-top="0">
<view class="sticky"> <view class="sticky">
<text>订单推荐</text> <text>订单推荐</text>
</view> </view>
...@@ -35,17 +35,24 @@ ...@@ -35,17 +35,24 @@
立即入驻 立即入驻
</u-button> </u-button>
</view> </view>
<view v-else-if="!needSettled && orderList.length > 0" class="order-item-view"> <template v-else>
<!-- 入驻成功之后无推荐订单 -->
<view v-if="orderList.length <= 0 && loadedOrder" class="no-order-view">
<NoOrder />
</view>
<view v-else class="order-item-view">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom"
scroll-anchoring>
<view v-for="(item, index) in orderList" :key="index"> <view v-for="(item, index) in orderList" :key="index">
<OrderCell :orderData="item" type="waitAccept" :location="location" @click="handleClick(item.orderId)" <OrderCell :orderData="item" type="waitAccept" :location="location"
@action="handleAction(item.orderId)"> </OrderCell> @click="handleClick(item.orderId)" @action="handleAction(item.orderId)">
</OrderCell>
</view> </view>
<u-loadmore :status="currentLoadStatus" bgColor="#f2f2f2"></u-loadmore> <u-loadmore :status="currentLoadStatus" bgColor="#F4F5F7"></u-loadmore>
</view> </scroll-view>
<!-- 入驻成功之后无推荐订单 -->
<view v-else-if="!needSettled && orderList.length <= 0" class="no-order-view">
<NoOrder/>
</view> </view>
</template>
</view> </view>
</view> </view>
<!-- </view> --> <!-- </view> -->
...@@ -78,18 +85,17 @@ ...@@ -78,18 +85,17 @@
title: false, title: false,
title: "Hello", title: "Hello",
loaded: false, loaded: false,
loadedOrder: false,
needSettled: true, needSettled: true,
count: 0, // 推荐订单数量 count: 0, // 推荐订单数量
messageList: [], messageList: [],
loadStatus: ["more", "loading", "noMore"],
currentLoadStatus: "loading", currentLoadStatus: "loading",
orderList: [], orderList: [],
search: { search: {
token: "", token: "",
pageNumber: 0, pageNumber: 0,
pageSize: 10, pageSize: 100,
}, },
bottomLoading: false
}; };
}, },
watch: { watch: {
...@@ -133,10 +139,6 @@ ...@@ -133,10 +139,6 @@
if (this.vuex_token) { if (this.vuex_token) {
this.initSettleInfo(); this.initSettleInfo();
} }
// else {
// // 初始化订单数据
// this.loadOrderList();
// }
}, },
onPullDownRefresh() { onPullDownRefresh() {
console.log('------下拉刷新------') console.log('------下拉刷新------')
...@@ -165,6 +167,7 @@ ...@@ -165,6 +167,7 @@
if (result && result.record) { if (result && result.record) {
vm.loaded = true; vm.loaded = true;
vm.needSettled = result.needSettled; vm.needSettled = result.needSettled;
vm.needSettled = false
vm.status = Number(result.record.status || '0'); vm.status = Number(result.record.status || '0');
// vm.status = 8 // vm.status = 8
} }
...@@ -172,6 +175,7 @@ ...@@ -172,6 +175,7 @@
await app.getBaseInfo(self, callBack); await app.getBaseInfo(self, callBack);
this.orderList = [] this.orderList = []
this.search.pageNumber = 0
// 加载消息列表 // 加载消息列表
self.loadMessageList(); self.loadMessageList();
self.loadOrderList(); self.loadOrderList();
...@@ -193,14 +197,51 @@ ...@@ -193,14 +197,51 @@
}, },
loadOrderList() { loadOrderList() {
console.log('-----------准备加载推荐列表-----------') console.log('-----------准备加载推荐列表-----------')
this.search.pageNumber += 1
let self = this; let self = this;
// 加载订单列表 // 加载订单列表
self.search.token = self.vuex_token; self.search.token = self.vuex_token;
self.$u.api.listByRecommendOrder(self.search).then((res) => { self.$u.api.listByRecommendOrder(self.search).then((res) => {
uni.stopPullDownRefresh() // 结束下拉刷新 uni.stopPullDownRefresh() // 结束下拉刷新
self.loadedOrder = true
/*↓↓↓↓↓↓↓↓↓↓测试数据↓↓↓↓↓↓↓↓↓↓*/
// if (res.data.list) {
// if (res.data.list.length == 0 && res.data.total > 0) {
// res.data.total = 15
// res.data.list = [{
// orderServiceType: '安装', // 服务类型:安装、维修
// categoryName: '充电桩', // 品类:充电桩
// orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池
// orderNumber: 'OR2021041809827', // 工单编号
// contactName: '郭小清', // 客户信息
// contactPhone: '13631612077', // 联系方式
// contactAddress: '湾街道荔枝花园D座125号', // 详细地址
// contactAddressLatitud: '116.3896', // 联系人地址经度
// contactAddressLongitud: '39.91917', // 联系人地址纬度
// orderStatus: 0, // 工单状态
// appointmentDatetime: '', // 预约时间
// currentWillOverTime: 10000, // 剩余时间
// currentOverTime: new Date().getTime() + 10000, // 超过时间点
// auditDatetime: '2021.04.19 12:45:09', // 审核时间
// submissionTime: '2021.04.19 16:24:48', // 提交时间
// auditResults: {}, // 审核结果
// orderBusinessType: 'R', // 业务类型 R 为抢单
// orderId: '1100000216'
// }]
// res.data.list = [...res.data.list, ...res.data.list, ...res.data.list, ...res.data
// .list,
// ...res.data.list, ...res.data.list, ...res.data.list, ...res.data.list, ...
// res
// .data.list, ...res.data.list
// ]
// }
// }
/*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/
if (res.code == 200) { if (res.code == 200) {
if (res.data && res.data.list && res.data.list.length > 0) { if (res.data && res.data.list && res.data.list.length > 0) {
self.orderList.push(...res.data.list); self.orderList.push(...res.data.list);
self.currentLoadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore'
} }
} else { } else {
console.log(res.message, "初始化订单列表异常"); console.log(res.message, "初始化订单列表异常");
...@@ -211,27 +252,9 @@ ...@@ -211,27 +252,9 @@
this.triggered = "restore"; this.triggered = "restore";
}, },
reachBottom() { reachBottom() {
console.log("-----bottom will-----"); if (this.currentLoadStatus != 'loadmore') return
if (this.bottomLoading || this.currentLoadStatus == this.loadStatus[2]) { this.currentLoadStatus == 'loading'
return; this.loadOrderList()
}
console.log("-----bottom did-----");
this.bottomLoading = true;
setTimeout(() => {
// 加载更多数据
// ...
this.orderList.push(...[{}, {}, {}, {}, {}, {}, {}, {}, {}, {}]);
// 加载完成
this.currentLoadStatus = false /*是否还有*/ ?
this.loadStatus[1] :
this.loadStatus[2];
this.$nextTick(function() {
this.bottomLoading = false;
});
}, 1000);
}, },
// clickSwiper(index) {}, // clickSwiper(index) {},
handleScroll() { handleScroll() {
...@@ -414,6 +437,7 @@ ...@@ -414,6 +437,7 @@
background-color: #ffffff; background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
min-height: 460rpx; min-height: 460rpx;
.tip-view-image { .tip-view-image {
width: 328rpx; width: 328rpx;
height: 200rpx; height: 200rpx;
...@@ -425,8 +449,8 @@ ...@@ -425,8 +449,8 @@
color: #333333; color: #333333;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.settle-button {
} .settle-button {}
} }
.order-item-view { .order-item-view {
......
...@@ -194,6 +194,40 @@ ...@@ -194,6 +194,40 @@
var self = this; var self = this;
self.$u.api.listOrder(param).then((res) => { self.$u.api.listOrder(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
/*↓↓↓↓↓↓↓↓↓↓测试数据↓↓↓↓↓↓↓↓↓↓*/
// res.data.type = self.orderType
// if (res.data.list) {
// if (res.data.list.length == 0 && res.data.total > 0) {
// res.data.total = 15
// res.data.list = [{
// orderServiceType: '安装', // 服务类型:安装、维修
// categoryName: '充电桩', // 品类:充电桩
// orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池
// orderNumber: 'OR2021041809827', // 工单编号
// contactName: '郭小清', // 客户信息
// contactPhone: '13631612077', // 联系方式
// contactAddress: '湾街道荔枝花园D座125号', // 详细地址
// contactAddressLatitud: '116.3896', // 联系人地址经度
// contactAddressLongitud: '39.91917', // 联系人地址纬度
// orderStatus: 0, // 工单状态
// appointmentDatetime: '', // 预约时间
// currentWillOverTime: 10000, // 剩余时间
// currentOverTime: new Date().getTime() + 10000, // 超过时间点
// auditDatetime: '2021.04.19 12:45:09', // 审核时间
// submissionTime: '2021.04.19 16:24:48', // 提交时间
// auditResults: {}, // 审核结果
// orderBusinessType: 'R', // 业务类型 R 为抢单
// orderId: '1100000216'
// }]
// res.data.list = [...res.data.list, ...res.data.list, ...res.data.list, ...res.data
// .list,
// ...res.data.list, ...res.data.list, ...res.data.list, ...res.data.list, ...
// res
// .data.list, ...res.data.list
// ]
// }
// }
/*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/
// 后台需要返回type,防止数据返回延迟期间点击了其他的tab // 后台需要返回type,防止数据返回延迟期间点击了其他的tab
if (res.data.type != self.orderType) return if (res.data.type != self.orderType) return
self.triggered = false; self.triggered = false;
......
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