This commit is contained in:
cun-nan 2024-05-28 14:06:53 +08:00
parent 1ea3d5e56c
commit f2cf5bffdb
4 changed files with 967 additions and 534 deletions

View File

@ -114,6 +114,17 @@ public class OilOrderController extends BaseController {
return getSuccessResult(order);
}
/**
* 批量添加订单信息 并支付
* @param oilOrderVo
* @return
*/
@PostMapping("/scanAppletQrCodePos")
public ResponseObject scanAppletQrCodePos(@Validated @RequestBody OilOrderVo oilOrderVo){
Map<String, String> order = orderService.scanAppletQrCodePos(oilOrderVo);
return getSuccessResult(order);
}
/**
* 小程序支付接口
* @param map

View File

@ -108,6 +108,12 @@ public interface OilOrderService extends IService<OilOrder> {
*/
Map<String,String> scanAppletQrCode(Map<String,String> map);
/**
* 扫描小程序中二维码所处理的逻辑POS端
* @param oilOrderVo
*/
Map<String,String> scanAppletQrCodePos(OilOrderVo oilOrderVo);
/**
* 小程序添加油品订单信息
* @param oilOrder
@ -216,5 +222,5 @@ public interface OilOrderService extends IService<OilOrder> {
* @param oilOrderVo
* @return
*/
int addOrderPosScan(OilOrderVo oilOrderVo) throws Exception;
Map<String, String> addOrderPosScan(OilOrderVo oilOrderVo) throws Exception;
}

View File

@ -58,18 +58,19 @@
</view>
<view class="Centralimg" v-if="item.type == 'img' ">
<view class="icon-box">
<image src="/static/imgs/smzf.png" v-if="item.value == 'smzf' " @click="scanQrcode">
<image src="/static/imgs/smzf.png" v-if="item.value == 'smzf' " @click="scanQrcode()">
</image>
<image src="/static/imgs/skzf.png" v-if="item.value == 'skzf' "></image>
<image src="/static/imgs/hyzf.png" v-if="item.value == 'hyzf' "></image>
<image src="/static/imgs/xjzf.png" v-if="item.value == 'xjzf' " @click="cashPay">
<image src="/static/imgs/skzf.png" v-if="item.value == 'skzf' " @click="swipeCard()"></image>
<image src="/static/imgs/hyzf.png" v-if="item.value == 'hyzf' "
@click="scanAppletQrCode()"></image>
<image src="/static/imgs/xjzf.png" v-if="item.value == 'xjzf' " @click="cashPay()">
</image>
<image src="/static/imgs/scjian.png" style="height: 30px;" v-if="!item.value"></image>
</view>
<view class="icon-size" v-if="item.value == 'smzf' " @click="scanQrcode">扫码支付</view>
<view class="icon-size" v-if="item.value == 'skzf' ">刷卡支付</view>
<view class="icon-size" v-if="item.value == 'hyzf' ">会员支付</view>
<view class="icon-size" v-if="item.value == 'xjzf' " @click="cashPay">现金支付</view>
<view class="icon-size" v-if="item.value == 'smzf' " @click="scanQrcode()">扫码支付</view>
<view class="icon-size" v-if="item.value == 'skzf' " @click="swipeCard()">刷卡支付</view>
<view class="icon-size" v-if="item.value == 'hyzf' " @click="scanAppletQrCode()">会员支付</view>
<view class="icon-size" v-if="item.value == 'xjzf' " @click="cashPay()">现金支付</view>
</view>
</view>
@ -117,7 +118,7 @@
"1号枪", "2号枪", "3号枪"
],
spearIndex: 0,
orderNo:"",
orderNo: "",
preferentialData: {},
//
keyboardList: [{
@ -278,7 +279,8 @@
this.paymentAmount = 0
} else {
this.balanceRedece = this.balance
this.paymentAmount = (this.AmountCollected - this.DiscountAmount - this.balance - this.oilCardAmount).toFixed(2)
this.paymentAmount = (this.AmountCollected - this.DiscountAmount - this.balance - this.oilCardAmount)
.toFixed(2)
}
},
//
@ -303,6 +305,78 @@
}
})
},
//
scanAppletQrCode() {
if (!this.AmountCollected) {
uni.showToast({
title: "请先输入收款金额",
icon: "none"
})
return;
}
this.oilOrder.payType = "APPLET_CODE"
this.oilOrder.orderNo = this.orderNo
this.oilOrder.orderAmount = this.AmountCollected
this.oilOrder.payAmount = this.paymentAmount
this.oilOrder.discountAmount = this.DiscountAmount
this.oilOrder.balanceAmount = this.balanceRedece
this.oilOrder.isOilStorageCard = this.isOilStorageCard
this.oilOrder.isUseChildCard = this.isUseChildCard
this.oilOrder.activeId = this.preferentialData.activeId
this.oilOrder.cardFavorableId = this.preferentialData.cardFavorableId
this.oilOrder.recordId = this.preferentialData.recordId
this.oilOrder.type = this.preferentialData.type
this.oilOrder.balanceAmountSale = this.balanceRedece
this.oilOrder.levelAmount = this.levelAmount
this.oilOrder.activeAmount = this.activeAmount
this.oilOrder.oils = this.oilName
this.oilOrder.tankId = this.tankId
this.oilOrder.oilPrice = this.oilPrice
this.oilOrder.oilCardAmount1 = this.oilCardAmount
this.oilOrder.userId = this.userInfo.id
this.oilOrder.oilGunNum = this.oilGunNum
this.oilOrder.payUser = this.userInfo.mobile
let _this = this
uni.scanCode({
onlyFromCamera: true,
success: (res) => {
console.log('扫描二维码成功,结果:' + JSON.stringify(res) + res.result);
_this.authCode = res.result
_this.oilOrder.authCode = _this.authCode
request({
url: '/business/oilOrder/scanAppletQrCodePos',
method: 'post',
data: _this.oilOrder
}).then((resp) => {
if (resp.data.success == 'success') {
_this.reset()
// uni.showToast({
// title: "",
// icon: "success"
// })
uni.navigateTo({
url:"/pagesHome/PaymentResults/PaymentResults"
})
} else {
uni.showToast({
title: resp.data.error,
icon: "none"
})
}
})
},
error: (res) => {
console.log('扫描二维码出现错误')
}
})
},
//
swipeCard(){
uni.showToast({
title:"暂未开发",
icon:"error"
})
},
//
cashPay() {
if (!this.AmountCollected) {
@ -315,17 +389,19 @@
this.oilOrder.payType = "CASH"
this.payMent()
},
getOilCardAmount(){
if(!this.userInfo){
getOilCardAmount() {
if (!this.userInfo) {
return;
}
request({
url: '/business/marketingActivity/cardFuelRecord/getRecordByUserId',
method: 'get',
params:{mtUserId:this.userInfo.id}
params: {
mtUserId: this.userInfo.id
}
}).then((res) => {
res.data.forEach(item => {
if (item.oilType==this.oilName){
if (item.oilType == this.oilName) {
let liters = this.AmountCollected / this.oilPrice
this.oilCardAmount = item.lockupPrice * liters
}
@ -364,13 +440,14 @@
this.orderNo = res.data.orderNo
if (res.data.code == 1) {
this.reset()
uni.showToast({
title: "支付成功",
icon: "success"
})
// uni.navigateTo({
// url:"/pages/index/index"
// uni.showToast({
// title: "",
// icon: "success"
// })
uni.navigateTo({
url:"/pagesHome/PaymentResults/PaymentResults"
})
} else if (res.data.code == 2) {
uni.showToast({
title: "请先配置商户号",
@ -436,12 +513,12 @@
if (!data.value) {
this.AmountCollected = this.AmountCollected.substring(0, this.AmountCollected.length - 1);
}
if (data.value == 'skzf') {
uni.navigateTo({
url: '/pagesHome/CardPayment/CardPayment'
})
// if (data.value == 'skzf') {
// uni.navigateTo({
// url: '/pagesHome/CardPayment/CardPayment'
// })
}
// }
}
},
@ -450,7 +527,7 @@
},
getspearIndex(num, data) {
this.spearIndex = num
this.oilGunNum = data.id
this.oilGunNum = data.id
this.oils = data.oilName
this.tankId = data.tankId
this.oilPrice = data.oilPrice