Commit 94101c65 by 宋冰琦

修复部分样式效果

parent ba44218c
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<view class="right" @click="goShow()"> <view class="right" @click="goShow()">
<view class="Text"> <view class="Text">
<view>查看实景演示</view> <view>查看实景演示</view>
<image class="arrow" :style="{'height':'18rpx','width':'10rpx'}" :src="'../../static/imgs/jiantouhei.png'" /> <image class="arrow" :style="{'height':'18rpx','width':'10rpx'}" :src="'../../static/imgs/jiantouhui.png'" />
</view> </view>
</view> </view>
</view> </view>
...@@ -311,6 +311,7 @@ export default { ...@@ -311,6 +311,7 @@ export default {
.right { .right {
display: flex; display: flex;
margin-left: 8rpx; margin-left: 8rpx;
margin-bottom: 2rpx;
.Text { .Text {
font-size: 20rpx; font-size: 20rpx;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<view class="partOne"> <view class="partOne">
<view class="one_left"> <view class="one_left">
<view class="type" :style="[typeBackground]">{{info.typeDesc}}</view> <view class="type" :style="[typeBackground]">{{info.typeDesc}}</view>
<view class="type_copy"></view>
<view class="price"> <view class="price">
<view class="price_box" :style="[priceColor]" v-if="info.couponType===1"> <view class="price_box" :style="[priceColor]" v-if="info.couponType===1">
<view class="num">{{info.price}}</view> <view class="num">{{info.price}}</view>
...@@ -212,13 +213,26 @@ export default { ...@@ -212,13 +213,26 @@ export default {
text-align: center; text-align: center;
height: 28rpx; height: 28rpx;
overflow: hidden; overflow: hidden;
display: inline-block;
font-size: 20rpx; font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
background: var(--type-background); background: var(--type-background);
color: #FFFFFF; color: #FFFFFF;
line-height: 28rpx; line-height: 28rpx;
float: left;
white-space: nowrap;
}
.type_copy {
padding: 2rpx 10rpx;
max-width: 154rpx;
text-align: center;
height: 28rpx;
overflow: hidden;
font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
line-height: 28rpx;
white-space: nowrap; white-space: nowrap;
} }
.price{ .price{
...@@ -231,7 +245,7 @@ export default { ...@@ -231,7 +245,7 @@ export default {
line-height: 74rpx; line-height: 74rpx;
margin: 0 auto; margin: 0 auto;
text-align: center; text-align: center;
margin-top: 30rpx; margin-top: 28rpx;
.price_box { .price_box {
...@@ -283,7 +297,7 @@ export default { ...@@ -283,7 +297,7 @@ export default {
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: var(color); color: var(color);
line-height: 40rpx; line-height: 38rpx;
white-space: nowrap; white-space: nowrap;
} }
.time { .time {
...@@ -344,7 +358,7 @@ export default { ...@@ -344,7 +358,7 @@ export default {
margin-right: 32rpx; margin-right: 32rpx;
.more_info { .more_info {
padding-bottom: 8rpx; padding-bottom: 8rpx;
padding-top: 8rpx; padding-top: 6rpx;
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
...@@ -396,8 +410,8 @@ export default { ...@@ -396,8 +410,8 @@ export default {
} }
.tap { .tap {
border: 1px solid #DFDFDF; border: 1px solid #DFDFDF;
width: 102rpx; width: 99rpx;
height: 102rpx; height: 99rpx;
border-radius: 50%; border-radius: 50%;
top: 15rpx; top: 15rpx;
right: 15rpx; right: 15rpx;
...@@ -405,11 +419,11 @@ export default { ...@@ -405,11 +419,11 @@ export default {
.tap_innew { .tap_innew {
position: relative; position: relative;
border: 1px solid #DFDFDF; border: 1px solid #DFDFDF;
width: 88rpx; width: 85rpx;
height: 88rpx; height: 85rpx;
border-radius: 50%; border-radius: 50%;
top: 7rpx; top: 7rpx;
left: 7rpx; left: 5.5rpx;
transform: rotate(25deg); transform: rotate(25deg);
.text { .text {
width: 100%; width: 100%;
...@@ -450,9 +464,10 @@ export default { ...@@ -450,9 +464,10 @@ export default {
radial-gradient(circle at left bottom, transparent 17rpx, #FFFFFF 0) bottom right / 511rpx 51% no-repeat; radial-gradient(circle at left bottom, transparent 17rpx, #FFFFFF 0) bottom right / 511rpx 51% no-repeat;
filter: drop-shadow(-1px 3px 3px rgba(102,102,102,0.1000)); filter: drop-shadow(-1px 3px 3px rgba(102,102,102,0.1000));
.part_top { .part_top {
margin-top: 39.6rpx; margin-top: 42.6rpx;
margin-left: 31.11rpx; margin-left: 31.11rpx;
margin-right: 30rpx; margin-right: 30rpx;
line-height: 32rpx;
font-size: 20rpx; font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
...@@ -460,10 +475,11 @@ export default { ...@@ -460,10 +475,11 @@ export default {
} }
.part_bottom { .part_bottom {
margin-top: 16rpx; margin-top: 19rpx;
margin-left: 31.11rpx; margin-left: 31.11rpx;
margin-right: 30rpx; margin-right: 30rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
line-height: 32rpx;
font-size: 20rpx; font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
......
...@@ -100,6 +100,8 @@ export default { ...@@ -100,6 +100,8 @@ export default {
buied(val) { buied(val) {
if(val){ if(val){
this.heightStyle['--scroll-height'] = (this.taBarHeight+122)+'rpx' this.heightStyle['--scroll-height'] = (this.taBarHeight+122)+'rpx'
this.initScroll()
}else{ }else{
this.heightStyle['--scroll-height'] = (this.taBarHeight+22)+'rpx' this.heightStyle['--scroll-height'] = (this.taBarHeight+22)+'rpx'
} }
...@@ -107,6 +109,7 @@ export default { ...@@ -107,6 +109,7 @@ export default {
}, },
computed:{ computed:{
classifyData(){ classifyData(){
this.scrollTop = 0
let categorys = this.$store.state.menu.setMenuCategorys.length!=0?JSON.parse(JSON.stringify(this.$store.state.menu.setMenuCategorys)):[] let categorys = this.$store.state.menu.setMenuCategorys.length!=0?JSON.parse(JSON.stringify(this.$store.state.menu.setMenuCategorys)):[]
// if(categorys.length!=0){ // if(categorys.length!=0){
// const lastGood = 1 // const lastGood = 1
...@@ -126,14 +129,7 @@ export default { ...@@ -126,14 +129,7 @@ export default {
this.categoryId = categorys[0].id; this.categoryId = categorys[0].id;
} }
} }
this.initScroll()
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query.selectAll('.box').boundingClientRect(data => {
this.categoryPostion = data
}).exec();
})
// console.log(categorys) // console.log(categorys)
// categorys[0]?categorys[0].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':'' // categorys[0]?categorys[0].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':''
// categorys[1]?categorys[1].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':'' // categorys[1]?categorys[1].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':''
...@@ -159,6 +155,20 @@ export default { ...@@ -159,6 +155,20 @@ export default {
}); });
}, },
methods: { methods: {
initScroll() {
this.scrollLeftTop = 0
this.scrollTop = 0
const timer = setTimeout(() => {
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query.selectAll('.box').boundingClientRect(data => {
console.log(data,'data')
this.categoryPostion = data
clearTimeout(timer)
}).exec();
})
}, 1000);
},
async imagesHeight(list,index) { async imagesHeight(list,index) {
// return // return
let i = 0 let i = 0
...@@ -243,7 +253,8 @@ export default { ...@@ -243,7 +253,8 @@ export default {
scroll(e) { scroll(e) {
if (!this.scrolled) return; if (!this.scrolled) return;
const { categoryPostion } = this; const { categoryPostion } = this;
const [el] = categoryPostion.filter(item => item.top - e.target.scrollTop >= 20); const [el] = categoryPostion.filter(item => (item.top) - (e.target.scrollTop) >= 20);
console.log(el,'-------------------',e.target.scrollTop)
if (el) this.categoryId = el.id if (el) this.categoryId = el.id
}, },
categoryClickMain(id) { categoryClickMain(id) {
...@@ -251,7 +262,7 @@ export default { ...@@ -251,7 +262,7 @@ export default {
this.categoryId = id; this.categoryId = id;
this.categoryPostion.forEach(item => { this.categoryPostion.forEach(item => {
if (item.id == id) { if (item.id == id) {
this.scrollTop = item.top - 320 this.scrollTop = this.buied ? item.top - 320 : item.top - 270
} }
}); });
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view catchtouchmove="return"> <view catchtouchmove="return">
<u-popup :show="showShopCar && goods.length" mode="bottom" :round="5" :overlay="true" <u-popup :show="showShopCar && goods.length" mode="bottom" :round="5" :overlay="true"
:closeOnClickOverlay="true" @close="closeT" zIndex="10071"> :closeOnClickOverlay="true" @close="closeT" zIndex="10071">
<view class="shop-car" :style="{'padding-bottom':bottomPadding+'rpx'}"> <view class="shop-car" :style="{'padding-bottom':Utils.getPx(bottomPadding)+'px'}">
<view class="header"> <view class="header">
<text class="left">购物袋</text> <text class="left">购物袋</text>
<text class="right" @click="clearCar"><text class="delete-icon"></text>清空购物车</text> <text class="right" @click="clearCar"><text class="delete-icon"></text>清空购物车</text>
...@@ -122,10 +122,11 @@ export default { ...@@ -122,10 +122,11 @@ export default {
}, },
mounted() { mounted() {
this.animation = uni.createAnimation() this.animation = uni.createAnimation()
this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')||10 this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')||50
this.bottomPadding = this.BottomSafeHeight+132 console.log(this.BottomSafeHeight,'this.BottomSafeHeight')
this.bottomPadding = 205
this.shopCar = uni.getStorageSync('shopCar') this.shopCar = uni.getStorageSync('shopCar')+4
if(!this.userms){ if(!this.userms){
User.wxLoginAndGetOpenid(true).then(loginInfo=>{ User.wxLoginAndGetOpenid(true).then(loginInfo=>{
this.loginInfo = loginInfo this.loginInfo = loginInfo
...@@ -175,6 +176,7 @@ export default { ...@@ -175,6 +176,7 @@ export default {
}, },
//跳转到结算 //跳转到结算
saveReserve(e) { saveReserve(e) {
const settleMentFunc = ()=>{
if(this.totalPrice < 0 || this.totalNum <= 0) { if(this.totalPrice < 0 || this.totalNum <= 0) {
this.showToast({ title: '请选择商品', icon: 'error' }) this.showToast({ title: '请选择商品', icon: 'error' })
return; return;
...@@ -191,6 +193,42 @@ export default { ...@@ -191,6 +193,42 @@ export default {
} }
} }
return; return;
}
uni.authorize({
scope: 'scope.userLocation',
success: () => { //1.1 允许授权
console.log("允许授权位置");
settleMentFunc()
},
fail: (err) => { //1.2 拒绝授权
wx.exitMiniProgram({ success: (res) => { } })
console.log("获取位置失败")
uni.showModal({
content: '检测到您没打开地理位置权限,是否去设置打开?',
confirmText: "确认",
cancelText: '取消',
success: (res) => {
if (res.confirm) {
uni.openSetting({//opensetting是调起设置页面的
success: (res) => {
console.log(res)
if(res.authSetting['scope.userLocation'] == true){//判断res.authsetting的值是true还是false
settleMentFunc()
}else{
// console.log("什么也不做");
}
}
})
} else {
console.log('取消');
return false;
}
}
})
}
})
return
}, },
// 付款前未登录发起授权 // 付款前未登录发起授权
loginByPhoneNumber(e) { loginByPhoneNumber(e) {
...@@ -307,7 +345,7 @@ export default { ...@@ -307,7 +345,7 @@ export default {
flex-direction: column; flex-direction: column;
.header { .header {
padding:24.87rpx 31.78rpx 22.3rpx 31.54rpx; padding:35rpx 31.78rpx 35rpx 31.54rpx;
display: flex; display: flex;
border-bottom: 0.1px solid #F4F4F4; border-bottom: 0.1px solid #F4F4F4;
......
...@@ -326,6 +326,7 @@ export default { ...@@ -326,6 +326,7 @@ export default {
} }
}, },
async getallNum(e) { async getallNum(e) {
const settleMentFunc = async ()=>{
let Authorization = uni.getStorageSync('Authorization'); let Authorization = uni.getStorageSync('Authorization');
if (!Authorization) { if (!Authorization) {
this.loginByPhoneNumber(e); this.loginByPhoneNumber(e);
...@@ -353,6 +354,42 @@ export default { ...@@ -353,6 +354,42 @@ export default {
Utils.addGoods(goods) Utils.addGoods(goods)
uni.navigateTo({ url: `/orderSubPackage/pages/settlement/index?buyType=1&goodsList=1` }) uni.navigateTo({ url: `/orderSubPackage/pages/settlement/index?buyType=1&goodsList=1` })
} }
}
uni.authorize({
scope: 'scope.userLocation',
success: () => { //1.1 允许授权
console.log("允许授权位置");
settleMentFunc()
},
fail: (err) => { //1.2 拒绝授权
wx.exitMiniProgram({ success: (res) => { } })
console.log("获取位置失败")
uni.showModal({
content: '检测到您没打开地理位置权限,是否去设置打开?',
confirmText: "确认",
cancelText: '取消',
success: (res) => {
if (res.confirm) {
uni.openSetting({//opensetting是调起设置页面的
success: (res) => {
console.log(res)
if(res.authSetting['scope.userLocation'] == true){//判断res.authsetting的值是true还是false
settleMentFunc()
}else{
// console.log("什么也不做");
}
}
})
} else {
console.log('取消');
return false;
}
}
})
}
})
return
}, },
async getMenuList() { async getMenuList() {
const shopId = uni.getStorageSync('shopData').id const shopId = uni.getStorageSync('shopData').id
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</view> </view>
<view class="page" :style="{'padding-top':(systemBarHeight.statusBarHeight+systemBarHeight.navigationBarHeight)+'px'}"> <view class="page" :style="{'padding-top':(systemBarHeight.statusBarHeight+systemBarHeight.navigationBarHeight)+'px'}">
<view class="avatarBox"> <view class="avatarBox">
<image class="avatar" :src="userInfo.avatarUrl"/> <image class="avatar" @click="editAvatar" :src="userInfo.avatarUrl"/>
</view> </view>
<view class="infoBox"> <view class="infoBox">
<view class="infoItem name"> <view class="infoItem name">
...@@ -150,6 +150,7 @@ export default { ...@@ -150,6 +150,7 @@ export default {
}, },
async onLoad(option) { async onLoad(option) {
const {info} = option const {info} = option
if(info){
const {avatarUrl,gender=0,nickName='点点'} = info?JSON.parse(decodeURIComponent(info)):{} const {avatarUrl,gender=0,nickName='点点'} = info?JSON.parse(decodeURIComponent(info)):{}
const {data} = await Mine.getUserInfo() const {data} = await Mine.getUserInfo()
const { birthday, createTime, id, phone, sex, userName } = data.data const { birthday, createTime, id, phone, sex, userName } = data.data
...@@ -169,9 +170,20 @@ export default { ...@@ -169,9 +170,20 @@ export default {
const {...result} = this.userInfoStorage const {...result} = this.userInfoStorage
const sendData ={ const sendData ={
...result, ...result,
avatarUrl avatarUrl:'',
canEditBirthday:this.canEditBirthday
} }
Store.commit('setUserInfo', sendData); Store.commit('setUserInfo', sendData);
}else{
const { avatarUrl,birthday, id, phone, sex, customerName, canEditBirthday } = this.userInfoStorage
this.canEditBirthday = canEditBirthday
this.userInfo.avatarUrl = avatarUrl
this.userInfo.sex = sex?1:0
this.userInfo.name = customerName
this.userInfo.birthday = birthday
this.userInfo.id = id
this.userInfo.phone = phone
}
}, },
methods:{ methods:{
...@@ -189,6 +201,20 @@ export default { ...@@ -189,6 +201,20 @@ export default {
} }
this.timerShow = false this.timerShow = false
}, },
editAvatar(e) {
wx.getUserProfile({
desc:'用于完善用户资料',
success:(res)=>{
const {userInfo} = res
const Info = {
avatarUrl:userInfo.avatarUrl,
nickName:userInfo.nickName
}
this.userInfo.avatarUrl = Info.avatarUrl
this.userInfo.name = Info.nickName
}
})
},
openTimer() { openTimer() {
this.birthdayModalShow = false this.birthdayModalShow = false
this.timerShow = true this.timerShow = true
...@@ -217,17 +243,23 @@ export default { ...@@ -217,17 +243,23 @@ export default {
id id
} }
console.log(sendData) console.log(sendData)
await Mine.editUserAvatar({avatarUrl:avatarUrl,id})
const { data } = await Mine.editUserInfo(sendData) const { data } = await Mine.editUserInfo(sendData)
const {code = 0} = data const {code = 0} = data
if(code===200){ if(code===200){
const data = { const data = {
...result, ...result,
customerName:name, customerName:name,
avatarUrl avatarUrl,
canEditBirthday:this.canEditBirthday,
sex
} }
Store.commit('setUserInfo', data); Store.commit('setUserInfo', data);
uni.setStorage({ key: 'userInfo', data: data }); uni.setStorage({ key: 'userInfo', data: data });
this.showToast({ title: '保存成功'}) this.showToast({ title: '保存成功'})
wx.navigateBack({
delta: 1
});
} }
} }
} }
...@@ -391,7 +423,7 @@ export default { ...@@ -391,7 +423,7 @@ export default {
.saveBtn { .saveBtn {
width: 670rpx; width: 670rpx;
height: 96rpx; height: 98rpx;
margin: 0 auto; margin: 0 auto;
margin-top: 32rpx; margin-top: 32rpx;
...@@ -399,8 +431,8 @@ export default { ...@@ -399,8 +431,8 @@ export default {
background: #0050F6; background: #0050F6;
border-radius: 2px; border-radius: 2px;
font-size: 32rpx; font-size: 32rpx;
height: 96rpx; height: 98rpx;
line-height: 96rpx; line-height: 98rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #FFFFFF; color: #FFFFFF;
...@@ -409,8 +441,8 @@ export default { ...@@ -409,8 +441,8 @@ export default {
background: #0050F6; background: #0050F6;
border-radius: 2px; border-radius: 2px;
font-size: 32rpx; font-size: 32rpx;
height: 96rpx; height: 98rpx;
line-height: 96rpx; line-height: 98rpx;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #FFFFFF; color: #FFFFFF;
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<view class="right" @click="goShow()"> <view class="right" @click="goShow()">
<view class="Text"> <view class="Text">
<view>查看实景演示</view> <view>查看实景演示</view>
<image class="arrow" :style="{'height':'18rpx','width':'10rpx'}" :src="'../../../static/imgs/jiantouhei.png'" /> <image class="arrow" :style="{'height':'18rpx','width':'10rpx'}" :src="'../../../static/imgs/jiantouhui.png'" />
</view> </view>
</view> </view>
</view> </view>
...@@ -595,6 +595,7 @@ export default { ...@@ -595,6 +595,7 @@ export default {
.right { .right {
display: flex; display: flex;
margin-left: 8rpx; margin-left: 8rpx;
margin-bottom: 1rpx;
.Text { .Text {
font-size: 20rpx; font-size: 20rpx;
......
...@@ -175,7 +175,7 @@ export default { ...@@ -175,7 +175,7 @@ export default {
const { q } = option; const { q } = option;
// console.log(q); // console.log(q);
if (q) { if (q) {
console.log('扫码进入') console.log('扫码进入',q)
uni.setStorageSync("selectFlag",false) uni.setStorageSync("selectFlag",false)
this.getMessageFlag() this.getMessageFlag()
this.saveGetTicket() this.saveGetTicket()
...@@ -481,8 +481,8 @@ export default { ...@@ -481,8 +481,8 @@ export default {
} else { } else {
list = uni.getStorageSync('goodsList').filter((v) => v.flag == true); list = uni.getStorageSync('goodsList').filter((v) => v.flag == true);
} }
const shopInfo = uni.getStorageSync('shopData') const location = uni.getStorageSync("location")
const {lat,lng} = shopInfo const {lat,lng} = location
// sendMsgFlag1:下单成功通知 // sendMsgFlag1:下单成功通知
// sendMsgFlag2:订单状态变更通知 // sendMsgFlag2:订单状态变更通知
// sendMsgFlag3:取餐提醒 // sendMsgFlag3:取餐提醒
......
...@@ -172,7 +172,6 @@ export default { ...@@ -172,7 +172,6 @@ export default {
}, },
methods: { methods: {
getShopMenus(params) { getShopMenus(params) {
$EventBus.$off('getMenuList'); $EventBus.$off('getMenuList');
$EventBus.$on('getMenuList', (data) => { $EventBus.$on('getMenuList', (data) => {
if(this.shopInfo && this.shopInfo.id != data.id) { if(this.shopInfo && this.shopInfo.id != data.id) {
...@@ -185,16 +184,14 @@ export default { ...@@ -185,16 +184,14 @@ export default {
this.getMenuList(data.id); this.getMenuList(data.id);
this.getHomeOrder(data.id) this.getHomeOrder(data.id)
// 判断店铺是否在范围内 // 判断店铺是否在范围内
const location = uni.getStorageSync("location")
const shopInfo = uni.getStorageSync("shopInfo") const shopInfo = uni.getStorageSync("shopInfo")
const {lat:latloc,lng:lngloc} = location const {distanceLimit,realDistance} = JSON.parse(shopInfo)
const {lat:latshop,lng:lngshop,distanceLimit} = JSON.parse(shopInfo) const distance = realDistance/1000
const distance = Utils.getDistances(latloc,lngloc,latshop,lngshop)
if(!distanceLimit){ if(!distanceLimit){
this.isInRange = true this.isInRange = true
}else{ }else{
console.log(parseInt(distance.distance_str)<parseInt(distanceLimit)) console.log(parseInt(distance),parseInt(distanceLimit),JSON.parse(shopInfo))
this.isInRange = parseInt(distance.distance_str)<parseInt(distanceLimit) this.isInRange = parseInt(distance)<parseInt(distanceLimit)
} }
uni.setStorageSync("isInRange",this.isInRange) uni.setStorageSync("isInRange",this.isInRange)
}); });
......
...@@ -134,7 +134,11 @@ export default { ...@@ -134,7 +134,11 @@ export default {
getPhoneNumber(e) { getPhoneNumber(e) {
if (e.detail.errMsg == 'getPhoneNumber:ok') { if (e.detail.errMsg == 'getPhoneNumber:ok') {
e.loginInfo = this.loginInfo e.loginInfo = this.loginInfo
User.getPhoneNumber(e); User.getPhoneNumber(e,async ()=>{
const {data:couponData} = await User.getCouponNum()
this.tickNum = couponData?.data||0
});
} else if (e.detail.errMsg == "getPhoneNumber:fail user deny") { } else if (e.detail.errMsg == "getPhoneNumber:fail user deny") {
this.showToast({ title: '已拒绝手机号授权', icon: 'error' }) this.showToast({ title: '已拒绝手机号授权', icon: 'error' })
} }
...@@ -148,6 +152,9 @@ export default { ...@@ -148,6 +152,9 @@ export default {
page == 'order' && uni.switchTab({ url: '/pages/order/order' }) page == 'order' && uni.switchTab({ url: '/pages/order/order' })
page == 'msg' && uni.navigateTo({ url: '/mineSubPackage/pages/msg/index' }) page == 'msg' && uni.navigateTo({ url: '/mineSubPackage/pages/msg/index' })
if(page == 'userInfo'){ if(page == 'userInfo'){
if(this.userInfo.avatarUrl){
uni.navigateTo({ url: '/mineSubPackage/pages/userInfo/index'})
}else{
wx.getUserProfile({ wx.getUserProfile({
desc:'用于完善用户资料', desc:'用于完善用户资料',
success:(res)=>{ success:(res)=>{
...@@ -164,6 +171,7 @@ export default { ...@@ -164,6 +171,7 @@ export default {
} }
} }
} }
}
} }
</script> </script>
......
...@@ -75,5 +75,16 @@ export default { ...@@ -75,5 +75,16 @@ export default {
.catch((err) => { .catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' }); context.showToast({ title: '服务器错误', icon: 'none' });
}); });
},
// 更改用户头像
editUserAvatar(data) {
return uni.$u.http
.post(`/system/customer/update/avatar-url`, data)
.then((res) => {
return res;
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
});
} }
}; };
...@@ -136,6 +136,34 @@ export default { ...@@ -136,6 +136,34 @@ export default {
} }
}) })
}, },
// 获取用户信息
getUserInfo(data) {
return uni.$u.http
.get(`/system/customer/detail`, {})
.then((res) => {
console.log(res,data)
const { birthday, createTime, id, phone, sex, userName, avatarUrl } = res.data.data
const sendData = {
...data,
avatarUrl: avatarUrl,
sex: sex?1:0,
customerName:userName,
phone: phone.substr(0,3) + "****" + phone.substr(7),
id:id
}
if(!birthday){
sendData.canEditBirthday = true
sendData.birthday = new Date(createTime.replace(/-/g,'/')).valueOf()
}else{
sendData.canEditBirthday = false
sendData.birthday = Date.parse(birthday)
}
Store.commit('setUserInfo', sendData);
})
.catch((err) => {
context.showToast({ title: '服务器错误', icon: 'none' });
});
},
onLogin(loginInfo,iv,data,callback) { onLogin(loginInfo,iv,data,callback) {
this.loginDecrypt({loginInfo:JSON.parse(loginInfo),iv,data}).then(res => { this.loginDecrypt({loginInfo:JSON.parse(loginInfo),iv,data}).then(res => {
const { statusCode, data } = res; const { statusCode, data } = res;
...@@ -146,6 +174,7 @@ export default { ...@@ -146,6 +174,7 @@ export default {
uni.setStorage({ key: 'userInfo', data: data }); uni.setStorage({ key: 'userInfo', data: data });
Store.commit('setUserInfo', data); Store.commit('setUserInfo', data);
Store.commit('setAuthorization', token); Store.commit('setAuthorization', token);
this.getUserInfo(data)
if(callback) if(callback)
return callback(); return callback();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment