| | |
| | | "componentPlaceholder": { |
| | | "u-navbar": "view", |
| | | "u-search": "view", |
| | | "u-image": "view" |
| | | "u-image": "view", |
| | | "u-icon": "view" |
| | | } |
| | | } |
| | | } |
| | |
| | | </scroll-view> |
| | | |
| | | </view> |
| | | <view class="goodsInfos" > |
| | | <view class="goodsInfos" style="position: relative;"> |
| | | <scroll-view :scroll-y="true" :show-scrollbar="false" style="height: 100%;" @scrolltolower="loadMoreData()"> |
| | | |
| | | <view class="goodsItem" v-for="item in goodsList" :key="item.id" |
| | |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | <view @click="gotoCardList()" style="position: absolute;bottom: 120rpx; right: 32rpx;"> |
| | | <div class="settlement" >去购物车结算</div> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | canGoToCarList:false, |
| | | nums:10, |
| | | searchInfo: '', |
| | | //商品列表 |
| | | goodsList: [], |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | gotoCardList(){ |
| | | uni.navigateTo({ |
| | | url:'/pages/cusbar/cart/cartList' |
| | | }) |
| | | }, |
| | | addCardNum(e, id) { |
| | | this.goodsList.forEach(item => { |
| | | if (item.id === id) { |
| | |
| | | const cardInfos = await getCarts(); |
| | | // 处理购物车信息 |
| | | let cardMap = new Map(); |
| | | this.canGoToCarList = cardInfos.data.result.cartList.length>0 |
| | | cardInfos.data.result.cartList.forEach(item => { |
| | | |
| | | item.skuList.forEach(sku => { |
| | |
| | | overflow: hidden; |
| | | |
| | | } |
| | | |
| | | .settlement { |
| | | width: 180rpx; |
| | | height: 70rpx; |
| | | line-height: 70rpx; |
| | | background: linear-gradient(91deg, $light-color 1%, $aider-light-color 99%); |
| | | border-radius: 900rpx; |
| | | text-align: center; |
| | | color: #fff; |
| | | margin-right: 10rpx; |
| | | } |
| | | |
| | | .navigatorMenue { |
| | | margin-left: -32rpx; |
| | |
| | | */ |
| | | onShow() { |
| | | this.deleteShow ? (this.deleteShow = false) : true; |
| | | if (this.$refs.swiperAction) { |
| | | this.$refs.swiperAction.forEach((item, index) => { |
| | | item.show = false; |
| | | }); |
| | | this.getCardData(); |
| | | // if (this.$refs.swiperAction) { |
| | | // this.$refs.swiperAction.forEach((item, index) => { |
| | | // item.show = false; |
| | | // }); |
| | | // this.getCardData(); |
| | | // } else { |
| | | // this.getCardData(); |
| | | // } |
| | | |
| | | this.getCardData(); |
| | | } else { |
| | | this.getCardData(); |
| | | } |
| | | }, |
| | | methods: { |
| | | /** |
| | |
| | | }, |
| | | onLoad(option) { |
| | | this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom |
| | | let queryParam = this.videoQuery; |
| | | if (option.q) { |
| | | // 双重解码:微信对URL进行了两次编码 |
| | | const decodedUrl = decodeURIComponent(decodeURIComponent(option.q)); |
| | | console.log('原始URL:', decodedUrl); |
| | | |
| | | // 解析URL中的查询参数 |
| | | const params = this.parseUrlParams(decodedUrl); |
| | | const shareType = params.shareType; |
| | | const videoId = params.videoId; |
| | | queryParam.videoId = videoId |
| | | queryParam.shareType = shareType |
| | | console.log('解析参数:', { shareType, videoId }); |
| | | } |
| | | const token = storage.getAccessToken(); |
| | | if (! token) { |
| | | this.wxSilentLogin(() => { |
| | | this.loadVideos(); |
| | | // 判断是不是点击分享链接进来的 |
| | | if (option.userId && option.videoId) { |
| | | queryParam.videoId = option.videoId |
| | | // 保存分享点击记录 |
| | | saveShareClickRecord({refId: option.videoId, shareUserId: option.userId}) |
| | | } |
| | | this.loadVideos(queryParam); |
| | | }) |
| | | } else { |
| | | this.loadVideos(); |
| | | if (option.userId && option.videoId) { |
| | | queryParam.videoId = option.videoId |
| | | // 保存分享点击记录 |
| | | saveShareClickRecord({refId: option.videoId, shareUserId: option.userId}) |
| | | } |
| | | this.loadVideos(queryParam); |
| | | } |
| | | }, |
| | | onShareAppMessage(e) { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | // 解析URL参数 |
| | | parseUrlParams(url) { |
| | | const params = {}; |
| | | // 处理可能存在的hash(如果有的话) |
| | | const cleanUrl = url.split('#')[0]; |
| | | const queryStr = cleanUrl.split('?')[1] || ''; |
| | | |
| | | queryStr.split('&').forEach(pair => { |
| | | const [key, value] = pair.split('='); |
| | | if (key) { |
| | | // 如果值存在,则解码,否则设为空字符串 |
| | | params[key] = value ? decodeURIComponent(value) : ''; |
| | | } |
| | | }); |
| | | |
| | | return params; |
| | | }, |
| | | // 查询当前视频的关联视频(挂了同一商品的) |
| | | async getGoodsSimilarly() { |
| | | if (this.similarlyLoading || this.similarlyNomore) return Promise.resolve();; |
| | |
| | | }, |
| | | |
| | | // 加载视频数据 |
| | | async loadVideos() { |
| | | async loadVideos(param) { |
| | | if (this.loading || this.videoNoMore) return; |
| | | this.loading = true; |
| | | |
| | | if(param){ |
| | | getHealthRecommendVideos(this.videoQuery).then(res => { |
| | | // 新增一个字段用于循环时的key |
| | | const data = res.data.data.map(item => { |
| | | return { |
| | | ...item, |
| | | updateKey: item.id |
| | | } |
| | | }) |
| | | if (this.videoQuery.pageNumber === 1) { |
| | | this.videoList = data; |
| | | } else { |
| | | this.videoList = [ |
| | | ...this.videoList, |
| | | ...data.filter( |
| | | (newItem) => !this.videoList.some((oldItem) => oldItem.id === newItem.id) |
| | | ), |
| | | ]; |
| | | } |
| | | this.loading = false; |
| | | if(data.length < this.videoQuery.pageSize) { |
| | | this.videoNoMore = true; |
| | | return; |
| | | } |
| | | this.videoQuery.pageNumber++; |
| | | |
| | | }) |
| | | }else{ |
| | | getHealthRecommendVideos(this.videoQuery).then(res => { |
| | | // 新增一个字段用于循环时的key |
| | | const data = res.data.data.map(item => { |
| | |
| | | } |
| | | this.videoQuery.pageNumber++; |
| | | |
| | | }) |
| | | })} |
| | | }, |
| | | |
| | | // 滑动切换视频 |
| | |
| | | console.log('-------------leftHeight------------------------>',this.leftHeight) |
| | | this.getKitchenTypeList(); |
| | | this.loadVideos(); |
| | | }, |
| | | onShareAppMessage(e) { |
| | | const userInfo = storage.getUserInfo(); |
| | | if(!userInfo) { |
| | | console.log("未登录不能分享"); |
| | | return |
| | | } |
| | | const videoInfo = e.target.dataset.obj; |
| | | // 保存分享记录 |
| | | const data = { |
| | | shareType: 'video', |
| | | refId: videoInfo.id, |
| | | shareUser: userInfo.id |
| | | } |
| | | saveShare(data) |
| | | return { |
| | | title: videoInfo.title, |
| | | path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`, |
| | | imageUrl: videoInfo.coverUrl |
| | | } |
| | | }, |
| | | methods: { |
| | | // 查询当前视频的关联视频(挂了同一商品的) |
| | |
| | | <div class="uForm"> |
| | | <u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules"> |
| | | <!-- #ifndef H5 --> |
| | | <view class="selectAddress" @click="clickUniMap"> |
| | | <!-- <view class="selectAddress" @click="clickUniMap"> |
| | | 选择收货地址 |
| | | </view> |
| | | </view> --> |
| | | <!-- #endif --> |
| | | <u-form-item class="border" label="收货人" label-width="130" prop="name"> |
| | | <u-input v-model="form.name" clearable placeholder="请输入收货人姓名" /> |
| | |
| | | <m-city :provinceData="list" headTitle="区域选择" ref="cityPicker" @funcValue="getpickerParentValue" pickerSize="4"> |
| | | </m-city> |
| | | |
| | | <uniMap v-if="mapFlag" @close="closeMap" @callback="callBackAddress" /> |
| | | <!-- <uniMap v-if="mapFlag" @close="closeMap" @callback="callBackAddress" /> --> |
| | | </div> |
| | | </view> |
| | | </template> |
| | |
| | | |
| | | // 选择地址后数据的回调 |
| | | callBackAddress(val) { |
| | | console.log(val) |
| | | uni.showLoading({ |
| | | title: "加载中", |
| | | }); |
| | |
| | | this.getTalk(options.userId) |
| | | |
| | | } |
| | | |
| | | // this.ws.connect(); |
| | | this.sokcet(); |
| | | }, |
| | |
| | | this.startHidenTime = Date.now() |
| | | }, |
| | | onLoad(option) { |
| | | console.log('-----------分享出的数据---------->',option) |
| | | //处理扫码出来的视频 |
| | | this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom |
| | | // 检查是否存在q参数 |
| | | let queryParam = this.videoQuery; |
| | | if (option.q) { |
| | | // 双重解码:微信对URL进行了两次编码 |
| | | const decodedUrl = decodeURIComponent(decodeURIComponent(option.q)); |
| | | console.log('原始URL:', decodedUrl); |
| | | |
| | | // 解析URL中的查询参数 |
| | | const params = this.parseUrlParams(decodedUrl); |
| | | const shareType = params.shareType; |
| | | const videoId = params.videoId; |
| | | queryParam.videoId = videoId |
| | | console.log('解析参数:', { shareType, videoId }); |
| | | } |
| | | const token = storage.getAccessToken(); |
| | | if (! token) { |
| | | this.wxSilentLogin(() => { |
| | | this.loadVideos(); |
| | | // 判断是不是点击分享链接进来的 |
| | | if (option.userId && option.videoId) { |
| | | queryParam.videoId = option.videoId |
| | | // 保存分享点击记录 |
| | | saveShareClickRecord({refId: option.videoId, shareUserId: option.userId}) |
| | | } |
| | | console.log('------------------------>',queryParam) |
| | | this.loadVideos(queryParam); |
| | | }) |
| | | } else { |
| | | this.loadVideos(); |
| | | if (option.userId && option.videoId) { |
| | | queryParam.videoId = option.videoId |
| | | // 保存分享点击记录 |
| | | saveShareClickRecord({refId: option.videoId, shareUserId: option.userId}) |
| | | } |
| | | console.log('------------------------2>',queryParam) |
| | | this.loadVideos(queryParam); |
| | | } |
| | | }, |
| | | onShareAppMessage(e) { |
| | |
| | | return { |
| | | title: videoInfo.title, |
| | | path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`, |
| | | imageUrl: videoInfo.coverUrl |
| | | } |
| | | }, |
| | | methods: { |
| | | methods: { |
| | | // 解析URL参数 |
| | | parseUrlParams(url) { |
| | | const params = {}; |
| | | // 处理可能存在的hash(如果有的话) |
| | | const cleanUrl = url.split('#')[0]; |
| | | const queryStr = cleanUrl.split('?')[1] || ''; |
| | | |
| | | queryStr.split('&').forEach(pair => { |
| | | const [key, value] = pair.split('='); |
| | | if (key) { |
| | | // 如果值存在,则解码,否则设为空字符串 |
| | | params[key] = value ? decodeURIComponent(value) : ''; |
| | | } |
| | | }); |
| | | |
| | | return params; |
| | | }, |
| | | // 查询当前视频的关联视频(挂了同一商品的) |
| | | async getGoodsSimilarly() { |
| | | if (this.similarlyLoading || this.similarlyNomore) return Promise.resolve();; |
| | |
| | | }, |
| | | |
| | | // 加载视频数据 |
| | | async loadVideos() { |
| | | async loadVideos(param) { |
| | | if (this.loading || this.videoNoMore) return; |
| | | this.loading = true; |
| | | |
| | | if(param){ |
| | | getRecommendVideos(param).then(res => { |
| | | // 新增一个字段用于循环时的key |
| | | const data = res.data.data.map(item => { |
| | | return { |
| | | ...item, |
| | | updateKey: item.id |
| | | } |
| | | }) |
| | | if (this.videoQuery.pageNumber === 1) { |
| | | this.videoList = data; |
| | | } else { |
| | | this.videoList = [ |
| | | ...this.videoList, |
| | | ...data.filter( |
| | | (newItem) => !this.videoList.some((oldItem) => oldItem.id === newItem.id) |
| | | ), |
| | | ]; |
| | | |
| | | } |
| | | this.loading = false; |
| | | if(res.data.data.length < this.videoQuery.pageSize) { |
| | | this.videoNoMore = true; |
| | | return; |
| | | } |
| | | this.videoQuery.pageNumber++; |
| | | |
| | | }) |
| | | }else{ |
| | | getRecommendVideos(this.videoQuery).then(res => { |
| | | // 新增一个字段用于循环时的key |
| | | const data = res.data.data.map(item => { |
| | |
| | | this.videoQuery.pageNumber++; |
| | | |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | // 滑动切换视频 |
| | |
| | | this.getGoodsList(); |
| | | }, |
| | | methods: { |
| | | selectGoods(goods,id){ |
| | | uni.navigateTo({ |
| | | url: `/pages/product/goods?id=${goods.id}&goodsId=${goods.goodsId}` |
| | | }) |
| | | }, |
| | | // 获取商品列表 |
| | | async getGoodsList() { |
| | | getGoodsDetail(this.videoId).then(res => { |