From be6df55226b155a1567ce3bac9c6d25df6c68b98 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期一, 29 九月 2025 17:21:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/user_action' into send_coupon --- api/members.js | 13 pages/kitchen/KitchenVideo.vue | 36 + api/store-coupon.js | 27 + api/userAction.js | 45 + pages/mine/activity/reportActivity.vue | 39 + pages/cart/coupon/myCoupon.vue | 35 + pages/cart/payment/success.vue | 35 + pages/health/healthVideo.vue | 37 + pages/tabbar/index/home.vue | 42 + pages/cusbar/video/video.vue | 38 + pages/mine/activity/detail.vue | 36 + pages/order/orderDetail.vue | 36 + pages/order/afterSales/afterSales.vue | 36 + pages/storeClaim/store-claim.vue | 365 ++++++++++++++ pages/video/video-goods-detail-swiper.vue | 34 + pages/cusbar/cart/cartList.vue | 39 + pages/order/fillorder.vue | 35 + pages/product/goods.vue | 42 + pages/prize/PrizeDetail/PrizeDetail.vue | 82 ++ pages.json | 23 pages/cart/payment/payOrder.vue | 36 + pages/video/video-goods-detail.vue | 37 + pages/order/afterSales/afterSalesSelect.vue | 38 + pages/order/myOrder.vue | 64 ++ pages/cart/coupon/couponCenter.vue | 38 + pages/tabbar/user/my.vue | 165 +++-- pages/order/afterSales/afterSalesDetail.vue | 37 + pages/commodity-square/commoditySquare.vue | 38 + 28 files changed, 1,429 insertions(+), 99 deletions(-) diff --git a/api/members.js b/api/members.js index c113d61..8f5c1ea 100644 --- a/api/members.js +++ b/api/members.js @@ -481,11 +481,10 @@ data:params }); } - export function bindMemberAndStore(params){ - return http.request({ - url: '/lmk/member/bindMemberAndStore', - method: Method.PUT, - data:params - }); -} + return http.request({ + url: '/lmk/member/bindMemberAndStore', + method: Method.PUT, + data:params + }); +} \ No newline at end of file diff --git a/api/store-coupon.js b/api/store-coupon.js new file mode 100644 index 0000000..b1dddb5 --- /dev/null +++ b/api/store-coupon.js @@ -0,0 +1,27 @@ +import { http, Method } from "@/utils/request.js"; + +/** + * 鏍规嵁搴楅摵浼樻儬鍒稿叧鑱擨D鑾峰彇浼樻儬鍒歌鎯� + * @param {string|number} storeCoupRef - 搴楅摵浼樻儬鍒稿叧鑱擨D + * @returns {Promise} 杩斿洖浼樻儬鍒歌鎯� + */ +export function getStoreCouponDetail(storeCoupRef) { + return http.request({ + url: `/lmk/store/coupon/${storeCoupRef}`, + method: Method.GET, + needToken: true, + }); +} + +/** + * 棰嗗彇搴楅摵浼樻儬鍒� + * @param {string|number} storeCoupRef - 搴楅摵浼樻儬鍒稿叧鑱擨D + * @returns {Promise} 杩斿洖棰嗗彇缁撴灉 + */ +export function claimStoreCoupon(storeCoupRef) { + return http.request({ + url: `/lmk/store/coupon/${storeCoupRef}`, + method: Method.POST, + needToken: true, + }); +} \ No newline at end of file diff --git a/api/userAction.js b/api/userAction.js new file mode 100644 index 0000000..40ed5e9 --- /dev/null +++ b/api/userAction.js @@ -0,0 +1,45 @@ +/** + * 娲诲姩鐩稿叧API + */ +import { http, Method } from "@/utils/request.js"; + +import api from "@/config/api.js"; + +/** + * 鑾峰彇浼氳瘽id + * + * @param params + */ + export function getSessionId() { + return http.request({ + url: "/lmk/action-record/sessionId", + method: Method.GET, + needToken: true + }); +} +/** + * 鎻掑叆鐢ㄦ埛琛屼负 + * + * @param params + */ + export function userAction(data) { + return http.request({ + url: "/lmk/action-record", + method: Method.POST, + needToken: true, + data:data + }); +} +/** + * 鍒嗕韩鍜岀偣鍑诲垎浜� + * + * @param params + */ + export function userShare(data) { + return http.request({ + url: "/lmk/action-record/share", + method: Method.POST, + needToken: true, + data:data + }); +} diff --git a/pages.json b/pages.json index 080939b..ebbcf32 100644 --- a/pages.json +++ b/pages.json @@ -198,6 +198,7 @@ // "path": "pages/tabbar/user/my", // "style": { // "navigationBarTextStyle": "white", + // "navigationBarTextStyle": "white", // "enablePullDownRefresh": true, // "navigationStyle": "custom", // "componentPlaceholder": { @@ -2247,7 +2248,27 @@ } } ] - } + }, + { + "root": "pages/storeClaim", + "pages": [{ + "path" : "store-claim", + "style" : + { + "navigationBarTitleText" : "浼樻儬鍗烽鍙�", + "componentPlaceholder":{ + "u-card": "view", + "u-navbar": "view", + "u-tag": "view", + "u-icon": "view", + "u-button": "view", + "u-empty": "view" + + } + } + }] + } + ], "globalStyle": { "navigationBarTextStyle": "black", diff --git a/pages/cart/coupon/couponCenter.vue b/pages/cart/coupon/couponCenter.vue index 958c482..78a8618 100644 --- a/pages/cart/coupon/couponCenter.vue +++ b/pages/cart/coupon/couponCenter.vue @@ -54,6 +54,7 @@ import { getAllCoupons } from "@/api/promotions.js"; + import { getSessionId, userAction } from "@/api/userAction.js"; export default { data() { return { @@ -65,10 +66,45 @@ pageSize: 10, }, storeId: "", //搴楅摵 id, - couponData: "" + couponData: "", + sendOnShow:false, + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"COUPON_CENTER", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } }; }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, onLoad(option) { + this.actionParam.pageParams = JSON.stringify(option) this.storeId = option.storeId; this.getCoupon(); }, diff --git a/pages/cart/coupon/myCoupon.vue b/pages/cart/coupon/myCoupon.vue index afacc3b..b99614f 100644 --- a/pages/cart/coupon/myCoupon.vue +++ b/pages/cart/coupon/myCoupon.vue @@ -126,6 +126,7 @@ import '@/components/uview-components/uview-ui'; import { getMemberCoupons } from "@/api/members.js"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { data() { @@ -171,10 +172,44 @@ }, ], couponList: [], //浼樻儬鍒稿垪琛� + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"MY_COUPON", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } }; }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) + }, onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) this.navList[this.tabCurrentIndex].params.pageNumber = 1; this.navList[this.tabCurrentIndex].dataList = []; this.getData(); diff --git a/pages/cart/payment/payOrder.vue b/pages/cart/payment/payOrder.vue index f1c642f..a965b8c 100644 --- a/pages/cart/payment/payOrder.vue +++ b/pages/cart/payment/payOrder.vue @@ -46,6 +46,7 @@ import '@/components/uview-components/uview-ui' import * as API_Trade from "@/api/trade"; import {payCallback} from '@/api/members' + import { getSessionId, userAction } from "@/api/userAction.js"; export default { data() { return { @@ -71,12 +72,45 @@ walletValue: 0.0, // 鏀粯鍊掕鏃� autoCancel: 0, + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"PAY_ORDER", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, onLoad(val) { this.routerVal = val; - + this.actionParam.pageParams = JSON.stringify(val) //鍒濆鍖栧弬鏁� // #ifdef APP-PLUS this.paymentType = "APP"; diff --git a/pages/cart/payment/success.vue b/pages/cart/payment/success.vue index 9b16e07..46e78aa 100644 --- a/pages/cart/payment/success.vue +++ b/pages/cart/payment/success.vue @@ -54,6 +54,7 @@ </template> <script> // import goodsRecommend from "@/pages/cart/m-goods-recommend/index.vue"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { data() { return { @@ -64,6 +65,16 @@ payPrice: 0, goodsList: [], activeColor: this.$mainColor, + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"PAY_SUCCESS", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, // components: { @@ -83,7 +94,31 @@ } }, }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) this.paymentMethod = options.paymentMethod || ""; this.from = options.from || ""; this.payPrice = options.payPrice || 0; diff --git a/pages/commodity-square/commoditySquare.vue b/pages/commodity-square/commoditySquare.vue index 3d23697..0601ad1 100644 --- a/pages/commodity-square/commoditySquare.vue +++ b/pages/commodity-square/commoditySquare.vue @@ -100,6 +100,7 @@ <script> import TopBar from "@/components/TopBar.vue"; + import { getSessionId, userAction } from "@/api/userAction.js"; import { getCategoryList, getGoodsList, @@ -155,6 +156,17 @@ order: 'asc', sort: 'goodsSort' }, + pageSessionNo:"", + sendOnShow:false, + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"SHOPPING_SQUARE", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } } }, methods: { @@ -413,8 +425,32 @@ console.log(this.maxPages) } }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, + async onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) - async onLoad() { await this.getCartList(); // 鑾峰彇鐘舵�佹爮楂樺害 const systemInfo = uni.getSystemInfoSync(); diff --git a/pages/cusbar/cart/cartList.vue b/pages/cusbar/cart/cartList.vue index da6bd4a..594c272 100644 --- a/pages/cusbar/cart/cartList.vue +++ b/pages/cusbar/cart/cartList.vue @@ -188,6 +188,7 @@ import '@/components/uview-components/uview-ui'; import * as API_Trade from "@/api/trade"; import { debounce } from "@/utils/tools.js"; +import { getSessionId, userAction } from "@/api/userAction.js"; // import uniNumberBox from '@/components/uni-number-box' export default { data() { @@ -220,7 +221,18 @@ checkout: false, //鍏ㄩ�夋寜閽� WEIXIN_num: "", //璐墿杞﹀吋瀹瑰井淇℃杩涘櫒 marginBottom: 0 ,// 搴曢儴瀹夊叏鍖哄煙 - windowHeight: 0 // 鍙娇鐢ㄥ睆骞曢珮搴� + windowHeight: 0 ,// 鍙娇鐢ㄥ睆骞曢珮搴� + pageSessionNo:"", + sendOnShow:false, + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"CART_LIST", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, @@ -235,10 +247,35 @@ onPullDownRefresh(){ this.getCardData(); }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) + + }, /** * 鍒濆鍖栦俊鎭� */ onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) this.deleteShow ? (this.deleteShow = false) : true; this.getCardData(); // if (this.$refs.swiperAction) { diff --git a/pages/cusbar/video/video.vue b/pages/cusbar/video/video.vue index 68065a6..4faf326 100644 --- a/pages/cusbar/video/video.vue +++ b/pages/cusbar/video/video.vue @@ -213,6 +213,7 @@ import { getRecommendTag3 } from "@/api/video-tag.js"; import { getFileKey } from "@/utils/file.js"; import { getVideoGoodsList } from "@/api/goods.js"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { components: {MyTag}, @@ -267,7 +268,17 @@ screenWidth: 375, gap: 10, // 鍥剧墖闂磋窛 windowHeight: 0, - marginBottom: 0 + marginBottom: 0, + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"PUBLISH_VIDEO", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } }; }, computed: { @@ -288,7 +299,22 @@ return (this.screenWidth - (this.gap * 4) - 20) / 3 } }, - onLoad() { + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) + // 鑾峰彇灞忓箷瀹藉害 const systemInfo = uni.getSystemInfoSync() this.screenWidth = systemInfo.windowWidth @@ -299,6 +325,14 @@ this.getVideoGoodsByEs() }, onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) this.initCOS() // 鍒濆鍖栨帹鑽愭爣绛� this.getRecommendTags() diff --git a/pages/health/healthVideo.vue b/pages/health/healthVideo.vue index 4b17775..cb9bc81 100644 --- a/pages/health/healthVideo.vue +++ b/pages/health/healthVideo.vue @@ -264,6 +264,7 @@ import { silentLogin } from "@/api/connect.js"; import { getUserInfo } from "@/api/members"; import storage from "@/utils/storage.js"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { components: {TopBar}, computed: { @@ -353,10 +354,28 @@ similarlyNomore: false, // 鏄惁杩樻湁鏇村鐩镐技瑙嗛 similaryVideoIndex: 0, // 鐩镐技瑙嗛鐨勬挱鏀句綅缃� similarlyLoading: false, // 鐩镐技瑙嗛鍔犺浇 - marginBottom: 0 // 搴曢儴瀹夊叏鍖哄煙 + marginBottom: 0 ,// 搴曢儴瀹夊叏鍖哄煙 + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"HEALTH_VIDEO", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } } }, onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) // const token = storage.getAccessToken(); // if (! token) { // this.wxSilentLogin(() => { @@ -371,8 +390,18 @@ this.totalHidenTime += duration } }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, onHide() { - this.startHidenTime = Date.now() + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) }, onLoad(option) { this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom @@ -392,12 +421,16 @@ queryParam.shareType = shareType queryParam.source = source console.log('瑙f瀽鍙傛暟:', { shareType, videoId,source }); + this.actionParam.pageParams = JSON.stringify(params) + this.actionParam.joinType = 'SHARE' } const token = storage.getAccessToken(); if (! token) { this.wxSilentLogin(() => { // 鍒ゆ柇鏄笉鏄偣鍑诲垎浜摼鎺ヨ繘鏉ョ殑 if (option.userId && option.videoId) { + this.actionParam.pageParams = JSON.stringify(option) + this.actionParam.joinType = 'SCAN' queryParam.videoId = option.videoId // 淇濆瓨鍒嗕韩鐐瑰嚮璁板綍 saveShareClickRecord({refId: option.videoId, shareUserId: option.userId}) diff --git a/pages/kitchen/KitchenVideo.vue b/pages/kitchen/KitchenVideo.vue index f69b41b..a2b54e4 100644 --- a/pages/kitchen/KitchenVideo.vue +++ b/pages/kitchen/KitchenVideo.vue @@ -285,7 +285,7 @@ } from "@/api/collect.js"; import { saveShare, saveShareClickRecord } from "@/api/share.js"; import storage from "@/utils/storage.js"; - +import { getSessionId, userAction } from "@/api/userAction.js"; export default { computed: { hasPlayTime() { @@ -387,10 +387,28 @@ similarlyNomore: false, // 鏄惁杩樻湁鏇村鐩镐技瑙嗛 similaryVideoIndex: 0, // 鐩镐技瑙嗛鐨勬挱鏀句綅缃� similarlyLoading: false, // 鐩镐技瑙嗛鍔犺浇 - marginBottom: 0 // 搴曢儴瀹夊叏鍖哄煙 + marginBottom: 0 ,// 搴曢儴瀹夊叏鍖哄煙 + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"KITCHEN_VIDEO", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } } }, onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) // this.showDrawer('showLeft') this.loadVideos() // 濡傛灉瑙嗛鎸変笅鏆傚仠鍚庡垏鎹㈤〉闈㈠啀鍥炲埌椤甸潰鏃讹紝鍙畻鏆傚仠鏃堕棿锛堝洜涓烘殏鍋滄椂闂村拰绂诲紑椤甸潰鏃堕棿鏄噸澶嶇殑锛屽彧绠椾竴涓級 @@ -399,8 +417,18 @@ this.totalHidenTime += duration } }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, onHide() { this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) }, onLoad(option) { this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom; @@ -429,12 +457,16 @@ queryParam.shareType = shareType queryParam.source = source console.log('瑙f瀽鍙傛暟:', { shareType, videoId,source }); + this.actionParam.pageParams = JSON.stringify(params) + this.actionParam.joinType = 'SHARE' } const token = storage.getAccessToken(); if(!token){ this.wxSilentLogin(() => { // 鍒ゆ柇鏄笉鏄偣鍑诲垎浜摼鎺ヨ繘鏉ョ殑 if (option.userId && option.videoId) { + this.actionParam.pageParams = JSON.stringify(option) + this.actionParam.joinType = 'SCAN' queryParam.videoId = option.videoId // 淇濆瓨鍒嗕韩鐐瑰嚮璁板綍 saveShareClickRecord({refId: option.videoId, shareUserId: option.userId}) diff --git a/pages/mine/activity/detail.vue b/pages/mine/activity/detail.vue index f05c52c..fe8b328 100644 --- a/pages/mine/activity/detail.vue +++ b/pages/mine/activity/detail.vue @@ -75,6 +75,7 @@ getActivityDetail, activityReport } from '@/api/activity.js'; + import { getSessionId, userAction } from "@/api/userAction.js"; export default { data() { return { @@ -103,9 +104,44 @@ collectType: '', refId: '', }, + pageSessionNo:"", + sendOnShow:false, + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"ACTIVITY_DETAIL", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) // 鎺ユ敹 URL 鍙傛暟 if (options.id) { this.detailId = options.id; diff --git a/pages/mine/activity/reportActivity.vue b/pages/mine/activity/reportActivity.vue index 5741ab1..adc28a9 100644 --- a/pages/mine/activity/reportActivity.vue +++ b/pages/mine/activity/reportActivity.vue @@ -55,6 +55,7 @@ import TopBar from "@/components/TopBar.vue"; import '@/components/uview-components/uview-ui'; import {getActivityReportList} from '@/api/activity.js'; + import { getSessionId, userAction } from "@/api/userAction.js"; export default { components: {TopBar}, data() { @@ -75,10 +76,44 @@ }, loading: false, // 鏄惁姝e湪鍔犺浇 noMore: false, // 鏄惁娌℃湁鏇村鏁版嵁 - total: 0 // 鎬绘暟鎹噺 + total: 0 ,// 鎬绘暟鎹噺 + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"ACTIVITY_LIST", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } }; }, - onLoad() { + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, + onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) this.getActivityList(); }, methods: { diff --git a/pages/order/afterSales/afterSales.vue b/pages/order/afterSales/afterSales.vue index 31d504e..e5f2973 100644 --- a/pages/order/afterSales/afterSales.vue +++ b/pages/order/afterSales/afterSales.vue @@ -204,6 +204,7 @@ import { getAfterSaleList, cancelAfterSale } from "@/api/after-sale.js"; import { getOrderList } from "@/api/order.js"; import storage from "@/utils/storage"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { @@ -240,9 +241,44 @@ }, status: "loadmore", keywords: "", // 鎼滅储璁㈠崟sn + pageSessionNo:"", + sendOnShow:false, + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"AFTER_SALE", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } }; }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) this.orderList = []; this.params.pageNumber = 1; if (options.orderSn) this.params.keywords = options.orderSn; diff --git a/pages/order/afterSales/afterSalesDetail.vue b/pages/order/afterSales/afterSalesDetail.vue index a157028..ca1a226 100644 --- a/pages/order/afterSales/afterSalesDetail.vue +++ b/pages/order/afterSales/afterSalesDetail.vue @@ -108,6 +108,7 @@ import { upload } from "@/api/common.js"; import { checkBankno } from "@/utils/Foundation"; import storage from "@/utils/storage.js"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { component: { city, @@ -169,13 +170,47 @@ refundWay: "", serviceType: "", //鐢宠绫诲瀷 }, + pageSessionNo:"", + sendOnShow:false, + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"REFUND_ORDER", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, - + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, /** * 鍒ゆ柇褰撳墠鍐呭骞剁敓鎴愭暟鎹� */ onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) let navTitle = "鐢宠鍞悗"; this.form.serviceType = "RETURN_GOODS"; if (options.value == 1) { diff --git a/pages/order/afterSales/afterSalesSelect.vue b/pages/order/afterSales/afterSalesSelect.vue index a10e5b8..ceb4a8b 100644 --- a/pages/order/afterSales/afterSalesSelect.vue +++ b/pages/order/afterSales/afterSalesSelect.vue @@ -58,15 +58,51 @@ import '@/components/uview-components/uview-ui' import { getAfterSaleInfo } from "@/api/after-sale"; import storage from "@/utils/storage"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { data() { return { sn: "", sku: {}, //sku - applyInfo:"" + applyInfo:"", + pageSessionNo:"", + sendOnShow:false, + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"APPLY_SALE", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } }; }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) this.sn = options.sn; this.sku = storage.getAfterSaleData(); // 鏌ョ湅褰撳墠鍟嗗搧鏄惁鏀寔閫�娆鹃��璐� diff --git a/pages/order/fillorder.vue b/pages/order/fillorder.vue index 667add2..f5c108f 100644 --- a/pages/order/fillorder.vue +++ b/pages/order/fillorder.vue @@ -400,9 +400,11 @@ import LiLiWXPay from "@/js_sdk/lili-pay/wx-pay.js"; import invoices from "@/pages/order/invoice/setInvoice"; import { mapState } from "vuex"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { onLoad: function (val) { this.routerVal = val; + this.actionParam.pageParams = JSON.stringify(val) }, components: { invoices, @@ -454,6 +456,17 @@ storeAddress: "", originOrderData:"", // 鍘熷璁㈠崟鏁版嵁 + pageSessionNo:"", + sendOnShow:false, + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"FILL_ORDER", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, watch: { @@ -516,8 +529,28 @@ return true; //闃绘榛樿杩斿洖琛屼负 } }, - + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, async onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) // 鍒ゆ柇鏄惁瀛樺湪鍐欒繃澶囨敞淇℃伅鐨勫晢鍝� if (this.remark && this.remark.length > 0) { this.remarkFlag = true; diff --git a/pages/order/myOrder.vue b/pages/order/myOrder.vue index 7e00d25..41f5961 100644 --- a/pages/order/myOrder.vue +++ b/pages/order/myOrder.vue @@ -175,6 +175,14 @@ </u-button> --> </view> </view> + <view style="display: flex;justify-content: space-around;"> + <view class="" @click="callPhone"> + 瀹㈡湇鐑嚎: 028-84472936 + </view> + <view class="" @click="copyToClipboard"> + 瀹㈡湇寰俊: meiyikuang + </view> + </view> </view> </view> <uni-load-more :status="tabItem.loadStatus"></uni-load-more> @@ -241,6 +249,7 @@ import { getClearReason } from "@/api/after-sale.js"; import LiLiWXPay from "@/js_sdk/lili-pay/wx-pay.js"; import {buyBack} from "@/api/trade.js"; +import { getSessionId, userAction } from "@/api/userAction.js"; export default { data() { @@ -327,6 +336,16 @@ reason: "", //鍙栨秷鍘熷洜 cancelList: "", //鍙栨秷鍒楄〃 rogShow: false, //鏄剧ず鏄惁鏀惰揣 + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"ORDER_LIST", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, @@ -349,7 +368,28 @@ } // this.loadData(this.status); }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) if(this.$options.filters.tipsToLogin()){ if (!this.tabCurrentIndex) { this.initData(0); @@ -359,6 +399,7 @@ }, onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) /** * 淇app绔偣鍑婚櫎鍏ㄩ儴璁㈠崟澶栫殑鎸夐挳杩涘叆鏃朵笉鍔犺浇鏁版嵁鐨勯棶棰� * 鏇挎崲onLoad涓嬩唬鐮佸嵆鍙� @@ -386,6 +427,29 @@ }, }, methods: { + copyToClipboard(){ + uni.setClipboardData({ + data:'meiyikuang', + success() { + uni.showToast({ + title: '澶嶅埗鎴愬姛', + icon: 'none' + }) + } + }) + }, + callPhone(){ + uni.showModal({ + title:'纭鑱旂郴瀹㈡湇鍚�?', + success(e) { + if(e.confirm){ + uni.makePhoneCall({ + phoneNumber:'028-84472936' + }) + } + } + }) + }, openCouponPackage(order){ console.log(order) uni.navigateTo({ diff --git a/pages/order/orderDetail.vue b/pages/order/orderDetail.vue index 4d2873f..5d5e5cc 100644 --- a/pages/order/orderDetail.vue +++ b/pages/order/orderDetail.vue @@ -270,7 +270,7 @@ import shares from "@/pages/order/m-share/index.vue"; //鍒嗕韩 import { getClearReason } from "@/api/after-sale.js"; - +import { getSessionId, userAction } from "@/api/userAction.js"; export default { components: { shares, @@ -325,9 +325,43 @@ orderPackage:"", //鍟嗗搧淇℃伅鍐嶆潵涓�鍗曚娇鐢� skuList:[], + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"ORDER_DETAIL", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) this.loadData(options.sn); this.sn = options.sn; }, diff --git a/pages/prize/PrizeDetail/PrizeDetail.vue b/pages/prize/PrizeDetail/PrizeDetail.vue index 6e2bba5..165273c 100644 --- a/pages/prize/PrizeDetail/PrizeDetail.vue +++ b/pages/prize/PrizeDetail/PrizeDetail.vue @@ -148,6 +148,8 @@ </template> <script> import bgConfig from '@/pages/prize/PrizeDetail/prize-bgConfig.js' + import { getSessionId, userAction ,userShare } from "@/api/userAction.js"; + import { prizeInfo, prizeNum, @@ -212,7 +214,23 @@ shareTimelineAttempt: false, activityCover: '', activityName: '', - couponId: '' + couponId: '', + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"PRIZE_DETAIL", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + }, + shareParam:{ + pageCode:"PRIZE_DETAIL", + shareOption:"{}", + pageType:"DETAIL" + }, + shareId:'', }; }, computed: { @@ -221,7 +239,38 @@ return [...this.originalWinners] } }, + 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 = res.data.data + if(this.pageSessionNo){ + let param = Object.assign({}, this.actionParam); + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, async onLoad(option) { + if(option.shareId){ + this.actionParam.shareId = option.shareId; + this.actionParam.joinType = 'SHARE' + console.log('瑙﹀彂onLoad') + } + this.actionParam.pageParams = JSON.stringify(option) + const pages = getCurrentPages() console.log('================pages ', pages) this.activityId = option.id @@ -266,17 +315,38 @@ // this.startAutoScroll() }, onShareAppMessage() { - return { + // 杩斿洖涓�涓狿romise + return new Promise((resolve) => { + this.shareId = ''; + this.shareParam.shareOption = JSON.stringify({ + id:this.activityId + }) + userShare(this.shareParam).then(res => { + this.shareId = res.data.data; + console.log('------------------1銆�', this.shareId); + + // 褰撹幏鍙栧埌shareId鍚庯紝鍐峳esolve鍒嗕韩閰嶇疆 + resolve({ title: this.activityName, - path: '/pages/prize/PrizeDetail/PrizeDetail?id=' + this.activityId, + path: '/pages/prize/PrizeDetail/PrizeDetail?id=' + this.activityId + '&shareId=' + this.shareId, imageUrl: this.activityCover, success(e) { - console.log("鍒嗕韩鎴愬姛", e) + console.log("鍒嗕韩鎴愬姛", e); }, fail(e) { - console.log('鍒嗕韩澶辫触', e) + console.log('鍒嗕韩澶辫触', e); } - } + }); + }).catch(err => { + // 澶勭悊閿欒鎯呭喌锛屼緥濡備娇鐢ㄩ粯璁ゅ弬鏁� + console.error('鑾峰彇鍒嗕韩ID澶辫触', err); + resolve({ + title: this.activityName, + path: '/pages/prize/PrizeDetail/PrizeDetail?id=' + this.activityId, + imageUrl: this.activityCover + }); + }); + }); }, beforeDestroy() { this.stopAutoScroll() diff --git a/pages/product/goods.vue b/pages/product/goods.vue index e74e3dc..94fd6cd 100644 --- a/pages/product/goods.vue +++ b/pages/product/goods.vue @@ -305,6 +305,7 @@ import popups from "@/pages/product/popups/popups.vue"; //姘旀场妗� import takeDownFormSaleGoods from "@/pages/product/m-take-down-sale-goods/index.vue"; //涓嬫灦妗� import setup from "./product/popup/popup"; +import { getSessionId, userAction } from "@/api/userAction.js"; import { getSTSToken } from '@/api/common.js' @@ -444,6 +445,23 @@ IMLink: "", // IM鍦板潃 wholesaleList: [], takeDownFromSale: false, // 涓嬫灦閿�鍞姸鎬� + pageSessionNo:"", + sendOnShow:false, + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"GOODS_DETAILS", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL", + shareId:null, + }, + shareParam:{ + pageCode:"GOODS_DETAILS", + shareOption:"{}", + pageType:"DETAIL" + } }; }, @@ -512,8 +530,11 @@ queryParam.id = id; queryParam.goodsId = gooodsId; this.routerVal = queryParam; + this.actionParam.pageParams = JSON.stringify(params) + this.actionParam.joinType = 'SCAN' }else{ this.routerVal = options; + this.actionParam.pageParams = JSON.stringify(options) } console.log('鎵撳嵃淇℃伅') console.log(options) @@ -527,7 +548,28 @@ }); // #endif }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, async onShow () { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) this.goodsDetail = {}; //濡傛灉鏈夊弬鏁癷ds璇存槑浜嬪垎閿�鐭繛鎺ワ紝闇�瑕佽幏鍙栧弬鏁� if (this.routerVal.scene) { diff --git a/pages/storeClaim/store-claim.vue b/pages/storeClaim/store-claim.vue new file mode 100644 index 0000000..aebe6d2 --- /dev/null +++ b/pages/storeClaim/store-claim.vue @@ -0,0 +1,365 @@ +<template> + <view class="container"> + <!-- 浼樻儬鍒稿崱鐗� --> + <view class="coupon-card" v-if="couponInfo.storeCoupRef"> + <u-card :border="false" :head-style="{ padding: '30rpx' }" :body-style="{ padding: '0 30rpx 30rpx' }"> + <!-- 澶撮儴锛氬簵閾轰俊鎭� --> + <view slot="head" class="card-head"> + <view class="store-info"> + <u-icon name="home" size="36" color="#999"></u-icon> + <text class="store-name">{{ couponInfo.storeName }}</text> + </view> + <u-tag v-if="couponInfo.claimStatus === 'NOT_CLAIM'" text="鏈鍙�" type="warning" mode="plain" size="mini" /> + <u-tag v-else-if="couponInfo.claimStatus === 'CLAIM'" text="宸查鍙�" type="success" mode="plain" size="mini" /> + <u-tag v-else text="宸茶繃鏈�" type="info" mode="plain" size="mini" /> + </view> + + <!-- 涓讳綋锛氫紭鎯犲埜淇℃伅 --> + <view slot="body" class="card-body"> + <view class="coupon-title"> + <text class="title">{{ couponInfo.couponName }}</text> + <text class="coupon-no">缂栧彿锛歿{ couponInfo.couponNo }}</text> + </view> + + <view class="coupon-desc" v-if="couponInfo.couponDesc"> + <text class="desc">{{ couponInfo.couponDesc }}</text> + </view> + + <view class="coupon-rule" v-if="couponInfo.couponRule"> + <text class="rule-title">浣跨敤瑙勫垯锛�</text> + <text class="rule-content">{{ couponInfo.couponRule }}</text> + </view> + + <view class="coupon-time" v-if="couponInfo.startTime && couponInfo.endTime"> + <u-icon name="clock" size="28" color="#999"></u-icon> + <text class="time-text">鏈夋晥鏈燂細{{ formatDate(couponInfo.startTime) }} 鑷� {{ formatDate(couponInfo.endTime) }}</text> + </view> + + <view class="coupon-condition" v-if="couponInfo.consumeThreshold > 0"> + <u-icon name="coupon" size="28" color="#999"></u-icon> + <text class="condition-text">婊{ formatAmount(couponInfo.consumeThreshold) }}鍏冨彲鐢�</text> + </view> + </view> + + <!-- 搴曢儴锛氭搷浣滄寜閽� --> + <view slot="foot" class="card-foot"> + <u-button + :type="couponInfo.claimStatus === 'NOT_CLAIM' ? 'primary' : 'default'" + :disabled="couponInfo.claimStatus !== 'NOT_CLAIM'" + :loading="loading" + @click="claimCoupon" + :ripple="true" + :hair-line="false" + > + {{ couponInfo.claimStatus === 'NOT_CLAIM' ? '绔嬪嵆棰嗗彇' : couponInfo.claimStatus === 'CLAIM' ? '宸查鍙�' : '宸茶繃鏈�' }} + </u-button> + </view> + </u-card> + </view> + + <!-- 绌虹姸鎬� --> + <view class="empty-state" v-else> + <u-empty text="浼樻儬鍒镐俊鎭笉瀛樺湪" mode="coupon" :icon-size="200"></u-empty> + </view> + + <!-- 浣跨敤璇存槑 --> + <view class="instructions"> + <view class="instructions-title"> + <u-icon name="info-circle" size="28" color="#999"></u-icon> + <text class="title-text">浣跨敤璇存槑</text> + </view> + <view class="instructions-content"> + <text class="content-text">1. 浼樻儬鍒镐粎闄愬湪鎸囧畾搴楅摵浣跨敤\n2. 姣忎釜鐢ㄦ埛闄愰涓�寮燶n3. 浼樻儬鍒镐笉鍙厬鎹㈢幇閲慭n4. 璇峰湪鏈夋晥鏈熷唴浣跨敤</text> + </view> + </view> + + <!-- 绌虹櫧鍗犱綅 --> + <view class="placeholder"></view> + </view> +</template> + +<script> + import { getStoreCouponDetail, claimStoreCoupon } from '@/api/store-coupon.js'; + import { formatPrice } from '@/utils/Foundation.js'; + + export default { + data() { + return { + loading: false, + storeCoupRef: '', // 搴楅摵浼樻儬鍒稿叧鑱擨D + couponInfo: { + id: "", + storeCoupRef: "", + storeId: "", + storeName: "", + couponId: "", + couponName: "", + couponNo: "", + couponAmount: 0, // 浼樻儬閲戦 + couponDesc: "", // 浼樻儬鍒告弿杩� + couponRule: "", // 浣跨敤瑙勫垯 + startTime: "", // 寮�濮嬫椂闂� + endTime: "", // 缁撴潫鏃堕棿 + consumeThreshold: 0, // 娑堣垂闂ㄦ + claimStatus: "NOT_CLAIM", // 棰嗗彇鐘舵�� + } + } + }, + onShow() { + this.getCouponDetail(this.storeCoupRef); + }, + onLoad(options) { + // 鑾峰彇浼犻�掔殑搴楅摵浼樻儬鍒稿叧鑱擨D + if (options.storeCoupRef) { + this.storeCoupRef = options.storeCoupRef; + this.getCouponDetail(options.storeCoupRef); + } else if (options.id) { + // 鍏煎鏃у弬鏁� + this.storeCoupRef = options.id; + this.getCouponDetail(options.id); + }else if(options.q){ + // 鍙岄噸瑙g爜锛氬井淇″URL杩涜浜嗕袱娆$紪鐮� + const decodedUrl = decodeURIComponent(decodeURIComponent(options.q)); + console.log('鍘熷URL:', decodedUrl); + + // 瑙f瀽URL涓殑鏌ヨ鍙傛暟 + const params = this.parseUrlParams(decodedUrl); + this.storeCoupRef = params.id; + this.getCouponDetail(this.storeCoupRef); + } + else { + this.$u.toast('鍙傛暟閿欒'); + } + }, + methods: { + // 瑙f瀽URL鍙傛暟 + parseUrlParams(url) { + const params = {}; + // 澶勭悊鍙兘瀛樺湪鐨刪ash锛堝鏋滄湁鐨勮瘽锛� + 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; + }, + // 鏍煎紡鍖栭噾棰� + formatAmount(amount) { + if (!amount) return '0'; + return formatPrice(parseFloat(amount)); + }, + + // 鏍煎紡鍖栨棩鏈� + formatDate(dateStr) { + if (!dateStr) return ''; + return dateStr.split(' ')[0]; + }, + + // 鑾峰彇浼樻儬鍒歌鎯� + async getCouponDetail(storeCoupRef) { + uni.showLoading({ + title: '鍔犺浇涓�...' + }); + + try { + const res = await getStoreCouponDetail(storeCoupRef); + console.log(JSON.stringify(res)) + if (res.data.code === 200) { + this.couponInfo = { + ...this.couponInfo, + ...res.data.data, + couponAmount: res.data.data.couponAmount || 0, + consumeThreshold: res.data.data.consumeThreshold || 0 + }; + } else { + this.$u.toast(res.data.message || '鑾峰彇浼樻儬鍒歌鎯呭け璐�'); + } + } catch (err) { + this.$u.toast('鑾峰彇浼樻儬鍒歌鎯呭け璐ワ紝璇风◢鍚庨噸璇�'); + console.error('鑾峰彇浼樻儬鍒歌鎯呭け璐�:', err); + } finally { + uni.hideLoading(); + } + }, + + // 棰嗗彇浼樻儬鍒� + async claimCoupon() { + if (this.couponInfo.claimStatus !== 'NOT_CLAIM') { + return; + } + + // 纭棰嗗彇 + uni.showModal({ + title: '鎻愮ず', + content: `纭畾瑕侀鍙�"${this.couponInfo.couponName}"浼樻儬鍒稿悧锛焋, + success: (res) => { + if (res.confirm) { + this.doClaimCoupon(); + } + } + }); + }, + + // 鎵ц棰嗗彇浼樻儬鍒告搷浣� + async doClaimCoupon() { + this.loading = true; + try { + // 璋冪敤棰嗗彇浼樻儬鍒告帴鍙� + const res = await claimStoreCoupon(this.storeCoupRef); + if (res.data.code === 200) { + this.$u.toast('棰嗗彇鎴愬姛'); + this.couponInfo.claimStatus = 'CLAIM'; + + // 寤惰繜杩斿洖涓婁竴椤碉紝璁╃敤鎴风湅鍒伴鍙栨垚鍔熺殑鎻愮ず + setTimeout(() => { + uni.navigateBack(); + }, 1500); + } else { + this.$u.toast(res.data.message || '棰嗗彇澶辫触'); + } + } catch (err) { + this.$u.toast('棰嗗彇澶辫触锛岃绋嶅悗閲嶈瘯'); + console.error('棰嗗彇浼樻儬鍒稿け璐�:', err); + } finally { + this.loading = false; + } + } + } + } +</script> + +<style lang="scss" scoped> +.container { + background-color: #f5f5f5; + min-height: 100vh; +} + +.coupon-card { + margin: 20rpx; +} + +.card-head { + display: flex; + justify-content: space-between; + align-items: center; +} + +.store-info { + display: flex; + align-items: center; +} + +.store-name { + margin-left: 10rpx; + font-size: 32rpx; + font-weight: bold; + color: #333; +} + +.card-body { + padding-top: 20rpx; +} + +.coupon-title { + margin-bottom: 30rpx; + display: flex; + align-items: center; + flex-wrap: wrap; +} + +.title { + font-size: 36rpx; + font-weight: bold; + color: #333; +} + +.coupon-no { + font-size: 24rpx; + color: #999; + margin-left: 20rpx; +} + +.coupon-desc { + margin-bottom: 30rpx; +} + +.desc { + font-size: 28rpx; + color: #666; +} + +.coupon-rule { + margin-bottom: 30rpx; +} + +.rule-title { + font-size: 28rpx; + color: #333; + font-weight: bold; +} + +.rule-content { + font-size: 26rpx; + color: #666; +} + +.coupon-time, .coupon-condition { + display: flex; + align-items: center; + margin-bottom: 20rpx; +} + +.time-text, .condition-text { + font-size: 24rpx; + color: #999; + margin-left: 10rpx; +} + +.card-foot { + padding: 20rpx 0; +} + +.instructions { + background-color: #ffffff; + margin: 20rpx; + padding: 30rpx; + border-radius: 16rpx; +} + +.instructions-title { + display: flex; + align-items: center; + margin-bottom: 20rpx; +} + +.title-text { + margin-left: 10rpx; + font-size: 30rpx; + font-weight: bold; + color: #333; +} + +.instructions-content { + padding-left: 40rpx; +} + +.content-text { + font-size: 26rpx; + color: #666; + line-height: 1.6; +} + +.placeholder { + height: 40rpx; +} + +.empty-state { + margin-top: 200rpx; +} +</style> \ No newline at end of file diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue index 23cbbdf..8a4ae99 100644 --- a/pages/tabbar/index/home.vue +++ b/pages/tabbar/index/home.vue @@ -266,6 +266,7 @@ import { setPopupRedisTime, getPopupAcitivty } from '@/api/popup.js' import { changeCollect } from "@/api/collect.js"; import { saveShare, saveShareClickRecord } from "@/api/share.js"; +import { getSessionId, userAction } from "@/api/userAction.js"; import { silentLogin } from "@/api/connect.js"; import { getUserInfo } from "@/api/members"; import storage from "@/utils/storage.js"; @@ -368,10 +369,28 @@ similarlyNomore: false, // 鏄惁杩樻湁鏇村鐩镐技瑙嗛 similaryVideoIndex: 0, // 鐩镐技瑙嗛鐨勬挱鏀句綅缃� similarlyLoading: false, // 鐩镐技瑙嗛鍔犺浇 - marginBottom: 0 // 搴曢儴瀹夊叏鍖哄煙 + marginBottom: 0 ,// 搴曢儴瀹夊叏鍖哄煙 + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"RECOMMEND_VIDEO", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } } }, onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) this.openActivityPopup() @@ -399,9 +418,19 @@ this.totalHidenTime += duration } }, - onHide() { - this.startHidenTime = Date.now() - }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, onLoad(option) { console.log('-----------鍒嗕韩鍑虹殑鏁版嵁---------->', option) @@ -419,6 +448,9 @@ const shareType = params.shareType; const videoId = params.videoId; queryParam.videoId = videoId + this.actionParam.joinType = "SCAN"; + this.actionParam.pageParams = JSON.stringify(params); + console.log('瑙f瀽鍙傛暟:', { shareType, videoId }); } const token = storage.getAccessToken(); @@ -426,6 +458,8 @@ this.wxSilentLogin(() => { // 鍒ゆ柇鏄笉鏄偣鍑诲垎浜摼鎺ヨ繘鏉ョ殑 if (option.userId && option.videoId) { + this.actionParam.joinType = "SHARE"; + this.actionParam.pageParams = JSON.stringify(option); queryParam.videoId = option.videoId // 淇濆瓨鍒嗕韩鐐瑰嚮璁板綍 saveShareClickRecord({ refId: option.videoId, shareUserId: option.userId }) diff --git a/pages/tabbar/user/my.vue b/pages/tabbar/user/my.vue index 20ff12d..d3b8b31 100644 --- a/pages/tabbar/user/my.vue +++ b/pages/tabbar/user/my.vue @@ -144,6 +144,7 @@ import { getUserWallet } from "@/api/members"; import configs from '@/config/config' import storage from '@/utils/storage.js' +import { getSessionId, userAction } from "@/api/userAction.js"; export default { components: { tool @@ -160,55 +161,91 @@ couponNum: "", footNum: "", walletNum: "", + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"TBA_BAR_MY", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, onLoad(option) { - console.log('-----------鍒嗕韩鍑虹殑鏁版嵁---------->', option) - let shareStoreId = null; - let shareTime = null; - // 妫�鏌ユ槸鍚﹀瓨鍦╭鍙傛暟 - if (option.q) { - // 鍙岄噸瑙g爜锛氬井淇″URL杩涜浜嗕袱娆$紪鐮� - const decodedUrl = decodeURIComponent(decodeURIComponent(option.q)); - console.log('鍘熷URL:', decodedUrl); - - // 瑙f瀽URL涓殑鏌ヨ鍙傛暟 - const params = this.parseUrlParams(decodedUrl); - shareStoreId = params.shareStoreId; - try { - // 灏嗘暟鎹瓨鍌ㄥ埌鏈湴缂撳瓨 - uni.setStorageSync('shareStoreId', shareStoreId); - //鍒涘缓涓�涓壂鐮佺殑鏃堕棿 - // 鑾峰彇褰撳墠鏃堕棿骞舵牸寮忓寲涓� yyyy-MM-dd HH:mm:ss - const now = new Date(); - const year = now.getFullYear(); - const month = String(now.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝闇�瑕�+1 - const day = String(now.getDate()).padStart(2, '0'); - const hours = String(now.getHours()).padStart(2, '0'); - const minutes = String(now.getMinutes()).padStart(2, '0'); - const seconds = String(now.getSeconds()).padStart(2, '0'); - - shareTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; - uni.setStorageSync('shareTime', shareTime); - console.log('鏁版嵁瀛樺偍鎴愬姛'); - } catch (e) { - console.error('瀛樺偍澶辫触锛�', e); - } - }else{ - shareStoreId = uni.getStorageSync('shareStoreId'); - shareStoreId = uni.getStorageSync('shareTime'); - console.log('浠庣紦瀛樿鍙栧弬鏁�:', { shareStoreId, shareTime }); - // this.bindMemberAndStore(shareStoreId, shareTime) - if (shareStoreId && shareTime) { - console.log('妫�娴嬪埌鏈夋晥鍙傛暟锛岃皟鐢ㄥ悗绔帴鍙�'); - this.bindMemberAndStore(shareStoreId, shareTime); - } else { - console.log('鏃犳湁鏁堝弬鏁帮紝鎵ц姝e父閫昏緫'); - } - } + console.log('-----------鍒嗕韩鍑虹殑鏁版嵁---------->', option) + let shareStoreId = null; + let shareTime = null; + // 妫�鏌ユ槸鍚﹀瓨鍦╭鍙傛暟 + if (option.q) { + // 鍙岄噸瑙g爜锛氬井淇″URL杩涜浜嗕袱娆$紪鐮� + const decodedUrl = decodeURIComponent(decodeURIComponent(option.q)); + console.log('鍘熷URL:', decodedUrl); + + // 瑙f瀽URL涓殑鏌ヨ鍙傛暟 + const params = this.parseUrlParams(decodedUrl); + shareStoreId = params.shareStoreId; + try { + // 灏嗘暟鎹瓨鍌ㄥ埌鏈湴缂撳瓨 + uni.setStorageSync('shareStoreId', shareStoreId); + //鍒涘缓涓�涓壂鐮佺殑鏃堕棿 + // 鑾峰彇褰撳墠鏃堕棿骞舵牸寮忓寲涓� yyyy-MM-dd HH:mm:ss + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝闇�瑕�+1 + const day = String(now.getDate()).padStart(2, '0'); + const hours = String(now.getHours()).padStart(2, '0'); + const minutes = String(now.getMinutes()).padStart(2, '0'); + const seconds = String(now.getSeconds()).padStart(2, '0'); + + shareTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + uni.setStorageSync('shareTime', shareTime); + console.log('鏁版嵁瀛樺偍鎴愬姛'); + } catch (e) { + console.error('瀛樺偍澶辫触锛�', e); + } + }else{ + shareStoreId = uni.getStorageSync('shareStoreId'); + shareStoreId = uni.getStorageSync('shareTime'); + console.log('浠庣紦瀛樿鍙栧弬鏁�:', { shareStoreId, shareTime }); + // this.bindMemberAndStore(shareStoreId, shareTime) + if (shareStoreId && shareTime) { + console.log('妫�娴嬪埌鏈夋晥鍙傛暟锛岃皟鐢ㄥ悗绔帴鍙�'); + this.bindMemberAndStore(shareStoreId, shareTime); + } else { + console.log('鏃犳湁鏁堝弬鏁帮紝鎵ц姝e父閫昏緫'); + } + } + this.initCOS() + }, + 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) + }, + onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) this.initCOS() }, onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + this.actionParam.sessionId = res.data.data + if(this.pageSessionNo){ + let param = Object.assign({}, this.actionParam); + param.sessionId = this.pageSessionNo + userAction(param) + } + }) this.userInfo = this.$options.filters.isLogin() || {}; if (this.$options.filters.isLogin("auth")) { this.getUserOrderNum(); @@ -233,27 +270,27 @@ mounted() { }, methods: { - async bindMemberAndStore(shareStoreId, shareTime){ - let form ={ - shareStoreId: shareStoreId, - shareTime: shareTime - } - // let form ={ - // shareStoreId: "1376433565247471616", - // shareTime: "2025-09-26 16:18:00" - // } - try { - const res = await bindMemberAndStore(form); - if(res.statusCode === 200){ - //娓呴櫎缂撳瓨 - uni.removeStorageSync('shareStoreId'); - uni.removeStorageSync('shareTime'); - } - } - catch(error) { - console.error('鍑洪敊:', error); - }; - }, + async bindMemberAndStore(shareStoreId, shareTime){ + let form ={ + shareStoreId: shareStoreId, + shareTime: shareTime + } + // let form ={ + // shareStoreId: "1376433565247471616", + // shareTime: "2025-09-26 16:18:00" + // } + try { + const res = await bindMemberAndStore(form); + if(res.statusCode === 200){ + //娓呴櫎缂撳瓨 + uni.removeStorageSync('shareStoreId'); + uni.removeStorageSync('shareTime'); + } + } + catch(error) { + console.error('鍑洪敊:', error); + }; + }, // goTOSuccess(){ // uni.redirectTo({ // url:"/pages/cart/payment/success?paymentMethod=WECHAT" + diff --git a/pages/video/video-goods-detail-swiper.vue b/pages/video/video-goods-detail-swiper.vue index 600c26b..da58270 100644 --- a/pages/video/video-goods-detail-swiper.vue +++ b/pages/video/video-goods-detail-swiper.vue @@ -293,6 +293,7 @@ import popups from "@/pages/product/popups/popups.vue"; //姘旀场妗� import takeDownFormSaleGoods from "@/pages/product/m-take-down-sale-goods/index.vue"; //涓嬫灦妗� import setup from "@/pages/product/product/popup/popup.js"; +import { getSessionId, userAction } from "@/api/userAction.js"; import { getGoodsDetail } from "@/api/video.js" import { @@ -439,6 +440,16 @@ touchStartX: 0, touchEndX: 0, minSwipeDistance: 100, // 鏈�灏忔粦鍔ㄨ窛绂伙紝鐢ㄤ簬鍒ゆ柇鏄惁涓烘湁鏁堟粦鍔� + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"SWIPER_GOODS", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } }; }, @@ -481,6 +492,8 @@ this.productRefHeight = windowHeight - bottomHeight + "px"; }, async onLoad(options) { + this.actionParam.pageParams = JSON.stringify(options) + this.videoId = options.videoId; this.getGoodsList(); @@ -492,7 +505,28 @@ }); // #endif }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, async onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) // this.goodsDetail = {}; // debugger // //濡傛灉鏈夊弬鏁癷ds璇存槑浜嬪垎閿�鐭繛鎺ワ紝闇�瑕佽幏鍙栧弬鏁� diff --git a/pages/video/video-goods-detail.vue b/pages/video/video-goods-detail.vue index 62ae3a8..d254c1d 100644 --- a/pages/video/video-goods-detail.vue +++ b/pages/video/video-goods-detail.vue @@ -31,6 +31,7 @@ import {getGoodsDetail} from "@/api/video.js" import { buyBack } from "@/api/trade.js"; import '@/components/uview-components/uview-ui'; + import { getSessionId, userAction } from "@/api/userAction.js"; export default { computed: { totalMoney() { @@ -45,11 +46,45 @@ data() { return { videoId: '', - goodsList: [] + goodsList: [], + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"RECOMMEND_VIDEO_GOODS", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"DETAIL" + } } + }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) }, onLoad(option) { this.videoId = option.videoId; + this.actionParam.pageParams = JSON.stringify(option) this.getGoodsList(); }, methods: { -- Gitblit v1.8.0