| | |
| | | .select-model .body { |
| | | padding: 0 20px; |
| | | color: #333; |
| | | max-height: 70vh; |
| | | max-height: 72vh; |
| | | overflow-y: auto; |
| | | } |
| | | |
| | |
| | | <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="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-edit-outline">修改</el-button> --> |
| | | <el-button icon="el-icon-delete" @click="delSales">删除</el-button> |
| | | <el-button icon="el-icon-download">导出</el-button> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <span>状态:</span> |
| | | <el-select v-model="search.type" size="small" placeholder="请选择" style="width: 224px;margin-right: 30px;"> |
| | | <el-option label="全部" :value="null"></el-option> |
| | | <el-option label="通过" :value="0"></el-option> |
| | | <el-option label="不通过" :value="1"></el-option> |
| | | <el-option label="未审核" :value="2"></el-option> |
| | | <el-option label="通过" :value="1"></el-option> |
| | | <el-option label="不通过" :value="0"></el-option> |
| | | </el-select> |
| | | <span>交货日期:</span> |
| | | <el-date-picker v-model="search.delTime" size="small" placeholder="请输入" style="width: 224px;margin-right: 30px;" |
| | |
| | | </el-button> |
| | | </div> |
| | | <div class="thing"> |
| | | <el-table :data="tableData" border style="width: 100%;overflow-y: auto;min-height: calc(100% - 50px)" |
| | | max-height="calc(100% - 50px)" @selection-change="handleSelectionChange" default-expand-all row-key="id"> |
| | | <el-table ref="tableData" :data="tableData" border |
| | | style="width: 100%;overflow-y: auto;min-height: calc(100% - 50px)" max-height="calc(100% - 50px)" |
| | | @selection-change="handleSelectionChange" default-expand-all row-key="id"> |
| | | <el-table-column type="selection" width="50"> |
| | | </el-table-column> |
| | | <el-table-column type="index" label="序号" width="65"> |
| | |
| | | <el-table-column label="操作" width="220"> |
| | | <template slot-scope="scope"> |
| | | <span class="table_do" @click="changeShowDetail(scope.row)"> 查看详情 </span> |
| | | <span class="table_do" v-if="scope.row.type==null"> 审核 </span> |
| | | <span class="table_do" v-if="scope.row.type==null" @click="saleCheck(scope)"> 审核 </span> |
| | | <span class="table_do" v-else> </span> |
| | | <span class="table_do"> 编辑 </span> |
| | | <span class="table_do"> 删除 </span> |
| | | <span class="table_do" v-if="scope.row.type==null" @click="openUpDia(scope.row.id)"> 编辑 </span> |
| | | <span class="table_do" v-else> </span> |
| | | <span class="table_do" @click="delSale(scope.$index)"> 删除 </span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-col style="height: 50px;display: flex;align-items: center;justify-content: right;"> |
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" |
| | | :page-sizes="[1,10, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" |
| | | :page-sizes="[10, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" |
| | | :total="countSize"> |
| | | </el-pagination> |
| | | </el-col> |
| | |
| | | <el-col :span="3" :offset="2">状态</el-col> |
| | | <el-col :span="8"> |
| | | <div class="value" v-if="oneData.type == 1" style="color: #34BD66;">通过</div> |
| | | <div class="value" v-else-if="oneData.type == 2" style="color: #E84738;">不通过</div> |
| | | <div class="value" v-else-if="oneData.type == 0" style="color: #E84738;">不通过</div> |
| | | <div class="value" v-else> </div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-row style="line-height: 30px;margin: 15px 0;"> |
| | | <el-col :span="3">业务员</el-col> |
| | | <el-col :span="8"> |
| | | <div class="value">{{JSON.parse(oneData.saleman)}}</div> |
| | | <div class="value">{{oneData.saleman}}</div> |
| | | </el-col> |
| | | <el-col :span="3" :offset="2">下单人</el-col> |
| | | <el-col :span="8"> |
| | |
| | | </el-col> |
| | | <el-col :span="3" :offset="2">审核人</el-col> |
| | | <el-col :span="8"> |
| | | <div class="value">{{JSON.parse(oneData.checkname)}}</div> |
| | | <div class="value">{{oneData.checkname==null?' ': oneData.checkname}}</div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="line-height: 30px;margin: 15px 0;"> |
| | | <el-col :span="3">审核日期</el-col> |
| | | <el-col :span="8"> |
| | | <div class="value">{{oneData.checkTime}}</div> |
| | | <div class="value">{{oneData.checkTime==null?' ': oneData.checkTime}}</div> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | |
| | | </el-dialog> |
| | | </div> |
| | | <div class="select-model"> |
| | | <el-dialog title="销售新增" :visible.sync="addDia" width="800px"> |
| | | <el-dialog :title="`销售${upDia==true?'修改':'新增'}`" :visible.sync="addDia" width="850px" |
| | | @close="closeDialog"> |
| | | <div class="body"> |
| | | <div class="head">基本信息</div> |
| | | <div class="content"> |
| | |
| | | <el-col :span="3" :offset="2">交货日期</el-col> |
| | | <el-col :span="8"> |
| | | <el-date-picker v-model="addData.delTime" size="small" placeholder="请输入交货日期" clearable |
| | | value-format="yyyy-MM-dd"></el-date-picker> |
| | | value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | |
| | | <el-table :data="addData.saleMaterialList" border style="width: 100%"> |
| | | <el-table-column prop="name" label="产品名称" width="180"> |
| | | <template slot-scope="scope"> |
| | | <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> |
| | | <el-input v-model="scope.row.name" size="small" clearable placeholder="请输入产品名称"> |
| | | </el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="specifications" label="规格型号" width="200"> |
| | | <el-table-column prop="specifications" label="规格型号" width="180"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.specifications" size="small" readonly></el-input> |
| | | <el-input v-model="scope.row.specifications" size="small" clearable placeholder="请输入规格型号"></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" readonly></el-input> |
| | | <el-input v-model="scope.row.unit" size="small" clearable placeholder="请输入"></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 |
| | | @change="(val)=>scope.row.number = isNaN(val)?null:val" clearable |
| | | placeholder="请输入"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-input v-model="scope.row.price" size="small" clearable placeholder="请输入"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="price" label="操作" width="65px"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click.native.prevent="deleteRow(scope.$index, addData.saleMaterialList)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="addSale">确 定</el-button> |
| | | <el-button v-if="upDia==false" type="primary" @click="addSale">确 定</el-button> |
| | | <el-button v-else-if="upDia==true" type="primary" @click="upSale">确 定</el-button> |
| | | <el-button @click="addDia = false">取 消</el-button> |
| | | </span> |
| | | </el-dialog> |
| | |
| | | delTime: null |
| | | }, |
| | | tableData: [], |
| | | selects: [], |
| | | selects: '', |
| | | currentPage: 1, |
| | | countSize: 0, |
| | | pageSize: 10, |
| | |
| | | phone: null, |
| | | saleMaterialList: [] |
| | | }, |
| | | repeList: [] |
| | | repeList: [], |
| | | upDia: false |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.selectRawInspectsList() |
| | | }, |
| | | methods: { |
| | | closeDialog(){ |
| | | this.addData = { |
| | | orderNumber: null, |
| | | code: null, |
| | | name: null, |
| | | proname: null, |
| | | adress: null, |
| | | username: null, |
| | | delTime: null, |
| | | orderName: null, |
| | | phone: null, |
| | | saleMaterialList: [] |
| | | } |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.selects = val; |
| | | this.selects = '' |
| | | val.forEach((a, ai)=>{ |
| | | this.selects += a.id |
| | | if(ai!=val.length-1){ |
| | | this.selects += ',' |
| | | } |
| | | }) |
| | | }, |
| | | handleSizeChange(val) { |
| | | this.pageSize = val |
| | |
| | | }) |
| | | }, |
| | | clean() { |
| | | this.selects = [] |
| | | this.selects = '' |
| | | this.currentPage = 1 |
| | | this.countSize = 0 |
| | | this.pageSize = 10 |
| | |
| | | formTime: null, |
| | | createTime: null, |
| | | insState: 2, |
| | | judgeState: 2 |
| | | judgeState: 2, |
| | | type: null |
| | | } |
| | | this.selectRawInspectsList() |
| | | }, |
| | |
| | | this.addData.saleMaterialList.push({}) |
| | | }, |
| | | addSale() { |
| | | for (var b = 0; b < this.addData.saleMaterialList.length; b++) { |
| | | if (Object.keys(this.addData.saleMaterialList[b]).length == 0) { |
| | | this.addData.saleMaterialList.splice(b, 1) |
| | | b-- |
| | | } else { |
| | | for (var c in this.addData.saleMaterialList[b]) { |
| | | if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == '' || Object |
| | | .keys(this.addData.saleMaterialList[b]).length != 5) { |
| | | this.$message.error('产品信息有必填项未填写') |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (var a in this.addData) { |
| | | if (this.addData[a] == null || this.addData[a] == '') { |
| | | if (a == 'saleMaterialList') { |
| | |
| | | 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); |
| | | this.$message.success('添加成功') |
| | | this.addDia = false |
| | | this.selectRawInspectsList() |
| | | }) |
| | | }, |
| | | openAddDia() { |
| | | this.addDia = !(this.addDia) |
| | | this.$axios.post(this.$api.url.seleRepe).then(res => { |
| | | this.repeList = res.data |
| | | }) |
| | | this.upDia = false |
| | | }, |
| | | upRepe(index, i) { |
| | | var data = this.repeList[index] |
| | |
| | | this.addData.saleMaterialList[i].unit = data.unit |
| | | this.addData.saleMaterialList[i].specifications = data.specifications |
| | | } |
| | | }, |
| | | saleCheck(ob) { |
| | | this.$confirm(`订单${ob.row.code}的信息是否通过`, '销售订单审核', { |
| | | distinguishCancelAndClose: true, |
| | | confirmButtonText: '通过', |
| | | cancelButtonText: '不通过' |
| | | }).then(res => { |
| | | this.$axios.post(this.$api.url.saleCheck, { |
| | | id: ob.row.id, |
| | | type: 1 |
| | | }).then(res => { |
| | | this.selectRawInspectsList() |
| | | this.$parent.removeAllTab() |
| | | }) |
| | | }).catch(e => { |
| | | if (e == 'cancel') { |
| | | this.$axios.post(this.$api.url.saleCheck, { |
| | | id: ob.row.id, |
| | | type: 0 |
| | | }).then(res => { |
| | | this.selectRawInspectsList() |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | openUpDia(index) { |
| | | this.addDia = true |
| | | this.upDia = true |
| | | this.axios.get(this.$api.url.selectSaleDatilById, { |
| | | params: { |
| | | id: index |
| | | } |
| | | }).then(res => { |
| | | this.addData = res.data |
| | | this.addData.id = index |
| | | }) |
| | | }, |
| | | upSale() { |
| | | for (var b = 0; b < this.addData.saleMaterialList.length; b++) { |
| | | if (Object.keys(this.addData.saleMaterialList[b]).length == 0) { |
| | | this.addData.saleMaterialList.splice(b, 1) |
| | | b-- |
| | | } else { |
| | | for (var c in this.addData.saleMaterialList[b]) { |
| | | if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == '' || Object |
| | | .keys(this.addData.saleMaterialList[b]).length != 6) { |
| | | this.$message.error('产品信息有必填项未填写') |
| | | return |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (var a in this.addData) { |
| | | console.log(a); |
| | | if ((this.addData[a] == null || this.addData[a] == '') && a!='checkname' && a!='checkTime' && a != 'type') { |
| | | if (a == 'saleMaterialList') { |
| | | this.$message.error('产品信息不能为空') |
| | | } else { |
| | | this.$message.error('销售订单有必填项未填写') |
| | | } |
| | | return |
| | | } |
| | | } |
| | | this.axios.post(this.$api.url.updateSaleById, { |
| | | id: this.addData.id, |
| | | str: JSON.stringify(this.addData) |
| | | }).then(res => { |
| | | this.$message.success('编辑成功') |
| | | this.addDia = false |
| | | this.upDia = false |
| | | this.selectRawInspectsList() |
| | | }) |
| | | }, |
| | | deleteRow(index, rows) { |
| | | rows.splice(index, 1); |
| | | }, |
| | | delSale(index){ |
| | | this.axios.post(this.$api.url.delSale, { |
| | | id: this.tableData[index].id, |
| | | }).then(res => { |
| | | this.$message.success('删除成功') |
| | | this.tableData.splice(index, 1) |
| | | }) |
| | | }, |
| | | delSales(){ |
| | | if(this.selects=='') { |
| | | this.$message.warning('请选择一条数据删除') |
| | | return |
| | | } |
| | | this.axios.post(this.$api.url.delAllSale,{ |
| | | ids: this.selects |
| | | }).then(res=>{ |
| | | this.$message.success('删除成功') |
| | | this.selectRawInspectsList() |
| | | }) |
| | | } |
| | | } |
| | | } |