123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- // pages/reservationMan/index.js
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- str:' ',
- loginStatus: wx.getStorageSync('loginStatus') ? wx.getStorageSync('loginStatus') : false,
- roleCodeList: wx.getStorageSync('roleCodeList') ? wx.getStorageSync('roleCodeList') : '',
- searchVal: '',
- type:'',//预约类型
- appointmentClassifyArray: [
- { label:'充电预约',value:'1' },
- { label:'管桩预约',value:'2' },
- { label:'其他预约',value:'3' },
- ], //预约类型
-
- //分页
- limit: 10,
- requestStatu: '加载中...',
- page: 1,
- totalPages: 1,
- more: false,
- nomore: '',
- resData:[],
- show:false,
- auditFlag:'false',
- appointmentReason:'',//审核备注
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- const roleCodeList = wx.getStorageSync('roleCodeList')
- let loginStatus = wx.getStorageSync('loginStatus')
- this.setData({
- searchVal: '',
- roleCodeList: roleCodeList ? roleCodeList : '',
- loginStatus: loginStatus ? loginStatus : false
- })
- //动态tabbar
- // if (roleCodeList == 'bizAdmin') {
- // this.getTabBar().setData({
- // list: app.globalData.allList[0].list2,
- // })
- // } else if(roleCodeList == 'send') {
- // this.getTabBar().setData({
- // list: app.globalData.allList[0].list3,
- // })
- // } else if(roleCodeList == 'sale') {
- // this.getTabBar().setData({
- // list: app.globalData.allList[0].list4,
- // })
- // }else if(roleCodeList == 'customer') {
- // this.getTabBar().setData({
- // list: app.globalData.allList[0].list5,
- // })
- // } else if (roleCodeList=='driver'||roleCodeList==''){
- // this.getTabBar().setData({
- // list: app.globalData.allList[0].list1,
- // })
- // }
- // if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- // this.getTabBar().setData({
- // selected: 2
- // })
- // }
- if(wx.getStorageSync('loginStatus')){
- this.getListFun();
- }
- },
- //搜索框请求S
- onChange(e) {
- this.setData({
- searchVal: e.detail,
- });
- },
- onSearch: function (event) {
- this.setData({
- searchVal: event.detail
- })
- this.getListFun();
- },
- onCancel: function () {
- this.setData({})
- },
- toSearch: function (event) {
- this.getListFun();
- },
- //列表
- getListFun: function () {
- this.setData({
- page: 1
- })
- let params = {
- current: this.data.page,
- size: this.data.limit,
- licenseNumber:this.data.searchVal,
- //status:1
- }
- app.request.pageFirst({
- url: app.API.appointmentList,
- page: this,
- params: params,
- })
- },
- //取消预约
- cancelFun: function (e) {
- let _this = this
- let { id, licenseNumber } = e.currentTarget.dataset
- wx.showModal({
- title: '提示!',
- content: `取消【${licenseNumber}】后不可恢复。确定要取消吗?`,
- confirmColor: '#FF5B5B',
- success: function (res) {
- if (res.confirm) {
- app.request.POST({
- url: app.API.appointmentCancel,
- params: {
- id: id
- },
- page: _this,
- isLoadingTxt: '取消中...',
- successFun: true
- }).then(res => {
- wx.showToast({
- title: '取消成功',
- icon: 'success',
- duration: 1000,
- mask: true
- })
- _this.getListFun(); //刷新列表
- })
- } else if (res.cancel) {
- }
- }
- })
- },
- //授权出场
- exitFun: function (e) {
- let _this = this
- let { id, licenseNumber } = e.currentTarget.dataset
- wx.showModal({
- title: '提示!',
- content: `确定授权【${licenseNumber}】出场?`,
- confirmColor: '#FF5B5B',
- success: function (res) {
- if (res.confirm) {
- app.request.POST({
- url: app.API.appointmentExit,
- params: {
- id: id
- },
- page: _this,
- isLoadingTxt: '授权中...',
- successFun: true
- }).then(res => {
- wx.showToast({
- title: '授权成功',
- icon: 'success',
- duration: 1000,
- mask: true
- })
- _this.getListFun(); //刷新列表
- })
- } else if (res.cancel) {
- }
- }
- })
- },
- // 审核S
- showPopup(e) {
- let { id,type } = e.currentTarget.dataset
- this.setData({
- show: true,
- appointmentReason: '',
- type:type,
- id: id
- });
- },
- onClose() {
- this.setData({
- show: false,
- auditFlag:'false',
- appointmentReason:'',
- id: ''
- });
- },
- // 单选
- dangerStatusChange: function (e) {
- this.setData({
- [e.currentTarget.dataset.radiotype]: e.detail.value
- })
- },
- //审核
- formSubmit: function (e) {
- let formData = e.detail.value;
- var warn = ""; //弹框时提示的内容
- if (formData.auditFlag=='true' && formData.appointmentReason == '') {
- warn = "审核不通过时备注不能为空!";
- }
- formData.auditFlag = formData.auditFlag=='true'
- if (warn != '') {
- app.util.checkForm(warn);
- } else {
- let url = app.API.appointmentAudit
- if(this.data.type == '2'){
- url = app.API.tempAudit
- }
- app.request.POST({
- url: url,
- params: formData,
- page: this,
- isLoadingTxt: '审核中...',
- successFun: true
- }).then(res => {
- wx.showToast({
- title: '审核成功',
- icon: 'success',
- duration: 1000,
- mask: true
- })
- this.onClose()
- this.getListFun(); //刷新列表
- })
- }
- },
- // 审核E
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({
- searchVal: ''
- })
- if (wx.getStorageSync('loginStatus')) {
- this.getListFun();
- } else {
- wx.stopPullDownRefresh();
- }
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- this.data.page++;
- let params = {
- current: this.data.page,
- size: this.data.limit,
- licenseNumber:this.data.searchVal,
- //status:1
- }
- app.request.pageOther({
- url: app.API.appointmentList,
- page: this,
- params: params,
- loadType: true //加载类型,是否是下拉加载
- });
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|