<template>
  <z-paging
    ref="pagingRef"
    v-model="orderListPar"
    default-page-size="10"
    empty-view-text="暂无相关订单"
    :paging-style="{'top': '0','background-color': '#f2f3f7', 'bottom': '0'}"
    loading-more-no-more-text="没有更多了，看看别的吧"
    :auto-scroll-to-top-when-reload="false"
    :auto-show-back-to-top="false"
    @query="getOrderList"
    @list-change="changeData"
  >
    <view class="Mall4j order page-order">
      <view class="search-box">
        <!-- #ifdef H5-->
        <image
          class="back-icon"
          src="@/static/images/back.png"
          @tap="backToPre"
        />
        <!-- #endif -->
        <view class="search">
          <view class="icon">
            <image
              src="@/static/images/search.png"
            />
          </view>
          <view class="text">
            <input
              v-model="searchKeyWord"
              type="text"
              placeholder="输入商品名称搜索"
              confirm-type="查找"
              placeholder-class="placeholder"
              @confirm="searchOrder"
            >
          </view>
        </view>
      </view>
      <view class="tab">
        <view
          :class="['item', orderStatus===orderStatusConstant.ALL? 'active' : '']"
          @tap="switchOrderSts(orderStatusConstant.ALL)"
        >
          全部
        </view>
        <view
          :class="['item', orderStatus===orderStatusConstant.UNPAY? 'active' : '']"
          @tap="switchOrderSts(orderStatusConstant.UNPAY)"
        >
          待付款
        </view>
        <view
          :class="['item', orderStatus===orderStatusConstant.PAYED? 'active' : '']"
          @tap="switchOrderSts(orderStatusConstant.PAYED)"
        >
          待发货
        </view>
        <view
          :class="['item', orderStatus===orderStatusConstant.CONSIGNMENT? 'active' : '']"
          @tap="switchOrderSts(orderStatusConstant.CONSIGNMENT)"
        >
          待收货
        </view>
        <view
          :class="['item', orderStatus===orderStatusConstant.SUCCESS? 'active' : '']"
          @tap="switchOrderSts(orderStatusConstant.SUCCESS)"
        >
          已完成
        </view>
      </view>
      <view class="order-box">
        <block
          v-for="(orderItem, orderIdx) in orderList"
          :key="orderIdx"
        >
          <view class="item">
            <!-- 店铺 -->
            <view class="shop-info">
              <view class="shop">
                <view class="icon">
                  <image
                    src="@/static/images/shop.png"
                  />
                </view>
                <view
                  class="name text-arrow"
                  @tap="toShopIndex(orderItem.shopId,orderItem)"
                >
                  {{ orderItem.shopName }}
                </view>
              </view>
              <view class="status">
                <text>{{ ['','待付款','待发货','待收货','待收货','','已取消', '待成团','','待付尾款'][orderItem.status] }}</text>
                <text v-if="orderItem.refundStatus && orderItem.status!==orderStatusConstant.CANCEL">
                  ({{
                    ['','退款中','退款完成','部分退款','退款失败'][orderItem.refundStatus]
                  }}<block v-if="(orderItem.status <= 2 && orderItem.deliveryCount && orderItem.deliveryCount < orderItem.allCount)">
                    , 部分发货
                  </block>)
                </text>
                <text
                  v-if="!orderItem.refundStatus &&
                    orderItem.status <= 2 &&
                    orderItem.deliveryCount &&
                    orderItem.allCount > orderItem.deliveryCount"
                >
                  (部分发货)
                </text>
              </view>
              <view
                v-if="orderItem.status===orderStatusConstant.SUCCESS"
                class="order-complete"
              >
                <image
                  src="@/package-user/static/images/order-finish.png"
                />
              </view>
              <view
                v-if="orderItem.status===orderStatusConstant.CANCEL || orderItem.status===orderStatusConstant.SUCCESS && !orderItem.reStatus"
                class="del"
                @tap="handleShowPop(0,orderItem.orderId)"
              >
                <image
                  src="@/static/images/del.png"
                />
              </view>
              <!-- 已完成或已取消时才显示“order-complete”和“del” -->
            </view>

            <!-- 单商品 -->
            <view
              v-if="orderItem.orderItems.length===1"
              class="single-prod"
              @tap="toOrderDetail(orderItem.orderId,orderItem.deliveryType)"
            >
              <block
                v-for="(prodItem,prodIdx) in orderItem.orderItems"
                :key="prodIdx"
              >
                <view class="prod-img">
                  <img-show
                    :src="prodItem.pic"
                    img-mode="aspectFit"
                  />
                </view>
                <view class="text-box">
                  <view class="name">
                    {{ prodItem.spuName }}
                  </view>
                  <view class="sku">
                    <view
                      v-if="prodItem.skuName"
                      class="sku-text"
                    >
                      {{ prodItem.skuName }}
                    </view>
                    <view
                      v-if="orderItem.orderType===orderTypeConstant.GROUP || orderItem.orderType===orderTypeConstant.SECOND || orderItem.orderType===orderTypeConstant.SCORE"
                      class="activity-logo"
                    >
                      <text v-if="orderItem.orderType===orderTypeConstant.GROUP">
                        拼团
                      </text>
                      <text v-if="orderItem.orderType===orderTypeConstant.SECOND">
                        秒杀
                      </text>
                      <text v-if="orderItem.orderType===orderTypeConstant.SCORE">
                        积分
                      </text>
                    </view>
                    <view
                      v-if="orderItem.deliveryType===2"
                      class="activity-logo pick-up"
                    >
                      自提
                    </view>
                    <!-- 预售 -->
                    <view
                      v-if="orderItem.preSaleType===1||orderItem.preSaleType===0"
                      class="presale-logo"
                    >
                      <view class="activity-logo">
                        预售
                      </view>
                      <view v-if="orderItem.preSaleDeliveryType!==-1 && !( orderItem.status===2|| orderItem.status===3|| orderItem.status===5)">
                        付款后{{ orderItem.preSaleDeliveryType }}天开始发货
                      </view>
                      <view v-else>
                        {{ orderItem.newPreSaleDeliveryTime }}开始发货
                      </view>
                    </view>
                  </view>

                  <view class="price-box">
                    <view class="price">
                      <view
                        v-if="orderItem.orderType===orderTypeConstant.SCORE"
                        class="symbol"
                      >
                        {{ prodItem.scoreFee }}积分
                      </view>
                      <view
                        v-if="orderItem.orderType===orderTypeConstant.SCORE && prodItem.price"
                        class="symbol"
                      >
                        +
                      </view>
                      <view
                        v-if="orderItem.orderType!==orderTypeConstant.SCORE"
                        class="symbol"
                      >
                        ￥
                      </view>
                      <view
                        v-if="prodItem.price"
                        class="big"
                      >
                        {{ wxs.parsePrice(prodItem.price)[0] }}
                      </view>
                      <view
                        v-if="prodItem.price"
                        class="symbol"
                      >
                        .{{ wxs.parsePrice(prodItem.price)[1] }}元
                      </view>
                    </view>
                    <view class="count">
                      ×{{ orderItem.totalCounts }}
                    </view>
                  </view>
                </view>
              </block>
            </view>

            <!-- 多商品 -->
            <view
              v-else
              class="many-prods"
              @tap="toOrderDetail(orderItem.orderId,orderItem.deliveryType)"
            >
              <scroll-view
                :scroll-x="true"
                class="img-box"
              >
                <view
                  v-for="(prodItem,prodIdx) in orderItem.orderItems"
                  :key="prodIdx"
                  class="img"
                >
                  <img-show
                    :src="prodItem.pic"
                    img-mode="aspectFit"
                  />
                  <view class="count">
                    ×{{ prodItem.count }}
                  </view>
                </view>
              </scroll-view>
            </view>

            <!-- 操作 -->
            <view class="action-box">
              <view class="number-box">
                <view class="price">
                  <view
                    v-if="orderItem.status===9"
                    class="symbol"
                  >
                    尾款:
                  </view>
                  <view
                    v-if="orderItem.preSaleType===1&&orderItem.status===1"
                    class="symbol"
                  >
                    定金:
                  </view>
                  <view
                    v-if="orderItem.orderType!==orderTypeConstant.SCORE && orderItem.actualTotal"
                    class="symbol"
                  >
                    ￥
                  </view>
                  <!--定金预售 orderItem.balanceAmount 尾款    -->
                  <template v-if="orderItem.status===9">
                    <view
                      v-if="orderItem.balanceAmount||orderItem.balanceAmount===0"
                      class="big"
                    >
                      {{ wxs.parsePrice(orderItem.balanceAmount)[0] }}
                    </view>
                    <view
                      v-if="orderItem.balanceAmount||orderItem.balanceAmount===0"
                      class="symbol"
                    >
                      .{{ wxs.parsePrice(orderItem.balanceAmount)[1] }}
                    </view>
                  </template>
                  <!--定金预售未付款定金    orderItem.depositAmount定金 -->
                  <template v-else-if="orderItem.preSaleType===1&&orderItem.status===1">
                    <view
                      v-if="orderItem.depositAmount"
                      class="big"
                    >
                      {{ wxs.parsePrice(orderItem.depositAmount)[0] }}
                    </view>
                    <view
                      v-if="orderItem.depositAmount"
                      class="symbol"
                    >
                      .{{ wxs.parsePrice(orderItem.depositAmount)[1] }}
                    </view>
                  </template>
                  <!-- orderItem.actualTotal 实际合计 -->
                  <template v-else>
                    <view
                      v-if="orderItem.actualTotal"
                      class="big"
                    >
                      {{ wxs.parsePrice(orderItem.actualTotal)[0] }}
                    </view>
                    <view
                      v-if="orderItem.actualTotal"
                      class="symbol"
                    >
                      .{{ wxs.parsePrice(orderItem.actualTotal)[1] }}
                    </view>
                  </template>
                  <view
                    v-if="(orderItem.orderType===orderTypeConstant.SCORE || orderItem.orderScore) && orderItem.actualTotal"
                    class="symbol"
                  >
                    +
                  </view>
                  <view
                    v-if="orderItem.orderType===orderTypeConstant.SCORE || orderItem.orderScore"
                    class="big"
                  >
                    {{ orderItem.orderScore }}
                  </view>
                  <view
                    v-if="orderItem.orderType===orderTypeConstant.SCORE || orderItem.orderScore"
                    class="score-apart"
                  >
                    积分
                  </view>
                </view>
                <view
                  v-if="orderItem.status===9&&orderItem.freightAmount &&(orderItem.freightAmount-orderItem.platformFreeFreightAmount)"
                  class="price"
                >
                  +运费{{ wxs.parsePrice(orderItem.freightAmount-orderItem.platformFreeFreightAmount)[0] }}.{{ wxs.parsePrice(orderItem.freightAmount-orderItem.platformFreeFreightAmount)[1] }}
                </view>
                <view class="count">
                  共{{ orderItem.totalCounts }}件
                </view>
              </view>
              <view class="btn-box">
                <block v-if="orderItem.orderType!==orderTypeConstant.SCORE">
                  <view
                    v-if="
                      ((orderItem.orderInvoiceId && orderItem.status !== 6) || (orderItem.orderInvoiceId && (orderItem.status === 6 && orderItem.refundStatus))) && orderItem.status !== 1
                        &&!(orderItem.status===orderStatusConstant.CONSIGNMENT &&
                          (!orderItem.refundStatus || (orderItem.refundStatus!==refundStatusConstant.APPLY))) &&
                        !(orderItem.orderItems[0].isComm === 0 && orderItem.status === 5 && (!orderItem.refundStatus || orderItem.refundStatus===refundStatusConstant.PARTIAL_SUCCESS)) && orderItem.orderItems[0].isComm !== 0"
                    class="btn"
                    @tap="viewIinvoice(orderItem.orderId,orderItem.orderInvoiceId)"
                  >
                    查看发票
                  </view>
                  <view
                    v-if="!orderItem.orderInvoiceId &&
                      orderItem.status !== 6 && orderItem.status !== 1
                      &&!(orderItem.status===orderStatusConstant.CONSIGNMENT &&
                        (!orderItem.refundStatus || (orderItem.refundStatus!==refundStatusConstant.APPLY))) &&
                      !(orderItem.orderItems[0].isComm === 0 && orderItem.status === 5 && (!orderItem.refundStatus || orderItem.refundStatus===refundStatusConstant.PARTIAL_SUCCESS)) && orderItem.orderItems[0].isComm !== 0"
                    class="btn"
                    @tap="showInvoicePopup(orderItem.shopId ,orderItem.orderId)"
                  >
                    申请开票
                  </view>
                </block>
                <view
                  v-if="orderItem.status===orderStatusConstant.UNPAY"
                  class="btn"
                  @tap="handleShowPop(1,orderItem.orderId)"
                >
                  取消订单
                </view>
                <view
                  v-if="orderItem.status===orderStatusConstant.UNPAY||(orderItem.status===9&&orderItem.isPreSaleActivity)"
                  class="btn btn-r"
                  @tap="payNow(orderItem.orderId,orderItem.actualTotal,orderItem)"
                >
                  立即支付
                </view>
                <view
                  v-if="(orderItem.status>=orderStatusConstant.CONSIGNMENT||(orderItem.status===2 && orderItem.updateOrViewDeliveryInfo)) && orderItem.status!==orderStatusConstant.CANCEL && orderItem.status!==orderStatusConstant.WAIT_GROUP && orderItem.updateOrViewDeliveryInfo"
                  class="btn"
                  @tap="viewLogistics(orderItem.orderId)"
                >
                  查看物流
                </view>
                <view
                  v-if="orderItem.orderType!==orderTypeConstant.SCORE && !orderItem.orderItems.some(val=>val.isComm !== 0)&& orderItem.orderItems.some(val=>(!val.refundStatus || val.refundStatus === refundStatusConstant.DISAGREE) && !val.isComm) && orderItem.status === 5 && (!orderItem.refundStatus || (orderItem.refundStatus===refundStatusConstant.PARTIAL_SUCCESS || orderItem.refundStatus===refundStatusConstant.DISAGREE ))"
                  class="btn btn-r"
                  @tap="wrtieCommnet(orderItem.orderItems)"
                >
                  评价
                </view>
                <view
                  v-if="orderItem.status===orderStatusConstant.CONSIGNMENT && (!orderItem.refundStatus || (orderItem.refundStatus!==refundStatusConstant.APPLY))"
                  class="btn btn-r"
                  @tap="handleShowPop(2,orderItem.orderId)"
                >
                  确认收货
                </view>
              </view>
            </view>
          </view>
        </block>
      </view>
      <!-- 订单弹窗组件 -->
      <confirm-pop
        :show-pop="showPop"
        :pop-content="popContent"
        @handle-pop-cancel="popCancel"
        @handle-pop-confirm="popConfirm"
      />
      <invoiceEdit
        v-if="isShowInvoicePopup"
        :shop-id="invoiceShopId"
        :order-id="invoiceOrderId"
        @close-popup="closePopup"
        @get-data="onPagingLoaded"
      />
      <!-- 广告弹窗 -->
      <popup-ad
        v-model="popupadShow"
        :popup-info="popupInfo"
        :shop-id="0"
      />
    </view>
  </z-paging>
</template>

<script setup>
import number from '@/wxs/number'
import util from '@/utils/util'
import Pay from '@/utils/pay'
import { OrderStatus, RefundStatus, PayType, PayEntry } from '@/utils/constant'
import moment from 'moment'
import invoiceEdit from '@/package-user/components/invoice-edit/index.vue'

const wxs = number()

// 订单状态常量
const orderStatusConstant = ref(OrderStatus)
// 退款状态常量
const refundStatusConstant = ref(RefundStatus)
// 订单类型常量
const orderTypeConstant = ref(ProdType)

// 订单状态
const orderStatus = ref(0)
onLoad((options) => {
  orderStatus.value = Number(options.orderStatus)
  onGetPopupInfo()
})
onShow(() => {
  pagingRef?.value?.reload()
})

// 获取弹窗广告信息
const popupadShow = ref(false)
const popupInfo = ref({})
const onGetPopupInfo = async () => {
  const info = await util.getPopupInfo({ pageType: 3, shopId: 0 })
  if (info) {
    popupInfo.value = info
    popupadShow.value = true
  }
}

const invoiceShopId = ref('')
const invoiceOrderId = ref('') // 当前选择发票的id
const isShowInvoicePopup = ref(false)
// 发票信息弹窗
const showInvoicePopup = (shopIdPar, invoiceOrderIdPar) => {
  invoiceShopId.value = shopIdPar
  invoiceOrderId.value = invoiceOrderIdPar
  isShowInvoicePopup.value = true
}

// 关闭弹窗
const closePopup = () => {
  isShowInvoicePopup.value = false
}

/**
 * 搜索订单
 */
const searchOrder = () => {
  orderStatus.value = 0
  pagingRef.value.reload()
}
/**
 * 返回上一页
 */
const backToPre = () => {
  // #ifdef H5
  history.back()
  // #endif
  // #ifndef H5
  uni.navigateBack()
  // #endif
}
/**
 * 立即支付
 */
const payNow = (orderIdPar, actualTotalPar, orderItemPar) => {
  const payStatus = orderItemPar.status === 9 ? '&pay_status=9' : '' // 预售订单
  if (actualTotalPar) {
    uni.navigateTo({
      url: '/package-activities/pages/payment/payment?orderIds=' + orderIdPar + payStatus
    })
  } else {
    surePay(orderIdPar + '', 0) // 0-积分支付
  }
}

// 确认支付
const surePay = (orderIdsPar, payTypePar) => {
  const paymentData = {
    payType: 0,
    orderIds: orderIdsPar,
    isPurePoints: orderIdsPar,
    dvyType: payTypePar,
    payEntry: PayEntry.ORDER
  }
  if (payTypePar === PayType.SCOREPAY) {
    uni.showModal({
      title: '提示',
      content: '确认进行支付吗？',
      success: (res) => {
        if (res.confirm) {
          Pay.toOrderPay(paymentData)
        } else if (res.cancel) {
          uni.showToast({
            title: '取消支付',
            icon: 'none',
            duration: 1500
          })
        }
      }
    })
  }
}

// 是否显示弹窗
const showPop = ref(false)
/**
 * 弹窗取消事件
 */
const popCancel = () => {
  showPop.value = false
}

// 订单操作类型: 0取消; 1删除
const operType = ref(0)
// 当前操作的订单id
const operOrderId = ref('')
/**
 * 弹窗确认事件 - 操作订单
 */
const popConfirm = () => {
  let url = ''
  let reqMethod = ''
  if (operType.value === 0) {
    url = '/mall4cloud_order/my_order/'
    reqMethod = 'DELETE'
  } else if (operType.value === 1) {
    url = '/mall4cloud_order/my_order/cancel/'
    reqMethod = 'PUT'
  } else if (operType.value === 2) {
    url = '/mall4cloud_order/my_order/receipt/'
    reqMethod = 'PUT'
  }
  url = url + operOrderId.value
  http.request({
    url,
    method: reqMethod
  }).then(() => {
    showPop.value = false
    uni.showToast({
      title: '操作成功',
      duration: 2000
    })
    setTimeout(() => {
      pagingRef.value.reload()
    }, 1000)
  })
}

const popContent = reactive({
  title: '提示',
  content: '',
  confirmText: '确认',
  cancelText: '取消'
})
/**
 * 显示订单操作弹窗
 * @param {number} operTypePar 0:删除订单; 1取消订单; 2确认收货
 * @param orderIdPar
 */
const handleShowPop = async (operTypePar, orderIdPar) => {
  operType.value = operTypePar
  operOrderId.value = orderIdPar
  // 设置弹窗内容文本
  if (operType.value === 0) {
    popContent.title = '是否删除该订单'
    popContent.content = '订单删除后将无法恢复，请谨慎操作'
  } else if (operType.value === 1) {
    popContent.title = '是否取消该订单'
    popContent.content = '订单取消后将无法恢复，请谨慎操作'
  } else {
    popContent.title = '我已收到货？'
    popContent.content = '确认收货后将改变订单状态'
    // 确认收货前检查
    const wxConfirmFlag = await util.orderReceiptCheck(orderIdPar, pagingRef.value.reload)
    if (wxConfirmFlag) return
  }
  showPop.value = true
}

/**
 * 切换订单状态
 */
const switchOrderSts = (sts) => {
  orderStatus.value = sts
  pagingRef.value.reload()
}

/**
 * 评价
 */
const wrtieCommnet = (orderItemsPar) => {
  // 把商品项缓存起来
  const preCommentData = []
  orderItemsPar.forEach((el) => {
    if ((!el.refundStatus || el.refundStatus === RefundStatus.DISAGREE) && !el.isComm) {
      preCommentData.push({
        spuName: el.spuName,
        pic: el.pic,
        orderItemId: el.orderItemId,
        shopId: el.shopId,
        skuName: el.skuName
      })
    }
  })
  uni.setStorageSync('cloudOrderItemInfo', preCommentData)
  uni.navigateTo({
    url: '/package-user/pages/pord-comment/pord-comment'
  })
}

// 订单搜索关键字
const searchKeyWord = ref('')
const orderList = ref([])
const orderListPar = ref([])
const isLoaded = ref(false) // 列表是否加载完毕
const pagingRef = ref(null)
/**
 * 获取订单列表
 */
const getOrderList = (pageNum, pageSize) => {
  isLoaded.value = false
  http.request({
    url: '/mall4cloud_order/my_order/search_order',
    method: 'GET',
    data: {
      status: orderStatus.value === OrderStatus.ALL ? '' : orderStatus.value,
      pageNum,
      pageSize,
      spuName: searchKeyWord.value
    }
  }).then((res) => {
    isLoaded.value = true
    res.list.forEach(orderItem => {
      orderItem.totalCounts = 0
      // 预售商品
      if (orderItem.preSaleType === 1 || orderItem.preSaleType === 0) {
        orderItem.newPreSaleDeliveryTime = orderItem.preSaleDeliveryTime ? moment(new Date(orderItem.preSaleDeliveryTime?.replace(/-/g, '/'))).format('M[月]D[日]') : null
        const balanceStartTime = new Date(orderItem.balanceStartTime ? orderItem.balanceStartTime.replace(/-/g, '/') : null).getTime() // 尾款开始支付时间（时间戳）
        const balanceEndTime = new Date(orderItem.balanceEndTime ? orderItem.balanceEndTime.replace(/-/g, '/') : null).getTime() // 尾款开始支付时间（时间戳）
        const nowTime = Date.now() // 现在时间（时间戳）
        const startTime = (balanceStartTime - nowTime) // 距离开始的毫秒数
        const isBalanceEndTime = (balanceEndTime - nowTime) // 距离结束的毫秒数

        orderItem.isPreSaleActivity = startTime <= 0 && isBalanceEndTime >= 0
      }

      if (orderItem.returnMoneySts == null) {
        orderItem.returnMoneySts = 0
      }
      orderItem.orderItems.forEach(prodItem => {
        if (prodItem.giveawayList) {
          orderItem.orderItems = [...orderItem.orderItems, ...prodItem.giveawayList]
        }
      })
      orderItem.orderItems.forEach(prodItem => {
        orderItem.totalCounts += prodItem.count
      })
    })

    pagingRef.value.complete(res.list)
  })
}

// 刷新列表数据，但不重置页码
const onPagingLoaded = () => {
  pagingRef.value.refresh()
}

const changeData = (list) => {
  orderList.value = list
  // 判断订单内有无退款商品
  orderList.value.forEach((oItem) => {
    oItem.orderItems.forEach((item) => {
      if (item.refundStatus === 1) {
        oItem.reStatus = true
      }
    })
  })
}

/**
 * 跳转店铺首页
 */
const toShopIndex = (shopIdPar, orderItemPar) => {
  if (orderItemPar.orderType === orderTypeConstant.value.SCORE) {
    uni.navigateTo({
      url: '/package-activities/pages/integral-mall/integral-mall'
    })
    return
  }

  getShopInfo(shopIdPar)
}

/**
* 获取店铺信息
*/
const getShopInfo = (shopIdPar) => {
  http.request({
    url: '/mall4cloud_admin/ua/shop_detail/head_info',
    method: 'GET',
    data: {
      shopId: shopIdPar,
      imgType: 0 // 图片类型：0.app(h5) 1.pc
    }
  }).then((res) => {
    uni.setStorageSync('cloudShopInfo', res)
    uni.redirectTo({
      url: res.renovationId ? '/package-shop/shop-page/feature-index/feature-index?shopId=' + res.shopId +
        '&renovationId=' + res.renovationId : '/package-shop/shop-page/shop-index/shop-index?shopId=' + shopIdPar
    })
  })
}

// 去订单详情
const toOrderDetail = (orderIdPar, deliveryTypePar) => {
  uni.navigateTo({
    url: '/package-user/pages/order-detail/order-detail?orderId=' + orderIdPar + '&deliveryType=' + deliveryTypePar
  })
}

// 查看物流
const viewLogistics = (orderIdPar) => {
  uni.navigateTo({
    url: '/pages/logistics-detail/logistics-detail?orderId=' + orderIdPar
  })
}
// 查看发票
const viewIinvoice = (orderIdPar, orderInvoiceIdPar) => {
  uni.navigateTo({
    url: `/package-user/pages/invoice-detail/invoice-detail?orderId=${orderIdPar}&orderInvoiceId=${orderInvoiceIdPar}`
  })
}
</script>

<style lang="scss" scoped>
@use "order";
</style>

<style lang="scss" scoped>
@use "../../../popup";
</style>
