Merge branch 'youda' of http://123.207.203.228:3000/shang/yfs into youda

This commit is contained in:
18631081161 2025-04-23 15:45:28 +08:00
commit d072e93523
3 changed files with 377 additions and 123 deletions

View File

@ -47,6 +47,7 @@ const defaultConfig = {
"exchange_times": "2",
"balance_name": "钻石",
"balance_icon": "https://image.zfunbox.cn/app/icons/20250412/a482b527477e74f8a18ec02ebc7f0b4e.png",
"currency1_name": "UU币",
"currency1_icon": "https://image.zfunbox.cn/app/icons/20250412/3d1741965e9439372d1ce101bd110616.png",
"currency2_name": "达达券",
@ -54,11 +55,12 @@ const defaultConfig = {
"win_audio": "https://image.zfunbox.cn/app/20250407/14ba53d367e1d131a344c6fd5cc0e28e.mp3",
"applet_version": "v1.0.3",
"sign_in_spend_limit": "1",
"show_dadajuan_limit": "0",
"waimai_box_id": "1049",
"daily_free_draw_id": "1050",
"cabinet_exchange_limit": "0",
"daily_coupon_limit": "0",
"update_time": 1744550962
"update_time": 1745379501
},
version: wx_version
};

View File

@ -150,7 +150,7 @@
<view v-if="tabList[tabCur].id == 1" class="bt-fixed">
<template v-if="subTab[subTabCur].id != 4">
<view v-if="subTab[subTabCur].id != 6 && listData.length && is_exchange == '1'" class="btn center"
<view v-if="subTab[subTabCur].id != 6 && is_exchange == '1' && show_dadajuan" class="btn center"
@click="open('changePop')">达达券</view>
<view v-if="subTab[subTabCur].id != 2" class="btn2 center" @click="open('sendPop')">发货</view>
<view v-if="subTab[subTabCur].id != 6" class="btn center" @click="open('model')">上锁</view>
@ -410,7 +410,8 @@ export default {
canReload: false,
zhanshiMoney: 0,
isAgree: false,
is_exchange: '0'
is_exchange: '0',
show_dadajuan: false
}
},
onShow() {
@ -885,6 +886,9 @@ export default {
this.freightData = res.data.yufei
}
if (res.data.show_dadajuan != null) {
this.show_dadajuan = res.data.show_dadajuan
}
this.listData = this.listData.concat(res.data.data)
this.mescroll.endByPage(res.data.data.length, res.data.last_page)

View File

@ -1,6 +1,7 @@
<template>
<view class="all">
<view v-if="isCanUse">
<!-- 小程序登录界面 -->
<view v-if="isCanUse && isMpWeixin">
<view>
<view class="header">
<image :src="$img1('common/logo.png?x=1')"></image>
@ -30,17 +31,10 @@
</view>
<view class="btn-list">
<view @click="$customRouter.navigateTo('/pages/shouye/index', {}, 'switchTab')" class="cancel">
<view @click="navigateBack()" class="cancel">
拒绝
</view>
<button v-if="isAgree" class="bottom center" type="primary" withCredentials="true" lang="zh_CN"
@click="getUserProfile">
<text>授权登录</text>
</button>
<button v-else class="bottom center" type="primary" withCredentials="true" lang="zh_CN"
@click="getUserProfile">
<button class="bottom center" type="primary" withCredentials="true" lang="zh_CN" @click="getUserProfile">
<text>授权登录</text>
</button>
</view>
@ -48,6 +42,57 @@
</view>
</view>
</view>
<!-- H5手机号登录界面 -->
<view v-if="isCanUse && !isMpWeixin">
<view>
<view class="header">
<image :src="$img1('common/logo.png?x=1')"></image>
</view>
<view class="h5-login-form">
<view class="input-item">
<input type="number" v-model="mobile" placeholder="请输入手机号" maxlength="11" class="phone-input" />
</view>
<view class="input-item code-item">
<input type="number" v-model="verifyCode" placeholder="请输入验证码" maxlength="6" class="code-input" />
<view @click="sendVerifyCode" class="send-code-btn" :class="{ disabled: countdown > 0 }">
{{ countdown > 0 ? countdown + '秒' : '发送验证码' }}
</view>
</view>
<view @click="isAgree = !isAgree" class="agree">
<view class="icon">
<image v-if="isAgree" :src="$img1('common/check_act.png')" lazy-load></image>
<image v-else :src="$img1('common/check.png')" lazy-load></image>
</view>
<view class="agree-r">
我已阅读并同意
<text @click.stop="$customRouter.navigateTo('/pages/guize/guize', {type: 4})">
用户协议
</text>
<text @click.stop="$customRouter.navigateTo('/pages/guize/guize', {type: 5})">
隐私政策
</text>
</view>
</view>
<view class="btn-list">
<view @click="navigateBack()" class="cancel">
拒绝
</view>
<view class="bottom center" @click="phoneLogin">
<text>登录</text>
</view>
</view>
</view>
<view style="font-size: 20rpx;color: #979797;position: fixed;bottom: 20rpx;right:47rpx;">version:v1.0.3
</view>
</view>
</view>
</view>
</template>
@ -62,21 +107,47 @@ export default {
avatarUrl: null,
isCanUse: uni.getStorageSync('isCanUse') || true, //true
code: '',
isAgree: false
isAgree: false,
// H5
isMpWeixin: false, //
mobile: '', //
verifyCode: '', //
countdown: 0, //
timer: null, //
codeSent: false //
}
},
onLoad(option) {
//
// #ifdef MP-WEIXIN
this.isMpWeixin = true;
// #endif
//
// this.login();
// console.log(window.location.href, option);
if (option != null) {
if (option.code != null) {
//
// this.h5Login(option.code);
}
}
},
onUnload() {
//
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
methods: {
//
navigateBack() {
uni.navigateBack({
delta: 1,
fail: () => {
//
this.$customRouter.navigateTo('/pages/shouye/index', {}, 'switchTab');
}
});
},
//===
getUserProfile(e) {
if (!this.isAgree) {
@ -89,8 +160,134 @@ export default {
// #ifdef MP-WEIXIN
this.wxUserProfile();
// #endif
},
//
async sendVerifyCode() {
//
if (this.countdown > 0) {
return;
}
//
if (!this.isAgree) {
return uni.showToast({
title: '请阅读并同意《用户协议》和《隐私政策》',
icon: 'none'
});
}
//
if (!this.mobile || !/^1\d{10}$/.test(this.mobile)) {
return uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
}
//
try {
const res = await this.$request.post('https://test.zfunbox.cn/api/v2/account/sendSms', {
phone: this.mobile
});
if (res.status == 1) {
uni.showToast({
title: '验证码已发送',
icon: 'success'
});
//
this.codeSent = true;
//
this.countdown = 60;
this.timer = setInterval(() => {
this.countdown--;
if (this.countdown <= 0) {
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
} else {
uni.showToast({
title: res.msg || '发送失败,请稍后重试',
icon: 'none'
});
}
} catch (error) {
uni.showToast({
title: '发送验证码失败,请稍后重试',
icon: 'none'
});
console.error('发送验证码失败:', error);
}
},
//
async phoneLogin() {
//
if (!this.isAgree) {
return uni.showToast({
title: '请阅读并同意《用户协议》和《隐私政策》',
icon: 'none'
});
}
if (!this.mobile || !/^1\d{10}$/.test(this.mobile)) {
return uni.showToast({
title: '请输入正确的手机号',
icon: 'none'
});
}
if (!this.verifyCode) {
return uni.showToast({
title: '请输入验证码',
icon: 'none'
});
}
//
if (!this.codeSent) {
return uni.showToast({
title: '请先发送验证码',
icon: 'none'
});
}
//
try {
const res = await this.$request.post('mobileLogin', {
mobile: this.mobile,
code: this.verifyCode,
pid: uni.getStorageSync('pid')
});
if (res.status == 1) {
uni.setStorageSync('token', res.data);
this.$c.msg("登录成功");
// URL
const redirectUrl = uni.getStorageSync('redirect');
if (redirectUrl) {
//
uni.removeStorageSync('redirect');
// 使
this.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
this.getdata();
}, 1000);
}
} else {
this.$c.msg("登录失败!" + res.msg);
}
} catch (error) {
this.$c.msg("登录请求失败,请稍后重试");
console.error('登录失败:', error);
}
},
/**
* 处理登录成功后的重定向逻辑
@ -142,125 +339,128 @@ export default {
return true;
},
wxUserProfile() {
var that = this
uni.getUserProfile({
desc: '用于向用户发送商品', //
lang: 'zh_CN',
success: res => {
uni.login({
provider: 'weixin',
success: function (loginRes) {
that.req({
url: 'login',
data: {
code: loginRes.code,
nickname: '',
headimg: '',
pid: uni.getStorageSync('pid')
},
success: function (res) {
if (res.status == 1) {
uni.setStorageSync('token', res.data)
that.$c.msg("登录成功")
// URL
const redirectUrl = uni.getStorageSync('redirect')
if (redirectUrl) {
//
uni.removeStorageSync('redirect')
// 使
that.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
that.getdata();
}, 1000)
}
} else {
that.$c.msg("登录失败!" + res.msg)
}
}
})
},
fail: (e) => {
that.$c.msg("登录失败,网络错误!" + e.msg)
console.log(e, '登录失败', e);
},
async wxUserProfile() {
try {
const profileRes = await new Promise((resolve, reject) => {
uni.getUserProfile({
desc: '用于向用户发送商品',
lang: 'zh_CN',
success: resolve,
fail: reject,
complete: (e) => {
console.log(e, '登录');
console.log(e, '用于向用户发送商品');
}
})
},
fail: (e) => {
that.$c.msg("登录失败,申请获取微信用户数据失败")
console.log(e, '获取微信用户数据失败');
},
complete: (e) => {
console.log(e, '用于向用户发送商品');
});
});
try {
const loginRes = await new Promise((resolve, reject) => {
uni.login({
provider: 'weixin',
success: resolve,
fail: (e) => {
this.$c.msg("登录失败,网络错误!" + e.msg);
console.log(e, '登录失败', e);
reject(e);
},
complete: (e) => {
console.log(e, '登录');
}
});
});
try {
const res = await this.$request.post('login', {
code: loginRes.code,
nickname: '',
headimg: '',
pid: uni.getStorageSync('pid')
});
if (res.status == 1) {
uni.setStorageSync('token', res.data);
this.$c.msg("登录成功");
// URL
const redirectUrl = uni.getStorageSync('redirect');
if (redirectUrl) {
//
uni.removeStorageSync('redirect');
// 使
this.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
this.getdata();
}, 1000);
}
} else {
this.$c.msg("登录失败!" + res.msg);
}
} catch (error) {
console.error('请求登录失败:', error);
}
} catch (error) {
console.error('微信登录失败:', error);
}
})
} catch (error) {
this.$c.msg("登录失败,申请获取微信用户数据失败");
console.log(error, '获取微信用户数据失败');
}
},
h5Login(code) {
var that = this;
that.req({
url: 'h5login',
data: {
async h5Login(code) {
try {
const res = await this.$request.post('h5login', {
code: code,
pid: uni.getStorageSync('pid')
},
success: function (res) {
if (res.status == 1) {
uni.setStorageSync('token', res.data)
});
if (res.status == 1) {
uni.setStorageSync('token', res.data);
// URL
const redirectUrl = uni.getStorageSync('redirect');
if (redirectUrl) {
//
uni.removeStorageSync('redirect');
// URL
const redirectUrl = uni.getStorageSync('redirect')
if (redirectUrl) {
//
uni.removeStorageSync('redirect')
// 使
that.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
that.getdata();
}, 1000)
}
// 使
this.handleRedirect(redirectUrl);
} else {
//
setTimeout(() => {
this.getdata();
}, 1000);
}
}
})
} catch (error) {
console.error('H5登录失败:', error);
}
},
h5UserProfile() {
var that = this;
console.log('进入h5')
console.log('进入h5');
this.$c.msg('暂未开放登录');
// window.location.href = this.$wxloginPage;
},
getdata() {
let that = this
that.req({
url: 'user',
success(res) {
if (res.status == 1 && res.data.userinfo != null && res.data.userinfo.mobile_is == 0) {
console.log("判断用户有没有手机号", res.data.userinfo.mobile_is);
// 使
that.$customRouter.navigateTo('/pages/user/bangding', {}, 'navigateTo');
} else {
// 使
that.$customRouter.navigateTo('/pages/user/index', {}, 'navigateTo');
}
async getdata() {
try {
const res = await this.$request.post('user');
if (res.status == 1 && res.data.userinfo != null && res.data.userinfo.mobile_is == 0) {
console.log("判断用户有没有手机号", res.data.userinfo.mobile_is);
// 使
this.$customRouter.navigateTo('/pages/user/bangding', {}, 'navigateTo');
} else {
// 使
this.$customRouter.navigateTo('/pages/user/index', {}, 'navigateTo');
}
})
} catch (error) {
console.error('获取用户数据失败:', error);
}
}
}
}
</script>
@ -299,9 +499,54 @@ export default {
margin-top: 28rpx;
}
// H5
.h5-login-form {
padding: 0 50rpx;
.input-item {
height: 90rpx;
border-bottom: 1px solid #E8E8E8;
margin-bottom: 40rpx;
input {
height: 100%;
width: 100%;
font-size: 28rpx;
}
}
.code-item {
display: flex;
justify-content: space-between;
align-items: center;
.code-input {
flex: 1;
}
.send-code-btn {
width: 200rpx;
height: 70rpx;
background-color: #333333;
color: #CDEF27;
font-size: 24rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 12rpx;
&.disabled {
background-color: #cccccc;
color: #ffffff;
}
}
}
}
.agree {
display: flex;
padding: 0 50rpx;
margin: 40rpx 0;
.icon {
width: 32rpx;
@ -353,6 +598,9 @@ export default {
border-radius: 16rpx;
font-size: 28rpx;
color: #CDEF27;
display: flex;
justify-content: center;
align-items: center;
}
}
</style>