commit b3b4d4dae798739766e00673233fc331d3c16483 Author: zhangjing Date: Wed Jun 21 17:14:39 2023 +0800 [水感应客户端最新] diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a70bc78 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/unpackage +/node_modules diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..018d5fa --- /dev/null +++ b/README.MD @@ -0,0 +1 @@ +# 水感应用户端小程序 diff --git a/api/err.js b/api/err.js new file mode 100644 index 0000000..667fb74 --- /dev/null +++ b/api/err.js @@ -0,0 +1,49 @@ + +/** + * 处理错误信息 + * @property {Object} errInfo + */ + +const errInfo = (obj) =>{ + if(obj.status_code == 401){ + // 清理客户端登录缓存 + // wx.removeStorageSync("") + wx.removeStorage({ + key : "token", + success: () => { + wx.navigateTo({ + url: "/pages/login/index", + }) + } + }) + }else if(obj.status_code == 422){ + wx.showToast({ + title: obj.message, + icon : "none" + }) + }else if(obj.status_code == 400 || obj.status_code == 0){ + wx.showToast({ + title: obj.message, + icon : "none" + }) + }else if(obj.status_code == 404){ + wx.showToast({ + title: "接口地址不存在,请联系系统管理员", + icon : "none" + }) + }else if(obj.status_code == 500){ + wx.showToast({ + title: "服务端:" + obj.message, + icon : "none" + }) + }else { + wx.showToast({ + title: "code:" + obj.status_code + ", msg:" + obj.message, + icon : "none" + }) + } +} + +module.exports = { + errInfo +} diff --git a/api/index.js b/api/index.js new file mode 100644 index 0000000..2d57142 --- /dev/null +++ b/api/index.js @@ -0,0 +1,39 @@ +/* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +// 授权登录 +import auth from "./interfaces/auth" + +// 图片上传 +import file from "./interfaces/file" + +// 皮肤健康知识 +import health from "./interfaces/health" + +// 首页 +import index from "./interfaces/index" + +// 产品 +import mall from "./interfaces/mall" + +// 订单 +import order from "./interfaces/order" + +// 地址管理 +import site from "./interfaces/site" + +// 个人中心 +import user from "./interfaces/user" + +export default { + auth, + file, + health, + index, + mall, + order, + site, + user +} \ No newline at end of file diff --git a/api/interfaces/auth.js b/api/interfaces/auth.js new file mode 100644 index 0000000..b446f68 --- /dev/null +++ b/api/interfaces/auth.js @@ -0,0 +1,38 @@ +/* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req } from "../request" + +//验证码登录 +const login = data => req({ + url: "user/socialite/login/wechat/mini", + method: "POST", + data: data +}) + +//获取openid +const codeOpenid = data => req({ + url: "user/auth/mini_openid", + data: data +}) + +//更新基本信息 +const userAdd = data => req({ + url: "user/setting/update_info", + method: "POST", + data: data +}) + +//隐私+协议 +const registeragree = (website) => req({ + url: "cms/pages/" + website +}) + +export default ({ + login, + codeOpenid, + userAdd, + registeragree +}) \ No newline at end of file diff --git a/api/interfaces/file.js b/api/interfaces/file.js new file mode 100644 index 0000000..fac4898 --- /dev/null +++ b/api/interfaces/file.js @@ -0,0 +1,17 @@ +/* + * 图图片上传公用接口 +*/ +import { upload } from "../request" + +//图上传 +const uploadImg = (imgPaht, data) => upload({ + url: "storage/upload", + method: "POST", + key: "upload", + path: imgPaht, + data: data +}) + +export default ({ + uploadImg +}) \ No newline at end of file diff --git a/api/interfaces/health.js b/api/interfaces/health.js new file mode 100644 index 0000000..858313f --- /dev/null +++ b/api/interfaces/health.js @@ -0,0 +1,68 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req } from "../request" + +// 健康分类 +const healthNav = () => req({ + url: "cms/categories" +}) + +// 健康列表 +const healthList = data => req({ + url: "cms/articles", + data: data +}) + +// 健康详情 +const healthSee = (article_id) => req({ + url: "cms/articles/" + article_id +}) + +// 健康收藏 +const favorite = (article_id) => req({ + url: "cms/articles/favorite/" + article_id +}) + +// 健康点赞 +const subscribe = (article_id) => req({ + url: "cms/articles/subscribe/" + article_id +}) + +// 我的-健康收藏 +const myFavorite = data => req({ + url: "user/favorites", + data: data +}) + +// 我的-健康点赞 +const mySubscribe = data => req({ + url: "user/subscriptions", + data: data + +}) + +// 我的-检测结果列表 +const aiList = data => req({ + url: "ai/images", + data: data +}) + +// 我的-检测结果 +const aiSee = (image_id) => req({ + url: "ai/images/" + image_id +}) + +export default ({ + healthNav, + healthList, + healthSee, + favorite, + subscribe, + myFavorite, + mySubscribe, + aiList, + aiSee +}) \ No newline at end of file diff --git a/api/interfaces/index.js b/api/interfaces/index.js new file mode 100644 index 0000000..67783dc --- /dev/null +++ b/api/interfaces/index.js @@ -0,0 +1,41 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req, upload } from "../request" + +// 是否可以检测 +const analyze = () => req({ + url: "ai/skin/analyze" +}) + +// 创建检测订单 +const skinOrder = () => req({ + url : "ai/skin/order", + method: "POST", +}) + +// 检测订单支付 +const skinPay = (order_id, data) => req({ + url : "ai/pay/" + order_id + "/wechat", + data: data, +}) + +// 皮肤检测 +const skinEnter = (data, path) => { + return upload({ + url : "ai/skin/analyze", + key : "image", + path : path, + data : data, + method : "POST", + }) +} + +export default ({ + analyze, + skinOrder, + skinPay, + skinEnter +}) \ No newline at end of file diff --git a/api/interfaces/mall.js b/api/interfaces/mall.js new file mode 100644 index 0000000..6cbd866 --- /dev/null +++ b/api/interfaces/mall.js @@ -0,0 +1,65 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req } from "../request" + +// 产品首页 +const mallIndex = () => req({ + url: "mall" +}) + +// 产品列表 +const mallList = data => req({ + url: "mall/goods", + data: data +}) + +// 产品详情 +const mallSee = (goods) => req({ + url: "mall/goods/" + goods +}) + +// 产品下单 +const mallPlace = data => req({ + url: "mall/buy/goods", + data: data +}) + +// 产品下单提交 +const mallAffirm = data => req({ + url: "mall/buy/goods", + data: data, + method: "POST", +}) + +// 产品支付 +const mallPay = (order_no, data) => req({ + url: "mall/pay/" + order_no + "/wechat", + data: data +}) + +// 绑定邀请码 +const levelBind = (data) => req({ + url: "user/bind", + data: data, + method: "POST", +}) + +// 我的兑换券 +const mycoupon = (data) => req({ + url: "coupons", + data: data +}) + +export default ({ + mallIndex, + mallList, + mallSee, + mallPlace, + mallAffirm, + mallPay, + levelBind, + mycoupon +}) \ No newline at end of file diff --git a/api/interfaces/order.js b/api/interfaces/order.js new file mode 100644 index 0000000..521f957 --- /dev/null +++ b/api/interfaces/order.js @@ -0,0 +1,50 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req } from "../request" + +// 订单首页 +const list = data => req({ + url : "mall/orders", + data: data +}) + +// 订单详情 +const goodsDet = (order_no) => req({ + url : "mall/orders/" + order_no +}) + +// 订单取消 +const goodsCancel = (order_no) => req({ + url : "mall/orders/" + order_no + "/cancel", + method: "PUT" +}) + +// 订单删除 +const goodsDel = (order_no) => req({ + url : "mall/orders/" + order_no, + method: "DELETE" +}) + +// 订单签收 +const goodsSign = (order_no) => req({ + url : "mall/orders/" + order_no + "/sign", + method: "PUT" +}) + +// 快递100-免费 +const kuaiDi = (data) => req({ + url : "mall/orders/express", + data: data +}) + +export default ({ + list, + goodsDet, + goodsCancel, + goodsDel, + goodsSign, + kuaiDi +}) \ No newline at end of file diff --git a/api/interfaces/site.js b/api/interfaces/site.js new file mode 100644 index 0000000..1ceb9d8 --- /dev/null +++ b/api/interfaces/site.js @@ -0,0 +1,58 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req } from "../request" + +// 收获地址(列表) +const siteList = () => req({ + url: "mall/addresses" +}) + +// 省市区-获取 +const create = data => req({ + url: "mall/addresses/create", + data: data +}) + +// 新增地址 +const siteAdd = data => req({ + url: "mall/addresses", + data: data, + method: 'POST' +}) + +// 地址详细 +const siteSee = (address) => req({ + url: "mall/addresses/" + address +}) + +// 编辑地址 +const siteEdit = (address, data) => req({ + url: "mall/addresses/" + address, + data: data, + method: 'PUT' +}) + +// 删除地址 +const siteDel = (address) => req({ + url: "mall/addresses/" + address, + method: 'DELETE' +}) + +// 设置默认地址 +const siteDefault = (address) => req({ + url: "mall/addresses/" + address + "/default", + method: 'POST' +}) + +export default ({ + siteList, + create, + siteAdd, + siteSee, + siteEdit, + siteDel, + siteDefault +}) \ No newline at end of file diff --git a/api/interfaces/user.js b/api/interfaces/user.js new file mode 100644 index 0000000..07e26ec --- /dev/null +++ b/api/interfaces/user.js @@ -0,0 +1,49 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req } from "../request" + +// 用户中心 +const userIndex = () => req({ + url: "user" +}) + +// 用户设置 +const userSetup = () => req({ + url: "user/setting" +}) + +//修改用户信息 +const setting = (key, data) => req({ + url: "user/setting/" + key, + method: "PUT", + data: data +}) + +// 我的推广码 +const invitesCode = data => req({ + url: "user/invite", + data: data +}) + +// 小程序码 +const miniShare = data => req({ + url: "user/mini_share", + data: data +}) + +// 帮助分类 +const helpsNav = () => req({ + url: "cms/categories/helps" +}) + +export default ({ + userIndex, + userSetup, + setting, + invitesCode, + miniShare, + helpsNav +}) \ No newline at end of file diff --git a/api/request.js b/api/request.js new file mode 100644 index 0000000..ed4ce8f --- /dev/null +++ b/api/request.js @@ -0,0 +1,139 @@ +/* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import {errInfo} from './err' +import {updToken} from './updateToken' + +// 请求方式配置 +// https://api.shui.shuiganying.com/api //正式地址 +// https://shuitest.shuiganying.com/api //测试地址 +// wx6bd4fcc040bfa025 正式appid +// wx3056ec23196eaf02 测试appid +const api = "https://api.shui.shuiganying.com/api/" // 正式环境 +// const api = "https://shuitest.shuiganying.com/api/" // 测试环境 +const header = { + "Accept" : "application/json" +} +let isToken = true + +/** + * 请求 + * @property {Object} req + */ + +const req = (obj, noToken) => { + // 检查是否无需要token + if(noToken != undefined){ + isToken = noToken + } + + // header + if(obj.token){ + header.Authorization = obj.token || '' + } else { + header.Authorization = wx.getStorageSync("token") || "" + } + + // 处理请求信息 + return new Promise((resolve, reject) => { + // 组合header + obj.header = { + "Accept" : "application/json", + "channel" : "client", + "Authorization" : wx.getStorageSync("token") || "" + } + if(!isToken){ + obj.header.Authorization = '' + } + wx.request({ + url : api + obj.url, + header : obj.header || {}, + method : obj.method || 'GET', + data : obj.data || {}, + success : res => { + // 更新token + if (res.header.Authorization) updToken(res.header.Authorization) + // 处理信息 + if (res.data.status_code == 200) { + resolve(res.data) + } else { + if (res.data.status_code == 401 || res.data.status_code == 400) { + reject({ + login : false, + codeBeen: false + }) + } + reject(res) + errInfo(res.data) + } + }, + fail: err => { + wx.showToast({ + title : err.errMsg, + icon : "none" + }) + reject(err) + }, + complete(){ + if(!isToken) isToken = true + } + }) + }) +} + + +/** + * 上传 + * @property {Object} upload + */ + +const upload = (obj) => { + // header + header.Authorization = wx.getStorageSync("token") || "" + // 处理上传信息 + return new Promise((resolve, reject) => { + wx.showLoading({ + title: "上传中..", + mask: true + }) + wx.uploadFile({ + url : api + obj.url, + header : header, + name : obj.key || "", + filePath: obj.path || "", + formData: obj.data || {}, + success : res=>{ + wx.hideLoading(); + // 处理返回值 + let jsonData = JSON.parse(res.data) + // 更新token + if (res.header.Authorization) updToken(res.header.Authorization) + // 处理信息 + if (jsonData.status_code == 200) { + resolve(jsonData.data) + } else { + if (jsonData.status_code == 401) { + reject({ + login: false + }) + } + errInfo(jsonData) + } + }, + fail : err=>{ + wx.showToast({ + title : err.errMsg, + icon : "none" + }) + reject(err) + } + }) + }) +} + +module.exports = { + req, + upload +} \ No newline at end of file diff --git a/api/updateToken.js b/api/updateToken.js new file mode 100644 index 0000000..7853539 --- /dev/null +++ b/api/updateToken.js @@ -0,0 +1,21 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +/** + * 更新token + * @property {String} updToken + */ + +const updToken = (token) =>{ + // 更新全局存储器 + getApp().globalData.token = token + // 更新客户端登录缓存 + wx.setStorageSync('token', token) +} + +module.exports = { + updToken +} + diff --git a/app.js b/app.js new file mode 100644 index 0000000..240f862 --- /dev/null +++ b/app.js @@ -0,0 +1,57 @@ +/* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +import api from "api/index" +App({ + onLaunch() { + // 检查用户登录状态 + const token = wx.getStorageSync("token") + if(token){ + this.globalData.isUser = true + } + + // 检查系统更新 + const updateManager = wx.getUpdateManager() + updateManager.onUpdateReady(function () { + wx.showModal({ + title : '更新提示', + content : '新版本已经准备好,是否重启应用?', + cancelColor: '#666', + confirmColor: '#e50d01', + success : res=> { + if (res.confirm) { + updateManager.applyUpdate() + } + } + }) + }) + updateManager.onUpdateFailed(function(){ + wx.showModal({ + title : '更新提示', + content : '版本更新下载失败,请检查您的网络稍后重试', + showCancel: false, + confirmColor: '#e50d01' + }) + }) + + // 获取系统信息 + wx.getSystemInfo({ + success: res=>{ + this.globalData = { + barHeight: res.statusBarHeight + } + } + }) + + // 挂载api + wx.$api = api + }, + globalData: { + isUser : false, + userInfo : null, + barHeight: '', + inviteText: '' // 邀请好友临时存储 + } +}) \ No newline at end of file diff --git a/app.json b/app.json new file mode 100644 index 0000000..b041034 --- /dev/null +++ b/app.json @@ -0,0 +1,73 @@ +{ + "pages": [ + "pages/index/index", + "pages/mall/index", + "pages/report/index", + "pages/user/index", + "pages/site/index", + "pages/order/index", + "pages/user/code/code", + "pages/user/setup/setup", + "pages/user/about/about", + "pages/user/help/help", + "pages/login/index", + "pages/site/add/add", + "pages/site/edit/edit", + "pages/health/index", + "pages/health/article/article", + "pages/order/details/details", + "pages/mall/details/details", + "pages/mall/confirm/confirm", + "pages/mall/coupon/coupon", + "pages/pay/index", + "pages/report/detail/detail", + "pages/report/share/share", + "pages/index/assess/assess", + "pages/health/collect/collect", + "pages/health/praise/praise", + "pages/mall/list/list", + "pages/login/personal/personal", + "pages/login/agreement/agreement", + "pages/mall/webView/webView", + "pages/order/logistic/logistic" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "水感应", + "navigationBarTextStyle": "black" + }, + "tabBar": { + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页", + "iconPath": "/static/tabBarIcon/tabBar_00.png", + "selectedIconPath": "/static/tabBarIcon/tabBar_selected_00.png" + }, + { + "pagePath": "pages/mall/index", + "text": "产品", + "iconPath": "/static/tabBarIcon/tabBar_01.png", + "selectedIconPath": "/static/tabBarIcon/tabBar_selected_01.png" + }, + { + "pagePath": "pages/report/index", + "text": "报告", + "iconPath": "/static/tabBarIcon/tabBar_02.png", + "selectedIconPath": "/static/tabBarIcon/tabBar_selected_02.png" + }, + { + "pagePath": "pages/user/index", + "text": "我的", + "iconPath": "/static/tabBarIcon/tabBar_03.png", + "selectedIconPath": "/static/tabBarIcon/tabBar_selected_03.png" + } + ], + "color": "#999999", + "selectedColor": "#3b7cff", + "borderStyle": "white" + }, + "style": "v2", + "sitemapLocation": "sitemap.json" +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..d97b6a0 --- /dev/null +++ b/app.wxss @@ -0,0 +1,70 @@ +page { + font-size: 30rpx; +} + +/* +* 文字截取 +*/ + +.nowrap { + max-width: 100%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.nowrap-multi { + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +/* + * 上拉加载 + */ +.pagesLoding{ + width: 100%; + text-align: center; + color: gray; + line-height: 90rpx; + font-size: 28rpx; +} + +.pagesLoding-icon{ + width: 32rpx; + height: 32rpx; + vertical-align: middle; + margin-right: 10rpx; + margin-bottom: 6rpx; +} + +.pages-hint { + width: 100%; + text-align: center; + color: #747788; + font-size: 28rpx; + background: white; +} + +.pages-hint image { + width: 220rpx; + height: 220rpx; +} + +/* +* 水平居中 +*/ + +.pack-center { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-box-pack: center; + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: -1; +} \ No newline at end of file diff --git a/pages/health/article/article.js b/pages/health/article/article.js new file mode 100644 index 0000000..8f73e16 --- /dev/null +++ b/pages/health/article/article.js @@ -0,0 +1,140 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ +Page({ + + /** + * 页面的初始数据 + */ + data: { + articleId : '', //文章id + indexShow : '', //内容 + mallContent : '', //简介 + favoritesSee : '', //收藏状态 + favoritesNumber : '', //收藏数量 + subscribesSee : '', //点赞状态 + subscribesNumber: '', //点赞数量 + isFixedTop : 0, + barHeight : getApp().globalData.barHeight, // 状态栏高度 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + articleId : options.id + }) + + if(options.invite != undefined) { + getApp().globalData.inviteText = options.invite + } + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取详情数据 + this.indexInfo(); + }, + + /** + * 详情数据 + */ + indexInfo () { + wx.$api.health.healthSee(this.data.articleId).then(res => { + this.setData({ + indexShow : res.data, + favoritesSee : res.data.isFavorite, + subscribesSee : res.data.isSubscribed, + favoritesNumber : res.data.favorites, + subscribesNumber: res.data.subscribes, + mallContent : res.data.content.replace(/\ {}) + }, + + // 操作按钮 + toolTap(e) { + let newName = e.currentTarget.dataset.name + if(wx.getStorageSync("token") != ''){ + // 收藏 + if(newName == 'favorites') { + wx.$api.health.favorite(this.data.articleId).then(res => { + this.setData({ + favoritesSee : res.data.favorite, + favoritesNumber: res.data.count + }) + wx.showToast({ + title:'操作成功', + icon:'none' + }) + }).catch(err => {}) + return + } + + // 点赞 + wx.$api.health.subscribe(this.data.articleId).then(res => { + this.setData({ + subscribesSee : res.data.subscribed, + subscribesNumber: res.data.count + }) + wx.showToast({ + title:'操作成功', + icon:'none' + }) + }).catch(err => {}) + }else{ + // 去登录 + wx.navigateTo({ + url: "/pages/login/index" + }) + } + }, + + /** + * 微信分享 + */ + onShareAppMessage(){ + return { + title : this.data.indexShow.title, + imageUrl: this.data.indexShow.cover, + path : "/pages/health/article/article?id=" + this.data.articleId + '&invite=' + wx.getStorageSync("invite") + } + }, + + /** + * 返回上一页 + */ + returnGo() { + wx.navigateBack({ + delta: 1, + fail: () => { + wx.switchTab({ + url: '/pages/index/index?invite=' + getApp().globalData.inviteText + }) + } + }) + }, + + /** + * 回到首页 + */ + returnHome() { + wx.switchTab({ + url: '/pages/index/index?invite=' + getApp().globalData.inviteText + }) + }, + + /** + * 监听页面滑动事件 + */ + onPageScroll(e) { + this.setData({ + isFixedTop: parseInt(e.scrollTop) + }); + }, +}) \ No newline at end of file diff --git a/pages/health/article/article.json b/pages/health/article/article.json new file mode 100644 index 0000000..f0f1934 --- /dev/null +++ b/pages/health/article/article.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom", + "navigationBarTextStyle": "white" +} \ No newline at end of file diff --git a/pages/health/article/article.wxml b/pages/health/article/article.wxml new file mode 100644 index 0000000..a5c9427 --- /dev/null +++ b/pages/health/article/article.wxml @@ -0,0 +1,40 @@ + + + + + + + + + + 水感应 | {{indexShow.title}} + + + {{indexShow.created_at}} + 浏览 {{indexShow.clicks}} + + + + + + + + + + + + + + + + {{favoritesNumber}} + + + + {{subscribesNumber}} + + + \ No newline at end of file diff --git a/pages/health/article/article.wxss b/pages/health/article/article.wxss new file mode 100644 index 0000000..ebbe4df --- /dev/null +++ b/pages/health/article/article.wxss @@ -0,0 +1,102 @@ +page { + background-color: #ffffff; +} + +.articleImg { + width: 100%; + display: inline-block; +} + +.articleCont { + padding: 30rpx; + box-sizing: border-box; + border-bottom: 160rpx transparent solid; +} + +.articleName { + font-size: 36rpx; + margin-top: 20rpx; +} + +.articleName text { + text-transform: uppercase; +} + +.articleTool { + color: #666666; + font-size: 26rpx; + margin-top: 15rpx; +} + +.articleTool text { + padding-right: 30rpx; + font-weight: 200; +} + +.articleBanner { + text-align: center; + margin: 60rpx 0; +} + +.articleBanner image { + width: 100%; +} + +.tool { + position: fixed; + width: 100%; + height: 90rpx; + line-height: 90rpx; + left: 0; + bottom: 60rpx; + z-index: 99; + padding: 0 30rpx; + box-sizing: border-box; +} + +.toolCont { + background-color: #ffffff; + display: flex; + box-shadow: 0 0 10rpx rgba(0, 0, 0, .1); + border-radius: 80rpx; +} + +.toolCont-label { + flex: 3; + text-align: center; + color: #999; + font-size: 30rpx; + background-color: transparent; + padding: 0; + margin: 0; + line-height: 100rpx; + font-weight: 200; +} + +.toolCont-label-icon { + width: 36rpx; + height: 36rpx; + margin-right: 10rpx; + vertical-align: -4rpx; +} + +.navigation{ + position: fixed; + top: 0; + left: 0; + z-index: 99; + width: 100%; + height: 90rpx; + background-color: transparent; + transition: .2s; +} + +.navigation.active { + background-color: transparent; +} + +.navigation-arrow { + width: 44rpx; + height: 44rpx; + margin: 20rpx 15rpx 0 20rpx; +} \ No newline at end of file diff --git a/pages/health/collect/collect.js b/pages/health/collect/collect.js new file mode 100644 index 0000000..b891a85 --- /dev/null +++ b/pages/health/collect/collect.js @@ -0,0 +1,71 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ +Page({ + + /** + * 页面的初始数据 + */ + data: { + categories : [], // 分类 + articlesArr : [], // 列表 + page : {}, // 分页信息 + lodingStats : false, // 加载状态 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取列表 + this.articlesInfo(); + }, + + // 列表 + articlesInfo(page){ + wx.$api.health.myFavorite({ + page : page || 1 + }).then(res => { + let listArr = this.data.articlesArr, + newData = [] + if(page == 1 || page == undefined) listArr = [] + newData = listArr.concat(res.data.favorites.data) + this.setData({ + articlesArr : newData, + page : res.data.favorites.page, + lodingStats : false + }) + wx.stopPullDownRefresh() + }).catch(err => {}) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + // 获取列表 + this.articlesInfo(); + }, + + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let pageNumber = this.data.page.current + if(this.data.page.has_more){ + pageNumber++ + // 获取列表 + this.articlesInfo(pageNumber); + } + } +}) \ No newline at end of file diff --git a/pages/health/collect/collect.json b/pages/health/collect/collect.json new file mode 100644 index 0000000..32e11d1 --- /dev/null +++ b/pages/health/collect/collect.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "我的收藏" +} \ No newline at end of file diff --git a/pages/health/collect/collect.wxml b/pages/health/collect/collect.wxml new file mode 100644 index 0000000..3909479 --- /dev/null +++ b/pages/health/collect/collect.wxml @@ -0,0 +1,24 @@ + + + + + + + 水感应 | {{item.favoriteable.title}} + {{item.favoriteable.description}} + + + + + 加载中... + + + 没有更多了~ + + + + + + 暂无数据 + + \ No newline at end of file diff --git a/pages/health/collect/collect.wxss b/pages/health/collect/collect.wxss new file mode 100644 index 0000000..28b618e --- /dev/null +++ b/pages/health/collect/collect.wxss @@ -0,0 +1,62 @@ +page { + padding: 0 30rpx; + box-sizing: border-box; + background-color: #f6f6f6; +} + +/* 健康知识 */ +.article { + box-sizing: border-box; +} + +.wiki { + margin-top: 60rpx; +} + +.wiki-label { + background-color: #fff; + margin-bottom: 70rpx; + position: relative; + height: 200rpx; + box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05); + border-radius: 10rpx; +} + +.wiki-label:last-child { + margin-bottom: 0; +} + +.wiki-label-img { + width: 200rpx; + height: 200rpx; + position: absolute; + top: -30rpx; + left: 30rpx; + border-radius: 10rpx; +} + +.wiki-label-cont { + position: absolute; + left: 0; + top: 0; + width: 100%; + padding: 30rpx 25rpx 0 270rpx; + box-sizing: border-box; +} + +.wiki-label-name { + font-size: 32rpx; + color: #3b7cff; +} + +.wiki-label-name text { + text-transform: uppercase; +} + +.wiki-label-text { + color: #999999; + font-size: 28rpx; + margin-top: 20rpx; + line-height: 40rpx; + font-weight: 200; +} \ No newline at end of file diff --git a/pages/health/index.js b/pages/health/index.js new file mode 100644 index 0000000..01b7f33 --- /dev/null +++ b/pages/health/index.js @@ -0,0 +1,87 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ +Page({ + data: { + categoriesArr : [], // 健康分类 + categoryId : '', // 分类id + listsArr : [], // 列表 + page : {}, // 分页信息 + lodingStats : false,// 加载状态 + }, + + onLoad(options) { + // 获取健康分类 + this.categoriesInfo(); + }, + + /** + * 健康分类 + */ + categoriesInfo() { + wx.$api.health.healthNav().then(res => { + this.setData({ + categoriesArr : res.data, + categoryId : res.data[0].category_id + }) + // 获取健康列表 + this.healthInfo(); + }).catch(err => {}) + }, + + /** + * 分类选择 + */ + tabsTap(e) { + this.setData({ + categoryId: e.currentTarget.dataset.id + }) + // 获取健康分类 + this.healthInfo(); + }, + + /** + * 健康列表 + */ + healthInfo(page) { + wx.$api.health.healthList({ + category_id: this.data.categoryId, + page : page || 1 + }).then(res => { + let listArr = this.data.listsArr, + newData = [] + if(page == 1 || page == undefined) listArr = [] + newData = listArr.concat(res.data.data) + this.setData({ + listsArr : newData, + page : res.data.page, + lodingStats : false + }) + wx.stopPullDownRefresh() + }).catch(err => {}) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + // 获取健康列表 + this.healthInfo(); + }, + + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let pageNumber = this.data.page.current + if(this.data.page.has_more){ + pageNumber++ + // 获取健康列表 + this.healthInfo(pageNumber); + } + } +}) diff --git a/pages/health/index.json b/pages/health/index.json new file mode 100644 index 0000000..52e6a1d --- /dev/null +++ b/pages/health/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "健康知识" +} \ No newline at end of file diff --git a/pages/health/index.wxml b/pages/health/index.wxml new file mode 100644 index 0000000..d14550e --- /dev/null +++ b/pages/health/index.wxml @@ -0,0 +1,33 @@ + + + + + {{item.title}} + + + + + + + + + + + 水感应 | {{item.title}} + {{item.description}} + + + + + 加载中... + + + 没有更多了~ + + + + + + 暂无数据 + + \ No newline at end of file diff --git a/pages/health/index.wxss b/pages/health/index.wxss new file mode 100644 index 0000000..3ac68c4 --- /dev/null +++ b/pages/health/index.wxss @@ -0,0 +1,101 @@ +page { + background-color: #fafafa; +} + +/* 分类 */ +.tabs { + box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .05); + background-color: #fff; +} + +.tabs-scroll { + line-height: 88rpx; + height: 110rpx; + white-space: nowrap; +} + +.tabs-scroll-name { + display: inline-block; + padding: 0 32rpx; + font-size: 30rpx; + position: relative; + color: rgb(85, 85, 85); +} + +.tabs-scroll-name::after { + content: ''; + position: absolute; + background-color: transparent; + left: 32%; + bottom: 0rpx; + width: 36%; + height: 8rpx; + border-radius: 60rpx; +} + +.tabs-scroll-name.active { + color: #3b7cff; + font-weight: 600; +} + +.tabs-scroll-name.active::after { + background-color: #3b7cff; +} + +/* 健康知识 */ +.article { + padding: 10rpx 30rpx; + box-sizing: border-box; +} + +.wiki { + margin-top: 60rpx; +} + +.wiki-label { + background-color: #fff; + margin-bottom: 70rpx; + position: relative; + height: 200rpx; + box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05); + border-radius: 10rpx; +} + +.wiki-label:last-child { + margin-bottom: 0; +} + +.wiki-label-img { + width: 200rpx; + height: 200rpx; + position: absolute; + top: -30rpx; + left: 30rpx; + border-radius: 10rpx; +} + +.wiki-label-cont { + position: absolute; + left: 0; + top: 0; + width: 100%; + padding: 30rpx 25rpx 0 270rpx; + box-sizing: border-box; +} + +.wiki-label-name { + font-size: 32rpx; + color: #3b7cff; +} + +.wiki-label-name text { + text-transform: uppercase; +} + +.wiki-label-text { + color: #999999; + font-size: 28rpx; + margin-top: 20rpx; + line-height: 40rpx; + font-weight: 200; +} \ No newline at end of file diff --git a/pages/health/praise/praise.js b/pages/health/praise/praise.js new file mode 100644 index 0000000..45002ac --- /dev/null +++ b/pages/health/praise/praise.js @@ -0,0 +1,71 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ +Page({ + + /** + * 页面的初始数据 + */ + data: { + categories : [], // 分类 + articlesArr : [], // 列表 + page : {}, // 分页信息 + lodingStats : false, // 加载状态 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取列表 + this.articlesInfo(); + }, + + // 列表 + articlesInfo(page){ + wx.$api.health.mySubscribe({ + page : page || 1 + }).then(res => { + let listArr = this.data.articlesArr, + newData = [] + if(page == 1 || page == undefined) listArr = [] + newData = listArr.concat(res.data.subscriptions.data) + this.setData({ + articlesArr : newData, + page : res.data.subscriptions.page, + lodingStats : false + }) + wx.stopPullDownRefresh() + }).catch(err => {}) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + // 获取列表 + this.articlesInfo(); + }, + + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let pageNumber = this.data.page.current + if(this.data.page.has_more){ + pageNumber++ + // 获取列表 + this.articlesInfo(pageNumber); + } + } +}) \ No newline at end of file diff --git a/pages/health/praise/praise.json b/pages/health/praise/praise.json new file mode 100644 index 0000000..08c673f --- /dev/null +++ b/pages/health/praise/praise.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "我的点赞" +} \ No newline at end of file diff --git a/pages/health/praise/praise.wxml b/pages/health/praise/praise.wxml new file mode 100644 index 0000000..3da9bc4 --- /dev/null +++ b/pages/health/praise/praise.wxml @@ -0,0 +1,24 @@ + + + + + + + 水感应 | {{item.subscribable.title}} + {{item.subscribable.description}} + + + + + 加载中... + + + 没有更多了~ + + + + + + 暂无数据 + + \ No newline at end of file diff --git a/pages/health/praise/praise.wxss b/pages/health/praise/praise.wxss new file mode 100644 index 0000000..28b618e --- /dev/null +++ b/pages/health/praise/praise.wxss @@ -0,0 +1,62 @@ +page { + padding: 0 30rpx; + box-sizing: border-box; + background-color: #f6f6f6; +} + +/* 健康知识 */ +.article { + box-sizing: border-box; +} + +.wiki { + margin-top: 60rpx; +} + +.wiki-label { + background-color: #fff; + margin-bottom: 70rpx; + position: relative; + height: 200rpx; + box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05); + border-radius: 10rpx; +} + +.wiki-label:last-child { + margin-bottom: 0; +} + +.wiki-label-img { + width: 200rpx; + height: 200rpx; + position: absolute; + top: -30rpx; + left: 30rpx; + border-radius: 10rpx; +} + +.wiki-label-cont { + position: absolute; + left: 0; + top: 0; + width: 100%; + padding: 30rpx 25rpx 0 270rpx; + box-sizing: border-box; +} + +.wiki-label-name { + font-size: 32rpx; + color: #3b7cff; +} + +.wiki-label-name text { + text-transform: uppercase; +} + +.wiki-label-text { + color: #999999; + font-size: 28rpx; + margin-top: 20rpx; + line-height: 40rpx; + font-weight: 200; +} \ No newline at end of file diff --git a/pages/index-老版/assess/assess.js b/pages/index-老版/assess/assess.js new file mode 100644 index 0000000..069e0c4 --- /dev/null +++ b/pages/index-老版/assess/assess.js @@ -0,0 +1,193 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + barHeight : getApp().globalData.barHeight, // 状态栏高度 + openId : '', + nameValue : '', // 姓名 + nameStatus: false, // 姓名填写弹框 + Analyze : '', // 是否交钱 + disabled : false, // 支付按钮 + payStatus : false, // 支付弹框 + payPrice : '', // 支付金额 + }, + + onLoad(options) { + this.setData({ + openId: options.code + }) + }, + + onShow() { + // 判断是否可检测 + this.ifAnalyze(); + }, + + /** + * 是否可检测 + */ + ifAnalyze() { + wx.$api.index.analyze().then(res => { + this.setData({ + Analyze : res.data.analyze, + payPrice : res.data.price + }) + if(!res.data.is_update) { + this.setData({ + nameStatus: true + }) + } + }).catch(err => {}) + }, + + /* + 姓名截取 + */ + bindinput(e) { + this.setData({ + nameValue: e.detail.value.substr(0,5) + }) + }, + + /* + 提交信息 + */ + issueForm() { + wx.showLoading({ + title: '信息提交中...', + mask : true + }) + let data = { + name : this.data.nameValue + } + wx.$api.auth.userAdd(data).then(() => { + wx.hideLoading() + this.setData({ + nameStatus: false + }) + }).catch(err => {}) + }, + + /** + * 开始皮肤检测 + */ + goAnalyze() { + if(this.data.Analyze) { + this.uploadPhoto() + return + } + this.setData({ + payStatus: true + }) + }, + + /** + * 上传图片信息 + */ + uploadPhoto() { + wx.chooseMedia({ + count : 1, + sourceType: ['camera'], + camera : 'front', + success : path => { + // 获取皮肤检测接口 + wx.cropImage({ + src: path.tempFiles[0].tempFilePath, // 图片路径 + cropScale: '3:4', // 裁剪比例 + success: res=> { + // 获取皮肤检测接口 + this.checkEnter(res.tempFilePath); + }, + complete: err => {} + }) + } + }) + }, + + /** + * 皮肤检测接口 + */ + checkEnter(img) { + wx.$api.index.skinEnter({}, img).then(res => { + wx.redirectTo({ + url: "/pages/report/detail/detail?image_id=" + res.image_id + }) + }) + }, + + /** + * 关闭支付弹窗 + */ + cancelAnalyze() { + this.setData({ + payStatus: false + }) + }, + + /** + * 创建订单 + */ + payFound() { + wx.$api.index.skinOrder().then(res => { + this.setData({ + disabled : true + }) + this.payBtn(res.data.order_id) + }).catch(err => {}) + }, + + /** + * 确认支付1元 + */ + payBtn(orderid) { + wx.showLoading({ + title: '支付中...', + mask : true + }) + wx.$api.index.skinPay(orderid,{type: 'miniapp', openid: this.data.openId}).then(res=>{ + wx.hideLoading() + let payInfo = JSON.parse(res.data.wechat) + wx.requestPayment({ + timeStamp: payInfo.timeStamp, + nonceStr : payInfo.nonceStr, + package : payInfo.package, + paySign : payInfo.paySign, + signType : payInfo.signType, + success : res=>{ + if(res.errMsg == "requestPayment:ok"){ + wx.showToast({ + title: '支付成功', + icon : 'success' + }) + } + this.setData({ + payStatus: false + }) + this.uploadPhoto() + }, + fail : err=>{ + wx.showToast({ + title: '支付失败', + icon : 'error' + }) + this.setData({ + disabled : false, + payStatus: false + }) + } + }) + }).catch(err => {}); + }, + + /** + * 返回上一页 + */ + returnGo() { + wx.navigateBack({ + delta: 1 + }) + }, +}) diff --git a/pages/index-老版/assess/assess.json b/pages/index-老版/assess/assess.json new file mode 100644 index 0000000..7af8b0a --- /dev/null +++ b/pages/index-老版/assess/assess.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/index-老版/assess/assess.wxml b/pages/index-老版/assess/assess.wxml new file mode 100644 index 0000000..9611929 --- /dev/null +++ b/pages/index-老版/assess/assess.wxml @@ -0,0 +1,75 @@ + + + + + + + + + + + + 拍照注意事项 + + + + 1 + 露出全脸 + + + + 2 + 保持素颜 + + + + 3 + 灯光柔和 + + + + 4 + 合适角度距离 + + + + + + + {{Analyze ? '首次免费,开始测肤' : '支付' + payPrice + '元,进行测肤'}} > + + + + + + + + + 请填写真实姓名 + + + + 取消 + 确定 + + + + + + + + + + + AI测肤火爆进行中 + 原价¥10/次,现价¥1/次即可享受并赠送水感应一年VIP权限! + + + ¥1.00 + + 立即支付 + 立即支付 + 取消 + + + \ No newline at end of file diff --git a/pages/index-老版/assess/assess.wxss b/pages/index-老版/assess/assess.wxss new file mode 100644 index 0000000..79f9777 --- /dev/null +++ b/pages/index-老版/assess/assess.wxss @@ -0,0 +1,344 @@ +page { + background-color: #f7faff; +} + + + +/* 返回 */ +.navigation{ + position: fixed; + top: 0; + left: 0; + z-index: 999; + width: 100%; + height: 90rpx; + background-color: transparent; + transition: .2s; +} + +.navigation.active { + background-color: #ffffff; +} + +.navigation-arrow { + width: 44rpx; + height: 44rpx; + margin: 20rpx 15rpx 0 20rpx; +} + +/* 顶部背景 */ +.top { + width: 100%; + position: relative; + height: 100vh; + overflow: hidden; +} + +.top-back { + position: absolute; + height: 100%; + left: 0; + top: 0; + width: 100%; + z-index: 1; +} + +/* 内容 */ +.seeCont { + position: absolute; + top: 10%; + z-index: 100; + width: 100%; + padding: 80rpx 30rpx; + box-sizing: border-box; +} + +.seeCont-title { + text-align: center; + font-size: 42rpx; +} + +.seeCont-item { + margin-top: 60rpx; + position: relative; + width: 100%; + height: 700rpx; +} + +.seeCont-item::after { + border-radius: 15rpx; + position: absolute; + content: ''; + background-color: #ffffff; + width: 100%; + height: 100%; + opacity: .6; + left: 0; + top: 0; +} + +.seeCont-text { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + z-index: 10; + padding: 60rpx; + box-sizing: border-box; +} + +.seeCont-laebl { + display: flex; + line-height: 84rpx; + padding: 30rpx 0; + box-sizing: border-box; + position: relative; +} + +.seeCont-laebl-number { + color: #3d7eff; + font-weight: 600; + font-size: 60rpx; + position: relative; + padding-right: 20rpx; + font-style:italic; +} + +.seeCont-laebl-number::after { + position: absolute; + content: ''; + right: 0; + top: 40rpx; + background-color: #3d7eff; + width: 4rpx; + height: 50rpx; + transform:skewX(-30deg); +} + +.seeCont-laebl-name { + font-size: 34rpx; + padding-left: 60rpx; +} + +.seeCont-laebl-img { + width: 84rpx; + height: 84rpx; + position: absolute; + right: 0; + top: 30rpx; +} + +.seeBtn { + text-align: center; + width: 100%; +} + +.seeBtn-btn { + background-color: #3d7eff; + display: inline-block; + color: #ffffff; + border-radius: 90rpx; + margin-top: 60rpx; + line-height: 90rpx; + padding: 0 80rpx; +} + + +/* 名字弹出 */ +.namePop { + position: fixed; + background-color: rgba(0, 0, 0, .5); + left: 0; + top: 0; + height: 100vh; + width: 100vw; + z-index: 100000; + display: none; +} + +.namePop.active { + display: block; +} + +.nameCont { + -webkit-box-orient: vertical; + -webkit-box-pack: center; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 100000; + padding: 0 15%; + box-sizing: border-box; + display: none; +} + +.nameCont.active { + display: -webkit-box; +} + +.nameCont-white { + background-color: #ffffff; + border-radius: 15rpx; + overflow: hidden; +} + +.nameCont-top { + padding: 30rpx; + box-sizing: border-box; +} + +.nameCont-title { + font-size: 34rpx; + margin-bottom: 30rpx; +} + +.nameCont-input { + background-color: #f3f3f3; + height: 90rpx; + line-height: 90rpx; + border-radius: 10rpx; + padding: 0 25rpx; + box-sizing: border-box; +} + +.nameCont-btn { + line-height: 100rpx; + background-color: #f3f3f3; + display: flex; + margin-top: 30rpx; + border-top: 2rpx solid #dfdfdf; +} + +.nameCont-btn-go { + text-align: center; + flex: 2; +} + +.nameCont-btn-go:last-child { + position: relative; + color: #ff9951; +} + +.nameCont-btn-go:last-child::after { + position: absolute; + content: ''; + left: 0; + top: 0; + width: 2rpx; + height: 100%; + background-color: #dfdfdf; +} + +/* 支付弹出 */ +.payEject { + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, .6); + z-index: 1000; + display: none; +} + +.payEject.active{ + display: block; +} + +.payPop { + width: 84%; + position: fixed; + left: 8%; + top: 30%; + z-index: 10001; + height: 600rpx; + display: none; +} + +.payPop.active{ + display: block; +} + +.payPop::after { + border-radius: 15rpx 200rpx 15rpx 15rpx; + position: absolute; + content: ''; + background-color: #ffffff; + width: 100%; + height: 100%; + opacity: .6; + left: 0; + top: 0; +} + +.payPop-cont { + width: calc(100% - 40rpx); + height: calc(100% - 40rpx); + position: absolute; + left: 20rpx; + top: 20rpx; + background-color: #ffffff; + border-radius: 15rpx 200rpx 15rpx 15rpx; + z-index: 10002; + padding: 30rpx; + box-sizing: border-box; +} + +.payPop-title { + width: 100%; + padding-right: 150rpx; + box-sizing: border-box; +} + +.payPop-title-name { + font-size: 46rpx; + color: #3d7eff; + margin-bottom: 20rpx; + font-weight: 600; +} + +.payPop-title-text { + color: #666666; + line-height: 44rpx; + font-size: 26rpx; +} + +.payPop-cont-img { + position: absolute; + top: -30rpx; + right: -20rpx; + width: 42%; +} + +.payPop-price { + text-align: center; + font-size: 70rpx; + padding: 40rpx 0; +} + +.payPop-btn { + text-align: center; + width: 100%; +} + +.payPop-btn-go { + background-image: linear-gradient(to right, #4181fe, #689aff); + display: inline-block; + color: #ffffff; + border-radius: 90rpx; + line-height: 90rpx; + padding: 0 100rpx; +} + +.payPop-btn-go.active { + background-image: linear-gradient(to right, #cacaca, #bdbdbd); +} + +.payPop-btn-cancel { + color:#3d7eff; + text-align: center; + padding-top: 30rpx; +} \ No newline at end of file diff --git a/pages/index-老版/index.js b/pages/index-老版/index.js new file mode 100644 index 0000000..7e372f5 --- /dev/null +++ b/pages/index-老版/index.js @@ -0,0 +1,67 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + payCode : '', // code获取openid + openId : '', // openid + disabled : false, // 支付按钮 + payStatus : false, // 支付弹框 + catchtouchmove: false + }, + + onLoad(options) { + if(options.invite != undefined) { + getApp().globalData.inviteText = options.invite + } + wx.login({ + success: res => { + this.setData({ + payCode: res.code + }) + // 获取openid + this.openInfo() + } + }) + }, + + /** + * openid + */ + openInfo() { + wx.$api.auth.codeOpenid({code: this.data.payCode}).then(res => { + this.setData({ + openId: res.data + }) + }).catch(err => {}) + }, + + /** + * 处理未登录时的转跳 + */ + assessGo(){ + if(wx.getStorageSync("token") != ''){ + wx.navigateTo({ + url: '/pages/index/assess/assess?code=' + this.data.openId + }) + return + } + + // 去登录 + wx.navigateTo({ + url: "/pages/login/index?type=indexDemo" + }) + }, + + /** + * 微信分享 + */ + onShareAppMessage(){ + return { + title : '水感应', + path : "/pages/index/index?invite=" + wx.getStorageSync("invite") + } + }, +}) diff --git a/pages/index-老版/index.json b/pages/index-老版/index.json new file mode 100644 index 0000000..7af8b0a --- /dev/null +++ b/pages/index-老版/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/index-老版/index.wxml b/pages/index-老版/index.wxml new file mode 100644 index 0000000..bf230aa --- /dev/null +++ b/pages/index-老版/index.wxml @@ -0,0 +1,37 @@ + + + + + 开始评测 + + + + + + + + + + + + + 最新活动 + + + + + + + + + + + + + + + + + + + diff --git a/pages/index-老版/index.wxss b/pages/index-老版/index.wxss new file mode 100644 index 0000000..c099bd4 --- /dev/null +++ b/pages/index-老版/index.wxss @@ -0,0 +1,140 @@ +/* 第一屏幕 */ +.indexBack { + position: relative; + width: 100%; + height: 100vh; +} + +.indexBack-img { + position: absolute; + width: 100%; + height: 100%; +} + +.indexText { + position: absolute; + bottom: 20rpx; + left: 0; + text-align: center; + width: 100%; +} + +.indexText-name { + background-color: #3b7cff; + color: #fff; + display: inline-block; + border-radius: 50rpx; + height: 68rpx; + line-height: 68rpx; + padding: 0 50rpx; +} + +.indexText-arrow { + width: 74rpx; + height: 74rpx; + display: block; + margin: 15rpx auto 0; + animation: bounce-down 2s linear infinite; +} + +@keyframes bounce-down { + 25% { + transform: translateY(-4px); + } + + 50%, + 100% { + transform: translateY(0); + } + + 75% { + transform: translateY(4px); + } +} + +/* 步骤提示 */ +.indexTips { + width: 100%; + padding: 60rpx 50rpx; + box-sizing: border-box; +} + +.indexTips-img { + width: 100%; +} + +/* 活动轮播 */ +.indexShaky { + width: 100%; +} + +.indexShaky-back { + position: relative; + width: 100%; + left: 0; + top: 0; + height: 230rpx; + background-color: #b8d3e8; + border-radius: 0 0 50rpx 50rpx; + text-align: center; +} + +.indexShaky-title { + color: #1049a2; + position: relative; + font-size: 54rpx; + height: 100rpx; + padding-top: 30rpx; +} + +.indexShaky-title>text { + width: 100%; + text-align: center; + position: absolute; + left: 0; + bottom: 0; + z-index: 2; +} + +.indexShaky-title::after { + position: absolute; + content: ''; + left: calc(50% - 100rpx); + bottom: -2rpx; + background-image: linear-gradient(to left, #ffffff,#ffffff 50%, transparent); + width: 200rpx; + height: 18rpx; +} + +.indexShaky-swiper { + margin-top: -50rpx; + padding: 0 30rpx; + box-sizing: border-box; +} + +.indexShaky-cont { + position: relative; + border-radius: 20rpx; + padding-top: 50%; + overflow: hidden; +} + +.indexShaky-see, +.swiperCont-img { + border-radius: 20rpx; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +/* 步骤提示 */ +.indexSingle { + width: 100%; + margin-top: 80rpx; +} + +.indexSingle-img { + width: 100%; +} diff --git a/pages/index/assess/assess.js b/pages/index/assess/assess.js new file mode 100644 index 0000000..ca4d540 --- /dev/null +++ b/pages/index/assess/assess.js @@ -0,0 +1,235 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + barHeight : getApp().globalData.barHeight, // 状态栏高度 + openId : '', + nameValue : '', // 姓名 + testTitle : '', + nameStatus: false, // 姓名填写弹框 + Analyze : '', // 是否交钱 + disabled : false, // 支付按钮 + payStatus : false, // 支付弹框 + payPrice : '', // 支付金额 + }, + + onLoad(options) { + this.setData({ + openId: options.code + }) + if(options) { + wx.login({ + success: res => { + // 获取openid + this.openInfo(res.code) + } + }) + } + }, + + onShow() { + // 判断是否可检测 + this.ifAnalyze(); + }, + + + /** + * openid + */ + openInfo(code) { + wx.$api.auth.codeOpenid({code: code}).then(res => { + this.setData({ + openId: res.data + }) + }).catch(err => {}) + }, + + /** + * 是否可检测 + */ + ifAnalyze() { + wx.$api.index.analyze().then(res => { + if(res.data.is_first) { + this.setData({ + testTitle: '首次免费,开始测肤' + }) + } else if (res.data.is_first == false && res.data.analyze == false) { + this.setData({ + testTitle: '支付' + res.data.price + '元,进行测肤' + }) + } else if (res.data.is_first == false && res.data.analyze == true) { + this.setData({ + testTitle: '您已付费,进行检测' + }) + } + + this.setData({ + Analyze : res.data + }) + if(!res.data.is_update) { + this.setData({ + nameStatus: true + }) + } + }).catch(err => {}) + }, + + /* + 姓名截取 + */ + bindinput(e) { + this.setData({ + nameValue: e.detail.value.substr(0,5) + }) + }, + + /* + 提交信息 + */ + issueForm() { + wx.showLoading({ + title: '信息提交中...', + mask : true + }) + let data = { + name : this.data.nameValue + } + wx.$api.auth.userAdd(data).then(() => { + wx.hideLoading() + this.setData({ + nameStatus: false + }) + }).catch(err => {}) + }, + + /** + * 开始皮肤检测 + */ + goAnalyze() { + if(this.data.Analyze.is_first == false && this.data.Analyze.analyze == false) { + this.setData({ + payStatus: true + }) + } else { + this.uploadPhoto() + } + }, + + /** + * 上传图片信息 + */ + uploadPhoto() { + wx.chooseMedia({ + count : 1, + sourceType: ['camera'], + camera : 'front', + success : path => { + // 获取皮肤检测接口 + wx.cropImage({ + src: path.tempFiles[0].tempFilePath, // 图片路径 + cropScale: '3:4', // 裁剪比例 + success: res=> { + // 获取皮肤检测接口 + this.checkEnter(res.tempFilePath); + }, + complete: err => {} + }) + } + }) + }, + + /** + * 皮肤检测接口 + */ + checkEnter(img) { + wx.$api.index.skinEnter({}, img).then(res => { + wx.redirectTo({ + url: "/pages/report/detail/detail?image_id=" + res.image_id + }) + }) + }, + + /** + * 关闭支付弹窗 + */ + cancelAnalyze() { + this.setData({ + payStatus: false + }) + }, + + /** + * 创建订单 + */ + payFound() { + wx.$api.index.skinOrder().then(res => { + this.setData({ + disabled : true + }) + this.payBtn(res.data.order_id) + }).catch(err => {}) + }, + + /** + * 确认支付1元 + */ + payBtn(orderid) { + wx.showLoading({ + title: '支付中...', + mask : true + }) + wx.$api.index.skinPay(orderid,{type: 'miniapp', openid: this.data.openId}).then(res=>{ + wx.hideLoading() + let payInfo = JSON.parse(res.data.wechat) + wx.requestPayment({ + timeStamp: payInfo.timeStamp, + nonceStr : payInfo.nonceStr, + package : payInfo.package, + paySign : payInfo.paySign, + signType : payInfo.signType, + success : res=>{ + if(res.errMsg == "requestPayment:ok"){ + wx.showToast({ + title: '支付成功', + icon : 'success' + }) + } + this.setData({ + payStatus: false + }) + this.setData({ + Analyze: false + }) + this.uploadPhoto() + }, + fail : err=>{ + wx.showToast({ + title: '支付失败', + icon : 'error' + }) + this.setData({ + disabled : false, + payStatus: false + }) + } + }) + }).catch(err => { + this.setData({ + disabled : false, + payStatus: false + }) + }); + }, + + /** + * 返回上一页 + */ + returnGo() { + wx.navigateBack({ + delta: 1 + }) + }, +}) diff --git a/pages/index/assess/assess.json b/pages/index/assess/assess.json new file mode 100644 index 0000000..7af8b0a --- /dev/null +++ b/pages/index/assess/assess.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/index/assess/assess.wxml b/pages/index/assess/assess.wxml new file mode 100644 index 0000000..e0e5200 --- /dev/null +++ b/pages/index/assess/assess.wxml @@ -0,0 +1,75 @@ + + + + + + + + + + + + 拍照注意事项 + + + + 1 + 露出全脸 + + + + 2 + 保持素颜 + + + + 3 + 光线柔和 + + + + 4 + 合适角度距离 + + + + + + + {{testTitle}} + + + + + + + + + 请填写真实姓名 + + + + 取消 + 确定 + + + + + + + + + + + AI测肤火爆进行中 + 原价¥10/次,现价¥1/次即可享受并赠送水感应一年VIP权限! + + + ¥1.00 + + 立即支付 + 立即支付 + 取消 + + + \ No newline at end of file diff --git a/pages/index/assess/assess.wxss b/pages/index/assess/assess.wxss new file mode 100644 index 0000000..79f9777 --- /dev/null +++ b/pages/index/assess/assess.wxss @@ -0,0 +1,344 @@ +page { + background-color: #f7faff; +} + + + +/* 返回 */ +.navigation{ + position: fixed; + top: 0; + left: 0; + z-index: 999; + width: 100%; + height: 90rpx; + background-color: transparent; + transition: .2s; +} + +.navigation.active { + background-color: #ffffff; +} + +.navigation-arrow { + width: 44rpx; + height: 44rpx; + margin: 20rpx 15rpx 0 20rpx; +} + +/* 顶部背景 */ +.top { + width: 100%; + position: relative; + height: 100vh; + overflow: hidden; +} + +.top-back { + position: absolute; + height: 100%; + left: 0; + top: 0; + width: 100%; + z-index: 1; +} + +/* 内容 */ +.seeCont { + position: absolute; + top: 10%; + z-index: 100; + width: 100%; + padding: 80rpx 30rpx; + box-sizing: border-box; +} + +.seeCont-title { + text-align: center; + font-size: 42rpx; +} + +.seeCont-item { + margin-top: 60rpx; + position: relative; + width: 100%; + height: 700rpx; +} + +.seeCont-item::after { + border-radius: 15rpx; + position: absolute; + content: ''; + background-color: #ffffff; + width: 100%; + height: 100%; + opacity: .6; + left: 0; + top: 0; +} + +.seeCont-text { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + z-index: 10; + padding: 60rpx; + box-sizing: border-box; +} + +.seeCont-laebl { + display: flex; + line-height: 84rpx; + padding: 30rpx 0; + box-sizing: border-box; + position: relative; +} + +.seeCont-laebl-number { + color: #3d7eff; + font-weight: 600; + font-size: 60rpx; + position: relative; + padding-right: 20rpx; + font-style:italic; +} + +.seeCont-laebl-number::after { + position: absolute; + content: ''; + right: 0; + top: 40rpx; + background-color: #3d7eff; + width: 4rpx; + height: 50rpx; + transform:skewX(-30deg); +} + +.seeCont-laebl-name { + font-size: 34rpx; + padding-left: 60rpx; +} + +.seeCont-laebl-img { + width: 84rpx; + height: 84rpx; + position: absolute; + right: 0; + top: 30rpx; +} + +.seeBtn { + text-align: center; + width: 100%; +} + +.seeBtn-btn { + background-color: #3d7eff; + display: inline-block; + color: #ffffff; + border-radius: 90rpx; + margin-top: 60rpx; + line-height: 90rpx; + padding: 0 80rpx; +} + + +/* 名字弹出 */ +.namePop { + position: fixed; + background-color: rgba(0, 0, 0, .5); + left: 0; + top: 0; + height: 100vh; + width: 100vw; + z-index: 100000; + display: none; +} + +.namePop.active { + display: block; +} + +.nameCont { + -webkit-box-orient: vertical; + -webkit-box-pack: center; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 100000; + padding: 0 15%; + box-sizing: border-box; + display: none; +} + +.nameCont.active { + display: -webkit-box; +} + +.nameCont-white { + background-color: #ffffff; + border-radius: 15rpx; + overflow: hidden; +} + +.nameCont-top { + padding: 30rpx; + box-sizing: border-box; +} + +.nameCont-title { + font-size: 34rpx; + margin-bottom: 30rpx; +} + +.nameCont-input { + background-color: #f3f3f3; + height: 90rpx; + line-height: 90rpx; + border-radius: 10rpx; + padding: 0 25rpx; + box-sizing: border-box; +} + +.nameCont-btn { + line-height: 100rpx; + background-color: #f3f3f3; + display: flex; + margin-top: 30rpx; + border-top: 2rpx solid #dfdfdf; +} + +.nameCont-btn-go { + text-align: center; + flex: 2; +} + +.nameCont-btn-go:last-child { + position: relative; + color: #ff9951; +} + +.nameCont-btn-go:last-child::after { + position: absolute; + content: ''; + left: 0; + top: 0; + width: 2rpx; + height: 100%; + background-color: #dfdfdf; +} + +/* 支付弹出 */ +.payEject { + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, .6); + z-index: 1000; + display: none; +} + +.payEject.active{ + display: block; +} + +.payPop { + width: 84%; + position: fixed; + left: 8%; + top: 30%; + z-index: 10001; + height: 600rpx; + display: none; +} + +.payPop.active{ + display: block; +} + +.payPop::after { + border-radius: 15rpx 200rpx 15rpx 15rpx; + position: absolute; + content: ''; + background-color: #ffffff; + width: 100%; + height: 100%; + opacity: .6; + left: 0; + top: 0; +} + +.payPop-cont { + width: calc(100% - 40rpx); + height: calc(100% - 40rpx); + position: absolute; + left: 20rpx; + top: 20rpx; + background-color: #ffffff; + border-radius: 15rpx 200rpx 15rpx 15rpx; + z-index: 10002; + padding: 30rpx; + box-sizing: border-box; +} + +.payPop-title { + width: 100%; + padding-right: 150rpx; + box-sizing: border-box; +} + +.payPop-title-name { + font-size: 46rpx; + color: #3d7eff; + margin-bottom: 20rpx; + font-weight: 600; +} + +.payPop-title-text { + color: #666666; + line-height: 44rpx; + font-size: 26rpx; +} + +.payPop-cont-img { + position: absolute; + top: -30rpx; + right: -20rpx; + width: 42%; +} + +.payPop-price { + text-align: center; + font-size: 70rpx; + padding: 40rpx 0; +} + +.payPop-btn { + text-align: center; + width: 100%; +} + +.payPop-btn-go { + background-image: linear-gradient(to right, #4181fe, #689aff); + display: inline-block; + color: #ffffff; + border-radius: 90rpx; + line-height: 90rpx; + padding: 0 100rpx; +} + +.payPop-btn-go.active { + background-image: linear-gradient(to right, #cacaca, #bdbdbd); +} + +.payPop-btn-cancel { + color:#3d7eff; + text-align: center; + padding-top: 30rpx; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..35db3a7 --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,116 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + payCode : '', // code获取openid + openId : '', // openid + userLogin : false, // 是否登录 + testTitle : '', // 检测文字 + disabled : false, // 支付按钮 + payStatus : false, // 支付弹框 + catchtouchmove: false + }, + + onLoad(options) { + if(options.invite != undefined) { + getApp().globalData.inviteText = options.invite + } + }, + + onShow() { + wx.login({ + success: res => { + this.setData({ + payCode: res.code + }) + // 获取openid + this.openInfo() + } + }) + + // 获取登录状态 + if(wx.getStorageSync("token") != ''){ + this.setData({ + userLogin: true + }) + // 是否可检测 + this.ifAnalyze(); + return + } + + this.setData({ + userLogin: false + }) + }, + + /** + * openid + */ + openInfo() { + wx.$api.auth.codeOpenid({code: this.data.payCode}).then(res => { + this.setData({ + openId: res.data + }) + }).catch(err => {}) + }, + + /** + * 是否可检测 + */ + ifAnalyze() { + wx.$api.index.analyze().then(res => { + if(res.data.is_first) { + this.setData({ + testTitle: '首次免费,开始测肤' + }) + } else if (res.data.is_first == false && res.data.analyze == false) { + this.setData({ + testTitle: '支付' + res.data.price + '元,进行测肤' + }) + } else if (res.data.is_first == false && res.data.analyze == true) { + this.setData({ + testTitle: '您已付费,进行检测' + }) + } + + this.setData({ + Analyze : res.data + }) + if(!res.data.is_update) { + this.setData({ + nameStatus: true + }) + } + }).catch(err => {}) + }, + + /** + * 处理未登录时的转跳 + */ + assessGo(){ + if(wx.getStorageSync("token") != ''){ + wx.navigateTo({ + url: '/pages/index/assess/assess?code=' + }) + return + } + + // 去登录 + wx.navigateTo({ + url: "/pages/login/index?type=indexDemo" + }) + }, + + /** + * 微信分享 + */ + onShareAppMessage(){ + return { + title : '水感应', + path : "/pages/index/index?invite=" + wx.getStorageSync("invite") + } + }, +}) diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..7af8b0a --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..662ed45 --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,30 @@ + + + + + + 下滑了解详情 + + + + + + + + + 检测 + + + + + + + + + + + + + + {{userLogin ? testTitle : '立即开启皮肤检测'}} + diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..016bb47 --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,125 @@ +/* 漂浮窗 */ +.wander { + position: fixed; + right: 0; + top: 26%; + background-color: #ffffff; + border-radius: 60rpx 0 0 60rpx; + height: 150rpx; + width: 120rpx; +} + +.wander::after { + position: absolute; + left: -15rpx; + top: -15rpx; + background-color: rgba(255, 255, 255, .3); + content: ''; + width: calc(100% + 30rpx); + height: calc(100% + 30rpx); + z-index: 0; + border-radius: 60rpx 0 0 60rpx; +} + +.wander-cont { + padding: 25rpx 25rpx 25rpx 35rpx; + box-sizing: border-box; + position: absolute; + z-index: 2; + width: 100%; + height: 100%; + left: 0; + top: 0; + text-align: center; +} + +.wander-icon { + width: 54rpx; +} + +.wander-name { + color: #12428f; + padding-top: 5rpx; + font-weight: 300; + font-size: 26rpx; +} + +/* 第一屏幕 */ +.indexBack { + position: relative; + width: 100%; + height: 100vh; +} + +.indexBack-img { + position: absolute; + width: 100%; + height: 100%; +} + +.indexText { + position: absolute; + bottom: 30rpx; + left: 0; + text-align: center; + width: 100%; +} + +.indexText-name { + color: #fff; + display: inline-block; + border-radius: 50rpx; + text-shadow: 2rpx 2rpx 10rpx rgba(0, 0, 0, .3); + font-size: 28rpx; +} + +.indexText-arrow { + width: 36rpx; + height: 36rpx; + display: block; + margin: 15rpx auto 0; + animation: bounce-down 2s linear infinite; +} + +@keyframes bounce-down { + 25% { + transform: translateY(-4px); + } + + 50%, + 100% { + transform: translateY(0); + } + + 75% { + transform: translateY(4px); + } +} + + +/* 步骤提示 */ +.indexSingle { + width: 100%; +} + +.indexSingle-img { + width: 100%; + display: block; +} + + +/* 按钮 */ +.testBtn { + text-align: center; +} + +.testBtn-go { + margin: 50rpx 0 100rpx; + background-image: linear-gradient(to right, #3d7dfe, #6b9fff); + border: 14rpx solid #bdd3ff; + display: inline-block; + color: #fff; + line-height: 90rpx; + width: 75%; + border-radius: 110rpx; +} \ No newline at end of file diff --git a/pages/login/agreement/agreement.js b/pages/login/agreement/agreement.js new file mode 100644 index 0000000..3abb33b --- /dev/null +++ b/pages/login/agreement/agreement.js @@ -0,0 +1,42 @@ +/* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + + /** + * 页面的初始数据 + */ + data: { + content: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + if(options.type == 'secret') { + wx.setNavigationBarTitle({ + title: '水感应 隐私政策' + }) + } else { + wx.setNavigationBarTitle({ + title: '水感应 服务协议' + }) + } + + // 获取用户协议 + wx.$api.auth.registeragree(options.type).then(res => { + this.setData({ + content: res.data.content + }) + }).catch(err => {}) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() {}, +}) \ No newline at end of file diff --git a/pages/login/agreement/agreement.json b/pages/login/agreement/agreement.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/pages/login/agreement/agreement.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/login/agreement/agreement.wxml b/pages/login/agreement/agreement.wxml new file mode 100644 index 0000000..7fd32b1 --- /dev/null +++ b/pages/login/agreement/agreement.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/pages/login/agreement/agreement.wxss b/pages/login/agreement/agreement.wxss new file mode 100644 index 0000000..7c3f35b --- /dev/null +++ b/pages/login/agreement/agreement.wxss @@ -0,0 +1,5 @@ +.agreement-content{ + padding: 30rpx; + box-sizing: border-box; + font-size: 32rpx; +} \ No newline at end of file diff --git a/pages/login/index.js b/pages/login/index.js new file mode 100644 index 0000000..9f7d09f --- /dev/null +++ b/pages/login/index.js @@ -0,0 +1,140 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + typeLogin : '', // 登录来源 + loading : false, // 加载 + loginCode : '', // 微信登录code + checked : false, //勾选协议 + }, + + onLoad(options) { + this.setData({ + typeLogin : options.type + }) + }, + + onShow() { + // 获取code + this.gainCode(); + }, + + /** + * 隐私协议 + */ + empowerTap() { + wx.showToast({ + title: '请勾选用户隐私和服务协议', + icon: "none" + }) + }, + + /** + * 微信授权手机号码 + */ + userPhone(e){ + // 获取code + this.gainCode(); + if(e.detail.errMsg == "getPhoneNumber:ok"){ + this.setData({ + loading: true + }) + let enData = e.detail.encryptedData, + iv = e.detail.iv + // 检查用户登录Code是否过期 + wx.checkSession({ + success: ()=>{ + this.userLogin(iv,enData) + }, + fail: err=>{ + this.setData({ + loading: false + }) + // 登录过期重新获取code + wx.login({ + success: res=>{ + this.setData({ + loginCode: res.code + }) + // 登录 + this.userLogin(iv,enData) + } + }) + } + }) + }else{ + wx.showToast({ + title: '拒绝了登录授权', + icon : 'none' + }) + } + }, + + /** + * 用户登录 + */ + userLogin(iv,enData){ + wx.$api.auth.login({ + code : this.data.loginCode, + encryptedData : enData, + iv : iv, + invite : getApp().globalData.inviteText || '' + }).then(res=>{ + // 存储登录信息 + wx.setStorage({ + key : 'token', + data : res.data.token_type + ' ' + res.data.access_token, + success: () =>{ + // 存储邀请码 + wx.$api.user.userIndex().then(res => { + wx.setStorage({ + key : 'invite', + data : res.data.invite + }) + if(this.data.typeLogin == "indexDemo") { + wx.redirectTo({ + url: '/pages/index/assess/assess' + }) + return + } + // 回到上一页 + wx.navigateBack() + }).catch(err => {}) + } + }) + }).catch(err=>{}) + }, + + /** + * 获取code + */ + gainCode() { + wx.login({ + success: res => { + this.setData({ + loginCode : res.code + }) + } + }) + }, + + // 勾选协议 + radioChange() { + this.setData({ + checked: !this.data.checked + }) + }, + + // 免责声明 + seeSm(){ + wx.showModal({ + title: '免责声明', + content: '本品不含任何除原料外的添加物,如使用中有任何问题,请遵医嘱。', + showCancel:false, + confirmText:'知道了' + }) + } +}) diff --git a/pages/login/index.json b/pages/login/index.json new file mode 100644 index 0000000..51796f5 --- /dev/null +++ b/pages/login/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#5283ea", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "授权登录" +} \ No newline at end of file diff --git a/pages/login/index.wxml b/pages/login/index.wxml new file mode 100644 index 0000000..44137d6 --- /dev/null +++ b/pages/login/index.wxml @@ -0,0 +1,31 @@ + + + + + 欢迎使用 + 水感应平台 + + + + + + 授权登录 + 回到首页 + + + + + + + + 我已阅读并同意《隐私政策》《服务协议》《免责声明》 + + + + + + + + \ No newline at end of file diff --git a/pages/login/index.wxss b/pages/login/index.wxss new file mode 100644 index 0000000..80eff17 --- /dev/null +++ b/pages/login/index.wxss @@ -0,0 +1,119 @@ +page { + background-color: #f4f4f6; +} + +.loginTop { + background-color: #5283ea; + width: 100%; + height: 200rpx; + border-radius: 0 0 80rpx 80rpx; +} + +.loginCont { + padding: 0 40rpx; + box-sizing: border-box; + position: absolute; + top: 40rpx; + width: 100%; + z-index: 99; +} + +.loginCont-back { + background-color: #ffffff; + border-radius: 20rpx; + padding: 40rpx 40rpx 20rpx; + box-sizing: border-box; +} + +.loginCont-title-name { + color: #525252; +} + +.loginCont-title-text { + font-size: 40rpx; + margin-top: 15rpx; + position: relative; + display: inline-block; + padding-bottom: 20rpx; +} + +.loginCont-title-text::after { + position: absolute; + content: ''; + background-color: #5283ea; + width: 100%; + height: 8rpx; + left: 0; + bottom: 0; + border-radius: 80rpx; +} + +.loginCont-see-img { + width: 100%; + margin: 80rpx 0 60rpx; +} + +.loginCont-see-btn { + width: 100%; +} + +.loginCont-see-go { + height: 98rpx; + line-height: 98rpx !important; + text-align: center; + border-radius: 90rpx; + margin-bottom: 40rpx; + font-size: 32rpx !important; + border: 2rpx solid #5283ea; + width: 100% !important; +} + +.loginCont-see-blue { + background-color: #5283ea; + color: #ffffff; + padding: 0 !important; + font-weight: normal; + border: none; + height: 104rpx !important; +} + +.loginCont-see-blue[disabled] { + border-color: transparent; +} + +.loginCont-see-white { + color: #5283ea; +} + +.logo { + position: absolute; + z-index: 1; + right: -120rpx; + bottom: 18%; +} + + +/* 协议 */ +.agreement { + font-size: 26rpx; + color: #9d9d9d; + margin: 20rpx 0; + display: flex; +} + +.radioGroup { + transform: scale(.6); + width: 55rpx; + text-align: left; +} + +.agreement-text { + width: calc(100% - 55rpx); + line-height: 48rpx; +} + +.agreement-text navigator, +.agreement-text view { + color: #3b7cff; + display: inline-block; +} \ No newline at end of file diff --git a/pages/login/personal/personal.js b/pages/login/personal/personal.js new file mode 100644 index 0000000..7920947 --- /dev/null +++ b/pages/login/personal/personal.js @@ -0,0 +1,77 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + loading : false, // 加载 + nameValue : '', + sexArray: [ + { + id: 0, + name: '男' + }, + { + id: 1, + name: '女' + }, + ], + sexId: '', + birthday: '请选择出生年月日' + }, + + onLoad(options) { + }, + + onShow() {}, + + /* + 性别选择 + */ + radioChange (e) { + const sex = this.data.sexArray + for (let i = 0, len = sex.length; i < len; ++i) { + sex[i].checked = sex[i].id == e.detail.value + } + this.setData({ + sexArray: sex, + sexId : e.detail.value + }) + }, + + /* + 出生年月日 + */ + bindDateChange(e) { + this.setData({ + birthday: e.detail.value + }) + }, + + /* + 姓名截取 + */ + bindinput(e) { + this.setData({ + nameValue: e.detail.value.substr(0,5) + }) + }, + + /* + 提交信息 + */ + issueForm() { + let data = { + name : this.data.nameValue, + sex : this.data.sexId, + birthday : this.data.birthday + } + wx.$api.auth.userAdd(data).then(res => { + this.setData({ + disabled: true + }) + wx.navigateBack() + }).catch(err => {}) + } +}) diff --git a/pages/login/personal/personal.json b/pages/login/personal/personal.json new file mode 100644 index 0000000..2abdc05 --- /dev/null +++ b/pages/login/personal/personal.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "基本信息" +} \ No newline at end of file diff --git a/pages/login/personal/personal.wxml b/pages/login/personal/personal.wxml new file mode 100644 index 0000000..b0db3d3 --- /dev/null +++ b/pages/login/personal/personal.wxml @@ -0,0 +1,46 @@ + + + + + 请填写以下个人信息 + 填写以下信息,填写后的信息不可修改 + +
+ + + 姓名 + + + + 性别 + + + + + {{item.name}} + + + + + 出生年月日 + + {{birthday}} + + + + + + + +
+
+
+ + + \ No newline at end of file diff --git a/pages/login/personal/personal.wxss b/pages/login/personal/personal.wxss new file mode 100644 index 0000000..9cc9d82 --- /dev/null +++ b/pages/login/personal/personal.wxss @@ -0,0 +1,147 @@ +page { + background-color: #f4f4f6; +} + +.loginTop { + background-color: #5283ea; + width: 100%; + height: 200rpx; + border-radius: 0 0 80rpx 80rpx; +} + +.loginCont { + padding: 0 40rpx; + box-sizing: border-box; + position: absolute; + top: 40rpx; + width: 100%; + z-index: 99; +} + +.loginCont-back { + background-color: #ffffff; + border-radius: 20rpx; + padding: 40rpx 40rpx 20rpx; + box-sizing: border-box; +} + +.loginCont-see-img { + width: 100%; + margin: 80rpx 0 60rpx; +} + +.loginCont-see-btn { + width: 100%; +} + +.loginCont-see-go { + height: 98rpx; + line-height: 98rpx !important; + text-align: center; + border-radius: 90rpx; + margin-bottom: 40rpx; + font-size: 32rpx !important; + border: 2rpx solid #5283ea; + width: 100% !important; +} + +.loginCont-see-blue { + background-color: #5283ea; + color: #ffffff; + height: 102rpx !important; + padding: 0 !important; + font-weight: normal; +} + +.loginCont-see-blue[disabled] { + border-color: transparent; +} + +.loginCont-see-white { + color: #5283ea; +} + +.logo { + position: absolute; + z-index: 1; + right: -120rpx; + bottom: 18%; +} + +.personal-title-text { + font-size: 36rpx; + font-weight: 600; +} + +.personal-title-name { + font-size: 28rpx; + color: #ff9951; + line-height: 54rpx; +} + +.personal-see { + display: block; +} + +.item { + margin-top: 40rpx; + border-bottom: 2rpx solid #ededed; +} + +.entry { + height: 44rpx; + line-height: 44rpx; + display: block; + padding: 30rpx 0; + position: relative; + color: #999999; +} + +.entry image { + width: 44rpx; + height: 44rpx; + position: absolute; + right: 0; + top: calc(50% - 22rpx); +} + +.sexSelect { + display: flex; + padding: 30rpx 0; + height: 44rpx; + line-height: 44rpx; + color: #999999; +} + +.sexSelect radio { + transform: scale(.7); +} + +.radiobox { + display: flex; + margin-right: 50rpx; +} + +/* 按钮 */ +.userdata-btn { + width: 100%; + margin: 80rpx 0 20rpx; +} + +.issue-btn { + background: #3b7cff; + text-align: center; + color: white; + height: 90rpx; + line-height: 90rpx !important; + font-weight: normal; + width: 100% !important; + margin: 0; + padding: 0; + border-radius: 10rpx; +} + +.issue-btn[disabled] { + background: #709fff !important; + color: #fff !important; +} \ No newline at end of file diff --git a/pages/mall/confirm/confirm.js b/pages/mall/confirm/confirm.js new file mode 100644 index 0000000..7414695 --- /dev/null +++ b/pages/mall/confirm/confirm.js @@ -0,0 +1,220 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + goods_id : '', // 店铺id + goods_sku : '', // 产品id + goods_qty : '', // 产品数量 + address : '', // 地址 + addressId : '', // 地址id + goodskData : '', // 数据 + amount : '', // 总金额 + freight : '', // 运费 + weight : '', // 重量 + disabled : true,//按钮 + paySuccess : false, // 兑换成功显示 + maxcoupon : '', //拥有兑换券数量 + coupon_qty : 1, //兑换券数量 + checked : false//兑换券 + }, + + onLoad(options) { + this.setData({ + goods_id : options.goodsid, + goods_sku : options.skuid, + goods_qty : options.qty + }) + }, + + onShow() { + // 获取下单信息 + this.confirmInfo() + }, + + /** + * 产品下单信息 + */ + confirmInfo (){ + wx.$api.mall.mallPlace({ + goods_sku_id: this.data.goods_sku, + address_id: this.data.addressId, + qty: this.data.goods_qty + }).then(res => { + this.setData({ + address : res.data.address, + addressId : res.data.address.address_id, + goodskData: res.data.detail, + amount : res.data.amount, + freight : res.data.freight, + weight : res.data.weight, + maxcoupon : res.data.couponCount + }) + + // 计算总价格 + this.totalPrice() + }).catch(err => { }) + }, + + /** + * 产品数量加减 + */ + goodsNumber(e){ + let num = this.data.goods_qty, + val = e.currentTarget.dataset.type + if (val == 'plus'){ + num ++; + }else{ + if (num > 1){ + num --; + if(num < this.data.coupon_qty) { + this.setData({ + coupon_qty: num + }) + } + }else{ + wx.showToast({ + title : '商品数量不能小于1', + icon : 'none' + }) + } + this.setData({ + goods_qty: num + }) + } + this.setData({ + goods_qty: num + }) + + // 计算总价格 + this.totalPrice() + }, + + /** + * 是否使用兑换券 + */ + checkedTap() { + this.setData({ + checked: !this.data.checked + }) + + // 计算总价格 + this.totalPrice() + }, + + /** + * 兑换券数量加减 + */ + couponNumber(e){ + let minVal = Math.min(this.data.goods_qty, this.data.maxcoupon) + let num = this.data.coupon_qty, + val = e.currentTarget.dataset.type + if (val == 'plus'){ + if(num >= minVal){ + this.setData({ + coupon_qty: minVal + }) + wx.showToast({ + title: '兑换券数量超出产品数量或兑换券不足', + icon : 'none' + }) + return + } + num ++; + + }else{ + if (num > 1){ + num --; + }else{ + wx.showToast({ + title : '兑换券数量不能小于1', + icon : 'none' + }) + } + this.setData({ + coupon_qty: num + }) + } + this.setData({ + coupon_qty: num + }) + + // 计算总价格 + this.totalPrice() + }, + + /** + * 计算总价格 + */ + totalPrice() { + let couponQty = this.data.coupon_qty + let goodNum = this.data.goods_qty + let goodPrice = this.data.goodskData[0].items[0].price + let freight = this.data.freight + let totalPrice = 0 + + totalPrice = this.data.checked ? + (goodNum - couponQty) * goodPrice : + goodNum * goodPrice + if(freight > 0) totalPrice += freight + + this.setData({ + amount: totalPrice + }) + }, + + /** + * 产品确认购买 + */ + buyTap() { + wx.showLoading({ + title: '加载中...', + }) + let that = this + let data = { + goods_sku_id: this.data.goods_sku, + qty : this.data.goods_qty, + address_id : this.data.addressId, + use_coupon : this.data.checked, + coupon_qty : this.data.coupon_qty + } + wx.$api.mall.mallAffirm(data).then(res => { + this.setData({ + disabled: false + }) + wx.hideLoading() + + if(res.data.can_pay) { + wx.redirectTo({ + url: '/pages/pay/index?order_no=' + res.data.order_no + '&total=' + res.data.total + }) + return + } + + wx.showToast({ + title: '支付成功', + icon: 'none', + duration: 2000, + //显示透明蒙层,防止触摸穿透 + mask:true, + success: function () { + that.setData({ + paySuccess: true + }) + setTimeout(()=>{ + wx.redirectTo({ + url: '/pages/order/index?state=paid' + }) + },3000) + } + }) + + }).catch(err => { + this.setData({ + disabled: true + }) + }) + } +}) diff --git a/pages/mall/confirm/confirm.json b/pages/mall/confirm/confirm.json new file mode 100644 index 0000000..b41059d --- /dev/null +++ b/pages/mall/confirm/confirm.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "订单确认" +} \ No newline at end of file diff --git a/pages/mall/confirm/confirm.wxml b/pages/mall/confirm/confirm.wxml new file mode 100644 index 0000000..4085e8d --- /dev/null +++ b/pages/mall/confirm/confirm.wxml @@ -0,0 +1,81 @@ + + + + + {{address.province.name}}{{address.city.name}} + {{address.full_address}} + + + {{address.name}}{{address.mobile}} + + + + + 新增收货地址 + + + + + + + + + + + {{items.title}} + + 规格 99mlx1 + + + 产品金额 ¥{{items.price}} + + + + + + + + 数量 + + - + + + + + + + 快递 + {{freight == 0 ? '免邮' : freight + '元'}} + + + + 兑换券 + 勾选使用 + + + 使用数量 + + - + + + + + + + + 金额 + ¥{{amount}} + + + + + + + {{amount}} + 实付金额 + + 立即支付 + 立即支付 + + + + + 疯狂加载中... + \ No newline at end of file diff --git a/pages/mall/confirm/confirm.wxss b/pages/mall/confirm/confirm.wxss new file mode 100644 index 0000000..7c98d82 --- /dev/null +++ b/pages/mall/confirm/confirm.wxss @@ -0,0 +1,315 @@ +page { + background-color: #f5f6f8; + padding: 30rpx; + box-sizing: border-box; +} + +/* 地址 */ +.address { + background-color: #FFFFFF; + border-radius: 15rpx; + overflow: hidden; + position: relative; +} + +.address-arrow { + position: absolute; + right: 15rpx; + top: 78rpx; + width: 50rpx; + height: 50rpx; +} + +.address-cont { + padding: 30rpx; + box-sizing: border-box; +} + +.address-top { + width: calc(100% - 80rpx); +} + +.address-area { + color: #585866; + font-size: 28rpx; +} + +.address-text { + font-weight: 600; + padding: 10px 0; +} + +.address-name text { + color: #585866; + padding-left: 30rpx; +} + +.address-img { + width: 100%; + display: block; +} + +.address-add { + width: 100%; + text-align: center; + padding: 30rpx 30rpx 0; + box-sizing: border-box; +} + +.address-go { + display: inline-block; + font-size: 28rpx; + line-height: 68rpx; + border-radius: 10rpx; + color: #df723a; + padding-bottom: 20rpx; +} + +/* 商品 */ + +.list-goods { + background-color: #FFFFFF; + margin: 30rpx 0; + display: flex; + padding: 30rpx; + border-radius: 15rpx; + box-sizing: border-box; +} + +.list-goods-img { + width: 184rpx; + height: 184rpx; + margin-right: 30rpx; + border-radius: 10rpx; +} + +.list-goods-cont { + width: calc(100% - 214rpx); +} + +.list-goods-name { + font-size: 32rpx; +} + +.list-goods-text { + line-height: 90rpx; + display: flex; + font-size: 28rpx; + color: #999999; +} + +.list-goods-text text { + flex: 1; +} + +.list-goods-parice { + text-align: right; + font-size: 26rpx; +} + +.list-goods-parice text { + font-size: 34rpx; +} + +/* 规格 */ +.label { + background-color: #FFFFFF; + border-radius: 15rpx; + overflow: hidden; + box-sizing: border-box; +} + +.label-item { + display: flex; + line-height: 100rpx; + color: #585866; + font-size: 30rpx; + padding: 0 30rpx; + box-sizing: border-box; + border-bottom: 2rpx solid rgb(243, 243, 243); +} + +.label-item:last-child { + border: none; +} + +.label-integral { + color: #3b7cff; + font-weight: 600; +} + +.label-name { + flex: 1; +} + +.coupons { + border-bottom: 2rpx solid rgb(243, 243, 243); + padding: 0 30rpx 30rpx; + box-sizing: border-box; +} + +.coupons-item { + display: flex; + line-height: 100rpx; + color: #585866; + font-size: 30rpx; +} + +.coupon-checked { + background-color: #fff3ea; + padding: 20rpx 30rpx; + box-sizing: border-box; + border-radius: 10rpx; + position: relative; +} + +.coupon-checked-name { + color: #ff9951; + font-size: 28rpx; + line-height: 42rpx; +} + +.coupon-checked-number { + position: absolute; + right: 0rpx; + top: 0rpx; + display: flex; + background-color:transparent; +} + +.coupon-checked-btn { + color: #db6815; + width: 80rpx; + text-align: center; + font-weight: 600; + font-size: 38rpx; + line-height: 78rpx; +} + +.coupon-checked-input { + width: 60rpx; + border: 2rpx solid #bd5e1b; + border-radius: 4rpx; + text-align: center; + color: #dd620a; + height: 36rpx; + min-height: 36rpx; + display: inline-block; + margin-top: 20rpx; + font-size: 26rpx; +} + +/*checkbox选中后样式 */ +.label-text-checkbox { + margin-right: -14rpx; + margin-left: 10rpx; +} + +.label-text-checkbox .wx-checkbox-input.wx-checkbox-input-checked { + background: #ff9951; + border-color: #ff9951; +} + +.label-text-checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { + width: 30rpx; + height: 30rpx; + line-height: 28rpx; + text-align: center; + font-size: 30rpx; + color: #fff; + background: transparent; + transform: translate(-50%, -50%) scale(1); + -webkit-transform: translate(-50%, -50%) scale(1); +} + +.label-price { + text-align: right; + line-height: 90rpx; + font-size: 30rpx; + font-weight: 600; + padding: 0 30rpx 5rpx; + box-sizing: border-box; +} + +.label-price text { + font-size: 34rpx; + padding: 0 10rpx; +} + +.label-number { + display: flex; + margin-top: 25rpx; +} + +.number-btn { + background-color: #f1f1f1; + width: 48rpx; + height: 48rpx; + line-height: 46rpx; + text-align: center; +} + +.number-input { + width: 80rpx; + text-align: center; +} + +/* 底部 */ +.footer { + width: 100%; + height: 60px; + background-color: #272e4f; + position: fixed; + left: 0; + bottom: 0; + z-index: 9; + box-sizing: border-box; + display: flex; +} + +.number { + flex: 1; + line-height: 60px; + color: #ffffff; + display: flex; + padding: 0 30rpx; + box-sizing: border-box; +} + +.number text { + font-size: 28rpx; + padding-top: 5rpx; +} + +.number-price { + padding: 0 5rpx; + font-size: 40rpx; +} + +.number-vip { + margin-left: 20rpx; + color: #8d97a1; + font-size: 28rpx; +} + +.btn { + height: 100%; + background-color: #ff9951; + text-align: center; + color: #FFFFFF; + padding: 0 70rpx; + line-height: 60px; +} + +.btn.active { + background-color: #cacaca; +} + +.detailsBrief-back{ + width: 100%; +} + +.grey { + background-color: #f9f9f9; + z-index: 99999; +} \ No newline at end of file diff --git a/pages/mall/coupon/coupon.js b/pages/mall/coupon/coupon.js new file mode 100644 index 0000000..cca7826 --- /dev/null +++ b/pages/mall/coupon/coupon.js @@ -0,0 +1,92 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + couponType : 1, // 兑换券类型 + couponStatus: 1, // 兑换券状态 + couponArr : [], // 兑换券列表 + page : {}, // 分页信息 + lodingStats : false, // 加载状态 + }, + + onShow() { + // 获取我的兑换券 + this.couponInfo(); + }, + + /** + * 我的兑换券 + */ + couponInfo(page) { + wx.$api.mall.mycoupon({ + stock : this.data.couponType, + status: this.data.couponStatus, + page : page || 1 + }).then(res => { + let listArr = this.data.couponArr, + newData = [] + if(page == 1 || page == undefined) listArr = [] + newData = listArr.concat(res.data.data) + this.setData({ + couponArr : newData, + page : res.data.page, + lodingStats : false + }) + wx.stopPullDownRefresh() + }).catch(err => { + this.setData({ + disabled: true + }) + }) + + }, + + /** + * 兑换券-类型 + */ + tabClick(e) { + this.setData({ + couponType: e.currentTarget.dataset.type + }) + // 获取我的兑换券 + this.couponInfo(); + }, + + /** + * 兑换券-状态 + */ + stateClick(e) { + this.setData({ + couponStatus: e.currentTarget.dataset.status + }) + // 获取我的兑换券 + this.couponInfo(); + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + // 获取我的兑换券 + this.couponInfo(); + }, + + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let pageNumber = this.data.page.current + if(this.data.page.has_more){ + pageNumber++ + + // 获取我的兑换券 + this.couponInfo(pageNumber); + } + } +}) diff --git a/pages/mall/coupon/coupon.json b/pages/mall/coupon/coupon.json new file mode 100644 index 0000000..07e3a0c --- /dev/null +++ b/pages/mall/coupon/coupon.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "兑换券" +} \ No newline at end of file diff --git a/pages/mall/coupon/coupon.wxml b/pages/mall/coupon/coupon.wxml new file mode 100644 index 0000000..42c2fe1 --- /dev/null +++ b/pages/mall/coupon/coupon.wxml @@ -0,0 +1,52 @@ + + + + 1瓶 + + + 2瓶 + + + 3瓶 + + + + + 未使用 + + + 已使用 + + + 已过期 + + + + + + + + + {{item.stock}} + + {{item.number}}张 + 有效期至 {{item.actived_at}} + 去使用 + 已使用 + + + + + + 加载中... + + + 没有更多了~ + + + + + + 暂无数据 + + \ No newline at end of file diff --git a/pages/mall/coupon/coupon.wxss b/pages/mall/coupon/coupon.wxss new file mode 100644 index 0000000..eed2e67 --- /dev/null +++ b/pages/mall/coupon/coupon.wxss @@ -0,0 +1,182 @@ +page { + background-color: #f7f9fa; +} + +.orderFixed { + background-color: #f7f9fa; + position: fixed; + top: 0; + left: 0; + width: 100%; + z-index: 9; + height: 220rpx; +} + +.orderTab { + height: 90rpx; + line-height: 90rpx; + background-color: white; + display: flex; +} + +.orderTab-item { + flex: 2; + text-align: center; + position: relative; + color: #000000; +} + +.orderTab-item::after { + position: absolute; + content: ''; + left: calc(50% - 25rpx); + bottom: 0; + width: 50rpx; + height: 8rpx; + background-color: #3b7cff; + display: none; + border-radius: 90rpx; +} + +.orderTab-item.active { + font-weight: 600; +} + +.orderTab-item.active::after { + display: block; +} + +.orderState { + display: flex; + padding: 40rpx 30rpx; + box-sizing: border-box; +} + +.orderState-item { + background-color: white; + line-height: 54rpx; + padding: 0 25rpx; + border-radius: 54rpx; + font-size: 28rpx; + margin-right: 40rpx; +} + +.orderState-item.active { + background-color: #3b7cff; + color: #ffffff; +} + +/* 列表 */ +.coupon { + padding: 230rpx 30rpx 0; + box-sizing: border-box; +} + +.coupon-item { + background-image: linear-gradient(to right, #fcefe5, #ffebdc); + border-radius: 20rpx; + padding: 30rpx 0; + box-sizing: border-box; + margin-bottom: 30rpx; + display: flex; + position: relative; +} + +.coupon-item::after { + position: absolute; + content: ''; + right: -18rpx; + top: calc(50% - 18rpx); + width: 36rpx; + height: 36rpx; + border-radius: 50%; + background-color: #f7f9fa; +} + +.coupon-item-name { + width: 150rpx; + text-align: center; + font-size: 36rpx; + color: #ff9951; + line-height: 110rpx; + position: relative; +} + +.coupon-item-name::after { + position: absolute; + content: ''; + right: 0; + top: 0; + width: 2rpx; + height: 100%; + border-radius: 50%; + background-color: #fdd4b6; +} + +.coupon-item-name text { + font-size: 60rpx; + font-weight: 600; +} + +.coupon-item-text { + width: calc(100% - 150rpx); + padding: 10rpx 0 0 40rpx; + box-sizing: border-box; + position: relative; +} + +.coupon-item-number { + color: #ff9951; + font-size: 38rpx; + margin-bottom: 10rpx; +} + +.coupon-item-time { + font-size: 28rpx; + color: #c06728; +} + +.coupon-item-go { + position: absolute; + right: 40rpx; + top: 30rpx; + background-color: #ff9951; + color: #ffffff; + font-size: 28rpx; + border-radius: 80rpx; + padding: 0 25rpx; + line-height: 58rpx; +} + +.coupon-item-img { + position: absolute; + right: 40rpx; + top: 15rpx; + width: 94rpx; +} + +.coupon-item-go.active { + background-color: #999999; +} + +.coupon-item.active { + background-image: linear-gradient(to right, #eeeeee, #eeeeee); + +} + +.coupon-item.active .coupon-item-go { + background-color: #c1c1c1; +} + +.coupon-item.active .coupon-item-name, +.coupon-item.active .coupon-item-number { + color: #999999; +} + +.coupon-item.active .coupon-item-time { + color: #7a7a7a; +} + +.coupon-item.active .coupon-item-name::after { + background-color: #dbdbdb; +} \ No newline at end of file diff --git a/pages/mall/details/details.js b/pages/mall/details/details.js new file mode 100644 index 0000000..949f078 --- /dev/null +++ b/pages/mall/details/details.js @@ -0,0 +1,314 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + isFixedTop : 0, + barHeight : getApp().globalData.barHeight, // 状态栏高度 + goodsId : '', // 产品id + mallData : '', // 产品信息 + mallContent: '', // 产品简介 + shareSee : false, // 分享弹出 + inviteText : '', // 自己的邀请码 + isParent : false, // 绑定邀请码 + nameValue : '', // 上级邀请码 + }, + + onLoad(options) { + if(options.invite != undefined) { + getApp().globalData.inviteText = options.invite + } + this.setData({ + goodsId: options.id + }) + + // 初始化画布 + wx.createSelectorQuery().select('#coverCanvas').fields({node: true, size: true}).exec(canvasNode => { + const canvas = canvasNode[0].node + canvas.width = 375 + canvas.height = 600 + this.setData({ + canvas + }) + }) + }, + + onShow() { + // 获取产品详情 + this.mallInfo(); + + // 获取登录状态 + if(wx.getStorageSync("token") != ''){ + // 小程序码 + this.ShareInfo(); + } + }, + + /** + * 产品详情 + */ + mallInfo (){ + wx.$api.mall.mallSee(this.data.goodsId).then(res => { + this.setData({ + mallData : res.data, + mallContent : res.data.content.replace(/\ { }) + }, + + /** + * 确认购买 + */ + buyTap() { + // 获取登录状态 + if(wx.getStorageSync("token") != ''){ + if(this.data.mallData.is_parent == true) { + wx.navigateTo({ + url: '/pages/mall/confirm/confirm?goodsid=' + this.data.mallData.goods_id + '&skuid=' + this.data.mallData.skus[0].sku_id + '&qty=1', + }) + return + } + + // 显示绑定邀请码弹窗 + this.setData({ + isParent: true + }) + + }else{ + // 去登录 + wx.navigateTo({ + url: "/pages/login/index" + }) + } + }, + + /** + * 小程序码 + */ + ShareInfo() { + wx.$api.user.miniShare({ + url: '/pages/index/index' + }).then(res => { + this.setData({ + inviteCode: res.data.qrcode + }) + }).catch(err => {}) + }, + + /** + * 分享弹出 + */ + shareTap() { + // 获取登录状态 + if(wx.getStorageSync("token") != ''){ + this.setData({ + shareSee: !this.data.shareSee + }) + }else{ + // 去登录 + wx.navigateTo({ + url: "/pages/login/index" + }) + } + }, + + /** + * 生成海报 + */ + onCanvas(){ + wx.showLoading({ + title: '生成图片中...', + mask : true + }) + const canvas = this.data.canvas + const ctx = canvas.getContext('2d') + const codeImgEl = canvas.createImage() + const backBackEl = canvas.createImage() + + codeImgEl.src = this.data.inviteCode //二维码 + backBackEl.src = this.data.mallData.cover //产品分享图片 + const codeImgLoding = new Promise((resolve, reason) => { + codeImgEl.onload = () => { + resolve() + } + }) + const backBackLoding = new Promise((resolve, reason) => { + backBackEl.onload = () => { + resolve() + } + }) + Promise.all([codeImgLoding, backBackLoding]).then(() => { + // 绘制[二维码-白色背景] + ctx.fillStyle = "#ffffff"; + ctx.fillRect(0, 0, 375, 540); + + ctx.drawImage(backBackEl, 0, 0, 375, 375) + + // 绘制[二维码] + ctx.drawImage(codeImgEl, 270, 440, 80, 80) + + // 产品名称 + ctx.font = "24px Arial"; //字体大小 + ctx.fillStyle = "#000000"; //字体颜色 + ctx.fillText(this.data.mallData.name, 25, 420); + + // 产品价格 + ctx.font = "bold 36px Arial"; //字体大小 + ctx.fillStyle = "#3b7cff"; //字体颜色 + ctx.fillText(this.data.mallData.price.price, 25, 480); + + // 海报文字提示 + ctx.font = "18px Arial"; //字体大小 + ctx.fillStyle = "#b3b3b3"; //字体颜色 + ctx.fillText('识别二维码进行查看', 25, 510); + + wx.hideLoading() + + wx.canvasToTempFilePath({ + canvas: this.data.canvas, + success : res => { + wx.saveImageToPhotosAlbum({ + filePath: res.tempFilePath, + success: saveRes => { + wx.showToast({ + title: '海报已保存至您的相册', + icon : 'none' + }) + this.setData({ + shareSee: false + }) + }, + fail: () => { + this.setData({ + shareSee: false + }) + wx.hideLoading() + wx.showModal({ + title: '提示', + content: '暂未授权小程序写入您的相册,无法存储海报', + confirmColor: '#e50d01', + confirmText: '去设置', + success: res => { + if (res.confirm) { + wx.openSetting() + } + } + }) + } + }) + }, + }) + }).catch(err => { + wx.showToast({ + title: '图片加载失败', + icon : 'none' + }) + }) + }, + + /* + 邀请码截取 + */ + bindinput(e) { + this.setData({ + nameValue: e.detail.value + }) + }, + + /** + * 绑定邀请码 + */ + nameTrue() { + wx.$api.mall.levelBind({ + invite: this.data.nameValue + }).then(res => { + this.setData({ + isParent: false + }) + wx.navigateTo({ + url: '/pages/mall/confirm/confirm?goodsid=' + this.data.mallData.goods_id + '&skuid=' + this.data.mallData.skus[0].sku_id + '&qty=1', + }) + }).catch(err => {}) + }, + + /** + * 关闭绑定邀请码弹窗 + */ + nameCancel() { + this.setData({ + isParent: !this.data.isParent + }) + }, + + /** + * 删除邀请码 + */ + colseTap() { + this.setData({ + nameValue: '' + }) + }, + + /** + * 返回上一页 + */ + returnGo() { + wx.navigateBack({ + delta: 1, + fail: err => { + wx.switchTab({ + url: '/pages/index/index?invite=' + getApp().globalData.inviteText + }) + } + }) + }, + + /** + * 回到首页 + */ + returnHome() { + wx.switchTab({ + url: '/pages/index/index?invite=' + getApp().globalData.inviteText + }) + }, + + /** + * 监听页面滑动事件 + */ + onPageScroll(e) { + this.setData({ + isFixedTop: parseInt(e.scrollTop) + }); + }, + + /** + * 微信分享 + */ + onShareAppMessage(){ + this.setData({ + shareSee: false + }) + return { + title : this.data.mallData.name, + path : "/pages/mall/details/details?id=" + this.data.goodsId + '&invite=' + wx.getStorageSync("invite"), + imageUrl: this.data.mallData.cover + } + }, + + /** + * 放大轮播相册图片 + */ + opneBanner(e){ + let imgs = [], + index = e.currentTarget.dataset.index + for (let img of e.currentTarget.dataset.imgs){ + imgs.push(img) + } + wx.previewImage({ + urls : imgs, + current : imgs[index] + }) + } +}) diff --git a/pages/mall/details/details.json b/pages/mall/details/details.json new file mode 100644 index 0000000..7af8b0a --- /dev/null +++ b/pages/mall/details/details.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/mall/details/details.wxml b/pages/mall/details/details.wxml new file mode 100644 index 0000000..b9fba3e --- /dev/null +++ b/pages/mall/details/details.wxml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + VIP¥{{mallData.price.vip}} + 市场指导价{{mallData.price.price}} + + + + {{mallData.name}} + + + 分享 + + + + + + + + + {{mallData.is_vip ? '已成为' : '开通'}}VIP + {{mallData.is_vip ? 'AI测肤精准分析您皮肤问题' : '完成皮肤评测成为vip/年'}} + + + {{mallData.is_vip ? '再次评测' : '立即评测'}} + + + + + + + 参数 + + + + {{mallData.param.weight}}ml + 净含量 + + + {{mallData.param.product_type}} + 产品类型 + + + + + + + 快递 + + + 免邮 + + + + + + + + + + + + + + {{mallData.is_vip ? mallData.price.vip : mallData.price.price}} + {{mallData.is_vip ? 'VIP会员价' : '市场指导价'}} + + 确认购买 + + + + + + + + {{mallData.name}} + + + {{mallData.price.price}} + + + 识别二维码进行查看 + + + + + + + + + + + + + + + 保存二维码 + + + 取消 + + + + + + + + + + + 您的邀请人? + + + + + + + 暂不绑定 + 立即绑定 + + + \ No newline at end of file diff --git a/pages/mall/details/details.wxss b/pages/mall/details/details.wxss new file mode 100644 index 0000000..7f527f1 --- /dev/null +++ b/pages/mall/details/details.wxss @@ -0,0 +1,545 @@ +page { + background-color: #f7faff; +} + +/* 返回 */ +.navigation { + position: fixed; + top: 0; + left: 0; + z-index: 999; + width: 100%; + height: 90rpx; + background-color: transparent; + transition: .2s; +} + +.navigation.active { + background-color: transparent; +} + +.navigation-arrow { + width: 44rpx; + height: 44rpx; + margin: 20rpx 15rpx 0 20rpx; +} + +/* 产品图 */ +.banner { + overflow: hidden; + position: relative; + padding-top: 100%; +} + +.swiperCont, +.swiperImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +/* 产品详情 */ +.goodsCont { + padding: 30rpx; + border-bottom: 60px solid transparent; + box-sizing: border-box; +} + +.goodsWhite { + background-color: #ffffff; + box-sizing: border-box; + border-radius: 15rpx; + margin-bottom: 30rpx; +} + +.goodsInfo { + padding: 30rpx; + box-sizing: border-box; + position: relative; +} + +.goodsInfo-price { + display: flex; + position: relative; + line-height: 52rpx; + color: #ff9951; +} + +.goodsInfo-cost { + font-size: 48rpx; +} + +.goodsInfo-cost text { + font-size: 28rpx; +} + +.goodsInfo-vip { + background-color: #fff5ed; + border-radius: 80rpx; + margin-left: 30rpx; + padding: 0 25rpx; + height: 52rpx; + font-size: 32rpx; +} + +.goodsInfo-vip text { + font-size: 24rpx; + padding-right: 5rpx; +} + +.goodsInfo-name { + margin-top: 20rpx; + font-size: 32rpx; +} + +.goodsInfo-share { + position: absolute; + top: 40rpx; + right: 30rpx; + display: flex; + font-size: 27rpx; + line-height: 34rpx; + color: #9b9b9b; +} + +.goodsInfo-share-image { + width: 34rpx; + height: 34rpx; + margin-right: 10rpx; +} + +/* 开通vip */ +.vipOpen { + box-sizing: border-box; + position: relative; + padding-top: 17%; + overflow: hidden; +} + +.vipOpen-back { + position: absolute; + width: calc(100% - 60rpx); + height: 100%; + top: 0; + border-radius: 20rpx 20rpx 0 0; + left: 30rpx; + z-index: 1; +} + +.vipOpen-cont { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + z-index: 9; + display: flex; + padding: 15rpx 55rpx; + box-sizing: border-box; +} + +.vipOpen-cont-icon { + width: 60rpx; + height: 60rpx; +} + +.vipOpen-cont-name { + padding: 0 20rpx; + box-sizing: border-box; +} + +.vipOpen-cont-vip { + background-image: linear-gradient(to right, #fbf6d9, #d4af72, #c89a59); + -webkit-background-clip: text; + color: transparent; + font-weight: 600; + margin-bottom: 5rpx; + font-size: 34rpx; +} + +.vipOpen-cont-vip text { + font-style: oblique; + padding-right: 13rpx; +} + +.vipOpen-cont-tips { + color: #f4e1c4; + font-size: 26rpx; +} + +.vipOpen-btn { + position: absolute; + top: 45rpx; + right: 50rpx; + display: flex; + z-index: 9; + line-height: 30rpx; + color: #f4e1c4; + font-size: 28rpx; +} + +.vipOpen-btn-arrow { + width: 30rpx; + height: 30rpx; + margin: 2rpx 0 0 6rpx; +} + +/* 参数 */ +.goodsItem { + padding: 30rpx 30rpx 0; +} + +.goodsItem-label { + display: flex; +} + +.goodsItem-label-name { + color: #999999; + width: 120rpx; + line-height: 110rpx; +} + +.goodsItem-label-see { + display: flex; + width: calc(100% - 120rpx); + background-color: #f7faff; + padding: 10rpx 0; + border-radius: 15rpx; +} + +.goodsItem-label-block { + flex: 3; + text-align: center; + font-size: 26rpx; + position: relative; +} + +.goodsItem-label-block::after { + position: absolute; + content: ''; + background-color: #d1d1d1; + width: 1rpx; + height: 60%; + top: 20%; + left: 0; +} + +.goodsItem-label-block:first-child::after { + display: none; +} + +.goodsItem-label-title { + color: #3b7cff; + line-height: 50rpx; +} + +.goodsItem-label-tips { + color: #999999; +} + +.goodsItem-label-text { + line-height: 110rpx; +} + +/* 详情 */ +.goodsBrief { + padding: 30rpx; + box-sizing: border-box; +} + +/* 底部 */ +.footer { + width: 100%; + height: 60px; + background-color: #ffffff; + position: fixed; + left: 0; + bottom: 0; + z-index: 9; + box-sizing: border-box; + display: flex; +} + +.number { + flex: 1; + line-height: 60px; + color: #ff9951; + display: flex; + padding: 0 30rpx; + box-sizing: border-box; +} + +.number text { + font-size: 28rpx; + padding-top: 10rpx; +} + +.number-price { + padding: 0 5rpx; + font-size: 52rpx; +} + +.number-vip { + margin-left: 20rpx; + font-size: 26rpx; + color: #8d97a1; + padding-top: 6rpx; + box-sizing: border-box; +} + + +.btn { + height: 100%; + background-color: #ff9951; + text-align: center; + color: #FFFFFF; + padding: 0 70rpx; + line-height: 60px; +} + +.detailsBrief-back { + width: 100%; +} + +/* 产品分享弹窗 */ +.goodsShare { + width: 100%; + z-index: 9999; + position: fixed; + bottom: 340rpx; + left: 0; + padding: 40rpx; + box-sizing: border-box; + display: none; +} + +.goodsShare.active { + display: block; +} + +.goodsShare-back { + width: 80%; + margin: 0 auto; + background-color: #ffffff; + border-radius: 15rpx; + overflow: hidden; +} + +.goodsShare-photo { + width: 100%; +} + +.goodsShare-cont { + padding: 30rpx; + box-sizing: border-box; +} + +.goodsShare-name { + font-size: 36rpx; +} + +.goodsShare-price { + font-size: 52rpx; + color: #3b7cff; +} + +.goodsShare-price text { + font-size: 30rpx; +} + +.goodsShare-see { + position: relative; + padding: 40rpx 0 20rpx; +} + +.goodsShare-tips { + font-size: 28rpx; + color: #b3b3b3; + margin-top: 10rpx; +} + +.goodsShare-code { + width: 130rpx; + height: 130rpx; + position: absolute; + right: 0; + top: 30rpx; +} + +/* 分享弹出 */ + +.shareBack { + position: fixed; + width: 100vw; + height: 100vh; + z-index: 9900; + left: 0; + bottom: 0; + background-color: rgba(0, 0, 0, .6); + display: none; +} + +.shareBack.active { + display: block; +} + +.sharePop { + position: fixed; + width: 100%; + z-index: 9999; + left: 0; + bottom: 0; + background-color: #ffffff; + display: none; + height: 280rpx; +} + +.sharePop.active { + display: block; +} + +.shareCont-label image { + width: 60rpx; + height: 60rpx; + display: block; + margin: 0 auto 10rpx; +} + +.shareCancel { + border-top: 2rpx solid #dddddd; + width: 100%; + text-align: center; + line-height: 100rpx; +} + +.shareCont { + display: flex; + padding: 30rpx 0; +} + +.shareCont-label { + flex: 2; + text-align: center; + font-size: 28rpx; +} + +.codeShare-button { + background-color: transparent; + padding: 0; + font-weight: normal; +} + +/* canvas */ +.canvas-img { + position: fixed; + left: -100000%; + top: 0; + z-index: 99; +} + + +/* 邀请码弹出 */ +.namePop { + position: fixed; + background-color: rgba(0, 0, 0, .5); + left: 0; + top: 0; + height: 100vh; + width: 100vw; + z-index: 100000; + display: none; +} + +.namePop.active { + display: block; +} + +.nameCont { + -webkit-box-orient: vertical; + -webkit-box-pack: center; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 100000; + padding: 0 15%; + box-sizing: border-box; + display: none; +} + +.nameCont.active { + display: -webkit-box; +} + +.nameCont-white { + background-color: #ffffff; + border-radius: 15rpx; + overflow: hidden; +} + +.nameCont-top { + padding: 30rpx; + box-sizing: border-box; +} + +.nameCont-title { + font-size: 34rpx; + margin-bottom: 30rpx; +} + +.nameCont-input { + height: 90rpx; + line-height: 90rpx; + position: relative; + background-color: #f3f3f3; + border-radius: 10rpx; + overflow: hidden; + padding: 0 25rpx; + box-sizing: border-box; +} + +.nameCont-input input { + width: calc(100% - 40rpx); + height: 100%; + background-color: transparent; +} + +.nameCont-colse { + width: 40rpx; + height: 40rpx; + top: 25rpx; + right: 20rpx; + position: absolute; + z-index: 9; +} + +.nameCont-btn { + line-height: 100rpx; + background-color: #f3f3f3; + display: flex; + margin-top: 30rpx; + border-top: 2rpx solid #dfdfdf; +} + +.nameCont-btn-go { + text-align: center; + flex: 2; +} + +.nameCont-btn-go:last-child { + position: relative; + color: #ff9951; +} + +.nameCont-btn-go:last-child::after { + position: absolute; + content: ''; + left: 0; + top: 0; + width: 2rpx; + height: 100%; + background-color: #dfdfdf; +} \ No newline at end of file diff --git a/pages/mall/index.js b/pages/mall/index.js new file mode 100644 index 0000000..b42c480 --- /dev/null +++ b/pages/mall/index.js @@ -0,0 +1,32 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + goodsArr: [] //商品列表 + }, + + onLoad(options) { + if(options.invite != undefined) { + getApp().globalData.inviteText = options.invite + } + }, + + onShow() { + // 获取产品首页 + this.mallInfo(); + }, + + /** + * 产品首页 + */ + mallInfo (){ + wx.$api.mall.mallIndex().then(res => { + this.setData({ + goodsArr: res.data.goods + }) + }).catch(err => { }) + }, +}) diff --git a/pages/mall/index.json b/pages/mall/index.json new file mode 100644 index 0000000..224c4c5 --- /dev/null +++ b/pages/mall/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "产品" +} \ No newline at end of file diff --git a/pages/mall/index.wxml b/pages/mall/index.wxml new file mode 100644 index 0000000..0d34e2e --- /dev/null +++ b/pages/mall/index.wxml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + 使用场景 + + 使用方法 + + + + 1.手握瓶身,距离肌肤15公分距离,Z字型喷在脸上; + + + + 2.等待自然风干或用面纸轻轻按压,吸走多余水分; + + + + + + + + 必Buy推荐 + + + + + + + + + + 市场指导价 + ¥{{item.price.price}}/{{item.number}}瓶 + + + VIP会员价 + ¥{{item.price.vip}}/{{item.number}}瓶 + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mall/index.wxss b/pages/mall/index.wxss new file mode 100644 index 0000000..5f0645c --- /dev/null +++ b/pages/mall/index.wxss @@ -0,0 +1,194 @@ +page { + background-color: #f7faff; +} + +/* 产品轮播 */ +.mallBanner { + padding: 30rpx; + box-sizing: border-box; + width: 100%; +} + +.mallBanner-cont { + position: relative; + border-radius: 20rpx; + padding-top: 45%; + overflow: hidden; + box-shadow: 0 0 20rpx rgba(0, 0, 0, .2); +} + +.mallBanner-see, +.mallBanner-img { + border-radius: 20rpx; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +/* 修改dot形状 */ +.wx-swiper-dots.wx-swiper-dots-horizontal { + bottom: 25rpx; +} +.wx-swiper-dots .wx-swiper-dot { + width: 32rpx; /*宽*/ + height: 12rpx; /*高*/ + border-radius: 10rpx; /*圆角*/ + background-color: transparent; + border: 4rpx solid #ffffff; + box-sizing: border-box; +} + +.wx-swiper-dot-active { + background-color:#ffffff !important; +} + +/* 使用场景 */ +.scene { + padding: 30rpx; + box-sizing: border-box; +} + +.sceneCont { + background-color: #ffffff; + padding: 30rpx; + box-sizing: border-box; + border-radius: 20rpx; +} + +.sceneCont-title { + text-align: center; + font-weight: 600; + font-size: 34rpx; +} + +.sceneCont-img { + width: 100%; + margin: 30rpx 0; +} + +.sceneCont-item { + display: flex; +} + +.sceneCont-label { + flex: 2; + text-align: center; +} + +.sceneCont-label-img { + width: 150rpx; + height: 150rpx; + box-shadow: 0 0 20rpx rgba(0, 0, 0, .2); + border-radius: 50%; + margin-bottom: 15rpx; +} + +.sceneCont-label-text { + font-size: 24rpx; + font-weight: 300; + padding: 0 15rpx; + text-align: center; +} + +/* 列表 */ +.goods { + padding: 30rpx; + box-sizing: border-box; +} + +.goodsTilte { + font-weight: 600; + font-size: 36rpx; +} + +.goodsCont-item { + position: relative; + border-radius: 20rpx; + overflow: hidden; + width: 100%; + padding-top: 100%; + margin-top: 30rpx; +} + +.goodsCont-item-back, +.goodsCont-item-cont { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; +} + +.goodsCont-item-cont { + padding: 30rpx 15rpx; + box-sizing: border-box; +} + +.goodsCont-item-photo { + width: 100%; + display: block; +} + +.goodsCont-item-price { + position: relative; + padding-top: 15%; +} +.goodsCont-item-price-back, +.goodsCont-item-price-cont { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; +} + +.goodsCont-item-price-back { + display: block; +} + +.goodsCont-item-price-cont { + padding: 14rpx 40rpx; + box-sizing: border-box; + display: flex; +} + +.goodsCont-item-price-text { + font-size: 22rpx; +} + +.goodsCont-item-price-left { + flex: 1; +} + +.goodsCont-item-price-white { + color: #ffffff; +} + +.goodsCont-item-price-number { + font-size: 24rpx; +} + +.goodsCont-item-price-number text { + font-weight: 600; + font-size: 40rpx; + padding-left: 6rpx; +} + +.goodsCont-item-price-right { + width: 26%; + text-align: center; +} + +/* 皮肤护理 */ +.nurse { + width: 100%; + padding: 30rpx; + box-sizing: border-box; +} + +.nurse-img { + border-radius: 20rpx; + width: 100%; +} \ No newline at end of file diff --git a/pages/mall/list/list.js b/pages/mall/list/list.js new file mode 100644 index 0000000..6d0a544 --- /dev/null +++ b/pages/mall/list/list.js @@ -0,0 +1,62 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + goodsArr : [], // 商品列表 + page : {}, // 分页信息 + lodingStats : false, // 加载状态 + }, + + onLoad(options) { + + }, + + onShow() { + // 获取产品列表 + this.mallInfo(); + }, + + /** + * 获取产品列表 + */ + mallInfo (page){ + wx.$api.mall.mallList({page : page || 1}).then(res => { + let listArr = this.data.goodsArr, + newData = [] + if(page == 1 || page == undefined) listArr = [] + newData = listArr.concat(res.data.data) + this.setData({ + goodsArr : newData, + page : res.data.page, + lodingStats : false + }) + wx.stopPullDownRefresh() + }).catch(err => { }) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + // 获取产品列表 + this.mallInfo(); + }, + + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let pageNumber = this.data.page.current + if(this.data.page.has_more){ + pageNumber++ + // 获取产品列表 + this.mallInfo(pageNumber); + } + } +}) diff --git a/pages/mall/list/list.json b/pages/mall/list/list.json new file mode 100644 index 0000000..c2ef54a --- /dev/null +++ b/pages/mall/list/list.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "产品列表" +} \ No newline at end of file diff --git a/pages/mall/list/list.wxml b/pages/mall/list/list.wxml new file mode 100644 index 0000000..62c75f1 --- /dev/null +++ b/pages/mall/list/list.wxml @@ -0,0 +1,31 @@ + + + + + + + {{item.name}} + {{item.description}} + + {{item.price.vip}}VIP + 原价¥{{item.price.price}} + + + 立即购买 + + + + + + 加载中... + + + 没有更多了~ + + + + + + 暂无数据 + + \ No newline at end of file diff --git a/pages/mall/list/list.wxss b/pages/mall/list/list.wxss new file mode 100644 index 0000000..40e6c86 --- /dev/null +++ b/pages/mall/list/list.wxss @@ -0,0 +1,121 @@ +page { + background-color: #f7faff; +} + +/* 产品列表 */ +.product { + width: 100%; + padding: 30rpx 30rpx 0; + box-sizing: border-box; +} + +.product-title { + font-size: 36rpx; +} + +.product-item { + position: relative; + height: 340rpx; +} + +.product-item-img { + position: absolute; + top: 0; + width: 300rpx; + height: 300rpx; + border-radius: 15rpx; +} + +.product-item-cont { + height: 300rpx; + position: absolute; + top: 0; + left: 0; + width: 100%; + box-sizing: border-box; +} + +.product-item-title { + line-height: 74rpx; + font-size: 32rpx; +} + +.product-item-specs, +.product-item-number { + font-size: 24rpx; + color: #999999; +} + +.product-item-number { + float: right; +} + +.product-item-see { + margin: 30rpx 0 20rpx; + line-height: 48rpx; + overflow: hidden; +} + +.product-item-price { + font-size: 38rpx; + position: relative; + float: left; +} + +.product-item-vip { + position: absolute; + font-size: 20rpx; + top: 0; + right: -60rpx; + background-color: #ff9951; + color: #ffffff; + display: inline-block; + border-radius: 8rpx; + padding: 0 10rpx; + line-height: 32rpx; + transform: scale(.8); +} + +.product-item-vip:before { + content: ""; + display: block; + position: absolute; + top: 50%; + left: -18rpx; + width: 0; + height: 0; + border: 10rpx solid; + margin-top: -10rpx; + border-color: transparent #ff9951 transparent transparent; +} + +.product-item-price text { + font-size: 24rpx; +} + +.product-item-btn { + font-size: 26rpx; + background-color: #ffffff; + border-radius: 80rpx; + height: 76rpx; + line-height: 76rpx; + border: 2rpx solid #000000; + text-align: center; + display: inline-block; + width: 96%; + margin-left: 2%; +} + +.product-item-arrow { + width: 18rpx; + height: 18rpx; + margin-left: 6rpx; +} + +.product-item .product-item-img { + left: 0; +} + +.product-item .product-item-cont { + padding-left: 340rpx; +} \ No newline at end of file diff --git a/pages/mall/webView/webView.js b/pages/mall/webView/webView.js new file mode 100644 index 0000000..24673b6 --- /dev/null +++ b/pages/mall/webView/webView.js @@ -0,0 +1,68 @@ +// pages/mall/webView/webView.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + h5url: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + h5url: decodeURIComponent(options.url) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/mall/webView/webView.json b/pages/mall/webView/webView.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/pages/mall/webView/webView.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mall/webView/webView.wxml b/pages/mall/webView/webView.wxml new file mode 100644 index 0000000..cb63700 --- /dev/null +++ b/pages/mall/webView/webView.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pages/mall/webView/webView.wxss b/pages/mall/webView/webView.wxss new file mode 100644 index 0000000..b021913 --- /dev/null +++ b/pages/mall/webView/webView.wxss @@ -0,0 +1 @@ +/* pages/mall/webView/webView.wxss */ \ No newline at end of file diff --git a/pages/mall/商品老版本/index.js b/pages/mall/商品老版本/index.js new file mode 100644 index 0000000..b42c480 --- /dev/null +++ b/pages/mall/商品老版本/index.js @@ -0,0 +1,32 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + goodsArr: [] //商品列表 + }, + + onLoad(options) { + if(options.invite != undefined) { + getApp().globalData.inviteText = options.invite + } + }, + + onShow() { + // 获取产品首页 + this.mallInfo(); + }, + + /** + * 产品首页 + */ + mallInfo (){ + wx.$api.mall.mallIndex().then(res => { + this.setData({ + goodsArr: res.data.goods + }) + }).catch(err => { }) + }, +}) diff --git a/pages/mall/商品老版本/index.json b/pages/mall/商品老版本/index.json new file mode 100644 index 0000000..224c4c5 --- /dev/null +++ b/pages/mall/商品老版本/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "产品" +} \ No newline at end of file diff --git a/pages/mall/商品老版本/index.wxml b/pages/mall/商品老版本/index.wxml new file mode 100644 index 0000000..fb47c50 --- /dev/null +++ b/pages/mall/商品老版本/index.wxml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + 必Buy推荐 + + + + + {{item.name}} + {{item.description}} + + {{item.price.vip}}VIP + 原价¥{{item.price.price}} + + + 立即购买 + + + + + + + + + + diff --git a/pages/mall/商品老版本/index.wxss b/pages/mall/商品老版本/index.wxss new file mode 100644 index 0000000..7ce3a6c --- /dev/null +++ b/pages/mall/商品老版本/index.wxss @@ -0,0 +1,169 @@ +page { + background-color: #f7faff; +} + +/* 产品轮播 */ +.mallBanner { + padding: 30rpx; + box-sizing: border-box; + width: 100%; +} + +.mallBanner-cont { + position: relative; + border-radius: 20rpx; + padding-top: 45%; + overflow: hidden; +} + +.mallBanner-see, +.mallBanner-img { + border-radius: 20rpx; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +/* 产品列表 */ +.product { + width: 100%; + padding: 10rpx 30rpx 0; + box-sizing: border-box; +} + +.product-title { + font-size: 36rpx; +} + +.product-list { + margin: 30rpx 0; +} + +.product-item { + position: relative; + height: 340rpx; +} + +.product-item-img { + position: absolute; + top: 0; + width: 300rpx; + height: 300rpx; + border-radius: 15rpx; +} + +.product-item-cont { + height: 300rpx; + position: absolute; + top: 0; + left: 0; + width: 100%; + box-sizing: border-box; +} + +.product-item-title { + line-height: 74rpx; + font-size: 32rpx; +} + +.product-item-specs, +.product-item-number { + font-size: 24rpx; + color: #999999; +} + +.product-item-number { + float: right; +} + +.product-item-see { + margin: 30rpx 0 20rpx; + line-height: 48rpx; + overflow: hidden; +} + +.product-item-price { + font-size: 38rpx; + position: relative; + float: left; +} + +.product-item-vip { + position: absolute; + font-size: 20rpx; + top: 0; + right: -60rpx; + background-color: #ff9951; + color: #ffffff; + display: inline-block; + border-radius: 8rpx; + padding: 0 10rpx; + line-height: 32rpx; + transform: scale(.8); +} + +.product-item-vip:before { + content: ""; + display: block; + position: absolute; + top: 50%; + left: -18rpx; + width: 0; + height: 0; + border: 10rpx solid; + margin-top: -10rpx; + border-color: transparent #ff9951 transparent transparent; +} + +.product-item-price text { + font-size: 24rpx; +} + +.product-item-btn { + font-size: 26rpx; + background-color: #ffffff; + border-radius: 80rpx; + height: 76rpx; + line-height: 76rpx; + border: 2rpx solid #000000; + text-align: center; + display: inline-block; + width: 96%; + margin-left: 2%; +} + +.product-item-arrow { + width: 18rpx; + height: 18rpx; + margin-left: 6rpx; +} + +.product-item:nth-child(odd) .product-item-img { + left: 0; +} + +.product-item:nth-child(odd) .product-item-cont { + padding-left: 340rpx; +} + +.product-item:nth-child(even) .product-item-img { + right: 0; +} + +.product-item:nth-child(even) .product-item-cont { + padding-right: 340rpx; +} + +/* 皮肤护理 */ +.nurse { + width: 100%; + padding: 0 30rpx 30rpx; + box-sizing: border-box; +} + +.nurse-img { + border-radius: 20rpx; + width: 100%; +} \ No newline at end of file diff --git a/pages/order/details/details.js b/pages/order/details/details.js new file mode 100644 index 0000000..f5ce171 --- /dev/null +++ b/pages/order/details/details.js @@ -0,0 +1,133 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + goodsData : '', //详情 + canState : '', //操作按钮 + express : '', //物流 + orderNo : '' //订单号 + }, + + onLoad(options) { + this.setData({ + orderNo: options.order_no + }) + }, + + onShow() { + // 获取订单详情 + this.goodsInfo(); + }, + + /** + * 订单详情 + */ + goodsInfo() { + wx.$api.order.goodsDet(this.data.orderNo).then(res => { + this.setData({ + goodsData : res.data, + canState : res.data.can, + express : res.data.express + }) + }).catch(err => {}) + }, + + /** + * 复制订单号 + */ + copyUrl(val) { + wx.setClipboardData({ + data: val.currentTarget.dataset.no, + success: () => { + wx.showToast({ + title: "订单编号复制成功", + icon : "none" + }) + } + }) + }, + + /** + * 支付订单 + */ + payClick() { + wx.navigateTo({ + url: '/pages/pay/index?order_no=' + this.data.goodsData.order_no + '&total=' + this.data.goodsData.total + }) + }, + + /** + * 订单签收 + */ + signClick(e) { + wx.showModal({ + title : '提示', + content : '是否签收', + success : res=> { + if (res.confirm) { + wx.$api.order.goodsSign(this.data.goodsData.order_no).then(res => { + wx.showToast({ + title:'签收成功', + icon:'none' + }) + + // 获取订单详情 + this.goodsInfo(); + }).catch(err => {}) + } + } + }) + }, + + /** + * 取消订单 + */ + cancelClick(e) { + wx.showModal({ + title : '提示', + content : '是否取消订单', + success : res=> { + if (res.confirm) { + wx.$api.order.goodsCancel(this.data.goodsData.order_no).then(res => { + wx.showToast({ + title:'取消成功', + icon:'none' + }) + + // 回到列表 + wx.navigateBack(1) + }).catch(err => {}) + } + } + }) + }, + + /** + * 复制物流单号 + */ + copyExpress(val) { + wx.setClipboardData({ + data: val.currentTarget.dataset.no, + success: () => { + wx.showToast({ + title: "物流单号复制成功", + icon : "none" + }) + } + }) + }, + + // 查看物流 + h5url() { + // wx.navigateTo({ + // url: '/pages/mall/webView/webView?url=' + this.data.goodsData.express.url, + // }) + var data = JSON.stringify(this.data.goodsData.express) + wx.navigateTo({ + url: `../logistic/logistic?newData=` + encodeURIComponent(data) + }) + } +}) diff --git a/pages/order/details/details.json b/pages/order/details/details.json new file mode 100644 index 0000000..7418a99 --- /dev/null +++ b/pages/order/details/details.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "订单详情" +} \ No newline at end of file diff --git a/pages/order/details/details.wxml b/pages/order/details/details.wxml new file mode 100644 index 0000000..47565d5 --- /dev/null +++ b/pages/order/details/details.wxml @@ -0,0 +1,94 @@ + + + + + + 订单编号 + + {{goodsData.order_no}} + 复制 + + + + + + + {{ goodsData.express.name }} {{ goodsData.express.mobile }} + + {{ goodsData.express.full_address }} + + + + + + + + + + {{item.sku.goods_name}} + + 规格 99mlx{{item.qty}} + + + ¥{{item.price}} + + + + + + + 订单信息 + + 交易时间 + {{goodsData.created_at}} + + + 运费 + {{goodsData.freight == 0 ? '免邮' : goodsData.freight + '元'}} + + + 交易状态 + {{goodsData.state}} + + + 兑换券使用 + {{goodsData.coupon_qty}}张 + + + 兑换券抵值 + ¥{{goodsData.coupon_price}} + + + 实付款 + ¥{{goodsData.total}} + + + + + 物流信息 + + 物流名称 + {{goodsData.express.express_name}} + + + 物流单号 + + {{goodsData.express.express_no}}复制 + + + + 查看物流信息 + + 去查看 + + + + + + + 取消订单 + 立即付款 + 签收订单 + 返回订单 + + \ No newline at end of file diff --git a/pages/order/details/details.wxss b/pages/order/details/details.wxss new file mode 100644 index 0000000..1127882 --- /dev/null +++ b/pages/order/details/details.wxss @@ -0,0 +1,234 @@ +page { + background: #f3f4f6; + padding: 30rpx; + box-sizing: border-box; +} + +.While { + border-radius: 10rpx; + margin-bottom: 30rpx; + background-color: #FFFFFF; + box-shadow: 0 0 10rpx rgba(0, 0, 0, .05); +} + +.orderData { + border-bottom: 100rpx transparent solid; +} + +/* 订单 */ +.orderData-cont-label { + padding: 40rpx 30rpx; + display: flex; + box-sizing: border-box; + border-bottom: #f2f2f2 2rpx solid; +} + +.orderData-cont-img { + width: 38rpx; + height: 38rpx; + margin-top: 4rpx; +} + +.orderData-cont-text { + width: calc(100% - 68rpx); + margin-left: 20rpx; + box-sizing: border-box; + font-size: 30rpx; +} + +.orderData-cont-site { + width: calc(100% - 108rpx); +} + +.orderData-cont-name { + margin-bottom: 10rpx; +} + +.orderData-cont-name text { + color: #999; + padding-left: 20rpx; +} + +.orderData-cont-copy { + display: flex; + font-size: 28rpx; + color: #999; +} + +.orderData-cont-copy text { + flex: 1; + display: inline-block; + margin-right: 20rpx; +} + +.orderData-cont-copy view { + color: #3b7cff; +} + +.address-btn { + width: 42rpx; + height: 42rpx; + margin-top: 46rpx; +} + +/* 产品 */ +.list-goods { + display: flex; + padding: 30rpx; + box-sizing: border-box; +} + +.list-goods-img { + width: 184rpx; + height: 184rpx; + margin-right: 30rpx; + border-radius: 10rpx; +} + +.list-goods-cont { + width: calc(100% - 214rpx); +} + +.list-goods-name { + font-size: 32rpx; +} + +.list-goods-text { + line-height: 90rpx; + display: flex; + font-size: 28rpx; + color: #999999; +} + +.list-goods-text text { + flex: 1; +} + +.list-goods-parice { + text-align: right; + font-size: 28rpx; +} + +.list-goods-parice text { + font-size: 34rpx; +} + +/* 规格 */ +.reserveCont-title { + padding: 30rpx; + font-size: 30rpx; +} + +.reserve-label { + display: flex; + padding: 0 30rpx 30rpx; + box-sizing: border-box; + font-size: 28rpx; + line-height: 48rpx; +} + +.reserve-name { + flex: 1; + width: 200rpx; + margin-right: 20rpx; + color: #7e7e7e; +} + +.reserve-text { + width: calc(100% - 240rpx); + text-align: right; + line-height: 50rpx; +} + +.reserve-text-btn { + width: 120rpx; + text-align: center; + color: #ffffff; + background-color: #3b7cff; + font-size: 26rpx; + border-radius: 10rpx; + line-height: 54rpx; +} + +.reserve-text-copy { + display: contents; +} + +.reserve-text-tap { + color: #ff9951; + padding-left: 30rpx; +} + +.reserve-text text { + font-size: 24rpx; + display: inline-block; + background-image: linear-gradient(to right, #f16e06, #f34206); + color: #FFFFFF; + border-radius: 6rpx; + padding: 0 10rpx; + height: 44rpx; + line-height: 44rpx; + margin-top: 6rpx; +} + +.reserve-text text.active { + background-image: linear-gradient(to right, #027be6, #2855f0); +} + +.reserve-text.reserve-price { + font-weight: 600; + font-size: 34rpx; +} + +.reserve-copy { + color: #3b7cff; + border: #3b7cff 2rpx solid; + display: inline-block; + height: 34rpx; + line-height: 34rpx; + font-size: 26rpx; + padding: 0 10rpx; + border-radius: 4rpx; + margin-left: 10rpx; +} + +.reserve-status { + color: #ff8100 +} + +/* 底部菜单 */ +.order-data-footer { + position: fixed; + bottom: 0; + left: 0; + right: 0; + border-top: solid 1rpx #f2f2f2; + padding-top: 20rpx; + padding-right: 30rpx; + padding-left: 30rpx; + height: 110rpx; + background: white; + flex-wrap: wrap; + flex-direction: row-reverse; + z-index: 9; +} + +.list-btn { + text-align: right; +} + +.order-btn { + border: 2rpx solid #ff8100; + color: #ff8100; + border-radius: 80rpx; + height: 56rpx; + line-height: 56rpx; + padding: 0 20rpx; + display: inline-block; + font-size: 26rpx; + margin-left: 30rpx; +} +.order-btn.grey { + color: grey; + border-color: grey; +} \ No newline at end of file diff --git a/pages/order/index.js b/pages/order/index.js new file mode 100644 index 0000000..8e1e0f7 --- /dev/null +++ b/pages/order/index.js @@ -0,0 +1,141 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + listType : '', // 订单状态 + listsArr : [], // 订单列表 + page : {}, // 分页信息 + lodingStats : false,// 加载状态 + }, + + onLoad(options) { + this.setData({ + listType: options.list_type + }) + }, + + onShow() { + // 获取订单列表 + this.listInfo() + }, + + /** + * 订单列表 + */ + listInfo(page) { + wx.$api.order.list({ + state: this.data.listType, + page : page || 1 + }).then(res => { + let listArr = this.data.listsArr, + newData = [] + if(page == 1 || page == undefined) listArr = [] + newData = listArr.concat(res.data.data) + this.setData({ + listsArr : newData, + page : res.data.page, + lodingStats : false + }) + wx.stopPullDownRefresh() + }).catch(err => {}) + }, + + /** + * 状态筛选 + */ + onTabs(val){ + if(this.data.listType === val) return + this.setData({ + listType: val.currentTarget.dataset.type + }) + + // 获取订单列表 + this.listInfo() + }, + + /** + * 支付订单 + */ + payClick(e) { + wx.navigateTo({ + url: '/pages/pay/index?order_no=' + e.currentTarget.dataset.order_no + '&total=' + e.currentTarget.dataset.total + }) + }, + + /** + * 更多操作 + */ + operateMore(e) { + wx.showActionSheet({ + itemList: ['取消订单'], + success: ()=> { + wx.showModal({ + title : '提示', + content : '是否取消订单', + success : res=> { + if (res.confirm) { + wx.$api.order.goodsCancel(e.currentTarget.dataset.order_no).then(res => { + wx.showToast({ + title:'取消成功', + icon:'none' + }) + // 获取订单列表 + this.listInfo() + }).catch(err => {}) + } + } + }) + }, + fail: err=> {} + }) + }, + + /** + * 订单签收 + */ + signClick(e) { + wx.showModal({ + title : '提示', + content : '是否签收', + success : res=> { + if (res.confirm) { + wx.$api.order.goodsSign(e.currentTarget.dataset.order_no).then(res => { + wx.showToast({ + title:'签收成功', + icon:'none' + }) + + // 获取订单列表 + this.listInfo() + }).catch(err => {}) + } + } + }) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + // 获取订单列表 + this.listInfo(); + }, + + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let pageNumber = this.data.page.current + if(this.data.page.has_more){ + pageNumber++ + // 获取订单列表 + this.listInfo(pageNumber); + } + } +}) diff --git a/pages/order/index.json b/pages/order/index.json new file mode 100644 index 0000000..e3130c7 --- /dev/null +++ b/pages/order/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "我的订单" +} \ No newline at end of file diff --git a/pages/order/index.wxml b/pages/order/index.wxml new file mode 100644 index 0000000..c1dc192 --- /dev/null +++ b/pages/order/index.wxml @@ -0,0 +1,66 @@ + + + 全部 + 待付款 + 待发货 + 待收货 + 已签收 + + + + + + + 订单编号{{item.order_no}} + {{item.state}} + + + + + {{goodItem.sku.goods_name}} + + 规格 99mlx{{goodItem.qty}} + + + ¥{{goodItem.sku.price}} + + + + + 需付款 + {{item.total}} + + + 兑换券兑换 + + + + 收货城市 + + {{item.province_city}} + + + + 更多 + + + 立即付款 + 签收订单 + 查看详情 + + + + + + 加载中... + + + 没有更多了~ + + + + + + + 暂无数据 + \ No newline at end of file diff --git a/pages/order/index.wxss b/pages/order/index.wxss new file mode 100644 index 0000000..db234d1 --- /dev/null +++ b/pages/order/index.wxss @@ -0,0 +1,174 @@ +page { + background-color: #f7faff; +} + +/* tabs */ +.header { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 99; + height: 100rpx; + background-color: #f7faff; +} + +.tabs { + display: flex; + justify-content: space-around; + padding: 30rpx 10rpx; + font-size: 30rpx; + color: #3c3d3e; +} + +.tabs-item.show { + color: #3b7cff; +} + +/* 列表 */ +.list { + padding: 20rpx 30rpx 30rpx; + box-sizing: border-box; + margin-top: 100rpx; +} + +.list-item { + background-color: #ffffff; + border-radius: 20rpx; + padding: 30rpx; + box-sizing: border-box; + margin-bottom: 30rpx; + box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05); +} + +.list-top { + display: flex; + margin-bottom: 30rpx; + line-height: 48rpx; +} + +.list-top-no { + flex: 1; +} + +.list-top-status { + color: #ff8100; +} + +.list-goods { + display: flex; +} + +.list-goods-img { + width: 184rpx; + height: 184rpx; + margin-right: 30rpx; + border-radius: 10rpx; +} + +.list-goods-cont { + width: calc(100% - 214rpx); +} + +.list-goods-name { + font-size: 32rpx; +} + +.list-goods-text { + line-height: 90rpx; + display: flex; + font-size: 28rpx; + color: #999999; +} + +.list-goods-text text { + flex: 1; +} + +.list-goods-parice { + text-align: right; + font-size: 28rpx; +} + +.list-goods-parice text { + font-size: 34rpx; +} + +.list-total { + text-align: right; + margin-top: 30rpx; + font-size: 32rpx; +} + +.list-total.active { + color: #3b7cff; +} + +.list-total text { + font-size: 30rpx; +} + +.list-total-price { + display: inline-block; + font-weight: 600; + font-size: 38rpx; +} + +.list-tips { + background-color: #f7faff; + display: flex; + padding: 20rpx 30rpx; + box-sizing: border-box; + margin: 30rpx 0 40rpx; + border-radius: 10rpx; + line-height: 44rpx; + font-size: 28rpx; +} + +.list-tips-left { + display: flex; + margin-right: 40rpx; +} + +.list-tips-img { + width: 44rpx; + height: 44rpx; + margin-right: 10rpx; +} + +.list-tips-right { + color: #707070; + width: calc(100% - 210rpx); +} + +.list-operate { + display: flex; +} + +.list-more { + flex: 1; + line-height: 56rpx; + font-size: 26rpx; + color: #999999; +} + +.list-btn { + text-align: right; +} + +.list-btn-labor { + border: 2rpx solid #ff8100; + color: #ff8100; + border-radius: 80rpx; + height: 56rpx; + line-height: 56rpx; + padding: 0 25rpx; + display: inline-block; + font-size: 26rpx; + margin-left: 30rpx; +} + +.list-btn-labor.grey { + color: grey; + border-color: grey; +} \ No newline at end of file diff --git a/pages/order/logistic/logistic.js b/pages/order/logistic/logistic.js new file mode 100644 index 0000000..1c6ea81 --- /dev/null +++ b/pages/order/logistic/logistic.js @@ -0,0 +1,43 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + logisticArr : [], + expressData : '', + }, + + onLoad(options) { + const { + newData = {} + } = options; + const data = JSON.parse(decodeURIComponent(newData)); + this.setData({ + expressData: data + }) + }, + + onShow() { + // 查看物流 + this.h5url(); + }, + + // 查看物流 + h5url() { + wx.$api.order.kuaiDi({express_no: this.data.expressData.express_no}).then(res => { + this.setData({ + logisticArr: res.data.data + }) + }).catch(err => {}) + // wx.request({ + // url: 'http://shanhe.kim/api/za/kuaidi.php?id=' + this.data.expressData.express_no, //需更换需请求数据的接口 + // success: res=> { + // this.setData({ + // logisticArr: res.data.data + // }) + // }, + // }); + } +}) diff --git a/pages/order/logistic/logistic.json b/pages/order/logistic/logistic.json new file mode 100644 index 0000000..e2aeb4c --- /dev/null +++ b/pages/order/logistic/logistic.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "物流信息" +} \ No newline at end of file diff --git a/pages/order/logistic/logistic.wxml b/pages/order/logistic/logistic.wxml new file mode 100644 index 0000000..5bf0bc3 --- /dev/null +++ b/pages/order/logistic/logistic.wxml @@ -0,0 +1,44 @@ + + + + + + {{expressData.express_name}} + + {{expressData.express_no}} + + + + {{expressData.name}}{{expressData.mobile}} + + + + + + + 收 + + + {{expressData.full_address}} + + + + + + + {{item.time}} + + + + {{item.context}} + + + + + + + + 暂无物流信息 + \ No newline at end of file diff --git a/pages/order/logistic/logistic.wxss b/pages/order/logistic/logistic.wxss new file mode 100644 index 0000000..b1728ce --- /dev/null +++ b/pages/order/logistic/logistic.wxss @@ -0,0 +1,141 @@ +.top { + background-color: #3b7cff; + padding: 30rpx 30rpx 60rpx; + box-sizing: border-box; + display: flex; +} + +.top-logo { + background-color: #ffffff; + border-radius: 10rpx; + width: 100rpx; + height: 100rpx; + padding: 10rpx; + box-sizing: border-box; +} + +.top-logo image { + width: 100%; + height: 100%; +} + +.top-cont { + color: #ffffff; + width: calc(100% - 130rpx); + margin-left: 30rpx; +} + +.top-name { + display: flex; + line-height: 44rpx; + padding: 10rpx 0; +} + +.top-no { + font-size: 26rpx; + padding-left: 30rpx; + opacity: .9; +} + +.top-type { + font-size: 24rpx; +} + +.top-type text { + padding-left: 20rpx; +} + +.address { + color: #333333; + font-size: 24rpx; + display: flex; + padding: 30rpx 30rpx 0; +} + +.address-tips { + width: 54rpx; + text-align: center; + height: 54rpx; + line-height: 54rpx; + border-radius: 50%; + background-color: #EEEEEE; + margin-left: -15rpx; + font-size: 24rpx +} + +.address-text { + width: calc(100% - 74rpx); + margin-left: 20rpx; + padding-top: 10rpx; +} + +.white { + margin-top: -30rpx; + background-color: #ffffff; + border-radius: 20rpx; +} + +.list { + padding: 0 30rpx; + box-sizing: border-box; +} + +.item { + padding-bottom: 40rpx; + padding-left: 40rpx; + box-sizing: border-box; + position: relative; +} + +.item:first-child { + padding-top: 30rpx; +} + +.item::after { + position: absolute; + content: ''; + background-color: #DDDDDD; + width: 14rpx; + height: 14rpx; + border-radius: 50%; + left: 0; + top: calc(50% - 6rpx); + z-index: 3; + border: 2rpx solid #ffffff; +} + +.item::before { + position: absolute; + content: ''; + background-color: #F0F0F0; + width: 2rpx; + height: 100%; + border-radius: 50%; + left: 8rpx; + top: 0; +} + +.item-name { + display: flex; +} + +.item-status { + font-weight: 600; + padding-right: 20rpx; +} + +.item-time { + color: #868686; +} + +.item-text { + color: #868686; + font-size: 24rpx; + line-height: 40rpx; + margin-top: 20rpx; +} + +.item:first-child .item-time, +.item:first-child .item-text { + color: #ff8100 !important; +} diff --git a/pages/pay/index.js b/pages/pay/index.js new file mode 100644 index 0000000..704fcf9 --- /dev/null +++ b/pages/pay/index.js @@ -0,0 +1,111 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + payCode : '', // code获取openid + openId : '', // openid + orderNo : '', // 订单编号 + total : '', // 订单金额 + paySuccess : false, // 兑换成功显示 + disabled : true + }, + + onLoad(options) { + this.setData({ + orderNo : options.order_no, + total : options.total + }) + }, + + onShow() { + wx.login({ + success: res => { + this.setData({ + payCode: res.code + }) + + // 获取openid + this.openInfo() + } + }) + }, + + /** + * openid + */ + openInfo() { + wx.$api.auth.codeOpenid({code: this.data.payCode}).then(res => { + this.setData({ + openId: res.data + }) + }).catch(err => {}) + }, + + /** + * 确认支付 + */ + payBtn() { + wx.showLoading({ + title: '支付中...', + mask : true + }) + let that = this + wx.$api.mall.mallPay(this.data.orderNo,{type: 'miniapp', openid: this.data.openId}).then(res=>{ + wx.hideLoading() + this.setData({ + disabled: false + }) + let payInfo = JSON.parse(res.data.wechat) + wx.requestPayment({ + timeStamp: payInfo.timeStamp, + nonceStr : payInfo.nonceStr, + package : payInfo.package, + paySign : payInfo.paySign, + signType : payInfo.signType, + success : res=>{ + if(res.errMsg == "requestPayment:ok"){ + wx.showToast({ + title: '支付成功', + icon: 'none', + duration: 2000, + //显示透明蒙层,防止触摸穿透 + mask:true, + success: function () { + that.setData({ + paySuccess: true + }) + setTimeout(()=>{ + wx.redirectTo({ + url: '/pages/order/index?state=paid' + }) + },3000) + } + }) + } + }, + fail : err=>{ + wx.showToast({ + title: '支付失败', + icon: 'none', + duration: 500, + //显示透明蒙层,防止触摸穿透 + mask:true, + success: function () { + that.setData({ + paySuccess: true + }) + setTimeout(()=>{ + wx.redirectTo({ + url: '/pages/order/index?state=unpay' + }) + },3000) + } + }) + } + }) + }).catch(err => {}); + } +}) diff --git a/pages/pay/index.json b/pages/pay/index.json new file mode 100644 index 0000000..98b0432 --- /dev/null +++ b/pages/pay/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "支付订单" +} \ No newline at end of file diff --git a/pages/pay/index.wxml b/pages/pay/index.wxml new file mode 100644 index 0000000..c09abef --- /dev/null +++ b/pages/pay/index.wxml @@ -0,0 +1,23 @@ + + 支付有效期为10分钟,请尽快支付 + {{total}} + 微信支付 + + + + + + 微信支付 + + + + + + 确认支付 + 确认支付 + + + + + 疯狂加载中... + \ No newline at end of file diff --git a/pages/pay/index.wxss b/pages/pay/index.wxss new file mode 100644 index 0000000..43ae7b2 --- /dev/null +++ b/pages/pay/index.wxss @@ -0,0 +1,86 @@ +page { + background-color: #f4f4f6; +} + +.payTop { + text-align: center; + padding: 140rpx 0; +} + +.payTop-price { + font-weight: 600; + font-size: 78rpx; + line-height: 70rpx; + padding: 20rpx 0 0; +} + +.payTop-price text { + font-size: 36rpx; +} + +.payTop-time, +.payTop-text { + font-size: 28rpx; + color: #666666; +} + +.payWay { + padding: 0 30rpx; + box-sizing: border-box; +} + +.payWay-item { + background-color: #ffffff; + border-radius: 15rpx; + padding: 25rpx 30rpx; + box-sizing: border-box; + display: flex; + line-height: 74rpx; + font-size: 34rpx; + position: relative; +} + +.payWay-img { + width: 74rpx; + height: 74rpx; + margin-right: 20rpx; +} + +.payWay-icon { + width: 42rpx; + height: 42rpx; + position: absolute; + right: 30rpx; + top: 40rpx; +} + + +/* 按钮 */ +.footer { + width: 100%; + height: 100px; + background-color: #f4f4f6; + position: fixed; + left: 0; + bottom: 0; + z-index: 9; + padding: 20px 20px 50rpx; + box-sizing: border-box; +} + +.btn { + line-height: 54px; + background-color: #3b7cff; + height: 100%; + text-align: center; + color: #FFFFFF; + border-radius: 10rpx; +} +.btn.active { + background-color: #cacaca; +} + +.grey { + background-color: #f9f9f9; + z-index: 99999; +} \ No newline at end of file diff --git a/pages/report/detail/detail.js b/pages/report/detail/detail.js new file mode 100644 index 0000000..25efa08 --- /dev/null +++ b/pages/report/detail/detail.js @@ -0,0 +1,155 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +var startPoint; +const min = 0; // 最小宽度 单位px +const max = 200; // 最大宽度  单位px + +Page({ + data: { + barHeight : getApp().globalData.barHeight, // 状态栏高度 + isFixedTop : 0, + loading : true, + imageId : '', // 报告id + coverImg : '', // 上传的图片 + analyze : '', // 检测结果 + createdAt : '', // 检测时间 + footerPop : '', //底部菜单优先级 + enlargedNumber : '', // 毛孔总数量 + sensitivityArea: '', // 敏感区域面积 + tactfulFace : false, // 敏感分析 + acneFace : false, // 痤疮 + oldFace : false, //衰老分析 + pigmentFace : false, // 色素分析 + pigmentFace : false, // 黑头分析 + poreStatus : false, // 毛孔 + + zoneArea : '', // 油光占比 额头 + leftcheekArea : '', // 油光占比 左脸颊 + rightcheekArea : '', // 油光占比 右脸颊 + + buttonLeft: 100, + progress: 100, // 进度条的宽度,这里的单位是px,所以在wxml文件中要改为rpx + precent: 50 // 这个是百分比 + }, + + onLoad(options) { + this.setData({ + imageId: options.image_id + }) + + // 获取检测报告结果 + this.aiInfo(options.image_id) + }, + + /** + * 检测报告结果 + */ + aiInfo(imageid) { + wx.$api.health.aiSee(imageid).then(res => { + this.setData({ + loading : false, + createdAt: res.data.created_at, + coverImg: res.data.cover, + analyze : res.data.skin_analyze.result.result, + sensitivityArea: (res.data.skin_analyze.result.result.sensitivity.sensitivity_area * 100).toFixed(3), + enlargedNumber: res.data.skin_analyze.result.result.enlarged_pore_count.forehead_count + res.data.skin_analyze.result.result.enlarged_pore_count.chin_count + res.data.skin_analyze.result.result.enlarged_pore_count.right_cheek_count + res.data.skin_analyze.result.result.enlarged_pore_count.left_cheek_count, + zoneArea : (res.data.skin_analyze.result.result.oily_intensity.t_zone.area * 100).toFixed(1), + leftcheekArea : (res.data.skin_analyze.result.result.oily_intensity.left_cheek.area * 100).toFixed(1), + rightcheekArea : (res.data.skin_analyze.result.result.oily_intensity.right_cheek.area * 100).toFixed(1), + }) + }).catch(err => { }) + }, + + /** + * 返回上一页 + */ + returnGo() { + wx.navigateBack({ + delta: 1 + }) + }, + + /** + * 查看检测图 + */ + faceSee(e) { + this.setData({ + footerPop: !this.data.footerPop, + progress: 100, + precent: 50 + }) + let type = e.currentTarget.dataset.type + if(type == 'old') { + // 衰老 + this.setData({ + oldFace : !this.data.oldFace + }) + } else if(type == 'acne') { + // 痤疮 + this.setData({ + acneFace : !this.data.acneFace + }) + } else if(type == 'tactful') { + // 敏感 + this.setData({ + tactfulFace : !this.data.tactfulFace + }) + } else if(type == 'pigment') { + // 色素性 + this.setData({ + pigmentFace : !this.data.pigmentFace + }) + } else if(type == 'black') { + // 黑头 + this.setData({ + blackFace : !this.data.blackFace + }) + } else if(type == 'pore') { + // 毛孔 + this.setData({ + poreStatus : !this.data.poreStatus + }) + } + + + }, + + /** + * 查看检测图-状态栏 + */ + buttonStart (e) { + startPoint = e.touches[0] + }, + + moveTo(e) { + var endPoint = e.touches[e.touches.length - 1] + var translateX = endPoint.clientX - startPoint.clientX + startPoint = endPoint; + var buttonLeft = this.data.buttonLeft + translateX; + if (buttonLeft > max) { + // 滑动位置大于进度条最大宽度的时候让它为最大宽度 + buttonLeft = max + } + if (buttonLeft < min) { + // 滑动位置小于进度条最大宽度的时候让它为最小宽度 + buttonLeft = min + } + this.setData({ + buttonLeft: buttonLeft, + progress: buttonLeft, + precent:parseInt((buttonLeft/max)*100) + }) + }, + + /** + * 监听页面滑动事件 + */ + onPageScroll(e) { + this.setData({ + isFixedTop: parseInt(e.scrollTop) + }); + }, +}) diff --git a/pages/report/detail/detail.json b/pages/report/detail/detail.json new file mode 100644 index 0000000..f0f1934 --- /dev/null +++ b/pages/report/detail/detail.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom", + "navigationBarTextStyle": "white" +} \ No newline at end of file diff --git a/pages/report/detail/detail.wxml b/pages/report/detail/detail.wxml new file mode 100644 index 0000000..0a942a1 --- /dev/null +++ b/pages/report/detail/detail.wxml @@ -0,0 +1,388 @@ + + + 疯狂加载中 + + + + + + + + + + + {{createdAt.m_d}} + {{createdAt.time}} + + + + + + + + 皮肤概况 + + + + + + + + + 油性肤质 + 干性皮肤 + 中性皮肤 + 混合性皮肤 + + 肤质 + + + + + 透白 + 白皙 + 自然 + 小麦 + 黝黑 + + 肤色 + + + {{analyze.skin_age.value}} + 肌龄 + + + + + + + 油光占比 + + + 额头 + + + + {{zoneArea}}% + + + 左脸颊 + + + + {{leftcheekArea}}% + + + 右脸颊 + + + + {{rightcheekArea}}% + + + + + + + + + 衰老分析 + + + + + + 查看检测图 + + + + + + + + + + + + + + + + + + + + + + + 抬头纹:{{analyze.forehead_wrinkle.value == 0 ? '无' : '有'}} + + + 法令纹:{{analyze.nasolabial_fold.value == 0 ? '无' : '有'}} + + + 鱼尾纹:{{analyze.crows_feet.value == 0 ? '无' : '有'}} + + + 眉间纹:{{analyze.glabella_wrinkle.value == 0 ? '无' : '有'}} + + + 额头区域细纹:{{analyze.fine_line.forehead_count}}处 + + + 左眼部区域细纹:{{analyze.fine_line.left_undereye_count}}处 + + + 右眼部区域细纹:{{analyze.fine_line.right_undereye_count}}处 + + + 额头区域深纹:{{analyze.wrinkle_count.forehead_count}}处 + + + 左眼部区域深纹:{{analyze.wrinkle_count.left_undereye_count}}处 + + + 右眼部区域深纹:{{analyze.wrinkle_count.right_undereye_count}}处 + + + + + + + + 眼袋 + + + + + + + + + 您{{analyze.eye_pouch.value == 0 ? '无' : '有'}}眼袋,{{analyze.eye_pouch.value == 0 ? '没有眼袋正常,可能个人护理比较好' : '受长期不规律作息和年龄增长,皮 肤弹性减弱影响。'}} + + + + + + + + 黑眼圈 + + + + + + + + + 您是{{analyze.dark_circle.value == 0 ? '无' : '有'}}黑眼圈,{{analyze.dark_circle.value == 0 ? '没有黑眼圈通常是生活习惯比较好,主要是平时没有熬夜的习惯' : '可能由长期熬夜、日晒、年龄增长、眼周围皮肤炎症等因素导致'}} + + + + + + + + 敏感度分析 + + + + + + 敏感程度 + {{analyze.sensitivity.sensitivity_intensity}} + + + + + + 敏感区域面积占比 + {{sensitivityArea}}% + + + + + + 查看检测图 + + + + + + + + + + + + + + + + + + + + + + + 毛孔分析 + + + + + + 毛孔数量 + {{enlargedNumber}} + + + + + + 查看检测图 + + + + + + + + + + + + + + + + + + + + + + + 额头粗大毛孔数:{{analyze.enlarged_pore_count.forehead_count}}个 + 下巴粗大毛孔数:{{analyze.enlarged_pore_count.chin_count}}个 + 右脸颊粗大毛孔数:{{analyze.enlarged_pore_count.right_cheek_count}}个 + 左脸颊粗大毛孔数:{{analyze.enlarged_pore_count.left_cheek_count}}个 + + + + + + + + 黑头分析 + + + + + + 黑头分析 + {{analyze.blackhead_count}}个 + + + + + + 查看检测图 + + + + + + + + + + + + + + + + + + + + + + + + + + 色素性分析 + + + + + + 痤疮 + {{analyze.acne.rectangle.length}}处 + + + + + + 闭口粉刺 + {{analyze.closed_comedones.rectangle.length}}处 + + + + + + + 色斑 + {{analyze.brown_spot.rectangle.length}}处 + + + + + + + {{analyze.mole.rectangle.length}}处 + + + + + + 查看检测图 + + + + + + + + + + + + + + + + + + + + + + + + + + + 邀请好友 + 产品推荐 + + + \ No newline at end of file diff --git a/pages/report/detail/detail.wxss b/pages/report/detail/detail.wxss new file mode 100644 index 0000000..a1e6e69 --- /dev/null +++ b/pages/report/detail/detail.wxss @@ -0,0 +1,619 @@ +page { + background-color: #f7faff; +} + + +.grey { + background-color: #f9f9f9; +} + +/* 返回 */ +.navigation { + position: fixed; + top: 0; + left: 0; + z-index: 1999; + width: 100%; + height: 90rpx; + background-color: transparent; + transition: .2s; +} + +.navigation.active { + background-color: transparent; +} + +.navigation-arrow { + width: 44rpx; + height: 44rpx; + margin: 20rpx 15rpx 0 20rpx; +} + +/* 顶部背景 */ +.top { + width: 100%; + position: relative; + height: 800rpx; + overflow: hidden; +} + +.top-back { + position: absolute; + height: 100%; + left: 0; + top: 0; + width: 100%; + z-index: 1; +} + +.top-date { + padding: 30rpx; + box-sizing: border-box; + position: absolute; + left: 0; + top: 370rpx; + width: 100%; + z-index: 9; + color: #6d9eff; + font-size: 28rpx; +} + +.top-date text { + display: block; +} + +.top-date::after, +.top-date::before { + position: absolute; + content: ''; + left: 30rpx; + background-color: #a7c5ff; + width: 100rpx; + height: 4rpx; +} + +.top-date::after { + top: 15rpx; +} + +.top-date::before { + bottom: 15rpx; +} + +/* 内容 */ +.seeCont { + position: absolute; + top: 460rpx; + z-index: 1000; + width: 100%; + padding: 60rpx 30rpx; + box-sizing: border-box; + border-bottom: 80px solid transparent; +} + +/* 皮肤概况 */ +.survey { + background-image: linear-gradient(90deg,rgba(255,255,255,0), transparent); + border-radius: 15rpx; + padding: 0 30rpx; + box-sizing: border-box; +} + +.survey-title { + text-align: center; +} + +.survey-title text { + display: inline-block; + background-color: #d3e2ff; + color: #3b7cff; + line-height: 58rpx; + padding: 0 30rpx; + border-radius: 0 0 20rpx 20rpx; + font-size: 28rpx; +} + +.survey-cont { + padding: 50rpx 0 20rpx; + box-sizing: border-box; +} + +.surveyTop { + position: relative; +} + +.surveyTop-img { + width: 210rpx; + height: 280rpx; + border-radius: 15rpx; +} + +.surveyTop-cont { + position: absolute; + left: 0; + top: 0; + width: 100%; + padding-left: 300rpx; + padding-right: 20rpx; + box-sizing: border-box; + text-align: center; +} + +.surveyTop-cont-title { + margin-bottom: 40rpx; +} + +.surveyTop-title-name { + color: #3b7cff; + font-size: 40rpx; + line-height: 70rpx; +} + +.surveyTop-title-text { + color: #666666; +} + +.surveyTop-cont-item { + background-color: #edf3ff; + border-radius: 80rpx; + display: flex; + font-size: 28rpx; + padding: 20rpx 0; +} + +.surveyTop-item-label { + flex: 2; + text-align: center; + position: relative; +} + +.surveyTop-item-name { + margin-bottom: 10rpx; +} + +.surveyTop-item-label::after { + position: absolute; + content: ''; + right: 0; + top: 20%; + background-color: #c4d8ff; + width: 2rpx; + height: 60%; +} + +.surveyTop-item-label:last-child::after { + display: none; +} + +.surveyTop-item-text { + color: #666666; +} + +.surveyList { + margin-top: 30rpx; +} + +.surveyList-title { + font-size: 34rpx; + font-weight: 600; +} + +.surveyList-item { + margin-top: 20rpx; +} + +.surveyList-label { + line-height: 80rpx; + display: flex; +} + +.surveyList-label-name { + color: #111111; + width: 120rpx; +} + +.surveyList-label-thread { + width: calc(100% - 220rpx); + height: 20rpx; + margin-top: 30rpx; + background-color: #f5f5f5; +} + +.surveyList-label-bar { + height: 20rpx; + background-color: #f5f5f5; + position: relative; +} + +.surveyList-label-bar::before { + position: absolute; + content: ''; + height: 100%; + width: 100%; + color: #fff; + background-color: #2486ff; +} + +.surveyList-label-bar::after { + position: absolute; + content: ''; + width: 22rpx; + height: 22rpx; + border-radius: 50%; + background-color: #fff; + border: 4rpx solid #2486ff; + right: -22rpx; + top: -6rpx; +} + +.surveyList-label-number { + width: 100rpx; + text-align: right; +} + +/* 公共模块 */ +.module { + background-color: #ffffff; + margin-top: 40rpx; + border-radius: 15rpx; + overflow: hidden; +} + +.module-title { + background-image: linear-gradient(to top, #ffffff, #ecf2ff); + padding: 30rpx 0; + box-sizing: border-box; + font-weight: 600; + font-size: 32rpx; + position: relative; + padding-left: 60rpx; +} + +.module-title::after { + position: absolute; + content: ''; + left: 30rpx; + top: calc(50% - 13rpx); + background-color: #3d7eff; + width: 10rpx; + height: 26rpx; + border-radius: 160rpx; +} + +.module-check { + border: 2rpx solid #3d7eff; + width: 230rpx; + margin: 30rpx auto 0; + text-align: center; + height: 58rpx; + line-height: 58rpx; + border-radius: 90rpx; +} + +.module-check-img { + width: 32rpx; + height: 32rpx; + margin: -2rpx 10rpx 0 0; + display: inline-block; + vertical-align: middle; +} + +.module-check-name { + color: #3d7eff; + font-size: 28rpx; + display: inline-block; +} + +.moduleText { + background-color: #f7faff; + border-radius: 15rpx; + padding: 25rpx; + box-sizing: border-box; + display: flex; + margin-top: 40rpx; +} + +.moduleText-img { + width: 42rpx; + height: 42rpx; + margin-top: 10rpx; +} + +.moduleText-tips { + width: calc(100% - 42rpx); + padding-left: 20rpx; + box-sizing: border-box; + font-size: 28rpx; + line-height: 38rpx; + text-align: justify; +} + +.moduleText-tips text { + color: #3d7eff; +} + +.module-flex { + padding: 30rpx; + box-sizing: border-box; +} + +.module-flex-cont { + display: flex; +} + +.module-flex-item { + flex: 2; + text-align: center; +} + +.module-flex-img { + width: 100rpx; + height: 100rpx; +} + +.module-flex-name { + font-size: 26rpx; + color: #666666; + line-height: 48rpx; +} + +.module-flex-number { + font-weight: 600; +} + +/* 衰老分析 */ +.old { + padding: 30rpx; + box-sizing: border-box; +} + +.oldTop { + text-align: center; +} + +.oldTop-img { + width: 75%; +} + +.oldSee { + background-color: #f7faff; + border-radius: 15rpx; + padding: 15rpx; + box-sizing: border-box; + flex-wrap: wrap; + justify-content: flex-start; + margin-top: 40rpx; +} + +.oldSee-item { + width: 50%; + padding-left: 10rpx; + box-sizing: border-box; + display: inline-block; + line-height: 60rpx; + color: #111111; +} + +.oldSee-name { + position: relative; + padding-left: 20rpx; + font-size: 25rpx; +} + +.oldSee-name::after { + position: absolute; + content: ''; + left: 0; + top: calc(50% - 4rpx); + background-color: #3d7eff; + width: 8rpx; + height: 8rpx; +} + +/* 眼图 */ +.eye-img { + width: 60%; +} + +/* 毛孔 */ +.pore-flex { + padding-left: 20rpx; + width: calc(100% - 42rpx); +} + +.pore-flex-item { + font-size: 26rpx; + line-height: 52rpx; +} + +.pore-flex-item text { + font-weight: 600; + color: #3d7eff; +} + +/* 按钮 */ +.footer { + width: 100%; + height: 80px; + background-color: #FFFFFF; + position: fixed; + left: 0; + bottom: 0; + z-index: 9989; + padding: 20rpx 10rpx; + box-sizing: border-box; + display: block; +} + +.footer.active { + display: none; +} + +.footer-flex { + display: flex; +} + +.footer-flex-btn { + flex: 2; + margin: 0 15rpx; + line-height: 40px; + background-color: transparent; + height: 40px; + text-align: center; + color: #3b7cff; + border-radius: 80rpx; + border: 2rpx solid #3b7cff; +} + +.footer-flex-share { + background-color: #3b7cff; + color: #FFFFFF; +} + +/* 图片弹出 */ +.face-pop { + position: fixed; + left: 10%; + top: calc(50% - 300rpx); + z-index: 9999; + width: 80%; + overflow: hidden; + height: 640rpx; + text-align: center; + display: none; +} + +.face-pop.active { + display: block; +} + +.face-cont { + position: relative; + width: 396rpx; + height: 520rpx; + margin: 0 auto; + border-radius: 15rpx; + overflow: hidden; +} + +.face-img, +.face-ai { + position: absolute; + top: 0; + width: 100%; + height: 100%; +} + +.face-img { + left: 0; + z-index: 1000000; +} + +.face-ai { + right: 0; + z-index: 1000001; +} + +.face-back { + position: fixed; + left: 0; + top: 0; + z-index: 9998; + background-color: rgba(0, 0, 0, .5); + width: 100%; + height: 100vh; + display: none; +} + +.face-back.active { + display: block; +} + +.process_wrap { + height: 520rpx; + width: 4rpx; + position: absolute; + bottom: 0; + left: 0; + z-index: 1000003; +} + +.process_wrap .line { + position: absolute; + left: calc(50% + 2rpx); + top: 0; + width: 4rpx; + height: 100%; +} + +.process_wrap .line::before, +.process_wrap .line::after { + content: ""; + position: absolute; + width: 100%; + height: calc(50% - 28rpx); + background: #fff; + left: 0; +} + +.process_wrap .line::after { + top: 2rpx; +} + +.process_wrap .line::before { + bottom: -8rpx; +} + +.process_wrap .active_line { + position: absolute; + top: 0; + max-width: 8rpx; + height: 100%; +} + +.process_wrap .spot { + position: absolute; + top: calc(50% - 28rpx); + left: -28rpx; + width: 56rpx; + height: 56rpx; + border: 2px solid #ffffff; + border-radius: 100%; + background-color: transparent; +} + +.process_wrap .spot::before, +.process_wrap .spot::after { + content: ""; + position: absolute; + width: 0; + height: 0; + border-style: solid; + top: 50%; + margin-top: -4px; +} + +.process_wrap .spot::after { + border-width: 4px 0 4px 8px; + border-color: transparent transparent transparent #ffffff; + right: 2px; +} + +.process_wrap .spot::before { + left: 2px; + border-width: 4px 8px 4px 0; + border-color: transparent #ffffff transparent transparent; +} + +.surveyTop-close { + position: absolute; + width: 100%; + left: 0; + bottom: 0; + text-align: center; +} + +.surveyTop-close image { + width: 60rpx; + height: 60rpx; +} \ No newline at end of file diff --git a/pages/report/index.js b/pages/report/index.js new file mode 100644 index 0000000..5c4a1cf --- /dev/null +++ b/pages/report/index.js @@ -0,0 +1,118 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + userLogin : false, + listArr : [], // 商品列表 + page : {}, // 分页信息 + lodingStats : false, // 加载状态 + disabled : false, // 支付按钮 + payCode : '', // code获取openid + openId : '', // openid + payStatus : false, // 支付弹框 + catchtouchmove: false + }, + + onLoad(options) { + }, + + onShow() { + wx.login({ + success: res => { + this.setData({ + payCode: res.code + }) + // 获取openid + this.openInfo() + } + }) + + // 获取登录状态 + if(wx.getStorageSync("token") != ''){ + this.setData({ + userLogin: true, + disabled : false + }) + + // 获取检测结果列表 + this.aiInfo(); + } else { + this.setData({ + userLogin: false + }) + } + }, + + /** + * 检测结果列表 + */ + aiInfo (page){ + wx.$api.health.aiList({ + page: page || 1 + }).then(res => { + let listArr = this.data.listArr, + newData = [] + if(page == 1 || page == undefined) listArr = [] + newData = listArr.concat(res.data.data) + this.setData({ + listArr : newData, + page : res.data.page, + lodingStats : false + }) + wx.stopPullDownRefresh() + }).catch(err => { }) + }, + + /** + * openid + */ + openInfo() { + wx.$api.auth.codeOpenid({code: this.data.payCode}).then(res => { + this.setData({ + openId: res.data + }) + }).catch(err => {}) + }, + + /** + * 处理未登录时的转跳 + */ + assessGo(){ + if(wx.getStorageSync("token") != ''){ + wx.navigateTo({ + url: '/pages/index/assess/assess?code=' + this.data.openId + }) + }else{ + // 去登录 + wx.navigateTo({ + url: "/pages/login/index" + }) + } + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + // 获取检测结果列表 + this.aiInfo(); + }, + + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let pageNumber = this.data.page.current + if(this.data.page.has_more){ + pageNumber++ + // 获取检测结果列表 + this.aiInfo(pageNumber); + } + } +}) diff --git a/pages/report/index.json b/pages/report/index.json new file mode 100644 index 0000000..58dc9d8 --- /dev/null +++ b/pages/report/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "报告" +} \ No newline at end of file diff --git a/pages/report/index.wxml b/pages/report/index.wxml new file mode 100644 index 0000000..1c02f7e --- /dev/null +++ b/pages/report/index.wxml @@ -0,0 +1,43 @@ + + + 检测报告 + + + {{item.create_at}} + 检测报告精准分析您皮肤问题 + 查看报告 + + + + 加载中... + + + 没有更多了~ + + + + + + 由于不同时间的生活习惯变化普遍较大 + 建议每年重新测试一次 + + 再次检测 + + + + + + 暂无报告数据 + 进行皮肤检测后,可查看报告数据 + 立即检测 + + + + + + + 暂不能查看数据 + 登录成功后,可查看报告数据 + 请先登录 + + \ No newline at end of file diff --git a/pages/report/index.wxss b/pages/report/index.wxss new file mode 100644 index 0000000..51d52f0 --- /dev/null +++ b/pages/report/index.wxss @@ -0,0 +1,104 @@ +page { + background-color: #f7faff; +} + + +/* 列表 */ +.report { + width: 100%; + padding: 30rpx 30rpx 0; + box-sizing: border-box; +} + +.report-title { + font-size: 36rpx; +} + +.report-list { + margin-top: 30rpx; +} + +.report-item { + background-color: #fff; + border-radius: 20rpx; + padding: 30rpx; + box-sizing: border-box; + box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05); + color: #0d0d0d; + position: relative; + margin-bottom: 30rpx; +} + +.report-item:last-child { + margin: 0; +} + +.report-time { + font-size: 34rpx; +} + +.report-tips { + font-size: 28rpx; + margin-top: 20rpx; + line-height: 60rpx; + color: #414141; +} + +.report-btn { + position: absolute; + right: 30rpx; + bottom: 30rpx; + color: #3b7cff; + border: #3b7cff 2rpx solid; + font-size: 26rpx; + line-height: 56rpx; + padding: 0 30rpx; + border-radius: 90rpx; +} + +/* 友情提示 */ +.report-point { + padding: 140rpx 50rpx 0; + box-sizing: border-box; + text-align: center; +} + +.report-point-text { + color: #999999; + line-height: 60rpx; +} + +.report-point-text text { + display: block; +} + +.report-point-btn { + margin-top: 50rpx; + background-color: #3b7cff; + display: inline-block; + color: #fff; + border-radius: 80rpx; + line-height: 90rpx; + width: 60%; +} + +/* 暂无数据 */ +.reportTips-title { + color: #000; + font-size: 34rpx; + line-height: 80rpx; +} + +.reportTips-text { + font-size: 26rpx; +} + +.reportTips-btn { + background-color: #3b7cff; + display: inline-block; + color: #fff; + line-height: 78rpx; + padding: 0 60rpx; + border-radius: 10rpx; + margin-top: 50rpx; +} diff --git a/pages/report/share/share.js b/pages/report/share/share.js new file mode 100644 index 0000000..cb73327 --- /dev/null +++ b/pages/report/share/share.js @@ -0,0 +1,193 @@ +// pages/report/share/share.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + barHeight : getApp().globalData.barHeight, // 状态栏高度 + userData : '', // 用户信息 + inviteCode : '', // 二维码 + + //海报 + canvas : '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + // 初始化画布 + wx.createSelectorQuery().select('#coverCanvas').fields({node: true, size: true}).exec(canvasNode => { + const canvas = canvasNode[0].node + canvas.width = 375 + canvas.height = 800 + this.setData({ + canvas + }) + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 小程序码 + this.ShareInfo(); + + // 获取用户信息 + this.userInfo(); + }, + + /** + * 小程序码 + */ + ShareInfo() { + wx.$api.user.miniShare({ + url: '/pages/index/index' + }).then(res => { + this.setData({ + inviteCode: res.data.qrcode + }) + }).catch(err => {}) + }, + + /** + * 用户信息 + */ + userInfo() { + wx.$api.user.userIndex().then(res => { + this.setData({ + userData : res.data + }) + }).catch(err => {}) + }, + + /** + * 生成海报 + */ + onCanvas(){ + wx.showLoading({ + title: '生成图片中...', + mask : true + }) + const canvas = this.data.canvas + const ctx = canvas.getContext('2d') + const codeImgEl = canvas.createImage() + const backBackEl = canvas.createImage() + + + codeImgEl.src = this.data.inviteCode //二维码 + backBackEl.src = 'https://cdn.shuiganying.com/images/2023/04/04/1b1781214a4b34bb37948d2adb86f142.png' //背景素材 + + const codeImgLoding = new Promise((resolve, reason) => { + codeImgEl.onload = () => { + resolve() + } + }) + const backBackLoding = new Promise((resolve, reason) => { + backBackEl.onload = () => { + resolve() + } + }) + Promise.all([codeImgLoding, backBackLoding]).then(() => { + // 绘制[背景] + ctx.drawImage(backBackEl, 0, 0, 375, 800) + + // 绘制[二维码] + ctx.drawImage(codeImgEl, 260, 650, 80, 80) + + // 文字 + ctx.font = "bold 20px Arial"; //字体大小 + ctx.fillStyle = "#3b7cff"; //字体颜色 + ctx.textAlign = "center" + ctx.fillText('水感应 | AI测肤', 190, 510); + + // 文字 + ctx.font = "15px Arial"; //字体大小 + ctx.fillStyle = "#000000"; //字体颜色 + ctx.textAlign = "center" + ctx.fillText('基于强大人脸算法,深度图像学习能力', 190, 543); + + // 文字 + ctx.font = "15px Arial"; //字体大小 + ctx.fillStyle = "#000000"; //字体颜色 + ctx.textAlign = "center" + ctx.fillText('准确分析皮肤状态,针对性发现皮肤问题', 188, 565); + + // 文字 + ctx.font = "14px Arial"; //字体大小 + ctx.fillStyle = "#666666"; //字体颜色 + ctx.textAlign = "center" + ctx.fillText('肤质、肤色、肤龄、皱纹、毛孔、黑头等~', 188, 595); + + // 文字 + ctx.font = "15px Arial"; //字体大小 + ctx.fillStyle = "#000000"; //字体颜色 + ctx.fillText('参与测试成为VIP立享VIP权益!', 145, 682); + + // 文字 + ctx.font = "15px Arial"; //字体大小 + ctx.fillStyle = "#000000"; //字体颜色 + ctx.fillText('活动火爆,先到先得哦~', 120, 713); + + wx.hideLoading() + wx.canvasToTempFilePath({ + canvas: this.data.canvas, + success : res => { + wx.saveImageToPhotosAlbum({ + filePath: res.tempFilePath, + success: saveRes => { + wx.showToast({ + title: '海报已保存至您的相册', + icon : 'none' + }) + this.setData({ + shareSee: false + }) + }, + fail: () => { + wx.hideLoading() + wx.showModal({ + title: '提示', + content: '暂未授权小程序写入您的相册,无法存储海报', + confirmColor: '#e50d01', + confirmText: '去设置', + success: res => { + if (res.confirm) { + wx.openSetting() + } + } + }) + } + }) + }, + }) + }).catch(err => { + wx.showToast({ + title: '图片加载失败', + icon : 'none' + }) + }) + }, + + /** + * 返回上一页 + */ + returnGo() { + wx.navigateBack({ + delta: 1 + }) + }, + + /** + * 微信分享 + */ + onShareAppMessage(){ + return { + title : this.data.userData.nickname + ':' + '邀请您一起AI测肤', + path : "/pages/index/index?invite=" + wx.getStorageSync("invite"), + imageUrl: "https://cdn.shuiganying.com/images/2023/04/04/382850bdd565b1a687e4547c5c4de0f7.png" + } + } +}) \ No newline at end of file diff --git a/pages/report/share/share.json b/pages/report/share/share.json new file mode 100644 index 0000000..f0f1934 --- /dev/null +++ b/pages/report/share/share.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom", + "navigationBarTextStyle": "white" +} \ No newline at end of file diff --git a/pages/report/share/share.wxml b/pages/report/share/share.wxml new file mode 100644 index 0000000..4e35278 --- /dev/null +++ b/pages/report/share/share.wxml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + 水感应 | AI测肤 + 基于强大人脸算法,深度图像学习能力,准确分析皮肤状态,针对性发现皮肤问题 + 肤质、肤色、肤龄、皱纹、毛孔、黑头等~ + + + + 参与测试成为VIP立享VIP权益! + 活动火爆,先到先得哦~ + + + + + + + + + + 保存海报 + + + + + \ No newline at end of file diff --git a/pages/report/share/share.wxss b/pages/report/share/share.wxss new file mode 100644 index 0000000..de16e0a --- /dev/null +++ b/pages/report/share/share.wxss @@ -0,0 +1,165 @@ +page { + background-color: #f7faff; +} + + +/* 返回 */ +.navigation{ + position: fixed; + top: 0; + left: 0; + z-index: 999; + width: 100%; + height: 90rpx; + background-color: transparent; + transition: .2s; +} + +.navigation.active { + background-color: transparent; +} + +.navigation-arrow { + width: 44rpx; + height: 44rpx; + margin: 20rpx 15rpx 0 20rpx; +} + + +/* 顶部背景 */ +.top { + width: 100%; + position: relative; + height: 100vh; + overflow: hidden; +} + +.top-back { + position: absolute; + height: 100%; + left: 0; + top: 0; + width: 100%; + z-index: 1; +} + +/* 内容 */ +.seeCont { + position: absolute; + bottom: 0; + z-index: 100; + width: 100%; + padding: 60rpx 30rpx 120rpx; + box-sizing: border-box; +} + +.seeBorder { + border: 4rpx solid #ffffff; + border-radius: 15rpx; + overflow: hidden; + width: 100%; + box-sizing: border-box; +} + +.seeTop { + background-color: #ffffff; + opacity: .75; + padding: 30rpx 50rpx; + box-sizing: border-box; +} + +.seeTop-img { + text-align: center; +} + +.seeTop-img-title { + width: 78%; +} + +.seeTop-img-line { + width: 100%; + margin: 20rpx 0; +} + +.seeTop-cont { + text-align: center; + font-size: 28rpx; + border-bottom: 2rpx dashed #3b7cff; + padding-bottom: 40rpx; +} + +.seeTop-cont-name { + color: #3b7cff; + font-weight: 600; + font-size: 40rpx; +} + +.seeTop-cont-tips { + margin: 30rpx 0 15rpx; +} + +.seeTop-cont-tips text { + color: #3b7cff; +} + +.seeTop-cont-text { + color: #666666; +} + +.seeTop-share { + padding-top: 40rpx; + box-sizing: border-box; + display: flex; +} + +.seeTop-share-title { + font-size: 26rpx; + line-height: 58rpx; + flex: 1; +} + +.seeTop-share-code { + width: 110rpx; + height: 110rpx; + box-sizing: border-box; +} + +.seeTop-share-img { + width: 100%; + height: 100%; +} + +.seeBtn { + text-align: center; + width: 100%; + display: flex; + margin-top: 50rpx; +} + +.seeBtn-btn { + flex: 2; + background-color: #3d7eff; + display: inline-block; + color: #ffffff; + border-radius: 90rpx; + height: 90rpx !important; + line-height: 90rpx !important; + padding: 0 80rpx !important; + margin: 0 15rpx !important; + border: 2rpx solid #3d7eff; +} + +.seeBtn-btn-border { + background-color: #ffffff; + color: #3d7eff; + font-weight: normal; + width: auto !important; +} + +/* canvas */ +.canvas-img { + position: fixed; + left: -10000%; + top: 0; + z-index: 99; +} \ No newline at end of file diff --git a/pages/site/add/add.js b/pages/site/add/add.js new file mode 100644 index 0000000..b26ec86 --- /dev/null +++ b/pages/site/add/add.js @@ -0,0 +1,178 @@ +/* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + + /** + * 页面的初始数据 + */ + data: { + nameValue : '', // 姓名 + mobile : '', // 电话 + address : '', // 地址 + isDefault : '', // 默认地址 + // 省份选择 + areasArr : [], + areaId : 0, + areaIndex : 0, + + // 市级选择 + cityArr : [], + cityId : 0, + cityIndex : 0, + + // 区域选择 + regiArr : [], + regiId : 0, + regiIndex : 0, + + disabled : false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + experience: options.experience + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取省市区列表 + this.createInfo(); + }, + + /** + * 省市区列表 + */ + createInfo() { + wx.$api.site.create().then(res => { + let areas = res.data, + areaIndex = this.data.areaIndex + + this.setData({ + areasArr : areas, + areaId : areas[areaIndex].id, + }) + this.citylist(areas[areaIndex].id) + }).catch(err => {}) + }, + + /** + * 所在省份-下拉 + */ + areasChange(e) { + let area = this.data.areasArr, + index = e.detail.value, + atcode = area[index].id + if (index != this.data.areaIndex) { + this.setData({ + areaIndex : index, + areaId : atcode + }) + // 获取市级列表 + this.citylist(atcode) + } + }, + + /** + * 市级列表 + */ + citylist(cityId) { + wx.$api.site.create({ + parent_id: cityId + }).then(res=>{ + let cityArr = res.data + this.setData({ + cityId : cityArr[0].id, + cityIndex : 0, + cityArr : cityArr + }) + + // 获取区级列表 + this.regilist(cityArr[0].id) + }) + }, + + /** + * 市级下拉筛选 + */ + cityDrop(e) { + let city = this.data.cityArr, + index = e.detail.value, + citycode = city[index].id + if (index != this.data.cityIndex) { + this.setData({ + cityIndex : index, + cityId : citycode + }) + + // 获取市级列表 + this.regilist(citycode) + } + }, + + /** + * 区列表 + */ + regilist(areaId) { + wx.$api.site.create({ + parent_id: areaId + }).then(res=>{ + this.setData({ + regiArr : res.data, + regiId : res.data[0].id, + regiIndex : 0 + }) + }) + }, + + /** + * 区下拉筛选 + */ + regiDrop(e) { + let newIndex = e.detail.value + this.setData({ + regiIndex : newIndex, + regiId : this.data.regiArr[newIndex].id + }) + }, + + /* + 姓名截取 + */ + bindinput(e) { + this.setData({ + nameValue: e.detail.value.substr(0,5) + }) + }, + + // 提交表单 + siteform(e) { + let value = e.detail.value + let data = { + name : this.data.nameValue, + mobile : value.mobile, + address : value.address, + province_id : this.data.areaId, + city_id : this.data.cityId, + district_id : this.data.regiId + } + this.setData({ + disabled: true + }) + wx.$api.site.siteAdd(data).then(res => { + wx.navigateBack() + }).catch(() =>{ + this.setData({ + disabled: false + }) + }) + } +}) \ No newline at end of file diff --git a/pages/site/add/add.json b/pages/site/add/add.json new file mode 100644 index 0000000..9b706f4 --- /dev/null +++ b/pages/site/add/add.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "新增地址" +} \ No newline at end of file diff --git a/pages/site/add/add.wxml b/pages/site/add/add.wxml new file mode 100644 index 0000000..7ef256d --- /dev/null +++ b/pages/site/add/add.wxml @@ -0,0 +1,44 @@ +
+ + + + + + + + + + + + + {{ areasArr[areaIndex].name }} + + + + + + + + + {{ cityArr[cityIndex].name }} + + + + + + + + + {{ regiArr[regiIndex].name }} + + + + + + + + + + + +
\ No newline at end of file diff --git a/pages/site/add/add.wxss b/pages/site/add/add.wxss new file mode 100644 index 0000000..7dd5fea --- /dev/null +++ b/pages/site/add/add.wxss @@ -0,0 +1,79 @@ +.site-form { + background: white; + display: block; +} + +.site-input { + padding: 0 30rpx 0 200rpx; + position: relative; + line-height: 110rpx; + min-height: 110rpx; + border-bottom: 2rpx solid #f3f3f3; +} + +.site-input::before { + position: absolute; + bottom: 0; + left: 30rpx; + right: 0; + height: 1rpx; + content: ""; + background: #e4e6f2; +} + +.site-input:last-child::before { + display: none; +} + +.site-input label { + position: absolute; + left: 30rpx; + top: 0; +} + +.site-input input { + height: 110rpx; +} + +.site-input image { + width: 44rpx; + height: 44rpx; + position: absolute; + right: 20rpx; + top: calc(50% - 22rpx); +} + +.site-btn { + padding: 20rpx 30rpx; + margin-top: 100rpx; +} + +.site-btn button[size="mini"] { + width: 100%; + background: #3b7cff; + height: 88rpx; + line-height: 88rpx; + font-size: 30rpx; + color: white; + padding: 0; +} + +.site-btn button[disabled] { + background: #7789ff !important; + color: #fff !important; +} + +.site-switch { + font-size: 32rpx; + margin: 30rpx; + display: flex; + line-height: 40rpx; +} + +.site-switch text { + flex: 1; +} + +.site-switch-active { + color: #797979; +} \ No newline at end of file diff --git a/pages/site/edit/edit.js b/pages/site/edit/edit.js new file mode 100644 index 0000000..d7e585c --- /dev/null +++ b/pages/site/edit/edit.js @@ -0,0 +1,227 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + addressId : '', + nameValue : '', + mobile : '', + address : '', + isDefault : '', + disabled : false, + + //省份选择 + areas : [], + areaId : '', + areaIndex : 0, + + //市级选择 + cityList : [], + cityId : 0, + cityIndex : 0, + + //区域选择 + regiList : [], + regiId : 0, + regiIndex : 0, + }, + + onLoad(options) { + this.setData({ + addressId: options.addressid + }) + }, + + onShow() { + // 获取收货人信息 + this.getUserAddress() + }, + + /** + * 收货人信息 + */ + getUserAddress(){ + wx.$api.site.siteSee(this.data.addressId).then(res => { + let areasValue = res.data.provinces.findIndex(val=> val.name == res.data.province.name), + cityValue = res.data.cities.findIndex(val=> val.name == res.data.city.name), + regiValue = res.data.districts.findIndex(val=> val.name == res.data.district.name) + this.setData({ + nameValue : res.data.name, + mobile : res.data.mobile, + areas : res.data.provinces, + cityList : res.data.cities, + regiList : res.data.districts, + areaIndex : areasValue, + cityIndex : cityValue, + regiIndex : regiValue, + areaId : res.data.province.region_id, + cityId : res.data.city.region_id, + regiId : res.data.district.region_id, + address : res.data.address, + isDefault : res.data.default + }) + }).catch(err => {}) + }, + + /** + * 省市区列表 + */ + createInfo() { + wx.$api.site.create().then(res => { + let areas = res.data, + areaIndex = this.data.areaIndex + this.setData({ + areas : areas, + areaId : areas[areaIndex].id, + }) + + this.citylist(areas[areaIndex].id) + }).catch(err => {}) + }, + + /** + * 所在省份-下拉 + */ + areasChange(e) { + let area = this.data.areas, + index = e.detail.value, + atcode = area[index].id + if (index != this.data.areaIndex) { + this.setData({ + areaIndex : index, + areaId : atcode + }) + // 获取市级列表 + this.citylist(atcode) + } + }, + + /** + * 市级列表 + */ + citylist(cityId) { + wx.$api.site.create({ + parent_id: cityId + }).then(res=>{ + let cityArr = res.data + this.setData({ + cityId : cityArr[0].id, + cityIndex : 0, + cityList : cityArr + }) + + // 获取区级列表 + this.regilist(cityArr[0].id) + }) + }, + + /** + * 市级下拉筛选 + */ + cityDrop(e) { + let city = this.data.cityList, + index = e.detail.value, + citycode = city[index].id + if (index != this.data.cityIndex) { + this.setData({ + cityIndex : index, + cityId : citycode + }) + + // 获取区列表 + this.regilist(citycode) + } + }, + + /** + * 区列表 + */ + regilist(areaId) { + wx.$api.site.create({ + parent_id: areaId + }).then(res=>{ + this.setData({ + regiList : res.data, + regiId : res.data[0].id, + regiIndex : 0 + }) + }) + }, + + /** + * 区下拉筛选 + */ + regiDrop(e) { + let newIndex = e.detail.value + this.setData({ + regiIndex : newIndex, + regiId : this.data.regiList[newIndex].id + }) + }, + + /** + * 默认地址 + */ + addressDefault() { + wx.$api.site.siteDefault(this.data.addressId).then(res => { + this.setData({ + isDefault: !this.data.isDefault + }) + }).catch(err => {}) + }, + + /* + 姓名截取 + */ + bindinput(e) { + this.setData({ + nameValue: e.detail.value.substr(0,5) + }) + }, + + /** + * 提交表单 + */ + siteform(e) { + let value = e.detail.value + let data = { + name : this.data.nameValue, + mobile : value.mobile, + address : value.address, + province_id : this.data.areaId, + city_id : this.data.cityId, + district_id : this.data.regiId, + is_default : this.data.isDefault + } + wx.$api.site.siteEdit(this.data.addressId, data).then(res => { + this.setData({ + disabled: true + }) + wx.navigateBack() + }).catch(err => {}) + }, + + + /** + * 删除地址 + */ + addressRemove(){ + wx.showModal({ + title : '提示', + content : '是否删除地址', + success : res=> { + if (res.confirm) { + wx.showLoading({ + title: '删除中', + }) + wx.$api.site.siteDel(this.data.addressId).then(res=>{ + wx.navigateBack() + }) + } + } + }) + }, + +}) diff --git a/pages/site/edit/edit.json b/pages/site/edit/edit.json new file mode 100644 index 0000000..9fb26d3 --- /dev/null +++ b/pages/site/edit/edit.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "编辑地址" +} \ No newline at end of file diff --git a/pages/site/edit/edit.wxml b/pages/site/edit/edit.wxml new file mode 100644 index 0000000..646c5ea --- /dev/null +++ b/pages/site/edit/edit.wxml @@ -0,0 +1,52 @@ +
+ + + + + + + + + + + + + {{ areas[areaIndex].name }} + + + + + + + + + {{ cityList[cityIndex].name }} + + + + + + + + + {{ regiList[regiIndex].name }} + + + + + + + + + + 设置默认地址 + + + + + 删除地址 + + + + +
\ No newline at end of file diff --git a/pages/site/edit/edit.wxss b/pages/site/edit/edit.wxss new file mode 100644 index 0000000..4a95a0d --- /dev/null +++ b/pages/site/edit/edit.wxss @@ -0,0 +1,99 @@ +.site-form { + background: white; + display: block; +} + +.site-input { + padding: 0 30rpx 0 200rpx; + position: relative; + line-height: 110rpx; + min-height: 110rpx; +} + +.site-input::before { + position: absolute; + bottom: 0; + left: 30rpx; + right: 0; + height: 1rpx; + content: ""; + background: #e4e6f2; +} + +.site-input:last-child::before { + display: none; +} + +.site-input label { + position: absolute; + left: 30rpx; + top: 0; +} + +.site-input input { + height: 110rpx; +} + +.site-input image { + width: 44rpx; + height: 44rpx; + position: absolute; + right: 20rpx; + top: calc(50% - 22rpx); +} + +.site-btn { + padding: 20rpx 30rpx; + margin-top: 100rpx; +} + +.site-btn button[size="mini"] { + width: 100%; + background: #3b7cff; + height: 88rpx; + line-height: 88rpx; + font-size: 30rpx; + color: white; + padding: 0; +} + +.site-btn button[disabled] { + background: #7789ff !important; + color: #fff !important; +} + +.site-switch { + font-size: 32rpx; + margin: 30rpx; + display: flex; + line-height: 40rpx; +} + +.site-switch text { + flex: 1; +} + +.site-switch-active { + color: #797979; +} + +.site-del { + width: 100%; + text-align: center; + margin-top: 40rpx; + padding-top: 60rpx; + border-top: 2rpx solid rgb(228, 230, 242); + color: #ff9951; +} + +.site-del-btn { + text-align: center; +} + +.site-del-img { + width: 46rpx; + height: 46rpx; + display: inline-block; + vertical-align: -10rpx; + margin-right: 5rpx; +} \ No newline at end of file diff --git a/pages/site/index.js b/pages/site/index.js new file mode 100644 index 0000000..915b5ce --- /dev/null +++ b/pages/site/index.js @@ -0,0 +1,76 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + + /** + * 页面的初始数据 + */ + data: { + type : '', //类型 + listArr : [] //收货地址 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if(options) { + this.setData({ + type: options.type + }) + } + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取地址列表 + this.listInfo(); + }, + + /** + * 地址列表 + */ + listInfo (){ + wx.$api.site.siteList().then(res => { + this.setData({ + listArr: res.data + }) + }).catch(err => { }) + }, + + /** + * 选择地址 + */ + selectAddress(e){ + let atAdds = this.data.listArr[e.currentTarget.dataset.index] + let pages = getCurrentPages(), + prepage = pages[pages.length-2] + + if(this.data.type == 'goodsAddress') { + prepage.setData({ + address: atAdds, + addressId: atAdds.address_id + }) + wx.navigateBack() + return + } + prepage.setData({ + address: atAdds + }) + wx.navigateBack() + }, + + /** + * 编辑地址 + */ + addressEdit(e) { + wx.navigateTo({ + url: './edit/edit?addressid=' + e.currentTarget.dataset.id, + }) + }, +}) \ No newline at end of file diff --git a/pages/site/index.json b/pages/site/index.json new file mode 100644 index 0000000..f30802c --- /dev/null +++ b/pages/site/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "地址管理" +} \ No newline at end of file diff --git a/pages/site/index.wxml b/pages/site/index.wxml new file mode 100644 index 0000000..d31a91f --- /dev/null +++ b/pages/site/index.wxml @@ -0,0 +1,37 @@ + + + + + + + + + + + {{item.name}} + + + {{item.mobile}} + + + 默认 + + + {{item.full_address}} + + + + + + 选择地址 + + + + + + + 暂无收货地址 + + + 添加收货地址 + \ No newline at end of file diff --git a/pages/site/index.wxss b/pages/site/index.wxss new file mode 100644 index 0000000..d849a1e --- /dev/null +++ b/pages/site/index.wxss @@ -0,0 +1,116 @@ +page{ + background-color: #f4f4f6; +} + +.list { + border-bottom: 90px solid transparent; + padding: 30rpx; + box-sizing: border-box; +} + +.address { + background-color: #FFFFFF; + margin-bottom: 30rpx; + padding: 30rpx; + box-sizing: border-box; + border-radius: 10rpx; +} + +.address:last-child { + margin-bottom: 0; +} + +.address-top { + display: flex; +} + +.address-img { + background-color: #eeeeee; + border-radius: 50%; + width: 60rpx; + height: 60rpx; + padding: 10rpx; + box-sizing: border-box; + margin-top: 25rpx; +} + +.address-img image { + width: 100%; + height: 100%; +} + +.address-btn { + width: 40rpx; + height: 40rpx; + margin-top: 62rpx; +} + +.address-cont { + width: calc(100% - 102rpx); + padding: 0 30rpx; + box-sizing: border-box; +} + +.address-cont-title { + display: flex; + margin-bottom: 20rpx; + line-height: 44rpx; +} + +.address-cont-mobile { + margin: 0 20rpx; + color: rgb(104, 104, 104); +} + +.address-cont-default { + background-color: #ff9951; + color: #FFFFFF; + font-size: 24rpx; + border-radius: 40rpx; + padding: 0 15rpx; + height: 38rpx; + line-height: 38rpx; + margin-top: 2rpx; +} + +.address-cont-text { + line-height: 42rpx; + font-size: 28rpx; +} + +.select { + text-align: right; + padding-top: 30rpx; +} + +.select-btn { + border: 2rpx solid #ff9951; + color: #ff9951; + display: inline-block; + font-size: 28rpx; + padding: 0 30rpx; + line-height: 54rpx; + border-radius: 5rpx; +} + +/* 按钮 */ +.footer { + width: 100%; + height: 90px; + background-color: #FFFFFF; + position: fixed; + left: 0; + bottom: 0; + z-index: 9; + padding: 20px; + box-sizing: border-box; +} + +.btn { + line-height: 50px; + background-color: #3b7cff; + height: 100%; + text-align: center; + color: #FFFFFF; + border-radius: 10rpx; +} \ No newline at end of file diff --git a/pages/user/about/about.js b/pages/user/about/about.js new file mode 100644 index 0000000..e50f861 --- /dev/null +++ b/pages/user/about/about.js @@ -0,0 +1,28 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + + /** + * 页面的初始数据 + */ + data: { + barHeight : getApp().globalData.barHeight, // 状态栏高度 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + // 返回上一页 + returnGo() { + wx.navigateBack({ + delta: 1 + }) + }, +}) \ No newline at end of file diff --git a/pages/user/about/about.json b/pages/user/about/about.json new file mode 100644 index 0000000..f7efdab --- /dev/null +++ b/pages/user/about/about.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" + } \ No newline at end of file diff --git a/pages/user/about/about.wxml b/pages/user/about/about.wxml new file mode 100644 index 0000000..9bb3734 --- /dev/null +++ b/pages/user/about/about.wxml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/pages/user/about/about.wxss b/pages/user/about/about.wxss new file mode 100644 index 0000000..d22e6b7 --- /dev/null +++ b/pages/user/about/about.wxss @@ -0,0 +1,30 @@ +/* 返回上一页 */ +.navigation{ + position: fixed; + top: 0; + left: 0; + z-index: 99; + width: 100%; + height: 90rpx; + background-color: transparent; + transition: .2s; +} + +.navigation.active { + background-color: transparent; +} + +.navigation-arrow { + width: 44rpx; + height: 44rpx; + margin: 20rpx 15rpx 0 20rpx; +} + +.about { + width: 100%; +} + +image { + width: 100%; + display: block; +} \ No newline at end of file diff --git a/pages/user/code/code.js b/pages/user/code/code.js new file mode 100644 index 0000000..e6bdfce --- /dev/null +++ b/pages/user/code/code.js @@ -0,0 +1,185 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + + /** + * 页面的初始数据 + */ + data: { + barHeight : getApp().globalData.barHeight, // 状态栏高度 + shareSee : false, //分享弹出 + inviteText : '', //邀请码 + inviteCode : '', //二维码 + + //海报 + canvas : '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + // 初始化画布 + wx.createSelectorQuery().select('#coverCanvas').fields({node: true, size: true}).exec(canvasNode => { + const canvas = canvasNode[0].node + canvas.width = 375 + canvas.height = 800 + this.setData({ + canvas + }) + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取信息 + this.inviteInfo(); + + // 小程序码 + this.ShareInfo(); + }, + + /** + * 获取信息 + */ + inviteInfo() { + wx.$api.user.invitesCode().then(res => { + this.setData({ + inviteText : res.data.invite + }) + }).catch(err => {}) + }, + + /** + * 小程序码 + */ + ShareInfo() { + wx.$api.user.miniShare({ + url: '/pages/index/index' + }).then(res => { + this.setData({ + inviteCode: res.data.qrcode + }) + }).catch(err => {}) + }, + + /** + * 生成海报 + */ + onCanvas(){ + wx.showLoading({ + title: '生成图片中...', + mask : true + }) + const canvas = this.data.canvas + const ctx = canvas.getContext('2d') + const codeImgEl = canvas.createImage() + const backBackEl = canvas.createImage() + + codeImgEl.src = this.data.inviteCode //二维码 + backBackEl.src = 'https://cdn.shuiganying.com/images/2023/03/31/30a1fde15c33efce2c182ef5fb7073fd.jpg' //背景素材 + const codeImgLoding = new Promise((resolve, reason) => { + codeImgEl.onload = () => { + resolve() + } + }) + const backBackLoding = new Promise((resolve, reason) => { + backBackEl.onload = () => { + resolve() + } + }) + Promise.all([codeImgLoding, backBackLoding]).then(() => { + ctx.drawImage(backBackEl, 0, 0, 375, 800) + // 绘制[二维码-白色背景] + ctx.fillStyle = "#ffffff"; + ctx.fillRect(30, 400, 130, 130); + + // 绘制[二维码-白色背景黑框] + ctx.strokeStyle = "#0e2c58"; + ctx.lineWidth = 2 + ctx.strokeRect(29, 399, 132, 132); + + // 绘制[二维码] + ctx.drawImage(codeImgEl, 40, 410, 110, 110) + + // 文字 + ctx.font = "bold 14px Arial"; //字体大小 + ctx.fillStyle = "#0e2c58"; //字体颜色 + ctx.textAlign = "center" + ctx.fillText('扫描二维码了解更多', 96, 560); + + wx.hideLoading() + wx.canvasToTempFilePath({ + canvas: this.data.canvas, + success : res => { + wx.saveImageToPhotosAlbum({ + filePath: res.tempFilePath, + success: saveRes => { + wx.showToast({ + title: '海报已保存至您的相册', + icon : 'none' + }) + this.setData({ + shareSee: false + }) + }, + fail: () => { + wx.hideLoading() + wx.showModal({ + title: '提示', + content: '暂未授权小程序写入您的相册,无法存储海报', + confirmColor: '#e50d01', + confirmText: '去设置', + success: res => { + if (res.confirm) { + wx.openSetting() + } + } + }) + } + }) + }, + }) + }).catch(err => { + wx.showToast({ + title: '图片加载失败', + icon : 'none' + }) + }) + }, + + /** + * 分享弹出 + */ + shareTap() { + this.setData({ + shareSee: !this.data.shareSee + }) + }, + + // 返回上一页 + returnGo() { + wx.navigateBack({ + delta: 1 + }) + }, + + /** + * 微信分享 + */ + onShareAppMessage(){ + this.setData({ + shareSee: false + }) + return { + title : '水感应修复、紧致、舒缓喷雾', + path : "/pages/index/index?invite=" + wx.getStorageSync("invite"), + imageUrl: "https://cdn.shuiganying.com/images/2023/04/04/9cd9968136e7efd85028fba69e4c587a.jpg" + } + } +}) \ No newline at end of file diff --git a/pages/user/code/code.json b/pages/user/code/code.json new file mode 100644 index 0000000..f7efdab --- /dev/null +++ b/pages/user/code/code.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" + } \ No newline at end of file diff --git a/pages/user/code/code.wxml b/pages/user/code/code.wxml new file mode 100644 index 0000000..4206743 --- /dev/null +++ b/pages/user/code/code.wxml @@ -0,0 +1,35 @@ + + + + + + + + + + + 扫描二维码了解更多 + + + + 分享 + + + + + + + + + + + + + 保存二维码 + + + 取消 + \ No newline at end of file diff --git a/pages/user/code/code.wxss b/pages/user/code/code.wxss new file mode 100644 index 0000000..6e9d51a --- /dev/null +++ b/pages/user/code/code.wxss @@ -0,0 +1,148 @@ +/* 返回上一页 */ +.navigation{ + position: fixed; + top: 0; + left: 0; + z-index: 99; + width: 100%; + height: 90rpx; + background-color: transparent; + transition: .2s; +} + +.navigation.active { + background-color: transparent; +} + +.navigation-arrow { + width: 44rpx; + height: 44rpx; + margin: 20rpx 15rpx 0 20rpx; +} + + +/* 二维码 */ +.code { + width: 100vw; + height: 100vh; + position: relative; +} + +.code-back { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; +} + +.code-cont { + width: 400rpx; + position: absolute; + z-index: 9; + text-align: center; + left: 0; + bottom: 30%; +} + +.code-img{ + margin: 0 auto 20rpx; + overflow: hidden; + width: 260rpx; + height: 260rpx; + border: 4rpx solid #144592; + background-color: #ffffff; + padding: 10rpx; + box-sizing: border-box; +} + +.code-img image { + width: 100%; +} + +.code-text { + color: #144592; + font-size: 28rpx; + font-weight: 600; +} + +.code-share { + position: absolute; + z-index: 10; + left: 0; + bottom: 13%; + background: linear-gradient(to right, #3f7fff, #568fff); + width: 50rpx; + text-align: center; + border-radius: 0 26rpx 26rpx 0; + padding: 30rpx 15rpx 30rpx 12rpx; + box-shadow: 0 0 6rpx 6rpx rgba(0, 0, 0, .2); +} + +.code-share-name { + writing-mode:vertical-rl; + font-size: 30rpx; + padding-left: 4rpx; + color: #fff; +} + +.code-share image { + width: 36rpx; + height: 36rpx; + margin-bottom: 5rpx; +} + +.sharePop { + position: fixed; + width: 100%; + z-index: 99; + left: 0; + bottom: 0; + background-color: #0a1930; + display: none; +} + +.sharePop.active { + display: block; +} + +.shareCont-label image { + width: 60rpx; + height: 60rpx; + display: block; + margin: 0 auto 10rpx; +} + +.shareCancel { + border-top: 2rpx solid #0e2c58; + color: #ffffff; + width: 100%; + text-align: center; + line-height: 100rpx; +} + +.shareCont{ + display: flex; + padding: 30rpx 0; +} + +.shareCont-label { + color: #ffffff; + flex: 2; + text-align: center; + font-size: 28rpx; +} + +.codeShare-button { + background-color: transparent; + padding: 0; + font-weight: normal; +} + +/* canvas */ +.canvas-img { + position: fixed; + left: -10000%; + top: 0; + z-index: 99; +} \ No newline at end of file diff --git a/pages/user/help/help.js b/pages/user/help/help.js new file mode 100644 index 0000000..8c005e5 --- /dev/null +++ b/pages/user/help/help.js @@ -0,0 +1,51 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + helpsArr: [], //帮助列表 + }, + + onLoad(options) {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取帮助分类 + this.helpsNavInfo(); + }, + + /** + * 帮助分类 + */ + helpsNavInfo() { + wx.$api.user.helpsNav().then(res => { + let listArr = this.data.helpsArr, + newData = [] + for(let i of res.data){ + for(let j of i.children){ + j.isMore = false + } + } + newData = listArr.concat(res.data) + this.setData({ + helpsArr: newData + }) + }).catch(err => {}) + }, + + /** + * 文字展开 + */ + textMore(e){ + let childIndex = e.currentTarget.dataset.index, + parentIndex = e.currentTarget.dataset.parent + this.setData({ + [`helpsArr[${parentIndex}].children[${childIndex}].isMore`]: !this.data.helpsArr[parentIndex].children[childIndex].isMore + }); + } +}) + \ No newline at end of file diff --git a/pages/user/help/help.json b/pages/user/help/help.json new file mode 100644 index 0000000..379a486 --- /dev/null +++ b/pages/user/help/help.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "帮助中心" +} \ No newline at end of file diff --git a/pages/user/help/help.wxml b/pages/user/help/help.wxml new file mode 100644 index 0000000..f0c6cb4 --- /dev/null +++ b/pages/user/help/help.wxml @@ -0,0 +1,114 @@ + + {{item.title}} + + + + + {{items.title}} + + + + + + + + + \ No newline at end of file diff --git a/pages/user/help/help.wxss b/pages/user/help/help.wxss new file mode 100644 index 0000000..980fd3e --- /dev/null +++ b/pages/user/help/help.wxss @@ -0,0 +1,56 @@ +page { + background-color: #f4f4f6; +} + +.help-title { + font-size: 34rpx; + margin-bottom: 40rpx; +} + +.help { + padding: 40rpx 30rpx; + box-sizing: border-box; + background-color: #ffffff; + margin-top: 30rpx; +} + +.help-item-name { + margin-bottom: 40rpx; + display: flex; + position: relative; + line-height: 44rpx; +} + +.help-item:last-child .help-item-name { + margin-bottom: 0; +} + +.help-item-img { + width: 40rpx; + height: 40rpx; + margin-right: 10rpx; + margin-top: 2rpx; +} + +.help-item-arrow { + width: 44rpx; + height: 44rpx; + position: absolute; + right: 0; +} + +.help-item-title { + width: calc(100% - 94rpx); +} + +.help-item-text { + display: none; +} + +.help-item-text.active { + display: block; + margin-top: 30rpx; + line-height: 48rpx; + color: #747474; + font-size: 28rpx; +} \ No newline at end of file diff --git a/pages/user/index.js b/pages/user/index.js new file mode 100644 index 0000000..22e879c --- /dev/null +++ b/pages/user/index.js @@ -0,0 +1,140 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + userLogin : false, + userData : '', //用户信息 + ordersData : '', //订单数据 + // Progress : '', //商品数 + parentStatus: false //推荐人弹出 + }, + + onLoad(options) {}, + + onShow() { + // 获取登录状态 + if(wx.getStorageSync("token") != ''){ + this.setData({ + userLogin: true + }) + // 获取用户信息 + this.userInfo(); + return + } + + this.setData({ + userLogin: false + }) + }, + + /** + * 用户信息 + */ + userInfo() { + wx.$api.user.userIndex().then(res => { + this.setData({ + userData : res.data, + ordersData: res.data.count.orders, + Progress : res.data.count.progress + }) + if(res.data.invite != '') { + wx.setStorage({ + key : 'invite', + data : res.data.invite + }) + } + }).catch(err => {}) + }, + + /** + * 处理未登录时的转跳 + */ + userNav(e){ + let pageUrl = e.currentTarget.dataset.url + if(wx.getStorageSync("token") != ''){ + wx.navigateTo({ + url: pageUrl + }) + }else{ + // 去登录 + wx.navigateTo({ + url: "/pages/login/index" + }) + } + }, + + /** + * 复制订单号 + */ + copyUrl(val) { + wx.setClipboardData({ + data: val.currentTarget.dataset.no, + success: () => { + wx.showToast({ + title: "邀请码复制成功", + icon : "none" + }) + } + }) + }, + + /** + * 我的客服 + */ + callCenter() { + wx.openCustomerServiceChat({ + extInfo: {url: 'https://work.weixin.qq.com/kfid/kfcaf0d242864812bcb'}, + corpId: 'ww988d2bd112e71dd2', + success: res=> {}, + fail: err=> { + console.log(err) + } + }) + }, + + /** + * 退出登录 + */ + outLogin() { + wx.showModal({ + title : '提示', + content : '是否退出登录', + success : res=> { + if (res.confirm) { + getApp().globalData.inviteText = '' + + // 清理客户端登录缓存 + wx.removeStorageSync("token") + + // 清理邀请码 + wx.removeStorageSync("invite") + + this.setData({ + userLogin: false + }) + } + } + }) + }, + + /** + * 推荐人弹出 + */ + parentTap() { + this.setData({ + parentStatus: !this.data.parentStatus + }) + }, + + /** + * 拨打电话 + */ + clickcall(e){ + wx.makePhoneCall({ + phoneNumber: e.currentTarget.dataset.tel + }) + } +}) diff --git a/pages/user/index.json b/pages/user/index.json new file mode 100644 index 0000000..e546aa0 --- /dev/null +++ b/pages/user/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarBackgroundColor": "#5283ea", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "我的" +} \ No newline at end of file diff --git a/pages/user/index.wxml b/pages/user/index.wxml new file mode 100644 index 0000000..042fd44 --- /dev/null +++ b/pages/user/index.wxml @@ -0,0 +1,182 @@ + + + + + + + + {{userData.identity.name}} + + + {{userData.nickname}} + + + + + + + + 购买产品{{Progress.now}} + 累计购买{{Progress.total}}瓶可成为创客 + + + + + + {{Progress.text}} + + + + 努力中 + + 经销商通道 + + + + + + + + + + 登录 / 注册 + + + + + + + + + + 我的订单 + 全部 + + + + + + 待付款 + + {{ordersData.init}} + + + + + 待发货 + + {{ordersData.paid}} + + + + + 待收货 + + {{ordersData.delivered}} + + + + + 已签收 + + + + + + + + + + 报告查看 + + + + 我的收藏 + + + + 我的点赞 + + + + 兑换券 + + + + 地址管理 + + + + 健康知识 + + + + 邀请好友 + + + + 推荐人 + + + + + + + + 常用工具 + + + + + + 我的邀请码 + + {{userData.invite}}复制 + + + + + + 用户设置 + + + + + 帮助中心 + + + + + 关于水感应 + + + + + 我的客服 + + + + + 退出登录 + + + + + + + + + + + + + + + + {{userData.parent.nickname}} + {{userData.parent.username}} + + \ No newline at end of file diff --git a/pages/user/index.wxss b/pages/user/index.wxss new file mode 100644 index 0000000..910f699 --- /dev/null +++ b/pages/user/index.wxss @@ -0,0 +1,451 @@ +page { + background-color: #f4f4f6; +} + +/* 头部 */ +.userTop { + background-color: #5283ea; + height: 380rpx; + position: relative; +} + +.userTop.active { + height: 320rpx; +} + +.userTop-url { + height: 190rpx; + position: relative; +} + +.userTop-back, +.userTop-cont { + position: absolute; + left: 0; + width: 100%; +} + +.userTop-back { + height: 100%; + bottom: 0; +} + +.userTop-cont { + padding: 40rpx 60rpx; + box-sizing: border-box; + display: flex; +} + +.userTop-head { + width: 110rpx; + height: 110rpx; + border: 4rpx solid #dae6ff; + background-color: #ffffff; + position: relative; + border-radius: 50%; +} + +.userTop-head image { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + border-radius: 50%; +} + +.userTop-name { + line-height: 110rpx; + color: #ffffff; + font-size: 38rpx; + padding-left: 40rpx; + box-sizing: border-box; + display: flex; +} + +.userTop-name-vip { + width: 140rpx; + margin-left: 20rpx; + margin-top: 38rpx; +} + +.userTop-head-vip{ + position: absolute; + bottom: -16rpx; + left: 18%; + font-size: 24rpx; + color: #ffffff; + height: 32rpx; + line-height: 32rpx; + width: 64%; + text-align: center; + border-radius: 80rpx; + background-image: linear-gradient(to right, #ffa340, #ff7707); +} + +.bar { + padding: 0 60rpx; + display: flex; +} + +.barTips { + display: flex; + line-height: 38rpx; + color: #ffffff; +} + +.barTips-center { + line-height: 54rpx; +} + +.barTips-name { + flex: 1; + font-size: 26rpx; +} + +.barTips-center .barTips-name { + font-weight: 600; + font-size: 28rpx; +} + +.barTips-name text { + font-weight: 600; + padding: 0 5rpx; +} + +.barTips-text { + font-size: 24rpx; + opacity: .8; +} + +.barCont { + width: calc(100% - 170rpx); +} + +.barBack { + width: 100%; + height: 6rpx; + position: relative; + border-radius: 200rpx; + margin-top: 15rpx; +} + +.barBack::after { + position: absolute; + content: ''; + left: 0; + top: 0; + height: 100%; + width: 100%; + background-color: #ffffff; + border-radius: 200rpx; + opacity: .5; +} + +.barBack text { + position: absolute; + content: ''; + left: 0; + top: 0; + height: 100%; + background-color: #ffffff; + border-radius: 100rpx; + opacity: 1; +} + +.barBtn { + background-color: #ffffff; + border-radius: 100rpx; + border: 2rpx solid #ffffff; + width: 120rpx; + text-align: center; + margin-left: 40rpx; + color: #5283ea; + font-size: 24rpx; + height: 54rpx; + line-height: 54rpx; +} + +.barBtn-active { + width: 180rpx; +} + +.barBtn.active { + opacity: .8; + color: #999; +} + +/* 主内容 */ +.userCont { + width: 100%; + position: absolute; + top: 285rpx; + padding: 0 30rpx 30rpx; + box-sizing: border-box; +} + +.userCont.active { + top: 210rpx; +} + +/* 订单 */ +.userOrder { + padding: 0 30rpx; + box-sizing: border-box; + width: 100%; +} + +.userOrder-cont { + padding: 30rpx 0; + box-sizing: border-box; + border-radius: 20rpx 20rpx 0 0; + background-image: linear-gradient(to top, #eef5ff 5%, #ffffff 90%); +} + +.userOrder-title { + display: flex; + margin-bottom: 30rpx; + line-height: 48rpx; + padding: 0 30rpx; +} + +.userOrder-title-name { + flex: 1; + font-size: 34rpx; +} + +.userOrder-title-more { + color: #a6a7ab; + font-size: 28rpx; + display: flex; +} + +.userOrder-title-arrow { + width: 42rpx; + height: 42rpx; + margin-top: 3rpx; +} + +.userOrder-list { + display: flex; +} + +.userOrder-item { + flex: 4; + text-align: center; + position: relative; +} +.userOrder-item-name { + font-size: 26rpx; + margin-top: 5rpx; + color: #868686; +} + +.userOrder-item-icon { + width: 42rpx; + height: 42rpx; +} + +.userOrder-item-number { + border-radius: 50%; + color: #ffffff; + background-color: #ff9951; + position: absolute; + top: -15rpx; + right: 40rpx; + font-size: 24rpx; + width: 30rpx; + height: 30rpx; + line-height: 30rpx; + border: 4rpx solid #ffffff; +} + +/* 入口 */ +.entry { + background-color: #ffffff; + border-radius: 0 0 20rpx 20rpx; + padding: 30rpx 0 0; + box-sizing: border-box; + flex-wrap: wrap; + justify-content: flex-start; + width: 100%; +} + +.entry-item { + width: 25%; + display: inline-block; + text-align: center; + font-size: 28rpx; + margin-bottom: 40rpx; +} + +.entry-item-img { + width: 56rpx; + height: 56rpx; + display: block; + margin: 0 auto 10rpx; +} + +.entry-item-name { + color: #313131; +} + +/* 常用工具 */ +.tool { + background-color: #ffffff; + border-radius: 20rpx; + padding: 30rpx 0 30rpx 30rpx; + box-sizing: border-box; + margin-top: 30rpx; +} + +.tool-title { + margin-bottom: 30rpx; + line-height: 48rpx; + font-size: 34rpx; +} + +.tool-list { + margin-top: 50rpx; +} + +.tool-item { + display: flex; + padding-bottom: 35rpx; + line-height: 48rpx; + margin-bottom: 35rpx; + border-bottom: 2rpx solid #e1e1e1; + position: relative; +} + +.tool-item.btn{ + background-color: transparent; + font-weight: normal; + width: 100% !important; + padding: 0 0 40rpx !important; +} + +.tool-item.btn::after{ + border: none; +} + +.tool-item:last-child { + border: none; + margin: 0; + padding-bottom: 15rpx; +} + +.tool-item-img { + width: 48rpx; + height: 48rpx; + margin-right: 20rpx; +} + +.tool-item-name { + color: #434343; +} + +.tool-item-arrow { + width: 48rpx; + height: 48rpx; + position: absolute; + right: 30rpx; +} + +.tool-item-code { + position: absolute; + right: 30rpx; + color: #ff9951; + font-size: 28rpx; + display: flex; +} + +.tool-item-copy { + height: 34rpx; + line-height: 34rpx; + border: 2rpx solid #ff9951; + padding: 0 15rpx; + border-radius: 5rpx; + margin-left: 15rpx; + font-size: 26rpx; + margin-top: 4rpx; +} + + +/* 推荐人弹出 */ +.parentEject { + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, .6); + z-index: 1000; + display: none; +} + +.parentEject.active{ + display: block; +} + +.parentPop { + width: 80%; + position: fixed; + left: 10%; + top: calc(50% - 200rpx); + z-index: 10001; + height: 400rpx; + display: none; + overflow: hidden; +} + +.parentPop.active{ + display: block; +} + +.parentPop-back, +.parentPop-cont { + height: 320rpx; + position: absolute; + left: 0; + top: 0; + border-radius: 40rpx; + width: 100%; +} + +.parentPop-cont { + padding: 60rpx; + box-sizing: border-box; +} + +.parentPop-close { + width: 50rpx; + left: calc(50% - 25rpx); + position: absolute; + bottom: 10rpx; +} + +.parentPop-img { + width: 220rpx; + position: absolute; + right: 40rpx; + top: 40rpx; +} + +.parentPop-head { + width: 94rpx; + height: 94rpx; + border-radius: 100%; + border: 4rpx solid #ffffff; +} + +.parentPop-nick { + margin: 10rpx 0 15rpx; + font-weight: 600; + color: #214b9b; + font-size: 32rpx; +} + +.parentPop-user { + color: #666666; +} \ No newline at end of file diff --git a/pages/user/setup/setup.js b/pages/user/setup/setup.js new file mode 100644 index 0000000..4b7deeb --- /dev/null +++ b/pages/user/setup/setup.js @@ -0,0 +1,154 @@ +// pages/user/setup/setup.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + userData : '', // 基础信息 + avatar : '', + nickName : '', + nameState : false, + disabled : false, + birthday : '', + sexArray : [ + { + id: 0, + name: '男' + }, + { + id: 1, + name: '女' + }, + ], + sexIndex : '', + reviseType: '', // 修改类型 + nameValue : '' // 限制5个字符 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取登录状态 + if(wx.getStorageSync("token") != ''){ + // 获取用户信息 + this.userInfo(); + } + }, + + /** + * 用户设置信息 + */ + userInfo() { + wx.$api.user.userSetup().then(res => { + this.setData({ + userData : res.data, + avatar : res.data.avatar, + nickName : res.data.nickname, + birthday : res.data.birthday, + sexIndex : res.data.sex + }) + }).catch(err => {}) + }, + + /** + * 头像上传 + */ + updImg(e){ + let type = e.currentTarget.dataset.type + this.setData({ + reviseType: e.currentTarget.dataset.type + }) + if(type == 'avatar') { + wx.chooseMedia({ + count : 1, + success : path => { + // 上传图片 + wx.$api.file.uploadImg(path.tempFiles[0].tempFilePath, {}).then(res=>{ + this.setData({ + avatar:res.url + }) + this.settingInfo(type, res.path) + }) + } + }) + return + } + + // 修改用户名 + this.setData({ + nameState: true + }) + }, + + /* + 姓名截取 + */ + bindinput(e) { + this.setData({ + nameValue: e.detail.value.substr(0,5) + }) + }, + + // 修改用户名 + freeform() { + this.settingInfo(this.data.reviseType, this.data.nameValue) + }, + + /* + 出生年月日 + */ + bindDateChange(e) { + this.setData({ + birthday: e.detail.value + }) + this.settingInfo('birthday', e.detail.value) + }, + + /* + 性别选择 + */ + radioChange (e) { + const sex = this.data.sexArray + for (let i = 0, len = sex.length; i < len; ++i) { + sex[i].checked = sex[i].id == e.detail.value + } + this.setData({ + sexArray: sex, + sexId : e.detail.value + }) + this.settingInfo('sex', e.detail.value) + }, + + /** + * 上传用户信息 + */ + settingInfo(key, value) { + wx.$api.user.setting(key, { + value: value + }).then(() => { + this.setData({ + nameState: false, + nameValue: '' + }) + // 获取用户信息 + this.userInfo(); + }).catch(err => {}) + }, + + // 关闭弹框 + establish() { + this.setData({ + nameState: false, + nameValue: '' + }) + } +}) \ No newline at end of file diff --git a/pages/user/setup/setup.json b/pages/user/setup/setup.json new file mode 100644 index 0000000..57e5f5a --- /dev/null +++ b/pages/user/setup/setup.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "用户设置" + } \ No newline at end of file diff --git a/pages/user/setup/setup.wxml b/pages/user/setup/setup.wxml new file mode 100644 index 0000000..aadfaf8 --- /dev/null +++ b/pages/user/setup/setup.wxml @@ -0,0 +1,86 @@ + + + + + 修改头像 + + + + + + + + + + 用户昵称 + + + {{nickName}} + + + + + + + + + + 真实姓名 + + + {{userData.name != '' ? userData.name : '填写真实姓名'}} + + + + + + + 出生年月 + + + + {{birthday != '' ? birthday : '请选择出生年月'}} + + + + + + + 年龄 + + + {{userData.age != '' ? userData.age : '-- '}}岁 + + + + + + 性别 + + + + + {{sexArray[sexIndex].name}} + + + + + + + + + + + + {{reviseType == 'nickname' ? '用户昵称' : '真实姓名'}} +
+ + + + + 暂不修改 + + +
+
+
\ No newline at end of file diff --git a/pages/user/setup/setup.wxss b/pages/user/setup/setup.wxss new file mode 100644 index 0000000..c308618 --- /dev/null +++ b/pages/user/setup/setup.wxss @@ -0,0 +1,173 @@ +page { + background-color: #f8f8f8; +} + +.setupItem { + margin-bottom: 30rpx; + background-color: #ffffff; +} + +.label { + line-height: 60rpx; + display: flex; + padding: 30rpx; + box-sizing: border-box; + border-bottom: 2rpx solid #f7f9fa; +} + +.label:last-child { + border: none; +} + +.label-name { + display: flex; + flex: 1; +} + +.label-name-img { + width: 34rpx; + height: 34rpx; + margin-top: 14rpx; + margin-right: 20rpx; +} + +.label-tips, +.entry { + display: flex; + color: rgb(110, 110, 110); +} + +.label-name-head { + width: 54rpx; + height: 54rpx; + border-radius: 50%; + margin-right: 20rpx; +} + +.label-name-nickName { + padding-right: 10rpx; + color: rgb(110, 110, 110); + font-size: 30rpx; +} + +.label-name-arrow { + width: 24rpx; + height: 24rpx; + margin-top: 18rpx; +} + +.label-name-number { + display: inline-block; + background-color: #f8f8f8; + color: #ffffff; + border-radius: 60rpx; + height: 36rpx; + line-height: 36rpx; + padding: 0 20rpx; + font-size: 28rpx; + margin: 12rpx 20rpx 0 0; +} + + +/* 弹出层提示 */ +.publicBack { + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, .5); + z-index: 99; +} + +.publicPop { + left: 50%; + top: 50%; + width: 240px; + margin-left: -120px; + margin-top: -340rpx; + position: fixed; + z-index: 100; +} + +.publicPop-cont { + width: 100%; + background-color: #FFFFFF; + border-radius: 30rpx; + text-align: center; + overflow: hidden; + padding: 50rpx 0 0; + box-sizing: border-box; +} + +.free-title { + font-weight: 600; + margin-bottom: 40rpx; + font-size: 34rpx; +} + +.free-input { + padding: 0 30rpx; + box-sizing: border-box; + height: 90rpx; + line-height: 90rpx; + font-size: 30rpx; +} + +.free-input input { + height: 90rpx; + border-radius: 10rpx; + background-color: #f8f8f8; +} + +.publicPop-text { + color: #9d9d9d; + font-size: 32rpx; + text-align: center; +} + +.publicPop-text text { + color: #000000; + font-size: 40rpx; + display: block; + font-weight: 600; + margin: 20rpx 0 10rpx; +} + +.publicPop-btn { + line-height: 80rpx; + margin-top: 70rpx; + font-size: 32rpx; + display: flex; + border-top: 2rpx solid #f8f8f8; +} + +.publicPop-btn button { + margin: 0 !important; + padding: 0 !important; + background-color: transparent; + font-weight: normal !important; + color: #6c78f8; +} + +.publicPop-btn-go { + width: 50% !important; + text-align: center; + height: 90rpx !important; + line-height: 90rpx !important; + font-size: 30rpx !important; +} + +.publicPop-btn-border { + position: relative; +} + +.publicPop-btn-border::after { + position: absolute; + content: ''; + right: 0; + top: 0; + width: 2rpx; + height: 100rpx; + background-color: #f8f8f8; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..bfdbf9f --- /dev/null +++ b/project.config.json @@ -0,0 +1,55 @@ +{ + "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "packOptions": { + "ignore": [], + "include": [] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false, + "minifyWXML": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "useStaticServer": true, + "checkInvalidKey": true, + "disableUseStrict": false, + "useCompilerPlugins": false + }, + "compileType": "miniprogram", + "libVersion": "2.17.0", + "appid": "wx6bd4fcc040bfa025", + "projectname": "miniprogram-92", + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 4 + } +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..61dddb9 --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,78 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "%E6%B0%B4%E6%84%9F%E5%BA%94", + "setting": { + "compileHotReLoad": true, + "urlCheck": false + }, + "condition": { + "miniprogram": { + "list": [ + { + "name": "", + "pathName": "pages/user/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/report/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/mall/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/index/assess/assess", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/report/share/share", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/login/personal/personal", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/mall/details/details", + "query": "id=2", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/health/article/article", + "query": "id=2", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/report/share/share", + "query": "", + "launchMode": "default", + "scene": null + } + ] + } + }, + "libVersion": "2.26.2" +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/static/icons/arrowWrite.png b/static/icons/arrowWrite.png new file mode 100644 index 0000000..f05e62a Binary files /dev/null and b/static/icons/arrowWrite.png differ diff --git a/static/icons/arrow_more.png b/static/icons/arrow_more.png new file mode 100644 index 0000000..c734f3b Binary files /dev/null and b/static/icons/arrow_more.png differ diff --git a/static/icons/goodsShare.png b/static/icons/goodsShare.png new file mode 100644 index 0000000..213fc24 Binary files /dev/null and b/static/icons/goodsShare.png differ diff --git a/static/icons/homeBlack.png b/static/icons/homeBlack.png new file mode 100644 index 0000000..5e4de66 Binary files /dev/null and b/static/icons/homeBlack.png differ diff --git a/static/icons/homeWrite.png b/static/icons/homeWrite.png new file mode 100644 index 0000000..f8745f0 Binary files /dev/null and b/static/icons/homeWrite.png differ diff --git a/static/icons/loadingGif.gif b/static/icons/loadingGif.gif new file mode 100644 index 0000000..d08d4e3 Binary files /dev/null and b/static/icons/loadingGif.gif differ diff --git a/static/icons/orderArrow.png b/static/icons/orderArrow.png new file mode 100644 index 0000000..bfbd9ce Binary files /dev/null and b/static/icons/orderArrow.png differ diff --git a/static/icons/orderArrow_active.png b/static/icons/orderArrow_active.png new file mode 100644 index 0000000..d36492a Binary files /dev/null and b/static/icons/orderArrow_active.png differ diff --git a/static/icons/refresh_loding.gif b/static/icons/refresh_loding.gif new file mode 100644 index 0000000..5bb90fd Binary files /dev/null and b/static/icons/refresh_loding.gif differ diff --git a/static/icons/reportColse.png b/static/icons/reportColse.png new file mode 100644 index 0000000..392ec82 Binary files /dev/null and b/static/icons/reportColse.png differ diff --git a/static/icons/reportColse_grey.png b/static/icons/reportColse_grey.png new file mode 100644 index 0000000..e104b80 Binary files /dev/null and b/static/icons/reportColse_grey.png differ diff --git a/static/icons/returnBlack.png b/static/icons/returnBlack.png new file mode 100644 index 0000000..f25a5f5 Binary files /dev/null and b/static/icons/returnBlack.png differ diff --git a/static/icons/returnBlue.png b/static/icons/returnBlue.png new file mode 100644 index 0000000..b27d7e6 Binary files /dev/null and b/static/icons/returnBlue.png differ diff --git a/static/icons/returnWrite.png b/static/icons/returnWrite.png new file mode 100644 index 0000000..0a47644 Binary files /dev/null and b/static/icons/returnWrite.png differ diff --git a/static/icons/siteDel.png b/static/icons/siteDel.png new file mode 100644 index 0000000..ef99874 Binary files /dev/null and b/static/icons/siteDel.png differ diff --git a/static/icons/siteEdit.png b/static/icons/siteEdit.png new file mode 100644 index 0000000..5dfc56d Binary files /dev/null and b/static/icons/siteEdit.png differ diff --git a/static/icons/siteIcon.png b/static/icons/siteIcon.png new file mode 100644 index 0000000..505ae38 Binary files /dev/null and b/static/icons/siteIcon.png differ diff --git a/static/icons/vipArrow.png b/static/icons/vipArrow.png new file mode 100644 index 0000000..f2a8bfc Binary files /dev/null and b/static/icons/vipArrow.png differ diff --git a/static/imgs/address.png b/static/imgs/address.png new file mode 100644 index 0000000..7608b5e Binary files /dev/null and b/static/imgs/address.png differ diff --git a/static/imgs/cont_null.png b/static/imgs/cont_null.png new file mode 100644 index 0000000..473d916 Binary files /dev/null and b/static/imgs/cont_null.png differ diff --git a/static/imgs/text_null.png b/static/imgs/text_null.png new file mode 100644 index 0000000..1326295 Binary files /dev/null and b/static/imgs/text_null.png differ diff --git a/static/imgs/userHead.png b/static/imgs/userHead.png new file mode 100644 index 0000000..8642e3a Binary files /dev/null and b/static/imgs/userHead.png differ diff --git a/static/report/report-face.png b/static/report/report-face.png new file mode 100644 index 0000000..ed2f683 Binary files /dev/null and b/static/report/report-face.png differ diff --git a/static/report/report-picture.png b/static/report/report-picture.png new file mode 100644 index 0000000..12cab8e Binary files /dev/null and b/static/report/report-picture.png differ diff --git a/static/report/shareLine.png b/static/report/shareLine.png new file mode 100644 index 0000000..00ec9fb Binary files /dev/null and b/static/report/shareLine.png differ diff --git a/static/tabBarIcon/tabBar_00.png b/static/tabBarIcon/tabBar_00.png new file mode 100644 index 0000000..16243a0 Binary files /dev/null and b/static/tabBarIcon/tabBar_00.png differ diff --git a/static/tabBarIcon/tabBar_01.png b/static/tabBarIcon/tabBar_01.png new file mode 100644 index 0000000..a08cdcd Binary files /dev/null and b/static/tabBarIcon/tabBar_01.png differ diff --git a/static/tabBarIcon/tabBar_02.png b/static/tabBarIcon/tabBar_02.png new file mode 100644 index 0000000..dbf5ac2 Binary files /dev/null and b/static/tabBarIcon/tabBar_02.png differ diff --git a/static/tabBarIcon/tabBar_03.png b/static/tabBarIcon/tabBar_03.png new file mode 100644 index 0000000..b460f2f Binary files /dev/null and b/static/tabBarIcon/tabBar_03.png differ diff --git a/static/tabBarIcon/tabBar_selected_00.png b/static/tabBarIcon/tabBar_selected_00.png new file mode 100644 index 0000000..4e5c691 Binary files /dev/null and b/static/tabBarIcon/tabBar_selected_00.png differ diff --git a/static/tabBarIcon/tabBar_selected_01.png b/static/tabBarIcon/tabBar_selected_01.png new file mode 100644 index 0000000..3aba0ee Binary files /dev/null and b/static/tabBarIcon/tabBar_selected_01.png differ diff --git a/static/tabBarIcon/tabBar_selected_02.png b/static/tabBarIcon/tabBar_selected_02.png new file mode 100644 index 0000000..55cbdba Binary files /dev/null and b/static/tabBarIcon/tabBar_selected_02.png differ diff --git a/static/tabBarIcon/tabBar_selected_03.png b/static/tabBarIcon/tabBar_selected_03.png new file mode 100644 index 0000000..27cc5e1 Binary files /dev/null and b/static/tabBarIcon/tabBar_selected_03.png differ diff --git a/utils/util.js b/utils/util.js new file mode 100644 index 0000000..764bc2c --- /dev/null +++ b/utils/util.js @@ -0,0 +1,19 @@ +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : `0${n}` +} + +module.exports = { + formatTime +}