wuhongyu hace 4 años
padre
commit
021c074408

+ 2 - 2
src/layout/market/prodDetail.vue

@@ -21,7 +21,7 @@
             <span>类型</span>
             <span>{{ productInfo.product_type_name || '暂无' }}</span>
           </p>
-          <p>
+          <p v-if="productInfo.totaltype == 0">
             <span>研发阶段</span>
             <span>{{ productInfo.phase == 1 ? '阶段成果' : productInfo.phase == 2 ? '最终成果' : '暂无' }}</span>
           </p>
@@ -29,7 +29,7 @@
             <span>交易方式</span>
             <span>{{ productInfo.business === '0' ? '公用' : productInfo.business === '1' ? '转让' : productInfo.business === '2' ? '竞价' : '暂无' }}</span>
           </p>
-          <p>
+          <p v-if="productInfo.totaltype == 0 || productInfo.totaltype == 2">
             <span>应用领域</span>
             <span>{{ productInfo.field || '暂无' }}</span>
           </p>

+ 21 - 11
src/layout/market/release.vue

@@ -52,6 +52,7 @@
               @delete="uploadDelete"
             ></upload>
           </el-form-item>
+
           <span v-if="form.totaltype == 0 || form.totaltype == 2">
             <el-form-item label="应用领域">
               <el-input v-model="form.field" placeholder="请输入应用领域"></el-input>
@@ -74,7 +75,7 @@
             <el-input v-model="form.contact_tel" placeholder="请输入联系电话"></el-input>
           </el-form-item>
           <el-form-item>
-            <el-button type="primary" @click="onSubmit">发布</el-button>
+            <el-button type="primary" @click="onSubmit(form)">发布</el-button>
           </el-form-item>
         </el-form>
       </el-col>
@@ -86,6 +87,7 @@
 import upload from '@/components/upload.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: maarkettype } = createNamespacedHelpers('maarkettype');
+const { mapActions: marketproduct } = createNamespacedHelpers('marketproduct');
 
 export default {
   name: 'release',
@@ -127,10 +129,21 @@ export default {
   },
   methods: {
     ...maarkettype(['query']),
+    ...marketproduct({ productFetch: 'fetch', productCreate: 'create', productUpdate: 'update', productQuery: 'query' }),
+
     // 提交发布
-    onSubmit() {
-      console.log(this.form);
+    async onSubmit(form) {
+      form.status = '0';
+      form.userid = this.user.uid;
+      let res;
+      let msg;
+      console.log(form);
+      res = await this.productCreate(form);
+      msg = `${this.keyWord}添加成功`;
+      this.$checkRes(res, '添加成功', '添加失败');
+      this.$router.push({ path: '/userCenter/myProduct/index' });
     },
+
     // 查询类型
     async searchType({ category = 54, ...info } = {}) {
       const res = await this.query({ category, ...info });
@@ -149,14 +162,11 @@ export default {
 
     // 图片
     uploadSuccess({ type, data }) {
-      let arr = _.get(this.form, type);
-      if (_.isArray(arr)) {
-        let datas = { name: data.name, url: data.uri };
-        this.form[type].push({ name: data.name, url: data.uri });
-      } else {
-        let newArr = [{ name: data.name, url: data.uri }];
-        this.$set(this.form, `${type}`, newArr);
-      }
+      console.log(type, data);
+      console.log(data.uri);
+      let image = [{ url: data.uri }];
+      console.log(image);
+      this.$set(this.form, `image`, image);
     },
     // 删除图片
     uploadDelete(index) {

+ 13 - 7
src/views/market/parts/productList.vue

@@ -2,13 +2,19 @@
   <div id="productList">
     <el-row>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" @click.native="$router.push({ path: '/market/prodDetail' })" v-for="(item, index) in list" :key="index">
+        <el-col
+          :span="24"
+          class="list"
+          @click.native="$router.push({ path: '/market/prodDetail', query: { id: item.id } })"
+          v-for="(item, index) in list"
+          :key="index"
+        >
           <p class="textOver">{{ item.name }}</p>
           <p>
             <span class="ptwo"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
-            <span class="ptwo"><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
+            <span class="ptwo"><span>产品单价</span>{{ item.price }}/{{ item.priceunit || '暂无' }}</span>
           </p>
-          <p class="textOver"><span>应用领域:</span>{{ item.field || '暂无' }}</p>
+          <p class="textOver"><span>产品简介:</span>{{ item.introduction || '暂无' }}</p>
         </el-col>
       </el-col>
     </el-row>
@@ -46,10 +52,10 @@ export default {
   methods: {
     ...product(['newquery']),
     async searchInfo() {
-      // let res = await this.newquery({ skip: 0, limit: 6, totaltype: '1', status: '1' });
-      // if (this.$checkRes(res)) {
-      //   this.$set(this, `list`, res.data);
-      // }
+      let res = await this.newquery({ skip: 0, limit: 6, totaltype: '1', status: '1' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+      }
     },
   },
   computed: {

+ 12 - 6
src/views/market/parts/serviceList.vue

@@ -2,11 +2,17 @@
   <div id="serviceList">
     <el-row>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" @click.native="$router.push({ path: '/market/prodDetail' })" v-for="(item, index) in list" :key="index">
+        <el-col
+          :span="24"
+          class="list"
+          @click.native="$router.push({ path: '/market/prodDetail', query: { id: item.id } })"
+          v-for="(item, index) in list"
+          :key="index"
+        >
           <p class="textOver">{{ item.name }}</p>
           <p>
             <span class="ptwo"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
-            <span class="ptwo"><span>研发阶段:</span>{{ item.phase == 1 ? '阶段成果' : item.phase == 2 ? '最终成果' : '暂无' }}</span>
+            <span class="ptwo"><span>产品单价</span>{{ item.price }}/{{ item.priceunit || '暂无' }}</span>
           </p>
           <p class="textOver"><span>应用领域:</span>{{ item.field || '暂无' }}</p>
         </el-col>
@@ -46,10 +52,10 @@ export default {
   methods: {
     ...product(['newquery']),
     async searchInfo() {
-      // let res = await this.newquery({ skip: 0, limit: 6, totaltype: '2', status: '1' });
-      // if (this.$checkRes(res)) {
-      //   this.$set(this, `list`, res.data);
-      // }
+      let res = await this.newquery({ skip: 0, limit: 6, totaltype: '2', status: '1' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+      }
     },
   },
   computed: {

+ 11 - 5
src/views/market/parts/technologyList.vue

@@ -2,7 +2,13 @@
   <div id="technologyList">
     <el-row>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" @click.native="$router.push({ path: '/market/prodDetail' })" v-for="(item, index) in list" :key="index">
+        <el-col
+          :span="24"
+          class="list"
+          @click.native="$router.push({ path: '/market/prodDetail', query: { id: item.id } })"
+          v-for="(item, index) in list"
+          :key="index"
+        >
           <p class="textOver">{{ item.name }}</p>
           <p>
             <span class="ptwo"><span>产品类型:</span>{{ item.product_type_name || '暂无' }}</span>
@@ -46,10 +52,10 @@ export default {
   methods: {
     ...product(['newquery']),
     async searchInfo() {
-      // let res = await this.newquery({ skip: 0, limit: 6, totaltype: '0', status: '1' });
-      // if (this.$checkRes(res)) {
-      //   this.$set(this, `list`, res.data);
-      // }
+      let res = await this.newquery({ totaltype: '0', status: '1' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+      }
     },
   },
   computed: {

+ 18 - 3
src/views/market/prodDetail.vue

@@ -16,6 +16,9 @@
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
 import prodDetails from '@/layout/market/prodDetail.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: marketproduct } = createNamespacedHelpers('marketproduct');
+
 export default {
   name: 'prodDetail',
   props: {},
@@ -51,9 +54,21 @@ export default {
       introduction: '产品简介',
     },
   }),
-  created() {},
-  computed: {},
-  methods: {},
+  created() {
+    this.search();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  methods: {
+    ...marketproduct(['fetch']),
+    async search() {
+      let res = await this.fetch(this.id);
+      this.$set(this, `productInfo`, res.data);
+    },
+  },
   mounted() {
     this.title = this.$route.meta.title;
     this.isleftarrow = this.$route.meta.isleftarrow;