activity.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. /*******************************************************************************
  2. * Copyright(c) 2022 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:活动(用于续费、注册)
  5. * 编辑履历:
  6. * 作者 日期 版本 修改内容
  7. * 周兴 2024-5-15 1.00 新建
  8. *******************************************************************************/
  9. const Constants = require('@/utils/Constants.js');
  10. const util = require('@/utils/util.js')
  11. const mixins = require('@/mixins/index.js');
  12. const config = require('@/config/config.js');
  13. const app = getApp()
  14. Page({
  15. mixins: [mixins],
  16. /**
  17. * 页面的初始数据
  18. */
  19. data: {
  20. imageUrl: config.image_url + '/static/img/',
  21. // 是否加载完毕
  22. loadFlag: false,
  23. // 是否显示vip
  24. showVip: false,
  25. // 升级标识
  26. upgradeFlag: false,
  27. gradeCode: null,
  28. freeFlag: false,
  29. // 企业名称
  30. companyName: null,
  31. cpManager: null,
  32. cpPhone: null,
  33. webMaxNum: null,
  34. wxMaxNum: null,
  35. cpEndDate: null,
  36. activityTable: null,
  37. vipTable: null,
  38. readFlag: false,
  39. staffCount: {
  40. maxNum: 1,
  41. webMaxNum: 0,
  42. wxMaxNum: 0
  43. },
  44. curentAdItem: null,
  45. // 选择的vip报表
  46. chooseVipFlag: false,
  47. summaryInfo: {},
  48. routeObjName: 'company',
  49. pageFlag: false,
  50. // 当前用户授权数
  51. currentUserCount: null,
  52. //按钮
  53. buttonSaveList: [
  54. { code: 'save', title: mixins.$t('save'), width: '120rpx' }
  55. ],
  56. noticeInfo: Constants.noticeInfo,
  57. funcMenu: [
  58. {
  59. title: '订单开单',
  60. icon: 'btn-account-receivable.png',
  61. },
  62. {
  63. title: '销售出库',
  64. icon: 'btn-shipped.png',
  65. },
  66. {
  67. title: '销售退货',
  68. icon: 'btn-stored.png',
  69. },
  70. {
  71. title: '销售跟踪',
  72. icon: 'btn-shipped-out.png',
  73. },
  74. {
  75. title: '采购订单',
  76. icon: 'btn-account-receivable.png',
  77. },
  78. {
  79. title: '采购入库',
  80. icon: 'btn-shipped.png',
  81. },
  82. {
  83. title: '采购退货',
  84. icon: 'btn-stored.png',
  85. },
  86. {
  87. title: '以销定采',
  88. icon: 'btn-shipped-out.png',
  89. },
  90. ],
  91. funcMenuFlg: false,
  92. },
  93. /**
  94. * @desc : 选择活动明细
  95. * @author : 周兴
  96. * @date : 2024/4/1
  97. */
  98. chooseAdItem(e) {
  99. let item = e.currentTarget.dataset.item;
  100. let summaryInfo = this.data.summaryInfo
  101. // 计算截止日期
  102. let months = item.validLong + item.extraLong
  103. let endDate = app.globalData.company.endDate
  104. // 升级需要从当天开始算
  105. if (this.data.upgradeFlag) {
  106. endDate = new Date()
  107. }
  108. endDate = new Date(endDate).addMonths(months).addDays(-1)
  109. summaryInfo.endDate = endDate.toDateStr();
  110. this.setData({
  111. curentAdItem: item,
  112. summaryInfo: summaryInfo
  113. })
  114. // 计算金额
  115. this.countSummaryAmount(item);
  116. },
  117. /**
  118. * @desc : 选择VIP报表明细
  119. * @author : 周兴
  120. * @date : 2024/4/1
  121. */
  122. chooseVipItem(e) {
  123. let item = e.currentTarget.dataset.item;
  124. // let summaryInfo = this.data.summaryInfo
  125. // // 计算截止日期
  126. // let months = item.validLong + item.extraLong
  127. // let endDate = app.globalData.company.endDate
  128. // // 升级需要从当天开始算
  129. // if (this.data.upgradeFlag) {
  130. // endDate = new Date()
  131. // }
  132. // endDate = new Date(endDate).addMonths(months).addDays(-1)
  133. // summaryInfo.endDate = endDate.toDateStr();
  134. this.setData({
  135. chooseVipFlag: !this.data.chooseVipFlag,
  136. // summaryInfo: summaryInfo
  137. })
  138. // 计算金额
  139. this.countSummaryAmountSTD();
  140. },
  141. /**
  142. * @desc : 勾选已阅读表示
  143. * @author : 周兴
  144. * @date : 2024/5/17
  145. */
  146. handleChangeCheckbox(e) {
  147. this.setData({
  148. readFlag: e.detail
  149. })
  150. },
  151. /**
  152. * @desc : 计算金额
  153. * @author : 周兴
  154. * @date : 2024/4/1
  155. */
  156. countSummaryAmount() {
  157. let item = this.data.curentAdItem;
  158. if (!item) return;
  159. let staffCount = this.data.staffCount;
  160. let summaryInfo = this.data.summaryInfo
  161. let amount = 0;
  162. // 先清空
  163. summaryInfo.amountInfo = '';
  164. // 共通用户
  165. if (staffCount.maxNum) {
  166. summaryInfo.amountInfo = item.stdPrice + '(打包价格)*' + staffCount.maxNum
  167. amount += item.stdPrice * staffCount.maxNum
  168. }
  169. // 手机端用户
  170. if (staffCount.wxMaxNum) {
  171. if (summaryInfo.amountInfo) {
  172. summaryInfo.amountInfo += ' + '
  173. }
  174. summaryInfo.amountInfo += item.wxPrice + '(手机端价格)*' + staffCount.wxMaxNum
  175. amount += item.wxPrice * staffCount.wxMaxNum
  176. }
  177. // 电脑端用户
  178. if (staffCount.webMaxNum) {
  179. if (summaryInfo.amountInfo) {
  180. summaryInfo.amountInfo += ' + '
  181. }
  182. summaryInfo.amountInfo += item.webPrice + '(电脑端价格)*' + staffCount.webMaxNum
  183. amount += item.webPrice * staffCount.webMaxNum
  184. }
  185. if (summaryInfo.amountInfo) {
  186. summaryInfo.amountInfo += ' = ' + amount + '(元)'
  187. summaryInfo.amount = amount;
  188. }
  189. this.setData({
  190. summaryInfo: summaryInfo
  191. })
  192. // 统计两端用户数
  193. this.countStaffInfo();
  194. },
  195. /**
  196. * @desc : 获取标准版的价格显示
  197. * @author : 周兴
  198. * @date : 2024/4/1
  199. */
  200. countSummaryAmountSTD() {
  201. let item = this.data.curentAdItem;
  202. let vipTable = this.data.vipTable
  203. let summaryInfo = this.data.summaryInfo
  204. let amount = 0;
  205. // 先清空
  206. summaryInfo.amountInfo = '';
  207. let extendDays = null;
  208. let nowDate = new Date(new Date().toDateStr());
  209. if (summaryInfo.reCountFlag) {
  210. // 手机端用户
  211. if (summaryInfo.wxMaxNum) {
  212. summaryInfo.amountInfo += item.wxPrice + '(元) * ' + summaryInfo.wxMaxNum + '(个) '
  213. amount += item.wxPrice * summaryInfo.wxMaxNum
  214. }
  215. // vip报表
  216. if (this.data.chooseVipFlag && vipTable && vipTable.length > 0) {
  217. let vipItem = vipTable[0]
  218. summaryInfo.amountInfo += ' + ' + vipItem.wxPrice + '(元/VIP) ';
  219. amount += vipItem.wxPrice;
  220. }
  221. if (summaryInfo.amountInfo) {
  222. summaryInfo.amountInfo += ' = ' + amount + '(元)'
  223. summaryInfo.amount = amount;
  224. }
  225. extendDays = new Date(summaryInfo.userEndDate).dayDiff(nowDate) + 1;
  226. } else {
  227. extendDays = new Date(summaryInfo.userEndDate).dayDiff(nowDate) + 1;
  228. if (summaryInfo.wxMaxNum) {
  229. summaryInfo.amountInfo += item.wxPrice + '(元) '
  230. amount += item.wxPrice * summaryInfo.wxMaxNum
  231. }
  232. // vip报表
  233. if (this.data.chooseVipFlag && vipTable && vipTable.length > 0) {
  234. let vipItem = vipTable[0]
  235. summaryInfo.amountInfo += ' + ' + vipItem.wxPrice + '(元/VIP) ';
  236. summaryInfo.amountInfo = '( ' + summaryInfo.amountInfo + ' ) ';
  237. amount += vipItem.wxPrice;
  238. }
  239. summaryInfo.amountInfo += ' / 365(天) * ' + extendDays + '(天) * ' + summaryInfo.wxMaxNum + '(个)'
  240. if (summaryInfo.amountInfo) {
  241. amount = (amount / 365 * extendDays).toFixed(2);
  242. summaryInfo.amountInfo += ' = ' + amount + '(元)'
  243. summaryInfo.amount = amount;
  244. }
  245. }
  246. // 计算一授权一天的单价
  247. if (summaryInfo.userEndDate) {
  248. let price = (summaryInfo.amount / summaryInfo.wxMaxNum / extendDays).toFixed(2);
  249. summaryInfo.priceInfo = price
  250. summaryInfo.extendDays = extendDays
  251. }
  252. this.setData({
  253. summaryInfo: summaryInfo
  254. })
  255. },
  256. /**
  257. * @desc : 统计电脑端和手机端的用户数
  258. * @author : 周兴
  259. * @date : 2024/4/1
  260. */
  261. countStaffInfo() {
  262. let summaryInfo = this.data.summaryInfo;
  263. let staffCount = this.data.staffCount;
  264. if (!staffCount) {
  265. return;
  266. }
  267. let webNum = staffCount.webMaxNum + staffCount.maxNum
  268. let wxNum = staffCount.wxMaxNum + staffCount.maxNum
  269. summaryInfo.staffInfo = '可配置手机端授权' + wxNum + '个;电脑端授权' + webNum + '个(包含当前用户)'
  270. summaryInfo.webMaxNum = webNum
  271. summaryInfo.wxMaxNum = wxNum
  272. // 升级从当天算
  273. if (this.data.upgradeFlag) {
  274. summaryInfo.buyBeginDate = new Date().addDays(1).toDateStr();
  275. summaryInfo.extendDays = new Date(summaryInfo.endDate).dayDiff(new Date().addDays(1));
  276. } else {
  277. summaryInfo.buyBeginDate = new Date(this.data.cpEndDate).addDays(1).toDateStr();
  278. summaryInfo.extendDays = new Date(summaryInfo.endDate).dayDiff(new Date(this.data.cpEndDate).addDays(1));
  279. }
  280. // 计算一授权一天的单价
  281. let price = (summaryInfo.amount / (webNum + wxNum) / summaryInfo.extendDays).toFixed(2);
  282. summaryInfo.priceInfo = price
  283. this.setData({
  284. summaryInfo: summaryInfo
  285. })
  286. },
  287. /**
  288. * @desc : 修改用户数
  289. * @author : 周兴
  290. * @date : 2024/4/1
  291. */
  292. changeStaffCount(e) {
  293. let staffCount = this.data.staffCount
  294. let ds = e.currentTarget.dataset
  295. if (ds.type == 'wx') {
  296. staffCount.wxMaxNum = e.detail
  297. } else if (ds.type == 'web') {
  298. staffCount.webMaxNum = e.detail
  299. } else {
  300. staffCount.maxNum = e.detail
  301. }
  302. this.setData({
  303. staffCount: staffCount
  304. })
  305. // 计算金额
  306. this.countSummaryAmount();
  307. },
  308. /**
  309. * @desc : 保存
  310. * @author : 周兴
  311. * @date : 2024/4/1
  312. */
  313. handleSave() {
  314. let summaryInfo = this.data.summaryInfo;
  315. let currentUserCount = this.data.currentUserCount
  316. if (!currentUserCount) {
  317. return;
  318. }
  319. if (this.data.gradeCode == Constants.gradeCode.STD) {
  320. // 必须要选择一个授权
  321. if (Number(summaryInfo.amount) <= 0) {
  322. util.showToast('请选择一个授权');
  323. return false
  324. }
  325. // 判断数量是否超出续约授权
  326. if (currentUserCount.wxNum > summaryInfo.wxMaxNum && summaryInfo.reCountFlag) {
  327. let staffInfo = [{ wxMaxNum: this.data.wxMaxNum, title: '当前授权', wxTitle: '手机授权', code: 'current', userTitle: '当前用户' }, { wxMaxNum: summaryInfo.wxMaxNum, title: '续费授权', wxTitle: '手机授权', code: 'renew' }]
  328. this.save({ saveFlag: false, url: '/package-basic-data/pages/activity/detail/detail?staffInfo=' + JSON.stringify(staffInfo) });
  329. } else {
  330. this.save({});
  331. }
  332. } else {
  333. // 判断数量是否超出续约授权
  334. if (currentUserCount.wxNum > summaryInfo.wxMaxNum || currentUserCount.webNum > summaryInfo.webMaxNum) {
  335. let staffInfo = [{ wxMaxNum: this.data.wxMaxNum, webMaxNum: this.data.webMaxNum, title: '当前授权', wxTitle: '手机授权', webTitle: (app.globalData.company.gradeCode == Constants.gradeCode.STD) ? '' : '电脑授权', code: 'current', userTitle: '当前用户' }, { wxMaxNum: summaryInfo.wxMaxNum, webMaxNum: summaryInfo.webMaxNum, title: '续费授权', wxTitle: '手机授权', webTitle: '电脑授权', code: 'renew' }]
  336. this.save({ saveFlag: false, url: '/package-basic-data/pages/activity/detail/detail?staffInfo=' + JSON.stringify(staffInfo) });
  337. } else {
  338. this.save({});
  339. }
  340. }
  341. },
  342. /**
  343. * @desc : 改变用户授权数
  344. * @author : 周兴
  345. * @date : 2024/4/1
  346. */
  347. changeUserSTD(e) {
  348. let summaryInfo = this.data.summaryInfo
  349. summaryInfo.wxMaxNum = e.detail
  350. this.setData({
  351. summaryInfo: summaryInfo
  352. })
  353. // 计算金额
  354. this.countSummaryAmountSTD();
  355. },
  356. /**
  357. * @desc : 校验
  358. * @author : 周兴
  359. * @date : 2024/4/1
  360. */
  361. validData() {
  362. // 专业版校验
  363. if (this.data.gradeCode == Constants.gradeCode.PRO) {
  364. // if (!this.data.readFlag) {
  365. // util.showToast('请勾选阅读须知');
  366. // return false;
  367. // }
  368. let curentAdItem = this.data.curentAdItem;
  369. if (!curentAdItem) {
  370. util.showToast('请选择活动');
  371. return false
  372. }
  373. // 必须要选择一个授权
  374. let staffCount = this.data.staffCount
  375. if (!staffCount.maxNum && !staffCount.webMaxNum && !staffCount.wxMaxNum) {
  376. util.showToast('请选择一个授权');
  377. return false
  378. }
  379. } else {
  380. let curentAdItem = this.data.curentAdItem;
  381. if (!curentAdItem) {
  382. util.showToast('请选择活动');
  383. return false
  384. }
  385. }
  386. return true;
  387. },
  388. /**
  389. * @desc : 设置保存参数
  390. * @author : 周兴
  391. * @date : 2024/4/1
  392. */
  393. setParams(params) {
  394. let summaryInfo = this.data.summaryInfo
  395. let curentAdItem = this.data.curentAdItem
  396. let cpEndDate = this.data.cpEndDate
  397. if (!summaryInfo || !cpEndDate) return;
  398. params.endDate = summaryInfo.endDate
  399. params.userEndDate = summaryInfo.userEndDate
  400. params.gradeCode = this.data.gradeCode
  401. params.cpId = app.globalData.company.cpId
  402. params.tradeNo = this.generateRandomNo();
  403. params.wxUserId = app.globalData.user.userId
  404. params.tradeAmount = summaryInfo.amount
  405. params.buyBeginDate = summaryInfo.buyBeginDate;
  406. params.buyEndDate = summaryInfo.endDate
  407. params.extendDays = summaryInfo.extendDays;
  408. if (this.data.gradeCode == Constants.gradeCode.STD) {
  409. params.buyEndDate = summaryInfo.userEndDate
  410. params.endDate = app.globalData.company.endDate
  411. params.wxMaxNum = summaryInfo.wxMaxNum
  412. if (this.data.showVip && this.data.chooseVipFlag) {
  413. params.vip = true;
  414. } else if (!this.data.showVip && app.globalData.company.vip) {
  415. params.vip = true;
  416. }
  417. if (this.data.chooseVipFlag) {
  418. params.vip = true;
  419. }
  420. if (!summaryInfo.reCountFlag && summaryInfo.wxMaxNumSocial) {
  421. params.wxMaxNum = summaryInfo.wxMaxNum + summaryInfo.wxMaxNumSocial
  422. }
  423. } else {
  424. params.webMaxNum = summaryInfo.webMaxNum
  425. params.wxMaxNum = summaryInfo.wxMaxNum
  426. }
  427. params.buyLong = curentAdItem.activityItemName
  428. return params;
  429. },
  430. /**
  431. * @desc : 保存数据
  432. * @author : 周兴
  433. * @date : 2024/5/17
  434. */
  435. saveData(params) {
  436. return this.excute(this.data.service, this.data.service.reNewCompany, this.data.params).then(res => {
  437. if (res.data.code == Constants.SUCESS_CODE) {
  438. // 成功后跳转支付
  439. this.toPay(res.data.data);
  440. }
  441. })
  442. },
  443. /**
  444. * @desc : 查询当前用户授权数
  445. * @author : 周兴
  446. * @date : 2024/4/1
  447. */
  448. getStaffCount() {
  449. let service = app.globalData['commonService']
  450. this.excute(service, service.selectUserCount, {}).then(res => {
  451. if (res.data.code == Constants.SUCESS_CODE) {
  452. if (res.data && res.data.data) {
  453. let currentUserCount = res.data.data;
  454. this.setData({
  455. currentUserCount: currentUserCount,
  456. //服务器的时间
  457. currentDate: new Date(currentUserCount.currentDate)
  458. })
  459. }
  460. }
  461. // 获取活动
  462. this.getActivity()
  463. this.setData({
  464. loadFlag: true
  465. })
  466. });
  467. },
  468. /**
  469. * @desc : 查询活动
  470. * @author : 周兴
  471. * @date : 2024/4/1
  472. */
  473. getActivity() {
  474. let params = {
  475. appCode: Constants.APP_CODE,
  476. activityStatus: Constants.kindCode.activityStatus,
  477. cpId: app.globalData.company.cpId,
  478. gradeCode: this.data.gradeCode
  479. }
  480. // 标准版
  481. if (this.data.gradeCode == Constants.gradeCode.STD) {
  482. params.activityTypeList = [Constants.kindCode.activityGrade];
  483. } else {
  484. params.activityTypeList = [Constants.kindCode.activityGrade, Constants.kindCode.activityVip];
  485. }
  486. let service = app.globalData['activityService']
  487. this.excute(service, service.selectActivityItems, params).then(res => {
  488. if (res.data.code == Constants.SUCESS_CODE) {
  489. if (res.data && res.data.data) {
  490. let activityTable = res.data.data;
  491. // 如果是标准版,需要进行截止日期的处理
  492. if (this.data.gradeCode == Constants.gradeCode.STD) {
  493. this.setData({
  494. activityTable: activityTable.filter(it => it.activityType == Constants.kindCode.activityGrade),
  495. vipTable: activityTable.filter(it => it.activityType == Constants.kindCode.activityVip),
  496. })
  497. this.handleDataStd(activityTable);
  498. } else {
  499. this.setData({
  500. activityTable: activityTable
  501. })
  502. }
  503. }
  504. }
  505. });
  506. },
  507. /**
  508. * @desc : 标准版处理数据
  509. * @author : 周兴
  510. * @date : 2024/4/1
  511. */
  512. handleDataStd(activityTable) {
  513. if (activityTable && activityTable.length > 0) {
  514. let item = activityTable[0]
  515. this.setData({
  516. curentAdItem: item
  517. })
  518. let summaryInfo = this.data.summaryInfo
  519. let months = item.validLong + item.extraLong
  520. //服务器的时间
  521. let endDate = this.data.currentDate.addMonths(months).addDays(-1)
  522. let dayDiffs = null;
  523. if (summaryInfo.userEndDate) {
  524. dayDiffs = new Date(summaryInfo.userEndDate).dayDiff(new Date(new Date().toDateStr()))
  525. }
  526. // 如果截止日期是空,就取活动中的截止日期
  527. if (!summaryInfo.userEndDate || !dayDiffs || dayDiffs < 0) {
  528. summaryInfo.userEndDate = endDate.toDateStr();
  529. // 重新统计,到期续费或者第一次购买用户
  530. summaryInfo.reCountFlag = true;
  531. summaryInfo.wxMaxNum = summaryInfo.wxMaxNumSocial
  532. this.setData({
  533. showVip: true
  534. })
  535. } else {
  536. // 如果没有购买,需要显示
  537. if (!app.globalData.company.vip) {
  538. this.setData({
  539. showVip: true
  540. })
  541. }
  542. }
  543. summaryInfo.buyBeginDate = this.data.currentDate.toDateStr();
  544. this.setData({
  545. summaryInfo: summaryInfo
  546. })
  547. // 计算金额
  548. this.countSummaryAmountSTD();
  549. }
  550. },
  551. /**
  552. * 生命周期函数--监听页面加载
  553. */
  554. onLoad(options) {
  555. // 升级
  556. if (options && options.upgrade) {
  557. wx.setNavigationBarTitle({
  558. title: mixins.$t('updateSpecialized'),
  559. })
  560. this.setData({
  561. gradeCode: Constants.gradeCode.PRO,
  562. upgradeFlag: true
  563. })
  564. } else {
  565. // 购买授权 和续费
  566. if (options.buyUser) {
  567. wx.setNavigationBarTitle({
  568. title: mixins.$t('buyUser'),
  569. })
  570. } else {
  571. wx.setNavigationBarTitle({
  572. title: mixins.$t('reNew'),
  573. })
  574. }
  575. this.setData({
  576. gradeCode: app.globalData.company.gradeCode
  577. })
  578. }
  579. this.setData({
  580. companyName: app.globalData.company.cpName,
  581. cpManager: app.globalData.company.cpManager,
  582. cpPhone: app.globalData.company.cpPhone,
  583. cpEndDate: app.globalData.company.endDate,
  584. webMaxNum: app.globalData.company.webMaxNum,
  585. wxMaxNum: app.globalData.company.wxMaxNum,
  586. })
  587. // 如果是标准版,需要获取用户授权数(手机)
  588. let summaryInfo = {}
  589. summaryInfo.wxMaxNum = 1
  590. summaryInfo.wxMaxNumSocial = this.data.wxMaxNum
  591. // 续费用户到期日期
  592. summaryInfo.userEndDate = app.globalData.company.userEndDate
  593. this.setData({
  594. summaryInfo: summaryInfo
  595. })
  596. // 获取活动
  597. // this.getActivity();
  598. // 获取当前用户授权数
  599. this.getStaffCount();
  600. },
  601. /**
  602. * 六大功能的切换
  603. */
  604. funcClick(e) {
  605. let funcMenuFlg = !this.data.funcMenuFlg
  606. if (funcMenuFlg) {
  607. this.setData({
  608. funcMenu: [
  609. {
  610. title: '订单开单',
  611. icon: 'btn-account-receivable.png',
  612. },
  613. {
  614. title: '销售出库',
  615. icon: 'btn-shipped.png',
  616. },
  617. {
  618. title: '销售退货',
  619. icon: 'btn-stored.png',
  620. },
  621. {
  622. title: '销售跟踪',
  623. icon: 'btn-shipped-out.png',
  624. },
  625. {
  626. title: '采购订单',
  627. icon: 'btn-account-receivable.png',
  628. },
  629. {
  630. title: '采购入库',
  631. icon: 'btn-shipped.png',
  632. },
  633. {
  634. title: '采购退货',
  635. icon: 'btn-stored.png',
  636. },
  637. {
  638. title: '以销定采',
  639. icon: 'btn-shipped-out.png',
  640. },
  641. {
  642. title: '库存查询',
  643. icon: 'btn-account-receivable.png',
  644. },
  645. {
  646. title: '入库办理',
  647. icon: 'btn-shipped.png',
  648. },
  649. {
  650. title: '出库办理',
  651. icon: 'btn-stored.png',
  652. },
  653. {
  654. title: '库存盘点',
  655. icon: 'btn-shipped-out.png',
  656. },
  657. {
  658. title: '资金账户',
  659. icon: 'btn-account-receivable.png',
  660. },
  661. {
  662. title: '资金转账',
  663. icon: 'btn-shipped.png',
  664. },
  665. {
  666. title: '收款单',
  667. icon: 'btn-stored.png',
  668. },
  669. {
  670. title: '付款单',
  671. icon: 'btn-shipped-out.png',
  672. },
  673. {
  674. title: '日结对账',
  675. icon: 'btn-account-receivable.png',
  676. },
  677. {
  678. title: '资金日记账',
  679. icon: 'btn-shipped.png',
  680. },
  681. {
  682. title: '供应商往来',
  683. icon: 'btn-stored.png',
  684. },
  685. ],
  686. })
  687. } else {
  688. this.setData({
  689. funcMenu: [
  690. {
  691. title: '订单开单',
  692. icon: 'btn-account-receivable.png',
  693. },
  694. {
  695. title: '销售出库',
  696. icon: 'btn-shipped.png',
  697. },
  698. {
  699. title: '销售退货',
  700. icon: 'btn-stored.png',
  701. },
  702. {
  703. title: '销售跟踪',
  704. icon: 'btn-shipped-out.png',
  705. },
  706. {
  707. title: '采购订单',
  708. icon: 'btn-account-receivable.png',
  709. },
  710. {
  711. title: '采购入库',
  712. icon: 'btn-shipped.png',
  713. },
  714. {
  715. title: '采购退货',
  716. icon: 'btn-stored.png',
  717. },
  718. {
  719. title: '以销定采',
  720. icon: 'btn-shipped-out.png',
  721. },
  722. ],
  723. })
  724. }
  725. this.setData({
  726. funcMenuFlg
  727. })
  728. },
  729. })