1
0
Просмотр исходного кода

新增了批次号管理;门店商品信息CRUD新增批次号,批次到期日期

hhq 4 лет назад
Родитель
Сommit
353a5467eb

+ 107 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsBatchController.java

@@ -0,0 +1,107 @@
+package com.kmall.admin.controller;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.service.GoodsBatchService;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import com.kmall.admin.entity.GoodsBatchEntity;
+
+/**
+ * 批次(多)— SKU(多)Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-06-13 09:58:15
+ */
+@Controller
+@RequestMapping("goodsbatch")
+public class GoodsBatchController {
+    @Autowired
+    private GoodsBatchService goodsBatchService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+//    @RequiresPermissions("goodsbatch:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<GoodsBatchEntity> goodsBatchList = goodsBatchService.queryList(query);
+        int total = goodsBatchService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(goodsBatchList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{id}")
+//    @RequiresPermissions("goodsbatch:info")
+    @ResponseBody
+    public R info(@PathVariable("id") Integer id) {
+        GoodsBatchEntity goodsBatch = goodsBatchService.queryObject(id);
+
+        return R.ok().put("goodsBatch", goodsBatch);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+//    @RequiresPermissions("goodsbatch:save")
+    @ResponseBody
+    public R save(@RequestBody GoodsBatchEntity goodsBatch) {
+        goodsBatchService.save(goodsBatch);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+//    @RequiresPermissions("goodsbatch:update")
+    @ResponseBody
+    public R update(@RequestBody GoodsBatchEntity goodsBatch) {
+        goodsBatchService.update(goodsBatch);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+//    @RequiresPermissions("goodsbatch:delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]ids) {
+        goodsBatchService.deleteBatch(ids);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<GoodsBatchEntity> list = goodsBatchService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+}

+ 15 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsBatchDao.java

@@ -0,0 +1,15 @@
+package com.kmall.admin.dao;
+
+import com.kmall.admin.entity.GoodsBatchEntity;
+import com.kmall.manager.dao.BaseDao;
+
+/**
+ * 批次(多)— SKU(多)Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-06-13 09:58:15
+ */
+public interface GoodsBatchDao extends BaseDao<GoodsBatchEntity> {
+
+}

+ 171 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/GoodsBatchEntity.java

@@ -0,0 +1,171 @@
+package com.kmall.admin.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 批次(多)— SKU(多)实体
+ * 表名 mall_goods_batch
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-06-13 09:58:15
+ */
+public class GoodsBatchEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     */
+    private Integer id;
+    /**
+     * 
+     */
+    private String batchSn;
+    /**
+     * 
+     */
+    private String sku;
+    /**
+     * 
+     */
+    private Date batchExpireDate;
+    /**
+     * 
+     */
+    private String createrSn;
+    /**
+     * 
+     */
+    private Date createTime;
+    /**
+     * 
+     */
+    private String moderSn;
+    /**
+     * 
+     */
+    private Date modTime;
+    /**
+     * 
+     */
+    private Date tstm;
+
+    /**
+     * 设置:
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:
+     */
+    public Integer getId() {
+        return id;
+    }
+    /**
+     * 设置:
+     */
+    public void setBatchSn(String batchSn) {
+        this.batchSn = batchSn;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getBatchSn() {
+        return batchSn;
+    }
+    /**
+     * 设置:
+     */
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getSku() {
+        return sku;
+    }
+    /**
+     * 设置:
+     */
+    public void setBatchExpireDate(Date batchExpireDate) {
+        this.batchExpireDate = batchExpireDate;
+    }
+
+    /**
+     * 获取:
+     */
+    public Date getBatchExpireDate() {
+        return batchExpireDate;
+    }
+    /**
+     * 设置:
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:
+     */
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
+    /**
+     * 获取:
+     */
+    public Date getModTime() {
+        return modTime;
+    }
+    /**
+     * 设置:
+     */
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    /**
+     * 获取:
+     */
+    public Date getTstm() {
+        return tstm;
+    }
+}

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

@@ -67,6 +67,7 @@ public class ProductStoreRelaEntity implements Serializable {
 
     private String sku;
     private String goodsBizType;
+    private String plu;
 
     private String createrSn;
 
@@ -128,6 +129,35 @@ public class ProductStoreRelaEntity implements Serializable {
 
     private String isHot;
 
+    //批次编号
+    private String batchSn;
+    //批次到期日期
+    private String batchExpireDate;
+
+    public String getBatchSn() {
+        return batchSn;
+    }
+
+    public void setBatchSn(String batchSn) {
+        this.batchSn = batchSn;
+    }
+
+    public String getBatchExpireDate() {
+        return batchExpireDate;
+    }
+
+    public void setBatchExpireDate(String batchExpireDate) {
+        this.batchExpireDate = batchExpireDate;
+    }
+
+    public String getPlu() {
+        return plu;
+    }
+
+    public void setPlu(String plu) {
+        this.plu = plu;
+    }
+
     public String getIsHot() {
         return isHot;
     }

+ 72 - 0
kmall-admin/src/main/java/com/kmall/admin/service/GoodsBatchService.java

@@ -0,0 +1,72 @@
+package com.kmall.admin.service;
+
+import com.kmall.admin.entity.GoodsBatchEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 批次(多)— SKU(多)Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-06-13 09:58:15
+ */
+public interface GoodsBatchService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param id 主键
+     * @return 实体
+     */
+    GoodsBatchEntity queryObject(Integer id);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<GoodsBatchEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param goodsBatch 实体
+     * @return 保存条数
+     */
+    int save(GoodsBatchEntity goodsBatch);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param goodsBatch 实体
+     * @return 更新条数
+     */
+    int update(GoodsBatchEntity goodsBatch);
+
+    /**
+     * 根据主键删除
+     *
+     * @param id
+     * @return 删除条数
+     */
+    int delete(Integer id);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param ids
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[] ids);
+}

+ 59 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsBatchServiceImpl.java

@@ -0,0 +1,59 @@
+package com.kmall.admin.service.impl;
+
+import com.kmall.admin.dao.GoodsBatchDao;
+import com.kmall.admin.service.GoodsBatchService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.entity.GoodsBatchEntity;
+
+/**
+ * 批次(多)— SKU(多)Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2020-06-13 09:58:15
+ */
+@Service("goodsBatchService")
+public class GoodsBatchServiceImpl implements GoodsBatchService {
+    @Autowired
+    private GoodsBatchDao goodsBatchDao;
+
+    @Override
+    public GoodsBatchEntity queryObject(Integer id) {
+        return goodsBatchDao.queryObject(id);
+    }
+
+    @Override
+    public List<GoodsBatchEntity> queryList(Map<String, Object> map) {
+        return goodsBatchDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return goodsBatchDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(GoodsBatchEntity goodsBatch) {
+        return goodsBatchDao.save(goodsBatch);
+    }
+
+    @Override
+    public int update(GoodsBatchEntity goodsBatch) {
+        return goodsBatchDao.update(goodsBatch);
+    }
+
+    @Override
+    public int delete(Integer id) {
+        return goodsBatchDao.delete(id);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]ids) {
+        return goodsBatchDao.deleteBatch(ids);
+    }
+}

+ 125 - 0
kmall-admin/src/main/resources/mybatis/mapper/GoodsBatchDao.xml

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.kmall.admin.dao.GoodsBatchDao">
+
+    <resultMap type="com.kmall.admin.entity.GoodsBatchEntity" id="goodsBatchMap">
+        <result property="id" column="id"/>
+        <result property="batchSn" column="batch_sn"/>
+        <result property="sku" column="sku"/>
+        <result property="batchExpireDate" column="batch_expire_date"/>
+        <result property="createrSn" column="creater_sn"/>
+        <result property="createTime" column="create_time"/>
+        <result property="moderSn" column="moder_sn"/>
+        <result property="modTime" column="mod_time"/>
+        <result property="tstm" column="tstm"/>
+    </resultMap>
+
+	<select id="queryObject" resultType="com.kmall.admin.entity.GoodsBatchEntity">
+		select
+			`id`,
+			`batch_sn`,
+			`sku`,
+			`batch_expire_date`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`
+		from mall_goods_batch
+		where id = #{id}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.admin.entity.GoodsBatchEntity">
+		select
+    		`id`,
+    		`batch_sn`,
+    		`sku`,
+    		`batch_expire_date`,
+    		`creater_sn`,
+    		`create_time`,
+    		`moder_sn`,
+    		`mod_time`,
+    		`tstm`
+		from mall_goods_batch
+		WHERE 1=1
+		<if test="batchSn != null and batchSn.trim() != ''">
+			AND batch_sn LIKE concat('%',#{batchSn},'%')
+		</if>
+		<if test="sku != null and sku.trim() != ''">
+			AND sku LIKE concat('%',#{sku},'%')
+		</if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+			<otherwise>
+                order by id desc
+			</otherwise>
+        </choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+	
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from mall_goods_batch
+		WHERE 1=1
+        <if test="batchSn != null and batchSn.trim() != ''">
+            AND batch_sn LIKE concat('%',#{batchSn},'%')
+        </if>
+		<if test="sku != null and sku.trim() != ''">
+			AND sku LIKE concat('%',#{sku},'%')
+		</if>
+	</select>
+	 
+	<insert id="save" parameterType="com.kmall.admin.entity.GoodsBatchEntity">
+		insert into mall_goods_batch(
+			`id`,
+			`batch_sn`,
+			`sku`,
+			`batch_expire_date`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`)
+		values(
+			#{id},
+			#{batchSn},
+			#{sku},
+			#{batchExpireDate},
+			#{createrSn},
+			#{createTime},
+			#{moderSn},
+			#{modTime},
+			#{tstm})
+	</insert>
+	 
+	<update id="update" parameterType="com.kmall.admin.entity.GoodsBatchEntity">
+		update mall_goods_batch 
+		<set>
+			<if test="batchSn != null">`batch_sn` = #{batchSn}, </if>
+			<if test="sku != null">`sku` = #{sku}, </if>
+			<if test="batchExpireDate != null">`batch_expire_date` = #{batchExpireDate}, </if>
+			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
+			<if test="createTime != null">`create_time` = #{createTime}, </if>
+			<if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
+			<if test="modTime != null">`mod_time` = #{modTime}, </if>
+			<if test="tstm != null">`tstm` = #{tstm}</if>
+		</set>
+		where id = #{id}
+	</update>
+	
+	<delete id="delete">
+		delete from mall_goods_batch where id = #{value}
+	</delete>
+	
+	<delete id="deleteBatch">
+		delete from mall_goods_batch where id in 
+		<foreach item="id" collection="array" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

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

@@ -42,6 +42,10 @@
         <result column="isStockShare" property="isStockShare" />
         <result column="goodsSellVolume" property="goodsSellVolume" />
         <result column="hot_sort_num" property="hotSortNum" />
+
+
+        <result column="batch_sn" property="batchSn" />
+        <result column="batch_expire_date" property="batchExpireDate" />
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
@@ -62,6 +66,8 @@
             a.create_time,
             a.moder_sn,
             a.mod_time,
+            a.`batch_sn`,
+            a.`batch_expire_date`,
             a.tstm,
             b.goods_sn goodsSn,
             c.goods_sn productSn,
@@ -153,6 +159,8 @@
         a.`market_price`,
         a.`stock_price`,
         a.`sell_volume`,
+        a.`batch_sn`,
+        a.`batch_expire_date`,
         b.is_hot 'isHot',
         b.is_on_sale 'isOnSale',
         b.sell_volume 'goodsSellVolume',
@@ -402,7 +410,13 @@
             moder_sn,
         </if>
         <if test="modTime != null" >
-            mod_time
+            mod_time,
+        </if>
+        <if test="batchSn != null" >
+            batch_sn,
+        </if>
+        <if test="batchExpireDate != null" >
+            batch_expire_date
         </if>
         )
 		values(
@@ -448,7 +462,13 @@
             #{moderSn,jdbcType=VARCHAR},
         </if>
         <if test="modTime != null" >
-            #{modTime,jdbcType=TIMESTAMP}
+            #{modTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="batchSn != null" >
+            #{batchSn,jdbcType=VARCHAR},
+        </if>
+        <if test="batchExpireDate != null" >
+            #{batchExpireDate,jdbcType=VARCHAR}
         </if>
         )
 	</insert>
@@ -500,6 +520,12 @@
             <if test="modTime != null" >
                 mod_time = #{modTime,jdbcType=TIMESTAMP},
             </if>
+            <if test="batchSn != null" >
+                batch_sn = #{batchSn,jdbcType=VARCHAR},
+            </if>
+            <if test="batchExpireDate != null" >
+                batch_expire_date = #{batchExpireDate,jdbcType=VARCHAR},
+            </if>
         </set>
         where id = #{id}
     </update>

+ 55 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/goodsbatch.html

@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>批次管理</title>
+    #parse("sys/header.html")
+</head>
+<body>
+<div id="rrapp" v-cloak>
+	<div v-show="showList">
+        <Row :gutter="16">
+            <div class="search-group">
+                <i-col span="4">
+                    <i-input v-model="q.batchSn" @on-enter="query" placeholder="批次编号"/>
+                </i-col>
+                <i-col span="4">
+                    <i-input v-model="q.sku" @on-enter="query" placeholder="sku"/>
+                </i-col>
+                <i-button @click="query">查询</i-button>
+                <i-button @click="reloadSearch">重置</i-button>
+            </div>
+            <div class="buttons-group">
+                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
+                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
+                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
+            </div>
+        </Row>
+	    <table id="jqGrid"></table>
+	    <div id="jqGridPager"></div>
+    </div>
+
+    <Card v-show="!showList">
+        <p slot="title">{{title}}</p>
+		<i-form ref="formValidate" :model="goodsBatch" :rules="ruleValidate" :label-width="80">
+            <Form-item label="批次编号" prop="batchSn">
+                <i-input v-model="goodsBatch.batchSn" placeholder=""/>
+            </Form-item>
+            <Form-item label="sku" prop="sku">
+                <i-input v-model="goodsBatch.sku" placeholder=""/>
+            </Form-item>
+            <Form-item label="批次到期时间" prop="batchExpireDate">
+                <i-input type='date' v-model="goodsBatch.batchExpireDate" placeholder=""/>
+            </Form-item>
+
+            <Form-item>
+                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
+                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
+                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
+            </Form-item>
+        </i-form>
+	</Card>
+</div>
+
+<script src="${rc.contextPath}/js/shop/goodsbatch.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 6 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/storeProductStock.html

@@ -203,6 +203,12 @@
                     </i-option>
                 </i-select>
             </Form-item>
+            <Form-item v-if="showInput" label="批次编号" prop="batchSn">
+                <i-input v-model="productStoreRela.batchSn" placeholder="批次编号" style="width: 268px;"/>
+            </Form-item>
+            <Form-item v-if="showInput" label="批次到期日期" prop="batchExpireDate">
+                <i-input type='date' v-model="productStoreRela.batchExpireDate" placeholder="批次到期日期" style="width: 268px;"/>
+            </Form-item>
             <Form-item v-if="showInputSpecification" label="规格" prop="specification">
                 <i-input v-model="productStoreRela.specification" placeholder="规格" style="width: 268px;"/>
             </Form-item>

+ 155 - 0
kmall-admin/src/main/webapp/js/shop/goodsbatch.js

@@ -0,0 +1,155 @@
+$(function () {
+    $("#jqGrid").jqGrid({
+        url: '../goodsbatch/list',
+        datatype: "json",
+        colModel: [
+			{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
+			{label: '批次编号', name: 'batchSn', index: 'batch_sn', width: 280},
+			{label: 'sku', name: 'sku', index: 'sku', width: 280},
+			{label: '批次到期日期', name: 'batchExpireDate', index: 'batch_expire_date', align: 'center',width: 280,formatter: function (value) {
+                    return transDate(value,'yyyy-MM-dd hh:mm:ss');
+                }}
+			// {label: '', name: 'createrSn', index: 'creater_sn', width: 80},
+			// {label: '', name: 'createTime', index: 'create_time', width: 80},
+			// {label: '', name: 'moderSn', index: 'moder_sn', width: 80},
+			// {label: '', name: 'modTime', index: 'mod_time', width: 80},
+			// {label: '', name: 'tstm', index: 'tstm', width: 80}
+			],
+		viewrecords: true,
+        height: 550,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        shrinkToFit: false,
+        autoScroll: true,   //开启水平滚动条
+        width: 1500,
+        multiselect: true,
+        pager: "#jqGridPager",
+        jsonReader: {
+            root: "page.list",
+            page: "page.currPage",
+            total: "page.totalPage",
+            records: "page.totalCount"
+        },
+        prmNames: {
+            page: "page",
+            rows: "limit",
+            order: "order"
+        },
+        gridComplete: function () {
+            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
+        }
+    });
+});
+
+let vm = new Vue({
+	el: '#rrapp',
+	data: {
+        showList: true,
+        title: null,
+		goodsBatch: {},
+		ruleValidate: {
+			name: [
+				{required: true, message: '名称不能为空', trigger: 'blur'}
+			]
+		},
+		q: {
+		    name: ''
+		}
+	},
+	methods: {
+		query: function () {
+			vm.reload();
+		},
+		add: function () {
+			vm.showList = false;
+			vm.title = "新增";
+			vm.goodsBatch = {};
+		},
+		update: function (event) {
+            let id = getSelectedRow();
+			if (id == null) {
+				return;
+			}
+			vm.showList = false;
+            vm.title = "修改";
+
+            vm.getInfo(id)
+		},
+		saveOrUpdate: function (event) {
+            let url = vm.goodsBatch.id == null ? "../goodsbatch/save" : "../goodsbatch/update";
+			$.ajax({
+				type: "POST",
+			    url: url,
+			    contentType: "application/json",
+			    data: JSON.stringify(vm.goodsBatch),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+			});
+		},
+		del: function (event) {
+            let ids = getSelectedRows();
+			if (ids == null){
+				return;
+			}
+
+			confirm('确定要删除选中的记录?', function () {
+				$.ajax({
+					type: "POST",
+				    url: "../goodsbatch/delete",
+				    contentType: "application/json",
+				    data: JSON.stringify(ids),
+				    success: function (r) {
+						if (r.code == 0) {
+							alert('操作成功', function (index) {
+								$("#jqGrid").trigger("reloadGrid");
+							});
+						} else {
+							alert(r.msg);
+						}
+					}
+				});
+			});
+		},
+		getInfo: function(id){
+			$.get("../goodsbatch/info/"+id, function (r) {
+                vm.goodsBatch = r.goodsBatch;
+            });
+		},
+        reloadSearch: function() {
+            vm.q = {
+                name: ''
+            }
+            vm.reload();
+		},
+		reload: function (event) {
+			vm.showList = true;
+            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
+			$("#jqGrid").jqGrid('setGridParam', {
+                postData: {
+                	'batchSn': vm.q.batchSn,
+                    'sku': vm.q.sku
+				},
+                page: page
+            }).trigger("reloadGrid");
+            vm.handleReset('formValidate');
+		},
+        handleSubmit: function (name) {
+            handleSubmitValidate(this, name, function () {
+                vm.saveOrUpdate()
+            });
+        },
+        handleReset: function (name) {
+            handleResetForm(this, name);
+        }
+	}
+});

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

@@ -25,6 +25,10 @@ $(function () {
             {label: '商品编码', name: 'goodsSn', index: 'goodsSn', width: 180, align: 'center'},
             {label: '名称', name: 'goodsName', index: 'goodsName', width: 500, align: 'left'},
             {label: '产品编码', name: 'productSn', index: 'productSn', width: 140, align: 'center'},
+            {label: '批次编号', name: 'batchSn', index: 'batchSn', width: 220, align: 'center'},
+            {label: '批次到期日期', name: 'batchExpireDate', index: 'batchExpireDate', width: 160, align: 'center',formatter: function (value) {
+                    return transDate(value,'yyyy-MM-dd hh:mm:ss');
+            }},
             {
                 label: '上架', name: 'isOnSale', index: 'is_on_sale', width: 80, align: 'center',
                 formatter: function (value) {