mine.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  1. /*******************************************************************************
  2. * Copyright(c) 2022 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:
  5. * 2.功能描述:我的设置
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 姜永辉 2024-2-12 1.00
  9. *******************************************************************************/
  10. const api = require('@/utils/api.js');
  11. const config = require('@/config/config.js');
  12. const common = require('@/utils/common.js')
  13. const Constants = require('@/utils/Constants.js');
  14. const util = require('@/utils/util.js')
  15. const mixins = require('@/mixins/index.js')
  16. import Dialog from '@/dist/dialog/dialog.js';
  17. const app = getApp()
  18. Page({
  19. mixins: [mixins],
  20. /**
  21. * 页面的初始数据
  22. */
  23. data: {
  24. imageUrl: config.image_url + '/static/img/',
  25. dueFlag: false, // 到期标识
  26. dueButtonFlag: false, // 到期标识
  27. videoSrc: 'https://s.dev01.dkiboss.com:7000/file/operate_guide/all.mp4',
  28. cpEndDate: null,
  29. playFlag: false,
  30. companyName: null,
  31. staffName: 'null',
  32. orgName: null,
  33. waitMenuFlag: true, // 是否显示待办工作区
  34. statusHeight: 0, // 状态栏高度
  35. // 路由
  36. routeObjName: 'setting',
  37. companyService: app.globalData['companyService'],
  38. oauthService: app.globalData['oauthService'],
  39. appCount: 0,
  40. noticeCount: 0,
  41. beginnerGuideUrl: '/package-basic-data/pages/beginner-guide/beginner-guide',//新手引导
  42. /** 6个切换组件的值 */
  43. storeHelperValue: 'nearly7days',
  44. /** 6个数据源 */
  45. shopHelper: {},
  46. staffHelper: {},
  47. /** 3个加载loading(实际页面上是6个 因为左右切换无法同时显示两个所以3个就够了) */
  48. filterBlur1: '0',
  49. /** 2种切换组件的options */
  50. tagList: [
  51. { name: '今日', id: 'today', value: [util.formatDataTime(new Date()).substring(0, 10), util.formatDataTime(new Date()).substring(0, 10)] },
  52. { name: '近7天', id: 'nearly7days', value: util.timeForMat(7) },
  53. { name: '近30天', id: 'nearly30days', value: util.timeForMat(30) }],
  54. active: 'store',
  55. showStoreFlag: true,
  56. menuBtnInfo: null,
  57. // 待办工作
  58. waitMenu: [
  59. {
  60. title: '待收款',
  61. code: 'cus-receipt',
  62. path: '/package-sales/pages/customer-collection/customer-collection',
  63. icon: 'btn-account-receivable.png',
  64. },
  65. {
  66. title: '待发货',
  67. code: 'order',
  68. path: '/package-sales/pages/order-billing/order-billing',
  69. icon: 'btn-shipped.png',
  70. },
  71. {
  72. title: '待入库',
  73. code: 'entry-handle',
  74. path: '/package-inventory/pages/warehousing-processing/warehousing-processing',
  75. icon: 'btn-stored.png',
  76. },
  77. {
  78. title: '待出库',
  79. code: 'out-handle',
  80. path: '/package-inventory/pages/outbound-processing/outbound-processing',
  81. icon: 'btn-shipped-out.png',
  82. },
  83. ],
  84. },
  85. /**
  86. * @desc : 改变选择框内容
  87. * @author : 周兴
  88. * @date : 2024/1/26 11:46
  89. */
  90. changeTabs(e) {
  91. let values = e.detail.value
  92. this.setData({
  93. storeHelperValue: e.detail.id
  94. })
  95. this.getHomeOrderRecCost(values[0], values[1])
  96. },
  97. /**
  98. * @desc : 切换公司
  99. * @author : 周兴
  100. * @date : 2024/4/1
  101. */
  102. changeCp() {
  103. wx.navigateTo({
  104. url: '/pages/company/company',
  105. })
  106. },
  107. /**
  108. * @desc : 跳转到功能页面
  109. * @author : 于继渤
  110. * @date : 2024/1/23 9:16
  111. */
  112. toApp(e) {
  113. let item = e.currentTarget.dataset.item
  114. let hasRightFlag = false;
  115. let menuUuid = null
  116. let menuList = app.globalData.menus
  117. if (menuList && menuList.length > 0) {
  118. // 查看该功能是否有权限
  119. let filters = menuList.filter(it => it.objectCode == item.code);
  120. if (filters && filters.length > 0) {
  121. menuUuid = filters[0].menuUuid
  122. hasRightFlag = true;
  123. }
  124. }
  125. if (!hasRightFlag) {
  126. util.showToast('没有该功能权限');
  127. return;
  128. }
  129. // 打开页面
  130. if (item.path) {
  131. wx.navigateTo({
  132. url: item.path,
  133. success: function (res) {
  134. res.eventChannel.emit('params', { formMode: 'index', menuUuid: menuUuid })
  135. }
  136. })
  137. }
  138. },
  139. /**
  140. * @desc : 查询销售金额收款金额库存成本
  141. * @author : 姜永辉
  142. * @date : 2024/4/9
  143. */
  144. getHomeOrderRecCost(dateBegin, dateEnd) {
  145. let params = {
  146. dateBegin: dateBegin,
  147. dateEnd: dateEnd,
  148. staffId: app.globalData.user.staffId,
  149. }
  150. let service = app.globalData['commonService']
  151. api.request(service.prefix + service.getHomeOrderRecCost, 'POST', params).then(res => {
  152. if (res.data.code == Constants.SUCESS_CODE) {
  153. let data = res.data.data
  154. let valueAmounts = []
  155. valueAmounts.push({
  156. title: '销售金额(元)',
  157. flgAmount: true,
  158. value: data.amtShouldSumAmount ? data.amtShouldSumAmount : 0.00
  159. })
  160. valueAmounts.push({
  161. title: '收款金额(元)',
  162. flgAmount: true,
  163. value: data.amtRecSumAmount ? data.amtRecSumAmount : 0.00
  164. })
  165. valueAmounts.push({
  166. title: '订单数(单)',
  167. flgAmount: false,
  168. value: data.orderQuantity ? data.orderQuantity : 0
  169. })
  170. this.setData({
  171. valueAmounts,
  172. })
  173. }
  174. });
  175. },
  176. /**
  177. * @desc : 跳转到微信聊天界面
  178. * @author : 周兴
  179. * @date : 2024/4/9
  180. */
  181. handleWxService(e) {
  182. // let url= Constants.WX_SERVICE
  183. // wx.navigateTo({
  184. // url: '/pages/product/product',
  185. // success: function (res) {
  186. // res.eventChannel.emit('url', Constants.WX_SERVICE);
  187. // }
  188. // })
  189. wx.openCustomerServiceChat({
  190. extInfo: { url: Constants.WX_SERVICE },
  191. corpId: Constants.WX_CPID,
  192. success(res) {
  193. }
  194. })
  195. },
  196. /**
  197. * @desc : 跳转到续费页面
  198. * @author : 周兴
  199. * @date : 2024/4/9
  200. */
  201. handleRecharge(e) {
  202. let url = '/package-basic-data/pages/activity/activity'
  203. wx.navigateTo({
  204. url: url,
  205. events: {
  206. // 保存成功后刷新页面
  207. refresh: function (data) {
  208. // 刷新一览界面
  209. wx.reLaunch({
  210. url: '/pages/welcome/welcome',
  211. })
  212. }
  213. },
  214. })
  215. },
  216. /**
  217. * @desc : 跳转至增加授权
  218. * @author : 刘尧
  219. * @date : 2024/7/4
  220. */
  221. toAddRole() {
  222. const item = {detail:{
  223. customUrl: undefined,
  224. name: "buy"}}
  225. this.open(item)
  226. },
  227. /**
  228. * @desc : 升级
  229. * @author : 周兴
  230. * @date : 2024/4/9
  231. */
  232. handleUpgrade(e) {
  233. let url = '/package-basic-data/pages/activity/activity?upgrade=true'
  234. wx.navigateTo({
  235. url: url,
  236. events: {
  237. // 保存成功后刷新页面
  238. refresh: function (data) {
  239. // 刷新一览界面
  240. wx.reLaunch({
  241. url: '/pages/welcome/welcome',
  242. })
  243. }
  244. },
  245. })
  246. },
  247. /**
  248. * @desc : 查询待发货数据
  249. * @author : 周兴
  250. * @date : 2024/4/9
  251. */
  252. getOrder() {
  253. let params = {
  254. appCode: Constants.APP_CODE,
  255. orderStatusList: ['出库状态-待出库', '出库状态-出库中']
  256. }
  257. let service = app.globalData['orderService']
  258. api.request(service.prefix + service.countOrderByCond, 'POST', params).then(res => {
  259. if (res.data.code == Constants.SUCESS_CODE) {
  260. let waitMenu = this.data.waitMenu;
  261. let filters = waitMenu.filter(it => it.code == 'order')
  262. if (filters && filters.length > 0) {
  263. filters[0].count = res.data.data;
  264. this.setData({
  265. waitMenu: waitMenu
  266. })
  267. }
  268. }
  269. });
  270. },
  271. /**
  272. * @desc : 查询待收款数据
  273. * @author : 周兴
  274. * @date : 2024/4/9
  275. */
  276. getWaitReceival() {
  277. let params = {
  278. appCode: Constants.APP_CODE,
  279. amtResidueZeroFlg: true,
  280. accItemType: '账款类型-应收'
  281. }
  282. let service = app.globalData['accountService']
  283. api.request(service.prefix + service.getReceivableAccountItemCount, 'POST', params).then(res => {
  284. if (res.data.code == Constants.SUCESS_CODE) {
  285. let waitMenu = this.data.waitMenu;
  286. let filters = waitMenu.filter(it => it.code == 'cus-receipt')
  287. if (filters && filters.length > 0) {
  288. filters[0].count = res.data.data;
  289. this.setData({
  290. waitMenu: waitMenu
  291. })
  292. }
  293. }
  294. });
  295. },
  296. /**
  297. * @desc : 查询待入库数据
  298. * @author : 周兴
  299. * @date : 2024/4/9
  300. */
  301. getWaitInbound() {
  302. let params = {
  303. appCode: Constants.APP_CODE,
  304. }
  305. let service = app.globalData['inboundOtherService']
  306. api.request(service.prefix + service.selectWaitInboundCount, 'POST', params).then(res => {
  307. if (res.data.code == Constants.SUCESS_CODE) {
  308. let waitMenu = this.data.waitMenu;
  309. let filters = waitMenu.filter(it => it.code == 'entry-handle')
  310. if (filters && filters.length > 0) {
  311. filters[0].count = res.data.data;
  312. this.setData({
  313. waitMenu: waitMenu
  314. })
  315. }
  316. }
  317. });
  318. },
  319. /**
  320. * @desc : 查询待出库数据
  321. * @author : 周兴
  322. * @date : 2024/4/9
  323. */
  324. getWaitOutbound() {
  325. let params = {
  326. appCode: Constants.APP_CODE,
  327. }
  328. let service = app.globalData['outboundOtherService']
  329. api.request(service.prefix + service.selectWaitOutboundCount, 'POST', params).then(res => {
  330. if (res.data.code == Constants.SUCESS_CODE) {
  331. let waitMenu = this.data.waitMenu;
  332. let filters = waitMenu.filter(it => it.code == 'out-handle')
  333. if (filters && filters.length > 0) {
  334. filters[0].count = res.data.data;
  335. this.setData({
  336. waitMenu: waitMenu
  337. })
  338. }
  339. }
  340. });
  341. },
  342. /**
  343. * @desc : 修改密码跳转
  344. * @date : 2022/5/12 13:49
  345. * @author : 姜永辉
  346. */
  347. toEditPassword() {
  348. wx.navigateTo({
  349. url: './setting/setting',
  350. })
  351. },
  352. /**
  353. * @desc : 公告跳转
  354. * @date : 2022/5/12 13:49
  355. * @author : 姜永辉
  356. */
  357. toNotice() {
  358. wx.navigateTo({
  359. url: '/package-basic-data/pages/notice/notice',
  360. })
  361. },
  362. /**
  363. * @desc : 打开操作手册
  364. * @date : 2024/5/13 13:49
  365. * @author : 周兴
  366. */
  367. toOperateGuide(e) {
  368. let file = 'all.pdf'
  369. // 下载操作手册pdf
  370. let url = config.image_url + '/operate_guide/' + file;
  371. this.downloadFile(url, type);
  372. },
  373. /**
  374. * @desc : 打开操作手册视频
  375. * @date : 2024/5/13 13:49
  376. * @author : 周兴
  377. */
  378. toOperateGuideVideo(e) {
  379. let type = e.currentTarget.dataset.type
  380. if (type == 'close') {
  381. this.setData({
  382. playFlag: false
  383. })
  384. } else {
  385. this.setData({
  386. playFlag: true
  387. })
  388. }
  389. },
  390. /**
  391. * @desc : 设置跳转
  392. * @date : 2022/5/12 13:49
  393. * @author : 姜永辉
  394. */
  395. toSetting() {
  396. this.setData({
  397. loading: true
  398. })
  399. let _this = this
  400. wx.navigateTo({
  401. url: this.data.route.companySetting.url,
  402. events: {
  403. // 回调后,在这里给页面赋值
  404. refresh: function (e) {
  405. wx.reLaunch({
  406. url: '/pages/welcome/welcome',
  407. })
  408. }
  409. },
  410. success: function (res) {
  411. // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
  412. res.eventChannel.emit('params', { id: app.globalData.company.cpId, formMode: Constants.formMode.edit })
  413. setTimeout(() => {
  414. _this.setData({
  415. loading: false
  416. })
  417. }, 2000)
  418. }
  419. })
  420. },
  421. /**
  422. * @desc : 新手引导
  423. * @date : 2022/5/12 13:49
  424. * @author : 于继渤
  425. */
  426. toBeginnerGuide() {
  427. this.setData({
  428. loading: true
  429. })
  430. let _this = this
  431. wx.navigateTo({
  432. url: this.data.beginnerGuideUrl,
  433. events: {
  434. // 回调后,在这里给页面赋值
  435. bandData: function (e) {
  436. }
  437. },
  438. success: function (res) {
  439. // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
  440. res.eventChannel.emit('params', {})
  441. setTimeout(() => {
  442. _this.setData({
  443. loading: false
  444. })
  445. }, 1000)
  446. }
  447. })
  448. },
  449. /**
  450. * @desc : 退出登录
  451. * @date : 2022/5/12 13:49
  452. * @author : 姜永辉
  453. */
  454. logout(e) {
  455. let _this = this
  456. //提示
  457. Dialog.confirm({
  458. message: '您确定要退出系统?',
  459. }).then(() => {
  460. let params = {
  461. openid: app.globalData.openid,
  462. userId: app.globalData.user.userId,
  463. }
  464. return this.excute(_this.data.oauthService, _this.data.oauthService.logout, params).then(res => {
  465. if (res.data.code === Constants.SUCESS_CODE) {
  466. // 调转主页
  467. wx.reLaunch({
  468. url: '../../pages/welcome/welcome',
  469. })
  470. }
  471. });
  472. }).catch(() => {
  473. });
  474. },
  475. /**
  476. * @desc : 获取用户信息
  477. * @date : 2022/5/12 13:49
  478. * @author : 姜永辉
  479. */
  480. getUserProfile() {
  481. wx.getUserProfile({
  482. desc: '用于完善用户资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  483. success: (res) => {
  484. let user = res.userInfo
  485. wx.setStorageSync('user', user) //保存用户信息到本地缓存
  486. this.setData({
  487. isShowUserName: true,
  488. userInfo: user,
  489. })
  490. },
  491. fail: res => {
  492. }
  493. })
  494. },
  495. /**
  496. * @desc : 小程序测试例子
  497. * @author : admin
  498. * @date : 2023年8月21日
  499. */
  500. toTestExample(e) {
  501. wx.navigateTo({
  502. url: '/package-basic-data/pages/test/test',
  503. })
  504. },
  505. toOtherPage(e) {
  506. let type = e.currentTarget.dataset.type
  507. let dateValue = e.currentTarget.dataset.datevalue
  508. let jumpType = e.currentTarget.dataset.jumptype
  509. let url = "";
  510. let param = {};
  511. let dateObj = {
  512. today: { text: '本日', value: 1 },
  513. nearly30days: { text: '近30天', value: 5 },
  514. nearly7days: { text: '近7天', value: 6 }
  515. }
  516. let staffObj = {}
  517. if (jumpType === 2) {
  518. staffObj = {
  519. staffId: app.globalData.user.userId,
  520. staffNames: app.globalData.user.userName
  521. }
  522. }
  523. let hasrightflg = true
  524. switch (type) {
  525. case 1:
  526. hasrightflg = this.data.orderflg
  527. url = '/package4/pages/order-billing/order-billing'
  528. param = { active: 1, date: dateObj[dateValue], receiveStatusParam: [], receiveStatusParamIds: [] }
  529. break;
  530. case 2:
  531. hasrightflg = this.data.customerflg
  532. url = '/package3/pages/customer/customer'
  533. param = { active: 0, date: dateObj[dateValue], keyTypeList: [], keyTypeNameList: [] }
  534. break;
  535. case 3:
  536. hasrightflg = this.data.customerflg
  537. url = '/package3/pages/customer/customer'
  538. param = { active: 3, date: dateObj[dateValue], keyTypeList: [0, 1], keyTypeNameList: ["客意品类-定制", "客意品类-智能"] }
  539. break;
  540. case 4:
  541. hasrightflg = this.data.orderflg
  542. url = '/package4/pages/order-billing/order-billing'
  543. param = { active: 2, date: { text: '自定义', value: -2 }, receiveStatusParam: ['收款状态-未收', '收款状态-部分'], receiveStatusParamIds: [0, 1], type: 2 }
  544. break;
  545. case 5:
  546. hasrightflg = this.data.receivecustomersflg
  547. url = '/package3/pages/receive-customers/receive-customers'
  548. param = { active: 1, date: { text: '自定义', value: -2 }, followStatusNameList: [], followStatusList: [], type: 2 }
  549. break;
  550. case 6:
  551. hasrightflg = this.data.orderflg
  552. url = '/package4/pages/order-billing/order-billing'
  553. param = { active: 3, date: dateObj[dateValue], receiveStatusParam: [], receiveStatusParamIds: [] }
  554. break;
  555. case 7:
  556. hasrightflg = this.data.receivecustomersflg
  557. url = '/package3/pages/receive-customers/receive-customers'
  558. param = { active: 0, date: dateObj[dateValue], followStatusNameList: ['跟进状态-接待', '跟进状态-报备'], followStatusList: [0, 1] }
  559. break;
  560. case 8:
  561. hasrightflg = this.data.receivecustomersflg
  562. url = '/package3/pages/receive-customers/receive-customers'
  563. param = { active: 0, date: dateObj[dateValue], followStatusNameList: ['跟进状态-报备'], followStatusList: [0] }
  564. break;
  565. case 9:
  566. hasrightflg = this.data.receivecustomersflg
  567. url = '/package3/pages/receive-customers/receive-customers'
  568. param = { active: 0, date: dateObj[dateValue], followStatusNameList: ['跟进状态-接待'], followStatusList: [1] }
  569. break;
  570. case 10:
  571. hasrightflg = this.data.customerflg
  572. url = '/package3/pages/customer/customer'
  573. param = { active: 1, date: dateObj.nearly30days }
  574. break;
  575. }
  576. if (hasrightflg) {
  577. wx.navigateTo({
  578. url: url + '?frommine=' + JSON.stringify(Object.assign(param, staffObj))
  579. })
  580. } else {
  581. wx.showModal({ title: '提示', content: '没有该功能权限', showCancel: false })
  582. }
  583. },
  584. /**
  585. *
  586. * @param {获取待审条数} options
  587. */
  588. getAppCount() {
  589. let params = {
  590. // cpId: app.globalData.user.cpId,
  591. userId: app.globalData.user.userId,
  592. }
  593. api.request(Constants.BPM_WAITING_FOR_APPRAVAL + 'list_count', 'POST', params).then(res => {
  594. if (res.data.code === 200) {
  595. this.setData({
  596. appCount: res.data.data
  597. })
  598. }
  599. })
  600. },
  601. /**
  602. *
  603. * @param {获取未读公告条数} options
  604. * @param {获取未读公告条数} options
  605. * @param {获取未读公告条数} options
  606. */
  607. getNoticeCount() {
  608. let param = {
  609. cpId: app.globalData.user.cpId,
  610. orgId: app.globalData.user.orgId,
  611. userId: app.globalData.user.userId,
  612. }
  613. //操作后台
  614. api.request(Constants.NOTICE_API + 'search_select_count', 'POST', param).then(res => {
  615. if (res.data.code == 200) {
  616. this.setData({
  617. noticeCount: res.data.data
  618. })
  619. }
  620. })
  621. },
  622. /**
  623. * 生命周期函数--监听页面加载
  624. */
  625. onLoad: function (options) {
  626. let res = wx.getSystemInfoSync();
  627. let statusHeight = res.statusBarHeight
  628. this.setData({
  629. statusHeight: statusHeight * 2 + 20
  630. })
  631. if (app.globalData && app.globalData.company) {
  632. let cpEndDate = app.globalData.company.endDate
  633. this.setData({
  634. cpEndDate: cpEndDate, // 企业到期日期
  635. contains2099: cpEndDate.includes("2099") //如果包含2099 就隐藏到期日期
  636. })
  637. // 判断是否即将到期
  638. let endD = new Date(cpEndDate);
  639. // 服务器的日期为准
  640. let nowD = new Date(app.globalData.nowDate).addDays(Constants.CP_ALERT_TIME);
  641. if (endD < nowD) {
  642. this.setData({
  643. dueFlag: true,
  644. dueButtonFlag: true
  645. })
  646. }
  647. }
  648. // // 判断当前用户是否到期 标准版
  649. if (app.globalData.company.gradeCode == Constants.gradeCode.STD
  650. && app.globalData.company.userEndDate) {
  651. let endD = new Date(app.globalData.company.userEndDate);
  652. // 服务器的日期为准
  653. let nowD = new Date(app.globalData.nowDate).addDays(Constants.CP_ALERT_TIME);
  654. if (endD < nowD) {
  655. let cpEndDate = app.globalData.company.userEndDate
  656. this.setData({
  657. cpEndDate: cpEndDate, // 企业到期日期
  658. contains2099: cpEndDate.includes("2099") //如果包含2099 就隐藏到期日期
  659. })
  660. if (!app.globalData.user.flgInit) {
  661. this.setData({
  662. dueFlag: true
  663. })
  664. } else {
  665. this.setData({
  666. dueButtonFlag: true
  667. })
  668. }
  669. }
  670. }
  671. let waitMenu = this.data.waitMenu;
  672. let waitMenuFlag = false;
  673. waitMenu.forEach(it => {
  674. let rightFlag = common.hasPageRight(it.code)
  675. if (rightFlag) {
  676. it.show = true;
  677. waitMenuFlag = true;
  678. // 待收款
  679. if (it.code == Constants.menuCode.cusReceipt) {
  680. // 获取条数
  681. this.getWaitReceival();
  682. } else if (it.code == Constants.menuCode.order) {
  683. // 获取条数
  684. this.getOrder();
  685. } else if (it.code == Constants.menuCode.entryHandle) {
  686. // 获取条数
  687. this.getWaitInbound();
  688. } else if (it.code == Constants.menuCode.outHandle) {
  689. // 获取条数
  690. this.getWaitOutbound();
  691. }
  692. }
  693. })
  694. // 标准版不显示待办
  695. if (this.data.gradeCode == Constants.gradeCode.STD) {
  696. waitMenuFlag = false
  697. }
  698. this.setData({
  699. waitMenuFlag: waitMenuFlag,
  700. companyName: app.globalData.company.cpName,
  701. staffName: app.globalData.user.staffName,
  702. orgName: app.globalData.user.orgName,
  703. waitMenu: waitMenu,
  704. dateBegin: '',
  705. dateEnd: '',
  706. version: wx.getAccountInfoSync().miniProgram.version,
  707. })
  708. /**
  709. * @desc : 获取用户信息
  710. * @date : 2022/5/12 13:49
  711. * @author : 姜永辉
  712. */
  713. if (app.globalData.user) {
  714. this.setData({
  715. userInfo: app.globalData.user,
  716. })
  717. }
  718. // this.getAppCount()
  719. /** 获取胶囊信息 */
  720. this.setData({
  721. menuBtnInfo: wx.getMenuButtonBoundingClientRect()
  722. })
  723. },
  724. onShow() {
  725. if (this.data.mineFlag) {
  726. // this.getAppCount()
  727. /** 获取胶囊信息 */
  728. this.setData({
  729. menuBtnInfo: wx.getMenuButtonBoundingClientRect()
  730. })
  731. }
  732. // 查询门店助手
  733. let dates = util.timeForMat(7)
  734. switch(this.data.storeHelperValue){
  735. case 'today': dates = util.timeForMat(0); break
  736. case 'nearly7days': dates = util.timeForMat(7); break
  737. case 'nearly30days': dates = util.timeForMat(30); break
  738. }
  739. this.getHomeOrderRecCost(dates[0], dates[1])
  740. },
  741. /**
  742. * 页面相关事件处理函数--监听用户下拉动作
  743. */
  744. onPullDownRefresh: function () {
  745. let that = this
  746. //调用刷新时将执行的方法
  747. that.setData({
  748. loadingShow: true,
  749. })
  750. // this.getAppCount()
  751. /** 获取胶囊信息 */
  752. this.setData({
  753. menuBtnInfo: wx.getMenuButtonBoundingClientRect()
  754. })
  755. // this.getReportData()
  756. // this.getNoticeCount()
  757. //隐藏导航条加载动画
  758. wx.hideNavigationBarLoading();
  759. setTimeout(function () {
  760. that.setData({
  761. loadingShow: false,
  762. })
  763. //停止下拉刷新
  764. wx.stopPullDownRefresh();
  765. }, 800)
  766. },
  767. /**
  768. * 检测是否有新版本-手动更新
  769. */
  770. checkHasManualUpdate() {
  771. app.checkHasManualUpdate()
  772. },
  773. /**
  774. *  当前版本号
  775. */
  776. getAccountInfoSync() {
  777. const accountInfo = wx.getAccountInfoSync();
  778. util.showToast('当前版本号:' + accountInfo.miniProgram.version);
  779. },
  780. })