wugg il y a 7 mois
Parent
commit
4efb2fc2a0

+ 5 - 1
app/admin/controller/Consult.php

@@ -1070,7 +1070,11 @@ class Consult extends Base
         $bargain =Db::name("bargain_order")->where(['bidsNo'=>$bidNo,"is_del"=>0])->find();
         $info['bargain'] =$bargain;
         $info['good_img'] = explode(',',$info['good_img']);
-        $info['tax_name'] =TaxCategory::where(["id"=>$info['tax_id']])->value("short_name","");
+        $tax = TaxCategory::where(['id'=>$info['tax_id']])->findOrEmpty();
+        $info['tax_short_name'] =$tax['short_name'];
+        $info['tax_name'] =$tax['cat_name'];
+        $info['tax_code'] =$tax['merge_code'];
+
         //添加商品创建人字段
         $good_info = Db::name('good_basic')
             ->field('id,createrid,creater')

+ 3 - 1
app/admin/controller/Goodup.php

@@ -1478,7 +1478,9 @@ class Goodup extends Base
             $taxInfo=GoodTax::with(['tax'])->where(["spuCode"=>$supcode])->findOrEmpty();
         }
         $data['tax_id'] = $taxInfo['tax_id']??'';
-        $data['tax_name'] = $taxInfo['tax_name']??'';
+        $data['tax_name'] = $taxInfo['cat_name']??'';
+        $data['tax_short_name'] =$tax['short_name'];
+        $data['tax_code'] =$tax['merge_code'];
         $data['tax']=$taxInfo['tax']??'';
         $data["inv_good_name"]=$taxInfo['inv_good_name']??"";
         $data['field_change'] = $data['field_change']!=''?json_decode($data['field_change']):"";

+ 7 - 1
app/admin/model/GoodTax.php

@@ -3,7 +3,9 @@ declare (strict_types = 1);
 
 namespace app\admin\model;
 
-use think\Model;use think\model\concern\SoftDelete;
+use app\model\TaxCategory;
+use think\Model;
+use think\model\concern\SoftDelete;
 
 /**
  * @mixin \think\Model
@@ -15,4 +17,8 @@ class GoodTax extends Model
     protected $updateTime = 'updateTime';
     protected $deleteTime = 'delete_time';
     protected $autoWriteTimestamp = 'datetime';
+
+    public function Tax(){
+        return $this->belongsTo(TaxCategory::class,'tax_id','id')->bind(['cat_name','cat_code','short_name','merge_code']);
+    }
 }