moreModal.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <!-- <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. switchFullscreen
  7. @ok="handleOk"
  8. :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
  9. @cancel="handleCancel"
  10. cancelText="关闭">
  11. <bus-market-member-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></bus-market-member-form>
  12. </j-modal> -->
  13. <j-modal destroyOnClose title="详细设置" :width="'50%'" :footer="null" :visible="visible" :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" @ok="handleOk" @cancel="handleCancel">
  14. <a-card style="width:100%" :tab-list="tabListNoTitle" :active-tab-key="noTitleKey" @tabChange="key => onTabChange(key, 'noTitleKey')">
  15. <BusMarketMemberForm ref="realForm" @ok="submitCallback" :disabled="disableSubmit" v-show="noTitleKey=='commodity'" />
  16. <GoodImg @saveOk="handleCancel" ref="goodImg" v-show="noTitleKey=='goodImg'" />
  17. <FoodSet v-show="noTitleKey=='foodSet'" />
  18. </a-card>
  19. </j-modal>
  20. </template>
  21. <script>
  22. const tabListNoTitle=[
  23. {
  24. key: 'commodity',
  25. tab: '商品小程序设置',
  26. },
  27. {
  28. key: 'goodImg',
  29. tab: '商品图片',
  30. },
  31. {
  32. key: 'foodSet',
  33. tab: '餐饮设置',
  34. }
  35. ]
  36. import BusMarketMemberForm from './commodity.vue'
  37. // import GoodImg from './goodImg.vue'
  38. import GoodImg from '../roomLayoutDetailForm/roomLayoutImage.vue'
  39. import FoodSet from './foodSet.vue'
  40. import { computed } from 'vue'
  41. export default {
  42. name: 'BusMarketMemberModal',
  43. components: {
  44. BusMarketMemberForm,
  45. GoodImg,
  46. FoodSet
  47. },
  48. data() {
  49. return {
  50. title: '',
  51. width: 800,
  52. visible: false,
  53. disableSubmit: false,
  54. tabListNoTitle,
  55. key: 'tab1',
  56. noTitleKey: 'commodity',
  57. model:{}
  58. }
  59. },
  60. provide(){
  61. return{
  62. modelData:computed(()=> this.model)
  63. }
  64. },
  65. methods: {
  66. add() {
  67. this.visible = true
  68. this.$nextTick(() => {
  69. this.$refs.realForm.add();
  70. })
  71. },
  72. edit(record) {
  73. console.log(record);
  74. this.visible = true
  75. this.$nextTick(() => {
  76. this.model = record
  77. this.$refs.realForm.edit(record);
  78. console.log('refs.realForm',this.$refs.realForm);
  79. })
  80. },
  81. close() {
  82. this.$emit('close');
  83. this.visible = false;
  84. },
  85. handleOk() {
  86. this.$refs.realForm.submitForm();
  87. },
  88. submitCallback() {
  89. this.$emit('ok');
  90. this.visible = false;
  91. },
  92. handleCancel() {
  93. this.close()
  94. },
  95. //更多设置切换卡片
  96. onTabChange(key, type) {
  97. console.log(key, type);
  98. this[type] = key;
  99. if (key = 'goodImg') {
  100. this.model.url = true
  101. this.$refs.goodImg.setData(this.model)
  102. }
  103. },
  104. }
  105. }
  106. </script>