bug
This commit is contained in:
parent
3cc44f8272
commit
fcb8ddb9ca
@ -49,12 +49,15 @@ import com.fuint.business.petrolStationManagement.entity.OilName;
|
|||||||
import com.fuint.business.petrolStationManagement.mapper.OilNameMapper;
|
import com.fuint.business.petrolStationManagement.mapper.OilNameMapper;
|
||||||
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
|
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
|
||||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||||
|
import com.fuint.business.storeInformation.entity.LJStore;
|
||||||
import com.fuint.business.storeInformation.service.ILJStoreService;
|
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||||
|
import com.fuint.business.userManager.entity.ChainStoreConfig;
|
||||||
import com.fuint.business.userManager.entity.LJUser;
|
import com.fuint.business.userManager.entity.LJUser;
|
||||||
import com.fuint.business.userManager.entity.LJUserGrade;
|
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||||
import com.fuint.business.userManager.entity.UserBalance;
|
import com.fuint.business.userManager.entity.UserBalance;
|
||||||
import com.fuint.business.userManager.mapper.LJUserGradeMapper;
|
import com.fuint.business.userManager.mapper.LJUserGradeMapper;
|
||||||
import com.fuint.business.userManager.mapper.LJUserMapper;
|
import com.fuint.business.userManager.mapper.LJUserMapper;
|
||||||
|
import com.fuint.business.userManager.service.ChainStoreConfigService;
|
||||||
import com.fuint.business.userManager.service.LJUserGradeService;
|
import com.fuint.business.userManager.service.LJUserGradeService;
|
||||||
import com.fuint.business.userManager.service.LJUserService;
|
import com.fuint.business.userManager.service.LJUserService;
|
||||||
import com.fuint.business.userManager.service.UserBalanceService;
|
import com.fuint.business.userManager.service.UserBalanceService;
|
||||||
@ -65,6 +68,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -116,6 +120,9 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
|||||||
private OilNameMapper oilNameMapper;
|
private OilNameMapper oilNameMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private OilNumberMapper oilNumberMapper;
|
private OilNumberMapper oilNumberMapper;
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private ChainStoreConfigService chainStoreConfigService;
|
||||||
/**
|
/**
|
||||||
* 分页查询所有
|
* 分页查询所有
|
||||||
* @param
|
* @param
|
||||||
@ -644,96 +651,102 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
|||||||
String oilTypebyId = oilNameMapper.getOilTypebyId(oilId);
|
String oilTypebyId = oilNameMapper.getOilTypebyId(oilId);
|
||||||
|
|
||||||
String gradeId = paymentActiveDTO.getMtUserLevel().toString();
|
String gradeId = paymentActiveDTO.getMtUserLevel().toString();
|
||||||
if (StringUtils.isNotEmpty(gradeId)){
|
if (StringUtils.isNotEmpty(gradeId)) {
|
||||||
LJUserGrade ljUserGrade = ljUserGradeMapper.selectAllByGradeId(gradeId);
|
LJStore store = iljStoreService.selectStoreByStoreId(storeId);
|
||||||
if (ObjectUtils.isNotEmpty(ljUserGrade)){
|
ChainStoreConfig chainStoreConfig = chainStoreConfigService.selectChainStoreById(store.getChainStoreId());
|
||||||
if (oilTypebyId.equals("汽油")){
|
String isEnableLevel = chainStoreConfig.getIsEnableLevel();
|
||||||
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
|
if (isEnableLevel.equals("yes")) {
|
||||||
|
|
||||||
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
|
LJUserGrade ljUserGrade = ljUserGradeMapper.selectAllByGradeId(gradeId);
|
||||||
String gasolineRule = ljUserGrade.getGasolineRule();
|
if (ObjectUtils.isNotEmpty(ljUserGrade)) {
|
||||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
if (oilTypebyId.equals("汽油")) {
|
||||||
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
|
if (ljUserGrade.getGasolineDiscount().equals("无优惠")) {
|
||||||
|
|
||||||
|
} else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) {
|
||||||
|
String gasolineRule = ljUserGrade.getGasolineRule();
|
||||||
|
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||||
|
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
|
||||||
BigDecimal bigDecimal = jsonObject.getBigDecimal("gasolineRule1");
|
BigDecimal bigDecimal = jsonObject.getBigDecimal("gasolineRule1");
|
||||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) {
|
||||||
//升数
|
//升数
|
||||||
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
|
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP);
|
||||||
BigDecimal gasolineRule3 = jsonObject.getBigDecimal("gasolineRule3");
|
BigDecimal gasolineRule3 = jsonObject.getBigDecimal("gasolineRule3");
|
||||||
BigDecimal multiply = divide.multiply(gasolineRule3);
|
BigDecimal multiply = divide.multiply(gasolineRule3);
|
||||||
paymentActiveVO.setMemberFavorableAmount(multiply);
|
paymentActiveVO.setMemberFavorableAmount(multiply);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
String gasolineRule = ljUserGrade.getGasolineRule();
|
String gasolineRule = ljUserGrade.getGasolineRule();
|
||||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||||
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
|
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
|
||||||
BigDecimal gasolineRule1 = jsonObject.getBigDecimal("gasolineRule1");
|
BigDecimal gasolineRule1 = jsonObject.getBigDecimal("gasolineRule1");
|
||||||
if (paymentActiveDTO.getAmount().compareTo(gasolineRule1)>=0){
|
if (paymentActiveDTO.getAmount().compareTo(gasolineRule1) >= 0) {
|
||||||
//升数
|
//升数
|
||||||
Integer gasolineRule3 = jsonObject.getInteger("gasolineRule2");
|
Integer gasolineRule3 = jsonObject.getInteger("gasolineRule2");
|
||||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||||
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (oilTypebyId.equals("柴油")) {
|
||||||
if (oilTypebyId.equals("柴油")){
|
if (ljUserGrade.getGasolineDiscount().equals("无优惠")) {
|
||||||
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
|
|
||||||
|
|
||||||
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
|
} else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) {
|
||||||
String gasolineRule = ljUserGrade.getDieselRule();
|
String gasolineRule = ljUserGrade.getDieselRule();
|
||||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||||
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
|
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
|
||||||
BigDecimal bigDecimal =jsonObject.getBigDecimal("dieselRule1");
|
BigDecimal bigDecimal = jsonObject.getBigDecimal("dieselRule1");
|
||||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) {
|
||||||
//升数
|
//升数
|
||||||
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
|
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP);
|
||||||
BigDecimal bigDecimal2 = jsonObject.getBigDecimal("dieselRule3");
|
BigDecimal bigDecimal2 = jsonObject.getBigDecimal("dieselRule3");
|
||||||
BigDecimal multiply = divide.multiply(bigDecimal2);
|
BigDecimal multiply = divide.multiply(bigDecimal2);
|
||||||
paymentActiveVO.setMemberFavorableAmount(multiply);
|
paymentActiveVO.setMemberFavorableAmount(multiply);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
String gasolineRule = ljUserGrade.getDieselRule();
|
String gasolineRule = ljUserGrade.getDieselRule();
|
||||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||||
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
|
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
|
||||||
BigDecimal bigDecimal = jsonObject.getBigDecimal("dieselRule1");
|
BigDecimal bigDecimal = jsonObject.getBigDecimal("dieselRule1");
|
||||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) {
|
||||||
//升数
|
//升数
|
||||||
Integer gasolineRule3 = jsonObject.getInteger("dieselRule2");
|
Integer gasolineRule3 = jsonObject.getInteger("dieselRule2");
|
||||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||||
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (oilTypebyId.equals("天然气")) {
|
||||||
|
if (ljUserGrade.getGasolineDiscount().equals("无优惠")) {
|
||||||
|
|
||||||
}
|
} else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")) {
|
||||||
if (oilTypebyId.equals("天然气")){
|
String gasolineRule = ljUserGrade.getNaturalGasRule();
|
||||||
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
|
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||||
|
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
|
||||||
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
|
|
||||||
String gasolineRule = ljUserGrade.getNaturalGasRule();
|
|
||||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
|
||||||
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
|
|
||||||
BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1");
|
BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1");
|
||||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) {
|
||||||
//升数
|
//升数
|
||||||
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
|
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1, 2, RoundingMode.HALF_UP);
|
||||||
BigDecimal bigDecimal2 = jsonObject.getBigDecimal("naturalGas3");
|
BigDecimal bigDecimal2 = jsonObject.getBigDecimal("naturalGas3");
|
||||||
BigDecimal multiply = divide.multiply(bigDecimal2);
|
BigDecimal multiply = divide.multiply(bigDecimal2);
|
||||||
paymentActiveVO.setMemberFavorableAmount(multiply);
|
paymentActiveVO.setMemberFavorableAmount(multiply);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
String gasolineRule = ljUserGrade.getGasolineRule();
|
String gasolineRule = ljUserGrade.getGasolineRule();
|
||||||
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
|
||||||
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
|
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
|
||||||
BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1");
|
BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1");
|
||||||
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
|
if (paymentActiveDTO.getAmount().compareTo(bigDecimal) >= 0) {
|
||||||
//升数
|
//升数
|
||||||
Integer gasolineRule3 = jsonObject.getInteger("naturalGas2");
|
Integer gasolineRule3 = jsonObject.getInteger("naturalGas2");
|
||||||
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
|
||||||
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return paymentActiveVO;
|
return paymentActiveVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,4 +253,15 @@ public class OilOrderController extends BaseController {
|
|||||||
public ResponseObject getAllAmount(@PathVariable Integer userId){
|
public ResponseObject getAllAmount(@PathVariable Integer userId){
|
||||||
return getSuccessResult(orderService.sumOilOrderAmountByUserIdAndStoreId(userId));
|
return getSuccessResult(orderService.sumOilOrderAmountByUserIdAndStoreId(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单号查询油品订单信息(小程序)
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("oilOrderNo")
|
||||||
|
public ResponseObject getOilOrder(@RequestBody Map<String,String> map){
|
||||||
|
String orderNo = map.get("orderNo");
|
||||||
|
return getSuccessResult(orderService.selectOilOrderDescByOrderNo(orderNo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,4 +113,5 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
|
|||||||
|
|
||||||
Map<String, String> orderStatistics( @Param("order") OilOrder order);
|
Map<String, String> orderStatistics( @Param("order") OilOrder order);
|
||||||
|
|
||||||
|
OilOrderVo selectOilOrderDescByOrderNo(@Param("orderNo") String orderNo);
|
||||||
}
|
}
|
||||||
|
@ -518,4 +518,15 @@
|
|||||||
user_id = #{userId} and store_id = #{storeId} and order_status = 'paid'
|
user_id = #{userId} and store_id = #{storeId} and order_status = 'paid'
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectOilOrderDescByOrderNo" resultType="com.fuint.business.order.vo.OilOrderVo"
|
||||||
|
parameterType="java.lang.String">
|
||||||
|
select od.*,ona.oil_name,og.gun_name,sta.real_name,sto.name storeName,sto.description from oil_order od
|
||||||
|
left join oil_name ona on od.oils = ona.id
|
||||||
|
left join oil_gun og on od.oil_gun_num = og.id
|
||||||
|
left join mt_staff sta on od.staff_id = sta.id
|
||||||
|
left join mt_store sto on od.store_id = sto.id
|
||||||
|
<where>
|
||||||
|
od.order_no = #{orderNo}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -8,6 +8,7 @@ import com.fuint.business.order.entity.CashierOrder;
|
|||||||
import com.fuint.business.order.entity.OilOrder;
|
import com.fuint.business.order.entity.OilOrder;
|
||||||
import com.fuint.business.order.vo.OilOrderVo;
|
import com.fuint.business.order.vo.OilOrderVo;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -144,5 +145,5 @@ public interface OilOrderService extends IService<OilOrder> {
|
|||||||
Map<String, String> orderStatistics(OilOrder order);
|
Map<String, String> orderStatistics(OilOrder order);
|
||||||
|
|
||||||
|
|
||||||
|
OilOrderVo selectOilOrderDescByOrderNo(String orderNo);
|
||||||
}
|
}
|
||||||
|
@ -993,17 +993,17 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
|||||||
applet = fyPayService.applet(receiveParameter);
|
applet = fyPayService.applet(receiveParameter);
|
||||||
String resultMsg = (String) applet.get("resultMsg");
|
String resultMsg = (String) applet.get("resultMsg");
|
||||||
// 判断商户订单号是否重复 重复则重新生成订单号
|
// 判断商户订单号是否重复 重复则重新生成订单号
|
||||||
if (StringUtils.isNotEmpty(resultMsg)){
|
// if (StringUtils.isNotEmpty(resultMsg)){
|
||||||
// 根据日期生成订单信息
|
// // 根据日期生成订单信息
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
String timestamp = dateFormat.format(new Date());
|
// String timestamp = dateFormat.format(new Date());
|
||||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
// String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||||
String orderNo1 = "2345"+timestamp+randomString;
|
// String orderNo1 = "2345"+timestamp+randomString;
|
||||||
oilOrder.setOrderNo(orderNo1);
|
// oilOrder.setOrderNo(orderNo1);
|
||||||
this.updateOilOrder(oilOrder);
|
// this.updateOilOrder(oilOrder);
|
||||||
receiveParameter.setOrderNo(orderNo1);
|
// receiveParameter.setOrderNo(orderNo1);
|
||||||
applet = fyPayService.applet(receiveParameter);
|
// applet = fyPayService.applet(receiveParameter);
|
||||||
}
|
// }
|
||||||
applet.put("orderNo",orderNo);
|
applet.put("orderNo",orderNo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1531,4 +1531,9 @@ return stringDoubleMap;
|
|||||||
|
|
||||||
return oilOrderMapper.orderStatistics(order);
|
return oilOrderMapper.orderStatistics(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OilOrderVo selectOilOrderDescByOrderNo(String orderNo) {
|
||||||
|
return baseMapper.selectOilOrderDescByOrderNo(orderNo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,8 @@ public class OilOrderVo extends OilOrder {
|
|||||||
private Double oilPrice;
|
private Double oilPrice;
|
||||||
//
|
//
|
||||||
private String storeName;
|
private String storeName;
|
||||||
|
private String description;
|
||||||
private String oilName;
|
private String oilName;
|
||||||
|
private String gunName;
|
||||||
|
private String realName;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@
|
|||||||
import tabbar from "../../components/tabbar/tabbar.vue"
|
import tabbar from "../../components/tabbar/tabbar.vue"
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
import request from '../../utils/request'
|
import request from '../../utils/request'
|
||||||
|
import { callWithErrorHandling } from "vue"
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -326,22 +327,21 @@
|
|||||||
getUserAuthority() {
|
getUserAuthority() {
|
||||||
let _this = this;
|
let _this = this;
|
||||||
// this.getAddress();
|
// this.getAddress();
|
||||||
|
|
||||||
uni.getSetting({
|
uni.getSetting({
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log(res, 111)
|
// console.log(res, 111,"dingw")
|
||||||
if (!res.authSetting['scope.userLocation']) {
|
if (!res.authSetting['scope.userLocation']) {
|
||||||
uni.authorize({
|
// uni.authorize({
|
||||||
scope: 'scope.userLocation',
|
// scope: 'scope.userLocation',
|
||||||
success() {
|
// success() {
|
||||||
// 用户同意获取位置信息
|
// // 用户同意获取位置信息
|
||||||
// _this.isExistStoreId()
|
// // _this.isExistStoreId()
|
||||||
_this.getAddress(uni.getStorageSync("storeId"));
|
// },
|
||||||
},
|
// fail() {
|
||||||
fail() {
|
// // 用户拒绝
|
||||||
// 用户拒绝
|
// }
|
||||||
}
|
// })
|
||||||
})
|
_this.getAddress(uni.getStorageSync("storeId"));
|
||||||
} else {
|
} else {
|
||||||
// 用户同意获取位置信息
|
// 用户同意获取位置信息
|
||||||
// _this.isExistStoreId()
|
// _this.isExistStoreId()
|
||||||
|
@ -339,7 +339,7 @@
|
|||||||
this.oilOrder.orderAmount = this.value
|
this.oilOrder.orderAmount = this.value
|
||||||
this.oilOrder.storeId = this.storeId
|
this.oilOrder.storeId = this.storeId
|
||||||
this.oilOrder.staffId = id
|
this.oilOrder.staffId = id
|
||||||
this.oilOrder.oilNum = Math.ceil((this.value/this.oilPrice)*100)/100
|
this.oilOrder.oilNum = (this.value/this.oilPrice).toFixed(2)
|
||||||
this.oilOrder.tankId = uni.getStorageSync("tankId")
|
this.oilOrder.tankId = uni.getStorageSync("tankId")
|
||||||
let _this = this;
|
let _this = this;
|
||||||
// 添加油品订单信息
|
// 添加油品订单信息
|
||||||
|
@ -13,11 +13,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="desc">
|
<view class="desc">
|
||||||
<view>油站名称</view>
|
<view>油站名称</view>
|
||||||
<view>{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view>
|
<!-- <view>{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view> -->
|
||||||
|
<view>{{oilOrder.storeName}}{{oilOrder.description ? "("+oilOrder.description+")" : ""}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="desc">
|
<view class="desc">
|
||||||
<view>油号油枪</view>
|
<view>油号油枪</view>
|
||||||
<view>{{oilName}}/{{oilOrder.oilGunNum}}</view>
|
<view>{{oilOrder.oilName}}/{{oilOrder.gunName}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="desc">
|
<view class="desc">
|
||||||
<view>加油金额</view>
|
<view>加油金额</view>
|
||||||
@ -33,7 +34,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="desc">
|
<view class="desc">
|
||||||
<view>加油员工</view>
|
<view>加油员工</view>
|
||||||
<view>{{staff.realName}}</view>
|
<view>{{oilOrder.realName}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -110,7 +111,7 @@
|
|||||||
</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;" v-if="fullRedece>0 || gradeRedece>0 || couponRedece>0">已为您计算出最大优惠</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>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -249,7 +250,7 @@
|
|||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.orderNo = e.orderNo
|
this.orderNo = e.orderNo
|
||||||
// this.orderNo = "234520240119103259511c58"
|
// this.orderNo = "23452024012011401299130f"
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getOilOrder();
|
this.getOilOrder();
|
||||||
@ -263,8 +264,21 @@
|
|||||||
this.checkOilCard = val
|
this.checkOilCard = val
|
||||||
if (val){
|
if (val){
|
||||||
this.chooseRefuelMoney()
|
this.chooseRefuelMoney()
|
||||||
|
this.fullRedece = 0;
|
||||||
|
this.gradeRedece = 0;
|
||||||
|
this.couponRedece = 0;
|
||||||
|
this.preferentialData = {
|
||||||
|
activeFavorableAmount: "",
|
||||||
|
activeId: "",
|
||||||
|
activeInfo: "",
|
||||||
|
cardFavorableAmount: "",
|
||||||
|
cardFavorableId: "",
|
||||||
|
cardFavorableInfo: "",
|
||||||
|
memberFavorableAmount: "",
|
||||||
|
type: "",
|
||||||
|
};
|
||||||
}else{
|
}else{
|
||||||
this.payAmount = this.payAmount + (this.oilCardRedece * this.oilPrice)
|
this.chooseCardBalance(0)
|
||||||
this.oilCardRedece = 0
|
this.oilCardRedece = 0
|
||||||
this.getPaymentPreferential(this.user.gradeId)
|
this.getPaymentPreferential(this.user.gradeId)
|
||||||
}
|
}
|
||||||
@ -431,13 +445,16 @@
|
|||||||
},
|
},
|
||||||
// 查看是否有可使用的储值卡金额
|
// 查看是否有可使用的储值卡金额
|
||||||
chooseCardBalance(val){
|
chooseCardBalance(val){
|
||||||
|
if (this.oilCardRedece==0){
|
||||||
|
this.getPaymentPreferential(this.user.gradeId)
|
||||||
|
}
|
||||||
console.log("balance");
|
console.log("balance");
|
||||||
if (this.user.cardBalance>0) {
|
if (this.user.cardBalance>0) {
|
||||||
this.isStoreValueCard = true;
|
this.isStoreValueCard = true;
|
||||||
if (val == 0) {
|
if (val == 0) {
|
||||||
// 没有使用囤油卡
|
// 没有使用囤油卡
|
||||||
if (this.user.cardBalance >= (this.oilOrder.orderAmount - this.couponRedece)){
|
if (this.user.cardBalance >= this.oilOrder.orderAmount){
|
||||||
this.balanceRedece = this.oilOrder.orderAmount - this.couponRedece
|
this.balanceRedece = this.oilOrder.orderAmount
|
||||||
} else {
|
} else {
|
||||||
this.balanceRedece = this.user.cardBalance
|
this.balanceRedece = this.user.cardBalance
|
||||||
this.deductAmount = (this.oilOrder.orderAmount*100-this.balanceRedece*100)/100
|
this.deductAmount = (this.oilOrder.orderAmount*100-this.balanceRedece*100)/100
|
||||||
@ -461,6 +478,7 @@
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.deductAmount = this.oilOrder.orderAmount
|
this.deductAmount = this.oilOrder.orderAmount
|
||||||
|
this.payAmount = this.oilOrder.orderAmount
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 查看是否有可使用的会员等级优惠
|
// 查看是否有可使用的会员等级优惠
|
||||||
@ -800,7 +818,7 @@
|
|||||||
// 计算用户应付金额
|
// 计算用户应付金额
|
||||||
countPayMent(){
|
countPayMent(){
|
||||||
this.payAmount = this.deductAmount;
|
this.payAmount = this.deductAmount;
|
||||||
console.log("111",this.deductAmount, this.gradeRedece, this.fullRedece, this.couponRedece);
|
// console.log("111",this.deductAmount, this.gradeRedece, this.fullRedece, this.couponRedece);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 根据店铺id查询用户信息
|
// 根据店铺id查询用户信息
|
||||||
@ -865,22 +883,26 @@
|
|||||||
this.fullRedece = res.data.activeFavorableAmount
|
this.fullRedece = res.data.activeFavorableAmount
|
||||||
}
|
}
|
||||||
console.log(this.gradeRedece,this.couponRedece,this.fullRedece,res.data.memberFavorableAmount,"2231");
|
console.log(this.gradeRedece,this.couponRedece,this.fullRedece,res.data.memberFavorableAmount,"2231");
|
||||||
|
|
||||||
|
this.payAmount = (this.payAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取油品订单
|
// 获取油品订单
|
||||||
getOilOrder() {
|
getOilOrder() {
|
||||||
let _this = this;
|
let _this = this;
|
||||||
request({
|
request({
|
||||||
url: "business/oilOrder/orderNo",
|
// url: "business/oilOrder/orderNo",
|
||||||
|
url: "business/oilOrder/oilOrderNo",
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
orderNo: _this.orderNo
|
orderNo: _this.orderNo
|
||||||
},
|
},
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if(res.data!=null){
|
if(res.data){
|
||||||
|
// console.log(res);
|
||||||
_this.oilOrder = res.data
|
_this.oilOrder = res.data
|
||||||
_this.getStaffList(res.data.staffId)
|
// _this.getStaffList(res.data.staffId)
|
||||||
_this.getStore(res.data.storeId)
|
// _this.getStore(res.data.storeId)
|
||||||
_this.getOilNumber(res.data.storeId)
|
_this.getOilNumber(res.data.storeId)
|
||||||
// _this.chooseCoupons()
|
// _this.chooseCoupons()
|
||||||
_this.getUser(res.data.userId)
|
_this.getUser(res.data.userId)
|
||||||
|
Loading…
Reference in New Issue
Block a user