|
@@ -13,46 +13,49 @@
|
|
|
<view class="title">今日统计</view>
|
|
|
<view class="header-cont">
|
|
|
<view class="cont-item">
|
|
|
- <text v-if="!titleStatus" >{{otherTotal}}</text>
|
|
|
+ <text v-if="!titleStatus" >{{numTotal}}</text>
|
|
|
<text>完成订单数(个)</text>
|
|
|
<u-loading :show="titleStatus"></u-loading>
|
|
|
</view>
|
|
|
<view class="cont-item">
|
|
|
- <text v-if="!titleStatus" >{{chuyuTotal}}</text>
|
|
|
+ <text v-if="!titleStatus" >{{weightTotal}}</text>
|
|
|
<text>回收重量(kg)</text>
|
|
|
<u-loading :show="titleStatus"></u-loading>
|
|
|
</view>
|
|
|
<view class="cont-item">
|
|
|
- <text v-if="!titleStatus" >{{jianzhuTotal}}</text>
|
|
|
+ <text v-if="!titleStatus" >{{moneyTotal}}</text>
|
|
|
<text>交易金额(元)</text>
|
|
|
<u-loading :show="titleStatus"></u-loading>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 接单按钮 -->
|
|
|
- <view class="btn-view start-btn">
|
|
|
+ <view v-if="workStatus==0 && hasLogin" class="btn-view start-btn">
|
|
|
点击开始接单
|
|
|
</view>
|
|
|
+ <view v-if="workStatus==1 && hasLogin" class="btn-view end-btn">
|
|
|
+ 接单中(点击停止接单)
|
|
|
+ </view>
|
|
|
<!-- 待处理订单 -->
|
|
|
<view class="list">
|
|
|
- <view class="title">
|
|
|
+ <view v-if="hasLogin" class="title">
|
|
|
<view>待处理订单(10个)</view>
|
|
|
</view>
|
|
|
<view class="list-item" v-for="item in listdata" :key="item.id">
|
|
|
- <u-image class="img-icon" :src="item.icon?item.icon:'../../static/logo.jpg'" border-radius="16" width="160" height="160"></u-image>
|
|
|
+ <u-image class="img-icon" :src="item.icon?item.imageHeader:'../../static/def_home_shop.jpg'" border-radius="16" width="160" height="160"></u-image>
|
|
|
<view class="cont-item-right flex_1 flex flex_column justify_between">
|
|
|
<view class="flex align_center justify_between">
|
|
|
- <view class="flex_1 bold ellipsis-one">{{item.name}}</view>
|
|
|
+ <view class="flex_1 bold ellipsis-one">{{item.contactName}}</view>
|
|
|
<view @click="intoWaitOrderDetail()" class="do-btn">去处理</view>
|
|
|
</view>
|
|
|
- <view class="greey-font flex align_center justify_between">
|
|
|
- <view class="dizhi ellipsis-one">{{item.addrDetail}}</view>
|
|
|
+ <view @click="openLocation(item)" class="greey-font flex align_center justify_between">
|
|
|
+ <view class="dizhi ellipsis-one">{{item.contactAddress}}</view>
|
|
|
<view class="flex align_center">
|
|
|
<view class="t-icon t-icon-icon_coordinate location-icon"></view>
|
|
|
- <text>2.9KM</text>
|
|
|
+ <text>{{item.distance}}KM</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="greey-font">2021.05.10 上午,预估50~100kg</view>
|
|
|
+ <view class="greey-font">2021.05.10 上午,预估{{item.reserveWeight}}kg</view>
|
|
|
<view class="flex">
|
|
|
<view class="mark">
|
|
|
纸张类
|
|
@@ -63,6 +66,12 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="nodata" v-if="listdata.length==0 && status!='loading'">
|
|
|
+ <u-empty :text="noDataText" mode="list"></u-empty>
|
|
|
+ </view>
|
|
|
+ <view class="loadmore">
|
|
|
+ <u-loadmore v-if="status=='loading'" :status="status" />
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<!-- 筛选弹框 -->
|
|
|
<search-modal v-if="openScreen" :visible="openScreen" :defaultParams="searchForm" @refresh="refresh" @close="openScreen=false"></search-modal>
|
|
@@ -70,45 +79,28 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import searchModal from './searchModal.vue'
|
|
|
- import {gatherList,gatherTotal} from '@/api/index.js'
|
|
|
+ import {waitOrderQuery,reserveTotal,changeWorkState} from '@/api/index.js'
|
|
|
import { checkLogin } from '@/api/login.js'
|
|
|
import moment from 'moment'
|
|
|
import getDate from '@/libs/getDate.js'
|
|
|
export default {
|
|
|
- components: { searchModal },
|
|
|
data() {
|
|
|
return {
|
|
|
hasLogin: false, // 是否登录
|
|
|
- listdata: [
|
|
|
- {
|
|
|
- name: '百果园(未央路店)',
|
|
|
- addrDetail: '西安市未央区凤城八路海圣诞节回复多少积分',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '百果园(未央路店)',
|
|
|
- addrDetail: '西安市未央区凤城八路海圣诞节回复多少积分',
|
|
|
- }
|
|
|
- ], // 列表数据
|
|
|
- otherTotal: 0, // 其它垃圾总和
|
|
|
- jianzhuTotal: 0, // 建筑垃圾总和
|
|
|
- chuyuTotal: 0, // 厨余垃圾总和
|
|
|
- pageNo: 1, // 当前页码
|
|
|
- pageSize: 10, // 每页条数
|
|
|
- total: 0, // 数据总条数
|
|
|
+ listdata: [], // 列表数据
|
|
|
noDataText: '暂无数据', // 列表请求状态提示语
|
|
|
status: 'loadmore', // 加载中状态
|
|
|
titleStatus: false, // 顶部加载中状态
|
|
|
- openScreen: false, // 是否打开筛选
|
|
|
- searchForm: { // 查询条件
|
|
|
- beginDate: getDate.getRecentday().starttime, // 创建时间默认筛选近7天
|
|
|
- endDate: getDate.getRecentday().endtime, // 创建时间默认筛选近7天
|
|
|
- },
|
|
|
scrollTop: 0, // 滚动条位置
|
|
|
+ numTotal: 0, // 完成订单个数
|
|
|
+ weightTotal: 0, // 回收重量
|
|
|
+ moneyTotal: 0 // 交易金额
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
this.checkUpdate()
|
|
|
+ // 获取当前经纬度
|
|
|
+ // this.getCurPosition()
|
|
|
// 开启分享
|
|
|
uni.showShareMenu({
|
|
|
withShareTicket: true,
|
|
@@ -126,27 +118,14 @@
|
|
|
checkLogin().then(res => {
|
|
|
this.hasLogin = res.status == 200
|
|
|
if(this.hasLogin){
|
|
|
- // this.pageInit()
|
|
|
+ this.getCurPosition()
|
|
|
+ this.getTotalData()
|
|
|
} else {
|
|
|
- this.noDataText = '您尚未登录或登录已过期,完成登录后可查看录入信息!'
|
|
|
+ this.noDataText = '您尚未登录或登录已过期!'
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
- pageInit() {
|
|
|
- this.pageNo = 1
|
|
|
- this.pageSize = 10
|
|
|
- this.total = 0
|
|
|
- this.scrollTop = 0
|
|
|
- this.otherTotal= 0 // 其它垃圾总和
|
|
|
- this.jianzhuTotal= 0 // 建筑垃圾总和
|
|
|
- this.chuyuTotal= 0 // 厨余垃圾总和
|
|
|
- this.searchForm.beginDate = getDate.getRecentday().starttime
|
|
|
- this.searchForm.endDate = getDate.getRecentday().endtime
|
|
|
- console.log(this.searchForm,'this.searchForm')
|
|
|
- this.searchHandle()
|
|
|
- this.getTotal()
|
|
|
- },
|
|
|
// 检查更新
|
|
|
checkUpdate(){
|
|
|
if (uni.canIUse('getUpdateManager')) {
|
|
@@ -181,16 +160,56 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ // 获取当前位置
|
|
|
+ getCurPosition () {
|
|
|
+ let _this = this
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'wgs84', // 默认wgs84
|
|
|
+ success: function(res) {
|
|
|
+ console.log(res,'------')
|
|
|
+ let lat = res.latitude
|
|
|
+ let lng = res.longitude
|
|
|
+ // 查询订单信息
|
|
|
+ _this.getList(lat,lng)
|
|
|
+ },
|
|
|
+ fail: function(res) {
|
|
|
+ console.log(res)
|
|
|
+ // 查询订单信息
|
|
|
+ _this.getList()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 待处理订单信息
|
|
|
+ getList (lat,lng) {
|
|
|
+ // let lat = this.currentPosition.lat
|
|
|
+ // let lng = this.currentPosition.lng
|
|
|
+ waitOrderQuery({handleUserLng:lat,handleUserLat:lng}).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if(res.status == 200){
|
|
|
+ this.listdata = res.data
|
|
|
+ this.listdata.forEach(item =>{
|
|
|
+ item.distance = item.distance ? Math.round(item.distance/1000) : ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 今日统计
|
|
|
+ getTotalData() {
|
|
|
+ reserveTotal().then(res=>{
|
|
|
+ if(res.status == 200) {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 打开回收价格页面
|
|
|
openPrice(){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/recoveryPrice/index'
|
|
|
- })
|
|
|
- // if(this.hasLogin){
|
|
|
- // uni.navigateTo({
|
|
|
- // url: '/pages/recoveryPrice/index'
|
|
|
- // })
|
|
|
- // }
|
|
|
+ if(this.hasLogin){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/recoveryPrice/index'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.loginModal()
|
|
|
+ }
|
|
|
},
|
|
|
// 进入待处理订单详情
|
|
|
intoWaitOrderDetail(){
|
|
@@ -198,96 +217,32 @@
|
|
|
url: '/pages/order/waitOrderDetail'
|
|
|
})
|
|
|
},
|
|
|
- // 获取查询参数 刷新列表
|
|
|
- refresh(params){
|
|
|
- this.searchForm = params
|
|
|
- this.listdata = []
|
|
|
- this.total = 0
|
|
|
- this.searchHandle(1)
|
|
|
- this.getTotal()
|
|
|
- },
|
|
|
- // 搜索查询
|
|
|
- searchHandle (pageNo) {
|
|
|
- this.status = "loading"
|
|
|
- pageNo ? this.pageNo = pageNo : null
|
|
|
- gatherList({
|
|
|
- pageNo: this.pageNo,
|
|
|
- pageSize: this.pageSize,
|
|
|
- beginDate: this.searchForm.beginDate?moment(this.searchForm.beginDate).format('YYYY-MM-DD 00:00:00'):'',
|
|
|
- endDate: this.searchForm.endDate ? moment(this.searchForm.endDate).format('YYYY-MM-DD 23:59:59'):'',
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- if(this.pageNo>1){
|
|
|
- this.listdata = this.listdata.concat(res.data.list || [])
|
|
|
- }else{
|
|
|
- this.listdata = res.data.list || []
|
|
|
- this.scrollTop = 0
|
|
|
- }
|
|
|
- this.total = res.data.count || 0
|
|
|
- this.noDataText = '暂无数据'
|
|
|
- } else {
|
|
|
- this.noDataText = res.message
|
|
|
- this.listdata = []
|
|
|
- this.total = 0
|
|
|
- }
|
|
|
- this.status = "loadmore"
|
|
|
- })
|
|
|
+ // 导航
|
|
|
+ openLocation(item) {
|
|
|
+ uni.openLocation({
|
|
|
+ latitude: item.lat - 0,
|
|
|
+ longitude: item.lng - 0,
|
|
|
+ name: item.name,
|
|
|
+ address: item.contactAddress
|
|
|
+ });
|
|
|
},
|
|
|
- // scroll-view到底部加载更多
|
|
|
- onreachBottom() {
|
|
|
- console.log(111111)
|
|
|
- if(this.listdata.length < this.total){
|
|
|
- this.pageNo += 1
|
|
|
- this.searchHandle()
|
|
|
- }else{
|
|
|
- uni.showToast({ title: '已经到底了', icon: 'none' })
|
|
|
- this.status = "nomore"
|
|
|
- }
|
|
|
- },
|
|
|
- // 总计
|
|
|
- getTotal(){
|
|
|
- this.titleStatus = true
|
|
|
- gatherTotal({
|
|
|
- beginDate: this.searchForm.beginDate?moment(this.searchForm.beginDate).format('YYYY-MM-DD 00:00:00'):'',
|
|
|
- endDate: this.searchForm.endDate ? moment(this.searchForm.endDate).format('YYYY-MM-DD 23:59:59'):''}).then(res=>{
|
|
|
- if(res.status==200){
|
|
|
- const a = res.data.find(item=>item.rubbishType=='GATHER_BUILDING')
|
|
|
- const b = res.data.find(item=>item.rubbishType=='GATHER_OTHER')
|
|
|
- const c = res.data.find(item=>item.rubbishType=='GATHER_KITCHEN')
|
|
|
- this.jianzhuTotal= a ? (a.rubbishWeight/1000).toFixed(3)/1 : '0'
|
|
|
- this.chuyuTotal= c ? (c.rubbishWeight/1000).toFixed(3)/1 : '0'
|
|
|
- this.otherTotal= b ? (b.rubbishWeight/1000).toFixed(3)/1 : '0'
|
|
|
- }
|
|
|
- console.log(res)
|
|
|
- this.titleStatus = false
|
|
|
- })
|
|
|
+ // 未登录弹窗
|
|
|
+ loginModal(){
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '您尚未登录或登录已过期,请登录后使用',
|
|
|
+ success: (res)=> {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ })
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
- // 打开垃圾数据录入页面
|
|
|
- intoPage(item) {
|
|
|
-
|
|
|
- uni.navigateTo({
|
|
|
- url: url
|
|
|
- })
|
|
|
- if(!this.hasLogin){
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '您尚未登录或登录已过期,请登录后使用',
|
|
|
- success: (res)=> {
|
|
|
- if (res.confirm) {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login'
|
|
|
- })
|
|
|
- } else if (res.cancel) {
|
|
|
- console.log('用户点击取消');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.navigateTo({
|
|
|
- url: url
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|