From 024eedaabb1cc388a6253b8475d7df2943e143d6 Mon Sep 17 00:00:00 2001 From: linxi Date: Thu, 12 Sep 2024 10:16:40 +0800 Subject: [PATCH] =?UTF-8?q?Feat(=E5=AE=A2=E6=9C=8D)=EF=BC=9A=E5=8F=91?= =?UTF-8?q?=E9=80=81=E5=95=86=E5=93=81=E4=BF=A1=E6=81=AF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/MyOrder/index.vue | 12 +++++- pages/order/OrderDetails/index.vue | 12 +++++- pkg_common/views/room.vue | 60 +++++++++++++++++++++++------- 3 files changed, 69 insertions(+), 15 deletions(-) diff --git a/pages/order/MyOrder/index.vue b/pages/order/MyOrder/index.vue index fe79d94..c834027 100644 --- a/pages/order/MyOrder/index.vue +++ b/pages/order/MyOrder/index.vue @@ -301,8 +301,18 @@ export default { return this.$force2Decimal(v); }, goRoom(order) { + const params = { + goodsId: order.cartInfo[0].productId, + goodsName: order.cartInfo[0].productInfo.storeName, + skuStr: order.cartInfo[0].productInfo.attrInfo.sku, + price: order.cartInfo[0].productInfo.attrInfo.price, + seckillId: order.cartInfo[0].seckillId, + cover: order.cartInfo[0].productInfo.attrInfo.image, + goodsData: '', + seckillData: '' + } uni.navigateTo({ - url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}` + url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}¶ms=${JSON.stringify(params)}` }) }, goRefund(order) { diff --git a/pages/order/OrderDetails/index.vue b/pages/order/OrderDetails/index.vue index 4fbbca0..cd4f7d3 100644 --- a/pages/order/OrderDetails/index.vue +++ b/pages/order/OrderDetails/index.vue @@ -531,8 +531,18 @@ export default { }); }, goRoom(order) { + const params = { + goodsId: order.cartInfo[0].productId, + goodsName: order.cartInfo[0].productInfo.storeName, + skuStr: order.cartInfo[0].productInfo.attrInfo.sku, + price: order.cartInfo[0].productInfo.attrInfo.price, + seckillId: order.cartInfo[0].seckillId, + cover: order.cartInfo[0].productInfo.attrInfo.image, + goodsData: '', + seckillData: '' + } uni.navigateTo({ - url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}` + url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}¶ms=${JSON.stringify(params)}` }) }, force2Decimal(v) { diff --git a/pkg_common/views/room.vue b/pkg_common/views/room.vue index e14063a..121e24a 100644 --- a/pkg_common/views/room.vue +++ b/pkg_common/views/room.vue @@ -26,28 +26,47 @@ - {{ params.goodsName }} + {{ wsJson(item.msg_content).goodsName }} - {{ params.skuStr }} + {{ wsJson(item.msg_content).skuStr }} - ¥{{ params.price }} + ¥{{ wsJson(item.msg_content).price }} + + + + + + + + {{ params.goodsName }} + + + {{ params.skuStr }} + + + + ¥{{ params.price }} + + - + @@ -87,13 +106,16 @@ export default { roomId: null, //房间ID content: "", //消息内容 list: [], //消息列表, - params: {} + params: null } }, onLoad(options) { this.storeId = options.id; this.merName = options.name; - this.params = options.params && JSON.parse(options.params) || {} + this.params = options.params && JSON.parse(options.params) || null + setTimeout(()=>{ + this.params = null + }, 10000) if (this.merName!="undefined" && this.merName!="null") { uni.setNavigationBarTitle({ title: this.merName @@ -110,6 +132,9 @@ export default { } }, methods: { + wsJson(json) { + return JSON.parse(json) + }, getUploadToken() { let that = this; @@ -165,7 +190,14 @@ export default { } }) }, - + sendGoods() { + if(Object.values(this.params).length > 0) { + this.content = JSON.stringify(this.params) + // this.list.push(this.params) + this.userSend(2) + } + this.params = null + }, // 预览图片 preview(url) { uni.previewImage({ @@ -186,11 +218,7 @@ export default { console.log('WebSocket连接已打开!', res); this.socketOpen = true; this.createRoom(); - if(Object.values(this.params).length > 0) { - this.content = JSON.stringify(this.params) - // this.list.push(this.params) - this.userSend(2) - } + }); uni.onSocketError(err => { @@ -292,6 +320,12 @@ export default {