UNPKG

tplus-pos

Version:

pos module

134 lines (122 loc) 4.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VoucherUiStateProcessor = undefined; var _assign = require("babel-runtime/core-js/object/assign"); var _assign2 = _interopRequireDefault(_assign); var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = require("babel-runtime/helpers/createClass"); var _createClass3 = _interopRequireDefault(_createClass2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** *明细行数据值控制 * @export * @class VoucherUiStateProcessor * @auther tuzha */ var VoucherUiStateProcessor = exports.VoucherUiStateProcessor = function () { function VoucherUiStateProcessor() { (0, _classCallCheck3.default)(this, VoucherUiStateProcessor); } (0, _createClass3.default)(VoucherUiStateProcessor, null, [{ key: "execute", value: function execute(detailDto, refundDetail, voucherView) { var minValue = -999999999999; var maxValue = 999999999999; //控制数量 var options = {}; var option = {}; if (refundDetail) { option = { 'Quantity': { min: { value: minValue, tip: "原单退货数量不能大于最大可退数量" }, max: { value: 0, tip: "原单退货数量不能为正数" }, abs: '' } }; (0, _assign2.default)(options, option); //控制数量2 option = { 'Quantity2': { min: { value: minValue, tip: "原单退货数量不能大于最大可退数量" }, max: { value: 0, tip: "原单退货数量不能为正数" }, abs: '' } }; (0, _assign2.default)(options, option); //控制单价 option = { 'TaxPrice': { min: { value: 0, tip: "原单退货单价不能少于零" }, max: { value: maxValue, tip: "单价不能大于原单单价金额" }, abs: 'positive' } }; (0, _assign2.default)(options, option); //控制金额 option = { 'TaxAmount': { min: { value: minValue, tip: "退货金额不能大于原单金额" }, max: { value: 0, tip: "原单退货退款金额不能为正数" }, abs: '' } }; (0, _assign2.default)(options, option); //控制折扣 // option = { 'DiscountRate': { // min:{ // value: 0, // tip:"原单退货折扣不能少于零" // } , // max:{ // value:refundDetail.DiscountRate*100, // tip: "原单退货折扣不能大于原单折扣" // } , // abs: 'positive', // } } (0, _assign2.default)(options, option); } else { option = { 'Quantity': { min: { value: 0, tip: "换货数量不能为负数" }, abs: 'positive' } }; (0, _assign2.default)(options, option); //控制数量2 option = { 'Quantity2': { min: { value: 0, tip: "换货数量不能为负数" }, abs: 'positive' } }; (0, _assign2.default)(options, option); } if (detailDto) { voucherView.changeUiState({ code: detailDto.Code, options: options }); } } }]); return VoucherUiStateProcessor; }(); //# sourceMappingURL=VoucherUiStateProcessor.js.map