inviteEnrollPopup.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. const util = require("../../../utils/util");
  2. Component({
  3. options:{addGlobalClass: true},
  4. properties: {
  5. show:{
  6. type: Boolean,
  7. observer: function (newVal) {
  8. this.setData({ show: newVal });
  9. }
  10. },
  11. datas:{
  12. type: Object,
  13. observer: function (newVal) {
  14. this.setData({ datas: newVal });
  15. }
  16. },
  17. shareInfo:{
  18. type: Object,
  19. observer: function (newVal) {
  20. console.log(newVal)
  21. this.setData({ shareInfo: newVal });
  22. }
  23. },
  24. list:{
  25. type: Array,
  26. observer: function (newVal) {
  27. this.setData({ list: newVal });
  28. this.getSkuName()
  29. }
  30. },
  31. remainTime:{
  32. type: Object,
  33. observer:function(val){
  34. this.setData({ updateTime: val });
  35. }
  36. },
  37. },
  38. data: {
  39. show:false,
  40. datas:{},
  41. list:[],
  42. shareInfo:{},
  43. skuInfo:{
  44. sessionName:'',
  45. mealsName:''
  46. },
  47. updateTime:{}
  48. },
  49. methods: {
  50. // 关闭弹窗
  51. closeTip(e){
  52. console.log(e)
  53. this.close(e.detail)
  54. },
  55. close(e){
  56. // this.setData({show:false})
  57. this.triggerEvent("close", false);
  58. },
  59. // 立即报名/一键参团/新开拼团
  60. signup(){
  61. if (!util.isEmpty(this.data.shareInfo.groupid)) {
  62. this.triggerEvent("newGroup", (this.data.datas.status ==2 || this.data.datas.status ==4)?1:0);
  63. } else {
  64. this.triggerEvent("signup", false);
  65. }
  66. },
  67. // 获取对应场次/套餐名称
  68. getSkuName(){
  69. // let session=this.recursion(this.data.list,this.data.shareInfo.sid,0);
  70. let list = this.data.list,sid=this.data.shareInfo.sid,pid=this.data.shareInfo.pid;
  71. for (let i = 0; i < list.length; i++) {
  72. if (list[i].sid==sid) {
  73. this.setData({'skuInfo.sessionName':list[i].name})
  74. for (let index = 0; index < list[i].meals.length; index++) {
  75. if (list[i].meals[index].pid==pid) {
  76. this.setData({'skuInfo.mealsName':list[i].meals[index].policyName})
  77. return false;
  78. }
  79. }
  80. }
  81. }
  82. },
  83. }
  84. })