Browse Source

Merge branch 'master' of http://git.cc-lotus.info/live/web-live

lrf402788946 3 years ago
parent
commit
0093b21281

+ 1 - 0
src/main.js

@@ -11,6 +11,7 @@ import '@/plugins/loading';
 import '@/plugins/var';
 import '@/plugins/methods';
 import '@/plugins/setting';
+import '@/plugins/components';
 import InitStomp from '@/plugins/stomp';
 Vue.config.productionTip = false;
 new Vue({

+ 12 - 0
src/plugins/components.js

@@ -0,0 +1,12 @@
+import Vue from 'vue';
+import dataTable from '@common/src/components/frame/filter-page-table.vue';
+import dataForm from '@common/src/components/frame/form.vue';
+import eUpload from '@common/src/components/frame/upload.vue';
+const Plugin = vue => {
+  vue.prototype.$dev_mode = process.env.NODE_ENV === 'development';
+  vue.component('data-table', dataTable);
+  vue.component('data-form', dataForm);
+  vue.component('eUpload', eUpload);
+};
+
+Vue.use(Plugin);

+ 3 - 0
src/store/index.js

@@ -23,6 +23,8 @@ import dockUser from '@common/src/store/dock/dock_user';
 import dockVip from '@common/src/store/dock/dockVip';
 // 交易记录
 import dockTranscation from '@common/src/store/dock/dockTranscation';
+// 公共聊天
+import dockChat from '@common/src/store/dock/dockChat';
 // 培训问诊
 import trainLive from '@common/src/store/trainLive';
 import trainchat from '@common/src/store/trainchat';
@@ -77,6 +79,7 @@ export default new Vuex.Store({
     dockUser,
     dockVip,
     dockTranscation,
+    dockChat,
     trainLive,
     trainchat,
     channel,

+ 148 - 6
src/views/achieveLive/detail/chatData.vue

@@ -6,7 +6,35 @@
           <el-tabs v-model="active" type="card">
             <el-tab-pane label="公共聊天" name="first">
               <el-col :span="24" class="first">
-                公共聊天
+                <el-col :span="24" class="first_1">
+                  <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
+                    <el-col :span="24" class="name">
+                      <span>[{{ item.send_time }}]</span>
+                      <span>{{ item.sender_name }}</span>
+                    </el-col>
+                    <el-col :span="24" class="content">
+                      {{ item.content }}
+                    </el-col>
+                  </el-col>
+                </el-col>
+                <el-col :span="24" class="first_2">
+                  <el-col :span="14" class="text">
+                    <el-input v-model="text"></el-input>
+                  </el-col>
+                  <el-col :span="10" class="btn">
+                    <el-col :span="10" class="btn_1">
+                      <el-button type="primary" size="mini" @click="send">发送</el-button>
+                    </el-col>
+                    <el-col :span="14" class="btn_1">
+                      <el-popover placement="top" trigger="click">
+                        <el-col :span="24">
+                          <p class="textList" v-for="(item, index) in textList" :key="index" @click="textBtn(item.name)">{{ item.name }}</p>
+                        </el-col>
+                        <el-button slot="reference" type="primary" size="mini">快捷发言</el-button>
+                      </el-popover>
+                    </el-col>
+                  </el-col>
+                </el-col>
               </el-col>
             </el-tab-pane>
           </el-tabs>
@@ -18,6 +46,8 @@
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: dockChat } = createNamespacedHelpers('dockChat');
+var moment = require('moment');
 export default {
   name: 'chatData',
   props: {},
@@ -25,11 +55,68 @@ export default {
   data: function() {
     return {
       active: 'first',
-      list: [],
+      list: [
+        {
+          send_time: '2021-01-01 10:00:00',
+          sender_name: '发言人',
+          content: '发言内容发言内容发言内容发言内容发言内容',
+        },
+      ],
+      // 发言内容
+      text: '',
+      textList: [{ name: '欢迎欢迎' }, { name: '科技创新' }, { name: '大咖云集' }],
     };
   },
-  created() {},
-  methods: {},
+  created() {
+    if (this.dock_id) this.search();
+  },
+  mounted() {
+    this.scrollToBottom();
+  },
+  //每次页面渲染完之后滚动条在最底部
+  updated() {
+    this.scrollToBottom();
+  },
+  methods: {
+    ...dockChat(['query', 'create']),
+    async search() {
+      let res = await this.query({ dock_id: this.dock_id });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+      }
+    },
+    async send() {
+      let data = {
+        dock_id: this.dock_id,
+        content: this.text,
+        sender_id: this.user ? this.user.id : this.getData(),
+        sender_name: this.user ? this.user.name : this.getData() + '游客',
+        send_time: moment().format('yyyy-MM-DD HH:mm:ss'),
+      };
+      if (data.content != '') {
+        const res = await this.create(data);
+        this.$checkRes(res, null, '发言成功' || '发言失败');
+        this.$set(this, 'text', '');
+        this.search();
+      } else this.$message.error('请输入信息后发送');
+    },
+    textBtn(text) {
+      this.$set(this, `text`, text);
+      this.send();
+    },
+    // 获取时间戳
+    getData() {
+      let date = moment(new Date()).valueOf();
+      if (date) return date;
+    },
+    // 整理滚动条
+    scrollToBottom: function() {
+      this.$nextTick(() => {
+        var container = this.$el.querySelector('.first_1');
+        container.scrollTop = container.scrollHeight;
+      });
+    },
+  },
   computed: {
     ...mapState(['user']),
     dock_id() {
@@ -53,13 +140,68 @@ export default {
 .main {
   .one {
     .first {
-      padding: 0 10px;
-      height: 410px;
+      padding: 0 5px;
+      height: 460px;
       overflow-y: auto;
+      .first_1 {
+        height: 410px;
+        overflow-y: auto;
+        padding: 0 10px 0 0;
+        .list {
+          margin: 0 0 10px 0;
+          .name {
+            margin: 0 0 5px 0;
+            span {
+              font-size: 14px;
+            }
+            span:nth-child(1) {
+              color: #666;
+            }
+            span:nth-child(2) {
+              font-weight: bold;
+              padding: 0 0 0 5px;
+            }
+          }
+          .content {
+            background-color: #f1f1f1;
+            padding: 10px 5px;
+            border-radius: 5px;
+          }
+        }
+      }
+      .first_2 {
+        height: 40px;
+        box-shadow: 0 0 5px #ccc;
+        padding: 5px;
+        border-radius: 5px;
+        .text {
+          /deep/.el-input__inner {
+            height: 30px;
+            line-height: 30px;
+            padding: 0 5px;
+          }
+        }
+        .btn {
+          .btn_1 {
+            height: 40px;
+            line-height: 24px;
+            text-align: center;
+          }
+        }
+      }
     }
     /deep/.el-tabs__header {
       margin: 0 0 10px 0;
     }
   }
 }
+.textList {
+  text-align: center;
+  padding: 5px 0;
+  border-bottom: 1px dashed #ccc;
+}
+.textList:hover {
+  cursor: pointer;
+  color: #409eff;
+}
 </style>

+ 41 - 0
src/views/achieveLive/detail/imgtextData.vue

@@ -93,6 +93,13 @@ export default {
   created() {
     if (this.dock_id) this.search();
   },
+  mounted() {
+    this.scrollToBottom();
+  },
+  //每次页面渲染完之后滚动条在最底部
+  updated() {
+    this.scrollToBottom();
+  },
   methods: {
     ...dockImgtxt(['query']),
     ...dockTranscation({ transQuery: 'query' }),
@@ -123,6 +130,13 @@ export default {
       else if (val == '3') return '交易完成';
       else if (val == '4') return '交易失败';
     },
+    // 整理滚动条
+    scrollToBottom: function() {
+      this.$nextTick(() => {
+        var container = this.$el.querySelector('.first');
+        container.scrollTop = container.scrollHeight;
+      });
+    },
   },
   computed: {
     ...mapState(['user']),
@@ -187,6 +201,33 @@ export default {
         }
       }
     }
+    .second {
+      padding: 0 10px;
+      height: 415px;
+      overflow-y: auto;
+      .secondList {
+        border-bottom: 1px dashed #ff0000;
+        padding: 10px 0;
+        span {
+          float: left;
+          font-weight: bold;
+          font-size: 16px;
+        }
+        span:nth-child(1) {
+          color: #ff0000;
+        }
+        span:nth-child(2n) {
+          width: 32%;
+          margin: 0 10px 0 10px;
+        }
+        span:nth-child(3) {
+          color: #666;
+        }
+        span:nth-child(5) {
+          float: right;
+        }
+      }
+    }
   }
 }
 </style>

+ 123 - 120
src/views/userCenter/menuParst/matterInfo.vue

@@ -7,98 +7,90 @@
         </el-col>
         <el-col :span="24" class="two">
           <el-tabs v-model="active" type="card" @tab-click="tabChange">
-            <el-tab-pane label="我的全部" name="all">
-              <data-table
-                :fields="fields"
-                :opera="opera"
-                :data="listall"
-                :total="totalall"
-                @query="search"
-                @check="data => toStep(data, '1')"
-                @keep="toKeep"
-              ></data-table>
+            <el-tab-pane label="洽谈合作" name="0">
+              <data-table :fields="fields" :opera="opera" :data="list0" :total="total0" @query="search" @refuse="torefuse" @inten="toInten"></data-table>
             </el-tab-pane>
-            <el-tab-pane label="我的洽谈" name="0">
-              <data-table
-                :fields="fields"
-                :opera="opera"
-                :data="list0"
-                :total="total0"
-                @query="data => search(data, '0')"
-                @check="data => toStep(data, '1')"
-              ></data-table>
+            <el-tab-pane label="达成意向" name="1">
+              <data-table :fields="fields" :opera="opera" :data="list1" :total="total1" @query="search" @refuse="torefuse" @keep="toKeep"></data-table>
             </el-tab-pane>
-            <el-tab-pane label="我的意向" name="1">
-              <data-table :fields="fields" :opera="opera" :data="list1" :total="total1" @query="data => search(data, '1')" @keep="toKeep"></data-table>
+            <el-tab-pane label="交易备案" name="2">
+              <data-table :fields="fields" :opera="opera" :data="list2" :total="total2" @query="search" @refuse="torefuse"></data-table>
             </el-tab-pane>
-            <el-tab-pane label="我的交易" name="2">
-              <data-table :fields="fields" :opera="[]" :data="list2" :total="total2" @query="data => search(data, '2')"></data-table>
+            <el-tab-pane label="交易完成" name="3">
+              <data-table :fields="fields" :opera="opera" :data="list3" :total="total3" @query="search" @refuse="torefuse"></data-table>
+            </el-tab-pane>
+            <el-tab-pane label="交易失败" name="4">
+              <data-table :fields="fields" :opera="opera" :data="list4" :total="total4" @query="search"></data-table>
             </el-tab-pane>
           </el-tabs>
         </el-col>
       </el-col>
     </el-row>
-    <el-dialog title="上传合同备案" :visible.sync="dialog" width="40%" @close="toClose" destroy-on-close>
-      <el-form>
-        <el-form-item label="合同图片" required>
-          <upload
-            :limit="1"
-            :data="keep.file_path"
-            type="file_path"
-            listType=""
-            :url="'/files/platform/transaction_pact/upload'"
-            @upload="uploadSuccess"
-            @delete="uploadDelete"
-          ></upload>
+    <el-dialog class="dialog" title="合同备案" :visible.sync="dialog" width="40%" @close="toClose" destroy-on-close>
+      <el-form ref="form" :model="form" label-width="90px">
+        <el-form-item label="产品名称">
+          <el-input v-model="form.product.name" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="供给者姓名">
+          <el-input v-model="form.s_name" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="供给者电话">
+          <el-input v-model="form.s_phone" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="需求者姓名">
+          <el-input v-model="form.d_name" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="需求者电话">
+          <el-input v-model="form.d_phone" disabled></el-input>
         </el-form-item>
-        <el-form-item label="描述" required>
-          <el-input type="textarea" v-model="keep.desc" :autosize="{ minRows: 3, maxRows: 5 }"></el-input>
+        <el-form-item label="合同图片">
+          <e-upload url="/files/platlive/tranContact/upload" :limit="1" v-model="form.contact" type="contact" @upload="upload" @delete="onDelete"></e-upload>
         </el-form-item>
       </el-form>
-      <div slot="footer">
-        <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="primary" @click="stepKeep">确 定</el-button>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="toClose">取消备案</el-button>
+        <el-button type="primary" @click="onSubmit">提交备案</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import upload from '@common/src/components/frame/upload.vue';
-import dataTable from '@common/src/components/frame/filter-page-table.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: transaction } = createNamespacedHelpers('transaction');
+const { mapActions: dockTranscation } = createNamespacedHelpers('dockTranscation');
+const _ = require('lodash');
 export default {
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
   name: 'matterInfo',
   props: {},
-  components: {
-    dataTable,
-    upload,
-  },
+  components: {},
   data: function() {
     return {
-      active: 'all',
+      active: '0',
       opera: [
         {
-          label: '意向',
-          method: 'check',
+          label: '达成意向',
+          method: 'inten',
           display: item => {
-            return item.status == '0';
+            return item.status == '0' && item.s_id == this.user.id;
           },
         },
         {
-          label: '备案',
+          label: '交易备案',
           method: 'keep',
           display: item => {
-            return item.status == '1';
+            return item.status == '1' && item.s_id == this.user.id;
+          },
+        },
+        {
+          label: '拒绝交易',
+          method: 'refuse',
+          display: item => {
+            return item.status == '0' || item.status == '1' || item.status == '2';
           },
         },
       ],
       fields: [
-        { label: '产品名称', prop: 'product', showTip: true },
+        { label: '产品名称', prop: 'product.name', showTip: true },
         { label: '供给者姓名', prop: 's_name', showTip: true },
         { label: '供给者电话', prop: 's_phone', showTip: true },
         { label: '需求者姓名', prop: 'd_name', showTip: true },
@@ -107,102 +99,100 @@ export default {
           label: '交易状态',
           prop: 'status',
           format: item => {
-            return item === '0' ? '正在洽谈' : item === '1' ? '达成意向' : item === '2' ? '交易备案' : item === '3' ? '交易完成' : '交易失败';
+            return item === '0' ? '正在洽谈' : item === '1' ? '达成意向' : item === '2' ? '备案' : item === '3' ? '交易完成' : '交易失败';
           },
         },
       ],
-      // 我的全部
-      listall: [],
-      totalall: 0,
-      // 我的洽谈
+      // 洽谈合作
       list0: [],
       total0: 0,
-      // 我的意向
+      // 达成意向
       list1: [],
       total1: 0,
-      // 交易完成
+      //  交易备案
       list2: [],
       total2: 0,
+      // 交易完成
+      list3: [],
+      total3: 0,
+      // 交易失败
+      list4: [],
+      total4: 0,
+      // 合同备案
       dialog: false,
-      keep: {},
+      form: {
+        product: {},
+      },
     };
   },
-  async created() {
-    await this.search();
+  created() {
+    this.search();
   },
   methods: {
-    ...transaction(['query', 'step']),
-    async search({ skip = 0, limit = 10, ...info } = {}, status = 'all') {
-      const query = { skip, limit, user_id: this.user.id };
-      if (status != 'all') query.status = status == '2' ? '2,3' : status;
-      const res = await this.query(query);
+    ...dockTranscation(['userList', 'update']),
+    async search({ skip = 0, limit = 10, ...info } = {}, status = '0') {
+      info.status = status;
+      info.user_id = this.user.id;
+      let res = await this.userList({ skip, limit, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `list${status}`, res.data);
         this.$set(this, `total${status}`, res.total);
       }
     },
-    async toStep({ data }, status) {
-      console.log(status);
-      this.$confirm('您确定双方已达成意向?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning',
-      })
-        .then(async () => {
-          const { id } = data;
-          const res = await this.step({ id, status });
-          if (this.$checkRes(res, '达成意向!', res.errmsg || '操作失败')) this.research();
-        })
-        .catch(() => {});
+    tabChange(tab) {
+      const status = _.get(tab, 'name', 0);
+      this.search({}, status);
+    },
+    // 达成意向
+    async toInten({ data }) {
+      data.status = '1';
+      let res = await this.update(data);
+      if (this.$checkRes(res, '意向提交成功', res.errmsg || '操作失败')) this.search();
     },
+    // 交易备案
     async toKeep({ data }) {
-      this.keep = _.cloneDeep(data);
-      this.keep.status = '2';
+      this.$set(this, `form`, data);
       this.dialog = true;
     },
-    async stepKeep() {
-      const { id, file_path, desc } = this.keep;
-      if (!(id && file_path && desc)) {
-        this.$message.error('需要上传合同图片及填写描述内容');
-        return;
-      }
-      const dup = { id, pact: { file_path, desc }, status: '2' };
-      const res = await this.step(dup);
-      if (this.$checkRes(res, '备案成功,请等待审核', res.errmsg || '备案失败')) this.research();
-    },
-    tabChange(tab) {
-      const status = _.get(tab, 'name', 0);
-      if (this[`list${status}`].length <= 0) {
-        this.search({}, status);
-      }
+    // 提交备案
+    async onSubmit() {
+      let data = this.form;
+      data.status = '2';
+      let res = await this.update(data);
+      if (this.$checkRes(res, '交易备案提交成功', res.errmsg || '操作失败')) this.toClose();
+      this.search();
     },
+    // 关闭交易备案
     toClose() {
-      this.keep = {};
-    },
-    research() {
-      this.search();
-      if (this.active !== 'all') this.search({}, this.active);
       this.dialog = false;
     },
-    uploadSuccess({ type, data }) {
-      this.$set(this.keep, `${type}`, data.uri);
-      this.$message({
-        message: '上传成功',
-        type: 'success',
-      });
+    // 拒绝交易
+    async torefuse({ data }) {
+      data.status = '4';
+      let res = await this.update(data);
+      if (this.$checkRes(res, '交易失败提交成功', res.errmsg || '操作失败')) this.search();
+    },
+    // 上传图片
+    upload({ type, data }) {
+      this.$set(this.form, `${type}`, data.uri);
     },
-    uploadDelete(index) {
-      this.$set(this.keep, `file_path`, null);
-      this.$message({
-        message: '删除成功',
-        type: 'success',
-      });
+    onDelete(data) {
+      this.$set(this.form, `${data.type}`, '');
     },
   },
   computed: {
     ...mapState(['user']),
   },
-  watch: {},
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
 };
 </script>
 
@@ -219,5 +209,18 @@ export default {
     color: #22529a;
     margin: 0 0 10px 0;
   }
+  .two {
+    /deep/.el-tabs__header {
+      margin: 0 0 10px 0;
+    }
+  }
+}
+.dialog {
+  /deep/.el-dialog__footer {
+    text-align: center;
+  }
+  /deep/.el-dialog__body {
+    padding: 5px 10px;
+  }
 }
 </style>