issueInvoice.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view>
  3. <ujp-navbar title="开具发票">
  4. <text class="explain" @click="gotoUrl('pagesFinance/news/index?code=KPSM')">开票说明</text>
  5. </ujp-navbar>
  6. <view class="invioice-info">
  7. <p class="title">发票信息</p>
  8. <u-cell-group>
  9. <u-cell-item title="发票金额" :arrow="false"> <text style="color:#ff3d00;">{{obj.totalPrice}}元</text></u-cell-item>
  10. <u-cell-item title="抬头类型" :arrow="false">
  11. <view v-if="!selectObj.title">请选择发票</view>
  12. <view v-else-if="selectObj.headerType==1">企业单位</view>
  13. <view v-else-if="selectObj.headerType==2">个人/非企业单位</view>
  14. </u-cell-item>
  15. <u-cell-item title="发票抬头" @click="gotoUrl('pagesFinance/MyInvoice/invoiceTitleManagement?invoice=1&uuid='+uuid)" :value="selectObj.title?selectObj.title:'请选择发票抬头'"></u-cell-item>
  16. <u-cell-item title="公司税号" :value="selectObj.title?(selectObj.companyTaxNo?selectObj.companyTaxNo:'--'):'自动读取对应抬头的公司税号'" :arrow="false"></u-cell-item>
  17. </u-cell-group>
  18. </view>
  19. <!-- 弹窗 -->
  20. <view class="modal">
  21. <u-modal v-model="show" :show-title="false" @confirm="confirm"
  22. :show-cancel-button="true" confirm-text="确认开具" cancel-text="返回修改">
  23. <view class="title">
  24. 发票开具成功后不可撤销
  25. 请您仔细核对开票信息
  26. </view>
  27. <view class="infos">
  28. <view class="item">
  29. <view class="name">
  30. 发票项目
  31. </view>
  32. <view class="content">
  33. 充电费发票
  34. </view>
  35. </view>
  36. <view class="item">
  37. <view class="name">
  38. 发票抬头
  39. </view>
  40. <view class="content">
  41. {{selectObj.title}}
  42. </view>
  43. </view>
  44. <view class="item">
  45. <view class="name">
  46. 公司税号
  47. </view>
  48. <view class="content">
  49. {{selectObj.companyTaxNo}}
  50. </view>
  51. </view>
  52. <view class="item">
  53. <view class="name">
  54. 发票金额
  55. </view>
  56. <view class="content">
  57. {{obj.totalPrice}}元
  58. </view>
  59. </view>
  60. <view class="hint">
  61. 发票开具后,可开票额度将按照实际开票金额相应扣减
  62. </view>
  63. </view>
  64. </u-modal>
  65. </view>
  66. <u-button class="submit" type="success" @click="open" shape="circle">提交</u-button>
  67. </view>
  68. </template>
  69. <script>
  70. import * as API from '@/apis/invoiceApi.js'
  71. export default {
  72. data() {
  73. return {
  74. ids:"",
  75. uuid:"",
  76. list: [{
  77. name: '企业单位',
  78. disabled: false
  79. },
  80. {
  81. name: '个人/非企业单位',
  82. disabled: false
  83. },
  84. ],
  85. value: '企业单位',
  86. show: false,
  87. selectObj:{},
  88. obj:{},
  89. id:"",
  90. saveAll:"",
  91. startDate:"",
  92. endDate:"",
  93. eventChannel:null,
  94. };
  95. },
  96. onShow() {
  97. this.getInfo()
  98. },
  99. onLoad(op) {
  100. if(op.id){
  101. this.id=op.id;
  102. }
  103. if(op.ids){
  104. this.ids=op.ids;
  105. }
  106. if(op.saveAll){
  107. this.saveAll=op.saveAll;
  108. }
  109. if(op.startDate){
  110. this.saveAll=1;
  111. this.startDate=op.startDate;
  112. this.endDate=op.endDate;
  113. }
  114. this.getInfo()
  115. },
  116. methods: {
  117. confirm(){
  118. uni.showLoading({
  119. title: "加载中",
  120. mask: true,
  121. })
  122. API.saveInvoice({
  123. entAccountId:this.id,
  124. recordIds:this.ids,
  125. saveAll:this.saveAll,
  126. invoiceTypeId:this.selectObj.id,
  127. startDate:this.startDate,
  128. endDate:this.endDate,
  129. }).then((res) => {
  130. try{
  131. var eventChannel = this.getOpenerEventChannel();
  132. eventChannel.emit('refreshData');
  133. }catch(e){
  134. //TODO handle the exception
  135. }
  136. uni.hideLoading()
  137. uni.redirectTo({
  138. url:"/pagesFinance/MyInvoice/invioceResult"
  139. })
  140. }).catch(error => {
  141. uni.showToast({
  142. title: error,
  143. icon: "none"
  144. })
  145. })
  146. },
  147. getInfo(){
  148. uni.showLoading({
  149. title: "加载中",
  150. mask: true,
  151. })
  152. API.invoiceTypeDefalut({
  153. entAccountId:this.id,
  154. recordIds:this.ids,
  155. saveAll:this.saveAll,
  156. startDate:this.startDate,
  157. endDate:this.endDate,
  158. }).then((res) => {
  159. uni.hideLoading()
  160. this.selectObj=res.data.invoiceType
  161. if(!res.data.invoiceType){
  162. this.selectObj={}
  163. this.uuid=new Date().getTime();
  164. }else{
  165. var obj=this.carhelp.get("issueInvoice");
  166. if(obj){
  167. if(obj.uuid==this.uuid){
  168. if(obj.selectObj.id){
  169. this.selectObj=obj.selectObj;
  170. }
  171. }
  172. }
  173. }
  174. this.selectObj.totalPrice=res.data.totalPrice;
  175. this.obj=res.data
  176. this.uuid=new Date().getTime();
  177. this.carhelp.set("issueInvoice",{
  178. uuid:this.uuid,
  179. selectObj:this.selectObj
  180. })
  181. }).catch(error => {
  182. uni.showToast({
  183. title: error,
  184. icon: "none"
  185. })
  186. })
  187. },
  188. // 选中某个单选框时,由radio时触发
  189. radioChange(e) {
  190. // console.log(e);
  191. },
  192. // 选中任一radio时,由radio-group触发
  193. radioGroupChange(e) {
  194. // console.log(e);
  195. },
  196. open() {
  197. if(this.selectObj.id){
  198. this.show = true;
  199. }
  200. else{
  201. uni.showToast({
  202. title:"请选择发票"
  203. })
  204. }
  205. }
  206. }
  207. };
  208. </script>
  209. <style lang="scss">
  210. page {
  211. background-color: #fff;
  212. }
  213. .explain {
  214. position: absolute;
  215. right: 16px;
  216. color: rgba(51, 51, 51, 100);
  217. font-size: 12px
  218. }
  219. .invioice-info {
  220. padding: 20px 16px;
  221. .title {
  222. font-size: 16px;
  223. color: #101010;
  224. margin-bottom: 16px;
  225. }
  226. }
  227. /deep/.u-cell__value {
  228. text-align: left;
  229. margin-left: 41px;
  230. font-size: 16px
  231. }
  232. /deep/.u-cell {
  233. padding: 16px 0;
  234. }
  235. .submit {
  236. width: 91.4%;
  237. margin: 12px auto;
  238. position: fixed;
  239. bottom: 0;
  240. left: 0;
  241. right: 0;
  242. }
  243. // 弹窗
  244. .modal {
  245. background-color: #101010;
  246. .title {
  247. line-height: 20px;
  248. padding: 18px 52px;
  249. background-image: linear-gradient(rgb(0, 217, 115), #00A457);
  250. color: #fff;
  251. text-align: center;
  252. }
  253. .infos {
  254. padding: 20px 14px;
  255. .item {
  256. line-height: 28px;
  257. display: flex;
  258. justify-content: space-between;
  259. color: #666666;
  260. font-size: 16px
  261. }
  262. .hint {
  263. color: rgba(238, 49, 56, 100);
  264. margin-top: 16px;
  265. font-size: 14px
  266. }
  267. }
  268. }
  269. </style>