Browse Source

品牌中心-器件详情,选择商家与产品匹配功能

yangc 8 years ago
parent
commit
fd433b1aa6

+ 56 - 8
components/product/component/StoreInfo.vue

@@ -20,12 +20,12 @@
         <div style="font-size: 14px">
           <span>产品匹配:</span>
           <span v-if="store && store.length > 0">
-            <input type="checkbox" v-if="storeExist && UmallExist">
-            <span v-if="UmallExist">&nbsp;库存寄售</span>
-            <input type="checkbox" v-if="storeExist && UmallExist">
+            <input type="checkbox" v-if="storeExist && UmallExist" @click="filterType('umall')">
+            <span v-if="UmallExist">&nbsp;库存寄售&nbsp;</span>
+            <input type="checkbox" v-if="storeExist && UmallExist" @click="filterType('store')">
             <span v-if="storeExist">&nbsp;店铺自营</span>
           </span>
-          <span v-if="!store || store.length == 0">暂无可匹配的信息 </span>
+          <span v-if="!storeList.content || storeList.content.length == 0">暂无可匹配的信息 </span>
         </div>
       </div>
     </div>
@@ -123,7 +123,18 @@
       return {
         storeIds: [],
         UmallExist: false,
-        storeExist: false
+        storeExist: false,
+        params: {
+          count: 10,
+          page: 1,
+          sorting: {'minPriceRMB': 'ASC'},
+          filter: {
+            uuid: this.$route.params.uuid,
+            ignoreUMall: false,
+            ignoreStore: false,
+            storeIds: ''
+          }
+        }
       }
     },
     components: {
@@ -148,10 +159,12 @@
       },
       storeList () {
         let storeList = this.$store.state.componentInformation.information.data
-        if (storeList.storeid && storeList.storeid !== '') {
-          this.storeIds = storeList.storeid
+        let _self = this
+        if (storeList.content) {
+          storeList.content.forEach(function (item) {
+            _self.storeIds.push(item.storeid)
+          })
         }
-       // this.storeId
         if (this.storeIds.length > 0) {
           if (this.storeIds.indexOf(this.storeId) === -1) {
             this.storeExist = true
@@ -179,6 +192,41 @@
           this.storeIds.push(storeIn.uuid)
           storeIn.isSelected = true
         }
+        // 点击请求处理
+        let index = this.params.filter.storeIds.indexOf(storeIn.uuid)
+        if (index === -1) {
+          if (this.params.filter.storeIds === '') {
+            this.params.filter.storeIds += storeIn.uuid
+          } else {
+            this.params.filter.storeIds += ',' + storeIn.uuid
+          }
+        } else {
+   //       console.log(this.params.filter.storeIds.replace(storeIn.uuid, ''))
+          console.log(this.params.filter.storeIds.charAt(index + storeIn.uuid.length))
+          if (this.params.filter.storeIds.charAt(index + storeIn.uuid.length) === '') {
+            if (this.params.filter.storeIds.charAt(index - 1) === ',') {
+              this.params.filter.storeIds = this.params.filter.storeIds.replace(',' + storeIn.uuid, '')
+            }
+            this.params.filter.storeIds = this.params.filter.storeIds.replace(storeIn.uuid, '')
+          } else {
+            this.params.filter.storeIds = this.params.filter.storeIds.replace(storeIn.uuid + ',', '')
+          }
+        }
+        this.$store.dispatch('loadComponentInformation', this.params)
+          .then(response => {
+            this.$store.commit('componentInformation/GET_INFORMATION_SUCCESS', response.data)
+          })
+      },
+      filterType (type) {
+        if (type === 'umall') {
+          this.params.filter.ignoreUMall = !this.params.filter.ignoreUMall
+        } else if (type === 'store') {
+          this.params.filter.ignoreStore = !this.params.filter.ignoreStore
+        }
+        this.$store.dispatch('loadComponentInformation', this.params)
+          .then(response => {
+            this.$store.commit('componentInformation/GET_INFORMATION_SUCCESS', response.data)
+          })
       }
     }
   }

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://www.usoftmall.com/' : 'http://192.168.253.60:8080/platform-b2c/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://www.usoftmall.com/' : 'http://192.168.253.60:9090/platform-b2c/')
 
 module.exports = {
   router: {

+ 12 - 1
pages/product/component/_uuid.vue

@@ -18,7 +18,18 @@
       return Promise.all([
         store.dispatch('loadComponentDetail', {id: route.params.uuid}),
         store.dispatch('loadComponentStore', {uuid: route.params.uuid}),
-        store.dispatch('loadComponentInformation', {uuid: route.params.uuid})
+        store.dispatch('loadComponentInformation',
+          {
+            count: 10,
+            page: 1,
+            sorting: {'minPriceRMB': 'ASC'},
+            filter: {
+              uuid: route.params.uuid,
+              ignoreUMall: false,
+              ignoreStore: false,
+              storeIds: ''
+            }}),
+        store.dispatch('getUmallStoreId')
       ])
     },
     created () {

+ 14 - 0
pages/register-saler/index.vue

@@ -0,0 +1,14 @@
+<template>
+<div>
+  <h1>啊啊啊啊啊</h1>
+</div>
+</template>
+
+<script>
+  export default {
+  }
+</script>
+
+<style>
+
+</style>

+ 8 - 8
store/index.js

@@ -190,14 +190,14 @@ export const actions = {
       })
   },
   // 器件详情页商家列表
-  loadComponentInformation ({commit}, uuid = '', pageParams = { page: 1, count: 10 }) {
-    let params = {}
-    let filter = {uuid: uuid.uuid, ignoreUMall: false, ignoreStore: false}
-    // let sorting = {minPriceRMB: 'ASC'}
-    params.filter = filter
-    // params.sorting = sorting
-    params.page = pageParams.page
-    params.count = pageParams.count
+  loadComponentInformation ({commit}, params = {}) {
+    // let params = {}
+    // let filter = {uuid: uuid.uuid, ignoreUMall: false, ignoreStore: false}
+    // // let sorting = {minPriceRMB: 'ASC'}
+    // params.filter = filter
+    // // params.sorting = sorting
+    // params.page = pageParams.page
+    // params.count = pageParams.count
     commit('componentInformation/REQUEST_INFORMATION')
     return axios.get('/api/commodity/goods/page', { params })
       .then(response => {