This commit is contained in:
砂糖
2026-02-07 18:01:13 +08:00
commit 8015759c65
2110 changed files with 269866 additions and 0 deletions

View File

@@ -0,0 +1,138 @@
<template>
<view class="container">
<view class="info-list">
<view class="info-item">
<view class="contacts">
<text class="name"><text class="iconfont icon-bangzhu"></text>长按领取会员卡</text>
</view>
</view>
</view>
<view class="info-code">
<view class="code-text">会员号{{ userInfo.userNo }}</view>
<image class="qrcode" :src="qrCode"></image>
</view>
<!-- 底部操作按钮 -->
<view class="footer-fixed">
<view class="btn-wrapper">
<view class="btn-item btn-item-main" @click="goBack()">返回主页</view>
</view>
</view>
</view>
</template>
<script>
import * as UserApi from '@/api/user'
import store from '@/store'
export default {
data() {
return {
//当前页面参数
options: {},
// 正在加载
isLoading: true,
userInfo: {},
qrCode: ""
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options
this.getUserInfo()
},
methods: {
/**
* 用户信息
* */
getUserInfo() {
const app = this
app.isLoading = true
UserApi.qrCode()
.then(result => {
app.userInfo = result.data.userInfo;
app.qrCode = result.data.wxCardQrCode;
app.isLoading = false;
})
},
goBack() {
this.$navTo('pages/index/index');
}
}
}
</script>
<style lang="scss" scoped>
.info-list {
padding-bottom: 30rpx;
margin-top: 30rpx;
}
// 项目内容
.info-item {
margin: 20rpx auto 20rpx auto;
padding: 30rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 10rpx;
background: #fff;
}
.contacts {
font-size: 35rpx;
text-align: center;
.name {
margin-left:0px;
text-align: center;
}
}
.info-code {
text-align: center;
padding: 30rpx;
margin-bottom: 30rpx;
.code-text{
margin-bottom: 50rpx;
}
.qrcode {
width: 360rpx;
height: 360rpx;
margin: 0 auto;
border: solid 1px #ccc;
}
}
// 底部操作栏
.footer-fixed {
z-index: 11;
box-shadow: 0 -4rpx 40rpx 0 rgba(144, 52, 52, 0.1);
.btn-wrapper {
height: 100%;
display: flex;
text-align: center;
align-items: center;
padding: 0 30rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
}
.btn-item-main {
background: linear-gradient(to right, #f9211c, #ff6335);
}
}
</style>

View File

@@ -0,0 +1,138 @@
<template>
<view class="container">
<view class="info-list">
<view class="info-item">
<view class="contacts">
<text class="name"><text class="iconfont icon-bangzhu"></text> 向商家展示会员码</text>
</view>
</view>
</view>
<view class="info-code">
<view class="code-text">会员号{{ userInfo.userNo ? userInfo.userNo : '--'}}</view>
<image class="qrcode" :src="qrCode"></image>
</view>
<!-- 底部操作按钮 -->
<view class="footer-fixed">
<view class="btn-wrapper">
<view class="btn-item btn-item-main" @click="goBack()">返回主页</view>
</view>
</view>
</view>
</template>
<script>
import * as UserApi from '@/api/user'
import store from '@/store'
export default {
data() {
return {
//当前页面参数
options: {},
// 正在加载
isLoading: true,
userInfo: {},
qrCode: ""
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options
this.getUserInfo()
},
methods: {
/**
* 用户信息
* */
getUserInfo() {
const app = this
app.isLoading = true
UserApi.qrCode()
.then(result => {
app.userInfo = result.data.userInfo;
app.qrCode = result.data.qrCode;
app.isLoading = false;
})
},
goBack() {
this.$navTo('pages/user/index');
}
}
}
</script>
<style lang="scss" scoped>
.info-list {
padding-bottom: 30rpx;
margin-top: 30rpx;
}
// 项目内容
.info-item {
margin: 20rpx auto 20rpx auto;
padding: 30rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 10rpx;
background: #fff;
}
.contacts {
font-size: 35rpx;
text-align: center;
.name {
margin-left:0px;
text-align: center;
}
}
.info-code {
text-align: center;
padding: 30rpx;
margin-bottom: 30rpx;
.code-text{
margin-bottom: 50rpx;
}
.qrcode {
width: 360rpx;
height: 360rpx;
margin: 0 auto;
border: solid 1px #ccc;
}
}
// 底部操作栏
.footer-fixed {
z-index: 11;
box-shadow: 0 -4rpx 40rpx 0 rgba(144, 52, 52, 0.1);
.btn-wrapper {
height: 100%;
display: flex;
text-align: center;
align-items: center;
padding: 0 30rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
}
.btn-item-main {
background: linear-gradient(to right, #f9211c, #ff6335);
}
}
</style>

View File

@@ -0,0 +1,59 @@
<template>
<grade-popup :value="value" @input="onChangeValue" @onPaySuccess="onPaySuccess" :memberGrade="memberGrade" border-radius="20" :maskCloseAble="true"
@open="openPopup" @close="closePopup"/>
</template>
<script>
import { setCartTotalNum } from '@/utils/app'
import * as CartApi from '@/api/cart'
import GradePopup from '@/components/grade-popup'
let memberGrade;
export default {
components: {
GradePopup
},
props: {
// true 组件显示 false 组件隐藏
value: {
Type: Boolean,
default: false
},
// 等级详情
memberGrade: {
type: Object,
default: {}
}
},
data() {
return {}
},
methods: {
// 监听组件显示隐藏
onChangeValue(val) {
this.$emit('input', val);
},
// 支付成功
onPaySuccess() {
this.$emit('onPaySuccess');
},
// sku组件 开始-----------------------------------------------------------
openPopup() {
console.log("监听 - 打开弹框组件");
},
closePopup() {
console.log("监听 - 关闭弹框组件")
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,789 @@
<template>
<view v-if="!isLoading" class="container">
<!-- 页面头部 -->
<view class="main-header">
<!-- 用户信息 -->
<view class="user-info">
<!--头像-->
<view class="user-avatar" @click="onUserInfo">
<image class="image" :src="userInfo.avatar ? userInfo.avatar : '/static/default-avatar.png'"></image>
</view>
<view class="user-content" @click="onUserInfo">
<!-- 会员昵称 -->
<view class="nick-name">{{ userInfo.name ? userInfo.name : '未登录'}}</view>
<view class="login-tips" v-if="!isLogin">(点击头像登录)</view>
<!-- 会员等级 -->
<view v-if="userInfo.gradeId > 0 && gradeInfo" class="user-grade">
<view class="user-grade_icon">
<image class="image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA0lBMVEUAAAD/tjL/tzH/uDP/uC7/tjH/tzH/tzL/tTH+tTL+tjP/tDD/tTD+tzD/tjL/szD/uDH/tjL/tjL+tjD/tjT/szb/tzL/tTL+uTH+tjL/tjL/tjL/tTT/tjL/tjL+tjH/uTL/vDD/tjL/tjH/tzL9uS//tTL/nBr/sS7/tjH/ujL/szD/uTv+rzf/tzL+tzH+vDP+uzL+tjP+ry7+tDL9ki/7szf/sEX/tTL/tjL+tjL/tTH/tTT/tzH/tzL/tjP/sTX/uTP/wzX+rTn/vDX9vC8m8ckhAAAAOXRSTlMAlnAMB/vjxKWGMh0S6drMiVxPRkEY9PLy0ru0sKagmo5+dGtgVCMgBP716eXWyMGxqJGRe2o5KSmFNjaYAAABP0lEQVQ4y8XS13KDMBAF0AWDDe4t7r3ETu9lVxJgJ/n/X8rKAzHG5TE+Twz3zki7I/g/KXdghIbGJewrU4yzn08Ebgl6TuZzzuOC6W5es3HX6qsSz3NFShRU0MpucytDmOSpu3yULx3CA9RD1HjVedc0jSjqm6ZzhUjDsFDQhSp/OKj5GQvg0+ZCOixsbtDLAeTTOm/yGi8GyIphIVsgH737FEDV44LJa88IRKK/SetrwT9G/GUIr6vXjoy4GXn7+RboVXnghuSjaoGecwQxL2su3CwAKlO+QFoqxI4FMctHQhQd2OhxTu184jWUlI+rMTBTn1/IQcJHQ6GQdZ7pWiDaNdhTt330efISeiqYwQEzQpTlsURJLhzkEmpCPsERfeIUVyXr6MNuIyp5uziW6xURtt7hhGwzmMNJExfO4Bd9X0ZPqAxdNwAAAABJRU5ErkJggg=="></image>
</view>
<view class="user-grade_name">
<text>{{ gradeInfo.name }}</text>
</view>
</view>
<!-- 会员无等级时显示手机号 -->
<view v-else class="mobile">{{ userInfo.mobile }}</view>
<view class="active-time" v-if="gradeEndTime">{{ gradeEndTime }}</view>
</view>
<view class="pay-qr" @click="toMemberCode(userInfo.id ? userInfo.id : 0)">
<view class="qrcode iconfont icon-qr-extract"></view>
</view>
<view class="amount-info" @click="toMemberWallet(userInfo.id ? userInfo.id : 0)">
<view class="amount-tip">余额</view>
<view class="amount-num" v-if="isLogin">{{ userInfo.balance.toFixed(2) }}</view>
<view class="amount-num" v-if="!isLogin">0.00</view>
<view class="point-amount" @click="onTargetPoints">积分 {{ userInfo.point ? userInfo.point : 0 }}</view>
</view>
</view>
<view class="user-no">
<view class="no" v-if="userInfo.userNo">会员号{{ userInfo.userNo ? userInfo.userNo : '-'}}</view>
<view class="recharge" @click="toRecharge(userInfo.id ? userInfo.id : 0)">储值有礼</view>
</view>
</view>
<!--会员升级 start-->
<view class="member-update" v-if="memberGrade.length > 0">
<view class="update-title">
<text>会员升级</text>
</view>
<scroll-view scroll-x>
<view class="recharge">
<view class="recharge-item" :class="current == index ? 'recharge-item-active': ''" v-for="(item, index) in memberGrade" :key="index" :style="{marginLeft: !index ? '30rpx': ''}" @click="onShowPopup(index)">
<view class="recharge-tag">
<text class="recharge-tag-text" v-if="parseInt(item.validDay) > 0">{{ item.validDay }}天有效期</text>
<text class="recharge-tag-text" v-else>永久有效期</text>
</view>
<text class="recharge-item-duration">{{ item.name }}</text>
<view class="recharge-item-price">
<text class="rmb"></text>
<text class="recharge-item-price-text">{{ item.catchValue }}</text>
</view>
<text class="recharge-item-des" v-if="item.discount > 0">买单{{ item.discount }}</text>
<text class="recharge-item-des" v-if="item.speedPoint > 0">积分翻{{ item.speedPoint }}</text>
</view>
</view>
</scroll-view>
</view>
<!-- 弹窗 -->
<Popup v-if="!isLoading" v-model="showPopup" @onPaySuccess="getPageData" :memberGrade="curGrade"/>
<!--会员升级 end-->
<!-- 订单操作 -->
<view class="order-navbar">
<view class="order-navbar-item" v-for="(item, index) in orderNavbar" :key="index" @click="onTargetOrder(item)">
<view class="item-icon">
<text class="iconfont" :class="[`icon-${item.icon}`]"></text>
</view>
<view class="item-name">{{ item.name }}</view>
<text class="order-badge" v-if="item.count && item.count > 0">{{ item.count }}</text>
</view>
</view>
<!-- 我的资产 -->
<view class="my-asset">
<view class="asset-left flex-box dis-flex flex-x-center">
<view class="asset-left-item" @click="onTargetMyCoupon('C')">
<view class="item-value dis-flex flex-x-center">
<text>{{ isLogin ? assets.coupon : '0' }}</text>
</view>
<view class="item-name dis-flex flex-x-center">
<text>优惠券</text>
</view>
</view>
<view class="asset-left-item" @click="onTargetMyCoupon('P')">
<view class="item-value dis-flex flex-x-center">
<text>{{ isLogin ? assets.prestore : '0' }}</text>
</view>
<view class="item-name dis-flex flex-x-center">
<text>储值卡</text>
</view>
</view>
<view class="asset-left-item" @click="onTargetMyCoupon('T')">
<view class="item-value dis-flex flex-x-center">
<text>{{ isLogin ? assets.timer : '0' }}</text>
</view>
<view class="item-name dis-flex flex-x-center">
<text>计次卡</text>
</view>
</view>
</view>
</view>
<!-- 我的服务 -->
<view class="my-service">
<view class="service-title">我的服务</view>
<view class="service-content clearfix">
<block v-for="(item, index) in service" :key="index">
<view v-if="item.type == 'link'" class="service-item" @click="handleService(item)">
<view class="item-icon">
<text class="iconfont" :class="[`icon-${item.icon}`]"></text>
</view>
<view class="item-name">{{ item.name }}</view>
</view>
<view v-if="item.type == 'button' && $platform == 'MP-WEIXIN'" class="service-item">
<button class="btn-normal" :open-type="item.openType">
<view class="item-icon">
<text class="iconfont" :class="[`icon-${item.icon}`]"></text>
</view>
<view class="item-name">{{ item.name }}</view>
</button>
</view>
</block>
<block>
<view v-if="isMerchant == true" class="service-item" @click="handleService({'url': 'pages/merchant/index'})">
<view class="item-icon">
<text class="iconfont icon-dianpu"></text>
</view>
<view class="item-name">商户管理</view>
</view>
</block>
</view>
</view>
<view class="my-recommend"></view>
</view>
</template>
<script>
import SettingKeyEnum from '@/common/enum/setting/Key'
import SettingModel from '@/common/model/Setting'
import * as UserApi from '@/api/user'
import * as OrderApi from '@/api/order'
import * as MessageApi from '@/api/message'
import { checkLogin, showMessage } from '@/utils/app'
import Popup from './components/Popup'
// 订单操作
const orderNavbar = [
{ id: 'all', name: '全部订单', icon: 'qpdingdan' },
{ id: 'toPay', name: '待支付', icon: 'daifukuan', count: 0 },
{ id: 'paid', name: '已支付', icon: 'daishouhuo', count: 0 }
]
/**
* 我的服务
* id: 标识; name: 标题名称; icon: 图标; type 类型(link和button); url: 跳转的链接
*/
const service = [
{ id: 'myCoupon', name: '卡券兑换', icon: 'youhuiquan', type: 'link', url: 'pages/coupon/receive' },
{ id: 'coupon', name: '转赠记录', icon: 'lingquan', type: 'link', url: 'pages/give/index' },
{ id: 'points', name: '我的积分', icon: 'jifen', type: 'link', url: 'pages/points/detail' },
{ id: 'book', name: '我的预约', icon: 'tuxingyanzhengma', type: 'link', url: 'pages/book/my' },
{ id: 'help', name: '我的帮助', icon: 'bangzhu', type: 'link', url: 'pages/help/index' },
{ id: 'contact', name: '在线客服', icon: 'kefu', type: 'button', openType: 'contact' },
{ id: 'address', name: '收货地址', icon: 'shouhuodizhi', type: 'link', url: 'pages/address/index' },
{ id: 'refund', name: '售后服务', icon: 'shouhou', type: 'link', url: 'pages/refund/index' },
{ id: 'setting', name: '个人信息', icon: 'shezhi1', type: 'link', url: 'pages/user/setting' },
{ id: 'book', name: '立即预约', icon: 'naozhong', type: 'link', url: 'pages/book/index' },
{ id: 'share', name: '邀请有礼', icon: 'fenxiang-post', type: 'link', url: 'pages/share/index' },
]
export default {
components: {
Popup
},
data() {
return {
// 枚举类
SettingKeyEnum,
// 当前运行的终端 (此处并不冗余,因为微信小程序端view层无法直接读取$platform)
$platform: this.$platform,
// 正在加载
isLoading: true,
// 是否已登录
isLogin: false,
// 系统设置
setting: {},
// 当前用户信息
userInfo: { id: 0, name: '', avatar: '', gradeId: 0, mobile: '', balance: 0 },
gradeInfo: {},
isMerchant: false,
gradeEndTime: '',
// 账户资产
assets: { prestore: '0', timer: '0', coupon: '0' },
// 我的服务
service,
// 订单操作
orderNavbar,
// 当前用户待处理的订单数量
todoCounts: { payment: 0 },
current: 0,
// 显示、隐藏弹窗
showPopup: false,
memberGrade: [],
curGrade: {}
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow(options) {
// 获取页面数据
this.getPageData()
// 判断是否已登录
this.isLogin = checkLogin()
// 消息显示
showMessage();
},
methods: {
// 获取页面数据
getPageData(callback) {
const app = this
app.isLoading = true
Promise.all([app.getSetting(), app.getUserInfo(), app.getUserAssets(), app.getTodoCounts()])
.then(result => {
app.isLoading = false
// 初始化我的服务数据
app.initService()
// 初始化订单操作数据
app.initOrderTabbar()
// 执行回调函数
callback && callback()
})
.catch(err => {
console.log('catch', err)
})
},
// 初始化我的服务数据
initService() {
const app = this
const newService = []
service.forEach(item => {
if (item.id === 'points') {
item.name = '我的积分'
}
newService.push(item)
})
app.service = newService
},
// 初始化订单操作数据
initOrderTabbar() {
const app = this
const newOrderNavbar = []
orderNavbar.forEach(item => {
if (item.hasOwnProperty('count')) {
item.count = app.isLogin ? app.todoCounts[item.id] : 0
}
newOrderNavbar.push(item)
})
app.orderNavbar = newOrderNavbar
},
// 获取设置
getSetting() {
const app = this
app.setting = {}
},
// 获取当前用户信息
getUserInfo() {
const app = this
app.showPopup = false;
return new Promise((resolve, reject) => {
UserApi.info()
.then(result => {
if (result.data.userInfo) {
app.userInfo = result.data.userInfo
app.isLogin = true
} else {
app.isLogin = false
app.userInfo = { id: 0, name: '', avatar: '', gradeId: 0, mobile: '', balance: 0 }
}
// 强制领取会员卡
if (result.data.openWxCard && app.userInfo) {
this.$navTo('pages/user/card?userId='+app.userInfo.id);
return false;
}
app.gradeInfo = result.data.gradeInfo;
app.memberGrade = result.data.memberGrade;
app.gradeEndTime = result.data.gradeEndTime;
app.isMerchant = result.data.isMerchant;
resolve(app.userInfo);
resolve(app.gradeInfo);
resolve(isMerchant);
})
.catch(err => {
if (err.result && err.result.status == 1001) {
app.isLogin = false
resolve(null)
} else {
reject(err)
}
})
})
},
// 获取账户资产
getUserAssets() {
const app = this
return new Promise((resolve, reject) => {
UserApi.assets()
.then(result => {
app.assets = result.data.asset
resolve(app.assets)
})
.catch(err => {
if (err.result && err.result.status == 1001) {
app.isLogin = false
resolve(null)
} else {
reject(err)
}
})
})
},
// 获取当前用户待处理的事项数量
getTodoCounts() {
const app = this
return new Promise((resolve, reject) => {
!app.isLogin ? resolve(null) : OrderApi.todoCounts()
.then(result => {
app.todoCounts = result.data
resolve(app.todoCounts)
})
})
},
// 会员等级
onShowPopup(index) {
this.showPopup = !this.showPopup
this.current = index
this.curGrade = this.memberGrade[index]
},
// 跳转到会员码
toMemberCode(userId) {
!this.isLogin && this.$navTo('pages/login/index')
this.$navTo('pages/user/code', { userId: userId})
},
// 跳转我的余额
toMemberWallet(userId) {
!this.isLogin && this.$navTo('pages/login/index')
this.$navTo('pages/wallet/index', { userId: userId})
},
// 跳转充值
toRecharge(userId) {
!this.isLogin && this.$navTo('pages/login/index')
this.$navTo('pages/wallet/recharge/index', { userId: userId})
},
// 跳转到订单页
onTargetOrder(item) {
!this.isLogin && this.$navTo('pages/login/index')
this.$navTo('pages/order/index', { dataType: item.id })
},
// 跳转到我的积分页面
onTargetPoints() {
!this.isLogin && this.$navTo('pages/login/index')
this.$navTo('pages/points/detail')
},
// 跳转到我的卡券列表页
onTargetMyCoupon(type) {
const app = this
if (app.isLogin) {
// #ifdef MP-WEIXIN
MessageApi.getSubTemplate({keys: "couponExpire,couponArrival"}).then(result => {
const templateIds = result.data
wx.requestSubscribeMessage({tmplIds: templateIds,
success(res) {
console.log("调用成功!")
}, fail(res) {
console.log("调用失败:", res)
}, complete() {
app.$navTo('pages/my-coupon/index?type='+type)
}})
})
// #endif
// #ifndef MP-WEIXIN
app.$navTo('pages/my-coupon/index?type='+type)
// #endif
} else {
app.$navTo('pages/login/index')
}
},
// 跳转会员设置页面
onUserInfo() {
if (!this.isLogin) {
this.$navTo('pages/login/index')
} else {
this.$navTo('pages/user/setting')
}
},
// 跳转到服务页面
handleService({ url }) {
this.$navTo(url)
}
},
/**
* 下拉刷新
*/
onPullDownRefresh() {
// 获取首页数据
this.getPageData(() => {
uni.stopPullDownRefresh()
})
}
}
</script>
<style lang="scss" scoped>
// 页面头部
.main-header {
background: url('~@/static/background/user-header.png') no-repeat;
height: 380rpx;
background-size: cover;
overflow: hidden;
display: block;
align-items: center;
margin: 10rpx 25rpx 10rpx 25rpx;
border-radius: 10rpx;
.user-info {
display: block;
height: 200rpx;
margin: 20rpx;
margin-left: 20rpx;
.user-avatar {
padding-top: 10rpx;
width: 50rpx;
margin-top: 70rpx;
float: left;
.image {
display: block;
width: 100rpx;
height: 100rpx;
border-radius: 999rpx;
}
}
.user-content {
display: block;
justify-content: center;
margin-top: 80rpx;
margin-left: 60rpx;
float: left;
color: #ffffff;
max-width: 300rpx;
.nick-name {
font-size: 32rpx;
font-weight: bold;
max-width: 270rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.mobile {
margin-top: 15rpx;
font-size: 26rpx;
}
.user-grade {
display: block;
align-items: center;
background: #3c3c3c;
margin-top: 8rpx;
border-radius: 10rpx;
padding: 5rpx 12rpx;
width: 80%;
min-width: 160rpx;
height: 40rpx;
.user-grade_icon .image {
display: block;
width: 32rpx;
height: 32rpx;
float: left;
}
.user-grade_name {
margin-left: 5rpx;
font-size: 24rpx;
color: #EEE0C3;
float: left;
}
}
.active-time {
margin-top: 3rpx;
}
.login-tips {
margin-top: 9rpx;
font-size: 25rpx;
}
}
.amount-info {
margin-top: 80rpx;
margin-left: 70rpx;
color: #fff;
display: block;
float: left;
max-width: 120rpx;
.amount-tip {
font-size: 24rpx;
}
.amount-num {
margin-top: 10rpx;
font-weight: bold;
font-size: 48rpx;
}
.point-amount {
display: block;
margin-top: 2px;
width: 100px;
}
}
.pay-qr {
color:#ffffff;
margin-top: 10rpx;
margin-left: 50rpx;
text-align: center;
width: 50rpx;
float: right;
.qrcode {
display: block;
font-size: 40rpx;
}
}
}
.user-no {
display: block;
font-size: 25rpx;
margin: 110rpx 0rpx 0rpx 20rpx;
color: #ffffff;
.no {
float: left;
}
.recharge {
float: right;
margin-right: 20rpx;
}
}
}
// 我的资产
.my-asset {
display: flex;
background: #fff;
margin: 10rpx 20rpx 10rpx 20rpx;
padding: 40rpx 0;
border: 2rpx #f5f5f5 solid;
.asset-right {
width: 200rpx;
border-left: 1rpx solid #eee;
}
.asset-left-item {
text-align: center;
color: #666;
padding: 0 72rpx;
width: 33%;
.item-value {
font-size: 35rpx;
color: #f03c3c;
font-weight: bold;
}
.item-name {
font-size: 25rpx;
margin-top: 6rpx;
}
}
}
// 订单操作
.order-navbar {
display: flex;
margin: 12rpx auto 10rpx auto;
padding: 20rpx 0;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
font-size: 30rpx;
border-radius: 5rpx;
background: #fff;
border: 2rpx #f5f5f5 solid;
&-item {
position: relative;
width: 33%;
.item-icon {
text-align: center;
margin: 0 auto;
padding: 10rpx 0;
color: #545454;
font-size: 48rpx;
font-weight: bold;
}
.item-name {
font-size: 24rpx;
color: #545454;
text-align: center;
margin-right: 10rpx;
}
.order-badge {
position: absolute;
top: 0;
right: 58rpx;
font-size: 20rpx;
background: #fa5151;
text-align: center;
line-height: 30rpx;
color: #fff;
border-radius: 50%;
min-width: 36rpx;
padding: 6rpx 13rpx 6rpx 13rpx;
}
}
}
// 我的服务
.my-service {
margin: 0rpx auto 20rpx auto;
border: 2rpx #f5f5f5 solid;
background: #FFF;
padding: 10rpx 0rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 5rpx;
display: block;
.service-title {
padding-left: 20rpx;
margin-bottom: 30rpx;
font-size: 28rpx;
}
.service-content {
.service-item {
width: 25%;
float: left;
margin-bottom: 25rpx;
.item-icon {
text-align: center;
margin: 0 auto;
padding: 10rpx 0;
color: #ff3800;
font-size: 40rpx;
}
.item-name {
font-size: 24rpx;
color: #545454;
text-align: center;
margin-right: 10rpx;
}
}
}
}
// 推荐信息
.my-recommend {
height: 20rpx;
}
// 会员升级
.member-update {
margin: 22rpx auto 0rpx auto;
padding: 20rpx 0;
border-radius: 5rpx;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
background: #fff;
width: 94%;
text-align: center;
.update-title {
padding-left: 20rpx;
margin-bottom: 30rpx;
font-size: 28rpx;
text-align: left;
}
.recharge {
position: relative;
margin-bottom: 35rpx;
display: flex;
flex-direction: row;
align-items: center;
&-tag {
position: absolute;
top: -2rpx;
left: -2rpx;
width: 170rpx;
height: 36rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background-image: url('~@/static/user/tag.png');
background-size: 100%;
&-text {
font-size: 20rpx;
color: #FFFFFF;
text-align: center;
}
}
&-item {
position: relative;
padding: 40rpx 0;
margin-left: 15rpx;
width: 29.33%;
height: 270rpx;
flex-shrink: 0;
display: flex;
flex-direction: column;
align-items: center;
border: solid 1rpx #CBCCCE;
border-radius: 12rpx;
&-active {
border: solid 2rpx #EDD2A9;
background-color: #FBF1E5;
}
&-duration {
margin-bottom: 30rpx;
font-size: 26rpx;
color: #1C1C1C;
}
&-price {
margin-bottom: 20rpx;
display: flex;
flex-direction: row;
align-items: baseline;
&-text {
font-size: 48rpx;
color: #E3BE83;
}
}
&-des {
font-size: 22rpx;
color: #A5A3A2;
}
}
}
}
</style>

View File

@@ -0,0 +1,269 @@
<template>
<view class="container">
<view class="form">
<!-- 手机号 -->
<view class="form-item">
<text class="iconfont icon-shoujihao"></text>
<text class="pre-mobile">+86</text>
<input class="form-item--input" style="padding-left: 12rpx;" type="number" v-model="mobile" maxlength="11" placeholder="请输入手机号码" />
</view>
<!-- 图形验证码 -->
<view class="form-item">
<text class="iconfont icon-tuxingyanzhengma"></text>
<input class="form-item--input" type="text" v-model="captchaCode" maxlength="5" placeholder="请输入图形验证码" />
<view class="form-item--parts">
<view class="captcha" @click="getCaptcha()">
<image class="image" :src="captcha"></image>
</view>
</view>
</view>
<!-- 短信验证码 -->
<view class="form-item">
<text class="iconfont icon-yanzhengma"></text>
<input class="form-item--input" type="number" v-model="smsCode" maxlength="6" placeholder="请输入短信验证码" />
<view class="form-item--parts">
<view class="captcha-sms" @click="handelSmsCaptcha()">
<text v-if="!smsState" class="activate">获取验证码</text>
<text v-else class="un-activate">重新发送({{ times }})</text>
</view>
</view>
</view>
</view>
<!-- 底部操作按钮 -->
<view class="footer-fixed">
<view class="btn-wrapper">
<view class="btn-item btn-item-main" @click="doSubmit()">保存</view>
</view>
</view>
</view>
</template>
<script>
import * as UserApi from '@/api/user'
import * as LoginApi from '@/api/login'
import * as Verify from '@/utils/verify'
import store from '@/store'
// 倒计时时长(秒)
const times = 60
export default {
data() {
return {
// 正在加载
isLoading: false,
// 手机号
mobile: '',
// 图形验证码信息
captcha: "",
// 图形验证码uuid
captchaUuid: "",
// 图形验证码
captchaCode: '',
// 短信验证码发送状态
smsState: false,
// 短信验证码
smsCode: '',
// 倒计时
times,
}
},
/**
* 生命周期函数--监听页面加载
*/
created() {
// 获取图形验证码
this.getCaptcha();
},
methods: {
// 获取图形验证码
getCaptcha() {
const app = this
LoginApi.captcha()
.then(result => {
app.captcha = result.data.captcha;
app.captchaUuid = result.data.uuid;
app.captchaCode = "";
})
},
// 点击发送短信验证码
handelSmsCaptcha() {
const app = this
if (Verify.isEmpty(app.mobile)) {
app.$toast("请填写手机号");
return false;
}
if (Verify.isEmpty(app.captchaCode)) {
app.$toast("请填写图形验证码");
return false;
}
if (!app.isLoading && !app.smsState) {
app.sendSmsCaptcha();
}
},
// 请求发送短信验证码接口
sendSmsCaptcha() {
const app = this
app.isLoading = true
LoginApi.sendSmsCaptcha({
captchaKey: app.captcha.key,
captchaCode: app.captchaCode,
mobile: app.mobile,
uuid: app.captchaUuid
})
.then(result => {
// 显示发送成功
if (result.data) {
app.$toast(result.message)
// 执行定时器
app.timer()
} else {
app.$error(result.message)
}
})
.finally(() => app.isLoading = false)
},
// 执行定时器
timer() {
const app = this
app.smsState = true
const inter = setInterval(() => {
app.times = app.times - 1
if (app.times <= 0) {
app.smsState = false;
app.times = times;
clearInterval(inter);
}
}, 1000)
},
// 提交保存
doSubmit() {
const app = this;
if (Verify.isEmpty(app.mobile)) {
this.$toast('请输入您的手机号')
return false
}
if (Verify.isEmpty(app.smsCode)) {
this.$toast('请输入短信验证码')
return false
}
app.isLoading = true;
UserApi.save({"mobile": app.mobile, "verifyCode": app.smsCode})
.then(result => {
app.isLoading = false;
if (result.code == 200) {
app.$success('保存成功!');
} else {
app.$error(result.message ? result.message : '保存失败!');
}
}).catch(err => {
app.isLoading = false;
})
}
}
}
</script>
<style lang="scss" scoped>
.form {
margin-top: 50rpx;
}
// 输入框元素
.form-item {
display: flex;
padding: 18rpx;
border-bottom: 2rpx solid #cccccc;
margin-left: 20rpx;
margin-right: 20rpx;
margin-bottom: 25rpx;
height: 110rpx;
align-items: center;
justify-content: center;
.pre-mobile {
line-height: 75rpx;
color: #888888;
}
&--input {
font-size: 26rpx;
letter-spacing: 1rpx;
flex: 1;
height: 100%;
padding-left: 5rpx;
}
&--parts {
min-width: 100rpx;
height: 100%;
}
// 图形验证码
.captcha {
height: 100%;
.image {
display: block;
width: 192rpx;
height: 80rpx;
}
}
// 短信验证码
.captcha-sms {
font-size: 22rpx;
line-height: 50rpx;
padding-right: 20rpx;
.activate {
color: #cea26a;
border: #ccc solid 1px;
padding: 18rpx;
border-radius: 8rpx;
}
.un-activate {
color: #9e9e9e;
}
}
}
// 底部操作栏
.footer-fixed {
z-index: 11;
box-shadow: 0 -4rpx 40rpx 0 rgba(144, 52, 52, 0.1);
margin-top: 80rpx;
.btn-wrapper {
height: 100%;
display: flex;
text-align: center;
align-items: center;
padding: 0 30rpx;
margin-bottom: 10rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
}
.btn-item-main {
background: linear-gradient(to right, #f9211c, #ff6335);
}
.btn-item-back {
margin-top: 20rpx;
background: #FFFFFF;
border: 1px solid $fuint-theme;
color: #666666;
}
}
</style>

View File

@@ -0,0 +1,175 @@
<template>
<view class="container">
<view class="info-item" v-if="hasPassword == 'Y'">
<view class="contacts">
<text class="name">旧密码</text>
<input class="weui-input value" type="password" v-model="passwordOld" placeholder="请输入旧密码"/>
</view>
</view>
<view class="info-item">
<view class="contacts">
<text class="name">新密码</text>
<input class="weui-input value" type="password" v-model="password" placeholder="请输入新密码"/>
</view>
</view>
<view class="info-item">
<view class="contacts">
<text class="name">新密码确认</text>
<input class="weui-input value" type="password" v-model="passwordCopy" placeholder="请输入新密码确认"/>
</view>
</view>
<!-- 底部操作按钮 -->
<view class="footer-fixed">
<view class="btn-wrapper">
<view class="btn-item btn-item-main" @click="doSubmit()">保存</view>
</view>
</view>
</view>
</template>
<script>
import * as UserApi from '@/api/user'
import store from '@/store'
export default {
data() {
return {
//当前页面参数
options: {},
// 正在加载
isLoading: false,
userInfo: {},
qrCode: "",
password: "",
passwordCopy: "",
passwordOld: "",
hasPassword: ""
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.hasPassword = options.hasPassword;
},
methods: {
// 提交保存
doSubmit() {
const app = this;
app.isLoading = true;
if (app.hasPassword == 'Y' && (!app.password || !app.passwordOld)) {
app.$error('请先填写表单!');
return false;
}
if (app.password != app.passwordCopy) {
app.$error('新密码输入不一致!');
return false;
}
UserApi.save({"password": app.password, "passwordOld": app.passwordOld})
.then(result => {
app.isLoading = false;
if (result.code == 200) {
app.$success('保存成功!');
} else {
app.$error(result.message ? result.message : '保存失败!');
}
}).catch(err => {
app.isLoading = false;
})
}
}
}
</script>
<style lang="scss" scoped>
.info-list {
padding-bottom: 30rpx;
margin-top: 30rpx;
}
// 项目内容
.info-item {
margin: 20rpx auto 20rpx auto;
padding: 30rpx 40rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
.avatar-warp {
line-height: 120rpx;
}
}
.contacts {
font-size: 30rpx;
height: 40rpx;
.name {
margin-left: 0px;
float: left;
margin-right: 10rpx;
line-height: 40rpx;
}
.value {
float:right;
color:#999999;
text-align: right;
.second {
margin-left: .6rem;
}
}
.vcode {
float: left;
line-height: 40rpx;
}
.password {
text-align: right;
float: left;
padding-right: 5rpx;
}
.avatar {
width: 120rpx;
height: 120rpx;
border-radius: 120rpx;
border: solid 1px #cccccc;
float: right;
}
}
// 底部操作栏
.footer-fixed {
z-index: 11;
box-shadow: 0 -4rpx 40rpx 0 rgba(144, 52, 52, 0.1);
margin-top: 80rpx;
.btn-wrapper {
height: 100%;
display: flex;
text-align: center;
align-items: center;
padding: 0 30rpx;
margin-bottom: 10rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
}
.btn-item-main {
background: linear-gradient(to right, #f9211c, #ff6335);
}
.btn-item-back {
margin-top: 20rpx;
background: #FFFFFF;
border: 1px solid $fuint-theme;
color: #666666;
}
}
</style>

View File

@@ -0,0 +1,299 @@
<template>
<view class="container">
<view class="info-list">
<view class="info-item">
<view class="contacts avatar-warp">
<text class="name">头像</text>
<image class="avatar" @click="chooseImage()" :src="avatar"></image>
</view>
</view>
<view class="info-item">
<view class="contacts">
<text class="name">称呼</text>
<input class="weui-input value" type="nickname" @blur="getnickname" v-model="nickname" placeholder="请输入称呼"/>
</view>
</view>
<view class="info-item">
<view class="contacts">
<text class="name">手机</text>
<button class="button btn-normal value" open-type="getPhoneNumber" @click="changeMobile" @getphonenumber="getPhoneNumber">
<text v-if="userInfo.mobile">{{ userInfo.mobile }}</text>
<text style="color: #f9211c;margin-left: 2px;">更换</text>
</button>
</view>
</view>
<view class="info-item">
<view class="contacts">
<text class="name">密码</text>
<button class="button btn-normal value" @click="changePassword">
<text class="password">********</text>
<text style="color: #f9211c;margin-left: 2px;">修改</text>
</button>
</view>
</view>
<view class="info-item">
<view class="contacts">
<text class="name">性别</text>
<view class="value">
<radio-group @change="genderChange">
<label class="radio"><radio value="1" color="#00acac" :checked="userInfo.sex == '1' ? true : false"/></label>
<label class="radio second"><radio value="0" color="#00acac" :checked="userInfo.sex == '0' ? true: false"/></label>
</radio-group>
</view>
</view>
</view>
<view class="info-item">
<view class="contacts">
<text class="name">生日</text>
<picker class="value" mode="date" :value="userInfo.birthday" start="1900-01-01" @change="bindDateChange">
<view class="picker">{{ userInfo.birthday ? userInfo.birthday : '选择生日' }}</view>
</picker>
</view>
</view>
</view>
<!-- 底部操作按钮 -->
<view class="footer-fixed" v-if="userInfo.id">
<view class="btn-wrapper">
<view class="btn-item btn-item-main" @click="save()">保存信息</view>
</view>
<view class="btn-wrapper">
<view class="btn-item btn-item-out" @click="logout()">退出登录</view>
</view>
</view>
</view>
</template>
<script>
import * as UserApi from '@/api/user'
import * as UploadApi from '@/api/upload'
import store from '@/store'
export default {
data() {
return {
//当前页面参数
options: {},
// 正在加载
isLoading: true,
userInfo: { avatar: '', name: '', sex: 0, birthday: '', hasPassword: '' },
openCardPara: null,
code: "",
nickname: "",
avatar: ""
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options;
this.getUserInfo();
},
methods: {
/**
* 用户信息
* */
getUserInfo() {
const app = this
app.isLoading = true
UserApi.info()
.then(result => {
app.userInfo = result.data.userInfo;
if (result.data.openCardPara) {
app.openCardPara = result.data.openCardPara;
}
app.nickname = app.userInfo.name;
app.avatar = app.userInfo.avatar;
app.isLoading = false;
})
},
bindDateChange (e) {
let that = this;
that.userInfo.birthday = e.detail.value;
},
getnickname(e) {
this.nickname = e.detail.value;
},
genderChange(e) {
this.userInfo.sex = e.detail.value
},
/**
* 获取会员手机
* */
getPhoneNumber(e) {
if (e.detail.errMsg == "getPhoneNumber:ok") {
this.onAuthSuccess(e)
}
},
getCode(e) {
const app = this
return new Promise((resolve, reject) => {
uni.login({
provider: 'weixin',
success: res => {
e.detail.code = res.code
UserApi.save(e.detail)
.then(result => {
app.userInfo.mobile = result.data.mobile
})
resolve(res.code)
},
fail: reject
})
})
},
onAuthSuccess(e) {
this.getCode(e)
},
// 修改密码
changePassword() {
this.$navTo('pages/user/password?hasPassword=' + this.userInfo.hasPassword);
console.log(this.userInfo.hasPassword);
},
// 修改手机号
changeMobile() {
// #ifdef H5
this.$navTo('pages/user/mobile');
// #endif
},
// 选择图片
chooseImage() {
const app = this
// 选择图片
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success({ tempFiles }) {
const imageList = tempFiles;
return new Promise((resolve, reject) => {
if (imageList.length > 0) {
UploadApi.image(imageList)
.then(files => {
if (files && files.length > 0) {
app.userInfo.avatar = files[0].fileName;
app.avatar = files[0].domain + app.userInfo.avatar;
}
resolve(files)
})
.catch(err => reject(err))
} else {
resolve()
}
})
}
});
},
/**
* 保存个人信息
*/
save() {
const app = this
app.isLoading = true
UserApi.save({"name": app.nickname, "avatar": app.avatar, "sex": app.userInfo.sex, "birthday": app.userInfo.birthday})
.then(result => {
app.userInfo = result.data
app.isLoading = false
app.$success('保存成功!')
}).catch(err => {
app.isLoading = false;
})
},
/**
* 退出登录
*/
logout() {
store.dispatch('Logout');
this.$navTo('pages/user/index');
}
}
}
</script>
<style lang="scss" scoped>
.info-list {
padding-bottom: 100rpx;
margin-top: 25rpx;
}
// 项目内容
.info-item {
margin: 20rpx auto 20rpx auto;
padding: 30rpx 40rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
.avatar-warp {
line-height: 120rpx;
}
}
.contacts {
font-size: 30rpx;
.name {
margin-left:0px;
}
.value {
float:right;
color:#999999;
text-align: right;
.second {
margin-left: .6rem;
}
}
.password {
text-align: right;
float: left;
padding-right: 5rpx;
}
.avatar {
width: 120rpx;
height: 120rpx;
border-radius: 120rpx;
border: solid 1px #cccccc;
float: right;
}
}
.item-option {
display: flex;
justify-content: space-between;
height: 48rpx;
}
// 底部操作栏
.footer-fixed {
height: 100rpx;
z-index: 11;
.btn-wrapper {
height: 100%;
display: flex;
align-items: center;
padding: 0 20rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
}
.btn-item-main {
background: linear-gradient(to right, #f9211c, #ff6335);
}
.btn-item-out {
margin-top: 20rpx;
background: #FFFFFF;
border: 1px solid $fuint-theme;
color: #666666;
}
}
</style>