This commit is contained in:
cun-nan 2024-10-08 10:59:23 +08:00
parent fe942e2224
commit c866a4237b
5 changed files with 211 additions and 20 deletions

View File

@ -59,7 +59,7 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_use","1");
queryWrapper.eq("store_id",storeId);
MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper);
// MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper);
// if (ObjectUtil.isNotEmpty(merchantConfig) && merchantConfig.getIsOpenRule().equals("1")){
// List<MerchantConfig> list = this.selectMeChByIsOpen(storeId);
// if (list.size()>0){

View File

@ -123,7 +123,7 @@ public interface OilOrderService extends IService<OilOrder> {
* @param oilOrder
* @return
*/
public String addOilOrder(OilOrder oilOrder);
public OilOrder addOilOrder(OilOrder oilOrder);
/**
* 小程序订单支付

View File

@ -1575,7 +1575,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
@Override
public String addOilOrder(OilOrder oilOrder) {
public OilOrder addOilOrder(OilOrder oilOrder) {
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo1();
// 根据日期生成订单信息
@ -1614,7 +1614,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
} else {
baseMapper.insert(oilOrder);
}
return orderNo;
return oilOrder;
}
@Override
@ -1795,8 +1795,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 修改订单的优惠金额和支付金额
oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
oilOrder.setPayAmount(payAmount);
oilOrder.setBalanceAmount(Double.valueOf(balanceAmountSale));
oilOrder.setOilCardAmount(Double.valueOf(oilCardAmountSale));
// oilOrder.setBalanceAmount(Double.valueOf(balanceAmountSale));
// oilOrder.setOilCardAmount(Double.valueOf(oilCardAmountSale));
if (StringUtils.isNotEmpty(activeId)) {
oilOrder.setActiveId(Integer.valueOf(activeId));
}

View File

@ -775,7 +775,7 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
mtUser.setOpenId(openId);
mtUser.setMobile(mobile);
mtUser.setName("("+mobile+"微信自动注册用户");
mtUser.setName("微信用户("+mobile+"");
mtUser.setCreateTime(new Date());
mtUser.setUpdateTime(new Date());
mtUser.setDescription("微信登录自动注册");
@ -793,7 +793,7 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
user.setOpenId(openId);
user.setMobile(mobile);
user.setName(""+mobile+"微信自动注册用户");
user.setName("微信用户"+mobile+"");
user.setCreateTime(new Date());
user.setUpdateTime(new Date());
user.setDescription("微信登录自动注册");

View File

@ -33,7 +33,8 @@
</view>
<view class="input_kuang">
<view class="leftIput">
<input style="width: 100%;" v-model="oilOrder.amount" type="text" placeholder="请输入金额" />
<input style="width: 100%;" v-model="oilOrder.orderAmount" @input="changeAmount()"
type="text" placeholder="请输入金额" />
</view>
<view class="rr_box">{{oilOrder.oilNum || 0}}L</view>
</view>
@ -260,7 +261,7 @@
<image src="../../static/imgs/zficon.png" style="width: 36px; height: 36px; "></image>
<view class="p_ds" style="width: 85%;">
<view class="">
<view class="">消费应支付245.99</view>
<view class="">消费应支付{{oilOrder.payAmount}}</view>
<view class="sm-size">会员-储值卡余额8900.99</view>
</view>
<view class="anxuan">
@ -268,7 +269,7 @@
</view>
</view>
</view>
<view class="annius">立即支付245.99</view>
<view class="annius" @click="payment()">立即支付{{oilOrder.payAmount}}</view>
</view>
</u-popup>
<!-- 订单明细 -->
@ -282,22 +283,22 @@
</view>
<view class="p_bs">
<view class="">员工</view>
<view class="">小王</view>
<view class="">{{staffName || '--'}}</view>
</view>
<view class="p_bs">
<view class="">油品单价</view>
<view class="">7.28/L</view>
<view class="">{{oilPrice || 0}}/{{oilUnit || 'L'}}</view>
</view>
<view class="p_bs">
<view class="">加油升数</view>
<view class="">36.88L</view>
<view class="">{{oilOrder.oilNum}}L</view>
</view>
<view class="p_bs">
<view class="">加油金额</view>
<view class="">256.89</view>
</view>
<view class="p_x"></view>
<view class="">商品信息</view>
<view class="">优惠信息</view>
<view class="p_bs">
<view class="">优惠券</view>
<view class="r-size">-10.00</view>
@ -315,7 +316,7 @@
<view class="p_x"></view>
<view class="p_bs">
<view class="">合计待支付</view>
<view class="r-size">568.99</view>
<view class="r-size">{{oilOrder.payAmount}}</view>
</view>
<view class="p_x"></view>
</view>
@ -403,14 +404,17 @@
terminal: "applet",
oils: "",
oilGunNum: "",
oilNum: "",
oilNum: 0,
orderAmount: 0,
discountAmount: 0,
payAmount: 0,
payType: uni.getStorageSync("appltType"),
},
//
couponList: []
couponList: [],
//
ifLogin: false,
orderInfo:{},
}
},
components: {
@ -478,6 +482,157 @@
},
methods: {
//
payment() {
this.ifLogin = this.AppToken ? true : false
let map = {
orderNo: this.oilOrder.orderNo,
payAmount: this.oilOrder.payAmount,
discountAmount: this.oilOrder.discountAmount,
oilCardAmount: '',
oilCardLiters: this.oilOrder.oilCardAmount || 0,
balanceAmount: this.oilOrder.balanceAmount || 0,
isOilStorageCard: false,
tankId: this.oilOrder.tankId,
isUseChildCard: false,
// activeId: this.preferentialData.activeId,
// cardFavorableId: this.preferentialData.cardFavorableId,
// recordId: this.preferentialData.recordId,
// type: this.preferentialData.type,
// balanceAmountSale: this.balanceRedece,
// oilCardAmountSale: this.oilCardRedece,
ifLogin: this.ifLogin,
// levelAmount: this.levelAmount,
// activeAmount: this.activeAmount
};
let _this = this;
request({
url: "business/oilOrder/appletPay",
method: 'post',
data: map,
}).then(res => {
let payProvider = "wxpay"
if (_this.appltType == "WECHAT") {
payProvider = "wxpay"
} else {
payProvider = "alipay"
}
if (res.data.error) {
request({
url: "/business/allOrderInfo/orderStatus",
method: 'post',
data: {
"orderNo": _this.oilOrder.orderNo,
"status": "payFail"
},
}).then((ress) => {})
uni.showToast({
title: res.data.error,
icon: "none"
})
return;
}
if (res.data.code == "error") {
request({
url: "/business/allOrderInfo/orderStatus",
method: 'post',
data: {
"orderNo": _this.oilOrder.orderNo,
"status": "payFail"
},
}).then((ress) => {})
uni.showToast({
title: "支付失败,请联系商家",
icon: "none"
})
return;
}
if (res.data.success == "ok") {
uni.redirectTo({
url: '/pagesRefuel/orderSuccess/index?orderNo=' + _this.oilOrder.orderNo,
})
return;
}
if (res.data.resultMsg == "商户订单号重复") {
uni.showToast({
title: "商户订单号重复,请重新选择订单信息进行支付!",
icon: "none"
})
}
if (res.data.data.reservedPayInfo) {
_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');
uni.redirectTo({
url: '/pagesRefuel/orderSuccess/index?orderNo=' + _this.oilOrder.orderNo,
})
},
fail: function(err) {
request({
url: "/business/allOrderInfo/orderStatus",
method: 'post',
data: {
"orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => {
uni.showToast({
title: "支付失败!",
icon: "error"
})
})
console.log('fail:', err);
}
});
}
if (_this.appltType == "ALIPAY") {
my.tradePay({
tradeNO: res.data.data.reservedTransactionId
}, function(resp) {
if (resp.resultCode == '9000') {
console.log("支付成功")
uni.redirectTo({
url: '/pagesRefuel/orderSuccess/index?orderNo=' + _this.oilOrder.orderNo,
})
} else {
request({
url: "/business/allOrderInfo/orderStatus",
method: 'post',
data: {
"orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => {
uni.showToast({
title: "支付失败!",
icon: "error"
})
})
console.log('支付失败,' + resp.resultCode);
}
});
}
})
},
changeAmount() {
if (this.oilOrder.orderAmount) {
this.oilOrder.payAmount = this.oilOrder.orderAmount - this.oilOrder.discountAmount
this.oilOrder.oilNum = (this.oilOrder.orderAmount / this.oilPrice).toFixed(2)
}
},
getCouponList() {
request({
url: "pay/paycenter/getCoupon",
@ -510,6 +665,7 @@
this.oilPrice = data.oilPrice
this.oilUnit = data.unit
this.oilOrder.oils = data.oilNameId
this.oilOrder.tankId = data.oilGunList[0].tankId
uni.setStorageSync("tankId", data.oilGunList[0].tankId)
this.oilGunName = data.oilGunList[0].gunName
}
@ -529,6 +685,7 @@
this.qhindex = index
this.selectShow = false
this.oilOrder.oilGunNum = data.id
this.oilOrder.tankId = data.tankId
uni.setStorageSync("tankId", data.tankId)
this.oilGunName = data.gunName
},
@ -538,7 +695,41 @@
},
goPayment() {
//
if (this.oilOrder.orderAmount <= 0) {
uni.showToast({
title: "请先输入加油金额",
icon: 'none'
})
return;
}
request({
url: "business/petrolStationManagement/oilTank/" + uni.getStorageSync('tankId'),
method: 'get',
}).then((res) => {
if (res.data.storedQuantity - this.oilOrder.oilNum < 0) {
uni.showToast({
title: "所加油的升数大于油罐内的升数,请重新选择加油升数",
icon: "none"
})
return;
} else {
this.ConfirmPayment = true
this.addOrder()
}
})
},
//
addOrder() {
this.oilOrder.storeId = uni.getStorageSync('storeId')
request({
url: "business/oilOrder/addOilOrder",
method: 'post',
data: this.oilOrder,
}).then((res) => {
console.log(res,578);
this.oilOrder = res.data
})
},
Selectclose() {
this.Selectemployees = false
@ -648,6 +839,7 @@
if (res.data[0].oilGunList) {
_this.oilGunList = res.data[0].oilGunList
_this.oilOrder.oilGunNum = res.data[0].oilGunList[0].id
_this.oilOrder.tankId = res.data[0].oilGunList[0].tankId
uni.setStorageSync("tankId", res.data[0].oilGunList[0].tankId)
_this.oilGunName = res.data[0].oilGunList[0].gunName
}
@ -699,7 +891,6 @@
} else {
this.toPayment(id)
}
})
},
//