Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
starsw001
ShopXO
提交
556ef838
ShopXO
项目概览
starsw001
/
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,发现更多精彩内容 >>
提交
556ef838
编写于
9月 22, 2019
作者:
D
Devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品规格快捷操作
上级
08771363
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
58 addition
and
81 deletion
+58
-81
public/static/admin/default/js/goods.js
public/static/admin/default/js/goods.js
+24
-47
public/static/index/default/js/cart.js
public/static/index/default/js/cart.js
+9
-9
public/static/index/default/js/goods.js
public/static/index/default/js/goods.js
+10
-10
public/static/index/default/js/index.js
public/static/index/default/js/index.js
+5
-5
public/static/index/default/js/search.js
public/static/index/default/js/search.js
+10
-10
未找到文件。
public/static/admin/default/js/goods.js
浏览文件 @
556ef838
...
...
@@ -8,7 +8,7 @@
* @param {[array]} arr1 [要进行笛卡尔积的二维数组]
* @param {[array]} arr2 [最终实现的笛卡尔积组合,可不写]
*/
function
spec_c
artesian
(
arr1
,
arr2
)
function
SpecC
artesian
(
arr1
,
arr2
)
{
// 去除第一个元素
var
result
=
[];
...
...
@@ -40,7 +40,7 @@ function spec_cartesian(arr1, arr2)
// 递归进行拼接
if
(
arr1
.
length
>
0
)
{
result
=
spec_c
artesian
(
arr1
,
result
);
result
=
SpecC
artesian
(
arr1
,
result
);
}
// 返回最终笛卡尔积
...
...
@@ -326,7 +326,6 @@ $(function()
// 生成规格
$
(
'
.quick-spec-created
'
).
on
(
'
click
'
,
function
()
{
var
spec
=
[];
$
(
'
.spec-quick table tbody tr
'
).
each
(
function
(
k
,
v
)
{
...
...
@@ -348,46 +347,9 @@ $(function()
if
(
spec
.
length
<=
0
)
{
Prompt
(
'
快捷操作规格为空
'
);
return
false
;
}
spec
=
[
{
"
title
"
:
"
套餐
"
,
"
value
"
:
[
"
套餐1
"
,
"
套餐2
"
,
"
套餐3
"
]
},
{
"
title
"
:
"
颜色
"
,
"
value
"
:
[
"
黑色
"
,
"
红色
"
]
},
{
"
title
"
:
"
容量
"
,
"
value
"
:
[
"
64G
"
,
"
128G
"
]
},
{
"
title
"
:
"
配置
"
,
"
value
"
:
[
"
高级
"
,
"
钻石
"
,
"
555
"
]
},
{
"
title
"
:
"
测试5
"
,
"
value
"
:
[
"
测试1
"
,
"
测试2
"
]
}
];
spec
=
[
{
"
title
"
:
"
颜色
"
,
"
value
"
:
[
"
黑色
"
,
"
白色
"
,
"
蓝色
"
]
},
{
"
title
"
:
"
尺码
"
,
"
value
"
:
[
"
S
"
,
"
M
"
,
"
L
"
,
"
XL
"
,
"
XXL
"
]
},
{
"
title
"
:
"
长度
"
,
"
value
"
:
[
"
5分裤
"
,
"
7分裤
"
,
"
9分裤
"
,
"
长裤
"
,
"
测试
"
]
}
];
// 移除规格列
$
(
'
.specifications-table .title-nav-remove
'
).
trigger
(
'
click
'
);
...
...
@@ -400,21 +362,36 @@ $(function()
html
+=
'
<i class="am-close am-close-spin title-nav-remove" data-index="
'
+
index
+
'
">×</i>
'
;
html
+=
'
<input type="text" name="specifications_name_
'
+
index
+
'
" value="
'
+
spec
[
i
][
'
title
'
]
+
'
" placeholder="规格名" class="am-radius" data-validation-message="请填写规格名" required />
'
;
html
+=
'
</th>
'
;
console
.
log
(
spec
[
i
])
$
(
'
.title-start
'
).
before
(
html
);
// value
html
=
'
<td class="table-value table-value-
'
+
index
+
'
">
'
;
html
+=
'
<input type="text" name="specifications_value_
'
+
index
+
'
[]" placeholder="规格值" class="am-radius" data-validation-message="请填写规格值" required />
'
;
html
+=
'
<input type="text" name="specifications_value_
'
+
index
+
'
[]"
value="
'
+
(
spec
[
i
][
'
value
'
][
0
]
||
""
)
+
'
"
placeholder="规格值" class="am-radius" data-validation-message="请填写规格值" required />
'
;
html
+=
'
</td>
'
;
$
(
'
.value-start
'
).
before
(
html
);
}
// 自动生成规格
var
data
=
spec_cartesian
(
spec
);
console
.
log
(
data
);
var
data
=
SpecCartesian
(
spec
);
for
(
var
i
=
1
;
i
<
data
.
length
;
i
++
)
{
// 添加规格值
var
html
=
$
(
'
.specifications-table
'
).
find
(
'
tbody tr:last
'
).
prop
(
'
outerHTML
'
);
if
(
html
.
indexOf
(
'
<!--operation-->
'
)
>=
0
)
{
html
=
html
.
replace
(
/<!--operation-->/ig
,
'
<span class="fs-12 cr-blue c-p m-r-5 line-copy">复制</span> <span class="fs-12 cr-red c-p line-remove">移除</span>
'
);
}
$
(
'
.specifications-table
'
).
append
(
html
);
$
(
'
.specifications-table
'
).
find
(
'
tbody tr:last
'
).
attr
(
'
class
'
,
'
line-
'
+
index
+
'
line-not-first
'
);
$
(
'
.specifications-table
'
).
find
(
'
tbody tr:last
'
).
attr
(
'
data-line-tag
'
,
'
.line-
'
+
index
);
// 规格值
var
temp_spec
=
data
[
i
].
split
(
'
,
'
);
for
(
var
k
in
temp_spec
)
{
// 规格值赋值
$
(
'
.specifications-table
'
).
find
(
'
tbody tr:last
'
).
find
(
'
td:eq(
'
+
k
+
'
) input
'
).
val
(
temp_spec
[
k
]);
}
}
});
});
\ No newline at end of file
public/static/index/default/js/cart.js
浏览文件 @
556ef838
$
(
function
()
{
// 计算选择的商品总数和总价
function
cart_base_t
otal
()
function
CartBaseT
otal
()
{
var
total_stock
=
0
;
var
total_price
=
0.00
;
...
...
@@ -72,7 +72,7 @@ $(function()
self
.
parents
(
'
tr
'
).
find
(
'
.wap-number
'
).
text
(
'
x
'
+
stock
);
// 计算选择的商品总数和总价
cart_base_t
otal
();
CartBaseT
otal
();
}
else
{
PromptCenter
(
result
.
msg
);
}
...
...
@@ -130,19 +130,19 @@ $(function()
}
// 计算选择的商品总数和总价
cart_base_t
otal
();
CartBaseT
otal
();
});
// 选择
$
(
'
.am-table input[type="checkbox"]
'
).
on
(
'
click
'
,
function
()
{
// 计算选择的商品总数和总价
cart_base_t
otal
();
CartBaseT
otal
();
});
// 导航固定
var
nav_top
=
$
(
'
.cart-nav
'
).
length
>
0
?
$
(
'
.cart-nav
'
).
offset
().
top
:
0
;
function
cart_nav_p
op
()
function
CartNavP
op
()
{
var
scroll
=
$
(
document
).
scrollTop
();
var
location
=
scroll
+
$
(
window
).
height
()
-
100
;
...
...
@@ -156,24 +156,24 @@ $(function()
$
(
'
body
'
).
css
({
"
padding-bottom
"
:
"
0
"
});
}
}
cart_nav_p
op
();
CartNavP
op
();
$
(
window
).
scroll
(
function
()
{
cart_nav_p
op
();
CartNavP
op
();
});
// 浏览器窗口实时事件
$
(
window
).
resize
(
function
()
{
// 导航固定初始化
cart_nav_p
op
();
CartNavP
op
();
});
// 结算事件
$
(
'
.separate-submit
'
).
on
(
'
click
'
,
function
()
{
// 计算选择的商品总数和总价
cart_base_t
otal
();
CartBaseT
otal
();
// 获取购物车id
var
ids
=
$
(
this
).
parents
(
'
form
'
).
find
(
'
input[name="ids"]
'
).
val
()
||
0
;
...
...
public/static/index/default/js/goods.js
浏览文件 @
556ef838
// 规格弹窗PC显示
function
poptit_pc_s
how
()
function
PoptitPcS
how
()
{
$
(
document
.
body
).
css
(
'
position
'
,
'
static
'
);
$
(
'
.theme-signin-left
'
).
scrollTop
(
0
);
...
...
@@ -7,7 +7,7 @@ function poptit_pc_show()
$
(
'
.theme-popover
'
).
slideDown
(
0
);
}
// 规格弹窗关闭
function
poptit_c
lose
()
function
PoptitC
lose
()
{
if
(
$
(
window
).
width
()
<
1025
)
{
...
...
@@ -186,7 +186,7 @@ function CartAdd(e)
data
:
{
"
goods_id
"
:
$
(
'
.goods-detail
'
).
data
(
'
id
'
),
"
stock
"
:
stock
,
"
spec
"
:
spec
},
success
:
function
(
result
)
{
poptit_c
lose
();
PoptitC
lose
();
$
.
AMUI
.
progress
.
done
();
$button
.
attr
(
'
disabled
'
,
false
);
...
...
@@ -200,7 +200,7 @@ function CartAdd(e)
},
error
:
function
(
xhr
,
type
)
{
poptit_c
lose
();
PoptitC
lose
();
$
.
AMUI
.
progress
.
done
();
$button
.
attr
(
'
disabled
'
,
false
);
PromptCenter
(
'
服务器错误
'
);
...
...
@@ -518,11 +518,11 @@ $(function() {
$
(
'
.theme-popover .confirm
'
).
attr
(
'
data-type
'
,
$
(
this
).
data
(
'
type
'
));
}
}
else
{
poptit_pc_s
how
();
PoptitPcS
how
();
}
});
$
(
'
.theme-poptit .close, .btn-op .close
'
).
on
(
'
click
'
,
function
()
{
poptit_c
lose
();
PoptitC
lose
();
});
// 购买
...
...
@@ -568,7 +568,7 @@ $(function() {
data
:
{
"
id
"
:
$
(
'
.goods-detail
'
).
data
(
'
id
'
)},
success
:
function
(
result
)
{
poptit_c
lose
();
PoptitC
lose
();
$
.
AMUI
.
progress
.
done
();
if
(
result
.
code
==
0
)
...
...
@@ -599,7 +599,7 @@ $(function() {
},
error
:
function
(
xhr
,
type
)
{
poptit_c
lose
();
PoptitC
lose
();
$
.
AMUI
.
progress
.
done
();
if
(
$
(
window
).
width
()
<
640
)
{
...
...
@@ -717,8 +717,8 @@ $(window).resize(function()
// 规格显示/隐藏处理
if
(
$
(
window
).
width
()
<
1025
)
{
poptit_c
lose
();
PoptitC
lose
();
}
else
{
poptit_pc_s
how
();
PoptitPcS
how
();
}
});
\ No newline at end of file
public/static/index/default/js/index.js
浏览文件 @
556ef838
// 楼层聚合数据高度处理
function
floor_resize_h
andle
()
function
FloorResizeH
andle
()
{
$
(
'
.floor
'
).
each
(
function
(
k
,
v
)
{
...
...
@@ -13,7 +13,7 @@ $(function()
// 新闻轮播
if
((
window
.
innerWidth
||
$
(
window
).
width
())
<=
640
)
{
function
auto_s
croll
()
function
AutoS
croll
()
{
$
(
'
.banner-news
'
).
find
(
"
ul
"
).
animate
({
marginTop
:
"
-39px
"
...
...
@@ -25,19 +25,19 @@ $(function()
}
setInterval
(
function
()
{
auto_s
croll
();
AutoS
croll
();
},
3000
);
}
// 浏览器窗口实时事件
$
(
window
).
resize
(
function
()
{
floor_resize_h
andle
();
FloorResizeH
andle
();
});
});
$
(
window
).
load
(
function
()
{
floor_resize_h
andle
();
FloorResizeH
andle
();
});
\ No newline at end of file
public/static/index/default/js/search.js
浏览文件 @
556ef838
...
...
@@ -16,13 +16,13 @@ $(function()
$
(
"
.select-result dl
"
).
append
(
copy_html
.
attr
(
"
id
"
,
selected_tag_name
));
}
}
get_goods_l
ist
(
1
);
GetGoodsL
ist
(
1
);
});
$
(
document
).
on
(
'
click
'
,
'
.select-result dl dd
'
,
function
()
{
$
(
this
).
remove
();
$
(
'
#
'
+
$
(
this
).
attr
(
'
id
'
)
+
'
-dl
'
).
find
(
'
.select-all
'
).
addClass
(
'
selected
'
).
siblings
().
removeClass
(
'
selected
'
);
get_goods_l
ist
(
1
);
GetGoodsL
ist
(
1
);
});
$
(
document
).
on
(
'
click
'
,
'
ul.select dd
'
,
function
()
{
...
...
@@ -42,7 +42,7 @@ $(function()
$
(
this
).
hide
();
$
(
'
.select-result .select-no
'
).
show
();
$
(
'
.select-result
'
).
hide
();
get_goods_l
ist
(
1
);
GetGoodsL
ist
(
1
);
});
// 排序导航
...
...
@@ -67,7 +67,7 @@ $(function()
$
(
this
).
addClass
(
'
active
'
);
$
(
this
).
attr
(
'
data-type
'
,
'
asc
'
);
}
get_goods_l
ist
(
1
);
GetGoodsL
ist
(
1
);
});
// 条件分类组筛选
...
...
@@ -111,7 +111,7 @@ $(function()
// 导航显示/隐藏处理
function
search_n
av
()
function
SearchN
av
()
{
// 滚动处理导航
$
(
window
).
scroll
(
function
()
...
...
@@ -138,7 +138,7 @@ $(function()
$
(
window
).
resize
(
function
()
{
// 导航
search_n
av
();
SearchN
av
();
// 条件筛选
if
(
$
(
document
).
width
()
>=
640
)
...
...
@@ -146,10 +146,10 @@ $(function()
$
(
'
.dd-conent
'
).
show
();
}
});
search_n
av
();
SearchN
av
();
// 获取商品列表
function
get_goods_l
ist
(
page
)
function
GetGoodsL
ist
(
page
)
{
// 请求参数处理
var
data
=
{
...
...
@@ -217,12 +217,12 @@ $(function()
}
});
}
get_goods_l
ist
(
1
);
GetGoodsL
ist
(
1
);
// 加载更多数据
$
(
'
.search-pages-submit
'
).
on
(
'
click
'
,
function
()
{
get_goods_l
ist
();
GetGoodsL
ist
();
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录