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.

116 lines
4.0 KiB

  1. <?php
  2. namespace backend\modules\shop\models\ars;
  3. /**
  4. * This is the model class for table "ats_after_sale".
  5. *
  6. * @property int $id
  7. * @property string $wx_refund_id 微信退款单号
  8. * @property string $after_sale_sn 售后单号
  9. * @property int $user_id 用户id
  10. * @property int $order_goods_id 订单商品id
  11. * @property int $amount 退货时实际退的金额
  12. * @property int $count 退货的商品数量
  13. * @property int $apply_at 申请时间
  14. * @property int $dealt_at 处理时间
  15. * @property int $finish_at 完成时间
  16. * @property int $operator_id 操作者
  17. * @property int $refund_type 退款类型:1:全额退款;2:部分退款
  18. * @property string $description 描述
  19. * @property string $image 图片
  20. * @property int $status 处理状态:0:未处理;1:已同意,待买家确认;2:用户已确认;3:已拒绝;4:退款成功;5:已取消;
  21. * @property int $reason 退货理由
  22. * @property string $remarks 店家备注
  23. * @property string $take_shipping_sn 用户发货物流单号
  24. * @property int $refund_mode 退款方式:1:仅退款;2:退货退款;
  25. */
  26. class AfterSale extends \yii\db\ActiveRecord
  27. {
  28. public $order_pay_amount; //订单支付金额
  29. //退款类型
  30. const REFUND_TYPE_ALL = 1; //全额退款
  31. const REFUND_TYPE_PART = 2; //部分退款
  32. //处理状态
  33. const STATUS_UNTREATED = 0; //未处理
  34. const STATUS_ACCEPT = 1; //已同意,待买家确认
  35. const STATUS_CONFIRM = 2; //用户已确认
  36. const STATUS_REJECT = 3; //已拒绝
  37. const STATUS_FINISH = 4; //退款成功
  38. const STATUS_CANCEL = 5; //已取消
  39. //退款方式
  40. const REFUND_MODE_MONEY = 1; //仅退款
  41. const REFUND_MODE_MONEY_GOODS = 2; //退货退款
  42. public static $refundType = [
  43. self::REFUND_TYPE_ALL => '全额退款',
  44. self::REFUND_TYPE_PART => '部分退款'
  45. ];
  46. public static $status = [
  47. self::STATUS_UNTREATED => '未处理',
  48. self::STATUS_ACCEPT => '已同意,待买家确认',
  49. self::STATUS_CONFIRM => '用户已确认',
  50. self::STATUS_REJECT => '已拒绝',
  51. self::STATUS_FINISH => '退款成功',
  52. self::STATUS_CANCEL => '已取消'
  53. ];
  54. public static $refundMode = [
  55. self::REFUND_MODE_MONEY => '仅退款',
  56. self::REFUND_MODE_MONEY_GOODS => '退货退款'
  57. ];
  58. /**
  59. * {@inheritdoc}
  60. */
  61. public static function tableName()
  62. {
  63. return 'ats_after_sale';
  64. }
  65. /**
  66. * {@inheritdoc}
  67. */
  68. public function rules()
  69. {
  70. return [
  71. [['user_id', 'order_goods_id', 'amount', 'count', 'apply_at', 'dealt_at', 'finish_at', 'operator_id', 'refund_type', 'status', 'reason', 'refund_mode'], 'integer'],
  72. [['description', 'image', 'remarks'], 'string'],
  73. [['wx_refund_id', 'after_sale_sn'], 'string', 'max' => 64],
  74. [['take_shipping_sn'], 'string', 'max' => 50],
  75. ];
  76. }
  77. /**
  78. * {@inheritdoc}
  79. */
  80. public function attributeLabels()
  81. {
  82. return [
  83. 'id' => 'id',
  84. 'wx_refund_id' => '微信退款单号',
  85. 'after_sale_sn' => '售后单号',
  86. 'user_id' => '用户id',
  87. 'order_goods_id' => '订单商品id',
  88. 'amount' => '退货时实际退的金额',
  89. 'count' => '退货的商品数量',
  90. 'apply_at' => '申请时间',
  91. 'dealt_at' => '处理时间',
  92. 'finish_at' => '完成时间',
  93. 'operator_id' => '操作者',
  94. 'refund_type' => '退款类型',
  95. 'description' => '描述',
  96. 'image' => '图片',
  97. 'status' => '处理状态',
  98. 'reason' => '退货理由',
  99. 'remarks' => '店家备注',
  100. 'take_shipping_sn' => '用户发货物流单号',
  101. 'refund_mode' => '退款方式',
  102. ];
  103. }
  104. public function getGoods()
  105. {
  106. return $this->hasOne(OrderGoods::className(), ['id' => 'order_goods_id']);
  107. }
  108. }