|
|
@@ -0,0 +1,297 @@
|
|
|
+<template>
|
|
|
+ <div class="orderList">
|
|
|
+ <Back />
|
|
|
+ <div class="top">
|
|
|
+ <div
|
|
|
+ v-for="item in topData"
|
|
|
+ :key="item.id"
|
|
|
+ @click="topId = item.id"
|
|
|
+ :class="{ active: topId === item.id }"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="none" v-if="data.length === 0">
|
|
|
+ <img src="../assets/img/none.png" alt="" />
|
|
|
+ <p>暂无预约活动</p>
|
|
|
+ </div>
|
|
|
+ <div class="row" v-for="item in data" :key="item.id" v-else>
|
|
|
+ <div
|
|
|
+ class="rowTop"
|
|
|
+ :class="{
|
|
|
+ end: item.status == 3,
|
|
|
+ notYet: item.status == 1,
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <div class="ll">
|
|
|
+ <h4>{{ item.activityName }}</h4>
|
|
|
+ <div @click="toDetail(item.activityId)">查看活动详情<img src="../assets/img/to.png" alt="" /></div>
|
|
|
+ </div>
|
|
|
+ <div class="rr">
|
|
|
+ <p>申请时间:{{ item.createTime }}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="rowFl">
|
|
|
+ <div>
|
|
|
+ <img src="../assets/img/l1.png" alt="" />
|
|
|
+ <p>参观日期:{{ item.joinTime }} {{ item.week }}</p>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <img src="../assets/img/l2.png" alt="" />
|
|
|
+ <p>参观时段:{{ item.timeBucket }}</p>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <img src="../assets/img/l3.png" alt="" />
|
|
|
+ <p>参观人数:{{ item.num }}人</p>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="btnn4 btnn"
|
|
|
+ v-if="item.status == 1"
|
|
|
+ @click="cancel(item.id)"
|
|
|
+ >
|
|
|
+ 取消预约
|
|
|
+ </div>
|
|
|
+ <div class="btnn" v-if="item.status == 2">进行中</div>
|
|
|
+ <div class="btnn btnn2" v-else-if="item.status == 1">暂未开始</div>
|
|
|
+ <div class="btnn btnn3" v-else>已结束</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <ToIndex />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { Dialog, Notify } from "vant";
|
|
|
+import ToIndex from "../components/ToIndex.vue";
|
|
|
+import Back from "../components/Back.vue";
|
|
|
+import { applyQuery, applyRemove } from "@/utlis/api";
|
|
|
+export default {
|
|
|
+ name: "orderList",
|
|
|
+ components: { Back, ToIndex },
|
|
|
+ data() {
|
|
|
+ //这里存放数据
|
|
|
+ return {
|
|
|
+ ID: "",
|
|
|
+ topId: "",
|
|
|
+ topData: [
|
|
|
+ { id: "", name: "全部" },
|
|
|
+ { id: 2, name: "活动中" },
|
|
|
+ { id: 1, name: "未开始" },
|
|
|
+ { id: 3, name: "已结束" },
|
|
|
+ ],
|
|
|
+ data: [],
|
|
|
+ apiId: "",
|
|
|
+ };
|
|
|
+ },
|
|
|
+ //监听属性 类似于data概念
|
|
|
+ computed: {},
|
|
|
+ //监控data中的数据变化
|
|
|
+ watch: {
|
|
|
+ topId(val) {
|
|
|
+ this.getList({ identity: this.ID, status: val });
|
|
|
+ // 回到顶点
|
|
|
+ window.scrollTo({ top: 0 });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ //方法集合
|
|
|
+ methods: {
|
|
|
+ // 点击查看活动详情
|
|
|
+ toDetail(id){
|
|
|
+ this.$router.push(`/detail/${id}`)
|
|
|
+ },
|
|
|
+ async beforeClose(action, done) {
|
|
|
+ if (action === "confirm") {
|
|
|
+ let res = await applyRemove(this.apiId);
|
|
|
+ done();
|
|
|
+ if (res.code === 0) {
|
|
|
+ Notify({ type: "success", message: "取消成功" });
|
|
|
+ this.getList({ identity: this.ID, status: this.topId });
|
|
|
+ } else Notify({ type: "warning", message: res.msg });
|
|
|
+ } else {
|
|
|
+ done();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 点击取消预约
|
|
|
+ cancel(id) {
|
|
|
+ this.apiId = id;
|
|
|
+ Dialog.confirm({
|
|
|
+ title: "提醒",
|
|
|
+ message: "您是否确定取消预约?",
|
|
|
+ beforeClose: this.beforeClose,
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ // 封装一个获取列表的方法
|
|
|
+ async getList(data) {
|
|
|
+ let timeChange = {
|
|
|
+ 1: "周一",
|
|
|
+ 2: "周二",
|
|
|
+ 3: "周三",
|
|
|
+ 4: "周四",
|
|
|
+ 5: "周五",
|
|
|
+ 6: "周六",
|
|
|
+ 0: "周日",
|
|
|
+ };
|
|
|
+ let res = await applyQuery(data);
|
|
|
+ res.data.forEach((v) => {
|
|
|
+ // 计算参观日期是周几
|
|
|
+ let temp = v.joinTime.split("-");
|
|
|
+ let weeks = new Date(temp[0], parseInt(temp[1] - 1), temp[2]);
|
|
|
+ v.week = timeChange[weeks.getDay()];
|
|
|
+ // 超出当前时间的改变状态为已结束
|
|
|
+ });
|
|
|
+ this.data = res.data;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ //生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ created() {
|
|
|
+ this.ID = this.$route.params.ID;
|
|
|
+ this.getList({ identity: this.ID });
|
|
|
+ },
|
|
|
+ //生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
+ mounted() {},
|
|
|
+ beforeCreate() {}, //生命周期 - 创建之前
|
|
|
+ beforeMount() {}, //生命周期 - 挂载之前
|
|
|
+ beforeUpdate() {}, //生命周期 - 更新之前
|
|
|
+ updated() {}, //生命周期 - 更新之后
|
|
|
+ beforeDestroy() {}, //生命周期 - 销毁之前
|
|
|
+ destroyed() {}, //生命周期 - 销毁完成
|
|
|
+ activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang='less' scoped>
|
|
|
+.orderList {
|
|
|
+ padding: 80px 20px 60px;
|
|
|
+ .top {
|
|
|
+ z-index: 998;
|
|
|
+ background-color: #fff;
|
|
|
+ max-width: 500px;
|
|
|
+ padding: 24px 10px 0 50px;
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ & > div {
|
|
|
+ text-align: center;
|
|
|
+ padding-bottom: 6px;
|
|
|
+ font-size: 16px;
|
|
|
+ color: #696969;
|
|
|
+ }
|
|
|
+ .active {
|
|
|
+ color: #858b6b;
|
|
|
+ border-bottom: 3px solid #858b6b;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .none {
|
|
|
+ margin-top: 100px;
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ & > img {
|
|
|
+ width: 200px;
|
|
|
+ }
|
|
|
+ & > p {
|
|
|
+ padding-left: 20px;
|
|
|
+ color: #858b6b;
|
|
|
+ margin-top: 15px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .row {
|
|
|
+ width: 100%;
|
|
|
+ height: 230px;
|
|
|
+ border-radius: 5px;
|
|
|
+ overflow: hidden;
|
|
|
+ box-shadow: 3px 3px 10px 3px #ccc;
|
|
|
+ margin-bottom: 24px;
|
|
|
+ .rowTop {
|
|
|
+ padding: 10px 15px 0;
|
|
|
+ color: #fff;
|
|
|
+ height: 90px;
|
|
|
+ background-color: #be9c6c;
|
|
|
+ .ll {
|
|
|
+ height: 40px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ & > h4 {
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ letter-spacing: 1px;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ font-weight: 700;
|
|
|
+ }
|
|
|
+ & > div {
|
|
|
+ min-width: 104px;
|
|
|
+ font-size: 14px;
|
|
|
+ & > img {
|
|
|
+ vertical-align: bottom;
|
|
|
+ margin-left: 5px;
|
|
|
+ width: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .rr {
|
|
|
+ margin-top: 5px;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .end {
|
|
|
+ background-color: #bfbfbf;
|
|
|
+ }
|
|
|
+ .notYet {
|
|
|
+ background-color: #6f774f;
|
|
|
+ }
|
|
|
+ .rowFl {
|
|
|
+ position: relative;
|
|
|
+ height: 140px;
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 10px 20px 0;
|
|
|
+ & > div {
|
|
|
+ height: 40px;
|
|
|
+ align-items: center;
|
|
|
+ display: flex;
|
|
|
+ & > img {
|
|
|
+ width: 16px;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+ & > p {
|
|
|
+ color: #696969;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .btnn {
|
|
|
+ position: absolute;
|
|
|
+ right: 5px;
|
|
|
+ bottom: 14px;
|
|
|
+ width: 100px;
|
|
|
+ height: 36px;
|
|
|
+ border-radius: 20px;
|
|
|
+ color: #be9c6c;
|
|
|
+ // background-color: #be9c6c;
|
|
|
+ color: #be9c6c;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .btnn2 {
|
|
|
+ color: #6f774f;
|
|
|
+ // background-color: #6f774f;
|
|
|
+ }
|
|
|
+ .btnn3 {
|
|
|
+ color: #bfbfbf;
|
|
|
+ // background-color: #bfbfbf;
|
|
|
+ }
|
|
|
+ .btnn4 {
|
|
|
+ color: #fff;
|
|
|
+ bottom: 50px;
|
|
|
+ background-color: #6f774f;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|