my-product-list.Vue 5.58 KB
Newer Older
786817560's avatar
786817560 committed
1

李晓兵's avatar
李晓兵 committed
2 3 4 5 6
/**
* @Author Sean
* @Date 2019/10/22
*/
<template>
786817560's avatar
786817560 committed
7 8 9 10 11 12 13 14 15 16 17 18
  <h-view class="public-style" style="height: 100%">
    <h-header :proportion="[5,1,1]" class="bar-custom">
      <div slot="left" class="h-header-btn">
        <img src="@/assets/userBind/arrow.png" @click="$routeGo()">
        <span>我的收藏</span>
      </div>
    </h-header>
    <h-content>
      <div class="hinput">
        <div class="search-box">
          <input type="text" placeholder="请输入经销商/产品名称/参数项">
          <img src="@/assets/distributorSign/search.png" alt="">
李晓兵's avatar
李晓兵 committed
19
        </div>
786817560's avatar
786817560 committed
20
      </div>
21 22 23 24 25 26 27 28
      <scroll
        ref="scroll"
        :updateData="[productList]"
        :pullUp="true"
      >
      <div class="division-box">

      <list-item v-for="(item,index) in productList" :key="index">
786817560's avatar
786817560 committed
29
        <item :proportion="[1,4]" @click.native="goDetailed(item.product_id,item.collect_status,item.bp_id)">
786817560's avatar
786817560 committed
30
          <div slot="name" class="item-pic">
786817560's avatar
786817560 committed
31 32
              <img :src="item.url" alt="">
            </div>
786817560's avatar
786817560 committed
33
          <div slot="content" class="item-content">
34 35 36 37
            <div class="pro-name">
              <p>{{ item.product_name }}</p>
              <img class="arrow" src="@/assets/productQuery/getIn.png" alt="" >
            </div>
786817560's avatar
786817560 committed
38
            <div class="centers">
39
              <p class="firsts1">{{ item.bp_type_n }}</p>
786817560's avatar
786817560 committed
40 41 42 43 44 45 46 47 48
              <p class="seconds1">{{ item.bp_name }}</p>
            </div>
            <div class="centers">
              <p class="firsts1">参数项</p>
              <p class="seconds1">{{ item.product_code }}</p>
            </div>
          </div>
        </item>
      </list-item>
49 50
      </div>
      </scroll>
786817560's avatar
786817560 committed
51 52
    </h-content>
  </h-view>
李晓兵's avatar
李晓兵 committed
53 54 55
</template>

<script>
786817560's avatar
786817560 committed
56 57 58 59
export default {
  data () {
    return {
      productList: [],
李晓兵's avatar
李晓兵 committed
60
    }
786817560's avatar
786817560 committed
61 62 63 64
  },
  created: function () {
  },
  mounted: function () {
65

786817560's avatar
786817560 committed
66 67 68 69 70 71 72
  },
  updated: function () {
  },
  destroyed: function () {
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
786817560's avatar
786817560 committed
73 74 75
      // if (from.name === 'MyInfo') {
      vm.getList()
      // }
786817560's avatar
786817560 committed
76 77 78 79 80 81 82 83 84
    })
  },
  methods: {
    getList () {
      let vm = this
      let url = $config.basePath + 'my_collection_query'
      let param = {
        user_phone: window.localStorage.getItem('user_phone'),
      }
786817560's avatar
786817560 committed
85
      hlsPopup.showLoading('数据加载中')
786817560's avatar
786817560 committed
86
      vm.$post(url, param).then(function (res) {
786817560's avatar
786817560 committed
87
        hlsPopup.hideLoading()
786817560's avatar
786817560 committed
88 89
        if (res.result === 'S') {
          vm.productList = res.lists
786817560's avatar
786817560 committed
90 91 92
          res.lists.forEach(item => {
                item['url'] = process.env.filePath + 'attachment_id=' + item.product_attachment_id + '&access_token=' + window.localStorage.access_token
              })
93 94 95
          if (res.lists.length > 0 && res.lists.length < 10) {
            vm.$refs.scroll.update(true)
          }
786817560's avatar
786817560 committed
96 97 98 99 100 101
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    // val:产品id, status: 收藏状态
786817560's avatar
786817560 committed
102
    goDetailed (val, status, bp_id) { // 进入产品查询功能明细页面
786817560's avatar
786817560 committed
103 104 105 106 107
      window.sessionStorage.setItem('collect_status', status)
      this.$router.push({
        name: 'ProDetailed',
        params: {
          product_id: val,
786817560's avatar
786817560 committed
108
          bp_id: bp_id,
786817560's avatar
786817560 committed
109 110 111 112 113 114
          //  collect_status: status,
        },
      })
    },
  },
}
李晓兵's avatar
李晓兵 committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
</script>

<style scoped lang="less" rel="stylesheet">
  .hinput {
    position: relative;
    z-index: 50;
    width: 100%;
    height: 50px;
    border-bottom: 1px solid #cccccc70;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    .search-box {
      width: 93.6%;
      height: 36px;
      font-size: 14px;
      color: #B4B4B5;
      letter-spacing: 0;
      font-family: PingFangSC-Regular;
      border: 1px solid rgba(56, 63, 69, 0.60);
      border-radius: 4px;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;

      input {
        width: 90%;
        height: 100%;
        opacity: 0.4;
        border: none;
        line-height: 34px;
      }
    }
  }
151 152
 .division-box {
      padding: 8px;
李晓兵's avatar
李晓兵 committed
153
    }
154 155
    .hls-list-item {
      border-radius: 4px;
李晓兵's avatar
李晓兵 committed
156
    }
157 158 159 160 161 162 163
    .item-pic {
          width: 100px;
          //height: 110px;
          img {
              width: 100%;
              height: 100%;
          }
李晓兵's avatar
李晓兵 committed
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
    .item-content {
          width: 100%;
          margin-left: 20px;
          .pro-name {
            height: 42px;
            width: 100%;
            position: relative;
            border-bottom: 1px solid #F3F3F7;
            .arrow {
              position: absolute;
              width: 16px;
              height: 16px;
              right: 0;
              top: 13px;
            }
            p {
              height: 42px;
              line-height: 42px;
            font-family: PingFangSC-Semibold;
            font-size: 15px;
            color: #4B4A4B;
            letter-spacing: 0;
            font-weight: 600;
            }
          }

          .centers {
              font-family: PingFangSC-Semibold;
              font-size: 13px;
              color: rgba(56,63,69,0.60);
              letter-spacing: 0.5px;
              display: flex;
              flex-direction: row;
              margin-top: 8px;
              .firsts1 {
                  width: 60px;
                  height: 17px;
                  font-family: PingFangSC-Regular;
                  font-size: 13px;
                  color: rgba(56,63,69,0.60);
              }
              .seconds1 {
                  width: 70%;
                  margin-left: 16px;
                  height: auto;
                  font-family: PingFangSC-Regular;
                  font-size: 13px;
                  color: #4B4A4B;
              }
          }

李晓兵's avatar
李晓兵 committed
216
    }
217

李晓兵's avatar
李晓兵 committed
218
</style>