订单数据

This commit is contained in:
hant 2025-04-01 23:03:44 +08:00
parent 0a333ab742
commit cee37cad21
6 changed files with 1068 additions and 240 deletions

View File

@ -121,13 +121,15 @@
radius: 1000, //范围默认500, radius: 1000, //范围默认500,
}); });
if (city_code){ if (city_code){
// console.log(111,city_code);
geocoder.getLocation(city_code, function(status, result) { geocoder.getLocation(city_code, function(status, result) {
if (status === 'complete' && result.info === 'OK') { if (status === 'complete' && result.info === 'OK') {
lat = result.geocodes[0].location.lat; lat = result.geocodes[0].location.lat;
lng = result.geocodes[0].location.lng; lng = result.geocodes[0].location.lng;
map.setCenter(result.geocodes[0].location) map.setCenter(result.geocodes[0].location);
console.log(result.geocodes[0],2222);
} else { } else {
// alert('无法获取该城市的经纬度信息'); console.log(result)
} }
}); });
} }

View File

@ -1,6 +1,7 @@
<?php <?php
namespace app\admin\addresmart; namespace app\admin\addresmart;
use app\admin\model\Item; use app\admin\model\Item;
use function fast\e;
class Address class Address
{ {
@ -68,7 +69,11 @@ class Address
$finalScores[$bestMatch.'__'.$word] = $similarities[$bestMatch]; $finalScores[$bestMatch.'__'.$word] = $similarities[$bestMatch];
} }
arsort($finalScores); // 计算整体匹配度,选择最高的 arsort($finalScores); // 计算整体匹配度,选择最高的
if ($finalScores[array_key_first($finalScores)] > 51){
return array_key_first($finalScores); // 返回最终匹配结果 return array_key_first($finalScores); // 返回最终匹配结果
}else{
return '';
}
} }
@ -142,7 +147,9 @@ class Address
$a3 = ''; $a3 = '';
$street = ''; $street = '';
if (mb_strpos($addr, '县') !== false && mb_strpos($addr, '县') < floor((mb_strlen($addr) / 3) * 2) || (mb_strpos($addr, '区') !== false && mb_strpos($addr, '区') < floor((mb_strlen($addr) / 3) * 2)) || mb_strpos($addr, '旗') !== false && mb_strpos($addr, '旗') < floor((mb_strlen($addr) / 3) * 2)) { if (mb_strpos($addr, '县') !== false && mb_strpos($addr, '县') <= floor((mb_strlen($addr) / 3) * 2)
|| (mb_strpos($addr, '区') !== false && mb_strpos($addr, '区') <= floor((mb_strlen($addr) / 3) * 2))
|| mb_strpos($addr, '旗') !== false && mb_strpos($addr, '旗') <= floor((mb_strlen($addr) / 3) * 2)) {
if (mb_strstr($addr, '旗')) { if (mb_strstr($addr, '旗')) {
$deep3_keyword_pos = mb_strpos($addr, '旗'); $deep3_keyword_pos = mb_strpos($addr, '旗');

View File

@ -31,8 +31,7 @@
"ext-bcmath": "*", "ext-bcmath": "*",
"txthinking/mailer": "^2.0", "txthinking/mailer": "^2.0",
"symfony/var-dumper": "^6.4", "symfony/var-dumper": "^6.4",
"alibabacloud/dyvmsapi-20170525": "^3.2" "alibabacloud/dyvmsapi-20170525": "^3.2",
"symfony/var-dumper": "^6.4",
"nesbot/carbon": "^3.8" "nesbot/carbon": "^3.8"
}, },
"config": { "config": {

1212
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ define([], function () {
var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : ""; var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : "";
var lat = lat_id ? $("#" + lat_id).val() : ''; var lat = lat_id ? $("#" + lat_id).val() : '';
var lng = lng_id ? $("#" + lng_id).val() : ''; var lng = lng_id ? $("#" + lng_id).val() : '';
var city_code = $("#area_id").val(); var city_code = $("#area_name").val();
var zoom = zoom_id ? $("#" + zoom_id).val() : ''; var zoom = zoom_id ? $("#" + zoom_id).val() : '';
var url = "/addons/address/index/select?abc=1"; var url = "/addons/address/index/select?abc=1";
url += (lat && lng) ? 'lat=' + lat + '&lng=' + lng + url += (lat && lng) ? 'lat=' + lat + '&lng=' + lng +

View File

@ -189,33 +189,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
Toastr.success('操作成功'); Toastr.success('操作成功');
return false; return false;
},); },);
$("#smart").on("click", function() {
$.ajax({
url: "order/smart", // 你的 API 地址
type: "GET",
dataType: "json",
data: {
str:$('#smart_text').val()
},
success: function (data) {
console.log(data);
// Controller.api.rendertree(data);
},
error: function () {
console.error("请求失败");
}
});
});
},
edit: function () {
Controller.api.bindevent();
},
copy: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$("#c-city").on("cp:updated", function() { $("#c-city").on("cp:updated", function() {
var citypicker = $(this).data("citypicker"); var citypicker = $(this).data("citypicker");
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province"); var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
@ -237,8 +210,59 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
} }
}); });
$('#item_id').val($('#item_id').data('value')).focus(); $('#item_id').val($('#item_id').data('value')).focus();
$("#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("请求失败");
}
});
});
},
edit: function () {
Controller.api.bindevent();
},
copy: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]")); Form.api.bindevent($("form[role=form]"));
} }
} }