exchange_detail.vue 7.27 KB
Newer Older
1 2
<template>
  <view class="exchange_detail">
3
    <dHeader :title="detail.exchangeTitle"></dHeader>
4 5 6 7 8 9
    <div class="container">
      <div class="header">
        <div class="header-image">
          <image class="img" src="../../static/img/exchange.png"></image>
        </div>
        <div class="header-content">
10
          <div class="header-content-title">
chenwei's avatar
chenwei committed
11
            {{ locale === "zh" ? detailInfo.statusZh : detailInfo.statusEn }}
12
          </div>
13
          <div class="header-content-text">
14 15
            <view class="header-content-small">{{ detail.total }}</view
            >{{ detailInfo.totalCount }}{{ detail.integral }}
16 17 18 19 20
          </div>
        </div>
      </div>
      <div class="nav">
        <div class="nav-image">
chenwei's avatar
chenwei committed
21
          <image class="img" :src="locale === 'zh' ? detailInfo.imgZh : detailInfo.imgEn"></image>
22 23
        </div>
        <div class="nav-content">
24
          <div class="nav-content-text">
chenwei's avatar
chenwei committed
25
            {{ locale === "zh" ? detailInfo.rewardTitleZh : detailInfo.rewardTitleEn }}
26
          </div>
27 28
          <div class="nav-content-tag">
            <div class="tag-image">
29
              <image class="img" src="../../static/img/score_b.png"></image
30
              >{{ detailInfo.oncePointsRequire }}
31
            </div>
32 33 34
            <view class="tag-text">
              {{ detail.num(detailInfo.rewardCount) }}
            </view>
35 36 37 38 39
          </div>
        </div>
      </div>
      <div class="main">
        <div class="main-cell">
40 41 42 43
          <div class="cell-label">{{ detail.activityTime }}</div>
          <div class="cell-content">
            {{ getTimeRange(detailInfo.startTime, detailInfo.endTime) }}
          </div>
44 45
        </div>
        <div class="main-cell">
46
          <div class="cell-label">{{ detail.exchangeOutlets }}</div>
47
          <div class="cell-content">
chenwei's avatar
chenwei committed
48
            {{ locale === "zh" ? detailInfo.nodeTitleZh : detailInfo.nodeTitleEn }}
49
          </div>
50 51
        </div>
        <div class="main-cell">
52
          <div class="cell-label">{{ detail.exchangeType }}</div>
53
          <div class="cell-content">
chenwei's avatar
chenwei committed
54
            {{ locale === "zh" ? detailInfo.redeemTypeZh : detailInfo.redeemTypeEn }}
55 56
          </div>
        </div>
57
        <template v-if="detailInfo.redeemType != 1">
58
          <div class="main-cell">
59
            <div class="cell-label">{{ detail.address }}</div>
60
            <div class="cell-content">
chenwei's avatar
chenwei committed
61
              {{ detailInfo.recipientName }}&ensp;+{{ detailInfo.recipientPhoneNum }},
62 63
              {{ detailInfo.recipientAddress }}
              <view class="red">{{ detail.errorMsg }}</view>
64 65 66
            </div>
          </div>
          <div class="main-cell">
67 68
            <div class="cell-label">{{ detail.courierNum }}</div>
            <div class="cell-content">{{ detailInfo.expressNo }}</div>
69 70
          </div>
          <div class="main-cell">
71 72
            <div class="cell-label">{{ detail.courierCompany }}</div>
            <div class="cell-content">{{ detailInfo.courierCompanyName }}</div>
73 74
          </div>
          <div class="main-cell">
75
            <div class="cell-label">{{ detail.courierTime }}</div>
chenwei's avatar
chenwei committed
76 77 78
            <div class="cell-content">
              {{ formatDate(detailInfo.expressDate) }}
            </div>
79 80
          </div>
        </template>
81
        <div class="main-cell">
82 83
          <div class="cell-label">{{ detail.remark }}</div>
          <div class="cell-content">{{ detailInfo.remark }}</div>
84 85 86 87 88 89 90
        </div>
      </div>
    </div>
  </view>
</template>

<script>
chenwei's avatar
chenwei committed
91
import dHeader from "../../components/dHeader/index.vue"
92 93
export default {
  components: {
chenwei's avatar
chenwei committed
94
    dHeader
95 96 97 98
  },
  data() {
    return {
      id: null,
chenwei's avatar
chenwei committed
99 100
      detailInfo: {}
    }
101 102
  },
  onLoad(route) {
chenwei's avatar
chenwei committed
103 104 105
    console.log(route)
    this.id = route.id
    this.getDetail()
106 107 108
  },
  computed: {
    locale() {
chenwei's avatar
chenwei committed
109
      return this.$lang.locale
110 111
    },
    detail() {
chenwei's avatar
chenwei committed
112 113
      return this.$lang.lang.detail
    }
114 115 116 117 118
  },
  methods: {
    // 获取详情
    getDetail() {
      this.$request
chenwei's avatar
chenwei committed
119
        .post("/app-api/reward/redeem/record/detail", {
chenwei's avatar
chenwei committed
120
          redeemId: this.id
121 122 123
        })
        .then(({ code, data }) => {
          if (code == 0 && data) {
chenwei's avatar
chenwei committed
124
            this.detailInfo = data
125 126 127
          }
        })
        .catch((error) => {
chenwei's avatar
chenwei committed
128 129
          console.log(error)
        })
130 131 132
    },
    // 时间范围返回
    getTimeRange(start, end) {
chenwei's avatar
chenwei committed
133
      return `${this.formatDate(start)}${this.detail.to}${this.formatDate(end)}`
134 135 136
    },
    // 时间戳转换为YYYY-MM-DD HH:mm:ss
    formatDate(timestamp) {
chenwei's avatar
chenwei committed
137 138 139 140 141 142 143 144 145 146 147 148
      if (!timestamp) return ""
      const date = new Date(timestamp)
      const year = date.getFullYear()
      const month = String(date.getMonth() + 1).padStart(2, "0")
      const day = String(date.getDate()).padStart(2, "0")
      const hours = String(date.getHours()).padStart(2, "0")
      const minutes = String(date.getMinutes()).padStart(2, "0")
      const seconds = String(date.getSeconds()).padStart(2, "0")
      return `${year}-${month}-${day}`
    }
  }
}
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
</script>

<style lang="scss">
page {
  /* #ifdef H5 */
  padding-top: 140upx;
  /* #endif */
  /* #ifdef APP-PLUS */
  padding-top: calc(var(--status-bar-height) + 100upx);
  /* #endif */

  box-sizing: border-box;
  height: 100%;
  background: linear-gradient(#317beb, #d3e5fe);
}
.exchange_detail {
  padding: 50upx 40upx;
  height: inherit;
  box-sizing: border-box;
  background-color: #fff;
  border-top-right-radius: 20upx;
  border-top-left-radius: 20upx;
  background: linear-gradient(#fff, #d3e5fe);
}
.header {
  display: flex;
  box-sizing: border-box;
  .header-image {
    width: 90upx;
    height: 90upx;
    .img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
  .header-content {
    margin-left: 20upx;
    display: flex;
    height: inherit;
    flex-direction: column;
    justify-content: space-between;
    .header-content-title {
      font-size: 26upx;
      color: #333;
    }
    .header-content-text {
      display: flex;
      align-items: end;
      font-size: 24upx;
      color: #666;

      .header-content-small {
        margin-right: 10upx;
        font-size: 20upx;
        color: #999;
      }
    }
  }
}
.nav {
  margin-top: 60upx;
  width: 100%;
  display: flex;
  .nav-image {
    width: 140upx;
    height: 140upx;
    .img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
  .nav-content {
    flex: 1;
    margin-left: 20upx;
    display: flex;
    height: inherit;
    flex-direction: column;
    .nav-content-text {
      width: 70%;
      font-size: 24upx;
      color: var(--cb7b);
    }
    .nav-content-tag {
234
      margin-top: auto;
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .tag-image {
        display: flex;
        align-items: center;
        .img {
          width: 32upx;
          height: 32upx;
          object-fit: cover;
        }
      }
      .tag-text {
        font-size: 24upx;
        color: #666;
      }
    }
  }
}
.main {
  margin-top: 60upx;
  width: 100%;
  display: flex;
  flex-direction: column;
  .main-cell {
    margin-top: 20upx;
    width: 100%;
    display: flex;
    align-items: start;
    justify-content: space-between;
    .cell-label {
      width: 30%;
      font-size: 24upx;
      color: #333;
    }
    .cell-content {
      text-align: right;
      width: 70%;
      font-size: 24upx;
      color: var(--cb7b);
      .red {
        color: red;
        font-size: 16upx;
      }
    }
  }
}
</style>