Merge remote-tracking branch 'origin/score_shop' into score_shop
 
	
	
	
	
	
	
		
		35 files modified
	
		
		2 files added
	
	
 
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  |                     <exclude>config/test/*</exclude> | 
 |  |  |                     <exclude>config/xcx/*</exclude> | 
 |  |  |  | 
 |  |  |                     <!-- | 
 |  |  |                     <!----> | 
 |  |  |                     <exclude>config/config.json</exclude> | 
 |  |  |                     <exclude>config/application.properties</exclude> | 
 |  |  |                     <exclude>config/system.properties</exclude> | 
 |  |  |                     --> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 
 |  |  | 
 |  |  | package com.matrix; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import java.io.FileWriter; | 
 |  |  | import java.io.IOException; | 
 |  |  | import java.math.BigDecimal; | 
 |  |  |  | 
 |  |  | public class TestClass { | 
 |  |  |     public static void main(String[] args) throws IOException { | 
 
 |  |  | 
 |  |  |      * 支付方式-现金支付 | 
 |  |  |      */ | 
 |  |  |     String PAY_TYPE_MOENY = "现金"; | 
 |  |  |     /** | 
 |  |  |      * 支付方式-现金支付 | 
 |  |  |      */ | 
 |  |  |     String PAY_TYPE_MOENY_CARD = "会员卡"; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 支付方式-卡支付 | 
 |  |  |      */ | 
 
 |  |  | 
 |  |  | package com.matrix.system.hive.action; | 
 |  |  |  | 
 |  |  | import cn.hutool.core.collection.CollUtil; | 
 |  |  | import com.matrix.component.rabbitmq.RabiitMqTemplate; | 
 |  |  | import com.matrix.core.constance.MatrixConstance; | 
 |  |  | import com.matrix.core.exception.GlobleException; | 
 |  |  | 
 |  |  | import com.matrix.system.hive.pojo.ShoppingCarItem; | 
 |  |  | import com.matrix.system.hive.pojo.ShoppingCarItemsVo; | 
 |  |  | import com.matrix.system.hive.service.*; | 
 |  |  | import com.matrix.system.shopXcx.mqTask.MQTaskRouting; | 
 |  |  | import com.matrix.system.wechart.templateMsg.UniformMsgParam; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.beans.factory.annotation.Value; | 
 |  |  | import org.springframework.stereotype.Controller; | 
 |  |  | 
 |  |  | import java.net.URLEncoder; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Arrays; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  | public class OrderController extends BaseController { | 
 |  |  |     @Resource | 
 |  |  |     private SysOrderService orderService; | 
 |  |  |     @Autowired | 
 |  |  |     ShoppingGoodsDao shoppingGoodsDao; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private CodeService codeService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SysOrderItemDao orderItemDao; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     RabiitMqTemplate rabiitMqTemplate; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SysProjServicesDao sysProjServicesDao; | 
 |  |  |  | 
 |  |  |     @Value("${evn}") | 
 |  |  |     private String evn; | 
 |  |  |  | 
 |  |  | 
 |  |  |     AjaxResult payOrder(@RequestBody SysOrder sysOrder) { | 
 |  |  |         SysUsers user = getMe(); | 
 |  |  |         sysOrder.setShopId(user.getShopId()); | 
 |  |  |         sysOrder.setOrderType(SysOrder.ORDER_TYPE_SEAL); | 
 |  |  |         sysOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_N); | 
 |  |  |         //校验订单是否满足结算调价,新订单则保存订单,已有订单则删除后更新 | 
 |  |  |         sysOrder = orderService.checkAndSaveOrder(sysOrder); | 
 |  |  |         orderService.updateReceiptMoney(sysOrder); | 
 |  |  |  | 
 |  |  |         //发送微信公众号提醒 | 
 |  |  | //        UniformMsgParam uniformMsgParam=new UniformMsgParam(user.getCompanyId(),UniformMsgParam.GZH_GMCG); | 
 |  |  | //        uniformMsgParam.put("orderId",sysOrder.getId()); | 
 |  |  | //        rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString()); | 
 |  |  |         UniformMsgParam uniformMsgParam=new UniformMsgParam(user.getCompanyId(),UniformMsgParam.GZH_GMCG); | 
 |  |  |         uniformMsgParam.put("orderId",sysOrder.getId()); | 
 |  |  |         rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,uniformMsgParam.toJSONString()); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         //处理用户购买的产品 | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     @RequestMapping(value = "/refundOrder") | 
 |  |  |     @ResponseBody | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public AjaxResult refundOrder(@RequestBody SysOrder sysOrder) { | 
 |  |  |         //储值卡订单不能通过退款渠道退款 | 
 |  |  |         if(CollectionUtils.isNotEmpty(sysOrder.getItems())){ | 
 |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         SysUsers user = getMe(); | 
 |  |  |         sysOrder.setShopId(user.getShopId()); | 
 |  |  |         sysOrder.setStatu(Dictionary.ORDER_STATU_TK); | 
 |  |  |         sysOrder.setOrderTime(new Date()); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         //校验订单是否满足结算调价,新订单则保存订单,已有订单则删除后更新 | 
 |  |  |         sysOrder = orderService.checkAndSaveOrder(sysOrder); | 
 |  |  |         orderService.refundOrderMoney(sysOrder); | 
 |  |  |         //处理用户购买的产品 | 
 |  |  |         return AjaxResult.buildSuccessInstance(Arrays.asList(sysOrder), "订单退款成功"); | 
 |  |  | 
 |  |  |         if (order == null) { | 
 |  |  |             return new AjaxResult(AjaxResult.STATUS_FAIL, "订单不存在!"); | 
 |  |  |         } | 
 |  |  |         orderService.cancelOrder(id); | 
 |  |  |         if (del > 0) { | 
 |  |  |             orderService.removeById(id); | 
 |  |  |             result.setInfo("删除成功!"); | 
 |  |  |         } else { | 
 |  |  |             result.setInfo("取消成功!"); | 
 |  |  |  | 
 |  |  |         List<SysOrderItem> items = orderItemDao.selectByOrderId(id); | 
 |  |  |         for (SysOrderItem item : items) { | 
 |  |  |             List<SysProjServices> sysProjServices = sysProjServicesDao.selectProjServicesByOrderItemId(item.getId()); | 
 |  |  |             if (CollUtil.isNotEmpty(sysProjServices)) { | 
 |  |  |                 return new AjaxResult(AjaxResult.STATUS_FAIL, "订单存在进行中的服务单无法取消/删除"); | 
 |  |  |         } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         orderService.cancelOrder(id); | 
 |  |  | //        if (del > 0) { | 
 |  |  | //            orderService.removeById(id); | 
 |  |  | //            result.setInfo("删除成功!"); | 
 |  |  | //        } else { | 
 |  |  |             result.setInfo("取消成功!"); | 
 |  |  | //        } | 
 |  |  |         result.setStatus(AjaxResult.STATUS_SUCCESS); | 
 |  |  |  | 
 |  |  |         return result; | 
 
 |  |  | 
 |  |  | package com.matrix.system.hive.action; | 
 |  |  |  | 
 |  |  | import cn.hutool.core.collection.CollUtil; | 
 |  |  | import com.matrix.core.anotations.RemoveRequestToken; | 
 |  |  | import com.matrix.core.constance.MatrixConstance; | 
 |  |  | import com.matrix.core.exception.GlobleException; | 
 |  |  | 
 |  |  |         } | 
 |  |  |         //补充服务单扩展信息=============== | 
 |  |  |         List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(id); | 
 |  |  |         if (CollUtil.isNotEmpty(beauticianStateList)) { | 
 |  |  |             for (SysBeauticianState sysBeauticianState : beauticianStateList) { | 
 |  |  |                 if (sysBeauticianState.getProjUse().getTaocanId() != null) { | 
 |  |  |                     SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId()); | 
 |  |  |                     sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName()+"--"+sysBeauticianState.getProjInfo().getName()); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         projServices.setServiceItems(beauticianStateList); | 
 |  |  |         SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId()); | 
 |  |  |         projServices.setBedState(sysBedState); | 
 |  |  | 
 |  |  |  | 
 |  |  |         //补充服务单扩展信息=============== | 
 |  |  |         List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId()); | 
 |  |  |         if (CollUtil.isNotEmpty(beauticianStateList)) { | 
 |  |  |             for (SysBeauticianState sysBeauticianState : beauticianStateList) { | 
 |  |  |                 if (sysBeauticianState.getProjUse().getTaocanId() != null) { | 
 |  |  |                     SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId()); | 
 |  |  |                     sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName()+"--"+sysBeauticianState.getProjInfo().getName()); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         projServices.setServiceItems(beauticianStateList); | 
 |  |  |  | 
 |  |  |         SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId()); | 
 |  |  | 
 |  |  |         if (balanceverifyResult.isError()) { | 
 |  |  |             return new AjaxResult(AjaxResult.STATUS_FAIL, balanceverifyResult.getMsg()); | 
 |  |  |         } | 
 |  |  |         sysProjServices.setState(Dictionary.SERVICE_STATU_YYCG); | 
 |  |  |         sysProjServices.setState(Dictionary.SERVICE_STATU_DYY); | 
 |  |  |         SysProjServices newSysProjServices = sysProjServicesService.addSysProjServices(sysProjServices); | 
 |  |  |         if (newSysProjServices != null) { | 
 |  |  |             return AjaxResult.buildSuccessInstance(Arrays.asList(newSysProjServices)); | 
 
 |  |  | 
 |  |  |     private Long  vipId; | 
 |  |  |              | 
 |  |  |      | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 购买业绩 | 
 |  |  |      */ | 
 |  |  |     private Double  goodsCash; | 
 |  |  | 	 | 
 |  |  |     /** | 
 |  |  |      * 赠送消耗 | 
 |  |  |      */ | 
 |  |  | 
 |  |  |     private Double  hisConsume; | 
 |  |  |              | 
 |  |  |      | 
 |  |  |     /** | 
 |  |  |      * 划扣金额 从卡中划扣钱买东西 | 
 |  |  |      */ | 
 |  |  |     private Double  consume; | 
 |  |  | 			 | 
 |  |  | 	 | 
 |  |  |     /** | 
 |  |  |      * 卡项,套餐,充值,开会籍卡 | 
 |  |  |      */ | 
 |  |  |     private Double  cardCash; | 
 |  |  | 			 | 
 |  |  | 	 | 
 |  |  |     /** | 
 |  |  |      * 现金单次,购买项目的业绩 | 
 |  |  |      */ | 
 |  |  |     private Double  projCash; | 
 |  |  | 			 | 
 |  |  | 	 | 
 |  |  |     /** | 
 |  |  |      * 现金产品,购买家居产品的钱 | 
 |  |  |      */ | 
 |  |  |     private Double  goodsCash; | 
 |  |  |              | 
 |  |  |      | 
 |  |  |     /** | 
 |  |  | 
 |  |  |      * 总金额 | 
 |  |  |      */ | 
 |  |  |     private Double  zkTotal; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 公司id | 
 |  |  |      */ | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 业绩种类 1-现金业绩 2-划扣业绩 | 
 |  |  |      * 业绩类型 | 
 |  |  |      */ | 
 |  |  |     private String  t3; | 
 |  |  |     private String  achieveType; | 
 |  |  |              | 
 |  |  |      | 
 |  |  |     private String  t4; | 
 |  |  | 
 |  |  |     private Date  endTime; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 分配的业绩金额 | 
 |  |  |      */ | 
 |  |  |     @Extend | 
 |  |  |     private Double achieveMoney; | 
 |  |  |  | 
 |  |  |     private String goodsNo; | 
 |  |  |  | 
 |  |  |     private String goodsName; | 
 |  |  |  | 
 |  |  |     private String type; | 
 |  |  |  | 
 |  |  |     private String payMethod; | 
 |  |  |  | 
 |  |  |     private String cateName; | 
 |  |  |  | 
 |  |  |     public String getCateName() { | 
 |  |  |         return cateName; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setCateName(String cateName) { | 
 |  |  |         this.cateName = cateName; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getPayMethod() { | 
 |  |  |         return payMethod; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setPayMethod(String payMethod) { | 
 |  |  |         this.payMethod = payMethod; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getType() { | 
 |  |  |         return type; | 
 |  |  | 
 |  |  |         this.companyId = companyId; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Double getAchieveMoney() { | 
 |  |  |         return achieveMoney; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setAchieveMoney(Double achieveMoney) { | 
 |  |  |         this.achieveMoney = achieveMoney; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Date getBeginTime() { | 
 |  |  |         return beginTime; | 
 |  |  | 
 |  |  |     public void setHisConsume(Double hisConsume) { | 
 |  |  |         this.hisConsume = hisConsume; | 
 |  |  |     } | 
 |  |  |     public Double getConsume() { | 
 |  |  |         return consume; | 
 |  |  |     } | 
 |  |  |     public void setConsume(Double consume) { | 
 |  |  |         this.consume = consume; | 
 |  |  |     } | 
 |  |  |     public Double getCardCash() { | 
 |  |  |         return cardCash; | 
 |  |  |     } | 
 |  |  |     public void setCardCash(Double cardCash) { | 
 |  |  |         this.cardCash = cardCash; | 
 |  |  |     } | 
 |  |  |     public Double getProjCash() { | 
 |  |  |         return projCash; | 
 |  |  |     } | 
 |  |  |     public void setProjCash(Double projCash) { | 
 |  |  |         this.projCash = projCash; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public Double getGoodsCash() { | 
 |  |  |         return goodsCash; | 
 |  |  |     } | 
 |  |  | 
 |  |  |     public void setT2(String t2) { | 
 |  |  |         this.t2 = t2; | 
 |  |  |     } | 
 |  |  |     public String getT3() { | 
 |  |  |         return t3; | 
 |  |  |  | 
 |  |  |     public String getAchieveType() { | 
 |  |  |         return achieveType; | 
 |  |  |     } | 
 |  |  |     public void setT3(String t3) { | 
 |  |  |         this.t3 = t3; | 
 |  |  |  | 
 |  |  |     public void setAchieveType(String achieveType) { | 
 |  |  |         this.achieveType = achieveType; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getT4() { | 
 |  |  |         return t4; | 
 |  |  |     } | 
 
 |  |  | 
 |  |  | package com.matrix.system.hive.bean; | 
 |  |  |  | 
 |  |  | import com.fasterxml.jackson.annotation.JsonFormat; | 
 |  |  | import com.matrix.core.tools.DateUtil; | 
 |  |  | import org.springframework.format.annotation.DateTimeFormat; | 
 |  |  |  | 
 |  |  | 
 |  |  |  */ | 
 |  |  | public class SysOrder implements Serializable { | 
 |  |  |  | 
 |  |  |     private static final long serialVersionUID = 1L; | 
 |  |  |     /** | 
 |  |  |      * 订单类型-销售订单 | 
 |  |  |      */ | 
 |  |  |     public static final int ORDER_TYPE_SEAL= 1; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 订单类型-退款订单 | 
 |  |  |      */ | 
 |  |  |     public static final int ORDER_TYPE_REFUND= 2; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 序号 | 
 |  |  | 
 |  |  |     /** | 
 |  |  |      * 订单总价 | 
 |  |  |      */ | 
 |  |  |     private double total; | 
 |  |  |     private Double total; | 
 |  |  |     /** | 
 |  |  |      * 折后价 | 
 |  |  |      */ | 
 |  |  |     private double zkTotal; | 
 |  |  |     private Double zkTotal; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 现金支付金额 | 
 |  |  |      */ | 
 |  |  |     private double cashPay; | 
 |  |  |     private Double cashPay; | 
 |  |  |     /** | 
 |  |  |      * 现金支付金额 | 
 |  |  |      */ | 
 |  |  |     private double cardPay; | 
 |  |  |     private Double cardPay; | 
 |  |  |     /** | 
 |  |  |      * 欠款金额 | 
 |  |  |      */ | 
 |  |  |     private double arrears; | 
 |  |  |     private Double arrears; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 店铺id | 
 |  |  | 
 |  |  |      * 会员姓名 | 
 |  |  |      */ | 
 |  |  |     private String vipNo; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 订单类型1,销售订单,2退款订单 | 
 |  |  |      */ | 
 |  |  |     private Integer orderType; | 
 |  |  |      | 
 |  |  |     /* 会员手机号 | 
 |  |  |      */ | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     private Integer times; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private String type; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 原有订单ID 退款时使用 | 
 |  |  |      */ | 
 |  |  |     private Long oldOrderId; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 该订单有退款 | 
 |  |  |      */ | 
 |  |  |     public static final Integer IS_HAS_REFUND_Y = 1; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 该订单无退款 | 
 |  |  |      */ | 
 |  |  |     public static final Integer IS_HAS_REFUND_N = 2; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否发生退款 1-是 2-否 | 
 |  |  |      */ | 
 |  |  |     private Integer isHasRefund; | 
 |  |  |  | 
 |  |  |     public Integer getIsHasRefund() { | 
 |  |  |         return isHasRefund; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setIsHasRefund(Integer isHasRefund) { | 
 |  |  |         this.isHasRefund = isHasRefund; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Long getOldOrderId() { | 
 |  |  |         return oldOrderId; | 
 |  |  | 
 |  |  |  | 
 |  |  |     public void setShopShortName(String shopShortName) { | 
 |  |  |         this.shopShortName = shopShortName; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Integer getOrderType() { | 
 |  |  |         return orderType; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setOrderType(Integer orderType) { | 
 |  |  |         this.orderType = orderType; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getType() { | 
 |  |  | 
 |  |  |         this.searchShop = searchShop; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public double getArrears() { | 
 |  |  |     public Double getArrears() { | 
 |  |  |         return arrears; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setArrears(double arrears) { | 
 |  |  |     public void setArrears(Double arrears) { | 
 |  |  |         this.arrears = arrears; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public double getCardPay() { | 
 |  |  |     public Double getCardPay() { | 
 |  |  |         return cardPay; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setCardPay(double cardPay) { | 
 |  |  |     public void setCardPay(Double cardPay) { | 
 |  |  |         this.cardPay = cardPay; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     public void setEndTimeVo(Date endTimeVo) { | 
 |  |  |         this.endTimeVo = endTimeVo; | 
 |  |  |     } | 
 |  |  |     public double getCashPay() { | 
 |  |  |     public Double getCashPay() { | 
 |  |  |         return cashPay; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setCashPay(double cashPay) { | 
 |  |  |     public void setCashPay(Double cashPay) { | 
 |  |  |         this.cashPay = cashPay; | 
 |  |  |     } | 
 |  |  |      | 
 |  |  | 
 |  |  |         this.activity = activity; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public double getTotal() { | 
 |  |  |     public Double getTotal() { | 
 |  |  |         return total; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setTotal(double total) { | 
 |  |  |     public void setTotal(Double total) { | 
 |  |  |         this.total = total; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |         this.changeId = changeId; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public double getZkTotal() { | 
 |  |  |     public Double getZkTotal() { | 
 |  |  |         return zkTotal; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setZkTotal(double zkTotal) { | 
 |  |  |     public void setZkTotal(Double zkTotal) { | 
 |  |  |         this.zkTotal = zkTotal; | 
 |  |  |     } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     private Integer count; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 退款数量 | 
 |  |  |      */ | 
 |  |  |     private Integer refundCount; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 是否为赠送和 是否 | 
 |  |  | 
 |  |  |     private Double arrears; | 
 |  |  |      | 
 |  |  |  | 
 |  |  | 	 | 
 |  |  | 	 | 
 |  |  |     //页面参数使用 | 
 |  |  |     /** | 
 |  |  |      * 付款方式 | 
 |  |  |      */ | 
 |  |  | 
 |  |  |      * 付款卡id 卡使用情况id | 
 |  |  |      */ | 
 |  |  |     private Long cardId; | 
 |  |  | 	 | 
 |  |  |      | 
 |  |  |      | 
 |  |  |     /** | 
 |  |  | 
 |  |  |         return preCount; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Integer getRefundCount() { | 
 |  |  |         return refundCount; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setRefundCount(Integer refundCount) { | 
 |  |  |         this.refundCount = refundCount; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setPreCount(int preCount) { | 
 |  |  |         this.preCount = preCount; | 
 |  |  |     } | 
 |  |  | 
 |  |  |     /** | 
 |  |  |      * 业绩计算 | 
 |  |  |      */ | 
 |  |  |     private List<AchieveNew> achaeveList; | 
 |  |  |     private List<AchieveNew> achieveList; | 
 |  |  |  | 
 |  |  |     public List<AchieveNew> getAchaeveList() { | 
 |  |  |         return achaeveList; | 
 |  |  |  | 
 |  |  |     public List<AchieveNew> getAchieveList() { | 
 |  |  |         return achieveList; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setAchaeveList(List<AchieveNew> achaeveList) { | 
 |  |  |         this.achaeveList = achaeveList; | 
 |  |  |     public void setAchieveList(List<AchieveNew> achieveList) { | 
 |  |  |         this.achieveList = achieveList; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getPayMethodDetail() { | 
 
 |  |  | 
 |  |  | package com.matrix.system.hive.dao; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | import com.matrix.core.pojo.PaginationVO; | 
 |  |  | import com.matrix.system.app.vo.OrderDetailAchieveItemVo; | 
 |  |  | import com.matrix.system.app.vo.RankingVo; | 
 |  |  | import com.matrix.system.app.vo.UserAchieveVo; | 
 |  |  | import com.matrix.system.hive.bean.AchieveNew; | 
 |  |  | import org.apache.ibatis.annotations.Param; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |     List<AchieveNew> selectOrderItemAchieveByOrderId(Long orderId); | 
 |  |  |  | 
 |  |  |     List<RankingVo> selectStaffSaleAchieveRanking(@Param("record") AchieveNew achieveNew); | 
 |  |  |  | 
 |  |  |     int deleteByOrderId(@Param("orderId") Long orderId); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     int updateNoticeTimes(@Param("list")List<Long> noticedIds); | 
 |  |  |  | 
 |  |  |     List<SysProjServices> selectProjServicesByOrderItemId(@Param("itemId") Long itemId); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |         if (CollectionUtils.isNotEmpty(pageOrder.getItems())) { | 
 |  |  |             for (SysOrderItem orderItem : pageOrder.getItems()) { | 
 |  |  |  | 
 |  |  |                 if (orderItem != null && CollectionUtils.isNotEmpty(orderItem.getAchaeveList())) { | 
 |  |  |                 if (orderItem != null && CollectionUtils.isNotEmpty(orderItem.getAchieveList())) { | 
 |  |  |  | 
 |  |  |                     for (AchieveNew achieveNew : orderItem.getAchaeveList()) { | 
 |  |  |                         if (achieveNew !=null   && achieveNew.getT1()!=null) { | 
 |  |  |                     for (AchieveNew achieveNew : orderItem.getAchieveList()) { | 
 |  |  |                         if (achieveNew !=null   && achieveNew.getGoodsCash()!=null) { | 
 |  |  |                             buildAchieve(pageOrder,  orderItem, achieveNew); | 
 |  |  |                             // 新增美疗师业绩 | 
 |  |  |                             achieveNewList.add(achieveNew); | 
 |  |  | 
 |  |  |         if (Dictionary.ORDER_STATU_TK.equals(pageOrder.getStatu())) { | 
 |  |  |             achieveNew.setId(null); | 
 |  |  |             achieveNew.setProjPercentage(0 - achieveNew.getProjPercentage()); | 
 |  |  |             achieveNew.setT1((0 - Double.parseDouble(achieveNew.getT1())) + ""); | 
 |  |  |             achieveNew.setGoodsCash(0 - achieveNew.getGoodsCash()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         achieveNew.setVipId(pageOrder.getVipId()); | 
 |  |  | 
 |  |  |         achieveNew.setShoppingGoodsId(orderItem.getGoodsId()); | 
 |  |  |         // 是否赠送 | 
 |  |  |         achieveNew.setT2(orderItem.getIsFree()); | 
 |  |  |         // 根据商品类型设置业绩类型 | 
 |  |  |  | 
 |  |  |         if (Dictionary.ACHIEVE_TYPE_CASH.equals(achieveNew.getT3())){ | 
 |  |  |             achieveNew.setCardCash(Double.parseDouble(achieveNew.getT1())); | 
 |  |  |         } else { | 
 |  |  |             // 设置划扣金额 | 
 |  |  |             achieveNew.setConsume(Double.parseDouble(achieveNew.getT1())); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public SysOrder checkAndSaveOrder(SysOrder sysOrder) { | 
 |  |  |         // 收款改变订单状态 | 
 |  |  |         SysOrder source = null; | 
 |  |  |         if (sysOrder.getId() != null) { | 
 |  |  |             source = sysOrderDao.selectById(sysOrder.getId()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 计算订单折扣金额,收款情况下 计算订单总额 | 
 |  |  |         double zkTotal = 0.0; | 
 |  |  | 
 |  |  |         SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); | 
 |  |  |         sysOrder.setZkTotal(zkTotal); | 
 |  |  |         sysOrder.setStatu(orderStatus); | 
 |  |  |         SysOrder source = null; | 
 |  |  |         if (sysOrder.getId() != null) { | 
 |  |  |             source = sysOrderDao.selectById(sysOrder.getId()); | 
 |  |  |         } | 
 |  |  |         sysOrder.setStaffId(source != null ? source.getStaffId() : user.getSuId()); | 
 |  |  |         sysOrder.setCompanyId(source != null ? source.getCompanyId() : user.getCompanyId()); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 取消订单 | 
 |  |  |      * 本方法无法退回多次不同卡项收款的订单 | 
 |  |  |      * | 
 |  |  |      * @param id | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  | 
 |  |  |                 throw new GlobleException("订单已取消"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(id); | 
 |  |  |  | 
 |  |  |             for (SysOrderItem orderItem : sysOrderItems) { | 
 |  |  |  | 
 |  |  |             List<SysOrderFlow> flows = sysOrderFlowDao.selectByOrderId(id); | 
 |  |  |                 //非现金收款退回扣卡余额 | 
 |  |  |                 if (StringUtils.isNotBlank(orderItem.getPayMethodDetail())) { | 
 |  |  |             for (SysOrderFlow flow : flows) { | 
 |  |  |                 if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { | 
 |  |  |  | 
 |  |  |                     MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(Long.parseLong(orderItem.getPayMethodDetail())); | 
 |  |  |                     MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); | 
 |  |  |                     MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); | 
 |  |  |  | 
 |  |  |                     if (moneyCardUse != null) { | 
 |  |  |  | 
 |  |  |                         // 根据订单明细判断是赠送金额购买还是本金购买 | 
 |  |  |  | 
 |  |  |                         moneyCardUseFlow.setTotal(orderItem.getCardPay()); | 
 |  |  |                         moneyCardUse.setRealMoney(MoneyUtil.add(moneyCardUse.getRealMoney(), orderItem.getCardPay())); | 
 |  |  |                         //TODO 目前无法退回到具体的赠送金额还是本金 | 
 |  |  |                         moneyCardUseFlow.setTotal(flow.getAmount().doubleValue()); | 
 |  |  |                         if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { | 
 |  |  |                             moneyCardUse.setGiftMoney(MoneyUtil.add(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue())); | 
 |  |  |                         } else { | 
 |  |  |                             moneyCardUse.setRealMoney(MoneyUtil.add(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue())); | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         if (!moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y)) { | 
 |  |  |                             if (moneyCardUse.getLastCount() != null) { | 
 |  |  | 
 |  |  |                         moneyCardUseFlowDao.insert(moneyCardUseFlow); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(id); | 
 |  |  |             for (SysOrderItem orderItem : sysOrderItems) { | 
 |  |  |                 // 充值卡类型退款 | 
 |  |  |                 if (Dictionary.SHOPPING_GOODS_TYPE_CZK.equals(orderItem.getType())) { | 
 |  |  |  | 
 |  |  |                     ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(orderItem.getGoodsId()); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                     //删除购买的充值卡 | 
 |  |  |                     moneyCardUseDao.deleteByOrderItemId(orderItem.getId()); | 
 |  |  |  | 
 |  |  |                 } else if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(orderItem.getType()) | 
 |  |  |                         || Dictionary.SHOPPING_GOODS_TYPE_TC.equals(orderItem.getType())) { | 
 |  |  |                     // 项目套餐退款 | 
 |  |  |                     // 删除套餐项目使用情况 | 
 |  |  |                     sysProjUseDao.deleteByOrderItemId(orderItem.getId()); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 } else if (Dictionary.SHOPPING_GOODS_TYPE_ZHK.equals(orderItem.getType())) { | 
 |  |  |                     // 综合卡 | 
 |  |  |                     // 删除套餐项目使用情况 | 
 |  |  |                     sysProjUseDao.deleteByOrderItemId(orderItem.getId()); | 
 |  |  |                     // 删除充值卡 | 
 |  |  |                     moneyCardUseDao.deleteByOrderItemId(orderItem.getId()); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |             // 取消订单 | 
 |  |  |             order.setStatu(Dictionary.ORDER_STATU_YQX); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             return sysOrderDao.update(order); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         if (!Dictionary.ORDER_STATU_DFK.equals(pageOrder.getStatu())) { | 
 |  |  |             throw new GlobleException("该订单已经收过款,请刷新页面再试!"); | 
 |  |  |         } | 
 |  |  |         // 更新收款时间 | 
 |  |  |         pageOrder.setPayTime(new Date()); | 
 |  |  |         pageOrder.setStatu(Dictionary.ORDER_STATU_YFK); | 
 |  |  |         sysOrderDao.update(pageOrder); | 
 |  |  |  | 
 |  |  |         // 获取用户信息 | 
 |  |  |         SysVipInfo vipInfo = sysVipInfoDao.selectById(pageOrder.getVipId()); | 
 |  |  | 
 |  |  |             sysVipInfoDao.update(vipInfo); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //设置订单的成交状态 | 
 |  |  |         changeOrderStatu(pageOrder); | 
 |  |  |         //添加支付流水 | 
 |  |  |         addOrderFlow(pageOrder); | 
 |  |  |  | 
 |  |  |         // 设置会员充值卡使用情况 | 
 |  |  |         addMoneyCardUse(pageOrder); | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 收款改变订单状态,划扣金额 | 
 |  |  |      * 创建支付流水 | 
 |  |  |      * | 
 |  |  |      * @author:姜友瑶 | 
 |  |  |      */ | 
 |  |  |     private void changeOrderStatu(SysOrder sourceOrder) { | 
 |  |  |     private void addOrderFlow(SysOrder sourceOrder) { | 
 |  |  |  | 
 |  |  |         String orderStatus = Dictionary.ORDER_STATU_YFK; | 
 |  |  |         String flowType = SysOrderFlow.FLOW_TYPE_BUY; | 
 |  |  |         double cashPayTotal = 0D; | 
 |  |  |         double cardPayTotal = 0D; | 
 |  |  |  | 
 |  |  |         //处理支付流水 | 
 |  |  |         int flowCount = 1; | 
 |  |  |         for (SysOrderFlow flow : sourceOrder.getFlows()) { | 
 |  |  |  | 
 |  |  |             //支付内容摘要设置 | 
 |  |  |             Long goodsId = sourceOrder.getItems().get(0).getGoodsId(); | 
 |  |  |             ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); | 
 |  |  |             flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品"); | 
 |  |  |  | 
 |  |  |             // 若是退款,则取负数 | 
 |  |  |             if (Dictionary.ORDER_STATU_TK.equals(sourceOrder.getStatu())) { | 
 |  |  |                 flowType = SysOrderFlow.FLOW_TYPE_REFUND; | 
 |  |  |             if (SysOrder.ORDER_TYPE_REFUND==sourceOrder.getOrderType()) { | 
 |  |  |                 flow.setFlowType(SysOrderFlow.FLOW_TYPE_REFUND); | 
 |  |  |                 flow.setAmount(flow.getAmount().negate()); | 
 |  |  |                 flow.setOrderId(sourceOrder.getOldOrderId()); | 
 |  |  |             } else { | 
 |  |  |                 flow.setFlowType(SysOrderFlow.FLOW_TYPE_BUY); | 
 |  |  |                 flow.setOrderId(sourceOrder.getId()); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //欠款处理 | 
 |  |  |             if (SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod())) { | 
 |  |  |                 orderStatus = Dictionary.ORDER_STATU_QK; | 
 |  |  |                 sourceOrder.setStatu(Dictionary.ORDER_STATU_QK); | 
 |  |  |                 sourceOrder.setArrears(flow.getAmount().doubleValue()); | 
 |  |  |                 sysOrderDao.update(sourceOrder); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //统计储值卡支付 | 
 |  |  |             if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { | 
 |  |  |                 if (flow.getCardId() != null) { | 
 |  |  |                     MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); | 
 |  |  |                     cardPayTotal += flow.getAmount().doubleValue(); | 
 |  |  |  | 
 |  |  |                     //修改储值卡余额 | 
 |  |  |                     cardPaySk(moneyCardUse, sourceOrder, flow); | 
 |  |  |                 }else{ | 
 |  |  |                     throw new GlobleException("无效的储值卡支付方式"); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             //统计现金支付 | 
 |  |  |             if (!SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod()) | 
 |  |  |                     && !SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { | 
 |  |  |                 cashPayTotal += flow.getAmount().doubleValue(); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             flow.setFlowNo(codeService.getFlowCode() + "-" + flowCount); | 
 |  |  |             flow.setVipId(sourceOrder.getVipId()); | 
 |  |  |             flow.setFlowType(flowType); | 
 |  |  |             flow.setShopId(sourceOrder.getShopId()); | 
 |  |  |             flow.setCompanyId(sourceOrder.getCompanyId()); | 
 |  |  |             sysOrderFlowDao.insert(flow); | 
 |  |  |             flowCount++; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //修改订单信息 | 
 |  |  |         if (Dictionary.ORDER_STATU_TK.equals(sourceOrder.getStatu())) { | 
 |  |  |             orderStatus = Dictionary.ORDER_STATU_TK; | 
 |  |  |         } | 
 |  |  |         // 更新收款状态 | 
 |  |  |         sourceOrder.setPayTime(new Date()); | 
 |  |  |         sourceOrder.setStatu(orderStatus); | 
 |  |  |         sourceOrder.setCardPay(cardPayTotal); | 
 |  |  |         sourceOrder.setCashPay(cashPayTotal); | 
 |  |  |         sysOrderDao.update(sourceOrder); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |             return true; | 
 |  |  |         } else { | 
 |  |  |             // 不是一卡通, | 
 |  |  |             // 判断卡是否可应用于所有产品 | 
 |  |  |             ShoppingGoods cardGoods = shoppingGoodsDao.selectById(moneyCardUse.getGoodsId()); | 
 |  |  |             if (cardGoods != null) { | 
 |  |  |                 if (Dictionary.FLAG_YES.equals(cardGoods.getCarIsAll())) { | 
 |  |  |                     return true; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 比较分类 | 
 |  |  |             MoneyCardAssemble moneyCardAssemble = new MoneyCardAssemble(); | 
 |  |  |             moneyCardAssemble.setCardId(moneyCardUse.getGoodsId()); | 
 |  |  | 
 |  |  |         orderItem.setIsFree(Dictionary.FLAG_NO); | 
 |  |  |         orderItem.setPrice(czVo.getBjmoney()); | 
 |  |  |         orderItem.setStatus(Dictionary.ORDER_STATU_YFK); | 
 |  |  |         orderItem.setAchaeveList(czVo.getAchaeveList()); | 
 |  |  |         orderItem.setAchieveList(czVo.getAchaeveList()); | 
 |  |  |         orderItemDao.insert(orderItem); | 
 |  |  |         List<SysOrderItem> items = new ArrayList<>(); | 
 |  |  |         items.add(orderItem); | 
 |  |  | 
 |  |  |         moneyCardUseFlowDao.insert(moneyCardUseFlow); | 
 |  |  |  | 
 |  |  |         order.setFlows(czVo.getFlows()); | 
 |  |  |         changeOrderStatu(order); | 
 |  |  |         addOrderFlow(order); | 
 |  |  |         // 添加员工业绩 | 
 |  |  |         achieveNewService.addAchaeveByOrder(order); | 
 |  |  |         return order; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     @Override | 
 |  |  |     public void refundOrderMoney(SysOrder pageOrder) { | 
 |  |  |     public void refundOrderMoney(SysOrder sysOrder) { | 
 |  |  |         SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); | 
 |  |  |  | 
 |  |  |         // 修改订单状态 | 
 |  |  |         changeOrderStatu(pageOrder); | 
 |  |  |         //原订单设置为退款状态 | 
 |  |  |         SysOrder sourceOrder=new SysOrder(); | 
 |  |  |         sourceOrder.setId(sysOrder.getOldOrderId()); | 
 |  |  |         sourceOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_Y); | 
 |  |  | //        sourceOrder.setStatu(Dictionary.ORDER_STATU_TK); | 
 |  |  |         sysOrderDao.update(sourceOrder); | 
 |  |  |  | 
 |  |  |         List<SysOrderItem> returnItems = new ArrayList<>(); | 
 |  |  |         for (SysOrderItem item : pageOrder.getItems()) { | 
 |  |  |         sysOrder.setId(null); | 
 |  |  |         sysOrder.setStaffId(user.getSuId()); | 
 |  |  |         sysOrder.setCompanyId(user.getCompanyId()); | 
 |  |  |         sysOrder.setShopId(user.getShopId()); | 
 |  |  |         sysOrder.setOrderType(SysOrder.ORDER_TYPE_REFUND); | 
 |  |  |         sysOrder.setStatu(Dictionary.ORDER_STATU_YFK); | 
 |  |  |         Date now = new Date(); | 
 |  |  |         sysOrder.setOrderTime(now); | 
 |  |  |         sysOrder.setPayTime(now); | 
 |  |  |         sysOrder.setOrderNo(codeService.getRefundOrderNo()); | 
 |  |  |         sysOrder.setZkTotal(-sysOrder.getZkTotal()); | 
 |  |  |         sysOrder.setOrderType(SysOrder.ORDER_TYPE_REFUND); | 
 |  |  |         //新增订单 | 
 |  |  |         sysOrderDao.insert(sysOrder); | 
 |  |  |         //插入明细 | 
 |  |  |         for (SysOrderItem item : sysOrder.getItems()) { | 
 |  |  |  | 
 |  |  |             //更新原订单明细的可退数量 | 
 |  |  |             SysOrderItem oldItem=new SysOrderItem(); | 
 |  |  |             oldItem.setId(item.getId()); | 
 |  |  |             oldItem.setRefundCount(item.getCount()); | 
 |  |  |             orderItemDao.update(oldItem); | 
 |  |  |  | 
 |  |  |             //插入新的订单明细 | 
 |  |  |             item.setId(null); | 
 |  |  |             item.setCount(-item.getCount()); | 
 |  |  |             item.setOrderId(sysOrder.getId()); | 
 |  |  |             orderItemDao.insert(item); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         // 添加订单收款流水 | 
 |  |  |         addOrderFlow(sysOrder); | 
 |  |  |         //退款退套餐退项目 | 
 |  |  |         refundProjUse(sysOrder); | 
 |  |  |  | 
 |  |  |         // 设置业绩 | 
 |  |  |         achieveNewService.addAchaeveByOrder(sysOrder); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 退款退项目,套餐,卡项 | 
 |  |  |      * @param sysOrder | 
 |  |  |      */ | 
 |  |  |     private void refundProjUse(SysOrder sysOrder) { | 
 |  |  |         SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); | 
 |  |  |  | 
 |  |  |         //记录需要退库存的产品 | 
 |  |  |         List<SysOrderItem> returnGoodsList = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |         for (SysOrderItem item : sysOrder.getItems()) { | 
 |  |  |  | 
 |  |  |             SysProjUse queryProjUse = new SysProjUse(); | 
 |  |  |             queryProjUse.setIsOver(Dictionary.FLAG_NO_N); | 
 |  |  |             queryProjUse.setStatus(Dictionary.TAOCAN_STATUS_YX); | 
 |  |  |             queryProjUse.setOrderItemId(item.getOldItemId()); | 
 |  |  |             // 修改项目信息 | 
 |  |  |             if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(item.getType()) || Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(item.getType())) { | 
 |  |  |  | 
 |  |  |                 if (Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(item.getType())) { | 
 |  |  |                     if (Dictionary.FLAG_YES_Y.equals(item.getIsReturnStore())) { | 
 |  |  |                         returnItems.add(item); | 
 |  |  |                         returnGoodsList.add(item); | 
 |  |  |                     } | 
 |  |  |                 } else { | 
 |  |  |                     SysProjUse sysProjUse = sysProjUseDao.selectByModel(queryProjUse).get(0); | 
 |  |  |  | 
 |  |  |                     int sub = sysProjUse.getSurplusCount() - item.getCount(); | 
 |  |  |                     sysProjUse.setSurplusCount(sub); | 
 |  |  |                     if (sub <= 0) { | 
 |  |  |                     if (sub < 0) { | 
 |  |  |                       throw new GlobleException("项目余次不足"); | 
 |  |  |                     }else if(sub==0){ | 
 |  |  |                         sysProjUse.setIsOver(Dictionary.FLAG_YES_Y); | 
 |  |  |                         sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX); | 
 |  |  |                     } | 
 |  |  |                     sysProjUse.setSurplusCount(sub); | 
 |  |  |                     sysProjUseDao.update(sysProjUse); | 
 |  |  |  | 
 |  |  |                     SysProjUseFlow sysProjUseFlow = SysProjUseMapper.INSTANCE.projUseToFlow(sysProjUse); | 
 |  |  |                     sysProjUseFlow.setOptionType("退款修改"); | 
 |  |  |                     sysProjUseFlow.setId(null); | 
 |  |  | 
 |  |  |             if (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(item.getType())) { | 
 |  |  |                 queryProjUse.setTaocanId(-1L); | 
 |  |  |                 List<SysProjUse> sysProjUses = sysProjUseDao.selectByModel(queryProjUse); | 
 |  |  |                 if (item.getCount() > sysProjUses.size()) { | 
 |  |  |                     throw new GlobleException("数据异常"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 for (int i = 0; i < item.getCount(); i++) { | 
 |  |  |  | 
 |  |  |                     SysProjUse sysProjUse = sysProjUses.get(i); | 
 |  |  |                     sysProjUse.setIsOver(Dictionary.FLAG_YES_Y); | 
 |  |  |                     sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX); | 
 |  |  |  | 
 |  |  |                     sysProjUseDao.update(sysProjUse); | 
 |  |  |                     SysProjUseFlow sysProjUseFlow = SysProjUseMapper.INSTANCE.projUseToFlow(sysProjUse); | 
 |  |  |                     sysProjUseFlow.setOptionType("退款修改"); | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 家居产品退库存 | 
 |  |  |         if (CollectionUtils.isNotEmpty(returnItems)) { | 
 |  |  |             refundInstore(returnItems); | 
 |  |  |         if (CollectionUtils.isNotEmpty(returnGoodsList)) { | 
 |  |  |             refundInstore(returnGoodsList); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 设置业绩 | 
 |  |  |         achieveNewService.addAchaeveByOrder(pageOrder); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 
 |  |  | 
 |  |  |     @Override | 
 |  |  |     public VerifyResult checkArrears(SysProjServices sysProjServices) { | 
 |  |  |         //检测欠款 | 
 |  |  |        /* for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) { | 
 |  |  |  | 
 |  |  |        for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) { | 
 |  |  |             SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId()); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(sysProjUse.getProjId()); | 
 |  |  |             SysOrderItem orderItem = sysOrderItemService.findById(sysProjUse.getOrderItemId()); | 
 |  |  |            SysOrderItem item = sysOrderItemService.findById(sysProjUse.getOrderItemId()); | 
 |  |  |            SysOrder orderItem = sysOrderService.findById(item.getOrderId()); | 
 |  |  |             if ("购买".equals(sysProjUse.getSource())) { | 
 |  |  |                 // 如果用户有欠款,服务单总价不能超过已付金额 | 
 |  |  |                 if (orderItem!=null && orderItem.getArrears() > 0) { | 
 |  |  | 
 |  |  |                     double money = MoneyUtil.sub((bj - orderItem.getArrears()), (yxfje + bcxfje)); | 
 |  |  |                     // 如果 已付金额  - (已消费金额+本次消费金额)<0 则不能再消费 | 
 |  |  |                    if (money < 0) { | 
 |  |  |                         return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 订单编号[ " + sysOrderService.findById(orderItem.getOrderId()).getOrderNo() + " ] "); | 
 |  |  |                         return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 订单编号[ " + orderItem.getOrderNo() + " ] "); | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |             } else if ("赠送".equals(sysProjUse.getSource())) { | 
 |  |  |                 if (orderItem!=null &&orderItem.getArrears() > 0) { | 
 |  |  |                     return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 不能消费赠送项目,订单编号[ " + sysOrderService.findById(orderItem.getOrderId()).getOrderNo() + " ] "); | 
 |  |  |                     return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 不能消费赠送项目,订单编号[ " + orderItem.getOrderNo() + " ] "); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }*/ | 
 |  |  |         } | 
 |  |  |         return new VerifyResult(false); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |             sysOutStoreItemDao.batchInsert(realOutStoreItemList); | 
 |  |  |         } | 
 |  |  |         // 设置服务单状态 | 
 |  |  |         projServices.setState(Dictionary.SERVICE_STATU_PLWC); | 
 |  |  | //        projServices.setState(Dictionary.SERVICE_STATU_PLWC); | 
 |  |  |  | 
 |  |  |         projServices.setState(Dictionary.SERVICE_STATU_FWWC); | 
 |  |  |         if(projServices.getDevisionId()==null){ | 
 |  |  |             //如果没有设置配料师则默认为操作配料的人为配料师 | 
 |  |  |             projServices.setDevisionId(sysUsers.getSuId()); | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 释放床位资源 | 
 |  |  |         SysBedState checkBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getBedId(), projServices.getId()); | 
 |  |  |         if (checkBedState != null) { | 
 |  |  |             checkBedState.setBedState(Dictionary.BED_STATE_SYJS); | 
 |  |  |             bedStateDao.update(checkBedState); | 
 |  |  |         } | 
 |  |  |         projServices.setStartTime(new Date()); | 
 |  |  |         projServices.setEndTime(new Date()); | 
 |  |  |         // 计算时差 | 
 |  |  |         long minspace = DateUtil.getDifTimeMin(projServices.getStartTime(), projServices.getEndTime()) | 
 |  |  |                 - projServices.getTotalTime(); | 
 |  |  |         // 判断是服务超时还是服务提前结束,如果minspace大于0则是超时服务,小于0则是提前结束服务 | 
 |  |  |         projServices.setIsOverTime(minspace + ""); | 
 |  |  |         projServices.setState(Dictionary.SERVICE_STATU_FWWC); | 
 |  |  |         return sysProjServicesDao.update(projServices); | 
 |  |  |     } | 
 |  |  |  | 
 
 |  |  | 
 |  |  | import com.matrix.system.common.tools.ResponseHeadUtil; | 
 |  |  | import com.matrix.system.hive.action.util.QueryUtil; | 
 |  |  | import com.matrix.system.hive.bean.AchieveNew; | 
 |  |  | import com.matrix.system.hive.bean.SysOrder; | 
 |  |  | import com.matrix.system.hive.bean.SysOrderItem; | 
 |  |  | import com.matrix.system.hive.dao.AchieveNewDao; | 
 |  |  | import com.matrix.system.hive.plugin.util.CollectionUtils; | 
 |  |  | import com.matrix.system.hive.service.AchieveNewService; | 
 |  |  | import com.matrix.system.hive.service.SysOrderItemService; | 
 |  |  | import com.matrix.system.hive.service.SysOrderService; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Controller; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | import org.springframework.ui.ModelMap; | 
 |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
 |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SysOrderItemService sysOrderItemService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private AchieveNewDao achieveNewDao; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 门店每日单据明细表 | 
 |  |  | 
 |  |  |         String title = "每日单据明细"; | 
 |  |  |         orderSheet.setSheetName(title); | 
 |  |  |         orderSheet.setTitle(title); | 
 |  |  |         String[] header = {"年", "月", "日",   "订单类型", "订单编号", "会员级别", "姓名", "项目名称", "总金额", "卡项", "现金单次", "现金产品", "划扣", "本金消耗", "赠消", "提成", "顾问", "美疗师", "人头", "项目个数", "项目时间", "门店"}; | 
 |  |  |         String[] header = {"年", "月", "日", "订单编号", "订单类型", "会员姓名", "项目名称", "订单金额", "订单业绩", "收款方式", "业绩类型", "顾问", "美疗师", "本金消耗", "赠消", "提成", "人头", "项目个数", "项目时间", "门店"}; | 
 |  |  |         orderSheet.setHeaders(header); | 
 |  |  |         SysUsers sysUsers = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); | 
 |  |  |         if(!AppConstance.ZONGDIAN.equals(sysUsers.getShopName())){ | 
 |  |  | 
 |  |  |                 temp.add(item.getYear()); | 
 |  |  |                 temp.add(item.getMonth()); | 
 |  |  |                 temp.add(item.getDay()); | 
 |  |  |                 temp.add(item.getOrderType()); | 
 |  |  |                 temp.add(item.getOrderNo()); | 
 |  |  |                 temp.add(item.getLevelName()); | 
 |  |  |                 temp.add(item.getOrderType()); | 
 |  |  |                 temp.add(item.getVipName()); | 
 |  |  |                 temp.add(item.getProName()); | 
 |  |  |                 temp.add(item.getZkTotal()); | 
 |  |  |                 temp.add(item.getCardCash()); | 
 |  |  |                 temp.add(item.getProjCash()); | 
 |  |  |                 temp.add(item.getGoodsCash()); | 
 |  |  |                 temp.add(item.getConsume()); | 
 |  |  |                 temp.add(item.getPayMethod()); | 
 |  |  |                 temp.add(item.getGuwen()); | 
 |  |  |                 temp.add(item.getMeiliao()); | 
 |  |  |                 temp.add(item.getHisConsume()); | 
 |  |  |                 temp.add(item.getFreeConsume()); | 
 |  |  |                 temp.add(item.getProjPercentage()); | 
 |  |  |                 temp.add(item.getGuwen()); | 
 |  |  |                 temp.add(item.getMeiliao()); | 
 |  |  |                 temp.add(item.getNumberOfPeople()); | 
 |  |  |                 temp.add(item.getProjNum()); | 
 |  |  |                 temp.add(item.getProjTime()); | 
 |  |  | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/add") | 
 |  |  |     @ResponseBody | 
 |  |  |     @Transactional | 
 |  |  |     public AjaxResult add(@RequestBody List<AchieveNew> list) { | 
 |  |  |         SysOrder order = sysOrderService.findById(list.get(0).getOrderId()); | 
 |  |  |         List<SysOrderItem> orderItems = sysOrderItemService.findByOrderId(order.getId()); | 
 |  |  |         orderItems.forEach(item -> { | 
 |  |  |             List<AchieveNew> achieveNewList = new ArrayList<>(); | 
 |  |  |             for(AchieveNew achieveNew : list) { | 
 |  |  |                 achieveNewService.removeById(achieveNew.getId()); | 
 |  |  |                 achieveNew.setId(null); | 
 |  |  |                 achieveNew.setConsume(null); | 
 |  |  |                 achieveNew.setCardCash(null); | 
 |  |  |  | 
 |  |  |                 if (achieveNew.getOrderItemId().equals(item.getId())) { | 
 |  |  |                     achieveNewList.add(achieveNew); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             item.setAchaeveList(achieveNewList); | 
 |  |  |         }); | 
 |  |  |         order.setItems(orderItems); | 
 |  |  |         achieveNewService.addAchaeveByOrder(order); | 
 |  |  |         if (CollectionUtils.isNotEmpty(list)) { | 
 |  |  |             //删除原业绩 | 
 |  |  |             achieveNewDao.deleteByOrderId(list.get(0).getOrderId()); | 
 |  |  |             //插入新业绩 | 
 |  |  |             achieveNewDao.batchInsert(list); | 
 |  |  |         return AjaxResult.buildSuccessInstance("保存成功"); | 
 |  |  |         } else { | 
 |  |  |             return AjaxResult.buildFailInstance("未找到业绩数据"); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "      ", notes = "") | 
 |  |  |     @ApiOperation(value = "查询审核进度", notes = "") | 
 |  |  |     @ApiResponses({ | 
 |  |  |             @ApiResponse(code = 200, message = "ok", response = ShopSalesmanApply.class) | 
 |  |  |     }) | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     private Long companyId; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public Long getCompanyId() { | 
 |  |  |         return companyId; | 
 |  |  |     } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public void createOrder(ShopOrder orderDto) { | 
 |  |  |  | 
 |  |  |         //判断是否存在需要同步的产品,只有绑定了erp中产品的才同步 | 
 |  |  |         boolean needTb=false; | 
 |  |  |         for (ShopOrderDetails orderItemDto : orderDto.getDetails()) { | 
 |  |  | 
 |  |  |             order.setTotal(orderDto.getOrderMoney().doubleValue()); | 
 |  |  |             order.setZkTotal(orderDto.getOrderMoney().doubleValue()); | 
 |  |  |             order.setPayTime(new Date()); | 
 |  |  |             order.setArrears(0); | 
 |  |  |             order.setArrears(0D); | 
 |  |  |             int i = sysOrderDao.insert(order); | 
 |  |  |             // 创建订单明细,并计算总价与折扣总价 | 
 |  |  |             int count = 0; | 
 
| New file | 
 |  |  | 
 |  |  | ALTER TABLE `achieve_new` | 
 |  |  |     ADD COLUMN `achieveMoney` double(10, 0) NULL AFTER `company_id`; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | ALTER TABLE `sys_order` | 
 |  |  |     ADD COLUMN `orderType` int(2) NULL COMMENT '订单类型1,销售订单,2退款订单' AFTER `company_id`; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | ALTER TABLE `achieve_new` | 
 |  |  |     CHANGE COLUMN `t3` `achieveType` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `t2`; | 
 |  |  |  | 
 |  |  | ALTER TABLE `sys_order_item` | 
 |  |  |     ADD COLUMN `refundCount` int(11) NULL COMMENT '退款数量' AFTER `pay_method_detail`; | 
 
 |  |  | 
 |  |  |         <result property="vipId" column="vip_id" /> | 
 |  |  |         <result property="freeConsume" column="free_consume" /> | 
 |  |  |         <result property="hisConsume" column="his_consume" /> | 
 |  |  |         <result property="consume" column="consume" /> | 
 |  |  |         <result property="cardCash" column="card_cash" /> | 
 |  |  |         <result property="projCash" column="proj_cash" /> | 
 |  |  |         <result property="goodsCash" column="goods_cash" /> | 
 |  |  |         <result property="projNum" column="proj_num" /> | 
 |  |  |         <result property="numberOfPeople" column="number_of_people" /> | 
 |  |  | 
 |  |  |         <result property="projPercentage" column="proj_percentage" /> | 
 |  |  |         <result property="t1" column="t1" /> | 
 |  |  |         <result property="t2" column="t2" /> | 
 |  |  |         <result property="t3" column="t3" /> | 
 |  |  |         <result property="achieveType" column="achieveType" /> | 
 |  |  |         <result property="t4" column="t4" /> | 
 |  |  |         <result property="t5" column="t5" /> | 
 |  |  |         <result property="t6" column="t6" /> | 
 |  |  | 
 |  |  |  | 
 |  |  |         <result property="goodsNo" column="goodsNo" /> | 
 |  |  |         <result property="goodsName" column="goodsName" /> | 
 |  |  |         <result property="zkPrice" column="zkPrice" /> | 
 |  |  |         <result property="payMethod" column="pay_method" /> | 
 |  |  |         <result property="cateName" column="cateName" /> | 
 |  |  |  | 
 |  |  |     </resultMap> | 
 |  |  |  | 
 |  |  | 
 |  |  |         d.level_name, | 
 |  |  |         c.vip_name, | 
 |  |  |         e.name as pro_name, | 
 |  |  |         a.card_cash, | 
 |  |  |         (IFNULL(a.card_cash,0) +IFNULL(a.proj_cash,0) + IFNULL(a.goods_cash,0) | 
 |  |  |         ) as zk_total, | 
 |  |  |         a.proj_cash, | 
 |  |  |         b.ZK_TOTAL as zk_total, | 
 |  |  |         a.goods_cash, | 
 |  |  |         a.card_cash, | 
 |  |  |         a.consume, | 
 |  |  |         a.his_consume, | 
 |  |  |         a.free_consume, | 
 |  |  |         f.su_name meiliao, | 
 |  |  | 
 |  |  |         a.number_of_people, | 
 |  |  |         a.proj_num, | 
 |  |  |         a.proj_time, | 
 |  |  |         i.name as module_subName, | 
 |  |  |         h.SHOP_NAME shop_name, | 
 |  |  |         a.order_type | 
 |  |  |         i.name as cateName, | 
 |  |  |         h.shop_short_name shop_name, | 
 |  |  |         a.order_type, | 
 |  |  |         a.achieveType, | 
 |  |  |         j.pay_method | 
 |  |  |         from | 
 |  |  |         achieve_new a | 
 |  |  |         left join sys_order b on a.order_id=b.id | 
 |  |  | 
 |  |  |         LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID | 
 |  |  |         LEFT JOIN shopping_goods_category i ON e.cate_id = i.id | 
 |  |  |         left join sys_proj_services l on a.service_order_id=l.id | 
 |  |  |         left join sys_order_item j on a.order_item_id=j.ID | 
 |  |  |         <where> | 
 |  |  |             <if test="record!=null"> | 
 |  |  |                 <if | 
 |  |  | 
 |  |  |         YEAR (a.datatime) year, | 
 |  |  |         MONTH (a.datatime) month, | 
 |  |  |         DAY(a.datatime) day, | 
 |  |  |         SUM(a.card_cash) as card_cash , | 
 |  |  |         SUM((IFNULL(a.card_cash,0) +IFNULL(a.proj_cash,0) + IFNULL(a.goods_cash,0) ) )as zk_total, | 
 |  |  |         SUM(a.proj_cash) as proj_cash, | 
 |  |  |         SUM( IFNULL(a.goods_cash,0)  )as zk_total, | 
 |  |  |         SUM(a.goods_cash) as goods_cash, | 
 |  |  |         SUM(a.card_cash) as card_cash, | 
 |  |  |         SUM(a.consume) as consume, | 
 |  |  |         SUM(a.his_consume) as his_consume, | 
 |  |  |         SUM(a.free_consume) as free_consume, | 
 |  |  |         SUM(a.proj_percentage) as proj_percentage, | 
 |  |  | 
 |  |  |         <result property="vipId" column="vip_id" /> | 
 |  |  |         <result property="freeConsume" column="free_consume" /> | 
 |  |  |         <result property="hisConsume" column="his_consume" /> | 
 |  |  |         <result property="consume" column="consume" /> | 
 |  |  |         <result property="cardCash" column="card_cash" /> | 
 |  |  |         <result property="projCash" column="proj_cash" /> | 
 |  |  |         <result property="goodsCash" column="goods_cash" /> | 
 |  |  |         <result property="projNum" column="proj_num" /> | 
 |  |  |         <result property="numberOfPeople" column="number_of_people" /> | 
 |  |  | 
 |  |  |         <result property="remark" column="remark" /> | 
 |  |  |         <result property="orderType" column="order_type" /> | 
 |  |  |         <result property="projPercentage" column="proj_percentage" /> | 
 |  |  |  | 
 |  |  |         <result property="t1" column="t1" /> | 
 |  |  |         <result property="t2" column="t2" /> | 
 |  |  |         <result property="t3" column="t3" /> | 
 |  |  |         <result property="achieveType" column="achieveType" /> | 
 |  |  |         <result property="t4" column="t4" /> | 
 |  |  |         <result property="t5" column="t5" /> | 
 |  |  |         <result property="t6" column="t6" /> | 
 |  |  | 
 |  |  |         vip_id, | 
 |  |  |         free_consume, | 
 |  |  |         his_consume, | 
 |  |  |         consume, | 
 |  |  |         card_cash, | 
 |  |  |         proj_cash, | 
 |  |  |         goods_cash, | 
 |  |  |         proj_num, | 
 |  |  |         number_of_people, | 
 |  |  | 
 |  |  |         remark, | 
 |  |  |         order_type, | 
 |  |  |         proj_percentage, | 
 |  |  |  | 
 |  |  |         t1, | 
 |  |  |         t2, | 
 |  |  |         t3, | 
 |  |  |         achieveType, | 
 |  |  |         t4, | 
 |  |  |         t5, | 
 |  |  |         t6, | 
 |  |  | 
 |  |  |         #{item.vipId}, | 
 |  |  |         #{item.freeConsume}, | 
 |  |  |         #{item.hisConsume}, | 
 |  |  |         #{item.consume}, | 
 |  |  |         #{item.cardCash}, | 
 |  |  |         #{item.projCash}, | 
 |  |  |         #{item.goodsCash}, | 
 |  |  |         #{item.projNum}, | 
 |  |  |         #{item.numberOfPeople}, | 
 |  |  | 
 |  |  |         #{item.remark}, | 
 |  |  |         #{item.orderType}, | 
 |  |  |         #{item.projPercentage}, | 
 |  |  |  | 
 |  |  |         #{item.t1}, | 
 |  |  |         #{item.t2}, | 
 |  |  |         #{item.t3}, | 
 |  |  |         #{item.achieveType}, | 
 |  |  |         #{item.t4}, | 
 |  |  |         #{item.t5}, | 
 |  |  |         #{item.t6}, | 
 |  |  | 
 |  |  |                 test="(record.hisConsume!=null and record.hisConsume!='') or  (record.hisConsume!='' and record.hisConsume==0)  "> | 
 |  |  |                 and his_consume = #{record.hisConsume} | 
 |  |  |             </if> | 
 |  |  |             <if | 
 |  |  |                 test="(record.consume!=null and record.consume!='') or  (record.consume!='' and record.consume==0)  "> | 
 |  |  |                 and consume = #{record.consume} | 
 |  |  |             </if> | 
 |  |  |             <if | 
 |  |  |                 test="(record.cardCash!=null and record.cardCash!='') or  (record.cardCash!='' and record.cardCash==0)  "> | 
 |  |  |                 and card_cash = #{record.cardCash} | 
 |  |  |             </if> | 
 |  |  |             <if | 
 |  |  |                 test="(record.projCash!=null and record.projCash!='') or  (record.projCash!='' and record.projCash==0)  "> | 
 |  |  |                 and proj_cash = #{record.projCash} | 
 |  |  |             </if> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             <if | 
 |  |  |                 test="(record.goodsCash!=null and record.goodsCash!='') or  (record.goodsCash!='' and record.goodsCash==0)  "> | 
 |  |  |                 and goods_cash = #{record.goodsCash} | 
 |  |  | 
 |  |  |                 and t2 = #{record.t2} | 
 |  |  |             </if> | 
 |  |  |             <if | 
 |  |  |                 test="(record.t3!=null and record.t3!='') or  (record.t3!='' and record.t3==0)  "> | 
 |  |  |                 and t3 = #{record.t3} | 
 |  |  |                 test="(record.achieveType!=null and record.achieveType!='') or  (record.achieveType!='' and record.achieveType==0)  "> | 
 |  |  |                 and achieveType = #{record.achieveType} | 
 |  |  |             </if> | 
 |  |  |             <if | 
 |  |  |                 test="(record.t4!=null and record.t4!='') or  (record.t4!='' and record.t4==0)  "> | 
 |  |  | 
 |  |  |             <if test="_parameter.containsKey('hisConsume')"> | 
 |  |  |                 his_consume = #{hisConsume}, | 
 |  |  |             </if> | 
 |  |  |             <if test="_parameter.containsKey('consume')"> | 
 |  |  |                 consume = #{consume}, | 
 |  |  |             </if> | 
 |  |  |             <if test="_parameter.containsKey('cardCash')"> | 
 |  |  |                 card_cash = #{cardCash}, | 
 |  |  |             </if> | 
 |  |  |             <if test="_parameter.containsKey('projCash')"> | 
 |  |  |                 proj_cash = #{projCash}, | 
 |  |  |             </if> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             <if test="_parameter.containsKey('goodsCash')"> | 
 |  |  |                 goods_cash = #{goodsCash}, | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |             <if test="_parameter.containsKey('projPercentage')"> | 
 |  |  |                 proj_percentage = #{projPercentage}, | 
 |  |  |             </if> | 
 |  |  |  | 
 |  |  |             <if test="_parameter.containsKey('t1')"> | 
 |  |  |                 t1 = #{t1}, | 
 |  |  |             </if> | 
 |  |  |             <if test="_parameter.containsKey('t2')"> | 
 |  |  |                 t2 = #{t2}, | 
 |  |  |             </if> | 
 |  |  |             <if test="_parameter.containsKey('t3')"> | 
 |  |  |                 t3 = #{t3}, | 
 |  |  |             <if test="_parameter.containsKey('achieveType')"> | 
 |  |  |                 achieveType = #{achieveType}, | 
 |  |  |             </if> | 
 |  |  |             <if test="_parameter.containsKey('t4')"> | 
 |  |  |                 t4 = #{t4}, | 
 |  |  | 
 |  |  |             <if test="record.hisConsume != null "> | 
 |  |  |                 his_consume = #{record.hisConsume}, | 
 |  |  |             </if> | 
 |  |  |             <if test="record.consume != null "> | 
 |  |  |                 consume = #{record.consume}, | 
 |  |  |             </if> | 
 |  |  |             <if test="record.cardCash != null "> | 
 |  |  |                 card_cash = #{record.cardCash}, | 
 |  |  |             </if> | 
 |  |  |             <if test="record.projCash != null "> | 
 |  |  |                 proj_cash = #{record.projCash}, | 
 |  |  |             </if> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             <if test="record.goodsCash != null "> | 
 |  |  |                 goods_cash = #{record.goodsCash}, | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |             <if test="record.projPercentage != null "> | 
 |  |  |                 proj_percentage = #{record.projPercentage}, | 
 |  |  |             </if> | 
 |  |  |  | 
 |  |  |             <if test="record.t1 != null and record.t1 != '' "> | 
 |  |  |                 t1 = #{record.t1}, | 
 |  |  |             </if> | 
 |  |  |             <if test="record.t2 != null and record.t2 != '' "> | 
 |  |  |                 t2 = #{record.t2}, | 
 |  |  |             </if> | 
 |  |  |             <if test="record.t3 != null and record.t3 != '' "> | 
 |  |  |                 t3 = #{record.t3}, | 
 |  |  |             <if test="record.achieveType != null and record.achieveType != '' "> | 
 |  |  |                 achieveType = #{record.achieveType}, | 
 |  |  |             </if> | 
 |  |  |             <if test="record.t4 != null and record.t4 != '' "> | 
 |  |  |                 t4 = #{record.t4}, | 
 |  |  | 
 |  |  |         DELETE FROM achieve_new | 
 |  |  |         where 1=1 | 
 |  |  |         <include refid="where_sql"></include> | 
 |  |  |     </delete> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <delete id="deleteByOrderId"> | 
 |  |  |         DELETE FROM achieve_new where order_id=#{orderId} | 
 |  |  |     </delete> | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |             sum(b.hisConsume) his_consume | 
 |  |  |         from sys_vip_info a | 
 |  |  |         inner join ( | 
 |  |  |             select vip_id,datatime, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) + IFNULL(card_cash, 0)) buyConsume from achieve_new a group by vip_id | 
 |  |  |             select vip_id,datatime, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) )) buyConsume from achieve_new a group by vip_id | 
 |  |  |         ) b on a.ID = b.vip_id | 
 |  |  |         inner join ( | 
 |  |  |             select vip_id, count(1) cnt from ( | 
 |  |  | 
 |  |  |         select count(1) | 
 |  |  |         from sys_vip_info a | 
 |  |  |         inner join ( | 
 |  |  |         select vip_id,datatime, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) + IFNULL(card_cash, 0)) buyConsume from achieve_new a group by vip_id | 
 |  |  |         select vip_id,datatime, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0)  ) buyConsume from achieve_new a group by vip_id | 
 |  |  |         ) b on a.ID = b.vip_id | 
 |  |  |         inner join ( | 
 |  |  |         select vip_id, count(1) cnt from ( | 
 |  |  | 
 |  |  |     <select id="selectUserAchieveByTime" resultType="com.matrix.system.app.vo.UserAchieveVo"> | 
 |  |  |         select | 
 |  |  |             sale_id id, | 
 |  |  |             sum(case t3 when '现金业绩' then card_cash else 0 end) orderCash, | 
 |  |  |             sum(case t3 when '划扣业绩' then consume else 0 end) cash, | 
 |  |  |             (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0) | 
 |  |  |                 from achieve_new a | 
 |  |  |                 inner join sys_order_item b on a.order_item_id=b.ID | 
 |  |  |             where a.beault_id=#{userId} | 
 |  |  |             and (date_format(datatime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d') >= date_format(datatime, '%Y-%m-%d')) | 
 |  |  |             ) orderCash, | 
 |  |  |             (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0) | 
 |  |  |                 from achieve_new a | 
 |  |  |                 inner join sys_order_item b on a.order_item_id=b.ID | 
 |  |  |             where  a.beault_id=#{userId} | 
 |  |  |             and (date_format(datatime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d') >= date_format(datatime, '%Y-%m-%d')) | 
 |  |  |             ) cash, | 
 |  |  |             sum(case order_type when '订单' then proj_percentage else 0 end) cardUse, | 
 |  |  |             sum(IFNULL(his_consume, 0)) hisConsume, | 
 |  |  |             sum(IFNULL(free_consume, 0)) freeConsume, | 
 |  |  | 
 |  |  |     <select id="selectApiOrderItemAchieve" resultType="com.matrix.system.app.vo.OrderDetailAchieveItemVo"> | 
 |  |  |         select | 
 |  |  |             b.su_name name, | 
 |  |  |             IFNULL(a.card_cash, 0) + IFNULL(a.proj_cash, 0) + IFNULL(a.goods_cash, 0) achieve | 
 |  |  |             IFNULL(a.goods_cash, 0) achieve | 
 |  |  |         from achieve_new a | 
 |  |  |         inner join sys_users b on (a.beault_id=b.su_id or a.sale_id = b.su_id) | 
 |  |  |         where a.order_item_id=#{itemId} and order_type = '订单' | 
 |  |  | 
 |  |  |         select | 
 |  |  |             b.su_name name, | 
 |  |  |             b.su_id id, | 
 |  |  |             sum(IFNULL(a.free_consume,0) + IFNULL(a.his_consume, 0) + IFNULL(a.consume, 0)) amount, | 
 |  |  |             sum(IFNULL(a.free_consume,0) + IFNULL(a.his_consume, 0) ) amount, | 
 |  |  |             c.shop_short_name shopName | 
 |  |  |         from achieve_new a | 
 |  |  |         inner join sys_users b on a.beault_id=b.su_id | 
 |  |  | 
 |  |  |             b.code goodsNo, | 
 |  |  |             b.name goodsName, | 
 |  |  |             c.su_name meiliao, | 
 |  |  |             d.count*d.zk_price zk_total | 
 |  |  |             d.count*d.zk_price zk_total, | 
 |  |  |             d.pay_method | 
 |  |  |         from achieve_new a | 
 |  |  |         left join shopping_goods b on a.shopping_goods_id=b.id | 
 |  |  |         left join sys_users c on a.beault_id=c.su_id | 
 |  |  | 
 |  |  |         b.su_name name, | 
 |  |  |         b.su_id id, | 
 |  |  |         b.su_photo photo, | 
 |  |  |         sum(ifnull(card_cash,0)) amount, | 
 |  |  |         sum(ifnull(goods_cash,0)) amount, | 
 |  |  |         c.shop_short_name shopName | 
 |  |  |         from achieve_new a | 
 |  |  |         inner join sys_users b on a.beault_id=b.su_id | 
 |  |  | 
 |  |  |         select | 
 |  |  |             b.shop_short_name name, | 
 |  |  |             b.SHOP_IMAG photo, | 
 |  |  |             sum(IFNULL(a.consume,0) + IFNULL(a.card_cash,0)) amount | 
 |  |  |             sum(IFNULL(a.goods_cash,0)) amount | 
 |  |  |         from achieve_new a | 
 |  |  |         left join sys_shop_info b on a.shop_id=b.ID and shop_type!=1 | 
 |  |  |         <where> | 
 
 |  |  | 
 |  |  |             d.id as pu_id, | 
 |  |  |             d.SURPLUS_COUNT as pu_SURPLUS_COUNT, | 
 |  |  |             d.ASSEMBLE_ID as pu_ASSEMBLE_ID, | 
 |  |  |             d.price as pu_price | 
 |  |  |             d.price as pu_price, | 
 |  |  |             d.taocan_id as pu_taocan_id | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         from sys_beautician_state a | 
 
 |  |  | 
 |  |  |                     </if> | 
 |  |  |                 ) refund, | 
 |  |  |                 (select IFNULL(count(1),0) from sys_order | 
 |  |  |                     where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  | 
 |  |  |                     </if> | 
 |  |  |                     ) perCustomCnt, | 
 |  |  |                 (select IFNULL(sum(b.COUNT),0) from sys_order a inner join sys_order_item b on a.ID=b.ORDER_ID | 
 |  |  |                     where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  | 
 |  |  |                     inner join sys_store_info d on c.store_id = d.ID | 
 |  |  |                     inner join sys_order_item e on a.ID=e.ORDER_ID | 
 |  |  |                     inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品' | 
 |  |  |                     where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and a.shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  | 
 |  |  |                 (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a | 
 |  |  |                     inner join sys_order_item b on a.ID=b.ORDER_ID | 
 |  |  |                     inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id | 
 |  |  |                     where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and a.shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  | 
 |  |  |             #{item.beginTime} dataTime, | 
 |  |  |             (select shop_short_name from sys_shop_info where id=#{shopId}) shopName, | 
 |  |  |             (select sum(total) shouldPay from sys_order | 
 |  |  |                 where STATU in ('已付款', '欠款') and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]> | 
 |  |  |                 where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]> | 
 |  |  |                 <if test="shopId != null"> | 
 |  |  |                     and shop_id=#{shopId} | 
 |  |  |                 </if> | 
 |  |  | 
 |  |  |             </if> | 
 |  |  |             ) refund, | 
 |  |  |             (select IFNULL(count(1),0) from sys_order | 
 |  |  |             where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             <if test="shopId != null"> | 
 |  |  |                 and shop_id=#{shopId} | 
 |  |  |             </if> | 
 |  |  |             ) perCustomCnt, | 
 |  |  |             (select IFNULL(sum(b.COUNT),0) from sys_order a inner join sys_order_item b on a.ID=b.ORDER_ID | 
 |  |  |             where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             <if test="shopId != null"> | 
 |  |  |                 and shop_id=#{shopId} | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |             inner join sys_store_info d on c.store_id = d.ID | 
 |  |  |             inner join sys_order_item e on a.ID=e.ORDER_ID | 
 |  |  |             inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品' | 
 |  |  |             where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             <if test="shopId != null"> | 
 |  |  |                 and a.shop_id=#{shopId} | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |             (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a | 
 |  |  |             inner join sys_order_item b on a.ID=b.ORDER_ID | 
 |  |  |             inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id | 
 |  |  |             where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             <if test="shopId != null"> | 
 |  |  |                 and a.shop_id=#{shopId} | 
 |  |  |             </if> | 
 
 |  |  | 
 |  |  |         <result property="vipNo" column="VIP_NO"/> | 
 |  |  |         <result property="staffName" column="STAFF_NAME"/> | 
 |  |  |         <result property="changeId" column="CHANGE_ID"/> | 
 |  |  |         <result property="orderType" column="orderType"/> | 
 |  |  |  | 
 |  |  |         <result property="cashPay" column="cash_Pay"/> | 
 |  |  |         <result property="cardPay" column="card_Pay"/> | 
 |  |  | 
 |  |  |         beatuyId, | 
 |  |  |         beatuyName, | 
 |  |  |         pay_time, | 
 |  |  |         company_id | 
 |  |  |         company_id, | 
 |  |  |         orderType, | 
 |  |  |         is_has_refund | 
 |  |  |         ) | 
 |  |  |         VALUES ( | 
 |  |  |         #{id}, | 
 |  |  | 
 |  |  |         #{beatuyId}, | 
 |  |  |         #{beatuyName}, | 
 |  |  |         #{payTime}, | 
 |  |  |         #{companyId} | 
 |  |  |         #{companyId}, | 
 |  |  |         #{orderType}, | 
 |  |  |         #{isHasRefund} | 
 |  |  |         ) | 
 |  |  |     </insert> | 
 |  |  |  | 
 |  |  | 
 |  |  |             <if test="cashPay != null and cashPay  !='' "> | 
 |  |  |                 cash_Pay = #{cashPay}, | 
 |  |  |             </if> | 
 |  |  |  | 
 |  |  |             <if test="payTime != null  "> | 
 |  |  |                 pay_time = #{payTime}, | 
 |  |  |             </if> | 
 |  |  |             <if test="isHasRefund != null  "> | 
 |  |  |                 is_has_refund = #{isHasRefund}, | 
 |  |  |             </if> | 
 |  |  |  | 
 |  |  |         </set> | 
 |  |  | 
 |  |  |             <if test="(record.companyId!=null and record.companyId!='') "> | 
 |  |  |                 and a.company_id = #{record.companyId} | 
 |  |  |             </if> | 
 |  |  |             <if test="(record.orderType!=null and record.orderType!='') "> | 
 |  |  |                 and a.orderType = #{record.orderType} | 
 |  |  |             </if> | 
 |  |  |             <if test="record.beginTimeVo != null  "> | 
 |  |  |                 and a.ORDER_TIME >= #{record.beginTimeVo} | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |             </if> | 
 |  |  |             <if test="(record.companyId!=null and record.companyId!='') "> | 
 |  |  |                 and a.company_id = #{record.companyId} | 
 |  |  |             </if> | 
 |  |  |             <if test="(record.orderType!=null and record.orderType!='') "> | 
 |  |  |                 and a.orderType = #{record.orderType} | 
 |  |  |             </if> | 
 |  |  |             <if test="record.isCross != null and record.isCross !='' "> | 
 |  |  |                 and a.IS_CROSS = #{record.isCross} | 
 |  |  | 
 |  |  |             <if test="(record.companyId!=null and record.companyId!='') "> | 
 |  |  |                 and a.company_id = #{record.companyId} | 
 |  |  |             </if> | 
 |  |  |             <if test="(record.orderType!=null and record.orderType!='') "> | 
 |  |  |                 and a.orderType = #{record.orderType} | 
 |  |  |             </if> | 
 |  |  |  | 
 |  |  |         </if> | 
 |  |  |     </sql> | 
 |  |  | 
 |  |  |             <if test="(record.companyId!=null and record.companyId!='') "> | 
 |  |  |                 and a.company_id = #{record.companyId} | 
 |  |  |             </if> | 
 |  |  |             <if test="(record.orderType!=null and record.orderType!='') "> | 
 |  |  |                 and a.orderType = #{record.orderType} | 
 |  |  |             </if> | 
 |  |  |             <if test="record.activity != null and record.activity !='' "> | 
 |  |  |                 and a.ACTIVITY = #{record.activity} | 
 |  |  |             </if> | 
 
 |  |  | 
 |  |  |         <!-- <result property="projId" column="PROJ_ID" /> | 
 |  |  |         <result property="skuId" column="SKU_ID" /> --> | 
 |  |  |         <result property="count" column="COUNT"/> | 
 |  |  |         <result property="refundCount" column="refundCount"/> | 
 |  |  |         <!-- <result property="taocanId" column="TAOCAN_ID" /> --> | 
 |  |  |         <result property="isFree" column="IS_FREE"/> | 
 |  |  |         <result property="type" column="TYPE"/> | 
 |  |  | 
 |  |  |         a.TOTAL, | 
 |  |  |         a.SKU_ID, | 
 |  |  |         b.COUNT, | 
 |  |  |         b.refundCount, | 
 |  |  |         b.ID, | 
 |  |  |         b.IS_FREE, | 
 |  |  |         b.ORDER_ID, | 
 |  |  | 
 |  |  |         ID, | 
 |  |  |         ORDER_ID, | 
 |  |  |         COUNT, | 
 |  |  |         refundCount, | 
 |  |  |         TYPE, | 
 |  |  |         IS_FREE, | 
 |  |  |         PRICE, | 
 |  |  | 
 |  |  |         #{id}, | 
 |  |  |         #{orderId}, | 
 |  |  |         #{count}, | 
 |  |  |         #{refundCount}, | 
 |  |  |         #{type}, | 
 |  |  |         #{isFree}, | 
 |  |  |         #{price}, | 
 |  |  | 
 |  |  |             </if> | 
 |  |  |             <if test="count != null and count !='' or count == 0 "> | 
 |  |  |                 COUNT = #{count}, | 
 |  |  |             </if> | 
 |  |  |             <if test="refundCount != null and refundCount !='' or refundCount == 0 "> | 
 |  |  |                 refundCount = #{refundCount}, | 
 |  |  |             </if> | 
 |  |  |             <if test="isFree != null and isFree !='' "> | 
 |  |  |                 IS_FREE = #{isFree}, | 
 |  |  | 
 |  |  |         i.ID, | 
 |  |  |         i.ORDER_ID, | 
 |  |  |         i.COUNT, | 
 |  |  |         i.refundCount, | 
 |  |  |         i.TYPE, | 
 |  |  |         i.IS_FREE, | 
 |  |  |         i.PRICE, | 
 |  |  | 
 |  |  |         ID, | 
 |  |  |         ORDER_ID, | 
 |  |  |         COUNT, | 
 |  |  |         refundCount, | 
 |  |  |         TYPE, | 
 |  |  |         IS_FREE, | 
 |  |  |         PRICE, | 
 |  |  | 
 |  |  |         c.name as goodsName, | 
 |  |  |         g.name as cateName, | 
 |  |  |         a.COUNT, | 
 |  |  |         a.refundCount, | 
 |  |  |         a.ZK_PRICE, | 
 |  |  |         a.IS_FREE, | 
 |  |  |         a.pay_method, | 
 
 |  |  | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <select id="selectProjServicesByOrderItemId" resultMap="SysProjServicesMap"> | 
 |  |  |         select a.* from sys_proj_services a | 
 |  |  |           inner join sys_beautician_state b on a.id=b.SERVICES_ID | 
 |  |  |           inner join sys_proj_use c on c.id=b.puse_id | 
 |  |  |         where ORDER_ITEM_ID=#{itemId} and a.STATE!='预约取消' | 
 |  |  |     </select> | 
 |  |  | </mapper> | 
 
 |  |  | 
 |  |  |         <foreach collection="list" index="index" item="item"   separator=","  > | 
 |  |  |             ( | 
 |  |  |             select IFNULL(count(1),0) from sys_order | 
 |  |  |             where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             <if test="shopId != null"> | 
 |  |  |                 and shop_id=#{shopId} | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |             select case a.perCustomCnt when 0 then 0 else a.totalSaleCnt/a.perCustomCnt end from ( | 
 |  |  |                 select | 
 |  |  |                 (select IFNULL(count(1),0) from sys_order | 
 |  |  |                     where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  | 
 |  |  |                     </if> | 
 |  |  |                 ) perCustomCnt, | 
 |  |  |                 (select IFNULL(sum(b.COUNT),0) from sys_order a inner join sys_order_item b on a.ID=b.ORDER_ID | 
 |  |  |                     where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  | 
 |  |  |             select case a.perCustomCnt when 0 then 0 else a.totalPay/a.perCustomCnt end from ( | 
 |  |  |             select | 
 |  |  |             (select IFNULL(count(1),0) from sys_order | 
 |  |  |             where STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |             <if test="shopId != null"> | 
 |  |  |                 and shop_id=#{shopId} | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |                         inner join sys_store_info d on c.store_id = d.ID | 
 |  |  |                         inner join sys_order_item e on a.ID=e.ORDER_ID | 
 |  |  |                         inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品' | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         <if test="shopId != null"> | 
 |  |  |                             and a.shop_id=#{shopId} | 
 |  |  |                         </if> | 
 |  |  | 
 |  |  |                     (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a | 
 |  |  |                         inner join sys_order_item b on a.ID=b.ORDER_ID | 
 |  |  |                         inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         <if test="shopId != null"> | 
 |  |  |                             and a.shop_id=#{shopId} | 
 |  |  |                         </if> | 
 |  |  | 
 |  |  |                         inner join sys_store_info d on c.store_id = d.ID | 
 |  |  |                         inner join sys_order_item e on a.ID=e.ORDER_ID | 
 |  |  |                         inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品' | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         <if test="shopId != null"> | 
 |  |  |                             and a.shop_id=#{shopId} | 
 |  |  |                         </if> | 
 |  |  | 
 |  |  |                     (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a | 
 |  |  |                         inner join sys_order_item b on a.ID=b.ORDER_ID | 
 |  |  |                         inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         <if test="shopId != null"> | 
 |  |  |                             and a.shop_id=#{shopId} | 
 |  |  |                         </if> | 
 |  |  | 
 |  |  |                         inner join sys_store_info d on c.store_id = d.ID | 
 |  |  |                         inner join sys_order_item e on a.ID=e.ORDER_ID | 
 |  |  |                         inner join shopping_goods f on e.goods_id=f.id and f.good_type='家居产品' | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         <if test="shopId != null"> | 
 |  |  |                             and a.shop_id=#{shopId} | 
 |  |  |                         </if> | 
 |  |  | 
 |  |  |                     (select IFNULL(sum(b.COUNT * IFNULL(c.price, 0)),0) from sys_order a | 
 |  |  |                         inner join sys_order_item b on a.ID=b.ORDER_ID | 
 |  |  |                         inner join shopping_goods c on c.good_type != '家居产品' and b.goods_id=c.id | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         where a.STATU in ('已付款', '欠款') and a.orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                         <if test="shopId != null"> | 
 |  |  |                             and a.shop_id=#{shopId} | 
 |  |  |                         </if> | 
 |  |  | 
 |  |  |             select | 
 |  |  |                 #{item.beginTime} time, | 
 |  |  |                 (select ifnull(sum(ifnull(card_cash,0) + ifnull(consume,0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) orderAmount, | 
 |  |  |                 (select ifnull(sum(case t3 when '现金业绩' then card_cash else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cashAmount, | 
 |  |  |                 (select ifnull(sum(case t3 when '划扣业绩' then consume else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardAmount, | 
 |  |  |                 (select ifnull(sum(case t3 when '划扣业绩' then consume else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardUseAmount, | 
 |  |  |                 (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0) | 
 |  |  |                     from achieve_new a | 
 |  |  |                     inner join sys_order_item b on a.order_item_id=b.ID | 
 |  |  |                 where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cashAmount, | 
 |  |  |                 (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0) | 
 |  |  |                     from achieve_new a | 
 |  |  |                     inner join sys_order_item b on a.order_item_id=b.ID | 
 |  |  |                 where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardAmount, | 
 |  |  |                 (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0) | 
 |  |  |                     from achieve_new a | 
 |  |  |                     inner join sys_order_item b on a.order_item_id=b.ID | 
 |  |  |                 where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardUseAmount, | 
 |  |  |                 (select ifnull(sum(ifnull(proj_percentage, 0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]> and order_type='订单') goodsAmount, | 
 |  |  |                 (select ifnull(sum(ifnull(his_consume, 0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) hisConsume, | 
 |  |  |                 (select ifnull(sum(ifnull(free_consume, 0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) freeConsume, | 
 |  |  | 
 |  |  |     <select id="selectStaffCashAchieve" resultType="java.util.TreeMap"> | 
 |  |  |         select | 
 |  |  |         <foreach collection="list" index="index" item="item"   separator=","  > | 
 |  |  |             (select ifnull(sum(case t3 when '现金业绩' then card_cash else 0 end),0) | 
 |  |  |             (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0) | 
 |  |  |                 from achieve_new a | 
 |  |  |                 inner join sys_order_item b on a.order_item_id=b.ID | 
 |  |  |                 where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]> | 
 |  |  |                 <if test="staffId != null and staffId != 0"> | 
 |  |  |                     and a.beault_id=#{staffId} | 
 |  |  |                 </if> | 
 |  |  |             ) as t${index} | 
 |  |  |  | 
 |  |  |         </foreach> | 
 |  |  |         from area where id=1 | 
 |  |  |     </select> | 
 |  |  | 
 |  |  |     <select id="selectStaffCardAchieve" resultType="java.util.TreeMap"> | 
 |  |  |         select | 
 |  |  |         <foreach collection="list" index="index" item="item"   separator=","  > | 
 |  |  |             (select ifnull(sum(case t3 when '划扣业绩' then consume else 0 end),0) | 
 |  |  |             (select ifnull(sum(case b.pay_method when '划扣' then goods_cash else 0 end),0) | 
 |  |  |             from achieve_new a | 
 |  |  |                 inner join sys_order_item b on a.order_item_id=b.ID | 
 |  |  |             where <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]> | 
 |  |  |             <if test="staffId != null and staffId != 0"> | 
 |  |  |                 and a.beault_id=#{staffId} | 
 
| New file | 
 |  |  | 
 |  |  | 删除 | 
 |  |  | cardCash | 
 |  |  | projCash | 
 |  |  | 只留下 | 
 |  |  | goodsCash | 
 |  |  | 产品现金业绩和划扣业绩consume | 
 |  |  |  | 
 |  |  | 重构订单,收款,退款等方法不要共用逻辑 | 
 |  |  |  | 
 |  |  | 把所有历史订单的订单类型区分销售订单和退款订单 | 
 |  |  |  | 
 
 |  |  | 
 |  |  |                 </el-col> | 
 |  |  |             </el-row> | 
 |  |  |             <el-row type="flex" justify="center" style="margin: 20px;"> | 
 |  |  |                 <el-button size="medium" type="primary">打印</el-button> | 
 |  |  |                 <el-button size="medium" type="primary" @click="printf">打印</el-button> | 
 |  |  |             </el-row> | 
 |  |  |         </el-aside> | 
 |  |  |         <el-main style="background-color: white; margin-right: 15px; margin-left: 15px; padding: 20px 30px;"> | 
 |  |  |             <el-tabs v-model="activeName" @tab-click="handleClick"> | 
 |  |  |                 <el-tab-pane label="订单明细" name="first"> | 
 |  |  |                     <el-row> | 
 |  |  |                         <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款</el-button> | 
 |  |  |                         <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款<span v-if="totalRefund"> ¥ {{totalRefund}}</span></el-button> | 
 |  |  |                         <el-button size="mini" type="danger" @click="isRefund = false" v-if="isRefund">取消</el-button> | 
 |  |  |                         <el-button size="mini" type="primary" @click="isRefund = true" v-if="order.statu == '已付款' && !isRefund">退款</el-button> | 
 |  |  |                     </el-row> | 
 |  |  | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column  label="小计" :formatter="calOrderTotalFormatter"> | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column  label="支付方式"  prop="payMethod"> | 
 |  |  |                             </el-table-column> | 
 |  |  |                         </el-table> | 
 |  |  |                     </el-row> | 
 |  |  |                     <el-row v-show="isRefund"> | 
 |  |  | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column label="退款单价"> | 
 |  |  |                                 <template slot-scope="scope"> | 
 |  |  |                                     <el-input v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input> | 
 |  |  |                                     <el-input @change="calRefund" v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input> | 
 |  |  |                                 </template> | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column label="退款数量"> | 
 |  |  |                                 <template slot-scope="scope"> | 
 |  |  |                                     <el-input v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input> | 
 |  |  |                                     <el-input @change="calRefund" v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input> | 
 |  |  |                                 </template> | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column label="是否退库存" align="center"> | 
 |  |  | 
 |  |  |                                 label="收款"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="payMethod" | 
 |  |  |                                 label="支付方式"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="t3" | 
 |  |  |                                 label="业绩类型"> | 
 |  |  |                             <template slot-scope="scope"> | 
 |  |  |                                 <el-select v-model="scope.row.t3" placeholder="请选择业绩类型"> | 
 |  |  |                                 <el-select v-model="scope.row.achieveType" placeholder="请选择业绩类型"> | 
 |  |  |                                     <el-option | 
 |  |  |                                             v-for="item in achieveTypeList" | 
 |  |  |                                             :key="item.key" | 
 |  |  |                                             :key="item.value" | 
 |  |  |                                             :label="item.value" | 
 |  |  |                                             :value="item.key"> | 
 |  |  |                                             :value="item.value"> | 
 |  |  |                                     </el-option> | 
 |  |  |                                 </el-select> | 
 |  |  |                             </template> | 
 |  |  | 
 |  |  |                                 prop="achieve" | 
 |  |  |                                 label="业绩"> | 
 |  |  |                             <template slot-scope="scope"> | 
 |  |  |                                 <el-input v-model="scope.row.t1"></el-input> | 
 |  |  |                                 <el-input  @input="checkAchieveMoney" v-model="scope.row.goodsCash"></el-input> | 
 |  |  |                             </template> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  | 
 |  |  |                                            size="mini" | 
 |  |  |                                            @click="delAchieve(scope.$index, scope.row)">删除 | 
 |  |  |                                 </el-button> | 
 |  |  |                                 <el-tooltip content="分享业绩" placement="top"> | 
 |  |  |                                 <el-tooltip content="分享业绩" placement="top" v-if="!scope.row.isShare"> | 
 |  |  |                                     <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share" | 
 |  |  |                                                size="mini" type="primary"></el-button> | 
 |  |  |                                 </el-tooltip> | 
 |  |  | 
 |  |  |                                 prop="flowContent" | 
 |  |  |                                 label="交易内容" | 
 |  |  |                                 width="300"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="createTime" | 
 |  |  |                                 label="交易时间"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="flowType" | 
 |  |  | 
 |  |  |             activeName : "first", | 
 |  |  |             circleUrl : "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png", | 
 |  |  |             userList : [], | 
 |  |  |             achieveTypeList : [ | 
 |  |  |                 { | 
 |  |  |                     "key" : "现金业绩", | 
 |  |  |                     "value" : "现金业绩" | 
 |  |  |                 },{ | 
 |  |  |                     "key" : "划扣业绩", | 
 |  |  |                     "value" : "划扣业绩" | 
 |  |  |                 }, | 
 |  |  |             ], | 
 |  |  |             achieveTypeList : [], | 
 |  |  |             orderItems : [], | 
 |  |  |             achieveItems : [], | 
 |  |  |             flowItems : [], | 
 |  |  |             payMethodItems : [], | 
 |  |  |             isRefund : false, | 
 |  |  |             isReturnAchieve : false, | 
 |  |  |             totalRefund : "", | 
 |  |  |             payMethods: [{ | 
 |  |  |                 value: '现金支付', | 
 |  |  |                 img: '/images/pay/cash.png', | 
 |  |  | 
 |  |  |             let _this = this; | 
 |  |  |             this.orderParam = /*[[${orderParam}]]*/ | 
 |  |  |             this.queryOrderDetailData(this.orderParam); | 
 |  |  |  | 
 |  |  |             // 业绩类型 | 
 |  |  |             AjaxProxy.requst({ | 
 |  |  |                 app: _this, | 
 |  |  |                 url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX', | 
 |  |  |                 callback: function (data) { | 
 |  |  |                     _this.achieveTypeList = data.rows; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         }, | 
 |  |  |         methods : { | 
 |  |  |             calRefund() { | 
 |  |  |                 let _this = this; | 
 |  |  |                 var total = 0; | 
 |  |  |                 _this.orderItems.forEach(item => { | 
 |  |  |                     if (item.refundPrice && item.refundCount) { | 
 |  |  |                         total += parseFloat(item.refundPrice * item.refundCount); | 
 |  |  |                     } | 
 |  |  |                 }) | 
 |  |  |  | 
 |  |  |                 _this.totalRefund = total; | 
 |  |  |             }, | 
 |  |  |             queryOrderDetailData(param) { | 
 |  |  |                 let _this = this; | 
 |  |  |                 AjaxProxy.requst({ | 
 |  |  | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     if(_this.order.zkTotal - _this.order.refund - _this.order.arrears < total) { | 
 |  |  |                         this.$message.warning("退款金额不能超过收取金额"); | 
 |  |  |                         this.$message.warning("退款金额不能超过收款金额"); | 
 |  |  |                         return false; | 
 |  |  |                     } | 
 |  |  |                     _this.data.flows = flows; | 
 |  |  | 
 |  |  |             }, | 
 |  |  |             saveAchieve() { | 
 |  |  |                 let _this = this; | 
 |  |  |                 if(_this.checkAchieveMoney()){ | 
 |  |  |                 AjaxProxy.requst({ | 
 |  |  |                     app: _this, | 
 |  |  |                     data: _this.achieveItems, | 
 |  |  | 
 |  |  |                         _this.$message.success(data.info); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             }, | 
 |  |  |  | 
 |  |  |             shareAchieve(index, row) { | 
 |  |  |                 var row2 = JSON.parse(JSON.stringify(row)); | 
 |  |  |                 row2.id = null; | 
 |  |  |                 row2.isShare = true; | 
 |  |  |                 this.achieveItems.push(row2); | 
 |  |  |                 this.achieveItems.splice(index+1,0,row2); | 
 |  |  |                 this.calculationAchieve(); | 
 |  |  |             }, | 
 |  |  |             delAchieve(index, row) { | 
 |  |  |                 let _this = this; | 
 |  |  |                 if (row.id) { | 
 |  |  |                     AjaxProxy.requst({ | 
 |  |  |                         app: _this, | 
 |  |  |                         url: basePath + '/admin/achieve/del?id=' + row.id, | 
 |  |  |                         callback: function (data) { | 
 |  |  |             //业绩均分订单金额 | 
 |  |  |             calculationAchieve(){ | 
 |  |  |                 console.log("计算业绩"); | 
 |  |  |                 let jsqMap={}; | 
 |  |  |                 this.achieveItems.forEach(achieve=>{ | 
 |  |  |                     key=achieve.achieveType+achieve.orderItemId; | 
 |  |  |                     if(!jsqMap[key]){ | 
 |  |  |                         jsqMap[key]=1; | 
 |  |  |                     }else{ | 
 |  |  |                         jsqMap[key]++; | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 this.achieveItems.forEach(achieve=>{ | 
 |  |  |                     key=achieve.achieveType+achieve.orderItemId; | 
 |  |  |                     achieve.goodsCash=(achieve.zkTotal/jsqMap[key]).toFixed(2); | 
 |  |  |                 }); | 
 |  |  |             }, | 
 |  |  |             //校验业绩是否大于订单收款金额 | 
 |  |  |             checkAchieveMoney(){ | 
 |  |  |                 console.log("校验业绩是否大于订单收款金额"); | 
 |  |  |                 let jsqMap={}; | 
 |  |  |                 let isOk=true; | 
 |  |  |                 for(let i=0 ; i< this.achieveItems.length; i++){ | 
 |  |  |                     let achieve=this.achieveItems[i]; | 
 |  |  |                     if(!isNaN(achieve.goodsCash)  ){ | 
 |  |  |                         key=achieve.achieveType+achieve.orderItemId; | 
 |  |  |                         if(!jsqMap[key]){ | 
 |  |  |                             jsqMap[key]=parseFloat(achieve.goodsCash); | 
 |  |  |                         }else{ | 
 |  |  |                             jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                         if(jsqMap[key]>achieve.zkTotal) { | 
 |  |  |                             this.$message.error("【"+achieve.goodsName + "】业绩分配金额大于支付金额"); | 
 |  |  |                             isOk = false; | 
 |  |  |                             return; | 
 |  |  |                         } | 
 |  |  |                     }else{ | 
 |  |  |                         this.$message.error("【"+achieve.goodsName + "】业绩分配金额请填写数字"); | 
 |  |  |                         isOk=false; | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |                 }; | 
 |  |  |                 console.log("isOk",isOk); | 
 |  |  |                 return isOk; | 
 |  |  |             }, | 
 |  |  |             //删除业绩 | 
 |  |  |             delAchieve(index, row) { | 
 |  |  |                 let _this = this; | 
 |  |  |                 _this.achieveItems.splice(index, 1); | 
 |  |  |                 this.calculationAchieve(); | 
 |  |  |             }, | 
 |  |  |             checkAchieveIsDel(items) { | 
 |  |  |                 var achieveIds = []; | 
 |  |  | 
 |  |  |                 var id = this.order.id; | 
 |  |  |                 layer.open({ | 
 |  |  |                     type: 2, | 
 |  |  |                     title: "打印服务单", | 
 |  |  |                     title: "打印订单", | 
 |  |  |                     area: ['250px', '550px'], | 
 |  |  |                     maxmin: true, | 
 |  |  |                     content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + id] | 
 
 |  |  | 
 |  |  |                 <div class="col-sm-8"> | 
 |  |  |                     <button  onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm"><i class="fa fa-search" ></i> 搜索</button> | 
 |  |  |                     <button  onclick="myGrid.resetForm()" type="button"   class="btn btn-default btn-sm"><i class="fa fa-refresh " ></i> 重置</button> | 
 |  |  |                     <button  matrix:btn="ygyjbbZb-exportExcel" onclick="exportExcel()" type="button" class="btn btn-default btn-sm"><i class="fa fa-download" ></i> 导出</button> | 
 |  |  |                     <button  matrix:btn="ygyjbb-exportExcel"  onclick="exportExcel()" type="button" class="btn btn-default btn-sm"><i class="fa fa-download" ></i> 导出</button> | 
 |  |  |                 </div> | 
 |  |  |             </div> | 
 |  |  |             <div class="form-group mr-20"> | 
 |  |  | 
 |  |  |                 <input name="beginTime" type="text" class="form-control datetimepicker" id="beginTime">- | 
 |  |  |                 <input name="endTime"  type="text" class="form-control datetimepicker" id="endTime"> | 
 |  |  |             </div> | 
 |  |  |  | 
 |  |  |             <div class="form-group mr-20"> | 
 |  |  |                 <label >所属门店</label> <select id="select_id" | 
 |  |  |                     class="form-control autoFull" | 
 |  |  |                     th:data-url="@{/admin/shopInfo/findShops}" data-value="id" | 
 |  |  |                     data-filed="shopName" data-def="${obj.shopId}" name="shopId"> | 
 |  |  |                     <option value="">--请选择所属门店--</option> | 
 |  |  |                 <label>会员</label> | 
 |  |  |                 <input autocomplete="off" placeholder="姓名/编号/电话"  name="vipQueryKey" type="text" class="form-control"  > | 
 |  |  |             </div> | 
 |  |  |  | 
 |  |  |             <div class="form-group mr-20"> | 
 |  |  |                 <label>美疗师</label> | 
 |  |  |                 <select class="form-control autoFull select2" | 
 |  |  |                         th:data-url="@{/admin/getShopStaffByRoleName?roleName=美疗师}" | 
 |  |  |                         data-value="suId" | 
 |  |  |                         data-filed="suName" | 
 |  |  |                         name="beaultId" | 
 |  |  |                         id="beaultId"> | 
 |  |  |                     <option value="">--请选择美容师--</option> | 
 |  |  |                 </select> | 
 |  |  |             </div> | 
 |  |  |  | 
 |  |  |             <div class="form-group mr-20"> | 
 |  |  |                 <label>门店</label> | 
 |  |  |                 <select class="form-control autoFull" data-filed="shopName" name="shopId" id="shopId" | 
 |  |  |                         th:data-url="@{/admin/shopInfo/findAllWithPermi}"> | 
 |  |  |                     <option value=''>--请选择部所属门店--</option> | 
 |  |  |                 </select> | 
 |  |  |             </div> | 
 |  |  |         </form> | 
 |  |  | 
 |  |  |                     <th data-formatter="MGrid.indexfn" data-align="center" | 
 |  |  |                         data-width="30px" data-footer-formatter="footCountTitle">序号</th> | 
 |  |  |                         <th data-field="datatime"  >时间</th> | 
 |  |  |                     <th data-field="orderType">订单类型</th> | 
 |  |  |                     <th data-field="orderNo"  data-formatter="buildOpenDetail" >订单编号</th> | 
 |  |  |                     <th data-field="levelName">会员级别</th> | 
 |  |  |                     <th data-field="vipName">姓名</th> | 
 |  |  |                     <th data-field="proName">项目名称</th> | 
 |  |  |                     <th data-field="zkTotal" data-footer-formatter="countColumn">总现金业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="总现金业绩=售卡+项目+产品" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="cardCash"  data-footer-formatter="countColumn"  >售卡业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="售卡业绩:现金购买充值卡,套餐,充值的收款金额" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="projCash" data-footer-formatter="countColumn">项目业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="项目业绩:现金购买单个项目的业绩" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="goodsCash" data-footer-formatter="countColumn">产品业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="产品业绩:现金购买产品的业绩" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="consume" data-footer-formatter="countColumn">余额划扣业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="余额划扣业绩:从客户的充值卡余额中划扣消费的金额" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="orderType">订单类型</th> | 
 |  |  |                     <th data-field="vipName">会员姓名</th> | 
 |  |  |                     <th data-field="proName">产品</th> | 
 |  |  |                     <th data-field="cateName">产品分类</th> | 
 |  |  |                     <th data-field="zkTotal" data-footer-formatter="countColumn">订单金额</th> | 
 |  |  |                     <th data-field="goodsCash" data-footer-formatter="countColumn">订单业绩</th> | 
 |  |  |                     <th data-field="payMethod">收款方式</th> | 
 |  |  |                     <th data-field="achieveType">业绩类型</th> | 
 |  |  |                     <th data-field="guwen">顾问</th> | 
 |  |  |                     <th data-field="meiliao">美疗师</th> | 
 |  |  |                     <th data-field="hisConsume" data-footer-formatter="countColumn">本金消耗 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="消耗金额:客户做服务时划扣的本金" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  | 
 |  |  |                     <th data-field="projPercentage" data-footer-formatter="countColumn">服务提成 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="服务提成:为美疗师手动设置的项目服务提成" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |                     <th data-field="guwen">顾问</th> | 
 |  |  |                     <th data-field="meiliao">美疗师</th> | 
 |  |  |                     <th data-field="numberOfPeople" data-footer-formatter="countColumn">人头</th> | 
 |  |  |                     <th data-field="projNum" data-footer-formatter="countColumn">项目个数</th> | 
 |  |  |                     <th data-field="projTime" data-footer-formatter="countColumn">项目时间</th> | 
 |  |  | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         function buildOpenDetail(value, row, index){ | 
 |  |  |             var html = []; | 
 |  |  |             if(row.orderType=='服务单'){ | 
 |  |  |                 html[0] = '<a  onClick="fnPublci.showServiceOrder(1 , \'' + value +'\')"   class="text-primary " >'+value+'</a>' | 
 |  |  |             }else{ | 
 |  |  |                 html[0] = '<a  onClick="fnPublci.showOrder(1 , \'' + value +'\')"   class="text-primary " >'+value+'</a>' | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             return html.join(""); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         $(function() { | 
 |  |  |             MTools.autoFullSelect(); | 
 |  |  |             myGrid = MGrid.initGrid({ | 
 |  |  | 
 |  |  |  | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         function footCountTitle(data) { | 
 |  |  |             return "<b>合计</b>"; | 
 |  |  |         }; | 
 |  |  | 
 |  |  |          | 
 |  |  |          | 
 |  |  |         function exportExcel(){ | 
 |  |  |  | 
 |  |  |             var param=MForm.toUrlParam("#serchform"); | 
 |  |  |  | 
 |  |  |             window.location.href=basePath+"/admin/achieve/exportDailyInfoNew?"+param; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         function buildOpenDetail(value, row, index){ | 
 |  |  |             var html = []; | 
 |  |  |             if(row.orderType=='服务单'){ | 
 |  |  |                 html[0] = '<a  onClick="fnPublci.showServiceOrder(1 , \'' + value +'\')"   class="text-primary " >'+value+'</a>' | 
 |  |  |             }else{ | 
 |  |  |                 html[0] = '<a  onClick="fnPublci.showOrder(1 , \'' + value +'\')"   class="text-primary " >'+value+'</a>' | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             return html.join(""); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     </script> | 
 |  |  | </body> | 
 
 |  |  | 
 |  |  |                         </template> | 
 |  |  |                     </el-table-column> | 
 |  |  |                     <el-table-column | 
 |  |  |                             label="支付方式" | 
 |  |  |                             width="130"> | 
 |  |  |                         <template slot-scope="scope"> | 
 |  |  |                             <el-select  v-model="scope.row.payMethod" | 
 |  |  |                                         placeholder="请选择支付方式"> | 
 |  |  |                                 <el-option | 
 |  |  |                                         v-for="item in itemSimplePayMethods" | 
 |  |  |                                         :key="item.value" | 
 |  |  |                                         :label="item.label" | 
 |  |  |                                         :value="item.value" | 
 |  |  |                                         :disabled="item.disabled"> | 
 |  |  |                                 </el-option> | 
 |  |  |                             </el-select> | 
 |  |  |                         </template> | 
 |  |  |                     </el-table-column> | 
 |  |  |                     <el-table-column | 
 |  |  |                             label="小计"> | 
 |  |  |                         <template slot-scope="scope"> | 
 |  |  |                             {{scope.row.zkPrice * scope.row.count }} | 
 |  |  | 
 |  |  |         </el-col> | 
 |  |  |     </el-row> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <!-- 业绩设置 --> | 
 |  |  |     <el-drawer | 
 |  |  |             title="业绩设置" | 
 |  |  |             :visible.sync="drawer" | 
 |  |  | 
 |  |  |                                 prop="orderItem.payMoney" | 
 |  |  |                                 label="收款"> | 
 |  |  |                         </el-table-column> | 
 |  |  |  | 
 |  |  |                         <el-table-column | 
 |  |  |                                 label="业绩类型" width="150"> | 
 |  |  |                             <template slot-scope="scope"> | 
 |  |  |                                 <el-select v-model="scope.row.t3" placeholder="请选择业绩类型"> | 
 |  |  |                                 <el-select v-model="scope.row.achieveType" @change="calculationAchieve" placeholder="请选择业绩类型"> | 
 |  |  |                                     <el-option | 
 |  |  |                                             v-for="item in achieveTypeList" | 
 |  |  |                                             :key="item.key" | 
 |  |  |                                             :key="item.value" | 
 |  |  |                                             :label="item.value" | 
 |  |  |                                             :value="item.key"> | 
 |  |  |                                             :value="item.value"> | 
 |  |  |                                     </el-option> | 
 |  |  |                                 </el-select> | 
 |  |  |                             </template> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 label="业绩" width="100"> | 
 |  |  |                                 label="业绩" > | 
 |  |  |                             <template slot-scope="scope"> | 
 |  |  |                                 <el-input v-model="scope.row.achieveMoney"></el-input> | 
 |  |  |                                 <el-input @input="checkAchieveMoney" v-model="scope.row.goodsCash"></el-input> | 
 |  |  |                             </template> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                         <el-table-column width="100" | 
 |  |  |                                 label="提成"> | 
 |  |  |                             <template slot-scope="scope"> | 
 |  |  |                                 <el-input v-model="scope.row.commission"></el-input> | 
 |  |  | 
 |  |  |                                            size="mini" | 
 |  |  |                                            @click="delAchieve(scope.$index, scope.row)">删除 | 
 |  |  |                                 </el-button> | 
 |  |  |                                 <el-tooltip content="分享业绩" placement="top"> | 
 |  |  |                                 <el-tooltip content="分享业绩" placement="top" v-if="!scope.row.isShare"> | 
 |  |  |                                     <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share" | 
 |  |  |                                                size="mini" type="primary"></el-button> | 
 |  |  |                                 </el-tooltip> | 
 |  |  | 
 |  |  |         </el-row> | 
 |  |  |     </el-drawer> | 
 |  |  |  | 
 |  |  |     <!-- 收款 --> | 
 |  |  |     <el-dialog title="收款" :visible.sync="dialogSettleVisible"> | 
 |  |  |         <el-row type="flex" align="middle" style="padding: 0 0 10px 0;"> | 
 |  |  |             <el-col :span="5" style="text-align: center;">应收</el-col> | 
 |  |  | 
 |  |  |             vipList: [], | 
 |  |  |             currentVipInfo: {}, | 
 |  |  |             vipLoading: false, | 
 |  |  |             itemSimplePayMethods:[{ | 
 |  |  |                 value: '现金', | 
 |  |  |                 label:'现金', | 
 |  |  |             },{ | 
 |  |  |                 value: '划扣', | 
 |  |  |                 label:'划扣', | 
 |  |  |             }], | 
 |  |  |             payMethods: [{ | 
 |  |  |                 value: '现金支付', | 
 |  |  |                 img: '/images/pay/cash.png', | 
 |  |  | 
 |  |  |                 type: '欠款' | 
 |  |  |             },], | 
 |  |  |             achieveList: [], | 
 |  |  |             //业绩岗位 | 
 |  |  |             achievePostList : [ | 
 |  |  |             ], | 
 |  |  |             //业绩类型 | 
 |  |  |             achieveTypeList : [ | 
 |  |  |                 { | 
 |  |  |                     "key" : "现金业绩", | 
 |  |  |                     "value" : "现金业绩" | 
 |  |  |                 },{ | 
 |  |  |                     "key" : "划扣业绩", | 
 |  |  |                     "value" : "划扣业绩" | 
 |  |  |                 }, | 
 |  |  |             ], | 
 |  |  |             //会员可用的充值卡 | 
 |  |  |             moneyCards: [], | 
 |  |  | 
 |  |  |             if (vipId) { | 
 |  |  |                 _this.changeVip(vipId); | 
 |  |  |             } | 
 |  |  |             //获取用户列表 | 
 |  |  |             //获取业绩用户列表 | 
 |  |  |             AjaxProxy.requst({ | 
 |  |  |                 app: _this, | 
 |  |  |                 url: basePath + '/admin/shopAll', | 
 |  |  |                 callback: function (data) { | 
 |  |  |                     _this.userList = data.rows; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             // 业绩类型 | 
 |  |  |             AjaxProxy.requst({ | 
 |  |  |                 app: _this, | 
 |  |  |                 url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX', | 
 |  |  |                 callback: function (data) { | 
 |  |  |                     _this.achieveTypeList = data.rows; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |  | 
 |  |  | 
 |  |  |                                                     orderItem: item, | 
 |  |  |                                                     staff: _this.staffUser, | 
 |  |  |                                                     saleId: _this.staffUser.suId, | 
 |  |  |                                                     achieveMoney: item.payMoney, | 
 |  |  |                                                     goodsCash: item.payMoney, | 
 |  |  |                                                     commission : 0, | 
 |  |  |                                                     t3 : '现金业绩', | 
 |  |  |                                                     achieveType : _this.achieveTypeList[0].value, | 
 |  |  |                                                     isShare: false, | 
 |  |  |                                                 }); | 
 |  |  |                                             }); | 
 |  |  | 
 |  |  |              * @param{type} 1 = 购买 2=赠送 | 
 |  |  |              * */ | 
 |  |  |             pushToSelectGoods(goods, type) { | 
 |  |  |  | 
 |  |  |                 let _this=this; | 
 |  |  |                 //判断是否被选中 | 
 |  |  |                 let selected = false; | 
 |  |  |                 this.order.items.forEach(item => { | 
 |  |  | 
 |  |  |                             orderItem: item, | 
 |  |  |                             staff: this.staffUser, | 
 |  |  |                             saleId: this.staffUser.suId, | 
 |  |  |                             achieveMoney: item.payMoney, | 
 |  |  |                             t3: '现金业绩', | 
 |  |  |                             goodsCash: item.payMoney, | 
 |  |  |                             achieveType : _this.achieveTypeList[0].value, | 
 |  |  |                             commission: 0, | 
 |  |  |                             isShare: false, | 
 |  |  |                         }); | 
 |  |  | 
 |  |  |                             orderItem: item, | 
 |  |  |                             staff: this.loginUser, | 
 |  |  |                             saleId: this.loginUser.suId, | 
 |  |  |                             achieveMoney: item.payMoney, | 
 |  |  |                             t3: '现金业绩', | 
 |  |  |                             goodsCash: item.payMoney, | 
 |  |  |                             achieveType : _this.achieveTypeList[0].value, | 
 |  |  |                             commission: 0, | 
 |  |  |                             isShare: false, | 
 |  |  |                         }); | 
 |  |  | 
 |  |  |                                 } | 
 |  |  |                                 _this.order.payMoney += parseFloat(item.payMoney); | 
 |  |  |  | 
 |  |  |                                 //重新计算业绩金额 | 
 |  |  |                                 _this.achieveList.forEach(achieve=>{ | 
 |  |  |                                     if(achieve.orderItem==item){ | 
 |  |  |                                         achieve.achieveMoney=item.payMoney; | 
 |  |  |                                     if(achieve.orderItem.uuid==item.uuid){ | 
 |  |  |                                         achieve.orderItem.payMoney=item.payMoney; | 
 |  |  |                                     } | 
 |  |  |                                 }) | 
 |  |  |                                 _this.calculationAchieve(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                             }); | 
 |  |  |                             _this.order.payMoney = _this.order.payMoney.toFixed(2); | 
 |  |  |                             //计算欠款 | 
 |  |  | 
 |  |  |                     let _this = this; | 
 |  |  |  | 
 |  |  |                     if(submitType == 1) { | 
 |  |  |                         //校验支付方式 | 
 |  |  |                         if (_this.payMoneys.length > 0) { | 
 |  |  |                             let flows = [] | 
 |  |  |                             var total = 0; | 
 |  |  |                             _this.payMoneys.forEach(item => { | 
 |  |  |                             let isPayMethodOk=true; | 
 |  |  |                             for(let i=0; i<_this.payMoneys.length;i++){ | 
 |  |  |                                 let item = _this.payMoneys[i]; | 
 |  |  |                                 let flow = {}; | 
 |  |  |                                 flow.payMethod = item.type; | 
 |  |  |                                 if (!item.money) { | 
 |  |  |                                     this.$message.warning("请输入" + item.type + "的付款金额"); | 
 |  |  |                                     _this.$message.warning("请输入" + item.type + "的付款金额"); | 
 |  |  |                                     isPayMethodOk=false; | 
 |  |  |                                     return false; | 
 |  |  |                                 } | 
 |  |  |                                 flow.amount = parseFloat(item.money); | 
 |  |  | 
 |  |  |                                 } | 
 |  |  |                                 total += parseFloat(item.money); | 
 |  |  |                                 flows.push(flow) | 
 |  |  |                             }) | 
 |  |  |                             } | 
 |  |  |                             if (total != _this.order.payMoney) { | 
 |  |  |                                 this.$message.warning("输入付款总金额与应付金额不符"); | 
 |  |  |                                 return false; | 
 |  |  | 
 |  |  |                     _this.achieveList.forEach(achieve => { | 
 |  |  |                         for (let i = 0; i < _this.order.items.length; i++) { | 
 |  |  |                             let item = _this.order.items[i]; | 
 |  |  |                             if (!item.achaeveList){ | 
 |  |  |                                 item.achaeveList = []; | 
 |  |  |                             if (!item.achieveList){ | 
 |  |  |                                 item.achieveList = []; | 
 |  |  |                             } | 
 |  |  |                             if (item.uuid == achieve.orderItem.uuid) { | 
 |  |  |                                 let achieveNew = { | 
 |  |  |                                     uuid:item.uuid, | 
 |  |  |                                     beaultId: achieve.saleId, | 
 |  |  |                                     t1: achieve.achieveMoney, | 
 |  |  |                                     t3: achieve.t3, | 
 |  |  |                                     projPercentage: achieve.commission, | 
 |  |  |                                     achieveType: achieve.achieveType, | 
 |  |  |                                     goodsCash: achieve.goodsCash, | 
 |  |  |                                 }; | 
 |  |  |  | 
 |  |  |                                 var flag = true; | 
 |  |  |                                 for(var j = 0; j < item.achaeveList.length; j++) { | 
 |  |  |                                     if(item.achaeveList[j].uuid == achieveNew.uuid && item.achaeveList[j].beaultId == achieveNew.beaultId) { | 
 |  |  |                                         flag = false; | 
 |  |  |                                         break; | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |  | 
 |  |  |                                 if (flag) { | 
 |  |  |                                     item.achaeveList.push(achieveNew); | 
 |  |  |                                 } | 
 |  |  |                                item.achieveList.push(achieveNew); | 
 |  |  |                                 break; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  | 
 |  |  |  | 
 |  |  |                     console.log(_this.order); | 
 |  |  |                     //校验业绩金额 | 
 |  |  |                     if (_this.checkAchieve()) { | 
 |  |  |                     if (_this.checkAchieveMoney()) { | 
 |  |  |                         let url = basePath + "/admin/order/payOrder"; | 
 |  |  |                         if (submitType == 2) { | 
 |  |  |                             url = basePath + "/admin/order/saveOrder"; | 
 |  |  | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |             }, | 
 |  |  |             /** | 
 |  |  |              * 校验订单业绩设置是否合理 | 
 |  |  |              */ | 
 |  |  |             checkAchieve() { | 
 |  |  |                /* | 
 |  |  |                //TODO 前端展示不检测,因为考虑到储值卡支付问题 | 
 |  |  |                let _this = this; | 
 |  |  |                 for (let i = 0; i < _this.order.items.length; i++) { | 
 |  |  |                     if (_this.achieveList.length > 0) { | 
 |  |  |                         let item = _this.order.items[i]; | 
 |  |  |                         let sum = 0; | 
 |  |  |                         item.achieveList.forEach(achieve => { | 
 |  |  |                             console.log(sum, achieve); | 
 |  |  |                             sum += parseFloat(achieve.t1); | 
 |  |  |                         }); | 
 |  |  |                         if (sum > item.payMoney) { | 
 |  |  |                             this.$message.warning("业绩金额不能大于支付金额【" + item.shoppingGoods.name + "】"); | 
 |  |  |                             return false; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 }*/ | 
 |  |  |                 return true; | 
 |  |  |             }, | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             /** | 
 |  |  |              * 检查订单是否能够提交 | 
 |  |  | 
 |  |  |             shareAchieve(index, row) { | 
 |  |  |                 row2 = JSON.parse(JSON.stringify(row)); | 
 |  |  |                 row2.isShare = true; | 
 |  |  |                 this.achieveList.push(row2); | 
 |  |  |                 this.achieveList.splice(index+1,0,row2); | 
 |  |  |                 //this.achieveList=; | 
 |  |  |                 this.calculationAchieve(); | 
 |  |  |             }, | 
 |  |  |  | 
 |  |  |             //业绩均分订单金额 | 
 |  |  |             calculationAchieve(){ | 
 |  |  |                 console.log("计算业绩"); | 
 |  |  |                 let jsqMap={}; | 
 |  |  |                 this.achieveList.forEach(achieve=>{ | 
 |  |  |                     key=achieve.achieveType+achieve.orderItem.uuid; | 
 |  |  |                     if(!jsqMap[key]){ | 
 |  |  |                         jsqMap[key]=1; | 
 |  |  |                     }else{ | 
 |  |  |                         jsqMap[key]++; | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 this.achieveList.forEach(achieve=>{ | 
 |  |  |                     key=achieve.achieveType+achieve.orderItem.uuid; | 
 |  |  |                     achieve.goodsCash=(achieve.orderItem.payMoney/jsqMap[key]).toFixed(2); | 
 |  |  |                 }); | 
 |  |  |             }, | 
 |  |  |             //校验业绩是否大于订单收款金额 | 
 |  |  |             checkAchieveMoney(){ | 
 |  |  |                 console.log("校验业绩是否大于订单收款金额"); | 
 |  |  |                 let jsqMap={}; | 
 |  |  |                 let isOk=true; | 
 |  |  |                 for(let i=0 ; i< this.achieveList.length; i++){ | 
 |  |  |                     let achieve=this.achieveList[i]; | 
 |  |  |                     if(!isNaN(achieve.goodsCash)  ){ | 
 |  |  |                         key=achieve.achieveType+achieve.orderItem.uuid; | 
 |  |  |                         if(!jsqMap[key]){ | 
 |  |  |                             jsqMap[key]=parseFloat(achieve.goodsCash); | 
 |  |  |                         }else{ | 
 |  |  |                             jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash); | 
 |  |  |                         } | 
 |  |  |                         if(jsqMap[key]>achieve.orderItem.payMoney) { | 
 |  |  |                             this.$message.error("【"+achieve.orderItem.shoppingGoods.name + "】业绩分配金额大于支付金额"); | 
 |  |  |                             isOk = false; | 
 |  |  |                             return; | 
 |  |  |                         } | 
 |  |  |                     }else{ | 
 |  |  |                         this.$message.error("【"+achieve.orderItem.shoppingGoods.name + "】业绩分配金额请填写数字"); | 
 |  |  |                         isOk=false; | 
 |  |  |                         return; | 
 |  |  |                     } | 
 |  |  |                 }; | 
 |  |  |                 console.log("isOk",isOk); | 
 |  |  |                 return isOk; | 
 |  |  |             }, | 
 |  |  |  | 
 |  |  |             //删除业绩 | 
 |  |  |             delAchieve(index, row) { | 
 |  |  |                 this.achieveList.splice(index, 1); | 
 |  |  |                 this.calculationAchieve(); | 
 |  |  |             }, | 
 |  |  |             print() { | 
 |  |  |                 let _this = this; | 
 |  |  | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if(!this.checkAchieveMoney()){ | 
 |  |  |                     return ; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 _this.dialogSettleVisible = true; | 
 |  |  |             } | 
 |  |  |         } | 
 
 |  |  | 
 |  |  |                         </el-col> | 
 |  |  |                         <el-col :span="14" style="text-align: right;"> | 
 |  |  |                             <label>¥ {{order.total}}</label> | 
 |  |  |                             <label>¥ {{(order.zkTotal - order.total).toFixed(2)}}</label> | 
 |  |  |                             <!-- 退款订单不能显示为负数 --> | 
 |  |  |                             <label>¥ {{(order.zkTotal - order.total>0?order.zkTotal - order.total:0).toFixed(2)}}</label> | 
 |  |  |                             <label>¥ {{order.zkTotal}}</label> | 
 |  |  |                             <label>¥ {{order.arrears}}</label> | 
 |  |  |                             <label>¥ {{order.repay}}</label> | 
 |  |  | 
 |  |  |                                     label="折扣单价"> | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column  label="小计" :formatter="calOrderTotalFormatter"> | 
 |  |  |                             </el-table-column> | 
 |  |  |                             <el-table-column  label="支付方式"  prop="payMethod"> | 
 |  |  |                             </el-table-column> | 
 |  |  |                         </el-table> | 
 |  |  |                     </el-row> | 
 |  |  | 
 |  |  |                                         label="收款"> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column | 
 |  |  |                                         prop="t3" | 
 |  |  |                                         prop="payMethod" | 
 |  |  |                                         label="支付方式"> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column | 
 |  |  |                                         prop="achieveType" | 
 |  |  |                                         label="业绩类型"> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column | 
 |  |  |                                         prop="t1" | 
 |  |  |                                         prop="goodsCash" | 
 |  |  |                                         label="原业绩"> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column | 
 |  |  | 
 |  |  |                                 label="收款"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="payMethod" | 
 |  |  |                                 label="支付方式"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="t3" | 
 |  |  |                                 label="业绩类型"> | 
 |  |  |                             <template slot-scope="scope"> | 
 |  |  |                                 <el-select v-model="scope.row.t3" placeholder="请选择业绩类型"> | 
 |  |  |                                 <el-select v-model="scope.row.achieveType" placeholder="请选择业绩类型"> | 
 |  |  |                                     <el-option | 
 |  |  |                                             v-for="item in achieveTypeList" | 
 |  |  |                                             :key="item.key" | 
 |  |  |                                             :key="item.value" | 
 |  |  |                                             :label="item.value" | 
 |  |  |                                             :value="item.key"> | 
 |  |  |                                             :value="item.value"> | 
 |  |  |                                     </el-option> | 
 |  |  |                                 </el-select> | 
 |  |  |                             </template> | 
 |  |  | 
 |  |  |                                 prop="achieve" | 
 |  |  |                                 label="业绩"> | 
 |  |  |                             <template slot-scope="scope"> | 
 |  |  |                                 <el-input v-model="scope.row.t1"></el-input> | 
 |  |  |                                 <el-input  @input="checkAchieveMoney" v-model="scope.row.goodsCash"></el-input> | 
 |  |  |                             </template> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  | 
 |  |  |                                            size="mini" | 
 |  |  |                                            @click="delAchieve(scope.$index, scope.row)">删除 | 
 |  |  |                                 </el-button> | 
 |  |  |                                 <el-tooltip content="分享业绩" placement="top"> | 
 |  |  |                                 <el-tooltip content="分享业绩" placement="top" v-if="!scope.row.isShare"> | 
 |  |  |                                     <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share" | 
 |  |  |                                                size="mini" type="primary"></el-button> | 
 |  |  |                                 </el-tooltip> | 
 |  |  | 
 |  |  |             activeName : "first", | 
 |  |  |             circleUrl : "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png", | 
 |  |  |             userList : [], | 
 |  |  |             achieveTypeList : [ | 
 |  |  |                 { | 
 |  |  |                     "key" : "现金业绩", | 
 |  |  |                     "value" : "现金业绩" | 
 |  |  |                 },{ | 
 |  |  |                     "key" : "划扣业绩", | 
 |  |  |                     "value" : "划扣业绩" | 
 |  |  |                 }, | 
 |  |  |             ], | 
 |  |  |             achieveTypeList : [], | 
 |  |  |             orderItems : [], | 
 |  |  |             achieveItems : [], | 
 |  |  |             flowItems : [], | 
 |  |  | 
 |  |  |             let _this = this; | 
 |  |  |             this.orderParam = /*[[${orderParam}]]*/ | 
 |  |  |             this.queryOrderDetailData(this.orderParam); | 
 |  |  |  | 
 |  |  |             // 业绩类型 | 
 |  |  |             AjaxProxy.requst({ | 
 |  |  |                 app: _this, | 
 |  |  |                 url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX', | 
 |  |  |                 callback: function (data) { | 
 |  |  |                     _this.achieveTypeList = data.rows; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         }, | 
 |  |  |         methods : { | 
 |  |  |             calRefund() { | 
 |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 _this.data.items = dataItems; | 
 |  |  |                 _this.data.zkTotal =  _this.refundMoney; | 
 |  |  |                 _this.data.total =  _this.total; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 AjaxProxy.requst({ | 
 |  |  |                     app: _this, | 
 |  |  |                     data: _this.data, | 
 |  |  | 
 |  |  |                 let _this = this; | 
 |  |  |                 let items = this.orderItems; | 
 |  |  |                 _this.refundMoney = 0; | 
 |  |  |                 _this.total = 0; | 
 |  |  |  | 
 |  |  |                 for(var i = 0; i < items.length; i++) { | 
 |  |  |                     let item = items[i] | 
 |  |  | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         _this.refundMoney += parseFloat(item.refundPrice * item.refundCount); | 
 |  |  |                         //记录一下未优惠之前的价格 | 
 |  |  |                         _this.total += parseFloat(item.price * item.refundCount); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  | 
 |  |  |                 _this.dialogSettleVisible = true; | 
 |  |  |             }, | 
 |  |  |             calOrderTotalFormatter(row, column) { | 
 |  |  |                 return row.count * row.price; | 
 |  |  |                 return row.count * row.zkPrice; | 
 |  |  |             }, | 
 |  |  |             getVipMoneyCards() { | 
 |  |  |                 let _this = this; | 
 |  |  | 
 |  |  |             }, | 
 |  |  |             saveAchieve() { | 
 |  |  |                 let _this = this; | 
 |  |  |                 if(_this.checkAchieveMoney()){ | 
 |  |  |                 AjaxProxy.requst({ | 
 |  |  |                     app: _this, | 
 |  |  |                     data: _this.achieveItems, | 
 |  |  | 
 |  |  |                         _this.$message.success(data.info); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             }, | 
 |  |  |  | 
 |  |  |             shareAchieve(index, row) { | 
 |  |  |                 var row2 = JSON.parse(JSON.stringify(row)); | 
 |  |  |                 row2.id = null; | 
 |  |  |                 row2.isShare = true; | 
 |  |  |                 this.achieveItems.push(row2); | 
 |  |  |                 this.achieveItems.splice(index+1,0,row2); | 
 |  |  |                 this.calculationAchieve(); | 
 |  |  |             }, | 
 |  |  |             delAchieve(index, row) { | 
 |  |  |                 let _this = this; | 
 |  |  |                 if (row.id) { | 
 |  |  |                     AjaxProxy.requst({ | 
 |  |  |                         app: _this, | 
 |  |  |                         url: basePath + '/admin/achieve/del?id=' + row.id, | 
 |  |  |                         callback: function (data) { | 
 |  |  |             //业绩均分订单金额 | 
 |  |  |             calculationAchieve(){ | 
 |  |  |                 console.log("计算业绩"); | 
 |  |  |                 let jsqMap={}; | 
 |  |  |                 this.achieveItems.forEach(achieve=>{ | 
 |  |  |                     key=achieve.achieveType+achieve.orderItemId; | 
 |  |  |                     if(!jsqMap[key]){ | 
 |  |  |                         jsqMap[key]=1; | 
 |  |  |                     }else{ | 
 |  |  |                         jsqMap[key]++; | 
 |  |  |                         } | 
 |  |  |                     }); | 
 |  |  |                 this.achieveItems.forEach(achieve=>{ | 
 |  |  |                     key=achieve.achieveType+achieve.orderItemId; | 
 |  |  |                     achieve.goodsCash=(achieve.zkTotal/jsqMap[key]).toFixed(2); | 
 |  |  |                 }); | 
 |  |  |             }, | 
 |  |  |             //校验业绩是否大于订单收款金额 | 
 |  |  |             checkAchieveMoney(){ | 
 |  |  |                 console.log("校验业绩是否大于订单收款金额"); | 
 |  |  |                 let jsqMap={}; | 
 |  |  |                 let isOk=true; | 
 |  |  |                 for(let i=0 ; i< this.achieveItems.length; i++){ | 
 |  |  |                     let achieve=this.achieveItems[i]; | 
 |  |  |                     if(!isNaN(achieve.goodsCash)  ){ | 
 |  |  |                         key=achieve.achieveType+achieve.orderItemId; | 
 |  |  |                         if(!jsqMap[key]){ | 
 |  |  |                             jsqMap[key]=parseFloat(achieve.goodsCash); | 
 |  |  |                         }else{ | 
 |  |  |                             jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                         if(jsqMap[key]>achieve.zkTotal) { | 
 |  |  |                             this.$message.error("【"+achieve.goodsName + "】业绩分配金额大于支付金额"); | 
 |  |  |                             isOk = false; | 
 |  |  |                             break; | 
 |  |  |                         } | 
 |  |  |                     }else{ | 
 |  |  |                         this.$message.error("【"+achieve.goodsName + "】业绩分配金额请填写数字"); | 
 |  |  |                         isOk=false; | 
 |  |  |                         break; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 console.log("isOk",isOk); | 
 |  |  |                 return isOk; | 
 |  |  |             }, | 
 |  |  |             //删除业绩 | 
 |  |  |             delAchieve(index, row) { | 
 |  |  |                 let _this = this; | 
 |  |  |                 _this.achieveItems.splice(index, 1); | 
 |  |  |                 this.calculationAchieve(); | 
 |  |  |             }, | 
 |  |  |             checkAchieveIsDel(items) { | 
 |  |  |                 var achieveIds = []; | 
 
 |  |  | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="projInfo.name" | 
 |  |  |                                 label="商品名称" | 
 |  |  |                                 width="280"> | 
 |  |  |                                 width="400"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 :formatter="hkPrice" | 
 |  |  |                                 label="划扣金额" | 
 |  |  |                                 width="200"> | 
 |  |  |                                 width="100"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="count" | 
 |  |  |                                 label="次数" | 
 |  |  |                                 width="200"> | 
 |  |  |                                 width="100"> | 
 |  |  |                         </el-table-column> | 
 |  |  |                         <el-table-column | 
 |  |  |                                 prop="projInfo.timeLength" | 
 
 |  |  | 
 |  |  |     function cancelOrder() { | 
 |  |  |         var id=myGrid.getSelectItemId(); | 
 |  |  |         layer.confirm('确定取消此订单?', { | 
 |  |  |             btn: ['确认', '取消并删除', '取消'] //可以无限个按钮 | 
 |  |  |             btn: ['确认', '取消'] //可以无限个按钮 | 
 |  |  |         }, function(index, layero){ | 
 |  |  |             $.post(basePath+'/admin/order/cancelOrder?id='+id+'&del=0', {}, function(data){ | 
 |  |  |                 if (data.status == '200') { | 
 |  |  |                 parent.layer.msg(data.info,{icon: 1}); | 
 |  |  |                 } else { | 
 |  |  |                     parent.layer.msg(data.info,{icon: 2}); | 
 |  |  |                 } | 
 |  |  |                 layer.closeAll(); | 
 |  |  |                 myGrid.serchData(); | 
 |  |  |             }); | 
 |  |  |         }, function(index){ | 
 |  |  |             $.post(basePath+'/admin/order/cancelOrder?id='+id+'&del=1', {}, function(data){ | 
 |  |  |                 parent.layer.msg(data.info,{icon: 1}); | 
 |  |  |                 layer.closeAll(); | 
 |  |  |                 myGrid.serchData(); | 
 |  |  |             }); | 
 |  |  |         }, function(index){ | 
 |  |  |         }, | 
 |  |  |         //     function(index){ | 
 |  |  |         //     $.post(basePath+'/admin/order/cancelOrder?id='+id+'&del=1', {}, function(data){ | 
 |  |  |         //         parent.layer.msg(data.info,{icon: 1}); | 
 |  |  |         //         layer.closeAll(); | 
 |  |  |         //         myGrid.serchData(); | 
 |  |  |         //     }); | 
 |  |  |         // }, | 
 |  |  |             function(index){ | 
 |  |  |             //按钮【按钮二】的回调 | 
 |  |  |         }); | 
 |  |  |     } | 
 
 |  |  | 
 |  |  |                                 <el-table-column fixed="right" label="操作"  width="200"> | 
 |  |  |                                     <template slot-scope="scope"> | 
 |  |  |                                         <el-button type="text" size="small" @click="lookServiceOrder(scope.$index, scope.row)">查看</el-button> | 
 |  |  |                                         <el-button matrix:btn="serviceClub-paiban" type="text" size="small" v-if="scope.row.state=='待预约'" @click="paiban(scope.$index, scope.row)">排班</el-button> | 
 |  |  |                                         <el-button matrix:btn="serviceClub-paidan" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="giveServiceOrder(scope.$index, scope.row)">派单</el-button> | 
 |  |  |                                         <el-button matrix:btn="serviceClub-paiban" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="paiban(scope.$index, scope.row)">排班</el-button> | 
 |  |  | <!--                                        <el-button matrix:btn="serviceClub-paidan" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="giveServiceOrder(scope.$index, scope.row)">派单</el-button>--> | 
 |  |  |                                         <el-button matrix:btn="serviceClub-edit" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="modifyServiceOrder(scope.$index, scope.row)">修改</el-button> | 
 |  |  |                                         <el-button matrix:btn="serviceClub-peiliao" type="text" size="small" v-if="scope.row.state=='需配料'" @click="peiliao(scope.$index, scope.row)">配料</el-button> | 
 |  |  |                                         <el-button matrix:btn="serviceClub-huakou" type="text" size="small" v-if="scope.row.state=='服务完成'" @click="hkService(scope.$index, scope.row)">划扣</el-button> | 
 |  |  | 
 |  |  |                                 <el-table-column | 
 |  |  |                                         prop="staffName" | 
 |  |  |                                         label="下单顾问"> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column | 
 |  |  |                                         prop="cashPay" | 
 |  |  |                                         label="现金支付金额"> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column | 
 |  |  |                                         prop="cardPay" | 
 |  |  |                                         label="卡支付金额"> | 
 |  |  |                                 </el-table-column> | 
 |  |  |                                 <el-table-column | 
 |  |  |                                         prop="arrears" | 
 
 |  |  | 
 |  |  |                     <th data-formatter="MGrid.indexfn" data-align="center" | 
 |  |  |                         data-width="30px" data-footer-formatter="footCountTitle">序号</th> | 
 |  |  |                     <th data-field="datatime">时间</th> | 
 |  |  |                     <th data-field="orderType">订单类型</th> | 
 |  |  |                     <th data-field="orderNo" data-formatter="buildOpenDetail" >订单编号</th> | 
 |  |  |                     <th data-field="levelName">会员级别</th> | 
 |  |  |                     <th data-field="vipName">姓名</th> | 
 |  |  |                     <th data-field="proName">项目名称</th> | 
 |  |  |                     <th data-field="zkTotal" data-footer-formatter="countColumn">总现金业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="总现金业绩=售卡+项目+产品" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="cardCash"  data-footer-formatter="countColumn"  >售卡业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="售卡业绩:现金购买充值卡,套餐,充值的收款金额" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="projCash" data-footer-formatter="countColumn">项目业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="项目业绩:现金购买单个项目的业绩" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="goodsCash" data-footer-formatter="countColumn">产品业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="产品业绩:现金购买产品的业绩" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="consume" data-footer-formatter="countColumn">余额划扣业绩 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="余额划扣业绩:从客户的充值卡余额中划扣消费的金额" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |  | 
 |  |  |                     <th data-field="orderType">订单类型</th> | 
 |  |  |                     <th data-field="vipName">会员姓名</th> | 
 |  |  |                     <th data-field="proName">产品</th> | 
 |  |  |                     <th data-field="cateName">产品分类</th> | 
 |  |  |                     <th data-field="zkTotal" data-footer-formatter="countColumn">订单金额</th> | 
 |  |  |                     <th data-field="goodsCash" data-footer-formatter="countColumn">订单业绩</th> | 
 |  |  |                     <th data-field="payMethod">收款方式</th> | 
 |  |  |                     <th data-field="achieveType">业绩类型</th> | 
 |  |  |                     <th data-field="guwen">顾问</th> | 
 |  |  |                     <th data-field="meiliao">美疗师</th> | 
 |  |  |                     <th data-field="hisConsume" data-footer-formatter="countColumn">本金消耗 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="消耗金额:客户做服务时划扣的本金" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  | 
 |  |  |                     <th data-field="projPercentage" data-footer-formatter="countColumn">服务提成 | 
 |  |  |                         <i data-toggle="tooltip" data-placement="top" title="服务提成:为美疗师手动设置的项目服务提成" class="fa fa-question-circle"></i> | 
 |  |  |                     </th> | 
 |  |  |                     <th data-field="guwen">顾问</th> | 
 |  |  |                     <th data-field="meiliao">美疗师</th> | 
 |  |  |                     <th data-field="numberOfPeople" data-footer-formatter="countColumn">人头</th> | 
 |  |  |                     <th data-field="projNum" data-footer-formatter="countColumn">项目个数</th> | 
 |  |  |                     <th data-field="projTime" data-footer-formatter="countColumn">项目时间</th> | 
 
 |  |  | 
 |  |  |  | 
 |  |  |         for (SysOrder sysOrder : sysOrders) { | 
 |  |  |             sysOrder.setCashPay(sysOrder.getZkTotal()); | 
 |  |  |             sysOrder.setCardPay(0); | 
 |  |  |             sysOrder.setCardPay(0D); | 
 |  |  |             sysOrderDao.update(sysOrder); | 
 |  |  |  | 
 |  |  |             List<SysOrderItem> items = sysOrderItemDao.selectByOrderId(sysOrder.getId()); |