<?php

namespace backend\modules\shop\models\ars;

use Yii;
use yii\behaviors\TimestampBehavior;

/**
 * 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
{
    //退款类型
    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;
    /**
     * {@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' => '订单商品id',
            'amount' => '退货时实际退的金额',
            'count' => '退换货的商品数量',
            'apply_at' => '申请时间',
            'dealt_at' => '处理时间',
            'finish_at' => '完成时间',
            'operator_id' => '操作者',
            'refund_type' => '退款类型',
            'description' => '描述',
            'image' => '图片',
            'status' => '处理状态',
            'reason' => '退换货理由',
            'remarks' => '店家备注',
            'take_shipping_sn' => '用户发货物流单号',
            'refund_mode' => '退款方式',
        ];
    }
   

}