1
0
dq 6 rokov pred
rodič
commit
43cda187bf
23 zmenil súbory, kde vykonal 306 pridanie a 106 odobranie
  1. 8 0
      kmall-admin/src/main/java/com/kmall/admin/controller/AttributeController.java
  2. 9 5
      kmall-admin/src/main/java/com/kmall/admin/controller/CategoryController.java
  3. 2 1
      kmall-admin/src/main/java/com/kmall/admin/controller/UserController.java
  4. 30 0
      kmall-admin/src/main/java/com/kmall/admin/entity/OrderEntity.java
  5. 49 2
      kmall-admin/src/main/java/com/kmall/admin/service/impl/CategoryServiceImpl.java
  6. 11 11
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java
  7. 19 9
      kmall-admin/src/main/resources/mybatis/mapper/AttributeDao.xml
  8. 15 3
      kmall-admin/src/main/resources/mybatis/mapper/CategoryDao.xml
  9. 2 2
      kmall-admin/src/main/resources/mybatis/mapper/CouponDao.xml
  10. 3 0
      kmall-admin/src/main/resources/mybatis/mapper/FreightDao.xml
  11. 18 1
      kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml
  12. 3 0
      kmall-admin/src/main/resources/mybatis/mapper/GoodsGalleryDao.xml
  13. 16 3
      kmall-admin/src/main/resources/mybatis/mapper/OrderDao.xml
  14. 3 0
      kmall-admin/src/main/resources/mybatis/mapper/OrderRefundDao.xml
  15. 8 8
      kmall-admin/src/main/webapp/WEB-INF/page/shop/attribute.html
  16. 2 3
      kmall-admin/src/main/webapp/WEB-INF/page/shop/coupongrads.html
  17. 2 1
      kmall-admin/src/main/webapp/WEB-INF/page/shop/goods.html
  18. 7 3
      kmall-admin/src/main/webapp/js/shop/attribute.js
  19. 34 31
      kmall-admin/src/main/webapp/js/shop/coupongrads.js
  20. 36 20
      kmall-admin/src/main/webapp/js/shop/goods.js
  21. 24 2
      kmall-admin/src/main/webapp/js/shop/order.js
  22. 4 0
      kmall-admin/src/main/webapp/js/shop/orderrefund.js
  23. 1 1
      kmall-common/src/main/java/com/kmall/common/utils/print/ticket/TicketBuilder.java

+ 8 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/AttributeController.java

@@ -97,4 +97,12 @@ public class AttributeController {
 
         return R.ok().put("list", list);
     }
+
+    @RequestMapping("/query")
+    public R query(@RequestParam Map<String, Object> params) {
+
+        List<AttributeEntity> list = attributeService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
 }

+ 9 - 5
kmall-admin/src/main/java/com/kmall/admin/controller/CategoryController.java

@@ -124,8 +124,7 @@ public class CategoryController {
      * @return
      */
     @RequestMapping("/getCategorySelect")
-    public R getCategorySelect() {
-        Map<String, Object> map = new HashMap<>();
+    public R getCategorySelect(@RequestParam Map<String, Object> map) {
         map.put("parentId", "0");
         List<CategoryEntity> list = categoryService.queryList(map);
         return R.ok().put("list", list);
@@ -137,11 +136,10 @@ public class CategoryController {
      * @return
      */
     @RequestMapping("/getCategorySelectByParent")
-    public R getCategorySelectByParent(@RequestParam String parentId) {
+    public R getCategorySelectByParent(@RequestParam Map<String, Object> map) {
+        String parentId = map.get("parentId").toString();
         List<CategoryEntity> list = new ArrayList<>();
         if (StringUtils.isNotEmpty(parentId)) {
-            Map<String, Object> map = new HashMap<>();
-            map.put("parentId", parentId);
             list = categoryService.queryList(map);
         }
 
@@ -161,4 +159,10 @@ public class CategoryController {
         list.add(root);
         return R.ok().put("list", list);
     }
+
+    @RequestMapping("/getCategory")
+    public R getCategory(@RequestParam Map<String, Object> map) {
+        List<CategoryEntity> list = categoryService.queryList(map);
+        return R.ok().put("list", list);
+    }
 }

+ 2 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/UserController.java

@@ -123,13 +123,14 @@ public class UserController {
 
         ExcelExport ee = new ExcelExport("会员列表");
 
-        String[] header = new String[]{"会员名称", "性别", "会员级别", "手机号码"};
+        String[] header = new String[]{"会员微信名称", "会员名称", "性别", "会员级别", "手机号码"};
 
         List<Map<String, Object>> list = new ArrayList<>();
 
         if (userList != null && userList.size() != 0) {
             for (UserEntity userEntity : userList) {
                 LinkedHashMap<String, Object> map = new LinkedHashMap<>();
+                map.put("NICKNAME", userEntity.getUsername());
                 map.put("USERNAME", userEntity.getUsername());
                 map.put("GENDER", userEntity.getGender() == 1 ? "男" : (userEntity.getGender() == 2 ? "女" : "未知"));
                 map.put("LEVEL_NAME", userEntity.getLevelName());

+ 30 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OrderEntity.java

@@ -111,6 +111,36 @@ public class OrderEntity implements Serializable {
 
     private String orderBizType;
 
+    private String isPaymentSend;
+
+    private String isEleOrderSend;
+
+    private String isCustomsSend;
+
+    public String getIsPaymentSend() {
+        return isPaymentSend;
+    }
+
+    public void setIsPaymentSend(String isPaymentSend) {
+        this.isPaymentSend = isPaymentSend;
+    }
+
+    public String getIsEleOrderSend() {
+        return isEleOrderSend;
+    }
+
+    public void setIsEleOrderSend(String isEleOrderSend) {
+        this.isEleOrderSend = isEleOrderSend;
+    }
+
+    public String getIsCustomsSend() {
+        return isCustomsSend;
+    }
+
+    public void setIsCustomsSend(String isCustomsSend) {
+        this.isCustomsSend = isCustomsSend;
+    }
+
     public String getOrderBizType() {
         return orderBizType;
     }

+ 49 - 2
kmall-admin/src/main/java/com/kmall/admin/service/impl/CategoryServiceImpl.java

@@ -1,12 +1,16 @@
 package com.kmall.admin.service.impl;
 
 import com.kmall.admin.dao.CategoryDao;
+import com.kmall.admin.dao.GoodsDao;
 import com.kmall.admin.entity.CategoryEntity;
+import com.kmall.admin.entity.GoodsEntity;
 import com.kmall.admin.service.CategoryService;
 import com.kmall.api.contants.Dict;
+import com.kmall.common.utils.RRException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -21,6 +25,8 @@ import java.util.Map;
 public class CategoryServiceImpl implements CategoryService {
     @Autowired
     private CategoryDao categoryDao;
+    @Autowired
+    private GoodsDao goodsDao;
 
     @Override
     public CategoryEntity queryObject(Integer id) {
@@ -41,6 +47,10 @@ public class CategoryServiceImpl implements CategoryService {
     public int save(CategoryEntity category) {
         if (Dict.Level.item_L1.getItem().equals(category.getLevel())) {
             category.setParentId(0);
+        } else {
+            if (category.getParentId() == null) {
+                throw new RRException("请选择父级分类!");
+            }
         }
         return categoryDao.save(category);
     }
@@ -56,7 +66,44 @@ public class CategoryServiceImpl implements CategoryService {
     }
 
     @Override
-    public int deleteBatch(Integer[]ids) {
-        return categoryDao.deleteBatch(ids);
+    public int deleteBatch(Integer[] ids) {
+        for (Integer id : ids) {
+            CategoryEntity category = queryObject(id);
+            Map<String, Object> map = new HashMap<>();
+            if (category.getParentId() == 0) {
+                map.put("parentId", id);
+                List<CategoryEntity> categoryEntityList = queryList(map);
+
+                if (categoryEntityList != null && categoryEntityList.size() > 0) {
+                    int goodsTotal = 0;
+                    for (CategoryEntity categoryEntity : categoryEntityList) {
+                        map.clear();
+                        map.put("categoryId", categoryEntity.getId());
+                        List<GoodsEntity> goodsEntityList = goodsDao.queryList(map);
+                        if (goodsEntityList != null) {
+                            goodsTotal += goodsEntityList.size();
+                        }
+                    }
+
+                    if (goodsTotal > 0) {
+                        throw new RRException("【" + category.getName() + "】商品类型下还有【" + goodsTotal + "】个商品,无法删除!");
+                    } else {
+                        for (CategoryEntity categoryEntity : categoryEntityList) {
+                            delete(categoryEntity.getId());
+                        }
+                    }
+                }
+            } else{
+                map.clear();
+                map.put("categoryId",id);
+                List<GoodsEntity> goodsEntityList = goodsDao.queryList(map);
+                if (goodsEntityList != null && goodsEntityList.size() > 0) {
+                    throw new RRException("【" + category.getName() + "】商品类型下还有【" + goodsEntityList.size() + "】个商品,无法删除!");
+                }
+            }
+
+            delete(id);
+        }
+        return 1;
     }
 }

+ 11 - 11
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -33,7 +33,7 @@ public class GoodsServiceImpl implements GoodsService {
     @Autowired
     private GoodsAttributeDao goodsAttributeDao;
     @Autowired
-    private AttributeCategoryDao attributeCategoryDao;
+    private AttributeDao attributeDao;
     @Autowired
     private ProductDao productDao;
     @Autowired
@@ -157,12 +157,12 @@ public class GoodsServiceImpl implements GoodsService {
         if (attributeEntityList != null && attributeEntityList.size() > 0) {
             for (GoodsAttributeEntity item : attributeEntityList) {
                 if (item.getIsDelete() == 0) {
-                    if (item.getAttributeId() != null && StringUtils.isNotEmpty(item.getValue())) {
+                    if (item.getId() == null && item.getAttributeId() != null && StringUtils.isNotEmpty(item.getValue())) {
                         item.setGoodsId(id);
                         goodsAttributeDao.save(item);
-                    } else if (item.getAttributeId() != null && StringUtils.isNullOrEmpty(item.getValue())) {
-                        throw new RRException("商品属性【" + attributeCategoryDao.queryObject(item.getAttributeId()).getName() + "】值不能为空!");
-                    } else if (item.getAttributeId() == null) {
+                    } else if (item.getId() == null && item.getAttributeId() != null && StringUtils.isNullOrEmpty(item.getValue())) {
+                        throw new RRException("商品属性【" + attributeDao.queryObject(item.getAttributeId()).getName() + "】值不能为空!");
+                    } else if (item.getId() == null && item.getAttributeId() == null) {
                         continue;
                     }
                 }
@@ -280,14 +280,14 @@ public class GoodsServiceImpl implements GoodsService {
         if (attributeEntityList != null && attributeEntityList.size() > 0) {
             for (GoodsAttributeEntity item : attributeEntityList) {
                 if (item.getIsDelete() == 0) {
-                    if (item.getAttributeId() != null && StringUtils.isNotEmpty(item.getValue())) {
+                     if (item.getId() != null) {
+                        goodsAttributeDao.update(item);
+                    } else if (item.getId() == null && item.getAttributeId() != null && StringUtils.isNotEmpty(item.getValue())) {
                         item.setGoodsId(goods.getId());
                         goodsAttributeDao.save(item);
-                    } else if (item.getAttributeId() != null && StringUtils.isNullOrEmpty(item.getValue())) {
-                        throw new RRException("商品属性【" + attributeCategoryDao.queryObject(item.getAttributeId()).getName() + "】值不能为空!");
-                    } else if (item.getId() != null) {
-                        goodsAttributeDao.update(item);
-                    } else if (item.getAttributeId() == null) {
+                    } else if (item.getId() == null && item.getAttributeId() != null && StringUtils.isNullOrEmpty(item.getValue())) {
+                        throw new RRException("商品属性【" + attributeDao.queryObject(item.getAttributeId()).getName() + "】值不能为空!");
+                    } else if (item.getId() == null && item.getAttributeId() == null) {
                         continue;
                     }
                 } else if (item.getIsDelete() == 1) {

+ 19 - 9
kmall-admin/src/main/resources/mybatis/mapper/AttributeDao.xml

@@ -25,22 +25,22 @@
 	</select>
 
     <select id="queryList" resultType="com.kmall.admin.entity.AttributeEntity">
-        select
+        SELECT
         a.id,
         a.attribute_category_id,
-        a.name,
+        a.NAME,
         a.input_type,
-        a.value,
+        a.VALUE,
         a.sort_order,
-        ac.name category_name
-        from mall_attribute a LEFT JOIN mall_attribute_category ac
-        ON a.attribute_category_id = ac.id
+        c.NAME category_name
+        FROM mall_attribute a
+        LEFT JOIN mall_category c ON a.attribute_category_id = c.id
         WHERE 1=1
         <if test="name != null and name.trim() != ''">
             AND a.name LIKE concat('%', #{name},'%')
         </if>
         <if test="categoryName != null and categoryName.trim() != ''">
-            AND ac.name LIKE concat('%', #{categoryName},'%')
+            AND c.name LIKE concat('%', #{categoryName},'%')
         </if>
         <if test="attributeCategoryId != null and attributeCategoryId.trim() != ''">
             AND a.attribute_category_id = #{attributeCategoryId}
@@ -59,8 +59,18 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-		select count(*) from mall_attribute
-		WHERE 1=1
+		select count(*) from mall_attribute a
+        LEFT JOIN mall_category c ON a.attribute_category_id = c.id
+        WHERE 1=1
+        <if test="name != null and name.trim() != ''">
+            AND a.name LIKE concat('%', #{name},'%')
+        </if>
+        <if test="categoryName != null and categoryName.trim() != ''">
+            AND c.name LIKE concat('%', #{categoryName},'%')
+        </if>
+        <if test="attributeCategoryId != null and attributeCategoryId.trim() != ''">
+            AND a.attribute_category_id = #{attributeCategoryId}
+        </if>
 	</select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.AttributeEntity" useGeneratedKeys="true" keyProperty="id">

+ 15 - 3
kmall-admin/src/main/resources/mybatis/mapper/CategoryDao.xml

@@ -72,6 +72,9 @@
 		<if test="isShow != null and isShow != ''">
 			AND `is_show` = #{isShow}
 		</if>
+		<if test="isL2 != null and isL2 != ''">
+			AND `parent_id` != #{isL2}
+		</if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}
@@ -88,9 +91,18 @@
  	<select id="queryTotal" resultType="int">
 		select count(*) from mall_category
 		WHERE 1=1
-        <if test="name != null and name.trim() != ''">
-            AND name LIKE concat('%',#{name},'%')
-        </if>
+		<if test="name != null and name.trim() != ''">
+			AND `name` LIKE concat('%',#{name},'%')
+		</if>
+		<if test="parentId != null and parentId != ''">
+			AND `parent_id` = #{parentId}
+		</if>
+		<if test="isShow != null and isShow != ''">
+			AND `is_show` = #{isShow}
+		</if>
+		<if test="isL2 != null and isL2 != ''">
+			AND `parent_id` != #{isL2}
+		</if>
 	</select>
 	 
 	<insert id="save" parameterType="com.kmall.admin.entity.CategoryEntity">

+ 2 - 2
kmall-admin/src/main/resources/mybatis/mapper/CouponDao.xml

@@ -118,8 +118,8 @@
             <if test="sendEndDate != null">`send_end_date` = #{sendEndDate},</if>
             <if test="useStartDate != null">`use_start_date` = #{useStartDate},</if>
             <if test="useEndDate != null">`use_end_date` = #{useEndDate},</if>
-            <if test="minGoodsAmount != null">`min_goods_amount` = #{minGoodsAmount}</if>
-            <if test="isAll != null">`is_all` = #{isAll}</if>
+            <if test="minGoodsAmount != null">`min_goods_amount` = #{minGoodsAmount},</if>
+            <if test="isAll != null">`is_all` = #{isAll},</if>
         </set>
         where id = #{id}
     </update>

+ 3 - 0
kmall-admin/src/main/resources/mybatis/mapper/FreightDao.xml

@@ -88,6 +88,9 @@
         <if test="name != null and name.trim() != ''">
             AND name LIKE concat('%',#{name},'%')
         </if>
+		<if test="id != null and id != ''">
+			AND id NOT LIKE concat('%',#{id},'%')
+		</if>
 	</select>
 	 
 	<insert id="save" parameterType="com.kmall.admin.entity.FreightEntity" useGeneratedKeys="true" keyProperty="id">

+ 18 - 1
kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml

@@ -101,6 +101,9 @@
         <if test="freightId != null and freightId != ''">
             AND mall_goods.freight_id = #{freightId}
         </if>
+        <if test="categoryId != null and categoryId != ''">
+            AND mall_goods.category_id = #{categoryId}
+        </if>
         <if test="sku != null and sku != ''">
             AND mall_goods.sku LIKE concat('%',#{sku},'%')
         </if>
@@ -170,10 +173,24 @@
         <if test="name != null and name != ''">
             AND mall_goods.name LIKE concat('%',#{name},'%')
         </if>
+        <if test="freightId != null and freightId != ''">
+            AND mall_goods.freight_id = #{freightId}
+        </if>
+        <if test="categoryId != null and categoryId != ''">
+            AND mall_goods.category_id = #{categoryId}
+        </if>
         <if test="sku != null and sku != ''">
             AND mall_goods.sku LIKE concat('%',#{sku},'%')
         </if>
-        AND mall_goods.is_Delete = #{isDelete}
+        <if test="category != null and category != ''">
+            AND mall_goods.category_id IN (select id from mall_category where parent_id = #{category})
+        </if>
+        <if test="categoryTwo != null and categoryTwo != ''">
+            AND mall_goods.category_id = #{categoryTwo}
+        </if>
+        <if test="isDelete != null and isDelete != ''">
+            AND mall_goods.is_Delete = #{isDelete}
+        </if>
     </select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.GoodsEntity" useGeneratedKeys="true" keyProperty="id">

+ 3 - 0
kmall-admin/src/main/resources/mybatis/mapper/GoodsGalleryDao.xml

@@ -59,6 +59,9 @@
         <if test="goodsName != null and goodsName.trim() != ''">
             AND mall_goods.name LIKE concat('%',#{goodsName},'%')
         </if>
+        <if test="goodsId != null">
+            AND mall_goods_gallery.goods_id = #{goodsId}
+        </if>
     </select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.GoodsGalleryEntity" useGeneratedKeys="true" keyProperty="id">

+ 16 - 3
kmall-admin/src/main/resources/mybatis/mapper/OrderDao.xml

@@ -48,6 +48,9 @@
         <result property="deliveryRemark" column="delivery_remark"/>
         <result property="predictTime" column="predict_time"/>
         <result property="orderBizType" column="order_biz_type"/>
+        <result property="isPaymentSend" column="is_payment_send"/>
+        <result property="isEleOrderSend" column="is_ele_order_send"/>
+        <result property="isCustomsSend" column="is_customs_send"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.OrderEntity">
@@ -70,9 +73,16 @@
     </select>
 
     <select id="queryList" resultType="com.kmall.admin.entity.OrderEntity">
-        select o.*,u.username as username
-        from mall_order o
-        left join mall_user u on o.user_id = u.id
+        SELECT
+        o.*,
+        u.username AS username,
+        p.is_payment_send,
+        p.is_ele_order_send,
+        p.is_customs_send
+        FROM
+        mall_order o
+        LEFT JOIN mall_user u ON o.user_id = u.id
+        LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
         WHERE 1=1
         <if test="orderSn != null and orderSn.trim() != ''">
             AND o.order_sn LIKE concat('%',#{orderSn},'%')
@@ -128,6 +138,9 @@
         <if test="orderType != null and orderType.trim() != ''">
             AND o.order_type = #{orderType}
         </if>
+        <if test="ids != null and ids.trim() != ''">
+            AND o.id in (${ids})
+        </if>
     </select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.OrderEntity" useGeneratedKeys="true" keyProperty="id">

+ 3 - 0
kmall-admin/src/main/resources/mybatis/mapper/OrderRefundDao.xml

@@ -119,6 +119,9 @@
         <if test="orderSn != null and orderSn.trim() != ''">
             AND o.order_sn LIKE concat('%',#{orderSn},'%')
         </if>
+        <if test="userName != null and userName.trim() != ''">
+            AND u.username LIKE concat('%',#{userName},'%')
+        </if>
         <if test="orderId != null">
             AND o.id = #{orderId}
         </if>

+ 8 - 8
kmall-admin/src/main/webapp/WEB-INF/page/shop/attribute.html

@@ -13,7 +13,7 @@
                     <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
                 </i-col>
                 <i-col span="4">
-                    <i-input v-model="q.categoryName" @on-enter="query" placeholder="所属类"/>
+                    <i-input v-model="q.categoryName" @on-enter="query" placeholder="所属类"/>
                 </i-col>
                 <i-button @click="query">查询</i-button>
             </div>
@@ -39,18 +39,18 @@
             <Form-item label="名称" prop="name">
                 <i-input v-model="attribute.name" placeholder="名称"/>
             </Form-item>
-            <Form-item label="所属种类" prop="attributeCategoryId" style="width: 268px;">
+            <Form-item label="所属分类" prop="attributeCategoryId">
                 <i-select v-model="attribute.attributeCategoryId" filterable>
                     <i-option v-for="category in categories" :value="category.id" :key="category.id">{{category.name}}
                     </i-option>
                 </i-select>
             </Form-item>
-            <!--<Form-item label="类型" prop="inputType">-->
-            <!--<i-input v-model="attribute.inputType" placeholder="类型"/>-->
-            <!--</Form-item>-->
-            <!--<Form-item label="值" prop="value">-->
-            <!--<i-input v-model="attribute.value" placeholder="值"/>-->
-            <!--</Form-item>-->
+            <!--<Form-item label="类型" prop="inputType">
+            <i-input v-model="attribute.inputType" placeholder="类型"/>
+            </Form-item>
+            <Form-item label="值" prop="value">
+            <i-input v-model="attribute.value" placeholder="值"/>
+            </Form-item>-->
             <Form-item label="排序" prop="sortOrder">
                 <Input-number :min="0" :step="1" v-model="attribute.sortOrder" placeholder="排序" style="width: 188px;"/>
             </Form-item>

+ 2 - 3
kmall-admin/src/main/webapp/WEB-INF/page/shop/coupongrads.html

@@ -41,8 +41,7 @@
             <Form-item label="优惠券名称" prop="name">
                 <i-input v-model="coupon.name" placeholder="优惠券名称"/>
             </Form-item>
-
-            <Form-item label="状态" prop="status">
+            <!--<Form-item label="状态" prop="status">
                 <Radio-group v-model="coupon.status">
                     <Radio label="1">
                         <span>正常</span>
@@ -51,7 +50,7 @@
                         <span>失效</span>
                     </Radio>
                 </Radio-group>
-            </Form-item>
+            </Form-item>-->
             <Form-item label="赠送金额" prop="typeMoney">
                 <Input-number :min="0" v-model="coupon.typeMoney" placeholder="赠送金额" style="width: 188px;"/>
             </Form-item>

+ 2 - 1
kmall-admin/src/main/webapp/WEB-INF/page/shop/goods.html

@@ -104,6 +104,7 @@
         <Tabs value="name1">
             <Tab-Pane label="通用信息" name="name1">
                 <!--<i-form ref="formValidate" :model="goods" :rules="ruleValidate" :label-width="80">-->
+                <span style="margin-left: 142px; font-size: 12px; color: red;">修改商品二级分类将清空商品参数列表</span>
                     <Form-item label="商品类型" prop="categoryId">
                         <!--<i-input v-model="goods.categoryName" @on-click="categoryTree" icon="eye" readonly="readonly" placeholder="商品类型"/>-->
                         <i-select v-model="goods.attributeCategory" placeholder="商品分类" filterable @on-change="changeCategories"
@@ -112,7 +113,7 @@
                                       :key="category.id">{{category.name}}
                             </i-option>
                         </i-select>
-                        <i-select v-model="goods.categoryId" placeholder="商品二级分类" filterable
+                        <i-select v-model="goods.categoryId" placeholder="商品二级分类" filterable @on-change="getAttributes"
                                   label-in-value style="width: 268px;">
                             <i-option v-for="category in categoriesTwo" :value="category.id"
                                       :key="category.id">{{category.name}}

+ 7 - 3
kmall-admin/src/main/webapp/js/shop/attribute.js

@@ -4,7 +4,7 @@ $(function () {
         datatype: "json",
         colModel: [
             {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
-            {label: '所属类', name: 'categoryName', index: 'attribute_category_id', width: 80},
+            {label: '所属类', name: 'categoryName', index: 'attribute_category_id', width: 80},
             {label: '名称', name: 'name', index: 'name', width: 80},
             // {label: '类型', name: 'inputType', index: 'input_type', width: 80},
             // {label: '值', name: 'value', index: 'value', width: 80},
@@ -41,10 +41,13 @@ var vm = new Vue({
     data: {
         showList: true,
         title: null,
-        attribute: {},
+        attribute: { sortOrder: '' },
         ruleValidate: {
             name: [
                 {required: true, message: '名称不能为空', trigger: 'blur'}
+            ],
+            attributeCategoryId: [
+                {required: true, message: '所属分类不能为空', trigger: 'blur'}
             ]
         },
         q: {
@@ -61,6 +64,7 @@ var vm = new Vue({
             vm.showList = false;
             vm.title = "新增";
             vm.attribute = {};
+            vm.attribute = { sortOrder: '' };
             vm.categories = [];
             this.getCategories();
         },
@@ -132,7 +136,7 @@ var vm = new Vue({
             vm.handleReset('formValidate');
         },
         getCategories: function () {
-            $.get("../attributecategory/queryAll", function (r) {
+            $.get("../category/getCategory?isL2=0", function (r) {
                 vm.categories = r.list;
             });
         },

+ 34 - 31
kmall-admin/src/main/webapp/js/shop/coupongrads.js

@@ -13,43 +13,46 @@ $(function () {
         colModel: [
             {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
             {label: '优惠券名称', name: 'name', index: 'name', width: 120},
-            // {
-            //     label: '优惠券类型', name: 'couponType', index: 'couponType', width: 80, formatter: function (value) {
-            //     if (value == 0) {
-            //         return '通用优惠券';
-            //     } else if (value == 1) {
-            //         return '门店优惠券';
-            //     } else if (value == 2) {
-            //         return '产品优惠券';
-            //     }
-            //     return '-';
-            // }
-            // },
-            {
-                label: '状态', name: 'status', index: 'status', width: 50, formatter: function (value) {
-                if (value == 0) {
-                    return '失效';
-                } else if (value == 1) {
-                    return '正常';
+            /*{
+                label: '优惠券类型', name: 'couponType', index: 'couponType', width: 80,
+                formatter: function (value) {
+                    if (value == 0) {
+                        return '通用优惠券';
+                    } else if (value == 1) {
+                        return '门店优惠券';
+                    } else if (value == 2) {
+                        return '产品优惠券';
+                    }
+                    return '-';
                 }
-                return '-';
-            }
-            },
+            },*/
+            /*{
+                label: '状态', name: 'status', index: 'status', width: 50,
+                formatter: function (value) {
+                    if (value == 0) {
+                        return '失效';
+                    } else if (value == 1) {
+                        return '正常';
+                    }
+                    return '-';
+                }
+            },*/
             {label: '订单最小金额', name: 'minAmount', index: 'minAmount', width: 80},
             {label: '订单最大金额', name: 'maxAmount', index: 'maxAmount', width: 80},
             {label: '金额', name: 'typeMoney', index: 'type_money', width: 80},
             // {label: '最小商品金额', name: 'minGoodsAmount', index: 'min_goods_amount', width: 80},
             {label: '有效天数', name: 'invalidDays', index: 'invalidDays', width: 80},
-            // {
-            //     label: '操作', width: 70, align: 'center', sortable: false, formatter: function (value, col, row) {
-            //     if (row.couponType == 1) {
-            //         return '<button class="btn btn-outline btn-info ivu-btn-small" onclick="vm.lookCouponStoreList(' + row.id + ',\'' + row.name + '\')"><i class="fa fa-info-circle"></i>&nbsp;门店列表</button>&nbsp;';
-            //     } else if (row.couponType == 2) {
-            //         return '<button class="btn btn-outline btn-info ivu-btn-small" onclick="vm.lookCouponProductList(' + row.id + ',\'' + row.name + '\')"><i class="fa fa-info-circle"></i>&nbsp;产品列表</button>&nbsp;';
-            //     }
-            //     return '';
-            // }
-            // }
+            /*{
+                label: '操作', width: 70, align: 'center', sortable: false,
+                    formatter: function (value, col, row) {
+                    if (row.couponType == 1) {
+                        return '<button class="btn btn-outline btn-info ivu-btn-small" onclick="vm.lookCouponStoreList(' + row.id + ',\'' + row.name + '\')"><i class="fa fa-info-circle"></i>&nbsp;门店列表</button>&nbsp;';
+                    } else if (row.couponType == 2) {
+                        return '<button class="btn btn-outline btn-info ivu-btn-small" onclick="vm.lookCouponProductList(' + row.id + ',\'' + row.name + '\')"><i class="fa fa-info-circle"></i>&nbsp;产品列表</button>&nbsp;';
+                    }
+                    return '';
+                }
+            }*/
         ]
     });
 });

+ 36 - 20
kmall-admin/src/main/webapp/js/shop/goods.js

@@ -143,7 +143,8 @@ var vm = new Vue({
         specifications: [],
         brands: [],
         freights: [],
-        showInput: true
+        showInput: true,
+        categoryId: ''
     },
     methods: {
         delSpeRow: function (index) {
@@ -196,12 +197,9 @@ var vm = new Vue({
             vm.brands = [];
             vm.freights = [];
             vm.attributeEntityList = [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}];
-            vm.attributeCategories = [];
             vm.getMacro();
             vm.getBrand();
             vm.getFreights();
-            vm.getAttributeCategories();
-            vm.getAttributes();
             vm.showInput = true;
         },
         update: function (event) {
@@ -213,22 +211,19 @@ var vm = new Vue({
             vm.title = "修改";
             vm.uploadList = [];
             vm.getInfo(id);
+            var opt = {};
+            opt.value = vm.goods.categoryId;
+            opt.flag = 1;
+            vm.getAttributes(opt);
             vm.getMacro();
             vm.getBrand();
             vm.getFreights();
-            vm.getAttributeCategories();
             vm.getGoodsGallery(id);
-            vm.getAttributes();
             vm.showInput = true;
             if (vm.goods.goodsBizType == '10' || vm.goods.goodsBizType == '02') {
                 vm.showInput = false;
             }
         },
-        getAttributes: function () {
-            $.get("../attribute/queryAll", function (r) {
-                vm.attributes = r.list;
-            });
-        },
         getMacro: function () {
             // 获取货品业务类型
             $.get("../sys/macro/queryMacrosByValue?value=goodsBizType", function (r) {
@@ -251,11 +246,6 @@ var vm = new Vue({
                 vm.uploadList = r.list;
             });
         },
-        getAttributeCategories: function () {
-            $.get("../attributecategory/queryAll", function (r) {
-                vm.attributeCategories = r.list;
-            });
-        },
         saveOrUpdate: function (event) {
             var url = vm.goods.id == null ? "../goods/save" : "../goods/update";
             vm.goods.goodsDesc = $('#goodsDesc').editable('getHTML');
@@ -374,8 +364,10 @@ var vm = new Vue({
         getInfo: function (id) {
             $.get("../goods/info/" + id, function (r) {
                 vm.goods = r.goods;
+                vm.categoryId = r.goods.categoryId;
                 // vm.getCategory();
-                var opt = {}; opt.value = vm.goods.attributeCategory;
+                var opt = {};
+                opt.value = vm.goods.attributeCategory;
                 vm.changeCategories(opt);
                 if (r.goods.attributeEntityList.length > 0) {
                     vm.attributeEntityList = r.goods.attributeEntityList;
@@ -387,6 +379,7 @@ var vm = new Vue({
                 } else {
                     vm.productEntityList = [{'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0}];
                 }
+
                 $('#goodsDesc').editable('setHTML', vm.goods.goodsDesc);
             });
         },
@@ -458,12 +451,33 @@ var vm = new Vue({
             var value = opt.value;
             $.get("../category/getCategorySelectByParent?parentId=" + value, function (r) {
                 vm.queryCategoriesTwo = r.list;
-                // vm.reload();
             });
         },
+        getAttributes: function (opt) {
+            var value = opt.value;
+            $.get("../attribute/query?attributeCategoryId=" + value, function (r) {
+                vm.attributes = r.list;
+            });
+
+            if (opt.flag != 1 && !(value === vm.categoryId)) {
+                if (vm.attributeEntityList.length > 0) {
+                    for (var i = 0; i < vm.attributeEntityList.length; i++) {
+                        if (!(vm.attributeEntityList[0].attributeId === '')) {
+                            vm.attributeEntityList[i].isDelete = 1;
+                        }
+                    }
+
+                    var goodsId = '';
+                    if (vm.goods) {
+                        goodsId = vm.goods.id;
+                    }
+                    vm.attributeEntityList.unshift({'id': '', 'goodsId': goodsId, 'attributeId': '', 'value': '', 'isDelete': 0});
+                }
+            }
+        },
         changeCategories: function (opt) {
             var value = opt.value;
-            $.get("../category/getCategorySelectByParent?parentId=" + value, function (r) {
+            $.get("../category/getCategorySelectByParent?isShow=1&parentId=" + value, function (r) {
                 vm.categoriesTwo = r.list;
             });
         },
@@ -559,7 +573,9 @@ var vm = new Vue({
         // this.uploadList = this.$refs.upload.fileList;
         $.get("../category/getCategorySelect", function (r) {
             vm.queryCategories = r.list;
+        });
+        $.get("../category/getCategorySelect?isShow=1", function (r) {
             vm.categories = r.list;
-        })
+        });
     }
 });

+ 24 - 2
kmall-admin/src/main/webapp/js/shop/order.js

@@ -115,7 +115,10 @@ $(function () {
                             htmlStr += '<button class="btn btn-outline btn-primary" onclick="vm.printDetail(' + row.id + ')"><i class="fa fa-print"></i>打印</button>&nbsp;';
                         }
                         if (row.orderStatus == 0) {
-                            htmlStr += '<button class="btn btn-outline btn-danger" onclick="vm.refundUpdate(' + row.id + ')"><i class="fa fa-times-circle-o"></i>&nbsp;取消</button>&nbsp;';
+                            htmlStr += '<button class="btn btn-outline btn-danger" onclick="vm.cancelUpdate(' + row.id + ')"><i class="fa fa-times-circle-o"></i>&nbsp;取消</button>&nbsp;';
+                        }
+                        if (row.isPaymentSend == 0 || row.isEleOrderSend == 0  || row.isCustomsSend == 0) {
+                            htmlStr += '<button class="btn btn-outline btn-danger" onclick="vm.refundUpdate(' + row.id + ')"><i class="fa fa-times-circle-o"></i>&nbsp;退款</button>&nbsp;';
                         }
                     }
                     return htmlStr;
@@ -345,7 +348,7 @@ let vm = new Vue({
                 }
             });
         },
-        refundUpdate: function (rowId) {
+        cancelUpdate: function (rowId) {
             let params = {};
             params.orderId = rowId;
 
@@ -363,6 +366,25 @@ let vm = new Vue({
                     }
                 }
             });
+        },
+        refundUpdate: function (rowId) {
+            let params = {};
+            params.orderId = rowId;
+
+            $.ajax({
+                type: "POST",
+                url: '../order/refund',
+                data: params,
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('取消成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+            });
         }
     },
     created: function () {

+ 4 - 0
kmall-admin/src/main/webapp/js/shop/orderrefund.js

@@ -41,6 +41,10 @@ $(function () {
                         return '退款成功';
                     } else if (value == '3') {
                         return '已拒绝';
+                    } else if (value == '4') {
+                        return '微信退款失败';
+                    } else if (value == '5') {
+                        return '微信退款处理中';
                     }
                     return value;
                 }

+ 1 - 1
kmall-common/src/main/java/com/kmall/common/utils/print/ticket/TicketBuilder.java

@@ -64,7 +64,7 @@ public class TicketBuilder implements Printable {
         //获取字体的高度
         float fontHeigthTit = fontTit.getSize2D();
 
-        yIdx += (y + fontHeigthTit);
+        yIdx += (fontHeigthTit);
         //yIdx += y;
         g2.drawString(ticket.getTicketHead().getTitle(), xIdx + 50, yIdx);