|
@@ -5,10 +5,10 @@ namespace app\admin\controller;
|
|
|
use app\admin\common\Ocr;
|
|
|
use app\admin\model\ActionLog;
|
|
|
use app\admin\model\DataGroup as DataGroupModel;
|
|
|
-use app\admin\model\ProcessOrder;
|
|
|
+use app\admin\model\GoodTax;use app\admin\model\GoodZixun;use app\admin\model\ProcessOrder;
|
|
|
use app\BaseController;
|
|
|
use think\App;
|
|
|
-use think\facade\Db;
|
|
|
+use think\facade\Db;use think\facade\Validate;
|
|
|
|
|
|
class Activity extends Base
|
|
|
{
|
|
@@ -200,7 +200,6 @@ class Activity extends Base
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
$list = Db::name('good_zixun')
|
|
|
->alias("a")
|
|
|
-// ->join("supplier b","b.code=a.supplierNo","left")
|
|
|
->where($where)
|
|
|
->page($page,$size)
|
|
|
->order("a.addtime desc")
|
|
@@ -226,9 +225,9 @@ class Activity extends Base
|
|
|
$userCommon = \app\admin\common\User::getIns();
|
|
|
$tmp = $userCommon->handle('getCodeAndName',['code'=>$all_code]);
|
|
|
$depart = get_company_name_by_uid( array_unique(array_column($list,'order_createrid')));
|
|
|
-
|
|
|
-//halt($list);
|
|
|
$data=[];
|
|
|
+ $taxspcu = GoodTax::where('spuCode',"in",array_column($list,"spuCode"))
|
|
|
+ ->column('status',"spuCode");
|
|
|
//分类/规格/品牌 等字段取出对应文字
|
|
|
$goodbasice = Db::name('good_basic')->where(['spuCode'=>array_column($list,"spuCode")])->column('status',"spuCode");
|
|
|
$good_online = Db::name('good_platform')->where(['spuCode'=>array_column($list,"spuCode")])->column('id',"spuCode");
|
|
@@ -236,7 +235,7 @@ class Activity extends Base
|
|
|
$value['cat_info']= made($value['cat_id'],[]);
|
|
|
$value['is_basic']=$goodbasice[$value['spuCode']]??null;
|
|
|
$value['order_creater_depart']=$depart[$value['order_createrid']]??'';
|
|
|
-
|
|
|
+ $value['tax_status']=$taxspcu[$value['spuCode']]??'0';
|
|
|
$value['is_online']=isset($good_online[$value['spuCode']])?1:0;
|
|
|
|
|
|
$value['platform_name'] = $all_platform[$value['platform_id']]??'';//isset($platform['platform_name']) ? $platform['platform_name']:"";
|
|
@@ -280,6 +279,26 @@ class Activity extends Base
|
|
|
return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
|
|
|
}
|
|
|
|
|
|
+ public function SetZixunTax(){
|
|
|
+ $param =$this->request->param(["spuCode"=>"","out_tax_id"=>"","out_tax"=>""],"post","trim");
|
|
|
+ $valid = Validate::rule( [
|
|
|
+ 'spuCode' => 'require',
|
|
|
+ 'out_tax_id' => 'require|number|gt:0',
|
|
|
+ 'out_tax' => 'require',
|
|
|
+ ]);
|
|
|
+ if(!$valid->check($param))$this->error($valid->getError());
|
|
|
+ $goodinfo = GoodZixun::where(["spuCode"=>$param['spuCode']])->findOrEmpty();
|
|
|
+ if($goodinfo->isEmpty()){
|
|
|
+ $this->error('商品不存在');
|
|
|
+ }
|
|
|
+ $goodTax = GoodTax::where(["spuCode"=>$param['spuCode']])->findOrEmpty();
|
|
|
+ if($goodTax->isEmpty())$this->error("商品进项税目未设置");
|
|
|
+ $goodTax->out_tax_id=$param['out_tax_id'];
|
|
|
+ $goodTax->out_tax=$param['out_tax'];
|
|
|
+ $goodTax->save();
|
|
|
+ return app_show(0,"设置成功");
|
|
|
+ }
|
|
|
+
|
|
|
//创建活动
|
|
|
public function create(){
|
|
|
$activity_name = isset($this->post['activity_name'])&&$this->post['activity_name']!="" ? trim($this->post['activity_name']):"";
|