Commit d5e9f16b by 朱继来

Merge branch 'master' of http://119.23.72.7/zhujilai/Order into zjl_brand_20200608

parents fc990db3 def0c6dd
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\Inspire::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')
->hourly();
}
}
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\Inspire::class,
\App\Console\Commands\JingDiaoUser::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
}
}
<?php
namespace App\Exceptions;
class BomException extends \Exception{
}
\ No newline at end of file
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Services\Bom\BomService;
class BomApiController extends Controller{
public $bomService =null;
public function __construct()
{
$this->bomService = new BomService;
}
public function Entrance(Request $request,$id){
return call_user_func_array([$this,$id],[$request, $id]);
}
private function ajaxReturn($errcode=0,$errmsg='成功',$data=''){
if(is_array($errcode)){
ErrorLog($errcode[0],$errcode[1]);
return [
'errcode'=>$errcode[0],
'errmsg'=>$errcode[1],
'data'=>!empty($errcode[2])?$errcode[2]:''
];
}else{
ErrorLog($errcode,$errmsg);
return [
'errcode'=>$errcode,
'errmsg'=>$errmsg,
'data'=>$data
];
}
}
private function LayuiAjaxReturn($errcode=0,$errmsg=0,$data=[],$count=0,$total=''){
if(is_array($errcode)){
ErrorLog($errcode[0],$errcode[1]);
return [
'code'=>$errcode[0],
'msg'=>$errcode[1],
'data'=>$errcode[2],
'count'=>$errcode[3],
'total'=>!empty($errcode[4])?$errcode[4]:''
];
}else{
ErrorLog($errcode,$errmsg);
return [
'code'=>$errcode,
'msg'=>$errmsg,
'data'=>$data,
'count'=>$count,
'total'=>$total
];
}
}
// bom单列表
public function BomList($request,$id)
{
list($count,$data) = $this->bomService->getBomList($request);
return $this->LayuiAjaxReturn(0,"ok",$data,$count);
}
// bom单详情
public function BomView($request,$id)
{
list($count,$data) = $this->bomService->getBomView($request);
return $this->LayuiAjaxReturn(0,"ok",$data,$count);
}
//bom单详情 保存bom单
public function saveBomInfo($request,$id){
$res = $this->bomService->saveBomInfo($request);
return $this->ajaxReturn($res['errcode'],$res['errmsg']);
}
/*
* 创建订单
*/
public function createBomOrder($request,$id){
$res = $this->bomService->createBomOrder($request);
return $this->ajaxReturn($res['errcode'],$res['errmsg']);
}
/*
* 数据报表
*/
public function bomReportCount($request,$id){
$res = $this->bomService->bomReportCount($request);
return $this->ajaxReturn($res['errcode'],$res['errmsg'],$res['data']);
}
}
\ No newline at end of file
......@@ -898,7 +898,8 @@ Class OrderController extends Controller
$order_goods_type = $request->input('order_goods_type', 1);
if ($order_goods_type == 1) {
$resData['status'] = $auditor_role == 3 ? 1 : 2; // 角色为‘查看自己’时,状态为待审核,否则为待付款
// $resData['status'] = $auditor_role == 3 ? 1 : 2; // 角色为‘查看自己’时,状态为待审核,否则为待付款
$resData['is_manager'] = $auditor_role == 3 ? 0 : 1; // 角色为‘查看自己’时,is_manager = 0
}
$url = Config('website.api_domain').'order/changeOrder';
......@@ -910,6 +911,23 @@ Class OrderController extends Controller
}
}
// 申请主管审核
public function ajaxApplyManagerAudit(Request $request)
{
if ($request->isMethod('post')) {
$data['order_id'] = $request->input('order_id', '');
$data['operator_id'] = $request->user->userId;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'order/applyManagerAudit';
$temp = json_decode(curlApi($url, $data, "POST"), true);
return array('errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']);
}
}
// 主管审核
public function ajaxAuditPass(Request $request)
{
......@@ -2069,12 +2087,14 @@ Class OrderController extends Controller
{
$id = $request->input('id');
$cc_email = $request->input('cc_email', ''); // 额外抄送人
$info = $this->orderDetail($request, $id);
$info = $this->orderDetail($request, $id);
$send_buyers = []; // 发送采购邮件数据
$CmsModel = new CmsModel();
$sale_name = $CmsModel->getUserName($info['order_info']['sale_id']); //获取业务员
$sale_name = $CmsModel->getUserName($info['order_info']['sale_id']); //获取业务员
$to_user_array = [];
//循环订单详情
foreach ($info['order_items_info'] as $key => $value) {
if ($value['status'] == -1) continue;
......@@ -2092,52 +2112,32 @@ Class OrderController extends Controller
$tmp['currency'] = $info['order_info']['currency'] == 1?'人民币':'美元';
$tmp['totalPrice'] = number_format($value['goods_number'] * $value['single_pre_price'], 2, '.', '');
$tmp['remarks'] = $value['remarks'];
$tmp['material'] = $value['erp_rec_id'];
$tmp['material'] = $value['material_number'];
$tmp['purchasing'] = !empty($value['buyerName'])?$value['buyerName']:'';
$tmp['deliveryTime'] = $value['batch']; //批次
$tmp['send_email'] = !empty($value['send_email'])?$value['send_email']:'';
$send_buyers[$value['send_email']]['data'][] = $tmp;
$send_buyers[$value['send_email']]['toUser'] = $value['send_email'];
$send_buyers[$value['send_email']]['ccUser'] = [];
$send_buyers[$value['send_email']]['date'] = date('Y-m-d',time());
$send_buyers[$value['send_email']]['date'] = intval($id);
$send_buyers[$value['send_email']]['id'] = $sale_name;
$send_buyers[$value['buyer_id']]['data'][] = $tmp;
$send_buyers[$value['buyer_id']]['toUser'] = $value['send_email'];
$send_buyers[$value['buyer_id']]['date'] = date('Y-m-d',time());
$send_buyers[$value['buyer_id']]['id'] = $sale_name;
$tmp['projectId'] = $key+1;
$data['data'][] = $tmp;
}
$to_user_array[] = $value['send_email'];
// 各个采购邮件推入队列
foreach ($send_buyers as &$v) {
$v['combined'] = 0;
foreach ($v['data'] as $item) {
$v['combined'] += $item['totalPrice'];
}
$this->pushQueue($v);
// $tmp['projectId'] = $key+1;
// $data['data'][] = $tmp;
}
$data['toUser'] = $request->user->email; // 收件人
$cc_send_mail_array = Config('config.cc_email'); // 固定抄送人
$perm = new PermController;
$kefu_manager_email = $perm->getManager($request->user->userId, 63); // 获取当前客服的上级主管邮箱,63-销售经理
$kefu_manager_email && $cc_send_mail_array = array_merge($cc_send_mail_array, $kefu_manager_email); // 合并上级主管邮箱
// 获取采购经理
$buyer_ids = array_unique(array_column($info['order_items_info'], 'buyer_id'));
foreach ($buyer_ids as $v) {
$buyer_manager_email = $perm->getManager($v, 41); // 获取当前采购的上级主管邮箱,41-采购经理
$buyer_manager_email && $cc_send_mail_array = array_merge($cc_send_mail_array, $buyer_manager_email);
}
$perm->getSubDepartmentId(33, $department_ids); // 获取线上销售部所有小组(包含自己)
$is_online = $perm->checkUserDepartment($request->user->userId, $department_ids); // 检查当前客服是否属于线上销售部
$is_online && $cc_send_mail_array = array_merge($cc_send_mail_array, Config('config.joint_online_manager')); // 合并联营线上主管邮箱
$cc_send_mail_array = array_unique($cc_send_mail_array); // 去重
$kefu_manager_email = $perm->getManager($request->user->userId, 63); // 获取当前客服的上级主管邮箱,63-销售经理
$kefu_manager_email && $cc_send_mail_array = array_merge($cc_send_mail_array, $kefu_manager_email); // 合并上级主管邮箱
$cc_email_arr = [];
......@@ -2149,18 +2149,58 @@ Class OrderController extends Controller
$email && $cc_email_arr[] = $email;
}
}
$cc_send_mail_array = array_unique(array_merge($cc_send_mail_array, $cc_email_arr));
$data['ccUser'] = array_unique(array_merge($cc_send_mail_array, $cc_email_arr));
$data['combined'] = $info['order_info']['order_amount'];
$data['order_amount'] = $info['order_info']['order_amount'];
$data['date'] = date('Y-m-d',time());
$data['kefu_remark'] = $info['order_temp_info']['kefu_remark']; // 客服备注
$data['id'] = $sale_name;
$data['order_id'] = intval($id);
$data['operator_id'] = intval($request->user->userId);
$data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($data['toUser']).',抄送人邮箱:'.json_encode($data['ccUser']);
$this->pushQueue($data);
// $data['toUser'] = $request->user->email; // 收件人
// $data['ccUser'] = $cc_send_mail_array;
// $data['combined'] = $info['order_info']['order_amount'];
// $data['order_amount'] = $info['order_info']['order_amount'];
// $data['date'] = date('Y-m-d',time());
// $data['id'] = $sale_name;
// $data['order_id'] = intval($id);
// $data['operator_id'] = intval($request->user->userId);
// $data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($data['toUser']).',抄送人邮箱:'.json_encode($data['ccUser']);
// $this->pushQueue($data);
// 同步到ERP
$url = Config('website.api_domain').'order/sysiteminfo';
$resData['order_id'] = $id;
$resData['k1'] = time();
$resData['k2'] = md5(md5($resData['k1']).'fh6y5t4rr351d2c3bryi');
$temp = json_decode(curlApi($url, $resData, "POST"), true); // 连接API
if ($temp['err_code'] != 0) return ['errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']];
// 各个采购邮件推入队列
foreach ($send_buyers as $k => &$v) {
$v['combined'] = 0;
foreach ($v['data'] as $item) {
$v['combined'] += $item['totalPrice'];
}
// 若不属于自营采购部,则添加联营采购管理人员
if (!$perm->checkUserDepartment($k, 51)) {
$joint_purchase_manager = Config('config.joint_purchase_manager');
$cc_send_mail_array = array_merge($cc_send_mail_array, $joint_purchase_manager);
}
array_push($cc_send_mail_array, $request->user->email); // 默认抄送给当前客服
$cc_send_mail_array = array_unique($cc_send_mail_array);
$v['ccUser'] = $cc_send_mail_array;
$this->pushQueue($v);
}
// 添加操作日志
$event = '发送邮件成功,收件人邮箱:'.json_encode($to_user_array).',抄送人邮箱:'.json_encode($cc_send_mail_array);
$OrderActionLogModel = new OrderActionLogModel;
$OrderActionLogModel->addLog($id, $request->user->userId, 2, $event);
return ['errcode'=>0, 'errmsg'=>'推送到邮件队列成功,请稍等...'];
}
......
......@@ -518,5 +518,21 @@
return $user;
}
// 检查用户是否属于某部门
public function checkUserDepartment($userId, $department_id)
{
$map = [];
$map['userId'] = $userId;
if (is_array($department_id)) {
$str = implode(',', $department_id);
$map[] = [DB::raw("department_id in ({$str})"), '1'];
} else {
$map['department_id'] = $department_id;
}
return DB::table('user_info')->where($map)->select('userId')->first();
}
}
\ No newline at end of file
<?php
namespace App\Model\Bom;
use Illuminate\Database\Eloquent\Model;
class BomExtendModel extends Model{
protected $connection = 'bom'; //库名
protected $table = 'bom_extend';
protected $primaryKey = 'id'; //设置id
protected $guarded = ['id']; //设置字段黑名单
public $timestamps = true;
const CREATED_AT = 'create_time';
const UPDATED_AT = 'update_time';
protected $dateFormat = 'Y-m-d H:i:s';
// protected $dates = ['fcorder_time'];
public static $STATUS = [
1=>"正常",
2=>"删除",
];
public function fromDateTime($value){
return strtotime(parent::fromDateTime($value));
}
public function getFcorderTimeAttribute($value)
{
if($value > 0){
return date("Y-m-d h:i",$value);
}else{
return "";
}
}
}
\ No newline at end of file
<?php
namespace App\Model\Bom;
use Illuminate\Database\Eloquent\Model;
class BomItemMatchBaseModel extends Model{
protected $suffix = null;
// 设置表后缀
public function setSuffix($suffix)
{
$this->suffix = $suffix;
if ($suffix !== null) {
$this->table = $this->getTable() . '_' . $suffix;
}
}
// 提供一个静态方法设置表后缀
public static function suffix($suffix)
{
$instance = new static;
$instance->setSuffix($suffix);
return $instance->newQuery();
}
// 创建新的"chapters_{$suffix}"的模型实例并返回
public function newInstance($attributes = [], $exists = false)
{
$model = parent::newInstance($attributes, $exists);
$model->setSuffix($this->suffix);
return $model;
}
}
\ No newline at end of file
<?php
namespace App\Model\Bom;
class BomItemMatchExtendModel extends BomItemMatchBaseModel{
protected $connection = 'bom'; //库名
protected $table = 'bom_match_extend'; //库名
protected $primaryKey = 'id'; //设置id
protected $guarded = ['id']; //设置字段黑名单
public $timestamps = true;
const CREATED_AT = 'create_time';
const UPDATED_AT = null;
protected $dateFormat = 'Y-m-d H:i:s';
public function fromDateTime($value){
return strtotime(parent::fromDateTime($value));
}
public function get_bom_match_extend($bom_id,$matching_id){
return static::where(["bom_id"=>$bom_id,"matching_id"=>$matching_id])->first();
}
}
\ No newline at end of file
<?php
namespace App\Model\Bom;
class BomItemMatchModel extends BomItemMatchBaseModel{
protected $connection = 'bom'; //库名
protected $table = 'bom_item_matching'; //库名
protected $primaryKey = 'matching_id'; //设置id
protected $guarded = ['matching_id']; //设置字段黑名单
public $timestamps = true;
const CREATED_AT = 'add_time';
const UPDATED_AT = 'update_time';
protected $dateFormat = 'Y-m-d H:i:s';
public function fromDateTime($value){
return strtotime(parent::fromDateTime($value));
}
public function getBomAmount($bom_id){
$suffix = substr(strrev($bom_id),0,1);
return self::suffix($suffix)->where('bom_id', $bom_id)->where("status",1)->selectRaw("sum(price*number) as amount")->first();
}
public function getBomItemsMatching($bom_id,$bom_item_id){
$suffix = substr(strrev($bom_id),0,1);
return self::suffix($suffix)->where('bom_id', $bom_id)->where("bom_item_id",$bom_item_id)->where("status",1)->first();
}
public function updateBomMatch($bom_id,$where,$data){
$suffix = substr(strrev($bom_id),0,1);
return self::suffix($suffix)->where($where)->update($data);
}
public function addBomMatch($bom_id,$data){
$suffix = substr(strrev($bom_id),0,1);
return self::suffix($suffix)->insert($data);
}
public function bomExtend(){
return $this->belongsTo(\App\Model\Bom\BomExtendModel::class,"bom_id","bom_id");
}
/*
* 获取bom下单型号的数量
*/
public function countCOrderBomItems($is_kefu,$bom_sn,$begin_time,$end_time){
$count = 0;
for($i=0;$i<=9;$i++){
$query = self::suffix($i);
$query = $this->buildCountQuery($query,$is_kefu,$bom_sn,$begin_time,$end_time);
$count += $query->where(["is_corder"=>1])->count("matching_id");
}
return $count;
}
protected function buildCountQuery($query,$is_kefu,$bom_sn,$begin_time,$end_time){
$bom_id = 0;
if($bom_sn != ""){
$bom = BomModel::where("bom_sn",trim($bom_sn))->select("bom_id")->first();
$bom_id = $bom ? $bom->bom_id : 0;
}
if($bom_id > 0){
$query = $query->where(["bom_id"=>$bom_id]);
}
$begin_time = $begin_time ? strtotime($begin_time." 00:00:00") : 0;
$end_time = $end_time ? strtotime($end_time." 23:59:59") : 0;
if($begin_time){
if($end_time){
$query = $query->where('add_time',">=",$begin_time)->where('add_time',"<=",$end_time);
}else{
$query = $query->where('add_time',">=",$begin_time);
}
}elseif($end_time){
$query = $query->where('add_time',"<=",$end_time);
}
if($is_kefu == '0'){
$query = $query->whereDoesntHave("bomExtend",function ($query) {
$query->where('kefu_id', "!=",0);
});
}elseif($is_kefu == '1'){
$query = $query->whereHas("bomExtend",function ($query) {
$query->where('kefu_id', "!=",0);
});
}
return $query;
}
/*
* 获取bom提交BOM金额
* $type 1提交的bom金额 2下单的bom金额
*/
public function bomAmount($is_kefu,$bom_sn,$begin_time,$end_time,$type=0){
$amount = 0;
for($i=0;$i<=9;$i++){
$query = self::suffix($i);
$query = $this->buildCountQuery($query,$is_kefu,$bom_sn,$begin_time,$end_time);
if($type == 0){
$query = $query->where(["is_corder"=>0]);
}elseif($type == 1){
$query = $query->where(["is_corder"=>1]);
}
$sumamount = $query->selectRaw("sum(number*price) as sumamount")->first();
$amount += $sumamount ? $sumamount->sumamount : 0;
}
return $amount;
}
}
\ No newline at end of file
<?php
namespace App\Model\Bom;
class BomItemModel extends BomItemMatchBaseModel{
protected $connection = 'bom'; //库名
protected $table = 'bom_item'; //库名
protected $primaryKey = 'bom_item_id'; //设置id
protected $guarded = ['bom_item_id']; //设置字段黑名单
public $timestamps = true;
const CREATED_AT = 'add_time';
const UPDATED_AT = 'update_time';
protected $dateFormat = 'Y-m-d H:i:s';
public function fromDateTime($value){
return strtotime(parent::fromDateTime($value));
}
public function getBomAmount($bom_id){
$suffix = substr(strrev($bom_id),0,1);
return self::suffix($suffix)->where('bom_id', $bom_id)->where("status",1)->selectRaw("sum(price*number) as amount")->first();
}
public function getBomItems($request,$bom_id){
$page = $request->input("page",1);
$limit = $request->input("limit",10);
$suffix = substr(strrev($bom_id),0,1);
$query = self::suffix($suffix)->select("*")->where('bom_id', $bom_id)->where(["del_status"=>1]);
$query = $query->paginate($limit,[],'page',$page);
return $query;
}
public function bomExtend(){
return $this->belongsTo(\App\Model\Bom\BomExtendModel::class,"bom_id","bom_id");
}
/*
* 获取bom提交型号的数量
*/
public function countBomItems($is_kefu,$bom_sn,$begin_time,$end_time){
$count = 0;
for($i=0;$i<=9;$i++){
$query = self::suffix($i);
$bom_id = 0;
if($bom_sn != ""){
$bom = BomModel::where("bom_sn",trim($bom_sn))->select("bom_id")->first();
$bom_id = $bom ? $bom->bom_id : 0;
}
if($bom_id > 0){
$query = $query->where(["bom_id"=>$bom_id]);
}
$begin_time = $begin_time ? strtotime($begin_time." 00:00:00") : 0;
$end_time = $end_time ? strtotime($end_time." 23:59:59") : 0;
if($begin_time){
if($end_time){
$query = $query->where('add_time',">=",$begin_time)->where('add_time',"<=",$end_time);
}else{
$query = $query->where('add_time',">=",$begin_time);
}
}elseif($end_time){
$query = $query->where('add_time',"<=",$end_time);
}
if($is_kefu == '0'){
$query = $query->whereDoesntHave("bomExtend",function ($query) {
$query->where('kefu_id', "!=",0);
});
}elseif($is_kefu == '1'){
$query = $query->whereHas("bomExtend",function ($query) {
$query->where('kefu_id', "!=",0);
});
}
$count += $query->count("bom_item_id");
}
return $count;
}
}
\ No newline at end of file
<?php
namespace App\Model\Bom;
use Illuminate\Database\Eloquent\Model;
class BomModel extends BomItemMatchBaseModel{
protected $connection = 'bom'; //库名
protected $table = 'bom';
protected $primaryKey = 'bom_id'; //设置id
protected $guarded = ['bom_id']; //设置字段黑名单
public $timestamps = true;
const CREATED_AT = 'add_time';
const UPDATED_AT = 'update_time';
protected $dateFormat = 'Y-m-d H:i:s';
public static $STATUS = [
1=>"正常",
2=>"删除",
];
public function fromDateTime($value){
return strtotime(parent::fromDateTime($value));
}
public function scopeSearchByrole($query,$role_id="",$sale_ids=[]){
if($role_id ==1){
return $query;
}elseif($role_id ==2 && is_array($sale_ids) && !empty($sale_ids) && count($sale_ids) > 0){
array_push($sale_ids,0);
$wherein = implode(",",$sale_ids);
$query = $query->whereRaw("bom_id in (select bom_id from lie_bom_extend where kefu_id in ({$wherein}))");
}elseif($role_id ==3 && !is_array($sale_ids)){
$query = $query->whereRaw("bom_id in (select bom_id from lie_bom_extend where kefu_id = 0 or kefu_id = {$sale_ids})");
}
return $query;
}
public function scopeSearchByBomSn($query,$bom_sn=""){
if($bom_sn != ''){
$query = $query->where('bom_sn',trim($bom_sn));
}
return $query;
}
public function scopeSearchByBomName($query,$bom_name=""){
if($bom_name != ''){
$query = $query->where('bom_name',trim($bom_name));
}
return $query;
}
public function scopeSearchByIsCorder($query,$is_corder=""){
if($is_corder == "all" || $is_corder == "" ){
return $query;
}else{
$query = $query->where('is_corder',intval($is_corder));
}
return $query;
}
public function scopeSearchByUserNameOrKefu($query,$username="",$is_kefu='all'){
$username = trim($username);
$is_kefu = trim($is_kefu);
if($username == "" ){
if($is_kefu == '0'){
$query = $query->whereDoesntHave("bomExtend",function ($query) {
$query->where('kefu_id', "!=",0);
});
}elseif($is_kefu == '1'){
$query = $query->whereHas("bomExtend",function ($query) {
$query->where('kefu_id', "!=",0);
});
}
return $query;
}else{
$query = $query->whereHas("bomExtend",function ($query) use($username,$is_kefu) {
if($username){
$query->where('user_name', trim($username));
}
if($is_kefu == '0'){
$query->where('kefu_id', "=",0);
}elseif($is_kefu == '1'){
$query->where('kefu_id', "!=",0);
}
});
}
return $query;
}
public function scopeSearchByTime($query,$begin_time='',$end_time=''){
$begin_time = $begin_time ? strtotime($begin_time." 00:00:00") : 0;
$end_time = $end_time ? strtotime($end_time." 23:59:59") : 0;
if($begin_time){
if($end_time){
$query = $query->where('add_time',">=",$begin_time)->where('add_time',"<=",$end_time);
}else{
$query = $query->where('add_time',">=",$begin_time);
}
}elseif($end_time){
$query = $query->where('add_time',"<=",$end_time);
}
return $query;
}
public function scopeCreateUserId($query,$create_userid=0,$role=null,$create_username='',$userType=0){
if($userType == 1){
return $query->where('create_userid',1000);
}
if($create_userid && $role != 1){
$query = $query->where('create_userid',$create_userid);
}
if($create_username && $role == 1){
$query = $query->where('create_username',"like","%".trim($create_username)."%");
}
return $query;
}
public function bomExtend()
{
return $this->hasOne(\App\Model\Bom\BomExtendModel::class,"bom_id","bom_id");
}
}
\ No newline at end of file
<?php
namespace App\Model\Bom;
use Illuminate\Database\Eloquent\Model;
class BomOrderModel extends Model{
protected $connection = 'bom'; //库名
protected $table = 'bom_order';
protected $primaryKey = 'id'; //设置id
protected $guarded = ['id']; //设置字段黑名单
public $timestamps = true;
const CREATED_AT = 'create_time';
const UPDATED_AT = 'update_time';
protected $dateFormat = 'Y-m-d H:i:s';
// protected $dates = ['fcorder_time'];
public function fromDateTime($value){
return strtotime(parent::fromDateTime($value));
}
//获取bom单的 下单金额
public static function getBomOrderAmount($bom_id=0){
return static::where(["bom_id"=>$bom_id])->sum("add_order_amount");
}
//获取bom单的 下单单号
public static function getBomOrderSn($bom_id=0){
return static::where(["bom_id"=>$bom_id])->get()->pluck("order_sn");
}
}
\ No newline at end of file
......@@ -335,6 +335,7 @@ class OrderModel extends Model
'1' => '自采',
'2' => '立创',
'3' => '京北',
'4' => '油柑网',
);
$tmp = array();
......@@ -461,7 +462,7 @@ class OrderModel extends Model
$tmp[$i]['sale_type'] = $order[$i]['sale_type'] == 1 ? '现卖' : '预售';
// 自营其他业务类型
$tmp[$i]['business_type'] = $order[$i]['business_type'] ? Config('params.business_type')[$order[$i]['business_type']] : '正常订单';
$tmp[$i]['self_supplier_type'] = $self_supplier_type[$order[$i]['self_supplier_type']]; // 自采标记
$tmp[$i]['self_supplier_type'] = isset($self_supplier_type[$order[$i]['self_supplier_type']]) ? $self_supplier_type[$order[$i]['self_supplier_type']] : '未知'; // 自采标记
$tmp[$i]['sample_demand_desc'] = $order[$i]['sample_demand_desc']; // 样片项目需求描述
//收货地址的电话
$tmp[$i]['receiving_address'] = isset($current_order_addr['mobile']) ? $current_order_addr['mobile'] : '';
......
......@@ -23,6 +23,18 @@ return [
// 'zoe@ichunt.com',
],
// 联营线上销售
'joint_online_manager' => [
'ysx@ichunt.com',
// 'zhengjf@ichunt.com',
// 'zoe@ichunt.com',
],
// 联营采购负责人
'joint_purchase_manager' => [
'zty@ichunt.com',
],
'footstone_url' => 'http://footstone.liexin.net',
'auth_key' => 'LX@ichunt.com82560956-0755',
's_standard_brand' => 'StandardBrand', // 缓存key
......
<?php
return [
'admin' => ['admin@ichunt.com'],
'login' => [
'login' => 'http://' . env('LOGIN_DOMAIN', '') . '/login',
'logout'=> 'http://' . env('LOGIN_DOMAIN', '') . '/logout',
'check' => 'http://' . env('LOGIN_DOMAIN', '') . '/api/checklogin',
'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search',
],
'domain' => 'liexin.net',
// 订单系统
'order_url' => 'http://order.liexin.net',
// API项目
'api_domain' => 'http://api.liexin.com/',
'upload_key' => 'fh6y5t4rr351d2c3bryi', // 上传文件key
// 权限系统
'perm_url' => 'http://perm.liexin.net',
// 获取用户权限接口
'perm_api' => 'http://perm.liexin.net/api/perms/',
// 获取用户许可权限接口
'check_access_api' => 'http://perm.liexin.net/api/perms/access',
// 竞调账户配置显示时间
'vp_time_set' => '2018-05-01',
// 基石服务地址
'SERVICE_DOMAIN' => 'http://192.168.1.100',
//中间服务秘钥
'SERVICE_KEY' => 'j9q##VRhaXBEtznIEeDiR@1Hvy0sW3wp',
// 快递配置
'express_fee_key' => 'express_fee',
'express_fee' => [
'sz_inside' => 10,
'gd_inside' => 10,
'gd_outside' => 15,
],
// www站点
'main_url' => 'https://www.liexin.com/',
// 新增自营线下订单内部账号
'internal-account' => '15011111111',
// 新增用户入口
'add-user-url' => 'http://member.liexin.net/add',
// 编辑用户入口
'check-user-url' => 'http://member.liexin.net/list',
// 查询SKUID接口
// 'search-skuid' => 'http://footstone.liexin.net/webapi/sku_list',
// 'search-skuid' => 'http://www.liexin.com/v3/sku/list',
'search-skuid' => 'http://api.liexin.com/goods/detail',
// 新增SKU入口
'add-sku-url' => 'http://footstone.liexin.net/manage/addsku',
// 查询联营SKU入口
'search-sku-url-1' => 'http://footstone.liexin.net/manage/skulist',
// 查询自营SKU入口
'search-sku-url-2' => 'http://footstone.liexin.net/manage/GoodsList',
// 新增自营线上订单付款地址
'pay_online_url' => 'http://www.liexin.com/v3/pay/online?id=',
// 获取自营商品库存
'self-stock-url' => 'http://footstone.liexin.net/webapi/goods_details?sku_id=',
// 财务系统接口地址 (自营发票)
'finance-self-invoice-url' => 'http://192.168.1.97/webapi/checkOrderBillStatus',
// 支付地址
'pay_url' => 'https://www.liexin.com/v3/pay/online?id=',
// 订单微服务
'order_api_domain' => 'http://orderapi.liexin.com',
// crm
'crm_domain' => 'http://lcrm.liexin.net',
// 导出系统
'export_url' => 'http://export.liexin.com',
'export_joint_source_id' => 16,
'export_self_source_id' => 17,
];
<?php
return [
'admin' => ['admin@ichunt.com'],
'login' => [
'login' => 'http://' . env('LOGIN_DOMAIN', '') . '/login',
'logout'=> 'http://' . env('LOGIN_DOMAIN', '') . '/logout',
'check' => 'http://' . env('LOGIN_DOMAIN', '') . '/api/checklogin',
'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search',
],
'domain' => 'liexin.net',
// 订单系统
'order_url' => 'http://order.liexin.net',
// API项目
'api_domain' => 'http://api.liexin.com/',
'upload_key' => 'fh6y5t4rr351d2c3bryi', // 上传文件key
// 权限系统
'perm_url' => 'http://perm.liexin.net',
// 获取用户权限接口
'perm_api' => 'http://perm.liexin.net/api/perms/',
// 获取用户许可权限接口
'check_access_api' => 'http://perm.liexin.net/api/perms/access',
// 竞调账户配置显示时间
'vp_time_set' => '2018-05-01',
// 基石服务地址
'SERVICE_DOMAIN' => 'http://192.168.1.100',
//中间服务秘钥
'SERVICE_KEY' => 'j9q##VRhaXBEtznIEeDiR@1Hvy0sW3wp',
// 快递配置
'express_fee_key' => 'express_fee',
'express_fee' => [
'sz_inside' => 10,
'gd_inside' => 10,
'gd_outside' => 15,
],
// www站点
'main_url' => 'https://www.liexin.com/',
// 新增自营线下订单内部账号
'internal-account' => '15011111111',
// 新增用户入口
'add-user-url' => 'http://member.liexin.net/add',
// 编辑用户入口
'check-user-url' => 'http://member.liexin.net/list',
// 查询SKUID接口
// 'search-skuid' => 'http://footstone.liexin.net/webapi/sku_list',
// 'search-skuid' => 'http://www.liexin.com/v3/sku/list',
'search-skuid' => 'http://api.liexin.com/goods/detail',
'search-skuid-finalInfo' => 'http://api.liexin.com/cart/bomOrderGetFinalGoods',
//自营订单添加购物车
'addzyorder_url' => 'http://api.liexin.com/cart/addBatch',
//联营加入购物车
'addlyorder_url' => 'http://api.liexin.com/cart/addBatchByOrderSystem',
//bom创建订单
'api_create_order' => 'http://api.liexin.com/order/create',
// 新增SKU入口
'add-sku-url' => 'http://footstone.liexin.net/manage/addsku',
// 查询联营SKU入口
'search-sku-url-1' => 'http://footstone.liexin.net/manage/skulist',
// 查询自营SKU入口
'search-sku-url-2' => 'http://footstone.liexin.net/manage/GoodsList',
// 新增自营线上订单付款地址
'pay_online_url' => 'http://www.liexin.com/v3/pay/online?id=',
// 获取自营商品库存
'self-stock-url' => 'http://footstone.liexin.net/webapi/goods_details?sku_id=',
// 财务系统接口地址 (自营发票)
'finance-self-invoice-url' => 'http://192.168.1.97/webapi/checkOrderBillStatus',
// 支付地址
'pay_url' => 'https://www.liexin.com/v3/pay/online?id=',
// 订单微服务
'order_api_domain' => 'http://orderapi.liexin.com',
// crm
'crm_domain' => 'http://lcrm.liexin.net',
// 导出系统
'export_url' => 'http://export.liexin.com',
'export_joint_source_id' => 16,
'export_self_source_id' => 17,
];
......@@ -4,6 +4,48 @@
$.extend($.lie, {
audit: {
index:function() {
// 申请主管审核
$('.apply-manager-audit').click(function() {
var order_id = $(this).data('id');
// 弹出提示
layer.open({
area: ['360px'],
title: '提示信息',
content: '确定申请主管审核吗?',
btn:['确定', '取消'],
yes: function(index, layero){
$.ajax({
url : '/ajaxApplyManagerAudit',
type: 'post',
data: {order_id: order_id},
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
return false;
}
layer.alert(resp.errmsg);
return false;
},
error: function (res) {
console.log(res);
}
})
layer.msg('申请中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2: function(index, layero){
layer.close(index);
}
});
})
// 主管审核
$('.manager-audit').click(function() {
var order_id = $(this).data('id');
......
......@@ -140,6 +140,8 @@
layer.alert('网络异常');
}
});
layer.msg('提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2:function(index){
layer.close(index);
......
layui.use(['form', 'table', 'laydate'], function(){
var form = layui.form;
var table = layui.table;
var laydate = layui.laydate;
laydate.render({
elem: '#begin_time' //指定元素
});
laydate.render({
elem: '#end_time' //指定元素
});
var renderTable = function () {
table.render({
id: 'list'
,elem: '#list'
,url: '/ajax/bom/BomList' //数据接口
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: true //开启分页
,cols: [[ //表头
{title: 'id',field: 'bom_id', fixed: 'left', width: 80}
,{field: 'add_time', title: '创建时间', width: 180}
,{field: 'bom_name', title: 'BOM名称', width: 160}
,{templet: '<div>{{d.bom_extend ? d.bom_extend.user_name : ""}}</div>', title: '会员账号', width: 180}
,{templet: '<div>{{d.bom_extend ? d.bom_extend.company_name : ""}}</div>', title: '公司名称', width: 160}
,{field:'bomMoney', title: 'BOM单金额', width: 130}
,{field: 'is_corder', title: '是否下单', templet: '#is_corder', width: 150}
,{field: '', title: '对应订单编号', width: 120,templet:"#bomCOrderSn"}
,{field: 'bomCOrderAmount', title: '下单金额', width: 150}
,{templet: '<div>{{d.bom_extend ? d.bom_extend.fcorder_time : ""}}</div>', title: '首次下单时间', width: 180}
,{templet: '<div>{{d.bom_extend ? d.bom_extend.kefu_name : ""}}</div>', title: '客服', width: 150}
,{field: 'status', title: '状态', templet: '#status', width: 150}
,{field: 'join_time', title: '操作',toolbar: '#action',width:130,fixed: 'right',}
]]
,limit: 10
,limits: [10, 20, 50,]
});
};
renderTable();
form.on('submit(load)', function(data) {
//执行重载
table.reload('list', {
page: {
curr: 1
}
,where: data.field
});
return false;
});
$('.add').click(function() {
layer.open({
area: ['400px', '200px'],
title: '新增客服',
type: 1,
content: $('#kefu-action'),
btn: ['确认', '取消'],
yes: function(index) {
var email = $('.kefu-email').val();
if (!email) {
layer.tips('请输入邮箱', $('.kefu-email'));
return false;
}
$.ajax({
url : '/api/ApiAddKefu',
type: 'post',
data: {email: email},
dataType: 'json',
success: function(resp) {
if (resp.errcode == 0) {
layer.close(index);
layer.msg(resp.errmsg);
renderTable(); // 重新加载table
return false;
}
layer.msg(resp.errmsg);
},
error: function(err) {
console.log(err)
}
})
layer.msg('新增客服中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
return false;
},
cancel: function(index) {
layer.close(index);
}
})
$('.kefu-email').val('');
})
// tool操作
table.on('tool(kefu)', function(obj){ //注:tool是工具条事件名,test是table原始容器的属性lay-filter="对应的值"
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
var url = '';
var title = '';
var content = '';
var datax = {};
datax.id = data.id;
if(layEvent === 'edit') {
url = '/api/ApiEditKefu';
title = '编辑客服';
content = $('#kefu-action');
} else if (layEvent === 'del') {
url = '/api/ApiDelKefu';
title = '删除客服';
content = '<div style="margin: 40px;">确定删除该客服吗?</div>';
datax.status = data.status;
} else if (layEvent === 'top') {
url = '/api/ApiTopKefu';
title = '置顶客服';
content = '<div style="margin: 40px;">确定置顶该客服吗?</div>';
}
layer.open({
area: ['400px', '200px'],
title: title,
type: 1,
content: content,
btn: ['确认', '取消'],
yes: function(index) {
if (layEvent == 'edit') {
var email = $('.kefu-email').val();
if (!email) {
layer.tips('请输入邮箱', $('.kefu-email'));
return false;
}
datax.email = email;
}
$.ajax({
url : url,
type: 'post',
data: datax,
dataType: 'json',
success: function(resp) {
if (resp.errcode == 0) {
layer.close(index);
layer.msg(resp.errmsg);
renderTable(); // 重新加载table
return false;
}
layer.msg(resp.errmsg);
},
error: function(err) {
console.log(err)
}
})
layer.msg(title+'中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
return false;
},
cancel: function(index) {
layer.close(index);
}
})
if (layEvent == 'edit') {
$('.kefu-email').val(data.email);
}
});
});
\ No newline at end of file
layui.use(['form', 'table', 'laydate'], function() {
var form = layui.form;
var table = layui.table;
var laydate = layui.laydate;
//时间选择器
laydate.render({
elem: '#begin_time' //指定元素
});
laydate.render({
elem: '#end_time' //指定元素
});
function initDataCount(datax){
$.post("/ajax/bom/bomReportCount",datax,function(res){
if(res.errcode == 0){
$.each(res.data,function(k,v){
$("#"+k).text(v);
})
}
})
}
initDataCount({});
$("#test1_button").click(function(){
var aa = $("#test1_form").serialize()
initDataCount(aa)
})
})
\ No newline at end of file
layui.use(['form', 'table', 'laydate'], function() {
var form = layui.form;
var table = layui.table;
var laydate = layui.laydate;
//转换静态表格
table.init('bomView', {
limit:10
,url: '/ajax/bom/BomView?bom_id='+bom_id //数据接口
,toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
,defaultToolbar:[]
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: true //开启分页
});
function renderTable(){
table.init('bomView', {
limit:10
,url: '/ajax/bom/BomView?bom_id='+bom_id //数据接口
,toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
,defaultToolbar:[]
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: true //开启分页
});
}
form.on('checkbox(checkall)', function (data) {
var child = $(data.elem).parents('.layui-tab-item').find('input[type="checkbox"]');
child.each(function (index, item) {
item.checked = data.elem.checked;
});
form.render('checkbox');
});
//监听单元格编辑
table.on('edit(bomView)', function(obj){
var value = obj.value //得到修改后的值
,data = obj.data //得到所在行所有键值
,field = obj.field; //得到字段
if(field != "match_goods_id"){
obj.data.match_goods_id = 0;
obj.update(data) //修改当前行数据
}
});
function save_form_ajax(datax){
layer.open({
title: "保存bom单",
content: "你确定保存吗?",
btn: ['确认?', '取消'],
yes: function(index) {
layer.close(index);
$.ajax({
url : "/ajax/bom/saveBomInfo",
type: 'post',
data: datax,
success: function(resp) {
if (resp.errcode == 0) {
layer.msg(resp.errmsg);
renderTable(); // 重新加载table
}else{
layer.alert(resp.errmsg);
}
},
error: function(err) {
console.log(err)
}
})
layer.msg('请耐心等待....', {icon: 16, time: 5000, shade: 0.3})
return false;
},
cancel: function(index) {
layer.close(index);
}
})
}
function create_order_ajax(datax){
layer.open({
title: "创建bom订单",
content: "你确定下单吗?",
btn: ['确认?', '取消'],
yes: function(index) {
layer.close(index);
$.ajax({
url : "/ajax/bom/createBomOrder",
type: 'post',
data: datax,
success: function(resp) {
if (resp.errcode == 0) {
layer.alert(resp.errmsg);
//return
renderTable(); // 重新加载table
}else{
layer.alert(resp.errmsg);
}
},
error: function(err) {
console.log(err)
}
})
layer.msg('请耐心等待....', {icon: 16, time: 10000, shade: 0.3})
return false;
},
cancel: function(index) {
layer.close(index);
}
})
}
//头工具栏事件
table.on('toolbar(bomView)', function(obj){
var checkStatus = table.checkStatus("layui_table_bomView");
var data = checkStatus.data;
if(checkStatus.data.length <= 0){
layer.msg('请先选择需要保存的数据行', {icon: 16, time: 3000, shade: 0.3})
return
}
var datax = {}
datax.data = data
switch(obj.event){
case 'create_order':
create_order_ajax(datax);
break;
case 'save_form':
save_form_ajax(datax)
break;
};
});
})
\ No newline at end of file
......@@ -15,7 +15,7 @@
<div class="tabs-box">
<div class="order-change-main">
@if (($order_info['order_goods_type'] == 1 && $order_info['status'] == 1) || ($order_info['order_goods_type'] == 2 && $order_info['adjust_count'] < 2))
@if (($order_info['order_goods_type'] == 1 && in_array($order_info['status'], [1, 2]) && $order_temp_info['is_manager_audit'] != 3) || ($order_info['order_goods_type'] == 2 && $order_info['adjust_count'] < 2))
<form id="checkOrderForm" class="form-horizontal table-responsive">
<input type="hidden" name="auditor_role" value="{{ $role }}" >
<input type="hidden" name="order_sn" value="{{$order_info['order_sn']}}">
......@@ -417,7 +417,7 @@
</form>
@endif
@if (($order_info['order_goods_type'] == 1 && $order_info['status'] == 2) || ($order_info['order_goods_type'] != 1 && $order_info['adjust_count'] == 2))
@if (($order_info['order_goods_type'] == 1 && $order_info['status'] == 2 && $order_temp_info['is_manager_audit'] == 3) || ($order_info['order_goods_type'] == 2 && $order_info['status'] == 2 && $order_info['adjust_count'] == 2))
<div class="checked_section">
<div class="checked_left">
<p>交易状态:&nbsp;审核通过,请联系客户及时付款!
......
......@@ -157,20 +157,25 @@
@endif
@if (in_array('check_order', $userPerms) && $order_info['sale_id'])
@if ($order_info['status'] == 1)
@if (isset($order_temp_info['is_manager_audit']) && $order_temp_info['is_manager_audit'] != 3 && in_array($order_info['status'], [1, 2]))
<a class="btn btn-success" href="{{URL('change', ['order_id'=>$order_info['order_id']])}}" target="_blank">人工审单</a>
@elseif ($order_info['status'] == 2 && in_array($role, [1, 2]))
@elseif ($order_info['status'] == 2 && $order_temp_info['is_manager_audit'] == 3 && in_array($role, [1, 2]))
<a class="btn btn-success re-audit" data-id="{{$order_info['order_id']}}">反审</a>
@endif
@endif
<!-- 申请主管审核 -->
@if (isset($order_temp_info['is_manager_audit']) && $order_temp_info['is_manager_audit'] == 1 && $order_info['status'] == 2)
<a class="btn btn-info apply-manager-audit" data-id="{{$order_info['order_id']}}">申请主管审核</a>
@endif
<!-- 主管审核 -->
@if ($order_temp_info['is_manager_audit'] && in_array($role, [1, 2]) && $order_info['status'] == 1)
@if (isset($order_temp_info['is_manager_audit']) && (($order_info['status'] == 2 && $order_temp_info['is_manager_audit'] == 2) || ($order_info['status'] > 2 && $order_temp_info['is_manager_audit'] != 3)) && in_array($role, [1, 2]) && empty($order_temp_info['erp_sn']))
<a class="btn btn-danger manager-audit" data-id="{{$order_info['order_id']}}">主管审核</a>
@endif
<!-- 判断邮件发送时机 -->
@if (!empty($order_temp_info['erp_sn']) )
@if (!empty($order_temp_info['erp_sn']) && in_array($order_info['status'], [2, 3, 4]))
<a class="btn btn-primary send_mail" data-id="{{ $order_info['order_id'] }}">发送邮件</a>
@endif
<!-- 预付款 管理员完成首款对账后改变'对账'按钮 -->
......
<style>
.action_log_event{ word-break: break-all; }
</style>
<p>操作记录</p>
<div class="tabs-box table-responsive">
<table class="table table-bordered table-hover">
......@@ -14,13 +18,13 @@
<tr>
<td width="15%"><?= date('Y-m-d H:i:s', $v->create_time) ?></td>
<td width="10%"><?= App\Http\Controllers\getOperatorName($v->operator_id, $v->operator_type) ?></td>
<td><?= $v->event ?></td>
<td class="action_log_event"><?= $v->event ?></td>
</tr>
<?php } else { ?>
<tr class="other-infos">
<td width="15%"><?= date('Y-m-d H:i:s', $v->create_time) ?></td>
<td width="10%"><?= App\Http\Controllers\getOperatorName($v->operator_id, $v->operator_type) ?></td>
<td><?= $v->event ?></td>
<td class="action_log_event"><?= $v->event ?></td>
</tr>
<?php } ?>
......
......@@ -30,12 +30,12 @@
<th>发货状态</th>
<th>物流单号</th>
<th>京东订单编号</th>
<th width="8%">自动确认收货时间</th>
<th>自动确认收货时间</th>
</tr>
<tr>
<td>{{ $order_info['order_sn'] }}</td>
<td>{{ $order_temp_info['is_manager_audit'] ? '待主管审核' : Config('params.order_status')[$order_info['status']] }}</td>
<td>{{ Config('params.order_status')[$order_info['status']] }}</td>
<td>{{ $user_info['mobile'] ? $user_info['mobile'] : $user_info['email'] }}</td>
<td>
<?php
......
......@@ -146,7 +146,7 @@
<td>
<!-- <button type="button" class="btn btn-success btn-xs remarks">编辑</button> -->
<?php if (in_array($order_info['status'], [1, 2, 3]) && $v['status'] == 1) { ?>
<?php if (in_array($order_info['status'], [1, 2, 3, 4]) && $v['status'] == 1) { ?>
<button type="button" class="btn btn-success btn-xs edit-item" data-id="<?= $v['rec_id'] ?>" data-batch="<?= $v['batch'] ?>" data-bid="<?= $v['buyer_id'] ?>" data-remarks="<?= $v['remarks'] ?>">编辑</button>
<?php } ?>
</td>
......
......@@ -25,9 +25,9 @@
<tr class="caption">
<th colspan="8" style="text-align: center; background: #f9f9f9;"> 发票信息
<?php
//<!-- 发票状态小于2(已发货)且更改权限存在 显示按钮 -->
if (!isset($tags)) {
if(in_array($order_info['status'], [1, 2, 3, 4]) && $order_invoice_info['invoice_status'] < 2 && in_array('update_invoice', $userPerms)) {
//<!-- 发票状态小于2(已发货)且更改权限存在 且未同步ERP 显示按钮 -->
if (empty($tags)) {
if(in_array($order_info['status'], [1, 2, 3, 4]) && $order_invoice_info['invoice_status'] < 2 && in_array('update_invoice', $userPerms) && empty($order_temp_info['erp_sn'])) {
echo '<a href="/changeInvoice/'.$order_info['order_id'].'" class="btn btn-success btn-sm changeBtn">更改发票</a>';
}
} elseif ($order_info['status'] != -1 && isset($tags) && $tags == 'self' && isset($extend) && !$extend) {
......
......@@ -12,7 +12,7 @@
<script src="/js/md5.js"></script>
<script src="/js/layui/layui.js"></script>
<script src="/js/details.js?v=<?= time() ?>"></script>
<script src="/js/order_audit.js"></script>
<script src="/js/order_audit.js?v=<?= time() ?>"></script>
<script src="/js/order_track.js"></script>
<script src="/js/order_cancel.js"></script>
<script src="/js/order_send_email.js"></script>
......
......@@ -250,6 +250,7 @@
<th class="pl30">ERP单号</th>
<th class="pl30">应付金额</th>
<th class="pl30">订单状态</th>
<th class="pl30">主管审核</th>
<th class="pl30">付款类型</th>
<th class="pl30">支付方式</th>
<th class="pl30">业务员</th>
......@@ -288,24 +289,36 @@
?>
</td>
<td class="show-list">
<?php
if (!empty($order_extend->is_manager_audit) && $v['status'] == 1) {
echo '<span class="list-text-checking"><b>待主管审核</b></span>';
} else {
switch ($v['status']) {
case -2: echo '<span class="list-text-no-check"><b>审核未通过</b></span>';break;
case -1: echo '<span class="list-text-cancel"><b>已取消</b></span>';break;
case 1: echo '<span class="list-text-checking"><b>待审核</b></span>';break;
case 2: echo '<span class="list-text-pay"><b>待付款</b></span>';break;
case 3: echo '<span class="list-text-last-pay"><b>待付尾款</b></span>';break;
case 4: echo '<span class="list-text-send"><b>待发货</b></span>';break;
case 7: echo '<span class="list-text-send"><b>部分发货</b></span>';break;
case 8: echo '<span class="list-text-confirm"><b>待收货</b></span>';break;
case 10: echo '<span class="list-text-success"><b>交易成功</b></span>';break;
}
}
<?php
switch ($v['status']) {
case -2: echo '<span class="list-text-no-check"><b>审核未通过</b></span>';break;
case -1: echo '<span class="list-text-cancel"><b>已取消</b></span>';break;
case 1: echo '<span class="list-text-checking"><b>待审核</b></span>';break;
case 2: echo '<span class="list-text-pay"><b>待付款</b></span>';break;
case 3: echo '<span class="list-text-last-pay"><b>待付尾款</b></span>';break;
case 4: echo '<span class="list-text-send"><b>待发货</b></span>';break;
case 7: echo '<span class="list-text-send"><b>部分发货</b></span>';break;
case 8: echo '<span class="list-text-confirm"><b>待收货</b></span>';break;
case 10: echo '<span class="list-text-success"><b>交易成功</b></span>';break;
}
?>
</td>
<td class="show-list">
<?php
if ($v['status'] >= 1 && isset($order_extend->is_manager_audit)) {
switch ($order_extend->is_manager_audit) {
case 1:
echo '<span class="list-text-checking"><b>未申请</b></span>';break;
case 2:
echo '<span class="list-text-checking"><b>待审核</b></span>';break;
case 3:
echo '<span class="list-text-success"><b>已审核</b></span>';break;
default:
echo ''; break;
}
}
?>
</td>
<td class="show-list"> {{ Config('params.order_pay_type')[$v['order_pay_type']] }} </td>
<td class="show-list"><?php print_r(App\Http\Controllers\getPayName($v['order_id'])); ?></td>
......@@ -331,19 +344,24 @@
<td>
<div class="btn-group btn-group-xs" style="min-width: 200px;">
@if (in_array('check_order', $userPerms) && $v['sale_id'])
@if ($v['status'] == 1)
@if (isset($order_extend->is_manager_audit) && $order_extend->is_manager_audit != 3 && in_array($v['status'], [1, 2]))
<a class="btn btn-success" href="{{URL('change', ['order_id'=>$v['order_id']])}}" target="_blank">人工审单</a>
@elseif ($v['status'] == 2 && in_array($role, [1, 2]))
@elseif ($v['status'] == 2 && $order_extend->is_manager_audit == 3 && in_array($role, [1, 2]))
<a class="btn btn-success re-audit" data-id="{{$v['order_id']}}">反审</a>
@endif
@endif
<!-- 主管审核 -->
@if (isset($order_extend->is_manager_audit) && in_array($role, [1, 2]) && $v['status'] == 1)
<!-- 申请主管审核 -->
@if (isset($order_extend->is_manager_audit) && $order_extend->is_manager_audit == 1 && $v['status'] == 2)
<a class="btn btn-info apply-manager-audit" data-id="{{$v['order_id']}}">申请主管审核</a>
@endif
<!-- 主管审核 (待付款且待主管审核 || 已付款且主管未审核) && 主管角色 && 未同步 -->
@if (isset($order_extend->is_manager_audit) && (($v['status'] == 2 && $order_extend->is_manager_audit == 2) || ($v['status'] > 2 && $order_extend->is_manager_audit != 3)) && in_array($role, [1, 2]) && empty($order_extend->erp_sn))
<a class="btn btn-danger manager-audit" data-id="{{$v['order_id']}}">主管审核</a>
@endif
@if (!empty($order_extend->erp_sn))
@if (!empty($order_extend->erp_sn) && in_array($v['status'], [2, 3, 4]))
<a class="btn btn-warning send_mail" data-id="{{ $v['order_id'] }}">发送邮件</a>
@endif
......
......@@ -11,7 +11,7 @@
<script src="/js/common.js"></script>
<script src="/js/layui/layui.js"></script>
<script src="/js/list.js?v=<?= time() ?>"></script>
<script src="/js/order_audit.js"></script>
<script src="/js/order_audit.js?v=<?= time() ?>"></script>
<script src="/js/order_track.js"></script>
<script src="/js/order_cancel.js"></script>
<script src="/js/order_send_email.js"></script>
......
<form class="layui-form layui-box" method="post">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">BOM名称</label>
<div class="layui-input-inline">
<input type="text" name="bom_name" placeholder="填写BOM名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">创建用户</label>
<div class="layui-input-inline">
<input type="text" name="username" placeholder="填写创建用户" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">创建日期:</label>
<div class="layui-input-inline">
<input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">是否下单</label>
<div class="layui-input-inline">
<select name="is_corder" lay-verify="" lay-search>
<option value="">全部</option>
<option value="1"></option>
<option value="0"></option>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">客服</label>
<div class="layui-input-inline">
<select name="is_kefu" lay-verify="" lay-search>
<option value="all">全部</option>
<option value="1"></option>
<option value="0"></option>
</select>
</div>
</div>
<div class="layui-inline" style="text-align: center;">
<button lay-submit lay-filter="load" class="layui-btn" data-type="search">搜索</button>
<!-- <button type="button" class="layui-btn layui-btn-normal export">导出</button> -->
</div>
</div>
</form>
<table id="list" lay-filter="list"></table>
<script type="text/html" id="action">
{{--<a class="btn btn-xs btn-outline btn-success" href="/web/showTemplate?t_id=@{{ d.bom_id }}" target="_blank" lay-event="show">下载</a>--}}
<a class="btn btn-xs btn-outline btn-success" href="/web/BomView?bom_id=@{{ d.bom_id }}" target="_blank" lay-event="show">详情</a>
</script>
<script type="text/html" id="status">
@{{# if (d.status == 1) { }}
<div style="color:green;">正常</div>
@{{# } else { }}
<div style="color:#ccc;">删除</div>
@{{# } }}
</script>
<script type="text/html" id="is_corder">
@{{# if (d.is_corder == 1) { }}
<div style="color:green;">已下单</div>
@{{# } else { }}
<div style="color:#ccc;">未下单</div>
@{{# } }}
</script>
<script type="text/html" id="kefu_name">
@{{# d.bom_extend.kefu_name }}
</script>
<script type="text/html" id="bomCOrderSn">
@{{# if (d.bomCOrderSn) { }}
@{{ d.bomCOrderSn.join(",")}}
@{{# } }}
</script>
<div class="layui-col-md12" style="padding-bottom: 15px">
<h3>数据概况</h3>
<hr>
<form class="layui-form layui-box" id="test1_form" method="post">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">BOM单号</label>
<div class="layui-input-inline">
<input type="text" name="bom_sn" placeholder="填写BOM单号" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">创建日期:</label>
<div class="layui-input-inline">
<input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">客服</label>
<div class="layui-input-inline">
<select name="is_kefu" lay-verify="" lay-search>
<option value="all">全部</option>
<option value="1"></option>
<option value="0"></option>
</select>
</div>
</div>
<div class="layui-inline" style="text-align: center;">
<a id="test1_button" class="layui-btn" >搜索</a>
<!-- <button type="button" class="layui-btn layui-btn-normal export">导出</button> -->
</div>
</div>
</form>
<div class="layui-card-body">
<table class="layui-table" id="dataCont">
<tr>
<th lay-data="">提交BOM单数量</th>
<th lay-data="">BOM单数量</th>
{{--<th lay-data="">BOM付款数量</th>--}}
<th lay-data="">提交型号数</th>
<th lay-data="">下单型号数</th>
{{--<th lay-data=>付款型号数</th>--}}
<th lay-data=>提交BOM金额</th>
<th lay-data=>下单BOM金额</th>
<th >无结果型号</th>
<th>询价型号数</th>
</tr>
<tr>
<th id="field1"></th>
<th id="field2"></th>
{{--<th id="field3"></th>--}}
<th id="field4"></th>
<th id="field5"></th>
{{--<th id="field6"></th>--}}
<th id="field7"></th>
<th id="field8"></th>
<th id="field10"></th>
<th id="field11"></th>
</tr>
</table>
</div>
</div>
{{--<div class="layui-card" style="">--}}
{{--<h3>用户数据</h3>--}}
{{--<hr>--}}
{{--<form class="layui-form layui-box" id="test5" method="post">--}}
{{--<div class="layui-form-item">--}}
{{--<div class="layui-inline">--}}
{{--<label class="layui-form-label">创建日期:</label>--}}
{{--<div class="layui-input-inline">--}}
{{--<input type="text" name="begin_time" value="" autocomplete="off" placeholder="选择开始时间" class="layui-input" id="begin_time" readonly>--}}
{{--</div>--}}
{{--<div class="layui-form-mid">-</div>--}}
{{--<div class="layui-input-inline">--}}
{{--<input type="text" name="end_time" value="" autocomplete="off" placeholder="选择结束时间" class="layui-input" id="end_time" readonly>--}}
{{--</div>--}}
{{--</div>--}}
{{--<div class="layui-inline">--}}
{{--<label class="layui-form-label">客服</label>--}}
{{--<div class="layui-input-inline">--}}
{{--<select name="is_kefu" lay-verify="" lay-search>--}}
{{--<option value="all">全部</option>--}}
{{--<option value="1"></option>--}}
{{--<option value="0"></option>--}}
{{--</select>--}}
{{--</div>--}}
{{--</div>--}}
{{--<div class="layui-inline" style="text-align: center;">--}}
{{--<button class="layui-btn" data-type="search">搜索</button>--}}
{{--<!-- <button type="button" class="layui-btn layui-btn-normal export">导出</button> -->--}}
{{--</div>--}}
{{--</div>--}}
{{--</form>--}}
{{--</div>--}}
<style>
::-webkit-scrollbar-track-piece {
-webkit-border-radius: 0
}
::-webkit-scrollbar {
width: 5px;
height: 10px
}
::-webkit-scrollbar-thumb {
height: 50px;
background-color: #b8b8b8;
-webkit-border-radius: 6px;
outline-offset: -2px;
filter: alpha(opacity = 50);
-moz-opacity: 0.5;
-khtml-opacity: 0.5;
opacity: 0.5
}
::-webkit-scrollbar-thumb:hover {
height: 50px;
background-color: #878987;
-webkit-border-radius: 6px;
}
</style>
<table class="layui-table" lay-filter="bomView" id="layui_table_bomView">
<thead>
<tr>
<th lay-data="{fixed: 'left',templet:'#checkbd'}"><input type="checkbox" >全选</th>
<th lay-data="{type:'numbers', width:80, sort: true,fixed: 'left'}">序号</th>
<th lay-data="{field:'goods_name', width:150}">需求型号</th>
<th lay-data="{field:'brand_name',width:140,}">品牌</th>
<th lay-data="{field:'number',width:120,}">需求数量</th>
<th lay-data="{field:'attrs',width:120,}">参数</th>
<th lay-data="{field: 'match_goods_id',width:150,edit:'text'}">skuID(可修改)</th>
<th lay-data="{field: 'match_goods_name',width:200,edit:'text'}">推荐型号(可修改)</th>
<th lay-data="{field: 'match_brand_name',width:200,edit:'text'}">推荐品牌(可修改)</th>
<th lay-data="{field:'match_number', width:130,edit:'text'}"><i class="layui-icon-edit"></i>推荐数量(可修改)</th>
<th lay-data="{field:'match_price',width:130,edit:'text'}">单价(可修改)</th>
<th lay-data="{field:'match_delivery',width:160,edit:'text'}">货期/天(可修改)</th>
<th lay-data="{field:'match_supplier_name',edit:'text',width:160}">供应商(可修改)</th>
<th lay-data="{field:'match_mpq'}">包装</th>
<th lay-data="{field:'match_moq'}">起订量</th>
<th lay-data="{field:'match_amount',width:100}">小计</th>
<th lay-data="{field:'is_corder',templet: '#match_ic_corder',width:100}">是否下单</th>
{{--<th lay-data="{field:'bom_match_extend',templet: '#match_extend_order_amount',width:150}">下单金额</th>--}}
<th lay-data="{field:'bom_match_extend',templet: '#match_extend_order_sn',width:150}">订单编号</th>
</tr>
</thead>
</table>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="save_form">保存</button>
<button class="layui-btn layui-btn-sm" lay-event="create_order">下单</button>
</div>
</script>
<script type="text/html" id="match_ic_corder">
@{{# if (d.is_corder == 1) { }}
<div style="color: #ff0000">下单</div>
@{{# }else{ }}
未下单
@{{# } }}
</script>
<script type="text/html" id="checkbd">
@{{# if (d.is_corder != 1) { }}
<input type="checkbox" name="layTableCheckbox" lay-skin="primary">
@{{# } }}
</script>
<script type="text/html" id="match_extend_order_amount">
@{{# if (d.bom_match_extend) { }}
@{{ d.bom_match_extend.order_amount }}
@{{# } }}
</script>
<script type="text/html" id="match_extend_order_sn">
@{{# if (d.bom_match_extend) { }}
@{{# if(d.bom_match_extend.order_id > 0){ }}
@{{# if(d.match_goods_type == 0){ }}
<a href="/details/@{{ d.bom_match_extend.order_id }}?tags=self">@{{ d.bom_match_extend.order_sn }}</a>
@{{# }else{ }}
<a href="/details/@{{ d.bom_match_extend.order_id }}">@{{ d.bom_match_extend.order_sn }}</a>
@{{# } }}
@{{# } }}
@{{# } }}
</script>
<script>
var bom_id = "{{$bom_id}}"
</script>
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
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