index.js 23 KB

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