Bläddra i källkod

Merge branch 'master' of http://git.cc-lotus.info/service-platform/mobile-official into master

wxy 4 år sedan
förälder
incheckning
63a34b7103
1 ändrade filer med 33 tillägg och 133 borttagningar
  1. 33 133
      src/views/userCenter/matter/detail.vue

+ 33 - 133
src/views/userCenter/matter/detail.vue

@@ -6,38 +6,17 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          <van-tabs v-model="active" @click="clickbtn">
-            <van-tab title="科技需求">
-              <producInfo
-                :type="type"
-                :form="form"
-                @onSubmit="onSubmit"
-                :fieldList="fieldList"
-                :achievestatusList="achievestatusList"
-                :cooperationList="cooperationList"
-              ></producInfo>
-            </van-tab>
-            <van-tab title="技术成果">
-              <producInfo
-                :type="type"
-                :form="form"
-                @onSubmit="onSubmit"
-                :fieldList="fieldList"
-                :achievestatusList="achievestatusList"
-                :cooperationList="cooperationList"
-              ></producInfo>
-            </van-tab>
-            <van-tab title="商务服务">
-              <producInfo
-                :type="type"
-                :form="form"
-                @onSubmit="onSubmit"
-                :fieldList="fieldList"
-                :achievestatusList="achievestatusList"
-                :cooperationList="cooperationList"
-              ></producInfo>
-            </van-tab>
-          </van-tabs>
+          <van-form>
+            <van-field v-model="form.product_name" name="产品名称" label="产品名称" placeholder="产品名称" readonly />
+            <van-field v-model="form.market_username" name="营销人名称" label="营销人名称" placeholder="营销人名称" readonly />
+            <van-field v-model="form.username" name="购买人名称" label="购买人名称" placeholder="购买人名称" readonly />
+            <van-field v-model="form.description" rows="1" autosize label="描述" type="textarea" placeholder="描述" />
+            <div style="margin: 16px;">
+              <van-button round block type="info" @click="onSubmit">
+                提交
+              </van-button>
+            </div>
+          </van-form>
         </el-col>
       </el-col>
     </el-row>
@@ -45,19 +24,15 @@
 </template>
 
 <script>
-import producInfo from './parts/producInfo.vue';
 import NavBar from '@/layout/common/topInfo.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: markettype } = createNamespacedHelpers('markettype');
-const { mapActions: marketuser } = createNamespacedHelpers('marketuser');
-const { mapActions: exportuser } = createNamespacedHelpers('exportuser');
-const { mapActions: product } = createNamespacedHelpers('product');
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
+const { mapActions: productpact } = createNamespacedHelpers('productpact');
 export default {
   name: 'detail',
   props: {},
   components: {
     NavBar,
-    producInfo,
   },
   data: function() {
     return {
@@ -67,122 +42,47 @@ export default {
       isleftarrow: '',
       // 返回
       navShow: true,
-      active: 0,
-      type: '0',
       form: {},
-      // 字典表
-      fieldList: [],
-      achievestatusList: [],
-      cooperationList: [],
     };
   },
   async created() {
-    await this.searchtype();
-    await this.searchinfo();
     if (this.id) {
-      await this.searchproductinfo();
+      await this.search();
     }
   },
   methods: {
-    ...markettype({ markettypeList: 'query' }),
-    ...marketuser({ marketuserfetch: 'fetch' }),
-    ...exportuser({ exportuserfetch: 'fetch' }),
-    ...product({ productFetch: 'fetch', productCreate: 'create', productUpdate: 'update' }),
-    // 查询企业详情
-    async searchinfo() {
-      let user = this.user;
-      if (user.role == '4' || user.role == '5') {
-        let res = await this.marketuserfetch(user.userid);
-        if (res.errcode === 0) {
-          let message = {
-            company: res.data.name,
-            phone: res.data.phone,
-            email: res.data.email,
-            companytype: res.data.companytype,
-            companydate: res.data.companydate,
-            companycapital: res.data.companycapital,
-          };
-          this.$set(this, `form`, message);
-        }
-      } else {
-        let res = await this.exportuserfetch(user.userid);
-        if (res.errcode === 0) {
-          let message = {
-            company: res.data.name,
-            phone: res.data.phone,
-            email: res.data.email,
-            qqwx: res.data.qqwx,
-          };
-          this.$set(this, `form`, message);
-        }
-      }
-    },
-    // 查询产品详情
-    async searchproductinfo() {
-      let res = await this.productFetch(this.id);
+    ...transaction({ transactionfetch: 'fetch', transactionlist: 'query', transactiondetele: 'detele', transactionupdate: 'update' }),
+    ...productpact({ transactionQuery: 'query', productpactFetch: 'findpact', productpactUpdate: 'update', productpactCreate: 'create' }),
+    async search() {
+      let res = await this.transactionfetch(this.id);
       if (this.$checkRes(res)) {
-        this.$set(this, `form`, res.data);
+        this.$set(this, 'form', res.data);
       }
     },
-    // 查询字典表
-    async searchtype() {
-      // 所属领域;
-      let res = await this.markettypeList({ category: '01' });
-      if (this.$checkRes(res)) {
-        this.$set(this, `fieldList`, res.data);
-      }
-      // 成果状态;
-      res = await this.markettypeList({ category: '02' });
-      if (this.$checkRes(res)) {
-        this.$set(this, `achievestatusList`, res.data);
-      }
-      // 合作方式;
-      res = await this.markettypeList({ category: '03' });
-      if (this.$checkRes(res)) {
-        this.$set(this, `cooperationList`, res.data);
-      }
-    },
-    // 选择类型
-    clickbtn(name) {
-      this.$set(this, `type`, String(name));
-    },
     // 提交
-    async onSubmit({ data }) {
-      data.type = this.type;
-      data.userid = this.user.uid;
-      let res = await this.productCreate(data);
+    async onSubmit() {
+      let data = this.form;
+      data.status = '0';
+      data.transaction_id = this.form.id;
+      const res = await this.productpactCreate(data);
       if (this.$checkRes(res)) {
-        this.$notify({
-          message: '保存草稿成功',
-          type: 'success',
-        });
-        this.$router.push({ path: '/userCenter/myProduct/index' });
+        data.status = '4';
+        const arr = await this.transactionupdate(data);
+        if (this.$checkRes(arr)) {
+          this.$notify({
+            message: '提交交易成功,等待管理员审核,方可交易完成',
+            type: 'success',
+          });
+          this.$router.push({ path: '/userCenter/matter/index' });
+        }
       }
     },
-    // 监听显示类型
-    changetype() {
-      let type = this.producttype;
-      this.$set(this, `active`, Number(type));
-      this.$set(this, `type`, type);
-    },
   },
   computed: {
     ...mapState(['user']),
     id() {
       return this.$route.query.id;
     },
-    producttype() {
-      return this.$route.query.type;
-    },
-  },
-  watch: {
-    producttype: {
-      immediate: true,
-      deep: true,
-      handler(val) {
-        this.changetype();
-      },
-    },
   },
   mounted() {
     this.title = this.$route.meta.title;