index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. :maxlength="20"
  48. border
  49. />
  50. </view>
  51. </view>
  52. <WdButton block size="large" @click="handleSubmit">提交</WdButton>
  53. </view>
  54. </template>
  55. <script setup lang="ts">
  56. import router from "@/router";
  57. const isCheckAll = ref(false);
  58. const MakeUpClassId = ref<string>("");
  59. const checkedAll = ref<string[]>([]);
  60. const postponeReason = ref("");
  61. const priceRulesId = ref();
  62. const { send: getUserList, data: userList } = useRequest(
  63. (coursePriceRulesId) =>
  64. Apis.app.getClassPostponeUsers({ params: { coursePriceRulesId } }),
  65. { immediate: false },
  66. );
  67. const { data, send: getData } = useRequest(
  68. (id: string, coursesType: number) =>
  69. Apis.app.queryListByCoursesId({
  70. params: { coursesType, id },
  71. }),
  72. {
  73. immediate: false,
  74. },
  75. );
  76. const { send: submit } = useRequest(
  77. (data) =>
  78. Apis.app.classPostpone({
  79. data,
  80. }),
  81. {
  82. immediate: false,
  83. },
  84. );
  85. onLoad(async (query: any) => {
  86. priceRulesId.value = query.id;
  87. await getUserList(query.id);
  88. await getData(query.coursesId, 1);
  89. });
  90. function handleChange({ value }: any) {
  91. if (value.length == userList.value.length) {
  92. isCheckAll.value = true;
  93. } else {
  94. isCheckAll.value = false;
  95. }
  96. }
  97. function handleCheckAllChange() {
  98. if (isCheckAll.value) {
  99. checkedAll.value = userList.value.map((it) => it.familyUserId) as string[];
  100. } else {
  101. checkedAll.value = [];
  102. }
  103. }
  104. async function handleSubmit() {
  105. if (!MakeUpClassId.value)
  106. return uni.showToast({ title: "请选择补课课时", icon: "none" });
  107. if (checkedAll.value.length == 0)
  108. return uni.showToast({ title: "请选择补课学生", icon: "none" });
  109. if (!postponeReason.value)
  110. return uni.showToast({ title: "请填写延课原因", icon: "none" });
  111. await submit({
  112. coursePriceRulesId: MakeUpClassId.value,
  113. postponeReason: postponeReason.value,
  114. priceRulesId: priceRulesId.value,
  115. familyUserVOList: checkedAll.value.map((item) => {
  116. return {
  117. familyUserId: item,
  118. };
  119. }),
  120. });
  121. router.back();
  122. console.log(MakeUpClassId.value, "补课课时");
  123. }
  124. </script>
  125. <style scoped>
  126. :deep(.wd-select-picker__cell) {
  127. padding: 0 !important;
  128. }
  129. </style>
  130. <route lang="json">
  131. {
  132. "name": "ExtensionClass",
  133. "style": {
  134. "navigationBarTitleText": "填写延期信息",
  135. "disableScroll": true
  136. }
  137. }
  138. </route>