diff --git a/common/js/globalData.js b/common/js/globalData.js index dba4bdc..16aaf13 100644 --- a/common/js/globalData.js +++ b/common/js/globalData.js @@ -2,7 +2,7 @@ export default { deptId: 101, from: 'server', initPageNum: 1, - initPageSize: 20, + initPageSize: 1, timeRangeList: [ '08:00-08:30', '08:30-09:00', diff --git a/components/custom-bar/module-bar.vue b/components/custom-bar/module-bar.vue index a5859a7..ee647a0 100644 --- a/components/custom-bar/module-bar.vue +++ b/components/custom-bar/module-bar.vue @@ -26,7 +26,8 @@ + + diff --git a/components/vertify/vertify-certify.vue b/components/vertify/vertify-certify.vue new file mode 100644 index 0000000..738f9cc --- /dev/null +++ b/components/vertify/vertify-certify.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/components/vertify/vertify-login.vue b/components/vertify/vertify-login.vue new file mode 100644 index 0000000..21fccc1 --- /dev/null +++ b/components/vertify/vertify-login.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/components/vertify/vertify-phone.vue b/components/vertify/vertify-phone.vue new file mode 100644 index 0000000..3b24181 --- /dev/null +++ b/components/vertify/vertify-phone.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/components/vertify/vertify-worker-type.vue b/components/vertify/vertify-worker-type.vue new file mode 100644 index 0000000..13e3e57 --- /dev/null +++ b/components/vertify/vertify-worker-type.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/main.js b/main.js index 0207f64..b074731 100644 --- a/main.js +++ b/main.js @@ -9,10 +9,21 @@ import validate from './common/js/validate.js'; import dateUtil from './common/js/dateUtil.js'; import commonFun from './common/js/commonFun.js'; import request from './common/js/request.js'; -import globalData from './common/js/globalData.js'; +import globalData from './common/js/globalData.js'; +import vertifyLogin from '@/components/vertify/vertify-login.vue'; +import vertifyPhone from '@/components/vertify/vertify-phone.vue'; +import vertifyCertify from '@/components/vertify/vertify-certify.vue'; +import vertifyWorkerType from '@/components/vertify/vertify-worker-type.vue'; +import vertifyBankBind from '@/components/vertify/vertify-bank-bind.vue'; + +Vue.component('cu-custom', CuCustom) +Vue.component('confirm-modal', ConfirmModal); +Vue.component('vertify-login', vertifyLogin); +Vue.component('vertify-phone', vertifyPhone); +Vue.component('vertify-certify', vertifyCertify); +Vue.component('vertify-worker-type', vertifyWorkerType); +Vue.component('vertify-bank-bind', vertifyBankBind); -Vue.component('cu-custom', CuCustom) -Vue.component('confirm-modal', ConfirmModal); const data = type => { //模拟异步请求数据 return new Promise(resolve => { diff --git a/pages/demand-center/accept-demand-center.vue b/pages/demand-center/accept-demand-center.vue index 820d168..649b34d 100644 --- a/pages/demand-center/accept-demand-center.vue +++ b/pages/demand-center/accept-demand-center.vue @@ -178,7 +178,10 @@ @tap="hideModal">继续接单 - + + + + @@ -263,16 +266,19 @@ chosenArea: [], categoryList: [], categoryMultiIndex: [0, 0, 0], - chosenCategory: [] + chosenCategory: [], + bankCard: null, + certifyInfo: null } }, onShow() { this.loadData(); }, methods: { - async loadData() { - // this.tasks = await this.$api.data('tasks'); + async loadData() { this.curUserInfo = this.$request.getCurUserInfo(); + this.checkBankAndCertify(); + // this.tasks = await this.$api.data('tasks'); this.reloadMasterOrderPage(); // this.takeCertify = await this.$api.data('takeCertify'); // this.areaList = await this.$api.data('areaList'); @@ -280,6 +286,24 @@ this.loadCategoryList(); this.loadRegionList(); }, + async checkBankAndCertify() { + // 查询账户绑定信息 + let bankCardRes = await this.$request.getBindBankCardByWorkerId({ + workerId: this.curUserInfo.workerId + }); + this.bankCard = bankCardRes.data; + // 查询实名信息 + let certifyInfoRes = await this.$request.getWorkerCertify(); + this.certifyInfo = certifyInfoRes.data; + if (!this.bankCard || !this.bankCard.bankNum) { + this.$refs.vertifyBankBind.showModal(); + return false; + } else if (!this.certifyInfo || !this.certifyInfo.workerCertificationId) { + this.$refs.vertifyCertify.showModal(); + return false; + } + return true; + }, async loadMasterOrderPage(params = {}) { params.pageSize = this.$globalData.initPageSize; params.pageNum = this.pageNum; @@ -306,7 +330,7 @@ this.tasks = this.tasks.concat(res.rows); // this.pageParams[this.tabCur].pageNum++; this.pageNum++; - if (rowsLength === this.pageSize) { + if (rowsLength === params.pageSize) { this.$refs.loadStatusBar.showLoadMore(); return; } @@ -472,7 +496,12 @@ paramObj)) }) }, - async takeTask(e, task) { + async takeTask(e, task) { + let checkRes = await this.checkBankAndCertify(); + if (!checkRes) { + return; + } + if (this.curUserInfo.status !== 0 || this.curUserInfo.type !== 0) { // 未认证需提示前往认证 e.currentTarget.dataset.modal = e.currentTarget.dataset.certifyModal; diff --git a/pages/index/index-home.vue b/pages/index/index-home.vue index 1e4c24d..e5856cf 100644 --- a/pages/index/index-home.vue +++ b/pages/index/index-home.vue @@ -9,7 +9,8 @@ :style="'width: 120rpx; height: 120rpx; background-image:url(' + curUserInfo.bannerUrl + ');'"> - {{curUserInfo.deptName}} + {{curUserInfo.deptName}} + 请先登录 @@ -20,15 +21,15 @@ - {{myInfo.order.noReservation}} + 0 未预约 - {{myInfo.order.noSchedule}} + 0 未排单 - {{myInfo.order.onsiteTimeout}} + 0 上门超时 @@ -47,7 +48,7 @@ - + @@ -57,10 +58,13 @@ 地址:{{item.address}} - + + + 未登录 + - + [每周公告] @@ -76,81 +80,22 @@ 服务中心 - {{item.title}} - - - - - - - - - - - 请您选择入驻类型!到家服务类请选择-服务商;商品销售类请选择-配件商。 - - - 配件商 - 服务商 - - - - - - 您还未进行认证 - - - 以后认证 - 立即认证 - - - - - - - - 需先授权微信登录才可正常使用功能,小程序将获取并使用以下信息: - 1.微信昵称 - 2.微信头像 - - - 拒绝授权 - - 确认授权 - - - - - - - - - 授予小程序绑定微信手机号码的权限 - - - 拒绝授权 - - - - - - - + + + + + + @@ -167,14 +112,16 @@ name: '查看详情', color: 'blue', cuIcon: 'list', - pageUrl: '' + pageUrl: '', + checkLogin: true }, { id: 2, title: '我的订单', name: '查看详情', color: 'orange', cuIcon: 'text', - pageUrl: '/pages/order-manage/order-manage' + pageUrl: '/pages/order-manage/order-manage', + checkLogin: true }, { id: 3, title: '叮咚学院', @@ -195,7 +142,8 @@ name: '查看详情', color: 'olive', cuIcon: 'group', - pageUrl: '/pages/area-proxy/my-team' + pageUrl: '/pages/area-proxy/my-team', + checkLogin: true }], curUserInfo: {}, myInfo: {}, @@ -208,27 +156,36 @@ onReady() { this.loadData(); }, - methods: { + methods: { + async authLogin() { + // 更新缓存中的userInfo + let res = await this.$request.storageExistUser(); + // 获取缓存中的userInfo + let curUserInfo = this.$request.getCurUserInfo(); + // 校验提示登录 + if (!curUserInfo || !curUserInfo.openId) { + this.$refs.vertifyLogin.showModal(); + return false; + } else { + this.$refs.vertifyLogin.hideModal(); + } + // 校验提示获取手机号码 + if (!curUserInfo.phone) { + this.$refs.vertifyPhone.showModal(); + return false; + } else { + this.$refs.vertifyPhone.hideModal(); + } + // 提示选择师傅类型 + if (curUserInfo.type == null) { + this.$refs.vertifyWorkerType.showModal(); + } + this.loadData(); + return true; + }, async loadData() { - // 更新缓存中的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; - } - this.curUserInfo = curUserInfo; - - // 是否展示选择入驻类型的模态框 - this.isShowSteer = this.curUserInfo.type == null ? true : false; - // 是否展示认证提示模态框 - this.showTakeCertifiedModal = this.curUserInfo.type === 0 && this.curUserInfo.status !== 0 ? true : false; - + this.curUserInfo = this.$request.getCurUserInfo(); this.myInfo = await this.$api.data('myInfo'); // this.isShowSteer = !this.myInfo.entryType; let newServModules = this.servModules.concat(); @@ -272,20 +229,16 @@ uni.navigateTo({ url: '/pages/demand-center/rule?paramObj=' + encodeURIComponent(JSON.stringify(paramObj)) }) - }, - authWxLogin() { - this.$request.login().then(res => { - if (res) { - this.loadData(); - } - }) - }, - getPhoneNumber(e) { - this.$request.storagePhoneIntoUserInfo(e.detail.code).then(res => { - if (res) { - this.loadData(); - } - }) + }, + async clickServModule(pageObj) { + if (pageObj.checkLogin) { + let res = await this.authLogin(); + if (res) { + uni.navigateTo({ + url: pageObj.pageUrl + }) + } + } } }, } @@ -323,7 +276,7 @@ font-weight: 300; } - .nav-list-panel>navigator:first-child { + .nav-list-panel>.serv-module:first-child { width: 46%; height: 249rpx; line-height: 195rpx; diff --git a/pages/index/index.vue b/pages/index/index.vue index 0aff32d..6208eca 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -4,7 +4,13 @@ - + + + + + + + @@ -26,19 +32,16 @@ data() { return { moduleBarInfos: [], - curPageCode: 'indexPage' + curPageCode: 'indexPage', + forwardingPageCode: null } }, onLoad(options) { - this.loadData(); - this.bindEvent(); + this.loadData(); if (options && options.menuCode) { this.changeCurPageCode(options.menuCode) } }, - onUnload() { - this.offEvent(); - }, methods: { async loadData() { // uni.getSystemInfo({ @@ -48,21 +51,56 @@ // console.log('高度:' + res.screenHeight) // } // }) - this.moduleBarInfos = await this.$api.data('moduleBarInfos'); - }, - bindEvent() { - uni.$on('getCurPageInfo', function(data) { - if (data.curPageCode === 'publishPage') { - this.isShowPublish = true; - } else { - this.isShowPublish = false; - this.curPageCode = data.curPageCode; - } - }.bind(this)); - }, - offEvent() { - uni.$off('getCurPageInfo') + }, + reloadForwardPage() { + this.getCurPageInfo({ + curPageCode: this.forwardingPageCode + }) + }, + async getCurPageInfo(data) { + let pageCode = data.curPageCode; + this.forwardingPageCode = pageCode; + // 登录校验 + if (['supplyChainPage', 'myPage'].indexOf(pageCode) >= 0) { + let loginRes = await this.authLogin(); + if (!loginRes) { + return; + } + } + this.forwardingPageCode = null; + + if (pageCode === 'publishPage') { + this.isShowPublish = true; + } else { + this.isShowPublish = false; + this.curPageCode = pageCode; + } + }, + async authLogin() { + // 更新缓存中的userInfo + let res = await this.$request.storageExistUser(); + // 获取缓存中的userInfo + let curUserInfo = this.$request.getCurUserInfo(); + // 校验提示登录 + if (!curUserInfo || !curUserInfo.openId) { + this.$refs.vertifyLogin.showModal(); + return false; + } else { + this.$refs.vertifyLogin.hideModal(); + } + // 校验提示获取手机号码 + if (!curUserInfo.phone) { + this.$refs.vertifyPhone.showModal(); + return false; + } else { + this.$refs.vertifyPhone.hideModal(); + } + // 提示选择师傅类型 + if (curUserInfo.type == null) { + this.$refs.vertifyWorkerType.showModal(); + } + return true; }, changeCurPageCode(targetPageCode) { // #ifdef MP diff --git a/pages/my/master-settled-info.vue b/pages/my/master-settled-info.vue index 27d1e3b..e4d160e 100644 --- a/pages/my/master-settled-info.vue +++ b/pages/my/master-settled-info.vue @@ -47,6 +47,7 @@ + 请完成入驻信息填写,需求大厅将根据师傅入驻信息推送任务单,无入驻信息将进行随机推送 diff --git a/pages/my/new-serv.vue b/pages/my/new-serv.vue index 3771e5f..3449f6a 100644 --- a/pages/my/new-serv.vue +++ b/pages/my/new-serv.vue @@ -217,7 +217,10 @@ - + + + + @@ -277,7 +280,10 @@ }, { code: 3, name: '45天' - }] + }], + curUserInfo: {}, + bankCard: null, + certifyInfo: null } }, onLoad(options) { @@ -288,12 +294,32 @@ this.loadData(goodId); }, methods: { - async loadData(goodId) { + async loadData(goodId) { + this.curUserInfo = this.$request.getCurUserInfo(); + this.checkBankAndCertify(); this.loadCategoryList(); this.loadRegionList(); // TODO 如果存在goodId说明是修改,需要查询good信息进行回显 // this.categoryList = await this.$api.data('categoryList'); // this.regionList = await this.$api.data('regionList'); + }, + async checkBankAndCertify() { + // 查询账户绑定信息 + let bankCardRes = await this.$request.getBindBankCardByWorkerId({ + workerId: this.curUserInfo.workerId + }); + this.bankCard = bankCardRes.data; + // 查询实名信息 + let certifyInfoRes = await this.$request.getWorkerCertify(); + this.certifyInfo = certifyInfoRes.data; + if (!this.bankCard || !this.bankCard.bankNum) { + this.$refs.vertifyBankBind.showModal(); + return false; + } else if (!this.certifyInfo || !this.certifyInfo.workerCertificationId) { + this.$refs.vertifyCertify.showModal(); + return false; + } + return true; }, async loadCategoryList(idArr) { let typeList = await this.$request.listByStep(); @@ -484,7 +510,12 @@ // this.formData.video = await this.$request.uploadFile(e.tempFilePaths[0]); // uni.hideLoading(); // }, - async submit() { + async submit() { + let checkRes = await this.checkBankAndCertify(); + if (!checkRes) { + return; + } + let goodsStandardList = this.formData.specsList.filter((item) => { if (item.checked) { return { diff --git a/pages/order-manage/order-manage.vue b/pages/order-manage/order-manage.vue index 573bcf4..78846b6 100644 --- a/pages/order-manage/order-manage.vue +++ b/pages/order-manage/order-manage.vue @@ -404,7 +404,7 @@ this.orderList = this.orderList.concat(res.rows); // this.pageParams[this.tabCur].pageNum++; this.pageNum++; - if (rowsLength === this.pageSize) { + if (rowsLength === params.pageSize) { this.$refs.loadStatusBar.showLoadMore(); return; }