Merge remote-tracking branch 'origin/master'

This commit is contained in:
齐天大圣 2024-01-20 10:44:46 +08:00
commit 3df54fd625
30 changed files with 642 additions and 276 deletions

View File

@ -167,7 +167,6 @@
<div>赠送<span class="amount">{{ item.giftBalance }}</span></div>
</div>
</div>
<div style="width: 30%;margin-left: 13px;margin-top: 8px;"
:class="activeKey === cardValueList.length ? 'select' : ''"
@click="rechargeCard(cardValueList.length,-1)">
@ -421,6 +420,13 @@
</template>
</el-result>
</div>
<div v-else-if="isAwait">
<el-result icon="warning" 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">
@ -876,6 +882,7 @@ export default {
isPay: true,
isPaySuccess: false,
isAwait: false,
isQuery: true,
payList: [],
@ -1113,7 +1120,7 @@ export default {
this.cardValueList.sort((a, b) => a.rechargeBalance - b.rechargeBalance);
// console.log("this.grade.name",this.grade)
})
// console.log("this.cardValueList", this.grade)
console.log("123123123123123123123t")
if (this.cardValueList.length > 0) {
//
@ -1126,8 +1133,12 @@ export default {
this.cardValueList = this.cardValueList.filter(item => {
return item.groupOriented === "1";
});
if (this.cardValueList.length > 0) {
this.rechargeCard(0);
}
}
}
this.$forceUpdate();
},
valueAmoutChange(data) {
@ -1264,13 +1275,13 @@ export default {
//
//
userRecharge() {
async userRecharge() {
this.getCardFuelDieselList()
this.getCardValueList()
this.getCountOilType()
await this.getCardFuelDieselList()
await this.getCardValueList()
await this.getCountOilType()
this.getPayList();
await this.getPayList();
this.openRecharge = true;
this.title = '会员充值'
@ -1307,9 +1318,6 @@ export default {
this.openConfirm = true;
this.isPay = true
// console.log("11111",this.isPay)
// this.isPaySuccess=false
this.title = this.payment
},
//
@ -1433,8 +1441,8 @@ export default {
},
//
async collection() {
let userForm = this.form
if (this.flag === 1) {
@ -1493,9 +1501,10 @@ export default {
clearInterval(timer);
this_.loading = false;
this_.isPay = false;
this.isPaySuccess = false;
this_.isPaySuccess = false;
this_.isAwait = true;
console.log("t3")
}, 10000)
}, 15000)
} else if (this.flag === 2) {
if (!this.authCode && this.cardFuelDieselForm.paymentType !== "CASH") {
@ -1551,9 +1560,10 @@ export default {
clearInterval(timer);
this_.loading = false;
this_.isPay = false;
this.isPaySuccess = false;
this_.isPaySuccess = false;
this_.isAwait = true;
}, 30000)
}, 15000)
let this_ = this
}
@ -1600,13 +1610,26 @@ export default {
points: '', //
growthValue: '', //
remark: '',
paymentType: '', //
paymentType: 'WECHAT', //
royaltyType: '',//
percentageCommissions: null,
amountCommission: null,
rechargeType: '0'
}
this.cardFuelDieselForm = {
mtStaffId: '',
realName: '',
staffMobile: '',
points: '',
remark: '',
rechargeBalance: '', //
paymentType: 'WECHAT',
payType:'',
oilType: '',
type: '',
chainStorId: '',
incomeLitres: '',
},
//
this.getUserInfo();
this.getInformation();
@ -1656,6 +1679,7 @@ export default {
this.cardValueForm = {}
this.cardFuelDieselForm = {}
this.iniz()
},
cancelCollection() {
this.openConfirm = false;

View File

@ -400,6 +400,7 @@ export default {
submitOilConfig(){
this.$refs["form"].validate(valid => {
if (valid) {
this.form.storeId = this.merchantConfig.storeId
if (this.form.id) {
editOilConfig(this.form).then(response => {
this.$modal.msgSuccess("修改通道成功");

View File

@ -195,7 +195,6 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
}
}
}
}catch (Exception e){
e.printStackTrace();
return false;

View File

@ -10,6 +10,7 @@ import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.service.OilConfigService;
import com.fuint.api.fuyou.vo.OilConfigVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
@ -119,7 +120,12 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
@Override
public int insertOilConfig(OilConfigVo oilConfig) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
Integer storeId = null;
if (oilConfig.getStoreId()==null){
storeId = nowAccountInfo.getStoreId();
}else {
storeId = oilConfig.getStoreId();
}
OilConfig config = new OilConfig();
config.setMerchConfigId(oilConfig.getMerchConfigId());
config.setStoreId(storeId);

View File

@ -8,6 +8,7 @@ import com.fuint.business.convenienceSore.entity.LJGoods;
import com.fuint.business.convenienceSore.service.LJGoodsService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -129,4 +130,10 @@ public class LJGoodsController extends BaseController {
return getSuccessResult(goodsService.editGoodsInventory(goods));
}
@GetMapping("determineTheInventoryOfTheProduct")
public ResponseObject determineTheInventoryOfTheProduct(@Param("id") Integer id, @Param("stock") Integer stock) {
return getSuccessResult(goodsService.determineTheInventoryOfTheProduct(id,stock));
}
}

View File

@ -82,4 +82,6 @@ public interface LJGoodsService extends IService<LJGoods> {
boolean editGoodsInventory(LJGoodsDto goods);
boolean subtractGoodesStockByLock(@Param("id") Integer id, @Param("stock") Integer stock);
boolean determineTheInventoryOfTheProduct(@Param("id") Integer id, @Param("stock") Integer stock);
}

View File

@ -287,4 +287,15 @@ public class LJGoodsServiceImpl extends ServiceImpl<LJGoodsMapper, LJGoods> impl
return true;
}
// 判断商品库存是否足够
@Override
public boolean determineTheInventoryOfTheProduct(@Param("id") Integer id, @Param("stock") Integer stock) {
LJGoods ljGoods = baseMapper.selectById(id);
if (stock.compareTo(ljGoods.getStock())>0) {
return false;
}
return true;
}
}

View File

@ -1,8 +1,12 @@
package com.fuint.business.integral.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.convenienceSore.entity.LJGoods;
import com.fuint.business.convenienceSore.service.LJGoodsService;
import com.fuint.business.integral.entity.IntegralGift;
import com.fuint.business.integral.entity.IntegralGiftCategory;
import com.fuint.business.integral.mapper.IntegralGiftMapper;
import com.fuint.business.integral.service.IntegralGiftService;
import com.fuint.business.integral.service.IntegralOrdersService;
@ -79,6 +83,7 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
*/
@Override
public IntegralGift insert(IntegralGift integralGift) {
determineTheInventoryOfTheProduct(integralGift);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
integralGift.setStoreId(nowAccountInfo.getStoreId());
integralGift.setCreateBy(nowAccountInfo.getStaffId().toString());
@ -94,10 +99,31 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
*/
@Override
public IntegralGift update(IntegralGift integralGift) {
determineTheInventoryOfTheProduct(integralGift);
this.integralGiftDao.update(integralGift);
return this.queryById(integralGift.getId());
}
@Resource
LJGoodsService ljGoodsService;
/**
* 判断商品库存是否足够
*/
public boolean determineTheInventoryOfTheProduct(IntegralGift integralGift) {
if ("实物商品".equals(integralGift.getGiftType())) {
if (ObjectUtil.isNotEmpty(integralGift.getGoodsId())) {
LJGoods byId = ljGoodsService.getById(integralGift.getGoodsId());
if (integralGift.getTotalInventory().compareTo(byId.getStock())>0){
throw new RuntimeException("该商品库存不足,可用库存“"+byId.getStock()+"");
}
}
}
return true;
}
/**
* 通过主键删除数据
*

View File

@ -190,6 +190,10 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
}
// 插入订单
List<IntegralOrders> integralOrdersList1 = integralOrdersList.getIntegralOrdersList();
// 当积分兑换为商品是需要判断库存是否足够
if (integralOrdersList1.size() < 0) return null;
@ -315,13 +319,13 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
@Transactional
public IntegralOrders checkTheStatusOfYourPaymentByIntegral(String orderNo) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 查询订单信息
// List<IntegralOrders> listByOrderNo = integralOrdersDao.getListByOrderNo2(orderNo, nowAccountInfo.getStoreId());
List<IntegralOrders> listByOrderNo = integralOrdersDao.getListByOrderNo2(orderNo);
// 加锁 processing_status
String lockKey = "IntegralOrders"+nowAccountInfo.getStoreId()+orderNo;
String lockKey = "IntegralOrders"+orderNo;
Boolean isLock = redisLock.tryLock(lockKey, 5000, TimeUnit.MILLISECONDS);
if (isLock && "paid".equals(listByOrderNo.get(0).getStatus()) && "0".equals(listByOrderNo.get(0).getProcessingStatus()) ) {
// 查询用户信息

View File

@ -242,7 +242,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 支付状态
String payStatus = "unpaid";
if (payType.equals("CASH")){
if (payType.equals("CASH") || map.get("allAmount").equals("0")){
payStatus = "paid";
}else {
payStatus = "unpaid";
@ -482,8 +482,9 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
*/
private Map<String,String> updateUserBalanceAndInsetOrder(int userId,Map<String, String> map,Double oilAmount,List<JSONObject> oilOrders,Integer storeId){
Map<String,String> res = new HashMap<>();
LJStore store = storeService.selectStoreByStoreId(storeId);
// 根据userId查询用户储值卡信息
UserBalance balance = userBalanceService.selectUserBalanceByStorId(userId,storeId);
UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId());
// 根据用户id查询用户信息
LJUserVo userVo1 = userService.selectUserById(userId,storeId);
@ -632,6 +633,44 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}else {
res.put("error","囤油卡或储值卡余额不足!");
}
}else {
Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString());
Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString());
flag = true;
status = "paid";
Double oilNum = amount / oilPrice;
oilLiters += oilNum;
if (i == 0) {
order.setOrderType("主订单");
order.setOrderAmount(amount);
order.setPayAmount(amount);
order.setOrderNo(orderNo);
} else {
order.setOrderType("子订单");
order.setOrderAmount(amount);
order.setPayAmount(0.0);
order.setOrderNo(orderNo + "1");
}
order.setStoreId(accountInfo.getStoreId());
order.setUserId(userId);
order.setCommissionAmount(Double.valueOf(map.get("commissionAmount")));
order.setStaffId(Integer.valueOf(map.get("staffId")));
order.setTerminal(map.get("terminal"));
order.setOils((String) oilOrders.get(i).get("oilName"));
order.setOilGunNum(oilOrders.get(i).get("gunName").toString());
order.setOilNum(oilNum);
// order.setDiscountAmount(Double.valueOf(map.get("oilDiscount")));
order.setPayUser(userVo1.getMobile());
order.setPayType(map.get("payType"));
order.setInvoicing("未开票");
order.setOrderStatus("paid");
order.setPayTime(new Date());
this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId());
baseMapper.insert(order);
oilOrder = this.selectOilOrderByOrderNo(orderNo);
this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId,orderNo);
}
}
@ -725,65 +764,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
res.put("error","储值卡余额不足!");
}
}
// } else {
//// 添加油品订单信息
// OilOrder order = new OilOrder();
// for (int i = 0;i < oilOrders.size();i++) {
// Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString());
// Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString());
// Double oilNum = amount / oilPrice;
// if (i == 0) {
// order.setOrderType("主订单");
// order.setOrderAmount(amount);
// order.setPayAmount(0.0);
// order.setOrderNo(orderNo);
// } else {
// order.setOrderType("子订单");
// order.setOrderAmount(amount);
// order.setPayAmount(0.0);
// order.setOrderNo(orderNo + "1");
// }
// order.setStoreId(accountInfo.getStoreId());
// order.setUserId(userId);
// order.setCommissionAmount(Double.valueOf(map.get("commissionAmount")));
// order.setStaffId(Integer.valueOf(map.get("staffId")));
// order.setTerminal(map.get("terminal"));
// order.setOils((String) oilOrders.get(i).get("oilName"));
// order.setOilGunNum(oilOrders.get(i).get("gunName").toString());
// order.setOilNum(oilNum);
//// order.setDiscountAmount(Double.valueOf(map.get("oilDiscount")));
// order.setPayUser(userVo1.getMobile());
// order.setPayType(map.get("payType"));
// order.setInvoicing("未开票");
// order.setOrderStatus("paid");
// order.setPayTime(new Date());
//
// this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId());
// baseMapper.insert(order);
// }
// OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
//
//// 添加收银台订单信息
// CashierOrder cashierOrder = new CashierOrder();
// cashierOrder.setStaffId(Integer.valueOf(map.get("staffId")));
// cashierOrder.setStoreId(accountInfo.getStoreId());
// cashierOrder.setPayUser(userVo1.getMobile());
// cashierOrder.setAmount(oilAmount);
// cashierOrder.setPayAmount(oilAmount);
// cashierOrder.setStatus("paid");
// cashierOrder.setPayTime(new Date());
// cashierOrder.setOrderNo(orderNo);
// cashierOrder.setOilOrderAmount(oilAmount);
//// cashierOrder.setOilDiscountAmount(Double.valueOf(map.get("oilDiscount")));
// cashierOrder.setTerminal(map.get("terminal"));
// cashierOrder.setOilOrderId(oilOrder.getId());
// cashierOrderService.insertCashierOrder(cashierOrder);
// this.updateGrowthValue1(oilAmount,userId, Integer.valueOf(oilOrder.getOils()),0.0,storeId);
// this.insertAllOrderInfo(orderNo,accountInfo.getStoreId(),oilAmount,map.get("payType"),userId,"PC","1","paid");
//
// res.put("success","success");
// }
return res;
}
@ -827,7 +807,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
* @param refuelMoney 扣除的囤油卡升数
*/
private void updateGrowthValue1(Double oilActualPay,Integer userid,Integer oilId,Double refuelMoney,Integer storeId,String orderNo){
UserBalance balance = userBalanceService.selectUserBalanceByStorId(userid,storeId);
LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userid,store.getChainStoreId());
JSONArray refuelMoneys = JSONArray.parseArray(balance.getRefuelMoney());
if (ObjectUtil.isNotEmpty(refuelMoneys)){
List<RefuelMoney> list = new ArrayList<>();

View File

@ -1,5 +1,6 @@
package com.fuint.business.petrolStationManagement.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -131,6 +132,11 @@ public class OilGunServiceImpl implements OilGunService {
return oilGunList.size();
}
public List<OilGun> checkData2(OilGun oilGun) {
List<OilGun> oilGunList = oilGunDao.checkData(oilGun);
return oilGunList;
}
/**
* 修改数据
*
@ -141,10 +147,16 @@ public class OilGunServiceImpl implements OilGunService {
public boolean update(OilGun oilGun) {
AccountInfo accountInfo = TokenUtil.getNowAccountInfo();
oilGun.setStoreId(accountInfo.getStoreId());
int i = checkData(oilGun);
if (i>1) {
return false;
List<OilGun> oilGuns = checkData2(oilGun);
if (ObjectUtil.isNotEmpty(oilGuns)) {
if (oilGuns.size()>1) {
return false;
}
if (!oilGuns.get(0).getId().equals(oilGun.getId())) {
return false;
}
}
oilGun.setUpdateBy(accountInfo.getId().toString());
return this.oilGunDao.update(oilGun)>0;
}

View File

@ -71,6 +71,7 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
// 经度
Double lon = Double.valueOf(map.get("lon"));
Double lat = Double.valueOf(map.get("lat"));
String isLogin = ObjectUtil.isEmpty(map.get("isLogin"))?"1":map.get("isLogin");
String storeId = map.get("storeId");
LJStore ljStore = new LJStore();
Double distance = 0.0;
@ -131,13 +132,16 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
}
// 判断当前店铺是否存在此用户的会员信息没有的话进行添加
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LJStore store = this.selectStoreByStoreId(Integer.valueOf(storeId));
UserBalance balance = userBalanceService.selectUserBalance(nowAccountInfo.getId(), store.getChainStoreId());
if (ObjectUtil.isEmpty(balance)){
userBalanceService.initBalance(nowAccountInfo.getId(),store.getChainStoreId());
if ("0".equals(isLogin)) { // 判断是否登录
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LJStore store = this.selectStoreByStoreId(Integer.valueOf(storeId));
UserBalance balance = userBalanceService.selectUserBalance(nowAccountInfo.getId(), store.getChainStoreId());
if (ObjectUtil.isEmpty(balance)){
userBalanceService.initBalance(nowAccountInfo.getId(),store.getChainStoreId());
}
}
Map<String,Object> map1 = new HashMap<>();
map1.put("distance",distance);
map1.put("store",ljStore);

View File

@ -111,6 +111,8 @@ public interface LJUserService extends IService<LJUser> {
*/
public int insertUser(LJUserVo user);
int addUser(LJUser user);
/**
* 修改会员信息
* @param user

View File

@ -353,6 +353,43 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return row;
}
@Override
public int addUser(LJUser user) {
// 生成会员号
if (StringUtils.isEmpty(user.getUserNo())){
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 7; i++) {
sb.append(random.nextInt(10));
}
String digits = sb.toString();
int sum = 0;
for (int i = 0; i < digits.length(); i++) {
int digit = Integer.parseInt(String.valueOf(digits.charAt(i)));
if (i % 2 == 0) {
sum += digit;
} else {
sum += digit * 3;
}
}
int checksum = (10 - (sum % 10)) % 10;
String number = digits + checksum;
user.setUserNo(number);
}
if (StringUtils.isEmpty(user.getName())){
String before = user.getMobile().substring(0, 3);
String after = user.getMobile().substring(7);
user.setName(before+"****"+after);
}else {
user.setName(user.getName());
}
user.setDescription("支付宝登录自动注册");
int row = baseMapper.insert(user);
return row;
}
/**
* 修改会员信息
* @param userVo

View File

@ -52,7 +52,27 @@ public class ShiroConfig {
filterMap.put("/backendApi/store/loginVerification","anon");
//小程序支付回调地址
filterMap.put("/api/fyPay/notify","anon");
// 小程序主页免登录配置
filterMap.put("/business/petrolStationManagement/oilNumber/getList2","anon"); // 主页油号获取
filterMap.put("/business/petrolStationManagement/oilGun/selectByNumber/**","anon"); // 获取油站的油号
filterMap.put("/business/member/staff/queryStaffList/**","anon"); // 获取员工信息
filterMap.put("/business/indexBanner/list/**","anon"); // 获取员工信息
filterMap.put("/business/storeInformation/store/queryStores","anon"); // 切换站点
filterMap.put("/**","commonFilter");
filter.setFilterChainDefinitionMap(filterMap);
filter.setLoginUrl("/login");
return filter;

View File

@ -49,10 +49,14 @@ public class AlipayController extends BaseController {
logger.info("支付宝授权登录参数:{}", map);
String authCode = map.get("authCode");
String encryptedData = map.get("encryptedData");
// alipayService.getUserMobile(encryptedData);
Map<String, String> userMobile = alipayService.getUserMobile(encryptedData);
String mobile = "";
if (userMobile.get("msg").equals("Success")){
mobile = userMobile.get("mobile");
}
String storeId = map.get("storeId");
if ("".equals(storeId)) return getFailureResult(0, "支付宝登录失败");
// if ("".equals(storeId)) return getFailureResult(0, "支付宝登录失败");
// 根据storeId查找对应的连锁店id
LJStore ljStore = iljStoreService.selectStoreByIdUni(Integer.parseInt(storeId));
// 获取支付宝userid
@ -63,19 +67,19 @@ public class AlipayController extends BaseController {
String userId = alipayProfile.getUserId();
// 根据手机号查询用户信息
LJUser user = userService.selectUserByMobile(map.get("phone"));
LJUser user = userService.selectUserByMobile(mobile);
if (ObjectUtil.isNotEmpty(user)){
// 存在则修改用户的支付宝userid
user.setUserId(userId);
userService.updateById(user);
}else {
// 不存在则添加用户的支付宝userid
LJUserVo ljUser = new LJUserVo();
ljUser.setMobile(map.get("phone"));
LJUser ljUser = new LJUser();
ljUser.setMobile(mobile);
ljUser.setUserId(userId);
userService.insertUser(ljUser);
userService.addUser(ljUser);
}
LJUser ljUser = userService.selectUserByMobile(map.get("phone"));
LJUser ljUser = userService.selectUserByMobile(mobile);
String userAgent = request.getHeader("user-agent");
AccountInfo accountInfo = new AccountInfo();
@ -89,7 +93,9 @@ public class AlipayController extends BaseController {
TokenUtil.saveAccountToken(accountInfo);
LoginResponse response = new LoginResponse();
response.setLogin(true);
response.setChainStoreId(ljStore.getChainStoreId());
if (ObjectUtil.isNotEmpty(ljStore)){
response.setChainStoreId(ljStore.getChainStoreId());
}
response.setToken(token);
response.setTokenCreatedTime(new Date());

View File

@ -3,6 +3,8 @@ package com.fuint.module.AlipayApi.service;
import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import java.util.Map;
public interface AlipayService1 {
/**
* 获取用户支付宝userId
@ -12,5 +14,5 @@ public interface AlipayService1 {
*/
public AlipaySystemOauthTokenResponse getAlipayProfile(String code) throws AlipayApiException;
void getUserMobile(String encryptedData) throws Exception;
Map<String, String> getUserMobile(String encryptedData) throws Exception;
}

View File

@ -3,6 +3,7 @@ package com.fuint.module.AlipayApi.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson2.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConfig;
@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service
@ -69,8 +71,8 @@ public class AlipayServiceImpl1 implements AlipayService1 {
}
@Override
public void getUserMobile(String encryptedData) throws Exception {
public Map<String, String> getUserMobile(String encryptedData) throws Exception {
Map<String, String> res = new HashMap<>();
//1. 获取验签和解密所需要的参数
Map<String, String> openapiResult = JSON.parseObject(encryptedData,
new TypeReference<Map<String, String>>() {}, Feature.OrderedField);
@ -108,7 +110,7 @@ public class AlipayServiceImpl1 implements AlipayService1 {
String plainData = null;
if (isDataEncrypted) {
try {
AlipayEncrypt.decryptContent(content, encryptType, decryptKey, charset);
plainData = AlipayEncrypt.decryptContent(content, encryptType, decryptKey, charset);
} catch (AlipayApiException e) {
//解密异常, 记录日志
throw new Exception("解密异常");
@ -116,5 +118,12 @@ public class AlipayServiceImpl1 implements AlipayService1 {
} else {
plainData = content;
}
JSONObject object = JSONObject.parseObject(plainData);
// 遍历 Map 获取 key-value
for (Object key : object.keySet()) {
System.out.println("Key: " + key + ", Value: " + object.get(key));
res.put(key.toString(),object.get(key).toString());
}
return res;
}
}

View File

@ -34,3 +34,11 @@ export function getCheckTheStatusOfYourPaymentByIntegralApi(query) {
params: query
})
}
// 判断库存是否足够
export function getDetermineTheInventoryOfTheProductApi(query) {
return request({
url: 'business/convenience/goods/determineTheInventoryOfTheProduct',
method: 'get',
params: query
})
}

View File

@ -17,3 +17,13 @@ export function selectCoupon(data) {
params: data
})
}
// 查询优惠券信息
export function getPaymentActive(data) {
return request({
url: '/business/marketingActivity/activeExchange/getPaymentActive',
method: 'get',
params: data
})
}

View File

@ -372,6 +372,13 @@
</template>
</el-result>
</div>
<div v-else-if="isAwait">
<el-result icon="warning" 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">
@ -390,7 +397,7 @@
<script>
import {
getCheckTheStatusOfYourPaymentByIntegralApi,
getCheckTheStatusOfYourPaymentByIntegralApi, getDetermineTheInventoryOfTheProductApi,
getGiftApi,
getGiftCategoryApi,
getIntegralOrdersProcessingApi
@ -452,6 +459,8 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
authCode:'',
isPay:true,
isPaySuccess:false,
isAwait: false,
loading:false,
paymentType : 'ALIPAY', //
payType:'支付宝支付'
@ -496,8 +505,8 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
},
//
addGift(data) {
console.log("data",data)
async addGift(data) {
if (data.markPurchases) {
if (data.markPurchases>=data.remainingInventory){
this.$message.error('库存不足');
@ -509,6 +518,18 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
}
this.markPurchasesAll++
//
await getDetermineTheInventoryOfTheProductApi({id:data.goodsId,
stock:data.markPurchases}).then(res=> {
if (!res.data) {
data.markPurchases = data.markPurchases-1
this.$message.error('该商品库存不足');
return;
}
})
console.log("addGift",data)
//
this.dataChange(data);
@ -887,9 +908,11 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
clearInterval(timer);
this_.loading = false;
this_.isPay = false;
this_.isAwait = true;
this.isPaySuccess = false;
},30000)
},15000)
}
// this.paymentType = ''

View File

@ -89,7 +89,7 @@
</div>
<div>-{{ fullReduction }}</div>
</div>
<div class="center-left-hj" v-show="isMember && gradeDiscount.length>0">
<div class="center-left-hj" v-show="isMember">
<div>
<el-popover
placement="bottom-start"
@ -120,7 +120,7 @@
</div>
<div>-{{ oilDiscount }}</div>
</div>
<div class="center-left-hj" v-show="isMember && refuelMoney!=null">
<div class="center-left-hj" v-show="isMember">
<div>
<el-checkbox
style="color: black;font-size: 16px"
@ -129,13 +129,13 @@
囤油卡
<div style="margin: 5px 0" v-for="(item,index) in refuelMoney" :key="index">
{{ item.type }}
<span style="color: #00afff">{{ item.oilType }}</span>
<!-- <span style="color: #00afff">{{ item.oilType }}</span>-->
余额{{ item.refuelMoney }}L
</div>
</div>
<div>- {{ consumeRefuelMoney }}L</div>
</div>
<div class="center-left-hj" v-show="isMember && balance>0">
<div class="center-left-hj" v-show="isMember">
<div>
<el-checkbox style="color: black;font-size: 16px"
v-model="checkAll4" @change="handleCheckAllChange4">
@ -145,7 +145,7 @@
</div>
<div>-{{ consumeAmount }}</div>
</div>
<div class="center-left-hj" v-show="isMember && couponDiscount.length>0">
<div class="center-left-hj" v-show="isMember">
<div>
<el-popover
placement="bottom-start"
@ -765,7 +765,7 @@
import {getOilGun, getOilTank} from "@/api/cashier/oilGuns";
import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
import {getOilNumberById, oilNumberList} from "@/api/cashier/oilnumber";
import {selectCoupon, selectPreferential} from "@/api/cashier/preferential";
import {getPaymentActive, selectCoupon, selectPreferential} from "@/api/cashier/preferential";
import {addHangBill} from "@/api/cashier/hangbill";
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
import {getSysConfig} from "@/api/staff/user/sysconfig";
@ -813,6 +813,14 @@
fullReduction:0,
//
refuelMoney:null,
paymentActive:{
type: 0,
amount: 0,
oilId: "",
storeId: "",
mtUserLevel: "",
userId: "",
},
//
consumeAmount:0,
//
@ -945,6 +953,7 @@
// 使id
useCouponIds:"",
payType:"WECHAT",
map:{
allAmount:0,
//
@ -1910,17 +1919,40 @@
// 使
this.refuelMoney = JSON.parse(data.refuelMoney)
this.changeRefuelMoney();
}else
await this.getGrade(data.id,data.gradeId)
if (!this.isFixingLevel){
this.preferentialData.storeId = this.storeId;
this.preferentialData.userId = data.id;
this.preferentialData.gradeId = data.gradeId;
if (this.oilOrder.length>0){
this.preferential();
this.getCoupon();
}
}
// await this.getGrade(data.id,data.gradeId)
// if (!this.isFixingLevel){
// this.preferentialData.storeId = this.storeId;
// this.preferentialData.userId = data.id;
// this.preferentialData.gradeId = data.gradeId;
// if (this.oilOrder.length>0){
// this.preferential();
// this.getCoupon();
// }
// }
this.getOilCoupon()
},
getOilCoupon(){
let type = 0;
if (this.consumeAmount==0){
type = 1;
}else {
type = 0;
}
this.paymentActive.type = type
this.paymentActive.mtUserLevel = this.member.gradeId
this.paymentActive.userId = this.member.id
let _this = this
this.oilOrder.forEach(item => {
console.log(item)
_this.paymentActive.amount = item.amount
_this.paymentActive.oilId = item.oilName
_this.paymentActive.storeId = item.storeId
getPaymentActive(_this.paymentActive).then(res => {
console.log(res)
})
})
},
//
getCoupon(){
@ -2381,12 +2413,14 @@
this.oilTotal = this.oilOrder.length;
this.select = "元";
if (this.isMember){
this.getGrade(this.member.id,this.member.gradeId)
this.changeRefuelMoney();
if (this.oilOrder.length>0){
this.preferential();
this.getCoupon();
}
// this.getGrade(this.member.id,this.member.gradeId)
// this.changeRefuelMoney();
// if (this.oilOrder.length>0){
// this.preferential();
// this.getCoupon();
// }
this.getOilCoupon()
}
}
})

View File

@ -422,6 +422,13 @@
</template>
</el-result>
</div>
<div v-else-if="isAwait">
<el-result icon="warning" 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">
@ -540,9 +547,9 @@
</div>
</el-dialog>
<!-- 子卡管理-->
<!-- 子卡管理-->
<el-dialog :title="title" :visible.sync="openSubCard" append-to-body>
<!-- <cardValueChild :pUserId="form.id" :handleUpdate="handleUpdate1" :handleAdd="handleAdd1"></cardValueChild>-->
<!-- <cardValueChild :pUserId="form.id" :handleUpdate="handleUpdate1" :handleAdd="handleAdd1"></cardValueChild>-->
<el-tabs v-model="subCardActive" @tab-click="handleClick">
<el-tab-pane label="子卡管理" name="subCardManage">
<div style="display: flex;justify-content: space-between;margin: 10px 0">
@ -720,7 +727,7 @@
</div>
</el-dialog>
<!-- 添加或修改子卡信息-->
<!-- 添加或修改子卡信息-->
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="openSubCard1" width="30%">
<el-form ref="form1" :model="form1" :rules="rules" label-width="120px">
<el-row>
@ -871,6 +878,7 @@ export default {
isPay: true,
isPaySuccess: false,
isAwait: false,
isQuery: true,
payList: [],
@ -1131,8 +1139,12 @@ export default {
this.cardValueList = this.cardValueList.filter(item => {
return item.groupOriented === "1";
});
if (this.cardValueList.length > 0) {
this.rechargeCard(0);
}
}
}
this.$forceUpdate();
},
valueAmoutChange(data) {
@ -1269,13 +1281,13 @@ export default {
//
//
userRecharge() {
async userRecharge() {
this.getCardFuelDieselList()
this.getCardValueList()
this.getCountOilType()
await this.getCardFuelDieselList()
await this.getCardValueList()
await this.getCountOilType()
this.getPayList();
await this.getPayList();
this.openRecharge = true;
this.title = '会员充值'
@ -1312,9 +1324,6 @@ export default {
this.openConfirm = true;
this.isPay = true
// console.log("11111",this.isPay)
// this.isPaySuccess=false
this.title = this.payment
},
//
@ -1499,8 +1508,10 @@ export default {
clearInterval(timer);
this_.loading = false;
this_.isPay = false;
this.isPaySuccess = false;
}, 30000)
this_.isPaySuccess = false;
this_.isAwait = true;
console.log("t3")
}, 15000)
} else if (this.flag === 2) {
if (!this.authCode && this.cardFuelDieselForm.paymentType !== "CASH") {
@ -1556,9 +1567,10 @@ export default {
clearInterval(timer);
this_.loading = false;
this_.isPay = false;
this.isPaySuccess = false;
this_.isPaySuccess = false;
this_.isAwait = true;
}, 30000)
}, 15000)
let this_ = this
}
@ -1580,9 +1592,9 @@ export default {
//
handClose() {
this.isPay = true,
this.isPaySuccess = false,
this.isQuery = true,
this.openConfirm = false
this.isPaySuccess = false,
this.isQuery = true,
this.openConfirm = false
this.openRecharge = false
// this.isPaySuccess = false;
@ -1607,13 +1619,26 @@ export default {
points: '', //
growthValue: '', //
remark: '',
paymentType: '', //
paymentType: 'WECHAT', //
royaltyType: '',//
percentageCommissions: null,
amountCommission: null,
rechargeType: '0'
}
this.cardFuelDieselForm = {
mtStaffId: '',
realName: '',
staffMobile: '',
points: '',
remark: '',
rechargeBalance: '', //
paymentType: 'WECHAT',
payType:'',
oilType: '',
type: '',
chainStorId: '',
incomeLitres: '',
},
//
this.getUserInfo();
this.getInformation();
@ -1663,6 +1688,7 @@ export default {
this.cardValueForm = {}
this.cardFuelDieselForm = {}
this.iniz()
},
cancelCollection() {
this.openConfirm = false;

View File

@ -1,7 +1,14 @@
// 应用全局配置
module.exports = {
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
baseUrl: 'http://192.168.0.138:8008/',
// baseUrl: 'http://192.168.0.196:8081/',
// baseUrl: 'http://192.168.1.4:8080/',
baseUrl: 'http://192.168.0.178:8008/',
// baseUrl: 'http://192.168.1.5:8002/cdJdc',
imagesUrl: 'http://www.nuoyunr.com/lananRsc',
// 应用信息

View File

@ -154,6 +154,7 @@
oilPrice: '0',
gbPrice: '0'
},
AppToken: uni.getStorageSync("App-Token"),
list1: [],
list3: [
@ -255,6 +256,10 @@
},
//
isJoined() {
//
if (!this.AppToken) {
return;
}
request({
url: 'business/marketingActivity/activeNewlywedsRecords/applet',
method: 'get',
@ -299,6 +304,10 @@
},
//
selectActiveNewlyweds() {
//
if (!this.AppToken) {
return;
}
request({
url: 'business/marketingActivity/activeNewlyweds/applet',
method: 'get',
@ -398,7 +407,9 @@
data: {
"lon": _this.longitude,
"lat": _this.latitude,
"storeId": storeId
"storeId": storeId,
"isLogin": _this.AppToken ? "0" : "1", // 0
},
}).then((response) => {
_this.distance = (Math.ceil(response.data.distance))

View File

@ -14,9 +14,11 @@
<image v-else src="../../static/imgs/myx.png" mode="aspectFit"></image>
</view>
<view class="">
<view class="user-tel" @click="goSetup">{{user.mobile}}</view>
<view class="user-name" @click="gorefuel">{{store.name}}{{store.description ? "("+store.description+")" : ""}}<uni-icons type="right" color="#c1c1ff"
size="12"></uni-icons> </view>
<view class="user-tel" @click="goSetup">{{user.mobile?user.mobile:"点击登录"}}</view>
<view class="user-name" @click="gorefuel">
{{store.name}}{{store.description ? "("+store.description+")" : ""}}<uni-icons
type="right" color="#c1c1ff" size="12"></uni-icons>
</view>
</view>
</view>
<view class="vipnber" @click="govip()">会员等级 <uni-icons type="right" color="#ffffff"
@ -178,6 +180,7 @@
refuelMoney: [],
cardBalance: 0.00,
title: '',
AppToken: uni.getStorageSync("App-Token"),
msg: "3",
// url
baseUrl: this.$baseUrl,
@ -213,6 +216,9 @@
},
//
getUser() {
if (!this.AppToken) {
return;
}
request({
url: 'business/userManager/user/getUser',
method: 'get',
@ -256,6 +262,12 @@
})
},
goSetup() {
if (!this.user.mobile) {
uni.navigateTo({
url: '/pagesLogin/login/login'
})
return;
}
uni.navigateTo({
url: '/pagesMy/setup/index'
})
@ -301,6 +313,9 @@
})
},
getUserBalance() {
if (!this.AppToken) {
return;
}
request({
url: '/business/userManager/user/getUserBalanceApplet',
method: 'get',
@ -318,6 +333,9 @@
})
},
getGiftRecords() {
if (!this.AppToken) {
return;
}
request({
url: 'business/marketingActivity/cardFavorable/applet',
method: 'get',
@ -330,6 +348,7 @@
},
//
toCoupons() {
uni.navigateTo({
url: '/pagesMy/Coupons/Coupons'
})
@ -502,4 +521,4 @@
.centenr-size {
font-size: 14px;
}
</style>
</style>

View File

@ -145,6 +145,7 @@
addrInfo: {
address: ''
},
appltType: uni.getStorageSync("appltType"),
shippingType: '',
paymentType: '',
storeId: uni.getStorageSync('storeId'),
@ -183,7 +184,8 @@
})
uni.$emit('unChooseAddr')
if (this.addrInfo.address == '' || this.addrInfo == null) {
//
if (!this.addrInfo.address) {
this.getAddr()
}
@ -254,7 +256,8 @@
integralOrdersList: integralOrdersList,
// authCode:this_.authCode,
// paymentType: _this.paymentType,
paymentType: "WECHAT",
// paymentType: "WECHAT",
paymentType: _this.appltType,
allAmout: _this.allAmout,
allPoints: _this.allPoints,
chainStoreId: _this.chainStoreId,
@ -267,41 +270,71 @@
url: '/pagesRefuel/orderSuccess/index'
})
} else if (res.data.code === "success") {
console.log(res)
let payProvider = "wxpay"
_this.orderInfo = JSON.parse(res.data.data.reservedPayInfo);
uni.requestPayment({
// provider: 'wxpay' 'alipay'
provider: payProvider,
timeStamp: _this.orderInfo.timeStamp,
nonceStr: _this.orderInfo.nonceStr,
package: _this.orderInfo.package,
signType: 'MD5',
paySign: _this.orderInfo.paySign,
success: function(res) {
console.log('success:', res);
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
},
fail: function(err) {
request({
url: "business/integral/integralOrders/editPayStatus",
method: 'get',
data: {
"orderNo": res.data.data.orderNo,
"status": "payFail",
"storeId": -1
},
}).then((res) => {
// let payProvider = "wxpay"
// if (_this.appltType == "WECHAT") {
// payProvider = "wxpay"
// } else {
// payProvider = "alipay"
// }
if (res.data.data.reservedPayInfo) {
_this.orderInfo = JSON.parse(res.data.data.reservedPayInfo);
uni.requestPayment({
// provider: 'wxpay' 'alipay'
// provider: payProvider,
provider: 'wxpay',
timeStamp: _this.orderInfo.timeStamp,
nonceStr: _this.orderInfo.nonceStr,
package: _this.orderInfo.package,
signType: 'MD5',
paySign: _this.orderInfo.paySign,
success: function(res) {
console.log('success:', res);
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
},
fail: function(err) {
request({
url: "business/integral/integralOrders/editPayStatus",
method: 'get',
data: {
"orderNo": res.data.data.orderNo,
"status": "payFail",
"storeId": -1
},
}).then((res) => {
uni.showToast({
title: "支付失败!",
icon: "error"
})
})
console.log('fail:', err);
}
});
}
if (_this.appltType == "ALIPAY") {
my.tradePay({
tradeNO: res.data.data.reservedTransactionId
}, function(resp) {
console.log("resp", resp)
if (resp.resultCode == '9000') {
console.log("支付成功")
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
} else {
uni.showToast({
title: "支付失败!",
icon: "error"
})
})
console.log('fail:', err);
}
});
}
});
}
} else {
uni.showToast({
title: "支付失败!",
@ -309,6 +342,8 @@
})
}
})
},
dataProcessing() {
@ -496,6 +531,7 @@
},
//
getUserInfoList() {
console.log("查询我的积分", this.chainStoreId)
request({
url: '/business/userManager/user/getByUniApp',
method: 'get',

View File

@ -61,41 +61,51 @@
console.log(e)
let _this = this;
my.getAuthCode({
// my.getPhoneNumber({
my.getPhoneNumber({
scopes: 'auth_base',
success: res => {
const authCode = res.authCode;
let encryptedData = res.response;
success: res1 => {
let encryptedData = res1.response;
// _this.setData({
// ['userInfo.phone']: "18457621459",
// alertPhone: false,
// })
console.log(res)
request({
url: "clientApi/sign/alipayLogin/getUserid",
method: 'post',
data: {
authCode: authCode,
storeId: 0,
staffId: "",
phone: "18457621459",
encryptedData:encryptedData,
},
}).then((resp) => {
console.log(resp)
if (resp.code == 200) {
uni.setStorageSync('App-Token', resp.data.token);
uni.setStorageSync('chainStoreId', resp.data.chainStoreId);
uni.navigateTo({
url: '/pages/index/index'
my.getAuthCode({
scopes: 'auth_base',
success: res => {
const authCode = res.authCode;
console.log(res)
request({
url: "clientApi/sign/alipayLogin/getUserid",
method: 'post',
data: {
authCode: authCode,
storeId: 0,
staffId: "",
phone: "18457621459",
encryptedData:encryptedData,
},
}).then((resp) => {
console.log(resp)
if (resp.code == 200) {
uni.setStorageSync('App-Token', resp.data.token);
uni.setStorageSync('chainStoreId', resp.data.chainStoreId);
uni.navigateTo({
url: '/pages/index/index'
})
}
console.log("swq", uni.getStorageSync(
'App-Token'));
})
},
fail: err => {
console.log('my.getAuthCode 调用失败', err)
}
console.log("swq", uni.getStorageSync(
'App-Token'));
})
});
},
fail: err => {
console.log('my.getAuthCode 调用失败', err)

View File

@ -47,12 +47,6 @@
<view style="display: flex;">
<span style="margin-right: 10px;display: flex;">
-{{balanceRedece}}
<span style="margin-left: 8px;margin-top: 8px;">
<!-- <uni-data-checkbox v-model="checkBalance" :multiple="true" :localdata="range" @change="changeBalance"></uni-data-checkbox> -->
<!-- <u-checkbox-group> -->
<!-- <u-checkbox v-model="checkBalance" @change="changeBalance"></u-checkbox> -->
<!-- </u-checkbox-group> -->
</span>
</span>
</view>
</view>
@ -67,14 +61,14 @@
- {{oilCardRedece}}L
<span style="margin-left: 8px;margin-top: 8px;">
<u-checkbox-group>
<u-checkbox v-model="checkOilCard" :checked="checkOilCard" @change="changeOilCard" :disabled="oilCardRedece==0"></u-checkbox>
<u-checkbox v-model="checkOilCard" :checked="checkOilCard" @change="changeOilCard" :disabled="refuelBalance==0"></u-checkbox>
</u-checkbox-group>
</span>
</span>
</view>
</view>
<view class="desc">
<view class="desc" v-if="preferentialData.activeFavorableAmount">
<view style="display: flex;">
活动优惠
<!-- <span style="display: flex;">(满减活动)</span> -->
@ -91,7 +85,7 @@
</view>
</view>
<view class="desc" >
<view class="desc" v-if="preferentialData.cardFavorableAmount">
<view style="display: flex;">
优惠券优惠
<span style="display: flex;">(优惠券)</span>
@ -99,16 +93,11 @@
<view style="display: flex;">
<span style="margin-right: 10px;display: flex;">
-{{couponRedece}}
<!-- <span style="margin-left: 8px;margin-top: 8px;">
<u-checkbox-group>
<u-checkbox v-model="checkCoupon" :checked="checkCoupon" @change="changeCoupon"></u-checkbox>
</u-checkbox-group>
</span> -->
</span>
</view>
</view>
<view class="desc">
<view class="desc" v-if="preferentialData.memberFavorableAmount">
<view style="display: flex;">
会员等级优惠
<!-- <span style="display: flex;">({{userGrade.name}})</span> -->
@ -116,15 +105,10 @@
<view style="display: flex;">
<span style="margin-right: 10px;display: flex;">
-{{gradeRedece}}
<!-- <span style="margin-left: 8px;margin-top: 8px;">
<u-checkbox-group>
<u-checkbox v-model="checkGrade" @change="changeGrade"></u-checkbox>
</u-checkbox-group>
</span> -->
</span>
</view>
</view>
<view class="desc" v-if="!isFullPreferential && !isGradePreferential && !isOilStorageCard && !isStoreValueCard">无优惠</view>
<!-- <view class="desc" v-if="!isFullPreferential && !isGradePreferential && !isOilStorageCard && !isStoreValueCard">无优惠</view> -->
<view style="margin: 10px 20px 0;color: red;font-size: 12px;">已为您计算出最大优惠</view>
<view style="margin: 10px 20px 0;color: red;font-size: 12px;">囤油卡不参与任何优惠活动</view>
@ -251,11 +235,21 @@
checkFull:false,
checkCoupon:false,
checkGrade:false,
preferentialData:{
activeFavorableAmount: "",
activeId: "",
activeInfo: "",
cardFavorableAmount: "",
cardFavorableId: "",
cardFavorableInfo: "",
memberFavorableAmount: "",
type: "",
},
}
},
onLoad(e) {
this.orderNo = e.orderNo
// this.orderNo = "234520240117095256fbd86e"
// this.orderNo = "234520240119103259511c58"
},
onShow() {
this.getOilOrder();
@ -264,42 +258,15 @@
},
methods: {
//
changeBalance(val){
console.log("balance",this.checkBalance,val);
},
//
changeOilCard(val){
console.log("oilcard",this.checkBalance,val);
this.checkOilCard = val
if (val){
// this.payAmount = this.deductAmount - this.gradeRedece
}
},
//
changeFull(val){
console.log("balance",this.checkBalance,val);
if (val){
this.payAmount = this.deductAmount - this.fullRedece
this.chooseRefuelMoney()
}else{
this.payAmount = this.deductAmount
}
},
//
changeCoupon(val){
console.log("balance",this.checkBalance,val);
if (val){
this.payAmount = this.deductAmount - this.couponRedece
}else{
this.payAmount = this.deductAmount
}
},
//
changeGrade(val){
console.log("balance",this.checkBalance,val);
if (val){
this.payAmount = this.deductAmount - this.gradeRedece
}else{
this.payAmount = this.deductAmount
this.payAmount = this.payAmount + (this.oilCardRedece * this.oilPrice)
this.oilCardRedece = 0
this.getPaymentPreferential(this.user.gradeId)
}
},
@ -371,6 +338,14 @@
paySign: _this.orderInfo.paySign,
success: function (res) {
console.log('success');
// 使
request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'put',
data: {"paymentActiveVO":_this.preferentialData},
}).then((res)=>{
console.log(res);
})
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
@ -394,6 +369,14 @@
my.tradePay({ tradeNO: res.data.data.reservedTransactionId }, function(resp){
if(resp.resultCode == '9000'){
console.log("支付成功")
// 使
request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'put',
data: {"paymentActiveVO":_this.preferentialData},
}).then((res)=>{
console.log(res);
})
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
@ -435,6 +418,7 @@
this.oilCardRedece = this.refuelMoney[i].refuelMoney
this.refuelMoneyAfter[i].refuelMoney = 0
if (falg) {
this.checkOilCard = true
this.chooseCardBalance(1)
}
}
@ -477,7 +461,6 @@
}
}else{
this.deductAmount = this.oilOrder.orderAmount
this.transferDTO.amount = this.deductAmount
}
},
// 使
@ -845,7 +828,45 @@
// _this.chooseGrade(res.data.userVo.id,res.data.userVo.gradeId)
})
},
// getPayment
getPaymentPreferential(gradeId){
let type = 0;
if (this.balanceRedece==0){
type = 1
}else{
type = 0
}
let map = {
// 0 1
type: type,
//
amount: this.oilOrder.orderAmount,
//Id
oilId: this.oilOrder.oils,
//id
storeId: this.oilOrder.storeId,
//
mtUserLevel: gradeId,
//id
userId: this.oilOrder.userId,
}
request({
url: "business/marketingActivity/activeExchange/getPaymentActive",
method: 'get',
params:map,
}).then((res) => {
this.preferentialData = res.data
if (res.data.memberFavorableAmount){
this.gradeRedece = res.data.memberFavorableAmount
}
if (res.data.cardFavorableAmount){
this.couponRedece = res.data.cardFavorableAmount
}
if (res.data.activeFavorableAmount){
this.fullRedece = res.data.activeFavorableAmount
}
console.log(this.gradeRedece,this.couponRedece,this.fullRedece,res.data.memberFavorableAmount,"2231");
})
},
//
getOilOrder() {
let _this = this;

View File

@ -43,9 +43,17 @@ const request = config => {
const msg = errorCode[code] || res.data.msg || errorCode['default']
if (code === 401) {
showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
uni.reLaunch({
url: '/pagesLogin/login/login'
})
console.log("res", res)
if (res.confirm) {
uni.reLaunch({
url: '/pagesLogin/login/login'
})
} else {
uni.reLaunch({
url: '/pages/index/index'
})
}
// if (res.confirm) {
// store.dispatch('LogOut').then(res => {
@ -79,4 +87,4 @@ const request = config => {
})
}
export default request
export default request