先下单后支付优惠券相关调试
This commit is contained in:
@@ -6,10 +6,10 @@ const proxyApi = "/api"
|
||||
// const proxyApi = 'http://192.168.1.15:9888/cashierService' // 王伟
|
||||
// const proxyApi = 'http://192.168.1.27:9888/cashierService' // 帆哥
|
||||
// const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试
|
||||
// const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
|
||||
// const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
|
||||
const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
|
||||
const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
|
||||
const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
|
||||
const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
|
||||
// const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
|
||||
// const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
|
||||
// const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||
// #endif
|
||||
|
||||
@@ -387,12 +387,16 @@
|
||||
orderInfo: res.data.tradeNo, // 微信支付商户号
|
||||
// #endif
|
||||
success: (res) => {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
// resultCode 9000
|
||||
console.log(res)
|
||||
console.log(2)
|
||||
|
||||
uni.hideLoading()
|
||||
let pages = getCurrentPages()
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
|
||||
complete() {
|
||||
@@ -414,6 +418,16 @@
|
||||
})
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if ( res.resultCode == '9000') {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败"
|
||||
})
|
||||
}
|
||||
|
||||
if ( _this.type && _this.type == "topUpActivity") {
|
||||
uni.pro.navigateBack()
|
||||
} else {
|
||||
|
||||
@@ -662,7 +662,7 @@
|
||||
if (b == '单规格') { //没有规格为空
|
||||
this.skuidname = []
|
||||
}
|
||||
if ( a == "+" && item.isVip == 1 && item.cartNumber >= item.limitNumber){
|
||||
if ( a == "+" && item.cartNumber >= item.limitNumber){
|
||||
uni.showToast({
|
||||
title: '当前商品已达到最大赠送数量',
|
||||
icon: 'none'
|
||||
@@ -685,7 +685,7 @@
|
||||
*/
|
||||
shopAdd(item, index, index1, a, b) {
|
||||
if (a == "+") {
|
||||
if ( item.isVip == 1 && this.amountcartNumber >= item.limitNumber){
|
||||
if ( this.amountcartNumber >= item.limitNumber){
|
||||
uni.showToast({
|
||||
title: '当前商品已达到最大赠送数量',
|
||||
icon: 'none'
|
||||
@@ -717,7 +717,7 @@
|
||||
return;
|
||||
}
|
||||
let num = 0;
|
||||
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){
|
||||
if (item.cartNumber >= item.limitNumber){
|
||||
uni.showToast({
|
||||
title: '当前商品已达到最大赠送数量',
|
||||
icon: 'none'
|
||||
@@ -733,7 +733,6 @@
|
||||
"skuId": this.skuId,
|
||||
"num": num, //数量
|
||||
"type": a == '+' ? 1 : 0,
|
||||
"isVip": item.isVip,
|
||||
"productId": item.id, //商品id
|
||||
"shopId": this.shopId,
|
||||
"note": item.note,
|
||||
@@ -775,7 +774,7 @@
|
||||
setNumber() {
|
||||
// 处理购物车相同id的情况下 数量相加
|
||||
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) {
|
||||
existing.number += current.number;
|
||||
} else {
|
||||
@@ -790,7 +789,7 @@
|
||||
return item.products.filter(e => {
|
||||
e.cartNumber = 0;
|
||||
return summedArray.find(i => {
|
||||
if (e.id == i.productId && e.isVip == i.isVip) {
|
||||
if (e.id == i.productId) {
|
||||
e.cartNumber = i.number
|
||||
}
|
||||
})
|
||||
@@ -986,7 +985,6 @@
|
||||
code: this.tableCode,
|
||||
shopId: this.shopId,
|
||||
productId: item.id, //商品id
|
||||
isVip: item.isVip, //商品id
|
||||
spec_tag: this.skuidname.join(","),
|
||||
})
|
||||
this.salePrice = res.data.salePrice // 价格
|
||||
@@ -997,7 +995,6 @@
|
||||
"num": num, //数量
|
||||
"type": c == '+' ? 1 : 0,
|
||||
"productId": item.id, //商品id
|
||||
"isVip": item.isVip,
|
||||
"note": item.note,
|
||||
"shopId": this.shopId,
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
|
||||
@@ -150,10 +150,23 @@
|
||||
type: Object
|
||||
},
|
||||
},
|
||||
watch :{
|
||||
listinfo:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
console.log(newVal)
|
||||
this.$forceUpdate()
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.listinfo.shopId)
|
||||
uni.$on('couponItem',this.changeCoupon)
|
||||
this.getCalcUsablePoints()
|
||||
},
|
||||
onShow() {
|
||||
// uni.$on('couponItem',this.changeCoupon)
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 监听优惠券/商品券选择
|
||||
@@ -190,11 +203,12 @@
|
||||
num: couponData.type == 1 ? 1 : couponData.num,
|
||||
})
|
||||
}
|
||||
if ( _this.isPointsChecked) {
|
||||
console.log(_this.listinfo.payAmount)
|
||||
// if ( _this.isPointsChecked ) {
|
||||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
|
||||
// }
|
||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "优惠券满减金额大于订单金额不可使用",
|
||||
@@ -202,7 +216,7 @@
|
||||
})
|
||||
}
|
||||
} else { //商品券
|
||||
// this.listinfo.details
|
||||
|
||||
// 筛选选中商品券商品列表
|
||||
let couponList = _this.listinfo.details.filter(v => v.productId == couponData.proId);
|
||||
//金额从小到大排序
|
||||
@@ -216,7 +230,7 @@
|
||||
productTicketList.map((item,index) => {
|
||||
productTicketNum += item.num
|
||||
})
|
||||
console.log(productTicketNum)
|
||||
console.log(minCouponList)
|
||||
minCouponList.map((item,index) => {
|
||||
productNumber += item.number
|
||||
if ( productNum > 0 && productNumber > productTicketNum) {
|
||||
@@ -227,7 +241,6 @@
|
||||
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.salePrice))
|
||||
}
|
||||
})
|
||||
console.log(minCouponList)
|
||||
_this.userCouponInfos.push({
|
||||
userCouponId: couponData.id,
|
||||
type: couponData.type,
|
||||
@@ -243,11 +256,13 @@
|
||||
discountAmount: productPayAmount,
|
||||
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
||||
})
|
||||
|
||||
if ( _this.isPointsChecked) {
|
||||
console.log(productNum)
|
||||
console.log(_this.favorable)
|
||||
// if ( _this.isPointsChecked) {
|
||||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
// }
|
||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
||||
}
|
||||
uni.$off('couponItem')
|
||||
},
|
||||
@@ -267,6 +282,7 @@
|
||||
this.freeDisabled = false
|
||||
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
||||
},
|
||||
goUrl(item){
|
||||
switch (item.type){
|
||||
@@ -544,7 +560,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
// padding: 0 30rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 26rpx;
|
||||
padding-top: 26rpx;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</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>
|
||||
<!-- 积分兑换订单详情 -->
|
||||
@@ -115,6 +115,10 @@
|
||||
console.log(e)
|
||||
},
|
||||
methods: {
|
||||
setPayAmount(payAmount) {
|
||||
this.listinfo.payAmount = payAmount
|
||||
this.$forceUpdate()
|
||||
},
|
||||
saveImage (url) {
|
||||
uni.saveImage({
|
||||
url: url,
|
||||
|
||||
Reference in New Issue
Block a user