list(cancelFlag) { if(cancelFlag=="cancel"){ this.testData=[]; } console.log("请求第几页:",this.pageNumber); let orderData = { pageNumber: this.pageNumber, pageSize: this.pageSize }; let url2 = global.getParams(this.$clubapi.Order.getOrdersHistory()); return new Promise( (resolve,reject)=>{ this.$http( { method: 'post', url: url2, data: JSON.stringify(orderData), headers: {'Content-Type': 'application/json'} }).then((res) => { console.log("订单列表:", res); if (res.data.resultData && res.data.resultData.ordersList) { let filterdatas = this.$clubapi.com.filterEmpty(res.data.resultData.ordersList); this.totalRecordsLocal = res.data.resultData.totalRecords; let self=this; // console.log("filterdatas:",filterdatas); for (let data of filterdatas) { let productList=[]; for (let item of data.itemList) { this.$http({ url: this.$clubapi.Order.orderPim() + item.product8D, method: 'get' }).then(res => { // console.log("8d数据:",res); if(res.status===200){ let item1={ 'color': res.data.result===false?"lost8d":res.data.returnData.OutMasterData.color, 'cnName': res.data.result===false?"lost8d":res.data.returnData.OutMasterData.cnName, 'quantity':item.quantity, 'isProductReviewable':item.isProductReviewable, 'imagePath': 'https://pet.sonystyle.com.cn' + (res.data.result===false?"lost8d":res.data.returnData.OutMasterData.imagePath), 'product8D':item.product8D, }; productList.push(item1); } }) } // console.log("self.testData:",self.testData); self.testData.push({ 'createdDate': data.createdDate, 'orderId': data.orderId, 'payment': data.paymentType=="online"?"在线支付":data.paymentType, 'totalPrice': data.totalPrice, 'lastUpdateDate':data.lastUpdateDate, // 'totalRecordsLocal': totalRecordsLocal, 'productList': productList, "isCancellationAllowed":data.isCancellationAllowed, "isDepositOrder":data.isDepositOrder, "paymentStatus":data.paymentStatus, "orderStatus":data.orderStatus, "amountType":data.amountType , }); resolve(self.testData); } console.log("this.testData:",this.testData); // this.$store.dispatch('makeWishData', filterdatas); } }) .catch((error) => { console.log(error) }) }) },
数据结构重构
猜你喜欢
转载自blog.csdn.net/pansuyong/article/details/81233954
今日推荐
周排行