| | |
| | | <el-row> |
| | | <el-col :span="12" style="line-height: 32px;">销售管理</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button type="primary" icon="el-icon-plus" @click="addDia= true">新增</el-button> |
| | | <el-button type="primary" icon="el-icon-plus" @click="openAddDia">新增</el-button> |
| | | <el-button icon="el-icon-edit-outline">修改</el-button> |
| | | <el-button icon="el-icon-delete">删除</el-button> |
| | | <el-button icon="el-icon-download">导出</el-button> |
| | |
| | | </el-dialog> |
| | | </div> |
| | | <div class="select-model"> |
| | | <el-dialog title="销售新增" :visible.sync="addDia" width="750px"> |
| | | <el-dialog title="销售新增" :visible.sync="addDia" width="800px"> |
| | | <div class="body"> |
| | | <div class="head">基本信息</div> |
| | | <div class="content"> |
| | |
| | | <el-table :data="addData.saleMaterialList" border style="width: 100%"> |
| | | <el-table-column prop="name" label="产品名称" width="180"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.name" size="small" clearable placeholder="请输入产品名称"></el-input> |
| | | <el-select v-model="scope.row.name" size="small" clearable placeholder="请输入产品名称" |
| | | @change="((index)=>{upRepe(index, scope.$index)})"> |
| | | <el-option v-for="(a, ai) in repeList" :key="ai" :label="a.name" :value="ai"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="specifications" label="规格型号" width="200"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.specifications" size="small" clearable placeholder="请输入规格型号"></el-input> |
| | | <el-input v-model="scope.row.specifications" size="small" readonly></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unit" label="单位"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.unit" size="small" clearable placeholder="请输入"></el-input> |
| | | <el-input v-model="scope.row.unit" size="small" readonly></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="number" label="数量"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model.number="scope.row.number" size="small" |
| | | @change="scope.row.number = isNaN(scope.row.number)?0:scope.row.number" clearable placeholder="请输入"></el-input> |
| | | @change="scope.row.number = isNaN(scope.row.number)?0:scope.row.number" clearable |
| | | placeholder="请输入"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="price" label="单价"> |
| | |
| | | pageSize: 10, |
| | | selectDia: false, |
| | | oneData: null, |
| | | addDia: true, |
| | | addDia: false, |
| | | addData: { |
| | | orderNumber: null, |
| | | code: null, |
| | | name: null, |
| | | proname: null, |
| | | adress: null, |
| | | username: null, |
| | | delTime: null, |
| | | orderName: null, |
| | | phone: null, |
| | | saleMaterialList: [] |
| | | } |
| | | }, |
| | | repeList: [] |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | this.addData.saleMaterialList.push({}) |
| | | }, |
| | | addSale() { |
| | | for (var a in this.addData) { |
| | | if (this.addData[a] == null || this.addData[a] == '') { |
| | | if (a == 'saleMaterialList') { |
| | | this.$message.error('产品信息不能为空') |
| | | } else { |
| | | this.$message.error('销售订单有必填项未填写') |
| | | } |
| | | return |
| | | } |
| | | } |
| | | for (var b = 0; b < this.addData.saleMaterialList.length; b++) { |
| | | console.log(this.addData.saleMaterialList[b]); |
| | | if (Object.getOwnPropertyNames(this.addData.saleMaterialList[b]).length==0) { |
| | | this.addData.saleMaterialList.splice(b, 1) |
| | | b-- |
| | | if (b < 0) { |
| | | this.$message.error('产品信息不能为空') |
| | | return |
| | | } |
| | | } else { |
| | | for (var c in this.addData.saleMaterialList[b]) { |
| | | if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == {} || Object |
| | | .getOwnPropertyNames(this.addData.saleMaterialList[b]).length != 5) { |
| | | this.$message.error('产品信息有必填项未填写') |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } |
| | | console.log(this.addData); |
| | | this.axios.post(this.$api.url.addSale, this.addData, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | |
| | | }).then(res => { |
| | | console.log(res); |
| | | }) |
| | | }, |
| | | openAddDia() { |
| | | this.addDia = !(this.addDia) |
| | | this.$axios.post(this.$api.url.seleRepe).then(res => { |
| | | this.repeList = res.data |
| | | }) |
| | | }, |
| | | upRepe(index, i) { |
| | | var data = this.repeList[index] |
| | | if (data == undefined) { |
| | | this.addData.saleMaterialList[i] = {} |
| | | } else { |
| | | this.addData.saleMaterialList[i].unit = data.unit |
| | | this.addData.saleMaterialList[i].specifications = data.specifications |
| | | } |
| | | } |
| | | } |
| | | } |