Blame view

src/pages/details/details.vue 5.36 KB
25347a006   范牧   详情页重构
1
2
  <template>
    <view class="container">
3cda19af7   范牧   详情页-售后保障
3
      <view class="basic_info">
25347a006   范牧   详情页重构
4
5
6
7
8
9
10
11
12
        <!-- 轮播图 -->
        <swiper
          class="swiperImage"
          :indicator-dots="true"
          :autoplay="true"
          :interval="4000"
          :duration="500"
        >
          <swiper-item
3cda19af7   范牧   详情页-售后保障
13
            v-for="(item, index) in carousel"
25347a006   范牧   详情页重构
14
15
16
17
18
19
20
21
22
23
            :key="index"
          >
            <image
              :src="item"
              mode="scaleToFill"
            ></image>
          </swiper-item>
        </swiper>
        <!-- 产品价格及购买人数 -->
        <view class="info_pay">
3cda19af7   范牧   详情页-售后保障
24
25
26
27
28
          <view>¥{{goodsInfo.price || '暂无'}}<span
              v-if="goodsInfo.discountPrice"
              class="info_pay_discount"
            >¥{{goodsInfo.discountPrice}}</span></view>
          <span class="info_pay_number">{{goodsInfo.tradeNumber || '暂无'}}人购买过</span>
25347a006   范牧   详情页重构
29
30
31
        </view>
        <!-- 产品名称 -->
        <view class="info_name">
3cda19af7   范牧   详情页-售后保障
32
33
34
35
36
          <text class="info_name_name">{{goodsInfo.name || '暂无'}}</text>
          <view class="info_name_share">
            <image src="/static/img/detail/share-icon.png"></image>
            <text>分享</text>
          </view>
25347a006   范牧   详情页重构
37
38
39
40
41
42
43
44
        </view>
        <!-- 产品售后信息 -->
        <view class="info_after">
          <span>支持7天无理由退货</span>
          <span>顺丰发货</span>
          <span>30天质量保证</span>
        </view>
      </view>
3cda19af7   范牧   详情页-售后保障
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
      <view class="detail_info">
        <!-- 详细信息菜单 -->
        <view class="screen_bar">
          <view
            v-for="item in screenItems"
            :key="item.current"
            @click="tabChange(item.current)"
          >
            <view
              class="screen_item"
              v-bind:class="{ item_active: item_current === item.current }"
            >{{ item.text || '暂无' }}</view>
          </view>
        </view>
        <!-- 售后保障 -->
        <view
          class="screen_item"
          v-if="item_current === 2"
        >
          <AfterSails />
        </view>
      </view>
25347a006   范牧   详情页重构
67
68
69
70
71
    </view>
  </template>
  
  <script>
  import store from '@/store'
3cda19af7   范牧   详情页-售后保障
72
  import AfterSails from './components/AfterSails'
25347a006   范牧   详情页重构
73
74
75
  // import BottomSheet from '@/components/BottomSheet.vue'
  
  export default {
3cda19af7   范牧   详情页-售后保障
76
77
78
    components: {
      AfterSails,
    },
25347a006   范牧   详情页重构
79
80
81
    data () {
      return {
        pid: 7, // 产品ID
3cda19af7   范牧   详情页-售后保障
82
83
84
85
86
87
88
89
        skId: undefined, // skuId
        // 详细信息菜单
        item_current: 0,
        screenItems: [
          { current: 0, text: '商品介绍' },
          { current: 1, text: '规格参数' },
          { current: 2, text: '售后保障' },
        ],
25347a006   范牧   详情页重构
90
91
92
93
      }
    },
    onLoad({ pid = this.pid, sk_id: skId }) {
      this.pid = pid
3cda19af7   范牧   详情页-售后保障
94
      this.skId = skId
25347a006   范牧   详情页重构
95
96
97
98
99
  
      // 获取产品详情
      this.getDetails({ pid, skId })
    },
    computed: {
3cda19af7   范牧   详情页-售后保障
100
101
102
103
104
105
106
107
      // 获取轮播图数据
      carousel() {
        return this.$store.state.details.carousel
      },
      // 商品基本信息
      goodsInfo() {
        return this.$store.state.details.goodsInfo
      },
25347a006   范牧   详情页重构
108
109
110
111
    },
    methods: {
      // 获取产品详情
      getDetails({ pid, skId }) {
3cda19af7   范牧   详情页-售后保障
112
        store.dispatch('details/details', {
25347a006   范牧   详情页重构
113
114
          pid,
          sk_id: skId,
25347a006   范牧   详情页重构
115
116
        })
      },
3cda19af7   范牧   详情页-售后保障
117
118
119
120
121
      // 切换详细信息菜单
      tabChange (e) {
        if (this.current !== e) {
          this.item_current = e
        }
25347a006   范牧   详情页重构
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
      },
    },
  }
  </script>
  
  <style lang="scss">
  .container {
    background-color: #f8f8f8;
    font-family: "PingFangSC-Regular";
    // 板块样式
    > view {
      background: #ffffff;
      margin-bottom: 10px;
      padding: 8px 20px 8px 20px;
      box-sizing: border-box;
    }
3cda19af7   范牧   详情页-售后保障
138
139
    // 基础信息板块
    .basic_info {
25347a006   范牧   详情页重构
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
      // 轮播图
      .swiperImage {
        width: 684rpx;
        height: 480rpx;
        image {
          max-width: 100%;
          max-height: 100%;
          border-radius: 16rpx;
        }
      }
      // 产品价格及购买人数
      .info_pay {
        color: #eb5d3b;
        font-size: 18px;
        margin-top: 5px;
        font-family: "PingFangSC-Semibold";
        display: flex;
        justify-content: space-between;
3cda19af7   范牧   详情页-售后保障
158
159
160
161
162
163
        .info_pay_discount {
          text-decoration: line-through;
          margin-left: 8rpx;
          color: #999;
          font-size: 14px;
        }
25347a006   范牧   详情页重构
164
165
166
167
168
169
170
        .info_pay_number {
          color: #999;
          font-size: 14px;
        }
      }
      // 产品名称
      .info_name {
25347a006   范牧   详情页重构
171
        margin-top: 5px;
3cda19af7   范牧   详情页-售后保障
172
173
174
        display: flex;
        justify-content: space-between;
        .info_name_name {
25347a006   范牧   详情页重构
175
          margin-right: 10px;
3cda19af7   范牧   详情页-售后保障
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
          font-size: 16px;
          font-family: "PingFangSC-Semibold";
          max-width: 592rpx;
        }
        .info_name_share {
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          align-items: center;
          margin-top: 14rpx;
          > image {
            height: 40rpx;
            width: 40rpx;
          }
          > text {
            font-family: PingFangSC-Regular;
            font-size: 12px;
            color: #999;
            letter-spacing: -0.23px;
          }
25347a006   范牧   详情页重构
196
197
198
199
200
201
        }
      }
      // 售后服务
      .info_after {
        font-size: 10px;
        color: #999;
3cda19af7   范牧   详情页-售后保障
202
        margin-top: 20rpx;
25347a006   范牧   详情页重构
203
204
205
206
207
208
        > span {
          height: 14px;
          margin-right: 10px;
        }
      }
    }
3cda19af7   范牧   详情页-售后保障
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
    // 详细信息
    .detail_info {
      .screen_bar {
        width: 670rpx;
        margin-top: 20rpx;
        margin-bottom: 24rpx;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        color: #333333;
        transition: all 0.2s;
      }
      .item_active {
        border-bottom: 4rpx solid #ff6b4a;
      }
      .screen_item {
        font-size: 32rpx;
        color: #333333;
        display: flex;
        transition: all 0.2s;
      }
    }
25347a006   范牧   详情页重构
233
234
  }
  </style>