牟新芬 4 years ago
parent
commit
c6e37fdfcb

+ 2 - 2
app/home/controller/Index.php

@@ -47,8 +47,8 @@ class Index extends BaseViewController
                     <title>星选联盟</title>
                     <meta name="keywords" content="星选联盟">
                     <meta name="description" content="星选联盟">
-                    <link rel="bookmark" type="image/x-icon" href="https://boofly.cn/favicon.ico" />
-                    <link rel="shortcut icon" type="image/x-icon" href="https://boofly.cn/favicon.ico" />'. $strBody . '<script>
+                    <link rel="bookmark" type="image/x-icon" href="https://www.boofly.cn/favicon/favicon.ico" />
+                    <link rel="shortcut icon" type="image/x-icon" href="https://www.boofly.cn/favicon/favicon.ico" />'. $strBody . '<script>
                       if (window.HTMLElement) {
                           if (Object.getOwnPropertyNames(HTMLElement.prototype).indexOf(\'dataset\') === -1) {
                               Object.defineProperty(HTMLElement.prototype, \'dataset\', {

+ 5 - 2
app/model/system/ProductAttr.php

@@ -129,9 +129,11 @@ class ProductAttr extends BaseModel
             if (!isset($value['price']) || !is_numeric($value['price']) || floatval($value['price']) != $value['price'])
                 return self::setErrorInfo('请填写正确的商品价格');
             if (!isset($value['stock']) || !is_numeric($value['stock']) || intval($value['stock']) != $value['stock'])
-                return self::setErrorInfo('请填写正确的商品库存');
+                return self::setErrorInfo('请填写正确的现货库存');
+            if (!isset($value['capacity']) || !is_numeric($value['capacity']) || intval($value['capacity']) != $value['capacity'])
+                return self::setErrorInfo('请填写正确的单日产能');
             if (!isset($value['cost']) || !is_numeric($value['cost']) || floatval($value['cost']) != $value['cost'])
-                return self::setErrorInfo('请填写正确的商品成本价格');
+                return self::setErrorInfo('请填写正确的出厂价');
             if (!isset($value['pic']) || empty($value['pic']))
                 return self::setErrorInfo('请上传商品图片');
             foreach ($value['detail'] as $attrName => $attrValue) {
@@ -164,6 +166,7 @@ class ProductAttr extends BaseModel
                 'cost' => $value['cost'],
                 'ot_price' => $value['ot_price'],
                 'stock' => $value['stock'],
+                'capacity' => $value['capacity'],
                 'unique' => ProductAttrValue::where(['product_id' => $productId, 'suk' => $suk, 'type' => $type])->value('unique') ?: '',
                 'image' => $value['pic'],
                 'bar_code' => $value['bar_code'] ?? '',

+ 20 - 15
app/system/controller/v1/Product.php

@@ -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', []],