Browse Source

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

lrf 2 years ago
parent
commit
b0c206577d

+ 7 - 7
src/layout/header/notice.vue

@@ -51,13 +51,13 @@ export default {
       body = JSON.parse(body);
       const type = body.type;
       if (type === 'shopMsg') {
-        this.$notify({
-          title: '新消息',
-          message: '您有新的消息,请注意及时处理!',
-          position: 'top-right',
-          type: 'warning',
-        });
-        this.getNotRead();
+        // this.$notify({
+        //   title: '新消息',
+        //   message: '您有新的消息,请注意及时处理!',
+        //   position: 'top-right',
+        //   type: 'warning',
+        // });
+        // this.getNotRead();
       } else if (type === 'chat') {
         this.$notify({
           title: '新消息',

+ 5 - 1
src/store/module/message/chatRecord.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex';
 const _ = require('lodash');
 Vue.use(Vuex);
 const api = {
-  url: '/point/v1/api/chatRecord',
+  url: '/point/chat/v1/api/chatRecord',
 };
 
 const state = () => ({});
@@ -22,6 +22,10 @@ const actions = {
     const res = await this.$axios.$post(`${api.url}`, payload);
     return res;
   },
+  async read({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.url}/read`, payload);
+    return res;
+  },
   async fetch({ commit }, payload) {
     const res = await this.$axios.$get(`${api.url}/${payload}`);
     return res;

+ 1 - 1
src/store/module/message/room.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex';
 const _ = require('lodash');
 Vue.use(Vuex);
 const api = {
-  url: '/point/v1/api/room',
+  url: '/point/chat/v1/api/room',
 };
 
 const state = () => ({});

+ 6 - 1
src/views/platmanag/storeAcc/index.vue

@@ -102,7 +102,12 @@ export default {
         { label: '店铺二维码', model: 'qrcode', type: 'upload', url: '/files/point/shopFile/upload' },
         { label: '抽成比例', model: 'cut', custom: true },
       ],
-      rules: {},
+      rules: {
+        name: [{ required: true, message: '店铺名称', trigger: 'blur' }],
+        code: [{ required: true, message: '店铺编号', trigger: 'blur' }],
+        person: [{ required: true, message: '店铺编号', trigger: 'blur' }],
+        logo: [{ required: true, message: '店主', trigger: 'change' }],
+      },
       form: {},
       // 店铺状态列表
       statusList: [],

File diff suppressed because it is too large
+ 113 - 289
src/views/selfShop/message/index.vue


+ 16 - 13
src/views/selfShop/message/parts/left-1.vue

@@ -3,25 +3,28 @@
     <el-row>
       <el-col :span="24" class="main">
         <el-col :span="24" class="left_one">
-          <el-input placeholder="请输入名称" v-model="searchName" size="medium">
-            <el-button slot="append" icon="el-icon-search" @click="toSearch()"></el-button>
+          <el-input placeholder="请输入名称" :disabled="true" size="medium">
+            <el-button slot="append" icon="el-icon-search"></el-button>
           </el-input>
         </el-col>
         <el-col :span="24" class="left_two">
-          <el-col :span="24" v-for="item in list" :key="item._id" @click.native="toView(item)">
+          <el-col :span="24" v-for="item in roomList" :key="item._id" @click.native="toView(item)" style="cursor: pointer">
             <el-col :span="24" class="left_two_1">
               <el-col :span="4" class="left_image">
-                <el-image :src="item.speaker.icon[0].url" class="left_icon"> </el-image>
+                <el-image :src="item.customer.icon[0].url" class="left_icon"> </el-image>
               </el-col>
               <el-col :span="20">
                 <el-col :span="24" class="left_time">
-                  <el-col :span="12" style="text-align: left">{{ item.speaker.name }}</el-col>
-                  <el-col :span="12" style="text-align: right">{{ item.time }}</el-col>
+                  <el-col :span="10" style="text-align: left">{{ item.customer.name }}</el-col>
+                  <el-col :span="14" style="text-align: right">{{ item.last_chat.time }}</el-col>
                 </el-col>
                 <el-col :span="20" class="left_content">
-                  <p class="left_content_test">{{ item.content }}</p>
+                  <p class="left_content_test" v-if="item.last_chat.msg_type == '0'">{{ item.last_chat.content }}</p>
+                  <p class="left_content_test" v-else>[图片]</p>
+                </el-col>
+                <el-col :span="4" class="left_badge" v-if="item.not_read != 0">
+                  <el-badge :value="item.not_read" :max="99" class="left_item"> </el-badge>
                 </el-col>
-                <el-col :span="4" class="left_badge"> <el-badge :value="200" :max="99" class="left_item"> </el-badge></el-col>
               </el-col>
             </el-col>
           </el-col>
@@ -36,8 +39,7 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   name: 'left-1',
   props: {
-    list: { type: Array },
-    searchName: { type: String },
+    roomList: { type: Array },
   },
   components: {},
   data: function () {
@@ -45,9 +47,6 @@ export default {
   },
   created() {},
   methods: {
-    toSearch() {
-      this.$emit('toSearch');
-    },
     toView(data) {
       this.$emit('toView', data);
     },
@@ -86,6 +85,9 @@ export default {
         height: 60px;
       }
     }
+    .left_content {
+      margin: 4px 0 0 0;
+    }
     .left_content_test {
       margin: 4px 0;
       overflow: hidden;
@@ -97,6 +99,7 @@ export default {
     }
 
     .left_badge {
+      margin: 8px 0 0 0;
       text-align: right;
     }
   }

+ 100 - 65
src/views/selfShop/message/parts/right-1.vue

@@ -4,40 +4,44 @@
       <el-col :span="24" class="main">
         <el-col :span="24" class="right_one">
           <p class="right_one_name">{{ customer.name }}</p>
-          <p class="right_one_address">
-            {{ address.name }},{{ address.phone }},{{ address.province }},{{ address.city }},{{ address.area }},{{ address.address }}
-          </p>
         </el-col>
-        <el-col :span="24" class="right_two">
-          <el-col :span="24" v-for="item in list" :key="item._id">
+        <div id="scrolldIV" class="scroll-div" ref="scrollContent">
+          <!-- <el-col :span="24" class="right_two"> -->
+          <el-col :span="24" v-for="item in chatRecordList" :key="item._id">
             <el-col :span="24" class="right_time">{{ item.time }}</el-col>
-            <el-col :span="24" class="right_left" v-if="item.speaker._id != user._id">
+            <el-col :span="24" class="right_left" v-if="item.speaker != user.shop._id">
               <el-col :span="24">
                 <el-col :span="2" class="right_image">
-                  <el-image :src="item.speaker.icon[0].url" class="right_icon"> </el-image>
+                  <el-avatar v-if="customer.icon && customer.icon.length != 0" :src="customer.icon[0].url" class="right_icon"></el-avatar>
+                  <el-avatar v-else icon="el-icon-user-solid"></el-avatar>
                 </el-col>
                 <el-col :span="20" class="right_left_cont">
-                  <p class="test">{{ item.content }}</p>
+                  <span class="test" v-if="item.msg_type == '0' && item.content.length < 50">{{ item.content }}</span>
+                  <div class="test" v-if="item.msg_type == '0' && item.content.length > 50">{{ item.content }}</div>
+                  <el-image v-else-if="item.msg_type == '1'" :src="item.content" :preview-src-list="srcList" style="width: 300px" mode="widthFix"> </el-image>
                 </el-col>
               </el-col>
             </el-col>
-            <el-col :span="24" class="right_right" v-else-if="item.speaker._id == user._id">
+            <el-col :span="24" class="right_right" v-else-if="item.speaker == user.shop._id">
               <el-col :span="24">
                 <el-col :span="20" class="right_right_cont">
-                  <p class="test">{{ item.content }}</p>
+                  <span class="test" v-if="item.msg_type == '0' && item.content.length < 50">{{ item.content }}</span>
+                  <div class="test" v-if="item.msg_type == '0' && item.content.length > 50">{{ item.content }}</div>
+                  <el-image v-if="item.msg_type == '1'" :src="item.content" :preview-src-list="srcList" style="width: 300px" mode="widthFix"> </el-image>
                 </el-col>
                 <el-col :span="2" class="right_image">
-                  <el-image :src="item.speaker.icon[0].url" class="right_icon"> </el-image>
+                  <el-avatar v-if="shop.logo && shop.logo.length != 0" :src="shop.logo[0].url" class="right_icon"></el-avatar>
+                  <el-avatar v-else icon="el-icon-user-solid"></el-avatar>
                 </el-col>
               </el-col>
             </el-col>
           </el-col>
-        </el-col>
+          <!-- </el-col> -->
+        </div>
         <el-col :span="24" class="right_thr">
           <el-col :span="20" class="right_thr_1">
-            <!-- <el-input v-model="message" :autosize="{ minRows: 5, maxRows: 7 }" maxlength="-1" placeholder="消息" type="textarea" size="small"></el-input> -->
             <el-form ref="form" :model="form" label-width="80px">
-              <el-input v-model="form.message" :autosize="{ minRows: 5, maxRows: 7 }" maxlength="-1" placeholder="消息" type="textarea" size="small"></el-input>
+              <el-input v-model="form.content" :autosize="{ minRows: 5, maxRows: 7 }" maxlength="-1" placeholder="消息" type="textarea" size="small"></el-input>
             </el-form>
           </el-col>
           <el-col :span="4" class="right_thr_2">
@@ -57,17 +61,34 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   name: 'right-1',
   props: {
-    list: { type: Array },
-    address: { type: Object },
+    chatRecordList: { type: Array },
     customer: { type: Object },
+    shop: { type: Object },
     form: { type: Object },
+    srcList: { type: Array },
   },
   components: {},
   data: function () {
     return {};
   },
-  created() {},
+  created() {
+    this.setBottom();
+  },
+
   methods: {
+    // 滚送到底部
+    setBottom() {
+      const me = this;
+      setTimeout(() => {
+        this.$nextTick(() => {
+          //一定要在this.$nextTick进行设置
+          me.$refs.scrollContent.scrollTop = 100000;
+          var container = this.$el.querySelector('scrolldIV');
+          // container.scrollTop = container.scrollHeight;
+          // console.log(container.scrollHeight);
+        });
+      }, 100);
+    },
     toUp() {
       this.$emit('toUp');
     },
@@ -75,6 +96,9 @@ export default {
       this.$emit('onSubmit', data);
     },
   },
+  updated: function () {
+    this.setBottom();
+  },
   computed: {
     ...mapState(['user']),
   },
@@ -108,69 +132,80 @@ export default {
     color: #666;
   }
 }
-
-.right_two {
+.scroll-div {
   background: rgb(246, 246, 246);
-  height: 62vh;
-  overflow-y: auto;
-  .right_icon {
-    border-radius: 10px;
-    width: 50px;
-    height: 50px;
-  }
-  .right_time {
-    text-align: center;
-    padding: 10px 0;
-    color: #666;
+  height: 65vh;
+  width: 56vw;
+  overflow: auto;
+  margin: 0 15px;
+}
+// .right_two {
+//   background: rgb(246, 246, 246);
+//   height: 62vh;
+//   overflow-y: auto;
+.right_icon {
+  border-radius: 10px;
+  width: 50px;
+  height: 50px;
+}
+.right_time {
+  text-align: center;
+  padding: 10px 0;
+  color: #666;
+}
+.right_left {
+  text-align: left;
+  padding: 0 30px;
+
+  .right_image {
+    padding: 10px 15px;
   }
-  .right_left {
-    text-align: left;
-    padding: 0 30px;
 
-    .right_image {
-      padding: 10px 15px;
+  .right_left_cont {
+    padding: 20px 10px 10px 10px;
+    span {
+      margin: 20px 0 0 0;
     }
-
-    .right_left_cont {
-      padding: 10px 10px;
-      .test {
-        border-radius: 8px;
-        border: 1px #ccc solid;
-        background: rgb(235, 249, 162);
-        padding: 10px;
-      }
+    .test {
+      border-radius: 8px;
+      border: 1px #ccc solid;
+      background: rgb(235, 249, 162);
+      padding: 10px;
+      word-wrap: break-word;
     }
   }
-  .right_right {
-    text-align: right;
-    padding: 0 30px;
-    .right_image {
-      padding: 10px 15px;
-    }
-    .right_time {
-      padding: 10px 0;
-    }
-    .right_right_cont {
-      margin: 0 0 0 8.3%;
-      padding: 10px 10px;
-      text-align: left;
-      .test {
-        border-radius: 8px;
-        border: 1px #ccc solid;
-        background: rgb(174, 254, 149);
-        padding: 10px;
-      }
+}
+.right_right {
+  padding: 0 30px;
+  .right_image {
+    padding: 10px 15px;
+  }
+  .right_time {
+    padding: 10px 0;
+  }
+  .right_right_cont {
+    margin: 0 0 0 8.3%;
+    padding: 20px 10px 10px 10px;
+    display: flex;
+    flex-direction: row-reverse;
+    .test {
+      border-radius: 8px;
+      border: 1px #ccc solid;
+      background: rgb(174, 254, 149);
+      padding: 10px;
+      word-break: break-all; // 强制内容换行
     }
   }
 }
+// }
 .right_thr {
   position: relative;
   bottom: 0;
-  padding: 3px 5px;
+  padding: 3px 10px 3px 13px;
   .right_thr_2 {
     padding: 20px;
     .btn {
-      margin: 20px 0 0 0;
+      margin: 15px 0 0 0;
     }
   }
 }

+ 17 - 4
src/views/selfShop/notice/index.vue

@@ -26,7 +26,17 @@
           </data-search>
         </el-col>
         <el-col :span="24">
-          <data-table ref="dataTable" :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @view="toView" @see="toSee"></data-table>
+          <data-table
+            ref="dataTable"
+            :fields="fields"
+            :opera="opera"
+            :data="list"
+            :total="total"
+            @query="search"
+            @view="toView"
+            @see="toSee"
+            @del="toDelete"
+          ></data-table>
         </el-col>
       </el-col>
     </el-row>
@@ -92,6 +102,7 @@ export default {
       opera: [
         { label: '查看', method: 'view' },
         { label: '已读', method: 'see', confirm: true, type: 'warning', display: (i) => i.status == '0' },
+        { label: '删除', method: 'del', confirm: true, type: 'danger' },
       ],
       btnList: [{ label: '添加', method: 'add' }],
       searchFields: [
@@ -139,9 +150,7 @@ export default {
         else if (data.source_type == '1') this.$router.push({ path: `/selfShop/sales`, query: { id: data.source_id } });
         let info = { _id: data._id, status: '1' };
         let res = await this.update(info);
-        if (this.$checkRes(res)) {
-          this.search();
-        }
+        if (this.$checkRes(res)) this.search();
       }
     },
     // 已读
@@ -150,6 +159,10 @@ export default {
       let res = await this.update(info);
       if (this.$checkRes(res, '已读', `${res.errmsg}`)) this.search();
     },
+    async toDelete({ data }) {
+      let res = await this.delete(data._id);
+      if (this.$checkRes(res, '刪除信息成功', `${res.errmsg}`)) this.search();
+    },
     // 查询其他信息
     async searchOthers() {
       // 来源

+ 14 - 1
src/views/selfShop/order/index.vue

@@ -30,7 +30,16 @@
                 <el-col :span="24" class="one">
                   <search-1 :form="searchForm" @onSubmit="search" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"> </search-1>
                 </el-col>
-                <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @detail="toDetails" @sales="toSaless">
+                <data-table
+                  :fields="fields"
+                  :opera="opera"
+                  @query="search"
+                  :data="list"
+                  :total="total"
+                  @detail="toDetails"
+                  @sales="toSaless"
+                  @message="toMessage"
+                >
                   <template #is_afterSale="{ row }">
                     <span :style="{ color: row.is_afterSale === true ? 'red' : '' }">
                       {{ row.is_afterSale === true ? '该订单有商品申请售后' : '未申请售后' }}
@@ -91,6 +100,7 @@ export default {
       opera: [
         { label: '详情', method: 'detail' },
         { label: '售后', method: 'sales', type: 'danger', display: (i) => i.status == '1' || i.status == '2' || i.status == '2-' || i.status == '3' },
+        { label: '联系', method: 'message', type: 'warning' },
         // { label: '联系', method: 'message', type: 'warning' },
       ],
       fields: [
@@ -190,6 +200,9 @@ export default {
       let shopname = i.map((e) => e.shop_name);
       return shopname.join(',');
     },
+    toMessage({ data }) {
+      this.$router.push({ path: `/selfShop/message`, query: { customer_id: data.customer._id } });
+    },
     // 重置
     toClose() {
       this.searchForm = {};

+ 12 - 7
src/views/selfShop/sales/index.vue

@@ -14,7 +14,8 @@
             <search-1 :form="searchForm" :statusList="statusList" :typeList="typeList" @onSubmit="toSearch" @toReset="toClose"> </search-1>
           </el-col>
           <el-col :span="24" class="four">
-            <data-table ref="dataTable" :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @exam="toExam"> </data-table>
+            <data-table ref="dataTable" :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @exam="toExam" @message="toMessage">
+            </data-table>
           </el-col>
         </span>
         <detail v-if="view === 'order'" :id="id" @toBack="toBack"></detail>
@@ -43,7 +44,10 @@ export default {
       searchForm: {},
       list: [],
       total: 0,
-      opera: [{ label: '审核', method: 'exam' }],
+      opera: [
+        { label: '审核', method: 'exam' },
+        { label: '联系', method: 'message', type: 'warning' },
+      ],
       fields: [
         { label: '顾客', model: 'customer.name', showTip: false },
         { label: '订单号', model: 'order_detail.no', showTip: false },
@@ -92,7 +96,7 @@ export default {
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       if (this.$route.query.id) {
-        let data = { data: { id: this.$route.query.id } };
+        let data = { data: { _id: this.$route.query.id } };
         this.toExam(data);
       } else {
         info.shop = this.user.shop.id;
@@ -108,15 +112,16 @@ export default {
       this.loadings = false;
     },
     toExam({ data }) {
-      this.$set(this, `id`, data.id);
+      this.$set(this, `id`, data._id);
       this.$set(this, `view`, 'order');
     },
+    toMessage({ data }) {
+      this.$router.push({ path: `/selfShop/message`, query: { customer_id: data.customer._id } });
+    },
     toBack() {
       this.view = 'list';
       this.loadings = true;
-      if (this.sales_id) {
-        delete this.$route.query.id;
-      }
+      if (this.sales_id) delete this.$route.query.id;
       this.search(this.searchQuery);
     },
     toClose() {

+ 13 - 0
vue.config.js

@@ -34,6 +34,7 @@ module.exports = {
         changeOrigin: true,
         ws: false,
       },
+      // 团购
       '/point/group/v1/api': {
         target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
         changeOrigin: true,
@@ -44,6 +45,18 @@ module.exports = {
         changeOrigin: true,
         ws: false,
       },
+      // 聊天
+      '/point/chat/v1/api': {
+        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
+        changeOrigin: true,
+        ws: false,
+      },
+      '/dev/point/chat/v1/api': {
+        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
+        changeOrigin: true,
+        ws: false,
+      },
+      // 尊荣
       '/dev/point/zr/v1/api': {
         target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
         changeOrigin: true,