Ver Fonte

订单超过两个产品显示展开与收缩,暂时隐藏加盟的视频

gcz há 2 anos atrás
pai
commit
b45bffcc64
2 ficheiros alterados com 13 adições e 16 exclusões
  1. 11 14
      shopping/order.vue
  2. 2 2
      xushuo/cooperation.vue

+ 11 - 14
shopping/order.vue

@@ -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);

+ 2 - 2
xushuo/cooperation.vue

@@ -11,13 +11,13 @@
 			<img class="img" :src="staticUrl+'/img/cooperation-bg.png'" alt="">
 		</view>
 		<view class="page-wrap">
-			<view class="video-wrap">
+			<!-- <view class="video-wrap">
 				<video 
 					id="video" 
 					:src="pageData.jiVideo" 
 				    controls playsinline loop>
 				</video>
-			</view>
+			</view> -->
 			<view class="u-content" style="margin-top: 20rpx;">
 				<u-parse :content="pageData.jiIntro"></u-parse>
 			</view>