feat: 代客下单更新,修复店铺列表编辑展示问题

This commit is contained in:
2025-03-04 10:34:19 +08:00
parent b71ca19c0d
commit bd59f05d26
19 changed files with 953 additions and 312 deletions

View File

@@ -1,7 +1,7 @@
<template>
<el-dialog width="400px" :title="title" v-model="show" @close="reset">
<div class="u-p-15">
<div v-if="openSwitch">
<div v-if="openSwitch" class="u-m-b-20">
<el-button
@click="changeKey('paysSel', index)"
v-for="(item, index) in pays"
@@ -11,7 +11,7 @@
{{ item.text }}
</el-button>
</div>
<div class="u-m-t-20">
<div class="">
<el-alert :closable="false" v-if="tips" :title="tips" type="warning" show-icon></el-alert>
</div>
<div class="u-m-t-20">
@@ -24,6 +24,7 @@
<el-input
v-model="form.code"
@change="codeInputChange"
autofocus
placeholder="请扫码或者输入付款码"
ref="refInputCode"
></el-input>
@@ -43,9 +44,9 @@
<!-- <img :src="codeImg" class="codeImg" alt="" /> -->
</div>
<div class="color-333 u-font-20 u-m-t-20">{{ to2(price) }}</div>
<div class="color-333 u-font-20 u-m-t-20">{{ form.money }}</div>
<div class="color-aaa u-font-12 u-m-t-10">
<i class="el-icon-loading"></i>
<el-icon class="loading-ani"><Loading /></el-icon>
<span>等待用户支付</span>
</div>
</div>
@@ -61,18 +62,10 @@ import payApi from "@/api/order/pay";
export default {
props: {
openSwitch: {
type: Boolean,
default: true,
},
order: {
type: Object,
default: () => ({}),
},
title: {
type: String,
default: "支付",
},
price: {
type: [String, Number],
default: 0,
@@ -84,6 +77,8 @@ export default {
},
data() {
return {
title: "支付",
openSwitch: false,
tips: "",
paymentQrcode: "",
paysSel: 0,
@@ -119,11 +114,13 @@ export default {
if (newval == 0) {
this.clear();
this.tips = "请使用扫码枪扫微信/支付宝收款码";
this.$refs.refInputCode.focus();
this.$nextTick(() => {
this.$refs.refInputCode.focus();
});
} else {
this.getPayUrl();
this.tips = "请用户使用微信/支付宝扫描付款码";
// this.startGetOrderInfo();
this.startGetOrderInfo();
}
},
number(newval) {
@@ -142,7 +139,7 @@ export default {
shopId: localStorage.getItem("shopId"),
orderId: this.order.id,
});
if (res.status == "closed") {
if (res.status == "done") {
this.clear();
this.$emit("paySuccess");
}
@@ -173,10 +170,12 @@ export default {
return this.$message.error("请输入或扫付款码");
}
this.close();
this.$emit("confirm", this.form.code);
this.$emit("confirm", this.form.code, this.paysSel ? true : false);
},
async getPayUrl() {
const res = await payApi.microPay(this.payPar);
const formdata = { ...this.payPar, ...this.payPar.checkOrderPay };
delete formdata.checkOrderPay;
const res = await payApi.orderPayUrl(formdata);
console.log(res);
this.paymentQrcode = res;
this.$nextTick(() => {
@@ -190,7 +189,16 @@ export default {
);
});
},
open(data) {
open(data, payType) {
if (payType == "deposit") {
// 储值卡
this.openSwitch = false;
this.title = "储值卡支付";
}
if (payType == "scanCode") {
this.openSwitch = true;
this.title = "扫码支付";
}
this.show = true;
this.form.money = Number(data.money).toFixed(2);
this.payPar = data;
@@ -198,7 +206,9 @@ export default {
// this.getPayUrl();
}
this.$nextTick(() => {
this.$refs.refInputCode.focus();
setTimeout(() => {
this.$refs.refInputCode.focus();
}, 100);
});
},
close() {
@@ -226,4 +236,18 @@ export default {
height: 164px;
overflow: hidden;
}
@keyframes rotating {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(1turn);
transform: rotate(1turn);
}
}
.loading-ani {
animation: rotating 2s linear infinite;
}
</style>