|
@@ -29,8 +29,8 @@
|
|
|
</text>
|
|
|
<text class="status">{{item.status|filterOrderState}}</text>
|
|
|
</view>
|
|
|
- <view class="center">
|
|
|
- <view v-for="goods in item.detailList" :key="goods.id" class="goods">
|
|
|
+ <view class="center" :key="goodsKey">
|
|
|
+ <view v-if="i<2||item.showMore" v-for="(goods,i) in item.detailList" :key="goods.id" class="goods">
|
|
|
<view class="u-flex u-row-between">
|
|
|
<view class="left u-flex">
|
|
|
<u--image :showLoading="true" :src="goods.mainImg" width="128rpx" height="128rpx"></u--image>
|
|
@@ -58,9 +58,10 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="bottom">
|
|
|
- <!-- <view v-if="item.moreData" class="more" @click.stop="toggleMore(item,index)">
|
|
|
- <text>查看剩余{{item.moreData.length}}件商品</text>
|
|
|
- </view> -->
|
|
|
+ <view v-if="item.detailList.length>2" class="more" @click.stop="toggleMore(item,index)">
|
|
|
+ <text v-if="!item.showMore">查看剩余{{item.moreData.length}}件商品</text>
|
|
|
+ <text v-else>收起</text>
|
|
|
+ </view>
|
|
|
<view class="u-flex u-row-between">
|
|
|
<view class="left u-flex">
|
|
|
<view
|
|
@@ -100,6 +101,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ goodsKey:1,
|
|
|
hasfetch:false,
|
|
|
tabsCurrent:1,
|
|
|
tabsList:[
|
|
@@ -139,13 +141,14 @@
|
|
|
// let spliceData = order.detailList.splice(0,2);
|
|
|
|
|
|
// let moreData = order.detailList.splice(2,order.detailList.length);
|
|
|
+ let moreData = order.detailList.slice(2);
|
|
|
// if(order.detailList.length>2){
|
|
|
// moreData = order.detailList;
|
|
|
// }
|
|
|
return {
|
|
|
...order,
|
|
|
// spliceData:spliceData,
|
|
|
- // moreData:moreData,
|
|
|
+ moreData:moreData,
|
|
|
showMore:false,
|
|
|
class: {
|
|
|
0: 'status-0',
|
|
@@ -252,15 +255,9 @@
|
|
|
});
|
|
|
},
|
|
|
toggleMore(item,index){
|
|
|
- console.log('toggleMore',item);
|
|
|
+ // console.log('toggleMore',item);
|
|
|
this.orderListWithClass[index].showMore = !this.orderListWithClass[index].showMore
|
|
|
- if(item.detailList.length<=2){
|
|
|
- // this.orderListWithClass[index].detailList = item.detailList.concat(item.moreData);
|
|
|
- this.$set(this.orderListWithClass, index, item.moreData);
|
|
|
- }else{
|
|
|
- this.orderListWithClass[index].detailList = this.orderListWithClass[index].detailList.slice(0, 2);
|
|
|
- }
|
|
|
- console.log('this.orderListWithClass[index]',this.orderListWithClass[index]);
|
|
|
+ this.goodsKey++;
|
|
|
},
|
|
|
clickEven(fun,item){
|
|
|
// console.log('fun',fun);
|