新增退单支付密码、会员充值支付密码
This commit is contained in:
@@ -13,7 +13,9 @@
|
||||
</div>
|
||||
<div class="t1" v-else>
|
||||
<span class="title">会员:</span>
|
||||
<span class="num">{{ props.userInfo.id && props.userInfo.telephone }}</span>
|
||||
<span class="num">{{
|
||||
props.userInfo.id && props.userInfo.telephone
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="t2">
|
||||
<span>已付:¥0.00</span>
|
||||
@@ -23,8 +25,13 @@
|
||||
</div>
|
||||
<div class="number_wrap">
|
||||
<div class="menus">
|
||||
<div class="item" :class="{ active: payActive == index }" v-for="(item, index) in payList" :key="item.id"
|
||||
@click="payTypeChange(index, item)">
|
||||
<div
|
||||
class="item"
|
||||
:class="{ active: payActive == index }"
|
||||
v-for="(item, index) in payList"
|
||||
:key="item.id"
|
||||
@click="payTypeChange(index, item)"
|
||||
>
|
||||
<div class="icon">
|
||||
<el-image :src="item.icon" class="img"></el-image>
|
||||
</div>
|
||||
@@ -39,7 +46,12 @@
|
||||
</div>
|
||||
<div class="keybord_wrap">
|
||||
<div class="left">
|
||||
<div class="item" v-for="item in 9" :key="item" @click="amountInput(`${item}`)">
|
||||
<div
|
||||
class="item"
|
||||
v-for="item in 9"
|
||||
:key="item"
|
||||
@click="amountInput(`${item}`)"
|
||||
>
|
||||
{{ item }}
|
||||
</div>
|
||||
<div class="item" @click="amountInput('.')">.</div>
|
||||
@@ -57,30 +69,50 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<scanModal ref="scanModalRef" fast :amount="money" :selecttype="props.type" :orderId="props.userInfo.id"
|
||||
@success="scanCodeSuccess" />
|
||||
<scanModal
|
||||
ref="scanModalRef"
|
||||
fast
|
||||
:amount="money"
|
||||
:selecttype="props.type"
|
||||
:orderId="props.userInfo.id"
|
||||
@success="scanCodeSuccess"
|
||||
/>
|
||||
<takeFoodCode
|
||||
ref="takeFoodCodeRef"
|
||||
title="支付密码"
|
||||
type="password"
|
||||
placeholder="请输入支付密码"
|
||||
@success="passwordSuccess"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from "vue";
|
||||
import { queryPayType, quickPay } from "@/api/pay";
|
||||
import { queryMembermember, createMembermember, membermemberScanPay, accountPaymember } from '@/api/member/index.js'
|
||||
import {
|
||||
queryMembermember,
|
||||
createMembermember,
|
||||
membermemberScanPay,
|
||||
accountPaymember,
|
||||
} from "@/api/member/index.js";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { clearNoNum } from "@/utils";
|
||||
|
||||
import scanModal from "@/components/payCard/scanModal.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import takeFoodCode from "@/components/takeFoodCode.vue";
|
||||
const takeFoodCodeRef = ref(null);
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: [String, Number],
|
||||
default: 0 // 1快捷收银 2会员支付
|
||||
default: 0, // 1快捷收银 2会员支付
|
||||
},
|
||||
userInfo: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
})
|
||||
default: {},
|
||||
},
|
||||
});
|
||||
|
||||
const store = useUser();
|
||||
|
||||
@@ -115,9 +147,28 @@ function payTypeChange(index, item) {
|
||||
payActive.value = index;
|
||||
}
|
||||
|
||||
// 获取支付密码
|
||||
async function passwordSuccess(e) {
|
||||
try {
|
||||
payLoading.value = true;
|
||||
await accountPaymember({
|
||||
shopId: store.userInfo.shopId,
|
||||
memberId: props.userInfo.id,
|
||||
amount: money.value,
|
||||
pwd: e,
|
||||
});
|
||||
payLoading.value = false;
|
||||
ElMessage.success("支付成功");
|
||||
emit("paySuccess");
|
||||
} catch (error) {
|
||||
payLoading.value = false;
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 结算支付
|
||||
async function confirmOrder() {
|
||||
if (payLoading.value) return
|
||||
if (payLoading.value) return;
|
||||
try {
|
||||
if (payList.value[payActive.value].payType == "scanCode") {
|
||||
if (money.value <= 0) {
|
||||
@@ -130,29 +181,26 @@ async function confirmOrder() {
|
||||
ElMessage.error("请输入大于0的金额");
|
||||
return;
|
||||
}
|
||||
payLoading.value = true;
|
||||
switch (payList.value[payActive.value].payType) {
|
||||
case "cash": //现金
|
||||
if (props.type == 0) {
|
||||
payLoading.value = true;
|
||||
await quickPay({
|
||||
amount: money.value,
|
||||
authCode: "",
|
||||
payType: payList.value[payActive.value].payType,
|
||||
});
|
||||
payLoading.value = false;
|
||||
ElMessage.success("支付成功");
|
||||
emit("paySuccess");
|
||||
} else {
|
||||
await accountPaymember({
|
||||
shopId: store.userInfo.shopId,
|
||||
memberId: props.userInfo.id,
|
||||
amount: money.value
|
||||
})
|
||||
// 会员充值
|
||||
takeFoodCodeRef.value.show();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
payLoading.value = false;
|
||||
ElMessage.success("支付成功");
|
||||
emit("paySuccess");
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -337,7 +385,9 @@ onMounted(() => {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
grid-template-rows: var(--item-height) var(--item-height) var(--item-height) var(--item-height);
|
||||
grid-template-rows: var(--item-height) var(--item-height) var(--item-height) var(
|
||||
--item-height
|
||||
);
|
||||
gap: var(--el-font-size-base);
|
||||
|
||||
.item {
|
||||
|
||||
@@ -1,74 +1,78 @@
|
||||
<!-- 取餐号组件 -->
|
||||
<template>
|
||||
<el-dialog :title="props.title" width="600" v-model="dialogVisible" @open="opne">
|
||||
<el-input v-model="number" :placeholder="props.placeholder" readonly></el-input>
|
||||
<el-input :type="props.type" v-model="number" :placeholder="props.placeholder" readonly></el-input>
|
||||
<div class="keybord_wrap">
|
||||
<div v-for="item in 9" :key="item">
|
||||
<el-button plain type="info" style="width: 100%;" @click="inputHandle(item)">{{ item }}</el-button>
|
||||
<el-button plain type="info" style="width: 100%" @click="inputHandle(item)">{{ item }}</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button plain type="info" disabled style="width: 100%;">.</el-button>
|
||||
<el-button plain type="info" disabled style="width: 100%">.</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button plain type="info" style="width: 100%;" @click="inputHandle(0)">0</el-button>
|
||||
<el-button plain type="info" style="width: 100%" @click="inputHandle(0)">0</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button plain type="info" icon="CloseBold" style="width: 100%;" @click="delHandle"></el-button>
|
||||
<el-button plain type="info" icon="CloseBold" style="width: 100%" @click="delHandle"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<el-button type="primary" style="width: 100%;" @click="confirmHandle">确认</el-button>
|
||||
<el-button type="primary" style="width: 100%" @click="confirmHandle">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref } from "vue";
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
default: "text",
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '标题'
|
||||
default: "标题",
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '提示'
|
||||
}
|
||||
})
|
||||
default: "提示",
|
||||
},
|
||||
});
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const number = ref('')
|
||||
const dialogVisible = ref(false);
|
||||
const number = ref("");
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
const emit = defineEmits(["success"]);
|
||||
|
||||
function show() {
|
||||
dialogVisible.value = true
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
|
||||
function opne() {
|
||||
number.value = ''
|
||||
number.value = "";
|
||||
}
|
||||
|
||||
// 输入
|
||||
function inputHandle(n) {
|
||||
number.value += n
|
||||
number.value += n;
|
||||
}
|
||||
|
||||
// 删除
|
||||
function delHandle() {
|
||||
if (!number.value) return
|
||||
number.value = number.value.substring(0, number.value.length - 1)
|
||||
if (!number.value) return;
|
||||
number.value = number.value.substring(0, number.value.length - 1);
|
||||
}
|
||||
|
||||
// 确认
|
||||
function confirmHandle() {
|
||||
emit('success', number.value)
|
||||
dialogVisible.value = false
|
||||
emit("success", number.value);
|
||||
dialogVisible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show
|
||||
})
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -88,4 +92,4 @@ defineExpose({
|
||||
height: 60px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user