|
|
@@ -0,0 +1,445 @@
|
|
|
+<config>
|
|
|
+{
|
|
|
+'navigationBarTitleText': '',
|
|
|
+'navigationBarTextStyle':'black',
|
|
|
+'backgroundColorBottom': '#fff',
|
|
|
+'navigationStyle':'custom',
|
|
|
+}
|
|
|
+</config>
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <custom-bar title="产品详情" :pre="0" :dark="false" :barTop="375"></custom-bar>
|
|
|
+ <banner :banners="banners" :height="375" :radius="0"></banner>
|
|
|
+ <div class="main" id="main">
|
|
|
+ <div class="info">
|
|
|
+ <div class="ad">
|
|
|
+ <span>可在MT展厅线下体验,点击查看地址</span>
|
|
|
+ <img src="../static/imgs/iocn_dingwei.png" alt="" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="info-top">
|
|
|
+ <div class="title">
|
|
|
+ {{ getName(productInfo) }}
|
|
|
+ </div>
|
|
|
+ <div class="sub">{{ productInfo.model }}</div>
|
|
|
+
|
|
|
+ <div class="btn">
|
|
|
+ <van-icon
|
|
|
+ custom-class="my-icon"
|
|
|
+ name="icon-icon_collect"
|
|
|
+ :size="32"
|
|
|
+ color="#BCC1CC"
|
|
|
+ class-prefix="iconfont"
|
|
|
+ />
|
|
|
+ <van-icon
|
|
|
+ custom-class="my-icon"
|
|
|
+ name="icon-icon_share"
|
|
|
+ :size="32"
|
|
|
+ color="#BCC1CC"
|
|
|
+ class-prefix="iconfont"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <van-divider />
|
|
|
+
|
|
|
+ <van-cell-group :border="false">
|
|
|
+ <van-cell :title="$t('chan-pin-pin-pai')" :border="false" :value="productInfo.brand" />
|
|
|
+ <van-cell :title="$t('ying-wen-pin-ming')" :border="false" :value="productInfo.enName" />
|
|
|
+ <van-cell :title="$t('chan-pin-lei-bie')" :border="false" :value="productCategoryName" />
|
|
|
+ <van-cell title="平均交货周期" :border="false" :value="productInfo.averageLeadTime" />
|
|
|
+ <van-cell title="产地" :border="false" :value="productInfo.origin" />
|
|
|
+ <van-cell title="应用领域" :border="false" :value="applicationField" />
|
|
|
+ <van-cell title="产品标签" :border="false">
|
|
|
+ <div>
|
|
|
+ <van-tag plain v-for="(item, index) in tags" :key="index">{{ item }}</van-tag>
|
|
|
+ </div>
|
|
|
+ </van-cell>
|
|
|
+ </van-cell-group>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="vendor">
|
|
|
+ <van-icon :name="vendorInfo.logo" :size="60" />
|
|
|
+ <div class="vendor-info">
|
|
|
+ <h3>{{ getName(vendorInfo, ['chCompanyName', 'enCompanyName']) }}</h3>
|
|
|
+
|
|
|
+ <div class="vendor-btn">
|
|
|
+ <van-button :color="$colors.warn" size="small">进入展商</van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="detail" v-if="productInfo.id" id="detail">
|
|
|
+ <van-tabs
|
|
|
+ :active="hotActive"
|
|
|
+ @change="tabClick"
|
|
|
+ :line-width="22"
|
|
|
+ :line-height="3"
|
|
|
+ sticky
|
|
|
+ :offset-top="71"
|
|
|
+ >
|
|
|
+ <van-tab title="图文详情">
|
|
|
+ <div class="detail-content">
|
|
|
+ <rich-text v-if="detailImg" :nodes="detailImg"></rich-text>
|
|
|
+ <van-empty v-else description="暂无详情" />
|
|
|
+ </div>
|
|
|
+ </van-tab>
|
|
|
+ <van-tab title="详细参数">
|
|
|
+ <div class="detail-content">
|
|
|
+ <parameter :productId="productId"></parameter>
|
|
|
+ </div>
|
|
|
+ </van-tab>
|
|
|
+ <van-tab title="PDF资料">PDF资料</van-tab>
|
|
|
+ </van-tabs>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="fixed-bottom">
|
|
|
+ <div class="fixed-bottom-content">
|
|
|
+ <div class="btn-icon" @click="navigateTo('/pagesProduct/Contrast?productId=' + productId)">
|
|
|
+ <van-icon name="icon-xiangqingye_iocn_vs" :size="24" class-prefix="iconfont" />
|
|
|
+ <div class="text">对比</div>
|
|
|
+ </div>
|
|
|
+ <div class="btn-icon">
|
|
|
+ <van-icon
|
|
|
+ name="icon-xiangqingye_iocn_yixiangdan"
|
|
|
+ :info="intentionList.length > 0 ? intentionList.length : ''"
|
|
|
+ :size="24"
|
|
|
+ class-prefix="iconfont"
|
|
|
+ />
|
|
|
+ <div class="text">意向单</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn-list">
|
|
|
+ <van-button
|
|
|
+ :color="$colors.prim"
|
|
|
+ :radius="0"
|
|
|
+ :disabled="isIntented"
|
|
|
+ @click="addIntentionList"
|
|
|
+ >{{ isIntented ? '已添加' : '添加意向单' }}</van-button
|
|
|
+ >
|
|
|
+ <van-button :color="$colors.warn" type="primary" :radius="0">询价</van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import Banner from '../components/Banner.vue';
|
|
|
+import CustomBar from '../components/bar/CustomBar.vue';
|
|
|
+import Parameter from '../components/product/Parameter.vue';
|
|
|
+import { mapState } from 'vuex';
|
|
|
+export default {
|
|
|
+ components: { CustomBar, Banner, Parameter },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ productId: 0,
|
|
|
+ productInfo: {},
|
|
|
+ vendorInfo: {},
|
|
|
+ hotActive: 0,
|
|
|
+ detailTop: 0
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['intentionList']),
|
|
|
+ banners() {
|
|
|
+ if (this.productInfo.img) {
|
|
|
+ return this.productInfo.img.split(',').map(item => {
|
|
|
+ return {
|
|
|
+ img: item + '?x-oss-process=image/resize,m_fill,h_750,w_750'
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return [];
|
|
|
+ },
|
|
|
+ applicationField() {
|
|
|
+ let list = this.productInfo.applicationField ? [...this.productInfo.applicationField] : [];
|
|
|
+ list = list.map(item => {
|
|
|
+ return this.getName(item);
|
|
|
+ });
|
|
|
+ if (this.productInfo.customApplicationField) {
|
|
|
+ const _list = this.productInfo.customApplicationField.split(',');
|
|
|
+
|
|
|
+ list = [...list, ..._list];
|
|
|
+ }
|
|
|
+ return list.join('、');
|
|
|
+ },
|
|
|
+ tags() {
|
|
|
+ return this.productInfo.tag || [];
|
|
|
+ },
|
|
|
+ productCategoryName() {
|
|
|
+ if (this.productInfo.productCategory) {
|
|
|
+ return this.getName(this.productInfo.productCategory);
|
|
|
+ } else {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ detailImg() {
|
|
|
+ let detail = this.productInfo.detailImg || '';
|
|
|
+ if (detail) {
|
|
|
+ detail = detail.replace(/<img/g, `<img class='detaiImg' `);
|
|
|
+ }
|
|
|
+ return detail;
|
|
|
+ },
|
|
|
+ isIntented() {
|
|
|
+ const list = [...this.intentionList];
|
|
|
+ return list
|
|
|
+ .map(item => {
|
|
|
+ return Number(item.id);
|
|
|
+ })
|
|
|
+ .includes(Number(this.productId));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ if (options.id) {
|
|
|
+ this.productId = options.id;
|
|
|
+ this.$http
|
|
|
+ .get(`/product/getDto/${options.id}`)
|
|
|
+ .then(res => {
|
|
|
+ this.productInfo = res;
|
|
|
+ return this.$http.get('/vendorInfo/getHome/' + res.vendorInfoId);
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.vendorInfo = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onPageScroll() {},
|
|
|
+ methods: {
|
|
|
+ tabClick(e) {
|
|
|
+ console.log(e);
|
|
|
+ if (!this.detailTop) {
|
|
|
+ wx.createSelectorQuery()
|
|
|
+ .select('#main')
|
|
|
+ .boundingClientRect(rect => {
|
|
|
+ const mainHeight = rect.height;
|
|
|
+ wx.createSelectorQuery()
|
|
|
+ .select('#detail')
|
|
|
+ .boundingClientRect(rect => {
|
|
|
+ this.detailTop = mainHeight - rect.height + 375 - 51;
|
|
|
+ wx.pageScrollTo({
|
|
|
+ scrollTop: this.detailTop,
|
|
|
+ duration: 300
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .exec();
|
|
|
+ })
|
|
|
+ .exec();
|
|
|
+ } else {
|
|
|
+ wx.pageScrollTo({
|
|
|
+ scrollTop: this.detailTop,
|
|
|
+ duration: 300
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.hotActive = e.detail.index;
|
|
|
+ if (e.detail.index === 2) {
|
|
|
+ wx.downloadFile({
|
|
|
+ // 示例 url,并非真实存在
|
|
|
+ url: 'https://imt.oss-cn-hangzhou.aliyuncs.com/application/2020-11-13-16-57-03rREcAPTN.pdf',
|
|
|
+ success: res => {
|
|
|
+ const filePath = res.tempFilePath;
|
|
|
+ this.hotActive = 0;
|
|
|
+ wx.openDocument({
|
|
|
+ filePath: filePath,
|
|
|
+ success: res => {}
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loginMethods() {
|
|
|
+ this.$store.dispatch('getIntentionList');
|
|
|
+ },
|
|
|
+ addIntentionList() {
|
|
|
+ if (this.isIntented) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.checkLogin()
|
|
|
+ .then(() => {
|
|
|
+ return this.$http.post('/intentionList/add', {
|
|
|
+ productId: this.productId,
|
|
|
+ type: 'BATCH_INQUIRY'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ console.log('aaaa');
|
|
|
+ this.toast('添加成功!', 'success');
|
|
|
+ this.$store.dispatch('getIntentionList');
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ if (e.error) {
|
|
|
+ this.toast(e.error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="less">
|
|
|
+.main {
|
|
|
+ background-color: #fff;
|
|
|
+}
|
|
|
+.info {
|
|
|
+ padding: 12px 16px 30px;
|
|
|
+
|
|
|
+ .info-top {
|
|
|
+ padding: 12px 0;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #292c33;
|
|
|
+ line-height: 25px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sub {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #878d99;
|
|
|
+ line-height: 22px;
|
|
|
+ margin-top: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ position: absolute;
|
|
|
+ right: 0;
|
|
|
+ bottom: 12px;
|
|
|
+
|
|
|
+ ._van-icon {
|
|
|
+ margin-left: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ --divider-text-color: #f2f4f5;
|
|
|
+ --divider-margin: 10px 0px;
|
|
|
+ --cell-vertical-padding: 8px;
|
|
|
+ --cell-horizontal-padding: 0px;
|
|
|
+ --cell-text-color: #292c33;
|
|
|
+ --cell-font-size: 13px;
|
|
|
+ --cell-value-color: #444444;
|
|
|
+ .van-cell__title {
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ .van-cell__value {
|
|
|
+ flex-grow: 2;
|
|
|
+ }
|
|
|
+}
|
|
|
+.ad {
|
|
|
+ background: rgba(255, 165, 38, 0.06);
|
|
|
+ border-radius: 4px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 10px;
|
|
|
+ justify-content: space-between;
|
|
|
+ span {
|
|
|
+ font-size: 12px;
|
|
|
+ color: @warn;
|
|
|
+ line-height: 22px;
|
|
|
+ }
|
|
|
+
|
|
|
+ img {
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.van-tag {
|
|
|
+ margin-left: 5px;
|
|
|
+}
|
|
|
+
|
|
|
+.vendor {
|
|
|
+ display: flex;
|
|
|
+ padding: 13px 16px;
|
|
|
+ border-top: 5px solid #f2f3f5;
|
|
|
+ border-bottom: 5px solid #f2f3f5;
|
|
|
+ .vendor-info {
|
|
|
+ flex-grow: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-left: 8px;
|
|
|
+
|
|
|
+ .vendor-btn {
|
|
|
+ --button-small-height: 26px;
|
|
|
+ --button-small-min-width: 70px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.van-tabs {
|
|
|
+ .van-tabs__line {
|
|
|
+ bottom: 5px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.detail {
|
|
|
+ padding: 20px 0;
|
|
|
+ --tab-text-color: #878d99;
|
|
|
+
|
|
|
+ .van-tabs__nav {
|
|
|
+ margin: 0 16px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.detail-content {
|
|
|
+ min-height: calc(100vh - 105px - 80rpx);
|
|
|
+ padding: 20px 16px;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.detaiImg {
|
|
|
+ max-width: 100%;
|
|
|
+ height: auto;
|
|
|
+ display: block;
|
|
|
+ margin: 0 0px;
|
|
|
+}
|
|
|
+
|
|
|
+.fixed-bottom {
|
|
|
+ height: 60px;
|
|
|
+ .fixed-bottom-content {
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 8px 16px;
|
|
|
+ position: fixed;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ height: 60px;
|
|
|
+ display: flex;
|
|
|
+ z-index: 200;
|
|
|
+ box-sizing: border-box;
|
|
|
+ box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.04);
|
|
|
+ align-items: center;
|
|
|
+ .btn-icon {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 10px;
|
|
|
+ .text {
|
|
|
+ font-size: 11px;
|
|
|
+ color: #565b66;
|
|
|
+ line-height: 16px;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ &:active {
|
|
|
+ background-color: darken(#fff, 5);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn-list {
|
|
|
+ flex-grow: 1;
|
|
|
+ margin-left: 10px;
|
|
|
+ border-radius: 4px;
|
|
|
+ overflow: hidden;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ .van-button {
|
|
|
+ width: 120px;
|
|
|
+
|
|
|
+ --button-border-radius: 0px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|