Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
6c622fcd
ShopXO
项目概览
jcy2004x
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6c622fcd
编写于
3月 19, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
运费模块应用
上级
4c932eab
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
413 addition
and
28 deletion
+413
-28
application/plugins/freightfee/Admin.php
application/plugins/freightfee/Admin.php
+15
-0
application/plugins/view/freightfee/admin/saveinfo.html
application/plugins/view/freightfee/admin/saveinfo.html
+55
-22
application/service/RegionService.php
application/service/RegionService.php
+6
-5
public/static/common/css/common.css
public/static/common/css/common.css
+1
-1
public/static/plugins/css/freightfee/admin.css
public/static/plugins/css/freightfee/admin.css
+76
-0
public/static/plugins/js/freightfee/admin.js
public/static/plugins/js/freightfee/admin.js
+260
-0
未找到文件。
application/plugins/freightfee/Admin.php
浏览文件 @
6c622fcd
...
...
@@ -12,6 +12,7 @@ namespace app\plugins\freightfee;
use
think\Controller
;
use
app\service\PluginsService
;
use
app\service\RegionService
;
/**
* 运费设置 - 管理
...
...
@@ -61,6 +62,20 @@ class Admin extends Controller
1
=>
array
(
'id'
=>
1
,
'name'
=>
'按重量'
),
];
// 地区
$region
=
RegionService
::
RegionItems
([
'pid'
=>
0
,
'field'
=>
'id,name'
]);
if
(
!
empty
(
$region
))
{
$region
=
array_map
(
function
(
$v
)
{
$v
[
'items'
]
=
RegionService
::
RegionItems
([
'pid'
=>
$v
[
'id'
],
'field'
=>
'id,name'
]);
return
$v
;
},
$region
);
}
//print_r($ret['data']);
$this
->
assign
(
'region_list'
,
$region
);
$this
->
assign
(
'is_whether_list'
,
$is_whether_list
);
$this
->
assign
(
'data'
,
$ret
[
'data'
]);
return
$this
->
fetch
(
'../../../plugins/view/freightfee/admin/saveinfo'
);
...
...
application/plugins/view/freightfee/admin/saveinfo.html
浏览文件 @
6c622fcd
...
...
@@ -21,8 +21,8 @@
</div>
</div>
<div
class=
"freightfee-rules"
>
<table
class=
"am-table am-table-striped
am-table-hover
"
>
<div
class=
"
business-form-block
freightfee-rules"
>
<table
class=
"am-table am-table-striped"
>
<thead>
<tr>
<th>
运送到
</th>
...
...
@@ -35,34 +35,67 @@
</thead>
<tbody>
<tr>
<td>
Amaze UI
</td>
<td>
http://amazeui.org
</td>
<td>
2012-10-01
</td></tr>
<tr>
<td>
Amaze UI
</td>
<td>
http://amazeui.org
</td>
<td>
2012-10-01
</td></tr>
<tr>
<td>
Amaze UI
</td>
<td>
http://amazeui.org
</td>
<td>
2012-10-01
</td></tr>
<tr>
<td>
Amaze UI
</td>
<td>
http://amazeui.org
</td>
<td>
2012-10-01
</td></tr>
<tr>
<td>
Amaze UI
</td>
<td>
http://amazeui.org
</td>
<td>
2012-10-01
</td></tr>
<td
class=
"first"
>
<div
class=
"region-td none"
></div>
默认运费
<input
type=
"text"
class=
"am-radius region-name"
name=
"region_name[0]['region']"
data-validation-message=
"请选择地区"
value=
"default"
required
/>
</td>
<td>
<input
type=
"number"
class=
"am-radius first-name"
name=
"first_name[0]['first']"
min=
"1"
max=
"9999"
data-validation-message=
"输入 1~9999 的整数"
required
/>
</td>
<td>
<input
type=
"number"
class=
"am-radius first-price-name"
name=
"first_price_name[0]['first_price']"
min=
"0.00"
max=
"999.99"
step=
"0.01"
data-validation-message=
"应输入 0.00~999.99 的数字,小数保留两位"
required
/>
</td>
<td>
<input
type=
"number"
class=
"am-radius continue-name"
name=
"continue_name[0]['continue']"
min=
"1"
max=
"9999"
data-validation-message=
"输入 1~9999 的整数"
required
/>
</td>
<td>
<input
type=
"number"
class=
"am-radius continue-price-name"
name=
"continue_price_name[0]['continue_price']"
min=
"0.00"
max=
"999.99"
step=
"0.01"
data-validation-message=
"应输入 0.00~999.99 的数字,且不能大于首费,小数保留两位"
required
/>
</td>
<td>
<!--operation-->
</td>
</tr>
</tbody>
</table>
<span
class=
"business-operations-submit rules-submit-add"
>
+为指定地区城市设置运费
</span>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm
w100
"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm
am-btn-block
"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
</div>
</form>
<!-- form end -->
<!-- popup -->
<div
class=
"am-popup"
id=
"freightfee-region-popup"
>
<div
class=
"am-popup-inner"
>
<div
class=
"am-popup-hd"
>
<h4
class=
"am-popup-title"
>
选择区域
</h4>
<span
data-am-modal-close
class=
"am-close"
>
×
</span>
</div>
<div
class=
"am-popup-bd"
>
{{if !empty($region_list)}}
<ul
class=
"province-list"
>
{{foreach $region_list as $v}}
<li>
<p
class=
"province-name region-node-{{$v.id}}"
data-id=
"{{$v.id}}"
>
{{$v.name}}
</p>
{{if !empty($v['items'])}}
<ul
class=
"city-list"
>
{{foreach $v.items as $vs}}
<li>
<span
class=
"city-name region-node-{{$vs.id}}"
data-province-id=
"{{$v.id}}"
data-city-id=
"{{$vs.id}}"
>
{{$vs.name}}
</span>
</li>
{{/foreach}}
</ul>
{{/if}}
</li>
{{/foreach}}
</ul>
{{else /}}
<div
class=
"table-no"
><i
class=
"am-icon-warning"
></i>
没有相关数据
</div>
{{/if}}
<button
type=
"submit"
class=
"am-btn am-btn-secondary am-radius btn-loading-example am-btn-sm am-btn-block"
>
确认
</button>
</div>
</div>
</div>
</div>
</div>
<!-- right content end -->
...
...
application/service/RegionService.php
浏览文件 @
6c622fcd
...
...
@@ -36,17 +36,18 @@ class RegionService
}
/**
* 获取地区id
x
下列表
* 获取地区id下列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-12-09T00:13:02+0800
* @param [array] $param [输入参数]
* @param [array] $param
s
[输入参数]
*/
public
static
function
RegionItems
(
$param
=
[])
public
static
function
RegionItems
(
$param
s
=
[])
{
$pid
=
isset
(
$param
[
'pid'
])
?
intval
(
$param
[
'pid'
])
:
0
;
return
Db
::
name
(
'Region'
)
->
where
([
'pid'
=>
$pid
,
'is_enable'
=>
1
])
->
select
();
$pid
=
isset
(
$params
[
'pid'
])
?
intval
(
$params
[
'pid'
])
:
0
;
$field
=
empty
(
$params
[
'field'
])
?
'*'
:
$params
[
'field'
];
return
Db
::
name
(
'Region'
)
->
field
(
$field
)
->
where
([
'pid'
=>
$pid
,
'is_enable'
=>
1
])
->
select
();
}
/**
...
...
public/static/common/css/common.css
浏览文件 @
6c622fcd
...
...
@@ -80,7 +80,7 @@ iframe { width: 100%; height: 100%; border: 0; }
form
.am-form
.am-form-group
:hover
,
.plug-file-upload-view
:hover
{
background
:
#f6f9fc
;
}
form
.am-form
.am-form-group
,
.plug-images-list
,
.goods-specifications
,
.content-app-items
,
.plug-file-upload-view
{
form
.am-form
.am-form-group
,
.plug-images-list
,
.goods-specifications
,
.content-app-items
,
.plug-file-upload-view
,
.business-form-block
{
border-bottom
:
1px
dashed
#ccc
;
padding
:
10px
20%
10px
5px
;
}
...
...
public/static/plugins/css/freightfee/admin.css
浏览文件 @
6c622fcd
...
...
@@ -8,4 +8,80 @@
}
.freightfee-content
.edit-submit
{
margin-bottom
:
20px
;
}
/**
* 编辑页面
*/
.freightfee-rules
table
.am-table
{
margin-bottom
:
10px
;
}
.freightfee-rules
table
.am-table
tr
td
input
{
max-width
:
100px
;
display
:
-webkit-inline-box
;
}
.freightfee-rules
table
.am-table
tr
th
,
.freightfee-rules
table
.am-table
tr
td
,
.freightfee-rules
table
.am-table
tr
td
input
{
text-align
:
center
;
}
.freightfee-rules
table
.am-table
tr
td
.first
{
width
:
30%
;
}
.freightfee-rules
table
.am-table
tr
td
.region-td
{
border
:
1px
solid
#bee5c0
;
padding
:
5px
;
background
:
#f0fff0
;
margin-bottom
:
5px
;
}
.freightfee-rules
table
.am-table
td
.first
input
{
position
:
absolute
;
margin-left
:
-1000000px
;
}
/**
* 弹窗
*/
#freightfee-region-popup
ul
{
margin
:
0
;
padding
:
0
;
}
#freightfee-region-popup
ul
li
{
list-style-type
:
none
;
border-bottom
:
1px
solid
#eee
;
margin-bottom
:
15px
;
}
#freightfee-region-popup
ul
.city-list
{
overflow
:
hidden
;
margin-top
:
5px
;
}
#freightfee-region-popup
ul
.province-name
{
border-bottom
:
1px
solid
#e7e7e7
;
background
:
#f5f5f5
;
margin
:
0
;
}
#freightfee-region-popup
ul
.province-name.selected-may
{
background
:
#eaf7eb
;
border-bottom
:
1px
solid
#d2efd3
;
}
#freightfee-region-popup
ul
.province-name.selected
{
background
:
#4CAF50
;
border-bottom
:
1px
solid
#409643
;
color
:
#fff
;
}
#freightfee-region-popup
ul
.city-list
li
{
float
:
left
;
background
:
#e9e8e8
;
margin
:
0
10px
10px
0
;
border-radius
:
3px
;
border
:
1px
solid
#d6d6d6
;
}
#freightfee-region-popup
ul
li
.province-name
,
#freightfee-region-popup
ul
li
.city-name
{
cursor
:
pointer
;
padding
:
2px
5px
;
}
#freightfee-region-popup
ul
.city-list
li
.selected
{
background
:
#4CAF50
;
color
:
#fff
;
border
:
1px
solid
#409643
;
}
\ No newline at end of file
public/static/plugins/js/freightfee/admin.js
0 → 100644
浏览文件 @
6c622fcd
$
(
function
()
{
// 计费方式切换
$
(
'
form.am-form input[name=valuation]
'
).
on
(
'
click
'
,
function
()
{
var
$this
=
$
(
this
);
var
valuation
=
parseInt
(
$this
.
val
());
if
(
$
(
this
).
parents
(
'
.am-form-group
'
).
attr
(
'
data-value
'
)
!=
valuation
)
{
AMUI
.
dialog
.
confirm
({
title
:
'
温馨提示
'
,
content
:
'
切换计价方式后,所设置当前模板的运输信息将被清空,确定继续么?
'
,
onConfirm
:
function
(
e
)
{
// 内容
var
valuation_unit
=
[
'
件
'
,
'
kg
'
];
var
unit
=
valuation_unit
[
valuation
]
||
null
;
if
(
unit
==
null
)
{
Prompt
(
'
配置有误
'
);
return
false
;
}
$this
.
parents
(
'
.am-form-group
'
).
attr
(
'
data-value
'
,
valuation
);
var
thead
=
'
<tr>
'
;
thead
+=
'
<th>运送到</th>
'
;
thead
+=
'
<th>首件数(
'
+
unit
+
'
)</th>
'
;
thead
+=
'
<th>首费(元)</th>
'
;
thead
+=
'
<th>续件数(
'
+
unit
+
'
)</th>
'
;
thead
+=
'
<th>续费(元)</th>
'
;
thead
+=
'
<th>操作</th>
'
;
thead
+=
'
</tr>
'
;
var
html
=
''
;
switch
(
valuation
)
{
// 按件
case
0
:
html
+=
'
<tr>
'
;
html
+=
'
<td class="first"><div class="region-td none"></div>默认运费
'
;
html
+=
'
<input type="text" class="am-radius region-name" name="region_name[0][
\'
region
\'
]" data-validation-message="请选择地区" value="default" required /></td>
'
;
html
+=
'
<td>
'
;
html
+=
'
<input type="number" class="am-radius first-name" name="first_name[0][
\'
first
\'
]" min="1" max="9999" data-validation-message="输入 1~9999 的整数" required />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td>
'
;
html
+=
'
<input type="number" class="am-radius first-price-name" name="first_price_name[0][
\'
first_price
\'
]" min="0.00" max="999.99" step="0.01" data-validation-message="应输入 0.00~999.99 的数字,小数保留两位" required />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td>
'
;
html
+=
'
<input type="number" class="am-radius continue-name" name="continue_name[0][
\'
continue
\'
]" min="1" max="9999" data-validation-message="输入 1~9999 的整数" required />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td>
'
;
html
+=
'
<input type="number" class="am-radius continue-price-name" name="continue_price_name[0][
\'
continue_price
\'
]" min="0.00" max="999.99" step="0.01" data-validation-message="应输入 0.00~999.99 的数字,且不能大于首费,小数保留两位" required />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td><!--operation--></td>
'
;
html
+=
'
</tr>
'
;
break
;
// 按重量
case
1
:
html
+=
'
<tr>
'
;
html
+=
'
<td class="first"><div class="region-td none"></div>默认运费
'
;
html
+=
'
<input type="text" class="am-radius region-name" name="region_name[0][
\'
region
\'
]" data-validation-message="请选择地区" value="default" required /></td>
'
;
html
+=
'
<td>
'
;
html
+=
'
<input type="number" class="am-radius first-name" name="first_name[0][
\'
first
\'
]" min="0.1" max="9999.0" step="0.1" data-validation-message="输入 0.1~9999.9 的数字,小数保留1位" required />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td>
'
;
html
+=
'
<input type="number" class="am-radius first-price-name" name="first_price_name[0][
\'
first_price
\'
]" min="0.00" max="999.99" step="0.01" data-validation-message="应输入 0.00~999.99 的数字,小数保留两位" required />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td>
'
;
html
+=
'
<input type="number" class="am-radius continue-name" name="continue_name[0][
\'
continue
\'
]" min="0.1" max="9999.0" step="0.1" data-validation-message="输入 0.1~9999.9 的数字,小数保留1位" required />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td>
'
;
html
+=
'
<input type="number" class="am-radius continue-price-name" name="continue_price_name[0][
\'
continue_price
\'
]" min="0.00" max="999.99" step="0.01" step="0.01" data-validation-message="应输入 0.00~999.99 的数字,且不能大于首费,小数保留两位" required />
'
;
html
+=
'
</td>
'
;
html
+=
'
<td><!--operation--></td>
'
;
html
+=
'
</tr>
'
;
break
;
default
:
Prompt
(
'
配置有误
'
);
}
$
(
'
.freightfee-rules table.am-table thead
'
).
html
(
thead
);
$
(
'
.freightfee-rules table.am-table tbody
'
).
html
(
html
);
},
onCancel
:
function
()
{
$
(
'
form.am-form input[name=valuation]
'
).
eq
(
valuation
).
uCheck
(
'
uncheck
'
);
$
(
'
form.am-form input[name=valuation]
'
).
eq
(
valuation
==
1
?
0
:
1
).
uCheck
(
'
check
'
);
$this
.
parents
(
'
.am-form-group
'
).
attr
(
'
data-value
'
,
valuation
==
1
?
0
:
1
);
}
});
}
});
// 元素添加
$
(
'
.rules-submit-add
'
).
on
(
'
click
'
,
function
()
{
// 唯一索引
var
index
=
parseInt
(
Math
.
random
()
*
1000001
);
// 元素html
var
html
=
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:first
'
).
prop
(
'
outerHTML
'
);
if
(
html
.
indexOf
(
'
默认运费
'
)
>=
0
)
{
html
=
html
.
replace
(
/默认运费/ig
,
'
<span class="fs-12 cr-blue c-p line-edit" data-index="
'
+
index
+
'
">添加地区</span>
'
);
}
if
(
html
.
indexOf
(
'
<!--operation-->
'
)
>=
0
)
{
html
=
html
.
replace
(
/<!--operation-->/ig
,
'
<span class="fs-12 cr-red c-p line-remove">删除</span>
'
);
}
$
(
'
.freightfee-rules table.am-table
'
).
append
(
html
);
// 值赋空
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:last
'
).
find
(
'
input
'
).
each
(
function
(
k
,
v
)
{
$
(
this
).
attr
(
'
value
'
,
''
);
});
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:last .region-td
'
).
text
(
''
).
addClass
(
'
none
'
);
// 移除原来的class新增新的class
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:last
'
).
removeClass
().
addClass
(
'
data-list-
'
+
index
);
// name名称设置
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:last .region-name
'
).
attr
(
'
name
'
,
'
region_name[
'
+
index
+
'
][
\'
region
\'
]
'
);
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:last .first-name
'
).
attr
(
'
name
'
,
'
first_name[
'
+
index
+
'
][
\'
first
\'
]
'
);
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:last .first-price-name
'
).
attr
(
'
name
'
,
'
first_price_name[
'
+
index
+
'
][
\'
first_price
\'
]
'
);
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:last .continue-name
'
).
attr
(
'
name
'
,
'
continue_name[
'
+
index
+
'
][
\'
continue
\'
]
'
);
$
(
'
.freightfee-rules table.am-table
'
).
find
(
'
tbody tr:last .continue-price-name
'
).
attr
(
'
name
'
,
'
continue_price_name[
'
+
index
+
'
][
\'
continue_price
\'
]
'
);
});
// 行移除
$
(
document
).
on
(
'
click
'
,
'
.freightfee-rules table.am-table .line-remove
'
,
function
()
{
$
(
this
).
parents
(
'
tr
'
).
remove
();
});
// 地区编辑
$
(
document
).
on
(
'
click
'
,
'
.freightfee-rules table.am-table .line-edit
'
,
function
()
{
var
index
=
$
(
this
).
data
(
'
index
'
);
$
(
'
#freightfee-region-popup
'
).
modal
();
$
(
'
#freightfee-region-popup
'
).
attr
(
'
data-index
'
,
index
);
// 清楚选中
$
(
'
#freightfee-region-popup
'
).
find
(
'
.province-name
'
).
removeClass
(
'
selected
'
).
removeClass
(
'
selected-may
'
);
$
(
'
#freightfee-region-popup
'
).
find
(
'
.city-name
'
).
parent
(
'
li
'
).
removeClass
(
'
selected
'
);
// 地区选中
var
ids
=
$
(
'
.data-list-
'
+
index
).
find
(
'
td.first input
'
).
val
()
||
null
;
if
(
ids
!=
null
)
{
var
ids_all
=
ids
.
split
(
'
-
'
);
for
(
var
i
in
ids_all
)
{
$
(
'
.region-node-
'
+
ids_all
[
i
]).
parent
(
'
li
'
).
addClass
(
'
selected
'
);
}
// 父级选择处理
$
(
'
#freightfee-region-popup .city-list
'
).
each
(
function
(
k
,
v
)
{
var
items_count
=
$
(
this
).
find
(
'
.city-name
'
).
length
;
var
selected_count
=
$
(
this
).
find
(
'
.selected
'
).
length
;
if
(
selected_count
>=
items_count
)
{
$
(
this
).
prev
(
'
.province-name
'
).
removeClass
(
'
selected-may
'
).
addClass
(
'
selected
'
);
}
else
if
(
selected_count
>
0
&&
selected_count
<
items_count
)
{
$
(
this
).
prev
(
'
.province-name
'
).
removeClass
(
'
selected
'
).
addClass
(
'
selected-may
'
);
}
else
{
$
(
this
).
prev
(
'
.province-name
'
).
removeClass
(
'
selected-may
'
).
removeClass
(
'
selected
'
);
}
});
}
});
// 地区选择事件 - 省
$
(
'
#freightfee-region-popup .province-name
'
).
on
(
'
click
'
,
function
()
{
if
(
$
(
this
).
hasClass
(
'
selected-may
'
)
||
$
(
this
).
hasClass
(
'
selected
'
))
{
$
(
this
).
next
(
'
.city-list
'
).
find
(
'
li
'
).
removeClass
(
'
selected
'
);
$
(
this
).
removeClass
(
'
selected-may
'
).
removeClass
(
'
selected
'
);
}
else
{
$
(
this
).
next
(
'
.city-list
'
).
find
(
'
li
'
).
addClass
(
'
selected
'
);
$
(
this
).
addClass
(
'
selected
'
);
}
});
// 地区选择事件 - 城市
$
(
'
#freightfee-region-popup .city-name
'
).
on
(
'
click
'
,
function
()
{
if
(
$
(
this
).
parent
(
'
li
'
).
hasClass
(
'
selected
'
))
{
$
(
this
).
parent
(
'
li
'
).
removeClass
(
'
selected
'
);
}
else
{
$
(
this
).
parent
(
'
li
'
).
addClass
(
'
selected
'
);
}
// 父级处理
var
items_count
=
$
(
this
).
parents
(
'
.city-list
'
).
find
(
'
.city-name
'
).
length
;
var
selected_count
=
$
(
this
).
parents
(
'
.city-list
'
).
find
(
'
.selected
'
).
length
;
if
(
selected_count
>=
items_count
)
{
$
(
this
).
parents
(
'
.city-list
'
).
prev
(
'
.province-name
'
).
removeClass
(
'
selected-may
'
).
addClass
(
'
selected
'
);
}
else
if
(
selected_count
>
0
&&
selected_count
<
items_count
)
{
$
(
this
).
parents
(
'
.city-list
'
).
prev
(
'
.province-name
'
).
removeClass
(
'
selected
'
).
addClass
(
'
selected-may
'
);
}
else
{
$
(
this
).
parents
(
'
.city-list
'
).
prev
(
'
.province-name
'
).
removeClass
(
'
selected-may
'
).
removeClass
(
'
selected
'
);
}
});
// 地区选择确认
$
(
'
#freightfee-region-popup button[type="submit"]
'
).
on
(
'
click
'
,
function
()
{
var
name_all
=
[];
var
ids_all
=
[];
var
city_index
=
0
;
var
province_index
=
0
;
var
province_id
=
0
;
$
(
'
#freightfee-region-popup .city-list li
'
).
each
(
function
(
k
,
v
)
{
if
(
$
(
this
).
parent
(
'
.city-list
'
).
prev
(
'
.province-name
'
).
hasClass
(
'
selected
'
))
{
var
temp_province_id
=
$
(
this
).
parent
(
'
.city-list
'
).
prev
(
'
.province-name
'
).
data
(
'
id
'
);
console
.
log
(
temp_province_id
)
if
(
province_id
!=
temp_province_id
)
{
province_id
=
temp_province_id
;
name_all
[
province_index
]
=
$
(
this
).
parent
(
'
.city-list
'
).
prev
(
'
.province-name
'
).
text
();
province_index
++
;
}
}
else
{
if
(
$
(
this
).
hasClass
(
'
selected
'
))
{
name_all
[
province_index
]
=
$
(
this
).
find
(
'
.city-name
'
).
text
();
province_index
++
;
}
}
if
(
$
(
this
).
hasClass
(
'
selected
'
))
{
ids_all
[
city_index
]
=
$
(
this
).
find
(
'
.city-name
'
).
data
(
'
city-id
'
);
city_index
++
;
}
});
var
$content
=
$
(
'
.data-list-
'
+
$
(
'
#freightfee-region-popup
'
).
attr
(
'
data-index
'
)
+
'
.region-td
'
);
$content
.
text
(
name_all
.
join
(
'
、
'
));
if
(
name_all
.
length
>
0
)
{
$content
.
removeClass
(
'
none
'
);
}
else
{
$content
.
addClass
(
'
none
'
);
}
$
(
'
.data-list-
'
+
$
(
'
#freightfee-region-popup
'
).
attr
(
'
data-index
'
)
+
'
td.first input
'
).
val
(
ids_all
.
join
(
'
-
'
));
$
(
'
#freightfee-region-popup
'
).
modal
(
'
close
'
);
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录