wip
This commit is contained in:
parent
97588de88d
commit
7a56083e3e
|
|
@ -241,13 +241,13 @@
|
|||
}
|
||||
|
||||
const type = this.dialogAddress.form.id ? 'put' : 'post';
|
||||
const url = `/customers/{{ $customer_id }}/addresses${type == 'put' ? '/' + this.dialogAddress.form.id : ''}`;
|
||||
const url = `/account/addresses${type == 'put' ? '/' + this.dialogAddress.form.id : ''}`;
|
||||
|
||||
$http[type](url, this.dialogAddress.form).then((res) => {
|
||||
if (type == 'post') {
|
||||
this.source.addresses.push(res.data.data)
|
||||
this.source.addresses.push(res.data)
|
||||
} else {
|
||||
this.source.addresses[this.dialogAddress.index] = res.data.data
|
||||
this.source.addresses[this.dialogAddress.index] = res.data
|
||||
}
|
||||
this.$message.success(res.message);
|
||||
this.$refs[form].resetFields();
|
||||
|
|
|
|||
|
|
@ -91,23 +91,14 @@
|
|||
|
||||
<script>
|
||||
$('.add-cart').on('click', function(event) {
|
||||
$.ajax({
|
||||
url: '/carts',
|
||||
type: 'POST',
|
||||
data: {
|
||||
sku_id: '{{ $product->master_sku->id }}',
|
||||
quantity: $('input[name="quantity"]').val()
|
||||
},
|
||||
const data = {
|
||||
sku_id: '{{ $product->master_sku->id }}',
|
||||
quantity: $('input[name="quantity"]').val()
|
||||
};
|
||||
|
||||
$http.post('/carts', data).then((res) => {
|
||||
layer.msg(res.message)
|
||||
})
|
||||
.done(function(e) {
|
||||
console.log(e);
|
||||
})
|
||||
.fail(function(e) {
|
||||
console.log("error");
|
||||
})
|
||||
.always(function() {
|
||||
console.log("complete");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
Loading…
Reference in New Issue