Quellcode durchsuchen

feat: add order list

bregsiaju vor 1 Jahr
Ursprung
Commit
5a5f711394
3 geänderte Dateien mit 247 neuen und 1 gelöschten Zeilen
  1. 70
    0
      src/components/CartItem.vue
  2. 171
    0
      src/components/OrderList.vue
  3. 6
    1
      src/views/HomeView.vue

+ 70
- 0
src/components/CartItem.vue Datei anzeigen

@@ -0,0 +1,70 @@
1
+<template>
2
+  <div class="order-list-item position-relative mb-3">
3
+    <div class="d-flex align-items-center gap-2">
4
+      <div class="ratio ratio-1x1 rounded overflow-hidden">
5
+        <img :src="'/img/iced-choco.jpg'" class="object-fit-cover" alt="Chocolate">
6
+      </div>
7
+      <div>
8
+        <p class="mb-1">Expresso</p>
9
+        <p class="mb-0"><small>Rp21.000</small></p>
10
+      </div>
11
+    </div>
12
+    <div class="position-absolute bottom-0 end-0 d-flex align-items-center gap-2">
13
+      <Icon icon="iconoir:minus" width="18" class="icon-minus" />
14
+      <span class="qty text-center">
15
+        <input type="number" class="form-control" value="2" min="0">
16
+      </span>
17
+      <Icon icon="iconoir:plus" width="18" class="icon-plus" />
18
+    </div>
19
+  </div>
20
+</template>
21
+
22
+<script>
23
+import { Icon } from '@iconify/vue';
24
+
25
+export default {
26
+  name: 'CartItem',
27
+  components: {
28
+    Icon
29
+  }
30
+}
31
+</script>
32
+
33
+<style lang="scss" scoped>
34
+.ratio {
35
+  max-width: 50px;
36
+}
37
+
38
+.qty input {
39
+  width: 32px;
40
+  text-align: center;
41
+  padding: 0;
42
+  border: none;
43
+}
44
+
45
+.icon-minus {
46
+  border: 1px solid #8751ab;
47
+  border-radius: 50%;
48
+  color: #8751ab;
49
+}
50
+
51
+.icon-plus,
52
+.icon-minus:hover {
53
+  border-radius: 50%;
54
+  background-color: #8751ab;
55
+  color: #FFF;
56
+  cursor: pointer;
57
+}
58
+
59
+/* hide arrow input num */
60
+input::-webkit-outer-spin-button,
61
+input::-webkit-inner-spin-button {
62
+  -webkit-appearance: none;
63
+  margin: 0;
64
+}
65
+
66
+input[type=number] {
67
+  appearance: none;
68
+  -moz-appearance: textfield;
69
+}
70
+</style>

+ 171
- 0
src/components/OrderList.vue Datei anzeigen

@@ -0,0 +1,171 @@
1
+<template>
2
+  <div class="order-details p-3">
3
+    <div class="d-flex gap-2 align-items-baseline mb-3">
4
+      <h5 class="mb-0">Order Details</h5>
5
+      <span>#3948</span>
6
+    </div>
7
+    <div class="mb-2">
8
+      <div class="input-group input-group-sm">
9
+        <span class="input-group-text" id="basic-addon1">Customer</span>
10
+        <input type="text" class="form-control" placeholder="name" v-model="order.customer">
11
+      </div>
12
+    </div>
13
+    <div>
14
+      <div class="input-group input-group-sm">
15
+        <span class="input-group-text" id="basic-addon1">Type</span>
16
+        <select class="form-select form-select-sm" v-model="order.type">
17
+          <option value="Dine in" selected>Dine in</option>
18
+          <option value="Take away">Take away</option>
19
+        </select>
20
+      </div>
21
+    </div>
22
+    <div class="row mt-4">
23
+      <div class="col">
24
+        <div class="total-items">Total items:</div>
25
+      </div>
26
+      <div class="col text-end">
27
+        <button class="btn btn-sm btn-outline-red btn-remove">Remove all</button>
28
+      </div>
29
+    </div>
30
+    <div class="order-list mt-3">
31
+      <CartItem />
32
+      <CartItem />
33
+      <CartItem />
34
+      <CartItem />
35
+    </div>
36
+    <div class="total-payment px-3 py-2 mt-3">
37
+      <div class="row">
38
+        <div class="col">Subtotal</div>
39
+        <div class="col text-end fw-medium">Rp68.000</div>
40
+      </div>
41
+      <div class="row">
42
+        <div class="col">Tax</div>
43
+        <div class="col text-end fw-medium">Rp3.400</div>
44
+      </div>
45
+      <hr>
46
+      <div class="row text-dark-purple fw-bold">
47
+        <div class="col">Total</div>
48
+        <div class="col text-end">Rp71.400</div>
49
+      </div>
50
+    </div>
51
+    <div class="payment-methods row">
52
+      <div v-for="payment in paymentOption" :key="payment.id" class="col"
53
+        :class="{ selected: order.paymentMethod === payment.name }" @click="order.paymentMethod = payment.name">
54
+        <div class="d-flex gap-2 align-items-center justify-content-center">
55
+          <Icon :icon="payment.icon" width="24"></Icon>
56
+          <span>{{ payment.name }}</span>
57
+        </div>
58
+      </div>
59
+    </div>
60
+    <button class="btn btn-checkout text-white w-100 fw-bold">Process order</button>
61
+  </div>
62
+</template>
63
+
64
+<script>
65
+import { Icon } from '@iconify/vue';
66
+import CartItem from '../components/CartItem.vue'
67
+
68
+export default {
69
+  name: 'OrderList',
70
+  components: {
71
+    Icon,
72
+    CartItem
73
+  },
74
+  data() {
75
+    return {
76
+      cart: [],
77
+      paymentOption: [
78
+        {
79
+          id: 1,
80
+          name: 'Cash',
81
+          icon: 'tabler:cash'
82
+        },
83
+        {
84
+          id: 2,
85
+          name: 'QRIS',
86
+          icon: 'heroicons:qr-code'
87
+        },
88
+        {
89
+          id: 3,
90
+          name: 'Card',
91
+          icon: 'ion:card-outline'
92
+        },
93
+      ],
94
+      order: {
95
+        customer: '',
96
+        type: 'Dine in',
97
+        items: [],
98
+        paymentMethod: 'Cash'
99
+      }
100
+    }
101
+  }
102
+}
103
+</script>
104
+
105
+<style lang="scss" scoped>
106
+.order-details {
107
+  border-radius: 6px;
108
+  background: #FFF;
109
+  box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);
110
+}
111
+
112
+.total-items {
113
+  background: #ae7be8;
114
+  color: #fff;
115
+  border-radius: 12px;
116
+  font-size: 14px;
117
+  height: 100%;
118
+  display: flex;
119
+  justify-content: center;
120
+  align-items: center;
121
+  font-weight: 500;
122
+}
123
+
124
+.btn-remove {
125
+  border: none;
126
+
127
+  &:hover {
128
+    background: none;
129
+    color: inherit;
130
+  }
131
+}
132
+
133
+.order-list {
134
+  max-height: 156px;
135
+  overflow-y: auto;
136
+}
137
+
138
+.total-payment {
139
+  border-radius: 8px;
140
+  box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);
141
+
142
+  hr {
143
+    border-style: dashed;
144
+    margin: 10px 0;
145
+  }
146
+}
147
+
148
+.payment-methods {
149
+  &.row {
150
+    margin: 16px 0 20px 0;
151
+    gap: 8px;
152
+  }
153
+
154
+  .col {
155
+    border-radius: 16px;
156
+    box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.25);
157
+    padding: 10px 0;
158
+    border: 1px solid transparent;
159
+
160
+    &.selected {
161
+      color: white;
162
+      background-color: #ae7be8;
163
+      border-color: #8751ab;
164
+    }
165
+  }
166
+}
167
+
168
+.btn-checkout {
169
+  background: linear-gradient(232deg, rgb(177, 122, 240) 0%, rgb(253, 164, 210));
170
+}
171
+</style>

+ 6
- 1
src/views/HomeView.vue Datei anzeigen

@@ -12,16 +12,21 @@
12 12
         </div>
13 13
         <MenuContainer />
14 14
       </div>
15
+      <div class="col-4 p-4">
16
+        <OrderList />
17
+      </div>
15 18
     </div>
16 19
   </div>
17 20
 </template>
18 21
 
19 22
 <script>
20 23
 import MenuContainer from '../components/MenuContainer.vue';
24
+import OrderList from '../components/OrderList.vue';
21 25
 
22 26
 export default {
23 27
   components: {
24
-    MenuContainer
28
+    MenuContainer,
29
+    OrderList
25 30
   },
26 31
   data() {
27 32
     return {

Laden…
Abbrechen
Speichern