servant.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. const app = getApp()
  2. const util = require("../../utils/util");
  3. const api = require('../../api/api.js');
  4. const user = require('../../utils/user.js');
  5. const wxCharts = require('../../utils/wxcharts-min.js')
  6. import todo from '../../lib/calendar/plugins/todo'
  7. import selectable from '../../lib/calendar/plugins/selectable'
  8. import solarLunar from '../../lib/calendar/plugins/solarLunar/index'
  9. import timeRange from '../../lib/calendar/plugins/time-range'
  10. import week from '../../lib/calendar/plugins/week'
  11. import holidays from '../../lib/calendar/plugins/holidays/index'
  12. import plugin from '../../lib/calendar/plugins/index'
  13. var calendar;
  14. plugin.use(todo).use(solarLunar).use(selectable).use(week).use(timeRange).use(holidays)
  15. Page({
  16. data: {
  17. userInfo: {
  18. nickName: '点击登录',
  19. avatarUrl: '/static/images/my.png'
  20. },
  21. hasLogin: false,
  22. count: 0, //服务中的工单 当天待处理
  23. list: [],
  24. page: 1,
  25. limit: 10,
  26. totalPages: 1,
  27. addressInfo: {
  28. shopId: 0
  29. },
  30. myqr_show: false, //我的分享二维码
  31. myqr_url: null,
  32. myqr_blur: 0, //背景模糊值
  33. code: '',
  34. calendarConfig: {
  35. theme: 'elegant'
  36. },
  37. list: [],
  38. board: {},
  39. selected: [], //选中日期的服务单
  40. selectedDate: '未选择', //选中的日期和时间
  41. selectedTime: '',
  42. isMaster: false, //是否为站长
  43. curDate: '', //当前选中时间
  44. line: {}, //当登录用户是站长时的数据对象
  45. today: '', //今日时间 用来控制是否可以点击到家
  46. testMobiles: ['132****8272', '173****9375', '182****9968', '130****7996', '131****2586', '138****9808', '151****2510', '178****5726','166****5459','180****8315','158****3676'],
  47. isTest: false,
  48. isFirstLoad: true, //是否第一次加载此页面
  49. salary:{//工资信息
  50. salary:0,
  51. total:0
  52. }
  53. },
  54. /**
  55. * 生命周期函数--监听页面加载
  56. */
  57. onLoad: function (options) {
  58. let week = util.getWeekByDate(new Date());
  59. this.setData({
  60. today: util.formatDate(new Date()) + ' ' + week
  61. })
  62. var addressInfo = wx.getStorageSync('addressInfo');
  63. if (addressInfo) {
  64. this.setData({
  65. addressInfo: addressInfo
  66. })
  67. }
  68. let that = this;
  69. user.login().then(res => {
  70. console.info(res)
  71. that.setData({
  72. code: res.code
  73. })
  74. })
  75. },
  76. // alertModel(){
  77. // if(wx.getStorageSync('alertgq')&&wx.getStorageSync('alertgq')==1){
  78. // return;
  79. // }
  80. // wx.showModal({
  81. // title: '公告',
  82. // content: '由于国庆假期,服务费盒马部分数据无法按时提供,影响核算时间,故本次9月服务费延期至10月17日周一发放,请各位劳动者知悉。',
  83. // success (res) {
  84. // if (res.confirm) {
  85. // console.log('用户点击确定')
  86. // wx.setStorageSync('alertgq', 1);
  87. // }
  88. // }
  89. // })
  90. // },
  91. goArrived(e) { //我已上门
  92. let that = this;
  93. let bookTradeNo = e.currentTarget.dataset.id;
  94. wx.showModal({
  95. title: '我已上门',
  96. content: '确定我已到顾客服务地?',
  97. showCancel: true, //是否显示取消按钮
  98. confirmText: "已上门", //默认是“确定”
  99. confirmColor: '#09afff', //确定文字的颜色
  100. success: function (res) {
  101. if (res.confirm == false) return;
  102. wx.showLoading();
  103. util.request(api.HmApiArrived, {
  104. bookTradeNo: bookTradeNo
  105. }).then(res => {
  106. wx.hideLoading();
  107. if (res.errno == 0) {
  108. let selected = that.data.selected;
  109. selected.forEach(item => {
  110. if (item.bookNo == bookTradeNo) {
  111. item.status = '待履约'
  112. }
  113. })
  114. that.setData({
  115. selected: selected
  116. })
  117. } else
  118. util.showErrorToast(res.errmsg);
  119. }).catch(res => {
  120. wx.hideLoading();
  121. util.showErrorToast(res.errmsg);
  122. })
  123. }
  124. })
  125. },
  126. goConfirm(e) {
  127. let that = this;
  128. let bookTradeNo = e.currentTarget.dataset.id;
  129. wx.showModal({
  130. title: '服务已完成',
  131. content: '确定我已服务完成?',
  132. showCancel: true, //是否显示取消按钮
  133. confirmText: "完成", //默认是“确定”
  134. confirmColor: '#09afff', //确定文字的颜色
  135. success: function (res) {
  136. if (res.confirm == false) return;
  137. wx.showLoading();
  138. util.request(api.HmApiConfirm, {
  139. bookTradeNo: bookTradeNo
  140. }).then(res => {
  141. wx.hideLoading();
  142. if (res.errno == 0) {
  143. let selected = that.data.selected;
  144. selected.forEach(item => {
  145. if (item.bookNo == bookTradeNo) {
  146. item.status = '服务已完成'
  147. }
  148. })
  149. that.setData({
  150. selected: selected
  151. })
  152. } else
  153. util.showErrorToast(res.errmsg);
  154. }).catch(res => {
  155. wx.hideLoading();
  156. util.showErrorToast(res.errmsg);
  157. })
  158. }
  159. })
  160. },
  161. goProblemAdd(e) {
  162. let id = e.currentTarget.dataset.id;
  163. if (id) {
  164. wx.navigateTo({
  165. url: '/pages/problem/list/list?bookTradeNo=' + id,
  166. })
  167. }
  168. },
  169. getBoard(month) { //获取看板信息
  170. let that = this;
  171. that.setData({
  172. curDate: month
  173. })
  174. wx.showLoading();
  175. util.request(api.Board, {
  176. 'month': month
  177. }).then(res => {
  178. console.info(res.data)
  179. wx.hideLoading();
  180. // if (res.data.isMaster) {
  181. // that.setData({
  182. // line: res.data.board,
  183. // isMaster: res.data.isMaster
  184. // })
  185. // that.goChat();
  186. // } else {
  187. console.info("getScheduling")
  188. that.setData({
  189. board: res.data.board,
  190. isMaster: res.data.isMaster
  191. })
  192. //that.calendar.header= res.data.board;
  193. that.getScheduling();
  194. //}
  195. }).catch(res => {
  196. //console.info(res)
  197. wx.hideLoading();
  198. util.showErrorToast(res.errmsg);
  199. })
  200. },
  201. isNewYearReport() { //是否新年报表
  202. util.request(api.NewYearReported).then(res => {
  203. if (!res.data) {
  204. wx.showModal({
  205. title: '返乡调查',
  206. content: '新年返乡调查已开始,是否现在去报备?',
  207. success: function (sm) {
  208. if (sm.confirm) {
  209. wx.navigateTo({
  210. url: '/pages/servant/gohome/report',
  211. })
  212. }
  213. }
  214. });
  215. }
  216. })
  217. },
  218. getScheduling() { //获取可用排班
  219. let that = this;
  220. //获取当月的所有日期
  221. if (calendar == undefined) {
  222. return;
  223. }
  224. var dates = calendar.getCalendarDates({
  225. lunar: true
  226. })
  227. //一天多个订单 聚集到一个list
  228. var books = [];
  229. dates.forEach(function (item, index) {
  230. var _date = String(item.year) + '-' + ((item.month < 10 ? "0" : "") + String(item.month)) + '-' + ((item.date < 10 ? "0" : "") + String(item.date));
  231. var bookDate = null;
  232. books.forEach(book => {
  233. if (book.date == _date)
  234. bookDate = book;
  235. })
  236. //是否包含当前日期
  237. that.data.board.details.forEach(element => {
  238. if (element.date == _date) {
  239. if (bookDate == null) {
  240. bookDate = {
  241. date: item.date,
  242. books: []
  243. };
  244. books.push(bookDate);
  245. }
  246. bookDate.books.push(element);
  247. }
  248. })
  249. })
  250. //赋值显示
  251. //console.info(books);
  252. books.forEach(item => {
  253. if (item.books.length > 0) {
  254. that.calenderTodo(item.date, item.books);
  255. }
  256. })
  257. that.setData({
  258. list: books
  259. });
  260. //选中当前时间
  261. if (that.data.isFirstLoad) {
  262. let now = new Date();
  263. let year = now.getFullYear();
  264. let month = now.getMonth() + 1;
  265. let day = now.getDate();
  266. const toSet = [{
  267. year,
  268. month,
  269. date: day
  270. }, {
  271. year,
  272. month,
  273. date: day
  274. }]
  275. calendar['setSelectedDates'](toSet);
  276. let nowDay = now.getDate();
  277. if (nowDay < 10)
  278. nowDay = '0' + nowDay;
  279. this.selectDate(util.formatDate(now), nowDay);
  280. }
  281. },
  282. goChat() {
  283. let that = this;
  284. var windowWidth = '',
  285. windowHeight = ''; //定义宽高
  286. try {
  287. var res = wx.getSystemInfoSync(); //试图获取屏幕宽高数据
  288. windowWidth = res.windowWidth / 750 * 690; //以设计图750为主进行比例算换
  289. windowHeight = res.windowWidth / 750 * 550 //以设计图750为主进行比例算换
  290. } catch (e) {
  291. console.error('getSystemInfoSync failed!'); //如果获取失败
  292. }
  293. new wxCharts({ //定义一个wxCharts图表实例
  294. canvasId: 'lineCanvas', //输入wxml中canvas的id
  295. type: 'line', //图标展示的类型有:'line','pie','column','area','ring','radar'
  296. categories: that.data.line.categories, //['6-13', '6-14', '6-15', '6-16', '6-17', '6-18', '6-19'],
  297. animation: true, //是否开启动画
  298. series: that.data.line.series,
  299. xAxis: { //是否隐藏x轴分割线
  300. disableGrid: true,
  301. },
  302. yAxis: { //y轴数据
  303. title: '数值', //标题
  304. format: function (val) { //返回数值
  305. return val.toFixed(2);
  306. },
  307. gridColor: '#D8D8D8',
  308. },
  309. width: windowWidth, //图表展示内容宽度
  310. height: windowHeight, //图表展示内容高度
  311. dataLabel: false, //是否在图表上直接显示数据
  312. dataPointShape: true, //是否在图标上显示数据点标志
  313. extra: {
  314. lineStyle: 'curve' //曲线
  315. },
  316. });
  317. },
  318. goNextWeek() {
  319. var date = util.mathChangeDate(this.data.curDate, '+', 7, true);
  320. console.info(date)
  321. this.getBoard(date)
  322. },
  323. goPreWeek() {
  324. var date = util.mathChangeDate(this.data.curDate, '-', 7, true);
  325. console.info(date)
  326. this.getBoard(date)
  327. },
  328. qrtouchstart: function () {
  329. this.setData({
  330. myqr_blur: 0,
  331. myqr_show: false
  332. });
  333. },
  334. /**
  335. * 生命周期函数--监听页面初次渲染完成
  336. */
  337. onReady: function () {
  338. },
  339. /**
  340. * 生命周期函数--监听页面显示
  341. */
  342. onShow: function () {
  343. let userInfo = wx.getStorageSync('userInfo');
  344. if (userInfo) {
  345. this.setData({
  346. userInfo: userInfo,
  347. hasLogin: true
  348. });
  349. var isTest = false;
  350. this.data.testMobiles.forEach(item => {
  351. if (item == userInfo.mobile)
  352. isTest = true;
  353. })
  354. this.setData({
  355. isTest: isTest
  356. });
  357. }
  358. if (this.hasLogin == false) {
  359. wx.navigateTo({
  360. url: '/pages/index/index',
  361. })
  362. return;
  363. }
  364. //this.isNewYearReport();
  365. if (this.data.curDate != '') return;
  366. this.setData({
  367. list: []
  368. })
  369. this.getSalary(util.formatDate(new Date()));
  370. this.getBoard(util.formatDate(new Date()));
  371. },
  372. getSalary(month){
  373. let that=this
  374. util.request(api.BoardSalary,{month:month}).then(res=>{
  375. that.setData({
  376. salary:res.data
  377. })
  378. })
  379. },
  380. getGoodsList() {
  381. let that = this
  382. //console.info(that.data.addressInfo)
  383. wx.showLoading();
  384. util.request(api.GoodsList, {
  385. shopId: that.data.addressInfo.shopId,
  386. limit: that.data.limit,
  387. page: that.data.page
  388. }).then(res => {
  389. wx.hideLoading();
  390. if (res.errno === 0) {
  391. that.setData({
  392. list: that.data.list.concat(res.data.list),
  393. totalPages: res.data.pages
  394. });
  395. }
  396. }).catch(res => {
  397. console.info(res)
  398. wx.hideLoading();
  399. })
  400. },
  401. getUserProfile(e) {
  402. let that = this
  403. wx.getUserProfile({
  404. desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  405. success: (res) => {
  406. res.userInfo.code = that.data.code;
  407. util.request(api.AuthLoginByWeixin, res.userInfo, "POST").then(res => {
  408. console.info(res)
  409. if (res.errno == 0) {
  410. that.setData({
  411. userInfo: res.data.userInfo
  412. })
  413. wx.setStorageSync('userInfo', res.data.userInfo);
  414. }
  415. })
  416. }
  417. })
  418. },
  419. goNucleicList() {
  420. wx.navigateTo({
  421. url: '/pages/servant/nucleic/list'
  422. })
  423. },
  424. goCRM(){
  425. wx.navigateTo({
  426. url: '/pages/servant/crm/ticket'
  427. })
  428. },
  429. goBookDetail(e) {
  430. let id = e.currentTarget.dataset.id;
  431. wx.navigateTo({
  432. url: '/pages/board/detail/detail?no=' + id,
  433. })
  434. },
  435. goPaymentOrderDetail(e){//钟点工订单明细
  436. let id = e.currentTarget.dataset.id;
  437. wx.navigateTo({
  438. url: '/pages/servant/orderDetail/hmOrderDetail?payId=' + id,
  439. })
  440. },
  441. goSalaryDetail(e) { //查询工资明细
  442. const {
  443. year,
  444. month
  445. } = calendar.getCurrentYM();
  446. let m = month;
  447. if (m < 10) m = '0' + String(m);
  448. let type = e.currentTarget.dataset.type;
  449. let total = (type == 1 ? this.data.salary.salary : this.data.salary.total);
  450. //servantType 表示服务者身份99是临时服务者 明细页可以显示提现按钮
  451. wx.navigateTo({
  452. url: '/pages/servant/salary/detail/detail?month=' + (String(year) + m) + '&total=' + total + '&type=' + type+'&servantType='+this.data.board.type+'&blance='+this.data.salary.salary
  453. })
  454. },
  455. afterTapDate(e) { //选中某个日期
  456. console.log('afterTapDate', e.detail.date)
  457. let that = this;
  458. var month = e.detail.month < 10 ? "0" + String(e.detail.month) : String(e.detail.month);
  459. var date = e.detail.date < 10 ? "0" + String(e.detail.date) : String(e.detail.date);
  460. let fullDate = e.detail.year + '-' + month + '-' + date;
  461. that.selectDate(fullDate, e.detail.date);
  462. },
  463. selectDate(fullDate, day) {
  464. console.info("selectDate:" + fullDate)
  465. let that = this;
  466. let week = util.getWeekByDate(fullDate);
  467. that.setData({
  468. selectedDate: fullDate + ' ' + week,
  469. isFirstLoad: false
  470. })
  471. that.setData({
  472. selected: []
  473. })
  474. that.data.list.forEach(item => {
  475. if (parseInt(item.date) == day) {
  476. that.setData({
  477. selected: item.books
  478. })
  479. }
  480. })
  481. // if(that.data.selected.length>0&&that.data.curDate==fullDate){//如果当日有订单 角标提醒(角标)
  482. // wx.setTabBarBadge({
  483. // index: 3,
  484. // text: String(that.data.selected.length)
  485. // })
  486. // }
  487. },
  488. whenChangeMonth(e) {
  489. console.log('whenChangeMonth', e.detail)
  490. const {
  491. year,
  492. month
  493. } = calendar.getCurrentYM();
  494. let m=month;
  495. if (m < 10) m = String(0) + m;
  496. this.getBoard(year + '-' + m + '-01');
  497. this.getSalary(year + '-' + m + '-01');
  498. },
  499. whenChangeWeek(e) {
  500. console.log('whenChangeWeek', e.detail)
  501. },
  502. takeoverTap(e) {
  503. console.log('takeoverTap', e.detail)
  504. },
  505. afterCalendarRender(e) {
  506. console.log('afterCalendarRender', e);
  507. //初始化完成后,将插件变量赋值
  508. calendar = this.selectComponent('#calendar').calendar;
  509. const {
  510. year,
  511. month
  512. } = calendar.getCurrentYM();
  513. if (this.data.isMaster == false) {
  514. let date = (new Date()).getDate();
  515. if (date < 10) date = String(0) + date;
  516. let m=month;
  517. if (m < 10) m = String(0) + m;
  518. this.getBoard(year + '-' + m + '-' + date);
  519. this.getSalary(year + '-' + m + '-' + date);
  520. }
  521. },
  522. onSwipe(e) {
  523. console.log('onSwipe', e)
  524. },
  525. calendarSetEnabledDates(dates) { //设置可选择的日期
  526. //const calendar = this.selectComponent('#calendar').calendar;
  527. //console.info(dates);
  528. //calendar['enableDates'](dates);
  529. },
  530. calenderTodo(date, title) { //设置指定日期
  531. const {
  532. year,
  533. month
  534. } = calendar.getCurrentYM();
  535. const dates = [{
  536. year,
  537. month,
  538. date: date,
  539. todoText: title
  540. }]
  541. calendar['setTodos']({
  542. showLabelAlways: true,
  543. dates
  544. })
  545. //console.log('set todo: ', dates) ;
  546. },
  547. openMap(e) { //打开地图
  548. let that = this;
  549. let bookTradeNo = e.currentTarget.dataset.id;
  550. let bookInfo = null;
  551. that.data.board.details.forEach(item => {
  552. if (item.bookNo == bookTradeNo) {
  553. bookInfo = item;
  554. return;
  555. }
  556. })
  557. console.info(bookInfo)
  558. let address = bookInfo.address;
  559. let lng = bookInfo.position.split(',')[0];
  560. let lat = bookInfo.position.split(',')[1];
  561. wx.openLocation({
  562. latitude: parseFloat(lat),
  563. longitude: parseFloat(lng),
  564. name: address,
  565. address: address,
  566. scale: 28
  567. })
  568. },
  569. /**
  570. * 生命周期函数--监听页面隐藏
  571. */
  572. onHide: function () {
  573. },
  574. userProtocol(){
  575. wx.navigateTo({
  576. url: '/pages/servant/salary/protocol/protocol'
  577. });
  578. },
  579. /**
  580. * 生命周期函数--监听页面卸载
  581. */
  582. onUnload: function () {
  583. },
  584. shareGoods(e) {
  585. let that = this;
  586. wx.showLoading({
  587. title: '生成中',
  588. });
  589. util.request(api.GoodsShare, {
  590. goodsId: e.currentTarget.dataset.id
  591. }).then(function (res) {
  592. console.info(res)
  593. wx.hideLoading();
  594. if (res.errno == 0) {
  595. that.setData({
  596. myqr_url: res.data.imgUrl,
  597. myqr_show: true,
  598. myqr_blur: 5
  599. });
  600. } else if (res.errno == 501) {
  601. // wx.navigateTo({
  602. // url: "/pages/index/index"
  603. // });
  604. } else {
  605. wx.showToast({
  606. title: res.errmsg,
  607. duration: 5000
  608. })
  609. }
  610. });
  611. },
  612. makeCall(e) {
  613. wx.makePhoneCall({
  614. phoneNumber: e.currentTarget.dataset.phone,
  615. })
  616. },
  617. /**
  618. * 页面相关事件处理函数--监听用户下拉动作
  619. */
  620. onPullDownRefresh: function () {
  621. },
  622. /**
  623. * 页面上拉触底事件的处理函数
  624. */
  625. onReachBottom: function () {
  626. // if (this.data.totalPages > this.data.page) {
  627. // this.setData({
  628. // page: this.data.page + 1
  629. // });
  630. // this.getGoodsList();
  631. // } else {
  632. // wx.showToast({
  633. // title: '没有更多商品了',
  634. // icon: 'none',
  635. // duration: 2000
  636. // });
  637. // return false;
  638. // }
  639. },
  640. goShowMoneyTip() {
  641. wx.showModal({
  642. title: '服务费说明',
  643. content: '因影响服务费的因素较多,如有疑问请及时反馈到站长,实际服务费以次月发放为准',
  644. showCancel: false
  645. })
  646. },
  647. /**
  648. * 用户点击右上角分享
  649. */
  650. onShareAppMessage: function () {
  651. },
  652. saveShare: function () {
  653. let that = this;
  654. wx.showLoading({
  655. title: '图片保存中',
  656. });
  657. console.log(that.data);
  658. wx.downloadFile({
  659. url: that.data.myqr_url,
  660. success: function (res) {
  661. console.log(res)
  662. wx.saveImageToPhotosAlbum({
  663. filePath: res.tempFilePath,
  664. success: function (res) {
  665. wx.hideLoading();
  666. wx.showModal({
  667. title: '存图成功',
  668. content: '图片成功保存到相册了,可以分享到朋友圈了',
  669. showCancel: false,
  670. confirmText: '好的',
  671. confirmColor: '#a78845',
  672. success: function (res) {
  673. if (res.confirm) {
  674. console.log('用户点击确定');
  675. that.setData({
  676. myqr_show: false,
  677. myqr_blur: 0
  678. });
  679. }
  680. }
  681. })
  682. },
  683. fail: function (res) {
  684. wx.hideLoading();
  685. wx.showModal({
  686. title: '警告',
  687. content: '未授权无法保存',
  688. showCancel: false
  689. })
  690. that.setData({
  691. myqr_show: false,
  692. myqr_blur: 0
  693. });
  694. }
  695. })
  696. },
  697. fail: function (res) {
  698. wx.hideLoading();
  699. console.log(res);
  700. }
  701. })
  702. },
  703. goProview() {
  704. wx.switchTab({
  705. url: '/pages/pre/list/preList',
  706. })
  707. },
  708. goBookIndex(e) {
  709. if (this.data.hasLogin) {
  710. let tab = e.currentTarget.dataset.index
  711. let route = e.currentTarget.dataset.route
  712. try {
  713. wx.setStorageSync('tab', tab);
  714. } catch (e) {
  715. }
  716. wx.navigateTo({
  717. url: route,
  718. success: function (res) {},
  719. fail: function (res) {},
  720. complete: function (res) {},
  721. })
  722. } else {
  723. wx.navigateTo({
  724. url: "/pages/index/index"
  725. });
  726. };
  727. },
  728. goLeave(){//请假
  729. // wx.navigateTo({
  730. // url: '/pages/servant/leave/leave',
  731. // })
  732. wx.showModal({
  733. title: '提醒',
  734. content: '暂未开通,敬请期待',
  735. showCancel: false
  736. })
  737. },
  738. exitLogin: function () {
  739. wx.showModal({
  740. title: '',
  741. confirmColor: '#b4282d',
  742. content: '退出登录?',
  743. success: function (res) {
  744. if (!res.confirm) {
  745. return;
  746. }
  747. util.request(api.AuthLogout, {}, 'POST');
  748. app.globalData.hasLogin = false;
  749. wx.removeStorageSync('token');
  750. wx.removeStorageSync('userInfo');
  751. wx.navigateTo({
  752. url: '/pages/index/index'
  753. });
  754. }
  755. })
  756. }
  757. })