<template>
    <view v-if="pageShow">
        <!-- 使用标题栏 -->
        <status-nav :statusBackw="true" :statusTitle="true" :title-val="'待评价'" :tabcolor="'#ffffff'"></status-nav>
        <view :style="{paddingTop:(statusHNH+10)+'px'}">
            <view v-if="dataArr.length!=0" class="margin-sx20 bacb padding-zy20">
                <view class="padding-sx30 borbot" v-for="(item,index) in dataArr" :key="index">
                    <view class="disac" @tap="checkDetail(item.spu_id)">
                        <image class="flexs goodsImg" :src="item.src" mode="aspectFill"></image>
                        <view class="margin-z20">
                            <view class="fon28 clips2">{{item.title}}</view>
                            <view class="margin-sx10"><text class="fon26" style="color: #6f6f6f;">共{{item.num}}件</text><text class="bold fon26 margin-z10">￥<text class="fon32">{{item.price}}</text>.0</text></view>
                        </view>
                    </view>
                    <view class="disba jcend">
                        <view @tap="goEvaluated(index)" class="fon26 colorf78" style="border: 1rpx solid #FF7800;height: 60rpx;width: 150rpx;border-radius: 29.5rpx;text-align: center;line-height: 60rpx;">评价</view>
                    </view>
                </view>
            </view>
			<view v-if="dataArr.length==0" class="zanwu">暂无待评价商品记录</view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                dataArr:[],
				page:1,
				size:50,
				statusHNH:uni.getStorageSync('statusHNH'),
				pageShow:false
            }
        },
		onShow() {
			this.$toolAll.tools.guoq()
		},
        onLoad() {
			this.checkDai()
        },
        methods: {
			checkDai(){//查询待评价列表
				this.$requst.post('user/order',{tag:'waiting_comment',page:this.page,size:this.size}).then(res=>{
					// console.log('待评价商品列表：',res);
					if(res.code==0){
						this.pageShow = true
						if(res.data.list.length!=0){
							res.data.list.forEach(item=>{
								item.skus.forEach(itemone=>{
									if(itemone.has_comment!='yes'){
										let orderObj = {
											id:item.id,
											orderId:itemone.order_id,
											danId:itemone.id,
											src:this.$http + itemone.sku_cover,
											title:itemone.spu_name,
											cate:itemone.sku_name,
											num:itemone.num,
											allprice:item.price/100,
											price:itemone.price/100,
											spu_id:itemone.spu_id
										}
										this.dataArr.push(orderObj)
									}
								})
							})
						}
					}
				},error=>{})
			},
            goEvaluated(index){//去评价事件
				uni.setStorageSync('orderPing',this.dataArr[index])
                uni.navigateTo({
                    url:'/pagesA/evaluate/evaluate'
                })
            },
            checkDetail(id){//查看详情事件
                uni.navigateTo({
                    url:'/pagesA/productDetail/productDetail?id='+id
                })
            }
        }
    }
</script>

<style>
</style>
