You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
4.1 KiB
122 lines
4.1 KiB
<?php
|
|
|
|
namespace backend\modules\shop\models\ars;
|
|
|
|
/**
|
|
* This is the model class for table "ats_after_sale".
|
|
*
|
|
* @property int $id
|
|
* @property string $wx_refund_id 微信退款单号
|
|
* @property string $after_sale_sn 售后单号
|
|
* @property int $user_id 用户id
|
|
* @property int $order_goods_id 订单商品id
|
|
* @property int $amount 退货时实际退的金额
|
|
* @property int $count 退货的商品数量
|
|
* @property int $apply_at 申请时间
|
|
* @property int $dealt_at 处理时间
|
|
* @property int $finish_at 完成时间
|
|
* @property int $operator_id 操作者
|
|
* @property int $refund_type 退款类型:1:全额退款;2:部分退款
|
|
* @property string $description 描述
|
|
* @property string $image 图片
|
|
* @property int $status 处理状态:0:未处理;1:已同意,待买家确认;2:用户已确认;3:已拒绝;4:退款成功;5:已取消;
|
|
* @property int $reason 退货理由
|
|
* @property string $remarks 店家备注
|
|
* @property string $take_shipping_sn 用户发货物流单号
|
|
* @property int $refund_mode 退款方式:1:仅退款;2:退货退款;
|
|
*/
|
|
class AfterSale extends \yii\db\ActiveRecord
|
|
{
|
|
public $order_pay_amount; //订单支付金额
|
|
//退款类型
|
|
const REFUND_TYPE_ALL = 1; //全额退款
|
|
const REFUND_TYPE_PART = 2; //部分退款
|
|
//处理状态
|
|
const STATUS_UNTREATED = 0; //未处理
|
|
const STATUS_ACCEPT = 1; //已同意,待买家确认
|
|
const STATUS_CONFIRM = 2; //用户已确认
|
|
const STATUS_REJECT = 3; //已拒绝
|
|
const STATUS_FINISH = 4; //退款成功
|
|
const STATUS_CANCEL = 5; //已取消
|
|
//退款方式
|
|
const REFUND_MODE_MONEY = 1; //仅退款
|
|
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 => '退货退款'
|
|
];
|
|
public static $afterSaleReason = [
|
|
1 => '7天无理由退货',
|
|
2 => '质量问题',
|
|
3 => '买错东西',
|
|
4 => '商品不满意',
|
|
];
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'ats_after_sale';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['user_id', 'order_goods_id', 'amount', 'count', 'apply_at', 'dealt_at', 'finish_at', 'operator_id', 'refund_type', 'status', 'reason', 'refund_mode'], 'integer'],
|
|
[['description', 'image', 'remarks'], 'string'],
|
|
[['wx_refund_id', 'after_sale_sn'], 'string', 'max' => 64],
|
|
[['take_shipping_sn'], 'string', 'max' => 50],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'id',
|
|
'wx_refund_id' => '微信退款单号',
|
|
'after_sale_sn' => '售后单号',
|
|
'user_id' => '用户id',
|
|
'order_goods_id' => '订单商品',
|
|
'amount' => '退货时实际退的金额',
|
|
'count' => '退货的商品数量',
|
|
'apply_at' => '申请时间',
|
|
'dealt_at' => '处理时间',
|
|
'finish_at' => '完成时间',
|
|
'operator_id' => '操作者',
|
|
'refund_type' => '退款类型',
|
|
'description' => '描述',
|
|
'image' => '图片',
|
|
'status' => '处理状态',
|
|
'reason' => '退货理由',
|
|
'remarks' => '店家备注',
|
|
'take_shipping_sn' => '用户发货物流单号',
|
|
'refund_mode' => '退款方式',
|
|
];
|
|
}
|
|
|
|
public function getGoods()
|
|
{
|
|
return $this->hasOne(OrderGoods::className(), ['id' => 'order_goods_id']);
|
|
}
|
|
|
|
|
|
}
|