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">
...@@ -98,42 +98,12 @@ ...@@ -98,42 +98,12 @@
data() { data() {
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-for="(item, index) in orderList" :key="index"> <!-- 入驻成功之后无推荐订单 -->
<OrderCell :orderData="item" type="waitAccept" :location="location" @click="handleClick(item.orderId)" <view v-if="orderList.length <= 0 && loadedOrder" class="no-order-view">
@action="handleAction(item.orderId)"> </OrderCell> <NoOrder />
</view> </view>
<u-loadmore :status="currentLoadStatus" bgColor="#f2f2f2"></u-loadmore> <view v-else class="order-item-view">
</view> <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom"
<!-- 入驻成功之后无推荐订单 --> scroll-anchoring>
<view v-else-if="!needSettled && orderList.length <= 0" class="no-order-view"> <view v-for="(item, index) in orderList" :key="index">
<NoOrder/> <OrderCell :orderData="item" type="waitAccept" :location="location"
</view> @click="handleClick(item.orderId)" @action="handleAction(item.orderId)">
</OrderCell>
</view>
<u-loadmore :status="currentLoadStatus" bgColor="#F4F5F7"></u-loadmore>
</scroll-view>
</view>
</template>
</view> </view>
</view> </view>
<!-- </view> --> <!-- </view> -->
...@@ -60,7 +67,7 @@ ...@@ -60,7 +67,7 @@
<script> <script>
import util from "@/utils/util.js"; import util from "@/utils/util.js";
import TabBarPage from "@/components/tabBarList/index.vue" import TabBarPage from "@/components/tabBarList/index.vue"
import NoOrder from "@/components/order/noOrder.vue" import NoOrder from "@/components/order/noOrder.vue"
const app = getApp(); const app = getApp();
import OrderCell from "@/components/order/index.vue"; import OrderCell from "@/components/order/index.vue";
...@@ -68,7 +75,7 @@ ...@@ -68,7 +75,7 @@
export default { export default {
components: { components: {
OrderCell, OrderCell,
TabBarPage, TabBarPage,
NoOrder NoOrder
}, },
data() { data() {
...@@ -78,23 +85,22 @@ ...@@ -78,23 +85,22 @@
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: {
vuex_token(val, oldVal) { vuex_token(val, oldVal) {
// 监听token变化,如果更新则重新加载页面数据 // 监听token变化,如果更新则重新加载页面数据
console.log('', val, oldVal) console.log('', val, oldVal)
val && this.initSettleInfo() val && this.initSettleInfo()
} }
...@@ -120,23 +126,19 @@ ...@@ -120,23 +126,19 @@
}, },
shouyeyouImage() { shouyeyouImage() {
return process.uniEnv.qn_base_url + 'shouyeyou.png' return process.uniEnv.qn_base_url + 'shouyeyou.png'
}, },
weiruzhuImage() { weiruzhuImage() {
return process.uniEnv.qn_base_url + 'weiruzhu.png' return process.uniEnv.qn_base_url + 'weiruzhu.png'
}, },
}, },
onLoad() { onLoad() {
this.getOrderCount() this.getOrderCount()
}, },
onShow() { onShow() {
// 每次进入页面都刷新入驻状态 // 每次进入页面都刷新入驻状态
if (this.vuex_token) { if (this.vuex_token) {
this.initSettleInfo(); this.initSettleInfo();
} }
// else {
// // 初始化订单数据
// this.loadOrderList();
// }
}, },
onPullDownRefresh() { onPullDownRefresh() {
console.log('------下拉刷新------') console.log('------下拉刷新------')
...@@ -146,17 +148,17 @@ ...@@ -146,17 +148,17 @@
methods: { methods: {
handleClick(orderId) { // 点击了cell handleClick(orderId) { // 点击了cell
console.log('点击了cell') console.log('点击了cell')
this.viewOderItem(orderId) this.viewOderItem(orderId)
}, },
handleAction(orderId) { // 点击了按钮 handleAction(orderId) { // 点击了按钮
console.log('点击了按钮') console.log('点击了按钮')
this.viewOderItem(orderId) this.viewOderItem(orderId)
}, },
viewOderItem(orderId) { // 跳转工单详情页面 viewOderItem(orderId) { // 跳转工单详情页面
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/detail?id=' + orderId url: 'pages/order/detail?id=' + orderId
}) })
}, },
async initSettleInfo() { async initSettleInfo() {
let self = this; let self = this;
...@@ -165,13 +167,15 @@ ...@@ -165,13 +167,15 @@
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
} }
}; };
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() {
...@@ -276,29 +299,29 @@ ...@@ -276,29 +299,29 @@
}); });
} }
}, },
// 获取订单数量 // 获取订单数量
getOrderCount() { getOrderCount() {
var self = this; // 加载订单列表 var self = this; // 加载订单列表
self.$u.api.listOrderCount().then((res) => { self.$u.api.listOrderCount().then((res) => {
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 var count = 0
for (var i in res.data) { for (var i in res.data) {
count += res.data[i] count += res.data[i]
} }
// 修改tab总数 // 修改tab总数
uni.setTabBarBadge({ uni.setTabBarBadge({
index: 1, index: 1,
text: String(count) text: String(count)
}) })
} }
} else { } else {
console.log(res.message, "获取订单数量失败!"); console.log(res.message, "获取订单数量失败!");
} }
}); });
}, },
}, },
}; };
</script> </script>
...@@ -414,19 +437,20 @@ ...@@ -414,19 +437,20 @@
background-color: #ffffff; background-color: #ffffff;
border-radius: 12rpx; border-radius: 12rpx;
min-height: 460rpx; min-height: 460rpx;
.tip-view-image {
width: 328rpx; .tip-view-image {
height: 200rpx; width: 328rpx;
margin-top: 30rpx; height: 200rpx;
margin-top: 30rpx;
} }
.tip-other { .tip-other {
font-size: 28rpx; font-size: 28rpx;
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