This commit is contained in:
魏啾
2024-07-19 09:36:41 +08:00
6 changed files with 191 additions and 528 deletions

View File

@@ -2,6 +2,9 @@ export default {
userwxlogin(data) { //登录
return uni.api.post("/login/wx/custom/login", data);
},
userwxlogins(data) { // 获取手机号
return uni.api.post("/login/getPhoneNumber", data);
},
loginapplogin(data) { //APP登录(登录即注册)
return uni.api.post("/login/app/login", data);
},
@@ -170,7 +173,7 @@ export default {
return uni.api.get("/login/mpdifyPwd", data);
},
cashierServicesong(data) { // 获取所有歌曲,支持搜索及分页
return uni.api.get("/song", data,false);
return uni.api.get("/song", data, false);
},
cashierServicerecord(data) { // 点歌记录
return uni.api.get("/song/record", data);

View File

@@ -281,6 +281,13 @@
"style": {
"navigationBarTitleText": "账单明细"
}
},
{
"path" : "pages/member/activatedmemberone",
"style" :
{
"navigationBarTitleText" : "会员卡"
}
}
],
"globalStyle": {

View File

@@ -1,95 +1,11 @@
<template>
<view class="container">
<view class="box flex-center">
<!-- <text>欢迎登录零点八零</text> -->
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/Logo" mode=""></image>
</view>
<view class="top_box">
<view class="top_box_one" v-if="showbox">
<text class="top_box_one_text">手机号码</text>
<input type="text" v-model="form.loginName" :adjust-position="false" placeholder="请输入手机号码" />
</view>
<!-- <view class="top_box_one" v-if="showbox">
<text class="top_box_one_text">密码</text>
<input type="mobile" v-model="form.password" :adjust-position="false" placeholder="8-16位密码"
maxlength="16" :password="!showPassword" />
<view class="repeat" @click="display">
<u-icon name="eye" v-if="showPassword"></u-icon>
<u-icon v-else name="eye-off"></u-icon>
</view>
</view> -->
<view class="top_box_one" v-if="showbox">
<text class="top_box_one_text">验证码</text>
<input type="mobile" v-model="form.code" placeholder="请输入短信验证码" maxlength="6" />
<view class="repeats">
<view v-if="showText == true" class="yzm"
style="padding: 8rpx 16rpx 6rpx 16rpx; background: #F1CB66; border-radius: 15rpx"
@click="CodeRegister">
{{ Recapture }}
</view>
<view v-else
style="color: #ccc; background-color: #f9f9f9; padding: 8rpx 16rpx 6rpx 16rpx; border-radius: 15rpx">
{{ second }}s重新发送
</view>
</view>
</view>
<!-- <view class="top_box_tow flex-between" v-if="showbox">
<text @click="register">注册账号</text>
<text @click="passwords">忘记密码</text>
</view> -->
<!-- #ifdef MP-WEIXIN -->
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="userlogin" v-if="!showbox">手机号快速登录
</button>
<view class="toLogin" v-if="showbox" @click="toLoginconfirm">登录</view>
<view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view>
<!-- #endif -->
<!-- #ifdef APP-PLUS || H5 -->
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="userlogin" v-if="!showbox">手机号快速登录
</button>
<view class="toLogin" v-if="showbox" @click="toLoginconfirm">登录</view>
<view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view>
<!-- #endif -->
<!-- <view class="agreement flex-start">
<u-checkbox-group><u-checkbox shape="circle" @change="radioChange"
size="24"></u-checkbox></u-checkbox-group>
<text>阅读并同意零点八零</text>
<view class="agreement-Item" @click="Privacy(1)">用户协议</view>
<view class="agreement-Item" @click="Privacy(2)">隐私政策</view>
</view> -->
<button class="toLogin" open-type="getPhoneNumber" @getphonenumber="userlogin">快速登录 </button>
</view>
<!-- #ifdef APP-PLUS || H5 -->
<view class="box_conf" v-if="debug" @click="showpicker = true">{{ baseUrl || '切换' }}</view>
<!-- #endif -->
<u-overlay :show="agreeShow">
<view class="warp">
<view class="rect">
<view class="rect_img"></view>
<view class="rect_text flex-colum">
<view class="rect_text_one">用户须知</view>
<view class="rect_text_tow">
感谢您使用银收客,我们非常重视您的个 人信息和隐私保护在您使用服务前请仔 细阅读
<text @click="Privacy(1)">用户协议</text>
<text @click="Privacy(2)">隐私协议</text>
</view>
<view class="rect_text_there">如您同意此条款请点击同意并开始使 用我们的产品和服务我们将尽全力保护您 的个人信息安全</view>
<view class="rect_text_four flex-between">
<view class="rect_text_four_o" @click="refuse">拒绝</view>
<view class="rect_text_four_t" @click="agree">同意</view>
</view>
</view>
</view>
</view>
</u-overlay>
<u-popup :show="showpopup" mode="center">
<view style="width: 600rpx; height: 100rpx">
<u--input style="width: 100%; height: 100%" placeholder="请输入内容" border="surround" @blur="blurinput"
v-model="valueinput"></u--input>
</view>
</u-popup>
<u-picker :show="showpicker" @cancel="showpicker = false" :columns="columns"
@confirm="confirmpicker"></u-picker>
</view>
</template>
@@ -97,156 +13,86 @@
export default {
data() {
return {
showpicker: false,
showpopup: false,
valueinput: '',
showbox: false,
columns: [
['http://admintestapi.sxczgkj.cn/', 'https://ky.sxczgkj.cn', 'http://192.168.2.22:7004',
'http://admintestapi.sxczgkj.cn/', '自定义输入'
]
],
radioChangeItem: false, //单选框
agreeShow: false,
h: null, //动态高度
showPassword: false, //是否显示密码
debug: uni.conf.debug,
baseUrl: uni.conf.baseUrl,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '发送验证码',
types: '', //判断是否是微信扫码点餐进来
form: {
//密码
loginName: '',
password: '',
code: '',
inviteCode: ''
}
};
},
mounted() {
this.computed_h();
},
onLoad(e) {
// console.log(e, '调试1')
// try {
// this.types = e.types
// } catch (e) {
// //TODO handle the exception
// }
// #ifdef APP-PLUS || H5
this.showbox = true
// #endif
this.userlogin() // 静默登录
},
methods: {
// 同意隐私政策
agree() {
uni.setStorageSync('agree', 1);
this.agreeShow = false;
},
blurinput(e) {
uni.conf.baseUrl = e;
this.baseUrl = e;
this.showpopup = false;
},
confirmpicker(e) {
this.showpicker = false;
if (e.value == '自定义输入') {
this.showpopup = true;
} else {
this.baseUrl = e.value[0];
uni.conf.baseUrl = e.value;
}
},
// 拒绝隐私政策-退出应用
refuse() {
// #ifdef APP-PLUS || H5
//android 退出方法
plus.runtime.quit();
// ios 退出方法
plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
// #endif
},
radioChange(n) {
//是否同意
this.radioChangeItem = n;
},
display() {
// 切换图片显示隐藏
this.showPassword = !this.showPassword;
},
async CodeRegister() {
//发起验证码
if (this.form.loginName == null || this.form.loginName == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
const res = await this.api.phoneValidateCode({
// post 手机验证码
phone: this.form.loginName
});
if (res) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
}
},
async Privacy(e) {
if (e == 1) {
//用户协议
let res = await this.api.agreementgetAgreementOne({
discern: 0
});
uni.pro.navigateTo('my/about/agreement', {
discern: 0,
list: res.data.content
});
} else {
let res3 = await this.api.agreementgetAgreementOne({
discern: 3
});
uni.pro.navigateTo('my/about/agreement', {
discern: 3,
list: res3.data.content
});
}
},
rightClick() {
uni.switchTab({
url: '/pages/device_shop/index'
});
},
register() {
uni.navigateTo({
url: '../login/register'
});
},
passwords() {
uni.navigateTo({
url: '../login/password'
// 静默登录
// userlogin(reslange) {
// uni.login({
// provider: 'weixin',
// success: async (data) => {
// if (data.errMsg == "login:ok") {
// console.log(data.code, '调试-code')
// let res = await this.api.userwxlogins({
// code: data.code,
// // rawData: infoRes.rawData,
// // signature: infoRes.signature,
// // iv: reslange.detail.iv,
// // encryptedData: resdataa.detail.encryptedData
// })
// if (res.code == 0) {}
// // if (uni.cache.get('types') == 'types') {
// // uni.reLaunch({
// // url: '/pages/order_food/order_food'
// // });
// // } else {
// // uni.pro.switchTab('index/index')
// // }
// }
// }
// })
// },
// 正常登录
async userlogin(reslange) {
var resdataa = reslange
// if (resdataa.detail.iv) {
uni.login({
provider: 'weixin',
success: async (data) => {
try {
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
rawData: infoRes.rawData,
// signature: infoRes.signature,
// iv: infoRes.detail.iv,
// encryptedData: infoRes.detail
// .encryptedData
})
if (res.code == 0) {
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
if (uni.cache.get('types') == 'types') {
uni.reLaunch({
url: '/pages/order_food/order_food'
});
} else {
uni.pro.switchTab('index/index')
}
}
},
fail: (err) => {}
});
} catch (e) {}
}
});
// } else {
// uni.showToast({
// title: '获取手机号失败!请重新获取',
// icon: 'none'
// });
// }
},
async computed_h() {
//获取div宽度
@@ -258,122 +104,6 @@
height: h
};
},
async toLoginconfirm() {
//登录
if (this.form.loginName == null || this.form.loginName == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
// if (this.radioChangeItem == false) {
// uni.showToast({
// icon: 'none',
// title: '请先阅读《用户协议》和《隐私政策》'
// });
// return;
// }
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
let res = await this.api.loginapplogin({
username: this.form.loginName,
password: this.form.password,
code: this.form.code,
opencode: data.code
});
console.log(res);
if (res.code == 0) {
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
if (uni.cache.get('types') == 'types') {
uni.reLaunch({
url: '/pages/order_food/order_food'
});
} else {
uni.pro.switchTab('index/index')
}
}
}
});
// #endif
},
// async getPhoneNumber(res) { // 获取手机号
// var resdataa = res
// console.log(res)
// // #ifdef MP-WEIXIN
// uni.login({
// provider: 'weixin',
// success: async (data) => {
// let resdata = await this.api.logingetPhoneNumber({
// code: data.code,
// iv: resdataa.detail.iv,
// encryptedData: resdataa.detail.encryptedData
// })
// console.log(resdata)
// if (resdata.data) {
// this.phone = resdata.data
// this.userlogin()
// }
// }
// });
// // #endif
// },
async userlogin(reslange) {
var resdataa = reslange
if (resdataa.detail.iv) {
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
try {
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
rawData: infoRes.rawData,
signature: infoRes.signature,
iv: resdataa.detail.iv,
encryptedData: resdataa.detail
.encryptedData
})
if (res.code == 0) {
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
if (uni.cache.get('types') == 'types') {
uni.reLaunch({
url: '/pages/order_food/order_food'
});
} else {
uni.pro.switchTab('index/index')
}
}
},
fail: (err) => {}
});
} catch (e) {}
}
});
// #endif
} else {
uni.showToast({
title: '获取手机号失败!请重新获取',
icon: 'none'
});
}
},
}
};
</script>
@@ -394,15 +124,6 @@
height: 100vh;
overflow: hidden;
.top {
position: absolute;
left: 64rpx;
.u-navbar--fixed {
top: 88rpx;
}
}
.box {
// padding-top: 110rpx;
position: fixed;
@@ -417,93 +138,6 @@
}
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
.rect {
width: 606rpx;
background-color: #fff;
border-radius: 12rpx;
.rect_img {
// background: url(@/static/login/uoverlay.png) no-repeat;
background-size: 100% 100%;
width: 100%;
height: 120px;
}
.rect_text {
padding: 0 40rpx;
.rect_text_one {
margin-top: 32rpx;
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
.rect_text_tow {
margin-top: 32rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
text {
color: #2f87fd;
}
color: #333333;
}
.rect_text_there {
margin-top: 16rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.rect_text_four {
width: 100%;
padding: 48rpx 40rpx 30rpx 40rpx;
.rect_text_four_o {
padding: 16rpx 64rpx;
background: #ffffff;
border-radius: 36rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
border: 2rpx solid #333333;
}
.rect_text_four_t {
background: #2f87fd;
padding: 16rpx 64rpx;
border-radius: 36rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #ffffff;
}
}
}
}
}
.box_conf {
position: fixed;
top: 0;
color: #000;
padding: 20rpx;
right: 2%;
}
.top_box::after {
position: absolute;
// content: url(@/static/icon.png);
@@ -527,57 +161,6 @@
border-radius: 40rpx 40rpx 0px 0px;
top: 220rpx;
.top_box_one {
position: relative;
width: 100%;
margin-top: 64rpx;
border-bottom: 6rpx solid #e5e5e5;
.top_box_one_text {
font-size: 36rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
input {
height: auto;
padding: 18rpx 0 20rpx 0;
}
.repeat {
position: absolute;
bottom: 26rpx;
right: 0;
width: 25rpx;
height: 17rpx;
}
.repeats {
position: absolute;
bottom: 26rpx;
right: 0;
font-size: 24rpx;
z-index: 9;
font-family: $uni_family;
font-weight: 400;
color: #ffffff;
border-radius: 12rpx;
}
}
.top_box_tow {
width: 100%;
text {
margin-top: 34rpx;
font-size: 24rpx;
font-family: $uni_family;
font-weight: 400;
color: #666666;
}
}
.toLogin {
margin-top: 212rpx;
width: 100%;
@@ -593,38 +176,8 @@
border: none;
}
.toLogin::after {
background: none;
border: none;
}
.toLogins {
margin-top: 32rpx;
width: 100%;
line-height: 84rpx;
height: 84rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
border: 2rpx solid #333333;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 32rpx;
color: #333333;
text-align: center;
}
.agreement {
width: 100%;
margin-top: 40rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 20rpx;
color: #999999;
text-align: left;
.agreement-Item {
color: #333333;
}
}
}
}
</style>

View File

@@ -0,0 +1,71 @@
<template>
<view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wkthuiyuanbg.png" class="imgstyle" mode=""></image>
<button class="btnclass" open-type="getPhoneNumber" @getphonenumber="sumbit">立即开通 </button>
</view>
</template>
<script>
export default {
data() {
return {
shopId: "",
switchdata: true, // 绑定后
}
},
onLoad(e) {
this.shopId = e.shopId
},
onUnload() {
if (this.switchdata) {
uni.switchTab({
url: '/pages/index/index'
});
}
},
methods: {
sumbit(d) {
if (d.detail.iv) {
uni.login({
provider: 'weixin',
success: async (data) => {
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
shopId: this.shopId
})
if (res.code == 0) {
this.switchdata = false
uni.navigateBack()
}
}
})
}
}
}
}
</script>
<style scoped lang="less">
.imgstyle {
width: 694rpx;
height: 414rpx;
margin: 70rpx auto;
}
.btnclass {
width: 694rpx;
height: 90rpx;
line-height: 90rpx;
background: #6D89A4;
border-radius: 12rpx 12rpx 12rpx 12rpx;
text-align: center;
margin: auto;
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 36rpx;
color: #FFFFFF;
}
</style>

View File

@@ -42,6 +42,14 @@
this.paygetShopByMember(e.shopId)
}
this.paygetActive(e.shopId) //列表
// 判断是否绑定手机,只有下单时候有,会员列表肯定有
console.log(uni.cache.get('userInfo').telephone, '调试1')
if (!uni.cache.get('userInfo').telephone) {
// 跳转到开通页面
uni.navigateTo({
url: '/pages/member/activatedmemberone?shopId=' + e.shopId
})
}
},
methods: {
async paygetShopByMember(w) {

View File

@@ -19,16 +19,18 @@
<view class="onecontentboxitemtext">
昵称
</view>
<input class="onecontentboxiteminput" v-model="nickName" type="nickname"
@blur="bindblur" placeholder="请输入昵称" @input="bindinput" />
<input class="onecontentboxiteminput" v-model="nickName" type="nickname" @blur="bindblur"
placeholder="请输入昵称" @input="bindinput" />
</view>
<view class="onecontentboxitem flex-between" style="border-top: 1rpx dotted #333333;">
<view class="onecontentboxitemtext">
手机号
</view>
<input class="onecontentboxiteminput" disabled v-model="userInfo.telephone" type="text"
placeholder="请输入手机号">
<button class="onecontentboxiteminput" style="background-color: #fff;border: none;!important"
open-type="getPhoneNumber" @getphonenumber="getPhone">{{phonetitle}} </button>
<!-- <input class="onecontentboxiteminput" disabled v-model="userInfo.telephone" type="text"
placeholder="请输入手机号"> -->
</view>
</view>
<view class="onecontentboxitemnamber" @click="sumbit">
@@ -61,13 +63,15 @@
},
userInfo: uni.cache.get('userInfo'),
userHeadImg: "",
nickName: ''
nickName: '',
phonetitle: ""
};
},
onLoad() {
this.userInfo = uni.cache.get('userInfo')
this.nickName = this.userInfo.nickName
this.userHeadImg = this.userInfo.headImg
this.phonetitle = this.userInfo.telephone ? this.userInfo.telephone : '请授权手机号'
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
@@ -77,12 +81,28 @@
}
},
methods: {
async getPhone(d) {
if (d.detail.iv) {
uni.login({
provider: 'weixin',
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
})
this.phonetitle = res.data
}
})
}
},
bindblur(e) {
console.log(e,11)
console.log(e, 11)
this.nickName = e.detail.value; // 获取微信昵称
},
bindinput(e) {
console.log(e,22)
console.log(e, 22)
this.nickName = e.detail.value; // 获取微信昵称
},
// uploadImg() {
@@ -148,7 +168,8 @@
async sumbit() {
let res = await this.api.upUserInfo({
headImg: this.userHeadImg,
nickName: this.nickName
nickName: this.nickName,
telephone: this.phonetitle
})
if (res.code == 0) {
uni.navigateBack()