|
@@ -22,15 +22,15 @@
|
|
|
></previewImage>
|
|
|
</div>
|
|
|
<div v-else-if="scope.column.columnname == 'discountrate'">
|
|
|
- <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.discountrate" @input="discountrateChange($event,scope.column.data)"></el-input>
|
|
|
+ <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.discountrate" @change="discountrateChange($event,scope.column.data,scope.column.data.index)"></el-input>
|
|
|
<p v-else>{{scope.column.data[scope.column.columnname]}}</p>
|
|
|
</div>
|
|
|
<div v-else-if="scope.column.columnname == 'price'">
|
|
|
- <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.price" @input="priceChange($event,scope.column.data)"></el-input>
|
|
|
+ <el-input size="mini" v-if="editIndex == scope.column.data.sa_contract_itemsid" v-model="form.price" @change="priceChange($event,scope.column.data,scope.column.data.index)"></el-input>
|
|
|
<p v-else>{{scope.column.data[scope.column.columnname]}}</p>
|
|
|
</div>
|
|
|
<div v-else-if="scope.column.columnname == 'countPrice'">
|
|
|
- <p>{{scope.column.data.price * scope.column.data.qty}}</p>
|
|
|
+ <p>{{Math.round((scope.column.data.price * scope.column.data.qty)*100)/100}}</p>
|
|
|
</div>
|
|
|
<div v-else-if="scope.column.columnname == 'brand'">
|
|
|
{{scope.column.data[scope.column.columnname][0] && scope.column.data[scope.column.columnname][0].brandname}}
|
|
@@ -104,6 +104,9 @@ export default {
|
|
|
async listData(){
|
|
|
this.params.content.sa_contractid = this.$route.query.id
|
|
|
const res = await this.$api.requested(this.params)
|
|
|
+ res.data.forEach((e,index)=>{
|
|
|
+ res.data[index].discountrate = Math.round((res.data[index].discountrate *100)*100)/100
|
|
|
+ })
|
|
|
this.list = res.data
|
|
|
this.total = res.total
|
|
|
this.$emit('priceChange')
|
|
@@ -111,23 +114,40 @@ export default {
|
|
|
qtyChange (num) {
|
|
|
this.form.qty = num
|
|
|
console.log(num);
|
|
|
-
|
|
|
},
|
|
|
handleChange(num) {
|
|
|
console.log(num);
|
|
|
|
|
|
},
|
|
|
- discountrateChange (num,data) {
|
|
|
- this.form.discountrate = num
|
|
|
- this.form.price = this.form.discountrate / 100 * data.marketprice
|
|
|
+ discountrateChange (num,data,index) {
|
|
|
+ console.log(num,data,index)
|
|
|
+ if (num>100){
|
|
|
+ this.form.discountrate = 100
|
|
|
+ }else if (num < 0){
|
|
|
+ this.form.discountrate = 1
|
|
|
+ }else {
|
|
|
+ this.form.discountrate = Math.round(num *100)/100
|
|
|
+ }
|
|
|
+ this.form.price = Math.round((this.form.discountrate / 100 * data.marketprice)*100)/100
|
|
|
+ data.price = this.form.price
|
|
|
+ this.$set(this.list,index,data)
|
|
|
},
|
|
|
- priceChange (num,data) {
|
|
|
- this.form.price = num
|
|
|
- this.form.discountrate = this.form.price / data.marketprice * 100
|
|
|
+ priceChange (num,data,index) {
|
|
|
+ if (num > data.marketprice){
|
|
|
+ this.form.price = data.marketprice
|
|
|
+ }else if (num < data.marketprice * 0.01){
|
|
|
+ this.form.price = data.marketprice * 0.01
|
|
|
+ }else {
|
|
|
+ this.form.price = Math.round(num * 100)/100
|
|
|
+ }
|
|
|
+ this.form.discountrate = Math.round((this.form.price / data.marketprice * 100)*100)/100
|
|
|
+ data.price = this.form.price
|
|
|
+ this.$set(this.list,index,data)
|
|
|
console.log(this.form.price,data.marketprice);
|
|
|
|
|
|
},
|
|
|
async save () {
|
|
|
+ this.form.discountrate = (this.form.discountrate/100).toFixed(4)
|
|
|
let res = await this.$api.requested({
|
|
|
"id": 20221122200302,
|
|
|
"content": {
|