Feat(客服):发送商品信息功能

This commit is contained in:
linxi
2024-09-12 10:16:40 +08:00
parent 6790c14aaf
commit 024eedaabb
3 changed files with 69 additions and 15 deletions
+11 -1
View File
@@ -301,8 +301,18 @@ export default {
return this.$force2Decimal(v); return this.$force2Decimal(v);
}, },
goRoom(order) { 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({ uni.navigateTo({
url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}` url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}&params=${JSON.stringify(params)}`
}) })
}, },
goRefund(order) { goRefund(order) {
+11 -1
View File
@@ -531,8 +531,18 @@ export default {
}); });
}, },
goRoom(order) { 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({ uni.navigateTo({
url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}` url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}&params=${JSON.stringify(params)}`
}) })
}, },
force2Decimal(v) { force2Decimal(v) {
+47 -13
View File
@@ -26,28 +26,47 @@
</view> </view>
<view class="msg v12-d-flex" style="box-sizing: content-box" v-if="item.msg_type===2"> <view class="msg v12-d-flex" style="box-sizing: content-box" v-if="item.msg_type===2">
<view class="goods-logo"> <view class="goods-logo">
<image class="img v12-radius-8" :src="params.cover"></image> <image class="img v12-radius-8" :src="wsJson(item.msg_content).cover"></image>
</view> </view>
<view class="conent v12-ml-3 v12-justify-between v12-flex-column"> <view class="conent v12-ml-3 v12-justify-between v12-flex-column">
<view class=""> <view class="">
<view class="goodsName one-t v12-font-26"> <view class="goodsName one-t v12-font-26">
{{ params.goodsName }} {{ wsJson(item.msg_content).goodsName }}
</view> </view>
<view class="goodsSku v12-secondary-dark-text v12-font-22 v12-font-weight-400 one-t"> <view class="goodsSku v12-secondary-dark-text v12-font-22 v12-font-weight-400 one-t">
{{ params.skuStr }} {{ wsJson(item.msg_content).skuStr }}
</view> </view>
</view> </view>
<view class="price v12-primary-text v12-font-24"> <view class="price v12-primary-text v12-font-24">
{{ params.price }} {{ wsJson(item.msg_content).price }}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<image class="cover" :src="item.header || webUrl+'/20221114155314348118.png'"/> <image class="cover" :src="item.header || webUrl+'/20221114155314348118.png'"/>
</view> </view>
</view>
<view class="msg v12-d-flex goods-link" style="box-sizing: content-box" v-if="params" @click="sendGoods">
<view class="goods-logo">
<image class="img v12-radius-8" :src="params.cover"></image>
</view>
<view class="conent v12-ml-3 v12-justify-between v12-flex-column">
<view class="">
<view class="goodsName one-t v12-font-26">
{{ params.goodsName }}
</view>
<view class="goodsSku v12-secondary-dark-text v12-font-22 v12-font-weight-400 one-t">
{{ params.skuStr }}
</view>
</view>
<view class="price v12-primary-text v12-font-24">
{{ params.price }}
</view>
</view>
</view> </view>
</view> </view>
<view class="footer flex jc-between ai-end v12-align-center"> <view class="footer flex jc-between ai-end v12-align-center">
<image :src="webUrl+'/20221014095236624035.png'" @click="getUploadToken"></image> <image :src="webUrl+'/20221014095236624035.png'" @click="getUploadToken"></image>
<view class="input-box"> <view class="input-box">
@@ -87,13 +106,16 @@ export default {
roomId: null, //房间ID roomId: null, //房间ID
content: "", //消息内容 content: "", //消息内容
list: [], //消息列表, list: [], //消息列表,
params: {} params: null
} }
}, },
onLoad(options) { onLoad(options) {
this.storeId = options.id; this.storeId = options.id;
this.merName = options.name; 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") { if (this.merName!="undefined" && this.merName!="null") {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.merName title: this.merName
@@ -110,6 +132,9 @@ export default {
} }
}, },
methods: { methods: {
wsJson(json) {
return JSON.parse(json)
},
getUploadToken() { getUploadToken() {
let that = this; 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) { preview(url) {
uni.previewImage({ uni.previewImage({
@@ -186,11 +218,7 @@ export default {
console.log('WebSocket连接已打开!', res); console.log('WebSocket连接已打开!', res);
this.socketOpen = true; this.socketOpen = true;
this.createRoom(); 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 => { uni.onSocketError(err => {
@@ -292,6 +320,12 @@ export default {
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.goods-link{
box-sizing: content-box;
position: absolute;
bottom: 200rpx;
right: 20rpx;
}
.goodsName,.goodsSku{ .goodsName,.goodsSku{
max-width: 400rpx; max-width: 400rpx;
} }