管理端细节修改

This commit is contained in:
2026-05-07 15:34:38 +08:00
parent ffad9432c5
commit 13bd39fbed
36 changed files with 2915 additions and 1482 deletions

View File

@@ -30,8 +30,8 @@
<el-table-column label="挂账人" prop="debtor" />
<el-table-column label="手机号" prop="mobile" />
<el-table-column label="已挂账金额(元)" prop="owedAmount" />
<el-table-column label="可用挂账额度(元)" prop="remainingAmount" />
<el-table-column label="账户余额(元)" prop="accountBalance" />
<el-table-column label="可用挂账额度(元)" prop="creditAmount" />
<el-table-column label="操作">
<template v-slot="scope">
<el-button type="text" @click="cellClick(scope.row)">选择</el-button>
@@ -52,8 +52,7 @@
</div>
</el-dialog>
</template>
<script>
import creditApi from "@/api/order/credit";
export default {

View File

@@ -44,12 +44,23 @@
<span class="u-font-14">部分抵扣</span>
</el-radio> -->
</el-radio-group>
<el-input-number class="u-m-l-10" v-if="score.sel != -1" v-model="usePointsNumber" step-strictly
:step="pointsRes.equivalentPoints" placeholder="请输入积分抵扣数量" :min="pointsRes.minDeductionPoints"
:max="pointsRes.maxUsablePoints" :disabled="!pointsRes.usable"
@change="pointsToMoney"></el-input-number>
<el-input-number
class="u-m-l-10"
v-if="score.sel != -1"
v-model="usePointsNumber"
step-strictly
:step="pointsRes.equivalentPoints"
placeholder="请输入积分抵扣数量"
:min="pointsRes.minDeductionPoints"
:max="pointsRes.maxUsablePoints"
:disabled="!pointsRes.usable"
@change="pointsToMoney"
></el-input-number>
</div>
<p class="u-font-14 color-666 u-m-t-10" v-if="pointsRes.unusableReason && !pointsRes.usable">
<p
class="u-font-14 color-666 u-m-t-10"
v-if="pointsRes.unusableReason && !pointsRes.usable"
>
<span class="color-red">*</span>
<span>{{ pointsRes.unusableReason }}</span>
</p>
@@ -70,10 +81,13 @@
</div>
<div class="u-flex u-col-center u-m-t-20 no-wrap">
<span class="u-font-14 font-bold u-m-r-20">优惠券</span>
<div v-if="
carts.orderCostSummary.fullReduction !== undefined &&
carts.orderCostSummary.fullReduction.actualAmount > 0
" style="font-size: 14px; color: #555">
<div
v-if="
carts.orderCostSummary.fullReduction !== undefined &&
carts.orderCostSummary.fullReduction.actualAmount > 0
"
style="font-size: 14px; color: #555"
>
参与满减活动不可用优惠券!
</div>
<div class="u-flex my-select" @click="openCoupon" v-else>
@@ -124,9 +138,14 @@
<p class="u-font-16 font-bold u-m-r-20 font-bold u-flex">选择支付方式</p>
<div class="u-m-t-20">
<div>
<el-button v-for="(item, index) in payTypes.list" :key="index" size="large"
:type="index == payTypes.sel ? 'primary' : ''" :disabled="canUsePayType(item)"
@click="changePayType(index)">
<el-button
v-for="(item, index) in payTypes.list"
:key="index"
size="large"
:type="index == payTypes.sel ? 'primary' : ''"
:disabled="canUsePayType(item)"
@click="changePayType(index)"
>
{{ item.payName }}
</el-button>
</div>
@@ -213,20 +232,43 @@
</div>
</div>
<!-- 扫码 -->
<scanPay ref="refScanPay" :order="orderInfo" @confirm="refScanPayConfirm" @paysuccess="paysuccess"></scanPay>
<scanPay
ref="refScanPay"
:order="orderInfo"
@confirm="refScanPayConfirm"
@paysuccess="paysuccess"
></scanPay>
<!-- 打折 -->
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
<!-- 优惠券 -->
<popup-coupon ref="refCoupon" :user="carts.vipUser" @confirm="refCouponConfirm"></popup-coupon>
<!-- 挂账 -->
<chooseGuaZahng ref="refGuaZhang" :payMoney="currentpayMoney" @confirm="refGuaZhangConfirm"></chooseGuaZahng>
<chooseGuaZahng
ref="refGuaZhang"
:payMoney="currentpayMoney"
@confirm="refGuaZhangConfirm"
></chooseGuaZahng>
<!-- 扫码等待用户支付转台查询 -->
<el-dialog v-model="showCheckPayStauts" width="400" title="订单支付状态查询中..." :close-on-click-modal="false"
:show-close="false">
<el-dialog
v-model="showCheckPayStauts"
width="400"
title="订单支付状态查询中..."
:close-on-click-modal="false"
:show-close="false"
>
<div class="pay_status_content">
<div class="loading" v-loading="checkPayStautsLoading" element-loading-text="用户支付中..."></div>
<div
class="loading"
v-loading="checkPayStautsLoading"
element-loading-text="用户支付中..."
></div>
<div class="btn">
<el-button style="width: 100%" :disabled="!closeState" type="primary" @click="resetScanCode">
<el-button
style="width: 100%"
:disabled="!closeState"
type="primary"
@click="resetScanCode"
>
<span v-if="!closeState">{{ closeStateTime }}秒后可重新扫码</span>
<span v-else>重新扫码</span>
</el-button>
@@ -262,7 +304,7 @@ import discount from "./discount.vue";
import { ElLoading } from "element-plus";
import { ElMessage, ElMessageBox } from "element-plus";
import { BigNumber } from "bignumber.js";
import { onUnmounted } from 'vue'
import { onUnmounted } from "vue";
// 配置BigNumber精度
BigNumber.set({
@@ -272,7 +314,7 @@ BigNumber.set({
//挂账
const refGuaZhang = ref();
function refGuaZhangConfirm(guazhangRen) {
payOrder("arrears", true, guazhangRen);
payOrder("virtual", true, guazhangRen);
}
function refGuaZhangShow() {
refGuaZhang.value.open();
@@ -377,7 +419,7 @@ function discountShow(e) {
const props = defineProps({
table: {
type: Object,
default: () => { },
default: () => {},
},
user: {
type: Object,
@@ -391,7 +433,7 @@ const props = defineProps({
},
orderInfo: {
type: Object,
default: () => { },
default: () => {},
},
});
@@ -506,7 +548,16 @@ async function pointsInit() {
computedMax = Math.floor(computedMax / eq) * eq;
}
res.maxUsablePoints = computedMax;
console.debug("pointsInit debug:", { finalPay: finalPay, basePay: basePay, eq, rawMaxRatio, maxRatio, maxByMoney, userPoints, computedMax });
console.debug("pointsInit debug:", {
finalPay: finalPay,
basePay: basePay,
eq,
rawMaxRatio,
maxRatio,
maxByMoney,
userPoints,
computedMax,
});
// 最小抵扣积分为配置值或等于换算比
res.minDeductionPoints = pointsConfig?.minDeductionPoints || eq;
if (res.maxUsablePoints < res.minDeductionPoints) {
@@ -565,7 +616,10 @@ function pointsToMoney(val) {
}
// 计算抵扣金额(元),向下保留两位
const money = new BigNumber(pts).div(cfg.equivalentPoints).decimalPlaces(2, BigNumber.ROUND_DOWN).toNumber();
const money = new BigNumber(pts)
.div(cfg.equivalentPoints)
.decimalPlaces(2, BigNumber.ROUND_DOWN)
.toNumber();
// 再次校验不超过允许的最大抵扣金额(基于比例或门槛)
let finalPay = Number(carts.orderCostSummary.finalPayAmount) || 0;
@@ -577,7 +631,9 @@ function pointsToMoney(val) {
carts.orderCostSummary.pointDeductionAmount = 0;
return;
}
const maxAllowedMoney = new BigNumber(maxByRatio).decimalPlaces(2, BigNumber.ROUND_DOWN).toNumber();
const maxAllowedMoney = new BigNumber(maxByRatio)
.decimalPlaces(2, BigNumber.ROUND_DOWN)
.toNumber();
console.debug("pointsToMoney debug:", { finalPay, cfg, pts, money, maxByRatio, maxAllowedMoney });
if (money > maxAllowedMoney) {
// 调整积分到允许的最大金额对应的积分
@@ -586,12 +642,15 @@ function pointsToMoney(val) {
}
usePointsNumber.value = pts;
const finalMoney = new BigNumber(pts).div(cfg.equivalentPoints).decimalPlaces(2, BigNumber.ROUND_DOWN).toNumber();
const finalMoney = new BigNumber(pts)
.div(cfg.equivalentPoints)
.decimalPlaces(2, BigNumber.ROUND_DOWN)
.toNumber();
carts.orderCostSummary.pointUsed = pts;
carts.orderCostSummary.pointDeductionAmount = finalMoney;
}
const emits = defineEmits(["chooseUser", "paysuccess", 'createOrder']);
const emits = defineEmits(["chooseUser", "paysuccess", "createOrder"]);
function chooseUser() {
emits("chooseUser");
}
@@ -669,8 +728,7 @@ function returnPayParams() {
allPack: carts.dinnerType == "take-out" ? 1 : 0,
limitRate: carts.limitDiscountRes,
newCustomerDiscountId: carts.newUserDiscount !== null ? carts.newUserDiscount.id : "", // 新客立减Id
newCustomerDiscountAmount:
carts.newUserDiscount !== null ? carts.newUserDiscount.amount : 0, // 新客立减金额
newCustomerDiscountAmount: carts.newUserDiscount !== null ? carts.newUserDiscount.amount : 0, // 新客立减金额
vipDiscountAmount: carts.orderCostSummary.vipDiscountAmount, // 超级会员折扣
remark: cashRemark.value, // 现金支付备注
},
@@ -688,7 +746,8 @@ function refScanPayOpen(payType) {
if (payType == "scanCode") {
return refScanPay.value.open(returnPayParams(), "scanCode");
}
if (payType == "arrears") {
console.log("payType", payType);
if (payType == "virtual") {
refGuaZhangShow();
return;
}
@@ -705,9 +764,8 @@ async function getPaytype() {
const cashRemark = ref("");
async function nowPayClick(payType) {
if (carts.list.length) {
await emits('createOrder', 'only-create')
await emits("createOrder", "only-create");
}
setTimeout(() => {
payType = payType || payTypes.list[payTypes.sel].payType;
if (payType === "cash") {
@@ -715,13 +773,13 @@ async function nowPayClick(payType) {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
inputPlaceholder: '请输入现金支付备注(选填)',
inputPlaceholder: "请输入现金支付备注(选填)",
})
.then(({ value }) => {
cashRemark.value = value || "";
payOrder("cash");
})
.catch(() => { });
.catch(() => {});
return;
}
if (payType == "member-account") {
@@ -777,16 +835,16 @@ async function payOrder(payType, isScan, guazhangren) {
shopUserId: carts.vipUser.id,
});
}
if (payType == "arrears") {
if (payType == "virtual") {
res = await payApi.creditPay({ ...returnPayParams(), creditBuyerId: guazhangren.id });
}
carts.clear();
} catch (error) {
console.log('payOrder===', error);
console.log("payOrder===", error);
// 启动状态查询
if (error.code == 211) {
showCheckPayStauts.value = true
autoCheckOrder()
showCheckPayStauts.value = true;
autoCheckOrder();
}
clearTimeout(payTimer);
loading.close();
@@ -799,68 +857,68 @@ async function payOrder(payType, isScan, guazhangren) {
}
function clearAutoCheckOrder() {
clearInterval(timer.value)
timer.value = null
clearInterval(timer.value);
timer.value = null;
}
// 关闭查询
function closeScanCode() {
showCheckPayStauts.value = false;
reset()
reset();
}
// 重新扫码
function resetScanCode() {
reset()
reset();
showCheckPayStauts.value = false;
clearInterval(timer.value)
timer.value = null
clearInterval(timer.value);
timer.value = null;
clearInterval(closeStateTimer.value)
closeStateTimer.value = null
clearInterval(closeStateTimer.value);
closeStateTimer.value = null;
setTimeout(() => {
refScanPay.value.open(returnPayParams(), "scanCode")
}, 500)
refScanPay.value.open(returnPayParams(), "scanCode");
}, 500);
}
const closeState = ref(false)
const closeState = ref(false);
const closeStateTime = ref(5);
const closeStateTimer = ref(null)
const closeStateTimer = ref(null);
function closeStateTimerFuc() {
closeStateTimer.value = setInterval(() => {
closeStateTime.value--
closeStateTime.value--;
if (closeStateTime.value <= 0) {
clearInterval(closeStateTimer.value)
closeStateTimer.value = null
closeState.value = true
clearInterval(closeStateTimer.value);
closeStateTimer.value = null;
closeState.value = true;
}
}, 1000)
}, 1000);
}
// 自动查询订单状态
const timer = ref(null)
const timer = ref(null);
function autoCheckOrder() {
closeStateTimerFuc()
closeStateTimerFuc();
timer.value = setInterval(() => {
// 开始锁单
// goodsStore.isOrderLock({
// table_code: table_code.value
// }, 'pay_lock')
checkPayStauts(false)
}, 2000)
checkPayStauts(false);
}, 2000);
}
function reset() {
checkPayStautsLoading.value = true;
closeState.value = false
closeStateTime.value = 5
closeState.value = false;
closeStateTime.value = 5;
}
// 查询订单支付状态
const showCheckPayStauts = ref(false)
const checkPayStautsLoading = ref(true)
const showCheckPayStauts = ref(false);
const checkPayStautsLoading = ref(true);
async function checkPayStauts(tips = true) {
try {
// 扫码下单
@@ -875,7 +933,7 @@ async function checkPayStauts(tips = true) {
checkPayStautsLoading.value = false;
// scanCode.value = "";
showCheckPayStauts.value = false;
clearAutoCheckOrder()
clearAutoCheckOrder();
paysuccess();
return;
}
@@ -885,8 +943,8 @@ async function checkPayStauts(tips = true) {
}
return;
} else {
clearAutoCheckOrder()
ElMessage.warning(res.msg || '');
clearAutoCheckOrder();
ElMessage.warning(res.msg || "");
return;
}
} catch (error) {
@@ -955,8 +1013,8 @@ watch(
);
onUnmounted(() => {
clearAutoCheckOrder()
})
clearAutoCheckOrder();
});
onMounted(() => {
carts.payParamsInit();
@@ -1061,4 +1119,4 @@ defineExpose({
padding-top: var(--el-font-size-base);
}
}
</style>
</style>

View File

@@ -9,7 +9,7 @@
</div>
<div>
<div class="">可用额度</div>
<div class="u-m-t-6">{{ guazhangRen.remainingAmount }}</div>
<div class="u-m-t-6">{{ guazhangRen.creditAmount + guazhangRen.accountBalance }}</div>
</div>
</template>
<template v-else>
@@ -43,8 +43,8 @@
<choose-guazhang ref="refChooseGuazhang" @confirm="chooseGuazhangConfirm"></choose-guazhang>
</div>
</template>
<script>
<script>
import { ElMessage } from "element-plus";
import keyBoard from "./keyboard.vue";
import chooseGuazhang from "./choose-guazhang.vue";
@@ -144,8 +144,8 @@ export default {
mounted() {},
};
</script>
<style lang="scss" scoped>
<style lang="scss" scoped>
:deep(.el-button) {
padding: 12px 20px;
}
@@ -350,4 +350,4 @@ export default {
.confirm_btns .el-button {
width: 175px;
}
</style>
</style>

View File

@@ -29,8 +29,9 @@
</template>
</el-dialog>
</template>
<script>
<script>
import { ElMessage } from "element-plus";
import { BigNumber } from "bignumber.js";
export default {
data() {
return {
@@ -60,6 +61,7 @@ export default {
open(opt) {
this.show = true;
this.option = opt;
console.log(new BigNumber("0.00"));
},
close() {
this.show = false;
@@ -73,7 +75,7 @@ export default {
if (valid) {
console.log(valid);
if (this.form.discount_sale_amount * 1 <= 0 || this.form.discount_sale_amount * 1 <= 0) {
return ElMessage.error("价格和数量必须大于0");
// return ElMessage.error("价格和数量必须大于0");
}
this.submit();
} else {
@@ -86,8 +88,8 @@ export default {
mounted() {},
};
</script>
<style lang="scss" scoped>
<style lang="scss" scoped>
:deep(.el-dialog__body) {
margin-bottom: 14px;
margin-top: 14px;
@@ -108,4 +110,4 @@ input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style>
</style>

View File

@@ -1,5 +1,5 @@
<template>
<div class="box" v-loading="!carts.isLinkFinshed" element-loading-text="购物车连接初始化中,请稍等……">
<div class="box">
<div class="content">
<div class="top">
<div class="left u-flex u-col-center">
@@ -9,8 +9,12 @@
<el-button type="primary" v-if="!carts.vipUser.id">选择用户</el-button>
<div v-else class="flex cur-pointer">
<img v-if="carts.vipUser.headImg && carts.vipUser.headImg != 'null'" class="headimg"
:src="carts.vipUser.headImg" alt="" />
<img
v-if="carts.vipUser.headImg && carts.vipUser.headImg != 'null'"
class="headimg"
:src="carts.vipUser.headImg"
alt=""
/>
<div v-else class="headimg flex flex-x-y-center">
<i class="el-icon-user"></i>
</div>
@@ -28,11 +32,19 @@
</div>
</div>
<el-popover placement="right" width="333" trigger="click" ref="refTable">
<el-input placeholder="请输入内容" prefix-icon="search" v-model="tableSearchText"
@input="tablesearchInput"></el-input>
<el-input
placeholder="请输入内容"
prefix-icon="search"
v-model="tableSearchText"
@input="tablesearchInput"
></el-input>
<div style="max-height: 398px; overflow-y: scroll" class="u-m-t-12">
<div class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30" v-for="(item, index) in tableList"
:key="index" @click="tableClick(item, index)">
<div
class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30"
v-for="(item, index) in tableList"
:key="index"
@click="tableClick(item, index)"
>
<span>{{ item.name }}</span>
<span :style="{ color: returnTableColor(item.status) }">
{{ returnTableLabel(item.status) }}
@@ -52,7 +64,12 @@
</div>
</div>
<div class="right">
<el-input placeholder="请输入商品名称" v-model="goods.query.name" clearable @change="getGoods">
<el-input
placeholder="请输入商品名称"
v-model="goods.query.name"
clearable
@change="getGoods"
>
<template #suffix>
<el-icon class="el-input__icon">
<search />
@@ -66,16 +83,24 @@
<div class="diners">
<!-- 就餐类型 -->
<el-button-group v-model="diners.sel" style="width: 100%; display: flex">
<el-button :class="{ active: index == diners.sel }" v-for="(item, index) in diners.list"
:disabled="dinerDisabled(item, index)" @click="changeDinersSel(index)" :key="index">
<el-button
:class="{ active: index == diners.sel }"
v-for="(item, index) in diners.list"
:disabled="dinerDisabled(item, index)"
@click="changeDinersSel(index)"
:key="index"
>
{{ item.label }}
</el-button>
</el-button-group>
</div>
<div class="u-flex u-font-14 clear u-m-t-10 perpoles">
<div @click="showDinerNumber" class="u-flex u-p-r-14 u-m-r-14"
style="border-right: 1px solid #ebebeb; line-height: 1">
<div
@click="showDinerNumber"
class="u-flex u-p-r-14 u-m-r-14"
style="border-right: 1px solid #ebebeb; line-height: 1"
>
<span>就餐人数{{ perpole || "-" }} </span>
<el-icon>
<ArrowRight />
@@ -86,19 +111,39 @@
</el-button>
</div>
<!-- 购物车 -->
<cartsList @editNote="showNote(true)" @createOrder="createOrder" @hideOrder="hideOrder"
@clearOldOrder="clearOldOrder" :showOrder="showOrder" :goodsList="carts.goods" :dinerType="diners.sel"
:perpole="perpole" :remark="remark" :table="carts.tableInfo" ref="refCart"></cartsList>
<cartsList
@editNote="showNote(true)"
@createOrder="createOrder"
@hideOrder="hideOrder"
@clearOldOrder="clearOldOrder"
:showOrder="showOrder"
:goodsList="carts.goods"
:dinerType="diners.sel"
:perpole="perpole"
:remark="remark"
:table="carts.tableInfo"
ref="refCart"
></cartsList>
</div>
<div class="center">
<!-- 购物车控制操作按钮 -->
<Controls @noteClick="showNote" @packClick="showPack" @changePriceClick="showChangePrice"
@return="refReturnCartShow" @rottable="rottableShow" @changeCartNumberShow="refChangeNumberShow" />
<Controls
@noteClick="showNote"
@packClick="showPack"
@changePriceClick="showChangePrice"
@return="refReturnCartShow"
@rottable="rottableShow"
@changeCartNumberShow="refChangeNumberShow"
/>
</div>
<div class="right">
<template v-if="!showOrder">
<div class="flex categoty u-col-center">
<div class="show_more_btn" :class="{ showAll: category.showAll }" @click="toggleShowAll">
<div
class="show_more_btn"
:class="{ showAll: category.showAll }"
@click="toggleShowAll"
>
<div class="flex">
<div class="flex showmore">
<el-icon color="#fff">
@@ -109,8 +154,16 @@
</div>
</div>
<div class="flex categorys" :class="{ 'flex-wrap': category.showAll }">
<div v-for="(item, index) in category.list" :key="index" @click="changeCategoryId(item)">
<el-tag size="large" :type="goods.query.categoryId === item.id ? 'primary' : 'info'" effect="dark">
<div
v-for="(item, index) in category.list"
:key="index"
@click="changeCategoryId(item)"
>
<el-tag
size="large"
:type="goods.query.categoryId === item.id ? 'primary' : 'info'"
effect="dark"
>
{{ item.name }}
</el-tag>
</div>
@@ -124,13 +177,26 @@
</el-icon>
<div class="u-m-t-10">临时菜</div>
</div>
<GoodsItem :item="item" @itemClick="goodsClick(item)" v-for="item in carts.goods" :key="item.id">
</GoodsItem>
<GoodsItem
:item="item"
@itemClick="goodsClick(item)"
v-for="item in carts.goods"
:key="item.id"
></GoodsItem>
</div>
</template>
<!-- 订单信息展示 -->
<Order ref="refOrder" :orderInfo="carts.oldOrder" @chooseUser="showChooseUser" @paysuccess="refresh"
:table="carts.tableInfo" :perpole="perpole" v-else :user="user" @create-order="createOrder"></Order>
<Order
ref="refOrder"
:orderInfo="carts.oldOrder"
@chooseUser="showChooseUser"
@paysuccess="refresh"
:table="carts.tableInfo"
:perpole="perpole"
v-else
:user="user"
@create-order="createOrder"
></Order>
</div>
</div>
</div>
@@ -145,7 +211,11 @@
<!-- 临时菜 -->
<addLingShiCai ref="refAddLingShiCai" @confirm="addLingShiCaiConfirm"></addLingShiCai>
<!-- 改价 -->
<changePrice ref="refChangePrice" :useVipPrice="carts.useVipPrice" @confirm="changePriceConfirm"></changePrice>
<changePrice
ref="refChangePrice"
:useVipPrice="carts.useVipPrice"
@confirm="changePriceConfirm"
></changePrice>
<!-- 称重商品 -->
<change-weight ref="refChangeWeight" @confirm="changeWeightConfirm"></change-weight>
<!-- 可选套餐 -->
@@ -518,7 +588,7 @@ async function getTableDetail(params) {
const res = await tableApi.get(params);
return res;
}
function tablesearchInput() { }
function tablesearchInput() {}
//返回桌台状态颜色
function returnTableColor(key) {
const item = $status[key];
@@ -665,7 +735,7 @@ function getCategoryList() {
size: 200,
})
.then((res) => {
localStorage.setItem('categorys', JSON.stringify(res))
localStorage.setItem("categorys", JSON.stringify(res));
res.unshift({ name: "全部", id: "" });
category.list = res;
});
@@ -803,14 +873,14 @@ onMounted(async () => {
// : await orderApi.getHistoryList({
// tableCode,
// });
let res = ''
let res = "";
if (id) {
res = await orderApi.getHistoryList({
orderId: id,
})
});
} else {
res = await orderApi.getHistoryList({
tableCode: carts.table_code,
tableCode: carts.table_code || tableCode,
});
}