index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="px32rpx py24rpx">
  3. <view class="bg-white rounded-16rpx p-24rpx">
  4. <wd-select-picker
  5. label="补课课时"
  6. v-model="MakeUpClassId"
  7. :columns="data"
  8. placeholder="请选择补课课时"
  9. align-right
  10. type="radio"
  11. value-key="id"
  12. safe-area-inset-bottom
  13. label-key="name"
  14. ></wd-select-picker>
  15. <wd-divider color="#F0F0F0"></wd-divider>
  16. </view>
  17. <view class="mt20rpx bg-white rounded-16rpx p24rpx mb20rpx">
  18. <view class="mb20rpx">
  19. <wd-checkbox
  20. v-model="isCheckAll"
  21. size="large"
  22. shape="square"
  23. @change="handleCheckAllChange"
  24. ><text class="font-semibold text-32rpx">全选</text>
  25. </wd-checkbox>
  26. </view>
  27. <wd-checkbox-group
  28. v-model="checkedAll"
  29. inline
  30. size="large"
  31. shape="square"
  32. @change="handleChange"
  33. >
  34. <wd-checkbox
  35. :modelValue="item.familyUserId"
  36. v-for="item in userList"
  37. :key="item.familyUserId"
  38. >{{ item.familyUserName }}</wd-checkbox
  39. >
  40. </wd-checkbox-group>
  41. <view
  42. class="mt24rpx border border-gray border-solid rounded-xl overflow-hidden"
  43. >
  44. <wd-textarea
  45. v-model="postponeReason"
  46. placeholder="请填写延课原因"
  47. border
  48. />
  49. </view>
  50. </view>
  51. <WdButton block size="large" @click="handleSubmit">提交</WdButton>
  52. </view>
  53. </template>
  54. <script setup lang="ts">
  55. import router from "@/router";
  56. const isCheckAll = ref(false);
  57. const MakeUpClassId = ref<string>("");
  58. const checkedAll = ref<string[]>([]);
  59. const postponeReason = ref("");
  60. const priceRulesId = ref();
  61. const { send: getUserList, data: userList } = useRequest(
  62. (coursePriceRulesId) =>
  63. Apis.app.getClassPostponeUsers({ params: { coursePriceRulesId } }),
  64. { immediate: false },
  65. );
  66. const { data, send: getData } = useRequest(
  67. (id: string, coursesType: number) =>
  68. Apis.app.queryListByCoursesId({
  69. params: { coursesType, id },
  70. }),
  71. {
  72. immediate: false,
  73. },
  74. );
  75. const { send: submit } = useRequest(
  76. (data) =>
  77. Apis.app.classPostpone({
  78. data,
  79. }),
  80. {
  81. immediate: false,
  82. },
  83. );
  84. onLoad(async (query: any) => {
  85. priceRulesId.value = query.id;
  86. await getUserList(query.id);
  87. await getData(query.coursesId, 1);
  88. });
  89. function handleChange({ value }: any) {
  90. if (value.length == userList.value.length) {
  91. isCheckAll.value = true;
  92. } else {
  93. isCheckAll.value = false;
  94. }
  95. }
  96. function handleCheckAllChange() {
  97. if (isCheckAll.value) {
  98. checkedAll.value = userList.value.map((it) => it.familyUserId) as string[];
  99. } else {
  100. checkedAll.value = [];
  101. }
  102. }
  103. async function handleSubmit() {
  104. if (!MakeUpClassId.value)
  105. return uni.showToast({ title: "请选择补课课时", icon: "none" });
  106. if (checkedAll.value.length == 0)
  107. return uni.showToast({ title: "请选择补课学生", icon: "none" });
  108. if (!postponeReason.value)
  109. return uni.showToast({ title: "请填写延课原因", icon: "none" });
  110. await submit({
  111. coursePriceRulesId: MakeUpClassId.value,
  112. postponeReason: postponeReason.value,
  113. priceRulesId: priceRulesId.value,
  114. familyUserVOList: checkedAll.value.map((item) => {
  115. return {
  116. familyUserId: item,
  117. };
  118. }),
  119. });
  120. router.back();
  121. console.log(MakeUpClassId.value, "补课课时");
  122. }
  123. </script>
  124. <style scoped>
  125. :deep(.wd-select-picker__cell) {
  126. padding: 0 !important;
  127. }
  128. </style>
  129. <route lang="json">
  130. {
  131. "name": "ExtensionClass",
  132. "style": {
  133. "navigationBarTitleText": "填写延期信息",
  134. "disableScroll": true
  135. }
  136. }
  137. </route>