商品高亮

This commit is contained in:
DESKTOP-GMUNQ1B\k 2024-03-13 11:52:35 +08:00
parent 385ed62abf
commit 9da1abfbd8

View File

@ -3,10 +3,12 @@
<div class="selCard">
<el-form inline size="small" :model="tableFrom" ref="searchForm" label-width="85px">
<el-form-item label="商品分类:" prop="pid">
<el-cascader v-model="tableFrom.pid" class="selWidth" :options="merCateList" :props="{ checkStrictly: true, emitPath:false }" clearable @change="getList(1)" />
<el-cascader v-model="tableFrom.pid" class="selWidth" :options="merCateList"
:props="{ checkStrictly: true, emitPath: false }" clearable @change="getList(1)" />
</el-form-item>
<el-form-item label="商户名称:" prop="mer_id">
<el-select v-model="tableFrom.mer_id" clearable filterable placeholder="请选择" class="selWidth" @change="getList(1)">
<el-select v-model="tableFrom.mer_id" clearable filterable placeholder="请选择" class="selWidth"
@change="getList(1)">
<el-option v-for="item in merSelect" :key="item.mer_id" :label="item.mer_name" :value="item.mer_id" />
</el-select>
</el-form-item>
@ -17,74 +19,86 @@
</el-select>
</el-form-item>
<el-form-item label="商品状态:" prop="us_status">
<el-select v-model="tableFrom.us_status" placeholder="请选择" class="filter-item selWidth" clearable @change="getList(1)">
<el-select v-model="tableFrom.us_status" placeholder="请选择" class="filter-item selWidth" clearable
@change="getList(1)">
<el-option v-for="item in productStatusList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="推荐级别:" prop="star">
<el-select v-model="tableFrom.star" placeholder="请选择" class="filter-item selWidth" clearable @change="getList(1)">
<el-option v-for="item in recommendedLevelStatus" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-select v-model="tableFrom.star" placeholder="请选择" class="filter-item selWidth" clearable
@change="getList(1)">
<el-option v-for="item in recommendedLevelStatus" :key="item.value" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="标签:" prop="sys_labels">
<el-select v-model="tableFrom.sys_labels" placeholder="请选择" class="filter-item selWidth" clearable filterable @change="getList(1)">
<el-select v-model="tableFrom.sys_labels" placeholder="请选择" class="filter-item selWidth" clearable filterable
@change="getList(1)">
<el-option v-for="item in labelList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-select>
</el-form-item>
<el-form-item label="会员价:" prop="svip_price_type">
<el-select v-model="tableFrom.svip_price_type" placeholder="请选择" class="selWidth" clearable @change="getList(1)">
<el-option label="未设置" value="0" />
<el-option label="默认设置" value="1" />
<el-option label="自定义设置" value="2" />
</el-select>
</el-form-item>
<el-form-item label="商品推荐:" prop="hot_type">
<el-select v-model="tableFrom.hot_type" placeholder="请选择" class="filter-item selWidth" clearable filterable @change="getList(1)">
<el-option v-for="item in recommendList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="商品类型:" prop="is_ficti">
<el-select v-model="tableFrom.is_ficti" placeholder="请选择" class="filter-item selWidth" clearable @change="getList(1)">
<el-option v-for="item in productTypeList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="商品搜索:" prop="keyword">
<el-input v-model="tableFrom.keyword" @keyup.enter.native="getList(1)" placeholder="请输入商品名称,关键字,产品编号" class="selWidth" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="getList(1)">搜索</el-button>
<el-button size="small" @click="searchReset()">重置</el-button>
</el-form-item>
</el-form>
</div>
<el-select v-model="tableFrom.svip_price_type" placeholder="请选择" class="selWidth" clearable
@change="getList(1)">
<el-option label="未设置" value="0" />
<el-option label="默认设置" value="1" />
<el-option label="自定义设置" value="2" />
</el-select>
</el-form-item>
<el-form-item label="商品推荐:" prop="hot_type">
<el-select v-model="tableFrom.hot_type" placeholder="请选择" class="filter-item selWidth" clearable filterable
@change="getList(1)">
<el-option v-for="item in recommendList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="商品类型:" prop="is_ficti">
<el-select v-model="tableFrom.is_ficti" placeholder="请选择" class="filter-item selWidth" clearable
@change="getList(1)">
<el-option v-for="item in productTypeList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="商品搜索:" prop="keyword">
<el-input v-model="tableFrom.keyword" @keyup.enter.native="getList(1)" placeholder="请输入商品名称,关键字,产品编号"
class="selWidth" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="getList(1)">搜索</el-button>
<el-button size="small" @click="searchReset()">重置</el-button>
</el-form-item>
</el-form>
</div>
<el-card class="mt14">
<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()" :label="item.name +'('+item.count +')' " />
<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()"
:label="item.name + '(' + item.count + ')'" />
</el-tabs>
<div class="mt5 mb20">
<el-button v-show="tableFrom.type === '6'" size="small" :disabled="multipleSelection.length==0" @click="batch">批量审核</el-button>
<el-button size="small" :disabled="multipleSelection.length==0 " @click="batchOff">批量强制下架</el-button>
<el-button size="small" :disabled="multipleSelection.length==0 " @click="batchShow(0)">批量不显示</el-button>
<el-button size="small" :disabled="multipleSelection.length==0 " @click="batchShow(1)">批量显示</el-button>
<el-button :disabled="multipleSelection.length==0" size="small" @click="batchLabel">批量设置标签</el-button>
<el-button :disabled="multipleSelection.length==0" size="small" @click="batchRecommend">批量设置推荐</el-button>
<el-button v-show="tableFrom.type === '6'" size="small" :disabled="multipleSelection.length == 0"
@click="batch">批量审核</el-button>
<el-button size="small" :disabled="multipleSelection.length == 0" @click="batchOff">批量强制下架</el-button>
<el-button size="small" :disabled="multipleSelection.length == 0" @click="batchShow(0)">批量不显示</el-button>
<el-button size="small" :disabled="multipleSelection.length == 0" @click="batchShow(1)">批量显示</el-button>
<el-button :disabled="multipleSelection.length == 0" size="small" @click="batchLabel">批量设置标签</el-button>
<el-button :disabled="multipleSelection.length == 0" size="small" @click="batchRecommend">批量设置推荐</el-button>
</div>
<el-table v-loading="listLoading" :data="tableData.data" size="small" @selection-change="handleSelectionChange">
<el-table-column v-if="Number(tableFrom.type)<7" key="2" type="selection" width="55" />
<el-table v-loading="listLoading" :data="tableData.data" size="small" @selection-change="handleSelectionChange"
:row-class-name="tableRowClassName">
<el-table-column v-if="Number(tableFrom.type) < 7" key="2" type="selection" width="55" />
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" inline class="demo-table-expand">
<el-form-item label="平台分类:">
<span>{{ props.row.storeCategory?props.row.storeCategory.cate_name:'-' }}</span>
<span>{{ props.row.storeCategory ? props.row.storeCategory.cate_name : '-' }}</span>
</el-form-item>
<el-form-item label="商品分类:">
<template v-if="props.row.merCateId.length">
<span v-for="(item, index) in props.row.merCateId" :key="index" class="mr10">{{ item.category ? item.category.cate_name : '-' }}</span>
<span v-for="(item, index) in props.row.merCateId" :key="index" class="mr10">{{ item.category ?
item.category.cate_name : '-' }}</span>
</template>
<span v-else>-</span>
</el-form-item>
<el-form-item label="品牌:">
<span>{{ props.row.brand ? props.row.brand.brand_name: '其它' }}</span>
<span>{{ props.row.brand ? props.row.brand.brand_name : '其它' }}</span>
</el-form-item>
<el-form-item label="市场价格:">
<span>{{ props.row.ot_price | filterEmpty }}</span>
@ -105,13 +119,15 @@
<el-table-column label="商品图" min-width="70">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image style="width: 36px; height: 36px" :src="scope.row.image" :preview-src-list="[scope.row.image]" />
<el-image style="width: 36px; height: 36px" :src="scope.row.image"
:preview-src-list="[scope.row.image]" />
</div>
</template>
</el-table-column>
<el-table-column prop="store_name" label="商品名称" min-width="200">
<template slot-scope="scope">
<div><span class="tags_name" :class="'name'+scope.row.spec_type">{{ scope.row.spec_type==0 ? '[单规格]' : '[多规格]' }}</span>{{ scope.row.store_name || '-' }}</div>
<div><span class="tags_name" :class="'name' + scope.row.spec_type">{{ scope.row.spec_type == 0 ? '[单规格]' :
'[多规格]' }}</span>{{ scope.row.store_name || '-' }}</div>
</template>
</el-table-column>
<el-table-column label="商户名称" min-width="150">
@ -131,7 +147,8 @@
<el-table-column prop="rank" label="排序" min-width="60" />
<el-table-column prop="status" label="是否显示" min-width="80">
<template slot-scope="scope">
<el-switch v-model="scope.row.is_used" :active-value="1" :inactive-value="0" active-text="显示" inactive-text="隐藏" @change="onchangeIsShow(scope.row)" />
<el-switch v-model="scope.row.is_used" :active-value="1" :inactive-value="0" active-text="显示"
inactive-text="隐藏" @change="onchangeIsShow(scope.row)" />
</template>
</el-table-column>
<el-table-column prop="stock" label="商品状态" min-width="90">
@ -142,34 +159,44 @@
<el-table-column v-if="Number(tableFrom.type) < 7" key="8" label="操作" min-width="180" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="small" @click="onDetails(scope.row.product_id)">详情</el-button>
<el-button v-if="tableFrom.type === '6'" type="text" size="small" @click.native="toExamine(scope.row.product_id)">审核</el-button>
<el-button v-if="tableFrom.type === '6'" type="text" size="small"
@click.native="toExamine(scope.row.product_id)">审核</el-button>
<el-button type="text" size="small" class="mr10" @click="handlePreview(scope.row.product_id)">预览</el-button>
<el-dropdown>
<span class="el-dropdown-link">
更多<i class="el-icon-arrow-down el-icon--right" />
更多<i class="el-icon-arrow-down el-icon--right" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="Number(tableFrom.type) < 7" @click.native="onEdit(scope.row.product_id)">编辑商品</el-dropdown-item>
<el-dropdown-item v-if="Number(tableFrom.type) < 7"
@click.native="onEdit(scope.row.product_id)">编辑商品</el-dropdown-item>
<el-dropdown-item v-if="tableFrom.type != 5">
<router-link :to="{path: roterPre + '/product/comment/?product_id=' + scope.row.product_id}" style="font-size: 14px;">
<router-link :to="{ path: roterPre + '/product/comment/?product_id=' + scope.row.product_id }"
style="font-size: 14px;">
查看评价
</router-link>
</el-dropdown-item>
<el-dropdown-item v-if="tableFrom.type !== '5'" @click.native="onEditLabel(scope.row)">编辑标签</el-dropdown-item>
<el-dropdown-item v-if="tableFrom.type === '6' || tableFrom.type === '1'" @click.native="toVirtualSales(scope.row.product_id)">已售数量</el-dropdown-item>
<el-dropdown-item v-if="Number(tableFrom.type) < 3" @click.native="toOff(scope.row.product_id)">强制下架</el-dropdown-item>
<el-dropdown-item v-if="tableFrom.type !== '5'"
@click.native="onEditLabel(scope.row)">编辑标签</el-dropdown-item>
<el-dropdown-item v-if="tableFrom.type === '6' || tableFrom.type === '1'"
@click.native="toVirtualSales(scope.row.product_id)">已售数量</el-dropdown-item>
<el-dropdown-item v-if="Number(tableFrom.type) < 3"
@click.native="toOff(scope.row.product_id)">强制下架</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination background :page-size="tableFrom.limit" :current-page="tableFrom.page" layout="total, prev, pager, next, jumper" :total="tableData.total" @size-change="handleSizeChange" @current-change="pageChange" />
<el-pagination background :page-size="tableFrom.limit" :current-page="tableFrom.page"
layout="total, prev, pager, next, jumper" :total="tableData.total" @size-change="handleSizeChange"
@current-change="pageChange" />
</div>
</el-card>
<info-from ref="infoFrom" :is-show="isShow" :ids="OffId" @subSuccess="subSuccess" />
<el-dialog title="商品编辑" :visible.sync="dialogVisible" width="960px" :before-close="handleClose" :append-to-body='append'>
<el-form ref="formValidate" v-loading="fullscreenLoading" class="formValidate mt20" :rules="ruleValidate" :model="formValidate" size="small" label-width="100px" @submit.native.prevent>
<el-dialog title="商品编辑" :visible.sync="dialogVisible" width="960px" :before-close="handleClose"
:append-to-body='append'>
<el-form ref="formValidate" v-loading="fullscreenLoading" class="formValidate mt20" :rules="ruleValidate"
:model="formValidate" size="small" label-width="100px" @submit.native.prevent>
<el-form-item label="商品名称:" prop="store_name">
<el-input v-model="formValidate.store_name" size="small" placeholder="请输入商品名称" />
</el-form-item>
@ -179,7 +206,8 @@
</el-form-item>
<el-form-item label="商品推荐:">
<el-checkbox-group v-model="checkboxGroup" size="small" @change="onChangeGroup">
<el-checkbox v-for="(item, index) in recommend" :key="index" :label="item.value">{{ item.name }}</el-checkbox>
<el-checkbox v-for="(item, index) in recommend" :key="index" :label="item.value">{{ item.name
}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="排序:">
@ -195,48 +223,35 @@
</el-form-item>
</el-form>
</el-dialog>
<!--预览商品-->
<!--预览商品-->
<div v-if="previewVisible">
<div class="bg" @click.stop="previewVisible = false" />
<preview-box v-if="previewVisible" ref="previewBox" :goods-id="goodsId" :product-type="0" :preview-key="previewKey" />
<preview-box v-if="previewVisible" ref="previewBox" :goods-id="goodsId" :product-type="0"
:preview-key="previewKey" />
</div>
<!--编辑标签-->
<el-dialog
v-if="dialogLabel"
title="选择标签"
:visible.sync="dialogLabel"
width="470px"
:before-close="handleClose"
>
<el-dialog v-if="dialogLabel" title="选择标签" :visible.sync="dialogLabel" width="470px" :before-close="handleClose">
<el-form ref="labelForm" :model="labelForm" @submit.native.prevent size="small">
<el-form-item>
<el-select v-model="labelForm.sys_labels" clearable filterable multiple size="small" placeholder="请选择" class="width100">
<el-option
v-for="item in labelList"
:key="item.id"
:label="item.name"
:value="item.id.toString()"
/>
<el-select v-model="labelForm.sys_labels" clearable filterable multiple size="small" placeholder="请选择"
class="width100">
<el-option v-for="item in labelList" :key="item.id" :label="item.name" :value="item.id.toString()" />
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogLabel=false">取消</el-button>
<el-button size="small" @click="dialogLabel = false">取消</el-button>
<el-button type="primary" size="small" @click="submitForm('labelForm')">提交</el-button>
</span>
</el-dialog>
<!--编辑推荐-->
<el-dialog
v-if="dialogRecommend"
title="推荐设置"
:visible.sync="dialogRecommend"
width="800px"
:before-close="handleClose"
>
<el-dialog v-if="dialogRecommend" title="推荐设置" :visible.sync="dialogRecommend" width="800px"
:before-close="handleClose">
<el-form @submit.native.prevent size="small">
<el-form-item label="商品推荐:">
<el-checkbox-group v-model="recommendGroup" @change="onChangeRecommend" size="small">
<el-checkbox v-for="(item, index) in recommend" :key="index" :label="item.value">{{ item.name }}</el-checkbox>
<el-checkbox-group v-model="recommendGroup" @change="onChangeRecommend" size="small">
<el-checkbox v-for="(item, index) in recommend" :key="index" :label="item.value">{{ item.name
}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
@ -245,13 +260,8 @@
</span>
</el-dialog>
<!--商品详情-->
<pro-detail
ref="proDetail"
:productId="product_id"
@closeDrawer="closeDrawer"
@changeDrawer="changeDrawer"
:drawer="drawer"
></pro-detail>
<pro-detail ref="proDetail" :productId="product_id" @closeDrawer="closeDrawer" @changeDrawer="changeDrawer"
:drawer="drawer"></pro-detail>
</div>
</template>
@ -259,7 +269,7 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEBCRMEB
// +----------------------------------------------------------------------
@ -422,8 +432,15 @@ export default {
this.getLabelLst()
},
methods: {
tableRowClassName({ row, rowIndex }) {
if (this.product_id == row.product_id) {
return "success-row"
}
},
/**重置 */
searchReset(){
searchReset() {
this.$refs.searchForm.resetFields()
this.getList(1)
},
@ -446,6 +463,7 @@ export default {
},
//
handlePreview(id) {
this.product_id = id;
this.previewVisible = true
this.goodsId = id
this.previewKey = ''
@ -490,13 +508,13 @@ export default {
}).catch(res => {
this.$message.error(res.message)
}) :
updatetProductLabel(this.product_id, this.labelForm).then(({ message }) => {
this.$message.success(message)
this.getList('')
this.dialogLabel = false
}).catch(res => {
this.$message.error(res.message)
})
updatetProductLabel(this.product_id, this.labelForm).then(({ message }) => {
this.$message.success(message)
this.getList('')
this.dialogLabel = false
}).catch(res => {
this.$message.error(res.message)
})
} else {
return
}
@ -532,10 +550,10 @@ export default {
rank: info.rank,
star: info.star
}
if(info.is_benefit === 1) this.checkboxGroup.push('is_benefit')
if(info.is_hot === 1) this.checkboxGroup.push('is_hot')
if(info.is_best === 1) this.checkboxGroup.push('is_best')
if(info.is_new === 1) this.checkboxGroup.push('is_new')
if (info.is_benefit === 1) this.checkboxGroup.push('is_benefit')
if (info.is_hot === 1) this.checkboxGroup.push('is_hot')
if (info.is_best === 1) this.checkboxGroup.push('is_best')
if (info.is_new === 1) this.checkboxGroup.push('is_new')
this.fullscreenLoading = false
}).catch(res => {
this.$message.error(res.message)
@ -543,6 +561,7 @@ export default {
})
},
onEdit(id) {
this.product_id = id;
this.productId = id
this.getInfo(id)
this.dialogVisible = true
@ -555,7 +574,7 @@ export default {
handleSubmit(name) {
console.log(this.formValidate)
this.$refs[name].validate((valid) => {
if(valid) {
if (valid) {
productUpdateApi(this.productId, this.formValidate).then(async res => {
this.fullscreenLoading = false
this.$message.success(res.message)
@ -589,7 +608,7 @@ export default {
},
//
batchOff() {
if(this.multipleSelection.length === 0) return this.$message.warning('请先选择商品')
if (this.multipleSelection.length === 0) return this.$message.warning('请先选择商品')
this.toOff(this.OffId)
},
//
@ -603,15 +622,15 @@ export default {
},
//
batchShow(status) {
if(this.multipleSelection.length === 0) return this.$message.warning('请先选择商品')
let data = {status: status,ids: this.OffId}
batchesOnOffApi(data).then(res => {
if (this.multipleSelection.length === 0) return this.$message.warning('请先选择商品')
let data = { status: status, ids: this.OffId }
batchesOnOffApi(data).then(res => {
this.$message.success(res.message)
this.getList('')
})
.catch(res => {
this.$message.error(res.message)
})
.catch(res => {
this.$message.error(res.message)
})
},
//
toOff(id) {
@ -622,7 +641,7 @@ export default {
inputType: 'textarea',
inputPlaceholder: '请输入强制下架原因',
inputValidator: (value) => {
if(!value) {
if (!value) {
return '请输入强制下架原因'
}
}
@ -667,7 +686,7 @@ export default {
})
},
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.isShow = false
},
@ -680,6 +699,7 @@ export default {
this.OffId = data
},
toExamine(id) {
this.product_id = id;
this.$refs.infoFrom.dialogVisible = true
this.isShow = true
this.$refs.infoFrom.getInfo(id)
@ -718,15 +738,18 @@ export default {
</script>
<style lang="scss" scoped>
::v-deep .el-select-dropdown__item{
max-width: 350px!important;
/deep/.el-select-dropdown__item {
max-width: 350px !important;
}
.template{
.template {
overflow: hidden;
}
.label-list{
.label-list {
height: 100%;
}
.bg {
z-index: 100;
position: fixed;
@ -736,48 +759,64 @@ export default {
height: 100%;
background: rgba(0, 0, 0, 0.1);
}
.tags_name{
.tags_name {
font-size: 10px;
height: 16px;
line-height: 16px;
padding: 0 2px;
margin-right: 2px;
&.name0{
&.name0 {
color: var(--prev-color-primary);
}
&.name1{
&.name1 {
color: #FF8A4D;
}
}
.rate_star {
position: relative;
top: 5px;
}
table .el-image {
display: inline-block;
}
.demo-table-expand {
font-size: 0;
}
.demo-table-expand ::v-deep label {
width: 105px;
color: #99a9bf;
.demo-table-expand {
/deep/ label {
width: 105px;
color: #99a9bf;
}
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
width: 33.33%;
}
.seachTiele {
line-height: 35px;
}
.el-dropdown-link {
cursor: pointer;
color: var(--prev-color-primary);
font-size: 12px;
}
.el-icon-arrow-down {
font-size: 12px;
}
/deep/.el-table .success-row {
background: #EBF1FE;
}
</style>