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
f9639790
Commit
f9639790
authored
Jul 19, 2018
by
usgeek
Browse files
商品详情页中的加入购物车样式调整,添加客服功能
parent
70763a2e
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
litemall-wx/pages/goods/goods.js
View file @
f9639790
...
@@ -42,7 +42,7 @@ Page({
...
@@ -42,7 +42,7 @@ Page({
// 这里检测一下
// 这里检测一下
let
_productPrice
=
res
.
data
.
productList
[
0
].
price
;
let
_productPrice
=
res
.
data
.
productList
[
0
].
price
;
let
_goodsPrice
=
res
.
data
.
info
.
retailPrice
;
let
_goodsPrice
=
res
.
data
.
info
.
retailPrice
;
if
(
_productPrice
!=
_goodsPrice
){
if
(
_productPrice
!=
_goodsPrice
)
{
console
.
error
(
'
商品数量价格和货品不一致
'
);
console
.
error
(
'
商品数量价格和货品不一致
'
);
}
}
...
@@ -206,21 +206,21 @@ Page({
...
@@ -206,21 +206,21 @@ Page({
}
}
let
checkedProduct
=
checkedProductArray
[
0
];
let
checkedProduct
=
checkedProductArray
[
0
];
if
(
checkedProduct
.
number
>
0
){
if
(
checkedProduct
.
number
>
0
)
{
this
.
setData
({
this
.
setData
({
checkedSpecPrice
:
checkedProduct
.
price
,
checkedSpecPrice
:
checkedProduct
.
price
,
soldout
:
false
soldout
:
false
});
});
}
}
else
{
else
{
this
.
setData
({
this
.
setData
({
checkedSpecPrice
:
this
.
data
.
goods
.
retailPrice
,
checkedSpecPrice
:
this
.
data
.
goods
.
retailPrice
,
soldout
:
true
soldout
:
true
});
});
}
}
}
}
else
{
else
{
this
.
setData
({
this
.
setData
({
checkedSpecText
:
'
规格数量选择
'
,
checkedSpecText
:
'
规格数量选择
'
,
checkedSpecPrice
:
this
.
data
.
goods
.
retailPrice
,
checkedSpecPrice
:
this
.
data
.
goods
.
retailPrice
,
...
@@ -276,28 +276,33 @@ Page({
...
@@ -276,28 +276,33 @@ Page({
});
});
}
}
},
},
closeAttrOrCollect
:
function
()
{
closeAttr
:
function
()
{
this
.
setData
({
openAttr
:
false
,
});
},
addCollectOrNot
:
function
()
{
let
that
=
this
;
let
that
=
this
;
if
(
this
.
data
.
openAttr
)
{
//
if (this.data.openAttr) {
this
.
setData
({
//
this.setData({
openAttr
:
false
,
//
openAttr: false,
});
//
});
if
(
that
.
data
.
userHasCollect
==
1
)
{
//
if (that.data.userHasCollect == 1) {
that
.
setData
({
//
that.setData({
collectBackImage
:
that
.
data
.
hasCollectImage
//
collectBackImage: that.data.hasCollectImage
});
//
});
}
else
{
//
} else {
that
.
setData
({
//
that.setData({
collectBackImage
:
that
.
data
.
noCollectImage
//
collectBackImage: that.data.noCollectImage
});
//
});
}
//
}
}
else
{
//
} else {
//添加或是取消收藏
//添加或是取消收藏
util
.
request
(
api
.
CollectAddOrDelete
,
{
type
:
0
,
valueId
:
this
.
data
.
id
},
"
POST
"
)
util
.
request
(
api
.
CollectAddOrDelete
,
{
type
:
0
,
valueId
:
this
.
data
.
id
},
"
POST
"
)
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
let
_res
=
res
;
let
_res
=
res
;
if
(
_res
.
errno
==
0
)
{
if
(
_res
.
errno
==
0
)
{
if
(
_res
.
data
.
type
==
'
add
'
)
{
if
(
_res
.
data
.
type
==
'
add
'
)
{
that
.
setData
({
that
.
setData
({
collectBackImage
:
that
.
data
.
hasCollectImage
collectBackImage
:
that
.
data
.
hasCollectImage
});
});
...
@@ -316,7 +321,6 @@ Page({
...
@@ -316,7 +321,6 @@ Page({
}
}
});
});
}
},
},
openCartPage
:
function
()
{
openCartPage
:
function
()
{
...
@@ -394,7 +398,7 @@ Page({
...
@@ -394,7 +398,7 @@ Page({
//打开规格选择窗口
//打开规格选择窗口
this
.
setData
({
this
.
setData
({
openAttr
:
!
this
.
data
.
openAttr
,
openAttr
:
!
this
.
data
.
openAttr
,
collectBackImage
:
'
/static/images/detail_back.png
'
//
collectBackImage: '/static/images/detail_back.png'
});
});
}
else
{
}
else
{
...
...
litemall-wx/pages/goods/goods.wxml
View file @
f9639790
<scroll-view class="container" scroll-y="true">
<view class="container">
<view wx:if="{{!openAttr}}">
<swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{goods.gallery}}" wx:key="*this">
<swiper-item wx:for="{{goods.gallery}}" wx:key="*this">
<image src="{{item}}" background-size="cover"></image>
<image src="{{item}}" background-size="cover"></image>
</swiper-item>
</swiper-item>
</swiper>
</swiper>
<view class="service-policy">
<view class="service-policy">
<view class="item">30天无忧退货</view>
<view class="item">30天无忧退货</view>
<view class="item">48小时快速退款</view>
<view class="item">48小时快速退款</view>
<view class="item">满88元免邮费</view>
<view class="item">满88元免邮费</view>
</view>
</view>
<view class="goods-info">
<view class="goods-info">
<view class="c">
<view class="c">
<text class="name">{{goods.name}}</text>
<text class="name">{{goods.name}}</text>
<text class="desc">{{goods.goodsBrief}}</text>
<text class="desc">{{goods.goodsBrief}}</text>
<text class="price">¥{{checkedSpecPrice}}</text>
<text class="price">¥{{checkedSpecPrice}}</text>
<view class="brand" wx:if="{{brand.name}}">
<view class="brand" wx:if="{{brand.name}}">
<navigator url="../brandDetail/brandDetail?id={{brand.id}}">
<navigator url="/pages/brandDetail/brandDetail?id={{brand.id}}">
<text>{{brand.name}}</text>
<text>{{brand.name}}</text>
</navigator>
</navigator>
</view>
</view>
</view>
</view>
</view>
<view class="section-nav section-attr" bindtap="switchAttrPop">
</view>
<view class="t">{{checkedSpecText}}</view>
<view class="section-nav section-attr" bindtap="switchAttrPop">
<image class="i" src="/static/images/address_right.png" background-size="cover"></image>
<view class="t">{{checkedSpecText}}</view>
<image class="i" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<view class="comments" wx:if="{{comment.count > 0}}">
<view class="h">
<navigator url="/pages/comment/comment?valueId={{goods.id}}&type=0">
<text class="t">评价({{comment.count > 999 ? '999+' : comment.count}})</text>
<text class="i">查看全部</text>
</navigator>
</view>
</view>
<view class="comments" wx:if="{{comment.count > 0}}">
<view class="b">
<view class="h">
<view class="item" wx:for="{{comment.data}}" wx:key="id">
<navigator url="/pages/comment/comment?valueId={{goods.id}}&type=0">
<view class="info">
<text class="t">评价({{comment.count > 999 ? '999+' : comment.count}})</text>
<view class="user">
<text class="i">查看全部</text>
<image src="{{item.avatar}}"></image>
</navigator>
<text>{{item.nickname}}</text>
</view>
<view class="b">
<view class="item" wx:for="{{comment.data}}" wx:key="id">
<view class="info">
<view class="user">
<image src="{{item.avatar}}"></image>
<text>{{item.nickname}}</text>
</view>
<view class="time">{{item.addTime}}</view>
</view>
<view class="content">
{{item.content}}
</view>
<view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="*this" wx:for-item="iitem" src="{{iitem}}"></image>
</view>
</view>
<view class="time">{{item.addTime}}</view>
</view>
<view class="content">
{{item.content}}
</view>
<view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="*this" wx:for-item="iitem" src="{{iitem}} "></image>
</view>
</view>
<!-- <view class="spec">白色 2件</view> -->
</view>
</view>
</view>
</view>
<view
class="goods-attr"
>
<
/
view>
<view class="
t">商品参数</view
>
<view class="
goods-attr"
>
<view class="
l
">
<view class="
t
">
商品参数</view>
<view class="
item" wx:for="{{attribute}}" wx:key="item
">
<view class="
l
">
<text class="left">{{item.attribute}}</text
>
<view class="item" wx:for="{{attribute}}" wx:key="name"
>
<text class="
righ
t">{{item.
valu
e}}</text>
<text class="
lef
t">{{item.
attribut
e}}</text>
<
/view
>
<
text class="right">{{item.value}}</text
>
</view>
</view>
</view>
</view>
</view>
<view class="detail">
<view class="detail">
<import src="/lib/wxParse/wxParse.wxml" />
<import src="/lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
<template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
</view>
</view>
<view class="common-problem">
<view class="
h
">
<view class="
common-problem
">
<view class="
line"></view
>
<view class="
h"
>
<text
class="
title">常见问题</text
>
<view
class="
line"></view
>
<
/view
>
<
text class="title">常见问题</text
>
<view
class="b"
>
<
/
view>
<view class="
item" wx:for="{{issueList}}" wx:key="id
">
<view class="
b
">
<view class="
question-box
">
<view class="
item" wx:for="{{issueList}}" wx:key="id
">
<text class="spot"></text
>
<view class="question-box"
>
<text class="
question">{{item.question}}
</text>
<text class="
spot">
</text>
<
/view
>
<
text class="question">{{item.question}}</text
>
<view
class="answer"
>
<
/
view>
{{item.
answer
}}
<view class="
answer
">
</view>
{{item.answer}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="related-goods" wx:if="{{relatedGoods.length > 0}}">
<view class="related-goods" wx:if="{{relatedGoods.length > 0}}">
<view class="h">
<view class="h">
<view class="line"></view>
<view class="line"></view>
<text class="title">大家都在看</text>
<text class="title">大家都在看</text>
</view>
</view>
<view class="b">
<view class="b">
<view class="item" wx:for="{{relatedGoods}}" wx:key="id">
<view class="item" wx:for="{{relatedGoods}}" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.id}}">
<navigator url="/pages/goods/goods?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<text class="name">{{item.name}}</text>
<text class="name">{{item.name}}</text>
<text class="price">¥{{item.retailPrice}}</text>
<text class="price">¥{{item.retailPrice}}</text>
</navigator>
</navigator>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:if="{{openAttr}}" class="attr-pop">
</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">
<view class="img-info">
<image class="img" src="{{goods.picUrl}}"></image>
<image class="img" src="{{goods.picUrl}}"></image>
<view class="info">
<view class="info">
<view class="c">
<view class="c">
<view class="p">价格:¥{{checkedSpecPrice}}</view>
<view class="p">价格:¥{{checkedSpecPrice}}</view>
<view class="a"
>{{tmp
SpecText}}</view>
<view class="a"
wx:if="{{productList.length>0}}">已选择:{{checked
SpecText}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -114,9 +119,7 @@
...
@@ -114,9 +119,7 @@
<view class="spec-item" wx:for="{{specificationList}}" wx:key="name">
<view class="spec-item" wx:for="{{specificationList}}" wx:key="name">
<view class="name">{{item.name}}</view>
<view class="name">{{item.name}}</view>
<view class="values">
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="id" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">
<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-id="{{vitem.specification}}">{{vitem.value}}</view>
{{vitem.value}}
</view>
</view>
</view>
</view>
</view>
...
@@ -130,9 +133,13 @@
...
@@ -130,9 +133,13 @@
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="contact">
<contact-button style="opacity:0;position:absolute;" type="default-dark" session-from="weapp" size="27">
</contact-button>
</view>
<view class="bottom-btn">
<view class="bottom-btn">
<view class="l l-collect
{{ openAttr ? 'back' : ''}}" bindtap="closeAttrOrCollec
t">
<view class="l l-collect
" bindtap="addCollectOrNo
t">
<image class="icon" src="{{ collectBackImage }}"></image>
<image class="icon" src="{{ collectBackImage }}"></image>
</view>
</view>
<view class="l l-cart">
<view class="l l-cart">
...
...
litemall-wx/pages/goods/goods.wxss
View file @
f9639790
This diff is collapsed.
Click to expand it.
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