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

  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. public static $afterSaleReason = [
  59. 1 => '7天无理由退货',
  60. 2 => '质量问题',
  61. 3 => '买错东西',
  62. 4 => '商品不满意',
  63. ];
  64. /**
  65. * {@inheritdoc}
  66. */
  67. public static function tableName()
  68. {
  69. return 'ats_after_sale';
  70. }
  71. /**
  72. * {@inheritdoc}
  73. */
  74. public function rules()
  75. {
  76. return [
  77. [['user_id', 'order_goods_id', 'amount', 'count', 'apply_at', 'dealt_at', 'finish_at', 'operator_id', 'refund_type', 'status', 'reason', 'refund_mode'], 'integer'],
  78. [['description', 'image', 'remarks'], 'string'],
  79. [['wx_refund_id', 'after_sale_sn'], 'string', 'max' => 64],
  80. [['take_shipping_sn'], 'string', 'max' => 50],
  81. ];
  82. }
  83. /**
  84. * {@inheritdoc}
  85. */
  86. public function attributeLabels()
  87. {
  88. return [
  89. 'id' => 'id',
  90. 'wx_refund_id' => '微信退款单号',
  91. 'after_sale_sn' => '售后单号',
  92. 'user_id' => '用户id',
  93. 'order_goods_id' => '订单商品',
  94. 'amount' => '退货时实际退的金额',
  95. 'count' => '退货的商品数量',
  96. 'apply_at' => '申请时间',
  97. 'dealt_at' => '处理时间',
  98. 'finish_at' => '完成时间',
  99. 'operator_id' => '操作者',
  100. 'refund_type' => '退款类型',
  101. 'description' => '描述',
  102. 'image' => '图片',
  103. 'status' => '处理状态',
  104. 'reason' => '退货理由',
  105. 'remarks' => '店家备注',
  106. 'take_shipping_sn' => '用户发货物流单号',
  107. 'refund_mode' => '退款方式',
  108. ];
  109. }
  110. public function getGoods()
  111. {
  112. return $this->hasOne(OrderGoods::className(), ['id' => 'order_goods_id']);
  113. }
  114. }