From 4245c2be0d2751d023f5a893b00fb39308d9b2d9 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Sun, 28 Sep 2025 17:41:19 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=EF=BC=8C=E5=85=85=E5=80=BC?=
=?UTF-8?q?=EF=BC=8C=E6=98=8E=E7=BB=86=EF=BC=8C=E4=B8=8B=E5=8D=95=E9=97=AE?=
=?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/css/common.scss | 3 +
components/coupon/coupon-icon.vue | 128 +++++++++++++++++++++++++
components/coupon/list.vue | 82 ++++++++++++++++
pages/order/components/charge.vue | 48 ++++++++--
pages/order/components/orderInfo.vue | 135 ++++++++++++++++++++-------
pages/order/confirm-order.vue | 114 ++++++++++++----------
pages/order/coupon.vue | 5 +-
pages/user/member/billDetails.vue | 78 ++++++++--------
pages/user/member/czzx.vue | 51 ++++++----
stores/carts.js | 7 +-
user/vip/buy-vip.vue | 4 +-
utils/goods-utils.js | 2 +-
utils/pay.js | 2 +-
13 files changed, 508 insertions(+), 151 deletions(-)
create mode 100644 components/coupon/coupon-icon.vue
create mode 100644 components/coupon/list.vue
diff --git a/common/css/common.scss b/common/css/common.scss
index 04012c7..349114d 100644
--- a/common/css/common.scss
+++ b/common/css/common.scss
@@ -91,4 +91,7 @@ page,
}
.u-flex-1{
flex:1;
+ }
+ .u-col-center{
+ align-items: center;
}
\ No newline at end of file
diff --git a/components/coupon/coupon-icon.vue b/components/coupon/coupon-icon.vue
new file mode 100644
index 0000000..61e3d50
--- /dev/null
+++ b/components/coupon/coupon-icon.vue
@@ -0,0 +1,128 @@
+
+
+
+
+
+ ¥
+ {{ props.item.discountAmount }}
+
+
+ 满{{ props.item.fullAmount }}可用
+
+
+
+
+ {{ props.item.discountNum }}件
+ 商品兑换
+
+
+ 满{{ props.item.fullAmount }}可用
+
+
+
+
+ {{ props.item.discountRate }}折
+
+
+ 满{{ props.item.fullAmount }}可用
+
+
+
+
+ 第二件
+ 半价券
+
+
+
+
+ 买一送
+ 一券
+
+
+
+
+
+
+
+
diff --git a/components/coupon/list.vue b/components/coupon/list.vue
new file mode 100644
index 0000000..7335c4c
--- /dev/null
+++ b/components/coupon/list.vue
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+ 查看优惠券
+ ({{list.length}})张
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.coupon.title }}
+
+
+ 有效期至:{{item.coupon.validEndTime||''}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/order/components/charge.vue b/pages/order/components/charge.vue
index f09aee2..0210ef2 100644
--- a/pages/order/components/charge.vue
+++ b/pages/order/components/charge.vue
@@ -7,7 +7,7 @@
-
¥
@@ -26,9 +26,9 @@
送
- {{item.couponInfoList.length}}
+ {{couponNum(item.couponInfoList)}}
张券
- 查看
+ 查看
@@ -40,21 +40,39 @@
+
\ No newline at end of file
diff --git a/pages/order/confirm-order.vue b/pages/order/confirm-order.vue
index 837cc27..a48d532 100644
--- a/pages/order/confirm-order.vue
+++ b/pages/order/confirm-order.vue
@@ -118,7 +118,10 @@
BigNumber
} from 'bignumber.js';
import ChargeVue from './components/charge.vue';
- import {pay} from '@/utils/pay.js'
+ import {
+ pay
+ } from '@/utils/pay.js'
+
function onback() {
closeSocket()
back()
@@ -149,7 +152,8 @@
import {
APIgetOrderById,
APIputuserorder,
- APIhistoryOrder,rechargePayOrder
+ APIhistoryOrder,
+ rechargePayOrder
} from '@/common/api/order/index.js'
import {
APIusershopInfodetail,
@@ -166,19 +170,22 @@
useWebSocket
} from '@/stores/carts-websocket.js';
const cartStore = useCartsStore()
-
-
+
+
//充值相关
- const rechargeItem=ref({id:''})
- const rechargeId=ref(null)
-
- function updateRechargeId(e){
- rechargeId.value=e
+ const rechargeItem = ref({
+ id: ''
+ })
+ const rechargeId = ref(null)
+
+ function updateRechargeId(e) {
+ rechargeId.value = e
}
- function updateChargeSel(e){
- rechargeItem.value=e
+
+ function updateChargeSel(e) {
+ rechargeItem.value = e
}
-
+
async function onMessage(Message) {
cartStore.onMessage(Message, cartsSocket)
listinfo.totalPrices = historyTotalPrices * 1 + cartStore.totalPrice * 1
@@ -192,8 +199,8 @@
let res = await APIgetOrderById({
orderId: listinfo.id
})
- console.log('onMessage:APIgetOrderById',res);
- if(res){
+ console.log('onMessage:APIgetOrderById', res);
+ if (res) {
// cartStore.carts=[];
// cartStore.setOldOrder(res)
}
@@ -590,7 +597,7 @@
// cartStore.carts=[];
// cartStore.setOldOrder(res)
getOrderInfoAfterCalcInit(res)
-
+
cartsSocket.sendMessage({
type: 'shopping',
table_code: uni.cache.get('tableCode'),
@@ -647,12 +654,12 @@
if (!cartStore.isEmpty) {
const res = await createOrder()
//历史订单数据
- const res1= await APIgetOrderById({
+ const res1 = await APIgetOrderById({
orderId: res.id
})
cartStore.setOldOrder(res1)
}
-
+
goToPay()
} else {
@@ -700,22 +707,26 @@
const goToPay = async (isCreateOrder = false) => {
// 余额支付
if (paymentmethod.payType == 'accountPay') {
- if (orderVIP.value.isVip == 0) {
- uni.showModal({
- title: '提示',
- content: '您还不是会员,是否去注册会员?',
- success: (res) => {
- if (res.confirm) {
- uni.pro.navigateTo('user/member/index', {
- shopId: orderVIP.value.shopId,
- type: 'detail'
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
- } else if (orderVIP.value.payPwd == '') {
+ // if (orderVIP.value.isVip == 0) {
+ // uni.showModal({
+ // title: '提示',
+ // content: '您还不是会员,是否去注册会员?',
+ // success: (res) => {
+ // if (res.confirm) {
+ // uni.pro.navigateTo('user/member/index', {
+ // shopId: orderVIP.value.shopId,
+ // type: 'detail'
+ // })
+ // } else if (res.cancel) {
+ // console.log('用户点击取消');
+ // }
+ // }
+ // })
+ // return
+
+ // }
+
+ if (orderVIP.value.payPwd == '') {
uni.showModal({
title: '提示',
content: '您还未设置支付密码,是否去设置?',
@@ -779,7 +790,7 @@
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
- originAmount: cartStore.orderCostSummary.goodsRealAmount , //订单原金额(包含打包费+餐位费) 不含折扣价格
+ originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
discountAmount: 0, //手动优惠金额 写死0
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
@@ -789,25 +800,29 @@
roundAmount: 0, //抹零金额 减免多少钱
pointsDiscountAmount: cartStore.orderCostSummary
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
- pointsNum: listinfo.pointsNum, //(扣除各类折扣 enable_deduction后使用)
+ pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
+ newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
+ newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore
+ .consumeDiscount.id : '',
remark: '', //用户备注
}
console.log('topay checkOrderPay', checkOrderPay);
try {
- if(rechargeItem.value.id&&rechargeId.value){
+ if (rechargeItem.value.id && rechargeId.value) {
//充值支付
- const payRes= await rechargePayOrder({
+ const payRes = await rechargePayOrder({
checkOrderPay,
payType: paymentmethod.payType,
buyerRemark: '',
returnUrl: '',
- rechargeId:rechargeId.value,
- rechargeDetailId:rechargeItem.value.id,
- shopUserId:orderVIP.value.id,
+ rechargeId: rechargeId.value,
+ rechargeDetailId: rechargeItem.value.id,
+ shopUserId: orderVIP.value.id,
shopId: orderVIP.value.shopId,
})
- pay(payRes)
- }else{
+ await pay(payRes)
+ pay_unlock()
+ } else {
console.log('微信支付');
await storeMemberpay.actionsltPayOrder({
checkOrderPay,
@@ -815,15 +830,17 @@
buyerRemark: '',
returnUrl: ''
})
+ pay_unlock()
}
-
+
} catch (error) {
- console.log('error',error);
+ console.log('error', error);
pay_unlock()
//TODO handle the exception
}
}
pay_unlock()
+ console.log('orderorderInfo');
orderorderInfo()
}
@@ -853,7 +870,7 @@
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
- originAmount: cartStore.orderCostSummary.goodsRealAmount , //订单原金额(包含打包费+餐位费) 不含折扣价格
+ originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
discountAmount: 0, //手动优惠金额 写死0
productCouponDiscountAmount: cartStore.orderCostSummary.productCouponDeduction, //商品优惠券抵扣金额
@@ -863,7 +880,10 @@
roundAmount: 0, //抹零金额 减免多少钱
pointsDiscountAmount: cartStore.orderCostSummary
.pointDeductionAmount, //积分抵扣金额(tb_points_basic_setting表)
- pointsNum: listinfo.pointsNum, //(扣除各类折扣 enable_deduction后使用)
+ pointsNum: cartStore.orderCostSummary.pointUsed, //(扣除各类折扣 enable_deduction后使用)
+ newCustomerDiscountAmount: cartStore.orderCostSummary.newUserDiscount, //新客立减
+ newCustomerDiscountId: cartStore.orderCostSummary.newUserDiscount > 0 ? cartStore.consumeDiscount
+ .id : '',
remark: '', //用户备注
}
try {
@@ -934,7 +954,7 @@
url: '/pages/product/index'
})
}
- const packfee=computed(()=>{
+ const packfee = computed(() => {
return cartStore.orderCostSummary.packFee
})
//不计算各种折扣前的实付金额
diff --git a/pages/order/coupon.vue b/pages/order/coupon.vue
index 94afc1d..184532c 100644
--- a/pages/order/coupon.vue
+++ b/pages/order/coupon.vue
@@ -323,7 +323,10 @@
let noUseGoodsCoupon = []
let noUseDiscountCoupon = []
const user = uni.cache.get('shopUserInfo')
- const shopInfo = uni.cache.get('shopInfo')
+ let shopInfo = uni.cache.get('shopInfo')||{}
+ if(!shopInfo.isMemberPrice){
+ shopInfo={}
+ }
const goodsOrderPrice = uni.getStorageSync('goodsOrderPrice') || 0
const goodsList = uni.getStorageSync('canDikouGoodsArr') || []
const dinnerType = uni.getStorageSync('dinnerType')
diff --git a/pages/user/member/billDetails.vue b/pages/user/member/billDetails.vue
index 0e506a7..74becd8 100644
--- a/pages/user/member/billDetails.vue
+++ b/pages/user/member/billDetails.vue
@@ -25,41 +25,44 @@
+
+
+
+ 现金充值
+
+
+ 微信小程序充值
+
+
+ 支付宝小程序充值
+
+
+ 充值奖励
+
+
+ 充值退款
+
+
+ 订单消费
+
+
+ 订单退款
+
+
+ 管理员充值
+
+
+ 管理员消费
+
+
+
+ {{item.content}}
+
+
+
-
-
-
- 现金充值
-
-
- 微信小程序充值
-
-
- 支付宝小程序充值
-
-
- 充值奖励
-
-
- 充值退款
-
-
- 订单消费
-
-
- 订单退款
-
-
- 管理员充值
-
-
- 管理员消费
-
-
-
- {{item.content}}
-
-
+
+ {{item.shopName||'门店名称'}}
{{ item.amount }}
@@ -285,11 +288,6 @@
color: #FF7127;
}
- >view {
- font-weight: bold;
- font-size: 32rpx;
- color: #333333;
- }
}
.listStyle_left {
@@ -304,7 +302,7 @@
}
.listrigth2 {
- margin-top: 16rpx;
+ margin-top: 4rpx;
>view {
font-weight: 500;
diff --git a/pages/user/member/czzx.vue b/pages/user/member/czzx.vue
index a11d998..eff173e 100644
--- a/pages/user/member/czzx.vue
+++ b/pages/user/member/czzx.vue
@@ -14,7 +14,7 @@
余额
- {{shopUserInfo.amount}}
+ {{shopUserInfo.amount||0}}
明细
@@ -43,7 +43,7 @@
:class="{active:sel==index}">
¥
- {{item.amount}}
@@ -51,16 +51,16 @@
¥
{{item.rewardAmount}}
-
+
送
- ¥
{{item.rewardPoints}}
+ 积分
送
- {{item.couponInfoList.length}}
+ {{couponNum(item.couponInfoList) }}
张券
- 查看
+ 查看
@@ -68,12 +68,15 @@
-
- 其他金额
-
-
- 自定义金额充值时,不享受任何优惠赠送
+
+
+ 其他金额
+
+
+ 自定义金额充值时,不享受任何优惠赠送
+
+
充值说明
-
+
{{state.remark||''}}
-
+
-
+
@@ -114,6 +117,7 @@
APIusershopInfodetail,
APIshopUserInfo
} from '@/common/api/member.js'
+ import CouponList from '@/components/coupon/list.vue'
import * as rechargeApi from '@/common/api/market/recharge.js'
import {
recharge
@@ -134,6 +138,21 @@
import {
pay
} from '@/utils/pay.js'
+
+ function couponNum(list) {
+ return list.reduce((prve, cur) => {
+ return prve + cur.num
+ }, 0)
+ }
+ const couponModel = reactive({
+ show: false,
+ couponInfoList: []
+ })
+
+ function lookCoupon(item) {
+ couponModel.show = true
+ couponModel.couponInfoList = item.couponInfoList
+ }
async function buy() {
if (!charge_money.value) {
return uni.showToast({
@@ -146,7 +165,7 @@
shopUserId: shopUserInfo.id,
}
if (sel.value < 0) {
- json.amount = `${money.value}`.trim()*1
+ json.amount = `${money.value}`.trim() * 1
} else {
json.rechargeDetailId = list.value[sel.value].id
json.amount = list.value[sel.value].amount
diff --git a/stores/carts.js b/stores/carts.js
index 23baf17..53e2856 100644
--- a/stores/carts.js
+++ b/stores/carts.js
@@ -33,6 +33,8 @@ export const useCartsStore = defineStore('cart',
isMemberPrice: 0,
isTableFee: 1
})
+
+ const consumeDiscount=ref({})
// 适配工具库 BaseCartItem 接口的商品数据转换函数
const convertToBaseCartItem = (item) => {
@@ -584,9 +586,12 @@ export const useCartsStore = defineStore('cart',
setSeatFeeConfig,
seatFeeConfig,
shopInfo,
+ //新客立减数据
+ consumeDiscount,
//新客立减金额
newUserDiscount,
- getAllGoodsList
+ getAllGoodsList,
+
};
}
);
\ No newline at end of file
diff --git a/user/vip/buy-vip.vue b/user/vip/buy-vip.vue
index f01684c..f63219a 100644
--- a/user/vip/buy-vip.vue
+++ b/user/vip/buy-vip.vue
@@ -4,7 +4,7 @@
-
+
{{shopInfo.shopName||'店铺名称' }}
@@ -577,7 +577,7 @@
display: grid;
grid-template-columns: repeat(3, 1fr);
column-gap: 36rpx;
-
+ row-gap: 36rpx;
.vip-list-item {
border: 4rpx solid #D9D9D9;
border-radius: 40rpx;
diff --git a/utils/goods-utils.js b/utils/goods-utils.js
index db21553..119bf88 100644
--- a/utils/goods-utils.js
+++ b/utils/goods-utils.js
@@ -438,7 +438,7 @@ export function returnCanDikouGoods(arr, user, shopInfo) {
return v.num > 0;
})
.sort((a, b) => {
- return returnGoodsPrice(b, use, shopInfo) - returnGoodsPrice(a, user, shopInfo);
+ return returnGoodsPrice(b, user, shopInfo) - returnGoodsPrice(a, user, shopInfo);
});
return result;
}
\ No newline at end of file
diff --git a/utils/pay.js b/utils/pay.js
index b4aec2c..43b4c8c 100644
--- a/utils/pay.js
+++ b/utils/pay.js
@@ -1,5 +1,5 @@
export const pay = (res) => {
- return new Promise((reslove, reject) => {
+ return new Promise((resolve, reject) => {
uni.showLoading({
title: '支付中...',
mask: true