|
@@ -0,0 +1,452 @@
|
|
|
+// pages/loadArrive/index.js
|
|
|
+const app = getApp()
|
|
|
+var startPoint
|
|
|
+Page({
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+ str:' ',
|
|
|
+ str2: ' ',
|
|
|
+
|
|
|
+ filterWidth: 0, //获取顶部筛选宽度
|
|
|
+ filterHeight: 0, //获取顶部筛选高度
|
|
|
+ safeAreaHeight: 0, //底部安全区域的高度
|
|
|
+ //按钮位置参数
|
|
|
+ buttonTop: 0,
|
|
|
+ buttonLeft: 0,
|
|
|
+ windowHeight: '',
|
|
|
+ windowWidth: '',
|
|
|
+
|
|
|
+ loginStatus: wx.getStorageSync('loginStatus') ? wx.getStorageSync('loginStatus') : false,
|
|
|
+ roleCodeList: wx.getStorageSync('roleCodeList') ? wx.getStorageSync('roleCodeList') : '',
|
|
|
+ searchVal: '',
|
|
|
+
|
|
|
+ arriveStatusArray: [{
|
|
|
+ dictValue: "",
|
|
|
+ dictLabel: "全部状态"
|
|
|
+ }],
|
|
|
+ arriveStatusIndex: 0,
|
|
|
+
|
|
|
+ //分页
|
|
|
+ limit: 10,
|
|
|
+ requestStatu: '加载中...',
|
|
|
+ page: 1,
|
|
|
+ totalPages: 1,
|
|
|
+ more: false,
|
|
|
+ nomore: '',
|
|
|
+
|
|
|
+ resData:[],
|
|
|
+
|
|
|
+ show: false,
|
|
|
+ auditFlag:true,
|
|
|
+ orderReason:'',//审核备注
|
|
|
+
|
|
|
+ requestStatu2: '加载中...',
|
|
|
+ page2: 1,
|
|
|
+ totalPages2: 1,
|
|
|
+ more2: false,
|
|
|
+ nomore2: '',
|
|
|
+ saleArr:[],
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onLoad(options) {
|
|
|
+ //预约审核状态
|
|
|
+ let treeData = app.globalData.treeArr
|
|
|
+ for (const element of treeData) {
|
|
|
+ let arrStr;
|
|
|
+ switch (element.dictValue) {
|
|
|
+ case 'arrive_status':
|
|
|
+ arrStr = "arriveStatusArray";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ let getArray =[{
|
|
|
+ dictValue: "",
|
|
|
+ dictLabel: "全部状态"
|
|
|
+ }]
|
|
|
+ this.setData({
|
|
|
+ [arrStr]: getArray.concat(element.children)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ safeAreaHeight: app.globalData.windowInfo.screenHeight - app.globalData.systemInfo.safeArea.bottom
|
|
|
+ })
|
|
|
+
|
|
|
+ // 使用选择器选择节点
|
|
|
+ this.getFilterHeight()
|
|
|
+ //获取页面高度设置新增按钮的初始位置
|
|
|
+ var that = this;
|
|
|
+ wx.getSystemInfo({
|
|
|
+ success: function (res) {
|
|
|
+ // 高度,宽度 单位为px
|
|
|
+ that.setData({
|
|
|
+ windowHeight: res.windowHeight, //屏幕宽度、高度
|
|
|
+ windowWidth: res.windowWidth,
|
|
|
+ buttonTop: res.windowHeight * 0.8 - that.data.safeAreaHeight-50, //这里定义按钮的初始位置
|
|
|
+ buttonLeft: res.windowWidth * 0.80, //这里定义按钮的初始位置
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //获取顶部筛选区域的高度
|
|
|
+ getFilterHeight:function(){
|
|
|
+ let that = this;
|
|
|
+ // 使用顶部筛选高度选择器选择节点的高度
|
|
|
+ const query = wx.createSelectorQuery();
|
|
|
+ query.select('.topSeach').boundingClientRect(function (rect) {
|
|
|
+ if(rect){
|
|
|
+ that.setData({
|
|
|
+ filterWidth: rect.width,
|
|
|
+ filterHeight: rect.height,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).exec();
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
+ */
|
|
|
+ onReady() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
+ */
|
|
|
+ onShow() {
|
|
|
+ const roleCodeList = wx.getStorageSync('roleCodeList')
|
|
|
+ let loginStatus = wx.getStorageSync('loginStatus')
|
|
|
+ this.setData({
|
|
|
+ searchVal: '',
|
|
|
+ roleCodeList: roleCodeList ? roleCodeList : '',
|
|
|
+ loginStatus: loginStatus ? loginStatus : false
|
|
|
+ })
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ requestStatu:'加载中...',
|
|
|
+ })
|
|
|
+ if (wx.getStorageSync('loginStatus')) {
|
|
|
+ this.getListFun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //下拉选择
|
|
|
+ bindPickerChange: function (e) { //下拉菜单
|
|
|
+ //方法一动态的
|
|
|
+ let getIndex = e.target.dataset.pickername + 'Index'
|
|
|
+ app.util.getPickerIndex(this, getIndex, e);
|
|
|
+ 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,
|
|
|
+ searchKey : this.data.searchVal,
|
|
|
+ status : this.data.arriveStatusArray[this.data.arriveStatusIndex].dictValue
|
|
|
+ }
|
|
|
+ app.request.pageFirst({
|
|
|
+ url: app.API.bizloadarrivePage,
|
|
|
+ page: this,
|
|
|
+ params: params,
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //页面跳转
|
|
|
+ toLink: function (e) {
|
|
|
+ let { url } = e.currentTarget.dataset
|
|
|
+ wx.navigateTo({
|
|
|
+ url: url
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //删除
|
|
|
+ delFun: function (e) {
|
|
|
+ let _this = this
|
|
|
+ let { id, arriveNumber } = e.currentTarget.dataset
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示!',
|
|
|
+ content: `删除【${arriveNumber}】后不可恢复。确定要删除吗?`,
|
|
|
+ confirmColor: '#FF5B5B',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ app.request.POST({
|
|
|
+ url: app.API.bizloadarriveDelete,
|
|
|
+ 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) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //业务员进行确认
|
|
|
+ comform: function (e) {
|
|
|
+ let _this = this
|
|
|
+ let { id, orderNumber } = e.currentTarget.dataset
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示!',
|
|
|
+ content: `确认【${orderNumber}】后不可取消。确定现在确认订单吗?`,
|
|
|
+ confirmColor: '#FF5B5B',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ app.request.POST({
|
|
|
+ url: app.API.orderConfirm,
|
|
|
+ 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 } = e.currentTarget.dataset
|
|
|
+ this.setData({
|
|
|
+ show: true,
|
|
|
+ orderReason: '',
|
|
|
+ id: id,
|
|
|
+ });
|
|
|
+ /*wx.navigateTo({
|
|
|
+ url: '/pages/appointment/review?id='+e.currentTarget.dataset.id
|
|
|
+ })*/
|
|
|
+ },
|
|
|
+ onClose() {
|
|
|
+ this.setData({
|
|
|
+ show: false,
|
|
|
+ auditFlag:'false',
|
|
|
+ orderReason:'',
|
|
|
+ id: ''
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 单选
|
|
|
+ dangerStatusChange: function (e) {
|
|
|
+ this.setData({
|
|
|
+ [e.currentTarget.dataset.radiotype]: e.detail.value
|
|
|
+ })
|
|
|
+ if (e.detail.value == '1') {
|
|
|
+ this.setData({
|
|
|
+ appointmentReason: ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //审核
|
|
|
+ formSubmit: function (e) {
|
|
|
+ let formData = e.detail.value;
|
|
|
+ var warn = ""; //弹框时提示的内容
|
|
|
+ if (formData.auditFlag=='true' && formData.orderReason == '') {
|
|
|
+ warn = "审核不通过时备注不能为空!";
|
|
|
+ }
|
|
|
+ formData.auditFlag = formData.auditFlag=='true'
|
|
|
+ if (warn != '') {
|
|
|
+ app.util.checkForm(warn);
|
|
|
+ } else {
|
|
|
+ app.request.POST({
|
|
|
+ url: app.API.bizloadarriveAudit,
|
|
|
+ params: formData,
|
|
|
+ page: this,
|
|
|
+ isLoadingTxt: '审核中...',
|
|
|
+ successFun: true
|
|
|
+ }).then(res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: '审核成功',
|
|
|
+ icon: 'success',
|
|
|
+ duration: 1000,
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ this.onClose()
|
|
|
+ this.getListFun(); //刷新列表
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 审核E
|
|
|
+
|
|
|
+
|
|
|
+ //提交
|
|
|
+ orderSubmit: function (e) {
|
|
|
+ let _this = this
|
|
|
+ let { id, orderNumber } = e.currentTarget.dataset
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示!',
|
|
|
+ content: `确认提交【${orderNumber}】订单?`,
|
|
|
+ confirmColor: '#FF5B5B',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ app.request.POST({
|
|
|
+ url: app.API.orderSubmit,
|
|
|
+ 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) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //申请
|
|
|
+ changeAdd() {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: 'add'
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面隐藏
|
|
|
+ */
|
|
|
+ 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,
|
|
|
+ searchKey:this.data.searchVal,
|
|
|
+ arriveStatus:this.data.arriveStatusArray[this.data.arriveStatusIndex].dictValue
|
|
|
+ }
|
|
|
+ app.request.pageOther({
|
|
|
+ url: app.API.bizloadarrivePage,
|
|
|
+ page: this,
|
|
|
+ params: params,
|
|
|
+ loadType: true //加载类型,是否是下拉加载
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ //以下是按钮拖动事件
|
|
|
+ buttonStart: function (e) {
|
|
|
+ startPoint = e.touches[0] //获取拖动开始点
|
|
|
+ },
|
|
|
+ buttonMove: function (e) {
|
|
|
+ var endPoint = e.touches[e.touches.length - 1] //获取拖动结束点
|
|
|
+ //计算在X轴上拖动的距离和在Y轴上拖动的距离
|
|
|
+ var translateX = endPoint.clientX - startPoint.clientX
|
|
|
+ var translateY = endPoint.clientY - startPoint.clientY
|
|
|
+ startPoint = endPoint //重置开始位置
|
|
|
+ var buttonTop = this.data.buttonTop + translateY
|
|
|
+ var buttonLeft = this.data.buttonLeft + translateX
|
|
|
+ //判断是移动否超出屏幕
|
|
|
+ if (buttonLeft + 60 >= this.data.windowWidth) {
|
|
|
+ buttonLeft = this.data.windowWidth - 60;
|
|
|
+ }
|
|
|
+ if (buttonLeft <= 0) {
|
|
|
+ buttonLeft = 0;
|
|
|
+ }
|
|
|
+ if (buttonTop <= this.data.filterHeight) {
|
|
|
+ buttonTop = this.data.filterHeight
|
|
|
+ }
|
|
|
+ if (buttonTop + 60 + 48 + this.data.safeAreaHeight >= this.data.windowHeight) {
|
|
|
+ buttonTop = this.data.windowHeight - 60 - 48 - this.data.safeAreaHeight;
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ buttonTop: buttonTop,
|
|
|
+ buttonLeft: buttonLeft
|
|
|
+ })
|
|
|
+ },
|
|
|
+ buttonEnd: function (e) {},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户点击右上角分享
|
|
|
+ */
|
|
|
+ onShareAppMessage() {
|
|
|
+
|
|
|
+ }
|
|
|
+})
|