Browse Source

feat: leave-source同手机号逻辑调整

cuiyalong 4 ngày trước cách đây
mục cha
commit
9ce2afa8af

BIN
plugins/leave-source/src/assets/images/column-footer-bg.png


+ 7 - 2
plugins/leave-source/src/lib/mobile/components/InputPhone.vue

@@ -6,7 +6,12 @@ defineProps({
   }
 })
 
-const emit = defineEmits(['contact'])
+const emit = defineEmits(['contact', 'update:value'])
+
+function onInput(e) {
+  emit('update:value', e.target.value)
+}
+
 function contactMe() {
   emit('contact')
 }
@@ -25,10 +30,10 @@ export default {
       <input
         :value="initPhone"
         type="number"
-        readonly
         class="phone-input"
         oninput="if(value.length > 11) value = value.slice(0, 11)"
         placeholder=""
+        @input="onInput"
       >
     </div>
     <button class="app-bottom-button contact-me" @click="contactMe">

+ 4 - 5
plugins/leave-source/src/lib/mobile/components/content-card.vue

@@ -6,7 +6,7 @@
       :qr="qr"
       :platform="platform"
       :use-customer3="useCustomer3"
-      :is-current-phone="isCurrentPhone"
+      @update:userPhone="updateUserPhone"
       @contact="contactMe"
     />
     <FooterCard />
@@ -40,13 +40,12 @@ export default {
       type: Boolean,
       default: false,
     },
-    isCurrentPhone: {
-      type: Boolean,
-      default: false,
-    },
     platform: String,
   },
   methods: {
+    updateUserPhone(e) {
+      this.$emit('update:userPhone', e)
+    },
     contactMe() {
       this.$emit('contact')
     }

+ 4 - 5
plugins/leave-source/src/lib/mobile/components/content.vue

@@ -34,7 +34,7 @@
           <span v-else class="step-item-content">
             <span class="step-left-text">客服主动联系您:</span>
             <div class="step-right-content">
-              <InputPhone :init-phone="userPhone" @contact="contactMe" />
+              <InputPhone :init-phone="userPhone" @update:value="updateContactPhone" @contact="contactMe" />
             </div>
           </span>
         </div>
@@ -67,10 +67,6 @@ export default {
       type: String,
       default: ''
     },
-    isCurrentPhone: {
-      type: Boolean,
-      default: false,
-    },
     useCustomer3: {
       type: Boolean,
       default: false,
@@ -91,6 +87,9 @@ export default {
         this.callPhone(phone)
       }
     },
+    updateContactPhone(e) {
+      this.$emit('update:userPhone', e)
+    },
     callPhone(phone) {
       if (!phone)
         return console.error('手机号为空')

+ 12 - 0
plugins/leave-source/src/lib/mobile/components/footer.vue

@@ -67,6 +67,7 @@ export default {
       display: flex;
       justify-content: center;
       margin-bottom: 10px;
+      width: 50%;
     }
     .leave-common-footer-item-icon {
       img {
@@ -87,15 +88,26 @@ export default {
   }
 
   &.footer-column {
+    background: url(../../../assets/images/column-footer-bg.png) no-repeat;
     .leave-common-footer-content {
       align-items: center;
     }
+    .leave-common-footer-item {
+      &:nth-of-type(2n) {
+        padding-left: 4px;
+      }
+    }
     .leave-common-footer-item-title {
       display: flex;
       align-items: flex-start;
       flex-direction: column;
     }
+    .j-icon {
+      width: 24px;
+      height: 24px;
+    }
     .subtext {
+      margin-top: 6px;
       font-weight: 400;
     }
   }

+ 1 - 2
plugins/leave-source/src/lib/mobile/content-popup.vue

@@ -115,10 +115,9 @@ export default {
         <MobileContentCard
           :qr="configInfo.wxer"
           :phone="configInfo.phone"
-          :user-phone="configInfo.userPhone"
+          :user-phone.sync="configInfo.userPhone"
           :platform="platform"
           :use-customer3="useCustomer3"
-          :is-current-phone="configInfo.isCurrentPhone"
           @contact="contactMe"
         />
       </PopupLayout>

+ 0 - 3
plugins/leave-source/src/lib/pc/components/QrCode.vue

@@ -42,9 +42,6 @@ export default {
       }
     }
   },
-  mounted() {
-    console.log('this.wxer', this.wxer)
-  }
 }
 </script>
 

+ 0 - 8
plugins/leave-source/src/lib/pc/components/content-card.vue

@@ -66,14 +66,6 @@ export default {
     //   default: '联系专属客服,申请免费体验'
     // }
   },
-  watch: {
-    showText: {
-      handler(val) {
-        console.info(val, 'showText')
-      },
-      immediate: true
-    }
-  },
   mounted() {
     useContactMeLogic({ props: this.$props })
   },

+ 1 - 2
plugins/leave-source/src/lib/pc/content-dialog.vue

@@ -35,7 +35,7 @@ const props = defineProps({
 
 const {
   updateVisible,
-  close,
+  // close,
   visible,
   configInfo,
 } = usePreLeaveInfo({ props })
@@ -44,7 +44,6 @@ const config = {
   configInfo,
   props,
 }
-console.log('config', configInfo)
 const {
   confirmPhoneDialog,
   changePhoneDialog,

+ 6 - 3
plugins/leave-source/src/utils/hooks.js

@@ -39,8 +39,10 @@ export function usePreLeaveInfo(options = {}) {
     remark: '',
     wxer: '',
     phone: '', // 客服手机号
-    userPhone: '', // 用户留资手机号
-    isCurrentPhone: true,
+    userPhone: '', // 用户上次留资手机号
+    userPhoneBackup: '', // 用户上次留资手机号备份
+    loginPhone: '', // 用户登录手机号
+    isCurrentPhone: computed(() => configInfo.loginPhone && configInfo.userPhone === configInfo.loginPhone),
   })
 
   const source = computed(() => props.source)
@@ -64,7 +66,8 @@ export function usePreLeaveInfo(options = {}) {
       const r = await useLeaveInfoRequest({ source: val })
       if (r.info) {
         configInfo.userPhone = r.info.phone
-        configInfo.isCurrentPhone = r.info.isCurrentPhone
+        configInfo.userPhoneBackup = r.info.phone
+        configInfo.loginPhone = r.info.loginPhone
       }
     }
   })