dingdong-master/pages/index/index-home.vue

369 lines
11 KiB
Vue
Raw Normal View History

2022-04-29 17:23:40 +08:00
<template>
<view>
2022-05-24 18:03:36 +08:00
<view class="padding bg-gradual-color"
:style="'padding-top: ' + pageContentTop + 'px; padding-bottom: 100rpx;'">
2022-04-29 17:23:40 +08:00
<!-- 个人信息栏 -->
<view class="flex justify-between padding-bottom align-center solid-bottom">
<view class="flex justify-start align-center">
<view class="cu-avatar round"
2022-06-22 17:40:50 +08:00
:style="'width: 120rpx; height: 120rpx; background-image:url(' + curUserInfo.deptLogoUrl + ');'">
2022-05-24 18:03:36 +08:00
</view>
2022-04-29 17:23:40 +08:00
<view class="margin-lr-sm">
2022-06-22 17:40:50 +08:00
<view class="text-xl margin-bottom-xs">{{curUserInfo.deptName}}</view>
2022-04-29 17:23:40 +08:00
<!-- <view class="padding-xs text-sm">
<view class='cu-tag bg-white radius'>编辑</view>
</view> -->
</view>
</view>
<view class="right-tag padding-lr padding-tb-xs" @click="showMasterRule">师傅规则</view>
2022-04-29 17:23:40 +08:00
</view>
<!-- 未预约未派单上门超时 -->
<view class="cu-list grid no-border col-3 margin-top-sm" style="background-color: inherit;">
<view class="cu-item">
<view class="margin-bottom-xs text-xxl">{{myInfo.order.noReservation}}</view>
<view>未预约</view>
</view>
<view class="cu-item">
<view class="margin-bottom-xs text-xxl">{{myInfo.order.noSchedule}}</view>
<view>未排单</view>
</view>
<view class="cu-item">
<view class="margin-bottom-xs text-xxl">{{myInfo.order.onsiteTimeout}}</view>
<view>上门超时</view>
</view>
</view>
</view>
<view class="margin-lr-sm paper-drawer-bar margin-bottom-with-bar">
<!-- 今日待上门 -->
<view class="bg-white padding-lr shadow-warp">
<view class="cu-bar margin-top-sm solid-bottom">
<view class="action bar-first-action">
<view class="cuIcon-title text-main-color"></view>
<text>今日待上门({{myInfo.order.onsiteToday.length}})</text>
</view>
<view class="flex justify-end text-sm align-center">
<text>即将上门订单</text>
<text class="cuIcon-right"></text>
</view>
</view>
<!-- 轮播 -->
<swiper class="screen-swiper" :autoplay="true" :circular="true">
<swiper-item v-for="(item,index) in myInfo.order.onsiteToday" :key="index">
<view class="padding-sm">
<view class="flex justify-between align-center margin-bottom-xs">
<view class="text-lg">{{item.work}}</view>
<view class="text-red">{{item.datetime}}</view>
</view>
<view>地址{{item.address}}</view>
</view>
</swiper-item>
</swiper>
</view>
<!-- 每周公告 -->
<view class="padding bg-white shadow-warp margin-top-sm">
<view class="flex justify-between align-center">
<view class="">
<text class="text-main-color">[每周公告]</text>
<text>{{myInfo.weekNotice.title}}</text>
</view>
<view class="flex justify-end">
<view class="cu-tag badge" v-if="myInfo.weekNotice.ifHasNoReadNotice"></view>
<view class="cuIcon-right"></view>
</view>
</view>
</view>
<!-- 功能模块 -->
2022-05-24 18:03:36 +08:00
<view class="margin-lr-sm margin-top">
2022-04-29 17:23:40 +08:00
<view class="text-lg">服务中心</view>
2022-05-24 18:03:36 +08:00
<view class="nav-list-panel float-clear clearfix">
<navigator hover-class="none" :url="item.pageUrl" class="nav-li" navigateTo
:class="'bg-'+item.color" :style="[{animation: 'show ' + ((index+1)*0.2+1) + 's 1'}]"
2022-04-29 17:23:40 +08:00
v-for="(item,index) in servModules " :key="index">
2022-05-24 18:03:36 +08:00
<view :class="index === 0 ? 'text-xxl' : 'text-xl'">{{item.title}}</view>
<!-- <view class="nav-name">{{item.name}}</view> -->
2022-04-29 17:23:40 +08:00
<text :class="'cuIcon-' + item.cuIcon"></text>
</navigator>
</view>
</view>
</view>
<!-- 首页引导 -->
<view class="cu-modal" :class="isShowSteer?'show':''">
<view class="cu-dialog">
<view class="padding-xl">
<view class="cuIcon-discover big-icon padding-tb text-main-color"></view>
<view>请您选择入驻类型到家服务类请选择-服务商商品销售类请选择-配件商</view>
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-black" @tap="hideModal" data-modal="isShowSteer" @click="chooseEntryType(1)">配件商
2022-06-23 17:33:19 +08:00
</view>
2022-04-29 17:23:40 +08:00
<view class="action margin-0 flex-sub text-main-color solid-left" @tap="hideModal"
data-modal="isShowSteer" @click="chooseEntryType(0)">服务商</view>
2022-04-29 17:23:40 +08:00
</view>
</view>
</view>
<!-- 接单认证模态框 -->
<view class="cu-modal" :class="showTakeCertifiedModal?'show':''">
<view class="cu-dialog">
<view class="padding-xl">
<view class="cuIcon-profile big-icon padding-tb text-main-color"></view>
<view>您还未进行认证</view>
</view>
<view class="cu-bar bg-white solid-top">
<view class="action margin-0 flex-sub text-black" data-modal="showTakeCertifiedModal"
@tap="hideModal">以后认证</view>
<view class="action margin-0 flex-sub text-main-color solid-left"
data-modal="showTakeCertifiedModal" @tap="hideModal" @click="chooseEntryType(0)">立即认证</view>
</view>
</view>
2022-05-23 17:38:52 +08:00
</view>
<!-- 强制要求用户授权登录的弹窗 -->
<view class="cu-modal" :class="isAuthWxLoginModal?'show':''">
<view class="cu-dialog">
2022-05-24 18:03:36 +08:00
<view class="padding-xl text-left">
<view>需先授权微信登录才可正常使用功能小程序将获取并使用以下信息</view>
<view>1.微信昵称</view>
<view>2.微信头像</view>
2022-05-23 17:38:52 +08:00
</view>
<view class="cu-bar bg-white">
2022-06-23 17:33:19 +08:00
<navigator class="modal-bottom-oper margin-0 flex-sub text-black" open-type="exit"
target="miniProgram">拒绝授权
</navigator>
<view class="modal-bottom-oper margin-0 flex-sub text-main-color solid-left" @tap="authWxLogin">确认授权
</view>
2022-05-23 17:38:52 +08:00
</view>
</view>
2022-04-29 17:23:40 +08:00
</view>
2022-05-24 18:03:36 +08:00
<!-- 手机号授予 -->
<view class="cu-modal" :class="isAuthWxPhoneModal?'show':''">
<view class="cu-dialog">
<view class="padding-xl">
<view>授予小程序绑定微信手机号码的权限</view>
</view>
<view class="cu-bar bg-white">
2022-06-23 17:33:19 +08:00
<navigator class="modal-bottom-oper margin-0 flex-sub text-black solid-right" open-type="exit"
target="miniProgram">拒绝授权
</navigator>
<view class="margin-0 flex-sub">
<button class="margin-0 flex-sub cu-btn bg-white text-main-color" open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber">确认授权</button>
</view>
2022-05-24 18:03:36 +08:00
</view>
</view>
</view>
2022-04-29 17:23:40 +08:00
</view>
</template>
<script>
export default {
2022-06-23 17:33:19 +08:00
name: 'index',
emits: ['changeCurPageCode'],
2022-04-29 17:23:40 +08:00
data() {
return {
pageContentTop: this.CustomBar,
servModules: [{
id: 1,
title: '需求大厅',
name: '查看详情',
color: 'blue',
2022-05-23 17:38:52 +08:00
cuIcon: 'list',
2022-04-29 17:23:40 +08:00
pageUrl: ''
}, {
id: 2,
title: '我的订单',
name: '查看详情',
color: 'orange',
2022-05-23 17:38:52 +08:00
cuIcon: 'text',
2022-05-06 23:47:18 +08:00
pageUrl: '/pages/order-manage/order-manage'
2022-04-29 17:23:40 +08:00
}, {
id: 3,
title: '叮咚学院',
name: '查看详情',
color: 'cyan',
2022-05-23 17:38:52 +08:00
cuIcon: 'emoji',
2022-04-29 17:23:40 +08:00
pageUrl: ''
}, {
id: 4,
title: '邀请师傅',
name: '查看详情',
color: 'pink',
2022-05-23 17:38:52 +08:00
cuIcon: 'profile',
pageUrl: ''
2022-04-29 17:23:40 +08:00
}, {
id: 5,
title: '区域代理',
name: '查看详情',
color: 'olive',
2022-05-23 17:38:52 +08:00
cuIcon: 'group',
pageUrl: '/pages/area-proxy/my-team'
2022-05-23 17:38:52 +08:00
}],
2022-05-09 23:10:42 +08:00
curUserInfo: {},
2022-04-29 17:23:40 +08:00
myInfo: {},
2022-05-23 17:38:52 +08:00
isShowSteer: false,
2022-05-24 18:03:36 +08:00
isAuthWxLoginModal: false,
isAuthWxPhoneModal: false,
showTakeCertifiedModal: false
2022-04-29 17:23:40 +08:00
}
},
onReady() {
this.loadData();
},
methods: {
2022-05-23 17:38:52 +08:00
async loadData() {
2022-05-24 18:03:36 +08:00
// 更新缓存中的userInfo
let res = await this.$request.storageExistUser();
// 获取缓存中的userInfo
let curUserInfo = this.$request.getCurUserInfo();
this.isAuthWxLoginModal = curUserInfo && curUserInfo.openId ? false : true;
if (this.isAuthWxLoginModal) {
return;
}
this.isAuthWxPhoneModal = !curUserInfo.phone ? true : false;
if (this.isAuthWxPhoneModal) {
return;
}
2022-06-23 17:33:19 +08:00
this.curUserInfo = curUserInfo;
// 是否展示选择入驻类型的模态框
this.isShowSteer = this.curUserInfo.type == null ? true : false;
// 是否展示认证提示模态框
this.showTakeCertifiedModal = this.curUserInfo.type === 0 && this.curUserInfo.status !== 0 ? true : false;
2022-05-24 18:03:36 +08:00
this.myInfo = await this.$api.data('myInfo');
2022-06-06 22:10:06 +08:00
// this.isShowSteer = !this.myInfo.entryType;
2022-05-24 18:03:36 +08:00
let newServModules = this.servModules.concat();
if (this.myInfo.hasCheckedRule) {
newServModules[0].pageUrl = '/pages/demand-center/accept-demand-center';
} else {
let paramObj = {
hasCheckedRule: this.myInfo.hasCheckedRule,
navigate: true
2022-05-23 17:38:52 +08:00
}
2022-05-24 18:03:36 +08:00
newServModules[0].pageUrl = '/pages/demand-center/rule?paramObj=' + encodeURIComponent(JSON
.stringify(paramObj));
2022-05-09 23:10:42 +08:00
}
2022-05-24 18:03:36 +08:00
this.servModules = newServModules;
2022-04-29 17:23:40 +08:00
},
async chooseEntryType(typeCode) {
let status = 1;
if (typeCode === 1) {
status = 0;
}
2022-06-23 17:33:19 +08:00
await this.$request.updateWorker({
type: typeCode,
status: status
2022-06-23 17:33:19 +08:00
});
if (typeCode === 1) {
this.$emit('changeCurPageCode', 'supplyChainPage');
} else if (typeCode === 0) {
uni.navigateTo({
url: '/pages/my/master-settled-info'
})
}
2022-04-29 17:23:40 +08:00
},
hideModal(e) {
this[e.currentTarget.dataset.modal] = false;
2022-05-23 17:38:52 +08:00
},
showMasterRule() {
let paramObj = {
hasCheckedRule: this.myInfo.hasCheckedRule,
navigate: false
}
uni.navigateTo({
url: '/pages/demand-center/rule?paramObj=' + encodeURIComponent(JSON.stringify(paramObj))
})
},
authWxLogin() {
this.$request.login().then(res => {
if (res) {
this.loadData();
}
})
2022-05-24 18:03:36 +08:00
},
getPhoneNumber(e) {
this.$request.storagePhoneIntoUserInfo(e.detail.code).then(res => {
if (res) {
this.loadData();
}
})
2022-04-29 17:23:40 +08:00
}
},
}
</script>
<style scoped>
.bg-main-color .solid-bottom::after {
border-bottom: 1upx solid rgba(255, 255, 255, 0.5);
}
.cu-list.grid.no-border>.solid-left.cu-item:after {
border-left: 1upx solid rgba(255, 255, 255, 0.5);
}
.cu-list.grid.no-border>.solid-right.cu-item:after {
border-right: 1upx solid rgba(255, 255, 255, 0.5);
}
.paper-drawer-bar {
position: relative;
top: -100rpx;
}
.screen-swiper {
height: 180rpx;
min-height: unset;
}
.bar-first-action {
margin-left: unset !important;
font-size: 30rpx !important;
}
2022-06-23 17:33:19 +08:00
.nav-list-panel {
font-weight: 300;
}
2022-05-24 18:03:36 +08:00
.nav-list-panel>navigator:first-child {
width: 46%;
2022-06-23 17:33:19 +08:00
height: 249rpx;
2022-05-24 18:03:36 +08:00
line-height: 195rpx;
}
2022-04-29 17:23:40 +08:00
2022-05-24 18:03:36 +08:00
.nav-li {
padding: 30rpx;
border-radius: 12rpx;
width: 46%;
background-image: url(https://cdn.nlark.com/yuque/0/2019/png/280374/1552996358352-assets/web-upload/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png);
background-size: cover;
background-position: center;
position: relative;
z-index: 1;
height: 116rpx;
margin: 10rpx;
float: left;
2022-04-29 17:23:40 +08:00
}
2022-05-24 18:03:36 +08:00
2022-05-23 17:38:52 +08:00
.right-tag {
background-color: rgba(0, 0, 0, 0.3);
position: relative;
right: -30rpx;
border-radius: 40rpx 0 0 40rpx;
2022-06-23 17:33:19 +08:00
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.modal-bottom-oper {
height: 70rpx;
display: inline-flex;
align-items: center;
justify-content: center;
2022-05-23 17:38:52 +08:00
}
2022-05-24 18:03:36 +08:00
</style>