Explorar o código

feat: migrate cart.vue to use CFC cart API

Replace config.danshop() calls with CFC /api/cart/* endpoints.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
liaoxg hai 2 meses
pai
achega
289844224f
Modificáronse 1 ficheiros con 5 adicións e 5 borrados
  1. 5 5
      cfc-frontend/pages/shop/cart/cart.vue

+ 5 - 5
cfc-frontend/pages/shop/cart/cart.vue

@@ -126,9 +126,9 @@ export default {
       this.loading = true
       var that = this
       uni.request({
-        url: config.danshop('/danshop/cart/list'),
+        url: config.api('/api/cart/list'),
         method: 'POST',
-        data: { userId: this.userId },
+        data: {},
         header: {
           'Content-Type': 'application/json',
           'Authorization': 'Bearer ' + uni.getStorageSync('token')
@@ -186,9 +186,9 @@ export default {
         success: function(confirm) {
           if (confirm.confirm) {
             uni.request({
-              url: config.danshop('/danshop/cart/remove'),
+              url: config.api('/api/cart/remove'),
               method: 'POST',
-              data: { userId: that.userId, productId: productId },
+              data: { productId: productId },
               header: {
                 'Content-Type': 'application/json',
                 'Authorization': 'Bearer ' + uni.getStorageSync('token')
@@ -224,7 +224,7 @@ export default {
       uni.setStorageSync('checkoutItems', selected)
       uni.navigateTo({ url: '/pages/shop/checkout/checkout' })
     },
-    formatPrice(price) {
+    formatPriceWithSymbol(price) {
       if (price === null || price === undefined) return '0.00'
       return (Number(price) / 100).toFixed(2)
     }