混凝土运输管理微信小程序、替班
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

167 lines
3.8 KiB

<template>
<view class="content">
<view class="head flex-sb sticky box-shadow-light">
<view class="flex" @click="seacher">
<view class="mr5"><uni-icons type="search" size="18"/></view>
<view v-if="+seacht===0" style="font-size: 28rpx;">筛选</view>
<input v-model="input" :class="{'active':+seacht===1}" maxlength="10"
class="search-input" type="text" confirm-type="search" @confirm="loadPage"/>
</view>
<view class="flex" @click="selectOnline" v-if="status===0" >
<view style="font-size: 28rpx;color: #F40000;font-weight: bolder;">
· 在线
</view>
<uni-icons type="down" size="12" color="#F40000"/>
</view>
<view class="flex" @click="selectOnline" v-if="status===1" >
<view style="font-size: 28rpx;color: #555555;font-weight: bolder;">
· 离线
</view>
<uni-icons type="down" size="12" color="#555555"/>
</view>
</view>
<view class="m20">
<view class="re-empty" v-if="waits.length<1">
<view>暂无数据</view>
</view>
<view v-for="e in waits" class="b-relative item-card mb20">
<view class="m10 flex-sb">
<view class="ellipsis">{{e.address}}</view>
<view class="item-time">{{ $timeUtils.formatTime(e.create_time) }}</view>
</view>
<view>到场时间:{{$timeUtils.formatTime2Day(e.in_time)}}</view>
<view>计划数量:{{e.mi}}m³/趟</view>
<view class="item-button" @click="clickDetail(e.id)">去接单</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
status: 0,
seacht: 0,
waits: [],
input: ''
}
},
mounted() {
this.seacht = 0
this.loadOnline()
this.loadPage()
},
methods: {
clickDetail(id){ uni.navigateTo({ url: `/pages/user/orderd?id=${id}` }) },
seacher() { this.seacht = 1 },
loadPage(){
this.seacht = 0
uni.showLoading({})
this.$httpGet("/api/order/user", { seo: this.input }, (res) => {
console.log('[/order/user]', res);
uni.hideLoading({})
this.waits = []
if(res.data){
this.waits = this.$utils.toArray(res.data)
}
})
},
loadOnline(){
this.$httpGet("/api/online/get", {}, (res) => {
console.log('[/online/get]', res);
if(res.data){
this.status= +res.data
}
})
},
selectOnline(){
uni.showActionSheet({
itemList: ["在线", "离线"],
success: (res) => {
this.status = res.tapIndex
this.$httpGet("/api/online/set", {online: res.tapIndex}, (res) => {
console.log('[/online/set]', res);
if(res.data || res.data == 0){
// TODO
}
})
uni.showToast({ icon: "loading", title: "正在更改设置" })
setTimeout(() => {
uni.hideToast()
if(res.tapIndex>0){
uni.showToast({ icon: "none", title:"离线状态不可接单" })
} else {
uni.showToast({ icon: "none", title:"您已上线" })
}
}, 1000)
}
})
},
}
}
</script>
<style>
page {
background-color: #f5f5f5;
}
.search-input{
font-size: 28rpx;
margin-top: 10rpx;
border-bottom: 2rpx solid #999;
line-height: 32rpx;
width: 0;
transition: .3s ease-in-out;
}
.active{
width: 70%;
padding-left: 10rpx;
}
.head{
height: 60rpx;
line-height: 60rpx;
padding: 0 40rpx;
background-color: #fff;
}
.item-card{
width: calc(100vw - 60rpx);
height: calc(236rpx - 60rpx);
background: #ffffff;
padding: 30rpx;
font-size: 24rpx;
line-height: 42rpx;
color: #333333;
}
.item-button{
position: absolute;
left: 533rpx;
top: 134.42rpx;
width: 182rpx;
height: 52rpx;
line-height: 52rpx;
border-radius: 8rpx;
opacity: 1;
box-sizing: border-box;
border: 2rpx solid #F70303;
font-size: 28rpx;
font-weight: normal;
text-align: center;
letter-spacing: 0px;
color: #F70303;
}
.item-time{
color: #aaa;
width: 160rpx;
text-align: right;
}
</style>