Commit 6cb6ed0a77f381b6f20f6d39fa7b22aa2f6284c0
1 parent
a1a3f464
商品普通购买的时候,要防止重复点击
Showing
2 changed files
with
72 additions
and
19 deletions
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
| @@ -4687,6 +4687,11 @@ Page({ | @@ -4687,6 +4687,11 @@ Page({ | ||
| 4687 | s.my_warnning("还未登录!", 0, this); | 4687 | s.my_warnning("还未登录!", 0, this); |
| 4688 | return; | 4688 | return; |
| 4689 | } | 4689 | } |
| 4690 | + | ||
| 4691 | + wx.showLoading({ | ||
| 4692 | + mask:true | ||
| 4693 | + }); | ||
| 4694 | + | ||
| 4690 | var e = this, | 4695 | var e = this, |
| 4691 | th = e, | 4696 | th = e, |
| 4692 | o = this.data.sele_g; | 4697 | o = this.data.sele_g; |
| @@ -4698,6 +4703,7 @@ Page({ | @@ -4698,6 +4703,7 @@ Page({ | ||
| 4698 | //---判断商品是否超出限购--- | 4703 | //---判断商品是否超出限购--- |
| 4699 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | 4704 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
| 4700 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { | 4705 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
| 4706 | + wx.hideLoading(); | ||
| 4701 | wx.showModal({ | 4707 | wx.showModal({ |
| 4702 | title: '提示', | 4708 | title: '提示', |
| 4703 | content: '超出商品限购' | 4709 | content: '超出商品限购' |
| @@ -4718,7 +4724,9 @@ Page({ | @@ -4718,7 +4724,9 @@ Page({ | ||
| 4718 | sto_sele_name: "" | 4724 | sto_sele_name: "" |
| 4719 | }); | 4725 | }); |
| 4720 | 4726 | ||
| 4721 | - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 4727 | + if (th.data.sto_sele_name == ""){ |
| 4728 | + wx.hideLoading();return s.my_warnning("请选择门店", 0, th); | ||
| 4729 | + } | ||
| 4722 | 4730 | ||
| 4723 | //--------------此时操作的数据------------ | 4731 | //--------------此时操作的数据------------ |
| 4724 | var newd = { | 4732 | var newd = { |
| @@ -4789,8 +4797,8 @@ Page({ | @@ -4789,8 +4797,8 @@ Page({ | ||
| 4789 | 4797 | ||
| 4790 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { | 4798 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { |
| 4791 | if (CanOutQty) { | 4799 | if (CanOutQty) { |
| 4792 | - | ||
| 4793 | if (CanOutQty < e.data.goodsInputNum) { | 4800 | if (CanOutQty < e.data.goodsInputNum) { |
| 4801 | + wx.hideLoading(); | ||
| 4794 | wx.showToast({ | 4802 | wx.showToast({ |
| 4795 | title: '库存不足!', | 4803 | title: '库存不足!', |
| 4796 | icon: 'none', | 4804 | icon: 'none', |
| @@ -4800,6 +4808,7 @@ Page({ | @@ -4800,6 +4808,7 @@ Page({ | ||
| 4800 | 4808 | ||
| 4801 | th.by_next_func(newd); | 4809 | th.by_next_func(newd); |
| 4802 | } else { | 4810 | } else { |
| 4811 | + wx.hideLoading(); | ||
| 4803 | wx.showToast({ | 4812 | wx.showToast({ |
| 4804 | title: '库存不足!', | 4813 | title: '库存不足!', |
| 4805 | icon: 'none', | 4814 | icon: 'none', |
| @@ -4810,6 +4819,7 @@ Page({ | @@ -4810,6 +4819,7 @@ Page({ | ||
| 4810 | 4819 | ||
| 4811 | } else { | 4820 | } else { |
| 4812 | if (o.store_count <= 0) { | 4821 | if (o.store_count <= 0) { |
| 4822 | + wx.hideLoading(); | ||
| 4813 | wx.showToast({ | 4823 | wx.showToast({ |
| 4814 | title: '库存已为空!', | 4824 | title: '库存已为空!', |
| 4815 | icon: 'none', | 4825 | icon: 'none', |
| @@ -4819,6 +4829,7 @@ Page({ | @@ -4819,6 +4829,7 @@ Page({ | ||
| 4819 | } | 4829 | } |
| 4820 | 4830 | ||
| 4821 | if (o.store_count < e.data.goodsInputNum) { | 4831 | if (o.store_count < e.data.goodsInputNum) { |
| 4832 | + wx.hideLoading(); | ||
| 4822 | wx.showToast({ | 4833 | wx.showToast({ |
| 4823 | title: '库存不足!', | 4834 | title: '库存不足!', |
| 4824 | icon: 'none', | 4835 | icon: 'none', |
pages/goods/goodsInfo/goodsInfo.js
| @@ -1389,7 +1389,9 @@ Page({ | @@ -1389,7 +1389,9 @@ Page({ | ||
| 1389 | return false; | 1389 | return false; |
| 1390 | } | 1390 | } |
| 1391 | 1391 | ||
| 1392 | - | 1392 | + wx.showLoading({ |
| 1393 | + mask:true | ||
| 1394 | + }) | ||
| 1393 | 1395 | ||
| 1394 | //如果是秒杀的话,要看redis够不够 | 1396 | //如果是秒杀的话,要看redis够不够 |
| 1395 | if (this.data.prom_type == 1 || this.data.prom_type == 2) { | 1397 | if (this.data.prom_type == 1 || this.data.prom_type == 2) { |
| @@ -1403,7 +1405,7 @@ Page({ | @@ -1403,7 +1405,7 @@ Page({ | ||
| 1403 | 1405 | ||
| 1404 | this.getactLen(function (num) { | 1406 | this.getactLen(function (num) { |
| 1405 | if (num < th.data.goodsInputNum) { | 1407 | if (num < th.data.goodsInputNum) { |
| 1406 | - | 1408 | + wx.hideLoading(); |
| 1407 | // getApp().my_warnning("活动库存不足!", 0, th); | 1409 | // getApp().my_warnning("活动库存不足!", 0, th); |
| 1408 | wx.showToast({ | 1410 | wx.showToast({ |
| 1409 | title: '活动库存不足!', | 1411 | title: '活动库存不足!', |
| @@ -1583,10 +1585,12 @@ Page({ | @@ -1583,10 +1585,12 @@ Page({ | ||
| 1583 | add_cart_func: function (t) { | 1585 | add_cart_func: function (t) { |
| 1584 | var i = getApp().request; | 1586 | var i = getApp().request; |
| 1585 | if (oo.user_id == null) { | 1587 | if (oo.user_id == null) { |
| 1588 | + wx.hideLoading(); | ||
| 1586 | return s.my_warnning("还未登录!", 0, this); | 1589 | return s.my_warnning("还未登录!", 0, this); |
| 1587 | } | 1590 | } |
| 1588 | 1591 | ||
| 1589 | if (!getApp().globalData.userInfo) { | 1592 | if (!getApp().globalData.userInfo) { |
| 1593 | + wx.hideLoading(); | ||
| 1590 | return s.my_warnning("还未登录!", 0, this); | 1594 | return s.my_warnning("还未登录!", 0, this); |
| 1591 | } | 1595 | } |
| 1592 | 1596 | ||
| @@ -1601,6 +1605,7 @@ Page({ | @@ -1601,6 +1605,7 @@ Page({ | ||
| 1601 | //---判断商品是否超出限购--- | 1605 | //---判断商品是否超出限购--- |
| 1602 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | 1606 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
| 1603 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { | 1607 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
| 1608 | + wx.hideLoading(); | ||
| 1604 | wx.showToast({ | 1609 | wx.showToast({ |
| 1605 | title: '超出商品限购', | 1610 | title: '超出商品限购', |
| 1606 | icon: 'none', | 1611 | icon: 'none', |
| @@ -1612,6 +1617,7 @@ Page({ | @@ -1612,6 +1617,7 @@ Page({ | ||
| 1612 | //---判断商品是否超出活动限购--- | 1617 | //---判断商品是否超出活动限购--- |
| 1613 | if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { | 1618 | if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { |
| 1614 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { | 1619 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { |
| 1620 | + wx.hideLoading(); | ||
| 1615 | wx.showToast({ | 1621 | wx.showToast({ |
| 1616 | title: '超出商品活动限购', | 1622 | title: '超出商品活动限购', |
| 1617 | icon: 'none', | 1623 | icon: 'none', |
| @@ -1621,12 +1627,16 @@ Page({ | @@ -1621,12 +1627,16 @@ Page({ | ||
| 1621 | } | 1627 | } |
| 1622 | } | 1628 | } |
| 1623 | 1629 | ||
| 1624 | - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | 1630 | + if (th.data.goodsInputNum <= 0){ |
| 1631 | + wx.hideLoading();return s.my_warnning("商品数量不能为0", 0, th); | ||
| 1632 | + } | ||
| 1625 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1633 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 1626 | th.setData({ | 1634 | th.setData({ |
| 1627 | sto_sele_name: "" | 1635 | sto_sele_name: "" |
| 1628 | }); | 1636 | }); |
| 1629 | - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 1637 | + if (th.data.sto_sele_name == ""){ |
| 1638 | + wx.hideLoading();return s.my_warnning("请选择门店", 0, th); | ||
| 1639 | + } | ||
| 1630 | 1640 | ||
| 1631 | //--------------此时操作的数据------------ | 1641 | //--------------此时操作的数据------------ |
| 1632 | var newd = { | 1642 | var newd = { |
| @@ -1703,6 +1713,7 @@ Page({ | @@ -1703,6 +1713,7 @@ Page({ | ||
| 1703 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { | 1713 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { |
| 1704 | if (CanOutQty) { | 1714 | if (CanOutQty) { |
| 1705 | if (CanOutQty < e.data.goodsInputNum) { | 1715 | if (CanOutQty < e.data.goodsInputNum) { |
| 1716 | + wx.hideLoading(); | ||
| 1706 | wx.showToast({ | 1717 | wx.showToast({ |
| 1707 | title: '库存不足!', | 1718 | title: '库存不足!', |
| 1708 | icon: 'none', | 1719 | icon: 'none', |
| @@ -1712,6 +1723,7 @@ Page({ | @@ -1712,6 +1723,7 @@ Page({ | ||
| 1712 | 1723 | ||
| 1713 | th.add_cart_next(e, t, a, o, newd, CanOutQty); | 1724 | th.add_cart_next(e, t, a, o, newd, CanOutQty); |
| 1714 | } else { | 1725 | } else { |
| 1726 | + wx.hideLoading(); | ||
| 1715 | wx.showToast({ | 1727 | wx.showToast({ |
| 1716 | title: '库存不足!', | 1728 | title: '库存不足!', |
| 1717 | icon: 'none', | 1729 | icon: 'none', |
| @@ -1723,47 +1735,48 @@ Page({ | @@ -1723,47 +1735,48 @@ Page({ | ||
| 1723 | 1735 | ||
| 1724 | } else { | 1736 | } else { |
| 1725 | if (o.store_count <= 0) { | 1737 | if (o.store_count <= 0) { |
| 1738 | + wx.hideLoading(); | ||
| 1726 | wx.showToast({ | 1739 | wx.showToast({ |
| 1727 | title: '库存已为空!', | 1740 | title: '库存已为空!', |
| 1728 | icon: 'none' | 1741 | icon: 'none' |
| 1729 | }); | 1742 | }); |
| 1730 | return false; | 1743 | return false; |
| 1731 | - }; | 1744 | + } |
| 1732 | if (o.store_count < e.data.goodsInputNum) { | 1745 | if (o.store_count < e.data.goodsInputNum) { |
| 1746 | + wx.hideLoading(); | ||
| 1733 | wx.showToast({ | 1747 | wx.showToast({ |
| 1734 | title: '库存不足!', | 1748 | title: '库存不足!', |
| 1735 | icon: 'none', | 1749 | icon: 'none', |
| 1736 | }); | 1750 | }); |
| 1737 | return false; | 1751 | return false; |
| 1738 | // return s.my_warnning("库存不足!", 0, th); | 1752 | // return s.my_warnning("库存不足!", 0, th); |
| 1739 | - }; | 1753 | + } |
| 1740 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 | 1754 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 |
| 1741 | }; | 1755 | }; |
| 1742 | - | ||
| 1743 | return false; | 1756 | return false; |
| 1744 | } | 1757 | } |
| 1745 | 1758 | ||
| 1746 | newd.goods_price = th.data.prom_price; | 1759 | newd.goods_price = th.data.prom_price; |
| 1747 | newd.member_goods_price = th.data.prom_price, | 1760 | newd.member_goods_price = th.data.prom_price, |
| 1748 | - newd.prom_type = th.data.prom_type; | 1761 | + newd.prom_type = th.data.prom_type; |
| 1749 | newd.prom_id = th.data.prom_id; | 1762 | newd.prom_id = th.data.prom_id; |
| 1750 | 1763 | ||
| 1751 | if (o.store_count <= 0) { | 1764 | if (o.store_count <= 0) { |
| 1765 | + wx.hideLoading(); | ||
| 1752 | wx.showToast({ | 1766 | wx.showToast({ |
| 1753 | title: '库存已为空!', | 1767 | title: '库存已为空!', |
| 1754 | icon: 'none', | 1768 | icon: 'none', |
| 1755 | }); | 1769 | }); |
| 1756 | return false; | 1770 | return false; |
| 1757 | - //return s.my_warnning("库存已为空!", 0, th); | ||
| 1758 | - }; | 1771 | + } |
| 1759 | if (o.store_count < e.data.goodsInputNum) { | 1772 | if (o.store_count < e.data.goodsInputNum) { |
| 1773 | + wx.hideLoading(); | ||
| 1760 | wx.showToast({ | 1774 | wx.showToast({ |
| 1761 | title: '库存不足!', | 1775 | title: '库存不足!', |
| 1762 | icon: 'none', | 1776 | icon: 'none', |
| 1763 | }); | 1777 | }); |
| 1764 | return false; | 1778 | return false; |
| 1765 | - }; | ||
| 1766 | - | 1779 | + } |
| 1767 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 | 1780 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 |
| 1768 | 1781 | ||
| 1769 | } else if (o.prom_type == 7) { | 1782 | } else if (o.prom_type == 7) { |
| @@ -1776,6 +1789,7 @@ Page({ | @@ -1776,6 +1789,7 @@ Page({ | ||
| 1776 | newd.prom_id = th.data.sele_g.act.id; | 1789 | newd.prom_id = th.data.sele_g.act.id; |
| 1777 | newd.prom_type = 7; | 1790 | newd.prom_type = 7; |
| 1778 | if (o.store_count <= 0) { | 1791 | if (o.store_count <= 0) { |
| 1792 | + wx.hideLoading(); | ||
| 1779 | wx.showToast({ | 1793 | wx.showToast({ |
| 1780 | title: '库存已为空!', | 1794 | title: '库存已为空!', |
| 1781 | icon: 'none', | 1795 | icon: 'none', |
| @@ -1783,6 +1797,7 @@ Page({ | @@ -1783,6 +1797,7 @@ Page({ | ||
| 1783 | return false; | 1797 | return false; |
| 1784 | }; | 1798 | }; |
| 1785 | if (o.store_count < e.data.goodsInputNum) { | 1799 | if (o.store_count < e.data.goodsInputNum) { |
| 1800 | + wx.hideLoading(); | ||
| 1786 | wx.showToast({ | 1801 | wx.showToast({ |
| 1787 | title: '库存不足!', | 1802 | title: '库存不足!', |
| 1788 | icon: 'none', | 1803 | icon: 'none', |
| @@ -1801,6 +1816,7 @@ Page({ | @@ -1801,6 +1816,7 @@ Page({ | ||
| 1801 | if (CanOutQty) { | 1816 | if (CanOutQty) { |
| 1802 | 1817 | ||
| 1803 | if (CanOutQty < e.data.goodsInputNum) { | 1818 | if (CanOutQty < e.data.goodsInputNum) { |
| 1819 | + wx.hideLoading(); | ||
| 1804 | wx.showToast({ | 1820 | wx.showToast({ |
| 1805 | title: '库存不足!', | 1821 | title: '库存不足!', |
| 1806 | icon: 'none', | 1822 | icon: 'none', |
| @@ -1810,6 +1826,7 @@ Page({ | @@ -1810,6 +1826,7 @@ Page({ | ||
| 1810 | 1826 | ||
| 1811 | th.add_cart_next(e, t, a, o, newd, CanOutQty); | 1827 | th.add_cart_next(e, t, a, o, newd, CanOutQty); |
| 1812 | } else { | 1828 | } else { |
| 1829 | + wx.hideLoading(); | ||
| 1813 | wx.showToast({ | 1830 | wx.showToast({ |
| 1814 | title: '库存不足!', | 1831 | title: '库存不足!', |
| 1815 | icon: 'none', | 1832 | icon: 'none', |
| @@ -1820,6 +1837,7 @@ Page({ | @@ -1820,6 +1837,7 @@ Page({ | ||
| 1820 | 1837 | ||
| 1821 | } else { | 1838 | } else { |
| 1822 | if (o.store_count <= 0) { | 1839 | if (o.store_count <= 0) { |
| 1840 | + wx.hideLoading(); | ||
| 1823 | wx.showToast({ | 1841 | wx.showToast({ |
| 1824 | title: '库存已为空!', | 1842 | title: '库存已为空!', |
| 1825 | icon: 'none', | 1843 | icon: 'none', |
| @@ -1828,6 +1846,7 @@ Page({ | @@ -1828,6 +1846,7 @@ Page({ | ||
| 1828 | //return s.my_warnning("库存已为空!", 0, th); | 1846 | //return s.my_warnning("库存已为空!", 0, th); |
| 1829 | }; | 1847 | }; |
| 1830 | if (o.store_count < e.data.goodsInputNum) { | 1848 | if (o.store_count < e.data.goodsInputNum) { |
| 1849 | + wx.hideLoading(); | ||
| 1831 | wx.showToast({ | 1850 | wx.showToast({ |
| 1832 | title: '库存不足!', | 1851 | title: '库存不足!', |
| 1833 | icon: 'none', | 1852 | icon: 'none', |
| @@ -1854,6 +1873,7 @@ Page({ | @@ -1854,6 +1873,7 @@ Page({ | ||
| 1854 | if (CanOutQty) { | 1873 | if (CanOutQty) { |
| 1855 | 1874 | ||
| 1856 | if (CanOutQty < e.data.goodsInputNum) { | 1875 | if (CanOutQty < e.data.goodsInputNum) { |
| 1876 | + wx.hideLoading(); | ||
| 1857 | wx.showToast({ | 1877 | wx.showToast({ |
| 1858 | title: '库存不足!', | 1878 | title: '库存不足!', |
| 1859 | icon: 'none', | 1879 | icon: 'none', |
| @@ -1863,6 +1883,7 @@ Page({ | @@ -1863,6 +1883,7 @@ Page({ | ||
| 1863 | 1883 | ||
| 1864 | th.add_cart_next(e, t, a, o, newd, CanOutQty); | 1884 | th.add_cart_next(e, t, a, o, newd, CanOutQty); |
| 1865 | } else { | 1885 | } else { |
| 1886 | + wx.hideLoading(); | ||
| 1866 | wx.showToast({ | 1887 | wx.showToast({ |
| 1867 | title: '库存不足!', | 1888 | title: '库存不足!', |
| 1868 | icon: 'none', | 1889 | icon: 'none', |
| @@ -1873,6 +1894,7 @@ Page({ | @@ -1873,6 +1894,7 @@ Page({ | ||
| 1873 | 1894 | ||
| 1874 | } else { | 1895 | } else { |
| 1875 | if (o.store_count <= 0) { | 1896 | if (o.store_count <= 0) { |
| 1897 | + wx.hideLoading(); | ||
| 1876 | wx.showToast({ | 1898 | wx.showToast({ |
| 1877 | title: '库存已为空!', | 1899 | title: '库存已为空!', |
| 1878 | icon: 'none', | 1900 | icon: 'none', |
| @@ -1881,13 +1903,14 @@ Page({ | @@ -1881,13 +1903,14 @@ Page({ | ||
| 1881 | //return s.my_warnning("库存已为空!", 0, th); | 1903 | //return s.my_warnning("库存已为空!", 0, th); |
| 1882 | }; | 1904 | }; |
| 1883 | if (o.store_count < e.data.goodsInputNum) { | 1905 | if (o.store_count < e.data.goodsInputNum) { |
| 1906 | + wx.hideLoading(); | ||
| 1884 | wx.showToast({ | 1907 | wx.showToast({ |
| 1885 | title: '库存不足!', | 1908 | title: '库存不足!', |
| 1886 | icon: 'none', | 1909 | icon: 'none', |
| 1887 | }); | 1910 | }); |
| 1888 | return false; | 1911 | return false; |
| 1889 | //return s.my_warnning("库存不足!", 0, th); | 1912 | //return s.my_warnning("库存不足!", 0, th); |
| 1890 | - }; | 1913 | + } |
| 1891 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 | 1914 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 |
| 1892 | } | 1915 | } |
| 1893 | } | 1916 | } |
| @@ -1899,6 +1922,8 @@ Page({ | @@ -1899,6 +1922,8 @@ Page({ | ||
| 1899 | 1922 | ||
| 1900 | //---加入购物车的最后一步--- | 1923 | //---加入购物车的最后一步--- |
| 1901 | add_cart_next(e, t, a, o, newd, CanOutQty) { | 1924 | add_cart_next(e, t, a, o, newd, CanOutQty) { |
| 1925 | + | ||
| 1926 | + | ||
| 1902 | if (getApp().globalData.groupchat_id) { | 1927 | if (getApp().globalData.groupchat_id) { |
| 1903 | newd.groupchat_id = getApp().globalData.groupchat_id | 1928 | newd.groupchat_id = getApp().globalData.groupchat_id |
| 1904 | } | 1929 | } |
| @@ -1988,6 +2013,7 @@ Page({ | @@ -1988,6 +2013,7 @@ Page({ | ||
| 1988 | //判断数量,要看下购物车中有没有该商品 | 2013 | //判断数量,要看下购物车中有没有该商品 |
| 1989 | if (CanOutQty) { | 2014 | if (CanOutQty) { |
| 1990 | if (item.goods_num + th.data.goodsInputNum > CanOutQty) { | 2015 | if (item.goods_num + th.data.goodsInputNum > CanOutQty) { |
| 2016 | + wx.hideLoading(); | ||
| 1991 | wx.showToast({ | 2017 | wx.showToast({ |
| 1992 | title: '库存不足!', | 2018 | title: '库存不足!', |
| 1993 | icon: 'none', | 2019 | icon: 'none', |
| @@ -1997,6 +2023,7 @@ Page({ | @@ -1997,6 +2023,7 @@ Page({ | ||
| 1997 | } | 2023 | } |
| 1998 | } else { | 2024 | } else { |
| 1999 | if (item.goods_num + th.data.goodsInputNum > o.store_count) { | 2025 | if (item.goods_num + th.data.goodsInputNum > o.store_count) { |
| 2026 | + wx.hideLoading(); | ||
| 2000 | wx.showToast({ | 2027 | wx.showToast({ |
| 2001 | title: '库存不足!', | 2028 | title: '库存不足!', |
| 2002 | icon: 'none', | 2029 | icon: 'none', |
| @@ -2007,6 +2034,7 @@ Page({ | @@ -2007,6 +2034,7 @@ Page({ | ||
| 2007 | 2034 | ||
| 2008 | //秒杀有限购的时候,同时不是普通购买 | 2035 | //秒杀有限购的时候,同时不是普通购买 |
| 2009 | if ( item.goods_num + th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit && th.data.prom_buy_limit>0 && !newd.is_pd_normal && (th.data.prom_type == 1 || th.data.prom_type == 2)) { | 2036 | if ( item.goods_num + th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit && th.data.prom_buy_limit>0 && !newd.is_pd_normal && (th.data.prom_type == 1 || th.data.prom_type == 2)) { |
| 2037 | + wx.hideLoading(); | ||
| 2010 | wx.showToast({ | 2038 | wx.showToast({ |
| 2011 | title: '此商品已在购物车,去购物车结算!', | 2039 | title: '此商品已在购物车,去购物车结算!', |
| 2012 | icon: 'none', | 2040 | icon: 'none', |
| @@ -2047,6 +2075,7 @@ Page({ | @@ -2047,6 +2075,7 @@ Page({ | ||
| 2047 | getApp().request.put("/api/weshop/cart/update", { | 2075 | getApp().request.put("/api/weshop/cart/update", { |
| 2048 | data: updata, | 2076 | data: updata, |
| 2049 | success: function (t) { | 2077 | success: function (t) { |
| 2078 | + wx.hideLoading(); | ||
| 2050 | getApp().my_warnning('加入购物车成功', 1, th, 450); | 2079 | getApp().my_warnning('加入购物车成功', 1, th, 450); |
| 2051 | var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; | 2080 | var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; |
| 2052 | th.setData({ | 2081 | th.setData({ |
| @@ -2059,6 +2088,7 @@ Page({ | @@ -2059,6 +2088,7 @@ Page({ | ||
| 2059 | getApp().request.post("/api/weshop/cart/save", { | 2088 | getApp().request.post("/api/weshop/cart/save", { |
| 2060 | data: newd, | 2089 | data: newd, |
| 2061 | success: function (t) { | 2090 | success: function (t) { |
| 2091 | + wx.hideLoading(); | ||
| 2062 | getApp().my_warnning('加入购物车成功', 1, th, 450); | 2092 | getApp().my_warnning('加入购物车成功', 1, th, 450); |
| 2063 | var c_num = th.data.cartGoodsNum + e.data.goodsInputNum; | 2093 | var c_num = th.data.cartGoodsNum + e.data.goodsInputNum; |
| 2064 | th.setData({ | 2094 | th.setData({ |
| @@ -5241,12 +5271,18 @@ Page({ | @@ -5241,12 +5271,18 @@ Page({ | ||
| 5241 | o = this.data.sele_g; | 5271 | o = this.data.sele_g; |
| 5242 | 5272 | ||
| 5243 | 5273 | ||
| 5274 | + wx.showLoading({ | ||
| 5275 | + mask:true | ||
| 5276 | + }) | ||
| 5277 | + | ||
| 5244 | //----------添加到购物车时,要判断限购数量,-------- | 5278 | //----------添加到购物车时,要判断限购数量,-------- |
| 5245 | e.get_buy_num(o, async function (ee) { | 5279 | e.get_buy_num(o, async function (ee) { |
| 5246 | 5280 | ||
| 5247 | //---判断商品是否超出限购--- | 5281 | //---判断商品是否超出限购--- |
| 5248 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | 5282 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
| 5249 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { | 5283 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
| 5284 | + | ||
| 5285 | + wx.hideLoading(); | ||
| 5250 | wx.showToast({ | 5286 | wx.showToast({ |
| 5251 | title: '超出商品限购', | 5287 | title: '超出商品限购', |
| 5252 | icon: 'none', | 5288 | icon: 'none', |
| @@ -5264,6 +5300,7 @@ Page({ | @@ -5264,6 +5300,7 @@ Page({ | ||
| 5264 | //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- | 5300 | //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- |
| 5265 | if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { | 5301 | if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { |
| 5266 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { | 5302 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { |
| 5303 | + wx.hideLoading(); | ||
| 5267 | wx.showToast({ | 5304 | wx.showToast({ |
| 5268 | title: '超出商品活动限购', | 5305 | title: '超出商品活动限购', |
| 5269 | icon: 'none', | 5306 | icon: 'none', |
| @@ -5283,6 +5320,7 @@ Page({ | @@ -5283,6 +5320,7 @@ Page({ | ||
| 5283 | if (th.data.is_normal != 1) { | 5320 | if (th.data.is_normal != 1) { |
| 5284 | 5321 | ||
| 5285 | if (o.store_count <= 0) { | 5322 | if (o.store_count <= 0) { |
| 5323 | + wx.hideLoading(); | ||
| 5286 | wx.showToast({ | 5324 | wx.showToast({ |
| 5287 | title: '库存已为空!', | 5325 | title: '库存已为空!', |
| 5288 | icon: 'none', | 5326 | icon: 'none', |
| @@ -5298,6 +5336,7 @@ Page({ | @@ -5298,6 +5336,7 @@ Page({ | ||
| 5298 | }) | 5336 | }) |
| 5299 | 5337 | ||
| 5300 | if (th.data.goodsInputNum > redis_num) { | 5338 | if (th.data.goodsInputNum > redis_num) { |
| 5339 | + wx.hideLoading(); | ||
| 5301 | wx.showToast({ | 5340 | wx.showToast({ |
| 5302 | title: '超出商品活动库存', | 5341 | title: '超出商品活动库存', |
| 5303 | icon: 'none', | 5342 | icon: 'none', |
| @@ -5311,6 +5350,7 @@ Page({ | @@ -5311,6 +5350,7 @@ Page({ | ||
| 5311 | } | 5350 | } |
| 5312 | } else { | 5351 | } else { |
| 5313 | if (o.store_count <= 0) { | 5352 | if (o.store_count <= 0) { |
| 5353 | + wx.hideLoading(); | ||
| 5314 | wx.showToast({ | 5354 | wx.showToast({ |
| 5315 | title: '库存已为空!', | 5355 | title: '库存已为空!', |
| 5316 | icon: 'none', | 5356 | icon: 'none', |
| @@ -5321,6 +5361,7 @@ Page({ | @@ -5321,6 +5361,7 @@ Page({ | ||
| 5321 | } | 5361 | } |
| 5322 | 5362 | ||
| 5323 | if (th.data.goodsInputNum <= 0) { | 5363 | if (th.data.goodsInputNum <= 0) { |
| 5364 | + wx.hideLoading(); | ||
| 5324 | wx.showToast({ | 5365 | wx.showToast({ |
| 5325 | title: '商品数量不能为0', | 5366 | title: '商品数量不能为0', |
| 5326 | icon: 'none', | 5367 | icon: 'none', |
| @@ -5330,9 +5371,7 @@ Page({ | @@ -5330,9 +5371,7 @@ Page({ | ||
| 5330 | }; | 5371 | }; |
| 5331 | if (th.data.goodsInputNum > o.store_count) { | 5372 | if (th.data.goodsInputNum > o.store_count) { |
| 5332 | 5373 | ||
| 5333 | - // th.setData({ | ||
| 5334 | - // goodsInputNum: o.store_count | ||
| 5335 | - // }) | 5374 | + wx.hideLoading(); |
| 5336 | wx.showToast({ | 5375 | wx.showToast({ |
| 5337 | title: '超出商品库存', | 5376 | title: '超出商品库存', |
| 5338 | icon: 'none', | 5377 | icon: 'none', |
| @@ -5345,7 +5384,10 @@ Page({ | @@ -5345,7 +5384,10 @@ Page({ | ||
| 5345 | th.setData({ | 5384 | th.setData({ |
| 5346 | sto_sele_name: "" | 5385 | sto_sele_name: "" |
| 5347 | }); | 5386 | }); |
| 5348 | - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 5387 | + if (th.data.sto_sele_name == ""){ |
| 5388 | + wx.hideLoading(); | ||
| 5389 | + return s.my_warnning("请选择门店", 0, th); | ||
| 5390 | + } | ||
| 5349 | //--------------此时操作的数据------------ | 5391 | //--------------此时操作的数据------------ |
| 5350 | var newd = { | 5392 | var newd = { |
| 5351 | goods_id: o.goods_id, | 5393 | goods_id: o.goods_id, |