Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
aeb2b9cb4fb6b1cd00dd923f35e28ebe1b25afc9
1 parent
ef3346bd
优化skn获取代码
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
static/js/product/detail/like.js
template/m.yohobuy.com/actions/product/detail/index.phtml
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
static/js/product/detail/like.js
View file @
aeb2b9c
...
...
@@ -11,7 +11,7 @@ var $ = require('jquery'),
var
productId
=
$
(
'#productId'
).
val
();
var
skn
=
$
(
'#pr
eferenceUrl'
).
val
().
split
(
'?'
)[
1
].
split
(
'&'
)[
0
].
split
(
'='
)[
1
]
,
var
skn
=
$
(
'#pr
oductSkn'
).
val
()
,
productCode
=
$
(
'#limitProductCode'
).
val
();
$
(
'#likeBtn'
).
on
(
'touchstart'
,
function
()
{
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
aeb2b9c
...
...
@@ -177,6 +177,8 @@
<input
id=
"preferenceUrl"
type=
"hidden"
value=
"{{preferenceUrl}}"
>
{
{/if
}
}
<input
id=
"productSkn"
type=
"hidden"
value=
"{{productSkn}}"
>
{
{#loginUrl
}
}
<input
type=
"hidden"
name=
"loginUrl"
id=
"loginUrl"
value=
"{{.}}"
>
{
{/loginUrl
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
aeb2b9c
...
...
@@ -169,6 +169,8 @@ class DetailModel
$result
[
'preferenceUrl'
]
=
Helpers
::
url
(
'/product/detail/preference'
,
array
(
'productSkn'
=>
$baseInfo
[
'erpProductId'
],
'brandId'
=>
$baseInfo
[
'brand'
][
'id'
]),
''
);
}
$result
[
'productSkn'
]
=
$baseInfo
[
'erpProductId'
];
// 商品信息
if
(
!
empty
(
$baseInfo
[
'goodsList'
]))
{
$colorGroup
=
array
();
...
...
@@ -214,10 +216,10 @@ class DetailModel
'sizeNum'
=>
$size
[
'goodsSizeStorageNum'
],
);
$sizeName
=
$size
[
'sizeName'
];
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
$allSizeList
[
$sizeName
]
=
empty
(
$allSizeList
[
$sizeName
][
'storage'
])
?
array
(
'storage'
=>
$size
[
'goodsSizeStorageNum'
],
'id'
=>
$size
[
'id'
])
$allSizeList
[
$sizeName
]
=
empty
(
$allSizeList
[
$sizeName
][
'storage'
])
?
array
(
'storage'
=>
$size
[
'goodsSizeStorageNum'
],
'id'
=>
$size
[
'id'
])
:
$allSizeList
[
$sizeName
];
$colorStorageNum
+=
intval
(
$size
[
'goodsSizeStorageNum'
]);
$colorStorageGroup
[
$value
[
'productSkc'
]
][
$sizeName
]
=
intval
(
$size
[
'goodsSizeStorageNum'
]);
...
...
@@ -239,7 +241,7 @@ class DetailModel
// 商品库存总数
$totalStorageNum
+=
$colorStorageNum
;
}
// 遍历所有尺码,构建颜色显示数据
$i
=
1
;
foreach
(
$allSizeList
as
$sizeName
=>
$value
)
{
...
...
@@ -256,7 +258,7 @@ class DetailModel
$colorGroup
[
$i
][
'color'
][]
=
$colorArr
;
}
$colorGroup
[
$i
][
'id'
]
=
$value
[
'id'
];
++
$i
;
}
// 遍历所有颜色, 构建尺码显示数据
...
...
@@ -267,7 +269,7 @@ class DetailModel
$sizeGroup
[
$i
][
'colorId'
]
=
$value
[
'skcId'
];
// 默认颜色
$colorGroup
[
0
][
'color'
][]
=
$value
;
++
$i
;
}
...
...
@@ -673,7 +675,7 @@ class DetailModel
$result
[
'data'
]
=
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
Helpers
::
url
(
'/product/detail/consults'
,
array
(
'product_id'
=>
$productId
,
'total'
=>
$total
))));
break
;
}
// 处理数据
$record
=
DetailData
::
upvoteConsult
(
$uid
,
$id
);
if
(
!
empty
(
$record
[
'code'
]))
{
...
...
@@ -705,7 +707,7 @@ class DetailModel
$result
[
'data'
]
=
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
Helpers
::
url
(
'/product/detail/consults'
,
array
(
'product_id'
=>
$productId
,
'total'
=>
$total
))));
break
;
}
// 处理数据
$record
=
DetailData
::
usefulConsult
(
$uid
,
$id
);
if
(
!
empty
(
$record
[
'code'
]))
{
...
...
Please
register
or
login
to post a comment