收银台

This commit is contained in:
cun-nan 2023-11-07 18:12:17 +08:00
parent 96497a7be9
commit 67e94f78a8
22 changed files with 831 additions and 135 deletions

View File

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -38,6 +39,12 @@ public class LJGoodsController extends BaseController {
return getSuccessResult(list);
}
@GetMapping("/queryList")
public ResponseObject queryList(){
List<LJGoods> goods = goodsService.selectGoodsList();
return getSuccessResult(goods);
}
/**
* 根据id查询商品信息
* @param id

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.convenienceSore.entity.LJGoods;
import java.util.List;
/**
* 商品信息 业务层
*/
@ -17,6 +19,12 @@ public interface LJGoodsService extends IService<LJGoods> {
*/
public IPage<LJGoods> selectLJGoodsList(Page page, LJGoods goods);
/**
* 查询所有商品列表信息
* @return
*/
public List<LJGoods> selectGoodsList();
/**
* 根据id查询商品信息
* @param id

View File

@ -18,6 +18,7 @@ import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Random;
/**
@ -44,6 +45,17 @@ public class LJGoodsServiceImpl extends ServiceImpl<LJGoodsMapper, LJGoods> impl
return goodsIPage;
}
@Override
public List<LJGoods> selectGoodsList() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_recovery",0);
queryWrapper.eq("store_id",storeId);
List list = baseMapper.selectList(queryWrapper);
return list;
}
/**
* 根据id查询商品信息
* @param id

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -56,6 +58,18 @@ public class LJStaffController extends BaseController {
return getSuccessResult(staff);
}
/**
* 根据登录账户名查询员工信息
* @return
*/
@GetMapping("/name")
public ResponseObject staff(){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer staffId = nowAccountInfo.getStaffId();
LJStaff staff = mtStaffService.selectStaffById(staffId);
return getSuccessResult(staff);
}
/**
* 根据id查询员工信息
* @param map

View File

@ -0,0 +1,47 @@
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.OilOrder;
import com.fuint.business.order.service.OilOrderService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/business/oilOrder")
public class OilOrderController extends BaseController {
@Autowired
private OilOrderService orderService;
/**
* 根据条件分页查询会员信息
* @param order
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/list")
public ResponseObject list(OilOrder order,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
IPage<OilOrder> list = orderService.selectOilOrderList(page,order);
return getSuccessResult(list);
}
/**
* 批量添加订单信息
* @param map
* @return
*/
@PostMapping
public ResponseObject add(@Validated @RequestBody Map<String,String> map){
int row = orderService.insertOilOrder(map);
return getSuccessResult(row);
}
}

View File

@ -12,11 +12,14 @@ import java.util.Date;
import java.io.Serializable;
/**
* 订单表(MtOrder)实体类
* 商品订单表(Order)实体类
*
* @author makejava
* @since 2023-11-07 15:04:17
*/
@Data
@TableName("mt_order")
@ApiModel(value = "LJOrder对象", description = "订单表")
@ApiModel(value = "LJOrder对象", description = "商品订单表")
public class LJOrder extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ -26,14 +29,14 @@ public class LJOrder extends BaseEntity implements Serializable {
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 订单类型
*/
private String type;
/**
* 终端
*/
private String terminal;
/**
* 订单类型
*/
private String type;
/**
* 付款用户
*/
@ -50,14 +53,14 @@ public class LJOrder extends BaseEntity implements Serializable {
* 所属店铺ID
*/
private Integer storeId;
/**
* 商品id
*/
private Integer goodId;
/**
* 用户ID
*/
private Integer userId;
/**
* 商品数量
*/
private Double goodsNum;
/**
* 订单金额
*/
@ -66,6 +69,10 @@ public class LJOrder extends BaseEntity implements Serializable {
* 支付金额
*/
private Double payAmount;
/**
* 商品数量
*/
private Integer goodsNum;
/**
* 使用积分数量
*/
@ -75,7 +82,7 @@ public class LJOrder extends BaseEntity implements Serializable {
*/
private Double pointAmount;
/**
* 折扣金额
* 优惠金额
*/
private Double discount;
/**
@ -94,6 +101,5 @@ public class LJOrder extends BaseEntity implements Serializable {
* 操作员工
*/
private Integer staffId;
}

View File

@ -0,0 +1,118 @@
package com.fuint.business.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 油品订单表(OilOrder)实体类
*
* @author makejava
* @since 2023-11-07 15:10:07
*/
@Data
@TableName("oil_order")
@ApiModel(value = "OilOrder对象", description = "油品订单表")
public class OilOrder extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 自增ID
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 店铺id
*/
private Integer storeId;
/**
* 用户id
*/
private Integer userId;
/**
* 优惠券id
*/
private Integer couponId;
/**
* 提成金额
*/
private Double commissionAmount;
/**
* 员工id
*/
private Integer staffId;
/**
* 终端
*/
private String terminal;
/**
* 订单号
*/
private String orderNo;
/**
* 油品
*/
private String oils;
/**
* 油枪号
*/
private Integer oilGunNum;
/**
* 油品数量
*/
private Double oilNum;
/**
* 订单金额
*/
private Double orderAmount;
/**
* 优惠金额
*/
private Double discountAmount;
/**
* 实付金额
*/
private Double payAmount;
/**
* 付款用户
*/
private String payUser;
/**
* 付款类型微信支付宝等赊账
*/
private String payType;
/**
* 开票标识已开票未开票
*/
private String invoicing;
/**
* 订单状态已支付未支付
*/
private String orderStatus;
/**
* 支付时间
*/
private Date payTime;
/**
* 富友订单号
*/
private Integer reservedFyOrderNo;
/**
* 富友渠道交易流水号
*/
private Integer reservedTransactionId;
/**
* 订单备注
*/
private String remark;
}

View File

@ -0,0 +1,20 @@
package com.fuint.business.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.OilOrder;
import org.apache.ibatis.annotations.Param;
/**
* 油品订单表 Mapper层
*/
public interface OilOrderMapper extends BaseMapper<OilOrder> {
/**
* 根据条件分页查询油品订单信息
* @param page
* @param order
* @return
*/
public IPage<OilOrder> selectOilOrderList(Page page, @Param("order") OilOrder order);
}

View File

@ -0,0 +1,35 @@
<?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.OilOrderMapper">
<sql id="selectOrders">
select * from oil_order
</sql>
<select id="selectOilOrderList" resultType="com.fuint.business.order.entity.OilOrder">
<include refid="selectOrders"></include>
<where>
store_id = #{order.storeId}
<!-- <if test="order.staffId != null and order.staffId != ''">-->
<!-- and staff_id = #{order.staffId}-->
<!-- </if>-->
<!-- <if test="order.type != null and order.type != ''">-->
<!-- and type = #{order.type}-->
<!-- </if>-->
<!-- <if test="order.payType != null and order.payType != ''">-->
<!-- and pay_type = #{order.payType}-->
<!-- </if>-->
<!-- <if test="order.orderNo != null and order.orderNo != ''">-->
<!-- and order_no like concat('%', #{order.orderNo}, '%')-->
<!-- </if>-->
<!-- <if test="order.payUser != null and order.payUser != ''">-->
<!-- and pay_user like concat('%', #{order.payUser}, '%')-->
<!-- </if>-->
<!-- <if test="order.params.beginTime != null and order.params.beginTime != ''">&lt;!&ndash; 开始时间检索 &ndash;&gt;-->
<!-- and date_format(create_time,'%y%m%d') &gt;= date_format(#{order.params.beginTime},'%y%m%d')-->
<!-- </if>-->
<!-- <if test="order.params.endTime != null and order.params.endTime != ''">&lt;!&ndash; 结束时间检索 &ndash;&gt;-->
<!-- and date_format(create_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d')-->
<!-- </if>-->
</where>
</select>
</mapper>

View File

@ -0,0 +1,28 @@
package com.fuint.business.order.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.order.entity.OilOrder;
import java.util.Map;
/**
* 油品订单信息 业务层
*/
public interface OilOrderService extends IService<OilOrder> {
/**
* 根据条件分页查询油品订单信息
* @param page
* @param order
* @return
*/
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order);
/**
* 添加油品订单信息
* @param map
* @return
*/
public int insertOilOrder(Map<String ,String> map);
}

View File

@ -0,0 +1,63 @@
package com.fuint.business.order.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.order.entity.OilOrder;
import com.fuint.business.order.mapper.OilOrderMapper;
import com.fuint.business.order.service.OilOrderService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Service
public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> implements OilOrderService {
@Override
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
order.setStoreId(storeId);
IPage<OilOrder> oilOrderIPage = baseMapper.selectOilOrderList(page, order);
return oilOrderIPage;
}
@Override
public int insertOilOrder(Map<String ,String> map) {
String oilOrder = map.get("oilOrder");
String goodsOrder = map.get("goodsOrder");
String payType = map.get("payType");
List<JSONObject> jsonObjects = JSONArray.parseArray(oilOrder, JSONObject.class);
OilOrder order = new OilOrder();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
// 添加油品订单信息
for (JSONObject object : jsonObjects) {
order.setOrderNo(timestamp+randomString);
double amount = (double) object.get("amount");
double oilPrice = (double) object.get("oilPrice");
double oilNum = amount/oilPrice;
order.setOilNum(oilNum);
order.setPayType(payType);
order.setOils((String) object.get("oilName"));
order.setOilGunNum((Integer) object.get("oilGunNum"));
order.setOrderAmount((Double) object.get("amount"));
System.out.println(object.get("oilGunNum"));
System.out.println(object.get("numberId"));
System.out.println(object.get("oilName"));
System.out.println(object.get("oilPrice"));
System.out.println(object.get("amount"));
}
// int row = baseMapper.insert(order);
return 0;
}
}

View File

@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@ -87,6 +88,18 @@ public class LJUserController extends BaseController {
return getSuccessResult(userVo);
}
/**
* 根据手机号查询会员信息
* @param map
* @return
*/
@PostMapping("/name")
public ResponseObject userVoByName(@Validated @RequestBody Map<String ,String > map){
String name = map.get("name");
List<LJUserVo> list = userService.queryUserByName(name);
return getSuccessResult(list);
}
/**
* 批量删除会员信息
* @return

View File

@ -7,6 +7,8 @@ import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.vo.LJUserVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 会员信息 mapper层
*/
@ -26,6 +28,13 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
*/
public LJUserVo selectUserByMobile(@Param("mobile") String mobile);
/**
* 根据会员昵称模糊查询会员信息
* @param name
* @return
*/
public List<LJUserVo> selectUserByName(@Param("name") String name);
/**
* 统计信息
* @param storeId
@ -33,4 +42,5 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
* @return
*/
public Double selectSumByStore(@Param("storeId") int storeId,@Param("sumValue") String sumValue);
}

View File

@ -51,4 +51,11 @@
mu.mobile = #{mobile}
</where>
</select>
<select id="selectUserByName" resultType="com.fuint.business.userManager.vo.LJUserVo"
parameterType="java.lang.String">
<include refid="selectUser"></include>
<where>
mu.name like concat('%', #{name}, '%')
</where>
</select>
</mapper>

View File

@ -47,6 +47,13 @@ public interface LJUserService extends IService<LJUser> {
*/
public LJUserVo queryUserByMobile(String mobile);
/**
* 根据会员昵称模糊查询会员信息
* @param name
* @return
*/
public List<LJUserVo> queryUserByName(String name);
/**
* 根据id删除会员信息
* @param id

View File

@ -109,6 +109,17 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return userVo;
}
/**
* 根据会员昵称模糊查询会员信息
* @param name
* @return
*/
@Override
public List<LJUserVo> queryUserByName(String name) {
List<LJUserVo> list = baseMapper.selectUserByName(name);
return list;
}
/**
* 根据id删除会员信息
* @param id

View File

@ -9,6 +9,14 @@ export function listLJGoods(query) {
})
}
// 查询商品列表
export function listgoods() {
return request({
url: '/business/convenience/goods/queryList',
method: 'get',
})
}
// 查询商品详细
export function getLJGoods(id) {
return request({

View File

@ -0,0 +1,19 @@
import request from '@/utils/request'
// 查询油品订单列表
export function listOilOrder(query) {
return request({
url: '/business/oilOrder/list',
method: 'get',
params: query
})
}
// 新增油品订单信息
export function addLJGoods(data) {
return request({
url: '/business/oilOrder',
method: 'post',
data: data
})
}

View File

@ -25,6 +25,14 @@ export function getStaff(id) {
})
}
// 查询当前登录账号信息
export function staffInfo() {
return request({
url: '/business/member/staff/name',
method: 'get'
})
}
// 根据手机号查询员工详情
export function queryStaff(data) {
return request({

View File

@ -9,24 +9,6 @@ export function listUser(query) {
})
}
// 查询会员列表
export function listStatistic(query) {
return request({
url: '/business/userManager/user/statistic',
method: 'get',
params: query
})
}
// 根据手机号查询会员详细
export function getUserMobile(data) {
return request({
url: '/business/userManager/user/mobile' ,
method: 'post',
data: data
})
}
// 根据手机号查询会员详细
export function getUserVoMobile(data) {
return request({
@ -36,4 +18,13 @@ export function getUserVoMobile(data) {
})
}
// 根据手机号查询会员详细
export function getUserVoName(data) {
return request({
url: '/business/userManager/user/name',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询会员等级列表
export function listUserGrade(query) {
return request({
url: '/business/userManager/userGrade/list',
method: 'get',
params: query
})
}
// 查询会员等级详细
export function getUserGrade(id) {
return request({
url: '/business/userManager/userGrade/' + id,
method: 'get'
})
}
// 根据会员等级名称查询会员等级信息
export function queryUserGrade(data) {
return request({
url: '/business/userManager/userGrade/getName',
method: 'post',
data: data
})
}
// 新增会员等级
export function addUserGrade(data) {
return request({
url: '/business/userManager/userGrade',
method: 'post',
data: data
})
}
// 修改会员等级
export function updateUserGrade(data) {
return request({
url: '/business/userManager/userGrade',
method: 'put',
data: data
})
}
// 删除会员等级
export function delUserGrade(id) {
return request({
url: '/business/userManager/userGrade/' + id,
method: 'delete'
})
}

View File

@ -3,14 +3,54 @@
<div class="center-left">
<div class="center-vh">
<div class="center-left-top">
<div class="vip-bottom" @click="dialogVisiblevip = true">
<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 class="hj-box" style="justify-content: flex-end">合计: 200.52</div>
<div class="hj-box" style="justify-content: left">油品:{{ oilAmount }}</div>
<div class="hj-box" style="border-left: 1px solid #d1d1d4; border-right: 1px solid #d1d1d4;">商品:{{ goodsAmount }}</div>
<div class="hj-box" style="justify-content: flex-end">合计: {{ oilAmount + goodsAmount }}</div>
</div>
<div class="center-left-hj">
<div>满减活动</div>
@ -19,15 +59,15 @@
<div class="center-left-th">
<div class="th-box">
<div>扫码支付</div>
<div class="bule">394.7</div>
<div class="bule">{{ oilAmount + goodsAmount }}</div>
</div>
<div class="th-box">
<div>找零</div>
<div class="bule">394.7</div>
<div class="bule">0</div>
</div>
<div class="th-box">
<div>加油员</div>
<div style="cursor: pointer;color: crimson" @click="dialogVisible = true" >加油员名称</div>
<div @click="dialogVisible = true">加油员</div>
<div style="cursor: pointer;color: crimson" @click="dialogVisible = true" >{{ staff.realName }}</div>
</div>
</div>
</div>
@ -41,10 +81,10 @@
</div>
<div class="center-left-bottom">
<div>
<div class="bottom-price">349.78</div>
<div class="bottom-price">{{ oilAmount + goodsAmount }}</div>
<div class="price-red">优惠合计5.74</div>
</div>
<div class="center-left-lv" @click="dialogVisiblej = true ">立即结算</div>
<div class="center-left-lv" @click="settlement">立即结算</div>
</div>
</div>
@ -94,13 +134,13 @@
<!-- -->
<div class="content-top-bottom">
<div>订单笔数 <span class="bule">3</span> </div>
<div>订单金额 <span class="bule">2.03</span> </div>
<div>订单笔数 <span class="bule">{{ oilTotal }}</span> </div>
<div>订单金额 <span class="bule">{{ oilAmount }}</span> </div>
</div>
</div>
</div>
<div class="center-left-bottom">
<div class="bottom-gd">新增订单</div>
<div class="bottom-gd" @click="resetting">新增订单</div>
<div class="bottom-qk">解锁</div>
</div>
</div>
@ -109,16 +149,26 @@
<div class="center-top">
<div class="center-top-title">非油商品</div>
<div class="center-top-input">
<input v-model="goods" type="text"
@input="queryGoods"
placeholder="请输入商品名称,条码,商品关键词">
<!-- <input v-model="goods" type="text"-->
<!-- clearable-->
<!-- placeholder="请输入商品名称,商品关键词">-->
<template>
<el-select v-model="goods" filterable
style="width: 95%;font-size: 20px;"
@change="changeGoods"
clearable
placeholder="请输入商品名称,商品关键词">
<el-option
v-for="item in goodsList"
:key="item.id"
:label="item.name"
:value="item.id">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.retailPrice }}</span>
</el-option>
</el-select>
</template>
</div>
<el-autocomplete
v-model="goods"
:fetch-suggestions="querySearchAsync"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
<div class="center-top-data">
<div class="data-top">
<div class="data-top-title">商品</div>
@ -128,23 +178,37 @@
<div>操作</div>
</div>
</div>
<div class="data-top-box">
<div class="data-top-title">商品名称</div>
<div class="data-top-box" v-for="(item,index) in goodsOrder" :key="index">
<div class="data-top-title">{{ item.name }}</div>
<div class="data-top-three">
<div>0.01</div>
<div> <el-input-number v-model="num" size="small" controls-position="right" @change="handleChange" :min="1" :max="10"></el-input-number> </div>
<div><i class="el-icon-circle-close" style="font-size: 22px"></i></div>
<div>{{ item.retailPrice }}</div>
<div>
<el-input-number v-model="item.num" size="small" controls-position="right"
@change="handleChange" :min="1" :max="10"></el-input-number>
</div>
<div @click="delGoods(index)"><i class="el-icon-circle-close" style="font-size: 22px"></i></div>
</div>
</div>
<!-- <div class="data-top-box">-->
<!-- <div class="data-top-title">商品名称</div>-->
<!-- <div class="data-top-three">-->
<!-- <div>0.01</div>-->
<!-- <div>-->
<!-- <el-input-number v-model="num" size="small" controls-position="right"-->
<!-- @change="handleChange" :min="1" :max="10"></el-input-number>-->
<!-- </div>-->
<!-- <div><i class="el-icon-circle-close" style="font-size: 22px"></i></div>-->
<!-- </div>-->
<!-- </div>-->
<!-- -->
<div class="content-top-bottom">
<div>商品数量 <span class="bule">3</span> </div>
<div>商品总额 <span class="bule">2.03</span> </div>
<div>商品数量 <span class="bule">{{ goodsTotal }}</span> </div>
<div>商品总额 <span class="bule">{{ goodsAmount }}</span> </div>
</div>
</div>
</div>
<div class="center-left-bottom">
<div class="bottom-qk">清空</div>
<div class="bottom-qk" @click="empty">清空</div>
<div style="display: flex">
<div class="bottom-qd">取单</div>
<div class="bottom-gd">挂单</div>
@ -160,38 +224,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)"
:style="{'background-color': item.color}">
<div>{{ item.name }}</div>
<div class="of-title" >{{ item.mobile }}</div>
<div class="of-title">{{ item.realName }}</div>
<div style="text-align: center;font-size: 17px">{{ item.mobile }}</div>
</div>
<!-- <div class="of-box" v-for="(item,index) in 7" :key="index" :style="{'background-color': item.color}">-->
<!-- <div>92#</div>-->
<!-- <div class="of-title" >加油员姓名</div>-->
<!-- <div>-->
<!-- <img src="../../../assets/images/jya.png" style="width: 18px;height: 18px;">-->
<!-- </div>-->
<!-- </div>-->
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"></el-button>
<el-button @click="dialogVisible = false"> </el-button>
<!-- <el-button type="primary" @click="dialogVisible = false"> </el-button>-->
</span>
</el-dialog>
<!-- 立即结算-->
<el-dialog
title="提示"
title="扫码支付"
:visible.sync="dialogVisiblej"
width="30%"
:close-on-click-modal="false">
<div style="text-align: center;font-size: 15px;font-weight: bold">付款金额</div>
<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">
300.00
<el-tag
effect="dark">
汽油
</el-tag>
{{ oilAmount + goodsAmount }}
</div>
<div style="text-align: center;margin-bottom: 10px">
合计金额{{ oilAmount + goodsAmount }}优惠合计13.02
</div>
<div style="text-align: center;margin-bottom: 10px">赠送金额</div>
<div>
<el-input v-model="authCode"
autofocus="autofocus"
@ -224,7 +280,9 @@
width="30%"
:close-on-click-modal="false">
<div >
<el-input placeholder="会员手机号、用户昵称、实体卡号" v-model="userNo"
<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>
@ -255,7 +313,7 @@
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisiblevip = false"> </el-button>
<el-button type="primary" @click="dialogVisiblevip = false"> </el-button>
<el-button type="primary" @click="chooseUser"> </el-button>
</span>
</el-dialog>
<!-- 油号选择-->
@ -298,7 +356,38 @@
</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>
</div>
</template>
@ -306,9 +395,11 @@
import {getDicts} from "@/api/dict/data";
import {getOilNameList, getOilNumGun, getOilNumGunById, listOilNumGun} from "@/api/cashier/oilnumgun";
import {fyPay} from "@/api/cashier/pay";
import {listLJGoods} from "@/api/cashier/ljgoods";
import {getUserVoMobile} from "@/api/cashier/user";
import {queryStaffs} from "@/api/cashier/staff";
import {getLJGoods, listgoods} from "@/api/cashier/ljgoods";
import {getUserVoMobile, getUserVoName} from "@/api/cashier/user";
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
import {addLJGoods} from "@/api/cashier/oilorder";
import {getUserGrade} from "@/api/cashier/usergrade";
export default {
name: "homeindex",
@ -316,8 +407,16 @@
return{
//
oilOrder:[],
//
oilAmount:0,
//
oilTotal:0,
//
goodsOrder:[],
//
goodsAmount:0,
//
goodsTotal:0,
//
rise:[
{value:"¥100"},
@ -327,6 +426,8 @@
],
//
member:{},
//
memberList:[],
select1:'会员手机号',
//
userNo:"",
@ -350,6 +451,7 @@
dialogVisiblej: false,
dialogVisiblevip:false,
dialogVisibleamount:false,
dialogVisibleMember:false,
activeName: '1',
tabarr:[
{name:'收银台',icon:'el-icon-s-platform'},
@ -371,28 +473,146 @@
{color:'#ecfae5'},
{color:'#fafafa'}
],
restaurants:'',
num: 1,
//
oilNameList:'',
//
staffList:[],
isMember: false,
//
staff:"",
map:{
//
oilOrder:"",
//
goodsOrder:"",
//
payType:"",
//
oilAmount:"",
//
goodsAmount:"",
//
oilActualPay:"",
//
goodsActualPay:"",
//
payUser:"",
//
oilDiscount:"",
//
goodsDiscount:"",
},
gradeName:"",
}
},
created() {
this.getPayList();
this.queryGoods();
this.getOilName();
this.getGoods();
this.getStaffList();
this.getStaff();
},
methods:{
//
resetMember(){
this.member = {};
this.isMember = false;
},
//
getGrade(id){
getUserGrade(id).then( response => {
this.gradeName = response.data.name;
})
return this.gradeName;
},
//
chooseUser(){
this.dialogVisiblevip = false
this.isMember = true;
},
//
handleChoose(data){
this.member = data;
this.dialogVisibleMember = false;
},
//
empty(){
this.goodsOrder = [];
this.goodsTotal = 0;
this.goodsAmount = 0;
},
//
getStaff(){
staffInfo().then( response => {
this.staff = response.data
})
},
//
chooseStaff(data){
this.staff = data;
},
//
delGoods(index){
this.goodsOrder.splice(index,1)
},
//
changeGoods(val){
let result = true;
let goods = this.goodsOrder
if (this.goodsOrder.length>0){
let amount = 0;
for (let i = 0; i<goods.length; i++){
amount += goods[i].retailPrice * goods[i].num
if (goods[i].id == val){
goods[i].num = goods[i].num + 1;
this.goodsTotal += 1;
result = false;
break;
}else {
result = true;
}
}
this.goodsAmount = amount;
}else {
result = true;
}
if (result){
getLJGoods(val).then( response => {
response.data.num = 1
this.goodsAmount += response.data.retailPrice
this.goodsOrder.push(response.data);
this.goodsTotal += 1;
})
}
this.goods = ""
},
//
settlement(){
this.dialogVisiblej = true
},
//
resetting(){
this.oilOrder = [];
this.oilTotal = 0;
this.oilAmount = 0;
},
//
getStaffList(){
queryStaffs().then( response => {
this.staffList = response.data
})
},
//
//
getOilOrder(){
this.dialogVisibleamount = false
this.oilOrder.push(this.form)
if (this.select == "元"){
this.oilAmount = +this.form.amount + this.oilAmount;
}else {
this.oilAmount = +(this.form.oilPrice * this.form.amount) + this.oilAmount;
}
this.oilTotal += 1;
},
// L
@ -439,48 +659,24 @@
this.oilNameList = response.data;
})
},
//
getUser(){
getUserVoMobile({mobile:this.userNo}).then( response => {
this.member = response.data
// console.log(this.member)
})
},
querySearchAsync(queryString, cb) {
var restaurants = this.goodsList;
// console.log(queryString)
this.goodsList.forEach(item => {
item.indexOf(queryString)
})
},
handleSelect(item) {
// console.log(item);
},
//
queryGoods(val){
// console.log(this.goods)
let map = {
page:1,
pageSize:40,
name:this.goods,
isRecovery:0,
if(this.select1=="会员手机号"){
getUserVoMobile({mobile:this.userNo}).then( response => {
this.member = response.data
})
}else {
getUserVoName({name:this.userNo}).then( response => {
this.memberList = response.data
})
this.dialogVisibleMember = true;
}
let map1 = {
page:1,
pageSize:40,
goodsNo:this.goods,
isRecovery:0,
}
listLJGoods(map).then( response => {
if(response.data.records!=null){
this.goodsList = response.data.records
}
},
//
getGoods(){
listgoods().then( response => {
this.goodsList = response.data
})
listLJGoods(map1).then( response => {
if(response.data.records!=null){
this.goodsList = response.data.records
}
})
// console.log(this.goodsList)
},
//
refuel(id){
@ -492,17 +688,24 @@
},
//
collection(){
let map = {
authCode : this.authCode,
orderNo : "0000055"
}
// console.log(map)
fyPay(map).then( response => {
// console.log(response)
// JSON.parse()
this.map.oilOrder = JSON.stringify(this.oilOrder);
this.map.goodsOrder = JSON.stringify(this.goodsOrder);
addLJGoods(this.map).then( response => {
console.log(response)
})
// let map = {
// authCode : this.authCode,
// orderNo : "0000055"
// }
// // console.log(map)
// fyPay(map).then( response => {
// // console.log(response)
// })
},
//
payMethod(payType){
// console.log(payType)
this.map.payType = payType;
},
//
getPayList(){
@ -526,7 +729,15 @@
.catch(_ => {});
},
handleChange(value) {
// console.log(value);
let goods = this.goodsOrder;
let num = 0;
let amount = 0;
goods.forEach(item => {
num += item.num
amount += item.retailPrice*item.num
})
this.goodsTotal = num;
this.goodsAmount = amount;
},
handleClick(tab, event) {
let oilNum = ""
@ -545,7 +756,7 @@
gocomponents(index){
this.leftindex = index
},
}
},
}
</script>