Blame view

src/views/eInvoice/common/fill.vue 5.25 KB
dcf54a32   刘淇   扬名微信公众号
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  <template>
    <div>
  
      <div>
        <divider>抬头类型</divider>
        <tab :line-width=2 active-color='#fc378c' v-model="index">
          <tab-item class="vux-center" :selected="active === item" v-for="(item, index) in list2" @click="active = item"
                    :key="index">{{item}}
          </tab-item>
        </tab>
        <swiper v-model="index" :show-dots="false" height="400px">
          <swiper-item :key="0">
            <div class="tab-swiper vux-center">
              <group title="发票详情">
                <x-input title="发票抬头" v-model="personname" type="text" placeholder="请填写抬头名称" required></x-input>
                <x-input title="电子邮箱" v-model="personemail" type="email" placeholder="用于向您发送电子邮箱" required
                         is-type="email"></x-input>
                <x-input title="备注信息" v-model="personremark" type="text" placeholder="请填写备注信息"></x-input>
              </group>
            </div>
          </swiper-item>
          <swiper-item :key="1">
            <div class="tab-swiper vux-center">
              <group title="发票详情" label-width="120px">
                <x-input title="发票抬头" v-model="name" type="text" placeholder="请填写抬头名称" required></x-input>
                <x-input title="纳税人识别号" v-model="num" type="text" placeholder="请填写纳税人识别号" required></x-input>
                <x-input title="注册地址" v-model="address" type="text" placeholder="请填写公司注册地址"></x-input>
                <x-input title="注册电话" v-model="iphone" type="text" placeholder="请填写公司注册电话"></x-input>
                <x-input title="开户行" v-model="bankName" type="text" placeholder="请填写公司开户账户"></x-input>
                <x-input title="开户账号" v-model="bankNum" type="text" placeholder="请填写公司开户账号"></x-input>
                <x-input title="电子邮箱" v-model="email" type="email" placeholder="用于向您发送电子邮箱" required
                         is-type="email"></x-input>
                <x-input title="备注信息" v-model="remark" type="text" placeholder="请填写备注信息"></x-input>
              </group>
            </div>
          </swiper-item>
        </swiper>
  
        <div style="padding: 15px">
380913b6   刘淇   设计修改
40
          <x-button type="primary" @click.native="fillBtn">确定</x-button>
dcf54a32   刘淇   扬名微信公众号
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
        </div>
  
      </div>
  
      <toast v-model="showToast" type="text" :time="800" is-show-mask :text="showVal" position="top" width="15em"></toast>
    </div>
  </template>
  
  <script>
  
  import { insertCustInvoiceInfo } from "@/api/invoice/invoice.js";
  export default {
    name: "fill",
    data() {
      return {
        list2: ["个人", "企业"],
        active: "个人",
        index: 0,
        personname: "",
        personemail: "",
        personremark: "",
        name: "",//企业发票抬头
        email: "",//企业邮箱
        remark: "",//企业备注信息
        num: "",//企业纳税人识别号
        address: "",//企业注册地址
        iphone: "",//企业注册电话
        bankName: "",
        bankNum: "",
        showToast: false,
        showVal: "" // 提示内容
      };
    },
    mounted() {
    },
    methods: {
      fillBtn: function() {
        let jsondata = {}
        if (this.index == 0) {
          if (!this.personname) {
            this.showToast = true;
            this.showVal = "请填写个人发票抬头名称";
            return false;
          }
          if (!this.personemail) {
            this.showToast = true;
            this.showVal = "请填写个人发票邮箱";
            return false;
          }
          let obj = {
            invoiceType: "0",//  0 :个人  , 1:企业   ,3:非营业单位
            name: this.personname,
            email: this.personemail,
            remark: this.personremark,
            isDefault: "1"
          };
          jsondata = Object.assign(obj,this.$utils.commonParams())
        }
        if (this.index == 1) {
          if (!this.name) {
            this.showToast = true;
            this.showVal = "请填写企业发票抬头名称";
            return false;
          }
          if (!this.email) {
            this.showToast = true;
            this.showVal = "请填写个人发票邮箱";
            return false;
          }
          if (!this.num) {
            this.showToast = true;
            this.showVal = "请填写企业纳税人识别号";
            return false;
          }
          let obj = {
            invoiceType: "1",//  0 :个人  , 1:企业   ,3:非营业单位
            name: this.name,
            email: this.email,
            remark: this.remark,
            isDefault: "1",
            phone: this.iphone,//企业注册电话
            address: this.address,//企业注册地址
            phone: this.iphone,//企业注册电话
            taxid: this.num,//企业纳税人识别号
            bankName: this.bankName,
            cardNo: this.bankNum
          };
          jsondata = Object.assign(obj,this.$utils.commonParams())
        }
        jsondata.sign = this.$utils.signObject(jsondata);
        insertCustInvoiceInfo(jsondata).then(response => {
          console.log(jsondata);
          console.log(response);
          if(response.code == 0){
            this.$router.push({
              path: "invoiceOpt"
            });
          }else{
            alert(response.message)
          }
  
        });
      }
    }
  };
  </script>
  
  <style scoped>
  
  </style>