goods update for admin

This commit is contained in:
xxb
2021-08-19 11:37:52 +08:00
committed by lccsw
parent f018ba456a
commit 400605ed26
6 changed files with 13 additions and 25 deletions
+4 -12
View File
@@ -8,7 +8,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class Goods extends HD_Controller
{
private $packAry = array(0 => '无', 1 => '是');
private $statusAry = array(0 => '下架', 1 => '未售', 2 => '已售');
public function __construct()
@@ -67,7 +66,7 @@ class Goods extends HD_Controller
$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['if_pack_name'] = $val['if_pack'];
$setVal['ori_price'] = $val['ori_price'];
$setVal['discount'] = $val['discount'] ? $val['discount'] . '%' : '100%';
$setVal['buy_price'] = $val['buy_price'];
@@ -88,7 +87,8 @@ class Goods extends HD_Controller
{
$autoList = array();
$id = intval($this->input->get('id'));
$info['brand_id'] = $info['s_id'] = $info['v_id'] = $info['cor_id'] = $info['incor_id'] = $info['if_pack'] = 0;
$info['brand_id'] = $info['s_id'] = $info['v_id'] = $info['cor_id'] = $info['incor_id'] = 0;
$info['if_pack'] = '';
$info['status'] = 1;
$autoList[2] = $autoList[3] = $autoList[4] = $autoList[5] = array();
if ($id > 0) {
@@ -117,7 +117,6 @@ class Goods extends HD_Controller
}
$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;
@@ -147,7 +146,7 @@ class Goods extends HD_Controller
$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['if_pack_name'] = $re['if_pack'];
$info['status_name'] = $this->statusAry[$re['status']];
$info['ori_price'] = $re['ori_price'] . '元';
$info['dis_price'] = $re['dis_price'] . '元';
@@ -309,9 +308,6 @@ class Goods extends HD_Controller
$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(); //合格证号
$pro_time = $objWorksheet->getCell('H' . $_row)->getValue(); //生产时间
$ori_price = $objWorksheet->getCell('I' . $_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));
@@ -322,17 +318,13 @@ class Goods extends HD_Controller
$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;
$pro_time = $pro_time ? gmdate("Y/m/d H:i:s", PHPExcel_Shared_Date::ExcelToPHP($pro_time)) : '';
$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 ? $ori_price : '0.00',
'vin' => $vin ? $vin : '',
'stdard_num' => $stdard_num ? $stdard_num : '',
'pro_time' => $pro_time ? $pro_time : '0000-00-00 00:00:00',
'c_time' => time()
);
$id = $this->mdItems->add($addData);
+6 -11
View File
@@ -47,13 +47,8 @@
<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 class="input-group-addon">精品加</div>
<input type="text" v-model="info.if_pack" placeholder="请输入精品加装">
</div>
</td>
<td class="table-td">
@@ -129,26 +124,26 @@
</table>
<table width="100%" style="padding:10px 10px 10px 10px;">
<tr>
<td class="table-td">
<!--<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>-->
<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">
<!--<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>
</td>-->
</tr>
<tr>
<td class="table-td">
+1 -1
View File
@@ -21,7 +21,7 @@
</tr>
<tr>
<td class="table-td">
选包装:<?= $info['if_pack_name'] ?>
精品加装:<?= $info['if_pack_name'] ?>
</td>
<td class="table-td">
车身色:<?= $info['cor_name'] ?>
+1 -1
View File
@@ -127,7 +127,7 @@
<h2><i class="fa fa-info-circle"></i> 请上传Excel文件</h2>
<p>Excel文件格式必须与模板保持一致,否则无法导入</p>
<div class="form-group-action">
<a href="/temp/goods.xlsx" target="_blank" class="btn btn-default">查看模板</a>
<a href="/temp/goods.xlsx?0819" target="_blank" class="btn btn-default">查看模板</a>
<label href="javascript:" class="btn btn-primary" style="margin-left: 10px;">
<form id="import-form">
<input type="file" id="goods-file" name="file" accept=".xls,.xlsx"
+1
View File
@@ -34,4 +34,5 @@ create table lc_items (
primary key (id)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商品表';
alter table lc_items drop column frame_num;
alter table lc_items modify if_pack varchar(256) not null default '' comment '精品加装';
Binary file not shown.