apply.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view>
  3. <view class="form">
  4. <view class="li ddflex">
  5. <label class="label">发票类型</label>
  6. <view class="item fflex">
  7. 电子发票
  8. </view>
  9. </view>
  10. <view class="li ddflex">
  11. <label class="label">发票金额</label>
  12. <view class="item fflex">
  13. ¥{{options.money}}
  14. </view>
  15. </view>
  16. <view class="li ddflex">
  17. <label class="label">开票方式</label>
  18. <view class="item fflex ddflex">
  19. <view class="lis ddflex" v-for="(item,index) in mode" :key="index" @click="modeClick(index)"><image :src="'../static/images/' + (modeIndex == index ? 'radio_h' : 'radio') +'.png'" class="radio"></image>{{item.label}}</view>
  20. </view>
  21. </view>
  22. <view class="li ddflex">
  23. <label class="label">发票抬头</label>
  24. <view class="item fflex ddflex">
  25. <view class="lis ddflex" v-for="(item,index) in headerType" :key="index" @click="headerTypeClick(index)"><image :src="'../static/images/' + (headerTypeIndex == index ? 'radio_h' : 'radio') +'.png'" class="radio"></image>{{item.label}}</view>
  26. </view>
  27. </view>
  28. <view class="li ddflex" v-if="headerTypeIndex == 0">
  29. <label class="label">电子邮箱</label>
  30. <view class="item fflex">
  31. <input v-model="options.email" placeholder="(必填)" placeholder-class="placeholder" class="ipt" />
  32. </view>
  33. </view>
  34. <block v-else>
  35. <view class="daoru ddflex" @click="daoru()"><image src="../static/images/dao.png"></image>一键导入微信发票助手抬头</view>
  36. <view class="li ddflex">
  37. <label class="label">公司抬头</label>
  38. <view class="item fflex">
  39. <input v-model="options.title" placeholder="请输入抬头名称" placeholder-class="placeholder" class="ipt" />
  40. </view>
  41. </view>
  42. <view class="li ddflex">
  43. <label class="label">税号</label>
  44. <view class="item fflex">
  45. <input v-model="options.duty" placeholder="请输入纳税人识别号" placeholder-class="placeholder" class="ipt" />
  46. </view>
  47. </view>
  48. <view class="li ddflex">
  49. <label class="label">邮箱地址</label>
  50. <view class="item fflex">
  51. <input v-model="options.email" placeholder="请输入" placeholder-class="placeholder" class="ipt" />
  52. </view>
  53. </view>
  54. <block v-if="isOther">
  55. <view class="li ddflex">
  56. <label class="label">注册地址</label>
  57. <view class="item fflex">
  58. <input v-model="options.address" placeholder="(选填)" placeholder-class="placeholder" class="ipt" />
  59. </view>
  60. </view>
  61. <view class="li ddflex">
  62. <label class="label">注册电话</label>
  63. <view class="item fflex">
  64. <input v-model="options.phone" placeholder="(选填)" placeholder-class="placeholder" class="ipt" />
  65. </view>
  66. </view>
  67. <view class="li ddflex">
  68. <label class="label">开户银行</label>
  69. <view class="item fflex">
  70. <input v-model="options.bank" placeholder="(选填)" placeholder-class="placeholder" class="ipt" />
  71. </view>
  72. </view>
  73. <view class="li ddflex">
  74. <label class="label">银行账户</label>
  75. <view class="item fflex">
  76. <input v-model="options.bankNo" placeholder="(选填)" placeholder-class="placeholder" class="ipt" />
  77. </view>
  78. </view>
  79. </block>
  80. <view class="more ddflex" @click="other()">其他发票信息<image :src="'../static/images/' + (isOther ? 'bico_h':'bico') +'.png'"></image></view>
  81. </block>
  82. </view>
  83. <view class="tip">
  84. <view class="tits">温馨提示:</view>
  85. <view>应国家税务总局要求,您若开具增值税普通发票,须同时提供企业抬头及纳税人识别号,否则发票将无法用于企业报销</view>
  86. </view>
  87. <view class="btn" @click="apply()">申请开票</view>
  88. </view>
  89. </template>
  90. <script>
  91. const req = require('../../utils/request.js');
  92. export default {
  93. data() {
  94. return{
  95. options: {},
  96. title: '',
  97. mode:[
  98. {
  99. label: '商品类别',
  100. value: 1
  101. },
  102. {
  103. label: '商品明细',
  104. value: 2
  105. }
  106. ],
  107. modeIndex: 0,
  108. headerType:[
  109. {
  110. label: '个人',
  111. value: 1
  112. },
  113. {
  114. label: '单位',
  115. value: 2
  116. }
  117. ],
  118. headerTypeIndex: 0,
  119. isOther: false
  120. }
  121. },
  122. onLoad(options) {
  123. this.options = options
  124. },
  125. methods:{
  126. modeClick(index){
  127. this.modeIndex = index;
  128. },
  129. headerTypeClick(index){
  130. this.headerTypeIndex = index;
  131. },
  132. other(){
  133. if(this.isOther){
  134. this.isOther = false;
  135. }else{
  136. this.isOther = true;
  137. }
  138. },
  139. daoru(){
  140. let that = this;
  141. uni.chooseInvoiceTitle({
  142. success(res){
  143. console.log(res)
  144. that.title = res.title;
  145. that.options.title = res.title;
  146. that.options.duty = res.taxNumber;
  147. that.options.address = res.companyAddress;
  148. that.options.phone = res.telephone;
  149. that.options.bank = res.bankName;
  150. that.options.bankNo = res.bankAccount;
  151. }
  152. })
  153. },
  154. apply(){
  155. let params = this.options;
  156. if(this.headerTypeIndex == 1){
  157. if(!params.title) return req.msg('请输入公司抬头');
  158. if(!params.duty) return req.msg('请输入纳税人识别号');
  159. }
  160. if(!params.email) return req.msg('请输入邮箱地址');
  161. if(params.email){
  162. var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
  163. if(!re.test(params.email)) return req.msg('请输入正确的邮箱地址');
  164. }
  165. params.mode = this.mode[this.modeIndex].value;
  166. params.headerType = this.headerType[this.headerTypeIndex].value;
  167. req.postRequest('/api/invoice/insert',params,res=>{
  168. uni.redirectTo({
  169. url: '/invoice/detail/detail?id=' + res
  170. })
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style>
  177. @import "./apply.css";
  178. </style>