30], [['merchant_express_mobile', 'member_express_mobile'], 'string', 'max' => 20], [['buyer_nickname', 'member_express_company', 'member_express_no'], 'string', 'max' => 100], [['refund_reason', 'merchant_express_company', 'memo'], 'string', 'max' => 255], [['refund_explain'], 'string', 'max' => 200], [['merchant_express_no'], 'string', 'max' => 50], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => '主键id', 'merchant_id' => '店铺ID', 'type' => '出售状态', // 售后 'order_id' => '订单id', 'order_sn' => '订单编号', 'order_product_id' => '订单项id', 'store_id' => '门店id', 'buyer_id' => '用户id', 'buyer_nickname' => '用户昵称', 'product_id' => '商品id', 'sku_id' => 'skuID', 'number' => '购买数量', 'refund_apply_money' => '退款申请金额', 'refund_type' => '退款方式', 'refund_pay_type' => '付款方式', 'refund_reason' => '退款原因', 'refund_explain' => '退款说明', 'refund_evidence' => '退款凭证', 'refund_status' => '退款状态', 'refund_money' => '退款金额', 'refund_time' => '退款时间', 'member_express_company' => '退款物流公司名称', 'member_express_no' => '退款物流单号', 'member_express_mobile' => '退款手机号码', 'member_express_time' => '退款物流时间', 'merchant_shipping_type' => '发货方式', // 1 需要物流 0 无需物流 'merchant_express_company_id' => '快递公司id', 'merchant_express_company' => '物流公司名称', 'merchant_express_no' => '运单编号', 'merchant_express_mobile' => '手机号码', 'merchant_express_time' => '退款物流时间', 'memo' => '备注', 'status' => '状态', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /** * @return ActiveQuery */ public function getOrder() { return $this->hasOne(Order::class, ['id' => 'order_id']); } /** * @return ActiveQuery */ public function getProduct() { return $this->hasOne(Product::class, ['id' => 'product_id']); } /** * @return ActiveQuery */ public function getOrderProduct() { return $this->hasOne(OrderProduct::class, ['id' => 'order_product_id']); } /** * @return ActiveQuery */ public function getMember() { return $this->hasOne(Member::class, ['id' => 'buyer_id']); } /** * @param $insert * @param $changedAttributes * @return void */ public function afterSave($insert, $changedAttributes) { if ($insert) { OrderProduct::updateAll(['refund_status' => $this->refund_status, 'refund_type' => $this->refund_type, 'after_sale_id' => $this->id], ['id' => $this->order_product_id]); } else { OrderProduct::updateAll(['refund_status' => $this->refund_status], ['after_sale_id' => $this->id]); } parent::afterSave($insert, $changedAttributes); } }