Преглед изворни кода

小程序分类前端修改

hyq пре 6 година
родитељ
комит
8c65084b2e

+ 10 - 0
kmall-api/src/main/java/com/kmall/api/entity/GoodsVo.java

@@ -101,6 +101,16 @@ public class GoodsVo implements Serializable {
 
     private BigDecimal goodsRate;
 
+    private Integer stockNum;
+
+    public Integer getStockNum() {
+        return stockNum;
+    }
+
+    public void setStockNum(Integer stockNum) {
+        this.stockNum = stockNum;
+    }
+
     public BigDecimal getGoodsRate() {
         return goodsRate;
     }

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

@@ -45,6 +45,7 @@
         <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
         <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
         <result property="goodsRate" column="goods_rate"/>
+        <result property="stockNum" column="stock_num"/>
     </resultMap>
 
     <sql id="Base_Column_List" >
@@ -109,8 +110,9 @@
         <if test="fields == null or fields == ''">
             a.*
         </if>
+        ,psr1.stock_num
         from mall_goods a
-        LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id AND a.primary_product_id = psr1.product_id
+        LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id
         LEFT JOIN mall_product b ON b.id = psr1.product_id
         where 1 = 1 and a.is_delete != 1 and psr1.stock_num > 0 and a.is_on_sale = 1
         <if test="is_new != null and is_new != ''">
@@ -227,7 +229,7 @@
     </select>
 
     <select id="queryCatalogProductList" resultMap="goodsMap">
-        select a.id, a.name, a.list_pic_url, psr1.market_price, psr1.retail_price, a.goods_brief, b.id AS product_id
+        select a.id, a.name, a.list_pic_url, psr1.market_price, psr1.retail_price, a.goods_brief, b.id AS product_id,psr1.stock_num
         <if test="is_group != null and is_group == true">
            ,gg.id as group_id
         </if>

+ 120 - 0
kmall-gen/kmall-gen.iml

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="Spring" name="Spring">
+      <configuration />
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="kmall-common" />
+    <orderEntry type="library" name="Maven: com.qiniu:qiniu-java-sdk:7.2.17" level="project" />
+    <orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.9.1" level="project" />
+    <orderEntry type="library" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
+    <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.2" level="project" />
+    <orderEntry type="library" name="Maven: com.aliyun.oss:aliyun-sdk-oss:2.5.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.4.1" level="project" />
+    <orderEntry type="library" name="Maven: org.jdom:jdom:1.1" level="project" />
+    <orderEntry type="library" name="Maven: net.sf.json-lib:json-lib:jdk15:2.4" level="project" />
+    <orderEntry type="library" name="Maven: net.sf.ezmorph:ezmorph:1.0.6" level="project" />
+    <orderEntry type="library" name="Maven: com.qcloud:cos_api:4.4" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.1" level="project" />
+    <orderEntry type="library" name="Maven: org.json:json:20140107" level="project" />
+    <orderEntry type="library" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.5.0" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.5.0" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.5.0" level="project" />
+    <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
+    <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi:3.15" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.15" level="project" />
+    <orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.15" level="project" />
+    <orderEntry type="library" name="Maven: redis.clients:jedis:2.8.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:guava:17.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.3.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
+    <orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.1" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.0" level="project" />
+    <orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.4.1.Final" level="project" />
+    <orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
+    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aspects:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.9" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:4.3.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.19" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.7.19" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.19" level="project" />
+    <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: org.logback-extensions:logback-ext-spring:0.1.5" level="project" />
+    <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.6.3" level="project" />
+    <orderEntry type="library" name="Maven: org.mariadb.jdbc:mariadb-java-client:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.39" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba:druid:1.0.28" level="project" />
+    <orderEntry type="module-library">
+      <library name="Maven: com.alibaba:jconsole:1.8.0">
+        <CLASSES>
+          <root url="jar://D:/Program Files/Java/jdk1.8.0_131/lib/jconsole.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Maven: com.alibaba:tools:1.8.0">
+        <CLASSES>
+          <root url="jar://D:/Program Files/Java/jdk1.8.0_131/lib/tools.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
+    <orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.1" level="project" />
+    <orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.30" level="project" />
+    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
+    <orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.10" level="project" />
+    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
+    <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
+    <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.3.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring:1.3.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-web:1.3.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.axet:kaptcha:0.0.9" level="project" />
+    <orderEntry type="library" name="Maven: com.jhlabs:filters:2.0.235" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.velocity:velocity-tools:2.0" level="project" />
+    <orderEntry type="library" name="Maven: commons-digester:commons-digester:1.8" level="project" />
+    <orderEntry type="library" name="Maven: jstl:jstl:1.2" level="project" />
+    <orderEntry type="library" name="Maven: taglibs:standard:1.1.2" level="project" />
+    <orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.23" level="project" />
+  </component>
+</module>

+ 25 - 20
wx-mall/pages/catalog/catalog.js

@@ -138,24 +138,25 @@ Page({
   },
   getGoodsList() {
     var that = this;
-    console.log(that.data);
-    util.request(api.CatalogProductList, {
-      page: that.data.page,
-      size: that.data.size,
-      order: that.data.currentSortOrder,
-      sort: that.data.currentSortType,
-      // discount: that.data.filterDiscount,
-      goodsBizType: that.data.goodsBizType,
-      categoryId: that.data.currentCategory.id
-    })
-      .then(function (res) {
-        if (res.errno === 0) {
-          that.setData({
-            goodsList: res.data.data,
-            filterCategory: res.data.filterCategory
-          });
-        }
-      });
+    if (that.data.currentCategory){
+      util.request(api.CatalogProductList, {
+        page: that.data.page,
+        size: that.data.size,
+        order: that.data.currentSortOrder,
+        sort: that.data.currentSortType,
+        // discount: that.data.filterDiscount,
+        goodsBizType: that.data.goodsBizType,
+        categoryId: that.data.currentCategory.id
+      })
+        .then(function (res) {
+          if (res.errno === 0) {
+            that.setData({
+              goodsList: res.data.data,
+              filterCategory: res.data.filterCategory
+            });
+          }
+        });
+    }
   },
   getFootCart: function () {
     let that = this;
@@ -192,6 +193,9 @@ Page({
           if (val.product_id == productId) {
             val.cart_num = res.data;
             goodsList[index] = val;
+            if(val.cart_num == 0){
+              util.showErrorToast('不能再减了');
+            }
           }
         }, that);
         that.setData({ goodsList: goodsList });
@@ -334,12 +338,13 @@ Page({
   sercherCategory: function (e) {
     var that = this;
     let url = '';
-    var id = e.currentTarget.dataset.replyType;
+    var replyType = e.currentTarget.dataset.replyType;
+    var currentIndex = e.currentTarget.dataset.currentIndex;
     // console.log('replyType:' + e.currentTarget.dataset.replyType);
     // console.log('goodsBizType:' + that.data.goodsBizType);
     // 跳转页面
     wx.navigateTo({
-      url: '/pages/category/category?id=' + id + '&&goodsBizType=' + that.data.goodsBizType
+      url: '/pages/category/category?id=' + replyType + '&&goodsBizType=' + that.data.goodsBizType + '&&currentIndex=' + currentIndex
     })
 
   }

+ 20 - 15
wx-mall/pages/catalog/catalog.wxml

@@ -84,18 +84,18 @@
         <image class="image" wx:if="{{currentCategory.wap_banner_url}}" src="{{currentCategory.wap_banner_url}}"></image>
         <view class="txt">{{currentCategory.front_name}}</view>
       </navigator>
-      <view class="hd">
+      <view class="hd" wx:if="{{currentCategory}}">
         <text class="line"></text>
         <text class="txt">{{currentCategory.name}}分类</text>
         <text class="line"></text>
       </view>
       <view class="bd">
-        <navigator bindtap="sercherCategory" data-reply-Type="{{item.id}}" class="item {{(index+1) % 3 == 0 ? 'last' : ''}}" wx:for="{{currentCategory.subCategoryList}}" wx:key="{{item.id}}">
+        <navigator bindtap="sercherCategory" data-reply-Type="{{item.id}}" data-current-Index="{{index}}" class="item {{(index+1) % 3 == 0 ? 'last' : ''}}" wx:for="{{currentCategory.subCategoryList}}" wx:key="{{item.id}}">
           <image class="icon" wx:if="{{item.wap_banner_url}}" src="{{item.wap_banner_url}}"></image>
-          <text class="txt">{{item.name}}</text>
+          <text class="txt">{{item.name?item.name:""}}</text>
         </navigator>
       </view>
-      <view class="sort">
+      <view class="sort" wx:if="{{goodsList.length > 0 }}">
         <view class="sort-box">
           <view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
             <text class="txt">综合</text>
@@ -109,36 +109,41 @@
         </view>
       </view>
       <view class="cate-item">
-        <view wx:if="{{goodsList.length == 0}}" class="item-text">未找到相关商品</view>
+        <view wx:if="{{goodsList != null && goodsList.length == 0}}" class="item-text">未找到相关商品</view>
         <view class="item" wx:for="{{goodsList}}" wx:for-index="index" wx:for-item="item" wx:key="{{item.id}}">
-          <navigator url="{{filterDiscount != 2 ?'/pages/goods/goods?id='+item.id:'/pages/groupDetail/groupDetail?id='+item.group_id }}">
+          <navigator url="/pages/goods/goods?id='+{{item.id}}">
             <view class="left">
               <image class="img" wx:if="{{item.list_pic_url}}" src="{{item.list_pic_url}}"></image>
             </view>
+          </navigator>
 
           <view class="right">
             <view class="text">
 
-                <text class="name" bindtap="bindtapGoodsDetail" data-item-id="{{filterDiscount != 2?item.id:item.group_id}}">{{item.name}}</text>
-                <text class="desc" bindtap="bindtapGoodsDetail" data-item-id="{{filterDiscount != 2?item.id:item.group_id}}">{{item.goods_brief}}</text>
+          <navigator url="/pages/goods/goods?id='+{{item.id}}">
+            <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>
 
 
-              <view class="goods-do">
-                <text class="price">¥{{item.retail_price}}</text>
-                <text class="org-price line-through">¥{{item.market_price}}</text>
-                <!-- //数量加减 -->
-                <view class="number-item">
+          <view class="goods-do">
+            <navigator url="/pages/goods/goods?id='+{{item.id}}">
+              <text class="price">¥{{item.retail_price}}</text>
+              <text class="org-price line-through">¥{{item.market_price}}</text>
+            </navigator>
+            <!-- //数量加减 -->
+            <view class="number-item">
                   <view class="selnum">
                     <view class="cut" data-goods-id="{{item.id}}" data-product-id="{{item.product_id}}" bindtap="cutNumber"></view>
                     <input value="{{item.cart_num}}" class="number" disabled="true" type="number" />
-                    <view class="add" data-goods-id="{{item.id}}" data-product-id="{{item.product_id}}" bindtap="addNumber"></view>
+                    <!-- <view class="add" data-goods-id="{{item.id}}" data-product-id="{{item.product_id}}" bindtap="addNumber"></view> -->
+                    <image class="add2" src="{{item.cart_num < item.stockNum ? '/static/images/service-hsjh.png':'/static/images/service-ehsjh.png'}}" data-goods-id="{{item.id}}" data-product-id="{{item.product_id}}"  catchtap="{{item.cart_num < item.stockNum ?  'addNumber' : ''}}"></image>
                   </view>
                 </view>
               </view>
             </view>
 
           </view>
-        </navigator>
 
         </view>
       </view>

+ 7 - 0
wx-mall/pages/catalog/catalog.wxss

@@ -440,4 +440,11 @@ page {
     filter:alpha(opacity=10);
     -moz-opacity:10;
     opacity:10;
+}
+.add2 {
+  box-sizing:border-box;
+  width:25px;
+  border:none;
+  border-radius:50%;
+  height:25px;
 }

+ 72 - 75
wx-mall/pages/category/category.js

@@ -32,12 +32,16 @@ Page({
     },
     // 滚动切换标签样式
     switchTab: function (e) {
-        let that = this;
+      let that = this;
+      that.setData({
+        goodsList: []
+      });
         //当页面改变是会触发
-        console.log("scrollLeft:" + that.data.scrollLeft);
+      console.log("e.detail.current:" + e.detail.current);
         this.setData({
             currentTab: e.detail.current
         });
+      // console.log("currentTab:" + that.data.currentTab);
         if (that.data.navIndex == e.detail.current) {
             this.setData({
                 navIndex: -1
@@ -68,33 +72,37 @@ Page({
         // 页面初始化 options为页面跳转所带来的参数
       var that = this; 
       if (options.id) {
-            that.setData({
-                id: parseInt(options.id)
-            });
-        } else {
-            that.setData({
-                id: 0,
-                currentCategory: {},
-                goodsList: [],
-            });
-        }
+        that.setData({
+          id: parseInt(options.id)
+        });
+      } else {
+        that.setData({
+          id: 0,
+          currentCategory: {}
+        });
+      }
       if (options.goodsBizType) {
         that.setData({
           goodsBizType: options.goodsBizType
         });
-      } 
-        wx.getSystemInfo({
-            success: function (res) {
-                var clientHeight = res.windowHeight,
-                    clientWidth = res.windowWidth,
-                    rpxR = 750 / clientWidth;
-                var calc = clientHeight * rpxR - 180;
-                that.setData({
-                    scrollHeight: calc
-                });
-            }
+      }
+      if (options.currentIndex) {
+        that.setData({
+          currentTab: options.currentIndex
         });
-        this.getCategoryInfo();
+      }
+      wx.getSystemInfo({
+        success: function (res) {
+          var clientHeight = res.windowHeight,
+          clientWidth = res.windowWidth,
+          rpxR = 750 / clientWidth;
+          var calc = clientHeight * rpxR - 180;
+          that.setData({
+            scrollHeight: calc
+          });
+        }
+      });
+      this.getCategoryInfo();
     },
     getFootCart: function () {
         let that = this;
@@ -107,42 +115,37 @@ Page({
         });
     },
     getCategoryInfo: function () {
-        let that = this;
-      console.log('idd:' + that.data.id);
+      let that = this;
       util.request(api.GoodsCategory, { id: that.data.id, goodsBizType: that.data.goodsBizType})
         .then(function (res) {
-                if (res.errno == 0) {
-                    that.setData({
-                        navList: res.data.brotherCategory,
-                        currentCategory: res.data.currentCategory
-                    });
-
-                    //nav位置
-                    let currentIndex = 0;
-                    let navListCount = that.data.navList.length;
-                    for (let i = 0; i < navListCount; i++) {
-                        currentIndex += 1;
-                        if (that.data.navList[i].id == that.data.id) {
-                            break;
-                        }
-                    }
-                    if (currentIndex > navListCount / 2 && navListCount > 5) {
-                        that.setData({
-                            scrollLeft: currentIndex * 60
-                        });
-                    }
-                    that.setData({
-                        currentTab: currentIndex,
-                        navIndex: currentIndex
-                  });
-                    that.getGoodsList();
-                } else {
-                    //显示错误信息
-                }
-
+          if (res.errno == 0) {
+            that.setData({
+              navList: res.data.brotherCategory,
+              currentCategory: res.data.currentCategory
             });
-    }
-    ,
+            //nav位置
+            let currentIndex = that.data.currentTab;
+            let navListCount = that.data.navList.length;
+            for (let i = 0; i < navListCount; i++) {
+              if (that.data.navList[i].id == that.data.id) {
+                break;
+              }
+            }
+            if (currentIndex > navListCount / 2 && navListCount > 5) {
+              that.setData({
+                scrollLeft: currentIndex * 60
+              });
+            }
+            that.setData({
+              currentTab: currentIndex,
+              navIndex: currentIndex
+            });
+            that.getGoodsList();
+          } else {
+            //显示错误信息
+          }
+        });
+    },
     refreshCategoryInfo: function () {
         let that = this;
         util.request(api.GoodsCategory, {id: this.data.id})
@@ -157,39 +160,31 @@ Page({
                     //显示错误信息
                 }
             });
-    }
-    ,
+    },
     onReady: function () {
         // 页面渲染完成
-    }
-    ,
+    },
     onShow: function () {
         // 页面显示
         this.getFootCart();
-    }
-    ,
+    },
     onHide: function () {
         // 页面隐藏
-    }
-    ,
+    },
     getGoodsList: function () {
         var that = this;
-
-        console.log('goodsBizType13:' + that.data.goodsBizType);
       util.request(api.GoodsList, { categoryId: that.data.id, goodsBizType: that.data.goodsBizType, page: that.data.page, size: that.data.size})
             .then(function (res) {
-                let goodsList = that.data.goodsList;
-                goodsList = goodsList.concat(res.data.data);
+              let goodsList = that.data.goodsList.concat(res.data.data);
                 that.setData({
                     goodsList: goodsList,
-                });
+              });
+              console.log(that.data.goodsList);
             });
-    }
-    ,
+    },
     onUnload: function () {
         // 页面关闭
-    }
-    ,
+    },
     switchAttrPop: function () {
         this.setData({
             openAttr: !this.data.openAttr
@@ -313,7 +308,9 @@ Page({
         that.setData({
             goodsList: [],
             page: 1,
-        })
+            currentTab: event.currentTarget.dataset.current
+        });
+        console.log("currentIndex:" + that.data.currentTab);
         var clientX = event.detail.x;
         var currentTarget = event.currentTarget;
         if (clientX < 60) {

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

@@ -56,19 +56,18 @@
       </view>
     </scroll-view>
   </view>
-
-  <swiper class="" current="{{currentTab}}" bindchange="switchTab" scroll-top="{{scrollTop}}" style="height:{{scrollHeight}}px;">
+  <swiper class="" current="{{currentTab}}"  scroll-top="{{scrollTop}}" style="height:{{scrollHeight}}px;">
     <swiper-item wx:for="{{navList}}"  wx:key="{{navIndex}}">
       <scroll-view scroll-y="true" class="cate-item">
         <view class="h">
           <text class="name">{{currentCategory.name}}</text>
-          <text class="desc">{{currentCategory.front_name}}</text>
+          <text class="desc">{{currentCategory.front_name?currentCategory.front_name:""}}</text>
         </view>
         <view class="b">
           <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}}">
+              <navigator url="../goods/goods?id={{iitem.id}}&&currentIndex={{navIndex}}">
                 <image class="img" src="{{iitem.list_pic_url}}" background-size="cover"></image>
                 <text class="name">{{iitem.name}}</text>
               </navigator>
@@ -80,10 +79,7 @@
           </block>
         </view>
       </scroll-view>
-
-
     </swiper-item>
-
   </swiper>
 
    <view wx:if="{{openAttr}}" class="attr-pop">

+ 2 - 2
wx-mall/pages/goods/goods.wxml

@@ -53,8 +53,8 @@
           <text class="price">¥{{goods.retail_price}}</text>
           <text class="org-price line-through">¥{{goods.market_price}}</text>
         </view>
-        <text class="name">{{goods.name}}</text>
-        <text class="desc">{{goods.goods_brief}}</text>
+        <text class="name">{{goods.name?goods.name:""}}</text>
+        <text class="desc">{{goods.goods_brief?goods.goods_brief:""}}</text>
         <!-- <view class="brand" wx:if="{{brand.name}}">
           <navigator url="../brandDetail/brandDetail?id={{brand.id}}">
             <text>{{brand.name}}</text>

+ 1 - 1
wx-mall/pages/goods/goods.wxss

@@ -331,7 +331,7 @@
 
 .goods-attr .right {
   float: left;
-  font-size: 36.5rpx;
+  font-size: 26rpx;
   margin-left: 20rpx;
   width: 480rpx;
   height: 45rpx;

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

@@ -165,8 +165,8 @@
         <view class="right">
           <view class="text">
             <navigator url="/pages/goods/goods?id={{item.id}}">
-              <text class="name">{{item.name}}</text>
-              <text class="desc">{{item.goods_brief}}</text>
+              <text class="name">{{item.name?item.name:""}}</text>
+              <text class="desc">{{item.goods_brief?item.goods_brief:""}}</text>
             </navigator>
             <view class="goods-do">
               <text class="price">¥{{item.retail_price}}</text>

+ 7 - 5
wx-mall/pages/ucenter/idCard/idCard.js

@@ -37,11 +37,13 @@ Page({
         that.setData({
           curUser: res.data
         });
-        that.setData({
-          idNoM: that.formatidcard(res.data.idNo),
-          idNo: res.data.idNo,
-          userName: res.data.username
-        });
+        if (res.data.idNo){
+          that.setData({
+            idNoM: that.formatidcard(res.data.idNo),
+            idNo: res.data.idNo,
+            userName: res.data.username
+          });
+        }
       }
     });
   },

+ 8 - 6
wx-mall/pages/ucenter/index/index.js

@@ -44,12 +44,14 @@ Page({
     // 查询骑手信息
     util.request(api.UcenterIndex, {}).then(function (res) {
       if (res.errno === 0) {
-        that.setData({
-          unPayNum: res.data.countMap.unPayNum,
-          unPaymentNum: res.data.countMap.unPaymentNum,
-          unTakeNum: res.data.countMap.unTakeNum,
-          unEvalNum: res.data.countMap.unEvalNum
-        });
+        if (res.data.countMap.orders > 0){
+          that.setData({
+            unPayNum: res.data.countMap.unPayNum,
+            unPaymentNum: res.data.countMap.unPaymentNum,
+            unTakeNum: res.data.countMap.unTakeNum,
+            unEvalNum: res.data.countMap.unEvalNum
+          });
+        }
       }
     });
   },

+ 1 - 1
wx-mall/project.config.json

@@ -8,7 +8,7 @@
 		"newFeature": true
 	},
 	"compileType": "miniprogram",
-	"libVersion": "1.9.97",
+	"libVersion": "2.3.2",
 	"appid": "wx0686d352293be639",
 	"projectname": "kmall-mp",
 	"condition": {