diff --git a/app.js b/app.js index 437ccd0..41dbb5a 100644 --- a/app.js +++ b/app.js @@ -39,7 +39,7 @@ App({ // 获取前端配置文件 commonApi._post("pbservice/Other/getClientConfig", {unique_key: "wechatxcx"}).then(res => { let data = JSON.parse(res.data); - data.isTest = data.isTest162? true : false; + data.isTest = data.isTest165? true : false; data.indexSeason = null this.globalData.configJson = data }).then(() => { diff --git a/app.json b/app.json index 2e942eb..648d5b6 100644 --- a/app.json +++ b/app.json @@ -254,26 +254,26 @@ { "pagePath": "pages/index/index", "iconPath": "/images/index.png", - "selectedIconPath": "/images/index_seld.png", + "selectedIconPath": "/images/indexs.png", "text": "首页", "shareTimeline": true }, { "pagePath": "pages/pbService/aiHelpYou/index", "iconPath": "/images/ai.png", - "selectedIconPath": "/images/ai_seld.png", + "selectedIconPath": "/images/ais.png", "text": "AI" }, { "pagePath": "pages/map/index", "iconPath": "/images/map.png", - "selectedIconPath": "/images/map_seld.png", + "selectedIconPath": "/images/tuyous.png", "text": "图游" }, { "pagePath": "pages/user/user", "iconPath": "/images/user.png", - "selectedIconPath": "/images/user_seld.png", + "selectedIconPath": "/images/users.png", "text": "我的" } ] diff --git a/images/ais.png b/images/ais.png new file mode 100644 index 0000000..94e74e0 Binary files /dev/null and b/images/ais.png differ diff --git a/images/indexs.png b/images/indexs.png new file mode 100644 index 0000000..da0852d Binary files /dev/null and b/images/indexs.png differ diff --git a/images/tuyous.png b/images/tuyous.png new file mode 100644 index 0000000..589aeb0 Binary files /dev/null and b/images/tuyous.png differ diff --git a/images/users.png b/images/users.png new file mode 100644 index 0000000..b3e58c9 Binary files /dev/null and b/images/users.png differ diff --git a/pages/index/index.js b/pages/index/index.js index 0814ac5..2c26694 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -7,49 +7,51 @@ import commonApi from "../../utils/https/common" import userApi from "../../utils/https/user" import util from "../../utils/util" import https from "../../utils/https.js" -import { unix } from "dayjs" +import { + unix +} from "dayjs" Page({ data: { isTest: false, - startList: {head_img: ''}, // 启动页广告 - fullAdvTimer: null, // 全屏timer - showFullAdv: true, //全屏广告开关 - opacity: 1, // 全屏广告透明度 - time: 3, //全屏广告剩余时间 - showTime: false, // 全屏广告时间展示 - alertSwipeList: [], //弹窗广告 + startList: { + head_img: '' + }, // 启动页广告 + fullAdvTimer: null, // 全屏timer + showFullAdv: true, //全屏广告开关 + opacity: 1, // 全屏广告透明度 + time: 3, //全屏广告剩余时间 + showTime: false, // 全屏广告时间展示 + alertSwipeList: [], //弹窗广告 showAdv: false, //弹窗开关 isMuted: true, - videoPlay: false, + videoPlay: false, - systemStyle: { + systemStyle: { height: 0, padHeight: 0, right: 0, - }, - lat: "", - lon: "", - - indexSeason: {}, // 后台UI配置项 - func_data: {}, - - // bannerInterver: 5*1000, // 动态更改banner时间 + }, + lat: "", + lon: "", + + indexSeason: {}, // 后台UI配置项 + func_data: {}, + + // bannerInterver: 5*1000, // 动态更改banner时间 banner: [], - xiaobanner: [], - ztbanner: [], //苏城环游记banner + xiaobanner: [], + ztbanner: [], //苏城环游记banner activeBannerIndex: 0, - smBannerIndex: 0, - ztBannerIndex: 0, - bannerDataListFake: [ - { - title: "景点门票", - img: "https://static.ticket.sz-trip.com/uploads/20250526/5934b8b77b058ce1de5943adbaf51739.png", - path: "/pages/list/scene/index", - }, - ], - + smBannerIndex: 0, + ztBannerIndex: 0, + bannerDataListFake: [{ + title: "景点门票", + img: "https://static.ticket.sz-trip.com/uploads/20250526/5934b8b77b058ce1de5943adbaf51739.png", + path: "/pages/list/scene/index", + }, ], + // banner上的金刚区 bannerDataList: [ // { @@ -101,7 +103,7 @@ Page({ // weburl:"https://m.cloud.sz-trip.com/movies", // }, // { - // type: 'hotel', // 特殊标识方便查找 更新weburl + // type: 'hotel', // 特殊标识方便查找 更新weburl // title: "酒店住宿", // img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png", // weburl: '', @@ -117,14 +119,14 @@ Page({ // img: "https://static.ticket.sz-trip.com/uploads/20250526/a901ad572bda409e769f92760b812d71.png", // path: '/pages/list/theatre/index' // }, - ], - mainTypeLeft: 0, - mainNavIndex: 0, + ], + mainTypeLeft: 0, + mainNavIndex: 0, xpth: {}, // 新品特惠 - XPathBannerIndex: 0, - xpthIndex: 0, - list: [], // 热门推荐 + XPathBannerIndex: 0, + xpthIndex: 0, + list: [], // 热门推荐 // 公共服务 publicSerivce: [ @@ -132,22 +134,22 @@ Page({ // title: "高峰预警", // img: "https://static.ticket.sz-trip.com/uploads/20250526/c7e28d88bde040c386183d69ae9bb228.png", // path: "/pages/pbService/sceneComfort/index?title=高峰预警", - // eventName: "comfort_click", - // keyname: 'gg_gfyj', + // eventName: "comfort_click", + // keyname: 'gg_gfyj', // }, // { // title: "实时路况", // img: "https://static.ticket.sz-trip.com/uploads/20250526/a678fdc2127648cd7881e36791b2062a.png", // weburl: "https://jiaotonghao2.amap.com/?channel=amap&unitId=257&src=app_share#/", - // eventName: "sslk", - // keyname: 'gg_sslk', + // eventName: "sslk", + // keyname: 'gg_sslk', // }, // { // title: "行李直送", // img: "https://static.ticket.sz-trip.com/uploads/20250526/66c8614112630ed168a27150f15a3234.png", // appId: 'wx757dd1ee184e75e9', - // pagePath: "pages/tabBar/index/index", - // keyname: 'gg_xlzs', + // pagePath: "pages/tabBar/index/index", + // keyname: 'gg_xlzs', // }, // { // title: "行李寄存", @@ -168,12 +170,12 @@ Page({ // weburl: "https://m.cloud.sz-trip.com/ParkingArea", // keyname: 'gg_tcc', // }, - - ], - - // 旅游助手 - travelData: [ - // { + + ], + + // 旅游助手 + travelData: [ + // { // title: "最美打卡点", // img: "https://static.ticket.sz-trip.com/uploads/20250526/800a30b94f77c1f7f1bc17f33c0daacd.png", // path: "/subPackageCheckPoint/pages/index/index", @@ -198,7 +200,7 @@ Page({ // path: "/pages/list/strategy/index", // keyname: 'ly_yjgl', // }, - ], + ], // 数字文旅 travelCulture: [ @@ -282,183 +284,215 @@ Page({ // path: "/pages/pbService/appreciate/index", // keyname: 'sz_mtjs', // }, - - ], + + ], scrollLeft: 0, - - // 十全十美 - // area_ids: ["changshu","taicang", "kunshan","wujiang","gongyeyuanqu","zhangjiagang","wuzhong","xiangcheng","gusu","gaoxin"], - SQSM: [ - // { - // title: "常熟", + + // 十全十美 + // area_ids: ["changshu","taicang", "kunshan","wujiang","gongyeyuanqu","zhangjiagang","wuzhong","xiangcheng","gusu","gaoxin"], + SQSM: [ + // { + // title: "常熟", // img: "https://static.ticket.sz-trip.com/uploads/20250529/ed641bf31558381e8d1c372e5cbbd155.png", - // appId: 'wxdaf3d5edd07dc7af', + // appId: 'wxdaf3d5edd07dc7af', // pagePath: 'pages/index/index', // keyname: 'changshu', - // }, - // { - // title: "太仓", + // }, + // { + // title: "太仓", // img: "https://static.ticket.sz-trip.com/uploads/20250529/f359551295197eff9c0966324659f037.png", - // appId: 'wx8853b0d93cbca75e', + // appId: 'wx8853b0d93cbca75e', // pagePath: 'pages/home/home', // keyname: 'taicang', - // }, - // { - // title: "昆山", + // }, + // { + // title: "昆山", // img: "https://static.ticket.sz-trip.com/uploads/20250529/35f498dbb43e14cdf3c6bbdf83e613db.png", - // appId: 'wx8888a3fd0862b4c8', + // appId: 'wx8888a3fd0862b4c8', // pagePath: 'pages/index/index', // keyname: 'kunshan', - // }, - // { - // title: "吴江", + // }, + // { + // title: "吴江", // img: "https://static.ticket.sz-trip.com/uploads/20250529/2288c75b3797363015bfe633ea9abc0e.png", - // appId: 'wx8eadea4ee2d42d4b', + // appId: 'wx8eadea4ee2d42d4b', // pagePath: 'pages/index/index', // keyname: 'wujiang', - // }, - // { - // title: "工业园区", + // }, + // { + // title: "工业园区", // img: "https://static.ticket.sz-trip.com/uploads/20250529/9e947f0ef8addbe5c52b5bd4de205788.png", - // appId: 'wxd323e63a10aa6865', + // appId: 'wxd323e63a10aa6865', // pagePath: 'pages/home/index', // keyname: 'yuanqu', - // }, - // { - // title: "张家港", - // img: "https://static.ticket.sz-trip.com/uploads/20250529/6162e0a86ec7e7b12e568fd5f81b5c9b.png", - // path: "/pages/list/six/index?area=zhangjiagang", + // }, + // { + // title: "张家港", + // img: "https://static.ticket.sz-trip.com/uploads/20250529/6162e0a86ec7e7b12e568fd5f81b5c9b.png", + // path: "/pages/list/six/index?area=zhangjiagang", // keyname: 'zhangjiagang', - // }, - // { - // title: "吴中", - // img: "https://static.ticket.sz-trip.com/uploads/20250529/36fc77bf5d6879e6ce06ae349187c2ad.png", - // path: "/pages/list/six/index?area=wuzhong", + // }, + // { + // title: "吴中", + // img: "https://static.ticket.sz-trip.com/uploads/20250529/36fc77bf5d6879e6ce06ae349187c2ad.png", + // path: "/pages/list/six/index?area=wuzhong", // keyname: 'wuzhong', - // }, - // { - // title: "相城", - // img: "https://static.ticket.sz-trip.com/uploads/20250529/ec54fba906166c7512d26ca8a4fa5a9f.png", - // path: "/pages/list/six/index?area=xiangcheng", + // }, + // { + // title: "相城", + // img: "https://static.ticket.sz-trip.com/uploads/20250529/ec54fba906166c7512d26ca8a4fa5a9f.png", + // path: "/pages/list/six/index?area=xiangcheng", // keyname: 'xiangcheng', - // }, - // { - // title: "姑苏", - // img: "https://static.ticket.sz-trip.com/uploads/20250529/cbb939c4ddfa187489b59adcbe72f7a9.png", - // path: "/pages/list/six/index?area=gusu", + // }, + // { + // title: "姑苏", + // img: "https://static.ticket.sz-trip.com/uploads/20250529/cbb939c4ddfa187489b59adcbe72f7a9.png", + // path: "/pages/list/six/index?area=gusu", // keyname: 'gusu', - // }, - // { - // title: "高新", - // img: "https://static.ticket.sz-trip.com/uploads/20250529/f2aa7328af4afaa9d1d4ecac1778300a.png", - // path: "/pages/list/six/index?area=gaoxin", + // }, + // { + // title: "高新", + // img: "https://static.ticket.sz-trip.com/uploads/20250529/f2aa7328af4afaa9d1d4ecac1778300a.png", + // path: "/pages/list/six/index?area=gaoxin", // keyname: 'gaoxin', - // }, - - - ], - - // 长三角文旅平台 - otherPlat: [ - // { - // "name":"玉见昆山", - // "icon":"https://static.ticket.sz-trip.com/uploads/20250526/c85dbe1b0f8f58014c05a30b3e6f86b5.png", - // "type":"mini", - // "path":"", - // "appid":"wx8888a3fd0862b4c8" - // }, - // { - // "name":"智游常熟", - // "icon":"https://static.ticket.sz-trip.com/uploads/20250526/98d57e31995b6dc3188f8717201640f1.png", - // "type":"mini", - // "path":"", - // "appid":"wxdaf3d5edd07dc7af" - // }, - { - "name":"常享游", - "icon":"https://static.ticket.sz-trip.com/uploads/20250604/5112dd50e7c175bf58416ba9d4e4b846.png", - "type":"h5", - "url":"https://tour.wlczy.com/h5/" - }, - { - "name":"畅游宿迁", - "icon":"https://static.ticket.sz-trip.com/uploads/20250604/962f331b2319b9759363c3787ca8d088.png", - "type":"mini", - "path":"/pages/index/index", - "appid":"wxcb00a59c4fba136e" - }, - - ], - - // 回购榜 - repurchaseList: [], - canGetrepurchase: true, - - urltopage: {}, - - cityIndex: 0, - scrollItem: "scrollItem-0", - - aiStr: "", + // }, + + + ], + + // 长三角文旅平台 + otherPlat: [ + // { + // "name":"玉见昆山", + // "icon":"https://static.ticket.sz-trip.com/uploads/20250526/c85dbe1b0f8f58014c05a30b3e6f86b5.png", + // "type":"mini", + // "path":"", + // "appid":"wx8888a3fd0862b4c8" + // }, + // { + // "name":"智游常熟", + // "icon":"https://static.ticket.sz-trip.com/uploads/20250526/98d57e31995b6dc3188f8717201640f1.png", + // "type":"mini", + // "path":"", + // "appid":"wxdaf3d5edd07dc7af" + // }, + { + "name": "常享游", + "icon": "https://static.ticket.sz-trip.com/uploads/20250604/5112dd50e7c175bf58416ba9d4e4b846.png", + "type": "h5", + "url": "https://tour.wlczy.com/h5/" + }, + { + "name": "畅游宿迁", + "icon": "https://static.ticket.sz-trip.com/uploads/20250604/962f331b2319b9759363c3787ca8d088.png", + "type": "mini", + "path": "/pages/index/index", + "appid": "wxcb00a59c4fba136e" + }, + + ], + + // 回购榜 + repurchaseList: [], + canGetrepurchase: true, + + urltopage: {}, + + cityIndex: 0, + scrollItem: "scrollItem-0", + + aiStr: "", // ---------------2025-5-26改版没用到的------------------ fourProduct: [], hotIndex: 0, indexHot: [], - weather: null, - showMore: false, - - // 页面图片 - // imageSourceList:imageSource, + weather: null, + showMore: false, + // 页面图片 + // imageSourceList:imageSource, + recommendType: [{ + id: 306, + name: '必逛景点榜', + img: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png', + path: '/pages/list/scene/index', + list: [] + }, + { + id: 307, + name: '寻鲜美食榜', + img: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png', + path: '/subPackages/foodListNew/index', + list: [] + }, + { + id: 308, + name: '优选住宿榜', + img: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png', + path: '/pages/pbService/web/index?weburl=' + encodeURIComponent( + 'https://m.cloud.sz-trip.com/selectedHotels'), + list: [] + }, + { + id: 309, + name: '必看演出榜', + img: 'https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png', + path: '/pages/list/theatre/index', + list: [] + } + ], + activeIndex: 0, + touchStartX: 0, + // 用于存储计算好的样式字符串数组 + cardStyles: [] }, onLoad: function(options) { + // 初始化时计算一次样式 + this.updateCardStyles(); // 相城小程序跳转获取用户信息 - if(options && options.szxcCode) { + if (options && options.szxcCode) { commonApi._post("uservice/user/loginByXC", { code: options.szxcCode }).then(res => { - if(res.data && res.data.id && res.data.token) { - https.set_logininfo(res); + if (res.data && res.data.id && res.data.token) { + https.set_logininfo(res); } }) - } - if (options.from) { + } + if (options.from) { app.globalData.from = options.from; } - return - console.log('options',options) - - }, + }, onReady: function() { - this.getHeight() - this.getWeather() // 天气 - this.getIndexSeason() - this.getBanner() + this.getHeight() + this.getWeather() // 天气 + this.getIndexSeason() + this.getBanner() + + this.setAiStr() - this.setAiStr() + this.getXpthList() // 限时特惠 - this.getXpthList() // 限时特惠 + this.getList() // 回购榜 - this.getList() // 回购榜 + this.getRepurchaseList() - this.getRepurchaseList() - - // this.getFourProduct() // 活动日历 + // this.getFourProduct() // 活动日历 - wx.getLocation({ + wx.getLocation({ type: 'gcj02', success: (res) => { this.setData({ @@ -466,143 +500,353 @@ Page({ lon: res.longitude }) }, - fail: (err) => { + fail: (err) => {} + }) + + this.getUrlToPage() + this.getShowMore() + + const typeList = this.data.recommendType; + + // 遍历数组进行请求 + typeList.forEach((item, index) => { + // 1. 根据索引判断接口地址 (前两个用 scene 接口,后面用 product 接口) + let apiUrl = ''; + if (index < 2) { + apiUrl = 'scene/get_scene_by_tag_subject'; + } else { + apiUrl = 'product/get_product_by_tag_subject'; } - }) - - this.getUrlToPage() - this.getShowMore() - }, - - setAiStr :function () { - let str = "你好啊,我是卿卿,我来带你游苏州~"; - let i = 0; - let timer = setInterval(()=>{ - i++ - this.setData({ - aiStr: str.slice(0,i) - }) - if (i>str.length) { - clearInterval(timer) - } - },125) - }, - - showImg (img) { - if (!img) { return img } - if (img.indexOf('https://') != -1 || img.indexOf('http://') != -1) { - return img; - } else { - // return "https://test.api.cloud.sz-trip.com"+img - return "https://static.ticket.sz-trip.com" + img; - } - }, - - gotoPath(e) { - if (e.currentTarget.dataset.path){ - wx.navigateTo({ - url: e.currentTarget.dataset.path, - }) - return - } - - }, - - - // 获取系统信息 + + // 2. 发起请求 + commonApi._post(apiUrl, { + offset: 0, + limit: 3, + tag_id: item.id + }).then(res => { + const key = `recommendType[${index}].list`; + res.data.list.forEach(item => { + // 手动增加一个 tagsArray 字段 + if (item.display_tags) { + item.tagsArray = item.display_tags.split(',').slice(0, 2); + } else { + item.tagsArray = []; + } + }); + this.setData({ + [key]: res.data.list // 假设返回的数据里直接有 list 字段 + }); + }).catch(err => { + console.error(`请求第 ${index + 1} 个榜单失败`, err); + }); + }); + }, + // 1. 点击 Tab 切换 + handleTabClick(e) { + const index = e.currentTarget.dataset.index; + this.setData({ + activeIndex: index + }); + this.updateCardStyles(); // 更新样式 + }, + + // 2. 点击卡片切换 + handleCardClick(e) { + const index = e.currentTarget.dataset.index; + if (index !== this.data.activeIndex) { + this.setData({ + activeIndex: index + }); + this.updateCardStyles(); // 更新样式 + } + }, + + // 3. ★核心逻辑:在 JS 中计算所有卡片的样式 + updateCardStyles() { + const { + activeIndex, + recommendType + } = this.data; + const len = recommendType.length; + + // 偏移量配置 (单位 rpx) + const xStep = 24; + const yStep = 14; + + // 遍历生成每个卡片的样式字符串 + const newStyles = recommendType.map((item, index) => { + // 计算距离 + let diff = (index - activeIndex + len) % len; + + let zIndex = 0; + let xOffset = 0; + let yOffset = 0; + let opacity = 1; + let bgColor = '#fcf1e2'; + let bgImage = 'none'; + + if (diff === 0) { + // --- 第1层 (最上面) --- + zIndex = 10; + xOffset = 0; + yOffset = 0; + bgImage = + 'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/biguang.png)'; + } else if (diff === 1) { + // --- 第2层 --- + zIndex = 9; + xOffset = xStep * 1; + yOffset = yStep * 1; + bgImage = + 'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBgs.png)'; + } else if (diff === 2) { + // --- 第3层 --- + zIndex = 8; + xOffset = xStep * 2; + yOffset = yStep * 2; + bgImage = + 'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBgs.png)'; + } else if (diff === 3) { + // --- 第4层 --- + zIndex = 7; + xOffset = xStep * 3; + yOffset = yStep * 3; + bgImage = + 'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBgs.png)'; + } else { + // --- 储备层 (隐藏在第4层后面) --- + zIndex = 1; + xOffset = xStep * 3; + yOffset = yStep * 3; + bgImage = + 'url(https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBgs.png)'; + } + + // 构造样式字符串 + return ` + z-index: ${zIndex}; + transform: translate(${xOffset}rpx, ${yOffset}rpx); + opacity: ${opacity}; + background-image: ${bgImage}; + background-size: 100% 100%; + background-repeat: no-repeat; + `; + }); + + // 更新到视图 + this.setData({ + cardStyles: newStyles + }); + }, + + // 4. 触摸开始 + handleTouchStart(e) { + this.setData({ + touchStartX: e.touches[0].clientX + }); + }, + + // 5. 触摸结束 + handleTouchEnd(e) { + const touchEndX = e.changedTouches[0].clientX; + const diff = this.data.touchStartX - touchEndX; + const len = this.data.recommendType.length; + let current = this.data.activeIndex; + + if (diff > 50) { + // 左滑 -> 下一张 + current = (current + 1) % len; + } else if (diff < -50) { + // 右滑 -> 上一张 + current = (current - 1 + len) % len; + } + + if (current !== this.data.activeIndex) { + this.setData({ + activeIndex: current + }); + this.updateCardStyles(); // 更新样式 + } + }, + + setAiStr: function() { + let str = "你好啊,我是卿卿,我来带你游苏州~"; + let i = 0; + let timer = setInterval(() => { + i++ + this.setData({ + aiStr: str.slice(0, i) + }) + if (i > str.length) { + clearInterval(timer) + } + }, 125) + }, + + showImg(img) { + if (!img) { + return img + } + if (img.indexOf('https://') != -1 || img.indexOf('http://') != -1) { + return img; + } else { + // return "https://test.api.cloud.sz-trip.com"+img + return "https://static.ticket.sz-trip.com" + img; + } + }, + + gotoPath(e) { + console.log(e.currentTarget.dataset.item.path) + if (e.currentTarget.dataset.item.path) { + wx.navigateTo({ + url: e.currentTarget.dataset.item.path, + }) + return + } + + }, + + + // 获取系统信息 getHeight() { - let systemInfo = wx.getSystemInfoSync(), + let systemInfo = wx.getSystemInfoSync(), rect = wx.getMenuButtonBoundingClientRect(); - let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height; - let systemStyle = { - height: height, // 导航栏 - padHeight: systemInfo.statusBarHeight, // 状态栏 - right: (systemInfo.screenWidth - rect.right) + rect.width // 右侧胶囊 - } - this.setData({ + let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height; + let systemStyle = { + height: height, // 导航栏 + padHeight: systemInfo.statusBarHeight, // 状态栏 + right: (systemInfo.screenWidth - rect.right) + rect.width // 右侧胶囊 + } + this.setData({ systemStyle: systemStyle, }) - }, - //获取季节配置 + }, + //获取季节配置 getIndexSeason() { - if (app.globalData.configJson&&app.globalData.configJson.indexSeason) { - console.log('app', app.globalData.configJson) - this.setData({ - indexHot: app.globalData.configJson.indexHot, - isTest: app.globalData.configJson.isTest, - indexSeason: app.globalData.configJson.indexSeason, - bannerDataList: (app.globalData.configJson.nav_menu || []), - mainTypeList: (app.globalData.configJson.menu_button || []), - publicSerivce: (app.globalData.configJson.service_data || []), - travelData:(app.globalData.configJson.travel_data||[]), - travelCulture:(app.globalData.configJson.number_data||[]), - SQSM:(app.globalData.configJson.city_data||[]), - otherPlat: app.globalData.configJson.platform_data, - func_data: (app.globalData.configJson.func_data||{}) - }) - } else { - // 小程序是3 测试H5 15 - commonApi._post("adv/get_home_ui", {type_id: 3}).then(res => { - let obj = {}; - (res.data.content||[]).forEach(item => { - obj[item.id] = item.image - }); - app.globalData.configJson.indexSeason = obj - app.globalData.loadIndexSeason = true - app.globalData.configJson.nav_menu = (res.data.nav_menu || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'nav_menu', key_number: index}} - }) - app.globalData.configJson.menu_button = (res.data.menu_button || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'menu_button', key_number: index}} - }) - // 公共服务 publicSerivce - app.globalData.configJson.service_data = (res.data.service_data || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'service_data', key_number: index}} - }) - // 旅游助手 travelData - app.globalData.configJson.travel_data = (res.data.travel_data || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'travel_data', key_number: index}} - }) - // 数字文旅 travelCulture - app.globalData.configJson.number_data = (res.data.number_data || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'number_data', key_number: index}} - }) - // 十全十美 SQSM - app.globalData.configJson.city_data = (res.data.city_data || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'city_data', key_number: index}} - }) - // 其他平台otherPlat - app.globalData.configJson.platform_data = (res.data.platform_data || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'platform_data', key_number: index}} - }) - - - let func_data = {} - for(let item of (res.data.func_data || [])) { - func_data[item.jump_type] = true - } - app.globalData.configJson.func_data = func_data - console.log('webData', app.globalData.configJson) - this.setData({ - indexHot: app.globalData.configJson.indexHot, - isTest: app.globalData.configJson.isTest, - otherPlat: app.globalData.configJson.platform_data, - indexSeason: app.globalData.configJson.indexSeason, - bannerDataList: (app.globalData.configJson.nav_menu || []), - mainTypeList: (app.globalData.configJson.menu_button || []), - publicSerivce: (app.globalData.configJson.service_data || []), - travelData:(app.globalData.configJson.travel_data||[]), - travelCulture:(app.globalData.configJson.number_data||[]), - SQSM:(app.globalData.configJson.city_data||[]), - func_data: (app.globalData.configJson.func_data||{}) - }) - }) - } - console.log(this.data) - }, - // url跳转(不知道什么东西) - getUrlToPage () { - commonApi._post("pbservice/Other/getClientConfig", { + if (app.globalData.configJson && app.globalData.configJson.indexSeason) { + console.log('app', app.globalData.configJson) + this.setData({ + indexHot: app.globalData.configJson.indexHot, + isTest: app.globalData.configJson.isTest, + indexSeason: app.globalData.configJson.indexSeason, + bannerDataList: (app.globalData.configJson.nav_menu || []), + mainTypeList: (app.globalData.configJson.menu_button || []), + publicSerivce: (app.globalData.configJson.service_data || []), + travelData: (app.globalData.configJson.travel_data || []), + travelCulture: (app.globalData.configJson.number_data || []), + SQSM: (app.globalData.configJson.city_data || []), + otherPlat: app.globalData.configJson.platform_data, + func_data: (app.globalData.configJson.func_data || {}) + }) + } else { + // 小程序是3 测试H5 15 + commonApi._post("adv/get_home_ui", { + type_id: 3 + }).then(res => { + let obj = {}; + (res.data.content || []).forEach(item => { + obj[item.id] = item.image + }); + app.globalData.configJson.indexSeason = obj + app.globalData.loadIndexSeason = true + app.globalData.configJson.nav_menu = (res.data.nav_menu || []).map((v, index) => { + return { + ...v, + pagePoint: { + classification: 'nav_menu', + key_number: index + } + } + }) + app.globalData.configJson.menu_button = (res.data.menu_button || []).map((v, index) => { + return { + ...v, + pagePoint: { + classification: 'menu_button', + key_number: index + } + } + }) + // 公共服务 publicSerivce + app.globalData.configJson.service_data = (res.data.service_data || []).map((v, + index) => { + return { + ...v, + pagePoint: { + classification: 'service_data', + key_number: index + } + } + }) + // 旅游助手 travelData + app.globalData.configJson.travel_data = (res.data.travel_data || []).map((v, index) => { + return { + ...v, + pagePoint: { + classification: 'travel_data', + key_number: index + } + } + }) + // 数字文旅 travelCulture + app.globalData.configJson.number_data = (res.data.number_data || []).map((v, index) => { + return { + ...v, + pagePoint: { + classification: 'number_data', + key_number: index + } + } + }) + // 十全十美 SQSM + app.globalData.configJson.city_data = (res.data.city_data || []).map((v, index) => { + return { + ...v, + pagePoint: { + classification: 'city_data', + key_number: index + } + } + }) + // 其他平台otherPlat + app.globalData.configJson.platform_data = (res.data.platform_data || []).map((v, + index) => { + return { + ...v, + pagePoint: { + classification: 'platform_data', + key_number: index + } + } + }) + + + let func_data = {} + for (let item of (res.data.func_data || [])) { + func_data[item.jump_type] = true + } + app.globalData.configJson.func_data = func_data + console.log('webData', app.globalData.configJson) + this.setData({ + indexHot: app.globalData.configJson.indexHot, + isTest: app.globalData.configJson.isTest, + otherPlat: app.globalData.configJson.platform_data, + indexSeason: app.globalData.configJson.indexSeason, + bannerDataList: (app.globalData.configJson.nav_menu || []), + mainTypeList: (app.globalData.configJson.menu_button || []), + publicSerivce: (app.globalData.configJson.service_data || []), + travelData: (app.globalData.configJson.travel_data || []), + travelCulture: (app.globalData.configJson.number_data || []), + SQSM: (app.globalData.configJson.city_data || []), + func_data: (app.globalData.configJson.func_data || {}) + }) + }) + } + console.log(this.data) + }, + // url跳转(不知道什么东西) + getUrlToPage() { + commonApi._post("pbservice/Other/getClientConfig", { unique_key: "urltopage" }).then(res => { let data = JSON.parse(res.data) @@ -610,80 +854,131 @@ Page({ urltopage: data }) }) - }, - - getShowMore () { - commonApi._post("multimedia/detail", {id: 2462}).then(res => { - if (res && res.data) { - this.setData({ - showMore: res.data.company_name ==1?true:false - }) - } - - }) - }, - - - - // --------------------banner 相关--------------------------- - // 获取banner 和开屏广告 - getBanner: function() { - let _this = this - //全屏广告 - commonApi._post("adv/getAdv", {position: 2,type_id: 3}).then(res => { + }, + + getShowMore() { + commonApi._post("multimedia/detail", { + id: 2462 + }).then(res => { + if (res && res.data) { + this.setData({ + showMore: res.data.company_name == 1 ? true : false + }) + } + + }) + }, + + // --------------------banner 相关--------------------------- + // 获取banner 和开屏广告 + getBanner: function() { + let _this = this + //全屏广告 + commonApi._post("adv/getAdv", { + position: 2, + type_id: 3 + }).then(res => { if (res.data.length > 0) { let length = res.data.length - let num = Math.floor(Math.random() * length); - this.setData({startList: res.data[num]}) + let num = Math.floor(Math.random() * length); + this.setData({ + startList: res.data[num] + }) // 图片 if (this.data.startList.media_type) { - wx.hideTabBar() //这里隐藏了底部导航栏 - this.setData({showTime: true}) + wx.hideTabBar() //这里隐藏了底部导航栏 + this.setData({ + showTime: true + }) this.data.fullAdvTimer = setInterval(() => { - _this.data.time-=0.5 - if (Number.isInteger(_this.data.time)) { - _this.setData({time: _this.data.time}) - } + _this.data.time -= 0.5 + if (Number.isInteger(_this.data.time)) { + _this.setData({ + time: _this.data.time + }) + } if (_this.data.time <= 0) { - _this.setData({opacity: _this.data.opacity - 0.3}) + _this.setData({ + opacity: _this.data.opacity - 0.3 + }) } if (_this.data.time <= -1) { clearInterval(_this.data.fullAdvTimer) wx.showTabBar() //倒计时结束清除定时器显示导航栏 - _this.setData({showFullAdv: false}) + _this.setData({ + showFullAdv: false + }) } }, 500) } else { // 视频 } } else { - this.setData({showFullAdv: false}) + this.setData({ + showFullAdv: false + }) } }) - // 顶部banner - commonApi._post("adv/getAdv", {position: 0,type_id: 3}).then(res => { - let resData = (res.data || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'bigBanner', key_number: v.id}} - }) - this.setData({banner: resData}) - }) - // 专题banner - commonApi._post("adv/getAdv", {position: 6,type_id: 3}).then(res => { - let resData = (res.data || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'specialBanner', key_number: v.id}} - }) - this.setData({ztbanner:resData}) - }) - // 小banner - commonApi._post("adv/getAdv", {position: 1,type_id: 3}).then(res => { - let resData = (res.data || []).map((v,index)=>{ - return {...v, pagePoint: {classification: 'smallBanner', key_number: v.id}} - }) - this.setData({xiaobanner: resData}) + // 顶部banner + commonApi._post("adv/getAdv", { + position: 0, + type_id: 3 + }).then(res => { + let resData = (res.data || []).map((v, index) => { + return { + ...v, + pagePoint: { + classification: 'bigBanner', + key_number: v.id + } + } + }) + this.setData({ + banner: resData + }) + }) + // 专题banner + commonApi._post("adv/getAdv", { + position: 6, + type_id: 3 + }).then(res => { + let resData = (res.data || []).map((v, index) => { + return { + ...v, + pagePoint: { + classification: 'specialBanner', + key_number: v.id + } + } + }) + this.setData({ + ztbanner: resData + }) + }) + // 小banner + commonApi._post("adv/getAdv", { + position: 1, + type_id: 3 + }).then(res => { + let resData = (res.data || []).map((v, index) => { + return { + ...v, + pagePoint: { + classification: 'smallBanner', + key_number: v.id + } + } + }) + this.setData({ + xiaobanner: resData + }) }) //弹窗广告 - commonApi._post("adv/getAdv", {position: 3,type_id: 3}).then(res => { + commonApi._post("adv/getAdv", { + position: 3, + type_id: 3 + }).then(res => { if (res.data.length > 0) { this.setData({ alertSwipeList: res.data || [], @@ -692,23 +987,27 @@ Page({ } }) }, - // 统一的banner change 需要时可以放开 + // 统一的banner change 需要时可以放开 changeBannerIndex: function(e) { - // return - let keyname = e.currentTarget.dataset.keyname + // return + let keyname = e.currentTarget.dataset.keyname this.setData({ - [keyname]: e.detail.current, + [keyname]: e.detail.current, }) - }, + }, // 轮播图点击 bannerClick: function(e) { if (this.data.isTest) return; - let item = e.currentTarget.dataset.item; - let source = e.currentTarget.dataset.source; - if (source) { util.setGlobalPagePoint(source); } + let item = e.currentTarget.dataset.item; + let source = e.currentTarget.dataset.source; + if (source) { + util.setGlobalPagePoint(source); + } console.log(item) - if (item.pagePoint) { this.newPagePoint(item.pagePoint) } - + if (item.pagePoint) { + this.newPagePoint(item.pagePoint) + } + switch (item.jump_type) { case 0: break; @@ -790,16 +1089,16 @@ Page({ return; }, - newPagePoint (param) { + newPagePoint(param) { commonApi._post("browse/newBuryingPoint", { - uuid: app.globalData.uuid, - drive: "mini", - ...param, + uuid: app.globalData.uuid, + drive: "mini", + ...param, }) }, - - //------------------------金刚区点击------------------------------------- - // 自定义数据的跳转 + + //------------------------金刚区点击------------------------------------- + // 自定义数据的跳转 mainIconClick: function(e) { let item = e.currentTarget.dataset.item @@ -821,83 +1120,84 @@ Page({ url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.weburl) }) return - } - }, - // 后台配置数据跳转 - mainNavClick:function (e) { - let item = e.currentTarget.dataset.item - console.log(item) - if (item.pagePoint) { - this.newPagePoint(item.pagePoint) - } - util.setGlobalPagePoint(item.menu_name || "首页") - - if (item.jump_type == "page") { - if (item.page.mini) { - wx.navigateTo({ - url: "/"+item.page.mini, - }) - return - } - if (item.page.tdata) { - //sph 视频号 - if (item.page.tdata.appid&&item.page.tdata.appid.indexOf("sph")>=0) { - // if (item.page.tdata.page) { - // wx.openChannelsActivity({ - // finderUserName: item.page.tdata.appid, // 视频号的原始ID - // feedId: item.page.tdata.page, // 视频号的视频ID - // success(res) { - // console.log('拉起视频号成功', res); - // }, - // fail(res) { - // console.log('拉起视频号失败', res); - // } - // }) - // } else { - // wx.openChannelsUserProfile({ - // finderUserName: item.page.tdata.appid, // 视频号的原始ID - // }) - // } - wx.openChannelsUserProfile({ - finderUserName: item.page.tdata.appid, // 视频号的原始ID - }) - return - } - - if (item.page.tdata.ghid == "gh_b55e177a4069" || item.page.tdata.appid == 'wx4bb7b6050831f585') { - wx.navigateTo({ - url: "/"+item.page.tdata.page, - }) - - } else { - wx.navigateToMiniProgram({ - appId: item.page.tdata.appid, - path: item.page.tdata.page - }) - } - } - - } - if (item.jump_type == "link") { - wx.navigateTo({ - url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.url), - }) - return - } - if (item.jump_type == "text") { - setTimeout(() => { - wx.showToast({ - title: item.text, - icon:'none', - duration: 2000, - }) - }, 200); - - } - }, - - // 其他平台配置数据的跳转 - gotoOther: function(e) { + } + }, + // 后台配置数据跳转 + mainNavClick: function(e) { + let item = e.currentTarget.dataset.item + console.log(item) + if (item.pagePoint) { + this.newPagePoint(item.pagePoint) + } + util.setGlobalPagePoint(item.menu_name || "首页") + + if (item.jump_type == "page") { + if (item.page.mini) { + wx.navigateTo({ + url: "/" + item.page.mini, + }) + return + } + if (item.page.tdata) { + //sph 视频号 + if (item.page.tdata.appid && item.page.tdata.appid.indexOf("sph") >= 0) { + // if (item.page.tdata.page) { + // wx.openChannelsActivity({ + // finderUserName: item.page.tdata.appid, // 视频号的原始ID + // feedId: item.page.tdata.page, // 视频号的视频ID + // success(res) { + // console.log('拉起视频号成功', res); + // }, + // fail(res) { + // console.log('拉起视频号失败', res); + // } + // }) + // } else { + // wx.openChannelsUserProfile({ + // finderUserName: item.page.tdata.appid, // 视频号的原始ID + // }) + // } + wx.openChannelsUserProfile({ + finderUserName: item.page.tdata.appid, // 视频号的原始ID + }) + return + } + + if (item.page.tdata.ghid == "gh_b55e177a4069" || item.page.tdata.appid == + 'wx4bb7b6050831f585') { + wx.navigateTo({ + url: "/" + item.page.tdata.page, + }) + + } else { + wx.navigateToMiniProgram({ + appId: item.page.tdata.appid, + path: item.page.tdata.page + }) + } + } + + } + if (item.jump_type == "link") { + wx.navigateTo({ + url: "/pages/pbService/web/index?weburl=" + encodeURIComponent(item.url), + }) + return + } + if (item.jump_type == "text") { + setTimeout(() => { + wx.showToast({ + title: item.text, + icon: 'none', + duration: 2000, + }) + }, 200); + + } + }, + + // 其他平台配置数据的跳转 + gotoOther: function(e) { let item = e.currentTarget.dataset.item; if (item.type == 'h5') { app.globalData.weburl = item.url @@ -918,91 +1218,135 @@ Page({ // 滚动监听 listenScroll(e) { - let keyname = e.currentTarget.dataset.keyname + let keyname = e.currentTarget.dataset.keyname this.setData({ - [keyname]: e.detail.scrollLeft, + [keyname]: e.detail.scrollLeft, }) }, - - // ----------------------------------------------------------------------- - - // 新品特惠 + + // ----------------------------------------------------------------------- + + // 新品特惠 getXpthList: function() { commonApi._post("product/get_product_indulgence", { tag_id: 275, - typeId: 3, - type: 1, // 返回数组 + typeId: 3, + type: 1, // 返回数组 }).then(res => { - console.log("resData",res.data.adv); - (res.data.adv || []).forEach(v=>{ v.pagePoint = {classification: 'flashSales', key_number: v.id} }); - (res.data.list || []).forEach(v=>{ v.pagePoint = {classification: 'flashSales', key_number: v.id} }); + console.log("resData", res.data.adv); + (res.data.adv || []).forEach(v => { + v.pagePoint = { + classification: 'flashSales', + key_number: v.id + } + }); + (res.data.list || []).forEach(v => { + v.pagePoint = { + classification: 'flashSales', + key_number: v.id + } + }); - this.setData({xpth: res.data}) + this.setData({ + xpth: res.data + }) }) - }, - - // 更换新品特惠 当即热门 - changeXpthIndex:function (e) { - let value = e.currentTarget.dataset.value - this.setData({xpthIndex:value}) - }, + }, + + // 更换新品特惠 当即热门 + changeXpthIndex: function(e) { + let value = e.currentTarget.dataset.value + this.setData({ + xpthIndex: value + }) + }, productGotoDetail: function(e) { - let item = e.currentTarget.dataset.item; - let source = e.currentTarget.dataset.source; - if (source) { util.setGlobalPagePoint(source); } - if (item.pagePoint) { this.newPagePoint(item.pagePoint) } + let item = e.currentTarget.dataset.item; + let source = e.currentTarget.dataset.source; + if (source) { + util.setGlobalPagePoint(source); + } + if (item.pagePoint) { + this.newPagePoint(item.pagePoint) + } util.gotoDetail(item) }, // 热门推荐 getList: function() { - commonApi._post("product/get_product_by_tag_subject", { - tag_id: 85,offset: 0,limit: 5, - }).then(res=>{ - let resData = res.data.list || [] - resData.forEach(v=>{ - v.pagePoint = {classification: 'hot', key_number: v.id}; - v.display_tags_arr = v.display_tags?v.display_tags.split(",") : [] - }) - this.setData({ list: resData}) - }) - }, - // 回购 - getRepurchaseList:function () { - commonApi._post("repurchase/repurchase/getRepurchaseList", {}).then(res=>{ - (res.data || []).forEach(v=>{ - v.headimg = this.showImg(v.headimg) - v.pagePoint={classification: 'repurchase', key_number: v.product_id} - }) - this.setData({ repurchaseList: res.data || []}) - }) - }, + commonApi._post("product/get_product_by_tag_subject", { + tag_id: 85, + offset: 0, + limit: 5, + }).then(res => { + let resData = res.data.list || [] + resData.forEach(v => { + v.pagePoint = { + classification: 'hot', + key_number: v.id + }; + v.display_tags_arr = v.display_tags ? v.display_tags.split(",") : [] + }) + this.setData({ + list: resData + }) + }) + }, + // 回购 + getRepurchaseList: function() { + commonApi._post("repurchase/repurchase/getRepurchaseList", {}).then(res => { + (res.data || []).forEach(v => { + v.headimg = this.showImg(v.headimg) + v.pagePoint = { + classification: 'repurchase', + key_number: v.product_id + } + }) + this.setData({ + repurchaseList: res.data || [] + }) + }) + }, onReachBottom: function() { // if (this.data.list.length < 30) { // this.getList() - // } - // if (this.data.canGetrepurchase) { - // this.data.canGetrepurchase = false - // this.getRepurchaseList() - // } + // } + // if (this.data.canGetrepurchase) { + // this.data.canGetrepurchase = false + // this.getRepurchaseList() + // } }, gotoDetail: function(e) { - let item = e.currentTarget.dataset.item; - let source = e.currentTarget.dataset.source; - if (source) { util.setGlobalPagePoint(source); } - - commonApi._post("repurchase/repurchase/recordClick", {product_id:item.product_id}) - // item.id = item.type=='post'?item.product_id:item.scene_id - if (item.pagePoint) { this.newPagePoint(item.pagePoint) } - // util.gotoDetail(item); - util.gotoDetail(item.goods); + let item = e.currentTarget.dataset.item; + let source = e.currentTarget.dataset.source; + let index = e.currentTarget.dataset.index; + console.log(index) + if (index == 1) { + wx.navigateTo({ + url: '/subPackages/foodNew/index?id=' + item.id + }) + return; + } + if (source) { + util.setGlobalPagePoint(source); + } + + commonApi._post("repurchase/repurchase/recordClick", { + product_id: item.product_id + }) + // item.id = item.type=='post'?item.product_id:item.scene_id + if (item.pagePoint) { + this.newPagePoint(item.pagePoint) + } + // util.gotoDetail(item); + util.gotoDetail(item); }, pagePoint: function(e, type) { util.pagePoint(e, type) - }, + }, - // --------------------------广告---------------------------- + // --------------------------广告---------------------------- //关闭弹窗广告 closeAdv: function() { this.setData({ @@ -1014,10 +1358,14 @@ Page({ }, //关闭全屏广告 closeFullAdv: function() { - this.setData({showFullAdv: false}) - clearInterval(this.data.fullAdvTimer) + this.setData({ + showFullAdv: false + }) + clearInterval(this.data.fullAdvTimer) if (!this.data.alertSwipeList.length > 0) { - wx.showTabBar({animation: true}) + wx.showTabBar({ + animation: true + }) } }, // 是否静音 @@ -1041,42 +1389,51 @@ Page({ this.setData({ videoPlay: true }) - }, - - changeSimpleVal (e) { - let keyname = e.currentTarget.dataset.keyname; - let val = e.currentTarget.dataset.val; - let param = {} - param[keyname] = val - if (keyname == "cityIndex") { - let scrollIndex = val-2 - if (scrollIndex<0) { scrollIndex = 0 } - param.scrollItem = "scrollItem-"+scrollIndex - } - - this.setData(param) - console.log(this.data) - }, + }, + + changeSimpleVal(e) { + let keyname = e.currentTarget.dataset.keyname; + let val = e.currentTarget.dataset.val; + let param = {} + param[keyname] = val + if (keyname == "cityIndex") { + let scrollIndex = val - 2 + if (scrollIndex < 0) { + scrollIndex = 0 + } + param.scrollItem = "scrollItem-" + scrollIndex + } + + this.setData(param) + console.log(this.data) + }, onShow: function() { - this.pagePoint({event: 'home_view'}, 1) - // 修复 首页广告点击后返回首页 tabbar不显示 - if (this.data.showTime && !this.data.showFullAdv) { - wx.showTabBar() - } - util.clearGlobalPagePoint() - - if (app.globalData.innerAudioContext) { - app.globalData.innerAudioContext.stop() - } - app.globalData.isCartBuy = false - }, - - goAIUrl () { - wx.switchTab({ - url: '/pages/pbService/aiHelpYou/index', - }) - }, + this.pagePoint({ + event: 'home_view' + }, 1) + // 修复 首页广告点击后返回首页 tabbar不显示 + if (this.data.showTime && !this.data.showFullAdv) { + wx.showTabBar() + } + util.clearGlobalPagePoint() + + if (app.globalData.innerAudioContext) { + app.globalData.innerAudioContext.stop() + } + app.globalData.isCartBuy = false + }, + + goAIUrl() { + wx.switchTab({ + url: '/pages/pbService/aiHelpYou/index', + }) + }, + goYjgl() { + wx.navigateTo({ + url: '/pages/list/strategy/index' + }) + }, /** * 用户点击右上角分享 @@ -1090,12 +1447,12 @@ Page({ query: '', imageUrl: 'https://static.ticket.sz-trip.com/xcxImages/zwt/logo.png' } - }, - + }, + - // --------------------以前的东西 暂时用不到仅做保留------------------------ - // 一城百馆 以前的活动 + // --------------------以前的东西 暂时用不到仅做保留------------------------ + // 一城百馆 以前的活动 city: function() { wx.navigateToMiniProgram({ appId: 'wx114d514f39cb1fed', @@ -1108,14 +1465,14 @@ Page({ }).then(res => { }) - }, - meituan: function() { + }, + meituan: function() { wx.navigateToMiniProgram({ appId: 'wxde8ac0a21135c07d', path: "hotel/pages/h5/index?q=https%3A%2F%2Ffenxiao.meituan.com%2Fopdtor%2Fh5%2Fhotel%2Fsearch%3FpartnerId%3D16829" }) - }, - // 活动日历 + }, + // 活动日历 getFourProduct: function() { let item = this.data.indexHot[this.data.hotIndex], service = "product/get_product_by_tag", @@ -1140,37 +1497,38 @@ Page({ fourProduct: res.data.list || res.data }) }) - }, - changeHotIndex: function(e) { + }, + changeHotIndex: function(e) { this.setData({ hotIndex: e.currentTarget.dataset.index, fourProduct: [] }) this.getFourProduct() - }, - getWeather: function() { + }, + getWeather: function() { commonApi._post('pbservice/Ztfw/getWeather').then(res => { this.setData({ weather: res.data }) }) - }, - // Ai避高峰 + }, + // Ai避高峰 gotoUrls() { // 判断是否登录 - var token = wx.getStorageSync("jstrip_token"), userId = wx.getStorageSync("jstrip_userid"); - if(!token || !userId) { + var token = wx.getStorageSync("jstrip_token"), + userId = wx.getStorageSync("jstrip_userid"); + if (!token || !userId) { let url = 'https://wlsjzx.zdhxwl.cn/kt_h5/index.html' - + app.globalData.weburl = url; wx.navigateTo({ url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url), }) - }else { + } else { commonApi.user_post("uservice/user/userEncry").then(res => { - if(res.code == 1) { + if (res.code == 1) { let url = 'https://wlsjzx.zdhxwl.cn/kt_h5/index.html?userEncry=' + res.data - + app.globalData.weburl = url; wx.navigateTo({ url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(url), diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 880e628..6d938eb 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,5 +1,6 @@ + @@ -62,31 +63,48 @@ --> - - - - {{aiStr}} - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + @@ -183,22 +201,6 @@ - - - - - - - - - - - - - @@ -211,6 +213,7 @@ + {{item.menu_name}} @@ -276,7 +279,7 @@ --> - + @@ -298,7 +301,7 @@ - + + --> + + + + + {{ item.name }} + + + + + + + + + + + + + + + + + {{pItem.title}} + + + + + + {{tagItem}} + + + + + + ¥{{pItem.price / 100}} + 立即购买 + + + + 查看更多 >> + + + - - - - - @@ -415,7 +487,7 @@ - + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index f51492c..b59d82b 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -5,13 +5,17 @@ min-height: 100vh; overflow-x: hidden; overflow-y: auto; - background-size: 100% auto; + background-size: 100% 100%; background-repeat: no-repeat; - padding-bottom: 200rpx; - background-color:#F8E0C6; - background-image: url("https://static.ticket.sz-trip.com/jundaosuzhou/images/indexWinter2025/topGifs.gif"); - - + padding-bottom: 100rpx; + background-color: rgba(80, 84, 136, 1); + background-image: url("https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/bg.jpg"); +} +.top-img { + position: absolute; + top: 0; + left: 0; + width: 100vw; } .swiper{ display: block; @@ -71,7 +75,7 @@ width: 100%; display: flex; justify-content: space-between; - padding: 26rpx 20rpx 30rpx; + padding: 26rpx 28rpx 30rpx; box-sizing: border-box; /* background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(0, 0, 0, 0.2)) */ } @@ -103,7 +107,7 @@ border-radius: 20rpx; /* background: #FFEEAD; */ padding-top: 13rpx; - background-image: url("https://static.ticket.sz-trip.com/uploads/20251127/971ccf61fe5446130501fb26ac7e8ffc.png"); + /* background-image: url("https://static.ticket.sz-trip.com/uploads/20251127/971ccf61fe5446130501fb26ac7e8ffc.png"); */ background-size: 100% 100%; } .top-icon-item { @@ -154,27 +158,36 @@ .common-header-img{ width: 100%; position: relative; + margin-top: 25rpx; } .small-swiper { - height: 154rpx; + height: 366.73rpx; } .small-swiper image { display: block; width: 100%; - height: 154rpx; + height: 366.73rpx; } .small-swiper-box { - margin: 50rpx 0; - width: 100%; - height: 154rpx; + width: 306.73rpx; + height: 366.73rpx; border-radius: 20rpx; /* border-radius: 77rpx; */ overflow: hidden; - margin-top: 33rpx; + /* margin-top: 33rpx; */ position: relative; } +.small-bg { + position: absolute; + top: 0; + left: 0; + width: 306.73rpx; + height: 366.73rpx; + z-index: 2000; +} + .sale-road-boxes { display: flex; justify-content: space-between; @@ -812,11 +825,15 @@ .ggfw-list .ggfw { width: 157.33rpx; height: 130.67rpx; - /* margin-bottom: 23rpx; */ + margin-bottom: 21rpx; + font-weight: 500; + font-size: 23rpx; + color: #FFF2E0; + text-align: center; } .ggfw image{ - width: 100%; - height: 100%; + width: 113.33rpx; + height: 113.33rpx; } .six-box-new { @@ -835,7 +852,6 @@ } .six-box-new .big-image-box image{ - width: 100%; height: 100%; border-radius: 20rpx 20rpx 0 0; } @@ -1059,8 +1075,8 @@ } .ai-box{ - margin: 15rpx 0 40rpx; - width: 100%; + /* margin: 15rpx 0 40rpx; */ + width: 373.33rpx; position: relative; } .ai-text{ @@ -1136,4 +1152,264 @@ height: 167rpx; width: 100%; + } + + .small-box { + /* width: 100%; */ + height: 366.73rpx; + display: flex; + justify-content: space-between; + margin: 30rpx; + } + + .small-bottom { + display: flex; + flex-direction: column; + justify-content: space-between; + } + + /* Tab */ + .custom-tabs { + white-space: nowrap; + width: 100%; + height: 100rpx; + margin-top: 32rpx; + } + + .tab-btn { + display: inline-block; + width: 200rpx; + height: 53rpx; + line-height: 53rpx; + text-align: center; + font-weight: 500; + font-size: 28rpx; + margin-right: 10rpx; + background-size: 100% 100%; + background-repeat: no-repeat; + transition: all 0.3s; + color: #111; + background-image: url('https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/hotBg.png'); + background-size: 100% 100%; + } + + .tab-btn.active { + font-weight: bold; + color: #E33929; + } + + /* Stack Swiper */ + .stack-swiper { + position: relative; + width: 700rpx; + height: 850rpx; + margin: 0 auto; + /* padding-right: 50rpx; */ + box-sizing: border-box; + margin-left: -10rpx; + } + + .stack-item { + position: absolute; + width: 630rpx; + height: 100%; + border-radius: 20rpx; + top: 0; + left: 10rpx; + + /* 动画过渡 */ + transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out, background-color 0.4s; + + box-shadow: -4rpx 4rpx 16rpx rgba(0, 0, 0, 0.1); + overflow: hidden; + } + + .card-inner-border { + width: 100%; + height: 100%; + border-radius: 20rpx; + padding: 20rpx; + box-sizing: border-box; + display: flex; + flex-direction: column; + justify-content: space-between; + + background-color: transparent; + transition: opacity 0.3s; + } + + /* Content Demo */ + .product-content-demo { + flex: 1; + display: flex; + flex-direction: column; + } + + .demo-img { + width: 100%; + height: 350rpx; + background-color: #ddd; + border-radius: 16rpx; + margin-bottom: 20rpx; + display: flex; + align-items: center; + justify-content: center; + color: #666; + font-size: 32rpx; + } + + .demo-info { + flex: 1; + } + + .demo-title { + font-size: 32rpx; + font-weight: bold; + color: #333; + margin-bottom: 10rpx; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + } + + .demo-tags text { + display: inline-block; + border: 1px solid #ff6b6b; + color: #ff6b6b; + font-size: 20rpx; + padding: 2rpx 10rpx; + border-radius: 8rpx; + margin-right: 10rpx; + } + + .demo-price-row { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 30rpx; + } + + .price { + color: #d43d3d; + font-size: 40rpx; + font-weight: bold; + } + + .buy-btn { + background: linear-gradient(90deg, #ff6b6b, #e03e3e); + color: #fff; + padding: 10rpx 30rpx; + border-radius: 30rpx; + font-size: 26rpx; + } + + .see-more-link { + text-align: center; + width: 220rpx; /* 3.03rem */ + height: 50rpx; /* 0.7rem */ + background: #FFF9F2; + border-radius: 25rpx; /* 0.35rem */ + font-weight: bold; + font-size: 26rpx; /* 0.42rem */ + color: #CE3B2B; + line-height: 50rpx; + margin: 0 0 20rpx auto; + display: block; + } + + .yjgl { + width: 373.33rpx; + height: 133.33rpx; + } + + .product-item { + width: 100%; /* 自动填满容器 */ + height: 220rpx; /* 3rem ≈ 210-220rpx */ + background: #FFF9F2; + border-radius: 14rpx; /* 0.2rem */ + display: flex; + margin-bottom: 20rpx; + box-sizing: border-box; + padding: 10rpx; /* 稍微加点内边距 */ + } + + .product-img { + width: 200rpx; /* 3rem */ + height: 200rpx; /* 3rem */ + background: #F9EFD7; + border-radius: 14rpx; /* 0.2rem */ + border: 1rpx solid #FAD29B; + margin-right: 14rpx; /* 0.19rem */ + flex-shrink: 0; /* 防止图片被压缩 */ + } + + .product-content { + height: 200rpx; /* 3rem */ + flex: 1; + display: flex; + flex-direction: column; + justify-content: space-between; + padding-right: 10rpx; + overflow: hidden; /* 防止内容溢出 */ + } + + .title { + font-weight: bold; + font-size: 30rpx; /* 0.42rem */ + color: #000000; + line-height: 1.3; + } + + /* 多行省略通用样式 */ + .text-overflowRows { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; /* 限制2行 */ + overflow: hidden; + text-overflow: ellipsis; + } + + .tags { + display: flex; + margin: 8rpx 0; + } + + .tag-item { + line-height: 36rpx; /* 0.5rem */ + border-radius: 8rpx; /* 0.1rem */ + border: 1rpx solid #CE3B2B; + padding: 0 10rpx; + margin-right: 10rpx; + font-weight: 500; + font-size: 24rpx; /* 0.34rem */ + color: #CE3B2B; + white-space: nowrap; + } + + .flex-between { + display: flex; + justify-content: space-between; + align-items: flex-end; /* 底部对齐 */ + } + + .price { + font-weight: bold; + font-size: 32rpx; /* 0.42rem 稍微调大增加强调 */ + color: #DD2723; + } + + .btn-img { + width: 150rpx; /* 2.1rem */ + height: 50rpx; /* 0.71rem */ + line-height: 50rpx; + text-align: center; + font-weight: bold; + font-size: 24rpx; /* 0.34rem */ + color: #F9EFD7; + /* 请确保背景图链接有效 */ + background-image: url('https://static.ticket.sz-trip.com/jundaosuzhou/images/index2026/btnBg.png'); + background-size: 100% 100%; + border-radius: 25rpx; /* 按钮圆角 */ } \ No newline at end of file diff --git a/pages/info/sceneProductInfo/index.js b/pages/info/sceneProductInfo/index.js index 0e26700..e178c2e 100644 --- a/pages/info/sceneProductInfo/index.js +++ b/pages/info/sceneProductInfo/index.js @@ -64,6 +64,8 @@ Page({ skuDays: 30, advList: [], + + zzShow: true }, /** @@ -77,9 +79,10 @@ Page({ } if(options.id) { let tempUrl = util.detailDomain+`/ScenicDetail?id=${options.id}` - wx.navigateTo({ + wx.redirectTo({ url: '/pages/pbService/web/index?weburl=' + encodeURIComponent(tempUrl), }) + return } if (options.retailId) { this.setData({ @@ -272,7 +275,9 @@ Page({ }, - + onReady() { + this.setData({zzShow: false}) + }, // 获取广告 getAdv() { commonApi._post("adv/getAdv", { diff --git a/pages/info/sceneProductInfo/index.wxml b/pages/info/sceneProductInfo/index.wxml index 4a52486..9467c35 100644 --- a/pages/info/sceneProductInfo/index.wxml +++ b/pages/info/sceneProductInfo/index.wxml @@ -371,4 +371,6 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/info/sceneProductInfo/index.wxss b/pages/info/sceneProductInfo/index.wxss index 44aad27..4f4fb6c 100644 --- a/pages/info/sceneProductInfo/index.wxss +++ b/pages/info/sceneProductInfo/index.wxss @@ -1082,4 +1082,12 @@ line-height: 93rpx; } .adv-swiper{ height: 166.67rpx; +} + +.zhezhao { + width: 100vw; + height: 100vh; + position: fixed; + background-color: #fff; + z-index: 2000; } \ No newline at end of file diff --git a/pages/pbService/web/index.js b/pages/pbService/web/index.js index 64848c4..5eb5336 100644 --- a/pages/pbService/web/index.js +++ b/pages/pbService/web/index.js @@ -3,273 +3,216 @@ let app = getApp() import commonApi from "../../../utils/https/common" import userApi from "../../../utils/https/user" import https from "../../../utils/https.js" -Page({ - /** - * 页面的初始数据 - */ +Page({ data: { - webUrl:"", - shareTitle: "", + webUrl: "", + shareTitle: "", shareUrl: "", - canSetData: true + + cachedOptions: null, + isWaitingLogin: false, }, - /** - * 生命周期函数--监听页面加载 - */ onLoad: function (options) { - let weburl = decodeURIComponent(options.weburl) - // weburl = 'https://test.m.cloud.sz-trip.com/petYou2024' - console.log('weburl',weburl) - // 获取路径参数 - let webParam = {} - let baseUrl = "" - try { - baseUrl = weburl.split('?')[0] - let paramStr = weburl.split('?')[1] - if (paramStr) { - paramStr.split('&').forEach((param) => { - let parts = param.split('='); - webParam[(parts[0])] = (parts[1]); - }); - } - - } catch(e) { - console.log(e) - } - console.log(webParam) - - let lowerUrl = weburl.toLowerCase() - // 宠你有礼 市民卡授权 - if (lowerUrl.indexOf('petyou2024') && webParam.cnylCode) { - commonApi._get("uservice/user/loginByCnyl", { - cnylCode: webParam.cnylCode - }).then(res => { + // onLoad 只负责存参数,不执行任何跳转逻辑,防止和页面初始化冲突 + console.log('onLoad options:', options); + this.data.cachedOptions = options; + }, - if(res.data && res.data.id && res.data.token) { - wx.setStorageSync("jstrip_userid", res.data.id) - wx.setStorageSync("jstrip_token", res.data.token) - wx.setStorageSync("jstrip_userInfo", res.data) + onShow: function () { + // 将所有逻辑移到 onShow,确保页面加载完毕后再执行跳转 + this.checkLoginAndLoad(); + }, - weburl += '&token='+res.data.token - } - }).finally(()=>{ - // this.setData({ - // webUrl:weburl - // }) - this.setUrl(weburl) - }) + checkLoginAndLoad: function() { + // 1. 防白屏容错:检查参数 + let options = this.data.cachedOptions; + if (!options || !options.weburl) { + setTimeout(() => { wx.navigateBack(); }, 100); + return; } - // 遇见昆山 - else if (lowerUrl.indexOf('couponAndKs') && webParam.ksCode) { - commonApi._get("uservice/user/loginBykunshan", { - code: webParam.ksCode - }).then(res => { - if(res.data && res.data.id && res.data.token) { - wx.setStorageSync("jstrip_userid", res.data.id) - wx.setStorageSync("jstrip_token", res.data.token) - wx.setStorageSync("jstrip_userInfo", res.data) - weburl += '&token='+res.data.token - } - }).finally(()=>{ - // this.setData({ - // webUrl:weburl - // }) - this.setUrl(weburl) - }) - } - // 君到苏州 加token - else if(lowerUrl.indexOf('m.cloud.sz-trip.com')!=-1) { - delete webParam.token - delete webParam.lon - delete webParam.lat - weburl = baseUrl - if(Object.keys(webParam).length>0) { - const newParamsArray = []; - for (let key in webParam) { - newParamsArray.push(`${key}=${(webParam[key])}`); - } - weburl = `${baseUrl}?${newParamsArray.join('&')}`; - } + let token = wx.getStorageSync('jstrip_token'); - let token = wx.getStorageSync('jstrip_token') - if (token) { - if (Object.keys(webParam).length>0) { - weburl += '&token='+token - } else { - weburl += '?token='+token - } + // 2. 有 Token:正常加载 + if (token) { + // 如果是刚登录回来,或者页面还没加载过 URL + if (this.data.isWaitingLogin || !this.data.webUrl) { + console.log('已登录,开始加载页面'); + this.data.isWaitingLogin = false; + this.handleUrlProcess(); } - let _this = this - try { - let lonAndLat = (wx.getStorageSync('lonAndLat')) - if (lonAndLat && JSON.parse(lonAndLat)) { - lonAndLat = JSON.parse(lonAndLat) - if (Object.keys(webParam).length>0 || token) { - weburl+=`&lon=${lonAndLat.lon}&lat=${lonAndLat.lat}` - } else { - weburl+=`?lon=${lonAndLat.lon}&lat=${lonAndLat.lat}` - } - this.setUrl(weburl) - return - } else { - wx.getLocation({ - type: 'gcj02', - success: (res) => { - let lonAndLat = JSON.stringify({lat: res.latitude,lon: res.longitude}) - wx.setStorageSync('lonAndLat', lonAndLat) - if (Object.keys(webParam).length>0 || token) { - weburl+=`&lon=${lonAndLat.lon}&lat=${lonAndLat.lat}` - } else { - weburl+=`?lon=${lonAndLat.lon}&lat=${lonAndLat.lat}` - } - _this.setUrl(weburl) - }, - fail: (err) => { - _this.setUrl(weburl) - } - }) - } - } catch(e) { - this.setUrl(weburl) - } - // this.setUrl(weburl) - } else { - // this.setData({ - // webUrl:weburl - // }) - this.setUrl(weburl) + return; } - // if(weburl.indexOf('m.cloud.sz-trip.com')!=-1){ - // userApi.user_post("user/getMyInfo").then(res=>{ - // let weburl = weburl - // if(weburl.indexOf('?')!=-1){ - // weburl += '&token='+res.data.token; - // } - // else { - // weburl += '?token='+res.data.token - // } - // this.setData({ - // info:res.data, - // webUrl:weburl - // }) - // }) - // } - // else if(weburl.indexOf('m.jszhwlpt.com')!=-1 || weburl.indexOf('wechat.b2c.zj-trip.net')!=-1){ - // // 如果是去苏心游或者镇江的话 - // userApi.user_post("user/getJumpThirdAppCode",{}).then(res=>{ - // let weburl = weburl - // if(weburl.indexOf('?')!=-1){ - // weburl += '&original_sys_name=jdsz&auth_code='+res.data; - // } - // else { - // weburl += '?original_sys_name=jdsz&auth_code='+res.data - // } - // this.setData({ - // info:res.data, - // webUrl:weburl - // }) - // }) - // } - // else { - - // } - }, - handleMessage(data) { - // this.setData({ - // shareTitle:data.shareTitle, - // shareUrl:data.shareUrl - // }) - console.log('打印22222',data); - }, + // 3. 无 Token:处理跳转 + // 3.1 如果 isWaitingLogin 为 true,说明是刚从登录页返回(用户取消了登录) + if (this.data.isWaitingLogin) { + console.log('用户取消登录,返回上一页'); + wx.navigateBack(); + return; + } - loginByCode () { - // 市民卡 - if(options && options.cnylCode) { - commonApi._post("uservice/user/loginByCnyl", { - cnylCode: options.cnylCode - }).then(res => { - if(res.data && res.data.id && res.data.token) { - https.set_logininfo(res); + // 3.2 第一次检测到未登录,跳转登录页 + console.log('未登录,延时跳转登录页'); + this.data.isWaitingLogin = true; + + // ★关键修复★:使用 setTimeout 延迟跳转,解决 "navigateTo with an already exist webviewId" 报错 + setTimeout(() => { + wx.navigateTo({ + url: '/pages/login/index', + fail: (err) => { + console.error('跳转失败:', err); + this.data.isWaitingLogin = false; // 重置标记以便重试 } - }) - } + }); + }, 300); // 延迟 300ms 足够让页面初始化完成 }, - setUrl (url) { - console.log(url) - let that = this - if (this.data.canSetData) { - this.data.canSetData = false - this.setData({ - webUrl:url - }) - setTimeout(() => { - that.data.canSetData = true - }, 1000); + handleUrlProcess: function () { + let options = this.data.cachedOptions; + // 双重检查 + if (!options || !options.weburl) return; + + let weburl = decodeURIComponent(options.weburl) + + let webParam = {} + let baseUrl = "" + try { + baseUrl = weburl.split('?')[0] + let paramStr = weburl.split('?')[1] + if (paramStr) { + paramStr.split('&').forEach((param) => { + let parts = param.split('='); + webParam[(parts[0])] = (parts[1]); + }); } + } catch (e) { console.log(e) } - }, + let lowerUrl = weburl.toLowerCase() + + // 此时 Token 肯定存在 + let token = wx.getStorageSync('jstrip_token'); + + // 1. 宠你有礼 + if (lowerUrl.indexOf('petyou2024') != -1 && webParam.cnylCode) { + commonApi._get("uservice/user/loginByCnyl", { cnylCode: webParam.cnylCode }) + .then(res => { + if (res.data && res.data.id && res.data.token) { + this.saveLoginInfo(res.data); + weburl += '&token=' + res.data.token + } + }).finally(() => { this.setUrl(weburl) }) + } + // 2. 遇见昆山 + else if (lowerUrl.indexOf('couponAndKs') != -1 && webParam.ksCode) { + commonApi._get("uservice/user/loginBykunshan", { code: webParam.ksCode }) + .then(res => { + if (res.data && res.data.id && res.data.token) { + this.saveLoginInfo(res.data); + weburl += '&token=' + res.data.token + } + }).finally(() => { this.setUrl(weburl) }) + } + // 3. 君到苏州 + else if (lowerUrl.indexOf('m.cloud.sz-trip.com') != -1) { + + delete webParam.token + delete webParam.lon + delete webParam.lat + weburl = baseUrl + + if (Object.keys(webParam).length > 0) { + const newParamsArray = []; + for (let key in webParam) { + newParamsArray.push(`${key}=${(webParam[key])}`); + } + weburl = `${baseUrl}?${newParamsArray.join('&')}`; + } - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { + if (Object.keys(webParam).length > 0) { + weburl += '&token=' + token + } else { + weburl += '?token=' + token + } + this.handleLocationAndSetUrl(weburl, webParam, token); + } + // 4. 其他 + else { + this.setUrl(weburl) + } }, - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { + handleLocationAndSetUrl(weburl, webParam, token) { + let that = this; + try { + let lonAndLat = wx.getStorageSync('lonAndLat') + let locObj = null; + if (lonAndLat) { + try { locObj = JSON.parse(lonAndLat); } catch(e) {} + } + if (locObj && locObj.lon && locObj.lat) { + weburl = that.appendLocation(weburl, locObj.lon, locObj.lat, webParam, token); + that.setUrl(weburl); + return; + } + + wx.getLocation({ + type: 'gcj02', + success: (res) => { + let newLoc = { lat: res.latitude, lon: res.longitude }; + wx.setStorageSync('lonAndLat', JSON.stringify(newLoc)); + weburl = that.appendLocation(weburl, newLoc.lon, newLoc.lat, webParam, token); + that.setUrl(weburl); + }, + fail: (err) => { + console.log('定位失败'); + that.setUrl(weburl); + } + }) + } catch (e) { + console.error(e); + that.setUrl(weburl); + } }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - + appendLocation(url, lon, lat, webParam, token) { + if (Object.keys(webParam).length > 0 || token) { + return url + `&lon=${lon}&lat=${lat}`; + } else { + return url + `?lon=${lon}&lat=${lat}`; + } }, - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + saveLoginInfo(data) { + wx.setStorageSync("jstrip_userid", data.id) + wx.setStorageSync("jstrip_token", data.token) + wx.setStorageSync("jstrip_userInfo", data) }, - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - + setUrl(url) { + console.log('设置webUrl:', url) + if (!url) return; + this.setData({ webUrl: url }) }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { + handleMessage(data) {}, + loginByCode() {}, - }, - - /** - * 用户点击右上角分享 - */ onShareAppMessage: function () { - return { - title: this.data.shareTitle, - path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`, - } + return { + title: this.data.shareTitle, + path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`, + } }, - - onShareTimeline: function() { + + onShareTimeline: function () { return { title: this.data.shareTitle, path: `/pages/pbService/web/index?weburl=${encodeURIComponent(this.data.webUrl)}`, } } -}) \ No newline at end of file +}) diff --git a/pages/user/order/list.wxml b/pages/user/order/list.wxml index 63433d9..eb46ae1 100644 --- a/pages/user/order/list.wxml +++ b/pages/user/order/list.wxml @@ -8,6 +8,7 @@ 全部 + 待付款 待确认 待发货 @@ -21,7 +22,7 @@ 订单号:{{item.order_id}} - {{item.orderStateText?item.orderStateText:orderState[item.state]}} + {{item.state_text}} diff --git a/pages/user/order/sceneOrderInfo/index.js b/pages/user/order/sceneOrderInfo/index.js index 248e463..c6ae7ca 100644 --- a/pages/user/order/sceneOrderInfo/index.js +++ b/pages/user/order/sceneOrderInfo/index.js @@ -3,418 +3,470 @@ import commonApi from "../../../../utils/https/common" import userApi from "../../../../utils/https/user" import QRCode from '../../../../utils/weapp-qrcode.js' import util from '../../../../utils/util' -let app = getApp(),timer +let app = getApp(), + timer Page({ - /** - * 页面的初始数据 - */ - data: { - id:null, - info:null, - orderState:app.globalData.orderState, - productState:app.globalData.productState, - product_model:null, - isRefund:false, - feeInfoFlag:false, - codeIndex:0, - codeImgs:[], - minute:0, - second:0, - cardTypes:{}, - cxr1:false, - cxr1Text:'更多', - sysm:false, - sysmText:'更多', - sysm2:false, - sysm2Text:'更多', - imgLen:[], - ids:[], + /** + * 页面的初始数据 + */ + data: { + id: null, + info: null, + orderState: app.globalData.orderState, + productState: app.globalData.productState, + product_model: null, + isRefund: false, + feeInfoFlag: false, + codeIndex: 0, + codeImgs: [], + minute: 0, + second: 0, + cardTypes: {}, + cxr1: false, + cxr1Text: '更多', + sysm: false, + sysmText: '更多', + sysm2: false, + sysm2Text: '更多', + imgLen: [], + ids: [], - isPost: false, // 有没有邮寄产品 - }, + isPost: false, // 有没有邮寄产品 - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - this.setData({ - id:options.id - }) - userApi.user_post("user/getCardTypeList").then(res=>{ - let cardTypes = {}; - res.data.map(item=>{ - cardTypes[item.type]=item.title; - }) - this.setData({ - cardTypes:cardTypes - }) - }) - }, - copy:function(e){ - let code = e.currentTarget.dataset.num; - wx.setClipboardData({ - data: code, - success: function (res) { - wx.showToast({ - title: '复制成功', - icon:'success' - }) - } - }) - }, - getCodeImg:function(){ - let that = this,sys =wx.getSystemInfoSync(),radio = sys.screenWidth / 750,qrcode=this.data.info.order_product_list[0].qrcode,codeImgs=[],codeId=0,arr = []; - this.data.info.order_product_list.forEach(qrcode=>{ - qrcode.qrcode.map((item,index)=>{ - console.log(qrcode.is_force_display_code); - item.is_force_display_code = qrcode.is_force_display_code - console.log(item.is_force_display_code); - arr.push(index) - this.setData({ - imgLen:arr - }) - if(item.use_url&&item.use_code){ - codeImgs.push({img:item.use_url,code:item.use_code,text:item.use_code_display_text,state:item.stateText,is_force_display_code:item.is_force_display_code,flag:item.state}); - // if(codeImgs.length==qrcode.qrcode.length){ - // that.setData({ - // codeImgs:codeImgs - // }) - // } - that.setData({ - codeImgs:codeImgs - }) - } - else { - console.log(item); - new QRCode('damocode'+codeId,{ - text: item.use_code, - width: 300 * radio, - height: 300 * radio, - padding:10, // 生成二维码四周自动留边宽度,不传入默认为0 - correctLevel: QRCode.CorrectLevel.H, // 二维码可辨识度 - callback: (res) => { - console.log(res); - codeImgs.push({img:res.path,code:item.use_code,text:item.use_code_display_text,state:item.stateText,is_force_display_code:item.is_force_display_code,flag:item.state}); - that.setData({ - codeImgs:codeImgs - }) - } - }) - console.log(this.data.codeImgs); - codeId = codeId + 1 - } - }) - }) - console.log(this.data.imgLen); - console.log(this.data.codeImgs); - }, - prevCodeImg:function(){ - let qrcode=this.data.codeImgs,codeIndex = this.data.codeIndex; - console.log(codeIndex) - if(codeIndex==0){ - this.setData({ - codeIndex:qrcode.length-1 - }) - } - else { - this.setData({ - codeIndex:codeIndex-1 - }) - } - console.log(codeIndex) - }, - nextCodeImg:function(){ - console.log(this.data.codeImgs); - let qrcode=this.data.codeImgs,codeIndex = this.data.codeIndex; - codeIndex = codeIndex + 1; - if(codeIndex==qrcode.length){ - codeIndex = 0; - } - this.setData({ - codeIndex:codeIndex + showProgressPopup: false, + reversedProgressList: [] // 数据源 + }, - }) - }, - showFeeInfo:function(){ - this.setData({ - feeInfoFlag:!this.data.feeInfoFlag - }) - }, - close:function(){ - let _this = this,info = _this.data.info; - wx.showModal({ - title:'提示', - content:"确定取消吗", - success:function(res){ - if(res.confirm){ - commonApi.user_post("order/close",{ - order_id:info.order_id - }).then(res=>{ - if(res.code==1){ - wx.showToast({ - title: '取消成功', - icon:'success' - }) - info.state = "CLOSED"; - info.order_product_list.map(item=>{ - item.state='CLOSED' - }) - _this.setData({ - info:info - }) - } - }) - } - } - }) - }, - refund:function(){ - let _this = this,info = _this.data.info; - wx.showModal({ - title:'提示', - content:"确定取消吗", - success:function(res){ - if(res.confirm){ - commonApi.user_post("order/refund",{ - order_id:info.order_id - }).then(res=>{ - if(res.code==1){ - wx.showToast({ - title: '取消成功', - icon:'success' - }) - info.state = "WAIT_REFUND"; - info.order_product_list.map(item=>{ - item.state='WAIT_REFUND' - }) - _this.setData({ - info:info - }) - } - }) - } - } - }) - }, - daojishi:function(time){ - let now = new Date().getTime(); - if(now>time){ - clearTimeout(timer); - timer = null; - util.back(); - return; - } - let times = time - now,minute = Math.floor(times / (60 * 1000)),second = Math.round((times - minute * 60 * 1000) / 1000); - this.setData({ - minute:util.formatNumber(minute), - second:util.formatNumber(second) - }) - timer = setTimeout(()=>{ - this.daojishi(time); - },1000) - }, - // 查看苏康码 - gotoSku:function(){ - commonApi.user_post("pbservice/Ztfw/sukangCode").then(res=>{ - console.log(res) - app.globalData.weburl = res.data.url; - wx.navigateTo({ - url: '/pages/pbService/web/index' - }) - return; - }) - }, - goDetail(e){ - console.log(e.currentTarget.dataset); - let item = e.currentTarget.dataset.set - // 组合产品 跳线路 - if (item.compose_product_id) { - wx.navigateTo({ - url: '/pages/info/roadInfo/index?id='+item.compose_product_id - }) - return - } - if (item.is_package == 1) { - wx.navigateTo({ - url:"/pages/info/postProductInfo/index?id="+item.product_id - }) - return - } else if (item.is_package==2) { - wx.navigateTo({ - url: '/subPackages/goods/oneCardTour/info/index?id='+item.scene_id - }); - return - } else if (item.is_package==3) { - wx.navigateTo({ - url: '/subPackages/goods/memberCard/index?id='+item.product_id - }); - return - } + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + this.setData({ + id: options.id + }) + userApi.user_post("user/getCardTypeList").then(res => { + let cardTypes = {}; + res.data.map(item => { + cardTypes[item.type] = item.title; + }) + this.setData({ + cardTypes: cardTypes + }) + }) + }, + // 防止弹窗背景滚动 + preventTouchMove() { + return; + }, - if (item.product_model=='ticket') { - wx.navigateTo({ - url:"/pages/info/sceneProductInfo/index?id="+item.scene_id - }) - }else if (item.product_model=='post') { - wx.navigateTo({ - url:"/pages/info/postProductInfo/index?id="+item.product_id - }) - } - }, - showMsg(e){ - console.log(e.currentTarget.dataset); - let msg = e.currentTarget.dataset.msg - switch (msg) { - case 'cxr1': - this.setData({ - cxr1:!this.data.cxr1, - cxr1Text:this.data.cxr1?'更多':'收起', + // 关闭弹窗 + closeProgressPopup() { + this.setData({ + showProgressPopup: false + }); + }, - }) - break; - case 'sysm1': - this.setData({ - sysm:!this.data.sysm, - sysmText:this.data.sysm?'更多':'收起', - }) - break; - case 'sysm2': - this.setData({ - sysm2:!this.data.sysm2, - sysm2Text:this.data.sysm2?'更多':'收起', - }) - break; - default: - break; - } - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { + // 打开弹窗 + openProgressPopup() { + this.setData({ + showProgressPopup: true + }); + }, + copy: function(e) { + let code = e.currentTarget.dataset.num; + wx.setClipboardData({ + data: code, + success: function(res) { + wx.showToast({ + title: '复制成功', + icon: 'success' + }) + } + }) + }, + getCodeImg: function() { + let that = this, + sys = wx.getSystemInfoSync(), + radio = sys.screenWidth / 750, + qrcode = this.data.info.order_product_list[0].qrcode, + codeImgs = [], + codeId = 0, + arr = []; + this.data.info.order_product_list.forEach(qrcode => { + qrcode.qrcode.map((item, index) => { + console.log(qrcode.is_force_display_code); + item.is_force_display_code = qrcode.is_force_display_code + console.log(item.is_force_display_code); + arr.push(index) + this.setData({ + imgLen: arr + }) + if (item.use_url && item.use_code) { + codeImgs.push({ + img: item.use_url, + code: item.use_code, + text: item.use_code_display_text, + state: item.stateText, + is_force_display_code: item.is_force_display_code, + flag: item.state + }); + // if(codeImgs.length==qrcode.qrcode.length){ + // that.setData({ + // codeImgs:codeImgs + // }) + // } + that.setData({ + codeImgs: codeImgs + }) + } else { + console.log(item); + new QRCode('damocode' + codeId, { + text: item.use_code, + width: 300 * radio, + height: 300 * radio, + padding: 10, // 生成二维码四周自动留边宽度,不传入默认为0 + correctLevel: QRCode.CorrectLevel.H, // 二维码可辨识度 + callback: (res) => { + console.log(res); + codeImgs.push({ + img: res.path, + code: item.use_code, + text: item.use_code_display_text, + state: item.stateText, + is_force_display_code: item + .is_force_display_code, + flag: item.state + }); + that.setData({ + codeImgs: codeImgs + }) + } + }) + console.log(this.data.codeImgs); + codeId = codeId + 1 + } + }) + }) + console.log(this.data.imgLen); + console.log(this.data.codeImgs); + }, + prevCodeImg: function() { + let qrcode = this.data.codeImgs, + codeIndex = this.data.codeIndex; + console.log(codeIndex) + if (codeIndex == 0) { + this.setData({ + codeIndex: qrcode.length - 1 + }) + } else { + this.setData({ + codeIndex: codeIndex - 1 + }) + } + console.log(codeIndex) + }, + nextCodeImg: function() { + console.log(this.data.codeImgs); + let qrcode = this.data.codeImgs, + codeIndex = this.data.codeIndex; + codeIndex = codeIndex + 1; + if (codeIndex == qrcode.length) { + codeIndex = 0; + } + this.setData({ + codeIndex: codeIndex - }, + }) + }, + showFeeInfo: function() { + this.setData({ + feeInfoFlag: !this.data.feeInfoFlag + }) + }, + close: function() { + let _this = this, + info = _this.data.info; + wx.showModal({ + title: '提示', + content: "确定取消吗", + success: function(res) { + if (res.confirm) { + commonApi.user_post("order/close", { + order_id: info.order_id + }).then(res => { + if (res.code == 1) { + wx.showToast({ + title: '取消成功', + icon: 'success' + }) + info.state = "CLOSED"; + info.order_product_list.map(item => { + item.state = 'CLOSED' + }) + _this.setData({ + info: info + }) + } + }) + } + } + }) + }, + refund: function() { + let _this = this, + info = _this.data.info; + wx.showModal({ + title: '提示', + content: "确定取消吗", + success: function(res) { + if (res.confirm) { + commonApi.user_post("order/refund", { + order_id: info.order_id + }).then(res => { + if (res.code == 1) { + wx.showToast({ + title: '取消成功', + icon: 'success' + }) + info.state = "WAIT_REFUND"; + info.order_product_list.map(item => { + item.state = 'WAIT_REFUND' + }) + _this.setData({ + info: info + }) + } + }) + } + } + }) + }, + daojishi: function(time) { + let now = new Date().getTime(); + if (now > time) { + clearTimeout(timer); + timer = null; + util.back(); + return; + } + let times = time - now, + minute = Math.floor(times / (60 * 1000)), + second = Math.round((times - minute * 60 * 1000) / 1000); + this.setData({ + minute: util.formatNumber(minute), + second: util.formatNumber(second) + }) + timer = setTimeout(() => { + this.daojishi(time); + }, 1000) + }, + // 查看苏康码 + gotoSku: function() { + commonApi.user_post("pbservice/Ztfw/sukangCode").then(res => { + console.log(res) + app.globalData.weburl = res.data.url; + wx.navigateTo({ + url: '/pages/pbService/web/index' + }) + return; + }) + }, + goDetail(e) { + console.log(e.currentTarget.dataset); + let item = e.currentTarget.dataset.set + // 组合产品 跳线路 + if (item.compose_product_id) { + wx.navigateTo({ + url: '/pages/info/roadInfo/index?id=' + item.compose_product_id + }) + return + } + if (item.is_package == 1) { + wx.navigateTo({ + url: "/pages/info/postProductInfo/index?id=" + item.product_id + }) + return + } else if (item.is_package == 2) { + wx.navigateTo({ + url: '/subPackages/goods/oneCardTour/info/index?id=' + item.scene_id + }); + return + } else if (item.is_package == 3) { + wx.navigateTo({ + url: '/subPackages/goods/memberCard/index?id=' + item.product_id + }); + return + } - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - commonApi.user_post("order/query",{ - order_id:this.data.id - }).then(res=>{ - if(res.data.create_time && res.data.auto_close_time && res.data.state=='UNPAID'){ - let time = (new Date(res.data.create_time.replace(/-/g,'/')).getTime() + Number(res.data.auto_close_time) * 1000); - this.daojishi(time); - } - let proId = [] - res.data.order_product_list.forEach(item => { - proId.push(item.product_id) - }) - let state = "" - res.data.order_product_list.map(order=>{ - order.qrcode.map(item=>{ - item.stateText = app.globalData.codeState[item.state]; - }) - order.contacts_info = order.contacts_info?JSON.parse(order.contacts_info):[]; - state = state + order.state; - }) - this.setData({ - isRefund:state.indexOf("REFUND")!=-1, - info:res.data, - product_model:"ticket"||res.data.order_product_list[0].product_model, - ids: proId.join(","), - isPost: res.data.order_product_list.some(x=>x.product_model == 'post'), - }) - console.log(res.data); - // debugger - console.log('ids',this.data.ids); - this.getCodeImg() - // 获取行程规划 - let that = this; - wx.getLocation({ - type: 'gcj02', - success: function (r) { - let ajaxes=[]; - res.data.order_product_list.map(item=>{ - ajaxes.push(commonApi.user_post("order/tripplan",{ - point_type:"gd", - child_order_id:item.child_order_id, - lon:r.longitude, - lat:r.latitude - })) - }) - Promise.all(ajaxes).then(r=>{ - console.log(r) - let orderInfo = that.data.info; - r.map((item,index)=>{ - if(item && item.data && item.data.url){ - orderInfo.order_product_list[index].btnUrl = item.data.url; - } - }) - that.setData({ - info:orderInfo - }) - }) - } - }) - }) - }, - // 行程规划 - leadRoad:function(e){ - let url = e.currentTarget.dataset.url; - app.globalData.weburl = url; - wx.navigateTo({ - url: '/pages/pbService/web/index' - }) - }, + if (item.product_model == 'ticket') { + wx.navigateTo({ + url: "/pages/info/sceneProductInfo/index?id=" + item.scene_id + }) + } else if (item.product_model == 'post') { + wx.navigateTo({ + url: "/pages/info/postProductInfo/index?id=" + item.product_id + }) + } + }, + showMsg(e) { + console.log(e.currentTarget.dataset); + let msg = e.currentTarget.dataset.msg + switch (msg) { + case 'cxr1': + this.setData({ + cxr1: !this.data.cxr1, + cxr1Text: this.data.cxr1 ? '更多' : '收起', - expandPost:function (e) { - let index = e.currentTarget.dataset.index - let productList = this.data.info.order_product_list - let item = productList[index] - item.showMore = !item.showMore - this.setData({ - info: this.data.info - }) - }, + }) + break; + case 'sysm1': + this.setData({ + sysm: !this.data.sysm, + sysmText: this.data.sysm ? '更多' : '收起', + }) + break; + case 'sysm2': + this.setData({ + sysm2: !this.data.sysm2, + sysm2Text: this.data.sysm2 ? '更多' : '收起', + }) + break; + default: + break; + } + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { - expandMsg: function(e) { - let index = e.currentTarget.dataset.index - let productList = this.data.info.order_product_list - let item = productList[index] - item.showMsg = !item.showMsg - this.setData({ - info: this.data.info - }) - }, + }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - clearTimeout(timer) - timer = null - }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + commonApi.user_post("order/query", { + order_id: this.data.id + }).then(res => { + if (res.data.create_time && res.data.auto_close_time && res.data.state == 'UNPAID') { + let time = (new Date(res.data.create_time.replace(/-/g, '/')).getTime() + Number(res + .data.auto_close_time) * 1000); + this.daojishi(time); + } + let proId = [] + res.data.order_product_list.forEach(item => { + proId.push(item.product_id) + }) + let state = "" + res.data.order_product_list.map(order => { + order.qrcode.map(item => { + item.stateText = app.globalData.codeState[item.state]; + }) + order.contacts_info = order.contacts_info ? JSON.parse(order + .contacts_info) : []; + state = state + order.state; + }) + let reversedList = [...res.data.reservation_log].reverse(); + this.setData({ + isRefund: state.indexOf("REFUND") != -1, + info: res.data, + product_model: "ticket" || res.data.order_product_list[0].product_model, + ids: proId.join(","), + isPost: res.data.order_product_list.some(x => x.product_model == 'post'), + reversedProgressList: reversedList + }) + console.log(res.data); + // debugger + console.log('ids', this.data.ids); + this.getCodeImg() + // 获取行程规划 + let that = this; + wx.getLocation({ + type: 'gcj02', + success: function(r) { + let ajaxes = []; + res.data.order_product_list.map(item => { + ajaxes.push(commonApi.user_post("order/tripplan", { + point_type: "gd", + child_order_id: item.child_order_id, + lon: r.longitude, + lat: r.latitude + })) + }) + Promise.all(ajaxes).then(r => { + console.log(r) + let orderInfo = that.data.info; + r.map((item, index) => { + if (item && item.data && item.data.url) { + orderInfo.order_product_list[index] + .btnUrl = item.data.url; + } + }) + that.setData({ + info: orderInfo + }) + }) + } + }) + }) + }, + // 行程规划 + leadRoad: function(e) { + let url = e.currentTarget.dataset.url; + app.globalData.weburl = url; + wx.navigateTo({ + url: '/pages/pbService/web/index' + }) + }, - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { + expandPost: function(e) { + let index = e.currentTarget.dataset.index + let productList = this.data.info.order_product_list + let item = productList[index] + item.showMore = !item.showMore + this.setData({ + info: this.data.info + }) + }, - }, + expandMsg: function(e) { + let index = e.currentTarget.dataset.index + let productList = this.data.info.order_product_list + let item = productList[index] + item.showMsg = !item.showMsg + this.setData({ + info: this.data.info + }) + }, - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + clearTimeout(timer) + timer = null + }, - }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { + }, - } + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + } }) \ No newline at end of file diff --git a/pages/user/order/sceneOrderInfo/index.wxml b/pages/user/order/sceneOrderInfo/index.wxml index b2bd512..5354b6b 100644 --- a/pages/user/order/sceneOrderInfo/index.wxml +++ b/pages/user/order/sceneOrderInfo/index.wxml @@ -4,11 +4,23 @@ - {{info.state_text}} + + {{info.state_text}} + + + 查看进度 > + + + + + 我们将于{{info.reservation_date}} 00:00为您预约抢票,最晚在{{info.reservation_date}} + 09:30前告知抢票结果,请您耐心等待 + + + + + + + + + + + + 预订进度 + + × + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ item.remark }} + {{ item.execution_time }} + + + + + + + + diff --git a/pages/user/order/sceneOrderInfo/index.wxss b/pages/user/order/sceneOrderInfo/index.wxss index dc33848..4f45a57 100644 --- a/pages/user/order/sceneOrderInfo/index.wxss +++ b/pages/user/order/sceneOrderInfo/index.wxss @@ -19,6 +19,27 @@ page { align-items: center; justify-content: space-between; } +.progress-box { + width: 148rpx; + height: 41rpx; + border-radius: 20rpx; + border: 1rpx solid #FFFFFF; + line-height: 41rpx; + text-align: center; + box-sizing: border-box; + font-weight: 500; + font-size: 24rpx; + color: #FFFFFF; +} +.state-texts { + display: flex; + align-items: center; +} +.state-texts image { + width: 40rpx; + height: 40rpx; + margin: 0 14rpx; +} .kefu-img{width: 85rpx;height: 85rpx;} .kefu-img image{width: 85rpx;height: 85rpx;} .box { @@ -382,4 +403,197 @@ page { color: #0B898E; right: 0; bottom: 0; +} + +/* --- 弹窗容器 --- */ +.custom-popup { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + z-index: 9999; +} + +.popup-mask { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.5); +} + +.popup-container { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + /* 调整:最大高度从 80% 降到 60%,更协调 */ + max-height: 60vh; + min-height: 40vh; + background: #fff; + border-radius: 24rpx 24rpx 0 0; + display: flex; + flex-direction: column; + /* animation: slideUp 0.3s ease-out; */ + padding-bottom: env(safe-area-inset-bottom); /* 适配iPhone底部黑条 */ +} + +@keyframes slideUp { + from { transform: translateY(100%); } + to { transform: translateY(0); } +} + +/* --- 头部 --- */ +.popup-header { + position: relative; + /* 调整:减小头部上下内边距 */ + padding: 30rpx 0; + text-align: center; + flex-shrink: 0; + border-bottom: 1rpx solid #f5f5f5; +} + +.popup-header .title { + /* 调整:标题字号 48 -> 36 */ + font-size: 36rpx; + font-weight: bold; + color: #333; +} + +.popup-header .close-btn { + position: absolute; + right: 20rpx; + top: 20rpx; /* 随 padding 调整 */ + font-size: 50rpx; /* 60 -> 50 */ + color: #999; + padding: 10rpx 20rpx; + line-height: 1; +} + +/* --- 内容区 --- */ +.progress-content { + flex: 1; + height: 0; +} + +.content-padding { + padding: 30rpx 40rpx 50rpx; +} + +.timeline-item { + display: flex; + min-height: 120rpx; + position: relative; +} + +/* 左侧轴 */ +.timeline-left { + width: 60rpx; + display: flex; + flex-direction: column; + align-items: center; + flex-shrink: 0; + position: relative; +} + +/* 线条 */ +.timeline-left .line { + position: absolute; + width: 2rpx; + background-color: #E5E5E5; + top: 36rpx; + height: 100%; + left: 50%; + transform: translateX(-50%); + z-index: 1; +} + +.timeline-left .line.active-line { + background-color: #0B898E; +} + +/* 图标容器通用 */ +.icon-box { + margin-top: 10rpx; + z-index: 2; + background-color: #fff; + box-sizing: border-box; +} + +/* 1. 灰色圆点 */ +.icon-box.pending { + width: 32rpx; + height: 32rpx; + background-color: #E0E0E0; /* 颜色稍微深一点点 */ + border-radius: 50%; + box-shadow: 0 0 0 6rpx #fff; +} + +/* 2. 完成态 */ +.icon-box.finished { + width: 32rpx; + height: 32rpx; + background-color: #0B898E; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 0 0 6rpx #fff; +} + +/* 纯CSS画对勾 */ +.css-checkmark { + width: 8rpx; + height: 14rpx; + border-bottom: 3rpx solid #fff; /* 4 -> 3 */ + border-right: 3rpx solid #fff; + transform: rotate(45deg); + margin-bottom: 2rpx; +} + +/* 3. 进行中 */ +.icon-box.processing { + width: 36rpx; + height: 36rpx; + background: #0B898E; + border-radius: 50%; + box-shadow: 0 0 0 6rpx #fff; + margin-top: 8rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.loading-img { + width: 60%; + height: 60%; +} + +/* 右侧文字 */ +.timeline-right { + flex: 1; + padding-left: 24rpx; + padding-top: 4rpx; + padding-bottom: 40rpx; +} + +.item-title { + font-size: 30rpx; + color: #333; + font-weight: 500; + margin-bottom: 10rpx; +} + +.item-time { + font-size: 24rpx; + color: #999; +} + +.order-text { + font-weight: 500; + font-size: 25rpx; + color: #FFFFFF; + padding: 0 32rpx; } \ No newline at end of file