From be97ea823c9ea6583111dac3ad05d17ee8250c59 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 2 Jun 2022 18:27:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/setting.js | 4 +- src/utils/api.js | 117 ++++---- src/views/course/AddCurriculum.vue | 42 ++- src/views/customer/AddCustomer.vue | 456 +++++++++++++++-------------- src/views/customer/Order.vue | 2 +- src/views/join/index.vue | 2 +- src/views/order/AddOrder.vue | 64 ++-- src/views/parner/staff.vue | 43 ++- 8 files changed, 396 insertions(+), 334 deletions(-) diff --git a/src/setting.js b/src/setting.js index 413d772..f688425 100644 --- a/src/setting.js +++ b/src/setting.js @@ -9,9 +9,9 @@ let jumpPath = `${location.origin}/judgmentPoint` let host = `${location.origin}:9000/` if (isDev) { jumpPath = "http://192.168.31.125:8087/"; // 本地调试-需要启动本地判分点系统 - host = 'http://39.108.250.202:9000/' + // host = 'http://39.108.250.202:9000/' // host = 'http://192.168.31.151:9000/'// 榕 - // host = 'http://192.168.31.137:9000/'// 赓 + host = 'http://192.168.31.137:9000/'// 赓 } else if (isPro) { jumpPath = "http://www.huorantech.cn/judgmentPoint/"; } diff --git a/src/utils/api.js b/src/utils/api.js index edee29c..3c87fe1 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -2,14 +2,13 @@ import Setting from "@/setting"; const host = Setting.apiBaseURL const uploadURL = Setting.uploadURL -const host1 = 'http://39.108.250.202:9000/' export default { logins: `users/users/user/login`, //登录 verification: `${host}users/users/user/captcha`,// 验证码图片 保留host bindPhoneOrEmail: `users/users/userAccount/bindPhoneOrEmail`,// 绑定手机 - sendPhoneOrEmailCode: `${host1}users/users/userAccount/sendPhoneOrEmailCode`,// 手机验证码 + sendPhoneOrEmailCode: `users/users/userAccount/sendPhoneOrEmailCode`,// 手机验证码 getUserRolesPermissionMenu: `users/user-role/getUserRolesPermissionMenu`, staffTemplate: `http://www.huorantech.cn/template/%E6%89%B9%E9%87%8F%E5%AF%BC%E5%85%A5%E5%91%98%E5%B7%A5%E6%A8%A1%E6%9D%BF.xlsx`, // 后台账号模板 @@ -18,14 +17,14 @@ export default { checkWorkNumOrAccount: `occupationlab/architecture/checkWorkNumOrAccount`, // 新增/编辑学生前:校验学号或者学生账号 // 订单管理 - orderAdd: `${host1}nakadai/nakadai/order/add`,// 订单添加 - orderDelete: `${host1}nakadai/nakadai/order/delete`,// 删除定单 - orderDetail: `${host1}nakadai/nakadai/order/get`,// 订单详情 - orderList: `${host1}nakadai/nakadai/order/list`,// 订单列表 - orderUpdate: `${host1}nakadai/nakadai/order/update`,// 订单更新 - renew: `${host1}nakadai/nakadai/orderOther/renew`,// 续费信息管理-post - ship: `${host1}nakadai/nakadai/orderOther/ship`,// 处理时的订单发货管理-post - getOrderOtherTime: `${host1}nakadai/nakadai/orderOther/getOrderOtherTime`, + orderAdd: `nakadai/nakadai/order/add`,// 订单添加 + orderDelete: `nakadai/nakadai/order/delete`,// 删除定单 + orderDetail: `nakadai/nakadai/order/get`,// 订单详情 + orderList: `nakadai/nakadai/order/list`,// 订单列表 + orderUpdate: `nakadai/nakadai/order/update`,// 订单更新 + renew: `nakadai/nakadai/orderOther/renew`,// 续费信息管理-post + ship: `nakadai/nakadai/orderOther/ship`,// 处理时的订单发货管理-post + getOrderOtherTime: `nakadai/nakadai/orderOther/getOrderOtherTime`, queryAccountIsExist: `liuwanr/userInfo/queryServerAccountIsExist`, //查询账号是否存在 @@ -35,7 +34,7 @@ export default { addCustomer: `nakadai/nakadai/customer/addCustomer`, queryCustomer: `nakadai/nakadai/customer/queryCustomer`, queryCustomerDetails: `nakadai/nakadai/customer/queryCustomerDetails`, - saveOrUpdate: `${host1}data/data/role/saveOrUpdate`, + saveOrUpdate: `data/data/role/saveOrUpdate`, doAssign: `data/data/permission/doAssign`, updateCustomerByRoleId: `nakadai/nakadai/customer/updateCustomerByRoleId`, checkEmailOrPhone: `nakadai/nakadai/customer/checkEmailOrPhone`, // 新增客户前:校验手机号或者邮箱 @@ -147,14 +146,14 @@ export default { courseProfessionalClass: `nakadai/nakadai/subject/courseProfessionalClass`, //课程专业类 courseProfessional: `nakadai/nakadai/subject/courseProfessional`, //课程专业 //课程管理 - curriculumList: `${host1}nakadai/nakadai/curriculum/curriculumList`, //课程列表 - createCurriculum: `${host1}nakadai/nakadai/curriculum/createCurriculum`, //创建课程 - curriculumDetail: `${host1}nakadai/nakadai/curriculum/curriculumDetail`, //课程详情 - modifyCourse: `${host1}nakadai/nakadai/curriculum/modifyCourse`, //编辑课程 - delCourse: `${host1}nakadai/nakadai/curriculum/delCourse`, //单个、批量删除课程 - isShelves: `${host1}nakadai/nakadai/curriculum/isShelves`, //上下架课程 + curriculumList: `nakadai/nakadai/curriculum/curriculumList`, //课程列表 + createCurriculum: `nakadai/nakadai/curriculum/createCurriculum`, //创建课程 + curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, //课程详情 + modifyCourse: `nakadai/nakadai/curriculum/modifyCourse`, //编辑课程 + delCourse: `nakadai/nakadai/curriculum/delCourse`, //单个、批量删除课程 + isShelves: `nakadai/nakadai/curriculum/isShelves`, //上下架课程 getInternalProjectBySystemId: `occupationlab/projectManage/getInternalProjectBySystemId`, //根据系统id、项目权限获取系统内置项目 - checkConfig: `${host1}nakadai/nakadai/curriculum/checkConfig`, + checkConfig: `nakadai/nakadai/curriculum/checkConfig`, // 课程章节管理 addChapter: `nakadai/curriculum/chapter/addChapter`, //添加章节 editChapter: `nakadai/curriculum/chapter/editChapter`, //修改章节 @@ -195,31 +194,31 @@ export default { downloadFiles: `liuwanr/aliyun/downloadFiles`, //下载文件 // 数据管理 - getIdQueryTable: `${host1}data/data/table/getIdQueryTable`, - getTableByClassification: `${host1}data/data/table/getTableByClassification`, - getTableByCondition: `${host1}data/data/table/getTableByCondition`, - originalList: `${host1}data/data/table/originalList`, - originalListById: `${host1}data/data/table/originalListById`, - saveCategory: `${host1}data/data/table/saveCategory`, - saveTable: `${host1}data/data/table/saveTable`, - updateCategory: `${host1}data/data/table/updateCategory`, - deleteCategory: `${host1}data/data/table/deleteCategory`, - deleteTable: `${host1}data/data/table/deleteTable`, - previewData: `${host1}data/data/preview`, - staticPreview: `${host1}data/data/staticPreview`, - editTableName: `${host1}data/data/table/editTableName`, - updateTableCommit: `${host1}data/data/updateTableCommit`, - getLevel: `${host1}data/category/getLevel`, - getAllTableInfoByCategoryId: `${host1}data/data/product/getAllTableInfoByCategoryId`, + getIdQueryTable: `data/data/table/getIdQueryTable`, + getTableByClassification: `data/data/table/getTableByClassification`, + getTableByCondition: `data/data/table/getTableByCondition`, + originalList: `data/data/table/originalList`, + originalListById: `data/data/table/originalListById`, + saveCategory: `data/data/table/saveCategory`, + saveTable: `data/data/table/saveTable`, + updateCategory: `data/data/table/updateCategory`, + deleteCategory: `data/data/table/deleteCategory`, + deleteTable: `data/data/table/deleteTable`, + previewData: `data/data/preview`, + staticPreview: `data/data/staticPreview`, + editTableName: `data/data/table/editTableName`, + updateTableCommit: `data/data/updateTableCommit`, + getLevel: `data/category/getLevel`, + getAllTableInfoByCategoryId: `data/data/product/getAllTableInfoByCategoryId`, // 产品管理 - deleteProduct: `${host1}data/data/product/delete`, - findById: `${host1}data/data/product/findById`, - listByEntity: `${host1}data/data/product/listByEntity`, - saveProduct: `${host1}data/data/product/save`, - updateProduct: `${host1}data/data/product/update`, - saveRecord: `${host1}data/data/dataRecord/saveRecord`, - getAllTableIdBycategoryId: `${host1}data/data/product/getAllTableIdBycategoryId`, + deleteProduct: `data/data/product/delete`, + findById: `data/data/product/findById`, + listByEntity: `data/data/product/listByEntity`, + saveProduct: `data/data/product/save`, + updateProduct: `data/data/product/update`, + saveRecord: `data/data/dataRecord/saveRecord`, + getAllTableIdBycategoryId: `data/data/product/getAllTableIdBycategoryId`, // 关键词 addKeyword: `data/keyword/addKeyword`, @@ -240,13 +239,13 @@ export default { exportFailure: `${host}nakadai/backstageStaff/exportFailure`, // 角色管理 - batchRemove: `${host1}users/role/batchRemove`, //批量删除角色 - checkRoleIsExist: `${host1}users/role/checkRoleIsExist`, //判断该角色是否存在 - delRoleByAccountId: `${host1}users/role/delRoleByAccountId`, //删除某用户下的某个角色 - roleList: `${host1}users/role/list`, //角色分页列表查询 - obtainDetails: `${host1}users/role/obtainDetails`, //获取角色详情 - saveOrUpdate: `${host1}users/role/saveOrUpdate`, //新增或更新角色 - queryAllMenus: `${host1}users/users/permission/queryAllMenus`, //查询所有菜单 + batchRemove: `users/role/batchRemove`, //批量删除角色 + checkRoleIsExist: `users/role/checkRoleIsExist`, //判断该角色是否存在 + delRoleByAccountId: `users/role/delRoleByAccountId`, //删除某用户下的某个角色 + roleList: `users/role/list`, //角色分页列表查询 + obtainDetails: `users/role/obtainDetails`, //获取角色详情 + saveOrUpdate: `users/role/saveOrUpdate`, //新增或更新角色 + queryAllMenus: `users/users/permission/queryAllMenus`, //查询所有菜单 // 日志管理 logAdd: `nakadai/log/add`, @@ -259,16 +258,16 @@ export default { logWithdrawal: `nakadai/log/logWithdrawal`, // 合伙人 - deleteParner: `${host1}nakadai/partnerClassification/delete`, - saveParner: `${host1}nakadai/partnerClassification/save`, - listParner: `${host1}nakadai/partnerClassification/treeList`, - updateParner: `${host1}nakadai/partnerClassification/update`, + deleteParner: `nakadai/partnerClassification/delete`, + saveParner: `nakadai/partnerClassification/save`, + listParner: `nakadai/partnerClassification/treeList`, + updateParner: `nakadai/partnerClassification/update`, - delPartnerAccount: `${host1}nakadai/partnerAccount/delPartnerAccount`, - modifyPartnerAccount: `${host1}nakadai/partnerAccount/modifyPartnerAccount`, - partnerAccountDetail: `${host1}nakadai/partnerAccount/partnerAccountDetail`, - partnerAccountList: `${host1}nakadai/partnerAccount/partnerAccountList`, - savePartnerAccount: `${host1}nakadai/partnerAccount/savePartnerAccount`, - generateInvitationCode: `${host1}nakadai/partnerAccount/generateInvitationCode`, - generationQrCode: `${host1}nakadai/partnerAccount/generationQrCode `, + delPartnerAccount: `nakadai/partnerAccount/delPartnerAccount`, + modifyPartnerAccount: `nakadai/partnerAccount/modifyPartnerAccount`, + partnerAccountDetail: `nakadai/partnerAccount/partnerAccountDetail`, + partnerAccountList: `nakadai/partnerAccount/partnerAccountList`, + savePartnerAccount: `nakadai/partnerAccount/savePartnerAccount`, + generateInvitationCode: `nakadai/partnerAccount/generateInvitationCode`, + generationQrCode: `nakadai/partnerAccount/generationQrCode `, }; \ No newline at end of file diff --git a/src/views/course/AddCurriculum.vue b/src/views/course/AddCurriculum.vue index 3866711..4c2b3a3 100644 --- a/src/views/course/AddCurriculum.vue +++ b/src/views/course/AddCurriculum.vue @@ -127,6 +127,32 @@ + + + +
+ +

上传封面

+
+ +
+

只能上传jpg/png文件

+

课程封面图将按1:1显示,最佳分辨率80*80

+
+
+
@@ -302,6 +328,7 @@ export default { professionalCategoryId: "", professionalId: "", coverUrl: "", + miniProgramPictureAddress: '', expectedCourse: "", marketPrice: "", briefIntroduction: "", @@ -453,6 +480,7 @@ export default { } this.$nextTick(() => { this.form = data; + data.miniProgramPictureAddress || this.$set(this.form, 'miniProgramPictureAddress', '') this.practiceData = data.practiceConfig; this.assessmentData = data.assessmentConfig; }); @@ -525,13 +553,23 @@ export default { return this.$confirm(`确定移除 ${file.name}?`); }, handleRemove(file, fileList) { // 文件列表移除文件时的钩子 - let fileName = this.form.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); - this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { + this.$del(`${this.api.fileDeletion}?keys=${this.form.coverUrl}`).then(res => { this.form.coverUrl = ""; }).catch(err => { }); }, + + uploadSuccessMini(res, file, fileList) { // 文件上传成功时的钩子 + this.form.miniProgramPictureAddress = res.data.filesResult.fileUrl; + }, + handleRemoveMini(file, fileList) { // 文件列表移除文件时的钩子 + this.$del(`${this.api.fileDeletion}?keys=${this.form.miniProgramPictureAddress}`).then(res => { + this.form.miniProgramPictureAddress = ""; + }).catch(err => { + }); + }, + handleConfig(type) { // 弹窗 this.permissions = type; this.configVisible = true; diff --git a/src/views/customer/AddCustomer.vue b/src/views/customer/AddCustomer.vue index 1c0939e..a42205e 100644 --- a/src/views/customer/AddCustomer.vue +++ b/src/views/customer/AddCustomer.vue @@ -2,7 +2,7 @@
-
+
返回 @@ -77,7 +77,7 @@
- 确定 + 确定 取消
@@ -477,10 +477,18 @@ export default { NoAdd: true, phoneRepeat: false, emailRepeat: false, - submiting: false // 新增编辑防抖标识 + submiting: false, // 新增编辑防抖标识 + updateTime: 0 }; }, watch: { + // 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 + form: { + handler(){ + this.updateTime++ + }, + deep:true + }, 'form2.keyword': function(val) { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { @@ -739,226 +747,236 @@ export default { this.$router.push(`/bmOrder?businessManagerId=${row.businessManagerId}&customerId=${this.customerId}&customerName=${this.form.customerName}&userName=${row.userName}`) }, - 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(){ - let data = { - provinceId: this.form.provinceId - } - this.$get(this.api.queryCity,data).then(res => { - this.cityList = res.list - }).catch(res => {}); - }, - // 清除学校 - clearSchool(){ - this.form.provinceId = '', - this.form.cityId = '', - this.form.customerName = '' - }, - // 获取学校/客户名称 - getSchoolData(){ - let data = { - schoolName: '', - provinceId: '', - cityId: '' - } - this.$get(this.api.querySchoolData).then(res => { - this.schoolList = res.list - }).catch(res => {}); - }, - // 查询客户是否存在 - SchoolChange(val){ - this.clearSchool() - if(val){ - let obj = {} - obj = this.schoolList.find((item)=>{ - return item.schoolId === val - }); - this.form.customerName = obj.schoolName - this.form.provinceId = obj.provinceId - this.getCityData() - this.form.cityId = obj.cityId - - this.$get(this.api.queryCustomerIsExists,{ - schoolId: this.form.schoolId - }).then(res => { - this.NoAdd = true - }).catch(res => { - this.NoAdd = false - }) - } - }, - // 获取行业类 - getIndustryClass(){ - this.$get(this.api.queryCustomerIndustryClass).then(res => { - this.IndustryClassList = res.list - }).catch(res => {}); - }, - // 清除行业类 - clearIndustry(){ - this.form.industryId = '' - }, - // 获取行业 - changIndustry(){ - this.clearIndustry() - this.changIndustryData() - }, - changIndustryData(){ - let data = { - industryClassId: this.form.industryClassId - } - this.$get(this.api.queryCustomerIndustry,data).then(res => { - this.industryList = res.list - }).catch(res => {}); - }, - switchOff(val, row) { - this.$post(`${this.api.orderBulkDisableEnable}?isOpen=${val}`, row.startAndEndTimeList.map(e => e.id)).then(res => { - this.$message.success(val ? '启用成功' : '禁用成功') - }).catch(res => {}) - }, - phoneChange() { // 切换手机号 - let regex = /^1[3456789]\d{9}$/; - if (regex.test(this.form.phone)) { - let url = ""; - if (!this.form.customerId) { - url = `${this.api.checkEmailOrPhone}?phone=${this.form.phone}&email=`; - } else { - url = `${this.api.checkEmailOrPhone}?customerId=${this.form.customerId}&phone=${this.form.phone}&email=`; - } - this.$post(url).then(res => { - if (res.status === 200) { - this.phoneRepeat = false; - } - }).catch(err => { - this.phoneRepeat = true; - }); - } - }, - emailChange() { // 切换邮箱 - let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; - if (regex.test(this.form.email)) { - let url = ""; - if (!this.form.customerId) { - url = `${this.api.checkEmailOrPhone}?email=${this.form.email}&phone=`; - } else { - url = `${this.api.checkEmailOrPhone}?customerId=${this.form.customerId}&email=${this.form.email}&phone=`; - } - this.$post(url).then(res => { - if (res.status === 200) { - this.emailRepeat = false; - } - }).catch(err => { - this.emailRepeat = true; - }); - } - }, - saveAdd(formName){ - this.$refs[formName].validate((valid) => { - if (valid) { - if (this.submiting) return false - if (this.phoneRepeat) { - this.$message.warning("该手机号已存在"); - return; - } - if (this.emailRepeat) { - this.$message.warning("该邮箱已存在"); - return; - } - this.submiting = true - if(this.NoAdd){ - let obj = {}; - obj = this.schoolList.find((item)=>{ - return item.schoolId == this.form.schoolId; - }); - this.form.customerName = obj.schoolName - this.form.provinceId = obj.provinceId - this.getCityData() - this.form.cityId = obj.cityId - let data = { - customerName: this.form.customerName, - customerId: this.customerId, - schoolId: this.form.schoolId, - countries: this.form.countries, - industryClassId: this.form.industryClassId, - industryId: this.form.industryId, - provinceId: this.form.provinceId, - account: this.form.account, - phone: this.form.phone, - cityId: this.form.cityId, - customerType: this.form.customerType, - expireDate: this.form.expireDate, - email: this.form.email, - name: this.form.name, - position: this.form.position - } - if(this.customerId){ - this.$post(this.api.updateCustomer,data).then((res) => { - this.$message.success('编辑成功') - this.goback() - }).catch((res) => { + // tab切换 + tabChange(index, to) { + // 当前tab是第一个,并且不是从确认询问后跳过来的,就直接调询问框询问是否保存 + if (this.curTab === 'tab1' && !to) { + this.goback(index) + } else { + 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() + this.updateTime = this.form.customerId ? 1 : 0 + } + }, + // 获取城市 + getCityData(){ + let data = { + provinceId: this.form.provinceId + } + this.$get(this.api.queryCity,data).then(res => { + this.cityList = res.list + }).catch(res => {}); + }, + // 清除学校 + clearSchool(){ + this.form.provinceId = '', + this.form.cityId = '', + this.form.customerName = '' + }, + // 获取学校/客户名称 + getSchoolData(){ + let data = { + schoolName: '', + provinceId: '', + cityId: '' + } + this.$get(this.api.querySchoolData).then(res => { + this.schoolList = res.list + }).catch(res => {}); + }, + // 查询客户是否存在 + SchoolChange(val){ + this.clearSchool() + if(val){ + let obj = {} + obj = this.schoolList.find((item)=>{ + return item.schoolId === val + }); + this.form.customerName = obj.schoolName + this.form.provinceId = obj.provinceId + this.getCityData() + this.form.cityId = obj.cityId + + this.$get(this.api.queryCustomerIsExists,{ + schoolId: this.form.schoolId + }).then(res => { + this.NoAdd = true + }).catch(res => { + this.NoAdd = false + }) + } + }, + // 获取行业类 + getIndustryClass(){ + this.$get(this.api.queryCustomerIndustryClass).then(res => { + this.IndustryClassList = res.list + }).catch(res => {}); + }, + // 清除行业类 + clearIndustry(){ + this.form.industryId = '' + }, + // 获取行业 + changIndustry(){ + this.clearIndustry() + this.changIndustryData() + }, + changIndustryData(){ + let data = { + industryClassId: this.form.industryClassId + } + this.$get(this.api.queryCustomerIndustry,data).then(res => { + this.industryList = res.list + }).catch(res => {}); + }, + switchOff(val, row) { + this.$post(`${this.api.orderBulkDisableEnable}?isOpen=${val}`, row.startAndEndTimeList.map(e => e.id)).then(res => { + this.$message.success(val ? '启用成功' : '禁用成功') + }).catch(res => {}) + }, + phoneChange() { // 切换手机号 + let regex = /^1[3456789]\d{9}$/; + if (regex.test(this.form.phone)) { + let url = ""; + if (!this.form.customerId) { + url = `${this.api.checkEmailOrPhone}?phone=${this.form.phone}&email=`; + } else { + url = `${this.api.checkEmailOrPhone}?customerId=${this.form.customerId}&phone=${this.form.phone}&email=`; + } + this.$post(url).then(res => { + if (res.status === 200) { + this.phoneRepeat = false; + } + }).catch(err => { + this.phoneRepeat = true; + }); + } + }, + emailChange() { // 切换邮箱 + let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; + if (regex.test(this.form.email)) { + let url = ""; + if (!this.form.customerId) { + url = `${this.api.checkEmailOrPhone}?email=${this.form.email}&phone=`; + } else { + url = `${this.api.checkEmailOrPhone}?customerId=${this.form.customerId}&email=${this.form.email}&phone=`; + } + this.$post(url).then(res => { + if (res.status === 200) { + this.emailRepeat = false; + } + }).catch(err => { + this.emailRepeat = true; + }); + } + }, + saveAdd(tab){ + this.$refs.form.validate((valid) => { + if (valid) { + if (this.submiting) return false + if (this.phoneRepeat) { + this.$message.warning("该手机号已存在"); + return; + } + if (this.emailRepeat) { + this.$message.warning("该邮箱已存在"); + return; + } + this.submiting = true + if(this.NoAdd){ + let obj = {}; + obj = this.schoolList.find((item)=>{ + return item.schoolId == this.form.schoolId; + }); + this.form.customerName = obj.schoolName + this.form.provinceId = obj.provinceId + this.getCityData() + this.form.cityId = obj.cityId + let data = { + customerName: this.form.customerName, + customerId: this.customerId, + schoolId: this.form.schoolId, + countries: this.form.countries, + industryClassId: this.form.industryClassId, + industryId: this.form.industryId, + provinceId: this.form.provinceId, + account: this.form.account, + phone: this.form.phone, + cityId: this.form.cityId, + customerType: this.form.customerType, + expireDate: this.form.expireDate, + email: this.form.email, + name: this.form.name, + position: this.form.position + } + if(this.customerId){ + this.$post(this.api.updateCustomer,data).then((res) => { + setTimeout(() => { this.submiting = false - }) - }else{ - this.$post(this.api.addCustomer,data).then((res) => { - let customerId = res.customerId - this.$store.commit('schoolIdData',{schoolId: this.form.schoolId}) - // this.$post(this.api.saveOrUpdate,{ - // clientId: 0, - // id: '', - // roleName: '超级管理员', - // remark: '拥有一切权限', - // isPort: 2 - // }).then(res => { - // let roleId = res.roleId - // let perData = { - // roleId, - // permissionId: ["1408370117262635009","1409351488911056897","1409351867862228993","1408370186435096578","1409352518310699009","1409352550615228418","1409352584240963585","1409352623344459778","1409352647054860289","1409352682471563266","1409352720786530305","1409352742290726913","1408370244584927233","1409352872662278146","1409352903574298626","1409352923509825538","1409352940068937730","1409353018443702273"], - // isPort: 2 - // } - // this.$post(this.api.doAssign,perData).then(res => {}).catch(res => {}) - // this.$post(`${this.api.updateCustomerByRoleId}?customerId=${customerId}&roleId=${roleId}`).then(res => {}).catch(res => {}) - // }).catch(res => {}) - - this.$message.success('添加成功') - this.goback() - }).catch((res) => { + }, 1500) + this.$message.success('编辑成功') + tab ? this.tabChange(tab, 1) : this.backPage() + }).catch((res) => { + this.submiting = false + }) + }else{ + this.$post(this.api.addCustomer,data).then((res) => { + setTimeout(() => { this.submiting = false - }) - } - }else{ - this.$message.warning('该客户已存在') - } - } - }) - }, - handleSelectionChange(val) { - this.multipleSelection = val - }, - showContract(row){ - if(!row.contractFile) return this.$message.warning('文件链接无效') - let type = row.contractFile.split('.').pop() - let img = ['jpg','gif','png','jepg'] - - this.fileSrc = row.contractFile - if(img.includes(type)){ - this.showImg = true - }else if('pdf'.includes(type)){ - this.pdfVisible = true - }else{ - window.open(`https://view.officeapps.live.com/op/view.aspx?src=${this.fileSrc}`) - } + }, 1500) + this.$store.commit('schoolIdData',{schoolId: this.form.schoolId}) + this.$message.success('添加成功') + tab ? this.tabChange(tab, 1) : this.backPage() + }).catch((res) => { + this.submiting = false + }) + } + }else{ + this.$message.warning('该客户已存在') + } + } + }) + }, + handleSelectionChange(val) { + this.multipleSelection = val + }, + showContract(row){ + if(!row.contractFile) return this.$message.warning('文件链接无效') + let type = row.contractFile.split('.').pop() + let img = ['jpg','gif','png','jepg'] - }, - goback(){ - this.$router.push(`customer?page=${this.$store.state.customerPage}`) + this.fileSrc = row.contractFile + if(img.includes(type)){ + this.showImg = true + }else if('pdf'.includes(type)){ + this.pdfVisible = true + }else{ + window.open(`https://view.officeapps.live.com/op/view.aspx?src=${this.fileSrc}`) + } + }, + goback(i) { + const id = this.form.customerId + const updateTime = this.updateTime + // 更改了信息才需要提示 + if ((id && updateTime > 1) || (!id && updateTime)) { + this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { + type: 'warning' + }).then(() => { + this.saveAdd(i) + }).catch(() => { + i ? this.tabChange(i, 1) : this.backPage() + }) + } else { + this.tabChange(i, 1) } + }, + backPage(){ + this.$router.push(`customer?page=${this.$store.state.customerPage}`) + } } }; diff --git a/src/views/customer/Order.vue b/src/views/customer/Order.vue index 32af66e..a5ce0cc 100644 --- a/src/views/customer/Order.vue +++ b/src/views/customer/Order.vue @@ -30,7 +30,7 @@ - + diff --git a/src/views/join/index.vue b/src/views/join/index.vue index cb4d3f4..ca3855a 100644 --- a/src/views/join/index.vue +++ b/src/views/join/index.vue @@ -61,7 +61,7 @@ export default { { required: true, message: '请输入手机号', trigger: 'blur' } ], code: [ - { required: util.isMobile(), message: "请输入验证码", trigger: 'blur' } + { required: true, message: "请输入验证码", trigger: 'blur' } ] }, phoneDisabled: false, diff --git a/src/views/order/AddOrder.vue b/src/views/order/AddOrder.vue index 2518d1b..7454754 100644 --- a/src/views/order/AddOrder.vue +++ b/src/views/order/AddOrder.vue @@ -1058,7 +1058,6 @@ export default { }, // 选择客户返回传值 backToOrder(val) { - console.log(val) this.showSelectClient = !this.showSelectClient; if (val.customerId) { this.form.customerName = val.customerName; @@ -1341,12 +1340,14 @@ export default { // 课程计算折扣率 calculateDiscountCourse(val, row) { const { finalPrice, marketValue } = row - if (finalPrice) row.discountRate = marketValue == 0 ? '0%' : (finalPrice / marketValue * 100).toFixed(2) + "%"; + // (原价-现价)÷原价 x100% + if (finalPrice) row.discountRate = marketValue == 0 ? '0%' : ((marketValue - finalPrice) / marketValue * 100).toFixed(2) + "%"; }, // 数据计算折扣率 calculateDiscount(val, row) { const { finalValue, marketValue } = row - if (finalValue) row.discountRate = marketValue == 0 ? '0%' : (finalValue / marketValue * 100).toFixed(2) + "%"; + // (原价-现价)÷原价 x100% + if (finalValue) row.discountRate = marketValue == 0 ? '0%' : ((marketValue - finalValue) / marketValue * 100).toFixed(2) + "%"; }, // 合同起止日期选择 contractTimeChange(val) { @@ -1367,19 +1368,27 @@ export default { dealFinalValue(val, row) { const { periodOfUse, options, accountNum, finalPrice } = row if (periodOfUse && accountNum && finalPrice) { - row.finalValue = (finalPrice / accountNum / periodOfUse * (!options ? - 365 : - options === 1 ? - 12 : - 1)).toFixed(2) + row.finalValue = (finalPrice / accountNum / periodOfUse).toFixed(2) this.calculateDiscount(val, row) } }, // 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) dealComputers(e, row) { - const { finalValue, accountNum, periodOfUse, options } = row - if (finalValue && accountNum) { - row.finalPrice = Math.round(finalValue * periodOfUse * accountNum) + const { finalValue, accountNum, periodOfUse, finalPrice } = row + if (periodOfUse) { + if (accountNum) { + // 有成交单价,则成交价=成交单价*账号数*时间 + if (finalValue) { + row.finalPrice = Math.round(finalValue * periodOfUse * accountNum) + } else if (!finalValue && finalPrice) { + // 有成交价,没有成交单价,则成交单价=成交价/账号数/时间 + row.finalValue = (finalPrice / periodOfUse / accountNum).toFixed(2) + this.calculateDiscount(e, row) + } + } else if (finalValue && finalValue) { + // 有成交价、成交单价,没有数量,则数量=成交价/时间/成交单价 + row.accountNum = Math.floor(finalPrice / periodOfUse / finalValue) + } } this.dealSettlePrice(row) this.allAmount(e, row) @@ -1388,22 +1397,24 @@ export default { dealSettlePrice(row) { const unit = row.options // 使用期限单位 const useUnit = row.periodOfUse // 使用期限 - let sPrice = '' - if (row.settlementMethod == 0) { - // 结算单价。计算规则:结算单价(**元/年)*购买时长(单位年)*数量(课程为1,数据为账号数量)(单位是万) - const priceUnit = row.settlementPriceUnit - sPrice = ((!unit ? - priceUnit / 365 * useUnit : - unit === 1 ? - priceUnit / 12 * useUnit : - priceUnit * useUnit) * (row.authority ? - 1 : - row.accountNum)).toFixed(2) - } else { - // 比例分成。计算规则:成交价*商务分成比例(单位是万) - sPrice = (row.finalPrice * row.businessProportion / 100).toFixed(2) + if (this.form.orderType !== 2) { + let sPrice = '' + if (row.settlementMethod == 0) { + // 结算单价。计算规则:结算单价(**元/年)*购买时长(单位年)*数量(课程为1,数据为账号数量)(单位是万) + const priceUnit = row.settlementPriceUnit + sPrice = ((!unit ? + priceUnit / 365 * useUnit : + unit === 1 ? + priceUnit / 12 * useUnit : + priceUnit * useUnit) * (row.authority ? + 1 : + row.accountNum)).toFixed(2) + } else { + // 比例分成。计算规则:成交价*商务分成比例(单位是万) + sPrice = (row.finalPrice * row.businessProportion / 100).toFixed(2) + } + row.settlementPrice = this.handleNaN(sPrice) } - row.settlementPrice = this.handleNaN(sPrice) }, // 使用期限转换以及计算剩余天数 deadLine(e,row,options, isDate) { @@ -1439,6 +1450,7 @@ export default { price * useUnit)).toFixed(2) this.dealComputers(e, row) + row.authority ? this.calculateDiscountCourse(e, row) : this.calculateDiscount(e, row) // 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 if (isDate) { const cId = row.dataOrCourseId diff --git a/src/views/parner/staff.vue b/src/views/parner/staff.vue index b0a108d..84fb65d 100644 --- a/src/views/parner/staff.vue +++ b/src/views/parner/staff.vue @@ -408,32 +408,27 @@ export default { }, // 添加 add() { - const { orgList } = this - if (orgList.length) { - const curNode = this.$refs.orgTree.getCurrentNode() - if (curNode && curNode.isTeam) { - util.warningMsg('请选择分类添加城市合伙人!') - } else { - const { accountId } = this - // 获取邀请码 - this.$post(`${this.api.generateInvitationCode}?accountId=${accountId}`).then(({ expireTime, invitationCode }) => { - const date = new Date(Date.now() + expireTime * 1000) // 返回的秒,要*1000 - this.expireTime = `${date.getFullYear()}-${util.preZero(date.getMonth() + 1)}-${util.preZero(date.getDate())} ${util.preZero(date.getHours())}:${util.preZero(date.getMinutes())}:${util.preZero(date.getMinutes())}` - this.parnerVisible = true - const cur = this.$refs.orgTree.getCurrentKey() - const link = `${location.origin}${Setting.isDev || Setting.isPro ? '' : '/nakadai'}/#/join?accountId=${accountId}&id=${cur ? cur: this.orgList[0].id}` + const curNode = this.$refs.orgTree.getCurrentNode() + if (curNode && curNode.isTeam) { + util.warningMsg('请选择分类添加城市合伙人!') + } else { + const { accountId } = this + // 获取邀请码 + this.$post(`${this.api.generateInvitationCode}?accountId=${accountId}`).then(({ expireTime, invitationCode }) => { + const date = new Date(Date.now() + expireTime * 1000) // 返回的秒,要*1000 + this.expireTime = `${date.getFullYear()}-${util.preZero(date.getMonth() + 1)}-${util.preZero(date.getDate())} ${util.preZero(date.getHours())}:${util.preZero(date.getMinutes())}:${util.preZero(date.getMinutes())}` + this.parnerVisible = true + const cur = this.$refs.orgTree.getCurrentKey() + const link = `${location.origin}${Setting.isDev || Setting.isPro ? '' : '/nakadai'}/#/join?accountId=${accountId}&id=${cur || ''}` - // 生成二维码 - this.link = link - axios.get(`${this.api.generationQrCode}?url=${encodeURIComponent(link)}`, { - responseType: 'blob' - }).then(({ data }) => { - this.qrcode = window.URL.createObjectURL(data) - }).catch(res => {}) + // 生成二维码 + this.link = link + axios.get(`${this.api.generationQrCode}?url=${encodeURIComponent(link)}`, { + responseType: 'blob' + }).then(({ data }) => { + this.qrcode = window.URL.createObjectURL(data) }).catch(res => {}) - } - } else { - util.errorMsg('请添加分类!') + }).catch(res => {}) } }, // 复制链接