|
@@ -30,6 +30,8 @@ use Yansongda\Supports\Arr;
|
|
|
* @property bool need_complete
|
|
|
* @property string audit_remark
|
|
|
* @property string order_no
|
|
|
+ * @property string refund_type_text
|
|
|
+ * @property string refund_by_text
|
|
|
* @property float amount_last
|
|
|
* @method static static|Query FilterRefund($status=null)
|
|
|
* @method static static|Query FilterTs()
|
|
@@ -45,6 +47,9 @@ class Refund Extends Model
|
|
|
'need_tk',
|
|
|
'is_pass',
|
|
|
'need_complete',
|
|
|
+ 'refund_type_text',
|
|
|
+ 'refund_by_text',
|
|
|
+ 'reason_text',
|
|
|
];
|
|
|
const REFUND_ING=100;
|
|
|
const REFUND_PASS=200;
|
|
@@ -415,6 +420,21 @@ class Refund Extends Model
|
|
|
public function getRefundStatusTextAttr($_,$model){
|
|
|
return Arr::get(self::getRefundStatus(),$model['refund_status']);
|
|
|
}
|
|
|
+ public function getRefundTypeTextAttr($_,$model){
|
|
|
+ return Arr::get(self::getRefundTypes(),$model['refund_type']);
|
|
|
+ }
|
|
|
+ public function getRefundByTextAttr($_,$model){
|
|
|
+ if(!$model['refund_by']){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return Arr::get(self::getRefundBys(),$model['refund_by'])['value'];
|
|
|
+ }
|
|
|
+ public function getReasonTextAttr($_,$model){
|
|
|
+ if(!$model['reason1']){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return Arr::get(self::getReasons(),$model['reason1'])['value'];
|
|
|
+ }
|
|
|
#是否可以已收货
|
|
|
public function getNeedRecAttr($_,$model){
|
|
|
return $this->is_goods_back && $this->user_send_time;
|
|
@@ -479,6 +499,9 @@ class Refund Extends Model
|
|
|
{
|
|
|
self::beforeInsert(function (self $refund){
|
|
|
$refund['refund_status']=self::REFUND_ING;
|
|
|
+ if($refund->refund_type==self::REFUND_TYPE_HHBX){
|
|
|
+ $refund['fix_order_no']=order_no('wx');
|
|
|
+ }
|
|
|
});
|
|
|
self::afterUpdate(function (self $refund){
|
|
|
if($refund->refund_status==self::REFUND_PASS && $refund->isRefundMoney()){
|