Преглед на файлове

产品收藏、跳转链接修改。

ouxq преди 8 години
родител
ревизия
9f52781e85

+ 6 - 0
assets/scss/common.scss

@@ -336,3 +336,9 @@ div.el-tree-node__content{
 .el-pagination{
   margin-bottom: 15px;
 }
+.componentDetail .el-dialog__wrapper .el-dialog--tiny{
+  width: 320px !important;
+}
+.componentDetail .el-dialog__wrapper .el-dialog__body{
+  padding: 14px !important;
+}

+ 2 - 2
components/default/Header.vue

@@ -33,8 +33,8 @@
             <nuxt-link class="item" to="/vendor">卖家中心</nuxt-link>-->
             <!--<a class="item" :href="url + '/user'">买家中心</a>
             <a class="item" :href="url + '/vendor'">卖家中心</a>-->
-            <a class="item" href="user#/index">买家中心</a>
-            <a class="item" href="vendor#/index">卖家中心</a>
+            <a class="item" href="/user#/index">买家中心</a>
+            <a class="item" href="/vendor#/index">卖家中心</a>
           </template>
           <template v-else>
             <a class="item" @click="onLoginClick()">登录</a>

+ 8 - 6
components/default/RightBar.vue

@@ -2,10 +2,10 @@
   <div class="right-bar">
     <ul class="right-bar-center">
       <li class="right-bar-item">
-        <a href="user#/cart" class="title" target="_blank">
+        <a href="/user#/cart" class="title" target="_blank">
           <i class="iconfont icon-shopping-cart icon-xlg"></i>
         </a>
-        <div class="sidebar-menu"><a href="user#/cart" title="我的购物车" target="_blank">我的购物车<em><span>(<span v-text="cartCount.count || 0"></span>)</span></em></a></div>
+        <div class="sidebar-menu"><a href="/user#/cart" title="我的购物车" target="_blank">我的购物车<em><span>(<span v-text="cartCount.count || 0"></span>)</span></em></a></div>
       </li>
       <li class="right-bar-item">
         <a @click="onLeaveMessageClick()" class="title">
@@ -28,11 +28,11 @@
     </ul>
     <ul class="right-bar-bottom">
       <li class="right-bar-item">
-        <a href="http://www.usoftmall.com/user#/browsingHistory" class="title" target="_blank">
+        <a href="/user#/browsingHistory" class="title" target="_blank">
           <i class="iconfont icon-zuji icon-xlg"></i>
         </a>
-        <div class="sidebar-menu" v-if="!user.logged"><a href="user#/browsingHistory" title="浏览记录" target="_blank">浏览记录</a></div>
-        <div class="sidebar-menu" v-if="user.logged && listMe(history).length == 0"><a href="user#/browsingHistory" title="浏览记录" target="_blank">浏览记录</a></div>
+        <div class="sidebar-menu" v-if="!user.logged"><a href="/user#/browsingHistory" title="浏览记录" target="_blank">浏览记录</a></div>
+        <div class="sidebar-menu" v-if="user.logged && listMe(history).length == 0"><a href="/user#/browsingHistory" title="浏览记录" target="_blank">浏览记录</a></div>
         <div class="foot-record sidebar-menu" v-if="user.logged && listMe(history).length > 0">
           <h3><a href="">浏览历史</a></h3>
           <dl>
@@ -177,11 +177,13 @@
     border-bottom: #767575 1px solid;
     text-align: left;
     padding-left: 10px;
-    width: 96%;
+    width: 100%;
     display: inline-block;
     margin: 0 auto;
     font-size: 12px;
     height: 39px;
+    position: relative;
+    z-index: 1;
   }
   .right-bar ul li .foot-record h3:hover a{
     color: #fbb029;

+ 61 - 1
components/product/component/ComponentDetail.vue

@@ -40,32 +40,92 @@
               <div class="message-body"><a :href="list.attach" v-if="list.attach">规格书</a><span v-if="!list.attach">暂无规格书</span></div>
             </div>
             <div class="form-group">
-              <button class="btn btn-default btn-stroe">加入收藏</button>
+             <!-- <button class="btn btn-default btn-stroe">加入收藏</button>-->
+              <el-button type="text" v-if="!isShow && collectList" @click="dialogVisible = true,collect(list.id)" class="btn btn-default btn-stroe" style="line-height: 26px;">加入收藏</el-button>
+               <button class="btn btn-default btn-stroe" v-if="isShow && collectList" disabled="disabled">已收藏</button>
             </div>
           </div>
         </div>
       </div>
     </div>
+    <!--关注-->
+    <el-dialog
+      :visible.sync="dialogVisible"
+      size="tiny"
+    >
+      <h3 class="header-text">收藏成功!</h3>
+      <div class="focus modal-body">
+        <button type="button" @click="dialogVisible = false" class="btn" style="margin-left:25px;">关&nbsp;&nbsp;闭</button>
+        <button type="button" class="focus-btn btn btn btn-info" style="margin-left:35px;">
+          <a href="/user#/browsingHistory" target="_blank">查看我的产品收藏</a>
+        </button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
   import { ComponentMenu } from '~components/product'
   export default {
     name: 'ComponentDetail',
+    data () {
+      return {
+        dialogVisible: false,
+        isShow: false
+      }
+    },
     computed: {
       lists () {
+       // console.log(this.$store.state.componentDetail.detail)
         return this.$store.state.componentDetail.detail
       },
       list () {
         return this.lists.data
+      },
+      collectList () {
+        let id = this.lists.data.properties[0].componentId
+       // console.log(this.lists.data)
+        let store = this.$store.state.product.common.collectList.data
+        var _this = this
+        if (store) {
+          for (var i = 0; i < store.length; i++) {
+            if (store[i].componentid === id) {
+              _this.isShow = true
+            }
+          }
+        }
+        return true
       }
     },
+    mounted () {
+      this.$nextTick(() => {
+        this.loadCollectList()
+      })
+    },
     components: {
       ComponentMenu
+    },
+    methods: {
+      loadCollectList () {
+        this.$store.dispatch('product/saveStores')
+      },
+      collect (id) {
+        let kind = 2
+        this.$store.dispatch('product/saveEntity', {componentid: id, kind: kind})
+        this.isShow = true
+      }
     }
   }
 </script>
 <style scoped>
+  .header-text {
+    text-align: center;
+    font-size: 20px;
+    color: #008B00;
+    margin-top: 0;
+  }
+  .componentDetail .el-dialog__wrapper .focus-btn a{
+    color: #fff;
+  }
   .componentDetail .container {
     width: 1190px;
     padding: 0;

+ 1 - 1
components/provider/NewStore.vue

@@ -31,7 +31,7 @@
           已入驻商家<span>{{storeCount}}</span>家
         </div>
         <div>
-          <a href="vendor#/store-apply"><button>立即入驻</button></a>
+          <a href="/vendor#/store-apply"><button>立即入驻</button></a>
         </div>
       </div>
     </div>

+ 2 - 2
components/provider/RecommendOriginal.vue

@@ -10,8 +10,8 @@
             <div class="name">
               <span :title="store.storeName">{{store.storeName}}</span>
             </div>
-            <div class="subject" style="min-height: 5px;">
-            </div>
+            <!--<div class="subject" style="min-height: 5px;">
+            </div>-->
             <div class="description">
               <strong>商家介绍</strong>:
               <span>{{store.description || '暂无简介'}}</span>

+ 1 - 1
components/provider/Suppliers.vue

@@ -15,7 +15,7 @@
         </td>
         <td width="150" style="vertical-align: middle"><span>入驻商家:</span><span class="text-message">{{stores ? stores.totalElements : 0}}</span><span>家</span></td>
         <td width="150">
-          <a href="vendor#/store-apply"><button class="btn btn-primary" style="margin-left: 6px;">立即入驻</button></a>
+          <a href="/vendor#/store-apply"><button class="btn btn-primary" style="margin-left: 6px;">立即入驻</button></a>
         </td>
       </tr>
       </thead>

+ 1 - 1
components/store/common/StoreHeader.vue

@@ -59,7 +59,7 @@
       <div class="focus modal-body">
         <button type="button" @click="dialogVisible = false" class="btn" style="margin-left:25px;">关&nbsp;&nbsp;闭</button>
         <button type="button" @click="dialogVisible = false" class="focus-btn btn btn btn-info" style="margin-left:35px;">
-          <a href="http://www.usoftmall.com/user#/browsingHistory" target="_blank">查看我的店铺关注</a>
+          <a href="/user#/browsingHistory" target="_blank">查看我的店铺关注</a>
         </button>
       </div>
     </el-dialog>

+ 23 - 0
store/product.js

@@ -97,5 +97,28 @@ export const actions = {
       }, err => {
         commit('component/GET_CMPGOODS_FAILURE', err)
       })
+  },
+  // 保存单个收藏记录
+  saveEntity ({ commit }, componentid) {
+    commit('common/REQUEST_COLLECTSAVA')
+    return axios.post(`/trade/collection/save`, componentid)
+      .then(response => {
+        commit('common/GET_COLLECTSAVA_SUCCESS', response.data)
+        if (response.data === 'success') {
+          commit('common/GET_COLLECTLIST_SUCCESS')
+        }
+      }, err => {
+        commit('common/GET_COLLECTSAVA_FAILURE', err)
+      })
+  },
+  // 保存一列收藏记录, 此方法仅限于在登陆界面使用
+  saveStores ({ commit }, params = {}) {
+    commit('common/REQUEST_COLLECTLIST')
+    return axios.get(`trade/collection/list`, { params })
+      .then(response => {
+        commit('common/GET_COLLECTLIST_SUCCESS', response.data)
+      }, err => {
+        commit('common/GET_COLLECTLIST_FAILURE', err)
+      })
   }
 }

+ 28 - 0
store/product/common.js

@@ -2,6 +2,14 @@ export const state = () => ({
   counts: {
     fetching: false,
     data: []
+  },
+  collectSave: {
+    fetching: false,
+    data: []
+  },
+  collectList: {
+    fetching: false,
+    data: []
   }
 })
 
@@ -15,5 +23,25 @@ export const mutations = {
   GET_COUNTS_SUCCESS (state, result) {
     state.counts.fetching = false
     state.counts.data = result
+  },
+  REQUEST_COLLECTSAVA (state) {
+    state.collectSave.fetching = true
+  },
+  GET_COLLECTSAVA_FAILURE (state) {
+    state.collectSave.fetching = false
+  },
+  GET_COLLECTSAVA_SUCCESS (state, result) {
+    state.collectSave.fetching = false
+    state.collectSave.data = result
+  },
+  REQUEST_COLLECTLIST (state) {
+    state.collectList.fetching = true
+  },
+  GET_COLLECTLIST_FAILURE (state) {
+    state.collectList.fetching = false
+  },
+  GET_COLLECTLIST_SUCCESS (state, result) {
+    state.collectList.fetching = false
+    state.collectList.data = result
   }
 }