feat: 新增师傅端功能及服务增项管理模块

- 新增师傅端路由和页面配置,切换登录后默认跳转到师傅大厅
- 新增服务分类图标上传功能和增项服务管理模块
- 新增订单、申诉、结算等模型关联关系及后台控制器
- 新增师傅端TabBar组件和消息页面跳转逻辑
- 新增文件上传接口和服务计算逻辑
- 新增各类SVG图标和空状态提示
这个提交包含在:
YuanWen
2026-11-03 15:45:21 +08:00
父节点 c01e8fc7d9
当前提交 361dffc7d8
共有 82 个文件被更改,包括 4787 次插入 和 531 次删除

查看文件

@@ -35,4 +35,25 @@ class Appeal extends Backend
*/
protected $relationSearch = true;
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(['order', 'master'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

查看文件

@@ -35,4 +35,25 @@ class Invoice extends Backend
*/
protected $relationSearch = true;
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(['user', 'merchant'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

查看文件

@@ -35,4 +35,25 @@ class Master extends Backend
*/
protected $relationSearch = true;
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(['user'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

查看文件

@@ -35,4 +35,25 @@ class Merchant extends Backend
*/
protected $relationSearch = true;
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(['user'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

查看文件

@@ -40,4 +40,25 @@ class Order extends Backend
*/
protected $relationSearch = true;
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(['user', 'master'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

查看文件

@@ -34,4 +34,25 @@ class Review extends Backend
*/
protected $relationSearch = true;
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(['user', 'master', 'order'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

查看文件

@@ -3,20 +3,24 @@
namespace app\admin\controller;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
use Exception;
/**
* 服务项目
* 服务项目与商品管理
*
* @icon fa fa-circle-o
*/
class Service extends Backend
{
/**
* Service模型对象
* @var \app\admin\model\Service
*/
protected $model = null;
protected $relationSearch = true;
public function _initialize()
{
@@ -24,15 +28,205 @@ class Service extends Backend
$this->model = new \app\admin\model\Service;
$this->view->assign("priceTypeList", $this->model->getPriceTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
// 获取全部可用的公共增项服务列表
$addonsPool = Db::name('service_addon')
->where('status', 'normal')
->order('weigh desc, id asc')
->select();
$this->view->assign("addonsPool", $addonsPool);
}
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);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
* 添加服务商品
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
// 处理工项类型与增项配置
$params = $this->formatServiceConfig($params);
$result = false;
Db::startTrans();
try {
$result = $this->model->allowField(true)->save($params);
$serviceId = $this->model->id;
// 处理规格列表
$this->syncSpecs($serviceId, $this->request->post('specs/a', []));
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑服务商品(工项价格、规格价格、增项服务绑定)
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
// 处理工项类型与增项配置
$params = $this->formatServiceConfig($params);
$result = false;
Db::startTrans();
try {
$result = $row->allowField(true)->save($params);
// 同步处理规格列表
$this->syncSpecs($row->id, $this->request->post('specs/a', []));
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
// 解析工项与增项配置以供视图回显
$serviceTypes = [];
if (!empty($row->service_types)) {
$serviceTypes = is_array($row->service_types) ? $row->service_types : json_decode($row->service_types, true);
}
$addons = [];
if (!empty($row->addons)) {
$addons = is_array($row->addons) ? $row->addons : json_decode($row->addons, true);
}
// 获取已有规格
$specs = Db::name('service_spec')
->where('service_id', $row->id)
->where('status', 'normal')
->order('weigh desc, id asc')
->select();
$this->view->assign("row", $row);
$this->view->assign("serviceTypes", $serviceTypes ?: []);
$this->view->assign("assignedAddons", $addons ?: []);
$this->view->assign("specs", $specs ?: []);
return $this->view->fetch();
}
/**
* 格式化工项与增项输入数据
*/
protected function formatServiceConfig($params)
{
// 工项类型 JSON
if (isset($params['service_types_raw'])) {
$params['service_types'] = is_string($params['service_types_raw']) ? $params['service_types_raw'] : json_encode($params['service_types_raw'], JSON_UNESCAPED_UNICODE);
unset($params['service_types_raw']);
}
// 增项服务 JSON
if (isset($params['addons_raw'])) {
$params['addons'] = is_string($params['addons_raw']) ? $params['addons_raw'] : json_encode($params['addons_raw'], JSON_UNESCAPED_UNICODE);
unset($params['addons_raw']);
}
return $params;
}
/**
* 同步商品规格表
*/
protected function syncSpecs($serviceId, $specsInput)
{
if (empty($serviceId)) return;
$now = time();
$keepIds = [];
if (!empty($specsInput) && is_array($specsInput)) {
foreach ($specsInput as $item) {
$name = trim(isset($item['name']) ? $item['name'] : '');
if ($name === '') continue;
$specPrice = isset($item['base_price']) ? (float)$item['base_price'] : 0.00;
$specDesc = isset($item['description']) ? trim($item['description']) : '';
$specId = isset($item['id']) ? (int)$item['id'] : 0;
if ($specId > 0) {
Db::name('service_spec')->where('id', $specId)->where('service_id', $serviceId)->update([
'name' => $name,
'base_price' => $specPrice,
'description' => $specDesc,
'updatetime' => $now,
]);
$keepIds[] = $specId;
} else {
$newId = Db::name('service_spec')->insertGetId([
'service_id' => $serviceId,
'name' => $name,
'base_price' => $specPrice,
'description' => $specDesc,
'weigh' => 0,
'status' => 'normal',
'createtime' => $now,
'updatetime' => $now,
]);
$keepIds[] = $newId;
}
}
}
// 将未在列表中的历史规格软下架或删除
$delQuery = Db::name('service_spec')->where('service_id', $serviceId);
if (!empty($keepIds)) {
$delQuery->whereNotIn('id', $keepIds);
}
$delQuery->delete();
}
}

查看文件

@@ -34,4 +34,25 @@ class Settle extends Backend
*/
protected $relationSearch = true;
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(['order', 'master'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

查看文件

@@ -35,4 +35,25 @@ class Withdraw extends Backend
*/
protected $relationSearch = true;
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(['master'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

查看文件

@@ -0,0 +1,51 @@
<?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);
}
}

查看文件

@@ -60,4 +60,14 @@ class Appeal extends Model
public function order()
{
return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function master()
{
return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

查看文件

@@ -60,4 +60,14 @@ class Invoice extends Model
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);
}
}

查看文件

@@ -60,4 +60,9 @@ class Master extends Model
public function user()
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

查看文件

@@ -60,4 +60,9 @@ class Merchant extends Model
public function user()
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

查看文件

@@ -223,4 +223,14 @@ class Order extends Model
}
public function user()
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function master()
{
return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

查看文件

@@ -46,4 +46,19 @@ class Review extends Model
public function user()
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function master()
{
return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function order()
{
return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

查看文件

@@ -70,4 +70,9 @@ class Service extends Model
public function cat()
{
return $this->belongsTo('app\\admin\\model\\service\\Cat', 'cat_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

查看文件

@@ -57,4 +57,14 @@ class Settle extends Model
}
public function order()
{
return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function master()
{
return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

查看文件

@@ -60,4 +60,9 @@ class Withdraw extends Model
public function master()
{
return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

查看文件

@@ -0,0 +1,41 @@
<?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);
}
}

查看文件

@@ -0,0 +1,36 @@
<?php
namespace app\admin\model\service;
use think\Model;
class Cat extends Model
{
// 表名
protected $name = 'service_cat';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
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 ?: ($data['status'] ?? '');
$list = $this->getStatusList();
return $list[$value] ?? '';
}
}

查看文件

@@ -1 +1 @@
<script src="__CDN__/assets/js/require.min.js" data-main="__CDN__/assets/js/require-backend{$Think.config.app_debug?'':'.min'}.js?v={$site.version|htmlentities}"></script>
<script src="__CDN__/assets/js/require.min.js" data-main="__CDN__/assets/js/require-backend.js?v={$site.version|htmlentities}"></script>

查看文件

@@ -0,0 +1,49 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<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">
<input id="c-unit" data-rule="required" class="form-control" name="row[unit]" 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">
<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="form-group">
<label class="control-label col-xs-12 col-sm-2">排序权重:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
</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="radio">
{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 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>
</div>
</div>
</form>

查看文件

@@ -0,0 +1,49 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<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}">
</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-unit" data-rule="required" class="form-control" name="row[unit]" type="text" value="{$row.unit|htmlentities}">
</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-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="form-group">
<label class="control-label col-xs-12 col-sm-2">排序权重:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</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="radio">
{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 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>
</div>
</div>
</form>

查看文件

@@ -0,0 +1,24 @@
<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>

查看文件

@@ -13,9 +13,17 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Icon')}:</label>
<label class="control-label col-xs-12 col-sm-2">类目图标:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-icon" data-rule="required" class="form-control" name="row[icon]" type="text" value="">
<div class="input-group">
<input id="c-icon" class="form-control" size="50" name="row[icon]" type="text" value="" placeholder="请上传真实图标图片或输入标识">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-icon" class="btn btn-danger plupload" data-input-id="c-icon" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp,image/svg+xml" data-multiple="false" data-preview-id="p-icon"><i class="fa fa-upload"></i> 上传</button></span>
<span><button type="button" id="fachoose-icon" class="btn btn-primary fachoose" data-input-id="c-icon" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> 选择</button></span>
</div>
<span class="msg-box n-right" for="c-icon"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-icon"></ul>
</div>
</div>
<div class="form-group">
@@ -27,13 +35,11 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{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 class="form-group layer-footer">

查看文件

@@ -13,9 +13,17 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Icon')}:</label>
<label class="control-label col-xs-12 col-sm-2">类目图标:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-icon" data-rule="required" class="form-control" name="row[icon]" type="text" value="{$row.icon|htmlentities}">
<div class="input-group">
<input id="c-icon" class="form-control" size="50" name="row[icon]" type="text" value="{$row.icon|htmlentities}" placeholder="请上传真实图标图片或输入标识">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-icon" class="btn btn-danger plupload" data-input-id="c-icon" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp,image/svg+xml" data-multiple="false" data-preview-id="p-icon"><i class="fa fa-upload"></i> 上传</button></span>
<span><button type="button" id="fachoose-icon" class="btn btn-primary fachoose" data-input-id="c-icon" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> 选择</button></span>
</div>
<span class="msg-box n-right" for="c-icon"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-icon"></ul>
</div>
</div>
<div class="form-group">
@@ -27,13 +35,11 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{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 class="form-group layer-footer">

查看文件

@@ -17,12 +17,12 @@
<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.cat/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.cat/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.cat/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('service/cat/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/cat/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/cat/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('service.cat/multi')?'':'hide'}">
<div class="dropdown btn-group {:$auth->check('service/cat/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
{foreach name="statusList" item="vo"}
@@ -34,8 +34,8 @@
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('service.cat/edit')}"
data-operate-del="{:$auth->check('service.cat/del')}"
data-operate-edit="{:$auth->check('service/cat/edit')}"
data-operate-del="{:$auth->check('service/cat/del')}"
width="100%">
</table>
</div>

查看文件

@@ -1,113 +1,335 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Cat_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-cat_id" data-rule="required" min="0" data-source="cat/index" class="form-control selectpage" name="row[cat_id]" type="text" value="{$row.cat_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</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}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<div class="nav-tabs-custom" style="box-shadow: none;">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-basic" data-toggle="tab"><i class="fa fa-info-circle text-primary"></i> 基础信息</a></li>
<li><a href="#tab-service-types" data-toggle="tab"><i class="fa fa-wrench text-warning"></i> 工项服务定价</a></li>
<li><a href="#tab-specs" data-toggle="tab"><i class="fa fa-cubes text-success"></i> 规格独立一口价</a></li>
<li><a href="#tab-addons" data-toggle="tab"><i class="fa fa-plus-square text-danger"></i> 增项施工服务绑定</a></li>
</ul>
<div class="tab-content" style="padding: 15px 0;">
<!-- Tab 1: 基础信息 -->
<div class="tab-pane active" id="tab-basic">
<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-cat_id" data-rule="required" min="0" data-source="service/cat/index" class="form-control selectpage" name="row[cat_id]" type="text" value="{$row.cat_id|htmlentities}">
</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}">
</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="input-group">
<input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> 上传</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> 选择</button></span>
</div>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</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">
<select id="c-price_type" data-rule="required" class="form-control selectpicker" name="row[price_type]">
{foreach name="priceTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.price_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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-base_price" data-rule="required" class="form-control" step="0.01" name="row[base_price]" type="number" value="{$row.base_price|htmlentities}">
<span class="help-block text-muted"><i class="fa fa-info-circle"></i> 作为该商品的通用基准价(若各工项未单独定价时默认采用此价)</span>
</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-unit" data-rule="required" class="form-control" name="row[unit]" type="text" value="{$row.unit|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">
<input id="c-floor_fee" data-rule="required" class="form-control" step="0.01" name="row[floor_fee]" type="number" value="{$row.floor_fee|htmlentities}">
</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-free_floor" data-rule="required" class="form-control" name="row[free_floor]" type="number" value="{$row.free_floor|htmlentities}">
</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">
<textarea id="c-description" class="form-control" rows="3" name="row[description]">{$row.description|htmlentities}</textarea>
</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-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</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="radio">
{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>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-image"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-price_type" data-rule="required" class="form-control selectpicker" name="row[price_type]">
{foreach name="priceTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.price_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Base_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-base_price" data-rule="required" class="form-control" step="0.01" name="row[base_price]" type="number" value="{$row.base_price|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Max_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-max_price" data-rule="required" class="form-control" step="0.01" name="row[max_price]" type="number" value="{$row.max_price|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Unit')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-unit" data-rule="required" class="form-control" name="row[unit]" type="text" value="{$row.unit|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Floor_fee')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-floor_fee" data-rule="required" class="form-control" step="0.01" name="row[floor_fee]" type="number" value="{$row.floor_fee|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Free_floor')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-free_floor" data-rule="required" class="form-control" name="row[free_floor]" type="number" value="{$row.free_floor|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Need_model')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-need_model" data-rule="required" class="form-control" name="row[need_model]" type="number" value="{$row.need_model|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-description" data-rule="required" class="form-control" name="row[description]" type="text" value="{$row.description|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sales')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sales" data-rule="required" class="form-control" name="row[sales]" type="number" value="{$row.sales|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{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>
<!-- Tab 2: 工项服务定价 -->
<div class="tab-pane" id="tab-service-types">
<div class="alert alert-info-light">
<i class="fa fa-info-circle"></i> 勾选此商品支持的服务工项(如安装、维修、拆旧等),并可为每个工项设定独立一口价。
</div>
<table class="table table-bordered table-striped" id="service-types-table">
<thead>
<tr class="active">
<th style="width: 60px; text-align: center;">启用</th>
<th style="width: 120px;">工项标识</th>
<th style="width: 160px;">工项显示名称</th>
<th style="width: 140px;">工项一口价(元)</th>
<th style="width: 80px; text-align: center;">默认勾选</th>
</tr>
</thead>
<tbody>
<?php
$defaultTypes = [
'install' => ['name' => '安装', 'price' => $row['base_price'], 'default' => 1],
'repair' => ['name' => '维修', 'price' => round($row['base_price'] * 0.7, 2), 'default' => 0],
'remove' => ['name' => '拆旧', 'price' => round($row['base_price'] * 0.5, 2), 'default' => 0],
'deliver' => ['name' => '送货到家', 'price' => 50.00, 'default' => 0],
'deliver_install' => ['name' => '送货到家并安装', 'price' => $row['base_price'] + 50.00, 'default' => 0],
'measure' => ['name' => '坑距测量(含拆旧)', 'price' => 40.00, 'default' => 0],
'maintain' => ['name' => '保养', 'price' => 60.00, 'default' => 0],
];
$savedMap = [];
foreach ($serviceTypes as $st) {
if (isset($st['code'])) {
$savedMap[$st['code']] = $st;
}
}
?>
{foreach name="defaultTypes" item="cfg" key="code"}
<?php
$isCheck = !empty($savedMap) ? isset($savedMap[$code]) : true;
$curName = isset($savedMap[$code]['name']) ? $savedMap[$code]['name'] : $cfg['name'];
$curPrice = isset($savedMap[$code]['price']) ? $savedMap[$code]['price'] : $cfg['price'];
$isDef = isset($savedMap[$code]['is_default']) ? $savedMap[$code]['is_default'] : $cfg['default'];
?>
<tr>
<td style="text-align: center; vertical-align: middle;">
<input type="checkbox" class="st-enable" data-code="{$code}" {if $isCheck}checked{/if}>
</td>
<td style="vertical-align: middle;"><code>{$code}</code></td>
<td>
<input type="text" class="form-control input-sm st-name" data-code="{$code}" value="{$curName}">
</td>
<td>
<div class="input-group input-group-sm">
<span class="input-group-addon">¥</span>
<input type="number" step="0.01" class="form-control st-price" data-code="{$code}" value="{$curPrice}">
</div>
</td>
<td style="text-align: center; vertical-align: middle;">
<input type="radio" name="st_default_radio" class="st-default" data-code="{$code}" {if $isDef}checked{/if}>
</td>
</tr>
{/foreach}
</tbody>
</table>
<input type="hidden" name="row[service_types_raw]" id="service_types_raw" value="">
</div>
<!-- Tab 3: 规格独立定价 -->
<div class="tab-pane" id="tab-specs">
<div class="alert alert-success-light">
<i class="fa fa-info-circle"></i> 为该商品增设不同规格(如:单眼灶/双眼灶、普通坐便器/智能马桶),并分别设置规格基准一口价。
</div>
<table class="table table-bordered table-striped" id="specs-table">
<thead>
<tr class="active">
<th style="width: 200px;">规格名称</th>
<th style="width: 150px;">规格独立一口价(元)</th>
<th>规格施工描述</th>
<th style="width: 80px; text-align: center;">操作</th>
</tr>
</thead>
<tbody id="specs-tbody">
{foreach name="specs" item="sp" key="idx"}
<tr data-id="{$sp.id}">
<td>
<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" value="{$sp.base_price}">
</div>
</td>
<td>
<input type="text" name="specs[{$idx}][description]" class="form-control input-sm" value="{$sp.description|htmlentities}" placeholder="施工要求说明">
</td>
<td style="text-align: center;">
<button type="button" class="btn btn-xs btn-danger btn-del-spec"><i class="fa fa-trash"></i></button>
</td>
</tr>
{/foreach}
</tbody>
</table>
<button type="button" class="btn btn-sm btn-success" id="btn-add-spec"><i class="fa fa-plus"></i> 添加新规格</button>
</div>
<!-- Tab 4: 增项服务绑定 -->
<div class="tab-pane" id="tab-addons">
<div class="alert alert-danger-light">
<i class="fa fa-info-circle"></i> 从系统增项库中勾选该商品允许加选的增项服务(如马桶勾选拆旧/改坑距,油烟机勾选打孔),并可为该商品定制专属单价(留空则默认按全局价)。
</div>
<table class="table table-bordered table-striped" id="addons-table">
<thead>
<tr class="active">
<th style="width: 60px; text-align: center;">绑定</th>
<th style="width: 180px;">增项名称</th>
<th style="width: 90px; text-align: center;">单位</th>
<th style="width: 140px;">平台全局指导价</th>
<th style="width: 180px;">针对本商品专属单价(元)</th>
</tr>
</thead>
<tbody>
<?php
$assignedMap = [];
foreach ($assignedAddons as $ad) {
if (isset($ad['id'])) {
$assignedMap[$ad['id']] = $ad;
}
}
?>
{foreach name="addonsPool" item="ad"}
<?php
$isBind = isset($assignedMap[$ad['id']]);
$customPrice = $isBind && isset($assignedMap[$ad['id']]['price']) ? $assignedMap[$ad['id']]['price'] : $ad['default_price'];
?>
<tr>
<td style="text-align: center; vertical-align: middle;">
<input type="checkbox" class="ad-bind" data-id="{$ad.id}" data-name="{$ad.name}" data-unit="{$ad.unit}" {if $isBind}checked{/if}>
</td>
<td style="vertical-align: middle;">
<strong>{$ad.name}</strong>
</td>
<td style="text-align: center; vertical-align: middle;">
<span class="badge">{$ad.unit}</span>
</td>
<td style="vertical-align: middle; color: #888;">
¥{$ad.default_price}
</td>
<td>
<div class="input-group input-group-sm">
<span class="input-group-addon">¥</span>
<input type="number" step="0.01" class="form-control ad-price" data-id="{$ad.id}" value="{$customPrice}" placeholder="覆盖单价">
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
<input type="hidden" name="row[addons_raw]" id="addons_raw" value="">
</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="submit" class="btn btn-primary btn-embossed disabled" id="btn-submit-service">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
<script>
// 动态组装工项与增项 JSON
function collectServiceConfig() {
// 1. 收集工项
var serviceTypes = [];
$('#service-types-table tbody tr').each(function () {
var $row = $(this);
var $enable = $row.find('.st-enable');
if ($enable.is(':checked')) {
var code = $enable.data('code');
var name = $row.find('.st-name').val();
var price = parseFloat($row.find('.st-price').val()) || 0;
var isDef = $row.find('.st-default').is(':checked') ? 1 : 0;
serviceTypes.push({
code: code,
name: name,
price: price,
is_default: isDef
});
}
});
$('#service_types_raw').val(JSON.stringify(serviceTypes));
// 2. 收集增项
var addons = [];
$('#addons-table tbody tr').each(function () {
var $row = $(this);
var $bind = $row.find('.ad-bind');
if ($bind.is(':checked')) {
var id = parseInt($bind.data('id'), 10);
var name = $bind.data('name');
var unit = $bind.data('unit');
var price = parseFloat($row.find('.ad-price').val()) || 0;
addons.push({
id: id,
name: name,
unit: unit,
price: price
});
}
});
$('#addons_raw').val(JSON.stringify(addons));
}
// 监听表单提交事件,在提交前组装 JSON
$(document).on('submit', '#edit-form', function () {
collectServiceConfig();
});
// 动态添加规格
var specIndex = 1000;
$(document).on('click', '#btn-add-spec', function () {
specIndex++;
var html = '<tr>' +
'<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" value="0.00"></div></td>' +
'<td><input type="text" name="specs[' + specIndex + '][description]" class="form-control input-sm" placeholder="施工说明"></td>' +
'<td style="text-align:center;"><button type="button" class="btn btn-xs btn-danger btn-del-spec"><i class="fa fa-trash"></i></button></td>' +
'</tr>';
$('#specs-tbody').append(html);
});
// 删除规格
$(document).on('click', '.btn-del-spec', function () {
$(this).closest('tr').remove();
});
</script>