|
@@ -0,0 +1,145 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="app-container">
|
|
|
|
+ <!-- 顶部操作区域 -->
|
|
|
|
+ <div class="filter-container">
|
|
|
|
+ <div class="filter-control">
|
|
|
|
+ <span>商品ID:</span>
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="listQuery.productId"
|
|
|
|
+ placeholder="商品ID"
|
|
|
|
+ clearable
|
|
|
|
+ @keyup.enter.native="getList"
|
|
|
|
+ @clear="getList"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <div class="filter-control">
|
|
|
|
+ <span>统计时间:</span>
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="time"
|
|
|
|
+ type="daterange"
|
|
|
|
+ unlink-panels
|
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
|
+ range-separator="至"
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
+ :picker-options="pickerOptions"
|
|
|
|
+ @change="getList"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <div class="filter-control">
|
|
|
|
+ <el-button type="primary" @click="getList"> 查询 </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 列表 -->
|
|
|
|
+ <el-table v-loading="isLoading" :data="list" border style="width: 100%">
|
|
|
|
+ <el-table-column prop="productId" label="商品ID" align="center" width="200" />
|
|
|
|
+ <el-table-column prop="productImage" label="商品图片" align="center">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ <el-popover v-if="row.productImage" placement="top-start" title="" width="100" trigger="hover">
|
|
|
|
+ <img :src="row.productImage" alt="" style="width: 80px; height: 80px" />
|
|
|
|
+ <img slot="reference" :src="row.productImage" alt="" style="width: 80px; height: 80px" />
|
|
|
|
+ </el-popover>
|
|
|
|
+ <span v-else>---</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="productName" label="商品名称" align="center" />
|
|
|
|
+ <el-table-column prop="productCount" label="商城总浏览次数" align="center">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ <el-link type="primary" :underline="false">【{{ row.productCount }}】次</el-link>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column fixed="right" label="操作" align="center" width="200">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ <el-button type="primary" size="mini" style="margin: 2px" @click="handleOperate(row)"> 查看用户详情 </el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+
|
|
|
|
+ <!-- 页码 -->
|
|
|
|
+ <pagination
|
|
|
|
+ :total="total"
|
|
|
|
+ :page-sizes="[10, 20, 30, 100]"
|
|
|
|
+ :page-size="20"
|
|
|
|
+ :page.sync="listQuery.pageNum"
|
|
|
|
+ :limit.sync="listQuery.pageSize"
|
|
|
|
+ @pagination="getRecordProductCount"
|
|
|
|
+ />
|
|
|
|
+ <!-- 详情弹窗 -->
|
|
|
|
+ <product-detail-dialog
|
|
|
|
+ v-if="dialogVisible"
|
|
|
|
+ ref="detailDialog"
|
|
|
|
+ :detail-query="detailQuery"
|
|
|
|
+ @cancel="handleCancel"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import pickerOptions from '@/utils/time-picker.js'
|
|
|
|
+import { getRecordProductCount } from '@/api/user/record/record'
|
|
|
|
+import ProductDetailDialog from './components/product-detail-dialog'
|
|
|
|
+const defaultListQuery = {
|
|
|
|
+ productId: '', // 商品ID
|
|
|
|
+ beginTime: '', // 开始日期
|
|
|
|
+ endTime: '', // 结束日期
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 20
|
|
|
|
+}
|
|
|
|
+export default {
|
|
|
|
+ name: 'RecordProductList',
|
|
|
|
+ components: {
|
|
|
|
+ ProductDetailDialog
|
|
|
|
+ },
|
|
|
|
+ filters: {},
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ isLoading: true,
|
|
|
|
+ listQuery: Object.assign({}, defaultListQuery),
|
|
|
|
+ pickerOptions,
|
|
|
|
+ time: [],
|
|
|
|
+ list: [],
|
|
|
|
+ total: 0,
|
|
|
|
+ dialogVisible: false,
|
|
|
|
+ detailQuery: {}
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {},
|
|
|
|
+ created() {
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+ mounted() {},
|
|
|
|
+ methods: {
|
|
|
|
+ // 获取列表
|
|
|
|
+ getList() {
|
|
|
|
+ this.listQuery.pageNum = 1
|
|
|
|
+ this.listQuery.beginTime = this.time[0]
|
|
|
|
+ this.listQuery.endTime = this.time[1]
|
|
|
|
+ this.getRecordProductCount()
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 获取商品列表
|
|
|
|
+ async getRecordProductCount() {
|
|
|
|
+ try {
|
|
|
|
+ this.isLoading = true
|
|
|
|
+ const res = await getRecordProductCount(this.listQuery)
|
|
|
|
+ this.list = res.data.results
|
|
|
|
+ this.total = res.data.totalRecord
|
|
|
|
+ this.isLoading = false
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 查看详情
|
|
|
|
+ handleOperate(row) {
|
|
|
|
+ this.detailQuery = { productId: row.productId }
|
|
|
|
+ this.dialogVisible = true
|
|
|
|
+ },
|
|
|
|
+ // 关闭详情弹窗
|
|
|
|
+ handleCancel() {
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style></style>
|