|
|
@@ -0,0 +1,220 @@
|
|
|
+<template>
|
|
|
+ <div class="discover">
|
|
|
+ <van-sticky ref="top" @change="change">
|
|
|
+ <div class="top">
|
|
|
+ <div class="top-btn">
|
|
|
+ <div
|
|
|
+ class="btn"
|
|
|
+ :class="{ active: active === 'explore' }"
|
|
|
+ @click="changeActive('explore')"
|
|
|
+ >
|
|
|
+ 商品订单
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="btn"
|
|
|
+ :class="{ active: active === 'creator' }"
|
|
|
+ @click="changeActive('creator')"
|
|
|
+ >
|
|
|
+ 盲盒订单
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="search">
|
|
|
+ <img src="../../assets/svgs/search.svg" alt="" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <van-tabs
|
|
|
+ v-model:active="type"
|
|
|
+ line-width="16"
|
|
|
+ line-height="2"
|
|
|
+ @click="changeStatus"
|
|
|
+ >
|
|
|
+ <van-tab
|
|
|
+ v-for="(item, index) in tabs"
|
|
|
+ :key="index"
|
|
|
+ :title="item.name"
|
|
|
+ :name="item.status"
|
|
|
+ ></van-tab>
|
|
|
+ </van-tabs>
|
|
|
+ </van-sticky>
|
|
|
+
|
|
|
+ <div class="list">
|
|
|
+ <order-info v-for="item in list" :key="item.id" :info="item"></order-info>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import OrderInfo from "../../components/order/OrderInfo.vue";
|
|
|
+export default {
|
|
|
+ name: "discover",
|
|
|
+ inject: ["bs"],
|
|
|
+ components: {
|
|
|
+ OrderInfo,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ active: "explore",
|
|
|
+ stiky: null,
|
|
|
+ type: "PROCESSING,FINISH",
|
|
|
+ list: [],
|
|
|
+ tabs: [
|
|
|
+ {
|
|
|
+ status: "PROCESSING,FINISH",
|
|
|
+ name: "全部",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ status: "PROCESSING",
|
|
|
+ name: "交易中",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ status: "FINISH",
|
|
|
+ name: "已完成",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ beforeUnmount() {
|
|
|
+ if (this.stiky.parentNode.nodeName == "BODY") {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ document.body.removeChild(this.stiky);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.stiky = this.$refs.top.$el.childNodes[0];
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList() {
|
|
|
+ this.$toast.loading({
|
|
|
+ message: "加载中...",
|
|
|
+ forbidClick: true,
|
|
|
+ });
|
|
|
+ this.$http
|
|
|
+ .post(
|
|
|
+ "/order/all",
|
|
|
+ {
|
|
|
+ size: 20,
|
|
|
+ query: {
|
|
|
+ userId: this.$store.state.userInfo.id,
|
|
|
+ status: this.type,
|
|
|
+ },
|
|
|
+ sort: "createdAt,desc",
|
|
|
+ },
|
|
|
+ { body: "json" }
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ this.list = res.content;
|
|
|
+ console.log(this.bs);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.bs.value.refresh();
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changeStatus(name) {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ change(isFixed) {
|
|
|
+ if (isFixed) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ document.body.appendChild(this.stiky);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$refs.top.$el.appendChild(this.stiky);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeActive(active) {
|
|
|
+ this.active = active;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.bs.value.scrollTo(0, 0);
|
|
|
+ this.bs.value.refresh();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.top {
|
|
|
+ display: flex;
|
|
|
+ padding: 10px 16px;
|
|
|
+ background-color: @bg;
|
|
|
+ border-bottom: 1px solid #202122;
|
|
|
+ .top-btn {
|
|
|
+ flex-grow: 1;
|
|
|
+ .btn {
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 26px;
|
|
|
+ display: inline-block;
|
|
|
+ vertical-align: text-bottom;
|
|
|
+
|
|
|
+ &.active {
|
|
|
+ color: @prim;
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: bold;
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn + .btn {
|
|
|
+ margin-left: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.discover {
|
|
|
+ background-color: @bg3;
|
|
|
+}
|
|
|
+
|
|
|
+.grid-img {
|
|
|
+ display: block;
|
|
|
+}
|
|
|
+.van-grid {
|
|
|
+ margin-top: 12px;
|
|
|
+}
|
|
|
+/deep/ .van-grid-item__content {
|
|
|
+ padding: 14px 20px 16px;
|
|
|
+}
|
|
|
+/deep/ .van-grid-item__text {
|
|
|
+ color: #fff;
|
|
|
+ font-size: 13px;
|
|
|
+ line-height: 18px;
|
|
|
+ margin-top: 4px;
|
|
|
+}
|
|
|
+
|
|
|
+.title {
|
|
|
+ padding: 16px 20px 8px;
|
|
|
+ color: @prim;
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+
|
|
|
+.box-list {
|
|
|
+ // display: flex;
|
|
|
+ // flex-wrap: wrap;
|
|
|
+ padding: 0 8px;
|
|
|
+}
|
|
|
+
|
|
|
+.discover {
|
|
|
+ padding-bottom: 50px;
|
|
|
+}
|
|
|
+
|
|
|
+/deep/.van-tab {
|
|
|
+ color: #fff;
|
|
|
+ flex: 0;
|
|
|
+ padding: 20px;
|
|
|
+ flex-shrink: 0;
|
|
|
+ min-width: 100px;
|
|
|
+
|
|
|
+ &.van-tab--active {
|
|
|
+ color: @prim;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/deep/ .van-tabs__line {
|
|
|
+ bottom: 20px;
|
|
|
+}
|
|
|
+</style>
|