From 21465c793eb6f703c62fd238a8f7e185020350fa Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 30 Dec 2021 11:16:18 +0800
Subject: [PATCH] merge score_shop

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html                |   16 ++++
 zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-setting.html                 |    6 +
 zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-order.html                   |    5 +
 zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html              |    4 
 zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml                          |   11 +++
 zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java                   |    2 
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java  |   15 +++++
 zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml                              |    4 +
 zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java                           |    2 
 zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/meidu.html               |    6 +-
 zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java                |   19 ++++++
 zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java                         |    5 +
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java           |    5 +
 zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/print-service-meidu.html |    8 +-
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html             |    1 
 zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java                             |   12 ++++
 zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html                   |   16 +++++
 17 files changed, 121 insertions(+), 16 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
index f2e5c36..650f50a 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
@@ -124,9 +124,28 @@
         List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(id);
         if (CollUtil.isNotEmpty(beauticianStateList)) {
             for (SysBeauticianState sysBeauticianState : beauticianStateList) {
+                SysProjUse item = sysBeauticianState.getProjUse();
+
+                // 若项目/套餐无效,则打印时,不显示余次
+                if ("无效".equals(item.getStatus())) {
+                    item.setRemainCount(item.getSurplusCount());
+                } else {
+                    item.setRemainCount(null);
+                }
+
                 if (sysBeauticianState.getProjUse().getTaocanId() != null) {
                     SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId());
+                    if ("无效".equals(sysProjUse.getStatus())) {
+                        item.setRemainCount(sysProjUse.getSurplusCount());
+                    } else {
+                        item.setRemainCount(null);
+                    }
+
                     sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName()+"--"+sysBeauticianState.getProjInfo().getName());
+                    if ("Y".equals(sysProjUse.getIsCourse()) && "Y".equals(sysProjUse.getIsInfinite())) {
+                        int count = projUseService.findTaocanCountForCourseAndInfinite(sysBeauticianState.getProjUse().getTaocanId(), projServices.getVipId());
+                        item.setRemainCount(count);
+                    }
                 }
             }
         }
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java
index 94b8b15..a019374 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysProjUse.java
@@ -143,6 +143,18 @@
     @Extend
     private String updateRemark;
 
+    /**
+     * 套餐/项目剩余次数
+     */
+    private Integer remainCount;
+
+    public Integer getRemainCount() {
+        return remainCount;
+    }
+
+    public void setRemainCount(Integer remainCount) {
+        this.remainCount = remainCount;
+    }
 
     public Long getOrderId() {
         return orderId;
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java
index 6eac36c..cd19d3d 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysProjUseDao.java
@@ -134,4 +134,6 @@
 	Integer selectProjUseFlowTotal(@Param("record") SysProjUseFlow projUseFlow);
 
 	List<SysProjUse> selectTaoCanListWithProj(@Param("record") SysProjUse sysProjUse);
+
+	int selectTaocanCountForCourseAndInfinite(@Param("taocanId") Long taocanId, @Param("vipId") Long vipId);
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java
index 0bf893a..ed21be0 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjUseService.java
@@ -143,4 +143,6 @@
 	public List<SysProjUse> selectTaocanProjUse(Long id, String status);
 
 	public List<SysProjUse> findTaocaoProjUseWithProj(SysProjUse sysProjUse);
+
+	int findTaocanCountForCourseAndInfinite(Long taocanId, Long vipId);
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java
index 2764267..b30f76c 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjUseServiceImpl.java
@@ -608,4 +608,9 @@
     public List<SysProjUse> findTaocaoProjUseWithProj(SysProjUse sysProjUse) {
         return sysProjUseDao.selectTaoCanListWithProj(sysProjUse);
     }
+
+    @Override
+    public int findTaocanCountForCourseAndInfinite(Long taocanId, Long vipId) {
+        return sysProjUseDao.selectTaocanCountForCourseAndInfinite(taocanId, vipId);
+    }
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
index 7982cf2..dee24d6 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
@@ -152,12 +152,23 @@
         shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS);
 
         List<ShopOrderDetails> details = new ArrayList<>();
+        // 是否包含实物商品
+        boolean hasRealGoods = false;
+
         Integer orderCount = 0;
         for (OrderItemDto orderItemDto : shopOrderDto.getOrderItemList()) {
             ShopOrderDetails shopOrderDetails = new ShopOrderDetails();
             shopOrderDetails.setCreateBy(AppConstance.SYSTEM_USER);
             shopOrderDetails.setUpdateBy(AppConstance.SYSTEM_USER);
             shopOrderDetails.setpId(orderItemDto.getProductId());
+
+            if (!hasRealGoods) {
+                ShopProduct shopProduct = shopProductDao.selectById(orderItemDto.getProductId());
+                if (shopProduct.getIsUnrealProduct() == 2) {
+                    hasRealGoods = true;
+                }
+            }
+
             shopOrderDetails.setsId(orderItemDto.getSkuId());
             shopOrderDetails.setCount(orderItemDto.getCount());
             if(ShopOrderDetails.PAYTYPE_MICRO==orderItemDto.getPayType()){
@@ -198,6 +209,10 @@
         shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS);
         //购买方式
         shopOrder.setShippingMethod(shopOrderDto.getDeliverySelect());
+        // 客户选择的物流配送,且没有实物产品(全是虚拟产品), 则直接门店自提,无需填写配送单
+        if (ShopOrder.SHIPPING_METHOD_WL == shopOrderDto.getDeliverySelect() && !hasRealGoods) {
+            shopOrder.setShippingMethod(ShopOrder.SHIPPING_METHOD_MDZT);
+        }
         //生成订单号
         shopOrder.setOrderNo(WxUtils.getOrderNum());
         //设置支付状态
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java
index 440cac1..73ef54d 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/bean/ShopProduct.java
@@ -272,6 +272,9 @@
 
 	private Long companyId;
 
-
+	/**
+	 * 是否虚拟产品 1/是 2/否
+	 */
+	private Integer isUnrealProduct;
 
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
index 5a13c18..335a873 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml
@@ -944,4 +944,8 @@
         </if>
     </select>
 
+    <select id="selectTaocanCountForCourseAndInfinite" resultType="java.lang.Integer">
+        select count(1) from sys_proj_use
+        where taocan_id=#{taocanId} and vip_id=#{vipId}
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
index 91c105d..b0061e1 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopProductDao.xml
@@ -45,6 +45,7 @@
         <result property="ableScorePay" column="able_score_pay"/>
         <result property="ableSales" column="able_sales"/>
         <result property="scoreCategoryId" column="score_category_id"/>
+        <result property="isUnrealProduct" column="is_unreal_product"/>
 
         <association property="shopCoupon" select="com.matrix.system.shopXcx.dao.ShopCouponDao.selectById"
                      column="{id=couponId}"></association>
@@ -123,6 +124,7 @@
 			company_id,
         able_score_pay,
         able_sales,
+        is_unreal_product,
         score_category_id
 
 	</sql>
@@ -161,7 +163,8 @@
 			#{item.shopIds},
 			#{item.companyId},
 			#{item.ableScorePay},
-			#{item.ableSales},
+            #{item.ableSales},
+            #{item.isUnrealProduct},
 			#{item.scoreCategoryId}
 
 	</sql>
@@ -552,7 +555,10 @@
                 able_sales = #{record.ableSales},
             </if>
             <if test="record.scoreCategoryId != null and record.scoreCategoryId ">
-               score_category_id = #{record.scoreCategoryId},
+                score_category_id = #{record.scoreCategoryId},
+            </if>
+            <if test="record.isUnrealProduct != null and record.isUnrealProduct">
+                is_unreal_product = #{record.isUnrealProduct},
             </if>
 
         </set>
@@ -909,6 +915,7 @@
             a.able_score_pay,
             a.able_sales,
             a.score_category_id,
+		    a.is_unreal_product,
 			(SELECT SUM(s.stock) from shop_sku  s where s.p_id = a.id) as stockNum,
 			(SELECT ROUND(SUM(s.stock),2) from shop_sku  s where s.p_id = a.id) as stockNum,
 			shop_ids
diff --git a/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-order.html b/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-order.html
index d3566c6..c047688 100644
--- a/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-order.html
+++ b/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-order.html
@@ -52,6 +52,10 @@
 <body>
 <div class="panel-body" id="app" v-cloak>
         <el-row>
+                <el-card class="box-card" style="background-color: #0a628f;">
+                    <div style="padding:10px;font-size: 20px;">¥{{basicdetail.balance}}</div>
+                    <div>订单总金额</div>
+                </el-card >
                 <el-card class="box-card" style="background-color: #0f9aef;">
                     <div style="padding:10px;font-size: 20px;">¥{{basicdetail.balance}}</div>
                     <div>待计算金额</div>
@@ -148,6 +152,7 @@
                             </el-form-item>
                             <el-button type="primary" @click="search" >搜索</el-button>
                             <el-button @click="resetForm('form')">重置</el-button>
+                            <el-button>导出</el-button>
                         </el-form>
                     </el-col>
                 </el-row>
diff --git a/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-setting.html b/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-setting.html
index 888cad5..48bbaef 100644
--- a/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-setting.html
+++ b/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-setting.html
@@ -343,7 +343,9 @@
                         }
                         _this.shfs = data.mapInfo.shfs;
                         _this.sqtj = data.mapInfo.sqtj;
-                        _this.order = data.mapInfo.order;
+                        if (!data.mapInfo.order && data.mapInfo.order != null) {
+                            _this.order = data.mapInfo.order;
+                        }
                     }
                 });
             },
@@ -356,7 +358,7 @@
                 this.pushToSelectGoods(row);
             },
             pushToSelectGoods(goods) {
-
+                console.log(this.order)
                 //判断是否被选中
                 let selected = false;
                 for(let i = 0; i < this.order.length; i++){
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
index 962a224..174a386 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
@@ -218,6 +218,7 @@
 			userList: [],
 			treeSelect : [],
 			payMoneys : [],
+			order:{},
 			printPaper : false,
 		},
 		created : function() {
@@ -324,8 +325,19 @@
 						data: _this.cardInfo,
 						url: url,
 						callback: function (data) {
+							_this.order.id = data.mapInfo.orderId;
+
 							if (_this.printPaper) {
+								_this.$message.success(data.info);
 								_this.print();
+							} else {
+								_this.$message.success({
+									message : data.info,
+									duration : 1000,
+									onClose() {
+										_this.closeFrame();
+									}
+								});
 							}
 
 							if(parent.myGrid) {
@@ -336,7 +348,7 @@
 								parent.app.vipInfoFn();
 							}
 
-							_this.closeFrame();
+							// _this.closeFrame();
 						}
 					});
 				}
@@ -354,7 +366,7 @@
 						maxmin: true,
 						content: [basePath + '/admin/order/printOrder?id=' + this.order.id],
 						cancel: function (index, layero) {
-							_this.closeFram();
+							_this.closeFrame();
 						}
 					});
 				} else {
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
index e5a8395..fb3829a 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
@@ -1103,6 +1103,7 @@
                                 //结算打印提示
                                 if (submitType == 1) {
                                     if (_this.printPaper) {
+                                        _this.$message.success(data.info);
                                         _this.print();
                                     } else {
                                         _this.$message.success({
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/meidu.html b/zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/meidu.html
index 22c1c0a..b760539 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/meidu.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/meidu.html
@@ -32,7 +32,7 @@
         <h1   style="text-align: center;font-size: 18px;margin: 20px auto;">
             {{order.shopName}}
         </h1>
-        <table style="width: 100%; font-size:12px;line-height: 20px;">
+        <table style="width: 100%; font-size:12px;">
 
             <tr>
                 <td colspan="2">
@@ -56,7 +56,7 @@
             </tr>
         </table>
         <p>--------------------------------</p>
-        <table style="width: 80%;font-size:12px;margin-top: 20px;text-align: left">
+        <table style="width: 80%;font-size:12px;margin-top: 10px;text-align: left; margin-bottom: 5px;">
 
             <tr>
                 <th style="text-align: left;"  colspan="4">产品</th>
@@ -89,7 +89,7 @@
             </tr>
         </table>
         <p>--------------------------------</p>
-        <table style="width: 100%;font-size: 10px;line-height: 30px;">
+        <table style="width: 100%;font-size: 10px; margin-bottom: 5px;">
             <tr  >
                 <td>
                     <b  >储值卡余额:</b><span >{{totalMoney}}</span>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/print-service-meidu.html b/zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/print-service-meidu.html
index f56a3dc..62f8f07 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/print-service-meidu.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/printTemplates/print-service-meidu.html
@@ -30,7 +30,7 @@
         <h1   style="text-align: center;font-size:18px;margin: 20px auto;">
             {{projService.shopName}}
         </h1>
-        <table style="width: 100%; font-size:10px;line-height: 20px;">
+        <table style="width: 100%; font-size:10px;">
 
             <tr>
                 <td colspan="2">
@@ -53,7 +53,7 @@
                 </td>
             </tr>
         </table>
-        <table style="width: 80%;font-size:10px;margin-top: 20px;text-align: left">
+        <table style="width: 80%;font-size:10px;margin-top: 10px;text-align: left; margin-bottom: 5px;">
             <tr>
                 <th style="text-align: left;"  colspan="4">产品</th>
             </tr>
@@ -70,12 +70,12 @@
                 <tr  >
                     <td>{{item.count }}</td>
                     <td>{{item.projUse.price }}</td>
-                    <td >{{item.projUse.surplusCount }}</td>
+                    <td >{{item.projUse.remainCount == null ? "-" : item.projUse.remainCount}}</td>
                     <td>{{item.beautiStaffInfo?item.beautiStaffInfo.suName:''}}</td>
                 </tr>
             </template>
         </table>
-        <table style="width: 100%;font-size: 10px;line-height: 30px;">
+        <table style="width: 100%;font-size: 10px; margin-bottom: 5px;">
             <tr>
                 <td>
                     <b>本次划扣:</b> <span >{{projService.money}}</span>
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html
index 084a646..000a29b 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopAdvertisType-list.html
@@ -722,8 +722,8 @@
                 if(zjw != null && zjh != null){
                     cNode.nodeStyleStr = '{"width":"'+zjw+'px","height":"'+zjh+'px"}';
                 }
-                if(this.interval != null && this.previousMargin != null && this.nextMargin != null){
-                    cNode.nodeAttribute = '{"interval":'+this.interval+',"previous-margin":'+this.previousMargin+',"next-margin":'+this.nextMargin+'}';
+                if(this.interval != null && this.previousMargin != null && this.nextMargin != null && this.interval != '' && this.previousMargin != '' && this.nextMargin != ''){
+                    cNode.nodeAttribute = '{\"interval\":'+this.interval+',\"previous-margin\":'+this.previousMargin+',\"next-margin\":'+this.nextMargin+'}';
                 }
 
                 if (cNode.nodeStyleStr != null && cNode.nodeStyleStr.length > 1) {
diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
index 96cde1a..d3ad1c5 100644
--- a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html
@@ -196,6 +196,22 @@
 
 
                             </div>
+
+                            <div class="form-group">
+                                <label class="col-sm-2 control-label">是否虚拟产品
+                                </label>
+                                <div class="col-sm-4">
+                                    <select th:field="${obj.isUnrealProduct}" class="form-control select2 " size="1"
+                                            name="isUnrealProduct"
+                                            style="width: 100%">
+                                        <option value="2" th:selected="${obj.isUnrealProduct == '2'}">否</option>
+                                        <option value="1" th:selected="${obj.isUnrealProduct == '1'}">是</option>
+                                        </option>
+
+                                    </select>
+                                </div>
+
+                            </div>
                         </div>
                     </div>
                 </div>

--
Gitblit v1.9.1