<template>
  <view class="page" :style="themeColor">
    <view class="flex benben-position-layout flex flex-wrap align-center paymentResults_flex_0"
      :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
      <view class='flex flex-wrap align-center justify-between flex-sub paymentResults_fd0_0'>
        <view v-if="source == 'app'" class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
          <!-- <text class='fu-iconfont2  paymentResults_fd0_0_c0_c0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">&#xE794;</text> -->
          <button class="fu-iconfont2  immediatePayment_fd0_0_c0_c0" style="background: #fff;" open-type="launchApp" app-parameter="wechat">&#xE794;</button>
        </view>
        <view v-else class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
          <text class='fu-iconfont2  paymentResults_fd0_0_c0_c0'>&#xE794;</text>
        </view>
        <view class='flex flex-wrap align-stretch justify-center flex-sub'>
          <text class='paymentResults_fd0_0_c1_c0'>支付结果</text>
        </view>
        <view class='flex flex-wrap align-center paymentResults_fd0_0_c2'>
        </view>
      </view>

    </view>
    <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

    <view class="flex flex-direction flex-wrap align-center justify-center paymentResults_flex_1">
      <image class='paymentResults_fd1_0' mode="aspectFit"
        :src='STATIC_URL+"146.png"'></image>
      <text class='paymentResults_fd1_1'>支付成功</text>
      <view class='flex flex-wrap align-center'>
        <text class='paymentResults_fd1_2_c0'>支付方式：</text>
        <text class='paymentResults_fd1_2_c1'>{{pay == 1 ? '微信支付' : pay == 2 ? '支付宝支付' : pay == 5 ? '抵用券抵扣' :'余额支付'}}</text>
      </view>
      <view class='flex flex-wrap align-center paymentResults_fd1_3'>
        <text class='paymentResults_fd1_3_c0'>支付时间：</text>
        <text class='paymentResults_fd1_3_c1'>{{time}}</text>
      </view>
      <view class='flex flex-wrap align-center paymentResults_fd1_4'>
        <text class='paymentResults_fd1_4_c0'>赚取积分：</text>
        <text class='paymentResults_fd1_4_c1'>{{score}}</text>
      </view>
      <button class='paymentResults_fd1_5' v-if="state == 1 && source !='app'" @tap="handleToOrder">查看订单</button>
      <view class="paymentResults_fd1_7" v-if="state == 2 && source !='app'"></view>
      <button v-if="source =='app'" class='paymentResults_fd1_6' open-type="launchApp" app-parameter="wechat" data-type="switchTab"
        :data-url="`/pages/tabBar/homePage/homePage`">返回App</button>
        <button v-else class='paymentResults_fd1_6' @tap.stop="handleJumpDiy" data-type="switchTab"
          :data-url="`/pages/tabBar/homePage/homePage`">返回首页</button>
    </view>




  </view>
</template>
<script>
  export default {
    components: {},


    data() {
      return {
        "pay": "",
        "time": "",
        "contribution": "",
				sn:"",
				score:"",
        source: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        pay,
        state,
				sn,
        source
      } = options
      if (pay !== undefined) this.pay = pay
      if (state !== undefined) this.state = state
			if (sn !== undefined) this.sn = sn
			if (source !== undefined) this.source = source
      this.getFamtterTimer();
			this.get64a530ab891d9()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      handleToOrder() {
        uni.switchTab({
          url: '/pages/tabBar/myOrder/myOrder'
        })
      },
      getFamtterTimer() { //传入时间
      		let date = new Date(),
      			Y = date.getFullYear(), // 年
      			M = date.getMonth() + 1, //月
      			D = date.getDate(), //日
      			h = date.getHours(), //小时
      			m = date.getMinutes(), //分钟
      			s = date.getSeconds(); //秒数
      		this.time = Y + '-' + this.getZero(M) + '-' + this.getZero(D) + ' ' + this.getZero(h) + ':' +
      			this.getZero(m) + ':' + this.getZero(s);

      	},
				get64a530ab891d9(){
					this.$api.post(global.apiUrls.get64a530ab891d9,{
						order_sn:this.sn
					}).then(res=>{
						if(res.data.code==1){
							this.score = res.data.data.score
						}
					})
				},
      getZero(num) {
        if (parseInt(num) < 10) {
          num = '0' + num;
        }
        return num;
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto !important;
  }

  .paymentResults_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .paymentResults_fd0_0_c2 {
    width: 32rpx;
    height: 32rpx;
  }

  .paymentResults_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333;
    line-height: 88rpx;
  }

  .paymentResults_fd0_0_c0_c0 {
    font-size: 32rpx;
    font-weight: 500;
    color: #333;
    line-height: 88rpx;
  }

  .paymentResults_fd0_0 {
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .paymentResults_flex_1 {
    margin: 88rpx 0rpx 0rpx 0rpx;
  }

  .paymentResults_fd1_6 {
    border: 1px solid rgba(255, 147, 0, 1);
    background: transparent;
    line-height: 88rpx;
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    font-size: 32rpx;
    color: rgba(255, 147, 0, 1);
    width: 320rpx;
    height: 88rpx;
    margin-top: 32rpx;
  }

  .paymentResults_fd1_5 {
    background: rgba(255, 147, 0, 1);
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    font-size: 32rpx;
    color: #fff;
    width: 320rpx;
    height: 88rpx;
    line-height: 88rpx;
    margin: 60rpx 0rpx 0rpx 0rpx;
  }
  .paymentResults_fd1_7 {
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    font-size: 32rpx;
    color: #fff;
    width: 320rpx;
    height: 88rpx;
    line-height: 88rpx;
    margin: 60rpx 0rpx 0rpx 0rpx;
  }

  .paymentResults_fd1_4_c1 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 30rpx;
  }

  .paymentResults_fd1_4_c0 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 30rpx;
  }

  .paymentResults_fd1_4 {
    margin: 16rpx 0rpx 0rpx 0rpx;
  }

  .paymentResults_fd1_3_c1 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 30rpx;
  }

  .paymentResults_fd1_3_c0 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 30rpx;
  }

  .paymentResults_fd1_3 {
    margin: 16rpx 0rpx 0rpx 0rpx;
  }

  .paymentResults_fd1_2_c1 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 30rpx;
  }

  .paymentResults_fd1_2_c0 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 30rpx;
  }

  .paymentResults_fd1_1 {
    font-weight: 700;
    font-size: 32rpx;
    line-height: 105rpx;
  }

  .paymentResults_fd1_0 {
    width: 250rpx;
    height: 180rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }
</style>
