This commit is contained in:
pushuo 2022-07-05 10:36:15 +08:00
parent 97588de88d
commit 7a56083e3e
2 changed files with 10 additions and 19 deletions

View File

@ -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();

View File

@ -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