@viur/shop-components 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/composables/order.js +36 -32
package/package.json
CHANGED
package/src/composables/order.js
CHANGED
|
@@ -36,39 +36,43 @@ export function useOrder() {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function addOrUpdateOrder({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
payment_provider,
|
|
40
|
+
billing_address_key,
|
|
41
|
+
customer_key,
|
|
42
|
+
state_ordered,
|
|
43
|
+
state_paid,
|
|
44
|
+
state_rts,
|
|
45
|
+
//TODO: ...additionalData Über alle requests in den components für customized Projekte
|
|
46
|
+
...additionalData // abfangen von nicht definierten Feldern
|
|
47
|
+
}={}){
|
|
48
|
+
state.isUpdating=true
|
|
49
|
+
let url = shopStore.state.shopApiUrl+"/order_add"
|
|
50
|
+
let data = {
|
|
51
|
+
payment_provider:payment_provider?payment_provider:shopStore.state.order?.['payment_provider'],
|
|
52
|
+
billing_address_key:billing_address_key?billing_address_key:shopStore.state.order?.['billing_address_key']?.['dest']?.['key'],
|
|
53
|
+
customer_key:customer_key?customer_key:shopStore.state.order?.['customer_key']?.['dest']?.['key'],
|
|
54
|
+
state_ordered:state_ordered?state_ordered:shopStore.state.order?.['state_ordered'],
|
|
55
|
+
state_paid:state_paid?state_paid:shopStore.state.order?.['state_paid'],
|
|
56
|
+
state_rts:state_rts?state_rts:shopStore.state.order?.['state_rts'],
|
|
57
|
+
...additionalData
|
|
58
|
+
}
|
|
59
|
+
if (shopStore.state.orderKey){
|
|
60
|
+
url = shopStore.state.shopApiUrl+"/order_update"
|
|
61
|
+
data["order_key"] = shopStore.state.orderKey
|
|
62
|
+
|
|
63
|
+
}else{
|
|
64
|
+
data["cart_key"] = shopStore.state.cartRoot['key']
|
|
65
|
+
}
|
|
66
|
+
return Request.post(url,{dataObj:removeUndefinedValues(data)}).then(async(resp)=>{
|
|
67
|
+
let data = await resp.json()
|
|
68
|
+
updateOrderState(data['key'], data)
|
|
69
|
+
state.isUpdating=false
|
|
70
|
+
}).then(async ( resp)=>{
|
|
71
|
+
fetchOrder(shopStore.state.orderKey)
|
|
72
|
+
return resp
|
|
73
|
+
})
|
|
74
|
+
}
|
|
59
75
|
|
|
60
|
-
}else{
|
|
61
|
-
data["cart_key"] = shopStore.state.cartRoot['key']
|
|
62
|
-
}
|
|
63
|
-
return Request.post(url,{dataObj:removeUndefinedValues(data)}).then(async(resp)=>{
|
|
64
|
-
let data = await resp.json()
|
|
65
|
-
updateOrderState(data['key'], data)
|
|
66
|
-
state.isUpdating=false
|
|
67
|
-
}).then(async ( resp)=>{
|
|
68
|
-
fetchOrder(shopStore.state.orderKey)
|
|
69
|
-
return resp
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
76
|
|
|
73
77
|
return {
|
|
74
78
|
state,
|