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
854bacf6
"jshERP-web/git@ustchcs.com:gujinli1118/JSH_ERP.git" did not exist on "536f5603775a652d6dd275c245aa32407c7a7afd"
Commit
854bacf6
authored
Aug 25, 2018
by
Menethil
Browse files
添加Renard小程序
parent
a50998e6
Changes
222
Hide whitespace changes
Inline
Side-by-side
renard-wx/pages/ucenter/address/address.js
0 → 100644
View file @
854bacf6
var
util
=
require
(
'
../../../utils/util.js
'
);
var
api
=
require
(
'
../../../config/api.js
'
);
var
app
=
getApp
();
Page
({
data
:
{
addressList
:
[],
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
this
.
getAddressList
();
},
onPullDownRefresh
()
{
wx
.
showNavigationBarLoading
()
//在标题栏中显示加载
this
.
getAddressList
();
wx
.
hideNavigationBarLoading
()
//完成停止加载
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
getAddressList
()
{
let
that
=
this
;
util
.
request
(
api
.
AddressList
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
addressList
:
res
.
data
});
}
});
},
addressAddOrUpdate
(
event
)
{
console
.
log
(
event
);
//返回之前,先取出上一页对象,并设置addressId
var
pages
=
getCurrentPages
();
var
prevPage
=
pages
[
pages
.
length
-
2
];
if
(
prevPage
.
route
==
"
pages/shopping/checkout/checkout
"
)
{
console
.
log
(
event
.
currentTarget
.
dataset
.
addressId
);
// prevPage.setData({
// addressId: event.currentTarget.dataset.addressId
// });
try
{
wx
.
setStorageSync
(
'
addressId
'
,
event
.
currentTarget
.
dataset
.
addressId
);
}
catch
(
e
)
{
}
let
addressId
=
event
.
currentTarget
.
dataset
.
addressId
;
console
.
log
(
addressId
);
if
(
addressId
&&
addressId
!=
0
)
{
wx
.
navigateBack
();
}
else
{
wx
.
navigateTo
({
url
:
'
/pages/ucenter/addressAdd/addressAdd?id=
'
+
addressId
})
}
}
else
{
wx
.
navigateTo
({
url
:
'
/pages/ucenter/addressAdd/addressAdd?id=
'
+
event
.
currentTarget
.
dataset
.
addressId
})
}
},
deleteAddress
(
event
)
{
console
.
log
(
event
.
target
);
let
that
=
this
;
wx
.
showModal
({
title
:
''
,
content
:
'
确定要删除地址?
'
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
let
addressId
=
event
.
target
.
dataset
.
addressId
;
util
.
request
(
api
.
AddressDelete
,
{
id
:
addressId
},
'
POST
'
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
getAddressList
();
wx
.
removeStorage
({
key
:
'
addressId
'
,
success
:
function
(
res
)
{},
})
}
});
console
.
log
(
'
用户点击确定
'
)
}
}
});
return
false
;
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
}
});
\ No newline at end of file
renard-wx/pages/ucenter/address/address.json
0 → 100644
View file @
854bacf6
{
"navigationBarTitleText"
:
"地址管理"
}
\ No newline at end of file
renard-wx/pages/ucenter/address/address.wxml
0 → 100644
View file @
854bacf6
<view class="container">
<view class="address-list" wx:if="{{ addressList.length > 0 }}">
<view class="item" wx:for="{{addressList}}" wx:key="id" bindtap="addressAddOrUpdate" data-address-id="{{item.id}}">
<view class="l">
<view class="name">{{item.name}}</view>
<view class="default" wx:if="{{item.isDefault}}">默认</view>
</view>
<view class="c">
<view class="mobile">{{item.mobile}}</view>
<view class="address">{{item.detailedAddress}}</view>
</view>
<view class="r">
<image catchtap="deleteAddress" data-address-id="{{item.id}}" class="del" src="/static/images/del-address.png"></image>
</view>
</view>
</view>
<view class="empty-view" wx:if="{{ addressList.length <= 0 }}">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noAddress-26d570cefa.png"></image>
<text class="text">收货地址在哪里</text>
</view>
<view class="add-address" bindtap="addressAddOrUpdate" data-address-id="0">新建</view>
</view>
renard-wx/pages/ucenter/address/address.wxss
0 → 100644
View file @
854bacf6
page{
height: 100%;
width: 100%;
background: #f4f4f4;
}
.container{
height: 100%;
width: 100%;
}
.address-list{
padding-left: 31.25rpx;
background: #fff url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/address-bg-bd30f2bfeb.png) 0 0 repeat-x;
background-size: auto 10.5rpx;
margin-bottom: 90rpx;
}
.address-list .item{
height: 156.55rpx;
align-items: center;
display: flex;
border-bottom: 1rpx solid #DCD9D9;
}
.address-list .l{
width: 125rpx;
height: 80rpx;
overflow: hidden;
}
.address-list .name{
width: 125rpx;
height: 43rpx;
font-size: 29rpx;
margin-bottom: 5.2rpx;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.address-list .default{
width: 62.5rpx;
height: 33rpx;
line-height: 28rpx;
text-align: center;
font-size: 20rpx;
color: #a78845;
border: 1rpx solid #a78845;
visibility: visible;
}
.address-list .c{
flex: 1;
height: auto;
overflow: hidden;
}
.address-list .mobile{
height: 29rpx;
font-size: 29rpx;
line-height: 29rpx;
overflow: hidden;
margin-bottom: 6.25rpx;
}
.address-list .address{
height: 37rpx;
font-size: 25rpx;
line-height: 37rpx;
overflow: hidden;
}
.address-list .r{
width: 52rpx;
height: auto;
overflow: hidden;
margin-right: 16.5rpx;
}
.address-list .del{
display: block;
width: 52rpx;
height: 52rpx;
}
.add-address{
background: #a78845;
text-align: center;
width: 100%;
height: 99rpx;
line-height: 99rpx;
position: fixed;
border-radius: 0;
border: none;
color: #fff;
font-size: 29rpx;
bottom: 0;
left:0;
}
.empty-view{
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.empty-view .icon{
height: 248rpx;
width: 258rpx;
margin-bottom: 10rpx;
}
.empty-view .text{
width: auto;
font-size: 28rpx;
line-height: 35rpx;
color: #999;
}
\ No newline at end of file
renard-wx/pages/ucenter/addressAdd/addressAdd.js
0 → 100644
View file @
854bacf6
var
util
=
require
(
'
../../../utils/util.js
'
);
var
api
=
require
(
'
../../../config/api.js
'
);
var
check
=
require
(
'
../../../utils/check.js
'
);
var
app
=
getApp
();
Page
({
data
:
{
address
:
{
id
:
0
,
provinceId
:
0
,
cityId
:
0
,
areaId
:
0
,
address
:
''
,
name
:
''
,
mobile
:
''
,
isDefault
:
0
,
provinceName
:
''
,
cityName
:
''
,
areaName
:
''
},
addressId
:
0
,
openSelectRegion
:
false
,
regionType
:
1
,
selectRegionDone
:
false
},
bindinputMobile
(
event
)
{
let
address
=
this
.
data
.
address
;
address
.
mobile
=
event
.
detail
.
value
;
this
.
setData
({
address
:
address
});
},
bindinputName
(
event
)
{
let
address
=
this
.
data
.
address
;
address
.
name
=
event
.
detail
.
value
;
this
.
setData
({
address
:
address
});
},
bindinputAddress
(
event
)
{
let
address
=
this
.
data
.
address
;
address
.
address
=
event
.
detail
.
value
;
this
.
setData
({
address
:
address
});
},
bindIsDefault
()
{
let
address
=
this
.
data
.
address
;
address
.
isDefault
=
!
address
.
isDefault
;
this
.
setData
({
address
:
address
});
},
getAddressDetail
()
{
let
that
=
this
;
util
.
request
(
api
.
AddressDetail
,
{
id
:
that
.
data
.
addressId
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
if
(
res
.
data
)
{
that
.
setData
({
address
:
res
.
data
});
}
}
});
},
wxChooseAddress
()
{
let
that
=
this
;
let
address
=
this
.
data
.
address
;
// 用户已经同意小程序使用地址功能
wx
.
chooseAddress
({
success
:
function
(
res
)
{
address
.
provinceId
=
99999
;
address
.
cityId
=
88888
;
address
.
areaId
=
77777
;
address
.
name
=
res
.
userName
;
address
.
mobile
=
res
.
telNumber
;
address
.
provinceName
=
res
.
provinceName
;
address
.
cityName
=
res
.
cityName
;
address
.
areaName
=
res
.
countyName
;
address
.
address
=
res
.
provinceName
+
res
.
cityName
+
res
.
countyName
+
res
.
detailInfo
;
that
.
setData
({
address
:
address
,
});
}
});
},
wxAddress
()
{
let
that
=
this
;
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.address" 这个 scope
wx
.
getSetting
({
success
(
res
)
{
if
(
!
res
.
authSetting
[
'
scope.address
'
])
{
wx
.
authorize
({
scope
:
'
scope.address
'
,
success
()
{
that
.
wxChooseAddress
();
}
})
}
else
{
that
.
wxChooseAddress
();
}
}
})
},
onLoad
:
function
(
options
)
{
let
that
=
this
;
// 页面初始化 options为页面跳转所带来的参数
console
.
log
(
options
);
if
(
options
.
id
&&
options
.
id
!=
0
)
{
this
.
setData
({
addressId
:
options
.
id
});
this
.
getAddressDetail
();
}
else
{
that
.
wxAddress
();
}
},
onReady
:
function
()
{
},
cancelAddress
()
{
wx
.
navigateBack
();
},
saveAddress
()
{
console
.
log
(
this
.
data
.
address
);
let
address
=
this
.
data
.
address
;
if
(
address
.
name
==
''
)
{
util
.
showErrorToast
(
'
请输入姓名
'
);
return
false
;
}
if
(
address
.
mobile
==
''
)
{
util
.
showErrorToast
(
'
请输入手机号码
'
);
return
false
;
}
if
(
address
.
areaId
==
0
)
{
util
.
showErrorToast
(
'
请输入省市区
'
);
return
false
;
}
if
(
address
.
address
==
''
)
{
util
.
showErrorToast
(
'
请输入详细地址
'
);
return
false
;
}
if
(
!
check
.
isValidPhone
(
address
.
mobile
))
{
util
.
showErrorToast
(
'
手机号不正确
'
);
return
false
;
}
let
that
=
this
;
util
.
request
(
api
.
AddressSave
,
{
id
:
address
.
id
,
name
:
address
.
name
,
mobile
:
address
.
mobile
,
provinceId
:
address
.
provinceId
,
cityId
:
address
.
cityId
,
areaId
:
address
.
areaId
,
address
:
address
.
address
,
isDefault
:
address
.
isDefault
,
provinceName
:
address
.
provinceName
,
cityName
:
address
.
cityName
,
countyName
:
address
.
areaName
},
'
POST
'
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
//返回之前,先取出上一页对象,并设置addressId
var
pages
=
getCurrentPages
();
var
prevPage
=
pages
[
pages
.
length
-
2
];
console
.
log
(
prevPage
);
if
(
prevPage
.
route
==
"
pages/shopping/checkout/checkout
"
)
{
prevPage
.
setData
({
addressId
:
res
.
data
});
try
{
wx
.
setStorageSync
(
'
addressId
'
,
res
.
data
);
}
catch
(
e
)
{
}
console
.
log
(
"
set address
"
);
}
wx
.
navigateBack
();
}
});
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
}
});
\ No newline at end of file
renard-wx/pages/ucenter/addressAdd/addressAdd.json
0 → 100644
View file @
854bacf6
{
"navigationBarTitleText"
:
"编辑地址"
}
\ No newline at end of file
renard-wx/pages/ucenter/addressAdd/addressAdd.wxml
0 → 100644
View file @
854bacf6
<view class="add-address">
<view class="add-form">
<view class="form-item">
<input class="input" bindinput="bindinputName" placeholder="姓名" value="{{address.name}}"/>
</view>
<view class="form-item">
<input class="input" bindinput="bindinputMobile" value="{{address.mobile}}" placeholder="手机号码"/>
</view>
<view class="form-item">
<input class="input" bindinput="bindinputAddress" value="{{address.address}}" placeholder="详细地址"/>
</view>
<view class="form-default">
<text bindtap="bindIsDefault" class="default-input {{address.isDefault == 1 ? 'selected' : ''}}">设为默认地址</text>
</view>
</view>
<view class="btns">
<button class="cannel" bindtap="cancelAddress">取消</button>
<button class="save" bindtap="saveAddress">保存</button>
</view>
</view>
<view class="bg-mask" bindtap="cancelSelectRegion" wx:if="{{openSelectRegion}}"></view>
\ No newline at end of file
renard-wx/pages/ucenter/addressAdd/addressAdd.wxss
0 → 100644
View file @
854bacf6
page{
height: 100%;
background: #f4f4f4;
}
.add-address .add-form{
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
}
.add-address .form-item{
height: 116rpx;
padding-left: 31.25rpx;
border-bottom: 1px solid #d9d9d9;
display: flex;
align-items: center;
padding-right: 31.25rpx;
}
.add-address .input{
flex: 1;
height: 44rpx;
line-height: 44rpx;
overflow: hidden;
}
.add-address .form-default{
border-bottom: 1px solid #d9d9d9;
height: 96rpx;
background: #fafafa;
padding-top: 28rpx;
font-size: 28rpx;
}
.default-input{
margin: 0 auto;
display: block;
width: 240rpx;
height: 40rpx;
padding-left: 50rpx;
line-height: 40rpx;
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
background-size: 38rpx 486rpx;
font-size: 28rpx;
}
.default-input.selected{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
background-size: 38rpx 486rpx;
}
.add-address .btns{
position: fixed;
bottom: 0;
left: 0;
overflow: hidden;
display: flex;
height: 100rpx;
width: 100%;
}
.add-address .cannel,.add-address .save{
flex: 1;
height: 100rpx;
text-align: center;
line-height: 100rpx;
font-size: 28rpx;
color: #fff;
border:none;
border-radius: 0;
}
.add-address .cannel{
background: #3F3F3F;
}
.add-address .save{
background: #a78845;
}
.region-select{
width: 100%;
height: 600rpx;
background: #fff;
position: fixed;
z-index: 10;
left:0;
bottom: 0;
}
.region-select .hd{
height: 108rpx;
width: 100%;
border-bottom: 1px solid #f4f4f4;
padding: 46rpx 30rpx 0 30rpx;
}
.region-select .region-selected{
float: left;
height: 60rpx;
display: flex;
}
.region-select .region-selected .item{
max-width: 140rpx;
margin-right: 30rpx;
text-align: left;
line-height: 60rpx;
height: 100%;
color: #333;
font-size: 28rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.region-select .region-selected .item.disabled{
color: #999;
}
.region-select .region-selected .item.selected{
color: #a78845;
}
.region-select .done{
float: right;
height: 60rpx;
width: 60rpx;
border: none;
background: #fff;
line-height: 60rpx;
text-align: center;
color: #333;
font-size: 28rpx;
}
.region-select .done.disabled{
color: #999;
}
.region-select .bd{
height: 492rpx;
width: 100%;
padding: 0 30rpx;
}
.region-select .region-list{
height: 492rpx;
}
.region-select .region-list .item{
width: 100%;
height: 104rpx;
line-height: 104rpx;
text-align: left;
color: #333;
font-size: 28rpx;
}
.region-select .region-list .item.selected{
color: #b4282d;
}
.bg-mask{
height: 100%;
width: 100%;
background: rgba(0, 0, 0, 0.4);
position: fixed;
top:0;
left:0;
z-index: 8;
}
renard-wx/pages/ucenter/collect/collect.js
0 → 100644
View file @
854bacf6
var
util
=
require
(
'
../../../utils/util.js
'
);
var
api
=
require
(
'
../../../config/api.js
'
);
var
app
=
getApp
();
Page
({
data
:
{
type
:
0
,
collectList
:
[],
page
:
1
,
size
:
10
,
totalPages
:
1
},
onPullDownRefresh
()
{
wx
.
showNavigationBarLoading
()
//在标题栏中显示加载
this
.
getCollectList
();
wx
.
hideNavigationBarLoading
()
//完成停止加载
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
getCollectList
()
{
wx
.
showLoading
({
title
:
'
加载中...
'
,
});
let
that
=
this
;
util
.
request
(
api
.
CollectList
,
{
type
:
that
.
data
.
type
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
collectList
:
res
.
data
.
collectList
,
totalPages
:
res
.
data
.
totalPages
});
}
wx
.
hideLoading
();
});
},
getAndAddCollectList
()
{
wx
.
showLoading
({
title
:
'
加载中...
'
,
});
let
that
=
this
;
util
.
request
(
api
.
CollectList
,
{
type
:
that
.
data
.
type
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
collectList
:
that
.
data
.
collectList
.
concat
(
res
.
data
.
collectList
),
totalPages
:
res
.
data
.
totalPages
});
}
wx
.
hideLoading
();
});
},
onLoad
:
function
(
options
)
{
this
.
getCollectList
();
},
onReachBottom
()
{
if
(
this
.
data
.
totalPages
>
this
.
data
.
page
)
{
this
.
setData
({
page
:
this
.
data
.
page
+
1
});
this
.
getAndAddCollectList
();
}
else
{
wx
.
showToast
({
title
:
'
没有更多用户收藏了
'
,
icon
:
'
none
'
,
duration
:
2000
});
return
false
;
}
},
onReady
:
function
()
{
},
onShow
:
function
()
{
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
openGoods
(
event
)
{
let
that
=
this
;
let
index
=
event
.
currentTarget
.
dataset
.
index
;
let
goodsId
=
this
.
data
.
collectList
[
index
].
valueId
;
//触摸时间距离页面打开的毫秒数
var
touchTime
=
that
.
data
.
touchEnd
-
that
.
data
.
touchStart
;
console
.
log
(
touchTime
);
//如果按下时间大于350为长按
if
(
touchTime
>
350
)
{
wx
.
showModal
({
title
:
''
,
content
:
'
确定删除吗?
'
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
util
.
request
(
api
.
CollectAddOrDelete
,
{
type
:
that
.
data
.
type
,
valueId
:
goodsId
},
'
POST
'
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
console
.
log
(
res
.
data
);
wx
.
showToast
({
title
:
'
删除成功
'
,
icon
:
'
success
'
,
duration
:
2000
});
that
.
data
.
collectList
.
splice
(
index
,
1
)
that
.
setData
({
collectList
:
that
.
data
.
collectList
});
}
});
}
}
})
}
else
{
wx
.
navigateTo
({
url
:
'
/pages/goods/goods?id=
'
+
goodsId
,
});
}
},
//按下事件开始
touchStart
:
function
(
e
)
{
let
that
=
this
;
that
.
setData
({
touchStart
:
e
.
timeStamp
})
},
//按下事件结束
touchEnd
:
function
(
e
)
{
let
that
=
this
;
that
.
setData
({
touchEnd
:
e
.
timeStamp
})
},
})
\ No newline at end of file
renard-wx/pages/ucenter/collect/collect.json
0 → 100644
View file @
854bacf6
{
"navigationBarTitleText"
:
"我的收藏"
}
\ No newline at end of file
renard-wx/pages/ucenter/collect/collect.wxml
0 → 100644
View file @
854bacf6
<view class="container">
<view class="no-collect" wx:if="{{collectList.length <= 0}}">
<view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>还没有收藏</text>
</view>
</view>
<view class="collect-list" wx:else>
<view class="item" bindtap="openGoods" bindtouchstart="touchStart" bindtouchend="touchEnd" wx:for="{{collectList}}" wx:key="id" data-index="{{index}}">
<image class="img" src="{{item.picUrl}}"></image>
<view class="info">
<view class="name">{{item.name}}</view>
<view class="subtitle">{{item.brief}}</view>
<view class="price">¥{{item.retailPrice}}</view>
</view>
</view>
</view>
</view>
renard-wx/pages/ucenter/collect/collect.wxss
0 → 100644
View file @
854bacf6
page{
background: #f4f4f4;
min-height: 100%;
}
.container{
background: #f4f4f4;
min-height: 100%;
width: 100%;
height: auto;
overflow: hidden;
}
.no-collect{
width: 100%;
height: auto;
margin: 0 auto;
}
.no-collect .c{
width: 100%;
height: auto;
margin-top: 200rpx;
}
.no-collect .c image{
margin: 0 auto;
display: block;
text-align: center;
width: 258rpx;
height: 258rpx;
}
.no-collect .c text{
margin: 0 auto;
display: block;
width: 258rpx;
height: 29rpx;
line-height: 29rpx;
text-align: center;
font-size: 29rpx;
color: #999;
}
.collect-list{
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
padding-left: 30rpx;
border-top: 1px solid #e1e1e1;
}
.item{
height: 212rpx;
width: 720rpx;
background: #fff;
padding: 30rpx 30rpx 30rpx 0;
border-bottom: 1px solid #e1e1e1;
}
.item:last-child{
border-bottom: 1px solid #fff;
}
.item .img{
float: left;
width: 150rpx;
height: 150rpx;
}
.item .info{
float: right;
width: 540rpx;
height: 150rpx;
display: flex;
flex-direction: column;
justify-content: center;
padding-left: 20rpx;
}
.item .info .name{
font-size: 28rpx;
color: #333;
line-height: 40rpx;
}
.item .info .subtitle{
margin-top: 8rpx;
font-size: 24rpx;
color: #888;
line-height: 40rpx;
}
.item .info .price{
margin-top: 8rpx;
font-size: 28rpx;
color: #333;
line-height: 40rpx;
}
renard-wx/pages/ucenter/coupon/coupon.js
0 → 100644
View file @
854bacf6
var
util
=
require
(
'
../../../utils/util.js
'
);
var
api
=
require
(
'
../../../config/api.js
'
);
var
app
=
getApp
();
Page
({
data
:
{
},
onLoad
:
function
(
options
)
{
},
onReady
:
function
()
{
},
onShow
:
function
()
{
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
}
})
\ No newline at end of file
renard-wx/pages/ucenter/coupon/coupon.json
0 → 100644
View file @
854bacf6
{
"navigationBarTitleText"
:
"优惠券"
}
\ No newline at end of file
renard-wx/pages/ucenter/coupon/coupon.wxml
0 → 100644
View file @
854bacf6
<view class="container">
<view class="coupon-form">
<view class="input-box">
<input class="coupon-sn" placeholder="请输入优惠码" />
<image class="clear-icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/clear-fb-dd9d604f86.png"></image>
</view>
<button class="add-btn disabled">兑换</button>
</view>
<view class="help">使用说明</view>
<view class="coupon-list">
<view class="item">
<view class="tag">新人专享</view>
<view class="content">
<view class="left">
<view class="name">限时免单券</view>
<view class="time">2017.06.08-2017.06.11</view>
</view>
<view class="right">
<button class="go">去使用</button>
</view>
</view>
<view class="condition">
<text class="txt">简约陶瓷马克杯专享;小米用户福利;限时购、三石福利价、礼品卡及详情页标注不可用券特殊商品除外</text>
<image src="https://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/couponArrow-71315b4145.png" class="icon"></image>
</view>
</view>
<view class="item">
<view class="tag">新人专享</view>
<view class="content">
<view class="left">
<view class="name">限时免单券</view>
<view class="time">2017.06.08-2017.06.11</view>
</view>
<view class="right">
<button class="go">去使用</button>
</view>
</view>
<view class="condition">
<text class="txt">简约陶瓷马克杯专享;小米用户福利;限时购、三石福利价、礼品卡及详情页标注不可用券特殊商品除外</text>
<image src="https://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/couponArrow-71315b4145.png" class="icon"></image>
</view>
</view>
</view>
</view>
\ No newline at end of file
renard-wx/pages/ucenter/coupon/coupon.wxss
0 → 100644
View file @
854bacf6
page{
background: #f4f4f4;
min-height: 100%;
}
.container{
background: #f4f4f4;
min-height: 100%;
padding-top: 30rpx;
}
.coupon-form{
height: 110rpx;
width: 100%;
background: #fff;
padding-left: 30rpx;
padding-right: 30rpx;
padding-top: 20rpx;
display: flex;
}
.input-box{
flex: 1;
height: 70rpx;
color: #333;
font-size: 24rpx;
background: #fff;
position: relative;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4rpx;
margin-right: 30rpx;
}
.input-box .coupon-sn{
position: absolute;
top: 10rpx;
left: 30rpx;
height: 50rpx;
width: 100%;
color: #000;
line-height: 50rpx;
font-size: 24rpx;
}
.clear-icon{
position: absolute;
top: 21rpx;
right: 30rpx;
width: 28rpx;
height: 28rpx;
}
.add-btn{
height: 70rpx;
border:none;
width: 168rpx;
background: #b4282d;
border-radius: 0;
line-height: 70rpx;
color: #fff;
font-size: 28rpx;
}
.add-btn.disabled{
background: #ccc;
}
.help{
height: 72rpx;
line-height: 72rpx;
text-align: right;
padding-right: 30rpx;
background: url(https://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/couponHelp-4768607555.png) 590rpx center no-repeat;
background-size: 28rpx;
color: #999;
font-size: 24rpx;
}
.coupon-list{
width: 100%;
height: auto;
overflow: hidden;
padding-left: 30rpx;
padding-right: 30rpx;
}
.item{
position: relative;
height: 290rpx;
width: 100%;
background: linear-gradient(to right,#cfa568,#e3bf79);
margin-bottom: 30rpx;
padding-top: 52rpx;
}
.tag{
height: 32rpx;
background: #A48143;
padding-left: 16rpx;
padding-right: 16rpx;
position: absolute;
left: 20rpx;
color: #fff;
top: 20rpx;
font-size: 20rpx;
text-align: center;
line-height: 32rpx;
}
.content{
margin-top: 24rpx;
margin-left: 40rpx;
display: flex;
margin-right: 40rpx;
flex-direction: row;
align-items: center;
}
.content .left{
flex: 1;
}
.name{
font-size: 44rpx;
color: #fff;
margin-bottom: 14rpx;
}
.time{
font-size: 24rpx;
color: rgba(255,255,255, 0.8);
line-height: 30rpx;
}
.content .right{
width: 162rpx;
}
.go{
height: 48rpx;
border:none;
width: 162rpx;
background: rgba(255,255,255, 0.8);
border-radius: 4rpx;
line-height: 48rpx;
color: #b69150;
font-size: 24rpx;
}
.condition{
position: absolute;
width: 100%;
bottom: 0;
left:0;
height: 78rpx;
background: rgba(0,0,0,.08);
padding: 24rpx 40rpx;
display: flex;
flex-direction: row;
}
.condition .txt{
display: block;
height: 30rpx;
flex: 1;
overflow: hidden;
font-size: 24rpx;
line-height: 30rpx;
color: #fff;
}
.condition .icon{
margin-left: 30rpx;
width: 24rpx;
height: 24rpx;
}
\ No newline at end of file
renard-wx/pages/ucenter/footprint/footprint.js
0 → 100644
View file @
854bacf6
var
util
=
require
(
'
../../../utils/util.js
'
);
var
api
=
require
(
'
../../../config/api.js
'
);
var
app
=
getApp
();
Page
({
data
:
{
footprintList
:
[],
page
:
1
,
size
:
10
,
totalPages
:
1
},
getFootprintList
()
{
wx
.
showLoading
({
title
:
'
加载中...
'
,
});
let
that
=
this
;
util
.
request
(
api
.
FootprintList
,
{
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
let
f1
=
that
.
data
.
footprintList
;
let
f2
=
res
.
data
.
footprintList
;
for
(
let
i
=
0
;
i
<
f2
.
length
;
i
++
)
{
let
last
=
f1
.
length
-
1
;
if
(
last
>=
0
&&
f1
[
last
][
0
].
addTime
===
f2
[
i
].
addTime
)
{
f1
[
last
].
push
(
f2
[
i
]);
}
else
{
let
tmp
=
[];
tmp
.
push
(
f2
[
i
])
f1
.
push
(
tmp
);
}
}
that
.
setData
({
footprintList
:
f1
,
totalPages
:
res
.
data
.
totalPages
});
}
wx
.
hideLoading
();
});
},
deleteItem
(
event
){
let
that
=
this
;
let
index
=
event
.
currentTarget
.
dataset
.
index
;
let
iindex
=
event
.
currentTarget
.
dataset
.
iindex
;
let
goodsId
=
this
.
data
.
footprintList
[
index
][
iindex
].
id
;
var
touchTime
=
that
.
data
.
touchEnd
-
that
.
data
.
touchStart
;
console
.
log
(
touchTime
);
//如果按下时间大于350为长按
if
(
touchTime
>
350
)
{
wx
.
showModal
({
title
:
''
,
content
:
'
要删除所选足迹?
'
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
util
.
request
(
api
.
FootprintDelete
,
{
footprintId
:
goodsId
},
'
POST
'
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
wx
.
showToast
({
title
:
'
删除成功
'
,
icon
:
'
success
'
,
duration
:
2000
});
that
.
data
.
footprintList
[
index
].
splice
(
iindex
,
1
)
if
(
that
.
data
.
footprintList
[
index
].
length
==
0
){
that
.
data
.
footprintList
.
splice
(
index
,
1
)
}
that
.
setData
({
footprintList
:
that
.
data
.
footprintList
});
}
});
}
}
});
}
else
{
wx
.
navigateTo
({
url
:
'
/pages/goods/goods?id=
'
+
goodsId
,
});
}
},
onLoad
:
function
(
options
)
{
this
.
getFootprintList
();
},
onReachBottom
()
{
if
(
this
.
data
.
totalPages
>
this
.
data
.
page
)
{
this
.
setData
({
page
:
this
.
data
.
page
+
1
});
this
.
getFootprintList
();
}
else
{
wx
.
showToast
({
title
:
'
没有更多用户足迹了
'
,
icon
:
'
none
'
,
duration
:
2000
});
return
false
;
}
},
onReady
:
function
()
{
},
onShow
:
function
()
{
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
//按下事件开始
touchStart
:
function
(
e
)
{
let
that
=
this
;
that
.
setData
({
touchStart
:
e
.
timeStamp
})
console
.
log
(
e
.
timeStamp
+
'
- touchStart
'
)
},
//按下事件结束
touchEnd
:
function
(
e
)
{
let
that
=
this
;
that
.
setData
({
touchEnd
:
e
.
timeStamp
})
console
.
log
(
e
.
timeStamp
+
'
- touchEnd
'
)
},
})
\ No newline at end of file
renard-wx/pages/ucenter/footprint/footprint.json
0 → 100644
View file @
854bacf6
{
"navigationBarTitleText"
:
"我的足迹"
}
\ No newline at end of file
renard-wx/pages/ucenter/footprint/footprint.wxml
0 → 100644
View file @
854bacf6
<view class="container">
<view class="no-footprint" wx:if="{{footprintList.length <= 0}}">
<view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>没有浏览足迹</text>
</view>
</view>
<view class="footprint" wx:if="{{footprintList.length > 0}}">
<view class="day-item" wx:for="{{footprintList}}" wx:key="*this" wx:for-index="index">
<view class="day-hd" wx:if="{{item.length > 0}}">{{item[0].addTime}}</view>
<view class="day-list" wx:if="{{item.length > 0}}">
<view class="item" data-index="{{index}}" data-iindex="{{iindex}}" bindtouchstart="touchStart" bindtouchend="touchEnd" bindtap="deleteItem" wx:for="{{item}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="id">
<image class="img" src="{{iitem.picUrl}}"></image>
<view class="info">
<view class="name">{{iitem.name}}</view>
<view class="subtitle">{{iitem.brief}}</view>
<view class="price">¥{{iitem.retailPrice}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
renard-wx/pages/ucenter/footprint/footprint.wxss
0 → 100644
View file @
854bacf6
page{
background: #f4f4f4;
min-height: 100%;
}
.container{
background: #f4f4f4;
min-height: 100%;
width: 100%;
height: auto;
overflow: hidden;
}
.no-footprint{
width: 100%;
height: auto;
margin: 0 auto;
}
.no-footprint .c{
width: 100%;
height: auto;
margin-top: 200rpx;
}
.no-footprint .c image{
margin: 0 auto;
display: block;
text-align: center;
width: 258rpx;
height: 258rpx;
}
.no-footprint .c text{
margin: 0 auto;
display: block;
width: 258rpx;
height: 29rpx;
line-height: 29rpx;
text-align: center;
font-size: 29rpx;
color: #999;
}
.footprint{
height: auto;
overflow: hidden;
width: 100%;
border-top: 1px solid #e1e1e1;
}
.day-item{
height: auto;
overflow: hidden;
width: 100%;
margin-bottom: 20rpx;
}
.day-hd{
height: 94rpx;
width: 100%;
line-height: 94rpx;
background: #fff;
padding-left: 30rpx;
color: #333;
font-size: 28rpx;
}
.day-list{
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
padding-left: 30rpx;
border-top: 1px solid #e1e1e1;
}
.item{
height: 212rpx;
width: 720rpx;
background: #fff;
padding: 30rpx 30rpx 30rpx 0;
border-bottom: 1px solid #e1e1e1;
}
.item:last-child{
border-bottom: 1px solid #fff;
}
.item .img{
float: left;
width: 150rpx;
height: 150rpx;
}
.item .info{
float: right;
width: 540rpx;
height: 150rpx;
display: flex;
flex-direction: column;
justify-content: center;
padding-left: 20rpx;
}
.item .info .name{
font-size: 28rpx;
color: #333;
line-height: 40rpx;
}
.item .info .subtitle{
margin-top: 8rpx;
font-size: 24rpx;
color: #888;
line-height: 40rpx;
}
.item .info .price{
margin-top: 8rpx;
font-size: 28rpx;
color: #333;
line-height: 40rpx;
}
Prev
1
…
5
6
7
8
9
10
11
12
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