mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-25 22:27:55 +08:00
135 lines
4.8 KiB
JavaScript
135 lines
4.8 KiB
JavaScript
(function (vc, vm) {
|
|
|
|
vc.extends({
|
|
data: {
|
|
editIntegralConfigInfo: {
|
|
configId: '',
|
|
squarePrice: '',
|
|
additionalAmount: '',
|
|
configName: '',
|
|
computingFormula: '',
|
|
scale: '',
|
|
|
|
}
|
|
},
|
|
_initMethod: function () {
|
|
|
|
},
|
|
_initEvent: function () {
|
|
vc.on('editIntegralConfig', 'openEditIntegralConfigModal', function (_params) {
|
|
$that.refreshEditIntegralConfigInfo();
|
|
$('#editIntegralConfigModel').modal('show');
|
|
vc.copyObject(_params, $that.editIntegralConfigInfo);
|
|
$that.editIntegralConfigInfo.communityId = vc.getCurrentCommunity().communityId;
|
|
});
|
|
},
|
|
methods: {
|
|
editIntegralConfigValidate: function () {
|
|
return vc.validate.validate({
|
|
editIntegralConfigInfo: $that.editIntegralConfigInfo
|
|
}, {
|
|
'editIntegralConfigInfo.squarePrice': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "金额/月不能为空"
|
|
},
|
|
],
|
|
'editIntegralConfigInfo.additionalAmount': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "赠送积分不能为空"
|
|
}
|
|
],
|
|
'editIntegralConfigInfo.configName': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "标准名称不能为空"
|
|
},
|
|
{
|
|
limit: "maxLength",
|
|
param: "100",
|
|
errInfo: "标准名称不能超过100"
|
|
},
|
|
],
|
|
'editIntegralConfigInfo.computingFormula': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "计算公式不能为空"
|
|
},
|
|
{
|
|
limit: "maxLength",
|
|
param: "12",
|
|
errInfo: "计算公式不能超过12"
|
|
},
|
|
],
|
|
'editIntegralConfigInfo.scale': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "进位不能为空"
|
|
},
|
|
{
|
|
limit: "maxLength",
|
|
param: "12",
|
|
errInfo: "进位不能超过12"
|
|
},
|
|
],
|
|
'editIntegralConfigInfo.configId': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "积分标准不能为空"
|
|
}]
|
|
|
|
});
|
|
},
|
|
editIntegralConfig: function () {
|
|
|
|
if (!$that.editIntegralConfigValidate()) {
|
|
vc.toast(vc.validate.errInfo);
|
|
return;
|
|
}
|
|
|
|
vc.http.apiPost(
|
|
'/integral.updateIntegralConfig',
|
|
JSON.stringify($that.editIntegralConfigInfo),
|
|
{
|
|
emulateJSON: true
|
|
},
|
|
function (json, res) {
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
let _json = JSON.parse(json);
|
|
if (_json.code == 0) {
|
|
//关闭model
|
|
$('#editIntegralConfigModel').modal('hide');
|
|
vc.emit('integralConfigManage', 'listIntegralConfig', {});
|
|
return;
|
|
}
|
|
vc.toast(_json.msg);
|
|
},
|
|
function (errInfo, error) {
|
|
console.log('请求失败处理');
|
|
|
|
vc.toast(errInfo);
|
|
});
|
|
},
|
|
refreshEditIntegralConfigInfo: function () {
|
|
$that.editIntegralConfigInfo = {
|
|
configId: '',
|
|
squarePrice: '',
|
|
additionalAmount: '',
|
|
configName: '',
|
|
computingFormula: '',
|
|
scale: '',
|
|
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
})(window.vc, window.$that);
|