<template>
  <view class="box">
    <view>{{ obj.supCusName }}</view>
    <view
      >结算时间：<text>{{ obj.settlementTime }}</text></view
    >
    <view
      >单据编号：<text>{{ obj.paymentNumber }}</text></view
    >
    <view
      >付款类型：<text>{{ getPayment(obj) }}</text></view
    >
    <view
      >付款金额：<text v-if="obj.paymentType === 0 || obj.paymentType === 3"
        >￥ {{ obj.totalPrice }}</text
      >
      <text v-else
        >运费：￥ {{ obj.freight }}&nbsp;&nbsp;&nbsp;杂费：￥
        {{ obj.incidentals }}</text
      >
    </view>
    <view
      >结算方式：<text>{{ getPaymentMethod(obj) }}</text></view
    >
    <view
      >付款人：<text>{{ obj.paymentName }}</text></view
    >
    <view v-if="obj.paymentType === 0 || obj.paymentType === 1"
      >{{ obj.paymentType === 0 ? "收货" : "出货" }}单号：
      <text>{{ obj.orderNumber }}</text></view
    >
    <up-image :show-loading="true" v-for="(item, index) in state.fileLists" :key="index" :src="item.url" width="80px" height="80px"></up-image>
  </view>
</template>
<script setup lang="ts">
import { FinanceApi, PictureApi } from "@/services";
import { ImagesType, OrderType } from "@/utils/enum";
import { onLoad } from "@dcloudio/uni-app";
const obj = ref<any>({});
const state = reactive<any>({
  fileLists: []
})
const getPayment = (item: any) => {
  return ["供应商付款", "客户付款", "客户(手动)", "供应商(手动)"][
    item.paymentType
  ];
};
const getPaymentMethod = (item: any) => {
  return ["", "现金", "转账", "微信", "支付宝"][item.paymentMethod];
};
onLoad((option: any) => {
  // 接收传递的标题参数
  FinanceApi.getByPaymentId({ id: option.id }).then((res) => {
    if (res.code === 200) {
      obj.value = res.data;
    }
  });
  PictureApi.getAnnex({
      businessId: option.id,
      orderType: OrderType.Pay,
      imagesType: ImagesType.NORMARL,
    }).then((res) => {
      if (res.code === 200) {
        state.fileLists = res.data;
      }
    });
});
</script>
<style lang="scss" scoped>
.box {
  background: #ffffff;
  box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(5, 68, 37, 0.12);
  border-radius: 13rpx;
  font-size: 26rpx;
  margin: 26rpx;
  padding: 26rpx;
  line-height: 50rpx;
  text {
    font-size: 24rpx;
    color: rgba(0, 0, 0, 0.7);
  }
}
</style>
