This commit is contained in:
DESKTOP-GMUNQ1B\k 2024-03-27 15:49:00 +08:00
parent 314dfd7032
commit d268c67ec1
4 changed files with 264 additions and 217 deletions

View File

@ -9,6 +9,14 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
import { dataURItoBlob } from 'dropzone' import { dataURItoBlob } from 'dropzone'
import request from './request' import request from './request'
// 导出商品数据
export function outportApi(data) {
return request.get('store/product/excel', data)
}
/* /*
上传视频 local 上传视频 local
*/ */

View File

@ -1,12 +1,6 @@
<template> <template>
<el-dialog <el-dialog v-if="dialogVisible" title="商品审核" :visible.sync="dialogVisible" width="900px" :before-close="handleClose"
v-if="dialogVisible" class="projectInfo">
title="商品审核"
:visible.sync="dialogVisible"
width="900px"
:before-close="handleClose"
class="projectInfo"
>
<el-tabs v-if="projectData && isShow" v-model="activeNames" v-loading="loading"> <el-tabs v-if="projectData && isShow" v-model="activeNames" v-loading="loading">
<el-tab-pane label="商品信息" name="first"> <el-tab-pane label="商品信息" name="first">
<div class="acea-row"> <div class="acea-row">
@ -19,7 +13,8 @@
<span class="sp100"> <span class="sp100">
商品分类 商品分类
<template v-if="projectData.merCateId"> <template v-if="projectData.merCateId">
<span v-for="(item, index) in projectData.merCateId" :key="index" class="mr10">{{ item.category?item.category.cate_name:'' }}</span> <span v-for="(item, index) in projectData.merCateId" :key="index" class="mr10">{{
item.category ? item.category.cate_name : '' }}</span>
</template> </template>
<span v-else>-</span> <span v-else>-</span>
</span> </span>
@ -27,24 +22,13 @@
<span class="sp100"> <span class="sp100">
商品封面图 商品封面图
<div class="demo-image__preview"> <div class="demo-image__preview">
<el-image <el-image style="width: 60px; height: 60px" :src="projectData.image"
style="width: 60px; height: 60px" :preview-src-list="[projectData.image]" />
:src="projectData.image"
:preview-src-list="[projectData.image]"
/>
</div> </div>
</span> </span>
<span class="sp100">商品轮播图 <span class="sp100">商品轮播图
<div <div v-for="(item, index) in projectData.slider_image" :key="index" class="pictrue">
v-for="(item,index) in projectData.slider_image" <el-image style="width: 60px; height: 60px" :src="item" :preview-src-list="[item]" />
:key="index"
class="pictrue"
>
<el-image
style="width: 60px; height: 60px"
:src="item"
:preview-src-list="[item]"
/>
</div> </div>
</span> </span>
</div> </div>
@ -66,14 +50,12 @@
<el-table-column align="center" label="图片" min-width="80"> <el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="demo-image__preview"> <div class="demo-image__preview">
<el-image <el-image style="width: 60px; height: 60px" :src="scope.row.image" />
style="width: 60px; height: 60px"
:src="scope.row.image"
/>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120"> <el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center"
min-width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" /> <span class="priceBox" v-text="scope.row[iii]" />
</template> </template>
@ -97,7 +79,8 @@
<template v-if="projectData.spec_type === 1"> <template v-if="projectData.spec_type === 1">
<el-table :data="ManyAttrValue" border class="tabNumWidth" size="mini"> <el-table :data="ManyAttrValue" border class="tabNumWidth" size="mini">
<template v-if="manyTabDate"> <template v-if="manyTabDate">
<el-table-column v-for="(item,iii) in manyTabDate" :key="iii" align="center" :label="manyTabTit[iii].title" min-width="80"> <el-table-column v-for="(item, iii) in manyTabDate" :key="iii" align="center"
:label="manyTabTit[iii].title" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" /> <span class="priceBox" v-text="scope.row[iii]" />
</template> </template>
@ -110,7 +93,8 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120"> <el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center"
min-width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="priceBox">{{ scope.row[iii] }}</span> <span class="priceBox">{{ scope.row[iii] }}</span>
</template> </template>
@ -327,17 +311,21 @@ export default {
.projectInfo ::v-deep .el-dialog__body { .projectInfo ::v-deep .el-dialog__body {
padding-top: 0 !important; padding-top: 0 !important;
} }
.projectInfo ::v-deep .el-tabs__content { .projectInfo ::v-deep .el-tabs__content {
padding-left: 10px !important; padding-left: 10px !important;
} }
.tabPic { .tabPic {
width: 40px !important; width: 40px !important;
height: 40px !important; height: 40px !important;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.sp { .sp {
display: block; display: block;
width: 33%; width: 33%;
@ -349,10 +337,12 @@ export default {
margin-bottom: 15px; margin-bottom: 15px;
display: inline-block; display: inline-block;
} }
.third { .third {
width: 100%; width: 100%;
display: flex; display: flex;
} }
.pictrue { .pictrue {
width: 60px; width: 60px;
height: 60px; height: 60px;
@ -361,11 +351,13 @@ export default {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.demo-image__preview { .demo-image__preview {
display: inline-block; display: inline-block;
} }

View File

@ -61,6 +61,12 @@
<el-input v-model="tableFrom.keyword" @keyup.enter.native="getList(1)" placeholder="请输入商品名称,关键字,产品编号" <el-input v-model="tableFrom.keyword" @keyup.enter.native="getList(1)" placeholder="请输入商品名称,关键字,产品编号"
class="selWidth" /> class="selWidth" />
</el-form-item> </el-form-item>
<el-form-item label="时间:" prop="date">
<el-date-picker v-model="timeVal" value-format="yyyy/MM/dd" format="yyyy/MM/dd" type="daterange"
start-placeholder="开始日期" end-placeholder="结束日期" @change="handleDateChange" />
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" size="small" @click="getList(1)">搜索</el-button> <el-button type="primary" size="small" @click="getList(1)">搜索</el-button>
<el-button size="small" @click="searchReset()">重置</el-button> <el-button size="small" @click="searchReset()">重置</el-button>
@ -68,6 +74,7 @@
</el-form> </el-form>
</div> </div>
<el-card class="mt14"> <el-card class="mt14">
<el-button size="small" type="primary" @click="exports">导出</el-button>
<el-tabs v-model="tableFrom.type" @tab-click="getList(1), getLstFilterApi()"> <el-tabs v-model="tableFrom.type" @tab-click="getList(1), getLstFilterApi()">
<el-tab-pane v-for="(item, index) in headeNum" :key="index" :name="item.type.toString()" <el-tab-pane v-for="(item, index) in headeNum" :key="index" :name="item.type.toString()"
:label="item.name + '(' + item.count + ')'" /> :label="item.name + '(' + item.count + ')'" />
@ -290,13 +297,15 @@ import {
updatetProductLabel, updatetProductLabel,
batchesLabelsApi, batchesLabelsApi,
batchesRecommendApi, batchesRecommendApi,
batchesOnOffApi batchesOnOffApi,
outportApi
} from '@/api/product' } from '@/api/product'
import { roterPre } from '@/settings' import { roterPre } from '@/settings'
import infoFrom from './info' import infoFrom from './info'
import ueditorFrom from '@/components/ueditorFrom' import ueditorFrom from '@/components/ueditorFrom'
import previewBox from '@/components/previewBox/index' import previewBox from '@/components/previewBox/index'
import proDetail from './proDetails.vue'; import proDetail from './proDetails.vue';
import createWorkBook from '@/utils/newToExcel.js';
const proOptions = [{ const proOptions = [{
name: '热门榜单', name: '热门榜单',
value: 'is_hot' value: 'is_hot'
@ -320,6 +329,7 @@ export default {
}, },
data() { data() {
return { return {
timeVal: [],
props: { props: {
emitPath: false emitPath: false
}, },
@ -402,6 +412,7 @@ export default {
is_trader: '', is_trader: '',
hot_type: '', hot_type: '',
star: '', star: '',
date: '',
svip_price_type: '', svip_price_type: '',
product_id: this.$route.query.id ? this.$route.query.id : "" product_id: this.$route.query.id ? this.$route.query.id : ""
}, },
@ -442,6 +453,8 @@ export default {
/**重置 */ /**重置 */
searchReset() { searchReset() {
this.timeVal = [];
this.tableFrom.date = '';
this.$refs.searchForm.resetFields() this.$refs.searchForm.resetFields()
this.getList(1) this.getList(1)
}, },
@ -686,6 +699,37 @@ export default {
this.$message.error(res.message) this.$message.error(res.message)
}) })
}, },
handleDateChange(e) {
this.tableFrom.date = e[0] + '-' + e[1];
},
//
async exports() {
let excelData = JSON.parse(JSON.stringify(this.tableFrom)), data = []
excelData.page = 1
let pageCount = 1
let lebData = {};
for (let i = 0; i < pageCount; i++) {
lebData = await this.downData(excelData)
pageCount = Math.ceil(lebData.count / excelData.limit)
if (lebData.export.length) {
data = data.concat(lebData.export)
excelData.page++
}
}
createWorkBook(lebData.header, lebData.title, data, lebData.foot, lebData.filename);
return
},
/**订单列表 */
downData(excelData) {
return new Promise((resolve, reject) => {
outportApi(excelData).then((res) => {
return resolve(res.data)
})
})
},
batch() { batch() {
if (this.multipleSelection.length === 0) return this.$message.warning('请先选择商品') if (this.multipleSelection.length === 0) return this.$message.warning('请先选择商品')
this.$refs.infoFrom.dialogVisible = true this.$refs.infoFrom.dialogVisible = true

View File

@ -1,13 +1,6 @@
<template> <template>
<el-dialog <el-dialog v-if="dialogVisible" title="商品审核" :visible.sync="dialogVisible" :append-to-body='isAppend' width="860px"
v-if="dialogVisible" :before-close="handleClose" class="projectInfo">
title="商品审核"
:visible.sync="dialogVisible"
:append-to-body='isAppend'
width="860px"
:before-close="handleClose"
class="projectInfo"
>
<el-tabs v-if="projectData && isShow" v-model="activeNames" v-loading="loading"> <el-tabs v-if="projectData && isShow" v-model="activeNames" v-loading="loading">
<el-tab-pane label="商品信息" name="first"> <el-tab-pane label="商品信息" name="first">
<div class="acea-row"> <div class="acea-row">
@ -16,12 +9,15 @@
<span class="sp">品牌{{ projectData.brand ? projectData.brand.brand_name : '其他' }}</span> <span class="sp">品牌{{ projectData.brand ? projectData.brand.brand_name : '其他' }}</span>
<span class="sp">商品关键字{{ projectData.keyword }}</span> <span class="sp">商品关键字{{ projectData.keyword }}</span>
<span class="sp">商品单位{{ projectData.unit_name }}</span> <span class="sp">商品单位{{ projectData.unit_name }}</span>
<span class="sp" v-if="projectData.temp && projectData.temp.name">运费模板{{ projectData.temp?projectData.temp.name:'' }}</span> <span class="sp" v-if="projectData.temp && projectData.temp.name">运费模板{{
<span class="sp100" v-if="projectData.temp && projectData.temp.info">运费说明{{ projectData.temp?projectData.temp.info:'' }}</span> projectData.temp ? projectData.temp.name : '' }}</span>
<span class="sp100" v-if="projectData.temp && projectData.temp.info">运费说明{{
projectData.temp ? projectData.temp.info : '' }}</span>
<span class="sp100"> <span class="sp100">
商品分类 商品分类
<template v-if="projectData.merCateId"> <template v-if="projectData.merCateId">
<span v-for="(item, index) in projectData.merCateId" :key="index" class="mr10">{{ item.category?item.category.cate_name:'' }}</span> <span v-for="(item, index) in projectData.merCateId" :key="index" class="mr10">{{
item.category ? item.category.cate_name : '' }}</span>
</template> </template>
<span v-else>-</span> <span v-else>-</span>
</span> </span>
@ -29,44 +25,39 @@
<span class="sp100"> <span class="sp100">
商品封面图 商品封面图
<div class="demo-image__preview"> <div class="demo-image__preview">
<el-image <el-image style="width: 60px; height: 60px" :src="projectData.image"
style="width: 60px; height: 60px" :preview-src-list="[projectData.image]" />
:src="projectData.image"
:preview-src-list="[projectData.image]"
/>
</div> </div>
</span> </span>
<span v-if="projectData.video_link" class="sp100"> <span v-if="projectData.video_link" class="sp100">
主图视频 主图视频
<video style="width:40%;height: 180px;border-radius: 10px;" :src="projectData.video_link" controls="controls"> <video style="width:40%;height: 180px;border-radius: 10px;" :src="projectData.video_link"
controls="controls">
您的浏览器不支持 video 标签 您的浏览器不支持 video 标签
</video> </video>
</span> </span>
<span class="sp100">商品轮播图 <span class="sp100">商品轮播图
<div <div v-for="(item, index) in projectData.slider_image" :key="index" class="pictrue">
v-for="(item,index) in projectData.slider_image" <el-image style="width: 60px; height: 60px" :src="item" :preview-src-list="[item]" />
:key="index"
class="pictrue"
>
<el-image
style="width: 60px; height: 60px"
:src="item"
:preview-src-list="[item]"
/>
</div> </div>
</span> </span>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="商品详情" name="second"> <el-tab-pane label="商品详情" name="second">
<span class="sp100">商品详情</span> <el-form v-if="projectData && projectData.content">
<div class="contentPic" v-html="projectData.content"/> <el-form-item label="商品详情:">
<el-image style="width:100px;" :src="srcParse(projectData.content)"
:preview-src-list="[srcParse(projectData.content)]"></el-image>
</el-form-item>
</el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="其他设置" name="third"> <el-tab-pane label="其他设置" name="third">
<span class="sp100">商品排序{{ projectData.sort }}</span> <span class="sp100">商品排序{{ projectData.sort }}</span>
<span class="third mb20"> <span class="third mb20">
<span>商品推荐</span> <span>商品推荐</span>
<el-checkbox-group v-model="checkboxGroup" size="small"> <el-checkbox-group v-model="checkboxGroup" size="small">
<el-checkbox v-for="(item, index) in recommend" :key="index" disabled :label="item.value">{{ item.name }}</el-checkbox> <el-checkbox v-for="(item, index) in recommend" :key="index" disabled :label="item.value">{{ item.name
}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</span> </span>
<span v-if="projectData.guarantee && projectData.guarantee.templateValue.length" class="third mb20"> <span v-if="projectData.guarantee && projectData.guarantee.templateValue.length" class="third mb20">
@ -86,14 +77,12 @@
<el-table-column align="center" label="图片" min-width="80"> <el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="demo-image__preview"> <div class="demo-image__preview">
<el-image <el-image style="width: 60px; height: 60px" :src="scope.row.image" />
style="width: 60px; height: 60px"
:src="scope.row.image"
/>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120"> <el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center"
min-width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" /> <span class="priceBox" v-text="scope.row[iii]" />
</template> </template>
@ -115,7 +104,8 @@
<template v-if="projectData.spec_type === 1"> <template v-if="projectData.spec_type === 1">
<el-table :data="ManyAttrValue" border size="small"> <el-table :data="ManyAttrValue" border size="small">
<template v-if="manyTabDate"> <template v-if="manyTabDate">
<el-table-column v-for="(item,iii) in manyTabDate" :key="iii" align="center" :label="manyTabTit[iii].title" min-width="80"> <el-table-column v-for="(item, iii) in manyTabDate" :key="iii" align="center"
:label="manyTabTit[iii].title" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="priceBox" v-text="scope.row[iii]" /> <span class="priceBox" v-text="scope.row[iii]" />
</template> </template>
@ -128,7 +118,8 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="80"> <el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center"
min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="priceBox">{{ scope.row[iii] }}</span> <span class="priceBox">{{ scope.row[iii] }}</span>
</template> </template>
@ -296,6 +287,9 @@ export default {
} }
}, },
methods: { methods: {
srcParse(e) {
return e.image[0]
},
onSubmit() { onSubmit() {
this.isShow ? this.ruleForm.id = this.proId : this.ruleForm.id = this.ids this.isShow ? this.ruleForm.id = this.proId : this.ruleForm.id = this.ids
productStatusApi(this.ruleForm).then(res => { productStatusApi(this.ruleForm).then(res => {
@ -353,31 +347,38 @@ export default {
.projectInfo ::v-deep .el-dialog__body { .projectInfo ::v-deep .el-dialog__body {
padding-top: 0 !important; padding-top: 0 !important;
} }
.projectInfo ::v-deep .el-tabs__content { .projectInfo ::v-deep .el-tabs__content {
padding-left: 10px !important; padding-left: 10px !important;
} }
.tabPic { .tabPic {
width: 40px !important; width: 40px !important;
height: 40px !important; height: 40px !important;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.sp { .sp {
display: block; display: block;
width: 33%; width: 33%;
margin-bottom: 20px; margin-bottom: 20px;
} }
.sp100 { .sp100 {
width: 100%; width: 100%;
margin-bottom: 15px; margin-bottom: 15px;
display: inline-block; display: inline-block;
} }
.third { .third {
width: 100%; width: 100%;
display: flex; display: flex;
} }
.pictrue { .pictrue {
width: 60px; width: 60px;
height: 60px; height: 60px;
@ -386,11 +387,13 @@ export default {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.demo-image__preview { .demo-image__preview {
display: inline-block; display: inline-block;
} }