From 9d00b8a53fbc2f41509ec33e5d57baf8f354bf87 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Fri, 19 Dec 2025 15:27:54 +0800 Subject: [PATCH] update --- pages/index/index.vue | 87 +- pages/shopMallPage/index/index.vue | 20 +- pages/shopMallPage/shopType/index.vue | 223 +++-- pages/shopPages/shopDetail/index.vue | 834 +++++++++++------- .../.sourcemap/mp-weixin/common/main.js.map | 2 +- .../mp-weixin/common/runtime.js.map | 2 +- .../mp-weixin/pages/index/index.js.map | 2 +- .../pages/shopMallPage/index/index.js.map | 2 +- .../pages/shopMallPage/shopType/index.js.map | 2 +- .../pages/shopPages/shopDetail/index.js.map | 2 +- .../dist/dev/mp-weixin/pages/index/index.js | 99 +-- .../pages/shopMallPage/index/index.js | 44 +- .../pages/shopMallPage/index/index.wxml | 2 +- .../pages/shopMallPage/shopType/index.js | 173 ++-- .../pages/shopPages/shopDetail/index.js | 70 +- .../pages/shopPages/shopDetail/index.wxml | 2 +- .../pages/shopPages/shopDetail/index.wxss | 4 +- .../dev/mp-weixin/project.private.config.json | 27 +- 18 files changed, 882 insertions(+), 715 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index f23dc2d4..22193e95 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -975,14 +975,7 @@ export default { }, async onShow() { // onShow 中不控制骨架屏,骨架屏只在 onLoad 中控制一次 - // 如果不是首次加载,直接显示内容 - if ( - !this.isPageLoading && - this.skeletonControl && - !this.skeletonControl.showSkeleton - ) { - // 非首次访问,确保内容显示 - } + let currentService = uni.getStorageSync("currentService"); if (currentService) { await this.handleGetServiceDetail(currentService.SERVERPART_ID); @@ -1016,52 +1009,7 @@ export default { } this.funList = newFunList; } - - // if (new Date("2025-03-02 8:00:00").getTime() < new Date().getTime()) { - // this.isChangeIcon = false; - // } - // if (this.isChangeIcon) { - // let fun = this.funList; - // fun.forEach((item) => { - // if (item.value === 15) { - // item.label = "女神活动"; - // item.src = "https://eshangtech.com/minTestImg/GoddessFestival.png"; - // item.springSrc = - // "https://eshangtech.com/minTestImg/GoddessFestival.png"; - // } - // }); - - // this.funList = fun; - // this.$forceUpdate(); - // } }, - // async onPullDownRefresh() { - // // await this.handleReloadFunIndex() - // const seatInfo = await this.handleGetNewPosition() - - // // handleGetNearService(seatInfo.longitude, seatInfo.latitude) - // let objInfo = await this.handleGetNearService(seatInfo.longitude, seatInfo.latitude) - // let obj = await this.handleGetServiceDetail(objInfo.SERVERPART_ID); - - // let newObj = { - // ...objInfo, - // sumDetail: obj, - // haveREFUELINGGUN: obj.haveREFUELINGGUN, - // HASCHARGE: obj.HASCHARGE, - // havePARKING: obj.havePARKING, - // haveWC: obj.haveWC, - // HASMOTHER: obj.HASMOTHER, - // HASPILOTLOUNGE: obj.HASPILOTLOUNGE, - // } - // console.log('newObjnewObjnewObjnewObj', newObj); - - // this.serviceDetail = newObj - // let idList = [1212, 1222, 1139, 1215]; - // if (idList.indexOf(nearService.SERVERPART_ID) !== -1) { - // this.handleGetChargingStation(nearService); - // } - // uni.stopPullDownRefresh() - // }, computed: { ...mapGetters({ user: "user", @@ -1172,10 +1120,10 @@ export default { SortStr: "OPERATE_DATE desc", type: "encryption", }; - const data1 = await this.$api.$zzyLocalPost( - "/MallBasic/GetUSERDEFINEDTYPEList", - req - ); + // const data1 = await this.$api.$zzyLocalPost( + // "/MallBasic/GetUSERDEFINEDTYPEList", + // req + // ); let req2 = { SearchParameter: { @@ -1186,10 +1134,15 @@ export default { SortStr: "OPERATE_DATE desc", type: "encryption", }; - const data2 = await this.$api.$zzyLocalPost( - "/MallBasic/GetUSERDEFINEDTYPEList", - req2 - ); + // const data2 = await this.$api.$zzyLocalPost( + // "/MallBasic/GetUSERDEFINEDTYPEList", + // req2 + // ); + + const [data1, data2] = await Promise.all([ + this.$api.$zzyLocalPost("/MallBasic/GetUSERDEFINEDTYPEList", req), + this.$api.$zzyLocalPost("/MallBasic/GetUSERDEFINEDTYPEList", req2), + ]); let res1 = data1.Result_Data.List; let res2 = data2.Result_Data.List; @@ -2276,7 +2229,7 @@ export default { // 跳转商品详情 handleGoShopDetail(obj) { uni.navigateTo({ - url: `/pages/shopPages/shopDetail/index?id=${obj.COMMODITY_ID}`, + url: `/pages/shopPages/shopDetail/index?id=${obj.COMMODITY_ID}&come=buyOrder`, }); }, // 跳转商品列表接口 @@ -2324,10 +2277,12 @@ export default { if (item.COMMODITYLIST && item.COMMODITYLIST.length > 0) { item.COMMODITYLIST.forEach((subItem) => { if (!idSet.has(subItem.COMMODITY_ID)) { - if (subItem.COMMODITY_NATURE === 7000) { - res2.push(subItem); - } else { - res.push(subItem); + if (subItem.IMAGE_PATH || subItem.IMAGE_PATHS) { + if (subItem.COMMODITY_NATURE === 7000) { + res2.push(subItem); + } else { + res.push(subItem); + } } idSet.add(subItem.COMMODITY_ID); } diff --git a/pages/shopMallPage/index/index.vue b/pages/shopMallPage/index/index.vue index b9bcc996..2d8f6658 100644 --- a/pages/shopMallPage/index/index.vue +++ b/pages/shopMallPage/index/index.vue @@ -742,7 +742,13 @@
0) { @@ -1369,7 +1371,7 @@ export default { if (this.activeTabs === 999999) { this.handleGoPointsMall(); } else { - this.handleGetAllShopItem(resList[this.activeTabs].UserdefinedType_Id); + this.handleGetAllShopItem(resList[this.activeTabs].UserdefinedType_Id, type); } }, // 按照小类的 UserdefinedType_PIndex 字段 从小到大排序 @@ -1390,45 +1392,57 @@ export default { return []; }, // 拿到全部的商品 - async handleGetAllShopItem(id) { - uni.showLoading({ title: "加载中" }); - const data = await this.$api.getCoop({ - action_type: "WeChat_GetMallGoodsInfo", - ownerUnitId: 911, - userdefinedtypeId: this.searchText ? "" : id, - commodityName: this.searchText, - excludeNature: this.pageType === "UnionMall" ? "" : 5070, - commodityNature: this.pageType === "UnionMall" ? 5070 : "", - // justCommodity: 1, - sortStr: `${ - this.selectShopSort === 0 - ? "COMMODITY_INDEX,COMMODITY_EN,COMMODITY_MEMBERPRICE,OPERATE_DATE" - : this.selectShopSort === 1 - ? "COMMODITY_MEMBERPRICE" - : this.selectShopSort === 2 - ? "COMMODITY_EN" - : this.selectShopSort === 3 - ? "OPERATE_DATE" - : "" - } ${this.selectSortType === 0 ? "asc" : "desc"}`, - }); + async handleGetAllShopItem(id, type) { + console.log("djaisdjasda", type); - // let url = this.pageType === "UnionMall" ? '/third-party/getWeChatGetMallGoodsInfo' : '/third-party/getWeChatGetMallGoodsInfoExclude' - // const data = await this.$api.$javaGet( - // // '/third-party/getExcludeWeChatGetMallGoodsInfo', - // url, - // { - // ownerUnitId: 911, - // userdefinedTypeId: this.searchText ? "" : id, - // userdefinedtypeId: this.searchText ? "" : id, - // commodityName: this.searchText, - // excludeNature: this.pageType === "UnionMall" ? "" : 5070, - // commodityNature: this.pageType === "UnionMall" ? 5070 : "", - // // justCommodity: 1, - // } - // ) - // uni.hideLoading() + // id 为 商品分类的大类 id type 判断走缓存 还是走老的 1 走老的 2 走缓存 + let data = []; + uni.showLoading({ title: "加载中" }); + if (type === 1) { + data = await this.$api.getCoop({ + action_type: "WeChat_GetMallGoodsInfo", + ownerUnitId: 911, + userdefinedtypeId: this.searchText ? "" : id, + commodityName: this.searchText, + excludeNature: this.pageType === "UnionMall" ? "" : 5070, + commodityNature: this.pageType === "UnionMall" ? 5070 : "", + // justCommodity: 1, + sortStr: `${ + this.selectShopSort === 0 + ? "COMMODITY_INDEX,COMMODITY_EN,COMMODITY_MEMBERPRICE,OPERATE_DATE" + : this.selectShopSort === 1 + ? "COMMODITY_MEMBERPRICE" + : this.selectShopSort === 2 + ? "COMMODITY_EN" + : this.selectShopSort === 3 + ? "OPERATE_DATE" + : "" + } ${this.selectSortType === 0 ? "asc" : "desc"}`, + }); + } else { + let url = + this.pageType === "UnionMall" + ? "/third-party/getWeChatGetMallGoodsInfo" + : "/third-party/getWeChatGetMallGoodsInfoExclude"; + data = await this.$api.$javaGet( + // '/third-party/getExcludeWeChatGetMallGoodsInfo', + url, + { + ownerUnitId: 911, + userdefinedTypeId: this.searchText ? "" : id, + userdefinedtypeId: this.searchText ? "" : id, + commodityName: this.searchText, + excludeNature: this.pageType === "UnionMall" ? "" : 5070, + commodityNature: this.pageType === "UnionMall" ? 5070 : "", + // justCommodity: 1, + } + ); + } + + uni.hideLoading(); let list = data.Data.List; + console.log("list接口返回的初始值", JSON.parse(JSON.stringify(list))); + console.log("this.shopTypeList ", JSON.parse(JSON.stringify(this.shopTypeList))); let thisAllType = []; if (this.shopTypeList && this.shopTypeList.length > 0) { @@ -1438,14 +1452,17 @@ export default { } }); } + console.log("thisAllTypethisAllType", JSON.parse(JSON.stringify(thisAllType))); + let haveAll = false; // 添加一个子类的全部 - list.unshift({ - UserdefinedType_Name: "全部", - UserdefinedType_Id: -1, - }); + // list.unshift({ + // USERDEFINEDTYPE_NAME: "全部", + // USERDEFINEDTYPE_ID: -1, + // }); + // 添加一个子类的全部 if (thisAllType && thisAllType.length > 0) { thisAllType.forEach((item) => { if (item.USERDEFINEDTYPE_NAME === "全部") { @@ -1461,12 +1478,27 @@ export default { UserdefinedType_Id: -1, }); } - + + // thisAllType 里面的值 才是当前商城分类的实际 类型 所以应该是把对应的商品拼到 thisAllType 里面去 + if (thisAllType && thisAllType.length > 0) { + thisAllType.forEach((item) => { + if (list && list.length > 0) { + list.forEach((subItem) => { + if (item.UserdefinedType_Id === subItem.USERDEFINEDTYPE_ID) { + item.COMMODITYLIST = subItem.COMMODITYLIST; + } + }); + } + }); + } + + console.log("thisAllTypethisAllType2", JSON.parse(JSON.stringify(thisAllType))); + let leftIndex = -1; // if (this.pageType === "UnionMall" && this.leftId) { // if (thisAllType && thisAllType.length > 0) { // thisAllType.forEach((item, index) => { - // if (item.UserdefinedType_Id === Number(this.leftId)) { + // if (item.USERDEFINEDTYPE_ID === Number(this.leftId)) { // leftIndex = index; // } // }); @@ -1482,16 +1514,6 @@ export default { } } - console.log("leftIndexleftIndexleftIndex", JSON.parse(JSON.stringify(leftIndex))); - - if (leftIndex === -1) { - leftIndex = this.leftSelectIndex; - } - console.log( - "indexDefaultLeftSelectindexDefaultLeftSelectindexDefaultLeftSelect", - this.indexDefaultLeftSelect - ); - if (this.indexDefaultLeftSelect !== -1) { if (thisAllType && thisAllType.length > 0) { thisAllType.forEach((item, index) => { @@ -1502,22 +1524,35 @@ export default { } } + console.log("leftIndexleftIndexleftIndex2", JSON.parse(JSON.stringify(leftIndex))); + console.log( + "thisAllTypethisAllTypethisAllType2", + JSON.parse(JSON.stringify(thisAllType)) + ); + + if (leftIndex === -1) { + leftIndex = this.leftSelectIndex; + } + // 当前选中的商品列表 let shopList = []; - if (list && list.length > 0) { + console.log("listlistlistlist", JSON.parse(JSON.stringify(list))); + + if (thisAllType && thisAllType.length > 0) { // 这一大类的全部商品 let thisTypeAllShop = []; // 当前的全部商品id let allShopID = []; - list.forEach((item) => { + // 这个遍历是拿全部商品 放在 thisTypeAllShop 里面 + thisAllType.forEach((item) => { if (item.UserdefinedType_Name !== "全部") { // if ( item.COMMODITYLIST && item.COMMODITYLIST.length > 0 && - (item.USERDEFINEDTYPE_PID === id || item.USERDEFINEDTYPE_ID === id) + (item.UserdefinedType_PId === id || item.UserdefinedType_Id === id) ) { item.COMMODITYLIST.forEach((subItem) => { if (allShopID.indexOf(subItem.COMMODITY_ID) === -1) { @@ -1529,19 +1564,19 @@ export default { } }); - list[0].COMMODITYLIST = thisTypeAllShop; + thisAllType[0].COMMODITYLIST = thisTypeAllShop; if ( leftIndex !== -1 && - list[leftIndex] && - list[leftIndex].COMMODITYLIST && - list[leftIndex].COMMODITYLIST.length > 0 + thisAllType[leftIndex] && + thisAllType[leftIndex].COMMODITYLIST && + thisAllType[leftIndex].COMMODITYLIST.length > 0 ) { if (this.pageType === "UnionMall" && this.leftId) { if (this.leftId) { let obj = {}; - list.forEach((item) => { + thisAllType.forEach((item) => { // (Number(item.USERDEFINEDTYPE_ID) === Number(this.leftId)) || if ( Number(item.UserdefinedType_Id) === Number(this.leftId) || @@ -1551,20 +1586,19 @@ export default { } }); - if (obj.USERDEFINEDTYPE_ID || obj.UserdefinedType_Id) { + if (obj.UserdefinedType_Id || obj.UserdefinedType_Id) { shopList = obj.COMMODITYLIST; } else { shopList = []; } } else { - shopList = list[leftIndex - 1].COMMODITYLIST; + shopList = thisAllType[leftIndex - 1].COMMODITYLIST; } } else { - shopList = list[leftIndex].COMMODITYLIST; + shopList = thisAllType[leftIndex].COMMODITYLIST; } } - if (shopList && shopList.length > 0) { shopList.forEach((item) => { // 判断当前的购物车里面 是不是已经有数据了 有数据的话 把原本的商品数量赋值进去 @@ -1602,38 +1636,41 @@ export default { let newList = []; if (thisAllType && thisAllType.length > 0) { thisAllType.forEach((item) => { - item.USERDEFINEDTYPE_ID = []; + // item.USERDEFINEDTYPE_ID = []; item.USERDEFINEDTYPE_ID = item.UserdefinedType_Id; item.USERDEFINEDTYPE_NAME = item.UserdefinedType_Name; item.USERDEFINEDTYPE_PID = item.UserdefinedType_PId; - // 判断这一项找到没 - let isFound = false; - let res = {}; - list.forEach((subItem) => { - if (item.UserdefinedType_Id === subItem.USERDEFINEDTYPE_ID) { - isFound = true; - res = subItem; - } - }); - if (isFound) { - newList.push(res); - } else { - newList.push(item); - } + newList.push(item); + // // 判断这一项找到没 + // let isFound = false; + // let res = {}; + // list.forEach((subItem) => { + // if (item.UserdefinedType_Id === subItem.UserdefinedType_Id) { + // isFound = true; + // res = subItem; + // } + // }); + // if (isFound) { + // newList.push(res); + // } else { + // newList.push(item); + // } }); } + console.log("newListnewListnewList", JSON.parse(JSON.stringify(newList))); + // 小类里面的全部商品类型 let allShopList = []; // 当前的全部商品id let allShopID2 = []; if (newList && newList.length > 0) { this.leftToView = - "left_" + leftIndex + "_" + newList[leftIndex].USERDEFINEDTYPE_ID; + "left_" + leftIndex + "_" + newList[leftIndex].UserdefinedType_Id; newList.forEach((item) => { if (item.COMMODITYLIST && item.COMMODITYLIST.length > 0) { item.COMMODITYLIST.forEach((subItem) => { - if (subItem.USERDEFINEDTYPE_NAME !== "全部") { + if (subItem.UserdefinedType_Name !== "全部") { // allShopList.push(subItem); if (allShopID2.indexOf(subItem.COMMODITY_ID) === -1) { allShopList.push(subItem); @@ -1664,7 +1701,7 @@ export default { // 商品列表 showDetail(obj) { uni.navigateTo({ - url: `/pages/shopPages/shopDetail/index?id=${obj.COMMODITY_ID}&pageType=${this.pageType}`, + url: `/pages/shopPages/shopDetail/index?id=${obj.COMMODITY_ID}&pageType=${this.pageType}&come=buyOrder`, }); }, // 更新 leftAllTypeObj 数据 @@ -1764,7 +1801,7 @@ export default { // url: `/pages/allFunPage/unionActivities`, // }); // } else { - this.handleGetAllShopItem(this.shopTypeList[index].UserdefinedType_Id); + this.handleGetAllShopItem(this.shopTypeList[index].UserdefinedType_Id, 2); // } }, // 改变商品小类 diff --git a/pages/shopPages/shopDetail/index.vue b/pages/shopPages/shopDetail/index.vue index bb40fe96..dba0838f 100644 --- a/pages/shopPages/shopDetail/index.vue +++ b/pages/shopPages/shopDetail/index.vue @@ -3,10 +3,13 @@ - + @@ -15,11 +18,14 @@ - + @@ -41,7 +47,11 @@ - + @@ -49,10 +59,18 @@ - + - + @@ -69,41 +87,78 @@ - -
- + +
+ - + - + - 商品 + 商品 - 详情 + 详情 - + - + - {{ item.label }} + {{ item.label }} @@ -112,8 +167,15 @@ -