orderItemMixin.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import TouristList from './TouristList'
  2. import { randomString } from '@/utils'
  3. export default {
  4. data () {
  5. return {
  6. touristList: []
  7. }
  8. },
  9. components: {
  10. TouristList
  11. },
  12. computed: {
  13. category () {
  14. return this.$route.meta.category || 'ticket'
  15. }
  16. },
  17. methods: {
  18. showTouristList (record) {
  19. this.currentRecord = record
  20. this.formData = this.$parent.$parent.$refs.formInfo.form
  21. this.touristList = record.tickets
  22. this.touristList.forEach(v => {
  23. v.idKey = randomString()
  24. })
  25. if (!this.currentRecord.currentTicket) {
  26. this.currentRecord.currentTicket = this.currentRecord.tickets[0]
  27. }
  28. this.$refs.touristList.show()
  29. },
  30. updateTourist (data) {
  31. const { id: ticketTypeId, playDateBegin, playDateEnd, isDiscount, price, batchConfigId } = this.currentRecord.currentTicket
  32. this.currentRecord.tickets = data.map(item => {
  33. const data = {
  34. ...item,
  35. playDateBegin,
  36. playDateEnd,
  37. isDiscount,
  38. price,
  39. ticketTypeId
  40. }
  41. batchConfigId && (data.batchConfigId = batchConfigId)
  42. return data
  43. })
  44. this.currentRecord.count = data.length
  45. this.currentRecord.total = this.$NP.times(this.currentRecord.price, this.currentRecord.count)
  46. },
  47. handleConfirm () {
  48. if (this.category === 'batch') {
  49. if (this.tickets.some(i => !i.batchConfigId)) {
  50. return this.$message.error('请选择场次')
  51. }
  52. }
  53. this.formData = this.$parent.$parent.$refs.formInfo.form
  54. this.formData.remark = this.remark
  55. this.formData.pictureRemarks = this.pictureRemarks
  56. if (this.formData.checkWay === 3) {
  57. if (this.tickets.some(i => !i.guestIdentify)) {
  58. return this.$message.error('检票方式为身份证入园,门票列表缺少身份证,请检查。')
  59. }
  60. }
  61. if (this.formData.checkWay === 4) {
  62. if (this.tickets.some(i => !i.face)) {
  63. return this.$message.error('检票方式为人脸入园,门票列表缺少人脸照片,请检查。')
  64. }
  65. }
  66. if (this.formData.checkWay === 5) {
  67. if (this.tickets.some(i => !i.ticketNo)) {
  68. return this.$message.error('检票方式为预印票,门票列表缺少票号,请检查。')
  69. }
  70. }
  71. this.$refs.confirm.show()
  72. }
  73. }
  74. }