Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
286c0ae7
"jetbrains:/idea/checkout/git" did not exist on "310696e2694b4424fbdbaadd3ac08d0c277028fe"
Commit
286c0ae7
authored
Nov 16, 2018
by
Junling Bu
Browse files
chore[renard-wx]: 基于微信开发者工具的格式化代码
parent
20b97ec8
Changes
94
Hide whitespace changes
Inline
Side-by-side
renard-wx/pages/category/category.js
View file @
286c0ae7
...
...
@@ -2,139 +2,139 @@ var util = require('../../utils/util.js');
var
api
=
require
(
'
../../config/api.js
'
);
Page
({
data
:
{
navList
:
[],
goodsList
:
[],
id
:
0
,
currentCategory
:
{},
scrollLeft
:
0
,
scrollTop
:
0
,
scrollHeight
:
0
,
page
:
1
,
size
:
100
},
data
:
{
navList
:
[],
goodsList
:
[],
id
:
0
,
currentCategory
:
{},
scrollLeft
:
0
,
scrollTop
:
0
,
scrollHeight
:
0
,
page
:
1
,
size
:
100
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
var
that
=
this
;
if
(
options
.
id
)
{
that
.
setData
({
id
:
parseInt
(
options
.
id
)
});
}
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
var
that
=
this
;
if
(
options
.
id
)
{
that
.
setData
({
id
:
parseInt
(
options
.
id
)
});
}
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
that
.
setData
({
scrollHeight
:
res
.
windowHeight
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
that
.
setData
({
scrollHeight
:
res
.
windowHeight
});
}
});
}
});
this
.
getCategoryInfo
();
},
this
.
getCategoryInfo
();
},
onPullDownRefresh
()
{
// wx.showNavigationBarLoading() //在标题栏中显示加载
this
.
getCategoryInfo
();
// wx.hideNavigationBarLoading() //完成停止加载
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
onPullDownRefresh
()
{
// wx.showNavigationBarLoading() //在标题栏中显示加载
this
.
getCategoryInfo
();
// wx.hideNavigationBarLoading() //完成停止加载
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
getCategoryInfo
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsCategory
,
{
id
:
this
.
data
.
id
})
.
then
(
function
(
res
)
{
getCategoryInfo
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsCategory
,
{
id
:
this
.
data
.
id
})
.
then
(
function
(
res
)
{
if
(
res
.
errno
==
0
)
{
that
.
setData
({
navList
:
res
.
data
.
brotherCategory
,
currentCategory
:
res
.
data
.
currentCategory
});
if
(
res
.
errno
==
0
)
{
that
.
setData
({
navList
:
res
.
data
.
brotherCategory
,
currentCategory
:
res
.
data
.
currentCategory
});
wx
.
setNavigationBarTitle
({
title
:
res
.
data
.
parentCategory
.
name
})
wx
.
setNavigationBarTitle
({
title
:
res
.
data
.
parentCategory
.
name
})
//nav位置
let
currentIndex
=
0
;
let
navListCount
=
that
.
data
.
navList
.
length
;
for
(
let
i
=
0
;
i
<
navListCount
;
i
++
)
{
currentIndex
+=
1
;
if
(
that
.
data
.
navList
[
i
].
id
==
that
.
data
.
id
)
{
break
;
}
}
if
(
currentIndex
>
navListCount
/
2
&&
navListCount
>
5
)
{
that
.
setData
({
scrollLeft
:
currentIndex
*
60
});
}
//nav位置
let
currentIndex
=
0
;
let
navListCount
=
that
.
data
.
navList
.
length
;
for
(
let
i
=
0
;
i
<
navListCount
;
i
++
)
{
currentIndex
+=
1
;
if
(
that
.
data
.
navList
[
i
].
id
==
that
.
data
.
id
)
{
break
;
}
}
if
(
currentIndex
>
navListCount
/
2
&&
navListCount
>
5
)
{
that
.
setData
({
scrollLeft
:
currentIndex
*
60
});
}
that
.
getGoodsList
();
}
else
{
//显示错误信息
}
that
.
getGoodsList
();
}
else
{
//显示错误信息
}
});
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
console
.
log
(
1
);
},
onHide
:
function
()
{
// 页面隐藏
},
getGoodsList
:
function
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
});
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
console
.
log
(
1
);
},
onHide
:
function
()
{
// 页面隐藏
},
getGoodsList
:
function
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
var
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
categoryId
:
that
.
data
.
currentCategory
.
id
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
})
.
then
(
function
(
res
)
{
that
.
setData
({
goodsList
:
res
.
data
.
goodsList
,
var
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
categoryId
:
that
.
data
.
currentCategory
.
id
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
})
.
then
(
function
(
res
)
{
that
.
setData
({
goodsList
:
res
.
data
.
goodsList
,
});
wx
.
hideLoading
();
});
},
onUnload
:
function
()
{
// 页面关闭
},
switchCate
:
function
(
event
)
{
if
(
this
.
data
.
id
==
event
.
currentTarget
.
dataset
.
id
)
{
return
false
;
}
var
that
=
this
;
var
clientX
=
event
.
detail
.
x
;
var
currentTarget
=
event
.
currentTarget
;
if
(
clientX
<
60
)
{
that
.
setData
({
scrollLeft
:
currentTarget
.
offsetLeft
-
60
});
}
else
if
(
clientX
>
330
)
{
that
.
setData
({
scrollLeft
:
currentTarget
.
offsetLeft
});
}
this
.
setData
({
id
:
event
.
currentTarget
.
dataset
.
id
});
wx
.
hideLoading
();
});
},
onUnload
:
function
()
{
// 页面关闭
},
switchCate
:
function
(
event
)
{
if
(
this
.
data
.
id
==
event
.
currentTarget
.
dataset
.
id
)
{
return
false
;
}
var
that
=
this
;
var
clientX
=
event
.
detail
.
x
;
var
currentTarget
=
event
.
currentTarget
;
if
(
clientX
<
60
)
{
that
.
setData
({
scrollLeft
:
currentTarget
.
offsetLeft
-
60
});
}
else
if
(
clientX
>
330
)
{
that
.
setData
({
scrollLeft
:
currentTarget
.
offsetLeft
});
}
this
.
setData
({
id
:
event
.
currentTarget
.
dataset
.
id
});
this
.
getCategoryInfo
();
}
this
.
getCategoryInfo
();
}
})
\ No newline at end of file
renard-wx/pages/category/category.json
View file @
286c0ae7
{
"usingComponents"
:
{
"goodList"
:
"/components/goodList/goodList"
}
"usingComponents"
:
{
"goodList"
:
"/components/goodList/goodList"
}
}
\ No newline at end of file
renard-wx/pages/category/category.wxml
View file @
286c0ae7
<view class="container">
<view class="cate-nav">
<scroll-view scroll-x="true" class="cate-nav-body" style="width: 750rpx;" scroll-left="{{scrollLeft}}">
<view wx:for="{{navList}}" class="item {{ id == item.id ? 'active' : ''}}" wx:key="id" data-id="{{item.id}}" data-index="{{index}}" bindtap="switchCate">
<view class="name">{{item.name}}</view>
</view>
</scroll-view>
</view>
<scroll-view scroll-y="true" scroll-top="{{scrollTop}}" style="height:{{scrollHeight}};">
<view class="cate-item">
<view class="h">
<text class="name">{{currentCategory.name}}</text>
<text class="desc">{{currentCategory.frontName}}</text>
</view>
<goodList goods="{{goodsList}}"></goodList>
<view class="cate-nav">
<scroll-view scroll-x="true" class="cate-nav-body" style="width: 750rpx;" scroll-left="{{scrollLeft}}">
<view wx:for="{{navList}}" class="item {{ id == item.id ? 'active' : ''}}" wx:key="id" data-id="{{item.id}}" data-index="{{index}}" bindtap="switchCate">
<view class="name">{{item.name}}</view>
</view>
</scroll-view>
</view>
</scroll-view>
<scroll-view scroll-y="true" scroll-top="{{scrollTop}}" style="height:{{scrollHeight}};">
<view class="cate-item">
<view class="h">
<text class="name">{{currentCategory.name}}</text>
<text class="desc">{{currentCategory.frontName}}</text>
</view>
<goodList goods="{{goodsList}}"></goodList>
</view>
</scroll-view>
</view>
\ No newline at end of file
renard-wx/pages/category/category.wxss
View file @
286c0ae7
.container{
background: #fff;
.container
{
background: #fff;
}
.cate-nav{
position: fixed;
left:0;
top:0;
z-index: 1000;
.cate-nav {
position: fixed;
left: 0;
top: 0;
z-index: 1000;
}
.cate-nav-body{
height: 84rpx;
white-space: nowrap;
background: #fff;
border-top: 1px solid rgba(0,0,0,.15);
overflow: hidden;
.cate-nav-body
{
height: 84rpx;
white-space: nowrap;
background: #fff;
border-top: 1px solid rgba(0,
0,
0,
0
.15);
overflow: hidden;
}
.cate-nav .item{
display: inline-block;
height: 84rpx;
min-width: 130rpx;
padding: 0 15rpx;
.cate-nav .item
{
display: inline-block;
height: 84rpx;
min-width: 130rpx;
padding: 0 15rpx;
}
.cate-nav .item .name{
display: block;
height: 84rpx;
padding: 0 20rpx;
line-height: 84rpx;
color: #333;
font-size: 30rpx;
width: auto;
.cate-nav .item .name
{
display: block;
height: 84rpx;
padding: 0 20rpx;
line-height: 84rpx;
color: #333;
font-size: 30rpx;
width: auto;
}
.cate-nav .item.active .name{
color: #a78845;
border-bottom: 2px solid #a78845;
.cate-nav .item.active .name
{
color: #a78845;
border-bottom: 2px solid #a78845;
}
.cate-item{
margin-top: 94rpx;
height: auto;
overflow: hidden;
.cate-item
{
margin-top: 94rpx;
height: auto;
overflow: hidden;
}
.cate-item .h{
height: 145rpx;
width: 750rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.cate-item .h
{
height: 145rpx;
width: 750rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.cate-item .h .name{
display: block;
height: 35rpx;
margin-bottom: 18rpx;
font-size: 30rpx;
color: #333;
.cate-item .h .name
{
display: block;
height: 35rpx;
margin-bottom: 18rpx;
font-size: 30rpx;
color: #333;
}
.cate-item .h .desc{
display: block;
height: 24rpx;
font-size: 24rpx;
color: #999;
}
\ No newline at end of file
.cate-item .h .desc {
display: block;
height: 24rpx;
font-size: 24rpx;
color: #999;
}
renard-wx/pages/comment/comment.js
View file @
286c0ae7
...
...
@@ -16,9 +16,12 @@ Page({
picPage
:
1
,
size
:
20
},
getCommentCount
:
function
()
{
getCommentCount
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
CommentCount
,
{
valueId
:
that
.
data
.
valueId
,
type
:
that
.
data
.
type
}).
then
(
function
(
res
)
{
util
.
request
(
api
.
CommentCount
,
{
valueId
:
that
.
data
.
valueId
,
type
:
that
.
data
.
type
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
allCount
:
res
.
data
.
allCount
,
...
...
@@ -27,15 +30,15 @@ Page({
}
});
},
getCommentList
:
function
(){
getCommentList
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
CommentList
,
{
valueId
:
that
.
data
.
valueId
,
util
.
request
(
api
.
CommentList
,
{
valueId
:
that
.
data
.
valueId
,
type
:
that
.
data
.
type
,
size
:
that
.
data
.
size
,
page
:
(
that
.
data
.
showType
==
0
?
that
.
data
.
allPage
:
that
.
data
.
picPage
),
showType
:
that
.
data
.
showType
}).
then
(
function
(
res
)
{
showType
:
that
.
data
.
showType
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
if
(
that
.
data
.
showType
==
0
)
{
...
...
@@ -54,7 +57,7 @@ Page({
}
});
},
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
this
.
setData
({
type
:
options
.
type
,
...
...
@@ -63,23 +66,23 @@ Page({
this
.
getCommentCount
();
this
.
getCommentList
();
},
onReady
:
function
()
{
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
onUnload
:
function
()
{
// 页面关闭
},
switchTab
:
function
()
{
switchTab
:
function
()
{
let
that
=
this
;
if
(
that
.
data
.
showType
==
0
)
{
that
.
setData
({
...
...
@@ -98,16 +101,16 @@ Page({
}
this
.
getCommentList
();
},
onReachBottom
:
function
(){
onReachBottom
:
function
()
{
console
.
log
(
'
onPullDownRefresh
'
);
if
(
this
.
data
.
showType
==
0
)
{
if
(
this
.
data
.
showType
==
0
)
{
if
(
this
.
data
.
allCount
/
this
.
data
.
size
<
this
.
data
.
allPage
)
{
return
false
;
}
this
.
setData
({
'
allPage
'
:
this
.
data
.
allPage
+
1
'
allPage
'
:
this
.
data
.
allPage
+
1
});
}
else
{
if
(
this
.
data
.
hasPicCount
/
this
.
data
.
size
<
this
.
data
.
picPage
)
{
...
...
renard-wx/pages/comment/comment.wxml
View file @
286c0ae7
<view class="comments">
<view class="h">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab">
<view class="txt">全部({{allCount}})</view>
</view>
<view class="item {{ showType == 0 ? '' : 'active'}}" bindtap="switchTab">
<view class="txt">有图({{hasPicCount}})</view>
</view>
<view class="h">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab">
<view class="txt">全部({{allCount}})</view>
</view>
<view class="item {{ showType == 0 ? '' : 'active'}}" bindtap="switchTab">
<view class="txt">有图({{hasPicCount}})</view>
</view>
</view>
<view class="b">
<view class="item" wx:for="{{comments}}" wx:key="id">
<view class="info">
...
...
renard-wx/pages/comment/comment.wxss
View file @
286c0ae7
.comments{
width: 100%;
height: auto;
padding-left:30rpx;
background: #fff;
margin: 20rpx 0;
.comments
{
width: 100%;
height: auto;
padding-left:
30rpx;
background: #fff;
margin: 20rpx 0;
}
.comments .h{
position: fixed;
left:0;
top:0;
z-index: 1000;
width: 100%;
display: flex;
background: #fff;
height: 84rpx;
border-bottom: 1px solid rgba(0,0,0,.15);
.comments .h
{
position: fixed;
left:
0;
top:
0;
z-index: 1000;
width: 100%;
display: flex;
background: #fff;
height: 84rpx;
border-bottom: 1px solid rgba(0,
0,
0,
0
.15);
}
.comments .h .item{
display: inline-block;
height: 82rpx;
width: 50%;
padding: 0 15rpx;
text-align: center;
.comments .h .item
{
display: inline-block;
height: 82rpx;
width: 50%;
padding: 0 15rpx;
text-align: center;
}
.comments .h .item .txt{
display: inline-block;
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
font-size: 30rpx;
width: 170rpx;
.comments .h .item .txt
{
display: inline-block;
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
font-size: 30rpx;
width: 170rpx;
}
.comments .h .item.active .txt{
color: #ab2b2b;
border-bottom: 4rpx solid #ab2b2b;
.comments .h .item.active .txt
{
color: #ab2b2b;
border-bottom: 4rpx solid #ab2b2b;
}
.comments .b{
margin-top: 85rpx;
height: auto;
width: 720rpx;
.comments .b
{
margin-top: 85rpx;
height: auto;
width: 720rpx;
}
.comments .b.no-h{
margin-top: 0;
.comments .b.no-h
{
margin-top: 0;
}
.comments .item{
height: auto;
width: 720rpx;
overflow: hidden;
border-bottom: 1px solid #d9d9d9;
padding-bottom: 25rpx;
.comments .item
{
height: auto;
width: 720rpx;
overflow: hidden;
border-bottom: 1px solid #d9d9d9;
padding-bottom: 25rpx;
}
.comments .info{
height: 127rpx;
width: 100%;
padding: 33rpx 0 27rpx 0;
.comments .info
{
height: 127rpx;
width: 100%;
padding: 33rpx 0 27rpx 0;
}
.comments .user{
float: left;
width: auto;
height: 67rpx;
line-height: 67rpx;
font-size: 0;
.comments .user
{
float: left;
width: auto;
height: 67rpx;
line-height: 67rpx;
font-size: 0;
}
.comments .user image{
float: left;
width: 67rpx;
height: 67rpx;
margin-right: 17rpx;
border-radius: 50%;
.comments .user image
{
float: left;
width: 67rpx;
height: 67rpx;
margin-right: 17rpx;
border-radius: 50%;
}
.comments .user text{
display: inline-block;
width: auto;
height: 66rpx;
overflow: hidden;
font-size: 29rpx;
line-height: 66rpx;
.comments .user text
{
display: inline-block;
width: auto;
height: 66rpx;
overflow: hidden;
font-size: 29rpx;
line-height: 66rpx;
}
.comments .time{
display: block;
float: right;
width: auto;
height: 67rpx;
line-height: 67rpx;
color: #7f7f7f;
font-size: 25rpx;
margin-right: 30rpx;
.comments .time
{
display: block;
float: right;
width: auto;
height: 67rpx;
line-height: 67rpx;
color: #7f7f7f;
font-size: 25rpx;
margin-right: 30rpx;
}
.comments .comment{
width: 720rpx;
padding-right: 30rpx;
line-height: 45.8rpx;
font-size: 29rpx;
margin-bottom: 16rpx;
.comments .comment
{
width: 720rpx;
padding-right: 30rpx;
line-height: 45.8rpx;
font-size: 29rpx;
margin-bottom: 16rpx;
}
.comments .imgs{
width: 720rpx;
height: 150rpx;
margin-bottom: 25rpx;
.comments .imgs
{
width: 720rpx;
height: 150rpx;
margin-bottom: 25rpx;
}
.comments .imgs .img{
height: 150rpx;
width: 150rpx;
margin-right: 28rpx;
.comments .imgs .img
{
height: 150rpx;
width: 150rpx;
margin-right: 28rpx;
}
.comments .spec{
width: 720rpx;
height: 25rpx;
font-size: 24rpx;
color: #999;
.comments .spec
{
width: 720rpx;
height: 25rpx;
font-size: 24rpx;
color: #999;
}
.comments .spec .item{
color: #7f7f7f;
font-size: 25rpx;
.comments .spec .item
{
color: #7f7f7f;
font-size: 25rpx;
}
.comments .customer-service{
width: 690rpx;
height: auto;
overflow: hidden;
margin-top: 23rpx;
background: rgba(0,0,0,.03);
padding: 21rpx;
.comments .customer-service
{
width: 690rpx;
height: auto;
overflow: hidden;
margin-top: 23rpx;
background: rgba(0,
0,
0,
0
.03);
padding: 21rpx;
}
.comments .customer-service .u{
font-size: 24rpx;
color: #333;
line-height: 37.5rpx;
.comments .customer-service .u {
font-size: 24rpx;
color: #333;
line-height: 37.5rpx;
}
.comments .customer-service .c{
font-size: 24rpx;
color: #999;
line-height: 37.5rpx;
}
\ No newline at end of file
.comments .customer-service .c {
font-size: 24rpx;
color: #999;
line-height: 37.5rpx;
}
renard-wx/pages/commentPost/commentPost.js
View file @
286c0ae7
...
...
@@ -16,7 +16,7 @@ Page({
picUrls
:
[],
files
:
[]
},
chooseImage
:
function
(
e
)
{
chooseImage
:
function
(
e
)
{
if
(
this
.
data
.
files
.
length
>=
5
)
{
util
.
showErrorToast
(
'
只能上传五张图片
'
)
return
false
;
...
...
@@ -27,7 +27,7 @@ Page({
count
:
1
,
sizeType
:
[
'
original
'
,
'
compressed
'
],
sourceType
:
[
'
album
'
,
'
camera
'
],
success
:
function
(
res
)
{
success
:
function
(
res
)
{
that
.
setData
({
files
:
that
.
data
.
files
.
concat
(
res
.
tempFilePaths
)
});
...
...
@@ -35,13 +35,13 @@ Page({
}
})
},
upload
:
function
(
res
)
{
upload
:
function
(
res
)
{
var
that
=
this
;
const
uploadTask
=
wx
.
uploadFile
({
url
:
api
.
StorageUpload
,
filePath
:
res
.
tempFilePaths
[
0
],
name
:
'
file
'
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
var
_res
=
JSON
.
parse
(
res
.
data
);
if
(
_res
.
errno
===
0
)
{
var
url
=
_res
.
data
.
url
...
...
@@ -52,7 +52,7 @@ Page({
})
}
},
fail
:
function
(
e
)
{
fail
:
function
(
e
)
{
wx
.
showModal
({
title
:
'
错误
'
,
content
:
'
上传失败
'
,
...
...
@@ -68,28 +68,24 @@ Page({
})
},
previewImage
:
function
(
e
)
{
previewImage
:
function
(
e
)
{
wx
.
previewImage
({
current
:
e
.
currentTarget
.
id
,
// 当前显示图片的http链接
urls
:
this
.
data
.
files
// 需要预览的图片http链接列表
})
},
selectRater
:
function
(
e
)
{
selectRater
:
function
(
e
)
{
var
star
=
e
.
currentTarget
.
dataset
.
star
+
1
;
var
starText
;
if
(
star
==
1
)
{
starText
=
'
很差
'
;
}
else
if
(
star
==
2
)
{
}
else
if
(
star
==
2
)
{
starText
=
'
不太满意
'
;
}
else
if
(
star
==
3
)
{
}
else
if
(
star
==
3
)
{
starText
=
'
满意
'
;
}
else
if
(
star
==
4
)
{
}
else
if
(
star
==
4
)
{
starText
=
'
比较满意
'
;
}
else
{
}
else
{
starText
=
'
十分满意
'
}
this
.
setData
({
...
...
@@ -98,7 +94,7 @@ Page({
})
},
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
var
that
=
this
;
that
.
setData
({
orderId
:
options
.
orderId
,
...
...
@@ -107,11 +103,12 @@ Page({
});
this
.
getOrderGoods
();
},
getOrderGoods
:
function
()
{
getOrderGoods
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
OrderGoods
,
{
orderId
:
that
.
data
.
orderId
,
goodsId
:
that
.
data
.
valueId
}).
then
(
function
(
res
)
{
orderId
:
that
.
data
.
orderId
,
goodsId
:
that
.
data
.
valueId
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
orderGoods
:
res
.
data
,
...
...
@@ -119,10 +116,10 @@ Page({
}
});
},
onClose
:
function
()
{
onClose
:
function
()
{
wx
.
navigateBack
();
},
onPost
:
function
()
{
onPost
:
function
()
{
let
that
=
this
;
if
(
!
this
.
data
.
content
)
{
...
...
@@ -137,11 +134,11 @@ Page({
star
:
that
.
data
.
star
,
hasPicture
:
that
.
data
.
hasPicture
,
picUrls
:
that
.
data
.
picUrls
},
'
POST
'
).
then
(
function
(
res
)
{
},
'
POST
'
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
wx
.
showToast
({
title
:
'
评论成功
'
,
complete
:
function
()
{
complete
:
function
()
{
wx
.
navigateBack
();
}
})
...
...
@@ -161,18 +158,18 @@ Page({
content
:
event
.
detail
.
value
,
})
},
onReady
:
function
()
{
onReady
:
function
()
{
},
onShow
:
function
()
{
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
onUnload
:
function
()
{
// 页面关闭
}
...
...
renard-wx/pages/goods/goods.js
View file @
286c0ae7
...
...
@@ -6,622 +6,621 @@ var api = require('../../config/api.js');
var
user
=
require
(
'
../../utils/user.js
'
);
Page
({
data
:
{
id
:
0
,
goods
:
{},
groupon
:
[],
//该商品支持的团购规格
grouponLink
:
{},
//参与的团购
attribute
:
[],
issueList
:
[],
comment
:
[],
brand
:
{},
specificationList
:
[],
productList
:
[],
relatedGoods
:
[],
cartGoodsCount
:
0
,
userHasCollect
:
0
,
number
:
1
,
checkedSpecText
:
'
规格数量选择
'
,
tmpSpecText
:
'
请选择规格数量
'
,
checkedSpecPrice
:
0
,
openAttr
:
false
,
noCollectImage
:
'
/static/images/icon_collect.png
'
,
hasCollectImage
:
'
/static/images/icon_collect_checked.png
'
,
collectImage
:
'
/static/images/icon_collect.png
'
,
shareImage
:
''
,
isGroupon
:
false
,
//标识是否是一个参团购买
soldout
:
false
},
// 页面分享
onShareAppMessage
:
function
()
{
let
that
=
this
;
return
{
title
:
that
.
data
.
goods
.
name
,
desc
:
'
唯爱与美食不可辜负
'
,
path
:
'
/pages/index/index?goodId=
'
+
this
.
data
.
id
}
},
showShare
:
function
()
{
this
.
sharePop
.
togglePopup
();
},
//从分享的团购进入
getGrouponInfo
:
function
(
grouponId
)
{
let
that
=
this
;
util
.
request
(
api
.
GroupOnJoin
,
{
grouponId
:
grouponId
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
grouponLink
:
res
.
data
.
groupon
,
id
:
res
.
data
.
goods
.
id
});
//获取商品详情
that
.
getGoodsInfo
();
}
});
},
// 获取商品信息
getGoodsInfo
:
function
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
let
that
=
this
;
util
.
request
(
api
.
GoodsDetail
,
{
id
:
that
.
data
.
id
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
let
_specificationList
=
res
.
data
.
specificationList
// 如果仅仅存在一种货品,那么商品页面初始化时默认checked
if
(
_specificationList
.
length
==
1
)
{
if
(
_specificationList
[
0
].
valueList
.
length
==
1
)
{
_specificationList
[
0
].
valueList
[
0
].
checked
=
true
// 如果仅仅存在一种货品,那么商品价格应该和货品价格一致
// 这里检测一下
let
_productPrice
=
res
.
data
.
productList
[
0
].
price
;
let
_goodsPrice
=
res
.
data
.
info
.
retailPrice
;
if
(
_productPrice
!=
_goodsPrice
)
{
console
.
error
(
'
商品数量价格和货品不一致
'
);
}
that
.
setData
({
checkedSpecText
:
_specificationList
[
0
].
valueList
[
0
].
value
,
tmpSpecText
:
'
已选择:
'
+
_specificationList
[
0
].
valueList
[
0
].
value
,
});
}
data
:
{
id
:
0
,
goods
:
{},
groupon
:
[],
//该商品支持的团购规格
grouponLink
:
{},
//参与的团购
attribute
:
[],
issueList
:
[],
comment
:
[],
brand
:
{},
specificationList
:
[],
productList
:
[],
relatedGoods
:
[],
cartGoodsCount
:
0
,
userHasCollect
:
0
,
number
:
1
,
checkedSpecText
:
'
规格数量选择
'
,
tmpSpecText
:
'
请选择规格数量
'
,
checkedSpecPrice
:
0
,
openAttr
:
false
,
noCollectImage
:
'
/static/images/icon_collect.png
'
,
hasCollectImage
:
'
/static/images/icon_collect_checked.png
'
,
collectImage
:
'
/static/images/icon_collect.png
'
,
shareImage
:
''
,
isGroupon
:
false
,
//标识是否是一个参团购买
soldout
:
false
},
// 页面分享
onShareAppMessage
:
function
()
{
let
that
=
this
;
return
{
title
:
that
.
data
.
goods
.
name
,
desc
:
'
唯爱与美食不可辜负
'
,
path
:
'
/pages/index/index?goodId=
'
+
this
.
data
.
id
}
},
showShare
:
function
()
{
this
.
sharePop
.
togglePopup
();
},
//从分享的团购进入
getGrouponInfo
:
function
(
grouponId
)
{
let
that
=
this
;
util
.
request
(
api
.
GroupOnJoin
,
{
grouponId
:
grouponId
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
grouponLink
:
res
.
data
.
groupon
,
id
:
res
.
data
.
goods
.
id
});
//获取商品详情
that
.
getGoodsInfo
();
}
});
},
that
.
setData
({
goods
:
res
.
data
.
info
,
attribute
:
res
.
data
.
attribute
,
issueList
:
res
.
data
.
issue
,
comment
:
res
.
data
.
comment
,
brand
:
res
.
data
.
brand
,
specificationList
:
res
.
data
.
specificationList
,
productList
:
res
.
data
.
productList
,
userHasCollect
:
res
.
data
.
userHasCollect
,
shareImage
:
res
.
data
.
shareImage
,
checkedSpecPrice
:
res
.
data
.
info
.
retailPrice
,
groupon
:
res
.
data
.
groupon
// 获取商品信息
getGoodsInfo
:
function
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
//如果是通过分享的团购参加团购,则团购项目应该与分享的一致并且不可更改
if
(
that
.
data
.
isGroupon
)
{
let
groupons
=
that
.
data
.
groupon
;
for
(
var
i
=
0
;
i
<
groupons
.
length
;
i
++
)
{
if
(
groupons
[
i
].
id
!=
that
.
data
.
grouponLink
.
rulesId
)
{
groupons
.
splice
(
i
,
1
);
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
let
that
=
this
;
util
.
request
(
api
.
GoodsDetail
,
{
id
:
that
.
data
.
id
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
let
_specificationList
=
res
.
data
.
specificationList
// 如果仅仅存在一种货品,那么商品页面初始化时默认checked
if
(
_specificationList
.
length
==
1
)
{
if
(
_specificationList
[
0
].
valueList
.
length
==
1
)
{
_specificationList
[
0
].
valueList
[
0
].
checked
=
true
// 如果仅仅存在一种货品,那么商品价格应该和货品价格一致
// 这里检测一下
let
_productPrice
=
res
.
data
.
productList
[
0
].
price
;
let
_goodsPrice
=
res
.
data
.
info
.
retailPrice
;
if
(
_productPrice
!=
_goodsPrice
)
{
console
.
error
(
'
商品数量价格和货品不一致
'
);
}
that
.
setData
({
checkedSpecText
:
_specificationList
[
0
].
valueList
[
0
].
value
,
tmpSpecText
:
'
已选择:
'
+
_specificationList
[
0
].
valueList
[
0
].
value
,
});
}
}
that
.
setData
({
goods
:
res
.
data
.
info
,
attribute
:
res
.
data
.
attribute
,
issueList
:
res
.
data
.
issue
,
comment
:
res
.
data
.
comment
,
brand
:
res
.
data
.
brand
,
specificationList
:
res
.
data
.
specificationList
,
productList
:
res
.
data
.
productList
,
userHasCollect
:
res
.
data
.
userHasCollect
,
shareImage
:
res
.
data
.
shareImage
,
checkedSpecPrice
:
res
.
data
.
info
.
retailPrice
,
groupon
:
res
.
data
.
groupon
});
//如果是通过分享的团购参加团购,则团购项目应该与分享的一致并且不可更改
if
(
that
.
data
.
isGroupon
)
{
let
groupons
=
that
.
data
.
groupon
;
for
(
var
i
=
0
;
i
<
groupons
.
length
;
i
++
)
{
if
(
groupons
[
i
].
id
!=
that
.
data
.
grouponLink
.
rulesId
)
{
groupons
.
splice
(
i
,
1
);
}
}
groupons
[
0
].
checked
=
true
;
//重设团购规格
that
.
setData
({
groupon
:
groupons
});
}
if
(
res
.
data
.
userHasCollect
==
1
)
{
that
.
setData
({
collectImage
:
that
.
data
.
hasCollectImage
});
}
else
{
that
.
setData
({
collectImage
:
that
.
data
.
noCollectImage
});
}
WxParse
.
wxParse
(
'
goodsDetail
'
,
'
html
'
,
res
.
data
.
info
.
detail
,
that
);
//获取推荐商品
that
.
getGoodsRelated
();
wx
.
hideLoading
();
}
}
groupons
[
0
].
checked
=
true
;
//重设团购规格
that
.
setData
({
groupon
:
groupons
});
});
},
// 获取推荐商品
getGoodsRelated
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsRelated
,
{
id
:
that
.
data
.
id
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
relatedGoods
:
res
.
data
.
goodsList
,
});
}
});
},
}
// 团购选择
clickGroupon
:
function
(
event
)
{
let
that
=
this
;
if
(
res
.
data
.
userHasCollect
==
1
)
{
that
.
setData
({
collectImage
:
that
.
data
.
hasCollectImage
});
}
else
{
that
.
setData
({
collectImage
:
that
.
data
.
noCollectImage
});
//参与团购,不可更改选择
if
(
that
.
data
.
isGroupon
)
{
return
;
}
WxParse
.
wxParse
(
'
goodsDetail
'
,
'
html
'
,
res
.
data
.
info
.
detail
,
that
);
//获取推荐商品
that
.
getGoodsRelated
();
wx
.
hideLoading
();
}
});
},
// 获取推荐商品
getGoodsRelated
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsRelated
,
{
id
:
that
.
data
.
id
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
relatedGoods
:
res
.
data
.
goodsList
,
});
}
});
},
// 团购选择
clickGroupon
:
function
(
event
)
{
let
that
=
this
;
//参与团购,不可更改选择
if
(
that
.
data
.
isGroupon
)
{
return
;
}
let
specName
=
event
.
currentTarget
.
dataset
.
name
;
let
specValueId
=
event
.
currentTarget
.
dataset
.
valueId
;
let
_grouponList
=
this
.
data
.
groupon
;
for
(
let
i
=
0
;
i
<
_grouponList
.
length
;
i
++
)
{
if
(
_grouponList
[
i
].
id
==
specValueId
)
{
if
(
_grouponList
[
i
].
checked
)
{
_grouponList
[
i
].
checked
=
false
;
}
else
{
_grouponList
[
i
].
checked
=
true
;
}
}
else
{
_grouponList
[
i
].
checked
=
false
;
}
}
this
.
setData
({
groupon
:
_grouponList
,
});
},
// 规格选择
clickSkuValue
:
function
(
event
)
{
let
that
=
this
;
let
specName
=
event
.
currentTarget
.
dataset
.
name
;
let
specValueId
=
event
.
currentTarget
.
dataset
.
valueId
;
//判断是否可以点击
//TODO 性能优化,可在wx:for中添加index,可以直接获取点击的属性名和属性值,不用循环
let
_specificationList
=
this
.
data
.
specificationList
;
for
(
let
i
=
0
;
i
<
_specificationList
.
length
;
i
++
)
{
if
(
_specificationList
[
i
].
name
===
specName
)
{
for
(
let
j
=
0
;
j
<
_specificationList
[
i
].
valueList
.
length
;
j
++
)
{
if
(
_specificationList
[
i
].
valueList
[
j
].
id
==
specValueId
)
{
//如果已经选中,则反选
if
(
_specificationList
[
i
].
valueList
[
j
].
checked
)
{
_specificationList
[
i
].
valueList
[
j
].
checked
=
false
;
let
specName
=
event
.
currentTarget
.
dataset
.
name
;
let
specValueId
=
event
.
currentTarget
.
dataset
.
valueId
;
let
_grouponList
=
this
.
data
.
groupon
;
for
(
let
i
=
0
;
i
<
_grouponList
.
length
;
i
++
)
{
if
(
_grouponList
[
i
].
id
==
specValueId
)
{
if
(
_grouponList
[
i
].
checked
)
{
_grouponList
[
i
].
checked
=
false
;
}
else
{
_grouponList
[
i
].
checked
=
true
;
}
}
else
{
_specificationList
[
i
].
valueList
[
j
].
checked
=
tru
e
;
_grouponList
[
i
].
checked
=
fals
e
;
}
}
else
{
_specificationList
[
i
].
valueList
[
j
].
checked
=
false
;
}
}
}
}
this
.
setData
({
specificationList
:
_specificationList
,
});
//重新计算spec改变后的信息
this
.
changeSpecInfo
();
//重新计算哪些值不可以点击
},
//获取选中的团购信息
getCheckedGrouponValue
:
function
()
{
let
checkedValues
=
{};
let
_grouponList
=
this
.
data
.
groupon
;
for
(
let
i
=
0
;
i
<
_grouponList
.
length
;
i
++
)
{
if
(
_grouponList
[
i
].
checked
)
{
checkedValues
=
_grouponList
[
i
];
}
}
return
checkedValues
;
},
//获取选中的规格信息
getCheckedSpecValue
:
function
()
{
let
checkedValues
=
[];
let
_specificationList
=
this
.
data
.
specificationList
;
for
(
let
i
=
0
;
i
<
_specificationList
.
length
;
i
++
)
{
let
_checkedObj
=
{
name
:
_specificationList
[
i
].
name
,
valueId
:
0
,
valueText
:
''
};
for
(
let
j
=
0
;
j
<
_specificationList
[
i
].
valueList
.
length
;
j
++
)
{
if
(
_specificationList
[
i
].
valueList
[
j
].
checked
)
{
_checkedObj
.
valueId
=
_specificationList
[
i
].
valueList
[
j
].
id
;
_checkedObj
.
valueText
=
_specificationList
[
i
].
valueList
[
j
].
value
;
this
.
setData
({
groupon
:
_grouponList
,
});
},
// 规格选择
clickSkuValue
:
function
(
event
)
{
let
that
=
this
;
let
specName
=
event
.
currentTarget
.
dataset
.
name
;
let
specValueId
=
event
.
currentTarget
.
dataset
.
valueId
;
//判断是否可以点击
//TODO 性能优化,可在wx:for中添加index,可以直接获取点击的属性名和属性值,不用循环
let
_specificationList
=
this
.
data
.
specificationList
;
for
(
let
i
=
0
;
i
<
_specificationList
.
length
;
i
++
)
{
if
(
_specificationList
[
i
].
name
===
specName
)
{
for
(
let
j
=
0
;
j
<
_specificationList
[
i
].
valueList
.
length
;
j
++
)
{
if
(
_specificationList
[
i
].
valueList
[
j
].
id
==
specValueId
)
{
//如果已经选中,则反选
if
(
_specificationList
[
i
].
valueList
[
j
].
checked
)
{
_specificationList
[
i
].
valueList
[
j
].
checked
=
false
;
}
else
{
_specificationList
[
i
].
valueList
[
j
].
checked
=
true
;
}
}
else
{
_specificationList
[
i
].
valueList
[
j
].
checked
=
false
;
}
}
}
}
}
checkedValues
.
push
(
_checkedObj
);
}
return
checkedValues
;
},
//判断规格是否选择完整
isCheckedAllSpec
:
function
()
{
return
!
this
.
getCheckedSpecValue
().
some
(
function
(
v
)
{
if
(
v
.
valueId
==
0
)
{
return
true
;
}
});
},
soldoutNotify
:
function
()
{
Notify
(
"
商品已售完
"
);
},
getCheckedSpecKey
:
function
()
{
let
checkedValue
=
this
.
getCheckedSpecValue
().
map
(
function
(
v
)
{
return
v
.
valueText
;
});
return
checkedValue
;
},
// 规格改变时,重新计算价格及显示信息
changeSpecInfo
:
function
()
{
let
checkedNameValue
=
this
.
getCheckedSpecValue
();
//设置选择的信息
let
checkedValue
=
checkedNameValue
.
filter
(
function
(
v
)
{
if
(
v
.
valueId
!=
0
)
{
return
true
;
}
else
{
return
false
;
}
}).
map
(
function
(
v
)
{
return
v
.
valueText
;
});
if
(
checkedValue
.
length
>
0
)
{
this
.
setData
({
tmpSpecText
:
checkedValue
.
join
(
'
'
)
});
}
else
{
this
.
setData
({
tmpSpecText
:
'
请选择规格数量
'
});
}
if
(
this
.
isCheckedAllSpec
())
{
this
.
setData
({
checkedSpecText
:
this
.
data
.
tmpSpecText
});
// 规格所对应的货品选择以后
let
checkedProductArray
=
this
.
getCheckedProductItem
(
this
.
getCheckedSpecKey
());
if
(
!
checkedProductArray
||
checkedProductArray
.
length
<=
0
)
{
this
.
setData
({
soldout
:
true
specificationList
:
_specificationList
,
});
this
.
soldoutNotify
();
console
.
error
(
'
规格所对应货品不存在
'
);
return
;
}
//重新计算spec改变后的信息
this
.
changeSpecInfo
();
//重新计算哪些值不可以点击
},
//获取选中的团购信息
getCheckedGrouponValue
:
function
()
{
let
checkedValues
=
{};
let
_grouponList
=
this
.
data
.
groupon
;
for
(
let
i
=
0
;
i
<
_grouponList
.
length
;
i
++
)
{
if
(
_grouponList
[
i
].
checked
)
{
checkedValues
=
_grouponList
[
i
];
}
}
let
checkedProduct
=
checkedProductArray
[
0
];
if
(
checkedProduct
.
number
>
0
)
{
this
.
setData
({
checkedSpecPrice
:
checkedProduct
.
price
,
soldout
:
false
return
checkedValues
;
},
//获取选中的规格信息
getCheckedSpecValue
:
function
()
{
let
checkedValues
=
[];
let
_specificationList
=
this
.
data
.
specificationList
;
for
(
let
i
=
0
;
i
<
_specificationList
.
length
;
i
++
)
{
let
_checkedObj
=
{
name
:
_specificationList
[
i
].
name
,
valueId
:
0
,
valueText
:
''
};
for
(
let
j
=
0
;
j
<
_specificationList
[
i
].
valueList
.
length
;
j
++
)
{
if
(
_specificationList
[
i
].
valueList
[
j
].
checked
)
{
_checkedObj
.
valueId
=
_specificationList
[
i
].
valueList
[
j
].
id
;
_checkedObj
.
valueText
=
_specificationList
[
i
].
valueList
[
j
].
value
;
}
}
checkedValues
.
push
(
_checkedObj
);
}
return
checkedValues
;
},
//判断规格是否选择完整
isCheckedAllSpec
:
function
()
{
return
!
this
.
getCheckedSpecValue
().
some
(
function
(
v
)
{
if
(
v
.
valueId
==
0
)
{
return
true
;
}
});
this
.
notify
.
hide
();
}
else
{
this
.
setData
({
checkedSpecPrice
:
this
.
data
.
goods
.
retailPrice
,
soldout
:
true
},
soldoutNotify
:
function
()
{
Notify
(
"
商品已售完
"
);
},
getCheckedSpecKey
:
function
()
{
let
checkedValue
=
this
.
getCheckedSpecValue
().
map
(
function
(
v
)
{
return
v
.
valueText
;
});
this
.
soldoutNotify
()
;
}
return
checkedValue
;
}
,
}
else
{
this
.
setData
({
checkedSpecText
:
'
规格数量选择
'
,
checkedSpecPrice
:
this
.
data
.
goods
.
retailPrice
,
soldout
:
false
});
this
.
notify
.
hide
();
}
},
// 获取选中的产品(根据规格)
getCheckedProductItem
:
function
(
key
)
{
return
this
.
data
.
productList
.
filter
(
function
(
v
)
{
if
(
v
.
specifications
.
toString
()
==
key
.
toString
())
{
return
true
;
}
else
{
return
false
;
}
});
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
if
(
options
.
id
)
{
this
.
setData
({
id
:
parseInt
(
options
.
id
)
});
this
.
getGoodsInfo
();
}
if
(
options
.
grouponId
)
{
this
.
setData
({
isGroupon
:
true
,
});
this
.
getGrouponInfo
(
options
.
grouponId
);
}
},
onShow
:
function
()
{
// 页面显示
var
that
=
this
;
util
.
request
(
api
.
CartGoodsCount
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
cartGoodsCount
:
res
.
data
// 规格改变时,重新计算价格及显示信息
changeSpecInfo
:
function
()
{
let
checkedNameValue
=
this
.
getCheckedSpecValue
();
//设置选择的信息
let
checkedValue
=
checkedNameValue
.
filter
(
function
(
v
)
{
if
(
v
.
valueId
!=
0
)
{
return
true
;
}
else
{
return
false
;
}
}).
map
(
function
(
v
)
{
return
v
.
valueText
;
});
}
});
},
//添加或是取消收藏
addCollectOrNot
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
CollectAddOrDelete
,
{
type
:
0
,
valueId
:
this
.
data
.
id
},
"
POST
"
)
.
then
(
function
(
res
)
{
let
_res
=
res
;
if
(
_res
.
errno
==
0
)
{
if
(
_res
.
data
.
type
==
'
add
'
)
{
that
.
setData
({
collectImage
:
that
.
data
.
hasCollectImage
if
(
checkedValue
.
length
>
0
)
{
this
.
setData
({
tmpSpecText
:
checkedValue
.
join
(
'
'
)
});
}
else
{
this
.
setData
({
tmpSpecText
:
'
请选择规格数量
'
});
}
else
{
that
.
setData
({
collectImage
:
that
.
data
.
noCollectImage
}
if
(
this
.
isCheckedAllSpec
())
{
this
.
setData
({
checkedSpecText
:
this
.
data
.
tmpSpecText
});
}
// 规格所对应的货品选择以后
let
checkedProductArray
=
this
.
getCheckedProductItem
(
this
.
getCheckedSpecKey
());
if
(
!
checkedProductArray
||
checkedProductArray
.
length
<=
0
)
{
this
.
setData
({
soldout
:
true
});
this
.
soldoutNotify
();
console
.
error
(
'
规格所对应货品不存在
'
);
return
;
}
let
checkedProduct
=
checkedProductArray
[
0
];
if
(
checkedProduct
.
number
>
0
)
{
this
.
setData
({
checkedSpecPrice
:
checkedProduct
.
price
,
soldout
:
false
});
this
.
notify
.
hide
();
}
else
{
this
.
setData
({
checkedSpecPrice
:
this
.
data
.
goods
.
retailPrice
,
soldout
:
true
});
this
.
soldoutNotify
();
}
}
else
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
_res
.
errmsg
,
mask
:
true
});
this
.
setData
({
checkedSpecText
:
'
规格数量选择
'
,
checkedSpecPrice
:
this
.
data
.
goods
.
retailPrice
,
soldout
:
false
});
this
.
notify
.
hide
();
}
});
},
//立即购买(先自动加入购物车)
addFast
:
function
()
{
var
that
=
this
;
if
(
this
.
data
.
openAttr
==
false
)
{
//打开规格选择窗口
this
.
setData
({
openAttr
:
!
this
.
data
.
openAttr
});
}
else
{
//提示选择完整规格
if
(
!
this
.
isCheckedAllSpec
())
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
请选择完整规格
'
});
return
false
;
}
//根据选中的规格,判断是否有对应的sku信息
let
checkedProductArray
=
this
.
getCheckedProductItem
(
this
.
getCheckedSpecKey
());
if
(
!
checkedProductArray
||
checkedProductArray
.
length
<=
0
)
{
//找不到对应的product信息,提示没有库存
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
没有库存
'
});
return
false
;
}
let
checkedProduct
=
checkedProductArray
[
0
];
//验证库存
if
(
checkedProduct
.
number
<=
0
)
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
没有库存
'
},
// 获取选中的产品(根据规格)
getCheckedProductItem
:
function
(
key
)
{
return
this
.
data
.
productList
.
filter
(
function
(
v
)
{
if
(
v
.
specifications
.
toString
()
==
key
.
toString
())
{
return
true
;
}
else
{
return
false
;
}
});
return
false
;
}
//验证团购是否有效
let
checkedGroupon
=
this
.
getCheckedGrouponValue
();
//立即购买
util
.
request
(
api
.
CartFastAdd
,
{
goodsId
:
this
.
data
.
goods
.
id
,
number
:
this
.
data
.
number
,
productId
:
checkedProduct
.
id
},
"
POST
"
)
.
then
(
function
(
res
)
{
if
(
res
.
errno
==
0
)
{
// 如果storage中设置了cartId,则是立即购买,否则是购物车购买
try
{
wx
.
setStorageSync
(
'
cartId
'
,
res
.
data
);
wx
.
setStorageSync
(
'
grouponRulesId
'
,
checkedGroupon
.
id
);
wx
.
setStorageSync
(
'
grouponLinkId
'
,
that
.
data
.
grouponLink
.
id
);
wx
.
navigateTo
({
url
:
'
/pages/shopping/checkout/checkout
'
})
}
catch
(
e
)
{}
}
else
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
res
.
errmsg
,
mask
:
true
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
if
(
options
.
id
)
{
this
.
setData
({
id
:
parseInt
(
options
.
id
)
});
}
});
}
},
//添加到购物车
addToCart
:
function
()
{
var
that
=
this
;
if
(
this
.
data
.
openAttr
==
false
)
{
//打开规格选择窗口
this
.
setData
({
openAttr
:
!
this
.
data
.
openAttr
});
}
else
{
//提示选择完整规格
if
(
!
this
.
isCheckedAllSpec
())
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
请选择完整规格
'
});
return
false
;
}
//根据选中的规格,判断是否有对应的sku信息
let
checkedProductArray
=
this
.
getCheckedProductItem
(
this
.
getCheckedSpecKey
());
if
(
!
checkedProductArray
||
checkedProductArray
.
length
<=
0
)
{
//找不到对应的product信息,提示没有库存
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
没有库存
'
});
return
false
;
}
let
checkedProduct
=
checkedProductArray
[
0
];
//验证库存
if
(
checkedProduct
.
number
<=
0
)
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
没有库存
'
this
.
getGoodsInfo
();
}
if
(
options
.
grouponId
)
{
this
.
setData
({
isGroupon
:
true
,
});
this
.
getGrouponInfo
(
options
.
grouponId
);
}
},
onShow
:
function
()
{
// 页面显示
var
that
=
this
;
util
.
request
(
api
.
CartGoodsCount
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
cartGoodsCount
:
res
.
data
});
}
});
return
false
;
}
//添加到购物车
util
.
request
(
api
.
CartAdd
,
{
goodsId
:
this
.
data
.
goods
.
id
,
number
:
this
.
data
.
number
,
productId
:
checkedProduct
.
id
},
"
POST
"
)
.
then
(
function
(
res
)
{
let
_res
=
res
;
if
(
_res
.
errno
==
0
)
{
wx
.
showToast
({
title
:
'
添加成功
'
},
//添加或是取消收藏
addCollectOrNot
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
CollectAddOrDelete
,
{
type
:
0
,
valueId
:
this
.
data
.
id
},
"
POST
"
)
.
then
(
function
(
res
)
{
let
_res
=
res
;
if
(
_res
.
errno
==
0
)
{
if
(
_res
.
data
.
type
==
'
add
'
)
{
that
.
setData
({
collectImage
:
that
.
data
.
hasCollectImage
});
}
else
{
that
.
setData
({
collectImage
:
that
.
data
.
noCollectImage
});
}
}
else
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
_res
.
errmsg
,
mask
:
true
});
}
});
that
.
setData
({
openAttr
:
!
that
.
data
.
openAttr
,
cartGoodsCount
:
_res
.
data
},
//立即购买(先自动加入购物车)
addFast
:
function
()
{
var
that
=
this
;
if
(
this
.
data
.
openAttr
==
false
)
{
//打开规格选择窗口
this
.
setData
({
openAttr
:
!
this
.
data
.
openAttr
});
if
(
that
.
data
.
userHasCollect
==
1
)
{
that
.
setData
({
collectImage
:
that
.
data
.
hasCollectImage
});
}
else
{
that
.
setData
({
collectImage
:
that
.
data
.
noCollectImage
});
}
else
{
//提示选择完整规格
if
(
!
this
.
isCheckedAllSpec
())
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
请选择完整规格
'
});
return
false
;
}
//根据选中的规格,判断是否有对应的sku信息
let
checkedProductArray
=
this
.
getCheckedProductItem
(
this
.
getCheckedSpecKey
());
if
(
!
checkedProductArray
||
checkedProductArray
.
length
<=
0
)
{
//找不到对应的product信息,提示没有库存
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
没有库存
'
});
return
false
;
}
let
checkedProduct
=
checkedProductArray
[
0
];
//验证库存
if
(
checkedProduct
.
number
<=
0
)
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
没有库存
'
});
return
false
;
}
}
else
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
_res
.
errmsg
,
mask
:
true
//验证团购是否有效
let
checkedGroupon
=
this
.
getCheckedGrouponValue
();
//立即购买
util
.
request
(
api
.
CartFastAdd
,
{
goodsId
:
this
.
data
.
goods
.
id
,
number
:
this
.
data
.
number
,
productId
:
checkedProduct
.
id
},
"
POST
"
)
.
then
(
function
(
res
)
{
if
(
res
.
errno
==
0
)
{
// 如果storage中设置了cartId,则是立即购买,否则是购物车购买
try
{
wx
.
setStorageSync
(
'
cartId
'
,
res
.
data
);
wx
.
setStorageSync
(
'
grouponRulesId
'
,
checkedGroupon
.
id
);
wx
.
setStorageSync
(
'
grouponLinkId
'
,
that
.
data
.
grouponLink
.
id
);
wx
.
navigateTo
({
url
:
'
/pages/shopping/checkout/checkout
'
})
}
catch
(
e
)
{}
}
else
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
res
.
errmsg
,
mask
:
true
});
}
});
}
},
//添加到购物车
addToCart
:
function
()
{
var
that
=
this
;
if
(
this
.
data
.
openAttr
==
false
)
{
//打开规格选择窗口
this
.
setData
({
openAttr
:
!
this
.
data
.
openAttr
});
}
else
{
//提示选择完整规格
if
(
!
this
.
isCheckedAllSpec
())
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
请选择完整规格
'
});
return
false
;
}
//根据选中的规格,判断是否有对应的sku信息
let
checkedProductArray
=
this
.
getCheckedProductItem
(
this
.
getCheckedSpecKey
());
if
(
!
checkedProductArray
||
checkedProductArray
.
length
<=
0
)
{
//找不到对应的product信息,提示没有库存
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
没有库存
'
});
return
false
;
}
let
checkedProduct
=
checkedProductArray
[
0
];
//验证库存
if
(
checkedProduct
.
number
<=
0
)
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
'
没有库存
'
});
return
false
;
}
//添加到购物车
util
.
request
(
api
.
CartAdd
,
{
goodsId
:
this
.
data
.
goods
.
id
,
number
:
this
.
data
.
number
,
productId
:
checkedProduct
.
id
},
"
POST
"
)
.
then
(
function
(
res
)
{
let
_res
=
res
;
if
(
_res
.
errno
==
0
)
{
wx
.
showToast
({
title
:
'
添加成功
'
});
that
.
setData
({
openAttr
:
!
that
.
data
.
openAttr
,
cartGoodsCount
:
_res
.
data
});
if
(
that
.
data
.
userHasCollect
==
1
)
{
that
.
setData
({
collectImage
:
that
.
data
.
hasCollectImage
});
}
else
{
that
.
setData
({
collectImage
:
that
.
data
.
noCollectImage
});
}
}
else
{
wx
.
showToast
({
image
:
'
/static/images/icon_error.png
'
,
title
:
_res
.
errmsg
,
mask
:
true
});
}
});
}
},
cutNumber
:
function
()
{
this
.
setData
({
number
:
(
this
.
data
.
number
-
1
>
1
)
?
this
.
data
.
number
-
1
:
1
});
},
addNumber
:
function
()
{
this
.
setData
({
number
:
this
.
data
.
number
+
1
});
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
switchAttrPop
:
function
()
{
if
(
this
.
data
.
openAttr
==
false
)
{
this
.
setData
({
openAttr
:
!
this
.
data
.
openAttr
});
}
}
},
closeAttr
:
function
()
{
this
.
setData
({
openAttr
:
false
,
});
},
openCartPage
:
function
()
{
wx
.
switchTab
({
url
:
'
/pages/cart/cart
'
});
}
},
cutNumber
:
function
()
{
this
.
setData
({
number
:
(
this
.
data
.
number
-
1
>
1
)
?
this
.
data
.
number
-
1
:
1
});
},
addNumber
:
function
()
{
this
.
setData
({
number
:
this
.
data
.
number
+
1
});
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
switchAttrPop
:
function
()
{
if
(
this
.
data
.
openAttr
==
false
)
{
this
.
setData
({
openAttr
:
!
this
.
data
.
openAttr
});
}
},
closeAttr
:
function
()
{
this
.
setData
({
openAttr
:
false
,
});
},
openCartPage
:
function
()
{
wx
.
switchTab
({
url
:
'
/pages/cart/cart
'
});
},
onReady
:
function
()
{
// 页面渲染完成
this
.
sharePop
=
this
.
selectComponent
(
"
#sharePop
"
);
this
.
notify
=
this
.
selectComponent
(
"
#van-notify
"
);
},
// 下拉刷新
onPullDownRefresh
()
{
wx
.
showNavigationBarLoading
()
//在标题栏中显示加载
this
.
getGoodsInfo
();
wx
.
hideNavigationBarLoading
()
//完成停止加载
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
//根据已选的值,计算其它值的状态
setSpecValueStatus
:
function
()
{
},
},
onReady
:
function
()
{
// 页面渲染完成
this
.
sharePop
=
this
.
selectComponent
(
"
#sharePop
"
);
this
.
notify
=
this
.
selectComponent
(
"
#van-notify
"
);
},
// 下拉刷新
onPullDownRefresh
()
{
wx
.
showNavigationBarLoading
()
//在标题栏中显示加载
this
.
getGoodsInfo
();
wx
.
hideNavigationBarLoading
()
//完成停止加载
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
//根据已选的值,计算其它值的状态
setSpecValueStatus
:
function
()
{},
})
\ No newline at end of file
renard-wx/pages/goods/goods.json
View file @
286c0ae7
{
"navigationBarTitleText"
:
"商品详情"
,
"usingComponents"
:
{
"sharePop"
:
"/components/sharePop/sharePop"
,
"goodList"
:
"/components/goodList/goodList"
,
"van-notify"
:
"
../..
/components/notify/index"
}
"navigationBarTitleText"
:
"商品详情"
,
"usingComponents"
:
{
"sharePop"
:
"/components/sharePop/sharePop"
,
"goodList"
:
"/components/goodList/goodList"
,
"van-notify"
:
"/components/notify/index"
}
}
\ No newline at end of file
renard-wx/pages/goods/goods.wxml
View file @
286c0ae7
<view class="container">
<swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{goods.gallery}}" wx:key="*this">
<image src="{{item}}" background-size="cover"></image>
</swiper-item>
</swiper>
<!-- 商品信息 -->
<view class="goods-info">
<view class="c">
<text class="name">{{goods.name}}</text>
<text class="desc">{{goods.brief}}</text>
<view class="price">
<view class="counterPrice">原价:¥{{goods.counterPrice}}</view>
<view class="retailPrice">现价:¥{{checkedSpecPrice}}</view>
</view>
<view class="brand" wx:if="{{brand.name}}">
<navigator url="../brandDetail/brandDetail?id={{brand.id}}">
<text>{{brand.name}}</text>
</navigator>
</view>
<swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{goods.gallery}}" wx:key="*this">
<image src="{{item}}" background-size="cover"></image>
</swiper-item>
</swiper>
<!-- 商品信息 -->
<view class="goods-info">
<view class="c">
<text class="name">{{goods.name}}</text>
<text class="desc">{{goods.brief}}</text>
<view class="price">
<view class="counterPrice">原价:¥{{goods.counterPrice}}</view>
<view class="retailPrice">现价:¥{{checkedSpecPrice}}</view>
</view>
<view class="brand" wx:if="{{brand.name}}">
<navigator url="../brandDetail/brandDetail?id={{brand.id}}">
<text>{{brand.name}}</text>
</navigator>
</view>
</view>
</view>
</view>
<!-- 规格框体 -->
<view class="section-nav section-attr" bindtap="switchAttrPop">
<view class="t">{{checkedSpecText}}</view>
<image class="i" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<view class="goods-attr">
<view class="t">商品参数</view>
<view class="l">
<view class="item" wx:for="{{attribute}}" wx:key="name">
<text class="left">{{item.attribute}}</text>
<text class="right">{{item.value}}</text>
</view>
<!-- 规格框体 -->
<view class="section-nav section-attr" bindtap="switchAttrPop">
<view class="t">{{checkedSpecText}}</view>
<image class="i" src="/static/images/address_right.png" background-size="cover"></image>
</view>
</view>
<view class="detail">
<import src="/lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
</view>
<view class="goods-attr">
<view class="t">商品参数</view>
<view class="l">
<view class="item" wx:for="{{attribute}}" wx:key="name">
<text class="left">{{item.attribute}}</text>
<text class="right">{{item.value}}</text>
</view>
</view>
</view>
<view class="common-problem">
<view class="h">
<view class="line"></view>
<text class="title">常见问题</text>
<view class="detail">
<import src="/lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
</view>
<view class="b">
<view class="
item" wx:for="{{issueList}}" wx:key="id
">
<view class="
question-box
">
<text
class="
spot"></text
>
<text class="
question">{{item.question}}
</text>
<view class="
common-problem
">
<view class="
h
">
<view
class="
line"></view
>
<text class="
title">常见问题
</text>
</view>
<view class="answer">
{{item.answer}}
<view class="b">
<view class="item" wx:for="{{issueList}}" wx:key="id">
<view class="question-box">
<text class="spot"></text>
<text class="question">{{item.question}}</text>
</view>
<view class="answer">
{{item.answer}}
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 大家都在看 -->
<view class="related-goods" wx:if="{{relatedGoods.length > 0}}">
<view class="h">
<view class="line"></view>
<text class="title">大家都在看</text>
<!-- 大家都在看 -->
<view class="related-goods" wx:if="{{relatedGoods.length > 0}}">
<view class="h">
<view class="line"></view>
<text class="title">大家都在看</text>
</view>
<goodList goods="{{relatedGoods}}"></goodList>
</view>
<goodList goods="{{relatedGoods}}"></goodList>
</view>
</view>
<!-- 规格选择界面 -->
<view class="attr-pop-box" hidden="{{!openAttr}}">
<view class="attr-pop">
<view class="close" bindtap="closeAttr">
<image class="icon" src="/static/images/icon_close.png"></image>
</view>
<view class="img-info">
<image class="img" src="{{goods.picUrl}}"></image>
<view class="info">
<view class="c">
<view class="p">价格:¥{{checkedSpecPrice}}</view>
<view class="a">{{tmpSpecText}}</view>
<view class="attr-pop">
<view class="close" bindtap="closeAttr">
<image class="icon" src="/static/images/icon_close.png"></image>
</view>
</view>
</view>
<!-- 规格列表 -->
<view class="spec-con">
<view class="spec-item" wx:for="{{specificationList}}" wx:key="name">
<view class="name">{{item.name}}</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">{{vitem.value}}</view>
</view>
</view>
<view class="spec-con" wx:if="{{groupon.length > 0}}">
<view class="spec-item">
<view class="name">团购立减</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickGroupon" wx:for="{{groupon}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">¥-{{vitem.discount}} ({{vitem.discountMember}}人)</view>
</view>
</view>
</view>
<!-- 数量 -->
<view class="number-item">
<view class="name">数量</view>
<view class="selnum">
<view class="cut" bindtap="cutNumber">-</view>
<input value="{{number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber">+</view>
<view class="img-info">
<image class="img" src="{{goods.picUrl}}"></image>
<view class="info">
<view class="c">
<view class="p">价格:¥{{checkedSpecPrice}}</view>
<view class="a">{{tmpSpecText}}</view>
</view>
</view>
</view>
</view>
<!-- 规格列表 -->
<view class="spec-con">
<view class="spec-item" wx:for="{{specificationList}}" wx:key="name">
<view class="name">{{item.name}}</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">{{vitem.value}}</view>
</view>
</view>
<view class="spec-con" wx:if="{{groupon.length > 0}}">
<view class="spec-item">
<view class="name">团购立减</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickGroupon" wx:for="{{groupon}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">¥-{{vitem.discount}} ({{vitem.discountMember}}人)</view>
</view>
</view>
</view>
<!-- 数量 -->
<view class="number-item">
<view class="name">数量</view>
<view class="selnum">
<view class="cut" bindtap="cutNumber">-</view>
<input value="{{number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber">+</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 联系客服 -->
<view class="contact">
<contact-button style="opacity:0;position:absolute;" type="default-dark" session-from="weapp" size="27">
</contact-button>
<contact-button style="opacity:0;position:absolute;" type="default-dark" session-from="weapp" size="27">
</contact-button>
</view>
<!-- 顶部提示 -->
...
...
@@ -134,16 +134,16 @@
<!-- 底部按钮 -->
<view class="bottom-btn">
<view class="l l-collect" bindtap="showShare" wx:if="{{!isGroupon}}">
<image class="icon" src="../../images/goods-share.png"/>
</view>
<view class="l l-cart" wx:if="{{!isGroupon}}">
<view class="box">
<text class="cart-count">{{cartGoodsCount}}</text>
<image bindtap="openCartPage" class="icon" src="/static/images/ic_menu_shoping_nor.png"></image>
<view class="l l-collect" bindtap="showShare" wx:if="{{!isGroupon}}">
<image class="icon" src="../../images/goods-share.png" />
</view>
<view class="l l-cart" wx:if="{{!isGroupon}}">
<view class="box">
<text class="cart-count">{{cartGoodsCount}}</text>
<image bindtap="openCartPage" class="icon" src="/static/images/ic_menu_shoping_nor.png"></image>
</view>
</view>
</view>
<view class="r" bindtap="addToCart" wx:if="{{!soldout}}" wx:if="{{!isGroupon}}">加入购物车</view>
<view class="c" bindtap="addFast" wx:if="{{!soldout}}">{{isGroupon?'参加团购':'立即购买'}}</view>
<view class="n" wx:if="{{soldout}}">商品已售空</view>
<view class="r" bindtap="addToCart" wx:if="{{!soldout}}" wx:if="{{!isGroupon}}">加入购物车</view>
<view class="c" bindtap="addFast" wx:if="{{!soldout}}">{{isGroupon?'参加团购':'立即购买'}}</view>
<view class="n" wx:if="{{soldout}}">商品已售空</view>
</view>
\ No newline at end of file
renard-wx/pages/goods/goods.wxss
View file @
286c0ae7
.container {
margin-bottom: 100rpx;
margin-bottom: 100rpx;
}
.goodsimgs {
width: 750rpx;
height: 750rpx;
width: 750rpx;
height: 750rpx;
}
.goodsimgs image {
width: 750rpx;
height: 750rpx;
width: 750rpx;
height: 750rpx;
}
.service-policy {
width: 100%;
height: 96rpx;
/* background: #d3b676; */
border: 2px solid #fff;
/* align-items: center; */
width: 100%;
height: 96rpx;
/* background: #d3b676; */
border: 2px solid #fff;
/* align-items: center; */
}
.goods-info {
width: 750rpx;
/* height: 406rpx; */
overflow: hidden;
background: #fff;
width: 750rpx;
/* height: 406rpx; */
overflow: hidden;
background: #fff;
}
.goods-info .c {
display: block;
width: 718.75rpx;
height: 100%;
margin-left: 31.25rpx;
padding: 38rpx 31.25rpx 38rpx 0;
border-bottom: 1px solid #f4f4f4;
display: block;
width: 718.75rpx;
height: 100%;
margin-left: 31.25rpx;
padding: 38rpx 31.25rpx 38rpx 0;
border-bottom: 1px solid #f4f4f4;
}
.goods-info .c text {
display: block;
width: 687.5rpx;
text-align: center;
display: block;
width: 687.5rpx;
text-align: center;
}
.goods-info .name {
height: 64rpx;
/* width: 620rpx; */
font-size: 41rpx;
height: 64rpx;
/* width: 620rpx; */
font-size: 41rpx;
}
.goods-info .desc {
height: 43rpx;
margin-bottom: 30rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #999;
height: 43rpx;
margin-bottom: 30rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #999;
}
.goods-info .price {
height: 50rpx;
align-content: center;
height: 50rpx;
align-content: center;
}
.goods-info .counterPrice {
float: left;
padding-left: 120rpx;
text-decoration: line-through;
font-size: 30rpx;
color: #999;
float: left;
padding-left: 120rpx;
text-decoration: line-through;
font-size: 30rpx;
color: #999;
}
.goods-info .retailPrice {
/* float: right; */
padding-left: 60rpx;
font-size: 30rpx;
color: #a78845;
/* float: right; */
padding-left: 60rpx;
font-size: 30rpx;
color: #a78845;
}
.goods-info .brand {
margin-top: 23rpx;
min-height: 40rpx;
text-align: center;
margin-top: 23rpx;
min-height: 40rpx;
text-align: center;
}
.goods-info .brand text {
display: inline-block;
width: auto;
padding: 2px 30rpx 2px 10.5rpx;
line-height: 35.5rpx;
border: 1px solid #a78845;
font-size: 28rpx;
color: #a78845;
border-radius: 4px;
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/detailTagArrow-18bee52dab.png) 95% center no-repeat;
background-size: 10.75rpx 18.75rpx;
display: inline-block;
width: auto;
padding: 2px 30rpx 2px 10.5rpx;
line-height: 35.5rpx;
border: 1px solid #a78845;
font-size: 28rpx;
color: #a78845;
border-radius: 4px;
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/detailTagArrow-18bee52dab.png) 95% center no-repeat;
background-size: 10.75rpx 18.75rpx;
}
.section-nav {
width: 750rpx;
height: 108rpx;
background: #fff;
margin-bottom: 20rpx;
width: 750rpx;
height: 108rpx;
background: #fff;
margin-bottom: 20rpx;
}
.section-nav .t {
float: left;
width: 600rpx;
height: 108rpx;
line-height: 108rpx;
font-size: 29rpx;
color: #a78845;
margin-left: 31.25rpx;
float: left;
width: 600rpx;
height: 108rpx;
line-height: 108rpx;
font-size: 29rpx;
color: #a78845;
margin-left: 31.25rpx;
}
.section-nav .i {
float: right;
width: 52rpx;
height: 52rpx;
margin-right: 16rpx;
margin-top: 28rpx;
float: right;
width: 52rpx;
height: 52rpx;
margin-right: 16rpx;
margin-top: 28rpx;
}
.section-act .t {
float: left;
display: flex;
align-items: center;
width: 600rpx;
height: 108rpx;
overflow: hidden;
line-height: 108rpx;
font-size: 29rpx;
color: #999;
margin-left: 31.25rpx;
float: left;
display: flex;
align-items: center;
width: 600rpx;
height: 108rpx;
overflow: hidden;
line-height: 108rpx;
font-size: 29rpx;
color: #999;
margin-left: 31.25rpx;
}
.section-act .label {
color: #999;
color: #999;
}
.section-act .tag {
display: flex;
align-items: center;
padding: 0 10rpx;
border-radius: 3px;
height: 37rpx;
width: auto;
color: #a78845;
overflow: hidden;
border: 1px solid #a78845;
font-size: 25rpx;
margin: 0 10rpx;
display: flex;
align-items: center;
padding: 0 10rpx;
border-radius: 3px;
height: 37rpx;
width: auto;
color: #a78845;
overflow: hidden;
border: 1px solid #a78845;
font-size: 25rpx;
margin: 0 10rpx;
}
.section-act .text {
display: flex;
align-items: center;
height: 37rpx;
width: auto;
overflow: hidden;
color: #a78845;
font-size: 29rpx;
display: flex;
align-items: center;
height: 37rpx;
width: auto;
overflow: hidden;
color: #a78845;
font-size: 29rpx;
}
.comments {
width: 100%;
height: auto;
padding-left: 30rpx;
background: #fff;
margin: 20rpx 0;
width: 100%;
height: auto;
padding-left: 30rpx;
background: #fff;
margin: 20rpx 0;
}
.comments .h {
height: 102.5rpx;
line-height: 100.5rpx;
width: 718.75rpx;
padding-right: 16rpx;
border-bottom: 1px solid #d9d9d9;
height: 102.5rpx;
line-height: 100.5rpx;
width: 718.75rpx;
padding-right: 16rpx;
border-bottom: 1px solid #d9d9d9;
}
.comments .h .t {
display: block;
float: left;
width: 50%;
font-size: 38.5rpx;
color: #333;
display: block;
float: left;
width: 50%;
font-size: 38.5rpx;
color: #333;
}
.comments .h .i {
display: block;
float: right;
width: 164rpx;
height: 100.5rpx;
line-height: 100.5rpx;
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/address-right-990628faa7.png) right center no-repeat;
background-size: 52rpx;
display: block;
float: right;
width: 164rpx;
height: 100.5rpx;
line-height: 100.5rpx;
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/address-right-990628faa7.png) right center no-repeat;
background-size: 52rpx;
}
.comments .b {
height: auto;
width: 720rpx;
height: auto;
width: 720rpx;
}
.comments .item {
height: auto;
width: 720rpx;
overflow: hidden;
height: auto;
width: 720rpx;
overflow: hidden;
}
.comments .info {
height: 127rpx;
width: 100%;
padding: 33rpx 0 27rpx 0;
height: 127rpx;
width: 100%;
padding: 33rpx 0 27rpx 0;
}
.comments .user {
float: left;
width: auto;
height: 67rpx;
line-height: 67rpx;
font-size: 0;
float: left;
width: auto;
height: 67rpx;
line-height: 67rpx;
font-size: 0;
}
.comments .user image {
float: left;
width: 67rpx;
height: 67rpx;
margin-right: 17rpx;
border-radius: 50%;
float: left;
width: 67rpx;
height: 67rpx;
margin-right: 17rpx;
border-radius: 50%;
}
.comments .user text {
display: inline-block;
width: auto;
height: 66rpx;
overflow: hidden;
font-size: 29rpx;
line-height: 66rpx;
display: inline-block;
width: auto;
height: 66rpx;
overflow: hidden;
font-size: 29rpx;
line-height: 66rpx;
}
.comments .time {
display: block;
float: right;
width: auto;
height: 67rpx;
line-height: 67rpx;
color: #7f7f7f;
font-size: 25rpx;
margin-right: 30rpx;
display: block;
float: right;
width: auto;
height: 67rpx;
line-height: 67rpx;
color: #7f7f7f;
font-size: 25rpx;
margin-right: 30rpx;
}
.comments .content {
width: 720rpx;
padding-right: 30rpx;
line-height: 45.8rpx;
font-size: 29rpx;
margin-bottom: 24rpx;
width: 720rpx;
padding-right: 30rpx;
line-height: 45.8rpx;
font-size: 29rpx;
margin-bottom: 24rpx;
}
.comments .imgs {
width: 720rpx;
height: auto;
margin-bottom: 25rpx;
width: 720rpx;
height: auto;
margin-bottom: 25rpx;
}
.comments .imgs .img {
height: 150rpx;
width: 150rpx;
margin-right: 28rpx;
height: 150rpx;
width: 150rpx;
margin-right: 28rpx;
}
.comments .spec {
width: 720rpx;
padding-right: 30rpx;
line-height: 30rpx;
font-size: 24rpx;
color: #999;
margin-bottom: 30rpx;
width: 720rpx;
padding-right: 30rpx;
line-height: 30rpx;
font-size: 24rpx;
color: #999;
margin-bottom: 30rpx;
}
.goods-attr {
width: 750rpx;
height: auto;
overflow: hidden;
padding: 0 31.25rpx 25rpx 31.25rpx;
background: #fff;
width: 750rpx;
height: auto;
overflow: hidden;
padding: 0 31.25rpx 25rpx 31.25rpx;
background: #fff;
}
.goods-attr .t {
width: 687.5rpx;
height: 104rpx;
line-height: 104rpx;
font-size: 38.5rpx;
width: 687.5rpx;
height: 104rpx;
line-height: 104rpx;
font-size: 38.5rpx;
}
.goods-attr .item {
width: 687.5rpx;
height: 68rpx;
padding: 11rpx 20rpx;
margin-bottom: 11rpx;
background: #f7f7f7;
font-size: 38.5rpx;
width: 687.5rpx;
height: 68rpx;
padding: 11rpx 20rpx;
margin-bottom: 11rpx;
background: #f7f7f7;
font-size: 38.5rpx;
}
.goods-attr .left {
float: left;
font-size: 25rpx;
width: 134rpx;
height: 45rpx;
line-height: 45rpx;
overflow: hidden;
color: #999;
float: left;
font-size: 25rpx;
width: 134rpx;
height: 45rpx;
line-height: 45rpx;
overflow: hidden;
color: #999;
}
.goods-attr .right {
float: left;
font-size: 36.5rpx;
margin-left: 20rpx;
width: 480rpx;
height: 45rpx;
line-height: 45rpx;
overflow: hidden;
color: #333;
float: left;
font-size: 36.5rpx;
margin-left: 20rpx;
width: 480rpx;
height: 45rpx;
line-height: 45rpx;
overflow: hidden;
color: #333;
}
.detail {
width: 750rpx;
height: auto;
overflow: hidden;
width: 750rpx;
height: auto;
overflow: hidden;
}
.detail image {
width: 750rpx;
display: block;
width: 750rpx;
display: block;
}
.common-problem {
width: 750rpx;
height: auto;
overflow: hidden;
width: 750rpx;
height: auto;
overflow: hidden;
}
.common-problem .h {
position: relative;
height: 145.5rpx;
width: 750rpx;
padding: 56.25rpx 0;
background: #fff;
text-align: center;
position: relative;
height: 145.5rpx;
width: 750rpx;
padding: 56.25rpx 0;
background: #fff;
text-align: center;
}
.common-problem .h .line {
display: inline-block;
position: absolute;
top: 72rpx;
left: 0;
z-index: 2;
height: 1px;
margin-left: 225rpx;
width: 300rpx;
background: #ccc;
display: inline-block;
position: absolute;
top: 72rpx;
left: 0;
z-index: 2;
height: 1px;
margin-left: 225rpx;
width: 300rpx;
background: #ccc;
}
.common-problem .h .title {
display: inline-block;
position: absolute;
top: 56.125rpx;
left: 0;
z-index: 3;
height: 33rpx;
margin-left: 285rpx;
width: 180rpx;
background: #fff;
display: inline-block;
position: absolute;
top: 56.125rpx;
left: 0;
z-index: 3;
height: 33rpx;
margin-left: 285rpx;
width: 180rpx;
background: #fff;
}
.common-problem .b {
width: 750rpx;
height: auto;
overflow: hidden;
padding: 0rpx 30rpx;
background: #fff;
width: 750rpx;
height: auto;
overflow: hidden;
padding: 0rpx 30rpx;
background: #fff;
}
.common-problem .item {
height: auto;
overflow: hidden;
padding-bottom: 25rpx;
height: auto;
overflow: hidden;
padding-bottom: 25rpx;
}
.common-problem .question-box .spot {
float: left;
display: block;
height: 8rpx;
width: 8rpx;
background: #b4282d;
border-radius: 50%;
margin-top: 11rpx;
float: left;
display: block;
height: 8rpx;
width: 8rpx;
background: #b4282d;
border-radius: 50%;
margin-top: 11rpx;
}
.common-problem .question-box .question {
float: left;
line-height: 30rpx;
padding-left: 8rpx;
display: block;
font-size: 26rpx;
padding-bottom: 15rpx;
color: #303030;
float: left;
line-height: 30rpx;
padding-left: 8rpx;
display: block;
font-size: 26rpx;
padding-bottom: 15rpx;
color: #303030;
}
.common-problem .answer {
line-height: 36rpx;
padding-left: 16rpx;
font-size: 26rpx;
color: #787878;
line-height: 36rpx;
padding-left: 16rpx;
font-size: 26rpx;
color: #787878;
}
.related-goods {
width: 750rpx;
height: auto;
overflow: hidden;
padding-bottom: 120rpx;
width: 750rpx;
height: auto;
overflow: hidden;
padding-bottom: 120rpx;
}
.related-goods .h {
position: relative;
height: 145.5rpx;
width: 750rpx;
padding: 56.25rpx 0;
background: #fff;
text-align: center;
border-bottom: 1px solid #f4f4f4;
position: relative;
height: 145.5rpx;
width: 750rpx;
padding: 56.25rpx 0;
background: #fff;
text-align: center;
border-bottom: 1px solid #f4f4f4;
}
.related-goods .h .line {
display: inline-block;
position: absolute;
top: 72rpx;
left: 0;
z-index: 2;
height: 1px;
margin-left: 225rpx;
width: 300rpx;
background: #ccc;
display: inline-block;
position: absolute;
top: 72rpx;
left: 0;
z-index: 2;
height: 1px;
margin-left: 225rpx;
width: 300rpx;
background: #ccc;
}
.related-goods .h .title {
display: inline-block;
position: absolute;
top: 56.125rpx;
left: 0;
z-index: 3;
height: 33rpx;
margin-left: 285rpx;
width: 180rpx;
background: #fff;
display: inline-block;
position: absolute;
top: 56.125rpx;
left: 0;
z-index: 3;
height: 33rpx;
margin-left: 285rpx;
width: 180rpx;
background: #fff;
}
.bottom-btn {
position: fixed;
left: 0;
bottom: 0;
z-index: 10;
width: 750rpx;
height: 100rpx;
display: flex;
background: #fff;
position: fixed;
left: 0;
bottom: 0;
z-index: 10;
width: 750rpx;
height: 100rpx;
display: flex;
background: #fff;
}
.bottom-btn .l {
float: left;
height: 100rpx;
width: 162rpx;
border: 1px solid #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
float: left;
height: 100rpx;
width: 162rpx;
border: 1px solid #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
}
.bottom-btn .l.l-collect {
border-right: none;
border-left: none;
text-align: center;
width: 162rpx;
border-right: none;
border-left: none;
text-align: center;
width: 162rpx;
}
.bottom-btn .l.l-kefu {
position: relative;
height: 54rpx;
width: 63rpx;
position: relative;
height: 54rpx;
width: 63rpx;
}
.bottom-btn .l.l-cart .box {
position: relative;
height: 60rpx;
width: 60rpx;
position: relative;
height: 60rpx;
width: 60rpx;
}
.bottom-btn .l.l-cart .cart-count {
height: 28rpx;
width: 28rpx;
z-index: 10;
position: absolute;
top: 0;
right: 0;
background: #a78845;
text-align: center;
font-size: 18rpx;
color: #fff;
line-height: 28rpx;
border-radius: 50%;
height: 28rpx;
width: 28rpx;
z-index: 10;
position: absolute;
top: 0;
right: 0;
background: #a78845;
text-align: center;
font-size: 18rpx;
color: #fff;
line-height: 28rpx;
border-radius: 50%;
}
.bottom-btn .l.l-cart .icon {
position: absolute;
top: 10rpx;
left: 0;
position: absolute;
top: 10rpx;
left: 0;
}
.bottom-btn .l.l-kefu .kefu-count {
height: 28rpx;
width: 28rpx;
z-index: 10;
position: absolute;
top: 0;
right: 0;
/* background: #b4282d; */
text-align: center;
font-size: 18rpx;
color: #fff;
line-height: 28rpx;
border-radius: 50%;
height: 28rpx;
width: 28rpx;
z-index: 10;
position: absolute;
top: 0;
right: 0;
/* background: #b4282d; */
text-align: center;
font-size: 18rpx;
color: #fff;
line-height: 28rpx;
border-radius: 50%;
}
.bottom-btn .l.l-kefu .icon {
position: absolute;
top: 10rpx;
left: 0;
position: absolute;
top: 10rpx;
left: 0;
}
.bottom-btn .l .icon {
display: block;
height: 44rpx;
width: 44rpx;
display: block;
height: 44rpx;
width: 44rpx;
}
.bottom-btn .c {
border: 1px solid #a78845;
background: #a78845;
float: left;
height: 100rpx;
line-height: 96rpx;
flex: 1;
text-align: center;
color: #fff;
border: 1px solid #a78845;
background: #a78845;
float: left;
height: 100rpx;
line-height: 96rpx;
flex: 1;
text-align: center;
color: #fff;
}
.bottom-btn .r {
border: 1px solid #d3bd8f;
background: #d3bd8f;
float: left;
height: 100rpx;
line-height: 96rpx;
flex: 1;
text-align: center;
color: #fff;
border: 1px solid #d3bd8f;
background: #d3bd8f;
float: left;
height: 100rpx;
line-height: 96rpx;
flex: 1;
text-align: center;
color: #fff;
}
.bottom-btn .n {
border: 1px solid #d3bd8f;
background: #d3bd8f;
float: left;
height: 100rpx;
line-height: 96rpx;
flex: 1;
text-align: center;
color: #fff;
border: 1px solid #d3bd8f;
background: #d3bd8f;
float: left;
height: 100rpx;
line-height: 96rpx;
flex: 1;
text-align: center;
color: #fff;
}
@import "../../lib/wxParse/wxParse.wxss";
.attr-pop-box {
width: 100%;
height: 100%;
position: fixed;
background: rgba(0, 0, 0, 0.5);
z-index: 8;
bottom: 0;
/* display: none; */
width: 100%;
height: 100%;
position: fixed;
background: rgba(0, 0, 0, 0.5);
z-index: 8;
bottom: 0;
/* display: none; */
}
.attr-pop {
width: 100%;
height: auto;
max-height: 780rpx;
padding: 31.25rpx;
background: #fff;
position: fixed;
z-index: 9;
bottom: 100rpx;
width: 100%;
height: auto;
max-height: 780rpx;
padding: 31.25rpx;
background: #fff;
position: fixed;
z-index: 9;
bottom: 100rpx;
}
.attr-pop .close {
position: absolute;
width: 48rpx;
height: 48rpx;
right: 31.25rpx;
overflow: hidden;
top: 31.25rpx;
position: absolute;
width: 48rpx;
height: 48rpx;
right: 31.25rpx;
overflow: hidden;
top: 31.25rpx;
}
.attr-pop .close .icon {
width: 48rpx;
height: 48rpx;
width: 48rpx;
height: 48rpx;
}
.attr-pop .img-info {
width: 687.5rpx;
height: 177rpx;
overflow: hidden;
margin-bottom: 41.5rpx;
width: 687.5rpx;
height: 177rpx;
overflow: hidden;
margin-bottom: 41.5rpx;
}
.attr-pop .img {
float: left;
height: 177rpx;
width: 177rpx;
background: #f4f4f4;
margin-right: 31.25rpx;
float: left;
height: 177rpx;
width: 177rpx;
background: #f4f4f4;
margin-right: 31.25rpx;
}
.attr-pop .info {
float: left;
height: 177rpx;
display: flex;
align-items: center;
float: left;
height: 177rpx;
display: flex;
align-items: center;
}
.attr-pop .p {
font-size: 33rpx;
color: #333;
height: 33rpx;
line-height: 33rpx;
margin-bottom: 10rpx;
font-size: 33rpx;
color: #333;
height: 33rpx;
line-height: 33rpx;
margin-bottom: 10rpx;
}
.attr-pop .a {
font-size: 29rpx;
color: #333;
height: 40rpx;
line-height: 40rpx;
font-size: 29rpx;
color: #333;
height: 40rpx;
line-height: 40rpx;
}
.spec-con {
width: 100%;
height: auto;
overflow: hidden;
width: 100%;
height: auto;
overflow: hidden;
}
.spec-con .name {
height: 32rpx;
margin-bottom: 22rpx;
font-size: 29rpx;
color: #333;
height: 32rpx;
margin-bottom: 22rpx;
font-size: 29rpx;
color: #333;
}
.spec-con .values {
height: auto;
margin-bottom: 31.25rpx;
font-size: 0;
height: auto;
margin-bottom: 31.25rpx;
font-size: 0;
}
.spec-con .value {
display: inline-block;
height: 62rpx;
padding: 0 35rpx;
line-height: 56rpx;
text-align: center;
margin-right: 25rpx;
margin-bottom: 16.5rpx;
border: 1px solid #333;
font-size: 25rpx;
color: #333;
display: inline-block;
height: 62rpx;
padding: 0 35rpx;
line-height: 56rpx;
text-align: center;
margin-right: 25rpx;
margin-bottom: 16.5rpx;
border: 1px solid #333;
font-size: 25rpx;
color: #333;
}
.spec-con .value.disable {
border: 1px solid #ccc;
color: #ccc;
border: 1px solid #ccc;
color: #ccc;
}
.spec-con .value.selected {
border: 1px solid #b4282d;
color: #b4282d;
border: 1px solid #b4282d;
color: #b4282d;
}
.number-item .selnum {
width: 322rpx;
height: 71rpx;
border: 1px solid #ccc;
display: flex;
width: 322rpx;
height: 71rpx;
border: 1px solid #ccc;
display: flex;
}
.number-item .cut {
width: 93.75rpx;
height: 100%;
text-align: center;
line-height: 65rpx;
width: 93.75rpx;
height: 100%;
text-align: center;
line-height: 65rpx;
}
.number-item .number {
flex: 1;
height: 100%;
text-align: center;
line-height: 68.75rpx;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
float: left;
flex: 1;
height: 100%;
text-align: center;
line-height: 68.75rpx;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
float: left;
}
.number-item .add {
width: 93.75rpx;
height: 100%;
text-align: center;
line-height: 65rpx;
width: 93.75rpx;
height: 100%;
text-align: center;
line-height: 65rpx;
}
.contact {
height: 100rpx;
width: 100rpx;
background-color: #008000;
border-radius: 100%;
position: fixed;
bottom: 150rpx;
right: 20rpx;
display: flex;
align-items: center;
justify-content: center;
z-index: 9;
flex-direction: column;
/*line-height: 100rpx;
height: 100rpx;
width: 100rpx;
background-color: #008000;
border-radius: 100%;
position: fixed;
bottom: 150rpx;
right: 20rpx;
display: flex;
align-items: center;
justify-content: center;
z-index: 9;
flex-direction: column;
/*line-height: 100rpx;
text-align: center;
padding-top: 26rpx;*/
font-size: 20rpx;
color: #008000;
box-sizing: border-box;
background: url("https://litemall.oss-cn-shenzhen.aliyuncs.com/kefu.png") no-repeat center 21rpx;
background-size: 55rpx auto;
font-size: 20rpx;
color: #008000;
box-sizing: border-box;
background: url("https://litemall.oss-cn-shenzhen.aliyuncs.com/kefu.png") no-repeat center 21rpx;
background-size: 55rpx auto;
}
.contact .name {
font-size: 32rpx;
max-width: 80rpx;
color: #fff;
text-align: center;
font-size: 32rpx;
max-width: 80rpx;
color: #fff;
text-align: center;
}
renard-wx/pages/groupon/grouponDetail/grouponDetail.js
View file @
286c0ae7
...
...
@@ -2,93 +2,93 @@ var util = require('../../../utils/util.js');
var
api
=
require
(
'
../../../config/api.js
'
);
Page
({
data
:
{
id
:
0
,
orderId
:
0
,
groupon
:
{},
linkGrouponId
:
0
,
joiners
:
[],
orderInfo
:
{},
orderGoods
:
[],
expressInfo
:
{},
flag
:
false
,
handleOption
:
{}
},
data
:
{
id
:
0
,
orderId
:
0
,
groupon
:
{},
linkGrouponId
:
0
,
joiners
:
[],
orderInfo
:
{},
orderGoods
:
[],
expressInfo
:
{},
flag
:
false
,
handleOption
:
{}
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
this
.
setData
({
id
:
options
.
id
});
this
.
getOrderDetail
();
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
this
.
setData
({
id
:
options
.
id
});
this
.
getOrderDetail
();
},
// 页面分享
onShareAppMessage
:
function
()
{
let
that
=
this
;
return
{
title
:
'
邀请团购
'
,
desc
:
'
唯爱与美食不可辜负
'
,
path
:
'
/pages/index/index?grouponId=
'
+
this
.
data
.
linkGrouponId
}
},
// 页面分享
onShareAppMessage
:
function
()
{
let
that
=
this
;
return
{
title
:
'
邀请团购
'
,
desc
:
'
唯爱与美食不可辜负
'
,
path
:
'
/pages/index/index?grouponId=
'
+
this
.
data
.
linkGrouponId
}
},
showShare
:
function
()
{
this
.
sharePop
.
togglePopup
();
},
showShare
:
function
()
{
this
.
sharePop
.
togglePopup
();
},
onPullDownRefresh
()
{
this
.
getOrderDetail
();
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
onPullDownRefresh
()
{
this
.
getOrderDetail
();
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
expandDetail
:
function
()
{
let
that
=
this
;
this
.
setData
({
flag
:
!
that
.
data
.
flag
})
},
getOrderDetail
:
function
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
expandDetail
:
function
()
{
let
that
=
this
;
this
.
setData
({
flag
:
!
that
.
data
.
flag
})
},
getOrderDetail
:
function
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
let
that
=
this
;
util
.
request
(
api
.
GroupOnDetail
,
{
grouponId
:
that
.
data
.
id
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
joiners
:
res
.
data
.
joiners
,
groupon
:
res
.
data
.
groupon
,
linkGrouponId
:
res
.
data
.
linkGrouponId
,
orderId
:
res
.
data
.
orderInfo
.
id
,
orderInfo
:
res
.
data
.
orderInfo
,
orderGoods
:
res
.
data
.
orderGoods
,
handleOption
:
res
.
data
.
orderInfo
.
handleOption
,
expressInfo
:
res
.
data
.
expressInfo
let
that
=
this
;
util
.
request
(
api
.
GroupOnDetail
,
{
grouponId
:
that
.
data
.
id
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
joiners
:
res
.
data
.
joiners
,
groupon
:
res
.
data
.
groupon
,
linkGrouponId
:
res
.
data
.
linkGrouponId
,
orderId
:
res
.
data
.
orderInfo
.
id
,
orderInfo
:
res
.
data
.
orderInfo
,
orderGoods
:
res
.
data
.
orderGoods
,
handleOption
:
res
.
data
.
orderInfo
.
handleOption
,
expressInfo
:
res
.
data
.
expressInfo
});
wx
.
hideLoading
();
}
});
},
wx
.
hideLoading
();
}
});
},
onReady
:
function
()
{
// 页面渲染完成
this
.
sharePop
=
this
.
selectComponent
(
"
#sharePop
"
);
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
}
onReady
:
function
()
{
// 页面渲染完成
this
.
sharePop
=
this
.
selectComponent
(
"
#sharePop
"
);
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
}
});
\ No newline at end of file
renard-wx/pages/groupon/grouponDetail/grouponDetail.json
View file @
286c0ae7
{
"navigationBarTitleText"
:
"团购详情"
,
"usingComponents"
:
{
"navigationBarTitleText"
:
"团购详情"
,
"usingComponents"
:
{
"sharePop"
:
"/components/sharePop/sharePop"
}
}
}
\ No newline at end of file
renard-wx/pages/groupon/grouponDetail/grouponDetail.wxml
View file @
286c0ae7
<view class="container">
<view class="order-info">
<view class="item-a">下单时间:{{orderInfo.addTime}}</view>
<view class="item-b">订单编号:{{orderInfo.orderSn}}</view>
<view class="item-c">
<view class="l">实付:
<text class="cost">¥{{orderInfo.actualPrice}}</text>
</view>
<view class="r">
<view class="btn active" bindtap="showShare">邀请参团</view>
</view>
<view class="order-info">
<view class="item-a">下单时间:{{orderInfo.addTime}}</view>
<view class="item-b">订单编号:{{orderInfo.orderSn}}</view>
<view class="item-c">
<view class="l">实付:
<text class="cost">¥{{orderInfo.actualPrice}}</text>
</view>
<view class="r">
<view class="btn active" bindtap="showShare">邀请参团</view>
</view>
</view>
</view>
</view>
<sharePop id="sharePop" url="{{groupon.shareUrl}}"></sharePop>
<sharePop id="sharePop" url="{{groupon.shareUrl}}"></sharePop>
<view class="menu-list-pro">
<view class="h">
<view class="label">参与团购 ( {{joiners.length}}人)</view>
<!-- <view class="status">查看全部</view> -->
</view>
<view class="menu-list-item" wx:for-items="{{joiners}}" wx:key="id" data-id="{{item.id}}">
<image class="icon" src="{{item.avatar}}"></image>
<text class="txt">{{item.nickname}}</text>
</view>
</view>
<view class="order-goods">
<view class="h">
<view class="label">商品信息</view>
<view class="status">{{orderInfo.orderStatusText}}</view>
</view>
<view class="goods">
<view class="item" wx:for="{{orderGoods}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
<view class="menu-list-pro">
<view class="h">
<view class="label">参与团购 ( {{joiners.length}}人)</view>
<!-- <view class="status">查看全部</view> -->
</view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="attr">{{item.goodsSpecificationValues}}</view>
<view class="price">¥{{item.retailPrice}}</view>
<view class="menu-list-item" wx:for-items="{{joiners}}" wx:key="id" data-id="{{item.id}}">
<image class="icon" src="{{item.avatar}}"></image>
<text class="txt">{{item.nickname}}</text>
</view>
</view>
</view>
<view class="order-bottom">
<view class="address">
<view class="t">
<text class="name">{{orderInfo.consignee}}</text>
<text class="mobile">{{orderInfo.mobile}}</text>
<view class="order-goods">
<view class="h">
<view class="label">商品信息</view>
<view class="status">{{orderInfo.orderStatusText}}</view>
</view>
<view class="b">{{orderInfo.address}}</view>
</view>
<view class="total">
<view class="t">
<text class="label">商品合计:</text>
<text class="txt">¥{{orderInfo.goodsPrice}}</text>
<view class="goods">
<view class="item" wx:for="{{orderGoods}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="attr">{{item.goodsSpecificationValues}}</view>
<view class="price">¥{{item.retailPrice}}</view>
</view>
</view>
</view>
<view class="t">
<text class="label">运费:</text>
<text class="txt">¥{{orderInfo.freightPrice}}</text>
<view class="order-bottom">
<view class="address">
<view class="t">
<text class="name">{{orderInfo.consignee}}</text>
<text class="mobile">{{orderInfo.mobile}}</text>
</view>
<view class="b">{{orderInfo.address}}</view>
</view>
<view class="total">
<view class="t">
<text class="label">商品合计:</text>
<text class="txt">¥{{orderInfo.goodsPrice}}</text>
</view>
<view class="t">
<text class="label">运费:</text>
<text class="txt">¥{{orderInfo.freightPrice}}</text>
</view>
</view>
<view class="pay-fee">
<text class="label">实付:</text>
<text class="txt">¥{{orderInfo.actualPrice}}</text>
</view>
</view>
</view>
<view class="pay-fee">
<text class="label">实付:</text>
<text class="txt">¥{{orderInfo.actualPrice}}</text>
</view>
</view>
</view>
<!-- 物流信息,仅收货状态下可见 -->
<view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}">
<view class="expand">
<view class="title">
<view class="t">快递公司:{{expressInfo.shipperName}}</view>
<view class="b">物流单号:{{expressInfo.shipperCode}}</view>
</view>
<image class="ti" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<!-- 物流信息,仅收货状态下可见 -->
<view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}">
<view class="expand">
<view class="title">
<view class="t">快递公司:{{expressInfo.shipperName}}</view>
<view class="b">物流单号:{{expressInfo.shipperCode}}</view>
</view>
<image class="ti" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<!-- <view class="order-express" > -->
<view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}">
<view class="trace">
<view class="acceptStation">{{iitem.AcceptStation}}</view>
<view class="acceptTime">{{iitem.AcceptTime}}</view>
</view>
<!-- <view class="order-express" > -->
<view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}">
<view class="trace">
<view class="acceptStation">{{iitem.AcceptStation}}</view>
<view class="acceptTime">{{iitem.AcceptTime}}</view>
</view>
</view>
</view>
</view>
<!-- </view> -->
<!-- </view> -->
</view>
\ No newline at end of file
renard-wx/pages/groupon/grouponDetail/grouponDetail.wxss
View file @
286c0ae7
page {
height: 100%;
width: 100%;
background: #f4f4f4;
height: 100%;
width: 100%;
background: #f4f4f4;
}
.order-info {
padding-top: 25rpx;
background: #fff;
height: auto;
overflow: hidden;
padding-top: 25rpx;
background: #fff;
height: auto;
overflow: hidden;
}
.item-a {
padding-left: 31.25rpx;
height: 42.5rpx;
padding-bottom: 12.5rpx;
line-height: 30rpx;
font-size: 30rpx;
color: #666;
padding-left: 31.25rpx;
height: 42.5rpx;
padding-bottom: 12.5rpx;
line-height: 30rpx;
font-size: 30rpx;
color: #666;
}
.item-b {
padding-left: 31.25rpx;
height: 29rpx;
line-height: 29rpx;
margin-top: 12.5rpx;
margin-bottom: 41.5rpx;
font-size: 30rpx;
color: #666;
padding-left: 31.25rpx;
height: 29rpx;
line-height: 29rpx;
margin-top: 12.5rpx;
margin-bottom: 41.5rpx;
font-size: 30rpx;
color: #666;
}
.item-c {
margin-left: 31.25rpx;
border-top: 1px solid #f4f4f4;
height: 103rpx;
line-height: 103rpx;
margin-left: 31.25rpx;
border-top: 1px solid #f4f4f4;
height: 103rpx;
line-height: 103rpx;
}
.item-c .l {
float: left;
float: left;
}
.item-c .r {
height: 103rpx;
float: right;
display: flex;
align-items: center;
padding-right: 16rpx;
height: 103rpx;
float: right;
display: flex;
align-items: center;
padding-right: 16rpx;
}
.item-c .r .btn {
float: right;
float: right;
}
.item-c .cost {
color: #b4282d;
color: #b4282d;
}
.item-c .btn {
line-height: 66rpx;
border-radius: 5rpx;
text-align: center;
margin: 0 15rpx;
padding: 0 20rpx;
height: 66rpx;
line-height: 66rpx;
border-radius: 5rpx;
text-align: center;
margin: 0 15rpx;
padding: 0 20rpx;
height: 66rpx;
}
.item-c .btn.active {
background: #a78845;
color: #fff;
background: #a78845;
color: #fff;
}
.order-goods {
margin-top: 20rpx;
background: #fff;
margin-top: 20rpx;
background: #fff;
}
.order-goods .h {
height: 93.75rpx;
line-height: 93.75rpx;
margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx;
height: 93.75rpx;
line-height: 93.75rpx;
margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx;
}
.order-goods .h .label {
float: left;
font-size: 30rpx;
color: #333;
float: left;
font-size: 30rpx;
color: #333;
}
.order-goods .h .status {
float: right;
font-size: 30rpx;
color: #b4282d;
float: right;
font-size: 30rpx;
color: #b4282d;
}
.order-goods .item {
display: flex;
align-items: center;
height: 192rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
display: flex;
align-items: center;
height: 192rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order-goods .item:last-child {
border-bottom: none;
border-bottom: none;
}
.order-goods .item .img {
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
}
.order-goods .item .img image {
height: 145.83rpx;
width: 145.83rpx;
height: 145.83rpx;
width: 145.83rpx;
}
.order-goods .item .info {
flex: 1;
height: 145.83rpx;
margin-left: 20rpx;
flex: 1;
height: 145.83rpx;
margin-left: 20rpx;
}
.order-goods .item .t {
margin-top: 8rpx;
height: 33rpx;
line-height: 33rpx;
margin-bottom: 10.5rpx;
margin-top: 8rpx;
height: 33rpx;
line-height: 33rpx;
margin-bottom: 10.5rpx;
}
.order-goods .item .t .name {
display: block;
float: left;
height: 33rpx;
line-height: 33rpx;
color: #333;
font-size: 30rpx;
display: block;
float: left;
height: 33rpx;
line-height: 33rpx;
color: #333;
font-size: 30rpx;
}
.order-goods .item .t .number {
display: block;
float: right;
height: 33rpx;
text-align: right;
line-height: 33rpx;
color: #333;
font-size: 30rpx;
display: block;
float: right;
height: 33rpx;
text-align: right;
line-height: 33rpx;
color: #333;
font-size: 30rpx;
}
.order-goods .item .attr {
height: 29rpx;
line-height: 29rpx;
color: #666;
margin-bottom: 25rpx;
font-size: 25rpx;
height: 29rpx;
line-height: 29rpx;
color: #666;
margin-bottom: 25rpx;
font-size: 25rpx;
}
.order-goods .item .price {
display: block;
float: left;
height: 30rpx;
line-height: 30rpx;
color: #333;
font-size: 30rpx;
display: block;
float: left;
height: 30rpx;
line-height: 30rpx;
color: #333;
font-size: 30rpx;
}
.order-goods .item .btn {
height: 50rpx;
line-height: 50rpx;
border-radius: 5rpx;
text-align: center;
display: block;
float: right;
margin: 0 15rpx;
padding: 0 20rpx;
height: 50rpx;
line-height: 50rpx;
border-radius: 5rpx;
text-align: center;
display: block;
float: right;
margin: 0 15rpx;
padding: 0 20rpx;
}
.order-goods .item .btn.active {
background: #b4282d;
color: #fff;
background: #b4282d;
color: #fff;
}
.order-bottom {
margin-top: 20rpx;
padding-left: 31.25rpx;
height: auto;
overflow: hidden;
background: #fff;
margin-top: 20rpx;
padding-left: 31.25rpx;
height: auto;
overflow: hidden;
background: #fff;
}
.order-bottom .address {
height: 128rpx;
padding-top: 25rpx;
border-bottom: 1px solid #f4f4f4;
height: 128rpx;
padding-top: 25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order-bottom .address .t {
height: 35rpx;
line-height: 35rpx;
margin-bottom: 7.5rpx;
height: 35rpx;
line-height: 35rpx;
margin-bottom: 7.5rpx;
}
.order-bottom .address .name {
display: inline-block;
height: 35rpx;
width: 140rpx;
line-height: 35rpx;
font-size: 30rpx;
display: inline-block;
height: 35rpx;
width: 140rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .address .mobile {
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .address .b {
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .total {
height: 106rpx;
padding-top: 20rpx;
border-bottom: 1px solid #f4f4f4;
height: 106rpx;
padding-top: 20rpx;
border-bottom: 1px solid #f4f4f4;
}
.order-bottom .total .t {
height: 30rpx;
line-height: 30rpx;
margin-bottom: 7.5rpx;
display: flex;
height: 30rpx;
line-height: 30rpx;
margin-bottom: 7.5rpx;
display: flex;
}
.order-bottom .total .label {
width: 150rpx;
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
width: 150rpx;
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .total .txt {
flex: 1;
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
flex: 1;
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .pay-fee {
height: 81rpx;
line-height: 81rpx;
height: 81rpx;
line-height: 81rpx;
}
.order-bottom .pay-fee .label {
display: inline-block;
width: 140rpx;
color: #b4282d;
display: inline-block;
width: 140rpx;
color: #b4282d;
}
.order-bottom .pay-fee .txt {
display: inline-block;
width: 140rpx;
color: #b4282d;
display: inline-block;
width: 140rpx;
color: #b4282d;
}
.order-express {
margin-top: 20rpx;
width: 100%;
height: 100rpx;
background: #fff;
margin-top: 20rpx;
width: 100%;
height: 100rpx;
background: #fff;
}
.order-express .expand {
/* margin-top: 20rpx; */
width: 100%;
height: 100rpx;
background: #fff;
/* border: 10rpx #a78845; */
/* margin-top: 20rpx; */
width: 100%;
height: 100rpx;
background: #fff;
/* border: 10rpx #a78845; */
}
.order-express .title {
float: left;
margin-bottom: 20rpx;
padding: 10rpx;
float: left;
margin-bottom: 20rpx;
padding: 10rpx;
}
.order-express .ti {
float: right;
width: 52rpx;
height: 52rpx;
margin-right: 16rpx;
margin-top: 28rpx;
float: right;
width: 52rpx;
height: 52rpx;
margin-right: 16rpx;
margin-top: 28rpx;
}
.order-express .t {
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
}
.order-express .b {
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
}
.order-express .traces {
padding: 17.5rpx;
background: #fff;
border-bottom: 1rpx solid #f1e6cdcc;
padding: 17.5rpx;
background: #fff;
border-bottom: 1rpx solid #f1e6cdcc;
}
.order-express .trace {
padding-bottom: 17.5rpx;
padding-top: 17.5rpx;
background: #fff;
padding-bottom: 17.5rpx;
padding-top: 17.5rpx;
background: #fff;
}
.order-express .acceptTime {
margin-top: 20rpx;
margin-right: 40rpx;
text-align: right;
font-size: 26rpx;
margin-top: 20rpx;
margin-right: 40rpx;
text-align: right;
font-size: 26rpx;
}
.order-express .acceptStation {
font-size: 26rpx;
font-size: 26rpx;
}
.menu-list-pro {
margin-top: 20rpx;
overflow-x: scroll;
white-space: nowrap;
text-overflow: ellipsis;
height: 260rpx;
width: 100%;
overflow: hidden;
border-bottom: 1rpx #cfc9ca;
background-color: #fff;
margin-top: 20rpx;
overflow-x: scroll;
white-space: nowrap;
text-overflow: ellipsis;
height: 260rpx;
width: 100%;
overflow: hidden;
border-bottom: 1rpx #cfc9ca;
background-color: #fff;
}
.menu-list-pro .h {
height: 93.75rpx;
line-height: 93.75rpx;
margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx;
height: 93.75rpx;
line-height: 93.75rpx;
margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx;
}
.menu-list-pro .h .label {
float: left;
font-size: 30rpx;
color: #333;
float: left;
font-size: 30rpx;
color: #333;
}
.menu-list-pro .h .status {
float: right;
font-size: 30rpx;
color: #a78845;
float: right;
font-size: 30rpx;
color: #a78845;
}
.menu-list-pro .menu-list-item {
display: block;
float: left;
height: 110rpx;
width: 80rpx;
margin-top: 30rpx;
margin-bottom: 30rpx;
margin-left: 40rpx;
display: block;
float: left;
height: 110rpx;
width: 80rpx;
margin-top: 30rpx;
margin-bottom: 30rpx;
margin-left: 40rpx;
}
.menu-list-pro .icon {
height: 80rpx;
width: 80rpx;
border-radius: 12rpx;
box-shadow: 0px 4rpx 4rpx 0px #cfc9ca;
height: 80rpx;
width: 80rpx;
border-radius: 12rpx;
box-shadow: 0px 4rpx 4rpx 0px #cfc9ca;
}
.menu-list-pro .txt {
display: block;
float: left;
width: 80rpx;
margin-top: 5rpx;
font-size: 22rpx;
color: #a78845;
display: block;
float: left;
width: 80rpx;
margin-top: 5rpx;
font-size: 22rpx;
color: #a78845;
}
renard-wx/pages/groupon/grouponList/grouponList.js
View file @
286c0ae7
...
...
@@ -20,59 +20,59 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
this
.
getGrouponList
();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
:
function
()
{
onReady
:
function
()
{
},
/**
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
onShow
:
function
()
{
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide
:
function
()
{
onHide
:
function
()
{
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload
:
function
()
{
onUnload
:
function
()
{
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh
:
function
()
{
onPullDownRefresh
:
function
()
{
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom
:
function
()
{
onReachBottom
:
function
()
{
},
/**
* 用户点击右上角分享
*/
onShareAppMessage
:
function
()
{
onShareAppMessage
:
function
()
{
},
getGrouponList
:
function
()
{
getGrouponList
:
function
()
{
let
that
=
this
;
that
.
setData
({
...
...
@@ -87,7 +87,10 @@ Page({
duration
:
2000
});
util
.
request
(
api
.
GroupOnList
,
{
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
}).
then
(
function
(
res
)
{
util
.
request
(
api
.
GroupOnList
,
{
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
...
...
@@ -101,7 +104,7 @@ Page({
});
},
nextPage
:
function
(
event
)
{
nextPage
:
function
(
event
)
{
var
that
=
this
;
if
(
this
.
data
.
page
>
that
.
data
.
count
/
that
.
data
.
size
)
{
return
true
;
...
...
@@ -115,7 +118,7 @@ Page({
this
.
getTopic
();
},
prevPage
:
function
(
event
)
{
prevPage
:
function
(
event
)
{
if
(
this
.
data
.
page
<=
1
)
{
return
false
;
}
...
...
renard-wx/pages/groupon/grouponList/grouponList.json
View file @
286c0ae7
...
...
@@ -2,5 +2,5 @@
"navigationBarTitleText"
:
"团购专区"
,
"usingComponents"
:
{
"zan-capsule"
:
"/components/capsule/index"
}
}
}
\ No newline at end of file
renard-wx/pages/groupon/grouponList/grouponList.wxss
View file @
286c0ae7
page
,.container{
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
page,
.container
{
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
}
.groupon-list{
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
.groupon-list {
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
}
.groupon-list .item {
height: 244rpx;
width: 100%;
background: #fff;
margin-bottom: 20rpx;
height: 244rpx;
width: 100%;
background: #fff;
margin-bottom: 20rpx;
}
.groupon-list .img {
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
}
.groupon-list .right {
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
}
.groupon-list .text {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
}
.groupon-list .name {
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
}
.groupon-list .capsule-tag {
float: right;
padding-right: 0rpx;
padding-top: 8rpx;
float: right;
padding-right: 0rpx;
padding-top: 8rpx;
}
.groupon-list .zan-capsule + .zan-capsule {
margin-left: 10px;
margin-left: 10px;
}
.groupon-list .desc {
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
}
.groupon-list .price {
width: 476rpx;
display: flex;
color: #
AB
956
D
;
line-height: 50rpx;
font-size: 33rpx;
width: 476rpx;
display: flex;
color: #
ab
956
d
;
line-height: 50rpx;
font-size: 33rpx;
}
.groupon-list .counterPrice {
text-decoration: line-through;
font-size: 28rpx;
color: #999;
text-decoration: line-through;
font-size: 28rpx;
color: #999;
}
.groupon-list .retailPrice {
margin-left: 30rpx;
font-size: 28rpx;
color: #a78845;
margin-left: 30rpx;
font-size: 28rpx;
color: #a78845;
}
.page{
width: 750rpx;
height: 108rpx;
background: #fff;
margin-bottom: 20rpx;
.page
{
width: 750rpx;
height: 108rpx;
background: #fff;
margin-bottom: 20rpx;
}
.page view{
height: 108rpx;
width: 50%;
float: left;
font-size: 29rpx;
color: #333;
text-align: center;
line-height: 108rpx;
.page view
{
height: 108rpx;
width: 50%;
float: left;
font-size: 29rpx;
color: #333;
text-align: center;
line-height: 108rpx;
}
.page .prev{
border-right: 1px solid #
D9D9D
9;
.page .prev
{
border-right: 1px solid #
d9d9d
9;
}
.page .disabled{
color: #ccc;
}
\ No newline at end of file
.page .disabled {
color: #ccc;
}
renard-wx/pages/groupon/myGroupon/myGroupon.js
View file @
286c0ae7
...
...
@@ -2,60 +2,60 @@ var util = require('../../../utils/util.js');
var
api
=
require
(
'
../../../config/api.js
'
);
Page
({
data
:
{
orderList
:
[],
showType
:
0
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
},
data
:
{
orderList
:
[],
showType
:
0
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
},
onPullDownRefresh
()
{
// wx.showNavigationBarLoading() //在标题栏中显示加载
this
.
getOrderList
();
// wx.hideNavigationBarLoading() //完成停止加载
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
onPullDownRefresh
()
{
// wx.showNavigationBarLoading() //在标题栏中显示加载
this
.
getOrderList
();
// wx.hideNavigationBarLoading() //完成停止加载
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
getOrderList
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
getOrderList
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
let
that
=
this
;
util
.
request
(
api
.
GroupOnMy
,
{
showType
:
that
.
data
.
showType
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
orderList
:
res
.
data
.
data
let
that
=
this
;
util
.
request
(
api
.
GroupOnMy
,
{
showType
:
that
.
data
.
showType
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
orderList
:
res
.
data
.
data
});
wx
.
hideLoading
();
}
});
},
switchTab
:
function
(
event
)
{
let
showType
=
event
.
currentTarget
.
dataset
.
index
;
this
.
setData
({
showType
:
showType
});
wx
.
hideLoading
();
}
});
},
switchTab
:
function
(
event
)
{
let
showType
=
event
.
currentTarget
.
dataset
.
index
;
this
.
setData
({
showType
:
showType
});
this
.
getOrderList
();
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
this
.
getOrderList
();
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
}
this
.
getOrderList
();
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
this
.
getOrderList
();
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
}
})
\ No newline at end of file
Prev
1
2
3
4
5
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment