商品券处理
This commit is contained in:
@@ -662,13 +662,7 @@
|
|||||||
if (b == '单规格') { //没有规格为空
|
if (b == '单规格') { //没有规格为空
|
||||||
this.skuidname = []
|
this.skuidname = []
|
||||||
}
|
}
|
||||||
if ( a == "+" && item.cartNumber >= item.limitNumber){
|
|
||||||
uni.showToast({
|
|
||||||
title: '当前商品已达到最大赠送数量',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1;
|
let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1;
|
||||||
|
|
||||||
@@ -685,13 +679,7 @@
|
|||||||
*/
|
*/
|
||||||
shopAdd(item, index, index1, a, b) {
|
shopAdd(item, index, index1, a, b) {
|
||||||
if (a == "+") {
|
if (a == "+") {
|
||||||
if ( this.amountcartNumber >= item.limitNumber){
|
|
||||||
uni.showToast({
|
|
||||||
title: '当前商品已达到最大赠送数量',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
|
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
|
||||||
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
|
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
|
||||||
} else {
|
} else {
|
||||||
@@ -717,13 +705,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let num = 0;
|
let num = 0;
|
||||||
if (item.cartNumber >= item.limitNumber){
|
|
||||||
uni.showToast({
|
|
||||||
title: '当前商品已达到最大赠送数量',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (item.typeEnum == "normal") {
|
if (item.typeEnum == "normal") {
|
||||||
num = item.cartNumber + this.amountcartNumber;
|
num = item.cartNumber + this.amountcartNumber;
|
||||||
} else {
|
} else {
|
||||||
@@ -984,6 +966,7 @@
|
|||||||
let res = await this.api.productqueryProductSku({
|
let res = await this.api.productqueryProductSku({
|
||||||
code: this.tableCode,
|
code: this.tableCode,
|
||||||
shopId: this.shopId,
|
shopId: this.shopId,
|
||||||
|
"isVip": 0,
|
||||||
productId: item.id, //商品id
|
productId: item.id, //商品id
|
||||||
spec_tag: this.skuidname.join(","),
|
spec_tag: this.skuidname.join(","),
|
||||||
})
|
})
|
||||||
@@ -996,6 +979,7 @@
|
|||||||
"type": c == '+' ? 1 : 0,
|
"type": c == '+' ? 1 : 0,
|
||||||
"productId": item.id, //商品id
|
"productId": item.id, //商品id
|
||||||
"note": item.note,
|
"note": item.note,
|
||||||
|
"isVip": 0,
|
||||||
"shopId": this.shopId,
|
"shopId": this.shopId,
|
||||||
"userId": uni.cache.get('userInfo').id,
|
"userId": uni.cache.get('userInfo').id,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,9 +105,10 @@
|
|||||||
if (options.payAmount) { this.payAmount = options.payAmount }
|
if (options.payAmount) { this.payAmount = options.payAmount }
|
||||||
if (options.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) }
|
if (options.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) }
|
||||||
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
|
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
this.getCouponList()
|
this.getCouponList()
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,6 +134,7 @@
|
|||||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' ) {
|
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' ) {
|
||||||
params.orderId = -1;
|
params.orderId = -1;
|
||||||
}
|
}
|
||||||
|
console.log("params",params)
|
||||||
let res = await this.api.conponList(params)
|
let res = await this.api.conponList(params)
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
|||||||
@@ -119,9 +119,9 @@
|
|||||||
if ( this.is_type == 'he') {
|
if ( this.is_type == 'he') {
|
||||||
this.shareHeOpen()
|
this.shareHeOpen()
|
||||||
}
|
}
|
||||||
this.getByShopId();
|
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
this.getByShopId();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
shareId : this.InviteFriendsData.id,
|
shareId : this.InviteFriendsData.id,
|
||||||
invitedId : uni.cache.get('userInfo').id,
|
invitedId : uni.cache.get('userInfo').id,
|
||||||
shopId : this.shopId,
|
shopId : this.shopId,
|
||||||
isSuccess : this.isSuccess,
|
success : this.isSuccess,
|
||||||
}
|
}
|
||||||
let res = await this.api.shareRecord(params)
|
let res = await this.api.shareRecord(params)
|
||||||
if ( res.code == 0 ) {
|
if ( res.code == 0 ) {
|
||||||
@@ -214,6 +214,7 @@
|
|||||||
},
|
},
|
||||||
tabClick(item) {
|
tabClick(item) {
|
||||||
this.tabAcitve = item.type;
|
this.tabAcitve = item.type;
|
||||||
|
this.shareRecord();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -149,6 +149,9 @@
|
|||||||
listinfo:{
|
listinfo:{
|
||||||
type: Object
|
type: Object
|
||||||
},
|
},
|
||||||
|
amountVIP:{
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch :{
|
watch :{
|
||||||
listinfo:{
|
listinfo:{
|
||||||
@@ -160,14 +163,13 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log(this.listinfo.shopId)
|
|
||||||
uni.$on('couponItem',this.changeCoupon)
|
|
||||||
this.getCalcUsablePoints()
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
// uni.$on('couponItem',this.changeCoupon)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
childOnShow() {
|
||||||
|
console.log(222)
|
||||||
|
uni.$on('couponItem',this.changeCoupon)
|
||||||
|
this.getCalcUsablePoints()
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 监听优惠券/商品券选择
|
* 监听优惠券/商品券选择
|
||||||
* @param {Object} data
|
* @param {Object} data
|
||||||
@@ -180,7 +182,7 @@
|
|||||||
if ( couponData.type == 1 ) { //满减优惠券
|
if ( couponData.type == 1 ) { //满减优惠券
|
||||||
let couponList = _this.userCouponInfos.filter(v => v.type == 1);
|
let couponList = _this.userCouponInfos.filter(v => v.type == 1);
|
||||||
//不包含优惠券的金额
|
//不包含优惠券的金额
|
||||||
let currentPayAmount = (couponList.length > 0 ? _this.listinfo.payAmount + couponList[0].discountAmount : _this.listinfo.payAmount)
|
let currentPayAmount = (couponList.length > 0 ? Number(_this.listinfo.payAmount) + couponList[0].discountAmount : _this.listinfo.payAmount)
|
||||||
// 判断优惠金额不能大于支付金额
|
// 判断优惠金额不能大于支付金额
|
||||||
if ( couponData.discountAmount < currentPayAmount) {
|
if ( couponData.discountAmount < currentPayAmount) {
|
||||||
_this.listinfo.payAmount = ( currentPayAmount - couponData.discountAmount).toFixed(2)
|
_this.listinfo.payAmount = ( currentPayAmount - couponData.discountAmount).toFixed(2)
|
||||||
@@ -203,11 +205,12 @@
|
|||||||
num: couponData.type == 1 ? 1 : couponData.num,
|
num: couponData.type == 1 ? 1 : couponData.num,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
console.log(currentPayAmount)
|
||||||
console.log(_this.listinfo.payAmount)
|
console.log(_this.listinfo.payAmount)
|
||||||
// if ( _this.isPointsChecked ) {
|
if ( _this.isPointsChecked ) {
|
||||||
_this.pointsChange()
|
_this.pointsChange()
|
||||||
_this.getCalcUsablePoints()
|
_this.getCalcUsablePoints()
|
||||||
// }
|
}
|
||||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -230,15 +233,23 @@
|
|||||||
productTicketList.map((item,index) => {
|
productTicketList.map((item,index) => {
|
||||||
productTicketNum += item.num
|
productTicketNum += item.num
|
||||||
})
|
})
|
||||||
|
console.log(productTicketList)
|
||||||
console.log(minCouponList)
|
console.log(minCouponList)
|
||||||
minCouponList.map((item,index) => {
|
minCouponList.map((item,index) => {
|
||||||
productNumber += item.number
|
// productNumber += item.num
|
||||||
if ( productNum > 0 && productNumber > productTicketNum) {
|
if ( productNum > 0) {
|
||||||
let num = productNum >= item.number ? item.number : productNum
|
item.num = (item.num - productTicketNum) <= 0 ? 0 : (item.num - productTicketNum)
|
||||||
productNum = (productNum - item.number) >= 0 ? (productNum - item.number) : 0;
|
productTicketNum = (item.num - productTicketNum) <= 0 ? (productTicketNum - item.num) : item.num - productTicketNum
|
||||||
console.log(num)
|
console.log(productTicketNum)
|
||||||
console.log(item.salePrice)
|
}
|
||||||
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.salePrice))
|
if ( productNum > 0 && item.num > 0) {
|
||||||
|
let num = productNum >= item.num ? item.num : productNum
|
||||||
|
productNum = (productNum - item.num) >= 0 ? (productNum - item.num) : 0;
|
||||||
|
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.price))
|
||||||
|
// let num = productNum >= item.num ? item.num : productNum
|
||||||
|
// productNum = (productNum - item.num) >= 0 ? (productNum - item.num) : 0;
|
||||||
|
|
||||||
|
// productNum = num <= productNum ? num : productNum;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
_this.userCouponInfos.push({
|
_this.userCouponInfos.push({
|
||||||
@@ -257,15 +268,39 @@
|
|||||||
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
||||||
})
|
})
|
||||||
console.log(productNum)
|
console.log(productNum)
|
||||||
console.log(_this.favorable)
|
console.log(productNum == 0 ? couponData.num : productNum)
|
||||||
// if ( _this.isPointsChecked) {
|
if ( _this.isPointsChecked) {
|
||||||
_this.pointsChange()
|
_this.pointsChange()
|
||||||
_this.getCalcUsablePoints()
|
}
|
||||||
// }
|
this.setPayAmount()
|
||||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
|
||||||
}
|
}
|
||||||
uni.$off('couponItem')
|
uni.$off('couponItem')
|
||||||
},
|
},
|
||||||
|
setPayAmount ( cartLists ) {
|
||||||
|
let tableFee;
|
||||||
|
// this.storeInfo.registerType == 'munchies'
|
||||||
|
|
||||||
|
|
||||||
|
if ( this.userCouponInfos.length > 0 ) {
|
||||||
|
console.log(this.userCouponInfos)
|
||||||
|
this.userCouponInfos.forEach(item => {
|
||||||
|
if ( item.type == 1 ) {
|
||||||
|
if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||||
|
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( item.discountAmount && item.discountAmount > 0 ) {
|
||||||
|
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.isPointsChecked = false;
|
||||||
|
this.getCalcUsablePoints()
|
||||||
|
this.$emit("setPayAmount",this.listinfo.payAmount)
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 积分状态监听
|
* 积分状态监听
|
||||||
*/
|
*/
|
||||||
@@ -282,7 +317,8 @@
|
|||||||
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)
|
console.log(this.listinfo.payAmount)
|
||||||
|
this.$emit("setPayAmount",this.listinfo.payAmount)
|
||||||
},
|
},
|
||||||
goUrl(item){
|
goUrl(item){
|
||||||
switch (item.type){
|
switch (item.type){
|
||||||
@@ -661,6 +697,7 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
|
|||||||
@@ -403,7 +403,8 @@
|
|||||||
},
|
},
|
||||||
setPayAmount ( cartLists ) {
|
setPayAmount ( cartLists ) {
|
||||||
let tableFee;
|
let tableFee;
|
||||||
if ( this.is_type == 0 ) {
|
// this.storeInfo.registerType == 'munchies'
|
||||||
|
if ( this.is_type == 0 && this.storeInfo.registerType == 'munchies') {
|
||||||
tableFee = this.shopTableInfo?(this.shopTableInfo.seatNum*this.storeInfo.tableFee):0
|
tableFee = this.shopTableInfo?(this.shopTableInfo.seatNum*this.storeInfo.tableFee):0
|
||||||
} else{
|
} else{
|
||||||
tableFee = 0
|
tableFee = 0
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 先下单后支付 -->
|
<!-- 先下单后支付 -->
|
||||||
<orderInfoAfter ref="orderInfoAfter" :listinfo="listinfo" @setPayAmount="setPayAmount" v-if="listinfo.useType == 'dine-in-after'"></orderInfoAfter>
|
<orderInfoAfter ref="orderInfoAfterRef" :amountVIP="amountVIP" :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>
|
||||||
<!-- 积分兑换订单详情 -->
|
<!-- 积分兑换订单详情 -->
|
||||||
@@ -96,11 +96,16 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
console.log(e)
|
|
||||||
this.orderId = e.orderId
|
this.orderId = e.orderId
|
||||||
|
this.orderorderInfo()
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.orderorderInfo()
|
if ( this.listinfo.useType == "dine-in-after") {
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.orderInfoAfterRef.childOnShow();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
this.ispws = false
|
this.ispws = false
|
||||||
@@ -116,8 +121,10 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setPayAmount(payAmount) {
|
setPayAmount(payAmount) {
|
||||||
|
console.log("payAmount===",payAmount)
|
||||||
this.listinfo.payAmount = payAmount
|
this.listinfo.payAmount = payAmount
|
||||||
this.$forceUpdate()
|
// this.$set(this.listinfo,"payAmount",payAmount)
|
||||||
|
// this.$forceUpdate()
|
||||||
},
|
},
|
||||||
saveImage (url) {
|
saveImage (url) {
|
||||||
uni.saveImage({
|
uni.saveImage({
|
||||||
@@ -157,17 +164,19 @@
|
|||||||
})
|
})
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.listinfo = res.data;
|
this.listinfo = res.data;
|
||||||
console.log(this.listinfo.orderInfo.couponInfoList)
|
|
||||||
if ( this.listinfo.orderInfo.couponInfoList ) {
|
if ( this.listinfo.orderInfo.couponInfoList ) {
|
||||||
this.listinfo.orderInfo.couponInfoList = JSON.parse(this.listinfo.orderInfo.couponInfoList)
|
this.listinfo.orderInfo.couponInfoList = JSON.parse(this.listinfo.orderInfo.couponInfoList)
|
||||||
// this.listinfo.orderInfo.couponInfoList = eval('(' + jsonString + ')')
|
|
||||||
}
|
}
|
||||||
this.listinfoid = res.data.orderId;
|
this.listinfoid = res.data.orderId;
|
||||||
this.shopId = res.data.shopId;
|
this.shopId = res.data.shopId;
|
||||||
if (this.listinfo.useType == " ") {
|
if (this.listinfo.useType == " ") {
|
||||||
//堂食先付费
|
//堂食先付费
|
||||||
}
|
}
|
||||||
console.log(this.listinfo)
|
if ( this.listinfo.useType == "dine-in-after") {
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.orderInfoAfterRef.childOnShow();
|
||||||
|
})
|
||||||
|
}
|
||||||
this.getAount();
|
this.getAount();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -181,10 +190,6 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 去支付
|
* 去支付
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user