changes
This commit is contained in:
@@ -17,25 +17,29 @@ const shipping_address = computed(() => {
|
||||
async function createOrder() {
|
||||
try {
|
||||
isPending.value = true;
|
||||
|
||||
const invoicePayload = {
|
||||
customer: activeCart.value.customer,
|
||||
customer_name: activeCart.value.customer__fullname,
|
||||
customer_phone: activeCart.value.customer__phone,
|
||||
customer_email: activeCart.value.customer__email,
|
||||
shipping_address: shipping_address.value,
|
||||
product_amount: activeCartItems.value.length,
|
||||
shipping_fee: 0,
|
||||
total_amount: subtotal.value,
|
||||
discount_amount: 0,
|
||||
final_amount: subtotal.value,
|
||||
order_type: "pos",
|
||||
status: "pending",
|
||||
payment_status: 1,
|
||||
staff: 1,
|
||||
ordered_at: new Date(),
|
||||
paid_at: null,
|
||||
delivery_method: orderInfo.value.deliveryMethod.id,
|
||||
};
|
||||
|
||||
const invoice = await $insertapi("Invoice", {
|
||||
data: {
|
||||
customer: activeCart.value.customer,
|
||||
customer_name: activeCart.value.customer__fullname,
|
||||
customer_phone: activeCart.value.customer__phone,
|
||||
customer_email: activeCart.value.customer__email,
|
||||
shipping_address: shipping_address.value,
|
||||
product_amount: activeCartItems.value.length,
|
||||
shipping_fee: 0,
|
||||
total_amount: subtotal.value,
|
||||
discount_amount: 0,
|
||||
final_amount: subtotal.value,
|
||||
order_type: "pos",
|
||||
status: "pending",
|
||||
staff: 1,
|
||||
ordered_at: new Date(),
|
||||
paid_at: null,
|
||||
delivery_method: orderInfo.value.deliveryMethod.id,
|
||||
},
|
||||
data: invoicePayload,
|
||||
notify: false,
|
||||
});
|
||||
|
||||
@@ -68,8 +72,8 @@ async function createOrder() {
|
||||
if (orderInfo.value.deliveryMethod.code === "HOME_DELIVERY") {
|
||||
const deliveryInfoPayload = {
|
||||
invoice: invoice.id,
|
||||
receiver_name: invoice.customer_name,
|
||||
receiver_phone: invoice.customer_phone,
|
||||
receiver_name: orderInfo.value.receiver_name,
|
||||
receiver_phone: orderInfo.value.receiver_phone,
|
||||
city: orderInfo.value.address.city,
|
||||
district: orderInfo.value.address.district,
|
||||
ward: orderInfo.value.address.ward,
|
||||
@@ -171,9 +175,9 @@ async function createOrder() {
|
||||
<div v-else>
|
||||
<p class="font-medium fs-16 mb-0.5">{{ shipping_address }}</p>
|
||||
<p class="has-text-grey">
|
||||
<span>{{ activeCart.customer__fullname }}</span>
|
||||
<span>{{ orderInfo.receiver_name }}</span>
|
||||
<span> • </span>
|
||||
<span>{{ activeCart.customer__phone }}</span>
|
||||
<span>{{ orderInfo.receiver_phone }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user