From b8d989a2bcb667a44538638a18ad80fd73ebe2b3 Mon Sep 17 00:00:00 2001 From: SelfRidicule Date: Sat, 9 Mar 2024 15:49:42 +0800 Subject: [PATCH] 1 --- .../visitorIinvitation/detail/detail.js | 39 +++++++++++- .../visitorIinvitation/detail/detail.json | 3 +- .../visitorIinvitation/detail/detail.wxml | 13 ++-- .../visitorIinvitation/indexBar/indexBar.js | 59 +++++++++++++++---- .../visitorIinvitation/indexBar/indexBar.json | 3 +- .../visitorIinvitation/indexBar/indexBar.wxml | 6 +- 6 files changed, 99 insertions(+), 24 deletions(-) diff --git a/miniprogram/pages/meeting/visitorIinvitation/detail/detail.js b/miniprogram/pages/meeting/visitorIinvitation/detail/detail.js index ceef38f..95b16dd 100644 --- a/miniprogram/pages/meeting/visitorIinvitation/detail/detail.js +++ b/miniprogram/pages/meeting/visitorIinvitation/detail/detail.js @@ -1,4 +1,7 @@ let app = getApp(); + +import Notify from '@vant/weapp/notify/notify'; + import { companyRq } from "../../../../api/meeting/visitorIinvitation.js" @@ -9,7 +12,24 @@ Page({ * 页面的初始数据 */ data: { - + IMG_NAME: app.IMG_NAME, + detail: { + customerId: null, //企业id + customerName: null, //企业名称 + userId: null, // 被访人id + username: null, //被访人姓名 + mobile: null, //被访人手机号 + intervieweeId: null, // 访客id + name: null, // 访客姓名 + phone: null, // 访客手机号 + joinTime: null, // 加入时间 + visitTime: null, // 到访时间 + leaveTime: null, // 离开时间 + visitContent: null, // 来访事由 + cardType: null, // 证件类型 + cardNo: null, // 证件号 + photo: null, // 头像 + } }, /** @@ -32,9 +52,24 @@ Page({ // 跳转-索引栏(单位、人员) jumpIndexBar(e) { console.log('jumpIndexBar', e); + let _this = this; let title = e.currentTarget.dataset.title + // 校验是否选择“被访单位” 后 ,再选择被访人信息 + if (title == '人员' && !_this.data.detail.customerId) { + // 危险通知 + Notify({ + type: 'danger', + message: '请先选择被访单位!' + }); + return ; + } + // url 参数 + let param = '?title=' + title; + if (title == '人员') { + param = param + '&id=' + _this.data.detail.customerId; + } wx.navigateTo({ - url: '/pages/meeting/visitorIinvitation/indexBar/indexBar?title=' + title, + url: '/pages/meeting/visitorIinvitation/indexBar/indexBar' + param, }) }, diff --git a/miniprogram/pages/meeting/visitorIinvitation/detail/detail.json b/miniprogram/pages/meeting/visitorIinvitation/detail/detail.json index fa802eb..8a85438 100644 --- a/miniprogram/pages/meeting/visitorIinvitation/detail/detail.json +++ b/miniprogram/pages/meeting/visitorIinvitation/detail/detail.json @@ -9,8 +9,7 @@ "van-datetime-picker": "@vant/weapp/datetime-picker/index", "van-dialog": "@vant/weapp/dialog/index", "van-cell": "@vant/weapp/cell/index", - "van-index-bar": "@vant/weapp/index-bar/index", - "van-index-anchor": "@vant/weapp/index-anchor/index" + "van-notify": "@vant/weapp/notify/index" } } \ No newline at end of file diff --git a/miniprogram/pages/meeting/visitorIinvitation/detail/detail.wxml b/miniprogram/pages/meeting/visitorIinvitation/detail/detail.wxml index 138b0b1..158756b 100644 --- a/miniprogram/pages/meeting/visitorIinvitation/detail/detail.wxml +++ b/miniprogram/pages/meeting/visitorIinvitation/detail/detail.wxml @@ -5,15 +5,15 @@ 被访单位 - + 被访人姓名 - + - + 被访人电话 - + 访客姓名 @@ -59,4 +59,7 @@ 提交 - \ No newline at end of file + + + + \ No newline at end of file diff --git a/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.js b/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.js index bd3880e..8179316 100644 --- a/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.js +++ b/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.js @@ -7,6 +7,7 @@ Page({ data: { title: '', + id: null, /** 索引栏*/ indexList: [], /** 数据*/ @@ -34,7 +35,6 @@ Page({ // 获取企业下的所有用户 _this.getVisitorSelectUserByCustomer() } - }, // 获取所有的企业 @@ -43,16 +43,12 @@ Page({ visitorListRq().then(res => { console.log('getVisitorList', res); let filterDataList = res.rows.map(item => { - let otherData = JSON.stringify({ - id: item.id, - name: item.name, - mailAddress: item.mailAddress, - }) - return { label: item.name, - value: item.id, - otherData + otherData: JSON.stringify({ + id: item.id, + name: item.name, + }) } }) // 赋值并且格式化数据 @@ -62,8 +58,21 @@ Page({ // 获取企业下的所有用户 getVisitorSelectUserByCustomer() { - visitorSelectUserByCustomerRq().then(res => { + let _this = this; + visitorSelectUserByCustomerRq(_this.data.id).then(res => { console.log('getVisitorSelectUserByCustomer', res); + let filterDataList = res.rows.map(item => { + return { + label: item.username + '-' + item.mobile, + otherData: JSON.stringify({ + id: item.id, + username: item.username, + mobile: item.mobile, + }) + } + }) + // 赋值并且格式化数据 + _this.setAndFormatData(filterDataList) }) }, @@ -118,13 +127,39 @@ Page({ }, - + // 选择 selectClick(e) { console.log('selectClick', e); + let _this = this; + // 获取点击行数据 let label = e.currentTarget.dataset.label - let value = e.currentTarget.dataset.value + let otherdata = JSON.parse(e.currentTarget.dataset.otherdata) + // + let pages = getCurrentPages(); //获取page + let prevPage = pages[pages.length - 2]; //上一个页面(父页面) + // 上个页面数据 + let detail = prevPage.data.detail; + // 更新上个页面对应的数据 + if (_this.data.title == '单位') { + detail.customerId = otherdata.id //企业id + detail.customerName = otherdata.name //企业名称 + detail.userId = null //被访人id + detail.username = null //被访人姓名 + detail.mobile = null //被访人手机号 + } + if (_this.data.title == '人员') { + detail.userId = otherdata.id //被访人id + detail.username = otherdata.username //被访人姓名 + detail.mobile = otherdata.mobile //被访人手机号 + } + // 赋值上个页面的数据 + prevPage.setData({ + detail + }) + // 后退页面 + wx.navigateBack(); }, /** diff --git a/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.json b/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.json index 8761843..b622e7a 100644 --- a/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.json +++ b/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.json @@ -3,6 +3,7 @@ "usingComponents": { "van-cell": "@vant/weapp/cell/index", "van-index-bar": "@vant/weapp/index-bar/index", - "van-index-anchor": "@vant/weapp/index-anchor/index" + "van-index-anchor": "@vant/weapp/index-anchor/index", + "van-divider": "@vant/weapp/divider/index" } } \ No newline at end of file diff --git a/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.wxml b/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.wxml index 9e62bb8..ebbdc23 100644 --- a/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.wxml +++ b/miniprogram/pages/meeting/visitorIinvitation/indexBar/indexBar.wxml @@ -1,6 +1,8 @@ - + - \ No newline at end of file + + +暂无数据 \ No newline at end of file