hardware.vue 17.6 KB
Newer Older
zhanglw's avatar
zhanglw committed
1 2 3 4 5
<template>
  <div class="page-body">
    <div class="head-box">
      <div class="head-box-top">
        <div class="top-call" />
zhanglw's avatar
zhanglw committed
6
        <div class="top-call"><img src="@/assets/home_images/cisnet_logo_b.png"></div>
zhanglw's avatar
zhanglw committed
7 8 9 10 11 12 13 14 15 16 17 18
        <div class="top-call"><title-menus ref="titleMenus" menu-index="99" style="padding-top: 15px" /></div>
        <div class="top-call"><user-login ref="userLogin" /></div>
        <div class="top-call"><language-setting ref="languageSetting" /></div>
      </div>
    </div>
    <div class="content-box">
      <div style="width: 88%;padding-left: 9%;">
        <div class="showcase">
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>硬件产品</el-breadcrumb-item>
            <el-breadcrumb-item>{{ title }}</el-breadcrumb-item>
zhanglw's avatar
zhanglw committed
19 20
            <div v-if="query.subProductType">
              <el-breadcrumb-item>{{ subTypeOpts[query.subProductType].label }}</el-breadcrumb-item>
zhanglw's avatar
zhanglw committed
21
            </div>
zhanglw's avatar
zhanglw committed
22 23 24 25 26
          </el-breadcrumb>
        </div>
        <!--查询面板-->
        <div class="search-box">
          <el-row style="padding-top: 16px">
zhanglw's avatar
zhanglw committed
27 28
            <el-col :span="2"><div class="area-title">分类</div></el-col>
            <el-col :span="22" style="border: 1px solid rgba(0,0,0,0.12);">
zhanglw's avatar
zhanglw committed
29
              <div v-for="(item,index) in subTypeOpts" :key="'st_'+index" class="area_item touch" :class="query.subProductType===item.value?'active':''" @click="query.subProductType=item.value">{{ item.label }}</div>
zhanglw's avatar
zhanglw committed
30 31 32 33
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="2"><div class="area-title" style="height: 62px;line-height: 60px;">地区选择</div></el-col>
zhanglw's avatar
zhanglw committed
34 35 36 37 38 39
            <el-col :span="22" style="border: 1px solid rgba(0,0,0,0.12);">
              <div v-for="(item,index) in areaOpts" :key="'a_'+index" class="area_item touch" :class="query.area===item.value?'active':''" @click="query.area=item.value">{{ item.label }}</div>
            </el-col>
          </el-row>
          <el-row style="padding-top: 10px">
            <el-col :span="2">
zhanglw's avatar
zhanglw committed
40 41 42
              <div class="search-item" :class="query.type===''?'active':''">
                <span class="touch label" @click="setQuertType('')">默认排序</span>
                <span v-if="query.type===''">
zhanglw's avatar
zhanglw committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
                  <i v-if="query.sort" class="el-icon-sort-up touch" />
                  <i v-else class="el-icon-sort-down touch" />
                </span>
              </div>
            </el-col>
            <el-col :span="2">
              <div class="search-item" :class="query.type==='hot'?'active':''">
                <span class="touch label" @click="setQuertType('hot')">人气排序</span>
                <span v-if="query.type==='hot'">
                  <i v-if="query.sort" class="el-icon-sort-up touch" />
                  <i v-else class="el-icon-sort-down touch" />
                </span>
              </div>
            </el-col>
            <el-col :span="2">
              <div class="search-item" :class="query.type==='time'?'active':''">
                <span class="touch label" @click="setQuertType('time')">上架时间</span>
                <span v-if="query.type==='time'">
                  <i v-if="query.sort" class="el-icon-sort-up touch" />
                  <i v-else class="el-icon-sort-down touch" />
                </span>
              </div>
            </el-col>
            <el-col :span="18">
              <div class="search-item">
                <span>产品价格区间</span>
                <div style="position: absolute;top: 15px;left: 35%;">
                  <el-input v-model="query.minPrice" placeholder="请输入价格(元)" clearable style="width: 140px" />
                  ~
                  <el-input v-model="query.maxPrice" placeholder="请输入价格(元)" clearable style="width: 140px" />
zhanglw's avatar
zhanglw committed
73
                  <div class="btn touch" @click="search">确 定</div>
zhanglw's avatar
zhanglw committed
74 75 76 77 78 79 80 81 82 83 84
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
        <!--硬件产品展柜-->
        <div style="padding-top: 6px">
          <div v-for="(item,index) in hardwareList" :key="'p_'+index" class="box-card">
            <img v-if="item.isGood" src="@/assets/home_images/recommend.png" class="stamp" title="推荐" style="top: 10px;right: 8px">
            <img v-if="item.isHot" src="@/assets/home_images/hot.png" class="stamp" title="热门" style="top: 0;left: 0">
            <el-image
85 86
              class="touch"
              :src="item.imgSrc?imgSrcStart+'/productPic/'+item.imgSrc:defaultImgProduct"
zhanglw's avatar
zhanglw committed
87
              style="width:284px;height: 284px;margin: 0 32px 4px"
88
              @click="goToDetails(item, '/product/details')"
zhanglw's avatar
zhanglw committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102
            >
              <div slot="placeholder" class="image-slot">加载中<span class="dot">...</span></div>
            </el-image>
            <el-row>
              <el-col :span="21">
                <div class="title touch" :title="item.title" @click="goToDetails(item, '/product/details')">{{ item.title }}</div>
              </el-col>
              <el-col :span="3">
                <img v-if="item.isStore" class="touch" src="@/assets/home_images/to_like_h.png" title="点击取消收藏" @click="storeShowcase(item, 'product')">
                <img v-else class="touch" src="@/assets/home_images/to_like.png" title="点击收藏" @click="storeShowcase(item, 'product')">
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
103
                <div class="subTitle touch" :title="item.subTitle" @click="goToDetailsSupplier(item, '/supplier/details')">{{ item.subTitle }}</div>
zhanglw's avatar
zhanglw committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
              </el-col>
            </el-row>
            <el-row style="margin-top: 6px">
              <el-col :span="3" style="padding-left: 20px">
                <img src="@/assets/home_images/locate.png">
              </el-col>
              <el-col :span="13">
                <div class="area">{{ item.area }}</div>
              </el-col>
              <el-col :span="8">
                <div class="date">{{ item.date }}</div>
              </el-col>
            </el-row>
            <div class="line-btn" style="margin-top: 4px">
              <div class="btn-o" style="width: 150px;border-radius: 10px;box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2);font-size:20px;" @click="inquiry(item, 'product')">询 价</div>
            </div>
          </div>
        </div>
        <div class="pagination">
          <!--          <span style="font-size: 14px; color: #666; margin-right: 8px">{{ total }} 条记录</span>-->
          <el-pagination
            :hide-on-single-page="true"
            :background="true"
            :current-page.sync="page"
            :page-size="pageSize"
            :total="total"
            layout=" prev, pager, next"
            @current-change="pageChange"
          />
        </div>
      </div>
    </div>
    <home-footer ref="homeFooter" />
    <inquiry-view ref="inquiryView" />
    <el-backtop />
zhanglw's avatar
zhanglw committed
139
    <float-btn ref="floatBtn" />
zhanglw's avatar
zhanglw committed
140 141 142 143 144 145 146 147 148
  </div>
</template>
<script>
import default_product from '@/assets/home_images/default_product.png'
import titleMenus from '../components/titleMenusV2'
import userLogin from '../components/userLoginV2'
import languageSetting from '../components/languageSettingV2'
import homeFooter from '../components/homeFooter'
import inquiryView from '../components/inquiryView'
zhanglw's avatar
zhanglw committed
149
import floatBtn from '../components/floatBtn'
zhanglw's avatar
zhanglw committed
150
import { HttpReq } from '@/api/common'
zhanglw's avatar
zhanglw committed
151 152

export default {
zhanglw's avatar
zhanglw committed
153
  components: { titleMenus, userLogin, languageSetting, homeFooter, inquiryView, floatBtn },
zhanglw's avatar
zhanglw committed
154
  dicts: ['product_type', 'product_type_1', 'product_type_2', 'product_type_3', 'product_type_4', 'product_type_5', 'product_type_6', 'product_type_7', 'area_province'],
zhanglw's avatar
zhanglw committed
155 156 157 158 159 160 161 162 163 164
  data() {
    return {
      defaultImgProduct: default_product,
      imgSrcStart: process.env.VUE_APP_BASE_API,
      page: 1,
      pageSize: 12,
      total: 0,
      title: '',
      query: {
        keyword: '',
zhanglw's avatar
zhanglw committed
165
        productType: '1',
zhanglw's avatar
zhanglw committed
166
        area: '',
zhanglw's avatar
zhanglw committed
167 168
        type: '',
        subProductType: '',
zhanglw's avatar
zhanglw committed
169 170 171
        sort: false
      },
      areaOpts: [],
zhanglw's avatar
zhanglw committed
172
      subTypeOpts: [],
zhanglw's avatar
zhanglw committed
173
      keywords: ['曲线记录仪', '液位控制器', '双金属温度计', '位移传感器'],
zhanglw's avatar
zhanglw committed
174
      hardwareList: [],
zhanglw's avatar
zhanglw committed
175 176 177 178 179 180
      throttle: null, // 节流器
      throttleTime: 300
    }
  },
  mounted() {
    this.$nextTick(() => {
181 182 183
      if (this.$route.params) {
        this.query = Object.assign(this.query, this.$route.params)
      }
zhanglw's avatar
zhanglw committed
184 185 186 187
    })
  },
  methods: {
    onDictReady(dict) {
zhanglw's avatar
zhanglw committed
188
      this.areaOpts = [{ value: '', label: '全部' }, ...dict.area_province]
zhanglw's avatar
zhanglw committed
189 190 191 192 193 194 195 196 197 198 199 200 201
      this.title = dict.product_type[this.query.productType - 1].label
      this.subTypeOpts = [{ value: '', label: '全部' }, ...dict['product_type_' + this.query.productType]]
      this.search()
    },
    search() {
      HttpReq.webClientApi.productGetHardwareList({
        page: this.page - 1,
        pageSize: this.pageSize,
        ...this.query
      }).then((res) => {
        this.hardwareList = res.data.hardwareList.data
        this.total = res.data.hardwareList.total
      })
zhanglw's avatar
zhanglw committed
202 203 204 205 206 207 208 209 210 211 212
    },
    keywordClick(item, type) {
      this.query.keyword = item
    },
    setQuertType(type) {
      if (type === this.query.type) {
        this.query.sort = !this.query.sort
      } else {
        this.query.type = type
        this.query.sort = false
      }
zhanglw's avatar
zhanglw committed
213
      this.search()
zhanglw's avatar
zhanglw committed
214 215 216
    },
    // 点击询价
    inquiry(item, type) {
zhanglw's avatar
zhanglw committed
217
      this.$refs.inquiryView.initView(item.id, item.customerId, type)
zhanglw's avatar
zhanglw committed
218 219 220
    },
    // 点击收藏
    storeShowcase(item, type) {
zhanglw's avatar
zhanglw committed
221 222 223 224 225 226 227 228 229
      HttpReq.webClientApi.collectProductOrSupplier({
        id: item.id,
        collect: !item.isStore,
        type: type
      }).then((res) => {
        item.isStore = !item.isStore
        this.$message.warning({
          message: res.msg
        })
zhanglw's avatar
zhanglw committed
230 231 232 233 234 235 236 237 238 239
      })
    },
    // 跳转到详情
    goToDetails(item, path) {
      if (item) {
        this.$router.push({ path: `${path}/${item.id || 123}` })
      } else {
        this.$router.push({ path: `${path}` })
      }
    },
240 241 242 243 244 245 246
    goToDetailsSupplier(item, path) {
      if (item) {
        this.$router.push({ path: `${path}/${item.customerId || 123}` })
      } else {
        this.$router.push({ path: `${path}` })
      }
    },
zhanglw's avatar
zhanglw committed
247 248
    pageChange(e) {
      this.page = e
zhanglw's avatar
zhanglw committed
249
      this.search()
zhanglw's avatar
zhanglw committed
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 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
    }
  }
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.touch {
  cursor:pointer;
}
.clear {
  clear: both
}
.ellipsis {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 6;
  text-overflow: ellipsis;
}
.pagination {
  margin-top: 23px;
  text-align: center;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  >>>.el-pagination.is-background .el-pager li {
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    text-align: center;
    background-color: #fff;
    color: #000000;
    border: 1px solid #e5e5ea;
  }
  /* 激活后的样式 */
  >>>.el-pagination.is-background .el-pager li:not(.disabled).active {
    background-color: #ffffff;
    color: #0366ed;
    border: 1px solid #0366ed;
    text-align: center;
  }
  /* 修改左右箭头样式 */
  >>>.el-pagination .btn-next .el-icon, >>>.el-pagination .btn-prev .el-icon {
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    text-align: center;
    background-color: #fff;
    color: #e5e5ea;
    border: 1px solid #e5e5ea;
  }
  >>>.el-pager {
    height: 35.5px !important;
  }
  >>>.number, >>>.el-icon {
    height: 35.5px !important;
    line-height: 35.5px !important;
  }
}
.head-box {
  width: 100vw;
  top: 0;
  position: fixed;
  background: none repeat scroll 0 0 white;
  z-index: 999;
  box-shadow: 0px 3px 7px 0px rgba(0,0,0,0.2);
  .head-box-top {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    .top-call {
      height: 80px;
      padding-top: 15px;
    }
  }
}
.content-box {
  margin-top: 94px;
  user-select: none;
  .box-block {
    width: 100%;
    margin: 12px 0;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 1px 2px 8px 0 rgba(0,0,0,0.12);
    border-radius: 10px;
    .box-title {
      padding-top: 20px;
      padding-left: 10px;
      font-size: 22px;
      font-weight: bold;
    }
    .box-title:hover {
      color: #0457C7
    }
    .content {
      height: 200px;
      padding: 4px 30px 20px 10px;
      font-size: 16px;
      font-weight: 600;
      line-height: 32px;
      color: #666;
    }
  }
  .box-card {
    display: inline-block;
    position: relative;
    margin: 12px;
    padding: 10px 0;
    width: 350px;
    background: #FFFFFF;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 1px 2px 8px 0 rgba(0,0,0,0.12);
    border-radius: 10px;
    .line-text {
      width: 100%;
      text-align: center;
      padding: 5px;
      font-size: 18px;
      font-weight: bolder;
      opacity: 0.85;
    }
    .line-text:hover {
      opacity: 1;
    }
    .float-title {
      width: 344px;
      position: absolute;
      padding: 5px;
      top: 200px;
      left: 2px;
      text-align: center;
      font-weight: 600;
      color: #fff;
      background: rgba(0,0,0,0.6);
      opacity: 0.9;
    }
    .float-title:hover {
      opacity: 1;
    }
    .title {
      width: 305px;
      padding: 2px 20px;
      font-size: 18px;
      color: #333333;
      overflow:hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      -o-text-overflow:ellipsis;
    }
    .title:hover {
      font-weight: 600;
    }
    .subTitle {
      width: 260px;
      padding: 2px 20px;
      font-size: 15px;
      color: #1961C5;
      overflow:hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      -o-text-overflow:ellipsis;
    }
    .area {
      padding: 2px 0;
      font-size: 17px;
      color: #666666;
    }
    .date {
      padding: 2px 10px;
      font-size: 17px;
      color: #999999;
    }
    .stamp {
      border-style: none;
      position: absolute;
      z-index: 99;
    }
  }
  .more {
    font-size: 18px;
    font-weight: 600;
    color: #0457C7;
    opacity: 0.7;
  }
  .more:hover {
    opacity: 1;
  }
  .line-title {
    padding: 6px 0;
    position: relative;
    border-bottom: 3px solid #0457C7;
    font-size: 24px;
    color: #333333;
    .title-point {
      width: 8px;
      height: 21px;
      position: absolute;
      top: 9px;
      background: #0457c7;
    }
    .title-text {
      padding-left: 14px;
      font-weight: 600;
    }
    .title-line{
      width: 100%;
      position: absolute;
      bottom: -7px;
      border-bottom: 2px solid #1961C5;
      opacity: 0.35
    }
  }
}
.search-box {
  padding-top: 12px;
  width: 100%;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #666666;
  user-select: none;
  .search-item {
    width: 100%;
    height: 38px;
    display: inline-block;
    padding: 8px 20px;
    background: #F7F7F7;
    border: 1px solid rgba(0,0,0,0.12);
    overflow:hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    -o-text-overflow:ellipsis;
    .label:hover {
      font-weight: 600;
    }
    .btn {
      width: 74px;
      padding: 3px;
      margin-left: 12px;
      display: inline-block;
      background: #1961C5;
      border-radius: 6px;
      color: white;
      text-align: center;
      opacity: 0.7;
    }
    .btn:hover {
      opacity: 1;
    }
  }
  .area-title {
    background: #F7F7F7;
    border: 1px solid rgba(0,0,0,0.12);
    text-align: center;
zhanglw's avatar
zhanglw committed
503 504
    height: 32px;
    line-height: 32px;
zhanglw's avatar
zhanglw committed
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
  }
  .area_item {
    height: 30px;
    padding: 6px 12px;
    display: inline-block;
  }
  .area_item:hover {
    font-weight: 600;
  }
  .active {
    color: #1961C5;
  }
  .search-tools {
    width: 100%;
    .btn{
      width: 76%;
      height: 38px;
      border: 2px solid #1961C5;
      border-radius: 8px;
      background: #1961C5;
      font-family: Source Han Sans CN;
      font-weight: 400;
      font-size: 21px;
      color: #ffffff;
      opacity: 0.7;
    }
    .btn:hover {
      opacity: 1;
    }
    >>>.el-input__inner {
      height: 38px;
      border: 2px solid #1961C5;
      border-radius: 8px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      font-size: 18px;
      color: #333333;
      opacity: 0.7;
    }
    >>>.el-input__inner:hover {
      opacity: 1;
    }
  }
  .search-keyword {
    padding: 5px 0;
    font-family: Source Han Sans CN;
    font-weight: 400;
    font-size: 14px;
    text-align: left;
    .label {
      padding: 1px 15px 1px;
      color: #333333;
      cursor:pointer;
      user-select: none;
    }
    .label:hover {
      color: #1961C5;
    }
  }
}
.line-btn {
  display: flex;
  justify-content: center;
  font-family: Source Han Sans CN;
  font-weight: 400;
  .btn-o {
    margin: 0 25px;
    width: 360px;
    padding: 6px 10px;
    background: #F7601A;
    box-shadow: 0 3px 6px 0 rgba(0,0,0,0.2);
    text-align: center;
    border: 1px solid transparent;
    font-size: 22px;
    color: #FFFFFF;
    cursor:pointer;
    user-select: none;
  }
  .btn-o:hover {
    border: 1px solid rgba(30, 144, 255, 0.8);
    color: #1482f0;
  }
  .btn-l {
    margin: 0 25px;
    width: 360px;
    padding: 10px;
    background: #1961C5;
    box-shadow: 0 3px 6px 0 rgba(0,0,0,0.2);
    text-align: center;
    border: 1px solid transparent;
    font-size: 22px;
    color: #FFFFFF;
    cursor:pointer;
    user-select: none;
  }
  .btn-l:hover {
    border: 1px solid rgba(0,0,0,0.3);
    color: #F7601A;
  }
  .btn-b {
    margin: 0 10px;
    width: 168px;
    padding: 6px;
    background: #EFF6FF;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2);
    text-align: center;
    font-size: 20px;
    color: #1961C5;
    cursor:pointer;
    user-select: none;
  }
  .btn-b:hover {
    border: 1px solid rgba(30, 144, 255, 0.9);
  }
  .active {
    color: #FFFFFF;
    font-weight: 400;
    background: #1961C5;
  }
}
</style>