wufeng před 2 roky
rodič
revize
d35fa1f0ec

+ 458 - 0
app/abutment/controller/Good.php

@@ -11,6 +11,8 @@ use think\facade\Db;
 //商品模块
 class Good extends BaseController
 {
+    private $gold = [1 => '18K', 2 => '24K', 3 => '白银'];
+
     //获取商品列表
     public function list()
     {
@@ -966,6 +968,359 @@ class Good extends BaseController
         }
     }
 
+    //修改商品成本全部信息
+    public function editGoodUp()
+    {
+        $supcode = isset($this->post['spuCode']) && $this->post['spuCode'] != "" ? trim($this->post['spuCode']) : "";
+        if ($supcode == "") {
+            return json_show(1004, "参数spuCode不能为空");
+        }
+        $data = Db::name("good_basic")->where(["spuCode" => $supcode, "is_del" => 0])->find();
+        if ($data == false) {
+            return json_show(1004, "未找到商品数据");
+        }
+        $is_down = Db::name("good_platform")
+            ->where(["spuCode" => $supcode, "is_del" => 0])
+            ->where("exam_status", "not in", [1, 8])//exam_status=1待完善成本,8已下线,除了这两个状态外其他状态都不允许编辑
+            ->find();
+        if ($is_down != false) {
+            return json_show(1004, "存在未下线商品数据");
+        }
+        if ($data['status'] != 6 && $data['status'] != 7 && $data['status'] != 8) {
+            return json_show(1004, "商品状态有误");
+        }
+        $good_name = isset($this->post['good_name']) && $this->post['good_name'] != "" ? trim($this->post['good_name']) : "";
+        if ($good_name == "") {
+            return json_show(1004, "商品名称不能为空");
+        }
+        $cat_id = isset($this->post['cat_id']) && $this->post['cat_id'] != "" ? intval($this->post['cat_id']) : "";
+        if ($cat_id == '') {
+            return json_show(1004, "商品分类不能为空");
+        }
+        $brandid = isset($this->post['brandid']) && $this->post['brandid'] != "" ? intval($this->post['brandid']) : "0";
+//        if($brandid==''){
+//            return json_show(1004,"商品品牌不能为空");
+//        }
+        $unit = isset($this->post['unit']) && $this->post['unit'] != "" ? trim($this->post['unit']) : "";
+        if ($unit == '') {
+            return json_show(1004, "商品单位不能为空");
+        }
+        $good_type = isset($this->post['good_type']) && $this->post['good_type'] !== "" ? intval($this->post['good_type'])
+            : "";
+        if ($good_type === '') {
+            return json_show(1004, "参数good_type不能为空");
+        }
+        $moq = 0;
+        $customized = 0;
+        if ($good_type == 1) {
+            $moq = isset($this->post['moq']) && $this->post['moq'] !== "" ? intval($this->post['moq']) : "";
+            if ($moq === '') {
+                return json_show(1004, "定制商品起订量不能为空");
+            }
+            $customized = isset($this->post['customized']) && $this->post['customized'] !== "" ? intval($this->post['customized']) : "";
+            if ($customized === '') {
+                return json_show(1004, "参数customized不能为空");
+            }
+        }
+
+        $is_exclusive = isset($this->post['is_exclusive']) && $this->post['is_exclusive'] !== "" ? intval($this->post['is_exclusive']) : "";
+        if ($is_exclusive === '') {
+            return json_show(1004, "参数is_exclusive不能为空");
+        }
+//        $customized = isset($this->post['customized'])&&$this->post['customized']!==""? intval($this->post['customized']):"";
+//        if($customized===''){
+//            return json_show(1004,"参数customized不能为空");
+//        }
+        $tax = isset($this->post['tax']) && $this->post['tax'] !== "" ? intval($this->post['tax']) : "";
+        if ($tax === '') {
+            return json_show(1004, "参数tax不能为空");
+        }
+        $supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] != "" ? trim($this->post['supplierNo']) : "";
+        if ($supplierNo == '') {
+            return json_show(1004, "参数supplierNo不能为空");
+        }
+        $good_size = isset($this->post['good_size']) && $this->post['good_size'] != "" ? trim($this->post['good_size'])
+            : "";
+        if ($good_size == '') {
+            return json_show(1004, "参数good_size不能为空");
+        }
+        $company_id = isset($this->post['companyNo']) && $this->post['companyNo'] != "" ? trim($this->post['companyNo'])
+            : "";
+        if ($company_id == '') {
+            return json_show(1004, "参数companyNo不能为空");
+        }
+        $is_auth = isset($this->post['is_auth']) && $this->post['is_auth'] !== "" ? intval($this->post['is_auth']) : "";
+        if ($is_auth === '') {
+            return json_show(1004, "参数is_auth不能为空");
+        }
+        $auth_img = isset($this->post['auth_img']) && $this->post['auth_img'] != "" ? trim($this->post['auth_img']) : "";
+//        if($auth_img==''){
+//            return json_show(1004,"商品不能为空");
+//        }
+        $after_sales = isset($this->post['after_sales']) && $this->post['after_sales'] != "" ? trim($this->post['after_sales']) : "";
+        if ($after_sales == "") {
+            return json_show(1004, "参数after_sales不能为空");
+        }
+        $craft_desc = isset($this->post['craft_desc']) && $this->post['craft_desc'] != "" ? trim($this->post['craft_desc']) : "";
+
+        $good_remark = isset($this->post['good_remark']) && $this->post['good_remark'] != "" ? trim($this->post['good_remark']) : "";
+        if ($good_remark === "") {
+            return json_show(1004, "参数good_remark不能为空");
+        }
+        $weight = isset($this->post['weight']) && $this->post['weight'] !== "" ? floatval($this->post['weight']) : "";
+        if ($weight === "") {
+            return json_show(1004, "参数weight不能为空");
+        }
+        $packing_way = isset($this->post['packing_way']) && $this->post['packing_way'] !== "" ? trim($this->post['packing_way']) : "";
+        if ($packing_way === "") {
+            return json_show(1004, "参数packing_way不能为空");
+        }
+        $packing_size = isset($this->post['packing_size']) && $this->post['packing_size'] !== "" ? trim($this->post['packing_size']) : "";
+        if ($packing_size === "") {
+            return json_show(1004, "参数packing_size不能为空");
+        }
+        $packing_spec = isset($this->post['packing_spec']) && $this->post['packing_spec'] !== "" ? trim($this->post['packing_spec']) : "";
+        if ($packing_spec === "") {
+            return json_show(1004, "参数packing_spec不能为空");
+        }
+        $packing_weight = isset($this->post['packing_weight']) && $this->post['packing_weight'] !== "" ? floatval($this->post['packing_weight']) : "";
+        if ($packing_weight === "") {
+            return json_show(1004, "参数packing_weight不能为空");
+        }
+        $packing_list = isset($this->post['packing_list']) && $this->post['packing_list'] !== "" ? trim($this->post['packing_list']) : "";
+        if ($packing_list === "") {
+            return json_show(1004, "参数packing_list不能为空");
+        }
+        $good_bar = isset($this->post['good_bar']) && $this->post['good_bar'] !== "" ? trim($this->post['good_bar']) : "";
+        $supply_area = isset($this->post['supply_area']) && $this->post['supply_area'] !== "" ? intval($this->post['supply_area']) : "";
+        if ($supply_area === "") {
+            return json_show(1004, "参数supply_area不能为空");
+        }
+        $delivery_place = isset($this->post['delivery_place']) && $this->post['delivery_place'] !== "" ? $this->post['delivery_place'] : "";
+        if ($delivery_place === "") {
+            return json_show(1004, "参数delivery_place不能为空");
+        }
+        $origin_place = isset($this->post['origin_place']) && $this->post['origin_place'] !== "" ? $this->post['origin_place'] : "";
+        if ($origin_place === "") {
+            return json_show(1004, "参数origin_place不能为空");
+        }
+        $delivery_day = isset($this->post['delivery_day']) && $this->post['delivery_day'] !== "" ? intval($this->post['delivery_day']) : "";
+        if ($delivery_day === "") {
+            return json_show(1004, "参数delivery_day不能为空");
+        }
+        $lead_time = isset($this->post['lead_time']) && $this->post['lead_time'] !== "" ? intval($this->post['lead_time'])
+            : "0";
+//        if($lead_time===""){
+//            return json_show(1004,"参数lead_time不能为空");
+//        }
+        $sample_day = isset($this->post['sample_day']) && $this->post['sample_day'] !== "" ? intval($this->post['sample_day']) : "0";
+//        if($sample_day===""){
+//            return json_show(1004,"参数sample_day不能为空");
+//        }
+        $sample_fee = isset($this->post['sample_fee']) && $this->post['sample_fee'] !== "" ? floatval($this->post['sample_fee']) : "0";
+
+        $good_img = isset($this->post['good_img']) && $this->post['good_img'] != "" ? trim($this->post['good_img']) : "";
+        if ($good_img === "") {
+            return json_show(1004, "参数good_img不能为空");
+        }
+        $good_thumb_img = isset($this->post['good_thumb_img']) && $this->post['good_thumb_img'] !== "" ? trim($this->post['good_thumb_img']) : "";
+        if ($good_thumb_img === "") {
+            return json_show(1004, "参数good_thumb_img不能为空");
+        }
+        $good_info_img = isset($this->post['good_info_img']) && !empty($this->post['good_info_img']) ? trim($this->post['good_info_img']) : "";
+        if ($good_info_img === "") {
+            return json_show(1004, "参数good_info_img不能为空");
+        }
+        $cert_fee = isset($this->post['cert_fee']) && $this->post['cert_fee'] !== "" ? floatval($this->post['cert_fee']) : "0";
+        $packing_fee = isset($this->post['packing_fee']) && $this->post['packing_fee'] !== "" ? floatval($this->post['packing_fee']) : "0";
+        $cost_fee = isset($this->post['cost_fee']) && $this->post['cost_fee'] !== "" ? floatval($this->post['cost_fee']) : "0";
+        $mark_fee = isset($this->post['mark_fee']) && $this->post['mark_fee'] !== "" ? floatval($this->post['mark_fee']) : "0";
+        $demo_fee = isset($this->post['demo_fee']) && $this->post['demo_fee'] !== "" ? floatval($this->post['demo_fee']) : "0";
+        $open_fee = isset($this->post['open_fee']) && $this->post['open_fee'] !== "" ? floatval($this->post['open_fee']) : "0";
+        $noble_metal = isset($this->post['noble_metal']) && $this->post['noble_metal'] !== "" ? intval($this->post['noble_metal']) : "0";
+        $noble_weight = isset($this->post['noble_weight']) && $this->post['noble_weight'] !== "" ? floatval($this->post['noble_weight']) : "0";
+        $is_gold_price = isset($this->post['is_gold_price']) && $this->post['is_gold_price'] !== "" ? intval($this->post['is_gold_price']) : "0";
+        $market_price = isset($this->post['market_price']) && $this->post['market_price'] !== "" ? floatval($this->post['market_price']) : "";
+        $cgd_gold_price = isset($this->post['cgd_gold_price']) && $this->post['cgd_gold_price'] !== "" ? floatval($this->post['cgd_gold_price']) : "0";
+        if ($market_price === "") {
+            return json_show(1004, "参数market_price不能为空");
+        }
+        $nake_price = isset($this->post['nake_price']) && $this->post['nake_price'] !== "" ? floatval($this->post['nake_price']) : "0";
+        $config = isset($this->post['config']) && $this->post['config'] !== "" ? trim($this->post['config']) : "";
+        $other_config = isset($this->post['other_config']) && $this->post['other_config'] !== "" ? trim($this->post['other_config']) : "";
+        $is_diff = isset($this->post['is_diff']) && $this->post['is_diff'] !== "" ? intval($this->post['is_diff']) : "0";
+        $is_stock = isset($this->post['is_stock']) && $this->post['is_stock'] !== "" ? intval($this->post['is_stock']) : "0";
+        $stock_moq = isset($this->post['stock_moq']) && $this->post['stock_moq'] !== "" ? intval($this->post['stock_moq']) : "0";
+        if ($is_stock == 1 && $stock_moq == 0) {
+            return json_show(1004, "库存品备库起订量不能为零");
+        }
+//        $is_step = isset($this->post['is_step'])&&$this->post['is_step']!==""? intval($this->post['is_step']):"";
+//        if($is_step===""){
+//            return json_show(1004,"参数is_step不能为空");
+//        }
+        $good_ladder = isset($this->post['good_ladder']) && !empty($this->post['good_ladder']) ? $this->post['good_ladder'] : "";
+//        if($is_step==1 &&  $good_ladder==""){
+//            return json_show(1004,"启用阶梯,阶梯价不能为空");
+//        }
+        $speclist = isset($this->post['speclist']) && !empty($this->post['speclist']) ? $this->post['speclist'] : "";
+
+        $is_support_barter = isset($this->post['is_support_barter']) && $this->post['is_support_barter'] !== "" ? intval($this->post['is_support_barter']) : 1;
+
+        Db::startTrans();
+        try {
+            $temp = [
+                "good_name" => $good_name,
+                "cat_id" => $cat_id,
+                'brand_id' => $brandid,
+                "good_unit" => $unit,
+                "good_type" => $good_type,
+                "companyNo" => $company_id,
+                "moq" => $moq,
+                "is_exclusive" => $is_exclusive,
+                "customized" => $customized,
+                "tax" => $tax,
+                "supplierNo" => $supplierNo,
+                "is_auth" => $is_auth,
+                "good_size" => $good_size,
+                "auth_img" => $auth_img,
+                "after_sales" => $after_sales,
+                "craft_desc" => $craft_desc,
+                "good_remark" => $good_remark,
+                "weight" => $weight,
+                "packing_way" => $packing_way,
+                "packing_size" => $packing_size,
+                "packing_spec" => $packing_spec,
+                "packing_list" => $packing_list,
+                "packing_weight" => $packing_weight,
+                "good_bar" => $good_bar,
+                "supply_area" => $supply_area,
+                "delivery_place" => $delivery_place,
+                "origin_place" => $origin_place,
+                "delivery_day" => $delivery_day,
+                "lead_time" => $lead_time,
+                "sample_day" => $sample_day,
+                "sample_fee" => $sample_fee,
+                "good_img" => $good_img,
+                "good_thumb_img" => $good_thumb_img,
+                "good_info_img" => $good_info_img,
+                "cert_fee" => $cert_fee,
+                "packing_fee" => $packing_fee,
+                "is_diff" => $is_diff,
+                "config" => $config,
+                "other_config" => $other_config,
+                "is_stock" => $is_stock,
+                "cost_fee" => $cost_fee,
+                "mark_fee" => $mark_fee,
+                "demo_fee" => $demo_fee,
+                "open_fee" => $open_fee,
+                "noble_metal" => $noble_metal,
+                "noble_weight" => $noble_weight,
+                "is_gold_price" => $is_gold_price,
+                "market_price" => $market_price,
+                "nake_price" => $nake_price,
+                "cgd_gold_price" => $cgd_gold_price,
+                "is_step" => count($good_ladder) > 1 ? 1 : 0,
+                "stock_moq" => $stock_moq,
+                "status" => "0",
+                "updatetime" => date("Y-m-d H:i:s"),
+                'is_support_barter' => $is_support_barter
+            ];
+            $field = array_diff_assoc($temp, $data);
+            $temp['field_change'] = empty($field) ? "" : json_encode(array_keys($field));
+            $up = Db::name("good_basic")->where(["spuCode" => $supcode, "is_del" => 0])->save($temp);
+            $var = array_diff($temp, $data);
+            $json = json_encode($var, JSON_UNESCAPED_UNICODE);
+            $dat = json_encode($data, JSON_UNESCAPED_UNICODE);
+            if ($up) {
+                ChangeLog::logAdd(3, $data['spuCode'], $dat, $json, $this->post['token'], $this->post);
+                //修改状态,添加待办
+                ActionLog::logAdd($this->post['token'], [
+                    "order_code" => $supcode,//咨询单详情编号
+                    "status" => $data['status'],//这里的status是之前的值
+                    "action_remark" => '',//备注
+                    "action_type" => "create"//新建create,编辑edit,更改状态status
+                ], "SPCB", 0, $temp);
+
+                ProcessOrder::AddProcess($this->post['token'], [
+                    "order_type" => 'SPCB',
+                    "order_code" => $supcode,//咨询单详情编号
+                    "order_id" => $data['id'],
+                    "order_status" => 0, "before_status" => 0
+                ]);
+                if ($speclist !== "" && !empty($speclist)) {
+                    foreach ($speclist as $value) {
+                        $lemp = [];
+                        isset($value["id"]) && $value["id"] != '' ? $lemp['id'] = $value['id'] : "";
+                        $lemp['spuCode'] = $supcode;
+                        $lemp['spec_id'] = $value['spec_id'];
+                        $lemp['spec_value_id'] = $value['spec_value_id'];
+                        $lemp['is_del'] = isset($value['is_del']) ? $value['is_del'] : 0;
+                        isset($value["id"]) && $value["id"] != '' ? "" : $lemp['addtime'] = date("Y-m-d H:i:s");
+                        $lemp['updatetime'] = date("Y-m-d H:i:s");
+                        $count = Db::name("good_spec")->save($lemp);
+                        if ($count == false) {
+                            Db::rollback();
+                            return json_show(1004, "商品规格值修改失败");
+                        }
+                    }
+                }
+                if ($good_ladder !== "" && !empty($good_ladder)) {
+
+//                    $user =GetUserInfo($this->post['token']);//获取用户信息,下面更新成本表的创建人
+
+                    $top_cat_id = made($cat_id);//获取所有分类
+                    $top_cat_id = isset($top_cat_id[0]['id']) ? $top_cat_id[0]['id'] : 0;//获取顶级分类id
+
+                    foreach ($good_ladder as $value) {
+                        $lemp = [];
+                        isset($value["id"]) && $value["id"] != '' ? $lemp['id'] = $value['id'] : "";
+                        $lemp['spuCode'] = $supcode;
+                        $lemp['min_num'] = $value['min_num'];
+                        $lemp['nake_fee'] = $value['nake_fee'];
+                        $lemp['cost_fee'] = $value['cost_fee'];
+                        $lemp['delivery_fee'] = $value['delivery_fee'];
+                        $lemp['cert_fee'] = $value['cert_fee'];
+                        $lemp['mark_fee'] = $value['mark_fee'];
+                        $lemp['package_fee'] = $value['package_fee'];
+                        $lemp['other_fee'] = $value['other_fee'];
+
+                        if ($is_gold_price == 1 && $top_cat_id == 6) {
+                            // $gold =Db::name("gold_price1")->where(["type"=>$noble_metal,"status"=>1,"is_del"=>0])
+                            // ->order("addtime desc")->find();
+
+                            //$lemp['nake_total'] =$noble_weight*$gold['price'] + $value['cost_fee']*$noble_weight+$value['mark_fee']+$value['package_fee']+$value['cert_fee']+$value['nake_fee']+$value['delivery_fee']+$value['other_fee'];
+                            //成本合计=贵金属重量*供应商采购金价 + 工艺费*贵金属重量+加标费+包装费+证书费+成本裸价+运费+其他费用
+                            //成本总计启用实时金价时,采用供应商实时金价
+                            $lemp['nake_total'] = $noble_weight * $cgd_gold_price + $value['cost_fee'] * $noble_weight +
+                                $value['mark_fee'] + $value['package_fee'] + $value['cert_fee'] + $value['nake_fee'] + $value['delivery_fee'] + $value['other_fee'];
+                        } else {
+                            $lemp['nake_total'] = $value['nake_fee'] + $value['delivery_fee'] + $value['cert_fee'] + $value['mark_fee'] + $value['package_fee'] + $value['other_fee'];
+                        }
+                        $lemp['creater_id'] = $this->request->user['uid'];
+                        $lemp['creater'] = $this->request->user['nickname'];
+                        $lemp['is_del'] = isset($value['is_del']) ? $value['is_del'] : 0;
+                        isset($value["id"]) && $value["id"] != '' ? "" : $lemp['addtime'] = date("Y-m-d H:i:s");
+                        $lemp['updatetime'] = date("Y-m-d H:i:s");
+                        $count = Db::name("good_nake")->save($lemp);
+                        if ($count == false) {
+                            Db::rollback();
+                            return json_show(1004, "商品规成本修改失败");
+                        }
+                    }
+                }
+
+                Db::commit();
+                return json_show(0, "更新成功");
+            } else {
+                Db::rollback();
+                return json_show(1005, "更新失败");
+            }
+        } catch (\Exception $e) {
+            Db::rollback();
+            return json_show(1004, $e->getMessage());
+        }
+    }
+
     //获取商品详情
     public function read()
     {
@@ -1039,5 +1394,108 @@ class Good extends BaseController
         return json_show(0, "获取成功", $data);
     }
 
+    //创建规格值
+    public function createSpec()
+    {
+        $this->post = $this->request->filter('trim')->post();
+        $spec_id = isset($this->post['spec_id']) && $this->post['spec_id'] !== "" ? intval($this->post['spec_id']) : "";
+        if ($spec_id == "") {
+            return json_show(1002, "参数spec_id不能为空");
+        }
+        $spec_value = isset($this->post['spec_value']) && $this->post['spec_value'] !== "" ? trim($this->post['spec_value']) : "";
+        if ($spec_value == "") {
+            return json_show(1002, "参数spec_value不能为空");
+        }
+
+        $id_is_empty = Db::name('spec_value')
+            ->field('id')
+            ->where([
+                'spec_id' => $spec_id,
+                'spec_value' => $spec_value,
+                'is_del' => 0
+            ])->find();
+
+        if ($id_is_empty) return json_show(1005, '数据库已存在该规格值');
+        else {
+            $data = [
+                "spec_id" => $spec_id,
+                "spec_value" => $spec_value,
+                "is_del" => 0,
+                "addtime" => date("Y-m-d H:i:s"),
+                "updatetime" => date("Y-m-d H:i:s")
+            ];
+            $info = Db::name("spec_value")->insert($data);
+            if ($info) return json_show(0, "新建成功");
+            else   return json_show(1002, "新建失败");
+        }
+    }
+
+    //所有规格值
+    public function allSpec()
+    {
+        $spec_id = $this->request->filter('trim')->post('spec_id/d', 0);
+        if ($spec_id == 0) {
+            return json_show(1002, "参数spec_id不能为空");
+        }
+        $info = Db::name('spec_value')
+            ->where(['spec_id' => $spec_id, 'is_del' => 0])
+            ->select()
+            ->toArray();
+        if (empty($info)) return json_show(1002, "未找到数据");
+
+        return json_show(0, "获取成功", $info);
+    }
+
+    //分类信息
+    public function catInfo()
+    {
+//        $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+        $id = $this->request->filter('trim')->post('id/d', 0);
+        if ($id == "") {
+            return json_show(1002, "参数id不能为空");
+        }
+        $idinfo = Db::name('cat')->where(['id' => $id])->find();
+        if ($idinfo == "") {
+            return json_show(1002, "未找到数据");
+        }
+        $info = Db::name('cat_specs')->where(['cat_id' => $idinfo['id'], 'is_del' => 0])->column('specs_id');
+        $temp = Db::name('specs')->where(['id' => $info, 'is_del' => 0])->field("id,spec_name")->select();
+        //$idinfo['cat_id']=$info['cat_id'];
+        $idinfo['spec'] = $temp;
+        // $idinfo['specs_id']=$info;
+        return json_show(0, "获取成功", $idinfo);
+    }
+
+    //实时金价列表
+    public function goldPriceLastList()
+    {
+        $this->post = $this->request->filter('trim')->post();
+        $where = [['g.is_del', '=', 0]];
+        $type = isset($this->post['type']) && $this->post['type'] != "" ? intval($this->post['type']) : "";
+        if ($type !== "") $where[] = ['g.type', '=', $type];
+
+        $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
+        if ($company_name !== "") $where[] = ["g.action_id", 'in', get_company_item_user_by_name($company_name)];
+
+        $ids = Db::name("gold_price1")
+            ->where(['is_del' => 0])
+            ->group("type")
+            ->column("max(id) as id");
+        $where[] = ['g.id', 'in', $ids];
+        $list = Db::name("gold_price1")
+            ->alias('g')
+            ->field('g.*,u.itemid')
+            ->leftJoin("depart_user u", "u.uid=g.action_id AND u.is_del=0")
+            ->where($where)
+            ->cursor();
+        $data = [];
+        foreach ($list as $value) {
+            $value['type_cn'] = $this->gold[$value['type']];
+            $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
+            $data[] = $value;
+        }
+        return json_show(0, "获取成功", $data);
+    }
+
 
 }

+ 41 - 1
app/abutment/controller/Sale.php

@@ -149,7 +149,6 @@ class Sale extends BaseController
         return json_show(0, "获取成功", ['list' => $data, 'count' => $count]);
     }
 
-
     //发货单详情
     public function saleOutInfo()
     {
@@ -510,5 +509,46 @@ class Sale extends BaseController
 
     }
 
+    //咨询商品详情
+    public function goodzxinfo()
+    {
+
+        $this->post = $this->request->filter('trim')->post();
+
+        $orderCode = isset($this->post['spuCode']) && $this->post['spuCode'] != '' ? trim($this->post['spuCode']) : "";
+        if ($orderCode == "") {
+            return json_show(1003, "参数spuCode不能为空");
+        }
+        $order = Db::name("good_zixun")->where(["spuCode" => $orderCode, "is_del" => 0])->find();
+        if (empty($order)) {
+            return json_show(1003, "订单数据未找到");
+        }
+        $unit = Db::name("unit")->where(["id" => $order['good_unit']])->find();
+        if ($order['brand_id'] != 0) {
+            $brand = Db::name("brand")->where(["id" => $order['brand_id']])->find();
+            $order["brand_name"] = isset($brand['brand_name']) ? $brand['brand_name'] : "";
+        } else {
+            $order["brand_name"] = "";
+            $order["brand_id"] = "";
+        }
+        $order['specinfo'] = json_decode($order['specinfo'], true);
+        $order['unit'] = isset($unit['unit']) ? $unit['unit'] : '';
+        $order['cat_info'] = made($order['cat_id'], []);
+        $order['noble_name'] = isset($order['noble_metal']) && $order['noble_metal'] != 0 ? $this->noble[$order['noble_metal']] : "";
+        if ($order['is_gold_price'] == 1) {
+            $price = Db::name("gold_price1")->where(["type" => $order['noble_metal'], "status" => 1, "is_del" => 0])->order("addtime desc")->find();
+
+        }
+        $supplier = Db::name("supplier")->where(["code" => $order['supplierNo']])->find();
+        $order['supplier_name'] = isset($supplier['name']) ? $supplier['name'] : "";
+        $palt = Db::name("platform")->where(["id" => $order['platform_id']])->find();
+        $order['platform_name'] = isset($palt['platform_name']) ? $palt['platform_name'] : "";
+        $company = Db::name("business")->where(["companyNo" => $order['companyNo']])->find();
+        $order['company'] = isset($company['company']) ? $company['company'] : "";
+        $order["gold_price"] = isset($price['price']) ? $price['price'] : 0;
+        $order["noble_weight"] = isset($order['weight']) ? $order['weight'] : 0;
+        return json_show(0, "获取成功", $order);
+    }
+
 
 }

+ 6 - 0
app/abutment/route/app.php

@@ -23,6 +23,11 @@ route::rule('createGood', 'abutment/Good/createGood');//创建商品
 route::rule('updateGoodBasicsInfo', 'abutment/Good/updateGoodBasicsInfo');//修改商品基础信息
 route::rule('updateGoodPriceInfo', 'abutment/Good/updateGoodPriceInfo');//修改商品价格信息
 route::rule('getGoodDetail', 'abutment/Good/read');//获取商品详情
+route::rule('createSpec', 'abutment/Good/createSpec');//创建规格值
+route::rule('allSpec', 'abutment/Good/allSpec');//所有规格值
+route::rule('editGoodUp', 'abutment/Good/editGoodUp');//修改商品成本全部信息
+route::rule('catInfo', 'abutment/Good/catInfo');//分类信息
+route::rule('goldPriceLastList', 'abutment/Good/goldPriceLastList');//实时金价列表
 
 //销售订单(采销的采购单)
 route::rule('getOrderList', 'abutment/Order/getList');//列表
@@ -33,6 +38,7 @@ route::rule('saleOutList', 'abutment/Sale/saleout');//发货单列表
 route::rule('saleOutInfo', 'abutment/Sale/saleOutInfo');//发货单详情
 route::rule('outSend', 'abutment/Sale/outSend');//发货单库管发货
 route::rule('outSendBatchByImport', 'abutment/Sale/saleOutInfo');//发货单库管批量发货
+route::rule('goodZxInfo', 'abutment/Sale/goodzxinfo');//咨询商品详情
 
 //竞价单
 route::rule('crontabList', 'abutment/Consult/crontablist');//招标工作台列表