客服:完善商品消息发送

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

View File

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

View File

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

View File

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