Bläddra i källkod

Merge branch 'master' of http://git.ds-bay.com/project/kmall-pt-general

xwh 4 år sedan
förälder
incheckning
f7f6d910c1

+ 6 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/CashierController.java

@@ -78,6 +78,12 @@ public class CashierController {
             cashier.setMachineCodeType("01"); // 默认mac地址
             cashier.setMachineCode(mac);
         }
+        // 校验是否已经有改机器码
+        CashierEntity cashierEntity =  cashierService.queryByMachineCode(cashier.getMachineCode(),cashier.getShopSn());
+        if(cashierEntity != null){
+            return R.error("该机器已录入,机器码:"+cashierEntity.getMachineCode());
+        }
+
         cashierService.save(cashier);
 
         return R.ok();

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

@@ -41,7 +41,7 @@ public class CategoryController {
     @RequiresPermissions("category:list")
     public R list(@RequestParam Map<String, Object> params) {
         ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
-        ParamUtils.setName(params, "categoryName");
+//        ParamUtils.setName(params, "categoryName");
         //查询列表数据
         Query query = new Query(params);
 
@@ -104,7 +104,7 @@ public class CategoryController {
     public R queryAll(@RequestParam Map<String, Object> params) {
 
         ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
-        ParamUtils.setName(params, "categoryName");
+//        ParamUtils.setName(params, "categoryName");
 
         List<CategoryEntity> list = categoryService.queryList(params);
         //添加顶级菜单

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

@@ -35,7 +35,7 @@ public class SupplierController {
     @ResponseBody
     public R list(@RequestParam Map<String, Object> params) {
         ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
-        ParamUtils.setName(params, "name");
+//        ParamUtils.setName(params, "name");
         //查询列表数据
         Query query = new Query(params);
 

+ 3 - 4
kmall-admin/src/main/java/com/kmall/admin/controller/statistics/MonthlyCustomersController.java

@@ -218,10 +218,9 @@ public class MonthlyCustomersController {
     @RequestMapping("/top10ForProduct")
     public R top10ForProduct(@RequestParam("month") String month, @RequestParam("week") String week){
         if (Objects.isNull(month) || "".equals(month)){
-            return R.error("请先选择开始时间");
-        }
-        if (Objects.isNull(week)  || "".equals(week)){
-            return R.error("请先选择结束时间");
+            return R.error("请选择月份");
+        }else if(Objects.isNull(week)  || "".equals(week)){
+            return R.error("请选择周");
         }
         String merchSn = null;
         SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/CashierServiceImpl.java

@@ -2,6 +2,7 @@ package com.kmall.admin.service.impl;
 
 import com.kmall.admin.dao.CashierDao;
 import com.kmall.admin.service.CashierService;
+import com.kmall.common.utils.R;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 

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

@@ -176,7 +176,7 @@
             AND s.third_party_merch_code = #{thirdPartyMerchCode}
         </if>
         <if test="name != null and name.trim() != ''">
-            AND name LIKE concat('%',#{name},'%')
+            AND b.name LIKE concat('%',#{name},'%')
         </if>
     </select>
 

+ 8 - 8
kmall-admin/src/main/resources/mybatis/mapper/statistics/WechatFollowersDao.xml

@@ -55,7 +55,7 @@
 			limit #{offset}, #{limit}
 		</if>
 	</select>
-	
+
  	<select id="queryTotal" resultType="int">
 		select count(*) from mall_wechat_followers
 		WHERE 1=1
@@ -74,7 +74,7 @@
 			 DATE_FORMAT(mwf.create_time,'%Y-%m')  &gt;= #{startMonth}
 			AND DATE_FORMAT(mwf.create_time,'%Y-%m') &lt;= #{endMonth}
 			<if test="merchSn != null">
-				and m.merch_sn = #{merchSn}
+				and mwf.merch_sn = #{merchSn}
 			</if>
 		</where>
 		group by DATE_FORMAT(mwf.create_time,'%Y-%m')
@@ -100,9 +100,9 @@
 			#{modTime},
 			#{tstm})
 	</insert>
-	 
+
 	<update id="update" parameterType="com.kmall.admin.entity.WechatFollowersEntity">
-		update mall_wechat_followers 
+		update mall_wechat_followers
 		<set>
 			<if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
 			<if test="wechatFollowers != null">`wechat_followers` = #{wechatFollowers}, </if>
@@ -114,16 +114,16 @@
 		</set>
 		where id = #{id}
 	</update>
-	
+
 	<delete id="delete">
 		delete from mall_wechat_followers where id = #{value}
 	</delete>
-	
+
 	<delete id="deleteBatch">
-		delete from mall_wechat_followers where id in 
+		delete from mall_wechat_followers where id in
 		<foreach item="id" collection="array" open="(" separator="," close=")">
 			#{id}
 		</foreach>
 	</delete>
 
-</mapper>
+</mapper>

+ 7 - 2
kmall-admin/src/main/webapp/WEB-INF/page/mk/mk2memberbirthday.html

@@ -31,8 +31,13 @@
             <Form-item label="活动名称" prop="topicName">
                 <i-input v-model="mk2MemberBirthday.topicName" placeholder="活动名称"/>
             </Form-item>
-            <Form-item label="优惠类型(00:按比例;10:按金额)" prop="topicType">
-                <i-input v-model="mk2MemberBirthday.topicType" placeholder="优惠类型"/>
+            <Form-item label="优惠类型" prop="topicType">
+                <i-select v-model="mk2MemberBirthday.topicType" placeholder="优惠类型" filterable label-in-value>
+                    <i-option v-for="topicType in topicTypes" :value="topicType.id"
+                              :key="topicType.id">{{topicType.name}}
+                    </i-option>
+                </i-select>
+
             </Form-item>
             <Form-item label="优惠金额" prop="topicPrice">
                 <i-input v-model="mk2MemberBirthday.topicPrice" type="number" placeholder="优惠金额"/>

+ 2 - 1
kmall-admin/src/main/webapp/WEB-INF/page/sale/monthlyCustomers2.html

@@ -41,7 +41,8 @@
             <input type="month" name="startMonth" id="startMonth"/>&nbsp;
             <input type="month" name="endMonth" id="endMonth" />&nbsp;
             <span>预定月份数</span>
-                <input type="number" name="monthNumber" id="monthNumber">;
+            <input type="number" name="monthNumber" id="monthNumber">;
+            <input type="button" name="queryButton" value="查询" onclick="queryMonthly()" />
             <input type="button" name="queryButton" value="导出选中的数据" onclick="exportSelectedMonthData()" />
             </div>
         </div>

+ 7 - 7
kmall-admin/src/main/webapp/WEB-INF/page/shop/brand.html

@@ -12,13 +12,13 @@
                 <i-col span="4">
                     <i-input v-model="q.name" @on-enter="query" placeholder="品牌名称"/>
                 </i-col>
-                <i-col span="3">
-                    <i-select v-model="q.storeId" placeholder="门店" filterable label-in-value>
-                        <i-option v-for="store in stores" :value="store.id"
-                                  :key="store.id">{{store.storeName}}
-                        </i-option>
-                    </i-select>
-                </i-col>
+<!--                <i-col span="3">-->
+<!--                    <i-select v-model="q.storeId" placeholder="门店" filterable label-in-value>-->
+<!--                        <i-option v-for="store in stores" :value="store.id"-->
+<!--                                  :key="store.id">{{store.storeName}}-->
+<!--                        </i-option>-->
+<!--                    </i-select>-->
+<!--                </i-col>-->
                 <i-button @click="query">查询</i-button>
             </div>
             <div class="buttons-group">

+ 10 - 1
kmall-admin/src/main/webapp/js/mk/mk2memberbirthday.js

@@ -79,7 +79,16 @@ let vm = new Vue({
 		},
 		q: {
             topicName: ''
-		}
+		},
+        topicTypes:[
+            {
+                id: '00',
+                name: '比例'
+            }, {
+                id: '10',
+                name: '金额'
+            }
+        ],
 	},
 	methods: {
 		query: function () {

+ 32 - 32
kmall-admin/src/main/webapp/js/sale/monthlyCustomers.js

@@ -1,36 +1,36 @@
 $(function () {
-    var data = {
-        "echatX": [
-            "2019-07-02",
-            "2019-07-03",
-            "2019-07-04",
-            "2019-07-05",
-            "2019-07-06",
-            "2019-07-07",
-            "2019-07-08",
-            "2019-07-09",
-            "2019-07-10",
-            "2019-07-11",
-            "2019-07-12",
-            "2019-07-13",
-            "2019-07-14",
-            "2019-07-15"
-        ],
-        "echatY": [
-            501,210,123,333,445,157,151,369,101,101,350,435,153,100
-        ],
-        "echatY2": [
-            80,40,13,36,57,77,41,39,61,31,60,73,33,50
-        ],
-        "echatY3": [
-            5091,2210,1233,3133,4415,1517,1511,3619,1101,1011,3510,4315,1513,1100
-        ],
-        "echatY4": [
-            501,210,123,333,445,157,151,369,101,101,350,435,153,100
-        ],
-        "peopleTotal":15,"peopleOnline":4,"peopleOutline":12,"ranges":[]
-    };
-    dFun(data.echatX, data.echatY, data.echatY2,data.echatY3,data.echatY4);
+    // var data = {
+    //     "echatX": [
+    //         "2019-07-02",
+    //         "2019-07-03",
+    //         "2019-07-04",
+    //         "2019-07-05",
+    //         "2019-07-06",
+    //         "2019-07-07",
+    //         "2019-07-08",
+    //         "2019-07-09",
+    //         "2019-07-10",
+    //         "2019-07-11",
+    //         "2019-07-12",
+    //         "2019-07-13",
+    //         "2019-07-14",
+    //         "2019-07-15"
+    //     ],
+    //     "echatY": [
+    //         501,210,123,333,445,157,151,369,101,101,350,435,153,100
+    //     ],
+    //     "echatY2": [
+    //         80,40,13,36,57,77,41,39,61,31,60,73,33,50
+    //     ],
+    //     "echatY3": [
+    //         5091,2210,1233,3133,4415,1517,1511,3619,1101,1011,3510,4315,1513,1100
+    //     ],
+    //     "echatY4": [
+    //         501,210,123,333,445,157,151,369,101,101,350,435,153,100
+    //     ],
+    //     "peopleTotal":15,"peopleOnline":4,"peopleOutline":12,"ranges":[]
+    // };
+    // dFun(data.echatX, data.echatY, data.echatY2,data.echatY3,data.echatY4);
 
 
 });

+ 65 - 12
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -58,6 +58,7 @@ function calculateGoodsPrice(r){
                     dataMap.set(barCodeArray[j],0);
                 }
                 vm.combinationPrice.set(data,rMap.zhjsp[data][0].combinedPrice)
+
                 vm.zhjsp.set(data,dataMap);
             }
         }
@@ -209,22 +210,69 @@ function calculateGoodsByZhjsp(r){
             if(flag === 1){
                 var combinationPrice = vm.combinationPrice.get(key);
                 var barCodeArr = key.toString().split(":");
-                for( var j = 0 ; j < barCodeArr.length ; j ++ ){
+
+                // 扫码的商品条码 barCode
+                for(var i = 0 ; i < barCodeArr.length ; i ++){
+                    var oldCode = barCodeArr[i];
+                    if(oldCode === barCode){
+                        continue;
+                    }
+                    if(vm.compareCombinationPrice.get(oldCode) && vm.compareCombinationPrice.get(oldCode) > combinationPrice){
+                        // 获取原组合关系
+                        var relationshipKey = vm.combinationRelationship.get(oldCode);
+                        // 将价格设置回原来的价格
+                        var keyArr = relationshipKey.toString().split(":");
+                        // 遍历原来的组合
+                        for(var j = 0 ; j < keyArr.length ; j ++){
+                            // 遍历购物车中原来的商品,替换价格
+                            for(var k = 0 ; k < vm.goodsList.length ; k ++){
+                                if(vm.goodsList[k].prodBarcode === keyArr[j] && vm.goodsList[k].activity == "组合价"){
+
+                                    vm.discountedPrice = vm.discountedPrice - vm.goodsList[k].discountedPrice ;
+                                    vm.actualPrice = vm.actualPrice + vm.goodsList[k].discountedPrice ;
+
+                                    vm.goodsList[k].discountedPrice = 0 ; //  优惠价格
+                                    vm.goodsList[k].actualPaymentAmount = vm.goodsList[k].retailPrice;  // 实际支付价格
+                                    vm.goodsList[k].isCombination = 0;
+                                    vm.goodsList[k].activity = "";
+
+
+
+                                    vm.compareCombinationPrice.delete(vm.goodsList[k].prodBarcode);
+                                    vm.combinationRelationship.delete(vm.goodsList[k].prodBarcode);
+                                }
+                            }
+                        }
+
+                    }
+                }
+
+                for( var i = 0 ; i < barCodeArr.length ; i ++ ){
                     // 如果是扫描的产品,直接退出,因为购物车中无该产品
-                    if(barCodeArr[j] == barCode){
+                    if(barCodeArr[i] == barCode){
                         r.goodsDetails.isCombination = 1;
                         r.goodsDetails.discountedPrice = r.goodsDetails.retailPrice - combinationPrice; //  优惠价格
                         r.goodsDetails.actualPaymentAmount = combinationPrice; // 实际支付价格
                         r.goodsDetails.activity = "组合价";
+
+
+                        vm.compareCombinationPrice.set(barCode,r.goodsDetails.actualPaymentAmount);
+                        vm.combinationRelationship.set(barCode,key);
                         continue;
                     }
-                    for(var i = 0 ; i < vm.goodsList.length ; i ++){
-                        if(vm.goodsList[i].prodBarcode === barCodeArr[j] && !vm.goodsList[i].isCombination){
-                            // 如果符合条件,把赠送的条码给删除(一次性)
-                            vm.goodsList[i].discountedPrice = vm.goodsList[i].retailPrice ; //  优惠价格
-                            vm.goodsList[i].actualPaymentAmount = 0;  // 实际支付价格
-                            vm.goodsList[i].isCombination = 1;
-                            vm.goodsList[i].activity = "组合价";
+                    for(var j = 0 ; j < vm.goodsList.length ; j ++){
+                        if(vm.goodsList[j].prodBarcode === barCodeArr[i] && !vm.goodsList[j].isCombination){
+                            vm.goodsList[j].discountedPrice = vm.goodsList[j].retailPrice ; //  优惠价格
+                            vm.goodsList[j].actualPaymentAmount = 0;  // 实际支付价格
+                            vm.goodsList[j].isCombination = 1;
+                            vm.goodsList[j].activity = "组合价";
+
+                            vm.discountedPrice = vm.discountedPrice + vm.goodsList[j].retailPrice ; // 总的优惠金额
+                            vm.actualPrice = vm.actualPrice - vm.goodsList[j].retailPrice ; // 总的实际支付金额
+
+                            vm.compareCombinationPrice.set(vm.goodsList[j].prodBarcode,vm.goodsList[j].actualPaymentAmount);
+                            vm.combinationRelationship.set(vm.goodsList[j].prodBarcode,barCode,key);
+
                             break;
                         }
                     }
@@ -237,6 +285,7 @@ function calculateGoodsByZhjsp(r){
             }
         });
     }
+    console.log(vm.compareCombinationPrice);
 
 }
 
@@ -284,6 +333,8 @@ let vm = new Vue({
         // 组合价
         zhjsp: new Map(),
         combinationPrice: new Map(), // 组合价商品的组合价
+        compareCombinationPrice: new Map(), // 用于比较组合价
+        combinationRelationship: new Map(), // 组合价格的组合关系
         // 满减
         mj: new Map(),
         accumulatedAmount: new Map(), // 累积金额(满减使用的)
@@ -316,6 +367,9 @@ let vm = new Vue({
                     }
                     vm.max++;
                     r.goodsDetails.goodsDesc = "";
+
+                    r.goodsDetails.discountedPrice =  Math.round(r.goodsDetails.discountedPrice * 100) / 100;
+                    r.goodsDetails.actualPaymentAmount =  Math.round(r.goodsDetails.actualPaymentAmount * 100) / 100;
                     // r.goodsDetails.primaryPicUrl = "";
                     var data = Object.assign({}, JSON.parse(JSON.stringify(r.goodsDetails)));
                     vm.goodsList.push(data);
@@ -331,7 +385,6 @@ let vm = new Vue({
                         vm.discountedPrice = vm.discountedPrice + r.goodsDetails.discountedPrice ;
                         vm.actualPrice = vm.actualPrice + r.goodsDetails.actualPaymentAmount ;
                     }
-
                     // 处理精度
                     vm.totalPrice =  Math.round(vm.totalPrice * 100) / 100;
                     vm.discountedPrice =  Math.round(vm.discountedPrice * 100) / 100;
@@ -477,7 +530,7 @@ let vm = new Vue({
             if(this.$refs.couponSn)
                 this.userInfo.couponSn = this.$refs.couponSn.value;
             var idcardReg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
-            /*if(!this.userInfo.customName){
+            if(!this.userInfo.customName){
                 alert("姓名不能为空!");
                 return ;
             }
@@ -489,7 +542,7 @@ let vm = new Vue({
             if(!(/^1[3456789]\d{9}$/.test(this.userInfo.customPhone))){
                 alert("手机号码有误,请重填");
                 return ;
-            }*/
+            }
 
             if(this.userInfo.couponSn){
                 var coupon = vm.coupons.get(this.userInfo.couponSn);

+ 1 - 1
kmall-admin/src/main/webapp/js/shop/category.js

@@ -301,7 +301,7 @@ var vm = new Vue({
                     vm.categoryList = r.list;
                 });
             }else{
-                $.get("../category/getCategorySelect?merchSn="+merchSn+"&share=1", function (r) {
+                $.get("../category/getCategorySelect?merchSn="+merchSn+"&parentId=0", function (r) {
                     vm.categoryList = r.list;
                 });
             }