-
-
+
+
-
+
@@ -237,27 +241,48 @@
-
+
-
+
+
-
-
+
+ 删除
+
+
+
+
+
+
+
@@ -271,7 +296,7 @@
-
+
@@ -470,6 +495,9 @@ export default {
data() {
return {
loading:false,// 页面加载
+ disabled:false,// 全局禁用,用于查看。
+ editDisabled:false,// 编辑禁用,区分查看的功能
+
showSelectClient:false,// 切换展示选择客户页
form: {// 基本信息
// orderNumber: '',// 编号
@@ -622,107 +650,79 @@ export default {
created(){
this.token = sessionStorage.getItem('token')
this.getCityData()
+ // 处于查看状态
if(this.$route.query.watch){
+ this.disabled = true
this.getDetail(this.$route.query.watch)
}
+ // 处于编辑状态
if(this.$route.query.edit){
+ this.editDisabled = true
this.getDetail(this.$route.query.edit)
}
},
- // mounted() {
- // if(this.form.orderId){
- // let data = {
- // orderId: this.form.orderId
- // }
- // this.$get(this.api.queryOrderDetails,data).then((res) => {
- // this.form = {
- // orderNumber: res.message[0].orders[0].orderNumber,
- // orderDate: res.message[0].orders[0].orderDate,
- // provinceId: res.message[0].orders[0].provinceId,
- // orderContact: res.message[0].orders[0].orderContact,
- // email: res.message[0].orders[0].email,
- // customerId: res.message[0].orders[0].customerId,
- // orderType: res.message[0].orders[0].orderType,
- // cityId: res.message[0].orders[0].cityId,
- // phone: res.message[0].orders[0].phone,
- // orderAmount: res.message[0].orders[0].orderAmount,
- // orderId: res.message[0].orders[0].orderId,
- // }
- // this.jurisdictionData = res.message[0].coursePermissionss
- // let arr1 = this.jurisdictionData
- // let result1 = arr1.map(e => e.courseId).join()
- // this.curArr = this.curArr.concat(result1)
- // if(res.message[0].contractInformations[0].contractInformationLink){
- // var iconImg = [];
- // iconImg.push({'name':'合同文件','url': res.message[0].contractInformations[0].contractInformationLink});
- // this.uploadList = iconImg
- // }
- // this.contract = {
- // contractInformationName: res.message[0].contractInformations[0].contractInformationName,
- // contractInformationNumber: res.message[0].contractInformations[0].contractInformationNumber,
- // contractInformationSum: res.message[0].contractInformations[0].contractInformationSum,
- // contractInformationLink: res.message[0].contractInformations[0].contractInformationLink,
- // contractInformationId: res.message[0].contractInformations[0].contractInformationId,
- // orderId: res.message[0].contractInformations[0].orderId
- // }
- // this.getCityData()
- // this.getSchoolData()
- // }).catch((res) => {
- // })
- // }
- // },
methods: {
// 读取页面详情
async getDetail(id){
this.$get(this.api.orderDetail,{orderId:+id}).then(res=>{
console.log(res,'请求详情');
- let form = res.orderDetails.order
- console.log(form.orderAmount,'amount');
-
+ let form = res.orderDetails.order,// 基本信息
+ contract = res.orderDetails.contractInformation,// 合同
+ list = res.orderDetails.orderOther// 俩列表
+ list.map(e=>{
+ e.ship?e.ship=true:e.ship = false
+ e.isEnable?e.isEnable=false:e.isEnable=true
+ })
+ let dataArr = list.filter(e=>{// 数据平台
+ return e.authority===0
+ }),
+ classArr = list.filter(e=>{// 课程权限
+ return e.authority===1
+ })
+ console.log(dataArr,'dataArr');
this.form = {
- orderNumber : form.orderNumber,
- createTime:form.createTime,
- provinceId:form.provinceId,
- orderContact:form.orderContact,
- email:form.email,
- customerId:form.customerId,
- customerName:form.customerName,
- orderType:form.orderType,
- cityId:form.cityId,
- phone:form.phone,
- orderAmount:form.orderAmount,
+ orderNumber: form.orderNumber,
+ createTime: form.createTime,
+ provinceId: form.provinceId,
+ orderContact: form.orderContact,
+ email: form.email,
+ customerId: form.customerId,
+ customerName: form.customerName,
+ orderType: form.orderType,
+ cityId: form.cityId,
+ phone: form.phone,
+ orderAmount: form.orderAmount,
+ orderId:form.orderId
}
- console.log(this.form,'amount');
-
+ if(contract.startTime&&contract.endTime){
+ this.contractTime = [contract.startTime,contract.endTime]
+ }
+ this.contract = {
+ contractName:contract.contractName,
+ contractMoney:contract.contractMoney,
+ contractNumber:contract.contractNumber,
+ startTime:contract.startTime?contract.startTime:'',
+ endTime:contract.endTime?contract.endTime:'',
+ uploadList:{name:contract.contractFile?contract.contractFile.split().pop():'',url:contract.contractFile}
+ }
+ this.dataPlatform = dataArr
})
},
- // 订单客户框触发选择页面
- gotoClient(){
- this.showSelectClient = !this.showSelectClient
-
- },
- // 选择客户返回传值
- backToOrder(val){
- this.showSelectClient = !this.showSelectClient
- if(val.id){
- this.form.customerName = val.name
- this.form.customerId = val.id
- this.$get(this.api.queryCustomerDetails,{customerId:val.id}).then(res=>{
- this.form.provinceId = res.result.customer.provinceId
- this.form.cityId = res.result.customer.cityId
- this.getCityData()
- })
- this.$forceUpdate()
- }
- },
// 新增订单
addOrder(){
+ this.dataPlatform.map(e=>{
+ e.ship?e.ship=1:e.ship=0
+ e.isEnable?e.isEnable=0:e.isEnable=1
+ })
+ this.jurisdictionData.map(e=>{
+ e.ship?e.ship=1:e.ship=0
+ e.isEnable?e.isEnable=0:e.isEnable=1
+ })
let param = {
contractInformation:this.contract,//合同信息
order:this.form,// 订单基本数据
- orderOther:[...this.jurisdictionData,...this.dataPlatform.map(e=>e.authority=0)]//订单其他数据
+ orderOther:[...this.dataPlatform,...this.jurisdictionData]//订单其他数据
}
- console.log(this.$refs,'refs');
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
@@ -741,6 +741,54 @@ export default {
})
},
+ // 编辑订单确定
+ orderUpdate(){
+ this.dataPlatform.map(e=>{
+ e.ship?e.ship=1:e.ship=0
+ e.isEnable?e.isEnable=0:e.isEnable=1
+ })
+ this.jurisdictionData.map(e=>{
+ e.ship?e.ship=1:e.ship=0
+ e.isEnable?e.isEnable=0:e.isEnable=1
+ })
+ let param = {
+ contractInformation:this.contract,//合同信息
+ order:this.form,// 订单基本数据
+ orderOther:[...this.dataPlatform,...this.jurisdictionData]//订单其他数据
+ }
+ this.loading = true
+ this.$post(this.api.orderUpdate,param).then(res=>{
+ this.$message.success('修改成功!')
+ this.loading = false
+ this.$router.push('/order')
+ }).catch(err=>{
+ this.loading = false
+
+ })
+ },
+ // 订单客户框触发选择页面
+ gotoClient(){
+ this.showSelectClient = !this.showSelectClient
+ },
+ // 选择客户返回传值
+ backToOrder(val){
+ this.showSelectClient = !this.showSelectClient
+ if(val.id){
+ this.form.customerName = val.name
+ this.form.customerId = val.id
+ this.form.phone = val.phone
+ this.form.email = val.email
+ this.form.orderContact = val.name
+ console.log(val,'取得返回值');
+ this.$get(this.api.queryCustomerDetails,{customerId:val.id}).then(res=>{
+ this.form.provinceId = res.result.customer.provinceId
+ this.form.cityId = res.result.customer.cityId
+ this.getCityData()
+ })
+ this.$forceUpdate()
+ }
+ },
+
// 课程权限
addClassJurisdiction(){
@@ -821,9 +869,16 @@ export default {
// 计算折扣率
discount(val,row){
if(val){
- row.discountRate = Math.floor(val/row.marketValue*100).toFixed(3)+'%'
+ row.discountRate = Math.floor(val/row.marketValue*100).toFixed(2)+'%'
}
},
+ // 已知成交和总额,计算账号数目
+ userAmount(val,row){
+ if(val&&row.totalAmount){
+ row.accountNum = Math.floor(row.totalAmount/val)
+ }
+ },
+
// 合同起止日期选择
contractTimeChange(val){
if(val.length>0){
@@ -848,17 +903,24 @@ export default {
if(row.accountNum){// 若有账号
row.marketValue = all/row.accountNum
}
- if(row.marketValue){
-
+ if(row.finalPrice){
+ row.accountNum = all/row.finalPrice
}
+ console.log(val,row);
}
},
// 权限switch切换--计算天数
formSwitch (e,row) {
- this.deadLine(row.periodOfUse,row)
+ if(this.editDisabled){
+
+ return
+ }
+ // this.deadLine(row.periodOfUse,row)
},
+ //
// 使用期限转换以及计算剩余天数
deadLine(e,row){
+
console.log(row.ship,e,'row.consignment');
if(e==='') {
console.log('進入return');
@@ -867,6 +929,7 @@ export default {
return
}
function completeDate(value) {
+ if(value==0) return '12'
return value < 10 ? "0"+value:value;
}
let char = "-";
@@ -877,8 +940,8 @@ export default {
//补全0,并拼接当前的时间点
let nowYear = year + char + completeDate(month) + char +completeDate(day);
// 判断结束日期
- console.log(parseInt(e%12),'取余');
- let endYear = +year + parseInt(e/12) + char + completeDate((month+e)%12) + char +completeDate(day);
+ console.log('取余',year,parseInt((+month+(+e))%12),+month+(+e));
+ let endYear = +year + parseInt((+month+(+e))/12) + char + completeDate((+month+(+e))%12) + char +completeDate(day);
// 得出起始年月日
row.startTime = nowYear
row.endTime = endYear
@@ -895,11 +958,20 @@ export default {
// 计算成交总额
dealComputers(e,row){
if(row.finalPrice&&row.accountNum){
- row.totalAmount = row.finalPrice*row.accountNum/10000;
+ row.totalAmount = (row.finalPrice*row.accountNum/10000).toFixed(2);
}
this.allAmount()
},
+ // 删除数据平台产品
+ delDataForm(index){
+ this.$confirm('确定要删除吗?', '提示', {
+ type: 'warning'
+ })
+ .then(() => {
+ this.dataPlatform.splice(index,1)
+ })
+ },
// 清除省份
clearprovince(){
this.form.cityId = '',
@@ -1104,11 +1176,15 @@ export default {