vueFilter.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. import Vue from 'vue'
  2. import dayjs from 'dayjs'
  3. import numeral from 'numeral'
  4. import * as constant from '../constant'
  5. // 合并数组
  6. Vue.filter('joinArray', (value, type) => {
  7. if (!type) {
  8. type = ' '
  9. }
  10. if (typeof value == 'object' && value != null) {
  11. return value.join(type)
  12. } else {
  13. return value
  14. }
  15. })
  16. // 合作单位
  17. Vue.filter('branchType', (value) => {
  18. let template = {
  19. OWN: "自有",
  20. COOPERATION: "合作",
  21. LEASE: "租赁"
  22. }
  23. return template[value]
  24. })
  25. // 商品类型
  26. Vue.filter('shopType', (value) => {
  27. let template = {
  28. "INSTRUMENT": "乐器",
  29. "ACCESSORIES": "辅件",
  30. "TEACHING": "教材",
  31. "STAFF": "教谱",
  32. "OTHER": "其它",
  33. }
  34. return template[value]
  35. })
  36. // 乐团状态
  37. Vue.filter('musicGroupType', (value) => {
  38. let template = {
  39. APPLY: "报名中",
  40. PAY: "缴费中",
  41. PREPARE: "筹备中",
  42. PROGRESS: "进行中",
  43. CANCELED: '取消',
  44. PAUSE: '暂停',
  45. AUDIT: '审核中',
  46. DRAFT: '编辑中',
  47. AUDIT_FAILED: '审核失败'
  48. }
  49. return template[value]
  50. })
  51. // 乐团学员状态
  52. Vue.filter('musicGroupStudentType', (value) => {
  53. let template = {
  54. NORMAL: "在读",
  55. LEAVE: "请假",
  56. QUIT: "退团",
  57. APPLY: '报名'
  58. }
  59. return template[value]
  60. })
  61. // 乐团学员状态
  62. Vue.filter('instrumentType', (value) => {
  63. let template = {
  64. GROUP: "团购",
  65. OWNED: "自备",
  66. LEASE: "租赁"
  67. }
  68. return template[value]
  69. })
  70. // 课程类型
  71. Vue.filter('coursesType', (value) => {
  72. let template = {
  73. NORMAL: '单技课',
  74. SINGLE: '单技课',
  75. MIX: "合奏课",
  76. HIGH: "基础技能课",
  77. VIP: "VIP课",
  78. DEMO: "试听课",
  79. COMPREHENSIVE: '综合课',
  80. // PRACTICE: '练习课',
  81. ENLIGHTENMENT: '启蒙课',
  82. TRAINING: '集训课',
  83. TRAINING_SINGLE: '集训单技课',
  84. TRAINING_MIX: '集训合奏课',
  85. CLASSROOM: '课堂课',
  86. PRACTICE: '网管课',
  87. COMM: '对外课',
  88. MUSIC: '乐团课',
  89. HIGH_ONLINE: '线上基础技能课',
  90. MUSIC_NETWORK: '乐团网管课'
  91. }
  92. return template[value]
  93. })
  94. // 课程状态
  95. Vue.filter('coursesStatus', (value) => {
  96. let template = {
  97. NOT_START: "未开始",
  98. UNDERWAY: "进行中",
  99. OVER: "已结束"
  100. }
  101. return template[value]
  102. })
  103. // 考勤类型
  104. Vue.filter('clockingIn', value => {
  105. let templateStatus = {
  106. NORMAL: "正常",
  107. TRUANT: "旷课",
  108. LEAVE: "请假",
  109. QUIT_SCHOOL: "休学",
  110. DROP_OUT: "退学"
  111. }
  112. return templateStatus[value]
  113. })
  114. // 学员状态
  115. Vue.filter('studentTeamStatus', value => {
  116. let templateStatus = {
  117. NORMAL: "在读",
  118. QUIT: "退团",
  119. QUIT_SCHOOL: "休学",
  120. APPLY: '报名'
  121. }
  122. return templateStatus[value]
  123. })
  124. // 时间处理
  125. Vue.filter('dayjsFormat', (value) => {
  126. if (value) {
  127. return dayjs(value).format('YYYY-MM-DD')
  128. } else {
  129. return value
  130. }
  131. })
  132. Vue.filter('dayjsFormatMinute', (value) => {
  133. if (value) {
  134. return dayjs(value).format('HH:mm')
  135. } else {
  136. return value
  137. }
  138. })
  139. Vue.filter('formatTimer', (value) => {
  140. if (value) {
  141. return value.split(' ')[0]
  142. } else {
  143. return value
  144. }
  145. })
  146. Vue.filter('timerForMinFormat', (value) => {
  147. if (value) {
  148. return value.substring(0, 5)
  149. } else {
  150. return value
  151. }
  152. })
  153. Vue.filter('dateForMinFormat', (value) => {
  154. if (value) {
  155. return value.substring(0, 16)
  156. } else {
  157. return value
  158. }
  159. })
  160. Vue.filter('paymentPatternTypeFormat', val => constant.paymentPatternType[val])
  161. // 支付用户类型
  162. Vue.filter('payUserTypeFormat', val => constant.payUserType[val])
  163. // 支付缴费方式
  164. Vue.filter('userPaymentTypeFormat', val => constant.userPaymentType[val])
  165. // 课程类型格式化
  166. Vue.filter('courseTypeFormat', val => constant.courseType[val])
  167. // 时间处理
  168. Vue.filter('timer', (value) => {
  169. if (value) {
  170. let tempDate = new Date(value)
  171. let month = tempDate.getHours() >= 10 ? tempDate.getHours() : '0' + tempDate.getHours()
  172. let days = tempDate.getMinutes() >= 10 ? tempDate.getMinutes() : '0' + tempDate.getMinutes()
  173. return month + ':' + days
  174. } else {
  175. return value
  176. }
  177. })
  178. // 格式化成星期
  179. Vue.filter('formatWeek', date => {
  180. let nd = new Date(date)
  181. let temp = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  182. return temp[nd.getDay()]
  183. })
  184. // 职位
  185. Vue.filter('jobType', value => {
  186. let template = {
  187. ADVISER: "指导老师",
  188. ACADEMIC: "教务老师",
  189. TEACHING: "乐队指导"
  190. }
  191. return template[value]
  192. })
  193. // 工作类型
  194. Vue.filter('jobNature', (value) => {
  195. return constant.jobNature[value]
  196. })
  197. // 考勤状态
  198. Vue.filter('attendanceType', value => {
  199. let template = {
  200. 0: "异常签到",
  201. 1: "正常签到",
  202. 3: "未签到"
  203. }
  204. return template[value]
  205. })
  206. // 考情签退
  207. Vue.filter('attendanceOutType', value => {
  208. let template = {
  209. 0: "异常签退",
  210. 1: "正常签退",
  211. 3: "未签退"
  212. }
  213. return template[value]
  214. })
  215. // 上课类型
  216. Vue.filter('workType', value => {
  217. return constant.workType[value]
  218. })
  219. // 交易类型
  220. Vue.filter('orderType', value => {
  221. let template = {
  222. APPLY: "报名",
  223. RENEW: "续费",
  224. OTHER: "其他",
  225. SMALL_CLASS_TO_BUY: "VIP购买",
  226. SPORADIC: '零星收费',
  227. LUCK: "福袋活动",
  228. PRACTICE: '网管课',
  229. PRACTICE_GROUP_BUY: '网管课购买',
  230. PRACTICE_GROUP_RENEW: '网管课续费',
  231. REPAIR: '乐器维修',
  232. OUTORDER: '外部收入',
  233. GOODS_SELL: '商品销售',
  234. SUBJECT_CHANGE: '声部更换',
  235. DOUBLE_ELEVEN2020: '双十一活动',
  236. DEGREE_REGISTRATION: '考级报名'
  237. }
  238. return template[value]
  239. })
  240. //
  241. Vue.filter('paymentChannelType', value => {
  242. let template = {
  243. PER: "个人",
  244. COM: "公司"
  245. }
  246. return template[value]
  247. })
  248. // 交易状态
  249. Vue.filter('dealStatus', value => {
  250. let template = {
  251. ING: "交易中",
  252. SUCCESS: "成功交易",
  253. FAILED: "交易失败",
  254. CLOSE: "交易关闭"
  255. }
  256. return template[value]
  257. })
  258. // 交易状态
  259. Vue.filter('returnStatus', value => {
  260. let template = {
  261. ING: "审核中",
  262. REJECT: "拒绝",
  263. WAIT_PAYMENT: "待支付",
  264. DONE: "完成"
  265. }
  266. return template[value]
  267. })
  268. // 缴费状态
  269. Vue.filter('payTypeStatus', val => {
  270. return constant.payStatus[val]
  271. })
  272. // 性别
  273. Vue.filter('sex', value => {
  274. let template = ['女', '男']
  275. return template[value]
  276. })
  277. // 服从调剂 isAllowAdjust
  278. Vue.filter('isAllowAdjust', value => {
  279. let template = ['否', '是']
  280. return template[value]
  281. })
  282. // 学员缴费状态 paymentStatus
  283. Vue.filter('paymentStatus', value => {
  284. let template = ['未开启缴费', '开启缴费', '已缴费']
  285. return template[value]
  286. })
  287. // 乐团状态
  288. Vue.filter('teamStatus', value => {
  289. let template = {
  290. APPLY: "报名中",
  291. PAY: "缴费中",
  292. PREPARE: "筹备中",
  293. PROGRESS: "进行中",
  294. CANCELED: '取消',
  295. PAUSE: '暂停',
  296. AUDIT: '乐团审核中',
  297. DRAFT: '编辑中',
  298. AUDIT_FAILED: '审核失败',
  299. FEE_AUDIT: '费用审核中'
  300. }
  301. return template[value]
  302. })
  303. // 学生状态
  304. /**studentStatus */
  305. Vue.filter('studentStatus', value => {
  306. let template = ['在读', '已退课', '退课中', '休学']
  307. return template[value]
  308. })
  309. // 学生点名
  310. Vue.filter('studentRecord', value => {
  311. let template = {
  312. NORMAL: "正常",
  313. TRUANT: "旷课",
  314. LEAVE: "请假",
  315. DROP_OUT: "退学",
  316. '': '未签到'
  317. }
  318. return template[value]
  319. })
  320. // 是否
  321. Vue.filter('yesOrNo', value => {
  322. let template = ['否', '是']
  323. return template[value]
  324. })
  325. // 学员缴费状态
  326. Vue.filter('studentPay', value => {
  327. let template = {
  328. PAID_COMPLETED: "完成缴费",
  329. NON_PAYMENT: "未缴费",
  330. PROCESSING: "缴费中",
  331. }
  332. return template[value]
  333. })
  334. // 学员点名详情
  335. Vue.filter('studentSign', value => {
  336. let template = {
  337. NORMAL: "正常",
  338. TRUANT: "旷课",
  339. LEAVE: "请假",
  340. DROP_OUT: '退学'
  341. }
  342. return template[value]
  343. })
  344. // 班级类型
  345. Vue.filter('classType', value => {
  346. let template = {
  347. NORMAL: "单技班",
  348. MIX: '合奏班',
  349. HIGH: '基础技能班',
  350. VIP: 'VIP',
  351. DEMO: '试听',
  352. SNAP: "临时班",
  353. PRACTICE: '网管课',
  354. HIGH_ONLINE: '线上基础技能课',
  355. MUSIC_NETWORK: '乐团网管课'
  356. }
  357. return template[value]
  358. })
  359. Vue.filter('teachMode', value => {
  360. return constant.teachMode[value]
  361. })
  362. // 老师状态
  363. Vue.filter('teacherStatus', value => {
  364. let template = {
  365. "0": '正常',
  366. "1": '冻结',
  367. "9": '锁定'
  368. }
  369. return template[value]
  370. })
  371. // vip课状态
  372. Vue.filter('vipCourseStatus', value => {
  373. let template = {
  374. 0: "未开始",
  375. 1: "报名中",
  376. 5: "报名结束",
  377. 2: "进行中",
  378. 4: "已结束",
  379. 3: "取消"
  380. }
  381. return template[value]
  382. })
  383. // 账号类型
  384. Vue.filter('accountTypeFormat', value => {
  385. let template = {
  386. 0: "对内",
  387. 1: "对外",
  388. }
  389. return template[value]
  390. })
  391. // 扣减库存
  392. Vue.filter('stockTypeFormat', value => {
  393. let template = {
  394. INTERNAL: "内部",
  395. EXTERNAL: "外部",
  396. ALL: "内部,外部",
  397. }
  398. return template[value]
  399. })
  400. // 交易状态
  401. Vue.filter('paymentChannelStatus', value => {
  402. let template = {
  403. YQPAY: "双乾",
  404. BALANCE: "余额",
  405. ADAPAY: "汇付"
  406. }
  407. return template[value]
  408. })
  409. // edition
  410. Vue.filter('editionFilter', value => {
  411. let template = {
  412. 'ios-teacher': '苹果-老师端',
  413. 'ios-student': '苹果-学生端',
  414. 'ios-education': '苹果-教务端',
  415. 'android-teacher': '安卓-老师端',
  416. 'android-student': '安卓-学生端',
  417. 'android-education': '安卓-教务端',
  418. }
  419. return template[value]
  420. })
  421. // payStatus 订单支付状态
  422. Vue.filter('payStatus', value => {
  423. let template = {
  424. WAIT_PAY: "等待支付",
  425. ING: "交易中",
  426. SUCCESS: '成功交易',
  427. FAILED: '交易失败',
  428. CLOSE: '交易关闭'
  429. }
  430. return template[value]
  431. })
  432. // payType 交易类型
  433. Vue.filter('payType', value => {
  434. let template = {
  435. RECHARGE: "充值",
  436. WITHDRAW: "提现",
  437. PAY_FEE: "缴费",
  438. SPORADIC: "零星收费",
  439. FILL_ACCOUNT: "人工补账",
  440. REFUNDS: "退费",
  441. REWARDS: "奖励",
  442. WAGE: "工资"
  443. }
  444. return template[value]
  445. })
  446. // 课程组状态 FINISH
  447. Vue.filter('courseGroup', value => {
  448. let template = {
  449. NORMAL: "正常",
  450. LOCK: "锁定",
  451. FINISH: '结束',
  452. CANCEL: '取消',
  453. }
  454. return template[value]
  455. })
  456. // 网管课程组
  457. Vue.filter('comCourseGroup', value => {
  458. let template = {
  459. NOT_START: "未开始",
  460. LOCK: "锁定",
  461. APPLYING: "报名中",
  462. NORMAL: "进行中",
  463. FINISH: '结束',
  464. CANCEL: '关闭',
  465. }
  466. return template[value]
  467. })
  468. //网管课类型
  469. Vue.filter('comType', value => {
  470. let template = {
  471. FREE: "免费",
  472. CHARGE: '收费',
  473. TRIAL: '试听课',
  474. }
  475. return template[value]
  476. })
  477. // 首充续费
  478. Vue.filter('firstOrRenewFilter', value => {
  479. let template = {
  480. '0': "续费",
  481. '1': "首次",
  482. }
  483. return template[value]
  484. })
  485. // 老师时间
  486. Vue.filter('transTypeFilter', value => {
  487. let template = {
  488. 'RECHARGE': "充值",
  489. 'CONSUME': "建课",
  490. 'RETURN': "退课",
  491. 'MANUAL_ADD': "系统充值",
  492. 'MANUAL_SUB': "系统扣除",
  493. }
  494. return template[value]
  495. })
  496. // paymentType
  497. Vue.filter('paymentType', value => {
  498. let template = {
  499. 'OFFLINE': "线下",
  500. 'ONLINE': "线上",
  501. 'ALL': "全部",
  502. }
  503. return template[value]
  504. })
  505. Vue.filter('paymentListStatus', value => {
  506. let template = {
  507. 0: "未开始",
  508. 1: "已开启",
  509. 2: "已结束",
  510. }
  511. return template[value]
  512. })
  513. // paymentStatus
  514. Vue.filter('paymentStatusDetall', value => {
  515. let template = {
  516. 'PAID_COMPLETED': "已缴费",
  517. 'PROCESSING': "缴费中",
  518. 'NON_PAYMENT': "未缴费",
  519. }
  520. return template[value]
  521. })
  522. // 课时申诉
  523. Vue.filter('complaintsStatusEnum', value => {
  524. let template = {
  525. 0: "已拒绝",
  526. 1: "已通过",
  527. 2: "待处理",
  528. 3: "已撤销",
  529. }
  530. return template[value]
  531. })
  532. // 人事状态 isProbationPeriod
  533. Vue.filter('isProbationPeriod', value => {
  534. let template = {
  535. 0: "正式",
  536. 1: "试用",
  537. 2: "离职",
  538. }
  539. return template[value]
  540. })
  541. Vue.filter('visiterType', value => {
  542. let template = {
  543. 'TEACHER': "指导老师",
  544. 'EDU_TEACHER': "教务老师",
  545. }
  546. return template[value]
  547. })
  548. // 人力资源人员状态
  549. Vue.filter('hrStatus', value => {
  550. let template = {
  551. 'NOT_EMPLOYED': "未录用",
  552. 'INTERVIEWING': "面试中",
  553. 'RESERVE': "储备",
  554. 'PART_TIME': "兼职",
  555. 'FULL_TIME': "全职",
  556. 'DIMISSION': "离职",
  557. }
  558. return template[value]
  559. })
  560. // 费用类型
  561. Vue.filter('feeType', value => {
  562. return constant.feeType[value]
  563. })
  564. // 费用项目
  565. Vue.filter('feeProject', value => {
  566. return constant.feeProject[value]
  567. })
  568. // 销售类型
  569. Vue.filter('saleType', value => {
  570. return constant.saleType[value]
  571. })
  572. // 缴费状态
  573. Vue.filter('teamPayStatus', value => {
  574. const tpl = {
  575. 0: '按月',
  576. 1: '按学期',
  577. 2: '一次性',
  578. }
  579. return tpl[value]
  580. })
  581. // 金额格式化
  582. Vue.filter('moneyFormat', value => {
  583. return numeral(value).format('0,0.00')
  584. })
  585. Vue.filter('stockTypeStatus', value => {
  586. const template = {
  587. INTERNAL: '内部',
  588. EXTERNAL: '外部',
  589. ALL: '全部',
  590. }
  591. return template[value]
  592. })
  593. // 确认收货类型
  594. Vue.filter('receiveFormat', value => {
  595. let template = {
  596. 'NO_RECEIVE': "未确认",
  597. 'MANUAL_RECEIVE': "手动确认",
  598. 'AUTO_RECEIVE': "自动确认",
  599. }
  600. return template[value]
  601. })
  602. // 缴费方式
  603. Vue.filter('payOrderType', value => {
  604. return constant.payOrderType[value]
  605. })
  606. // 审核状态 auditType
  607. Vue.filter('auditType', value => {
  608. return constant.auditType[value]
  609. })
  610. // 审核申请类型 auditPaymentType
  611. Vue.filter('auditPaymentType', value => {
  612. return constant.auditPaymentType[value]
  613. })
  614. // 销售收入和服务收入
  615. Vue.filter('orderServer', value => {
  616. return constant.orderServerType[value]
  617. })
  618. // 订单审核状态 orderAuditType
  619. Vue.filter('orderAuditType', value => {
  620. constant.orderAuditType[''] = '审核通过'
  621. return constant.orderAuditType[value]
  622. })
  623. Vue.filter('songUseTypeFormat', value => {
  624. return constant.songUseType[value]
  625. })