Files
zszq-trs/YLErpWeb/wwwroot/Scripts/app/swapRate/swapRateEdit.js
T
2025-12-26 14:00:19 +08:00

114 lines
4.3 KiB
JavaScript

//otcformat禁止千分位分组
window.otcformat.options.disableGrouping = true;
const inputFormatRate = Object.freeze({ precision: otcformat.trading.premiumRateP.precision, negative: true, append: '%' });
const inputFormatThousandsRate = Object.freeze({ precision: otcformat.trading.premiumRateP.precision, negative: true, append: '‱' });
const inputFormatSinglePrice = Object.freeze({ precision: otcformat.trading.umprice.precision, negative: true, append: '' });
var vue = new Vue({
el: "#rateEditModal",
data: {
rate: {
id: 0,
TakeEffectDate: "",
TempRateIsPercent: true,
TempRate: null,
BaseRateIsPercent: true,
BaseRate: null,
DiscountRateIsPercent: true,
DiscountRate: null,
DiscountAccDown: null,
FrontDeskChargeIsPercent: true,
FrontDeskCharge: null,
BackDeskChargeIsPercent: true,
BackDeskCharge: null,
OfflineRate: null,
},
IsDma: false
},
mounted: function () {
let thisObbj = this;
let autoClient = FastVue.autocomplete(document.getElementById('ClientId'), {
nameField: 'Name', valueField: 'id', searchField: ['Name', 'PinYin'],
lookup: clients, onSelect: function (rep) {
thisObbj.changeClient(rep);
}
});
let clientId = model.ClientId;
let client = clientId >= 0 ? clients.find(x => x.id === clientId) : null;
if (client!=null) {
this.IsDma = client.SwapTradeType == 1;
}
autoClient.setData(client);
this.rate = model;
this.rate.TakeEffectDate = moment(this.rate.TakeEffectDate).format('YYYY-MM-DD');
},
methods: {
save() {
var thisObj = this;
if (thisObj.rate.ClientId==null||thisObj.rate.ClientId == 0) {
return main.alert("请选择客户");
}
if (thisObj.rate.TakeEffectDate == null || thisObj.rate.TakeEffectDate.length == 0) {
return main.alert("请选择生效日期");
}
if ((thisObj.rate.TempRate == null || thisObj.rate.TempRate == "") && (thisObj.rate.BaseRate == null || thisObj.rate.BaseRate == "")) {
return main.alert("临时费率、基础费率必须填写一个");
}
if ((thisObj.rate.DiscountRate != null && thisObj.rate.DiscountRate != "") && thisObj.rate.DiscountAccDown==null) {
return main.alert("优惠累计量下限不能为空");
}
if (thisObj.rate.DiscountRate == null || thisObj.rate.DiscountRate=="") {
thisObj.rate.DiscountAccDown = null;
}
main.post("/SwapRate/SaveSwapRate", { req: thisObj.rate }).done(function (resp) {
if (resp.success) {
thisObj.close();
} else {
main.alert(resp.msg);
}
})
},
changeClient: function (client) {
this.rate.ClientId = client.id;
this.rate.ClientNumber = client.Number;
this.IsDma = client.SwapTradeType == 1;
},
showTempAbsPrice() {
this.rate.TempRateIsPercent = false;
},
showTempPercentPrice() {
this.rate.TempRateIsPercent = true;
},
showBaseAbsPrice() {
this.rate.BaseRateIsPercent = false;
},
showBasePercentPrice() {
this.rate.BaseRateIsPercent = true;
},
showDisAbsPrice() {
this.rate.DiscountRateIsPercent = false;
},
showDisPercentPrice() {
this.rate.DiscountRateIsPercent = true;
},
showFrontAbsPrice() {
this.rate.FrontDeskChargeIsPercent = false;
},
showFrontPercentPrice() {
this.rate.FrontDeskChargeIsPercent = true;
},
showBackAbsPrice() {
this.rate.BackDeskChargeIsPercent = false;
},
showBackPercentPrice() {
this.rate.BackDeskChargeIsPercent = true;
},
close() {
window.parent.reloadData();
layer.closeMe();
}
},
components: {
'vue-datepicker': FastVue.vueDatePicker(),
'vue-number-input': FastVue.vueNumberInput()
},
});