订单录入优化
This commit is contained in:
parent
5ed36e678a
commit
cba265cc1e
|
|
@ -83,7 +83,7 @@
|
||||||
<div class="form-group col-xs-6">
|
<div class="form-group col-xs-6">
|
||||||
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
|
||||||
<div class='col-xs-12 col-sm-8'>
|
<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="c-city" data-rule="required" class="form-control" data-toggle="city-picker" type="text" value="" />
|
||||||
<input id="area_id" style="display: none" class="form-control" name="row[area_id]" hidden type="text" value="" />
|
<input id="area_id" style="display: none" class="form-control" name="row[area_id]" hidden type="text" value="" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -92,8 +92,13 @@
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-address" data-rule="required"
|
<input id="c-address" data-rule="required"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
|
readonly
|
||||||
name="row[address]"
|
name="row[address]"
|
||||||
type="text">
|
type="text">
|
||||||
|
<div class="btn btn-primary" style="margin-top: 10px" id="area_map"
|
||||||
|
data-input-id="c-address"
|
||||||
|
data-lng-id="lng"
|
||||||
|
data-lat-id="lat">地图查找</div>
|
||||||
<input type="text" style="display: none"
|
<input type="text" style="display: none"
|
||||||
name="row[lng]" id="lng" >
|
name="row[lng]" id="lng" >
|
||||||
<input type="text" style="display: none"
|
<input type="text" style="display: none"
|
||||||
|
|
@ -102,17 +107,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-6">
|
<!-- <div class="col-xs-6">-->
|
||||||
<p style="display: inline-block" class="control-label col-xs-12 col-sm-3">
|
<!-- <p style="display: inline-block" class="control-label col-xs-12 col-sm-3">-->
|
||||||
未能找到使用
|
<!-- 未能找到使用-->
|
||||||
</p>
|
<!-- </p>-->
|
||||||
<div class="col-xs-12 col-sm-8" >
|
<!-- <div class="col-xs-12 col-sm-8" >-->
|
||||||
<span class="btn btn-primary" data-toggle="addresspicker"
|
<!-- <span class="btn btn-primary" data-toggle="addresspicker"-->
|
||||||
data-input-id="c-address"
|
<!-- data-input-id="c-address"-->
|
||||||
data-lng-id="lng"
|
<!-- data-lng-id="lng"-->
|
||||||
data-lat-id="lat">地图查找</span>
|
<!-- data-lat-id="lat">地图查找</span>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
|
|
||||||
<div class="form-group col-xs-6">
|
<div class="form-group col-xs-6">
|
||||||
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
|
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
<div class="form-group col-xs-6">
|
<div class="form-group col-xs-6">
|
||||||
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
|
||||||
<div class='col-xs-12 col-sm-8'>
|
<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="c-city" data-rule="required" value="{$row.area_name}" class="form-control" data-toggle="city-picker" type="text" />
|
||||||
<input id="area_id" style="display: none" value="{$row.area_id}" class="form-control" name="row[area_id]" hidden 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>
|
</div>
|
||||||
|
|
@ -95,7 +95,12 @@
|
||||||
class="form-control"
|
class="form-control"
|
||||||
value="{$row.address}"
|
value="{$row.address}"
|
||||||
name="row[address]"
|
name="row[address]"
|
||||||
|
readonly
|
||||||
type="text">
|
type="text">
|
||||||
|
<div class="btn btn-primary" style="margin-top: 10px" id="area_map"
|
||||||
|
data-input-id="c-address"
|
||||||
|
data-lng-id="lng"
|
||||||
|
data-lat-id="lat">地图查找</div>
|
||||||
<input type="text" style="display: none"
|
<input type="text" style="display: none"
|
||||||
value="{$row['lng']}"
|
value="{$row['lng']}"
|
||||||
name="row[lng]" id="lng" >
|
name="row[lng]" id="lng" >
|
||||||
|
|
@ -106,18 +111,6 @@
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="form-group col-xs-6">
|
||||||
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
|
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
<div class="form-group col-xs-6">
|
<div class="form-group col-xs-6">
|
||||||
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-3">{:__('Area_id')}:</label>
|
||||||
<div class='col-xs-12 col-sm-8'>
|
<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="c-city" data-rule="required" value="{$row.area_name}" class="form-control" data-toggle="city-picker" type="text" value="{$row.address}" />
|
||||||
<input id="area_id" style="display: none" value="{$row.area_id}" class="form-control" name="row[area_id]" hidden 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>
|
</div>
|
||||||
|
|
@ -94,8 +94,13 @@
|
||||||
<input id="c-address" data-rule="required"
|
<input id="c-address" data-rule="required"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
value="{$row.address}"
|
value="{$row.address}"
|
||||||
|
readonly
|
||||||
name="row[address]"
|
name="row[address]"
|
||||||
type="text">
|
type="text">
|
||||||
|
<div class="btn btn-primary" style="margin-top: 10px" id="area_map"
|
||||||
|
data-input-id="c-address"
|
||||||
|
data-lng-id="lng"
|
||||||
|
data-lat-id="lat">地图查找</div>
|
||||||
<input type="text" style="display: none"
|
<input type="text" style="display: none"
|
||||||
name="row[lng]" id="lng" >
|
name="row[lng]" id="lng" >
|
||||||
<input type="text" style="display: none"
|
<input type="text" style="display: none"
|
||||||
|
|
@ -104,17 +109,6 @@
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="form-group col-xs-6">
|
||||||
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
|
<label class="control-label col-xs-12 col-sm-3">{:__('Coupons')}:</label>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
define([], function () {
|
define([], function () {
|
||||||
require([], function () {
|
require([], function () {
|
||||||
//绑定data-toggle=addresspicker属性点击事件
|
//绑定data-toggle=addresspicker属性点击事件
|
||||||
console.log('111');
|
|
||||||
|
|
||||||
$(document).on('click', "[data-toggle='addresspicker']", function () {
|
$(document).on('click', "[data-toggle='addresspicker']", function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
var callback = $(that).data('callback');
|
var callback = $(that).data('callback');
|
||||||
|
|
@ -22,7 +20,7 @@ define([], function () {
|
||||||
if (city_code){
|
if (city_code){
|
||||||
url += city_code ? "&city_code=" + city_code : "";
|
url += city_code ? "&city_code=" + city_code : "";
|
||||||
}
|
}
|
||||||
console.log(url);
|
// console.log(url);
|
||||||
Fast.api.open(url, '位置选择', {
|
Fast.api.open(url, '位置选择', {
|
||||||
callback: function (res) {
|
callback: function (res) {
|
||||||
input_id && $("#" + input_id).val(res.address).trigger("change");
|
input_id && $("#" + input_id).val(res.address).trigger("change");
|
||||||
|
|
|
||||||
|
|
@ -376,27 +376,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
Toastr.success('操作成功');
|
Toastr.success('操作成功');
|
||||||
return false;
|
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();
|
|
||||||
$("#smart").on("click", function () {
|
$("#smart").on("click", function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "order/smart", // 你的 API 地址
|
url: "order/smart", // 你的 API 地址
|
||||||
|
|
@ -441,22 +420,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Controller.api.map();
|
||||||
},
|
},
|
||||||
edit: function () {
|
edit: function () {
|
||||||
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();
|
|
||||||
Controller.api.bindevent();
|
Controller.api.bindevent();
|
||||||
|
Controller.api.map();
|
||||||
},
|
},
|
||||||
copy: function () {
|
copy: function () {
|
||||||
Controller.api.bindevent();
|
Controller.api.bindevent();
|
||||||
|
Controller.api.map();
|
||||||
},
|
},
|
||||||
saleafter: function () {
|
saleafter: function () {
|
||||||
Controller.api.bindevent();
|
Controller.api.bindevent();
|
||||||
|
|
@ -503,6 +475,74 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
api: {
|
api: {
|
||||||
bindevent: function () {
|
bindevent: function () {
|
||||||
Form.api.bindevent($("form[role=form]"));
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
},
|
||||||
|
map: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);
|
||||||
|
$("#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") : "";
|
||||||
|
var lat_id = $(that).data("lat-id") ? $(that).data("lat-id") : "";
|
||||||
|
var lng_id = $(that).data("lng-id") ? $(that).data("lng-id") : "";
|
||||||
|
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 zoom = zoom_id ? $("#" + zoom_id).val() : '';
|
||||||
|
var url = "/addons/address/index/select?a=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");
|
||||||
|
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");
|
||||||
|
|
||||||
|
try {
|
||||||
|
//执行回调函数
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback.call(that, res);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user