|
|
@@ -12,11 +12,12 @@ use app\model\system\Category;
|
|
|
use library\services\UtilService;
|
|
|
|
|
|
class Product extends BaseController
|
|
|
-{/**
|
|
|
- * 显示资源列表头部
|
|
|
- *
|
|
|
- * @return \think\Response
|
|
|
- */
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * 显示资源列表头部
|
|
|
+ *
|
|
|
+ * @return \think\Response
|
|
|
+ */
|
|
|
public function type_header()
|
|
|
{
|
|
|
//出售中商品
|
|
|
@@ -91,18 +92,18 @@ class Product extends BaseController
|
|
|
sort($item['detail'], SORT_STRING);
|
|
|
$suk = implode(',', $item['detail']);
|
|
|
if ($id) {
|
|
|
- $sukValue = ProductAttrValue::where('product_id', $id)->where('type', 0)->where('suk', $suk)->column('bar_code,cost,price,ot_price,stock,image as pic,weight,volume,brokerage,brokerage_two', 'suk');
|
|
|
+ $sukValue = ProductAttrValue::where('product_id', $id)->where('type', 0)->where('suk', $suk)->column('bar_code,cost,price,ot_price,stock,capacity,image as pic,weight,volume,brokerage', 'suk');
|
|
|
if (!count($sukValue)) {
|
|
|
$sukValue[$suk]['pic'] = '';
|
|
|
$sukValue[$suk]['price'] = 0;
|
|
|
$sukValue[$suk]['cost'] = 0;
|
|
|
$sukValue[$suk]['ot_price'] = 0;
|
|
|
$sukValue[$suk]['stock'] = 0;
|
|
|
+ $sukValue[$suk]['capacity'] = 0;
|
|
|
$sukValue[$suk]['bar_code'] = '';
|
|
|
$sukValue[$suk]['weight'] = 0;
|
|
|
$sukValue[$suk]['volume'] = 0;
|
|
|
$sukValue[$suk]['brokerage'] = 0;
|
|
|
- $sukValue[$suk]['brokerage_two'] = 0;
|
|
|
}
|
|
|
} else {
|
|
|
$sukValue[$suk]['pic'] = '';
|
|
|
@@ -110,11 +111,11 @@ class Product extends BaseController
|
|
|
$sukValue[$suk]['cost'] = 0;
|
|
|
$sukValue[$suk]['ot_price'] = 0;
|
|
|
$sukValue[$suk]['stock'] = 0;
|
|
|
+ $sukValue[$suk]['capacity'] = 0;
|
|
|
$sukValue[$suk]['bar_code'] = '';
|
|
|
$sukValue[$suk]['weight'] = 0;
|
|
|
$sukValue[$suk]['volume'] = 0;
|
|
|
$sukValue[$suk]['brokerage'] = 0;
|
|
|
- $sukValue[$suk]['brokerage_two'] = 0;
|
|
|
}
|
|
|
foreach (array_keys($detail) as $k => $title) {
|
|
|
$header[$k]['title'] = $title;
|
|
|
@@ -131,19 +132,20 @@ class Product extends BaseController
|
|
|
$valueNew[$count]['cost'] = $sukValue[$suk]['cost'] ? floatval($sukValue[$suk]['cost']) : 0;
|
|
|
$valueNew[$count]['ot_price'] = isset($sukValue[$suk]['ot_price']) ? floatval($sukValue[$suk]['ot_price']) : 0;
|
|
|
$valueNew[$count]['stock'] = $sukValue[$suk]['stock'] ? intval($sukValue[$suk]['stock']) : 0;
|
|
|
+ $valueNew[$count]['capacity'] = $sukValue[$suk]['capacity'] ? intval($sukValue[$suk]['capacity']) : 0;
|
|
|
$valueNew[$count]['bar_code'] = $sukValue[$suk]['bar_code'] ?? '';
|
|
|
$valueNew[$count]['weight'] = $sukValue[$suk]['weight'] ? floatval($sukValue[$suk]['weight']) : 0;
|
|
|
$valueNew[$count]['volume'] = $sukValue[$suk]['volume'] ? floatval($sukValue[$suk]['volume']) : 0;
|
|
|
$valueNew[$count]['brokerage'] = $sukValue[$suk]['brokerage'] ? floatval($sukValue[$suk]['brokerage']) : 0;
|
|
|
- $valueNew[$count]['brokerage_two'] = $sukValue[$suk]['brokerage_two'] ? floatval($sukValue[$suk]['brokerage_two']) : 0;
|
|
|
$count++;
|
|
|
}
|
|
|
$header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 80];
|
|
|
+ $header[] = ['title' => '货号', 'slot' => 'bar_code', 'align' => 'center', 'minWidth' => 120];
|
|
|
$header[] = ['title' => '售价', 'slot' => 'price', 'align' => 'center', 'minWidth' => 95];
|
|
|
- $header[] = ['title' => '成本价', 'slot' => 'cost', 'align' => 'center', 'minWidth' => 95];
|
|
|
- $header[] = ['title' => '原价', 'slot' => 'ot_price', 'align' => 'center', 'minWidth' => 95];
|
|
|
- $header[] = ['title' => '库存', 'slot' => 'stock', 'align' => 'center', 'minWidth' => 95];
|
|
|
- $header[] = ['title' => '商品编号', 'slot' => 'bar_code', 'align' => 'center', 'minWidth' => 120];
|
|
|
+ $header[] = ['title' => '出厂价(含所有辅材)', 'slot' => 'cost', 'align' => 'center', 'minWidth' => 95];
|
|
|
+ $header[] = ['title' => '代发价(含运费)', 'slot' => 'ot_price', 'align' => 'center', 'minWidth' => 95];
|
|
|
+ $header[] = ['title' => '现货库存', 'slot' => 'stock', 'align' => 'center', 'minWidth' => 95];
|
|
|
+ $header[] = ['title' => '单日产能', 'slot' => 'capacity', 'align' => 'center', 'minWidth' => 95];
|
|
|
$header[] = ['title' => '重量(KG)', 'slot' => 'weight', 'align' => 'center', 'minWidth' => 95];
|
|
|
$header[] = ['title' => '体积(m³)', 'slot' => 'volume', 'align' => 'center', 'minWidth' => 95];
|
|
|
$header[] = ['title' => '操作', 'slot' => 'action', 'align' => 'center', 'minWidth' => 70];
|
|
|
@@ -186,7 +188,7 @@ class Product extends BaseController
|
|
|
}
|
|
|
$productInfo['items'] = $result['attr'];
|
|
|
$productInfo['attrs'] = $result['value'];
|
|
|
- $productInfo['attr'] = ['pic' => '', 'price' => 0, 'cost' => 0, 'ot_price' => 0, 'stock' => 0, 'bar_code' => '', 'weight' => 0, 'volume' => 0, 'brokerage' => 0, 'brokerage_two' => 0];
|
|
|
+ $productInfo['attr'] = ['pic' => '', 'price' => 0, 'cost' => 0, 'ot_price' => 0, 'stock' => 0, 'capacity' => 0, 'bar_code' => '', 'weight' => 0, 'volume' => 0, 'brokerage' => 0];
|
|
|
} else {
|
|
|
$result = ProductAttrValue::where('product_id', $id)->where('type', 0)->find();
|
|
|
$productInfo['items'] = [];
|
|
|
@@ -197,11 +199,11 @@ class Product extends BaseController
|
|
|
'cost' => $result['cost'] ? floatval($result['cost']) : 0,
|
|
|
'ot_price' => $result['ot_price'] ? floatval($result['ot_price']) : 0,
|
|
|
'stock' => $result['stock'] ? floatval($result['stock']) : 0,
|
|
|
+ 'capacity' => $result['capacity'] ? floatval($result['capacity']) : 0,
|
|
|
'bar_code' => $result['bar_code'] ?? '',
|
|
|
'weight' => $result['weight'] ? floatval($result['weight']) : 0,
|
|
|
'volume' => $result['volume'] ? floatval($result['volume']) : 0,
|
|
|
'brokerage' => $result['brokerage'] ? floatval($result['brokerage']) : 0,
|
|
|
- 'brokerage_two' => $result['brokerage_two'] ? floatval($result['brokerage_two']) : 0
|
|
|
];
|
|
|
}
|
|
|
$data['productInfo'] = $productInfo;
|
|
|
@@ -222,6 +224,9 @@ class Product extends BaseController
|
|
|
'cate_id',
|
|
|
'keyword',
|
|
|
'store_info',
|
|
|
+ 'material',
|
|
|
+ 'craft',
|
|
|
+ 'packing',
|
|
|
['unit_name', '件'],
|
|
|
['postage', 0],
|
|
|
['image', []],
|