@layout("/common/_container.html"){
|
<style>
|
.newWidth, .single-line {
|
max-width: 200px !important;
|
display: initial !important;
|
}
|
|
</style>
|
<div class="ibox float-e-margins">
|
<div class="ibox-content">
|
<div class="form-horizontal">
|
<div class="row">
|
<div class="col-sm-11">
|
|
<div class="ibox-title">
|
<h3>同城快送价格设置:</h3>
|
</div>
|
<input type="hidden" id="tcId" name="tcId"
|
@if(isNotEmpty(tcId)){
|
value="${tcId}"
|
@}else{
|
value=""
|
@}
|
>
|
|
|
<div class="">
|
<button name="SupendButton-one" onclick="goData()"style="width: 200px;height: 100px;border-color: #0e9aef;background-color:#0e9aef ;">司机</button>
|
<button name="SupendButton-two" onclick="goData()" style="width: 200px;height: 100px;border-color: #0e9aef;background-color: #0e9aef; " onclick="changeColor(this)">用户</button>
|
</div>
|
|
<div class="col-sm-3" onclick="goData()">
|
<#SelectCon id="cityId" name="选择城市:" >
|
<option value="${city.id}">${city.areaName}${city.cityName}${city.provinceName}</option>
|
</#SelectCon>
|
</div>
|
|
|
<div class="form-group">
|
<label class="col-sm-1 control-label"></label>
|
<div class="col-sm-10">
|
(根据起点终点距离收费):<br/>
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-sm-2 control-label">起步价设置:</label>
|
<div class="col-sm-10">
|
起步价为 <input type="text" oninput="checkIsYuan(this)" name="num1" id="num1"
|
value="${json1.num1}" class="form-control newWidth" disabled="true"
|
placeholder="最多5位数"/> Rp,
|
起步包含 <input type="text" oninput="checkIsGongLi(this)" name="num2" id="num2"
|
value="${json1.num2}" class="form-control newWidth" disabled="true"
|
placeholder="最多3位数"/> 公里,
|
<input type="text" oninput="checkIsMinute(this)" name="num3" id="num3"
|
value="${json1.num3}" class="form-control newWidth" disabled="true"
|
placeholder="最多3位数"/> 分钟
|
<br/>
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-sm-2 control-label">里程费设置:</label>
|
<div class="col-sm-10">
|
超过起步里程后每公里 <input type="text" oninput="checkIsYuan(this)" name="num4" id="num4"
|
value="${json2.num1}" class="form-control newWidth" disabled="true"
|
placeholder="最多5位数"/> Rp
|
<br/>
|
</div>
|
</div>
|
|
|
@for(json3 in json3a){
|
<div class="form-group">
|
<label class="col-sm-2 control-label">夜间行驶费用设置:</label>
|
<div class="col-sm-10">
|
<input type="text" name="num5" id="num5" value="${json3.num1}" class="form-control newWidth"
|
disabled="true" placeholder="选择时间"/> 点为夜间行驶时间,
|
起步价变为 <input type="text" oninput="checkIsYuan(this)" name="num6" id="num6"
|
value="${json3.num2}" class="form-control newWidth" disabled="true"
|
placeholder="最多5位数"/> Rp
|
<br>
|
<br>
|
里程费为每公里 <input type="text" oninput="checkIsYuan(this)" name="num7" id="num7"
|
value="${json3.num3}" class="form-control newWidth" disabled="true"
|
placeholder="最多5位数"/> Rp
|
</div>
|
</div>
|
@}
|
|
|
|
</div>
|
<#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="addSubmit()"/>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
|
|
<script src="${ctxPath}/modular/system/tSystemPrice/tSystemPrice_info.js"></script>
|
<script type="text/javascript">
|
function goData() {
|
}
|
|
//提交数据
|
function addSubmit() {
|
let id = $("#id").val()
|
let check = $("#check").val()
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tSystemPrice/smallCheckSubmit", function (data) {
|
if(language==1){
|
Feng.success("操作成功!");
|
}else if(language==2){
|
Feng.success("Operate successfully!");
|
}else {
|
Feng.success("Operasi berhasil!");
|
}
|
location.reload();
|
}, function (data) {
|
if(language==1){
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
}else if(language==2){
|
Feng.error("Fail!" + data.responseJSON.message + "!");
|
}else {
|
Feng.error("Gagal!" + data.responseJSON.message + "!");
|
}
|
});
|
ajax.set("id", id);
|
ajax.set("check", check);
|
ajax.start();
|
}
|
|
function changeColor(obj) {
|
//清空其它同类按钮选中颜色
|
$('div[id^="SupendButton-"]').css("background-color", "transparent");//按钮原来颜色
|
//点击后变色
|
$(obj).val(1);
|
$("#SupendButton-two").val('')
|
$(obj).css("background-color", "#0e9aef")
|
|
|
}
|
function changeColor1(obj) {
|
//清空其它同类按钮选中颜色
|
$('div[id^="SupendButton-"]').css("background-color", "transparent");//按钮原来颜色
|
//点击后变色
|
$(obj).val(2);
|
$("#SupendButton-one").val('')
|
$(obj).css("background-color", "#0e9aef")
|
|
}
|
var regDouble = /^(0|[1-9]\d{0,4})(\.\d{1,2})?$/;
|
var regInt = /^[0-9]{0,3}$/;
|
function checkIsYuan(obj){
|
var num = $(obj).val();
|
if(!regDouble.test(num)){
|
layer.msg("【Rp】输入框不能超过5位数,保留两位小数");
|
}
|
}
|
function checkIsGongLi(obj){
|
var num = $(obj).val();
|
if(!regDouble.test(num)){
|
layer.msg("【公里】输入框不能超过3位数,保留两位小数");
|
}
|
if (obj.id == "num1"){
|
$("#num3").val(num);
|
}else if (obj.id == "num4"){
|
$("#num6").val(num);
|
}else if (obj.id == "num7"){
|
$("#num9").val(num);
|
}else if (obj.id == "num12"){
|
$("#num14").val(num);
|
}else if (obj.id == "num15"){
|
$("#num17").val(num);
|
}else if (obj.id == "num18"){
|
$("#num20").val(num);
|
}
|
}
|
function checkIsMinute(obj){
|
var num = $(obj).val();
|
if(!regInt.test(num)){
|
layer.msg("【分钟】输入框不能超过3位数");
|
}
|
}
|
|
//提交数据
|
function addSubmit() {
|
//验证数据格式-跨城小件物流价格设置
|
var kcId = $("#kcId").val();
|
var num101 = $("#num101").val();
|
var num102 = $("#num102").val();
|
//验证数据格式-同城小件物流价格设置
|
var tcId = $("#cityId").val();
|
if(tcId==''){
|
Feng.info("请选择城市")
|
return false;
|
}
|
var num1 = $("#num1").val();
|
var num2 = $("#num2").val();
|
var num3 = $("#num3").val();
|
var num4 = $("#num4").val();
|
let num5 = $('input[name="num5"]');
|
let num6 = $('input[name="num6"]');
|
let num7 = $('input[name="num7"]');
|
var b1 = $("#SupendButton-one").val();
|
var b2 = $("#SupendButton-two").val();
|
if(b1=='' && b2==''){
|
if(language==1){
|
Feng.error("【请选择计价对象类型】");
|
}else if(language==2){
|
Feng.error("【Please select the valuation object type】");
|
}else {
|
Feng.error("【Silakan pilih tipe objek penghargaan】");
|
}
|
return;
|
}
|
let type =null;
|
if(b1!=''){
|
type=b1
|
}
|
if(b2!=''){
|
type=b2
|
}
|
if ("" == num1 || "" == num2 || "" == num3 || "" == num4 ){
|
Feng.error("【同城快送价格设置】输入框不能为空");
|
return;
|
}else if (!regDouble.test(num1) || !regDouble.test(num2) || !regDouble.test(num3) || !regDouble.test(num4) ){
|
Feng.error("【同城快送价格设置】输入框格式不正确");
|
return;
|
}
|
//封装数据
|
var json2 = '{"num1":"'+num1+'","num2":"'+num2+'","num3":"'+num3+'","num4":"'+num4+'"}';
|
|
|
|
|
var json1='[';
|
for (let i = 0; i < num5.length; i++) {
|
var arr = '{"num1":"'+$(num5[i]).val()+'","num2":"'+$(num6[i]).val()+'","num3":"'+$(num7[i]).val()+'"}';
|
if(i==num5.length-1){
|
json1 += arr+']'
|
}else {
|
json1 += arr+','
|
}
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tSystemPrice/smallSubmit", function(data){
|
if(language==1){
|
Feng.success("操作成功!");
|
}else if(language==2){
|
Feng.success("Operate successfully!");
|
}else {
|
Feng.success("Operasi berhasil!");
|
}
|
location.reload();
|
},function(data){
|
if(language==1){
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
}else if(language==2){
|
Feng.error("Fail!" + data.responseJSON.message + "!");
|
}else {
|
Feng.error("Gagal!" + data.responseJSON.message + "!");
|
}
|
});
|
ajax.set("tcId", tcId);
|
ajax.set("json2", json2);
|
ajax.set("type", type);
|
ajax.set("json1", json1);
|
ajax.start();
|
}
|
|
|
function addBox() {
|
var i = $('.nightTime').length + 1;
|
var a =" <div class=\"form-group\">\n" +
|
" <label class=\"col-sm-2 control-label\"></label>\n" +
|
" <div class=\"col-sm-10\">\n" +
|
" <input type=\"text\" name=\"num5\" id=\"num1-" + i + "\" class=\"form-control newWidth nightTime\" placeholder=\"选择时间\"/> 点为夜间行驶时间,\n" +
|
" 起步价变为 <input type=\"text\" oninput=\"checkIsYuan(this)\" name=\"num6\" id=\"num6\" class=\"form-control newWidth\" placeholder=\"最多5位数\"/> Rp\n" +
|
" <br>\n" +
|
" <br>\n" +
|
" 里程费为每公里 <input type=\"text\" oninput=\"checkIsYuan(this)\" name=\"num7\" id=\"num7\" class=\"form-control newWidth\" placeholder=\"最多5位数\"/> Rp\n" +
|
" <i class=\"fa fa-remove\" onclick=\"delBox(this)\"></i>\n" +
|
" <br/>\n" +
|
" </div>\n" +
|
" </div>"
|
|
$("#night").append($(a))
|
laydate.render({
|
elem: '#num1-' + i
|
,type: 'time'
|
,range: '-'
|
,format: 'HH:mm'
|
});
|
|
}
|
function delBox(o) {
|
$(o).parent("div").parent("div").remove()
|
}
|
|
|
laydate.render({
|
elem: '#num1-1'
|
,type: 'time'
|
,range: '-'
|
,format: 'HH:mm'
|
});
|
</script>
|
@}
|