|
|
@@ -9,7 +9,7 @@
|
|
|
<div class="app-list-content" v-else>
|
|
|
<div class="left_box">
|
|
|
<p class="tor">
|
|
|
- <span style="color:black;">供货商:{{form.ghsName}}</span>
|
|
|
+ <span style="color:black;font-weight:bold;">供货商:{{form.ghsName}}</span>
|
|
|
<span>全屏:F11</span>
|
|
|
<span>修改:回车</span>
|
|
|
<span>删除:Delete</span>
|
|
|
@@ -29,11 +29,24 @@
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column prop="name" label="名称" align="center"></el-table-column>
|
|
|
- <el-table-column prop="userPrice" label="单价" width="110" align="center"></el-table-column>
|
|
|
- <el-table-column prop="bigCount" label="数量" width="110" align="center"></el-table-column>
|
|
|
+ <el-table-column prop="bigCount" label="数量" width="110" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="cgUnitType == 0">
|
|
|
+ {{ scope.row.bigCount }}{{ scope.row.bigUnit }}
|
|
|
+ </span>
|
|
|
+ <span v-else>
|
|
|
+ {{ scope.row.smallCount }}{{ scope.row.smallUnit }}
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="userPrice" label="单价" width="110" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.aboutPrice == 1 ? '约' : '' }} {{ scope.row.userPrice }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="sumPrice" label="金额" width="110" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- ¥{{ parseFloat((Number(scope.row.userPrice)*Number(scope.row.bigCount)).toFixed(2)) }}
|
|
|
+ {{ scope.row.totalPrice }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
@@ -61,7 +74,14 @@
|
|
|
<img :src="scope.row.cover" style="width:26px;margin:0 auto;" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="名称" align="center"></el-table-column>
|
|
|
+ <el-table-column prop="name" label="名称" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.name }}
|
|
|
+ <span v-if="scope.row.selectedNum && Number(scope.row.selectedNum)>0" style="color:blue;font-weight:bold;">
|
|
|
+ (已选{{ scope.row.selectedNum }}{{ cgUnitType == 0 ? scope.row.bigUnit : scope.row.smallUnit }})
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="price" label="价格" width="100" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span>¥{{ scope.row.price?parseFloat(scope.row.price):0 }}</span>
|
|
|
@@ -80,7 +100,9 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="selectedNum" label="已选数量" align="center" width="120">
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-if="scope.row.selectedNum && Number(scope.row.selectedNum)>0" style="color:red;font-weight:bold;font-size:17px;">已选{{ scope.row.selectedNum }}</span>
|
|
|
+ <span v-if="scope.row.selectedNum && Number(scope.row.selectedNum)>0" style="color:blue;font-weight:bold;font-size:15px;">
|
|
|
+ 已选{{ scope.row.selectedNum }}{{ cgUnitType == 0 ? scope.row.bigUnit : scope.row.smallUnit }}
|
|
|
+ </span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -95,15 +117,35 @@
|
|
|
<el-button size="medium" style="margin-left:50px;" @click="comeBack()">返回</el-button>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog :title="currentItem.name" v-if="showConfirmNum" :visible.sync="showConfirmNum" width="30%" center>
|
|
|
+ <el-dialog :title="currentItem.name" :visible.sync="showConfirmNum" width="30%" center>
|
|
|
<div class="el-dialog-center">
|
|
|
- <el-input ref="bigInput" style="width: 130px;margin-left: 15px" placeholder="数量" @keyup.enter.native="confirmNumPrice()" type="number" v-model="customData.bigCount"></el-input>
|
|
|
- <span>{{currentItem.bigUnit}}</span>
|
|
|
- <el-input style="width: 130px;margin-left: 15px" placeholder="价格" @keyup.enter.native="confirmNumPrice()" type="number" v-model="customData.userPrice"></el-input>
|
|
|
- <span>元</span>
|
|
|
+
|
|
|
+ <template v-if="cgUnitType == 0">
|
|
|
+ <el-input ref="countInput" style="width: 90px;margin-left: 15px;text-align:center;" placeholder="数量" @keyup.enter.native="confirmNumPrice()" @input="bigCountChange"
|
|
|
+ type="number" v-model="customData.bigCount"></el-input>
|
|
|
+ <span style="padding:0 0 0 4px;">{{currentItem.bigUnit}}</span>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-input ref="countInput" style="width: 90px;margin-left: 15px;text-align:center;" placeholder="数量" @keyup.enter.native="confirmNumPrice()" @input="smallCountChange"
|
|
|
+ type="number" v-model="customData.smallCount"></el-input>
|
|
|
+ <span style="padding:0 0 0 4px;">{{currentItem.smallUnit}}</span>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <span style="padding:0 2px 0 15px;color:red;font-weight:bold;"v-if="customData.aboutPrice == 1">约</span>
|
|
|
+ <span style="padding:0 2px 0 15px;color:green;font-weight:bold;" v-else> </span>
|
|
|
+ <el-input style="width: 90px;margin-left:0px;text-align:center;" center placeholder="单价" @keyup.enter.native="confirmNumPrice()" @input="userPriceChange"
|
|
|
+ type="number" v-model="customData.userPrice"></el-input>
|
|
|
+ <span style="padding:0 0 0 4px;">元</span>
|
|
|
+ <el-input style="width: 90px;margin-left: 15px;text-align:center;" placeholder="总价" @keyup.enter.native="confirmNumPrice()" @input="totalPriceChange"
|
|
|
+ type="number" v-model="customData.totalPrice"></el-input>
|
|
|
+ <span style="padding:0 0 0 4px;">元</span>
|
|
|
</div>
|
|
|
<div style="text-align:center;margin:20px 0 5px 0;font-weight:bold;font-size:18px;">剩 {{ currentItem.stock ? parseFloat(currentItem.stock) : 0 }} {{ currentItem.bigUnit}}</div>
|
|
|
- <div class="remark">Enter 确定,Esc 取消</div>
|
|
|
+ <div class="remark">
|
|
|
+ <el-button @click="backToSearchItem()">取消</el-button>
|
|
|
+ <el-button type="primary" @click="confirmNumPrice()">确认</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="remark">Esc 取消,Enter 确认</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog title="确认提交" v-if="showCommitPop" :visible.sync="showCommitPop" width="655px" center :close-on-click-modal="false">
|
|
|
@@ -267,7 +309,8 @@ export default {
|
|
|
changeType:'add',
|
|
|
TT:null,
|
|
|
selectJobType: "purchase",
|
|
|
- globalCheckStock:false
|
|
|
+ globalCheckStock:false,
|
|
|
+ cgUnitType:0,//采购入库使用单位
|
|
|
};
|
|
|
},
|
|
|
mixins: [productMins],
|
|
|
@@ -294,10 +337,18 @@ export default {
|
|
|
let price = 0;
|
|
|
if (this.selectList) {
|
|
|
for (const item of this.selectList) {
|
|
|
- if(Number(item.bigCount)>0){
|
|
|
- price += Number(item.userPrice)*Number(item.bigCount);
|
|
|
+ if(this.cgUnitType == 0){
|
|
|
+ if(item.aboutPrice && item.aboutPrice == 1){
|
|
|
+ price += Number(item.totalPrice)
|
|
|
+ }else{
|
|
|
+ price += Number(item.userPrice)*Number(item.bigCount);
|
|
|
+ }
|
|
|
}else{
|
|
|
- price += Number(item.userPrice)*Number(item.smallCount);
|
|
|
+ if(item.aboutPrice && item.aboutPrice == 1){
|
|
|
+ price += Number(item.totalPrice)
|
|
|
+ }else{
|
|
|
+ price += Number(item.userPrice)*Number(item.smallCount);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -416,6 +467,7 @@ export default {
|
|
|
that.$service.shopAdmin.getAllStaff().then(res => {
|
|
|
that.staffList = res.list
|
|
|
})
|
|
|
+ that.cgUnitType = res.shopInfo.cgUnitType ? res.shopInfo.cgUnitType : 0
|
|
|
})
|
|
|
|
|
|
this.$service.itemClass.getAllClassIndex().then(data => {
|
|
|
@@ -471,6 +523,7 @@ export default {
|
|
|
that.$refs['itemSearchRef'].blur()
|
|
|
that.$confirm('确定删除 '+current.name+'?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
|
|
current.bigCount = 0
|
|
|
+ current.smallCount = 0
|
|
|
that.replaceItemFn(current,1,'sub')
|
|
|
that.selectIndex = 0
|
|
|
that.$refs.singleTable.setCurrentRow(that.selectList[0])
|
|
|
@@ -553,7 +606,9 @@ export default {
|
|
|
itemId:ele.itemId,
|
|
|
itemPrice: ele.userPrice,
|
|
|
ratio:ele.ratio,
|
|
|
- ratioType:ele.ratioType
|
|
|
+ ratioType:ele.ratioType,
|
|
|
+ aboutPrice:ele.aboutPrice,
|
|
|
+ totalPrice:ele.totalPrice
|
|
|
}
|
|
|
})
|
|
|
formData.itemInfo = JSON.stringify(itemInfo)
|
|
|
@@ -643,7 +698,11 @@ export default {
|
|
|
}
|
|
|
let selectedNum = 0
|
|
|
if(that.selectListIndex[ele.id]){
|
|
|
- selectedNum = that.selectListIndex[ele.id].bigCount ? Number(that.selectListIndex[ele.id].bigCount) : 0
|
|
|
+ if(that.cgUnitType == 0){
|
|
|
+ selectedNum = that.selectListIndex[ele.id].bigCount ? Number(that.selectListIndex[ele.id].bigCount) : 0
|
|
|
+ }else{
|
|
|
+ selectedNum = that.selectListIndex[ele.id].smallCount ? Number(that.selectListIndex[ele.id].smallCount) : 0
|
|
|
+ }
|
|
|
}
|
|
|
return {...ele,className:cName,selectedNum:selectedNum}
|
|
|
})
|
|
|
@@ -680,34 +739,120 @@ export default {
|
|
|
},
|
|
|
selectCurrentItem(currentItem){
|
|
|
this.currentItem = currentItem
|
|
|
- this.customData.bigCount = currentItem.bigCount > 0 ? currentItem.bigCount : 1
|
|
|
- this.customData.userPrice = parseFloat(this.currentItem.price)
|
|
|
+ if(this.cgUnitType == 0){
|
|
|
+ this.customData.bigCount = currentItem.bigCount > 0 ? currentItem.bigCount : 1
|
|
|
+ }else{
|
|
|
+ this.customData.smallCount = currentItem.smallCount > 0 ? currentItem.smallCount : 1
|
|
|
+ }
|
|
|
+ this.customData.aboutPrice = currentItem.aboutPrice ? currentItem.aboutPrice : 0
|
|
|
+ let currentPrice = 0
|
|
|
+ if(currentItem.userPrice && Number(currentItem.userPrice)>0){
|
|
|
+ currentPrice = currentItem.userPrice
|
|
|
+ }else{
|
|
|
+ if(currentItem.price && Number(currentItem.price)>0){
|
|
|
+ currentPrice = currentItem.price
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.customData.userPrice = parseFloat(currentPrice)
|
|
|
+
|
|
|
+ let total = 0
|
|
|
+ if(currentItem.totalPrice && Number(currentItem.totalPrice)>0){
|
|
|
+ this.customData.totalPrice = Number(currentItem.totalPrice)
|
|
|
+ }else{
|
|
|
+ if(this.cgUnitType == 0){
|
|
|
+ total = Number(this.customData.bigCount)*Number(this.customData.userPrice)
|
|
|
+ }else{
|
|
|
+ total = Number(this.customData.smallCount)*Number(this.customData.userPrice)
|
|
|
+ }
|
|
|
+ total = parseFloat(total.toFixed(2))
|
|
|
+ this.customData.totalPrice = total
|
|
|
+ }
|
|
|
+
|
|
|
this.desk = 'confirmPriceNum';
|
|
|
this.showGetItemList = false
|
|
|
this.showConfirmNum = true;
|
|
|
this.$nextTick(()=>{
|
|
|
- this.$refs['bigInput'].focus()
|
|
|
- this.$refs['bigInput'].select()
|
|
|
+ this.$refs['countInput'].focus()
|
|
|
+ this.$refs['countInput'].select()
|
|
|
})
|
|
|
},
|
|
|
+ totalPriceChange(){
|
|
|
+ if(Number(this.customData.totalPrice)>0){
|
|
|
+ if(this.cgUnitType == 0){
|
|
|
+ if(Number(this.customData.bigCount)>0){
|
|
|
+ let a = Number(this.customData.totalPrice)/Number(this.customData.bigCount)
|
|
|
+ this.customData.userPrice = Math.floor(a*100)/100
|
|
|
+
|
|
|
+ let newNum = Number(this.customData.userPrice)*Number(this.customData.bigCount)
|
|
|
+ newNum = parseFloat(newNum.toFixed(2))
|
|
|
+ if(Number(this.customData.totalPrice) > Number(newNum)){
|
|
|
+ this.customData.aboutPrice = 1
|
|
|
+ }else{
|
|
|
+ this.customData.aboutPrice = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(Number(this.customData.smallCount)>0){
|
|
|
+ let a = Number(this.customData.totalPrice)/Number(this.customData.smallCount)
|
|
|
+ this.customData.userPrice = Math.floor(a*100)/100
|
|
|
+ let newNum = Number(this.customData.userPrice)*Number(this.customData.smallCount)
|
|
|
+ newNum = parseFloat(newNum.toFixed(2))
|
|
|
+ if(Number(this.customData.totalPrice) > Number(newNum)){
|
|
|
+ this.customData.aboutPrice = 1
|
|
|
+ }else{
|
|
|
+ this.customData.aboutPrice = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ userPriceChange(){
|
|
|
+ if(Number(this.customData.userPrice)>0){
|
|
|
+ if(this.cgUnitType == 0){
|
|
|
+ if(Number(this.customData.bigCount)>0){
|
|
|
+ this.customData.totalPrice = Number(this.customData.bigCount)*Number(this.customData.userPrice)
|
|
|
+ this.customData.totalPrice = parseFloat(this.customData.totalPrice.toFixed(2))
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(Number(this.customData.smallCount)>0){
|
|
|
+ this.customData.totalPrice = Number(this.customData.smallCount)*Number(this.customData.userPrice)
|
|
|
+ this.customData.totalPrice = parseFloat(this.customData.totalPrice.toFixed(2))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ bigCountChange(){
|
|
|
+ if(Number(this.customData.bigCount)>0){
|
|
|
+ if(Number(this.customData.userPrice)>0){
|
|
|
+ this.customData.totalPrice = Number(this.customData.bigCount)*Number(this.customData.userPrice)
|
|
|
+ this.customData.totalPrice = parseFloat(this.customData.totalPrice.toFixed(2))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ smallCountChange(){
|
|
|
+ if(Number(this.customData.smallCount)>0){
|
|
|
+ if(Number(this.customData.userPrice)>0){
|
|
|
+ this.customData.totalPrice = Number(this.customData.smallCount)*Number(this.customData.userPrice)
|
|
|
+ this.customData.totalPrice = parseFloat(this.customData.totalPrice.toFixed(2))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
confirmNumPrice(){
|
|
|
let currentItem = this.currentItem;
|
|
|
- if(Number(this.customData.bigCount)<=0){
|
|
|
+ if(Number(this.customData.bigCount)<=0 && Number(this.customData.smallCount)<=0){
|
|
|
this.$message({message: '请填写数量',type: 'warning'});
|
|
|
return;
|
|
|
}
|
|
|
- for (let i=0;i<this.selectList.length;i++){
|
|
|
- if(this.selectList[i].id == currentItem.id){
|
|
|
- if(this.changeType == 'add'){
|
|
|
- this.customData.bigCount = Number(this.customData.bigCount)+Number(this.selectList[i].bigCount)
|
|
|
- }else{
|
|
|
- this.customData.bigCount = Number(this.customData.bigCount)
|
|
|
- }
|
|
|
- this.customData.bigCount = this.customData.bigCount.toFixed(2)
|
|
|
- this.customData.bigCount = parseFloat(this.customData.bigCount)
|
|
|
- }
|
|
|
+ if(Number(this.customData.userPrice)<=0){
|
|
|
+ this.$message({message: '请填写金额',type: 'warning'});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(Number(this.customData.totalPrice)<=0){
|
|
|
+ this.$message({message: '总金额错误',type: 'warning'});
|
|
|
+ return;
|
|
|
}
|
|
|
- currentItem = {...currentItem,bigCount:this.customData.bigCount,userPrice:this.customData.userPrice,smallCount:this.customData.smallCount}
|
|
|
+ currentItem = {...currentItem,bigCount:this.customData.bigCount,userPrice:this.customData.userPrice,smallCount:this.customData.smallCount,
|
|
|
+ totalPrice:this.customData.totalPrice,aboutPrice:this.customData.aboutPrice}
|
|
|
this.replaceItemFn(currentItem,1,'add')
|
|
|
this.backToSearchItem();
|
|
|
},
|