From d68fb476c248c6c3ab974ea6b18d6bba638f12d8 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期四, 06 十一月 2025 12:35:37 +0800
Subject: [PATCH] 页面优化
---
pages/video/video-goods-detail.vue | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/pages/video/video-goods-detail.vue b/pages/video/video-goods-detail.vue
index d12c0d1..9039cc5 100644
--- a/pages/video/video-goods-detail.vue
+++ b/pages/video/video-goods-detail.vue
@@ -29,10 +29,10 @@
<script>
import {getGoodsDetail} from "@/api/video.js"
-
- import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue';
+ import { buyBack } from "@/api/trade.js";
+ import '@/components/uview-components/uview-ui';
+ import { getSessionId, userAction } from "@/api/userAction.js";
export default {
- components: {UButton},
computed: {
totalMoney() {
return this.goodsList.reduce((total, goods) => {
@@ -46,14 +46,53 @@
data() {
return {
videoId: '',
- goodsList: []
+ goodsList: [],
+ pageSessionNo:"",
+ actionParam:{
+ sessionId:'',
+ actionType:"PAGE",
+ joinType:"SELF",
+ pageCode:"RECOMMEND_VIDEO_GOODS",
+ pageParams:"{}",
+ pageStatus:"JOIN",
+ pageType:"DETAIL"
+ }
}
+ },
+ onUnload() {
+ let param = Object.assign({}, this.actionParam);
+ if (this.sendOnShow)return
+ param.pageStatus = "LEAVE"
+ userAction(param)
+ },
+ onHide() {
+ this.startHidenTime = Date.now()
+ let param = Object.assign({}, this.actionParam);
+ this.sendOnShow = true;
+ param.pageStatus = "LEAVE"
+ userAction(param)
+ },
+ onShow() {
+ getSessionId().then(res=>{
+ this.pageSessionNo = res.data.data
+ this.actionParam.sessionId = this.pageSessionNo
+ if(this.pageSessionNo){
+ let param = Object.assign({}, this.actionParam);
+ userAction(param)
+ }
+ })
},
onLoad(option) {
this.videoId = option.videoId;
+ this.actionParam.pageParams = JSON.stringify(option)
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 => {
@@ -62,7 +101,17 @@
},
// 鐢熸垚璁㈠崟-鏀粯
toPay() {
-
+ const buyList = this.goodsList.map(goods => {
+ return {
+ skuId: goods.id,
+ num: goods.goodsNum
+ }
+ })
+ buyBack(buyList).then(res => {
+ uni.navigateTo({
+ url: "/pages/order/fillorder?way=CART"
+ })
+ })
}
}
}
--
Gitblit v1.8.0