Prechádzať zdrojové kódy

Merge branch 'master' of http://1.14.104.71:10880/liujiaxin/baiyuchengpin

xw 1 týždeň pred
rodič
commit
19c5d723e5

+ 7 - 2
api/living.js

@@ -216,7 +216,7 @@ export function login(data) {
 // }
 
 export function getGotoWxAppLiveLink(data) {
-	return request('/app/fs/course/getGotoWxAppLiveLink', data, 'GET', 'application/json;charset=UTF-8');
+	return request('/app/live/getAppletScheme', data, 'GET', 'application/json;charset=UTF-8');
 }
 
 
@@ -232,4 +232,9 @@ export function loginByMp(data) {
 
 export function getUserInfo() {
 	return request('/liveAPP/app/user/getUserInfo', null, 'GET');
-}
+}
+
+// 关注客服
+export function getIsAddKf(data) {
+	return request('/app/live/liveWatchUser/liveIsAddKf', data, 'POST', 'application/json;charset=UTF-8');
+}

+ 2 - 1
api/storeAfterSales.js

@@ -9,7 +9,8 @@ let request = new Request().http
  }
  
  export function getAfterSalesList(data) {
- 	 return request('/app/storeAfterSales/getStoreAfterSalesList',data,'GET');
+ 	 //return request('/app/storeAfterSales/getStoreAfterSalesList',data,'GET');///旧版
+	 return request('/app/order/getMergedAfterSalesList',data,'GET');
  } 
  
  export function getAfterSalesDetails(data) {

+ 14 - 3
api/storeOrder.js

@@ -3,7 +3,8 @@ let request = new Request().http
 
  
  export function getMyStoreOrderList(data) {
- 	 return request('/app/storeOrder/getMyStoreOrderList',data,'GET');
+ 	 //return request('/app/storeOrder/getMyStoreOrderList',data,'GET');//旧版
+	 return request('/app/order/getMyMergedOrderList',data,'GET')
  } 
  export function getCompanyStoreOrderList(data) {
  	 return request('/app/storeOrder/getCompanyStoreOrderList',data,'GET');
@@ -50,6 +51,11 @@ let request = new Request().http
  
  export function cancelOrder(data) {
  	 return request('/app/storeOrder/cancelOrder',data,'POST','application/json;charset=UTF-8');
+	 
+ }
+ // 取消直播订单
+ export function cancelLiveOrder(data) {
+ 	return request('/app/live/liveOrder/cancelOrder', data, 'POST', 'application/json;charset=UTF-8')
  }
  export function finishOrder(data) {
  	 return request('/app/storeOrder/finishOrder',data,'POST','application/json;charset=UTF-8');
@@ -77,8 +83,13 @@ let request = new Request().http
  export function orderBindUser(data) {
  	 return request('/app/storeOrder/orderBindUser',data,'POST','application/json;charset=UTF-8');
  }  
- export function clearPayType(data) {
-  	 return request('/app/live/liveOrder/clearPayType',data,'POST','application/json;charset=UTF-8');
+export function clearPayType(data) {
+ 	 return request('/app/live/liveOrder/clearPayType',data,'POST','application/json;charset=UTF-8');
   }
  
+// 删除订单
+export function deleteOrder(data) {
+	return request('/app/order/deleteOrder', data, 'POST', 'application/json;charset=UTF-8');
+}
+ 
  

+ 9 - 3
common/request.js

@@ -13,8 +13,8 @@ export default class Request {
 		let path = 'https://userapp.klbycp.com/store'; //百域承品
 		let path2 = 'https://userapp.klbycp.com'; //百域承品
 
-		// let path = 'http://qeeaf625.natappfree.cc/store'; //本地
-		// let path2 = 'http://qeeaf625.natappfree.cc'; //本地
+		// let path = 'http://gd3c3bb9.natappfree.cc/store'; //本地
+		// let path2 = 'http://gd3c3bb9.natappfree.cc'; //本地
 
 		let type = 0
 		uni.setStorageSync('requestPath', path2)
@@ -25,7 +25,13 @@ export default class Request {
 		if (router.indexOf("/live/liveData/like") != -1) {
 			path = 'https://im.fhhx.runtzh.com';
 		}
-
+if (router.indexOf("/app/order/getMyMergedOrderList") != -1 || router.indexOf("/app/order/deleteOrder") != -1) {
+			path = 'https://userapp.klbycp.com';
+		}
+	
+			if (router.indexOf("/app/order/getMergedAfterSalesList") != -1) {
+					path = 'https://userapp.klbycp.com';
+				}
 		if (router.indexOf("/live") !== -1 || router.indexOf("/liveAPP") !== -1) {
 			// path = 'https://userapp.klbycp.com';
 			path = path2

+ 5 - 2
pages/shopping/productDetails.vue

@@ -489,8 +489,11 @@
 			// 加入购物车
 			addCart(type) {
 				if (type == 'buy') {
-					const userInfoStr = uni.getStorageSync('userInfo');
-					if (!userInfoStr || !userInfoStr.maOpenId) {
+					let userInfoStr = uni.getStorageSync('userInfo');
+					if(Object.prototype.toString.call(userInfoStr) == '[object String]'){
+						userInfoStr = JSON.parse(userInfoStr)
+					}
+					if (!userInfoStr || userInfoStr && !userInfoStr.maOpenId) {
 						uni.navigateTo({
 							url: '/pages/auth/login'
 						});

+ 2 - 2
pages/user/index.vue

@@ -181,12 +181,12 @@
 
 
 							<!-- 测试用下面的 -->
-							<!-- <view class="item no-marin-bottom align-top" @click="navgetTo('/pages_course/livingList')">
+							<view class="item no-marin-bottom align-top" @click="navgetTo('/pages_course/livingList')">
 								<image
 									src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/integral.png"
 									mode=""></image>
 								<text class="text">直播</text>
-							</view> -->
+							</view>
 
 							<view class="item no-marin-bottom" @click="toManager()">
 								<image

+ 3 - 3
pages_company/shareLive.vue

@@ -172,8 +172,8 @@
 			        }
 			        
 			        const data = {
-			            appid: this.appid,
-			            linkStr: `/pages_course/living?companyId=${this.companyId}&companyUserId=${this.companyUserId}&liveId=${item.liveId}`
+			            liveId: item.liveId,
+                  companyUserId: this.companyUserId,
 			        }
 			        
 			        console.log("请求短链接参数:", data);
@@ -182,7 +182,7 @@
 			            console.log("短链接口返回:", res);
 			            if (res.code == 200) {
 			                // 正确使用 resolve 返回数据
-			                resolve(res.data || res.result || res.url || res);
+			                resolve( res.result.link || res.result ||  res);
 			            } else {
 			                uni.showToast({
 			                    icon: 'none',

+ 385 - 73
pages_course/living.vue

@@ -2,18 +2,22 @@
 	<view class="swiper-wrapper" :class="liveItem.showType == 1 ? 'horizontal' : ''">
 		<view class="container">
 			<!-- 预告直播状态 -->
-			<view class="trailer-box" v-if="liveItem.status == 1">
-				<video v-if="liveItem.previewUrl" :id="`myVideo_${liveId}`" class="trailer-video"
-					:src="liveItem.previewUrl" :autoplay="true" :loop="false" object-fit="contain" :custom-cache="false"
-					:enable-progress-gesture="false" vslide-gesture-in-fullscreen="false" :show-center-play-btn="false"
-					:http-cache="false" @error="videoError" @loadedmetadata="onVideoMetaLoaded" @pause="onVideoPause"
-					@play="onVideoPlay" :disable-progress="true" :enable-play-gesture="true" @waiting="onVideoWaiting"
-					preload="auto" type="application/x-mpegURL" :controls="false"></video>
+			<view :class="liveItem.previewUrl?'trailer-box':'trailer-box2'" v-if="liveItem.status == 1">
+				<view class="video-container2"
+					:style="{ paddingBottom:liveItem.previewUrl?videoRatio + '%':'' ,height:auto,width:'100%'}">
+					<video v-if="liveItem.previewUrl" :id="`myVideo_${liveId}`" class="trailer-video"
+						:src="liveItem.previewUrl" :autoplay="true" :loop="false"
+						:object-fit="isHeight?'contain':'fill'" :custom-cache="false" :enable-progress-gesture="false"
+						vslide-gesture-in-fullscreen="false" :show-center-play-btn="false" :http-cache="false"
+						@error="videoError" @loadedmetadata="onVideoMetaLoaded" @pause="onVideoPause"
+						@play="onVideoPlay" :disable-progress="true" :enable-play-gesture="true"
+						@waiting="onVideoWaiting" preload="auto" type="application/x-mpegURL" :controls="false"></video>
+				</view>
 				<image v-if="liveItem.status == 1 && !liveItem.previewUrl" class="trailer-placeholder"
-					src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/no_live.png">
+					src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/readyStart.png">
 				</image>
 				<view class="countdown-container" v-if="liveItem.status == 1 && liveCountdown">
-					<view class="live-name">{{ liveItem.liveName }}</view>
+					<view class="live-name" v-if="liveItem.previewUrl">{{ liveItem.liveName }}</view>
 					<view class="countdown-display">
 						<text class="countdown-label">距离开播还有</text>
 						<view class="countdown-unit">
@@ -31,13 +35,13 @@
 				</view>
 				<view class="trailer-actions">
 					<button open-type="share" class="button-reset share-button">
-						<view class="action-button mr18" @click="handleAgreement">
+						<view class="action-button mr24" @click="handleAgreement">
 							<text>分享给好友</text>
 						</view>
 					</button>
 
 					<view class="action-button reserve-button" @click="handleAgreement">
-						<image class="button-icon mr8" src="/static/images/trailer.png"></image>
+						<!-- <image class="button-icon mr8" src="/static/images/trailer.png"></image> -->
 						<text>预约直播</text>
 					</view>
 				</view>
@@ -99,11 +103,12 @@
 					<text>{{ orderUser.count || 0 }}人正在去购买</text>
 				</view> -->
 
+
 				<!-- 视频区域 -->
 
 				<view class="videolist" v-if="liveItem.status == 2" :class="isFullscreen ? 'screen' : ''">
 					<view class="video-container"
-						:style="{ paddingBottom: liveItem.showType==2||isFullscreen?'':videoRatio + '%',height:liveItem.showType==2?'100vh':'auto',width:isFullscreen?'0':'100%'}"
+						:style="{ paddingBottom: liveItem.showType==2||isFullscreen?'':videoRatio + '%',height:liveItem.showType==2?'100vh':isFullscreen?'auto':'400rpx',width:isFullscreen?'0':'100%'}"
 						:class="{'horizontal-layout': liveItem.showType == 1,'fullscreen-mode': isFullscreen}">
 						<!-- <video v-if="liveItem.videoUrl && liveItem.liveType == 2 && !generating"
 							:id="`myVideo_${liveId}`" :autoplay="true" class="video-player" :src="liveItem.videoUrl"
@@ -121,8 +126,8 @@
 						</video> -->
 						<video v-if="liveItem.videoUrl && liveItem.liveType == 2 && !generating"
 							:id="`myVideo_${liveId}`" :autoplay="true" class="video-player" :src="liveItem.videoUrl"
-							:style="{transform: `scale(${scale})`, transformOrigin: 'center center', bottom:isFullscreen?'0':''}"
-							:object-fit="liveItem.showType==2?'contain':'fill'" :custom-cache="false"
+							:style="{transform:liveItem.showType!==2?`scale(${scale})`:'', transformOrigin: 'center center', bottom:isFullscreen?'0':''}"
+							:object-fit="liveItem.showType==2||isFullscreen?'contain':'fill'" :custom-cache="false"
 							:enable-progress-gesture="false" vslide-gesture-in-fullscreen="false"
 							:show-center-play-btn="false" :http-cache="false" loop @error="videoError"
 							@timeupdate="onVideoTimeUpdate" @loadedmetadata="onVideoMetaLoaded" @pause="onVideoPause"
@@ -157,7 +162,8 @@
 						</view>
 
 						<!-- 回放标签 -->
-						<view v-if="isPlayback" class="replay-label" :style="{top:liveItem.showType === 2?'22%':isFullscreen?'':'10%',bottom:isFullscreen?'75vw':''}"
+						<view v-if="isPlayback" class="replay-label"
+							:style="{top:liveItem.showType === 2?'22%':isFullscreen?'':'10%',bottom:isFullscreen?'75vw':''}"
 							:class="isFullscreen? 'replay-full' : ''">回放
 						</view>
 					</view>
@@ -167,7 +173,7 @@
 				<view class="videolist" v-if="liveItem.status == 3">
 					<view class="video-container" style="height: 500rpx;"
 						:class="{'horizontal-layout': liveItem.showType == 1, 'fullscreen-mode': isFullscreen}">
-						<view class="live-end-message">直播已结束</view>
+						<view class="live-end-message" :style="{marginTop:liveItem.showType === 2?'50%':''}">直播已结束</view>
 					</view>
 				</view>
 
@@ -208,7 +214,8 @@
 				<!-- 底部聊天区域 -->
 				<view class="chat-area-container" :class="{
 				    'chat-area-container2': liveItem.showType == 1,
-					'chat-area-container3': liveItem.status == 1,
+					'chat-area-container3': liveItem.status == 1 && !liveItem.previewUrl && liveItem.showType == 1,
+					'chat-area-container4': liveItem.status == 1 && liveItem.previewUrl && liveItem.showType == 1,
 				    'chat-area-focused': isFocus
 				  }" :style="{ '--keyboard-height': keyboardHeight + 'rpx' ,'display':isFullscreen?'none':''}">
 					<view class="tabs_bg" v-if="liveItem.showType == 1">
@@ -224,15 +231,15 @@
 					</view>
 
 					<view class="chat-content-wrapper" :class="{ 'chat-content-focused': isFocus }">
-						<view class="notice-message" v-if="!isFocus&&isShowNotice"
-							:class="liveItem.showType == 1 ? 'horizontal-notice' : ''">
+						<view class="notice-message" v-if="isShowNotice"
+							:class="liveItem.showType == 1 ? 'horizontal-notice' : 'horizontal-notice2'">
 							公告消息: {{notice.msg}}
 						</view>
 						<scroll-view id="msgScroll" v-if="Array.isArray(talklist)" enable-flex scroll-y="true"
-						:style="{ height: `calc(100% - ${commonViewHeight}px)`,marginTop:commonViewHeight+'px' }"
+							:style="{ height: liveItem.showType === 1?`calc(100% - ${commonViewHeight}px)`:liveItem.status == 1?'100%':'',marginTop:liveItem.showType === 1?commonViewHeight+'px':'' }"
 							:enhanced="true" :bounces="false" :show-scrollbar="false" :fast-deceleration="false"
 							:enable-back-to-top="false" class="message-scroll-view"
-							:class="liveItem.status == 1 ? 'message-scroll2' : ''" :scroll-top="scrollTop"
+							:class="liveItem.status == 1 ? '' : ''" :scroll-top="scrollTop"
 							:scroll-into-view="scrollIntoView" @scroll="onScroll" ref="scrollView">
 							<view class="message-list" v-for="(item, talkIndex) in (talklist || [])"
 								:key="item.uniqueId " :id="`list_${item.uniqueId }`" v-show="item.cmd != 'red' ">
@@ -258,13 +265,15 @@
 								:placeholder-style="liveItem.showType == 1 ? 'color:#999999;' : 'color:#e7e7e7;'"
 								placeholder-class="placeholder-style" class="chat-input"
 								:class="{ 'input-focused': isFocus }" @focus="inputFocus" @blur="inputBlur"
-								cursor-spacing="100" :adjust-position="false" :disabled="isEnd" @confirm="sendMsg" />
+								cursor-spacing="100" :adjust-position="false" :disabled="isEnd" @confirm="sendMsg"
+								:confirm-type="value?'send':'done'" />
 
-							<input v-else :placeholder="placeholderText" v-model="value"
+							<input v-else :placeholder="placeholderText" v-model="value" type="text"
 								:placeholder-style="liveItem.showType == 1 ? 'color:#999999;' : 'color:#e7e7e7;'"
 								placeholder-class="placeholder-style" class="chat-input"
 								:class="{ 'input-focused': isFocus }" @focus="inputFocus" @blur="inputBlur"
-								cursor-spacing="100" :adjust-position="false" :disabled="isEnd" />
+								cursor-spacing="100" :adjust-position="false" :disabled="isEnd" @confirm="sendMsg"
+								:confirm-type="value?'send':'done'" />
 							<!-- v-if="isFocus&&!isIOS" -->
 							<view class="send-button" v-if="!isIOS" :class="liveItem.showType == 1 ? 'send2' : ''"
 								@click="sendMsg()">
@@ -725,7 +734,9 @@
 		internetTraffic, // 流量(缓冲百分比),
 		liveInternetTraffic, // 直播流量(缓冲百分比),
 		loginByMp,
-		getUserInfo
+		getUserInfo,
+		getIsAddKf,
+		liveWatchUser
 	} from '@/api/living.js';
 	import {
 		editUser
@@ -757,8 +768,9 @@
 		},
 		data() {
 			return {
+				urlOption:{},
 				menuButtonInfo: {}, // 胶囊按钮布局信息
-
+				isHeight: false,
 				isFullscreen: false,
 				isVideoRotated: false,
 				showNonVideoElementsFlag: true,
@@ -833,6 +845,11 @@
 				isOnload: false,
 				isConnecting: false, // 是否正在连接中
 				hasInitialized: false,
+				// 请求状态标记,防止重复请求
+				isLoadingLiveInfo: false, // 是否正在加载直播间信息
+				isLoadingVideo: false, // 是否正在加载视频资源
+				hasCheckedLogin: false, // 是否已检查登录状态
+				hasLoadedLocation: false, // 是否已加载位置信息
 
 				liveViewersData: [],
 				liveUserCalled: false, //调用过watchUserList没
@@ -904,6 +921,7 @@
 				shopping: false,
 				systemInfo: null, // 缓存系统信息,避免重复调用同步API
 				generatingTimer: null, //回访生成中
+				getlivingTimer: null, // getliving 防抖定时器
 				inputInfo: '',
 				showWelcomeMessage: false,
 				isShowGoods: false,
@@ -943,9 +961,20 @@
 		async onLoad(options) {
 			this.getMenuButtonInfo(); // 初始化获取胶囊信息
 			this.initTime()
-			this.getLocationByIP();
+
+			// 解析参数
 			if (options.liveId) {
 				this.liveId = options.liveId;
+
+			}
+			if(options.qwUserId){
+				this.urlOption.companyId=options.companyId
+				this.urlOption.companyUserId=options.companyUserId
+				this.urlOption.corpId=options.corpId
+				this.urlOption.liveId=options.liveId
+				this.urlOption.qwUserId=options.qwUserId
+				this.urlOption.qwExternalId=options.externalId
+				this.urlOption.chatId=options.chatId
 			}
 			// 扫码传来的参数
 			if (options.scene) {
@@ -966,15 +995,30 @@
 				this.qrFrom = `&companyId=${options.companyId}&companyUserId=${options.companyUserId}`;
 			}
 			this.userinfo = uni.getStorageSync('userinfo');
-			// this.userData = uni.getStorageSync('userData');
 			console.log('全部参数', options);
+
+			// 优先判断登录状态,然后加载数据
+			// this.userData = uni.getStorageSync('userData');
+
 			try {
 				const isLogin = await this.utils.checkLiveToken();
+				this.hasCheckedLogin = true;
 				if (isLogin) {
-					this.haveLogin()
+					// 登录后:优先加载直播间信息,然后加载视频资源
+					await this.haveLogin();
+				} else {
+					// 未登录:先登录,登录成功后再加载数据
+					this.goLogin();
 				}
+
 			} catch (error) {
 				console.error('初始化失败:', error);
+				this.hasCheckedLogin = true;
+			}
+
+			// 异步加载位置信息(不阻塞主流程)
+			if (!this.hasLoadedLocation) {
+				this.getLocationByIP();
 			}
 			//获取键盘高度 - 针对iPhone优化(使用缓存的系统信息)
 			uni.onKeyboardHeightChange((res) => {
@@ -1039,9 +1083,14 @@
 			// 初始化网络状态监听
 			this.initNetworkStatusListener();
 		},
-		onPullDownRefresh() {
-			this.getLiveMsg(this.liveItem);
-			// this.getliveUser();
+		async onPullDownRefresh() {
+			// 下拉刷新时,重新加载数据
+			if (this.liveId) {
+				// 重置加载状态,允许重新加载
+				this.isLoadingLiveInfo = false;
+				await this.getliving(this.liveId);
+				await this.getLiveMsg(this.liveItem);
+			}
 			setTimeout(() => {
 				uni.stopPullDownRefresh();
 			}, 1000);
@@ -1065,18 +1114,26 @@
 			this.isIOS = systemInfo.platform === 'ios';
 		},
 		async onShow() {
-			try {
-				const isLogin = await this.utils.checkLiveToken();
-				if (isLogin) {
-					this.haveLogin()
-				} else {
-					this.goLogin();
+			// 如果还没有检查过登录状态,则检查(避免重复检查)
+			if (!this.hasCheckedLogin) {
+				try {
+					const isLogin = await this.utils.checkLiveToken();
+					this.hasCheckedLogin = true;
+					if (isLogin) {
+						await this.haveLogin();
+					} else {
+						this.goLogin();
+					}
+				} catch (error) {
+					console.error('初始化失败:', error);
+					this.hasCheckedLogin = true;
 				}
-			} catch (error) {
-				console.error('初始化失败:', error);
 			}
 
-			this.getLocationByIP();
+			// 位置信息只加载一次
+			if (!this.hasLoadedLocation) {
+				this.getLocationByIP();
+			}
 
 			this.uuId = generateRandomString(16);
 			const isLiveLogin = uni.getStorageSync('isLiveLogin');
@@ -1324,6 +1381,12 @@
 			// 关闭WebSocket连接(会自动清理相关资源)
 			this.closeWebSocket(true);
 
+			// 清除 getliving 防抖定时器
+			if (this.getlivingTimer) {
+				clearTimeout(this.getlivingTimer);
+				this.getlivingTimer = null;
+			}
+
 			// 清除所有定时器(使用增强清理)
 			this.clearAllTimersEnhanced();
 
@@ -1381,8 +1444,13 @@
 						return;
 					}
 					// 状态变化时,调用getliving更新直播间数据
-					// console.log(`liveItem.status从${oldStatus}变为${newStatus},触发getliving请求`);
-					this.getliving(this.liveId);
+					// 添加防抖,避免频繁请求
+					if (this.getlivingTimer) {
+						clearTimeout(this.getlivingTimer);
+					}
+					this.getlivingTimer = setTimeout(() => {
+						this.getliving(this.liveId);
+					}, 500); // 500ms 防抖
 				},
 				deep: true
 			},
@@ -1397,13 +1465,25 @@
 				immediate: true
 			},
 			'isShowNotice': {
-							handler(newVal, oldVal) {
-								setTimeout(() => {
-									this.noticeHeightFun()
-								}, 800)
-							},
-							immediate: true
-						}
+				handler(newVal, oldVal) {
+					setTimeout(() => {
+						this.noticeHeightFun()
+					}, 800)
+				},
+				immediate: true
+			},
+			'notice.msg': {
+				handler(newVal, oldVal) {
+					const newLength = newVal.length;
+					const oldLength = oldVal.length;
+					if (newLength !== oldLength) {
+						setTimeout(() => {
+							this.noticeHeightFun()
+						}, 800)
+					}
+				},
+				deep: true
+			},
 		},
 		methods: {
 			noticeHeightFun() {
@@ -1748,6 +1828,11 @@
 				this.user.nickname = e.detail.value
 			},
 			async haveLogin() {
+				// 防止重复执行
+				if (this.isOnload) {
+					return;
+				}
+
 				this.userInfo = uni.getStorageSync('userInfo');
 				if (this.userInfo) {
 					await this.getUserInfo();
@@ -1755,13 +1840,19 @@
 
 				// this.initTime();
 				if (this.liveId) {
-					// 先获取直播间信息
+					// 优先加载直播间信息(包含视频资源URL)
 					await this.getliving(this.liveId);
 					this.isOnload = true;
 
-					await this.getLiveMsg(this.liveItem);
-					await this.getliveViewData();
-					// await this.getliving(this.liveId);
+					// 然后加载其他数据(并行执行,不阻塞视频加载)
+					Promise.all([
+						this.getLiveMsg(this.liveItem),
+						this.getliveViewData()
+					]).catch(err => {
+						console.error('加载数据失败:', err);
+					});
+
+					// 其他非关键数据异步加载
 					this.getCurrentActivities();
 					this.getliveOrder();
 					this.initSocket();
@@ -1812,7 +1903,9 @@
 										this.haveLogin()
 										this.userlogo = true
 										// console.log("TOKEN_KEYAuto",TOKEN_KEYAuto)
-										// this.getIsAddKf() 
+										if(this.urlOption.qwUserId){
+											this.getIsAddKf()										//this.getIsAddKf()
+										}
 									} else {
 										uni.showToast({
 											title: res.msg,
@@ -1831,8 +1924,60 @@
 					}
 				})
 			},
+			// liveWatchUser(){
+			// 	var data={
+			// 		qwUserId:this.urlOption.qwUserId,
+			// 		liveId:this.urlOption.liveId,
+			// 		userId:this.userInfo.userId,
+			// 		corpId:this.urlOption.corpId,
+			// 		companyUserId:this.urlOption.companyUserId,
+			// 		qwExternalId:this.urlOption.qwExternalId,
+			// 		companyId:this.urlOption.companyId,
+			// 		chatId:this.urlOption.chatId,
+			// 	}
+			// 	liveWatchUser(data).then(
+			// 		res => {
+			// 			if (res.code == 200) {
+
+			// 			} else {
+			// 				uni.showToast({
+			// 					icon: 'none',
+			// 					title: res.msg,
+			// 				});
+			// 			}
+			// 		},
+			// 		rej => {}
+			// 	);
+			// },
+			// 客服
+			getIsAddKf() {
+				// {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
+				getIsAddKf(this.urlOption).then(res => {
+						if (res.code == 200) {
+							this.isAddKf = 1
+							//this.getH5CourseVideoDetails()
+						} else if (res.code == 401) {
+							this.isAddKf = 0
+							this.goLogin();
+							}
+						else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+						}
+					},
+					err => {}
+				);
+			},
 			clickTabs(item) {},
 			getLocationByIP() {
+				// 防止重复请求
+				if (this.hasLoadedLocation) {
+					return;
+				}
+				this.hasLoadedLocation = true;
+
 				// 高德IP定位API,需要替换成你的key
 				const key = '4e13632be0cc278f56825919603c07cf';
 				uni.request({
@@ -1847,10 +1992,12 @@
 							console.log('用户所在地:', this.location);
 						} else {
 							console.error('获取位置失败:', res.data);
+							this.hasLoadedLocation = false; // 失败后允许重试
 						}
 					},
 					fail: (err) => {
 						console.error('请求失败:', err);
+						this.hasLoadedLocation = false; // 失败后允许重试
 					}
 				});
 			},
@@ -2750,8 +2897,9 @@
 					maOpenId: this.userInfo.maOpenId,
 					appId: this.appid,
 					data: {
-						thing6: this.liveItem.liveName,
-						date7: this.liveItem.startTime
+						thing4: this.liveItem.liveName,
+						time2: this.liveItem.startTime,
+            date7: this.liveItem.startTime
 					}
 				};
 				subNotifyLive(templateData).then(
@@ -3096,14 +3244,18 @@
 				//横屏
 				const wW = (winW / winH) * 100;
 				//竖屏
-				const wH = (winH / winW) * 100;
-				if (this.liveItem.showType == 2) {
-					const videoRatio = (height / width) * 100;
-					this.scale = wH / videoRatio;
-					console.log("比例", this.videoRatio, width, height)
-				} else if (this.isFullscreen) {
-					this.scale = wW / this.videoRatio;
+				if (height > width) {
+					this.isHeight = true
 				}
+				const wH = (winH / winW) * 100;
+				// this.scale = wW / this.videoRatio;
+				// if (this.liveItem.showType == 2) {
+				// 	const videoRatio = (height / width) * 100;
+				// 	this.scale = wH / videoRatio;
+				// 	console.log("比例", this.videoRatio, width, height)
+				// } else if (this.isFullscreen) {
+
+				// }
 				this.videoProgressKey = `videoProgress_${this.liveId}`;
 				this.setVideoProgress();
 			},
@@ -3834,11 +3986,21 @@
 			// 修改获取直播信息方法
 			async getliving(liveId) {
 				if (!liveId) return;
+
+				// 防止重复请求
+				if (this.isLoadingLiveInfo) {
+					console.log('正在加载直播间信息,跳过重复请求');
+					return;
+				}
+
+				this.isLoadingLiveInfo = true;
 				const param = {
 					id: liveId
 				};
 				try {
 					const res = await getlive(param);
+					this.isLoadingLiveInfo = false;
+
 					if (res.code !== 200) {
 						uni.showToast({
 							title: res.msg,
@@ -3931,6 +4093,7 @@
 						this.playVideo();
 					}
 				} catch (err) {
+					this.isLoadingLiveInfo = false;
 					console.error('获取直播信息失败:', err);
 					uni.showToast({
 						title: '获取直播信息失败',
@@ -3987,11 +4150,14 @@
 			//直播间点赞、关注、在线人数数据
 			getliveViewData() {
 				if (!this.liveId) return;
-				getLiveViewData(this.liveId).then((res) => {
+
+				// 使用 Promise 包装,支持 await
+				return getLiveViewData(this.liveId).then((res) => {
 					if (res.code == 200) {
 						// 强制响应式更新,确保数据实时显示
 						this.liveViewData = res;
 					}
+					return res;
 				}).catch((error) => {
 					console.error('获取直播间数据失败:', error);
 					// 失败时兜底,避免显示异常
@@ -3999,6 +4165,7 @@
 						like: 0,
 						watchCount: 0
 					};
+					throw error;
 				});
 			},
 			// 30秒刷新一下直播间点赞数
@@ -4847,6 +5014,12 @@
 		transition: all 0.3s ease;
 	}
 
+	.video-container2 {
+		position: relative;
+		bottom: -1px;
+		transition: all 0.3s ease;
+	}
+
 	.video-player.fullscreen {
 		width: 100vh !important;
 		height: 100vw !important;
@@ -4905,7 +5078,7 @@
 		line-height: 1 !important;
 		margin: 0 !important;
 		width: auto !important;
-		font-weight: 500 !important;
+		// font-weight: 500 !important;
 		border-radius: none !important;
 
 		&::after {
@@ -4975,7 +5148,7 @@
 				background: var(--pop-bg);
 				border-radius: 24rpx;
 				position: absolute;
-				top: 15%;
+				top: 16%;
 				left: 50%;
 				transform: translateX(-50%);
 				display: flex;
@@ -4989,7 +5162,10 @@
 
 				.trailer-video {
 					width: 100%;
-					height: 400rpx;
+					height: 100%;
+					position: absolute;
+					z-index: 1;
+					border-radius: 20rpx;
 				}
 
 				.trailer-placeholder {
@@ -5075,6 +5251,121 @@
 				}
 			}
 
+			// 新预告直播盒子
+			.trailer-box2 {
+				width: 100%;
+				position: absolute;
+				top: 16%;
+				display: flex;
+				flex-direction: column;
+				align-items: center;
+				z-index: 999;
+				transition: box-shadow 0.3s ease;
+				height: 400rpx;
+
+				.trailer-video {
+					width: 100%;
+					height: 100%;
+					position: absolute;
+					z-index: 1;
+				}
+
+				.trailer-placeholder {
+
+					position: absolute;
+					top: 0;
+					left: 0;
+					width: 100%;
+					height: 100%;
+					z-index: -1;
+					/* 置于内容下方 */
+				}
+
+				.countdown-container {
+					padding-top: 15%;
+					margin: 20rpx 0;
+					display: flex;
+					flex-direction: column;
+					align-items: center;
+
+					.live-name {
+						font-weight: 600;
+						font-size: 36rpx;
+					}
+
+					.countdown-display {
+						display: flex;
+						align-items: center;
+						margin: 30rpx 0;
+
+						.countdown-label {
+							font-size: 32rpx;
+							color: rgba(250, 214, 176, 1);
+						}
+
+						.countdown-separator {
+							font-size: 24rpx;
+							color: #999999;
+						}
+
+						.countdown-unit {
+							width: 60rpx;
+							height: 60rpx;
+							background: rgba(255, 246, 214, 1);
+							border-radius: 8rpx;
+							text-align: center;
+							overflow: hidden;
+							margin: 0 8rpx;
+							font-weight: 500;
+							font-size: 36rpx;
+							color: rgba(0, 75, 59, 1);
+							line-height: 60rpx;
+						}
+					}
+				}
+
+				.trailer-actions {
+					display: flex;
+					justify-content: center;
+					align-items: center;
+
+					.action-button {
+						width: 280rpx;
+						height: 72rpx;
+						border-radius: 36rpx;
+						display: flex;
+						justify-content: center;
+						align-items: center;
+						text-align: center;
+						border: 1px solid rgba(151, 151, 151, 1);
+						font-size: 36rpx;
+						font-weight: bold;
+
+						&.reserve-button {
+							color: rgba(0, 110, 80, 1);
+							background: linear-gradient(231.51deg, rgba(249, 215, 178, 1) 0%, rgba(255, 255, 191, 1) 47.83%, rgba(255, 250, 229, 1) 65.77%, rgba(248, 214, 178, 1) 100%);
+
+						}
+
+						&:not(.reserve-button) {
+							color: rgba(255, 246, 214, 1);
+							background: rgba(0, 110, 80, 1);
+						}
+
+						.button-icon {
+							width: 32rpx;
+							height: 32rpx;
+						}
+					}
+				}
+
+				.no-live-title {
+					margin-top: 30rpx;
+					font-size: 42rpx;
+					font-weight: 500;
+				}
+			}
+
 			// 主要内容区域
 			.content {
 				position: relative;
@@ -5238,6 +5529,7 @@
 							color: #fff;
 							border-radius: 28rpx;
 							z-index: 999999 !important;
+
 							&.complaint-full {
 								// top: 10rpx;
 								left: 82vh;
@@ -5368,16 +5660,32 @@
 				}
 
 				&.chat-area-container3 {
+					height: calc(85% - 420rpx);
+					flex: 1;
+					transform: none; // 移除之前的变换
+					will-change: auto;
+					display: flex;
+					flex-direction: column;
+					position: absolute;
+				}
 
-					max-height: 40%;
+				&.chat-area-container4 {
+					height: calc(85% - 680rpx);
 					flex: 1;
-					min-height: 0; // 重要:允许收缩到0
-					// position: relative;
 					transform: none; // 移除之前的变换
 					will-change: auto;
 					display: flex;
 					flex-direction: column;
 					position: absolute;
+					// max-height: 40%;
+					// flex: 1;
+					// min-height: 0; // 重要:允许收缩到0
+					// // position: relative;
+					// transform: none; // 移除之前的变换
+					// will-change: auto;
+					// display: flex;
+					// flex-direction: column;
+					// position: absolute;
 				}
 
 				&.chat-area-focused {
@@ -5406,14 +5714,14 @@
 
 				.chat-content-wrapper {
 					flex: 1;
-					height: 300rpx;
+					height: 400rpx;
 					padding: 20rpx 0;
 					transform: translateZ(0);
 					will-change: height;
 					position: relative;
 
 					&.chat-content-focused {
-						height: 100rpx;
+						height: 100rpx  !important;
 					}
 
 					.notice-message {
@@ -5434,6 +5742,10 @@
 							height: fit-content;
 							z-index: 2;
 						}
+
+						&.horizontal-notice2 {
+							color: #fff !important
+						}
 					}
 
 					.message-scroll-view {

+ 4 - 3
pages_shopping/live/confirmCreateOrder.vue

@@ -358,8 +358,8 @@
 					productId: this.productId,
 					totalNum: this.totalNum,
 					couponUserId: this.couponUserId,
-					attrValueId: this.productValueSelect
-
+					attrValueId: this.productValueSelect,
+                     appId: wx.getAccountInfoSync().miniProgram.appId
 				}
 
 				return createliveOrder(data).then(res => {
@@ -390,7 +390,8 @@
 					productId: this.productId,
 					totalNum: 1,
 					couponUserId: this.couponUserId,
-					recordId: this.recordId
+					recordId: this.recordId,
+					appId: wx.getAccountInfoSync().miniProgram.appId
 				}
 
 				return createReward(data).then(res => {

+ 5 - 2
pages_shopping/live/goods.vue

@@ -227,8 +227,11 @@
 			// 加入购物车
 			addCart(type) {
 				if (type == 'buy') {
-					const userInfoStr = uni.getStorageSync('userInfo');
-					if (!userInfoStr || !userInfoStr.maOpenId) {
+					let userInfoStr = uni.getStorageSync('userInfo');
+					if(Object.prototype.toString.call(userInfoStr) == '[object String]'){
+						userInfoStr = JSON.parse(userInfoStr)
+					}
+					if (!userInfoStr || userInfoStr && !userInfoStr.maOpenId) {
 						uni.navigateTo({
 							url: '/pages/auth/login'
 						});

+ 4 - 2
pages_shopping/live/paymentOrder.vue

@@ -182,7 +182,8 @@
 			weixinPayOrder() {
 				var data = {
 					orderId: this.order.orderId,
-					payType: 1
+					payType: 1,
+					appId: wx.getAccountInfoSync().miniProgram.appId
 				};
 				this.payParams = data
 				var that = this;
@@ -320,7 +321,8 @@
 			
 			toPayConfirmReward() {
 				let data = {
-					orderId: this.order.orderId
+					orderId: this.order.orderId,
+					appId: wx.getAccountInfoSync().miniProgram.appId
 				}
 				payConfirmReward(data).then(
 					res => {

+ 1 - 1
pages_user/user/refundOrderDetail.vue

@@ -270,7 +270,7 @@
 <style lang="scss">
 	.fixed-top-box{
 		width: 100%;
-		background: linear-gradient(135deg, #66b2ef 0%, #2BC7B9 100%);
+		//background: linear-gradient(135deg, #66b2ef 0%, #2BC7B9 100%);
 		position: fixed;
 		top: 0;
 		left: 0;

+ 10 - 3
pages_user/user/refundOrderList.vue

@@ -170,9 +170,16 @@
 			},
 			// 查看订单详情
 			showDetail(item) {
-				uni.navigateTo({
-					url: './refundOrderDetail?salesId=' + item.id
-				})
+				if(item.afterSalesType==2){
+					uni.navigateTo({
+						url: '/pages_shopping/live/refundOrderDetail?id=' + item.id
+					})
+				}else{
+					uni.navigateTo({
+						url: './refundOrderDetail?salesId=' + item.id
+					})
+				}
+				
 			},
 			
 		}

+ 156 - 17
pages_user/user/storeOrder.vue

@@ -42,7 +42,8 @@
 						</view>
 					</view>
 					<!-- 产品列表 -->
-					<view  class="drug-list"  >
+					<!-- 商城 -->
+					<view  class="drug-list"  v-if="item.orderType!==2">
 						<view @click="showDetail(item)"  v-if="item.isPackage!=1" v-for="(subItem,subIndex) in item.items" :key="subIndex" class="drug-item" >
 							<view class="img-box">
 								<image :src="JSON.parse(subItem.jsonInfo).image" mode="aspectFill"></image>
@@ -57,7 +58,7 @@
 								<view class="num-box">
 									<view class="price">
 										<text class="unit">¥</text>
-										<text class="num">{{JSON.parse(subItem.jsonInfo).price.toFixed(2)}}</text>
+									<text class="num">{{JSON.parse(subItem.jsonInfo).price.toFixed(2)}}</text>
 									</view>
 									<view class="amount">x{{JSON.parse(subItem.jsonInfo).num}}</view>
 								</view>
@@ -97,6 +98,68 @@
 								<view v-if="item.status == 0" class="btn pay" @click="pay(item)">支付</view>
 								<view v-if="item.isAfterSales==1" class="btn cancel" @click="refund(item)">申请售后</view>
 								<view v-if="item.status >=2 &&item.deliveryId!=null" class="btn pay" @click.stop="showDelivery(item)">查看物流</view>
+								<view v-if="item.status == -3" class="btn cancel" @click="deleteOrder(item)">删除订单</view>
+								<!-- <view v-if="item.status==4" class="btn pay">再次购买</view> -->
+							</view>
+						</view>
+					</view>
+					<!-- 直播 -->
+					<view  class="drug-list"  v-if="item.orderType==2">
+						<view @click="showDetail(item)"  v-if="item.isPackage!=1" class="drug-item" >
+							<view class="img-box">
+								<image :src="JSON.parse(item.itemJson).image" mode="aspectFill"></image>
+							</view>
+							<view class="drug-info"  >
+								<view>
+									<view class="name-box ellipsis2">
+										<view v-if="item.isPrescribe==1" class="tag">处方药</view>{{JSON.parse(item.itemJson).productName}}
+									</view>
+									<view class="spec ellipsis2">{{JSON.parse(item.itemJson).sku}}</view>
+								</view>
+								<view class="num-box">
+									<view class="price">
+										<text class="unit">¥</text>
+									<text class="num">{{JSON.parse(item.itemJson).price.toFixed(2)}}</text>
+									</view>
+									<view class="amount">x{{item.totalNum}}</view>
+								</view>
+							</view>
+						</view>
+						<view v-if="item.isPackage==1&&item.packageJson!=null" class="drug-item" @click="showDetail(item)">
+							<view class="img-box">
+								<image :src="JSON.parse(item.packageJson).imgUrl" mode="aspectFill"></image>
+							</view>
+							<view class="drug-info"  >
+								<view>
+									<view class="name-box ellipsis2">
+										<view class="tag">套餐</view>{{JSON.parse(item.packageJson).title}}
+									</view>
+									<view class="spec ellipsis2">{{JSON.parse(item.packageJson).descs}}</view>
+								</view>
+								<!-- <view class="num-box">
+									<view class="price">
+										<text class="unit">¥</text>
+										<text class="num">{{JSON.parse(item.packageJson).payMoney.toFixed(2)}}</text>
+									</view>
+									<view class="amount"></view>
+								</view> -->
+							</view>
+						</view>
+						<!-- 实付金额、按钮 -->
+						<view class="bottom-box">
+							<view class="amount-paid">
+								<text class="label">订单金额:</text>
+								<view class="price-box">
+									<view class="unit">¥</view>
+									<view class="num" >{{item.payPrice.toFixed(2)}}</view>
+								</view>
+							</view>
+							<view class="btn-box">
+								<view v-if="item.status == 0" class="btn cancel" @click="cancel(item)">取消订单</view>
+								<view v-if="item.status == 0" class="btn pay" @click="pay(item)">支付</view>
+								<view v-if="item.isAfterSales==1" class="btn cancel" @click="refund(item)">申请售后</view>
+								<view v-if="item.status >=2 &&item.deliveryId!=null" class="btn pay" @click.stop="showDelivery(item)">查看物流</view>
+								<view v-if="item.status == -3" class="btn cancel" @click="deleteOrder(item)">删除订单</view>
 								<!-- <view v-if="item.status==4" class="btn pay">再次购买</view> -->
 							</view>
 						</view>
@@ -108,7 +171,7 @@
 </template>
 
 <script>
-	import {getMyStoreOrderList,cancelOrder} from '@/api/storeOrder'
+	import {getMyStoreOrderList,cancelOrder,canceliveOrder, deleteOrder as deleteOrderApi, cancelLiveOrder} from '@/api/storeOrder'
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 	export default {
 		mixins: [MescrollMixin], 
@@ -155,9 +218,15 @@
 				this.mescroll.resetUpScroll()
 			},
 			refund(item) {
-				uni.navigateTo({
-					url: './refundOrderProduct?orderId='+item.id
-				})	
+				if(item.orderType==2){
+					uni.navigateTo({
+						url: '/pages_shopping/live/refundOrderProduct?orderId=' + item.orderId
+					})
+				}else{
+					uni.navigateTo({
+						url: './refundOrderProduct?orderId='+item.id
+					})	
+				}
 			},
 			// tab切换
 			orderStatusChange(item) {
@@ -201,13 +270,21 @@
 						that.mescroll.endErr();
 					}
 				});
+
 			},
 			// 查看订单详情
 			showDetail(item) {
 				console.log(item)
-				uni.navigateTo({
-					url: './storeOrderDetail?id=' + item.id
-				})
+				if(item.orderType==2){
+					uni.navigateTo({
+						url: '/pages_shopping/live/storeOrderDetail?orderId=' + item.orderId
+					})
+				}else{
+					uni.navigateTo({
+						url: './storeOrderDetail?id=' + item.id
+					})
+				}
+				
 			},
 			cancel(item){
 				var that=this;
@@ -217,9 +294,10 @@
 				    success: function (res) {
 				        if (res.confirm) {
 							var data = {
-								orderId:item.id
+								orderId:item.orderType==2?item.orderId:item.id
 							};
-							cancelOrder(data).then(res => {
+							if(item.orderType==2){
+							cancelLiveOrder(data).then(res => {
 								if(res.code==200){
 									uni.showToast({
 										icon:'success',
@@ -233,6 +311,23 @@
 									});
 								}
 							});
+							}else{
+								cancelOrder(data).then(res => {
+									if(res.code==200){
+										uni.showToast({
+											icon:'success',
+											title: "操作成功",
+										});
+										 that.mescroll.resetUpScroll()
+									}else{
+										uni.showToast({
+											icon:'none',
+											title: res.msg,
+										});
+									}
+								});
+							}
+							
 				        } 
 						else if (res.cancel) {
 							
@@ -247,16 +342,60 @@
 					});
 				}
 				else{
-					uni.navigateTo({
-						url: '/pages/shopping/paymentOrder?orderId='+item.id
-					})
+					if(item.orderType==2){
+						// 支付
+						console.log("去支付", item)
+						uni.navigateTo({
+							url: `/pages_shopping/live/paymentOrder?orderList=${encodeURIComponent(JSON.stringify(item))}`
+						})
+					}else{
+						uni.navigateTo({
+							url: '/pages/shopping/paymentOrder?orderId='+item.id
+						})
+					}
 				}
 			},
 			// 查看物流
 			showDelivery(item) {
-				uni.navigateTo({
-					url: './storeOrderDelivery?orderId='+item.id
-				})
+				if(item.orderType==2){
+					uni.navigateTo({
+						url: `/pages_shopping/live/storeOrderDelivery?orderId=${item.orderId}`
+					})
+				}else{
+					uni.navigateTo({
+						url: './storeOrderDelivery?orderId='+item.id
+					})
+				}
+			},
+			// 删除订单
+			deleteOrder(item) {
+				var that = this;
+				uni.showModal({
+					title: '提示',
+					content: '确定删除订单吗?删除后无法恢复',
+					success: function (res) {
+						if (res.confirm) {
+							var data = {
+								orderId: item.orderType == 2 ? item.orderId : item.id,
+								orderType: item.orderType
+							};
+							deleteOrderApi(data).then(res => {
+								if(res.code == 200){
+									uni.showToast({
+										icon:'success',
+										title: "删除成功",
+									});
+									that.mescroll.resetUpScroll()
+								}else{
+									uni.showToast({
+										icon:'none',
+										title: res.msg,
+									});
+								}
+							});
+						}
+					}
+				});
 			}
 			
 		}