更新订单查询

parent 2966cb7e
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Jobs\JopExportGoodsList;
use App\Jobs\JopExportOrderList;
use App\Model\CommonModel; use App\Model\CommonModel;
use App\Model\ExportModel; use App\Model\ExportModel;
use App\Model\GoodsAuditModel; use App\Model\GoodsAuditModel;
...@@ -40,13 +42,24 @@ class ApiController extends Controller ...@@ -40,13 +42,24 @@ class ApiController extends Controller
private function ApiStockChangeItems($request, $id){ private function ApiStockChangeItems($request, $id){
(new ServerPurModel($request->appid,$request->key))->StockChangeItemsList($request->input()); (new ServerPurModel($request->appid,$request->key))->StockChangeItemsList($request->input());
} }
//订单列表 //订单列表(寄售)
private function ApiOrderList($request, $id){ private function ApiOrderList($request, $id){
(new ServerPurModel($request->appid,$request->key))->OrderList($request->input()); $data = $request->input();
$data['picking_type'] = 2; //寄售类型
(new ServerPurModel($request->appid,$request->key))->OrderList($data);
} }
//订单列表导出 //订单列表导出
private function ApiOrderListExport($request, $id){ private function ApiOrderListExport($request, $id){
ExportModel::ApiOrderListExport($request); $data= $request->input();
$data['picking_type'] = 2; //寄售类型
$id = (new UploadLogModel())->addLog($request->account_id,1,$data);
if(!$id) return Export(20003,'任务推送失败');
dispatch(new JopExportOrderList($id));
Export(0,$id);
}
//订单列表
private function ApiOrderDetail($request, $id){
(new ServerPurModel($request->appid,$request->key))->OrderDetail($request->input());
} }
//退货列表 //退货列表
private function ApiAbnormalList($request, $id){ private function ApiAbnormalList($request, $id){
...@@ -60,10 +73,6 @@ class ApiController extends Controller ...@@ -60,10 +73,6 @@ class ApiController extends Controller
private function ApiAbnormalListExport($request, $id){ private function ApiAbnormalListExport($request, $id){
ExportModel::ApiAbnormalListExport($request); ExportModel::ApiAbnormalListExport($request);
} }
//订单列表
private function ApiOrderDetail($request, $id){
(new ServerPurModel($request->appid,$request->key))->OrderDetail($request->input());
}
//获取对账单列表 //获取对账单列表
private function ApiAccountCheckingList($request, $id){ private function ApiAccountCheckingList($request, $id){
(new ServerFinanceModel($request->appid,$request->key))->accountCheckingList($request->input()); (new ServerFinanceModel($request->appid,$request->key))->accountCheckingList($request->input());
...@@ -102,10 +111,33 @@ class ApiController extends Controller ...@@ -102,10 +111,33 @@ class ApiController extends Controller
private function ApiSkuList($request){ private function ApiSkuList($request){
ExportLayui2((new ServerFoostoneModel($request->appid,$request->key))->SkuList($request->input(),2)); ExportLayui2((new ServerFoostoneModel($request->appid,$request->key))->SkuList($request->input(),2));
} }
//商品列表导出
private function ApiGoodsListExport($request, $id){
$id = (new UploadLogModel())->addLog($request->account_id,1,$request->input());
if(!$id) return Export(20003,'任务推送失败');
dispatch(new JopExportGoodsList($id));
Export(0,$id);
}
//查询品牌 //查询品牌
private function GetBrand($request){ private function GetBrand($request){
CommonModel::getBrand($request->p); CommonModel::getBrand($request->p);
} }
//价格明细弹框
private function PurePrice($request){
ExportLayui2((new ServerFoostoneModel($request->appid,$request->key))->SkuCost($request->input(),2));
}
//导出结果查询
private function ApiExportResult($request){
$loginfo = (new UploadLogModel())->where(['create_uid'=>$request->account_id,"id"=>$request->input("id")])->first();
$status = @$loginfo['status'];
if($status == 2){ //成功
Export(0,$loginfo['file_path']);
}elseif ($status == 3){ //失败
Export(1,"没有数据");
}else{
Export(2,"没完成");
}
}
} }
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Jobs\JopExportGoodsList;
use App\Jobs\JopExportOrderList;
use App\Jobs\PreSaleOrder; use App\Jobs\PreSaleOrder;
use App\Jobs\PushFinancePeriod; use App\Jobs\PushFinancePeriod;
use App\Jobs\SafeStock; use App\Jobs\SafeStock;
...@@ -42,23 +44,23 @@ class HandleController extends Controller ...@@ -42,23 +44,23 @@ class HandleController extends Controller
private function a(){ private function a(){
#商品sku列表 #商品sku列表
$info=[ // $info=[
'p'=>'1', // 'p'=>'1',
'limit'=>'10' // 'limit'=>'10'
]; // ];
$appid = '33b95a9c83b6297d1009e6515774d08a'; // $appid = '33b95a9c83b6297d1009e6515774d08a';
$key = '73d27bc6b22539081e07d68b091e932f'; // $key = '73d27bc6b22539081e07d68b091e932f';
// $data=ExcessEncryption($info,'liexin20190128castervbht=1@k','DEvLbH82HMj$ZSjxNZW#M%5Xgn9dvsvT'); // // $data=ExcessEncryption($info,'liexin20190128castervbht=1@k','DEvLbH82HMj$ZSjxNZW#M%5Xgn9dvsvT');
$data=ExcessEncryption($info,$appid,$key); // $data=ExcessEncryption($info,$appid,$key);
$url='http://footstone.liexin.net/third/api/obtain/list/sku'; // $url='http://footstone.liexin.net/third/api/obtain/list/sku';
echo (curl($url,$data)); // echo (curl($url,$data));
die(); // die();
#测试sku列表 #测试sku列表
$info=[ $info=[
'goods_id'=>11050,'p'=>'1','limit'=>100 'goods_id'=>11050,'p'=>'1','limit'=>100
]; ];
$data=ExcessEncryption($info,'98edc594bfac7353f7644c07c328fc88','c99f5662b56977c3168e6659f5d64daf'); $data=ExcessEncryption($info,'98edc594bfac7353f7644c07c328fc88','c99f5662b56977c3168e6659f5d64daf');
$url='http://footstone.liexin.com/third/api/query/sku/cost'; $url='http://footstone.liexin.net/third/api/query/sku/cost';
$res = (curl($url,$data)); $res = (curl($url,$data));
print_r($res); print_r($res);
die(); die();
...@@ -89,5 +91,15 @@ class HandleController extends Controller ...@@ -89,5 +91,15 @@ class HandleController extends Controller
echo "更新成功"; echo "更新成功";
} }
private function c(){
$s = (new JopExportOrderList($_GET['id']))->handle();
print_r($s);
die();
echo dispatch(new JopExportOrderList($_GET['id']));
die();
$a = (new JopExportGoodsList($_GET['id']))->handle();
print_r($a);
}
} }
<?php
namespace App\Http\Controllers;
use Config;
use Illuminate\Http\Request;
use App\Http\Requests;
use DB;
use RedisDB;
class PureController extends Controller
{
public function info(Request $request,$id=''){
if(empty($id)){
return redirect('/web/OrderList' );
}
$data['id'] = $id;
$data['URL_YUNXIN'] = config("website.URL_YUNXIN");
$data['URL_ICHUNT'] = config("website.URL_ICHUNT");
$data['_DOMAIN_'] = config("website.domain");
$data['mobile'] = $request->mobile;
$data['time']=time();
return $this->$id($request,$data,$id);
}
public function __call($name,$arr){
$data['errinfo']='访问路径错误';
return view('errors.error',$data);
}
//价格明细弹框
private function PurePrice($request,$data,$id){
$data['title']='欢迎使用云芯系统';
$data['time']=time();
return view('pure',$data);
}
}
...@@ -58,9 +58,10 @@ class WebController extends Controller ...@@ -58,9 +58,10 @@ class WebController extends Controller
$data['title']='商品列表'; $data['title']='商品列表';
return view('pc',$data); return view('pc',$data);
} }
//订单列表 //订单列表(寄售)
private function OrderList($request,$data,$id){ private function OrderList($request,$data,$id){
$data['title']='订单列表'; $data['title']='订单列表';
$data['is_consign'] = 1;
return view('pc',$data); return view('pc',$data);
} }
//价格审核列表 //价格审核列表
......
...@@ -27,7 +27,9 @@ class Kernel extends HttpKernel ...@@ -27,7 +27,9 @@ class Kernel extends HttpKernel
\App\Http\Middleware\CheckLogin::class, \App\Http\Middleware\CheckLogin::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
], ],
'pure'=>[
],
'api' => [ 'api' => [
], ],
'webapi'=>[ 'webapi'=>[
......
...@@ -1161,9 +1161,9 @@ function GetLikeStr($fen,$key,$data,$type = 1){ ...@@ -1161,9 +1161,9 @@ function GetLikeStr($fen,$key,$data,$type = 1){
/* /*
* 根据当前环境获取目标网址 * 根据当前环境获取目标网址
*/ */
function getHostUrl($sys) function getHostUrl($sys,$current_domain='')
{ {
$current_domain = $_SERVER['HTTP_HOST']; $current_domain = $current_domain ? $current_domain : $_SERVER['HTTP_HOST'];
if($current_domain === "yunxin.liexin.com") if($current_domain === "yunxin.liexin.com")
{ {
return Config('yunxin_conf.'.$sys.'.local'); return Config('yunxin_conf.'.$sys.'.local');
......
...@@ -9,3 +9,6 @@ Route::group(['middleware' => 'web'], function () { ...@@ -9,3 +9,6 @@ Route::group(['middleware' => 'web'], function () {
Route::match(['get', 'post'],'/helper/{key}', 'HelperController@Entrance'); Route::match(['get', 'post'],'/helper/{key}', 'HelperController@Entrance');
Route::match(['get', 'post'],'/hd/{key}', 'HandleController@Entrance'); Route::match(['get', 'post'],'/hd/{key}', 'HandleController@Entrance');
Route::group(['middleware' => 'pure'], function () {
Route::match(['get', 'post'],'/pure/{key}', 'PureController@info');
});
\ No newline at end of file
<?php
namespace App\Jobs;
use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Storage;
use RedisDB;
use DB;
class ExportInOutStock extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
private $log_id;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($log_id)
{
$this->log_id=$log_id;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$LogModel=new UploadLogModel();
$LogInfo=$LogModel->LogInfo($this->log_id);
$Log = json_decode($LogInfo['log'],true);
$collert = json_decode($LogInfo['remark'],true);
$LogModel->UpdateLogArr($this->log_id,'开始处理任务',1,$Log);
$filename=date('Y-m-d-H-i-s') . '-' . uniqid() . '.csv';
$filePath = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$filename;
$x=fopen($filePath,'a'); //不存在则创建
$Arr = ['ID','批次号','skuID','商品型号','品牌名','封装/规格','标准包装量','包装单位','出入库类型','关联单号','用户ID','用户账号','仓库ID','供应商名称','供应商编码','货主','币种','当日ERP汇率','数量','税率','含税单价','去税单价','税费','期初数量','期初成本','期末数量','期末成本','操作时间']; // 表头
foreach ($Arr as $k=>$v){
$Arr[$k]=iconv('utf-8','gbk//IGNORE',$v);
}
fputcsv($x,$Arr); //写入表头
$Arr= ['p', 'limit','relevance_sn','batch_sn','start_time','end_time','sku_id','inout_type','stock_type','supplier_name','supplier_code','user_id','user_account'];
$collert=TrimX($collert,true,$Arr);
$year1 = $collert['start_time'] == "" ? 2019 : date("Y",strtotime($collert['end_time']));
$year2 = $collert['end_time'] == "" ? 2019 : date("Y",strtotime($collert['end_time']));
if ($year1 != $year2){
return $LogModel->UpdateLogArr($this->log_id,'导出失败',3,$Log);
}
//处理条件
$con = DB::connection('report')->table('in_out_stock_'.$year1);
foreach ($collert as $k => $v){
switch ($k){
case "p":
case "limit":
continue;
break;
case "start_time":
$con->where('handle_time', '>=', strtotime($v));
break;
case "end_time":
$con->where('handle_time', '<=',strtotime($v));
break;
case "stock_type":
if ($v == "in"){
$con ->whereIn("inout_type",InOutStockMap::$in_type);
}else{
$con ->whereIn("inout_type",InOutStockMap::$out_type);
}
break;
default:
$con->whereRaw("FIND_IN_SET($k,'".trim($v,',')."') > 0");
break;
}
}
$fixed = Config('finance_conf');
$count = 100;
for ($p = 1; $p < $count + 1; $p++) {
$list = $con->paginate(1000,['*'],'',$p)->toArray();
$count = $list['last_page'];
foreach ($list['data'] as $k=>&$v){
$v['batch_sn']= $v['batch_sn'];
$v['currency'] =array_key_exists($v['currency'],$fixed['currency']) ? $fixed['currency'][$v['currency']] :""; //币种
$v['inout_type'] = InOutStockMap::$inout_type[$v['inout_type']]; //出入库类型
$v['handle_time'] = date('Y-m-d H:i:s',$v['handle_time']);
$v['number'] = str_replace('-','',$v['number']);
unset($v['is_count']);
foreach ($v as $k1=>&$v1){
$v1= iconv('utf-8', 'gbk', $v1);
}
fputcsv($x,$v);
}
}
$UploadFileModel=new UploadLogModel();
$Url=$UploadFileModel->SaveDownFile($filename);
fclose($x);
unlink($filePath);
if(!$Url){
$LogModel->UpdateLogArr($this->log_id,'导出失败',3,$Log);
}else{
$LogModel->UpdateLogArr($this->log_id,'任务完成',2,$Log,['file_name'=>$Url]);
return $Url;
}
}
}
<?php
namespace App\Jobs;
use App\Jobs\Job;
use App\Model\ExportModel;
use App\Model\Server\ServerFoostoneModel;
use App\Model\SupplierAccountModel;
use App\Model\UploadLogModel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Storage;
use RedisDB;
use DB;
class JopExportGoodsList extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
private $id;
public function __construct($id)
{
$this->id=$id;
}
/**
* Execute the job.
* @return void
*/
public function handle()
{
$UploadLogModel=new UploadLogModel();
$LogInfo=$UploadLogModel->LogInfo($this->id);
$log = json_decode($LogInfo['log'],true);
$query = json_decode($LogInfo['remark'],true);
$UploadLogModel->UpdateLogArr($this->id,'开始处理任务',1,$log);
#建立临时文件
$filename=date('Y-m-d-H-i-s') . '-' . uniqid() . '.csv';
$filePath = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$filename;
$x=fopen($filePath,'a'); //不存在则创建
$Arr = ["商品编码","类型","型号","品牌","包装方式","封装","MPQ","状态","价格","商家实际库存","预占库存","可用库存"]; // 表头
foreach ($Arr as $k=>$v){
$Arr[$k]=iconv('utf-8','gbk//IGNORE',$v);
}
fputcsv($x,$Arr); //写入表头
#导出查询数据
$account = (new SupplierAccountModel())->select("appid","key")->where("id",$LogInfo['create_uid'])->first();
$query['p'] = 1;
$query['limit'] = 1000;
$res = (new ServerFoostoneModel($account->appid,$account->key,$LogInfo['extend']))->SkuList($query,2);
if ($res['code'] > 0 ){
$UploadLogModel->UpdateLogArr($this->id,'没有数据',3,$log);
return true;
}
$count = ceil($res['total']/1000);
for ($p = 1; $p < $count + 1; $p++) {
sleep(1);
$query['p'] = $p;
$query['limit'] = 1000;
$list = (new ServerFoostoneModel($account->appid,$account->key,$LogInfo['extend']))->SkuList($query,2);
if ($list['code'] > 0){
break;
}
foreach ($list['data'] as $k=>&$v){
$out = [
'encoded'=>$v['encoded'],
'goods_type_name'=>$v['goods_type_name'],
'goods_name'=>$v['goods_name'],
'brand_name'=>$v['brand_name'],
'packing'=>$v['packing'],
'encap'=>$v['encap'],
'mpq'=>$v['mpq'],
'status_name'=>$v['status_name'],
'new_cost'=>$v['new_cost'],
'商家实际库存'=>"",
'LockStock'=>$v['LockStock'],
'stock'=>$v['stock'],
];
foreach ($out as $k1=>&$v1){
$v1= iconv('utf-8', 'gbk', $v1);
}
fputcsv($x,$out);
}
}
$UploadFileModel=new UploadLogModel();
$Url=$UploadFileModel->SaveDownFile($filename);
print_r($Url);
fclose($x);
unlink($filePath);
if(!$Url){
$UploadLogModel->UpdateLogArr($this->id,'导出失败',3,$log);
return true;
}else{
$UploadLogModel->where('id',$this->id)->update(['file_path'=>$Url]);
$UploadLogModel->UpdateLogArr($this->id,'任务完成',2,$log,['file_path'=>$Url]);
return true;
}
}
}
<?php
namespace App\Jobs;
use App\Jobs\Job;
use App\Model\ExportModel;
use App\Model\Server\ServerPurModel;
use App\Model\SupplierAccountModel;
use App\Model\UploadLogModel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Storage;
use RedisDB;
use DB;
class JopExportOrderList extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
private $id;
public function __construct($id)
{
$this->id=$id;
}
/**
* Execute the job.
* @return void
*/
public function handle()
{
$UploadLogModel=new UploadLogModel();
$LogInfo=$UploadLogModel->LogInfo($this->id);
$log = json_decode($LogInfo['log'],true);
$query = json_decode($LogInfo['remark'],true);
$UploadLogModel->UpdateLogArr($this->id,'开始处理任务',1,$log);
#建立临时文件
$filename=date('Y-m-d-H-i-s') . '-' . uniqid() . '.csv';
$filePath = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$filename;
$x=fopen($filePath,'a'); //不存在则创建
$Arr = ["订单号","创建时间","订单金额","结算币种","结算方式","付款状态"]; // 表头
foreach ($Arr as $k=>$v){
$Arr[$k]=iconv('utf-8','gbk//IGNORE',$v);
}
fputcsv($x,$Arr); //写入表头
#导出查询数据
$account = (new SupplierAccountModel())->select("appid","key")->where("id",$LogInfo['create_uid'])->first();
$query['p'] = 1;
$query['limit'] = 1000;
$res = (new ServerPurModel($account->appid,$account->key,$LogInfo['extend']))->OrderList($query,2);
if (!count($res['data']) ){
$UploadLogModel->UpdateLogArr($this->id,'没有数据',3,$log);
return true;
}
$count = ceil($res['count']/1000);
for ($p = 1; $p < $count + 1; $p++) {
sleep(1);
$query['p'] = $p;
$query['limit'] = 1000;
$list = (new ServerPurModel($account->appid,$account->key,$LogInfo['extend']))->OrderList($query,2);
if ($list['code'] > 0){
break;
}
foreach ($list['data'] as $k=>&$v){
$out = [
'order_sn'=>$v['order_sn'],
'create_time'=>$v['create_time'],
'picking_amount'=>$v['picking_amount'],
'currency'=>$v['currency'],
'pay_type'=>$v['pay_type'],
'status'=>$v['status'],
];
foreach ($out as $k1=>&$v1){
$v1= iconv('utf-8', 'gbk', $v1);
}
fputcsv($x,$out);
}
}
$UploadFileModel=new UploadLogModel();
$Url=$UploadFileModel->SaveDownFile($filename);
fclose($x);
unlink($filePath);
if(!$Url){
$UploadLogModel->UpdateLogArr($this->id,'导出失败',3,$log);
return true;
}else{
$UploadLogModel->where('id',$this->id)->update(['file_path'=>$Url]);
$UploadLogModel->UpdateLogArr($this->id,'任务完成',2,$log,['file_path'=>$Url]);
return true;
}
}
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Model; namespace App\Model;
use App\Model\Server\ServerFoostoneModel;
use Request; use Request;
use DB; use DB;
use App\Model\Server\ServerPurModel; use App\Model\Server\ServerPurModel;
...@@ -87,4 +88,6 @@ class ExportModel ...@@ -87,4 +88,6 @@ class ExportModel
export_csv($out,['对账单号','账单金额','结算币种','结算方式','结算时间','创建时间','对账时间','状态'],'对账列表导出'.time().'.csv'); export_csv($out,['对账单号','账单金额','结算币种','结算方式','结算时间','创建时间','对账时间','状态'],'对账列表导出'.time().'.csv');
} }
} }
\ No newline at end of file
...@@ -12,17 +12,17 @@ class ServerFoostoneModel ...@@ -12,17 +12,17 @@ class ServerFoostoneModel
private $appid ; //APPID private $appid ; //APPID
private $key ; //密钥 private $key ; //密钥
const IS_DEBUG = 0; //是否调试 const IS_DEBUG = 0; //是否调试
public function __construct($appid,$key) public function __construct($appid,$key,$domain="")
{ {
$this->_url = getHostUrl('footstone_domain'); $this->_url = getHostUrl('footstone_domain',$domain);
$this->appid = $appid; $this->appid = $appid;
$this->key = $key; $this->key = $key;
} }
//发送请求 //发送请求
public function push($url,$data,$type = 1){ public function push($url,$data,$type = 1){
$data = ExcessEncryption($data,$this->appid,$this->key); $datas = ExcessEncryption($data,$this->appid,$this->key);
$urls = $this->_url.$url; $urls = $this->_url.$url;
$res = (curl($urls,$data)); $res = (curl($urls,$datas));
if (self::IS_DEBUG){ if (self::IS_DEBUG){
print_r($urls); print_r($urls);
...@@ -43,10 +43,17 @@ class ServerFoostoneModel ...@@ -43,10 +43,17 @@ class ServerFoostoneModel
} }
//获取价格变化列表 //获取价格变化列表
public function SkuCost($data,$type =1){ public function SkuCost($data,$type =1){
return $this->push( '/third/api/query/sku/cost',$data,$type); $res = $this->push( '/third/api/query/sku/cost',$data,$type);
if($res['code'] == 0){
foreach ($res['data'] as $k=>&$v){
$v['add_time'] = timeToDate($v['add_time']);
}
}
return $res;
} }
//获取sku列表 //获取sku列表
public function SkuList($data,$type =1){ public function SkuList($data,$type =1,$goods_type = [3,4]){
$data['goods_type'] = $goods_type;
return $this->push( '/third/api/obtain/list/sku',$data,$type); return $this->push( '/third/api/obtain/list/sku',$data,$type);
} }
......
...@@ -12,17 +12,17 @@ class ServerPurModel ...@@ -12,17 +12,17 @@ class ServerPurModel
private $appid ; //APPID private $appid ; //APPID
private $key ; //密钥 private $key ; //密钥
const IS_DEBUG = 0; //是否调试 const IS_DEBUG = 0; //是否调试
public function __construct($appid,$key) public function __construct($appid,$key,$domain="")
{ {
$this->_url = getHostUrl('pur_domain'); $this->_url = getHostUrl('pur_domain',$domain);
$this->appid = $appid; $this->appid = $appid;
$this->key = $key; $this->key = $key;
} }
//发送请求 //发送请求
public function push($url,$data,$type = 1){ public function push($url,$data,$type = 1){
$data = ExcessEncryption($data,$this->appid,$this->key); $datas = ExcessEncryption($data,$this->appid,$this->key);
$urls = $this->_url.$url; $urls = $this->_url.$url;
$res = (curl($urls,$data)); $res = (curl($urls,$datas));
if (self::IS_DEBUG){ if (self::IS_DEBUG){
print_r($urls); print_r($urls);
......
...@@ -36,9 +36,9 @@ class UploadLogModel extends Model ...@@ -36,9 +36,9 @@ class UploadLogModel extends Model
return [0,'成功',$list['data'],$list['total']]; return [0,'成功',$list['data'],$list['total']];
} }
public function LogInfo($up_id){ public function LogInfo($id){
if(empty($up_id)) return false; if(empty($id)) return false;
$info=$this->where('up_id','=',$up_id)->first(); $info=$this->where('id',$id)->first();
$info && $info=$info->toArray(); $info && $info=$info->toArray();
return $info; return $info;
} }
...@@ -49,14 +49,18 @@ class UploadLogModel extends Model ...@@ -49,14 +49,18 @@ class UploadLogModel extends Model
if(!$result) return false; if(!$result) return false;
return true; return true;
} }
//插入任务
public function UpdateLogArr($up_id,$info,$status='',$Log,$data=[]){ public function addLog($create_uid,$type,$remark)
if(empty($up_id)) return false; {
return $this->insertGetId(['create_uid'=>$create_uid,'type'=>$type,'extend'=>$_SERVER['HTTP_HOST'],'create_time'=>time(),'remark'=>json_encode($remark, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES)]);
}
public function UpdateLogArr($id,$info,$status='',$Log,$data=[]){
if(empty($id)) return false;
$data['update_time'] = time(); $data['update_time'] = time();
$Log[] = date('Y-m-d H:i',$data['update_time']).$info; $Log[] = date('Y-m-d H:i',$data['update_time']).$info;
$data['log'] = json_encode($Log, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); $data['log'] = json_encode($Log, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
empty($status) || $data['status']=$status; empty($status) || $data['status']=$status;
$result=$this->where('up_id','=',$up_id)->update($data); //debug $result=$this->where('id','=',$id)->update($data); //debug
if(!$result) return false; if(!$result) return false;
return true; return true;
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
var table_data = []; var table_data = [];
window.app = { window.app = {
init: function () { init: function () {
app.select2();
app.tableList(); app.tableList();
app.checkbox(); app.checkbox();
app.uploadChangePrice(); app.uploadChangePrice();
...@@ -14,7 +13,10 @@ ...@@ -14,7 +13,10 @@
}) })
//重置表单 //重置表单
$("#reset").click(function () { $("#reset").click(function () {
layui.form.render(); $("input[name='supplier_goods_id']").val("")
$("input[name='goods_name']").val("")
$("input[name='brand_id']").val("")
$("#brand_name").empty(); //清空select2数据
}) })
//审核通过 //审核通过
$("#exmine_pass").click(function () { $("#exmine_pass").click(function () {
...@@ -24,6 +26,10 @@ ...@@ -24,6 +26,10 @@
$("#exmine_no").click(function () { $("#exmine_no").click(function () {
app.exmine(-1) app.exmine(-1)
}) })
//导出
$("#export").click(function () {
app.export()
})
}, },
tableList:function () { tableList:function () {
layui.table.render({ layui.table.render({
...@@ -40,16 +46,14 @@ ...@@ -40,16 +46,14 @@
,first: true //不显示首页 ,first: true //不显示首页
,last: false //不显示尾页 ,last: false //不显示尾页
,cols: [[ ,cols: [[
{field:'id', title: '全选',type:'checkbox',align:'center'} {field:'encoded', title: '商品编码',align:'center'}
,{field:'goods_code', title: '商品编码',align:'center'}
,{field:'goods_type_name', title: '类型',align:'center'} ,{field:'goods_type_name', title: '类型',align:'center'}
,{field:'goods_name', title: '型号',align:'center'} ,{field:'goods_name', title: '型号',align:'center'}
,{field:'brand_name', title: '品牌',align:'center'} ,{field:'brand_name', title: '品牌',align:'center'}
,{field:'packing', title: '包装方式',align:'center'} ,{field:'packing', title: '包装方式',align:'center'}
,{field:'encap', title: '封装',align:'center'} ,{field:'encap', title: '封装',align:'center'}
,{field:'mpq', title: 'MPQ',align:'center'} ,{field:'mpq', title: 'MPQ',align:'center'}
,{field:'', title: '相关参数',align:'center'} ,{field:'status_name', title: '状态',align:'center'}
,{field:'status', title: '状态',align:'center'}
,{field:'new_cost', title: '价格',align:'center'} ,{field:'new_cost', title: '价格',align:'center'}
,{field:'', title: '商家实际库存',align:'center'} ,{field:'', title: '商家实际库存',align:'center'}
,{field:'LockStock', title: '预占库存',align:'center'} ,{field:'LockStock', title: '预占库存',align:'center'}
...@@ -72,8 +76,12 @@ ...@@ -72,8 +76,12 @@
} }
}); });
}, },
select2:function () { //品牌模糊搜索 export:function (){ //商品列表导出
common_export('/api/ApiGoodsListExport',formJson('form1'))
},
export_result:function (){ //循环导出结果
var res = ajax_push('/api/ApiGoodsListExportResult',formJson('form1'))
// alert(res.msg);
}, },
uploadChangePrice:function () { //审核操作 uploadChangePrice:function () { //审核操作
//执行实例 //执行实例
...@@ -120,7 +128,19 @@ ...@@ -120,7 +128,19 @@
app.init(); app.init();
}) })
}(); }();
/*
sku价格明细弹框
*/
function purePrice(sku_id) {
layer.open({
type: 2
, scrollbar: false
, area: ['700px', '570px']
, maxmin: true
, title: '价格变化明细'
, content: '/pure/PurePrice?sku_id='+sku_id
});
}
/* /*
模糊选择品牌 模糊选择品牌
*/ */
......
;!function () { ;!function () {
var ids = []; //选择的ids
var table_data = [];
window.app = { window.app = {
init: function () { init: function () {
app.tableList(1); app.tableList();
//搜索
//刷新列表
$("#search").click(function () { $("#search").click(function () {
app.tableList(1); app.tableList()
})
//重置表单
$("#reset").click(function () {
$('#form1')[0].reset()
}) })
//导出 //导出
$("#export").click(function () { $("#export").click(function () {
exportUrl('/api/ApiOrderListExport','form1','确定导出数据?') app.export()
}) })
//下单时间选择
layui.laydate.render({
elem: '.order-time-1',
theme: '#1080d0'
});
layui.laydate.render({
elem: '.order-time-2',
theme: '#1080d0'
});
}, },
//列表数据查询 tableList:function () {
tableList: function (page) { layui.table.render({
var postData = { elem: '#list'
'p':page, ,url:'/api/ApiOrderList'
'order_sn':$("input[name='order_sn']").val(), ,method:'post'
'goods_name':$("input[name='goods_name']").val(), ,cellMinWidth: 100 //全局定义常规单元格的最小宽度
'status':$("input[name='status']").val(), ,request: {
'create_time1':$("input[name='create_time1']").val(), pageName: 'p' //页码的参数名称,默认:page
'create_time2':$("input[name='create_time2']").val(), ,limitName: 'limit' //每页数据量的参数名,默认:limit
}
var res = ajax_push(URL_YUNXIN + '/api/ApiOrderList',postData)
if (res.code == 0) {
var html = "";
if(res.data.length > 0) {
for (i = 0; i < res.data.length; i++) {
var s = res.data[i];
html += "<tr class=\"you\"> " +
"<td><span class=\"t1\">"+s.order_sn+"</span></td>" +
"<td><span class=\"t1\">"+s.create_time+"</span></td>" +
"<td><span class=\"t1\">"+s.picking_amount+"</span></td>" +
"<td><span class=\"t1\">"+s.currency+"</span></td>" +
"<td><span class=\"t1\">"+s.pay_type+"</span></td>" +
"<td><span class=\"t1\">"+s.status+"</span></td>" +
"<td><a href=\"/web/OrderDetail?id="+s.order_id+"\" class=\"lineBlock va-m operation-1\"><i class=\"iconfont icon-mingxi-\"></i><em>明细</em></a></td></tr>"
}
}else{
html = "<tr class=\"you\"><td colspan='9' style='text-align: center;'><span class=\"t1\" style='color: #cccccc'>没有数据</span></td></tr>";
} }
,where: formJson('form1')
,loading:true
,first: true //不显示首页
,last: false //不显示尾页
,cols: [[
{field:'order_sn', title: '订单号',align:'center'}
,{field:'create_time', title: '创建时间',align:'center'}
,{field:'picking_amount', title: '订单金额',align:'center'}
,{field:'currency', title: '结算币种',align:'center'}
,{field:'pay_type', title: '结算方式',align:'center'}
,{field:'status', title: '付款状态',align:'center'}
,{field:'cahe', title: '操作',templet:'#cahe',width:50,align:'center', fixed: 'right'}
]]
,id:'Abnormal'
,page:{
$("#shopListContent").html(html)
layui.laypage.render({
elem: 'pagination',
theme: '#1080d0',
count: res.count,
groups:10,
curr: page,
jump:function (obj, first) {
if(!first){
app.tableList(obj.curr)
} }
,done: function(res, curr, count) {
table_data=res.data;
} }
}); });
} else { },
alert_err(res.msg) export:function (){ //商品列表导出
return false; common_export('/api/ApiOrderListExport',formJson('form1'))
}
} }
}, $(function () { }, $(function () {
app.init(); app.init();
......
;!function () {
var ids = []; //选择的ids
var table_data = [];
window.app = {
init: function () {
app.tableList();
//刷新列表
$("#search").click(function () {
app.tableList()
})
},
tableList:function () {
layui.table.render({
elem: '#list'
,url:'/api/PurePrice'
,method:'post'
,cellMinWidth: 100 //全局定义常规单元格的最小宽度
,request: {
pageName: 'p' //页码的参数名称,默认:page
,limitName: 'limit' //每页数据量的参数名,默认:limit
}
,where: formJson('form1')
,loading:true
,first: true //不显示首页
,last: false //不显示尾页
,cols: [[
{field:'add_time', title: '修改时间',align:'center'}
,{field:'cost', title: '价格',align:'center'}
]]
,id:'Abnormal'
,page:{
}
,done: function(res, curr, count) {
}
});
},
}, $(function () {
app.init();
})
}();
...@@ -34,6 +34,62 @@ function ajax_push(url,data){ ...@@ -34,6 +34,62 @@ function ajax_push(url,data){
return result; return result;
} }
/* /*
ajax 请求
@param str url 请求地址
@param json data 请求参数
@return json
*/
function ajax_push2(url,data){
var result=false;
$.ajax({
url:url,
type:'post',
data:data,
async: false,
dataType:'json',
timeout:10000,
success:function (resp) {
if(resp){
result=resp;
}
},
error: function (res) {
alert_err('网络阻塞,请重试!')
}
})
return result;
}
/*
后台任务导出
*/
function common_export(url,data) {
var res = ajax_push(url,data)
if(res.code > 0) {
alert_err(res.msg)
return false;
}
layer.msg('后台正在导出,请别关闭页面并耐心等待...', {
icon: 16
,time:0
,shade: 0.01
,style: 'background: rgba(216,100,125,0.9); color:#fff; border:none;',
});
var logid = res.msg //导出id
var t2 = window.setInterval(function () {
var res = ajax_push2('/api/ApiExportResult',{"id":logid})
if(res.code == 0){
layer.closeAll();
window.location.href = res.msg
window.clearInterval(t2)
}
if(res.code == 1){
layer.closeAll();
window.clearInterval(t2)
alert_err(res.msg)
}
},3000);
}
/*
表单数据转json 表单数据转json
*/ */
function formJson(id) { function formJson(id) {
......
...@@ -116,11 +116,11 @@ ...@@ -116,11 +116,11 @@
<dl> <dl>
<dd class=" <?php if( in_array($id,['OrderList','OrderDetail']) !== false ) echo "curr" ?>"> <dd class=" <?php if( in_array($id,['OrderList','OrderDetail']) !== false ) echo "curr" ?>">
<i class="line"></i> <i class="line"></i>
<a href="/web/OrderList">订单列表(商家代发)</a> <a href="/web/OrderList">订单列表(寄售)</a>
</dd> </dd>
<dd class=" <?php if( in_array($id,['AbnormalList','AbnormalDetail']) !== false ) echo "curr" ?>"> <dd class=" <?php if( in_array($id,['AbnormalList','AbnormalDetail']) !== false ) echo "curr" ?>">
<i class="line"></i> <i class="line"></i>
<a href="/web/AbnormalList">退货列表(商家代发)</a> <a href="/web/AbnormalList">退货列表(寄售)</a>
</dd> </dd>
<!-- <!--
{{--<dd class=" <?php if( in_array($id,['OrderList','OrderDetail']) !== false ) echo "curr" ?>">--}} {{--<dd class=" <?php if( in_array($id,['OrderList','OrderDetail']) !== false ) echo "curr" ?>">--}}
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
</div> </div>
<div class="con-section shop-list"> <div class="con-section shop-list">
<p class="text">{{ $title }}</p> <p class="text">{{ $title }}</p>
<form action="" id="form1"> <form action="" id="form1" >
<div class="search-bar"> <div class="search-bar">
<div class="lineBlock input-inline va-m"> <div class="lineBlock input-inline va-m">
<label class="tag">商品编码:</label> <label class="tag">商品编码:</label>
<input type="text" class="inp w180" name="goods_code" > <input type="text" class="inp w180" name="supplier_goods_id" >
</div> </div>
<div class="lineBlock input-inline va-m"> <div class="lineBlock input-inline va-m">
<label class="tag">型号:</label> <label class="tag">型号:</label>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</div> </div>
<div class="lineBlock input-inline va-m"> <div class="lineBlock input-inline va-m">
<label class="tag">品牌:</label> <label class="tag">品牌:</label>
<input type="hidden" id="brand_id" > <input type="hidden" id="brand_id" name="brand_id" >
<select id="brand_name" style="width: 200px;"> <select id="brand_name" style="width: 200px;">
</select> </select>
</div> </div>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
{{--<span>模板下载</span>--}} {{--<span>模板下载</span>--}}
{{--</a>--}} {{--</a>--}}
{{--</div>--}} {{--</div>--}}
<div class="lineBlock input-inline va-m" id="exmine_no"> <div class="lineBlock input-inline va-m" id="export">
<a href="javascript:;" class="search-btn"> <a href="javascript:;" class="search-btn">
<i class="iconfont icon-chaxun-"></i> <i class="iconfont icon-chaxun-"></i>
<span>导出</span> <span>导出</span>
...@@ -57,7 +57,11 @@ ...@@ -57,7 +57,11 @@
<div class="table-list" id="shopList"> <div class="table-list" id="shopList">
<table class="layui-table" lay-filter="test" id="list"></table> <table class="layui-table" lay-filter="test" id="list"></table>
</div> </div>
<div class="pagination-with" id="pagination"></div>
<script type="text/html" id="cahe">
<button class="btn btn-xs btn-outline btn-danger" onclick="purePrice(@{{ d.goods_id }})">价格明细</button>
</script>
</div> </div>
</div> </div>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</div> </div>
<div class="con-section shop-list"> <div class="con-section shop-list">
<p class="text">{{ $title }}</p> <p class="text">{{ $title }}</p>
<form action=""> <form action="" id="form1">
<div class="search-bar"> <div class="search-bar">
<div class="lineBlock input-inline va-m"> <div class="lineBlock input-inline va-m">
<label class="tag">订单号:</label> <label class="tag">订单号:</label>
...@@ -44,24 +44,21 @@ ...@@ -44,24 +44,21 @@
<span>导出</span> <span>导出</span>
</a> </a>
</div> </div>
<div class="lineBlock input-inline va-m" id="reset">
<a href="javascript:;" class="export-btn">
<i class="iconfont icon-daochu-"></i>
<span>重置</span>
</a>
</div>
</div> </div>
</form> </form>
<div class="table-list" id="shopList"> <div class="table-list" id="shopList">
<table> <table class="layui-table" lay-filter="test" id="list"></table>
<tr>
<th>订单号<b></b></th>
<th>创建时间<b></b></th>
<th>订单金额<b></b></th>
<th>结算币种<b></b></th>
<th>结算方式<b></b></th>
<th>付款状态<b></b></th>
<th>操作</th>
</tr>
<tbody id="shopListContent">
</tbody>
</table>
</div> </div>
<div class="pagination-with" id="pagination"></div>
<script type="text/html" id="cahe">
<a class="btn btn-xs btn-outline btn-danger" href="/web/OrderDetail?id=@{{ d.goods_id }}" >明细</a>
</script>
</div> </div>
</div> </div>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>资料管理后台 | </title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
<link rel="stylesheet" type="text/css" href="/pc/font/iconfont.css">
<link rel="stylesheet" type="text/css" href="/pc/js/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="/pc/css/style.min.css">
<script type="text/javascript" src="/pc/js/jquery.min.js"></script>
<script type="text/javascript" src="/pc/js/layui/layui.all.js"></script>
<script type="text/javascript" src="/pc/js/md5/jquery.md5.js"></script>
<script type="text/javascript" src="/pc/js/global.js"></script>
<script type="text/javascript" src="/pc/js/public.js"></script>
<script src="/pc/js/controller/{{$id}}.js?{{time()}}"></script>
<script>
var URL_YUNXIN = "<?= $URL_YUNXIN; ?>";
var URL_ICHUNT = "<?= $URL_ICHUNT; ?>";
var _DOMAIN_ = "<?= $_DOMAIN_; ?>";
</script>
</head>
<body style="background-color: rgba(255, 249, 242, 0);margin: 20px">
@include("pure.$id")
</body>
<div class="table-list" id="shopList" style="width: 95%">
<table class="layui-table" lay-filter="test" id="list"></table>
</div>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>资料管理后台 | </title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
<link href="/js/web/layui/css/layui.css" rel="stylesheet">
<link href="/css/common.min.css" rel="stylesheet">
@include('table.css')
<style>
label{
box-sizing:content-box;
}
</style>
<script>
var k1='';
var k2='';
var UploadImgUrl='';
</script>
</head>
<body style="background-color: rgba(255, 249, 242, 0);margin: 20px">
@include("web.$id")
<script src="/js/jquery-2.2.1.js"></script>
<script src="/js/web/layui/layui.js"></script>
<script src="/js/web/common.min.js"></script>
@if(empty($into))
<script src="/js/web/{{$id}}.js?{{time()}}"></script>
@endif
</body>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment