Showing
1 changed file
with
15 additions
and
17 deletions
@@ -696,10 +696,10 @@ export default { | @@ -696,10 +696,10 @@ export default { | ||
696 | this.$refs['product'].validate((valid) => { | 696 | this.$refs['product'].validate((valid) => { |
697 | if (valid) { | 697 | if (valid) { |
698 | this.table.showValidateOtherProps = false; | 698 | this.table.showValidateOtherProps = false; |
699 | - resolve(); | 699 | + resolve(true); |
700 | } else { | 700 | } else { |
701 | this.table.showValidateOtherProps = true; | 701 | this.table.showValidateOtherProps = true; |
702 | - reject(); | 702 | + resolve(false); |
703 | } | 703 | } |
704 | }) | 704 | }) |
705 | }).catch(() => {}); | 705 | }).catch(() => {}); |
@@ -737,10 +737,10 @@ export default { | @@ -737,10 +737,10 @@ export default { | ||
737 | 737 | ||
738 | if (errors.length !== 0) { | 738 | if (errors.length !== 0) { |
739 | _this.table.showValidateTable = false; | 739 | _this.table.showValidateTable = false; |
740 | - return resolve(); | 740 | + return resolve(false); |
741 | } else { | 741 | } else { |
742 | _this.table.showValidateTable = true; | 742 | _this.table.showValidateTable = true; |
743 | - return reject(errors); | 743 | + return reject(true); |
744 | } | 744 | } |
745 | 745 | ||
746 | }).catch((err) => { | 746 | }).catch((err) => { |
@@ -752,11 +752,11 @@ export default { | @@ -752,11 +752,11 @@ export default { | ||
752 | return new Promise((resolve, reject) => { | 752 | return new Promise((resolve, reject) => { |
753 | if (_this.table.selectedColors.length === 0) { | 753 | if (_this.table.selectedColors.length === 0) { |
754 | this.table.showValidateColor = true; | 754 | this.table.showValidateColor = true; |
755 | - return reject({message: '颜色不能为空'}) | 755 | + return resolve(false); |
756 | } | 756 | } |
757 | 757 | ||
758 | this.table.showValidateColor = false; | 758 | this.table.showValidateColor = false; |
759 | - return resolve(); | 759 | + return resolve(true); |
760 | }).catch((err) => { | 760 | }).catch((err) => { |
761 | }); | 761 | }); |
762 | 762 | ||
@@ -765,24 +765,22 @@ export default { | @@ -765,24 +765,22 @@ export default { | ||
765 | return new Promise((resolve, reject) => { | 765 | return new Promise((resolve, reject) => { |
766 | if (this.table.selectedSizes.length === 0) { | 766 | if (this.table.selectedSizes.length === 0) { |
767 | this.table.showValidateSize = true; | 767 | this.table.showValidateSize = true; |
768 | - return reject({message: '尺码不能为空'}); | 768 | + return reject(false); |
769 | } | 769 | } |
770 | 770 | ||
771 | this.table.showValidateSize = false; | 771 | this.table.showValidateSize = false; |
772 | - return resolve(); | 772 | + return resolve(true); |
773 | }).catch(() => { | 773 | }).catch(() => { |
774 | }); | 774 | }); |
775 | }, | 775 | }, |
776 | validate: function() { | 776 | validate: function() { |
777 | - return this.validateOtherProps() | ||
778 | - .then(this.validateColor) | ||
779 | - .then(this.validateSize) | ||
780 | - .then(this.validateTable) | ||
781 | - .then(() => { | ||
782 | - if (!this.showValidateColor | ||
783 | - && !this.showValidateSize | ||
784 | - && !this.showValidateOtherProp | ||
785 | - && !this.showValidateTable) { | 777 | + return Promise.all([ |
778 | + this.validateOtherProps(), | ||
779 | + this.validateColor(), | ||
780 | + this.validateSize(), | ||
781 | + this.validateTable() | ||
782 | + ]).then((valid) => { | ||
783 | + if (valid[0] && valid[1] && valid[2] && valid[3] && valid[4]) { | ||
786 | return Promise.resolve(); | 784 | return Promise.resolve(); |
787 | } else { | 785 | } else { |
788 | return Promise.reject(); | 786 | return Promise.reject(); |
-
Please register or login to post a comment