Commit d791ce33 by Lin

Merge branch 'saas+v5.8.3' of http://192.168.3.233:8090/glsx/gl_tape into saas+v5.8.3

2 parents 75a9abe8 ee4bad1f
...@@ -233,6 +233,7 @@ import { ...@@ -233,6 +233,7 @@ import {
shouldShowDailyGuide, shouldShowDailyGuide,
markDailyGuideShown markDailyGuideShown
} from '@/utils/aiAssistant/AiAssistantPref.js' } from '@/utils/aiAssistant/AiAssistantPref.js'
import { storageApi } from '@/utils/cache'
import RecordService from '@/utils/recordManager/RecordService.js' import RecordService from '@/utils/recordManager/RecordService.js'
import { getAiStreamSession } from '@/utils/aiAssistant/aiStreamSession.js' import { getAiStreamSession } from '@/utils/aiAssistant/aiStreamSession.js'
import { TransportType } from '@/utils/socket' import { TransportType } from '@/utils/socket'
...@@ -609,6 +610,7 @@ export default { ...@@ -609,6 +610,7 @@ export default {
'info', 'info',
`encode ${this.encodeCostMs}ms, request POST /api/audio/chat session=${sessionId}` `encode ${this.encodeCostMs}ms, request POST /api/audio/chat session=${sessionId}`
) )
const userInfo = storageApi.getUserInfo() || {}
let res let res
const tReqStart = Date.now() const tReqStart = Date.now()
try { try {
...@@ -621,7 +623,8 @@ export default { ...@@ -621,7 +623,8 @@ export default {
audio: audioBase64, audio: audioBase64,
sample_rate: 16000, sample_rate: 16000,
sample_width: 2, sample_width: 2,
channels: 1 channels: 1,
phone: userInfo.phone || ''
}, },
onTask: (task) => { onTask: (task) => {
this.helpAnswerAbort = () => { this.helpAnswerAbort = () => {
......
...@@ -443,8 +443,22 @@ export default { ...@@ -443,8 +443,22 @@ export default {
chooseList.map((item, ind) => { chooseList.map((item, ind) => {
if (item.goodsFlag == 2 && item.multipleSpecificationsGoods.id == goodsList[index].multipleSpecificationsGoods.id) addIndex = ind if (item.goodsFlag == 2 && item.multipleSpecificationsGoods.id == goodsList[index].multipleSpecificationsGoods.id) addIndex = ind
}) })
const parentMsg = goodsList[index].multipleSpecificationsGoods
const marketingFlag = goodsList[index].marketingFlag ?? parentMsg.marketingFlag
const activityId = goodsList[index].activityId ?? parentMsg.activityId
const selectedGoods = goodsArr[0]
if (marketingFlag != null && marketingFlag !== '') {
goodsList[index].marketingFlag = goodsList[index].marketingFlag ?? marketingFlag
parentMsg.marketingFlag = parentMsg.marketingFlag ?? marketingFlag
selectedGoods.marketingFlag = selectedGoods.marketingFlag ?? marketingFlag
}
if (activityId != null && activityId !== '') {
goodsList[index].activityId = goodsList[index].activityId ?? activityId
parentMsg.activityId = parentMsg.activityId ?? activityId
selectedGoods.activityId = selectedGoods.activityId ?? activityId
}
goodsList[index].active = true goodsList[index].active = true
goodsList[index].multipleSpecificationsGoods.goods = goodsArr[0] goodsList[index].multipleSpecificationsGoods.goods = selectedGoods
goodsList[index].multipleSpecificationsGoods.goods.goodsId = goodsList[index].multipleSpecificationsGoods.goods.merchantGoodsId goodsList[index].multipleSpecificationsGoods.goods.goodsId = goodsList[index].multipleSpecificationsGoods.goods.merchantGoodsId
goodsList[index].multipleSpecificationsGoods.goods.specificationStr = goodsList[index].multipleSpecificationsGoods.goods.specificationData.replace(/;~;/g, '/') goodsList[index].multipleSpecificationsGoods.goods.specificationStr = goodsList[index].multipleSpecificationsGoods.goods.specificationData.replace(/;~;/g, '/')
snapshotOriginalPrice(goodsList[index].multipleSpecificationsGoods.goods) snapshotOriginalPrice(goodsList[index].multipleSpecificationsGoods.goods)
......
...@@ -102,18 +102,30 @@ export default { ...@@ -102,18 +102,30 @@ export default {
title: '请勾选商品', title: '请勾选商品',
icon: 'none', icon: 'none',
}) })
let { baseGoodsName, id, specificationGoodsMap, specificationList, skuGoodsList } = data.multipleSpecificationsGoods let { baseGoodsName, id, specificationGoodsMap, specificationList, skuGoodsList, marketingFlag: msgMarketingFlag, activityId: msgActivityId } = data.multipleSpecificationsGoods
let goods = skuGoodsList.find(e => e.goodsId == currentId) let goods = skuGoodsList.find(e => e.goodsId == currentId)
const marketingFlag = data.marketingFlag ?? msgMarketingFlag
const activityId = data.activityId ?? msgActivityId
if (marketingFlag != null && marketingFlag !== '' && (goods.marketingFlag == null || goods.marketingFlag === '')) {
goods.marketingFlag = marketingFlag
}
if (activityId != null && activityId !== '' && (goods.activityId == null || goods.activityId === '')) {
goods.activityId = activityId
}
this.$emit('onConfirm', { this.$emit('onConfirm', {
count: 1, count: 1,
goods: null, goods: null,
goodsFlag: 2, goodsFlag: 2,
isFlag: true, isFlag: true,
marketingFlag,
activityId,
multipleSpecificationsGoods: { multipleSpecificationsGoods: {
baseGoodsName, baseGoodsName,
id, id,
specificationGoodsMap, specificationGoodsMap,
specificationList, specificationList,
marketingFlag,
activityId,
goods goods
} }
}) })
......
...@@ -778,6 +778,7 @@ export default { ...@@ -778,6 +778,7 @@ export default {
this.$set(this.orderObj, _typeValue.key, chooseContent) this.$set(this.orderObj, _typeValue.key, chooseContent)
} }
snapshotOrderItemsOriginalPrice(this.orderObj[_typeValue.key]) snapshotOrderItemsOriginalPrice(this.orderObj[_typeValue.key])
this.enrichOrderItemsMarketingFields(this.orderObj[_typeValue.key])
// 商品类,需计算总价 // 商品类,需计算总价
setTimeout(() => { setTimeout(() => {
this.changeTotalPrice() this.changeTotalPrice()
...@@ -1808,16 +1809,118 @@ export default { ...@@ -1808,16 +1809,118 @@ export default {
}, },
buildSubOrderGoodsFlags(orderItem, goods) { buildSubOrderGoodsFlags(orderItem, goods) {
if (!['createWithPay', 'supplementOrder'].includes(this.orderCreateType)) return {} if (!['createWithPay', 'supplementOrder'].includes(this.orderCreateType)) return {}
const catalogMatch = this.resolveCatalogMatch(orderItem, goods)
let marketingFlag = getSubmitMarketingFlag(orderItem, goods)
if (marketingFlag !== 1 && catalogMatch) {
marketingFlag = getSubmitMarketingFlag(catalogMatch)
}
const flags = { const flags = {
marketingFlag: getSubmitMarketingFlag(orderItem, goods), marketingFlag,
modifyFlag: getSubmitModifyFlag(goods) modifyFlag: getSubmitModifyFlag(goods)
} }
const activityId = getSubmitActivityId(orderItem, goods)
if (marketingFlag === 1) {
let activityId = getSubmitActivityId(orderItem, goods)
if ((activityId == null || activityId === '') && catalogMatch) {
activityId = getActivityId(catalogMatch)
if ((activityId == null || activityId === '') && orderItem.goodsFlag == 3 && goods?.merchantGoodsId) {
const pkgGoods = catalogMatch.packageGoods?.goodsList?.find(
g => g.merchantGoodsId == goods.merchantGoodsId
)
activityId = pkgGoods?.activityId
}
}
if (activityId != null && activityId !== '') { if (activityId != null && activityId !== '') {
flags.activityId = activityId flags.activityId = activityId
} }
}
return flags return flags
}, },
resolveCatalogMatch(orderItem, goods) {
if (!orderItem) return undefined
if (orderItem.goodsFlag == 1) {
const g = goods ?? orderItem.goods
return this.findCatalogGoodsMatch({
merchantGoodsId: g?.merchantGoodsId,
goodsId: g?.goodsId ?? g?.merchantGoodsId
})
}
if (orderItem.goodsFlag == 2) {
const id = orderItem.multipleSpecificationsGoods?.id ?? orderItem.multipleSpecificationsGoods?.merchantGoodsId
return this.findCatalogGoodsMatch({ merchantGoodsId: id, goodsId: id })
}
if (orderItem.goodsFlag == 3 && orderItem.packageGoods) {
return this.findCatalogGoodsMatch({ packageGoods: orderItem.packageGoods })
}
return undefined
},
enrichOrderItemsMarketingFields(items) {
if (!Array.isArray(items)) return
items.forEach(item => {
const catalogMatch = this.resolveCatalogMatch(item)
if (!catalogMatch) return
const catalogMarketingFlag = getMarketingFlag(catalogMatch)
const catalogActivityId = getActivityId(catalogMatch)
if (catalogMarketingFlag != null && catalogMarketingFlag !== '' && (item.marketingFlag == null || item.marketingFlag === '')) {
item.marketingFlag = catalogMarketingFlag
}
if (catalogActivityId != null && catalogActivityId !== '' && (item.activityId == null || item.activityId === '')) {
item.activityId = catalogActivityId
}
if (item.goodsFlag == 1 && item.goods) {
if (catalogMarketingFlag != null && catalogMarketingFlag !== '' && (item.goods.marketingFlag == null || item.goods.marketingFlag === '')) {
item.goods.marketingFlag = catalogMarketingFlag
}
if (catalogActivityId != null && catalogActivityId !== '' && (item.goods.activityId == null || item.goods.activityId === '')) {
item.goods.activityId = catalogActivityId
}
}
if (item.goodsFlag == 2 && item.multipleSpecificationsGoods) {
const msg = item.multipleSpecificationsGoods
if (catalogMarketingFlag != null && catalogMarketingFlag !== '' && (msg.marketingFlag == null || msg.marketingFlag === '')) {
msg.marketingFlag = catalogMarketingFlag
}
if (catalogActivityId != null && catalogActivityId !== '' && (msg.activityId == null || msg.activityId === '')) {
msg.activityId = catalogActivityId
}
if (msg.goods) {
if (catalogMarketingFlag != null && catalogMarketingFlag !== '' && (msg.goods.marketingFlag == null || msg.goods.marketingFlag === '')) {
msg.goods.marketingFlag = catalogMarketingFlag
}
if (catalogActivityId != null && catalogActivityId !== '' && (msg.goods.activityId == null || msg.goods.activityId === '')) {
msg.goods.activityId = catalogActivityId
}
}
}
if (item.goodsFlag == 3 && item.packageGoods) {
if (catalogMarketingFlag != null && catalogMarketingFlag !== '' && (item.packageGoods.marketingFlag == null || item.packageGoods.marketingFlag === '')) {
item.packageGoods.marketingFlag = catalogMarketingFlag
}
if (catalogActivityId != null && catalogActivityId !== '' && (item.packageGoods.activityId == null || item.packageGoods.activityId === '')) {
item.packageGoods.activityId = catalogActivityId
}
item.packageGoods.goodsList?.forEach(g => {
const catalogGoods = catalogMatch.packageGoods?.goodsList?.find(
cg => cg.merchantGoodsId == g.merchantGoodsId
)
if (!catalogGoods) return
if (catalogGoods.marketingFlag != null && catalogGoods.marketingFlag !== '' && (g.marketingFlag == null || g.marketingFlag === '')) {
g.marketingFlag = catalogGoods.marketingFlag
}
if (catalogGoods.activityId != null && catalogGoods.activityId !== '' && (g.activityId == null || g.activityId === '')) {
g.activityId = catalogGoods.activityId
}
})
}
})
},
findCatalogGoodsMatch({ merchantGoodsId, goodsId, packageGoods } = {}) { findCatalogGoodsMatch({ merchantGoodsId, goodsId, packageGoods } = {}) {
const list = this.goodsList || [] const list = this.goodsList || []
return list.find(item => { return list.find(item => {
......
...@@ -309,7 +309,7 @@ class RecordService { ...@@ -309,7 +309,7 @@ class RecordService {
const useWs = !!wsBase const useWs = !!wsBase
const transport = useWs ? TransportType.WEBSOCKET : TransportType.HTTP const transport = useWs ? TransportType.WEBSOCKET : TransportType.HTTP
// HTTP 服务端固定为 /health(可在 AiAssistantBall 内按需覆盖) // HTTP 服务端固定为 /health(可在 AiAssistantBall 内按需覆盖)
const httpBaseUrl = 'https://lightmodification.test.glsx.com.cn' const httpBaseUrl = 'https://lightmodification.glsx.com.cn'
const client = new NativeChannelClient( const client = new NativeChannelClient(
useWs ? { transport } : { transport, baseUrl: httpBaseUrl } useWs ? { transport } : { transport, baseUrl: httpBaseUrl }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!