diff --git a/src/assets/css/main.css b/src/assets/css/main.css index 6091a66..24162f5 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -162,7 +162,7 @@ li { width: 60%; } .orderTable td .normal{ - width: auto; + width: 90%; } .orderTable .el-select>.el-input{ diff --git a/src/store/index.js b/src/store/index.js index 6b8530e..61664fa 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -20,7 +20,8 @@ const store = new Vuex.Store({ lastSystemId: null, projectFields: {}, btns: [], - routes: [] + routes: [], + customerPage: 1 }, actions: { setSystemId({ state,commit },systemId) { @@ -78,7 +79,10 @@ const store = new Vuex.Store({ }, addRoutes(state,routes) { state.routes = routes - } + }, + SET_C_PAGE: (state, page) => { + state.customerPage = page + }, } }); diff --git a/src/views/course/AddCurriculum.vue b/src/views/course/AddCurriculum.vue index 2916389..3866711 100644 --- a/src/views/course/AddCurriculum.vue +++ b/src/views/course/AddCurriculum.vue @@ -62,11 +62,11 @@
比例分成 商务经理占比 - + 产品厂商占比 - +
@@ -498,6 +498,16 @@ export default { }).catch(err => { }); }, + // 计算比例分成 + calcProp() { + const p1 = this.form.businessProportion + const p2 = this.form.manufacturerProportion + if (p1 && p2) { + if(isNaN(p1)) return this.$message.warning('商务经理占比请输入数字') + if(isNaN(p2)) return this.$message.warning('产品厂商占比请输入数字') + if(+p1 + +p2 !== 100) return this.$message.warning('比例分成总和须为100%,请重新修改') + } + }, handleExceed(files, fileList) { // 文件超出个数限制时的钩子 this.$message.warning("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); }, diff --git a/src/views/customer/AddCustomer.vue b/src/views/customer/AddCustomer.vue index 6bdaea0..1c0939e 100644 --- a/src/views/customer/AddCustomer.vue +++ b/src/views/customer/AddCustomer.vue @@ -10,12 +10,12 @@ - +
- + @@ -76,8 +76,9 @@ -
- 确定 +
+ 确定 + 取消
@@ -104,7 +105,7 @@ 导出列表
- + @@ -158,7 +159,7 @@ - + @@ -277,7 +278,7 @@ export default { token: sessionStorage.getItem('token'), customerId : this.$route.query.id, isDetail : Boolean(this.$route.query.show), - curTab: 'tab1', + curTab: this.$route.query.type || 'tab1', tabs: { tab1: '基本信息', tab2: '已订阅产品', @@ -414,7 +415,7 @@ export default { ], products: [], productAll: [], - pageProduct: 1, + pageProduct: this.$route.query.type === 'tab2' ? (+this.$route.query.page || 1) : 1, pageSizeProduct: 10, totalProduct: 0, @@ -449,7 +450,7 @@ export default { name: '待发货' } ], - pageOrder: 1, + pageOrder: this.$route.query.type === 'tab3' ? (+this.$route.query.page || 1) : 1, pageSizeOrder: 10, totalOrder: 0, orders: [], @@ -457,7 +458,7 @@ export default { bmsKeyword: '', bms: [], - pageBm: 1, + pageBm: this.$route.query.type === 'tab5' ? (+this.$route.query.page || 1) : 1, pageSizeBm: 10, totalBm: 0, @@ -487,9 +488,10 @@ export default { },500) }, 'form3.keyword': function(val) { + this.pageOrder = 1 clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { - this.filterOrder() + this.handlePageOrder() },500) }, bmsKeyword: function(val) { @@ -562,6 +564,15 @@ export default { e.endTime = connect ? list[list.length - 1].endTime : list[0].endTime e.status = '未生效' e.orderEnable = list[0].isEnable + + // 如果还有未生效的订单,页面上要显示出来 + if (!connect && list[1]) { + const notActive = list.slice(1) // 取第一个订单以后的所有订单 + e.other = '' + notActive.map(j => { + e.other += `
${j.startTime} ~ ${j.endTime}` + }) + } } else if (now > new Date(list[list.length - 1].endTime).getTime()) { e.status = '已过期' } else { @@ -609,7 +620,7 @@ export default { e.startAndEndTime = e.status === '已过期' ? '' : e.startTime + ' ~ ' + e.endTime e.productTypeName = productTypeList.find(n => n.id === e.productType).name // 1开启 0禁用(已过期的订单,或者当前生效的订单为禁用,则显示为禁用,否则是启用) - e.isEnable = (e.status === '已过期' || !e.orderEnable) ? + e.isEnable = (e.status === '未生效' || e.status === '已过期' || !e.orderEnable) ? 0 : 1 } @@ -621,7 +632,7 @@ export default { }, // 获取剩余日期 getRemain(startTime, endTime) { - return parseInt(((new Date(endTime).getTime() - new Date(startTime).getTime()) / 86400000)) + 1 + return parseInt(((new Date(endTime).getTime() - new Date(startTime).getTime()) / 86400000)) }, // 分页 handlePage() { @@ -630,6 +641,7 @@ export default { handleCurrentChangeProduct(val) { this.pageProduct = val this.handlePage() + this.$router.push(`addcustomer?id=${this.customerId}&type=tab2&page=${val}`) }, // 已订阅产品筛选 filterForm2() { @@ -670,7 +682,7 @@ export default { customerName: this.form.customerName, orderStatus, orderType, - pageNo: this.pageOrder, + pageNo: 1, pageSize: 10000, provinceId: '' }).then(({ orderPage }) => { @@ -688,7 +700,7 @@ export default { filterOrder() { const { keyword } = this.form3 const { orders } = this - this.orders = keyword ? orders.filter(e => e.orderNumber.includes(keyword) || e.orderContent.includes(keyword)) : this.orderAll + this.orders = keyword ? this.orderAll.filter(e => e.orderNumber.includes(keyword) || e.orderContent.includes(keyword)) : orders }, // 分页 handlePageOrder() { @@ -698,6 +710,7 @@ export default { handleCurrentChangeOrder(val) { this.pageOrder = val this.handlePageOrder() + this.$router.push(`addcustomer?id=${this.customerId}&type=tab3&page=${val}`) }, // 订单详情 toOrderDetail(row) { @@ -719,6 +732,7 @@ export default { handleCurrentChangeBm(val) { this.pageBm = val this.getBm() + this.$router.push(`addcustomer?id=${this.customerId}&type=tab5&page=${val}`) }, // 商务经理查看 toOrder(row) { @@ -727,6 +741,11 @@ export default { tabChange(index) { this.curTab = index + this.$router.push(`addcustomer?id=${this.customerId}&type=${index}`) + this.pageProduct = 1 + this.pageOrder = 1 + this.pageBm = 1 + index === 'tab3' && this.handlePageOrder() }, // 获取城市 getCityData(){ @@ -938,7 +957,7 @@ export default { }, goback(){ - this.$router.back() + this.$router.push(`customer?page=${this.$store.state.customerPage}`) } } }; @@ -950,6 +969,7 @@ export default { } .card { min-height: calc(100vh - 260px); + margin-bottom: 20px; } .addhr_tag{ background-color: #666; @@ -976,4 +996,10 @@ export default { line-clamp: 2; -webkit-box-orient: vertical; } +.info { + margin-top: 20px; + .el-select { + width: 100%; + } +} diff --git a/src/views/customer/Order.vue b/src/views/customer/Order.vue index 96ccca3..32af66e 100644 --- a/src/views/customer/Order.vue +++ b/src/views/customer/Order.vue @@ -5,7 +5,7 @@
返回 - {{ $route.query.userName }} + {{ $route.query.userName }}的订单
diff --git a/src/views/customer/customer.vue b/src/views/customer/customer.vue index af46f5e..ff5e951 100644 --- a/src/views/customer/customer.vue +++ b/src/views/customer/customer.vue @@ -236,6 +236,7 @@ export default { }, handleCurrentChange(val) { this.page = val + this.$store.commit('SET_C_PAGE', val) this.$router.push(`customer?page=${val}`) this.getData() }, diff --git a/src/views/data/Product.vue b/src/views/data/Product.vue index eebea10..7c94ae3 100644 --- a/src/views/data/Product.vue +++ b/src/views/data/Product.vue @@ -76,13 +76,13 @@
商务经理占比 - +
产品厂商占比 - +
@@ -491,6 +491,16 @@ export default { this.page = val this.getData() }, + // 计算比例分成 + calcProp() { + const p1 = this.businessProportion + const p2 = this.manufacturerProportion + if (p1 && p2) { + if(isNaN(p1)) return this.$message.warning('商务经理占比请输入数字') + if(isNaN(p2)) return this.$message.warning('产品厂商占比请输入数字') + if(+p1 + +p2 !== 100) return this.$message.warning('比例分成总和须为100%,请重新修改') + } + }, // 关闭产品弹框回调 closeProduct(){ this.productName = '' diff --git a/src/views/order/AddOrder.vue b/src/views/order/AddOrder.vue index d32a3ff..2518d1b 100644 --- a/src/views/order/AddOrder.vue +++ b/src/views/order/AddOrder.vue @@ -174,12 +174,11 @@ - + @@ -204,7 +203,7 @@ :disabled="viewDisabled" @input="scope.row.settlementPrice = scope.row.settlementPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="scope.row.settlementPrice" - type="text"> + type="text"> 元
@@ -222,18 +221,25 @@ @click="delCourseForm(scope.$index)" style="margin-right:10px;" >删除 + + - + - + @@ -395,8 +401,8 @@ style="margin-right:10px;" >删除 e.authority)) { promises.push(new Promise((resolve, reject) => { this.$post(this.api.renew, { @@ -913,14 +920,13 @@ export default { }); }, setStartDate(renewList, orderOther) { - console.log(555) let list = orderOther.map(e => { + const now = Date.now() const item = renewList.find(n => n.dataOrCourseId === e.dataOrCourseId && n.authority === e.authority) // 匹配renew接口返回的数据 if (item) { // 处于续费 if (this.renewDisabled) { let end = Date.parse(item.endTime); - let now = +new Date(); if (now < end) { let time = new Date(item.endTime.split(" ")[0]) time = new Date(time.setDate(time.getDate() + 1)) @@ -936,6 +942,15 @@ export default { e.endTime = item.endTime.split(" ")[0]; } } + const startTime = new Date(e.startTime) + const endTime = new Date(e.endTime) + // 1: 未生效,2:生效中,3:已过期 + e.status = now < startTime ? + 1 : + now > startTime && now < endTime ? + 2 : + 3 + if (e.status === 3) e.isEnable = 0 // 已过期的,变成禁用状态,且不能启用 return e; });// 俩列表 @@ -1126,7 +1141,7 @@ export default { ship: 0,// 发货否(0未发货,1已发货,默认不发货) authority: 1, // 区分权限 0为数据平台权限,1为课程权限 options: 1, - settlementPrice: '', // 结算价 + settlementPrice: orderType === 2 ? 0 : '', // 结算价 settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成 settlementPriceUnit: e.settlementPrice, // 结算单价 businessProportion: e.businessProportion, // 商务占比 @@ -1234,10 +1249,10 @@ export default { startTime: new Date(),// 开始 endTime: "", // 终止 remainingPeriod: "",// 剩余期限 - marketValue: e.market, // 市场价 - marketValue: e.market, // 市场单价 - finalPrice: '',// 成交价 - finalValue: '', // 成交单价 + marketValue: '', // 市场单价(订单里需要保存的) + marketPrice: e.market, // 原始市场单价(产品里添加的) + finalPrice: orderType === 2 ? 0 : '',// 成交价 + finalValue: orderType === 2 ? 0 : '', // 成交单价 discountRate: "",// 折扣率 accountNum: "",// 账号数 totalAmount: orderType === 2 ? 0 : '',// 总价 @@ -1245,7 +1260,7 @@ export default { ship: 0,// 发货否(0未发货,1已发货,默认不发货) authority: 0,// 数据平台权限 options:1, - settlementPrice: '', // 结算价 + settlementPrice: orderType === 2 ? 0 : '', // 结算价 settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成 settlementPriceUnit: e.settlementPrice, // 结算单价 businessProportion: e.businessProportion, // 商务占比 @@ -1357,18 +1372,16 @@ export default { options === 1 ? 12 : 1)).toFixed(2) + this.calculateDiscount(val, row) } }, // 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) dealComputers(e, row) { const { finalValue, accountNum, periodOfUse, options } = row if (finalValue && accountNum) { - row.finalPrice = ((!options ? - finalValue / 365 * periodOfUse : - options === 1 ? - finalValue / 12 * periodOfUse : - finalValue * periodOfUse) * accountNum).toFixed(2) + row.finalPrice = Math.round(finalValue * periodOfUse * accountNum) } + this.dealSettlePrice(row) this.allAmount(e, row) }, // 计算结算价 @@ -1376,7 +1389,7 @@ export default { const unit = row.options // 使用期限单位 const useUnit = row.periodOfUse // 使用期限 let sPrice = '' - if (row.settlementMethod === '0') { + if (row.settlementMethod == 0) { // 结算单价。计算规则:结算单价(**元/年)*购买时长(单位年)*数量(课程为1,数据为账号数量)(单位是万) const priceUnit = row.settlementPriceUnit sPrice = ((!unit ? @@ -1388,7 +1401,7 @@ export default { row.accountNum)).toFixed(2) } else { // 比例分成。计算规则:成交价*商务分成比例(单位是万) - sPrice = row.finalPrice * row.businessProportion / 100 + sPrice = (row.finalPrice * row.businessProportion / 100).toFixed(2) } row.settlementPrice = this.handleNaN(sPrice) }, @@ -1417,17 +1430,15 @@ export default { row.remainingPeriod = endYears const unit = row.options // 使用期限单位 const useUnit = row.periodOfUse // 使用期限 - // 计算市场价(课程才需要) - if (row.authority) { - const price = row.marketPrice // 市场单价 - // 结算单价是元/年,所以如果选择的不是年,要进行换算(日:/365,月:/12) - row.marketValue = ((!unit ? - price / 365 * useUnit : - unit === 1 ? - price / 12 * useUnit : - price * useUnit)).toFixed(2) - } - this.dealSettlePrice(row) + let price = row.marketPrice // 市场单价 + // 结算单价是元/年,所以如果选择的不是年,要进行换算(日:/365,月:/12) + row.marketValue = ((!unit ? + price / 365 * useUnit : + unit === 1 ? + price / 12 * useUnit : + price * useUnit)).toFixed(2) + + this.dealComputers(e, row) // 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 if (isDate) { const cId = row.dataOrCourseId diff --git a/src/views/parner/pcRole.vue b/src/views/parner/pcRole.vue index 13e4e7d..c91ecb6 100644 --- a/src/views/parner/pcRole.vue +++ b/src/views/parner/pcRole.vue @@ -109,7 +109,7 @@ export default { methods: { getData() { // platformId 合伙人为4,具体看setting.js; - this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=${this.platformId}`).then(res => { + this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=${this.platformId}&port=0`).then(res => { this.listData = res.rolePage.records; this.total = res.rolePage.total; }).catch(res => {}); diff --git a/src/views/parner/staff.vue b/src/views/parner/staff.vue index a75f125..b0a108d 100644 --- a/src/views/parner/staff.vue +++ b/src/views/parner/staff.vue @@ -4,7 +4,7 @@
-
或然城市合伙人
+
或然城市合伙人
添加分类
@@ -232,13 +232,14 @@ export default { qrcode: '', expireTime: '', curTeamId: '', - submiting: false // 新增编辑防抖标识 + submiting: false, // 新增编辑防抖标识 + setKey: '' }; }, watch: { keyWord: function(val) { clearTimeout(this.searchTimer); - this.searchTimer = setTimeout(this.getList, 500); + this.searchTimer = setTimeout(this.initData, 500); } }, mounted() { @@ -250,10 +251,11 @@ export default { const res = await this.$post(this.api.listParner) const list = res.treeList // 没有子级,删除children属性 - const handleLeaf = list => { + const handleLeaf = (list, ids) => { list.map(e => { + e.ids = ids ? [...ids, e.id] : [e.id] if (e.children.length) { - handleLeaf(e.children) + handleLeaf(e.children, e.ids) } else { delete e.children } @@ -261,6 +263,10 @@ export default { } handleLeaf(list) this.orgList = list + // 如果刚编辑完,则选中刚编辑的分类 + this.setKey && this.$nextTick(() => { + this.$refs.orgTree.setCurrentKey(this.setKey) + }) this.getList() }, // 添加部门 @@ -284,7 +290,7 @@ export default { partnerClassificationName: data.partnerClassificationName } this.orgVisible = true - const ids = data.ids + const { ids } = data ids.splice(ids.length - 1, 1) this.cascaderValue = ids }, @@ -332,6 +338,7 @@ export default { // 编辑 this.$post(this.api.updateParner, form).then(res => { util.successMsg("编辑成功!") + this.setKey = form.id this.closeOrg() }).catch(err => {}) } @@ -342,7 +349,7 @@ export default { getTeamId(list) { for (const i in list) { const e = list[i] - if (e.isTeam) { + if (e.isTeam && !this.curTeamId) { this.curTeamId = e.id break } else { @@ -352,16 +359,15 @@ export default { }, // 点击树节点查询列表数据 handleNodeClick(data) { - this.curTeamId = data.id + this.curTeamId = '' if (data.isTeam) { this.curTeamId = data.id } else { this.getTeamId(data.children) } - if (this.curTeamId) { - this.$refs.orgTree.setCurrentKey(this.curTeamId) - this.getList() - } + if (!this.curTeamId) this.curTeamId = data.id + this.$refs.orgTree.setCurrentKey(this.curTeamId) + this.initData() this.$refs.table.clearSelection() }, // 关闭组织新增编辑弹框 @@ -370,6 +376,11 @@ export default { this.cascaderValue = [] this.getOrg() }, + // 查询全部 + getAll() { + this.curTeamId = '' + this.getList() + }, // 员工列表 getList() { this.$post(this.api.partnerAccountList, { @@ -454,7 +465,7 @@ export default { border-right: 1px solid rgba(0, 0, 0, 0.06); } .right { - width: calc(100% - 374px); + flex: 1; padding: 24px 0; } } diff --git a/src/views/system/role.vue b/src/views/system/role.vue index 76f6fef..85c979a 100644 --- a/src/views/system/role.vue +++ b/src/views/system/role.vue @@ -107,7 +107,7 @@ export default { }, methods: { getData() { - this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=${Setting.platformId}`).then(res => { + this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${this.keyword}&platformId=${Setting.platformId}&port=0`).then(res => { this.listData = res.rolePage.records; this.total = res.rolePage.total; }).catch(res => {}); diff --git a/src/views/system/staff.vue b/src/views/system/staff.vue index 732d7c6..75122b5 100644 --- a/src/views/system/staff.vue +++ b/src/views/system/staff.vue @@ -555,7 +555,25 @@ export default { this.$get(`${this.api.staffDetail}?accountId=${row.accountId}`).then(res => { const { data } = res const { staffArchitectureId, roleId } = data - if (roleId) data.roleList = roleId.split(',').map(e => Number(e)) + if (roleId) { + const roleList = roleId.split(',').map(e => Number(e)) + const list = this.roleList + if (roleList.length) { + let has = false // 是否在角色列表里有已选择的角色,全部都被删除了,则提示 + for (const i in roleList) { + if (list.find(n => n.id === roleList[i])) { + has = true + break + } + } + if (!has) { + util.warningMsg('角色被删请重新选择') + data.roleList = [] + } else { + data.roleList = roleList + } + } + } if (staffArchitectureId) { handleArchId(this.orgList, staffArchitectureId.split(',').map(e => Number(e))) data.staffArchitectureId = archId @@ -563,12 +581,11 @@ export default { this.form = data this.originAccount = data.account this.originWorkNumber = data.workNumber - console.log(333, this.orgList) }).catch(res => {}) }, // 获取角色数据 getRole() { - this.$get(`${this.api.roleList}?page=1&size=1000&name=&platformId=${Setting.platformId}`).then(res => { + this.$get(`${this.api.roleList}?page=1&size=1000&name=&platformId=${Setting.platformId}&port=0`).then(res => { this.roleList = res.rolePage.records }).catch(res => {}) },