先下单后支付优惠券相关调试

This commit is contained in:
GaoHao
2024-11-18 16:41:32 +08:00
parent fb4f8820a4
commit 69151ca3f4
5 changed files with 57 additions and 26 deletions

View File

@@ -6,10 +6,10 @@ const proxyApi = "/api"
// const proxyApi = 'http://192.168.1.15:9888/cashierService' // 王伟 // const proxyApi = 'http://192.168.1.15:9888/cashierService' // 王伟
// const proxyApi = 'http://192.168.1.27:9888/cashierService' // 帆哥 // const proxyApi = 'http://192.168.1.27:9888/cashierService' // 帆哥
// const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试 // const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试
// const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试 const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试 const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布 // const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布 // const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
// const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上 // const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上
// const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上 // const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上
// #endif // #endif

View File

@@ -387,12 +387,16 @@
orderInfo: res.data.tradeNo, // 微信支付商户号 orderInfo: res.data.tradeNo, // 微信支付商户号
// #endif // #endif
success: (res) => { success: (res) => {
uni.showToast({ // resultCode 9000
title: "支付成功" console.log(res)
}) console.log(2)
uni.hideLoading() uni.hideLoading()
let pages = getCurrentPages() let pages = getCurrentPages()
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.showToast({
title: "支付成功"
})
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"], tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() { complete() {
@@ -414,6 +418,16 @@
}) })
// #endif // #endif
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
if ( res.resultCode == '9000') {
uni.showToast({
title: "支付成功"
})
} else {
uni.showToast({
title: "支付失败"
})
}
if ( _this.type && _this.type == "topUpActivity") { if ( _this.type && _this.type == "topUpActivity") {
uni.pro.navigateBack() uni.pro.navigateBack()
} else { } else {

View File

@@ -662,7 +662,7 @@
if (b == '单规格') { //没有规格为空 if (b == '单规格') { //没有规格为空
this.skuidname = [] this.skuidname = []
} }
if ( a == "+" && item.isVip == 1 && item.cartNumber >= item.limitNumber){ if ( a == "+" && item.cartNumber >= item.limitNumber){
uni.showToast({ uni.showToast({
title: '当前商品已达到最大赠送数量', title: '当前商品已达到最大赠送数量',
icon: 'none' icon: 'none'
@@ -685,7 +685,7 @@
*/ */
shopAdd(item, index, index1, a, b) { shopAdd(item, index, index1, a, b) {
if (a == "+") { if (a == "+") {
if ( item.isVip == 1 && this.amountcartNumber >= item.limitNumber){ if ( this.amountcartNumber >= item.limitNumber){
uni.showToast({ uni.showToast({
title: '当前商品已达到最大赠送数量', title: '当前商品已达到最大赠送数量',
icon: 'none' icon: 'none'
@@ -717,7 +717,7 @@
return; return;
} }
let num = 0; let num = 0;
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){ if (item.cartNumber >= item.limitNumber){
uni.showToast({ uni.showToast({
title: '当前商品已达到最大赠送数量', title: '当前商品已达到最大赠送数量',
icon: 'none' icon: 'none'
@@ -733,7 +733,6 @@
"skuId": this.skuId, "skuId": this.skuId,
"num": num, //数量 "num": num, //数量
"type": a == '+' ? 1 : 0, "type": a == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.id, //商品id "productId": item.id, //商品id
"shopId": this.shopId, "shopId": this.shopId,
"note": item.note, "note": item.note,
@@ -775,7 +774,7 @@
setNumber() { setNumber() {
// 处理购物车相同id的情况下 数量相加 // 处理购物车相同id的情况下 数量相加
var summedArray = this.cartLists.data.reduce((acc, current) => { var summedArray = this.cartLists.data.reduce((acc, current) => {
const existing = acc.find(item => item.productId === current.productId && item.isVip === current.isVip); const existing = acc.find(item => item.productId === current.productId);
if (existing) { if (existing) {
existing.number += current.number; existing.number += current.number;
} else { } else {
@@ -790,7 +789,7 @@
return item.products.filter(e => { return item.products.filter(e => {
e.cartNumber = 0; e.cartNumber = 0;
return summedArray.find(i => { return summedArray.find(i => {
if (e.id == i.productId && e.isVip == i.isVip) { if (e.id == i.productId) {
e.cartNumber = i.number e.cartNumber = i.number
} }
}) })
@@ -986,7 +985,6 @@
code: this.tableCode, code: this.tableCode,
shopId: this.shopId, shopId: this.shopId,
productId: item.id, //商品id productId: item.id, //商品id
isVip: item.isVip, //商品id
spec_tag: this.skuidname.join(","), spec_tag: this.skuidname.join(","),
}) })
this.salePrice = res.data.salePrice // 价格 this.salePrice = res.data.salePrice // 价格
@@ -997,7 +995,6 @@
"num": num, //数量 "num": num, //数量
"type": c == '+' ? 1 : 0, "type": c == '+' ? 1 : 0,
"productId": item.id, //商品id "productId": item.id, //商品id
"isVip": item.isVip,
"note": item.note, "note": item.note,
"shopId": this.shopId, "shopId": this.shopId,
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,

View File

@@ -150,10 +150,23 @@
type: Object type: Object
}, },
}, },
watch :{
listinfo:{
immediate: true,
handler (newVal) {
console.log(newVal)
this.$forceUpdate()
}
},
},
mounted() { mounted() {
console.log(this.listinfo.shopId) console.log(this.listinfo.shopId)
uni.$on('couponItem',this.changeCoupon)
this.getCalcUsablePoints() this.getCalcUsablePoints()
}, },
onShow() {
// uni.$on('couponItem',this.changeCoupon)
},
methods: { methods: {
/** /**
* 监听优惠券/商品券选择 * 监听优惠券/商品券选择
@@ -190,11 +203,12 @@
num: couponData.type == 1 ? 1 : couponData.num, num: couponData.type == 1 ? 1 : couponData.num,
}) })
} }
if ( _this.isPointsChecked) { console.log(_this.listinfo.payAmount)
// if ( _this.isPointsChecked ) {
_this.pointsChange() _this.pointsChange()
_this.getCalcUsablePoints() _this.getCalcUsablePoints()
} // }
this.$emit("setPayAmount",_this.listinfo.payAmount)
} else { } else {
uni.showToast({ uni.showToast({
title: "优惠券满减金额大于订单金额不可使用", title: "优惠券满减金额大于订单金额不可使用",
@@ -202,7 +216,7 @@
}) })
} }
} else { //商品券 } else { //商品券
// this.listinfo.details
// 筛选选中商品券商品列表 // 筛选选中商品券商品列表
let couponList = _this.listinfo.details.filter(v => v.productId == couponData.proId); let couponList = _this.listinfo.details.filter(v => v.productId == couponData.proId);
//金额从小到大排序 //金额从小到大排序
@@ -216,7 +230,7 @@
productTicketList.map((item,index) => { productTicketList.map((item,index) => {
productTicketNum += item.num productTicketNum += item.num
}) })
console.log(productTicketNum) console.log(minCouponList)
minCouponList.map((item,index) => { minCouponList.map((item,index) => {
productNumber += item.number productNumber += item.number
if ( productNum > 0 && productNumber > productTicketNum) { if ( productNum > 0 && productNumber > productTicketNum) {
@@ -227,7 +241,6 @@
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.salePrice)) productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.salePrice))
} }
}) })
console.log(minCouponList)
_this.userCouponInfos.push({ _this.userCouponInfos.push({
userCouponId: couponData.id, userCouponId: couponData.id,
type: couponData.type, type: couponData.type,
@@ -243,11 +256,13 @@
discountAmount: productPayAmount, discountAmount: productPayAmount,
num: productNum == 0 ? couponData.num : (couponData.num - productNum), num: productNum == 0 ? couponData.num : (couponData.num - productNum),
}) })
console.log(productNum)
if ( _this.isPointsChecked) { console.log(_this.favorable)
// if ( _this.isPointsChecked) {
_this.pointsChange() _this.pointsChange()
_this.getCalcUsablePoints() _this.getCalcUsablePoints()
} // }
this.$emit("setPayAmount",_this.listinfo.payAmount)
} }
uni.$off('couponItem') uni.$off('couponItem')
}, },
@@ -267,6 +282,7 @@
this.freeDisabled = false this.freeDisabled = false
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2); this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
} }
this.$emit("setPayAmount",_this.listinfo.payAmount)
}, },
goUrl(item){ goUrl(item){
switch (item.type){ switch (item.type){
@@ -544,7 +560,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
// padding: 0 30rpx; padding: 0 30rpx;
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 26rpx; padding-bottom: 26rpx;
padding-top: 26rpx; padding-top: 26rpx;

View File

@@ -27,7 +27,7 @@
</view> </view>
<!-- 先下单后支付 --> <!-- 先下单后支付 -->
<orderInfoAfter ref="orderInfoAfter" :listinfo="listinfo" v-if="listinfo.useType == 'dine-in-after'"></orderInfoAfter> <orderInfoAfter ref="orderInfoAfter" :listinfo="listinfo" @setPayAmount="setPayAmount" v-if="listinfo.useType == 'dine-in-after'"></orderInfoAfter>
<!-- 先支付后下单 --> <!-- 先支付后下单 -->
<orderInfoBefore ref="orderInfoBefore" :listinfo="listinfo" v-else></orderInfoBefore> <orderInfoBefore ref="orderInfoBefore" :listinfo="listinfo" v-else></orderInfoBefore>
<!-- 积分兑换订单详情 --> <!-- 积分兑换订单详情 -->
@@ -115,6 +115,10 @@
console.log(e) console.log(e)
}, },
methods: { methods: {
setPayAmount(payAmount) {
this.listinfo.payAmount = payAmount
this.$forceUpdate()
},
saveImage (url) { saveImage (url) {
uni.saveImage({ uni.saveImage({
url: url, url: url,