1 files added
14 files modified
| | |
| | | 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 { |
| | |
| | | // printer.printRecord(cells); |
| | | // } |
| | | // printer.flush(); |
| | | // printer.close(); |
| | | // printer.close(); |
| | | long t2 = System.currentTimeMillis(); |
| | | System.out.println("CSV: " + (t2 - t1)); |
| | | } |
| | |
| | | * 支付方式-现金支付 |
| | | */ |
| | | String PAY_TYPE_MOENY = "现金"; |
| | | /** |
| | | * 支付方式-现金支付 |
| | | */ |
| | | String PAY_TYPE_MOENY_CARD = "会员卡"; |
| | | |
| | | /** |
| | | * 支付方式-卡支付 |
| | | */ |
| | |
| | | * 客户id |
| | | */ |
| | | private Long vipId; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 购买业绩 |
| | | */ |
| | | private Double goodsCash; |
| | | |
| | | /** |
| | | * 赠送消耗 |
| | |
| | | */ |
| | | private Double hisConsume; |
| | | |
| | | |
| | | /** |
| | | * 划扣金额 从卡中划扣钱买东西 |
| | | */ |
| | | private Double consume; |
| | | |
| | | |
| | | /** |
| | | * 卡项,套餐,充值,开会籍卡 |
| | | */ |
| | | private Double cardCash; |
| | | |
| | | |
| | | /** |
| | | * 现金单次,购买项目的业绩 |
| | | */ |
| | | @Deprecated |
| | | private Double projCash; |
| | | |
| | | |
| | | /** |
| | | * 现金产品,购买家居产品的钱 |
| | | */ |
| | | private Double goodsCash; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * 总金额 |
| | | */ |
| | | private Double zkTotal; |
| | | |
| | | /** |
| | | * 公司id |
| | | */ |
| | | private Long companyId; |
| | | |
| | | |
| | | private String t1; |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 岗位业绩 |
| | | */ |
| | | private String t3; |
| | | |
| | | /** |
| | | * 业绩类型 |
| | | */ |
| | | private String achieveType; |
| | | |
| | | |
| | | private String t4; |
| | | |
| | | |
| | |
| | | private Date endTime; |
| | | |
| | | |
| | | /** |
| | | * 分配的业绩金额 |
| | | */ |
| | | private Double achieveMoney; |
| | | |
| | | private String goodsNo; |
| | | |
| | | private String goodsName; |
| | | |
| | | private String type; |
| | | |
| | | private String payMethod; |
| | | |
| | | 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; |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | //页面参数使用 |
| | | |
| | | |
| | | /** |
| | | * 付款方式 |
| | | */ |
| | |
| | | /** |
| | | * 业绩计算 |
| | | */ |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | |
| | | // 本日 |
| | | case 1 : |
| | | break; |
| | | // 昨日 |
| | | // 昨日 |
| | | case 2: |
| | | startTime = DateUtil.previousNDate(startTime, 1); |
| | | endTime = startTime; |
| | | break; |
| | | // 本月 |
| | | // 本月 |
| | | case 3: |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | startTime = calendar.getTime(); |
| | | break; |
| | | // 上月 |
| | | // 上月 |
| | | case 4: |
| | | calendar.add(Calendar.MONTH, -1); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | |
| | | |
| | | /** |
| | | * 取消订单 |
| | | * 本方法无法退回多次不同卡项收款的订单 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | 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); |
| | |
| | | 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.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.getHisConsume()); |
| | | temp.add(item.getFreeConsume()); |
| | | temp.add(item.getProjPercentage()); |
| | |
| | | |
| | | @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); |
| | | return AjaxResult.buildSuccessInstance("保存成功"); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | //删除原业绩 |
| | | achieveNewDao.deleteByOrderId(list.get(0).getOrderId()); |
| | | //插入新业绩 |
| | | achieveNewDao.batchInsert(list); |
| | | return AjaxResult.buildSuccessInstance("保存成功"); |
| | | } else { |
| | | return AjaxResult.buildFailInstance("未找到业绩数据"); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | <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="achieveMoney" column="achieveMoney" /> |
| | | <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" /> |
| | | |
| | | </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, |
| | | (IFNULL(a.goods_cash,0)) as zk_total, |
| | | a.goods_cash, |
| | | a.card_cash, |
| | | a.consume, |
| | | a.his_consume, |
| | | a.free_consume, |
| | | a.achieveMoney, |
| | | f.su_name meiliao, |
| | | g.su_name guwen, |
| | | a.proj_percentage, |
| | |
| | | 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="achieveMoney" column="achieveMoney" /> |
| | | |
| | | <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, |
| | | achieveMoney, |
| | | |
| | | 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.achieveMoney}, |
| | | |
| | | #{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('achieveMoney')"> |
| | | achieveMoney = #{achieveMoney}, |
| | | </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.achieveMoney != null "> |
| | | achieveMoney = #{record.achieveMoney}, |
| | | </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, |
| | | sum(goods_cash) orderCash, |
| | | 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> |
New file |
| | |
| | | 删除 |
| | | cardCash |
| | | projCash |
| | | 只留下 |
| | | goodsCash |
| | | 产品现金业绩和划扣业绩consume |
| | | |
| | | 重构订单,收款,退款等方法不要共用逻辑 |
| | | 修改t3为业绩类型 |
| | | ALTER TABLE `achieve_new` |
| | | CHANGE COLUMN `t3` `achieveType` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `t2`; |
| | | |
| | |
| | | </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-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share" |
| | | size="mini" type="primary"></el-button> |
| | | <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> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | prop="flowContent" |
| | | label="交易内容" |
| | | width="300"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="createTime" |
| | | label="交易时间"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="flowType" |
| | |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- <el-row style="text-align: center; margin: 20px 0 10px 0">--> |
| | | <!-- <el-checkbox v-model="printPaper">打印小票</el-checkbox>--> |
| | | <!-- </el-row>--> |
| | | <!-- <el-row style="text-align: center; margin: 20px 0 10px 0">--> |
| | | <!-- <el-checkbox v-model="printPaper">打印小票</el-checkbox>--> |
| | | <!-- </el-row>--> |
| | | |
| | | <el-row style="text-align: center; margin: 10px 0 0 0"> |
| | | <el-button type="primary" @click="confirmSubmit">确认收款</el-button> |
| | |
| | | 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', |
| | |
| | | created : function() { |
| | | let _this = this; |
| | | this.orderParam = /*[[${orderParam}]]*/ |
| | | this.queryOrderDetailData(this.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; |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | data: _this.achieveItems, |
| | | contentType: 'application/json', |
| | | url: basePath + '/admin/achieve/add', |
| | | callback: function (data) { |
| | | _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); |
| | | }, |
| | | delAchieve(index, row) { |
| | | let _this = this; |
| | | if (row.id) { |
| | | if(_this.checkAchieveMoney()){ |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/admin/achieve/del?id=' + row.id, |
| | | data: _this.achieveItems, |
| | | contentType: 'application/json', |
| | | url: basePath + '/admin/achieve/add', |
| | | callback: function (data) { |
| | | _this.$message.success(data.info); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | |
| | | shareAchieve(index, row) { |
| | | var row2 = JSON.parse(JSON.stringify(row)); |
| | | row2.id = null; |
| | | row2.isShare = true; |
| | | this.achieveItems.splice(index+1,0,row2); |
| | | this.calculationAchieve(); |
| | | }, |
| | | //业绩均分订单金额 |
| | | 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; |
| | | this.achieveItems.forEach(achieve=>{ |
| | | 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] |
| | |
| | | </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-option |
| | | v-for="item in achievePostList" |
| | | :key="item.value" |
| | | :label="item.value" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="业绩类型" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.t4" placeholder="请选择业绩类型"> |
| | | <el-select v-model="scope.row.achieveType" @change="calculationAchieve" placeholder="请选择业绩类型"> |
| | | <el-option |
| | | v-for="item in achieveTypeList" |
| | | :key="item.value" |
| | |
| | | </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', |
| | |
| | | } |
| | | }); |
| | | |
| | | //岗位业绩 |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/admin/customerDictionary/getListByParentCode/GWYJ', |
| | | callback: function (data) { |
| | | _this.achievePostList = data.rows; |
| | | } |
| | | }); |
| | | |
| | | // 业绩类型 |
| | | AjaxProxy.requst({ |
| | |
| | | orderItem: item, |
| | | staff: _this.staffUser, |
| | | saleId: _this.staffUser.suId, |
| | | achieveMoney: item.payMoney, |
| | | goodsCash: item.payMoney, |
| | | commission : 0, |
| | | t3 : _this.achievePostList[0].value, |
| | | t4 : _this.achieveTypeList[0].value, |
| | | achieveType : _this.achieveTypeList[0].value, |
| | | isShare: false, |
| | | }); |
| | | }); |
| | |
| | | orderItem: item, |
| | | staff: this.staffUser, |
| | | saleId: this.staffUser.suId, |
| | | achieveMoney: item.payMoney, |
| | | t3 : _this.achievePostList[0].value, |
| | | t4 : _this.achieveTypeList[0].value, |
| | | 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 : _this.achievePostList[0].value, |
| | | t4 : _this.achieveTypeList[0].value, |
| | | 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; |
| | | let isPayMethodOk=true; |
| | | _this.payMoneys.forEach(item => { |
| | | 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(!isPayMethodOk){ |
| | | return ; |
| | | } |
| | | |
| | | 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, |
| | | 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; |
| | | this.achieveList.forEach(achieve=>{ |
| | | 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; |
| | |
| | | </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"> |
| | |
| | | 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-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share" |
| | | size="mini" type="primary"></el-button> |
| | | <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> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- <el-row style="text-align: center; margin: 20px 0 10px 0">--> |
| | | <!-- <el-checkbox v-model="printPaper">打印小票</el-checkbox>--> |
| | | <!-- </el-row>--> |
| | | <!-- <el-row style="text-align: center; margin: 20px 0 10px 0">--> |
| | | <!-- <el-checkbox v-model="printPaper">打印小票</el-checkbox>--> |
| | | <!-- </el-row>--> |
| | | |
| | | <el-row style="text-align: center; margin: 10px 0 0 0"> |
| | | <el-button type="primary" @click="confirmSubmit">确认收款</el-button> |
| | |
| | | activeName : "first", |
| | | circleUrl : "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png", |
| | | userList : [], |
| | | achieveTypeList : [ |
| | | { |
| | | "key" : "现金业绩", |
| | | "value" : "现金业绩" |
| | | },{ |
| | | "key" : "划扣业绩", |
| | | "value" : "划扣业绩" |
| | | }, |
| | | ], |
| | | achieveTypeList : [], |
| | | orderItems : [], |
| | | achieveItems : [], |
| | | flowItems : [], |
| | |
| | | created : function() { |
| | | let _this = this; |
| | | this.orderParam = /*[[${orderParam}]]*/ |
| | | this.queryOrderDetailData(this.orderParam); |
| | | |
| | | this.queryOrderDetailData(this.orderParam); |
| | | // 业绩类型 |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX', |
| | | callback: function (data) { |
| | | _this.achieveTypeList = data.rows; |
| | | } |
| | | }); |
| | | }, |
| | | methods : { |
| | | calRefund() { |
| | |
| | | }, |
| | | saveAchieve() { |
| | | let _this = this; |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | data: _this.achieveItems, |
| | | contentType: 'application/json', |
| | | url: basePath + '/admin/achieve/add', |
| | | callback: function (data) { |
| | | _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); |
| | | }, |
| | | delAchieve(index, row) { |
| | | let _this = this; |
| | | if (row.id) { |
| | | if(_this.checkAchieveMoney()){ |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/admin/achieve/del?id=' + row.id, |
| | | data: _this.achieveItems, |
| | | contentType: 'application/json', |
| | | url: basePath + '/admin/achieve/add', |
| | | callback: function (data) { |
| | | _this.$message.success(data.info); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | |
| | | shareAchieve(index, row) { |
| | | var row2 = JSON.parse(JSON.stringify(row)); |
| | | row2.id = null; |
| | | row2.isShare = true; |
| | | this.achieveItems.splice(index+1,0,row2); |
| | | this.calculationAchieve(); |
| | | }, |
| | | //业绩均分订单金额 |
| | | 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; |
| | | this.achieveItems.forEach(achieve=>{ |
| | | 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 = []; |