Commit 4e4f2755f1dc58c0f5d12c7dde982c103f8a2ed5

Authored by 后端研发-苏泰源
1 parent 28b5509b

购物车超出限购提示修改

Showing 1 changed file with 90 additions and 41 deletions
pages/cart/cart/cart.js
... ... @@ -1686,9 +1686,10 @@ Page({
1686 1686 th.check_down_line(t, pitem, item, wareIds);
1687 1687 } else {
1688 1688 if (t.goods_num > store_count) {
1689   - wx.showModal({
1690   - title: '提示',
1691   - content: '购买数量超出商品库存'
  1689 + wx.showToast({
  1690 + title: '购买数量超出商品库存',
  1691 + icon: 'none',
  1692 + // content: '购买数量超出商品库存'
1692 1693 });
1693 1694 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1694 1695 e.setData({
... ... @@ -1742,18 +1743,21 @@ Page({
1742 1743  
1743 1744 var buyed_mum2 = t.goods_num + goodsbuynum;
1744 1745 if (buyed_mum2 > limit && limit > 0) {
1745   - wx.showModal({
1746   - title: '提示',
1747   - content: '购买数量超出商品限购'
  1746 + wx.showToast({
  1747 + title: '购买数量超出商品限购',
  1748 + icon: 'none',
  1749 + // content: '购买数量超出商品限购'
1748 1750 });
1749 1751 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1750 1752 var cbuy = limit - buyed_mum2;
1751 1753 e.setData({
1752   - [txt]: cbuy > 0 ? cbuy : 0,
  1754 + // [txt]: cbuy > 0 ? cbuy : 0,
  1755 + [txt]: cbuy > 0 ? cbuy : limit,
1753 1756 });
1754 1757 e.doCheckAll();
1755   -
1756   - t.goods_num = cbuy > 0 ? cbuy : 0,
  1758 +
  1759 + t.goods_num = cbuy > 0 ? cbuy : limit,
  1760 + // t.goods_num = cbuy > 0 ? cbuy : 0,
1757 1761 e.update_cart(t, pitem, item);
1758 1762 return false;
1759 1763 }
... ... @@ -1767,10 +1771,15 @@ Page({
1767 1771 success: function (res_d) {
1768 1772 if (res_d.data.code == 0 && res_d.data.data) {
1769 1773 if (t.goods_num > store_count) {
1770   - wx.showModal({
1771   - title: '提示',
1772   - content: '购买数量超出商品库存'
1773   - });
  1774 + // wx.showModal({
  1775 + // title: '提示',
  1776 + // content: '购买数量超出商品库存'
  1777 + // });
  1778 + wx.showToast({
  1779 + title: '购买数量超出商品库存',
  1780 + icon: 'none',
  1781 + // content: '购买数量超出商品库存'
  1782 + });
1774 1783 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1775 1784 e.setData({
1776 1785 [txt]: store_count
... ... @@ -1786,10 +1795,15 @@ Page({
1786 1795 var false_data = res_d.data.data;
1787 1796 //--判断库存--
1788 1797 if (t.goods_num > false_data.goods_num - false_data.buy_num) {
1789   - wx.showModal({
1790   - title: '提示',
1791   - content: '购买数量超出活动库存'
1792   - });
  1798 + // wx.showModal({
  1799 + // title: '提示',
  1800 + // content: '购买数量超出活动库存'
  1801 + // });
  1802 + wx.showToast({
  1803 + title: '购买数量超出活动库存',
  1804 + icon: 'none',
  1805 + // content: '购买数量超出活动库存'
  1806 + });
1793 1807 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1794 1808 e.setData({
1795 1809 [txt]: false_data.goods_num - false_data.buy_num
... ... @@ -1804,10 +1818,15 @@ Page({
1804 1818  
1805 1819 //--判断redis数量是否已经超出--
1806 1820 if (t.goods_num > false_data.redisnum) {
1807   - wx.showModal({
1808   - title: '提示',
1809   - content: '购买数量超出商品库存'
1810   - });
  1821 + // wx.showModal({
  1822 + // title: '提示',
  1823 + // content: '购买数量超出商品库存'
  1824 + // });
  1825 + wx.showToast({
  1826 + title: '购买数量超出商品库存',
  1827 + icon: 'none',
  1828 + // content: '购买数量超出商品库存'
  1829 + });
1811 1830 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1812 1831 e.setData({
1813 1832 [txt]: false_data.redisnum
... ... @@ -1821,9 +1840,14 @@ Page({
1821 1840  
1822 1841 //--活动的限购是不是要判断--
1823 1842 if (t.goods_num + promgoodsbuynum > false_data.buy_limit && false_data.buy_limit > 0) {
1824   - wx.showModal({
1825   - title: '提示',
1826   - content: '购买数量超出秒杀限购'
  1843 + // wx.showModal({
  1844 + // title: '提示',
  1845 + // content: '购买数量超出秒杀限购'
  1846 + // });
  1847 + wx.showToast({
  1848 + title: '购买数量超出秒杀限购',
  1849 + icon: 'none',
  1850 + // content: '购买数量超出秒杀限购'
1827 1851 });
1828 1852 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1829 1853 e.setData({
... ... @@ -1846,10 +1870,15 @@ Page({
1846 1870 getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {}).then(res => {
1847 1871 if (res.data.code == 0 && res.data.data) {
1848 1872 if (t.goods_num > store_count) {
1849   - wx.showModal({
1850   - title: '提示',
1851   - content: '购买数量超出商品库存'
1852   - });
  1873 + // wx.showModal({
  1874 + // title: '提示',
  1875 + // content: '购买数量超出商品库存'
  1876 + // });
  1877 + wx.showToast({
  1878 + title: '购买数量超出商品库存',
  1879 + icon: 'none',
  1880 + // content: '购买数量超出商品库存'
  1881 + });
1853 1882 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1854 1883 e.setData({
1855 1884 [txt]: store_count
... ... @@ -1865,9 +1894,14 @@ Page({
1865 1894 var gr_data = res.data.data;
1866 1895 //--判断库存--
1867 1896 if (t.goods_num > gr_data.goods_num - gr_data.buy_num) {
1868   - wx.showModal({
1869   - title: '提示',
1870   - content: '购买数量超出活动库存'
  1897 + // wx.showModal({
  1898 + // title: '提示',
  1899 + // content: '购买数量超出活动库存'
  1900 + // });
  1901 + wx.showToast({
  1902 + title: '购买数量超出活动库存',
  1903 + icon: 'none',
  1904 + // content: '购买数量超出活动库存'
1871 1905 });
1872 1906 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1873 1907 e.setData({
... ... @@ -1883,9 +1917,14 @@ Page({
1883 1917  
1884 1918 //--判断redis数量是否已经超出--
1885 1919 if (t.goods_num > gr_data.redisnum) {
1886   - wx.showModal({
1887   - title: '提示',
1888   - content: '购买数量超出商品库存'
  1920 + // wx.showModal({
  1921 + // title: '提示',
  1922 + // content: '购买数量超出商品库存'
  1923 + // });
  1924 + wx.showToast({
  1925 + title: '购买数量超出商品库存',
  1926 + icon: 'none',
  1927 + // content: '购买数量超出商品库存'
1889 1928 });
1890 1929 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1891 1930 e.setData({
... ... @@ -1900,10 +1939,15 @@ Page({
1900 1939  
1901 1940 //--活动的限购是不是要判断--
1902 1941 if (t.goods_num + promgoodsbuynum > gr_data.buy_limit && gr_data.buy_limit > 0) {
1903   - wx.showModal({
1904   - title: '提示',
1905   - content: '购买数量超出团购限购'
1906   - });
  1942 + // wx.showModal({
  1943 + // title: '提示',
  1944 + // content: '购买数量超出团购限购'
  1945 + // });
  1946 + wx.showToast({
  1947 + title: '购买数量超出团购限购',
  1948 + icon: 'none',
  1949 + // content: '购买数量超出团购限购'
  1950 + });
1907 1951 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1908 1952 e.setData({
1909 1953 [txt]: gr_data.buy_limit
... ... @@ -1954,9 +1998,14 @@ Page({
1954 1998 });
1955 1999 var log = 0;
1956 2000 if (ob.code == -1) {
1957   - wx.showModal({
1958   - title: '提示',
1959   - content: '购买数量超出商品库存'
  2001 + // wx.showModal({
  2002 + // title: '提示',
  2003 + // content: '购买数量超出商品库存'
  2004 + // });
  2005 + wx.showToast({
  2006 + title: '购买数量超出商品库存',
  2007 + icon: 'none',
  2008 + // content: '购买数量超出商品库存'
1960 2009 });
1961 2010 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
1962 2011 th.setData({
... ...