bug
This commit is contained in:
parent
662f21012d
commit
06fcb5fe98
@ -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("修改通道成功");
|
||||
|
@ -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);
|
||||
|
@ -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<>();
|
||||
|
@ -111,6 +111,8 @@ public interface LJUserService extends IService<LJUser> {
|
||||
*/
|
||||
public int insertUser(LJUserVo user);
|
||||
|
||||
int addUser(LJUser user);
|
||||
|
||||
/**
|
||||
* 修改会员信息
|
||||
* @param user
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user