Browse Source

增加售后和订单商品表关联方法

antshop
linyaostalker 5 years ago
parent
commit
0f081c90a3
  1. 28
      backend/modules/shop/models/ars/AfterSale.php

28
backend/modules/shop/models/ars/AfterSale.php

@ -4,6 +4,7 @@ namespace backend\modules\shop\models\ars;
use Yii; use Yii;
use yii\behaviors\TimestampBehavior; use yii\behaviors\TimestampBehavior;
use backend\modules\shop\models\ars\OrderGoods;
/** /**
* This is the model class for table "ats_after_sale". * This is the model class for table "ats_after_sale".
@ -30,6 +31,7 @@ use yii\behaviors\TimestampBehavior;
*/ */
class AfterSale extends \yii\db\ActiveRecord class AfterSale extends \yii\db\ActiveRecord
{ {
public $order_pay_amount; //订单支付金额
//退款类型 //退款类型
const REFUND_TYPE_ALL = 1; //全额退款 const REFUND_TYPE_ALL = 1; //全额退款
const REFUND_TYPE_PART = 2; //部分退款 const REFUND_TYPE_PART = 2; //部分退款
@ -42,7 +44,24 @@ class AfterSale extends \yii\db\ActiveRecord
const STATUS_CANCEL = 5; //已取消 const STATUS_CANCEL = 5; //已取消
//退款方式 //退款方式
const REFUND_MODE_MONEY = 1; //仅退款 const REFUND_MODE_MONEY = 1; //仅退款
const REFUND_MODE_MONEY_GOODS = 2;
const REFUND_MODE_MONEY_GOODS = 2; //退货退款
public static $refundType = [
self::REFUND_TYPE_ALL => '全额退款',
self::REFUND_TYPE_PART => '部分退款'
];
public static $status = [
self::STATUS_UNTREATED => '未处理',
self::STATUS_ACCEPT => '已同意,待买家确认',
self::STATUS_CONFIRM => '用户已确认',
self::STATUS_REJECT => '已拒绝',
self::STATUS_FINISH => '退款成功',
self::STATUS_CANCEL => '已取消'
];
public static $refundMode = [
self::REFUND_MODE_MONEY => '仅退款',
self::REFUND_MODE_MONEY_GOODS => '退货退款'
];
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -76,7 +95,7 @@ class AfterSale extends \yii\db\ActiveRecord
'user_id' => '用户id', 'user_id' => '用户id',
'order_goods_id' => '订单商品id', 'order_goods_id' => '订单商品id',
'amount' => '退货时实际退的金额', 'amount' => '退货时实际退的金额',
'count' => '退货的商品数量',
'count' => '退货的商品数量',
'apply_at' => '申请时间', 'apply_at' => '申请时间',
'dealt_at' => '处理时间', 'dealt_at' => '处理时间',
'finish_at' => '完成时间', 'finish_at' => '完成时间',
@ -92,5 +111,10 @@ class AfterSale extends \yii\db\ActiveRecord
]; ];
} }
public function getGoods()
{
return $this->hasOne(OrderGoods::className(), ['id' => 'order_goods_id']);
}
} }
Loading…
Cancel
Save