invoiceForm.vue 3.31 KB
<template>
    <view>
        <!--<uni-notice-bar backgroundColor="#f2fded" color="#51c24e" single showIcon text="已发送电子邮箱"></uni-notice-bar>-->
        <uni-list>
            <uni-list-item title="发票预览" clickable showArrow @click="previewCell"/>

        </uni-list>

        <uni-list>
            <view class="recordCon uni-list-cell-pd">
                <text class="color-black">发票信息</text>
            </view>
            <view class="recordCon uni-list-cell-pd">
                <text>电子邮箱:{{invoiceInfo.email}}</text>
            </view>
        </uni-list>

        <view class="bg-white border-bottom-1 pos-rel" @click="recordClick">
            <view class="recordCon uni-list-cell-pd">
                <text class="color-black">发票包含内容</text>
            </view>
            <view class="recordCon uni-list-cell-pd">
                <text>该发票包含{{len}}笔交易</text>
            </view>
            <view class="uni-icon pos-abs icon-arrowright uni-icon-arrowright">
            </view>
        </view>

        <view class="margin-top-30">
            <button type="primary" class="tel-btn" @click="sentEmail">重发邮件</button>
        </view>

        <view class="margin-top-30">
            <button class="tel-btn" v-if="tel.length>0" type="primary" plain="true" @click="call">客服电话:{{tel}}</button>
        </view>

    </view>
</template>

<script>
export default {
  data() {
    return {
      invoiceInfo: {
        email: '',
        number: 0
      },
      tel: '051086166660',
      invoiceId:'',
      invoiceUrl:'',
      index:0,
      len:0
    }
  },
  onLoad(params){
    var pages = getCurrentPages();//当前页
    var beforePage = pages[pages.length - 2];//上个页面
    console.log(beforePage.$vm.list)
    console.log(params)

    this.invoiceInfo.email = params.custEmail
    this.invoiceId = params.invoiceId
    this.index = params.index
    this.invoiceUrl =beforePage.$vm.list[this.index].invoiceUrl
    this.len = params.len
  },
  methods: {
    call(){
      var me = this;
      uni.makePhoneCall({
        phoneNumber: me.tel //仅为示例
      });
    },
    previewCell() {
      uni.navigateTo({
        url: '../invoicePreview/invoicePreview?index='+this.index
      });
      // window.open(this.invoiceUrl)
    },
    recordClick() {
      uni.navigateTo({
        url: '../elecRecord/elecRecord?index='+this.index
      });
    },
    sentEmail(){
      var resendInvoiceMail = this.$common.resendInvoiceMail;
      var jsondata = {
        invoiceId:this.invoiceId,
        orgId:this.$common.public_orgId
      };
      uni.request({
        url: resendInvoiceMail,
        data: JSON.stringify(this.$common.requestSign(jsondata)),
        dataType: "json",
        method: "POST",
        success: (res) => {
        console.log(res)
      console.log(res.data)
      console.log(res.code)
      if (res.data.code == 0) {
        uni.showToast({
          icon:'none',
          title: `邮件发送成功`
        })
      }
    }
    })
    }
  }
}
</script>

<style scoped>
    .icon-arrowright {
        color: #bbb;
        font-size: 20px;
        right: 15upx;
        top: 60upx;
    }

    .tel-btn {
        width: 90%;
        margin: 30upx auto;
    }

    >>> .uni-list-cell__content-title {
        margin-left: 0 !important;
    }

</style>