|
@@ -4,57 +4,57 @@ import { Search } from '@element-plus/icons-vue'
|
|
import {apiProductsConfig} from '@/api/products'
|
|
import {apiProductsConfig} from '@/api/products'
|
|
import { apiMediaCommon } from '@/api/media'
|
|
import { apiMediaCommon } from '@/api/media'
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
+import editSingle from './components/editSingle.vue'
|
|
const router=useRouter()
|
|
const router=useRouter()
|
|
const tableColumns = [
|
|
const tableColumns = [
|
|
{
|
|
{
|
|
label:'产品名称',
|
|
label:'产品名称',
|
|
- key:'Mobile',
|
|
|
|
- sortable:false,
|
|
|
|
- align: 'center'
|
|
|
|
|
|
+ key:'ProductName',
|
|
|
|
+ align: 'center',
|
|
|
|
+ minwidthsty:250
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label:'产品类型',
|
|
label:'产品类型',
|
|
- key:'Mobile',
|
|
|
|
- sortable:false,
|
|
|
|
- align: 'center'
|
|
|
|
|
|
+ key:'ProductType',
|
|
|
|
+ align:'center',
|
|
|
|
+ widthsty:100,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label:'商品价格',
|
|
label:'商品价格',
|
|
- key:'Mobile',
|
|
|
|
- sortable:false,
|
|
|
|
- align: 'center'
|
|
|
|
|
|
+ key:'Price',
|
|
|
|
+ align: 'center',
|
|
|
|
+ widthsty:120,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label:'风险等级',
|
|
label:'风险等级',
|
|
- key:'LastReadTime',
|
|
|
|
- sortable:false,
|
|
|
|
- align: 'center'
|
|
|
|
|
|
+ key:'RiskLevel',
|
|
|
|
+ align: 'center',
|
|
|
|
+ widthsty:100,
|
|
},{
|
|
},{
|
|
label:'状态',
|
|
label:'状态',
|
|
- key:'AccountStatus',
|
|
|
|
- sortable:false,
|
|
|
|
- align: 'center'
|
|
|
|
|
|
+ key:'SaleStatus',
|
|
|
|
+ align: 'center',
|
|
|
|
+ widthsty:120,
|
|
},{
|
|
},{
|
|
label:'创建人',
|
|
label:'创建人',
|
|
key:'LastReadTime',
|
|
key:'LastReadTime',
|
|
- sortable:false,
|
|
|
|
align: 'center'
|
|
align: 'center'
|
|
},{
|
|
},{
|
|
label:'创建时间',
|
|
label:'创建时间',
|
|
- key:'ReadCount',
|
|
|
|
- sortable:false,
|
|
|
|
|
|
+ key:'PublishedTime',
|
|
|
|
+ sortable:true,
|
|
align: 'center'
|
|
align: 'center'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label:'更新时间',
|
|
label:'更新时间',
|
|
- key:'ReadCount',
|
|
|
|
- sortable:false,
|
|
|
|
|
|
+ key:'UpdatedTime',
|
|
|
|
+ sortable:true,
|
|
align: 'center'
|
|
align: 'center'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label:'操作',
|
|
label:'操作',
|
|
- key:'ReadCount',
|
|
|
|
- sortable:false,
|
|
|
|
|
|
+ key:'handle',
|
|
align: 'center'
|
|
align: 'center'
|
|
}
|
|
}
|
|
]
|
|
]
|
|
@@ -70,28 +70,40 @@ const options = ref([
|
|
label: '视频'
|
|
label: '视频'
|
|
}
|
|
}
|
|
])
|
|
])
|
|
|
|
+const saleStatusList = ref([
|
|
|
|
+ {
|
|
|
|
+ value: 'onSale',
|
|
|
|
+ label: '已上架'
|
|
|
|
+ }, {
|
|
|
|
+ value: 'offSale',
|
|
|
|
+ label: '未上架'
|
|
|
|
+ }
|
|
|
|
+])
|
|
const tableData = ref([])
|
|
const tableData = ref([])
|
|
const labelOptions = ref([])
|
|
const labelOptions = ref([])
|
|
|
|
+const showModal = ref(false)
|
|
|
|
+const productInfo = ref({})
|
|
const tableQuery = reactive({
|
|
const tableQuery = reactive({
|
|
keyWord:'',
|
|
keyWord:'',
|
|
currentPage:1,
|
|
currentPage:1,
|
|
pageSize:10,
|
|
pageSize:10,
|
|
totals:0,
|
|
totals:0,
|
|
- ProductType:'report',
|
|
|
|
- PermissionIds:null,
|
|
|
|
- RegisterBeginDate:'',
|
|
|
|
- RegisterEndDate:'',
|
|
|
|
|
|
+ ProductType:'',
|
|
|
|
+ SaleStatus:null,
|
|
|
|
+ CreatedTime:'',
|
|
|
|
+ UpdatedTime:'',
|
|
})
|
|
})
|
|
|
|
|
|
function getTableData(){
|
|
function getTableData(){
|
|
- apiProductsConfig.getUnSetProductList({
|
|
|
|
|
|
+ apiProductsConfig.getproductList({
|
|
|
|
+ IsSingle:true, // 是否是单品
|
|
Keyword:tableQuery.keyWord,
|
|
Keyword:tableQuery.keyWord,
|
|
CurrentIndex:tableQuery.currentPage,
|
|
CurrentIndex:tableQuery.currentPage,
|
|
PageSize:tableQuery.pageSize,
|
|
PageSize:tableQuery.pageSize,
|
|
ProductType:tableQuery.ProductType,
|
|
ProductType:tableQuery.ProductType,
|
|
- RegisterBeginDate:tableQuery.RegisterBeginDate,
|
|
|
|
- RegisterEndDate:tableQuery.RegisterEndDate,
|
|
|
|
- PermissionIds:tableQuery.PermissionIds?.join(','),
|
|
|
|
|
|
+ CreatedTime:tableQuery.CreatedTime,
|
|
|
|
+ UpdatedTime:tableQuery.UpdatedTime,
|
|
|
|
+ SaleStatus:tableQuery.SaleStatus,
|
|
}).then(res=>{
|
|
}).then(res=>{
|
|
if(res.Ret!==200) return
|
|
if(res.Ret!==200) return
|
|
tableData.value = res.Data.List||[]
|
|
tableData.value = res.Data.List||[]
|
|
@@ -126,6 +138,66 @@ function handleSortChange({order,prop}){
|
|
function handleSelectChange() {
|
|
function handleSelectChange() {
|
|
getTableData();
|
|
getTableData();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 操作
|
|
|
|
+function operation(handle, row) {
|
|
|
|
+ switch (handle) {
|
|
|
|
+ case 'stock':
|
|
|
|
+ apiProductsConfig.postUpdateSaleStatus({
|
|
|
|
+ ProductId:row.Id,
|
|
|
|
+ SaleStatus:'onSale'
|
|
|
|
+ }).then(res=>{
|
|
|
|
+ if(res.Ret!==200) return
|
|
|
|
+ ElMessage.success('上架成功')
|
|
|
|
+ getTableData()
|
|
|
|
+ })
|
|
|
|
+ break;
|
|
|
|
+ case 'delist':
|
|
|
|
+ apiProductsConfig.postUpdateSaleStatus({
|
|
|
|
+ ProductId:row.Id,
|
|
|
|
+ SaleStatus:'offSale'
|
|
|
|
+ }).then(res=>{
|
|
|
|
+ if(res.Ret!==200) return
|
|
|
|
+ ElMessage.success('下架成功')
|
|
|
|
+ getTableData()
|
|
|
|
+ })
|
|
|
|
+ break;
|
|
|
|
+ case 'edit':
|
|
|
|
+ console.log(row);
|
|
|
|
+ row.Price = row.Price.split('¥').join("")
|
|
|
|
+ console.log(row);
|
|
|
|
+
|
|
|
|
+ productInfo.value = row
|
|
|
|
+ showModal.value = true
|
|
|
|
+ break;
|
|
|
|
+ case 'delete':
|
|
|
|
+ ElMessageBox.confirm(
|
|
|
|
+ '删除产品后,该产品转为免费,不影响该产品的历史购买记录,确认删除吗?',
|
|
|
|
+ '提示',
|
|
|
|
+ {
|
|
|
|
+ confirmButtonText: '确认',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then(() => {
|
|
|
|
+ apiProductsConfig.postDeleteProduct({
|
|
|
|
+ ProductId:row.Id,
|
|
|
|
+ }).then(res=>{
|
|
|
|
+ if(res.Ret!==200) return
|
|
|
|
+ ElMessage.success('删除成功')
|
|
|
|
+ getTableData()
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+function closeEdit() {
|
|
|
|
+ showModal.value = false
|
|
|
|
+ getTableData();
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -134,7 +206,7 @@ function handleSelectChange() {
|
|
<div class="top-box">
|
|
<div class="top-box">
|
|
<div>
|
|
<div>
|
|
<el-button type="primary" style="margin-right: 20px;" @click="router.push('/products/addSingle')">添加单品</el-button>
|
|
<el-button type="primary" style="margin-right: 20px;" @click="router.push('/products/addSingle')">添加单品</el-button>
|
|
- <el-select v-model="tableQuery.ProductType" @change="handleSelectChange()" placeholder="请选择" style="width: 200px; margin-right: 20px;">
|
|
|
|
|
|
+ <el-select clearable v-model="tableQuery.ProductType" @change="handleSelectChange()" placeholder="产品类型" style="width: 200px; margin-right: 20px;">
|
|
<el-option
|
|
<el-option
|
|
v-for="item in options"
|
|
v-for="item in options"
|
|
:key="item.value"
|
|
:key="item.value"
|
|
@@ -142,35 +214,30 @@ function handleSelectChange() {
|
|
:value="item.value">
|
|
:value="item.value">
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
- <el-cascader
|
|
|
|
- filterable
|
|
|
|
- :options="labelOptions"
|
|
|
|
- collapse-tags
|
|
|
|
- v-model="tableQuery.PermissionIds"
|
|
|
|
- @change="handleSelectChange()"
|
|
|
|
- :props="{
|
|
|
|
- value:'id',
|
|
|
|
- label:'name',
|
|
|
|
- emitPath:false,
|
|
|
|
- multiple:true
|
|
|
|
- }"
|
|
|
|
- style=" margin-right: 20px"
|
|
|
|
- clearable>
|
|
|
|
- </el-cascader>
|
|
|
|
|
|
+ <el-select v-model="tableQuery.SaleStatus" clearable @change="handleSelectChange()" placeholder="状态" style="width: 200px; margin-right: 20px;">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in saleStatusList"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
<el-date-picker
|
|
<el-date-picker
|
|
- v-model="tableQuery.RegisterBeginDate"
|
|
|
|
|
|
+ v-model="tableQuery.CreatedTime"
|
|
type="date"
|
|
type="date"
|
|
placeholder="创建时间"
|
|
placeholder="创建时间"
|
|
format="YYYY-MM-DD"
|
|
format="YYYY-MM-DD"
|
|
style="margin-right: 20px;"
|
|
style="margin-right: 20px;"
|
|
value-format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
|
|
+ @change="handlePageChange(1)"
|
|
/>
|
|
/>
|
|
<el-date-picker
|
|
<el-date-picker
|
|
- v-model="tableQuery.RegisterEndDate"
|
|
|
|
|
|
+ v-model="tableQuery.UpdatedTime"
|
|
type="date"
|
|
type="date"
|
|
placeholder="更新时间"
|
|
placeholder="更新时间"
|
|
format="YYYY-MM-DD"
|
|
format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
|
|
+ @change="handlePageChange(1)"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="search-box">
|
|
<div class="search-box">
|
|
@@ -178,18 +245,25 @@ function handleSelectChange() {
|
|
v-model="tableQuery.keyWord"
|
|
v-model="tableQuery.keyWord"
|
|
:prefix-icon="Search" clearable
|
|
:prefix-icon="Search" clearable
|
|
style="width:400px"
|
|
style="width:400px"
|
|
- placeholder="请输入手机号"
|
|
|
|
|
|
+ placeholder="产品名称"
|
|
@input="handlePageChange(1)"
|
|
@input="handlePageChange(1)"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="table-box">
|
|
<div class="table-box">
|
|
<el-table border :data="tableData" @sort-change="handleSortChange">
|
|
<el-table border :data="tableData" @sort-change="handleSortChange">
|
|
- <el-table-column
|
|
|
|
|
|
+ <el-table-column
|
|
v-for="column in tableColumns" :key="column.key"
|
|
v-for="column in tableColumns" :key="column.key"
|
|
- :prop="column.key" :label="column.label" :sortable="column.sortable" :align="column.align">
|
|
|
|
- <template #default="scope" v-if="column.key === 'AccountStatus'">
|
|
|
|
- <el-tag :type="scope.row[column.key]=== 'Open' ?'success':'info'">{{scope.row[column.key]=== 'Open'?'已开户':'未开户' }}</el-tag>
|
|
|
|
|
|
+ :prop="column.key" :label="column.label" :sortable="column.sortable" :align="column.align" :width="column.widthsty"
|
|
|
|
+ :min-width="column.minwidthsty">
|
|
|
|
+ <template #default="scope" v-if="column.key === 'SaleStatus'">
|
|
|
|
+ <el-tag :type="scope.row[column.key]=== '已上架' ?'success':'info'">{{ scope.row[column.key] }}</el-tag>
|
|
|
|
+ </template>
|
|
|
|
+ <template #default="scope" v-else-if="column.key === 'handle'">
|
|
|
|
+ <span class="edit" v-if="scope.row.SaleStatus !== '已上架'" @click="operation('stock', scope.row)">上架</span>
|
|
|
|
+ <span class="edit" v-if="scope.row.SaleStatus === '已上架'" @click="operation('delist', scope.row)" >下架</span>
|
|
|
|
+ <span class="edit" v-if="scope.row.SaleStatus !== '已上架'" @click="operation('edit', scope.row)">编辑</span>
|
|
|
|
+ <span class="delete" v-if="scope.row.SaleStatus !== '已上架'" @click="operation('delete', scope.row)">删除</span>
|
|
</template>
|
|
</template>
|
|
<template #default="scope" v-else>
|
|
<template #default="scope" v-else>
|
|
{{scope.row[column.key]}}
|
|
{{scope.row[column.key]}}
|
|
@@ -207,6 +281,7 @@ function handleSelectChange() {
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <editSingle v-model:show="showModal" :productInfo="productInfo" @close="closeEdit()"></editSingle>
|
|
</el-card>
|
|
</el-card>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -220,9 +295,14 @@ function handleSelectChange() {
|
|
padding: 20px 0 40px 0;
|
|
padding: 20px 0 40px 0;
|
|
}
|
|
}
|
|
.table-box{
|
|
.table-box{
|
|
- .ReadCount {
|
|
|
|
- color: rgba(8, 108, 224, 1);
|
|
|
|
- cursor: pointer;
|
|
|
|
|
|
+ .edit {
|
|
|
|
+ cursor:pointer;
|
|
|
|
+ color: rgba(8, 108, 224, 1);
|
|
|
|
+ margin-right: 10px;
|
|
|
|
+ }
|
|
|
|
+ .delete {
|
|
|
|
+ cursor:pointer;
|
|
|
|
+ color: rgba(240, 61, 57, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|