Merge branch 'fea#goods' into dev

This commit is contained in:
dengbw
2021-11-08 14:22:03 +08:00
9 changed files with 661 additions and 216 deletions
+44 -4
View File
@@ -8,7 +8,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class Goods extends HD_Controller
{
private $statusAry = array(1 => '未', 2 => '已', 0 => '下架');
private $statusAry = array(1 => '未', 2 => '已', 0 => '下架');
public function __construct()
{
@@ -379,8 +379,10 @@ class Goods extends HD_Controller
} else if ($v['biz_id'] == -1 && $v['addr_id']) {
$address = $map_addr[$v['addr_id']];
}
$title = "{$map_brand[$v['brand_id']]}-{$map_sery[$v['s_id']]}-{$map_vid[$v['v_id']]}-{$map_corid[$v['cor_id']]}";
$lists[] = array(
'id' => $v['id'],
'title' => $title,
'brand_name' => $map_brand[$v['brand_id']],
's_name' => $map_sery[$v['s_id']],
'v_name' => $map_vid[$v['v_id']],
@@ -613,8 +615,13 @@ class Goods extends HD_Controller
'status' => 1
);
}
$ret = $this->items_relate_model->add_batch($adds);
$this->items_relate_model->add_batch($adds);
}
//添加入库日志
$this->load->library('entity/items_entity');
$params = array('item_id' => $id, 'type' => 1, 'uid' => $this->uid, 'uname' => $this->username
, 'com_time' => $addData['in_time'], 'biz_id' => $addData['biz_id'], 'addr_id' => $addData['addr_id']);
$this->items_entity->add_log($params);
$this->data['status'] = 1;
$url = $info['bill_time'] ? '/items/goods/goods?sold=1' : "/items/goods/goods";
return $this->show_json(SYS_CODE_SUCCESS, '添加成功!', $url);
@@ -705,7 +712,7 @@ class Goods extends HD_Controller
return $this->show_json(SYS_CODE_FAIL, 'vin码已存在');
}
}
$re = $this->mdItems->get(['id' => $info['id']]);
$editData['brand_id'] = $info['brand_id'];
$editData['s_id'] = $info['s_id'];
$editData['v_id'] = $info['v_id'];
@@ -766,7 +773,40 @@ class Goods extends HD_Controller
}
$adds && $this->items_relate_model->add_batch($adds);
}
//添加日志
$this->load->library('entity/items_entity');
if ($re['in_time'] != $info['in_time']) {//入库时间不同修改日志
$params = array('item_id' => $info['id'], 'type' => 1, 'com_time' => $info['in_time']);
$this->items_entity->add_log($params);
}
if ($info['bill_time'] && $re['bill_time'] != $info['bill_time']) {//开票时间不同修改日志
$params = array('item_id' => $info['id'], 'type' => 3, 'uid' => $this->uid, 'uname' => $this->username
, 'com_time' => $info['bill_time'], 'biz_id' => $info['biz_id'], 'addr_id' => $info['addr_id']);
$this->items_entity->add_log($params);
}
if ($re['biz_id'] > 0 && $biz_id > 0) {//门店间变化
if ($re['biz_id'] != $biz_id) {
$params = array('item_id' => $info['id'], 'type' => 2, 'uid' => $this->uid, 'uname' => $this->username
, 'com_time' => $info['bill_time'], 'biz_id' => $re['biz_id'], 'biz_id_to' => $biz_id);
$this->items_entity->add_log($params);
}
} else if ($re['biz_id'] > 0 && $biz_id == -1) {//门店转地址变化
if ($addr_id) {
$params = array('item_id' => $info['id'], 'type' => 2, 'uid' => $this->uid, 'uname' => $this->username
, 'com_time' => $info['bill_time'], 'biz_id' => $re['biz_id'], 'addr_id_to' => $addr_id);
$this->items_entity->add_log($params);
}
} else if ($re['biz_id'] == -1 && $biz_id == -1) {//地址间变化
if ($re['addr_id'] != $addr_id) {
$params = array('item_id' => $info['id'], 'type' => 2, 'uid' => $this->uid, 'uname' => $this->username
, 'com_time' => $info['bill_time'], 'biz_id' => -1, 'addr_id' => $re['addr_id'], 'addr_id_to' => $addr_id);
$this->items_entity->add_log($params);
}
} else if ($re['biz_id'] == -1 && $biz_id > 0) {//地址转门店变化
$params = array('item_id' => $info['id'], 'type' => 2, 'uid' => $this->uid, 'uname' => $this->username
, 'com_time' => $info['bill_time'], 'biz_id' => -1, 'addr_id' => $re['addr_id'], 'biz_id_to' => $biz_id);
$this->items_entity->add_log($params);
}
$this->data['status'] = 2;
$url = $info['bill_time'] ? '/items/goods/goods?sold=1' : "/items/goods/goods";
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!', $url);
+204
View File
@@ -0,0 +1,204 @@
<?php
/**
* Notes:商品操作日志
* Created on: 2021/11/5 11:56
* Created by: dengbw
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Logs extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('items/items_oplogs_model', 'mdItemsOplogs');
$this->load->model('items/items_model', 'mdItems');
$this->load->model("biz/biz_model", 'mdBiz');
$this->load->model("sys/sys_addr_model", 'mdAddr');
$this->load->model('area_model', 'mdArea');
}
public function index()
{
$this->lists();
}
public function lists()
{
}
public function get()
{
$id = $this->input->get('id');
$re = $this->mdItems->get(array('id' => $id));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '商品不存在!');
}
$title = $this->input->get('title');
$res_log = $this->mdItemsOplogs->select(array('item_id' => $id), 'id asc', 0, 0);
$biz_ids = $biz_ids_to = $addr_ids = $addr_ids_to = array();
foreach ($res_log as $v) {
$v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_id'];
$v['biz_id_to'] && !in_array($v['biz_id_to'], $biz_ids_to) && $biz_ids_to[] = $v['biz_id_to'];
$v['addr_id'] && !in_array($v['addr_id'], $addr_ids) && $addr_ids[] = $v['addr_id'];
$v['addr_id_to'] && !in_array($v['addr_id_to'], $addr_ids_to) && $addr_ids_to[] = $v['addr_id_to'];
}
$map_biz = $map_addr = array();
if ($biz_ids || $biz_ids_to) {
if ($biz_ids && $biz_ids_to) {
$biz_ids = array_merge($biz_ids, $biz_ids_to);
} else if ($biz_ids_to) {
$biz_ids = $biz_ids_to;
}
$str_ids = implode(',', $biz_ids);
$where = array("id in ({$str_ids})" => null);
$rows_biz = $this->mdBiz->select($where, 'id desc', 0, 0, 'id,biz_name,city_id,county_id');
foreach ($rows_biz as $v) {
$address = $v['biz_name'];
if ($v['county_id']) {
$re_area = $this->mdArea->get(array('county_id' => $v['county_id']));
$re_area && $address = "{$re_area['city_name']} {$re_area['county_name']} {$address}";
} else if ($v['city_id']) {
$re_area = $this->mdArea->get(array('city_id' => $v['city_id']));
$re_area && $address = "{$re_area['city_name']} {$address}";
}
$map_biz[$v['id']] = ['title' => $v['biz_name'], 'address' => $address];
}
}
if ($addr_ids || $addr_ids_to) {
if ($addr_ids && $addr_ids_to) {
$addr_ids = array_merge($addr_ids, $addr_ids_to);
} else if ($addr_ids_to) {
$addr_ids = $addr_ids_to;
}
$str_ids = implode(',', $addr_ids);
$where = array("id in ({$str_ids})" => null);
$rows_addr = $this->mdAddr->select($where, 'id desc', 0, 0, 'id, title, city_name, county_name');
foreach ($rows_addr as $v) {
$address = "{$v['city_name']} {$v['county_name']} {$v['title']}";
$map_addr[$v['id']] = ['title' => $v['title'], 'address' => $address];
}
}
$typeAry = $this->mdItemsOplogs->typeAry();
$lists = array();
foreach ($res_log as $key => $value) {
$setValue = array();
$log = '';
if ($value['type'] == 1) {
$log = '[' . $value['com_time'] . '] 入库';
if ($value['biz_id'] > 0) {
$log .= ',存放门店 [' . $map_biz[$value['biz_id']]['address'] . ']';
} elseif ($value['addr_id']) {
$log .= ',存放地址 [' . $map_addr[$value['addr_id']]['address'] . ']';
} else {
$log .= ',未选择存放地';
}
} else if ($value['type'] == 2) {
if ($value['biz_id'] > 0 && $value['biz_id_to'] > 0) {
$log = '从 [' . $map_biz[$value['biz_id']]['address'] . '] 调拨到 [' . $map_biz[$value['biz_id_to']]['address'] . ']';
} else if ($value['biz_id'] > 0 && $value['addr_id_to']) {
$log = '从 [' . $map_biz[$value['biz_id']]['address'] . '] 调拨到 [' . $map_addr[$value['addr_id_to']]['address'] . ']';
} else if ($value['addr_id'] && $value['biz_id_to'] > 0) {
$log = '从 [' . $map_addr[$value['addr_id']]['address'] . '] 调拨到 [' . $map_biz[$value['biz_id_to']]['address'] . ']';
} else if ($value['addr_id'] && $value['addr_id_to']) {
$log = '从 [' . $map_addr[$value['addr_id']]['address'] . '] 调拨到 [' . $map_addr[$value['addr_id_to']]['address'] . ']';
}
} else if ($value['type'] == 3) {
$log = '[' . $value['com_time'] . '] 开票';
if ($value['biz_id'] > 0) {
$log .= ',出售门店 [' . $map_biz[$value['biz_id']]['address'] . ']';
} elseif ($value['addr_id']) {
$log .= ',出售地址 [' . $map_addr[$value['addr_id']]['address'] . ']';
} else {
$log .= ',未选择出售地';
}
}
$setValue['log'] = $log;
$setValue['uname'] = $value['uname'];
$setValue['type_name'] = $typeAry[$value['type']];
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
if ($value['biz_id_to'] > 0) {
$map_biz[$value['biz_id_to']]['lists'][] = $setValue;
}
if ($value['biz_id'] > 0) {
if ($value['biz_id_to'] > 0) {
if ($map_biz[$value['biz_id']]['s_time']) {
$days = round(($value['c_time'] - $map_biz[$value['biz_id']]['s_time']) / 3600 / 24);
$setValue['log'] = $setValue['log'] . ',库存' . $days . '天';
}
$map_biz[$value['biz_id_to']]['s_time'] = $value['c_time'];
} else {
if ($value['type'] == 3 && $map_biz[$value['biz_id']]['s_time']) {
$days = round(($value['c_time'] - $map_biz[$value['biz_id']]['s_time']) / 3600 / 24);
$setValue['log'] = $setValue['log'] . ',用时' . $days . '天售出车辆';
}
$map_biz[$value['biz_id']]['s_time'] = $value['c_time'];
}
$map_biz[$value['biz_id']]['lists'][] = $setValue;
}
if ($value['addr_id_to'] > 0) {
$map_addr[$value['addr_id_to']]['lists'][] = $setValue;
}
if ($value['addr_id'] > 0) {
if ($value['biz_id_to'] > 0) {
if ($map_addr[$value['addr_id']]['s_time']) {
$days = round(($value['c_time'] - $map_addr[$value['addr_id']]['s_time']) / 3600 / 24);
$setValue['log'] = $setValue['log'] . ',库存' . $days . '天';
}
$map_addr[$value['addr_id_to']]['s_time'] = $value['c_time'];
} else {
if ($value['type'] == 3 && $map_addr[$value['addr_id']]['s_time']) {
$days = round(($value['c_time'] - $map_addr[$value['addr_id']]['s_time']) / 3600 / 24);
$setValue['log'] = $setValue['log'] . ',用时' . $days . '天售出车辆';
}
$map_addr[$value['addr_id']]['s_time'] = $value['c_time'];
}
$map_addr[$value['addr_id']]['lists'][] = $setValue;
}
$lists[] = $setValue;
}
//echo json_encode($map_biz,JSON_UNESCAPED_UNICODE);
$all = array('lists' => $lists);
if ($re['in_time'] != '0000-00-00 00:00:00' && $re['bill_time'] != '0000-00-00 00:00:00') {
$days = round((strtotime($re['bill_time']) - strtotime($re['in_time'])) / 3600 / 24);
$all['title'] = "总用时{$days}天售出车辆";
} else {
$days = round((time() - strtotime($re['in_time'])) / 3600 / 24);
$all['title'] = "至今已库存{$days}";
}
$lists = array();
foreach ($map_biz as $key => $value) {
$lists[] = $value;
}
foreach ($map_addr as $key => $value) {
$lists[] = $value;
}
$this->data['all'] = $all;
$this->data['lists'] = $lists;
$this->data['_title'] = $title;
return $this->show_view('/items/logs/get', true);
}
public function add()
{
}
public function edit()
{
}
public function del()
{
}
public function batch()
{
}
public function export()
{
}
}
+8 -1
View File
@@ -582,9 +582,16 @@ class Orders extends HD_Controller
$row_order = $this->orders_model->get(array('id' => $row['o_id']));
if ($row_order) {
$this->load->model('items/items_model');
$upd = array('bill_time' => date('Y-m-d H:i:s'));
$bill_time = date('Y-m-d H:i:s');
$upd = array('bill_time' => $bill_time);
$where = array('id' => $row_order['item_id']);
$ret = $this->items_model->update($upd, $where);
if ($ret) { //添加开票日志
$this->load->library('entity/items_entity');
$params = array('item_id' => $id, 'type' => 3, 'uid' => $this->uid, 'uname' => $this->username
, 'com_time' => $bill_time, 'biz_id' => $row_order['biz_id'], 'addr_id' => $row_order['addr_id']);
$this->items_entity->add_log($params);
}
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
} else {
+93 -95
View File
@@ -1,46 +1,3 @@
<link rel="stylesheet" type="text/css" href="/static/css/appitem/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css">
<style>
.label-group-wrap {
margin-top: 10px;
font-size: 0;
}
.label-group {
display: inline-block;
margin-right: 4px;
margin-bottom: 16px;
font-size: 0;
white-space: nowrap;
}
.label-group-wrap .label, .label-group > .label {
font-size: 10px;
font-weight: normal;
margin-right: 1px;
white-space: normal;
line-height: 1.4;
}
.label {
font-weight: normal;
}
.label-group > span + a.label {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: 1px solid #fff;
margin-left: -3px;
}
.label-group-wrap .label, .label-group > .label {
font-size: 10px;
font-weight: normal;
margin-right: 1px;
white-space: normal;
line-height: 1.4;
}
</style>
<div class="am-form am-form-horizontal" style="width: 100%;padding: 10px">
<div id="vue-edit">
<div class="am-panel am-panel-default">
@@ -183,16 +140,15 @@
</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">
</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"></td>-->
<!-- </tr>-->
</table>
<table width="100%" style="padding:10px 10px 10px 10px;">
<tr>
@@ -203,13 +159,6 @@
placeholder="请输入生产日期">
</div>
</td>-->
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">入库日期</div>
<input id="in_time_id" type="text" value="<?= $info['in_time'] ?>"
placeholder="请输入或选择入库日期">
</div>
</td>
<!--<td class="table-td">
<div class="input-group">
<div class="input-group-addon">出库日期</div>
@@ -217,28 +166,13 @@
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 class="input-group-addon">入库日期</div>
<input id="in_time_id" type="text" value="<?= $info['in_time'] ?>"
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>
@@ -248,26 +182,48 @@
</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 class="input-group-addon">指导价</div>
<input type="text" v-model="info.ori_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>
<!-- <tr>-->
<!-- <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 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();'
@@ -744,7 +700,49 @@
});
});
</script>
<link rel="stylesheet" type="text/css" href="/static/css/appitem/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css">
<style type="text/css">
.label-group-wrap {
margin-top: 10px;
font-size: 0;
}
.label-group {
display: inline-block;
margin-right: 4px;
margin-bottom: 16px;
font-size: 0;
white-space: nowrap;
}
.label-group-wrap .label, .label-group > .label {
font-size: 10px;
font-weight: normal;
margin-right: 1px;
white-space: normal;
line-height: 1.4;
}
.label {
font-weight: normal;
}
.label-group > span + a.label {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: 1px solid #fff;
margin-left: -3px;
}
.label-group-wrap .label, .label-group > .label {
font-size: 10px;
font-weight: normal;
margin-right: 1px;
white-space: normal;
line-height: 1.4;
}
.input-group {
width: 100%;
padding-right: 30px;
+28 -16
View File
@@ -294,25 +294,37 @@
</a>
</span>
</th>
<th width=""><span>操作</span></th>
</tr>
</thead>
<tbody>
<tr v-for="(v,i) in lists">
<td>{{v.id}}</td>
<td>{{v.brand_name}}-{{v.s_name}}-{{v.v_name}}-{{v.cor_name}}</td>
<td>
<a href="javascript:void(0);" :data-modal="'/items/goods/goods/get_info?id='+v.id" data-title="详情">{{v.vin}}</a>
</td>
<td>{{v.address}}</td>
<td>{{v.in_time}}</td>
<td>{{v.auto_fine}}</td>
<td>
<a href="javascript:void(0);"
:data-open="'/items/goods/goods/get?id='+v.id"
class="am-btn am-btn-primary am-btn-xs">编辑</a>
</td>
</tr>
<template v-for="(v,i) in lists">
<tr>
<td>{{v.id}}</td>
<td>{{v.title}}</td>
<td>
<a href="javascript:void(0);" :data-modal="'/items/goods/goods/get_info?id='+v.id"
data-title="详情">{{v.vin}}</a>
</td>
<td>{{v.address}}</td>
<td>{{v.in_time}}</td>
<td>{{v.auto_fine}}</td>
</tr>
<tr>
<td colspan="6">
<div class="row">
<div class="col-md-4 align-l">
</div>
<div class="col-md-8 align-r" style="padding-right: 30px;">
<a href="javascript:void(0);"
:data-open="'/items/goods/logs/get?id='+v.id+'&title='+v.title"
class="am-btn am-btn-primary am-btn-xs">调拨记录</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>
</template>
</tbody>
</table>
</div>
+119 -100
View File
@@ -5,6 +5,7 @@
margin-top: 10px;
font-size: 0;
}
.label-group {
display: inline-block;
margin-right: 4px;
@@ -12,35 +13,40 @@
font-size: 0;
white-space: nowrap;
}
.label-group-wrap .label, .label-group>.label {
.label-group-wrap .label, .label-group > .label {
font-size: 10px;
font-weight: normal;
margin-right: 1px;
white-space: normal;
line-height: 1.4;
}
.label {
font-weight: normal;
}
.label-group>span+a.label {
.label-group > span + a.label {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: 1px solid #fff;
margin-left: -3px;
}
.label-group-wrap .label, .label-group>.label {
.label-group-wrap .label, .label-group > .label {
font-size: 10px;
font-weight: normal;
margin-right: 1px;
white-space: normal;
line-height: 1.4;
}
.order-on {
border-bottom: 2px solid #e61773;
height: 40px;
}
.order-none{
.order-none {
height: 38px;
}
@@ -50,7 +56,7 @@
position: relative;
}
.order a{
.order a {
display: block;
overflow: hidden;
width: 100%;
@@ -182,7 +188,7 @@
<div class="am-form-group">
<label class="am-para-label w100">车架号:</label>
<div class="am-para-inline w200">
<input type="text" name="vin" placeholder="车架号关键字" v-model="params.vin" />
<input type="text" name="vin" placeholder="车架号关键字" v-model="params.vin"/>
</div>
</div>
<div class="am-form-group">
@@ -322,25 +328,38 @@
</a>
</span>
</th>
<th width=""><span>操作</span></th>
</tr>
</thead>
<tbody>
<tr v-for="(v,i) in lists">
<template v-for="(v,i) in lists">
<tr>
<td>{{v.id}}</td>
<td>{{v.brand_name}}-{{v.s_name}}-{{v.v_name}}-{{v.cor_name}}</td>
<td>{{v.title}}</td>
<td>
<a href="javascript:void(0);" :data-modal="'/items/goods/goods/get_info?id='+v.id" data-title="详情">{{v.vin}}</a>
<a href="javascript:void(0);" :data-modal="'/items/goods/goods/get_info?id='+v.id"
data-title="详情">{{v.vin}}</a>
</td>
<td>{{v.uname}}</td>
<td>{{v.mobile}}</td>
<td>{{v.admin_name}}</td>
<td>{{v.sold_time}}</td>
<td>
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs"
:data-open="'/items/goods/goods/get?id='+v.id">编辑</a>
</tr>
<tr>
<td colspan="7">
<div class="row">
<div class="col-md-4 align-l">
</div>
<div class="col-md-8 align-r" style="padding-right: 30px;">
<a href="javascript:void(0);"
:data-open="'/items/goods/logs/get?id='+v.id+'&title='+v.title"
class="am-btn am-btn-primary am-btn-xs">调拨记录</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>
</template>
</tbody>
</table>
</div>
@@ -464,20 +483,20 @@
vue_obj = new Vue({
el: '.coms-table-wrap',
data: {
params:[],
statusAry:[],//状态
cityAry:[],//城市
countyAry:[],//行政区
params: [],
statusAry: [],//状态
cityAry: [],//城市
countyAry: [],//行政区
bizAry: [],//门店
addrAry:[],//地址
addrAry: [],//地址
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
fines:[],//搜索条件精品列表
fine_ids:[],//列表所有选中的精品列表
lists:[],
attrs_cor:[],//车身颜色选项
modal_fine:{title:'', lists:[], selected:[], page:1, size:10, total:0}
fines: [],//搜索条件精品列表
fine_ids: [],//列表所有选中的精品列表
lists: [],
attrs_cor: [],//车身颜色选项
modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0}
},
mounted:function() {
mounted: function () {
var vm = this;
vm.lists = <?=json_encode($lists)?>;
vm.params = <?=json_encode($params)?>;
@@ -488,8 +507,8 @@
vm.init_fines_lists();
vm.set_sery();
},
methods:{
init_citys:function() {
methods: {
init_citys: function () {
var vm = this;
$.ajax({
type: 'get',
@@ -518,18 +537,18 @@
that.addrAry = [];
that.params.addr_id = '';
},
init_fines:function(){
init_fines: function () {
var vm = this;
if(vm.params.fine_ids.length > 0){
if (vm.params.fine_ids.length > 0) {
$.ajax({
type: 'post',
url: '/auto/fine/json_lists',
dataType: 'json',
data: {
id: vm.params.fine_ids,
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
vm.fines = response.data.list;
}
@@ -537,32 +556,32 @@
});
}
},
init_fines_lists:function(){//初始化列表中精品
init_fines_lists: function () {//初始化列表中精品
var vm = this;
if(vm.fine_ids.length > 0){
if (vm.fine_ids.length > 0) {
$.ajax({
type: 'post',
url: '/auto/fine/json_lists',
dataType: 'json',
data: {
id: vm.fine_ids.join(','),
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
var fines = response.data.list;
var map_fine = {};
for(var i in fines){
for (var i in fines) {
var fine = fines[i];
map_fine[fine.id] = fine;
}
for(i in vm.lists){
for (i in vm.lists) {
var goods = vm.lists[i];
var auto_fine = '';
for(var j in goods.fine_ids){
for (var j in goods.fine_ids) {
var fine_id = goods.fine_ids[j];
fine = map_fine[fine_id];
if(undefined != fine){
if (undefined != fine) {
auto_fine += fine.title + " ";
}
}
@@ -574,11 +593,11 @@
});
}
},
fine_modal:function(){
fine_modal: function () {
//选择门店
var vm = this;
var selects = JSON.parse(JSON.stringify(vm.fines));
vm.modal_fine = {title:'', lists:[], selected:selects, page:1, size:10, total:0, next:0};
vm.modal_fine = {title: '', lists: [], selected: selects, page: 1, size: 10, total: 0, next: 0};
vm.get_fines();
layer.open({
type: 1,
@@ -591,28 +610,28 @@
layer.close(index);
vm.fines = JSON.parse(JSON.stringify(vm.modal_fine.selected));
var fine_ids = '';
for(var i in vm.fines){
for (var i in vm.fines) {
var fine = vm.fines[i];
if('' == fine_ids){
if ('' == fine_ids) {
fine_ids = fine.id;
} else{
fine_ids += ','+ fine.id
} else {
fine_ids += ',' + fine.id
}
}
vm.params.fine_ids = fine_ids;
}
});
},
get_fines:function(page){
get_fines: function (page) {
var vm = this;
if(0 == page){
if (0 == page) {
vm.modal_fine.page = 1;
vm.modal_fine.total = 0;
vm.modal_fine.next = 0;
} else if(1 == page){
vm.modal_fine.page+=1;
} else if(-1 == page) {
vm.modal_fine.page-=1;
} else if (1 == page) {
vm.modal_fine.page += 1;
} else if (-1 == page) {
vm.modal_fine.page -= 1;
}
$.ajax({
type: 'post',
@@ -621,24 +640,24 @@
data: {
page: vm.modal_fine.page,
size: vm.modal_fine.size,
status:1,
title:vm.modal_fine.title
status: 1,
title: vm.modal_fine.title
},
success:function(response){
success: function (response) {
if (response.code == 1) {
vm.modal_fine.lists = response.data.list;
vm.modal_fine.total = response.data.total;
if(vm.modal_fine.page * vm.modal_fine.size < vm.modal_fine.total){
vm.modal_fine.next=1;
if (vm.modal_fine.page * vm.modal_fine.size < vm.modal_fine.total) {
vm.modal_fine.next = 1;
} else {
vm.modal_fine.next=0;
vm.modal_fine.next = 0;
}
for(var i in vm.modal_fine.lists){
for (var i in vm.modal_fine.lists) {
var fine = vm.modal_fine.lists[i];
fine.checked = 0;
for(var j in vm.modal_fine.selected){
for (var j in vm.modal_fine.selected) {
var selected = vm.modal_fine.selected[j];
if(fine.id == selected.id){
if (fine.id == selected.id) {
fine.checked = 1;
}
}
@@ -647,17 +666,17 @@
}
});
},
set_fine:function(index, checked){
set_fine: function (index, checked) {
var vm = this;
var fine = vm.modal_fine.lists[index];
fine.checked = checked;
if(checked == 1){
var selected = {id:fine.id, title:fine.title};
if (checked == 1) {
var selected = {id: fine.id, title: fine.title};
vm.modal_fine.selected.push(selected);
} else {
for(var i in vm.modal_fine.selected){
for (var i in vm.modal_fine.selected) {
selected = vm.modal_fine.selected[i];
if(fine.id == selected.id){
if (fine.id == selected.id) {
vm.modal_fine.selected.splice(i, 1);
break;
}
@@ -665,34 +684,34 @@
}
vm.$forceUpdate();
},
rm_fine:function(index){
rm_fine: function (index) {
var vm = this;
vm.fines.splice(index, 1);
var fine_ids = '';
for(var i in vm.fines){
for (var i in vm.fines) {
var fine = vm.fines[i];
if('' == fine_ids){
if ('' == fine_ids) {
fine_ids = fine.id;
} else{
fine_ids += ','+ fine.id
} else {
fine_ids += ',' + fine.id
}
}
vm.params.fine_ids = fine_ids;
},
set_sery:function(){
set_sery: function () {
var vm = this;
var s_id = $('#bd-auto2-id').val();
if(s_id > 0){
if (s_id > 0) {
$.ajax({
type: 'post',
url: '/auto/attr/json_lists',
dataType: 'json',
data: {
s_id: s_id,
status:1,
type:0
status: 1,
type: 0
},
success:function(response){
success: function (response) {
if (response.code == 1) {
vm.attrs_cor = response.data.list;
}
@@ -703,11 +722,11 @@
vm.params.cor_id = '';
}
},
set_order:function(order){
set_order: function (order) {
var vm = this;
var sort = vm.params.sort;
if(vm.params.order == order){
if(vm.params.sort == 'desc'){
var sort = vm.params.sort;
if (vm.params.order == order) {
if (vm.params.sort == 'desc') {
sort = 'asc';
} else {
sort = 'desc';
@@ -723,7 +742,7 @@
$('#order').val(order);
$('.form-search').submit();
},
reset:function(){
reset: function () {
var that = this;
that.params.cor_id = '';
that.params.city_id = '';
@@ -736,7 +755,7 @@
$('#bd-auto3-id').val(0);
}
},
watch:{
watch: {
'params.city_id': function (nv, ov) {
var that = this;
if (nv == '') {
@@ -833,13 +852,13 @@
});
}
},
'params.city_id_admin':function(nv, ov){
'params.city_id_admin': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.admins.countyAry = [];
that.params.county_id_admin = '';
} else {
if(nv.substring(0,4) != that.params.county_id_admin.substring(0, 4)){
if (nv.substring(0, 4) != that.params.county_id_admin.substring(0, 4)) {
that.params.county_id_admin = '';
}
$.ajax({
@@ -848,10 +867,10 @@
dataType: 'json',
data: {
id: nv,
key:'county',
type:1
key: 'county',
type: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
that.admins.countyAry = response.data;
}
@@ -859,9 +878,9 @@
});
}
},
'params.county_id_admin':function(nv, ov){
'params.county_id_admin': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.admins.bizAry = [];
that.params.biz_id_admin = '';
} else {
@@ -872,15 +891,15 @@
data: {
city_id: that.params.city_id_admin,
county_id: that.params.county_id_admin,
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
that.admins.bizAry = response.data.list;
if(that.params.biz_id_admin>0){
if (that.params.biz_id_admin > 0) {
var biz_id = '';
for(var i in that.admins.bizAry){
if(that.params.biz_id_admin == that.admins.bizAry[i].id){
for (var i in that.admins.bizAry) {
if (that.params.biz_id_admin == that.admins.bizAry[i].id) {
biz_id = that.params.biz_id_admin;
break;
}
@@ -892,9 +911,9 @@
});
}
},
'params.biz_id_admin':function(nv, ov){
'params.biz_id_admin': function (nv, ov) {
var that = this;
if(nv == ''){
if (nv == '') {
that.admins.list = [];
that.params.admin_id = '';
} else {
@@ -904,15 +923,15 @@
dataType: 'json',
data: {
biz_id: nv,
status:1
status: 1
},
success:function(response){
success: function (response) {
if (response.code == 1) {
that.admins.list = response.data.list;
if(that.params.admin_id>0){
if (that.params.admin_id > 0) {
var admin_id = '';
for(var i in that.admins.list){
if(that.params.admin_id == that.admins.list[i].id){
for (var i in that.admins.list) {
if (that.params.admin_id == that.admins.list[i].id) {
admin_id = that.params.admin_id;
break;
}
+79
View File
@@ -0,0 +1,79 @@
<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">
<div class="am-tabs" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">
<li class="am-active"><a href="javascript: void(0)">车辆记录</a></li>
<?
if ($lists) {
foreach ($lists as $key => $val) { ?>
<li><a href="javascript: void(0)"><?= $val['title'] ?></a></li>
<? }
} ?>
</ul>
<div class="am-tabs-bd">
<div class="am-tab-panel am-active">
<div><?= $all['title'] ?></div>
<table class="am-table">
<thead>
<tr>
<th width="10%"><span>操作人员</span></th>
<th width=""><span>内容</span></th>
<th width="13%"><span>类型</span></th>
<th width="15%"><span>操作时间</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($all['lists'] as $key => $val) { ?>
<tr>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val['uname'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val['log'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val['type_name'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word;"><?= $val['c_time'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?
if ($lists) {
foreach ($lists as $key => $val) { ?>
<div class="am-tab-panel">
<table class="am-table">
<thead>
<tr>
<th width="20%"><span>操作人员</span></th>
<th width=""><span>内容</span></th>
<th width="13%"><span>类型</span></th>
<th width="15%"><span>操作时间</span></th>
</tr>
</thead>
<tbody>
<?
if ($val['lists']) {
foreach ($val['lists'] as $key2 => $val2) { ?>
<tr>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val2['uname'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val2['log'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val2['type_name'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word;"><?= $val2['c_time'] ?></td>
</tr>
<? }
} ?>
</tbody>
</table>
</div>
<? }
} ?>
</div>
</div>
</div>
</div>
</div>
</div>
+58
View File
@@ -0,0 +1,58 @@
<?php
/**
* Notes:商品
* Created on: 2021/11/4 14:10
* Created by: dengbw
*/
class Items_entity
{
private $ci;
public function __construct()
{
$this->ci = &get_instance();
}
/**
* Notes:商品操作日志
* Created on: 2021/11/4 16:31
* Created by: dengbw
* @param array $params
* @return mixed
*/
public function add_log($params = [])
{
$this->ci->load->model('items/items_oplogs_model', 'mdItemsOplogs');
$add_data = [
'item_id' => intval($params['item_id']),
'uid' => intval($params['uid']),
'type' => intval($params['type']),
'c_time' => time()
];
$params['uname'] && $add_data['uname'] = $params['uname'];
$params['biz_id'] && $add_data['biz_id'] = $params['biz_id'];
$params['addr_id'] && $add_data['addr_id'] = $params['addr_id'];
$edit_data = [];
if ($params['type'] == 1 || $params['type'] == 3) {//入库 出库/开票
$re = $this->ci->mdItemsOplogs->get(['item_id' => $params['item_id'], 'type' => $params['type']]);
if ($re) {
$params['com_time'] && $edit_data['com_time'] = $params['com_time'];
} else {
$params['com_time'] && $add_data['com_time'] = $params['com_time'];
}
} elseif ($params['type'] == 2) {//调拨
$params['biz_id_to'] && $add_data['biz_id_to'] = $params['biz_id_to'];
$params['addr_id_to'] && $add_data['addr_id_to'] = $params['addr_id_to'];
}
if ($edit_data) {
$result = $this->ci->mdItemsOplogs->update($edit_data, ['item_id' => $params['item_id'], 'type' => $params['type']]);
} else {
$result = $this->ci->mdItemsOplogs->add($add_data);
}
return $result;
}
}
?>
@@ -0,0 +1,28 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:商品操作日志表
* Created on: 2021/11/4 14:10
* Created by: dengbw
*/
class Items_oplogs_model extends HD_Model
{
private $table_name = 'lc_items_oplogs';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
/**
* Notes:类型
* Created on: 2021/11/05 10:31
* Created by: dengbw
* @return array
*/
public function typeAry()
{
return array(1 => '入库', 2 => '调拨', 3 => '出库/开票');
}
}