mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-26 08:16:47 +08:00
优化代码
This commit is contained in:
parent
db150057c9
commit
3c22f440ea
@ -1,4 +1,4 @@
|
||||
(function (vc) {
|
||||
(function(vc) {
|
||||
|
||||
vc.extends({
|
||||
propTypes: {
|
||||
@ -18,11 +18,11 @@
|
||||
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('addCouponPool', 'openAddCouponPoolModal', function () {
|
||||
_initEvent: function() {
|
||||
vc.on('addCouponPool', 'openAddCouponPoolModal', function() {
|
||||
$('#addCouponPoolModel').modal('show');
|
||||
});
|
||||
},
|
||||
@ -31,8 +31,7 @@
|
||||
return vc.validate.validate({
|
||||
addCouponPoolInfo: vc.component.addCouponPoolInfo
|
||||
}, {
|
||||
'addCouponPoolInfo.couponType': [
|
||||
{
|
||||
'addCouponPoolInfo.couponType': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "优惠券类型不能为空"
|
||||
@ -43,8 +42,7 @@
|
||||
errInfo: "优惠券类型不能超过12"
|
||||
},
|
||||
],
|
||||
'addCouponPoolInfo.couponName': [
|
||||
{
|
||||
'addCouponPoolInfo.couponName': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "优惠券名称不能为空"
|
||||
@ -55,8 +53,7 @@
|
||||
errInfo: "优惠券名称不能超过64"
|
||||
},
|
||||
],
|
||||
'addCouponPoolInfo.actualPrice': [
|
||||
{
|
||||
'addCouponPoolInfo.actualPrice': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "面值不能为空"
|
||||
@ -67,8 +64,7 @@
|
||||
errInfo: "面值不能超过10"
|
||||
},
|
||||
],
|
||||
'addCouponPoolInfo.buyPrice': [
|
||||
{
|
||||
'addCouponPoolInfo.buyPrice': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "购买价格不能为空"
|
||||
@ -79,8 +75,7 @@
|
||||
errInfo: "购买价格不能超过10"
|
||||
},
|
||||
],
|
||||
'addCouponPoolInfo.couponStock': [
|
||||
{
|
||||
'addCouponPoolInfo.couponStock': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "数量不能为空"
|
||||
@ -91,8 +86,7 @@
|
||||
errInfo: "数量不能超过20"
|
||||
},
|
||||
],
|
||||
'addCouponPoolInfo.validityDay': [
|
||||
{
|
||||
'addCouponPoolInfo.validityDay': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "有效期不能为空"
|
||||
@ -103,8 +97,7 @@
|
||||
errInfo: "有效期不能超过20"
|
||||
},
|
||||
],
|
||||
'addCouponPoolInfo.seq': [
|
||||
{
|
||||
'addCouponPoolInfo.seq': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "排序不能为空"
|
||||
@ -120,14 +113,13 @@
|
||||
|
||||
});
|
||||
},
|
||||
saveCouponPoolInfo: function () {
|
||||
saveCouponPoolInfo: function() {
|
||||
if (!vc.component.addCouponPoolValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
vc.component.addCouponPoolInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
//不提交数据将数据 回调给侦听处理
|
||||
if (vc.notNull($props.callBackListener)) {
|
||||
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addCouponPoolInfo);
|
||||
@ -137,11 +129,10 @@
|
||||
|
||||
vc.http.apiPost(
|
||||
'couponPool.saveCouponPool',
|
||||
JSON.stringify(vc.component.addCouponPoolInfo),
|
||||
{
|
||||
JSON.stringify(vc.component.addCouponPoolInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
@ -155,14 +146,14 @@
|
||||
vc.message(_json.msg);
|
||||
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
|
||||
vc.message(errInfo);
|
||||
|
||||
});
|
||||
},
|
||||
clearAddCouponPoolInfo: function () {
|
||||
clearAddCouponPoolInfo: function() {
|
||||
vc.component.addCouponPoolInfo = {
|
||||
couponType: '',
|
||||
couponName: '',
|
||||
@ -176,4 +167,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc);
|
||||
})(window.vc);
|
||||
@ -1,4 +1,4 @@
|
||||
(function (vc, vm) {
|
||||
(function(vc, vm) {
|
||||
|
||||
vc.extends({
|
||||
data: {
|
||||
@ -6,11 +6,11 @@
|
||||
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('deleteCouponPool', 'openDeleteCouponPoolModal', function (_params) {
|
||||
_initEvent: function() {
|
||||
vc.on('deleteCouponPool', 'openDeleteCouponPoolModal', function(_params) {
|
||||
|
||||
vc.component.deleteCouponPoolInfo = _params;
|
||||
$('#deleteCouponPoolModel').modal('show');
|
||||
@ -18,15 +18,13 @@
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
deleteCouponPool: function () {
|
||||
vc.component.deleteCouponPoolInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
deleteCouponPool: function() {
|
||||
vc.http.apiPost(
|
||||
'couponPool.deleteCouponPool',
|
||||
JSON.stringify(vc.component.deleteCouponPoolInfo),
|
||||
{
|
||||
JSON.stringify(vc.component.deleteCouponPoolInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
@ -37,16 +35,16 @@
|
||||
}
|
||||
vc.message(_json.msg);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.message(json);
|
||||
|
||||
});
|
||||
},
|
||||
closeDeleteCouponPoolModel: function () {
|
||||
closeDeleteCouponPoolModel: function() {
|
||||
$('#deleteCouponPoolModel').modal('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc, window.vc.component);
|
||||
})(window.vc, window.vc.component);
|
||||
@ -1,4 +1,4 @@
|
||||
(function (vc, vm) {
|
||||
(function(vc, vm) {
|
||||
|
||||
vc.extends({
|
||||
data: {
|
||||
@ -15,24 +15,22 @@
|
||||
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('editCouponPool', 'openEditCouponPoolModal', function (_params) {
|
||||
_initEvent: function() {
|
||||
vc.on('editCouponPool', 'openEditCouponPoolModal', function(_params) {
|
||||
vc.component.refreshEditCouponPoolInfo();
|
||||
$('#editCouponPoolModel').modal('show');
|
||||
vc.copyObject(_params, vc.component.editCouponPoolInfo);
|
||||
vc.component.editCouponPoolInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
editCouponPoolValidate: function () {
|
||||
editCouponPoolValidate: function() {
|
||||
return vc.validate.validate({
|
||||
editCouponPoolInfo: vc.component.editCouponPoolInfo
|
||||
}, {
|
||||
'editCouponPoolInfo.poolId': [
|
||||
{
|
||||
'editCouponPoolInfo.poolId': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "池ID不能为空"
|
||||
@ -43,8 +41,7 @@
|
||||
errInfo: "池ID不能超过30"
|
||||
},
|
||||
],
|
||||
'editCouponPoolInfo.couponType': [
|
||||
{
|
||||
'editCouponPoolInfo.couponType': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "优惠券类型不能为空"
|
||||
@ -55,8 +52,7 @@
|
||||
errInfo: "优惠券类型不能超过12"
|
||||
},
|
||||
],
|
||||
'editCouponPoolInfo.couponName': [
|
||||
{
|
||||
'editCouponPoolInfo.couponName': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "优惠券名称不能为空"
|
||||
@ -67,8 +63,7 @@
|
||||
errInfo: "优惠券名称不能超过64"
|
||||
},
|
||||
],
|
||||
'editCouponPoolInfo.actualPrice': [
|
||||
{
|
||||
'editCouponPoolInfo.actualPrice': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "面值不能为空"
|
||||
@ -79,8 +74,7 @@
|
||||
errInfo: "面值不能超过10"
|
||||
},
|
||||
],
|
||||
'editCouponPoolInfo.buyPrice': [
|
||||
{
|
||||
'editCouponPoolInfo.buyPrice': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "购买价格不能为空"
|
||||
@ -91,8 +85,7 @@
|
||||
errInfo: "购买价格不能超过10"
|
||||
},
|
||||
],
|
||||
'editCouponPoolInfo.couponStock': [
|
||||
{
|
||||
'editCouponPoolInfo.couponStock': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "数量不能为空"
|
||||
@ -103,8 +96,7 @@
|
||||
errInfo: "数量不能超过20"
|
||||
},
|
||||
],
|
||||
'editCouponPoolInfo.validityDay': [
|
||||
{
|
||||
'editCouponPoolInfo.validityDay': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "有效期不能为空"
|
||||
@ -115,8 +107,7 @@
|
||||
errInfo: "有效期不能超过20"
|
||||
},
|
||||
],
|
||||
'editCouponPoolInfo.seq': [
|
||||
{
|
||||
'editCouponPoolInfo.seq': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "排序不能为空"
|
||||
@ -130,7 +121,7 @@
|
||||
|
||||
});
|
||||
},
|
||||
editCouponPool: function () {
|
||||
editCouponPool: function() {
|
||||
if (!vc.component.editCouponPoolValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
return;
|
||||
@ -138,11 +129,10 @@
|
||||
|
||||
vc.http.apiPost(
|
||||
'couponPool.updateCouponPool',
|
||||
JSON.stringify(vc.component.editCouponPoolInfo),
|
||||
{
|
||||
JSON.stringify(vc.component.editCouponPoolInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
@ -153,13 +143,13 @@
|
||||
}
|
||||
vc.message(_json.msg);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
|
||||
vc.message(errInfo);
|
||||
});
|
||||
},
|
||||
refreshEditCouponPoolInfo: function () {
|
||||
refreshEditCouponPoolInfo: function() {
|
||||
vc.component.editCouponPoolInfo = {
|
||||
poolId: '',
|
||||
couponType: '',
|
||||
@ -176,4 +166,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc, window.vc.component);
|
||||
})(window.vc, window.vc.component);
|
||||
Loading…
Reference in New Issue
Block a user