删除多余值

dev
e 3 years ago
parent d7c1b23447
commit 463728a343
  1. 288
      src/views/oder/AddOrder.vue

@ -24,26 +24,29 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-col :span="6" :offset="5"> <el-col :span="6" :offset="5">
<el-form-item label="订单编号"> <el-form-item label="订单编号">
<el-input v-model="form.orderNumber" disabled placeholder="请输入订单编号"></el-input> <el-input v-model="form.orderNumber" disabled placeholder="自动生成"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="订单时间">
<el-date-picker
v-model="form.orderNumber"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item prop="provinceId" label="省份"> <el-form-item prop="provinceId" label="省份">
<el-select v-model="form.provinceId" clearable placeholder="请选择省份" @change="getCity" @clear="clearprovince()"> <el-select v-model="form.provinceId" clearable placeholder="请选择省份" @change="getCity" @clear="clearprovince()">
<el-option v-for="(item,index) in provinceList" :key="index" :label="item.provinceName" :value="item.provinceId"></el-option> <el-option v-for="(item,index) in provinceList" :key="index" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="customerId" label="客户名称">
<el-select v-model="form.customerId" clearable placeholder="请选择客户"
:disabled="form.cityId ? false : true" @change="getcustomer" @clear="clearcustomer()">
<el-option v-for="(item,index) in schoolList" :key="index" :label="item.customerName" :value="item.customerId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="联系人" prop="orderContact"> <el-form-item label="联系人" prop="orderContact">
<el-input v-model="form.orderContact" disabled placeholder="请输入联系人姓名"></el-input> <el-input v-model="form.orderContact" disabled placeholder="请输入联系人姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="邮箱"> <el-form-item label="邮箱">
<el-input v-model="form.email" disabled placeholder="请输入邮箱地址"></el-input> <el-input v-model="form.email" disabled placeholder="请输入邮箱地址"></el-input>
</el-form-item> </el-form-item>
@ -51,22 +54,31 @@
<el-col :span="6" :offset="2"> <el-col :span="6" :offset="2">
<el-form-item label="订单时间"> <el-form-item prop="customerId" label="订单客户">
<el-input v-model="form.orderDate" disabled placeholder="请输入订单时间"></el-input> <el-select v-model="form.customerId" clearable placeholder="请选择客户"
</el-form-item> :disabled="form.cityId ? false : true" @change="getcustomer" @clear="clearcustomer()">
<el-option v-for="(item,index) in schoolList" :key="index" :label="item.customerName" :value="item.customerId"></el-option>
<el-form-item prop="cityId" label="城市">
<el-select v-model="form.cityId" clearable placeholder="请选择城市" @clear="clearcity()"
:disabled="form.provinceId ? false : true" @change="getSchool()">
<el-option v-for="(item,index) in cityList" :key="index" :label="item.cityName" :value="item.cityId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="orderType" label="订单类型"> <el-form-item prop="orderType" label="订单类型">
<el-select v-model="form.orderType" clearable placeholder="请选择订单类型"> <el-select 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-option v-for="(item,index) in orderTypeList" :key="index" :label="item.name" :value="item.value"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="cityId" label="城市">
<el-select v-model="form.orderType" placeholder="请选择">
<el-option
v-for="(item,index) in form.city"
:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="电话"> <el-form-item label="电话">
<el-input v-model="form.phone" disabled placeholder="请输入电话号码" maxlength="11"></el-input> <el-input v-model="form.phone" disabled placeholder="请输入电话号码" maxlength="11"></el-input>
@ -94,32 +106,56 @@
<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" show-summary :summary-method="getSummaries">
<el-table-column type="index" width="100" label="序号" align="center"> <el-table-column type="index" width="100" label="序号" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="courseName" label="应用名称" align="center"> <el-table-column prop="courseName" label="课程名称" align="center">
</el-table-column>
<el-table-column label="使用期限" align="center" width="200">
<template slot-scope="scope">
<div class="course-input">
<el-input @change="deadLine($event,scope.row)" maxlength="10" oninput="value=value.replace(/[^0-9.]/g,'')" v-model="scope.row.date" placeholder="输入时间"></el-input>
<span></span>
</div>
</template>
</el-table-column>
<el-table-column label="起止日期" align="center" width="200">
<template slot-scope="scope">
<p v-if="!scope.row.startDate">请输入使用期限且确认发货</p>
<div v-else style="display:flex;justify-content:center;">
<p>{{scope.row.startDate}}</p><span>&nbsp;&nbsp;-&nbsp;&nbsp;</span><p>{{scope.row.endDate}}</p>
</div>
</template>
</el-table-column> </el-table-column>
<el-table-column label="使用期限" align="center" width="300"> <el-table-column label="剩余期限" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.usePeriod" placeholder="请选择"> <div class="small">
<el-option v-for="(item,index) in yearList" :key="index" :label="item.name" :value="item.value"></el-option> <el-input v-model="scope.row.transactionPrice" placeholder="请输入"type="text"></el-input>
</el-select> <span></span>
</div>
</template> </template>
</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-input v-model="scope.row.marketPrice" disabled placeholder="请输入"></el-input> <div class="small">
<el-input v-model="scope.row.transactionPrice" placeholder="请输入"type="text"></el-input>
<span></span>
</div>
</template> </template>
</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-input v-model="scope.row.transactionPrice" placeholder="请输入" <div class="small">
type="text" oninput="value=value.replace(/[^\d.]/g,'')" @change="discountChange(scope.row)"></el-input> <el-input v-model="scope.row.transactionPrice" placeholder="请输入"type="text"></el-input>
<span></span>
</div>
</template> </template>
</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-input v-model="scope.row.discount" disabled></el-input> <div class="small">
<el-input v-model="scope.row.transactionPrice" placeholder="请输入"type="text"></el-input>
</div>
</template> </template>
</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 @click="configure(scope.row)">配置</el-button> <el-button @click="configure(scope.row)">配置</el-button>
</template> </template>
@ -127,18 +163,111 @@
<el-table-column label="发货" align="center"> <el-table-column label="发货" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.isDeliverGoods" v-model="scope.row.consignment"
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
@change="changeSwitch($event,scope.row,scope.$index)"> @change="courseSwitch($event,scope.row)">
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> </el-table>
</div>
</el-card>
<el-card shadow="hover" class="mgb20">
<div>
<div class="flex-between mgb20 user_header">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>数据平台权限</span>
</div>
<el-button type="primary" size="small" round class="mag" @click="getConfig()">添加</el-button>
</div>
<el-table :data="dataPlatform" class="orderTable" stripe header-align="center" show-summary :summary-method="getSummaries">
<el-table-column type="index" width="100" label="序号" align="center">
</el-table-column>
<el-table-column prop="name" label="产品名称" align="center">
</el-table-column>
<el-table-column label="使用期限" align="center" width="200">
<template slot-scope="scope">
<div class="course-input">
<el-input maxlength="10" oninput="value=value.replace(/[^0-9.]/g,'')" v-model="scope.row.date" placeholder="输入时间"></el-input>
<span></span>
</div>
</template>
</el-table-column>
<el-table-column label="起止日期" align="center" width="200">
<template slot-scope="scope">
<p v-if="!scope.row.startDate">请输入使用期限且确认状态</p>
<div v-else style="display:flex;justify-content:center;">
<p>{{scope.row.startDate}}</p><span>&nbsp;&nbsp;-&nbsp;&nbsp;</span><p>{{scope.row.endDate}}</p>
</div>
</template>
</el-table-column>
<el-table-column label="剩余期限" align="center">
<template slot-scope="scope">
<div class="small">
<el-input v-model="scope.row.transactionPrice" placeholder="请输入"type="text"></el-input>
<span></span>
</div>
</template>
</el-table-column>
<el-table-column label="市场价" align="center" width="165">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.transactionPrice" placeholder="请输入"type="text"></el-input>
<span>&nbsp;/&nbsp;</span>
</div>
</template>
</el-table-column>
<el-table-column label="成交价" align="center" width="165">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="deljur(scope.$index,scope.row)">删除</el-button> <div class="small">
<el-input @change="dealComputers($event,scope.row)" v-model="scope.row.bargain" placeholder="请输入"type="text"></el-input>
<span>&nbsp;/&nbsp; </span>
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="折扣率" align="center">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.transactionPrice" 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.account" 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 oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="scope.row.gross" placeholder="请输入"type="text"></el-input>
</div>
</template>
</el-table-column>
<el-table-column label="端口地址 " align="center">
<template slot-scope="scope">
<el-button @click="configure(scope.row)">配置</el-button>
</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
v-model="scope.row.platformState"
:active-value="1"
:inactive-value="0"
@change="platformSwitch($event,scope.row)">
</el-switch>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
</el-card> </el-card>
@ -367,7 +496,29 @@ export default {
provinceList: this.$store.state.provinceList, provinceList: this.$store.state.provinceList,
cityList: [], cityList: [],
schoolList: [], schoolList: [],
jurisdictionData: [], jurisdictionData: [
{ name:'1',
date:'',
startDate:'',
endDate:'',
consignment:false,
}
],//
dataPlatform:[
{
name:'1',
date:'',
startDate:'',
endDate:'',
platformState:'',
bargain:'',
account:'',
gross:''
}
],// data
permissionData: [], permissionData: [],
curVisible: false, curVisible: false,
configSearch: '', configSearch: '',
@ -422,6 +573,7 @@ export default {
test: [] test: []
}; };
}, },
mounted() { mounted() {
if(this.form.orderId){ if(this.form.orderId){
let data = { let data = {
@ -465,6 +617,9 @@ export default {
} }
}, },
methods: { methods: {
testfn(event){
console.log(event,'ev');
},
// //
clearprovince(){ clearprovince(){
this.form.cityId = '', this.form.cityId = '',
@ -658,11 +813,7 @@ export default {
this.form.orderAmount = sums this.form.orderAmount = sums
return sums; return sums;
}, },
changeSwitch (e,row,index) {
let newData = row;
newData.status = newData.status === 1 ? 1 : 0;
this.jurisdictionData[index] = newData;
},
// //
handleExceed(files, fileList) { handleExceed(files, fileList) {
this.$message.warning( this.$message.warning(
@ -698,12 +849,63 @@ export default {
}, },
goback(){ goback(){
this.$router.go(-1) this.$router.go(-1)
},
// switch
courseSwitch(e,row){
this.deadLine(row.date,row)
},
// switch
platformSwitch (e,row) {
this.deadLine(row.date,row)
},
// 使
deadLine(e,row){
console.log(row.consignment,e,'row.consignment');
if(e===''||!row.consignment) {
console.log('進入return');
row.startDate = ''
row.endDate = ''
return
}
function completeDate(value) {
return value < 10 ? "0"+value:value;
}
let char = "-";
let nowDate = new Date()
let day = nowDate.getDate();
let month = nowDate.getMonth() + 1;
let year = nowDate.getFullYear();
//0
let nowYear = year + char + completeDate(month) + char +completeDate(day);
//
let endYear = +year+parseInt(e/12) + char + completeDate(month+e%12) + char +completeDate(day);
//
row.startDate = nowYear
row.endDate = endYear
this.$forceUpdate();
console.log(endYear,nowYear);
},
//
dealComputers(e,row){
if(row.bargain&&row.account){
row.gross = row.bargain*row.account;
this.$forceUpdate();
console.log(row.gross,'row.gross');
}
} }
} }
}; };
</script> </script>
<style> <style lang="scss" scoped>
/deep/.course-input .el-input__inner {
width: 120px;
}
/deep/ .small .el-input__inner{
width: 70px;
}
.mag{ .mag{
margin-right: 20px; margin-right: 20px;
} }

Loading…
Cancel
Save