Discount.js 766 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { Model, Collection } from 'js-abstract-model'
  2. class Discount extends Model {
  3. constructor (data) {
  4. super(data, [
  5. { key: 'id' },
  6. { key: 'code' },
  7. { key: 'price' },
  8. { key: 'order_price' },
  9. { key: 'target' },
  10. {
  11. key: 'percent',
  12. default: 0
  13. },
  14. { key: 'expire_time' }
  15. ], {
  16. target: {
  17. infoKey: 'target_info',
  18. enumListKey: 'targetEnums',
  19. enums: [
  20. { label: 'فروشگاه', value: 'STORE' },
  21. { label: 'دوره آموزشی', value: 'TRAINING' },
  22. { label: 'رویداد', value: 'EVENT' }
  23. ]
  24. }
  25. })
  26. }
  27. }
  28. class DiscountList extends Collection {
  29. model() {
  30. return Discount
  31. }
  32. }
  33. export { Discount, DiscountList }