积分兑换
This commit is contained in:
parent
758442ff37
commit
b1329a0dcc
@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.commission.entity.StaffCommission;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 员工提成方案信息 业务层
|
||||
*/
|
||||
@ -49,4 +52,5 @@ public interface StaffCommissionService extends IService<StaffCommission> {
|
||||
* @return
|
||||
*/
|
||||
public int updateStaffCommission(StaffCommission commission);
|
||||
|
||||
}
|
||||
|
@ -12,8 +12,13 @@ import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 员工提成方案信息 业务层
|
||||
@ -79,4 +84,6 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
|
||||
int row = baseMapper.updateById(commission);
|
||||
return row;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.dto.IntegralOrdersDTO;
|
||||
import com.fuint.business.integral.entity.IntegralOrders;
|
||||
import com.fuint.business.integral.service.IntegralOrdersService;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersRequest;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersVO;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
@ -14,6 +15,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 存储兑换订单信息(IntegralOrders)表控制层
|
||||
@ -34,15 +36,15 @@ public class IntegralOrdersController extends BaseController {
|
||||
* 分页查询
|
||||
*
|
||||
* @param integralOrders 筛选条件
|
||||
* @param pageNo 分页对象
|
||||
* @param 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("queryByPage")
|
||||
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
public ResponseObject queryByPage(@RequestParam(value = "page",defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("integralOrders") IntegralOrdersDTO integralOrders) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
IPage<IntegralOrdersVO> integralOrdersIPage = this.integralOrdersService.queryByPage(page, integralOrders);
|
||||
Page pages = new Page(page, pageSize);
|
||||
IPage<IntegralOrdersVO> integralOrdersIPage = this.integralOrdersService.queryByPage(pages, integralOrders);
|
||||
return getSuccessResult(integralOrdersIPage);
|
||||
}
|
||||
|
||||
@ -130,8 +132,18 @@ public class IntegralOrdersController extends BaseController {
|
||||
*
|
||||
*/
|
||||
@PostMapping("integralOrdersProcessing")
|
||||
public ResponseObject integralOrdersProcessing(@RequestBody IntegralOrders integralOrders) {
|
||||
return getSuccessResult(this.integralOrdersService.integralOrdersProcessing(integralOrders));
|
||||
public ResponseObject integralOrdersProcessing(@RequestBody IntegralOrdersRequest integralOrdersList) {
|
||||
return getSuccessResult(this.integralOrdersService.integralOrdersProcessing(integralOrdersList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付状态 修改相关关联表
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("checkTheStatusOfYourPaymentByIntegral")
|
||||
public ResponseObject checkTheStatusOfYourPaymentByIntegral(@Param("orderNumber") String orderNumber) {
|
||||
return getSuccessResult(this.integralOrdersService.checkTheStatusOfYourPaymentByIntegral(orderNumber));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.integral.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@ -19,9 +20,14 @@ public class IntegralOrders extends BaseEntity {
|
||||
* 兑换订单id(主键)
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 操作店员
|
||||
*/
|
||||
private Integer staffId;
|
||||
/**
|
||||
* 关联用户id
|
||||
*/
|
||||
// @JsonProperty("userId")
|
||||
private Integer userId;
|
||||
/**
|
||||
* 订单号
|
||||
@ -30,6 +36,7 @@ public class IntegralOrders extends BaseEntity {
|
||||
/**
|
||||
* 关联商品id
|
||||
*/
|
||||
// @JsonProperty("giftId")
|
||||
private Integer giftId;
|
||||
/**
|
||||
* 配送类型
|
||||
@ -42,10 +49,12 @@ public class IntegralOrders extends BaseEntity {
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
// @JsonProperty("amount")
|
||||
private Double amount;
|
||||
/**
|
||||
* 积分
|
||||
*/
|
||||
// @JsonProperty("integral")
|
||||
private Double integral;
|
||||
/**
|
||||
* 加油金
|
||||
@ -54,6 +63,7 @@ public class IntegralOrders extends BaseEntity {
|
||||
/**
|
||||
* 兑换数量
|
||||
*/
|
||||
// @JsonProperty("exchangeQuantity")
|
||||
private Integer exchangeQuantity;
|
||||
/**
|
||||
* 订单状态
|
||||
@ -87,6 +97,10 @@ public class IntegralOrders extends BaseEntity {
|
||||
* 快递号
|
||||
*/
|
||||
private String theTrackingNumber;
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private String paymentType;
|
||||
|
||||
}
|
||||
|
||||
|
@ -93,5 +93,9 @@ public interface IntegralOrdersMapper {
|
||||
*/
|
||||
Map<String, String> statistics(@Param("storeId") Integer storeId);
|
||||
|
||||
List<IntegralOrders> getListByOrderNo(@Param("orderNumber") String orderNumber,@Param("storeId") Integer storeId);
|
||||
|
||||
|
||||
int editPayStatus(@Param("orderNumber") String orderNumber,@Param("payStates") String payStates, @Param("storeId") Integer storeId );
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
|
||||
<result property="staffId" column="staff_id" jdbcType="INTEGER"/>
|
||||
<result property="paymentType" column="payment_type" jdbcType="VARCHAR"/>
|
||||
|
||||
<!-- outher-->
|
||||
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
|
||||
@ -140,6 +142,8 @@
|
||||
and io.update_time = #{integralOrders.updateTime}
|
||||
</if>
|
||||
</where>
|
||||
order by io.create_time desc
|
||||
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
@ -223,15 +227,15 @@
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on, exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time, update_time, create_by, update_by)
|
||||
values (#{userId}, #{orderNumber}, #{giftId}, #{shippingType}, #{paidInfo}, #{amount}, #{integral}, #{comeOn}, #{exchangeQuantity}, #{orderStatus}, #{status}, #{orderType}, #{processingResult}, #{notes}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on, exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time, update_time, create_by, update_by,staff_id)
|
||||
values (#{userId}, #{orderNumber}, #{giftId}, #{shippingType}, #{paidInfo}, #{amount}, #{integral}, #{comeOn}, #{exchangeQuantity}, #{orderStatus}, #{status}, #{orderType}, #{processingResult}, #{notes}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy},#{staffId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on, exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time, update_time, create_by, update_by)
|
||||
insert into integral_orders(user_id, order_number, gift_id, shipping_type, paid_info, amount, integral, come_on, exchange_quantity, order_status, status, order_type, processing_result, notes, store_id, create_time, update_time, create_by, update_by,staff_id,payment_type)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.userId}, #{entity.orderNumber}, #{entity.giftId}, #{entity.shippingType}, #{entity.paidInfo}, #{entity.amount}, #{entity.integral}, #{entity.comeOn}, #{entity.exchangeQuantity}, #{entity.orderStatus}, #{entity.status}, #{entity.orderType}, #{entity.processingResult}, #{entity.notes}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
(#{entity.userId}, #{entity.orderNumber}, #{entity.giftId}, #{entity.shippingType}, #{entity.paidInfo}, #{entity.amount}, #{entity.integral}, #{entity.comeOn}, #{entity.exchangeQuantity}, #{entity.orderStatus}, #{entity.status}, #{entity.orderType}, #{entity.processingResult}, #{entity.notes}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy},#{entity.staffId},#{entity.paymentType})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@ -336,5 +340,18 @@
|
||||
delete from integral_orders where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getListByOrderNo" resultType="com.fuint.business.integral.entity.IntegralOrders">
|
||||
select * from integral_orders where order_number = #{orderNumber} and store_id = #{storeId}
|
||||
</select>
|
||||
|
||||
<update id="editPayStatus">
|
||||
update integral_orders set status = #{payStates} where order_number = #{orderNumber}
|
||||
<if test="storeId != -1">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.integral.dto.IntegralOrdersDTO;
|
||||
import com.fuint.business.integral.entity.IntegralOrders;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersRequest;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersVO;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -41,7 +44,6 @@ public interface IntegralOrdersService {
|
||||
* @return 实例对象
|
||||
*/
|
||||
IntegralOrders insert(IntegralOrders integralOrders);
|
||||
IntegralOrders integralOrdersProcessing(IntegralOrders integralOrders);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
@ -60,4 +62,11 @@ public interface IntegralOrdersService {
|
||||
boolean deleteById(Integer id);
|
||||
Map<String, String> statistics();
|
||||
|
||||
IntegralOrders integralOrdersProcessing(IntegralOrdersRequest integralOrdersList);
|
||||
|
||||
IntegralOrders checkTheStatusOfYourPaymentByIntegral(String orderNO);
|
||||
|
||||
int editPayStatus(String orderNumber, String payStates,Integer storeId);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,24 +1,40 @@
|
||||
package com.fuint.business.integral.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.service.FyPayService;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import com.fuint.business.integral.dto.IntegralOrdersDTO;
|
||||
import com.fuint.business.integral.entity.IntegralDetail;
|
||||
import com.fuint.business.integral.entity.IntegralGift;
|
||||
import com.fuint.business.integral.entity.IntegralOrders;
|
||||
import com.fuint.business.integral.mapper.IntegralOrdersMapper;
|
||||
import com.fuint.business.integral.service.IntegralDetailService;
|
||||
import com.fuint.business.integral.service.IntegralOrdersService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import com.fuint.business.integral.vo.IntegralGiftVO;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersRequest;
|
||||
import com.fuint.business.integral.vo.IntegralOrdersVO;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.mapper.LJUserMapper;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 存储兑换订单信息(IntegralOrders)表服务实现类
|
||||
@ -30,7 +46,16 @@ import java.util.Map;
|
||||
public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
@Resource
|
||||
private IntegralOrdersMapper integralOrdersDao;
|
||||
|
||||
@Autowired
|
||||
private MerchantConfigService merchantConfigService;
|
||||
@Autowired
|
||||
private FyPayService fyPayService;
|
||||
@Resource
|
||||
private LJUserMapper ljUserMapper;
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
@Resource
|
||||
IntegralDetailService integralDetailService;
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
@ -67,10 +92,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
return integralOrders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegralOrders integralOrdersProcessing(IntegralOrders integralOrders) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改数据 receiving_information
|
||||
@ -102,4 +124,154 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
return this.integralOrdersDao.statistics(nowAccountInfo.getStoreId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入订单状态 并进行支付
|
||||
* @param integralOrdersList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public IntegralOrders integralOrdersProcessing(IntegralOrdersRequest integralOrdersList) {
|
||||
|
||||
// 首先判断是否足够积分
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById(integralOrdersList.getIntegralOrdersList().get(0).getUserId());
|
||||
if (ljUserVos.getPoints() < integralOrdersList.getAllPoints()) {
|
||||
integralOrdersList.getIntegralOrdersList().get(0).setStatus("un");
|
||||
return integralOrdersList.getIntegralOrdersList().get(0);
|
||||
}
|
||||
// 插入订单
|
||||
List<IntegralOrders> integralOrdersList1 = integralOrdersList.getIntegralOrdersList();
|
||||
if (integralOrdersList1.size()<0) return null;
|
||||
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
|
||||
String status = "unpaid";
|
||||
// 添加储存充值
|
||||
if ("CASH".equals(integralOrdersList.getPaymentType())) {
|
||||
status = "paid";
|
||||
}else {
|
||||
status = "unpaid";
|
||||
}
|
||||
// 根据日期生成支付编号
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
String orderNo = timestamp+randomString;
|
||||
|
||||
// 生成订单编号
|
||||
for (IntegralOrders integralOrders : integralOrdersList1) {
|
||||
integralOrders.setStoreId(nowAccountInfo.getStoreId());
|
||||
integralOrders.setCreateBy(nowAccountInfo.getStaffId().toString());
|
||||
|
||||
integralOrders.setOrderNumber(orderNo);
|
||||
integralOrders.setStatus(status);
|
||||
}
|
||||
integralOrdersDao.insertBatch(integralOrdersList.getIntegralOrdersList());
|
||||
|
||||
double epsilon = 1e-10; // 阈值
|
||||
boolean flag = false;
|
||||
|
||||
if (!ObjectUtil.isEmpty(integralOrdersList.getAllAmout())
|
||||
&& integralOrdersList.getAllAmout() > epsilon
|
||||
&& "unpaid".equals(status)){
|
||||
flag = true;
|
||||
}
|
||||
if (flag) {
|
||||
// Integer allAmount = (int) (integralOrdersList.getAllAmout()*100);
|
||||
System.out.println("金额"+(int) (integralOrdersList.getAllAmout()*100));
|
||||
Integer allAmount = (int) (0.01*100);
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
|
||||
// 处理支付需要的数据
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("authCode",integralOrdersList.getAuthCode());
|
||||
map.put("allAmount",allAmount.toString());
|
||||
map.put("orderNo",orderNo);
|
||||
map.put("payType",integralOrdersList.getPaymentType());
|
||||
map.put("insCd",merchantConfig.getInsCd());
|
||||
map.put("mchntCd",merchantConfig.getMchntCd());
|
||||
map.put("goodsDes",merchantConfig.getMerchantName());
|
||||
map.put("publicKey",merchantConfig.getPublicKey());
|
||||
map.put("privateKey",merchantConfig.getPrivateKey());
|
||||
map.put("type","IOS");
|
||||
map.put("storeId",nowAccountInfo.getStoreId().toString());
|
||||
// 调用支付接口
|
||||
try {
|
||||
fyPayService.pay(map);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return integralOrdersList1.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态并添加记录
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IntegralOrders checkTheStatusOfYourPaymentByIntegral(String orderNo) {
|
||||
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
// 查询订单信息
|
||||
List<IntegralOrders> listByOrderNo = integralOrdersDao.getListByOrderNo(orderNo, nowAccountInfo.getStoreId());
|
||||
if ("paid".equals(listByOrderNo.get(0).getStatus())){
|
||||
BigDecimal totalPoints = new BigDecimal(0);
|
||||
|
||||
for (IntegralOrders integralOrders : listByOrderNo) {
|
||||
totalPoints = totalPoints.add(new BigDecimal(integralOrders.getIntegral()));
|
||||
}
|
||||
// 查询用户信息
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById(listByOrderNo.get(0).getUserId());
|
||||
|
||||
// 用户积分余额变动
|
||||
if (totalPoints.doubleValue()>0) {
|
||||
UserBalance userBalance = balanceCalculation(ljUserVos,totalPoints.doubleValue());
|
||||
userBalanceService.updateUserBalance(userBalance);
|
||||
}
|
||||
// 积分表变动
|
||||
if (totalPoints.doubleValue()>0) {
|
||||
IntegralDetail integralDetail = changesInPoints(totalPoints.doubleValue(),ljUserVos);
|
||||
integralDetailService.insert(integralDetail);
|
||||
}
|
||||
}
|
||||
return listByOrderNo.get(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//用户余额表计算
|
||||
private UserBalance balanceCalculation(LJUserVo ljUserVos,Double totalPoints) {
|
||||
if (ObjectUtil.isEmpty(ljUserVos.getPoints())) ljUserVos.setPoints(0);
|
||||
// 减去积分
|
||||
BigDecimal bigPoints = new BigDecimal(ljUserVos.getPoints());
|
||||
BigDecimal addPoints = bigPoints.subtract(new BigDecimal(totalPoints));
|
||||
|
||||
UserBalance userBalance = new UserBalance();
|
||||
userBalance.setId(ljUserVos.getBalanceId());
|
||||
userBalance.setPoints(addPoints.intValue());
|
||||
|
||||
return userBalance;
|
||||
}
|
||||
// 积分变动
|
||||
private IntegralDetail changesInPoints(Double totalPoints,LJUserVo ljUserVos) {
|
||||
IntegralDetail integralDetail = new IntegralDetail();
|
||||
integralDetail.setUserId(ljUserVos.getId());
|
||||
integralDetail.setPointsChange(-totalPoints.intValue());
|
||||
// 计算积分
|
||||
BigDecimal bigPoints = new BigDecimal(ljUserVos.getPoints());
|
||||
BigDecimal addPoints = bigPoints.subtract(new BigDecimal(totalPoints));
|
||||
integralDetail.setChangeType("0");
|
||||
integralDetail.setCurrentPoints(addPoints.intValue());
|
||||
integralDetail.setChangeReason("收银台积分商城兑换");
|
||||
return integralDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int editPayStatus(String orderNumber, String payStates, Integer storeId) {
|
||||
|
||||
return integralOrdersDao.editPayStatus(orderNumber,payStates,storeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.fuint.business.integral.vo;
|
||||
|
||||
import com.fuint.business.integral.entity.IntegralOrders;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class IntegralOrdersRequest {
|
||||
|
||||
private List<IntegralOrders> integralOrdersList;
|
||||
private String authCode;
|
||||
private String paymentType;
|
||||
/**
|
||||
* 总价格
|
||||
*/
|
||||
private Double allAmout;
|
||||
|
||||
/**
|
||||
* 总积分
|
||||
*/
|
||||
private Double allPoints;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
|
||||
|
||||
}
|
@ -242,6 +242,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
// 计算积分
|
||||
BigDecimal bigPoints = new BigDecimal(cardValueRecordDTO.getPoints());
|
||||
BigDecimal addPoints = bigPoints.add(new BigDecimal(ljUserVos.getPoints()));
|
||||
integralDetail.setChangeType("1");
|
||||
|
||||
integralDetail.setCurrentPoints(addPoints.intValue());
|
||||
integralDetail.setChangeReason("余额充值赠送");
|
||||
|
@ -0,0 +1,103 @@
|
||||
package com.fuint.business.order.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.entity.HandoverRecord;
|
||||
import com.fuint.business.order.service.HandoverRecordService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 交班记录表(HandoverRecord)表控制层
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-16 17:54:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/handoverRecord")
|
||||
public class HandoverRecordController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private HandoverRecordService handoverRecordService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param handoverRecord 筛选条件
|
||||
* @param pageNo 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("queryByPage")
|
||||
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("handoverRecord") HandoverRecord handoverRecord) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
IPage< HandoverRecord> iPageList = this.handoverRecordService.queryByPage(page, handoverRecord);
|
||||
return getSuccessResult(iPageList);
|
||||
}
|
||||
|
||||
@GetMapping("selectByTime")
|
||||
public ResponseObject selectByTime() {
|
||||
return getSuccessResult(this.handoverRecordService.selectByTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject queryById(@PathVariable("id") Integer id) {
|
||||
return getSuccessResult(this.handoverRecordService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param handoverRecord 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(@RequestBody HandoverRecord handoverRecord) {
|
||||
return getSuccessResult(this.handoverRecordService.insert(handoverRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param handoverRecord 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject edit(@RequestBody HandoverRecord handoverRecord) {
|
||||
return getSuccessResult(this.handoverRecordService.update(handoverRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject deleteById(Integer id) {
|
||||
return getSuccessResult(this.handoverRecordService.deleteById(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("handover")
|
||||
public ResponseObject handover() {
|
||||
return getSuccessResult(handoverRecordService.handover());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
package com.fuint.business.order.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 交班记录表(HandoverRecord)实体类
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-16 17:54:52
|
||||
*/
|
||||
@Data
|
||||
public class HandoverRecord extends BaseEntity {
|
||||
private static final long serialVersionUID = -94767649484308223L;
|
||||
/**
|
||||
* 交班记录ID
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 交班员工ID
|
||||
*/
|
||||
private Integer staffId;
|
||||
/**
|
||||
* 交班数据记录
|
||||
*/
|
||||
private String recordData;
|
||||
/**
|
||||
* 交班开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
/**
|
||||
* 交班结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
|
||||
private Integer storeId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,87 @@
|
||||
package com.fuint.business.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.entity.HandoverRecord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交班记录表(HandoverRecord)表数据库访问层
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-16 17:54:52
|
||||
*/
|
||||
public interface HandoverRecordMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
HandoverRecord queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param handoverRecord 查询条件
|
||||
* @param page 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
IPage<HandoverRecord> queryAllByLimit(@Param("page") Page page, HandoverRecord handoverRecord);
|
||||
|
||||
HandoverRecord selectByTime(HandoverRecord handoverRecord);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param handoverRecord 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(HandoverRecord handoverRecord);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param handoverRecord 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(HandoverRecord handoverRecord);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<HandoverRecord> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<HandoverRecord> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<HandoverRecord> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<HandoverRecord> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param handoverRecord 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(HandoverRecord handoverRecord);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.fuint.business.order.vo.OilOrderVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 油品订单表 Mapper层
|
||||
@ -27,4 +28,7 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
|
||||
* @return
|
||||
*/
|
||||
public List<OilOrderVo> selectOilOrderByOrderNo(@Param("orderNo") String orderNo);
|
||||
|
||||
public Map<String, String> orderAmountStatistics(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("storeId") Integer storeId);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,215 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.business.order.mapper.HandoverRecordMapper">
|
||||
|
||||
<resultMap type="com.fuint.business.order.entity.HandoverRecord" id="HandoverRecordMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="staffId" column="staff_id" jdbcType="INTEGER"/>
|
||||
<result property="recordData" column="record_data" jdbcType="VARCHAR"/>
|
||||
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="HandoverRecordMap">
|
||||
select
|
||||
id, staff_id, record_data, start_time, end_time, store_id, create_time, update_time, create_by, update_by
|
||||
from handover_record
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="HandoverRecordMap">
|
||||
select
|
||||
id, staff_id, record_data, start_time, end_time, store_id, create_time, update_time, create_by, update_by
|
||||
from handover_record
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="staffId != null">
|
||||
and staff_id = #{staffId}
|
||||
</if>
|
||||
<if test="recordData != null and recordData != ''">
|
||||
and record_data = #{recordData}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and start_time = #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and end_time = #{endTime}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByTime" resultMap="HandoverRecordMap">
|
||||
select
|
||||
id, staff_id, record_data, start_time, end_time, store_id, create_time, update_time, create_by, update_by
|
||||
from handover_record
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="staffId != null">
|
||||
and staff_id = #{staffId}
|
||||
</if>
|
||||
<if test="recordData != null and recordData != ''">
|
||||
and record_data = #{recordData}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and start_time = #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and end_time = #{endTime}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
limit 1
|
||||
</select>
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from handover_record
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="staffId != null">
|
||||
and staff_id = #{staffId}
|
||||
</if>
|
||||
<if test="recordData != null and recordData != ''">
|
||||
and record_data = #{recordData}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and start_time = #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and end_time = #{endTime}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into handover_record(staff_id, record_data, start_time, end_time, store_id, create_time, update_time, create_by, update_by)
|
||||
values (#{staffId}, #{recordData}, #{startTime}, #{endTime}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into handover_record(staff_id, record_data, start_time, end_time, store_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.staffId}, #{entity.recordData}, #{entity.startTime}, #{entity.endTime}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into handover_record(staff_id, record_data, start_time, end_time, store_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.staffId}, #{entity.recordData}, #{entity.startTime}, #{entity.endTime}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
staff_id = values(staff_id),
|
||||
record_data = values(record_data),
|
||||
start_time = values(start_time),
|
||||
end_time = values(end_time),
|
||||
store_id = values(store_id),
|
||||
create_time = values(create_time),
|
||||
update_time = values(update_time),
|
||||
create_by = values(create_by),
|
||||
update_by = values(update_by)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update handover_record
|
||||
<set>
|
||||
<if test="staffId != null">
|
||||
staff_id = #{staffId},
|
||||
</if>
|
||||
<if test="recordData != null and recordData != ''">
|
||||
record_data = #{recordData},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time = #{startTime},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time = #{endTime},
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
store_id = #{storeId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from handover_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
@ -47,4 +47,15 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="orderAmountStatistics" resultType="java.util.Map">
|
||||
select
|
||||
sum(order_amount),
|
||||
sum(discount_amount),
|
||||
sum(pay_amount),
|
||||
-- sum(if(order_status='0',money,0))
|
||||
from oil_order
|
||||
where store_id = #{storeId}
|
||||
and create_time BETWEEN #{startTime} AND #{endTime};
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,65 @@
|
||||
package com.fuint.business.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.entity.HandoverRecord;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 交班记录表(HandoverRecord)表服务接口
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-16 17:54:52
|
||||
*/
|
||||
public interface HandoverRecordService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
HandoverRecord queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param handoverRecord 筛选条件
|
||||
* @param page 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
IPage<HandoverRecord> queryByPage(@Param("page") Page page, HandoverRecord handoverRecord);
|
||||
|
||||
HandoverRecord selectByTime();
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param handoverRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
HandoverRecord insert(HandoverRecord handoverRecord);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param handoverRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
HandoverRecord update(HandoverRecord handoverRecord);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
public Map<String, Map<String,String>> handover();
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
package com.fuint.business.order.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.entity.HandoverRecord;
|
||||
import com.fuint.business.order.mapper.HandoverRecordMapper;
|
||||
import com.fuint.business.order.service.HandoverRecordService;
|
||||
import com.fuint.business.store.entity.MtStore;
|
||||
import com.fuint.business.store.mapper.MtStoreMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.crypto.Data;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 交班记录表(HandoverRecord)表服务实现类
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2023-11-16 17:54:52
|
||||
*/
|
||||
@Service("handoverRecordService")
|
||||
public class HandoverRecordServiceImpl implements HandoverRecordService {
|
||||
@Resource
|
||||
private HandoverRecordMapper handoverRecordMapper;
|
||||
@Resource
|
||||
private MtStoreMapper mtStoreMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public HandoverRecord queryById(Integer id) {
|
||||
return this.handoverRecordMapper.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param handoverRecord 筛选条件
|
||||
* @param page 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<HandoverRecord> queryByPage(@Param("page") Page page, HandoverRecord handoverRecord) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
handoverRecord.setStoreId(nowAccountInfo.getStoreId());
|
||||
return this.handoverRecordMapper.queryAllByLimit(page, handoverRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandoverRecord selectByTime() {
|
||||
HandoverRecord handoverRecord = new HandoverRecord();
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
handoverRecord.setStoreId(nowAccountInfo.getStoreId());
|
||||
return handoverRecordMapper.selectByTime(handoverRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param handoverRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public HandoverRecord insert(HandoverRecord handoverRecord) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
handoverRecord.setStoreId(nowAccountInfo.getStoreId());
|
||||
this.handoverRecordMapper.insert(handoverRecord);
|
||||
return handoverRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param handoverRecord 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public HandoverRecord update(HandoverRecord handoverRecord) {
|
||||
this.handoverRecordMapper.update(handoverRecord);
|
||||
return this.queryById(handoverRecord.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.handoverRecordMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Map<String,String>> handover() {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
MtStore mtStore = mtStoreMapper.queryStoreById(nowAccountInfo.getStoreId());
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 获取当前日期的零点时间
|
||||
LocalDateTime midnight = today.atStartOfDay();
|
||||
// 格式化当前时间
|
||||
String formattedEndTime = LocalDateTime.now().format(formatter);
|
||||
|
||||
Map<String, Map<String,String>> handoverMap = new HashMap<>();
|
||||
|
||||
String startTime = midnight.format(formatter);
|
||||
HandoverRecord handoverRecord = selectByTime();
|
||||
if (!ObjectUtil.isEmpty(handoverRecord) && !ObjectUtil.isEmpty(handoverRecord.getEndTime())) {
|
||||
startTime = handoverRecord.getEndTime().toString();
|
||||
}
|
||||
|
||||
|
||||
// 填充 baseInfo
|
||||
Map<String, String> baseInfo = new HashMap<>();
|
||||
baseInfo.put("storeName", mtStore.getName());
|
||||
baseInfo.put("realName", nowAccountInfo.getRealName());
|
||||
baseInfo.put("handoverType", "门店统一交班");
|
||||
baseInfo.put("startTime", startTime);
|
||||
baseInfo.put("endTime", formattedEndTime);
|
||||
handoverMap.put("baseInfo",baseInfo);
|
||||
// 获取订单汇总
|
||||
Map<String, String> orderSummaryMap = orderSummary(startTime, formattedEndTime);
|
||||
// 退款汇总
|
||||
// 实收汇总
|
||||
// 油品订单
|
||||
// 商品订单
|
||||
// 普通订单
|
||||
// 会员储值
|
||||
// 油号统计
|
||||
// 优惠统计
|
||||
// 油枪统计
|
||||
// 员工统计
|
||||
// 合计
|
||||
return handoverMap;
|
||||
}
|
||||
public Map<String, String> orderSummary(String startTime, String endTime) {
|
||||
|
||||
// 油品订单(订单)
|
||||
// 油品订单(退款)
|
||||
// 油品订单(实收)
|
||||
// 油品优惠(实收)
|
||||
// 油品交易(实收)
|
||||
|
||||
|
||||
// 会员储值(订单)
|
||||
// 会员储值(退款)
|
||||
// 会员储值(实收)
|
||||
// 储值赠送(订单)
|
||||
// 储值赠送(退款)
|
||||
// 储值赠送(实际)
|
||||
// 普通收款(订单)
|
||||
// 普通收款(退款)
|
||||
// 普通收款(实收)
|
||||
return null;
|
||||
}
|
||||
}
|
@ -17,6 +17,8 @@ public interface MtStoreMapper extends BaseMapper<MtStore> {
|
||||
|
||||
MtStore queryStoreByName(@Param("name") String name);
|
||||
|
||||
MtStore queryStoreById(@Param("id") Integer id);
|
||||
|
||||
|
||||
List<MtStore> findStoresByIds(@Param("ids") List<Integer> ids);
|
||||
|
||||
|
@ -5,6 +5,10 @@
|
||||
select * from mt_store t where t.name = #{name}
|
||||
</select>
|
||||
|
||||
<select id="queryStoreById" resultType="com.fuint.business.store.entity.MtStore">
|
||||
select * from mt_store t where t.id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findStoresByIds" resultType="com.fuint.business.store.entity.MtStore">
|
||||
select * from mt_store where id in
|
||||
|
Binary file not shown.
9
fuintCashierWeb/src/api/cashier/handover.js
Normal file
9
fuintCashierWeb/src/api/cashier/handover.js
Normal file
@ -0,0 +1,9 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getHandoverApi() {
|
||||
return request({
|
||||
url: '/business/handoverRecord/handover',
|
||||
method: 'get',
|
||||
// params: query
|
||||
})
|
||||
}
|
@ -15,3 +15,22 @@ export function getGiftCategoryApi(data) {
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 支付相关
|
||||
// 支付
|
||||
export function getIntegralOrdersProcessingApi(query) {
|
||||
return request({
|
||||
url: 'business/integral/integralOrders/integralOrdersProcessing',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
// 更改记录
|
||||
export function getCheckTheStatusOfYourPaymentByIntegralApi(query) {
|
||||
return request({
|
||||
url: 'business/integral/integralOrders/checkTheStatusOfYourPaymentByIntegral',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
40
fuintCashierWeb/src/api/cashier/integralOrder/order.js
Normal file
40
fuintCashierWeb/src/api/cashier/integralOrder/order.js
Normal file
@ -0,0 +1,40 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 查询列表
|
||||
export function getOrderApi(data) {
|
||||
return request({
|
||||
url: 'business/integral/integralOrders/queryByPage',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 新增有关信息
|
||||
export function insertOrderApi(data) {
|
||||
return request({
|
||||
url: 'business/integral/integralOrders',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 修改有关信息
|
||||
export function updateOrderApi(data) {
|
||||
return request({
|
||||
url: 'business/integral/integralOrders',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function getStatisticsApi(data) {
|
||||
return request({
|
||||
url: 'business/integral/integralOrders/statistics',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
<div class="box-ge">
|
||||
<div class="input-box">
|
||||
<div>油站名称:</div>
|
||||
<div>蓝鲸加油站</div>
|
||||
<div>{{ handoverList.baseInfo.storeName }}</div>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<div>收银员:</div>
|
||||
<div>陈某人</div>
|
||||
<div>{{ handoverList.baseInfo.realName }}</div>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<div>交班方式:</div>
|
||||
@ -18,11 +18,11 @@
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<div>开始时间:</div>
|
||||
<div>2023-10-24 15:41:47</div>
|
||||
<div>{{ handoverList.baseInfo.startTime }}</div>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<div>结束时间:</div>
|
||||
<div>2023-10-24 15:41:47</div>
|
||||
<div>{{ handoverList.baseInfo.endTime }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-ge">
|
||||
@ -53,10 +53,10 @@
|
||||
<div>油品优惠(实收)</div>
|
||||
<div>¥2164.55</div>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<div>抹零总额(实收)</div>
|
||||
<div>¥2164.55</div>
|
||||
</div>
|
||||
<!-- <div class="input-box">-->
|
||||
<!-- <div>抹零总额(实收)</div>-->
|
||||
<!-- <div>¥2164.55</div>-->
|
||||
<!-- </div>-->
|
||||
<div class="input-box">
|
||||
<div>油品交易(实收)</div>
|
||||
<div>¥2164.55</div>
|
||||
@ -327,9 +327,26 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getHandoverApi} from "@/api/cashier/handover";
|
||||
|
||||
export default {
|
||||
name: "Handover",
|
||||
|
||||
data() {
|
||||
return {
|
||||
handoverList : '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getHandover();
|
||||
},
|
||||
methods: {
|
||||
getHandover() {
|
||||
getHandoverApi().then(res=>{
|
||||
this.handoverList = res.data;
|
||||
console.log("this.handoverList",this.handoverList)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
@ -4,132 +4,461 @@
|
||||
<div class="center-left">
|
||||
<div class="center-vh">
|
||||
<div class="center-left-top">
|
||||
<div class="vip-bottom" >
|
||||
<div class="vip-bottom" v-if="isMember == false" @click="dialogVisiblevip = true">
|
||||
<div>会员登录</div>
|
||||
</div>
|
||||
<div v-else style="width: 96%;margin: 0 auto;display: flex;justify-content: space-between">
|
||||
<div
|
||||
style="display: flex;color: white;justify-content: space-around;width: 55%;
|
||||
height: 90%;border-radius: 10px;
|
||||
padding-top: 10px;
|
||||
background-color: rgb(67,119,204)">
|
||||
<div>
|
||||
<template>
|
||||
<img v-if="member.avatar" class="list-avatar" :src="member.avatar">
|
||||
<img v-else class="list-avatar" src="@/assets/images/avatar.png">
|
||||
</template>
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
<span style="margin-bottom: 10px">{{ member.name }}</span><br/>
|
||||
<span>{{ member.mobile }}</span>
|
||||
</div>
|
||||
<div style="background-color: rgba(46,82,142,0.65);width: 50px;height: 45px;padding-top: 5px;
|
||||
border-radius: 5px;text-align: center">
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
<p>会员储值账户余额:{{ member.cardBalance }}</p>
|
||||
<p>积分余额:{{ member.points }}</p>
|
||||
</div>
|
||||
<i class="el-icon-bank-card" style="font-size: 35px"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div style="background-color: rgba(46,82,142,0.65);width: 50px;height: 45px;padding-top: 5px;
|
||||
border-radius: 5px;text-align: center">
|
||||
<el-tooltip placement="top">
|
||||
<div slot="content">
|
||||
会员等级:{{ getGrade(member.gradeId) }}
|
||||
</div>
|
||||
<i class="el-icon-medal" style="font-size: 35px"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vip-bottom" style="height: 40px;margin-top: 10px" @click="resetMember">
|
||||
<div>重置会员</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- <div class="center-left-hj">-->
|
||||
<!-- <div class="hj-box" style="justify-content: left">油品:¥200.00</div>-->
|
||||
<!-- <div class="hj-box" style="border-left: 1px solid #d1d1d4; border-right: 1px solid #d1d1d4;">商品:¥0.52</div>-->
|
||||
<!-- </div>-->
|
||||
<div class="center-left-hj">
|
||||
<div class="hj-box" style="justify-content: left">油品:¥200.00</div>
|
||||
<div class="hj-box" style="border-left: 1px solid #d1d1d4; border-right: 1px solid #d1d1d4;">商品:¥0.52</div>
|
||||
<div class="hj-box" style="justify-content: flex-end">合计: ¥200.52</div>
|
||||
</div>
|
||||
<div class="center-left-hj">
|
||||
<div>满减活动</div>
|
||||
<div>-¥2.87</div>
|
||||
<div>使用积分</div>
|
||||
<div>-{{allPoints}}</div>
|
||||
</div>
|
||||
<!-- <div class="center-left-hj" v-show="isMember">-->
|
||||
<!-- <div>-->
|
||||
<!-- 储值卡-->
|
||||
<!-- <span>(账户余额:{{ balance }}元)</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div>-¥{{ allAmout }}</div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="center-left-hj" v-show="isMember">
|
||||
<div>
|
||||
积分余额
|
||||
<span>(账户余额:{{ member.points }}积分)</span>
|
||||
<span v-if="!isTheBalanceIsSufficient" style="color: red">积分余额不足</span>
|
||||
</div>
|
||||
<div>-{{ allPoints }}</div>
|
||||
</div>
|
||||
<div class="center-left-th">
|
||||
<div class="th-box">
|
||||
<div>扫码支付</div>
|
||||
<div class="bule">394.7</div>
|
||||
<div class="bule">{{allPoints}}</div>
|
||||
</div>
|
||||
<!-- <div class="th-box">-->
|
||||
<!-- <div>找零</div>-->
|
||||
<!-- <div class="bule">394.7</div>-->
|
||||
<!-- </div>-->
|
||||
<div class="th-box">
|
||||
<div>找零</div>
|
||||
<div class="bule">394.7</div>
|
||||
</div>
|
||||
<div class="th-box">
|
||||
<div>加油员</div>
|
||||
<div style="cursor: pointer;color: crimson" >加油员名称</div>
|
||||
<div @click="dialogVisible = true">加油员</div>
|
||||
<div style="cursor: pointer;color: crimson" @click="dialogVisible = true" >{{ staff.realName }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-posi">
|
||||
<div class="center-left-wrap">
|
||||
<div class="wrap-box" v-for="(item,index) in 3" :key="index">
|
||||
|
||||
<span>支付方式</span>
|
||||
<div class="wrap-box" v-for="item in payList"
|
||||
:key="item.dictValue"
|
||||
:value="item.dictValue">
|
||||
<span @click="payMethod(item.dictValue)">{{ item.dictLabel }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="center-left-bottom">
|
||||
<div>
|
||||
<div class="bottom-price">¥349.78</div>
|
||||
<div class="price-red">优惠合计:5.74元</div>
|
||||
<div class="bottom-price">¥{{allAmout}}</div>
|
||||
<div class="price-red">积分合计:{{allPoints}}</div>
|
||||
</div>
|
||||
<div class="center-left-lv" >请先登录会员</div>
|
||||
<div v-if="!isMember" style="background-color: #ffa6a6;" class="center-left-lv" >请先登录会员</div>
|
||||
<div v-if="isMember && !isTheBalanceIsSufficient" style="background-color: #a9fcce;" class="center-left-lv" >余额不足</div>
|
||||
<div v-if="isMember && isTheBalanceIsSufficient" class="center-left-lv" @click="settlement">立即结算</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="center-right">
|
||||
<div class="center-right"
|
||||
>
|
||||
<div class="center-right-top">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane v-for="(item,index) in giftCategoryList" :label="item.categoryName" :name='index'></el-tab-pane>
|
||||
|
||||
<!-- <el-tab-pane label="全部" name="first"></el-tab-pane>-->
|
||||
<!-- <el-tab-pane label="车用品" name="second"></el-tab-pane>-->
|
||||
<!-- <el-tab-pane label="优惠卡券" name="third"></el-tab-pane>-->
|
||||
<!-- <el-tab-pane label="食品酒饮" name="fourth"></el-tab-pane>-->
|
||||
<!-- <el-tab-pane label="数码家电" name="fourthf"></el-tab-pane>-->
|
||||
<!-- <el-tab-pane label="其它礼品" name="fourthp"></el-tab-pane>-->
|
||||
<el-tabs v-model="queryParams.categoryId" @tab-click="handleClick">
|
||||
<el-tab-pane label="全部" name='first'></el-tab-pane>
|
||||
<el-tab-pane v-for="(item,index) in giftCategoryList" :label="item.categoryName" :name='item.id.toString()'></el-tab-pane>
|
||||
</el-tabs>
|
||||
<div style="width: 200px; ">
|
||||
<el-input v-model="input" placeholder="请输入内容"></el-input>
|
||||
<el-input v-model="queryParams.giftName" @input="getGift()" placeholder="请输入内容"></el-input>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wrap-right">
|
||||
<div class="ts-box">
|
||||
<div class="wrap-right-box" v-for="(item,index) in giftList" :key="item.id">
|
||||
<el-card shadow="hover">
|
||||
<div class="wrap-right-box" v-for="(item,index) in giftList" :key="item.id" @click="addGift(item)">
|
||||
<el-card shadow="hover" >
|
||||
<el-badge :hidden="!item.markPurchases>0" :value="item.markPurchases" class="item">
|
||||
<div class="box-six">
|
||||
<img :src="imagePath+item.coverImage" >
|
||||
</div>
|
||||
<div class="box-four">
|
||||
<div class="title-red">{{item.exchangePoints}}积分</div>
|
||||
<div class="title-hui">库存:不限</div>
|
||||
<div class="title-red" >
|
||||
<span v-if="item.exchangeMethod == '积分' || item.exchangeMethod == '积分+金额' || item.exchangeMethod == '积分+加钱购'">{{item.exchangePoints}}积分</span>
|
||||
<span v-if="item.exchangeMethod == '积分+金额'">+</span>
|
||||
<span v-if="item.exchangeMethod == '金额' || item.exchangeMethod == '积分+金额'">¥{{item.exchangeAmount}}</span>
|
||||
<!-- <span v-if="item.exchangeMethod == '积分+加钱购'">+{{item.moneyRatio}}加钱比例</span>-->
|
||||
</div>
|
||||
<div class="title-hui">
|
||||
<span>库存:{{item.remainingInventory === -1?"不限":item.remainingInventory}}</span>
|
||||
</div>
|
||||
<div class="title-goods">
|
||||
<el-tag type="danger" size="mini" effect="dark">加钱购</el-tag>
|
||||
<el-tag type="danger" size="mini" effect="dark">{{item.exchangeMethod}}</el-tag>
|
||||
<span style="margin-left: 5px">{{item.giftName}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</el-badge>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrap-right-bottom">
|
||||
<div class="chongzhi" > <i class="el-icon-refresh"></i> 重置</div>
|
||||
<div class="chongzhi" @click="reset()"> <i class="el-icon-refresh"></i> 重置</div>
|
||||
<div style="display: flex;align-items: center">
|
||||
<div class="ddjil">订单记录</div>
|
||||
<div class="gwuc"> <i class="el-icon-shopping-cart-2"></i> <span style="margin-left: 5px">购物车</span></div>
|
||||
<div class="ddjil" @click="orderHistoryMethod">订单记录</div>
|
||||
<div class="gwuc" @click="shoppingCartMethod()">
|
||||
<el-badge :hidden="markPurchasesAll<1" :value="markPurchasesAll" class="item">
|
||||
<i class="el-icon-shopping-cart-2"></i> <span style="margin-left: 5px">购物车</span>
|
||||
</el-badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- 会员登录-->
|
||||
<el-dialog
|
||||
title="会员信息"
|
||||
:visible.sync="dialogVisiblevip"
|
||||
width="30%"
|
||||
:close-on-click-modal="false">
|
||||
<div >
|
||||
<el-input placeholder="会员手机号、用户昵称" v-model="userNo"
|
||||
clearable
|
||||
@keyup.enter.native="getUser"
|
||||
class="input-with-select" style="text-align: center;">
|
||||
<el-select v-model="select1" slot="prepend" placeholder="请选择" style="width: 120px">
|
||||
<el-option label="会员手机号" value="会员手机号"></el-option>
|
||||
<el-option label="用户昵称" value="用户昵称"></el-option>
|
||||
</el-select>
|
||||
<el-button slot="append" @click="getUser">查询</el-button>
|
||||
</el-input>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-descriptions title="会员信息" :column="2">
|
||||
<el-descriptions-item label="手机号">{{member.mobile ? member.mobile : "--"}}</el-descriptions-item>
|
||||
<el-descriptions-item label="会员昵称">{{member.name ? member.name : "--"}}</el-descriptions-item>
|
||||
<el-descriptions-item label="积分">{{member.points ? member.points : "--"}}</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="加油金余额">0</el-descriptions-item>-->
|
||||
<el-descriptions-item label="车牌号">{{member.carNo ? member.carNo : "--"}}</el-descriptions-item>
|
||||
<el-descriptions-item label="会员备注">{{member.remark ? member.remark : "--"}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions title="会员等级">
|
||||
<el-descriptions-item label="等级名称">{{member.gradeId ? member.gradeId : "--"}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions title="储值余额">
|
||||
<template slot="extra">
|
||||
<span style="color: red;margin-right: 20px">余额充值</span>
|
||||
<span style="font-weight: bold">¥{{member.cardBalance ? member.cardBalance : "--"}}</span>
|
||||
</template>
|
||||
<el-descriptions-item v-if="member.cardBalance!=0" label="账户余额">{{member.cardBalance ? member.cardBalance : "--"}}元</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisiblevip = false">取 消</el-button>
|
||||
<el-button type="primary" @click="chooseUser(member.mobile,member.id)">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 模糊查询会员列表信息-->
|
||||
<el-dialog
|
||||
title="请选择会员"
|
||||
:visible.sync="dialogVisibleMember"
|
||||
:close-on-click-modal="false">
|
||||
<div class="wrap-wrap">
|
||||
<el-table ref="tables" :data="memberList">
|
||||
<el-table-column label="ID" align="center" prop="id" width="80" />
|
||||
<el-table-column label="头像" align="center" width="70">
|
||||
<template slot-scope="scope">
|
||||
<img v-if="scope.row.avatar" class="list-avatar" :src="scope.row.avatar">
|
||||
<img v-else class="list-avatar" src="@/assets/images/avatar.png">
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="姓名" align="center" prop="name" />
|
||||
<el-table-column label="手机号" align="center" prop="mobile"/>
|
||||
<el-table-column label="注册时间" align="center" prop="createTime">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="primary" round
|
||||
@click="handleChoose(scope.row)"
|
||||
>选择</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 加油员姓名-->
|
||||
<el-dialog
|
||||
title="选择加油员"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
:close-on-click-modal="false">
|
||||
<div class="wrap-wrap">
|
||||
<div class="of-box" v-for="(item,index) in staffList" :key="index"
|
||||
@click="chooseStaff(item),dialogVisible = false"
|
||||
:style="{'background-color': item.color}">
|
||||
<div class="of-title">{{ item.realName }}</div>
|
||||
<div style="text-align: center;font-size: 17px">{{ item.mobile }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <span slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button @click="dialogVisible = false">关 闭</el-button>-->
|
||||
<!-- <!– <el-button type="primary" @click="dialogVisible = false">确 定</el-button>–>-->
|
||||
<!-- </span>-->
|
||||
</el-dialog>
|
||||
<!-- 购物车-->
|
||||
<el-dialog title="购物车" :visible.sync="openShoppingCart" width="50%">
|
||||
<el-alert
|
||||
style="margin-bottom: 5px"
|
||||
title="“加钱够”商品仅支持在单商品结算时支持积分不足情况下使用加钱购进行付款,多个商品结算不支持“加钱够”计算"
|
||||
type="warning"
|
||||
:closable="false">
|
||||
</el-alert>
|
||||
<el-table
|
||||
:data="shoppingCart"
|
||||
stripe
|
||||
align="center"
|
||||
style="width: 100%">
|
||||
<el-table-column align="center" prop="date" label="商品信息">
|
||||
<el-table-column align="center" prop="date" label="商品图">
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
style="width: 60px; height: 60px"
|
||||
:src="imagePath+scope.row.coverImage"
|
||||
fit="cover"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="giftName" label="商品名称" ></el-table-column>
|
||||
<el-table-column align="center" prop="remainingInventory" label="库存">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.remainingInventory === -1?"不限":scope.row.remainingInventory}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="date" label="价格">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.exchangeMethod == '积分' || scope.row.exchangeMethod == '积分+金额' || scope.row.exchangeMethod == '积分+加钱购'">{{scope.row.exchangePoints}}积分</span>
|
||||
<span v-if="scope.row.exchangeMethod == '积分+金额'">+</span>
|
||||
<span v-if="scope.row.exchangeMethod == '金额' || scope.row.exchangeMethod == '积分+金额'">¥{{scope.row.exchangeAmount}}</span>
|
||||
<span v-if="scope.row.exchangeMethod == '积分+加钱购'">+{{scope.row.moneyRatio}}加钱比例</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="name" label="购买数量" width="200px">
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-input-number :disabled="scope.row.markPurchases>=scope.row.remainingInventory" v-model="scope.row.markPurchases" @change="changePurchases(scope.row),changeCompute" :min="1" :max="10000" label="" style="width: 130px" size="small"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="totalPoints_sum" label="合计">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
fixed="right"
|
||||
label="操作"
|
||||
width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="delShooping(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
<!-- 立即结算-->
|
||||
<el-dialog
|
||||
title="扫码支付"
|
||||
:visible.sync="dialogVisiblej"
|
||||
width="30%"
|
||||
:close-on-click-modal="false">
|
||||
<div v-if="isPay == true"
|
||||
v-loading="loading">
|
||||
<div style="text-align: center;font-size: 15px;font-weight: bold">应收金额</div>
|
||||
<div style="text-align: center;font-size: 30px;font-weight: bold;color: red;margin: 10px 0">
|
||||
¥{{ allAmout}}
|
||||
</div>
|
||||
<div style="text-align: center;margin-bottom: 10px">
|
||||
减去积分:{{ allPoints }}
|
||||
</div>
|
||||
<div>
|
||||
<el-input v-model="authCode"
|
||||
autofocus="autofocus"
|
||||
@keydown.enter.native="collection"
|
||||
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
|
||||
<i
|
||||
slot="suffix">
|
||||
<svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"><path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path></svg>
|
||||
</i>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="demo-image">
|
||||
<div class="block" style="text-align: center">
|
||||
<el-image
|
||||
style="width: 200px; height: 200px"
|
||||
fit="cover"
|
||||
src="https://oil.wudb.cn/static/img/scan-demo.fcb8b1ab.png"></el-image>
|
||||
</div>
|
||||
</div>
|
||||
<el-divider></el-divider>
|
||||
<span slot="footer" class="dialog-footer" style="display: flex;justify-content: space-around">
|
||||
<el-button @click="dialogVisiblej = false" class="but">取 消</el-button>
|
||||
<el-button type="primary" class="but" @click="collection">确 定 收 款</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="isPaySuccess">
|
||||
<el-result icon="success" title="收款成功">
|
||||
<template slot="extra">
|
||||
<el-button type="primary" @click="handClose">关 闭</el-button>
|
||||
</template>
|
||||
</el-result>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-result icon="error" title="支付失败,请重新支付">
|
||||
<template slot="extra">
|
||||
<el-button type="primary" @click="handClose">关 闭</el-button>
|
||||
</template>
|
||||
</el-result>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 订单记录-->
|
||||
<el-drawer title="订单记录" :visible.sync="openOrderHistory" direction="rtl" size="1300px">
|
||||
<PointsCashier></PointsCashier>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getGiftApi,getGiftCategoryApi} from "@/api/cashier/integral";
|
||||
import {
|
||||
getCheckTheStatusOfYourPaymentByIntegralApi,
|
||||
getGiftApi,
|
||||
getGiftCategoryApi,
|
||||
getIntegralOrdersProcessingApi
|
||||
} from "@/api/cashier/integral";
|
||||
import BigNumber from 'bignumber.js';
|
||||
import PointsCashier from "@/views/cashier/NewComponents/integralOrder/pointsCashier";
|
||||
import {getDicts} from "@/api/dict/data";
|
||||
import {getUserVoMobile, getUserVoName} from "@/api/cashier/user";
|
||||
import {getUserGrade} from "@/api/cashier/usergrade";
|
||||
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: "Integral",
|
||||
components: {PointsCashier},
|
||||
dict: [],
|
||||
data(){
|
||||
return{
|
||||
|
||||
shoppingCart:[],
|
||||
giftList:'',
|
||||
giftCategoryList:'',
|
||||
queryParams: {
|
||||
categoryId:'',
|
||||
giftName:'',
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 10000,
|
||||
},
|
||||
|
||||
markPurchasesAll: 0,
|
||||
// 图片根目录
|
||||
imagePath: process.env.VUE_APP_SERVER_URL,
|
||||
activeName:0,
|
||||
input:''
|
||||
activeName:"first",
|
||||
input:'',
|
||||
|
||||
allPoints:0,
|
||||
allAmout:0,
|
||||
allMoneyRatio:0,
|
||||
|
||||
dialogVisible: false, //员工选择
|
||||
dialogVisiblevip:false, // 会员查询
|
||||
dialogVisibleMember: false,// 模糊查询会员
|
||||
dialogVisiblej: false,// 支付方式
|
||||
openShoppingCart: false,
|
||||
openOrderHistory: false,
|
||||
// 会员相关
|
||||
isMember: false, //是否为会员
|
||||
balance:0, // 账户余额
|
||||
member:{}, // 会员信息
|
||||
memberList:[], // 会员列表信息
|
||||
select1:'会员手机号',
|
||||
// 会员信息
|
||||
userNo:"",
|
||||
|
||||
// 员工相关
|
||||
staffList:[],
|
||||
staff:"",
|
||||
//支付方式
|
||||
payList:[],
|
||||
authCode:'',
|
||||
isPay:true,
|
||||
isPaySuccess:false,
|
||||
loading:false,
|
||||
paymentType : '',
|
||||
// isTheBalanceIsSufficient:false, //余额是否充足
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
this.getGiftCategory();
|
||||
this.getGift();
|
||||
this.getPayList()
|
||||
this.getStaffList();
|
||||
this.getStaff();
|
||||
},
|
||||
methods:{
|
||||
// 获取所有积分商品
|
||||
getGift() {
|
||||
getGiftApi().then(res=>{
|
||||
if (this.queryParams.categoryId ==='first') {
|
||||
this.queryParams.categoryId = null
|
||||
}
|
||||
getGiftApi(this.queryParams).then(res=>{
|
||||
this.giftList = res.data.records;
|
||||
})
|
||||
console.log("imagePath",this.imagePath)
|
||||
@ -141,11 +470,432 @@
|
||||
this.giftCategoryList = res.data.records;
|
||||
})
|
||||
},
|
||||
// 获取支付方式
|
||||
getPayList() {
|
||||
getDicts("payment_type").then(response => {
|
||||
this.payList = response.data;
|
||||
})
|
||||
},
|
||||
payMethod(payType){
|
||||
this.paymentType = payType
|
||||
},
|
||||
|
||||
// 点击商品增加库存
|
||||
addGift(data) {
|
||||
console.log("data",data)
|
||||
if (data.markPurchases) {
|
||||
if (data.markPurchases>=data.remainingInventory){
|
||||
this.$message.error('库存不足');
|
||||
return
|
||||
}
|
||||
data.markPurchases = data.markPurchases+1
|
||||
}else {
|
||||
this.$set(data, "markPurchases", 1);
|
||||
}
|
||||
this.markPurchasesAll++
|
||||
|
||||
// 计算总额
|
||||
this.dataChange(data);
|
||||
|
||||
if (this.shoppingCart.length === 0) {
|
||||
this.shoppingCart.push(data);
|
||||
} else {
|
||||
let flag = false;
|
||||
this.shoppingCart.forEach(shopp=>{
|
||||
if (data.id === shopp.id) {
|
||||
flag = true;
|
||||
}
|
||||
})
|
||||
if (!flag) {
|
||||
this.shoppingCart.push(data);
|
||||
}
|
||||
}
|
||||
this.allData();
|
||||
|
||||
|
||||
// 计算余额是否足够
|
||||
},
|
||||
|
||||
handleClick(tab, event){
|
||||
console.log(tab, event);
|
||||
this.getGift()
|
||||
},
|
||||
// 选择会员
|
||||
chooseUser(mobile,id){
|
||||
this.dialogVisiblevip = false
|
||||
this.isMember = true;
|
||||
// this.map.payUser = mobile;
|
||||
// this.map.userId = id;
|
||||
this.balance = this.member.cardBalance;
|
||||
if (this.balance>=(this.oilAmount - this.oilDiscount)){
|
||||
this.consumeAmount = this.oilAmount - this.oilDiscount;
|
||||
this.oilActualPay = 0;
|
||||
}else {
|
||||
this.consumeAmount = this.balance;
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount - this.balance;
|
||||
}
|
||||
},
|
||||
// 选择会员信息
|
||||
handleChoose(data){
|
||||
this.member = data;
|
||||
this.dialogVisibleMember = false;
|
||||
this.allData();
|
||||
},
|
||||
// 根据手机号查询会员信息
|
||||
getUser(){
|
||||
if(this.select1=="会员手机号"){
|
||||
getUserVoMobile({mobile:this.userNo}).then( response => {
|
||||
if (response.data!=null){
|
||||
this.member = response.data
|
||||
}else {
|
||||
this.$modal.msgError("会员信息不存在")
|
||||
}
|
||||
})
|
||||
}else {
|
||||
getUserVoName({name:this.userNo}).then( response => {
|
||||
this.memberList = response.data
|
||||
})
|
||||
this.dialogVisibleMember = true;
|
||||
}
|
||||
},
|
||||
// 获取会员等级信息
|
||||
getGrade(id){
|
||||
getUserGrade(id).then( response => {
|
||||
this.gradeName = response.data.name;
|
||||
})
|
||||
return this.gradeName;
|
||||
},
|
||||
// 重置会员
|
||||
resetMember(){
|
||||
this.member = {};
|
||||
this.isMember = false;
|
||||
// this.map.payUser == "";
|
||||
// this.balance = 0;
|
||||
this.userNo = "";
|
||||
// this.handleChange();
|
||||
},
|
||||
// 获取当前账户信息
|
||||
getStaff(){
|
||||
staffInfo().then( response => {
|
||||
this.staff = response.data;
|
||||
// this.map.staffId = this.staff.id;
|
||||
})
|
||||
},
|
||||
// 选择员工信息
|
||||
chooseStaff(data){
|
||||
this.staff = data;
|
||||
// this.map.staffId = this.staff.id;
|
||||
},
|
||||
// 获取员工列表
|
||||
getStaffList(){
|
||||
queryStaffs().then( response => {
|
||||
this.staffList = response.data
|
||||
})
|
||||
},
|
||||
// 重置
|
||||
reset() {
|
||||
this.getGift();
|
||||
this.shoppingCart=[]
|
||||
this.markPurchasesAll = 0
|
||||
this.allPoints=0
|
||||
this.allAmout=0
|
||||
this.allMoneyRatio=0
|
||||
this.paymentType = ''
|
||||
},
|
||||
// 打开购物车
|
||||
shoppingCartMethod() {
|
||||
if (this.shoppingCart == [] || this.shoppingCart.length < 1) {
|
||||
this.$message({
|
||||
message: '请先选择商品!',
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
this.openShoppingCart = true
|
||||
}
|
||||
},
|
||||
// 购物车页面计算
|
||||
changePurchases(data) {
|
||||
//计算总积分
|
||||
this.dataChange(data);
|
||||
this.allData()
|
||||
},
|
||||
changeCompute(newValue,oldValue){
|
||||
this.markPurchasesAll = this.markPurchasesAll + (newValue - oldValue)
|
||||
},
|
||||
// 删除商品
|
||||
delShooping(data) {
|
||||
|
||||
if (this.markPurchasesAll >= data.markPurchases) {
|
||||
this.markPurchasesAll = this.markPurchasesAll - data.markPurchases
|
||||
}
|
||||
data.markPurchases = 0;
|
||||
this.shoppingCart = this.shoppingCart.filter(item => item.id !== data.id);
|
||||
this.allData()
|
||||
},
|
||||
allData() {
|
||||
this.allPoints = 0
|
||||
this.allAmout = 0
|
||||
let allPoints = new BigNumber(this.allPoints)
|
||||
let allAmout = new BigNumber(this.allAmout)
|
||||
let allMoneyRatio = new BigNumber(this.allMoneyRatio)
|
||||
|
||||
console.log("this.shoppingCart",this.shoppingCart)
|
||||
|
||||
this.shoppingCart.forEach(res => {
|
||||
if (res.exchangePoints_sum) {
|
||||
let exchangePoints_sum = new BigNumber(res.exchangePoints_sum);
|
||||
allPoints = allPoints.plus(exchangePoints_sum);
|
||||
}
|
||||
if (res.exchangeAmount_sum) {
|
||||
let exchangeAmount_sum = new BigNumber(res.exchangeAmount_sum);
|
||||
allAmout = allAmout.plus(exchangeAmount_sum);
|
||||
}
|
||||
});
|
||||
|
||||
// 计算加钱购
|
||||
if (this.shoppingCart && this.shoppingCart.length === 1 && this.shoppingCart[0].exchangeMethod === '积分+加钱购' && this.shoppingCart[0].moneyRatio) {
|
||||
let data = this.shoppingCart[0];
|
||||
// 计算加钱购商品一共多少积分
|
||||
let markPurchases = new BigNumber(data.markPurchases);
|
||||
let exchangePoints = markPurchases.multipliedBy(new BigNumber(data.exchangePoints));
|
||||
// 拿到总的积分
|
||||
this.member.points = this.member.points?this.member.points:0
|
||||
let points = this.member.points - exchangePoints.toNumber(); // 使用 toNumber() 获取 BigNumber 的数值
|
||||
|
||||
// 以及分等一多少
|
||||
if (points < 0) {
|
||||
|
||||
// 计算需要的金额
|
||||
points = Math.abs(points);
|
||||
|
||||
|
||||
allAmout = points * data.moneyRatio; // 直接使用 JavaScript 中的乘法
|
||||
this.allAmout = allAmout.toFixed(2);
|
||||
this.allPoints = this.member.points;
|
||||
} else {
|
||||
console.log("计算加钱购",exchangePoints)
|
||||
console.log("计算加钱购",this.member.points)
|
||||
|
||||
this.allAmout = 0
|
||||
this.allPoints = exchangePoints.toNumber();
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// 更新组件的值
|
||||
this.allPoints = Number(allPoints).toFixed(2);
|
||||
this.allAmout = Number(allAmout).toFixed(2);
|
||||
},
|
||||
dataChange(data) {
|
||||
// 判断支付方式 (计算积分)
|
||||
if (data.exchangeMethod =='积分'){
|
||||
let exchange = new BigNumber(data.exchangePoints);
|
||||
let mark = new BigNumber(data.markPurchases);
|
||||
let exchangePoints_sum = exchange.multipliedBy(mark);
|
||||
if (data.exchangePoints_sum) {
|
||||
data.exchangePoints_sum = Number(exchangePoints_sum);
|
||||
}else {
|
||||
this.$set(data, "exchangePoints_sum", exchangePoints_sum);
|
||||
}
|
||||
if (data.totalPoints_sum) {
|
||||
data.totalPoints_sum = exchangePoints_sum.toString()+"积分";
|
||||
}else {
|
||||
this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分");
|
||||
}
|
||||
}else if (data.exchangeMethod =='金额') {
|
||||
let amount = new BigNumber(data.exchangeAmount);
|
||||
let mark = new BigNumber(data.markPurchases);
|
||||
let exchangeAmount_sum = amount.multipliedBy(mark);
|
||||
|
||||
if (data.exchangeAmount_sum) {
|
||||
data.exchangeAmount_sum = Number(exchangeAmount_sum);
|
||||
}else {
|
||||
this.$set(data, "exchangeAmount_sum", exchangeAmount_sum);
|
||||
}
|
||||
if (data.totalPoints_sum) {
|
||||
data.totalPoints_sum = "¥"+exchangeAmount_sum.toString();
|
||||
}else {
|
||||
this.$set(data, "totalPoints_sum", "¥"+exchangeAmount_sum);
|
||||
}
|
||||
}else if (data.exchangeMethod =='积分+金额') {
|
||||
let exchange = new BigNumber(data.exchangePoints);
|
||||
let mark = new BigNumber(data.markPurchases);
|
||||
let exchangePoints_sum = exchange.multipliedBy(mark);
|
||||
|
||||
if (data.exchangePoints_sum) {
|
||||
data.exchangePoints_sum = Number(exchangePoints_sum);
|
||||
}else {
|
||||
this.$set(data, "exchangePoints_sum", exchangePoints_sum);
|
||||
}
|
||||
|
||||
let amount = new BigNumber(data.exchangeAmount);
|
||||
let exchangeAmount_sum = amount.multipliedBy(mark);
|
||||
|
||||
if (data.exchangeAmount_sum) {
|
||||
data.exchangeAmount_sum = Number(exchangeAmount_sum);
|
||||
}else {
|
||||
this.$set(data, "exchangeAmount_sum", exchangeAmount_sum);
|
||||
}
|
||||
if (data.totalPoints_sum) {
|
||||
data.totalPoints_sum = exchangePoints_sum.toString()+"积分"+"+"+"¥"+exchangeAmount_sum.toString();
|
||||
}else {
|
||||
this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分"+"+"+"¥"+exchangeAmount_sum);
|
||||
}
|
||||
|
||||
}else if (data.exchangeMethod =='积分+加钱购') {
|
||||
let exchange = new BigNumber(data.exchangePoints);
|
||||
let mark = new BigNumber(data.markPurchases);
|
||||
let exchangePoints_sum = exchange.multipliedBy(mark);
|
||||
this.$set(data, "exchangePoints_sum", exchangePoints_sum);
|
||||
|
||||
if (data.exchangePoints_sum) {
|
||||
data.exchangePoints_sum = Number(exchangePoints_sum);
|
||||
}else {
|
||||
this.$set(data, "exchangePoints_sum", exchangePoints_sum);
|
||||
}
|
||||
|
||||
let ratio = new BigNumber(data.moneyRatio);
|
||||
let moneyRatio_sum = ratio.multipliedBy(mark);
|
||||
this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分"+"+"+moneyRatio_sum+"");
|
||||
|
||||
if (data.moneyRatio_sum) {
|
||||
data.moneyRatio_sum = moneyRatio_sum;
|
||||
}else {
|
||||
this.$set(data, "moneyRatio_sum", moneyRatio_sum);
|
||||
}
|
||||
if (data.totalPoints_sum) {
|
||||
data.totalPoints_sum = exchangePoints_sum+"积分"+"+"+moneyRatio_sum+"";
|
||||
}else {
|
||||
this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分"+"+"+moneyRatio_sum+"");
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
// 打开订单记录
|
||||
orderHistoryMethod() {
|
||||
this.openOrderHistory = true
|
||||
},
|
||||
// 立即结算
|
||||
settlement(){
|
||||
if (this.paymentType == '') {
|
||||
this.$message.error('请先选择支付方式');
|
||||
|
||||
return
|
||||
}
|
||||
this.isPay = true
|
||||
this.dialogVisiblej = true
|
||||
},
|
||||
// 确定收款
|
||||
async collection() {
|
||||
let this_ = this
|
||||
// this_.authCode
|
||||
let integralOrdersList = []
|
||||
if (this_.shoppingCart.length >0) {
|
||||
//数组组装
|
||||
this_.shoppingCart.forEach(res =>{
|
||||
let integralOrders = {
|
||||
userId : this_.member.id,
|
||||
giftId : res.id,
|
||||
amount : res.exchangeAmount_sum,
|
||||
integral : res.exchangePoints_sum,
|
||||
exchangeQuantity : res.markPurchases,
|
||||
orderType : 1,
|
||||
staffId: this_.staff.id,
|
||||
paymentType : this_.paymentType
|
||||
}
|
||||
integralOrdersList.push(integralOrders)
|
||||
})
|
||||
let flag = false
|
||||
let orderNumber = '';
|
||||
await getIntegralOrdersProcessingApi({
|
||||
integralOrdersList:integralOrdersList,
|
||||
authCode:this_.authCode,
|
||||
paymentType:this_.paymentType,
|
||||
allAmout:this_.allAmout,
|
||||
allPoints:this_.allPoints,
|
||||
}).then(response=> {
|
||||
if (response.data!=null){
|
||||
this_.loading = true;
|
||||
orderNumber = response.data.orderNumber
|
||||
if (response.data.status == "un") {
|
||||
this.$message.error('积分已不足');
|
||||
this_.loading = false;
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
});
|
||||
if (flag) return
|
||||
|
||||
let timer = setInterval(async () => {
|
||||
getCheckTheStatusOfYourPaymentByIntegralApi({orderNumber:orderNumber}).then(response => {
|
||||
if (response.data!=null){
|
||||
if (response.data.status == "unpaid"){
|
||||
this_.isQuery = true;
|
||||
}
|
||||
if (response.data.status == "paid"){
|
||||
this_.isPaySuccess = true;
|
||||
this_.isQuery = false;
|
||||
}
|
||||
if (response.data.status == "payFail"){
|
||||
this_.isPaySuccess = false;
|
||||
this_.isQuery = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 500);
|
||||
|
||||
let timer2 = setInterval(function () {
|
||||
if (this_.isQuery == false) {
|
||||
this_.loading = false;
|
||||
this_.isPay = false;
|
||||
clearInterval(timer);
|
||||
}
|
||||
},500)
|
||||
|
||||
setTimeout(function (){
|
||||
clearInterval(timer2);
|
||||
clearInterval(timer);
|
||||
this_.loading = false;
|
||||
this_.isPay = false;
|
||||
this.isPaySuccess = false;
|
||||
|
||||
},30000)
|
||||
|
||||
}
|
||||
this.paymentType = ''
|
||||
|
||||
},
|
||||
// 清楚数据
|
||||
handClose(){
|
||||
// if(this.isPaySuccess){
|
||||
// this.oilAmount = 0;
|
||||
// this.oilActualPay = 0;
|
||||
// this.oilDiscount = 0;
|
||||
// this.goodsAmount = 0;
|
||||
// this.goodsActualPay = 0;
|
||||
// this.goodsDiscount = 0;
|
||||
// this.consumeAmount = 0;
|
||||
// this.oilTotal = 0;
|
||||
// this.goodsTotal = 0;
|
||||
// }
|
||||
this.isPay = true;
|
||||
this.dialogVisiblej = false
|
||||
this.isPaySuccess = false;
|
||||
this.authCode = '';
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
isTheBalanceIsSufficient(){
|
||||
if (this.member && this.member.points !== undefined) {
|
||||
const allPoints = new BigNumber(this.allPoints);
|
||||
const points = new BigNumber(this.member.points);
|
||||
return points.minus(allPoints).toNumber() >= 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@ -484,6 +1234,7 @@
|
||||
margin: 5px;
|
||||
}
|
||||
.box-six{
|
||||
|
||||
width: 100%;
|
||||
height: 160px;
|
||||
img{
|
||||
|
@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<div class="">
|
||||
<el-descriptions class="margin-top" title="用户信息" :column="1" border>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
用户手机号
|
||||
</template>
|
||||
{{dataForm.mobile}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
用户名称
|
||||
</template>
|
||||
{{dataForm.name}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions class="margin-top" style="margin-top:10px" title="订单信息" :column="1" border>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
商品名称
|
||||
</template>
|
||||
{{ dataForm.giftName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
交易数量
|
||||
</template>
|
||||
{{ dataForm.exchangeQuantity }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="dataForm.orderType != 1">
|
||||
<template slot="label">
|
||||
配送类型
|
||||
</template>
|
||||
<el-tag size="small"> {{ dataForm.shippingType }} </el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="dataForm.orderType != 1">
|
||||
<template slot="label">
|
||||
付款信息
|
||||
</template>
|
||||
{{ dataForm.orderStatus }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
订单编号
|
||||
</template>
|
||||
{{ dataForm.orderNumber }}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
创建时间
|
||||
</template>
|
||||
{{ dataForm.createTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
更新时间
|
||||
</template>
|
||||
{{ dataForm.updateTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
付款备注
|
||||
</template>
|
||||
{{ dataForm.notes }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions v-if="dataForm.shippingType == '物流配送'" class="margin-top" style="margin-top:10px" title="收货信息" :column="1" border>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
收货人
|
||||
</template>
|
||||
{{dataForm.addrName}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
收货电话
|
||||
</template>
|
||||
{{dataForm.addrMobile}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
收货地址
|
||||
</template>
|
||||
{{dataForm.address }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "detail",
|
||||
props: {
|
||||
dataForm:{},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
created(){
|
||||
console.log("dataForm",this.dataForm)
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card >
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px">
|
||||
<el-form-item label="交易单号" prop="giftName">
|
||||
<el-input
|
||||
v-model="queryParams.orderNumber"
|
||||
placeholder="请输入交易单号"
|
||||
clearable
|
||||
style="width: 220px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="兑换状态">
|
||||
<el-select v-model="queryParams.status" style="width: 150px" placeholder="兑换状态" clearable>
|
||||
<el-option label="未支付" value="unpaid">未支付</el-option>
|
||||
<el-option label="付款成功" value="paid">付款成功</el-option>
|
||||
<el-option label="付款失败" value="payFail">付款失败</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="giftName">
|
||||
<el-input
|
||||
v-model="queryParams.mobile"
|
||||
placeholder="请输入用户手机号"
|
||||
clearable
|
||||
style="width: 160px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="注册时间">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
style="width: 240px"
|
||||
size="medium"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
clearable
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 20px;" >
|
||||
<div style="margin-bottom : 10px">
|
||||
<span class="font-number">统计</span>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8" >
|
||||
<el-col :span="2.5">
|
||||
<div class="box">
|
||||
<span class="font-chinese">笔数</span>
|
||||
<span class="font-number">{{statisticsForm.num}}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2.5">
|
||||
<div class="box">
|
||||
<span class="font-chinese">商品数量</span>
|
||||
<span class="font-number">{{statisticsForm.exchangeQuantity}}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2.5">
|
||||
<div class="box">
|
||||
<span class="font-chinese">积分</span>
|
||||
<span class="font-number">{{statisticsForm.integral}}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<div class="box">
|
||||
<span class="font-chinese">支付总额
|
||||
<el-tooltip class="item" effect="dark" content="实际支付订单详细信息请在增值订单页面查看
|
||||
" placement="top-start">
|
||||
<i class="el-icon-info"></i>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<span class="font-number">{{statisticsForm.amount}}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top: 20px" >
|
||||
<el-table ref="tables"
|
||||
v-loading="loading"
|
||||
:data="dataList"
|
||||
:default-sort="defaultSort">
|
||||
<el-table-column label="用户手机号" align="center" prop="mobile"/>
|
||||
<el-table-column label="订单号" align="center" prop="orderNumber"/>
|
||||
<!-- <el-table-column label="商品信息" align="center" prop="" >-->
|
||||
<!-- <el-table-column label="简述" align="center" prop="categoryName" />-->
|
||||
<!-- <el-table-column label="商品名称" align="center" prop="giftName" />-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column label="商品名称" align="center" prop="giftName" />
|
||||
<el-table-column label="实付信息" align="center" >
|
||||
<el-table-column label="积分" align="center" prop="integral" width=""/>
|
||||
<el-table-column label="支付金额" align="center" prop="amount" width="">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.amount?scope.row.amount:"--" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付状态" align="center" prop="status" width="">
|
||||
<template slot-scope="scope">
|
||||
<el-tag effect="plain" v-if="scope.row.status =='unpaid'"> 待支付</el-tag>
|
||||
<el-tag type="success" effect="plain" v-else-if="scope.row.status =='paid'">支付成功</el-tag>
|
||||
<el-tag type="warning" effect="plain" v-else>支付失败</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width=""/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleDetail(scope.row)"
|
||||
>订单详情</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
<el-dialog title="订单详情" :visible.sync="openDetail" width="500px" append-to-body :close-on-click-modal="false">
|
||||
<detail :dataForm = "dataForm"></detail>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getOrderApi,getStatisticsApi } from "@/api/cashier/integralOrder/order";
|
||||
import Detail from '@/views/cashier/NewComponents/integralOrder/detail'
|
||||
import {getDicts} from "@/api/dict/data";
|
||||
|
||||
export default {
|
||||
name: "pointsCashier",
|
||||
components: { Detail },
|
||||
|
||||
// dicts: ['zhzt'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
openDetail:false,
|
||||
dataForm:{},
|
||||
dataList:[],
|
||||
zhztList:'',
|
||||
queryParams: {
|
||||
orderType:1,
|
||||
|
||||
giftName: '',
|
||||
status: '',
|
||||
mobile: '',
|
||||
orderNumber: '',
|
||||
page:null,
|
||||
pageSize:null
|
||||
},
|
||||
loading: false,
|
||||
dateRange: [],
|
||||
defaultSort: {prop: 'createTime', order: 'descending'},
|
||||
|
||||
total: 0,
|
||||
|
||||
statisticsForm: {
|
||||
num:0,
|
||||
exchangeQuantity:0,
|
||||
integral:0,
|
||||
amount:0
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getStatistics();
|
||||
|
||||
},
|
||||
methods: {
|
||||
getList(){
|
||||
getOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
|
||||
this.dataList = res.data.records
|
||||
this.total = res.data.total
|
||||
|
||||
})
|
||||
},
|
||||
getStatistics() {
|
||||
getStatisticsApi().then(res=>{
|
||||
this.statisticsForm = res.data
|
||||
})
|
||||
console.log("123123123",this.statisticsForm)
|
||||
},
|
||||
|
||||
// 获取支付方式
|
||||
getZhzt() {
|
||||
getDicts("zhzt").then(response => {
|
||||
this.zhztList = response.data;
|
||||
})
|
||||
},
|
||||
|
||||
handleUpdate(){},
|
||||
handleQuery(){
|
||||
this.getList();
|
||||
|
||||
},
|
||||
resetQuery(){
|
||||
this.queryParams = {
|
||||
giftName: '',
|
||||
status: '',
|
||||
mobile: '',
|
||||
orderNumber: '',
|
||||
page:1,
|
||||
pageSize:10
|
||||
},
|
||||
this.dateRange = []
|
||||
},
|
||||
handleDetail(data){
|
||||
this.openDetail = true
|
||||
this.dataForm = data;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.app-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f6f8f9;
|
||||
padding-top: 0px;
|
||||
padding: 0px
|
||||
}
|
||||
.box {
|
||||
padding: 10px;
|
||||
height: 80px;
|
||||
width: 150px;
|
||||
margin-right: 0px;
|
||||
background-color: rgba(204, 204, 204, 0.3);
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.font-chinese {
|
||||
font-size: 15px;
|
||||
font-family:Microsoft YaHei;
|
||||
font-weight: bold;
|
||||
line-height:1.5
|
||||
}
|
||||
.font-number {
|
||||
font-size: 20px;
|
||||
font-family: PingFang SC,sans-serif;
|
||||
font-weight: bold;
|
||||
line-height:1.3
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user