Commit 99e5812c authored by yaya's avatar yaya

feat:优化

parent 63781579
......@@ -45,4 +45,11 @@ export function findSaleDetail(data) {
data
})
}
export function irregularOff(data) {
return request({
url: '/supplierItem/irregularOff',
method: 'post',
data
})
}
......@@ -141,7 +141,8 @@ export const asyncRouterMap = [
title: '会员详情',
icon: 'message',
noCache: true
}
},
hidden: true
},
{
path: 'feedback',
......
......@@ -2,7 +2,7 @@
<div class="page_consignList">
<div class="filter-container">
<div class="button_left">
<el-input v-model="listQuery.name" clearable class="filter-item" style="width: 200px;" placeholder="请输入标题"/>
<el-input v-model="listQuery.name" clearable class="filter-item" style="width: 200px;" placeholder="请输入商品标题"/>
<el-select v-model="listQuery.isOnSale" placeholder="请选择是否出售" class="filter-item" style="width: 200px;">
<el-option
v-for="item in options"
......@@ -20,6 +20,7 @@
size="mini"/>
</el-select>
<el-button class="filter-item" type="primary" icon="el-icon-search" style="margin-left: 12px" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-search" style="margin-left: 12px" @click="handleReset">重置</el-button>
</div>
</div>
<el-table
......@@ -65,13 +66,19 @@
<span class="tooltip-span">{{ `${scope.row.statusName || '-'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100">
<el-table-column align="center" label="操作" width="200">
<template slot-scope="scope">
<el-button
type="primary"
size="mini"
@click="handleToDetail(scope.row)">详情
</el-button>
<el-button
v-if="scope.row.status === 0"
type="danger"
size="mini"
@click="handleSetItemOff(scope.row)">违规下架
</el-button>
</template>
</el-table-column>
......@@ -90,7 +97,7 @@
<script>
import Line2Hidden from '@/components/line2Hidden'
import Pagination from '@/components/Pagination'
import { getSaleList, updateOnSale, deleteSaleItem } from '@/api/business/sale'
import { getSaleList, updateOnSale, deleteSaleItem, irregularOff } from '@/api/business/sale'
import { MessageBox } from 'element-ui'
export default {
......@@ -164,6 +171,13 @@ export default {
handleCreate() {
this.$router.push({ path: '/sale/saleAdd' })
},
handleReset() {
this.listQuery = {
page: 1,
limit: 20,
type: 3
}
},
handlerGetList() {
this.listQuery.page = 1
this.getList()
......@@ -210,10 +224,40 @@ export default {
})
this.getList()
}).catch(err => {
this.$notify.error({
title: '失败',
message: err.data.errmsg
this.$message.error(err.data && err.data.errmsg || '请求失败, 请重试')
})
})
},
/**
* 违规下架
* @param this.userDetail
*/
handleSetItemOff(row) {
this.$confirm('是否将该商品违规下架?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const params = {
id: row.id,
state: 1
}
irregularOff(params).then(response => {
this.list = this.list.filter((item) => {
if (item.id === row.id) {
item.statusName = '违规下架'
item.status = 1
item.isAbleSale = false
return item
}
return item
})
this.$notify.success({
message: '下架成功'
})
}).catch((e) => {
console.log('===报错=', e)
this.$message.error(e.data && e.data.errmsg || '请求失败, 请重试')
})
})
}
......
......@@ -205,11 +205,7 @@ export default {
message: successTip
})
}).catch((e) => {
this.$notify({
title: '提示',
message: e.message || '请求失败, 请重试',
type: 'warning'
})
this.$message.error(e.data && e.data.errmsg || '请求失败, 请重试')
})
})
},
......@@ -242,11 +238,7 @@ export default {
})
}).catch((e) => {
console.log('===报错=', e)
this.$notify({
title: '提示',
message: e.message || '请求失败, 请重试',
type: 'warning'
})
this.$message.error(e.data && e.data.errmsg || '请求失败, 请重试')
})
})
},
......
......@@ -247,11 +247,7 @@ export default {
message: successTip
})
}).catch((e) => {
this.$notify({
title: '提示',
message: e.message || '请求失败, 请重试',
type: 'warning'
})
this.$message.error(e.data && e.data.errmsg || '请求失败, 请重试')
})
})
},
......@@ -278,11 +274,7 @@ export default {
})
}).catch((e) => {
console.log('===报错=', e)
this.$notify({
title: '提示',
message: e.message || '请求失败, 请重试',
type: 'warning'
})
this.$message.error(e.data && e.data.errmsg || '请求失败, 请重试')
})
})
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment