mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-02-04 08:05:54 +08:00
feat(商品详情): 增加商品参数初始化和详细信息获取的参数检查
This commit is contained in:
@@ -121,13 +121,23 @@ export default {
|
|||||||
// })
|
// })
|
||||||
// },
|
// },
|
||||||
getGoodsDetail () {
|
getGoodsDetail () {
|
||||||
if(this.toUser.storeFlag){
|
// 检查必要参数是否存在
|
||||||
ServeGetGoodsDetail(this.goodsParams).then(res => {
|
if (!this.toUser.storeFlag) {
|
||||||
if (res.success) {
|
return
|
||||||
this.goodsDetail = res.result.data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.goodsParams || !this.goodsParams.goodsId) {
|
||||||
|
console.warn('getGoodsDetail: goodsParams 或 goodsId 参数缺失')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ServeGetGoodsDetail(this.goodsParams).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
this.goodsDetail = res.result.data
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('获取商品详情失败:', error)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getFootPrint() {
|
getFootPrint() {
|
||||||
if (this.toUser.storeFlag) {
|
if (this.toUser.storeFlag) {
|
||||||
@@ -284,4 +294,4 @@ export default {
|
|||||||
/deep/ .el-tabs__header{
|
/deep/ .el-tabs__header{
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -289,6 +289,8 @@ export default {
|
|||||||
beforeRouteUpdate (to, from, next) {
|
beforeRouteUpdate (to, from, next) {
|
||||||
let index_name = getCacheIndexName();
|
let index_name = getCacheIndexName();
|
||||||
if (index_name) this.clickTab(index_name);
|
if (index_name) this.clickTab(index_name);
|
||||||
|
// 更新商品参数
|
||||||
|
this.initGoodsParams(to.query);
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
@@ -296,8 +298,10 @@ export default {
|
|||||||
},
|
},
|
||||||
async created () {
|
async created () {
|
||||||
await this.initialize();
|
await this.initialize();
|
||||||
await this.loadUserSetting();
|
await this.loadUserSetting();
|
||||||
/**
|
// 初始化商品参数
|
||||||
|
this.initGoodsParams(this.$route.query);
|
||||||
|
/**
|
||||||
* 如果说有id 说明是用户点击 “联系客服” 进入的该页面
|
* 如果说有id 说明是用户点击 “联系客服” 进入的该页面
|
||||||
* 所以创建会话 并请求用户列表
|
* 所以创建会话 并请求用户列表
|
||||||
* 如果没有id说明当前商家登录 直接请求用户列表
|
* 如果没有id说明当前商家登录 直接请求用户列表
|
||||||
@@ -317,6 +321,16 @@ export default {
|
|||||||
// 美化时间格式
|
// 美化时间格式
|
||||||
beautifyTime,
|
beautifyTime,
|
||||||
|
|
||||||
|
// 初始化商品参数
|
||||||
|
initGoodsParams (query) {
|
||||||
|
this.goodsParams = {
|
||||||
|
goodsId: query.goodsId || '',
|
||||||
|
skuId: query.skuId || '',
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('初始化商品参数:', this.goodsParams);
|
||||||
|
},
|
||||||
|
|
||||||
//创建会话
|
//创建会话
|
||||||
async createTalk (id) {
|
async createTalk (id) {
|
||||||
await ServeCreateTalkList(id);
|
await ServeCreateTalkList(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user