|
@@ -0,0 +1,448 @@
|
|
|
|
+<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-input
|
|
|
|
+ v-model="listQuery.productName"
|
|
|
|
+ placeholder="商品名称"
|
|
|
|
+ clearable
|
|
|
|
+ @keyup.enter.native="getList"
|
|
|
|
+ @clear="getList"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <div class="filter-control">
|
|
|
|
+ <span>统计状态:</span>
|
|
|
|
+ <el-select v-model="listQuery.status" style="width: 120px" clearable @change="getList">
|
|
|
|
+ <el-option value="" label="请选择" />
|
|
|
|
+ <el-option :value="0" label="统计中" />
|
|
|
|
+ <el-option :value="1" label="暂停统计" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="filter-control">
|
|
|
|
+ <el-button type="primary" @click="getList"> 查询 </el-button>
|
|
|
|
+ <el-button type="primary" @click="goodsDialogVisible = true"> 添加商品 </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="tags-sms">
|
|
|
|
+ <span class="tags-sms-span">供应商:{{ shopName }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 列表 -->
|
|
|
|
+ <el-table v-loading="isLoading" :data="list" border style="width: 100%" height="660">
|
|
|
|
+ <el-table-column prop="productId" label="商品ID" align="center" width="80" />
|
|
|
|
+ <el-table-column prop="productImage" label="商品图片" align="center" width="120">
|
|
|
|
+ <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="status" label="统计状态" align="center" width="100">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ <el-tag v-if="row.status === 0" type="success" size="small">统计中</el-tag>
|
|
|
|
+ <el-tag v-if="row.status === 1" type="danger" size="small">暂停统计</el-tag>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="logo" label="logo" align="center" width="150">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ <el-popover v-if="row.logo" placement="top-start" title="" width="180" trigger="hover">
|
|
|
|
+ <img :src="row.logo" alt="" style="width: 94px; height: 50px" />
|
|
|
|
+ <img slot="reference" :src="row.logo" alt="" style="width: 94px; height: 50px" />
|
|
|
|
+ </el-popover>
|
|
|
|
+ <span v-else>---</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="recentlyTime" label="最近报表时间" align="center" width="100">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ {{ row.recentlyTime ? row.recentlyTime : '---' }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="addTime" label="添加时间" align="center" width="100">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ {{ row.addTime ? row.addTime : '---' }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column fixed="right" label="操作" align="center">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ <el-button type="primary" size="mini" style="margin: 2px" @click="handleRecordDetail(7, row)">
|
|
|
|
+ 营销数据报表
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="primary" size="mini" style="margin: 2px" @click="handleRecordDetail(1, row)">
|
|
|
|
+ 潜客统计列表
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="primary" size="mini" style="margin: 2px" @click="handleRecordDetail(2, row)">
|
|
|
|
+ 相关文章
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="primary" size="mini" style="margin: 2px" @click="handleRecordDetail(3, row)">
|
|
|
|
+ 相关搜索词
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="success" size="mini" style="margin: 2px" @click="handleRecordDetail(8, row)">
|
|
|
|
+ 上传LOGO
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="success" size="mini" style="margin: 2px" @click="handleRecordDetail(5, row)">
|
|
|
|
+ 弹窗样式
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="success" size="mini" style="margin: 2px" @click="handleRecordDetail(6, row)">
|
|
|
|
+ 设置统计状态
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button type="danger" size="mini" style="margin: 2px" @click="handleRecordDetail(4, 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="getShopProduct"
|
|
|
|
+ />
|
|
|
|
+ <!-- 选择供应商弹窗 -->
|
|
|
|
+ <goods-dialog v-if="goodsDialogVisible" ref="shopDialog" @confirm="handleAddShopConfirm" @cancel="handleCancel" />
|
|
|
|
+ <!-- 设置统计状态 -->
|
|
|
|
+ <el-dialog title="设置统计状态" :visible.sync="dialogFormVisible" width="500px">
|
|
|
|
+ <el-form ref="dataForm" :model="renewCustome" :rules="rules" label-position="right">
|
|
|
|
+ <el-form-item prop="status">
|
|
|
|
+ <el-radio v-model="renewCustome.status" :label="0">统计中</el-radio>
|
|
|
|
+ <el-radio v-model="renewCustome.status" :label="1">暂停统计</el-radio>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="handleConfirm">确定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!-- 上传LOGO -->
|
|
|
|
+ <el-dialog title="上传LOGO" :visible.sync="logoFormVisible" width="500px">
|
|
|
|
+ <el-form ref="logoForm" :model="logoForm" :rules="rules" label-position="right">
|
|
|
|
+ <el-form-item prop="logo" label="logo">
|
|
|
|
+ <div class="form-el-upload" style="width: 126px; height: 126px">
|
|
|
|
+ <el-upload
|
|
|
|
+ class="avatar-uploader"
|
|
|
|
+ :action="actionUrl"
|
|
|
|
+ :headers="getToken"
|
|
|
|
+ :show-file-list="false"
|
|
|
|
+ :on-success="handleSuccess"
|
|
|
|
+ :before-upload="beforeUpload"
|
|
|
|
+ >
|
|
|
|
+ <div v-loading="loadImgLoading" class="avatar" style="width: 126px; height: 126px; display: block">
|
|
|
|
+ <img
|
|
|
|
+ v-if="logoForm.logo"
|
|
|
|
+ :src="logoForm.logo"
|
|
|
|
+ style="width: 126px; height: 126px; display: block"
|
|
|
|
+ @error="reloadImage"
|
|
|
|
+ @load="loadSucess"
|
|
|
|
+ />
|
|
|
|
+ <i
|
|
|
|
+ v-elseopProduct
|
|
|
|
+ class="el-icon-plus avatar-uploader-icon"
|
|
|
|
+ style="width: 126px; height: 126px; line-height: 126px"
|
|
|
|
+ ></i>
|
|
|
|
+ </div>
|
|
|
|
+ </el-upload>
|
|
|
|
+ <p class="uploader-tips">注:请尽量上传126*50(px)尺寸的图片。</p>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="logoFormVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="handleConfirmLogo">确定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import {
|
|
|
|
+ getShopProduct,
|
|
|
|
+ saveShopProduct,
|
|
|
|
+ renewShopProduct,
|
|
|
|
+ uploadShopLogo,
|
|
|
|
+ deleteShopProduct
|
|
|
|
+} from '@/api/user/customer/customer'
|
|
|
|
+import GoodsDialog from './components/goods-dialog'
|
|
|
|
+export default {
|
|
|
|
+ name: 'RecordList',
|
|
|
|
+ components: { GoodsDialog },
|
|
|
|
+ filters: {},
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ isLoading: true,
|
|
|
|
+ shopName: this.$route.query.shopName,
|
|
|
|
+ listQuery: {
|
|
|
|
+ id: this.$route.query.id,
|
|
|
|
+ productName: '',
|
|
|
|
+ productId: '',
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 20
|
|
|
|
+ },
|
|
|
|
+ list: [],
|
|
|
|
+ total: 0,
|
|
|
|
+ goodsDialogVisible: false,
|
|
|
|
+ dialogFormVisible: false,
|
|
|
|
+ logoFormVisible: false,
|
|
|
|
+ loadImgLoading: false,
|
|
|
|
+ renewCustome: {
|
|
|
|
+ id: '',
|
|
|
|
+ status: ''
|
|
|
|
+ },
|
|
|
|
+ logoForm: {
|
|
|
|
+ id: '',
|
|
|
|
+ logo: ''
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ status: [{ required: true, message: '请设置统计状态', trigger: 'blur' }],
|
|
|
|
+ logo: [{ required: true, message: '请上传弹窗图片', trigger: 'blur' }]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ getToken() {
|
|
|
|
+ return {
|
|
|
|
+ token: this.$store.getters.token
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ actionUrl() {
|
|
|
|
+ return process.env.VUE_APP_BASE_API + '/formData/MultiPictareaddData'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+ mounted() {},
|
|
|
|
+ methods: {
|
|
|
|
+ // 获取行为记录列表
|
|
|
|
+ getList() {
|
|
|
|
+ this.list = []
|
|
|
|
+ this.listQuery.pageNum = 1
|
|
|
|
+ this.getShopProduct()
|
|
|
|
+ },
|
|
|
|
+ // 确认选择供应商
|
|
|
|
+ handleAddShopConfirm(data) {
|
|
|
|
+ console.log('data', data)
|
|
|
|
+ const productIds = []
|
|
|
|
+ data.forEach((ele) => {
|
|
|
|
+ productIds.push(ele.productId)
|
|
|
|
+ })
|
|
|
|
+ this.saveShopProduct({ id: this.listQuery.id, productIds: productIds.join(',') })
|
|
|
|
+ },
|
|
|
|
+ // 取消选择供应商
|
|
|
|
+ handleCancel() {
|
|
|
|
+ this.goodsDialogVisible = false
|
|
|
|
+ this.$refs.shopDialog.visible = false
|
|
|
|
+ },
|
|
|
|
+ // 确认设置统计状态
|
|
|
|
+ handleConfirm() {
|
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.renewShopProduct(this.renewCustome)
|
|
|
|
+ } else {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 获取潜客搜集供应商列表
|
|
|
|
+ async getShopProduct() {
|
|
|
|
+ try {
|
|
|
|
+ this.isLoading = true
|
|
|
|
+ const res = await getShopProduct(this.listQuery)
|
|
|
|
+ this.list = res.data.results
|
|
|
|
+ this.total = res.data.totalRecord
|
|
|
|
+ this.isLoading = false
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 保存添加统计供应商
|
|
|
|
+ async saveShopProduct(params) {
|
|
|
|
+ try {
|
|
|
|
+ await saveShopProduct(params)
|
|
|
|
+ this.goodsDialogVisible = false
|
|
|
|
+ this.$message.success('操作成功')
|
|
|
|
+ this.getList()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 统计状态
|
|
|
|
+ async renewShopProduct(params) {
|
|
|
|
+ try {
|
|
|
|
+ await renewShopProduct(params)
|
|
|
|
+ this.dialogFormVisible = false
|
|
|
|
+ this.$message.success('操作成功')
|
|
|
|
+ this.getList()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 上传logo
|
|
|
|
+ handleConfirmLogo() {
|
|
|
|
+ this.$refs['logoForm'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.uploadShopLogo(this.logoForm)
|
|
|
|
+ } else {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 上传logo
|
|
|
|
+ async uploadShopLogo(params) {
|
|
|
|
+ try {
|
|
|
|
+ await uploadShopLogo(params)
|
|
|
|
+ this.logoFormVisible = false
|
|
|
|
+ this.$message.success('操作成功')
|
|
|
|
+ this.$refs['logoForm'].clearValidate()
|
|
|
|
+ this.getList()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 查看详情
|
|
|
|
+ handleRecordDetail(type, row) {
|
|
|
|
+ switch (type) {
|
|
|
|
+ case 1: // 潜客统计列表
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: '/user/customer/customer-stat-list',
|
|
|
|
+ query: { shopProductId: row.id }
|
|
|
|
+ })
|
|
|
|
+ break
|
|
|
|
+ case 2: // 相关文章
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: '/user/customer/customer-article-list',
|
|
|
|
+ query: { shopProductId: row.id }
|
|
|
|
+ })
|
|
|
|
+ break
|
|
|
|
+ case 3: // 相关搜索词
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: '/user/customer/customer-search-list',
|
|
|
|
+ query: { shopProductId: row.id }
|
|
|
|
+ })
|
|
|
|
+ break
|
|
|
|
+ case 4: // 页面访问
|
|
|
|
+ this.handleDelete(row)
|
|
|
|
+ break
|
|
|
|
+ case 5: // 弹窗样式
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: '/user/customer/customer-popup-edit',
|
|
|
|
+ query: { shopProductId: row.id, shopId: row.shopId, id: this.listQuery.id, shopName: this.shopName }
|
|
|
|
+ })
|
|
|
|
+ break
|
|
|
|
+ case 6: // 设置统计状态
|
|
|
|
+ this.renewCustome.id = row.id
|
|
|
|
+ this.renewCustome.status = row.status
|
|
|
|
+ console.log('renewCustome', this.renewCustome)
|
|
|
|
+ this.dialogFormVisible = true
|
|
|
|
+ break
|
|
|
|
+ case 7: // 跳转数据报表
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: '/user/customer/market-report-list',
|
|
|
|
+ query: { marketId: row.id, productName: row.productName }
|
|
|
|
+ })
|
|
|
|
+ break
|
|
|
|
+ case 8: // 上传LOGO
|
|
|
|
+ this.logoForm.id = row.id
|
|
|
|
+ this.logoFormVisible = true
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 操作删除广告图
|
|
|
|
+ async handleDelete(row) {
|
|
|
|
+ try {
|
|
|
|
+ await this.$confirm('确定删除该商品吗?', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ })
|
|
|
|
+ this.deleteShopProduct(row)
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.info('已取消删除操作')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 调用删除广告图
|
|
|
|
+ async deleteShopProduct(row) {
|
|
|
|
+ try {
|
|
|
|
+ await deleteShopProduct({ id: row.id })
|
|
|
|
+ this.$message.success('操作成功')
|
|
|
|
+ this.getList()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 上传图标事件
|
|
|
|
+ handleSuccess(res, file) {
|
|
|
|
+ this.loadImgLoading = true
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.logoForm.logo = res.data
|
|
|
|
+ }, 1000 * 2)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 对上传图片的大小、格式进行限制
|
|
|
|
+ beforeUpload(file) {
|
|
|
|
+ const isJPG = file.type === 'image/jpeg'
|
|
|
|
+ const isJPG2 = file.type === 'image/jpg'
|
|
|
|
+ const isPNG = file.type === 'image/png'
|
|
|
|
+ const isLt5M = file.size / 1024 / 1024 < 5
|
|
|
|
+ if (!isJPG && !isJPG2 && !isPNG) {
|
|
|
|
+ this.$message.error('只支持jpg或png格式图片')
|
|
|
|
+ }
|
|
|
|
+ if (!isLt5M) {
|
|
|
|
+ this.$message.error('请上传5MB以内的图片!')
|
|
|
|
+ }
|
|
|
|
+ return (isJPG || isJPG2 || isPNG) && isLt5M
|
|
|
|
+ },
|
|
|
|
+ reloadImage() {
|
|
|
|
+ this.loadImgLoading = true
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.logoForm.logo = this.logoForm.logo.split('?')[0] + '?r=' + Math.floor(Math.random() * 1000)
|
|
|
|
+ }, 1000 * 2)
|
|
|
|
+ },
|
|
|
|
+ loadSucess() {
|
|
|
|
+ this.loadImgLoading = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style>
|
|
|
|
+.tags-sms {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: auto;
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ color: #333333;
|
|
|
|
+ line-height: 28px;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ padding: 5px;
|
|
|
|
+}
|
|
|
|
+.avatar-uploader .el-upload {
|
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
|
+ border-radius: 6px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ position: relative;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ float: left;
|
|
|
|
+}
|
|
|
|
+.uploader-tips {
|
|
|
|
+ position: absolute;
|
|
|
|
+ bottom: 0;
|
|
|
|
+ left: 160px;
|
|
|
|
+ line-height: 28px;
|
|
|
|
+ color: red;
|
|
|
|
+ margin: 0;
|
|
|
|
+}
|
|
|
|
+</style>
|