lvhao 3 месяцев назад
Родитель
Сommit
676ad5a1e7
2 измененных файлов с 59 добавлено и 32 удалено
  1. 57 30
      core/CoreApp/controllers/Fullorderabf.php
  2. 2 2
      template/erp/fullorderabf_yjtj.html

+ 57 - 30
core/CoreApp/controllers/Fullorderabf.php

@@ -10,6 +10,14 @@ class Fullorderabf extends Start_Controller {
     $this->load->_model('Model_shop','shop');
     $this->load->_model('Model_express','express');
 		$this->load->_model('Model_country','country');
+    $this->load->_model('Model_typeclass','typeclass');
+    $this->load->_model('Model_pay','pay');
+    $this->load->_model('Model_logic_order','logic_order');
+    $this->load->_model('Model_warehouse','warehouse');
+    $this->load->_model('Model_ck','ck');
+    $this->load->_model('Model_specialstock','specialstock');
+    $this->load->_model('Model_whlabel','whlabel');
+    $this->load->_model('Model_customer','customer');
   }
     //定义方法的调用规则 获取URI第二段值
   public function _remap($arg,$arg_array)
@@ -53,6 +61,48 @@ class Fullorderabf extends Start_Controller {
 				echo json_encode(array('msg'=>'需要先清理浏览器缓存,刷新当前页面后再试!','success'=>false));exit;
 			}
 			$customerid = $this->input->post('customerid',true);
+      if(empty($customerid)){
+        $tmp_email = $this->input->post('email',true);
+        $tmp_shop = $this->input->post('shop',true);
+        $customer = $this->customer->get_email($tmp_email,$tmp_shop);
+      }else{
+        $customer = $this->customer->read($customerid);
+      }
+
+      if(empty($customer)){
+          $str = $post['phone'];
+          preg_match_all('/[0-9]/u',$str,$result);
+          $numphone = join('',$result[0]);
+          $ct['shop'] = $post['shop'];
+          $ct['source'] = 10;
+          $ct['level'] = 5;
+          $ct['country'] = $post['country'];
+          $ct['time'] = time();
+          $ct['num'] = 1;
+          $ct['money'] = $post['shouldmoney'];
+          $ct['zipcode'] = $post['zipcode'];
+          $ct['name'] = $post['name'];
+          $ct['phone'] = $post['phone'];
+          $ct['numphone'] = $numphone;
+          $ct['email'] = preg_replace('/( | | |\s)+/','',$post['email']);
+          $ct['province'] = $post['province'];
+          $ct['city'] = $post['city'];
+          $ct['address'] = $post['address'];
+          $ct['zhcx'] = $post['shop'].'-'.$ct['email'];
+          $ct['is_tb'] = 0;
+          $this->customer->insert($ct);
+          $tmp_email = $this->input->post('email',true);
+          $tmp_shop = $this->input->post('shop',true);
+          $customer = $this->customer->get_email($tmp_email,$tmp_shop);
+          $customerid = $customer['id'];
+      }else{
+        $customerid = $customer['id'];
+      }
+      if(empty($customerid)){
+        echo json_encode(array('msg'=>'客户信息异常!','success'=>false));exit;
+      }
+      
+
 			$shop = $this->input->post('shop',true);
 			$sp = $this->shop->read($shop);
 			$num = $this->fullorder->find_count('shop = "'.$sp['id'].'" and gtime = "'.date('Ymd',time()).'"');
@@ -113,6 +163,7 @@ class Fullorderabf extends Start_Controller {
 			$post['freight'] = $this->input->post('freight',true);//运费
 			$post['expressmoney'] = $this->input->post('expressmoney',true);//物流金额
 			$post['shouldmoney'] = $this->input->post('shouldmoney',true);//应收金额
+      $post['shouldmoney'] = (float)$post['shouldmoney'];
 			$post['skje'] = $post['shouldmoney'];//收款金额
 			$product = $this->input->post('product');//产品名称
 			$product = str_replace(array('%26','%2B'),array('&','+'),$product);
@@ -155,34 +206,18 @@ class Fullorderabf extends Start_Controller {
 			$post['express'] = $this->input->post('express',true);//快递公司
 			$post['printtype'] = $this->input->post('printtype',true);//打印类型
 			$post['quantity'] = $this->input->post('quantity',true);//数量
-			$post['paypal'] = $this->input->post('paypal',true);//支付号
+			$post['paypal'] = $post['orderinfo'];//支付号
 			$post['guarantee'] = $this->input->post('guarantee',true);//卖家保障
 			$post['msg'] = $this->input->post('msg',true);//发送留言类型
 			$post['ioss'] = $this->input->post('ioss',true);
 			$post['sbpm'] = $this->input->post('sbpm',true);
+      $post['merge'] = $post['mergeid'] = 0;
 			$pay = $this->pay->get_typeclass($post['pay']);
 			$yga = $post['shouldmoney'];
 			$post['budget'] = 0;
-			if($pay)
-			{
-				$ygc = $pay['estimaterate'];//预估到账公式
-				$ifbudget = eval("return $yga*1.$ygc;");
-				$post['estimaterate'] = $pay['estimaterate'];
-				if($ifbudget > 0)
-				{
-				    $post['budget'] = eval("return $yga*1.$ygc;");//预估到帐金额
-				}
-			}
-			else
-			{
-				$ygb = $sp['estimaterate'];//店铺默认到账公式
-				$ifbudget = eval("return $yga*1.$ygb;");
-				$post['estimaterate'] = $sp['estimaterate'];
-				if($ifbudget > 0)
-				{
-		    	    $post['budget'] = eval("return $yga*1.$ygb;");//预估到帐金额
-				}
-			}
+      $post['estimaterate'] = 1;
+      $post['budget'] = $post['shouldmoney'];
+			
 			$baddress = $this->input->post('baddress',true);
 			$saddress = $this->input->post('saddress',true);
 			$baddress = array_reverse(explode(',',$baddress));
@@ -244,14 +279,6 @@ class Fullorderabf extends Start_Controller {
 			{
 				echo json_encode(array('msg'=>'非美国选择官方DHL必须选择Synthetic Hair Wigs/Synthetic Hair Goods','success'=>false));exit;
 			}
-			if($post['pay'] == '22' && ($post['paypal'] == '' || $post['guarantee'] == ''))
-			{
-				echo json_encode(array('msg'=>'交易号和卖家保障必须填写','success'=>false));exit;
-			}
-			if($post['pay'] == '23' && $post['paypal'] == '')
-			{
-				echo json_encode(array('msg'=>'交易号必须填写','success'=>false));exit;
-			}
 			if(empty($post['paypal'])){
 				echo json_encode(array('msg'=>'交易号必须填写','success'=>false));exit;
 			}
@@ -392,7 +419,7 @@ class Fullorderabf extends Start_Controller {
       "express"=>"14",
       "address"=>"建安区英豪路与滨河路交叉路口往东约50米路北 龙盈实业(客户自提)",
     ];
-    
+
 		$this->data['customer'] = $customer;
 		$country = $this->country->find_all('1=1','id,name','name asc');//国家
 		$this->data['country'] = $country;

+ 2 - 2
template/erp/fullorderabf_yjtj.html

@@ -160,7 +160,7 @@
 
 <li class="lengththree">
 <em>付款时间:</em>
-<input id="buytime" class="must" value="" name="buytime" type="text" >
+<input id="buytime" class="must" value="{date('Y-m-d')}" name="buytime" type="text" >
 <i class="time fa fa-calendar fa-lg"></i>
 </li>
 
@@ -423,7 +423,7 @@
 <div class="none fullorderdata"></div>
 <div class="zm none"></div>
 <script type="text/javascript">
-var addedit="/customer/mdedit/";
+var addedit="/fullorderabf/yjtj/";
 var fh="/fullorder";
 $(document).ready(function() { 
 if($("select[name='express']").find("option:selected").val() == '24')//联邦的话替换签名选项