diff --git a/甲情_甲意/.mini-ide/compileMode.json b/甲情_甲意/.mini-ide/compileMode.json index 43d0b24..0d5ab65 100644 --- a/甲情_甲意/.mini-ide/compileMode.json +++ b/甲情_甲意/.mini-ide/compileMode.json @@ -79,6 +79,36 @@ "title": "登录测试", "page": "pages/denglutest/denglutest", "launchMode": "common" + }, + { + "title": "pages/test/test", + "page": "pages/test/test", + "launchMode": "common" + }, + { + "title": "到店服务", + "page": "pages/daodianfuwu/daodianfuwu", + "launchMode": "common" + }, + { + "title": "发布抢单", + "page": "pages/kehushangmenyuyueqiangdan/kehushangmenyuyueqiangdan", + "launchMode": "common" + }, + { + "title": "我的预约", + "page": "pages/wodeyuyue/wodeyuyue", + "launchMode": "common" + }, + { + "title": "咨询", + "page": "pages/zixunmeijiashi/zixunmeijiashi", + "launchMode": "common" + }, + { + "title": "支付界面", + "page": "pages/zhifujiemian/zhifujiemian", + "launchMode": "common" } ] } \ No newline at end of file diff --git a/甲情_甲意/miniprogram/app.js b/甲情_甲意/miniprogram/app.js index d245edd..64cee0b 100644 --- a/甲情_甲意/miniprogram/app.js +++ b/甲情_甲意/miniprogram/app.js @@ -1,36 +1,29 @@ App({ - globalData: { - isLoggedIn: false, // 用户登录状态 - userInfo: null, // 用户信息 - }, - onLaunch() { - // 从本地存储读取登录信息 - const userInfo = my.getStorageSync({ key: 'user_info' }).data; - if (userInfo) { - this.globalData.isLoggedIn = true; - this.globalData.userInfo = userInfo; - } + my.getStorage({ + key: 'userInfo', + success: (res) => { + const userInfo = res.data; + const currentTimestamp = new Date().getTime(); + const lastLoginTimestamp = userInfo.timestamp; // 获取上次登录时间戳 + // 计算时间差(单位:毫秒) + const timeDiff = currentTimestamp - lastLoginTimestamp; + const oneDay = 86400* 1000; // 24小时的毫秒数 + // 如果时间差大于24小时,则清除缓存 + if (timeDiff > oneDay) { + console.log('超过24小时,清除缓存'); + my.removeStorage({ + key: 'userInfo', + success: function () { + console.log('用户信息已删除'); + }, + fail: function (err) { + console.error('删除失败:', err); + } + }); + } + }, + }); }, - - setUserInfo(userInfo) { - // 设置全局用户信息 - this.globalData.isLoggedIn = true; - this.globalData.userInfo = userInfo; - - // 同步存储到本地 - my.setStorageSync({ - key: 'user_info', - data: userInfo - }); - }, - - clearUserInfo() { - // 清空全局用户信息 - this.globalData.isLoggedIn = false; - this.globalData.userInfo = null; - - // 清除本地存储 - my.removeStorageSync({ key: 'user_info' }); - } + }) diff --git a/甲情_甲意/miniprogram/app.json b/甲情_甲意/miniprogram/app.json index 3ac17e6..b478554 100644 --- a/甲情_甲意/miniprogram/app.json +++ b/甲情_甲意/miniprogram/app.json @@ -1,25 +1,13 @@ { "pages": [ "pages/shouye/shouye", - "pages/kehubiaodan/kehubiaodan", "pages/shangmenyuyue/shangmenyuyue", "pages/daodianfuwu/daodianfuwu", - "pages/gongzuotai/gongzuotai", - "pages/kehuqiangdanqueren/kehuqiangdanqueren", "pages/kehushangmenyuyueqiangdan/kehushangmenyuyueqiangdan", - "pages/shangjiabiaodan/shangjiabiaodan", - "pages/shangjiabiaodanyuyue/shangjiabiaodanyuyue", - "pages/shangjiadingdan/shangjiadingdan", - "pages/shangmenyuyuedianpu/shangmenyuyuedianpu", - "pages/shangmenyuyueshijianduan/shangmenyuyueshijianduan", - "pages/shangpinxiadanjiemian/shangpinxiadanjiemian", "pages/wodeshoucang/wodeshoucang", "pages/wodeyuyue/wodeyuyue", "pages/zixunmeijiashi/zixunmeijiashi", "pages/shangjiaqiangdan/shangjiaqiangdan", - "pages/shangjiaqiangdanqueren/shangjiaqiangdanqueren", - "pages/shangpinpingjia/shangpinpingjia", - "pages/fuwujindu/fuwujindu", "pages/denglu/denglu", "pages/zhifujiemian/zhifujiemian", "pages/index/index", diff --git a/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.acss b/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.acss index 867221b..37dffc5 100644 --- a/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.acss +++ b/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.acss @@ -1,198 +1,98 @@ -/* 搜索框 */ -.Box1{ +.search-line { width: 100%; - height: 60px; + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px; +} +.cancel { + color: var(--color-text-primary); + +} +.box{ + width: 90%; + display: flex; + justify-content: center; + align-items: center; + border: 1px solid #de868f; + border-radius: 40px; + margin-top: 20rpx; } .box1{ - width: 330px; - height: 40px; - margin-top:15px; - margin-left: 35px; - border: 1px solid #de868f; - border-radius: 20px; - overflow:hidden; -} -/* 框内信息 */ -.box2{ width: 100%; - height: 30px; - background-color:#ffffff; - border-radius: 20px; + display: flex; + justify-content: center; +} +.box4{ + width: 120rpx; + height: 50rpx; + border: 1px solid #4095e5; + border-radius: 50px; + display: flex; + align-items: center; + justify-content: center; + position: relative; + bottom: 310rpx; + left: 530rpx; +} +.dingwei{ + position: relative; + + } +.statues{ + font-size: 13px; + width: 100rpx; + background-color: #4095e5; + margin-top: 20rpx; + margin-left: 10rpx; + color: white; + position: relative; + /* top: 88rpx; + right: 210rpx; */ +} +.text{ + font-weight: bolder; + margin-left: 10rpx; + position: relative; + top: 30rpx; + right: 10rpx; +} +.wenzi{ + width: 65%; + height: 200rpx; + position: relative; + left: 220rpx; + bottom: 180rpx; } - - .image{ - width: 25px; - height: 25px; - position: relative; - top:6px; - left: 5px; -} -.z1{ - top:8px; - left: 30px; - position: absolute; -} -/* 地区选择 */ -.image1{ - width: 15px; - height: 20px; - position: absolute; - top:54px; - left: 32px; -} -.z2{ - top:55px; - position: absolute; - left: 48px; -} -.h2 image{ - width: 10px; - height: 10px; - position: absolute; - top:62px; - left: 162px; -} -/* 店铺 */ -/* a店铺 */ -.adianpu{ - width: 344px; - height: 120px; - position: relative; - left: 8rpx; - top: 80px; - margin: auto; - border: 3px #de868f solid; - border-radius: 20px; - margin-top: 15rpx; -} - -/* a店铺名称 */ -.aname{ - font-size: 15px; - font-weight: bold; - left: 110px; - top: 15px; - position: absolute; - color: black; -} - -/* a店铺图片 */ -.t1 image{ width: 100px; height: 100px; - position: absolute; - top:10px; - left:5px; border-radius: 20px; -} -/* 可预定小框 */ -.ksm{ - width: 70px; - height: 26px; - position: absolute; - left: 255px; - top: 40px; - border: 1px #4095e5 solid; - border-radius: 10px; -} - -/* 可预定 休息中 小字 */ -.wksm{ - font-size: 12px; - left: 18px; - top: 6px; - position: absolute; - color: #4095e5; -} - -/* 接受预约 */ -.yy1{ - width: 50px; - height: 25px; - position: absolute; - left: 110px; - top: 45px; - background-color: #4095e5; -} -.yy2{ - width: 60px; - height: 25px; - position: absolute; - left: 165px; - top: 45px; - background-color: #ffffff; -} -.yy3{ - width: 10px; - height: 25px; - position: absolute; - left: 230px; - top: 45px; - background-color: #4095e5; -} - -/* 《预约》 */ -.wyy1{ - font-size: 12px; - color: #ffffff; -} -.wyy2{ - font-size: 12px; - color: #4095e5; -} - -/* 店铺地点 */ -.wdpdd{ - font-size: 12px; - left: 110px; - top: 85px; - position: absolute; - color: #9b9b9b; -} -/* 搜索框 */ -.search-outer { - box-sizing: border-box; - display:flex; - height:40px; - overflow:hidden; - padding: 8px; - border-bottom: 1px solid #ddd; position: relative; - bottom: 60rpx; - left: 40rpx; - width: 560rpx; + top: 25rpx; + left: 20rpx; } -/* 取消 */ -.search-cancel { - font-size: 16px; - color: #4095e5; /* 确保颜色可见 */ - display: inline-block; /* 确保元素不是隐藏的 */ - text-align: center; /* 如果需要居中 */ - line-height: 30px; /* 确保文字垂直居中 */ - position: relative; - bottom: 4rpx; +.kuang{ + width: 90%; + height: 240rpx; + border: 3px solid #de868f; + border-radius: 20px; + margin-top: 20rpx; } - -/* 输入 */ -.search-input { - flex:1; - text-align: left; - display: block; - color: #000; - height: 24px; - font-size: 15px; - background-color: #fff; - border-color: transparent; -} -/* 弹性盒 */ -.box3{ +.box2{ display: flex; - flex-wrap: wrap; /* 允许换行 */ - justify-content: space-between; /* 使子元素分布更均匀 */ - position: relative; + justify-content: center; + align-items: center; + margin-top: 50rpx; + flex-direction: column; } -.Box2{ +.dingweiimage{ + width: 30rpx; + height: 30rpx; +} +.dingweikuang{ + width: 100%; position: relative; - -} \ No newline at end of file + left: 50rpx; + top: 30rpx; +} \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.axml b/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.axml index 7edc9d4..29e46f5 100644 --- a/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.axml +++ b/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.axml @@ -1,55 +1,40 @@ - - - - - - - - - 取消 + + + + + + + + + + 取消 + + + + + + + {{selectedCity}} + + + + + + + + {{item.businessName}} + + {{item.businessImages}} + {{item.startBusiness}}营业 + + + {{item.address}} + + + + 可预约 + 已休息 - - - - - - - - 哈尔滨华德学院 - - - - - - - - - {{item.businessName}} - - {{item.businessImages}} - - - {{item.startBusiness}}营业 - - - - {{item.address}} - - 已休息 - 可预定 - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.js b/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.js index 3ac09aa..b9a0328 100644 --- a/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.js +++ b/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.js @@ -17,9 +17,19 @@ Page({ state: 0, storeStatus: '', updateTime: "", - userId: 0 + userId: 0, + inputtext:'', + selectedCity:'', + }, + inputchange(e){ + this.setData({ + inputtext:e.detail.value, + }); + console.log(e.detail.value); + console.log(this.data.inputtext); }, onLoad() { + this.localcation(); my.request({ url: url + '/api/business/list', method: 'POST', @@ -45,13 +55,11 @@ Page({ } }); }, - doneSearch() { - console.log('doneSearch', this.data.search); - my.hideKeyboard(); - }, - dianpu(item){ + dianpu(item) { const id = item.target.dataset.num + // console.log('传递的数据:', id); const ID = id.id + console.log(ID); const userId = id.userId const address = id.address const businessName = id.businessName @@ -59,10 +67,69 @@ Page({ const endBusiness = id.endBusiness const startBusiness = id.startBusiness const storeStatus = id.storeStatus - console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness); + const businessPhone =id.businessPhone + console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness,businessPhone); my.navigateTo({ - url: `/pages/dianpuzhuye/dianpuzhuye?userId=${userId}&&address=${address}&&businessName=${businessName}&&businessAvatar=${businessAvatar}&&startBusiness=${startBusiness}&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}&&id=${ID}`, + url: `/pages/dianpuzhuye/dianpuzhuye?userId=${userId}&&address=${address}&&businessName=${businessName}&&businessAvatar=${businessAvatar}&&startBusiness=${startBusiness}&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}&&id=${ID}&&businessPhone=${businessPhone}`, + }); + }, + find(){ + my.request({ + url: url + '/api/business/list/page/vo', + method: 'POST', + data: { + address: this.data.selectedCity, + businessName: this.data.inputtext, + businessProfile: "", + categoryId: "", + current: 1, + id: "", + pageSize: 20, + sortField: "", + sortOrder: "", + state: "", + storeStatus: "", + userId: "" + }, + headers: { + 'content-type': 'application/json', + }, + dataType: 'json', + success: (res) => { + console.log('Request succeeded:', res); + if (res.data && res.data.data) { + this.setData({ + sousuo:res.data.data.records + }) + } else { + console.log('shibaile') + } + }, + fail: (error) => { + console.error('Request failed', error); + } + }); + }, + localcation(){ + my.getLocation({ + type: 1, // 获取包括省市区县数据 + success: (res) => { + console.log('定位成功:', res); + this.setData({ + selectedCity: res.city // 将城市名称设置到 selectedCity + }); + }, + fail: (error) => { + console.error('定位失败:', error); + my.alert({ + title: '定位失败', + content: '无法获取当前位置,请检查定位权限设置。' + }); + this.setData({ + selectedCity: '定位失败' + }); + } }); } }); diff --git a/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.json b/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.json index e11b8fa..9eab84c 100644 --- a/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.json +++ b/甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.json @@ -1,5 +1,8 @@ { "defaultTitle": "到店服务", - "usingComponents": {}, + "usingComponents": { + "ant-icon": "antd-mini/es/Icon/index", + "ant-input": "antd-mini/es/Input/index" + }, "styleIsolation": "apply-shared" } diff --git a/甲情_甲意/miniprogram/pages/denglu/denglu.js b/甲情_甲意/miniprogram/pages/denglu/denglu.js index 645459e..416116d 100644 --- a/甲情_甲意/miniprogram/pages/denglu/denglu.js +++ b/甲情_甲意/miniprogram/pages/denglu/denglu.js @@ -2,34 +2,17 @@ import {url} from '../request' Page({ data: { authCode: '', + intervalId: null, // 定时器ID,用于后续清除 }, - + Login() { my.getAuthCode({ - scopes: 'auth_user', success: res => { const authCode = res.authCode; - console.log(typeof authCode); console.log(authCode); - - // my.setStorage({ - // key: 'userInfo', - // data: { - // username: username, - // avatarUrl: avatarUrl, - // cookie:setCookie, - // id:id - // }, - // success: function () { - - // console.log('用户信息已存储',cookie); - // }, - // fail: function (err) { - // console.error('存储失败:', err); - // } - // }); + // 请求后端接口进行用户登录 my.request({ url: url + '/api/Alipay/parseCode', @@ -37,28 +20,30 @@ Page({ authCode, }, success: (res) => { - const { username, avatarUrl,id} = res.data.data; + const { username, avatarUrl, id } = res.data.data; const setCookie = res.header['set-cookie'] || res.header['Set-Cookie']; - console.log('Set-Cookie:', setCookie+'这是这个码'); + console.log('Set-Cookie:', setCookie + '这是这个码'); + // 存储用户信息到本地存储 my.setStorage({ key: 'userInfo', data: { username: username, avatarUrl: avatarUrl, - cookie:setCookie, - id:id + cookie: setCookie, + id: id, + timestamp: new Date().getTime(), }, success: function () { - - console.log('用户信息已存储',cookie); + console.log('用户信息已存储'); }, fail: function (err) { console.error('存储失败:', err); } }); - + // 启动定时器清除缓存 + this.startClearingStorage(); // 登录成功后的处理逻辑 console.log(res); @@ -74,4 +59,36 @@ Page({ } }); }, -}); \ No newline at end of file + + // 启动定时器清除缓存 + startClearingStorage() { + // 清除缓存定时器,每小时检查一次 + const intervalId = setInterval(() => { + my.getStorage({ + key: 'userInfo', + success: (res) => { + const userInfo = res.data; + + if (userInfo) { + my.removeStorage({ + key: 'userInfo', + success: function () { + console.log('用户信息已删除'); + }, + fail: function (err) { + console.error('删除失败:', err); + } + }); + } else { + console.log('缓存中没有用户信息,停止定时器'); + clearInterval(intervalId); // 清除定时器 + } + }, + }); + }, 86400*1000); // 每小时检查一次,单位是毫秒(3600秒 = 1小时) + // 保存定时器ID,便于后续清除定时器 + this.setData({ + intervalId: intervalId, + }); + }, +}); diff --git a/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.acss b/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.acss index bacfb26..50e696d 100644 --- a/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.acss +++ b/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.acss @@ -1,5 +1,86 @@ +.cebian { + width: 20%; + height: 100v; + background-color: #efeced; + overflow: hidden; +} - +.text { + width: 100%; + height: 50px; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + cursor: pointer; +} +.color { + font-size: 14px; + color: rgb(0, 0, 0); /* 默认文字颜色 */ +} +.xian{ + width: 60px; + height: 3px; + background-color: #f2819f; + margin-top: 5rpx; +} +.xinxi{ + width: 80%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + overflow-y: scroll +} +.pages{ + width: 100%; + display: flex; + margin-top: 30rpx; +} +.shop{ + width: 90%; + height:130px; + border: 1px solid #f2819f; + border-radius: 20px; + margin-top: 20rpx; + display: flex; +} +.image{ + width: 100px; + height: 100px; + border-radius: 20px; +} +.imagebox{ + width: 100px; + height: 130px; + display: flex; + align-items: center; + justify-content: center; + margin-left: 10rpx; +} +.dingwei{ + position: relative; +} +.yuyue{ + display: flex; + justify-content: center; + align-items: center; + width: 50px; + height: 20px; + border-radius: 20px; + border: 1px solid #fb96b1; + background-color: #fb96b1; +} +.yuyuekuang{ + width: 100%; + display: flex; + justify-content: space-between; +} +.gouimage{ +width: 20px; +height: 20px; +} /* 店铺名框 */ .Box2 { @@ -33,23 +114,6 @@ left: 80rpx; bottom:10rpx; } - -/* 相册框按钮 */ -.box2{ - width: 60px; - height: 40px; - position: relative; - background-color: rgb(197, 190, 190); - top:110px; - left: 300px; - border-radius: 10px; -} -.z5{ - top:10px; - left: 10px; - position: absolute; -} - /* 营业时间 */ .z6{ color: #4095E5; @@ -74,7 +138,6 @@ font-size: 12px; margin-left: 10rpx; } - .image3{ width: 10px; height: 12px; @@ -86,161 +149,12 @@ background-color: darkgrey; margin-top: 10rpx; } -/* 推荐项目 */ -.zt1{ - font-size: 18px; - left: 10px; - position: relative; -} -/* 第一个项目 */ -.image2{ - width: 185px; - height: 140px; - position: relative; - border-radius: 10px; -} -.zt2{ - font-size: 20px; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - - -} -.zt3{ - color: #E89709; - font-size: 19px; - font-weight: bolder; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -.zt4{ - position: absolute; - top:5px; - left: 8px; - color: #ffffff; -} -.zt5{ - font-size: 20px; - position: absolute; - top:425px; - right: 30px; -} -.zt6{ - color: #E89709; - font-size: 19px; - font-weight: bolder; - position: absolute; - top:445px; - right: 60px; -} -.h4{ - width: 80px; - height: 30px; - position: absolute; - background-color: #58A55C; - top:470px; - left: 298px; - border-radius: 10px; -} -.zt7{ - position: absolute; - top:5px; - right: 8px; - color: #ffffff; -} -/* 推荐美甲师 */ -.wz1{ - font-size: 18px; - position: relative; - left: 10px; -} -/* 第一个美甲师 */ - -/* 底部框 */ -.Box6{ - width: 100%; - height: 70px; - height: #ffffffe9; - top:1300rpx; - position: fixed; -} -.image12{ - width: 35px; - height: 30px; - position: relative; - top:24px; - left: 20rpx; -} -.box5{ - width: 100%; - height: 1px; - background-color: darkgray; - position: relative; - bottom: 45rpx; -} -.t1{ - position: relative; - left: 90rpx; - bottom: 30rpx; -} -.box6{ - width: 130px; - height: 40px; - background-color: #eec2c7; - position: relative; - left: 480rpx; - border-radius: 20px; - bottom: 70rpx; -} -.t2{ - font-size: 20px; - top:8px; - left: 48px; - position: absolute; -} -.image{ +.shangimage{ width: 200rpx; height: 200rpx; border-radius: 10%; margin-left: 20rpx; } -.h1{ - width: 100%; - height: 200px; - white-space: nowrap; - margin-top: 20rpx; - overflow:hidden; - display: flex; -} -.box7 { - width: 100%; - flex-direction: column; /* 垂直方向弹性布局 */ - white-space: nowrap; /* 强制内容不换行,确保图片在一行显示 */ - position:relative; - top: 20rpx; -} - -.image-container { - display: inline-block; - width: 180rpx; - height: 240rpx; - margin-right: 10rpx; /* 图片之间的间距 */ - margin-left: 10rpx; -} - -.image5 { - width: 100%; - height: 100%; -} -.text{ - margin-left: 60rpx; - margin-top: 50rpx; -} .box8{ width: 500rpx; height: 200rpx; @@ -248,10 +162,62 @@ left: 230rpx; bottom: 200rpx; } -.diimage{ - width: 50rpx; - height: 50rpx; - position: relative; - left: 130rpx; - bottom: 25rpx; +.tiao{ + width: 100px; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} +.tiaobox{ + width: 100%; + height: 30px; + display: flex; +} +.pingjia{ + width: 100%; + display: flex; + justify-content: center; + margin-top: 10rpx; +} +.pingjiakuang{ + width: 90%; + border-top: #6e7071 1px solid; + height: auto; +} +.pingjiaimage{ + width: 40px; + height: 40px; + border-radius: 50px; +} +.touxiang{ + width: 100%; + height: 40px; + display: flex; + align-items: center; + margin-top: 10rpx; +} +.kuangimage{ + width: 100px; + height: 100px; + margin:10rpx 10rpx 10rpx 10rpx; + border-radius: 10px; +} +.tupianbox{ + width: 100%; + justify-content: center; +} +.soucangimage{ + width: 30px; + height: 30px; + position: absolute; + right: 80rpx; + top: -40rpx; +} +.zixunimage{ + width: 30px; + height: 30px; + position: absolute; + right: 0rpx; + top: -40rpx; } \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.axml b/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.axml index 93db4a1..8dd2929 100644 --- a/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.axml +++ b/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.axml @@ -1,7 +1,6 @@ - - + {{businessName}} @@ -9,10 +8,16 @@ 4.9 500条 + + + + + + - + 已休息 营业中 @@ -30,40 +35,90 @@ - - 推荐项目 - - - - - - {{item.commoditiesName}} - - ¥{{item.commoditiesPrice}} + + + {{item.hengname}} + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + {{item.commoditiesName}} + + + 款式随便做,饰品不限量,含甲片,含卸甲 + + + ¥{{item.commoditiesPrice}} + + 预约 + + + + - - - 推荐美甲师 - - - - - - {{item.manicuristName}} - - - + + + + + + + + 陌路 - - - - - 评价 - - - 咨询 - + + 颜色:冰透系列裸色01色+烤灯-简约 + + aslkjhdklajshdkalsdhaskljdhaskldhaskhdaksjhdkjsh + - + + + + + + + + + + + + + 店铺名称:{{businessName}} + + + + 联系电话:{{businessPhone}} + + + + 营业时间:{{startBusiness}}-{{endBusiness}} + + + + 店铺地址:{{address}} + + + \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.js b/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.js index 735b3ec..6b0da18 100644 --- a/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.js +++ b/甲情_甲意/miniprogram/pages/dianpuzhuye/dianpuzhuye.js @@ -1,7 +1,18 @@ -import { loadavg } from 'os'; -import {url} from '../request' +import{url} from '../request' Page({ data: { + lie: [ + { id: 1, name: '推荐款式', showLine: true }, + { id: 2, name: '中长款', showLine: false }, + { id: 3, name: '本甲款', showLine: false }, + { id: 4, name: '长款', showLine: false }, + { id: 5, name: '短款', showLine: false }, + ], + names:[ + { id:1, hengname:'款式分类',line:true}, + {id:2,hengname:'评价',line:false}, + {id:3,hengname:'商家',line:false}, + ], userId: '', address: '', businessName:'', @@ -26,7 +37,11 @@ Page({ phone: "", rating: 0, specialties: "", - id:'' + id:'', + filteredShopping: [], + showShoppingCart: true, // 控制购物车部分是否显示 + showComments: false, // 控制评论部分是否显示 + showBusinessInfo: false, // 控制商家信息是否显示 }, onLoad(options) { // Extract userId and address from options @@ -38,6 +53,7 @@ Page({ const endBusiness = options.endBusiness; const storeStatus = options.storeStatus; const id = options.id + const businessPhone = options.businessPhone console.log(id,'zheyedesaksdas'); // Set them in data for use in the page this.setData({ @@ -49,6 +65,7 @@ Page({ startBusiness:startBusiness, storeStatus:storeStatus, id:id, + businessPhone:businessPhone, }); my.request({ url: url + '/api/commodities/list/page/commodities', @@ -74,6 +91,8 @@ Page({ this.setData({ tuijian: res.data.data.records, // 更新 tuijian 列表 }); + this.chushihua(); + console.log(this.data.tuijian,'这是推荐'); } else { console.log('shibaile') } @@ -82,7 +101,7 @@ Page({ console.error('Request failed', error); } }); - this.meijiahsi(); + }, soucang() { my.getStorage({ @@ -104,10 +123,23 @@ Page({ }, dataType: 'json', success: (res) => { - my.alert({ - content: '收藏成功' - }); - console.log('收藏成功', res); + if(res.data.code===0){ + my.alert({ + content: '收藏成功' + }); + } + else if(res.data.code===40100){ + my.alert({ + content: '登录信息已过期,请重新登录' + }); + my.navigateTo({ + url:'/pages/denglu/denglu' + }) + }else{ + my.alert({ + content: '店铺已收藏' + }); + } }, fail: (error) => { console.error('请求失败: ', JSON.stringify(error)); @@ -128,32 +160,32 @@ Page({ }); }, - meijiahsi(){ - my.request({ - url: url + '/api/manicurist/userQueryAll', - method: 'GET', - data: { - businessId: this.data.id - }, - headers: { - 'content-type': 'application/json', - }, - dataType: 'json', - success: (res) => { - console.log('Request succeeded:', res); - if (res.data && res.data.data) { - this.setData({ - meijiashi: res.data.data, // 更新 tuijian 列表 - }); - } else { - console.log('shibaile') - } - }, - fail: (error) => { - console.error('Request failed', error); - } - }); - }, + // meijiahsi(){ + // my.request({ + // url: url + '/api/manicurist/userQueryAll', + // method: 'GET', + // data: { + // businessId: this.data.id + // }, + // headers: { + // 'content-type': 'application/json', + // }, + // dataType: 'json', + // success: (res) => { + // console.log('Request succeeded:', res); + // if (res.data && res.data.data) { + // this.setData({ + // meijiashi: res.data.data, // 更新 tuijian 列表 + // }); + // } else { + // console.log('shibaile') + // } + // }, + // fail: (error) => { + // console.error('Request failed', error); + // } + // }); + // }, pingjia(){ my.navigateTo({ url:'/pages/shangpinpingjia/shangpinpingjia' @@ -178,5 +210,76 @@ Page({ }) console.log(ids,businessId,commoditiesImage,commoditiesName,commoditiesPrice+'这是商品的') }, - -}); + // 点击事件处理函数 +selectItem(e) { + const id = e.currentTarget.dataset.id; + console.log(id); + // 更新对应的 showLine 状态,控制是否显示线条 + const updatedLie = this.data.lie.map(item => { + if (item.id === id) { + item.showLine = !item.showLine; // 切换显示状态 + } else { + item.showLine = false; // 其他项隐藏 + } + return item; + }); + + // 根据点击的类别 id 筛选对应的商品 + const filteredShopping = this.data.tuijian.filter(item => String(item.commoditiesGroupId) === String(id)); + + // 更新数据 + this.setData({ + lie: updatedLie, + filteredShopping, // 更新右侧商品列表 + showShoppingCart: true, // 显示购物车部分 + showComments: false, // 隐藏评论部分 + showBusinessInfo: false, // 隐藏商家信息部分 + }); + console.log(this.data.filteredShopping,'hhhhhhhhhhhhhh'); +}, +chushihua(){ + this.setData({ + filteredShopping: this.data.tuijian.filter(item => String(item.commoditiesGroupId) === "1"), // 默认选中类别 1 + }) + console.log(this.data.filteredShopping,'chushi'); +}, +chaxunzhuangtai(e) { + const id = e.currentTarget.dataset.id; + console.log(id); + + // 更新对应的 line 状态,控制是否显示线条 + const updatednames = this.data.names.map(item => { + if (item.id === id) { + item.line = !item.line; // 切换显示状态 + } else { + item.line = false; // 其他项隐藏 + } + return item; + }); + + this.setData({ + names: updatednames, + }); + + // 根据点击的分类切换显示内容 + if (id === 1) { + this.setData({ + showShoppingCart: true, // 显示购物车 + showComments: false, // 隐藏评论 + showBusinessInfo: false, // 隐藏商家信息 + }); + } else if (id === 2) { + this.setData({ + showShoppingCart: false, // 隐藏购物车 + showComments: true, // 显示评论 + showBusinessInfo: false, // 隐藏商家信息 + }); + } else if (id === 3) { + this.setData({ + showShoppingCart: false, // 隐藏购物车 + showComments: false, // 隐藏评论 + showBusinessInfo: true, // 显示商家信息 + }); + } +}, +}); \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.acss b/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.acss index 10700d4..9083b1a 100644 --- a/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.acss +++ b/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.acss @@ -15,6 +15,7 @@ border-radius: 20px; padding: 10px; margin-bottom: 80px; /* 留出一些空间给底部结算栏 */ + margin-top: 30rpx; } .box1 { @@ -53,9 +54,11 @@ } .container { + width: 100px; position: relative; - left: 85px; - top: 25px; + left: 100px; + top: 20px; + display: flex; } .boxd { @@ -88,7 +91,7 @@ } .text2 { position: relative; - left: 185rpx; + left: 200rpx; } .text3{ height: 20px; @@ -98,3 +101,20 @@ font-size:12px; color:#a8b0b8 } +.number{ + width: 30px; + background-color: white; + display: flex; + justify-content: center; + align-items: center; +} +.beijing{ + display: flex; + justify-content: center; + align-items: center; + width: 25px; + height: 25px; + background-color: white; + font-size: 20p; + +} \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.axml b/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.axml index a9ea0f4..d38c8b8 100644 --- a/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.axml +++ b/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.axml @@ -1,25 +1,16 @@ + - - + - - - {{item.commoditiesName}} @@ -27,19 +18,28 @@ ¥{{item.commoditiesPrice}} - + + - + + + {{item.quantity}} + + + + + 移除购物车 + - 全选 + 全选 合计:¥{{totalPrice}} - + 结算 diff --git a/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.js b/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.js index 4183def..9f0bda4 100644 --- a/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.js +++ b/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.js @@ -3,21 +3,139 @@ import { url } from '../request'; Page({ data: { id: '', - checked: false, // 全选的状态 productList: [], // 商品列表 - selectedItems: [], // 每个商品的选中状态 - totalPrice: 0, // 总价 + select_all: false, + checkbox_productListid: '', + totalPrice: 0, + }, + // 计算总价 +calculateTotalPrice() { + const totalPrice = this.data.productList + .filter(item => item.checked) // 只计算勾选的商品 + .reduce((sum, item) => sum + item.quantity * item.commoditiesPrice, 0); + + // 格式化总价为两位小数 + const formattedTotalPrice = totalPrice.toFixed(2); + + // 更新 totalPrice + this.setData({ totalPrice: formattedTotalPrice }); +}, + // 增加商品数量 + increaseQuantity(e) { + const { index } = e.currentTarget.dataset; // 获取当前商品的索引 + const updatedProductList = [...this.data.productList]; + const item = updatedProductList[index]; + // 增加数量 + if (item.quantity < 999) { + item.quantity += 1; + } + this.setData({ productList: updatedProductList }); + this.calculateTotalPrice(); // 重新计算总价 + }, + // 减少商品数量 + decreaseQuantity(e) { + const { index } = e.currentTarget.dataset; // 获取当前商品的索引 + const updatedProductList = [...this.data.productList]; + const item = updatedProductList[index]; + // 减少数量 + if (item.quantity > 1) { + item.quantity -= 1; + } + this.setData({ productList: updatedProductList }); + this.calculateTotalPrice(); // 重新计算总价 + }, + // 全选/取消全选 + selectall(e) { + const newSelectAll = !this.data.select_all; + const updatedProductList = this.data.productList.map(item => ({ + ...item, + checked: newSelectAll, + })); + + const checkbox_productListid = newSelectAll + ? updatedProductList.map(item => item.cartId).join(',') + : ''; + + this.setData({ + productList: updatedProductList, + select_all: newSelectAll, + checkbox_productListid, + }); + console.log("arr=", checkbox_productListid); + this.calculateTotalPrice(); // 重新计算总价 + const selectedProducts = updatedProductList.filter(item => item.checked); + this.setData({ + selectedProducts, // 存储勾选的商品信息 + }); + console.log(selectedProducts); + }, + checkboxChange(e) { + const { value } = e.detail; // 当前选中的值列表 + const updatedProductList = this.data.productList.map(item => ({ + ...item, + checked: value.includes(item.cartId.toString()), + })); + const select_all = updatedProductList.every(item => item.checked); + this.setData({ + productList: updatedProductList, + select_all, + }); + this.calculateTotalPrice(); // 更新总价 + // 提取勾选的商品 + const selectedProducts = updatedProductList.filter(item => item.checked); + this.setData({ + selectedProducts, // 存储勾选的商品信息 + }); + console.log(selectedProducts,'askldjaslkdaslkdjklas'); + }, + // 获取商品数据 + fetchProductDetails(cartItems) { + const promises = cartItems.map((item) => { + return new Promise((resolve, reject) => { + my.request({ + url: url + '/api/commodities/getById/commodities', + method: 'GET', + data: { id: item.commoditiesId }, + headers: { 'content-type': 'application/json' }, + success: (res) => { + console.log(res); + if (res.data.code === 0) { + const productData = res.data.data; + productData.cartId = item.id; // 将 cartId 添加到商品数据中 + productData.quantity = 1; // 默认数量为 1 + resolve(productData); + } else { + reject(`商品信息获取失败: ${res.data.message}`); + } + }, + fail: (error) => { + reject(error); + }, + }); + }); + }); + + Promise.all(promises) + .then((productList) => { + this.setData({ productList }); + this.calculateTotalPrice(); // 初始化总价 + }) + .catch((error) => { + console.error('商品信息获取失败: ', error); + my.alert({ content: '商品信息获取失败,请稍后重试' }); + }); }, - onShow() { + // 页面加载时获取商品数据 + onLoad() { + this.setData({ + select_all: false, + products:[], + }); my.getStorage({ key: 'userInfo', success: (res) => { const userInfo = res.data; - this.setData({ - id: userInfo.id, // 获取 id - }); - if (userInfo && userInfo.cookie) { my.request({ url: url + '/api/cart/selectByUserId', @@ -30,8 +148,16 @@ Page({ dataType: 'json', success: (res) => { if (res.data.code === 0) { + console.log(res); const cartItems = res.data.data; this.fetchProductDetails(cartItems); + } else { + my.alert({ + content: '登录信息已过期,请重新登录', + }); + my.navigateTo({ + url: '/pages/denglu/denglu', + }); } }, fail: (error) => { @@ -39,20 +165,18 @@ Page({ my.alert({ content: '请求失败,请稍后重试' }); }, }); - } else { + } + else{ my.alert({ - content: '您未登录,请先登录。', - success: () => { - my.navigateTo({ - url: '/pages/denglu/denglu', - }); - }, - }); + content:'您未登录,请先登录' + }) + my.navigateTo({ + url:'/pages/denglu/denglu' + }) } }, }); }, - yichu(e) { const cartId = e.currentTarget.dataset.id; // 获取商品的 cartId if (!cartId) { @@ -60,9 +184,7 @@ Page({ my.alert({ content: '商品ID未找到,请稍后重试' }); return; } - console.log('需要移除的商品cartId:', cartId); - my.getStorage({ key: 'userInfo', success: (res) => { @@ -90,10 +212,6 @@ Page({ console.log(res); } }, - fail: (error) => { - console.error('请求失败: ', JSON.stringify(error)); - my.alert({ content: '请求失败,请稍后重试' }); - }, }); } }, @@ -101,11 +219,11 @@ Page({ }, // 移除后更新 updateCartList() { + this.setData({ select_all: false }); my.getStorage({ key: 'userInfo', success: (res) => { const userInfo = res.data; - if (userInfo && userInfo.cookie) { my.request({ url: url + '/api/cart/selectByUserId', // 获取最新的购物车数据 @@ -135,82 +253,19 @@ Page({ }, }); }, - - fetchProductDetails(cartItems, userId) { - console.log(cartItems, 'zheshiid'); - const promises = cartItems.map((item) => { - return new Promise((resolve, reject) => { - my.request({ - url: url + '/api/commodities/getById/commodities', - method: 'GET', - data: { id: item.commoditiesId }, - headers: { 'content-type': 'application/json' }, - success: (res) => { - if (res.data.code === 0) { - const productData = res.data.data; - productData.userId = userId; // 添加 userId - productData.cartId = item.id; // 将 cartId 添加到商品数据中 - resolve(productData); - } else { - reject(`商品信息获取失败: ${res.data.message}`); - } - }, - fail: (error) => { - reject(error); - }, - }); - }); - }); - - Promise.all(promises) - .then((productList) => { - this.setData({ - productList, - selectedItems: new Array(productList.length).fill(false), // 初始化所有商品的选中状态为 false - }); - console.log(productList, '这是商品'); + jiesuan() { + const products = this.data.selectedProducts; + if(!products || products.length === 0){ + my.alert({ + content:'请选择商品' }) - .catch((error) => { - console.error('商品信息获取失败: ', error); - my.alert({ content: '商品信息获取失败,请稍后重试' }); + }else{ + const productsStr = JSON.stringify(products) + const prices =this.data.totalPrice + my.navigateTo({ + url: '/pages/zhifujiemian/zhifujiemian?products='+encodeURIComponent(productsStr)+ '&prices=' + encodeURIComponent(prices) }); - }, - - calculateTotalPrice() { - const selectedItems = this.data.selectedItems; - const productList = this.data.productList; - let totalPrice = 0; - selectedItems.forEach((selected, index) => { - if (selected) { - totalPrice += parseFloat(productList[index].commoditiesPrice); - } - }); - this.setData({ - totalPrice: totalPrice.toFixed(2), - }); - }, - - toggleChange() { - const newChecked = !this.data.checked; - const selectedItems = new Array(this.data.productList.length).fill(newChecked); - this.setData({ - checked: newChecked, - selectedItems, - }); - this.calculateTotalPrice(); - }, - - handleCheckedChange(e) { - const index = e.target.dataset.index; - if (index === undefined) { - console.error('e.target.dataset.index is undefined'); - return; } - const selectedItems = [...this.data.selectedItems]; - selectedItems[index] = e.detail.value; - this.setData({ - selectedItems, - }); - this.calculateTotalPrice(); - }, -}); + } + +}); \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.json b/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.json index 5662f87..8e8d368 100644 --- a/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.json +++ b/甲情_甲意/miniprogram/pages/gouwuche/gouwuche.json @@ -1,11 +1,7 @@ { "defaultTitle": "购物车", "usingComponents": { - "ant-checkbox": "antd-mini/es/Checkbox/index", - "stepper": "antd-mini/es/Stepper/index", - "ant-checkbox-group": "antd-mini/es/Checkbox/CheckboxGroup/index", - "ant-swipe-action": "antd-mini/es/SwipeAction/index", - "ant-stepper": "antd-mini/es/Stepper/index" + }, "styleIsolation": "apply-shared" } diff --git a/甲情_甲意/miniprogram/pages/image/tijiagouwuche.png b/甲情_甲意/miniprogram/pages/image/tijiagouwuche.png new file mode 100644 index 0000000..31ecff3 Binary files /dev/null and b/甲情_甲意/miniprogram/pages/image/tijiagouwuche.png differ diff --git a/甲情_甲意/miniprogram/pages/image/zixun.png b/甲情_甲意/miniprogram/pages/image/zixun.png new file mode 100644 index 0000000..9c36f23 Binary files /dev/null and b/甲情_甲意/miniprogram/pages/image/zixun.png differ diff --git a/甲情_甲意/miniprogram/pages/index/index.axml b/甲情_甲意/miniprogram/pages/index/index.axml index 049bdf7..d319046 100644 --- a/甲情_甲意/miniprogram/pages/index/index.axml +++ b/甲情_甲意/miniprogram/pages/index/index.axml @@ -1,10 +1,2 @@ - - - - 这是一个空白小程序,安装此小程序后修改 index.js 中的环境 ID 为自己的环境 ID 并且部署云函数就可以正常访问函数。 - - - {{data}} - - + \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/index/index.json b/甲情_甲意/miniprogram/pages/index/index.json index f1f64b0..b1cb3d1 100644 --- a/甲情_甲意/miniprogram/pages/index/index.json +++ b/甲情_甲意/miniprogram/pages/index/index.json @@ -1,8 +1,5 @@ { "usingComponents": { - "list": "antd-mini/es/List/index", - "list-item": "antd-mini/es/List/ListItem/index", - "icon": "antd-mini/es/Icon/index", - "switch": "antd-mini/es/Switch/index" + } } \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/meijiashirenzheng/meijiashirenzheng.js b/甲情_甲意/miniprogram/pages/meijiashirenzheng/meijiashirenzheng.js index d75f5a4..9dc04c4 100644 --- a/甲情_甲意/miniprogram/pages/meijiashirenzheng/meijiashirenzheng.js +++ b/甲情_甲意/miniprogram/pages/meijiashirenzheng/meijiashirenzheng.js @@ -29,12 +29,12 @@ Page({ url: url + '/api/manicurist/add', method: 'POST', data: { - certificate_path: this.data.businessName, + certificate_path: this.data.selectedOption, certification_number: this.data.idcard, email: this.data.person, gender: 0, issuing_authority: "hhh", - manicuristName: this.data.selectedOption, + manicuristName: this.data.businessName, phone: this.data.phone, specialties: "hhh" }, @@ -44,9 +44,18 @@ Page({ }, dataType: 'json', success: (res) => { - console.log(res); - my.navigateBack() - my.alert({ content: '正在审核中,请耐心等待' }); + if(res.data.code===0){ + my.navigateBack(); + my.alert({content:res.data.description}) + } + elif(res.data.code===50001) + { + my.alert({content:res.data.description}) + } + elif(res.data.code===40100) + { + my.alert({content:res.data.description}) + } }, fail: (error) => { console.error('请求失败: ', JSON.stringify(error)); diff --git a/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.acss b/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.acss index d0b9a4d..3aa1558 100644 --- a/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.acss +++ b/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.acss @@ -13,58 +13,74 @@ height: 30rpx; } .box{ - width: 100%; - display: flex; /* 启用 Flexbox 布局 */ - flex-direction: column; /* 设置主轴为竖直方向 */ - align-items: center; /* 在交叉轴(水平方向)上居中对齐 */ - height: 100vh; -} -.kuang{ -width: 90%; -height: 240rpx; -border: 1px solid #de868f; -border-radius: 20px; -margin-top: 20rpx; -} - -.image{ -width: 100px; -height: 100px; -border-radius: 20px; -position: relative; -top: 25rpx; -left: 20rpx; -} - -.wenzi{ -width: 65%; -height: 200rpx; -position: relative; -left: 220rpx; -bottom: 180rpx; -} - -.text{ -font-weight: bolder; -margin-left: 10rpx; -position: relative; -top: 30rpx; -right: 10rpx; + width: 90%; + display: flex; + justify-content: center; + align-items: center; + border: 1px solid #de868f; + border-radius: 40px; + margin-top: 20rpx; } .box1{ -font-size: 13px; -width: 100rpx; -background-color: #21a612; -margin-top: 20rpx; -margin-left: 10rpx; -color: white; -position: relative; -top: 88rpx; -right: 210rpx; + width: 100%; + display: flex; + justify-content: center; +} +.box4{ + width: 120rpx; + height: 50rpx; + border: 1px solid #4095e5; + border-radius: 50px; + display: flex; + align-items: center; + justify-content: center; + position: relative; + bottom: 310rpx; + left: 530rpx; } .dingwei{ -position: relative; - + position: relative; + + } +.statues{ + font-size: 13px; + width: 100rpx; + background-color: #4095e5; + margin-top: 20rpx; + margin-left: 10rpx; + color: white; + position: relative; + /* top: 88rpx; + right: 210rpx; */ +} +.text{ + font-weight: bolder; + margin-left: 10rpx; + position: relative; + top: 30rpx; + right: 10rpx; +} +.wenzi{ + width: 65%; + height: 200rpx; + position: relative; + left: 220rpx; + bottom: 180rpx; +} +.image{ + width: 100px; + height: 100px; + border-radius: 20px; + position: relative; + top: 25rpx; + left: 20rpx; +} +.kuang{ + width: 90%; + height: 240rpx; + border: 3px solid #de868f; + border-radius: 20px; + margin-top: 20rpx; } .box2{ display: flex; @@ -72,15 +88,4 @@ position: relative; align-items: center; margin-top: 50rpx; flex-direction: column; -} -.box4{ - width: 120rpx; - height: 50rpx; - border: 1px solid #21a612; - border-radius: 50px; - display: flex; - align-items: center; - justify-content: center; - position: relative; - left: 300rpx; } \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.axml b/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.axml index d28f379..340e973 100644 --- a/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.axml +++ b/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.axml @@ -26,23 +26,26 @@ + - + - - + + - {{item.name}} - {{item.statue}} - {{item.time}} - - {{item.address}} - - - 可上门 + {{item.businessName}} + + {{item.businessImages}} + {{item.startBusiness}}营业 + + + {{item.address}} + + 可上门 + 已休息 + - \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.js b/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.js index d620bd5..cb8daca 100644 --- a/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.js +++ b/甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.js @@ -1,39 +1,12 @@ +import {url} from '../request' Page({ data: { selectedCity:'', - - dianpu:[ - { - name:'小德美甲店铺', - statue:'接受预定', - image:'/pages/image/meijia1.jpg', - time:'8:00营业', - address:'哈尔滨市呼兰区学院路街道288号' - }, - { - name:'小德美甲店铺', - statue:'接受预定', - image:'/pages/image/meijia1.jpg', - time:'8:00营业', - address:'哈尔滨市呼兰区学院路街道288号' - }, - { - name:'小德美甲店铺', - statue:'接受预定', - image:'/pages/image/meijia1.jpg', - time:'8:00营业', - address:'哈尔滨市呼兰区学院路街道288号' - }, - { - name:'小德美甲店铺', - statue:'接受预定', - image:'/pages/image/meijia1.jpg', - time:'8:00营业', - address:'哈尔滨市呼兰区学院路街道288号' - } - ] + xuanran:[], + inputtext:'', }, onShow(){ + this.chaxun(); my.getLocation({ type: 1, // 获取包括省市区县数据 success: (res) => { @@ -53,5 +26,93 @@ Page({ }); } }); - } + }, + chaxun(){ + my.request({ + url: url + '/api/business/list', + method: 'POST', + data: { + + }, + headers: { + 'content-type': 'application/json', + }, + dataType: 'json', + success: (res) => { + console.log('Request succeeded:', res); + if (res.data && res.data.data) { + this.setData({ + xuanran: res.data.data, // 更新 tuijian 列表 + }); + } else { + console.log('shibaile') + } + }, + fail: (error) => { + console.error('Request failed', error); + } + }); + }, + onConfirm(){ + my.request({ + url: url + '/api/business/list/page/vo', + method: 'POST', + data: { + address: this.data.selectedCity, + businessName: this.data.inputtext, + businessProfile: "", + categoryId: "", + current: 1, + id: "", + pageSize: 20, + sortField: "", + sortOrder: "", + state: "", + storeStatus: "", + userId: "" + }, + headers: { + 'content-type': 'application/json', + }, + dataType: 'json', + success: (res) => { + console.log('Request succeeded:', res); + if (res.data && res.data.data) { + this.setData({ + xuanran:res.data.data.records + }) + } else { + console.log('shibaile') + } + }, + fail: (error) => { + console.error('Request failed', error); + } + }); + }, + dianpu(item) { + const id = item.target.dataset.num + // console.log('传递的数据:', id); + const ID = id.id + console.log(ID); + const userId = id.userId + const address = id.address + const businessName = id.businessName + const businessAvatar = id.businessAvatar + const endBusiness = id.endBusiness + const startBusiness = id.startBusiness + const storeStatus = id.storeStatus + const businessPhone =id.businessPhone + console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness,businessPhone); + + my.navigateTo({ + url: `/pages/dianpuzhuye/dianpuzhuye?userId=${userId}&&address=${address}&&businessName=${businessName}&&businessAvatar=${businessAvatar}&&startBusiness=${startBusiness}&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}&&id=${ID}&&businessPhone=${businessPhone}`, + }); + }, + onChange(value) { + this.setData({ + inputtext:value + }) + console.log(this.data.inputtext); +}, }); diff --git a/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.acss b/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.acss index b8e2111..6543242 100644 --- a/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.acss +++ b/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.acss @@ -1,11 +1,11 @@ /* 商品图背景 */ .image{ - width: 390px; + width: 100%; height: 300px; } /* 价格 */ .box1{ - width: 390px; + width: 100%; height: 80px; background-color: #eec2c7; position: relative; @@ -45,7 +45,6 @@ left: 240rpx; top: 25rpx; } /* 商品介绍 */ - .z5{ font-size: 15px; position: relative; @@ -53,162 +52,33 @@ top: 25rpx; color: darkgrey; left: 5px; } -/* 中间信息 */ -.z6{ - font-size: 22px; - color: rgb(190, 57, 57); - position: absolute; - top:140px; - left: 10px; -} -.z7{ - font-size: 22px; - position: absolute; - top:140px; - left: 130px; -} -.z8{ - font-size: 22px; - position: absolute; - top:140px; - left: 250px; -} -/* 详情介绍 */ -.box3{ - width: 50px; - height: 2px; - position: absolute; - top:174px; - left: 32px; - background-color: rgb(169, 169, 169); -} -.Box3{ - width: 390px; - height: 220px; - background-color: rgba(169, 169, 169, 0.53); - position: absolute; - top:180px; +.time{ + width: 100%; + height: 400px; + border-top: 2px solid #aba8a8; + margin-top: 40rpx; border-radius: 20px; } -.Box4{ - width: 388px; - height: 218px; - background-color: #ffffff; - position: absolute; - top:1px; - left: 1px; - border-radius: 20px; +.yuyuetext{ + width: 100%; + height: 50px; } - - - -/* 内部盒子 */ -.Box5{ - width: 340px; - height: 130px; - background-color:rgba(169, 169, 169, 0.53) ; - position: absolute; - top:70px; - left: 30px; - border-radius: 10px; -} -.box6{ - width:338px ; - height: 128px; - background-color: #ffffff; - position: absolute; - top:1px; - left: 1px; - border-radius: 10px; -} -.box7{ - width: 338px; - height: 30px; - background-color:#FEFA83; - position: absolute; -} -.w4{ - position: absolute; - top:5px; - left: 5px; -} -.w5{ - position: absolute; - top:5px; - left: 240px; -} -.w6{ - font-size: 13px; - position: absolute; - top:35px; - left: 5px; -} -.w7{ - font-size: 13px; - position: absolute; - top:60px; - left: 5px; -} -.w8{ - font-size: 13px; - position: absolute; - top:85px; - left: 5px; -} -.w9{ - font-size: 13px; - position: absolute; - top:85px; - left: 60px; -} -.w10{ - font-size: 13px; - position: absolute; - top:110px; - left: 5px; -} -.box9{ - position: relative; - top: 35rpx; -} -.container { - padding: 16px; -} -.box10{ - display: block; - margin-top: 15rpx; -} -.box11{ - display: flex; - justify-content: space-between; - align-items: center; - width: 100%; -} -/* Add this in your style section */ -.button-container { - display: flex; - justify-content: space-between; - padding: 10px; - position: absolute; - top: 700px; - left: 28px; -} - -.button { - background-color: #f3bfc1; /* Light pink background color */ - color: #000000; /* Text color */ - border-radius: 20px; /* Rounded edges */ - padding: 10px 20px; - text-align: center; - font-size: 16px; +.timebox{ width: 100px; + height: 40px; + border: 1px solid #8f8c8c; + border-radius: 10px; + margin-left: 20rpx; + display: flex; + justify-content: center; + align-items: center; + margin-top: 10rpx; } - -/* Additional styling for individual buttons if needed */ -.add-to-cart { - margin-right: 20px; -} - -.buy-now { - margin-left: 20px; -} +.boxtextkuang{ + width: 100%; + height: 180px; + display: flex; + flex-wrap: wrap; + justify-content: space-evenly; + gap: 10px; +} \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.axml b/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.axml index 59046a3..a43b869 100644 --- a/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.axml +++ b/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.axml @@ -1,4 +1,4 @@ - + @@ -14,55 +14,16 @@ 须知 需提前两小时预约 周一至周日全天可用 购买后30天内有效 购买前请仔细阅读 - - - - - - - - 商品介绍 - 适用部位: 手部 - 包含项目 - - 款式美甲 - 1/{{commoditiesPrice}} - - 美甲类型: 全手任意款式(款式随便做,饰品随便贴) - 美甲饰品: 随便选择饰品款式 - 封层 : 磨砂/亮面 - 底胶品牌: PQ|甲胶油 - - - - - - - - - - - + + + + + 预约时间 + + + + {{item.title}} - - - - - 加入购物车 - 立即购买 - - - + \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.js b/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.js index c14f09c..5868f7f 100644 --- a/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.js +++ b/甲情_甲意/miniprogram/pages/shangpinjiemian/shangpinjiemian.js @@ -7,11 +7,18 @@ Page({ commoditiesName: '', businessId: '', ids: '', - items: [ - { title: '项目详情' }, - { title: '购买须知' }, - { title: '评价' }, + time: [ + { title: '9:00' }, + { title: '10:00' }, + { title: '11:00' }, + { title: '12:00' }, + { title: '13:00' }, + { title: '14:00' }, + { title: '15:00' }, + { title: '16:00' }, + { title: '17:00' }, ], + selectedTime: '', }, onLoad(options) { @@ -37,6 +44,11 @@ Page({ current, }); }, + onSwipeChange(e) { + this.setData({ + current: e.detail.current, + }); +}, onShow(){ this.checkUserLogin }, @@ -59,59 +71,63 @@ this.checkUserLogin jiaru() { - // 获取本地存储的用户信息 my.getStorage({ key: 'userInfo', success: (res) => { - const userInfo = res.data; - console.log(userInfo,userInfo.cookie); - if (userInfo && userInfo.cookie) { - - // 使用获取的 `cookie` 值 - my.request({ - url: url + '/api/cart/add', - method: 'POST', - data: { - businessId: this.data.businessId, - commoditiesId: this.data.ids, - quantity: 1, - selectedOptions: "", - }, - headers: { - 'content-type': 'application/json', - 'Cookie': userInfo.cookie, // 通过头部传递 cookie - }, - dataType: 'json', - success: (res) => { - console.log(res); - my.alert({ content: '成功添加到购物车' }); - }, - fail: (error) => { - console.error('请求失败: ', JSON.stringify(error)); - my.alert({ content: '请求失败,请稍后重试' }); - }, - complete: () => { - my.hideLoading(); - }, - }); - } else { - // 未登录时跳转到登录页面 - my.alert({ - content: '您未登录,请先登录。', - success: () => { - my.navigateTo({ - url: '/pages/denglu/denglu', + const userInfo = res.data; + if (userInfo && userInfo.cookie) { + my.request({ + url: url + '/api/cart/add', + method: 'POST', + data: { + businessId: this.data.businessId, + commoditiesId: this.data.ids, + quantity: 1, + selectedOptions: "", + }, + headers: { + 'content-type': 'application/json', + 'Cookie': userInfo.cookie, // 通过头部传递 cookie + }, + dataType: 'json', + success: (res) => { + if(res.data.code===0){ + console.log(res); + my.alert({ content: '成功添加到购物车' }); + } + else if(res.data.code===40100){ + my.alert({ + content: '登录信息已过期,请重新登录' + }); + my.navigateTo({ + url:'/pages/denglu/denglu' + }) + } + }, + fail: (error) => { + console.error('请求失败: ', JSON.stringify(error)); + my.alert({ content: '请求失败,请稍后重试' }); + }, + }); + } else { + my.alert({ + content: '您未登录,请先登录。', + success: () => { + my.navigateTo({ + url: '/pages/denglu/denglu', + }); + }, }); - }, - }); - } + } }, - fail: (err) => { - console.error('获取用户信息失败:', err); - my.alert({ - content: '获取用户信息失败,请重试。', - }); - } + }); + }, + selectTime(e) { + const selectedTime = e.currentTarget.dataset.time; // 获取点击的时间 + console.log(selectedTime); + this.setData({ + selectedTime: selectedTime, // 更新选中的时间 }); + console.log('选中的时间:', this.data.selectedTime); // 打印选中的时间 }, }); diff --git a/甲情_甲意/miniprogram/pages/shouye/shouye.acss b/甲情_甲意/miniprogram/pages/shouye/shouye.acss index 6472925..96b3b14 100644 --- a/甲情_甲意/miniprogram/pages/shouye/shouye.acss +++ b/甲情_甲意/miniprogram/pages/shouye/shouye.acss @@ -1,205 +1,18 @@ -.shouyeBox1{ - height: 110px; - margin-bottom: 10px; - padding-bottom: 10px; -} -/* 个人预约 */ -.box1{ - width: 180px; - height: 100px; - background-color:#ff001913; - top:20px; - left:10px; - position: absolute; - border-radius: 20px; -} -.text1{ - font-size:20px; - font-weight: bolder; - position: absolute; - color:#DE868F; - left:50px; - top:40px; -} -/* 到店服务 */ -.box2{ - width: 180px; - height: 100px; - background-color:#ff001913 ; - top:20px; - right:10px; - position: absolute; - border-radius: 20px; -} -.text2{ - font-size:20px; - font-weight: bolder; - position: absolute; - color:#DE868F; - right:50px ; - top:40px; -} .k1{ width: 100%; height: 60px; background-color: #efaab1b7; - top:80rpx; - position: relative; + margin-top: 70rpx; } .z1{ font-size: 25px; font-weight: bolder; - position: absolute; + position: relative; color: #ffffff; top:15px; left:20px; } -/* a店铺 */ -.adianpu{ - width: 344px; - height: 120px; - position: relative; - left: 8rpx; - top: 60px; - margin: auto; - border: 3px #de868f solid; - border-radius: 20px; - margin-top: 15rpx; -} - -/* a店铺名称 */ -.aname{ - font-size: 15px; - font-weight: bold; - left: 110px; - top: 15px; - position: absolute; - color: black; -} - -/* a店铺图片 */ -.t1 image{ - width: 100px; - height: 100px; - position: absolute; - top:10px; - left:5px; - border-radius: 20px; -} - -/* b店铺 */ -.bdianpu{ - width: 344px; - height: 120px; - position: absolute; - left: 22px; - top: 620px; - margin: auto; - border: 3px #de868f solid; - border-radius: 20px; -} - -/* b店铺名称 */ -.aname{ - font-size: 15px; - font-weight: bold; - left: 110px; - top: 15px; - position: absolute; - color: black; -} - -/* b店铺图片 */ -.t2 image{ - width: 100px; - height: 100px; - position: absolute; - top:10px; - left:5px; - border-radius: 20px; -} - -/* 可预定小框 */ -.ksm{ - width: 70px; - height: 26px; - position: absolute; - left: 255px; - top: 40px; - border: 1px #4095e5 solid; - border-radius: 10px; -} - -/* 可预定 休息中 小字 */ -.wksm{ - font-size: 12px; - left: 18px; - top: 6px; - position: absolute; - color: #4095e5; -} - -/* 接受预约 */ -.yy1{ - width: 50px; - height: 25px; - position: absolute; - left: 110px; - top: 45px; - background-color: #4095e5; -} -.yy2{ - width: 60px; - height: 25px; - position: absolute; - left: 165px; - top: 45px; - background-color: #ffffff; -} -.yy3{ - width: 10px; - height: 25px; - position: absolute; - left: 230px; - top: 45px; - background-color: #4095e5; -} - -/* 《预约》 */ -.wyy1{ - font-size: 12px; - top:5px; - position: absolute; - color: #ffffff; -} -.wyy2{ - font-size: 12px; - top:5px; - position: absolute; - color: #4095e5; -} - -/* 店铺地点 */ -.wdpdd{ - font-size: 12px; - left: 110px; - top: 85px; - position: absolute; - color: #9b9b9b; -} -/* 弹性盒 */ -.box3{ - display: flex; - flex-wrap: wrap; /* 允许换行 */ - justify-content: space-between; /* 使子元素分布更均匀 */ -} -.container { - display: flex; - flex-direction: row; /* 设为横向排列 */ - align-items: center; /* 纵向居中对齐 */ -} - .box4 { display: inline-flex; width: 160rpx; @@ -211,13 +24,74 @@ box-shadow: -10px 10px 0px rgba(33, 2, 2, 0.1); position: relative; } - .box5 { width: 100%; position: relative; margin-left: 30rpx; - top: 20rpx; + top: 30rpx; } .text3{ color: white; +} +.box6{ + width: 120rpx; + height: 50rpx; + border: 1px solid #4095e5; + border-radius: 50px; + display: flex; + align-items: center; + justify-content: center; + position: relative; + bottom: 300rpx; + left: 530rpx; +} +.dingwei{ + position: relative; + + } +.statues{ + font-size: 13px; + width: 100rpx; + background-color: #4095e5; + margin-top: 20rpx; + margin-left: 10rpx; + color: white; + position: relative; + +} +.text{ + font-weight: bolder; + margin-left: 10rpx; + position: relative; + top: 30rpx; + right: 10rpx; +} +.wenzi{ + width: 65%; + height: 200rpx; + position: relative; + left: 220rpx; + bottom: 180rpx; +} +.image{ + width: 100px; + height: 100px; + border-radius: 20px; + position: relative; + top: 25rpx; + left: 20rpx; +} +.kuang{ + width: 90%; + height: 240rpx; + border: 3px solid #de868f; + border-radius: 20px; + margin-top: 20rpx; +} +.box2{ + display: flex; + justify-content: center; + align-items: center; + margin-top: 20rpx; + flex-direction: column; } \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/shouye/shouye.axml b/甲情_甲意/miniprogram/pages/shouye/shouye.axml index 6670704..018b1c1 100644 --- a/甲情_甲意/miniprogram/pages/shouye/shouye.axml +++ b/甲情_甲意/miniprogram/pages/shouye/shouye.axml @@ -1,62 +1,58 @@ - - - - - - - - + + + + + + + + - - - 上门预约 - - - 到店服务 - - - 发布抢单 - - - 我的预约 - - + + 上门预约 + + + 到店服务 + + + 发布抢单 + + + 我的预约 + - - - 推荐店铺 - - - - {{item.businessName}} - - {{item.businessImages}} + + 推荐店铺 + + + + + + + + {{item.businessName}} + + {{item.businessImages}} + {{item.startBusiness}}营业 - - {{item.startBusiness}}营业 - - - - {{item.address}} - - 已休息 - 可预定 + + {{item.address}} + - - + + 可预约 + 已休息 - \ No newline at end of file + + diff --git a/甲情_甲意/miniprogram/pages/shouye/shouye.js b/甲情_甲意/miniprogram/pages/shouye/shouye.js index 5770c88..2f1f86f 100644 --- a/甲情_甲意/miniprogram/pages/shouye/shouye.js +++ b/甲情_甲意/miniprogram/pages/shouye/shouye.js @@ -67,10 +67,11 @@ Page({ const endBusiness = id.endBusiness const startBusiness = id.startBusiness const storeStatus = id.storeStatus - console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness); + const businessPhone =id.businessPhone + console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness,businessPhone); my.navigateTo({ - url: `/pages/dianpuzhuye/dianpuzhuye?userId=${userId}&&address=${address}&&businessName=${businessName}&&businessAvatar=${businessAvatar}&&startBusiness=${startBusiness}&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}&&id=${ID}`, + url: `/pages/dianpuzhuye/dianpuzhuye?userId=${userId}&&address=${address}&&businessName=${businessName}&&businessAvatar=${businessAvatar}&&startBusiness=${startBusiness}&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}&&id=${ID}&&businessPhone=${businessPhone}`, }); }, shangmen(){ diff --git a/甲情_甲意/miniprogram/pages/test/test.acss b/甲情_甲意/miniprogram/pages/test/test.acss index e69de29..50e696d 100644 --- a/甲情_甲意/miniprogram/pages/test/test.acss +++ b/甲情_甲意/miniprogram/pages/test/test.acss @@ -0,0 +1,223 @@ +.cebian { + width: 20%; + height: 100v; + background-color: #efeced; + overflow: hidden; +} + +.text { + width: 100%; + height: 50px; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + cursor: pointer; +} +.color { + font-size: 14px; + color: rgb(0, 0, 0); /* 默认文字颜色 */ +} +.xian{ + width: 60px; + height: 3px; + background-color: #f2819f; + margin-top: 5rpx; +} +.xinxi{ + width: 80%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + overflow-y: scroll +} +.pages{ + width: 100%; + display: flex; + margin-top: 30rpx; +} +.shop{ + width: 90%; + height:130px; + border: 1px solid #f2819f; + border-radius: 20px; + margin-top: 20rpx; + display: flex; +} +.image{ + width: 100px; + height: 100px; + border-radius: 20px; +} +.imagebox{ + width: 100px; + height: 130px; + display: flex; + align-items: center; + justify-content: center; + margin-left: 10rpx; +} +.dingwei{ + position: relative; +} +.yuyue{ + display: flex; + justify-content: center; + align-items: center; + width: 50px; + height: 20px; + border-radius: 20px; + border: 1px solid #fb96b1; + background-color: #fb96b1; +} +.yuyuekuang{ + width: 100%; + display: flex; + justify-content: space-between; +} +.gouimage{ +width: 20px; +height: 20px; +} +/* 店铺名框 */ +.Box2 +{ + width: 100%; + height: 150px; + background-color: white; + position: relative; + top:30px; + border-radius: 15px; +} +/* 店铺名 */ +.z2{ + font-size: 25px; + font-weight: bolder; + position: relative; +} +.image1{ + width: 80px; + height: 20px; + margin-left: 10rpx; + margin-top: 20rpx; +} +.z3{ + position: relative; + left: 30rpx; + bottom: 8rpx; + color: rgb(194, 53, 53); +} +.z4{ + position: relative; + left: 80rpx; + bottom:10rpx; +} +/* 营业时间 */ +.z6{ + color: #4095E5; + font-weight: bolder; + top:20px; + left: 10px; + position: relative; +} +.z7{ + position: relative; + top:38rpx; + left: 30rpx; + font-size: 13px; +} +.box3{ + width: 100%; + height: 1px; + background-color: darkgrey; +} +/* 地址 */ +.z8{ + font-size: 12px; + margin-left: 10rpx; +} +.image3{ + width: 10px; + height: 12px; + margin-left: 5rpx; +} +.box4{ + width: 100%; + height: 1px; + background-color: darkgrey; + margin-top: 10rpx; +} +.shangimage{ + width: 200rpx; + height: 200rpx; + border-radius: 10%; + margin-left: 20rpx; +} +.box8{ + width: 500rpx; + height: 200rpx; + position: relative; + left: 230rpx; + bottom: 200rpx; +} +.tiao{ + width: 100px; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} +.tiaobox{ + width: 100%; + height: 30px; + display: flex; +} +.pingjia{ + width: 100%; + display: flex; + justify-content: center; + margin-top: 10rpx; +} +.pingjiakuang{ + width: 90%; + border-top: #6e7071 1px solid; + height: auto; +} +.pingjiaimage{ + width: 40px; + height: 40px; + border-radius: 50px; +} +.touxiang{ + width: 100%; + height: 40px; + display: flex; + align-items: center; + margin-top: 10rpx; +} +.kuangimage{ + width: 100px; + height: 100px; + margin:10rpx 10rpx 10rpx 10rpx; + border-radius: 10px; +} +.tupianbox{ + width: 100%; + justify-content: center; +} +.soucangimage{ + width: 30px; + height: 30px; + position: absolute; + right: 80rpx; + top: -40rpx; +} +.zixunimage{ + width: 30px; + height: 30px; + position: absolute; + right: 0rpx; + top: -40rpx; +} \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/test/test.axml b/甲情_甲意/miniprogram/pages/test/test.axml index e69de29..85aa05c 100644 --- a/甲情_甲意/miniprogram/pages/test/test.axml +++ b/甲情_甲意/miniprogram/pages/test/test.axml @@ -0,0 +1,124 @@ + + + + + {{businessName}} + + + 4.9 + 500条 + + + + + + + + + + + + + 已休息 + 营业中 + 营业时间:{{startBusiness}}-{{endBusiness}} + + + + + + + + {{address}} + + + + + + + + {{item.hengname}} + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + {{item.commoditiesName}} + + + 款式随便做,饰品不限量,含甲片,含卸甲 + + + ¥{{item.commoditiesPrice}} + + 预约 + + + + + + + + + + + + + + + 陌路 + + + 颜色:冰透系列裸色01色+烤灯-简约 + + aslkjhdklajshdkalsdhaskljdhaskldhaskhdaksjhdkjsh + + + + + + + + + + + + + + + 店铺名称:{{businessName}} + + + + 联系电话:{{businessPhone}} + + + + 营业时间:{{startBusiness}}-{{endBusiness}} + + + + 店铺地址:{{address}} + + + \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/test/test.js b/甲情_甲意/miniprogram/pages/test/test.js index e69de29..f3b91da 100644 --- a/甲情_甲意/miniprogram/pages/test/test.js +++ b/甲情_甲意/miniprogram/pages/test/test.js @@ -0,0 +1,286 @@ +import{url} from '../request' +Page({ + data: { + lie: [ + { id: 1, name: '推荐款式', showLine: true }, + { id: 2, name: '中长款', showLine: false }, + { id: 3, name: '本甲款', showLine: false }, + { id: 4, name: '长款', showLine: false }, + { id: 5, name: '短款', showLine: false }, + ], + names:[ + { id:1, hengname:'款式分类',line:true}, + {id:2,hengname:'评价',line:false}, + {id:3,hengname:'商家',line:false}, + ], + userId: '', + address: '', + businessName:'', + businessAvatar:'', + startBusiness:'', + endBusiness:'', + storeStatus:'', + businessId: '', + commoditiesGroupId: 0, + commoditiesName: "", + current: 0, + pageSize: 0, + sortField: "", + sortOrder: "", + status: "", + tuijian:[], + meijiashi:[], + email: "", + gender: 0, + manicuristAvatar: "", + manicuristName: "", + phone: "", + rating: 0, + specialties: "", + id:'', + filteredShopping: [], + showShoppingCart: true, // 控制购物车部分是否显示 + showComments: false, // 控制评论部分是否显示 + showBusinessInfo: false, // 控制商家信息是否显示 + }, + onLoad(options) { + // Extract userId and address from options + const userId = options.userId; + const address = options.address; + const businessName = options.businessName; + const businessAvatar = options.businessAvatar; + const startBusiness = options.startBusiness; + const endBusiness = options.endBusiness; + const storeStatus = options.storeStatus; + const id = options.id + const businessPhone = options.businessPhone + console.log(id,'zheyedesaksdas'); + // Set them in data for use in the page + this.setData({ + userId: userId, + address: address, + businessName:businessName, + businessAvatar:businessAvatar, + endBusiness:endBusiness, + startBusiness:startBusiness, + storeStatus:storeStatus, + id:id, + businessPhone:businessPhone, + }); + my.request({ + url: url + '/api/commodities/list/page/commodities', + method: 'POST', + data: { + businessId: id, + commoditiesGroupId: id, + commoditiesName: "", + current: 0, + pageSize: 2, + sortField: "", + sortOrder: "", + status: "", + }, + headers: { + 'content-type': 'application/json', + }, + dataType: 'json', + success: (res) => { + console.log(id,'这是onload'); + console.log('Request succeeded:', res); + if (res.data && res.data.data) { + this.setData({ + tuijian: res.data.data.records, // 更新 tuijian 列表 + }); + this.chushihua(); + console.log(this.data.tuijian,'这是推荐'); + } else { + console.log('shibaile') + } + }, + fail: (error) => { + console.error('Request failed', error); + } + }); + + }, + soucang() { + my.getStorage({ + key: 'userInfo', + success: (res) => { + const userInfo = res.data; + const businessId = this.data.id; // 获取 onLoad 中保存的 id + + if (userInfo && userInfo.cookie) { + my.request({ + url: url + '/api/collect/add', + method: 'POST', + data: { + businessId: businessId // 使用 businessId 来请求收藏 + }, + headers: { + 'content-type': 'application/json', + 'Cookie': userInfo.cookie, + }, + dataType: 'json', + success: (res) => { + if(res.data.code===0){ + my.alert({ + content: '收藏成功' + }); + } + else if(res.data.code===40100){ + my.alert({ + content: '登录信息已过期,请重新登录' + }); + my.navigateTo({ + url:'/pages/denglu/denglu' + }) + }else{ + my.alert({ + content: '店铺已收藏' + }); + } + }, + fail: (error) => { + console.error('请求失败: ', JSON.stringify(error)); + my.alert({ content: '请求失败,请稍后重试' }); + }, + }); + } else { + my.alert({ + content: '您未登录,请先登录。', + success: () => { + my.navigateTo({ + url: '/pages/denglu/denglu', + }); + }, + }); + } + }, + }); + }, + + // meijiahsi(){ + // my.request({ + // url: url + '/api/manicurist/userQueryAll', + // method: 'GET', + // data: { + // businessId: this.data.id + // }, + // headers: { + // 'content-type': 'application/json', + // }, + // dataType: 'json', + // success: (res) => { + // console.log('Request succeeded:', res); + // if (res.data && res.data.data) { + // this.setData({ + // meijiashi: res.data.data, // 更新 tuijian 列表 + // }); + // } else { + // console.log('shibaile') + // } + // }, + // fail: (error) => { + // console.error('Request failed', error); + // } + // }); + // }, + pingjia(){ + my.navigateTo({ + url:'/pages/shangpinpingjia/shangpinpingjia' + }) + }, + zixun(){ + my.navigateTo({ + url:'/pages/zixunmeijiashi/zixunmeijiashi' + }) + }, + shangpinjiemian(item){ + const id = item.target.dataset.num + console.log('传递的数据:', id); + const ids = id.id + const commoditiesPrice = id.commoditiesPrice + const commoditiesName = id.commoditiesName + const commoditiesImage = id.commoditiesImage + const businessId = id.businessId + console.log('Address being passed: ',id,commoditiesPrice,commoditiesName,commoditiesImage,businessId); + my.navigateTo({ + url:`/pages/shangpinjiemian/shangpinjiemian?commoditiesPrice=${commoditiesPrice}&&commoditiesName=${commoditiesName}&&commoditiesImage=${commoditiesImage}&&ids=${ids}&&businessId=${businessId}` + }) + console.log(ids,businessId,commoditiesImage,commoditiesName,commoditiesPrice+'这是商品的') + }, + // 点击事件处理函数 +selectItem(e) { + const id = e.currentTarget.dataset.id; + console.log(id); + // 更新对应的 showLine 状态,控制是否显示线条 + const updatedLie = this.data.lie.map(item => { + if (item.id === id) { + item.showLine = !item.showLine; // 切换显示状态 + } else { + item.showLine = false; // 其他项隐藏 + } + return item; + }); + + // 根据点击的类别 id 筛选对应的商品 + const filteredShopping = this.data.tuijian.filter(item => String(item.commoditiesGroupId) === String(id)); + + // 更新数据 + this.setData({ + lie: updatedLie, + filteredShopping, // 更新右侧商品列表 + showShoppingCart: true, // 显示购物车部分 + showComments: false, // 隐藏评论部分 + showBusinessInfo: false, // 隐藏商家信息部分 + }); + console.log(this.data.filteredShopping,'hhhhhhhhhhhhhh'); +}, +chushihua(){ + this.setData({ + filteredShopping: this.data.tuijian.filter(item => String(item.commoditiesGroupId) === "1"), // 默认选中类别 1 + }) + console.log(this.data.filteredShopping,'chushi'); +}, +chaxunzhuangtai(e) { + const id = e.currentTarget.dataset.id; + console.log(id); + + // 更新对应的 line 状态,控制是否显示线条 + const updatednames = this.data.names.map(item => { + if (item.id === id) { + item.line = !item.line; // 切换显示状态 + } else { + item.line = false; // 其他项隐藏 + } + return item; + }); + + this.setData({ + names: updatednames, + }); + + // 根据点击的分类切换显示内容 + if (id === 1) { + this.setData({ + showShoppingCart: true, // 显示购物车 + showComments: false, // 隐藏评论 + showBusinessInfo: false, // 隐藏商家信息 + }); + } else if (id === 2) { + this.setData({ + showShoppingCart: false, // 隐藏购物车 + showComments: true, // 显示评论 + showBusinessInfo: false, // 隐藏商家信息 + }); + } else if (id === 3) { + this.setData({ + showShoppingCart: false, // 隐藏购物车 + showComments: false, // 隐藏评论 + showBusinessInfo: true, // 显示商家信息 + }); + } +}, +}); + diff --git a/甲情_甲意/miniprogram/pages/test/test.json b/甲情_甲意/miniprogram/pages/test/test.json index a8dbd4b..8f1692e 100644 --- a/甲情_甲意/miniprogram/pages/test/test.json +++ b/甲情_甲意/miniprogram/pages/test/test.json @@ -1,11 +1,7 @@ { "defaultTitle": "", "usingComponents": { - "ant-checkbox": "antd-mini/es/Checkbox/index", - "stepper": "antd-mini/es/Stepper/index", - "ant-checkbox-group": "antd-mini/es/Checkbox/CheckboxGroup/index", - "ant-swipe-action": "antd-mini/es/SwipeAction/index", - "ant-stepper": "antd-mini/es/Stepper/index" + }, "styleIsolation": "apply-shared" } diff --git a/甲情_甲意/miniprogram/pages/test1/test1.acss b/甲情_甲意/miniprogram/pages/test1/test1.acss index cf57c75..96b3b14 100644 --- a/甲情_甲意/miniprogram/pages/test1/test1.acss +++ b/甲情_甲意/miniprogram/pages/test1/test1.acss @@ -1,97 +1,97 @@ -.box { - width: 100vw; - min-height: 100vh; /* 确保容器至少占满屏幕的高度 */ - background-color: #eec2c7; - overflow-y: auto; /* 允许竖直方向滚动 */ - width: 100vw; /* 或者 750rpx */ - height: auto; - overflow:hidden; /* 防止溢出 */ -} - -.box3 { - display: flex; - flex-direction: column; - background-color: rgba(252, 240, 240, 0.807); - border-radius: 20px; - padding: 10px; - margin-bottom: 80px; /* 留出一些空间给底部结算栏 */ -} - -.box1 { +.k1{ width: 100%; - height: 170px; - display: flex; - flex-direction: row; -} + height: 60px; + background-color: #efaab1b7; + margin-top: 70rpx; -.image { - width: 120px; - height: 120px; - border-radius: 10px; +} +.z1{ + font-size: 25px; + font-weight: bolder; position: relative; - left: 20px; - top: 20px; + color: #ffffff; + top:15px; + left:20px; } - .box4 { + display: inline-flex; + width: 160rpx; + height: 160rpx; + background-color: pink; + border-radius: 10%; + justify-content: center; + align-items: center; + box-shadow: -10px 10px 0px rgba(33, 2, 2, 0.1); position: relative; - top: 80px; - left: 10px; - width: 25px; - height: 25px; } - .box5 { - height: 50px; + width: 100%; position: relative; - left: 40px; - top:30px; + margin-left: 30rpx; + top: 30rpx; } - -.text { - padding: 5px; +.text3{ + color: white; } - -.container { - position: relative; - left: 85px; - top: 25px; -} - -.boxd { - width: 100px; - height: 40px; - position: absolute; - border-radius: 30px; - background-color: rgb(162, 12, 12); - left: 570rpx; +.box6{ + width: 120rpx; + height: 50rpx; + border: 1px solid #4095e5; + border-radius: 50px; display: flex; align-items: center; justify-content: center; -} - -.text1 { - color: #ffffff; - position: unset; -} - -.boxall { - display: flex; - align-items: center; - padding: 10px; - position: fixed; - bottom: 0; - left: 0; - width: 100%; - background-color: #fff; - box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1); -} -.text2 { position: relative; - left: 185rpx; + bottom: 300rpx; + left: 530rpx; } -.text3{ - height: 20px; - position: absolute; - left: 650rpx; +.dingwei{ + position: relative; + + } +.statues{ + font-size: 13px; + width: 100rpx; + background-color: #4095e5; + margin-top: 20rpx; + margin-left: 10rpx; + color: white; + position: relative; + } +.text{ + font-weight: bolder; + margin-left: 10rpx; + position: relative; + top: 30rpx; + right: 10rpx; +} +.wenzi{ + width: 65%; + height: 200rpx; + position: relative; + left: 220rpx; + bottom: 180rpx; +} +.image{ + width: 100px; + height: 100px; + border-radius: 20px; + position: relative; + top: 25rpx; + left: 20rpx; +} +.kuang{ + width: 90%; + height: 240rpx; + border: 3px solid #de868f; + border-radius: 20px; + margin-top: 20rpx; +} +.box2{ + display: flex; + justify-content: center; + align-items: center; + margin-top: 20rpx; + flex-direction: column; +} \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/test1/test1.axml b/甲情_甲意/miniprogram/pages/test1/test1.axml index 1b9f14b..018b1c1 100644 --- a/甲情_甲意/miniprogram/pages/test1/test1.axml +++ b/甲情_甲意/miniprogram/pages/test1/test1.axml @@ -1,48 +1,58 @@ - - - - - - - - - - - - {{item.commoditiesName}} - - - ¥{{item.commoditiesPrice}} - - - - - - 移除购物车 - - - - - - - - + + - 全选 - - 合计:¥{{totalPrice}} - - 结算 + + + + + + + + + 上门预约 + + + 到店服务 + + + 发布抢单 + + + 我的预约 + + + + + 推荐店铺 + + + + + + + + {{item.businessName}} + + {{item.businessImages}} + {{item.startBusiness}}营业 + + + {{item.address}} + + + + 可预约 + 已休息 + diff --git a/甲情_甲意/miniprogram/pages/test1/test1.js b/甲情_甲意/miniprogram/pages/test1/test1.js index 12de1e8..c9e6ba3 100644 --- a/甲情_甲意/miniprogram/pages/test1/test1.js +++ b/甲情_甲意/miniprogram/pages/test1/test1.js @@ -1,217 +1,98 @@ -import {url} from '../request' +import {url} from '../request'; Page({ data: { - id: '', - productList: [], // 商品列表 - selectedItems: [], // 每个商品的选中状态 - totalPrice: 0, // 总价 - checkAll: false, // 全选标志 - hhh:[] - }, - - onShow() { - my.getStorage({ - key: 'userInfo', - success: (res) => { - const userInfo = res.data; - this.setData({ - id: userInfo.id, // 获取 id - }); - - if (userInfo && userInfo.cookie) { - my.request({ - url: url + '/api/cart/selectByUserId', - method: 'POST', - data: { - id: this.data.id - }, - headers: { - 'content-type': 'application/json', - 'Cookie': userInfo.cookie, - }, - dataType: 'json', - success: (res) => { - console.log(res); - if (res.data.code === 0) { - const cartItems = res.data.data; - this.fetchProductDetails(cartItems); - } - }, - fail: (error) => { - console.error('请求失败: ', JSON.stringify(error)); - my.alert({ content: '请求失败,请稍后重试' }); - }, - }); - } else { - my.alert({ - content: '您未登录,请先登录。', - success: () => { - my.navigateTo({ - url: '/pages/denglu/denglu', - }); - }, - }); + background: [ + {image:"../image/meijia1.jpg"}, + {image:"../image/meijia2.jpg"} + ], + indicatorDots: true, + autoplay: true, + vertical: false, + interval: 1000, + circular: false, + duration: 1500, + tuijian:[], + address: "", + businessAvatar: "", + businessImages: "", + businessName: "", + businessPhone: "", + businessProfile: "", + categoryId: 0, + createTime: "", + endBusiness: "", + id: 0, + isDelete: 0, + startBusiness: "", + state: 0, + storeStatus: '', + updateTime: "", + userId: 0 + }, + onLoad() { + my.request({ + url: url + '/api/business/list', + method: 'POST', + data: { + + }, + headers: { + 'content-type': 'application/json', + }, + dataType: 'json', + success: (res) => { + console.log('Request succeeded:', res); + if (res.data && res.data.data) { + this.setData({ + tuijian: res.data.data, // 更新 tuijian 列表 + }); + } else { + console.log('shibaile') + } + }, + fail: (error) => { + console.error('Request failed', error); } - }, - }); - }, - - // 获取商品详细信息 - fetchProductDetails(cartItems, userId) { - console.log(cartItems, 'zheshiid'); - const promises = cartItems.map((item) => { - return new Promise((resolve, reject) => { - my.request({ - url: url + '/api/commodities/getById/commodities', - method: 'GET', - data: { id: item.commoditiesId }, - headers: { 'content-type': 'application/json' }, - success: (res) => { - if (res.data.code === 0) { - const productData = res.data.data; - productData.userId = userId; // 添加 userId - productData.cartId = item.id; // 将 cartId 添加到商品数据中 - resolve(productData); - } else { - reject(`商品信息获取失败: ${res.data.message}`); - } - }, - fail: (error) => { - reject(error); - }, - }); }); - }); - - Promise.all(promises) - .then((productList) => { - this.setData({ - productList, - selectedItems: new Array(productList.length).fill(false), // 初始化所有商品的选中状态为 false - }); - console.log(productList, '这是商品'); + }, + dianpu(item) { + const id = item.target.dataset.num + // console.log('传递的数据:', id); + const ID = id.id + console.log(ID); + const userId = id.userId + const address = id.address + const businessName = id.businessName + const businessAvatar = id.businessAvatar + const endBusiness = id.endBusiness + const startBusiness = id.startBusiness + const storeStatus = id.storeStatus + const businessPhone =id.businessPhone + console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness,businessPhone); + + my.navigateTo({ + url: `/pages/test/test?userId=${userId}&&address=${address}&&businessName=${businessName}&&businessAvatar=${businessAvatar}&&startBusiness=${startBusiness}&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}&&id=${ID}&&businessPhone=${businessPhone}`, + }); + }, + shangmen(){ + my.navigateTo({ + url:'/pages/shangmenyuyue/shangmenyuyue' + }) + }, + daodian(){ + my.navigateTo({ + url:'/pages/daodianfuwu/daodianfuwu' + }) + }, + qiangdan(){ + my.navigateTo({ + url:'/pages/kehushangmenyuyueqiangdan/kehushangmenyuyueqiangdan' + }) + }, + yuyue(){ + my.navigateTo({ + url:'/pages/wodeyuyue/wodeyuyue' }) - .catch((error) => { - console.error('商品信息获取失败: ', error); - my.alert({ content: '商品信息获取失败,请稍后重试' }); - }); - }, - - - // 计算 checkAll 是否选中 - checkAll() { - return this.data.selectedItems.every(item => item); // 如果所有项都选中,返回 true - }, - - // 处理单个复选框的选中状态变化 - onChange(event) { - const selectedItems = event.detail.value; // 获取选中的商品ID列表 - const updatedSelectedItems = this.data.productList.map((item, index) => { - return selectedItems.includes(item.id); // 更新每个商品的选中状态 - }); - this.setData({ - selectedItems: updatedSelectedItems - }); - }, - - // 处理全选框的选中状态变化 - onCheckAllChange(event) { - const allSelected = event.detail.value; // 获取全选框的状态 - const updatedSelectedItems = this.data.productList.map(() => allSelected); // 全选或全不选 - this.setData({ - selectedItems: updatedSelectedItems - }); - }, - - // 计算合计 - calculateTotalPrice() { - const total = this.data.productList.reduce((sum, item, index) => { - if (this.data.selectedItems[index]) { - sum += item.commoditiesPrice; // 累加选中商品的价格 - } - return sum; - }, 0); - this.setData({ - totalPrice: total.toFixed(2) // 保留两位小数 - }); - }, - - // 处理移除商品 - yichu(e) { - const cartId = e.currentTarget.dataset.id; // 获取商品的 cartId - if (!cartId) { - console.error('没有找到商品cartId'); - my.alert({ content: '商品ID未找到,请稍后重试' }); - return; } - - console.log('需要移除的商品cartId:', cartId); - - my.getStorage({ - key: 'userInfo', - success: (res) => { - const userInfo = res.data; - this.setData({ - id: userInfo.id, // 获取 id - }); - // 发送请求移除商品 - if (userInfo && userInfo.cookie) { - my.request({ - url: url + '/api/cart/delete', - method: 'POST', - data: { id: cartId }, // 使用 cartId 作为参数 - headers: { 'content-type': 'application/json', 'Cookie': userInfo.cookie }, - dataType: 'json', - success: (res) => { - console.log(res); - if (res.data.code === 0) { - my.alert({ content: '成功移除商品' }); - console.log(res); - // 更新购物车 - this.updateCartList(); - } else { - my.alert({ content: '移除商品失败,请稍后重试' }); - console.log(res); - } - }, - fail: (error) => { - console.error('请求失败: ', JSON.stringify(error)); - my.alert({ content: '请求失败,请稍后重试' }); - }, - }); - } - }, - }); - }, - // 移除后更新 - updateCartList() { - my.getStorage({ - key: 'userInfo', - success: (res) => { - const userInfo = res.data; - - if (userInfo && userInfo.cookie) { - my.request({ - url: url + '/api/cart/selectByUserId', // 获取最新的购物车数据 - method: 'POST', - data: { id: this.data.id }, // 使用当前用户ID - headers: { 'content-type': 'application/json', 'Cookie': userInfo.cookie }, - dataType: 'json', - success: (res) => { - if (res.data.code === 0) { - const cartItems = res.data.data; - this.fetchProductDetails(cartItems, userInfo.id); - } else { - my.alert({ content: '获取购物车数据失败,请稍后重试' }); - } - }, - fail: (error) => { - console.error('请求失败: ', JSON.stringify(error)); - my.alert({ content: '请求失败,请稍后重试' }); - }, - }); - } - }, - }); - }, -}); \ No newline at end of file + + }) diff --git a/甲情_甲意/miniprogram/pages/test1/test1.json b/甲情_甲意/miniprogram/pages/test1/test1.json index 4ad1c8e..ac7c59d 100644 --- a/甲情_甲意/miniprogram/pages/test1/test1.json +++ b/甲情_甲意/miniprogram/pages/test1/test1.json @@ -1,10 +1,5 @@ { "usingComponents": { - "ant-checkbox": "antd-mini/es/Checkbox/index", - "stepper": "antd-mini/es/Stepper/index", - "ant-checkbox-group": "antd-mini/es/Checkbox/CheckboxGroup/index", - "ant-swipe-action": "antd-mini/es/SwipeAction/index", - "ant-stepper": "antd-mini/es/Stepper/index" }, "styleIsolation": "apply-shared" } diff --git a/甲情_甲意/miniprogram/pages/wode/wode.axml b/甲情_甲意/miniprogram/pages/wode/wode.axml index 1e8e0b7..8c4c95e 100644 --- a/甲情_甲意/miniprogram/pages/wode/wode.axml +++ b/甲情_甲意/miniprogram/pages/wode/wode.axml @@ -19,12 +19,6 @@ 我的评价 - - @@ -44,7 +38,7 @@ 认证美甲师 - + 退出登录 diff --git a/甲情_甲意/miniprogram/pages/wode/wode.js b/甲情_甲意/miniprogram/pages/wode/wode.js index c2a5aff..5f69570 100644 --- a/甲情_甲意/miniprogram/pages/wode/wode.js +++ b/甲情_甲意/miniprogram/pages/wode/wode.js @@ -7,22 +7,24 @@ Page({ onShow() { my.getStorage({ key: 'userInfo', - success: (res)=> { + success: (res) => { // 成功获取到用户信息 const userInfo = res.data; console.log('用户信息:', userInfo); - - // 可以直接使用 username 和 avatarUrl - this.setData({ - username: userInfo.username, // 设置用户名 - avatarUrl: userInfo.avatarUrl, // 设置头像链接 - }); - console.log('用户名:', username); - console.log('头像链接:', avatarUrl); + if(userInfo){ + this.setData({ + username: userInfo.username, + avatarUrl: userInfo.avatarUrl, + }); + }else{ + this.setData({ + username: '请登录', + avatarUrl: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.jHUH4s7TQ48X_B-1iozuJgHaHa?w=207&h=207&c=7&r=0&o=5&dpr=1.5&pid=1.7', + }); + } }, - fail: function(err) { - // 如果没有存储的 userInfo,说明用户可能未登录 - console.error('获取用户信息失败:', err); + fail: (err) => { + console.log('获取用户信息失败:', err); } }); }, @@ -63,4 +65,24 @@ Page({ url: '/pages/meijiashirenzheng/meijiashirenzheng' }); }, + out(){ + my.removeStorage({ + key: 'userInfo', + success: () => { + console.log('用户已退出登录,缓存已清除'); + + // 清除缓存后更新页面为默认信息 + this.setData({ + username: '请登录', + avatarUrl: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.jHUH4s7TQ48X_B-1iozuJgHaHa?w=207&h=207&c=7&r=0&o=5&dpr=1.5&pid=1.7', + }); + my.alert({ + content:'您已退出登录' + }) + }, + fail: (err) => { + console.error('退出登录失败:', err); + } + }); + }, }); diff --git a/甲情_甲意/miniprogram/pages/wode/wode.json b/甲情_甲意/miniprogram/pages/wode/wode.json index 208219e..e5dfa05 100644 --- a/甲情_甲意/miniprogram/pages/wode/wode.json +++ b/甲情_甲意/miniprogram/pages/wode/wode.json @@ -1,5 +1,7 @@ { "defaultTitle": "我的", - "usingComponents": {}, + "usingComponents": { + "ant-button": "antd-mini/es/Button/index" + }, "styleIsolation": "apply-shared" } diff --git a/甲情_甲意/miniprogram/pages/wodedingdan/wodedingdan.js b/甲情_甲意/miniprogram/pages/wodedingdan/wodedingdan.js index c2002e0..b81c213 100644 --- a/甲情_甲意/miniprogram/pages/wodedingdan/wodedingdan.js +++ b/甲情_甲意/miniprogram/pages/wodedingdan/wodedingdan.js @@ -63,24 +63,30 @@ Page({ }, dataType: 'json', success: (res) => { - if(res.data&&res.data.data){ + if(res.data.code===0){ this.setData({ dingdan:res.data.data.records, }) } - console.log('Response Set-Cookie:', res.header['Set-Cookie']); - + else if(res.data.code===40100){ + my.alert({ + content: '登录信息已过期,请重新登录' + }); + my.navigateTo({ + url:'/pages/denglu/denglu' + }) + } console.log(res); console.log(this.data.dingdan); - console.log(this.data.dingdan); }, fail: (error) => { console.error('请求失败: ', JSON.stringify(error)); my.alert({ content: '请求失败,请稍后重试' }); }, }); - } else { + } + else { my.alert({ content: '您未登录,请先登录。', success: () => { diff --git a/甲情_甲意/miniprogram/pages/wodeshoucang/wodeshoucang.js b/甲情_甲意/miniprogram/pages/wodeshoucang/wodeshoucang.js index 265f1fe..f5fa5ae 100644 --- a/甲情_甲意/miniprogram/pages/wodeshoucang/wodeshoucang.js +++ b/甲情_甲意/miniprogram/pages/wodeshoucang/wodeshoucang.js @@ -41,21 +41,24 @@ Page({ dataType: 'json', success: (res) => { console.log(res); - const soucang = res.data.data || []; + if(res.data.code===0){ + const soucang = res.data.data || []; this.setData({ soucang }); - // 从返回的 data 数组中提取 id 并存储到 collectedData 中 const collectedIds = soucang.map(item => item.id); // 提取 id this.setData({ - collectedData: collectedIds // 存储 id + collectedData: collectedIds // 存储id }); - - // 你可以在这里继续调用其他函数,进行数据处理或页面渲染 this.fetchCollectedData(soucang); - }, - fail: (error) => { - console.error('请求失败: ', JSON.stringify(error)); - my.alert({ content: '请求失败,请稍后重试' }); + }else if(res.data.code===40100){ + my.alert({ + content: '登录信息已过期,请重新登录' + }); + my.navigateTo({ + url:'/pages/denglu/denglu' + }) + } + }, }); } else { @@ -94,7 +97,8 @@ Page({ businessId: item.id, // 添加 businessId data: res.data.data, // 返回请求结果的数据 }); - } else { + } + else { reject('请求数据为空'); } }, diff --git a/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.acss b/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.acss index 842d943..0060c2f 100644 --- a/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.acss +++ b/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.acss @@ -1,170 +1,61 @@ -/* 顶部 */ -.Box{ - width: 100%; - height: 800px; +.all{ + width: 100%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; } -.Box1{ - width: 100%; - height: 50px; - background-color: #eec2c7; -} -.t1{ - font-weight: bolder; - top:10px; - left:170px; - position: absolute; -} -/* 商品信息 */ -.Box2{ - width: 100%; - height: 710px; - background-color: darkgray; - position: absolute; - border-radius: 10px; - top:40px; -} -.box1{ - width: 388px; - height: 708px; - background-color: #ffffff; - position: absolute; - border-radius: 10px; - top:1px; -} -.z1{ - position: absolute; - top:10px; - left: 100px; -} -.z2{ - position: absolute; - top:40px; - left: 100px; - font-weight: bolder; -} -/* 减号 */ -.box2 image{ - width: 20px; - height: 20px; - position: absolute; - top:42px; - left: 290px; -} -.z3{ - font-size: 15px; - position: absolute; - top:45px; - left: 320px; -} -/* 加号 */ -.box3 image{ - width: 20px; - height: 20px; - position: absolute; - top:44px; - left: 335px; -} -/* 美甲图 */ -.box1 image{ - width: 70px; - height: 70px; - position: absolute; - top:10px; - left: 10px; - border-radius: 10px; -} -/* 价格框 */ -.Box3{ +.box{ width: 90%; - height: 160px; - background-color: darkgrey; - top:90px; - position: absolute; - left: 20px; + height: 180px; + display: flex; + border: 1px solid #9fa1a3; + border-radius: 20px; + margin-top: 20rpx; + flex-direction: column; + overflow: hidden; +} +.image{ + width: 80px; + height: 80px; border-radius: 10px; } -.Box4{ - width: 348px; - height: 158px; - background-color: #ffffff; - top:1px; - left: 1px; - position: absolute; - border-radius: 10px; +.xinxi{ + width: 100%; + height: 100px; + display: flex; + margin-left: 20rpx } -/* 内容1 */ -.t1{ - top:15px; - left: 20px; - position: absolute; +.juzhong{ + display:flex; + align-items:center } -.t2{ - top:15px; - left: 80px; - position: absolute; +.biaoti{ + width: 249px; + margin-left: 10rpx; } -.t3{ - top:15px; - left: 280px; - position: absolute; - font-weight: bolder; +.text{ + font-size: 18px; + font-weight: bold; } -.box4{ - width: 340px; +.form{ + width: 100%; + height: 200px; +} +.xian{ + width: 100%; height: 1px; - background-color: darkgray; - position:absolute; - top:50px; - left: 5px; + background-color: #9fa1a3; + } -/* 内容2 */ -.t4{ - top:65px; - left: 20px; - position: absolute; -} -.t5{ - top:68px; - left: 280px; - position: absolute; - font-size: 13px; - color: darkgrey; -} -.box5{ - width: 340px; - height: 1px; - background-color: darkgray; - position:absolute; - top:100px; - left: 5px; -} -/* 内容3 */ -.t6{ - top:120px; - left: 250px; - position: absolute; -} -.t7{ - top:120px; - left: 280px; - position: absolute; - color: rgb(176, 31, 31); - position: absolute; - font-weight: bolder; -} -/* 支付按钮 */ -.Box5{ - width: 360px; - height: 40px; - position: absolute; - top:650px; - background-color: #eec2c7; - left: 20px; - border-radius: 10px; -} -.t8{ - position:absolute; - top:10px; - left: 140px; - font-weight: bolder; +.zhifu{ + display: flex; + justify-content: center; + align-items: center; + width: 90%; + height: 50px; + background-color: #ee8d97; + border-radius: 40px; + position: fixed; + bottom: 40rpx; } \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.axml b/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.axml index cba5fcb..730dff3 100644 --- a/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.axml +++ b/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.axml @@ -1,44 +1,37 @@ - - - - 确认订单 - - - - - - - 【半贴短甲彩绘款】(饰品免费) - ¥59.90 - - - - - 商品总价 - (共1件) - ¥59.90 - - - 蚂蚁积分 - 暂不可用 - - - 小计 - ¥59.90 + + + + + + + + + + {{item.commoditiesName}} + + ¥{{item.commoditiesPrice*item.quantity}} + + + 共{{item.quantity}}件 + + + + + + + + 商品总价 + ¥{{item.commoditiesPrice*item.quantity}} + + + + 蚂蚁积分 + 暂不可用 + + - - - - - - - - 1 - - - - - 立即支付 + + 支付 ¥{{prices}} \ No newline at end of file diff --git a/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.js b/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.js index cb73536..90bdf53 100644 --- a/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.js +++ b/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.js @@ -1,4 +1,16 @@ Page({ - data: {}, - onLoad() {}, + data:{ + dingdan:[], + prices:'', + }, + onLoad(options) { + const arrStr = decodeURIComponent(options.products); + const arr = JSON.parse(arrStr); + const prices = decodeURIComponent(options.prices); + console.log(arr,'传过来的'); + this.setData({ + dingdan:arr, + prices:prices + }) + }, }); diff --git a/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.json b/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.json index 89bb81c..b0669d3 100644 --- a/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.json +++ b/甲情_甲意/miniprogram/pages/zhifujiemian/zhifujiemian.json @@ -1,4 +1,5 @@ { + "defaultTitle": "支付界面", "usingComponents": {}, "styleIsolation": "apply-shared" }