chore: 移除废弃的增项服务模块并升级服务架构
- 删除 Addon 相关控制器、模型、语言包和视图文件 - 新增服务类型支持一口价属性配置 - 新增系统监控、用户资料、订单评价等后端管理页面 - 新增数据库表结构及索引优化脚本 - 更新应用版本号至 1.0.44 - 更新小程序应用标识 - 完善 .gitignore 配置
这个提交包含在:
@@ -26,7 +26,6 @@ class Service extends Backend
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\Service;
|
||||
$this->view->assign("priceTypeList", $this->model->getPriceTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
|
||||
// 获取统一服务字典表(fa_service_type,不绑定单一类目,主服务与增项服务同源)
|
||||
@@ -66,7 +65,7 @@ class Service extends Backend
|
||||
}
|
||||
// 一次性批量查询当前页商品的细分规格,避免 N+1 查询
|
||||
$allSpecs = Db::name('service_spec')
|
||||
->field('id,service_id,name,description')
|
||||
->field('id,service_id,name,base_price,description')
|
||||
->where('service_id', 'in', $serviceIds)
|
||||
->where('status', 'normal')
|
||||
->order('weigh desc, id asc')
|
||||
@@ -77,7 +76,8 @@ class Service extends Backend
|
||||
if (!isset($specMap[$sid])) {
|
||||
$specMap[$sid] = [];
|
||||
}
|
||||
$specMap[$sid][] = $sp['name'];
|
||||
$spPrice = (float)$sp['base_price'];
|
||||
$specMap[$sid][] = $spPrice > 0 ? ($sp['name'] . '(¥' . round($spPrice) . ')') : $sp['name'];
|
||||
}
|
||||
foreach ($rows as &$r) {
|
||||
$sid = (int)$r['id'];
|
||||
@@ -125,7 +125,7 @@ class Service extends Backend
|
||||
$serviceId = $this->model->id;
|
||||
|
||||
// 处理商品规格列表
|
||||
$this->syncSpecs($serviceId, $this->request->post('specs/a', []), isset($params['base_price']) ? (float)$params['base_price'] : 0);
|
||||
$this->syncSpecs($serviceId, $this->request->post('specs/a', []));
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
@@ -168,7 +168,7 @@ class Service extends Backend
|
||||
$result = $row->allowField(true)->save($params);
|
||||
|
||||
// 同步处理商品规格列表
|
||||
$this->syncSpecs($row->id, $this->request->post('specs/a', []), isset($params['base_price']) ? (float)$params['base_price'] : (float)$row->base_price);
|
||||
$this->syncSpecs($row->id, $this->request->post('specs/a', []));
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
@@ -220,20 +220,75 @@ class Service extends Backend
|
||||
if (isset($params['service_types_raw'])) {
|
||||
if (is_string($params['service_types_raw'])) {
|
||||
$parsedTypes = json_decode($params['service_types_raw'], true) ?: [];
|
||||
$params['service_types'] = $params['service_types_raw'];
|
||||
} else {
|
||||
$parsedTypes = is_array($params['service_types_raw']) ? $params['service_types_raw'] : [];
|
||||
$params['service_types'] = json_encode($parsedTypes, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
unset($params['service_types_raw']);
|
||||
|
||||
if (empty($parsedTypes)) {
|
||||
throw new ValidateException('请至少开启 1 项主服务');
|
||||
}
|
||||
|
||||
$dictSupportMap = Db::name('service_type')->column('support_fixed', 'code');
|
||||
$hasDefault = false;
|
||||
foreach ($parsedTypes as &$pt) {
|
||||
$code = isset($pt['code']) ? (string)$pt['code'] : '';
|
||||
$supportFixed = isset($dictSupportMap[$code])
|
||||
? (int)$dictSupportMap[$code]
|
||||
: (isset($pt['support_fixed']) ? (int)$pt['support_fixed'] : 1);
|
||||
$price = ($supportFixed === 1 && isset($pt['price'])) ? round((float)$pt['price'], 2) : 0.00;
|
||||
$pt['price'] = $price;
|
||||
$pt['support_fixed'] = $supportFixed;
|
||||
if ($supportFixed === 1 && !empty($pt['is_default']) && !$hasDefault) {
|
||||
$pt['is_default'] = 1;
|
||||
$hasDefault = true;
|
||||
} else {
|
||||
$pt['is_default'] = 0;
|
||||
}
|
||||
}
|
||||
unset($pt);
|
||||
|
||||
if (!$hasDefault && !empty($parsedTypes)) {
|
||||
foreach ($parsedTypes as &$ptDef) {
|
||||
if ((int)$ptDef['support_fixed'] === 1) {
|
||||
$ptDef['is_default'] = 1;
|
||||
$hasDefault = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($ptDef);
|
||||
if (!$hasDefault) {
|
||||
$parsedTypes[0]['is_default'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$params['service_types'] = json_encode(array_values($parsedTypes), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
if (isset($params['addons_raw'])) {
|
||||
$params['addons'] = is_string($params['addons_raw']) ? $params['addons_raw'] : json_encode($params['addons_raw'], JSON_UNESCAPED_UNICODE);
|
||||
$parsedAddons = is_string($params['addons_raw'])
|
||||
? (json_decode($params['addons_raw'], true) ?: [])
|
||||
: (is_array($params['addons_raw']) ? $params['addons_raw'] : []);
|
||||
unset($params['addons_raw']);
|
||||
$cleanAddons = [];
|
||||
foreach ($parsedAddons as $idx => $ad) {
|
||||
$adName = isset($ad['name']) ? trim((string)$ad['name']) : '';
|
||||
$adPrice = isset($ad['price']) ? round((float)$ad['price'], 2) : 0.00;
|
||||
if ($adName === '' || $adPrice <= 0) {
|
||||
continue;
|
||||
}
|
||||
$cleanAddons[] = [
|
||||
'id' => isset($ad['id']) ? (int)$ad['id'] : ($idx + 1),
|
||||
'code' => isset($ad['code']) ? (string)$ad['code'] : ('addon_' . ($idx + 1)),
|
||||
'name' => $adName,
|
||||
'unit' => !empty($ad['unit']) ? (string)$ad['unit'] : '份',
|
||||
'price' => $adPrice,
|
||||
];
|
||||
}
|
||||
$params['addons'] = json_encode($cleanAddons, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
// 自动从关联的主服务(优先默认主服务或“安装”)同步底层 base_price 与 price_type,商品无需单独填价格
|
||||
// 自动从关联的主服务(优先默认首选主服务)同步底层 base_price 与 price_type
|
||||
if (!empty($parsedTypes)) {
|
||||
$defItem = $parsedTypes[0];
|
||||
foreach ($parsedTypes as $pt) {
|
||||
@@ -251,9 +306,9 @@ class Service extends Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步商品规格型号表(规格不设独立商品价格,仅标识具体施工标的物型号)
|
||||
* 同步商品规格型号表(支持特殊规格单独设价覆盖,留空或0则沿用商品默认服务价)
|
||||
*/
|
||||
protected function syncSpecs($serviceId, $specsInput, $defaultBasePrice = 0.00)
|
||||
protected function syncSpecs($serviceId, $specsInput)
|
||||
{
|
||||
if (empty($serviceId)) return;
|
||||
$now = time();
|
||||
@@ -264,6 +319,9 @@ class Service extends Backend
|
||||
$name = trim(isset($item['name']) ? $item['name'] : '');
|
||||
if ($name === '') continue;
|
||||
$specDesc = isset($item['description']) ? trim($item['description']) : '';
|
||||
$specPrice = (isset($item['base_price']) && is_numeric($item['base_price']) && (float)$item['base_price'] > 0)
|
||||
? round((float)$item['base_price'], 2)
|
||||
: 0.00;
|
||||
$specId = isset($item['id']) ? (int)$item['id'] : 0;
|
||||
$weigh = max(0, 100 - $idx * 5);
|
||||
$idx++;
|
||||
@@ -271,7 +329,7 @@ class Service extends Backend
|
||||
if ($specId > 0) {
|
||||
Db::name('service_spec')->where('id', $specId)->where('service_id', $serviceId)->update([
|
||||
'name' => $name,
|
||||
'base_price' => $defaultBasePrice,
|
||||
'base_price' => $specPrice,
|
||||
'description' => $specDesc,
|
||||
'weigh' => $weigh,
|
||||
'updatetime' => $now,
|
||||
@@ -281,7 +339,7 @@ class Service extends Backend
|
||||
$newId = Db::name('service_spec')->insertGetId([
|
||||
'service_id' => $serviceId,
|
||||
'name' => $name,
|
||||
'base_price' => $defaultBasePrice,
|
||||
'base_price' => $specPrice,
|
||||
'description' => $specDesc,
|
||||
'weigh' => $weigh,
|
||||
'status' => 'normal',
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\service;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 增项服务管理
|
||||
*
|
||||
* @icon fa fa-plus-square
|
||||
*/
|
||||
class Addon extends Backend
|
||||
{
|
||||
/**
|
||||
* Addon模型对象
|
||||
* @var \app\admin\model\service\Addon
|
||||
*/
|
||||
protected $model = null;
|
||||
protected $relationSearch = true;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\service\Addon;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
|
||||
// 获取分类列表
|
||||
$cats = Db::name('service_cat')->where('status', 'normal')->column('id,name');
|
||||
$this->view->assign("catList", [0 => '通用全部类目'] + $cats);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if (false === $this->request->isAjax()) {
|
||||
return $this->view->fetch();
|
||||
}
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
||||
$list = $this->model
|
||||
->with(['cat'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||
return json($result);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'Cat_id' => '所属服务类目',
|
||||
'Name' => '增值服务名称',
|
||||
'Unit' => '计价单位',
|
||||
'Default_price' => '平台指导价(元)',
|
||||
'Weigh' => '排序权重',
|
||||
'Status' => '服务状态',
|
||||
'Normal' => '正常启用',
|
||||
'Hidden' => '隐藏下架',
|
||||
];
|
||||
@@ -2,19 +2,14 @@
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Service extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'service';
|
||||
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
@@ -28,7 +23,6 @@ class Service extends Model
|
||||
'price_type_text',
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
@@ -38,9 +32,13 @@ class Service extends Model
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
|
||||
}
|
||||
});
|
||||
|
||||
self::afterDelete(function ($row) {
|
||||
$pk = $row->getPk();
|
||||
Db::name('service_spec')->where('service_id', $row[$pk])->delete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function getPriceTypeList()
|
||||
{
|
||||
return ['fixed' => __('Fixed'), 'quote' => __('Quote'), 'range' => __('Range')];
|
||||
@@ -51,7 +49,6 @@ class Service extends Model
|
||||
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
|
||||
}
|
||||
|
||||
|
||||
public function getPriceTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['price_type'] ?? '');
|
||||
@@ -59,7 +56,6 @@ class Service extends Model
|
||||
return $list[$value] ?? '';
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['status'] ?? '');
|
||||
@@ -67,10 +63,6 @@ class Service extends Model
|
||||
return $list[$value] ?? '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function cat()
|
||||
{
|
||||
return $this->belongsTo('app\\admin\\model\\service\\Cat', 'cat_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\service;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Addon extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'service_addon';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function cat()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\service\Cat', 'cat_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
@@ -195,14 +195,18 @@
|
||||
|
||||
<div class="srv-section-card">
|
||||
<div class="srv-section-header">
|
||||
<div class="srv-section-title"><i class="fa fa-tags"></i> 商品细分型号与款式规格</div>
|
||||
<div class="srv-section-title">
|
||||
<i class="fa fa-tags"></i> 商品细分型号与款式规格
|
||||
<small class="text-muted" style="font-weight:400;font-size:12px;">(常规规格留空价格即可,自动沿用商品默认服务价;仅施工难度特殊的规格需填专属一口价)</small>
|
||||
</div>
|
||||
<button type="button" class="btn btn-xs btn-success" id="btn-add-spec"><i class="fa fa-plus"></i> 新增细分规格</button>
|
||||
</div>
|
||||
<table class="table table-bordered table-hover" id="specs-table" style="margin-bottom: 0;">
|
||||
<thead>
|
||||
<tr class="active">
|
||||
<th style="width: 55px; text-align: center;">序号</th>
|
||||
<th style="width: 300px;">细分规格/款式名称</th>
|
||||
<th style="width: 260px;">细分规格/款式名称</th>
|
||||
<th style="width: 220px;">特殊规格一口价(选填)</th>
|
||||
<th>规格说明或施工提示(选填)</th>
|
||||
<th style="width: 75px; text-align: center;">操作</th>
|
||||
</tr>
|
||||
@@ -235,7 +239,7 @@
|
||||
$addonPrice = (float)$tp['default_addon_price'] > 0 ? (float)$tp['default_addon_price'] : 30.00;
|
||||
$rowEnabled = ($isMainChecked || $isAddonChecked);
|
||||
?>
|
||||
<tr class="srv-matrix-row {if $rowEnabled}is-row-enabled{else/}is-row-disabled{/if}" data-id="{$tp.id}" data-code="{$code}" data-name="{$name}" data-unit="{$unit}">
|
||||
<tr class="srv-matrix-row {if $rowEnabled}is-row-enabled{else/}is-row-disabled{/if}" data-id="{$tp.id}" data-code="{$code}" data-name="{$name}" data-unit="{$unit}" data-support-fixed="{$mainSupportFixed}">
|
||||
<td>
|
||||
<div class="srv-name-box">
|
||||
<span class="srv-name-text">{$name}</span>
|
||||
@@ -249,6 +253,7 @@
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
<div class="st-active-panel" style="display: {if $isMainChecked}inline-flex{else/}none{/if}; align-items: center; gap: 10px;">
|
||||
{if $mainSupportFixed == 1}
|
||||
<div class="input-group input-group-sm st-price-wrap" style="width: 170px;">
|
||||
<span class="input-group-addon" style="background:#eff6ff;color:#1d4ed8;font-weight:700;">¥</span>
|
||||
<input type="number" step="0.01" class="form-control st-price" data-code="{$code}" value="{$mainPrice}" style="font-weight:700;color:#0f172a;">
|
||||
@@ -257,6 +262,9 @@
|
||||
<label class="srv-default-label {if $isMainDefault==1}is-def-active{/if}">
|
||||
<input type="radio" name="st_default_radio" class="st-default" data-code="{$code}" {if $isMainDefault==1}checked{/if}> 默认首选
|
||||
</label>
|
||||
{else/}
|
||||
<span class="srv-quote-badge">不支持一口价(下单时自动转师傅报价)</span>
|
||||
{/if}
|
||||
</div>
|
||||
<span class="srv-off-hint st-off-hint" style="display: {if $isMainChecked}none{else/}inline{/if};">未启用主服务</span>
|
||||
</div>
|
||||
@@ -323,18 +331,6 @@
|
||||
$row.toggleClass('is-row-enabled', on).toggleClass('is-row-disabled', !on);
|
||||
});
|
||||
|
||||
$(document).on('change', '.st-support-fixed', function () {
|
||||
var $row = $(this).closest('tr');
|
||||
var isFixed = parseInt($(this).val(), 10) === 1;
|
||||
if (isFixed) {
|
||||
$row.find('.st-price-wrap').css('display', 'inline-table');
|
||||
$row.find('.st-quote-hint').hide();
|
||||
} else {
|
||||
$row.find('.st-price-wrap').hide();
|
||||
$row.find('.st-quote-hint').css('display', 'inline-flex');
|
||||
}
|
||||
});
|
||||
|
||||
function collectServiceConfig() {
|
||||
var serviceTypes = [];
|
||||
var addons = [];
|
||||
@@ -345,15 +341,16 @@
|
||||
var code = $row.data('code');
|
||||
var name = $row.data('name');
|
||||
var unit = $row.data('unit') || '份';
|
||||
var supportFixed = parseInt($row.data('support-fixed'), 10) === 1 ? 1 : 0;
|
||||
|
||||
if ($row.find('.st-enable').is(':checked')) {
|
||||
var mainPrice = parseFloat($row.find('.st-price').val()) || 0;
|
||||
var isDef = $row.find('.st-default').is(':checked') ? 1 : 0;
|
||||
var mainPrice = supportFixed === 1 ? (parseFloat($row.find('.st-price').val()) || 0) : 0;
|
||||
var isDef = (supportFixed === 1 && $row.find('.st-default').is(':checked')) ? 1 : 0;
|
||||
serviceTypes.push({
|
||||
code: code,
|
||||
name: name,
|
||||
price: mainPrice,
|
||||
support_fixed: 1,
|
||||
support_fixed: supportFixed,
|
||||
is_default: isDef
|
||||
});
|
||||
}
|
||||
@@ -386,6 +383,7 @@
|
||||
var html = '<tr>' +
|
||||
'<td style="text-align: center; vertical-align: middle; color: #64748b; font-weight: 600;">' + seq + '</td>' +
|
||||
'<td><input type="text" name="specs[' + specIndex + '][name]" class="form-control input-sm" placeholder="如:普通坐便器 / 智能马桶"></td>' +
|
||||
'<td><div class="input-group input-group-sm"><span class="input-group-addon">¥</span><input type="number" step="0.01" name="specs[' + specIndex + '][base_price]" class="form-control input-sm" placeholder="留空则沿用商品默认价"></div></td>' +
|
||||
'<td><input type="text" name="specs[' + specIndex + '][description]" class="form-control input-sm" placeholder="选填说明"></td>' +
|
||||
'<td style="text-align:center; vertical-align: middle;"><button type="button" class="btn btn-xs btn-danger btn-del-spec"><i class="fa fa-trash-o"></i></button></td>' +
|
||||
'</tr>';
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<!-- 1. 基础服务信息 -->
|
||||
<div class="panel panel-default panel-form-section">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title"><i class="fa fa-plus-square"></i> 增项施工服务定义</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">适用类目:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_select('row[cat_id]', $catList, 0, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">增项名称:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="" placeholder="如: 水泥拆旧、修改坑距、加装喷枪">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">计费指导:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">指导价 ¥</span>
|
||||
<input id="c-default_price" data-rule="required;range(0~)" class="form-control" step="0.01" name="row[default_price]" type="number" value="30.00">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">计量单位</span>
|
||||
<input id="c-unit" data-rule="required" class="form-control" name="row[unit]" type="text" value="个" placeholder="如: 个、处、项、米、套">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 2. 排序与启用状态 -->
|
||||
<div class="panel panel-default panel-form-section">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title"><i class="fa fa-sliders"></i> 排序与启用状态</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">运营配置:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">排序权重</span>
|
||||
<input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0" placeholder="数字越大越靠前">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="radio" style="padding-top: 7px;">
|
||||
{foreach name="statusList" item="vo"}
|
||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal"}checked{/in} /> {$vo}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -1,79 +0,0 @@
|
||||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<!-- 1. 基础服务信息 -->
|
||||
<div class="panel panel-default panel-form-section">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title"><i class="fa fa-plus-square"></i> 增项施工服务定义</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">适用类目:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{:build_select('row[cat_id]', $catList, $row['cat_id'], ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">增项名称:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}" placeholder="如: 水泥拆旧、修改坑距、加装喷枪">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">计费指导:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">指导价 ¥</span>
|
||||
<input id="c-default_price" data-rule="required;range(0~)" class="form-control" step="0.01" name="row[default_price]" type="number" value="{$row.default_price|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">计量单位</span>
|
||||
<input id="c-unit" data-rule="required" class="form-control" name="row[unit]" type="text" value="{$row.unit|htmlentities}" placeholder="如: 个、处、项、米、套">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 2. 排序与启用状态 -->
|
||||
<div class="panel panel-default panel-form-section">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title"><i class="fa fa-sliders"></i> 排序与启用状态</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">运营配置:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">排序权重</span>
|
||||
<input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}" placeholder="数字越大越靠前">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="radio" style="padding-top: 7px;">
|
||||
{foreach name="statusList" item="vo"}
|
||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -1,24 +0,0 @@
|
||||
<div class="panel panel-default panel-intro">
|
||||
{:build_heading()}
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('service/addon/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('service/addon/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('service/addon/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('service/addon/edit')}"
|
||||
data-operate-del="{:$auth->check('service/addon/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -429,7 +429,7 @@
|
||||
<div class="srv-section-header">
|
||||
<div class="srv-section-title">
|
||||
<i class="fa fa-tags"></i> 商品细分型号与款式规格
|
||||
<small class="text-muted" style="font-weight:400;font-size:12px;">(用户下单选择该商品时,二级联动展示的具体款式,无单独商品价格)</small>
|
||||
<small class="text-muted" style="font-weight:400;font-size:12px;">(常规规格留空价格即可,自动沿用商品默认服务价;仅施工难度特殊的规格需填专属一口价)</small>
|
||||
</div>
|
||||
<button type="button" class="btn btn-xs btn-success" id="btn-add-spec"><i class="fa fa-plus"></i> 新增细分规格</button>
|
||||
</div>
|
||||
@@ -438,7 +438,8 @@
|
||||
<thead>
|
||||
<tr class="active">
|
||||
<th style="width: 55px; text-align: center;">序号</th>
|
||||
<th style="width: 300px;">细分规格/款式名称</th>
|
||||
<th style="width: 260px;">细分规格/款式名称</th>
|
||||
<th style="width: 220px;">特殊规格一口价(选填)</th>
|
||||
<th>规格说明或施工提示(选填)</th>
|
||||
<th style="width: 75px; text-align: center;">操作</th>
|
||||
</tr>
|
||||
@@ -451,6 +452,12 @@
|
||||
<input type="hidden" name="specs[{$idx}][id]" value="{$sp.id}">
|
||||
<input type="text" name="specs[{$idx}][name]" class="form-control input-sm" value="{$sp.name|htmlentities}" placeholder="如:普通坐便器(马桶) / 智能马桶">
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon">¥</span>
|
||||
<input type="number" step="0.01" name="specs[{$idx}][base_price]" class="form-control input-sm" value="{if $sp.base_price > 0}{$sp.base_price|htmlentities}{/if}" placeholder="留空则沿用商品默认价">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="specs[{$idx}][description]" class="form-control input-sm" value="{$sp.description|htmlentities}" placeholder="选填说明">
|
||||
</td>
|
||||
@@ -492,9 +499,9 @@
|
||||
$unit = $tp['unit'] ?: ($row['unit'] ?: '份');
|
||||
|
||||
$isMainChecked = !empty($savedMainMap) ? isset($savedMainMap[$code]) : ($tp['can_be_main'] == 1 && in_array($code, ['install','repair','remove']));
|
||||
$mainSupportFixed = isset($savedMainMap[$code]['support_fixed']) ? (int)$savedMainMap[$code]['support_fixed'] : (int)$tp['support_fixed'];
|
||||
$mainPrice = isset($savedMainMap[$code]['price']) ? (float)$savedMainMap[$code]['price'] : (float)$tp['default_price'];
|
||||
$isMainDefault = isset($savedMainMap[$code]['is_default']) ? (int)$savedMainMap[$code]['is_default'] : (int)$tp['is_default'];
|
||||
$mainSupportFixed = (int)$tp['support_fixed'];
|
||||
$mainPrice = isset($savedMainMap[$code]['price']) && (float)$savedMainMap[$code]['price'] > 0 ? (float)$savedMainMap[$code]['price'] : (float)$tp['default_price'];
|
||||
$isMainDefault = ($mainSupportFixed === 1 && isset($savedMainMap[$code]['is_default'])) ? (int)$savedMainMap[$code]['is_default'] : ($mainSupportFixed === 1 ? (int)$tp['is_default'] : 0);
|
||||
|
||||
$matchedAddon = isset($savedAddonMap[$code]) ? $savedAddonMap[$code] : (isset($savedAddonMap[$name]) ? $savedAddonMap[$name] : null);
|
||||
$isAddonChecked = !empty($savedAddonMap) ? ($matchedAddon !== null) : ($code === 'remove');
|
||||
@@ -502,7 +509,7 @@
|
||||
$addonUnit = $matchedAddon !== null && !empty($matchedAddon['unit']) ? $matchedAddon['unit'] : $unit;
|
||||
$rowEnabled = ($isMainChecked || $isAddonChecked);
|
||||
?>
|
||||
<tr class="srv-matrix-row {if $rowEnabled}is-row-enabled{else/}is-row-disabled{/if}" data-id="{$tp.id}" data-code="{$code}" data-name="{$name}" data-unit="{$addonUnit}">
|
||||
<tr class="srv-matrix-row {if $rowEnabled}is-row-enabled{else/}is-row-disabled{/if}" data-id="{$tp.id}" data-code="{$code}" data-name="{$name}" data-unit="{$addonUnit}" data-support-fixed="{$mainSupportFixed}">
|
||||
<!-- 服务名称与标识 -->
|
||||
<td>
|
||||
<div class="srv-name-box">
|
||||
@@ -520,6 +527,7 @@
|
||||
</label>
|
||||
|
||||
<div class="st-active-panel" style="display: {if $isMainChecked}inline-flex{else/}none{/if}; align-items: center; gap: 10px;">
|
||||
{if $mainSupportFixed == 1}
|
||||
<div class="input-group input-group-sm st-price-wrap" style="width: 170px;">
|
||||
<span class="input-group-addon" style="background:#eff6ff;color:#1d4ed8;font-weight:700;">¥</span>
|
||||
<input type="number" step="0.01" class="form-control st-price" data-code="{$code}" value="{$mainPrice}" style="font-weight:700;color:#0f172a;">
|
||||
@@ -529,6 +537,9 @@
|
||||
<label class="srv-default-label {if $isMainDefault==1}is-def-active{/if}">
|
||||
<input type="radio" name="st_default_radio" class="st-default" data-code="{$code}" {if $isMainDefault==1}checked{/if}> 默认首选
|
||||
</label>
|
||||
{else/}
|
||||
<span class="srv-quote-badge">不支持一口价(下单时自动转师傅报价)</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<span class="srv-off-hint st-off-hint" style="display: {if $isMainChecked}none{else/}inline{/if};">未启用主服务</span>
|
||||
@@ -617,19 +628,6 @@
|
||||
refreshRowAndCounters($row);
|
||||
});
|
||||
|
||||
// 切换一口价/仅报价模式
|
||||
$(document).on('change', '.st-support-fixed', function () {
|
||||
var $row = $(this).closest('tr');
|
||||
var isFixed = parseInt($(this).val(), 10) === 1;
|
||||
if (isFixed) {
|
||||
$row.find('.st-price-wrap').css('display', 'inline-table');
|
||||
$row.find('.st-quote-hint').hide();
|
||||
} else {
|
||||
$row.find('.st-price-wrap').hide();
|
||||
$row.find('.st-quote-hint').css('display', 'inline-flex');
|
||||
}
|
||||
});
|
||||
|
||||
// 首选单选高亮
|
||||
$(document).on('change', '.st-default', function () {
|
||||
$('.srv-default-label').removeClass('is-def-active');
|
||||
@@ -673,15 +671,16 @@
|
||||
var code = $row.data('code');
|
||||
var name = $row.data('name');
|
||||
var unit = $row.data('unit') || '份';
|
||||
var supportFixed = parseInt($row.data('support-fixed'), 10) === 1 ? 1 : 0;
|
||||
|
||||
if ($row.find('.st-enable').is(':checked')) {
|
||||
var mainPrice = parseFloat($row.find('.st-price').val()) || 0;
|
||||
var isDef = $row.find('.st-default').is(':checked') ? 1 : 0;
|
||||
var mainPrice = supportFixed === 1 ? (parseFloat($row.find('.st-price').val()) || 0) : 0;
|
||||
var isDef = (supportFixed === 1 && $row.find('.st-default').is(':checked')) ? 1 : 0;
|
||||
serviceTypes.push({
|
||||
code: code,
|
||||
name: name,
|
||||
price: mainPrice,
|
||||
support_fixed: 1,
|
||||
support_fixed: supportFixed,
|
||||
is_default: isDef
|
||||
});
|
||||
}
|
||||
@@ -714,6 +713,7 @@
|
||||
var html = '<tr>' +
|
||||
'<td style="text-align: center; vertical-align: middle; color: #64748b; font-weight: 600;">' + seq + '</td>' +
|
||||
'<td><input type="text" name="specs[' + specIndex + '][name]" class="form-control input-sm" placeholder="如:普通坐便器 / 智能马桶"></td>' +
|
||||
'<td><div class="input-group input-group-sm"><span class="input-group-addon">¥</span><input type="number" step="0.01" name="specs[' + specIndex + '][base_price]" class="form-control input-sm" placeholder="留空则沿用商品默认价"></div></td>' +
|
||||
'<td><input type="text" name="specs[' + specIndex + '][description]" class="form-control input-sm" placeholder="选填说明"></td>' +
|
||||
'<td style="text-align:center; vertical-align: middle;"><button type="button" class="btn btn-xs btn-danger btn-del-spec"><i class="fa fa-trash-o"></i></button></td>' +
|
||||
'</tr>';
|
||||
|
||||
@@ -31,20 +31,27 @@
|
||||
<label class="control-label col-xs-12 col-sm-2">可用角色:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label" style="padding-top:0; font-weight:normal;">可作为【主服务项目】:</label>
|
||||
<div class="radio">
|
||||
<label><input name="row[can_be_main]" type="radio" value="1" checked /> 是</label>
|
||||
<label><input name="row[can_be_main]" type="radio" value="0" /> 否</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label" style="padding-top:0; font-weight:normal;">可作为【增项服务】:</label>
|
||||
<div class="radio">
|
||||
<label><input name="row[can_be_addon]" type="radio" value="1" /> 是(如拆旧、切割、打孔)</label>
|
||||
<label><input name="row[can_be_addon]" type="radio" value="1" /> 是</label>
|
||||
<label><input name="row[can_be_addon]" type="radio" value="0" checked /> 否</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label" style="padding-top:0; font-weight:normal;">是否【支持一口价】:</label>
|
||||
<div class="radio">
|
||||
<label><input name="row[support_fixed]" type="radio" value="1" checked /> 支持一口价</label>
|
||||
<label><input name="row[support_fixed]" type="radio" value="0" /> 仅师傅报价</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,20 +31,27 @@
|
||||
<label class="control-label col-xs-12 col-sm-2">可用角色:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label" style="padding-top:0; font-weight:normal;">可作为【主服务项目】:</label>
|
||||
<div class="radio">
|
||||
<label><input name="row[can_be_main]" type="radio" value="1" {if $row.can_be_main==1}checked{/if} /> 是</label>
|
||||
<label><input name="row[can_be_main]" type="radio" value="0" {if $row.can_be_main==0}checked{/if} /> 否</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label" style="padding-top:0; font-weight:normal;">可作为【增项服务】:</label>
|
||||
<div class="radio">
|
||||
<label><input name="row[can_be_addon]" type="radio" value="1" {if $row.can_be_addon==1}checked{/if} /> 是(如拆旧、切割、打孔)</label>
|
||||
<label><input name="row[can_be_addon]" type="radio" value="1" {if $row.can_be_addon==1}checked{/if} /> 是</label>
|
||||
<label><input name="row[can_be_addon]" type="radio" value="0" {if $row.can_be_addon==0}checked{/if} /> 否</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label" style="padding-top:0; font-weight:normal;">是否【支持一口价】:</label>
|
||||
<div class="radio">
|
||||
<label><input name="row[support_fixed]" type="radio" value="1" {if $row.support_fixed==1}checked{/if} /> 支持一口价</label>
|
||||
<label><input name="row[support_fixed]" type="radio" value="0" {if $row.support_fixed==0}checked{/if} /> 仅师傅报价</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -415,9 +415,6 @@ class Home extends Base
|
||||
$types = $dec;
|
||||
}
|
||||
}
|
||||
if (empty($types)) {
|
||||
$types = $this->resolveServiceTypes($csRow);
|
||||
}
|
||||
foreach ($types as $st) {
|
||||
$code = isset($st['code']) ? (string)$st['code'] : '';
|
||||
if ($code === $serviceType) {
|
||||
@@ -728,9 +725,11 @@ class Home extends Base
|
||||
$allowTypes = ['fixed', 'quote', 'range', 'custom'];
|
||||
$type = in_array($priceType, $allowTypes, true) ? $priceType : ($service ? $service['price_type'] : 'fixed');
|
||||
|
||||
// 支持多商品组合与增项计算
|
||||
// 支持多商品组合与增项计算(后端结合 fa_service 与 fa_service_spec 权威核验单价)
|
||||
$base = 0;
|
||||
if (!empty($goodsList) && is_array($goodsList)) {
|
||||
$serviceCache = [];
|
||||
$specCache = [];
|
||||
foreach ($goodsList as $g) {
|
||||
if (is_string($g)) {
|
||||
$rawG = htmlspecialchars_decode($g);
|
||||
@@ -742,16 +741,88 @@ class Home extends Base
|
||||
if (!is_array($g)) {
|
||||
continue;
|
||||
}
|
||||
$itemPrice = isset($g['base_price']) ? (float)$g['base_price'] : 0;
|
||||
if ($itemPrice <= 0 && !empty($g['service_id'])) {
|
||||
$itemPrice = (float)Db::name('service')->where('id', (int)$g['service_id'])->value('base_price');
|
||||
$sid = isset($g['service_id']) ? (int)$g['service_id'] : 0;
|
||||
$specId = isset($g['spec_id']) ? (int)$g['spec_id'] : 0;
|
||||
$reqServiceType = isset($g['service_type']) ? trim((string)$g['service_type']) : '';
|
||||
$isCustom = !empty($g['is_custom']) || (isset($g['cat_id']) && (int)$g['cat_id'] === 15);
|
||||
|
||||
$dbSvc = null;
|
||||
if ($sid > 0 && !$isCustom) {
|
||||
if (!array_key_exists($sid, $serviceCache)) {
|
||||
$serviceCache[$sid] = Db::name('service')->where('id', $sid)->find() ?: null;
|
||||
}
|
||||
$dbSvc = $serviceCache[$sid];
|
||||
}
|
||||
|
||||
$specPrice = 0.0;
|
||||
if ($specId > 0 && !$isCustom) {
|
||||
if (!array_key_exists($specId, $specCache)) {
|
||||
$spQuery = Db::name('service_spec')->where('id', $specId);
|
||||
if ($sid > 0) {
|
||||
$spQuery->where('service_id', $sid);
|
||||
}
|
||||
$specCache[$specId] = $spQuery->find() ?: null;
|
||||
}
|
||||
if (!empty($specCache[$specId])) {
|
||||
$specPrice = (float)$specCache[$specId]['base_price'];
|
||||
}
|
||||
}
|
||||
|
||||
$itemPrice = isset($g['base_price']) ? max(0, (float)$g['base_price']) : 0.0;
|
||||
$dbAddonsMap = [];
|
||||
|
||||
if ($dbSvc) {
|
||||
$svcTypes = !empty($dbSvc['service_types']) ? (json_decode((string)$dbSvc['service_types'], true) ?: []) : [];
|
||||
$defaultCode = 'install';
|
||||
$matchedTypePrice = 0.0;
|
||||
foreach ($svcTypes as $st) {
|
||||
if (!empty($st['is_default']) && !empty($st['code'])) {
|
||||
$defaultCode = (string)$st['code'];
|
||||
}
|
||||
if ($reqServiceType !== '' && isset($st['code']) && (string)$st['code'] === $reqServiceType) {
|
||||
$matchedTypePrice = isset($st['price']) ? (float)$st['price'] : 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
// 方案2计价优先级:若规格设置了专属一口价(>0)且当前为默认主服务,则优先采用规格专属价;否则采用所选主服务定价或商品默认价
|
||||
$isDefaultService = ($reqServiceType === '' || $reqServiceType === $defaultCode || $reqServiceType === 'install');
|
||||
if ($specPrice > 0 && $isDefaultService) {
|
||||
$itemPrice = $specPrice;
|
||||
} elseif ($matchedTypePrice > 0) {
|
||||
$itemPrice = $matchedTypePrice;
|
||||
} elseif ($specPrice > 0) {
|
||||
$itemPrice = $specPrice;
|
||||
} elseif ((float)$dbSvc['base_price'] > 0) {
|
||||
$itemPrice = (float)$dbSvc['base_price'];
|
||||
}
|
||||
|
||||
$svcAddons = !empty($dbSvc['addons']) ? (json_decode((string)$dbSvc['addons'], true) ?: []) : [];
|
||||
foreach ($svcAddons as $ad) {
|
||||
if (!empty($ad['name']) && isset($ad['price']) && (float)$ad['price'] > 0) {
|
||||
$dbAddonsMap[(string)$ad['name']] = (float)$ad['price'];
|
||||
}
|
||||
if (!empty($ad['code']) && isset($ad['price']) && (float)$ad['price'] > 0) {
|
||||
$dbAddonsMap[(string)$ad['code']] = (float)$ad['price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$itemNum = isset($g['num']) ? max(1, (int)$g['num']) : 1;
|
||||
$base += $itemPrice * $itemNum;
|
||||
if (!empty($g['extras']) && is_array($g['extras'])) {
|
||||
foreach ($g['extras'] as $ex) {
|
||||
$exPrice = isset($ex['price']) ? (float)$ex['price'] : 0;
|
||||
$exNum = isset($ex['num']) ? max(0, (int)$ex['num']) : 0;
|
||||
if ($exNum <= 0) {
|
||||
continue;
|
||||
}
|
||||
$exPrice = isset($ex['price']) ? max(0, (float)$ex['price']) : 0.0;
|
||||
$exName = isset($ex['name']) ? (string)$ex['name'] : '';
|
||||
$exCode = isset($ex['code']) ? (string)$ex['code'] : '';
|
||||
if ($exName !== '' && isset($dbAddonsMap[$exName])) {
|
||||
$exPrice = $dbAddonsMap[$exName];
|
||||
} elseif ($exCode !== '' && isset($dbAddonsMap[$exCode])) {
|
||||
$exPrice = $dbAddonsMap[$exCode];
|
||||
}
|
||||
$base += $exPrice * $exNum;
|
||||
}
|
||||
}
|
||||
@@ -842,9 +913,6 @@ class Home extends Base
|
||||
foreach ($rows as $r) {
|
||||
$theme = isset($themeText[$r['theme']]) ? $r['theme'] : 'promo';
|
||||
$stats = $this->parseBannerStats(isset($r['stats']) ? $r['stats'] : '');
|
||||
if ($theme === 'brand' && empty($stats)) {
|
||||
$stats = $this->defaultBrandStats();
|
||||
}
|
||||
$actionText = trim((string)$r['action_text']);
|
||||
if ($actionText === '' && $theme !== 'brand') {
|
||||
$actionText = '立即查看';
|
||||
@@ -892,47 +960,6 @@ class Home extends Base
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台实力默认指标
|
||||
*/
|
||||
protected function defaultBrandStats()
|
||||
{
|
||||
return [
|
||||
['value' => '460万+', 'label' => '专业师傅'],
|
||||
['value' => '99.9%', 'label' => '区域覆盖到村镇'],
|
||||
['value' => '1762万', 'label' => '成功订单'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 无后台数据时的兜底轮播
|
||||
*/
|
||||
protected function defaultBanners()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'id' => 0, 'badge' => '家装季', 'title' => '双11 狂欢大促',
|
||||
'subtitle' => '下单立减 · 满额再返券', 'date_text' => '10.23 - 11.15',
|
||||
'theme' => 'promo', 'theme_text' => '活动促销', 'action_text' => '立即抢购',
|
||||
'stats' => [], 'image' => '',
|
||||
'link' => '/pages/service/list?cat_id=1&cat_name=%E5%AE%B6%E5%85%B7',
|
||||
],
|
||||
[
|
||||
'id' => -1, 'badge' => '平台实力', 'title' => '平台实力',
|
||||
'subtitle' => '已有 176276994 个订单找到师傅', 'date_text' => '下单越多 · 越优惠',
|
||||
'theme' => 'brand', 'theme_text' => '平台实力', 'action_text' => '',
|
||||
'stats' => $this->defaultBrandStats(), 'image' => '', 'link' => '',
|
||||
],
|
||||
[
|
||||
'id' => -2, 'badge' => '服务主题', 'title' => '家电清洗季',
|
||||
'subtitle' => '空调 / 洗衣机 / 油烟机深度清洗', 'date_text' => '9.9 折起',
|
||||
'theme' => 'service', 'theme_text' => '服务主题', 'action_text' => '立即预约',
|
||||
'stats' => [], 'image' => '',
|
||||
'link' => '/pages/service/list?cat_id=10&cat_name=%E5%AE%B6%E7%94%B5',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取 fa_config 中的逗号分隔列表
|
||||
*/
|
||||
@@ -1054,44 +1081,42 @@ class Home extends Base
|
||||
|
||||
$serviceTypes = [];
|
||||
if (!empty($row['service_types'])) {
|
||||
$serviceTypes = is_array($row['service_types']) ? $row['service_types'] : json_decode($row['service_types'], true);
|
||||
$serviceTypes = is_array($row['service_types']) ? $row['service_types'] : (json_decode($row['service_types'], true) ?: []);
|
||||
}
|
||||
if (empty($serviceTypes)) {
|
||||
$serviceTypes = $this->resolveServiceTypes($row);
|
||||
}
|
||||
$FixedCodes = ['install', 'repair', 'remove'];
|
||||
$isOtherCat = ((int)$row['cat_id'] === 15);
|
||||
if (!empty($activeTypeCodes)) {
|
||||
$filteredTypes = [];
|
||||
foreach ($serviceTypes as $st) {
|
||||
$c = isset($st['code']) ? $st['code'] : '';
|
||||
if ($c !== '' && isset($activeTypeCodes[$c])) {
|
||||
if (!isset($st['support_fixed'])) {
|
||||
$st['support_fixed'] = in_array($c, $FixedCodes, true) ? 1 : 0;
|
||||
$dictSupport = isset($activeTypeCodes[$c]['support_fixed']) ? (int)$activeTypeCodes[$c]['support_fixed'] : 1;
|
||||
$stPrice = isset($st['price']) ? (float)$st['price'] : 0.0;
|
||||
if ($isOtherCat || $dictSupport === 0) {
|
||||
$st['support_fixed'] = 0;
|
||||
$st['price'] = 0;
|
||||
} else {
|
||||
$st['support_fixed'] = $stPrice > 0 ? 1 : 0;
|
||||
}
|
||||
$filteredTypes[] = $st;
|
||||
}
|
||||
}
|
||||
if (!empty($filteredTypes)) {
|
||||
$serviceTypes = $filteredTypes;
|
||||
}
|
||||
$serviceTypes = $filteredTypes;
|
||||
} else {
|
||||
foreach ($serviceTypes as &$stItem) {
|
||||
$c = isset($stItem['code']) ? $stItem['code'] : '';
|
||||
$stPrice = isset($stItem['price']) ? (float)$stItem['price'] : 0.0;
|
||||
if (!isset($stItem['support_fixed'])) {
|
||||
$stItem['support_fixed'] = in_array($c, $FixedCodes, true) ? 1 : 0;
|
||||
$stItem['support_fixed'] = (!$isOtherCat && $stPrice > 0) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
unset($stItem);
|
||||
}
|
||||
|
||||
// 解析增项服务(优先读取商品绑定的 addons JSON,并与统一服务表 fa_service_type 联动过滤)
|
||||
// 解析增项服务(读取商品绑定的 addons JSON,并与统一服务表 fa_service_type 联动过滤)
|
||||
$addons = [];
|
||||
if (!empty($row['addons'])) {
|
||||
$addons = is_array($row['addons']) ? $row['addons'] : json_decode($row['addons'], true);
|
||||
$addons = is_array($row['addons']) ? $row['addons'] : (json_decode($row['addons'], true) ?: []);
|
||||
}
|
||||
if (empty($addons)) {
|
||||
$addons = $this->resolveServiceAddons($row);
|
||||
} elseif (!empty($activeTypeCodes)) {
|
||||
if (!empty($addons) && !empty($activeTypeCodes)) {
|
||||
$addons = array_values(array_filter($addons, function ($ad) use ($activeTypeCodes, $activeTypeNames) {
|
||||
$code = isset($ad['code']) ? $ad['code'] : '';
|
||||
$name = isset($ad['name']) ? $ad['name'] : '';
|
||||
@@ -1126,450 +1151,6 @@ class Home extends Base
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据具体商品名称与所属类目返回精准匹配的服务项目列表(1:1 对标奇兵到家图2 & 图3)
|
||||
*/
|
||||
protected function resolveServiceTypes($row)
|
||||
{
|
||||
$catId = (int)$row['cat_id'];
|
||||
$name = (string)$row['name'];
|
||||
$bp = max(30, (float)$row['base_price']);
|
||||
|
||||
$make = function ($items) use ($bp) {
|
||||
$res = [];
|
||||
$fixedCodes = ['install', 'repair', 'remove'];
|
||||
foreach ($items as $idx => $it) {
|
||||
$ratio = isset($it[2]) ? (float)$it[2] : 1.0;
|
||||
$fixed = isset($it[3]) && $it[3] !== null ? (float)$it[3] : round($bp * $ratio, 2);
|
||||
$supportFixed = isset($it[4]) ? (int)$it[4] : (in_array($it[0], $fixedCodes, true) ? 1 : 0);
|
||||
$res[] = [
|
||||
'code' => $it[0],
|
||||
'name' => $it[1],
|
||||
'price' => $fixed,
|
||||
'is_default' => $idx === 0 ? 1 : 0,
|
||||
'support_fixed' => $supportFixed,
|
||||
];
|
||||
}
|
||||
return $res;
|
||||
};
|
||||
|
||||
// 类目 15:其它(1:1 复刻图3)
|
||||
if ($catId === 15) {
|
||||
return $make([
|
||||
['install', '安装', 1.0, null, 0],
|
||||
['repair', '维修', 0.8, null, 0],
|
||||
['grout', '美缝', 1.0, null, 0],
|
||||
['glue', '打胶', 0.6, null, 0],
|
||||
['remove', '拆旧', 0.5, null, 0],
|
||||
['deliver', '送货到家', 0.7, 50, 0],
|
||||
['deliver_install', '送货到家并安装', 1.3, null, 0],
|
||||
['deliver_downstairs', '送货到楼下(不含上楼)', 0.5, 35, 0],
|
||||
['clean', '保洁', 1.0, null, 0],
|
||||
['drill', '打孔', 0.5, 30, 0],
|
||||
['film', '贴膜', 0.8, null, 0],
|
||||
['move', '移机', 1.1, null, 0],
|
||||
['other', '其他', 1.0, null, 0],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 6:墙纸/壁画(1:1 复刻图2)
|
||||
if ($catId === 6) {
|
||||
if (strpos($name, '画') !== false && strpos($name, '壁画') === false) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 1.15],
|
||||
['remove', '拆旧', 0.5, 30],
|
||||
['drill', '打孔', 0.6, 30, 0],
|
||||
['deliver_install', '送货到家并安装', 1.3, null, 0],
|
||||
]);
|
||||
}
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 1.15],
|
||||
['deliver', '送货到家', 0.7, 50, 0],
|
||||
['deliver_install', '送货到家并安装', 1.3, null, 0],
|
||||
['deliver_downstairs', '送货到楼下(不含上楼)', 0.5, 35, 0],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 1:家具(1:1 复刻视频 00:02 的 11 项服务项目,且安装/维修/拆旧支持一口价,其余自动转报价)
|
||||
if ($catId === 1) {
|
||||
$repairPrice = round($bp + 10, 2);
|
||||
return $make([
|
||||
['install', '安装', 1.0, $bp, 1],
|
||||
['repair', '维修', 1.18, $repairPrice, 1],
|
||||
['remove', '拆旧', 0.9, 50, 1],
|
||||
['paint_repair', '补漆修复', 1.0, 80, 0],
|
||||
['measure', '测量', 0.8, 50, 0],
|
||||
['deliver', '送货到家', 0.7, 60, 0],
|
||||
['deliver_install', '送货到家并安装', 1.35, round($bp * 1.35, 2), 0],
|
||||
['deliver_downstairs', '送货到楼下(不含上楼)', 0.5, 40, 0],
|
||||
['return_goods', '返货', 0.8, 50, 0],
|
||||
['maintain', '保养', 0.8, 60, 0],
|
||||
['open_hole', '开孔', 0.5, 30, 0],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 2:卫浴(区分马桶、花洒龙头、浴室柜/浴缸、浴霸)
|
||||
if ($catId === 2) {
|
||||
if (preg_match('/(马桶|便器)/u', $name)) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.5],
|
||||
['glue', '打胶', 0.4, 30],
|
||||
['grout', '美缝', 0.6, 50],
|
||||
['deliver_install', '送货到家并安装', 1.3],
|
||||
]);
|
||||
}
|
||||
if (preg_match('/(花洒|龙头|扶手|镜)/u', $name)) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.4],
|
||||
['drill', '打孔', 0.4, 25],
|
||||
]);
|
||||
}
|
||||
if (preg_match('/(浴霸|水泵)/u', $name)) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.75],
|
||||
['remove', '拆旧', 0.45],
|
||||
['deliver_install', '送货到家并安装', 1.25],
|
||||
]);
|
||||
}
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.5],
|
||||
['glue', '打胶', 0.4, 30],
|
||||
['deliver', '送货到家', 0.6, 50],
|
||||
['deliver_install', '送货到家并安装', 1.3],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 3:灯具
|
||||
if ($catId === 3) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.4],
|
||||
['deliver_install', '送货到家并安装', 1.25],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 4:锁具
|
||||
if ($catId === 4) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.4],
|
||||
['drill', '打孔', 0.5, 40],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 5:窗帘
|
||||
if ($catId === 5) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['measure', '测量', 0.5, 40],
|
||||
['remove', '拆旧', 0.4],
|
||||
['deliver_install', '送货到家并安装', 1.25],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 7:净水器
|
||||
if ($catId === 7) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['filter', '换滤芯', 0.5, 40],
|
||||
['remove', '拆旧', 0.4],
|
||||
['move', '移机', 1.1],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 8:晾衣架(区分电动、手摇、户外推拉/落地)
|
||||
if ($catId === 8) {
|
||||
if (strpos($name, '电动') !== false) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.4],
|
||||
['deliver', '送货到家', 0.6, 45],
|
||||
['deliver_install', '送货到家并安装', 1.25],
|
||||
['move', '移机', 1.1],
|
||||
]);
|
||||
}
|
||||
if (strpos($name, '户外') !== false || strpos($name, '推拉') !== false) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.4],
|
||||
['drill', '打孔', 0.5, 30],
|
||||
]);
|
||||
}
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.4],
|
||||
['deliver', '送货到家', 0.6, 45],
|
||||
['deliver_install', '送货到家并安装', 1.25],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 9:门窗
|
||||
if ($catId === 9) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['measure', '测量', 0.4, 50],
|
||||
['remove', '拆旧', 0.5],
|
||||
['glue', '打胶', 0.4, 40],
|
||||
['deliver_install', '送货到家并安装', 1.3],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 10:家电(区分空调、厨电、洗衣机冰箱)
|
||||
if ($catId === 10) {
|
||||
if (strpos($name, '空调') !== false) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['move', '移机', 1.2],
|
||||
['remove', '拆旧', 0.5],
|
||||
['clean', '保洁清洗', 0.6, 80],
|
||||
['deliver_install', '送货到家并安装', 1.3],
|
||||
]);
|
||||
}
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.45],
|
||||
['clean', '保洁清洗', 0.6, 70],
|
||||
['drill', '打孔', 0.4, 40],
|
||||
['deliver_install', '送货到家并安装', 1.25],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 11:电视/投影
|
||||
if ($catId === 11) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['move', '移机', 1.0],
|
||||
['remove', '拆旧', 0.4],
|
||||
['deliver_install', '送货到家并安装', 1.25],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 12:淋浴房
|
||||
if ($catId === 12) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['measure', '测量', 0.3, 50],
|
||||
['remove', '拆旧', 0.45],
|
||||
['glue', '打胶', 0.3, 40],
|
||||
['film', '贴膜', 0.4, 80],
|
||||
['deliver_install', '送货到家并安装', 1.3],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 13:商用厨电
|
||||
if ($catId === 13) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['clean', '保洁', 0.8],
|
||||
['remove', '拆旧', 0.5],
|
||||
['deliver_install', '送货到家并安装', 1.25],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 14:健身器材
|
||||
if ($catId === 14) {
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['move', '移机', 1.1],
|
||||
['remove', '拆旧', 0.5],
|
||||
['deliver', '送货到家', 0.6, 60],
|
||||
['deliver_install', '送货到家并安装', 1.3],
|
||||
]);
|
||||
}
|
||||
|
||||
return $make([
|
||||
['install', '安装', 1.0],
|
||||
['repair', '维修', 0.7],
|
||||
['remove', '拆旧', 0.5],
|
||||
['deliver', '送货到家', 0.6, 50],
|
||||
['deliver_install', '送货到家并安装', 1.3],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据具体商品名称与所属类目返回极简增值服务(增项)列表(1:1 对标奇兵到家:仅保留“拆旧”、“切割”等 1~2 项极简短词)
|
||||
*/
|
||||
protected function resolveServiceAddons($row)
|
||||
{
|
||||
$catId = (int)$row['cat_id'];
|
||||
$name = (string)$row['name'];
|
||||
|
||||
$codeMap = [
|
||||
'拆旧' => 'remove',
|
||||
'切割' => 'cut',
|
||||
'打孔' => 'drill',
|
||||
'开孔' => 'open_hole',
|
||||
];
|
||||
$build = function ($items) use ($codeMap) {
|
||||
$res = [];
|
||||
foreach ($items as $idx => $it) {
|
||||
$res[] = [
|
||||
'id' => $idx + 1,
|
||||
'code' => isset($codeMap[$it[0]]) ? $codeMap[$it[0]] : ('addon_' . ($idx + 1)),
|
||||
'name' => $it[0],
|
||||
'unit' => $it[1],
|
||||
'price' => (float)$it[2],
|
||||
];
|
||||
}
|
||||
return $res;
|
||||
};
|
||||
|
||||
// 类目 1:家具(对标视频 00:06 / 00:17:电脑桌仅“拆旧 50元/份”,柜类多一项“切割 20元/份”)
|
||||
if ($catId === 1) {
|
||||
if (preg_match('/(柜)/u', $name)) {
|
||||
return $build([
|
||||
['拆旧', '份', 50],
|
||||
['切割', '份', 20],
|
||||
]);
|
||||
}
|
||||
return $build([
|
||||
['拆旧', '份', 50],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 2:卫浴(对标奇兵到家截图 frame_010:洗衣柜/浴室柜为“拆旧 50元/份”、“切割 20元/份”,马桶/花洒为“拆旧”)
|
||||
if ($catId === 2) {
|
||||
if (preg_match('/(浴室柜|洗衣柜|面盆|洗面盆|水槽|拖把池)/u', $name)) {
|
||||
return $build([
|
||||
['拆旧', '份', 50],
|
||||
['切割', '份', 20],
|
||||
]);
|
||||
}
|
||||
if (preg_match('/(马桶|便器)/u', $name)) {
|
||||
return $build([
|
||||
['拆旧', '份', 50],
|
||||
]);
|
||||
}
|
||||
if (preg_match('/(浴缸)/u', $name)) {
|
||||
return $build([
|
||||
['拆旧', '份', 80],
|
||||
]);
|
||||
}
|
||||
return $build([
|
||||
['拆旧', '份', 30],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 3:灯具
|
||||
if ($catId === 3) {
|
||||
return $build([
|
||||
['拆旧', '份', 20],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 4:锁具
|
||||
if ($catId === 4) {
|
||||
return $build([
|
||||
['拆旧', '份', 30],
|
||||
['开孔', '份', 30],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 5:窗帘
|
||||
if ($catId === 5) {
|
||||
return $build([
|
||||
['拆旧', '份', 30],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 6:墙纸/壁画
|
||||
if ($catId === 6) {
|
||||
return $build([
|
||||
['拆旧', '份', 30],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 7:净水器
|
||||
if ($catId === 7) {
|
||||
return $build([
|
||||
['拆旧', '份', 30],
|
||||
['打孔', '份', 30],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 8:晾衣架
|
||||
if ($catId === 8) {
|
||||
return $build([
|
||||
['拆旧', '份', 30],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 9:门窗
|
||||
if ($catId === 9) {
|
||||
return $build([
|
||||
['拆旧', '份', 50],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 10:家电
|
||||
if ($catId === 10) {
|
||||
if (strpos($name, '空调') !== false) {
|
||||
return $build([
|
||||
['拆旧', '份', 80],
|
||||
['打孔', '份', 50],
|
||||
]);
|
||||
}
|
||||
return $build([
|
||||
['拆旧', '份', 40],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 11:电视/投影
|
||||
if ($catId === 11) {
|
||||
return $build([
|
||||
['拆旧', '份', 30],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 12:淋浴房
|
||||
if ($catId === 12) {
|
||||
return $build([
|
||||
['拆旧', '份', 80],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 13:商用厨电
|
||||
if ($catId === 13) {
|
||||
return $build([
|
||||
['拆旧', '份', 80],
|
||||
]);
|
||||
}
|
||||
|
||||
// 类目 14:健身器材
|
||||
if ($catId === 14) {
|
||||
return $build([
|
||||
['拆旧', '份', 60],
|
||||
]);
|
||||
}
|
||||
|
||||
return $build([
|
||||
['拆旧', '份', 30],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 相对时间计算(更具真实动态感)
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@ return array (
|
||||
'name' => '优匠优服',
|
||||
'beian' => '',
|
||||
'cdnurl' => '',
|
||||
'version' => '1.0.43',
|
||||
'version' => '1.0.44',
|
||||
'timezone' => 'Asia/Shanghai',
|
||||
'forbiddenip' => '',
|
||||
'languages' =>
|
||||
|
||||
在新工单中引用
屏蔽一个用户