xiaohaizhao 5 dni temu
rodzic
commit
3909d722b9

+ 26 - 7
components/My-shade/My-shade.vue

@@ -17,20 +17,33 @@
 </template>
 
 <script setup>
-import { onShow } from '@dcloudio/uni-app';
+import { onShow, onHide } from '@dcloudio/uni-app';
 import { ref, getCurrentInstance } from 'vue'
 const { $Http } = getCurrentInstance().proxy;
 
 let show = ref(false);
+let checkTimer = null;
+
+function checkIsLoad() {
+    show.value = !$Http.isLoad;
+    // 如果还未登录,持续轮询检查,直到 isLoad 变为 true
+    if (!$Http.isLoad) {
+        checkTimer = setTimeout(checkIsLoad, 500);
+    }
+}
+
 onShow(() => {
-    setTimeout(() => {
-        show.value = !$Http.isLoad;
-        if (!$Http.isLoad) setTimeout(() => show.value = !$Http.isLoad, 800);
-    });
+    checkIsLoad();
+});
+
+onHide(() => {
+    if (checkTimer) {
+        clearTimeout(checkTimer);
+        checkTimer = null;
+    }
 });
 
 function handleClick() {
-    return toLogin()
     uni.showModal({
         title: '提示',
         content: '当前页面需要登录才能继续使用',
@@ -43,7 +56,13 @@ function handleClick() {
 
 function toLogin() {
     try {
-        window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxffbbc08445f46409&redirect_uri=https://crm.meida.com/relay.html&response_type=code&scope=snsapi_userinfo&state=getcode#wechat_redirect`
+        // 测试环境跳过微信授权,直接跳登录页
+        const isTestEnv = window.location.href.includes('61.164.207.46:8300');
+        if (isTestEnv) {
+            uni.navigateTo({ url: '/pages/login/login' });
+        } else {
+            window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxffbbc08445f46409&redirect_uri=https://crm.meida.com/relay.html&response_type=code&scope=snsapi_userinfo&state=getcode#wechat_redirect`
+        }
     } catch (error) {
         wx.navigateTo({
           url: '/pages/login/login',

+ 13 - 7
pages/login/login.vue

@@ -48,14 +48,20 @@ onLoad(() => {
     const storedPhone = uni.getStorageSync('phonenumber');
     //网页链接中会有一个code的参数
     try {
-        let code = window.location.href.split('code=')[1]?.split('&')[0];
-        if (code) {
-            wxCode = code;
-            timedRefresh = setInterval(() => {
-                window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxffbbc08445f46409&redirect_uri=https://crm.meida.com/relay.html&response_type=code&scope=snsapi_userinfo&state=getcode#wechat_redirect`
-            }, 270000);
+        // 测试环境跳过微信授权
+        const isTestEnv = window.location.href.includes('61.164.207.46:8300');
+        if (isTestEnv) {
+            // 测试服务器不需要微信code
         } else {
-            window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxffbbc08445f46409&redirect_uri=https://crm.meida.com/relay.html&response_type=code&scope=snsapi_userinfo&state=getcode#wechat_redirect`
+            let code = window.location.href.split('code=')[1]?.split('&')[0];
+            if (code) {
+                wxCode = code;
+                timedRefresh = setInterval(() => {
+                    window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxffbbc08445f46409&redirect_uri=https://crm.meida.com/relay.html&response_type=code&scope=snsapi_userinfo&state=getcode#wechat_redirect`
+                }, 270000);
+            } else {
+                window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxffbbc08445f46409&redirect_uri=https://crm.meida.com/relay.html&response_type=code&scope=snsapi_userinfo&state=getcode#wechat_redirect`
+            }
         }
     } catch (error) {
 

+ 31 - 0
pages/serviceSeeking/detail.vue

@@ -110,10 +110,32 @@
                     <view class="value">{{ detail.serviceenterprisename || '--' }}
                     </view>
                 </view>
+                <view class="row" v-if="detail.aftersalesphonenumber" style="align-items: center;">
+                    <view class="label justify">售后电话</view>
+                    <view class="value phonenumber">
+                        <block>
+                            <text style="margin: 0 20rpx 0 10rpx;">
+                                {{ detail.aftersalesphonenumber }}
+                            </text>
+                            <My-button :customStyle="{
+                                width: '142rpx',
+                                height: '48rpx',
+                                'background-color': '#FFFFFF',
+                                'color': '#3874F6',
+                                borderRadius: '10rpx'
+                            }" :frontIconStyle="{
+                                marginRight: '6rpx',
+                            }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="detail.aftersalesphonenumber" />
+                        </block>
+                    </view>
+                </view>
                 <view class="row" v-if="detail.servicephonenumber" style="align-items: center;">
                     <view class="label justify">联系人</view>
                     <view class="value phonenumber">
                         <block>
+                            <text v-if="detail.servicecontactname" style="margin-right: 10rpx;">
+                                {{ detail.servicecontactname }}
+                            </text>
                             <text style="margin: 0 20rpx 0 10rpx;">
                                 {{ detail.servicephonenumber }}
                             </text>
@@ -228,7 +250,16 @@ function getWorkorderDetail(sa_workorderid) {
         console.log("工单详情", res)
         if (res.code !== 1) return uni.showToast({ title: res.msg, icon: 'none' });
         time.value = new Date().getTime()
+        // 用服务团队第一个成员(服务师傅)的信息替换联系人
+        const firstMember = res.data.team && res.data.team.length > 0 ? res.data.team[0] : null;
+        if (firstMember) {
+            res.data.servicephonenumber = firstMember.phonenumber || '';
+            res.data.servicecontactname = firstMember.name || '';
+        }
+        // 保留服务申请单的预约单号,不被工单的billno覆盖
+        const serviceorderBillno = detail.billno;
         Object.assign(detail, res.data);
+        detail.billno = serviceorderBillno;
     })
 }
 

+ 0 - 16
pages/serviceSeeking/index.vue

@@ -25,22 +25,6 @@
                     {{ item.serviceenterprisename + ' ' + item.servicephonenumber }}
                 </view>
             </navigator>
-
-            <view class="but-box" @click="stopPropagation">
-                <view class="but-box-item" v-if="item.servicephonenumber">
-                    <My-button :customStyle="{
-                        'background-color': '#FFFFFF',
-                        'color': '#3874F6',
-                        height: '70rpx',
-                    }" frontIcon="icon-bodadianhua1" text="服务商电话" :phonenumber="item.servicephonenumber" />
-                </view>
-
-                <navigator :url="'/pages/serviceSeeking/detail?id=' + item.sa_serviceorderid" class="but-box-item">
-                    <My-button :customStyle="{
-                        height: '70rpx',
-                    }" frontIcon="icon-jiedan" text="查询" />
-                </navigator>
-            </view>
         </view>
     </My_listbox>
 </template>