Commit 219affc8 by cmosquito

更新页面

parent bf4fce74
...@@ -6,7 +6,7 @@ module.exports = merge(prodEnv, { ...@@ -6,7 +6,7 @@ module.exports = merge(prodEnv, {
NODE_ENV: '"development"', NODE_ENV: '"development"',
// BASE_API: '"http://localhost:8080"' // BASE_API: '"http://localhost:8080"'
// BASE_API: '"http://192.168.10.112:8045"', //本地系统服务器地址 // BASE_API: '"http://192.168.10.112:8045"', //本地系统服务器地址
// BASE_API: '"https://pandaxuequ.com.cn/words/admin"' //线上系统服务器地址 BASE_API: '"https://pandaxuequ.com.cn/words/admin"' //线上系统服务器地址
BASE_API: '"https://test.pandaxuequ.com.cn/words/admin"'//线上地址 // BASE_API: '"https://test.pandaxuequ.com.cn/words/admin"'//线上地址
}); });
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module.exports = { module.exports = {
NODE_ENV: '"production"', NODE_ENV: '"production"',
// BASE_API: '"https://pandaxuequ.com.cn/words/admin"'//线上地址 // BASE_API: '"https://pandaxuequ.com.cn/words/admin"'//线上地址
// BASE_API: '"https://pandaxuequ.com.cn/words/admin"' BASE_API: '"https://pandaxuequ.com.cn/words/admin"'
// BASE_API: '"http://192.168.10.112:8045"' //本地系统服务器地址 // BASE_API: '"http://192.168.10.112:8045"' //本地系统服务器地址
BASE_API: '"https://test.pandaxuequ.com.cn/words/admin"'//线上地址 // BASE_API: '"https://test.pandaxuequ.com.cn/words/admin"'//线上测试服地址
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" /> <meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>熊猫单词宝</title> <title>熊猫单词宝-渠道管理系统</title>
<style type="text/css"> <style type="text/css">
:root { :root {
font-size: calc(100vw / 1920); font-size: calc(100vw / 1920);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.18.0", "axios": "^0.18.0",
"clipboard": "^2.0.11",
"echarts": "^4.2.0-rc.2", "echarts": "^4.2.0-rc.2",
"element-ui": "^2.3.7", "element-ui": "^2.3.7",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
......
import request from '@/utils/request' import request from '@/utils/request'
export function fetchList(params) { export function fetchList(params) {
return request({ return request({
url:'/order/list', url:'/brand/list',
method:'get', method:'get',
params:params params:params
}) })
} }
export function createBrand(data) {
export function closeOrder(params) {
return request({ return request({
url:'/order/update/close', url:'/brand/create',
method:'post', method:'post',
params:params data:data
}) })
} }
export function updateShowStatus(data) {
export function deleteOrder(params) {
return request({ return request({
url:'/order/delete', url:'/brand/update/showStatus',
method:'post', method:'post',
params:params data:data
}) })
} }
export function deliveryOrder(data) { export function updateFactoryStatus(data) {
return request({ return request({
url:'/order/update/delivery', url:'/brand/update/factoryStatus',
method:'post', method:'post',
data:data data:data
}); })
} }
export function getOrderDetail(id) { export function deleteBrand(id) {
return request({ return request({
url:'/order/'+id, url:'/brand/delete/'+id,
method:'get' method:'get',
}); })
} }
export function updateReceiverInfo(data) { export function getBrand(id) {
return request({ return request({
url:'/order/update/receiverInfo', url:'/brand/'+id,
method:'post', method:'get',
data:data })
});
} }
export function updateMoneyInfo(data) { export function updateBrand(id,data) {
return request({ return request({
url:'/order/update/moneyInfo', url:'/brand/update/'+id,
method:'post', method:'post',
data:data data:data
});
}
export function updateOrderNote(params) {
return request({
url:'/order/update/note',
method:'post',
params:params
}) })
} }
import request from '@/utils/request'
export function getChaInfo() {
return request({
url:'/mashup/channel/mge/info',
method:'post',
})
}
export function getUserList(data) {
return request({
url:'/mashup/channel/mge/users',
method:'post',
data
})
}
export function getUserMoney(data) {
return request({
url:'/mashup/channel/mge/user/consume',
method:'post',
data
})
}
\ No newline at end of file
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' import request from '@/utils/request'
export function policy() { export function fetchList(params) {
return request({ return request({
url:'/aliyun/oss/policy', url:'/couponHistory/list',
method:'get', 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
})
}
...@@ -2,7 +2,8 @@ import request from '@/utils/request' ...@@ -2,7 +2,8 @@ import request from '@/utils/request'
export function login(username, password) { export function login(username, password) {
return request({ return request({
url: '/admin/login', // url: '/admin/login',
url: '/mashup/channel/mge/login',
method: 'post', method: 'post',
data: { data: {
username, username,
......
import request from '@/utils/request' import request from '@/utils/request'
export function fetchList(cid,params) { export function fetchList(params) {
return request({ return request({
url:'/productAttribute/list/'+cid, url:'/home/newProduct/list',
method:'get', method:'get',
params:params params:params
}) })
} }
export function deleteProductAttr(data) { export function updateRecommendStatus(data) {
return request({ return request({
url:'/productAttribute/delete', url:'/home/newProduct/update/recommendStatus',
method:'post', method:'post',
data:data data:data
}) })
} }
export function createProductAttr(data) { export function deleteNewProduct(data) {
return request({ return request({
url:'/productAttribute/create', url:'/home/newProduct/delete',
method:'post', method:'post',
data:data data:data
}) })
} }
export function updateProductAttr(id,data) { export function createNewProduct(data) {
return request({ return request({
url:'/productAttribute/update/'+id, url:'/home/newProduct/create',
method:'post', method:'post',
data:data data:data
}) })
} }
export function getProductAttr(id) {
return request({
url:'/productAttribute/'+id,
method:'get'
})
}
export function getProductAttrInfo(productCategoryId) { export function updateNewProductSort(params) {
return request({ return request({
url:'/productAttribute/attrInfo/'+productCategoryId, url:'/home/newProduct/update/sort/'+params.id,
method:'get' method:'post',
params:params
}) })
} }
import request from "@/utils/request";
export function fetchList(params) {
return request({
url: "/product/list",
method: "get",
params: params
});
}
export function fetchSimpleList(params) {
return request({
url: "/product/simpleList",
method: "get",
params: params
});
}
export function updateDeleteStatus(params) {
return request({
url: "/product/update/deleteStatus",
method: "post",
params: params
});
}
export function updateNewStatus(params) {
return request({
url: "/product/update/newStatus",
method: "post",
params: params
});
}
export function noticeAll(data) {
// 学服部主管-系统公告-分页查询系统公告
return request({
url: `/system/notice/all`,
method: "post",
data
});
}
export function addNoticeAll(data) {
// 学服部主管-系统公告-添加系统公告
return request({
url: `/system/notice/add`,
method: "post",
data
});
}
export function deleteNotice(id) {
// 学服部主管-系统公告-删除系统公告
return request({
url: `/system/notice/delete/${id}`,
method: "post"
});
}
export function updateNoticeAll(data) {
// 学服部主管-系统公告-修改系统公告
return request({
url: `/system/notice/update`,
method: "post",
data
});
}
export function xuefuMasterAllStu(data) {
// 学服部主管-全部学员
return request({
url: `/course/filter/all`,
method: "post",
data
});
}
export function school(data) {
// 学服部主管-全部学员-学校列表
return request({
url: `/filter/param/school`,
method: "post",
data
});
}
export function courseTime(data) {
// 学服部主管-全部学员-报名学期列表
return request({
url: `/filter/param/courseTime`,
method: "post",
data
});
}
export function selectCourse(state, data) {
// 今日任务-审课待分配-根据条件查询(待确认/审课中、审课通过/审课未通过)课程信息
return request({
url: `/course/filter/list/selectCourse/${state}`,
method: "post",
data
});
}
export function confirmCourse(data) {
// 今日任务-审课待分配-确认课程
return request({
url: `/course/filter/confirmCourse`,
method: "post",
data
});
}
export function LOPState(data) {
// 今日任务-审课待分配-LOP确认
return request({
url: `/course/filter/LOPState`,
method: "post",
data
});
}
export function errorWord(data) {
// 单词报错查询接口
return request({
url: `/error/word`,
method: "post",
data
});
}
export function baseWordRedisData(data) {
// 单词缓存
return request({
url: `/complex/font/baseWordRedisData`,
method: "post",
data
});
}
export function getPageBaseWord(data) {
// 单词分页查询
return request({
url: `/baseWord/getPageBaseWord`,
method: "post",
data
});
}
export function getBaseWordById(id) {
// 获取单词基础信息信息
return request({
url: `/baseWord/getBaseWordById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelective(data) {
// 修改单词基础信息
return request({
url: `/baseWord/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function getPageGradeWord(data) {
// 简体词库信息分页查询
return request({
url: `/gradeWord/getPageGradeWord`,
method: "post",
data
});
}
export function gradeWordHansRedisData(data) {
// 简体词库释义缓存
return request({
url: `/complex/font/gradeWordHansRedisData`,
method: "post",
data
});
}
export function getGradeWordById(id) {
// 获取简体词库信息信息
return request({
url: `/gradeWord/getGradeWordById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveGrade(data) {
// 修改简体词库信息
return request({
url: `/gradeWord/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function addGradeWord(data) {
// 增加简体词库信息
return request({
url: `/gradeWord/add`,
method: "post",
data
});
}
export function getPageRootAffix(data) {
// 词根词缀分页查询
return request({
url: `/rootAffix/getPageRootAffix`,
method: "post",
data
});
}
export function getRootAffixById(id) {
// 获取词根词缀信息
return request({
url: `/rootAffix/getRootAffixById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveRootAffix(data) {
// 修改词根词缀
return request({
url: `/rootAffix/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function insertSelectiveRootAffix(data) {
// 添加词根词缀
return request({
url: `/rootAffix/insertSelective`,
method: "post",
data
});
}
export function deleteByPrimaryKeyRootAffix(id) {
// 删除词根词缀
return request({
url: `/rootAffix/deleteByPrimaryKey/${id}`,
method: "post"
});
}
export function getPageTextbookWord(data) {
// 词书单词信息分页查询
return request({
url: `/textbookWord/getPageTextbookWord`,
method: "post",
data
});
}
export function getTextbookWordById(id) {
// 获取词根词缀信息
return request({
url: `/textbookWord/getTextbookWordById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveTextbookWord(data) {
// 修改词书单词信息
return request({
url: `/textbookWord/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function getPageTextbookWordError(data) {
// 错误单词信息分页查询
return request({
url: `/baseWord/getPageTextbookWord`,
method: "post",
data
});
}
export function baseWordUpdate(data) {
// 错误单词信息已完成按钮
return request({
url: `/baseWord/update`,
method: "post",
data
});
}
export function getPageBaseWordMission(data) {
// 任务信息分页查询
return request({
url: `/mission/getPageBaseWord`,
method: "post",
data
});
}
export function getBaseWordByIdMission(id) {
// 获取任务信息信息
return request({
url: `/mission/getBaseWordById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveMission(data) {
// 修改任务信息
return request({
url: `/mission/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function getPageFurnitureInfo(data) {
// 家具信息分页查询
return request({
url: `/furniture/getPageFurnitureInfo`,
method: "post",
data
});
}
export function getFurnitureInfoById(id) {
// 获取家具信息信息
return request({
url: `/furniture/getFurnitureInfoById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveFurniture(data) {
// 修改家具信息
return request({
url: `/furniture/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function insertSelectiveFurniture(data) {
// 添加家具信息
return request({
url: `/furniture/insertSelective`,
method: "post",
data
});
}
export function getPageResourceStore(data) {
// 熊猫币商城信息分页查询
return request({
url: `/resource/store/getPageResourceStore`,
method: "post",
data
});
}
export function getResourceStoreById(id) {
// 获取熊猫币商城信息
return request({
url: `/resource/store/getResourceStoreById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveResourceStore(data) {
// 修改熊猫币商城信息
return request({
url: `/resource/store/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function insertSelectiveResourceStore(data) {
// 添加熊猫币商城信息
return request({
url: `/resource/store/insertSelective`,
method: "post",
data
});
}
export function deleteByPrimaryKeyResourceStore(id) {
// 删除熊猫币商城信息
return request({
url: `/resource/store/deleteByPrimaryKey/${id}`,
method: "post"
});
}
export function getPageRmbStore(data) {
// 人民币商城信息分页查询
return request({
url: `/rmbStore/getPageRmbStore`,
method: "post",
data
});
}
export function getRmbStoreById(id) {
// 获取人民币商城信息
return request({
url: `/rmbStore/getRmbStoreById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveRmbStore(data) {
// 修改人民币商城信息
return request({
url: `/rmbStore/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function insertSelectiveRmbStore(data) {
// 添加人民币商城信息
return request({
url: `/rmbStore/insertSelective`,
method: "post",
data
});
}
export function deleteByPrimaryKeyRmbStore(id) {
// 删除人民币商城信息
return request({
url: `/rmbStore/deleteByPrimaryKey/${id}`,
method: "post"
});
}
export function getRmbStoreResource(rmbStoreId) {
// 人民币商城资源信息分页查询
return request({
url: `/rmbStoreResource/getRmbStoreResource/${rmbStoreId}`,
method: "post"
});
}
export function getRmbStoreResourceById(id) {
// 获取人民币商城资源信息
return request({
url: `/rmbStoreResource/getRmbStoreResourceById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveRmbStoreResource(data) {
// 修改人民币商城资源信息
return request({
url: `/rmbStoreResource/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function insertSelectiveRmbStoreResource(data) {
// 添加人民币商城资源信息
return request({
url: `/rmbStoreResource/insertSelective`,
method: "post",
data
});
}
export function deleteByPrimaryKeyRmbStoreResource(id) {
// 删除人民币商城资源信息
return request({
url: `/rmbStoreResource/deleteByPrimaryKey/${id}`,
method: "post"
});
}
export function getInviteAwardById(data) {
// 获取邀请奖励信息信息
return request({
url: `/inviteAward/getInviteAwardById`,
method: "post",
data
});
}
export function updateByPrimaryKeySelectiveInviteAward(data) {
// 修改邀请奖励信息
return request({
url: `/inviteAward/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function getAdvertiseNumById(data) {
// 获取每日广告限制信息
return request({
url: `/advertiseNum/getAdvertiseNumById`,
method: "post",
data
});
}
export function updateByPrimaryKeySelectiveAdvertiseNum(data) {
// 修改每日广告限制
return request({
url: `/advertiseNum/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function getPageFurnitureInfoLottery(data) {
// 抽奖概率信息分页查询
return request({
url: `/lottery/getPageFurnitureInfo`,
method: "post",
data
});
}
export function allLottery(data) {
// 全部稀有度信息
return request({
url: `/lottery/all`,
method: "post",
data
});
}
export function getLotteryById(id) {
// 获取抽奖概率信息;
return request({
url: `/lottery/getLotteryById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveLottery(data) {
// 修改抽奖概率信息
return request({
url: `/lottery/updateByPrimaryKeySelective`,
method: "post",
data
});
}
export function getPageFurnitureInfoAchievement(data) {
// 勋章信息分页查询
return request({
url: `/achievement/getPageFurnitureInfo`,
method: "post",
data
});
}
export function getAchievementInfoById(id) {
// 获取勋章信息;
return request({
url: `/achievement/getAchievementInfoById/${id}`,
method: "post"
});
}
export function updateByPrimaryKeySelectiveAchievement(data) {
// 修改勋章信息
return request({
url: `/achievement/updateByPrimaryKeySelective`,
method: "post",
data
});
}
//伙伴管理模块
export function getFriendsList(data) {
// 获取伙伴信息列表
return request({
url: `/mashup/dragon/internal/api/definition/page`,
method: "post",
data
});
}
export function updateFriends(data) {
// 增加和修改改伙伴信息
return request({
url: `/mashup/dragon/internal/api/definition/save`,
method: "post",
data
});
}
export function firstDialogue(data) {
// 生成伙伴初次对话
return request({
url: `/mashup/dragon/internal/api/dialogue/material/generate`,
method: "post",
data
});
}
export function getfirstDialogue(data) {
// 获取伙伴初次对话
return request({
url: `/mashup/dragon/internal/api/dialogue/material/page`,
method: "post",
data
});
}
export function updateDialogue(data) {
// 更新对话数据
return request({
url: `/mashup/dragon/internal/api/dialogue/material/update`,
method: "post",
data
});
}
export function deleteDialogue(data) {
// 删除对话数据
return request({
url: `/mashup/dragon/internal/api/dialogue/material/delete`,
method: "post",
data
});
}
export function getFinDialogue(data) {
// 翻译、转换对话数据
return request({
url: `/mashup/dragon/internal/api/dialogue/material/transition`,
method: "post",
data
});
}
export function saveDialogue(data) {
// 保存对话数据
return request({
url: `/mashup/dragon/internal/api/dialogue/material/synchronize`,
method: "post",
data
});
}
//邮箱模块
export function updateMail(data) {
// 新增/修改邮件
return request({
url: `/mashup/mail/internal/api/save`,
method: "post",
data
});
}
export function getMailList(data) {
// 邮件分页列表
return request({
url: `/mashup/mail/internal/api/page`,
method: "post",
data
});
}
export function deleteMail(data) {
// 删除邮件
return request({
url: `/mashup/mail/internal/api/delete`,
method: "post",
data
});
}
\ No newline at end of file
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'
})
}
import router from './router' import router from "./router";
import store from './store' import store from "./store";
import NProgress from 'nprogress' // Progress 进度条 import NProgress from "nprogress"; // Progress 进度条
import 'nprogress/nprogress.css'// Progress 进度条样式 import "nprogress/nprogress.css"; // Progress 进度条样式
import { Message } from 'element-ui' import { Message } from "element-ui";
import { getToken } from '@/utils/auth' // 验权 import { getToken } from "@/utils/auth"; // 验权
const whiteList = ['/login'] // 不重定向白名单 const whiteList = ["/login"]; // 不重定向白名单
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start();
if (getToken()) { if (getToken()) {
if (to.path === '/login') { if (to.path === "/login") {
next({ path: '/' }) next({ path: "/homepage" });
NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it NProgress.done(); // if current page is dashboard will not trigger afterEach hook, so manually handle it
} else {
if (store.getters.roles.length === 0) {
store.dispatch('GetInfo').then(res => { // 拉取用户信息
let menus=res.data.menus;
let username=res.data.username;
store.dispatch('GenerateRoutes', { menus,username }).then(() => { // 生成可访问的路由表
router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
next({ ...to, replace: true })
})
}).catch((err) => {
store.dispatch('FedLogOut').then(() => {
Message.error(err || 'Verification failed, please login again')
next({ path: '/' })
})
})
} else { } else {
next() next()
} // if (store.getters.roles.length === 0) {
// store
// .dispatch("GetInfo")
// .then(res => {
// console.log(res,'1111111111');
// // 拉取用户信息
// // let menus=res.data.menus;
// // let username=res.data.username;
// let menus = [
// {
// "createTime": "2023-07-10T07:39:54.000+00:00",
// "hidden": 0,
// "icon": "product",
// "id": 288,
// "level": 1,
// "name": "homepage",
// "parentId": 287,
// "sort": 0,
// "title": "渠道管理首页"
// }
// ];
// let username = "superadmin";
// store.dispatch("GenerateRoutes", { menus, username }).then(() => {
// // 生成可访问的路由表
// router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
// next({ ...to, replace: true });
// });
// })
// .catch(err => {
// store.dispatch("FedLogOut").then(() => {
// Message.error(err || "Verification failed, please login again");
// next({ path: "/" });
// });
// });
// }
// else {
// next();
// }
} }
} else { } else {
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
next() next();
} else { } else {
next('/login') next("/login");
NProgress.done() NProgress.done();
} }
} }
}) });
router.afterEach(() => { router.afterEach(() => {
NProgress.done() // 结束Progress NProgress.done(); // 结束Progress
}) });
...@@ -26,39 +26,60 @@ export const constantRouterMap = [ ...@@ -26,39 +26,60 @@ export const constantRouterMap = [
}, },
{ path: "/404", component: () => import("@/views/404"), hidden: true }, { path: "/404", component: () => import("@/views/404"), hidden: true },
{ {
path: "", path: "/",
component: Layout, component: Layout,
redirect: "/home", redirect: "/homepage",
children: [ children: [
{ {
path: "home", path: "homepage",
name: "home", name: "homepage",
component: () => import("@/views/home/index"), component: () => import("@/views/wordchannels/homepage"),
meta: { title: "首页", icon: "home" } meta: { title: "首页", icon: "home" }
},
{
path: "channelUser",
name: "channelUser",
component: () => import("@/views/wordchannels/channelUser"),
meta: { title: "渠道用户列表", icon: "product-list" }
},
{
path: "userMoney",
name: "userMoney",
component: () => import("@/views/wordchannels/userMoney"),
meta: { title: "用户消费列表", icon: "product-list" }
} }
] ]
} }
]; ];
export const asyncRouterMap = [ export const asyncRouterMap = [
//渠道管理
{ {
path: "/wordController", path: "/wordchannels",
component: Layout, component: Layout,
redirect: "/wordController/index", redirect: "/wordchannels/homepage",
name: "wordController", name: "wordchannels",
meta: { title: "单词管理", icon: "product-list" }, meta: { title: "渠道管理", icon: "product-list" },
children: [ children: [
{
path: "homepage",
name: "homepage",
component: () => import("@/views/wordchannels/homepage"),
meta: { title: "渠道管理首页", icon: "product-list" }
},
{ {
path: "index", path: "channelUser",
name: "index", name: "channelUser",
component: () => import("@/views/wordController/index"), component: () => import("@/views/wordchannels/channelUser"),
meta: { title: "单词列表", icon: "product-list" } meta: { title: "渠道用户列表", icon: "product-list" }
}, },
{ {
path: "wordDetail", path: "userMoney",
name: "wordDetail", name: "userMoney",
component: () => import("@/views/wordController/wordDetail"), component: () => import("@/views/wordchannels/userMoney"),
meta: { title: "单词详情", icon: "product-list" } meta: { title: "用户消费聊表", icon: "product-list" }
} }
] ]
}, },
...@@ -77,59 +98,59 @@ export const asyncRouterMap = [ ...@@ -77,59 +98,59 @@ export const asyncRouterMap = [
meta: { title: "用户列表", icon: "ums-admin" } meta: { title: "用户列表", icon: "ums-admin" }
}, },
// 打包的时候注释———————————————————————————————————————————————————————— // 打包的时候注释————————————————————————————————————————————————————————
{ // {
path: "role", // path: "role",
name: "role", // name: "role",
component: () => import("@/views/ums/role/index"), // component: () => import("@/views/ums/role/index"),
meta: { title: "角色列表", icon: "ums-role" } // meta: { title: "角色列表", icon: "ums-role" }
}, // },
{ // {
path: "allocMenu", // path: "allocMenu",
name: "allocMenu", // name: "allocMenu",
component: () => import("@/views/ums/role/allocMenu"), // component: () => import("@/views/ums/role/allocMenu"),
meta: { title: "分配菜单" }, // meta: { title: "分配菜单" },
hidden: true // hidden: true
}, // },
{ // {
path: "allocResource", // path: "allocResource",
name: "allocResource", // name: "allocResource",
component: () => import("@/views/ums/role/allocResource"), // component: () => import("@/views/ums/role/allocResource"),
meta: { title: "分配资源" }, // meta: { title: "分配资源" },
hidden: true // hidden: true
}, // },
{ // {
path: "menu", // path: "menu",
name: "menu", // name: "menu",
component: () => import("@/views/ums/menu/index"), // component: () => import("@/views/ums/menu/index"),
meta: { title: "菜单列表", icon: "ums-menu" } // meta: { title: "菜单列表", icon: "ums-menu" }
}, // },
{ // {
path: "addMenu", // path: "addMenu",
name: "addMenu", // name: "addMenu",
component: () => import("@/views/ums/menu/add"), // component: () => import("@/views/ums/menu/add"),
meta: { title: "添加菜单" }, // meta: { title: "添加菜单" },
hidden: true // hidden: true
}, // },
{ // {
path: "updateMenu", // path: "updateMenu",
name: "updateMenu", // name: "updateMenu",
component: () => import("@/views/ums/menu/update"), // component: () => import("@/views/ums/menu/update"),
meta: { title: "修改菜单" }, // meta: { title: "修改菜单" },
hidden: true // hidden: true
}, // },
{ // {
path: "resource", // path: "resource",
name: "resource", // name: "resource",
component: () => import("@/views/ums/resource/index"), // component: () => import("@/views/ums/resource/index"),
meta: { title: "资源列表", icon: "ums-resource" } // meta: { title: "资源列表", icon: "ums-resource" }
}, // },
{ // {
path: "resourceCategory", // path: "resourceCategory",
name: "resourceCategory", // name: "resourceCategory",
component: () => import("@/views/ums/resource/categoryList"), // component: () => import("@/views/ums/resource/categoryList"),
meta: { title: "资源分类" }, // meta: { title: "资源分类" },
hidden: true // hidden: true
} // }
// 打包的时候注释———————————————————————————————————————————————————————— // 打包的时候注释————————————————————————————————————————————————————————
] ]
}, },
......
...@@ -31,7 +31,8 @@ const user = { ...@@ -31,7 +31,8 @@ const user = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(username, userInfo.password).then(response => { login(username, userInfo.password).then(response => {
const data = response.data const data = response.data
const tokenStr = data.tokenHead+data.token const tokenStr = data.token
setToken(tokenStr) setToken(tokenStr)
commit('SET_TOKEN', tokenStr) commit('SET_TOKEN', tokenStr)
resolve() resolve()
......
...@@ -3,6 +3,7 @@ import Cookies from 'js-cookie' ...@@ -3,6 +3,7 @@ import Cookies from 'js-cookie'
const TokenKey = 'loginToken' const TokenKey = 'loginToken'
export function getToken() { export function getToken() {
// console.log(Cookies.get(TokenKey),'token');
return Cookies.get(TokenKey) return Cookies.get(TokenKey)
} }
......
...@@ -12,7 +12,9 @@ const service = axios.create({ ...@@ -12,7 +12,9 @@ const service = axios.create({
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
if (store.getters.token) { if (store.getters.token) {
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
config.headers['Authorization'] = getToken()
// 让每个请求携带自定义token 请根据实际情况自行修改
} }
return config return config
}, error => { }, error => {
......
<template> <template>
<div class="container"> <div class="container">
<h1>xxx,您好</h1> <h1>欢迎来到熊猫单词宝渠道管理系统</h1>
<!-- <img src="@/assets/images/pandaxia.png" alt=""> --> <img src="@/assets/images/pandaxia.png" alt="">
</div> </div>
</template> </template>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<breadcrumb></breadcrumb> <breadcrumb></breadcrumb>
<el-dropdown class="avatar-container" trigger="click"> <el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img class="user-avatar" :src="avatar"> <img class="user-avatar" src="@/views/wordchannels/icon512.png">
<i class="el-icon-caret-bottom"></i> <i class="el-icon-caret-bottom"></i>
</div> </div>
<el-dropdown-menu class="user-dropdown" slot="dropdown"> <el-dropdown-menu class="user-dropdown" slot="dropdown">
......
<template> <template>
<div>
<scroll-bar> <scroll-bar>
<el-menu
<div class="menu">
<div class="jump" @click="toHome()">首页</div>
<div class="jump" @click="toUser()">渠道用户</div>
<div class="jump" @click="toMoney()">渠道详情</div>
</div>
<!-- <el-menu
mode="vertical" mode="vertical"
:show-timeout="200" :show-timeout="200"
:default-active="$route.path" :default-active="$route.path"
...@@ -9,9 +18,11 @@ ...@@ -9,9 +18,11 @@
text-color="#bfcbd9" text-color="#bfcbd9"
active-text-color="#409EFF" active-text-color="#409EFF"
> >
<sidebar-item :routes="routes"></sidebar-item> <sidebar-item :routes="routes"></sidebar-item>
</el-menu> </el-menu> -->
</scroll-bar> </scroll-bar>
</div>
</template> </template>
<script> <script>
...@@ -21,6 +32,25 @@ import ScrollBar from '@/components/ScrollBar' ...@@ -21,6 +32,25 @@ import ScrollBar from '@/components/ScrollBar'
export default { export default {
components: { SidebarItem, ScrollBar }, components: { SidebarItem, ScrollBar },
methods:{
toHome(){
this.$router.push({
path: "/homepage",
});
},
toUser(){
this.$router.push({
path: "/channelUser",
});
},
toMoney(){
this.$router.push({
path: "/userMoney",
});
},
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'sidebar', 'sidebar',
...@@ -32,7 +62,30 @@ export default { ...@@ -32,7 +62,30 @@ export default {
}, },
isCollapse() { isCollapse() {
return !this.sidebar.opened return !this.sidebar.opened
} },
} }
} }
</script> </script>
<style lang='scss' scoped>
.menu{
display: flex;
flex-flow: column;
justify-content: space-evenly;
margin-top: 100px;
width: 100%;
height: 180px;
// background-color: pink;
font-size: 20px;
.jump{
height: 60px;
text-align: center;
line-height: 60px;
color: #fff;
}
.jump:hover{
background-color: #91c5f0;
cursor:pointer
}
}
</style>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
style="width: 56px;height: 56px;color: #409EFF" style="width: 56px;height: 56px;color: #409EFF"
></svg-icon> ></svg-icon>
</div> </div>
<h2 class="login-title color-main">熊猫单词宝</h2> <h2 class="login-title color-main">熊猫单词宝-渠道管理系统</h2>
<el-form-item prop="username"> <el-form-item prop="username">
<el-input <el-input
name="username" name="username"
......
<template> <template>
<div class="container"> <div class="container">
<el-card class="filter-container" shadow="never"> <!-- <h1>lottery</h1> -->
<!-- <el-card class="filter-container" shadow="never">
<div> <div>
<i class="el-icon-search"></i> <i class="el-icon-search"></i>
<span>筛选搜索</span> <span>筛选搜索</span>
...@@ -27,40 +28,25 @@ ...@@ -27,40 +28,25 @@
ref="listQuery" ref="listQuery"
size="small" size="small"
label-width="140px" label-width="140px"
@submit.native.prevent
> >
<el-form-item label="单词:" prop="customerName"> <el-form-item label="关键字:" prop="customerName">
<el-input <el-input
style="width: 203px" style="width: 203px"
v-model="listQuery.key" v-model="listQuery.key"
placeholder="" placeholder=""
@keyup.enter.native="handleSearchList()"
></el-input> ></el-input>
</el-form-item> </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> </el-form>
<div>
</div> </div>
</div> </el-card> -->
</el-card>
<el-card class="operate-container" shadow="never"> <!-- <el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i> <i class="el-icon-tickets"></i>
<span>数据列表</span> <span>数据列表</span>
<el-button type="primary" style="float:right" size="mini" @click="handleWordAdd()">添加</el-button> <el-button class="btn-add" @click="handleAddProduct" size="mini">
<el-button class="btn-add" style="float:right; margin-right:20px" @click="complex" size="mini"> 添加
简体词库释义缓存
</el-button> </el-button>
<!-- <el-button class="btn-add" @click="handleStuDetail()" size="mini"> </el-card> -->
stuDetail
</el-button> -->
</el-card>
<div class="table-container"> <div class="table-container">
<el-table <el-table
...@@ -70,73 +56,69 @@ ...@@ -70,73 +56,69 @@
v-loading="listLoading" v-loading="listLoading"
border border
> >
<el-table-column label="序号" align="center" width="60"> <el-table-column label="序号" align="center" width="100">
<template slot-scope="scope">{{ scope.$index + 1 }}</template> <template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column> </el-table-column>
<el-table-column label="单词" align="center" width="100"> <el-table-column label="中奖概率" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div <div
class="handleWordDetail" class="handleWordDetail"
@click="handleWordDetail(scope.row.id)" @click="handleWordDetail(scope.row.id)"
> >
{{ scope.row.word }} {{ scope.row.probability }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="英式音标" align="center" width="100"> <el-table-column label="宠物的稀有度分类id" align="center">
<template slot-scope="scope">{{ scope.row.ukSoundmark }}</template> <template slot-scope="scope">{{ scope.row.dragonRarityId }}</template>
</el-table-column>
<el-table-column label="美式音标" align="center" width="100">
<template slot-scope="scope">{{ scope.row.usSoundmark }}</template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="词性" align="center">
<template slot-scope="scope">{{ scope.row.wordClass }}</template> <el-table-column label="抽奖类型" align="center">
</el-table-column> -->
<el-table-column label="等级" align="center" width="100">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.level == "0" scope.row.type == 1
? "学前" ? "普通抽奖"
: scope.row.level == "1" : scope.row.type == 2
? "小学" ? "高级抽奖"
: scope.row.level == "2"
? "初中"
: scope.row.level == "3"
? "高中"
: scope.row.level == "4"
? "大学"
: scope.row.level == "5"
? "成人"
: "" : ""
}}</template> }}</template>
</el-table-column> </el-table-column>
<el-table-column label="简明释义" align="center" width="100">
<template slot-scope="scope">{{ scope.row.simpleIntro }}</template> <el-table-column label="稀有度名称" align="center">
</el-table-column> <template slot-scope="scope">{{ scope.row.rarityName }}</template>
<el-table-column label="释义" align="center" width="200">
<template slot-scope="scope">{{ scope.row.intro }}</template>
</el-table-column> </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"> <!-- <el-table-column label="英式发音" align="center">
<template slot-scope="scope"> <template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
<div </el-table-column> -->
class="exampleMapItem" <!-- <el-table-column label="英式发音" align="center">
v-for="(item, index) in scope.row.exampleMap" <template slot-scope="scope">{{ scope.row.ukPronounce }}</template>
:key="index"
>
<div>{{ item.sContent }}</div>
<div>{{ item.sCn }}</div>
<el-divider></el-divider>
</div>
</template>
</el-table-column> </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"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.id)" type="mini" <el-button @click="handleWordDetail(scope.row.id)" type="mini"
>修改</el-button >修改</el-button
> >
<!-- <el-button
@click="handleWordDelete(scope.row.id)"
size="mini"
type="danger"
>删除</el-button
> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -159,7 +141,10 @@ ...@@ -159,7 +141,10 @@
</template> </template>
<script> <script>
import { getPageGradeWord, gradeWordHansRedisData } from "@/api/pandaWords"; import {
getPageFurnitureInfoLottery,
deleteByPrimaryKeyRootAffix
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date"; import { formatDate } from "@/utils/date";
const defaultListQuery = { const defaultListQuery = {
...@@ -176,13 +161,12 @@ export default { ...@@ -176,13 +161,12 @@ export default {
listLoading: true, listLoading: true,
pageSize: null, pageSize: null,
pageNum: null, pageNum: null,
total: null, total: null
searchValue: 1,
}; };
}, },
methods: { methods: {
getData() { getData() {
getPageGradeWord(this.listQuery).then(res => { getPageFurnitureInfoLottery(this.listQuery).then(res => {
// console.log(res); // console.log(res);
this.list = JSON.parse(JSON.stringify(res.data.list)); this.list = JSON.parse(JSON.stringify(res.data.list));
this.listLoading = false; this.listLoading = false;
...@@ -192,12 +176,11 @@ export default { ...@@ -192,12 +176,11 @@ export default {
}); });
}, },
edit(id) { edit(id) {
// console.log(id, "edit"); console.log(id, "edit");
}, },
handleSearchList() { handleSearchList() {
//搜索 //搜索
this.listQuery.pageNum = 1; this.listQuery.pageNum = 1;
this.listQuery.match = this.searchValue
this.getData(); this.getData();
}, },
handleResetSearch(formName) { handleResetSearch(formName) {
...@@ -222,35 +205,32 @@ export default { ...@@ -222,35 +205,32 @@ export default {
this.getData(); this.getData();
}, },
handleWordDetail(id) { handleWordDetail(id) {
// this.$router.push({ this.$router.push({
// path: "/wordGrade/wordGradeDetail", path: "/lottery/lotteryDetail",
// query: {
// id: id
// }
// });
// console.log(123);
const { href } = this.$router.resolve({
path: '/wordGrade/wordGradeDetail',
query: { query: {
id: id id: id
} }
}); });
window.open(href, '_blank');
},
handleWordAdd() {
this.$router.push({
path: "/wordGrade/addGradeWord",
});
// console.log(123); // console.log(123);
}, },
complex() { handleWordDelete(id) {
gradeWordHansRedisData().then(res => { this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deleteByPrimaryKeyRootAffix(id).then(res => {
this.$message({ this.$message({
message: "缓存成功", type: "success",
type: "success" message: "删除成功!"
});
this.getData();
}); });
}); });
},
handleAddProduct() {
// 添加
this.$router.push({ path: "/affixRoot/affixRootAdd" });
} }
}, },
filters: { filters: {
...@@ -273,9 +253,6 @@ export default { ...@@ -273,9 +253,6 @@ export default {
.handleWordDetail { .handleWordDetail {
cursor: pointer; cursor: pointer;
} }
// .exampleMapItem {
// margin-top: 5px;
// }
.container { .container {
padding: 30rem; padding: 30rem;
} }
......
<template> <template>
<div class="container"> <div class="container">
<!-- <h1>lotteryDetail</h1> -->
<el-form <el-form
:model="list" :model="list"
:rules="rules" :rules="rules"
ref="wordDetailForm" ref="wordDetailForm"
label-width="100px" label-width="150px"
class="demo-ruleForm" class="demo-ruleForm"
> >
<el-form-item label="单词" prop="word"> <el-form-item label="中奖概率" prop="probability">
<el-col :span="11"> <el-col :span="11">
<el-input disabled v-model="list.word"></el-input> <el-slider
v-model="list.probability"
show-input
:max="1"
:step="0.01"
></el-slider>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="英式音标" prop="intro">
<el-form-item label="宠物的稀有度分类id" prop="dragonRarityId">
<el-col :span="11"> <el-col :span="11">
<el-input v-model="list.ukSoundmark"></el-input> <!-- <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-col>
</el-form-item> </el-form-item>
<el-form-item label="美式音标" prop="intro">
<el-form-item label="抽奖类型" prop="type">
<el-col :span="11"> <el-col :span="11">
<el-input v-model="list.usSoundmark"></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-col>
</el-form-item> </el-form-item>
<el-form-item label="等级" prop="level">
<el-form-item label="稀有度名称" prop="rarityName">
<el-col :span="11"> <el-col :span="11">
<el-select v-model="list.level" placeholder="请选择" disabled> <el-select v-model="list.rarityName" placeholder="请选择">
<el-option <el-option
v-for="item in levelList" v-for="item in rarityNameList"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
...@@ -35,46 +56,33 @@ ...@@ -35,46 +56,33 @@
</el-select> </el-select>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="简明释义" prop="simpleIntro">
<!-- <el-form-item label="稀有度名称" prop="rarityName">
<el-col :span="11"> <el-col :span="11">
<el-input v-model="list.simpleIntro"></el-input> <el-input v-model="list.rarityName"></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item> -->
<el-form-item label="所需资源编号" prop="resourceCode">
<el-form-item label="释义" prop="intro">
<el-col :span="11"> <el-col :span="11">
<el-input v-model="list.intro"></el-input> <el-input v-model="list.resourceCode"></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="所需资源数量" prop="resourceNum">
<el-form-item
v-for="(item, index) in list.exampleMap"
:key="index"
:label="'例句' + (index + 1)"
prop="exampleMap"
class="item"
>
<el-col :span="11"> <el-col :span="11">
<el-input v-model="item.sContent"></el-input> <el-input
</el-col> oninput="value=value.replace(/[^\d]|^[0]/g, '')"
<el-col class="line" :span="1">-</el-col> v-model.number="list.resourceNum"
<el-col :span="8"> ></el-input>
<el-input v-model="item.sCn"></el-input>
</el-col> </el-col>
<el-button
@click="handleDel(index)"
type="danger"
size="mini"
icon="el-icon-delete"
circle
></el-button>
</el-form-item> </el-form-item>
<el-form-item label="" prop=""> <!-- <el-form-item label="词性" prop="wordClass">
<el-button @click="handleAdd" size="mini">添加例句</el-button> <el-col :span="11">
</el-form-item> <el-input v-model="list.wordClass"></el-input>
</el-col>
</el-form-item> -->
<el-form-item> <el-form-item>
<el-button type="primary" @click="submitForm('wordDetailForm')" <el-button type="primary" @click="submitForm('wordDetailForm')"
...@@ -88,88 +96,96 @@ ...@@ -88,88 +96,96 @@
<script> <script>
import { import {
getGradeWordById, getLotteryById,
updateByPrimaryKeySelectiveGrade updateByPrimaryKeySelectiveLottery,
allLottery
} from "@/api/pandaWords"; } from "@/api/pandaWords";
import { formatDate } from "@/utils/date"; import { formatDate } from "@/utils/date";
export default { export default {
name: "wordGradeDetail", name: "lotteryDetail",
data() { data() {
return { return {
id: "", id: "",
list: {}, list: {},
typeList: [
levelList: [
{ {
value: "0", value: 1,
label: "学前" label: "普通抽奖"
}, },
{ {
value: "1", value: 2,
label: "小学" label: "高级抽奖"
}
],
rarityNameList: [
{
value: 1,
label: "常见级"
}, },
{ {
value: "2", value: 2,
label: "初中" label: "稀有级"
}, },
{ {
value: "3", value: 3,
label: "高中" label: "史诗级"
}, },
{ {
value: "4", value: 4,
label: "大学" label: "传说级"
}, },
{ {
value: "5", value: 5,
label: "成人" label: "特殊怪物"
} }
], ],
allLotteryList: "",
rules: { rules: {
word: [{ required: true, message: "必填", trigger: "blur" }], probability: [{ required: true, message: "必填", trigger: "blur" }],
// intro: [{ required: true, message: "必填", trigger: "blur" }], dragonRarityId: [{ required: true, message: "必填", trigger: "blur" }],
simpleIntro: [{ required: true, message: "必填", trigger: "blur" }], rarityName: [{ required: true, message: "必填", trigger: "blur" }],
level: [{ required: true, message: "必填", trigger: "change" }] resourceCode: [{ required: true, message: "必填", trigger: "blur" }],
resourceNum: [{ required: true, message: "必填", trigger: "blur" }],
type: [{ required: true, message: "必填", trigger: "change" }]
} }
}; };
}, },
methods: { methods: {
getData() { getData() {
getGradeWordById(this.id).then(res => { getLotteryById(this.id).then(res => {
console.log(res); console.log(res);
this.list = JSON.parse(JSON.stringify(res.data)); this.list = JSON.parse(JSON.stringify(res.data));
// this.list.probability = this.list.probability * 100;
// this.listLoading = false; // this.listLoading = false;
// this.pageNum = res.data.pageNum; // this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize; // this.pageSize = res.data.pageSize;
// this.total = res.data.total; // this.total = res.data.total;
}); });
}, allLottery().then(res => {
handleAdd() { console.log(res);
this.list.exampleMap.push({ // this.list = JSON.parse(JSON.stringify(res.data));
sContent: "", // this.list.probability = this.list.probability * 100;
sCn: "" // this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
}); });
}, },
handleDel(index) {
this.list.exampleMap.splice(index, 1);
},
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
for (const key in this.list) { for (const key in this.list) {
if (this.list[key].length == 0) { if (this.list[key].length == 0) {
this.list[key] = undefined; this.list[key] = undefined;
} }
// console.log(key, "---", this.list[key]);
} }
this.$refs[formName].validate(valid => {
if (valid) {
this.$confirm("是否确认提交?", "提示", { this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(() => { }).then(() => {
updateByPrimaryKeySelectiveGrade(this.list).then(res => { updateByPrimaryKeySelectiveLottery(this.list).then(res => {
this.$message({ this.$message({
type: "success", type: "success",
message: "提交成功!" message: "提交成功!"
...@@ -181,26 +197,6 @@ export default { ...@@ -181,26 +197,6 @@ export default {
return false; return false;
} }
}); });
// this.$refs[formName].validate(valid => {
// if (valid) {
// this.$confirm("是否确认提交?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning"
// }).then(() => {
// updateByPrimaryKeySelective(this.list).then(res => {
// this.$message({
// type: "success",
// message: "提交成功!"
// });
// });
// });
// } else {
// console.log("error submit!!");
// return false;
// }
// });
}, },
resetForm(formName) { resetForm(formName) {
this.$refs[formName].resetFields(); this.$refs[formName].resetFields();
......
<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> 
<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-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.word"></el-input>
</el-col>
</el-form-item>
<el-form-item label="英式音标" prop="ukSoundmark">
<el-col :span="11">
<el-input v-model="list.ukSoundmark"></el-input>
</el-col>
</el-form-item>
<el-form-item label="美式音标" prop="usSoundmark">
<el-col :span="11">
<el-input v-model="list.usSoundmark"></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 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="intro">
<el-col :span="11">
<el-input v-model="list.intro"></el-input>
</el-col>
</el-form-item>
<el-form-item
v-for="(item, index) in list.exampleMap"
:key="index"
:label="'例句' + (index + 1)"
prop="exampleMap"
class="item"
>
<el-col :span="11">
<el-input v-model="item.sContent" placeholder="英文例句"></el-input>
</el-col>
<el-col class="line" :span="1">-</el-col>
<el-col :span="8">
<el-input v-model="item.sCn" 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-button @click="handleAdd" size="mini">添加例句</el-button>
</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 {
updateByPrimaryKeySelectiveGrade,
addGradeWord
} from "@/api/pandaWords";
import { formatDate } from "@/utils/date";
export default {
name: "addGradeWord",
data() {
return {
id: "",
list: {
exampleMap:[]
},
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: "change" }]
}
};
},
methods: {
// getData() {
// getGradeWordById(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;
// });
// },
handleAdd() {
this.list.exampleMap.push({
sContent: "",
sCn: ""
});
},
handleDel(index) {
this.list.exampleMap.splice(index, 1);
},
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.$refs[formName].validate(valid => {
if (valid) {
this.$confirm("是否确认提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
addGradeWord(this.list).then(res => {
console.log(this.list,'addlist');
this.$message({
type: "success",
message: "提交成功!"
});
});
});
} else {
console.log("error submit!!");
return false;
}
});
// this.$refs[formName].validate(valid => {
// if (valid) {
// this.$confirm("是否确认提交?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning"
// }).then(() => {
// updateByPrimaryKeySelective(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>
<h1>test</h1>
</div>
</template>
<script>
export default {
name: "test"
};
</script>
<style lang="scss" scoped></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="用户id" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.gameId }}
</div>
</template>
</el-table-column>
<el-table-column label="用户昵称" align="center">
<template slot-scope="scope">
<div>
{{ scope.row.nickname }}
</div>
</template>
</el-table-column>
<el-table-column label="渠道" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.channel }}
</div>
</template>
</el-table-column>
<el-table-column label="当前消费总金额" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.consumeAmount }}
</div>
</template>
</el-table-column>
<el-table-column label="注册时间" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.addTime }}
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button @click="handleWordDetail(scope.row.userId)" type="mini"
>查看详情</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<!-- 单人信息框 -->
<el-dialog
title="单个用户消费情况"
:visible.sync="userMoney"
width="90%"
:before-close="handleClose"
>
<el-table
ref="productTable"
:data="oneList"
style="width: 100%"
v-loading="listLoading"
border
>
<el-table-column label="序号" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.id }}
</div>
</template>
</el-table-column>
<el-table-column label="用户id" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.gameId }}
</div>
</template>
</el-table-column>
<el-table-column label="用户昵称" align="center">
<template slot-scope="scope">
<div>
{{ scope.row.nickname }}
</div>
</template>
</el-table-column>
<el-table-column label="渠道名称" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.channel }}
</div>
</template>
</el-table-column>
<el-table-column label="人民币礼包" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.orderName }}
</div>
</template>
</el-table-column>
<el-table-column label="购买金额" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.orderAmount }}
</div>
</template>
</el-table-column>
<el-table-column label="购买时间" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.orderTime }}
</div>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<!-- <el-button @click="userMoney = false">取 消</el-button> -->
<el-button type="primary" @click="userMoney = false">确 定</el-button>
</span>
</el-dialog>
<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 { getUserList,getUserMoney } from "@/api/channels";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
name:'channelUser',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
oneList:[],
listLoading: true,
pageSize: null,
pageNum: null,
total: null,
userMoney:false
};
},
methods: {
getData() {
getUserList(this.listQuery).then(res => {
// console.log(res);
this.list = 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");
},
handleClose(done) {
this.$confirm("确认关闭?")
.then(_ => {
done();
})
.catch(_ => {});
},
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(userId) {
getUserMoney({pageNum: 1,pageSize: 10,userId:userId}).then(res => {
// console.log(res,'getUserMoney');
this.oneList = res.data.list
// this.listLoading = false;
// this.pageNum = res.data.pageNum;
// this.pageSize = res.data.pageSize;
// this.total = res.data.total;
});
this.userMoney = true
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
</style>
<template>
<div class="container">
<el-main><router-view></router-view></el-main>
<h1>{{channelName}},欢迎您</h1>
<el-card class="box-card">
<div class="channelLink">
渠道链接为
<p id="chaLink">{{link}}</p>
<el-button
data-clipboard-target="#chaLink"
data-clipboard-action="copy"
type="primary"
class="btn"
@click="copy"
>一键复制</el-button
>
<el-button type="primary" @click="makeQrcode()"
>预览二维码</el-button
>
</div>
<div class="channelMember">
您当前共计邀请:
<p>{{invUserNum}}</p>
<el-button type="primary" @click="toUser()">查看详情</el-button>
</div>
<div class="channelEarn">
您当前邀请共计消费
<p>{{invUserAmount}}</p>
<el-button type="primary" @click="toMoney()">查看详情</el-button>
</div>
</el-card>
<!-- 二维码下载框 -->
<el-dialog
title="渠道链接二维码"
:visible.sync="qrcodeBox"
width="30%"
:before-close="handleClose"
>
<img :src="img" alt="" style="width:100%">
<span slot="footer" class="dialog-footer">
<el-button @click="qrcodeBox = false">取 消</el-button>
<el-button type="primary"> <a class="down" :href="picData" download="二维码.png">下载</a></el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import axios from "axios";
import { getChaInfo } from "@/api/channels";
import Clipboard from "clipboard";
export default {
name: "homepage",
data() {
return {
qrcodeBox: false,
link:'https://pandaxuequ.com.cn/#/',
img:'',
channelName:'',
invUserAmount:'',
invUserNum:'',
picData:'',
};
},
methods: {
handleClose(done) {
this.$confirm("确认关闭?")
.then(_ => {
done();
})
.catch(_ => {});
},
urlToBase64(url) {
return new Promise((resolve, reject) => {
let image = new Image();
image.onload = function () {
let canvas = document.createElement('canvas');
canvas.width = this.naturalWidth;
canvas.height = this.naturalHeight;
// 将图片插入画布并开始绘制
canvas.getContext('2d').drawImage(image, 0, 0);
// result
let result = canvas.toDataURL('image/png')
resolve(result);
};
// CORS 策略,会存在跨域问题https://stackoverflow.com/questions/20424279/canvas-todataurl-securityerror
image.setAttribute("crossOrigin", 'Anonymous');
image.src = url;
// 图片加载失败的错误处理
image.onerror = () => {
reject(new Error('urlToBase64 error'));
};
})
},
makeQrcode(){
axios.get('https://api.pwmqr.com/qrcode/create/', {
// 传递的参数
params: {
// 账号
url:encodeURI(this.link),
down:1
},
responseType: 'blob'
// 回调函数,一定要使用箭头函数,不然this的指向不是vue示例
}).then(res =>{
// console.log(res,'qrcode');
let blob = new Blob([res.data]); // 返回的文件流数据
let url = window.URL.createObjectURL(blob); // 将他转化为路径
this.img = url;
this.urlToBase64(url).then(res=> {
// 转化后的base64图片地址
this.picData = res
// console.log('base64', res)
});
this.qrcodeBox = true
// console.log(this.img,'this.img');
}).catch(error =>{
console.log(error)
})
},
getData(){
// console.log('ok');
getChaInfo().then(res => {
// console.log(res,'getData');
this.channelName = res.data.channelName
this.invUserAmount = res.data.invUserAmount
this.invUserNum = res.data.invUserNum
if(res.data.channelLink){
this.link = res.data.channelLink
}
});
},
toUser(){
this.$router.push({
path: "/channelUser",
});
},
toMoney(){
this.$router.push({
path: "/userMoney",
});
},
copy() {
let clipboard = new Clipboard(".btn");
clipboard.on("success", function(e) {
e.clearSelection();
});
clipboard.on("error", function(e) {
console.error("Action:", e.action);
console.error("Trigger:", e.trigger);
});
this.$message({
type: "success",
message: "复制成功",
duration: 1000
});
// this.pdfInfo = false;
},
},
mounted(){
this.getData()
}
};
</script>
<style lang="scss" scoped>
.container {
padding: 30rem;
h1 {
font-size: 32rem;
}
.box-card {
font-size: 20px;
p {
display: inline-block;
color: blue;
// width: 100px;
}
.down{
display: inline-block;
width: 20px;
height: 20px;
background-color: skyblue;
}
}
}
</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="oneList"
style="width: 100%"
v-loading="listLoading"
@selection-change="handleSelectionChange"
border
>
<el-table-column
type="selection"
width="60"
align="center"
></el-table-column>
<!-- <el-table-column label="序号" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.id }}
</div>
</template>
</el-table-column> -->
<el-table-column label="用户id" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.gameId }}
</div>
</template>
</el-table-column>
<el-table-column label="用户昵称" align="center">
<template slot-scope="scope">
<div>
{{ scope.row.nickname }}
</div>
</template>
</el-table-column>
<el-table-column label="渠道名称" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.channel }}
</div>
</template>
</el-table-column>
<el-table-column label="人民币礼包" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.orderName }}
</div>
</template>
</el-table-column>
<el-table-column label="购买金额" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.orderAmount }}
</div>
</template>
</el-table-column>
<el-table-column label="购买时间" align="center">
<template slot-scope="scope">
<div
>
{{ scope.row.orderTime }}
</div>
</template>
</el-table-column>
</el-table>
</div>
<div style="font-size:20px">共计数据 {{ multipleSelection.length }} 条,共: {{ money }} 元</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 { getUserList,getUserMoney } from "@/api/channels";
import { formatDate } from "@/utils/date";
const defaultListQuery = {
pageNum: 1,
pageSize: 10
};
export default {
name:'userMoney',
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
test: "errorWords",
list: [],
oneList:[],
multipleSelection: [],
money: 0,
listLoading: true,
pageSize: null,
pageNum: null,
total: null,
userMoney:false
};
},
methods: {
getData() {
getUserMoney(this.listQuery).then(res => {
// console.log(res,'getUserMoney');
this.oneList = 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");
},
handleClose(done) {
this.$confirm("确认关闭?")
.then(_ => {
done();
})
.catch(_ => {});
},
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();
},
handleSelectionChange(val) {
this.multipleSelection = val;
let arr = [];
this.multipleSelection.forEach(item => {
arr.push(item.orderAmount);
});
if (arr.length > 0) {
this.money = arr.reduce((a, b) => {
return a + b;
});
} else {
this.money = 0;
}
}
},
mounted() {
this.getData();
}
};
</script>
<style lang="scss" scoped>
.handleWordDetail {
cursor: pointer;
}
.container {
padding: 30rem;
}
</style>
This source diff could not be displayed because it is too large. You can view the blob instead.
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