From 861e1c1428046b348f7e963025a454e710792815 Mon Sep 17 00:00:00 2001 From: 李林 <z1292839451@163.com> Date: 星期四, 17 八月 2023 12:54:15 +0800 Subject: [PATCH] 增加菜单,增加销售管理 --- src/components/view/sale.vue | 75 +++++++++++++++++++++++++++++++++---- 1 files changed, 67 insertions(+), 8 deletions(-) diff --git a/src/components/view/sale.vue b/src/components/view/sale.vue index c229b1f..e46f70c 100644 --- a/src/components/view/sale.vue +++ b/src/components/view/sale.vue @@ -115,7 +115,7 @@ <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> @@ -281,7 +281,7 @@ </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"> @@ -346,23 +346,27 @@ <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="鍗曚环"> @@ -399,10 +403,20 @@ 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() { @@ -462,6 +476,36 @@ 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' @@ -469,6 +513,21 @@ }).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 + } } } } -- Gitblit v1.9.3