quanwei
2 days ago 04102f7237efefa744090ed7c25f7b5d0807b679
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<template>
  <!--
          作者:luoyiming
          时间:2019-10-25
          描述:门店列表
      -->
  <div class="user">
    <!--添加门店-->
    <!-- <div class="common-level-rail"><el-button size="small" type="primary" icon="el-icon-plus" @click="addClick" v-auth="'/store/store/add'">添加门店</el-button></div> -->
 
    <!--内容-->
    <div class="product-content">
      <div class="table-wrap">
        <el-table size="small" :data="tableData" border style="width: 100%" v-loading="loading">
          <el-table-column prop="user_id" label="用户ID" width="160"></el-table-column>
          <el-table-column prop="user.nickName" label="发送人昵称">
            <template slot-scope="scope">
              <div v-if="scope.row.msg_type==1">
                <span>{{scope.row.supplier.name}}</span>
              </div>
              <div v-else><span>{{scope.row.user.nickName}}</span></div>
            </template>
          </el-table-column>
          <el-table-column label="发送人头像" width="100">
            <template slot-scope="scope">
              <div v-if="scope.row.msg_type==1">
                <img v-img-url="scope.row.supplier.logo.file_path" width="30px" height="30px" />
              </div>
              <div v-else><img v-img-url="scope.row.user.avatarUrl" width="30px" height="30px" /></div>
 
            </template>
          </el-table-column>
          <el-table-column prop="content" label="发送消息">
            <template slot-scope="scope">
              <div v-if="scope.row.type==0">
                <span>{{scope.row.content}}</span>
              </div>
              <div v-if="scope.row.type==1">
                <img v-img-url="scope.row.content" width="100px" height="100px" />
              </div>
              <div v-if="scope.row.type==2">
                <img v-img-url="JSON.parse(scope.row.content).product_img" width="50px" height="50px" />
                <div class="pro_txtname nmaxwidth">{{JSON.parse(scope.row.content).product_name}}</div>
                <div class="pro_price">¥{{JSON.parse(scope.row.content).product_price}}</div>
              </div>
              <div class="d-s-c" v-if="scope.row.type==3">
                <div>
                  <img v-img-url="JSON.parse(scope.row.content).product_img" width="50px" height="50px" />
                </div>
                <div>
                  <div class="pro_txtname nmaxwidth">订单号:{{JSON.parse(scope.row.content).order_no}}</div>
                  <div class="pro_txtname nmaxwidth">商品名称:{{JSON.parse(scope.row.content).product_name}}</div>
                  <div class="pro_price">订单价格:¥{{JSON.parse(scope.row.content).order_price}}</div>
                  <div class="pro_price">商品数量:{{JSON.parse(scope.row.content).order_num}}</div>
                  <div class="pro_txtname nmaxwidth">下单时间:{{JSON.parse(scope.row.content).create_time}}</div>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="create_time" label="发送时间" width="140"></el-table-column>
          <!-- <el-table-column fixed="right" label="操作" width="190">
            <template slot-scope="scope">
              <el-button @click="editClick(scope.row)" type="text" size="small" v-auth="'/store/store/edit'">对话记录</el-button>
              <el-button @click="deleteClick(scope.row)" type="text" size="small" v-auth="'/store/store/delete'">开启对话</el-button>
            </template>
          </el-table-column> -->
        </el-table>
      </div>
 
      <!--分页-->
      <div class="pagination">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" background :current-page="curPage"
          :page-size="pageSize" layout="total, prev, pager, next, jumper" :total="totalDataNumber"></el-pagination>
      </div>
    </div>
  </div>
</template>
 
<script>
  import ServiceApi from '@/api/service.js';
  export default {
    components: {},
    inject: ['reload'],
    data() {
      return {
        /*是否加载完成*/
        loading: true,
        /*列表数据*/
        tableData: [],
        /*一页多少条*/
        pageSize: 20,
        /*一共多少条数据*/
        totalDataNumber: 0,
        /*当前是第几页*/
        curPage: 1,
        /*横向表单数据模型*/
        formInline: {
          user: '',
          region: ''
        },
        /*是否打开添加弹窗*/
        open_add: false,
        /*是否打开编辑弹窗*/
        open_edit: false,
        /*当前编辑的对象*/
        userModel: {},
        user_id: 0
      };
    },
    created() {
      this.user_id = this.$route.query.user_id;
      /*获取列表*/
      this.getTableList();
    },
    methods: {
      /*选择第几页*/
      handleCurrentChange(val) {
        let self = this;
        self.curPage = val;
        self.loading = true;
        self.getTableList();
      },
 
      /*每页多少条*/
      handleSizeChange(val) {
        this.curPage = 1;
        this.pageSize = val;
        this.getTableList();
      },
 
      /*获取列表*/
      getTableList() {
        let self = this;
        let Params = {};
        Params.user_id = self.user_id;
        Params.page = self.curPage;
        Params.list_rows = self.pageSize;
        ServiceApi.recordlist(Params, true)
          .then(data => {
            self.loading = false;
            self.tableData = data.data.list.data;
            self.totalDataNumber = data.data.list.total;
          })
          .catch(error => {});
      },
 
      /*打开添加*/
      addClick() {
        this.$router.push('/store/store/add');
      },
 
      /*打开编辑*/
      editClick(row) {
        let self = this;
        let params = row.store_id;
        this.$router.push({
          path: '/store/store/edit',
          // name: 'mallList',
          query: {
            store_id: params
          }
        });
      },
 
      /*删除*/
      deleteClick(row) {
        let self = this;
        self
          .$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          })
          .then(() => {
            ServiceApi.deleteShop({
                  store_id: row.store_id
                },
                true
              )
              .then(data => {
                self.$message({
                  message: '恭喜你,门店删除成功',
                  type: 'success'
                });
                self.getTableList();
              })
              .catch(error => {});
          })
          .catch(() => {});
      }
    }
  };
</script>
 
<style>
  .nmaxwidth{
    max-width: 250px;
  }
</style>