Browse Source

完成图片信息返回上一步暂存

18838166547 1 year ago
parent
commit
1f425e534e

+ 63 - 0
app/home/controller/MemberAuth.php

@@ -81,6 +81,54 @@ class MemberAuth extends BaseMember
         return View::fetch($this->template_dir . 'index');
         return View::fetch($this->template_dir . 'index');
     }
     }
 
 
+    public function index2()
+    {
+        ds_json_encode(10001, lang('member_idcard_image2_require'));
+        $member_model = model('member');
+
+        if (request()->isPost()) {
+            $member_array = array();
+            $member_array['member_auth_state'] = 1;
+            $member_array['member_idcard'] = input('post.member_idcard');
+            $member_array['member_truename'] = input('post.member_truename');
+//            $member_validate = ds_validate('member');
+//            if (!$member_validate->scene('auth')->check($member_array)) {
+//                ds_json_encode(10001, $member_validate->getError());
+//            }
+            if (!$this->member_info['member_idcard_image2']) {
+                ds_json_encode(10001, lang('member_idcard_image2_require'));
+            }
+
+
+            $res = $this->getIdCardInfo($this->member_info);
+            if ($res['code'] == 200) {
+                $info = $res['data'];
+                if ($member_array['member_idcard'] != $info['idcard'] || $member_array['member_truename'] !== $info['name']) {
+                    ds_json_encode(10001,'您提交的身份信息或身份证照片未通过校验,请仔细核对后提交');
+                }
+            } else {
+                ds_json_encode(10001,$res['msg']);
+            }
+
+            $update = $member_model->editMember(array(array('member_id', '=', $this->member_info['member_id']), array('member_auth_state', 'in', array(0, 2))), $member_array, $this->member_info['member_id']);
+
+            $message = $update ? lang('ds_common_save_succ') : lang('ds_common_save_fail');
+
+            if ($update) {
+                ds_json_encode(10000, $message);
+            } else {
+                ds_json_encode(10001, $message);
+            }
+        }
+
+        View::assign('member_info', $this->member_info);
+        /* 设置买家当前菜单 */
+        $this->setMemberCurMenu('member_auth');
+        /* 设置买家当前栏目 */
+        $this->setMemberCurItem('index');
+        return View::fetch($this->template_dir . 'index');
+    }
+
     public function image_upload()
     public function image_upload()
     {
     {
         $file_name = input('param.id');
         $file_name = input('param.id');
@@ -106,6 +154,8 @@ class MemberAuth extends BaseMember
 
 
     public function image_upload2()
     public function image_upload2()
     {
     {
+        $memberId = session('member_id');
+        session('member_image_'.$memberId,'');
         $file_name = input('param.id');
         $file_name = input('param.id');
         if (!empty($_FILES[$file_name]['name'])) {
         if (!empty($_FILES[$file_name]['name'])) {
 
 
@@ -143,6 +193,19 @@ class MemberAuth extends BaseMember
         ds_json_encode(10000);
         ds_json_encode(10000);
     }
     }
 
 
+    public function image_drop2()
+    {
+        $memberId = session('member_id');
+
+        $data2 = session('member_image2_'.$memberId);
+        $data3 = session('member_image3_'.$memberId);
+
+        ds_json_encode(10000, '',
+            array('image2' =>get_member_idcard_image($data2['business_licence_number_electronic']),
+                  'image3'=>get_member_idcard_image($data3['business_author_letter']))
+        );
+    }
+
     /**
     /**
      * 用户中心右边,小导航
      * 用户中心右边,小导航
      *
      *

+ 16 - 2
app/home/controller/Sellerjoininc2c.php

@@ -2,8 +2,10 @@
 
 
 namespace app\home\controller;
 namespace app\home\controller;
 
 
+use app\common\model\Cache;
 use think\facade\View;
 use think\facade\View;
 use think\facade\Lang;
 use think\facade\Lang;
+use think\middleware\SessionInit;
 
 
 /**
 /**
  
  
@@ -121,6 +123,7 @@ class Sellerjoininc2c extends BaseMember
     public function step2()
     public function step2()
     {
     {
         if (request()->isPost()) {
         if (request()->isPost()) {
+
             $param = array();
             $param = array();
             $param['member_name'] = session('member_name');
             $param['member_name'] = session('member_name');
             $param['company_name'] = input('post.company_name');
             $param['company_name'] = input('post.company_name');
@@ -148,10 +151,21 @@ class Sellerjoininc2c extends BaseMember
             if ($res['code'] == 200) {
             if ($res['code'] == 200) {
                 $info = $res['data'];
                 $info = $res['data'];
                 if ($param['business_licence_number'] != $info['idcard'] || $param['contacts_name'] !== $info['name']) {
                 if ($param['business_licence_number'] != $info['idcard'] || $param['contacts_name'] !== $info['name']) {
-                    ds_json_encode(10001,'您提交的身份信息或身份证照片未通过校验,请仔细核对后提交');
+                    //缓存图片
+                    $memberId = session('member_id');
+                    session('member_image2_'.$memberId,$param);
+                    session('member_image3_'.$memberId,$param);
+//                    dd();
+
+                    $this->error('您提交的身份信息或身份证照片未通过校验,请仔细核对后提交');
+//                    ds_json_encode(10001, '您提交的身份信息或身份证照片未通过校验,请仔细核对后提交');
                 }
                 }
             } else {
             } else {
-                ds_json_encode(10001,$res['msg']);
+                $memberId = session('member_id');
+                session('member_image2_'.$memberId,$param);
+                session('member_image3_'.$memberId,$param);
+                $this->error($res['msg']);
+//                ds_json_encode(10001, $res['msg']);
             }
             }
 
 
             $storejoinin_model = model('storejoinin');
             $storejoinin_model = model('storejoinin');

+ 1 - 1
app/home/view/default/member/sellerjoinin/step1.html

@@ -345,7 +345,7 @@
             <th><i>*</i>企业授权书照片:</th>
             <th><i>*</i>企业授权书照片:</th>
             <td><input name="business_author_letter" type="file" class="w200" />
             <td><input name="business_author_letter" type="file" class="w200" />
                 <span class="block">{$Think.lang.upload_information2}</span>
                 <span class="block">{$Think.lang.upload_information2}</span>
-                <span><a style="color: #0a6dee" target="_blank" href="https://imgse.com/i/p9ynd6H">点击下载企业授权书模板</a></span>
+                <span><a style="color: #0a6dee" target="_blank" href="https://s1.ax1x.com/2023/05/12/p9ynd6H.png">点击下载企业授权书模板</a></span>
             </td>
             </td>
         </tr>
         </tr>
       </tbody>
       </tbody>

+ 94 - 50
app/home/view/default/member/sellerjoininc2c/step1.html

@@ -163,7 +163,7 @@
     })
     })
 </script>
 </script>
 <div class="breadcrumb"><span class="iconfont">&#xe6ff;</span><span><a href="">{$Think.lang.homepage}</a></span> <span class="arrow">></span> <span>{$Think.lang.merchant_entry_application}</span> </div>
 <div class="breadcrumb"><span class="iconfont">&#xe6ff;</span><span><a href="">{$Think.lang.homepage}</a></span> <span class="arrow">></span> <span>{$Think.lang.merchant_entry_application}</span> </div>
-<div class="main">
+<div class="main" >
     <div class="sidebar">
     <div class="sidebar">
         <div class="title">
         <div class="title">
             <h3>{$Think.lang.merchant_entry_application}</h3>
             <h3>{$Think.lang.merchant_entry_application}</h3>
@@ -349,6 +349,10 @@
                         {/if}
                         {/if}
                     </div>
                     </div>
                 </div>
                 </div>
+
+<!--                <img hidden id="a1" type="hidden" src="111">-->
+                <input type="hidden" id="a1" value="">
+<!--                <input type="hidden" id="bbb" value="">-->
                 <span class="w400">
                 <span class="w400">
                     <input type="text" style="width:0;opacity: 0" name="member_idcard_image3" id="member_idcard_image3"
                     <input type="text" style="width:0;opacity: 0" name="member_idcard_image3" id="member_idcard_image3"
                            value="{$member_info.member_idcard_image3}" {if in_array($member_info.member_auth_state,array(1,3))}disabled="" {/if}>
                            value="{$member_info.member_idcard_image3}" {if in_array($member_info.member_auth_state,array(1,3))}disabled="" {/if}>
@@ -392,6 +396,9 @@ $(document).ready(function(){
     });
     });
 
 
     $('#form_company_info').validate({
     $('#form_company_info').validate({
+        // submitHandler: function (form) {
+        //     ds_ajaxpost('form_company_info','url',"{:url('Sellerjoininc2c/step22')}");
+        // },
         errorPlacement: function(error, element){
         errorPlacement: function(error, element){
             element.nextAll('span').first().after(error);
             element.nextAll('span').first().after(error);
         },
         },
@@ -437,6 +444,9 @@ $(document).ready(function(){
             business_licence_start: {
             business_licence_start: {
                 required: true
                 required: true
             },
             },
+            member_idcard_image2: {
+                required:true
+            }
            
            
         },
         },
         messages : {
         messages : {
@@ -480,6 +490,9 @@ $(document).ready(function(){
             business_licence_start: {
             business_licence_start: {
                 required: '{$Think.lang.select_effective_date}'
                 required: '{$Think.lang.select_effective_date}'
             },
             },
+            member_idcard_image2 : {
+                required: '错误'
+            }
 
 
         }
         }
     });
     });
@@ -591,20 +604,23 @@ $(document).ready(function(){
         })
         })
     }
     }
     function dropImage(id){
     function dropImage(id){
-        var index=layer.confirm("{$Think.lang.ds_ensure_del}", {
-            btn: ['{$Think.lang.ds_ok}', '{$Think.lang.ds_cancel}'],
-            title: false,
-        }, function () {
-            layer.close(index)
-            $.getJSON('{:url('MemberAuth/image_drop')}',{file_name:id},function(res){
+            $.getJSON('{:url('MemberAuth/image_drop2')}',{file_name:id},function(res){
                 if(res.code!=10000){
                 if(res.code!=10000){
                     layer.alert(res.message);
                     layer.alert(res.message);
                 }else{
                 }else{
-                    $('#'+id).val('')
-                    $('#img_'+id+'_url').attr('src',"{$Think.BASE_SITE_ROOT}/static/home/images/"+id+".png")
+                    console.log(res)
+                    // $('#'+id).val('')
+                    // $('#img_'+id+'_url').attr('src',"{$Think.BASE_SITE_ROOT}/static/home/images/"+id+".png")
+                    if (res.result.image2 != '') {
+                        $('#img_member_idcard_image2_url').attr('src',res.result.image2)
+
+                    }
+                    if (res.result.image3 != '') {
+                        $('#img_member_idcard_image3_url').attr('src',res.result.image3)
+
+                    }
                 }
                 }
-            })
-        })
+            });
     }
     }
     function ajaxFileUpload(url, id)
     function ajaxFileUpload(url, id)
     {
     {
@@ -636,49 +652,77 @@ $(document).ready(function(){
     }
     }
     $(document).ready(function () {
     $(document).ready(function () {
         var url = '{:url("MemberAuth/image_upload2")}';
         var url = '{:url("MemberAuth/image_upload2")}';
+
         $('#form_company_info').find('input[type="file"]').unbind().change(function () {
         $('#form_company_info').find('input[type="file"]').unbind().change(function () {
             var id = $(this).attr('id');
             var id = $(this).attr('id');
+            // localstroage.setItem(id,url)
             ajaxFileUpload(url, id);
             ajaxFileUpload(url, id);
+            // alert($('#member_idcard_image3').val())
+
         });
         });
-        $('#form_company_info').validate({
-            submitHandler: function (form) {
-                ds_ajaxpost('member_form','url','{:url('MemberAuth/index')}');
-            },
-            rules: {
-                member_truename: {
-                    required: true
-                },
-                member_idcard: {
-                    required: true,
-                },
-                member_idcard_image1: {
-                    required: true,
-                },
-                member_idcard_image2: {
-                    required: true,
-                },
-                member_idcard_image3: {
-                    required: true,
-                },
-            },
-            messages: {
-                member_truename: {
-                    required: '{$Think.lang.member_truename_require}'
-                },
-                member_idcard: {
-                    required: '{$Think.lang.member_idcard_require}',
-                },
-                member_idcard_image1: {
-                    required: '{$Think.lang.member_idcard_image1_require}',
-                },
-                member_idcard_image2: {
-                    required: '{$Think.lang.member_idcard_image2_require}',
-                },
-                member_idcard_image3: {
-                    required: '{$Think.lang.member_idcard_image3_require}',
-                },
-            }
-        });
+        dropImage('member_idcard_image2')
+        // $('#member_idcard_image2').value='';
+        // console.log($('#member_idcard_image2'))
+        // console.log('111',window.location.host)
+        // $('#img_member_idcard_image2_url').attr('src',"{get_member_idcard_image('"+$('#member_idcard_image2').val()+"')");
+        // $('#img_member_idcard_image3_url').attr('src',"http://"+window.location.host+"/uploads/home/idcard_image/"+$('#member_idcard_image3').val());
+        // console.log(document.getElementById('member_idcard_image2'))
+        // console.log('adasdsd')
+
+        // alert($("input[name='business_licence_number']").val())
+        // alert($('#member_idcard_image3').val())
+        //去判断 图片有没有, 有的话 展示
+        // if ($('#member_idcard_image2_url').val().isEmpty) {
+        //     alert(1)
+        //     // $('#img_member_idcard_image2_url').attr('src',$('#member_idcard_image2_url').attr('src'))
+        // }
+        // if (!$('#member_idcard_image3_url').attr('src') !== undefined) {
+        //     alert($('#member_idcard_image3_url').attr('src'))
+        //     $('#img_member_idcard_image3_url').attr('src',$('#member_idcard_image3_url').attr('src'))
+        // }
+
+
+
+
+        // $('#form_company_info').validate({
+        //     submitHandler: function (form) {
+        //         ds_ajaxpost('member_form','url','{:url('MemberAuth/index')}');
+        //     },
+        //     rules: {
+        //         member_truename: {
+        //             required: true
+        //         },
+        //         member_idcard: {
+        //             required: true,
+        //         },
+        //         member_idcard_image1: {
+        //             required: true,
+        //         },
+        //         member_idcard_image2: {
+        //             required: true,
+        //         },
+        //         member_idcard_image3: {
+        //             required: true,
+        //         },
+        //     },
+        //     messages: {
+        //         member_truename: {
+        //             required: '{$Think.lang.member_truename_require}'
+        //         },
+        //         member_idcard: {
+        //             required: '{$Think.lang.member_idcard_require}',
+        //         },
+        //         member_idcard_image1: {
+        //             required: '{$Think.lang.member_idcard_image1_require}',
+        //         },
+        //         member_idcard_image2: {
+        //             required: '{$Think.lang.member_idcard_image2_require}',
+        //         },
+        //         member_idcard_image3: {
+        //             required: '{$Think.lang.member_idcard_image3_require}',
+        //         },
+        //     }
+        // });
 
 
     });
     });
 </script>
 </script>