Explorar el Código

修改小程序代码---税务报告逻辑

plg hace 4 meses
padre
commit
37a8871d8e

+ 102 - 0
src/components/ShuiWuAuth.vue

@@ -0,0 +1,102 @@
+<script setup lang="ts">
+import { onLoad, onShow } from "@dcloudio/uni-app";
+import { ref, reactive } from "vue";
+
+const inputDialog = ref<any>(false);
+
+const dialogInputConfirm = () => {
+  //判断单位是否为空
+  uni.navigateTo({ url: "/pages/login/login?id=1231" });
+};
+
+//打开输入税号的弹出框
+const openSH = () => {
+  inputDialog.value.open("center");
+};
+
+//关闭税务弹出框
+const closeSW = () => {
+  inputDialog.value.close();
+};
+
+const next_step = () => {
+  //跳转到首页
+  uni.switchTab({ url: "/pages/index/index" });
+};
+
+//导出方法专供父组件调用
+defineExpose({ openSH });
+</script>
+<template>
+  <view>
+    <view>
+      <!-- 输入框示例 -->
+      <uni-popup ref="inputDialog" type="dialog" :mask-click="false">
+        <view class="form_out">
+          <view class="form_title">提示</view>
+
+          <view class="form_tip"
+            >我们将对你企业基本信息、申报信息、征收信息等数据进行采集。</view
+          >
+          <view>成功了 </view>
+          <view class="form_wu"
+            >您好,税务授权登录已完成,请勿在3天内登录税务局系统!</view
+          >
+          <view class="form_button_out"
+            ><button class="form_button" @click="next_step">下一步</button></view
+          >
+        </view>
+      </uni-popup>
+    </view>
+  </view>
+</template>
+<style lang="scss" scoped>
+.form_out {
+  // padding: 0rpx 20rpx;
+  width: 90%;
+  margin-left: 5%;
+  background-color: rgb(255, 255, 255);
+  display: flex;
+  align-items: center;
+  flex-direction: column;
+  border-radius: 20rpx;
+  .form_title {
+    // border-radius: 20rpx;
+    border-top-left-radius: 20rpx;
+    border-top-right-radius: 20rpx;
+    padding: 30rpx 0rpx;
+    font-size: 40rpx;
+    background-color: #eceaea;
+
+    width: 100%;
+    text-align: center;
+  }
+  .form_tip {
+    padding: 20rpx;
+    text-align: center;
+    width: 70%;
+    background-color: rgb(164, 215, 247);
+    border: #3785ec solid 1rpx;
+    margin-top: 40rpx;
+    font-size: 35rpx;
+    color: #0a7baf;
+    margin-bottom: 40rpx;
+  }
+  .form_wu {
+    padding: 0rpx 40rpx;
+    color: #000000;
+    opacity: 0.4;
+    margin-top: 30rpx;
+    margin-bottom: 40rpx;
+  }
+  .form_button_out {
+    margin-bottom: 60rpx;
+    width: 90%;
+    button {
+      width: 100%;
+      background: linear-gradient(#4a5fd6, #4b6bf8) !important;
+      color: #ffffff;
+    }
+  }
+}
+</style>

+ 109 - 0
src/components/ShuiWuSH.vue

@@ -0,0 +1,109 @@
+<script setup lang="ts">
+import { ref, reactive } from "vue";
+
+const inputDialog = ref<any>(false);
+
+//表单所用到的数据绑定
+//公司名称
+const name = ref<string>("");
+//税务编号
+const swNum = ref<string>("");
+//测试类型--渠道测试的话值为1
+//--个人测试的话值为2
+const type = ref<string>("1");
+const dialogInputConfirm = () => {
+  //判断单位是否为空
+  if (name.value == "") {
+    uni.showToast({
+      title: "单位不能为空",
+      icon: "none",
+    });
+    return;
+  }
+  //判断单位税号是不是为空
+  if (swNum.value == "") {
+    uni.showToast({
+      title: "税号不能为空",
+      icon: "none",
+    });
+    return;
+  }
+  //如果都填写了则判断跳转到另一个页面
+  inputDialog.value.close();
+  //跳转到页面  输入信息去查询页面
+  //需要跳转到信息输入界面
+  uni.navigateTo({
+    url: `/pages/login/login?name=${name.value}&swNum=${swNum.value}&type=${type.value}`,
+  });
+};
+
+//打开输入税号的弹出框
+const openSH = () => {
+  name.value = "";
+  swNum.value = "";
+  inputDialog.value.open("center");
+};
+
+//关闭税务弹出框
+const closeSW = () => {
+  inputDialog.value.close();
+};
+
+//导出方法专供父组件调用
+defineExpose({ openSH });
+</script>
+<template>
+  <view>
+    <view>
+      <!-- 输入框示例 -->
+      <uni-popup ref="inputDialog" type="dialog" :mask-click="false">
+        <uni-popup-dialog
+          :before-close="false"
+          ref="inputClose"
+          mode="input"
+          title="输入内容"
+          value="对话框预置提示内容!"
+          placeholder="请输入内容"
+          @close="closeSW"
+          @confirm="dialogInputConfirm"
+        >
+          <view class="form_out">
+            <view class="form_out_name">
+              <uni-easyinput
+                v-model="name"
+                :clearable="false"
+                type="text"
+                style="margin-bottom: 30rpx"
+                placeholder="请输入检测单位名称"
+            /></view>
+            <view>
+              <uni-easyinput
+                v-model="swNum"
+                :clearable="false"
+                type="text"
+                placeholder="请输入检测单位的税号"
+              />
+            </view>
+            <view class="form_tip"
+              >请检查税号是否正确,输入错误无法获取报告请联系客服</view
+            >
+          </view>
+        </uni-popup-dialog>
+      </uni-popup>
+    </view>
+  </view>
+</template>
+<style lang="scss" scoped>
+.form_out {
+  width: 100%;
+  .form_out_name {
+    margin-bottom: 20rpx;
+  }
+  .form_tip {
+    margin-top: 10rpx;
+    font-size: 20rpx;
+    color: #000000;
+    opacity: 0.4;
+  }
+}
+</style>

+ 10 - 2
src/pages.json

@@ -28,6 +28,15 @@
       }
 
     },
+    // {
+
+    //   "path": "pages/index/inviteUser",
+    //   "style": {
+    //     "navigationBarTitleText": "信息填写",
+    //     // "navigationStyle": "custom"
+    //   }
+
+    // },
     {
       "path": "pages/index/pay",
       "style": {
@@ -76,8 +85,7 @@
     {
       "path": "pages/login/login",
       "style": {
-        "navigationBarTitleText": "登录"
-      }
+        "navigationBarTitleText": "锦泓征信"      }
     }
   ],
   "globalStyle": {

+ 10 - 2
src/pages/index/components/HomeTabs.vue

@@ -1,7 +1,8 @@
 <script setup lang="ts">
 import { useMemberStore } from "@/stores";
 const userInfo = useMemberStore();
-const emit = defineEmits(["jumpInvite"]);
+//父组件调用父组件
+const emit = defineEmits(["jumpInvite", "jumpSW"]);
 const inviteUserFun = () => {
   //判断是否是授权了
   //如果没有授权,点击按钮择跳转授权页面
@@ -12,12 +13,19 @@ const inviteUserFun = () => {
     uni.navigateTo({ url: "/pages/index/inviteUser" });
   }
 };
+
+//点击税务风险检测
+const swFun = () => {
+  emit("jumpSW");
+  //调用父组件方法--然后让父组件打开弹出框
+  //父组件打开弹出框后表单输入校验后将值传输到这个页面
+};
 </script>
 <template>
   <view class="home_top"> 税务风险检测 </view>
   <view class="home_tabs">
     <view class="user_use" @click="inviteUserFun">邀请用户使用</view>
-    <view class="risk_detection">税务风险检测</view>
+    <view class="risk_detection" @click="swFun">税务风险检测</view>
   </view>
 </template>
 <style lang="scss">

+ 16 - 3
src/pages/index/index.vue

@@ -4,6 +4,7 @@ import HomeList from "./components/HomeList.vue";
 import { ref, reactive, onMounted } from "vue";
 import { login } from "@/hooks/useIsLogin";
 import { onShow } from "@dcloudio/uni-app";
+import ShuiWuSH from "@/components/ShuiWuSH.vue";
 const companyName = ref<string>("");
 
 const phoneGet = ref<any>();
@@ -13,9 +14,14 @@ onMounted(() => {
 });
 onShow(() => {
   console.log("onshow");
-  login();
+  login().then((res) => {
+    //登录调用成功后
+    //判断是否授权了
+    //如果授权了则开始查询列表数据
+    //列表查出来后判断是都可以查看报告
+  });
 });
-//调用子组件
+//调用子组件---获取手机号授权
 const phoneGetFun = () => {
   phoneGet.value.open();
 };
@@ -25,17 +31,24 @@ const validFun = () => {
   //跳转到邀请用户页面
   // uni.navigateTo({ url: "/pages/index/inviteUser" });
 };
+
+//点击税务风险检测--弹出输入税务号的信息
+const swGet = ref<any>();
+const openSW = () => {
+  swGet.value.openSH();
+};
 </script>
 <template>
   <!-- 引入头部安全区域组件 -->
   <view class="home_padding">
     <ShuiWuTop />
-    <HomeTabs @jumpInvite="validFun" />
+    <HomeTabs @jumpInvite="validFun" @jumpSW="openSW" />
     <view class="list_search">
       <uni-easyinput type="text" v-model="companyName" placeholder="请输入公司名称" />
     </view>
     <HomeList class="home_list_com" />
     <ShuiWuGetPhone ref="phoneGet" />
+    <ShuiWuSH ref="swGet" />
   </view>
 </template>
 <style>

+ 1 - 1
src/pages/index/inviteUser.vue

@@ -209,7 +209,7 @@ const saveLocal = () => {
     </view>
   </view>
 </template>
-<style lang="scss">
+<style lang="scss" scoped>
 page {
   height: 100%;
 }

+ 33 - 7
src/pages/index/pay.vue

@@ -1,3 +1,4 @@
+<!-- eslint-disable no-prototype-builtins -->
 <script setup lang="ts">
 import { onLoad, onShow, onUnload } from "@dcloudio/uni-app";
 import { ref, reactive } from "vue";
@@ -45,7 +46,23 @@ onLoad((options) => {
   //获取的二维码中得到的参数信息
   // console.log(decodeURIComponent(options?.scene));
   // scene.value.scene = decodeURIComponent(options?.scene);
-  userInfo.saveScene(decodeURIComponent(options?.scene));
+  // userInfo.saveScene(decodeURIComponent(options?.scene));
+
+  //根据页面中的options 获取参数
+  //1判断是否含有这个参数
+
+  //2如果没有则是表明是从另一个页面进来的不是扫码进来的
+  //3则需要调用接口需要看到访问次数和过期时间
+  const option = options as any;
+  console.log(option.hasOwnProperty("scene"));
+  console.log(option.hasOwnProperty("id"));
+  if (option.hasOwnProperty("scene")) {
+    //
+    userInfo.saveScene(option.scene);
+  } else {
+    userInfo.saveScene("");
+    //获取参数接口
+  }
   //将scene存入缓存中
 
   // loginUser().then((res) => {
@@ -59,13 +76,22 @@ onShow(() => {
   //从缓存中取出信息
   //  scene.value.scene = decodeURIComponent(options?.scene);
   //将scene存入缓存中
+  //需要判断是否有scene
   scene.value.scene = userInfo.scene;
-  loginUser().then((res) => {
-    //这时已经有返回信息了且用户数据已经
-    scene.value.userId = res as string;
-    //获取到userId了
-    queryParams(scene.value);
-  });
+  debugger;
+  //不等于空的话就说明是从扫码进来的
+  //如果是空的话就是渠道点击进来的
+  if (scene.value.scene !== "") {
+    loginUser().then((res) => {
+      //这时已经有返回信息了且用户数据已经
+      scene.value.userId = res as string;
+      //获取到userId了
+      queryParams(scene.value);
+    });
+  } else {
+    //如果是渠道点击进来的
+    //则调用渠道接口//然后返回数据
+  }
 });
 
 //查询 根据唯一键值对

+ 188 - 6
src/pages/login/login.vue

@@ -1,11 +1,193 @@
 <script setup lang="ts">
-//
-</script>
+import { saveUserSWApi } from "@/services/home";
+import { onLoad } from "@dcloudio/uni-app";
+import { ref, reactive } from "vue";
+
+const auth_next = ref<any>();
+
+const current = ref<number>(0);
+//选中背景色
+const activeColor = ref<string>("#007aff");
+//分段器的类型
+const styleType = ref<string>("text");
+//分段器的标题
+const titleArr = ref<any>(["新版登录", "旧版登录"]);
+//点击分段器修改参数
+const onClickTitle = (e: any) => {
+  console.log(e.currentIndex);
+  current.value = e.currentIndex;
+};
+//纳税人识别号
+const swNum = ref<string>("sw00shjsa0fdjf12");
+//企业名称
+const name = ref<string>("xxxxx公司");
+//电子税务局账号
+const swAcount = ref<string>("");
+//电子税务局密码
+const swPas = ref<string>("");
+//类型输入的类型
+const type = ref<string>("");
+
+//表单所用到的数据绑定
+onLoad((options: any) => {
+  name.value = options.name;
+  swNum.value = options.swNum;
+  type.value = options.type;
+});
+//点击授权登录按钮
+const authorizedLogin = () => {
+  if (swAcount.value == "") {
+    uni.showToast({
+      title: "请输入账号",
+      icon: "none",
+    });
+    return;
+  }
+  if (swPas.value == "") {
+    uni.showToast({
+      title: "请输入密码",
+      icon: "none",
+    });
+    return;
+  }
+  //开始了
+  //弹出提示框显示5秒钟后
+  //然后提示报告已生成请查看
 
+  uni.showToast({ title: "正在生成中", icon: "none", mask: true });
+  setTimeout(() => {
+    //5秒钟后显示弹框
+
+    auth_next.value.openSH();
+    uni.hideToast();
+    //显示提示框
+
+    //弹出框里有下一步
+    //点击下一步跳转到主页面可以在列表中查看数据
+    //弹出提示框
+  }, 1000);
+};
+//保存用户的接口
+const saveUserSWFun = async (val: any) => {
+  const res = await saveUserSWApi(val);
+};
+</script>
 <template>
-  <view class="login">login</view>
+  <view class="login">
+    <view class="login_top">
+      <image
+        class="login_image"
+        mode="'scaleToFill'"
+        src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg"
+      ></image>
+    </view>
+    <view class="login_mid">
+      <view class="login_mid_inner"
+        ><view class="uni-padding-wrap uni-common-mt">
+          <uni-segmented-control
+            :current="current"
+            :values="titleArr"
+            :style-type="styleType"
+            :active-color="activeColor"
+            @clickItem="onClickTitle"
+          />
+        </view>
+        <view class="content">
+          <view v-if="current === 0">
+            <view class="content_info">
+              <view class="login_text">纳税人识别号</view>
+              <view>
+                <uni-easyinput
+                  :disabled="true"
+                  v-model="swNum"
+                  placeholder="请输入纳税人识别号"
+                ></uni-easyinput
+              ></view>
+            </view>
+            <view class="content_info">
+              <view class="login_text">企业名称</view>
+              <view>
+                <uni-easyinput
+                  :disabled="true"
+                  v-model="name"
+                  placeholder="请输入企业名称"
+                ></uni-easyinput
+              ></view>
+            </view>
+            <view class="content_info">
+              <view class="login_text">电子税务局账号</view>
+              <view>
+                <uni-easyinput
+                  :clearable="false"
+                  v-model="swAcount"
+                  placeholder="请输入电子税务局账号"
+                ></uni-easyinput
+              ></view>
+            </view>
+            <view class="content_info">
+              <view class="login_text">电子税务局密码</view>
+              <view>
+                <uni-easyinput
+                  :clearable="false"
+                  type="password"
+                  v-model="swPas"
+                  placeholder="请输入电子税务局密码"
+                ></uni-easyinput
+              ></view>
+            </view>
+            <view>
+              <button
+                @click="authorizedLogin"
+                size="default"
+                style="color: #ffffff; background: #302ebe; margin-top: 90rpx"
+                hover-class="is-hover"
+              >
+                授权登录
+              </button></view
+            >
+          </view>
+          <view v-if="current === 1"><text class="content-text">旧版登录</text></view>
+        </view></view
+      >
+    </view>
+  </view>
+  <ShuiWuAuth ref="auth_next" />
 </template>
-
-<style lang="scss">
-//
+<style lang="scss" scoped>
+.login {
+  .login_top {
+    .login_image {
+      width: 750rpx;
+      height: 300rpx;
+    }
+  }
+  .login_mid {
+    width: 750rpx;
+    padding: 0rpx 20rpx;
+    position: relative;
+    .login_mid_inner {
+      padding: 0px 20rpx;
+      width: 710rpx;
+      position: absolute;
+      padding-top: 40rpx;
+      border-radius: 40rpx;
+      background-color: #ffffff;
+      margin-top: -60rpx;
+      .content {
+        .login_text {
+          font-size: 30rpx;
+          color: #000000;
+          margin-bottom: 20rpx;
+          margin-top: 20rpx;
+        }
+        .content_info {
+          margin-top: 40rpx;
+        }
+        .content_button {
+          background: linear-gradient(#302ebe #110981);
+        }
+      }
+    }
+  }
+}
 </style>

+ 11 - 0
src/services/home.ts

@@ -29,6 +29,9 @@ const payAppointmentUrl = ''
 //订单号查询
 const queryOrderStatusUrl = ''
 
+//报错登录用户信息
+const saveUserSWUrl = ''
+
 export const getHomeApi = (distributionSite = 1) => {
   return http<TypeList[]>({
     method: 'GET',
@@ -116,3 +119,11 @@ export const queryOrderStatusApi = (val: any) => {
     data: { ...val },
   })
 }
+//保存账号信息
+export const saveUserSWApi = (val: any) => {
+  return http<any>({
+    method: 'POST',
+    url: saveUserSWUrl,
+    data: { ...val },
+  })
+}