2022-12-28 10:08:51 +08:00
|
|
|
|
<template>
|
2022-12-28 14:54:57 +08:00
|
|
|
|
<div style="width: 350px;">
|
2022-12-28 11:23:46 +08:00
|
|
|
|
<div class="base">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<img :src="goodsDetail.thumbnail" class="image" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="margin-left: 13px">
|
|
|
|
|
|
<a @click="linkToGoods(goodsDetail.goodsId, goodsDetail.id)"> {{ goodsDetail.goodsName }} </a>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<span style="color: red;">¥{{ goodsDetail.price }}</span>
|
2022-12-28 10:08:51 +08:00
|
|
|
|
</div>
|
2022-12-28 11:23:46 +08:00
|
|
|
|
<div v-if="hide">
|
2022-12-28 18:31:26 +08:00
|
|
|
|
<el-button class="store-button" type="danger" v-if="btnHide == 1" size="mini" @click="submitSendMessage()"
|
|
|
|
|
|
plain>发送</el-button>
|
2022-12-28 11:23:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-12-28 10:08:51 +08:00
|
|
|
|
</div>
|
2022-12-28 11:23:46 +08:00
|
|
|
|
</div>
|
2022-12-28 10:08:51 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { Tag, button } from 'element-ui'
|
|
|
|
|
|
import { mapState, mapGetters } from "vuex";
|
2022-12-28 18:31:26 +08:00
|
|
|
|
|
2022-12-28 10:08:51 +08:00
|
|
|
|
export default {
|
2022-12-28 11:23:46 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
btnHide: undefined,
|
|
|
|
|
|
hide: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
...mapGetters(["talkItems"]),
|
|
|
|
|
|
...mapState({
|
|
|
|
|
|
id: (state) => state.user.id,
|
2022-12-28 18:31:26 +08:00
|
|
|
|
|
2022-12-28 11:23:46 +08:00
|
|
|
|
toUser: (state) => state.user.toUser,
|
|
|
|
|
|
}),
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
2022-12-28 18:31:26 +08:00
|
|
|
|
this.btnHide = localStorage.getItem(this.goodsDetail.goodsId)
|
2022-12-28 11:23:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
components: {
|
|
|
|
|
|
"el-tag": Tag,
|
|
|
|
|
|
"el-button": button,
|
|
|
|
|
|
Storage
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
toGoods () {
|
|
|
|
|
|
alert("toGoods")
|
2022-12-28 10:08:51 +08:00
|
|
|
|
},
|
2022-12-28 11:23:46 +08:00
|
|
|
|
toMessage () {
|
|
|
|
|
|
alert(JSON.stringify(this.toUser))
|
|
|
|
|
|
alert("toMessage")
|
2022-12-28 10:08:51 +08:00
|
|
|
|
},
|
2022-12-28 11:23:46 +08:00
|
|
|
|
// 回车键发送消息回调事件
|
|
|
|
|
|
submitSendMessage () {
|
|
|
|
|
|
console.log("发送");
|
2022-12-28 18:31:26 +08:00
|
|
|
|
const context = {
|
|
|
|
|
|
id: this.goodsDetail.id,
|
|
|
|
|
|
goodsId: this.goodsDetail.goodsId,
|
|
|
|
|
|
thumbnail: this.goodsDetail.thumbnail,
|
|
|
|
|
|
price: this.goodsDetail.price,
|
|
|
|
|
|
goodsName: this.goodsDetail.goodsName
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-28 11:23:46 +08:00
|
|
|
|
const record = {
|
|
|
|
|
|
operation_type: "MESSAGE",
|
|
|
|
|
|
to: this.toUser.userId,
|
|
|
|
|
|
from: this.id,
|
|
|
|
|
|
message_type: "GOODS",
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
talk_id: this.toUser.id,
|
|
|
|
|
|
};
|
2022-12-28 18:31:26 +08:00
|
|
|
|
this.$emit('sendMessage', record, context);
|
2022-12-28 11:23:46 +08:00
|
|
|
|
// 发送后隐藏按钮 0:隐藏 1:显示
|
2022-12-28 18:31:26 +08:00
|
|
|
|
localStorage.setItem(this.goodsDetail.goodsId, 0)
|
2022-12-28 11:23:46 +08:00
|
|
|
|
this.hide = false
|
|
|
|
|
|
},
|
2022-12-28 10:08:51 +08:00
|
|
|
|
|
2022-12-28 11:23:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
props: {
|
|
|
|
|
|
goodsDetail: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: null,
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2022-12-28 10:08:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
|
.store-button {
|
2022-12-28 11:23:46 +08:00
|
|
|
|
background-color: white;
|
|
|
|
|
|
border-color: #F56C6C;
|
2022-12-28 10:08:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.base {
|
2022-12-28 11:23:46 +08:00
|
|
|
|
margin-top: 5px;
|
|
|
|
|
|
height: 120px;
|
|
|
|
|
|
display: flex;
|
2022-12-28 10:08:51 +08:00
|
|
|
|
|
2022-12-28 14:54:57 +08:00
|
|
|
|
div {
|
2022-12-28 11:25:40 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
2022-12-28 11:22:54 +08:00
|
|
|
|
margin-top: 8px;
|
2022-12-28 11:25:40 +08:00
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-28 14:54:57 +08:00
|
|
|
|
.image {
|
2022-12-28 11:23:46 +08:00
|
|
|
|
height: 100px;
|
|
|
|
|
|
margin-top: 3px;
|
|
|
|
|
|
width: 100px
|
|
|
|
|
|
}
|
2022-12-28 10:08:51 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-28 11:25:40 +08:00
|
|
|
|
.click-button {
|
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
background-color: white;
|
|
|
|
|
|
border-color: #F56C6C;
|
2022-12-28 11:22:54 +08:00
|
|
|
|
}
|
2022-12-28 11:25:40 +08:00
|
|
|
|
|
2022-12-28 10:08:51 +08:00
|
|
|
|
.separate {
|
2022-12-28 11:23:46 +08:00
|
|
|
|
margin-top: 8px;
|
2022-12-28 10:08:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|