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 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) => { $http[type](url, this.dialogAddress.form).then((res) => {
if (type == 'post') { if (type == 'post') {
this.source.addresses.push(res.data.data) this.source.addresses.push(res.data)
} else { } else {
this.source.addresses[this.dialogAddress.index] = res.data.data this.source.addresses[this.dialogAddress.index] = res.data
} }
this.$message.success(res.message); this.$message.success(res.message);
this.$refs[form].resetFields(); this.$refs[form].resetFields();

View File

@ -91,23 +91,14 @@
<script> <script>
$('.add-cart').on('click', function(event) { $('.add-cart').on('click', function(event) {
$.ajax({ const data = {
url: '/carts', sku_id: '{{ $product->master_sku->id }}',
type: 'POST', quantity: $('input[name="quantity"]').val()
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> </script>
@endsection @endsection