1
0
Переглянути джерело

新增页面无库存商品列表展示逻辑

hyq 5 роки тому
батько
коміт
77a151c8f0

+ 35 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/test.java

@@ -0,0 +1,35 @@
+package com.kmall.admin.controller;
+
+import com.kmall.admin.entity.WxOrderEntity;
+import com.kmall.common.utils.ResponseData;
+import com.kmall.common.utils.JacksonUtils;
+import com.kmall.common.utils.OkHttpUtils;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author zengjunlin
+ * @version 1.0
+ * 2019-11-07 14:37
+ */
+public class test {
+    public static void main(String[] args) {
+
+        Map map = new HashMap();
+//        map.put("data", '1');
+//        String requestData = JacksonUtil.toJson(map);
+        String url = "http://192.168.1.68:8888/wx/wxOrderResendQueryAll ";
+        // 同步访问,返回结果字符串
+        String response = OkHttpUtils.post(map, url, "SSL");
+        ResponseData responseData = JacksonUtils.fromStringJson(response, ResponseData.class);
+        System.out.println(response);
+        System.out.println(responseData.getCode());
+        System.out.println(responseData.getMsg());
+        System.out.println(responseData.getData().getRows().size());
+        if(responseData.getCode().equalsIgnoreCase("0")){
+            List<WxOrderEntity> list = responseData.getData().getRows();
+            System.out.println(list);
+        }
+    }
+}

+ 1 - 1
kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java

@@ -226,7 +226,7 @@ public class ApiCartController extends ApiBaseAction {
         Map<String, Object> resultObj = Maps.newHashMap();
         //查询列表数据
         Map param = Maps.newHashMap();
-        param.put("user_id", loginUser.getId());
+        param.put("user_id", getUserId());
         Long storeId = getStoreId();
         param.put("store_id", storeId);
 //        param.putAll(setIsStockShare(storeId));

+ 2 - 2
kmall-api/src/main/java/com/kmall/api/api/ApiFootprintController.java

@@ -124,7 +124,7 @@ public class ApiFootprintController extends ApiBaseAction {
         //查询列表数据
         Map params = Maps.newHashMap();
         params.put("sidx", "f.id");
-        params.put("user_id", loginUser.getId());
+        params.put("user_id", getUserId());
         params.put("maxFoot", true);
         params.put("order", "desc");
         params.put("bizType", true);
@@ -176,4 +176,4 @@ public class ApiFootprintController extends ApiBaseAction {
         resultObj.put("data", footprintVos);
         return this.toResponsSuccess(resultObj);
     }
-}
+}

+ 1 - 1
kmall-api/src/main/resources/mybatis/mapper/ApiGoodsMapper.xml

@@ -302,7 +302,7 @@
 
     <select id="queryCatalogProductList" resultMap="goodsMap">
         select a.id, a.name, a.list_pic_url,psr1.category_id,psr1.brand_id,psr1.attribute_category , psr1.market_price, psr1.retail_price, a.goods_brief, b.id AS product_id,
-        psr1.stock_num,a.third_party_merch_code,a.goods_biz_type,a.goods_number,
+        psr1.stock_num,a.third_party_merch_code,a.goods_biz_type,a.goods_number,a.is_hot,
         mb.is_stock_share isStockShare,psr1.store_id ,
         ( SELECT sum( number ) FROM mall_cart WHERE goods_id = a.id AND store_id = psr1.store_id ) cart_num
         <if test="is_group != null and is_group == true">

+ 8 - 2
wx-mall/pages/catalog/catalog.wxml

@@ -127,14 +127,19 @@
         <view class="item" wx:for="{{goodsList}}" wx:for-index="index" wx:for-item="item" wx:key="{{item.id}}">
           <navigator url="/pages/goods/goods?id={{item.id}}&&storeId={{item.storeId}}&&paramView=cateGoods">
             <view class="left">
-              <image lazy-load="true" class="img" wx:if="{{item.list_pic_url}}" src="{{item.list_pic_url}}"></image>
+              <image lazy-load="true" class="img {{item.stockNum==0?'touming-img':''}}" wx:if="{{item.list_pic_url}}" src="{{item.list_pic_url}}"></image>
+              <image lazy-load="true" style="width:50px;height:50px;position: absolute;" wx:if="{{item.stockNum==0}}" src="../../static/images/service-zswh.png"></image>
+
+              <!-- <view class='nav'>{{item.stockNum==0?'无货':''}}</view>  -->
+              <!-- <text class='nav' style="color: #fff;font-size: 25rpx;background-color: #7c7b7b;border-radius: 40rpx;width: 82rpx;text-align: center;">{{item.stockNum==0?'无货':''}}</text>  -->
             </view>
           </navigator>
           <!-- 文字开始 -->
           <view class="right">
             <view class="text">
             <navigator url="/pages/goods/goods?id={{item.id}}&&storeId={{item.storeId}}&&paramView=cateGoods">
-              <text class="name" data-item-id="{{filterDiscount != 2?item.id:item.group_id}}">{{item.name?item.name:""}}</text>
+              <text class="name" data-item-id="{{filterDiscount != 2?item.id:item.group_id}}">{{item.name?item.name:""}}
+                </text>
               <!-- <text class="name" bindtap="bindtapGoodsDetail" data-item-id="{{filterDiscount != 2?item.id:item.group_id}}">{{item.name?item.name:""}}</text> -->
               <!-- <text class="desc" bindtap="bindtapGoodsDetail" data-item-id="{{filterDiscount != 2?item.id:item.group_id}}">{{item.goods_brief?item.goods_brief:""}}</text> -->
             </navigator>
@@ -144,6 +149,7 @@
               <navigator url="/pages/goods/goods?id={{item.id}}&&storeId={{item.storeId}}&&paramView=cateGoods">
                 <text class="price">{{item.retail_price?"¥"+item.retail_price:"¥0"}}</text>
                 <text class="org-price line-through">{{item.market_price?"¥"+item.market_price:""}}</text>
+                <!-- <text style="color: #fff;font-size: 25rpx;background-color: #b4282d;border-radius: 14rpx;width: 82rpx;text-align: center;">{{item.is_hot==1?'热销':''}}</text> -->
               </navigator>
               <!-- //数量加减 -->
               <!-- <view class="number-item">

+ 13 - 6
wx-mall/pages/catalog/catalog.wxss

@@ -272,14 +272,21 @@ page {
   text-align: center;
 }
 .cate-item .item .left {
-  width: 190rpx;
-  height: 272rpx;
-  float: left;
-  display: flex;
-  justify-content: center;
-  align-items: center;
+  width: 194rpx;
+height: 200rpx;
+float: left;
+display: flex;
+justify-content: center;
+align-items: center;
+/* box-shadow: 2px 2px 6px #3333; */
+border-radius: 20rpx;
+margin-top: 36rpx;
 }
 
+.touming-img{
+  opacity:0.6;
+  filter:alpha(opacity=60);
+}
 .cate-item .item .left .img {
   width: 180rpx; 
   height: 180rpx;

+ 7 - 1
wx-mall/pages/category/category.js

@@ -168,6 +168,8 @@ Page({
     // 页面显示
     let userInfo = wx.getStorageSync('userInfo');
     let token = wx.getStorageSync('token');
+    console.log(userInfo)
+    console.log(token)
     if ((userInfo && token)) {
       this.getFootCart();
     }
@@ -317,7 +319,11 @@ Page({
           that.setData({
             openAttr: !that.data.openAttr
           })
-          that.getFootCart();
+          let userInfo = wx.getStorageSync('userInfo');
+          let token = wx.getStorageSync('token');
+          if ((userInfo && token)) {
+            that.getFootCart();
+          }
         } else {
           wx.showToast({
             title: res.errmsg,

+ 7 - 2
wx-mall/pages/category/category.wxml

@@ -65,9 +65,14 @@
       <block wx:for="{{goodsList}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="unique">
         <view class="item {{iindex % 2 == 0 ? 'item-b' : '' }}">
          <navigator url="../goods/goods?id={{iitem.id}}&&currentIndex={{navIndex}}&&storeId={{iitem.storeId}}">
-            <image class="img" src="{{iitem.list_pic_url}}"></image>
-            <text class="name">{{iitem.name}}</text>
+            <view class="imglist">
+              <image class="img {{iitem.stockNum==0?'touming-img':''}}" src="{{iitem.list_pic_url}}"></image>
+              <image lazy-load="true" style="width:60px;height:60px;position: absolute;" wx:if="{{iitem.stockNum==0}}" src="../../static/images/service-zswh.png"></image>
+            </view>
           </navigator>
+          <view>
+            <text class="name">{{iitem.name}}</text>
+          </view>
           <view class="price">¥{{iitem.retail_price == null?'':iitem.retail_price}}
             <image class="cart" src="/static/images/cart.png" data-goods-id="{{iitem.id}}" data-product-id="{{iitem.product_id}}" bindtap='addCart' background-size="cover"></image>
           </view>

+ 17 - 1
wx-mall/pages/category/category.wxss

@@ -98,6 +98,22 @@ color: transparent;
   text-align: center;
 }
 
+.cate-item .imglist {
+  width: 302rpx;
+  height: 302rpx;
+  /* float: left; */
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 20rpx;
+  margin-left: 39rpx;
+}
+
+.touming-img{
+  opacity:0.6;
+  filter:alpha(opacity=60);
+}
+
 .cate-item .b .item-b{
   margin-left: 6.25rpx;
 }
@@ -109,7 +125,7 @@ color: transparent;
 }
 
 .cate-item .item .name{
-  display: block;
+  display: flex;
   width: 365.625rpx;
   height: 70rpx;
   margin: 11.5rpx 0 22rpx 0;

+ 8 - 2
wx-mall/pages/categoryBrand/categoryBrand.wxml

@@ -75,9 +75,15 @@
       <block wx:for="{{goodsList}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="unique">
         <view class="item {{iindex % 2 == 0 ? 'item-b' : '' }}">
            <navigator url="../goods/goods?id={{iitem.id}}&&currentIndex={{navIndex}}&&storeId={{iitem.storeId}}">
-            <image class="img" src="{{iitem.list_pic_url}}"></image>
-            <text class="name">{{iitem.name}}</text>
+            <!-- <image class="img" src="{{iitem.list_pic_url}}"></image> -->
+            <view class="imglist">
+              <image class="img {{iitem.stockNum==0?'touming-img':''}}" src="{{iitem.list_pic_url}}"></image>
+              <image lazy-load="true" style="width:50px;height:50px;position: absolute;" wx:if="{{iitem.stockNum==0}}" src="../../static/images/service-zswh.png"></image>
+            </view>
            </navigator>
+           <view>
+              <text class="name">{{iitem.name}}</text>
+            </view>
            <view class="price">¥{{iitem.retail_price == null?'':iitem.retail_price}}
              <image class="cart" src="/static/images/cart.png" data-goods-id="{{iitem.id}}" data-product-id="{{iitem.product_id}}" bindtap='addCart' background-size="cover"></image>
            </view>

+ 16 - 0
wx-mall/pages/categoryBrand/categoryBrand.wxss

@@ -98,6 +98,22 @@ color: transparent;
   text-align: center;
 }
 
+.cate-item .imglist {
+  width: 302rpx;
+  height: 302rpx;
+  /* float: left; */
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 20rpx;
+  margin-left: 39rpx;
+}
+
+.touming-img{
+  opacity:0.6;
+  filter:alpha(opacity=60);
+}
+
 .cate-item .b .item-b{
   margin-left: 6.25rpx;
 }

+ 9 - 1
wx-mall/pages/goods/goods.wxml

@@ -439,13 +439,21 @@
   </view>
 </view>
 <!-- 促销弹框end -->
-<view wx:if="{{stockNum ==0 || goods.is_on_sale == 0}}">
+<view wx:if="{{goods.is_on_sale == 0}}">
   <view class='shelves-view'>
     <view class="shelves">
       <text class='shelves-text'>已下架</text>
     </view>
   </view>
 </view>
+<view wx:if="{{goods.is_on_sale != 0 && stockNum ==0}}">
+  <view class='shelves-view'>
+    <view class="shelves2">
+      <text class='shelves-text'>暂时无货</text>
+    </view>
+  </view>
+</view>
+
 <view class="bottom-btn">
   <view class="l l-home" bindtap="switchNav">
     <image class="icon" src="/static/images/nav-1.png"></image>

+ 17 - 0
wx-mall/pages/goods/goods.wxss

@@ -1179,6 +1179,23 @@
   color: #fff;
 }
 
+.shelves-view .shelves2 {
+  border: 1px solid #d8b676;
+  background: #dab97c;
+  float: left;
+  height: 60rpx;
+  line-height: 60rpx;
+  flex: 1;
+  text-align: center;
+  color: rgb(248, 238, 206);
+  width: 100%;
+}
+.shelves-view .shelves2 .shelves-text {
+  font-size: 28rpx;
+  flex: 1;
+  text-align: center;
+  color: rgb(248, 238, 206);
+}
 .detail .t {
   width: 687.5rpx;
   height: 104rpx;

+ 18 - 4
wx-mall/pages/hotGoods/hotGoods.js

@@ -26,7 +26,8 @@ Page({
     number: 1,
     retailPrice: '',
     stockNum: 0,
-    cartNumber: 0
+    cartNumber: 0,
+    mobileHeight: null
   },
   toggleNav() {
     this.setData({
@@ -42,6 +43,18 @@ Page({
           goodsList: [],
           page: 1
         });
+        wx.getSystemInfo({
+          success: function (res) {
+            that.setData({
+              mobileHeight: res.windowHeight - (res.windowWidth / 750) * 94
+            })
+          }
+        });
+        if (that.data.mobileHeight > 700) {
+          that.setData({
+            size: 6
+          });
+        }
         that.getGoodsList();
       }
     });
@@ -52,6 +65,7 @@ Page({
     });
     var that = this;
 
+    console.log(that.data.size)
     util.request(api.HotGoodsList, { isHot: 1, page: that.data.page, size: that.data.size, order: that.data.currentSortOrder, sort: that.data.currentSortType, categoryId: that.data.categoryId})
       .then(function (res) {
         if (res.errno === 0) {
@@ -83,14 +97,14 @@ Page({
     });
   },
   onLoad: function (options) {
+    var that = this;
     // 页面初始化 options为页面跳转所带来的参数
-    this.getData();
+    that.getData();
     let userInfo = wx.getStorageSync('userInfo');
     let token = wx.getStorageSync('token');
     if ((userInfo && token)) {
-      this.getFootCart();
+      that.getFootCart();
     }
-
   },
   onReady: function () {
     // 页面渲染完成

+ 7 - 3
wx-mall/pages/hotGoods/hotGoods.wxml

@@ -82,10 +82,14 @@
         <block wx:for="{{goodsList}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="unique">
           <view class="item {{iindex % 2 == 0 ? 'item-b' : '' }}">
             <navigator url="../goods/goods?id={{iitem.id}}&&storeId={{iitem.storeId}}&&paramView=hotGoodsView">
-              <image class="img" src="{{iitem.list_pic_url}}"></image>
-              <text class="name">{{iitem.name}}</text>
+              <view class="imglist">
+                <image class="img {{iitem.stockNum==0?'touming-img':''}}" src="{{iitem.list_pic_url}}"></image>
+                <image lazy-load="true" style="width:60px;height:60px;position: absolute;" wx:if="{{iitem.stockNum==0}}" src="../../static/images/service-zswh.png"></image>
+              </view>
             </navigator>
-
+            <view>
+              <text class="name">{{iitem.name}}</text>
+            </view>
             <view class="price">¥{{iitem.retail_price}}
               <image lazy-load="true" class="cart" src="/static/images/cart.png" data-goods-id="{{iitem.id}}" data-retail-price="{{iitem.retail_price}}" bindtap='addCart' background-size="cover"></image>
             </view>

+ 15 - 0
wx-mall/pages/hotGoods/hotGoods.wxss

@@ -146,6 +146,21 @@ page{
   text-align: center;
 }
 
+.cate-item .imglist {
+  width: 302rpx;
+  height: 302rpx;
+  /* float: left; */
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 20rpx;
+  margin-left: 39rpx;
+}
+
+.touming-img{
+  opacity:0.6;
+  filter:alpha(opacity=60);
+}
 .cate-item .b .item-b{
  border-right: 1rpx solid #f4f4f4;
 }

+ 2 - 2
wx-mall/pages/index/index.js

@@ -34,8 +34,8 @@ Page({
     // options.scene = 148;
     // options.scene = 93;
     // options.scene = 38;
-    // options.scene = 67;
-    options.scene = 28;
+    options.scene = 67;
+    // options.scene = 28;
     // options.scene = 8;
     if (options.scene) {
       // console.log("have scene");

+ 4 - 1
wx-mall/pages/index/index.wxml

@@ -177,7 +177,10 @@
         <scroll-view class='contents fade_in'>
           <view class="c">
             <navigator url="/pages/goods/goods?id={{item.id}}&&storeId={{item.storeId}}&&paramView=hotGoods">
-              <image lazy-load="true" class="img" src="{{item.list_pic_url}}?x-oss-process=image/resize,h_500" mode="aspectFit"></image>
+              <view class="left">
+                <image lazy-load="true" class="img {{item.stockNum==0?'touming-img':''}}" src="{{item.list_pic_url}}?x-oss-process=image/resize,h_500" mode="aspectFit"></image>
+                <image lazy-load="true" style="width:60px;height:60px;position: absolute;" wx:if="{{item.stockNum==0}}" src="../../static/images/service-zswh.png"></image>
+              </view>
             </navigator>
           </view>
           <view class="right">

+ 15 - 0
wx-mall/pages/index/index.wxss

@@ -266,6 +266,21 @@
   height: auto;
   overflow: hidden;
 }
+.a-popular .b .item .c .left {
+  width: 240rpx;
+  height: 240rpx;
+  float: left;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  /* border-radius: 20rpx;
+  margin-top: 36rpx; */
+}
+
+.touming-img{
+  opacity:0.6;
+  filter:alpha(opacity=60);
+}
 
 .a-popular .b .item {
   border-top: 1px solid #d9d9d9;

BIN
wx-mall/static/images/service-zswh.png