|
@@ -91,6 +91,7 @@ class Manage
|
|
|
|
|
|
public function searchProduct_api()
|
|
|
{
|
|
|
+ $id = Dever::input('id');
|
|
|
$keyword = Dever::input('keyword');
|
|
|
$where = array();
|
|
|
if ($keyword) {
|
|
@@ -144,13 +145,41 @@ class Manage
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return $data;
|
|
|
+ $width = '600';
|
|
|
+ $table = '<style>.layui-table-view{margin:10px!important}</style><table class="layui-table" lay-filter="'.$id.'">';
|
|
|
+
|
|
|
+ $table .= '<thead>
|
|
|
+ <tr>
|
|
|
+ <th lay-data="{field:\'value\', fixed:\'left\', width: 120}">ID</th>
|
|
|
+ <th lay-data="{field:\'name\', fixed:\'left\', hide:true}">名称</th>
|
|
|
+ <th lay-data="{field:\'sname\', fixed:\'left\', width: 120}">名称</th>
|
|
|
+ <th lay-data="{field:\'spec\'}">规格</th>
|
|
|
+ </tr>
|
|
|
+ </thead>';
|
|
|
+
|
|
|
+ $table .= '<tbody>';
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $table .= '<tr>
|
|
|
+ <td>'.$v['id'].'</td>
|
|
|
+ <td>'.$v['name'].'</td>
|
|
|
+ <td>'.$v['sname'].'</td>
|
|
|
+ <td>'.$v['spec'].'</td>
|
|
|
+ </tr>';
|
|
|
+ }
|
|
|
+ $table .= '</tbody>';
|
|
|
+ $table .= '</table>';
|
|
|
+
|
|
|
+ $result['list'] = $data;
|
|
|
+ //$result['table'] = $table;
|
|
|
+ $result['table_config'] = array('width' => $width);
|
|
|
+
|
|
|
+ return $result;
|
|
|
}
|
|
|
|
|
|
public function getGoods($id, $table = 'scm_servicer/in_order_goods', $cash = true)
|
|
|
{
|
|
|
$result = array();
|
|
|
- $result['head'] = array('名称', '批次', '单价', '数量', '状态');
|
|
|
+ $result['head'] = array('名称', '批次', '单位', '单价', '数量', '状态');
|
|
|
if (!$cash) {
|
|
|
unset($result['head'][1]);
|
|
|
}
|
|
@@ -163,8 +192,10 @@ class Manage
|
|
|
foreach ($data as $k => $v) {
|
|
|
$goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($v['goods_id'], $v['sku_id']);
|
|
|
$status_name = Dever::status($status, $v['status']);
|
|
|
+ $unit = Dever::db('scm/unit')->one($v['unit_id']);
|
|
|
$result['body'][$k][] = $goods_info['aname'];
|
|
|
$result['body'][$k][] = $v['batch'];
|
|
|
+ $result['body'][$k][] = $unit['name'];
|
|
|
$result['body'][$k][] = $v['cash'];
|
|
|
$result['body'][$k][] = $v['num'];
|
|
|
$result['body'][$k][] = $status_name;
|
|
@@ -261,27 +292,7 @@ class Manage
|
|
|
$unit = Dever::input('value');
|
|
|
$goods = Dever::input('goods');
|
|
|
list($goods_id, $sku_id) = explode('-', $goods);
|
|
|
- $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($goods_id, $sku_id);
|
|
|
- $result = array();
|
|
|
-
|
|
|
- if ($goods_info) {
|
|
|
- $where['goods_id'] = $goods_id;
|
|
|
- $where['sku_id'] = $sku_id;
|
|
|
-
|
|
|
- # 获取供应商供货价
|
|
|
- $supplier_id = Dever::input('supplier_id');
|
|
|
- if ($supplier_id) {
|
|
|
- $where['supplier_id'] = $supplier_id;
|
|
|
- $sku = Dever::db('scm_supplier/goods_sku')->getOne($where);
|
|
|
- }
|
|
|
- $result['cash'] = isset($sku['cost_price']) && $sku['cost_price'] ? $sku['cost_price'] : $goods_info['cost_price'];
|
|
|
-
|
|
|
- $unit = Dever::db('scm_product/info_unit')->find(array('info_id' => $goods_info['id'], 'unit_id' => $unit));
|
|
|
- if ($unit && $unit['discount'] > 0) {
|
|
|
- $result['cash'] = $result['cash'] * $unit['radio'] * $unit['discount'];
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- return array('data' => $result, 'html' => '');
|
|
|
+ return array('data' => Dever::load('scm/lib/price')->getByUnit($goods_id, $sku_id, $unit, 1, 'cost_price', Dever::input('supplier_id')), 'html' => '');
|
|
|
}
|
|
|
}
|