收银台
This commit is contained in:
parent
9e2b9068a2
commit
a3f8c672f1
@ -7,8 +7,11 @@ import com.fuint.business.order.service.LJOrderService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 订单信息 controller层
|
||||
*/
|
||||
@ -36,11 +39,12 @@ public class LJOrderController extends BaseController {
|
||||
|
||||
/**
|
||||
* 根据订单号查询订单信息
|
||||
* @param orderNo
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{orderNo}")
|
||||
public ResponseObject goodsOrder(@PathVariable String orderNo){
|
||||
@PostMapping("/orderNo")
|
||||
public ResponseObject goodsOrder(@Validated @RequestBody Map<String,String> map){
|
||||
String orderNo = map.get("orderNo");
|
||||
LJOrder ljOrder = orderService.selectGoodsOrder(orderNo);
|
||||
return getSuccessResult(ljOrder);
|
||||
}
|
||||
|
@ -42,17 +42,18 @@ public class OilOrderController extends BaseController {
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(@Validated @RequestBody Map<String,String> map){
|
||||
String order = orderService.insertOilOrder(map);
|
||||
Map<String, Object> order = orderService.insertOilOrder(map);
|
||||
return getSuccessResult(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单号查询订单信息
|
||||
* @param orderNo
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{orderNo}")
|
||||
public ResponseObject goodsOrder(@PathVariable String orderNo){
|
||||
@PostMapping("/orderNo")
|
||||
public ResponseObject oilOrder(@Validated @RequestBody Map<String,String> map){
|
||||
String orderNo = map.get("orderNo");
|
||||
OilOrder order = orderService.selectOilOrderByOrderNo(orderNo);
|
||||
return getSuccessResult(order);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public interface OilOrderService extends IService<OilOrder> {
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public String insertOilOrder(Map<String ,String> map);
|
||||
public Map<String,Object> insertOilOrder(Map<String ,String> map);
|
||||
|
||||
/**
|
||||
* 添加油品订单信息
|
||||
|
@ -16,6 +16,8 @@ import com.fuint.business.order.mapper.OilOrderMapper;
|
||||
import com.fuint.business.order.service.LJOrderService;
|
||||
import com.fuint.business.order.service.OilOrderService;
|
||||
import com.fuint.business.order.service.OrderGoodsService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -34,6 +36,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
private FyPayService fyPayService;
|
||||
@Autowired
|
||||
private MerchantConfigService merchantConfigService;
|
||||
@Autowired
|
||||
private UserBalanceService userBalanceService;
|
||||
|
||||
@Override
|
||||
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
|
||||
@ -53,7 +57,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public String insertOilOrder(Map<String ,String> map) {
|
||||
public Map<String,Object> insertOilOrder(Map<String ,String> map) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
// 油品订单信息
|
||||
@ -83,10 +87,20 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
Double goodsDiscount = Double.valueOf(map.get("goodsDiscount"));
|
||||
// 员工id
|
||||
Integer staffId = Integer.valueOf(map.get("staffId"));
|
||||
// 会员消费金额(储值卡需要减少的金额)
|
||||
Double consumeAmount = Double.valueOf(map.get("consumeAmount"));
|
||||
Integer userId = null;
|
||||
if (map.get("userId") != null && !map.get("userId").equals("")){
|
||||
// 会员id
|
||||
userId = Integer.valueOf(map.get("userId"));
|
||||
|
||||
// 根据用户id查询用户余额信息
|
||||
UserBalance balance = userBalanceService.selectUserBalance(userId);
|
||||
// 修改余额信息
|
||||
double beforeBalance = balance.getCardBalance();
|
||||
double afterBalance = beforeBalance - consumeAmount;
|
||||
balance.setCardBalance(afterBalance);
|
||||
userBalanceService.updateUserBalance(balance);
|
||||
}
|
||||
// 优惠券id
|
||||
Integer couponId = null;
|
||||
@ -102,6 +116,14 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
// 终端
|
||||
String terminal = map.get("terminal");
|
||||
|
||||
// 支付状态
|
||||
String payStatus = "unpaid";
|
||||
if (payType.equals("CASH")){
|
||||
payStatus = "paid";
|
||||
}else {
|
||||
payStatus = "unpaid";
|
||||
}
|
||||
|
||||
// 根据日期生成订单信息
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
@ -136,7 +158,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
order.setPayUser(payUser);
|
||||
order.setPayType(payType);
|
||||
order.setInvoicing("未开票");
|
||||
order.setOrderStatus("unpaid");
|
||||
order.setOrderStatus(payStatus);
|
||||
baseMapper.insert(order);
|
||||
oilOrder1 = this.selectOilOrderByOrderNo(orderNo);
|
||||
}
|
||||
@ -158,7 +180,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
ljOrder.setPointAmount(pointAmount);
|
||||
ljOrder.setDiscount(goodsDiscount);
|
||||
ljOrder.setStaffId(staffId);
|
||||
ljOrder.setStatus("unpaid");
|
||||
ljOrder.setStatus(payStatus);
|
||||
orderService.insertGoodOrder(ljOrder);
|
||||
// 将油品订单的json数据转换为数组
|
||||
List<JSONObject> goods = JSONArray.parseArray(goodsOrder, JSONObject.class);
|
||||
@ -177,50 +199,59 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
ljOrder1 = orderService.selectGoodsOrder(orderNo);
|
||||
}
|
||||
|
||||
// 根据店铺id查询商户配置信息
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByStoreId(storeId);
|
||||
// 如果金额不等于0调用第三方支付接口
|
||||
if (!map.get("allAmount").equals("0") && !map.get("payType").equals("CASH")){
|
||||
Integer allAmount = (int) (Double.valueOf(map.get("allAmount"))*100);
|
||||
// 根据店铺id查询商户配置信息
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByStoreId(storeId);
|
||||
// 处理支付需要的数据
|
||||
Map<String,String> map1 = new HashMap<>();
|
||||
map1.put("authCode",map.get("authCode"));
|
||||
map1.put("allAmount",allAmount.toString());
|
||||
map1.put("orderNo",orderNo);
|
||||
map1.put("payType",map.get("payType"));
|
||||
map1.put("insCd",merchantConfig.getInsCd());
|
||||
map1.put("mchntCd",merchantConfig.getMchntCd());
|
||||
map1.put("goodsDes",merchantConfig.getMerchantName());
|
||||
map1.put("publicKey",merchantConfig.getPublicKey());
|
||||
map1.put("privateKey",merchantConfig.getPrivateKey());
|
||||
|
||||
// 调用支付接口
|
||||
Map<String,String> map1 = new HashMap<>();
|
||||
map1.put("authCode",map.get("authCode"));
|
||||
Integer allAmount = (int) (Double.valueOf(map.get("allAmount"))*100);
|
||||
map1.put("allAmount",allAmount.toString());
|
||||
map1.put("orderNo",orderNo);
|
||||
map1.put("payType",map.get("payType"));
|
||||
map1.put("insCd",merchantConfig.getInsCd());
|
||||
map1.put("mchntCd",merchantConfig.getMchntCd());
|
||||
map1.put("goodsDes",merchantConfig.getMerchantName());
|
||||
map1.put("publicKey",merchantConfig.getPublicKey());
|
||||
map1.put("privateKey",merchantConfig.getPrivateKey());
|
||||
|
||||
try {
|
||||
Map<String, String> pay = fyPayService.pay(map1);
|
||||
String resultCode = pay.get("result_code");
|
||||
if (resultCode.equals("000000")){
|
||||
if (oilOrder1!=null){
|
||||
oilOrder1.setOrderStatus("paid");
|
||||
oilOrder1.setPayTime(new Date());
|
||||
this.updateOilOrder(oilOrder1);
|
||||
}
|
||||
if (ljOrder1!=null){
|
||||
ljOrder1.setStatus("paid");
|
||||
ljOrder1.setPayTime(new Date());
|
||||
orderService.updateGoodOrder(ljOrder1);
|
||||
}
|
||||
}else {
|
||||
if (oilOrder1!=null){
|
||||
oilOrder1.setOrderStatus("unpaid");
|
||||
this.updateOilOrder(oilOrder1);
|
||||
}
|
||||
if (ljOrder1!=null){
|
||||
ljOrder1.setStatus("unpaid");
|
||||
orderService.updateGoodOrder(ljOrder1);
|
||||
// 调用支付接口
|
||||
try {
|
||||
Map<String, String> pay = fyPayService.pay(map1);
|
||||
String resultCode = pay.get("result_code");
|
||||
if (resultCode.equals("000000")){
|
||||
if (oilOrder1!=null){
|
||||
oilOrder1.setOrderStatus("paid");
|
||||
oilOrder1.setPayTime(new Date());
|
||||
this.updateOilOrder(oilOrder1);
|
||||
}
|
||||
if (ljOrder1!=null){
|
||||
ljOrder1.setStatus("paid");
|
||||
ljOrder1.setPayTime(new Date());
|
||||
orderService.updateGoodOrder(ljOrder1);
|
||||
}
|
||||
}else {
|
||||
if (oilOrder1!=null){
|
||||
oilOrder1.setOrderStatus("unpaid");
|
||||
this.updateOilOrder(oilOrder1);
|
||||
}
|
||||
if (ljOrder1!=null){
|
||||
ljOrder1.setStatus("unpaid");
|
||||
orderService.updateGoodOrder(ljOrder1);
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return orderNo;
|
||||
|
||||
Map<String,Object> orders = new HashMap<>();
|
||||
OilOrder oilOrder2 = this.selectOilOrderByOrderNo(orderNo);
|
||||
LJOrder goodsOrder1 = orderService.selectGoodsOrder(orderNo);
|
||||
orders.put("oilOrder",oilOrder2);
|
||||
orders.put("goodsOrder",goodsOrder1);
|
||||
return orders;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,4 +4,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
|
||||
public interface UserBalanceMapper extends BaseMapper<UserBalance> {
|
||||
|
||||
}
|
||||
|
@ -20,4 +20,18 @@ public interface UserBalanceService extends IService<UserBalance> {
|
||||
* @param userId
|
||||
*/
|
||||
public void deleteUserBalanceByUserId(Integer userId);
|
||||
|
||||
/**
|
||||
* 根据用户id修改储值卡金额
|
||||
* @param balance
|
||||
* @return
|
||||
*/
|
||||
public int updateUserBalance(UserBalance balance);
|
||||
|
||||
/**
|
||||
* 根据用户id查询用户余额信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public UserBalance selectUserBalance(int userId);
|
||||
}
|
||||
|
@ -24,4 +24,18 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
queryWrapper.eq("mt_user_id",userId);
|
||||
baseMapper.delete(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateUserBalance(UserBalance balance) {
|
||||
int row = baseMapper.updateById(balance);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserBalance selectUserBalance(int userId) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("mt_user_id",userId);
|
||||
UserBalance balance = baseMapper.selectOne(queryWrapper);
|
||||
return balance;
|
||||
}
|
||||
}
|
||||
|
@ -19,17 +19,19 @@ export function addLJGoods(data) {
|
||||
}
|
||||
|
||||
// 根据订单号查询油品订单信息
|
||||
export function oilOrder(orderNo) {
|
||||
export function oilOrder(data) {
|
||||
return request({
|
||||
url: `/business/oilOrder/${orderNo}`,
|
||||
method: 'get'
|
||||
url: '/business/oilOrder/orderNo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据订单号查询商品订单信息
|
||||
export function goodsOrder(orderNo) {
|
||||
export function goodsOrder(data) {
|
||||
return request({
|
||||
url: `/business/order/${orderNo}`,
|
||||
method: 'get'
|
||||
url: '/business/order/orderNo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -56,6 +56,17 @@
|
||||
<div>满减活动</div>
|
||||
<div>-¥{{ oilDiscount + goodsDiscount }}</div>
|
||||
</div>
|
||||
<div class="center-left-hj">
|
||||
<div>充值优惠</div>
|
||||
<div>-¥0</div>
|
||||
</div>
|
||||
<div class="center-left-hj">
|
||||
<div>
|
||||
储值卡
|
||||
<span>(账户余额:{{ balance }}元)</span>
|
||||
</div>
|
||||
<div>-¥{{ consumeAmount }}</div>
|
||||
</div>
|
||||
<div class="center-left-th">
|
||||
<div class="th-box">
|
||||
<div>扫码支付</div>
|
||||
@ -131,8 +142,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="center-left-bottom">
|
||||
<div class="bottom-gd" @click="resetting">新增订单</div>
|
||||
<div class="bottom-qk">解锁</div>
|
||||
<div class="bottom-gd" @click="resetting">重置</div>
|
||||
<!-- <div class="bottom-qk">解锁</div>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -140,9 +151,6 @@
|
||||
<div class="center-top">
|
||||
<div class="center-top-title">非油商品</div>
|
||||
<div class="center-top-input">
|
||||
<!-- <input v-model="goods" type="text"-->
|
||||
<!-- clearable-->
|
||||
<!-- placeholder="请输入商品名称,商品关键词">-->
|
||||
<template>
|
||||
<el-select v-model="goods" filterable
|
||||
style="width: 95%;font-size: 20px;"
|
||||
@ -164,7 +172,8 @@
|
||||
<div class="data-top">
|
||||
<div class="data-top-title">商品</div>
|
||||
<div class="data-top-three">
|
||||
<div>单价</div>
|
||||
<div v-if="isMember == false">单价</div>
|
||||
<div v-else>会员价</div>
|
||||
<div>数量</div>
|
||||
<div>操作</div>
|
||||
</div>
|
||||
@ -172,7 +181,8 @@
|
||||
<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>{{ item.retailPrice }}</div>
|
||||
<div v-if="isMember == false">{{ item.retailPrice }}</div>
|
||||
<div v-else>{{ item.memberPrice }}</div>
|
||||
<div>
|
||||
<el-input-number v-model="item.num" size="small" controls-position="right"
|
||||
@change="handleChange" :min="1" :max="10"></el-input-number>
|
||||
@ -180,18 +190,6 @@
|
||||
<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">{{ goodsTotal }}件</span> </div>
|
||||
<div>商品总额 <span class="bule">¥{{ goodsAmount }}</span> </div>
|
||||
@ -316,7 +314,7 @@
|
||||
<div v-if="isPay">
|
||||
<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">
|
||||
¥{{ oilAmount + goodsAmount }}
|
||||
¥{{ oilActualPay + goodsActualPay }}
|
||||
</div>
|
||||
<div style="text-align: center;margin-bottom: 10px">
|
||||
合计金额:{{ oilAmount + goodsAmount }}元、优惠合计13.02元
|
||||
@ -428,13 +426,14 @@
|
||||
<span class="amountBlue">{{ form.oilPrice }}元/L</span>
|
||||
</div>
|
||||
<div >
|
||||
<el-input v-model="form.amount" placeholder="请输入加油金额"
|
||||
<el-input v-model="amount" @input="form.amount = amount" placeholder="请输入加油金额"
|
||||
style="font-weight: 700;text-align: center;font-size: 20px;">
|
||||
<el-select v-model="select" style="width: 70px" @change="changeSelect" slot="append" placeholder="请选择">
|
||||
<el-option label="元" value="元"></el-option>
|
||||
<el-option label="L" value="L"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
<!-- <el-input v-model="form.amount"></el-input>-->
|
||||
</div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6" v-for="(item,index) in rise" :key="index">
|
||||
@ -485,7 +484,6 @@
|
||||
<script>
|
||||
import {getDicts} from "@/api/dict/data";
|
||||
import {getOilNameList, getOilNumGun, getOilNumGunById, listOilNumGun} from "@/api/cashier/oilnumgun";
|
||||
import {fyPay} from "@/api/cashier/pay";
|
||||
import {getLJGoods, listgoods} from "@/api/cashier/ljgoods";
|
||||
import {getUserVoMobile, getUserVoName} from "@/api/cashier/user";
|
||||
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
|
||||
@ -496,6 +494,13 @@
|
||||
name: "homeindex",
|
||||
data(){
|
||||
return{
|
||||
// 会员消费金额(储值卡需要减少的金额)
|
||||
consumeAmount:0,
|
||||
// 账户余额
|
||||
balance:0,
|
||||
// 绑定数据
|
||||
amount:'',
|
||||
// 等待中
|
||||
loading:false,
|
||||
// 油品类型
|
||||
oilType:'',
|
||||
@ -635,12 +640,15 @@
|
||||
terminal:"PC",
|
||||
// 商品数量
|
||||
goodsNum:0,
|
||||
// 会员消费金额(储值卡需要减少的金额)
|
||||
consumeAmount:0,
|
||||
},
|
||||
gradeName:"",
|
||||
menu:1,
|
||||
index:0,
|
||||
isPay:true,
|
||||
isPaySuccess:false,
|
||||
orderNo:'',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -657,9 +665,14 @@
|
||||
this.goodsOrder = list;
|
||||
let num = 0;
|
||||
let amount = 0;
|
||||
let _this = this;
|
||||
list.forEach(item => {
|
||||
num += item.num;
|
||||
amount += item.retailPrice;
|
||||
if (_this.isMember){
|
||||
amount += item.memberPrice;
|
||||
}else {
|
||||
amount += item.retailPrice;
|
||||
}
|
||||
})
|
||||
this.goodsTotal = num;
|
||||
this.goodsAmount = amount;
|
||||
@ -690,21 +703,24 @@
|
||||
resetMember(){
|
||||
this.member = {};
|
||||
this.isMember = false;
|
||||
this.map.payUser == ""
|
||||
this.map.payUser == "";
|
||||
this.balance = 0;
|
||||
this.userNo = "";
|
||||
this.handleChange();
|
||||
},
|
||||
// 获取会员等级信息
|
||||
getGrade(id){
|
||||
getUserGrade(id).then( response => {
|
||||
this.gradeName = response.data.name;
|
||||
if (this.oilType == "汽油"){
|
||||
|
||||
}
|
||||
if (this.oilType == "柴油"){
|
||||
|
||||
}
|
||||
if (this.oilType == "天然气"){
|
||||
|
||||
}
|
||||
// if (this.oilType == "汽油"){
|
||||
//
|
||||
// }
|
||||
// if (this.oilType == "柴油"){
|
||||
//
|
||||
// }
|
||||
// if (this.oilType == "天然气"){
|
||||
//
|
||||
// }
|
||||
})
|
||||
return this.gradeName;
|
||||
},
|
||||
@ -714,6 +730,15 @@
|
||||
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;
|
||||
}
|
||||
this.handleChange();
|
||||
},
|
||||
// 选择会员信息
|
||||
handleChoose(data){
|
||||
@ -746,11 +771,16 @@
|
||||
// 添加商品列表信息
|
||||
changeGoods(val){
|
||||
let result = true;
|
||||
let goods = this.goodsOrder
|
||||
let goods = this.goodsOrder;
|
||||
let _this = this;
|
||||
if (this.goodsOrder.length>0){
|
||||
let amount = 0;
|
||||
for (let i = 0; i<goods.length; i++){
|
||||
amount += goods[i].retailPrice * goods[i].num
|
||||
if (_this.isMember){
|
||||
amount += goods[i].memberPrice * goods[i].num
|
||||
}else {
|
||||
amount += goods[i].retailPrice * goods[i].num
|
||||
}
|
||||
if (goods[i].id == val){
|
||||
goods[i].num = goods[i].num + 1;
|
||||
this.goodsTotal += 1;
|
||||
@ -767,8 +797,12 @@
|
||||
}
|
||||
if (result){
|
||||
getLJGoods(val).then( response => {
|
||||
response.data.num = 1
|
||||
this.goodsAmount += response.data.retailPrice
|
||||
response.data.num = 1;
|
||||
if (_this.isMember){
|
||||
this.goodsAmount += response.data.memberPrice
|
||||
}else {
|
||||
this.goodsAmount += response.data.retailPrice
|
||||
}
|
||||
this.goodsActualPay = this.goodsAmount - this.goodsDiscount;
|
||||
this.goodsOrder.push(response.data);
|
||||
this.goodsTotal += 1;
|
||||
@ -786,6 +820,7 @@
|
||||
this.oilActualPay = 0;
|
||||
this.oilTotal = 0;
|
||||
this.oilAmount = 0;
|
||||
this.amount = "";
|
||||
},
|
||||
// 获取员工列表
|
||||
getStaffList(){
|
||||
@ -799,12 +834,23 @@
|
||||
this.oilOrder.push(this.form)
|
||||
if (this.select == "元"){
|
||||
this.oilAmount = +this.form.amount + this.oilAmount;
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount;
|
||||
if (this.balance!=0){
|
||||
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;
|
||||
}
|
||||
}else {
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount;
|
||||
}
|
||||
}else {
|
||||
this.oilAmount = +(this.form.oilPrice * this.form.amount) + this.oilAmount;
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount;
|
||||
}
|
||||
this.oilTotal += 1;
|
||||
this.select = "元";
|
||||
},
|
||||
// 选择“元”或“L”
|
||||
changeSelect(){
|
||||
@ -827,8 +873,10 @@
|
||||
// 改变加油金额
|
||||
changeAmount(amount){
|
||||
if (this.select == "元"){
|
||||
this.amount = amount.slice(1)
|
||||
this.form.amount = amount.slice(1)
|
||||
}else {
|
||||
this.amount = amount.slice(0,3)
|
||||
this.form.amount = amount.slice(0,3)
|
||||
}
|
||||
},
|
||||
@ -856,7 +904,11 @@
|
||||
getUser(){
|
||||
if(this.select1=="会员手机号"){
|
||||
getUserVoMobile({mobile:this.userNo}).then( response => {
|
||||
this.member = response.data
|
||||
if (response.data!=null){
|
||||
this.member = response.data
|
||||
}else {
|
||||
this.$modal.msgError("会员信息不存在")
|
||||
}
|
||||
})
|
||||
}else {
|
||||
getUserVoName({name:this.userNo}).then( response => {
|
||||
@ -873,6 +925,7 @@
|
||||
},
|
||||
// 加油金额
|
||||
refuel(id){
|
||||
this.amount = ""
|
||||
this.form.amount = ""
|
||||
this.dialogVisibleamount = true;
|
||||
getOilNumGunById(id).then( response => {
|
||||
@ -895,32 +948,51 @@
|
||||
this.map.allAmount = this.map.oilActualPay + this.map.goodsActualPay;
|
||||
|
||||
let _this = this;
|
||||
let orderNo = "";
|
||||
addLJGoods(this.map).then( response => {
|
||||
orderNo = response.data
|
||||
})
|
||||
oilOrder(orderNo).then( response => {
|
||||
if (response.data.orderStatus == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
addLJGoods(_this.map).then( response => {
|
||||
if (response.data.oilOrder!=null){
|
||||
if (response.data.oilOrder.orderStatus == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
}
|
||||
}
|
||||
if (response.data.goodsOrder!=null){
|
||||
if (response.data.goodsOrder.status == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
goodsOrder(orderNo).then( response => {
|
||||
if (response.data.status == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
}})
|
||||
this.loading = true;
|
||||
this.isPay = false;
|
||||
setTimeout(function (){
|
||||
_this.loading = false;
|
||||
},1000);
|
||||
this.authCode = "";
|
||||
if (_this.isPaySuccess == true){
|
||||
_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;
|
||||
}
|
||||
},
|
||||
handClose(){
|
||||
if(this.isPaySuccess = false){
|
||||
this.isPay = true;
|
||||
}else {
|
||||
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.dialogVisiblej = false
|
||||
this.isPay = true;
|
||||
this.isPaySuccess = false;
|
||||
},
|
||||
// 支付方式
|
||||
@ -948,19 +1020,22 @@
|
||||
})
|
||||
.catch(_ => {});
|
||||
},
|
||||
handleOpen(key, keyPath) {
|
||||
// console.log(key, keyPath);
|
||||
},
|
||||
handleChange(value) {
|
||||
let goods = this.goodsOrder;
|
||||
let num = 0;
|
||||
let amount = 0;
|
||||
let _this = this;
|
||||
goods.forEach(item => {
|
||||
num += item.num
|
||||
amount += item.retailPrice*item.num
|
||||
if (_this.isMember){
|
||||
amount += item.memberPrice*item.num;
|
||||
}else {
|
||||
amount += item.retailPrice*item.num;
|
||||
}
|
||||
})
|
||||
this.goodsTotal = num;
|
||||
this.goodsAmount = amount;
|
||||
this.goodsActualPay = this.goodsAmount - this.goodsDiscount;
|
||||
},
|
||||
handleClick(tab, event) {
|
||||
let oilNum = ""
|
||||
|
Loading…
Reference in New Issue
Block a user