| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\ModelLogChanging;
- class OwnerPriceOperation extends Model
- {
- use ModelLogChanging;
- protected $fillable = [
- "operation_type", //操作类型
- "name", //名称
- "strategy", //策略
- "feature", //特征
- "remark", //备注
- "priority", //优先级 值越大越高
- "discount_count", //减免值 array
- "total_price", //按单计价
- "total_discount_price",//按单计价减免 array
- "operation", //操作
- "target_id", //目标ID
- "type_mark", //类型标记 用于某些特殊项的匹配限制 0:退货 例:退货模块的单据进入模型匹配时仅匹配为0的项
- "surcharge", //附加费
- "surcharge_unit_id",//附加费单位
- "max_fee", //封顶费
- "tax_rate_id", //税率
- ];
- public static $features = null;
- public static $columnMapping = null;
- const MARK=[
- 0 => "退货单",
- ];
- public function items()
- { //出库规则
- return $this->hasMany(OwnerPriceOperationItem::class,"owner_price_operation_id","id");
- }
- public function owners()
- { //货主
- return $this->belongsToMany(Owner::class,"owner_price_operation_owner","owner_price_operation_id","owner_id");
- }
- public function taxRate()
- { //税率
- return $this->belongsTo(TaxRate::class);
- }
- public function getFeatureFormatAttribute()
- {
- if ($this->strategy == '默认')return "/";
- return app("FeatureService")->formatFeature(self::$features,$this->feature,self::$columnMapping);
- }
- }
|