diff --git a/miniprogram/api/meeting/exhibition.js b/miniprogram/api/meeting/exhibition.js index b0e1142..0b68758 100644 --- a/miniprogram/api/meeting/exhibition.js +++ b/miniprogram/api/meeting/exhibition.js @@ -38,3 +38,22 @@ export function appointmentRecordRq(data) { }); } +// 查询字典 +export function listByTypeRq(data) { + return request({ + url: '/api/showroom/listByType', + method: "post", + data + }); +} + + +// 新增展厅预约记录 +export function saveShowRoomRecordRq(data) { + return request({ + url: '/api/showroom/saveShowRoomRecord', + method: "post", + data + }); +} + diff --git a/miniprogram/app.json b/miniprogram/app.json index 9b53d2f..0067a89 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -69,7 +69,8 @@ "pages/meeting/exhibition/list/list", "pages/meeting/exhibition/detail/detail", "pages/meeting/exhibition/booked/booked", - "pages/meeting/exhibition/order/order" + "pages/meeting/exhibition/order/order", + "pages/meeting/reservationRecord/exhibitionRecord/list/list" ], "window": { "backgroundTextStyle": "light", diff --git a/miniprogram/pages/meeting/exhibition/order/order.js b/miniprogram/pages/meeting/exhibition/order/order.js index 318ab25..1b66c21 100644 --- a/miniprogram/pages/meeting/exhibition/order/order.js +++ b/miniprogram/pages/meeting/exhibition/order/order.js @@ -4,16 +4,11 @@ import Dialog from '@vant/weapp/dialog/dialog'; import Notify from '@vant/weapp/notify/notify'; import { - showroomDetailRq + showroomDetailRq, + listByTypeRq, + saveShowRoomRecordRq } from "../../../../api/meeting/exhibition.js" -import { - meetingRoomDetailRq, - getCustomerTicketRq, - calculateMeetingRoomAmountRq, - saveMeetingRecordRq -} from "../../../../api/meeting/meetingRoom.js" - import { selfFormatTimeYMD, selfFormatTimeHM, @@ -38,7 +33,34 @@ Page({ endTime: null, selectDay: null, selectCountTime: null, - formData: {} + // 选择参观目的 + visitTypeShow: false, + visitTypeList: [], + // 来参观人员-dialog + dialogShow: false, + dialogName: null, + dialogJob: null, + dialogPhone: null, + // 来参观人员 + personList: [], + // 提交数据 + formData: { + showroomId: null, // 展厅id + userId: null, // 用户id + startTime: null, // 开始时间 + endDate: null, // 结束时间 + title: null, // 展厅主题 + persons: null, // 来参观人员 + visitType: null, // 参观目的 + visitTypeName: null, // 参观目的-name + explainNeedType: 0, // 讲解需求 + explainNeedTypeBoolean: false, // 讲解需求-boolean + meetingNeedType: 0, // 是否需要会议室 + meetingNeedTypeBoolean: false, // 是否需要会议室-boolean + photographType: 0, // 摄影需求 + photographTypeBoolean: false, // 摄影需求-boolean + remake: null, // 备注 + } }, /** @@ -46,15 +68,24 @@ Page({ */ onLoad(options) { console.log('onLoad', options); + let _this = this; let selectCountTime = selfFormatTimeHM(options.startTime) + "-" + selfFormatTimeHM(options.endTime) + ' 共计' + twoTimeInterval(options.startTime, options.endTime) - this.setData({ + _this.setData({ ...options, userData: wx.getStorageSync('user'), selectDay: selfFormatTimeYMD(options.startTime), selectCountTime }) + // 表单数据初始化 + let formData = _this.data.formData; + formData.showroomId = _this.data.id; // 展厅id + formData.userId = _this.data.userData.id // 用户id + formData.startTime = _this.data.startTime // 开始时间 + formData.endDate = _this.data.endTime // 结束时间 // 详细信息 - this.getDetail(); + _this.getDetail(); + // 获取字典数据 + _this.getDictData(); }, // 详细信息 @@ -68,13 +99,158 @@ Page({ }) }, - // 主题修改监听 - titleChange(event) { - this.setData({ - title: event.detail + // 获取字典数据 + getDictData() { + let _this = this + listByTypeRq({ + "dictType": "visit_type" + }).then(res => { + console.log('getDictData', res); + let visitTypeList = res.data.map(item => { + return { + name: item.dictLabel, + value: item.dictValue, + } + }) + _this.setData({ + visitTypeList + }) }) }, + // input监听 + inputChange(e) { + console.log('inputChange', e); + let _this = this; + let formData = _this.data.formData; + formData[e.currentTarget.dataset.name] = e.detail + _this.setData({ + formData + }) + }, + + // switch监听 + switchChange(e) { + console.log('switchChange', e); + let _this = this; + let status = e.detail; + let formData = _this.data.formData; + formData[e.currentTarget.dataset.name + 'Boolean'] = status + if (status) { + formData[e.currentTarget.dataset.name] = 1 + } else { + formData[e.currentTarget.dataset.name] = 0 + } + _this.setData({ + formData + }) + }, + + // 显示-参观目的 + showVisitType() { + let _this = this; + _this.setData({ + visitTypeShow: true + }) + }, + + // 隐藏-参观目的 + hideVisitType() { + let _this = this; + _this.setData({ + visitTypeShow: false + }) + }, + + // 选择-参观目的 + selectVisitType(e) { + console.log('selectVisitType', e); + let _this = this; + let formData = _this.data.formData; + formData.visitType = e.detail.value; // 参观目的 + formData.visitTypeName = e.detail.name; // 参观目的-name + _this.setData({ + formData + }) + }, + + // 显示-dialog + dialogUnfold() { + let _this = this; + _this.setData({ + dialogShow: true + }) + }, + // 取消-dialog + dialogCancel() { + let _this = this; + _this.setData({ + dialogShow: false + }) + }, + + // 提交-dialog + dialogSubmit() { + let _this = this; + let name = _this.data.dialogName + let job = _this.data.dialogJob + let phone = _this.data.dialogPhone + if (!name) { + // 显示错误信息 + _this.showErrMsg('请输入姓名!') + return; + } + if (!job) { + // 显示错误信息 + _this.showErrMsg('请输入职务!') + return; + } + // 来参观人员 + let personList = _this.data.personList; + personList.push({ + id: new Date().getTime(), + name, + job, + phone + }) + _this.setData({ + personList, + dialogShow: false, + dialogName: null, + dialogJob: null, + dialogPhone: null, + }) + }, + + // 删除来参观人员 + removePerson(e) { + console.log('removePerson', e); + let _this = this; + let id = e.currentTarget.dataset.id + let personList = _this.data.personList.filter(item => item.id != id) + _this.setData({ + personList + }) + }, + + // input监听-dialog + dialogInputChange(e) { + console.log('dialogInputChange', e); + let _this = this; + let data = _this.data; + data[e.currentTarget.dataset.name] = e.detail + _this.setData(data) + }, + + // 显示错误信息 + showErrMsg(msg) { + // 错误提示 + Notify({ + type: 'danger', + message: msg + }); + }, + // 协议点击 protocolChange() { let _this = this; @@ -91,48 +267,54 @@ Page({ }) }, - // 提交订单 - submitCase() { + // 提交 + submitData() { let _this = this + let formData = _this.data.formData; // 参数校验 - if (!_this.data.title) { + // + // 展厅主题 + if (!formData.title) { // 错误提示 - Notify({ - type: 'danger', - message: '请输入会议主题!' - }); + _this.showErrMsg('请输入展厅主题!'); return; } + // 来参观人员 + if (_this.data.personList && _this.data.personList.length > 0) { + formData.persons = JSON.stringify(_this.data.personList) + } else { + // 错误提示 + _this.showErrMsg('请添加来参观人员!'); + return; + } + // 参观目的 + if (!formData.visitType) { + // 错误提示 + _this.showErrMsg('请选择参观目的!'); + return; + } + // 同意协议 if (!_this.data.protocolFlag) { // 错误提示 - Notify({ - type: 'danger', - message: `请同意${_this.data.protocolTitle}!` - }); + _this.showErrMsg(`请同意${_this.data.protocolTitle}!`); return; } - saveMeetingRecordRq({ - "roomContentId": _this.data.meetingRoomId, - "userId": _this.data.userData.id, - "ticketId": _this.data.couponId, - "customerId": _this.data.userData.icsCustomerId, - "title": _this.data.title, - "startTime": _this.data.startTime, - "endDate": _this.data.endTime, - "orderMoney": _this.data.totalAmount, - }).then(res => { - console.log('saveMeetingRecordRq', res); + // 提交数据 + saveShowRoomRecordRq(formData).then(res => { + console.log('saveShowRoomRecordRq', res); if (res.code == 0) { - wx.redirectTo({ - url: "/pages/meeting/pay/waitPay/waitPay?id=" + res.reservationId, - }) + if (formData.meetingNeedTypeBoolean) { + wx.reLaunch({ + url: "/pages/meeting/meetingReservation/meetingReservation", + }) + } else { + wx.reLaunch({ + url: "/pages/meeting/reservationRecord/exhibitionRecord/list/list", + }) + } } else { - // 错误提示 - Notify({ - type: 'danger', - message: res.msg - }); + _this.showErrMsg(res.msg) } }) }, diff --git a/miniprogram/pages/meeting/exhibition/order/order.json b/miniprogram/pages/meeting/exhibition/order/order.json index 5cdcc8f..52f1640 100644 --- a/miniprogram/pages/meeting/exhibition/order/order.json +++ b/miniprogram/pages/meeting/exhibition/order/order.json @@ -5,7 +5,8 @@ "van-dialog": "@vant/weapp/dialog/index", "van-notify": "@vant/weapp/notify/index", "van-checkbox": "@vant/weapp/checkbox/index", - "van-switch": "@vant/weapp/switch/index" + "van-switch": "@vant/weapp/switch/index", + "van-action-sheet": "@vant/weapp/action-sheet/index" }, "navigationBarTitleText": "预约信息" } \ No newline at end of file diff --git a/miniprogram/pages/meeting/exhibition/order/order.wxml b/miniprogram/pages/meeting/exhibition/order/order.wxml index db1d908..fc8fd4b 100644 --- a/miniprogram/pages/meeting/exhibition/order/order.wxml +++ b/miniprogram/pages/meeting/exhibition/order/order.wxml @@ -40,55 +40,55 @@ 展厅主题 - + 来参观人员 - 请添加 + 请添加 - + - - 陈泽 - 国务院院长 - 18360702148 - + + {{item.name}} + {{item.job}} + {{item.phone ? item.phone : '-'}} + - + 参观目的 - + 讲解需求 - + 是否需要会议室 - + 摄影需求 - + 备注 - + @@ -101,10 +101,26 @@ - 立即预约 + 立即预约 - - - - - \ No newline at end of file + + + + + + + + + + + + 取消 + 确定 + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/meeting/exhibition/order/order.wxss b/miniprogram/pages/meeting/exhibition/order/order.wxss index ea1631a..0f35e27 100644 --- a/miniprogram/pages/meeting/exhibition/order/order.wxss +++ b/miniprogram/pages/meeting/exhibition/order/order.wxss @@ -231,4 +231,32 @@ .submitBtn { position: static; margin-left: 50%; +} + +.dialogContent{ + padding: 40rpx 20rpx; +} + +.dialogBtnView { + display: flex; + justify-content: space-between; + align-items: center; + border-top: 1px solid rgb(126, 126, 126, 0.2); +} + +.dialogBtnView .rejectBtn, +.dialogBtnView .successBtn { + width: 50%; + text-align: center; + padding: 30rpx 0; + font-size: 32rpx; +} + +.dialogBtnView .rejectBtn { + border-right: 1px solid rgb(126, 126, 126, 0.2); + color: gray; +} + +.dialogBtnView .successBtn { + color: #4e96f8; } \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.js b/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.js new file mode 100644 index 0000000..b6a040f --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.js @@ -0,0 +1,66 @@ +// pages/meeting/reservationRecord/exhibitionRecord/list.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.json b/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.wxml b/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.wxml new file mode 100644 index 0000000..3a36439 --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.wxml @@ -0,0 +1,2 @@ + +pages/meeting/reservationRecord/exhibitionRecord/list.wxml \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.wxss b/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.wxss new file mode 100644 index 0000000..db16fd4 --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/exhibitionRecord/list/list.wxss @@ -0,0 +1 @@ +/* pages/meeting/reservationRecord/exhibitionRecord/list.wxss */ \ No newline at end of file