first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1 @@
645d1223-eea2-4666-a4f0-267e845122d4

View File

@@ -0,0 +1,293 @@
// pages/auth/auth.js
const app = getApp();
const util = app.loadUtils("util")
const regeneratorRuntime = app.loadAsync()
const model = app.loadModel("index")
const http = app.loadHttp()
const api = app.loadApi()
Page({
/**
* 页面的初始数据
*/
data: {
index: 1,//当前激活的下表
num: 0,//判断token在当前页面只生效一次
showSkeleton: true, //骨架屏显示隐藏
swiperList: [{
id: 0,
type: 'image',
url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big84000.jpg'
}, {
id: 1,
type: 'image',
url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big84001.jpg',
}, {
id: 2,
type: 'image',
url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big39000.jpg'
}, {
id: 3,
type: 'image',
url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg'
}, {
id: 4,
type: 'image',
url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big25011.jpg'
}, {
id: 5,
type: 'image',
url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big21016.jpg'
}, {
id: 6,
type: 'image',
url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg'
}],
kfRight: 20,
isCoupon: false,//优惠券
couponList: [],//优惠券列表
isKf: false,//客服
userInfo: {},//用户信息
couponTitle: '恭喜获得优惠券',//优惠券标题
},
// 获取用户个人信息
async userInfo() {
let token = await util.token()
if (!token) {
return
}
let user = await http.http.request2({ url: `${http.api.personalInfo}`, method: "POST" })
this.setData({
userInfo: user.data.data
})
app.globalData.userInfo = user.data.data
model.storage.setStorage("userInfo", user.data.data)
// 每次获取userInfo时执行
this.selectComponent("#home").getUserInfo();
},
async tabSwitch(e) {
let index = e.currentTarget.dataset.index
let nav = e.currentTarget.dataset.nav
let islog = e.currentTarget.dataset.islog
if (islog == 'ok') {
let isLogin = await util.isLoginJump()
if (isLogin == 1) return;
}
// 跳转到预约
if (nav) {
if (app.globalData.userInfo.group_type == 39) {
wx.navigateTo({
url: '/pages/auth/auth?index=6&group_type=' + app.globalData.userInfo.group_type
})
} else {
wx.navigateTo({
url: "/user/appointment/appointment"
})
}
return
}
// 调转到洗衣
if (index == 2) {
wx.navigateTo({
url: '/pages/nearbyStore/nearbyStore'
})
return;
if (!this.data.userInfo.cupboard_num) {
wx.showModal({
title: '您不是衣柜会员',
content: '衣柜会员才可打开',
confirmText: "成为会员",
cancelText: "取消",
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/pages/joinWardrobe/joinWardrobe'
})
}
}
})
return;
}
wx.navigateTo({
url: "/user/wardrobe/wardrobe"
})
return
}
// 调转到商城
if (index == 4) {
wx.navigateTo({
url: "/mall/auth/auth?index=1"
})
return
}
this.setData({
index: index
})
if (index == 1) {
this.getCoupon()
}
},
// 优惠券显示关闭
_coupon() {
this.setData({
isCoupon: !this.data.isCoupon
})
},
// 优惠券领取
async _receive() {
let isLogin = await util.isLoginJump()
if (isLogin == 1) return;
this._coupon()
},
// 客服的显示关闭
_service() {
this.setData({
isKf: !this.data.isKf
})
},
// 获取系统推送的优惠券
async getCoupon() {
let isTel = app.globalData.userInfo.telnum
if(isTel == "点击授权手机号" || isTel == '' || !isTel) return;
if(app.globalData.userInfo.group_type !== 0) return;
let token = await util.token();
let isCoupon = await model.storage.getSetting('isCoupon');
let res = { data: { data: [] } }, couponTitle;
if (!token && isCoupon !== 'ok') {
res = await http.http.request1({ url: `${http.api.newPersonCoupon}/0`, method: "POST" })
couponTitle = '登录后领取'
model.storage.setStorage("isCoupon", 'ok')
} else if (token) {
res = await http.http.request2({ url: `${http.api.newPersonCoupon}/0`, method: "POST" })
}
let coupon = res.data.data
if (coupon.length > 0) {
let all = "";//优惠劵id 如果有优惠券直接领取
coupon.map((v, i) => {
coupon[i].coupon_price = parseInt(coupon[i].coupon_price)
all += coupon[i].coupon_id + ","
coupon[i].start_time = util.formatTime(v.start_time, 'Y-M-D')
coupon[i].end_time = util.formatTime(v.end_time, 'Y-M-D')
})
this.setData({
couponList: coupon,
isCoupon: true,
couponTitle: couponTitle
})
if (!!token) {
http.http.request2({ url: `${http.api.getNewPersonCoupon}/0`, method: "POST", data: { coupon_id: all.substr(0, all.length - 1) } })
this.userInfo()
}
}
},
// 客服电话
openTel() {
wx.makePhoneCall({
phoneNumber: '4000551071'
})
},
goUrl() {
wx.navigateTo({
url: '/pages/laundry/laundry?id=1'
})
this._coupon();
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 需要跳转到首页tabbar时需要路径参数index否则不激活
this.setData({
index: options.index || 1
})
app.setWatching('showSkeleton', (v) => {
this.setData({
showSkeleton: v
});
});
app.setWatching('isToken', (v) => {
this.userInfo()
});
if (!!options.group_type) {
this.selectComponent("#choice").tuanPic(options.group_type);
}
app.setWatching('userInfo', (v) => {
if (app.globalData.userInfo.group_type !== ''
&& app.globalData.userInfo.group_type !== 0
&& app.globalData.userInfo.group_type !== void 0
) {
this.selectComponent("#index").storeMenu();
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: async function () {
model.getauth.getSetting()
.then(res => {
if (res.authSetting['scope.userLocation']) {
this.selectComponent("#index").add();
}
})
this.userInfo();
this.getCoupon()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
clearInterval(this.time)
this.setData({
kfRight: 20
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
// 监听用户滑动页面
onPageScroll: function () {
this.setData({
kfRight: -70
})
clearInterval(this.time)
this.time = setTimeout(() => {
this.setData({
kfRight: 20
})
}, 1000)
}
})

View File

@@ -0,0 +1,8 @@
{
"navigationBarTextStyle": "black",
"usingComponents": {
"index":"../index/index",
"home":"../home/home",
"choice":"../choice/choice"
}
}

View File

@@ -0,0 +1,121 @@
<!-- 骨架屏 -->
<skeleton selector="skeleton" loading="spin" bgcolor="#FFF" wx:if="{{showSkeleton}}"></skeleton>
<!-- pages/auth/auth.wxml -->
<view class="skeleton content">
<view hidden="{{!(index == 1)}}">
<index id="index"></index>
</view>
<view hidden="{{!(index == 5)}}">
<home id="home"></home>
</view>
<view hidden="{{!(index == 6)}}">
<choice id="choice"></choice>
</view>
</view>
<!-- tabbar -->
<view class="TabBar">
<view class="cu-bar tabbar bg-white">
<view data-index="1" bind:tap="tabSwitch" class="action">
<view class="cuIcon-cu-image">
<image class="index-icon" src="{{ index == 1 ? '/static/img/icon/index-active-icon.png' : '/static/img/icon/index-icon.png' }}"></image>
</view>
<view class="{{ index == 1 ? 'text-green' : 'text-gray' }} mt10">首页</view>
</view>
<!-- <view data-index="2" data-islog="ok" bind:tap="tabSwitch" class="action {{index == 2?'text-green':'text-gray'}}">
<view class="cuIcon-cu-image">
<image class="index-icon" src="{{ index == 2 ? '/static/img/icon/wardrobe-active-icon.png' : '/static/img/icon/wardrobe-icon.png' }}"></image>
</view>
<view class="{{ index == 2 ? 'text-green' : 'text-gray' }} mt10">洗衣柜</view>
</view> -->
<view data-index="2" bind:tap="tabSwitch" class="action {{index == 2?'text-green':'text-gray'}}">
<view class="cuIcon-cu-image">
<image class="index-icon" src="{{ index == 2 ? '/static/img/icon/xy_md.png' : '/static/img/icon/xy_md.png' }}"></image>
</view>
<view class="{{ index == 2 ? 'text-green' : 'text-gray' }} mt10">门店</view>
</view>
<view data-index="{{index}}" data-islog='ok' data-nav="true" bind:tap="tabSwitch" class="action text-gray add-action">
<view class="my-icno">
<view class="icon_bac flex-con3">
<image src="/static/img/icon/asdferfhrthjtr.png" />
</view>
</view>
马上洗
</view>
<view data-index="4" bind:tap="tabSwitch" class="action {{index == 4?'text-green':'text-gray'}}">
<view class="cuIcon-cu-image">
<image class="index-icon" src="{{ index == 4 ? '/static/img/icon/shop-active-icon.png' : '/static/img/icon/shop-icon.png' }}"></image>
</view>
<view class="{{ index == 4 ? 'text-green' : 'text-gray' }} mt10">商城</view>
</view>
<view data-index="5" bind:tap="tabSwitch" class="action {{index == 5?'text-green':'text-gray'}}">
<view class="cuIcon-cu-image">
<image class="index-icon" src="{{ index == 5 ? '/static/img/icon/home-active-icon.png' : '/static/img/icon/home-icon.png' }}"></image>
</view>
<view class="{{ index == 5 ? 'text-green' : 'text-gray' }} mt10">我的</view>
</view>
</view>
</view>
<!-- 客服 -->
<button catchtap="_service" wx:if="{{ index == 1 }}" class="customer flex-con3" style="right:{{ kfRight }}rpx;">
<image src="/static/img/icon/kf.png" />
</button>
<!-- 客服弹出层 -->
<view wx:if="{{ isKf }}" class="coupon flex-con3">
<view class="video_cen">
<view class="coupon_list tips-bac">
<view class="coupon_list_tit coupon_list_tit-t1">请选择你要进行的操作</view>
<view class="mt30 dis-flex">
<view class="flex1">
<view class="tel-img flex-con3" catchtap="openTel">
<image src="/static/img/tel-icon-kf.png" />
</view>
<view class="tel-p">电话客服</view>
</view>
<view class="flex1">
<button open-type="contact" class="tel-img flex-con3">
<image src="/static/img/wx-icon-kf.png" />
</button>
<view class="tel-p">微信客服</view>
</view>
</view>
</view>
<image catchtap="_service" src="/static/img/icon/colse_tips.png" />
</view>
</view>
<!-- 优惠券 -->
<view wx:if="{{ isCoupon }}" catchtouchmove="{{ isCoupon }}" class="coupon flex-con3">
<view class="video_cen">
<view class="coupon_list">
<view class="coupon_list_tit">{{couponTitle}}</view>
<view wx:for="{{ couponList }}" wx:key class="coupon_list_row dis-flex mt20" catchtap="goUrl">
<view class="coupon_row_l ">
<image src="/static/img/xrj.png" />
<view class="row_l1 flex-con3">
<view>
<view class="row_l1_p1">
<span>{{item.coupon_price}}</span>
</view>
<view class="row_l1_p2">满{{item.use_min_price}}使用</view>
</view>
</view>
</view>
<view class="flex1 coupon_row_r">
<image src="/static/img/xrjr.png" />
<view class="row_l1 flex-con2 pl30">
<view>
<view class="row_r1_p1 text-left clamp1">{{item.coupon_title}}</view>
<view class="row_r1_p2 text-left clamp1">
{{item.start_time}}至{{item.end_time}}
</view>
</view>
</view>
</view>
</view>
<view bind:tap="_receive" class="receive mt40">立即领取</view>
</view>
<image catchtap="_coupon" src="/static/img/icon/colse_tips.png" />
</view>
</view>
<!-- toasta提示 -->
<i-toast id="toast" />

View File

@@ -0,0 +1,222 @@
/* pages/auth/auth.wxss */
page{
background-color: #ffffff;
}
.tabbar{
/* height: 120rpx !important; */
}
.tabbar .action{
/* font-size: 30rpx !important; */
}
.my-icno{
padding: 10rpx;
position: absolute;
width: 130rpx;
z-index: 2;
height: 130rpx;
border-radius: 50%;
font-size: 50rpx;
top: -90rpx;
left: 0;
right: 0;
margin: 0 auto;
background-color: #ffffff;
}
.icon_bac{
border-radius: 50%;
height: 100%;
width: 100%;
background-image: linear-gradient(-30deg,
rgba(51, 51, 51, 0.2) 0%,
rgba(255, 255, 255, 0.2) 100%),
linear-gradient(
#1fcc58,
#41d974);
}
.icon_bac image{
width: 47rpx;
height: 64rpx;
vertical-align: middle;
}
.content{
padding-bottom: 140rpx;
}
.customer{
padding: 0 !important;
position: fixed;
bottom: 190rpx;
width: 100rpx;
height: 100rpx;
overflow: hidden;
background-color: #ffffff;
border-radius: 50%;
box-shadow: 0px 0px 30px 0px rgba(14, 5, 9, 0.4);
-moz-transition: all .5s ease;
-webkit-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
transition: all 0.5s;
}
.customer image{
height: 100%;
width: 100%;
}
.TabBar{
box-shadow: 0px -8px 20px 0px rgba(14, 5, 9, 0.06);
}
/* 底部导航 */
.index-icon{
width: 39rpx !important;
height: 39rpx !important;
}
/* 底部导航end */
/* 优惠券样式 */
.video_cen{
text-align: center;
}
.video_cen video{
width: 620rpx;
height: 400rpx;
display: block;
margin: 0 auto;
}
.video_cen image{
width: 69rpx;
height: 69rpx;
display: block;
margin: 55rpx auto 0;
}
.coupon{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.75);
z-index: 99999;
}
.coupon_list{
width: 600rpx;
padding: 40rpx;
background-color: #f92929;
border-radius: 10px;
}
.coupon_list_tit{
font-weight: 500;
font-family: PingFang-SC-Bold;
font-size: 36rpx;
color: #ffffff;
text-align: center;
margin: 10rpx;
}
.coupon_list_row{
height: 150rpx;
}
.coupon_row_l,
.coupon_row_r{
position: relative;
}
.coupon_row_l{
height: 150rpx;
width: 148rpx;
}
.coupon_row_l image{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 150rpx;
width: 148rpx;
vertical-align: middle;
margin: 0;
}
.coupon_row_r image{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%;
width: 100%;
margin: 0;
}
.row_l1{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%;
width: 100%;
}
.row_l1_p1{
font-family: PingFang-SC-Bold;
font-size: 25rpx;
color: #f92929;
}
.row_l1_p1 span{
font-size: 40rpx;
font-weight: 600;
}
.row_l1_p2{
font-family: PingFang-SC-Medium;
font-size: 18rpx;
color: #333333;
}
.row_r1_p1{
font-family: PingFang-SC-Medium;
font-size: 28rpx;
color: #333333;
}
.row_r1_p2{
font-family: PingFang-SC-Medium;
font-size: 22rpx;
color: #999999;
}
.receive{
padding: 22rpx 187rpx;
background-color: #f6b900;
border-radius: 45rpx;
font-family: PingFang-SC-Bold;
font-size: 32rpx;
color: #ffffff;
}
/* 客服弹出层 */
.tips-bac{
background-color: #ffffff;
}
.coupon_list_tit-t1{
color: #000000;
}
.tel-img{
margin: 0 auto;
width: 130rpx;
height: 130rpx;
background-color: #eaebed;
border-radius: 50%;
border: 0;
}
.tel-img::after{
width: 0;
height: 0;
}
.tel-img image{
width: 60rpx;
height: 60rpx;
margin: 0;
}
.tel-p{
margin-top: 15rpx;
font-family: PingFang-SC-Medium;
font-size: 28rpx;
font-weight: 400;
color: #666666;
}