feat: 新增发票抬头、晒单、钱包日志等模型及后台管理功能
- 新增 invoice_title、showcase、wallet_log 模型及对应语言包 - 新增后台控制器、视图及搜索字段配置 - 修复服务类目删除保护逻辑 - 优化后台登录页面文案及样式 - 新增前端角色切换逻辑及页面拦截 - 新增 SVG 图标及样式变量 - 修复接口权限及下拉框默认值问题
这个提交包含在:
@@ -4,17 +4,11 @@ namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Invoice extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'invoice';
|
||||
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
@@ -26,21 +20,29 @@ class Invoice extends Model
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
'title_type_text',
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['normal' => __('Ordinary'), 'special' => __('Special')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
public function getTitleTypeList()
|
||||
{
|
||||
return ['wait' => __('Wait'), 'issued' => __('Issued'), 'reject' => __('Reject')];
|
||||
return ['personal' => __('Personal'), 'enterprise' => __('Enterprise')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return [
|
||||
'wait' => __('Wait'),
|
||||
'issued' => __('Issued'),
|
||||
'reject' => __('Reject'),
|
||||
'cancel' => __('Cancel'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
@@ -49,6 +51,15 @@ class Invoice extends Model
|
||||
return $list[$value] ?? '';
|
||||
}
|
||||
|
||||
public function getTitleTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['title_type'] ?? '');
|
||||
if ($value === '' && !empty($data['tax_no'])) {
|
||||
$value = 'enterprise';
|
||||
}
|
||||
$list = $this->getTitleTypeList();
|
||||
return $list[$value] ?? __('Personal');
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
@@ -57,10 +68,6 @@ class Invoice extends Model
|
||||
return $list[$value] ?? '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class InvoiceTitle extends Model
|
||||
{
|
||||
protected $name = 'invoice_title';
|
||||
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
public function getTitleTypeList()
|
||||
{
|
||||
return [
|
||||
'enterprise' => '企业单位',
|
||||
'personal' => '个人/非企业',
|
||||
];
|
||||
}
|
||||
|
||||
public function getDefaultInvoiceTypeList()
|
||||
{
|
||||
return [
|
||||
'normal' => '增值税普通发票',
|
||||
'special' => '增值税专用发票',
|
||||
];
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function merchant()
|
||||
{
|
||||
return $this->belongsTo('Merchant', 'merchant_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
@@ -36,11 +36,11 @@ class MasterSkill extends Model
|
||||
|
||||
public function master()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\Master', 'master_id', 'id')->setEagerlyType(0);
|
||||
return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function cat()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\service\Cat', 'cat_id', 'id')->setEagerlyType(0);
|
||||
return $this->belongsTo('app\admin\model\service\Cat', 'cat_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Showcase extends Model
|
||||
{
|
||||
protected $name = 'showcase';
|
||||
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
protected $append = [
|
||||
'status_text',
|
||||
];
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return [
|
||||
'normal' => '公开展示',
|
||||
'hidden' => '已屏蔽下架',
|
||||
];
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['status'] ?? '');
|
||||
$list = $this->getStatusList();
|
||||
return $list[$value] ?? '';
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function service()
|
||||
{
|
||||
return $this->belongsTo('Service', 'service_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,6 @@ class SkillDict extends Model
|
||||
|
||||
public function master()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\Master', 'master_id', 'id');
|
||||
return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class UserCoupon extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'user_coupon';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'use_time_text',
|
||||
];
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return [
|
||||
'unused' => '未使用',
|
||||
'used' => '已核销',
|
||||
'expired' => '已过期',
|
||||
];
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['status'] ?? '');
|
||||
$list = $this->getStatusList();
|
||||
return $list[$value] ?? '';
|
||||
}
|
||||
|
||||
public function getUseTimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['use_time'] ?? '');
|
||||
return $value && is_numeric($value) ? date('Y-m-d H:i:s', (int)$value) : '';
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function coupon()
|
||||
{
|
||||
return $this->belongsTo('Coupon', 'coupon_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class WalletLog extends Model
|
||||
{
|
||||
protected $name = 'wallet_log';
|
||||
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
public function getUserTypeList()
|
||||
{
|
||||
return [
|
||||
'master' => '认证师傅',
|
||||
'user' => '业主/企业用户',
|
||||
];
|
||||
}
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return [
|
||||
'settle' => '佣金结算',
|
||||
'withdraw' => '余额提现',
|
||||
'refund' => '退回/退款',
|
||||
'recharge' => '账户充值',
|
||||
'pay' => '余额支付',
|
||||
'deduct' => '判责扣款',
|
||||
];
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户