订单基本完成

dev
e 4 years ago
parent b26d59d32b
commit 13c39305b2
  1. 2
      src/utils/http.js
  2. 318
      src/views/order/AddOrder.vue
  3. 13
      src/views/order/selectClient.vue

@ -41,7 +41,7 @@ axios.interceptors.response.use(
response => {
if (response.status === 200) {
if(response.data.status!==200){// 接口定义的非正常返回的时候,应当处于报错状态
Message.error(response.data.message)
Message.error(response.data.message)// 非服务器状态码对应的报错信息
return Promise.reject(response);
}
return Promise.resolve(response);

@ -11,7 +11,10 @@
<span class="per_back">返回</span>
<span class="per_school">订单处理</span>
</div>
<el-button type="primary" size="small" round class="mag" v-preventReClick @click="addOrder">确定</el-button>
<!-- 新增 -->
<el-button v-if="!disabled&&!editDisabled" type="primary" size="small" round class="mag" v-preventReClick @click="addOrder">确定</el-button>
<!-- 修改 -->
<el-button v-if="editDisabled" type="primary" size="small" round class="mag" v-preventReClick @click="orderUpdate">确定</el-button>
</div>
</el-card>
@ -22,7 +25,7 @@
<span>基本信息</span>
</div>
<div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-col :span="6" :offset="5">
<el-form-item label="订单编号">
<el-input v-model="form.orderNumber" disabled placeholder="自动生成"></el-input>
@ -41,22 +44,23 @@
<el-option v-for="(item,index) in provinceList" :key="index" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="联系人" prop="orderContact" >
<el-input v-model="form.orderContact" placeholder="请输入联系人姓名"></el-input>
<el-form-item label="联系人">
<el-input disabled v-model="form.orderContact" placeholder="请输入联系人姓名"></el-input>
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱地址"></el-input>
<el-form-item label="邮箱">
<el-input disabled v-model="form.email" placeholder="请输入邮箱地址"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" :offset="2">
<el-form-item prop="customerName" label="订单客户">
<div @click="gotoClient" style="cursor: pointer">
<div v-if="!disabled&&!editDisabled" @click="gotoClient" style="cursor: pointer">
<el-input v-model="form.customerName" placeholder="请选择客户"></el-input>
</div>
<el-input v-if="disabled||editDisabled" disabled v-model="form.customerName" placeholder="请选择客户"></el-input>
</el-form-item>
<el-form-item prop="orderType" label="订单类型">
<el-select v-model="form.orderType" clearable placeholder="请选择订单类型">
<el-select :disabled="disabled||editDisabled" v-model="form.orderType" clearable placeholder="请选择订单类型">
<el-option v-for="(item,index) in orderTypeList" :key="index" :label="item.name" :value="item.value"></el-option>
</el-select>
</el-form-item>
@ -70,8 +74,8 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话号码" maxlength="11"></el-input>
<el-form-item label="电话">
<el-input disabled v-model="form.phone" placeholder="请输入电话号码" maxlength="11"></el-input>
</el-form-item>
<el-form-item label="订单金额(万)" prop="orderAmount">
<el-input disabled oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" type="number" v-model="form.orderAmount" placeholder="请输入订单金额"></el-input>
@ -89,10 +93,10 @@
<p class="addhr_tag"></p>
<span>课程权限</span>
</div>
<el-button type="primary" size="small" round class="mag" @click="addClassJurisdiction()">添加</el-button>
<el-button v-if="!disabled&&!editDisabled" type="primary" size="small" round class="mag" @click="addClassJurisdiction()">添加</el-button>
</div>
<el-table :data="jurisdictionData" class="orderTable" stripe header-align="center" show-summary :summary-method="getSummaries">
<el-table :data="jurisdictionData" class="orderTable" stripe header-align="center" >
<el-table-column type="index" width="100" label="序号" align="center">
</el-table-column>
<el-table-column prop="productName" label="课程名称" align="center">
@ -171,10 +175,10 @@
<p class="addhr_tag"></p>
<span>数据平台权限</span>
</div>
<el-button type="primary" size="small" round class="mag" @click="addDataJurisdiction()">添加</el-button>
<el-button v-if="!disabled&&!editDisabled" type="primary" size="small" round class="mag" @click="addDataJurisdiction()">添加</el-button>
</div>
<el-table :data="dataPlatform" class="orderTable" stripe header-align="center" show-summary :summary-method="getSummaries">
<el-table :data="dataPlatform" class="orderTable" stripe header-align="center" :summary-method="getSummaries">
<el-table-column type="index" width="100" label="序号" align="center">
</el-table-column>
<el-table-column prop="productName" label="产品名称" align="center">
@ -182,7 +186,7 @@
<el-table-column label="使用期限" align="center" width="200">
<template slot-scope="scope">
<div class="course-input">
<el-input maxlength="4" @change="deadLine($event,scope.row)" oninput="value=value.replace(/[^0-9.]/g,'')" v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
<el-input :disabled="disabled||editDisabled" maxlength="4" @change="deadLine($event,scope.row)" oninput="value=value.replace(/[^0-9.]/g,'')" v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
<span></span>
</div>
</template>
@ -214,22 +218,22 @@
<el-table-column label="成交价" align="center" width="165">
<template slot-scope="scope">
<div class="small">
<el-input oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" @change="[dealComputers($event,scope.row),discount($event,scope.row)]" v-model="scope.row.finalPrice" placeholder="请输入"type="text"></el-input>
<el-input :disabled="disabled||editDisabled" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" @change="[dealComputers($event,scope.row),discount($event,scope.row),userAmount($event,scope.row)]" v-model="scope.row.finalPrice" placeholder="请输入"type="text"></el-input>
<span>&nbsp;/&nbsp; </span>
</div>
</template>
</el-table-column>
<el-table-column label="折扣率" align="center">
<el-table-column label="折扣率" align="center" width="140">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.discountRate" placeholder="请输入"type="text"></el-input>
<div class="discountRate">
<el-input disabled v-model="scope.row.discountRate" placeholder=""type="text"></el-input>
</div>
</template>
</el-table-column>
<el-table-column label="账号数" align="center">
<template slot-scope="scope">
<div class="small">
<el-input @change="dealComputers($event,scope.row)" v-model="scope.row.accountNum" placeholder="请输入"type="text"></el-input>
<el-input :disabled="disabled||editDisabled" @change="dealComputers($event,scope.row)" v-model="scope.row.accountNum" placeholder="请输入"type="text"></el-input>
</div>
</template>
</el-table-column>
@ -237,27 +241,48 @@
<el-table-column label="总金额(万)" align="center">
<template slot-scope="scope">
<div class="small">
<el-input @change="[allAmount($event,scope.row),allAmountChange($event,scope.row)]" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="scope.row.totalAmount" placeholder="请输入"type="text"></el-input>
<el-input :disabled="disabled||editDisabled" @change="[allAmount($event,scope.row),allAmountChange($event,scope.row)]" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="scope.row.totalAmount" placeholder="请输入"type="text"></el-input>
</div>
</template>
</el-table-column>
<el-table-column label="端口地址 " align="center">
<!-- <el-table-column label="端口地址 " align="center">
<template slot-scope="scope">
<el-button @click="configure(scope.row)">配置</el-button>
<el-button :disabled="disabled" @click="configure(scope.row)">配置</el-button>
</template>
</el-table-column>
<el-table-column label="状态" align="center">
</el-table-column> -->
<el-table-column label="操作" align="center" width="330px">
<template slot-scope="scope">
<el-switch
:disabled="scope.row.ship"
v-model="scope.row.ship"
:active-value="true"
:inactive-value="false"
@change="formSwitch($event,scope.row)">
</el-switch>
<div class="flex-c-c">
<el-button v-if="!editDisabled&&!disabled" style="margin-right:10px;" @click="delDataForm(scope.$index)">删除</el-button>
<!-- <el-button :disabled="disabled" v-show="scope.row.ship===true" style="margin-right:10px;" @click="configure(scope.row)">启动</el-button> -->
<el-switch
style="margin-right:10px"
v-show="scope.row.ship"
:disabled="disabled"
v-model="scope.row.isEnable"
:active-value="false"
:inactive-value="true"
active-text="启用"
inactive-text="禁用"
@change="formSwitch($event,scope.row)">
</el-switch>
<el-switch
v-show="!scope.row.ship||editDisabled"
:disabled="scope.row.ship||disabled"
v-model="scope.row.ship"
:active-value="true"
:inactive-value="false"
active-text="发货"
inactive-text="未发货"
@change="formSwitch($event,scope.row)">
</el-switch>
</div>
</template>
</el-table-column>
<!-- <el-table-column label="发货状态" align="center">
<template slot-scope="scope">
</template>
</el-table-column> -->
</el-table>
</div>
@ -271,7 +296,7 @@
</div>
<div>
<el-form ref="contract" :model="contract" :rules="rules" label-width="80px" >
<el-form :disabled="disabled" ref="contract" :model="contract" :rules="rules" label-width="80px" >
<el-col :span="8" :offset="4">
<el-form-item label="合同名称">
<el-input v-model="contract.contractName" placeholder="请输入合同名称"></el-input>
@ -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 {
<style lang="scss" scoped>
/deep/.course-input .el-input__inner {
width: 120px;
width: 100px;
}
/deep/ .small .el-input__inner{
width: 70px;
}
/deep/ .discountRate .el-input__inner{
width: 85px;
}
/deep/ .contractDate .el-date-editor--daterange.el-input__inner{
width: 100%;
}

@ -202,10 +202,21 @@ export default {
if(!this.checkedName){
return this.$message('请选择客户后再确定!')
}
let param = {
show:true,
id:this.checkedID,
name:this.checkedName,
}
await this.$get(this.api.queryCustomerDetails,{customerId:this.checkedID}).then(res=>{
console.log(res,'当前的res');
let data = res.result.customer
param.email = data.email
param.phone = data.phone
param.name = data.name
})
this.$emit('back',{show:true,id:this.checkedID,name:this.checkedName})
this.$emit('back',param)
}
},
initData(){

Loading…
Cancel
Save