|
@@ -63,6 +63,26 @@
|
|
|
{{ scope.row[countObj.unitKey] || '' }}
|
|
{{ scope.row[countObj.unitKey] || '' }}
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <!-- 单价:允许调整,联动 totalPrice / discountSinglePrice / discountTotalPrice -->
|
|
|
|
|
+ <template v-slot:singlePrice="scope">
|
|
|
|
|
+ <el-form-item :prop="'datasource.' + scope.$index + '.singlePrice'">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="scope.row.singlePrice"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
|
+ @input="changeCount(scope.row, scope.$index)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template slot="append">元</template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-slot:headerSinglePrice="{ column }">
|
|
|
|
|
+ <span>{{ column.label }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- 不含税单价:跟随 singlePrice + taxRate 自动计算 -->
|
|
|
|
|
+ <template v-slot:notaxSinglePrice="scope">
|
|
|
|
|
+ {{ scope.row.notaxSinglePrice }}
|
|
|
|
|
+ </template>
|
|
|
<!-- <template v-slot:saleUnit="scope">
|
|
<!-- <template v-slot:saleUnit="scope">
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
:prop="'datasource.' + scope.$index + '.' + countObj.unitKey"
|
|
:prop="'datasource.' + scope.$index + '.' + countObj.unitKey"
|
|
@@ -107,7 +127,8 @@
|
|
|
getAllQuantity,
|
|
getAllQuantity,
|
|
|
formatPrice,
|
|
formatPrice,
|
|
|
getAllPrice,
|
|
getAllPrice,
|
|
|
- getAllDiscountPrice
|
|
|
|
|
|
|
+ getAllDiscountPrice,
|
|
|
|
|
+ changeCount as changeCountUtil
|
|
|
} from '@/BIZComponents/setProduct.js';
|
|
} from '@/BIZComponents/setProduct.js';
|
|
|
import { getInventoryTotalAPI } from '@/api/bpm/components/wms';
|
|
import { getInventoryTotalAPI } from '@/api/bpm/components/wms';
|
|
|
|
|
|
|
@@ -212,7 +233,9 @@
|
|
|
},
|
|
},
|
|
|
columnsVersion: 1,
|
|
columnsVersion: 1,
|
|
|
tabMixinsInit: false,
|
|
tabMixinsInit: false,
|
|
|
- quoteTypeOp
|
|
|
|
|
|
|
+ quoteTypeOp,
|
|
|
|
|
+ // 标记:用户在表格里是否手动修改过单价,仅当为 true 时审批前才需要落库
|
|
|
|
|
+ singlePriceChanged: false
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -896,6 +919,64 @@
|
|
|
handleMethod(row) {
|
|
handleMethod(row) {
|
|
|
this.$refs.timeDialogRef.open(row);
|
|
this.$refs.timeDialogRef.open(row);
|
|
|
},
|
|
},
|
|
|
|
|
+ // 修改单价后,联动更新行内的合计/折让字段与组件级总计
|
|
|
|
|
+ changeCount(row, index) {
|
|
|
|
|
+ if (!row) {
|
|
|
|
|
+ this.form.datasource.forEach((item, idx) => {
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.form.datasource,
|
|
|
|
|
+ idx,
|
|
|
|
|
+ changeCountUtil(item, this.countObj)
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 用户在 UI 上实际修改了某行的单价,置位"已改动"标记
|
|
|
|
|
+ this.singlePriceChanged = true;
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.form.datasource,
|
|
|
|
|
+ index,
|
|
|
|
|
+ changeCountUtil(row, this.countObj)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.getNotaxSinglePrice();
|
|
|
|
|
+ this.changeAll();
|
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ // 供父组件查询:用户在表格里是否手动调整过单价
|
|
|
|
|
+ isSinglePriceChanged() {
|
|
|
|
|
+ return this.singlePriceChanged;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 刷新组件级总计
|
|
|
|
|
+ changeAll() {
|
|
|
|
|
+ this.allPrice = getAllPrice(this.form.datasource) || 0;
|
|
|
|
|
+ if (this.isDiscountTotalPrice) {
|
|
|
|
|
+ this.form.discountTotalPrice =
|
|
|
|
|
+ getAllDiscountPrice(this.form.datasource) || this.allPrice;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 通知父组件刷新"订单总金额 / 应付金额"
|
|
|
|
|
+ this.$emit('price-change', {
|
|
|
|
|
+ totalAmount: this.allPrice,
|
|
|
|
|
+ payAmount: this.form.discountTotalPrice
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ // 不含税单价 = 单价 / (1 + 税率/100)
|
|
|
|
|
+ getNotaxSinglePrice() {
|
|
|
|
|
+ this.form.datasource.forEach((item, index) => {
|
|
|
|
|
+ if (item.singlePrice && item.taxRate) {
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.form.datasource[index],
|
|
|
|
|
+ 'notaxSinglePrice',
|
|
|
|
|
+ parseFloat(
|
|
|
|
|
+ (item.singlePrice / (1 + Number(item.taxRate) / 100)).toFixed(2)
|
|
|
|
|
+ )
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
// 返回列表数据
|
|
// 返回列表数据
|
|
|
getTableValue() {
|
|
getTableValue() {
|
|
|
let comitDatasource = this.form.datasource;
|
|
let comitDatasource = this.form.datasource;
|
|
@@ -1047,6 +1128,10 @@
|
|
|
'productId'
|
|
'productId'
|
|
|
);
|
|
);
|
|
|
this.$refs.table?.reload();
|
|
this.$refs.table?.reload();
|
|
|
|
|
+ // 单价允许调整:回显后统一跑一次联动计算,保证 totalPrice / discountTotalPrice / notaxSinglePrice 与 singlePrice 一致
|
|
|
|
|
+ if (this.isChangeCount) {
|
|
|
|
|
+ this.changeCount();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|