issueInvoice.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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" v-if="obj.totalPrice" type="success" @click="open" shape="circle">提交</u-button>
  67. <u-button class="submit" v-else type="info" shape="circle" @click="back">金额为0,点击返回编辑</u-button>
  68. </view>
  69. </template>
  70. <script>
  71. import * as API from '@/apis/invoiceApi.js'
  72. export default {
  73. data() {
  74. return {
  75. ids:"",
  76. uuid:"",
  77. list: [{
  78. name: '企业单位',
  79. disabled: false
  80. },
  81. {
  82. name: '个人/非企业单位',
  83. disabled: false
  84. },
  85. ],
  86. value: '企业单位',
  87. show: false,
  88. selectObj:{},
  89. obj:{},
  90. id:"",
  91. saveAll:"",
  92. startDate:"",
  93. endDate:"",
  94. eventChannel:null,
  95. };
  96. },
  97. onShow() {
  98. this.getInfo()
  99. },
  100. onLoad(op) {
  101. if(op.id){
  102. this.id=op.id;
  103. }
  104. if(op.ids){
  105. this.ids=op.ids;
  106. }
  107. if(op.saveAll){
  108. this.saveAll=op.saveAll;
  109. }
  110. if(op.startDate){
  111. this.saveAll=1;
  112. this.startDate=op.startDate;
  113. this.endDate=op.endDate;
  114. }
  115. this.getInfo()
  116. },
  117. methods: {
  118. back(){
  119. uni.navigateBack({
  120. })
  121. },
  122. confirm(){
  123. uni.showLoading({
  124. title: "加载中",
  125. mask: true,
  126. })
  127. API.saveInvoice({
  128. entAccountId:this.id,
  129. recordIds:this.ids,
  130. saveAll:this.saveAll,
  131. invoiceTypeId:this.selectObj.id,
  132. startDate:this.startDate,
  133. endDate:this.endDate,
  134. }).then((res) => {
  135. try{
  136. var eventChannel = this.getOpenerEventChannel();
  137. eventChannel.emit('refreshData');
  138. }catch(e){
  139. //TODO handle the exception
  140. }
  141. uni.hideLoading()
  142. uni.redirectTo({
  143. url:"/pagesFinance/MyInvoice/invioceResult"
  144. })
  145. }).catch(error => {
  146. uni.showToast({
  147. title: error,
  148. icon: "none"
  149. })
  150. })
  151. },
  152. getInfo(){
  153. uni.showLoading({
  154. title: "加载中",
  155. mask: true,
  156. })
  157. API.invoiceTypeDefalut({
  158. entAccountId:this.id,
  159. recordIds:this.ids,
  160. saveAll:this.saveAll,
  161. startDate:this.startDate,
  162. endDate:this.endDate,
  163. }).then((res) => {
  164. uni.hideLoading()
  165. this.selectObj=res.data.invoiceType
  166. if(!res.data.invoiceType){
  167. this.selectObj={}
  168. this.uuid=new Date().getTime();
  169. }else{
  170. var obj=this.carhelp.get("issueInvoice");
  171. if(obj){
  172. if(obj.uuid==this.uuid){
  173. if(obj.selectObj.id){
  174. this.selectObj=obj.selectObj;
  175. }
  176. }
  177. }
  178. }
  179. this.selectObj.totalPrice=res.data.totalPrice;
  180. this.obj=res.data
  181. this.uuid=new Date().getTime();
  182. this.carhelp.set("issueInvoice",{
  183. uuid:this.uuid,
  184. selectObj:this.selectObj
  185. })
  186. }).catch(error => {
  187. uni.showToast({
  188. title: error,
  189. icon: "none"
  190. })
  191. })
  192. },
  193. // 选中某个单选框时,由radio时触发
  194. radioChange(e) {
  195. // console.log(e);
  196. },
  197. // 选中任一radio时,由radio-group触发
  198. radioGroupChange(e) {
  199. // console.log(e);
  200. },
  201. open() {
  202. if(this.selectObj.id){
  203. this.show = true;
  204. }
  205. else{
  206. uni.showToast({
  207. title:"请选择发票"
  208. })
  209. }
  210. }
  211. }
  212. };
  213. </script>
  214. <style lang="scss">
  215. page {
  216. background-color: #fff;
  217. }
  218. .explain {
  219. position: absolute;
  220. right: 16px;
  221. color: rgba(51, 51, 51, 100);
  222. font-size: 12px
  223. }
  224. .invioice-info {
  225. padding: 20px 16px;
  226. .title {
  227. font-size: 16px;
  228. color: #101010;
  229. margin-bottom: 16px;
  230. }
  231. }
  232. ::v-deep.u-cell__value {
  233. text-align: left;
  234. margin-left: 41px;
  235. font-size: 16px
  236. }
  237. ::v-deep.u-cell {
  238. padding: 16px 0;
  239. }
  240. .submit {
  241. width: 91.4%;
  242. margin: 12px auto;
  243. position: fixed;
  244. bottom: 0;
  245. left: 0;
  246. right: 0;
  247. }
  248. // 弹窗
  249. .modal {
  250. background-color: #101010;
  251. .title {
  252. line-height: 20px;
  253. padding: 18px 52px;
  254. background-image: linear-gradient(rgb(0, 217, 115), #00A457);
  255. color: #fff;
  256. text-align: center;
  257. }
  258. .infos {
  259. padding: 20px 14px;
  260. .item {
  261. line-height: 28px;
  262. display: flex;
  263. justify-content: space-between;
  264. color: #666666;
  265. font-size: 16px
  266. }
  267. .hint {
  268. color: rgba(238, 49, 56, 100);
  269. margin-top: 16px;
  270. font-size: 14px
  271. }
  272. }
  273. }
  274. </style>