Browse Source

开店代码

yangc 8 years ago
parent
commit
a8c52eca98

+ 1 - 1
components/default/RightBar.vue

@@ -447,7 +447,7 @@
 
     .right-bar-center {
       position: absolute;
-      top: 50%;
+      top: 60%;
       transform: translateY(-50%);
       list-style: none;
       padding: 0;

+ 1 - 1
components/main/Search.vue

@@ -16,7 +16,7 @@
         <button class="btn btn-primary search-btn" type="button">搜&nbsp;索</button>
       </span>
     </div>
-    <ul class="association" v-show="showAssociate"
+    <ul class="association" v-show="showAssociate && searchType == 'product'"
         @mouseenter="associate.focus=true" @mouseleave="associate.focus=false">
       <li v-for="(k, index) in similarKeywords.data" :key="k" class="item"
           :class="{'active': index==associate.activeIndex}"

+ 6 - 13
components/product/component/ComponentDetail.vue

@@ -71,9 +71,6 @@
         dialogVisible: false
       }
     },
-    mounted () {
-      this.collectList()
-    },
     computed: {
       lists () {
         return this.$store.state.componentDetail.detail
@@ -88,16 +85,12 @@
         return this.$store.state.product.common.collectList.data
       },
       collectList () {
-   //     let _this = this
-        if (this.lists.data.properties && this.lists.data.properties.length > 0) {
-          let id = this.lists.data.properties[0].componentId
-          let store = this.colList
-          if (store) {
-            for (let i = 0; i < store.length; i++) {
-              if (store[i].componentid === id) {
-         //       _this.isShow = true
-                return true
-              }
+        let id = this.lists.data.id
+        let store = this.colList
+        if (store) {
+          for (let i = 0; i < store.length; i++) {
+            if (store[i].componentid === id) {
+              return true
             }
           }
         }

+ 1 - 9
components/register-saler/Register.vue

@@ -8,7 +8,7 @@
       </ul>
     </div>
     <div class="tab-list">
-      <step-first v-if="section == 1" @sectionEvent="sectionChange" :data="this.data"></step-first>
+      <step-first v-if="section == 1" @sectionEvent="sectionChange"></step-first>
       <step-second v-if="section == 2" @sectionEvent="sectionChange" :checkData="checkData"></step-second>
       <step-third v-if="section == 3" @sectionEvent="sectionChange"></step-third>
     </div>
@@ -22,14 +22,6 @@
     data () {
       return {
         section: 1,
-        data: {
-          name: '',
-          simpleName: '',
-          url: '',
-          licenceId: '',
-          address: '',
-          website: ''
-        },
         checkData: {
           checked: false
         }

+ 48 - 19
components/register-saler/register/StepFirst.vue

@@ -40,7 +40,7 @@
             请上传营业执照扫描件(≤5M的图片或PDF)
             <input type="file" @change="upload" class="form-control file-input" name="name" required="" placeholder="请上传营业执照扫描件(≤5M的图片或PDF)" accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png,.pdf">
           </a>
-          <img class="previewImg" v-if="data.url != ''" :src="data.url" alt="">
+          <img class="previewImg" v-if="data.url != ''" :src="isPdf?'/images/all/timg.png':data.url" alt="">
         </div>
         <div class="col-sm-5" v-show="!isValidUpload"><p><i class="fa fa-info-circle"></i>请上传营业执照扫描件(≤5M的图片或PDF)</p></div>
       </div>
@@ -73,21 +73,36 @@
 </template>
 <script>
   export default {
-    props: ['data'],
     data () {
       return {
-        isValid: false,
+        data: {
+          name: '',
+          simpleName: '',
+          url: '',
+          licenceId: '',
+          address: '',
+          website: ''
+        },
+        isValid: true,
         isValidUpload: true,
         isValidTypeName: true,
         isValidName: true,
         isValidLicence: true,
         isValidSimpleName: true,
-        isValidAddress: true
+        isValidAddress: true,
+        isPdf: false
       }
     },
     methods: {
       sectionChange: function (type) {
-        this.$emit('sectionEvent', type)
+        this.$http.post('/basic/enterprise/register', {enterprise: [], filePath: this.data.url})
+          .then(response => {
+            if (response.data.success) {
+              this.$emit('sectionEvent', type)
+            } else {
+              this.$message.error('注册失败,请重新填写信息')
+            }
+          })
       },
       upload: function (e) {
         let file = e.target.files[0]
@@ -95,39 +110,53 @@
           this.isValidUpload = false
         } else {
           this.isValidUpload = true
-          let param = new FormData()
-          param.append('file', file, file.name)
-          param.append('chunk', '0')
-          let config = {
-            headers: {'Content-Type': 'multipart/form-data'}
+          if (file.type !== 'application/pdf') {
+            this.isPdf = false
+            let param = new FormData()
+            param.append('file', file, file.name)
+            param.append('chunk', '0')
+            let config = {
+              headers: {'Content-Type': 'multipart/form-data'}
+            }
+            this.$http.post('/api/images', param, config)
+              .then(response => {
+                this.data.url = response.data[0].path
+              })
+          } else {
+            this.isPdf = true
+            let param = new FormData()
+            param.append('file', file, file.name)
+            let config = {
+              headers: {'Content-Type': file.type}
+            }
+            this.$http.post('/file', param, config)
+              .then(response => {
+                this.data.url = response.data[0].path
+              })
           }
-          this.$http.post('/api/images', param, config)
-            .then(response => {
-              this.data.url = response.data[0].path
-            })
         }
       },
       validCheck: function () {
-        this.isValid = this.isValidUpload && this.isValidTypeName && this.isValidName && this.isValidLicence && this.isValidSimpleName
+//        this.isValid = this.isValidUpload && this.isValidTypeName && this.isValidName && this.isValidLicence && this.isValidSimpleName
       },
       nameCheck: function () {
-        this.validCheck()
         this.$http.post('/basic/enterprise/register/valid/name?name=' + this.data.name)
           .then(response => {
             this.isValidName = response.data.success
           })
         this.isValidTypeName = this.data.name && this.data.name.length >= 2 && this.data.name.length <= 99
+        this.validCheck()
       },
       simpleNameCheck: function () {
-        this.validCheck()
         this.isValidSimpleName = this.data.simpleName && this.data.simpleName.length >= 2 && this.data.simpleName.length <= 40
+        this.validCheck()
       },
       licenceCheck: function () {
-        this.validCheck()
         this.$http.post('/basic/enterprise/register/valid/businessCode?businessCode=' + this.data.licenceId)
           .then(response => {
             this.isValidLicence = response.data.success
           })
+        this.validCheck()
       },
       addressCheck: function () {
         //
@@ -139,7 +168,7 @@
   }
 </script>
 
-<style>
+<style scoped>
   .register input[type="file"] {
     display: block;
   }

+ 0 - 1
components/register-saler/register/StepSecond.vue

@@ -27,7 +27,6 @@
       </label>
     </div>
     <div class="row next-btn" style="margin-top: 20px">
-      <button @click="sectionChange('prev')">上一步</button>
       <button @click="sectionChange('next')" :disabled="!checkData.checked" class="btn">下一步</button>
     </div>
   </div>

+ 36 - 4
components/searchStore/SearchTitle.vue

@@ -13,7 +13,15 @@
         <div class=""><a >库存</a></div>
         <div class=""><a >销量</a></div>
         <div class=""><a >信用</a></div>
-        <div class=""><a >店铺类型</a></div>
+        <div class="">
+          <select @change="onSelectTypeChange" class="form-control select-type select-adder">
+            <option value="">店铺类型</option>
+            <option value="">原厂</option>
+            <option value="">代理</option>
+            <option value="">经销</option>
+            <option value="">寄售</option>
+          </select>
+        </div>
         <div class=""><a >所在地</a></div>
     </div>
       <div class="off">
@@ -31,7 +39,31 @@
     props: ['keyword'],
     computed: {
       goodsCount () {
-        return this.$store.state.searchStore.searchStoreDetail.detail.data.totalElements || 0
+        return this.$store.state.searchStore.searchStoreDetail.detail.data[0].stores.numberOfElements || 0
+      }
+    },
+    methods: {
+      onSelectTypeChange: function (e) {
+        let type = e.target[e.target.selectedIndex].innerHTML
+        let paramType = ''
+        if (type === '原厂') {
+          paramType = 'ORIGINAL_FACTORY'
+        } else if (type === '代理') {
+          paramType = 'AGENCY'
+        } else if (type === '经销') {
+          paramType = 'DISTRIBUTION'
+        } else if (type === '寄售') {
+          paramType = 'CONSIGNMENT'
+        } else if (type === '店铺类型') {
+          paramType = 'AGENCY-DISTRIBUTION-ORIGINAL_FACTORY-CONSIGNMENT'
+        }
+        this.$store.dispatch('searchStore/searchStoreDetail',
+          {
+            page: 1,
+            count: 4,
+            keyword: this.$route.query.w,
+            types: paramType,
+            op: 'pageByType'})
       }
     }
   }
@@ -40,8 +72,8 @@
   .search-store-title {
     margin-top: 10px;
   }
-  .search-store-title .search-result {
-
+  .search-store-title .select-type {
+    min-width: 87px;
   }
   .tab-filter{
     width: 1190px;

+ 67 - 55
components/searchStore/StoreContent.vue

@@ -1,45 +1,29 @@
 <template>
   <div>
   <ul class="store-list" v-if="storeData.content && storeData.content.length > 0">
-    <li v-for="store in storeData.content">
+    <li v-for="(store, index) in storeData.content">
       <div class="store-content-left">
-        <img :src="store.logoUrl?store.logoUrl:'/images/all/default.png'" class="storeImg" alt="">
+        <a :href="'/store/' + store.uuid">
+          <img :src="store.logoUrl?store.logoUrl:'/images/all/default.png'" class="storeImg" alt="">
+        </a>
         <div class="store-detail">
-          <span>{{store.storeName}}</span>
+          <a :href="'/store/' + store.uuid">{{store.storeName}}</a>
         </div>
         <div class="btn-content">
           <span style="position: relative;" class="call-seller">
             <img src="static/img/common/songguo.png?_v=1503050008623">
 							<a name="21059" href="javascript:void(0)" class="contact_btn">联系卖家</a>
           </span>
-          <a class="focus-store store-btn" @click="focusStore(store)">关注店铺</a>
+          <a class="focus-store store-btn" @click="focusStore(store, index)" v-text="focusData[index] === 'true'?'已关注':'关注店铺'"></a>
           <a :href="'/store/' + store.uuid" class="enter-store store-btn">进入店铺</a>
         </div>
       </div>
-      <ul class="store-component-list">
-        <li>
-          <img src="/images/all/default.png" alt="">
-          <span class="store-component-kind">asdadasdadas</span>
-          <span class="store-component-brand">sadasdasda</span>
-          <span class="store-component-name">sadasdada</span>
-        </li>
-        <li>
-          <img src="/images/all/default.png" alt="">
-          <span class="store-component-kind">asdadasdadas</span>
-          <span class="store-component-brand">sadasdasda</span>
-          <span class="store-component-name">sadasdada</span>
-        </li>
-        <li>
-          <img src="/images/all/default.png" alt="">
-          <span class="store-component-kind">asdadasdadas</span>
-          <span class="store-component-brand">sadasdasda</span>
-          <span class="store-component-name">sadasdada</span>
-        </li>
-        <li>
-          <img src="/images/all/default.png" alt="">
-          <span class="store-component-kind">asdadasdadas</span>
-          <span class="store-component-brand">sadasdasda</span>
-          <span class="store-component-name">sadasdada</span>
+      <ul class="store-component-list" v-if="componentData">
+        <li v-for="item in componentData[index].content">
+          <a :href="`/product/component/${item.uuid}`"><img :src="item.img?item.img:'/images/all/default.png'" alt=""></a>
+          <a :href="`/product/component/${item.uuid}`" class="store-component-code" v-text="item.code" :title="item.code"></a>
+          <a :href="`/product/brand/${item.branduuid}`" v-text="item.brandNameEn"></a>
+          <a :href="`/product/kind/${item.kindUuid}`" v-text="item.kindNameCn"></a>
         </li>
       </ul>
     </li>
@@ -69,12 +53,22 @@
       user () {
         return this.$store.state.option.user
       },
-      storeData () {
+      storeDetail () {
         return this.$store.state.searchStore.searchStoreDetail.detail.data
+      },
+      storeData () {
+        console.log(this.storeDetail[0].stores)
+        return this.storeDetail[0].stores
+      },
+      focusData () {
+        return this.storeDetail[1].isFocus
+      },
+      componentData () {
+        return this.storeDetail[1].image
       }
     },
     methods: {
-      focusStore: function (store) {
+      focusStore: function (store, index) {
         if (!this.user.logged) {
           this.$http.get('/login/page').then(response => {
             if (response.data) {
@@ -82,25 +76,23 @@
             }
           })
         } else {
-          this.$http.get('/trade/storeFocus/ifFocus', {params: {storeid: store.id}})
-            .then(response => {
-              if (response.data === 'true') {
-                // 已关注
-                this.$message.error('店铺已关注,不能重复关注')
-              } else {
-                // 未关注
-                this.$http.post('/trade/storeFocus/save', {storeName: store.storeName, storeid: store.id})
-                  .then(response => {
-                    if (response.data === 'success') {
-                      // 关注成功
-                      this.dialogVisible = true
-                    } else {
-                      // 关注失败
-                      this.$message.error('关注失败')
-                    }
-                  })
-              }
-            })
+          if (this.focusData[index] === 'true') {
+            // 已关注
+            this.$message.error('店铺已关注,不能重复关注')
+          } else {
+            // 未关注
+            this.$http.post('/trade/storeFocus/save', {storeName: store.storeName, storeid: store.id})
+              .then(response => {
+                if (response.data === 'success') {
+                  // 关注成功
+                  this.dialogVisible = true
+                  this.focusData[index] = 'true'
+                } else {
+                  // 关注失败
+                  this.$message.error('关注失败')
+                }
+              })
+          }
         }
       }
     }
@@ -109,6 +101,7 @@
 <style scoped>
   .store-list {
     border-right: 1px solid;
+    border-left: 1px solid;
   }
   .store-list >li{
     border-bottom: 1px solid;
@@ -121,10 +114,14 @@
   .store-content-left >div {
     display: inline-block;
   }
-  .store-content-left >img.storeImg {
+  .store-content-left >a {
+    color: black;
+  }
+  .store-content-left >a >img.storeImg {
     border: 1px solid;
     width: 250px;
     height: 200px;
+    margin-left: 10px;
   }
   .btn-content {
     position: relative;
@@ -140,6 +137,12 @@
   .store-detail {
     margin-left: 20px;
   }
+  .store-detail >a {
+    color: black;
+  }
+  .store-detail a:hover {
+    color: #f39801;
+  }
   .store-detail >span{
     font-size: 14px;
     font-weight: 700;
@@ -173,7 +176,7 @@
 
   }
   .store-component-list {
-    width: 639px;
+    width: 638px;
     display: inline-block;
     vertical-align: middle;
     padding-left: 20px;
@@ -184,17 +187,26 @@
     padding: 5px 15px;
     border: 1px solid;
     margin-left: 20px;
+    width: 132px;
+    height: 120px;
   }
   .store-component-list >li img {
     width: 100px;
     height:60px;
   }
-  .store-component-list >li span {
+  .store-component-list >li img:hover {
+    cursor: pointer;
+  }
+  .store-component-list >li a {
     display: block;
-    font-size: 12px;
+    font-size: 10px;
+    color: black;
+    margin-top: 3px;
   }
-  .store-component-list .store-component-kind {
-    font-size: 14px;
+  .store-component-list >li a:hover {
+    color: #f39801;
+  }
+  .store-component-list .store-component-code {
     font-weight: 600;
   }
   .header-text {

+ 1 - 1
pages/searchStore/_keyword.vue

@@ -19,7 +19,7 @@
     },
     fetch ({store, route}) {
       return Promise.all([
-        store.dispatch('searchStore/searchStoreDetail', {page: 1, count: 4, keyword: route.query.w, types: 'ORIGINAL_FACTORY', op: 'pageByType'})
+        store.dispatch('searchStore/searchStoreDetail', {page: 1, count: 4, keyword: route.query.w, types: 'AGENCY-DISTRIBUTION-ORIGINAL_FACTORY-CONSIGNMENT', op: 'pageByType'})
       ])
     }
   }

BIN
static/images/all/timg.png


+ 1 - 1
store/searchStore.js

@@ -4,7 +4,7 @@ export const actions = {
   // 获取搜索店铺数据
   searchStoreDetail ({ commit }, params = {}) {
     commit('searchStoreDetail/REQUEST_STORE', params)
-    return axios.get(`/api/store-service/stores`, {params})
+    return axios.get(`/search/stores`, {params})
       .then(response => {
         commit('searchStoreDetail/GET_STORE_SUCCESS', response.data)
       }, err => {