Browse Source

fix(shop/order-detail): unify all order ops to DanShop API

- onPay navigates to DanShop payment page (was productOrderPay CFC)
- onCancel uses danshopOrderCancel (was productOrderCancel CFC)
- onConfirmReceive uses orderNo param (was orderId)
- onBuyAgain navigates to shop/detail (was discover/product-detail)

Co-authored-by: Sisyphus <sisyphus@ohmyopencode.dev>
liaoxg 4 months ago
parent
commit
16a5a0a472
1 changed files with 7 additions and 15 deletions
  1. 7 15
      cfc-frontend/pages/shop/order-detail/order-detail.vue

+ 7 - 15
cfc-frontend/pages/shop/order-detail/order-detail.vue

@@ -90,7 +90,7 @@
 </template>
 
 <script>
-import { danshopOrderDetail, danshopOrderConfirm, productOrderPay, productOrderCancel } from '@/utils/api.js'
+import { danshopOrderDetail, danshopOrderConfirm } from '@/utils/api.js'
 
 export default {
   data() {
@@ -119,17 +119,9 @@ export default {
       })
     },
     onPay() {
-      uni.showLoading({ title: '支付中...' })
-      productOrderPay({ orderNo: this.orderNo }).then(res => {
-        uni.hideLoading()
-        if (res.code === 200) {
-          uni.showToast({ title: '支付成功', icon: 'success' })
-          this.loadDetail()
-        } else {
-          uni.showToast({ title: res.message || '支付失败', icon: 'none' })
-        }
-      }).catch(() => {
-        uni.hideLoading()
+      // Navigate to payment page — DanShop WeChat payment flow
+      uni.navigateTo({
+        url: '/pages/shop/payment/payment?orderNo=' + this.orderNo + '&amount=' + (this.order.totalAmount / 100 || 0)
       })
     },
     onCancel() {
@@ -138,7 +130,7 @@ export default {
         content: '确定取消该订单吗?',
         success: (confirm) => {
           if (confirm.confirm) {
-            productOrderCancel({ orderNo: this.orderNo }).then(res => {
+            danshopOrderCancel({ orderNo: this.orderNo }).then(res => {
               if (res.code === 200) {
                 uni.showToast({ title: '订单已取消', icon: 'success' })
                 this.loadDetail()
@@ -161,7 +153,7 @@ export default {
         content: '确定已收到商品吗?',
         success: (confirm) => {
           if (confirm.confirm) {
-            danshopOrderConfirm({ orderId: this.order.id }).then(res => {
+            danshopOrderConfirm({ orderNo: this.orderNo }).then(res => {
               if (res.code === 200) {
                 uni.showToast({ title: '已确认收货', icon: 'success' })
                 this.loadDetail()
@@ -175,7 +167,7 @@ export default {
     },
     onBuyAgain() {
       if (this.order.items && this.order.items.length > 0) {
-        uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + this.order.items[0].productId })
+        uni.navigateTo({ url: '/pages/shop/detail/detail?id=' + this.order.items[0].productId })
       }
     },
     statusLabel(status) {