123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364 |
- <template>
- <view class="content">
- <view class="content-top">
- <view class="top-banner">
- <u-swiper :list="bannerList" class="banner"></u-swiper>
- </view>
- </view>
- <view class="content-bottom">
- <!-- 预约 -->
- <u-button :custom-style="yuYueBtn" :hair-line="false" @click="gotoYueYu">一键预约</u-button>
- <!-- 接单信息 -->
- <view class="bottom-new-notice">
- <view class="notice-content">
- <view class="notice-content-item"><span class="t-icon t-icon-home_icon_bells"></span><span class="item-title">最新通知</span></view>
- <view class="notice-content-item">骑手<span>{{orderStatusText ? orderStatusText :''}},</span>请耐心等待</view>
- <view class="notice-content-item">{{orderTime ? orderTime :''}}</view>
- </view>
- <view class="notice-static">
- <span class="notice-static-text">{{orderStatusText ? orderStatusText :''}}</span>
- </view>
- </view>
- <!-- 回收指引 -->
- <view class="bottom-zhiyin" @click="toZY">
- <u-image src="/static/houme_bg_guide.png" mode="" height="160"></u-image>
- </view>
- <!-- 收回统计 -->
- <view class="statistics-title">今日上门回收价格</view>
- <view class="bottom-statistics" v-if="hasLogin">
- <view class="statistics-rubbishType">
- <view class="statistics-box">
- <view class="rubbishType-type"><span class="t-icon t-icon-home_icon_paper" style="display: inline-block;margin: 0 10upx;"></span>{{rubbishPaperName ? rubbishPaperName :''}}</view>
- <view v-for="item in rubbishPaperList" class="rubbishType-item">
- <view>{{item.name ? item.name+':' :''}}{{item.customerPrice ? (item.customerPrice/1000).toFixed(2)/1 :0}} 元/kg</view>
- </view>
- </view>
- <view class="statistics-box">
- <view class="rubbishType-type"><span class="t-icon t-icon-home_icon_clothing" style="display: inline-block;margin: 0 10upx;"></span>{{rubbishYWName ? rubbishYWName :''}}</view>
- <view v-for="item in rubbishYWList" class="rubbishType-item">
- <view>{{item.name ? item.name+':' :''}}{{item.customerPrice ? (item.customerPrice/1000).toFixed(2)/1 :0}} 元/kg</view>
- </view>
- </view>
- </view>
- <view class="statistics-rubbishType">
- <view class="statistics-box">
- <view class="rubbishType-type"><span class="t-icon t-icon-home_icon_plastic" style="display: inline-block;margin: 0 10upx;"></span>{{rubbishSLName ? rubbishSLName :''}}</view>
- <view v-for="item in rubbishSLList" class="rubbishType-item">
- <view>{{item.name ? item.name+':' :''}}{{item.customerPrice ? (item.customerPrice/1000).toFixed(2)/1 :0}} 元/kg</view>
- </view>
- </view>
- <view class="statistics-box">
- <view class="rubbishType-type"><span class="t-icon t-icon-home_icon_metal" style="display: inline-block;margin: 0 10upx;"></span>{{rubbishJSName ? rubbishJSName :''}}</view>
- <view v-for="item in rubbishJSList" class="rubbishType-item">
- <view>{{item.name ? item.name+':' :''}}{{item.customerPrice ? (item.customerPrice/1000).toFixed(2)/1 :0}} 元/kg</view>
- </view>
- </view>
- </view>
- </view>
- <view class="nodata" v-if="!hasLogin">
- <u-empty :text="noDataText" mode="data"></u-empty>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {getBannerList,geRubbishType,orderStatus} from '@/api/index'
- import { checkLogin } from '@/api/login.js'
- export default {
- components: { },
- data() {
- return {
- yuYueBtn:{
- background: "#4F88F7",
- borderRadius: "12px",
- color:'#fff',
- },
- hasLogin:false, // 是否登录
- noDataText:"", // 未登录提示文字
- orderStatusText:'', // 订单状态
- orderTime:'', //
- bannerList:[],
- rubbishPaperName:"",
- rubbishSLName:"",
- rubbishYWName:"",
- rubbishJSName:"",
- rubbishPaperList:[],
- rubbishSLList:[],
- rubbishYWList:[],
- rubbishJSList:[]
- }
- },
- onLoad() {
- this.pageInit()
- },
- onUnload() {
-
- },
- onShareAppMessage(res) {
- },
- onShareTimeline(res) {
- },
- onShow() {
- checkLogin().then(res => {
- this.hasLogin=res.status==200
- if(this.hasLogin){
- this.pageInit()
- }else{
- this.noDataText="您尚未登录或登录已过期,完成登录后可查看数据信息!"
- }
- })
- },
- methods: {
- pageInit() {
- this.getBanner()
- this.geRubbishTypeList()
- this.getOrderStatus()
- },
- // 获取banner图
- getBanner(){
- getBannerList().then(res=>{
- if(res.status==200){
- this.bannerList=res.data || []
- }
- console.log(res,'-----banner')
- })
- },
- // 获取订单状态
- getOrderStatus(){
- orderStatus().then(res=>{
- if(res.status==200){
- this.orderStatusText=res.data.orderStatusDictValue
- this.orderTime=res.data.createDate
- console.log(res,'----------订单状态')
- }
- })
- },
- // 获取垃圾分类
- geRubbishTypeList(){
- geRubbishType().then(res=>{
- if(res.status==200){
- console.log(res,'---------垃圾类型')
- const a= res.data.find(item=>item.code=='PAPER')
- const b= res.data.find(item=>item.code=='PLASTIC')
- const c= res.data.find(item=>item.code=='CLOTHES')
- const d= res.data.find(item=>item.code=='METAL')
- this.rubbishPaperList=a.rubbishTypeVOList
- this.rubbishSLList=b.rubbishTypeVOList
- this.rubbishYWList=c.rubbishTypeVOList
- this.rubbishJSList=d.rubbishTypeVOList
- this.rubbishPaperName=a.name
- this.rubbishSLName=b.name
- this.rubbishYWName=c.name
- this.rubbishJSName=d.name
- }
- })
- },
- gotoYueYu(){
- uni.navigateTo({
- url: '/pages/index/yuyue'
- })
- },
- // 回收指引
- toZY(){
- uni.navigateTo({
- url: '/pages/index/zhiyin'
- })
- },
- // 检查更新
- checkUpdate(){
- // if (uni.canIUse('getUpdateManager')) {
- // const updateManager = uni.getUpdateManager()
- // updateManager.onCheckForUpdate(function (res) {
- // console.log('onCheckForUpdate====', res)
- // // 请求完新版本信息的回调
- // if (res.hasUpdate) {
- // console.log('res.hasUpdate====')
- // updateManager.onUpdateReady(function () {
- // uni.showModal({
- // title: '更新提示',
- // content: '新版本已经准备好,是否重启应用?',
- // success: function (res) {
- // console.log('success====', res)
- // // res: {errMsg: "showModal: ok", cancel: false, confirm: true}
- // if (res.confirm) {
- // // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- // updateManager.applyUpdate()
- // }
- // }
- // })
- // })
- // updateManager.onUpdateFailed(function () {
- // // 新的版本下载失败
- // uni.showModal({
- // title: '已经有新版本了哟~',
- // content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
- // })
- // })
- // }
- // })
- // }
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- },
- // 总计
- 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
- // })
- },
- // 打开垃圾数据录入页面
- intoPage(item) {
- // const flag=item ? item.gatherId : ''
- // console.log(flag,'---------hangid,;;;;')
- // let url = flag ? `/pages/index/addData?id=${flag}` : `/pages/index/addData`
- // // 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>
- <style lang="scss" scoped>
- .content {
- width: 100%;
- height: 100vh;
- display: flex;
- flex-direction: column;
- padding: 0;
- .content-top{
- width: 100%;
- height:260upx ;
- background-color: #4F88F7;
- border-bottom-left-radius: 50%; /* 左下角 */
- border-bottom-right-radius:50%; /* 右下角 */
- opacity: 1;
- .top-banner{
- padding: 20upx 30upx 0;
- .banner{
- width:100%;
- height: 140px;
- }
- }
- }
- .content-bottom{
- padding: 30upx;
- background-color: #f5f5f5;
- .bottom-new-notice{
- background-image: url('../../static/home_bg_expressage.png');
- height:220upx;
- margin: 30upx 0;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20upx 30upx;
- .notice-content{
- .notice-content-item{
- margin: 15upx 0;
- display: flex;
- align-items: center;
- .item-title{
- display: inline-block;
- margin-left: 20upx;
- }
- }
- .notice-content-item:last-child{
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #7C7D7E;
- }
- }
- .notice-static{
- width:186upx;
- height: 108upx;
- background-image: url('../../static/home_sign_rider.png');
- .notice-static-text{
- position: relative;
- top:21upx;
- left:85upx
- }
- }
- }
- .bottom-zhiyin{
- margin-bottom: 30upx;
- }
- .statistics-title{
- font-size: 36upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #191919;
- opacity: 1;
- margin-bottom: 30upx;
- }
- .bottom-statistics{
- display: flex;
- width: 100%;
- justify-content: space-between;
- .statistics-rubbishType{
- width: 48%;
- .statistics-box{
- margin-bottom:30upx ;
- background-color: #fff;
- padding: 20upx;
- border-radius:16upx;
- }
- .statistics-box:last-child{
- margin-bottom:0 ;
- }
- }
- .rubbishType-type{
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #000000;
- }
- .rubbishType-item{
- display: flex;
- justify-content: center;
- margin:10upx 0 ;
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #444444;
- }
- }
- }
- }
- </style>
|