功能完善
This commit is contained in:
@@ -5,6 +5,7 @@ import Avatar from "@/components/Avatar.vue";
|
||||
import SButton from "@/components/SButton.vue";
|
||||
import SModal from "@/components/SModal.vue";
|
||||
import Signin from "@/components/Signin.vue";
|
||||
import { createOrderAPI } from "@/apis";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
@@ -13,14 +14,19 @@ const { user, config } = storeToRefs(store);
|
||||
const selectedVIP = ref(0);
|
||||
const showModal = ref(false);
|
||||
|
||||
const chooseVip = (index) => {
|
||||
selectedVIP.value = index;
|
||||
};
|
||||
|
||||
const onPay = () => {
|
||||
const onPay = async () => {
|
||||
if (!user.value.id) {
|
||||
showModal.value = true;
|
||||
} else {
|
||||
} else if (config.value.vipMenus[selectedVIP.value]) {
|
||||
if (config.value.vipMenus[selectedVIP.value].id) {
|
||||
const result = await createOrderAPI(
|
||||
config.value.vipMenus[selectedVIP.value].id
|
||||
);
|
||||
uni.showToast({
|
||||
title: "创建成功",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -70,7 +76,7 @@ const onPay = () => {
|
||||
? '#FF7D57'
|
||||
: 'linear-gradient(180deg, #fbfbfb 0%, #f5f5f5 100%)',
|
||||
}"
|
||||
@click="chooseVip(index)"
|
||||
@click="() => (selectedVIP = index)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
@@ -141,6 +147,7 @@ const onPay = () => {
|
||||
.content > view:nth-child(2) > text {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
color: #000;
|
||||
}
|
||||
.vip-items {
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user