客服:完善商品消息发送

pull/56/head
puhui999 2024-07-09 16:17:56 +08:00
parent d9efd4e2e6
commit b630d26d4b
4 changed files with 29 additions and 47 deletions

View File

@ -91,16 +91,16 @@
></su-image>
</view>
</template>
<!-- <template v-if="item.contentType === KeFuMessageContentTypeEnum.PRODUCT">-->
<!-- <GoodsItem-->
<!-- :goodsData="item.content.item"-->
<!-- @tap="-->
<!-- sheep.$router.go('/pages/goods/index', {-->
<!-- id: item.content.item.id,-->
<!-- })-->
<!-- "-->
<!-- />-->
<!-- </template>-->
<template v-if="item.contentType === KeFuMessageContentTypeEnum.PRODUCT">
<GoodsItem
:goodsData="JSON.parse(item.content)"
@tap="
sheep.$router.go('/pages/goods/index', {
id: JSON.parse(item.content).id,
})
"
/>
</template>
<!-- <template v-if="item.contentType === KeFuMessageContentTypeEnum.ORDER">-->
<!-- <OrderItem-->
<!-- from="msg"-->
@ -133,8 +133,9 @@
</template>
<script setup>
import { nextTick, onMounted,onBeforeUnmount, reactive, ref, unref } from 'vue';
import { nextTick, onBeforeUnmount, onMounted, reactive, ref, unref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import GoodsItem from './goods.vue';
import sheep from '@/sheep';
import KeFuApi from '@/sheep/api/promotion/kefu';
import { isEmpty } from '@/sheep/helper/utils';
@ -175,22 +176,6 @@
};
defineExpose({ getMessageList });
const poller = ref(null) // TODO puhui999: websocket
onMounted(() => {
// TODO puhui999:
if (!poller.value) {
poller.value = setInterval(() => {
getMessageList(1)
}, 1000)
}
})
// TODO puhui999:
onBeforeUnmount(() => {
if (!poller.value) {
return
}
clearInterval(poller.value)
})
const scrollTop = ref(0); //
const currentTop = ref(0);
const showGoBottom = ref(false);
@ -232,6 +217,7 @@
//
const includePage = index => {
console.log(visiblePagesList.value, index);
return visiblePagesList.value.indexOf(index) > -1;
};

View File

@ -1,15 +1,15 @@
<template>
<view class="goods ss-flex">
<image class="image" :src="sheep.$url.cdn(goodsData.image)" mode="aspectFill"> </image>
<image class="image" :src="sheep.$url.cdn(goodsData.picUrl)" mode="aspectFill"> </image>
<view class="ss-flex-1">
<view class="title ss-line-2">
{{ goodsData.title }}
{{ goodsData.spuName }}
</view>
<view v-if="goodsData.subtitle" class="subtitle ss-line-1">
{{ goodsData.subtitle }}
<view v-if="goodsData.introduction" class="subtitle ss-line-1">
{{ goodsData.introduction }}
</view>
<view class="price ss-m-t-8">
{{ isArray(goodsData.price) ? goodsData.price[0] : goodsData.price }}
{{ goodsData.price }}
</view>
</view>
</view>
@ -17,7 +17,6 @@
<script setup>
import sheep from '@/sheep';
import { isArray } from 'lodash';
const props = defineProps({
goodsData: {

View File

@ -14,11 +14,11 @@
<view
class="item"
v-for="item in state.pagination.data"
:key="item"
:key="item.id"
@tap="emits('select', { type: mode, data: item })"
>
<template v-if="mode == 'goods'">
<GoodsItem :goodsData="item.goods" />
<GoodsItem :goodsData="item" />
</template>
<template v-if="mode == 'order'">
<OrderItem :orderData="item" />
@ -32,7 +32,6 @@
<script setup>
import { reactive, watch } from 'vue';
import sheep from '@/sheep';
import _ from 'lodash';
import GoodsItem from './goods.vue';
import OrderItem from './order.vue';
@ -83,7 +82,7 @@
page,
list_rows,
});
let orderList = _.concat(state.pagination.data, res.data.data);
let orderList = _.concat(state.pagination.data, res.data.list);
state.pagination = {
...res.data,
data: orderList,

View File

@ -118,19 +118,17 @@
content: res.data,
};
break;
// TODO puhui999:
case 'goods':
msg = {
contentType: KeFuMessageContentTypeEnum.PRODUCT,
content: {
item: {
id: data.goods.id,
title: data.goods.title,
image: data.goods.image,
price: data.goods.price,
stock: data.goods.stock,
},
},
content: JSON.stringify({
id: data.id,
spuName: data.spuName,
picUrl: data.picUrl,
price: data.price,
introduction: data.introduction,
stock: data.stock,
})
};
break;
case 'order':