Commit 94101c65 by 宋冰琦

修复部分样式效果

parent ba44218c
......@@ -27,7 +27,7 @@
<view class="right" @click="goShow()">
<view class="Text">
<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>
......@@ -311,6 +311,7 @@ export default {
.right {
display: flex;
margin-left: 8rpx;
margin-bottom: 2rpx;
.Text {
font-size: 20rpx;
......
......@@ -4,6 +4,7 @@
<view class="partOne">
<view class="one_left">
<view class="type" :style="[typeBackground]">{{info.typeDesc}}</view>
<view class="type_copy"></view>
<view class="price">
<view class="price_box" :style="[priceColor]" v-if="info.couponType===1">
<view class="num">{{info.price}}</view>
......@@ -212,13 +213,26 @@ export default {
text-align: center;
height: 28rpx;
overflow: hidden;
display: inline-block;
font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
background: var(--type-background);
color: #FFFFFF;
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;
}
.price{
......@@ -231,7 +245,7 @@ export default {
line-height: 74rpx;
margin: 0 auto;
text-align: center;
margin-top: 30rpx;
margin-top: 28rpx;
.price_box {
......@@ -283,7 +297,7 @@ export default {
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: var(color);
line-height: 40rpx;
line-height: 38rpx;
white-space: nowrap;
}
.time {
......@@ -344,7 +358,7 @@ export default {
margin-right: 32rpx;
.more_info {
padding-bottom: 8rpx;
padding-top: 8rpx;
padding-top: 6rpx;
display: flex;
justify-content: flex-start;
align-items: center;
......@@ -396,8 +410,8 @@ export default {
}
.tap {
border: 1px solid #DFDFDF;
width: 102rpx;
height: 102rpx;
width: 99rpx;
height: 99rpx;
border-radius: 50%;
top: 15rpx;
right: 15rpx;
......@@ -405,11 +419,11 @@ export default {
.tap_innew {
position: relative;
border: 1px solid #DFDFDF;
width: 88rpx;
height: 88rpx;
width: 85rpx;
height: 85rpx;
border-radius: 50%;
top: 7rpx;
left: 7rpx;
left: 5.5rpx;
transform: rotate(25deg);
.text {
width: 100%;
......@@ -450,9 +464,10 @@ export default {
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));
.part_top {
margin-top: 39.6rpx;
margin-top: 42.6rpx;
margin-left: 31.11rpx;
margin-right: 30rpx;
line-height: 32rpx;
font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
......@@ -460,10 +475,11 @@ export default {
}
.part_bottom {
margin-top: 16rpx;
margin-top: 19rpx;
margin-left: 31.11rpx;
margin-right: 30rpx;
margin-bottom: 40rpx;
line-height: 32rpx;
font-size: 20rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
......
......@@ -100,6 +100,8 @@ export default {
buied(val) {
if(val){
this.heightStyle['--scroll-height'] = (this.taBarHeight+122)+'rpx'
this.initScroll()
}else{
this.heightStyle['--scroll-height'] = (this.taBarHeight+22)+'rpx'
}
......@@ -107,6 +109,7 @@ export default {
},
computed:{
classifyData(){
this.scrollTop = 0
let categorys = this.$store.state.menu.setMenuCategorys.length!=0?JSON.parse(JSON.stringify(this.$store.state.menu.setMenuCategorys)):[]
// if(categorys.length!=0){
// const lastGood = 1
......@@ -126,14 +129,7 @@ export default {
this.categoryId = categorys[0].id;
}
}
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query.selectAll('.box').boundingClientRect(data => {
this.categoryPostion = data
}).exec();
})
this.initScroll()
// console.log(categorys)
// 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':''
......@@ -159,6 +155,20 @@ export default {
});
},
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) {
// return
let i = 0
......@@ -243,7 +253,8 @@ export default {
scroll(e) {
if (!this.scrolled) return;
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
},
categoryClickMain(id) {
......@@ -251,7 +262,7 @@ export default {
this.categoryId = id;
this.categoryPostion.forEach(item => {
if (item.id == id) {
this.scrollTop = item.top - 320
this.scrollTop = this.buied ? item.top - 320 : item.top - 270
}
});
......
......@@ -2,7 +2,7 @@
<view catchtouchmove="return">
<u-popup :show="showShopCar && goods.length" mode="bottom" :round="5" :overlay="true"
: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">
<text class="left">购物袋</text>
<text class="right" @click="clearCar"><text class="delete-icon"></text>清空购物车</text>
......@@ -122,10 +122,11 @@ export default {
},
mounted() {
this.animation = uni.createAnimation()
this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')||10
this.bottomPadding = this.BottomSafeHeight+132
this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')||50
console.log(this.BottomSafeHeight,'this.BottomSafeHeight')
this.bottomPadding = 205
this.shopCar = uni.getStorageSync('shopCar')
this.shopCar = uni.getStorageSync('shopCar')+4
if(!this.userms){
User.wxLoginAndGetOpenid(true).then(loginInfo=>{
this.loginInfo = loginInfo
......@@ -175,22 +176,59 @@ export default {
},
//跳转到结算
saveReserve(e) {
if(this.totalPrice < 0 || this.totalNum <= 0) {
this.showToast({ title: '请选择商品', icon: 'error' })
const settleMentFunc = ()=>{
if(this.totalPrice < 0 || this.totalNum <= 0) {
this.showToast({ title: '请选择商品', icon: 'error' })
return;
}
let Authorization = uni.getStorageSync('Authorization');
let shopCarInfo = uni.getStorageSync('shopCarInfo').filter(v => v.flag == true);
if (shopCarInfo) {
if (Authorization) {
uni.navigateTo({
url: `/orderSubPackage/pages/settlement/index?buyType=1`
})
} else {
this.loginByPhoneNumber(e)
}
}
return;
}
let Authorization = uni.getStorageSync('Authorization');
let shopCarInfo = uni.getStorageSync('shopCarInfo').filter(v => v.flag == true);
if (shopCarInfo) {
if (Authorization) {
uni.navigateTo({
url: `/orderSubPackage/pages/settlement/index?buyType=1`
})
} else {
this.loginByPhoneNumber(e)
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;
})
return
},
// 付款前未登录发起授权
loginByPhoneNumber(e) {
......@@ -307,7 +345,7 @@ export default {
flex-direction: column;
.header {
padding:24.87rpx 31.78rpx 22.3rpx 31.54rpx;
padding:35rpx 31.78rpx 35rpx 31.54rpx;
display: flex;
border-bottom: 0.1px solid #F4F4F4;
......
......@@ -326,33 +326,70 @@ export default {
}
},
async getallNum(e) {
let Authorization = uni.getStorageSync('Authorization');
if (!Authorization) {
this.loginByPhoneNumber(e);
return
}
if(!this.shopState||!this.isInRange){
return
}
const { goods } = this;
const { data } = await Order.checkSku({skuId:goods.skuId})
const {state,goods:newgoods} = data.data
const newInfo = JSON.parse(JSON.stringify(newgoods))
newInfo.category = this.goodInfo.category
this.goodInfo = {...newInfo}
this.initInfo(this.goodInfo)
if(state == 2){
this.showToast({ title: '本商品已经售罄', icon: 'none' });
// this.getMenuList()
return;
}else{
goods.num = this.size
Utils.addGoods(goods)
uni.navigateTo({ url: `/orderSubPackage/pages/settlement/index?buyType=1&goodsList=1` })
const settleMentFunc = async ()=>{
let Authorization = uni.getStorageSync('Authorization');
if (!Authorization) {
this.loginByPhoneNumber(e);
return
}
if(!this.shopState||!this.isInRange){
return
}
const { goods } = this;
const { data } = await Order.checkSku({skuId:goods.skuId})
const {state,goods:newgoods} = data.data
const newInfo = JSON.parse(JSON.stringify(newgoods))
newInfo.category = this.goodInfo.category
this.goodInfo = {...newInfo}
this.initInfo(this.goodInfo)
if(state == 2){
this.showToast({ title: '本商品已经售罄', icon: 'none' });
// this.getMenuList()
return;
}else{
goods.num = this.size
Utils.addGoods(goods)
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() {
const shopId = uni.getStorageSync('shopData').id
......
......@@ -6,7 +6,7 @@
</view>
<view class="page" :style="{'padding-top':(systemBarHeight.statusBarHeight+systemBarHeight.navigationBarHeight)+'px'}">
<view class="avatarBox">
<image class="avatar" :src="userInfo.avatarUrl"/>
<image class="avatar" @click="editAvatar" :src="userInfo.avatarUrl"/>
</view>
<view class="infoBox">
<view class="infoItem name">
......@@ -150,28 +150,40 @@ export default {
},
async onLoad(option) {
const {info} = option
const {avatarUrl,gender=0,nickName='点点'} = info?JSON.parse(decodeURIComponent(info)):{}
const {data} = await Mine.getUserInfo()
const { birthday, createTime, id, phone, sex, userName } = data.data
this.userInfo.id = id
this.canEditBirthday = !birthday
if(!birthday){
this.userInfo.birthday = new Date(createTime.replace(/-/g,'/')).valueOf()
}else{
this.userInfo.birthday = Date.parse(birthday)
}
if(info){
const {avatarUrl,gender=0,nickName='点点'} = info?JSON.parse(decodeURIComponent(info)):{}
const {data} = await Mine.getUserInfo()
const { birthday, createTime, id, phone, sex, userName } = data.data
this.userInfo.id = id
this.canEditBirthday = !birthday
if(!birthday){
this.userInfo.birthday = new Date(createTime.replace(/-/g,'/')).valueOf()
}else{
this.userInfo.birthday = Date.parse(birthday)
}
this.userInfo.avatarUrl = avatarUrl
this.userInfo.sex = sex?sex?1:0:gender
this.userInfo.name = userName?userName:nickName
this.userInfo.phone = phone.substr(0,3) + "****" + phone.substr(7)
this.userInfo.avatarUrl = avatarUrl
this.userInfo.sex = sex?sex?1:0:gender
this.userInfo.name = userName?userName:nickName
this.userInfo.phone = phone.substr(0,3) + "****" + phone.substr(7)
const {...result} = this.userInfoStorage
const sendData ={
...result,
avatarUrl
const {...result} = this.userInfoStorage
const sendData ={
...result,
avatarUrl:'',
canEditBirthday:this.canEditBirthday
}
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
}
Store.commit('setUserInfo', sendData);
},
methods:{
......@@ -189,6 +201,20 @@ export default {
}
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() {
this.birthdayModalShow = false
this.timerShow = true
......@@ -217,17 +243,23 @@ export default {
id
}
console.log(sendData)
await Mine.editUserAvatar({avatarUrl:avatarUrl,id})
const { data } = await Mine.editUserInfo(sendData)
const {code = 0} = data
if(code===200){
const data = {
...result,
customerName:name,
avatarUrl
avatarUrl,
canEditBirthday:this.canEditBirthday,
sex
}
Store.commit('setUserInfo', data);
uni.setStorage({ key: 'userInfo', data: data });
this.showToast({ title: '保存成功'})
wx.navigateBack({
delta: 1
});
}
}
}
......@@ -391,7 +423,7 @@ export default {
.saveBtn {
width: 670rpx;
height: 96rpx;
height: 98rpx;
margin: 0 auto;
margin-top: 32rpx;
......@@ -399,8 +431,8 @@ export default {
background: #0050F6;
border-radius: 2px;
font-size: 32rpx;
height: 96rpx;
line-height: 96rpx;
height: 98rpx;
line-height: 98rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
......@@ -409,8 +441,8 @@ export default {
background: #0050F6;
border-radius: 2px;
font-size: 32rpx;
height: 96rpx;
line-height: 96rpx;
height: 98rpx;
line-height: 98rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
......
......@@ -41,7 +41,7 @@
<view class="right" @click="goShow()">
<view class="Text">
<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>
......@@ -595,6 +595,7 @@ export default {
.right {
display: flex;
margin-left: 8rpx;
margin-bottom: 1rpx;
.Text {
font-size: 20rpx;
......
......@@ -175,7 +175,7 @@ export default {
const { q } = option;
// console.log(q);
if (q) {
console.log('扫码进入')
console.log('扫码进入',q)
uni.setStorageSync("selectFlag",false)
this.getMessageFlag()
this.saveGetTicket()
......@@ -481,8 +481,8 @@ export default {
} else {
list = uni.getStorageSync('goodsList').filter((v) => v.flag == true);
}
const shopInfo = uni.getStorageSync('shopData')
const {lat,lng} = shopInfo
const location = uni.getStorageSync("location")
const {lat,lng} = location
// sendMsgFlag1:下单成功通知
// sendMsgFlag2:订单状态变更通知
// sendMsgFlag3:取餐提醒
......
......@@ -172,7 +172,6 @@ export default {
},
methods: {
getShopMenus(params) {
$EventBus.$off('getMenuList');
$EventBus.$on('getMenuList', (data) => {
if(this.shopInfo && this.shopInfo.id != data.id) {
......@@ -185,16 +184,14 @@ export default {
this.getMenuList(data.id);
this.getHomeOrder(data.id)
// 判断店铺是否在范围内
const location = uni.getStorageSync("location")
const shopInfo = uni.getStorageSync("shopInfo")
const {lat:latloc,lng:lngloc} = location
const {lat:latshop,lng:lngshop,distanceLimit} = JSON.parse(shopInfo)
const distance = Utils.getDistances(latloc,lngloc,latshop,lngshop)
const {distanceLimit,realDistance} = JSON.parse(shopInfo)
const distance = realDistance/1000
if(!distanceLimit){
this.isInRange = true
}else{
console.log(parseInt(distance.distance_str)<parseInt(distanceLimit))
this.isInRange = parseInt(distance.distance_str)<parseInt(distanceLimit)
console.log(parseInt(distance),parseInt(distanceLimit),JSON.parse(shopInfo))
this.isInRange = parseInt(distance)<parseInt(distanceLimit)
}
uni.setStorageSync("isInRange",this.isInRange)
});
......
......@@ -134,7 +134,11 @@ export default {
getPhoneNumber(e) {
if (e.detail.errMsg == 'getPhoneNumber:ok') {
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") {
this.showToast({ title: '已拒绝手机号授权', icon: 'error' })
}
......@@ -148,19 +152,23 @@ export default {
page == 'order' && uni.switchTab({ url: '/pages/order/order' })
page == 'msg' && uni.navigateTo({ url: '/mineSubPackage/pages/msg/index' })
if(page == 'userInfo'){
wx.getUserProfile({
desc:'用于完善用户资料',
success:(res)=>{
const {userInfo} = res
const Info = JSON.stringify({
avatarUrl:userInfo.avatarUrl,
gender:userInfo.gender,
nickName:userInfo.nickName
})
// console.log(res)
page == 'userInfo' && uni.navigateTo({ url: '/mineSubPackage/pages/userInfo/index?info='+encodeURIComponent(Info) })
}
})
if(this.userInfo.avatarUrl){
uni.navigateTo({ url: '/mineSubPackage/pages/userInfo/index'})
}else{
wx.getUserProfile({
desc:'用于完善用户资料',
success:(res)=>{
const {userInfo} = res
const Info = JSON.stringify({
avatarUrl:userInfo.avatarUrl,
gender:userInfo.gender,
nickName:userInfo.nickName
})
// console.log(res)
page == 'userInfo' && uni.navigateTo({ url: '/mineSubPackage/pages/userInfo/index?info='+encodeURIComponent(Info) })
}
})
}
}
}
}
......
......@@ -75,5 +75,16 @@ export default {
.catch((err) => {
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 {
}
})
},
// 获取用户信息
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) {
this.loginDecrypt({loginInfo:JSON.parse(loginInfo),iv,data}).then(res => {
const { statusCode, data } = res;
......@@ -146,6 +174,7 @@ export default {
uni.setStorage({ key: 'userInfo', data: data });
Store.commit('setUserInfo', data);
Store.commit('setAuthorization', token);
this.getUserInfo(data)
if(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