- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
<template>
<main class="container">
<header>
<h3>— Checkout —</h3>
<p>Your total is only {{total}}</p>
</header>
<div>
<v-stepper v-model="e1">
<v-stepper-header>
<v-stepper-step step="1" :complete="e1 > 1">
Guest's Name
<small>(optional)</small>
</v-stepper-step>
<v-divider></v-divider>
<v-stepper-step step="2" :complete="e1 > 2">
Shipping Address
</v-stepper-step>
<v-divider></v-divider>
<v-stepper-step step="3">
Checkout
</v-stepper-step>
</v-stepper-header>
<v-stepper-content step="1">
<div>
<v-text-field
placeholder="Enter guest's name here (optional)"
class="input-group">
</v-text-field>
<p>
This is optional, and free of charge.
</p>
<p>
If you enter your guest's name, the crate will say "Welcome, <i>(name of guest)</i>"
</p>
</div>
<v-btn primary @click.native="e1 = 2">Continue</v-btn>
</v-stepper-content>
<v-stepper-content step="2">
<div>
<p>
Where are we shipping to?
</p>
<p>
<small>
Tip: If you can't make it to your property to leave the crate
inside, you can have it shipped directly to the property
and let the guests know that there is a package for them
at the door when they arrive!
</small>
</p>
<v-layout row>
<v-card flat>
<v-card-text>
<v-text-field
label="Name"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
</v-layout>
<v-layout row-sm column child-flex-sm>
<v-card flat>
<v-card-text>
<v-text-field
label="Address"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
<v-card flat>
<v-card-text>
<v-text-field
label="City"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
<v-card flat>
<v-card-text>
<v-text-field
label="State"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
<v-card flat>
<v-card-text>
<v-text-field
label="Zip"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
</v-layout>
</div>
<v-btn flat accent @click.native="e1 = 1">Back</v-btn>
<v-btn primary @click.native="e1 = 3">Continue</v-btn>
</v-stepper-content>
<v-stepper-content step="3">
<div>
<p>
We accept Credit Cards and Paypal
</p>
<v-layout row>
<v-layout row>
<v-card flat>
<v-card-text>
<v-text-field
label="Name on Card"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
<v-card flat>
<v-card-text>
<v-text-field
label="Card Number"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
<v-card flat>
<v-card-text>
<v-text-field
label="Expiry Date"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
<v-card flat>
<v-card-text>
<v-text-field
label="Security Code"
class="input-group">
</v-text-field>
</v-card-text>
</v-card>
</v-layout>
<v-layout row-sm column child-flex-sm>
<div>
<img src="https://ee-screenshots.s3.amazonaws.com/2016/08/paypal-express-checkout-logo.png" alt="">
</div>
</v-layout>
</v-layout>
</div>
<v-btn primary @click.native="e1 = 2">Back</v-btn>
</v-stepper-content>
</v-stepper>
</div>
</main>
</template>
<script>
import axios from 'axios'
export default {
layout: 'default',
data () {
return {
e1: 0,
isSubmitting: false,
guestName: null,
email: null,
shipping: {
name: null,
address: null,
address2: null,
city: null,
state: null,
zip: null,
country: 'us'
},
creditCard: {
name: null,
number: null,
exp: null,
cvv: null,
zip: null,
country: 'us'
},
//billingAddressSameAsShipping: true
}
},
computed: {
total()
{
var crates = this.$store.state.crates
return Object.keys(this.$store.state.crates)
.map(e => crates[e].price * crates[e].quantity)
.reduce((acc,cv) => acc + cv)
}
},
methods: {
handleCreditCardSubmit()
{
//const formdata = new FormData()
//formdata.append('name', name)
this.isSubmitting = true
axios.post('/api/checkout', {
guestName: this.guestName,
shipping: this.shipping,
crates: this.$store.state.crates, //[{name: 'smiley crate', quantity: 2}],
paymentMethod: {type: 'credit card', info: this.creditCard}
})
.then( response => {
if (response.data.result == 'success')
{
this.$router.replace('/checkout/complete')
}
this.isSubmitting = false
})
.catch(error => {
console.log(error);
this.isSubmitting = false
});
}
}
}
</script>
<style lang='stylus'>
@import '~assets/css/variables'
// .stepper__header
// background white
.stepper__wrapper > div
font-size 1.3em
</style>