guhongwei 4 år sedan
förälder
incheckning
f21d360140

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

@@ -48,8 +48,8 @@
         </div>
         <el-col :span="24" class="anniu">
           <el-button type="primary" @click="btnPhone()" v-if="this.user.uid != zhuanjiainfo.userid">对接聊天</el-button>
-          <el-button v-if="this.user.uid != zhuanjiainfo.userid" @click="zjsubmit()" type="success">洽谈交易</el-button></el-col
-        >
+          <el-button v-if="this.user.uid != zhuanjiainfo.userid" @click="zjsubmit()" type="success">洽谈交易</el-button>
+        </el-col>
       </el-col>
       <el-dialog title="对接聊天" :visible.sync="dialogTableVisible">
         <el-col :span="24" class="two">

+ 55 - 3
src/views/market/detail/achiDetail.vue

@@ -60,24 +60,73 @@
             </p>
           </el-col>
         </el-col>
+        <el-col :span="24" class="anniu">
+          <el-button type="primary" size="mini" v-if="this.user.uid != detailInfo.userid" @click="btnPhone()">对接聊天</el-button>
+          <el-button type="success" size="mini" v-if="this.user.uid != detailInfo.userid" @click="onSubmit()">洽谈交易</el-button>
+        </el-col>
       </el-col>
     </el-row>
+    <el-dialog title="对接聊天" :visible.sync="dialogTableVisible">
+      <chat :room="room"></chat>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import _ from 'lodash';
 import { mapState, createNamespacedHelpers } from 'vuex';
+import chat from '@/layout/market/parts/chat.vue';
+const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
 export default {
   name: 'achiDetail',
   props: {
     detailInfo: { type: Object },
   },
-  components: {},
+  components: { chat },
   data: function() {
-    return {};
+    return { dialogTableVisible: false, room: {} };
   },
   created() {},
-  methods: {},
+  methods: {
+    ...personalRoom(['create', 'countDelete']),
+    ...transaction({ buyProduct: 'create' }),
+    // 对接聊天
+    async btnPhone() {
+      if (!this.room.id) {
+        //TODO 请求房间号
+        let obj = {};
+        if (!this.user.uid) {
+          // this.$message.error('游客身份无法与卖家对话,请先注册');
+          this.$message({
+            dangerouslyUseHTMLString: true,
+            message: '<strong><a href="http://free.liaoningdoupo.com/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
+            type: 'error',
+          });
+          return;
+        } else {
+          obj.buyer_id = this.user.uid;
+          obj.buyer_name = this.user.name;
+        }
+        if (!this.detailInfo.userid) {
+          this.$message.error('缺少卖家信息,请联系卖家或管理员');
+          return;
+        } else {
+          obj.seller_id = this.detailInfo.userid;
+          obj.seller_name = this.detailInfo.contacts;
+        }
+        let res = await this.create(obj);
+        if (this.$checkRes(res)) {
+          this.$set(this, `room`, res.data);
+        }
+      }
+      this.dialogTableVisible = true;
+    },
+    // 洽谈交易
+    onSubmit() {
+      this.$emit('onSubmit', { data: this.detailInfo });
+    },
+  },
   computed: {
     ...mapState(['user']),
     pageTitle() {
@@ -120,5 +169,8 @@ export default {
       }
     }
   }
+  .anniu {
+    text-align: center;
+  }
 }
 </style>

+ 55 - 3
src/views/market/detail/busiDetail.vue

@@ -39,24 +39,73 @@
             </p>
           </el-col>
         </el-col>
+        <el-col :span="24" class="anniu">
+          <el-button type="primary" size="mini" v-if="this.user.uid != detailInfo.userid" @click="btnPhone()">对接聊天</el-button>
+          <el-button type="success" size="mini" v-if="this.user.uid != detailInfo.userid" @click="onSubmit()">洽谈交易</el-button>
+        </el-col>
       </el-col>
     </el-row>
+    <el-dialog title="对接聊天" :visible.sync="dialogTableVisible">
+      <chat :room="room"></chat>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import _ from 'lodash';
 import { mapState, createNamespacedHelpers } from 'vuex';
+import chat from '@/layout/market/parts/chat.vue';
+const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
 export default {
   name: 'busiDetail',
   props: {
     detailInfo: { type: Object },
   },
-  components: {},
+  components: { chat },
   data: function() {
-    return {};
+    return { dialogTableVisible: false, room: {} };
   },
   created() {},
-  methods: {},
+  methods: {
+    ...personalRoom(['create', 'countDelete']),
+    ...transaction({ buyProduct: 'create' }),
+    // 对接聊天
+    async btnPhone() {
+      if (!this.room.id) {
+        //TODO 请求房间号
+        let obj = {};
+        if (!this.user.uid) {
+          // this.$message.error('游客身份无法与卖家对话,请先注册');
+          this.$message({
+            dangerouslyUseHTMLString: true,
+            message: '<strong><a href="http://free.liaoningdoupo.com/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
+            type: 'error',
+          });
+          return;
+        } else {
+          obj.buyer_id = this.user.uid;
+          obj.buyer_name = this.user.name;
+        }
+        if (!this.detailInfo.userid) {
+          this.$message.error('缺少卖家信息,请联系卖家或管理员');
+          return;
+        } else {
+          obj.seller_id = this.detailInfo.userid;
+          obj.seller_name = this.detailInfo.contacts;
+        }
+        let res = await this.create(obj);
+        if (this.$checkRes(res)) {
+          this.$set(this, `room`, res.data);
+        }
+      }
+      this.dialogTableVisible = true;
+    },
+    // 洽谈交易
+    onSubmit() {
+      this.$emit('onSubmit', { data: this.detailInfo });
+    },
+  },
   // 过滤时间
   filters: {
     getDate(meta) {
@@ -105,5 +154,8 @@ export default {
       }
     }
   }
+  .anniu {
+    text-align: center;
+  }
 }
 </style>

+ 56 - 2
src/views/market/detail/expeDetail.vue

@@ -53,26 +53,77 @@
             </p>
           </el-col>
         </el-col>
+        <el-col :span="24" class="anniu">
+          <el-button type="primary" size="mini" v-if="this.user.uid != detailInfo.userid" @click="btnPhone()">对接聊天</el-button>
+          <el-button type="success" size="mini" v-if="this.user.uid != detailInfo.userid" @click="onSubmit()">洽谈交易</el-button>
+        </el-col>
       </el-col>
     </el-row>
+    <el-dialog title="对接聊天" :visible.sync="dialogTableVisible">
+      <chat :room="room"></chat>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import _ from 'lodash';
 import { mapState, createNamespacedHelpers } from 'vuex';
+import chat from '@/layout/market/parts/chat.vue';
+const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
 export default {
   name: 'techDetail',
   props: {
     detailInfo: { type: Object },
   },
-  components: {},
+  components: { chat },
   data: function() {
     return {
       expertimage: require('@/assets/live/222.png'),
+      dialogTableVisible: false,
+      room: {},
     };
   },
   created() {},
-  methods: {},
+  methods: {
+    ...personalRoom(['create', 'countDelete']),
+    ...transaction({ buyProduct: 'create' }),
+    // 对接聊天
+    async btnPhone() {
+      if (!this.room.id) {
+        //TODO 请求房间号
+        let obj = {};
+        if (!this.user.uid) {
+          // this.$message.error('游客身份无法与卖家对话,请先注册');
+          this.$message({
+            dangerouslyUseHTMLString: true,
+            message: '<strong><a href="http://free.liaoningdoupo.com/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
+            type: 'error',
+          });
+          return;
+        } else {
+          obj.buyer_id = this.user.uid;
+          obj.buyer_name = this.user.name;
+        }
+        if (!this.detailInfo.id) {
+          this.$message.error('缺少卖家信息,请联系卖家或管理员');
+          return;
+        } else {
+          obj.seller_id = this.detailInfo.userid;
+          obj.seller_name = this.detailInfo.name;
+        }
+        let res = await this.create(obj);
+        if (this.$checkRes(res)) {
+          this.$set(this, `room`, res.data);
+        }
+      }
+      this.dialogTableVisible = true;
+    },
+    // 洽谈交易
+    onSubmit() {
+      this.$emit('onSubmit', { data: this.detailInfo });
+    },
+  },
   computed: {
     ...mapState(['user']),
     pageTitle() {
@@ -115,5 +166,8 @@ export default {
       }
     }
   }
+  .anniu {
+    text-align: center;
+  }
 }
 </style>

+ 61 - 3
src/views/market/detail/techDetail.vue

@@ -46,24 +46,79 @@
             </p>
           </el-col>
         </el-col>
+        <el-col :span="24" class="anniu">
+          <el-button type="primary" size="mini" v-if="this.user.uid != detailInfo.userid" @click="btnPhone()">对接聊天</el-button>
+          <el-button type="success" size="mini" v-if="this.user.uid != detailInfo.userid" @click="onSubmit()">洽谈交易</el-button>
+        </el-col>
       </el-col>
     </el-row>
+    <el-dialog title="对接聊天" :visible.sync="dialogTableVisible">
+      <chat :room="room"></chat>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import _ from 'lodash';
 import { mapState, createNamespacedHelpers } from 'vuex';
+import chat from '@/layout/market/parts/chat.vue';
+const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
 export default {
   name: 'techDetail',
   props: {
     detailInfo: { type: Object },
   },
-  components: {},
+  components: {
+    chat,
+  },
   data: function() {
-    return {};
+    return {
+      dialogTableVisible: false,
+      room: {},
+    };
   },
   created() {},
-  methods: {},
+  methods: {
+    ...personalRoom(['create', 'countDelete']),
+    ...transaction({ buyProduct: 'create' }),
+    // 对接聊天
+    async btnPhone() {
+      if (!this.room.id) {
+        //TODO 请求房间号
+        let obj = {};
+        if (!this.user.uid) {
+          // this.$message.error('游客身份无法与卖家对话,请先注册');
+          this.$message({
+            dangerouslyUseHTMLString: true,
+            message: '<strong><a href="http://free.liaoningdoupo.com/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
+            type: 'error',
+          });
+          return;
+        } else {
+          obj.buyer_id = this.user.uid;
+          obj.buyer_name = this.user.name;
+        }
+        if (!this.detailInfo.userid) {
+          this.$message.error('缺少卖家信息,请联系卖家或管理员');
+          return;
+        } else {
+          obj.seller_id = this.detailInfo.userid;
+          obj.seller_name = this.detailInfo.contacts;
+        }
+        console.log(obj);
+        let res = await this.create(obj);
+        if (this.$checkRes(res)) {
+          this.$set(this, `room`, res.data);
+        }
+      }
+      this.dialogTableVisible = true;
+    },
+    // 洽谈交易
+    onSubmit() {
+      this.$emit('onSubmit', { data: this.detailInfo });
+    },
+  },
   computed: {
     ...mapState(['user']),
     pageTitle() {
@@ -106,5 +161,8 @@ export default {
       }
     }
   }
+  .anniu {
+    text-align: center;
+  }
 }
 </style>

+ 54 - 4
src/views/market/marketlists.vue

@@ -43,7 +43,7 @@
                   <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
                 </el-col>
                 <el-col :span="24">
-                  <techDetail :detailInfo="techDetail"></techDetail>
+                  <techDetail :detailInfo="techDetail" @onSubmit="techSubmit"></techDetail>
                 </el-col>
               </span>
               <span v-else-if="column_name == '技术成果'">
@@ -51,7 +51,7 @@
                   <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
                 </el-col>
                 <el-col :span="24">
-                  <achiDetail :detailInfo="achiDetail"></achiDetail>
+                  <achiDetail :detailInfo="achiDetail" @onSubmit="techSubmit"></achiDetail>
                 </el-col>
               </span>
               <span v-else-if="column_name == '商务信息'">
@@ -59,7 +59,7 @@
                   <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
                 </el-col>
                 <el-col :span="24">
-                  <busiDetail :detailInfo="busiDetail"></busiDetail>
+                  <busiDetail :detailInfo="busiDetail" @onSubmit="techSubmit"></busiDetail>
                 </el-col>
               </span>
               <span v-else-if="column_name == '专家服务'">
@@ -67,7 +67,7 @@
                   <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
                 </el-col>
                 <el-col :span="24">
-                  <expeDetail :detailInfo="expeDetail"></expeDetail>
+                  <expeDetail :detailInfo="expeDetail" @onSubmit="expertSuubmit"></expeDetail>
                 </el-col>
               </span>
             </span>
@@ -92,6 +92,7 @@ import expeDetail from './detail/expeDetail.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: product } = createNamespacedHelpers('enterpriseproject');
 const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
 export default {
   name: 'marketlists',
   props: {},
@@ -148,6 +149,7 @@ export default {
   methods: {
     ...product({ productList: 'newquery', productFetch: 'newfetch' }),
     ...expertsuser({ expertsuserList: 'query', expertsuserFetch: 'fetch' }),
+    ...transaction({ transactioncreate: 'create', transactionfetch: 'fetch' }),
     // 查询栏目,列表,详情
     async searchColumn() {
       if (this.type == 0) {
@@ -217,6 +219,54 @@ export default {
       this.display = 'detail';
       this.searchDetail(column_name, id);
     },
+    // 科技需求,技术成果,商务信息洽谈交易
+    async techSubmit({ data }) {
+      let form = {
+        userid: this.user.uid,
+        username: this.user.name,
+        product_id: data.id,
+        product_name: data.name,
+        market_userid: data.userid,
+        market_username: data.contacts,
+        status: '0',
+      };
+      if (!this.user.uid) {
+        this.$message({
+          dangerouslyUseHTMLString: true,
+          message: '<strong><a href="http://free.liaoningdoupo.com/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
+          type: 'error',
+        });
+        return;
+      } else {
+        let res = await this.transactioncreate(form);
+        this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
+      }
+    },
+    // 专家服务
+    async expertSuubmit({ data }) {
+      let form = {
+        userid: this.user.uid,
+        username: this.user.name,
+        product_id: data.id,
+        product_name: data.name,
+        market_userid: data.id,
+        market_username: data.name,
+        status: '0',
+        type: '1',
+      };
+      if (!this.user.uid) {
+        // this.$message.error('游客身份无法与卖家对话,请先注册');
+        this.$message({
+          dangerouslyUseHTMLString: true,
+          message: '<strong><a href="http://free.liaoningdoupo.com/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
+          type: 'error',
+        });
+        return;
+      } else {
+        let res = await this.transactioncreate(form);
+        this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
+      }
+    },
   },
   computed: {
     ...mapState(['user']),