Commit 30ed6f6d by 孙龙

bom

parent 37d2ba9e
<?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){
$this->bomService->saveBomInfo($request);
}
}
\ 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)->first();
}
}
\ 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($bom_id){
$suffix = substr(strrev($bom_id),0,1);
return self::suffix($suffix)->where('bom_id', $bom_id)->get();
}
}
\ 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',$bom_sn);
}
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_name', "!=","");
});
}elseif($is_kefu == '1'){
$query = $query->whereHas("bomExtend",function ($query) {
$query->where('kefu_name', "!=","");
});
}
return $query;
}else{
$query = $query->whereHas("bomExtend",function ($query) use($username,$is_kefu) {
if($username){
$query->where('user_name', $username);
}
if($is_kefu == '0'){
$query->where('kefu_name', "=","");
}elseif($is_kefu == '1'){
$query->where('kefu_name', "!=","");
}
});
}
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\Services\Bom;
use App\Http\Controllers\PermController;
use App\Model\Bom\BomModel;
use App\Model\Bom\BomItemMatchModel;
use App\Model\Bom\BomItemModel;
use App\Model\Bom\BomItemMatchExtendModel;
class BomService {
public function __construct(){
$this->bomModel = new BomModel;
}
protected function getRole($request){
$perm = new PermController();
// 用户角色
$role_id = (new PermController)->getUserRole($request);
$sale_ids = [];
if($role_id == 1){
$sale_ids=[];
}else if($role_id == 2){
$sale_ids = (new PermController)->getSubSaleId($request->user->userId);
}elseif($role_id >= 3){
$sale_ids = $request->user->userId;
}
return [$role_id,$sale_ids];
}
public function getBomList($request){
$page = $request->input("page",1);
$limit = $request->input("limit",10);
$bom_sn = $request->input("bom_sn",'');
$is_corder = $request->input("is_corder",'all');
$begin_time = $request->input("begin_time",'');
$end_time = $request->input("end_time",'');
$username = $request->input("username",'');
$is_kefu = $request->input("is_kefu",'all');
list($role_id,$sale_ids) = $this->getRole($request);
$query = BomModel::select("*")->with("bomExtend")->SearchByUserNameOrKefu($username,$is_kefu)
->SearchByBomSn($bom_sn)->SearchByIsCorder($is_corder)->SearchByTime($begin_time,$end_time)
->SearchByrole($role_id,$sale_ids)
->orderBy("bom_id","desc");
// $tmp = str_replace('?', '"'.'%s'.'"', $query->toSql());
// $tmp = vsprintf($tmp, $query->getBindings());
// echo $tmp;
// exit;
$list = $query->paginate($limit,[],'page',$page);
$bomItemMatchModel = new BomItemMatchModel;
foreach($list as $k=>$item){
$bomMoneyObj = $bomItemMatchModel->getBomAmount($item->bom_id);
$bomMoney = $bomMoneyObj->amount;
$item->bomMoney = $bomMoney ? round($bomMoney,2) : 0;
}
$list = $list->toArray();
// dump($list);
return [$list['total'],$list["data"]];
}
public function getBomView($request){
$bom_id = $request->input("bom_id",0);
$bom = BomModel::where(["bom_id"=>$bom_id])->select("bom_id","bom_sn")->first();
$bomItemModel = new BomItemModel;
$bomItemModelMatch = new BomItemMatchModel;
$bomItemMatchExtendModel = new BomItemMatchExtendModel;
$bom_items = $bomItemModel->getBomItems($bom->bom_id);
foreach($bom_items as $k=>&$item){
$bom_item_matching = $bomItemModelMatch->getBomItemsMatching($bom->bom_id,$item->bom_item_id);
if($bom_item_matching){
$item->match_goods_id = $bom_item_matching->goods_id;
$item->match_goods_name = $bom_item_matching->goods_name;
$item->match_brand_name = $bom_item_matching->brand_name;
$item->match_supplier_name = $bom_item_matching->supplier_name;
$item->match_mpq = $bom_item_matching->mpq;
$item->match_moq = $bom_item_matching->moq;
$item->match_delivery = $bom_item_matching->delivery;
$item->match_price = $bom_item_matching->price;
$item->match_amount = $bom_item_matching->price * $bom_item_matching->number;
$item->is_corder = $bom_item_matching->is_corder;
}
$item->bom_match_extend = $bomItemMatchExtendModel->get_bom_match_extend($bom->bom_id,$bom_item_matching->matching_id);
}
return [count($bom_items),collect($bom_items)->toArray()];
}
protected function getSku($goods_id){
$url = Config('website.search-skuid');
$data['id'] = $goods_id;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$response = json_decode(curlApi($url, $data, 'POST'), true);
dump($response);
}
public function saveBomInfo($request){
try{
$data = $request->input("data",'');
// dump($data);
foreach($data as $k=>$item){
dump($item['match_goods_id']);
if($item['match_goods_id'] && intval($item['match_goods_id']) > 0){
$this->getSku($item['match_goods_id']);
}
}
}catch(\Exception $e){
}
}
}
\ No newline at end of file
......@@ -109,6 +109,18 @@ return [
'prefix' => 'lie_',
'strict' => false,
],
'bom' => [
'driver' => 'mysql',
'host' => env('DB_HOST_BOM', ''),
'database' => env('DB_DATABASE_BOM', ''),
'username' => env('DB_USERNAME_BOM', ''),
'password' => env('DB_PASSWORD_BOM', ''),
'port' => env('DB_PORT_BOM', 3306),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'lie_',
'strict' => false,
],
'sqlite' => [
'driver' => 'sqlite',
'database' => database_path('database.sqlite'),
......
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_sn', 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}
,{field: '', 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;
var table = layui.table;
//转换静态表格
table.init('bomView', {
url: '/ajax/bom/BomView?bom_id='+bom_id //数据接口
,toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板
,defaultToolbar:[]
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: false //开启分页
});
//头工具栏事件
table.on('toolbar(bomView)', function(obj){
switch(obj.event){
case 'save_form':
var listdata = layui.table.cache;
console.log(listdata[1])
var datax = {}
datax.data = listdata[1]
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.err_code == 0) {
// layer.msg(resp.err_msg);
// // renderTable(); // 重新加载table
// $('.search').trigger("click"); // 触发搜索按钮
// if(typeof resp.data.redictUrl != "undefined"){
// window.location.href=resp.data.redictUrl;
// }
// return false;
//}
//
//layer.alert(resp.err_msg);
},
error: function(err) {
console.log(err)
}
})
//layer.msg('保存中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
return false;
},
cancel: function(index) {
layer.close(index);
}
})
break;
};
});
})
\ No newline at end of file
<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_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="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.status == 0) { }}
<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>
<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">
<thead>
<tr>
<th lay-data="{type:'numbers', width:80, sort: true,fixed: 'left'}">序号</th>
<th lay-data="{field:'goods_name', width:150,fixed: 'left'}">需求型号</th>
<th lay-data="{field:'brand_name',fixed: 'left',width:140,}">品牌</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:'number', width:130,edit: 'text',edit:'text'}">数量(可修改)</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'}">供应商</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>
</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="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) { }}
@{{ d.bom_match_extend.order_sn }}
@{{# } }}
</script>
<script>
var bom_id = "{{$bom_id}}"
</script>
\ No newline at end of file
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