Browse Source

feat(KIP-6765): 小程序临停缴费功能未登录身份使用流程

John-Hong 2 years ago
parent
commit
dd3b6de26f

+ 4 - 0
src/common/js/config.js

@@ -47,6 +47,10 @@
 // Vue.prototype.$etcpAppInvoicePath = ETCP_APP_INVOICE_PATH;
 // Vue.prototype.$etcpAppInvoicePath = ETCP_APP_INVOICE_PATH;
 
 
 
 
+// export const
+// this.groupId = '8a8485497c9cafbc017c9cb90b9d0000';
+// this.mallId = '8a84854a7cfd947d017d02861a9d0002';
+
 export const KIP_API_CODE = {
 export const KIP_API_CODE = {
     TOKEN_EXPIRED: '300000',
     TOKEN_EXPIRED: '300000',
     REFRESH_TOKEN_EXPIRED: '300001',
     REFRESH_TOKEN_EXPIRED: '300001',

+ 2 - 1
src/constants.js

@@ -3,7 +3,8 @@
 // 嘉里link:CRM小程序
 // 嘉里link:CRM小程序
 // const APPID = 'wxd830fe4d1e04988e'
 // const APPID = 'wxd830fe4d1e04988e'
 // console.log('uni:::::', uni)
 // console.log('uni:::::', uni)
-const APPID = 'wxd830fe4d1e04988e' // uni.getAccountInfoSync().miniProgram.appId;
+// const APPID = 'wxd830fe4d1e04988e' // uni.getAccountInfoSync().miniProgram.appId;
+const APPID = 'wx907c27f16841a919' // uni.getAccountInfoSync().miniProgram.appId;
 // const APPID = 'wx2a1741f02f7bb650';
 // const APPID = 'wx2a1741f02f7bb650';
 
 
 const APPID_MAP = {
 const APPID_MAP = {

+ 48 - 0
src/pages/cryptojs/demo.vue

@@ -0,0 +1,48 @@
+<template>
+  <div>
+    <div @click="scanCode">扫码</div>
+  </div>
+</template>
+
+<script>
+import { getPlatform } from "@/utils";
+import { initWxJsSdkConfig } from '@/utils/login'
+
+export default {
+  created() {
+    // 初始化微信
+    initWxJsSdkConfig(['scanQRCode']);
+  },
+  methods: {
+    // 扫码
+    scanCode() {
+      const runScanFn = ( res ) => {
+        if ( res.scanType === 'QR_CODE' && res.scanType ) {
+          console.log(res.result);
+          const url = res.result;
+          if ( url.indexOf('auth/') === -1 ) {
+            this.getPaperCouponInfo(res.result);
+          } else {
+            const start = url.indexOf('auth/');
+            const end = url.indexOf('?');
+            const params = url.slice(start,end).split('/');
+            if ( params && params.length ) {
+              const couponCode = params[1];
+              this.getPaperCouponInfo(couponCode);
+            }
+          }
+        }
+      };
+      this.$wx.scanQRCode({
+        needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+        scanType: ['qrCode','barCode'], // 可以指定扫二维码还是一维码,默认二者都有
+        success: ( res ) => {
+          console.log(35,res);
+          runScanFn(res);
+          // this.formMsg.deviceCode = res.resultStr;
+        },
+      });
+    },
+  }
+}
+</script>

+ 1 - 3
src/pages/parkingFee/parkingFeeDetail.vue

@@ -325,7 +325,7 @@ export default {
     if (/index|home/.test(to.name)) {
     if (/index|home/.test(to.name)) {
       // 不在缓存列表中,从cachedViews缓存列表中移除
       // 不在缓存列表中,从cachedViews缓存列表中移除
       this.$store.commit('cachedViews/DEL_CACHED_VIEW', from);
       this.$store.commit('cachedViews/DEL_CACHED_VIEW', from);
-      
+
     }
     }
     next();
     next();
   },
   },
@@ -1600,8 +1600,6 @@ export default {
       //   path = 'api/1.0/park/dealParkOrderBj';
       //   path = 'api/1.0/park/dealParkOrderBj';
       // }
       // }
       this.$md(params);
       this.$md(params);
-      // console.log(165516551655, this.actualFee);
-      // console.log(1654, this.$baseURL + path);
       this.$request({
       this.$request({
         url: this.$baseURL + path,
         url: this.$baseURL + path,
         data: params,
         data: params,

+ 6 - 1
src/routes/index.js

@@ -12,7 +12,7 @@ const routes = [
     path: '/parkingFeeDetail',
     path: '/parkingFeeDetail',
     name: 'parkingFeeDetail',
     name: 'parkingFeeDetail',
     component: () => import('@/pages/parkingFee/parkingFeeDetail.vue'),
     component: () => import('@/pages/parkingFee/parkingFeeDetail.vue'),
-  }, 
+  },
   {
   {
     path: '/parkingFeeCoupon',
     path: '/parkingFeeCoupon',
     name: 'parkingFeeCoupon',
     name: 'parkingFeeCoupon',
@@ -121,6 +121,11 @@ const routes = [
     name: 'openWx',
     name: 'openWx',
     component: () => import('@/pages/login/openWx'),
     component: () => import('@/pages/login/openWx'),
   },
   },
+  {
+    path: '/dome',
+    name: 'dome',
+    component: () => import('@/pages/cryptojs/demo'),
+  },
   // { path: '/bar', component: 'Bar' }
   // { path: '/bar', component: 'Bar' }
 ];
 ];
 
 

+ 26 - 2
src/utils/index.js

@@ -42,7 +42,7 @@ export function getQueryParam() {
   return query;
   return query;
 }
 }
 
 
-// 
+//
 export function isInWeixinH5() {
 export function isInWeixinH5() {
   // TODO: 发布前取消注释
   // TODO: 发布前取消注释
   return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
   return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
@@ -64,9 +64,33 @@ export function getPlatform() {
   // TODO: 发布前取消注释
   // TODO: 发布前取消注释
   return 'browser'
   return 'browser'
 }
 }
+// 是否在微信小程序中运行
+export function getIsMin() {
+  const platform  = getPlatform();
+  return platform === 'miniprogram'
+}
+
+// 是否在微信公众号中运行
+export function getIsWxh5() {
+  const platform  = getPlatform();
+  return platform === 'micromessenger'
+}
+// 获取appid
+export function getAppid() {
+  const platform  = getPlatform();
+  if ( platform === 'miniprogram' ) {
+    // TODO: 后期在其他公众号上线H5应用,appid需要根据地址栏的 project 动态处理
+    return 'wx92c3e55fbef6b2af'
+  }
+  if ( platform === 'micromessenger' ) {
+    return 'wx907c27f16841a919'
+  }
+  return ''
+
+}
 
 
 export function getUrlParams(url = window.location.href) {
 export function getUrlParams(url = window.location.href) {
 const str = `${url}`.split('?')[1]
 const str = `${url}`.split('?')[1]
   if(!str) return {}
   if(!str) return {}
   return qs.parse(str);
   return qs.parse(str);
-}
+}