| | |
| | | <el-table-column prop="price" label="采购价(元)" show-overflow-tooltip min-width="100px"></el-table-column> |
| | | <el-table-column label="入手价(元)" show-overflow-tooltip min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <el-input v-model="row.purchasePrice" placeholder="请输入"></el-input> |
| | | <el-input v-model="row.purchasePrice" @input="changeVal(row)" placeholder="请输入"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | }) |
| | | }, |
| | | methods: { |
| | | changeVal(row) { |
| | | var zz2 = new RegExp("^[0-9]*[1-9][0-9]*$"); |
| | | if (!zz2.test(row.purchasePrice)) { |
| | | row.purchasePrice = '' |
| | | this.$message.warning({ message: '只能输入整数' }) |
| | | } |
| | | }, |
| | | getList() { |
| | | pageT({ |
| | | capacity: this.pageSize, |
| | |
| | | page: this.page |
| | | }).then(res => { |
| | | res.records.forEach(item => { |
| | | item.purchasePrice = item.price * this.form.rate |
| | | item.purchasePrice = Math.ceil(item.price * this.form.rate) |
| | | }) |
| | | this.tableData = res.records |
| | | this.total = res.total |
| | |
| | | handleSelectionChange(e) { |
| | | let arr = [] |
| | | e.forEach(item => { |
| | | arr.push({ goodsId: item.id, price: item.purchasePrice }) |
| | | arr.push({ id: item.id }) |
| | | }) |
| | | // e.forEach(item => { |
| | | // arr.push({ goodsId: item.id, price: item.purchasePrice }) |
| | | // }) |
| | | this.form.goodsParamList = arr |
| | | console.log(arr) |
| | | }, |
| | | confirm() { |
| | | if (this.form.goodsParamList.length === 0) { |
| | | this.$message.warning({ message: '请先勾选商品' }) |
| | | return |
| | | } |
| | | let goodsParamList = [] |
| | | this.form.goodsParamList.forEach(item => { |
| | | this.tableData.forEach(child => { |
| | | if (item.id === child.id) { |
| | | goodsParamList.push({ goodsId: child.id, price: child.purchasePrice }) |
| | | } |
| | | }) |
| | | }) |
| | | // 调用新建接口 |
| | | this.isWorking = true |
| | | createPlat({ |
| | | categoryId: this.form.categoryId1, |
| | | goodsParamList: this.form.goodsParamList, |
| | | goodsParamList, |
| | | rate: this.form.rate, |
| | | type: this.form.type |
| | | }).then(res => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('操作成功') |
| | | this.$tip.apiSuccess(res) |
| | | // this.$emit('success') |
| | | this.$emit('result') |
| | | }) |
| | |
| | | open(title, target) { |
| | | this.title = title |
| | | this.visible = true |
| | | this.form.name = '' |
| | | this.form.categoryId = Number(target.categoryId.split(',')[0]) |
| | | this.form.categoryId1 = Number(target.categoryId.split(',')[1]) |
| | | this.form.rate = Number(target.rate) |