index.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. // pages/index/index.js
  2. const app = getApp()
  3. var QRCode = require('../../utils/weapp-qrcode.js');
  4. var startPoint
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. str:' ',
  11. loginStatus: wx.getStorageSync('loginStatus') ? wx.getStorageSync('loginStatus') : false,
  12. roleCodeList: wx.getStorageSync('roleCodeList') ? wx.getStorageSync('roleCodeList') : '',
  13. content: '',
  14. filterWidth: 0, //获取顶部筛选宽度
  15. filterHeight: 0, //获取顶部筛选高度
  16. safeAreaHeight: 0, //底部安全区域的高度
  17. //按钮位置参数
  18. buttonTop: 0,
  19. buttonLeft: 0,
  20. windowHeight: '',
  21. windowWidth: '',
  22. //分页
  23. requestStatu: '', //加载中...
  24. limit: 10,
  25. page: 1,
  26. totalPages: 1,
  27. more: false,
  28. nomore: '',
  29. searchVal: '', //筛选条件
  30. appointmentClassifyArray: [
  31. { label:'充电预约',value:'1' },
  32. { label:'管桩预约',value:'2' },
  33. { label:'其他预约',value:'3' },
  34. ],
  35. appointmentTypeArray: [{
  36. dictValue: "",
  37. dictLabel: "全部状态"
  38. }],
  39. appointmentTypeIndex: 0,
  40. appointmentStatusArray: [{
  41. dictValue: "",
  42. dictLabel: "全部状态"
  43. }],
  44. appointmentStatusIndex: 0,
  45. registStatus: '', //状态
  46. registStatusdrc: '', //显示状态数值
  47. registStatusdgb: '', //显示状态数值
  48. registStatusgbz: '', //显示状态数值
  49. registStatusdcc: '', //显示状态数值
  50. registStatusycc: '', //显示状态数值
  51. appointmentType: '', //切换显示
  52. appointmentTypeSha: '', //砂石
  53. appointmentTypeQi: '', //起卸
  54. appointmentTypeGuan: '', //管桩
  55. appointmentTypeChong: '', //充电桩
  56. appointmentTypeOther: '', //其他
  57. //筛选E
  58. setIndex: 0,
  59. resData: [],
  60. showQrcode:false,
  61. show:false,
  62. auditFlag:'false'
  63. },
  64. //下拉选择
  65. bindPickerChange: function (e) { //下拉菜单
  66. //方法一动态的
  67. let getIndex = e.target.dataset.pickername + 'Index'
  68. app.util.getPickerIndex(this, getIndex, e);
  69. this.getListFun()
  70. },
  71. //去登录页面
  72. toLogin(e) {
  73. wx.navigateTo({
  74. url: '../login/index',
  75. })
  76. },
  77. //拨打电话
  78. call: function (e) {
  79. e.currentTarget.dataset.phone && wx.makePhoneCall({
  80. phoneNumber: e.currentTarget.dataset.phone
  81. })
  82. },
  83. //变动筛选条件时
  84. changeFilter: function (e) {
  85. let getFilterType = e.currentTarget.dataset.filtertype + 'Value'
  86. this.setData({
  87. [getFilterType]: e.detail
  88. })
  89. //重新请求
  90. this.getListFun();
  91. },
  92. /**
  93. * 生命周期函数--监听页面加载
  94. */
  95. onLoad: function (options) {
  96. //订单状态
  97. if(wx.getStorageSync('loginStatus')){
  98. this.getTree()
  99. }
  100. this.setData({
  101. safeAreaHeight: app.globalData.windowInfo.screenHeight - app.globalData.systemInfo.safeArea.bottom
  102. })
  103. // 使用选择器选择节点
  104. this.getFilterHeight()
  105. //获取页面高度设置新增按钮的初始位置
  106. var that = this;
  107. wx.getSystemInfo({
  108. success: function (res) {
  109. // 高度,宽度 单位为px
  110. that.setData({
  111. windowHeight: res.windowHeight, //屏幕宽度、高度
  112. windowWidth: res.windowWidth,
  113. buttonTop: res.windowHeight * 0.8 - that.data.safeAreaHeight-60, //这里定义按钮的初始位置
  114. buttonLeft: res.windowWidth * 0.80, //这里定义按钮的初始位置
  115. })
  116. }
  117. })
  118. },
  119. //获取顶部筛选区域的高度
  120. getFilterHeight:function(){
  121. let that = this;
  122. // 使用顶部筛选高度选择器选择节点的高度
  123. const query = wx.createSelectorQuery();
  124. query.select('.topFilter').boundingClientRect(function (rect) {
  125. if(rect){
  126. that.setData({
  127. filterWidth: rect.width,
  128. filterHeight: rect.height,
  129. });
  130. }
  131. }).exec();
  132. },
  133. // 二维码弹框
  134. showQrcodePopup(e) {
  135. let { id, licenseNumber } = e.currentTarget.dataset
  136. this.setData({
  137. showQrcode : true,
  138. id : id,
  139. });
  140. this.makeCode(JSON.stringify({
  141. "id" : id,
  142. "licenseNumber" : licenseNumber
  143. }))
  144. },
  145. // 二维码
  146. makeCode(data) {
  147. var qrcode;
  148. qrcode = new QRCode('canvas', {
  149. text: data,
  150. width: 220,
  151. height: 220,
  152. colorDark: "#000000",
  153. colorLight: "#ffffff",
  154. correctLevel: QRCode.CorrectLevel.H,
  155. });
  156. qrcode.makeCode(data);
  157. },
  158. onCloseQrcode() {
  159. this.setData({
  160. showQrcode : false,
  161. id : '',
  162. });
  163. },
  164. /**
  165. * 生命周期函数--监听页面初次渲染完成
  166. */
  167. onReady() {
  168. },
  169. //绑定微信
  170. bindingWX: function () {
  171. let _this = this;
  172. if (this.data.loginStatus) {
  173. wx.showModal({
  174. title: '提示',
  175. content: '确定绑定该微信账号?',
  176. success: function (res) {
  177. if (res.confirm) {
  178. wx.login({
  179. success: (res) => {
  180. //console.log(res.code)
  181. app.request.requestPostApi(app.API.api.bindingWX, {
  182. id: wx.getStorageSync('id'),
  183. appCode: res.code
  184. }, _this, function (res, that) {
  185. if (res.code == '200') { //退出登录
  186. wx.showToast({
  187. title: '绑定成功',
  188. icon: 'none',
  189. duration: 1500,
  190. mask: true
  191. })
  192. } else {
  193. wx.showToast({
  194. title: res.data.msg ? res.data.msg : '出错了',
  195. icon: 'none',
  196. duration: 1500,
  197. mask: true
  198. })
  199. }
  200. });
  201. },
  202. })
  203. }
  204. }
  205. })
  206. } else {
  207. wx.showToast({
  208. title: '您还未登录!',
  209. icon: 'none',
  210. duration: 1500,
  211. mask: true
  212. })
  213. }
  214. },
  215. /**
  216. * 生命周期函数--监听页面显示
  217. */
  218. onShow: function () {
  219. let that = this
  220. const roleCodeList = wx.getStorageSync('roleCodeList')
  221. let loginStatus = wx.getStorageSync('loginStatus')
  222. this.setData({
  223. searchVal: '',
  224. roleCodeList: roleCodeList ? roleCodeList : '',
  225. loginStatus: loginStatus ? loginStatus : false
  226. })
  227. //动态tabbar
  228. // if (roleCodeList == 'bizAdmin') {
  229. // this.getTabBar().setData({
  230. // list: app.globalData.allList[0].list2,
  231. // })
  232. // } else if(roleCodeList == 'send') {
  233. // this.getTabBar().setData({
  234. // list: app.globalData.allList[0].list3,
  235. // })
  236. // } else if(roleCodeList == 'sale') {
  237. // this.getTabBar().setData({
  238. // list: app.globalData.allList[0].list4,
  239. // })
  240. // } else if(roleCodeList == 'customer') {
  241. // this.getTabBar().setData({
  242. // list: app.globalData.allList[0].list5,
  243. // })
  244. // } else if (roleCodeList=='driver'||roleCodeList==''){
  245. // this.getTabBar().setData({
  246. // list: app.globalData.allList[0].list1,
  247. // })
  248. // }
  249. // if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  250. // this.getTabBar().setData({
  251. // selected: 0
  252. // })
  253. // }
  254. if (wx.getStorageSync('loginStatus')) {
  255. // if (roleCodeList=='bizAdmin') {
  256. // wx.switchTab({
  257. // url: '/pages/queueCar/index',
  258. // })
  259. // } else if (roleCodeList=='send') {
  260. // wx.switchTab({
  261. // url: '/pages/deliveryConfirm/index',
  262. // })
  263. // } else if (roleCodeList=='sale') {
  264. // wx.switchTab({
  265. // url: '/pages/salesOrderMan/index',
  266. // })
  267. // }
  268. if(this.data.filterHeight){
  269. const query = wx.createSelectorQuery();
  270. query.select('.topFilter').boundingClientRect(function (rect) {
  271. that.setData({
  272. filterWidth: rect.width,
  273. filterHeight: rect.height,
  274. });
  275. }).exec();
  276. }
  277. if(roleCodeList=='driver'||roleCodeList=='customer'){
  278. this.getListFun();
  279. }
  280. if(this.data.appointmentStatusArray.length==1 || this.data.appointmentTypeArray.length==1){
  281. this.getTree()
  282. }
  283. }
  284. },
  285. //获取字典数据
  286. getTree:function(){
  287. app.request.GET({
  288. url:app.API.getTree,
  289. page:this,
  290. successFun:true
  291. }).then(res=>{
  292. if(this.data.appointmentStatusArray.length==1){
  293. let treeData = res.data.data
  294. for (const element of treeData) {
  295. let arrStr;
  296. switch (element.dictValue) {
  297. case 'appointment_status':
  298. arrStr = "appointmentStatusArray";
  299. break;
  300. }
  301. let getArray = this.data.appointmentStatusArray
  302. this.setData({
  303. [arrStr]: getArray.concat(element.children)
  304. })
  305. }
  306. }
  307. if(this.data.appointmentTypeArray.length==1){
  308. let treeData = res.data.data
  309. for (const element of treeData) {
  310. let arrStr;
  311. switch (element.dictValue) {
  312. case 'appointment_type':
  313. arrStr = "appointmentTypeArray";
  314. break;
  315. }
  316. let getArray = this.data.appointmentTypeArray
  317. this.setData({
  318. [arrStr]: getArray.concat(element.children)
  319. })
  320. }
  321. }
  322. })
  323. },
  324. //获取通知消息
  325. getContent: function () {
  326. app.request.GET({
  327. url: app.API.getContent,
  328. params: {},
  329. page: this,
  330. successFun: true
  331. }).then(res => {
  332. //console.log(res.data.data)
  333. this.setData({
  334. content: res.data.data.content
  335. })
  336. })
  337. },
  338. //预约列表页面审核状态汇总页面接口
  339. getReservationCount: function () {
  340. app.request.GET({
  341. url: app.API.reservationCount,
  342. params: {},
  343. page: this,
  344. successFun: true
  345. }).then(res => {
  346. let resData = res.data.data
  347. let getApplyData = this.data.applyData
  348. resData.forEach(element => {
  349. //console.log(element)
  350. switch (Number(element.reservationStatus)) {
  351. case 0:
  352. getApplyData[1].label = '待审核' + "(" + element.recordCount + ")辆"
  353. break;
  354. case 1:
  355. getApplyData[2].label = '审核通过' + "(" + element.recordCount + ")辆"
  356. break;
  357. case 2:
  358. getApplyData[3].label = '过磅中' + "(" + element.recordCount + ")辆"
  359. break;
  360. }
  361. });
  362. this.setData({
  363. applyData: getApplyData
  364. })
  365. })
  366. },
  367. //搜索框请求S
  368. onChange(e) {
  369. this.setData({
  370. searchVal: e.detail,
  371. });
  372. },
  373. onSearch: function (event) {
  374. this.setData({
  375. searchVal: event.detail
  376. })
  377. this.getListFun();
  378. },
  379. onCancel: function () {
  380. this.setData({})
  381. },
  382. toSearch: function (event) {
  383. this.getListFun();
  384. },
  385. statusFun: function (e) {
  386. this.setData({
  387. registStatus : e.currentTarget.dataset.status
  388. })
  389. this.getListFun()
  390. },
  391. typeFun: function (e) {
  392. this.setData({
  393. appointmentType : e.currentTarget.dataset.type
  394. })
  395. this.getListFun()
  396. },
  397. //状态筛选
  398. clickScroll: function (e) {
  399. this.setData({
  400. setIndex: e.detail.index
  401. })
  402. this.getListFun()
  403. },
  404. //预约类型
  405. onClick() {
  406. this.getListFun()
  407. },
  408. //列表
  409. getListFun: function () {
  410. this.setData({
  411. page: 1
  412. })
  413. let params = {
  414. current : this.data.page,
  415. size : this.data.limit,
  416. appointmentStatus : this.data.appointmentStatusArray[this.data.appointmentStatusIndex].dictValue,
  417. licenseNumber : this.data.searchVal,
  418. type : this.data.appointmentType
  419. }
  420. app.request.pageFirst({
  421. url: app.API.appointmentPage,
  422. page: this,
  423. params: params,
  424. })
  425. // if (this.data.roleCodeList != '0') {
  426. // this.getReservationCount()
  427. // }
  428. },
  429. //分类统计数据获取
  430. getTypeCount: function () {
  431. app.request.GET({
  432. url: app.API.typeCount,
  433. page: this,
  434. params: {
  435. appointmentType: this.data.appointmentType,
  436. searchKey: this.data.searchVal
  437. },
  438. successFun: true
  439. }).then(res => {
  440. let getCount = res.data.data
  441. for (let key in getCount) {
  442. let setStr = 'appointmentType' + key
  443. this.setData({
  444. [setStr]: getCount[key]
  445. })
  446. }
  447. })
  448. },
  449. //扫码预约申请
  450. changeAdd() {
  451. // wx.navigateTo({
  452. // url: '/pages/reservationLoadAppoint/add?orderId=1940665005240860674'
  453. // })
  454. wx.scanCode({
  455. success: (res) => {
  456. let info = JSON.parse(res.result.trim())
  457. console.log(info)
  458. //console.log(JSON.parse(info)) //{id: "1712651156370632706", projectCode: "D456"}
  459. if(info.type=='1'){
  460. // 砂石预约
  461. wx.navigateTo({
  462. url: 'add?orderId=' + info.id + '&orderName='+ info.orderName+'&orderNumber='+ info.orderNumber
  463. })
  464. // }else if(info.type=='2'){
  465. // // 临时预约----已作废
  466. // wx.navigateTo({
  467. // url: '/pages/reservationTemp/add?orderId=' + info.id + '&orderName='+ info.orderName+'&orderNumber='+ info.orderNumber
  468. // })
  469. }else if(info.type=='3'){
  470. // 起卸预约
  471. wx.navigateTo({
  472. url: '/pages/reservationLoadAppoint/add?orderId=' + info.id
  473. })
  474. }else if(info.type=='4'){
  475. // 充电桩预约
  476. wx.navigateTo({
  477. url: '/pages/reservationChargestation/add?orderId=' + info.id
  478. })
  479. }else if(info.type=='5'){
  480. // 管桩预约
  481. wx.navigateTo({
  482. url: '/pages/reservationPipe/add?orderId=' + info.id
  483. })
  484. }else if(info.type=='6'){
  485. // 其他预约
  486. wx.navigateTo({
  487. url: '/pages/other/add?orderId=' + info.id
  488. })
  489. }
  490. },
  491. fail: (res) => {
  492. wx.showToast({
  493. title: '请重试!',
  494. icon: 'error',
  495. duration: 2000
  496. })
  497. }
  498. })
  499. },
  500. //删除
  501. delFun: function (e) {
  502. let _this = this
  503. let { id, licenseNumber } = e.currentTarget.dataset
  504. wx.showModal({
  505. title: '提示!',
  506. content: `删除【${licenseNumber}】后不可恢复。确定要删除吗?`,
  507. confirmColor: '#FF5B5B',
  508. success: function (res) {
  509. if (res.confirm) {
  510. app.request.POST({
  511. url: app.API.appointmentDelete,
  512. params: [{
  513. id: id
  514. }],
  515. page: _this,
  516. isLoadingTxt: '删除中...',
  517. successFun: true
  518. }).then(res => {
  519. wx.showToast({
  520. title: '删除成功',
  521. icon: 'success',
  522. duration: 1000,
  523. mask: true
  524. })
  525. _this.getListFun(); //刷新列表
  526. })
  527. } else if (res.cancel) {
  528. }
  529. }
  530. })
  531. },
  532. //取消预约
  533. cancelFun: function (e) {
  534. let _this = this
  535. let { id, licenseNumber } = e.currentTarget.dataset
  536. wx.showModal({
  537. title: '提示!',
  538. content: `取消【${licenseNumber}】后不可恢复。确定要取消吗?`,
  539. confirmColor: '#FF5B5B',
  540. success: function (res) {
  541. if (res.confirm) {
  542. app.request.POST({
  543. url: app.API.appointmentCancel,
  544. params: {
  545. id: id
  546. },
  547. page: _this,
  548. isLoadingTxt: '取消中...',
  549. successFun: true
  550. }).then(res => {
  551. wx.showToast({
  552. title: '取消成功',
  553. icon: 'success',
  554. duration: 1000,
  555. mask: true
  556. })
  557. _this.getListFun(); //刷新列表
  558. })
  559. } else if (res.cancel) {
  560. }
  561. }
  562. })
  563. },
  564. //充电结束预约
  565. overFun: function (e) {
  566. let _this = this
  567. let { id, licenseNumber } = e.currentTarget.dataset
  568. wx.showModal({
  569. title: '提示!',
  570. content: `确定【${licenseNumber}】要充电结束。确定要结束吗?`,
  571. confirmColor: '#FF5B5B',
  572. success: function (res) {
  573. if (res.confirm) {
  574. app.request.POST({
  575. url: app.API.chargestationExit,
  576. params: {
  577. id: id
  578. },
  579. page: _this,
  580. isLoadingTxt: '充电结束中...',
  581. successFun: true
  582. }).then(res => {
  583. wx.showToast({
  584. title: '充电结束完成',
  585. icon: 'success',
  586. duration: 1000,
  587. mask: true
  588. })
  589. _this.getListFun(); //刷新列表
  590. })
  591. } else if (res.cancel) {
  592. }
  593. }
  594. })
  595. },
  596. //修改
  597. toUpdate: function (e) {
  598. let { id, index, type } = e.currentTarget.dataset
  599. if(type=='1'){
  600. wx.navigateTo({
  601. url: 'edit?id=' + id + '&index=' + index,
  602. })
  603. // }else if(type=='2'){
  604. // wx.navigateTo({
  605. // url: '/pages/reservationTemp/edit?id=' + id + '&index=' + index,
  606. // })
  607. }else if(type=='3'){
  608. wx.navigateTo({
  609. url: '/pages/reservationLoadAppoint/edit?id=' + id + '&index=' + index,
  610. })
  611. }else if(type=='4'){
  612. wx.navigateTo({
  613. url: '/pages/reservationChargestation/edit?id=' + id + '&index=' + index,
  614. })
  615. }else if(type=='5'){
  616. wx.navigateTo({
  617. url: '/pages/reservationPipe/edit?id=' + id + '&index=' + index,
  618. })
  619. }
  620. },
  621. //页面跳转
  622. toLink: function (e) {
  623. let { url } = e.currentTarget.dataset
  624. wx.navigateTo({
  625. url: url
  626. })
  627. },
  628. // 审核S
  629. showPopup(e) {
  630. let { id } = e.currentTarget.dataset
  631. this.setData({
  632. show: true,
  633. id: id
  634. });
  635. },
  636. onClose() {
  637. this.setData({
  638. show: false,
  639. auditFlag:'false',
  640. id: ''
  641. });
  642. },
  643. // 单选
  644. dangerStatusChange: function (e) {
  645. this.setData({
  646. [e.currentTarget.dataset.radiotype]: e.detail.value
  647. })
  648. },
  649. //审核
  650. formSubmit: function (e) {
  651. let formData = e.detail.value;
  652. var warn = ""; //弹框时提示的内容
  653. // if (formData.auditFlag == '') {
  654. // warn = "选择审核结果!";
  655. // } else if (formData.auditFlag == '2' && formData.appointmentReason == '') {
  656. // warn = "审核不通过时备注不能为空!";
  657. // }
  658. formData.auditFlag = formData.auditFlag=='true'
  659. if (warn != '') {
  660. app.util.checkForm(warn);
  661. } else {
  662. app.request.POST({
  663. url: app.API.appointmentAudit,
  664. params: formData,
  665. page: this,
  666. isLoadingTxt: '审核中...',
  667. successFun: true
  668. }).then(res => {
  669. wx.showToast({
  670. title: '审核成功',
  671. icon: 'success',
  672. duration: 1000,
  673. mask: true
  674. })
  675. this.onClose()
  676. this.getListFun(); //刷新列表
  677. })
  678. }
  679. },
  680. // 审核E
  681. //提交申请
  682. sendFun: function (e) {
  683. let _this = this;
  684. if (this.data.loginStatus) {
  685. wx.showModal({
  686. title: '提示',
  687. content: '确定立即提交申请?',
  688. success: function (res) {
  689. if (res.confirm) {
  690. app.request.requestGetApi(app.API.api.appointmentSend, {
  691. id: e.currentTarget.dataset.id
  692. }, _this, function (res, that) {
  693. if (res.statusCode == '200') { //退出登录
  694. wx.showToast({
  695. title: '提交成功',
  696. icon: 'success',
  697. duration: 2000,
  698. complete: function () {
  699. setTimeout(function () {
  700. that.getListFun();
  701. }, 1500) //延迟时间
  702. }
  703. })
  704. } else {
  705. wx.showToast({
  706. title: res.data.msg ? res.data.msg : '出错了',
  707. icon: 'none',
  708. duration: 1500,
  709. mask: true
  710. })
  711. }
  712. });
  713. }
  714. }
  715. })
  716. } else {
  717. wx.showToast({
  718. title: '您还未登录,无需退出哦!',
  719. icon: 'none',
  720. duration: 1500,
  721. mask: true
  722. })
  723. }
  724. },
  725. /**
  726. * 生命周期函数--监听页面隐藏
  727. */
  728. onHide: function () {
  729. },
  730. /**
  731. * 生命周期函数--监听页面卸载
  732. */
  733. onUnload: function () {
  734. },
  735. /**
  736. * 页面相关事件处理函数--监听用户下拉动作
  737. */
  738. onPullDownRefresh: function () {
  739. this.setData({
  740. searchVal: ''
  741. })
  742. if (wx.getStorageSync('loginStatus')) {
  743. this.getListFun();
  744. } else {
  745. wx.stopPullDownRefresh();
  746. }
  747. },
  748. /**
  749. * 页面上拉触底事件的处理函数
  750. */
  751. onReachBottom: function () {
  752. this.data.page++;
  753. let params = {
  754. current: this.data.page,
  755. size: this.data.limit,
  756. licenseNumber: this.data.searchVal,
  757. reservationStatus: this.data.applyData[this.data.setIndex].value,
  758. reservationType: this.data.typeArray[this.data.typeIndex].code,
  759. }
  760. app.request.pageOther({
  761. url: app.API.appointmentPage,
  762. page: this,
  763. params: params,
  764. loadType: true, //加载类型,是否是下拉加载
  765. });
  766. //this.getTypeCount()
  767. },
  768. //以下是按钮拖动事件
  769. buttonStart: function (e) {
  770. startPoint = e.touches[0] //获取拖动开始点
  771. },
  772. buttonMove: function (e) {
  773. var endPoint = e.touches[e.touches.length - 1] //获取拖动结束点
  774. //计算在X轴上拖动的距离和在Y轴上拖动的距离
  775. var translateX = endPoint.clientX - startPoint.clientX
  776. var translateY = endPoint.clientY - startPoint.clientY
  777. startPoint = endPoint //重置开始位置
  778. var buttonTop = this.data.buttonTop + translateY
  779. var buttonLeft = this.data.buttonLeft + translateX
  780. //判断是移动否超出屏幕
  781. if (buttonLeft + 60 >= this.data.windowWidth) {
  782. buttonLeft = this.data.windowWidth - 60;
  783. }
  784. if (buttonLeft <= 0) {
  785. buttonLeft = 0;
  786. }
  787. if (buttonTop <= this.data.filterHeight) {
  788. buttonTop = this.data.filterHeight
  789. }
  790. if (buttonTop + 60 + 48 + this.data.safeAreaHeight >= this.data.windowHeight) {
  791. buttonTop = this.data.windowHeight - 60 - 48 - this.data.safeAreaHeight;
  792. }
  793. this.setData({
  794. buttonTop: buttonTop,
  795. buttonLeft: buttonLeft
  796. })
  797. },
  798. buttonEnd: function (e) {},
  799. /**
  800. * 用户点击右上角分享
  801. */
  802. onShareAppMessage: function () {
  803. }
  804. })