Commit f81edf77d1c0413804d13539b9907c869148077f
1 parent
6cb6ed0a
避免重复点击的优化
Showing
2 changed files
with
66 additions
and
4 deletions
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -287,6 +287,8 @@ Page({ | @@ -287,6 +287,8 @@ Page({ | ||
287 | is_get_guide:0, | 287 | is_get_guide:0, |
288 | keyword:'', //门店搜索 | 288 | keyword:'', //门店搜索 |
289 | sec_i:-1,//选中分类门店 下标 | 289 | sec_i:-1,//选中分类门店 下标 |
290 | + | ||
291 | + adding:0 //避免重复点击 | ||
290 | }, | 292 | }, |
291 | 293 | ||
292 | //------初始化加载---------- | 294 | //------初始化加载---------- |
@@ -896,6 +898,9 @@ Page({ | @@ -896,6 +898,9 @@ Page({ | ||
896 | //---展示--- | 898 | //---展示--- |
897 | onShow: async function () { | 899 | onShow: async function () { |
898 | 900 | ||
901 | + //添加购物车的控制要清理0 | ||
902 | + this.data.adding=0; | ||
903 | + | ||
899 | getApp().check_can_share(this); | 904 | getApp().check_can_share(this); |
900 | // console.log('onshow'); | 905 | // console.log('onshow'); |
901 | var goods_list = null, th = this, that = this; | 906 | var goods_list = null, th = this, that = this; |
@@ -1435,7 +1440,6 @@ Page({ | @@ -1435,7 +1440,6 @@ Page({ | ||
1435 | open_ind_store: ind | 1440 | open_ind_store: ind |
1436 | }); | 1441 | }); |
1437 | 1442 | ||
1438 | - | ||
1439 | th.add_cart_func(t); | 1443 | th.add_cart_func(t); |
1440 | }, | 1444 | }, |
1441 | 1445 | ||
@@ -4688,6 +4692,9 @@ Page({ | @@ -4688,6 +4692,9 @@ Page({ | ||
4688 | return; | 4692 | return; |
4689 | } | 4693 | } |
4690 | 4694 | ||
4695 | + if(this.data.adding) return false; | ||
4696 | + this.data.adding=1; | ||
4697 | + | ||
4691 | wx.showLoading({ | 4698 | wx.showLoading({ |
4692 | mask:true | 4699 | mask:true |
4693 | }); | 4700 | }); |
@@ -4704,6 +4711,7 @@ Page({ | @@ -4704,6 +4711,7 @@ Page({ | ||
4704 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | 4711 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
4705 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { | 4712 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
4706 | wx.hideLoading(); | 4713 | wx.hideLoading(); |
4714 | + th.data.adding=0; | ||
4707 | wx.showModal({ | 4715 | wx.showModal({ |
4708 | title: '提示', | 4716 | title: '提示', |
4709 | content: '超出商品限购' | 4717 | content: '超出商品限购' |
@@ -4725,7 +4733,9 @@ Page({ | @@ -4725,7 +4733,9 @@ Page({ | ||
4725 | }); | 4733 | }); |
4726 | 4734 | ||
4727 | if (th.data.sto_sele_name == ""){ | 4735 | if (th.data.sto_sele_name == ""){ |
4728 | - wx.hideLoading();return s.my_warnning("请选择门店", 0, th); | 4736 | + wx.hideLoading(); |
4737 | + th.data.adding=0; | ||
4738 | + return s.my_warnning("请选择门店", 0, th); | ||
4729 | } | 4739 | } |
4730 | 4740 | ||
4731 | //--------------此时操作的数据------------ | 4741 | //--------------此时操作的数据------------ |
@@ -4799,6 +4809,7 @@ Page({ | @@ -4799,6 +4809,7 @@ Page({ | ||
4799 | if (CanOutQty) { | 4809 | if (CanOutQty) { |
4800 | if (CanOutQty < e.data.goodsInputNum) { | 4810 | if (CanOutQty < e.data.goodsInputNum) { |
4801 | wx.hideLoading(); | 4811 | wx.hideLoading(); |
4812 | + th.data.adding=0; | ||
4802 | wx.showToast({ | 4813 | wx.showToast({ |
4803 | title: '库存不足!', | 4814 | title: '库存不足!', |
4804 | icon: 'none', | 4815 | icon: 'none', |
@@ -4809,6 +4820,7 @@ Page({ | @@ -4809,6 +4820,7 @@ Page({ | ||
4809 | th.by_next_func(newd); | 4820 | th.by_next_func(newd); |
4810 | } else { | 4821 | } else { |
4811 | wx.hideLoading(); | 4822 | wx.hideLoading(); |
4823 | + th.data.adding=0; | ||
4812 | wx.showToast({ | 4824 | wx.showToast({ |
4813 | title: '库存不足!', | 4825 | title: '库存不足!', |
4814 | icon: 'none', | 4826 | icon: 'none', |
@@ -4820,6 +4832,7 @@ Page({ | @@ -4820,6 +4832,7 @@ Page({ | ||
4820 | } else { | 4832 | } else { |
4821 | if (o.store_count <= 0) { | 4833 | if (o.store_count <= 0) { |
4822 | wx.hideLoading(); | 4834 | wx.hideLoading(); |
4835 | + th.data.adding=0; | ||
4823 | wx.showToast({ | 4836 | wx.showToast({ |
4824 | title: '库存已为空!', | 4837 | title: '库存已为空!', |
4825 | icon: 'none', | 4838 | icon: 'none', |
@@ -4830,6 +4843,7 @@ Page({ | @@ -4830,6 +4843,7 @@ Page({ | ||
4830 | 4843 | ||
4831 | if (o.store_count < e.data.goodsInputNum) { | 4844 | if (o.store_count < e.data.goodsInputNum) { |
4832 | wx.hideLoading(); | 4845 | wx.hideLoading(); |
4846 | + th.data.adding=0; | ||
4833 | wx.showToast({ | 4847 | wx.showToast({ |
4834 | title: '库存不足!', | 4848 | title: '库存不足!', |
4835 | icon: 'none', | 4849 | icon: 'none', |
pages/goods/goodsInfo/goodsInfo.js
@@ -274,6 +274,8 @@ Page({ | @@ -274,6 +274,8 @@ Page({ | ||
274 | showFold:true, | 274 | showFold:true, |
275 | new_share_imgurl:'', //普通商品分享图片 | 275 | new_share_imgurl:'', //普通商品分享图片 |
276 | 276 | ||
277 | + adding:0 //加入购物车的避免重复 | ||
278 | + | ||
277 | }, | 279 | }, |
278 | 280 | ||
279 | //------初始化加载---------- | 281 | //------初始化加载---------- |
@@ -919,6 +921,8 @@ Page({ | @@ -919,6 +921,8 @@ Page({ | ||
919 | 921 | ||
920 | //---展示--- | 922 | //---展示--- |
921 | onShow: function () { | 923 | onShow: function () { |
924 | + //添加购物车的控制要清理0 | ||
925 | + this.data.adding=0; | ||
922 | 926 | ||
923 | getApp().check_can_share(this); | 927 | getApp().check_can_share(this); |
924 | 928 | ||
@@ -1389,10 +1393,17 @@ Page({ | @@ -1389,10 +1393,17 @@ Page({ | ||
1389 | return false; | 1393 | return false; |
1390 | } | 1394 | } |
1391 | 1395 | ||
1396 | + if(th.data.adding) return false; | ||
1397 | + th.data.adding=1; | ||
1398 | + | ||
1392 | wx.showLoading({ | 1399 | wx.showLoading({ |
1393 | mask:true | 1400 | mask:true |
1394 | }) | 1401 | }) |
1395 | 1402 | ||
1403 | + | ||
1404 | + | ||
1405 | + | ||
1406 | + | ||
1396 | //如果是秒杀的话,要看redis够不够 | 1407 | //如果是秒杀的话,要看redis够不够 |
1397 | if (this.data.prom_type == 1 || this.data.prom_type == 2) { | 1408 | if (this.data.prom_type == 1 || this.data.prom_type == 2) { |
1398 | 1409 | ||
@@ -1406,6 +1417,7 @@ Page({ | @@ -1406,6 +1417,7 @@ Page({ | ||
1406 | this.getactLen(function (num) { | 1417 | this.getactLen(function (num) { |
1407 | if (num < th.data.goodsInputNum) { | 1418 | if (num < th.data.goodsInputNum) { |
1408 | wx.hideLoading(); | 1419 | wx.hideLoading(); |
1420 | + th.data.adding=0; | ||
1409 | // getApp().my_warnning("活动库存不足!", 0, th); | 1421 | // getApp().my_warnning("活动库存不足!", 0, th); |
1410 | wx.showToast({ | 1422 | wx.showToast({ |
1411 | title: '活动库存不足!', | 1423 | title: '活动库存不足!', |
@@ -1586,11 +1598,13 @@ Page({ | @@ -1586,11 +1598,13 @@ Page({ | ||
1586 | var i = getApp().request; | 1598 | var i = getApp().request; |
1587 | if (oo.user_id == null) { | 1599 | if (oo.user_id == null) { |
1588 | wx.hideLoading(); | 1600 | wx.hideLoading(); |
1601 | + th.data.adding=0; | ||
1589 | return s.my_warnning("还未登录!", 0, this); | 1602 | return s.my_warnning("还未登录!", 0, this); |
1590 | } | 1603 | } |
1591 | 1604 | ||
1592 | if (!getApp().globalData.userInfo) { | 1605 | if (!getApp().globalData.userInfo) { |
1593 | wx.hideLoading(); | 1606 | wx.hideLoading(); |
1607 | + th.data.adding=0; | ||
1594 | return s.my_warnning("还未登录!", 0, this); | 1608 | return s.my_warnning("还未登录!", 0, this); |
1595 | } | 1609 | } |
1596 | 1610 | ||
@@ -1606,6 +1620,7 @@ Page({ | @@ -1606,6 +1620,7 @@ Page({ | ||
1606 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | 1620 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
1607 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { | 1621 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
1608 | wx.hideLoading(); | 1622 | wx.hideLoading(); |
1623 | + th.data.adding=0; | ||
1609 | wx.showToast({ | 1624 | wx.showToast({ |
1610 | title: '超出商品限购', | 1625 | title: '超出商品限购', |
1611 | icon: 'none', | 1626 | icon: 'none', |
@@ -1618,6 +1633,7 @@ Page({ | @@ -1618,6 +1633,7 @@ Page({ | ||
1618 | if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { | 1633 | if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { |
1619 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { | 1634 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { |
1620 | wx.hideLoading(); | 1635 | wx.hideLoading(); |
1636 | + th.data.adding=0; | ||
1621 | wx.showToast({ | 1637 | wx.showToast({ |
1622 | title: '超出商品活动限购', | 1638 | title: '超出商品活动限购', |
1623 | icon: 'none', | 1639 | icon: 'none', |
@@ -1628,14 +1644,18 @@ Page({ | @@ -1628,14 +1644,18 @@ Page({ | ||
1628 | } | 1644 | } |
1629 | 1645 | ||
1630 | if (th.data.goodsInputNum <= 0){ | 1646 | if (th.data.goodsInputNum <= 0){ |
1631 | - wx.hideLoading();return s.my_warnning("商品数量不能为0", 0, th); | 1647 | + wx.hideLoading(); |
1648 | + th.data.adding=0; | ||
1649 | + return s.my_warnning("商品数量不能为0", 0, th); | ||
1632 | } | 1650 | } |
1633 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1651 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
1634 | th.setData({ | 1652 | th.setData({ |
1635 | sto_sele_name: "" | 1653 | sto_sele_name: "" |
1636 | }); | 1654 | }); |
1637 | if (th.data.sto_sele_name == ""){ | 1655 | if (th.data.sto_sele_name == ""){ |
1638 | - wx.hideLoading();return s.my_warnning("请选择门店", 0, th); | 1656 | + wx.hideLoading(); |
1657 | + th.data.adding=0; | ||
1658 | + return s.my_warnning("请选择门店", 0, th); | ||
1639 | } | 1659 | } |
1640 | 1660 | ||
1641 | //--------------此时操作的数据------------ | 1661 | //--------------此时操作的数据------------ |
@@ -1714,6 +1734,7 @@ Page({ | @@ -1714,6 +1734,7 @@ Page({ | ||
1714 | if (CanOutQty) { | 1734 | if (CanOutQty) { |
1715 | if (CanOutQty < e.data.goodsInputNum) { | 1735 | if (CanOutQty < e.data.goodsInputNum) { |
1716 | wx.hideLoading(); | 1736 | wx.hideLoading(); |
1737 | + th.data.adding=0; | ||
1717 | wx.showToast({ | 1738 | wx.showToast({ |
1718 | title: '库存不足!', | 1739 | title: '库存不足!', |
1719 | icon: 'none', | 1740 | icon: 'none', |
@@ -1724,6 +1745,7 @@ Page({ | @@ -1724,6 +1745,7 @@ Page({ | ||
1724 | th.add_cart_next(e, t, a, o, newd, CanOutQty); | 1745 | th.add_cart_next(e, t, a, o, newd, CanOutQty); |
1725 | } else { | 1746 | } else { |
1726 | wx.hideLoading(); | 1747 | wx.hideLoading(); |
1748 | + th.data.adding=0; | ||
1727 | wx.showToast({ | 1749 | wx.showToast({ |
1728 | title: '库存不足!', | 1750 | title: '库存不足!', |
1729 | icon: 'none', | 1751 | icon: 'none', |
@@ -1736,6 +1758,7 @@ Page({ | @@ -1736,6 +1758,7 @@ Page({ | ||
1736 | } else { | 1758 | } else { |
1737 | if (o.store_count <= 0) { | 1759 | if (o.store_count <= 0) { |
1738 | wx.hideLoading(); | 1760 | wx.hideLoading(); |
1761 | + th.data.adding=0; | ||
1739 | wx.showToast({ | 1762 | wx.showToast({ |
1740 | title: '库存已为空!', | 1763 | title: '库存已为空!', |
1741 | icon: 'none' | 1764 | icon: 'none' |
@@ -1744,6 +1767,7 @@ Page({ | @@ -1744,6 +1767,7 @@ Page({ | ||
1744 | } | 1767 | } |
1745 | if (o.store_count < e.data.goodsInputNum) { | 1768 | if (o.store_count < e.data.goodsInputNum) { |
1746 | wx.hideLoading(); | 1769 | wx.hideLoading(); |
1770 | + th.data.adding=0; | ||
1747 | wx.showToast({ | 1771 | wx.showToast({ |
1748 | title: '库存不足!', | 1772 | title: '库存不足!', |
1749 | icon: 'none', | 1773 | icon: 'none', |
@@ -1763,6 +1787,7 @@ Page({ | @@ -1763,6 +1787,7 @@ Page({ | ||
1763 | 1787 | ||
1764 | if (o.store_count <= 0) { | 1788 | if (o.store_count <= 0) { |
1765 | wx.hideLoading(); | 1789 | wx.hideLoading(); |
1790 | + th.data.adding=0; | ||
1766 | wx.showToast({ | 1791 | wx.showToast({ |
1767 | title: '库存已为空!', | 1792 | title: '库存已为空!', |
1768 | icon: 'none', | 1793 | icon: 'none', |
@@ -1771,6 +1796,7 @@ Page({ | @@ -1771,6 +1796,7 @@ Page({ | ||
1771 | } | 1796 | } |
1772 | if (o.store_count < e.data.goodsInputNum) { | 1797 | if (o.store_count < e.data.goodsInputNum) { |
1773 | wx.hideLoading(); | 1798 | wx.hideLoading(); |
1799 | + th.data.adding=0; | ||
1774 | wx.showToast({ | 1800 | wx.showToast({ |
1775 | title: '库存不足!', | 1801 | title: '库存不足!', |
1776 | icon: 'none', | 1802 | icon: 'none', |
@@ -1790,6 +1816,7 @@ Page({ | @@ -1790,6 +1816,7 @@ Page({ | ||
1790 | newd.prom_type = 7; | 1816 | newd.prom_type = 7; |
1791 | if (o.store_count <= 0) { | 1817 | if (o.store_count <= 0) { |
1792 | wx.hideLoading(); | 1818 | wx.hideLoading(); |
1819 | + th.data.adding=0; | ||
1793 | wx.showToast({ | 1820 | wx.showToast({ |
1794 | title: '库存已为空!', | 1821 | title: '库存已为空!', |
1795 | icon: 'none', | 1822 | icon: 'none', |
@@ -1798,6 +1825,7 @@ Page({ | @@ -1798,6 +1825,7 @@ Page({ | ||
1798 | }; | 1825 | }; |
1799 | if (o.store_count < e.data.goodsInputNum) { | 1826 | if (o.store_count < e.data.goodsInputNum) { |
1800 | wx.hideLoading(); | 1827 | wx.hideLoading(); |
1828 | + th.data.adding=0; | ||
1801 | wx.showToast({ | 1829 | wx.showToast({ |
1802 | title: '库存不足!', | 1830 | title: '库存不足!', |
1803 | icon: 'none', | 1831 | icon: 'none', |
@@ -1817,6 +1845,7 @@ Page({ | @@ -1817,6 +1845,7 @@ Page({ | ||
1817 | 1845 | ||
1818 | if (CanOutQty < e.data.goodsInputNum) { | 1846 | if (CanOutQty < e.data.goodsInputNum) { |
1819 | wx.hideLoading(); | 1847 | wx.hideLoading(); |
1848 | + th.data.adding=0; | ||
1820 | wx.showToast({ | 1849 | wx.showToast({ |
1821 | title: '库存不足!', | 1850 | title: '库存不足!', |
1822 | icon: 'none', | 1851 | icon: 'none', |
@@ -1827,6 +1856,7 @@ Page({ | @@ -1827,6 +1856,7 @@ Page({ | ||
1827 | th.add_cart_next(e, t, a, o, newd, CanOutQty); | 1856 | th.add_cart_next(e, t, a, o, newd, CanOutQty); |
1828 | } else { | 1857 | } else { |
1829 | wx.hideLoading(); | 1858 | wx.hideLoading(); |
1859 | + th.data.adding=0; | ||
1830 | wx.showToast({ | 1860 | wx.showToast({ |
1831 | title: '库存不足!', | 1861 | title: '库存不足!', |
1832 | icon: 'none', | 1862 | icon: 'none', |
@@ -1838,6 +1868,7 @@ Page({ | @@ -1838,6 +1868,7 @@ Page({ | ||
1838 | } else { | 1868 | } else { |
1839 | if (o.store_count <= 0) { | 1869 | if (o.store_count <= 0) { |
1840 | wx.hideLoading(); | 1870 | wx.hideLoading(); |
1871 | + th.data.adding=0; | ||
1841 | wx.showToast({ | 1872 | wx.showToast({ |
1842 | title: '库存已为空!', | 1873 | title: '库存已为空!', |
1843 | icon: 'none', | 1874 | icon: 'none', |
@@ -1847,6 +1878,7 @@ Page({ | @@ -1847,6 +1878,7 @@ Page({ | ||
1847 | }; | 1878 | }; |
1848 | if (o.store_count < e.data.goodsInputNum) { | 1879 | if (o.store_count < e.data.goodsInputNum) { |
1849 | wx.hideLoading(); | 1880 | wx.hideLoading(); |
1881 | + th.data.adding=0; | ||
1850 | wx.showToast({ | 1882 | wx.showToast({ |
1851 | title: '库存不足!', | 1883 | title: '库存不足!', |
1852 | icon: 'none', | 1884 | icon: 'none', |
@@ -1874,6 +1906,7 @@ Page({ | @@ -1874,6 +1906,7 @@ Page({ | ||
1874 | 1906 | ||
1875 | if (CanOutQty < e.data.goodsInputNum) { | 1907 | if (CanOutQty < e.data.goodsInputNum) { |
1876 | wx.hideLoading(); | 1908 | wx.hideLoading(); |
1909 | + th.data.adding=0; | ||
1877 | wx.showToast({ | 1910 | wx.showToast({ |
1878 | title: '库存不足!', | 1911 | title: '库存不足!', |
1879 | icon: 'none', | 1912 | icon: 'none', |
@@ -2014,6 +2047,7 @@ Page({ | @@ -2014,6 +2047,7 @@ Page({ | ||
2014 | if (CanOutQty) { | 2047 | if (CanOutQty) { |
2015 | if (item.goods_num + th.data.goodsInputNum > CanOutQty) { | 2048 | if (item.goods_num + th.data.goodsInputNum > CanOutQty) { |
2016 | wx.hideLoading(); | 2049 | wx.hideLoading(); |
2050 | + th.data.adding=0; | ||
2017 | wx.showToast({ | 2051 | wx.showToast({ |
2018 | title: '库存不足!', | 2052 | title: '库存不足!', |
2019 | icon: 'none', | 2053 | icon: 'none', |
@@ -2024,6 +2058,7 @@ Page({ | @@ -2024,6 +2058,7 @@ Page({ | ||
2024 | } else { | 2058 | } else { |
2025 | if (item.goods_num + th.data.goodsInputNum > o.store_count) { | 2059 | if (item.goods_num + th.data.goodsInputNum > o.store_count) { |
2026 | wx.hideLoading(); | 2060 | wx.hideLoading(); |
2061 | + th.data.adding=0; | ||
2027 | wx.showToast({ | 2062 | wx.showToast({ |
2028 | title: '库存不足!', | 2063 | title: '库存不足!', |
2029 | icon: 'none', | 2064 | icon: 'none', |
@@ -2035,6 +2070,7 @@ Page({ | @@ -2035,6 +2070,7 @@ Page({ | ||
2035 | //秒杀有限购的时候,同时不是普通购买 | 2070 | //秒杀有限购的时候,同时不是普通购买 |
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)) { | 2071 | 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(); | 2072 | wx.hideLoading(); |
2073 | + th.data.adding=0; | ||
2038 | wx.showToast({ | 2074 | wx.showToast({ |
2039 | title: '此商品已在购物车,去购物车结算!', | 2075 | title: '此商品已在购物车,去购物车结算!', |
2040 | icon: 'none', | 2076 | icon: 'none', |
@@ -2076,6 +2112,7 @@ Page({ | @@ -2076,6 +2112,7 @@ Page({ | ||
2076 | data: updata, | 2112 | data: updata, |
2077 | success: function (t) { | 2113 | success: function (t) { |
2078 | wx.hideLoading(); | 2114 | wx.hideLoading(); |
2115 | + th.data.adding=0; | ||
2079 | getApp().my_warnning('加入购物车成功', 1, th, 450); | 2116 | getApp().my_warnning('加入购物车成功', 1, th, 450); |
2080 | var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; | 2117 | var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; |
2081 | th.setData({ | 2118 | th.setData({ |
@@ -2089,6 +2126,7 @@ Page({ | @@ -2089,6 +2126,7 @@ Page({ | ||
2089 | data: newd, | 2126 | data: newd, |
2090 | success: function (t) { | 2127 | success: function (t) { |
2091 | wx.hideLoading(); | 2128 | wx.hideLoading(); |
2129 | + th.data.adding=0; | ||
2092 | getApp().my_warnning('加入购物车成功', 1, th, 450); | 2130 | getApp().my_warnning('加入购物车成功', 1, th, 450); |
2093 | var c_num = th.data.cartGoodsNum + e.data.goodsInputNum; | 2131 | var c_num = th.data.cartGoodsNum + e.data.goodsInputNum; |
2094 | th.setData({ | 2132 | th.setData({ |
@@ -5270,6 +5308,8 @@ Page({ | @@ -5270,6 +5308,8 @@ Page({ | ||
5270 | th = e, | 5308 | th = e, |
5271 | o = this.data.sele_g; | 5309 | o = this.data.sele_g; |
5272 | 5310 | ||
5311 | + if(th.data.adding) return false; | ||
5312 | + th.data.adding=0; | ||
5273 | 5313 | ||
5274 | wx.showLoading({ | 5314 | wx.showLoading({ |
5275 | mask:true | 5315 | mask:true |
@@ -5283,6 +5323,7 @@ Page({ | @@ -5283,6 +5323,7 @@ Page({ | ||
5283 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { | 5323 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
5284 | 5324 | ||
5285 | wx.hideLoading(); | 5325 | wx.hideLoading(); |
5326 | + th.data.adding=0; | ||
5286 | wx.showToast({ | 5327 | wx.showToast({ |
5287 | title: '超出商品限购', | 5328 | title: '超出商品限购', |
5288 | icon: 'none', | 5329 | icon: 'none', |
@@ -5301,6 +5342,7 @@ Page({ | @@ -5301,6 +5342,7 @@ Page({ | ||
5301 | if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { | 5342 | if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { |
5302 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { | 5343 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { |
5303 | wx.hideLoading(); | 5344 | wx.hideLoading(); |
5345 | + th.data.adding=0; | ||
5304 | wx.showToast({ | 5346 | wx.showToast({ |
5305 | title: '超出商品活动限购', | 5347 | title: '超出商品活动限购', |
5306 | icon: 'none', | 5348 | icon: 'none', |
@@ -5321,6 +5363,7 @@ Page({ | @@ -5321,6 +5363,7 @@ Page({ | ||
5321 | 5363 | ||
5322 | if (o.store_count <= 0) { | 5364 | if (o.store_count <= 0) { |
5323 | wx.hideLoading(); | 5365 | wx.hideLoading(); |
5366 | + th.data.adding=0; | ||
5324 | wx.showToast({ | 5367 | wx.showToast({ |
5325 | title: '库存已为空!', | 5368 | title: '库存已为空!', |
5326 | icon: 'none', | 5369 | icon: 'none', |
@@ -5337,6 +5380,7 @@ Page({ | @@ -5337,6 +5380,7 @@ Page({ | ||
5337 | 5380 | ||
5338 | if (th.data.goodsInputNum > redis_num) { | 5381 | if (th.data.goodsInputNum > redis_num) { |
5339 | wx.hideLoading(); | 5382 | wx.hideLoading(); |
5383 | + th.data.adding=0; | ||
5340 | wx.showToast({ | 5384 | wx.showToast({ |
5341 | title: '超出商品活动库存', | 5385 | title: '超出商品活动库存', |
5342 | icon: 'none', | 5386 | icon: 'none', |
@@ -5351,6 +5395,7 @@ Page({ | @@ -5351,6 +5395,7 @@ Page({ | ||
5351 | } else { | 5395 | } else { |
5352 | if (o.store_count <= 0) { | 5396 | if (o.store_count <= 0) { |
5353 | wx.hideLoading(); | 5397 | wx.hideLoading(); |
5398 | + th.data.adding=0; | ||
5354 | wx.showToast({ | 5399 | wx.showToast({ |
5355 | title: '库存已为空!', | 5400 | title: '库存已为空!', |
5356 | icon: 'none', | 5401 | icon: 'none', |
@@ -5362,6 +5407,7 @@ Page({ | @@ -5362,6 +5407,7 @@ Page({ | ||
5362 | 5407 | ||
5363 | if (th.data.goodsInputNum <= 0) { | 5408 | if (th.data.goodsInputNum <= 0) { |
5364 | wx.hideLoading(); | 5409 | wx.hideLoading(); |
5410 | + th.data.adding=0; | ||
5365 | wx.showToast({ | 5411 | wx.showToast({ |
5366 | title: '商品数量不能为0', | 5412 | title: '商品数量不能为0', |
5367 | icon: 'none', | 5413 | icon: 'none', |
@@ -5372,6 +5418,7 @@ Page({ | @@ -5372,6 +5418,7 @@ Page({ | ||
5372 | if (th.data.goodsInputNum > o.store_count) { | 5418 | if (th.data.goodsInputNum > o.store_count) { |
5373 | 5419 | ||
5374 | wx.hideLoading(); | 5420 | wx.hideLoading(); |
5421 | + th.data.adding=0; | ||
5375 | wx.showToast({ | 5422 | wx.showToast({ |
5376 | title: '超出商品库存', | 5423 | title: '超出商品库存', |
5377 | icon: 'none', | 5424 | icon: 'none', |
@@ -5386,6 +5433,7 @@ Page({ | @@ -5386,6 +5433,7 @@ Page({ | ||
5386 | }); | 5433 | }); |
5387 | if (th.data.sto_sele_name == ""){ | 5434 | if (th.data.sto_sele_name == ""){ |
5388 | wx.hideLoading(); | 5435 | wx.hideLoading(); |
5436 | + th.data.adding=0; | ||
5389 | return s.my_warnning("请选择门店", 0, th); | 5437 | return s.my_warnning("请选择门店", 0, th); |
5390 | } | 5438 | } |
5391 | //--------------此时操作的数据------------ | 5439 | //--------------此时操作的数据------------ |