index.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="px32rpx py20rpx" v-if="data">
  3. <view class="text-28rpx">未核销<text class="text-#0074FF">{{ data.length }}</text>人</view>
  4. <view class="bg-white rounded-32rpx flex items-center justify-between p24rpx box-border mt20rpx"
  5. v-for="(item, idx) in data" :key="item.id">
  6. <view class="font-semibold text-32rpx">{{ item.useUserName }}</view>
  7. <upload :disabled="false" @click="handleGoCamera(item)" :imgUrl="item.verifyImage" :key="item.id" :id="item.id">
  8. </upload>
  9. </view>
  10. <view class="h-180rpx"></view>
  11. </view>
  12. <fixdbtn block size="large" @click="handleSubmit" :loading="loading">提交</fixdbtn>
  13. </template>
  14. <script setup lang="ts">
  15. import type { AppCoursesVerificationRecord } from "@/api/globals";
  16. import router from "@/router";
  17. import upload from "@/subPack/EmployeeListAdd/components/CustomUpload/index.vue";
  18. const { dataId, img } = storeToRefs(useCameraStore());
  19. const { data, send: getList } = useRequest(
  20. (data) =>
  21. Apis.app.courseQueryUsers({
  22. data,
  23. }),
  24. { immediate: false },
  25. );
  26. const { send: setFormData, loading } = useRequest(
  27. (data) =>
  28. Apis.app.courseUploadImage({
  29. data,
  30. }),
  31. { immediate: false },
  32. );
  33. const coursePriceRulesId = ref();
  34. onLoad(async (query: any) => {
  35. coursePriceRulesId.value = query.id;
  36. await getList({ coursePriceRulesId: query.id, verifyStatus: 0 });
  37. });
  38. async function handleSubmit() {
  39. const form = data.value
  40. .map((it) => {
  41. return {
  42. id: it.useUserId,
  43. verifyImage: it.verifyImage,
  44. };
  45. })
  46. .filter((it) => it.verifyImage);
  47. if (!form.length)
  48. return uni.showToast({ title: "最少核销一个人", icon: "none" });
  49. const formData = {
  50. coursePriceRulesId: coursePriceRulesId.value,
  51. formList: form,
  52. };
  53. await setFormData(formData);
  54. uni.showToast({
  55. title: "拍照核销成功",
  56. icon: "success",
  57. duration: 2000,
  58. mask: true,
  59. });
  60. setTimeout(() => {
  61. router.back();
  62. }, 2000);
  63. }
  64. function handleGoCamera(item: AppCoursesVerificationRecord) {
  65. dataId.value = String(item.id);
  66. router.push({ name: "Camera" });
  67. }
  68. watch(
  69. () => img.value,
  70. () => {
  71. data.value = data.value.map((its) => {
  72. return {
  73. ...its,
  74. verifyImage: dataId.value == its.id ? img.value : its.verifyImage,
  75. };
  76. });
  77. },
  78. );
  79. </script>
  80. <style scoped></style>
  81. <route lang="json">{
  82. "name": "selectClass",
  83. "style": {
  84. "navigationBarTitleText": ""
  85. }
  86. }</route>