diff --git a/public/build/beike/shop/default/js/app.js b/public/build/beike/shop/default/js/app.js
index f35a75a8..fffd8331 100644
--- a/public/build/beike/shop/default/js/app.js
+++ b/public/build/beike/shop/default/js/app.js
@@ -122,24 +122,22 @@ axios.defaults.baseURL = process.env.VUE_APP_BASE_URL; // axios.defaults.headers
}
return new Promise(function (resolve, reject) {
- // axios({method: method, url: url, data: QS.stringify(params)}).then((res) => {
axios(_defineProperty({
method: method,
url: url
}, method == 'get' ? 'params' : 'data', params)).then(function (res) {
if (res) {
- resolve(res);
+ resolve(res.data);
} else {
// 其他情况返回错误信息,根据需要处理
- reject(res);
+ reject(res.data);
if (!hmsg) return layer.msg(res.data.message, function () {});
}
})["catch"](function (res) {
- console.log(res);
reject(res);
if (!hmsg && res.message) {
- layer.msg(res.message, function () {});
+ layer.msg(res.response.data.message, function () {});
}
})["finally"](function () {
layer.closeAll('loading');
diff --git a/resources/beike/shop/default/js/http.js b/resources/beike/shop/default/js/http.js
index d2bb359b..a5055e05 100644
--- a/resources/beike/shop/default/js/http.js
+++ b/resources/beike/shop/default/js/http.js
@@ -70,19 +70,17 @@ export default {
}
return new Promise((resolve, reject) => {
- // axios({method: method, url: url, data: QS.stringify(params)}).then((res) => {
axios({method: method, url: url, [method == 'get' ? 'params' : 'data']: params}).then((res) => {
if (res) {
- resolve(res);
+ resolve(res.data);
} else { // 其他情况返回错误信息,根据需要处理
- reject(res);
+ reject(res.data);
if (!hmsg) return layer.msg(res.data.message, ()=>{});
}
}).catch((res) => {
- console.log(res)
reject(res);
if (!hmsg && res.message) {
- layer.msg(res.message, ()=>{});
+ layer.msg(res.response.data.message, ()=>{});
}
}).finally(function(){
layer.closeAll('loading')
diff --git a/themes/default/cart.blade.php b/themes/default/cart.blade.php
index 899fcb1e..7cee44ba 100644
--- a/themes/default/cart.blade.php
+++ b/themes/default/cart.blade.php
@@ -63,7 +63,7 @@
@{{ product.subtotal_format }} |
-
+
|
@@ -131,25 +131,16 @@
quantityChange(quantity, cart_id) {
const self = this;
- $.ajax({
- url: `/carts/${cart_id}`,
- type: 'PUT',
- data: {quantity: quantity,},
- success: function(res) {
- self.setUpdateData(res);
- }
+ $http.put(`/carts/${cart_id}`, {quantity: quantity}).then((res) => {
+ this.setUpdateData(res);
})
},
checkedBtnDelete(cart_id) {
const self = this;
- $.ajax({
- url: `/carts/${cart_id}`,
- type: 'DELETE',
- success: function(res) {
- self.setUpdateData(res);
- }
+ $http.delete(`/carts/${cart_id}`).then((res) => {
+ this.setUpdateData(res);
})
},
@@ -162,13 +153,8 @@
const self = this;
const cart_ids = this.products.filter(e => e.selected).map(x => x.cart_id)
- $.ajax({
- url: `/carts/select`,
- type: 'POST',
- data: {cart_ids: cart_ids},
- success: function(res) {
- self.setUpdateData(res);
- }
+ $http.post(`/carts/select`, {cart_ids: cart_ids}).then((res) => {
+ this.setUpdateData(res);
})
},
@@ -180,11 +166,6 @@
},
// 实例被挂载后调用
mounted () {
- // if (this.products.length) {
- // this.products.forEach((e) => {
- // this.$set(e, 'selected', false)
- // })
- // }
},
})
diff --git a/themes/default/checkout.blade.php b/themes/default/checkout.blade.php
index 21f739e8..d6d16b68 100644
--- a/themes/default/checkout.blade.php
+++ b/themes/default/checkout.blade.php
@@ -241,7 +241,7 @@
}
const type = this.dialogAddress.form.id ? 'put' : 'post';
- const url = `/admin/customers/{{ $customer_id }}/addresses${type == 'put' ? '/' + this.dialogAddress.form.id : ''}`;
+ const url = `/customers/{{ $customer_id }}/addresses${type == 'put' ? '/' + this.dialogAddress.form.id : ''}`;
$http[type](url, this.dialogAddress.form).then((res) => {
if (type == 'post') {
@@ -269,22 +269,26 @@
countryChange(e) {
const self = this;
- $http.get(`/admin/countries/${e}/zones`).then((res) => {
- this.source.zones = res.data.data.zones;
+ $http.get(`/countries/${e}/zones`).then((res) => {
+ this.source.zones = res.zones;
})
},
updateCheckout(id, key) {
+ if (this.form[key] === id) {
+ return
+ }
+
this.form[key] = id
$http.put('/checkout', this.form).then((res) => {
- this.form = res.data.current
+ this.form = res.current
})
},
checkedBtnCheckoutConfirm() {
$http.post('/checkout/confirm', this.form).then((res) => {
- console.log(res)
+ {{-- location = '{{ shop_route("orders.index", [1]) }}' --}}
})
}
}