diff --git a/addons/address/config.php b/addons/address/config.php index 96ab16a..6bf5e5e 100644 --- a/addons/address/config.php +++ b/addons/address/config.php @@ -70,7 +70,7 @@ return [ 'title' => '高德地图KEY', 'type' => 'string', 'content' => [], - 'value' => 'dd4e8434697466586aaac37167abfb52', + 'value' => 'cc6b0958c512ac08b0aa884f9b64d553', 'rule' => '', 'msg' => '', 'tip' => '', @@ -82,7 +82,7 @@ return [ 'title' => '高德地图安全密钥', 'type' => 'string', 'content' => [], - 'value' => '38b7b7a5e4b90dcb1aa4999826d4e9d1', + 'value' => 'a2ac54e925b448f8884e35ead370c12d', 'rule' => '', 'msg' => '', 'tip' => '', diff --git a/addons/address/controller/Index.php b/addons/address/controller/Index.php index 9917665..aa11953 100644 --- a/addons/address/controller/Index.php +++ b/addons/address/controller/Index.php @@ -44,8 +44,8 @@ class Index extends Controller { $config = get_addon_config('address'); $zoom = (int)$this->request->get('zoom', $config['zoom']); - $lng = (float)$this->request->get('lng'); - $lat = (float)$this->request->get('lat'); + $lng = $this->request->get('lng'); + $lat = $this->request->get('lat'); $address = $this->request->get('address'); $city_code = $this->request->get('city_code'); $lng = $lng ?: $config['lng']; diff --git a/addons/address/view/index/amap.html b/addons/address/view/index/amap.html index 7ec88cb..0f9b1fa 100644 --- a/addons/address/view/index/amap.html +++ b/addons/address/view/index/amap.html @@ -111,7 +111,7 @@ var center = [lng,lat] //加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分 - console.log(center) + // console.log(center) map = new AMap.Map('container', { zoom: parseInt('{$zoom}'), center: center @@ -121,15 +121,15 @@ radius: 1000, //范围,默认:500, }); if (city_code){ - // console.log(111,city_code); + // // console.log(111,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); - console.log(result.geocodes[0],2222); + // console.log(result.geocodes[0],2222,result); } else { - console.log(result) + // console.log(result) } }); } @@ -147,6 +147,7 @@ lat = lnglat.lat; map.panTo([lng, lat]); positionPicker.start(lnglat); + // console.log(lnglat,addr) if (addr) { // var label = '
地址:' + addr + '
经度:' + lng + '
纬度:' + lat + '
'; var label = '
地址:' + addr + '
'; @@ -159,11 +160,12 @@ var address = result.regeocode.formattedAddress; // var label = '
地址:' + address + '
经度:' + lng + '
纬度:' + lat + '
'; var label = '
地址:' + address + '
'; + city_code = result.regeocode.addressComponent.adcode positionPicker.marker.setLabel({ content: label //显示内容 }); } else { - console.log(JSON.stringify(result)); + // console.log(JSON.stringify(result)); } }); } @@ -211,7 +213,7 @@ }); positionPicker.on('success', function (positionResult) { - console.log(positionResult); + // console.log(positionResult); as = positionResult.position; address = positionResult.address; lat = as.lat; @@ -260,12 +262,13 @@ //点击搜索按钮 $(document).on('click', '.confirm', function () { var zoom = map.getZoom(); - var data = {lat: lat, lng: lng, zoom: zoom, address: address}; + // console.log(map) + var data = {lat: lat, lng: lng, zoom: zoom, address: address,city_code:city_code}; if (fromtype !== totype) { var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]); data.lng = (result[0] || data.lng).toFixed(5); data.lat = (result[1] || data.lat).toFixed(5); - console.log(data, result, fromtype, totype); + // console.log(data, result, fromtype, totype); } close(data); }); diff --git a/application/admin/addresmart/Address.php b/application/admin/addresmart/Address.php index 7ecbfb4..2e15427 100644 --- a/application/admin/addresmart/Address.php +++ b/application/admin/addresmart/Address.php @@ -18,11 +18,12 @@ class Address $name_items [] = $item->title; $name_items_map [$item->title] = $item->id; } - $type = self::findMostSimilar($string,$name_items); - $type_arr = explode('__',$type); - $type = $type_arr[0] ?? ''; - $str = $type_arr[1] ?? ''; - $string = str_replace($str,'',$string); + + $titles = Item::where('status',1)->column('title'); + $type = self::extractServiceTypes($string,$titles)[0] ?? ''; + + + $string = str_replace($type,'',$string); if ($user) { $decompose = self::decompose($string); $re = $decompose; @@ -34,9 +35,9 @@ class Address $fuzz = self::fuzz($re['addr']); $parse = self::parse($fuzz['a1'], $fuzz['a2'], $fuzz['a3']); - $re['province'] = $parse['province']; - $re['city'] = $parse['city']; - $re['region'] = $parse['region']; + $re['province'] = $parse['province'] ?? ''; + $re['city'] = $parse['city'] ?? ''; + $re['region'] = $parse['region'] ?? ''; $re['item'] = [ 'id'=> $name_items_map[$type] ?? 0, 'item' => $type ?? '' @@ -305,4 +306,38 @@ class Address return $r; } + + + /** + * 从聊天内容中提取匹配的服务类型 + * + * @param string $chatText 聊天内容 + * @param array $serviceTypes 服务类型数组 + * @param bool $returnAll 是否返回全部匹配,false 时只返回第一个匹配 + * @return array|string|null 匹配的服务类型(数组或单个字符串) + */ + static function extractServiceTypes(string $chatText, array $serviceTypes, bool $returnAll = true): array|string|null + { + // 去重 + 去空 + $cleaned = array_filter(array_map('trim', $serviceTypes)); + + // 优先匹配更长的词 + usort($cleaned, fn($a, $b) => mb_strlen($b, 'UTF-8') - mb_strlen($a, 'UTF-8')); + + $matched = []; + + foreach ($cleaned as $service) { + if (mb_stripos($chatText, $service) !== false) { + if ($returnAll) { + $matched[] = $service; + } else { + return $service; + } + } + } + + return $returnAll ? $matched : null; + } + + } diff --git a/application/admin/command/Test.php b/application/admin/command/Test.php index ef5fc4e..df65a22 100644 --- a/application/admin/command/Test.php +++ b/application/admin/command/Test.php @@ -11,6 +11,7 @@ use app\admin\model\OrderDispatch; use app\admin\model\OrderReview; use app\admin\model\Worker; use app\admin\model\WorkerItem; +use app\admin\controller\AmapTrait; use think\Collection; use think\console\Command; use think\console\Input; @@ -24,7 +25,7 @@ use function Symfony\Component\Clock\now; class Test extends Command { - + use AmapTrait; protected function configure() { @@ -34,38 +35,9 @@ class Test extends Command protected function execute(Input $input, Output $output) { - dd(config('system_id')); - - $order = Order::where('id',140)->find(); - AutoDispatchLogic::autoDispatch($order); - - - $hookParams = [ - 'dispatch' => (new OrderDispatch())->where('id', 144)->find(), - 'remark' => '系统自动派单给师傅:'. '时间嗯' .'('.'12312'.')', - ]; - - Lang::load(APP_PATH . 'admin/lang/zh-cn/orders/dispatch2.php'); - - $Model = new \app\admin\model\OrderDispatch(); - $statusList = $Model->getStatusList(); - $dispatch = $hookParams['dispatch']; //订单对象 - $remark = $hookParams['remark'] ?? ''; //备注 - $data = [ - 'dispatch_id' => $dispatch->id, - 'order_id' => $dispatch->order_id, - 'worker_id' => $dispatch->worker_id, - 'status' => $dispatch->status, - 'status_text' => $statusList[$dispatch->status], - 'remark' => $remark, - 'admin_user' => $dispatch->admin_user??'sys', - ]; - dd($data); - - + $key = 'ae0ab397a2febfa1ce0a2c780f3f23a3'; + $res = $this->getAddressByKeyword('重庆武隆区凤山街道锦江竹苑6幢31-4'); dd($res); - - } diff --git a/application/admin/controller/AmapTrait.php b/application/admin/controller/AmapTrait.php new file mode 100644 index 0000000..41cfa89 --- /dev/null +++ b/application/admin/controller/AmapTrait.php @@ -0,0 +1,49 @@ +amapKey = Env::get('amap_key'); + $url = 'https://restapi.amap.com/v5/place/text'; + $params = [ + 'key' => $this->amapKey, + 'keywords' => $keyword, + 'page_size' => 1, + ]; + + try { + $response = Http::get($url, $params); + $data = json_decode($response, true); +// dd($data); + if (isset($data['status']) && $data['status'] == '1') { + return $data['pois']['0'] ?? false; + } + } catch (\Exception $e) { + throw $e; + // 这里可以做日志记录 + } + return false; + } + + /** + * 还可以封装更多高德API调用方法 + */ +} diff --git a/application/admin/controller/AutoDispatchLogic.php b/application/admin/controller/AutoDispatchLogic.php index 02283fe..cef084f 100644 --- a/application/admin/controller/AutoDispatchLogic.php +++ b/application/admin/controller/AutoDispatchLogic.php @@ -34,7 +34,7 @@ class AutoDispatchLogic 'order_id' => $order->id, 'type' => 2, 'worker_id' => $worker_id, - 'plan_time' => $order->plan_time, + 'plan_time' => $order->plan_time ?? null, 'is_receipt' => $order->receive_type == 1, ]; diff --git a/application/admin/controller/CustomerInfoExtractor.php b/application/admin/controller/CustomerInfoExtractor.php new file mode 100644 index 0000000..3329cf1 --- /dev/null +++ b/application/admin/controller/CustomerInfoExtractor.php @@ -0,0 +1,91 @@ + $this->extractNickname($chatText), + 'city' => $this->extractCity($chatText), + 'district' => $this->extractDistrict($chatText), + 'address' => $this->extractAddress($chatText), + 'phone' => $this->extractPhone($chatText), + 'remark' => $this->extractRemark($chatText), + 'services' => $this->extractServices($chatText, $serviceTypes), + ]; + } + + protected function extractNickname(string $text): ?string + { + if (preg_match('/^(.*?)\s*-->/u', $text, $match)) { + return trim($match[1]); + } + return null; + } + + protected function extractCity(string $text): ?string + { + if (preg_match('/(北京|上海|广州|深圳|武汉|成都|重庆|杭州|南京|天津|西安|苏州|郑州|长沙|青岛|合肥|福州|厦门|南昌|昆明|大连|宁波|无锡|哈尔滨|长春|石家庄|南宁|贵阳|兰州|呼和浩特|乌鲁木齐)/u', $text, $match)) { + return $match[1]; + } + return null; + } + + protected function extractDistrict(string $text): ?string + { + if (preg_match('/([\p{Han}]{1,10}区)/u', $text, $match)) { + return $match[1]; + } + return null; + } + + protected function extractAddress(string $text): ?string + { + if (preg_match('/(湖北省|四川省|北京市|上海市|重庆市|[\p{Han}]+省)?[\p{Han}]+市\s*[\p{Han}]+区.*?(\d+栋.*?室)/u', $text, $match)) { + return $match[0]; + } + return null; + } + + protected function extractPhone(string $text): ?string + { + if (preg_match('/1[3-9]\d{9}/', $text, $match)) { + return $match[0]; + } + return null; + } + + protected function extractRemark(string $text): ?string + { + if (preg_match_all('/https?:\/\/[^\s]+/i', $text, $matches)) { + return implode(', ', $matches[0]); + } + + // 其他软件/售后/推广语也可加关键词检测 + if (str_contains($text, '软件下载') || str_contains($text, '自动发货')) { + return '可能包含软件下载或推广信息'; + } + + return null; + } + + protected function extractServices(string $text, array $serviceTypes): array + { + $cleaned = array_filter(array_map('trim', $serviceTypes)); + usort($cleaned, fn($a, $b) => mb_strlen($b, 'UTF-8') - mb_strlen($a, 'UTF-8')); + + $matched = []; + foreach ($cleaned as $service) { + if (mb_stripos($text, $service) !== false) { + $matched[] = $service; + } + } + return $matched; + } +} \ No newline at end of file diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index e81ec9e..e521b5b 100644 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -5,6 +5,7 @@ namespace app\admin\controller; use app\admin\addresmart\Address; use app\admin\controller\orders\DispatchLogic; use app\admin\model\Admin; +use app\admin\model\Item; use app\admin\model\Message; use app\admin\model\order\Invoice; use app\admin\model\OrderDispatch; @@ -30,6 +31,7 @@ use function Symfony\Component\Clock\now; */ class Order extends Backend { + use CustomerInfoExtractor; /** * Order模型对象 * @var \app\admin\model\Order @@ -39,6 +41,8 @@ class Order extends Backend protected $items = null; protected $itemsformattedTree = null; + protected $noNeedRight = ['smart']; + public function _initialize() { parent::_initialize(); @@ -142,6 +146,8 @@ class Order extends Backend 'receive_type', 'plan_time', 'coupon_id', + 'total', + 'online_amount', 'aftersale_id' ]) ->where($where); @@ -204,11 +210,21 @@ class Order extends Backend public function add() { - if (false === $this->request->isPost()) { return $this->view->fetch(); } $params = $this->request->post('row/a'); + + // 数据验证 + $validate = $this->validate($params, \app\admin\validate\Order::class . '.add'); + if ($validate !== true) { + $this->error($validate); + } + + if (!$params['set_time']) { + $params['plan_time'] = ''; + } + $params = array_filter($params, function ($val) { return $val != ''; }); @@ -244,12 +260,12 @@ class Order extends Backend $params['admin_id'] = $this->auth->id; } $params['status'] = 10; + $params['total'] = $params['online_amount'] ?? 0; $params['order_no'] = $this->generateOrderNumber(); $params['create_time'] = date('Y-m-d H:i:s'); $params['update_time'] = date('Y-m-d H:i:s'); $result = $this->model->allowField(true)->save($params); - if ($params['dispatch_type'] == 2) { AutoDispatchLogic::autoDispatch($this->model, $this->auth); } @@ -261,7 +277,7 @@ class Order extends Backend if ($result === false) { $this->error(__('No rows were inserted')); } - $this->success(); + $this->success(data:$this->model); } public function edit($ids = null) @@ -288,6 +304,20 @@ class Order extends Backend if (request()->isPost()) { // 获取表单提交的数据 $params = input('post.row/a'); + + // 数据验证 + $validate = $this->validate($params, \app\admin\validate\Order::class . '.edit'); + if ($validate !== true) { + $this->error($validate); + } + + if (!$params['set_time']) { + $params['plan_time'] = null; + } + + //移除无用字段:是否设置上门时间 + unset($params['set_time']); + $params['update_time'] = date('Y-m-d H:i:s'); $sources = $this->sources; $sources = array_column($sources, 'title', 'id'); @@ -295,7 +325,6 @@ class Order extends Backend $params['source_shop'] = $sources[$params['source']] ?? null; $sources = $this->sources; - $items = $this->items; $sources = array_column($sources, 'title', 'id'); @@ -316,7 +345,7 @@ class Order extends Backend } $area = new \app\admin\model\Area(); $area_name = $area->getNameByCode($order->area_id); - $order->area_name = str_replace(',', '/', $area_name); + $order->area_name = str_replace(',', '/', $area_name ?? ''); // dd($area_name); // 将订单数据传递到视图 $this->assign('row', $order); @@ -350,23 +379,48 @@ class Order extends Backend return $this->fetch(); } - function generateOrderNumber($prefix = 'ORD') + function generateOrderNumber($prefix = '') { // 获取当前时间戳(精确到毫秒) $timestamp = microtime(true); $date = date('YmdHis', (int)$timestamp); // 格式:YYYYMMDDHHMMSS - $randomNum = strtoupper(substr(md5($timestamp), 0, 4)); // 从时间戳生成一个随机字符串,取前四个字符 - +// $randomNum = strtoupper(substr(md5($timestamp), 0, 4)); // 从时间戳生成一个随机字符串,取前四个字符 + $code = str_pad(mt_rand(0, 999999), 6, '0', STR_PAD_LEFT); // 组合生成的订单编号 - $orderNumber = $prefix . $date . $randomNum; + $orderNumber = $prefix . $date . $code; return $orderNumber; } - + use AmapTrait; public function smart() { - $this->success(data: Address::smart(request()->get('str'))); +// $titles = Item::where('status',1)->column('title'); +// $res = $this->extractCustomerInfo(request()->post('str'),$titles); +// dd($res); + $data = Address::smart(request()->post('str')); + + if ($data['item']['id'] ?? 0){ + $data['item']['item'] = $this->findElementByValue($this->itemsformattedTree, $data['item']['id'] ?? null); + } + preg_match('/\b(1[3-9]\d{9})\b/',$data['mobile'],$match); + $data['mobile'] = $match[0] ?? $data['mobile']; + + if ($data['addr'] && $data['addr']!=''){ + $address = $this->getAddressByKeyword($data['addr']); + if ($address){ + $data['area_id'] = $address['adcode']; + $location = explode(',',$address['location']); + $data['lng'] = $location[0]; + $data['lat'] = $location[1]; + }else{ + $data['addr'] =''; + } + } +// dd($data); + + + $this->success(data: $data); } diff --git a/application/admin/validate/Order.php b/application/admin/validate/Order.php index e0565c2..e4286fa 100644 --- a/application/admin/validate/Order.php +++ b/application/admin/validate/Order.php @@ -10,18 +10,68 @@ class Order extends Validate * 验证规则 */ protected $rule = [ + 'source' => 'require', + 'item_id' => 'require', + 'customer' => 'require|max:32', + 'tel' => 'require|number|max:32|regex:/^1[3-9]\d{9}$/', + 'area_id' => 'require', + 'address' => 'require|max:255', + 'lng' => 'require', + 'lat' => 'require', + 'online_amount|收款金额' => 'require|number|between:0.01,10000000', + 'plan_time|上门时间' => 'requireIf:set_time,1|date' ]; /** * 提示消息 */ protected $message = [ + 'source.require' => '请选择订单渠道', + 'item_id.require' => '请选择服务项目', + + 'customer.require' => '请输入客户昵称', + 'customer.max' => '客户昵称不能超过 32 个字符', + + 'tel.require' => '请输入客户电话', + 'tel.regex' => '电话号码格式不正确', + 'area_id.require' => '请选择地区', + + 'address.require' => '请选择详细地址', + 'address.max' => '详细地址不能超过 255 个字符', + + 'lng.require' => '请选择详细地址', + 'lat.require' => '请选择详细地址', + + 'online_amount.require' => '请输入收款金额', + 'online_amount.number' => '收款金额不正确', ]; /** * 验证场景 */ protected $scene = [ - 'add' => [], - 'edit' => [], + 'add' => [ + 'source', + 'item_id', + 'customer', + 'tel', + 'area_id', + 'address', + 'lng', + 'lat', + 'online_amount', + 'plan_time', + ], + 'edit' => [ + 'source', + 'item_id', + 'customer', + 'tel', + 'area_id', + 'address', + 'lng', + 'lat', + 'online_amount', + 'plan_time', + ], ]; - + } diff --git a/application/admin/view/order/add.html b/application/admin/view/order/add.html index 2644c32..57b8f9b 100644 --- a/application/admin/view/order/add.html +++ b/application/admin/view/order/add.html @@ -1,283 +1,270 @@ - -
-
-
- -
-
-
-
-
-
- -
- -
-
-
- -
- -
-
- - -
- -
- - -
-
-
- -
-
- -
地图查找
-
- - - -
-
- -
- -
- - - -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
-
- -
- - -
- -
-
    -
    -
    -
    - -
    - -
    - -
    - -
    -
    - - - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - - - -
    - -
    - -
    -
    -
    - -
    - -
    -
    - -
    - -
    - - -
    -
    - - -
    - -
    -
    快速输入:
    -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    +
    +
    +
    +
    + +
    +
    +
    *订单渠道:
    +
    + +
    +
    +
    *服务项目:
    +
    + + +
    +
    +
    +
    +
    +
    *客户昵称:
    +
    + +
    +
    +
    +
    *客户电话:
    +
    + +
    +
    +
    + +
    +
    +
    *详细地址:
    +
    +
    地图查找
    +
    +
    +
    + +
      + + + +
      +
      +
      +
      +
      收款方式:
      +
      + +
      +
      +
      +
      *收款金额:
      +
      + +
      +
      +
      +
      +
      +
      优惠:
      +
      + +
      +
      +
      + +
      +
      +
      上门时间:
      +
      + {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'])} +
      +
      +
      +
      *设置时间:
      +
      + +
      +
      +
      +
      +
      +
      订单备注:
      +
      +
      + +
      +
      +
      +
      +
      录单员:
      +
      + +
      +
      +
      +
      +
      图片上传:
      +
      +
      + +
      + + +
      + +
      +
        +
        +
        +
        +
        +
        +
        快速录入:
        +
        +
        +
        +
        + +
        +
        +
        +
        + + 智能识别 +
        +
        +
        +
        + + +
        +
        +
        + - - \ No newline at end of file + var items = {:json_encode($items); }; + window.addEventListener('DOMContentLoaded', function () { + setTimeout(function () { + const container = document.querySelector('.body-hidden'); + if (container) { + container.classList.remove('body-hidden'); + container.classList.add('body-shown'); + } + }, 500); + }); + + + + + + + + + + + + + + + + diff --git a/application/admin/view/order/copy.html b/application/admin/view/order/copy.html index b6268f4..c985983 100644 --- a/application/admin/view/order/copy.html +++ b/application/admin/view/order/copy.html @@ -1,266 +1,247 @@ - -
        -
        -
        - -
        -
        -
        -
        -
        -
        - -
        - -
        -
        -
        - -
        - -
        -
        - -
        - -
        - - -
        -
        -
        - -
        -
        - -
        地图查找
        -
        - - - -
        -
        - -
        - -
        - - -
        -
        - -
        - -
        - -
        -
        - -
        - -
        - -
        -
        - -
        - -
        -
        - -
        - - -
        - -
        -
          -
          -
          - -
          - - -
          -
          - -
          - -
          -
          - - - -
          - -
          - -
          -
          - - -
          - -
          - -
          -
          - - -
          - -
          - -
          -
          - -
          - -
          - -
          -
          - - - - - -
          - -
          - -
          -
          - - -
          - -
          - -
          -
          - -
          - -
          - -
          -
          - - - -
          - - - -
          -
          +
          +
          +
          +
          + +
          +
          +
          *订单渠道:
          +
          +
          +
          +
          +
          *服务项目:
          +
          + + +
          +
          +
          +
          +
          *客户昵称:
          +
          + +
          +
          +
          +
          *客户电话:
          +
          + +
          +
          +
          + +
          +
          +
          *详细地址:
          +
          +
          地图查找
          +
          +
          +
          + +
            + + + +
            +
            +
            +
            +
            收款方式:
            +
            + +
            +
            +
            +
            *收款金额:
            +
            + +
            +
            +
            +
            +
            +
            优惠:
            +
            + +
            +
            +
            + +
            +
            +
            上门时间:
            +
            + {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'], $row.plan_time === '' || $row.plan_time === null ? 0 : 1)} +
            +
            +
            +
            *设置时间:
            +
            + +
            +
            +
            +
            +
            +
            订单备注:
            +
            +
            + +
            +
            +
            +
            +
            录单员:
            +
            + +
            +
            +
            + +
            +
            图片上传:
            +
            +
            + +
            + + +
            + +
            +
              +
              +
              +
              + +
              - + + - - - \ No newline at end of file + + + + + + + + + + + + + + diff --git a/application/admin/view/order/edit.html b/application/admin/view/order/edit.html index 1df3deb..9864556 100644 --- a/application/admin/view/order/edit.html +++ b/application/admin/view/order/edit.html @@ -1,262 +1,246 @@ - -
              -
              -
              - -
              -
              -
              -
              -
              -
              - -
              - -
              -
              -
              - -
              - -
              -
              - -
              - -
              - - -
              -
              -
              - -
              -
              - -
              地图查找
              -
              - - - -
              -
              - -
              - -
              - - -
              -
              - -
              - -
              - -
              -
              - -
              - -
              - -
              -
              - -
              - -
              -
              - -
              - - -
              - -
              -
                -
                -
                - -
                - - -
                -
                - -
                - -
                -
                - - - -
                - -
                - -
                -
                - - -
                - -
                - -
                -
                - - -
                - -
                - -
                -
                - -
                - -
                - -
                -
                - -
                - -
                - -
                -
                - - -
                - -
                - -
                -
                - -
                - -
                - -
                -
                - - - -
                - - - -
                -
                +
                +
                +
                +
                +
                +
                +
                *订单渠道:
                +
                +
                +
                +
                +
                *服务项目:
                +
                + + +
                +
                +
                +
                +
                *客户昵称:
                +
                + +
                +
                +
                +
                *客户电话:
                +
                + +
                +
                +
                + +
                +
                +
                *详细地址:
                +
                +
                地图查找
                +
                +
                +
                + +
                  + + + +
                  +
                  +
                  +
                  +
                  收款方式:
                  +
                  + +
                  +
                  +
                  +
                  *收款金额:
                  +
                  + +
                  +
                  +
                  +
                  +
                  +
                  优惠:
                  +
                  + +
                  +
                  +
                  + +
                  +
                  +
                  上门时间:
                  +
                  + {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'], $row.plan_time === '' || $row.plan_time === null ? 0 : 1)} +
                  +
                  +
                  +
                  *设置时间:
                  +
                  + +
                  +
                  +
                  +
                  +
                  +
                  订单备注:
                  +
                  +
                  + +
                  +
                  +
                  +
                  +
                  录单员:
                  +
                  + +
                  +
                  +
                  + +
                  +
                  图片上传:
                  +
                  +
                  + +
                  + + +
                  + +
                  +
                    +
                    +
                    +
                    + +
                    - + + - - - \ No newline at end of file + + + + + + + + + + + + + + diff --git a/application/extra/site.php b/application/extra/site.php deleted file mode 100755 index 7df4673..0000000 --- a/application/extra/site.php +++ /dev/null @@ -1,46 +0,0 @@ - '神帝', - 'beian' => '2', - 'cdnurl' => '', - 'version' => '1.0.2', - 'timezone' => 'Asia/Shanghai', - 'forbiddenip' => '', - 'languages' => - array ( - 'backend' => 'zh-cn', - 'frontend' => 'zh-cn', - ), - 'fixedpage' => 'dashboard', - 'categorytype' => - array ( - 'default' => 'Default', - 'page' => 'Page', - 'article' => 'Article', - 'test' => 'Test', - ), - 'configgroup' => - array ( - 'basic' => 'Basic', - 'email' => 'Email', - 'dictionary' => 'Dictionary', - 'user' => 'User', - 'example' => 'Example', - ), - 'mail_type' => '1', - 'mail_smtp_host' => 'smtp.qq.com', - 'mail_smtp_port' => '465', - 'mail_smtp_user' => '', - 'mail_smtp_pass' => '', - 'mail_verify_type' => '2', - 'mail_from' => '', - 'attachmentcategory' => - array ( - 'category1' => 'Category1', - 'category2' => 'Category2', - 'custom' => 'Custom', - ), - 'ip_check' => '0', - 'allowip' => '', -); diff --git a/application/services/OrderDispatchService.php b/application/services/OrderDispatchService.php index 300c2d4..ecac62f 100644 --- a/application/services/OrderDispatchService.php +++ b/application/services/OrderDispatchService.php @@ -402,6 +402,7 @@ class OrderDispatchService extends BaseService $order->is_material_used = $params['is_material_used']; if ($order->is_material_used == 1) { // 材料成本 + $orderDispatch->material_cost = $params['material_cost']; $order->material_cost = $params['material_cost']; // 材料凭证图片组 $order->material_images = $this->removeStrCdnUrl($params['material_images']); diff --git a/public/assets/css/create-order.css b/public/assets/css/create-order.css new file mode 100644 index 0000000..df7b9d2 --- /dev/null +++ b/public/assets/css/create-order.css @@ -0,0 +1,226 @@ +.body-hidden { + visibility: hidden; + opacity: 0; +} + +.body-shown { + visibility: visible; + opacity: 1; + transition: opacity 0.3s ease; +} + +.flex-c { + display: flex; + justify-content: center; + align-items: center; +} + +.flex-r { + display: flex; + justify-content: flex-end; + align-items: center; +} + +.flex-l { + display: flex; + justify-content: flex-start; + align-items: center; +} + +.flex-sb { + display: flex; + justify-content: space-between; + align-items: center; +} +.full-height { + width: 100vw; + height: 768px; + background: #f1f4f6; +} + +.line { + width: 100%; + height: 40px; + margin-bottom: 10px; +} +.line .item { + width: 280px; + height: 40px; +} + +.title { + width: 100px; + height: 40px; + font-weight: 500; + font-size: 14px; + color: rgba(0,0,0,0.9); +} +.title .required { + color: #E6521F; +} + +.item .value { + width: 180px; + height: 40px; +} +.line>.value { + width: 494px !important; + height: 40px; + padding: 0 !important; +} + +.value .form-input { + height: 34px !important; + color: rgba(0,0,0,0.9) !important; + border: 1px solid rgba(0,0,0,0.15) !important; + border-radius: 4px !important; +} + +.value>.city-picker-span { + height: 34px !important; + border: 1px solid rgba(0,0,0,0.15) !important; + border-radius: 4px !important; + padding: 0 12px !important; +} + +.value>.city-picker-span > .title > span { + color: rgba(0,0,0,0.9) !important; + font-weight: 400 !important; +} + +.item .value>.bootstrap-select>.btn { + height: 34px !important; + border-radius: 4px !important; + border: 1px solid rgba(0,0,0,0.15) !important; + box-sizing: border-box !important; + background-color: #FFFFFF !important; + color: rgba(0,0,0,0.9) !important; +} +.item .value>.bootstrap-select>.btn .filter-option { + display: flex; + justify-content: flex-start; + align-items: center; +} + +.item .value > .zd-input--suffix { + height: 40px !important; + line-height: 40px !important; +} +.zd-cascader-wrap>.zd-input>.zd-input__inner { + height: 34px !important; + color: rgba(0,0,0,0.9) !important; + border: 1px solid rgba(0,0,0,0.15) !important; + padding: 0 12px !important; +} +.line .select-address { + width: 100px; + height: 60px; +} +.select-address .title { + width: 100px; + height: 30px; +} +.select-address .select-ctr { + width: 100px; + height: 30px; +} + +.multi-line { + height: 60px; +} +.form-textarea { + width: 494px !important; + height: 60px !important; + color: rgba(0,0,0,0.9) !important; + border: 1px solid rgba(0,0,0,0.15) !important; + border-radius: 4px !important; + resize: none; +} +#area_map { + width: 64px; + height: 26px; + border-radius: 4px; +} +.bt-40 { + margin-bottom: 40px !important; +} + +.radio > label, .checkbox > label { + margin-right: 40px; +} +input[type="radio"] { + transform: scale(1.2); +} + +.radio > label > input, .checkbox > label > input { + margin: 4px 0 0; +} + +.faupload-preview { + padding-bottom: 20px; +} +.value .input-group { + height: 40px; +} + +.right { + padding: 20px 30px; + box-sizing: border-box; +} + +.smart-text,.smart-text-item,.smart-text-line { + width: 326px !important; + height: 140px !important; +} +.smart-btn { + width: 94px; + height: 38px; + background: #444c69; + border-radius: 4px; + font-weight: 400; + font-size: 14px; + color: #FFFFFF; + cursor: pointer; + user-select: none; +} +.smart-btn>.img { + width: 16px; + height: 16px; + margin-right: 2px; +} +.smart-btn:hover { + background: #3d445f; +} +.smart-btn:active { + background: #3a425b; +} + +.submit-ctr { + width: 270px; + height: 80px; + position: absolute; + right: 30px; + bottom: 44px; +} +.submit-ctr> .submit { + width: 108px; + height: 46px; + box-shadow: 0px 8px 32px 0px rgba(0,0,0,0.16); + border-radius: 4px; + font-weight: 400; + font-size: 16px; +} + +.submit-ctr> .submit-continue { + width: 140px; + height: 46px; + box-shadow: 0px 8px 32px 0px rgba(0,0,0,0.16); + border-radius: 4px; + font-weight: 400; + font-size: 16px; +} + +.images-input { + width: 180px; + padding: 0 12px; +} diff --git a/public/assets/img/automation.png b/public/assets/img/automation.png new file mode 100644 index 0000000..943f600 Binary files /dev/null and b/public/assets/img/automation.png differ diff --git a/public/assets/js/addons.js b/public/assets/js/addons.js index 6299f6b..0f3bdcb 100755 --- a/public/assets/js/addons.js +++ b/public/assets/js/addons.js @@ -1,7 +1,6 @@ define([], function () { require([], function () { //绑定data-toggle=addresspicker属性点击事件 - $(document).on('click', "[data-toggle='addresspicker']", function () { var that = this; var callback = $(that).data('callback'); diff --git a/public/assets/js/backend/order.js b/public/assets/js/backend/order.js index 0122db0..09f62b5 100644 --- a/public/assets/js/backend/order.js +++ b/public/assets/js/backend/order.js @@ -4,6 +4,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function $('[name^="row["]').val(''); $("#c-city").citypicker('reset'); $("#item_id").val(''); + $('.zd-cascader-menu').find('li.in-active-path').removeClass('in-active-path'); + $('.zd-cascader-panel').find('.is-selected-icon').remove(); $("#item_id_value").val(''); $(".selectpicker").val('').selectpicker('refresh'); } @@ -26,23 +28,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function // 拼装文本 function assembleOrderMessage(data) { - const message = ` -【订单详情】 -录单员: ${data.user.nickname} -订单编号: ${data.order_no} + const message = `订单编号: ${data.order_no} 服务名称: ${data.item_title} -客户姓名: ${data.customer} +客户昵称: ${data.customer} 客户电话: ${data.tel} -上门时间: ${data.plan_time} -优惠码: ${data.coupon?.description||'无'} -订单状态: ${data.status_text} -详细地址: ${data.address} -订单详情: ${data.detail} +客户地址: ${data.address} +收款金额: ${data.receive_type === 1 ? '已收定金 ' + data.online_amount : '已收全款 ' + data.online_amount} +优惠活动: ${data.coupon?.description || '无'} +订单详情: ${data.detail || '无'} 订单备注: ${data.remark} -派单方式: ${data.dispatch_type === 1 ? '手动派单' : '自动派单'} -收款方式: ${data.receive_type === 1 ? '已收定金' : '已收全款'} - -请查收以上订单信息。`; +预约时间: ${data.plan_time || '无'} +`; return message; } @@ -74,9 +70,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function fixedRightNumber: 1, fixedNumber: 3, fixedColumns: true, - renderDefault:true, - searchFormVisible:true, - search:false, + renderDefault: true, + searchFormVisible: true, + search: false, columns: [ [ {checkbox: true}, @@ -84,7 +80,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function { field: 'status', title: __('Status'), - fixed:true, + fixed: true, searchList: { "0": __('Status 0'), "10": __('Status 10'), @@ -99,10 +95,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function /*"-20": __('Status -20'), "-30": __('Status -30')*/ }, - defaultValue:10, + defaultValue: 10, formatter: Table.api.formatter.status, - custom:{ - "10":"my_dispatch" + custom: { + "10": "my_dispatch" } }, { @@ -121,7 +117,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function {field: 'order_no', title: __('Order_no'), operate: 'LIKE'}, {field: 'customer', title: __('Customer'), operate: 'LIKE'}, {field: 'tel', title: __('Tel'), operate: 'LIKE'}, - {field: 'area.merge_name', title: __('Area_id'),searchable:false}, + {field: 'area.merge_name', title: __('Area_id'), searchable: false}, { field: 'address', title: __('Address'), @@ -203,7 +199,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function extend: 'data-toggle="tooltip" data-container="body"', classname: 'btn btn-xs btn-info btn-editone', visible: function (row) { - if (row.status != 60 && row.status != 70) { + if (row.status != 60 && row.status != 70) { return true; } return false; @@ -275,7 +271,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function } return false; }, - callback:function (){ + callback: function () { table.bootstrapTable('refresh'); } }, @@ -336,17 +332,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function }, }, { - name:"error", - text:"订单报错", - title:"订单报错", + name: "error", + text: "订单报错", + title: "订单报错", extend: 'data-toggle="tooltip" data-container="body"', classname: 'btn btn-dialog', icon: 'fa fa-bolt', url: 'order/addAbnormal', - refresh:true, + refresh: true, dropdown: "更多", visible: function (row) { - if (row.status != 60 && row.status != 70) { + if (row.status != 60 && row.status != 70) { return true; } return false; @@ -413,71 +409,91 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function }); const timer = setInterval(function () { table.bootstrapTable('refresh', {}); - },1000 * 120); + }, 1000 * 120); }, add: function () { $("#mybuttom").on("click", function () { const res = $("form[role=form]").isValid(); - if (res){ - Form.api.submit($("form[role=form]")); - // Toastr.success('录入成功'); + if ($('#lng').val() && $('#lng').val() !== ''){ + if (res) { + Form.api.submit($("form[role=form]"),function (data){ + copyToClipboard(assembleOrderMessage(data)); + }); + + } + }else{ + Toastr.success('请选择有效地址'); } + return false; }); + $("#mysubmit").on("click", function () { const res = $("form[role=form]").isValid(); - if (res){ - Form.api.submit($("form[role=form]")); - clearInfo(); - // Toastr.success('录入成功'); + + if ($('#lng').val() && $('#lng').val() !== ''){ + if (res) { + Form.api.submit($("form[role=form]"), function (data, ret) { + clearInfo(); + copyToClipboard(assembleOrderMessage(data)); + return false; + }); + } + }else{ + Toastr.success('请选择有效地址'); } return false; }); - Form.api.bindevent($("form[role=form]")); - $("#smart").on("click", function () { - $.ajax({ - url: "order/smart", // 你的 API 地址 - type: "GET", - dataType: "json", - data: { - str: $('#smart_text').val() - }, - success: function (data) { - if (data.code === 1) { - data = data.data; - if (data.mobile !== '') { - $('#c-tel').val(data.mobile); - } - if (data.name !== '') { - $('#c-customer').val(data.name); - } - if (data.item.id !== 0) { - $('#item_id_value').val(data.item.id); - $('#item_id').val(data.item.item); - } - if (data.idn) { - $('#c-source-id').val(data.idn); - } - let citypicker = $('#c-city'); - // $city.citypicker({ - // province: data.province, - // city: data.city, - // district: data.region - // }); - citypicker.val(data.province + '/' + data.city + '/' + data.region); - citypicker = citypicker.data("citypicker"); - citypicker.refresh(); - var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province"); - $("#area_id").val(code); - $("#area_name").val(citypicker.getVal()); - } - }, - error: function () { - console.error("请求失败"); - } - }); + $("#smart").on("click", function () { + Fast.api.ajax({ + url: "order/smart", // 你的 API 地址 + type: "post", + contentType: 'application/json', + dataType: "json", + data: JSON.stringify({ + str: $('#smart_text').val() + }) + }, function (data) { + if (data.mobile !== '') { + $('#c-tel').val(data.mobile); + } + if (data.name !== '') { + $('#c-customer').val(data.name); + } + if (data.item.id !== 0) { + $('#item_id_value').val(data.item.id); + $('#item_id').val(data.item.item); + } + if (data.idn) { + $('#c-source-id').val(data.idn); + } + // $city.citypicker({ + // province: data.province, + // city: data.city, + // district: data.region + // }); + if (data.area_id) { + $("#area_id").val(data.area_id); + } + if (data.lat) { + $("#lat").val(data.lat); + } + if (data.lng) { + $("#lng").val(data.lng); + } + if (data.area_id) { + $("#area_id").val(data.area_id); + } + if (data.addr && data.addr !== '') { + $("#c-address").val(data.addr); + $("#area_name").val(data.addr); + } + Toastr.info('识别成功'); + return false; + }); }); + Controller.api.bindevent(); Controller.api.map(); }, edit: function () { @@ -519,11 +535,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function $('#c-bank_account').closest('.form-group').hide(); } } + // 初始化时执行一次 toggleInvoiceFields(); // 监听 select 改变 - $('#c-source').on('change',function () { + $('#c-source').on('change', function () { toggleInvoiceFields(); }); Form.api.bindevent($("form[role=form]")); @@ -532,7 +549,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function bindevent: function () { Form.api.bindevent($("form[role=form]")); }, - map:function () { + map: function () { $("#c-city").on("cp:updated", function () { var citypicker = $(this).data("citypicker"); var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province"); @@ -540,16 +557,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function $("#area_id").val(code); $("#area_name").val(citypicker.getVal()); }); - // $("#area_map").data("callback", function (res) { - // Form.api.target($('#c-address')); - // }); $(document).on('click', "#area_map", function (e) { - const data = $("#c-city").val(); - if (!data){ - Toastr.error('请先选择区域'); - return false; - } - var that = this; var callback = $(that).data('callback'); var input_id = $(that).data("input-id") ? $(that).data("input-id") : ""; @@ -558,24 +566,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], 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 = $("#c-city").val(); + var city_code = $("#area_id").val(); var zoom = zoom_id ? $("#" + zoom_id).val() : ''; - var url = "/addons/address/index/select?a=1"; + var url = "/addons/address/index/select?"; url += (lat && lng) ? 'lat=' + lat + '&lng=' + lng + (input_id ? "&address=" + $("#" + input_id).val() : "") - +(zoom ? "&zoom=" + zoom : "") : '' + + (zoom ? "&zoom=" + zoom : "") : '' ; - if (city_code){ + if (city_code) { url += city_code ? "&city_code=" + city_code : ""; } // console.log(url); Fast.api.open(url, '位置选择', { - callback: function (res) { + callback: function (res, data) { input_id && $("#" + input_id).val(res.address).trigger("change"); lat_id && $("#" + lat_id).val(res.lat).trigger("change"); lng_id && $("#" + lng_id).val(res.lng).trigger("change"); zoom_id && $("#" + zoom_id).val(res.zoom).trigger("change"); - + $('#area_id').val(res.city_code); try { //执行回调函数 if (typeof callback === 'function') { @@ -588,9 +596,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function }); }); - var _data = items; - $('#item_id').zdCascader({ data: _data, onChange: function ($this, data, allPathData) { @@ -599,6 +605,162 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function } }); $('#item_id').val($('#item_id').data('value')).focus(); + + const mainSelect = document.getElementById('receive_type'); + const otherSelect = document.getElementById('coupon'); + + function toggleOtherSelect() { + if (mainSelect.value === '2') { + otherSelect.style.display = 'none'; + } else { + otherSelect.style.display = ''; + } + } + + mainSelect.addEventListener('change', toggleOtherSelect); + toggleOtherSelect(); + + $('input[name="row[set_time]"]').on('change', toggleTime); + + function toggleTime() { + var val = $('input[name="row[set_time]"]:checked').val(); + if (val == 1) { + $('#set-time').show(); + } else { + $('#set-time').hide(); + } + } + + toggleTime(); + + const amapKey = 'c299da50c080dfccf9b1d00560ff9639'; + + let isComposing = false; + let addressSelected = false; + let selectedIndex = -1; + $('#c-address') + .on('compositionstart', () => { + isComposing = true; + }) + .on('compositionend', () => { + isComposing = false; + // 不执行 handleInput,由 input 触发 + }) + .on('input', debounce(function (e) { + if (!isComposing) handleInput(e); + }, 300)) + .on('blur', function () { + // 如果还没有选择地址,且列表中有内容,则默认选择第一个 + + // 如果还没有选择地址,且列表中有内容,则默认选择第一个 + if (!addressSelected && $('#suggestionList li').length > 0) { + $('#suggestionList li').first().trigger('mousedown'); + } + + $('#suggestionList').hide(); + }) + .on('focus', function () { + // 如果还没有选择地址,且列表中有内容,则默认选择第一个 + $('#suggestionList').show(); + }) + .on('keydown', function (e) { + const $items = $('#suggestionList li'); + const len = $items.length; + + if (!len) return; + + if (e.key === 'ArrowDown') { + e.preventDefault(); + selectedIndex = (selectedIndex + 1) % len; + updateActiveItem($items); + } else if (e.key === 'ArrowUp') { + e.preventDefault(); + selectedIndex = (selectedIndex - 1 + len) % len; + updateActiveItem($items); + } else if (e.key === 'Enter') { + if (selectedIndex >= 0 && selectedIndex < len) { + e.preventDefault(); + $items.eq(selectedIndex).trigger('mousedown'); + } + } + }); + function updateActiveItem($items) { + $items.removeClass('active'); + if (selectedIndex >= 0) { + const $active = $items.eq(selectedIndex); + $active.addClass('active'); + + // 自动滚动使其可见 + const container = $('#suggestionList')[0]; + const item = $active[0]; + + if (item && container) { + const itemTop = item.offsetTop; + const itemBottom = itemTop + item.offsetHeight; + const containerTop = container.scrollTop; + const containerBottom = containerTop + container.clientHeight; + + if (itemTop < containerTop) { + container.scrollTop = itemTop; + } else if (itemBottom > containerBottom) { + container.scrollTop = itemBottom - container.clientHeight; + } + } + } + } + + + function handleInput(e) { + selectedIndex = -1; + addressSelected = false; + const keyword = $(e.target).val(); + if (!keyword.trim() || /^[\s\p{P}]+$/u.test(keyword)) return; + if (!keyword) return $('#c-address').empty(); + + $.getJSON('https://restapi.amap.com/v3/assistant/inputtips', { + key: amapKey, + keywords: keyword, + datatype: 'all', + city: '全国', + }, function (res) { + if (res.tips) { + let html = ''; + res.tips.forEach(tip => { + if (tip.location) { + html += `
                  • + ${tip.district} ${tip.name} +
                  • `; + } + }); + $('#suggestionList').html(html).show(); + } + }); + } + + function debounce(fn, delay = 300) { + let timer = null; + return function (...args) { + clearTimeout(timer); + timer = setTimeout(() => { + fn.apply(this, args); + }, delay); + }; + } + + + $('#suggestionList').on('mousedown', 'li', function (e) { + const name = $(this).data('name'); + const location = $(this).data('location'); // "经度,纬度" + const [lng, lat] = location.split(','); + console.log('click'); + // $('#c-address').val(name); + $('#lng').val(lng); + $('#lat').val(lat); + // 隐藏提示列表 + $('#suggestionList').hide(); + selectedIndex = -1; + addressSelected = true; + }); } } }; diff --git a/public/assets/js/cascader.js b/public/assets/js/cascader.js index 3b82dc2..6f3d6e5 100644 --- a/public/assets/js/cascader.js +++ b/public/assets/js/cascader.js @@ -132,6 +132,10 @@ this.search(this.$el.val()); }, this)); } + ZdCascader.prototype.clear_path_class = function () { + this.$dropdownWrap.find('li.' + this.CLASS.checkClass.nodeAnchor).removeClass(this.CLASS + .checkClass.nodeAnchor); + } ZdCascader.prototype._wrapClick = function () { event.stopPropagation(); this.$el.focus(); @@ -307,7 +311,8 @@ this.reload(null, true) return }; - var keywords = keyword.replace(' ','').replace('/','').split('') + var keywords = [keyword]; + // console.log(keywords); var data = this.labelList.filter(function(item) { item.num = 0 keywords.forEach(function(key) { @@ -317,8 +322,7 @@ return item.num>(keywords.length==1?0:1) }).sort(function(a, b) { return b.num - a.num - }).slice(0, 10) - console.log(data); + }).slice(0, 15) this.reload(data, true) } //关键词筛选数据(暂不用)