Merge branch 'score_shop' of http://120.27.238.55:7000/r/beauty-erp into score_shop
3 files added
7 files modified
| | |
| | | <exclude>config/test/*</exclude> |
| | | <exclude>config/xcx/*</exclude> |
| | | |
| | | <!-- |
| | | <!----> |
| | | <exclude>config/config.json</exclude> |
| | | <exclude>config/application.properties</exclude> |
| | | <exclude>config/system.properties</exclude> |
| | | |
| | | --> |
| | | |
| | | |
| | | <exclude>**/*.woff</exclude> |
| | | <exclude>**/*.woff2</exclude> |
| | |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanApply; |
| | | import com.matrix.system.fenxiao.vo.ShopSalesmanAppliingVo; |
| | | import com.matrix.system.fenxiao.vo.ShopSalesmanApplyVo; |
| | | import com.matrix.system.shopXcx.vo.SalesmanCenterInfo; |
| | | import com.matrix.system.shopXcx.vo.SalesmanVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | IPage<ShopSalesmanAppliingVo> selectBizUserApplyList(Page<ShopSalesmanAppliingVo> page, |
| | | @Param("record")ShopSalesmanAppliingDto shopSalesmanAppliingDto); |
| | | |
| | | SalesmanCenterInfo selectSalesmanCenterInfo(String openId); |
| | | } |
| | |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); |
| | | flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品"); |
| | | // 若是退款,则取负数 |
| | | if (SysOrder.ORDER_TYPE_REFUND==sourceOrder.getOrderType()) { |
| | | if (Dictionary.ORDER_STATU_TK.equals(sourceOrder.getStatu())) { |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_REFUND); |
| | | flow.setAmount(flow.getAmount().negate()); |
| | | flow.setOrderId(sourceOrder.getOldOrderId()); |
| | |
| | | |
| | | } |
| | | |
| | | private void addRefundOrderFlow(SysOrder sourceOrder) { |
| | | //处理支付流水 |
| | | 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() + "件产品"); |
| | | // 退款,则取负数 |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_REFUND); |
| | | flow.setAmount(flow.getAmount().negate()); |
| | | flow.setOrderId(sourceOrder.getOldOrderId()); |
| | | |
| | | //统计储值卡支付 |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | if (flow.getCardId() != null) { |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); |
| | | //修改储值卡余额 |
| | | cardPaySk(moneyCardUse, sourceOrder, flow); |
| | | }else{ |
| | | throw new GlobleException("无效的储值卡支付方式"); |
| | | } |
| | | } |
| | | |
| | | flow.setFlowNo(codeService.getFlowCode() + "-" + flowCount); |
| | | flow.setVipId(sourceOrder.getVipId()); |
| | | flow.setShopId(sourceOrder.getShopId()); |
| | | flow.setCompanyId(sourceOrder.getCompanyId()); |
| | | sysOrderFlowDao.insert(flow); |
| | | flowCount++; |
| | | } |
| | | } |
| | | |
| | | private void refundCard(MoneyCardUse moneyCardUse, SysOrder sourceOrder, SysOrderFlow flow) { |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); |
| | | if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { |
| | | if (moneyCardUse.getGiftMoney() >= flow.getAmount().doubleValue()) { |
| | | double surplus = MoneyUtil.sub(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue()); |
| | | moneyCardUse.setGiftMoney(surplus); |
| | | moneyCardUseFlow.setGiftMoney(0D - flow.getAmount().doubleValue()); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | } else { |
| | | if (moneyCardUse.getRealMoney() >= flow.getAmount().doubleValue()) { |
| | | double surplus = MoneyUtil.sub(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue()); |
| | | moneyCardUse.setRealMoney(surplus); |
| | | moneyCardUseFlow.setTotal(0 - flow.getAmount().doubleValue()); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | } |
| | | |
| | | if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_NO_N)) { |
| | | //余额为0时充值卡变为无效 |
| | | if (moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)) { |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); |
| | | } |
| | | } |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId()); |
| | | if (shoppingGoods != null) { |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime()); |
| | | moneyCardUse.setFailTime(invalidTime); |
| | | } |
| | | // 更新充值卡信息 |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | //设置卡项使用流水 |
| | | moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); |
| | | moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo()); |
| | | moneyCardUseFlow.setVipId(sourceOrder.getVipId()); |
| | | moneyCardUseFlow.setTimes(-1); |
| | | moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_CONSUMER); |
| | | moneyCardUseFlow.setCreateTime(new Date()); |
| | | moneyCardUseFlow.setOperationId(user.getSuId()); |
| | | moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney()); |
| | | moneyCardUseFlowDao.insert(moneyCardUseFlow); |
| | | } |
| | | |
| | | /** |
| | | * 退款退项目,套餐,卡项 |
| | | * @param sysOrder |
New file |
| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.biz.dao.BizUserDao; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.BasePageQueryDto; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao; |
| | | import com.matrix.system.fenxiao.service.ShopSalesmanApplyService; |
| | | import com.matrix.system.shopXcx.vo.SalesmanVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author jyy |
| | | * @date 2021-03-10 |
| | | **/ |
| | | @Api(tags = "分销订单接口类") |
| | | @RestController |
| | | @RequestMapping(value = "/wxapi/salesOrder") |
| | | public class WxSalesOrderAction { |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | ShopSalesmanApplyDao salesmanApplyDao; |
| | | |
| | | |
| | | @Autowired |
| | | ShopSalesmanApplyService shopSalesmanApplyService; |
| | | |
| | | @Autowired |
| | | private RedisUserLoginUtils redisUserLoginUtils; |
| | | |
| | | @Autowired |
| | | private BizUserDao bizUserDao; |
| | | |
| | | @Autowired |
| | | private ShopSalesmanOrderDao shopSalesmanOrderDao; |
| | | |
| | | |
| | | @ApiOperation(value = "获取下级列表", notes = "keywords=1 推广订单,keywords=2 邀请订单") |
| | | @PostMapping(value = "/getOrderList") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = SalesmanVo.class) |
| | | }) |
| | | AjaxResult getInvitationuserList(@RequestBody BasePageQueryDto pageDto) { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | Page<SalesmanVo> page=new Page<>(pageDto.getPageNum(),pageDto.getPageSize()); |
| | | IPage<SalesmanVo> shopSalesmanApplyIPage = salesmanApplyDao.selectInvitationuserInPage(page, loginUser.getOpenId(),pageDto.getKeywords()); |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(shopSalesmanApplyIPage.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanApply; |
| | | import com.matrix.system.fenxiao.service.ShopSalesmanApplyService; |
| | | import com.matrix.system.shopXcx.api.WeChatApiTools; |
| | | import com.matrix.system.shopXcx.vo.SalesmanCenterInfo; |
| | | import com.matrix.system.shopXcx.vo.SalesmanVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "查询分销员中心信息", notes = "") |
| | | @PostMapping(value = "/getSalesmanCenterInfo") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = SalesmanCenterInfo.class) |
| | | }) |
| | | AjaxResult getSalesmanCenterInfo() { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | SalesmanCenterInfo salesmanCenterInfo= salesmanApplyDao.selectSalesmanCenterInfo(loginUser.getOpenId()); |
| | | return AjaxResult.buildSuccessInstance(salesmanCenterInfo); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanGrade; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanOrder; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | |
| | | import com.matrix.system.shopXcx.dao.ShopSkuDao; |
| | | import com.rabbitmq.client.DeliverCallback; |
| | | import com.rabbitmq.client.Delivery; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | if(StringUtils.isNotBlank(bizUser.getParentOpenId())){ |
| | | LogUtil.debug("处理分销订单userOpid={}",bizUser.getOpenId()); |
| | | //存在上级 |
| | | ShopSalesmanOrder shopSalesmanOrder=new ShopSalesmanOrder(); |
| | | shopSalesmanOrder.setCompanyId(order.getCompanyId()); |
| | | shopSalesmanOrder.setCreateBy(MatrixConstance.SYSTEM_USER); |
| | | shopSalesmanOrder.setUpdateBy(MatrixConstance.SYSTEM_USER); |
| | | shopSalesmanOrder.setCreateTime(new Date()); |
| | | shopSalesmanOrder.setUpdateTime(new Date()); |
| | | shopSalesmanOrder.setOrderId(Long.parseLong(order.getId()+"")); |
| | | shopSalesmanOrder.setUserId(order.getUserId()); |
| | | shopSalesmanOrder.setSalesUserId(bizUser.getParentOpenId()); |
| | | shopSalesmanOrder.setRevenueType(ShopSalesmanOrder.REVENUE_TYPE_SALES); |
| | | shopSalesmanOrder.setOrderStatus(ShopSalesmanOrder.STATUS_DJS); |
| | | Double amount=0D; |
| | | ShopSalesmanOrder salesmanOrder=new ShopSalesmanOrder(); |
| | | salesmanOrder.setCompanyId(order.getCompanyId()); |
| | | salesmanOrder.setCreateBy(MatrixConstance.SYSTEM_USER); |
| | | salesmanOrder.setUpdateBy(MatrixConstance.SYSTEM_USER); |
| | | salesmanOrder.setCreateTime(new Date()); |
| | | salesmanOrder.setUpdateTime(new Date()); |
| | | salesmanOrder.setOrderId(Long.parseLong(order.getId()+"")); |
| | | salesmanOrder.setUserId(order.getUserId()); |
| | | salesmanOrder.setSalesUserId(bizUser.getParentOpenId()); |
| | | salesmanOrder.setRevenueType(ShopSalesmanOrder.REVENUE_TYPE_SALES); |
| | | salesmanOrder.setOrderStatus(ShopSalesmanOrder.STATUS_DJS); |
| | | Double salesAmount=0D; |
| | | Double invitationAmount=0D; |
| | | Double orderTotal=0D; |
| | | Double zk=1D; |
| | | |
| | | BizUser salesMan=bizUserService.findByOpenId(bizUser.getParentOpenId()); |
| | | BizUser invitationMan=null; |
| | | ShopSalesmanOrder invitationOrder=null; |
| | | boolean hasInvitationMan=StringUtils.isNotBlank(salesMan.getParentOpenId()); |
| | | |
| | | //判断推广员是否还存在上级,存在则计算邀请收益 |
| | | if(hasInvitationMan){ |
| | | invitationMan=bizUserService.findByOpenId(salesMan.getParentOpenId()); |
| | | invitationOrder=new ShopSalesmanOrder(); |
| | | BeanUtils.copyProperties(salesmanOrder,invitationOrder); |
| | | invitationOrder.setSalesUserId(invitationMan.getOpenId()); |
| | | invitationOrder.setRevenueType(ShopSalesmanOrder.REVENUE_TYPE_INVITATION); |
| | | } |
| | | |
| | | //收益计算 |
| | | for (ShopOrderDetails item:order.getDetails() ){ |
| | | if(StringUtils.isNotBlank(item.getShopProduct().getAttrValues()) |
| | | && item.getShopProduct().getAttrValues().contains("分销商城")){ |
| | | if(item.getShopSku().getSealesPrice()==null |
| | | ||item.getShopSku().getSealesPrice().doubleValue()==0){ |
| | | //按分销等级计算 |
| | | BizUser salesMan=bizUserService.findByOpenId(bizUser.getParentOpenId()); |
| | | shopSalesmanGradeDao.selectById(salesMan.getSalesmanGrade()); |
| | | ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectById(salesMan.getSalesmanGrade()); |
| | | salesAmount+=item.getTotalPrice().doubleValue()*(shopSalesmanGrade.getSealesCommission()/100); |
| | | |
| | | if(hasInvitationMan){ |
| | | ShopSalesmanGrade invitationManGrade = shopSalesmanGradeDao.selectById(invitationMan.getSalesmanGrade()); |
| | | invitationAmount+=item.getTotalPrice().doubleValue()*(invitationManGrade.getInvitationCommission()/100); |
| | | } |
| | | |
| | | }else{ |
| | | //按产品设置的金额计算 |
| | | amount+=item.getShopSku().getSealesPrice().doubleValue(); |
| | | //按产品设置的推广金额计算 |
| | | salesAmount+=item.getShopSku().getSealesPrice().doubleValue()*item.getCount(); |
| | | if(hasInvitationMan){ |
| | | invitationAmount+=item.getShopSku().getInvitationPrice().doubleValue()*item.getCount(); |
| | | } |
| | | } |
| | | |
| | | orderTotal+=item.getTotalPrice().doubleValue(); |
| | | } |
| | | } |
| | | //整体的优惠金额折算成折扣,* 佣金 |
| | | zk=order.getOrderMoney().doubleValue()/orderTotal; |
| | | |
| | | salesAmount=salesAmount*zk; |
| | | salesmanOrder.setAmount(salesAmount); |
| | | shopSalesmanOrderDao.insert(salesmanOrder); |
| | | |
| | | |
| | | |
| | | if(hasInvitationMan){ |
| | | invitationAmount=invitationAmount*zk; |
| | | invitationOrder.setAmount(invitationAmount); |
| | | shopSalesmanOrderDao.insert(invitationOrder); |
| | | } |
| | | |
| | | }else{ |
| | | LogUtil.debug("不存在父级userOpid={}",bizUser.getOpenId()); |
New file |
| | |
| | | package com.matrix.system.shopXcx.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SalesOrderVo", description = " 推广订单信息返回类") |
| | | public class SalesOrderVo { |
| | | |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | private Long orderId ; |
| | | |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.shopXcx.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SalesmanCenterInfo", description = " 销售员中心返回参数") |
| | | public class SalesmanCenterInfo { |
| | | |
| | | @ApiModelProperty(value = "累计收益") |
| | | private String totalRevenue; |
| | | |
| | | |
| | | @ApiModelProperty(value = "分销佣金") |
| | | private String salesRevenue; |
| | | |
| | | @ApiModelProperty(value = "邀请奖励") |
| | | private String invitationRevenue; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "待结算收益") |
| | | private String djsRevenue; |
| | | |
| | | |
| | | @ApiModelProperty(value = "可提现金额") |
| | | private String withdrawalCash; |
| | | |
| | | @ApiModelProperty(value = "推广订单数") |
| | | private String orderCount; |
| | | |
| | | |
| | | @ApiModelProperty(value = "客户数") |
| | | private Double customerCount; |
| | | |
| | | @ApiModelProperty(value = "邀请下级数") |
| | | private Double invitationCount; |
| | | |
| | | |
| | | } |
| | |
| | | shop_salesman_order b |
| | | WHERE |
| | | b.user_id = a.open_id |
| | | and order_status=1 |
| | | and order_status=2 |
| | | AND b.sales_user_id = #{openId} |
| | | |
| | | ) AS revenueAmount, |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectSalesmanCenterInfo" resultType="com.matrix.system.shopXcx.vo.SalesmanCenterInfo"> |
| | | select |
| | | IFNULL(withdrawal_cash,0) as withdrawal_cash, |
| | | ( |
| | | SELECT |
| | | IFNULL(sum(IFNULL( b.amount, 0 )),0) |
| | | FROM |
| | | shop_salesman_order b |
| | | WHERE |
| | | b.user_id = a.open_id |
| | | and order_status=2 |
| | | AND b.sales_user_id = #{openId} |
| | | |
| | | ) AS totalRevenue, |
| | | ( |
| | | SELECT |
| | | IFNULL(sum(IFNULL( b.amount, 0 )),0) |
| | | FROM |
| | | shop_salesman_order b |
| | | WHERE |
| | | b.user_id = a.open_id |
| | | and order_status=2 and revenue_type=1 |
| | | AND b.sales_user_id = #{openId} |
| | | |
| | | ) AS salesRevenue, |
| | | ( |
| | | SELECT |
| | | IFNULL(sum(IFNULL( b.amount, 0 )),0) |
| | | FROM |
| | | shop_salesman_order b |
| | | WHERE |
| | | b.user_id = a.open_id |
| | | and order_status=2 and revenue_type=2 |
| | | AND b.sales_user_id = #{openId} |
| | | |
| | | ) AS invitationRevenue, |
| | | IFNULL(withdrawal_cash,0) as withdrawal_cash, |
| | | ( |
| | | SELECT |
| | | IFNULL(sum(IFNULL( b.amount, 0 )),0) |
| | | FROM |
| | | shop_salesman_order b |
| | | WHERE |
| | | b.user_id = a.open_id |
| | | and order_status=1 |
| | | AND b.sales_user_id = #{openId} |
| | | |
| | | ) AS djsRevenue, |
| | | ( SELECT count( * ) FROM shop_salesman_order c WHERE c.user_id = a.open_id AND c.sales_user_id = #{openId} ) AS orderCount, |
| | | (select count(*) from biz_user where parent_open_id=#{openId} and is_sales=1) as invitationCount, |
| | | (select count(*) from biz_user where parent_open_id=#{openId} and is_sales=2) as customerCount |
| | | from biz_user a where |
| | | a.open_id=#{openId} |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | width="50"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="业绩类型" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.achieveType" @change="calculationAchieve" placeholder="请选择业绩类型"> |
| | | <el-option |
| | | v-for="item in achieveTypeList" |
| | | :key="item.value" |
| | | :label="item.value" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="业绩" width="100"> |
| | | <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 |
| | |
| | | cardInfo : "", |
| | | loginUser : "", |
| | | rechargeMoney : 0, |
| | | achieveTypeList : [], |
| | | payMethods: [{ |
| | | value: '现金支付', |
| | | img: '/images/pay/cash.png', |
| | |
| | | } |
| | | }); |
| | | |
| | | //获取登录用户信息 |
| | | |
| | | // 业绩类型 |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/admin/getLoginUser', |
| | | url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX', |
| | | callback: function (data) { |
| | | _this.loginUser = data.mapInfo.user; |
| | | _this.achieveTypeList = data.rows; |
| | | |
| | | _this.achieveList.push({ |
| | | saleId: _this.loginUser.suId, |
| | | achieveMoney: 0, |
| | | commission : 0, |
| | | isShare: false, |
| | | //获取登录用户信息 |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/admin/getLoginUser', |
| | | callback: function (data) { |
| | | _this.loginUser = data.mapInfo.user; |
| | | |
| | | _this.achieveList.push({ |
| | | saleId: _this.loginUser.suId, |
| | | goodsCash: 0, |
| | | achieveType : _this.achieveTypeList[0].value, |
| | | commission : 0, |
| | | isShare: false, |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | methods : { |
| | | //修改充值金额同步修改业绩 |
| | | changeRechargeMoney(){ |
| | | let aMoeny=(this.rechargeMoney/this.achieveList.length).toFixed(2); |
| | | this.achieveList.forEach(item=>{ |
| | | item.achieveMoney=aMoeny; |
| | | item.goodsCash=aMoeny; |
| | | }); |
| | | }, |
| | | submitRecharge() { |
| | |
| | | _this.achieveList.forEach(achieve => { |
| | | let achieveNew = { |
| | | beaultId: achieve.saleId, |
| | | t1: achieve.achieveMoney, |
| | | t3: '现金业绩', |
| | | goodsCash: achieve.goodsCash, |
| | | achieveType: achieve.achieveType, |
| | | projPercentage: achieve.commission, |
| | | }; |
| | | achaeveList.push(achieveNew); |
| | | }) |
| | | _this.cardInfo.bjmoney = _this.rechargeMoney; |
| | | _this.cardInfo.achaeveList = achaeveList; |
| | | let url = basePath + "/admin/moneyCardUse/cz"; |
| | | if (_this.checkAchieveMoney()) { |
| | | let url = basePath + "/admin/moneyCardUse/cz"; |
| | | |
| | | console.log(_this.cardInfo); |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | data: _this.cardInfo, |
| | | url: url, |
| | | callback: function (data) { |
| | | if (_this.printPaper) { |
| | | _this.print(); |
| | | console.log(_this.cardInfo); |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | data: _this.cardInfo, |
| | | url: url, |
| | | callback: function (data) { |
| | | if (_this.printPaper) { |
| | | _this.print(); |
| | | } |
| | | |
| | | if(parent.myGrid) { |
| | | parent.myGrid.serchData(); |
| | | } |
| | | |
| | | if (parent.app) { |
| | | parent.app.vipInfoFn(); |
| | | } |
| | | |
| | | _this.closeFrame(); |
| | | } |
| | | |
| | | if(parent.myGrid) { |
| | | parent.myGrid.serchData(); |
| | | } |
| | | |
| | | if (parent.app) { |
| | | parent.app.vipInfoFn(); |
| | | } |
| | | |
| | | _this.closeFrame(); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | cancelSubmit() { |
| | | this.closeFrame(); |
| | |
| | | row2 = JSON.parse(JSON.stringify(row)); |
| | | row2.isShare = true; |
| | | this.achieveList.push(row2); |
| | | this.calculationAchieve(); |
| | | }, |
| | | calculationAchieve() { |
| | | let _this = this; |
| | | let jsqMap = {}; |
| | | this.achieveList.forEach(achieve=>{ |
| | | key=achieve.achieveType; |
| | | if(!jsqMap[key]) { |
| | | jsqMap[key]=1; |
| | | } else { |
| | | jsqMap[key]++; |
| | | } |
| | | }); |
| | | this.achieveList.forEach(achieve=>{ |
| | | key = achieve.achieveType; |
| | | achieve.goodsCash=(_this.rechargeMoney/jsqMap[key]).toFixed(2); |
| | | }); |
| | | }, |
| | | //删除业绩 |
| | | delAchieve(index, row) { |
| | | this.achieveList.splice(index, 1); |
| | | this.calculationAchieve(); |
| | | }, |
| | | checkAchieveMoney(){ |
| | | console.log("校验业绩是否大于订单收款金额"); |
| | | let _this = this; |
| | | 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; |
| | | if(!jsqMap[key]){ |
| | | jsqMap[key]=parseFloat(achieve.goodsCash); |
| | | }else{ |
| | | jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash); |
| | | } |
| | | if(jsqMap[key]>_this.rechargeMoney) { |
| | | this.$message.error("业绩分配金额大于支付金额"); |
| | | isOk = false; |
| | | return; |
| | | } |
| | | }else{ |
| | | this.$message.error("业绩分配金额请填写数字"); |
| | | isOk=false; |
| | | return; |
| | | } |
| | | }; |
| | | console.log("isOk",isOk); |
| | | return isOk; |
| | | }, |
| | | } |
| | | }); |