添加订单

This commit is contained in:
hant 2025-03-23 18:19:34 +08:00
parent d08bbb1c7f
commit 10760ed9d0
24 changed files with 19003 additions and 431 deletions

View File

@ -1,5 +1,6 @@
require([], function () {
//绑定data-toggle=addresspicker属性点击事件
console.log('111');
$(document).on('click', "[data-toggle='addresspicker']", function () {
var that = this;
@ -10,9 +11,17 @@ require([], function () {
var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : "";
var lat = lat_id ? $("#" + lat_id).val() : '';
var lng = lng_id ? $("#" + lng_id).val() : '';
var city_code = $("#area_id").val();
var zoom = zoom_id ? $("#" + zoom_id).val() : '';
var url = "/addons/address/index/select";
url += (lat && lng) ? '?lat=' + lat + '&lng=' + lng + (input_id ? "&address=" + $("#" + input_id).val() : "") + (zoom ? "&zoom=" + zoom : "") : '';
var url = "/addons/address/index/select?1=1";
url += (lat && lng) ? 'lat=' + lat + '&lng=' + lng +
(input_id ? "&address=" + $("#" + input_id).val() : "")
+(zoom ? "&zoom=" + zoom : "") : ''
;
if (city_code){
url += city_code ? "&city_code=" + city_code : "";
}
console.log(url);
Fast.api.open(url, '位置选择', {
callback: function (res) {
input_id && $("#" + input_id).val(res.address).trigger("change");

View File

@ -2,131 +2,131 @@
return [
[
'name' => 'maptype',
'title' => '默认地图类型',
'type' => 'radio',
'name' => 'maptype',
'title' => '默认地图类型',
'type' => 'radio',
'content' => [
'baidu' => '百度地图',
'amap' => '高德地图',
'baidu' => '百度地图',
'amap' => '高德地图',
'tencent' => '腾讯地图',
],
'value' => 'baidu',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => 'amap',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'zoom',
'title' => '默认缩放级别',
'type' => 'string',
'name' => 'zoom',
'title' => '默认缩放级别',
'type' => 'string',
'content' => [],
'value' => '11',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => '11',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'lat',
'title' => '默认Lat',
'type' => 'string',
'name' => 'lat',
'title' => '默认Lat',
'type' => 'string',
'content' => [],
'value' => '39.919990',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => '39.919990',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'lng',
'title' => '默认Lng',
'type' => 'string',
'name' => 'lng',
'title' => '默认Lng',
'type' => 'string',
'content' => [],
'value' => '116.456270',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => '116.456270',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'baidukey',
'title' => '百度地图KEY',
'type' => 'string',
'name' => 'baidukey',
'title' => '百度地图KEY',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'amapkey',
'title' => '高德地图KEY',
'type' => 'string',
'name' => 'amapkey',
'title' => '高德地图KEY',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => 'dd4e8434697466586aaac37167abfb52',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'amapsecurityjscode',
'title' => '高德地图安全密钥',
'type' => 'string',
'name' => 'amapsecurityjscode',
'title' => '高德地图安全密钥',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => '38b7b7a5e4b90dcb1aa4999826d4e9d1',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'tencentkey',
'title' => '腾讯地图KEY',
'type' => 'string',
'name' => 'tencentkey',
'title' => '腾讯地图KEY',
'type' => 'string',
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => '',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => 'coordtype',
'title' => '坐标系类型',
'type' => 'select',
'name' => 'coordtype',
'title' => '坐标系类型',
'type' => 'select',
'content' => [
'DEFAULT' => '默认(使用所选地图默认坐标系)',
'GCJ02' => 'GCJ-02',
'BD09' => 'BD-09',
'GCJ02' => 'GCJ-02',
'BD09' => 'BD-09',
],
'value' => 'DEFAULT',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
'value' => 'DEFAULT',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
[
'name' => '__tips__',
'title' => '温馨提示',
'type' => '',
'name' => '__tips__',
'title' => '温馨提示',
'type' => '',
'content' => [],
'value' => '请先申请对应地图的Key配置后再使用',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => 'alert-danger-light',
'value' => '请先申请对应地图的Key配置后再使用',
'rule' => '',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => 'alert-danger-light',
],
];

View File

@ -48,12 +48,14 @@ class Index extends Controller
$lng = (float)$this->request->get('lng');
$lat = (float)$this->request->get('lat');
$address = $this->request->get('address');
$city_code = $this->request->get('city_code');
$lng = $lng ?: $config['lng'];
$lat = $lat ?: $config['lat'];
$this->view->assign('zoom', $zoom);
$this->view->assign('lng', $lng);
$this->view->assign('lat', $lat);
$this->view->assign('address', $address);
$this->view->assign('city_code', $city_code);
$maptype = $config['maptype'];
if (!isset($config[$maptype . 'key']) || !$config[$maptype . 'key']) {
$this->error("请在配置中配置对应类型地图的密钥");

View File

@ -91,8 +91,9 @@
<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
<script type="text/javascript">
$(function () {
var as, map, geocoder, address, fromtype, totype;
var as, map, geocoder, address, fromtype, totype,city_code;
address = "{$address|htmlentities}";
city_code = "{$city_code|htmlentities}";
var lng = Number("{$lng}");
var lat = Number("{$lat}");
fromtype = "GCJ02";
@ -107,14 +108,29 @@
var init = function () {
AMapUI.loadUI(['misc/PositionPicker', 'misc/PoiPicker'], function (PositionPicker, PoiPicker) {
var center = [lng,lat]
//加载PositionPickerloadUI的路径参数为模块名中 'ui/' 之后的部分
console.log(center)
map = new AMap.Map('container', {
zoom: parseInt('{$zoom}'),
center: [lng, lat]
center: center
});
geocoder = new AMap.Geocoder({
radius: 1000 //范围默认500
radius: 1000, //范围默认500,
});
if (city_code){
geocoder.getLocation(city_code, function(status, result) {
if (status === 'complete' && result.info === 'OK') {
lat = result.geocodes[0].location.lat;
lng = result.geocodes[0].location.lng;
map.setCenter(result.geocodes[0].location)
} else {
// alert('无法获取该城市的经纬度信息');
}
});
}
var positionPicker = new PositionPicker({
mode: 'dragMarker',//设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
map: map//依赖地图对象

View File

@ -0,0 +1,72 @@
<?php
namespace app\admin\command;
use Overtrue\Pinyin\Converter;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Db;
use Overtrue\Pinyin\Pinyin;
class ImportServiceItems extends Command
{
protected function configure()
{
$this->setName('item:import:new')
->setDescription('倒入 item 数据');
}
protected function execute(Input $input, Output $output)
{
// 读取 JSON 文件
$jsonFile = __DIR__.'/newItem.json'; // JSON 文件路径
if (!file_exists($jsonFile)) {
$output->writeln("JSON file not found.");
return;
}
$jsonData = file_get_contents($jsonFile);
$data = json_decode($jsonData, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$output->writeln("Invalid JSON format.");
return;
}
// 调用递归函数导入数据
$this->importData($data['服务项目'],$output, 0, 1);
$output->writeln("Data import completed.");
}
// 递归函数处理服务项插入
protected function importData($items,Output $output, $parentId = 0, $level = 1)
{
foreach ($items as $item) {
// 插入当前服务项
$insertData = [
'pid' => $parentId,
'level' => $level,
'title' => $item['title'],
'key_word' => null, // 可以根据需要提供关键词
'image' => null, // 可以根据需要提供图标
'sort' => 0, // 可以根据需要设置排序
'status' => 1, // 默认启用
];
// 执行插入
$result = Db::name('item')->insert($insertData);
if ($result) {
$output->writeln("Inserted: " . $item['title']);
} else {
$output->writeln("Failed to insert: " . $item['title']);
}
// 如果有子项,递归插入
if (isset($item['children'])) {
$this->importData($item['children'], $output,Db::name('item')->getLastInsID(), $level + 1);
}
}
}
}

View File

@ -0,0 +1,212 @@
{
"服务项目": [
{
"title": "刷墙补漆",
"children": [
{
"title": "墙面修补",
"children": [
{"title": "裂缝"},
{"title": "孔洞"},
{"title": "起皮"},
{"title": "发霉"},
{"title": "鼓包"},
{"title": "墙面污渍"},
{"title": "划痕"}
]
},
{
"title": "墙面刷漆",
"children": [
{"title": "乳胶漆"},
{"title": "艺术漆"}
]
},
{
"title": "墙面翻新",
"children": [
{"title": "毛坯房刷漆"},
{"title": "局部翻新"},
{"title": "整体翻新"}
]
}
]
},
{
"title": "美缝施工",
"children": [
{"title": "瓷砖美缝"},
{"title": "石材美缝"},
{"title": "马赛克美缝"},
{"title": "美缝清理维护"}
]
},
{
"title": "拆除清运",
"children": [
{"title": "墙体拆除"},
{"title": "地面拆除"},
{"title": "吊顶拆除"},
{"title": "门窗拆除"},
{"title": "家具拆除"},
{"title": "垃圾清运"},
{"title": "建筑废料处理"}
]
},
{
"title": "家政保洁",
"children": [
{"title": "日常保洁"},
{"title": "深度保洁"},
{"title": "开荒保洁"},
{"title": "玻璃清洗"},
{"title": "地毯清洗"},
{"title": "沙发清洗"},
{"title": "窗帘清洗"},
{"title": "家电清洗"},
{"title": "卫生间除垢"},
{"title": "厨房除油"}
]
},
{
"title": "电路维修",
"children": [
{"title": "电路检修"},
{"title": "灯具安装维修"},
{"title": "开关插座安装维修"},
{"title": "配电箱维修"},
{"title": "线路改造"},
{"title": "电器维修"},
{"title": "智能家居安装调试"}
]
},
{
"title": "水路维修",
"children": [
{
"title": "水路维修",
"children": [
{"title": "水龙头更换维修"},
{"title": "角阀更换维修"},
{"title": "马桶维修"},
{"title": "地漏维修"},
{"title": "热水器维修"},
{"title": "净水器安装维修"}
]
},
{"title": "水路改造"},
{"title": "漏水"},
{"title": "堵塞"},
{"title": "噪音"},
{"title": "水压异常"},
{"title": "水质浑浊"},
{
"title": "管道疏通",
"children": [
{"title": "下水道疏通"},
{"title": "马桶疏通"},
{"title": "地漏疏通"},
{"title": "洗手池疏通"},
{"title": "浴缸疏通"},
{"title": "厨房管道疏通"}
]
},
{"title": "化粪池清理"}
]
},
{
"title": "开锁换锁",
"children": [
{"title": "门锁开锁"},
{"title": "汽车开锁"},
{"title": "保险柜开锁"},
{"title": "门锁更换"},
{"title": "指纹锁安装"},
{"title": "智能锁安装"},
{"title": "锁具维修"}
]
},
{
"title": "门窗维修",
"children": [
{"title": "门窗安装"},
{"title": "门窗维修"},
{"title": "门窗更换"},
{"title": "门窗密封条更换"},
{"title": "门窗五金件更换"},
{"title": "纱窗安装维修"},
{"title": "变形"},
{"title": "开裂"},
{"title": "漏风"}
]
},
{
"title": "收纳整理",
"children": [
{"title": "衣橱整理"},
{"title": "厨房整理"},
{"title": "书房整理"},
{"title": "儿童房整理"},
{"title": "客厅整理"},
{"title": "储物间整理"},
{"title": "搬家整理"},
{"title": "空间规划"}
]
},
{
"title": "沙发翻新",
"children": [
{"title": "沙发清洗"},
{"title": "沙发维修"},
{"title": "沙发换皮"},
{"title": "沙发换布"},
{"title": "沙发更换海绵"},
{"title": "沙发框架加固"},
{"title": "破损"},
{"title": "塌陷"}
]
},
{
"title": "地板维修",
"children": [
{"title": "地板安装"},
{"title": "地板维修"},
{"title": "地板更换"},
{"title": "地板打磨翻新"},
{"title": "地板打蜡保养"},
{"title": "木地板防潮处理"},
{"title": "地板开裂"},
{"title": "地板起供"},
{"title": "地板磨损"},
{"title": "地板异响"},
{"title": "地板变色"},
{"title": "地板受潮"},
{"title": "地板松动"},
{"title": "地板老化"}
]
},
{
"title": "软装清洗",
"children": [
{"title": "窗帘清洗"},
{"title": "地毯清洗"},
{"title": "沙发清洗"},
{"title": "床垫清洗"},
{"title": "抱枕清洗"},
{"title": "桌布清洗"},
{"title": "布艺家具清洗"},
{"title": "家电清洗"},
{
"title": "空调清洗"
},
{"title": "油烟机清洗"},
{"title": "冰箱清洗"},
{"title": "洗衣机清洗"},
{"title": "热水器清洗"},
{"title": "微波炉清洗"},
{"title": "烤箱清洗"},
{"title": "饮水机清洗"}
]
}
]
}

View File

@ -0,0 +1,15 @@
<?php
namespace app\admin\controller;
use think\Env;
class Amap
{
function search($keyword, $code) {
$api_key = Env::get('amap.key');
dd($keyword);
}
}

View File

@ -61,37 +61,35 @@ class Order extends Backend
->order('pid','asc')
->order('sort','desc')
->select();
$tree = $this->buildTree($items);
$formattedTree = $this->formatTree($tree);
$phones = Db::name('phones')
->where('assigned_user',$this->auth->id)
->field(['id','model','phone_number'])
->select();
$this->items = $items;
$filtered = array_filter($items, function($item) {
return $item['pid'] == 0;
});
$pid_map = array_column($filtered,null,'id');
$res_items = [];
foreach ($items as $item){
if ($item['pid'] != 0 && isset($pid_map[$item['pid']])){
$res_items [] = [
...$item,'ptitle' => $pid_map[$item['pid']]['title']
];
}
}
$coupons = Db::name('coupons')
->where('status','active')
->field(['id','code','description'])
->select();
$users = Db::name('admin')
->field(['id','nickname'])
->select();
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("sources", $res);
$this->view->assign("coupons", $coupons);
$this->view->assign("items", $res_items);
$this->view->assign("items", $formattedTree);
$this->view->assign("phones", $phones);
$this->view->assign("users", $users);
//$this->view->assign("collectList", $this->model->getCollectList());
//$this->view->assign("dispatchTypeList", $this->model->getDispatchTypeList());
}
@ -120,7 +118,7 @@ class Order extends Backend
$list = $this->model
->field(['id','order_no','admin_id','customer','tel','status','area_id','address',
'source','source_shop','source_uid','source','item_title','item_id','work_tel_id',
'detail','remark','images','create_time','update_time','admin_id'])
'detail','remark','images','create_time','update_time','admin_id','dispatch_type','receive_type'])
->where($where)
->with(['user' => function($q){
$q->field('id,nickname');
@ -165,7 +163,10 @@ class Order extends Backend
$items = array_column($items,'title','id');
$params['source_shop'] = $sources[$params['source']] ?? null;
$params['item_title'] = $items[$params['item_id']] ?? null;
$params['admin_id'] = $this->auth->id;
$params['admin_id'] = ($params['admin_id'] ?? -1) == -1 ? $this->auth->id : $params['admin_id'];
if(empty($params['admin_id'])){
$params['admin_id'] = $this->auth->id;
}
$params['status'] = 10;
$params['order_no'] = $this->generateOrderNumber();
$params['create_time'] = date('Y-m-d H:i:s');
@ -219,10 +220,14 @@ class Order extends Backend
$sources = array_column($sources,'title','id');
$items = array_column($items,'title','id');
$params['admin_id'] = ($params['admin_id'] == -1) ? $this->auth->id : $params['admin_id'];
if(empty($params['admin_id'])){
$params['admin_id'] = $this->auth->id;
}
$params['source_shop'] = $sources[$params['source']] ?? null;
$params['item_title'] = $items[$params['item_id']] ?? null;
$params['create_time'] = date('Y-m-d H:i:s');
// $params['create_time'] = date('Y-m-d H:i:s');
$params['update_time'] = date('Y-m-d H:i:s');
// 更新订单信息

View File

@ -101,30 +101,19 @@ class Dispatch extends Backend
$this->error(__('No results were found'));
}
$items = Db::name('item')
->where('status',1)
->field(['id','title','key_word','pid'])
->order('pid','asc')
->order('sort','desc')
->select();
$filtered = array_filter($items, function($item) {
return $item['pid'] == 0;
});
$pid_map = array_column($filtered,null,'id');
$res_items = [];
foreach ($items as $item){
if ($item['pid'] != 0 && isset($pid_map[$item['pid']])){
$res_items [] = [
...$item,'ptitle' => $pid_map[$item['pid']]['title']
];
}
}
$tree = $this->buildTree($items);
$formattedTree = $this->formatTree($tree);
$area_name = model('area')->getNameByCode($order->area_id);
$order->area_name = str_replace(',','/',$area_name);
$this->view->assign('items', $res_items);
$this->view->assign('items', $formattedTree);
$this->view->assign('row', $order);
return $this->view->fetch();
@ -157,7 +146,8 @@ class Dispatch extends Backend
'order_id' => $params['order_id'],
'type' => 1,
'worker_id' => $params['worker_id'],
'plan_time' => $params['plan_time'],
'plan_time' => $order['plan_time'],
'is_receipt' => $order['receive_type'] == 1
];
$worker = model('worker')->where('id',$params['worker_id'])->find();

View File

@ -16,22 +16,22 @@
<small>{:__('Control panel')}</small>
</h1>
</section>
{if !IS_DIALOG && !$Think.config.fastadmin.multiplenav && $Think.config.fastadmin.breadcrumb}
<!-- RIBBON -->
<div id="ribbon">
<ol class="breadcrumb pull-left">
{if condition="$auth->check('dashboard')"}
<li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> {:__('Dashboard')}</a></li>
{/if}
</ol>
<ol class="breadcrumb pull-right">
{foreach $breadcrumb as $vo}
<li><a href="javascript:;" data-url="{$vo.url|htmlentities}">{$vo.title|htmlentities}</a></li>
{/foreach}
</ol>
</div>
<!-- END RIBBON -->
{/if}
<!-- {if !IS_DIALOG && !$Think.config.fastadmin.multiplenav && $Think.config.fastadmin.breadcrumb}-->
<!-- &lt;!&ndash; RIBBON &ndash;&gt;-->
<!-- <div id="ribbon">-->
<!-- <ol class="breadcrumb pull-left">-->
<!-- {if condition="$auth->check('dashboard')"}-->
<!-- <li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> {:__('Dashboard')}</a></li>-->
<!-- {/if}-->
<!-- </ol>-->
<!-- <ol class="breadcrumb pull-right">-->
<!-- {foreach $breadcrumb as $vo}-->
<!-- <li><a href="javascript:;" data-url="{$vo.url|htmlentities}">{$vo.title|htmlentities}</a></li>-->
<!-- {/foreach}-->
<!-- </ol>-->
<!-- </div>-->
<!-- END RIBBON -->
<!-- {/if}-->
<div class="content">
{__CONTENT__}
</div>

View File

@ -4,37 +4,24 @@
<div class="content">
<!-- 表单区域占2/3 -->
<div class="form-area">
<div class="w-75">
<div>
<div class="card-body">
<h5 class="card-title">录入订单</h5>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<form id="add-form" class="row" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Customer')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-customer" data-rule="required" class="form-control" name="row[customer]" type="text">
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Tel')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tel" data-rule="required" class="form-control" name="row[tel]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
<div class='col-xs-12 col-sm-8'>
<input id="c-city" data-rule="required" class="form-control" data-toggle="city-picker" name="row[address]" type="text" value="" />
<input id="area_id" style="display: none" class="form-control" name="row[area_id]" hidden type="text" value="" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required" class="form-control" name="row[address]" type="text" value="">
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Source')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-source" data-live-search="true" title="请选择" data-rule="required" name="row[source]" class="form-control selectpicker show-tick">
@ -46,7 +33,89 @@
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">来源订单ID:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-source-id" name="row[source_uid]" type="text" class="form-control">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">录单员:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-users" data-live-search="true" title="不选择默认当前登陆账号" name="row[admin_id]" class="form-control selectpicker show-tick">
<option value="-1">不选择默认当前登陆账号</option>
{foreach $users as $item}
<option value="{$item['id']}">{$item['nickname']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">派单方式:</label>
<div class="col-xs-12 col-sm-8">
<select data-live-search="true" name="row[dispatch_type]" class="form-control selectpicker show-tick">
<option selected value="1">手动派单</option>
<option value="2">自动派单</option>
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">收款方式:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[receive_type]" class="form-control selectpicker">
<option selected value="1">已收定金</option>
<option value="2">已收全款</option>
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">收款金额:</label>
<div class="col-xs-12 col-sm-8">
<input data-rule="required" name="row[online_amount]" class="form-control" type="number">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
<div class='col-xs-12 col-sm-8'>
<input id="c-city" data-rule="required" class="form-control" data-toggle="city-picker" name="row[address]" type="text" value="" />
<input id="area_id" style="display: none" class="form-control" name="row[area_id]" hidden type="text" value="" />
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required"
class="form-control"
name="row[address]"
type="text">
<input type="text" style="display: none"
name="row[lng]" id="lng" >
<input type="text" style="display: none"
name="row[lat]" id="lat">
<input type="text" style="display: none" id="area_name">
</div>
</div>
<div class="col-xs-6">
<p style="display: inline-block" class="control-label col-xs-12 col-sm-3">
未能找到使用
</p>
<div class="col-xs-12 col-sm-8" >
<span class="btn btn-primary" data-toggle="addresspicker"
data-input-id="c-address"
data-lng-id="lng"
data-lat-id="lat">地图查找</span>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-coupon" data-live-search="true" title="请选择" data-rule="required" name="row[coupon_id]" class="form-control selectpicker show-tick">
@ -58,43 +127,35 @@
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">上门时间:</label>
<div class="col-xs-12 col-sm-8">
<input data-rule="required" name="row[plan_time]" class="form-control datetimepicker">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Item_title')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="citem" data-live-search="true" title="请选择" data-rule="required" name="row[item_id]" class="form-control selectpicker show-tick">
{foreach $items as $item}
<option data-subtext="{$item['key_word']}" value="{$item['id']}">{$item['title']}</option>
{/foreach}
</select>
<input type="text" id="item_id" class="zd-input__inner">
<input type="text" id="item_id_value" style="display: none" name="row[item_id]" class="zd-input__inner">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Work_tel_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="Work_tel_id" data-live-search="true" title="请选择" data-rule="required" name="row[work_tel_id]" class="form-control selectpicker show-tick">
{foreach $phones as $item}
<option data-subtext="{$item['phone_number']}" value="{$item['id']}">{$item['model']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Detail')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-detail" rows="4" style="width: 100%;resize: vertical" class="form-control" name="row[detail]"></textarea>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-remark" rows="4" style="width: 100%;resize: vertical" class="form-control" name="row[remark]" ></textarea>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
@ -108,7 +169,7 @@
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group layer-footer">
<div class="form-group col-xs-6 layer-footer">
<label class="control-label col-xs-12 col-sm-3"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" data-id="submit" class="btn btn-primary btn-embossed disabled">录入并清空</button>
@ -117,22 +178,19 @@
</div>
</form>
</div>
</div>
</div>
<h5 class="text-left">快速输入</h5>
<div class="col-md-6">
<div class="form-floating">
<textarea rows="8" style="width: 100%;resize: vertical" class="form-control" placeholder="复制内容,快速输入" id="floatingTextarea"></textarea>
</div>
</div>
<!-- 功能区占1/3 -->
<div class="function-area ">
<h5 class="text-center">快速输入</h5>
<div class="form-floating">
<textarea rows="8" style="width: 100%;resize: vertical" class="form-control" placeholder="复制内容,快速输入" id="floatingTextarea"></textarea>
</div>
</div>
</div>
</div>
</div>
<script>
</script>
<link rel="stylesheet" href="/assets/css/select.css">
<style>
.full-height {
height: 100vh;
@ -193,3 +251,6 @@
</style>
<script>
var items = {:json_encode($items); };
</script>

View File

@ -1,38 +1,27 @@
<div class="full-height">
<div class="overlay"></div> <!-- 遮罩层 -->
<div class="content">
<!-- 表单区域占2/3 -->
<div class="form-area">
<div class="w-75">
<div>
<div class="card-body">
<h5 class="card-title">编辑订单</h5>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('order/add')}">
<div class="form-group">
<h5 class="card-title">录入订单</h5>
<form id="add-form" class="row" role="form" data-toggle="validator" method="POST" action="{:url('order/add')}">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Customer')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-customer" data-rule="required" class="form-control" name="row[customer]" type="text" value="{$row.customer}">
<input id="c-customer" value="{$row['customer']}" data-rule="required" class="form-control" name="row[customer]" type="text">
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Tel')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tel" data-rule="required" class="form-control" name="row[tel]" type="number" value="{$row.tel}">
<input id="c-tel" data-rule="required" value="{$row['tel']}" class="form-control" name="row[tel]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
<div class='col-xs-12 col-sm-8'>
<input id="c-city" data-rule="required" class="form-control" data-toggle="city-picker" value="{$row.area_name}" type="text" name="row[address]" />
<input id="area_id" style="display: none" class="form-control" name="row[area_id]" hidden type="text" value="{$row.area_id}" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required" class="form-control" name="row[address]" type="text" value="{$row.address}">
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Source')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-source" data-live-search="true" title="请选择" data-rule="required" name="row[source]" class="form-control selectpicker show-tick">
@ -43,7 +32,93 @@
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">来源订单ID:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-source-id" value="{$row['source_uid']}" name="row[source_uid]" type="text" class="form-control">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">录单员:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-users" data-live-search="true" title="不选择默认当前登陆账号" name="row[admin_id]" class="form-control selectpicker show-tick">
<option value="-1">不选择默认当前登陆账号</option>
{foreach $users as $item}
<option {if $item['id'] == $row.admin_id} selected {/if} value="{$item['id']}">{$item['nickname']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">派单方式:</label>
<div class="col-xs-12 col-sm-8">
<select data-live-search="true" value="" name="row[dispatch_type]" class="form-control selectpicker show-tick">
<option {if 1 == $row.dispatch_type} value="1">手动派单</option>
<option {if 2 == $row.dispatch_type} value="2">自动派单</option>
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">收款方式:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[receive_type]" class="form-control selectpicker">
<option {if 1 == $row.receive_type} value="1">已收定金</option>
<option {if 2 == $row.receive_type} value="2">已收全款</option>
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">收款金额:</label>
<div class="col-xs-12 col-sm-8">
<input data-rule="required" value="{$row['online_amount']}" name="row[online_amount]" class="form-control" type="number">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
<div class='col-xs-12 col-sm-8'>
<input id="c-city" data-rule="required" value="{$row.area_name}" class="form-control" data-toggle="city-picker" name="row[address]" type="text" value="" />
<input id="area_id" style="display: none" value="{$row.area_id}" class="form-control" name="row[area_id]" hidden type="text" value="" />
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required"
class="form-control"
value="{$row.address}"
name="row[address]"
type="text">
<input type="text" style="display: none"
value="{$row['lng']}"
name="row[lng]" id="lng" >
<input type="text" style="display: none"
value="{$row['lat']}"
name="row[lat]" id="lat">
<input value="{$row['area_name']}" type="text" style="display: none" id="area_name">
</div>
</div>
<div class="col-xs-6">
<p style="display: inline-block" class="control-label col-xs-12 col-sm-3">
未能找到使用
</p>
<div class="col-xs-12 col-sm-8" >
<span class="btn btn-primary" data-toggle="addresspicker"
data-input-id="c-address"
data-lng-id="lng"
data-lat-id="lat">地图查找</span>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-coupon" data-live-search="true" title="请选择" data-rule="required" name="row[coupon_id]" class="form-control selectpicker show-tick">
@ -55,44 +130,37 @@
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">上门时间:</label>
<div class="col-xs-12 col-sm-8">
<input data-rule="required" value="{$row['plan_time']}" name="row[plan_time]" class="form-control datetimepicker">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Item_title')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="citem" data-live-search="true" title="请选择" data-rule="required" name="row[item_id]" class="form-control selectpicker show-tick">
{foreach $items as $item}
<option {if $item['id'] == $row.item_id} selected {/if} data-subtext="{$item['key_word']}" value="{$item['id']}">{$item['title']}</option>
{/foreach}
</select>
<input type="text" id="item_id" value="{$row.item_title}" data-value="{$row.item_title}" class="zd-input__inner">
<input type="text" id="item_id_value" value="{$row.item_id}" style="display: none" name="row[item_id]" class="zd-input__inner">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Work_tel_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="Work_tel_id" data-live-search="true" title="请选择" data-rule="required" name="row[work_tel_id]" class="form-control selectpicker show-tick">
{foreach $phones as $item}
<option {if $item['id'] == $row.work_tel_id} selected {/if} data-subtext="{$item['phone_number']}" value="{$item['id']}">{$item['model']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Detail')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-detail" rows="4" style="width: 100%;resize: vertical" class="form-control" name="row[detail]">{$row.detail}</textarea>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-remark" rows="4" style="width: 100%;resize: vertical" class="form-control" name="row[remark]">{$row.remark}</textarea>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" class="form-control" size="50" name="row[images]" type="text" value="{$row.images}">
<input id="c-images" class="form-control" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
@ -102,27 +170,21 @@
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group layer-footer">
<div class="form-group col-xs-6 layer-footer">
<label class="control-label col-xs-12 col-sm-3"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed">创建订单</button>
<button type="submit" data-id="submit" class="btn btn-primary btn-embossed disabled">复制</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- 功能区占1/3 -->
<div class="function-area">
<h5 class="text-center">快速输入</h5>
<div class="form-floating">
<textarea rows="8" style="width: 100%;resize: vertical" class="form-control" placeholder="复制内容,快速输入" id="floatingTextarea"></textarea>
</div>
</div>
</div>
</div>
<script>
</script>
<style>
.full-height {
height: 100vh;
@ -180,4 +242,10 @@
.suggestion-item:hover {
background-color: #f0f0f0;
}
</style>
</style>
<script>
var items = {:json_encode($items); };
</script>
<link rel="stylesheet" href="/assets/css/select.css">

View File

@ -1,41 +1,27 @@
<div class="full-height">
<div class="overlay"></div> <!-- 遮罩层 -->
<div class="content">
<!-- 表单区域占2/3 -->
<div class="form-area">
<div class="w-75">
<div>
<div class="card-body">
<h5 class="card-title">编辑订单</h5>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('order/edit')}">
<input type="hidden" name="id" value="{$row.id}"> <!-- 订单ID用于提交编辑的对象 -->
<div class="form-group">
<h5 class="card-title">录入订单</h5>
<form id="add-form" class="row" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Customer')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-customer" data-rule="required" class="form-control" name="row[customer]" type="text" value="{$row.customer}">
<input id="c-customer" value="{$row['customer']}" data-rule="required" class="form-control" name="row[customer]" type="text">
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Tel')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tel" data-rule="required" class="form-control" name="row[tel]" type="number" value="{$row.tel}">
<input id="c-tel" data-rule="required" value="{$row['tel']}" class="form-control" name="row[tel]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
<div class='col-xs-12 col-sm-8'>
<input id="c-city" data-rule="required" class="form-control" data-toggle="city-picker" value="{$row.area_name}" type="text" name="row[address]" />
<input id="area_id" style="display: none" class="form-control" name="row[area_id]" hidden type="text" value="{$row.area_id}" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required" class="form-control" name="row[address]" type="text" value="{$row.address}">
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Source')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-source" data-live-search="true" title="请选择" data-rule="required" name="row[source]" class="form-control selectpicker show-tick">
@ -46,7 +32,91 @@
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">来源订单ID:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-source-id" value="{$row['source_uid']}" name="row[source_uid]" type="text" class="form-control">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">录单员:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-users" data-live-search="true" title="不选择默认当前登陆账号" name="row[admin_id]" class="form-control selectpicker show-tick">
<option value="-1">不选择默认当前登陆账号</option>
{foreach $users as $item}
<option {if $item['id'] == $row.admin_id} selected {/if} value="{$item['id']}">{$item['nickname']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">派单方式:</label>
<div class="col-xs-12 col-sm-8">
<select data-live-search="true" value="" name="row[dispatch_type]" class="form-control selectpicker show-tick">
<option {if 1 == $row.dispatch_type} value="1">手动派单</option>
<option {if 2 == $row.dispatch_type} value="2">自动派单</option>
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">收款方式:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[receive_type]" class="form-control selectpicker">
<option {if 1 == $row.receive_type} value="1">已收定金</option>
<option {if 2 == $row.receive_type} value="2">已收全款</option>
</select>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">收款金额:</label>
<div class="col-xs-12 col-sm-8">
<input data-rule="required" value="{$row['online_amount']}" name="row[online_amount]" class="form-control" type="number">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
<div class='col-xs-12 col-sm-8'>
<input id="c-city" data-rule="required" value="{$row.area_name}" class="form-control" data-toggle="city-picker" name="row[address]" type="text" value="" />
<input id="area_id" style="display: none" value="{$row.area_id}" class="form-control" name="row[area_id]" hidden type="text" value="" />
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required"
class="form-control"
value="{$row.address}"
name="row[address]"
type="text">
<input type="text" style="display: none"
name="row[lng]" id="lng" >
<input type="text" style="display: none"
name="row[lat]" id="lat">
<input type="text" style="display: none" id="area_name">
</div>
</div>
<div class="col-xs-6">
<p style="display: inline-block" class="control-label col-xs-12 col-sm-3">
未能找到使用
</p>
<div class="col-xs-12 col-sm-8" >
<span class="btn btn-primary" data-toggle="addresspicker"
data-input-id="c-address"
data-lng-id="lng"
data-lat-id="lat">地图查找</span>
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-coupon" data-live-search="true" title="请选择" data-rule="required" name="row[coupon_id]" class="form-control selectpicker show-tick">
@ -58,44 +128,37 @@
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">上门时间:</label>
<div class="col-xs-12 col-sm-8">
<input data-rule="required" value="{$row['plan_time']}" name="row[plan_time]" class="form-control datetimepicker">
</div>
</div>
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Item_title')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="citem" data-live-search="true" title="请选择" data-rule="required" name="row[item_id]" class="form-control selectpicker show-tick">
{foreach $items as $item}
<option {if $item['id'] == $row.item_id} selected {/if} data-subtext="{$item['key_word']}" value="{$item['id']}">{$item['title']}</option>
{/foreach}
</select>
<input type="text" id="item_id" value="{$row.item_title}" data-value="{$row.item_title}" class="zd-input__inner">
<input type="text" id="item_id_value" value="{$row.item_id}" style="display: none" name="row[item_id]" class="zd-input__inner">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Work_tel_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="Work_tel_id" data-live-search="true" title="请选择" data-rule="required" name="row[work_tel_id]" class="form-control selectpicker show-tick">
{foreach $phones as $item}
<option {if $item['id'] == $row.work_tel_id} selected {/if} data-subtext="{$item['phone_number']}" value="{$item['id']}">{$item['model']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Detail')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-detail" rows="4" style="width: 100%;resize: vertical" class="form-control" name="row[detail]">{$row.detail}</textarea>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-remark" rows="4" style="width: 100%;resize: vertical" class="form-control" name="row[remark]">{$row.remark}</textarea>
</div>
</div>
<div class="form-group">
<div class="form-group col-xs-6">
<label class="control-label col-xs-12 col-sm-3">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" class="form-control" size="50" name="row[images]" type="text" value="{$row.images}">
<input id="c-images" class="form-control" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
@ -105,27 +168,21 @@
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group layer-footer">
<div class="form-group col-xs-6 layer-footer">
<label class="control-label col-xs-12 col-sm-3"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed">更新订单</button>
<button type="submit" data-id="submit" class="btn btn-primary btn-embossed disabled">修改</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- 功能区占1/3 -->
<div class="function-area">
<h5 class="text-center">快速输入</h5>
<div class="form-floating">
<textarea rows="8" style="width: 100%;resize: vertical" class="form-control" placeholder="复制内容,快速输入" id="floatingTextarea"></textarea>
</div>
</div>
</div>
</div>
<script>
</script>
<style>
.full-height {
height: 100vh;
@ -183,4 +240,10 @@
.suggestion-item:hover {
background-color: #f0f0f0;
}
</style>
</style>
<script>
var items = {:json_encode($items); };
</script>
<link rel="stylesheet" href="/assets/css/select.css">

View File

@ -1,81 +1,45 @@
<div class="row">
<div class="col-md-4">
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<!-- 订单信息标题 -->
<div class="row order-header">
<div class="col-xs-12">
<h2>订单详情</h2>
<p><strong>订单编号:</strong> {$row.order_no}</p>
<p><strong>顾客信息:</strong> {$row.customer} 电话:{$row.tel}</p>
<p><strong>订单来源:</strong> {$row.source_shop} 单号:{$row.source_uid} </p>
<p><strong>区域:</strong> {$row.area_name}</p>
<p><strong>地址:</strong> {$row.address}</p>
<p><strong>订单类型:</strong> {$row.item_title}</p>
<p><strong>订单详情:</strong> {$row.detail}</p>
<p><strong>订单备注:</strong> {$row.remark}</p>
<!-- <p><strong>收款方式:</strong> {$row.receive_type == 1 ? '定金':'全款'}</p>-->
<!-- <p><strong>线上收款:</strong> {$row.online_amount}</p>-->
</div>
<form id="add-form" class="form-horizontal col-xs-12" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-4 text-left" style="text-align: left">师傅名称:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-worker_name" disabled data-rule="required" class="form-control" name="row[worker_name]" type="text">
<input id="c-worker_id" class="form-control" style="display: none" name="row[worker_id]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-4 text-left" style="text-align: left">{:__('Plan_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[plan_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-4"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
<input style="display: none" class="form-control" name="row[order_id]" type="text" value="{$row->id}">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Customer')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-customer" data-rule="required" disabled class="form-control" type="text" value="{$row.customer}">
</div>
</form>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Tel')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tel" data-rule="required" disabled class="form-control" type="number" value="{$row.tel}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
<div class='col-xs-12 col-sm-8'>
<input id="c-city" data-rule="required" class="form-control" value="{$row.area_name}" disabled type="text" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" data-rule="required" disabled value="{$row.address}" class="form-control" name="row[address]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">服务类型</label>
<div class="col-xs-12 col-sm-8">
<input id="c-item_title" data-rule="required" value="{$row.item_title}" disabled class="form-control" name="row[item_title]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Detail')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-detail" disabled rows="4" style="width: 100%;resize: vertical" class="form-control">{$row.detail}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-remark" disabled rows="4" style="width: 100%;resize: vertical" class="form-control" >{$row.remark}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Order_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_id" data-rule="required" data-field="order_no" disabled class="form-control" name="row[order_no]" type="text" value="{$row->order_no}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">师傅名称:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-worker_name" disabled data-rule="required" class="form-control" name="row[worker_name]" type="text">
<input id="c-worker_id" class="form-control" style="display: none" name="row[worker_id]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Plan_time')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[plan_time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-3"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
<input style="display: none" class="form-control" name="row[order_id]" type="text" value="{$row->id}">
</form>
</div>
<div class="col-md-8">
<div class="panel panel-default panel-intro">
@ -94,17 +58,14 @@
<input id="area_id" style="display: none" class="form-control" name="area_id" hidden type="text" value="{$row.area_id}" />
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-2" style="text-align: left;padding-left: 0px;">工种:</label>
<div style="width: 300px;display: inline-block;">
<select id="citem" data-live-search="true" title="请选择" value = "{$row.item_id}" name="item_id" class="form-control selectpicker show-tick">
<option value="0">不过滤</option>
{foreach $items as $item}
<option {if $item['id'] == $row.item_id} selected {/if} data-subtext="{$item['key_word']}" value="{$item['id']}">{$item['title']}</option>
{/foreach}
</select>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-2" style="text-align: left;padding-left: 0px;">工种:</label>
<div style="width: 300px;display: inline-block;">
<input type="text" id="item_id" name="item_id" data-value="{$row.item_title}" value="{$row.item_id}" class="zd-input__inner">
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-2" style="padding-left: 0px;text-align: left">关键字:</label>
<div style="display: inline-block;width: 300px;position: absolute">
@ -125,6 +86,7 @@
</div>
</div>
</div>
<link rel="stylesheet" href="/assets/css/select.css">
<style>
.dropdown-menu {
position: absolute;
@ -142,4 +104,7 @@
margin-left: 0;
margin-right: 0;
}
</style>
</style>
<script>
var items = {:json_encode($items); };
</script>

View File

@ -19,4 +19,5 @@ return [
'app\admin\command\Api',
'app\admin\command\AreaPinyinCommand',
'app\admin\command\ItemImportCommand',
'app\admin\command\ImportServiceItems',
];

View File

@ -629,4 +629,39 @@ class Backend extends Controller
return $res;
}
public function buildTree($data, $parentId = 0) {
$branch = [];
foreach ($data as $item) {
if ($item['pid'] == $parentId) {
$children = $this->buildTree($data, $item['id']);
if ($children) {
$item['children'] = $children;
}
$branch[] = $item;
}
}
return $branch;
}
public function formatTree($tree) {
$formattedTree = [];
foreach ($tree as $item) {
$formattedItem = [
'value' => $item['id'],
'label' => $item['title'],
];
if (isset($item['children']) && count($item['children']) > 0) {
$formattedItem['children'] = $this->formatTree($item['children']);
}
$formattedTree[] = $formattedItem;
}
return $formattedTree;
}
}

View File

@ -0,0 +1,216 @@
.zd-input {
width: 100%;
position: relative;
display: inline-block;
}
.zd-input__inner {
-webkit-appearance: none;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #606266;
display: inline-block;
font-size: inherit;
height: 30px;
line-height: 30px;
outline: none;
padding: 0 15px;
transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
width: 100%;
}
.zd-input--suffix .zd-input__inner {
padding-right: 30px;
}
.zd-input__suffix {
position: absolute;
height: 100%;
right: 5px;
top: 0;
text-align: center;
color: #c0c4cc;
transition: all .3s;
pointer-events: none;
}
.zd-input__suffix-inner {
pointer-events: all;
}
.zd-cascader-wrap .zd-input__inner {
text-overflow: ellipsis;
}
.zd-input__icon {
height: 100%;
text-align: center;
width: 25px;
font-style: normal;
font-weight: 400;
font-variant: normal;
text-transform: none;
line-height: 1;
vertical-align: baseline;
display: inline-block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.zd-input__icon.zd-icon-arrow-down {
transition: transform .3s;
font-size: 13px;
}
.zd-input__icon.zd-icon-arrow-right {
transition: transform .3s;
font-size: 13px;
transform: rotate(270deg);
}
.zd-cascader-wrap {
width: 100%;
height: 33px;
line-height: 33px;
position: relative;
display: inline-block;
font-size: 14px;
}
.zd-cascader__dropdown {
position: absolute;
top: 30px;
left: 0;
z-index: 2009;
margin: 5px 0;
margin-bottom: 12px;
font-size: 13px;
background: #fff;
border: 1px solid #e4e7ed;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
display: none;
}
.zd-cascader-panel {
display: flex;
border-radius: 4px;
font-size: 13px;
}
.zd-scrollbar {
overflow: hidden;
position: relative;
}
.zd-scrollbar__wrap {
overflow: scroll;
height: 100%;
}
.zd-cascader-menu {
min-width: 160px;
box-sizing: border-box;
color: #606266;
border-right: 1px solid #e4e7ed;
}
.zd-cascader-menu:last-child {
border-right: none;
}
.zd-cascader-menu__wrap {
margin-bottom: -17px;
margin-right: -17px;
height: 204px;
}
.zd-cascader-menu__list {
position: relative;
min-height: 100%;
margin: 0;
padding: 6px 0;
list-style: none;
box-sizing: border-box;
}
.zd-cascader-node {
position: relative;
display: flex;
align-items: center;
padding: 0 30px 0 20px;
height: 34px;
line-height: 34px;
outline: none;
}
.zd-cascader-node:not(.is-disabled) {
cursor: pointer;
}
.zd-cascader-node__label {
flex: 1;
padding: 0 10px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.zd-cascader-node__postfix {
position: absolute;
right: 10px;
}
.zd-cascader-node:not(.is-disabled):focus,
.zd-cascader-node:not(.is-disabled):hover,
.zd-cascader-node:not(.is-disabled).is-prepare {
background: #f5f7fa;
}
.zd-cascader-node.in-active-path,
.zd-cascader-node.is-active,
.zd-cascader-node.is-selectable.in-checked-path {
color: #409eff;
font-weight: 700;
}
.zd-cascader-node.in-active-path .zd-input__icon path,
.zd-cascader-node.is-active .zd-input__icon path,
.zd-cascader-node.is-selectable.in-checked-path .zd-input__icon path {
fill: #409eff;
}
.zd-cascader-wrap:not(.is-disabled):hover .zd-input__inner {
cursor: pointer;
border-color: #c0c4cc;
}
.zd-cascader-wrap.is-focus .zd-input .zd-input__inner {
border-color: #409eff;
}
.zd-cascader-wrap.is-focus .zd-input .zd-input__icon {
transform: rotate(180deg);
}
.zd-cascader-wrap.is-focus .zd-cascader__dropdown {
display: inline-block;
}
.zd-cascader-wrap:focus-within .zd-input__inner {
border-color: #409eff;
}
.is-selected-icon {
position: absolute;
left: 10px;
font-size: 13px;
}

View File

@ -11,9 +11,20 @@ define([], function () {
var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : "";
var lat = lat_id ? $("#" + lat_id).val() : '';
var lng = lng_id ? $("#" + lng_id).val() : '';
var city_code = $("#area_name").val();
var zoom = zoom_id ? $("#" + zoom_id).val() : '';
var url = "/addons/address/index/select";
url += (lat && lng) ? '?lat=' + lat + '&lng=' + lng + (input_id ? "&address=" + $("#" + input_id).val() : "") + (zoom ? "&zoom=" + zoom : "") : '';
var parmas = (lat && lng) ? '&lat=' + lat + '&lng=' + lng + (input_id ? "&address="
+ $("#" + input_id).val() : "") + (zoom ? "&zoom=" + zoom : "") : '';
url += parmas;
if (city_code){
if (parmas === ''){
url += city_code ? "?city_code=" + city_code : "";
}else {
url += city_code ? "&city_code=" + city_code : "";
}
}
console.log(url);
Fast.api.open(url, '位置选择', {
callback: function (res) {
input_id && $("#" + input_id).val(res.address).trigger("change");
@ -32,7 +43,7 @@ define([], function () {
}
});
});
});
});
if (typeof Config.upload.storage !== 'undefined' && Config.upload.storage === 'alioss') {
require(['upload'], function (Upload) {

View File

@ -147,12 +147,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
formatter: {
title: function (value, row, index) {
value = value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
var caret = row.pid === 0 ? '<i class="fa fa-caret-right"></i>' : '';
var caret = row.haschild ? '<i class="fa fa-caret-right"></i>' : '';
value = value.indexOf("&nbsp;") > -1 ? value.replace(/(.*)&nbsp;/, "$1" + caret) : caret + value;
value = row.status === 0 ? "<span class='text-muted'>" + value + "</span>" : value;
return '<a href="javascript:;" data-id="' + row.id + '" data-pid="' + row.pid + '" class="'
+ (row.pid !== 0 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + value + '</a>';
+ ((!row.haschild) ? 'text-primary' : 'disabled') + ' btn-node-sub">' + value + '</a>';
},
},
bindevent: function () {

View File

@ -1,4 +1,4 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function ($, undefined, Backend, Table, Form) {
function clearInfo() {
$('[name^="row["]').val('');
@ -62,7 +62,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
class: 'autocontent',
formatter: Table.api.formatter.content
},
{field: 'phone.model', title: __('Work_tel_id')},
{
field: 'dispatch_type',
title: '派单方式',
searchList: {
"1": '手动派单',
"2": '自动派单',
},
formatter: Table.api.formatter.label
},
{
field: 'receive_type',
title: '收款方式',
searchList: {
"1": '已收全款',
"2": '已收定金',
},
formatter: Table.api.formatter.label
},
// {field: 'worker_id', title: __('Worker_id')},
{field: 'source_shop', title: __('Source')},
// {field: 'source_uid', title: __('Source_uid'), operate: 'LIKE'},
@ -183,16 +202,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.bindevent(table);
},
add: function () {
$("#c-city").on("cp:updated", function() {
var citypicker = $(this).data("citypicker");
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
$("#area_id").val(code);
});
$("#mybuttom").on("click", function() {
Form.api.submit($("form[role=form]"));
Toastr.success('录入成功');
return false;
});
Form.api.bindevent($("form[role=form]"),function (success,ret) {
clearInfo();
Toastr.success('操作成功');
return false;
},);
Controller.api.bindevent();
},
edit: function () {
@ -203,11 +222,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"),function (success,ret) {
clearInfo();
Toastr.success('录入成功');
return false;
},);
$("#c-city").on("cp:updated", function() {
var citypicker = $(this).data("citypicker");
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
$("#area_id").val(code);
$("#area_name").val(citypicker.getVal());
});
$("[data-toggle='addresspicker']").data("callback", function(res){
Form.api.target($('#c-address'));
});
var _data = items;
$('#item_id').zdCascader({
data:_data,
onChange: function ($this,data,allPathData) {
// console.log(data,allPathData);
$('#item_id_value').val(data.value);
}
});
$('#item_id').val($('#item_id').data('value')).focus();
Form.api.bindevent($("form[role=form]"));
}
}
};

View File

@ -1,4 +1,4 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, undefined, Backend, Table, Form) {
define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer','cascader'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
@ -183,7 +183,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url +'?' + getQueryData(),
url: $.fn.bootstrapTable.defaults.extend.index_url + '?'+ getQueryData(),
pk: 'id',
sortName: 'id',
fixedColumns: true,
@ -209,7 +209,23 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
commonSearch:false,
});
function getQueryData(){
return $('#select-form').serialize();
const
area_id = $('#area_id').val(),
item_id = $('#item_id').data('myvalue'),
keyword = $('#keyword').val()
;
let res = '';
if (area_id && area_id !== ''){
res += '&area_id=' + area_id;
}
if (item_id && item_id !== ''){
res += '&item_id=' + item_id;
}
if (keyword && keyword !== ''){
res += '&keyword=' + keyword;
}
console.log(res);
return res;
}
$("#c-city-search").on("cp:updated", function() {
var citypicker = $(this).data("citypicker");
@ -218,6 +234,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
$('#area_id').val(code);
});
$("#search_btn").on("click", function() {
console.log($.fn.bootstrapTable.defaults.extend.index_url +'?' + getQueryData());
table.bootstrapTable('refresh',{
url:$.fn.bootstrapTable.defaults.extend.index_url +'?' + getQueryData(),
});
@ -225,9 +242,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
$("#reset_btn").on("click", function() {
$("#c-city-search").citypicker('reset');
$("#area_id").val('');
$("#citem").val('').selectpicker('refresh');
$("#test").val('');
$("#test").data('myvalue','');
$("#keyword").val('');
console.log(1);
table.bootstrapTable('refresh',{
url:$.fn.bootstrapTable.defaults.extend.index_url +'?' + getQueryData(),
});
@ -241,6 +258,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
$('#c-worker_id').val(worker.id).trigger('input').trigger('change');
});
var _data = items;
$(function(){
$('#item_id').zdCascader({
data:_data,
onChange: function ($this,data,allPathData) {
// console.log(data,allPathData);
$('#item_id').data('myvalue',data.value);
}
});
});
// 为表格绑定事件
Table.api.bindevent(table);

View File

@ -0,0 +1,396 @@
/**
* @author: Zhang Dong
* @version: v1.0.1
*/
;
(function ($) {
var _keyCodes = {
ESC: 27,
TAB: 9,
RETURN: 13,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
ENTER: 13,
SHIFT: 16
}
function ZdCascader(el, options) {
this.options = options;
this.CLASS = ZdCascader.CLASS;
this.$el = $(el); //input
this.$el_ = this.$el.clone();
this.init();
}
ZdCascader.CLASS = {
wrap: "zd-cascader-wrap",
inputwrap: "zd-input zd-input--suffix",
input: "zd-input__inner",
iconWrap: "zd-input__suffix",
iconInnerWrap: "zd-input__suffix-inner",
icon: "icon zd-input__icon zd-icon-arrow-down",
dropdownWrap: "zd-cascader__dropdown",
dropdownPanel: "zd-cascader-panel",
menuWrap: "zd-cascader-menu",
menuList: "zd-cascader-menu__list",
menuNode: "zd-cascader-node",
menuNodeLabel: "zd-cascader-node__label",
menuNodePostfix: "zd-cascader-node__postfix",
checkClass: {
wrapFocus: 'is-focus',
menuNodeSelected: "in-active-path",
nodeSelectedIcon: "is-selected-icon",
nodeAnchor: "is-prepare" //预备选中
}
}
ZdCascader.DEFAULTS = {
data: null, //支持格式[{value:"",label:"",children:[{value:"",label:""}]}]
range: ' / ', //分割符
onChange: function (data) {}
}
ZdCascader.METHODS = ['reload', 'destroy'];
ZdCascader.prototype.init = function () {
/*构建基础html*/
this._construct();
/*事件绑定*/
this._event();
}
//构建Cascader的html
ZdCascader.prototype._construct = function () {
var self = this;
//最外层容器
this.$container = this.$el.wrap(`<div class="${this.CLASS.wrap}"></div>`)
.wrap(`<div class="${this.CLASS.inputwrap}"></div>`).addClass(this.CLASS.input).prop('readonly', true)
.closest('.' + this.CLASS.wrap);
//文本框右侧图标
this.$arrow = $(`<span class="zd-input__suffix">
<span class="zd-input__suffix-inner">
<svg t="1600158452164" class="icon zd-input__icon zd-icon-arrow-down" viewBox="0 0 1024 1024"
version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1181" width="200" height="200">
<path
d="M538.434046 617.504916c0 3.687996-1.403976 7.356548-4.211928 10.1645-5.615904 5.615904-14.713097 5.615904-20.329001 0L364.187513 476.931297c-5.615904-5.615904-5.615904-14.713097 0-20.329001 5.615904-5.615904 14.713097-5.615904 20.329001 0l149.705604 150.739143C537.03007 610.148367 538.434046 613.817943 538.434046 617.504916z"
p-id="1182" fill="#515151"></path>
<path
d="M689.172165 466.767819c0 3.687996-1.403976 7.356548-4.211928 10.1645L534.222117 627.670439c-5.615904 5.615904-14.713097 5.615904-20.329001 0-5.615904-5.615904-5.615904-14.713097 0-20.329001L664.631236 456.603319c5.615904-5.615904 14.713097-5.615904 20.329001 0C687.768189 459.411271 689.172165 463.079824 689.172165 466.767819z"
p-id="1183" fill="#515151"></path>
</svg>
</span>
</span>`).insertAfter(this.$el);
//下拉列表
this.$dropdownWrap = $(`<div class="${this.CLASS.dropdownPanel}"></div>`).appendTo(this.$container).wrap(`<div class="${this.CLASS.dropdownWrap}"></div>`);
this.reload();
}
/*事件绑定*/
ZdCascader.prototype._event = function () {
this.$container.on('click.wrap', $.proxy(this._wrapClick, this));
this.$container.on('mousedown', $.proxy(function (event) {
this.$el.focus();
event.stopPropagation();
}, this));
$(document).on('mousedown.cascader', $.proxy(function () {
this.$container.removeClass(this.CLASS.checkClass.wrapFocus);
}, this));
this.$container.on('blur.wrap', $.proxy(function () {
this.$container.removeClass(this.CLASS.checkClass.wrapFocus);
}, this));
this.$container.on('click.item', '.' + this.CLASS.menuNode, $.proxy(this._nodeClick, this));
this.$el.on('keyup.wrap', $.proxy(this._keyup, this));
}
ZdCascader.prototype._wrapClick = function () {
event.stopPropagation();
this.$el.focus();
if (!this.$container.hasClass(this.CLASS.checkClass.wrapFocus)) {
// if (this.$dropdownWrap.children(this.CLASS.menuWrap).length === 0)
// loadFirst();
this.$container.addClass(this.CLASS.checkClass.wrapFocus);
}
this.$dropdownWrap.find('li.' + this.CLASS.checkClass.nodeAnchor).removeClass(this.CLASS
.checkClass.nodeAnchor);
this.$dropdownWrap.find(this.CLASS.menuList).eq(0).find('li.' + this.CLASS.checkClass
.menuNodeSelected).addClass(this.CLASS.checkClass.nodeAnchor);
}
ZdCascader.prototype._nodeClick = function (event) {
var $that = event.currentTarget ? $(event.currentTarget) : $(event); //li
var $wrap = $that.closest('.' + this.CLASS.menuWrap);
$that.addClass(this.CLASS.checkClass.menuNodeSelected).siblings().removeClass(this.CLASS.checkClass.menuNodeSelected);
var data = $that.data('bindData');
if (!data.children) {
$wrap.nextAll().remove();
var prevWrap = $wrap.prevAll();
var value = data.label;
var allPathData = [data];
$.each(prevWrap, (i, m) => {
var selectedData = $(m).find('li.' + this.CLASS.checkClass
.menuNodeSelected).data(
'bindData');
value = selectedData.label + this.options.range + value;
allPathData.push(selectedData);
});
this.$el.val(value).focus();
this.$container.removeClass(this.CLASS.checkClass.wrapFocus);
this.$dropdownWrap.find('.' + this.CLASS.checkClass.nodeSelectedIcon).remove();
$that.prepend($(`<span class="${this.CLASS.checkClass.nodeSelectedIcon}">√</span>`));
this.$el.data('bindData', data);
this.$el.data('bindPathData', allPathData);
if (this.options.onChange && typeof this.options.onChange === "function")
this.options.onChange(this, data, allPathData);
event.stopPropagation();
} else
this._loadChildren($that);
}
ZdCascader.prototype._loadChildren = function ($parentNode) {
this.$el.focus();
$parentNode.addClass(this.CLASS.checkClass.menuNodeSelected).siblings().removeClass(this.CLASS.checkClass.menuNodeSelected);
var $wrap = $parentNode.closest('.' + this.CLASS.menuWrap);
var data = $parentNode.data('bindData');
this.$dropdownWrap.find('li.' + this.CLASS.checkClass.nodeAnchor).removeClass(this.CLASS
.checkClass.nodeAnchor);
$parentNode.addClass(this.CLASS.checkClass.nodeAnchor);
if (!data.children) {
$wrap.nextAll().remove();
return
}
var selectedId = [];
var pathData = this.$el.data('bindPathData');
if (pathData && pathData.length > 0) {
selectedId = $.map(pathData, m => {
return m.value
});
}
var $nextWrap = $wrap.next();
if (!$nextWrap || $nextWrap.length === 0) {
$nextWrap = $(`<div class="zd-scrollbar ${this.CLASS.menuWrap}">
<div class="zd-cascader-menu__wrap zd-scrollbar__wrap">
<ul class="${this.CLASS.menuList}">
</ul>
</div>
</div>`);
$nextWrap = $nextWrap.appendTo(this.$dropdownWrap);
}
$nextWrap.nextAll().remove();
var $ul = $nextWrap.find('.' + this.CLASS.menuList).empty();
$.each(data.children, (i, m) => {
var $li = $(`<li class="${this.CLASS.menuNode}"></li>`);
var $label = $(`<span class="${this.CLASS.menuNodeLabel}">${m.label}</span>`);
var $icon = $(`<svg t="1600158452164"
class="icon zd-input__icon zd-icon-arrow-right ${this.CLASS.menuNodePostfix}"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1181"
width="200" height="200">
<path
d="M538.434046 617.504916c0 3.687996-1.403976 7.356548-4.211928 10.1645-5.615904 5.615904-14.713097 5.615904-20.329001 0L364.187513 476.931297c-5.615904-5.615904-5.615904-14.713097 0-20.329001 5.615904-5.615904 14.713097-5.615904 20.329001 0l149.705604 150.739143C537.03007 610.148367 538.434046 613.817943 538.434046 617.504916z"
p-id="1182" fill="#515151"></path>
<path
d="M689.172165 466.767819c0 3.687996-1.403976 7.356548-4.211928 10.1645L534.222117 627.670439c-5.615904 5.615904-14.713097 5.615904-20.329001 0-5.615904-5.615904-5.615904-14.713097 0-20.329001L664.631236 456.603319c5.615904-5.615904 14.713097-5.615904 20.329001 0C687.768189 459.411271 689.172165 463.079824 689.172165 466.767819z"
p-id="1183" fill="#515151"></path>
</svg>`);
$li.append($label).data('bindData', m);
if (m.children && m.children.length > 0) $li.append($icon);
else if (selectedId.indexOf(m.value) >= 0) {
this.$dropdownWrap.find('.' + this.CLASS.checkClass.nodeSelectedIcon).remove();
$li.addClass(this.CLASS.checkClass.menuNodeSelected).prepend($(
`<span class="${this.CLASS.checkClass.nodeSelectedIcon}">√</span>`));
}
$li.appendTo($ul);
});
}
//销毁
ZdCascader.prototype.destroy = function () {
$(this.$el).insertAfter(this.$el_);
this.$el.remove();
}
//重新加载下拉数据
ZdCascader.prototype.reload = function (data) {
data = data || this.options.data;
this.$el.val('').removeData('bindData').removeData('bindPathData');
this.$dropdownWrap.empty();
var selectedData = this.$el.data('bindData');
var $firstWrap = $(`<div class="zd-scrollbar ${this.CLASS.menuWrap}">
<div class="zd-cascader-menu__wrap zd-scrollbar__wrap">
<ul class="${this.CLASS.menuList}">
</ul>
</div>
</div>`);
var $ul = $firstWrap.find('.' + this.CLASS.menuList);
$.each(data, (i, m) => {
var $li = $(`<li class="${this.CLASS.menuNode}"></li>`);
var $label = $(`<span class="${this.CLASS.menuNodeLabel}">${m.label}</span>`);
var $icon = $(`<svg t="1600158452164"
class="icon zd-input__icon zd-icon-arrow-right ${this.CLASS.menuNodePostfix}"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1181"
width="200" height="200">
<path
d="M538.434046 617.504916c0 3.687996-1.403976 7.356548-4.211928 10.1645-5.615904 5.615904-14.713097 5.615904-20.329001 0L364.187513 476.931297c-5.615904-5.615904-5.615904-14.713097 0-20.329001 5.615904-5.615904 14.713097-5.615904 20.329001 0l149.705604 150.739143C537.03007 610.148367 538.434046 613.817943 538.434046 617.504916z"
p-id="1182" fill="#515151"></path>
<path
d="M689.172165 466.767819c0 3.687996-1.403976 7.356548-4.211928 10.1645L534.222117 627.670439c-5.615904 5.615904-14.713097 5.615904-20.329001 0-5.615904-5.615904-5.615904-14.713097 0-20.329001L664.631236 456.603319c5.615904-5.615904 14.713097-5.615904 20.329001 0C687.768189 459.411271 689.172165 463.079824 689.172165 466.767819z"
p-id="1183" fill="#515151"></path>
</svg>`);
$li.append($label).data('bindData', m);
if (m.children && m.children.length > 0) $li.append($icon);
else if (selectedData && m.value == selectedData.value) {
this.$dropdownWrap.find('.' + this.CLASS.checkClass.nodeSelectedIcon).remove();
$li.prepend($(`<span class="${this.CLASS.checkClass.nodeSelectedIcon}">√</span>`));
}
$ul.append($li);
});
this.$dropdownWrap.find('li.' + this.CLASS.checkClass.nodeAnchor).removeClass(this.CLASS.checkClass.nodeAnchor);
this.$dropdownWrap.append($firstWrap).find(this.CLASS.menuNode).eq(0).focus().addClass(this.CLASS.checkClass
.nodeAnchor);
}
ZdCascader.prototype._keyup = function (event) {
var keycode = event.which;
switch (keycode) {
case _keyCodes.DOWN:
this._movedown();
break;
case _keyCodes.UP:
this._moveup();
break;
case _keyCodes.LEFT:
this._moveleft();
break;
case _keyCodes.RIGHT:
this._moveright();
break;
case _keyCodes.ENTER:
this._keyenter();
break;
case _keyCodes.ESC:
this._keyesc();
break;
default:
break;
}
}
ZdCascader.prototype._movedown = function () {
var $selected;
if (!this.$container.hasClass(this.CLASS.checkClass.wrapFocus)) {
this.$container.trigger('click');
return
}
$selected = this.$dropdownWrap.find('.' + this.CLASS.menuNode + '.' + this.CLASS
.checkClass
.nodeAnchor);
if ($selected.length === 0)
$selected = this.$dropdownWrap.find('.' + this.CLASS.menuWrap).eq(0).find('.' + this.CLASS
.menuNode).eq(0)
.addClass(
this.CLASS.checkClass.nodeAnchor);
else if ($selected.next().length > 0)
$selected = $selected.removeClass(this.CLASS.checkClass.nodeAnchor).next()
.addClass(
this.CLASS
.checkClass.nodeAnchor);
this._loadChildren($selected);
}
ZdCascader.prototype._moveup = function () {
if (!this.$container.hasClass(this.CLASS.checkClass.wrapFocus)) return;
var $selected = this.$dropdownWrap.find('.' + this.CLASS.menuNode + '.' + this.CLASS
.checkClass.nodeAnchor);
if ($selected.length === 0) return;
if ($selected.prev().length > 0)
$selected = $selected.removeClass(this.CLASS.checkClass.nodeAnchor).prev()
.addClass(
this.CLASS
.checkClass.nodeAnchor);
this._loadChildren($selected);
}
ZdCascader.prototype._moveleft = function () {
if (!this.$container.hasClass(this.CLASS.checkClass.wrapFocus)) return;
var $selected = this.$dropdownWrap.find('.' + this.CLASS.menuNode + '.' + this.CLASS
.checkClass.nodeAnchor);
if ($selected.length === 0) return;
var $leftWrap = $selected.closest('.' + this.CLASS.menuWrap).prev();
if ($leftWrap.length === 0) return;
$selected.removeClass(this.CLASS.checkClass.nodeAnchor);
$selected = $leftWrap.find('li.' + this.CLASS.checkClass.menuNodeSelected)
.length > 0 ?
$leftWrap.find('li.' + this.CLASS.checkClass.menuNodeSelected).eq(0) :
$leftWrap.find('li' + this.CLASS.menuNode).eq(0);
$selected.addClass(this.CLASS.checkClass.nodeAnchor);
this._loadChildren($selected);
}
ZdCascader.prototype._moveright = function () {
if (!this.$container.hasClass(this.CLASS.checkClass.wrapFocus)) return;
var $selected = this.$dropdownWrap.find('.' + this.CLASS.menuNode + '.' + this.CLASS
.checkClass.nodeAnchor);
if ($selected.length === 0) return;
var $rightWrap = $selected.closest('.' + this.CLASS.menuWrap).next();
if ($rightWrap.length === 0) return;
$selected.removeClass(this.CLASS.checkClass.nodeAnchor);
$selected = $rightWrap.find('li.' + this.CLASS.menuNode).eq(0).addClass(
this.CLASS.checkClass
.nodeAnchor);
this._loadChildren($selected);
}
ZdCascader.prototype._keyenter = function () {
if (!this.$container.hasClass(this.CLASS.checkClass.wrapFocus)) return;
var $selected = this.$dropdownWrap.find('.' + this.CLASS.menuNode + '.' + this.CLASS
.checkClass.nodeAnchor);
if ($selected.length === 0) return;
var $rightWrap = $selected.closest('.' + this.CLASS.menuWrap).next();
if ($rightWrap.length !== 0) return;
$selected.trigger('click');
}
ZdCascader.prototype._keyesc = function () {
if (!this.$container.hasClass(this.CLASS.checkClass.wrapFocus)) return;
this.$container.removeClass(this.CLASS.checkClass.wrapFocus);
this.$el.focus();
}
$.fn.zdCascader = function (option) {
var value,
args = Array.prototype.slice.call(arguments, 1);
this.each(function () {
var $this = $(this),
data = $this.data('zdCascader'),
options = $.extend({}, ZdCascader.DEFAULTS, $this.data(),
typeof option === 'object' && option);
if (typeof option === 'string') {
if ($.inArray(option, ZdCascader.METHODS) < 0) {
throw new Error("Unknown method: " + option);
}
if (!data) {
return;
}
value = data[option].apply(data, args);
if (option === 'destroy') {
$this.removeData('zdCascader');
}
}
if (!data) {
$this.data('zdCascader', (data = new ZdCascader(this, options)));
}
});
return typeof value === 'undefined' ? this : value;
};
})(jQuery);

17400
public/assets/js/require-backend.min.js vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

View File

@ -670,6 +670,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio
}
});
}
console.log(multipleList,params);
//调用Ajax请求方法
Fast.api.ajax({
type: type,