[本时生活小程序-线上备份]

This commit is contained in:
张慢慢
2021-05-21 15:02:18 +08:00
commit f0302de899
206 changed files with 12884 additions and 0 deletions

174
pages/user/user.js Normal file
View File

@@ -0,0 +1,174 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
isUser : false, //用户登录状态
currentId : '', //轮播下标
infos : '', //用户信息
order : '', //订单信息
account : '',
// 卡轮播
swiper: {
imgUrls: [
{
id : 0,
src : '/static/img/user_card_00.png',
color : '#676869',
type : 'silver'
},
{
id : 2,
src : '/static/img/user_card_02.png',
color : '#192b4c',
type : 'drill'
}
],
autoplay: false,
interval: 5000,
duration: 1000,
current : 0
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
// 检查用户是否已登录
const current = wx.getStorageSync("current")
this.setData({
currentId: current
})
if(wx.getStorageSync("token") == ""){
this.setData({
infos : '',
order : '',
account : '',
isUser : false
})
return
}
this.setData({
isUser : getApp().globalData.isUser
})
// 获取用户信息
this.userInfo();
},
/**
* 用户信息
*/
userInfo() {
wx.$api.user.index().then(res=>{
this.setData({
infos : res.data.info,
order : res.data.order,
account : res.data.info.account
})
}).catch(err=>{
if(!err.login){
this.setData({
infos : '',
order : '',
account : '',
isUser : false
})
}
})
},
/**
* 处理未登录时的转跳
*/
userNav(e){
let pageUrl = e.currentTarget.dataset.url
if(this.data.isUser){
wx.navigateTo({
url: pageUrl
})
}else{
// 去登录
wx.navigateTo({
url: "/pages/login/login"
})
}
},
/**
* 判断是否新用户
*/
userLogin(){
if(app.globalData.token != '') {
wx.navigateTo({
url: '/pages/chooseTel/chooseTel'
})
}else {
wx.navigateTo({
url: '/pages/login/login',
})
}
},
/**
* 切换用户
*/
switchParty() {
wx.navigateTo({
url: '/pages/chooseTel/chooseTel?type=mobiles'
})
},
/**
* 左箭头
*/
prevImg () {
var swiper = this.data.swiper;
var current = swiper.current;
swiper.current = current > 0 ? current - 1 : swiper.imgUrls.length - 1;
this.setData({
swiper: swiper,
})
},
/**
* 右箭头
*/
nextImg () {
var swiper = this.data.swiper;
var current = swiper.current;
swiper.current = current < (swiper.imgUrls.length - 1) ? current + 1 : 0;
this.setData({
swiper: swiper,
})
},
/**
* 敬请期待
*/
await() {
wx.showToast({
title : '努力开发中~',
icon : 'none',
duration: 1000
})
}
})

4
pages/user/user.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents" : {},
"navigationBarTitleText": "个人中心"
}

171
pages/user/user.wxml Normal file
View File

@@ -0,0 +1,171 @@
<!-- 个人中心 -->
<block wx:if="{{isUser}}">
<view class="userHead">
<view class="userHead-img">
<image src="{{infos.avatar}}" mode="aspectFill"></image>
<view class="userHead-tips {{infos.identity.identity_id == 0 ? '' : 'active'}}">{{infos.identity.identity_id == 0 ? '普通用户':'惠生活会员'}}</view>
</view>
<view class="userHead-text">
<view class="userHead-name">
{{infos.nickname}}
</view>
<view class="userHead-tel">
{{infos.username}}
</view>
</view>
<view class="userHead-switch" bindtap="switchParty">
<image src="/static/icon/switch.png"></image>
切换账号
</view>
</view>
</block>
<block wx:else>
<view class="userHead" bindtap="userLogin">
<image class="userHead-img no-userHead" src="/static/img/default_cover.png" mode="aspectFill"></image>
<view class="userHead-text">
<view class="userHead-login">
去登录
</view>
</view>
</view>
</block>
<!-- 我的会员卡 -->
<view class="userCard">
<view class="userCard-title">我的会员卡</view>
<view class="userCard-cont">
<view class="userCard-clip">
<swiper class="userCard-swiper" autoplay="{{swiper.autoplay}}" interval="{{swiper.interval}}" duration="{{swiper.duration}}" current="{{currentId}}">
<swiper-item class="userCard-item" bindtap="userNav" data-url="/pages/account/account?type={{item.type}}" wx:for="{{swiper.imgUrls}}" wx:key="swiper">
<image class="userCard-img" src="{{item.src}}" mode="scaleToFill" bindtap="bannerTap" data-id="{{item.id}}"></image>
<view class="userCard-parice" style="color:{{item.color}}" wx:if="{{isUser}}"><text>可用余额:</text>
<block wx:if="{{item.id == 0}}">{{account.silver}}</block>
<block wx:if="{{item.id == 1}}">{{account.gold}}</block>
<block wx:if="{{item.id == 2}}">{{account.drill}}</block>
<!-- 0.00 -->
</view>
</swiper-item>
<!-- <swiper-item class="userCard-item" bindtap="userNav" data-url="">
<image class="userCard-img" src="/static/img/user_card_01.png" mode="scaleToFill" bindtap="bannerTap" data-id="{{item.goods_id}}"></image>
<view class="userCard-parice" style="color: #f79210" wx:if="{{isUser}}"><text>余额:</text>{{infos.account.gold}}</view>
</swiper-item>
<swiper-item class="userCard-item" bindtap="userNav" data-url="">
<image class="userCard-img" src="/static/img/user_card_02.png" mode="scaleToFill" bindtap="bannerTap" data-id="{{item.goods_id}}"></image>
<view class="userCard-parice" style="color: #192b4c" wx:if="{{isUser}}"><text>余额:</text>{{infos.account.drill}}</view>
</swiper-item> -->
</swiper>
</view>
<image src="/static/icon/arrow_left.png" class='userCard-arrow-left' bindtap='nextImg'></image>
<image src="/static/icon/arrow_right.png" class='userCard-arrow-right' bindtap='prevImg'></image>
</view>
<view class="userCard-tips">
滑动切换,查看更多权益
<image src="/static/icon/arrow_tips.png"></image>
</view>
</view>
<!-- 我的服务 -->
<view class="userCard">
<view class="userCard-title">我的服务</view>
<view class="userOrder">
<view class="userOrder-label" bindtap="userNav" data-url="/pages/coupon/coupon">
<view class="userOrder-icon active">
<image src="/static/img/userCoupon.png"></image>
</view>
<text>我的卡券</text>
</view>
<view class="userOrder-label" bindtap="userNav" data-url="/pages/packet/packet">
<view class="userOrder-icon active">
<image src="/static/img/userOrder_06.png"></image>
</view>
<text>红包领取</text>
</view>
<!-- <view class="userOrder-label" bindtap="userNav" data-url="/pages/activityOrder/activityOrder">
<view class="userOrder-icon active">
<image src="/static/img/userOrder_04.png"></image>
</view>
<text>活动订单</text>
</view> -->
<view class="userOrder-label" bindtap="userNav" data-url="/pages/address/address">
<view class="userOrder-icon active">
<image src="/static/img/userSite.png"></image>
</view>
<text>收货地址</text>
</view>
<view class="userOrder-label" bindtap="userNav" data-url="/pages/activate/activate">
<view class="userOrder-icon active">
<image src="/static/img/userOrder_05.png"></image>
</view>
<text>实体卡激活</text>
</view>
</view>
</view>
<!-- 我的订单 -->
<view class="userCard">
<view class="userCard-title">兑换订单</view>
<!-- <view class="userOrder">
<view class="userOrder-label" bindtap="await">
<view class="userOrder-icon">
<image src="/static/img/userOrder_00.png"></image>
</view>
<text>所有订单</text>
</view>
<view class="userOrder-label" bindtap="await">
<view class="userOrder-icon">
<image src="/static/img/userOrder_01.png"></image>
</view>
<text>待付款</text>
</view>
<view class="userOrder-label" bindtap="await">
<view class="userOrder-icon">
<image src="/static/img/userOrder_02.png"></image>
</view>
<text>待发货</text>
</view>
<view class="userOrder-label" bindtap="await">
<view class="userOrder-icon">
<image src="/static/img/userOrder_03.png"></image>
</view>
<text>已发货</text>
</view>
</view> -->
<view class="userOrder userOrder-label-new">
<!-- <view class="userOrder-label" bindtap="userNav" data-url="/pages/activityOrder/activityOrder">
<view class="userOrder-icon">
<image src="/static/img/userOrder_04.png"></image>
</view>
<text>活动订单</text>
</view> -->
<view class="userOrder-label" bindtap="userNav" data-url="/pages/order/order?stateType=all">
<view class="userOrder-icon">
<image src="/static/img/userOrder_00.png"></image>
</view>
<text>所有订单</text>
</view>
<view class="userOrder-label" bindtap="userNav" data-url="/pages/order/order?stateType=unpay">
<view class="userOrder-icon">
<image src="/static/img/userOrder_01.png"></image>
</view>
<text>待支付</text>
</view>
<view class="userOrder-label" bindtap="userNav" data-url="/pages/order/order?stateType=paid">
<view class="userOrder-icon">
<image src="/static/img/userOrder_02.png"></image>
</view>
<text>待发货</text>
</view>
<view class="userOrder-label" bindtap="userNav" data-url="/pages/order/order?stateType=delivered">
<view class="userOrder-icon">
<image src="/static/img/userOrder_03.png"></image>
</view>
<text>已发货</text>
</view>
<!-- <view class="userOrder-label" bindtap="userNav" data-url="/pages/rights/rights?type=web&rightsId=39">
<view class="userOrder-icon">
<image src="/static/img/userOrder_03.png"></image>
</view>
<text>券领取</text>
</view> -->
</view>
</view>

228
pages/user/user.wxss Normal file
View File

@@ -0,0 +1,228 @@
/* 个人中心 */
.userHead {
display: flex;
padding: 30rpx;
box-sizing: border-box;
background: white;
}
.userHead-img {
width: 135rpx;
height: 135rpx;
border-radius: 50%;
position: relative;
}
.userHead-img image {
position: absolute;
left: 22rpx;
top: 0;
width: 110rpx;
height: 110rpx;
border-radius: 50%;
}
.no-userHead {
width: 120rpx;
height: 120rpx;
}
.userHead-img view {
display: inline-block;
position: absolute;
bottom: 0;
left: 10rpx;
background: #c6c6c6;
border-radius: 30rpx;
color: #fff;
font-size: 24rpx;
padding: 4rpx 0;
text-align: center;
width: 130rpx;
display: inline-block;
z-index: 99;
}
.userHead-img view.active {
width: 144rpx;
left: 8rpx;
background: #000;
color: #fff;
}
.userHead-text {
margin-left: 30rpx;
width: calc(100% - 340rpx);
}
.userHead-switch {
border: 2rpx solid #000;
border-radius: 50rpx;
font-size: 24rpx;
height: 58rpx;
line-height: 58rpx;
width: 160rpx;
margin-top: 30rpx;
display: flex;
}
.userHead-switch image {
width: 30rpx;
height: 30rpx;
margin: 15rpx 6rpx 0 12rpx;
}
.userHead-name {
margin: 10rpx 0 20rpx;
font-size: 32rpx;
font-weight: 600;
}
.userHead-login {
border: 2rpx solid #313131;
border-radius: 6rpx;
font-size: 28rpx;
padding: 8rpx 30rpx;
margin-top: 30rpx;
display: inline-block;
}
.userHead-tel {
font-size: 28rpx;
}
/* 轮播图 */
.userCard {
background: white;
padding-bottom: 30rpx;
margin-bottom: 20rpx;
}
.userCard-title {
font-size: 32rpx;
font-weight: 600;
padding: 30rpx 30rpx 0;
margin: 20rpx 0;
}
.userCard-cont {
padding: 30rpx 80rpx;
box-sizing: border-box;
position: relative;
}
.userCard-clip {
position: relative;
padding-top: 55%;
width: 100%;
}
/* .userCard-clip::after {
content: '';
left: 10%;
top: 0;
background: rgba(0, 0, 0, .5);
position: absolute;
z-index: 1;
width: 80%;
height: 90%;
border-radius: 20px;
} */
.userCard-swiper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 9;
}
.userCard-item {
padding: 0 10rpx;
box-sizing: border-box;
}
.userCard-img {
width: 100%;
height: 100%;
background-size: 100% 100%;
}
.userCard-parice {
position: absolute;
z-index: 9;
left: 30rpx;
bottom: 50rpx;
color: #f79210;
font-weight: 600;
font-size: 36rpx;
}
.userCard-arrow-left, .userCard-arrow-right {
width: 50rpx;
height: 50rpx;
position: absolute;
top: calc(50% - 25rpx);
}
.userCard-arrow-left {
right: 10rpx;
}
.userCard-arrow-right {
left: 10rpx;
}
.userCard-tips {
background: #f0f4fa;
border-radius: 30rpx;
width: 360rpx;
text-align: center;
margin: 0 auto;
color: #b4bbc4;
font-size: 26rpx;
padding: 14rpx 0;
}
.userCard-tips image {
width: 20rpx;
height: 20rpx;
}
.userOrder {
overflow: hidden;
margin-top: 40rpx;
}
.userOrder-label {
float: left;
width: 25%;
text-align: center;
font-size: 28rpx;
}
.userOrder-label-new .userOrder-label {
width: 25%;
}
.userOrder-icon {
width: 94rpx;
height: 94rpx;
background: #000;
border-radius: 50%;
padding: 18rpx;
box-sizing: border-box;
margin: 0 auto 10rpx;
}
.userOrder-icon.active {
background: #000;
}
.userOrder-icon image {
width: 100%;
height: 100%;
}