|
@@ -24,7 +24,7 @@
|
|
|
</div>
|
|
|
<div class="screen clearfix">
|
|
|
<el-row :gutter="20">
|
|
|
- <el-col :xs="12" :sm="12" :lg="4">
|
|
|
+ <el-col :xs="8" :sm="8" :lg="4">
|
|
|
<el-form-item label-width="0">
|
|
|
<el-cascader
|
|
|
v-model="screenForm.classify"
|
|
@@ -39,23 +39,30 @@
|
|
|
</el-select> -->
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :xs="12" :sm="12" :lg="4">
|
|
|
+ <el-col :xs="8" :sm="8" :lg="4">
|
|
|
<el-form-item label-width="0">
|
|
|
- <el-select v-model="screenForm.status" placeholder="全部" size="small" @change="getListByScreen">
|
|
|
- <el-option label="上下架状态" value=""></el-option>
|
|
|
+ <el-select v-model="screenForm.status" placeholder="上下架状态" size="small" clearable @change="getListByScreen">
|
|
|
<el-option :label="item.label" :value="item.value" v-for="(item, index) in select_status" :key="index"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :xs="12" :sm="12" :lg="8">
|
|
|
- <el-form-item label="销售价格:" label-width="90px">
|
|
|
+ <el-col :xs="8" :sm="8" :lg="4">
|
|
|
+ <el-form-item label-width="0">
|
|
|
+ <el-select v-model="screenForm.isTrade" placeholder="是否支持以旧换新" size="small" clearable @change="getListByScreen">
|
|
|
+ <el-option label="支持以旧换新" value="YES"></el-option>
|
|
|
+ <el-option label="不支持以旧换新" value="NO"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="12" :sm="12" :lg="6">
|
|
|
+ <el-form-item label="销售价格" label-width="80px">
|
|
|
<el-input v-model="screenForm.price1" size="small" @change="getListByScreen" clearable ></el-input>
|
|
|
<span>至</span>
|
|
|
<el-input v-model="screenForm.price2" size="small" @change="getListByScreen" clearable ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :xs="12" :sm="12" :lg="8">
|
|
|
- <el-form-item label="分销金额:" label-width="90px">
|
|
|
+ <el-col :xs="12" :sm="12" :lg="6">
|
|
|
+ <el-form-item label="分销金额" label-width="80px">
|
|
|
<el-input v-model="screenForm.amount1" size="small" @change="getListByScreen" clearable ></el-input>
|
|
|
<span>至</span>
|
|
|
<el-input v-model="screenForm.amount2" size="small" @change="getListByScreen" clearable ></el-input>
|
|
@@ -74,10 +81,14 @@
|
|
|
<div class="btn-group clearfix">
|
|
|
<div class="fl">
|
|
|
<el-button v-if="$restrict('add')" type="primary" icon="el-icon-plus" size="small" @click="addOrEdit('add')">添加商品</el-button>
|
|
|
- <el-button v-if="$restrict('batchLaunch')" size="small" @click="batchOperation('on')">批量上架</el-button>
|
|
|
- <el-button v-if="$restrict('batchRemova')" size="small" @click="batchOperation('off')">批量下架</el-button>
|
|
|
<el-button v-if="$restrict('batchSet')" size="small" @click="batchOperation('module')">批量设置模块</el-button>
|
|
|
<el-button v-if="$restrict('batchSetfreight')" size="small" @click="batchOperation('freight')">批量设置运费</el-button>
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
+ <el-button v-if="$restrict('batchLaunch')" size="small" @click="batchOperation('status', 'on')">批量上架</el-button>
|
|
|
+ <el-button v-if="$restrict('batchRemova')" size="small" @click="batchOperation('status', 'off')">批量下架</el-button>
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
+ <el-button v-if="$restrict('batchTrade')" size="small" @click="batchOperation('isTrade', 'YES')">开启以旧换新</el-button>
|
|
|
+ <el-button v-if="$restrict('batchTrade')" size="small" @click="batchOperation('isTrade', 'NO')">关闭以旧换新</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -153,6 +164,11 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="销量" prop="soldNum" min-width="110" sortable></el-table-column>
|
|
|
+ <el-table-column align="center" label="是否支持以旧换新" prop="isTrade" min-width="130">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ {YES: '支持', NO: '不支持'}[scope.row.isTrade] }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column align="center" label="排序" prop="sortNum" min-width="110" sortable>
|
|
|
<template slot-scope="scope">
|
|
|
<!-- {{ scope.row.sortNum }} -->
|
|
@@ -298,7 +314,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getGoodsList, deleteGoods, getClassifyList, getGoodsStateCount, cloneGoods, editGoods, goodsPutOn, goodsPutOff, checkSeckill, getGoodsDetail, getModuleList, setCommomModule, setFreight, getFreightList } from '@/api/goods'
|
|
|
+import { getGoodsList, deleteGoods, getClassifyList, getGoodsStateCount, cloneGoods, editGoods, goodsPutOn, goodsPutOff, checkSeckill, getGoodsDetail, getModuleList, setCommomModule, setFreight, getFreightList, batchTrade } from '@/api/goods'
|
|
|
import Clipboard from 'clipboard'
|
|
|
import { EventBus } from '@/utils/eventBus'
|
|
|
export default {
|
|
@@ -315,6 +331,7 @@ export default {
|
|
|
keyword: '',
|
|
|
classify: '',
|
|
|
status: '',
|
|
|
+ isTrade: '',
|
|
|
price1: '',
|
|
|
price2: '',
|
|
|
amount1: '',
|
|
@@ -401,6 +418,7 @@ export default {
|
|
|
keyword: this.screenForm.keyword,
|
|
|
categoryId: categoryId,
|
|
|
status: this.screenForm.status,
|
|
|
+ isTrade: this.screenForm.isTrade,
|
|
|
startPrice: this.screenForm.price1,
|
|
|
endPrice: this.screenForm.price2,
|
|
|
startShare: this.screenForm.amount1,
|
|
@@ -605,20 +623,14 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 批量操作
|
|
|
- batchOperation(type) {
|
|
|
+ batchOperation(type, status) {
|
|
|
if(this.tableSelection.length < 1) {
|
|
|
return this.$errorMsg('至少选择一个商品');
|
|
|
}
|
|
|
- const typeMap = {
|
|
|
- on: '上架',
|
|
|
- off: '下架',
|
|
|
- module: '设置模块',
|
|
|
- freight: '设置运费'
|
|
|
- };
|
|
|
|
|
|
// 批量上架/批量下架
|
|
|
- if(['on', 'off'].includes(type)) {
|
|
|
- this.$confirm('您确定要批量'+typeMap[type]+'选中商品吗?', '提示', {
|
|
|
+ if(type == 'status') {
|
|
|
+ this.$confirm(`您确定要批量${{on: '上架', off: '下架'}[status]}选中商品吗?`, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
@@ -628,14 +640,14 @@ export default {
|
|
|
goodsIds.push(item.goodsId);
|
|
|
});
|
|
|
// 批量上架
|
|
|
- if(type == 'on') {
|
|
|
+ if(status == 'on') {
|
|
|
goodsPutOn(goodsIds).then(res => {
|
|
|
this.$successMsg();
|
|
|
this.getList();
|
|
|
})
|
|
|
}
|
|
|
// 批量下架
|
|
|
- else if(type == 'off') {
|
|
|
+ else if(status == 'off') {
|
|
|
checkSeckill(goodsIds).then(res => {
|
|
|
if(res.data && res.data.length > 0) {
|
|
|
let goodsNames = [];
|
|
@@ -664,6 +676,28 @@ export default {
|
|
|
|
|
|
}).catch(() => {});
|
|
|
}
|
|
|
+
|
|
|
+ // 批量开启关闭以旧换新
|
|
|
+ else if(type == 'isTrade') {
|
|
|
+ this.$confirm(`您确定要批量${{YES: '开启', NO: '关闭'}[status]}以旧换新吗?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ let goodsIds = [];
|
|
|
+ this.tableSelection.forEach(item => {
|
|
|
+ goodsIds.push(item.goodsId);
|
|
|
+ });
|
|
|
+ batchTrade({
|
|
|
+ goodsIds: goodsIds.join(','),
|
|
|
+ isTrade: status
|
|
|
+ }).then(res => {
|
|
|
+ this.$successMsg();
|
|
|
+ this.getList();
|
|
|
+ })
|
|
|
+ }).catch(() => {});
|
|
|
+ }
|
|
|
+
|
|
|
// 批量设置模块
|
|
|
else if(type == 'module') {
|
|
|
this.getModuleList();
|