Browse Source

收银端输入手机号,回显姓名与身份证号

lsp 4 years ago
parent
commit
09197fd144

+ 5 - 5
kmall-admin/src/main/webapp/WEB-INF/page/sale/sale.html

@@ -152,17 +152,17 @@
                                     <div class="modal-body">
                                         <form>
                                             <div class="form-group">
+                                                <label for="customPhone" class="control-label">手机号:</label>
+                                                <input type="text" class="form-control" ref="customPhone" id="customPhone" @blur="customPhoneBlur" />
+                                            </div>
+                                            <div class="form-group">
                                                 <label for="customName" class="control-label">姓名:</label>
-                                                <input type="text" class="form-control"  ref="customName"  id="customName">
+                                                <input type="text" class="form-control"  ref="customName"  id="customName" />
                                             </div>
                                             <div class="form-group">
                                                 <label for="customIDCard" class="control-label">身份证:</label>
                                                 <input type="text" class="form-control"  ref="customIDCard"  id="customIDCard" />
                                             </div>
-                                            <div class="form-group">
-                                                <label for="customPhone" class="control-label">手机号:</label>
-                                                <input type="text" class="form-control" ref="customPhone" id="customPhone" />
-                                            </div>
                                             <div v-if="coupons.size > 0" class="form-group">
                                                 <label for="couponSn" class="control-label">优惠券码:</label>
                                                 <input type="text" class="form-control" ref="couponSn" id="couponSn" />

+ 20 - 0
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -301,6 +301,8 @@ let vm = new Vue({
         goodsList:[],
         orderInfo:[],
         userInfo:{},
+        //user信息绑定集合
+        userInfoBinding: {},
         sysUserInfo:{},
         storeName:null,
         prodBarcode:null,
@@ -608,6 +610,19 @@ let vm = new Vue({
             });
 
         },
+        customPhoneBlur:function (){
+            let customPhone = this.$refs.customPhone.value;
+            if(customPhone){
+                for(let key in this.userInfoBinding){
+                    if(customPhone == key){
+                        let userInfoBindingValue = this.userInfoBinding[key];
+                        this.$refs.customName.value = userInfoBindingValue.substring(0, userInfoBindingValue.length-18);
+                        this.$refs.customIDCard.value = userInfoBindingValue.substring(userInfoBindingValue.length-18);
+                        break;
+                    }
+                }
+            }
+        },
         submitCustomInfo:function(){
             this.userInfo.customName = this.$refs.customName.value ;
             this.userInfo.customIDCard =  this.$refs.customIDCard.value ;
@@ -629,6 +644,11 @@ let vm = new Vue({
                 return ;
             }
 
+            //将手机号与姓名身份证号进行绑定,下次填写手机号即可
+            let userInfoBindingKey = this.userInfo.customPhone;
+            let userInfoBindingValue = this.userInfo.customName+this.userInfo.customIDCard;
+            this.userInfoBinding[userInfoBindingKey] = userInfoBindingValue;
+
             if(this.userInfo.couponSn){
                 var coupon = vm.coupons.get(this.userInfo.couponSn);
                 if(coupon == null){