调bug,添加验证

dev
e 3 years ago
parent 7a8bbb71e8
commit aa05aa898f
  1. 60
      src/views/order/AddOrder.vue
  2. 4
      src/views/order/Order.vue

@ -186,7 +186,7 @@
<el-table-column label="使用期限" align="center" width="200"> <el-table-column label="使用期限" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="course-input"> <div class="course-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> <el-input onkeyup="value=this.value.replace(/\D+/g,'')" :class="!scope.row.periodOfUse?'red':''" :disabled="disabled||editDisabled" maxlength="4" @change="deadLine($event,scope.row),zero($event,scope.row)" oninput="value=value.replace(/[^0-9.]/g,'')" v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
<span></span> <span></span>
</div> </div>
</template> </template>
@ -218,7 +218,7 @@
<el-table-column label="成交价" align="center" width="185"> <el-table-column label="成交价" align="center" width="185">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="small"> <div class="small">
<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> <el-input :class="!scope.row.finalPrice?'red':''" :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> <span>&nbsp;/&nbsp; </span>
</div> </div>
</template> </template>
@ -233,7 +233,7 @@
<el-table-column label="账号数" align="center" width="150"> <el-table-column label="账号数" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="small"> <div class="small">
<el-input :disabled="disabled||editDisabled" @change="[dealComputers($event,scope.row),dealBargain($event,scope.row)]" v-model="scope.row.accountNum" placeholder="请输入"type="text"></el-input> <el-input :class="!scope.row.accountNum?'red':''" :disabled="disabled||editDisabled" @change="[dealComputers($event,scope.row),dealBargain($event,scope.row)]" v-model="scope.row.accountNum" placeholder="请输入"type="text"></el-input>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -241,7 +241,7 @@
<el-table-column label="总金额(元)" align="center" width="180"> <el-table-column label="总金额(元)" align="center" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="small"> <div class="small">
<el-input :disabled="disabled||editDisabled" @blur="[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 :class="!scope.row.totalAmount?'red':''" :disabled="disabled||editDisabled" @blur="[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> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -303,8 +303,7 @@
</el-form-item> </el-form-item>
<el-form-item label="合同金额" prop="contractInformationSum"> <el-form-item label="合同金额" prop="contractInformationSum">
<el-input v-model="contract.contractMoney" <el-input oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="contract.contractMoney" placeholder="请输入合同金额"></el-input>
placeholder="请输入合同金额"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -647,25 +646,25 @@ export default {
}; };
}, },
created(){ async created(){
this.token = sessionStorage.getItem('token') this.token = sessionStorage.getItem('token')
this.getCityData()
// //
if(this.$route.query.watch){ if(this.$route.query.watch){
this.disabled = true this.disabled = true
this.getDetail(this.$route.query.watch) await this.getDetail(this.$route.query.watch)
} }
// //
if(this.$route.query.edit){ if(this.$route.query.edit){
this.editDisabled = true this.editDisabled = true
this.getDetail(this.$route.query.edit) await this.getDetail(this.$route.query.edit)
} }
this.getCityData()//
}, },
methods: { methods: {
// //
async getDetail(id){ async getDetail(id){
this.$get(this.api.orderDetail,{orderId:+id}).then(res=>{ return this.$get(this.api.orderDetail,{orderId:+id}).then(res=>{
console.log(res,'请求详情');
let form = res.orderDetails.order,// let form = res.orderDetails.order,//
contract = res.orderDetails.contractInformation?res.orderDetails.contractInformation:{},// contract = res.orderDetails.contractInformation?res.orderDetails.contractInformation:{},//
list = res.orderDetails.orderOther// list = res.orderDetails.orderOther//
@ -681,7 +680,6 @@ export default {
classArr = list.filter(e=>{// classArr = list.filter(e=>{//
return e.authority===1 return e.authority===1
}) })
console.log(dataArr,'dataArr');
this.form = { this.form = {
orderNumber: form.orderNumber, orderNumber: form.orderNumber,
createTime: form.createTime, createTime: form.createTime,
@ -696,7 +694,6 @@ export default {
orderAmount: form.orderAmount, orderAmount: form.orderAmount,
orderId:form.orderId orderId:form.orderId
} }
this.contract = { this.contract = {
contractName:contract.contractName, contractName:contract.contractName,
contractMoney:contract.contractMoney, contractMoney:contract.contractMoney,
@ -710,7 +707,6 @@ export default {
this.contractTime = [contract.startTime,contract.endTime] this.contractTime = [contract.startTime,contract.endTime]
} }
this.dataPlatform = dataArr this.dataPlatform = dataArr
console.log(this.dataPlatform,'当前的值');
}) })
}, },
// //
@ -749,7 +745,6 @@ export default {
if (valid) { if (valid) {
this.loading = true this.loading = true
this.$post(this.api.orderAdd,param).then(res=>{ this.$post(this.api.orderAdd,param).then(res=>{
console.log(res,'新增订单');
this.$router.push('/order') this.$router.push('/order')
this.loading = false this.loading = false
this.$message.success('添加订单成功!') this.$message.success('添加订单成功!')
@ -788,6 +783,13 @@ export default {
}) })
}, },
/* 处理0开头的期限 */
zero(e,row){
if(e[0]=='0'){
row.periodOfUse = e.substring(1)
this.zero(row.periodOfUse,row)
}
},
// //
gotoClient(){ gotoClient(){
this.showSelectClient = !this.showSelectClient this.showSelectClient = !this.showSelectClient
@ -801,7 +803,6 @@ export default {
this.form.phone = val.phone this.form.phone = val.phone
this.form.email = val.email this.form.email = val.email
this.form.orderContact = val.name this.form.orderContact = val.name
console.log(val,'取得返回值');
this.$get(this.api.queryCustomerDetails,{customerId:val.id}).then(res=>{ this.$get(this.api.queryCustomerDetails,{customerId:val.id}).then(res=>{
this.form.provinceId = res.result.customer.provinceId this.form.provinceId = res.result.customer.provinceId
this.form.cityId = res.result.customer.cityId this.form.cityId = res.result.customer.cityId
@ -829,22 +830,18 @@ export default {
productName:this.productName productName:this.productName
} }
this.$post(this.api.listByEntity,param).then(res=>{ this.$post(this.api.listByEntity,param).then(res=>{
console.log(res,'请求成功');
this.boxDataPlatform = res.pageList.records this.boxDataPlatform = res.pageList.records
this.platfromTotals = res.pageList.total this.platfromTotals = res.pageList.total
}).catch(err=>{ }).catch(err=>{
console.log(err,'请求错误');
}) })
}, },
// -- // --
boxDataPlatformSelection(val){ boxDataPlatformSelection(val){
this.platformSelect = val this.platformSelect = val
console.log(val,'数据选中',this.platformSelect);
}, },
// -- // --
addPlatform(){ addPlatform(){
console.log(this.platformSelect,'this.platformSelect');
if(this.platformSelect.length>0){ if(this.platformSelect.length>0){
let that = this let that = this
let fn = function(e){ let fn = function(e){
@ -906,7 +903,6 @@ export default {
if(val.length>0){ if(val.length>0){
this.contract.startTime = val[0] this.contract.startTime = val[0]
this.contract.endTime = val[1] this.contract.endTime = val[1]
console.log(this.contract.startTime,this.contract.endTime,'s-e');
} }
}, },
// //
@ -921,7 +917,6 @@ export default {
// -- // --
allAmountChange(val,row){ allAmountChange(val,row){
console.log(val,row,'kankan');
if(row.totalAmount){ if(row.totalAmount){
let all = row.totalAmount let all = row.totalAmount
if(row.accountNum){// if(row.accountNum){//
@ -930,7 +925,6 @@ export default {
if(row.finalPrice){// if(row.finalPrice){//
row.accountNum = Math.floor(all/row.finalPrice) row.accountNum = Math.floor(all/row.finalPrice)
} }
console.log(val,row);
} }
}, },
// //
@ -957,10 +951,7 @@ export default {
// //
// 使 // 使
deadLine(e,row){ deadLine(e,row){
console.log(row.ship,e,'row.consignment');
if(e==='') { if(e==='') {
console.log('進入return');
row.startTime = '' row.startTime = ''
row.endTime = '' row.endTime = ''
return return
@ -977,12 +968,7 @@ export default {
//0 //0
let nowYear = year + char + completeDate(month) + char +completeDate(day); let nowYear = year + char + completeDate(month) + char +completeDate(day);
// //
console.log('取余',year+parseInt((+month+(+e))%12));
console.log(year,'当前年');
console.log(+year + parseInt((+month+(+e))/12) ,'处理过的年',parseInt((+month+(+e))%12)===0,'处理的值');
console.log((+month+(+e))%12,'月份%12');
let endYear = year + (parseInt((+month+(+e))/12)===0?0:parseInt((+month+(+e))/12)) + char + completeDate((+month+(+e))%12) + char +completeDate(day); let endYear = year + (parseInt((+month+(+e))/12)===0?0:parseInt((+month+(+e))/12)) + char + completeDate((+month+(+e))%12) + char +completeDate(day);
console.log(endYear,'endYear');
// //
row.startTime = nowYear row.startTime = nowYear
@ -994,7 +980,6 @@ export default {
let date2 = Date.parse(nowYear); let date2 = Date.parse(nowYear);
let ms = Math.abs(date1 - date2) let ms = Math.abs(date1 - date2)
let days = Math.floor(ms / (24 * 3600 * 1000)); let days = Math.floor(ms / (24 * 3600 * 1000));
console.log(Date.parse(endYear),nowYear,date1,date2,days,'剩余期限');
row.remainingPeriod = days row.remainingPeriod = days
}, },
@ -1026,7 +1011,6 @@ export default {
provinceId: this.form.provinceId provinceId: this.form.provinceId
} }
return this.$get(this.api.queryCity,data).then(res => { return this.$get(this.api.queryCity,data).then(res => {
console.log(res.list,'res.list');
this.cityList = res.list this.cityList = res.list
}).catch(res => {}); }).catch(res => {});
}, },
@ -1177,7 +1161,6 @@ export default {
// //
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
this.contract.contractFile = response.filesResult.fileUrl this.contract.contractFile = response.filesResult.fileUrl
console.log(this.contract,response,'this.contract');
}, },
// //
uploadError(err, file, fileList) { uploadError(err, file, fileList) {
@ -1213,6 +1196,13 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/.course-input .el-input__inner { /deep/.course-input .el-input__inner {
width: 100px; width: 100px;
}
/deep/.course-input .red .el-input__inner {
border:1px solid red;
}
/deep/ .small .red .el-input__inner{
border:1px solid red;
} }
/deep/ .small .el-input__inner{ /deep/ .small .el-input__inner{

@ -83,10 +83,10 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="handle('edit',scope.row)">修改</el-button> <el-button type="text" v-if="scope.row.isDel!==1" @click="handle('edit',scope.row)">{{scope.oderStatus==='已完成'?'修改':'处理'}}</el-button>
<el-button type="text" @click="handle('watch',scope.row)">查看</el-button> <el-button type="text" @click="handle('watch',scope.row)">查看</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button> <el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
<!-- <el-button type="text" @click="handleRenew(scope.row)">续费</el-button> --> <el-button type="text" v-if="scope.oderStatus==='已完成'&&scope.row.isDel!==1" @click="handleRenew(scope.row)">续费</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

Loading…
Cancel
Save