Commit bf4fce74 by cmosquito

整理页面

parent d47341b9
import request from '@/utils/request'
export function fetchList(params) {
return request({
url:'/brand/list',
method:'get',
params:params
})
}
export function createBrand(data) {
return request({
url:'/brand/create',
method:'post',
data:data
})
}
export function updateShowStatus(data) {
return request({
url:'/brand/update/showStatus',
method:'post',
data:data
})
}
export function updateFactoryStatus(data) {
return request({
url:'/brand/update/factoryStatus',
method:'post',
data:data
})
}
export function deleteBrand(id) {
return request({
url:'/brand/delete/'+id,
method:'get',
})
}
export function getBrand(id) {
return request({
url:'/brand/'+id,
method:'get',
})
}
export function updateBrand(id,data) {
return request({
url:'/brand/update/'+id,
method:'post',
data:data
})
}
import request from '@/utils/request'
export function fetchList() {
return request({
url:'/companyAddress/list',
method:'get'
})
}
import request from '@/utils/request'
export function fetchList(params) {
return request({
url:'/coupon/list',
method:'get',
params:params
})
}
export function createCoupon(data) {
return request({
url:'/coupon/create',
method:'post',
data:data
})
}
export function getCoupon(id) {
return request({
url:'/coupon/'+id,
method:'get',
})
}
export function updateCoupon(id,data) {
return request({
url:'/coupon/update/'+id,
method:'post',
data:data
})
}
export function deleteCoupon(id) {
return request({
url:'/coupon/delete/'+id,
method:'post',
})
}
import request from '@/utils/request'
export function fetchList(params) {
return request({
url:'/couponHistory/list',
method:'get',
params:params
})
}
import request from '@/utils/request'
export function fetchList(params) {
return request({
url:'/flash/list',
method:'get',
params:params
})
}
export function updateStatus(id,params) {
return request({
url:'/flash/update/status/'+id,
method:'post',
params:params
})
}
export function deleteFlash(id) {
return request({
url:'/flash/delete/'+id,
method:'post'
})
}
export function createFlash(data) {
return request({
url:'/flash/create',
method:'post',
data:data
})
}
export function updateFlash(id,data) {
return request({
url:'/flash/update/'+id,
method:'post',
data:data
})
}
import request from '@/utils/request'
export function fetchList(params) {
return request({
url:'/home/newProduct/list',
method:'get',
params:params
})
}
export function updateRecommendStatus(data) {
return request({
url:'/home/newProduct/update/recommendStatus',
method:'post',
data:data
})
}
export function deleteNewProduct(data) {
return request({
url:'/home/newProduct/delete',
method:'post',
data:data
})
}
export function createNewProduct(data) {
return request({
url:'/home/newProduct/create',
method:'post',
data:data
})
}
export function updateNewProductSort(params) {
return request({
url:'/home/newProduct/update/sort/'+params.id,
method:'post',
params:params
})
}
...@@ -31,543 +31,7 @@ export function updateNewStatus(params) { ...@@ -31,543 +31,7 @@ export function updateNewStatus(params) {
}); });
} }
export function updateRecommendStatus(params) {
return request({
url: "/product/update/recommendStatus",
method: "post",
params: params
});
}
export function updatePublishStatus(params) {
return request({
url: "/product/update/publishStatus",
method: "post",
params: params
});
}
export function createProduct(data) {
return request({
url: "/product/create",
method: "post",
data: data
});
}
export function updateProduct(id, data) {
return request({
url: "/product/update/" + id,
method: "post",
data: data
});
}
export function getProduct(id) {
return request({
url: "/product/updateInfo/" + id,
method: "get"
});
}
// ------------------------------------------------------------------------------------
//底下的是新增的api,上面的是自带的
export function createUser(data) {
//学员页新建线索
console.log(data, "createUser");
return request({
url: "/user/info/add",
method: "post",
data: data
});
}
export function getUserInfo(id) {
// 学员详情页查询基本信息
return request({
url: `/user/info/selectOne/${id}`,
method: "post"
});
}
export function UserInfoDetail(id) {
// 学员详情页查询用户基本信息详情
return request({
url: `/user/info/detail/${id}`,
method: "post"
});
}
export function UserInfoUpdate(data) {
// 学员详情页修改用户基本信息详情
return request({
url: `/user/info/update`,
method: "post",
data
});
}
export function addChatRecord(data) {
//学员详情页添加沟通记录
return request({
url: "/chat/record/add",
method: "post",
data: data
});
}
export function getChatRecordAll(data) {
//获取学员详情页沟通记录
return request({
url: "/chat/record/all",
method: "post",
data: data
});
}
export function getTodayTasks() {
//首页获取今日任务
return request({
url: "/customerCare/user/statistics/todayTask",
///customerCare/user/statistics/todayTask
method: "post"
});
}
export function getNotice(data) {
//首页获取系统公告
return request({
url: "/notice/list",
method: "post",
data: data
});
}
export function myStu(data) {
//我的学员页。获取学员筛选结果
return request({
url: "/user/info/all/filter",
method: "post",
data: data
});
}
export function userTag(id) {
// 学员详情页查询用户标签
return request({
url: `/user/tag/all/${id}`,
method: "post"
});
}
export function addUserCustomTag(data) {
// 学员详情页添加用户自定义标签
return request({
url: `/user/tag/addUserCustomTag`,
method: "post",
data
});
}
export function deleteUserCustomTag(data) {
// 学员详情页删除用户标签
return request({
url: `/user/tag/delete`,
method: "post",
data
});
}
export function allTag(data) {
// 我的标签页,标签统计
return request({
url: `/tag/Statistics/all`,
method: "post",
data
});
}
export function singleTag(data) {
// 我的标签页,客服-单一标签列表
return request({
url: `/tag/Statistics/customerCare/singleTag`,
method: "post",
data
});
}
export function xuefuSingleTag(data) {
// 我的标签页,学服-单一标签列表
return request({
url: `/tag/Statistics/studyCare/singleTag`,
method: "post",
data
});
}
export function deleteList(data) {
// 单一标签页,批量删除单一标签下的用户
return request({
url: `/tag/Statistics/deleteList`,
method: "post",
data
});
}
export function newAddClew(data) {
// 首页点击跳转新增线索 待沟通线索
return request({
url: `/today/info/newAddClew`,
method: "post",
data
});
}
export function newAddStu(data) {
// 首页点击跳转新增学员
return request({
url: `/today/info/addUser`,
method: "post",
data
});
}
export function newChatUser(data) {
// 首页点击跳转已沟通学员
return request({
url: `/today/info/chatUser`,
method: "post",
data
});
}
export function newUnChatUser(data) {
// 首页点击跳转已沟通学员
return request({
url: `/today/info/unChatUser`,
method: "post",
data
});
}
export function KPI(data) {
// cso首页业绩简报
return request({
url: `/customerCare/user/statistics/KPI`,
method: "post",
data
});
}
export function auditCommitNum(data) {
// cso首页业绩简报-审课提交数
return request({
url: `/studyCare/user/statistics/auditCommitNum`,
method: "post",
data
});
}
export function refundNum(data) {
// cso首页业绩简报-退费人数
return request({
url: `/studyCare/user/statistics/refundNum`,
method: "post",
data
});
}
export function statisticsLop(data) {
// cso首页业绩简报-LOP审核通过人数
return request({
url: `/studyCare/user/statistics/Lop`,
method: "post",
data
});
}
export function kpiList(data) {
// 业绩简报详情列表
return request({
url: `/kpi/statistics/detail/list`,
method: "post",
data
});
}
export function unPayBalance(data) {
// 业绩简报未补全尾款
return request({
url: `/kpi/statistics/unPayBalance`,
method: "post",
data
});
}
export function payCostInfoAll(data) {
// 学员详情页-分页查询缴费记录
return request({
url: `/payCost/record/all`,
method: "post",
data
});
}
// ----------------------------------------------------------------------
// 学服部接口
export function todayTask(data) {
// 学服-首页今日任务
return request({
url: `/studyCare/user/statistics/todayTask`,
method: "post",
data
});
}
export function lop(data) {
// 学服-首页LOP审核通过人数
return request({
url: `/studyCare/user/statistics/Lop`,
method: "post",
data
});
}
export function newAllocate(data) {
// 学服-首页今日任务查询新分配学员
return request({
url: `/confirm/user/base/search/newAllocate`,
method: "post",
data
});
}
export function addWechatStatus(data) {
// 学服-首页今日任务-修改主动添加微信状态
return request({
url: `/confirm/user/base/update/addWechat/status`,
method: "post",
data
});
}
export function weChatState(id) {
// 学服-首页今日任务查询新分配学员-添加微信状态确认
return request({
url: `/confirm/user/base/update/weChatState/${id}`,
method: "post"
});
}
export function unConfirmBase(data) {
// 学服-首页今日任务-查询基本信息待确认
return request({
url: `/confirm/user/base/search/unConfirmBase`,
method: "post",
data
});
}
export function single(id) {
// 学服-首页今日任务-基本信息待确认-查询单一学员基本待确认信息
return request({
url: `/confirm/user/base/search/single/${id}`,
method: "post"
});
}
export function picUrl(data) {
// 学服-首页今日任务-查询基本信息待确认-变更用户图片
return request({
url: `/confirm/user/base/update/picUrl`,
method: "post",
data
});
}
export function baseConfirmState(id) {
// 学服-首页今日任务-基本信息待确认-基本信息审课完成
return request({
url: `/confirm/user/base/update/baseConfirmState/${id}`,
method: "post"
});
}
export function addCourse(data) {
// 学员详情页-课程信息-添加课程
return request({
url: `/user/course/addCourse`,
method: "post",
data
});
}
export function allCode(data) {
// 学员详情页-课程信息-查询cso课程代码
return request({
url: `/cso/all`,
method: "post",
data
});
}
export function allPayCode(data) {
// 学员详情页-课程信息-查询缴费标签
return request({
url: `/payCost/tag/all`,
method: "post",
data
});
}
export function courseList(data) {
// 学员详情页-课程信息-课程信息分页展示
return request({
url: `/user/course/list`,
method: "post",
data
});
}
export function editUpdate(data) {
// 学员详情页-课程信息-修改用户课程
return request({
url: `/user/course/update`,
method: "post",
data
});
}
export function deleteCourse(id) {
// 学员详情页-课程信息-删除用户课程
return request({
url: `/user/course/delete/${id}`,
method: "post"
});
}
export function updateAuditCourse(data) {
// 学员详情页-课程信息-修改审课信息
return request({
url: `/user/course/updateAuditCourse`,
method: "post",
data
});
}
export function addCurrentTermCourse(data) {
// 学员详情页-课程信息-继续添加本期课程
return request({
url: `/user/course/addCurrentTermCourse`,
method: "post",
data
});
}
export function addPayCost(data) {
// 学员详情页-缴费信息-添加缴费记录
return request({
url: `/payCost/record/add`,
method: "post",
data
});
}
export function updatePayCost(data) {
// 学员详情页-缴费信息-修改缴费记录
return request({
url: `/payCost/record/update`,
method: "post",
data
});
}
export function outlineList(data) {
// 大纲页-查询课程大纲
return request({
url: `/course/outline/list`,
method: "post",
data
});
}
export function updateOutlineState(id) {
// 大纲页-查询课程大纲-课程大纲确认
return request({
url: `/course/outline/updateState/${id}`,
method: "post"
});
}
export function statistics(data) {
// 学服部主管首页-数据简报
return request({
url: `/teacherAssistant/user/statistics/statistics`,
method: "post",
data
});
}
export function xfSelectUnBind(data) {
// 学服部主管-我的学员-查询待分配学员
return request({
url: `/studyCare/allocate/selectUnBind`,
method: "post",
data
});
}
export function kfSelectUnBind(data) {
// 客服部主管-我的学员-查询待分配学员
return request({
url: `/customerCare/allocate/selectUnBind`,
method: "post",
data
});
}
export function adminList(state) {
// 学服部主管-我的学员-查询老师(state = 1客服,state = 2学服))
return request({
url: `/filter/param/adminList/${state}`,
method: "post"
});
}
export function xfUpdateAllocate(data) {
// 学服部主管-我的学员-分配学员到指定学服
return request({
url: `/studyCare/allocate/update`,
method: "post",
data
});
}
export function kfUpdateAllocate(data) {
// 客服部主管-我的学员-分配学员到指定客服
return request({
url: `/customerCare/allocate/update`,
method: "post",
data
});
}
export function xfSelectBind(data) {
// 学服部主管-我的学员-查询已分配学员
return request({
url: `/studyCare/allocate/selectBind`,
method: "post",
data
});
}
export function kfSelectBind(data) {
// 客服部主管-我的学员-查询已分配学员
return request({
url: `/customerCare/allocate/selectBind`,
method: "post",
data
});
}
export function noticeAll(data) { export function noticeAll(data) {
// 学服部主管-系统公告-分页查询系统公告 // 学服部主管-系统公告-分页查询系统公告
...@@ -656,138 +120,8 @@ export function LOPState(data) { ...@@ -656,138 +120,8 @@ export function LOPState(data) {
}); });
} }
export function unPassState(data) {
// 今日任务-审课待分配-审课未通过确认
return request({
url: `/course/filter/unPassState`,
method: "post",
data
});
}
export function auditFail(data) {
// 审课进行中-查询审课失败信息
return request({
url: `/course/filter/list/auditFail`,
method: "post",
data
});
}
export function unConfirmAuditCourse1(state, data) {
// 审课进行中-查询全部信息待确认/转学分待确认学员
return request({
url: `/course/filter/list/unConfirmAuditCourse/${state}`,
method: "post",
data
});
}
export function confirmAuditCourseState1(data) {
// 审课进行中-全部信息确认/转学分确认
return request({
url: `/course/filter/confirmAuditCourseState`,
method: "post",
data
});
}
export function confirmAuditCourseState2(data) {
// 审课进行中-全部信息确认/转学分确认
return request({
url: `/course/filter/confirmAuditCourseState`,
method: "post",
data
});
}
export function unConfirmAuditCourse2(state, data) {
// 审课进行中-查询全部信息待确认/转学分待确认学员
return request({
url: `/course/filter/list/unConfirmAuditCourse/${state}`,
method: "post",
data
});
}
export function userAuditCourseState(data) {
// 学员详情-学员审课所处状态
return request({
url: `/user/course/auditCourseState`,
method: "post",
data
});
}
export function proofPic(id) {
// 学员详情-查询用户上传凭证
return request({
url: `/user/info/proofPic/${id}`,
method: "post"
});
}
export function unCommit(data) {
// 学员详情-查询未提交信息审核
return request({
url: `/confirm/user/base/search/unCommit`,
method: "post",
data
});
}
export function channel(data) {
// 客服部首页-销售渠道占比
return request({
url: `/customerCare/user/statistics/channel`,
method: "post",
data
});
}
export function statisticsList(data) {
// 数据统计-招生院校统计
return request({
url: `/auditSchool/statistics/list`,
method: "post",
data
});
}
export function payCostTagAll(data) {
// 缴费标签-分页查询缴费标签
return request({
url: `/payCost/tag/all`,
method: "post",
data
});
}
export function payCostTagAdd(data) {
// 缴费标签-添加缴费标签
return request({
url: `/payCost/tag/add`,
method: "post",
data
});
}
export function payCostTagUpdate(data) {
// 缴费标签-修改缴费标签
return request({
url: `/payCost/tag/update`,
method: "post",
data
});
}
export function adminAllUser(data) {
// 学员-管理员查询全部学员
return request({
url: `/all/user/data/search`,
method: "post",
data
});
}
export function errorWord(data) { export function errorWord(data) {
// 单词报错查询接口 // 单词报错查询接口
......
import request from '@/utils/request'
export function fetchList(params) {
return request({
url:'/returnApply/list',
method:'get',
params:params
})
}
export function deleteApply(params) {
return request({
url:'/returnApply/delete',
method:'post',
params:params
})
}
export function updateApplyStatus(id,data) {
return request({
url:'/returnApply/update/status/'+id,
method:'post',
data:data
})
}
export function getApplyDetail(id) {
return request({
url:'/returnApply/'+id,
method:'get'
})
}
...@@ -62,657 +62,7 @@ export const asyncRouterMap = [ ...@@ -62,657 +62,7 @@ export const asyncRouterMap = [
} }
] ]
}, },
{
path: "/wordGrade",
component: Layout,
redirect: "/wordGrade/index",
name: "wordGrade",
meta: { title: "简体词库信息", icon: "product-list" },
children: [
{
path: "index",
name: "WordGradeIndex",
component: () => import("@/views/wordGrade/index"),
meta: { title: "词库列表", icon: "product-list" }
},
{
path: "test",
name: "test",
component: () => import("@/views/wordGrade/test"),
meta: { title: "test", icon: "product-list" }
},
{
path: "wordGradeDetail",
name: "wordGradeDetail",
component: () => import("@/views/wordGrade/wordGradeDetail"),
meta: { title: "词库单词详情", icon: "product-list" }
},
{
path: "addGradeWord",
name: "addGradeWord",
component: () => import("@/views/wordGrade/addGradeWord"),
meta: { title: "添加词库单词", icon: "product-list" }
}
]
},
{
path: "/affixRoot",
component: Layout,
redirect: "/affixRoot/index",
name: "affixRoot",
meta: { title: "词根词缀管理", icon: "product-list" },
children: [
{
path: "index",
name: "affixRootIndex",
component: () => import("@/views/affixRoot/index"),
meta: { title: "词根词缀列表", icon: "product-list" }
},
{
path: "affixRootDetail",
name: "affixRootDetail",
component: () => import("@/views/affixRoot/affixRootDetail"),
meta: { title: "词根词缀详情", icon: "product-list" }
},
{
path: "affixRootAdd",
name: "affixRootAdd",
component: () => import("@/views/affixRoot/affixRootAdd"),
meta: { title: "词根词缀详情添加", icon: "product-list" }
}
]
},
{
path: "/wordTextbook",
component: Layout,
redirect: "/wordTextbook/index",
name: "wordTextbook",
meta: { title: "词书单词信息管理", icon: "product-list" },
children: [
{
path: "index",
name: "wordTextbookIndex",
component: () => import("@/views/wordTextbook/index"),
meta: { title: "词书单词信息列表", icon: "product-list" }
},
{
path: "wordTextbookDetail",
name: "wordTextbookDetail",
component: () => import("@/views/wordTextbook/wordTextbookDetail"),
meta: { title: "词书单词信息详情", icon: "product-list" }
}
]
},
{
path: "/wordError",
component: Layout,
redirect: "/wordError/index",
name: "wordError",
meta: { title: "错误单词管理", icon: "product-list" },
children: [
{
path: "index",
name: "wordErrorIndex",
component: () => import("@/views/wordError/index"),
meta: { title: "错误单词列表", icon: "product-list" }
},
{
path: "wordErrorDetail",
name: "wordErrorDetail",
component: () => import("@/views/wordError/wordErrorDetail"),
meta: { title: "错误单词详情", icon: "product-list" }
}
]
},
{
path: "/missionInfo",
component: Layout,
redirect: "/missionInfo/index",
name: "missionInfo",
meta: { title: "任务信息管理", icon: "product-list" },
children: [
{
path: "index",
name: "missionInfoIndex",
component: () => import("@/views/missionInfo/index"),
meta: { title: "任务信息列表", icon: "product-list" }
},
{
path: "missionInfoDetail",
name: "missionInfoDetail",
component: () => import("@/views/missionInfo/missionInfoDetail"),
meta: { title: "任务信息详情", icon: "product-list" }
}
]
},
{
path: "/furnitureInfo",
component: Layout,
redirect: "/furnitureInfo/index",
name: "furnitureInfo",
meta: { title: "家具信息管理", icon: "product-list" },
children: [
{
path: "index",
name: "furnitureInfoIndex",
component: () => import("@/views/furnitureInfo/index"),
meta: { title: "家具信息列表", icon: "product-list" }
},
{
path: "furnitureInfoDetail",
name: "furnitureInfoDetail",
component: () => import("@/views/furnitureInfo/furnitureInfoDetail"),
meta: { title: "家具信息详情", icon: "product-list" }
},
{
path: "furnitureInfoAdd",
name: "furnitureInfoAdd",
component: () => import("@/views/furnitureInfo/furnitureInfoAdd"),
meta: { title: "家具信息添加", icon: "product-list" }
}
]
},
{
path: "/resourceStore",
component: Layout,
redirect: "/resourceStore/index",
name: "resourceStore",
meta: { title: "熊猫币商城信息管理", icon: "product-list" },
children: [
{
path: "index",
name: "resourceStoreIndex",
component: () => import("@/views/resourceStore/index"),
meta: { title: "熊猫币商城信息列表", icon: "product-list" }
},
{
path: "resourceStoreDetail",
name: "resourceStoreDetail",
component: () => import("@/views/resourceStore/resourceStoreDetail"),
meta: { title: "熊猫币商城信息详情", icon: "product-list" }
},
{
path: "resourceStoreAdd",
name: "resourceStoreAdd",
component: () => import("@/views/resourceStore/resourceStoreAdd"),
meta: { title: "熊猫币商城信息添加", icon: "product-list" }
}
]
},
{
path: "/rmbStore",
component: Layout,
redirect: "/rmbStore/index",
name: "rmbStore",
meta: { title: "人民币商城信息管理", icon: "product-list" },
children: [
{
path: "index",
name: "rmbStoreIndex",
component: () => import("@/views/rmbStore/index"),
meta: { title: "人民币商城信息列表", icon: "product-list" }
},
{
path: "rmbStoreDetail",
name: "rmbStoreDetail",
component: () => import("@/views/rmbStore/rmbStoreDetail"),
meta: { title: "人民币商城信息详情", icon: "product-list" }
},
{
path: "rmbStoreAdd",
name: "rmbStoreAdd",
component: () => import("@/views/rmbStore/rmbStoreAdd"),
meta: { title: "人民币商城信息添加", icon: "product-list" }
},
{
path: "rmbStoreResourceIndex",
name: "rmbStoreResourceIndex",
component: () => import("@/views/rmbStoreResource/index"),
meta: { title: "人民币商城资源信息列表", icon: "product-list" }
},
{
path: "rmbStoreResourceDetail",
name: "rmbStoreResourceDetail",
component: () =>
import("@/views/rmbStoreResource/rmbStoreResourceDetail"),
meta: { title: "人民币商城资源信息详情", icon: "product-list" }
},
{
path: "rmbStoreResourceAdd",
name: "rmbStoreResourceAdd",
component: () => import("@/views/rmbStoreResource/rmbStoreResourceAdd"),
meta: { title: "人民币商城资源信息添加", icon: "product-list" }
}
]
},
{
path: "/inviteAward",
component: Layout,
redirect: "/inviteAward/inviteAwardDetail",
name: "inviteAward",
meta: { title: "邀请奖励信息管理", icon: "product-list" },
children: [
// {
// path: "index",
// name: "inviteAwardIndex",
// component: () => import("@/views/inviteAward/index"),
// meta: { title: "邀请奖励信息列表", icon: "product-list" }
// },
{
path: "inviteAwardDetail",
name: "inviteAwardDetail",
component: () => import("@/views/inviteAward/inviteAwardDetail"),
meta: { title: "邀请奖励信息详情", icon: "product-list" }
}
]
},
{
path: "/friends",
component: Layout,
redirect: "/friends/friendsList",
name: "friends",
meta: { title: "伙伴管理", icon: "product-list" },
children: [
{
path: "friendsList",
name: "friendsList",
component: () => import("@/views/friends/friendsList"),
meta: { title: "伙伴列表", icon: "product-list" }
},
{
path: "friendsDetail",
name: "friendsDetail",
component: () => import("@/views/friends/friendsDetail"),
meta: { title: "伙伴信息详情页", icon: "product-list" }
},
{
path: "talkpro",
name: "talkpro",
component: () => import("@/views/friends/talkpro"),
meta: { title: "伙伴对话生成器", icon: "product-list" }
},
{
path: "oneTalk",
name: "oneTalk",
component: () => import("@/views/friends/oneTalk"),
meta: { title: "单人对话格式整理", icon: "product-list" }
}
]
},
{
path: "/mail",
component: Layout,
redirect: "/mail/maillist",
name: "maillist",
meta: { title: "邮箱模块", icon: "product-list" },
children: [
{
path: "maillist",
name: "maillist",
component: () => import("@/views/mail/maillist"),
meta: { title: "邮箱公告列表", icon: "product-list" }
},
{
path: "newMail",
name: "newMail",
component: () => import("@/views/mail/newMail"),
meta: { title: "新建邮件", icon: "product-list" }
}
]
},
{
path: "/advertiseNum",
component: Layout,
redirect: "/advertiseNum/advertiseNumDetail",
name: "advertiseNum",
meta: { title: "每日广告限制管理", icon: "product-list" },
children: [
// {
// path: "index",
// name: "advertiseNumIndex",
// component: () => import("@/views/advertiseNum/index"),
// meta: { title: "每日广告限制列表", icon: "product-list" }
// },
{
path: "advertiseNumDetail",
name: "advertiseNumDetail",
component: () => import("@/views/advertiseNum/advertiseNumDetail"),
meta: { title: "每日广告限制详情", icon: "product-list" }
}
]
},
{
path: "/lottery",
component: Layout,
redirect: "/lottery/index",
name: "lottery",
meta: { title: "抽奖概率管理", icon: "product-list" },
children: [
{
path: "index",
name: "lotteryIndex",
component: () => import("@/views/lottery/index"),
meta: { title: "抽奖概率列表", icon: "product-list" }
},
{
path: "lotteryDetail",
name: "lotteryDetail",
component: () => import("@/views/lottery/lotteryDetail"),
meta: { title: "抽奖概率详情", icon: "product-list" }
}
]
},
{
path: "/achievement",
component: Layout,
redirect: "/achievement/index",
name: "achievement",
meta: { title: "勋章信息管理", icon: "product-list" },
children: [
{
path: "index",
name: "achievementIndex",
component: () => import("@/views/achievement/index"),
meta: { title: "勋章信息列表", icon: "product-list" }
},
{
path: "achievementDetail",
name: "achievementDetail",
component: () => import("@/views/achievement/achievementDetail"),
meta: { title: "勋章信息详情", icon: "product-list" }
}
]
},
// {
// {
// path: "/rmbStoreResource",
// component: Layout,
// redirect: "/rmbStoreResource/index",
// name: "rmbStoreResource",
// meta: { title: "人民币商城资源信息管理", icon: "product-list" },
// children: [
// {
// path: "rmbStoreResourceIndex",
// name: "rmbStoreResourceIndex",
// component: () => import("@/views/rmbStoreResource/index"),
// meta: { title: "人民币商城资源信息列表", icon: "product-list" }
// },
// {
// path: "rmbStoreResourceDetail",
// name: "rmbStoreResourceDetail",
// component: () =>
// import("@/views/rmbStoreResource/rmbStoreResourceDetail"),
// meta: { title: "人民币商城资源信息详情", icon: "product-list" }
// },
// {
// path: "rmbStoreResourceAdd",
// name: "rmbStoreResourceAdd",
// component: () => import("@/views/rmbStoreResource/rmbStoreResourceAdd"),
// meta: { title: "人民币商城资源信息添加", icon: "product-list" }
// }
// ]
// },
{
path: "/pms",
component: Layout,
redirect: "/pms/product",
name: "pms",
meta: { title: "商品", icon: "product" },
children: [
{
path: "product",
name: "product",
component: () => import("@/views/pms/product/index"),
meta: { title: "商品列表", icon: "product-list" }
},
{
path: "addProduct",
name: "addProduct",
component: () => import("@/views/pms/product/add"),
meta: { title: "添加商品", icon: "product-add" }
},
{
path: "updateProduct",
name: "updateProduct",
component: () => import("@/views/pms/product/update"),
meta: { title: "修改商品", icon: "product-add" },
hidden: true
},
{
path: "productCate",
name: "productCate",
component: () => import("@/views/pms/productCate/index"),
meta: { title: "商品分类", icon: "product-cate" }
},
{
path: "addProductCate",
name: "addProductCate",
component: () => import("@/views/pms/productCate/add"),
meta: { title: "添加商品分类" },
hidden: true
},
{
path: "updateProductCate",
name: "updateProductCate",
component: () => import("@/views/pms/productCate/update"),
meta: { title: "修改商品分类" },
hidden: true
},
{
path: "productAttr",
name: "productAttr",
component: () => import("@/views/pms/productAttr/index"),
meta: { title: "商品类型", icon: "product-attr" }
},
{
path: "productAttrList",
name: "productAttrList",
component: () => import("@/views/pms/productAttr/productAttrList"),
meta: { title: "商品属性列表" },
hidden: true
},
{
path: "addProductAttr",
name: "addProductAttr",
component: () => import("@/views/pms/productAttr/addProductAttr"),
meta: { title: "添加商品属性" },
hidden: true
},
{
path: "updateProductAttr",
name: "updateProductAttr",
component: () => import("@/views/pms/productAttr/updateProductAttr"),
meta: { title: "修改商品属性" },
hidden: true
},
{
path: "brand",
name: "brand",
component: () => import("@/views/pms/brand/index"),
meta: { title: "品牌管理", icon: "product-brand" }
},
{
path: "addBrand",
name: "addBrand",
component: () => import("@/views/pms/brand/add"),
meta: { title: "添加品牌" },
hidden: true
},
{
path: "updateBrand",
name: "updateBrand",
component: () => import("@/views/pms/brand/update"),
meta: { title: "编辑品牌" },
hidden: true
}
]
},
{
path: "/oms",
component: Layout,
redirect: "/oms/order",
name: "oms",
meta: { title: "订单", icon: "order" },
children: [
{
path: "order",
name: "order",
component: () => import("@/views/oms/order/index"),
meta: { title: "订单列表", icon: "product-list" }
},
{
path: "orderDetail",
name: "orderDetail",
component: () => import("@/views/oms/order/orderDetail"),
meta: { title: "订单详情" },
hidden: true
},
{
path: "deliverOrderList",
name: "deliverOrderList",
component: () => import("@/views/oms/order/deliverOrderList"),
meta: { title: "发货列表" },
hidden: true
},
{
path: "orderSetting",
name: "orderSetting",
component: () => import("@/views/oms/order/setting"),
meta: { title: "订单设置", icon: "order-setting" }
},
{
path: "returnApply",
name: "returnApply",
component: () => import("@/views/oms/apply/index"),
meta: { title: "退货申请处理", icon: "order-return" }
},
{
path: "returnReason",
name: "returnReason",
component: () => import("@/views/oms/apply/reason"),
meta: { title: "退货原因设置", icon: "order-return-reason" }
},
{
path: "returnApplyDetail",
name: "returnApplyDetail",
component: () => import("@/views/oms/apply/applyDetail"),
meta: { title: "退货原因详情" },
hidden: true
}
]
},
{
path: "/sms",
component: Layout,
redirect: "/sms/coupon",
name: "sms",
meta: { title: "营销", icon: "sms" },
children: [
{
path: "flash",
name: "flash",
component: () => import("@/views/sms/flash/index"),
meta: { title: "秒杀活动列表", icon: "sms-flash" }
},
{
path: "flashSession",
name: "flashSession",
component: () => import("@/views/sms/flash/sessionList"),
meta: { title: "秒杀时间段列表" },
hidden: true
},
{
path: "selectSession",
name: "selectSession",
component: () => import("@/views/sms/flash/selectSessionList"),
meta: { title: "秒杀时间段选择" },
hidden: true
},
{
path: "flashProductRelation",
name: "flashProductRelation",
component: () => import("@/views/sms/flash/productRelationList"),
meta: { title: "秒杀商品列表" },
hidden: true
},
{
path: "coupon",
name: "coupon",
component: () => import("@/views/sms/coupon/index"),
meta: { title: "优惠券列表", icon: "sms-coupon" }
},
{
path: "addCoupon",
name: "addCoupon",
component: () => import("@/views/sms/coupon/add"),
meta: { title: "添加优惠券" },
hidden: true
},
{
path: "updateCoupon",
name: "updateCoupon",
component: () => import("@/views/sms/coupon/update"),
meta: { title: "修改优惠券" },
hidden: true
},
{
path: "couponHistory",
name: "couponHistory",
component: () => import("@/views/sms/coupon/history"),
meta: { title: "优惠券领取详情" },
hidden: true
},
{
path: "brand",
name: "homeBrand",
component: () => import("@/views/sms/brand/index"),
meta: { title: "品牌推荐", icon: "product-brand" }
},
{
path: "new",
name: "homeNew",
component: () => import("@/views/sms/new/index"),
meta: { title: "新品推荐", icon: "sms-new" }
},
{
path: "hot",
name: "homeHot",
component: () => import("@/views/sms/hot/index"),
meta: { title: "人气推荐", icon: "sms-hot" }
},
{
path: "subject",
name: "homeSubject",
component: () => import("@/views/sms/subject/index"),
meta: { title: "专题推荐", icon: "sms-subject" }
},
{
path: "advertise",
name: "homeAdvertise",
component: () => import("@/views/sms/advertise/index"),
meta: { title: "广告列表", icon: "sms-ad" }
},
{
path: "addAdvertise",
name: "addHomeAdvertise",
component: () => import("@/views/sms/advertise/add"),
meta: { title: "添加广告" },
hidden: true
},
{
path: "updateAdvertise",
name: "updateHomeAdvertise",
component: () => import("@/views/sms/advertise/update"),
meta: { title: "编辑广告" },
hidden: true
}
]
},
{ {
path: "/ums", path: "/ums",
component: Layout, component: Layout,
......
<template>
<div class="container">
<!-- <h1>achievementDetail</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="中文名" prop="nameCn">
<el-col :span="11">
<!-- <el-slider
v-model="list.probability"
show-input
:max="1"
:step="0.01"
></el-slider> -->
<el-input v-model="list.nameCn"></el-input>
</el-col>
</el-form-item>
<el-form-item label="获得条件" prop="requirement">
<el-col :span="11">
<el-input v-model="list.requirement"></el-input>
</el-col>
</el-form-item>
<el-form-item label="条件次数" prop="num">
<el-col :span="11">
<!-- <el-input v-model="list.num"></el-input> -->
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="抽奖类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="稀有度名称" prop="rarityName">
<el-col :span="11">
<el-select v-model="list.rarityName" placeholder="请选择">
<el-option
v-for="item in rarityNameList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="稀有度名称" prop="rarityName">
<el-col :span="11">
<el-input v-model="list.rarityName"></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="第一种奖励资源编号" prop="firstAwardCode">
<el-col :span="11">
<el-input v-model="list.firstAwardCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="第一种奖励资源数量" prop="firstAwardNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.firstAwardNum"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="第二种奖励资源编号" prop="secondAwardCode">
<el-col :span="11">
<el-input v-model="list.secondAwardCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="第二种奖励资源数量" prop="secondAwardNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.secondAwardNum"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="家具图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${4}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogUrl" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="词性" prop="wordClass">
<el-col :span="11">
<el-input v-model="list.wordClass"></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getAchievementInfoById,
updateByPrimaryKeySelectiveAchievement
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "achievementDetail",
data() {
return {
id: "",
list: {},
typeList: [
{
value: 1,
label: "普通抽奖"
},
{
value: 2,
label: "高级抽奖"
}
],
rarityNameList: [
{
value: 1,
label: "常见级"
},
{
value: 2,
label: "稀有级"
},
{
value: 3,
label: "史诗级"
},
{
value: 4,
label: "传说级"
},
{
value: 5,
label: "特殊怪物"
}
],
allLotteryList: "",
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
requirement: [{ required: true, message: "必填", trigger: "blur" }],
num: [{ required: true, message: "必填", trigger: "blur" }],
firstAwardCode: [{ required: true, message: "必填", trigger: "blur" }],
firstAwardNum: [{ required: true, message: "必填", trigger: "blur" }],
secondAwardCode: [{ required: true, message: "必填", trigger: "blur" }],
secondAwardNum: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }]
},
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getAchievementInfoById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
this.fileList.push({ url: this.list.medalUrl });
// this.list.probability = this.list.probability * 100;
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
// submitForm(formName) {
// this.$refs[formName].validate(valid => {
// if (valid &&
// this.fileList.length > 0 ) {
// for (const key in this.list) {
// if (this.list[key].length == 0) {
// this.list[key] = undefined;
// }
// }
// this.$confirm("是否确认提交?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning"
// }).then(() => {
// updateByPrimaryKeySelectiveAchievement(this.list).then(res => {
// this.$message({
// type: "success",
// message: "提交成功!"
// });
// });
// });
// } else {
// console.log("error submit!!");
// return false;
// }
// });
// },
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid && this.fileList.length) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveFurniture(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
let arr = this.fileList.filter(item => {
return item.url !== file.url;
});
this.fileList = arr;
console.log(this.fileList, "this.fileList");
},
handlePreview(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.fileList.shift();
this.fileList.push(arr);
// console.log(this.fileList, "this.fileList");
this.list.Url = res.data.url;
console.log(res);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>achievement</h1> -->
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<!-- <el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button class="btn-add" @click="handleAddProduct" size="mini">
添加
</el-button>
</el-card> -->
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="100">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="中文名" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.nameCn }}
</div>
</template>
</el-table-column>
<el-table-column label="获得条件" align="center">
<template slot-scope="scope">{{ scope.row.requirement }}</template>
</el-table-column>
<el-table-column label="条件次数" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column>
<!-- <el-table-column label="勋章类型" align="center">
<template slot-scope="scope">{{
scope.row.type == 1
? "引导"
: scope.row.type == 2
? "打卡"
: scope.row.type == 3
? "训练"
: scope.row.type == 4
? "收藏"
: ""
}}</template>
</el-table-column> -->
<el-table-column label="勋章图片" align="center">
<template slot-scope="scope">
<img class="medalUrl" :src="scope.row.medalUrl" alt="" />
</template>
</el-table-column>
<el-table-column label="第一种奖励资源编号" align="center">
<template slot-scope="scope">{{ scope.row.firstAwardCode }}</template>
</el-table-column>
<el-table-column label="第一种奖励资源数量" align="center">
<template slot-scope="scope">{{ scope.row.firstAwardNum }}</template>
</el-table-column>
<el-table-column label="第二种奖励资源编号" align="center">
<template slot-scope="scope">{{
scope.row.secondAwardCode
}}</template>
</el-table-column>
<el-table-column label="第二种奖励资源数量" align="center">
<template slot-scope="scope">{{ scope.row.secondAwardNum }}</template>
</el-table-column>
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
<!-- <el-button
@click="handleWordDelete(scope.row.id)"
size="mini"
type="danger"
>删除</el-button
> -->
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import {
getPageFurnitureInfoAchievement
// deleteByPrimaryKeyRootAffix
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageFurnitureInfoAchievement(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/achievement/achievementDetail",
query: {
id: id
}
});
// console.log(123);
},
handleWordDelete(id) {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteByPrimaryKeyRootAffix(id).then(res => {
this.$message({
type: "success",
message: "删除成功!"
});
this.getData();
});
});
},
handleAddProduct() {
// 添加
this.$router.push({ path: "/affixRoot/affixRootAdd" });
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
.medalUrl {
width: 100rem;
object-fit: contain;
}
</style>
<template>
<div class="container">
<!-- <h1>advertiseNum</h1> -->
<el-form
:model="list"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="广告次数限制" prop="resourceCode">
<el-col :span="15">
<!-- <el-input v-model="list.advertiseNum"></el-input> -->
<el-slider v-model="list.advertiseNum" show-input> </el-slider>
</el-col>
</el-form-item>
<!-- <el-form-item label="任务名称(英文名)" prop="nameEn">
<el-col :span="11">
<el-input v-model="list.nameEn"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="任务内容说明" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="奖励资源数量" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="奖励资源数量" prop="rewardNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.rewardNum"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getAdvertiseNumById,
updateByPrimaryKeySelectiveAdvertiseNum
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "advertiseNumDetail",
data() {
return {
id: "",
list: {},
typeList: [
{
value: 1,
label: "新手引导任务"
},
{
value: 2,
label: "每日任务"
}
]
};
},
methods: {
getData() {
getAdvertiseNumById().then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
// console.log(key, "---", this.list[key]);
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveAdvertiseNum(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<h1>advertiseNum</h1>
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="100">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="任务名称" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.name }}
</div>
</template>
</el-table-column>
<el-table-column label="任务名称(英文名)" align="center">
<template slot-scope="scope">{{ scope.row.nameEn }}</template>
</el-table-column>
<el-table-column label="任务内容说明" align="center">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column>
<!-- <el-table-column label="任务类型" align="center">
<template slot-scope="scope">{{
scope.row.type == 1
? "新手引导任务"
: scope.row.type == 2
? "每日任务"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> -->
<el-table-column label="目标数" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column>
<el-table-column label="资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column>
<el-table-column label="奖励资源数量" align="center">
<template slot-scope="scope">{{ scope.row.rewardNum }}</template>
</el-table-column>
<!-- <el-table-column label="美式发音" align="center">
<template slot-scope="scope">{{ scope.row.usPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { getPageBaseWordMission } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageBaseWordMission(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/missionInfo/missionInfoDetail",
query: {
id: id
}
});
// console.log(123);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="词根词缀" prop="affix">
<el-col :span="11">
<el-input v-model="list.affix"></el-input>
</el-col>
</el-form-item>
<el-form-item label="释义" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="词性" prop="wordClass">
<el-col :span="11">
<el-input v-model="list.wordClass"></el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import { getRootAffixById, insertSelectiveRootAffix } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "affixRootAdd",
data() {
return {
id: "",
list: {},
typeList: [
{
value: 1,
label: "前缀"
},
{
value: 2,
label: "词根"
}
],
rules: {
affix: [{ required: true, message: "必填", trigger: "blur" }],
intro: [{ required: true, message: "必填", trigger: "blur" }],
sort: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }]
}
};
},
methods: {
getData() {
getRootAffixById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
insertSelectiveRootAffix(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
console.log("error submit!!");
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
// this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="词根词缀" prop="affix">
<el-col :span="11">
<el-input disabled v-model="list.affix"></el-input>
</el-col>
</el-form-item>
<el-form-item label="释义" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="词性" prop="wordClass">
<el-col :span="11">
<el-input v-model="list.wordClass"></el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getRootAffixById,
updateByPrimaryKeySelectiveRootAffix
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "wordGradeDetail",
data() {
return {
id: "",
list: {},
typeList: [
{
value: 1,
label: "前缀"
},
{
value: 2,
label: "词根"
}
],
rules: {
affix: [{ required: true, message: "必填", trigger: "blur" }],
intro: [{ required: true, message: "必填", trigger: "blur" }],
sort: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }]
}
};
},
methods: {
getData() {
getRootAffixById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveRootAffix(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
console.log("error submit!!");
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
@submit.native.prevent
>
<el-form-item label="词根词缀:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
@keyup.enter.native="handleSearchList()"
></el-input>
</el-form-item>
<el-radio-group v-model="searchValue">
<el-radio-button label="1">精准搜索</el-radio-button>
<el-radio-button label="0">模糊匹配</el-radio-button>
</el-radio-group>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button class="btn-add" @click="handleAddProduct" size="mini">
添加
</el-button>
<!-- <el-button class="btn-add" @click="handleStuDetail()" size="mini">
stuDetail
</el-button> -->
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="100">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="词根词缀" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.affix }}
</div>
</template>
</el-table-column>
<el-table-column label="释义" align="center">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">{{
scope.row.type == 1 ? "前缀" : scope.row.type == 2 ? "词根" : ""
}}</template>
</el-table-column>
<el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column>
<el-table-column label="词性" align="center">
<template slot-scope="scope">{{ scope.row.wordClass }}</template>
</el-table-column>
<!-- <el-table-column label="美式发音" align="center">
<template slot-scope="scope">{{ scope.row.usPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
<el-button
@click="handleWordDelete(scope.row.id)"
size="mini"
type="danger"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import {
getPageRootAffix,
deleteByPrimaryKeyRootAffix
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null,
searchValue: 1,
};
},
methods: {
getData() {
getPageRootAffix(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
// edit(id) {
// console.log(id, "edit");
// },
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.listQuery.match = this.searchValue
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/affixRoot/affixRootDetail",
query: {
id: id
}
});
// console.log(123);
},
handleWordDelete(id) {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteByPrimaryKeyRootAffix(id).then(res => {
this.$message({
type: "success",
message: "删除成功!"
});
this.getData();
});
});
},
handleAddProduct() {
// 添加
this.$router.push({ path: "/affixRoot/affixRootAdd" });
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-form
:model="friendOne"
:rules="rules"
ref="friendDetailForm"
label-width="160px"
class="demo-ruleForm"
>
<!-- <el-form-item label="id" prop="id">
<el-col :span="11">
<el-input v-model="friendOne.id" ></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="code" prop="code">
<el-col :span="11">
<el-input v-model="friendOne.code" ></el-input>
</el-col>
</el-form-item>
<el-form-item label="职业" prop="profession">
<el-col :span="11">
<el-input v-model="friendOne.profession" type="textarea" autosize></el-input>
</el-col>
</el-form-item>
<el-form-item label="性格" prop="character">
<el-col :span="11">
<el-input v-model="friendOne.character" type="textarea" autosize></el-input>
</el-col>
</el-form-item>
<el-form-item label="人设" prop="definition">
<el-col :span="16">
<el-input v-model="friendOne.definition" type="textarea" autosize></el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('friendDetailForm')"
>提交</el-button
>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getFurnitureInfoById,
updateByPrimaryKeySelectiveFurniture,
updateFriends
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "furnitureInfoDetail",
data() {
return {
id: "",
list: {},
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
nameEn: [{ required: true, message: "必填", trigger: "blur" }],
engName: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
des: [{ required: true, message: "必填", trigger: "blur" }],
},
friendOne:{
// id: "",
profession:"",
character:"",
definition:"",
code:""
},
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: [],
dialogVisibleFrame: false,
dialogUrlFrame: "",
fileListFrame: [],
dialogVisiblePut: false,
dialogUrlPut: "",
fileListPut: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
submitForm(formName) {
this.$refs[formName].validate(
valid => {
if (
// valid &&
// this.fileList.length > 0 &&
// this.fileListFrame &&
// this.fileListPut
1
) {
// for (const key in this.list) {
// if (this.list[key].length == 0) {
// this.list[key] = undefined;
// }
// }
// this.list.picUrlList = [];
// this.fileList.forEach(item => {
// this.list.picUrlList.push(item.url);
// });
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateFriends(this.friendOne).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
let arr = this.fileList.filter(item => {
return item.url !== file.url;
});
this.fileList = arr;
console.log(this.fileList, "this.fileList");
},
handlePreview(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.fileList.push(arr);
// this.fileList.push(res.data.url);
// console.log(this.fileList, "this.fileList");
// this.list.picUrlList = this.fileList;
console.log(res);
},
// ---------------------------
handleRemoveFrame(file, fileListFrame) {
let arr = this.fileListFrame.filter(item => {
return item.url !== file.url;
});
this.fileListFrame = arr;
console.log(this.fileListFrame, "this.fileListFrame");
},
handlePreviewFrame(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccessFrame(res, file, fileListFrame) {
let arr = {};
arr.url = res.data.url;
this.fileListFrame.shift();
this.fileListFrame.push(arr);
// console.log(this.fileListFrame, "this.fileListFrame");
this.list.frameUrl = res.data.url;
console.log(res);
},
// ---------------------------
handleRemovePut(file, fileListPut) {
let arr = this.fileListPut.filter(item => {
return item.url !== file.url;
});
this.fileListPut = arr;
console.log(this.fileListPut, "this.fileListPut");
},
handlePreviewPut(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccessPut(res, file, fileListPut) {
let arr = {};
arr.url = res.data.url;
this.fileListPut.shift();
this.fileListPut.push(arr);
// this.fileListPut[0] = arr;
// console.log(this.fileListPut, "this.fileListPut");
this.list.putUrl = res.data.url;
console.log(res);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.friendOne.id = this.$route.query.id;
this.friendOne.profession = this.$route.query.profession;
this.friendOne.character = this.$route.query.character;
this.friendOne.definition = this.$route.query.definition;
this.friendOne.code = this.$route.query.code;
console.log(this.$route.query,'friendonlist');
// this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>furnitureInfoDetail</h1> -->
<!-- <el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
@submit.native.prevent
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
@keyup.enter.native="handleSearchList()"
></el-input>
</el-form-item>
</el-form>
</div>
</el-card> -->
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button class="btn-add" @click="handleAddProduct" size="mini">
添加
</el-button>
<!-- <el-button class="btn-add" @click="handleStuDetail()" size="mini">
stuDetail
</el-button> -->
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="friendList"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="60">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="id" align="center" width="120">
<template slot-scope="scope">{{ scope.row.id }}</template>
</el-table-column>
<el-table-column label="code" align="center" width="120">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id,scope.row.profession,scope.row.character,scope.row.definition,scope.row.code)"
>
{{ scope.row.code }}
</div>
</template>
</el-table-column>
<el-table-column label="职业" align="center" width="240">
<template slot-scope="scope">{{ scope.row.profession }}</template>
</el-table-column>
<el-table-column label="性格" align="center" width="240">
<template slot-scope="scope">{{ scope.row.character }}</template>
</el-table-column>
<el-table-column label="人设" align="center" >
<template slot-scope="scope">{{ scope.row.definition }}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id,scope.row.profession,scope.row.character,scope.row.definition,scope.row.code )" type="mini"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { getPageFurnitureInfo ,getFriendsList} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
friendList:[],
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getList() {
getFriendsList(this.listQuery).then(res => {
this.friendList = res.data.list
console.log(this.friendList,'friendList');
// this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = Number(res.data.pageNum);
this.pageSize = Number(res.data.pageSize);
this.total = Number(res.data.total);
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getList();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getList();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getList();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getList();
},
handleWordDetail(id,profession,character,definition,code) {
this.$router.push({
name: "friendsDetail",
query: {
code:code,
definition:definition,
character:character,
profession:profession,
id: id,
}
});
// console.log(123);
},
handleAddProduct() {
// 添加
this.$router.push({ path: "/friends/friendsDetail" });
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
// this.getData();
this.getList()
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
.picBox {
display: flex;
justify-content: center;
align-items: center;
.pic {
width: 100rem;
object-fit: contain;
}
}
</style>
<template>
<div>
<el-form
:model="oneMailList"
ref="oneMailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="" prop="">
<el-button @click="handleAdd" size="mini">添加句子</el-button>
</el-form-item>
<el-form-item
v-for="(item, index) in mailAwards "
:key="index"
:label="'奖励' + (index + 1)"
class="item"
>
<el-col :span="11">
<el-input v-model="item.oneTalkCn" placeholder="中文"></el-input>
</el-col>
<el-col class="line" :span="1">-</el-col>
<el-col :span="8">
<el-input v-model="item.oneTalkEn" placeholder="英文"></el-input>
</el-col>
<el-button
@click="handleDel(index)"
type="danger"
size="mini"
icon="el-icon-delete"
circle
></el-button>
</el-form-item>
<el-form-item label="" prop="">
<el-col :span="16">
<el-input v-model="oneMailList.mailContentAwards" type="textarea" autosize=""></el-input>
</el-col>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'oneTalk',
data(){
return{
mailAwards:[],
oneMailList:{},
}
},
methods: {
handleAdd() {
this.mailAwards.push({
oneTalkCn: "",
oneTalkEn: ""
});
console.log(this.mailAwards,'----');
this.oneMailList.mailContentAwards = JSON.stringify(this.mailAwards)
},
handleDel(index) {
this.mailAwards.splice(index, 1);
// this.oneMailList.mailContentAwards.splice(index, 1);
},
},
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<div >
<el-card class="select" title="伙伴选择">
<div slot="header" class="clearfix">
<span>伙伴选择</span>
<!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button> -->
</div>
<el-form
:inline="true"
:data="friendSelected"
ref="friendForm"
label-width="160px"
class="demo-form-inline"
>
<!-- <el-form-item label="id" prop="id">
<el-col :span="11">
<el-input v-model="friendOne.id" ></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="伙伴一">
<el-select v-model="friendSelected.codeOne" placeholder="请选择伙伴">
<el-option
v-for="item in friOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="伙伴二">
<el-select v-model="friendSelected.codeTwo" placeholder="请选择伙伴">
<el-option
v-for="item in friOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="生成次数">
<el-input v-model="friendSelected.genNum"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" style="margin-left:50px" @click="makeTalk()"
>提交</el-button
>
</el-form-item>
</el-form>
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="talkList"
style="width: 100%"
border
>
<el-table-column label="是否保存" align="center" width="40">
<!-- <template slot-scope="scope">{{ scope.$index + 1 }}</template> -->
<template slot-scope="scope" >
<span v-if="scope.row.dialoguesId"></span>
<span v-else></span>
<!-- {{ scope.row.dialoguesId }} -->
</template>
</el-table-column>
<el-table-column label="codeOne" align="center" width="80">
<template slot-scope="scope">{{ scope.row.codeOne}}</template>
</el-table-column>
<el-table-column label="codeTwo" align="center" width="80">
<template slot-scope="scope">{{ scope.row.codeTwo}}</template>
</el-table-column>
<el-table-column label="中英文标题" align="center" width="120">
<template slot-scope="scope">
<p>{{ scope.row.zhDialogueTitle}} </p>
<p>{{ scope.row.enDialogueTitle}}</p>
</template>
</el-table-column>
<!-- <el-table-column label="英文标题" align="center" width="120">
<template slot-scope="scope">{{ scope.row.enDialogueTitle}}</template>
</el-table-column> -->
<el-table-column label="中文原始对话" align="center">
<template slot-scope="scope">{{ scope.row.zhDialogueOrig}}</template>
</el-table-column>
<el-table-column label="中文最终对话" align="center">
<template slot-scope="scope">{{ scope.row.zhDialogueLast}}</template>
</el-table-column>
<!--
<el-table-column label="英文原始对话" align="center" >
<template slot-scope="scope">{{ scope.row.enDialogueOrig}}</template>
</el-table-column> -->
<el-table-column label="英文最终对话" align="center" >
<template slot-scope="scope">{{ scope.row.enDialogueLast}}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id,scope.row.zhDialogueTitle,scope.row.enDialogueTitle,scope.row.zhDialogueLast,scope.row.enDialogueLast)" type="primary" size="mini"
>修改</el-button
>
<el-button @click="handleChangeDetail(scope.row.id)" type="primary" size="mini"
>转换</el-button
>
<el-button @click="handleSaveDetail(scope.row.id)" type="success" size="mini"
>保存</el-button
>
<el-button @click="handleDelete(scope.row.id)" type="danger" size="mini"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
<!-- 修改框 -->
<el-dialog
title="提示"
:visible.sync="dialogVisible"
width="60%"
:before-close="handleClose">
<el-form :model="editTalk" label-width="100px" ref="updateTalkForm">
<el-form-item label="id" prop="id" >
<el-input v-model="editTalk.id" disabled></el-input>
</el-form-item>
<el-form-item label="中文标题" prop="zhDialogueTitle" >
<el-input v-model="editTalk.zhDialogueTitle" ></el-input>
</el-form-item>
<el-form-item label="英文标题" prop="enDialogueTitle" >
<el-input v-model="editTalk.enDialogueTitle" ></el-input>
</el-form-item>
<el-form-item label="中文最终对话" prop="zhDialogueLast">
<el-input type="textarea" autosize v-model="editTalk.zhDialogueLast"></el-input>
</el-form-item>
<el-form-item label="英文最终对话" prop="enDialogueLast">
<el-input type="textarea" autosize v-model="editTalk.enDialogueLast"></el-input>
</el-form-item>
<el-form-item>
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="updateTalk('updateTalkForm')">提交修改</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import {
firstDialogue,getfirstDialogue,updateDialogue,deleteDialogue,getFinDialogue,saveDialogue
} from "@/api/pandaWords";
const defaultListQuery = {
pageNum: 1,
pageSize: 5
};
export default {
name: "talkpro",
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
friendSelected: {
codeOne: "",
codeTwo:"",
genNum:1
},
talkList:[],
editTalk:{
id:1,
zhDialogueTitle:'',
enDialogueTitle:'',
zhDialogueLast:'',
enDialogueLast:''
},
content:"",
friendSelected:{},
changeArr:[],
dialogVisible :false,
updateTalkForm:{},
listLoading: true,
pageSize: null,
pageNum: null,
total: null,
friOptions:[
{
value: 'PE00001',
label: '小Po仔'
},
{
value: 'PE00002',
label: '瑞蕤'
},
{
value: 'PE00003',
label: '奈奈'
},
{
value: 'PE00004',
label: '卡库'
},
{
value: 'PE00005',
label: '小墨'
},
{
value: 'PE00006',
label: '优优'
},
{
value: 'PE00007',
label: '懒懒'
},
{
value: 'PE00008',
label: '思诺'
},
{
value: 'PE00009',
label: '墩墩'
},
{
value: 'PE00047',
label: '熊宝宝'
},
{
value: 'PE00048',
label: '哒咩'
},
{
value: 'PE00049',
label: '战斗基'
},
{
value: 'PE00060',
label: '格鲁布'
},
{
value: 'PE00030',
label: '巴特勒'
},
{
value: 'PE00071',
label: '璐美'
},
{
value: 'PE00072',
label: '拉纳'
},
{
value: 'PE00073',
label: '西娅'
},
{
value: 'PE00074',
label: '威尔斯'
}, {
value: 'PE00075',
label: '桑普森'
},
{
value: 'PE00014',
label: '小芙'
},
{
value: 'PE00015',
label: '努努'
},
{
value: 'PE00016',
label: '椰青'
},
{
value: 'PE00017',
label: '七月'
}, {
value: 'PE00018',
label: '咔米'
},
{
value: 'PE00019',
label: '小茶'
},
{
value: 'PE00040',
label: '小Molly'
}, {
value: 'PE00041',
label: '更更'
},
{
value: 'PE00042',
label: '小谣'
},
{
value: 'PE00043',
label: '阿祈'
},
{
value: 'PE00044',
label: '里佩'
},
{
value: 'PE00050',
label: '易爱'
},
{
value: 'PE00076',
label: '妮亚'
},
{
value: 'PE00077',
label: '荷莉'
},
{
value: 'PE00078',
label: '伊娃'
},
{
value: 'PE00079',
label: '妮娜'
},
{
value: 'PE00022',
label: '莉莉'
},
{
value: 'PE00023',
label: '夏洛特'
},
{
value: 'PE00024',
label: '木木'
},
{
value: 'PE00025',
label: '霹雳'
},
{
value: 'PE00045',
label: '兜兜'
},
{
value: 'PE00051',
label: '艺霏'
},
{
value: 'PE00029',
label: '福尔摩探'
},
{
value: 'PE00052',
label: '麦芽'
},
{
value: 'PE00053',
label: '迦安'
},
{
value: 'PE00038',
label: '梅林'
},
{
value: 'PE00046',
label: '悠美'
},
{
value: 'PE00055',
label: '赛勒斯'
},
{
value: 'PE00011',
label: '莎莎'
},
{
value: 'PE00013',
label: '彤歌'
},
{
value: 'PE00100',
label: '彼得'
},
]
}
},
methods: {
makeTalk() {
// firstDialogue(this.friendSelected).then(res => {
// });
// this.checkTalk();
// this.$forceUpdate();
this.$confirm("是否确认生成?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
firstDialogue(this.friendSelected).then(res => {
this.$message({
type: "success",
message: "成功!"
});
this.checkTalk()
});
});
},
checkTalk(){
getfirstDialogue(this.listQuery).then(res => {
// console.log(res,'talk');
this.talkList = res.data.list
this.pageSize = res.data.pageSize
this.pageNum = res.data.pageNum
this.total = res.data.total
this.totalPage = res.data.totalPage
});
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.checkTalk();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.checkTalk();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.checkTalk();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.checkTalk();
},
//修改对话
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
},
handleWordDetail(id,zhDialogueTitle,enDialogueTitle,zhDialogueLast,enDialogueLast){
this.dialogVisible = true
this.editTalk.id = id
this.editTalk.zhDialogueTitle = zhDialogueTitle
this.editTalk.enDialogueTitle = enDialogueTitle
this.editTalk.zhDialogueLast =zhDialogueLast
this.editTalk.enDialogueLast =enDialogueLast
},
updateTalk(updateTalkForm){
// this.$refs[updateTalkForm].validate((valid) => {
// if (valid) {
// updateDialogue(this.editTalk).then(res => {
// });
// } else {
// console.log('error submit!!');
// return false;
// }
// });
// this.dialogVisible = false
// this.checkTalk()
this.$confirm("是否确认提修改?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateDialogue(this.editTalk).then(res => {
this.$message({
type: "success",
message: "修改成功!"
});
this.dialogVisible = false
this.checkTalk()
});
});
},
//转换格式
handleChangeDetail(id){
this.$confirm("是否确认提交转换?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
getFinDialogue({ids:id}).then(res => {
this.$message({
type: "success",
message: "转换成功!"
});
this.checkTalk()
});
});
},
//保存对话
handleSaveDetail(id){
this.$confirm("是否确认保存?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
saveDialogue({ids:id,seq:1}).then(res => {
this.$message({
type: "success",
message: "保存成功!"
});
this.checkTalk()
});
});
},
//删除对话
handleDelete(id){
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteDialogue({id:id}).then(res => {
this.$message({
type: "success",
message: "删除成功!"
});
this.checkTalk()
});
});
}
},
mounted() {
this.checkTalk()
}
}
</script>
<style lang = "scss" scoped>
.select{
margin: 10px;
/* border: 2px solid #9bcfe1; */
.friendSelect{
margin: 40px;
font-size: 20px;
}
}
.product{
margin: 10px;
p{
margin: 40px;
font-size: 20px;
}
}
.talkEn{
width: 800px;
}
.table-container{
margin: 10px;
}
</style>
\ No newline at end of file
<template>
<div class="container">
<!-- <h1>furnitureInfoAdd</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.nameCn" ></el-input>
</el-col>
</el-form-item>
<el-form-item label="英文名称" prop="nameEn">
<el-col :span="11">
<el-input v-model="list.nameEn"></el-input>
</el-col>
</el-form-item>
<el-form-item label="显示名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.engName"></el-input>
</el-col>
</el-form-item>
<el-form-item label="家具代码" prop="code">
<el-col :span="11">
<el-input v-model="list.code"></el-input>
</el-col>
</el-form-item>
<el-form-item label="描述" prop="des">
<el-col :span="11">
<el-input type="textarea" v-model="list.des"></el-input>
</el-col>
</el-form-item>
<el-form-item label="排序" prop="sorted">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sorted"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.type"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="场景中默认解锁" prop="unlockDefault">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.unlockDefault"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="容量" prop="vol">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.vol"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="状态" prop="state">
<el-col :span="11">
<el-select v-model="list.state" placeholder="请选择">
<el-option
v-for="item in stateList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<el-form-item label="是否广告购买" prop="isAdvertiseBuy">
<el-col :span="11">
<el-select v-model="list.isAdvertiseBuy" placeholder="请选择">
<el-option
v-for="item in isAdvertiseBuyList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item label="是否会员家具" prop="isMemberLocked">
<el-col :span="11">
<el-select v-model="list.isMemberLocked" placeholder="请选择">
<el-option
v-for="item in isMemberLockedList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item label="能否移动" prop="isMove">
<el-col :span="11">
<el-select v-model="list.isMove" placeholder="请选择">
<el-option
v-for="item in isMoveList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<!-- <el-form-item label="家具图片(可多张)" prop="picUrlList">
<el-col :span="11">
<div v-for="(item, index) in fileList" :key="index">
<img :src="item.url" alt="" />
</div>
</el-col>
</el-form-item> -->
<el-form-item label="家具图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${3}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogUrl" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="家具底座图片(1张)" prop="storeUrl">
<el-col :span="11">
<img :src="list.frameUrl" alt="" />
</el-col>
</el-form-item> -->
<el-form-item label="家具底座图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${3}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileListFrame"
:on-preview="handlePreviewFrame"
:on-remove="handleRemoveFrame"
:on-success="handleSuccessFrame"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisibleFrame">
<img width="100%" :src="dialogUrlFrame" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="家具摆放图片(1张)" prop="storeUrl">
<el-col :span="11">
<img :src="list.putUrl" alt="" />
</el-col>
</el-form-item> -->
<el-form-item label="家具摆放图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${3}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileListPut"
:on-preview="handlePreviewPut"
:on-remove="handleRemovePut"
:on-success="handleSuccessPut"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisiblePut">
<img width="100%" :src="dialogUrlPut" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="资源数值" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="x坐标" prop="posX">
<el-col :span="11">
<el-input v-model="list.posX"></el-input>
</el-col>
</el-form-item>
<el-form-item label="y坐标" prop="posY">
<el-col :span="11">
<el-input v-model="list.posY"></el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getFurnitureInfoById,
insertSelectiveFurniture
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "furnitureInfoAdd",
data() {
return {
id: "",
list: {},
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
nameEn: [{ required: true, message: "必填", trigger: "blur" }],
engName: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
des: [{ required: true, message: "必填", trigger: "blur" }],
sorted: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
resourceNum: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }],
isAdvertiseBuy: [
{ required: true, message: "必填", trigger: "change" }
],
isMove: [{ required: true, message: "必填", trigger: "change" }]
},
typeList: [
{
value: 1,
label: "新手引导任务"
},
{
value: 2,
label: "每日任务"
}
],
stateList: [
{
value: 0,
label: "已购买"
},
{
value: 1,
label: "未购买"
}
],
isAdvertiseBuyList: [
{
value: 1,
label: "否"
}
],
isMemberLockedList: [
{
value: 1,
label: "是"
},
{
value: 0,
label: "否"
}
],
isMoveList: [
{
value: 0,
label: "能"
},
{
value: 1,
label: "否"
}
],
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: [],
dialogVisibleFrame: false,
dialogUrlFrame: "",
fileListFrame: [],
dialogVisiblePut: false,
dialogUrlPut: "",
fileListPut: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getFurnitureInfoById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (
valid &&
this.fileList.length > 0 &&
this.fileListFrame &&
this.fileListPut
) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.list.picUrlList = [];
this.fileList.forEach(item => {
this.list.picUrlList.push(item.url);
});
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
insertSelectiveFurniture(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
let arr = this.fileList.filter(item => {
return item.url !== file.url;
});
this.fileList = arr;
console.log(this.fileList, "this.fileList");
},
handlePreview(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.fileList.push(arr);
// this.fileList.push(res.data.url);
// console.log(this.fileList, "this.fileList");
// this.list.picUrlList = this.fileList;
console.log(res);
},
// ---------------------------
handleRemoveFrame(file, fileListFrame) {
let arr = this.fileListFrame.filter(item => {
return item.url !== file.url;
});
this.fileListFrame = arr;
console.log(this.fileListFrame, "this.fileListFrame");
},
handlePreviewFrame(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccessFrame(res, file, fileListFrame) {
let arr = {};
arr.url = res.data.url;
this.fileListFrame.shift();
this.fileListFrame.push(arr);
// console.log(this.fileListFrame, "this.fileListFrame");
this.list.frameUrl = res.data.url;
console.log(res);
},
// ---------------------------
handleRemovePut(file, fileListPut) {
let arr = this.fileListPut.filter(item => {
return item.url !== file.url;
});
this.fileListPut = arr;
console.log(this.fileListPut, "this.fileListPut");
},
handlePreviewPut(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccessPut(res, file, fileListPut) {
let arr = {};
arr.url = res.data.url;
this.fileListPut.shift();
this.fileListPut.push(arr);
// this.fileListPut[0] = arr;
// console.log(this.fileListPut, "this.fileListPut");
this.list.putUrl = res.data.url;
console.log(res);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
// this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.nameCn"></el-input>
</el-col>
</el-form-item>
<el-form-item label="任务名称(英文名)" prop="nameEn">
<el-col :span="11">
<el-input v-model="list.nameEn"></el-input>
</el-col>
</el-form-item>
<el-form-item label="显示名称" prop="engName">
<el-col :span="11">
<el-input v-model="list.engName"></el-input>
</el-col>
</el-form-item>
<el-form-item label="家具代码" prop="code">
<el-col :span="11">
<el-input v-model="list.code"></el-input>
</el-col>
</el-form-item>
<el-form-item label="描述" prop="des">
<el-col :span="11">
<el-input type="textarea" v-model="list.des"></el-input>
</el-col>
</el-form-item>
<el-form-item label="排序" prop="sorted">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sorted"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-col :span="11">
<!-- <el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.type"
></el-input> -->
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<!-- <el-form-item label="场景中默认解锁" prop="unlockDefault">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.unlockDefault"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="容量" prop="vol">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.vol"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="状态" prop="state">
<el-col :span="11">
<el-select v-model="list.state" placeholder="请选择">
<el-option
v-for="item in stateList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<el-form-item label="是否广告购买" prop="isAdvertiseBuy">
<el-col :span="11">
<el-select disabled v-model="list.isAdvertiseBuy" placeholder="请选择">
<el-option
v-for="item in isAdvertiseBuyList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item label="能否移动" prop="isMove">
<el-col :span="11">
<el-select v-model="list.isMove" placeholder="请选择">
<el-option
v-for="item in isMoveList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<!-- <el-form-item label="家具图片(可多张)" prop="picUrlList">
<el-col :span="11">
<div v-for="(item, index) in fileList" :key="index">
<img :src="item.url" alt="" />
</div>
</el-col>
</el-form-item> -->
<el-form-item label="家具图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${3}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogUrl" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="家具底座图片(1张)" prop="storeUrl">
<el-col :span="11">
<img :src="list.frameUrl" alt="" />
</el-col>
</el-form-item> -->
<el-form-item label="家具底座图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${3}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileListFrame"
:on-preview="handlePreviewFrame"
:on-remove="handleRemoveFrame"
:on-success="handleSuccessFrame"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisibleFrame">
<img width="100%" :src="dialogUrlFrame" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="家具摆放图片(1张)" prop="storeUrl">
<el-col :span="11">
<img :src="list.putUrl" alt="" />
</el-col>
</el-form-item> -->
<el-form-item label="家具摆放图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${3}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileListPut"
:on-preview="handlePreviewPut"
:on-remove="handleRemovePut"
:on-success="handleSuccessPut"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisiblePut">
<img width="100%" :src="dialogUrlPut" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="资源数值" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="x坐标" prop="posX">
<el-col :span="11">
<el-input v-model="list.posX"></el-input>
</el-col>
</el-form-item>
<el-form-item label="y坐标" prop="posY">
<el-col :span="11">
<el-input v-model="list.posY"></el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getFurnitureInfoById,
updateByPrimaryKeySelectiveFurniture
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "furnitureInfoDetail",
data() {
return {
id: "",
list: {},
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
nameEn: [{ required: true, message: "必填", trigger: "blur" }],
engName: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
des: [{ required: true, message: "必填", trigger: "blur" }],
sorted: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
resourceNum: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }],
isAdvertiseBuy: [
{ required: true, message: "必填", trigger: "change" }
],
isMove: [{ required: true, message: "必填", trigger: "change" }]
},
typeList: [
{
value: 200,
label: "200"
},
{
value: 201,
label: "201"
},
{
value: 202,
label: "202"
},
{
value: 204,
label: "204"
},
{
value: 205,
label: "205"
}
],
stateList: [
{
value: 0,
label: "已购买"
},
{
value: 1,
label: "未购买"
}
],
isAdvertiseBuyList: [
{
value: 0,
label: "是"
},
{
value: 1,
label: "否"
}
],
isMoveList: [
{
value: 0,
label: "能"
},
{
value: 1,
label: "否"
}
],
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: [],
dialogVisibleFrame: false,
dialogUrlFrame: "",
fileListFrame: [],
dialogVisiblePut: false,
dialogUrlPut: "",
fileListPut: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getFurnitureInfoById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.fileList = this.list.picUrlList;
this.list.picUrlList.forEach(item => {
let arr = {};
arr.url = item;
this.fileList.push(arr);
});
this.fileListFrame.push({ url: this.list.frameUrl });
this.fileListPut.push({ url: this.list.putUrl });
// this.fileListFrame = this.list.frameUrl;
// console.log(this.fileList);
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (
valid &&
this.fileList.length > 0 &&
this.fileListFrame &&
this.fileListPut
) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.list.picUrlList = [];
this.fileList.forEach(item => {
this.list.picUrlList.push(item.url);
});
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveFurniture(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
let arr = this.fileList.filter(item => {
return item.url !== file.url;
});
this.fileList = arr;
console.log(this.fileList, "this.fileList");
},
handlePreview(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.fileList.push(arr);
// this.fileList.push(res.data.url);
// console.log(this.fileList, "this.fileList");
// this.list.picUrlList = this.fileList;
console.log(res);
},
// ---------------------------
handleRemoveFrame(file, fileListFrame) {
let arr = this.fileListFrame.filter(item => {
return item.url !== file.url;
});
this.fileListFrame = arr;
console.log(this.fileListFrame, "this.fileListFrame");
},
handlePreviewFrame(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccessFrame(res, file, fileListFrame) {
let arr = {};
arr.url = res.data.url;
this.fileListFrame.shift();
this.fileListFrame.push(arr);
// console.log(this.fileListFrame, "this.fileListFrame");
this.list.frameUrl = res.data.url;
console.log(res);
},
// ---------------------------
handleRemovePut(file, fileListPut) {
let arr = this.fileListPut.filter(item => {
return item.url !== file.url;
});
this.fileListPut = arr;
console.log(this.fileListPut, "this.fileListPut");
},
handlePreviewPut(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccessPut(res, file, fileListPut) {
let arr = {};
arr.url = res.data.url;
this.fileListPut.shift();
this.fileListPut.push(arr);
// this.fileListPut[0] = arr;
// console.log(this.fileListPut, "this.fileListPut");
this.list.putUrl = res.data.url;
console.log(res);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>furnitureInfoDetail</h1> -->
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
@submit.native.prevent
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
@keyup.enter.native="handleSearchList()"
></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button class="btn-add" @click="handleAddProduct" size="mini">
添加
</el-button>
<!-- <el-button class="btn-add" @click="handleStuDetail()" size="mini">
stuDetail
</el-button> -->
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="60">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="名称" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.nameCn }}
</div>
</template>
</el-table-column>
<el-table-column label="名称(英文名)" align="center">
<template slot-scope="scope">{{ scope.row.nameEn }}</template>
</el-table-column>
<el-table-column label="显示名称" align="center">
<template slot-scope="scope">{{ scope.row.engName }}</template>
</el-table-column>
<!-- <el-table-column label="家具数量" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column> -->
<el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sorted }}</template>
</el-table-column>
<el-table-column label="描述" align="center">
<template slot-scope="scope">{{ scope.row.des }}</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">{{ scope.row.type }}</template>
</el-table-column>
<el-table-column label="场景中默认解锁" align="center">
<template slot-scope="scope">{{ scope.row.unlockDefault }}</template>
</el-table-column>
<!-- <el-table-column label="容量" align="center">
<template slot-scope="scope">{{ scope.row.vol }}</template>
</el-table-column> -->
<el-table-column label="图片" align="center">
<template slot-scope="scope">
<div
class="picBox"
v-for="(item, index) in scope.row.picUrlList"
:key="index"
>
<!-- <img class="pic" :src="item" alt="" /> -->
<el-image
style="width: 100rem; height: 100rem"
:src="item"
:preview-src-list="scope.row.picUrlList"
>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column label="家具底座图片" align="center">
<template slot-scope="scope">
<div class="picBox">
<el-image
style="width: 100rem; height: 100rem"
:src="scope.row.frameUrl"
>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column label="家具摆放图片" align="center">
<template slot-scope="scope">
<div class="picBox">
<el-image
style="width: 100rem; height: 100rem"
:src="scope.row.putUrl"
>
</el-image>
</div>
</template>
</el-table-column>
<!-- <el-table-column label="是否摆放" align="center">
<template slot-scope="scope">{{
scope.row.placeState == 0
? "已摆放"
: scope.row.placeState == 1
? "未摆放"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">{{
scope.row.state == 0
? "已购买"
: scope.row.state == 1
? "未购买"
: ""
}}</template>
</el-table-column> -->
<el-table-column label="是否广告购买" align="center">
<template slot-scope="scope">{{
scope.row.isAdvertiseBuy == 0
? "是"
: scope.row.isAdvertiseBuy == 1
? "否"
: ""
}}</template>
</el-table-column>
<el-table-column label="能否移动" align="center">
<template slot-scope="scope">{{
scope.row.isMove == 0 ? "能" : scope.row.isMove == 1 ? "否" : ""
}}</template>
</el-table-column>
<!-- <el-table-column label="目标数" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column> -->
<el-table-column label="资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column>
<el-table-column label="资源数值" align="center">
<template slot-scope="scope">{{ scope.row.resourceNum }}</template>
</el-table-column>
<el-table-column label="x坐标" align="center">
<template slot-scope="scope">{{ scope.row.posX }}</template>
</el-table-column>
<el-table-column label="y坐标" align="center">
<template slot-scope="scope">{{ scope.row.posY }}</template>
</el-table-column>
<!-- <el-table-column label="美式发音" align="center">
<template slot-scope="scope">{{ scope.row.usPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { getPageFurnitureInfo } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageFurnitureInfo(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/furnitureInfo/furnitureInfoDetail",
query: {
id: id
}
});
// console.log(123);
},
handleAddProduct() {
// 添加
this.$router.push({ path: "/furnitureInfo/furnitureInfoAdd" });
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
.picBox {
display: flex;
justify-content: center;
align-items: center;
.pic {
width: 100rem;
object-fit: contain;
}
}
</style>
<template> <template>
<div class="container"> <div class="container">
<h1>欢迎来到熊猫单词宝后台管理系统</h1> <h1>xxx,您好</h1>
<img src="@/assets/images/pandaxia.png" alt=""> <!-- <img src="@/assets/images/pandaxia.png" alt=""> -->
</div> </div>
</template> </template>
......
<template>
<div class="container">
<!-- <h1>missionInfoDetail</h1> -->
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="100">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="任务名称" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.name }}
</div>
</template>
</el-table-column>
<el-table-column label="任务名称(英文名)" align="center">
<template slot-scope="scope">{{ scope.row.nameEn }}</template>
</el-table-column>
<el-table-column label="任务内容说明" align="center">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column>
<!-- <el-table-column label="任务类型" align="center">
<template slot-scope="scope">{{
scope.row.type == 1
? "新手引导任务"
: scope.row.type == 2
? "每日任务"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> -->
<el-table-column label="目标数" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column>
<el-table-column label="资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column>
<el-table-column label="奖励资源数量" align="center">
<template slot-scope="scope">{{ scope.row.rewardNum }}</template>
</el-table-column>
<!-- <el-table-column label="美式发音" align="center">
<template slot-scope="scope">{{ scope.row.usPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { getPageBaseWordMission } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageBaseWordMission(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/missionInfo/missionInfoDetail",
query: {
id: id
}
});
// console.log(123);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>inviteAward</h1> -->
<el-form
:model="list"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="奖励资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="任务名称(英文名)" prop="nameEn">
<el-col :span="11">
<el-input v-model="list.nameEn"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="任务内容说明" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="奖励资源数量" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="奖励资源数量" prop="rewardNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.rewardNum"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getInviteAwardById,
updateByPrimaryKeySelectiveInviteAward
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "inviteAwardDetail",
data() {
return {
id: "",
list: {},
typeList: [
{
value: 1,
label: "新手引导任务"
},
{
value: 2,
label: "每日任务"
}
]
};
},
methods: {
getData() {
getInviteAwardById().then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
// console.log(key, "---", this.list[key]);
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveInviteAward(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>lottery</h1> -->
<!-- <el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
></el-input>
</el-form-item>
</el-form>
</div>
</el-card> -->
<!-- <el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button class="btn-add" @click="handleAddProduct" size="mini">
添加
</el-button>
</el-card> -->
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="100">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="中奖概率" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.probability }}
</div>
</template>
</el-table-column>
<el-table-column label="宠物的稀有度分类id" align="center">
<template slot-scope="scope">{{ scope.row.dragonRarityId }}</template>
</el-table-column>
<el-table-column label="抽奖类型" align="center">
<template slot-scope="scope">{{
scope.row.type == 1
? "普通抽奖"
: scope.row.type == 2
? "高级抽奖"
: ""
}}</template>
</el-table-column>
<el-table-column label="稀有度名称" align="center">
<template slot-scope="scope">{{ scope.row.rarityName }}</template>
</el-table-column>
<el-table-column label="所需资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column>
<el-table-column label="所需资源数量" align="center">
<template slot-scope="scope">{{ scope.row.resourceNum }}</template>
</el-table-column>
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
<!-- <el-button
@click="handleWordDelete(scope.row.id)"
size="mini"
type="danger"
>删除</el-button
> -->
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import {
getPageFurnitureInfoLottery,
deleteByPrimaryKeyRootAffix
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageFurnitureInfoLottery(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/lottery/lotteryDetail",
query: {
id: id
}
});
// console.log(123);
},
handleWordDelete(id) {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteByPrimaryKeyRootAffix(id).then(res => {
this.$message({
type: "success",
message: "删除成功!"
});
this.getData();
});
});
},
handleAddProduct() {
// 添加
this.$router.push({ path: "/affixRoot/affixRootAdd" });
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>lotteryDetail</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="中奖概率" prop="probability">
<el-col :span="11">
<el-slider
v-model="list.probability"
show-input
:max="1"
:step="0.01"
></el-slider>
</el-col>
</el-form-item>
<el-form-item label="宠物的稀有度分类id" prop="dragonRarityId">
<el-col :span="11">
<!-- <el-input v-model="list.dragonRarityId"></el-input> -->
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.dragonRarityId"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="抽奖类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item label="稀有度名称" prop="rarityName">
<el-col :span="11">
<el-select v-model="list.rarityName" placeholder="请选择">
<el-option
v-for="item in rarityNameList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<!-- <el-form-item label="稀有度名称" prop="rarityName">
<el-col :span="11">
<el-input v-model="list.rarityName"></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="所需资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="所需资源数量" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="词性" prop="wordClass">
<el-col :span="11">
<el-input v-model="list.wordClass"></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getLotteryById,
updateByPrimaryKeySelectiveLottery,
allLottery
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "lotteryDetail",
data() {
return {
id: "",
list: {},
typeList: [
{
value: 1,
label: "普通抽奖"
},
{
value: 2,
label: "高级抽奖"
}
],
rarityNameList: [
{
value: 1,
label: "常见级"
},
{
value: 2,
label: "稀有级"
},
{
value: 3,
label: "史诗级"
},
{
value: 4,
label: "传说级"
},
{
value: 5,
label: "特殊怪物"
}
],
allLotteryList: "",
rules: {
probability: [{ required: true, message: "必填", trigger: "blur" }],
dragonRarityId: [{ required: true, message: "必填", trigger: "blur" }],
rarityName: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
resourceNum: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }]
}
};
},
methods: {
getData() {
getLotteryById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.list.probability = this.list.probability * 100;
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
allLottery().then(res => {
console.log(res);
// this.list = JSON.parse(JSON.stringify(res.data));
// this.list.probability = this.list.probability * 100;
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveLottery(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
console.log("error submit!!");
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div>
<el-card>
<el-button type="primary" style="float:right;margin-bottom:10px" @click="newmail()">新建邮件</el-button>
</el-card>
<div class="tableMain">
<el-table
ref="productTable"
:data="tableData"
style="width: 100%"
border
>
<el-table-column label="序号" align="center" width="60">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="id" align="center" width="100">
<template slot-scope="scope">{{ scope.row.id}}</template>
</el-table-column>
<el-table-column label="邮件类型" align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.mailType == 1">通知</span>
<span v-else>奖励</span>
</template>
</el-table-column>
<el-table-column label="邮件标题" align="center">
<template slot-scope="scope">{{ scope.row.mailTitle}}</template>
</el-table-column>
<!-- <el-table-column label="邮件接收类型" align="center">
<template slot-scope="scope">{{ scope.row.receiverType}}</template>
</el-table-column> -->
<el-table-column label="邮件封面图" align="center" >
<template slot-scope="scope">
<img :src="scope.row.mailCover" alt="" style="width: 100rem; height: 100rem">
</template>
</el-table-column>
<el-table-column label="触发时间" align="center" >
<template slot-scope="scope">{{ scope.row.triggerTime }}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<!-- <el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button> -->
<el-button @click="mailDelete(scope.row.id)" type="mini"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import {
getMailList,deleteMail
} from "@/api/pandaWords";
const defaultListQuery = {
pageNum: 1,
pageSize: 5
};
export default {
name: "maillist",
data() {
return {
tableData: [],
listQuery: Object.assign({}, defaultListQuery),
listLoading: true,
pageSize: null,
pageNum: null,
total: null,
}
},
methods:{
getData(){
getMailList(this.listQuery).then(res => {
// console.log(res,'List');
this.tableData = res.data.list
// this.listLoading = false;
});
},
mailDelete(id){
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteMail({id:id}).then(res => {
this.$message({
type: "success",
message: "删除成功!"
});
this.getData();
});
});
},
//页面跳转
newmail() {
this.$router.push({
path: "/mail/newMail",
});
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
},
mounted(){
this.getData()
}
}
</script>
<style lang="scss" scoped>
.tableMain{
width: 95%;
padding: 10px;
}
</style>
\ No newline at end of file
<template>
<div class="container">
<!-- <h1>furnitureInfoAdd</h1> -->
<el-form
:model="oneMailList"
ref="oneMailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="邮件标题" prop="mailTitle">
<el-col :span="11">
<el-input v-model="oneMailList.mailTitle" ></el-input>
</el-col>
</el-form-item>
<el-form-item label="邮件类型" prop="mailType">
<el-col :span="11">
<el-select v-model="oneMailList.mailType" placeholder="请选择">
<!-- <el-option
v-for="item in mailTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option> -->
<el-option label="通知" :value="1"></el-option>
<el-option label="礼物" :value="2"></el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item label="邮件封面图" v-if="oneMailList.mailType == 1">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${5}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="oneMailList.mailCover" alt="" />
</el-dialog>
</el-form-item>
<el-form-item label="邮箱详情图片" v-if="oneMailList.mailType == 1" >
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${5}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileListFrame"
:on-preview="handlePreviewFrame"
:on-remove="handleRemoveFrame"
:on-success="handleSuccessFrame"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisibleFrame">
<img width="100%" :src="oneMailList.mailContentImg" alt="" />
</el-dialog>
</el-form-item>
<el-form-item label="邮件详情内容" prop="mailContentText">
<el-col :span="16">
<el-input v-model="oneMailList.mailContentText" type="textarea" autosize=""></el-input>
</el-col>
</el-form-item>
<el-form-item label="发件人" prop="mailSender">
<el-col :span="11">
<el-input v-model="oneMailList.mailSender" ></el-input>
</el-col>
</el-form-item>
<el-form-item label="邮件接收类型" prop="receiverType">
<el-col :span="11">
<el-select v-model="oneMailList.receiverType" placeholder="请选择">
<el-option
v-for="item in receiverTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item label="指定收件人邀请码" prop="mailSender" v-if="oneMailList.receiverType == 2">
<el-col :span="11">
<el-input v-model="oneMailList.inviteCode" ></el-input>
</el-col>
</el-form-item>
<el-form-item label="" prop="" >
<el-button @click="handleAdd" size="mini" v-if="oneMailList.mailType == 2">添加奖励</el-button>
</el-form-item>
<el-form-item
v-for="(item, index) in mailAwards "
:key="index"
:label="'奖励' + (index + 1)"
class="item"
>
<el-col :span="11">
<el-input v-model="item.resourceCode" placeholder="奖励资源编号"></el-input>
</el-col>
<el-col class="line" :span="1">-</el-col>
<el-col :span="8">
<el-input v-model="item.resourceNum" placeholder="奖励资源数量"></el-input>
</el-col>
<el-button
@click="handleDel(index)"
type="danger"
size="mini"
icon="el-icon-delete"
circle
></el-button>
</el-form-item>
<el-form-item label="预计发布时间" required style="width:600px">
<el-col :span="11">
<el-date-picker
v-model="oneMailList.triggerTime"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('oneMailForm')">提交</el-button>
<!-- <el-button type="primary" @click="testmail()">提交</el-button> -->
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getFurnitureInfoById,
insertSelectiveFurniture,
updateMail
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
// const triggerTime = date1 + date2
export default {
name: "furnitureInfoAdd",
data() {
return {
id: "",
list: {},
oneMailList:{
mailTitle:'',
mailType:1,
mailContentText:'',
receiverType:1,
// mailCover:'',
// mailContentImg:'',
// mailSender:'',
// triggerTime: '',
// mailContentAwards:''
},
mailAwards:[],
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
nameEn: [{ required: true, message: "必填", trigger: "blur" }],
engName: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
des: [{ required: true, message: "必填", trigger: "blur" }],
sorted: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
resourceNum: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }],
isAdvertiseBuy: [
{ required: true, message: "必填", trigger: "change" }
],
isMove: [{ required: true, message: "必填", trigger: "change" }]
},
mailTypeOptions: [
{
label: 2,
value: "礼物"
},
{
value: 1,
label: "通知"
}
],
receiverTypeOptions: [
{
value: 1,
label: "全体用户"
},
// {
// value: 2,
// label: "会员用户"
// },
{
value: 2,
label: "指定用户"
},
],
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: [],
dialogVisibleFrame: false,
dialogUrlFrame: "",
fileListFrame: [],
dialogVisiblePut: false,
dialogUrlPut: "",
fileListPut: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
testmail(){
console.log(this.oneMailList,'okkk');
},
getData() {
getFurnitureInfoById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.oneMailList.mailContentAwards = JSON.stringify(this.mailAwards)
console.log(this.oneMailList,'=======');
this.$refs[formName].validate(valid => {
if (valid ) {
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateMail(this.oneMailList).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
// let arr = this.fileList.filter(item => {
// return item.url !== file.url;
// });
// this.fileList = arr;
// console.log(this.fileList, "this.fileList");
this.oneMailList.mailCover = ''
},
handlePreview(file) {
this.oneMailList.mailCover = file.url;
console.log(this.oneMailList.mailCover,'this.oneMailList.mailCover');
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
this.oneMailList.mailCover = res.data.url;
},
// ---------------------------
handleRemoveFrame(file, fileListFrame) {
this.oneMailList.mailContentImg = ''
},
handlePreviewFrame(file) {
this.oneMailList.mailContentImg = file.url;
this.dialogVisible = true;
},
handleSuccessFrame(res, file, fileListFrame) {
this.oneMailList.mailContentImg = res.data.url;
},
// ---------------------------
handleRemovePut(file, fileListPut) {
let arr = this.fileListPut.filter(item => {
return item.url !== file.url;
});
this.fileListPut = arr;
console.log(this.fileListPut, "this.fileListPut");
},
handlePreviewPut(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccessPut(res, file, fileListPut) {
let arr = {};
arr.url = res.data.url;
this.fileListPut.shift();
this.fileListPut.push(arr);
// this.fileListPut[0] = arr;
// console.log(this.fileListPut, "this.fileListPut");
this.list.putUrl = res.data.url;
console.log(res);
},
//添加奖励
handleAdd() {
this.mailAwards.push({
resourceCode: "",
resourceNum: ""
});
console.log(this.mailAwards,'----');
// this.oneMailList.mailContentAwards = JSON.stringify(this.mailAwards)
},
handleDel(index) {
this.mailAwards.splice(index, 1);
// this.oneMailList.mailContentAwards.splice(index, 1);
},
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
// this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>missionInfoDetail</h1> -->
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
@submit.native.prevent
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
@keyup.enter.native="handleSearchList()"
></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="100">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="任务名称" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.name }}
</div>
</template>
</el-table-column>
<el-table-column label="任务名称(英文名)" align="center">
<template slot-scope="scope">{{ scope.row.nameEn }}</template>
</el-table-column>
<el-table-column label="任务内容说明" align="center">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column>
<!-- <el-table-column label="任务类型" align="center">
<template slot-scope="scope">{{
scope.row.type == 1
? "新手引导任务"
: scope.row.type == 2
? "每日任务"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> -->
<!-- <el-table-column label="目标数" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column> -->
<el-table-column label="资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column>
<el-table-column label="奖励资源数量" align="center">
<template slot-scope="scope">{{ scope.row.rewardNum }}</template>
</el-table-column>
<!-- <el-table-column label="美式发音" align="center">
<template slot-scope="scope">{{ scope.row.usPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { getPageBaseWordMission } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageBaseWordMission(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/missionInfo/missionInfoDetail",
query: {
id: id
}
});
// console.log(123);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="任务名称" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item>
<el-form-item label="任务名称(英文名)" prop="nameEn">
<el-col :span="11">
<el-input v-model="list.nameEn"></el-input>
</el-col>
</el-form-item>
<el-form-item label="任务内容说明" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="奖励资源数量" prop="rewardNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.rewardNum"
></el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getBaseWordByIdMission,
updateByPrimaryKeySelectiveMission
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "missionInfoDetail",
data() {
return {
id: "",
list: {},
typeList: [
{
value: 1,
label: "新手引导任务"
},
{
value: 2,
label: "每日任务"
}
],
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
// nameEn: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
rewardNum: [{ required: true, message: "必填", trigger: "blur" }]
// type: [{ required: true, message: "必填", trigger: "change" }]
}
};
},
methods: {
getData() {
getBaseWordByIdMission(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveMission(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
console.log("error submit!!");
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="detail-container">
<el-card shadow="never">
<span class="font-title-medium">退货商品</span>
<el-table
border
class="standard-margin"
ref="productTable"
:data="productList">
<el-table-column label="商品图片" width="160" align="center">
<template slot-scope="scope">
<img style="height:80px" :src="scope.row.productPic">
</template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">
<span class="font-small">{{scope.row.productName}}</span><br>
<span class="font-small">品牌:{{scope.row.productBrand}}</span>
</template>
</el-table-column>
<el-table-column label="价格/货号" width="180" align="center">
<template slot-scope="scope">
<span class="font-small">价格:¥{{scope.row.productRealPrice}}</span><br>
<span class="font-small">货号:NO.{{scope.row.productId}}</span>
</template>
</el-table-column>
<el-table-column label="属性" width="180" align="center">
<template slot-scope="scope">{{scope.row.productAttr}}</template>
</el-table-column>
<el-table-column label="数量" width="100" align="center">
<template slot-scope="scope">{{scope.row.productCount}}</template>
</el-table-column>
<el-table-column label="小计" width="100" align="center">
<template slot-scope="scope">{{totalAmount}}</template>
</el-table-column>
</el-table>
<div style="float:right;margin-top:15px;margin-bottom:15px">
<span class="font-title-medium">合计:</span>
<span class="font-title-medium color-danger">¥{{totalAmount}}</span>
</div>
</el-card>
<el-card shadow="never" class="standard-margin">
<span class="font-title-medium">服务单信息</span>
<div class="form-container-border">
<el-row>
<el-col :span="6" class="form-border form-left-bg font-small">服务单号</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.id}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">申请状态</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.status | formatStatus}}</el-col>
</el-row>
<el-row>
<el-col :span="6" class="form-border form-left-bg font-small" style="height:50px;line-height:30px">订单编号
</el-col>
<el-col class="form-border font-small" :span="18" style="height:50px">
{{orderReturnApply.orderSn}}
<el-button type="text" size="small" @click="handleViewOrder">查看</el-button>
</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">申请时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.createTime | formatTime}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">用户账号</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.memberUsername}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">联系人</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.returnName}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">联系电话</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.returnPhone}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">退货原因</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.reason}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">问题描述</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.description}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:100px;line-height:80px">凭证图片
</el-col>
<el-col class="form-border font-small" :span="18" style="height:100px">
<img v-for="item in proofPics" style="width:80px;height:80px" :src="item">
</el-col>
</el-row>
</div>
<div class="form-container-border">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">订单金额</el-col>
<el-col class="form-border font-small" :span="18">¥{{totalAmount}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">确认退款金额
</el-col>
<el-col class="form-border font-small" style="height:52px" :span="18">
<el-input size="small" v-model="updateStatusParam.returnAmount"
:disabled="orderReturnApply.status!==0"
style="width:200px;margin-left: 10px"></el-input>
</el-col>
</el-row>
<div v-show="orderReturnApply.status!==3">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">选择收货点
</el-col>
<el-col class="form-border font-small" style="height:52px" :span="18">
<el-select size="small"
style="width:200px"
:disabled="orderReturnApply.status!==0"
v-model="updateStatusParam.companyAddressId">
<el-option v-for="address in companyAddressList"
:key="address.id"
:value="address.id"
:label="address.addressName">
</el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">收货人姓名</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.name}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">所在区域</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress | formatRegion}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">详细地址</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.detailAddress}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">联系电话</el-col>
<el-col class="form-border font-small" :span="18">{{currentAddress.phone}}</el-col>
</el-row>
</div>
</div>
<div class="form-container-border" v-show="orderReturnApply.status!==0">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">处理人员</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleMan}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">处理时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleTime | formatTime}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">处理备注</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.handleNote}}</el-col>
</el-row>
</div>
<div class="form-container-border" v-show="orderReturnApply.status===2">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">收货人员</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveMan}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" >收货时间</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveTime | formatTime}}</el-col>
</el-row>
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6">收货备注</el-col>
<el-col class="form-border font-small" :span="18">{{orderReturnApply.receiveNote}}</el-col>
</el-row>
</div>
<div class="form-container-border" v-show="orderReturnApply.status===0">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">处理备注</el-col>
<el-col class="form-border font-small" :span="18">
<el-input size="small" v-model="updateStatusParam.handleNote" style="width:200px;margin-left: 10px"></el-input>
</el-col>
</el-row>
</div>
<div class="form-container-border" v-show="orderReturnApply.status===1">
<el-row>
<el-col class="form-border form-left-bg font-small" :span="6" style="height:52px;line-height:32px">收货备注</el-col>
<el-col class="form-border font-small" :span="18">
<el-input size="small" v-model="updateStatusParam.receiveNote" style="width:200px;margin-left: 10px"></el-input>
</el-col>
</el-row>
</div>
<div style="margin-top:15px;text-align: center" v-show="orderReturnApply.status===0">
<el-button type="primary" size="small" @click="handleUpdateStatus(1)">确认退货</el-button>
<el-button type="danger" size="small" @click="handleUpdateStatus(3)">拒绝退货</el-button>
</div>
<div style="margin-top:15px;text-align: center" v-show="orderReturnApply.status===1">
<el-button type="primary" size="small" @click="handleUpdateStatus(2)">确认收货</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {getApplyDetail,updateApplyStatus} from '@/api/returnApply';
import {fetchList} from '@/api/companyAddress';
import {formatDate} from '@/utils/date';
const defaultUpdateStatusParam = {
companyAddressId: null,
handleMan: 'admin',
handleNote: null,
receiveMan: 'admin',
receiveNote: null,
returnAmount: 0,
status: 0
};
const defaultOrderReturnApply = {
id: null,
orderId: null,
companyAddressId: null,
productId: null,
orderSn: null,
createTime: null,
memberUsername: null,
returnAmount: null,
returnName: null,
returnPhone: null,
status: null,
handleTime: null,
productPic: null,
productName: null,
productBrand: null,
productAttr: null,
productCount: null,
productPrice: null,
productRealPrice: null,
reason: null,
description: null,
proofPics: null,
handleNote: null,
handleMan: null,
receiveMan: null,
receiveTime: null,
receiveNote: null
};
export default {
name: 'returnApplyDetail',
data() {
return {
id: null,
orderReturnApply: Object.assign({},defaultOrderReturnApply),
productList: null,
proofPics: null,
updateStatusParam: Object.assign({}, defaultUpdateStatusParam),
companyAddressList: null
}
},
created() {
this.id = this.$route.query.id;
this.getDetail();
},
computed: {
totalAmount() {
if (this.orderReturnApply != null) {
return this.orderReturnApply.productRealPrice * this.orderReturnApply.productCount;
} else {
return 0;
}
},
currentAddress() {
console.log("currentAddress()");
let id = this.updateStatusParam.companyAddressId;
if(this.companyAddressList==null)return {};
for (let i = 0; i < this.companyAddressList.length; i++) {
let address = this.companyAddressList[i];
if (address.id === id) {
return address;
}
}
return null;
}
},
filters: {
formatStatus(status) {
if (status === 0) {
return "待处理";
} else if (status === 1) {
return "退货中";
} else if (status === 2) {
return "已完成";
} else {
return "已拒绝";
}
},
formatTime(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatRegion(address) {
let str = address.province;
if (address.city != null) {
str += " " + address.city;
}
str += " " + address.region;
return str;
}
},
methods: {
handleViewOrder(){
this.$router.push({path:'/oms/orderDetail',query:{id:this.orderReturnApply.orderId}});
},
getDetail() {
getApplyDetail(this.id).then(response => {
console.log("getDetail")
this.orderReturnApply = response.data;
this.productList = [];
this.productList.push(this.orderReturnApply);
if (this.orderReturnApply.proofPics != null) {
this.proofPics = this.orderReturnApply.proofPics.split(",")
}
//退货中和完成
if(this.orderReturnApply.status===1||this.orderReturnApply.status===2){
this.updateStatusParam.returnAmount=this.orderReturnApply.returnAmount;
this.updateStatusParam.companyAddressId=this.orderReturnApply.companyAddressId;
}
this.getCompanyAddressList();
});
},
getCompanyAddressList() {
fetchList().then(response => {
console.log("getCompanyAddressList()")
this.companyAddressList = response.data;
for (let i = 0; i < this.companyAddressList.length; i++) {
if (this.companyAddressList[i].receiveStatus === 1&&this.orderReturnApply.status===0) {
this.updateStatusParam.companyAddressId = this.companyAddressList[i].id;
}
}
});
},
handleUpdateStatus(status){
this.updateStatusParam.status=status;
this.$confirm('是否要进行此操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateApplyStatus(this.id,this.updateStatusParam).then(response=>{
this.$message({
type: 'success',
message: '操作成功!',
duration:1000
});
this.$router.back();
});
});
}
}
}
</script>
<style scoped>
.detail-container {
position: absolute;
left: 0;
right: 0;
width: 1080px;
padding: 35px 35px 15px 35px;
margin: 20px auto;
}
.standard-margin {
margin-top: 15px;
}
.form-border {
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
}
.form-container-border {
border-left: 1px solid #DCDFE6;
border-top: 1px solid #DCDFE6;
margin-top: 15px;
}
.form-left-bg {
background: #F2F6FC;
}
</style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input v-model="listQuery.id" class="input-width" placeholder="服务单号"></el-input>
</el-form-item>
<el-form-item label="处理状态:">
<el-select v-model="listQuery.status" placeholder="全部" clearable class="input-width">
<el-option v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="申请时间:">
<el-date-picker
class="input-width"
v-model="listQuery.createTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="操作人员:">
<el-input v-model="listQuery.handleMan" class="input-width" placeholder="全部"></el-input>
</el-form-item>
<el-form-item label="处理时间:">
<el-date-picker
class="input-width"
v-model="listQuery.handleTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
</el-card>
<div class="table-container">
<el-table ref="returnApplyTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="服务单号" width="180" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="申请时间" width="180" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatTime}}</template>
</el-table-column>
<el-table-column label="用户账号" align="center">
<template slot-scope="scope">{{scope.row.memberUsername}}</template>
</el-table-column>
<el-table-column label="退款金额" width="180" align="center">
<template slot-scope="scope">{{scope.row | formatReturnAmount}}</template>
</el-table-column>
<el-table-column label="申请状态" width="180" align="center">
<template slot-scope="scope">{{scope.row.status | formatStatus}}</template>
</el-table-column>
<el-table-column label="处理时间" width="180" align="center">
<template slot-scope="scope">{{scope.row.handleTime | formatTime}}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleViewDetail(scope.$index, scope.row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {formatDate} from '@/utils/date';
import {fetchList,deleteApply} from '@/api/returnApply';
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
id: null,
receiverKeyword: null,
status: null,
createTime: null,
handleMan: null,
handleTime: null
};
const defaultStatusOptions=[
{
label: '待处理',
value: 0
},
{
label: '退货中',
value: 1
},
{
label: '已完成',
value: 2
},
{
label: '已拒绝',
value: 3
}
];
export default {
name:'returnApplyList',
data() {
return {
listQuery:Object.assign({},defaultListQuery),
statusOptions: Object.assign({},defaultStatusOptions),
list:null,
total:null,
listLoading:false,
multipleSelection:[],
operateType:1,
operateOptions: [
{
label: "批量删除",
value: 1
}
],
}
},
created(){
this.getList();
},
filters:{
formatTime(time) {
if(time==null||time===''){
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(status){
for(let i=0;i<defaultStatusOptions.length;i++){
if(status===defaultStatusOptions[i].value){
return defaultStatusOptions[i].label;
}
}
},
formatReturnAmount(row){
return row.productRealPrice*row.productCount;
}
},
methods:{
handleSelectionChange(val){
this.multipleSelection = val;
},
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleViewDetail(index,row){
this.$router.push({path:'/oms/returnApplyDetail',query:{id:row.id}})
},
handleBatchOperate(){
if(this.multipleSelection==null||this.multipleSelection.length<1){
this.$message({
message: '请选择要操作的申请',
type: 'warning',
duration: 1000
});
return;
}
if(this.operateType===1){
//批量删除
this.$confirm('是否要进行删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = new URLSearchParams();
let ids=[];
for(let i=0;i<this.multipleSelection.length;i++){
ids.push(this.multipleSelection[i].id);
}
params.append("ids",ids);
deleteApply(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
}
},
handleSizeChange(val){
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val){
this.listQuery.pageNum = val;
this.getList();
},
getList(){
this.listLoading=true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
}
}
}
</script>
<style scoped>
.input-width {
width: 203px;
}
</style>
<template> 
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
size="mini"
@click="handleAdd"
class="btn-add">添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="returnReasonTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="80" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="原因类型" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort }}</template>
</el-table-column>
<el-table-column label="是否可用" align="center">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
@change="handleStatusChange(scope.$index,scope.row)"
:active-value="1"
:inactive-value="0">
</el-switch>
</template>
</el-table-column>
<el-table-column label="添加时间" width="180" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="160" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑</el-button>
<el-button
size="mini"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
<el-dialog
title="添加退货原因"
:visible.sync="dialogVisible" width="30%">
<el-form :model="returnReason"
ref="reasonForm" label-width="150px">
<el-form-item label="原因类型:">
<el-input v-model="returnReason.name" class="input-width"></el-input>
</el-form-item>
<el-form-item label="排序:">
<el-input v-model="returnReason.sort" class="input-width"></el-input>
</el-form-item>
<el-form-item label="是否启用:">
<el-switch v-model="returnReason.status" :active-value="1" :inactive-value="0"></el-switch>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleConfirm">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {formatDate} from '@/utils/date';
import {fetchList,deleteReason,updateStatus,addReason,getReasonDetail,updateReason} from '@/api/returnReason';
const defaultListQuery = {
pageNum: 1,
pageSize: 5
};
const defaultReturnReason = {
name:null,
sort:0,
status:1,
createTime:null
};
export default {
name: 'returnReasonList',
data() {
return {
list: null,
total: null,
multipleSelection: [],
listLoading:true,
listQuery:Object.assign({}, defaultListQuery),
operateType:null,
operateOptions: [
{
label: "删除",
value: 1
}
],
dialogVisible:false,
returnReason:Object.assign({},defaultReturnReason),
operateReasonId:null
}
},
created(){
this.getList();
},
filters:{
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
}
},
methods: {
handleAdd() {
this.dialogVisible=true;
this.operateReasonId=null;
this.returnReason=Object.assign({},defaultReturnReason);
},
handleConfirm(){
if(this.operateReasonId==null){
//添加操作
addReason(this.returnReason).then(response=>{
this.dialogVisible=false;
this.operateReasonId=null;
this.$message({
message: '添加成功!',
type: 'success',
duration:1000
});
this.getList();
});
}else{
//编辑操作
updateReason(this.operateReasonId,this.returnReason).then(response=>{
this.dialogVisible=false;
this.operateReasonId=null;
this.$message({
message: '修改成功!',
type: 'success',
duration:1000
});
this.getList();
});
}
},
handleUpdate(index, row){
this.dialogVisible=true;
this.operateReasonId=row.id;
getReasonDetail(row.id).then(response=>{
this.returnReason=response.data;
});
},
handleDelete(index, row){
let ids=[];
ids.push(row.id);
this.deleteReason(ids);
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleStatusChange(index,row){
let ids=[];
ids.push(row.id);
let param = new URLSearchParams();
param.append("status",row.status);
param.append("ids",ids);
updateStatus(param).then(response=>{
this.$message({
message: '状态修改成功',
type: 'success'
});
});
},
handleBatchOperate(){
if(this.multipleSelection==null||this.multipleSelection.length<1){
this.$message({
message: '请选择要操作的条目',
type: 'warning',
duration: 1000
});
return;
}
if(this.operateType===1){
let ids=[];
for(let i=0;i<this.multipleSelection.length;i++){
ids.push(this.multipleSelection[i].id);
}
this.deleteReason(ids);
}
},
handleSizeChange(val){
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val){
this.listQuery.pageNum = val;
this.getList();
},
getList(){
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
},
deleteReason(ids){
this.$confirm('是否要进行该删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = new URLSearchParams();
params.append("ids",ids);
deleteReason(params).then(response=>{
this.$message({
message: '删除成功!',
type: 'success',
duration: 1000
});
this.listQuery.pageNum=1;
this.getList();
});
})
},
}
}
</script>
<style scoped>
.input-width {
width: 80%;
}
</style>
<template> 
<el-dialog title="订单跟踪"
:visible.sync="visible"
:before-close="handleClose"
width="40%">
<el-steps direction="vertical"
:active="6"
finish-status="success"
space="50px">
<el-step v-for="item in logisticsList"
:key="item.name"
:title="item.name"
:description="item.time"></el-step>
</el-steps>
</el-dialog>
</template>
<script>
const defaultLogisticsList=[
{name: '订单已提交,等待付款',time:'2017-04-01 12:00:00 '},
{name: '订单付款成功',time:'2017-04-01 12:00:00 '},
{name: '在北京市进行下级地点扫描,等待付款',time:'2017-04-01 12:00:00 '},
{name: '在分拨中心广东深圳公司进行卸车扫描,等待付款',time:'2017-04-01 12:00:00 '},
{name: '在广东深圳公司进行发出扫描',time:'2017-04-01 12:00:00 '},
{name: '到达目的地网点广东深圳公司,快件将很快进行派送',time:'2017-04-01 12:00:00 '},
{name: '订单已签收,期待再次为您服务',time:'2017-04-01 12:00:00 '}
];
export default {
name:'logisticsDialog',
props: {
value: Boolean
},
computed:{
visible: {
get() {
return this.value;
},
set(visible){
this.value=visible;
}
}
},
data() {
return {
logisticsList:Object.assign({},defaultLogisticsList)
}
},
methods:{
emitInput(val) {
this.$emit('input', val)
},
handleClose(){
this.emitInput(false);
}
}
}
</script>
<style></style>
<template> 
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>发货列表</span>
</el-card>
<div class="table-container">
<el-table ref="deliverOrderTable"
style="width: 100%;"
:data="list" border>
<el-table-column label="订单编号" width="180" align="center">
<template slot-scope="scope">{{scope.row.orderSn}}</template>
</el-table-column>
<el-table-column label="收货人" width="180" align="center">
<template slot-scope="scope">{{scope.row.receiverName}}</template>
</el-table-column>
<el-table-column label="手机号码" width="160" align="center">
<template slot-scope="scope">{{scope.row.receiverPhone}}</template>
</el-table-column>
<el-table-column label="邮政编码" width="160" align="center">
<template slot-scope="scope">{{scope.row.receiverPostCode}}</template>
</el-table-column>
<el-table-column label="收货地址" align="center">
<template slot-scope="scope">{{scope.row.address}}</template>
</el-table-column>
<el-table-column label="配送方式" width="160" align="center">
<template slot-scope="scope">
<el-select placeholder="请选择物流公司"
v-model="scope.row.deliveryCompany"
size="small">
<el-option v-for="item in companyOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="物流单号" width="180" align="center">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.deliverySn"></el-input>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 15px;text-align: center">
<el-button @click="cancel">取消</el-button>
<el-button @click="confirm" type="primary">确定</el-button>
</div>
</div>
</div>
</template>
<script>
import {deliveryOrder} from '@/api/order'
const defaultLogisticsCompanies=["顺丰快递","圆通快递","中通快递","韵达快递"];
export default {
name: 'deliverOrderList',
data() {
return {
list:[],
companyOptions:defaultLogisticsCompanies
}
},
created(){
this.list= this.$route.query.list;
//当list不为数组时转换为数组
if(this.list instanceof Array===false){
this.list=[];
}
},
methods:{
cancel(){
this.$router.back();
},
confirm(){
this.$confirm('是否要进行发货操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deliveryOrder(this.list).then(response=>{
this.$router.back();
this.$message({
type: 'success',
message: '发货成功!'
});
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消发货'
});
});
}
}
}
</script>
<style></style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input v-model="listQuery.orderSn" class="input-width" placeholder="订单编号"></el-input>
</el-form-item>
<el-form-item label="收货人:">
<el-input v-model="listQuery.receiverKeyword" class="input-width" placeholder="收货人姓名/手机号码"></el-input>
</el-form-item>
<el-form-item label="提交时间:">
<el-date-picker
class="input-width"
v-model="listQuery.createTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="订单状态:">
<el-select v-model="listQuery.status" class="input-width" placeholder="全部" clearable>
<el-option v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="订单分类:">
<el-select v-model="listQuery.orderType" class="input-width" placeholder="全部" clearable>
<el-option v-for="item in orderTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="订单来源:">
<el-select v-model="listQuery.sourceType" class="input-width" placeholder="全部" clearable>
<el-option v-for="item in sourceTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
</el-card>
<div class="table-container">
<el-table ref="orderTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="80" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="订单编号" width="180" align="center">
<template slot-scope="scope">{{scope.row.orderSn}}</template>
</el-table-column>
<el-table-column label="提交时间" width="180" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="用户账号" align="center">
<template slot-scope="scope">{{scope.row.memberUsername}}</template>
</el-table-column>
<el-table-column label="订单金额" width="120" align="center">
<template slot-scope="scope">{{scope.row.totalAmount}}</template>
</el-table-column>
<el-table-column label="支付方式" width="120" align="center">
<template slot-scope="scope">{{scope.row.payType | formatPayType}}</template>
</el-table-column>
<el-table-column label="订单来源" width="120" align="center">
<template slot-scope="scope">{{scope.row.sourceType | formatSourceType}}</template>
</el-table-column>
<el-table-column label="订单状态" width="120" align="center">
<template slot-scope="scope">{{scope.row.status | formatStatus}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleViewOrder(scope.$index, scope.row)"
>查看订单</el-button>
<el-button
size="mini"
@click="handleCloseOrder(scope.$index, scope.row)"
v-show="scope.row.status===0">关闭订单</el-button>
<el-button
size="mini"
@click="handleDeliveryOrder(scope.$index, scope.row)"
v-show="scope.row.status===1">订单发货</el-button>
<el-button
size="mini"
@click="handleViewLogistics(scope.$index, scope.row)"
v-show="scope.row.status===2||scope.row.status===3">订单跟踪</el-button>
<el-button
size="mini"
type="danger"
@click="handleDeleteOrder(scope.$index, scope.row)"
v-show="scope.row.status===4">删除订单</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
<el-dialog
title="关闭订单"
:visible.sync="closeOrder.dialogVisible" width="30%">
<span style="vertical-align: top">操作备注:</span>
<el-input
style="width: 80%"
type="textarea"
:rows="5"
placeholder="请输入内容"
v-model="closeOrder.content">
</el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="closeOrder.dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleCloseOrderConfirm">确 定</el-button>
</span>
</el-dialog>
<logistics-dialog v-model="logisticsDialogVisible"></logistics-dialog>
</div>
</template>
<script>
import {fetchList,closeOrder,deleteOrder} from '@/api/order'
import {formatDate} from '@/utils/date';
import LogisticsDialog from '@/views/oms/order/components/logisticsDialog';
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
orderSn: null,
receiverKeyword: null,
status: null,
orderType: null,
sourceType: null,
createTime: null,
};
export default {
name: "orderList",
components:{LogisticsDialog},
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
listLoading: true,
list: null,
total: null,
operateType: null,
multipleSelection: [],
closeOrder:{
dialogVisible:false,
content:null,
orderIds:[]
},
statusOptions: [
{
label: '待付款',
value: 0
},
{
label: '待发货',
value: 1
},
{
label: '已发货',
value: 2
},
{
label: '已完成',
value: 3
},
{
label: '已关闭',
value: 4
}
],
orderTypeOptions: [
{
label: '正常订单',
value: 0
},
{
label: '秒杀订单',
value: 1
}
],
sourceTypeOptions: [
{
label: 'PC订单',
value: 0
},
{
label: 'APP订单',
value: 1
}
],
operateOptions: [
{
label: "批量发货",
value: 1
},
{
label: "关闭订单",
value: 2
},
{
label: "删除订单",
value: 3
}
],
logisticsDialogVisible:false
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatPayType(value) {
if (value === 1) {
return '支付宝';
} else if (value === 2) {
return '微信';
} else {
return '未支付';
}
},
formatSourceType(value) {
if (value === 1) {
return 'APP订单';
} else {
return 'PC订单';
}
},
formatStatus(value) {
if (value === 1) {
return '待发货';
} else if (value === 2) {
return '已发货';
} else if (value === 3) {
return '已完成';
} else if (value === 4) {
return '已关闭';
} else if (value === 5) {
return '无效订单';
} else {
return '待付款';
}
},
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleViewOrder(index, row){
this.$router.push({path:'/oms/orderDetail',query:{id:row.id}})
},
handleCloseOrder(index, row){
this.closeOrder.dialogVisible=true;
this.closeOrder.orderIds=[row.id];
},
handleDeliveryOrder(index, row){
let listItem = this.covertOrder(row);
this.$router.push({path:'/oms/deliverOrderList',query:{list:[listItem]}})
},
handleViewLogistics(index, row){
this.logisticsDialogVisible=true;
},
handleDeleteOrder(index, row){
let ids=[];
ids.push(row.id);
this.deleteOrder(ids);
},
handleBatchOperate(){
if(this.multipleSelection==null||this.multipleSelection.length<1){
this.$message({
message: '请选择要操作的订单',
type: 'warning',
duration: 1000
});
return;
}
if(this.operateType===1){
//批量发货
let list=[];
for(let i=0;i<this.multipleSelection.length;i++){
if(this.multipleSelection[i].status===1){
list.push(this.covertOrder(this.multipleSelection[i]));
}
}
if(list.length===0){
this.$message({
message: '选中订单中没有可以发货的订单',
type: 'warning',
duration: 1000
});
return;
}
this.$router.push({path:'/oms/deliverOrderList',query:{list:list}})
}else if(this.operateType===2){
//关闭订单
this.closeOrder.orderIds=[];
for(let i=0;i<this.multipleSelection.length;i++){
this.closeOrder.orderIds.push(this.multipleSelection[i].id);
}
this.closeOrder.dialogVisible=true;
}else if(this.operateType===3){
//删除订单
let ids=[];
for(let i=0;i<this.multipleSelection.length;i++){
ids.push(this.multipleSelection[i].id);
}
this.deleteOrder(ids);
}
},
handleSizeChange(val){
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val){
this.listQuery.pageNum = val;
this.getList();
},
handleCloseOrderConfirm() {
if (this.closeOrder.content == null || this.closeOrder.content === '') {
this.$message({
message: '操作备注不能为空',
type: 'warning',
duration: 1000
});
return;
}
let params = new URLSearchParams();
params.append('ids', this.closeOrder.orderIds);
params.append('note', this.closeOrder.content);
closeOrder(params).then(response=>{
this.closeOrder.orderIds=[];
this.closeOrder.dialogVisible=false;
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
},
deleteOrder(ids){
this.$confirm('是否要进行该删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = new URLSearchParams();
params.append("ids",ids);
deleteOrder(params).then(response=>{
this.$message({
message: '删除成功!',
type: 'success',
duration: 1000
});
this.getList();
});
})
},
covertOrder(order){
let address=order.receiverProvince+order.receiverCity+order.receiverRegion+order.receiverDetailAddress;
let listItem={
orderId:order.id,
orderSn:order.orderSn,
receiverName:order.receiverName,
receiverPhone:order.receiverPhone,
receiverPostCode:order.receiverPostCode,
address:address,
deliveryCompany:null,
deliverySn:null
};
return listItem;
}
}
}
</script>
<style scoped>
.input-width {
width: 203px;
}
</style>
<template> 
<div class="detail-container">
<div>
<el-steps :active="formatStepStatus(order.status)" finish-status="success" align-center>
<el-step title="提交订单" :description="formatTime(order.createTime)"></el-step>
<el-step title="支付订单" :description="formatTime(order.paymentTime)"></el-step>
<el-step title="平台发货" :description="formatTime(order.deliveryTime)"></el-step>
<el-step title="确认收货" :description="formatTime(order.receiveTime)"></el-step>
<el-step title="完成评价" :description="formatTime(order.commentTime)"></el-step>
</el-steps>
</div>
<el-card shadow="never" style="margin-top: 15px">
<div class="operate-container">
<i class="el-icon-warning color-danger" style="margin-left: 20px"></i>
<span class="color-danger">当前订单状态:{{order.status | formatStatus}}</span>
<div class="operate-button-container" v-show="order.status===0">
<el-button size="mini" @click="showUpdateReceiverDialog">修改收货人信息</el-button>
<el-button size="mini">修改商品信息</el-button>
<el-button size="mini" @click="showUpdateMoneyDialog">修改费用信息</el-button>
<el-button size="mini" @click="showMessageDialog">发送站内信</el-button>
<el-button size="mini" @click="showCloseOrderDialog">关闭订单</el-button>
<el-button size="mini" @click="showMarkOrderDialog">备注订单</el-button>
</div>
<div class="operate-button-container" v-show="order.status===1">
<el-button size="mini" @click="showUpdateReceiverDialog">修改收货人信息</el-button>
<el-button size="mini" @click="showMessageDialog">发送站内信</el-button>
<el-button size="mini">取消订单</el-button>
<el-button size="mini" @click="showMarkOrderDialog">备注订单</el-button>
</div>
<div class="operate-button-container" v-show="order.status===2||order.status===3">
<el-button size="mini" @click="showLogisticsDialog">订单跟踪</el-button>
<el-button size="mini" @click="showMessageDialog">发送站内信</el-button>
<el-button size="mini" @click="showMarkOrderDialog">备注订单</el-button>
</div>
<div class="operate-button-container" v-show="order.status===4">
<el-button size="mini" @click="handleDeleteOrder">删除订单</el-button>
<el-button size="mini" @click="showMarkOrderDialog">备注订单</el-button>
</div>
</div>
<div style="margin-top: 20px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">基本信息</span>
</div>
<div class="table-layout">
<el-row>
<el-col :span="4" class="table-cell-title">订单编号</el-col>
<el-col :span="4" class="table-cell-title">发货单流水号</el-col>
<el-col :span="4" class="table-cell-title">用户账号</el-col>
<el-col :span="4" class="table-cell-title">支付方式</el-col>
<el-col :span="4" class="table-cell-title">订单来源</el-col>
<el-col :span="4" class="table-cell-title">订单类型</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell">{{order.orderSn}}</el-col>
<el-col :span="4" class="table-cell">暂无</el-col>
<el-col :span="4" class="table-cell">{{order.memberUsername}}</el-col>
<el-col :span="4" class="table-cell">{{order.payType | formatPayType}}</el-col>
<el-col :span="4" class="table-cell">{{order.sourceType | formatSourceType}}</el-col>
<el-col :span="4" class="table-cell">{{order.orderType | formatOrderType}}</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell-title">配送方式</el-col>
<el-col :span="4" class="table-cell-title">物流单号</el-col>
<el-col :span="4" class="table-cell-title">自动确认收货时间</el-col>
<el-col :span="4" class="table-cell-title">订单可得优币</el-col>
<el-col :span="4" class="table-cell-title">订单可得成长值</el-col>
<el-col :span="4" class="table-cell-title">活动信息</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell">{{order.deliveryCompany | formatNull}}</el-col>
<el-col :span="4" class="table-cell">{{order.deliverySn | formatNull}}</el-col>
<el-col :span="4" class="table-cell">{{order.autoConfirmDay}}</el-col>
<el-col :span="4" class="table-cell">{{order.integration}}</el-col>
<el-col :span="4" class="table-cell">{{order.growth}}</el-col>
<el-col :span="4" class="table-cell">
<el-popover
placement="top-start"
title="活动信息"
width="200"
trigger="hover"
:content="order.promotionInfo">
<span slot="reference">{{order.promotionInfo | formatLongText}}</span>
</el-popover>
</el-col>
</el-row>
</div>
<div style="margin-top: 20px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">收货人信息</span>
</div>
<div class="table-layout">
<el-row>
<el-col :span="6" class="table-cell-title">收货人</el-col>
<el-col :span="6" class="table-cell-title">手机号码</el-col>
<el-col :span="6" class="table-cell-title">邮政编码</el-col>
<el-col :span="6" class="table-cell-title">收货地址</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">{{order.receiverName}}</el-col>
<el-col :span="6" class="table-cell">{{order.receiverPhone}}</el-col>
<el-col :span="6" class="table-cell">{{order.receiverPostCode}}</el-col>
<el-col :span="6" class="table-cell">{{order | formatAddress}}</el-col>
</el-row>
</div>
<div style="margin-top: 20px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">商品信息</span>
</div>
<el-table
ref="orderItemTable"
:data="order.orderItemList"
style="width: 100%;margin-top: 20px" border>
<el-table-column label="商品图片" width="120" align="center">
<template slot-scope="scope">
<img :src="scope.row.productPic" style="height: 80px">
</template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">
<p>{{scope.row.productName}}</p>
<p>品牌:{{scope.row.productBrand}}</p>
</template>
</el-table-column>
<el-table-column label="价格/货号" width="120" align="center">
<template slot-scope="scope">
<p>价格:¥{{scope.row.productPrice}}</p>
<p>货号:{{scope.row.productSn}}</p>
</template>
</el-table-column>
<el-table-column label="属性" width="120" align="center">
<template slot-scope="scope">
{{scope.row.productAttr | formatProductAttr}}
</template>
</el-table-column>
<el-table-column label="数量" width="120" align="center">
<template slot-scope="scope">
{{scope.row.productQuantity}}
</template>
</el-table-column>
<el-table-column label="小计" width="120" align="center">
<template slot-scope="scope">
{{scope.row.productPrice*scope.row.productQuantity}}
</template>
</el-table-column>
</el-table>
<div style="float: right;margin: 20px">
合计:<span class="color-danger">¥{{order.totalAmount}}</span>
</div>
<div style="margin-top: 60px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">费用信息</span>
</div>
<div class="table-layout">
<el-row>
<el-col :span="6" class="table-cell-title">商品合计</el-col>
<el-col :span="6" class="table-cell-title">运费</el-col>
<el-col :span="6" class="table-cell-title">优惠券</el-col>
<el-col :span="6" class="table-cell-title">积分抵扣</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">¥{{order.totalAmount}}</el-col>
<el-col :span="6" class="table-cell">¥{{order.freightAmount}}</el-col>
<el-col :span="6" class="table-cell">-¥{{order.couponAmount}}</el-col>
<el-col :span="6" class="table-cell">-¥{{order.integrationAmount}}</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell-title">活动优惠</el-col>
<el-col :span="6" class="table-cell-title">折扣金额</el-col>
<el-col :span="6" class="table-cell-title">订单总金额</el-col>
<el-col :span="6" class="table-cell-title">应付款金额</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">-¥{{order.promotionAmount}}</el-col>
<el-col :span="6" class="table-cell">-¥{{order.discountAmount}}</el-col>
<el-col :span="6" class="table-cell">
<span class="color-danger">¥{{order.totalAmount+order.freightAmount}}</span>
</el-col>
<el-col :span="6" class="table-cell">
<span class="color-danger">¥{{order.payAmount+order.freightAmount-order.discountAmount}}</span>
</el-col>
</el-row>
</div>
<div style="margin-top: 20px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">操作信息</span>
</div>
<el-table style="margin-top: 20px;width: 100%"
ref="orderHistoryTable"
:data="order.historyList" border>
<el-table-column label="操作者" width="120" align="center">
<template slot-scope="scope">
{{scope.row.operateMan}}
</template>
</el-table-column>
<el-table-column label="操作时间" width="160" align="center">
<template slot-scope="scope">
{{formatTime(scope.row.createTime)}}
</template>
</el-table-column>
<el-table-column label="订单状态" width="120" align="center">
<template slot-scope="scope">
{{scope.row.orderStatus | formatStatus}}
</template>
</el-table-column>
<el-table-column label="付款状态" width="120" align="center">
<template slot-scope="scope">
{{scope.row.orderStatus | formatPayStatus}}
</template>
</el-table-column>
<el-table-column label="发货状态" width="120" align="center">
<template slot-scope="scope">
{{scope.row.orderStatus | formatDeliverStatus}}
</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">
{{scope.row.note}}
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog title="修改收货人信息"
:visible.sync="receiverDialogVisible"
width="40%">
<el-form :model="receiverInfo"
ref="receiverInfoForm"
label-width="150px">
<el-form-item label="收货人姓名:">
<el-input v-model="receiverInfo.receiverName" style="width: 200px"></el-input>
</el-form-item>
<el-form-item label="手机号码:">
<el-input v-model="receiverInfo.receiverPhone" style="width: 200px">
</el-input>
</el-form-item>
<el-form-item label="邮政编码:">
<el-input v-model="receiverInfo.receiverPostCode" style="width: 200px">
</el-input>
</el-form-item>
<el-form-item label="所在区域:">
<v-distpicker :province="receiverInfo.receiverProvince"
:city="receiverInfo.receiverCity"
:area="receiverInfo.receiverRegion"
@selected="onSelectRegion"></v-distpicker>
</el-form-item>
<el-form-item label="详细地址:">
<el-input v-model="receiverInfo.receiverDetailAddress" type="textarea" rows="3">
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="receiverDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleUpdateReceiverInfo">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="修改费用信息"
:visible.sync="moneyDialogVisible"
width="40%">
<div class="table-layout">
<el-row>
<el-col :span="6" class="table-cell-title">商品合计</el-col>
<el-col :span="6" class="table-cell-title">运费</el-col>
<el-col :span="6" class="table-cell-title">优惠券</el-col>
<el-col :span="6" class="table-cell-title">积分抵扣</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">¥{{order.totalAmount}}</el-col>
<el-col :span="6" class="table-cell">
<el-input v-model.number="moneyInfo.freightAmount" size="mini"><template slot="prepend"></template></el-input>
</el-col>
<el-col :span="6" class="table-cell">-¥{{order.couponAmount}}</el-col>
<el-col :span="6" class="table-cell">-¥{{order.integrationAmount}}</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell-title">活动优惠</el-col>
<el-col :span="6" class="table-cell-title">折扣金额</el-col>
<el-col :span="6" class="table-cell-title">订单总金额</el-col>
<el-col :span="6" class="table-cell-title">应付款金额</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">-¥{{order.promotionAmount}}</el-col>
<el-col :span="6" class="table-cell">
<el-input v-model.number="moneyInfo.discountAmount" size="mini"><template slot="prepend">-¥</template></el-input>
</el-col>
<el-col :span="6" class="table-cell">
<span class="color-danger">¥{{order.totalAmount+moneyInfo.freightAmount}}</span>
</el-col>
<el-col :span="6" class="table-cell">
<span class="color-danger">¥{{order.payAmount+moneyInfo.freightAmount-moneyInfo.discountAmount}}</span>
</el-col>
</el-row>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="moneyDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleUpdateMoneyInfo">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="发送站内信"
:visible.sync="messageDialogVisible"
width="40%">
<el-form :model="message"
ref="receiverInfoForm"
label-width="150px">
<el-form-item label="标题:">
<el-input v-model="message.title" style="width: 200px"></el-input>
</el-form-item>
<el-form-item label="内容:">
<el-input v-model="message.content" type="textarea" rows="3">
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="messageDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleSendMessage">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="关闭订单"
:visible.sync="closeDialogVisible"
width="40%">
<el-form :model="closeInfo"
label-width="150px">
<el-form-item label="操作备注:">
<el-input v-model="closeInfo.note" type="textarea" rows="3">
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleCloseOrder">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="备注订单"
:visible.sync="markOrderDialogVisible"
width="40%">
<el-form :model="markInfo"
label-width="150px">
<el-form-item label="操作备注:">
<el-input v-model="markInfo.note" type="textarea" rows="3">
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="markOrderDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleMarkOrder">确 定</el-button>
</span>
</el-dialog>
<logistics-dialog v-model="logisticsDialogVisible"></logistics-dialog>
</div>
</template>
<script>
import {getOrderDetail,updateReceiverInfo,updateMoneyInfo,closeOrder,updateOrderNote,deleteOrder} from '@/api/order';
import LogisticsDialog from '@/views/oms/order/components/logisticsDialog';
import {formatDate} from '@/utils/date';
import VDistpicker from 'v-distpicker';
const defaultReceiverInfo = {
orderId:null,
receiverName:null,
receiverPhone:null,
receiverPostCode:null,
receiverDetailAddress:null,
receiverProvince:null,
receiverCity:null,
receiverRegion:null,
status:null
};
export default {
name: 'orderDetail',
components: { VDistpicker, LogisticsDialog},
data() {
return {
id: null,
order: {},
receiverDialogVisible:false,
receiverInfo:Object.assign({},defaultReceiverInfo),
moneyDialogVisible:false,
moneyInfo:{orderId:null, freightAmount:0, discountAmount:0,status:null},
messageDialogVisible:false,
message: {title:null, content:null},
closeDialogVisible:false,
closeInfo:{note:null,id:null},
markOrderDialogVisible:false,
markInfo:{note:null},
logisticsDialogVisible:false
}
},
created() {
this.id = this.list = this.$route.query.id;
getOrderDetail(this.id).then(response => {
this.order = response.data;
});
},
filters: {
formatNull(value) {
if(value===undefined||value===null||value===''){
return '暂无';
}else{
return value;
}
},
formatLongText(value) {
if(value===undefined||value===null||value===''){
return '暂无';
}else if(value.length>8){
return value.substr(0, 8) + '...';
}else{
return value;
}
},
formatPayType(value) {
if (value === 1) {
return '支付宝';
} else if (value === 2) {
return '微信';
} else {
return '未支付';
}
},
formatSourceType(value) {
if (value === 1) {
return 'APP订单';
} else {
return 'PC订单';
}
},
formatOrderType(value) {
if (value === 1) {
return '秒杀订单';
} else {
return '正常订单';
}
},
formatAddress(order) {
let str = order.receiverProvince;
if (order.receiverCity != null) {
str += " " + order.receiverCity;
}
str += " " + order.receiverRegion;
str += " " + order.receiverDetailAddress;
return str;
},
formatStatus(value) {
if (value === 1) {
return '待发货';
} else if (value === 2) {
return '已发货';
} else if (value === 3) {
return '已完成';
} else if (value === 4) {
return '已关闭';
} else if (value === 5) {
return '无效订单';
} else {
return '待付款';
}
},
formatPayStatus(value) {
if (value === 0) {
return '未支付';
} else if(value===4){
return '已退款';
}else{
return '已支付';
}
},
formatDeliverStatus(value) {
if (value === 0||value === 1) {
return '未发货';
} else {
return '已发货';
}
},
formatProductAttr(value){
if(value==null){
return '';
}else{
let attr = JSON.parse(value);
let result='';
for(let i=0;i<attr.length;i++){
result+=attr[i].key;
result+=":";
result+=attr[i].value;
result+=";";
}
return result;
}
}
},
methods: {
onSelectRegion(data){
this.receiverInfo.receiverProvince=data.province.value;
this.receiverInfo.receiverCity=data.city.value;
this.receiverInfo.receiverRegion=data.area.value;
},
formatTime(time) {
if (time == null || time === '') {
return '';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStepStatus(value) {
if (value === 1) {
//待发货
return 2;
} else if (value === 2) {
//已发货
return 3;
} else if (value === 3) {
//已完成
return 4;
}else {
//待付款、已关闭、无限订单
return 1;
}
},
showUpdateReceiverDialog(){
this.receiverDialogVisible=true;
this.receiverInfo={
orderId:this.order.id,
receiverName:this.order.receiverName,
receiverPhone:this.order.receiverPhone,
receiverPostCode:this.order.receiverPostCode,
receiverDetailAddress:this.order.receiverDetailAddress,
receiverProvince:this.order.receiverProvince,
receiverCity:this.order.receiverCity,
receiverRegion:this.order.receiverRegion,
status:this.order.status
}
},
handleUpdateReceiverInfo(){
this.$confirm('是否要修改收货信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateReceiverInfo(this.receiverInfo).then(response=>{
this.receiverDialogVisible=false;
this.$message({
type: 'success',
message: '修改成功!'
});
getOrderDetail(this.id).then(response => {
this.order = response.data;
});
});
});
},
showUpdateMoneyDialog(){
this.moneyDialogVisible=true;
this.moneyInfo.orderId=this.order.id;
this.moneyInfo.freightAmount=this.order.freightAmount;
this.moneyInfo.discountAmount=this.order.discountAmount;
this.moneyInfo.status=this.order.status;
},
handleUpdateMoneyInfo(){
this.$confirm('是否要修改费用信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateMoneyInfo(this.moneyInfo).then(response=>{
this.moneyDialogVisible=false;
this.$message({
type: 'success',
message: '修改成功!'
});
getOrderDetail(this.id).then(response => {
this.order = response.data;
});
});
});
},
showMessageDialog(){
this.messageDialogVisible=true;
this.message.title=null;
this.message.content=null;
},
handleSendMessage(){
this.$confirm('是否要发送站内信?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.messageDialogVisible=false;
this.$message({
type: 'success',
message: '发送成功!'
});
});
},
showCloseOrderDialog(){
this.closeDialogVisible=true;
this.closeInfo.note=null;
this.closeInfo.id=this.id;
},
handleCloseOrder(){
this.$confirm('是否要关闭?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = new URLSearchParams();
params.append("ids",[this.closeInfo.id]);
params.append("note",this.closeInfo.note);
closeOrder(params).then(response=>{
this.closeDialogVisible=false;
this.$message({
type: 'success',
message: '订单关闭成功!'
});
getOrderDetail(this.id).then(response => {
this.order = response.data;
});
});
});
},
showMarkOrderDialog(){
this.markOrderDialogVisible=true;
this.markInfo.id=this.id;
this.closeOrder.note=null;
},
handleMarkOrder(){
this.$confirm('是否要备注订单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = new URLSearchParams();
params.append("id",this.markInfo.id);
params.append("note",this.markInfo.note);
params.append("status",this.order.status);
updateOrderNote(params).then(response=>{
this.markOrderDialogVisible=false;
this.$message({
type: 'success',
message: '订单备注成功!'
});
getOrderDetail(this.id).then(response => {
this.order = response.data;
});
});
});
},
handleDeleteOrder(){
this.$confirm('是否要进行该删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = new URLSearchParams();
params.append("ids",[this.id]);
deleteOrder(params).then(response=>{
this.$message({
message: '删除成功!',
type: 'success',
duration: 1000
});
this.$router.back();
});
})
},
showLogisticsDialog(){
this.logisticsDialogVisible=true;
}
}
}
</script>
<style scoped>
.detail-container {
width: 80%;
padding: 20px 20px 20px 20px;
margin: 20px auto;
}
.operate-container {
background: #F2F6FC;
height: 80px;
margin: -20px -20px 0;
line-height: 80px;
}
.operate-button-container {
float: right;
margin-right: 20px
}
.table-layout {
margin-top: 20px;
border-left: 1px solid #DCDFE6;
border-top: 1px solid #DCDFE6;
}
.table-cell {
height: 60px;
line-height: 40px;
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
font-size: 14px;
color: #606266;
text-align: center;
overflow: hidden;
}
.table-cell-title {
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
background: #F2F6FC;
text-align: center;
font-size: 14px;
color: #303133;
}
</style>
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="orderSetting"
ref="orderSettingForm"
:rules="rules"
label-width="150px">
<el-form-item label="秒杀订单超过:" prop="flashOrderOvertime">
<el-input v-model="orderSetting.flashOrderOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">未付款,订单自动关闭</span>
</el-form-item>
<el-form-item label="正常订单超过:" prop="normalOrderOvertime">
<el-input v-model="orderSetting.normalOrderOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">未付款,订单自动关闭</span>
</el-form-item>
<el-form-item label="发货超过:" prop="confirmOvertime">
<el-input v-model="orderSetting.confirmOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">未收货,订单自动完成</span>
</el-form-item>
<el-form-item label="订单完成超过:" prop="finishOvertime">
<el-input v-model="orderSetting.finishOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">自动结束交易,不能申请售后</span>
</el-form-item>
<el-form-item label="订单完成超过:" prop="commentOvertime">
<el-input v-model="orderSetting.commentOvertime" class="input-width">
<template slot="append"></template>
</el-input>
<span class="note-margin">自动五星好评</span>
</el-form-item>
<el-form-item>
<el-button
@click="confirm('orderSettingForm')"
type="primary">提交</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {getOrderSetting,updateOrderSetting} from '@/api/orderSetting';
const defaultOrderSetting = {
id: null,
flashOrderOvertime: 0,
normalOrderOvertime: 0,
confirmOvertime: 0,
finishOvertime: 0,
commentOvertime: 0
};
const checkTime = (rule, value, callback) => {
if (!value) {
return callback(new Error('时间不能为空'));
}
console.log("checkTime",value);
let intValue = parseInt(value);
if (!Number.isInteger(intValue)) {
return callback(new Error('请输入数字值'));
}
callback();
};
export default {
name: 'orderSetting',
data() {
return {
orderSetting: Object.assign({}, defaultOrderSetting),
rules: {
flashOrderOvertime:{validator: checkTime, trigger: 'blur' },
normalOrderOvertime:{validator: checkTime, trigger: 'blur' },
confirmOvertime: {validator: checkTime, trigger: 'blur' },
finishOvertime: {validator: checkTime, trigger: 'blur' },
commentOvertime:{validator: checkTime, trigger: 'blur' }
}
}
},
created(){
this.getDetail();
},
methods:{
confirm(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否要提交修改?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateOrderSetting(1,this.orderSetting).then(response=>{
this.$message({
type: 'success',
message: '提交成功!',
duration:1000
});
})
});
} else {
this.$message({
message: '提交参数不合法',
type: 'warning'
});
return false;
}
});
},
getDetail(){
getOrderSetting(1).then(response=>{
this.orderSetting=response.data;
})
}
}
}
</script>
<style scoped>
.input-width {
width: 50%;
}
.note-margin {
margin-left: 15px;
}
</style>
<template> 
<brand-detail :is-edit='false'></brand-detail>
</template>
<script>
import BrandDetail from './components/BrandDetail'
export default {
name: 'addBrand',
components: { BrandDetail }
}
</script>
<style>
</style>
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="brand" :rules="rules" ref="brandFrom" label-width="150px">
<el-form-item label="品牌名称:" prop="name">
<el-input v-model="brand.name"></el-input>
</el-form-item>
<el-form-item label="品牌首字母:">
<el-input v-model="brand.firstLetter"></el-input>
</el-form-item>
<el-form-item label="品牌LOGO:" prop="logo">
<single-upload v-model="brand.logo"></single-upload>
</el-form-item>
<el-form-item label="品牌专区大图:">
<single-upload v-model="brand.bigPic"></single-upload>
</el-form-item>
<el-form-item label="品牌故事:">
<el-input
placeholder="请输入内容"
type="textarea"
v-model="brand.brandStory"
:autosize="true"></el-input>
</el-form-item>
<el-form-item label="排序:" prop="sort">
<el-input v-model.number="brand.sort"></el-input>
</el-form-item>
<el-form-item label="是否显示:">
<el-radio-group v-model="brand.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="品牌制造商:">
<el-radio-group v-model="brand.factoryStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createBrand, getBrand, updateBrand} from '@/api/brand'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultBrand={
bigPic: '',
brandStory: '',
factoryStatus: 0,
firstLetter: '',
logo: '',
name: '',
showStatus: 0,
sort: 0
};
export default {
name: 'BrandDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
brand:Object.assign({}, defaultBrand),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getBrand(this.$route.query.id).then(response => {
this.brand = response.data;
});
}else{
this.brand = Object.assign({},defaultBrand);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateBrand(this.$route.query.id, this.brand).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createBrand(this.brand).then(response => {
this.$refs[formName].resetFields();
this.brand = Object.assign({},defaultBrand);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.brand = Object.assign({},defaultBrand);
}
}
}
</script>
<style>
</style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchBrandList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addBrand()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="brandTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="品牌名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="品牌首字母" width="100" align="center">
<template slot-scope="scope">{{scope.row.firstLetter}}</template>
</el-table-column>
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="品牌制造商" width="100" align="center">
<template slot-scope="scope">
<el-switch
@change="handleFactoryStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.factoryStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="是否显示" width="100" align="center">
<template slot-scope="scope">
<el-switch
@change="handleShowStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="相关" width="220" align="center">
<template slot-scope="scope">
<span>商品:</span>
<el-button
size="mini"
type="text"
@click="getProductList(scope.$index, scope.row)">100
</el-button>
<span>评价:</span>
<el-button
size="mini"
type="text"
@click="getProductCommentList(scope.$index, scope.row)">1000
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, updateShowStatus, updateFactoryStatus, deleteBrand} from '@/api/brand'
export default {
name: 'brandList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showBrand"
},
{
label: "隐藏品牌",
value: "hideBrand"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
this.totalPage = response.data.totalPage;
this.pageSize = response.data.pageSize;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/pms/updateBrand', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteBrand(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleFactoryStatusChange(index, row) {
var data = new URLSearchParams();
data.append("ids", row.id);
data.append("factoryStatus", row.factoryStatus);
updateFactoryStatus(data).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
}).catch(error => {
if (row.factoryStatus === 0) {
row.factoryStatus = 1;
} else {
row.factoryStatus = 0;
}
});
},
handleShowStatusChange(index, row) {
let data = new URLSearchParams();
;
data.append("ids", row.id);
data.append("showStatus", row.showStatus);
updateShowStatus(data).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
}).catch(error => {
if (row.showStatus === 0) {
row.showStatus = 1;
} else {
row.showStatus = 0;
}
});
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchBrandList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showBrand') {
showStatus = 1;
} else if (this.operateType === 'hideBrand') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addBrand() {
this.$router.push({path: '/pms/addBrand'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
<template> 
<brand-detail :is-edit='true'></brand-detail>
</template>
<script>
import BrandDetail from './components/BrandDetail'
export default {
name: 'updateBrand',
components: { BrandDetail }
}
</script>
<style>
</style>
<template> 
<product-detail :is-edit='false'></product-detail>
</template>
<script>
import ProductDetail from './components/ProductDetail'
export default {
name: 'addProduct',
components: { ProductDetail }
}
</script>
<style>
</style>
<template>
<div style="margin-top: 50px">
<el-form :model="value" ref="productAttrForm" label-width="120px" style="width: 720px" size="small">
<el-form-item label="属性类型:">
<el-select v-model="value.productAttributeCategoryId"
placeholder="请选择属性类型"
@change="handleProductAttrChange">
<el-option
v-for="item in productAttributeCategoryOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="商品规格:">
<el-card shadow="never" class="cardBg">
<div v-for="(productAttr,idx) in selectProductAttr">
{{productAttr.name}}
<el-checkbox-group v-if="productAttr.handAddStatus===0" v-model="selectProductAttr[idx].values">
<el-checkbox v-for="item in getInputListArr(productAttr.inputList)" :label="item" :key="item"
class="littleMarginLeft"></el-checkbox>
</el-checkbox-group>
<div v-else>
<el-checkbox-group v-model="selectProductAttr[idx].values">
<div v-for="(item,index) in selectProductAttr[idx].options" style="display: inline-block"
class="littleMarginLeft">
<el-checkbox :label="item" :key="item"></el-checkbox>
<el-button type="text" class="littleMarginLeft" @click="handleRemoveProductAttrValue(idx,index)">删除
</el-button>
</div>
</el-checkbox-group>
<el-input v-model="addProductAttrValue" style="width: 160px;margin-left: 10px" clearable></el-input>
<el-button class="littleMarginLeft" @click="handleAddProductAttrValue(idx)">增加</el-button>
</div>
</div>
</el-card>
<el-table style="width: 100%;margin-top: 20px"
:data="value.skuStockList"
border>
<el-table-column
v-for="(item,index) in selectProductAttr"
:label="item.name"
:key="item.id"
align="center">
<template slot-scope="scope">
{{getProductSkuSp(scope.row,index)}}
</template>
</el-table-column>
<el-table-column
label="销售价格"
width="80"
align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.price"></el-input>
</template>
</el-table-column>
<el-table-column
label="商品库存"
width="80"
align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.stock"></el-input>
</template>
</el-table-column>
<el-table-column
label="库存预警值"
width="80"
align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.lowStock"></el-input>
</template>
</el-table-column>
<el-table-column
label="SKU编号"
align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.skuCode"></el-input>
</template>
</el-table-column>
<el-table-column
label="操作"
width="80"
align="center">
<template slot-scope="scope">
<el-button
type="text"
@click="handleRemoveProductSku(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-button
type="primary"
style="margin-top: 20px"
@click="handleRefreshProductSkuList">刷新列表
</el-button>
<el-button
type="primary"
style="margin-top: 20px"
@click="handleSyncProductSkuPrice">同步价格
</el-button>
<el-button
type="primary"
style="margin-top: 20px"
@click="handleSyncProductSkuStock">同步库存
</el-button>
</el-form-item>
<el-form-item label="属性图片:" v-if="hasAttrPic">
<el-card shadow="never" class="cardBg">
<div v-for="(item,index) in selectProductAttrPics">
<span>{{item.name}}:</span>
<single-upload v-model="item.pic"
style="width: 300px;display: inline-block;margin-left: 10px"></single-upload>
</div>
</el-card>
</el-form-item>
<el-form-item label="商品参数:">
<el-card shadow="never" class="cardBg">
<div v-for="(item,index) in selectProductParam" :class="{littleMarginTop:index!==0}">
<div class="paramInputLabel">{{item.name}}:</div>
<el-select v-if="item.inputType===1" class="paramInput" v-model="selectProductParam[index].value">
<el-option
v-for="item in getParamInputList(item.inputList)"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
<el-input v-else class="paramInput" v-model="selectProductParam[index].value"></el-input>
</div>
</el-card>
</el-form-item>
<el-form-item label="商品相册:">
<multi-upload v-model="selectProductPics"></multi-upload>
</el-form-item>
<el-form-item label="规格参数:">
<el-tabs v-model="activeHtmlName" type="card">
<el-tab-pane label="电脑端详情" name="pc">
<tinymce :width="595" :height="300" v-model="value.detailHtml"></tinymce>
</el-tab-pane>
<el-tab-pane label="移动端详情" name="mobile">
<tinymce :width="595" :height="300" v-model="value.detailMobileHtml"></tinymce>
</el-tab-pane>
</el-tabs>
</el-form-item>
<el-form-item style="text-align: center">
<el-button size="medium" @click="handlePrev">上一步,填写商品促销</el-button>
<el-button type="primary" size="medium" @click="handleNext">下一步,选择商品关联</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {fetchList as fetchProductAttrCateList} from '@/api/productAttrCate'
import {fetchList as fetchProductAttrList} from '@/api/productAttr'
import SingleUpload from '@/components/Upload/singleUpload'
import MultiUpload from '@/components/Upload/multiUpload'
import Tinymce from '@/components/Tinymce'
export default {
name: "ProductAttrDetail",
components: {SingleUpload, MultiUpload, Tinymce},
props: {
value: Object,
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
//编辑模式时是否初始化成功
hasEditCreated:false,
//商品属性分类下拉选项
productAttributeCategoryOptions: [],
//选中的商品属性
selectProductAttr: [],
//选中的商品参数
selectProductParam: [],
//选中的商品属性图片
selectProductAttrPics: [],
//可手动添加的商品属性
addProductAttrValue: '',
//商品富文本详情激活类型
activeHtmlName: 'pc'
}
},
computed: {
//是否有商品属性图片
hasAttrPic() {
if (this.selectProductAttrPics.length < 1) {
return false;
}
return true;
},
//商品的编号
productId(){
return this.value.id;
},
//商品的主图和画册图片
selectProductPics:{
get:function () {
let pics=[];
if(this.value.pic===undefined||this.value.pic==null||this.value.pic===''){
return pics;
}
pics.push(this.value.pic);
if(this.value.albumPics===undefined||this.value.albumPics==null||this.value.albumPics===''){
return pics;
}
let albumPics = this.value.albumPics.split(',');
for(let i=0;i<albumPics.length;i++){
pics.push(albumPics[i]);
}
return pics;
},
set:function (newValue) {
if (newValue == null || newValue.length === 0) {
this.value.pic = null;
this.value.albumPics = null;
} else {
this.value.pic = newValue[0];
this.value.albumPics = '';
if (newValue.length > 1) {
for (let i = 1; i < newValue.length; i++) {
this.value.albumPics += newValue[i];
if (i !== newValue.length - 1) {
this.value.albumPics += ',';
}
}
}
}
}
}
},
created() {
this.getProductAttrCateList();
},
watch: {
productId:function (newValue) {
if(!this.isEdit)return;
if(this.hasEditCreated)return;
if(newValue===undefined||newValue==null||newValue===0)return;
this.handleEditCreated();
}
},
methods: {
handleEditCreated() {
//根据商品属性分类id获取属性和参数
if(this.value.productAttributeCategoryId!=null){
this.handleProductAttrChange(this.value.productAttributeCategoryId);
}
this.hasEditCreated=true;
},
getProductAttrCateList() {
let param = {pageNum: 1, pageSize: 100};
fetchProductAttrCateList(param).then(response => {
this.productAttributeCategoryOptions = [];
let list = response.data.list;
for (let i = 0; i < list.length; i++) {
this.productAttributeCategoryOptions.push({label: list[i].name, value: list[i].id});
}
});
},
getProductAttrList(type, cid) {
let param = {pageNum: 1, pageSize: 100, type: type};
fetchProductAttrList(cid, param).then(response => {
let list = response.data.list;
if (type === 0) {
this.selectProductAttr = [];
for (let i = 0; i < list.length; i++) {
let options = [];
let values = [];
if (this.isEdit) {
if (list[i].handAddStatus === 1) {
//编辑状态下获取手动添加编辑属性
options = this.getEditAttrOptions(list[i].id);
}
//编辑状态下获取选中属性
values = this.getEditAttrValues(i);
}
this.selectProductAttr.push({
id: list[i].id,
name: list[i].name,
handAddStatus: list[i].handAddStatus,
inputList: list[i].inputList,
values: values,
options: options
});
}
if(this.isEdit){
//编辑模式下刷新商品属性图片
this.refreshProductAttrPics();
}
} else {
this.selectProductParam = [];
for (let i = 0; i < list.length; i++) {
let value=null;
if(this.isEdit){
//编辑模式下获取参数属性
value= this.getEditParamValue(list[i].id);
}
this.selectProductParam.push({
id: list[i].id,
name: list[i].name,
value: value,
inputType: list[i].inputType,
inputList: list[i].inputList
});
}
}
});
},
//获取设置的可手动添加属性值
getEditAttrOptions(id) {
let options = [];
for (let i = 0; i < this.value.productAttributeValueList.length; i++) {
let attrValue = this.value.productAttributeValueList[i];
if (attrValue.productAttributeId === id) {
let strArr = attrValue.value.split(',');
for (let j = 0; j < strArr.length; j++) {
options.push(strArr[j]);
}
break;
}
}
return options;
},
//获取选中的属性值
getEditAttrValues(index) {
let values = new Set();
if (index === 0) {
for (let i = 0; i < this.value.skuStockList.length; i++) {
let sku = this.value.skuStockList[i];
let spData = JSON.parse(sku.spData);
if (spData!= null && spData.length>=1) {
values.add(spData[0].value);
}
}
} else if (index === 1) {
for (let i = 0; i < this.value.skuStockList.length; i++) {
let sku = this.value.skuStockList[i];
let spData = JSON.parse(sku.spData);
if (spData!= null && spData.length>=2) {
values.add(spData[1].value);
}
}
} else {
for (let i = 0; i < this.value.skuStockList.length; i++) {
let sku = this.value.skuStockList[i];
let spData = JSON.parse(sku.spData);
if (spData!= null && spData.length>=3) {
values.add(spData[2].value);
}
}
}
return Array.from(values);
},
//获取属性的值
getEditParamValue(id){
for(let i=0;i<this.value.productAttributeValueList.length;i++){
if(id===this.value.productAttributeValueList[i].productAttributeId){
return this.value.productAttributeValueList[i].value;
}
}
},
handleProductAttrChange(value) {
this.getProductAttrList(0, value);
this.getProductAttrList(1, value);
},
getInputListArr(inputList) {
return inputList.split(',');
},
handleAddProductAttrValue(idx) {
let options = this.selectProductAttr[idx].options;
if (this.addProductAttrValue == null || this.addProductAttrValue == '') {
this.$message({
message: '属性值不能为空',
type: 'warning',
duration: 1000
});
return
}
if (options.indexOf(this.addProductAttrValue) !== -1) {
this.$message({
message: '属性值不能重复',
type: 'warning',
duration: 1000
});
return;
}
this.selectProductAttr[idx].options.push(this.addProductAttrValue);
this.addProductAttrValue = null;
},
handleRemoveProductAttrValue(idx, index) {
this.selectProductAttr[idx].options.splice(index, 1);
},
getProductSkuSp(row, index) {
let spData = JSON.parse(row.spData);
if(spData!=null&&index<spData.length){
return spData[index].value;
}else{
return null;
}
},
handleRefreshProductSkuList() {
this.$confirm('刷新列表将导致sku信息重新生成,是否要刷新', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.refreshProductAttrPics();
this.refreshProductSkuList();
});
},
handleSyncProductSkuPrice(){
this.$confirm('将同步第一个sku的价格到所有sku,是否继续', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(this.value.skuStockList!==null&&this.value.skuStockList.length>0){
let tempSkuList = [];
tempSkuList = tempSkuList.concat(tempSkuList,this.value.skuStockList);
let price=this.value.skuStockList[0].price;
for(let i=0;i<tempSkuList.length;i++){
tempSkuList[i].price=price;
}
this.value.skuStockList=[];
this.value.skuStockList=this.value.skuStockList.concat(this.value.skuStockList,tempSkuList);
}
});
},
handleSyncProductSkuStock(){
this.$confirm('将同步第一个sku的库存到所有sku,是否继续', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(this.value.skuStockList!==null&&this.value.skuStockList.length>0){
let tempSkuList = [];
tempSkuList = tempSkuList.concat(tempSkuList,this.value.skuStockList);
let stock=this.value.skuStockList[0].stock;
let lowStock=this.value.skuStockList[0].lowStock;
for(let i=0;i<tempSkuList.length;i++){
tempSkuList[i].stock=stock;
tempSkuList[i].lowStock=lowStock;
}
this.value.skuStockList=[];
this.value.skuStockList=this.value.skuStockList.concat(this.value.skuStockList,tempSkuList);
}
});
},
refreshProductSkuList() {
this.value.skuStockList = [];
let skuList = this.value.skuStockList;
//只有一个属性时
if (this.selectProductAttr.length === 1) {
let attr = this.selectProductAttr[0];
for (let i = 0; i < attr.values.length; i++) {
skuList.push({
spData: JSON.stringify([{key:attr.name,value:attr.values[i]}])
});
}
} else if (this.selectProductAttr.length === 2) {
let attr0 = this.selectProductAttr[0];
let attr1 = this.selectProductAttr[1];
for (let i = 0; i < attr0.values.length; i++) {
if (attr1.values.length === 0) {
skuList.push({
spData: JSON.stringify([{key:attr0.name,value:attr0.values[i]}])
});
continue;
}
for (let j = 0; j < attr1.values.length; j++) {
let spData = [];
spData.push({key:attr0.name,value:attr0.values[i]});
spData.push({key:attr1.name,value:attr1.values[j]});
skuList.push({
spData: JSON.stringify(spData)
});
}
}
} else {
let attr0 = this.selectProductAttr[0];
let attr1 = this.selectProductAttr[1];
let attr2 = this.selectProductAttr[2];
for (let i = 0; i < attr0.values.length; i++) {
if (attr1.values.length === 0) {
skuList.push({
spData: JSON.stringify([{key:attr0.name,value:attr0.values[i]}])
});
continue;
}
for (let j = 0; j < attr1.values.length; j++) {
if (attr2.values.length === 0) {
let spData = [];
spData.push({key:attr0.name,value:attr0.values[i]});
spData.push({key:attr1.name,value:attr1.values[j]});
skuList.push({
spData: JSON.stringify(spData)
});
continue;
}
for (let k = 0; k < attr2.values.length; k++) {
let spData = [];
spData.push({key:attr0.name,value:attr0.values[i]});
spData.push({key:attr1.name,value:attr1.values[j]});
spData.push({key:attr2.name,value:attr2.values[k]});
skuList.push({
spData: JSON.stringify(spData)
});
}
}
}
}
},
refreshProductAttrPics() {
this.selectProductAttrPics = [];
if (this.selectProductAttr.length >= 1) {
let values = this.selectProductAttr[0].values;
for (let i = 0; i < values.length; i++) {
let pic=null;
if(this.isEdit){
//编辑状态下获取图片
pic=this.getProductSkuPic(values[i]);
}
this.selectProductAttrPics.push({name: values[i], pic: pic})
}
}
},
//获取商品相关属性的图片
getProductSkuPic(name){
for(let i=0;i<this.value.skuStockList.length;i++){
let spData = JSON.parse(this.value.skuStockList[i].spData);
if(name===spData[0].value){
return this.value.skuStockList[i].pic;
}
}
return null;
},
//合并商品属性
mergeProductAttrValue() {
this.value.productAttributeValueList = [];
for (let i = 0; i < this.selectProductAttr.length; i++) {
let attr = this.selectProductAttr[i];
if (attr.handAddStatus === 1 && attr.options != null && attr.options.length > 0) {
this.value.productAttributeValueList.push({
productAttributeId: attr.id,
value: this.getOptionStr(attr.options)
});
}
}
for (let i = 0; i < this.selectProductParam.length; i++) {
let param = this.selectProductParam[i];
this.value.productAttributeValueList.push({
productAttributeId: param.id,
value: param.value
});
}
},
//合并商品属性图片
mergeProductAttrPics() {
for (let i = 0; i < this.selectProductAttrPics.length; i++) {
for (let j = 0; j < this.value.skuStockList.length; j++) {
let spData = JSON.parse(this.value.skuStockList[j].spData);
if (spData[0].value === this.selectProductAttrPics[i].name) {
this.value.skuStockList[j].pic = this.selectProductAttrPics[i].pic;
}
}
}
},
getOptionStr(arr) {
let str = '';
for (let i = 0; i < arr.length; i++) {
str += arr[i];
if (i != arr.length - 1) {
str += ',';
}
}
return str;
},
handleRemoveProductSku(index, row) {
let list = this.value.skuStockList;
if (list.length === 1) {
list.pop();
} else {
list.splice(index, 1);
}
},
getParamInputList(inputList) {
return inputList.split(',');
},
handlePrev() {
this.$emit('prevStep')
},
handleNext() {
this.mergeProductAttrValue();
this.mergeProductAttrPics();
this.$emit('nextStep')
}
}
}
</script>
<style scoped>
.littleMarginLeft {
margin-left: 10px;
}
.littleMarginTop {
margin-top: 10px;
}
.paramInput {
width: 250px;
}
.paramInputLabel {
display: inline-block;
width: 100px;
text-align: right;
padding-right: 10px
}
.cardBg {
background: #F8F9FC;
}
</style>
<template> 
<el-card class="form-container" shadow="never">
<el-steps :active="active" finish-status="success" align-center>
<el-step title="填写商品信息"></el-step>
<el-step title="填写商品促销"></el-step>
<el-step title="填写商品属性"></el-step>
<el-step title="选择商品关联"></el-step>
</el-steps>
<product-info-detail
v-show="showStatus[0]"
v-model="productParam"
:is-edit="isEdit"
@nextStep="nextStep">
</product-info-detail>
<product-sale-detail
v-show="showStatus[1]"
v-model="productParam"
:is-edit="isEdit"
@nextStep="nextStep"
@prevStep="prevStep">
</product-sale-detail>
<product-attr-detail
v-show="showStatus[2]"
v-model="productParam"
:is-edit="isEdit"
@nextStep="nextStep"
@prevStep="prevStep">
</product-attr-detail>
<product-relation-detail
v-show="showStatus[3]"
v-model="productParam"
:is-edit="isEdit"
@prevStep="prevStep"
@finishCommit="finishCommit">
</product-relation-detail>
</el-card>
</template>
<script>
import ProductInfoDetail from './ProductInfoDetail';
import ProductSaleDetail from './ProductSaleDetail';
import ProductAttrDetail from './ProductAttrDetail';
import ProductRelationDetail from './ProductRelationDetail';
import {createProduct,getProduct,updateProduct} from '@/api/product';
const defaultProductParam = {
albumPics: '',
brandId: null,
brandName: '',
deleteStatus: 0,
description: '',
detailDesc: '',
detailHtml: '',
detailMobileHtml: '',
detailTitle: '',
feightTemplateId: 0,
flashPromotionCount: 0,
flashPromotionId: 0,
flashPromotionPrice: 0,
flashPromotionSort: 0,
giftPoint: 0,
giftGrowth: 0,
keywords: '',
lowStock: 0,
name: '',
newStatus: 0,
note: '',
originalPrice: 0,
pic: '',
//会员价格{memberLevelId: 0,memberPrice: 0,memberLevelName: null}
memberPriceList: [],
//商品满减
productFullReductionList: [{fullPrice: 0, reducePrice: 0}],
//商品阶梯价格
productLadderList: [{count: 0,discount: 0,price: 0}],
previewStatus: 0,
price: 0,
productAttributeCategoryId: null,
//商品属性相关{productAttributeId: 0, value: ''}
productAttributeValueList: [],
//商品sku库存信息{lowStock: 0, pic: '', price: 0, sale: 0, skuCode: '', spData: '', stock: 0}
skuStockList: [],
//商品相关专题{subjectId: 0}
subjectProductRelationList: [],
//商品相关优选{prefrenceAreaId: 0}
prefrenceAreaProductRelationList: [],
productCategoryId: null,
productCategoryName: '',
productSn: '',
promotionEndTime: '',
promotionPerLimit: 0,
promotionPrice: null,
promotionStartTime: '',
promotionType: 0,
publishStatus: 0,
recommandStatus: 0,
sale: 0,
serviceIds: '',
sort: 0,
stock: 0,
subTitle: '',
unit: '',
usePointLimit: 0,
verifyStatus: 0,
weight: 0
};
export default {
name: 'ProductDetail',
components: {ProductInfoDetail, ProductSaleDetail, ProductAttrDetail, ProductRelationDetail},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
active: 0,
productParam: Object.assign({}, defaultProductParam),
showStatus: [true, false, false, false]
}
},
created(){
if(this.isEdit){
getProduct(this.$route.query.id).then(response=>{
this.productParam=response.data;
});
}
},
methods: {
hideAll() {
for (let i = 0; i < this.showStatus.length; i++) {
this.showStatus[i] = false;
}
},
prevStep() {
if (this.active > 0 && this.active < this.showStatus.length) {
this.active--;
this.hideAll();
this.showStatus[this.active] = true;
}
},
nextStep() {
if (this.active < this.showStatus.length - 1) {
this.active++;
this.hideAll();
this.showStatus[this.active] = true;
}
},
finishCommit(isEdit) {
this.$confirm('是否要提交该产品', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(isEdit){
updateProduct(this.$route.query.id,this.productParam).then(response=>{
this.$message({
type: 'success',
message: '提交成功',
duration:1000
});
this.$router.back();
});
}else{
createProduct(this.productParam).then(response=>{
this.$message({
type: 'success',
message: '提交成功',
duration:1000
});
location.reload();
});
}
})
}
}
}
</script>
<style>
.form-container {
width: 800px;
}
</style>
<template>
<div style="margin-top: 50px">
<el-form :model="value" :rules="rules" ref="productInfoForm" label-width="120px" style="width: 600px" size="small">
<el-form-item label="商品分类:" prop="productCategoryId">
<el-cascader
v-model="selectProductCateValue"
:options="productCateOptions">
</el-cascader>
</el-form-item>
<el-form-item label="商品名称:" prop="name">
<el-input v-model="value.name"></el-input>
</el-form-item>
<el-form-item label="副标题:" prop="subTitle">
<el-input v-model="value.subTitle"></el-input>
</el-form-item>
<el-form-item label="商品品牌:" prop="brandId">
<el-select
v-model="value.brandId"
@change="handleBrandChange"
placeholder="请选择品牌">
<el-option
v-for="item in brandOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="商品介绍:">
<el-input
:autoSize="true"
v-model="value.description"
type="textarea"
placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item label="商品货号:">
<el-input v-model="value.productSn"></el-input>
</el-form-item>
<el-form-item label="商品售价:">
<el-input v-model="value.price"></el-input>
</el-form-item>
<el-form-item label="市场价:">
<el-input v-model="value.originalPrice"></el-input>
</el-form-item>
<el-form-item label="商品库存:">
<el-input v-model="value.stock"></el-input>
</el-form-item>
<el-form-item label="计量单位:">
<el-input v-model="value.unit"></el-input>
</el-form-item>
<el-form-item label="商品重量:">
<el-input v-model="value.weight" style="width: 300px"></el-input>
<span style="margin-left: 20px"></span>
</el-form-item>
<el-form-item label="排序">
<el-input v-model="value.sort"></el-input>
</el-form-item>
<el-form-item style="text-align: center">
<el-button type="primary" size="medium" @click="handleNext('productInfoForm')">下一步,填写商品促销</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {fetchListWithChildren} from '@/api/productCate'
import {fetchList as fetchBrandList} from '@/api/brand'
import {getProduct} from '@/api/product';
export default {
name: "ProductInfoDetail",
props: {
value: Object,
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
hasEditCreated:false,
//选中商品分类的值
selectProductCateValue: [],
productCateOptions: [],
brandOptions: [],
rules: {
name: [
{required: true, message: '请输入商品名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
subTitle: [{required: true, message: '请输入商品副标题', trigger: 'blur'}],
productCategoryId: [{required: true, message: '请选择商品分类', trigger: 'blur'}],
brandId: [{required: true, message: '请选择商品品牌', trigger: 'blur'}],
description: [{required: true, message: '请输入商品介绍', trigger: 'blur'}],
requiredProp: [{required: true, message: '该项为必填项', trigger: 'blur'}]
}
};
},
created() {
this.getProductCateList();
this.getBrandList();
},
computed:{
//商品的编号
productId(){
return this.value.id;
}
},
watch: {
productId:function(newValue){
if(!this.isEdit)return;
if(this.hasEditCreated)return;
if(newValue===undefined||newValue==null||newValue===0)return;
this.handleEditCreated();
},
selectProductCateValue: function (newValue) {
if (newValue != null && newValue.length === 2) {
this.value.productCategoryId = newValue[1];
this.value.productCategoryName= this.getCateNameById(this.value.productCategoryId);
} else {
this.value.productCategoryId = null;
this.value.productCategoryName=null;
}
}
},
methods: {
//处理编辑逻辑
handleEditCreated(){
if(this.value.productCategoryId!=null){
this.selectProductCateValue.push(this.value.cateParentId);
this.selectProductCateValue.push(this.value.productCategoryId);
}
this.hasEditCreated=true;
},
getProductCateList() {
fetchListWithChildren().then(response => {
let list = response.data;
this.productCateOptions = [];
for (let i = 0; i < list.length; i++) {
let children = [];
if (list[i].children != null && list[i].children.length > 0) {
for (let j = 0; j < list[i].children.length; j++) {
children.push({label: list[i].children[j].name, value: list[i].children[j].id});
}
}
this.productCateOptions.push({label: list[i].name, value: list[i].id, children: children});
}
});
},
getBrandList() {
fetchBrandList({pageNum: 1, pageSize: 100}).then(response => {
this.brandOptions = [];
let brandList = response.data.list;
for (let i = 0; i < brandList.length; i++) {
this.brandOptions.push({label: brandList[i].name, value: brandList[i].id});
}
});
},
getCateNameById(id){
let name=null;
for(let i=0;i<this.productCateOptions.length;i++){
for(let j=0;j<this.productCateOptions[i].children.length;j++){
if(this.productCateOptions[i].children[j].value===id){
name=this.productCateOptions[i].children[j].label;
return name;
}
}
}
return name;
},
handleNext(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$emit('nextStep');
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
handleBrandChange(val) {
let brandName = '';
for (let i = 0; i < this.brandOptions.length; i++) {
if (this.brandOptions[i].value === val) {
brandName = this.brandOptions[i].label;
break;
}
}
this.value.brandName = brandName;
}
}
}
</script>
<style scoped>
</style>
<template>
<div style="margin-top: 50px">
<el-form :model="value"
ref="productRelationForm"
label-width="120px"
style="width: 680px"
size="small">
<el-form-item label="关联专题:">
<el-transfer
style="display: inline-block"
filterable
:filter-method="filterMethod"
filter-placeholder="请输入专题名称"
v-model="selectSubject"
:titles="subjectTitles"
:data="subjectList">
</el-transfer>
</el-form-item>
<el-form-item label="关联优选:">
<el-transfer
style="display: inline-block"
filterable
:filter-method="filterMethod"
filter-placeholder="请输入优选名称"
v-model="selectPrefrenceArea"
:titles="prefrenceAreaTitles"
:data="prefrenceAreaList">
</el-transfer>
</el-form-item>
<el-form-item style="text-align: center">
<el-button size="medium" @click="handlePrev">上一步,填写商品属性</el-button>
<el-button type="primary" size="medium" @click="handleFinishCommit">完成,提交商品</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {fetchListAll as fetchSubjectList} from '@/api/subject'
import {fetchList as fetchPrefrenceAreaList} from '@/api/prefrenceArea'
export default {
name: "ProductRelationDetail",
props: {
value: Object,
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
//所有专题列表
subjectList: [],
//专题左右标题
subjectTitles: ['待选择', '已选择'],
//所有专题列表
prefrenceAreaList: [],
//专题左右标题
prefrenceAreaTitles: ['待选择', '已选择']
};
},
created() {
this.getSubjectList();
this.getPrefrenceAreaList();
},
computed:{
//选中的专题
selectSubject:{
get:function () {
let subjects =[];
if(this.value.subjectProductRelationList==null||this.value.subjectProductRelationList.length<=0){
return subjects;
}
for(let i=0;i<this.value.subjectProductRelationList.length;i++){
subjects.push(this.value.subjectProductRelationList[i].subjectId);
}
return subjects;
},
set:function (newValue) {
this.value.subjectProductRelationList=[];
for(let i=0;i<newValue.length;i++){
this.value.subjectProductRelationList.push({subjectId:newValue[i]});
}
}
},
//选中的优选
selectPrefrenceArea:{
get:function () {
let prefrenceAreas =[];
if(this.value.prefrenceAreaProductRelationList==null||this.value.prefrenceAreaProductRelationList.length<=0){
return prefrenceAreas;
}
for(let i=0;i<this.value.prefrenceAreaProductRelationList.length;i++){
prefrenceAreas.push(this.value.prefrenceAreaProductRelationList[i].prefrenceAreaId);
}
return prefrenceAreas;
},
set:function (newValue) {
this.value.prefrenceAreaProductRelationList=[];
for(let i=0;i<newValue.length;i++){
this.value.prefrenceAreaProductRelationList.push({prefrenceAreaId:newValue[i]});
}
}
}
},
methods: {
filterMethod(query, item) {
return item.label.indexOf(query) > -1;
},
getSubjectList() {
fetchSubjectList().then(response => {
let list = response.data;
for (let i = 0; i < list.length; i++) {
this.subjectList.push({
label: list[i].title,
key: list[i].id
});
}
});
},
getPrefrenceAreaList() {
fetchPrefrenceAreaList().then(response=>{
let list = response.data;
for (let i = 0; i < list.length; i++) {
this.prefrenceAreaList.push({
label: list[i].name,
key: list[i].id
});
}
});
},
handlePrev(){
this.$emit('prevStep')
},
handleFinishCommit(){
this.$emit('finishCommit',this.isEdit);
}
}
}
</script>
<style scoped>
</style>
<template>
<div style="margin-top: 50px">
<el-form :model="value" ref="productSaleForm" label-width="120px" style="width: 600px" size="small">
<el-form-item label="赠送积分:">
<el-input v-model="value.giftPoint"></el-input>
</el-form-item>
<el-form-item label="赠送成长值:">
<el-input v-model="value.giftGrowth"></el-input>
</el-form-item>
<el-form-item label="积分购买限制:">
<el-input v-model="value.usePointLimit"></el-input>
</el-form-item>
<el-form-item label="预告商品:">
<el-switch
v-model="value.previewStatus"
:active-value="1"
:inactive-value="0">
</el-switch>
</el-form-item>
<el-form-item label="商品上架:">
<el-switch
v-model="value.publishStatus"
:active-value="1"
:inactive-value="0">
</el-switch>
</el-form-item>
<el-form-item label="商品推荐:">
<span style="margin-right: 10px">新品</span>
<el-switch
v-model="value.newStatus"
:active-value="1"
:inactive-value="0">
</el-switch>
<span style="margin-left: 10px;margin-right: 10px">推荐</span>
<el-switch
v-model="value.recommandStatus"
:active-value="1"
:inactive-value="0">
</el-switch>
</el-form-item>
<el-form-item label="服务保证:">
<el-checkbox-group v-model="selectServiceList">
<el-checkbox :label="1">无忧退货</el-checkbox>
<el-checkbox :label="2">快速退款</el-checkbox>
<el-checkbox :label="3">免费包邮</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="详细页标题:">
<el-input v-model="value.detailTitle"></el-input>
</el-form-item>
<el-form-item label="详细页描述:">
<el-input v-model="value.detailDesc"></el-input>
</el-form-item>
<el-form-item label="商品关键字:">
<el-input v-model="value.keywords"></el-input>
</el-form-item>
<el-form-item label="商品备注:">
<el-input v-model="value.note" type="textarea" :autoSize="true"></el-input>
</el-form-item>
<el-form-item label="选择优惠方式:">
<el-radio-group v-model="value.promotionType" size="small">
<el-radio-button :label="0">无优惠</el-radio-button>
<el-radio-button :label="1">特惠促销</el-radio-button>
<el-radio-button :label="2">会员价格</el-radio-button>
<el-radio-button :label="3">阶梯价格</el-radio-button>
<el-radio-button :label="4">满减价格</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="value.promotionType===1">
<div>
开始时间:
<el-date-picker
v-model="value.promotionStartTime"
type="datetime"
:picker-options="pickerOptions1"
placeholder="选择开始时间">
</el-date-picker>
</div>
<div class="littleMargin">
结束时间:
<el-date-picker
v-model="value.promotionEndTime"
type="datetime"
:picker-options="pickerOptions1"
placeholder="选择结束时间">
</el-date-picker>
</div>
<div class="littleMargin">
促销价格:
<el-input style="width: 220px" v-model="value.promotionPrice" placeholder="输入促销价格"></el-input>
</div>
</el-form-item>
<el-form-item v-show="value.promotionType===2">
<div v-for="(item, index) in value.memberPriceList" :class="{littleMargin:index!==0}">
{{item.memberLevelName}}
<el-input v-model="item.memberPrice" style="width: 200px"></el-input>
</div>
</el-form-item>
<el-form-item v-show="value.promotionType===3">
<el-table :data="value.productLadderList"
style="width: 80%" border>
<el-table-column
label="数量"
align="center"
width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.count"></el-input>
</template>
</el-table-column>
<el-table-column
label="折扣"
align="center"
width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.discount"></el-input>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作">
<template slot-scope="scope">
<el-button type="text" @click="handleRemoveProductLadder(scope.$index, scope.row)">删除</el-button>
<el-button type="text" @click="handleAddProductLadder(scope.$index, scope.row)">添加</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item v-show="value.promotionType===4">
<el-table :data="value.productFullReductionList"
style="width: 80%" border>
<el-table-column
label="满"
align="center"
width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.fullPrice"></el-input>
</template>
</el-table-column>
<el-table-column
label="立减"
align="center"
width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.reducePrice"></el-input>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作">
<template slot-scope="scope">
<el-button type="text" @click="handleRemoveFullReduction(scope.$index, scope.row)">删除</el-button>
<el-button type="text" @click="handleAddFullReduction(scope.$index, scope.row)">添加</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item style="text-align: center">
<el-button size="medium" @click="handlePrev">上一步,填写商品信息</el-button>
<el-button type="primary" size="medium" @click="handleNext">下一步,填写商品属性</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {fetchList as fetchMemberLevelList} from '@/api/memberLevel'
export default {
name: "ProductSaleDetail",
props: {
value: Object,
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
//日期选择器配置
pickerOptions1: {
disabledDate(time) {
return time.getTime() < Date.now();
}
}
}
},
created() {
if (this.isEdit) {
// this.handleEditCreated();
} else {
fetchMemberLevelList({defaultStatus: 0}).then(response => {
let memberPriceList = [];
for (let i = 0; i < response.data.length; i++) {
let item = response.data[i];
memberPriceList.push({memberLevelId: item.id, memberLevelName: item.name})
}
this.value.memberPriceList = memberPriceList;
});
}
},
computed: {
//选中的服务保证
selectServiceList: {
get() {
let list = [];
if (this.value.serviceIds === undefined || this.value.serviceIds == null || this.value.serviceIds === '') return list;
let ids = this.value.serviceIds.split(',');
for (let i = 0; i < ids.length; i++) {
list.push(Number(ids[i]));
}
return list;
},
set(newValue) {
let serviceIds = '';
if (newValue != null && newValue.length > 0) {
for (let i = 0; i < newValue.length; i++) {
serviceIds += newValue[i] + ',';
}
if (serviceIds.endsWith(',')) {
serviceIds = serviceIds.substr(0, serviceIds.length - 1)
}
this.value.serviceIds = serviceIds;
} else {
this.value.serviceIds = null;
}
}
}
},
methods: {
handleEditCreated() {
let ids = this.value.serviceIds.split(',');
console.log('handleEditCreated', ids);
for (let i = 0; i < ids.length; i++) {
this.selectServiceList.push(Number(ids[i]));
}
},
handleRemoveProductLadder(index, row) {
let productLadderList = this.value.productLadderList;
if (productLadderList.length === 1) {
productLadderList.pop();
productLadderList.push({
count: 0,
discount: 0,
price: 0
})
} else {
productLadderList.splice(index, 1);
}
},
handleAddProductLadder(index, row) {
let productLadderList = this.value.productLadderList;
if (productLadderList.length < 3) {
productLadderList.push({
count: 0,
discount: 0,
price: 0
})
} else {
this.$message({
message: '最多只能添加三条',
type: 'warning'
});
}
},
handleRemoveFullReduction(index, row) {
let fullReductionList = this.value.productFullReductionList;
if (fullReductionList.length === 1) {
fullReductionList.pop();
fullReductionList.push({
fullPrice: 0,
reducePrice: 0
});
} else {
fullReductionList.splice(index, 1);
}
},
handleAddFullReduction(index, row) {
let fullReductionList = this.value.productFullReductionList;
if (fullReductionList.length < 3) {
fullReductionList.push({
fullPrice: 0,
reducePrice: 0
});
} else {
this.$message({
message: '最多只能添加三条',
type: 'warning'
});
}
},
handlePrev() {
this.$emit('prevStep')
},
handleNext() {
this.$emit('nextStep')
}
}
}
</script>
<style scoped>
.littleMargin {
margin-top: 10px;
}
</style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small">
查询结果
</el-button>
<el-button
style="float: right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="商品名称"></el-input>
</el-form-item>
<el-form-item label="商品货号:">
<el-input style="width: 203px" v-model="listQuery.productSn" placeholder="商品货号"></el-input>
</el-form-item>
<el-form-item label="商品分类:">
<el-cascader
clearable
v-model="selectProductCateValue"
:options="productCateOptions">
</el-cascader>
</el-form-item>
<el-form-item label="商品品牌:">
<el-select v-model="listQuery.brandId" placeholder="请选择品牌" clearable>
<el-option
v-for="item in brandOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="上架状态:">
<el-select v-model="listQuery.publishStatus" placeholder="全部" clearable>
<el-option
v-for="item in publishStatusOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="审核状态:">
<el-select v-model="listQuery.verifyStatus" placeholder="全部" clearable>
<el-option
v-for="item in verifyStatusOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="handleAddProduct()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="productTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="商品图片" width="120" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">
<p>{{scope.row.name}}</p>
<p>品牌:{{scope.row.brandName}}</p>
</template>
</el-table-column>
<el-table-column label="价格/货号" width="120" align="center">
<template slot-scope="scope">
<p>价格:¥{{scope.row.price}}</p>
<p>货号:{{scope.row.productSn}}</p>
</template>
</el-table-column>
<el-table-column label="标签" width="140" align="center">
<template slot-scope="scope">
<p>上架:
<el-switch
@change="handlePublishStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.publishStatus">
</el-switch>
</p>
<p>新品:
<el-switch
@change="handleNewStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.newStatus">
</el-switch>
</p>
<p>推荐:
<el-switch
@change="handleRecommendStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.recommandStatus">
</el-switch>
</p>
</template>
</el-table-column>
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="SKU库存" width="100" align="center">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-edit" @click="handleShowSkuEditDialog(scope.$index, scope.row)" circle></el-button>
</template>
</el-table-column>
<el-table-column label="销量" width="100" align="center">
<template slot-scope="scope">{{scope.row.sale}}</template>
</el-table-column>
<el-table-column label="审核状态" width="100" align="center">
<template slot-scope="scope">
<p>{{scope.row.verifyStatus | verifyStatusFilter}}</p>
<p>
<el-button
type="text"
@click="handleShowVerifyDetail(scope.$index, scope.row)">审核详情
</el-button>
</p>
</template>
</el-table-column>
<el-table-column label="操作" width="160" align="center">
<template slot-scope="scope">
<p>
<el-button
size="mini"
@click="handleShowProduct(scope.$index, scope.row)">查看
</el-button>
<el-button
size="mini"
@click="handleUpdateProduct(scope.$index, scope.row)">编辑
</el-button>
</p>
<p>
<el-button
size="mini"
@click="handleShowLog(scope.$index, scope.row)">日志
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</p>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
<el-dialog
title="编辑货品信息"
:visible.sync="editSkuInfo.dialogVisible"
width="40%">
<span>商品货号:</span>
<span>{{editSkuInfo.productSn}}</span>
<el-input placeholder="按sku编号搜索" v-model="editSkuInfo.keyword" size="small" style="width: 50%;margin-left: 20px">
<el-button slot="append" icon="el-icon-search" @click="handleSearchEditSku"></el-button>
</el-input>
<el-table style="width: 100%;margin-top: 20px"
:data="editSkuInfo.stockList"
border>
<el-table-column
label="SKU编号"
align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.skuCode"></el-input>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in editSkuInfo.productAttr"
:label="item.name"
:key="item.id"
align="center">
<template slot-scope="scope">
{{getProductSkuSp(scope.row,index)}}
</template>
</el-table-column>
<el-table-column
label="销售价格"
width="80"
align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.price"></el-input>
</template>
</el-table-column>
<el-table-column
label="商品库存"
width="80"
align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.stock"></el-input>
</template>
</el-table-column>
<el-table-column
label="库存预警值"
width="100"
align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.lowStock"></el-input>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="editSkuInfo.dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleEditSkuConfirm">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
fetchList,
updateDeleteStatus,
updateNewStatus,
updateRecommendStatus,
updatePublishStatus
} from '@/api/product'
import {fetchList as fetchSkuStockList,update as updateSkuStockList} from '@/api/skuStock'
import {fetchList as fetchProductAttrList} from '@/api/productAttr'
import {fetchList as fetchBrandList} from '@/api/brand'
import {fetchListWithChildren} from '@/api/productCate'
const defaultListQuery = {
keyword: null,
pageNum: 1,
pageSize: 5,
publishStatus: null,
verifyStatus: null,
productSn: null,
productCategoryId: null,
brandId: null
};
export default {
name: "productList",
data() {
return {
editSkuInfo:{
dialogVisible:false,
productId:null,
productSn:'',
productAttributeCategoryId:null,
stockList:[],
productAttr:[],
keyword:null
},
operates: [
{
label: "商品上架",
value: "publishOn"
},
{
label: "商品下架",
value: "publishOff"
},
{
label: "设为推荐",
value: "recommendOn"
},
{
label: "取消推荐",
value: "recommendOff"
},
{
label: "设为新品",
value: "newOn"
},
{
label: "取消新品",
value: "newOff"
},
{
label: "转移到分类",
value: "transferCategory"
},
{
label: "移入回收站",
value: "recycle"
}
],
operateType: null,
listQuery: Object.assign({}, defaultListQuery),
list: null,
total: null,
listLoading: true,
selectProductCateValue: null,
multipleSelection: [],
productCateOptions: [],
brandOptions: [],
publishStatusOptions: [{
value: 1,
label: '上架'
}, {
value: 0,
label: '下架'
}],
verifyStatusOptions: [{
value: 1,
label: '审核通过'
}, {
value: 0,
label: '未审核'
}]
}
},
created() {
this.getList();
this.getBrandList();
this.getProductCateList();
},
watch: {
selectProductCateValue: function (newValue) {
if (newValue != null && newValue.length == 2) {
this.listQuery.productCategoryId = newValue[1];
} else {
this.listQuery.productCategoryId = null;
}
}
},
filters: {
verifyStatusFilter(value) {
if (value === 1) {
return '审核通过';
} else {
return '未审核';
}
}
},
methods: {
getProductSkuSp(row, index) {
let spData = JSON.parse(row.spData);
if(spData!=null&&index<spData.length){
return spData[index].value;
}else{
return null;
}
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
},
getBrandList() {
fetchBrandList({pageNum: 1, pageSize: 100}).then(response => {
this.brandOptions = [];
let brandList = response.data.list;
for (let i = 0; i < brandList.length; i++) {
this.brandOptions.push({label: brandList[i].name, value: brandList[i].id});
}
});
},
getProductCateList() {
fetchListWithChildren().then(response => {
let list = response.data;
this.productCateOptions = [];
for (let i = 0; i < list.length; i++) {
let children = [];
if (list[i].children != null && list[i].children.length > 0) {
for (let j = 0; j < list[i].children.length; j++) {
children.push({label: list[i].children[j].name, value: list[i].children[j].id});
}
}
this.productCateOptions.push({label: list[i].name, value: list[i].id, children: children});
}
});
},
handleShowSkuEditDialog(index,row){
this.editSkuInfo.dialogVisible=true;
this.editSkuInfo.productId=row.id;
this.editSkuInfo.productSn=row.productSn;
this.editSkuInfo.productAttributeCategoryId = row.productAttributeCategoryId;
this.editSkuInfo.keyword=null;
fetchSkuStockList(row.id,{keyword:this.editSkuInfo.keyword}).then(response=>{
this.editSkuInfo.stockList=response.data;
});
if(row.productAttributeCategoryId!=null){
fetchProductAttrList(row.productAttributeCategoryId,{type:0}).then(response=>{
this.editSkuInfo.productAttr=response.data.list;
});
}
},
handleSearchEditSku(){
fetchSkuStockList(this.editSkuInfo.productId,{keyword:this.editSkuInfo.keyword}).then(response=>{
this.editSkuInfo.stockList=response.data;
});
},
handleEditSkuConfirm(){
if(this.editSkuInfo.stockList==null||this.editSkuInfo.stockList.length<=0){
this.$message({
message: '暂无sku信息',
type: 'warning',
duration: 1000
});
return
}
this.$confirm('是否要进行修改', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(()=>{
updateSkuStockList(this.editSkuInfo.productId,this.editSkuInfo.stockList).then(response=>{
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
this.editSkuInfo.dialogVisible=false;
});
});
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleAddProduct() {
this.$router.push({path:'/pms/addProduct'});
},
handleBatchOperate() {
if(this.operateType==null){
this.$message({
message: '请选择操作类型',
type: 'warning',
duration: 1000
});
return;
}
if(this.multipleSelection==null||this.multipleSelection.length<1){
this.$message({
message: '请选择要操作的商品',
type: 'warning',
duration: 1000
});
return;
}
this.$confirm('是否要进行该批量操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let ids=[];
for(let i=0;i<this.multipleSelection.length;i++){
ids.push(this.multipleSelection[i].id);
}
switch (this.operateType) {
case this.operates[0].value:
this.updatePublishStatus(1,ids);
break;
case this.operates[1].value:
this.updatePublishStatus(0,ids);
break;
case this.operates[2].value:
this.updateRecommendStatus(1,ids);
break;
case this.operates[3].value:
this.updateRecommendStatus(0,ids);
break;
case this.operates[4].value:
this.updateNewStatus(1,ids);
break;
case this.operates[5].value:
this.updateNewStatus(0,ids);
break;
case this.operates[6].value:
break;
case this.operates[7].value:
this.updateDeleteStatus(1,ids);
break;
default:
break;
}
this.getList();
});
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handlePublishStatusChange(index, row) {
let ids = [];
ids.push(row.id);
this.updatePublishStatus(row.publishStatus, ids);
},
handleNewStatusChange(index, row) {
let ids = [];
ids.push(row.id);
this.updateNewStatus(row.newStatus, ids);
},
handleRecommendStatusChange(index, row) {
let ids = [];
ids.push(row.id);
this.updateRecommendStatus(row.recommandStatus, ids);
},
handleResetSearch() {
this.selectProductCateValue = [];
this.listQuery = Object.assign({}, defaultListQuery);
},
handleDelete(index, row){
this.$confirm('是否要进行删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let ids = [];
ids.push(row.id);
this.updateDeleteStatus(1,ids);
});
},
handleUpdateProduct(index,row){
this.$router.push({path:'/pms/updateProduct',query:{id:row.id}});
},
handleShowProduct(index,row){
console.log("handleShowProduct",row);
},
handleShowVerifyDetail(index,row){
console.log("handleShowVerifyDetail",row);
},
handleShowLog(index,row){
console.log("handleShowLog",row);
},
updatePublishStatus(publishStatus, ids) {
let params = new URLSearchParams();
params.append('ids', ids);
params.append('publishStatus', publishStatus);
updatePublishStatus(params).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
updateNewStatus(newStatus, ids) {
let params = new URLSearchParams();
params.append('ids', ids);
params.append('newStatus', newStatus);
updateNewStatus(params).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
updateRecommendStatus(recommendStatus, ids) {
let params = new URLSearchParams();
params.append('ids', ids);
params.append('recommendStatus', recommendStatus);
updateRecommendStatus(params).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
updateDeleteStatus(deleteStatus, ids) {
let params = new URLSearchParams();
params.append('ids', ids);
params.append('deleteStatus', deleteStatus);
updateDeleteStatus(params).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
});
this.getList();
}
}
}
</script>
<style></style>
<template> 
<product-detail :is-edit='true'></product-detail>
</template>
<script>
import ProductDetail from './components/ProductDetail'
export default {
name: 'updateProduct',
components: { ProductDetail }
}
</script>
<style>
</style>
<template>
<product-attr-detail :is-edit='false'></product-attr-detail>
</template>
<script>
import ProductAttrDetail from './components/ProductAttrDetail'
export default {
name: 'addProductAttr',
components: { ProductAttrDetail }
}
</script>
<style scoped>
</style>
<template>
<el-card class="form-container" shadow="never">
<el-form :model="productAttr" :rules="rules" ref="productAttrFrom" label-width="150px">
<el-form-item label="属性名称:" prop="name">
<el-input v-model="productAttr.name"></el-input>
</el-form-item>
<el-form-item label="商品类型:">
<el-select v-model="productAttr.productAttributeCategoryId" placeholder="请选择">
<el-option
v-for="item in productAttrCateList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="分类筛选样式:">
<el-radio-group v-model="productAttr.filterType">
<el-radio :label="0">普通</el-radio>
<el-radio :label="1">颜色</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="能否进行检索:">
<el-radio-group v-model="productAttr.searchType">
<el-radio :label="0">不需要检索</el-radio>
<el-radio :label="1">关键字检索</el-radio>
<el-radio :label="2">范围检索</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="商品属性关联:">
<el-radio-group v-model="productAttr.relatedStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="属性是否可选:">
<el-radio-group v-model="productAttr.selectType">
<el-radio :label="0">唯一</el-radio>
<el-radio :label="1">单选</el-radio>
<el-radio :label="2">复选</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="属性值的录入方式:">
<el-radio-group v-model="productAttr.inputType">
<el-radio :label="0">手工录入</el-radio>
<el-radio :label="1">从下面列表中选择</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="属性值可选值列表:">
<el-input :autosize="true" type="textarea" v-model="inputListFormat"></el-input>
</el-form-item>
<el-form-item label="是否支持手动新增:">
<el-radio-group v-model="productAttr.handAddStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序属性:">
<el-input v-model="productAttr.sort"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('productAttrFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('productAttrFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {fetchList} from '@/api/productAttrCate'
import {createProductAttr,getProductAttr,updateProductAttr} from '@/api/productAttr'
const defaultProductAttr = {
filterType: 0,
handAddStatus: 0,
inputList: '',
inputType: 0,
name: '',
productAttributeCategoryId: 0,
relatedStatus: 0,
searchType: 0,
selectType: 0,
sort: 0,
type: 0
};
export default {
name: "ProductAttrDetail",
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
productAttr: Object.assign({}, defaultProductAttr),
rules: {
name: [
{required: true, message: '请输入属性名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
]
},
productAttrCateList: null,
inputListFormat:null
}
},
created() {
if(this.isEdit){
getProductAttr(this.$route.query.id).then(response => {
this.productAttr = response.data;
this.inputListFormat = this.productAttr.inputList.replace(/,/g,'\n');
});
}else{
this.resetProductAttr();
}
this.getCateList();
},
watch:{
inputListFormat: function (newValue, oldValue) {
newValue = newValue.replace(/\n/g,',');
this.productAttr.inputList = newValue;
}
},
methods: {
getCateList() {
let listQuery = {pageNum: 1, pageSize: 100};
fetchList(listQuery).then(response => {
this.productAttrCateList = response.data.list;
});
},
resetProductAttr() {
this.productAttr = Object.assign({}, defaultProductAttr);
this.productAttr.productAttributeCategoryId = Number(this.$route.query.cid);
this.productAttr.type = Number(this.$route.query.type);
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(this.isEdit){
updateProductAttr(this.$route.query.id,this.productAttr).then(response=>{
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
this.$router.back();
});
}else{
createProductAttr(this.productAttr).then(response=>{
this.$message({
message: '提交成功',
type: 'success',
duration: 1000
});
this.resetForm('productAttrFrom');
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration: 1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.resetProductAttr();
}
},
}
</script>
<style scoped>
</style>
<template> 
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets" style="margin-top: 5px"></i>
<span style="margin-top: 5px">数据列表</span>
<el-button
class="btn-add"
@click="addProductAttrCate()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="productAttrCateTable"
style="width: 100%"
:data="list"
v-loading="listLoading"
border>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="类型名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="属性数量" width="200" align="center">
<template slot-scope="scope">{{scope.row.attributeCount==null?0:scope.row.attributeCount}}</template>
</el-table-column>
<el-table-column label="参数数量" width="200" align="center">
<template slot-scope="scope">{{scope.row.paramCount==null?0:scope.row.paramCount}}</template>
</el-table-column>
<el-table-column label="设置" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="getAttrList(scope.$index, scope.row)">属性列表
</el-button>
<el-button
size="mini"
@click="getParamList(scope.$index, scope.row)">参数列表
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
<el-dialog
:title="dialogTitle"
:visible.sync="dialogVisible"
:before-close="handleClose()"
width="30%">
<el-form ref="productAttrCatForm":model="productAttrCate" :rules="rules" label-width="120px">
<el-form-item label="类型名称" prop="name">
<el-input v-model="productAttrCate.name" auto-complete="off"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleConfirm('productAttrCatForm')">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchList,createProductAttrCate,deleteProductAttrCate,updateProductAttrCate} from '@/api/productAttrCate'
export default {
name: 'productAttrCateList',
data() {
return {
list: null,
total: null,
listLoading: true,
listQuery: {
pageNum: 1,
pageSize: 5
},
dialogVisible: false,
dialogTitle:'',
productAttrCate:{
name:'',
id:null
},
rules: {
name: [
{ required: true, message: '请输入类型名称', trigger: 'blur' }
]
}
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
},
addProductAttrCate() {
this.dialogVisible = true;
this.dialogTitle = "添加类型";
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteProductAttrCate(row.id).then(response=>{
this.$message({
message: '删除成功',
type: 'success',
duration:1000
});
this.getList();
});
});
},
handleUpdate(index, row) {
this.dialogVisible = true;
this.dialogTitle = "编辑类型";
this.productAttrCate.name = row.name;
this.productAttrCate.id = row.id;
},
getAttrList(index, row) {
this.$router.push({path: '/pms/productAttrList',query:{cid:row.id,cname:row.name,type:0}})
},
getParamList(index, row) {
this.$router.push({path: '/pms/productAttrList',query:{cid:row.id,cname:row.name,type:1}})
},
handleConfirm(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let data = new URLSearchParams();
data.append("name",this.productAttrCate.name);
if(this.dialogTitle==="添加类型"){
createProductAttrCate(data).then(response=>{
this.$message({
message: '添加成功',
type: 'success',
duration:1000
});
this.dialogVisible = false;
this.getList();
});
}else{
updateProductAttrCate(this.productAttrCate.id,data).then(response=>{
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.dialogVisible = false;
this.getList();
});
}
} else {
console.log('error submit!!');
return false;
}
});
},
handleClose(){
if (!this.dialogVisible && this.$refs.productAttrCatForm) {
this.$refs.productAttrCatForm.clearValidate()
}
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
<template> 
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets" style="margin-top: 5px"></i>
<span style="margin-top: 5px">数据列表</span>
<el-button
class="btn-add"
@click="addProductAttr()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="productAttrTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="属性名称" width="140" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="商品类型" width="140" align="center">
<template slot-scope="scope">{{$route.query.cname}}</template>
</el-table-column>
<el-table-column label="属性是否可选" width="120" align="center">
<template slot-scope="scope">{{scope.row.selectType|selectTypeFilter}}</template>
</el-table-column>
<el-table-column label="属性值的录入方式" width="150" align="center">
<template slot-scope="scope">{{scope.row.inputType|inputTypeFilter}}</template>
</el-table-column>
<el-table-column label="可选值列表" align="center">
<template slot-scope="scope">{{scope.row.inputList}}</template>
</el-table-column>
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteProductAttr} from '@/api/productAttr'
export default {
name: 'productAttrList',
data() {
return {
list: null,
total: null,
listLoading: true,
listQuery: {
pageNum: 1,
pageSize: 5,
type: this.$route.query.type
},
operateType: null,
multipleSelection: [],
operates: [
{
label: "删除",
value: "deleteProductAttr"
}
]
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.$route.query.cid, this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
},
addProductAttr() {
this.$router.push({path:'/pms/addProductAttr',query:{cid:this.$route.query.cid,type:this.$route.query.type}});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleBatchOperate() {
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
if (this.operateType !== 'deleteProductAttr') {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
this.handleDeleteProductAttr(ids);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleUpdate(index, row) {
this.$router.push({path:'/pms/updateProductAttr',query:{id:row.id}});
},
handleDeleteProductAttr(ids) {
this.$confirm('是否要删除该属性', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let data = new URLSearchParams();
data.append("ids", ids);
deleteProductAttr(data).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
handleDelete(index, row) {
let ids = [];
ids.push(row.id);
this.handleDeleteProductAttr(ids);
},
},
filters: {
inputTypeFilter(value) {
if (value === 1) {
return '从列表中选取';
} else {
return '手工录入'
}
},
selectTypeFilter(value) {
if (value === 1) {
return '单选';
} else if (value === 2) {
return '多选';
} else {
return '唯一'
}
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
<template>
<product-attr-detail :is-edit='true'></product-attr-detail>
</template>
<script>
import ProductAttrDetail from './components/ProductAttrDetail'
export default {
name: 'updateProductAttr',
components: { ProductAttrDetail }
}
</script>
<style scoped>
</style>
<template> 
<product-cate-detail :is-edit='false'></product-cate-detail>
</template>
<script>
import ProductCateDetail from './components/ProductCateDetail'
export default {
name: 'addProductCate',
components: { ProductCateDetail }
}
</script>
<style>
</style>
<template>
<el-card class="form-container" shadow="never">
<el-form :model="productCate"
:rules="rules"
ref="productCateFrom"
label-width="150px">
<el-form-item label="分类名称:" prop="name">
<el-input v-model="productCate.name"></el-input>
</el-form-item>
<el-form-item label="上级分类:">
<el-select v-model="productCate.parentId"
placeholder="请选择分类">
<el-option
v-for="item in selectProductCateList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="数量单位:">
<el-input v-model="productCate.productUnit"></el-input>
</el-form-item>
<el-form-item label="排序:">
<el-input v-model="productCate.sort"></el-input>
</el-form-item>
<el-form-item label="是否显示:">
<el-radio-group v-model="productCate.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否显示在导航栏:">
<el-radio-group v-model="productCate.navStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="分类图标:">
<single-upload v-model="productCate.icon"></single-upload>
</el-form-item>
<el-form-item v-for="(filterProductAttr, index) in filterProductAttrList"
:label="index | filterLabelFilter"
:key="filterProductAttr.key"
>
<el-cascader
clearable
v-model="filterProductAttr.value"
:options="filterAttrs">
</el-cascader>
<el-button style="margin-left: 20px" @click.prevent="removeFilterAttr(filterProductAttr)">删除</el-button>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="handleAddFilterAttr()">新增</el-button>
</el-form-item>
<el-form-item label="关键词:">
<el-input v-model="productCate.keywords"></el-input>
</el-form-item>
<el-form-item label="分类描述:">
<el-input type="textarea" :autosize="true" v-model="productCate.description"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('productCateFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('productCateFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {fetchList, createProductCate, updateProductCate, getProductCate} from '@/api/productCate';
import {fetchListWithAttr} from '@/api/productAttrCate';
import {getProductAttrInfo} from '@/api/productAttr';
import SingleUpload from '@/components/Upload/singleUpload';
const defaultProductCate = {
description: '',
icon: '',
keywords: '',
name: '',
navStatus: 0,
parentId: 0,
productUnit: '',
showStatus: 0,
sort: 0,
productAttributeIdList: []
};
export default {
name: "ProductCateDetail",
components: {SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
productCate: Object.assign({}, defaultProductCate),
selectProductCateList: [],
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
]
},
filterAttrs: [],
filterProductAttrList: [{
value: []
}]
}
},
created() {
if (this.isEdit) {
getProductCate(this.$route.query.id).then(response => {
this.productCate = response.data;
});
getProductAttrInfo(this.$route.query.id).then(response => {
if (response.data != null && response.data.length > 0) {
this.filterProductAttrList = [];
for (let i = 0; i < response.data.length; i++) {
this.filterProductAttrList.push({
key: Date.now() + i,
value: [response.data[i].attributeCategoryId, response.data[i].attributeId]
})
}
}
});
} else {
this.productCate = Object.assign({}, defaultProductCate);
}
this.getSelectProductCateList();
this.getProductAttrCateList();
},
methods: {
getSelectProductCateList() {
fetchList(0, {pageSize: 100, pageNum: 1}).then(response => {
this.selectProductCateList = response.data.list;
this.selectProductCateList.unshift({id: 0, name: '无上级分类'});
});
},
getProductAttrCateList() {
fetchListWithAttr().then(response => {
let list = response.data;
for (let i = 0; i < list.length; i++) {
let productAttrCate = list[i];
let children = [];
if (productAttrCate.productAttributeList != null && productAttrCate.productAttributeList.length > 0) {
for (let j = 0; j < productAttrCate.productAttributeList.length; j++) {
children.push({
label: productAttrCate.productAttributeList[j].name,
value: productAttrCate.productAttributeList[j].id
})
}
}
this.filterAttrs.push({label: productAttrCate.name, value: productAttrCate.id, children: children});
}
});
},
getProductAttributeIdList() {
//获取选中的筛选商品属性
let productAttributeIdList = [];
for (let i = 0; i < this.filterProductAttrList.length; i++) {
let item = this.filterProductAttrList[i];
if (item.value !== null && item.value.length === 2) {
productAttributeIdList.push(item.value[1]);
}
}
return productAttributeIdList;
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
this.productCate.productAttributeIdList = this.getProductAttributeIdList();
updateProductCate(this.$route.query.id, this.productCate).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
this.$router.back();
});
} else {
this.productCate.productAttributeIdList = this.getProductAttributeIdList();
createProductCate(this.productCate).then(response => {
this.$refs[formName].resetFields();
this.resetForm(formName);
this.$message({
message: '提交成功',
type: 'success',
duration: 1000
});
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration: 1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.productCate = Object.assign({}, defaultProductCate);
this.getSelectProductCateList();
this.filterProductAttrList = [{
value: []
}];
},
removeFilterAttr(productAttributeId) {
if (this.filterProductAttrList.length === 1) {
this.$message({
message: '至少要留一个',
type: 'warning',
duration: 1000
});
return;
}
var index = this.filterProductAttrList.indexOf(productAttributeId);
if (index !== -1) {
this.filterProductAttrList.splice(index, 1)
}
},
handleAddFilterAttr() {
if (this.filterProductAttrList.length === 3) {
this.$message({
message: '最多添加三个',
type: 'warning',
duration: 1000
});
return;
}
this.filterProductAttrList.push({
value: null,
key: Date.now()
});
}
},
filters: {
filterLabelFilter(index) {
if (index === 0) {
return '筛选属性:';
} else {
return '';
}
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets" style="margin-top: 5px"></i>
<span style="margin-top: 5px">数据列表</span>
<el-button
class="btn-add"
@click="handleAddProductCate()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="productCateTable"
style="width: 100%"
:data="list"
v-loading="listLoading" border>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="分类名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="级别" width="100" align="center">
<template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
</el-table-column>
<el-table-column label="商品数量" width="100" align="center">
<template slot-scope="scope">{{scope.row.productCount }}</template>
</el-table-column>
<el-table-column label="数量单位" width="100" align="center">
<template slot-scope="scope">{{scope.row.productUnit }}</template>
</el-table-column>
<el-table-column label="导航栏" width="100" align="center">
<template slot-scope="scope">
<el-switch
@change="handleNavStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.navStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="是否显示" width="100" align="center">
<template slot-scope="scope">
<el-switch
@change="handleShowStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort }}</template>
</el-table-column>
<el-table-column label="设置" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
:disabled="scope.row.level | disableNextLevel"
@click="handleShowNextLevel(scope.$index, scope.row)">查看下级
</el-button>
<el-button
size="mini"
@click="handleTransferProduct(scope.$index, scope.row)">转移商品
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList,deleteProductCate,updateShowStatus,updateNavStatus} from '@/api/productCate'
export default {
name: "productCateList",
data() {
return {
list: null,
total: null,
listLoading: true,
listQuery: {
pageNum: 1,
pageSize: 5
},
parentId: 0
}
},
created() {
this.resetParentId();
this.getList();
},
watch: {
$route(route) {
this.resetParentId();
this.getList();
}
},
methods: {
resetParentId(){
this.listQuery.pageNum = 1;
if (this.$route.query.parentId != null) {
this.parentId = this.$route.query.parentId;
} else {
this.parentId = 0;
}
},
handleAddProductCate() {
this.$router.push('/pms/addProductCate');
},
getList() {
this.listLoading = true;
fetchList(this.parentId, this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleNavStatusChange(index, row) {
let data = new URLSearchParams();
let ids=[];
ids.push(row.id)
data.append('ids',ids);
data.append('navStatus',row.navStatus);
updateNavStatus(data).then(response=>{
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleShowStatusChange(index, row) {
let data = new URLSearchParams();
let ids=[];
ids.push(row.id)
data.append('ids',ids);
data.append('showStatus',row.showStatus);
updateShowStatus(data).then(response=>{
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleShowNextLevel(index, row) {
this.$router.push({path: '/pms/productCate', query: {parentId: row.id}})
},
handleTransferProduct(index, row) {
console.log('handleAddProductCate');
},
handleUpdate(index, row) {
this.$router.push({path:'/pms/updateProductCate',query:{id:row.id}});
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteProductCate(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
}
},
filters: {
levelFilter(value) {
if (value === 0) {
return '一级';
} else if (value === 1) {
return '二级';
}
},
disableNextLevel(value) {
if (value === 0) {
return false;
} else {
return true;
}
}
}
}
</script>
<style scoped>
</style>
<template> 
<product-cate-detail :is-edit='true'></product-cate-detail>
</template>
<script>
import ProductCateDetail from './components/ProductCateDetail'
export default {
name: 'updateProductCate',
components: { ProductCateDetail }
}
</script>
<style>
</style>
<template>
<div class="container">
<!-- <h1>resourceStore</h1> -->
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
@submit.native.prevent
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
@keyup.enter.native="handleSearchList()"
></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button class="btn-add" @click="handleAddProduct" size="mini">
添加
</el-button>
<!-- <el-button class="btn-add" @click="handleStuDetail()" size="mini">
stuDetail
</el-button> -->
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="60">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="名称" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.nameCn }}
</div>
</template>
</el-table-column>
<el-table-column label="名称(英文名)" align="center">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<!-- <el-table-column label="显示名称" align="center">
<template slot-scope="scope">{{ scope.row.engName }}</template>
</el-table-column> -->
<!-- <el-table-column label="家具数量" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column> -->
<el-table-column label="描述" align="center">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column>
<el-table-column label="分类类别" align="center">
<template slot-scope="scope">{{ scope.row.classifyType }}</template>
</el-table-column>
<el-table-column label="分类排序" align="center">
<template slot-scope="scope">{{ scope.row.classifySort }}</template>
</el-table-column>
<el-table-column label="app内排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column>
<el-table-column label="图片" align="center">
<template slot-scope="scope">
<div class="picBox">
<el-image
style="width: 100rem; height: 100rem"
:src="scope.row.storeUrl"
>
</el-image>
</div>
</template>
</el-table-column>
<!-- <el-table-column label="是否摆放" align="center">
<template slot-scope="scope">{{
scope.row.placeState == 0
? "已摆放"
: scope.row.placeState == 1
? "未摆放"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">{{
scope.row.state == 0
? "已购买"
: scope.row.state == 1
? "未购买"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="是否广告购买" align="center">
<template slot-scope="scope">{{
scope.row.isAdvertiseBuy == 0
? "是"
: scope.row.isAdvertiseBuy == 1
? "否"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="能否移动" align="center">
<template slot-scope="scope">{{
scope.row.isMove == 0 ? "能" : scope.row.isMove == 1 ? "否" : ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> -->
<el-table-column label="增加的数量" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column>
<el-table-column label="增加的资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column>
<el-table-column label="所需第一种资源编号" align="center">
<template slot-scope="scope">{{
scope.row.firstResourceCode
}}</template>
</el-table-column>
<el-table-column label="所需第一种资源数量" align="center">
<template slot-scope="scope">{{
scope.row.firstResourceNum
}}</template>
</el-table-column>
<!-- <el-table-column label="美式发音" align="center">
<template slot-scope="scope">{{ scope.row.usPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<div class="btn">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
<el-button
@click="handleWordDelete(scope.row.id)"
size="mini"
type="danger"
>删除</el-button
>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import {
getPageResourceStore,
deleteByPrimaryKeyResourceStore
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageResourceStore(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/resourceStore/resourceStoreDetail",
query: {
id: id
}
});
// console.log(123);
},
handleAddProduct() {
// 添加
this.$router.push({ path: "/resourceStore/resourceStoreAdd" });
},
handleWordDelete(id) {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteByPrimaryKeyResourceStore(id).then(res => {
this.$message({
type: "success",
message: "删除成功!"
});
this.getData();
});
});
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
.picBox {
display: flex;
justify-content: center;
align-items: center;
.pic {
width: 100rem;
object-fit: contain;
}
}
.btn {
display: flex;
justify-content: center;
align-items: center;
}
</style>
<template>
<div class="container">
<!-- <h1>resourceStore</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.nameCn"></el-input>
</el-col>
</el-form-item>
<el-form-item label="任务名称(英文名)" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="显示名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.engName"></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="描述" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item>
<el-form-item label="分类类别" prop="classifyType">
<el-col :span="11">
<el-input v-model="list.classifyType"></el-input>
</el-col>
</el-form-item>
<el-form-item label="分类排序" prop="classifySort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.classifySort"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="增加的数量" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="增加的资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="所需第一种资源编号" prop="firstResourceCode">
<el-col :span="11">
<el-input v-model="list.firstResourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="所需第一种资源数量" prop="firstResourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.firstResourceNum"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="容量" prop="vol">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.vol"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="状态" prop="state">
<el-col :span="11">
<el-select v-model="list.state" placeholder="请选择">
<el-option
v-for="item in stateList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="是否广告购买" prop="isAdvertiseBuy">
<el-col :span="11">
<el-select v-model="list.isAdvertiseBuy" placeholder="请选择">
<el-option
v-for="item in isAdvertiseBuyList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="能否移动" prop="isMove">
<el-col :span="11">
<el-select v-model="list.isMove" placeholder="请选择">
<el-option
v-for="item in isMoveList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="商品图片" prop="storeUrl">
<el-col :span="11">
<img :src="list.storeUrl" alt="" />
</el-col>
</el-form-item> -->
<el-form-item label="上传图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${2}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogUrl" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源数值" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getResourceStoreById,
insertSelectiveResourceStore
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "resourceStoreAdd",
data() {
return {
id: "",
list: {},
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
name: [{ required: true, message: "必填", trigger: "blur" }],
intro: [{ required: true, message: "必填", trigger: "blur" }],
classifyType: [{ required: true, message: "必填", trigger: "blur" }],
classifySort: [{ required: true, message: "必填", trigger: "blur" }],
sort: [{ required: true, message: "必填", trigger: "blur" }],
num: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
firstResourceCode: [
{ required: true, message: "必填", trigger: "blur" }
],
firstResourceNum: [
{ required: true, message: "必填", trigger: "blur" }
],
type: [{ required: true, message: "必填", trigger: "change" }],
isAdvertiseBuy: [
{ required: true, message: "必填", trigger: "change" }
],
isMove: [{ required: true, message: "必填", trigger: "change" }]
},
typeList: [
{
value: 1,
label: "新手引导任务"
},
{
value: 2,
label: "每日任务"
}
],
stateList: [
{
value: 0,
label: "已购买"
},
{
value: 1,
label: "未购买"
}
],
isAdvertiseBuyList: [
{
value: 0,
label: "是"
},
{
value: 1,
label: "否"
}
],
isMoveList: [
{
value: 0,
label: "能"
},
{
value: 1,
label: "否"
}
],
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getResourceStoreById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid && this.list.storeUrl) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
insertSelectiveResourceStore(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
let arr = this.fileList.filter(item => {
return item.url !== file.url;
});
this.fileList = arr;
console.log(this.fileList, "this.fileList");
},
handlePreview(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.fileList.shift();
this.fileList.push(arr);
// console.log(this.fileList, "this.fileList");
this.list.storeUrl = res.data.url;
console.log(res);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
// this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>resourceStore</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.nameCn"></el-input>
</el-col>
</el-form-item>
<el-form-item label="任务名称(英文名)" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="显示名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.engName"></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="描述" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item>
<el-form-item label="分类类别" prop="classifyType">
<el-col :span="11">
<el-input v-model="list.classifyType"></el-input>
</el-col>
</el-form-item>
<el-form-item label="分类排序" prop="classifySort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.classifySort"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="增加的数量" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="增加的资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="所需第一种资源编号" prop="firstResourceCode">
<el-col :span="11">
<el-input v-model="list.firstResourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="所需第一种资源数量" prop="firstResourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.firstResourceNum"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="容量" prop="vol">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.vol"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="状态" prop="state">
<el-col :span="11">
<el-select v-model="list.state" placeholder="请选择">
<el-option
v-for="item in stateList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="是否广告购买" prop="isAdvertiseBuy">
<el-col :span="11">
<el-select v-model="list.isAdvertiseBuy" placeholder="请选择">
<el-option
v-for="item in isAdvertiseBuyList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="能否移动" prop="isMove">
<el-col :span="11">
<el-select v-model="list.isMove" placeholder="请选择">
<el-option
v-for="item in isMoveList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="商品图片" prop="storeUrl">
<el-col :span="11">
<img :src="list.storeUrl" alt="" />
</el-col>
</el-form-item> -->
<el-form-item label="上传图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${2}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogUrl" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源数值" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getResourceStoreById,
updateByPrimaryKeySelectiveResourceStore
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "resourceStoreDetail",
data() {
return {
id: "",
list: {},
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
name: [{ required: true, message: "必填", trigger: "blur" }],
intro: [{ required: true, message: "必填", trigger: "blur" }],
classifyType: [{ required: true, message: "必填", trigger: "blur" }],
classifySort: [{ required: true, message: "必填", trigger: "blur" }],
sort: [{ required: true, message: "必填", trigger: "blur" }],
num: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
firstResourceCode: [
{ required: true, message: "必填", trigger: "blur" }
],
firstResourceNum: [
{ required: true, message: "必填", trigger: "blur" }
],
type: [{ required: true, message: "必填", trigger: "change" }],
isAdvertiseBuy: [
{ required: true, message: "必填", trigger: "change" }
],
isMove: [{ required: true, message: "必填", trigger: "change" }]
},
typeList: [
{
value: 1,
label: "新手引导任务"
},
{
value: 2,
label: "每日任务"
}
],
stateList: [
{
value: 0,
label: "已购买"
},
{
value: 1,
label: "未购买"
}
],
isAdvertiseBuyList: [
{
value: 0,
label: "是"
},
{
value: 1,
label: "否"
}
],
isMoveList: [
{
value: 0,
label: "能"
},
{
value: 1,
label: "否"
}
],
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getResourceStoreById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
this.fileList.push({ url: this.list.storeUrl });
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid && this.list.storeUrl) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveResourceStore(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
let arr = this.fileList.filter(item => {
return item.url !== file.url;
});
this.fileList = arr;
console.log(this.fileList, "this.fileList");
},
handlePreview(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.fileList.shift();
this.fileList.push(arr);
// console.log(this.fileList, "this.fileList");
this.list.storeUrl = res.data.url;
console.log(res);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>rmbStoreDetail</h1> -->
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
@submit.native.prevent
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
@keyup.enter.native="handleSearchList()"
></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button class="btn-add" @click="handleAddProduct" size="mini">
添加
</el-button>
<!-- <el-button class="btn-add" @click="handleStuDetail()" size="mini">
stuDetail
</el-button> -->
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="60">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="名称" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.name }}
</div>
</template>
</el-table-column>
<el-table-column label="价格/元" align="center">
<template slot-scope="scope">{{ scope.row.price }}</template>
</el-table-column>
<!-- <el-table-column label="显示名称" align="center">
<template slot-scope="scope">{{ scope.row.engName }}</template>
</el-table-column> -->
<!-- <el-table-column label="家具数量" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column> -->
<!-- <el-table-column label="描述" align="center">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column> -->
<el-table-column label="分类类别" align="center">
<template slot-scope="scope">{{ scope.row.classifyType }}</template>
</el-table-column>
<el-table-column label="分类排序" align="center">
<template slot-scope="scope">{{ scope.row.classifySort }}</template>
</el-table-column>
<el-table-column label="app内排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column>
<el-table-column label="图片" align="center">
<template slot-scope="scope">
<!-- <div
class="picBox"
v-for="(item, index) in scope.row.storeUrl"
:key="index"
>
<el-image
style="width: 100rem; height: 100rem"
:src="item"
:preview-src-list="scope.row.storeUrl"
>
</el-image>
</div> -->
<div class="picBox">
<el-image
style="width: 100rem; height: 100rem"
:src="scope.row.productUrl"
>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">{{
scope.row.type == 1
? "免费"
: scope.row.type == 2
? "广告"
: scope.row.type == 3
? "rmb礼包"
: scope.row.type == 4
? "限购1次"
: ""
}}</template>
</el-table-column>
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">{{
scope.row.state == 0
? "已购买"
: scope.row.state == 1
? "未购买"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="是否广告购买" align="center">
<template slot-scope="scope">{{
scope.row.isAdvertiseBuy == 0
? "是"
: scope.row.isAdvertiseBuy == 1
? "否"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="能否移动" align="center">
<template slot-scope="scope">{{
scope.row.isMove == 0 ? "能" : scope.row.isMove == 1 ? "否" : ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> -->
<!-- <el-table-column label="增加的数量" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column> -->
<!-- <el-table-column label="增加的资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column> -->
<!-- <el-table-column label="所需第一种资源编号" align="center">
<template slot-scope="scope">{{
scope.row.firstResourceCode
}}</template>
</el-table-column> -->
<!-- <el-table-column label="所需第一种资源数量" align="center">
<template slot-scope="scope">{{
scope.row.firstResourceNum
}}</template>
</el-table-column> -->
<!-- <el-table-column label="美式发音" align="center">
<template slot-scope="scope">{{ scope.row.usPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<div class="btn">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
<el-button
@click="handleWordDelete(scope.row.id)"
size="mini"
type="danger"
>删除</el-button
>
<el-button @click="handleWordResource(scope.row.id)" size="mini"
>查看资源</el-button
>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { getPageRmbStore, deleteByPrimaryKeyRmbStore } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageRmbStore(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/rmbStore/rmbStoreDetail",
query: {
id: id
}
});
// console.log(123);
},
handleWordResource(id) {
// console.log(id, typeof id);
this.$router.push({
path: "/rmbStore/rmbStoreResourceIndex",
query: {
id: id
}
});
},
handleAddProduct() {
// 添加
this.$router.push({ path: "/rmbStore/rmbStoreAdd" });
},
handleWordDelete(id) {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteByPrimaryKeyRmbStore(id).then(res => {
this.$message({
type: "success",
message: "删除成功!"
});
this.getData();
});
});
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
.picBox {
display: flex;
justify-content: center;
align-items: center;
.pic {
width: 100rem;
object-fit: contain;
}
}
.btn {
// width: 100%;
// display: flex;
// flex-direction: column;
// justify-content: center;
// align-items: center;
// background-color: red;
}
</style>
<template>
<div class="container">
<!-- <h1>rmbStore</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="名称" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="任务名称(英文名)" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="显示名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.engName"></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="价格/元" prop="price">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.price"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="分类类别" prop="classifyType">
<el-col :span="11">
<el-input v-model="list.classifyType"></el-input>
</el-col>
</el-form-item>
<el-form-item label="分类排序" prop="classifySort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.classifySort"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="增加的数量" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="增加的资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="所需第一种资源编号" prop="firstResourceCode">
<el-col :span="11">
<el-input v-model="list.firstResourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="所需第一种资源数量" prop="firstResourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.firstResourceNum"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="容量" prop="vol">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.vol"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<!-- <el-form-item label="是否广告购买" prop="isAdvertiseBuy">
<el-col :span="11">
<el-select v-model="list.isAdvertiseBuy" placeholder="请选择">
<el-option
v-for="item in isAdvertiseBuyList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="能否移动" prop="isMove">
<el-col :span="11">
<el-select v-model="list.isMove" placeholder="请选择">
<el-option
v-for="item in isMoveList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="商品图片" prop="productUrl">
<el-col :span="11">
<img :src="list.productUrl" alt="" />
</el-col>
</el-form-item> -->
<el-form-item label="商品图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${2}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogUrl" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源数值" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import { getRmbStoreById, insertSelectiveRmbStore } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "rmbStoreDetail",
data() {
return {
id: "",
list: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
price: [{ required: true, message: "必填", trigger: "blur" }],
classifyType: [{ required: true, message: "必填", trigger: "blur" }],
classifySort: [{ required: true, message: "必填", trigger: "blur" }],
sort: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }]
},
typeList: [
{
value: 1,
label: "免费"
},
{
value: 2,
label: "广告"
},
{
value: 3,
label: "rmb礼包"
},
{
value: 4,
label: "限购1次"
}
],
stateList: [
{
value: 0,
label: "已购买"
},
{
value: 1,
label: "未购买"
}
],
isAdvertiseBuyList: [
{
value: 0,
label: "是"
},
{
value: 1,
label: "否"
}
],
isMoveList: [
{
value: 0,
label: "能"
},
{
value: 1,
label: "否"
}
],
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getRmbStoreById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid && this.list.productUrl) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
insertSelectiveRmbStore(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
let arr = this.fileList.filter(item => {
return item.url !== file.url;
});
this.fileList = arr;
console.log(this.fileList, "this.fileList");
},
handlePreview(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.fileList.shift();
this.fileList.push(arr);
// console.log(this.fileList, "this.fileList");
this.list.productUrl = res.data.url;
console.log(res);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
// this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>rmbStore</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="名称" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="任务名称(英文名)" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="显示名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.engName"></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="价格/元" prop="price">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.price"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="分类类别" prop="classifyType">
<el-col :span="11">
<el-input v-model="list.classifyType"></el-input>
</el-col>
</el-form-item>
<el-form-item label="分类排序" prop="classifySort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.classifySort"
></el-input>
</el-col>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="增加的数量" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="增加的资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="所需第一种资源编号" prop="firstResourceCode">
<el-col :span="11">
<el-input v-model="list.firstResourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="所需第一种资源数量" prop="firstResourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.firstResourceNum"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="容量" prop="vol">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.vol"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<!-- <el-form-item label="是否广告购买" prop="isAdvertiseBuy">
<el-col :span="11">
<el-select v-model="list.isAdvertiseBuy" placeholder="请选择">
<el-option
v-for="item in isAdvertiseBuyList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="能否移动" prop="isMove">
<el-col :span="11">
<el-select v-model="list.isMove" placeholder="请选择">
<el-option
v-for="item in isMoveList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="商品图片" prop="productUrl">
<el-col :span="11">
<img :src="list.productUrl" alt="" />
</el-col>
</el-form-item> -->
<el-form-item label="商品图片">
<el-upload
:action="`${$BASE_URL}/admin/storage/upload/${2}`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="fileList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogUrl" alt="" />
</el-dialog>
</el-form-item>
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源数值" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getRmbStoreById,
updateByPrimaryKeySelectiveRmbStore
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "rmbStoreDetail",
data() {
return {
id: "",
list: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
price: [{ required: true, message: "必填", trigger: "blur" }],
classifyType: [{ required: true, message: "必填", trigger: "blur" }],
classifySort: [{ required: true, message: "必填", trigger: "blur" }],
sort: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }]
},
typeList: [
{
value: 1,
label: "免费"
},
{
value: 2,
label: "广告"
},
{
value: 3,
label: "rmb礼包"
},
{
value: 4,
label: "限购1次"
}
],
stateList: [
{
value: 0,
label: "已购买"
},
{
value: 1,
label: "未购买"
}
],
isAdvertiseBuyList: [
{
value: 0,
label: "是"
},
{
value: 1,
label: "否"
}
],
isMoveList: [
{
value: 0,
label: "能"
},
{
value: 1,
label: "否"
}
],
token: "",
dialogVisible: false,
dialogUrl: "",
fileList: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getRmbStoreById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
this.fileList.push({ url: this.list.productUrl });
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid && this.list.productUrl) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveRmbStore(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleRemove(file, fileList) {
let arr = this.fileList.filter(item => {
return item.url !== file.url;
});
this.fileList = arr;
console.log(this.fileList, "this.fileList");
},
handlePreview(file) {
this.dialogUrl = file.url;
this.dialogVisible = true;
},
handleSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.fileList.shift();
this.fileList.push(arr);
// console.log(this.fileList, "this.fileList");
this.list.productUrl = res.data.url;
console.log(res);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>rmbStoreResource</h1> -->
<!-- <el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
>
<el-form-item label="关键字:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
></el-input>
</el-form-item>
</el-form>
</div>
</el-card> -->
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button class="btn-add" @click="handleAddProduct" size="mini">
添加
</el-button>
<!-- <el-button class="btn-add" @click="handleStuDetail()" size="mini">
stuDetail
</el-button> -->
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="60">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="中文名" align="center">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.nameCn }}
</div>
</template>
</el-table-column>
<!-- <el-table-column label="英文名" align="center">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> -->
<el-table-column label="资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column>
<el-table-column label="资源数量" align="center">
<template slot-scope="scope">{{ scope.row.resourceNum }}</template>
</el-table-column>
<!-- <el-table-column label="描述" align="center">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column> -->
<!-- <el-table-column label="分类类别" align="center">
<template slot-scope="scope">{{ scope.row.classifyType }}</template>
</el-table-column> -->
<!-- <el-table-column label="分类排序" align="center">
<template slot-scope="scope">{{ scope.row.classifySort }}</template>
</el-table-column> -->
<!-- <el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> -->
<!-- <el-table-column label="图片" align="center">
<template slot-scope="scope">
<div class="picBox">
<el-image
style="width: 100rem; height: 100rem"
:src="scope.row.productUrl"
>
</el-image>
</div>
</template>
</el-table-column> -->
<!-- <el-table-column label="类型" align="center">
<template slot-scope="scope">{{
scope.row.type == 1
? "免费"
: scope.row.type == 2
? "广告"
: scope.row.type == 3
? "rmb礼包"
: scope.row.type == 4
? "限购1次"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">{{
scope.row.state == 0
? "已购买"
: scope.row.state == 1
? "未购买"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="是否广告购买" align="center">
<template slot-scope="scope">{{
scope.row.isAdvertiseBuy == 0
? "是"
: scope.row.isAdvertiseBuy == 1
? "否"
: ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="能否移动" align="center">
<template slot-scope="scope">{{
scope.row.isMove == 0 ? "能" : scope.row.isMove == 1 ? "否" : ""
}}</template>
</el-table-column> -->
<!-- <el-table-column label="排序" align="center">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> -->
<!-- <el-table-column label="增加的数量" align="center">
<template slot-scope="scope">{{ scope.row.num }}</template>
</el-table-column> -->
<!-- <el-table-column label="增加的资源编号" align="center">
<template slot-scope="scope">{{ scope.row.resourceCode }}</template>
</el-table-column> -->
<!-- <el-table-column label="所需第一种资源编号" align="center">
<template slot-scope="scope">{{
scope.row.firstResourceCode
}}</template>
</el-table-column> -->
<!-- <el-table-column label="所需第一种资源数量" align="center">
<template slot-scope="scope">{{
scope.row.firstResourceNum
}}</template>
</el-table-column> -->
<!-- <el-table-column label="美式发音" align="center">
<template slot-scope="scope">{{ scope.row.usPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column>
<el-table-column label="英式发音" align="center">
<template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
</el-table-column> -->
<!-- <el-table-column label="词根" align="center">
<template slot-scope="scope">{{ scope.row.etyma }}</template>
</el-table-column> -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<div class="btn">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
<el-button
@click="handleWordDelete(scope.row.id)"
size="mini"
type="danger"
>删除</el-button
>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import {
getRmbStoreResource,
deleteByPrimaryKeyRmbStoreResource
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
rmbStoreId: "",
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getRmbStoreResource(this.rmbStoreId).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/rmbStore/rmbStoreResourceDetail",
query: {
id: id
}
});
// console.log(123);
},
handleAddProduct() {
// 添加
this.$router.push({
path: "/rmbStore/rmbStoreResourceAdd",
query: {
id: this.rmbStoreId
}
});
},
handleWordDelete(id) {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteByPrimaryKeyRmbStoreResource(id).then(res => {
this.$message({
type: "success",
message: "删除成功!"
});
this.getData();
});
});
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.rmbStoreId = this.$route.query.id;
// console.log(this.rmbStoreId, "this.rmbStoreId", typeof this.rmbStoreId);
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
.picBox {
display: flex;
justify-content: center;
align-items: center;
.pic {
width: 100rem;
object-fit: contain;
}
}
.btn {
display: flex;
justify-content: center;
align-items: center;
}
</style>
<template>
<div class="container">
<!-- <h1>rmbStoreResource</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.nameCn"></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="英文名" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="资源数量" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="分类类别" prop="classifyType">
<el-col :span="11">
<el-input v-model="list.classifyType"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="分类排序" prop="classifySort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.classifySort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="增加的数量" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="增加的资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="所需第一种资源编号" prop="firstResourceCode">
<el-col :span="11">
<el-input v-model="list.firstResourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="所需第一种资源数量" prop="firstResourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.firstResourceNum"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="容量" prop="vol">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.vol"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="是否广告购买" prop="isAdvertiseBuy">
<el-col :span="11">
<el-select v-model="list.isAdvertiseBuy" placeholder="请选择">
<el-option
v-for="item in isAdvertiseBuyList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="能否移动" prop="isMove">
<el-col :span="11">
<el-select v-model="list.isMove" placeholder="请选择">
<el-option
v-for="item in isMoveList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="商品图片" prop="productUrl">
<el-col :span="11">
<img :src="list.productUrl" alt="" />
</el-col>
</el-form-item> -->
<!-- <el-form-item label="上传图片">
<el-upload
:action="`${$BASE_URL}/storage/upload`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="idCardfileList"
:on-preview="handleIdCardPreview"
:on-remove="handleIdCardRemove"
:on-success="handleIdCardSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogIdCardVisible">
<img width="100%" :src="dialogIdCardUrl" alt="" />
</el-dialog>
</el-form-item> -->
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源数值" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getRmbStoreResourceById,
insertSelectiveRmbStoreResource
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "rmbStoreResourceAdd",
data() {
return {
id: "",
list: {},
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
name: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
resourceNum: [{ required: true, message: "必填", trigger: "blur" }]
},
typeList: [
{
value: 1,
label: "免费"
},
{
value: 2,
label: "广告"
},
{
value: 3,
label: "rmb礼包"
},
{
value: 4,
label: "限购1次"
}
],
stateList: [
{
value: 0,
label: "已购买"
},
{
value: 1,
label: "未购买"
}
],
isAdvertiseBuyList: [
{
value: 0,
label: "是"
},
{
value: 1,
label: "否"
}
],
isMoveList: [
{
value: 0,
label: "能"
},
{
value: 1,
label: "否"
}
],
token: "",
dialogIdCardVisible: false,
dialogIdCardUrl: "",
idCardfileList: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getRmbStoreResourceById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
// console.log(this.list);
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
insertSelectiveRmbStoreResource(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleIdCardRemove(file, fileList) {
let arr = this.idCardfileList.filter(item => {
return item.url !== file.url;
});
this.idCardfileList = arr;
console.log(this.idCardfileList, "this.idCardfileList");
},
handleIdCardPreview(file) {
this.dialogIdCardUrl = file.url;
this.dialogIdCardVisible = true;
},
handleIdCardSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.idCardfileList.push(arr);
console.log(this.idCardfileList, "this.idCardfileList");
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id * 1;
// console.log(this.id, "this.id", typeof this.id);
this.list.rmbStoreId = this.id;
// this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<!-- <h1>rmbStoreResource</h1> -->
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="150px"
class="demo-ruleForm"
>
<el-form-item label="名称" prop="nameCn">
<el-col :span="11">
<el-input v-model="list.nameCn"></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="英文名" prop="name">
<el-col :span="11">
<el-input v-model="list.name"></el-input>
</el-col>
</el-form-item> -->
<el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item>
<el-form-item label="资源数量" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item>
<!-- <el-form-item label="分类类别" prop="classifyType">
<el-col :span="11">
<el-input v-model="list.classifyType"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="分类排序" prop="classifySort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.classifySort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="增加的数量" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="增加的资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="所需第一种资源编号" prop="firstResourceCode">
<el-col :span="11">
<el-input v-model="list.firstResourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="所需第一种资源数量" prop="firstResourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.firstResourceNum"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="容量" prop="vol">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.vol"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="类型" prop="type">
<el-col :span="11">
<el-select v-model="list.type" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="是否广告购买" prop="isAdvertiseBuy">
<el-col :span="11">
<el-select v-model="list.isAdvertiseBuy" placeholder="请选择">
<el-option
v-for="item in isAdvertiseBuyList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="能否移动" prop="isMove">
<el-col :span="11">
<el-select v-model="list.isMove" placeholder="请选择">
<el-option
v-for="item in isMoveList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="商品图片" prop="productUrl">
<el-col :span="11">
<img :src="list.productUrl" alt="" />
</el-col>
</el-form-item> -->
<!-- <el-form-item label="上传图片">
<el-upload
:action="`${$BASE_URL}/storage/upload`"
:headers="headers"
list-type="picture-card"
name="file"
:file-list="idCardfileList"
:on-preview="handleIdCardPreview"
:on-remove="handleIdCardRemove"
:on-success="handleIdCardSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogIdCardVisible">
<img width="100%" :src="dialogIdCardUrl" alt="" />
</el-dialog>
</el-form-item> -->
<!-- <el-form-item label="排序" prop="sort">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.sort"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="目标数" prop="num">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.num"
></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源编号" prop="resourceCode">
<el-col :span="11">
<el-input v-model="list.resourceCode"></el-input>
</el-col>
</el-form-item> -->
<!-- <el-form-item label="资源数值" prop="resourceNum">
<el-col :span="11">
<el-input
oninput="value=value.replace(/[^\d]|^[0]/g, '')"
v-model.number="list.resourceNum"
></el-input>
</el-col>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getRmbStoreResourceById,
updateByPrimaryKeySelectiveRmbStoreResource
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
import { getToken } from "@/utils/auth";
export default {
name: "rmbStoreResourceDetail",
data() {
return {
id: "",
list: {},
rules: {
nameCn: [{ required: true, message: "必填", trigger: "blur" }],
name: [{ required: true, message: "必填", trigger: "blur" }],
resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
resourceNum: [{ required: true, message: "必填", trigger: "blur" }]
},
typeList: [
{
value: 1,
label: "免费"
},
{
value: 2,
label: "广告"
},
{
value: 3,
label: "rmb礼包"
},
{
value: 4,
label: "限购1次"
}
],
stateList: [
{
value: 0,
label: "已购买"
},
{
value: 1,
label: "未购买"
}
],
isAdvertiseBuyList: [
{
value: 0,
label: "是"
},
{
value: 1,
label: "否"
}
],
isMoveList: [
{
value: 0,
label: "能"
},
{
value: 1,
label: "否"
}
],
token: "",
dialogIdCardVisible: false,
dialogIdCardUrl: "",
idCardfileList: []
};
},
computed: {
headers() {
return {
Authorization: this.token
};
}
},
methods: {
getData() {
getRmbStoreResourceById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveRmbStoreResource(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
this.$message({
type: "warning",
message: "全部必填!"
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleIdCardRemove(file, fileList) {
let arr = this.idCardfileList.filter(item => {
return item.url !== file.url;
});
this.idCardfileList = arr;
console.log(this.idCardfileList, "this.idCardfileList");
},
handleIdCardPreview(file) {
this.dialogIdCardUrl = file.url;
this.dialogIdCardVisible = true;
},
handleIdCardSuccess(res, file, fileList) {
let arr = {};
arr.url = res.data.url;
this.idCardfileList.push(arr);
console.log(this.idCardfileList, "this.idCardfileList");
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
this.token = getToken();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template> 
<home-advertise-detail :isEdit="false"></home-advertise-detail>
</template>
<script>
import HomeAdvertiseDetail from './components/HomeAdvertiseDetail'
export default {
name: 'addHomeAdvertise',
components: { HomeAdvertiseDetail }
}
</script>
<style></style>
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="homeAdvertise"
:rules="rules"
ref="homeAdvertiseFrom"
label-width="150px"
size="small">
<el-form-item label="广告名称:" prop="name">
<el-input v-model="homeAdvertise.name" class="input-width"></el-input>
</el-form-item>
<el-form-item label="广告位置:">
<el-select v-model="homeAdvertise.type">
<el-option
v-for="type in typeOptions"
:key="type.value"
:label="type.label"
:value="type.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="开始时间:" prop="startTime">
<el-date-picker
type="datetime"
placeholder="选择日期"
v-model="homeAdvertise.startTime"></el-date-picker>
</el-form-item>
<el-form-item label="到期时间:" prop="endTime">
<el-date-picker
type="datetime"
placeholder="选择日期"
v-model="homeAdvertise.endTime"></el-date-picker>
</el-form-item>
<el-form-item label="上线/下线:">
<el-radio-group v-model="homeAdvertise.status">
<el-radio :label="0">下线</el-radio>
<el-radio :label="1">上线</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="广告图片:">
<single-upload v-model="homeAdvertise.pic"></single-upload>
</el-form-item>
<el-form-item label="排序:">
<el-input v-model="homeAdvertise.sort" class="input-width"></el-input>
</el-form-item>
<el-form-item label="广告链接:" prop="url">
<el-input v-model="homeAdvertise.url" class="input-width"></el-input>
</el-form-item>
<el-form-item label="广告备注:">
<el-input
class="input-width"
type="textarea"
:rows="5"
placeholder="请输入内容"
v-model="homeAdvertise.note">
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('homeAdvertiseFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('homeAdvertiseFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import SingleUpload from '@/components/Upload/singleUpload'
import {createHomeAdvertise, getHomeAdvertise, updateHomeAdvertise} from '@/api/homeAdvertise'
const defaultTypeOptions = [
{
label: 'PC首页轮播',
value: 0
},
{
label: 'APP首页轮播',
value: 1
}
];
const defaultHomeAdvertise = {
name: null,
type: 1,
pic: null,
startTime: null,
endTime: null,
status: 0,
url: null,
note: null,
sort: 0
};
export default {
name: 'HomeAdvertiseDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
homeAdvertise: null,
rules: {
name: [
{required: true, message: '请输入广告名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
url: [
{required: true, message: '请输入广告链接', trigger: 'blur'}
],
startTime: [
{required: true, message: '请选择开始时间', trigger: 'blur'}
],
endTime: [
{required: true, message: '请选择到期时间', trigger: 'blur'}
],
pic: [
{required: true, message: '请选择广告图片', trigger: 'blur'}
]
},
typeOptions: Object.assign({}, defaultTypeOptions)
}
},
created(){
if (this.isEdit) {
getHomeAdvertise(this.$route.query.id).then(response => {
this.homeAdvertise = response.data;
});
}else{
this.homeAdvertise = Object.assign({},defaultHomeAdvertise);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateHomeAdvertise(this.$route.query.id, this.homeAdvertise).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createHomeAdvertise(this.homeAdvertise).then(response => {
this.$refs[formName].resetFields();
this.homeAdvertise = Object.assign({},defaultHomeAdvertise);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.homeAdvertise = Object.assign({},defaultHomeAdvertise);
}
}
}
</script>
<style scoped>
.input-width {
width: 70%;
}
</style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="广告名称:">
<el-input v-model="listQuery.name" class="input-width" placeholder="广告名称"></el-input>
</el-form-item>
<el-form-item label="广告位置:">
<el-select v-model="listQuery.type" placeholder="全部" clearable class="input-width">
<el-option v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="到期时间:">
<el-date-picker
class="input-width"
v-model="listQuery.endTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleAdd()">添加广告</el-button>
</el-card>
<div class="table-container">
<el-table ref="homeAdvertiseTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="120" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="广告名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="广告位置" width="120" align="center">
<template slot-scope="scope">{{scope.row.type | formatType}}</template>
</el-table-column>
<el-table-column label="广告图片" width="120" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
</el-table-column>
<el-table-column label="时间" width="220" align="center">
<template slot-scope="scope">
<p>开始时间:{{scope.row.startTime | formatTime}}</p>
<p>到期时间:{{scope.row.endTime | formatTime}}</p>
</template>
</el-table-column>
<el-table-column label="上线/下线" width="120" align="center">
<template slot-scope="scope">
<el-switch
@change="handleUpdateStatus(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.status">
</el-switch>
</template>
</el-table-column>
<el-table-column label="点击次数" width="120" align="center">
<template slot-scope="scope">{{scope.row.clickCount}}</template>
</el-table-column>
<el-table-column label="生成订单" width="120" align="center">
<template slot-scope="scope">{{scope.row.orderCount}}</template>
</el-table-column>
<el-table-column label="操作" width="120" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList,updateStatus,deleteHomeAdvertise} from '@/api/homeAdvertise';
import {formatDate} from '@/utils/date';
const defaultListQuery = {
pageNum: 1,
pageSize: 5,
name: null,
type: null,
endTime:null
};
const defaultTypeOptions = [
{
label: 'PC首页轮播',
value: 0
},
{
label: 'APP首页轮播',
value: 1
}
];
export default {
name: 'homeAdvertiseList',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
typeOptions: Object.assign({}, defaultTypeOptions),
list: null,
total: null,
listLoading: false,
multipleSelection: [],
operates: [
{
label: "删除",
value: 0
}
],
operateType: null
}
},
created() {
this.getList();
},
filters:{
formatType(type){
if(type===1){
return 'APP首页轮播';
}else{
return 'PC首页轮播';
}
},
formatTime(time){
if(time==null||time===''){
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleUpdateStatus(index,row){
this.$confirm('是否要修改上线/下线状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateStatus(row.id,{status:row.status}).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '修改成功!'
});
});
}).catch(() => {
this.$message({
type: 'success',
message: '已取消操作!'
});
this.getList();
});
},
handleDelete(index,row){
this.deleteHomeAdvertise(row.id);
},
handleBatchOperate(){
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
if(this.operateType===0){
//删除
this.deleteHomeAdvertise(ids);
}else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
}
},
handleAdd(){
this.$router.push({path: '/sms/addAdvertise'})
},
handleUpdate(index,row){
this.$router.push({path: '/sms/updateAdvertise', query: {id: row.id}})
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
})
},
deleteHomeAdvertise(ids){
this.$confirm('是否要删除该广告?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
deleteHomeAdvertise(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
}
}
}
</script>
<style scoped>
.input-width {
width: 203px;
}
</style>
<template> 
<home-advertise-detail :isEdit="true"></home-advertise-detail>
</template>
<script>
import HomeAdvertiseDetail from './components/HomeAdvertiseDetail'
export default {
name: 'updateHomeAdvertise',
components: { HomeAdvertiseDetail }
}
</script>
<style></style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="品牌名称:">
<el-input v-model="listQuery.brandName" class="input-width" placeholder="品牌名称"></el-input>
</el-form-item>
<el-form-item label="推荐状态:">
<el-select v-model="listQuery.recommendStatus" placeholder="全部" clearable class="input-width">
<el-option v-for="item in recommendOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleSelectBrand()">选择品牌</el-button>
</el-card>
<div class="table-container">
<el-table ref="homeBrandTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="120" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="品牌名称" align="center">
<template slot-scope="scope">{{scope.row.brandName}}</template>
</el-table-column>
<el-table-column label="是否推荐" width="200" align="center">
<template slot-scope="scope">
<el-switch
@change="handleRecommendStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.recommendStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="160" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="状态" width="160" align="center">
<template slot-scope="scope">{{scope.row.recommendStatus | formatRecommendStatus}}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleEditSort(scope.$index, scope.row)">设置排序
</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
<el-dialog title="选择品牌" :visible.sync="selectDialogVisible" width="40%">
<el-input v-model="dialogData.listQuery.keyword"
style="width: 250px;margin-bottom: 20px"
size="small"
placeholder="品牌名称搜索">
<el-button slot="append" icon="el-icon-search" @click="handleSelectSearch()"></el-button>
</el-input>
<el-table :data="dialogData.list"
@selection-change="handleDialogSelectionChange" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="品牌名称"align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="相关" width="220" align="center">
<template slot-scope="scope">
商品:<span class="color-main">{{scope.row.productCount}}</span>
评价:<span class="color-main">{{scope.row.productCommentCount}}</span>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
background
@size-change="handleDialogSizeChange"
@current-change="handleDialogCurrentChange"
layout="prev, pager, next"
:current-page.sync="dialogData.listQuery.pageNum"
:page-size="dialogData.listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="dialogData.total">
</el-pagination>
</div>
<div style="clear: both;"></div>
<div slot="footer">
<el-button size="small" @click="selectDialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelectDialogConfirm()">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="设置排序"
:visible.sync="sortDialogVisible"
width="40%">
<el-form :model="sortDialogData"
label-width="150px">
<el-form-item label="排序:">
<el-input v-model="sortDialogData.sort" style="width: 200px"></el-input>
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="sortDialogVisible = false" size="small">取 消</el-button>
<el-button type="primary" @click="handleUpdateSort" size="small">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchList,updateRecommendStatus,deleteHomeBrand,createHomeBrand,updateHomeBrandSort} from '@/api/homeBrand';
import {fetchList as fetchBrandList} from '@/api/brand';
const defaultListQuery = {
pageNum: 1,
pageSize: 5,
brandName: null,
recommendStatus: null
};
const defaultRecommendOptions = [
{
label: '未推荐',
value: 0
},
{
label: '推荐中',
value: 1
}
];
export default {
name: 'homeBrandList',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
recommendOptions: Object.assign({}, defaultRecommendOptions),
list: null,
total: null,
listLoading: false,
multipleSelection: [],
operates: [
{
label: "设为推荐",
value: 0
},
{
label: "取消推荐",
value: 1
},
{
label: "删除",
value: 2
}
],
operateType: null,
selectDialogVisible:false,
dialogData:{
list: null,
total: null,
multipleSelection:[],
listQuery:{
keyword: null,
pageNum: 1,
pageSize: 5
}
},
sortDialogVisible:false,
sortDialogData:{sort:0,id:null}
}
},
created() {
this.getList();
},
filters:{
formatRecommendStatus(status){
if(status===1){
return '推荐中';
}else{
return '未推荐';
}
}
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleRecommendStatusStatusChange(index,row){
this.updateRecommendStatusStatus(row.id,row.recommendStatus);
},
handleDelete(index,row){
this.deleteBrand(row.id);
},
handleBatchOperate(){
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
if (this.operateType === 0) {
//设为推荐
this.updateRecommendStatusStatus(ids,1);
} else if (this.operateType === 1) {
//取消推荐
this.updateRecommendStatusStatus(ids,0);
} else if(this.operateType===2){
//删除
this.deleteBrand(ids);
}else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
},
handleSelectBrand(){
this.selectDialogVisible=true;
this.getDialogList();
},
handleSelectSearch(){
this.getDialogList();
},
handleDialogSizeChange(val) {
this.dialogData.listQuery.pageNum = 1;
this.dialogData.listQuery.pageSize = val;
this.getDialogList();
},
handleDialogCurrentChange(val) {
this.dialogData.listQuery.pageNum = val;
this.getDialogList();
},
handleDialogSelectionChange(val){
this.dialogData.multipleSelection = val;
},
handleSelectDialogConfirm(){
if (this.dialogData.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let selectBrands = [];
for (let i = 0; i < this.dialogData.multipleSelection.length; i++) {
selectBrands.push({
brandId:this.dialogData.multipleSelection[i].id,
brandName:this.dialogData.multipleSelection[i].name
});
}
this.$confirm('使用要进行添加操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
createHomeBrand(selectBrands).then(response=>{
this.selectDialogVisible=false;
this.dialogData.multipleSelection=[];
this.getList();
this.$message({
type: 'success',
message: '添加成功!'
});
});
});
},
handleEditSort(index,row){
this.sortDialogVisible=true;
this.sortDialogData.sort=row.sort;
this.sortDialogData.id=row.id;
},
handleUpdateSort(){
this.$confirm('是否要修改排序?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateHomeBrandSort(this.sortDialogData).then(response=>{
this.sortDialogVisible=false;
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
})
},
updateRecommendStatusStatus(ids,status){
this.$confirm('是否要修改推荐状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
params.append("recommendStatus",status);
updateRecommendStatus(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '修改成功!'
});
});
}).catch(() => {
this.$message({
type: 'success',
message: '已取消操作!'
});
this.getList();
});
},
deleteBrand(ids){
this.$confirm('是否要删除该推荐?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
deleteHomeBrand(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '删成功!'
});
});
})
},
getDialogList(){
fetchBrandList(this.dialogData.listQuery).then(response=>{
this.dialogData.list=response.data.list;
this.dialogData.total=response.data.total;
})
}
}
}
</script>
<style></style>
<template> 
<coupon-detail :isEdit="false"></coupon-detail>
</template>
<script>
import CouponDetail from './components/CouponDetail'
export default {
name: 'addCoupon',
components: { CouponDetail }
}
</script>
<style scoped>
</style>
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="coupon"
:rules="rules"
ref="couponFrom"
label-width="150px"
size="small">
<el-form-item label="优惠券类型:">
<el-select v-model="coupon.type">
<el-option
v-for="type in typeOptions"
:key="type.value"
:label="type.label"
:value="type.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="优惠券名称:" prop="name">
<el-input v-model="coupon.name" class="input-width"></el-input>
</el-form-item>
<el-form-item label="适用平台:">
<el-select v-model="coupon.platform">
<el-option
v-for="item in platformOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="总发行量:" prop="publishCount">
<el-input v-model.number="coupon.publishCount" placeholder="只能输入正整数" class="input-width"></el-input>
</el-form-item>
<el-form-item label="面额:" prop="amount">
<el-input v-model.number="coupon.amount" placeholder="面值只能是数值,限2位小数" class="input-width">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="每人限领:">
<el-input v-model="coupon.perLimit" placeholder="只能输入正整数" class="input-width">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="使用门槛:" prop="minPoint">
<el-input v-model.number="coupon.minPoint" placeholder="只能输入正整数" class="input-width">
<template slot="prepend"></template>
<template slot="append">元可用</template>
</el-input>
</el-form-item>
<el-form-item label="领取日期:" prop="enableTime">
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.enableTime" class="input-width"></el-date-picker>
</el-form-item>
<el-form-item label="有效期:">
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.startTime" style="width: 150px"></el-date-picker>
<span style="margin-left: 20px;margin-right: 20px"></span>
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.endTime" style="width: 150px"></el-date-picker>
</el-form-item>
<el-form-item label="可使用商品:">
<el-radio-group v-model="coupon.useType">
<el-radio-button :label="0">全场通用</el-radio-button>
<el-radio-button :label="1">指定分类</el-radio-button>
<el-radio-button :label="2">指定商品</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="coupon.useType===1">
<el-cascader
clearable
placeholder="请选择分类名称"
v-model="selectProductCate"
:options="productCateOptions">
</el-cascader>
<el-button @click="handleAddProductCategoryRelation()">添加</el-button>
<el-table ref="productCateRelationTable"
:data="coupon.productCategoryRelationList"
style="width: 100%;margin-top: 20px"
border>
<el-table-column label="分类名称" align="center">
<template slot-scope="scope">{{scope.row.parentCategoryName}}>{{scope.row.productCategoryName}}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleDeleteProductCateRelation(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item v-show="coupon.useType===2">
<el-select
v-model="selectProduct"
filterable
remote
reserve-keyword
placeholder="商品名称/商品货号"
:remote-method="searchProductMethod"
:loading="selectProductLoading">
<el-option
v-for="item in selectProductOptions"
:key="item.productId"
:label="item.productName"
:value="item.productId">
<span style="float: left">{{ item.productName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">NO.{{ item.productSn }}</span>
</el-option>
</el-select>
<el-button @click="handleAddProductRelation()">添加</el-button>
<el-table ref="productRelationTable"
:data="coupon.productRelationList"
style="width: 100%;margin-top: 20px"
border>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">{{scope.row.productName}}</template>
</el-table-column>
<el-table-column label="货号" align="center" width="120" >
<template slot-scope="scope">NO.{{scope.row.productSn}}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleDeleteProductRelation(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="备注:">
<el-input
class="input-width"
type="textarea"
:rows="5"
placeholder="请输入内容"
v-model="coupon.note">
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('couponFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('couponFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createCoupon,getCoupon,updateCoupon} from '@/api/coupon';
import {fetchSimpleList as fetchProductList} from '@/api/product';
import {fetchListWithChildren} from '@/api/productCate'
const defaultCoupon = {
type: 0,
name: null,
platform: 0,
amount: null,
perLimit: 1,
minPoint: null,
startTime: null,
endTime: null,
useType: 0,
note: null,
publishCount: null,
productRelationList: [],
productCategoryRelationList: []
};
const defaultTypeOptions = [
{
label: '全场赠券',
value: 0
},
{
label: '会员赠券',
value: 1
},
{
label: '购物赠券',
value: 2
},
{
label: '注册赠券',
value: 3
}
];
const defaultPlatformOptions = [
{
label: '全平台',
value: 0
},
{
label: '移动平台',
value: 1
},
{
label: 'PC平台',
value: 2
}
];
export default {
name: 'CouponDetail',
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
coupon: Object.assign({}, defaultCoupon),
typeOptions: Object.assign({}, defaultTypeOptions),
platformOptions: Object.assign({}, defaultPlatformOptions),
rules: {
name: [
{required: true, message: '请输入优惠券名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
publishCount: [
{type: 'number',required: true, message: '只能输入正整数', trigger: 'blur'}
],
amount: [
{type: 'number',required: true,message: '面值只能是数值,0.01-10000,限2位小数',trigger: 'blur'}
],
minPoint: [
{type: 'number',required: true,message: '只能输入正整数',trigger: 'blur'}
]
},
selectProduct:null,
selectProductLoading: false,
selectProductOptions:[],
selectProductCate: null,
productCateOptions: []
}
},
created(){
if(this.isEdit){
getCoupon(this.$route.query.id).then(response=>{
this.coupon=response.data;
});
}
this.getProductCateList();
},
methods:{
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(this.isEdit){
updateCoupon(this.$route.query.id,this.coupon).then(response=>{
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}else{
createCoupon(this.coupon).then(response=>{
this.$refs[formName].resetFields();
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.coupon = Object.assign({},defaultCoupon);
},
searchProductMethod(query){
if (query !== '') {
this.loading = true;
fetchProductList({keyword:query}).then(response=>{
this.loading=false;
let productList = response.data;
this.selectProductOptions = [];
for(let i=0;i<productList.length;i++){
let item = productList[i];
this.selectProductOptions.push({productId:item.id,productName:item.name,productSn:item.productSn});
}
});
} else {
this.selectProductOptions = [];
}
},
handleAddProductRelation(){
if(this.selectProduct===null){
this.$message({
message: '请先选择商品',
type: 'warning'
});
return
}
this.coupon.productRelationList.push(this.getProductById(this.selectProduct));
this.selectProduct=null;
},
handleDeleteProductRelation(index,row){
this.coupon.productRelationList.splice(index,1);
},
handleAddProductCategoryRelation(){
if(this.selectProductCate===null||this.selectProductCate.length===0){
this.$message({
message: '请先选择商品分类',
type: 'warning'
});
return
}
this.coupon.productCategoryRelationList.push(this.getProductCateByIds(this.selectProductCate));
this.selectProductCate=[];
},
handleDeleteProductCateRelation(index,row){
this.coupon.productCategoryRelationList.splice(index,1);
},
getProductById(id){
for(let i=0;i<this.selectProductOptions.length;i++){
if(id===this.selectProductOptions[i].productId){
return this.selectProductOptions[i];
}
}
return null;
},
getProductCateList() {
fetchListWithChildren().then(response => {
let list = response.data;
this.productCateOptions = [];
for (let i = 0; i < list.length; i++) {
let children = [];
if (list[i].children != null && list[i].children.length > 0) {
for (let j = 0; j < list[i].children.length; j++) {
children.push({label: list[i].children[j].name, value: list[i].children[j].id});
}
}
this.productCateOptions.push({label: list[i].name, value: list[i].id, children: children});
}
});
},
getProductCateByIds(ids){
let name;
let parentName;
for (let i = 0; i < this.productCateOptions.length; i++) {
if (this.productCateOptions[i].value === ids[0]) {
parentName = this.productCateOptions[i].label;
for (let j = 0; j < this.productCateOptions[i].children.length; j++) {
if (this.productCateOptions[i].children[j].value === ids[1]) {
name = this.productCateOptions[i].children[j].label;
}
}
}
}
return {productCategoryId: ids[1], productCategoryName: name, parentCategoryName: parentName};
}
}
}
</script>
<style scoped>
.input-width {
width: 60%;
}
</style>
<template> 
<div class="app-container">
<div class="table-layout">
<el-row>
<el-col :span="4" class="table-cell-title">名称</el-col>
<el-col :span="4" class="table-cell-title">优惠券类型</el-col>
<el-col :span="4" class="table-cell-title">可使用商品</el-col>
<el-col :span="4" class="table-cell-title">使用门槛</el-col>
<el-col :span="4" class="table-cell-title">面值</el-col>
<el-col :span="4" class="table-cell-title">状态</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell">{{coupon.name}}</el-col>
<el-col :span="4" class="table-cell">{{coupon.type | formatType}}</el-col>
<el-col :span="4" class="table-cell">{{coupon.useType | formatUseType}}</el-col>
<el-col :span="4" class="table-cell">{{coupon.minPoint}}元可用</el-col>
<el-col :span="4" class="table-cell">{{coupon.amount}}</el-col>
<el-col :span="4" class="table-cell">{{coupon.endTime | formatStatus}}</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell-title">有效期</el-col>
<el-col :span="4" class="table-cell-title">总发行量</el-col>
<el-col :span="4" class="table-cell-title">已领取</el-col>
<el-col :span="4" class="table-cell-title">待领取</el-col>
<el-col :span="4" class="table-cell-title">已使用</el-col>
<el-col :span="4" class="table-cell-title">未使用</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell" style="font-size: 13px">
{{coupon.startTime|formatDate}}{{coupon.endTime|formatDate}}
</el-col>
<el-col :span="4" class="table-cell">{{coupon.publishCount}}</el-col>
<el-col :span="4" class="table-cell">{{coupon.receiveCount}}</el-col>
<el-col :span="4" class="table-cell">{{coupon.publishCount-coupon.receiveCount}}</el-col>
<el-col :span="4" class="table-cell">{{coupon.useCount}}</el-col>
<el-col :span="4" class="table-cell">{{coupon.publishCount-coupon.useCount}}</el-col>
</el-row>
</div>
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="使用状态:">
<el-select v-model="listQuery.useStatus" placeholder="全部" clearable class="input-width">
<el-option v-for="item in useTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="订单编号:">
<el-input v-model="listQuery.orderSn" class="input-width" placeholder="订单编号"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<div class="table-container">
<el-table ref="couponHistoryTable"
:data="list"
style="width: 100%;"
v-loading="listLoading" border>
<el-table-column label="优惠码" width="160" align="center">
<template slot-scope="scope">{{scope.row.couponCode}}</template>
</el-table-column>
<el-table-column label="领取会员" width="140" align="center">
<template slot-scope="scope">{{scope.row.memberNickname}}</template>
</el-table-column>
<el-table-column label="领取方式" width="100" align="center">
<template slot-scope="scope">{{scope.row.getType | formatGetType}}</template>
</el-table-column>
<el-table-column label="领取时间" width="160" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatTime}}</template>
</el-table-column>
<el-table-column label="当前状态" width="140" align="center">
<template slot-scope="scope">{{scope.row.useStatus | formatCouponHistoryUseType}}</template>
</el-table-column>
<el-table-column label="使用时间" width="160" align="center">
<template slot-scope="scope">{{scope.row.useTime | formatTime}}</template>
</el-table-column>
<el-table-column label="订单编号" align="center">
<template slot-scope="scope">{{scope.row.orderSn===null?'N/A':scope.row.orderSn}}</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {formatDate} from '@/utils/date';
import {getCoupon} from '@/api/coupon';
import {fetchList as fetchCouponHistoryList} from '@/api/couponHistory';
const defaultTypeOptions = [
{
label: '全场赠券',
value: 0
},
{
label: '会员赠券',
value: 1
},
{
label: '购物赠券',
value: 2
},
{
label: '注册赠券',
value: 3
}
];
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
useStatus: null,
orderSn: null,
couponId: null
};
const defaultUseTypeOptions= [
{
label: "未使用",
value: 0
},
{
label: "已使用",
value: 1
},
{
label: "已过期",
value: 2
}
];
export default {
name: 'couponHistoryList',
data() {
return {
coupon: {},
listQuery: Object.assign({}, defaultListQuery),
useTypeOptions:Object.assign({},defaultUseTypeOptions),
list:null,
total:null,
listLoading:false
}
},
created() {
getCoupon(this.$route.query.id).then(response => {
this.coupon = response.data;
});
this.listQuery.couponId=this.$route.query.id;
this.getList();
},
filters: {
formatType(type) {
for (let i = 0; i < defaultTypeOptions.length; i++) {
if (type === defaultTypeOptions[i].value) {
return defaultTypeOptions[i].label;
}
}
return '';
},
formatUseType(useType) {
if (useType === 0) {
return '全场通用';
} else if (useType === 1) {
return '指定分类';
} else {
return '指定商品';
}
},
formatPlatform(platform) {
if (platform === 1) {
return '移动平台';
} else if (platform === 2) {
return 'PC平台';
} else {
return '全平台';
}
},
formatDate(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd')
},
formatStatus(endTime) {
let now = new Date().getTime();
if (endTime > now) {
return '未过期'
} else {
return '已过期';
}
},
formatGetType(type) {
if(type===1){
return '主动获取';
}else{
return '后台赠送';
}
},
formatCouponHistoryUseType(useType) {
if (useType === 0) {
return '未使用';
} else if (useType === 1) {
return '已使用';
} else {
return '已过期';
}
},
formatTime(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
},
methods: {
getList(){
this.listLoading=true;
fetchCouponHistoryList(this.listQuery).then(response=>{
this.listLoading=false;
this.list=response.data.list;
this.total=response.data.total;
});
},
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
this.listQuery.couponId=this.$route.query.id;
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
}
}
}
</script>
<style scoped>
.app-container {
width: 80%;
margin: 20px auto;
}
.filter-container {
margin-top: 20px;
}
.table-layout {
margin-top: 20px;
border-left: 1px solid #DCDFE6;
border-top: 1px solid #DCDFE6;
}
.table-cell {
height: 60px;
line-height: 40px;
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
font-size: 14px;
color: #606266;
text-align: center;
overflow: hidden;
}
.table-cell-title {
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
background: #F2F6FC;
text-align: center;
font-size: 14px;
color: #303133;
}
</style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="优惠券名称:">
<el-input v-model="listQuery.name" class="input-width" placeholder="优惠券名称"></el-input>
</el-form-item>
<el-form-item label="优惠券类型:">
<el-select v-model="listQuery.type" placeholder="全部" clearable class="input-width">
<el-option v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleAdd()">添加</el-button>
</el-card>
<div class="table-container">
<el-table ref="couponTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="优惠劵名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="优惠券类型" width="100" align="center">
<template slot-scope="scope">{{scope.row.type | formatType}}</template>
</el-table-column>
<el-table-column label="可使用商品" width="100" align="center">
<template slot-scope="scope">{{scope.row.useType | formatUseType}}</template>
</el-table-column>
<el-table-column label="使用门槛" width="140" align="center">
<template slot-scope="scope">{{scope.row.minPoint}}元可用</template>
</el-table-column>
<el-table-column label="面值" width="100" align="center">
<template slot-scope="scope">{{scope.row.amount}}</template>
</el-table-column>
<el-table-column label="适用平台" width="100" align="center">
<template slot-scope="scope">{{scope.row.platform | formatPlatform}}</template>
</el-table-column>
<el-table-column label="有效期" width="180" align="center">
<template slot-scope="scope">{{scope.row.startTime|formatDate}}{{scope.row.endTime|formatDate}}</template>
</el-table-column>
<el-table-column label="状态" width="100" align="center">
<template slot-scope="scope">{{scope.row.endTime | formatStatus}}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleView(scope.$index, scope.row)">查看</el-button>
<el-button size="mini"
type="text"
@click="handleUpdate(scope.$index, scope.row)">
编辑</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList,deleteCoupon} from '@/api/coupon';
import {formatDate} from '@/utils/date';
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
name: null,
type: null
};
const defaultTypeOptions=[
{
label: '全场赠券',
value: 0
},
{
label: '会员赠券',
value: 1
},
{
label: '购物赠券',
value: 2
},
{
label: '注册赠券',
value: 3
}
];
export default {
name:'couponList',
data() {
return {
listQuery:Object.assign({},defaultListQuery),
typeOptions:Object.assign({},defaultTypeOptions),
list:null,
total:null,
listLoading:false,
multipleSelection:[]
}
},
created(){
this.getList();
},
filters:{
formatType(type){
for(let i=0;i<defaultTypeOptions.length;i++){
if(type===defaultTypeOptions[i].value){
return defaultTypeOptions[i].label;
}
}
return '';
},
formatUseType(useType){
if(useType===0){
return '全场通用';
}else if(useType===1){
return '指定分类';
}else{
return '指定商品';
}
},
formatPlatform(platform){
if(platform===1){
return '移动平台';
}else if(platform===2){
return 'PC平台';
}else{
return '全平台';
}
},
formatDate(time){
if(time==null||time===''){
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd')
},
formatStatus(endTime){
let now = new Date().getTime();
let endDate = new Date(endTime);
if(endDate>now){
return '未过期'
}else{
return '已过期';
}
}
},
methods:{
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleAdd(){
this.$router.push({path: '/sms/addCoupon'})
},
handleView(index, row) {
this.$router.push({path: '/sms/couponHistory', query: {id: row.id}})
},
handleUpdate(index, row) {
this.$router.push({path: '/sms/updateCoupon', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否进行删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCoupon(row.id).then(response=>{
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList();
});
})
},
getList(){
this.listLoading=true;
fetchList(this.listQuery).then(response=>{
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
}
}
}
</script>
<style scoped>
.input-width {
width: 203px;
}
</style>
<template> 
<coupon-detail :isEdit="true"></coupon-detail>
</template>
<script>
import CouponDetail from './components/CouponDetail'
export default {
name: 'updateCoupon',
components: { CouponDetail }
}
</script>
<style scoped>
</style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="活动名称:">
<el-input v-model="listQuery.keyword" class="input-width" placeholder="活动名称" clearable></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleAdd()" style="margin-left: 20px">添加活动</el-button>
<el-button size="mini" class="btn-add" @click="handleShowSessionList()">秒杀时间段列表</el-button>
</el-card>
<div class="table-container">
<el-table ref="flashTable"
:data="list"
style="width: 100%;"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="活动标题" align="center">
<template slot-scope="scope">{{scope.row.title}}</template>
</el-table-column>
<el-table-column label="活动状态" width="140" align="center">
<template slot-scope="scope">{{scope.row |formatActiveStatus}}</template>
</el-table-column>
<el-table-column label="开始时间" width="140" align="center">
<template slot-scope="scope">{{scope.row.startDate | formatDate}}</template>
</el-table-column>
<el-table-column label="结束时间" width="140" align="center">
<template slot-scope="scope">{{scope.row.endDate | formatDate}}</template>
</el-table-column>
<el-table-column label="上线/下线" width="200" align="center">
<template slot-scope="scope">
<el-switch
@change="handleStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.status">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleSelectSession(scope.$index, scope.row)">设置商品
</el-button>
<el-button size="mini"
type="text"
@click="handleUpdate(scope.$index, scope.row)">
编辑
</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
<el-dialog
title="添加活动"
:visible.sync="dialogVisible"
width="40%">
<el-form :model="flashPromotion"
ref="flashPromotionForm"
label-width="150px" size="small">
<el-form-item label="活动标题:">
<el-input v-model="flashPromotion.title" style="width: 250px"></el-input>
</el-form-item>
<el-form-item label="开始时间:">
<el-date-picker
v-model="flashPromotion.startDate"
type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间:">
<el-date-picker
v-model="flashPromotion.endDate"
type="date"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="上线/下线">
<el-radio-group v-model="flashPromotion.status">
<el-radio :label="1">上线</el-radio>
<el-radio :label="0">下线</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" size="small">取 消</el-button>
<el-button type="primary" @click="handleDialogConfirm()" size="small">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchList, updateStatus, deleteFlash, createFlash, updateFlash} from '@/api/flash';
import {formatDate} from '@/utils/date';
const defaultListQuery = {
pageNum: 1,
pageSize: 5,
keyword: null
};
const defaultFlashPromotion = {
id: null,
title: null,
startDate: null,
endDate: null,
status: 0
};
export default {
name: 'flashPromotionList',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
list: null,
total: null,
listLoading: false,
dialogVisible: false,
flashPromotion: Object.assign({}, defaultFlashPromotion),
isEdit: false
}
},
created() {
this.getList();
},
filters: {
formatActiveStatus(row) {
let nowTime = new Date().getTime();
if (nowTime >= row.startDate && nowTime <= row.endDate) {
return '活动进行中';
} else if (nowTime > row.endDate) {
return '活动已结束';
} else {
return '活动未开始';
}
},
formatDate(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd')
}
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleAdd() {
this.dialogVisible = true;
this.isEdit = false;
this.flashPromotion = Object.assign({},defaultFlashPromotion);
},
handleShowSessionList() {
this.$router.push({path: '/sms/flashSession'})
},
handleStatusChange(index, row) {
this.$confirm('是否要修改该状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateStatus(row.id, {status: row.status}).then(response => {
this.$message({
type: 'success',
message: '修改成功!'
});
});
}).catch(() => {
this.$message({
type: 'info',
message: '取消修改'
});
this.getList();
});
},
handleDelete(index, row) {
this.$confirm('是否要删除该活动?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteFlash(row.id).then(response => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList();
});
});
},
handleUpdate(index, row) {
this.dialogVisible = true;
this.isEdit = true;
this.flashPromotion = Object.assign({},row);
},
handleDialogConfirm() {
this.$confirm('是否要确认?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateFlash(this.flashPromotion.id,this.flashPromotion).then(response => {
this.$message({
message: '修改成功!',
type: 'success'
});
this.dialogVisible =false;
this.getList();
})
} else {
createFlash(this.flashPromotion).then(response => {
this.$message({
message: '添加成功!',
type: 'success'
});
this.dialogVisible =false;
this.getList();
})
}
})
},
handleSelectSession(index,row){
this.$router.push({path:'/sms/selectSession',query:{flashPromotionId:row.id}})
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
}
}
}
</script>
<style></style>
<template> 
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleSelectProduct()" style="margin-left: 20px">添加</el-button>
</el-card>
<div class="table-container">
<el-table ref="productRelationTable"
:data="list"
style="width: 100%;"
v-loading="listLoading" border>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">{{scope.row.product.name}}</template>
</el-table-column>
<el-table-column label="货号" width="140" align="center">
<template slot-scope="scope">NO.{{scope.row.product.productSn}}</template>
</el-table-column>
<el-table-column label="商品价格" width="100" align="center">
<template slot-scope="scope">{{scope.row.product.price}}</template>
</el-table-column>
<el-table-column label="剩余数量" width="100" align="center">
<template slot-scope="scope">{{scope.row.product.stock}}</template>
</el-table-column>
<el-table-column label="秒杀价格" width="100" align="center">
<template slot-scope="scope">
<p v-if="scope.row.flashPromotionPrice!==null">
{{scope.row.flashPromotionPrice}}
</p>
</template>
</el-table-column>
<el-table-column label="秒杀数量" width="100" align="center">
<template slot-scope="scope">{{scope.row.flashPromotionCount}}</template>
</el-table-column>
<el-table-column label="限购数量" width="100" align="center">
<template slot-scope="scope">{{scope.row.flashPromotionLimit}}</template>
</el-table-column>
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="操作" width="100" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
<el-dialog title="选择商品" :visible.sync="selectDialogVisible" width="50%">
<el-input v-model="dialogData.listQuery.keyword"
style="width: 250px;margin-bottom: 20px"
size="small"
placeholder="商品名称搜索">
<el-button slot="append" icon="el-icon-search" @click="handleSelectSearch()"></el-button>
</el-input>
<el-table :data="dialogData.list"
@selection-change="handleDialogSelectionChange" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="货号" width="160" align="center">
<template slot-scope="scope">NO.{{scope.row.productSn}}</template>
</el-table-column>
<el-table-column label="价格" width="120" align="center">
<template slot-scope="scope">{{scope.row.price}}</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
background
@size-change="handleDialogSizeChange"
@current-change="handleDialogCurrentChange"
layout="prev, pager, next"
:current-page.sync="dialogData.listQuery.pageNum"
:page-size="dialogData.listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="dialogData.total">
</el-pagination>
</div>
<div style="clear: both;"></div>
<div slot="footer">
<el-button size="small" @click="selectDialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelectDialogConfirm()">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="编辑秒杀商品信息"
:visible.sync="editDialogVisible"
width="40%">
<el-form :model="flashProductRelation"
ref="flashProductRelationForm"
label-width="150px" size="small">
<el-form-item label="商品名称:">
<span>{{flashProductRelation.product.name}}</span>
</el-form-item>
<el-form-item label="货号:">
<span>NO.{{flashProductRelation.product.productSn}}</span>
</el-form-item>
<el-form-item label="商品价格:">
<span>¥{{flashProductRelation.product.price}}</span>
</el-form-item>
<el-form-item label="秒杀价格:">
<el-input v-model="flashProductRelation.flashPromotionPrice" class="input-width">
<template slot="prepend"></template>
</el-input>
</el-form-item>
<el-form-item label="剩余数量:">
<span>{{flashProductRelation.product.stock}}</span>
</el-form-item>
<el-form-item label="秒杀数量:">
<el-input v-model="flashProductRelation.flashPromotionCount" class="input-width"></el-input>
</el-form-item>
<el-form-item label="限购数量:">
<el-input v-model="flashProductRelation.flashPromotionLimit" class="input-width"></el-input>
</el-form-item>
<el-form-item label="排序:">
<el-input v-model="flashProductRelation.sort" class="input-width"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editDialogVisible = false" size="small">取 消</el-button>
<el-button type="primary" @click="handleEditDialogConfirm()" size="small">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchList,createFlashProductRelation,deleteFlashProductRelation,updateFlashProductRelation} from '@/api/flashProductRelation';
import {fetchList as fetchProductList} from '@/api/product';
const defaultListQuery = {
pageNum: 1,
pageSize: 5,
flashPromotionId: null,
flashPromotionSessionId: null
};
export default {
name:'flashPromotionProductRelationList',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
list: null,
total: null,
listLoading: false,
dialogVisible: false,
selectDialogVisible:false,
dialogData:{
list: null,
total: null,
multipleSelection:[],
listQuery:{
keyword: null,
pageNum: 1,
pageSize: 5
}
},
editDialogVisible:false,
flashProductRelation:{
product:{}
}
}
},
created(){
this.listQuery.flashPromotionId=this.$route.query.flashPromotionId;
this.listQuery.flashPromotionSessionId=this.$route.query.flashPromotionSessionId;
this.getList();
},
methods:{
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleSelectProduct(){
this.selectDialogVisible=true;
this.getDialogList();
},
handleUpdate(index,row){
this.editDialogVisible = true;
this.flashProductRelation = Object.assign({},row);
},
handleDelete(index,row){
this.$confirm('是否要删除该商品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteFlashProductRelation(row.id).then(response => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList();
});
});
},
handleSelectSearch(){
this.getDialogList();
},
handleDialogSizeChange(val) {
this.dialogData.listQuery.pageNum = 1;
this.dialogData.listQuery.pageSize = val;
this.getDialogList();
},
handleDialogCurrentChange(val) {
this.dialogData.listQuery.pageNum = val;
this.getDialogList();
},
handleDialogSelectionChange(val){
this.dialogData.multipleSelection = val;
},
handleSelectDialogConfirm(){
if (this.dialogData.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let selectProducts = [];
for (let i = 0; i < this.dialogData.multipleSelection.length; i++) {
selectProducts.push({
productId:this.dialogData.multipleSelection[i].id,
flashPromotionId:this.listQuery.flashPromotionId,
flashPromotionSessionId:this.listQuery.flashPromotionSessionId
});
}
this.$confirm('使用要进行添加操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
createFlashProductRelation(selectProducts).then(response=>{
this.selectDialogVisible=false;
this.dialogData.multipleSelection=[];
this.getList();
this.$message({
type: 'success',
message: '添加成功!'
});
});
});
},
handleEditDialogConfirm(){
this.$confirm('是否要确认?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateFlashProductRelation(this.flashProductRelation.id,this.flashProductRelation).then(response => {
this.$message({
message: '修改成功!',
type: 'success'
});
this.editDialogVisible =false;
this.getList();
})
})
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
});
},
getDialogList(){
fetchProductList(this.dialogData.listQuery).then(response=>{
this.dialogData.list=response.data.list;
this.dialogData.total=response.data.total;
})
}
}
}
</script>
<style scoped>
.operate-container{
margin-top: 0;
}
.input-width{
width: 200px;
}
</style>
<template> 
<div class="app-container">
<el-card shadow="never" class="operate-container">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
</el-card>
<div class="table-container">
<el-table ref="selectSessionTable"
:data="list"
style="width: 100%;"
v-loading="listLoading" border>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="秒杀时间段名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="每日开始时间" align="center">
<template slot-scope="scope">{{scope.row.startTime | formatTime}}</template>
</el-table-column>
<el-table-column label="每日结束时间" align="center">
<template slot-scope="scope">{{scope.row.endTime | formatTime}}</template>
</el-table-column>
<el-table-column label="商品数量" align="center">
<template slot-scope="scope">{{scope.row.productCount}}</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleShowRelation(scope.$index, scope.row)">商品列表
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import {fetchSelectList} from '@/api/flashSession';
import {formatDate} from '@/utils/date';
export default {
name: 'selectSessionList',
data() {
return {
list: null,
listLoading: false
}
},
created() {
this.getList();
},
filters:{
formatTime(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'hh:mm:ss')
}
},
methods: {
handleShowRelation(index,row){
this.$router.push({path:'/sms/flashProductRelation',query:{
flashPromotionId:this.$route.query.flashPromotionId, flashPromotionSessionId:row.id}})
},
getList() {
this.listLoading = true;
fetchSelectList({flashPromotionId:this.$route.query.flashPromotionId}).then(response => {
this.listLoading = false;
this.list = response.data;
});
}
}
}
</script>
<style scoped>
.operate-container {
margin-top: 0;
}
</style>
<template> 
<div class="app-container">
<el-card shadow="never" class="operate-container">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleAdd()">添加</el-button>
</el-card>
<div class="table-container">
<el-table ref="flashSessionTable"
:data="list"
style="width: 100%;"
v-loading="listLoading" border>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="秒杀时间段名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="每日开始时间" align="center">
<template slot-scope="scope">{{scope.row.startTime | formatTime}}</template>
</el-table-column>
<el-table-column label="每日结束时间" align="center">
<template slot-scope="scope">{{scope.row.endTime | formatTime}}</template>
</el-table-column>
<el-table-column label="启用" align="center">
<template slot-scope="scope">
<el-switch
@change="handleStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.status">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog
title="添加时间段"
:visible.sync="dialogVisible"
width="40%">
<el-form :model="flashSession"
ref="flashSessionForm"
label-width="150px" size="small">
<el-form-item label="秒杀时间段名称:">
<el-input v-model="flashSession.name" style="width: 250px"></el-input>
</el-form-item>
<el-form-item label="每日开始时间:">
<el-time-picker
v-model="flashSession.startTime"
placeholder="请选择时间">
</el-time-picker>
</el-form-item>
<el-form-item label="每日结束时间:">
<el-time-picker
v-model="flashSession.endTime"
placeholder="请选择时间">
</el-time-picker>
</el-form-item>
<el-form-item label="是否启用">
<el-radio-group v-model="flashSession.status">
<el-radio :label="1">启用</el-radio>
<el-radio :label="0">不启用</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" size="small">取 消</el-button>
<el-button type="primary" @click="handleDialogConfirm()" size="small">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchList,updateStatus,deleteSession,createSession,updateSession} from '@/api/flashSession';
import {formatDate} from '@/utils/date';
const defaultFlashSession={
name:null,
startTime:null,
endTime:null,
status:0
};
export default {
name: 'flashPromotionSessionList',
data() {
return {
list: null,
listLoading: false,
dialogVisible:false,
isEdit:false,
flashSession:Object.assign({},defaultFlashSession)
}
},
created() {
this.getList();
},
filters:{
formatTime(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'hh:mm:ss')
}
},
methods: {
handleAdd() {
this.dialogVisible = true;
this.isEdit = false;
this.flashSession = Object.assign({},defaultFlashSession);
},
handleStatusChange(index,row){
this.$confirm('是否要修改该状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateStatus(row.id, {status: row.status}).then(response => {
this.$message({
type: 'success',
message: '修改成功!'
});
});
}).catch(() => {
this.$message({
type: 'info',
message: '取消修改'
});
this.getList();
});
},
handleUpdate(index,row){
this.dialogVisible = true;
this.isEdit = true;
this.flashSession = Object.assign({},row);
this.flashSession.startTime=new Date(row.startTime);
this.flashSession.endTime=new Date(row.endTime);
},
handleDelete(index,row){
this.$confirm('是否要删除该时间段?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteSession(row.id).then(response => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList();
});
});
},
handleDialogConfirm() {
this.$confirm('是否要确认?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateSession(this.flashSession.id,this.flashSession).then(response => {
this.$message({
message: '修改成功!',
type: 'success'
});
this.dialogVisible =false;
this.getList();
})
} else {
createSession(this.flashSession).then(response => {
this.$message({
message: '添加成功!',
type: 'success'
});
this.dialogVisible =false;
this.getList();
})
}
})
},
getList() {
this.listLoading = true;
fetchList({}).then(response => {
this.listLoading = false;
this.list = response.data;
});
}
}
}
</script>
<style scoped>
.operate-container {
margin-top: 0;
}
</style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="商品名称:">
<el-input v-model="listQuery.productName" class="input-width" placeholder="商品名称"></el-input>
</el-form-item>
<el-form-item label="推荐状态:">
<el-select v-model="listQuery.recommendStatus" placeholder="全部" clearable class="input-width">
<el-option v-for="item in recommendOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleSelectProduct()">选择商品</el-button>
</el-card>
<div class="table-container">
<el-table ref="newProductTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="120" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">{{scope.row.productName}}</template>
</el-table-column>
<el-table-column label="是否推荐" width="200" align="center">
<template slot-scope="scope">
<el-switch
@change="handleRecommendStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.recommendStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="160" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="状态" width="160" align="center">
<template slot-scope="scope">{{scope.row.recommendStatus | formatRecommendStatus}}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleEditSort(scope.$index, scope.row)">设置排序
</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
<el-dialog title="选择商品" :visible.sync="selectDialogVisible" width="50%">
<el-input v-model="dialogData.listQuery.keyword"
style="width: 250px;margin-bottom: 20px"
size="small"
placeholder="商品名称搜索">
<el-button slot="append" icon="el-icon-search" @click="handleSelectSearch()"></el-button>
</el-input>
<el-table :data="dialogData.list"
@selection-change="handleDialogSelectionChange" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="货号" width="160" align="center">
<template slot-scope="scope">NO.{{scope.row.productSn}}</template>
</el-table-column>
<el-table-column label="价格" width="120" align="center">
<template slot-scope="scope">{{scope.row.price}}</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
background
@size-change="handleDialogSizeChange"
@current-change="handleDialogCurrentChange"
layout="prev, pager, next"
:current-page.sync="dialogData.listQuery.pageNum"
:page-size="dialogData.listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="dialogData.total">
</el-pagination>
</div>
<div style="clear: both;"></div>
<div slot="footer">
<el-button size="small" @click="selectDialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelectDialogConfirm()">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="设置排序"
:visible.sync="sortDialogVisible"
width="40%">
<el-form :model="sortDialogData"
label-width="150px">
<el-form-item label="排序:">
<el-input v-model="sortDialogData.sort" style="width: 200px"></el-input>
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="sortDialogVisible = false" size="small">取 消</el-button>
<el-button type="primary" @click="handleUpdateSort" size="small">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchList,updateRecommendStatus,deleteHotProduct,createHotProduct,updateHotProductSort} from '@/api/hotProduct';
import {fetchList as fetchProductList} from '@/api/product';
const defaultListQuery = {
pageNum: 1,
pageSize: 5,
productName: null,
recommendStatus: null
};
const defaultRecommendOptions = [
{
label: '未推荐',
value: 0
},
{
label: '推荐中',
value: 1
}
];
export default {
name: 'hotProductList',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
recommendOptions: Object.assign({}, defaultRecommendOptions),
list: null,
total: null,
listLoading: false,
multipleSelection: [],
operates: [
{
label: "设为推荐",
value: 0
},
{
label: "取消推荐",
value: 1
},
{
label: "删除",
value: 2
}
],
operateType: null,
selectDialogVisible:false,
dialogData:{
list: null,
total: null,
multipleSelection:[],
listQuery:{
keyword: null,
pageNum: 1,
pageSize: 5
}
},
sortDialogVisible:false,
sortDialogData:{sort:0,id:null}
}
},
created() {
this.getList();
},
filters:{
formatRecommendStatus(status){
if(status===1){
return '推荐中';
}else{
return '未推荐';
}
}
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleRecommendStatusStatusChange(index,row){
this.updateRecommendStatusStatus(row.id,row.recommendStatus);
},
handleDelete(index,row){
this.deleteProduct(row.id);
},
handleBatchOperate(){
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
if (this.operateType === 0) {
//设为推荐
this.updateRecommendStatusStatus(ids,1);
} else if (this.operateType === 1) {
//取消推荐
this.updateRecommendStatusStatus(ids,0);
} else if(this.operateType===2){
//删除
this.deleteProduct(ids);
}else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
}
},
handleSelectProduct(){
this.selectDialogVisible=true;
this.getDialogList();
},
handleSelectSearch(){
this.getDialogList();
},
handleDialogSizeChange(val) {
this.dialogData.listQuery.pageNum = 1;
this.dialogData.listQuery.pageSize = val;
this.getDialogList();
},
handleDialogCurrentChange(val) {
this.dialogData.listQuery.pageNum = val;
this.getDialogList();
},
handleDialogSelectionChange(val){
this.dialogData.multipleSelection = val;
},
handleSelectDialogConfirm(){
if (this.dialogData.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let selectProducts = [];
for (let i = 0; i < this.dialogData.multipleSelection.length; i++) {
selectProducts.push({
productId:this.dialogData.multipleSelection[i].id,
productName:this.dialogData.multipleSelection[i].name
});
}
this.$confirm('使用要进行添加操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
createHotProduct(selectProducts).then(response=>{
this.selectDialogVisible=false;
this.dialogData.multipleSelection=[];
this.getList();
this.$message({
type: 'success',
message: '添加成功!'
});
});
});
},
handleEditSort(index,row){
this.sortDialogVisible=true;
this.sortDialogData.sort=row.sort;
this.sortDialogData.id=row.id;
},
handleUpdateSort(){
this.$confirm('是否要修改排序?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateHotProductSort(this.sortDialogData).then(response=>{
this.sortDialogVisible=false;
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
})
},
updateRecommendStatusStatus(ids,status){
this.$confirm('是否要修改推荐状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
params.append("recommendStatus",status);
updateRecommendStatus(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '修改成功!'
});
});
}).catch(() => {
this.$message({
type: 'success',
message: '已取消操作!'
});
this.getList();
});
},
deleteProduct(ids){
this.$confirm('是否要删除该推荐?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
deleteHotProduct(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
},
getDialogList(){
fetchProductList(this.dialogData.listQuery).then(response=>{
this.dialogData.list=response.data.list;
this.dialogData.total=response.data.total;
})
}
}
}
</script>
<style></style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="商品名称:">
<el-input v-model="listQuery.productName" class="input-width" placeholder="商品名称"></el-input>
</el-form-item>
<el-form-item label="推荐状态:">
<el-select v-model="listQuery.recommendStatus" placeholder="全部" clearable class="input-width">
<el-option v-for="item in recommendOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleSelectProduct()">选择商品</el-button>
</el-card>
<div class="table-container">
<el-table ref="newProductTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="120" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">{{scope.row.productName}}</template>
</el-table-column>
<el-table-column label="是否推荐" width="200" align="center">
<template slot-scope="scope">
<el-switch
@change="handleRecommendStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.recommendStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="160" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="状态" width="160" align="center">
<template slot-scope="scope">{{scope.row.recommendStatus | formatRecommendStatus}}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleEditSort(scope.$index, scope.row)">设置排序
</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
<el-dialog title="选择商品" :visible.sync="selectDialogVisible" width="50%">
<el-input v-model="dialogData.listQuery.keyword"
style="width: 250px;margin-bottom: 20px"
size="small"
placeholder="商品名称搜索">
<el-button slot="append" icon="el-icon-search" @click="handleSelectSearch()"></el-button>
</el-input>
<el-table :data="dialogData.list"
@selection-change="handleDialogSelectionChange" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="货号" width="160" align="center">
<template slot-scope="scope">NO.{{scope.row.productSn}}</template>
</el-table-column>
<el-table-column label="价格" width="120" align="center">
<template slot-scope="scope">{{scope.row.price}}</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
background
@size-change="handleDialogSizeChange"
@current-change="handleDialogCurrentChange"
layout="prev, pager, next"
:current-page.sync="dialogData.listQuery.pageNum"
:page-size="dialogData.listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="dialogData.total">
</el-pagination>
</div>
<div style="clear: both;"></div>
<div slot="footer">
<el-button size="small" @click="selectDialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelectDialogConfirm()">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="设置排序"
:visible.sync="sortDialogVisible"
width="40%">
<el-form :model="sortDialogData"
label-width="150px">
<el-form-item label="排序:">
<el-input v-model="sortDialogData.sort" style="width: 200px"></el-input>
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="sortDialogVisible = false" size="small">取 消</el-button>
<el-button type="primary" @click="handleUpdateSort" size="small">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchList,updateRecommendStatus,deleteNewProduct,createNewProduct,updateNewProductSort} from '@/api/newProduct';
import {fetchList as fetchProductList} from '@/api/product';
const defaultListQuery = {
pageNum: 1,
pageSize: 5,
productName: null,
recommendStatus: null
};
const defaultRecommendOptions = [
{
label: '未推荐',
value: 0
},
{
label: '推荐中',
value: 1
}
];
export default {
name: 'newProductList',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
recommendOptions: Object.assign({}, defaultRecommendOptions),
list: null,
total: null,
listLoading: false,
multipleSelection: [],
operates: [
{
label: "设为推荐",
value: 0
},
{
label: "取消推荐",
value: 1
},
{
label: "删除",
value: 2
}
],
operateType: null,
selectDialogVisible:false,
dialogData:{
list: null,
total: null,
multipleSelection:[],
listQuery:{
keyword: null,
pageNum: 1,
pageSize: 5
}
},
sortDialogVisible:false,
sortDialogData:{sort:0,id:null}
}
},
created() {
this.getList();
},
filters:{
formatRecommendStatus(status){
if(status===1){
return '推荐中';
}else{
return '未推荐';
}
}
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleRecommendStatusStatusChange(index,row){
this.updateRecommendStatusStatus(row.id,row.recommendStatus);
},
handleDelete(index,row){
this.deleteProduct(row.id);
},
handleBatchOperate(){
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
if (this.operateType === 0) {
//设为推荐
this.updateRecommendStatusStatus(ids,1);
} else if (this.operateType === 1) {
//取消推荐
this.updateRecommendStatusStatus(ids,0);
} else if(this.operateType===2){
//删除
this.deleteProduct(ids);
}else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
}
},
handleSelectProduct(){
this.selectDialogVisible=true;
this.getDialogList();
},
handleSelectSearch(){
this.getDialogList();
},
handleDialogSizeChange(val) {
this.dialogData.listQuery.pageNum = 1;
this.dialogData.listQuery.pageSize = val;
this.getDialogList();
},
handleDialogCurrentChange(val) {
this.dialogData.listQuery.pageNum = val;
this.getDialogList();
},
handleDialogSelectionChange(val){
this.dialogData.multipleSelection = val;
},
handleSelectDialogConfirm(){
if (this.dialogData.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let selectProducts = [];
for (let i = 0; i < this.dialogData.multipleSelection.length; i++) {
selectProducts.push({
productId:this.dialogData.multipleSelection[i].id,
productName:this.dialogData.multipleSelection[i].name
});
}
this.$confirm('使用要进行添加操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
createNewProduct(selectProducts).then(response=>{
this.selectDialogVisible=false;
this.dialogData.multipleSelection=[];
this.getList();
this.$message({
type: 'success',
message: '添加成功!'
});
});
});
},
handleEditSort(index,row){
this.sortDialogVisible=true;
this.sortDialogData.sort=row.sort;
this.sortDialogData.id=row.id;
},
handleUpdateSort(){
this.$confirm('是否要修改排序?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateNewProductSort(this.sortDialogData).then(response=>{
this.sortDialogVisible=false;
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
})
},
updateRecommendStatusStatus(ids,status){
this.$confirm('是否要修改推荐状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
params.append("recommendStatus",status);
updateRecommendStatus(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '修改成功!'
});
});
}).catch(() => {
this.$message({
type: 'success',
message: '已取消操作!'
});
this.getList();
});
},
deleteProduct(ids){
this.$confirm('是否要删除该推荐?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
deleteNewProduct(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
},
getDialogList(){
fetchProductList(this.dialogData.listQuery).then(response=>{
this.dialogData.list=response.data.list;
this.dialogData.total=response.data.total;
})
}
}
}
</script>
<style></style>
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="专题名称:">
<el-input v-model="listQuery.subjectName" class="input-width" placeholder="专题名称"></el-input>
</el-form-item>
<el-form-item label="推荐状态:">
<el-select v-model="listQuery.recommendStatus" placeholder="全部" clearable class="input-width">
<el-option v-for="item in recommendOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button size="mini" class="btn-add" @click="handleSelectSubject()">选择专题</el-button>
</el-card>
<div class="table-container">
<el-table ref="newSubjectTable"
:data="list"
style="width: 100%;"
@selection-change="handleSelectionChange"
v-loading="listLoading" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="120" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="专题名称" align="center">
<template slot-scope="scope">{{scope.row.subjectName}}</template>
</el-table-column>
<el-table-column label="是否推荐" width="200" align="center">
<template slot-scope="scope">
<el-switch
@change="handleRecommendStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.recommendStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="160" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="状态" width="160" align="center">
<template slot-scope="scope">{{scope.row.recommendStatus | formatRecommendStatus}}</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleEditSort(scope.$index, scope.row)">设置排序
</el-button>
<el-button size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
<el-dialog title="选择专题" :visible.sync="selectDialogVisible" width="50%">
<el-input v-model="dialogData.listQuery.keyword"
style="width: 250px;margin-bottom: 20px"
size="small"
placeholder="专题名称搜索">
<el-button slot="append" icon="el-icon-search" @click="handleSelectSearch()"></el-button>
</el-input>
<el-table :data="dialogData.list"
@selection-change="handleDialogSelectionChange" border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="专题名称" align="center">
<template slot-scope="scope">{{scope.row.title}}</template>
</el-table-column>
<el-table-column label="所属分类" width="160" align="center">
<template slot-scope="scope">{{scope.row.categoryName}}</template>
</el-table-column>
<el-table-column label="添加时间" width="160" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatTime}}</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
background
@size-change="handleDialogSizeChange"
@current-change="handleDialogCurrentChange"
layout="prev, pager, next"
:current-page.sync="dialogData.listQuery.pageNum"
:page-size="dialogData.listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="dialogData.total">
</el-pagination>
</div>
<div style="clear: both;"></div>
<div slot="footer">
<el-button size="small" @click="selectDialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelectDialogConfirm()">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="设置排序"
:visible.sync="sortDialogVisible"
width="40%">
<el-form :model="sortDialogData"
label-width="150px">
<el-form-item label="排序:">
<el-input v-model="sortDialogData.sort" style="width: 200px"></el-input>
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="sortDialogVisible = false" size="small">取 消</el-button>
<el-button type="primary" @click="handleUpdateSort" size="small">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchList,updateRecommendStatus,deleteHomeSubject,createHomeSubject,updateHomeSubjectSort} from '@/api/homeSubject';
import {fetchList as fetchSubjectList} from '@/api/subject';
import {formatDate} from '@/utils/date';
const defaultListQuery = {
pageNum: 1,
pageSize: 5,
subjectName: null,
recommendStatus: null
};
const defaultRecommendOptions = [
{
label: '未推荐',
value: 0
},
{
label: '推荐中',
value: 1
}
];
export default {
name: 'homeSubjectList',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
recommendOptions: Object.assign({}, defaultRecommendOptions),
list: null,
total: null,
listLoading: false,
multipleSelection: [],
operates: [
{
label: "设为推荐",
value: 0
},
{
label: "取消推荐",
value: 1
},
{
label: "删除",
value: 2
}
],
operateType: null,
selectDialogVisible:false,
dialogData:{
list: null,
total: null,
multipleSelection:[],
listQuery:{
keyword: null,
pageNum: 1,
pageSize: 5
}
},
sortDialogVisible:false,
sortDialogData:{sort:0,id:null}
}
},
created() {
this.getList();
},
filters:{
formatRecommendStatus(status){
if(status===1){
return '推荐中';
}else{
return '未推荐';
}
},
formatTime(time){
if(time==null||time===''){
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSelectionChange(val){
this.multipleSelection = val;
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleRecommendStatusStatusChange(index,row){
this.updateRecommendStatusStatus(row.id,row.recommendStatus);
},
handleDelete(index,row){
this.deleteSubject(row.id);
},
handleBatchOperate(){
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
if (this.operateType === 0) {
//设为推荐
this.updateRecommendStatusStatus(ids,1);
} else if (this.operateType === 1) {
//取消推荐
this.updateRecommendStatusStatus(ids,0);
} else if(this.operateType===2){
//删除
this.deleteSubject(ids);
}else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
}
},
handleSelectSubject(){
this.selectDialogVisible=true;
this.dialogData.listQuery.keyword=null;
this.getDialogList();
},
handleSelectSearch(){
this.getDialogList();
},
handleDialogSizeChange(val) {
this.dialogData.listQuery.pageNum = 1;
this.dialogData.listQuery.pageSize = val;
this.getDialogList();
},
handleDialogCurrentChange(val) {
this.dialogData.listQuery.pageNum = val;
this.getDialogList();
},
handleDialogSelectionChange(val){
this.dialogData.multipleSelection = val;
},
handleSelectDialogConfirm(){
if (this.dialogData.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let selectSubjects = [];
for (let i = 0; i < this.dialogData.multipleSelection.length; i++) {
selectSubjects.push({
subjectId:this.dialogData.multipleSelection[i].id,
subjectName:this.dialogData.multipleSelection[i].title
});
}
this.$confirm('使用要进行添加操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
createHomeSubject(selectSubjects).then(response=>{
this.selectDialogVisible=false;
this.dialogData.multipleSelection=[];
this.getList();
this.$message({
type: 'success',
message: '添加成功!'
});
});
});
},
handleEditSort(index,row){
this.sortDialogVisible=true;
this.sortDialogData.sort=row.sort;
this.sortDialogData.id=row.id;
},
handleUpdateSort(){
this.$confirm('是否要修改排序?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateHomeSubjectSort(this.sortDialogData).then(response=>{
this.sortDialogVisible=false;
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.list;
this.total = response.data.total;
})
},
updateRecommendStatusStatus(ids,status){
this.$confirm('是否要修改推荐状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
params.append("recommendStatus",status);
updateRecommendStatus(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '修改成功!'
});
});
}).catch(() => {
this.$message({
type: 'success',
message: '已取消操作!'
});
this.getList();
});
},
deleteSubject(ids){
this.$confirm('是否要删除该推荐?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params=new URLSearchParams();
params.append("ids",ids);
deleteHomeSubject(params).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
});
})
},
getDialogList(){
fetchSubjectList(this.dialogData.listQuery).then(response=>{
this.dialogData.list=response.data.list;
this.dialogData.total=response.data.total;
})
}
}
}
</script>
<style></style>
<template>
<div class="container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="export2Excel()"
type="primary"
size="small"
>
导出为Excel
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
@submit.native.prevent
>
<el-form-item label="单词:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
@keyup.enter.native="handleSearchList()"
></el-input>
</el-form-item>
<el-form-item label="反馈时间:">
<el-date-picker
v-model="createTime"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00', '23:59:59']"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item>
</el-form>
</div>
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="60">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="单词" align="center" width="200">
<template slot-scope="scope">
<div>
{{ scope.row.word }}
</div>
</template>
</el-table-column>
<!-- <el-table-column label="词性" align="center">
<template slot-scope="scope">{{ scope.row.wordClass }}</template>
</el-table-column> -->
<el-table-column label="错误分类" align="center">
<template slot-scope="scope">{{ scope.row.errorType }}</template>
</el-table-column>
<el-table-column label="详情描述" align="center">
<template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column>
<el-table-column label="等级" align="center" width="100">
<template slot-scope="scope">{{
scope.row.level == "0"
? "学前"
: scope.row.level == "1"
? "小学"
: scope.row.level == "2"
? "初中"
: scope.row.level == "3"
? "高中"
: scope.row.level == "4"
? "大学"
: scope.row.level == "5"
? "成人"
: ""
}}</template>
</el-table-column>
<el-table-column label="反馈时间" align="center">
<template slot-scope="scope">{{ scope.row.createTime }}</template>
</el-table-column>
<!-- <el-table-column label="例句" align="center">
<template slot-scope="scope">
<div
class="exampleMapItem"
v-for="(item, index) in scope.row.exampleMap"
:key="index"
>
<div>{{ item.sContent }}</div>
<div>{{ item.sCn }}</div>
<el-divider></el-divider>
</div>
</template>
</el-table-column> -->
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" size="mini"
>已完成</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { getPageTextbookWordError, baseWordUpdate } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null,
createTime: [],
pickerOptions: {
shortcuts: [
{
text: "最近一周",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", [start, end]);
}
},
{
text: "最近一个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit("pick", [start, end]);
}
},
{
text: "最近三个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit("pick", [start, end]);
}
}
]
}
};
},
watch: {
createTime(newValue, oldValue) {
if (this.createTime) {
[
this.listQuery.starCreateTime,
this.listQuery.endCreateTime
] = this.createTime;
// console.log(this.createTime,'==createTime');
// [
// this.auditSeniorQuery.starCreateTime,
// this.auditSeniorQuery.endCreateTime
// ] = this.createTime;
} else {
this.listQuery.starCreateTime = undefined;
this.listQuery.endCreateTime = undefined;
// this.auditSeniorQuery.starCreateTime = undefined,
// this.auditSeniorQuery.endCreateTime = undefined
}
// this.getAuditSeniorList()
}
},
methods: {
getData() {
getPageTextbookWordError(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
this.createTime = [];
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
// this.$router.push({
// path: "/wordTextbook/wordTextbookDetail",
// query: {
// id: id
// }
// });
// // console.log(123);
this.$confirm("是否确认已完成?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
baseWordUpdate({
id: id,
dealStatus: 0
}).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
this.getData();
});
});
},
export2Excel() {
getPageTextbookWordError({
pageNum: 1,
pageSize: 1000
}).then(res => {
require.ensure([], () => {
const { export_json_to_excel } = require("@/vendor/Export2Excel");
const fieldName = [
"单词",
"错误分类",
"详情描述",
"等级",
"反馈时间"
];
const filterVal = [
"word",
"errorType",
"description",
"level",
"createTime"
];
const data = res.data.list.map(v => filterVal.map(j => v[j]));
export_json_to_excel(fieldName, data, "错误单词");
});
});
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
// .exampleMapItem {
// margin-top: 5px;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-form
:model="list"
:rules="rules"
ref="wordDetailForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="单词" prop="word">
<el-col :span="11">
<el-input v-model="list.baseWord"></el-input>
</el-col>
</el-form-item>
<el-form-item label="释义" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item>
<el-form-item label="简明释义" prop="simpleIntro">
<el-col :span="11">
<el-input v-model="list.simpleIntro"></el-input>
</el-col>
</el-form-item>
<el-form-item label="等级" prop="level">
<el-col :span="11">
<el-select v-model="list.level" placeholder="请选择">
<el-option
v-for="item in levelList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item
v-for="(item, index) in list.exampleMap"
:key="index"
:label="'例句' + (index + 1)"
prop="simpleIntro"
class="item"
>
<el-col :span="11">
<el-input v-model="item.sContent"></el-input>
</el-col>
<el-col class="line" :span="1">-</el-col>
<el-col :span="11">
<el-input v-model="item.sCn"></el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getTextbookWordById,
updateByPrimaryKeySelectiveTextbookWord
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "wordErrorDetail",
data() {
return {
id: "",
list: {},
levelList: [
{
value: "0",
label: "学前"
},
{
value: "1",
label: "小学"
},
{
value: "2",
label: "初中"
},
{
value: "3",
label: "高中"
},
{
value: "4",
label: "大学"
},
{
value: "5",
label: "成人"
}
],
rules: {
word: [{ required: true, message: "必填", trigger: "blur" }],
intro: [{ required: true, message: "必填", trigger: "blur" }],
simpleIntro: [{ required: true, message: "必填", trigger: "blur" }],
level: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
methods: {
getData() {
getTextbookWordById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
// console.log(key, "---", this.list[key]);
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveTextbookWord(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="handleSearchList()"
type="primary"
size="small"
>
查询结果
</el-button>
<el-button
style="float: right; margin-right: 15px"
@click="handleResetSearch('listQuery')"
size="small"
>
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form
:inline="true"
:model="listQuery"
ref="listQuery"
size="small"
label-width="140px"
>
<el-form-item label="单词:" prop="customerName">
<el-input
style="width: 203px"
v-model="listQuery.key"
placeholder=""
></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center" width="60">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="单词" align="center" width="100">
<template slot-scope="scope">
<div
class="handleWordDetail"
@click="handleWordDetail(scope.row.id)"
>
{{ scope.row.baseWord }}
</div>
</template>
</el-table-column>
<!-- <el-table-column label="词性" align="center">
<template slot-scope="scope">{{ scope.row.wordClass }}</template>
</el-table-column> -->
<el-table-column label="释义" align="center" width="400">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column>
<el-table-column label="简明释义" align="center" width="100">
<template slot-scope="scope">{{ scope.row.simpleIntro }}</template>
</el-table-column>
<el-table-column label="等级" align="center" width="100">
<template slot-scope="scope">{{
scope.row.level == "0"
? "学前"
: scope.row.level == "1"
? "小学"
: scope.row.level == "2"
? "初中"
: scope.row.level == "3"
? "高中"
: scope.row.level == "4"
? "大学"
: scope.row.level == "5"
? "成人"
: ""
}}</template>
</el-table-column>
<el-table-column label="例句" align="center">
<template slot-scope="scope">
<div
class="exampleMapItem"
v-for="(item, index) in scope.row.exampleMap"
:key="index"
>
<div>{{ item.sContent }}</div>
<div>{{ item.sCn }}</div>
<el-divider></el-divider>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total,sizes,prev, pager, next,jumper"
:page-size="pageSize"
:page-sizes="[5, 10, 15]"
:current-page.sync="pageNum"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { getPageTextbookWord } from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
listLoading: true,
pageSize: null,
pageNum: null,
total: null
};
},
methods: {
getData() {
getPageTextbookWord(this.listQuery).then(res => {
// console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false;
this.pageNum = res.data.pageNum;
this.pageSize = res.data.pageSize;
this.total = res.data.total;
});
},
edit(id) {
console.log(id, "edit");
},
handleSearchList() {
//搜索
this.listQuery.pageNum = 1;
this.getData();
},
handleResetSearch(formName) {
this.$refs[formName].resetFields();
// 重置
// this.selectProductCateValue = [];
// this.chatTime = undefined;
// this.paymentTime = undefined;
this.listQuery = Object.assign({}, defaultListQuery);
this.getData();
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
this.listLoading = true;
this.getData();
},
handleSizeChange(val) {
//切换展示条数
this.listQuery.pageSize = val;
this.getData();
},
handleWordDetail(id) {
this.$router.push({
path: "/wordTextbook/wordTextbookDetail",
query: {
id: id
}
});
// console.log(123);
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
// .exampleMapItem {
// margin-top: 5px;
// }
.container {
padding: 30rem;
}
</style>
<template>
<div>
<h1>test</h1>
</div>
</template>
<script>
export default {
name: "test"
};
</script>
<style lang="scss" scoped></style>
<template>
<div class="container">
<el-form
:model="list"
ref="wordDetailForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="单词" prop="word">
<el-col :span="11">
<el-input v-model="list.baseWord"></el-input>
</el-col>
</el-form-item>
<el-form-item label="释义" prop="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item>
<el-form-item label="简明释义" prop="simpleIntro">
<el-col :span="11">
<el-input v-model="list.simpleIntro"></el-input>
</el-col>
</el-form-item>
<el-form-item label="等级" prop="level">
<el-col :span="11">
<el-select v-model="list.level" placeholder="请选择">
<el-option
v-for="item in levelList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-form-item>
<el-form-item
v-for="(item, index) in list.exampleMap"
:key="index"
:label="'例句' + (index + 1)"
prop="simpleIntro"
class="item"
>
<el-col :span="11">
<el-input v-model="item.sContent"></el-input>
</el-col>
<el-col class="line" :span="1">-</el-col>
<el-col :span="11">
<el-input v-model="item.sCn"></el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')"
>提交</el-button
>
<!-- <el-button @click="resetForm('wordDetailForm')">清空</el-button> -->
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
getTextbookWordById,
updateByPrimaryKeySelectiveTextbookWord
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "wordTextbookDetail",
data() {
return {
id: "",
list: {},
levelList: [
{
value: "0",
label: "学前"
},
{
value: "1",
label: "小学"
},
{
value: "2",
label: "初中"
},
{
value: "3",
label: "高中"
},
{
value: "4",
label: "大学"
},
{
value: "5",
label: "成人"
}
]
};
},
methods: {
getData() {
getTextbookWordById(this.id).then(res => {
console.log(res);
this.list = JSON.parse(JSON.stringify(res.data));
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
},
submitForm(formName) {
for (const key in this.list) {
if (this.list[key].length == 0) {
this.list[key] = undefined;
}
// console.log(key, "---", this.list[key]);
}
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
updateByPrimaryKeySelectiveTextbookWord(this.list).then(res => {
this.$message({
type: "success",
message: "提交成功!"
});
});
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
},
filters: {
formatDateTime(time) {
if (time == null || time === "") {
return "";
}
let date = new Date(time);
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
// return formatDate(date, "yyyy-MM-dd");
}
},
mounted() {
this.id = this.$route.query.id;
this.getData();
}
};
</script>
<style lang="scss" scoped>
// .item {
// display: flex;
// flex-direction: column;
// }
.container {
padding: 30rem;
}
</style>
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