其余文件

This commit is contained in:
2026-04-14 17:46:22 +08:00
parent 294b68fe37
commit 3691f4db22
1343 changed files with 189847 additions and 0 deletions

View File

@ -0,0 +1,161 @@
<?php
namespace app\common\model\after_sale;
use app\common\basics\Models;
use app\common\enum\PayEnum;
use app\common\model\Client_;
use app\common\model\Pay;
use app\common\model\shop\Shop;
use app\common\model\user\User;
use app\common\model\order\Order;
use app\common\model\order\OrderGoods;
use app\common\server\ConfigServer;
use think\facade\Db;
class AfterSale extends Models
{
//售后状态
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 售后状态描述
* @param $state
* @return string|string[]
* @author suny
* @date 2021/7/13 6:37 下午
*/
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] ?? '';
}
/**
* @notes 售后类型描述
* @param $type
* @return string|string[]
* @author suny
* @date 2021/7/13 6:37 下午
*/
public static function getRefundTypeDesc($type)
{
$data = [
self::TYPE_ONLY_REFUND => '仅退款',
self::TYPE_REFUND_RETURN => '退款退货',
];
if ($type === true) {
return $data;
}
return $data[$type] ?? '';
}
/**
* @notes 售后原因
* @return string[]
* @author suny
* @date 2021/7/13 6:37 下午
*/
public static function getReasonLists()
{
$data = [
'7天无理由退换货',
'大小尺寸与商品描述不符',
'颜色/图案/款式不符',
'做工粗糙/有瑕疵',
'质量问题',
'卖家发错货',
'少件(含缺少配件)',
'不喜欢/不想要',
'快递/物流一直未送到',
'空包裹',
'快递/物流无跟踪记录',
'货物破损已拒签',
'其他',
];
return $data;
}
/**
* @notes 预载入OrderGoods
* @return \think\model\relation\HasMany
* @author suny
* @date 2021/7/13 6:38 下午
*/
public function orderGoods()
{
return $this->hasMany(OrderGoods::class, 'id', 'order_goods_id');
}
/**
* @notes 预载入user
* @return \think\model\relation\HasOne
* @author suny
* @date 2021/7/13 6:38 下午
*/
public function user()
{
return $this->hasOne(User::class, 'id', 'user_id')
->field('id,sn,nickname,avatar,mobile,sex,create_time');
}
/**
* @notes 预载入order
* @return AfterSale|\think\model\relation\HasOne
* @author suny
* @date 2021/7/13 6:38 下午
*/
public function order()
{
return $this->hasOne(Order::class, 'id', 'order_id')
->field('id,shop_id,order_sn,total_amount,order_amount,pay_way,order_status,delivery_type')
->append(['delivery_type_text']);
}
/**
* @notes 预载入shop
* @return \think\model\relation\HasOne
* @author suny
* @date 2021/7/13 6:38 下午
*/
public function shop()
{
return $this->hasOne(Shop::class, 'id', 'shop_id')
->field('id,type,name,logo')->append(['type_desc']);
}
/**
* @notes 预载入after_sale_log
* @return \think\model\relation\HasMany
* @author suny
* @date 2021/7/13 6:39 下午
*/
public function logs()
{
return $this->hasMany('after_sale_log', 'after_sale_id', 'id')->order('id desc');
}
}

View File

@ -0,0 +1,73 @@
<?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\after_sale;
use app\common\basics\Models;
class AfterSaleLog extends Models
{
//售后操作人类型
const TYPE_USER = 0;//会员
const TYPE_SHOP = 1;//门店
//售后动作
const USER_APPLY_REFUND = 100;//会员申请售后
const USER_SEND_EXPRESS = 101;//会员发快递
const USER_CANCEL_REFUND = 102;//会员撤销售后
const USER_AGAIN_REFUND = 103;//会员重新提交申请
const SHOP_AGREE_REFUND = 104;//商家同意退款
const SHOP_REFUSE_REFUND = 105;//商家拒绝退款
const SHOP_TAKE_GOODS = 106;//商家收货
const SHOP_REFUSE_TAKE_GOODS = 107;//商家拒绝收货
const SHOP_CONFIRM_REFUND = 108;//商家确认退款
const REFUND_SUCCESS = 109;//退款成功
const REFUND_ERROR = 110;//退款失败
/**
* @notes 售后动作明细
* @param $log
* @return string|string[]
* @author suny
* @date 2021/7/13 6:39 下午
*/
public static function getLogDesc($log)
{
$desc = [
self::USER_APPLY_REFUND => '会员申请退款',
self::USER_SEND_EXPRESS => '会员填写退货物流信息',
self::USER_CANCEL_REFUND => '会员撤销售后申请',
self::USER_AGAIN_REFUND => '会员重新提交申请',
self::SHOP_AGREE_REFUND => '商家同意退款',
self::SHOP_REFUSE_REFUND => '商家拒绝退款',
self::SHOP_TAKE_GOODS => '商家收货',
self::SHOP_REFUSE_TAKE_GOODS => '商家拒绝收货',
self::SHOP_CONFIRM_REFUND => '商家确认退款',
self::REFUND_SUCCESS => '退款成功',
self::REFUND_ERROR => '退款失败',
];
if ($log === true){
return $desc;
}
return isset($desc[$log]) ? $desc[$log] : $log;
}
}