소스 검색

新增上传小票禁用限制

15102826049 1 개월 전
부모
커밋
c5db2a9537
4개의 변경된 파일78개의 추가작업 그리고 23개의 파일을 삭제
  1. 2 2
      .env.development
  2. 33 16
      src/pagesOne/winner/components/uploadReceptPopop.vue
  3. 42 5
      src/pagesOne/winner/index.vue
  4. 1 0
      src/pagesOne/winner/utils/interface.ts

+ 2 - 2
.env.development

@@ -10,5 +10,5 @@ VITE_APP_BASE_API = ''
 # 路由懒加载
 VITE_CLI_BABEL_TRANSPILE_MODULES = true
 
-# VITE_API_URL=http://192.168.168.71:8080
-VITE_API_URL=https://test-coupon.qiuyutech.com.cn/stage-api
+VITE_API_URL=http://192.168.168.104:8090
+# VITE_API_URL=https://test-coupon.qiuyutech.com.cn/stage-api

+ 33 - 16
src/pagesOne/winner/components/uploadReceptPopop.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="uploadReceptPopup">
+  <view v-if="props.show" class="uploadReceptPopup">
     <wd-popup
       v-model="props.show"
       position="bottom"
@@ -13,7 +13,7 @@
       </view>
       <radio-group class="receptBox" @change="radioChange">
         <label
-          v-for="item in props.list"
+          v-for="item in receptList"
           :key="item.id"
           class="radioItem"
           :class="item.checked ? 'active' : 'static'"
@@ -30,6 +30,7 @@
             :value="item.id"
             style="transform: scale(0.9)"
             :checked="item.checked"
+            :disabled="item.disabled"
           />
         </label>
       </radio-group>
@@ -47,7 +48,7 @@
 </template>
 
 <script lang="ts" setup>
-import { reactive, ref } from "vue";
+import { reactive, ref, watch } from "vue";
 import { imgObj } from "../utils/source";
 import { useDraw } from "@/hooks/useDraw";
 import { receptProp } from "../utils/interface";
@@ -68,6 +69,16 @@ const openid = uni.getStorageSync("openid");
 const emit = defineEmits(["update:show"]);
 const value = ref("1");
 
+let receptList: any = ref([]);
+
+watch(
+  () => props.list,
+  (newVal) => {
+    receptList.value = newVal;
+  },
+  { deep: true, immediate: true }
+);
+
 const toUploadImage = (type: string) => {
   if (!discountId.value) {
     uni.showToast({
@@ -88,21 +99,25 @@ const toUploadImage = (type: string) => {
           url: `/pagesOne/winner/uploadImage?discountId=${discountId.value}&discountLevel=${discountLevel.value}`,
         });
         return;
+      } else {
+        uni.showModal({
+          title: "提示",
+          content: res.message || "",
+          showCancel: false, // 如果只需要确定按钮,可以隐藏取消按钮
+        });
+
+        for (let i of receptList.value) {
+          if (i.id === discountId.value) {
+            i.disabled = true;
+          }
+        }
       }
-      uni.showModal({
-        title: "提示",
-        content: res.message || "",
-        showCancel: false, // 如果只需要确定按钮,可以隐藏取消按钮
-      });
-      // uni.showToast({
-      //   title: res.message || "",
-      //   icon: "none",
-      // });
     })
     .catch((err) => {
-      uni.showToast({
-        title: err.msg,
-        icon: "none",
+      uni.showModal({
+        title: "提示",
+        content: err.message || "网络异常,请稍后再试",
+        showCancel: false,
       });
     });
 
@@ -114,7 +129,9 @@ const discountLevel = ref<string>("");
 
 const radioChange = (e: any) => {
   discountId.value = e.detail.value;
-  const obj = props.list!.filter((item) => item.id === e.detail.value)[0];
+  const obj = receptList.value.filter(
+    (item: any) => item.id === e.detail.value
+  )[0];
   discountLevel.value = `满${obj.thresholdAmount}返${obj.cashbackAmount}`;
 };
 

+ 42 - 5
src/pagesOne/winner/index.vue

@@ -92,7 +92,7 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref, computed } from "vue";
+import { reactive, ref, computed, watch } from "vue";
 import { onLoad, onShow } from "@dcloudio/uni-app";
 import { getStatusBarHeight, getNavBarPaddingTop } from "@/utils/system";
 
@@ -102,7 +102,12 @@ import UploadReceptPopop from "./components/uploadReceptPopop.vue";
 import WinRecordPopup from "./components/winRecordPopup.vue";
 import UploadRecordPopup from "./components/uploadRecordPopup.vue";
 import ActivityDescPopup from "./components/activityDescPopup.vue";
-import { getActivity, rewardList, auditSuccessList } from "@/services/ams";
+import {
+  getActivity,
+  rewardList,
+  auditSuccessList,
+  validate,
+} from "@/services/ams";
 import { receptProp } from "./utils/interface";
 let showExample = ref<boolean>(false);
 let showUpload = ref<boolean>(false);
@@ -142,6 +147,7 @@ const getList = () => {
         return {
           ...item,
           checked: false,
+          disabled: false,
         };
       });
 
@@ -214,12 +220,41 @@ const onBack = () => {
   uni.navigateBack({ delta: 1 });
 };
 
-const handledUpload = () => {
+const onValidate = async () => {
+  const params = {
+    openid,
+    marketingActivityId: aData.id,
+    discountId: "",
+  };
+  const res: any = await validate(params);
+  try {
+    if (res.valid) {
+      // showUpload.value = true;
+      return true;
+    }
+    uni.showModal({
+      title: "提示",
+      content: res.message || "",
+      showCancel: false,
+    });
+    return false;
+  } catch (err: any) {
+    uni.showModal({
+      title: "提示",
+      content: err.message || "网络异常,请稍后再试",
+      showCancel: false,
+    });
+    return false;
+  }
+};
+const handledUpload = async () => {
   if (!aData.authCheck.includes("2")) {
     showUpload.value = true;
 
     return;
   }
+  const m = await onValidate();
+  if (!m) return;
   // const location = uni.getStorageSync("location") ? JSON.parse(uni.getStorageSync("location")) : {};
 
   // if (!aData.authCheck.includes("2") || location.latitude) {
@@ -233,6 +268,8 @@ const handledUpload = () => {
         uni.authorize({
           scope: "scope.userLocation",
           success() {
+            showUpload.value = true;
+
             // 用户同意授权
           },
           fail() {
@@ -267,7 +304,6 @@ const handledUpload = () => {
               title: "请勿频繁调用!",
               icon: "none",
             });
-            console.log("失败", error);
           },
         });
       }
@@ -276,12 +312,13 @@ const handledUpload = () => {
 };
 
 onShow(() => {
-  getList();
+  // getList();
 });
 const navTop = ref<number>(0);
 
 onLoad(() => {
   // navTop.value = getNavTop();
+  getList();
 });
 </script>
 

+ 1 - 0
src/pagesOne/winner/utils/interface.ts

@@ -9,4 +9,5 @@ export interface receptProp {
   thresholdAmount: number;
   updateTime: string;
   checked: boolean;
+  disabled: boolean;
 }