<template>
  <clinic-salesperson-page-layout title="服务费记录" :show-back="true">
    <view class="page">
      <view v-if="!list.length" class="empty">暂无服务费记录</view>
      <view v-for="item in list" :key="item.id" class="row">
        <view>
          <text class="order">{{ item.order_no }} <text class="status" style="margin-left: 20rpx">{{ item.settlement_id > 0 ? '已结算' : '待结算' }}</text></text>
          <text v-if="item.patient_name || item.patient_mobile" class="patient">{{ item.patient_name }} {{ item.patient_mobile }}</text>
          <text class="drug">{{ item.drug_name }} ×{{ item.qty }}</text>
        </view>
        <view class="right">
          <text class="amount">¥{{ item.commission_amount }}</text>
          <text class="status">{{ item.created_at }}</text>
        </view>
      </view>
    </view>
  </clinic-salesperson-page-layout>
</template>

<script>
import ClinicSalespersonPageLayout from '@/subPackages/sub_clinic_salesperson/components/clinic-salesperson-page-layout.vue'
import { getClinicSalespersonCommissionList } from '@/api/clinicSalesperson.js'

export default {
  components: { ClinicSalespersonPageLayout },
  data() {
    return { list: [] }
  },
  onLoad() {
    this.loadList()
  },
  methods: {
    async loadList() {
      const wrap = await getClinicSalespersonCommissionList({ page: 1, pageSize: 50 })
      if (wrap && wrap.ok) this.list = wrap.data?.items || []
    },
  },
}
</script>

<style lang="scss" scoped>
.page { padding: 24rpx; }
.empty { text-align: center; color: #999; padding: 80rpx 0; }
.row { background: #fff; border-radius: 12rpx; padding: 24rpx; margin-bottom: 16rpx; display: flex; justify-content: space-between; }
.order { display: block; font-size: 26rpx; font-weight: 600; }
.patient { display: block; font-size: 24rpx; color: #666; margin-top: 6rpx; }
.drug { font-size: 24rpx; color: #666; }
.right { text-align: right; }
.amount { display: block; font-size: 28rpx; color: #4db6a8; font-weight: 600; }
.status { font-size: 22rpx; color: #999; }
</style>
