添加联营物料上传

parent 10d5ac35
......@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Jobs\JopExportAbnormlList;
use App\Jobs\JopExportGoodsComList;
use App\Jobs\JopExportGoodsList;
use App\Jobs\JopExportOrderList;
use App\Jobs\JopExportPutawayList;
......@@ -114,9 +115,11 @@ class ApiController extends Controller
private function ApiGoodsAuditList($request, $id){
ExportLayui((new GoodsAuditModel())->getList($request->input(),$request->supplier_id));
}
//批量修改价格日志
/*
* 上传日志
*/
private function ApiUploadLogList($request, $id){
ExportLayui((new UploadLogModel())->getList($request->input(),$request->account_id));
ExportLayui((new UploadLogModel())->getList($request->account_id,$request->appid,$request->key));
}
//价格审核操作
private function ApiGoodsAuditExmine($request, $id){
......@@ -132,16 +135,21 @@ class ApiController extends Controller
$input['checking_name'] = $request->supplier_name;
(new ServerFinanceModel($request->appid,$request->key))->accountChangeChecking($input);
}
//上传批量修改价格
private function ApiUploadChangePrice($request,$id){
Export((new UploadLogModel())->uploadFile($request->supplier_name));
}
//联营商品列表
private function ApiGoodsComList($request){
$input = $request->input();
$input['supplier_com_code'] = $request->supplier_com_code;
ExportLayui2((new ServerMicModel())->getSkuList($input));
}
//联营商品导出
private function ApiGoodsComListExport($request, $id){
$data= $request->input();
$data['supplier_com_code'] = $request->supplier_com_code;
$id = (new UploadLogModel())->addLog($request->account_id,1,$data,$request->mobile);
if(!$id) return Export(20003,'任务推送失败');
dispatch(new JopExportGoodsComList($id));
Export(0,$id);
}
//商品列表导出
private function ApiGoodsListExport($request, $id){
$id = (new UploadLogModel())->addLog($request->account_id,1,$request->input());
......@@ -171,7 +179,18 @@ class ApiController extends Controller
}
//批量上传联营物料
private function ApiUploadSkuList($request,$id){
$res = (new UploadLogModel())->uploadSkuFile($request->supplier_com_name);
$res = (new UploadLogModel())->uploadSkuFile($request->appid,$request->key,$request->mobile,$request->account_id);
Export($res);
}
//获取上传联营物料结果
private function ApiComImportResult($request){
$res = (new ServerFoostoneModel($request->appid,$request->key))->uploadComSkulog([$request->input("id")],2);
$status = @$res['data']['list'][0]['status'];
if($status == 2){ //成功
Export(0,'成功');
}elseif ($status == 3){ //失败
Export(1,"任务失败:".implode(',',@$res['data']['list'][0]['log']));
}
}
}
......@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Jobs\JopExportAbnormlList;
use App\Jobs\JopExportGoodsComList;
use App\Jobs\JopExportGoodsList;
use App\Jobs\JopExportOrderList;
use App\Jobs\JopExportPutawayList;
......@@ -119,6 +120,9 @@ class HandleController extends Controller
}
private function c(){
$s = (new JopExportGoodsComList($_GET['id']))->handle();
print_r($s);
die();
$s = (new JopExportAbnormlList($_GET['id']))->handle();
print_r($s);
die();
......
......@@ -58,17 +58,17 @@ class WebController extends Controller
}
//自营商品列表
private function GoodsList($request,$data,$id){
if (empty($request->supplier_id)) return redirect("web/GoodsComList");
$data['title']='自营商品列表';
return view('pc',$data);
}
//联营商品列表
private function GoodsComList($request,$data,$id){
$data['title']='联营商品列表';
return view('pc',$data);
}
//联营商品列表上传日志
private function GoodsComImportLogList($request,$data,$id){
private function UploadLogList($request,$data,$id){
$data['title']='联营商品上传日志列表';
return view('pc',$data);
}
......@@ -88,11 +88,6 @@ class WebController extends Controller
$data['title']='订单详情';
return view('pc',$data);
}
//批量修改价格日志
private function UploadLogList($request,$data,$id){
$data['title']='批量修改价格日志列表';
return view('pc',$data);
}
//退货列表
private function AbnormalList($request,$data,$id){
$data['title']='退货列表';
......
......@@ -19,15 +19,15 @@ function curl($url, $params = false, $ispost = 0, $https = 0,$cookie='')
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // 对认证证书来源的检查
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); // 从证书中检查SSL加密算法是否存在
}
if (is_array($params)) {
$params = http_build_query($params);
}
if ($ispost) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, $url);
} else {
if ($params) {
if (is_array($params)) {
$params = http_build_query($params);
}
curl_setopt($ch, CURLOPT_URL, $url . '?' . $params);
} else {
curl_setopt($ch, CURLOPT_URL, $url);
......@@ -45,7 +45,6 @@ function curl($url, $params = false, $ispost = 0, $https = 0,$cookie='')
curl_close($ch);
return $response;
}
function AuthCurl($Url,$params = [],$ispost = 0, $https = 0){
$map['time']=time();
$map['data']=$params;
......
<?php
namespace App\Jobs;
use App\Jobs\Job;
use App\Map\GoodsMap;
use App\Model\ExportModel;
use App\Model\Server\ServerEsModel;
use App\Model\Server\ServerMicModel;
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 JopExportGoodsComList 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 = ["商品ID","SKU型号","商品类别","供应商","制造商","渠道标签","内部编号","库存","状态","是否过期","更新时间"]; // 表头
foreach ($Arr as $k=>$v){
$Arr[$k]=iconv('utf-8','gbk//IGNORE',$v);
}
fputcsv($x,$Arr); //写入表头
#查询es数据
$s = [
'p'=>1,
'offset'=>1000,
'supplier_id'=>17,
'canal/condition'=>$query['supplier_com_code'],
];
if (@$query['goods_id']) $s['goods_id/condition'] = $query['goods_id'];
if(array_key_exists('goods_status',$query)) $s['goods_status/condition'] = $query['goods_status'];
if (@$query['brand_id']) $s['brand_id/condition'] = $query['brand_id'];
if (@$query['goods_name']) $s['goods_name/condition'] = $query['goods_name'];
$searchArr = (new ServerEsModel())->searchSku($s);
$total = @$searchArr['data']['total'];
if (@$searchArr['error_code'] > 0 || !count($total) ){
$UploadLogModel->UpdateLogArr($this->id,'没有数据',3,$log);
return true;
}
$ServerEsModel = new ServerEsModel();
$ServerMicModel = new ServerMicModel();
$count = ceil($total/1000);
for ($p = 1; $p < $count + 1; $p++) {
sleep(1);
$query['p'] = $p;
$query['limit'] = 1000;
$searchArr = $ServerEsModel->searchSku($s);
if ($searchArr['error_code'] > 0){
break;
}
$p = [
'goods_id'=>$searchArr['data']['goods_id']
];
$res = $ServerMicModel->synchronization($p,2);
foreach ($res['data'] as $k=>&$v){
$out = [
'goods_id'=>$k,
'goods_name'=>$v['goods_name'],
'goods_type_name'=> GoodsMap::$goods_type[$v['goods_type']],
'supplier_name'=>$v['supplier_name'],
'brand_name'=>$v['brand_name'],
'canal'=>$v['canal'],
'encoded'=>$v['encoded'],
'stock'=>$v['stock'],
'goods_status_name'=>GoodsMap::$status[$v['goods_status']],
'expire'=>GoodsMap::$expire[$v['status']],
'update_time'=>timeToDate($v['update_time']),
];
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;
}
}
}
<?php
namespace App\Map;
class GoodsMap{
//可选,商品状态 0:待审核 1:审核通过(上架)2:审核不通过 3:下架 4:删除
const STATUS_READY = 0;
const STATUS_PASS = 1;
const STATUS_NO = 2;
const STATUS_XIA =3 ;
const STATUS_DELETE = 4;
static $status =[
self::STATUS_READY => "待审核",
self::STATUS_PASS => "审核通过",
self::STATUS_NO => "审核不通过",
self::STATUS_XIA => "下架",
self::STATUS_DELETE => "删除",
];
//可选,是否过期,0为过期,1为非过期
const expire_yes = 0;
const expire_no = 1;
static $expire = [
self::expire_no =>"非过期",
self::expire_yes =>"已过期",
];
//`goods_type` '0:自营 1:联营 2:专卖',
const goods_type_self = 0;
const goods_type_com = 1;
const goods_type_zhuan = 2;
static $goods_type = [
self::goods_type_self =>"自营",
self::goods_type_com =>"联营",
self::goods_type_zhuan =>"专卖",
];
}
......@@ -4,20 +4,22 @@ namespace App\Map;
class UploadLogMap{
// 操作类型:0:建立任务 1:处理中 2:处理成功 3:处理失败
const STATUS_BUILT = 1;
const STATUS_BUILT = 0;
const STATUS_DEAL = 1;
const STATUS_SUCCESS = 1;
const STATUS_ERROR = 1;
const STATUS_SUCCESS = 2;
const STATUS_ERROR = 3;
static $status =[
self::STATUS_BUILT => "建立任务",
self::STATUS_DEAL => "处理中",
self::STATUS_SUCCESS => "处理成功",
self::STATUS_ERROR => "处理失败",
];
//类型:1 批量修改价格
const TYPE_CHANGE_PRICE = 1;
//类型:1 批量导入sku价格 2
const type_import_sku = 1;
const type_update_sku = 1;
static $type = [
self::TYPE_CHANGE_PRICE =>'批量修改价格'
self::type_import_sku =>'批量导入联营sku',
self::type_update_sku =>'批量修改联营sku'
];
......
......@@ -19,8 +19,7 @@ class ServerEsModel
public function push($url,$data,$type = 1){
$urls = $this->_url.$url;
$datas = self::ApiRequest($data);
$res = curl($urls,$datas,true);
$res = curl($urls,http_build_query($datas),true);
if (self::IS_DEBUG){
print_r($urls);
print_r("<br/>");
......
......@@ -63,5 +63,24 @@ class ServerFoostoneModel
$s = $this->push( '/third/api/query/brand/list',$data,$type);
echo \GuzzleHttp\json_encode($s['data'],JSON_UNESCAPED_UNICODE);
}
/*
* 批量上传联营物料
* @param str $url 上传网址
* @param str $filename 上传原始文件名
*/
public function uploadComSku($url,$filename = "",$type =1){
$data['url'] = $url;
if ($filename != "") $data['filename'] = $filename;
return $this->push('/yunxin/api/pool/upload/sku',$data,$type);
}
/*
* 批量上传联营物料日志
* @param str $up_id_arr 上传id [1,3]
*/
public function uploadComSkulog($up_id_arr,$type =1){
$data['up_id'] = $up_id_arr;
return $this->push('/yunxin/api/pool/select/uploadlog',$data,$type);
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@
namespace App\Model\Server;
use App\Map\GoodsMap;
use Request;
use DB;
......@@ -18,9 +19,7 @@ class ServerMicModel
public function push($url,$data,$type = 1){
$urls = $this->url_imc_footstone.$url;
$datas = $data;
// print_r($datas);
// die();
$res = curl($urls,$datas,true);
$res = curl($urls,http_build_query($datas),true);
if (self::IS_DEBUG){
print_r($urls);
print_r("<br/>");
......@@ -54,22 +53,26 @@ class ServerMicModel
'supplier_id'=>17,
'canal/condition'=>$param['supplier_com_code'],
];
if (@$param['goods_status']) $s['goods_status/condition'] = $param['goods_status'];
if (@$param['band_name']) $s['band_name/condition'] = $param['band_name'];
if (@$param['goods_id']) $s['goods_id/condition'] = $param['goods_id'];
if(array_key_exists('goods_status',$param)) $s['goods_status/condition'] = $param['goods_status'];
if (@$param['brand_id']) $s['brand_id/condition'] = $param['brand_id'];
if (@$param['goods_name']) $s['goods_name/condition'] = $param['goods_name'];
$searchArr = (new ServerEsModel())->searchSku($s);
if ($searchArr['error_code'] > 0) return ["code"=>10001,"msg"=>"没有数据"];
$total = @$searchArr['data']['total'];
if ($searchArr['error_code'] > 0) return ["code"=>10001,"errmsg"=>"没有数据"];
#查询商品数据
$p = [
// 'goods_id'=>$searchArr['data']['goods_id']
'goods_id'=>['1155781458425246471']
'goods_id'=>$searchArr['data']['goods_id']
];
$res = $this->synchronization($p,2);
foreach ($res['data'] as $k=>&$v){
$v['goods_id'] = $k;
$v['update_time'] = timeToDate($v['update_time']);
$v['goods_status_name'] = GoodsMap::$status[$v['goods_status']];
$v['expire'] = GoodsMap::$expire[$v['status']];
$v['goods_type_name'] = GoodsMap::$goods_type[$v['goods_type']];
}
$res['count'] = @$searchArr['data']['total'];
$res['total'] = $total ;
return $res;
}
......
......@@ -3,6 +3,7 @@
namespace App\Model;
use App\Jobs\UploadChangePrice;
use App\Model\Server\ServerFoostoneModel;
use Illuminate\Database\Eloquent\Model;
use RedisDB;
use Request;
......@@ -17,23 +18,35 @@ class UploadLogModel extends Model
protected $primaryKey='id';
public $timestamps = false;
public function getList($type,$create_uid){
public function getList($create_uid,$appid = "",$key = ""){
$collert=Request::only('p','limit','type');
$collert=TrimX($collert,true,['p','limit','type']);
$limit=!empty($collert['limit'])?$collert['limit']:10;
$p=!empty($collert['p'])?$collert['p']:1;
$type = @$collert['type']; //日志类型
//查数据
$UploadLogType = UploadLogMap::$type;
$UploadLogStatus = UploadLogMap::$status;
$list=$this->whereIn('type',$type)->where("create_uid",$create_uid)->orderBy('id','desc')->paginate($limit,['*'],'p',$p)->toArray();
foreach ($list['data'] as $key => &$v) {
$list=$this->where('type',$type)->where("create_uid",$create_uid)->orderBy('id','desc')->paginate($limit,['*'],'p',$p)->toArray();
$data = $list['data'];
if ($type == UploadLogMap::type_import_sku){
//如果是联营sku导入,查询状态
$ids = arrayToCommaStr($data,'extend',1);
$res = (new ServerFoostoneModel($appid,$key))->uploadComSkulog($ids,2);
$foostoneLogStatus = array_column($res['data']['list'],null,'up_id');
}
foreach ($data as $key => &$v) {
$v['create_time'] =timeToDate($v['create_time']);
$v['status'] = @$UploadLogStatus[$v['status']];
$v['type'] = @$UploadLogType[$v['type']];
$v['type_name'] = @UploadLogMap::$type[$v['type']];
if ($v['type'] == UploadLogMap::type_import_sku){ //如果是导入sku,查询状态
$v['status'] = @UploadLogMap::$status[$foostoneLogStatus[$v['extend']]['status']];
$v['log'] = implode(',',@$foostoneLogStatus[$v['extend']]['log']);
}else{
$v['status'] = @UploadLogMap::$status[$v['status']];
}
}
return [0,'成功',$list['data'],$list['total']];
return [0,'成功',$data,$list['total']];
}
public function LogInfo($id){
......@@ -50,9 +63,9 @@ class UploadLogModel extends Model
return true;
}
//插入任务
public function addLog($create_uid,$type,$remark)
public function addLog($create_uid,$type,$remark,$create_name="")
{
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)]);
return $this->insertGetId(['create_uid'=>$create_uid,'create_name'=>$create_name,'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;
......@@ -72,7 +85,7 @@ class UploadLogModel extends Model
return $result['data'][0];
}
//上传文件
public function uploadSkuFile($create_name = ''){
public function uploadSkuFile($appid,$key,$create_name = '',$create_uid = ""){
$file = Request::file('file');
if ($file->isValid()) {
$ext = $file->getClientOriginalExtension();
......@@ -95,18 +108,20 @@ class UploadLogModel extends Model
date('Y-m-d H:i',time()). '建立任务'
]);
$data['create_time'] = $data['update_time'] =time();
$data['create_uid'] = $create_uid;
$data['create_name'] = $create_name;
$data['type']=1;
DB::connection($this->connection)->beginTransaction();
$data['type'] = UploadLogMap::type_import_sku;
$con = DB::connection($this->connection);
$con->beginTransaction();
$insert=$this->insertGetId($data);
if($insert){
$return=dispatch(new UploadChangePrice($insert));
if($return){
DB::connection($this->connection)->commit();
return [0,'上传成功,请等待系统自动处理'];
}else{
$resturn = (new ServerFoostoneModel($appid,$key))->uploadComSku($data['file_path'],"",2);
if($resturn['code'] >0){
return [10004,'上传失败'];
}else{
$this->where("id",$insert)->update(['extend'=>$resturn['data']['up_id']]); //回写上传后id
$con->commit();
return [0,$resturn['data']['up_id']];
}
}else{
return [10003,'上传失败'];
......
......@@ -14,7 +14,7 @@ return [
"domain" => "liexin.com", //根域名
'UploadUrl'=>'http://api.liexin.com/oss/upload',//上传图片接口地址
'UploadUrl'=>'http://api.ichunt.com/oss/upload',//上传图片接口地址
'UploadKey'=>'fh6y5t4rr351d2c3bryi',
......
......@@ -69,10 +69,9 @@ ADD INDEX `idx_supplier_com_name` (`supplier_com_name`) ;
-- 上传日志添加字段
ALTER TABLE `lie_upload_log`
MODIFY COLUMN `type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '1: 批量上传联营物料' AFTER `id`,
MODIFY COLUMN `type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '1: 批量导入联营物料 2: 批量修改联营物料' AFTER `id`;
ADD COLUMN `create_name` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人名称' AFTER `create_uid`;
原因:添加联营账号
......
......@@ -38,22 +38,26 @@
,first: true //不显示首页
,last: false //不显示尾页
,cols: [[
{field:'goods_id', title: '商品ID',width:120,align:'center',templet: function(d){
{field:'goods_id', title: '商品ID',width:190,align:'center',templet: function(d){
return d.goods_id
}},
{field:'old_goods_id', title: '原ID',align:'center'},
{field:'goods_name', title: 'SKU型号',align:'center'},
{field:'type_name', title: '商品类别',align:'center'},
{field:'goods_name', title: 'SKU型号',width:110,align:'center'},
{field:'goods_type_name', title: '商品类别',align:'center'},
{field:'supplier_name', title: '供应商',align:'center'},
{field:'brand_name', title: '制造商',align:'center'},
{field:'canal', title: '渠道标签',align:'center'},
{field:'goods_images', title: '图片',align:'center'},
{field:'goods_images', title: '图片',align:'center',templet: function(d){
if(d.goods_images == ""){
return d.goods_images
}else{
return "<img src='"+d.goods_images+"' style='width: 50px;height:50px '>"
}
}},
{field:'encoded', title: '内部编号',align:'center'},
{field:'batch_sn', title: '批次',align:'center'},
{field:'stock', title: '库存',align:'center'},
{field:'status_name', title: '状态',align:'center'},
{field:'is_expire', title: '是否过期',align:'center'},
{field:'update_time', title: '更新时间',align:'center'},
{field:'goods_status_name', title: '状态',align:'center'},
{field:'expire', title: '是否过期',align:'center'},
{field:'update_time', title: '更新时间',width:120,align:'center'},
{field:'cahe', title: '操作',templet:'#cahe',width:100,align:'center', fixed: 'right'}
]]
,id:'Abnormal'
......@@ -72,11 +76,8 @@
}
});
},
export:function (){ //商品列表导出
common_export('/api/ApiGoodsListExport',formJson('form1'))
},
export_result:function (){ //循环导出结果
var res = ajax_push('/api/ApiGoodsListExportResult',formJson('form1'))
export:function (){ //联营商品列表导出
common_export('/api/ApiGoodsComListExport',formJson('form1'))
},
uploadSku:function () { //审核操作
//执行实例
......@@ -87,7 +88,30 @@
,exts:'csv'
,done: function(res){
if(!res) return layer.msg('网络连接失败,请重试',{icon:6});
return layer.msg(res.msg,{icon:6});
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/ApiComImportResult',{"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);
}
,error: function(){
return layer.msg('上传异常',{icon:5});
......@@ -129,10 +153,75 @@
function purePrice(goods_id) {
layer.open({
type: 2
, scrollbar: false
, area: ['700px', '570px']
, maxmin: true
, area: ['75%',"300px"]
, title: '价格变化明细'
, content: '/pure/PureComPrice?goods_id='+goods_id
, yes: function (index, layero) {
var body = layer.getChildFrame('body', index).contents().serialize(); //巧妙的地方在这里哦
update(body,table,_cur_page,index);
}
});
}
/*
模糊选择品牌
*/
var selectTelehone;
$(function () {
selectTelehone = $("#brand_name");
initSelectTelephone();
});
function initSelectTelephone() {
selectTelehone.select2({
ajax: {
url: function (params) {
return "/api/GetBrand?p=" + params.term;
},
dataType: 'json',
processResults: function (data, params) {
for (var i = 0; i < data.length; i++) {
data[i].id = data[i].brand_id;
data[i].text = data[i].brand_name;
}
return {
results: data
};
},
cache: true
},
allowClear: true, //选中之后,可手动点击删除
placeholder: "输入关键词搜索...",
escapeMarkup: function (markup) { return markup; }, // 让template的html显示效果,否则输出代码
minimumInputLength: 1, //搜索框至少要输入的长度,此处设置后需输入才显示结果
language: "zh-CN", //中文
templateResult: formatTelehoneNumber, // 自定义下拉选项的样式模板
templateSelection: formatTelehoneNumberSelection // 自定义选中选项的样式模板
});
selectTelehone.on("select2:select", function (evt) {
$("#brand_id").val(evt.params.data.brand_id)
//这里是选中触发的事件
//evt.params.data 是选中项的信息
});
selectTelehone.on("select2:unselect", function (evt) {
//这里是取消选中触发的事件
//如配置allowClear: true后,触发
$("#brand_name").empty(); //清空select2数据
$("#brand_id").val(""); //清空搜索
});
}
function formatTelehoneNumber(item) {
if (item.loading) return item;
var markup = '<div> <p class="text-primary">' + item.brand_name + '</p> </div>';
return markup;
}
function formatTelehoneNumberSelection(item) {
if (item.brand_name) {
return item.brand_name;
}
else {
return "输入品牌搜索...";
}
}
\ No newline at end of file
......@@ -14,25 +14,23 @@
elem: '#list'
,url:'/api/ApiUploadLogList'
,method:'post'
// ,cellMinWidth: 100 //全局定义常规单元格的最小宽度
,request: {
pageName: 'p' //页码的参数名称,默认:page
,limitName: 'limit' //每页数据量的参数名,默认:limit
}
,where: {} //formJson('form1')
,where: {"type":1} //formJson('form1')
,loading:true
,first: true //不显示首页
,last: false //不显示尾页
,cols: [[ //
{field:'id', title: 'ID',widht:"10px",align:'center'}
,{field:'batch_sn', title: '批次号',align:'center'}
{field:'id', title: 'ID',align:'center'}
,{field:'create_name', title: '上传人',align:'center'}
,{field:'status', title: '状态',align:'center'}
,{field:'log', title: '日志',align:'center'}
,{field:'create_time', title: '上传时间',align:'center'}
,{field:'', title: '操作',align:'center',templet: function(d){
,{field:'', title: '操作',fixed: 'right',align:'center',templet: function(d){
if(d.file_path != ""){
return '<a style="cursor:pointer;font-size: 14px; color:blue" href="'+d.file_path+'">下载</a>'
return '<button style="cursor:pointer;font-size: 14px; color:blue" href="'+d.file_path+'">下载文件</button>'
}else{
return ""
}
......@@ -41,17 +39,6 @@
,id:'Abnormal'
,page:{ }
,done: function(res, curr, count) {
// 若无数据,则禁用导出按钮
if (!count) {
$('.export').addClass('layui-disabled');
} else {
$('.export').removeClass('layui-disabled');
}
$("td[data-field='log']").each(function(){
$(this).find(".layui-table-cell").removeClass('layui-table-cell');
});
//设置全部数据到全局变量
table_data=res.data;
}
});
}
......
......@@ -107,9 +107,9 @@
<i class="line"></i>
<a href="/web/GoodsComList">联营商品列表</a>
</dd>
<dd class="<?php if( in_array($id,['GoodsComImportLogList']) !== false ) echo "curr" ?>">
<dd class="<?php if( in_array($id,['UploadLogList']) !== false ) echo "curr" ?>">
<i class="line"></i>
<a href="/web/GoodsComImportLogList">联营商品导入日志</a>
<a href="/web/UploadLogList">联营商品导入日志</a>
</dd>
<?php } ?>
</dl>
......
......@@ -9,19 +9,30 @@
<form action="" id="form1" >
<div class="search-bar">
<div class="lineBlock input-inline va-m">
<label class="tag">商品编码</label>
<input type="text" class="inp w180" name="supplier_goods_id" placeholder="输入商品编码">
<label class="tag">商品ID</label>
<input type="text" class="inp w180" name="goods_id" placeholder="输入商品ID">
</div>
<div class="lineBlock input-inline va-m">
<label class="tag">型号:</label>
<input type="text" class="inp w180" name="goods_name" placeholder="输入型号">
<input type="text" class="inp w180" name="goods_name" placeholder="输入型号名称">
</div>
<div class="lineBlock input-inline va-m">
<label class="tag">品牌:</label>
<input type="hidden" id="brand_id" name="brand_id" placeholder="输入品牌">
<input type="hidden" id="brand_id" name="brand_id" placeholder="输入品牌名称">
<select id="brand_name" style="width: 200px;">
</select>
</div>
<div class="lineBlock input-inline va-m">
<label class="tag">状态:</label>
<select name="goods_status" class="sel w180" >
<option value="">全部</option>
<?php
foreach(\App\Map\GoodsMap::$status as $k=>$v){
echo "<option value='$k'>$v</option>";
}
?>
</select>
</div>
<div style="margin-top: 10px">
<div class="lineBlock input-inline va-m" id="search">
<a href="javascript:;" class="export-btn">
......@@ -29,13 +40,20 @@
<span>查询</span>
</a>
</div>
<a href="" style="color:red">下载导入模板</a>
<div class="lineBlock input-inline va-m" id="BatchAdd">
<a href="javascript:;" class="export-btn">
<i class="iconfont icon-daochu-"></i>
<span>导入</span>
</a>
</div>
<a href="" style="color:red">下载导入模板</a>
<div class="lineBlock input-inline va-m" id="export">
<a href="javascript:;" class="export-btn">
<i class="iconfont icon-daochu-"></i>
<span>导出</span>
</a>
</div>
</div>
</div>
</form>
......@@ -44,7 +62,7 @@
</div>
<script type="text/html" id="cahe">
<button class="btn btn-xs btn-outline btn-success pointer" style="color: #1080d0;border: 1px solid #1080d0;" onclick="purePrice(@{{ d.goods_id }})">&nbsp;价格明细&nbsp;</button>
<button class="btn btn-xs btn-outline btn-success pointer" style="color: #1080d0;border: 1px solid #1080d0;" onclick="purePrice('@{{ d.goods_id }}')">&nbsp;价格明细&nbsp;</button>
</script>
</div>
......
<div class="table-list" id="shopList" style="width: 95%">
<table class="layui-table" id="tb" lay-filter="parse-table-demo1">
<table class="layui-table" id="tb" style="width: 650px;" lay-filter="parse-table-demo1">
<thead>
<tr>
@if(!empty($ladder_price) && is_array($ladder_price))
@foreach($ladder_price as $k=>$v)
<th><div style="width:30px!important">阶梯数量 <?= $k+1 ?></div></th>
<th><div style="width:70px!important">国内含税价<?= $k+1 ?>(¥)</div></th>
<th><div style="width:70px!important">香港交货价<?= $k+1 ?></div></th>
<th><div style="">阶梯数量 <?= $k+1 ?></div></th>
<th><div style="">国内含税价<?= $k+1 ?>(¥)</div></th>
<th><div style="">香港交货价<?= $k+1 ?></div></th>
@endforeach
@endif
</tr>
......@@ -14,9 +14,9 @@
<tr >
@if(!empty($ladder_price) && is_array($ladder_price))
@foreach($ladder_price as $k=>$v)
<td>{{$v['purchases']}}</td>
<td>{{$v['price_us']}}</td>
<td>{{$v['price_cn']}}</td>
<td>{{@$v['purchases']}}</td>
<td>{{@$v['price_us']}}</td>
<td>{{@$v['price_cn']}}</td>
@endforeach
@endif
</tr>
......
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