index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div>
  3. <div class="search">
  4. <Search :SearchForm="SetMealSearchForm"></Search>
  5. </div>
  6. <div class="addSetMeal">
  7. <a-button type="primary" @click="visibleSetMeal = true">新增套餐计划</a-button>
  8. </div>
  9. <div class="table">
  10. <a-table row-key="id" :data="data" :columns="columnsSetMeal" :pagination="pagination" :scroll="{ x: 'auto' }"
  11. @page-change="evChangePage">
  12. <template #Controls="{ record }">
  13. <a-space>
  14. <a-button type="text">设置套餐</a-button>
  15. <a-button type="text" @click="visibleQrCode = true">充值二维码</a-button>
  16. <a-button type="text">下架</a-button>
  17. </a-space>
  18. </template>
  19. </a-table>
  20. </div>
  21. <a-modal v-model:visible="visibleQrCode" width="700px" @cancel="visibleQrCode = false" title="充值二维码">
  22. <div class="code">
  23. <qrcode-vue :value="codeUrl" size="150" level="H"></qrcode-vue>
  24. </div>
  25. <template #footer>
  26. <a-button @click="visibleQrCode = false">关闭</a-button>
  27. </template>
  28. </a-modal>
  29. <a-modal v-model:visible="visibleSetMeal" width="600px" @cancel="visibleSetMeal = false" title="新增套餐计划">
  30. <div class="Form">
  31. <a-form ref="formRef" :rules="rules" :model="Form" @submit="handleSubmit">
  32. <a-form-item label="套餐计划名称" field="source">
  33. <a-input placeholder="请输入套餐计划名称"></a-input>
  34. </a-form-item>
  35. <a-form-item label="选择所属客户" field="source">
  36. <a-select :style="{ width: '320px' }" placeholder="请选择所属客户">
  37. <a-option v-for="(item,index) in userList" :value="item.id">{{ item.name}}</a-option>
  38. </a-select>
  39. </a-form-item>
  40. </a-form>
  41. </div>
  42. <template #footer>
  43. <a-button @click="visibleSetMeal = false">取消</a-button>
  44. <a-button type="primary" @click="visibleSetMeal = false">确定</a-button>
  45. </template>
  46. </a-modal>
  47. </div>
  48. </template>
  49. <script setup>
  50. import { ref, onMounted, toRefs } from 'vue';
  51. import Search from '@/components/Search/index.vue'
  52. import { SetMealSearchForm, columnsSetMeal } from '../config.js'
  53. import { getMessUserList } from '@/api/customer.js';
  54. import QrcodeVue from 'qrcode.vue'
  55. const state = ref({
  56. data: [{ labelName: '666', ID: '4884', userName: '张总', time: '2024', status: '正常' }],
  57. pagination: {
  58. total: 0,
  59. pageSize: 10,
  60. current: 1,
  61. },
  62. visibleQrCode: false,
  63. codeUrl: 'https://baidu.com',
  64. visibleSetMeal: false,
  65. Form: {
  66. },
  67. userList:[]
  68. })
  69. const { data, pagination, visibleQrCode, codeUrl, visibleSetMeal ,userList} = toRefs(state.value)
  70. const fetchCustomerList = async (item) => {
  71. const response = await getMessUserList({
  72. current: 1,
  73. pageSize: 99999,
  74. });
  75. if (response.code === 200 && response.data) {
  76. userList.value = response.data.records
  77. }
  78. };
  79. onMounted(()=>{
  80. fetchCustomerList()
  81. })
  82. </script>
  83. <style lang="less" scoped>
  84. .search,
  85. .table {
  86. margin-top: 1rem;
  87. }
  88. .code {
  89. justify-content: center;
  90. display: flex;
  91. }
  92. </style>