Sfoglia il codice sorgente

商品全景图的进销存管理

zcb 4 anni fa
parent
commit
6967a87b6f

+ 20 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java

@@ -660,7 +660,7 @@ public class OrderController {
         Query query = new Query(params);
         query.put("isOnfiilineOrder", Dict.isOnfflineOrder.item_1.getItem());
         List<OrderEntity> orderList = orderService.queryOffilineOrderList(query);
-        int total = orderService.queryTotal(query);
+        int total = orderService.queryOffilineOrderTotal(query);
 
         // 遍历循环订单是哪个店员销售的,根据订单号查询
 
@@ -1000,4 +1000,23 @@ public class OrderController {
     }
 
 
+    @RequestMapping("/purchaseSalesInStockDetail")
+//    @RequiresPermissions("order:offilineOrderList")
+    public R purchaseSalesInStockDetail(@RequestParam Map<String, Object> params) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<PurchaseSalesInStockDetail> orderList = orderService.purchaseSalesInStockDetailList(query);
+        int total = orderService.purchaseSalesInStockDetailTotal(query);
+
+        // 遍历循环订单是哪个店员销售的,根据订单号查询
+
+        PageUtils pageUtil = new PageUtils(orderList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+
+
 }

+ 7 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/OrderDao.java

@@ -3,8 +3,10 @@ package com.kmall.admin.dao;
 import com.kmall.admin.dto.OrderRecognitionDto;
 import com.kmall.admin.dto.SendTempDto;
 import com.kmall.admin.entity.OrderEntity;
+import com.kmall.admin.entity.PurchaseSalesInStockDetail;
 import com.kmall.admin.entity.RealtimeSalesDetection;
 import com.kmall.api.entity.OrderVo;
+import com.kmall.common.utils.Query;
 import org.apache.ibatis.annotations.Param;
 import com.kmall.manager.dao.BaseDao;
 
@@ -109,4 +111,9 @@ public interface OrderDao extends BaseDao<OrderEntity> {
     //实时销售监测
     RealtimeSalesDetection queryRealtimeSales(Map realtimeSalesDetection);
 
+    int queryOffilineOrderTotal(Query query);
+
+    List<PurchaseSalesInStockDetail> purchaseSalesInStockDetailList(Query query);
+
+    int purchaseSalesInStockDetailTotal(Query query);
 }

+ 126 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/PurchaseSalesInStockDetail.java

@@ -0,0 +1,126 @@
+package com.kmall.admin.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * @author Scott
+ * @email
+ * @date 2017-08-13 10:41:09
+ */
+public class PurchaseSalesInStockDetail implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private String orderSn;
+    private String time;
+    private String type;
+    private String addNum;
+    private String lessNum;
+    private String endingInventory;
+    private String inventory;
+    private String costPrice;
+    private String retailPrice;
+    private String addAmount;
+    private String lessAmount;
+    private String price;
+
+    public String getOrderSn() {
+        return orderSn;
+    }
+
+    public void setOrderSn(String orderSn) {
+        this.orderSn = orderSn;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    public void setTime(String time) {
+        this.time = time;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getAddNum() {
+        return addNum;
+    }
+
+    public void setAddNum(String addNum) {
+        this.addNum = addNum;
+    }
+
+    public String getLessNum() {
+        return lessNum;
+    }
+
+    public void setLessNum(String lessNum) {
+        this.lessNum = lessNum;
+    }
+
+    public String getEndingInventory() {
+        return endingInventory;
+    }
+
+    public void setEndingInventory(String endingInventory) {
+        this.endingInventory = endingInventory;
+    }
+
+    public String getInventory() {
+        return inventory;
+    }
+
+    public void setInventory(String inventory) {
+        this.inventory = inventory;
+    }
+
+    public String getCostPrice() {
+        return costPrice;
+    }
+
+    public void setCostPrice(String costPrice) {
+        this.costPrice = costPrice;
+    }
+
+    public String getRetailPrice() {
+        return retailPrice;
+    }
+
+    public void setRetailPrice(String retailPrice) {
+        this.retailPrice = retailPrice;
+    }
+
+    public String getAddAmount() {
+        return addAmount;
+    }
+
+    public void setAddAmount(String addAmount) {
+        this.addAmount = addAmount;
+    }
+
+    public String getLessAmount() {
+        return lessAmount;
+    }
+
+    public void setLessAmount(String lessAmount) {
+        this.lessAmount = lessAmount;
+    }
+
+    public String getPrice() {
+        return price;
+    }
+
+    public void setPrice(String price) {
+        this.price = price;
+    }
+}

+ 19 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/SaleRecordEntity.java

@@ -30,11 +30,14 @@ public class SaleRecordEntity implements Serializable {
      * 店员id
      */
     private String sallerId;
+    private String sallerName;
     /**
      * 活动id
      */
     private String discountId;
     private String discountName;
+
+    private String storeName;
     /**
      * 销售时间
      */
@@ -211,4 +214,20 @@ public class SaleRecordEntity implements Serializable {
     public void setDiscountName(String discountName) {
         this.discountName = discountName;
     }
+
+    public String getSallerName() {
+        return sallerName;
+    }
+
+    public void setSallerName(String sallerName) {
+        this.sallerName = sallerName;
+    }
+
+    public String getStoreName() {
+        return storeName;
+    }
+
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
 }

+ 8 - 4
kmall-admin/src/main/java/com/kmall/admin/service/OrderService.java

@@ -2,11 +2,9 @@ package com.kmall.admin.service;
 
 import com.kmall.admin.dto.OrderExpressDto;
 import com.kmall.admin.dto.OrderRecognitionDto;
-import com.kmall.admin.entity.OfflineCartEntity;
-import com.kmall.admin.entity.OrderEntity;
-import com.kmall.admin.entity.OrderRefundEntity;
-import com.kmall.admin.entity.WxOrderEntity;
+import com.kmall.admin.entity.*;
 import com.kmall.admin.fromcomm.entity.SysUserEntity;
+import com.kmall.common.utils.Query;
 import com.kmall.manager.manager.alipay.AliPayMicropayApiResult;
 import com.kmall.manager.manager.wechat.wxglobal.dto.WechatGlobalRefundApiResult;
 import com.kmall.common.utils.print.ticket.item.Ticket;
@@ -147,4 +145,10 @@ public interface OrderService {
     OrderEntity queryObjectByOrderSn(String orderSn);
 
     void orderRefund(OrderEntity orderInfo, String sessionId) throws Exception;
+
+    int queryOffilineOrderTotal(Query query);
+
+    List<PurchaseSalesInStockDetail> purchaseSalesInStockDetailList(Query query);
+
+    int purchaseSalesInStockDetailTotal(Query query);
 }

+ 15 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -2258,6 +2258,21 @@ public class OrderServiceImpl implements OrderService {
 
     }
 
+    @Override
+    public int queryOffilineOrderTotal(Query query) {
+        return orderDao.queryOffilineOrderTotal(query);
+    }
+
+    @Override
+    public List<PurchaseSalesInStockDetail> purchaseSalesInStockDetailList(Query query) {
+        return orderDao.purchaseSalesInStockDetailList(query);
+    }
+
+    @Override
+    public int purchaseSalesInStockDetailTotal(Query query) {
+        return orderDao.purchaseSalesInStockDetailTotal(query);
+    }
+
 
     /**
      * 设置订单数据

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

@@ -410,21 +410,24 @@
             AND o.id in (${ids})
         </if>
     </select>
+
     <select id="queryOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
         SELECT distinct
         o.*,
-        u.username AS username,
+        u.username AS userName,
         p.is_payment_send,
         p.is_ele_order_send,
         p.is_customs_send,
         s.store_name storeName
         FROM
         mall_order o
-        LEFT JOIN sys_user u ON o.user_id = u.user_id
+
         LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
         LEFT JOIN mall_order_goods g ON o.id = g.order_id
         left join mall_store s on o.store_id = s.id
         LEFT JOIN mall_goods gs ON g.goods_id = gs.id
+        left join mall_sale_record record on record.order_sn = o.order_sn
+        LEFT JOIN sys_user u ON record.saller_id = u.user_id
         WHERE 1=1
         <if test="storeId != null and storeId != ''">
             AND o.store_id = #{storeId}
@@ -433,7 +436,7 @@
             AND o.merch_sn = #{merchSn}
         </if>
         <if test="goodsSn != null and goodsSn.trim() != ''">
-            AND gs.goodsSn = #{goodsSn}
+            AND gs.goods_sn = #{goodsSn}
         </if>
         <if test="sku != null and sku.trim() != ''">
             AND gs.sku = #{sku}
@@ -481,6 +484,71 @@
         </if>
     </select>
 
+    <select id="queryOffilineOrderTotal" resultType="int">
+        select count(DISTINCT o.id) FROM
+        mall_order o
+        LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
+        LEFT JOIN mall_order_goods g ON o.id = g.order_id
+        left join mall_store s on o.store_id = s.id
+        LEFT JOIN mall_goods gs ON g.goods_id = gs.id
+        left join mall_sale_record record on record.order_sn = o.order_sn
+        LEFT JOIN sys_user u ON record.saller_id = u.user_id
+        WHERE 1=1
+        <if test="storeId != null and storeId != ''">
+            AND o.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND o.merch_sn = #{merchSn}
+        </if>
+        <if test="goodsSn != null and goodsSn.trim() != ''">
+            AND gs.goods_sn = #{goodsSn}
+        </if>
+        <if test="sku != null and sku.trim() != ''">
+            AND gs.sku = #{sku}
+        </if>
+        <if test="prodBarcode != null and prodBarcode.trim() != ''">
+            AND gs.prod_barcode = #{prodBarcode}
+        </if>
+        <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
+            AND s.third_party_merch_code = #{thirdPartyMerchCode}
+        </if>
+        <if test="orderSn != null and orderSn.trim() != ''">
+            AND o.order_sn LIKE concat('%',#{orderSn},'%')
+        </if>
+        <if test="shippingStatus != null and shippingStatus.trim() != ''">
+            AND o.shipping_status = #{shippingStatus}
+        </if>
+        <if test="payStatus != null and payStatus.trim() != ''">
+            AND o.pay_status = #{payStatus}
+        </if>
+        <if test="orderStatus != null and orderStatus.trim() != ''">
+            AND o.order_status = #{orderStatus}
+        </if>
+        <if test="shippingId != null and shippingId != 0">
+            AND o.shipping_id = #{shippingId}
+        </if>
+        <if test="orderType != null and orderType.trim() != ''">
+            AND o.order_type = #{orderType}
+        </if>
+        <if test="isOnfiilineOrder != null">
+            AND o.is_onffline_order = #{isOnfiilineOrder}
+        </if>
+        <if test="ids != null and ids.trim() != ''">
+            AND o.id in (${ids})
+        </if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+            <otherwise>
+                order by o.id desc
+            </otherwise>
+        </choose>
+        <if test="offset != null and limit != null">
+            limit #{offset}, #{limit}
+        </if>
+    </select>
+
     <insert id="save" parameterType="com.kmall.api.entity.OrderVo" useGeneratedKeys="true" keyProperty="id">
 		insert into mall_order
 		(
@@ -1632,4 +1700,75 @@
                 AND (c.parent_id = #{categoryId} or c.id = #{categoryId})
             </if>
     </select>
+
+
+    <select id="purchaseSalesInStockDetailList" resultType="com.kmall.admin.entity.PurchaseSalesInStockDetail">
+        select
+        substr(msmc.create_time,1,10) as time,
+        if(msmc.change_type = 1 ,'销售','期初') as type,
+        sum(if((msmc.change_type = 2 or msmc.change_type = 3 ),msmc.store_change_num,0)) as addNum,
+        sum(if(msmc.change_type = 1 ,msmc.store_change_num,0)) as lessNum,
+        rela.stock_num as endingInventory,
+        rela.stock_num as inventory,
+        0 as costPrice,
+        rela.retail_price as retailPrice,
+        0 as addAmount,
+        sum(if(msmc.change_type = 1 ,msmc.store_change_num,0)*rela.retail_price) as lessAmount,
+        0 as price
+        from mall_product_store_rela rela
+        left join mall_store_mng_change  msmc on msmc.goods_id = rela.goods_id
+        left join mall_goods g on g.id = msmc.goods_id
+        WHERE 1=1 and msmc.creater_sn <![CDATA[ <> ]]> '定时任务'
+        <if test="storeId != null and storeId != ''">
+            AND rela.store_id = #{storeId}
+        </if>
+        <if test="goodsSn != null and goodsSn.trim() != ''">
+            AND g.goods_sn = #{goodsSn}
+        </if>
+        <if test="prodBarcode != null and prodBarcode.trim() != ''">
+            AND g.prod_barcode = #{prodBarcode}
+        </if>
+        <if test="startTime != null and startTime.trim() != ''">
+            AND substr(msmc.create_time,1,10) <![CDATA[ >= ]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime.trim() != ''">
+            AND substr(msmc.create_time,1,10) <![CDATA[ <= ]]> #{endTime}
+        </if>
+
+        group by substr(msmc.create_time,1,10)
+        <if test="offset != null and limit != null">
+            limit #{offset}, #{limit}
+        </if>
+
+    </select>
+
+    <select id="purchaseSalesInStockDetailTotal" resultType="int">
+        select count(1) from ( select count(DISTINCT rela.id)
+        from mall_product_store_rela rela
+        left join mall_store_mng_change  msmc on msmc.goods_id = rela.goods_id
+        left join mall_goods g on g.id = msmc.goods_id
+        WHERE 1=1 and msmc.creater_sn <![CDATA[ <> ]]> '定时任务'
+        <if test="storeId != null and storeId != ''">
+            AND rela.store_id = #{storeId}
+        </if>
+        <if test="goodsSn != null and goodsSn.trim() != ''">
+            AND g.goods_sn = #{goodsSn}
+        </if>
+        <if test="sku != null and sku.trim() != ''">
+            AND g.sku = #{sku}
+        </if>
+        <if test="prodBarcode != null and prodBarcode.trim() != ''">
+            AND g.prod_barcode = #{prodBarcode}
+        </if>
+        <if test="startTime != null and startTime.trim() != ''">
+            AND substr(msmc.create_time,1,10) <![CDATA[ >= ]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime.trim() != ''">
+            AND substr(msmc.create_time,1,10) <![CDATA[ <= ]]> #{endTime}
+        </if>
+
+        group by substr(msmc.create_time,1,10)
+        ) b
+    </select>
+
 </mapper>

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

@@ -47,9 +47,15 @@
     		record.moder_sn,
     		record.mod_time,
     		record.tstm,
-    		topic.title as discountName
+    		topic.title as discountName,
+    		su.username as sallerName,
+    		store.store_name as storeName
 		from mall_sale_record record
+		left join sys_user su on su.user_id = record.saller_id
+		left join mall_store store on su.store_id = store.id
 		left join mall_store_topic topic on topic.id = record.discount_id
+
+
 		WHERE 1=1
 		<if test="name != null and name.trim() != ''">
 			AND name LIKE concat('%',#{name},'%')
@@ -68,7 +74,10 @@
 	</select>
 
  	<select id="queryTotal" resultType="int">
-		select count(*) from mall_sale_record
+		select count(*) from mall_sale_record record
+		left join sys_user su on su.user_id = record.saller_id
+		left join mall_store store on su.store_id = store.id
+		left join mall_store_topic topic on topic.id = record.discount_id
 		WHERE 1=1
         <if test="name != null and name.trim() != ''">
             AND name LIKE concat('%',#{name},'%')

+ 1 - 0
kmall-admin/src/main/resources/spring/spring-shiro.xml

@@ -71,6 +71,7 @@
                 /js/**=anon
                 /qz/**=anon
                 /login.html=anon
+                /userLogin.html=anon
                 /cus/send=anon
                 /cus/platDataOpen=anon
                 /sys/login=anon

+ 10 - 0
kmall-admin/src/main/webapp/WEB-INF/page/sale/goodsPanorama.html

@@ -217,6 +217,16 @@
                 <div id="barcodeJqGridPager"><div class="ui-jqgrid-bdiv frozen-div"></div></div>
             </Tab-Pane>
             <Tab-Pane label="进销存明细查询" name="detail">
+                <div class="search-group">
+                    <i-col span="3">
+                        <Date-picker v-model="q.startTime" placeholder="创建订单开始时间"/>
+                    </i-col>
+                    <i-col span="3">
+                        <Date-picker v-model="q.endTime" placeholder="创建订单结束时间"/>
+                    </i-col>
+                    <i-button @click="queryDetail">查询</i-button>
+                </div>
+
                 <table id="detailJqGrid"></table>
                 <div id="detailJqGridPager"><div class="ui-jqgrid-bdiv frozen-div"></div></div>
             </Tab-Pane>

+ 2 - 0
kmall-admin/src/main/webapp/js/cashier/salerecord.js

@@ -7,6 +7,8 @@ $(function () {
 			{label: '订单编号', name: 'orderSn', index: 'order_sn',align: 'center', width: 200},
 			{label: '收银机编号', name: 'cashierSn', index: 'cashier_sn',align: 'center', width: 120},
 			{label: '店员id', name: 'sallerId', index: 'saller_id',align: 'center', width: 120},
+			{label: '店员名称', name: 'sallerName', index: 'sallerName',align: 'center', width: 120},
+			{label: '门店名称', name: 'storeName', index: 'storeName',align: 'center', width: 120},
 			{label: '活动id', name: 'discountId', index: 'discount_id', align: 'center', width: 120,formatter:function(value){
 				console.log(typeof value);
 				if(value === '0'){

+ 91 - 4
kmall-admin/src/main/webapp/js/sale/goodsPanorama.js

@@ -317,6 +317,53 @@ $(function () {
     });
 
 
+
+
+    $("#detailJqGrid").jqGrid({
+        url: '../order/purchaseSalesInStockDetail',
+        datatype: "json",
+        colModel: [
+            {label: '单据号', name: 'storeName', index: 'storeName',align: 'center', width: 120},
+            {label: '日期', name: 'time', index: 'time',align: 'center', width: 120},
+            {label: '方式', name: 'type', index: 'type',align: 'center', width: 120},
+            {label: '数量(+)', name: 'addNum', index: 'addNum',align: 'center', width: 120},
+            {label: '数量(-)', name: 'lessNum', index: 'lessNum',align: 'center', width: 120},
+            {label: '期末库存', name: 'endingInventory', index: 'endingInventory',align: 'center', width: 120},
+            {label: '应存数量', name: 'inventory', index: 'inventory',align: 'center', width: 120},
+            {label: '成本价', name: 'costPrice', index: 'costPrice',align: 'center', width: 120},
+            {label: '售价', name: 'retailPrice', index: 'retailPrice',align: 'center', width: 120},
+            {label: '金额(+)进价', name: 'addAmount', index: 'addAmount',align: 'center', width: 120},
+            {label: '金额(-)进价', name: 'lessAmount', index: 'lessAmount',align: 'center', width: 120},
+            {label: '期末金额', name: 'price', index: 'price',align: 'center', width: 120},
+        ],
+        viewrecords: true,
+        height: 550,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        shrinkToFit: false,
+        autoScroll: true,   //开启水平滚动条
+        width: 1500,
+        pager: "#detailJqGridPager",
+        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"});
+        }
+    });
+
+
 });
 
 var ztree;
@@ -347,7 +394,7 @@ var vm = new Vue({
         goods: {primaryPicUrl: '', listPicUrl: '',videoUrl:'', categoryId: '', isOnSale: 1, isAppExclusive: 0, isLimited: 0, isHot: 0, categoryName: '', retailPrice: '', marketPrice: '', goodsRate: '', sortOrder: '',goodsNumber: '' },
         ruleValidate: {
         },
-        q: {name: '', goodsSn: '', prodBarcode: '',goodsBizType:'', merchSn: '',thirdPartyMerchCode:''},
+        q: {name: '', goodsSn: '', prodBarcode: '',goodsBizType:'', merchSn: '',thirdPartyMerchCode:'',startTime:'',endTime:''},
         attributes: [],
         attributeEntityList: [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}],
         productEntityList: [{'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0}],
@@ -435,8 +482,6 @@ var vm = new Vue({
                 vm.showInput = false;
             }
             vm.price();
-            vm.discount();
-            vm.detail();
 
 
         },
@@ -450,6 +495,7 @@ var vm = new Vue({
                 vm.branch();
                 vm.barcode();
                 vm.sales();
+                vm.detail();
             });
         },
         getInfo: function () {
@@ -465,6 +511,7 @@ var vm = new Vue({
                 vm.branch();
                 vm.barcode();
                 vm.sales();
+                vm.detail();
             });
             // $.get("../goods/info/" + id, function (r) {
             //     vm.goods = r.goods;
@@ -490,14 +537,49 @@ var vm = new Vue({
         },
         barcode:function(){
             var postData = {"goodsSn":vm.q.goodsSn,'prodBarcode':vm.q.prodBarcode,'storeId':vm.q.storeId};
-
+            console.log("barcode:"+postData);
             $("#barcodeJqGrid").jqGrid('setGridParam',{
                 datatype:'json',
                 postData:postData,
             }).trigger("reloadGrid");
         },
         detail:function(){
+            if(vm.q.startTime != ''){
+                var date = new Date(vm.q.startTime);
+                vm.q.startTime=date.getFullYear();
+                if((date.getMonth() + 1) < 10){
+                    vm.q.startTime = vm.q.startTime +'-0'+(date.getMonth() + 1);
+                }else{
+                    vm.q.startTime = vm.q.startTime +'-'+(date.getMonth() + 1);
+                }
+                if((date.getDate()) < 10){
+                    vm.q.startTime = vm.q.startTime + '-0'+(date.getDate());
+                }else{
+                    vm.q.startTime = vm.q.startTime + '-'+(date.getDate());
+                }
 
+            }
+            if(vm.q.endTime != '') {
+                date = new Date(vm.q.endTime);
+                vm.q.endTime = date.getFullYear();
+                if((date.getMonth() + 1) < 10){
+                    vm.q.endTime = vm.q.endTime +'-0'+(date.getMonth() + 1);
+                }else{
+                    vm.q.endTime = vm.q.endTime +'-'+(date.getMonth() + 1);
+                }
+                if((date.getDate()) < 10){
+                    vm.q.endTime = vm.q.endTime + '-0'+(date.getDate());
+                }else{
+                    vm.q.endTime = vm.q.endTime + '-'+(date.getDate());
+                }
+            }
+
+            var postData = {"goodsSn":vm.q.goodsSn,'prodBarcode':vm.q.prodBarcode,'storeId':vm.q.storeId,'startTime':vm.q.startTime,'endTime':vm.q.endTime};
+            console.log("detail:"+postData);
+            $("#detailJqGrid").jqGrid('setGridParam',{
+                datatype:'json',
+                postData:postData,
+            }).trigger("reloadGrid");
         },
         sales:function(){
             var postData = {"goodsSn":vm.q.goodsSn,'prodBarcode':vm.q.prodBarcode,'storeId':vm.q.storeId};
@@ -672,6 +754,7 @@ var vm = new Vue({
             vm.sales();
             vm.branch();
             vm.barcode();
+            vm.detail();
             vm.getInfo();
             // vm.showList = true;
             // let page = event;
@@ -694,6 +777,7 @@ var vm = new Vue({
         },
         returnBack:function(){
             vm.showList = true;
+            vm.q.startTime = '',v.q.endTime = '';
         },
         getCategory: function () {
             //加载分类树
@@ -913,6 +997,9 @@ var vm = new Vue({
             // vm.getBrand(merchSn);
             vm.getThirdMerchantBizList(merchSn);
         },
+        queryDetail:function(){
+            vm.detail();
+        }
         // getCategories: function (merchSn) {
         //     $.get("../category/getCategorySelect?isShow=1&merchSn=" + merchSn, function (r) {
         //         vm.categories = r.list;

+ 30 - 26
kmall-admin/src/main/webapp/login.html

@@ -55,7 +55,7 @@
             <p style="font-size: 35px;font-family: 微软雅黑;color: #3bc8ff;text-shadow: 2px 2px 5px #000;padding-right: 10px;margin: 45px 0 0;" align="center">
                 <span >CW大药房</span>
                 <br/>
-                <span style="font-size: 45px">收 银 系 统</span>
+                <span style="font-size: 45px">管 理 后 台</span>
                 <br/>
             </p>
             <!--<p style="font-size: 20px;font-family: 微软雅黑;color: #3bc8ff;text-shadow: 2px 2px 5px #000;padding-right: 10px;margin: 30px 0 0;"></p>-->
@@ -80,7 +80,8 @@
                     </div>
                 </div>
                 <div>
-                    <i-button type="primary" @click="login" style="width: 250px;height: 45px">登录</i-button>
+                    <i-button type="primary" @click="login" style="width: 125px;height: 45px">登录</i-button>
+                    <i-button type="primary" @click="changeUserLogin" style="width: 125px;height: 45px">切换店员端登录</i-button>
                 </div>
             </div>
         </div>
@@ -119,20 +120,20 @@
         beforeMount: function(){
             // TODO 调用接口获取机器码
 
-                $.ajax({
-                    url:"http://127.0.0.1:8000/api/reg/gen",
-                    success:function(r){
-                        if(r.code == "0"){
-                            vm.machineCode = r.rows[0].data.code;
-                            console.log(vm.machineCode);
-                            vm.machineCode = vm.machineCode.replace("+","%2B");
-                            sessionStorage.setItem("machineCode",vm.machineCode);
-                        }
-                    },
-                    error:function(XMLHttpRequest, textStatus, errorThrown){
-                        alert("获取机器码失败,请联系管理员");
-                    }
-                })
+                // $.ajax({
+                //     url:"http://127.0.0.1:8000/api/reg/gen",
+                //     success:function(r){
+                //         if(r.code == "0"){
+                //             vm.machineCode = r.rows[0].data.code;
+                //             console.log(vm.machineCode);
+                //             vm.machineCode = vm.machineCode.replace("+","%2B");
+                //             sessionStorage.setItem("machineCode",vm.machineCode);
+                //         }
+                //     },
+                //     error:function(XMLHttpRequest, textStatus, errorThrown){
+                //         alert("获取机器码失败,请联系管理员");
+                //     }
+                // })
 
                 // $.get("http://127.0.0.1:8000/api/reg/gen" , function (r) {
                 //     console.log(r);
@@ -154,12 +155,12 @@
             },
             login: function (event) {
                 var data = "username=" + vm.username + "&password=" + vm.password + "&captcha=" + vm.captcha + "&machineCode=" + vm.machineCode; //TODO  新增加一个机器码;
-                sessionStorage.removeItem("permsSet");
-                var code = sessionStorage.getItem("machineCode");
-                if(!code){
-                    alert("正在获取机器码,请稍后登录,大约5s");
-                    return;
-                }
+                // sessionStorage.removeItem("permsSet");
+                // var code = sessionStorage.getItem("machineCode");
+                // if(!code){
+                //     alert("正在获取机器码,请稍后登录,大约5s");
+                //     return;
+                // }
                 $.ajax({
                     type: "POST",
                     url: "sys/login",
@@ -170,17 +171,20 @@
                             sessionStorage.setItem("permsSet", JSON.stringify(result.permsSet))
                             sessionStorage.setItem("storeId", result.storeId)
 
-                            if(result.storeId != null){
-                                parent.location.href = '/sale/sale.html';
-                            }else{
+                            // if(result.storeId != null){
+                            // parent.location.href = '/sale/sale.html';
+                            // }else{
                                 parent.location.href = 'index.html';
-                            }
+                            // }
                         } else {
                             iview.Message.error(result.msg);
                             vm.refreshCode();
                         }
                     }
                 });
+            },
+            changeUserLogin:function(){
+                parent.location.href = 'userLogin.html';
             }
         }
     });

+ 193 - 0
kmall-admin/src/main/webapp/userLogin.html

@@ -0,0 +1,193 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>kmall_pt</title>
+    <!-- Tell the browser to be responsive to screen width -->
+    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
+    <link rel="stylesheet" href="statics/css/bootstrap.min.css">
+    <link rel="stylesheet" href="statics/css/font-awesome.min.css">
+    <link rel="stylesheet" href="statics/css/style.css">
+    <link rel="stylesheet" href="statics/css/login.css">
+    <link rel="stylesheet" href="statics/css/main.css">
+    <link rel="stylesheet" href="statics/css/iview.css">
+    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
+    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+    <!--[if lt IE 9]>
+    <script src="statics/libs/html5shiv.min.js"></script>
+    <script src="statics/libs/respond.min.js"></script>
+    <![endif]-->
+</head>
+<body class="signin hold-transition login-page">
+<div class="loginscreen animated fadeInDown signinpanel" id="loginBox" v-cloak>
+    <!--<div class="row" style="background: rgba(109, 109, 109, 0.23);border: 0px solid #dddee1;padding:72px 2px">-->
+    <div class="row" style="background: rgba(109, 109, 109, 0.45);border-radius: 20px;border: 0px solid #6d6d6d;padding:13px 22px 35px 22px;">
+        <div class="row" style="border: 0px solid #6d6d6d">
+            <p style="font-size: 45px;font-family: 微软雅黑;color: #ffffff;text-shadow: 5px 5px 5px #000;margin-bottom: 10px" align="center"><b>跨 境 电 商 &nbsp;&nbsp;新零售</b></p>
+            <hr/>
+        </div>
+        <!--<div class="col-md-7">
+            <div class="signin-info">
+                <div class="logopanel m-b">
+                    <h1>中网科技</h1>
+                </div>
+                <div class="m-b"></div>
+                <h4>欢迎使用kmall_pt</h4>
+                <ul class="m-b">
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>完善开源版本购物流程</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>多门店管理</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>团购管理(团购设置、分享)</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>优惠活动(折扣、满减、满免配送)</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>优惠推广(下单送满减券、推荐送满减券、推荐送满减券)</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>订单管理(普通订单、团购订单、打印订单)</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>收货地址(用户输入、微信地址)</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>用户评论审核</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>快递查询接口(快递鸟)</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>用户下单自动打印小票(飞鸽打印机)</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>升级版UI</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>短信平台</li>
+                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>优化退款功能和付款记录</li>
+                </ul>
+            </div>
+        </div>-->
+        <div class="col-md-7" >
+            <p style="font-size: 35px;font-family: 微软雅黑;color: #3bc8ff;text-shadow: 2px 2px 5px #000;padding-right: 10px;margin: 45px 0 0;" align="center">
+                <span >CW大药房</span>
+                <br/>
+                <span style="font-size: 45px">收 银 系 统</span>
+                <br/>
+            </p>
+            <!--<p style="font-size: 20px;font-family: 微软雅黑;color: #3bc8ff;text-shadow: 2px 2px 5px #000;padding-right: 10px;margin: 30px 0 0;"></p>-->
+        </div>
+        <div class="col-md-5">
+            <div class="m-t text-center" style="border: 0px solid #dddee1;">
+                <div class="form-group has-feedback">
+                    <i-input class="userinput" v-model="username" @on-enter="login" placeholder="账号" style="width: 250px;" autofocus/>
+                </div>
+                <div class="form-group has-feedback">
+                    <i-input class="userinput"  type="password" v-model="password" @on-enter="login" style="width: 250px;"
+                             placeholder="密码"/>
+                </div>
+                <div class="form-group has-feedback" id="authcode">
+                    <div style="display: inline-block;width: 150px;height:45px;padding-left: 2px">
+                        <i-input v-model="captcha" @on-enter="login"
+                                 placeholder="验证码" class="authcode" />
+                    </div>
+                    <div style="display: inline-block;width: 100px;">
+                        <img style="height: 45px;width: 96px;border-radius: 4px;" alt="如果看不清楚,请单击图片刷新!" title="点击刷新"
+                             class="pointer" :src="src" @click="refreshCode">
+                    </div>
+                </div>
+                <div>
+                    <i-button type="primary" @click="login" style="width: 125px;height: 45px">登录</i-button>
+                    <i-button type="primary" @click="change" style="width: 125px;height: 45px">切换管理端</i-button>
+                </div>
+            </div>
+        </div>
+    </div>
+    <!--<div class="signup-footer">-->
+        <!--<div class="pull-left" style="margin-left: 520px;">-->
+            <!--2018~2020 &copy; <a href="#" target="_blank">中网科技(深圳)有限公司</a>-->
+        <!--</div>-->
+    <!--</div>-->
+</div>
+<!-- /.login-box -->
+<script src="statics/libs/jquery.min.js"></script>
+<script src="statics/libs/vue.min.js"></script>
+<script src="statics/libs/iview.min.js"></script>
+<script src="statics/libs/bootstrap.min.js"></script>
+<script src="statics/plugins/slimscroll/jquery.slimscroll.min.js"></script>
+<script src="statics/libs/fastclick.min.js"></script>
+<script type="text/javascript">
+    var vm = new Vue({
+        el: '#loginBox',
+        data: {
+            username: '',
+            password: '',
+            captcha: '',
+            machineCode: '' ,
+            src: 'captcha.jpg'
+        },
+        beforeCreate: function () {
+            if (self != top) {
+                top.location.href = self.location.href;
+            }
+
+
+
+        },
+        beforeMount: function(){
+            // TODO 调用接口获取机器码
+
+                $.ajax({
+                    url:"http://127.0.0.1:8000/api/reg/gen",
+                    success:function(r){
+                        if(r.code == "0"){
+                            vm.machineCode = r.rows[0].data.code;
+                            console.log(vm.machineCode);
+                            vm.machineCode = vm.machineCode.replace("+","%2B");
+                            sessionStorage.setItem("machineCode",vm.machineCode);
+                        }
+                    },
+                    error:function(XMLHttpRequest, textStatus, errorThrown){
+                        alert("获取机器码失败,请联系管理员");
+                    }
+                })
+
+                // $.get("http://127.0.0.1:8000/api/reg/gen" , function (r) {
+                //     console.log(r);
+                //     if(r.code == "0"){
+                //         vm.machineCode = r.rows[0].data.code;
+                //         console.log(vm.machineCode);
+                //         vm.machineCode = vm.machineCode.replace("+","%2B");
+                //         sessionStorage.setItem("machineCode",vm.machineCode);
+                //     }
+                // });
+
+
+
+
+        },
+        methods: {
+            refreshCode: function () {
+                this.src = "captcha.jpg?t=" + $.now();
+            },
+            login: function (event) {
+                var data = "username=" + vm.username + "&password=" + vm.password + "&captcha=" + vm.captcha + "&machineCode=" + vm.machineCode; //TODO  新增加一个机器码;
+                sessionStorage.removeItem("permsSet");
+                var code = sessionStorage.getItem("machineCode");
+                if(!code){
+                    alert("正在获取机器码,请稍后登录,大约5s");
+                    return;
+                }
+                $.ajax({
+                    type: "POST",
+                    url: "sys/login",
+                    data: data,
+                    dataType: "json",
+                    success: function (result) {
+                        if (result.code == 0) {//登录成功
+                            sessionStorage.setItem("permsSet", JSON.stringify(result.permsSet))
+                            sessionStorage.setItem("storeId", result.storeId)
+
+                            // if(result.storeId != null){
+                                parent.location.href = '/sale/sale.html';
+                            // }else{
+                            //     parent.location.href = 'index.html';
+                            // }
+                        } else {
+                            iview.Message.error(result.msg);
+                            vm.refreshCode();
+                        }
+                    }
+                });
+            },
+            change:function(){
+                parent.location.href = 'login.html';
+            }
+        }
+    });
+</script>
+</body>
+</html>