瀏覽代碼

修改消息

YY 2 年之前
父節點
當前提交
5835ff4a8e

+ 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: [],

+ 45 - 40
src/views/selfShop/message/index.vue

@@ -11,14 +11,12 @@
         <el-col :span="16" class="right" v-else>
           <right-1
             :chatRecordList="chatRecordList"
-            :address="address"
             :customer="customer"
             :shop="shop"
             @toUp="toUp"
             @onSubmit="onSubmit"
             :form="form"
             :srcList="srcList"
-            :add="add"
           ></right-1>
         </el-col>
       </el-col>
@@ -90,7 +88,7 @@ export default {
   methods: {
     ...users({ userFetch: 'fetch' }),
     ...address({ addFetch: 'fetch' }),
-    ...room({ roomQuery: 'query', roomFetch: 'fetch' }),
+    ...room({ roomQuery: 'query', roomFetch: 'fetch', roomDelete: 'delete' }),
     ...chatRecord(['query', 'delete', 'fetch', 'update', 'create', 'read']),
     // 查询
     async search() {
@@ -100,45 +98,51 @@ export default {
     },
     // 订单和售后跳转页面,联系买家
     async searchDetail() {
-      let res = await this.userFetch(this.customer_id);
-      if (this.$checkRes(res)) this.$set(this, `customer`, res.data);
-      res = await this.roomQuery({ customer: this.customer_id });
-      if (this.$checkRes(res)) this.toView(res.data[0]);
-      // res = await this.addFetch(this.address_id);
-      // if (this.$checkRes(res)) this.$set(this, `address`, res.data);
-      this.show = '1';
-      this.add = '1';
+      let res = await this.roomQuery({ customer: this.customer_id, shop: this.user.shop._id });
+      if (this.$checkRes(res)) {
+        if (res.total > 0) this.toView(res.data[0]);
+        else {
+          let aee = await this.userFetch(this.customer_id);
+          if (this.$checkRes(aee)) {
+            let data = { customer: aee.data, shop: this.user.shop };
+            this.toView(data);
+          }
+        }
+      }
     },
     // 查看
     async toView(data) {
-      this.$set(this, `customer`, data.customer);
-      this.$set(this, `shop`, data.shop);
-      this.$set(this, `form`, { room: data._id });
-      // 处理已读
-      let list = [];
-      let res = await this.query({ room: data._id });
-      if (this.$checkRes(res)) {
+      if (this.customer._id != data.customer._id) this.$set(this, `customer`, data.customer);
+      if (data._id) {
+        this.$set(this, `form`, { room: data._id });
         // 处理已读
-        for (const p1 of res.data) {
-          if (p1.speaker != this.user.shop._id && p1.is_read == '0') list.push(p1._id);
+        let list = [];
+        let res = await this.query({ room: data._id });
+        if (this.$checkRes(res)) {
+          // 聊天记录列表
+          let arr1 = res.data.reverse();
+          this.$set(this, `chatRecordList`, arr1);
+          // 处理已读
+          for (const p1 of res.data) {
+            if (p1.speaker != this.user.shop._id && p1.is_read == '0') list.push(p1._id);
+          }
+          // 处理聊天图片,大图预览
+          let arr = [];
+          for (const p1 of this.chatRecordList) {
+            if (p1.msg_type == '1') arr.push(p1.content);
+          }
+          this.$set(this, `srcList`, arr);
         }
-        // 处理聊天图片,大图预览
-        let arr = [];
-        for (const p1 of this.chatRecordList) {
-          if (p1.msg_type == '1') arr.push(p1.content);
+        // 处理已读
+        if (list.length != 0) {
+          let form = { ids: list };
+          res = await this.read(form);
+          if (this.$checkRes(res)) this.search();
         }
-        this.$set(this, `srcList`, arr);
-        // 聊天记录列表
-        let arr1 = res.data.reverse();
-        this.$set(this, `chatRecordList`, arr1);
       }
       this.show = '1';
-      if (list.length != 0) {
-        let form = { ids: list };
-        res = await this.read(form);
-        if (this.$checkRes(res)) this.search();
-      }
     },
+    // 发送图片
     toUp() {
       this.dialog = { title: '信息管理', show: true, type: '1' };
     },
@@ -161,28 +165,27 @@ export default {
       let res = await this.create(form);
       if (this.$checkRes(res, '操作成功', '操作失败')) {
         let data = { _id: res.data.room, customer: this.customer, shop: this.shop };
-        this.toView(data);
-        this.search();
         this.toClose();
+        this.search();
+        if (this.customer_id) this.searchDetail(data);
+        if (!this.customer_id) this.toView(data);
       }
     },
-
     // 关闭
     toClose() {
       this.file = [];
       this.dialog = { title: '信息管理', show: false, type: '1' };
     },
     // 查询其他信息
-    async searchOthers() {},
+    async searchOthers() {
+      this.$set(this, `shop`, this.user.shop);
+    },
   },
   computed: {
     ...mapState(['user']),
     customer_id() {
       return this.$route.query.customer_id;
     },
-    address_id() {
-      return this.$route.query.address_id;
-    },
   },
 };
 </script>
@@ -202,6 +205,8 @@ export default {
     font-size: 300px;
     color: #ccc;
     padding: 10% 0;
+    height: 80vh;
+    overflow-y: auto;
   }
   .right {
     height: 80vh;

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

@@ -23,8 +23,8 @@
                   <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-badge :value="item.not_read" :max="99" class="left_item"> </el-badge>
+                </el-col>
               </el-col>
             </el-col>
           </el-col>

+ 20 - 14
src/views/selfShop/message/parts/right-1.vue

@@ -4,9 +4,6 @@
       <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" v-if="add == '1'">
-            {{ address.name }},{{ address.phone }},{{ address.province }},{{ address.city }},{{ address.area }},{{ address.address }}
-          </p> -->
         </el-col>
         <div id="scrolldIV" class="scroll-div" ref="scrollContent">
           <!-- <el-col :span="24" class="right_two"> -->
@@ -15,7 +12,8 @@
             <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-avatar :src="customer.icon[0].url" class="right_icon"></el-avatar>
+                  <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">
                   <span class="test" v-if="item.msg_type == '0' && item.content.length < 50">{{ item.content }}</span>
@@ -32,7 +30,8 @@
                   <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-avatar :src="shop.file[0].url" class="right_icon"></el-avatar>
+                  <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>
@@ -63,12 +62,10 @@ export default {
   name: 'right-1',
   props: {
     chatRecordList: { type: Array },
-    address: { type: Object },
     customer: { type: Object },
     shop: { type: Object },
     form: { type: Object },
     srcList: { type: Array },
-    add: { type: String },
   },
   components: {},
   data: function () {
@@ -79,13 +76,6 @@ export default {
   },
 
   methods: {
-    search() {},
-    toUp() {
-      this.$emit('toUp');
-    },
-    onSubmit(data) {
-      this.$emit('onSubmit', data);
-    },
     // 滚送到底部
     setBottom() {
       const me = this;
@@ -99,6 +89,22 @@ export default {
         });
       }, 100);
     },
+    toUp() {
+      this.$emit('toUp');
+    },
+    getCustomer() {
+      let url = this.customer.icon[0].url;
+      console.log(url);
+      return url;
+    },
+    getShop() {
+      let url = this.shop.file[0].url;
+      console.log(url);
+      return url;
+    },
+    onSubmit(data) {
+      this.$emit('onSubmit', data);
+    },
   },
   updated: function () {
     this.setBottom();

+ 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 = {};