|
@@ -1,21 +1,21 @@
|
|
|
<script>
|
|
|
- import { Tab, TabItem, Swiper, SwiperItem} from 'vux'
|
|
|
+ import {Tab, TabItem, Swiper, SwiperItem} from 'vux'
|
|
|
import OrderList from "./OrderList.vue"
|
|
|
|
|
|
export default {
|
|
|
computed: {
|
|
|
current_index: function () {
|
|
|
- return this.selected_page === -1 ? parseInt(this.$route.query["index"]) : this.selected_page;
|
|
|
+ return this.selected_page = parseInt(this.$route.params["index"]) ;
|
|
|
}
|
|
|
},
|
|
|
data(){
|
|
|
return {
|
|
|
pages: [
|
|
|
- { title: "全部", index: 0, state: 0},
|
|
|
- { title: "待付款", index: 1, state: 10},
|
|
|
- { title: "待发货", index: 2, state: 20},
|
|
|
- { title: "待收货", index: 3, state: 30},
|
|
|
- { title: "已收货", index: 4, state: 40},
|
|
|
+ {title: "全部", index: 0, state: 0},
|
|
|
+ {title: "待付款", index: 1, state: 10},
|
|
|
+ {title: "待发货", index: 2, state: 20},
|
|
|
+ {title: "待收货", index: 3, state: 30},
|
|
|
+ {title: "已收货", index: 4, state: 40},
|
|
|
],
|
|
|
selected_page: -1
|
|
|
}
|
|
@@ -23,23 +23,21 @@
|
|
|
render(h){
|
|
|
let _self = this;
|
|
|
let nativeClickHandler = (index = 0) => {
|
|
|
- _self.selected_page = index;
|
|
|
+ let page = _self.pages[index];
|
|
|
+ _self.$router.push(`/order_tabs/${page.title}/${page.index}/${page.state}`);
|
|
|
};
|
|
|
//tab
|
|
|
const tabs = this.pages.map((item, index) => {
|
|
|
return <TabItem selected={_self.current_index === index}
|
|
|
nativeOnClick={ () => nativeClickHandler(index)}>{ _self.pages[index].title}</TabItem>
|
|
|
})
|
|
|
- //pages
|
|
|
- const lists = this.pages.map((item, index) => {
|
|
|
- return <OrderList page={item} class={{order_hide: this.current_index !== index}}/>
|
|
|
- })
|
|
|
-
|
|
|
return (
|
|
|
<div>
|
|
|
<div v-document_title>我的订单</div>
|
|
|
- <Tab>{tabs}</Tab>
|
|
|
- <div class="order_container">{lists}</div>
|
|
|
+ <Tab >
|
|
|
+ {tabs}
|
|
|
+ </Tab>
|
|
|
+ <router-view class="order_container"></router-view>
|
|
|
</div>
|
|
|
)
|
|
|
}
|