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>
|
||||
|
||||
在新工单中引用
屏蔽一个用户