From 972f63331f113cd213dc5bfbb39b1a9bbffc8980 Mon Sep 17 00:00:00 2001 From: lincm <8481569+qiuqiukele@user.noreply.gitee.com> Date: Mon, 5 Sep 2022 22:33:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E9=80=89=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 3 +- pages/account/myOrders.vue | 6 +- pages/account/settings.vue | 2 +- pages/account/wishlist.vue | 168 ++++++++++++++++++++++++++------- pages/order/confirmation.vue | 2 +- pages/productDetails/index.vue | 4 +- 6 files changed, 141 insertions(+), 44 deletions(-) diff --git a/pages.json b/pages.json index 326fb00..186bca7 100644 --- a/pages.json +++ b/pages.json @@ -95,7 +95,8 @@ { "path": "pages/account/wishlist", "style": { - "titleNView":false + "titleNView":false, + "enablePullDownRefresh":true } }, { diff --git a/pages/account/myOrders.vue b/pages/account/myOrders.vue index 04b8127..6d8dac9 100644 --- a/pages/account/myOrders.vue +++ b/pages/account/myOrders.vue @@ -831,7 +831,7 @@ .info_lable{ padding: 5.33rpx 20rpx; font-size: 22.67rpx; - border-radius: 33.33rpx; + // border-radius: 33.33rpx; border: 1px solid #D3D3D3; image{ width: 17.33rpx; @@ -882,7 +882,7 @@ font-size: 22.67rpx; border: none; margin: 0; - border-radius: 0; + // border-radius: 0; &:last-child{ margin-right: 0 !important; @@ -918,7 +918,7 @@ background-color: #000000; font-size: 24rpx; color: white; - border-radius: 13.33rpx; + // border-radius: 13.33rpx; height: 63.33rpx; margin-top: 20rpx; } diff --git a/pages/account/settings.vue b/pages/account/settings.vue index 416a8fd..c6670ec 100644 --- a/pages/account/settings.vue +++ b/pages/account/settings.vue @@ -24,7 +24,7 @@ - CHIC BUYER + DOPE PLUS Version {{appver}} diff --git a/pages/account/wishlist.vue b/pages/account/wishlist.vue index 6849ab5..639594a 100644 --- a/pages/account/wishlist.vue +++ b/pages/account/wishlist.vue @@ -3,11 +3,11 @@ - + - - + + @@ -23,7 +23,7 @@ All - + @@ -57,46 +57,93 @@ this.isDelete=true } let i = index + console.log(i) + let list = ({ id:this.goodsList[i].goods_id, index:i }) - - console.log(list) - // let str = [] - if(!this.deletelist.includes(list)){ - this.deletelist.push(list) - console.log(this.deletelist) - } - else if(this.deletelist.includes(list)){ - let i = this.deletelist.indexOf(list) - this.deletelist = this.deletelist.splice(i,1) + let tag = 1 + const _list = JSON.stringify(list) + const _delete = JSON.stringify(this.deletelist) + console.log( _list, _delete) + console.log(_delete.includes(_list)) + + for(let i =0;i{ + if(item.id!=''){ + console.log(111) + list2.push(item) + + } + }) + console.log(list2) + if(list2.length == this.goodsList.length){ + this.isAll = true + }else{ + this.isAll = false + } // this.$store.commit('addSave', list) // if(this.$store.state.goodslist.includes(list)){ // const i = this.$store.state.goodslist.indexOf(list) // this.$store.state.goodslist = this.$store.state.goodslist.splice(i,1) // console.log(i) // } + + }, + Sortid() + { + var arr = this.deletelist + var len = this.deletelist.length; + for (var a = 0; a < len - 1; a++) { + for (var b = 0; b < len - 1 - a; b++) { + if (arr[b].index > arr[b+1].index) { // 相邻元素两两对比 + var temp = arr[b+1]; // 元素交换 + arr[b+1] = arr[b]; + arr[b] = temp; + } + } + } + return arr; }, deleteTap(u){ this.goods_id = item.goods_id - // if(this.Src.includes('select.png')){ - // this.Src = '../../static/img/select1.png' - // }else{ - // this.Src = '../../static/img/select.png' - // } + }, isAllTap(){ - this.goods_id = '' - this.isAll=!this.isAll - if(this.Src.includes('select.png')&&this.isAll==true){ - this.Src = '../../static/img/select1.png' + this.isAll = !this.isAll + if(this.isAll == false){ + this.goods_id = '' + for(let i =0;i{ + this.deletelist.push({ + index:'', + id:'' + }) + }) + } }) }, @@ -143,21 +197,45 @@ }) }, // 取消收藏 - removeLike(){ - let data={_action:'unsetfaviouritegoods',goods_id:this.goods_id} - if(this.isAll)data.goods_id=0 - defaultRequest2(data).then(res=>{ - console.info(res) - if(res.error==0){ + async removeLike(){ + + // let data={_action:'unsetfaviouritegoods',goods_id:this.goods_id} + // if(this.isAll)data.goods_id=0 + let list =[] + let res + this.deletelist.map( item =>{ + if(item.id!=''){ + console.log(111) + list.push(item) + + } + }) + console.log(list) + res = await Promise.all(list.map(async (item) => { + // 等待异步操作完成,返回执行结果 + return await defaultRequest2({ + _action: 'unsetfaviouritegoods', + goods_id: item.id + }) + + })); + console.log(res) + if(res[0].error==0){ + console.info(1234) + setTimeout(() =>{ + uni.showToast({ - title:res.message, + title:'ok!', icon:'none' }) - this.isAll = false - this.isDelete = false - this.getList() + },1000) + this.getList() + // uni.startPullDownRefresh() + this.isAll = false + this.isDelete = false + } - }) + }, back(){ uni.navigateBack() @@ -168,11 +246,29 @@ if(this.goodsList){ this.isAll= false this.isDelete=!this.isDelete + } } }, - onLoad() { + onLoad() { + this.getList() + // uni.startPullDownRefresh() + // uni.clearStorage() + this.deletelist = [] + // let list = await uni.getStorage({ + // key: 'deletelist' + // }); + // if (list.length>1) { + + // this.deletelist = JSON.parse(list[1].data); + // console.log(this.deletelist); + // } + }, + onPullDownRefresh(){ this.getList() + setTimeout(function() { + uni.stopPullDownRefresh(); + }, 2000); } } diff --git a/pages/order/confirmation.vue b/pages/order/confirmation.vue index a91a281..a78ad4c 100644 --- a/pages/order/confirmation.vue +++ b/pages/order/confirmation.vue @@ -115,7 +115,7 @@ {{item.goods_attr |goodsAttr}} - + x{{item.goods_number}} diff --git a/pages/productDetails/index.vue b/pages/productDetails/index.vue index ffb8fdb..9de9770 100644 --- a/pages/productDetails/index.vue +++ b/pages/productDetails/index.vue @@ -119,7 +119,7 @@ - +