ZZJ
2022-06-01 f3bf27d9bc7c8c6484be4f37edcc57df5490ecbe
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<template>
  <div class="UserDetail">
    <div class="header">
      <span class="iconfont" @click="back">&#xe62c;</span> 用户列表
    </div>
    <div class="content">
      <div class="title">基本信息</div>
      <div class="infoArea">
        <div class="infoItem">
          <div class="label">用户名</div>
          <div class="data">{{ userInfo.username }}</div>
        </div>
        <div class="infoItem">
          <div class="label">姓名/联系人</div>
          <div class="data">{{ userInfo.trueName }}</div>
        </div>
        <div class="infoItem">
          <div class="label">公司名称</div>
          <div class="data">{{ userInfo.companyName }}</div>
        </div>
        <div class="infoItem">
          <div class="label">来源</div>
          <div class="data">
            {{ userInfo.source == 0 ? "自行注册" : "手动添加" }}
          </div>
        </div>
        <div class="infoItem">
          <div class="label">邮箱</div>
          <div class="data">{{ userInfo.email }}</div>
        </div>
        <div class="infoItem">
          <div class="label">地区</div>
          <div class="data">
            {{ userInfo.provinceName + "-" + userInfo.areaName }}
          </div>
        </div>
        <div class="infoItem">
          <div class="label">注册时间</div>
          <div class="data">{{ userInfo.createTime }}</div>
        </div>
        <div class="infoItem">
          <div class="label">手机号</div>
          <div class="data">{{ userInfo.phoneNum }}</div>
        </div>
        <div class="infoItem">
          <div class="label">行业</div>
          <div class="data">{{ userInfo.industryName }}</div>
        </div>
      </div>
    </div>
 
    <div class="content">
      <div class="title">统计数据</div>
      <div class="table-area">
        <el-table
          id="multipleTable"
          ref="multipleTable"
          :data="statisticData"
          tooltip-effect="dark"
          :fit="true"
        >
          <el-table-column
            prop="totalOrderMoney"
            label="累计消费金额"
          ></el-table-column>
 
          <el-table-column prop="orderNum" label="订单数量"></el-table-column>
          <el-table-column prop="devNum" label="设备总量/x86架构/ARM">
          </el-table-column>
          <el-table-column prop="sdkNum" label="购买算法数量"></el-table-column>
          <el-table-column prop="appNum" label="购买应用数量"></el-table-column>
          <el-table-column prop="time" label="平均登录时长"></el-table-column>
        </el-table>
      </div>
    </div>
 
    <div class="content">
      <div class="title">设备管理开通状态</div>
      <div class="table-area">
        <el-table
          id="multipleTable"
          ref="multipleTable"
          :data="menuList"
          tooltip-effect="dark"
          :fit="true"
        >
          <el-table-column label="序号" width="68">
            <template slot-scope="scope">{{ scope.$index + 1 }}</template>
          </el-table-column>
          <el-table-column prop="appName" label="应用名称"></el-table-column>
          <el-table-column prop="type" label="开通状态">
            <template slot-scope="scope">
              <div
                class="deviceStatus"
                :class="{ green: scope.row.status == 0 }"
              >
                {{ scope.row.status == 0 ? "已开通" : "未开通" }}
              </div>
            </template>
          </el-table-column>
 
          <el-table-column prop="openTime" label="开通时间"></el-table-column>
          <el-table-column prop="lastTime" label="到期时间"> </el-table-column>
        </el-table>
      </div>
    </div>
 
    <div class="content">
      <div class="title">订单记录</div>
      <div class="table-area orderArea">
        <el-table
          id="multipleTable"
          ref="multipleTable"
          :data="orderList"
          tooltip-effect="dark"
          :fit="true"
        >
          <el-table-column label="序号" width="68">
            <template slot-scope="scope">{{ scope.$index + 1 }}</template>
          </el-table-column>
          <el-table-column prop="sn" label="订单编号"></el-table-column>
          <el-table-column label="产品名称">
            <template slot-scope="scope">
              {{ scope.row.products[0].productName }}
            </template>
          </el-table-column>
          <el-table-column label="订单类型">
            <template slot-scope="scope">
              {{ scope.row.products[0].productTypeName }}
            </template>
          </el-table-column>
          <el-table-column label="订单来源">
            <template slot-scope="scope">
              <div>
                {{ scope.row.source == 0 ? "激活码下载" : "订单购买" }}
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间"></el-table-column>
          <el-table-column prop="status" label="订单状态">
            <template slot-scope="scope">
              <div class="orderStatus" v-if="scope.row.orderStatus == -1">
                已取消
              </div>
              <div class="orderStatus" v-if="scope.row.orderStatus == 0">
                未下单
              </div>
              <div class="orderStatus" v-if="scope.row.orderStatus == 1">
                待支付
              </div>
              <div class="orderStatus green" v-if="scope.row.orderStatus == 2">
                已支付
              </div>
              <div class="orderStatus" v-if="scope.row.orderStatus == 11">
                支付凭证待审核
              </div>
            </template>
          </el-table-column>
          <el-table-column label="激活码">
            <template slot-scope="scope">
              {{ scope.row.products[0].activateCode }}
            </template>
          </el-table-column>
          <el-table-column prop="orderMoney" label="金额"> </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <div class="control" @click="checkDetail(scope.row)">
                查看详情
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>
 
<script>
import {
  findUserList,
  userInfoStatistic,
  devInfoStatistic,
  findAllOrder,
} from "@/api/user";
 
export default {
  created() {
    this.getUserList();
    this.getStatistic();
    this.getDevInfo();
    this.getOrder();
  },
  data() {
    return {
      userInfo: {},
      statisticData: [
        {
          totalOrderMoney: "33,223元",
          orderNum: "23",
          devNum: "2/2/0",
          sdkNum: "12",
          appNum: "1",
          time: "-",
        },
      ],
      menuList: [],
      orderList: [],
    };
  },
  methods: {
    async getUserList() {
      const res = await findUserList({
        page: 1,
        size: 1,
        type: +this.$route.query.type,
        startTime: "",
        endTime: "",
        inputText: this.$route.query.username,
      });
      if (res && res.success) {
        this.userInfo = res.data.list[0];
      }
      if (this.userInfo.menuNames) {
        let menuArr = this.userInfo.menuNames.split(",");
        menuArr.forEach((item) => {
          let obj = {
            appName: item,
            openTime: this.userInfo.authTime,
          };
          let dateList = this.userInfo.authTime.split("-");
          console.log(dateList[0]);
          dateList[0] =
            parseInt(dateList[0]) + parseInt(this.userInfo.authDuration);
          console.log(dateList[0]);
          obj.lastTime = dateList.join("-");
          var date1 = new Date();
          var date2 = new Date(obj.lastTime);
          obj.status = date2 - date1 > 0 ? 0 : 1;
 
          this.menuList.push(obj);
        });
      }
    },
    async getStatistic() {
      const res = await userInfoStatistic({
        userId: this.$route.query.userId,
        startTime: "",
        endTime: "",
        inputText: "",
        productBaseId: "0",
        orderName: "",
        orderType: "",
        orderStatus: 0,
      });
      if (res && res.success) {
        this.statisticData[0].totalOrderMoney = res.data.totalOrderMoney;
        this.statisticData[0].orderNum = res.data.orderNum;
        this.statisticData[0].sdkNum = res.data.sdkNum;
        this.statisticData[0].appNum = res.data.appNum;
      }
    },
    async getDevInfo() {
      const res = await devInfoStatistic({
        userId: this.$route.query.userId,
      });
      if (res && res.success) {
        this.statisticData[0].devNum =
          res.data.total + "/" + res.data.x86_total + "/" + res.data.arm_total;
      }
    },
    async getOrder() {
      const res = await findAllOrder({
        userId: this.$route.query.userId,
        startTime: "",
        endTime: "",
        inputText: "",
        productBaseId: "0",
        orderName: "",
        orderType: "",
        orderStatus: 0,
        page: 1,
        size: 1000,
      });
      if (res && res.success) {
        this.orderList = res.data.list;
      }
    },
    back() {
      this.$router.push("/Layout/UserList");
    },
    checkDetail(row) {
      this.$router.push({
        path: "/Layout/OrderDetail",
        query: {
          id: row.id,
        },
      });
    },
  },
};
</script>
 
<style lang="scss" scoped>
.UserDetail {
  background-color: rgb(243, 245, 248);
  .header {
    margin-bottom: 24px;
    padding: 0 24px;
    height: 50px;
    font-size: 16px;
    color: #666666;
    line-height: 50px;
    background: #ffffff;
    vertical-align: middle;
    font-weight: 700;
 
    .iconfont {
      margin-right: 10px;
      font-size: 18px;
      cursor: pointer;
    }
  }
 
  .content {
    margin: 0 24px 24px 24px;
    padding: 20px;
    background-color: #fff;
 
    .title {
      padding-left: 10px;
      height: 20px;
      font-size: 16px;
      font-weight: 700;
      color: #3d3d3d;
      border-left: 4px solid #0064ff;
    }
 
    .infoArea {
      display: flex;
      flex-wrap: wrap;
 
      .infoItem {
        display: flex;
        margin-top: 30px;
        width: 320px;
        font-size: 14px;
        color: #3d3d3d;
        font-weight: 700;
 
        .label {
          width: 90px;
          font-weight: 400;
          color: #666666;
        }
      }
    }
 
    .orderArea {
      overflow-y: auto;
      max-height: 500px;
    }
 
    .control {
      color: #0064ff;
      cursor: pointer;
    }
 
    .deviceStatus {
      color: #ff9600;
    }
 
    .orderStatus {
      color: #ff4a32;
    }
 
    .green {
      color: #36b24a;
    }
  }
}
</style>