|  |  | 
 |  |  |     @ApiModelProperty(value = "卡项业绩") | 
 |  |  |     private BigDecimal cardAchieve; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "储值卡本金扣款") | 
 |  |  |     private BigDecimal cardAmount; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "储值卡增金扣款") | 
 |  |  |     private BigDecimal cardFreeAmount; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "退款") | 
 |  |  |     private BigDecimal refund; | 
 |  |  |  | 
 |  |  | 
 |  |  |     public void setTimeLength(BigDecimal timeLength) { | 
 |  |  |         this.timeLength = timeLength; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public BigDecimal getCardAmount() { | 
 |  |  |         return cardAmount; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setCardAmount(BigDecimal cardAmount) { | 
 |  |  |         this.cardAmount = cardAmount; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public BigDecimal getCardFreeAmount() { | 
 |  |  |         return cardFreeAmount; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setCardFreeAmount(BigDecimal cardFreeAmount) { | 
 |  |  |         this.cardFreeAmount = cardFreeAmount; | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     <select id="selectUserAchieveByTime" resultType="com.matrix.system.app.vo.UserAchieveVo"> | 
 |  |  |         select | 
 |  |  |             sale_id id, | 
 |  |  |             (select ifnull(sum(case b.pay_method when '现金' then goods_cash else 0 end),0) | 
 |  |  |             (select ifnull(sum(case 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) | 
 |  |  |             (select ifnull(sum(case 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, | 
 
 |  |  | 
 |  |  |                     )totalPay, | 
 |  |  |                 (select IFNULL(sum(a.amount),0) from sys_order_flow a | 
 |  |  |                     inner join sys_order b on a.order_id=b.id and b.statu!='已取消' | 
 |  |  |                     where a.pay_method not in ('储值卡', '欠款') and a.flow_type != '退款' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]> | 
 |  |  |                     where a.pay_method not in ('储值卡', '欠款') and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and a.shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  | 
 |  |  |                         and a.company_id=#{companyId} | 
 |  |  |                     </if> | 
 |  |  |                 ) refund, | 
 |  |  |                 (select sum(IFNULL(amount, 0)) | 
 |  |  |                     from sys_order_flow a | 
 |  |  |                     inner join sys_order b on a.order_id=b.id and b.STATU!='已取消' | 
 |  |  |                     where a.pay_method='储值卡' and a.is_gift='N' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and a.shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  |                     <if test="companyId != null"> | 
 |  |  |                         and a.company_id=#{companyId} | 
 |  |  |                     </if> | 
 |  |  |                 ) cardAmount, | 
 |  |  |                 (select sum(IFNULL(amount, 0)) | 
 |  |  |                     from sys_order_flow a | 
 |  |  |                     inner join sys_order b on a.order_id=b.id and b.STATU!='已取消' | 
 |  |  |                     where a.pay_method='储值卡' and a.is_gift='Y' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]> | 
 |  |  |                     <if test="shopId != null"> | 
 |  |  |                         and a.shop_id=#{shopId} | 
 |  |  |                     </if> | 
 |  |  |                     <if test="companyId != null"> | 
 |  |  |                         and a.company_id=#{companyId} | 
 |  |  |                     </if> | 
 |  |  |                 ) cardFreeAmount, | 
 |  |  |                 (select IFNULL(count(1),0) from sys_order | 
 |  |  |                     where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]> | 
 |  |  |                     <if test="shopId != null"> | 
 
 |  |  | 
 |  |  |                     callback: function (data) { | 
 |  |  |                         _this.isRefund = false; | 
 |  |  |                         _this.dialogSettleVisible = false; | 
 |  |  |                         _this.queryOrderDetailData(_this.data.oldOrderId); | 
 |  |  |                         var param = {}; | 
 |  |  |                         param.id = _this.data.oldOrderId; | 
 |  |  |                         _this.queryOrderDetailData(param); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |  | 
 
 |  |  | 
 |  |  |                     callback: function (data) { | 
 |  |  |                         _this.isRefund = false; | 
 |  |  |                         _this.dialogSettleVisible = false; | 
 |  |  |                         _this.queryOrderDetailData(_this.data.oldOrderId); | 
 |  |  |                         var param = {}; | 
 |  |  |                         param.id = _this.data.oldOrderId; | 
 |  |  |                         _this.queryOrderDetailData(param); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |  |