<template>
<view>
<!--promote/balance/balance.wxml-->
<view class="list" v-if="pageList.length > 0">
	<block v-for="(item, index) in pageList" :key="index">
		<view class="li dflex">
			<image :src="item.createAvatar ? item.createAvatar : '../../static/pages/images/userimg.png'" mode="aspectFill" class="userimg"></image>
			<view class="fflex">
				<view class="ddflex">
					<view class="fflex">
						<view class="username">{{item.nickName}}</view>
						<view class="time" v-if="item.updateDate">{{item.updateDate}}</view>
					</view>
					<view class="money">￥<text>{{item.orderMoney}}</text></view>
				</view>
				<view class="name">
					<text>订单</text>
					{{item.orderId}}
				</view>
				<view class="pro-buy ddflex" v-if="item.productList && item.productList.length > 0">
					<text>购买了</text>
					<view class="pro-list fflex">
						<view class="lis tover" v-for="(it,idx) in item.productList" :key="idx">{{it.title}}</view>
					</view>
				</view>
				<view class="opt ddflex">
					<view :class="'shifu ddflex' + (item.state==2 ? ' green' : item.state==1 ? ' dai' : '')"><text>佣金</text>￥<text>{{item.money}}</text></view>
					<view class="sta dai" v-if="item.state==1">待结算</view>
					<view class="sta green" v-else-if="item.state==2">已结算</view>
					<view class="sta moneygray" v-else>已取消</view>
				</view>
			</view>
				<!-- <view class="flex">
					<view class="name">
						<text>订单:</text>
						{{item.orderId}}
					</view>
					<view class="dblock">
						<text class="moneygray"></text>
						<text class="moneygray" v-if="item.orderMoney">   ￥{{item.orderMoney}}</text>
						<text class="moneyred" v-if="item.state==1">待结算</text>
						<text class="moneygray" v-else-if="item.state==2">已结算</text>
						<text class="moneygray" v-else>已取消</text>
					</view>
				</view>
				<view class="money">￥<text>{{item.money}}</text>
					<view>
						<text class="time" v-if="item.updateDate">{{item.updateDate}}</text>
					</view>
				
				</view> -->
		</view>
	</block>
</view>
<view class="nodata" v-if="pageList.length < 1">
	<image :src="picUrlss+'empty_dd.png'"></image>
	<text>暂无业绩订单</text>
</view>
</view>
</template>

<script>
// promote/balance/balance.js
const app = getApp();
const req = require("../../utils/request.js");

export default {
  data() {
    return {
		picUrlss: req.public.picUrls,
      pageList: [],
      form: {
        page: 1,
        limit: 12
      },
      isLoad: true
    };
  },

  components: {},
  props: {},

  onLoad(options) {
    this.getData();
  },

  onReachBottom: function () {
    if (this.hasmore) return false;
    this.form.page++;
    this.getData();
  },
  methods: {
    getData() {
      if (!this.isLoad) return false;
      this.isLoad = false;
      let that = this;
      req.getRequest('/api/distribution/income', that.form, data => {
        // console.log(data);
        if (data && data.length >= 10) that.isLoad = true;
        if (that.form.page > 1) data = that.pageList.concat(data);
        that.setData({
          pageList: data
        });
      });
    }

  }
};
</script>
<style>
@import "./balance.css";
</style>