admin_items_720
This commit is contained in:
@@ -178,7 +178,7 @@ class Common extends CI_Controller
|
||||
|
||||
$this->load->model("sys/sys_tag_model");
|
||||
$rows = $this->sys_tag_model->select($where);
|
||||
if($rows){
|
||||
if ($rows) {
|
||||
foreach ($rows as $v) {
|
||||
$v['tag_id'] = $v['id'];
|
||||
$v['tag_name'] = $v['tag_name'];
|
||||
@@ -1177,7 +1177,8 @@ class Common extends CI_Controller
|
||||
* 导入excel表格生成数组
|
||||
* @return bool
|
||||
*/
|
||||
public function excel2arr(){
|
||||
public function excel2arr()
|
||||
{
|
||||
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
|
||||
|
||||
$key = $this->input->get('key');
|
||||
@@ -1201,7 +1202,7 @@ class Common extends CI_Controller
|
||||
$arr = array();
|
||||
for ($i = 1; $i <= $rowCnt; $i++) { //读取内容
|
||||
$row = array();
|
||||
for($j='A'; $j < $col_max; $j++){
|
||||
for ($j = 'A'; $j < $col_max; $j++) {
|
||||
$row[] = $objWorksheet->getCell($j . $i)->getValue();
|
||||
}
|
||||
$arr[] = $row;
|
||||
@@ -1271,11 +1272,11 @@ class Common extends CI_Controller
|
||||
$where = [];
|
||||
$status && $where['lc_auto_series.status'] = $status;
|
||||
$title && $where['lc_auto_series.name like "%' . $title . '%"'] = null;
|
||||
$count = $this->auto_series_model->select_brand($where,'','','','',1);
|
||||
$count = $this->auto_series_model->select_brand($where, '', '', '', '', 1);
|
||||
$itemsList = [];
|
||||
if ($count) {
|
||||
$lists = $this->auto_series_model->select_brand($where, 'lc_auto_series.id desc', $page, $size);
|
||||
foreach($lists as $key=>$val){
|
||||
foreach ($lists as $key => $val) {
|
||||
$itemsList[] = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
@@ -1289,4 +1290,37 @@ class Common extends CI_Controller
|
||||
$this->data['itemsPage'] = array('page' => $page, 'pageLimit' => $size, 'pageCount' => $count, 'hasNext' => $hasNext);
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:车型库
|
||||
* Created on: 2021/7/19 10:18
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function auto()
|
||||
{
|
||||
$type = intval($this->input->get('type'));//1品牌2车系3型号
|
||||
$pid = intval($this->input->get('pid'));
|
||||
$name = $this->input->get('name');
|
||||
$tp = intval($this->input->get('tp'));//0搜索使用,1修改使用
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->load->model('auto/auto_attr_model', 'mdAutoAttr');
|
||||
$res = $lists = array();
|
||||
if ($type == 1) {
|
||||
$tp == 0 && $lists[] = array('id' => 0, 'name' => $name ? $name : '选择品牌');
|
||||
$res = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
} else if ($type == 2) {
|
||||
$tp == 0 && $lists[] = array('id' => 0, 'name' => $name ? $name : '选择车系');
|
||||
$res = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $pid), 'id desc', 0, 0, 'id,name');
|
||||
} else if ($type == 3) {
|
||||
$tp == 0 && $lists[] = array('id' => 0, 'name' => $name ? $name : '选择车型');
|
||||
$res = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $pid), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
foreach ($res as $key => $value) {
|
||||
$lists[] = array('id' => $value['id'], 'name' => $value['name']);
|
||||
}
|
||||
$this->data = $lists;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notes:商品
|
||||
* Created on: 2021/7/14 15:03
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Goods extends HD_Controller
|
||||
{
|
||||
private $packAry = array(0 => '无', 1 => '是');
|
||||
private $statusAry = array(0 => '下架', 1 => '正常', 2 => '已售');
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('items/items_model', 'mdItems');
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->load->model('auto/auto_attr_model', 'mdAutoAttr');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$where = $autoList = array();
|
||||
if ($params['brand_id']) {
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$where['s_id'] = $params['s_id'];
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
if ($params['v_id']) {
|
||||
$where['v_id'] = $params['v_id'];
|
||||
}
|
||||
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
$count = $this->mdItems->count($where);
|
||||
$lists = array();
|
||||
if ($count) {
|
||||
$fileds = 'id,brand_id,s_id,ori_price,sale_price,bill_price,c_time,if_pack,discount,buy_price,address,status
|
||||
,v_id,cor_id,incor_id';
|
||||
$rows = $this->mdItems->select($where, 'id desc', $page, $size, $fileds);
|
||||
$brand_id_arr = array_unique(array_column($rows, 'brand_id'));
|
||||
$brands_rows = $this->mdAutoBrand->get_map_by_ids($brand_id_arr, 'id,name');
|
||||
$series_id_arr = array_unique(array_column($rows, 's_id'));
|
||||
$series_rows = $this->mdAutoSeries->get_map_by_ids($series_id_arr, 'id,name');
|
||||
$attr_vid_arr = array_unique(array_column($rows, 'v_id'));
|
||||
$attr_vid_rows = $this->mdAutoAttr->get_map_by_ids($attr_vid_arr, 'id,title');
|
||||
$attr_corid_arr = array_unique(array_column($rows, 'cor_id'));
|
||||
$attr_corid_rows = $this->mdAutoAttr->get_map_by_ids($attr_corid_arr, 'id,title');
|
||||
$attr_incorid_arr = array_unique(array_column($rows, 'incor_id'));
|
||||
$attr_incorid_rows = $this->mdAutoAttr->get_map_by_ids($attr_incorid_arr, 'id,title');
|
||||
foreach ($rows as $key => $val) {
|
||||
$setVal = array();
|
||||
$setVal['id'] = $val['id'];
|
||||
$setVal['brand_name'] = isset($brands_rows[$val['brand_id']]) ? $brands_rows[$val['brand_id']][0]['name'] : '';
|
||||
$setVal['s_name'] = isset($series_rows[$val['s_id']]) ? $series_rows[$val['s_id']][0]['name'] : '';
|
||||
$setVal['v_name'] = isset($attr_vid_rows[$val['v_id']]) ? $attr_vid_rows[$val['v_id']][0]['title'] : '';
|
||||
$setVal['cor_name'] = isset($attr_corid_rows[$val['cor_id']]) ? $attr_corid_rows[$val['cor_id']][0]['title'] : '';
|
||||
$setVal['incor_name'] = isset($attr_incorid_rows[$val['incor_id']]) ? $attr_incorid_rows[$val['incor_id']][0]['title'] : '';
|
||||
$setVal['if_pack_name'] = $this->packAry[$val['if_pack']];
|
||||
$setVal['ori_price'] = $val['ori_price'];
|
||||
$setVal['discount'] = $val['discount'] ? $val['discount'] . '%' : '100%';
|
||||
$setVal['buy_price'] = $val['buy_price'];
|
||||
$setVal['status_name'] = $this->statusAry[$val['status']];
|
||||
$setVal['address'] = $val['address'] ? '收货地址:' . $val['address'] : '';
|
||||
$lists[] = $setVal;
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
$this->data['params'] = $params;
|
||||
$this->data['autoList'] = $autoList;
|
||||
$this->data['_title'] = '商品管理';
|
||||
return $this->show_view('/items/goods/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$autoList = array();
|
||||
$id = intval($this->input->get('id'));
|
||||
$info['brand_id'] = $info['s_id'] = $info['v_id'] = 0;
|
||||
if ($id > 0) {
|
||||
$re = $this->mdItems->get(array('id' => $id));
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商品不存在!');
|
||||
}
|
||||
$info = $re;
|
||||
if ($re['brand_id']) {
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $re['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($re['s_id']) {
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[4] = $this->mdAutoAttr->select(array('type' => 0, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[5] = $this->mdAutoAttr->select(array('type' => 2, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
$_title = '编辑商品';
|
||||
$edit_url = '/items/goods/goods/edit';
|
||||
} else {
|
||||
$_title = '新增商品';
|
||||
$edit_url = '/items/goods/goods/add';
|
||||
}
|
||||
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
$showInfo['autoList'] = $autoList;
|
||||
$showInfo['packAry'] = $this->packAry;
|
||||
$showInfo['statusAry'] = $this->statusAry;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['showInfo'] = $showInfo;
|
||||
$this->data['edit_url'] = $edit_url;
|
||||
$this->data['_title'] = $_title;
|
||||
return $this->show_view('/items/goods/edit', true);
|
||||
}
|
||||
|
||||
public function get_info()
|
||||
{
|
||||
$id = intval($this->input->get('id'));
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
|
||||
}
|
||||
$re = $this->mdItems->get(array('id' => $id));
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商品不存在!');
|
||||
}
|
||||
$info = $re;
|
||||
$re_b = $this->mdAutoBrand->get(array('id' => $re['brand_id']), 'name');
|
||||
$re_s = $this->mdAutoSeries->get(array('id' => $re['s_id']), 'name');
|
||||
$re_v = $this->mdAutoAttr->get(array('id' => $re['v_id']), 'title');
|
||||
$re_cor = $this->mdAutoAttr->get(array('id' => $re['cor_id']), 'title');
|
||||
$re_incor = $this->mdAutoAttr->get(array('id' => $re['incor_id']), 'title');
|
||||
$info['brand_name'] = $re_b ? $re_b['name'] : '';
|
||||
$info['s_name'] = $re_s ? $re_s['name'] : '';
|
||||
$info['v_name'] = $re_v ? $re_v['title'] : '';
|
||||
$info['cor_name'] = $re_cor ? $re_cor['title'] : '';
|
||||
$info['incor_name'] = $re_incor ? $re_incor['title'] : '';
|
||||
$info['if_pack_name'] = $this->packAry[$re['if_pack']];
|
||||
$info['status_name'] = $this->statusAry[$re['status']];
|
||||
$info['ori_price'] = $re['ori_price'] . '元';
|
||||
$info['dis_price'] = $re['dis_price'] . '元';
|
||||
$info['bill_price'] = $re['bill_price'] . '元';
|
||||
$info['buy_price'] = $re['buy_price'] . '元';
|
||||
$info['discount'] = $re['discount'] ? $re['discount'] . '%' : '100%';
|
||||
$info['pro_time'] = $re['pro_time'] != '0000-00-00 00:00:00' ? $re['pro_time'] : '';
|
||||
$info['p_time'] = $re['p_time'] != '0000-00-00 00:00:00' ? $re['p_time'] : '';
|
||||
$info['out_time'] = $re['out_time'] != '0000-00-00 00:00:00' ? $re['out_time'] : '';
|
||||
$info['bill_time'] = $re['bill_time'] != '0000-00-00 00:00:00' ? $re['bill_time'] : '';
|
||||
$this->data['info'] = $info;
|
||||
return $this->show_view('/items/goods/get_info');
|
||||
}
|
||||
|
||||
private function checkInfo($info)
|
||||
{
|
||||
$msg = '';
|
||||
$code = SYS_CODE_FAIL;
|
||||
if (!$info) {
|
||||
$msg = '非法参数';
|
||||
} else if (!$info['brand_id']) {
|
||||
$msg = '请选择品牌';
|
||||
} else if (!$info['s_id']) {
|
||||
$msg = '请选择车系';
|
||||
} else {
|
||||
$code = SYS_CODE_SUCCESS;
|
||||
}
|
||||
return array('code' => $code, 'msg' => $msg);
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add()
|
||||
{
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$checkInfo = $this->checkInfo($info);
|
||||
if (!$checkInfo['code']) {
|
||||
return $this->show_json($checkInfo['code'], $checkInfo['msg']);
|
||||
}
|
||||
$editData['brand_id'] = $info['brand_id'];
|
||||
$editData['s_id'] = $info['s_id'];
|
||||
$editData['v_id'] = $info['v_id'];
|
||||
$editData['cor_id'] = $info['cor_id'];
|
||||
$editData['incor_id'] = $info['incor_id'];
|
||||
$editData['if_pack'] = $info['if_pack'];
|
||||
$editData['status'] = $info['status'];
|
||||
|
||||
$editData['address'] = $info['address'];
|
||||
$editData['vin'] = $info['vin'];
|
||||
$editData['stdard_num'] = $info['stdard_num'];
|
||||
$editData['engine_num'] = $info['engine_num'];
|
||||
$editData['frame_num'] = $info['frame_num'];
|
||||
$editData['ori_price'] = $info['ori_price'];
|
||||
$editData['discount'] = $info['discount'];
|
||||
$editData['dis_price'] = $info['dis_price'];
|
||||
$editData['bill_num'] = $info['bill_num'];
|
||||
$editData['bill_price'] = $info['bill_price'];
|
||||
$editData['buy_price'] = $info['buy_price'];
|
||||
|
||||
$editData['pro_time'] = $info['pro_time'];
|
||||
$editData['p_time'] = $info['p_time'];
|
||||
$editData['out_time'] = $info['out_time'];
|
||||
$editData['bill_time'] = $info['bill_time'];
|
||||
$this->mdItems->update($editData, array('id' => $info['id']));
|
||||
$this->data['status'] = 2;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit_excel()
|
||||
{
|
||||
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
|
||||
$res = $this->upload();
|
||||
if (!$res['code']) {
|
||||
return $this->show_json(0, $res['message']);
|
||||
}
|
||||
$file = $res['path'];
|
||||
if ($res['file_ext'] == '.xls') {
|
||||
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
|
||||
} elseif ($res['file_ext'] == '.xlsx') {
|
||||
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
|
||||
}
|
||||
$PHPExcel = $reader->load($file); // 文档名称
|
||||
$objWorksheet = $PHPExcel->getActiveSheet();
|
||||
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
|
||||
if ($rowCnt > 10000) {
|
||||
@unlink($file);
|
||||
return $this->show_json(0, '数据大于一万请拆分多个表格导入');
|
||||
}
|
||||
$j = 0;
|
||||
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
|
||||
$vin = $objWorksheet->getCell('F' . $_row)->getValue(); //vin码
|
||||
if ($vin) {
|
||||
$re_i = $this->mdItems->get(array('vin' => $vin));
|
||||
if (!$re_i) {
|
||||
$brand_id = $objWorksheet->getCell('A' . $_row)->getValue(); //品牌id
|
||||
$s_id = $objWorksheet->getCell('B' . $_row)->getValue(); //车系id
|
||||
$v_id = $objWorksheet->getCell('C' . $_row)->getValue(); //车型id
|
||||
$cor_id = $objWorksheet->getCell('D' . $_row)->getValue(); //车身颜色id
|
||||
$incor_id = $objWorksheet->getCell('E' . $_row)->getValue(); //内饰颜色id
|
||||
$stdard_num = $objWorksheet->getCell('G' . $_row)->getValue(); //合格证号
|
||||
$frame_num = $objWorksheet->getCell('H' . $_row)->getValue(); //车架号
|
||||
$pro_time = $objWorksheet->getCell('I' . $_row)->getValue(); //生产时间
|
||||
$ori_price = $objWorksheet->getCell('J' . $_row)->getValue(); //指导价
|
||||
$re_b = $this->mdAutoBrand->get(array('name' => $brand_id));
|
||||
$brand_id = $re_b ? $re_b['id'] : 0;
|
||||
$re_s = $this->mdAutoSeries->get(array('brand_id' => $brand_id, 'name' => $s_id));
|
||||
$s_id = $re_s ? $re_s['id'] : 0;
|
||||
$re_a1 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 1, 'title' => $v_id));
|
||||
$v_id = $re_a1 ? $re_a1['id'] : 0;
|
||||
$re_a0 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 0, 'title' => $cor_id));
|
||||
$cor_id = $re_a0 ? $re_a0['id'] : 0;
|
||||
$re_a2 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 2, 'title' => $incor_id));
|
||||
$incor_id = $re_a2 ? $re_a2['id'] : 0;
|
||||
$addData = array('brand_id' => $brand_id, 's_id' => $s_id, 'v_id' => $v_id, 'cor_id' => $cor_id, 'incor_id' => $incor_id
|
||||
, 'ori_price' => $ori_price, 'vin' => $vin, 'frame_num' => $frame_num, 'stdard_num' => $stdard_num, 'pro_time' => $pro_time, 'c_time' => time());
|
||||
$id = $this->mdItems->add($addData);
|
||||
if ($id) {
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@unlink($file);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '导入完成,导入总条数为:' . $j);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:上传excel
|
||||
* Created on: 2021/7/14 15:06
|
||||
* Created by: dengbw
|
||||
* @return array
|
||||
*/
|
||||
private function upload()
|
||||
{
|
||||
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
|
||||
$config['allowed_types'] = '*';//xls|xlsx
|
||||
$config['max_size'] = 2 * 1024;
|
||||
$config['file_name'] = 'items_' . time() . rand(1, 99999);
|
||||
$this->load->library('upload', $config);
|
||||
if (!$this->upload->do_upload('file')) {
|
||||
return array('code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', ''));
|
||||
} else {
|
||||
$data = $this->upload->data();
|
||||
return array('code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
<div class="am-form am-form-horizontal" style="width: 100%;padding: 10px">
|
||||
<div id="vue-edit">
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span href="javascript:void(0)" style="font-size: 20px;">
|
||||
车辆信息
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g">
|
||||
<table width="100%" style="padding:10px 10px 10px 10px;">
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">品牌</div>
|
||||
<select style="width: 200px;" v-model="info.brand_id" @change='autoList(2);'>
|
||||
<option value="0">选择品牌</option>
|
||||
<template v-for="(v,i) in showInfo['autoList'][1]">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">车系</div>
|
||||
<select style="width: 200px;" v-model="info.s_id" @change='autoList(3);'>
|
||||
<option value="0">选择车系</option>
|
||||
<template v-for="(v,i) in showInfo['autoList'][2]">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">车型</div>
|
||||
<select style="width: 200px;"
|
||||
v-model="info.v_id">
|
||||
<option value="0">选择车型</option>
|
||||
<template v-for="(v,i) in showInfo['autoList'][3]">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">选包装</div>
|
||||
<select style="width: 200px;"
|
||||
v-model="info.if_pack">
|
||||
<template v-for="(v,i) in showInfo['packAry']">
|
||||
<option :value="i">{{v}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">车身色</div>
|
||||
<select style="width: 200px;"
|
||||
v-model="info.cor_id">
|
||||
<option value="0">选择车身色</option>
|
||||
<template v-for="(v,i) in showInfo['autoList'][4]">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">内饰色</div>
|
||||
<select style="width: 200px;"
|
||||
v-model="info.incor_id">
|
||||
<option value="0">选择内饰色</option>
|
||||
<template v-for="(v,i) in showInfo['autoList'][5]">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">车辆状态</div>
|
||||
<select style="width: 200px;"
|
||||
v-model="info.status">
|
||||
<template v-for="(v,i) in showInfo['statusAry']">
|
||||
<option :value="i">{{v}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td" colspan="2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">送货地址</div>
|
||||
<input type="text" v-model="info.address" placeholder="请输入送货地址">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" style="padding:10px 10px 10px 10px;">
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">VIN码</div>
|
||||
<input type="text" v-model="info.vin" placeholder="请输入VIN码">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">合格证号</div>
|
||||
<input type="text" v-model="info.stdard_num" placeholder="请输入合格证号">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">发动机号</div>
|
||||
<input type="text" v-model="info.engine_num" placeholder="请输入发动机号">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">车架号</div>
|
||||
<input type="text" v-model="info.frame_num" placeholder="请输入车架号">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" style="padding:10px 10px 10px 10px;">
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">生产日期</div>
|
||||
<input id="pro_time_id" type="text" value="<?= $info['pro_time'] ?>"
|
||||
placeholder="请输入生产日期">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">分配日期</div>
|
||||
<input id="p_time_id" type="text" value="<?= $info['p_time'] ?>" placeholder="请输入分配日期">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">出库日期</div>
|
||||
<input id="out_time_id" type="text" value="<?= $info['out_time'] ?>"
|
||||
placeholder="请输入出库日期">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">指导价</div>
|
||||
<input type="text" v-model="info.ori_price" placeholder="请输入指导价">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">折扣%</div>
|
||||
<input type="text" v-model="info.discount" placeholder="请输入折扣%">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">折扣金额</div>
|
||||
<input type="text" v-model="info.dis_price" placeholder="请输入折扣金额">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">开票日期</div>
|
||||
<input id="bill_time_id" type="text" value="<?= $info['bill_time'] ?>"
|
||||
placeholder="请输入开票日期">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">发票号</div>
|
||||
<input type="text" v-model="info.bill_num" placeholder="请输入发票号">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">发票金额</div>
|
||||
<input type="text" v-model="info.bill_price" placeholder="请输入发票金额">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">采购成本</div>
|
||||
<input type="text" v-model="info.buy_price" placeholder="请输入采购成本">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="am-form-group">
|
||||
<a href="javascript:void(0);" @click='saveEdit();'
|
||||
style="margin-left: 3.5rem;margin-top: 4rem;"
|
||||
class="am-btn ml20 am-btn-sm am-btn-success w100">保存</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vue_obj;
|
||||
$(document).ready(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info: {},
|
||||
showInfo: {'autoList': []},
|
||||
},
|
||||
mounted: function () {
|
||||
var that = this;
|
||||
that.info = <?=json_encode($info)?>;
|
||||
that.showInfo = <?=json_encode($showInfo)?>;
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
},
|
||||
updated: function () {
|
||||
},
|
||||
methods: {
|
||||
autoList: function (type) {
|
||||
var vm = this;
|
||||
var pid = 0;
|
||||
if (type == 2) {
|
||||
if (vm.info.brand_id == 0) {
|
||||
vm.info.brand_id = 0;
|
||||
vm.info.s_id = 0;
|
||||
vm.info.v_id = 0;
|
||||
vm.info.cor_id = 0;
|
||||
vm.info.incor_id = 0;
|
||||
vm.showInfo['autoList'][2] = [];
|
||||
vm.showInfo['autoList'][3] = [];
|
||||
vm.showInfo['autoList'][4] = [];
|
||||
vm.showInfo['autoList'][5] = [];
|
||||
return;
|
||||
}
|
||||
pid = vm.info.brand_id;
|
||||
} else if (type == 3) {
|
||||
if (vm.info.s_id == 0) {
|
||||
vm.info.s_id = 0;
|
||||
vm.info.v_id = 0;
|
||||
vm.info.cor_id = 0;
|
||||
vm.info.incor_id = 0;
|
||||
vm.showInfo['autoList'][3] = [];
|
||||
vm.showInfo['autoList'][4] = [];
|
||||
vm.showInfo['autoList'][5] = [];
|
||||
return;
|
||||
}
|
||||
pid = vm.info.s_id;
|
||||
}
|
||||
$.ajax({
|
||||
url: '/common/auto',
|
||||
type: 'get',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
type: type,
|
||||
pid: pid,
|
||||
tp: 1,
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.data) {
|
||||
if (type == 2) {
|
||||
vm.info.s_id = 0;
|
||||
vm.info.v_id = 0;
|
||||
vm.info.cor_id = 0;
|
||||
vm.info.incor_id = 0;
|
||||
vm.showInfo['autoList'][2] = data.data;
|
||||
vm.showInfo['autoList'][3] = [];
|
||||
vm.showInfo['autoList'][4] = [];
|
||||
vm.showInfo['autoList'][5] = [];
|
||||
} else if (type == 3) {
|
||||
vm.info.v_id = 0;
|
||||
vm.info.cor_id = 0;
|
||||
vm.info.incor_id = 0;
|
||||
vm.showInfo['autoList'][3] = data.data;
|
||||
vm.showInfo['autoList'][4] = [];
|
||||
vm.showInfo['autoList'][5] = [];
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
saveEdit: function () {
|
||||
var vm = this;
|
||||
vm.info.pro_time = $('#pro_time_id').val();
|
||||
vm.info.p_time = $('#p_time_id').val();
|
||||
vm.info.out_time = $('#out_time_id').val();
|
||||
vm.info.bill_time = $('#bill_time_id').val();
|
||||
$.ajax({
|
||||
url: <?=json_encode($edit_url)?>,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info
|
||||
},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = false;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
if (data.data.status == 1) {
|
||||
$.form.href('#/items/goods/goods');
|
||||
} else {
|
||||
$.form.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = false;
|
||||
layer.closeAll('loading');
|
||||
},
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
require(['laydate'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#pro_time_id', type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#p_time_id', type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#out_time_id', type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#bill_time_id', type: 'datetime'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.input-group {
|
||||
width: 100%;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.input-group-addon {
|
||||
padding: 0px 10px 0px 0px;
|
||||
font-size: 1.6rem;
|
||||
font-weight: normal;
|
||||
line-height: 0px;
|
||||
color: #333;
|
||||
text-align: right;
|
||||
background-color: #fff;
|
||||
border: 0px solid #fff;
|
||||
border-radius: 0px;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.table-td {
|
||||
width: 20%;
|
||||
padding-top: 15px;
|
||||
line-height: 37px;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,111 @@
|
||||
<div class="am-form am-form-horizontal" style="width: 100%;padding: 10px">
|
||||
<div id="vue-edit">
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd" style="text-align: center">
|
||||
<span href="javascript:void(0)" style="font-size: 20px;">
|
||||
车辆信息
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g">
|
||||
<table width="100%" style="margin:10px 10px 10px 10px;">
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
品牌:<?= $info['brand_name'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
车系:<?= $info['s_name'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
车型:<?= $info['v_name'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
选包装:<?= $info['if_pack_name'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
车身色:<?= $info['cor_name'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
内饰色:<?= $info['incor_name'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
车辆状态:<?= $info['status_name'] ?>
|
||||
</td>
|
||||
<td class="table-td" colspan="2">
|
||||
送货地址:<?= $info['address'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" style="margin:10px 10px 10px 10px;">
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
VIN码:<?= $info['vin'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
合格证号:<?= $info['stdard_num'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
发动机号:<?= $info['engine_num'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
车架号:<?= $info['frame_num'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" style="margin:10px 10px 10px 10px;">
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
生产日期:<?= $info['pro_time'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
分配日期:<?= $info['p_time'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
出库日期:<?= $info['out_time'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
指导价:<?= $info['ori_price'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
折扣%:<?= $info['discount'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
折扣金额:<?= $info['dis_price'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
开票日期:<?= $info['bill_time'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
发票号:<?= $info['bill_num'] ?>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
发票金额:<?= $info['bill_price'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td" colspan="3">
|
||||
采购成本:<?= $info['buy_price'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.table-td {
|
||||
width: 20%;
|
||||
padding-top: 15px;
|
||||
line-height: 37px;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,178 @@
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/items/goods/goods">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">车型:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select id="bd-auto1-id" name="brand_id" data-toggle="next-select"
|
||||
data-refurl="/common/auto?pid={value}&type=2"
|
||||
data-next="#bd-auto2-id">
|
||||
<option value="0">选择品牌</option>
|
||||
<? if ($autoList[1]) {
|
||||
foreach ($autoList[1] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['auto1_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<? }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w120">
|
||||
<select id="bd-auto2-id" name="s_id" data-toggle="next-select"
|
||||
data-refurl="/common/auto?pid={value}&type=3"
|
||||
data-next="#bd-auto3-id">
|
||||
<option value="0">选择车系</option>
|
||||
<?php if ($autoList[2]) {
|
||||
foreach ($autoList[2] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['auto2_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w120">
|
||||
<select id="bd-auto3-id" name="v_id">
|
||||
<option value="0">选择车型</option>
|
||||
<?php if ($autoList[3]) {
|
||||
foreach ($autoList[3] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['auto3_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml100">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="button" data-open="/items/goods/goods/get"
|
||||
class="am-btn am-btn-success am-btn-sm w100">新增
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group fl am-form-file">
|
||||
<button type="button" class="am-btn am-btn-sm am-btn-success w100 ml20">
|
||||
<i class="am-icon-cloud-upload"></i> 导入
|
||||
</button>
|
||||
<input id="doc-form-file" type="file">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"><span>商品ID</span></th>
|
||||
<th width="10%"><span>品牌</span></th>
|
||||
<th width="10%"><span>车系</span></th>
|
||||
<th width="10%"><span>车型</span></th>
|
||||
<th width="6%"><span>车身颜色</span></th>
|
||||
<th width="6%"><span>内饰颜色</span></th>
|
||||
<th width="6%"><span>选装包</span></th>
|
||||
<th width="6%"><span>市场指导价</span></th>
|
||||
<th width="6%"><span>折扣%</span></th>
|
||||
<th width="6%"><span>采购成本</span></th>
|
||||
<th width="6%"><span>采购状态</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['brand_name'] ?></td>
|
||||
<td><?= $v['s_name'] ?></td>
|
||||
<td><?= $v['v_name'] ?></td>
|
||||
<td><?= $v['cor_name'] ?></td>
|
||||
<td><?= $v['incor_name'] ?></td>
|
||||
<td><?= $v['if_pack_name'] ?></td>
|
||||
<td><?= $v['ori_price'] ?></td>
|
||||
<td><?= $v['discount'] ?></td>
|
||||
<td><?= $v['buy_price'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="11">
|
||||
<div class="row">
|
||||
<div class="col-md-4 align-l">
|
||||
<?= $v['address'] ?>
|
||||
</div>
|
||||
<div class="col-md-8 align-r" style="padding-right: 30px;">
|
||||
<a href="javascript:void(0);"
|
||||
data-modal="/items/goods/goods/get_info?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs"
|
||||
data-title="详情">查看</a>
|
||||
<a href="javascript:void(0);"
|
||||
data-open="/items/goods/goods/get?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">编辑</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#bd-auto1-id').change(function () {
|
||||
$('#bd-auto2-id').empty();
|
||||
$('#bd-auto3-id').empty();
|
||||
$("#bd-auto3-id").prepend("<option value='0'>选择车型</option>")
|
||||
});
|
||||
$('#bd-auto2-id').change(function () {
|
||||
$('#bd-auto3-id').empty();
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$("#doc-form-file").on("change", function (e) {
|
||||
if (this.files.length < 1) {
|
||||
return false;
|
||||
}
|
||||
var formdata = new FormData();
|
||||
formdata.append('file', this.files[0]);
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/items/goods/goods/edit_excel',
|
||||
dataType: 'json',
|
||||
data: formdata,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function () {
|
||||
var index = layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (res) {
|
||||
if (res['code']) {
|
||||
layer.msg(res.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
console.log(res);
|
||||
},
|
||||
complete: function () {
|
||||
layer.closeAll('loading');
|
||||
},
|
||||
error: function (responseStr) {
|
||||
console.log(responseStr);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -13,4 +13,25 @@ class Auto_attr_model extends HD_Model{
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:根据id获取数据
|
||||
* Created on: 2021/7/15 17:27
|
||||
* Created by: dengbw
|
||||
* @param $ids
|
||||
* @param string $fileds
|
||||
* @return array
|
||||
*/
|
||||
public function get_map_by_ids($ids, $fileds = '')
|
||||
{
|
||||
$rows = [];
|
||||
if ($ids) {
|
||||
$cf_ids = implode(',', $ids);
|
||||
$where = [
|
||||
"id in ($cf_ids)" => null
|
||||
];
|
||||
$rows = $this->map('id', '', $where, '', '', '', $fileds);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,39 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Created by Vim.
|
||||
* User: lcc
|
||||
* Date: 2021/06/23
|
||||
* Time: 16:24
|
||||
*/
|
||||
class Auto_brand_model extends HD_Model{
|
||||
class Auto_brand_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_auto_brand';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:根据id获取数据
|
||||
* Created on: 2021/7/15 17:27
|
||||
* Created by: dengbw
|
||||
* @param $ids
|
||||
* @param string $fileds
|
||||
* @return array
|
||||
*/
|
||||
public function get_map_by_ids($ids, $fileds = '')
|
||||
{
|
||||
$rows = [];
|
||||
if ($ids) {
|
||||
$cf_ids = implode(',', $ids);
|
||||
$where = [
|
||||
"id in ($cf_ids)" => null
|
||||
];
|
||||
$rows = $this->map('id', '', $where, '', '', '', $fileds);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,27 @@ class Auto_series_model extends HD_Model{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:根据id获取数据
|
||||
* Created on: 2021/7/15 17:27
|
||||
* Created by: dengbw
|
||||
* @param $ids
|
||||
* @param string $fileds
|
||||
* @return array
|
||||
*/
|
||||
public function get_map_by_ids($ids, $fileds = '')
|
||||
{
|
||||
$rows = [];
|
||||
if ($ids) {
|
||||
$cf_ids = implode(',', $ids);
|
||||
$where = [
|
||||
"id in ($cf_ids)" => null
|
||||
];
|
||||
$rows = $this->map('id', '', $where, '', '', '', $fileds);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//获取车系品牌
|
||||
public function select_brand($where=[],$order,$page,$size,$fileds='',$count=''){
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:商品表
|
||||
* Created on: 2021/7/14 15:30
|
||||
* Created by: dengbw
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Items_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_items';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user