Commit f65a3916327d2a645ea0b474f2469ee91964a016

Authored by yvan.ni
1 parent 853a6f78

跳转的优化

pages/cart/cart/cart.wxml
... ... @@ -88,7 +88,7 @@
88 88 </navigator>
89 89 <view class="goods-cont">
90 90 <view class="goods-name">
91   - <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-gd="{{items.goods_id}}">{{items.goods_name}}</navigator>
  91 + <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-item="{{items}}" data-gd="{{items.goods_id}}">{{items.goods_name}}</navigator>
92 92  
93 93 <view class="specifications ellipsis-1">
94 94 <view wx:if="{{items.goods_color || items.goods_spec}}">
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -261,6 +261,7 @@ Page({
261 261 hiddenCS: true,
262 262  
263 263 is_retail_price: 0,
  264 + is_no_new:0
264 265 },
265 266  
266 267 //------初始化加载----------
... ... @@ -1422,7 +1423,6 @@ Page({
1422 1423 icon: 'none',
1423 1424 });
1424 1425 return false;
1425   - // return s.my_warnning("库存已为空!", 0, th);
1426 1426 };
1427 1427 if (o.store_count < e.data.goodsInputNum) {
1428 1428 wx.showToast({
... ... @@ -1610,7 +1610,6 @@ Page({
1610 1610 icon: 'none'
1611 1611 });
1612 1612 return false;
1613   - // s.my_warnning("库存已为空!", 0, th);
1614 1613 };
1615 1614 if (o.store_count < e.data.goodsInputNum) {
1616 1615 wx.showToast({
... ... @@ -1632,7 +1631,7 @@ Page({
1632 1631 newd.prom_type = th.data.prom_type;
1633 1632 newd.prom_id = th.data.prom_id;
1634 1633  
1635   - if (o.store_count <= 0) {
  1634 + if (o.store_count <= 0 && th.data.is_no_new) {
1636 1635 wx.showToast({
1637 1636 title: '库存已为空!',
1638 1637 icon: 'none',
... ... @@ -1640,13 +1639,12 @@ Page({
1640 1639 return false;
1641 1640 //return s.my_warnning("库存已为空!", 0, th);
1642 1641 };
1643   - if (o.store_count < e.data.goodsInputNum) {
  1642 + if (o.store_count < e.data.goodsInputNum && th.data.is_no_new) {
1644 1643 wx.showToast({
1645 1644 title: '库存不足!',
1646 1645 icon: 'none',
1647 1646 });
1648 1647 return false;
1649   - // return s.my_warnning("库存不足!", 0, th);
1650 1648 };
1651 1649  
1652 1650 th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
... ... @@ -1666,7 +1664,6 @@ Page({
1666 1664 icon: 'none',
1667 1665 });
1668 1666 return false;
1669   - //return s.my_warnning("库存已为空!", 0, th);
1670 1667 };
1671 1668 if (o.store_count < e.data.goodsInputNum) {
1672 1669 wx.showToast({
... ... @@ -1682,62 +1679,6 @@ Page({
1682 1679 //---如果是线下门店销售的时候---
1683 1680 if (th.data.sales_rules >= 2) {
1684 1681 var pick = th.get_pick_from_list(th.data.sto_sele_id)
1685   - //---通过接口获取门店的线下库存信息--
1686   - // getApp().request.get("/api/weshop/goods/getWareStorages", {
1687   - // data: {
1688   - // storageNos: pick.pickup_no,
1689   - // wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
1690   - // storeId: os.stoid
1691   - // },
1692   - // success: function (res) {
1693   - // if (res.data.code == 0) {
1694   - // if (res.data.data.pageData.length > 0) {
1695   - // var CanOutQty = res.data.data.pageData[0].CanOutQty;
1696   - // if (CanOutQty < e.data.goodsInputNum) {
1697   - // wx.showToast({
1698   - // title: '库存不足!',
1699   - // icon: 'none',
1700   - // });
1701   - // return false;
1702   - // //return s.my_warnning("库存不足!", 0, th);
1703   - // }
1704   - // //在调一次接口,读取商品的预出库的数量,lock
1705   - // getApp().request.get("/api/weshop/order/ware/lock/page", {
1706   - // data: {
1707   - // store_id: os.stoid,
1708   - // wareId: th.data.sele_g.goods_id,
1709   - // storageId: pick.pickup_id,
1710   - // pageSize: 1000
1711   - // },
1712   - // success: function (res_data) {
1713   - // if (res_data.data.code == 0 && res_data.data.data.total > 0) {
1714   - //
1715   - // var lock = 0;
1716   - // for (var i in res_data.data.data.pageData) {
1717   - // lock += res_data.data.data.pageData[i].outQty;
1718   - // }
1719   - //
1720   - // if (CanOutQty <= lock) {
1721   - // wx.showToast({
1722   - // title: '库存不足!',
1723   - // icon: 'none',
1724   - // });
1725   - // return false;
1726   - // //return s.my_warnning("库存不足!", 0, th);
1727   - // }
1728   - // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
1729   - // } else {
1730   - // th.add_cart_next(e, t, a, o, newd, CanOutQty);
1731   - // }
1732   - // }
1733   - // })
1734   - // } else {
1735   - // return s.my_warnning("库存不足!", 0, th);
1736   - // }
1737   - //
1738   - // }
1739   - // }
1740   - // })
1741 1682  
1742 1683 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
1743 1684 if (CanOutQty) {
... ... @@ -4869,14 +4810,7 @@ Page({
4869 4810 var e = this,
4870 4811 th = e,
4871 4812 o = this.data.sele_g;
4872   - if (o.store_count <= 0) {
4873   - wx.showToast({
4874   - title: '库存已为空!',
4875   - icon: 'none',
4876   - });
4877   - return false;
4878   - // return s.my_warnning("库存已为空!", 0, th);
4879   - };
  4813 +
4880 4814  
4881 4815 //----------添加到购物车时,要判断限购数量,--------
4882 4816 e.get_buy_num(o, async function (ee) {
... ... @@ -4917,6 +4851,15 @@ Page({
4917 4851 var redis_num = 0
4918 4852 //不是普通购买的时候
4919 4853 if (th.data.is_normal != 1) {
  4854 +
  4855 + if (o.store_count <= 0 && th.data.is_no_new) {
  4856 + wx.showToast({
  4857 + title: '库存已为空!',
  4858 + icon: 'none',
  4859 + });
  4860 + return false;
  4861 + };
  4862 +
4920 4863 //-------判断活动是否抢光---------
4921 4864 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, {
4922 4865 1: 1
... ... @@ -4937,6 +4880,16 @@ Page({
4937 4880 return false;
4938 4881 }
4939 4882 }
  4883 + else{
  4884 + if (o.store_count <= 0) {
  4885 + wx.showToast({
  4886 + title: '库存已为空!',
  4887 + icon: 'none',
  4888 + });
  4889 + return false;
  4890 + };
  4891 +
  4892 + }
4940 4893  
4941 4894 if (th.data.goodsInputNum <= 0) {
4942 4895 wx.showToast({
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -1398,7 +1398,7 @@
1398 1398 </block>
1399 1399 <!-- 线上销售 -->
1400 1400 <block wx:else>
1401   - <block wx:if="{{sele_g.store_count<=0}}">
  1401 + <block wx:if="{{sele_g.store_count<=0 && is_no_new}}">
1402 1402 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
1403 1403 库存不足
1404 1404 </view>
... ...