feat: 代客下单更新
This commit is contained in:
@@ -224,12 +224,12 @@ function to2(n) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
::v-deep .order-input-number .el-input__inner::-webkit-inner-spin-button {
|
||||
:deep(.order-input-number .el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::v-deep .order-input-number .el-input__inner::-webkit-outer-spin-button {
|
||||
:deep(.order-input-number .el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@@ -254,15 +254,15 @@ onMounted(() => {
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .number-box .el-input__inner {
|
||||
:deep(.number-box .el-input__inner) {
|
||||
border: none;
|
||||
}
|
||||
|
||||
::v-deep .el-button--text {
|
||||
:deep(.el-button--text) {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
::v-deep .number-box .el-input__inner {
|
||||
:deep(.number-box .el-input__inner) {
|
||||
border: none;
|
||||
padding: 0 4px;
|
||||
text-align: center;
|
||||
@@ -478,12 +478,12 @@ onMounted(() => {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
::v-deep .order-input-number .el-input__inner::-webkit-inner-spin-button {
|
||||
:deep(.order-input-number .el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::v-deep .order-input-number .el-input__inner::-webkit-outer-spin-button {
|
||||
:deep(.order-input-number .el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- <div class="color-666 u-font-14">订单备注:{{ "123" }}</div> -->
|
||||
<div class="color-666 u-font-14" v-if="remark">订单备注:{{ remark }}</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="u-flex u-row-right">
|
||||
@@ -88,24 +88,64 @@
|
||||
<el-link type="primary">打印制作单</el-link>
|
||||
<div>
|
||||
<span class="totalNumber">共{{ carts.totalNumber }}件</span>
|
||||
<span class="totalPrice">¥{{ totalMoney }}</span>
|
||||
<span class="totalPrice">¥{{ carts.payMoney }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" v-if="isXianFuKuan">
|
||||
<el-button type="primary" size="large" @click="createOrder()">微信/支付宝</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder()">现金</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder()">更多支付</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:disabled="!goodsMapisFinish"
|
||||
@click="createOrder('wx-aiplay')"
|
||||
>
|
||||
微信/支付宝
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:disabled="!goodsMapisFinish"
|
||||
@click="createOrder('cash')"
|
||||
>
|
||||
现金
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:disabled="!goodsMapisFinish || showOrder"
|
||||
@click="createOrder('more-pay')"
|
||||
>
|
||||
更多支付
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="btn-group" v-else>
|
||||
<template v-if="!showOrder">
|
||||
<el-button type="primary" size="large" @click="createOrder('only-create')">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:disabled="!goodsMapisFinish"
|
||||
@click="createOrder('only-create')"
|
||||
>
|
||||
仅下单
|
||||
</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder('to-pay')">去结账</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:disabled="!goodsMapisFinish"
|
||||
@click="createOrder('to-pay')"
|
||||
>
|
||||
去结账
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button type="default" size="large" @click="hideOrder()">加菜/返回</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder('to-pay')">立即支付</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:disabled="!goodsMapisFinish"
|
||||
@click="createOrder('to-pay')"
|
||||
>
|
||||
立即支付
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -123,6 +163,10 @@ const shopUser = useUserStore();
|
||||
const carts = useCartsStore();
|
||||
|
||||
const props = defineProps({
|
||||
remark: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
@@ -216,9 +260,9 @@ function itemClick(item) {
|
||||
function changeNumber(step, item) {
|
||||
carts.changeNumber(step * 1, item);
|
||||
}
|
||||
const totalMoney = computed(() => {
|
||||
return (carts.payMoney * 1 + (carts.oldOrder.originAmount || 0) * 1).toFixed(2);
|
||||
});
|
||||
// const totalMoney = computed(() => {
|
||||
// return (carts.payMoney * 1 + (carts.oldOrder.originAmount || 0) * 1).toFixed(2);
|
||||
// });
|
||||
defineExpose({
|
||||
carts,
|
||||
init,
|
||||
|
||||
@@ -184,12 +184,12 @@ defineExpose({
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
::v-deep .el-input--small .el-input__inner {
|
||||
:deep(.el-input--small .el-input__inner) {
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
::v-deep .image-slot {
|
||||
:deep(.image-slot) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
||||
@@ -161,7 +161,7 @@ defineExpose({ open, close });
|
||||
font-size: 11px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
::v-deep .number-box .el-input__inner {
|
||||
:deep(.number-box .el-input__inner) {
|
||||
border: none;
|
||||
padding: 0 4px;
|
||||
text-align: center;
|
||||
|
||||
@@ -135,7 +135,7 @@ export default {
|
||||
filter: grayscale(1);
|
||||
}
|
||||
}
|
||||
::v-deep .inputs .el-input__inner {
|
||||
:deep(.inputs .el-input__inner) {
|
||||
border-color: transparent !important;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 1.25px;
|
||||
|
||||
@@ -47,7 +47,7 @@ function addNote(tag) {
|
||||
}
|
||||
function open(remark, isOneNote) {
|
||||
isOne.value = isOneNote;
|
||||
title.value = isOneNote ? "整单备注(提交订单时生效)" : "单品备注(提交订单时生效)";
|
||||
title.value = !isOneNote ? "整单备注(提交订单时生效)" : "单品备注(提交订单时生效)";
|
||||
show.value = true;
|
||||
note.value = remark ? remark : "";
|
||||
const tags = localStorage.getItem("tags");
|
||||
@@ -80,11 +80,11 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
:deep(.el-dialog__body) {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
::v-deep .el-tag {
|
||||
:deep(.el-tag) {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
@@ -74,13 +74,14 @@
|
||||
:key="index"
|
||||
size="large"
|
||||
:type="index == payTypes.sel ? 'primary' : ''"
|
||||
:disabled="canUsePayType(item)"
|
||||
@click="changePayType(index)"
|
||||
>
|
||||
{{ item.payName }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="u-m-t-20">
|
||||
<el-button type="primary" size="large" @click="nowPayClick">立即支付</el-button>
|
||||
<el-button type="primary" size="large" @click="nowPayClick()">立即支付</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -172,6 +173,8 @@ function discountConfirm(e) {
|
||||
if (e.discount) {
|
||||
checkOrderPay.discountAmount =
|
||||
carts.payMoney - (carts.payMoney * (e.discount / 100).toFixed(2)).toFixed(2);
|
||||
} else {
|
||||
checkOrderPay.discount = 0;
|
||||
}
|
||||
}
|
||||
function discountShow(e) {
|
||||
@@ -246,19 +249,33 @@ const payTypes = reactive({
|
||||
list: [],
|
||||
sel: 0,
|
||||
});
|
||||
function canUsePayType(item) {
|
||||
if (currentpayMoney.value * 1 == 0) {
|
||||
return item.payType == "cash" ? false : true;
|
||||
}
|
||||
// if (item.payType == "virtual" && item.payName == "会员支付") {
|
||||
// return props.user.id ? false : true;
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
const refScanPay = ref();
|
||||
function changePayType(i) {
|
||||
const payType = payTypes.list[i].payType;
|
||||
refScanPayOpen(payType);
|
||||
payTypes.sel = i;
|
||||
if (payType == "member-account") {
|
||||
return chooseUser();
|
||||
}
|
||||
refScanPayOpen(payType);
|
||||
}
|
||||
|
||||
function returnPayParams() {
|
||||
return {
|
||||
money: currentpayMoney.value * 1,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
authCode: "",
|
||||
authCode: authCode,
|
||||
checkOrderPay: {
|
||||
vipPrice: props.user.id && props.user.isVip ? 1 : 0,
|
||||
orderId: props.orderInfo.id,
|
||||
// discountRatio: (checkOrderPay.discount / 100).toFixed(2),
|
||||
discountRatio: 0,
|
||||
@@ -276,6 +293,10 @@ function returnPayParams() {
|
||||
}
|
||||
|
||||
function refScanPayOpen(payType) {
|
||||
if (payType == "member-account") {
|
||||
chooseUser();
|
||||
return;
|
||||
}
|
||||
if (payType == "deposit") {
|
||||
return refScanPay.value.open(returnPayParams(), "deposit");
|
||||
}
|
||||
@@ -288,8 +309,8 @@ async function getPaytype() {
|
||||
const res = await payTypeApi.getList();
|
||||
payTypes.list = res;
|
||||
}
|
||||
function nowPayClick() {
|
||||
const payType = payTypes.list[payTypes.sel].payType;
|
||||
function nowPayClick(payType) {
|
||||
payType = payType || payTypes.list[payTypes.sel].payType;
|
||||
if (payType === "cash") {
|
||||
ElMessageBox.confirm("是否确认已现金收款:" + currentpayMoney.value + "元", "快捷支付", {
|
||||
confirmButtonText: "确定",
|
||||
@@ -302,12 +323,20 @@ function nowPayClick() {
|
||||
.catch(() => {});
|
||||
return;
|
||||
}
|
||||
if (payType == "member-account") {
|
||||
if (!props.user.id) {
|
||||
return ElMessage.error("请先选择会员");
|
||||
}
|
||||
payOrder(payType);
|
||||
return;
|
||||
}
|
||||
refScanPayOpen(payType);
|
||||
}
|
||||
|
||||
function refScanPayConfirm(authCode, isScan) {
|
||||
let authCode = "";
|
||||
function refScanPayConfirm($authCode, isScan) {
|
||||
const payType = payTypes.list[payTypes.sel].payType;
|
||||
payParams.authCode = authCode;
|
||||
authCode = $authCode;
|
||||
payOrder(payType, isScan);
|
||||
}
|
||||
|
||||
@@ -325,6 +354,7 @@ async function payOrder(payType, isScan) {
|
||||
loading.close();
|
||||
}, 1000 * 20);
|
||||
let res = undefined;
|
||||
console.log(payType);
|
||||
try {
|
||||
if (payType == "scanCode") {
|
||||
res = isScan
|
||||
@@ -337,7 +367,15 @@ async function payOrder(payType, isScan) {
|
||||
if (payType == "deposit") {
|
||||
res = await payApi.vipPay({ ...returnPayParams(), payType: "scanCode" });
|
||||
}
|
||||
if (payType == "member-account") {
|
||||
res = await payApi.vipPay({
|
||||
...returnPayParams(),
|
||||
payType: "userPay",
|
||||
shopUserId: props.user.id,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
clearTimeout(payTimer);
|
||||
loading.close();
|
||||
}
|
||||
@@ -357,11 +395,21 @@ const currentpayMoney = computed(() => {
|
||||
}
|
||||
return (carts.payMoney - checkOrderPay.discountAmount).toFixed(2);
|
||||
});
|
||||
|
||||
watch(
|
||||
() => currentpayMoney.value,
|
||||
(newval) => {
|
||||
if (newval * 1 <= 0) {
|
||||
payTypes.sel = payTypes.list.findIndex((v) => v.payType == "cash");
|
||||
}
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
getPaytype();
|
||||
pointsInit();
|
||||
});
|
||||
defineExpose({
|
||||
nowPayClick,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -44,11 +44,11 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
:deep(.el-dialog__body) {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
::v-deep .el-tag {
|
||||
:deep(.el-tag) {
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
@@ -88,11 +88,11 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
:deep(.el-dialog__body) {
|
||||
margin-bottom: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
::v-deep .el-form-item__label {
|
||||
:deep(.el-form-item__label) {
|
||||
text-align: left;
|
||||
}
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
@@ -100,11 +100,11 @@ input[type="number"]::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
::v-deep .el-input__inner::-webkit-inner-spin-button {
|
||||
:deep(.el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
::v-deep .el-input__inner::-webkit-outer-spin-button {
|
||||
:deep(el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.el-button {
|
||||
:deep(.el-button) {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,25 +120,25 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.el-button {
|
||||
:deep(.el-button) {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
::v-deep .carts .box_status {
|
||||
:deep(.carts .box_status) {
|
||||
border: none;
|
||||
}
|
||||
|
||||
::v-deep .el-input__inner::-webkit-inner-spin-button {
|
||||
:deep(.el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::v-deep .el-input__inner::-webkit-outer-spin-button {
|
||||
:deep(.el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::v-deep .el-button--success {
|
||||
:deep(.el-button--success) {
|
||||
border-color: #22bf64;
|
||||
background-color: #22bf64;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .inputs .el-input__inner {
|
||||
:deep(.inputs .el-input__inner) {
|
||||
border-color: transparent !important;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 1.25px;
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
import QRCode from "qrcode";
|
||||
import orderApi from "@/api/order/order";
|
||||
import payApi from "@/api/order/pay";
|
||||
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
props: {
|
||||
order: {
|
||||
@@ -167,7 +167,7 @@ export default {
|
||||
|
||||
confirm() {
|
||||
if (!this.form.code) {
|
||||
return this.$message.error("请输入或扫付款码");
|
||||
return ElMessage.error("请输入或扫付款码");
|
||||
}
|
||||
this.close();
|
||||
this.$emit("confirm", this.form.code, this.paysSel ? true : false);
|
||||
|
||||
Reference in New Issue
Block a user