2025-07-27 21:42:34 +08:00

138 lines
4.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\common\model;
use think\Model;
class AfterSale extends Model
{
//售后状态
const STATUS_APPLY_REFUND = 0;//申请退款
const STATUS_REFUSE_REFUND = 1;//商家拒绝
const STATUS_WAIT_RETURN_GOODS = 2;//商品待退货
const STATUS_WAIT_RECEIVE_GOODS = 3;//商家待收货
const STATUS_REFUSE_RECEIVE_GOODS = 4;//商家拒收货
const STATUS_WAIT_REFUND = 5;//等待退款
const STATUS_SUCCESS_REFUND = 6;//退款成功
//退款类型
const TYPE_ONLY_REFUND = 0;//仅退款
const TYPE_REFUND_RETURN = 1;//退款退货
/**
* @notes 不能核销的状态
* @return array
* @author lbzy
* @datetime 2023-06-21 11:48:32
*/
static function CanNotVerificationStatusArr() : array
{
return [
self::STATUS_APPLY_REFUND,
self::STATUS_WAIT_RETURN_GOODS,
self::STATUS_WAIT_RECEIVE_GOODS,
self::STATUS_WAIT_REFUND,
];
}
//售后状态描述
public static function getStatusDesc($state)
{
$data = [
self::STATUS_APPLY_REFUND => '申请退款',
self::STATUS_REFUSE_REFUND => '商家拒绝',
self::STATUS_WAIT_RETURN_GOODS => '商品待退货',
self::STATUS_WAIT_RECEIVE_GOODS => '商家待收货',
self::STATUS_REFUSE_RECEIVE_GOODS => '商家拒收货',
self::STATUS_WAIT_REFUND => '等待退款',
self::STATUS_SUCCESS_REFUND => '退款成功',
];
if ($state === true) {
return $data;
}
return $data[$state] ?? '';
}
//售后类型描述
public static function getRefundTypeDesc($type)
{
$data = [
self::TYPE_ONLY_REFUND => '仅退款',
self::TYPE_REFUND_RETURN => '退款退货',
];
if ($type === true) {
return $data;
}
return $data[$type] ?? '';
}
//售后原因
public static function getReasonLists()
{
$data = [
'7天无理由退换货',
'大小尺寸与商品描述不符',
'颜色/图案/款式不符',
'做工粗糙/有瑕疵',
'质量问题',
'卖家发错货',
'少件(含缺少配件)',
'不喜欢/不想要',
'快递/物流一直未送到',
'空包裹',
'快递/物流无跟踪记录',
'货物破损已拒签',
'其他',
];
return $data;
}
function getConfirmTakeTimeAttr($fieldValue, $data)
{
return $fieldValue ? date('Y-m-d H:i:s', $fieldValue) : '';
}
public function orderGoods()
{
return $this->hasMany('order_goods', 'id', 'order_goods_id');
}
public function user()
{
return $this->hasOne('user', 'id', 'user_id')
->field('id,sn,nickname,avatar,mobile,sex,create_time');
}
public function order()
{
return $this->hasOne('order', 'id', 'order_id')
->field('id,order_sn,total_amount,order_amount,pay_way,order_status,delivery_type');
}
public function logs()
{
return $this->hasMany('after_sale_log', 'after_sale_id', 'id')->order('id desc');
}
}