<template>
  <view class="main">
	<view class="order_nav">
		<view class="order_nav_item" v-for="(item,index) in tab" :key="index" :class="active == index?'order_nav_active':''" @click="clickOrder(index)">
			<view class="order_nav_name">{{item}}</view>
			<view class="order_nav_m"></view>
		</view>
	</view>
	
	<view class="cont">
		<view class="cont_title">下单时间: 2025/03/06 18:00</view>
		<view class="cont_shop" @click="assDetail()">
			<view class="cont_shop_l">
				<view class="cont_shop_img">
					<image class="cont_shop_imgUrl" src="../../static/Mask.png" mode="widthFix"></image>
				</view>
				<view class="cont_shop_m">
					<view class="cont_shop_title">泡椒田鸡</view>
					<view class="cont_shop_text">实付单价:<text class="cont_shop_price">9.99</text> <text class="cont_shop_num">数量:1</text></view>
				</view>
			</view>
			<view :class="active == 0?'cont_shop_r':'cont_shop_n'" >{{active == 0 ?'申请售后':'已完成'}}</view>
		</view>
	</view>
  </view>
</template>

<script setup>
import { computed,ref,onMounted,onUnmounted,getCurrentInstance,nextTick } from 'vue';
import { useCounterStore } from '@/store/counter'; // 引入 Pinia Store
import { storeToRefs } from 'pinia';//实现解构付值
import { onLoad,onShow,onPullDownRefresh,onPageScroll,onReachBottom,onReady } from "@dcloudio/uni-app"
const counterStore = useCounterStore(); // 使用 Store
const { proxy } = getCurrentInstance();
//使用pinia：storeToRefs方法包裹(保持响应式更新，不使用视图无法更新)
const {statusHeight,headerHeight,statusBartop } = storeToRefs(counterStore);
const tab = ref(['售后申请','售后记录']);
const active = ref(0);
const clickOrder=(index)=>{
	if(index == active.value) return false;
	active.value = index;
};
const assDetail=()=>{
	if(active.value == 0){
		uni.navigateTo({
			url:`/order/assedit/assedit`
		})
	}else{
		uni.navigateTo({
			url:`/order/assDetail/assDetail`
		})
	}
	
};
onLoad((options) => {
	const { type } = options;
	if(type == 0 || type == 1){active.value = type;}
});
onShow(() => {});
onReady(()=>{})
onPullDownRefresh(()=>{})
onReachBottom(()=>{})
</script>

<style lang="scss">
	@import './style.scss';
</style>