issueInvoice.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view>
  3. <ujp-navbar title="开具发票">
  4. <text class="explain" @click="gotoUrl('pages/article/details?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.toFixed(2)}}元</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('pages/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.toFixed(2)}}元
  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. };
  90. },
  91. onShow() {
  92. this.getInfo()
  93. },
  94. onLoad(op) {
  95. if(op.ids){
  96. this.ids=op.ids;
  97. //this.getInfo()
  98. }
  99. },
  100. methods: {
  101. confirm(){
  102. uni.showLoading({
  103. title: "加载中",
  104. mask: true,
  105. })
  106. API.saveInvoice({
  107. recordIds:this.ids,
  108. invoiceTypeId:this.selectObj.id
  109. }).then((res) => {
  110. uni.hideLoading()
  111. uni.redirectTo({
  112. url:"/pages/MyInvoice/invioceResult"
  113. })
  114. }).catch(error => {
  115. uni.showToast({
  116. title: error,
  117. icon: "none"
  118. })
  119. })
  120. },
  121. getInfo(){
  122. uni.showLoading({
  123. title: "加载中",
  124. mask: true,
  125. })
  126. API.invoiceTypeDefalut({
  127. recordIds:this.ids
  128. }).then((res) => {
  129. uni.hideLoading()
  130. this.selectObj=res.data.invoiceType
  131. if(!res.data.invoiceType){
  132. this.selectObj={}
  133. this.uuid=new Date().getTime();
  134. }else{
  135. var obj=this.carhelp.get("issueInvoice");
  136. if(obj){
  137. if(obj.uuid==this.uuid){
  138. if(obj.selectObj.id){
  139. this.selectObj=obj.selectObj;
  140. }
  141. }
  142. }
  143. }
  144. this.selectObj.totalPrice=res.data.totalPrice;
  145. this.obj=res.data
  146. this.uuid=new Date().getTime();
  147. this.carhelp.set("issueInvoice",{
  148. uuid:this.uuid,
  149. selectObj:this.selectObj
  150. })
  151. }).catch(error => {
  152. uni.showToast({
  153. title: error,
  154. icon: "none"
  155. })
  156. })
  157. },
  158. // 选中某个单选框时,由radio时触发
  159. radioChange(e) {
  160. // console.log(e);
  161. },
  162. // 选中任一radio时,由radio-group触发
  163. radioGroupChange(e) {
  164. // console.log(e);
  165. },
  166. open() {
  167. if(this.selectObj.id){
  168. this.show = true;
  169. }
  170. else{
  171. uni.showToast({
  172. title:"请选择发票"
  173. })
  174. }
  175. }
  176. }
  177. };
  178. </script>
  179. <style lang="scss">
  180. page {
  181. background-color: #fff;
  182. }
  183. .explain {
  184. position: absolute;
  185. right: 16px;
  186. color: rgba(51, 51, 51, 100);
  187. font-size: 12px
  188. }
  189. .invioice-info {
  190. padding: 20px 16px;
  191. .title {
  192. font-size: 16px;
  193. color: #101010;
  194. margin-bottom: 16px;
  195. }
  196. }
  197. ::v-deep .u-cell__value {
  198. text-align: left;
  199. margin-left: 41px;
  200. font-size: 16px
  201. }
  202. ::v-deep .u-cell {
  203. padding: 16px 0;
  204. }
  205. .submit {
  206. width: 91.4%;
  207. margin: 12px auto;
  208. position: fixed;
  209. bottom: 0;
  210. left: 0;
  211. right: 0;
  212. }
  213. // 弹窗
  214. .modal {
  215. background-color: #101010;
  216. .title {
  217. line-height: 20px;
  218. padding: 18px 52px;
  219. background-image: linear-gradient(rgb(0, 217, 115), #00A457);
  220. color: #fff;
  221. text-align: center;
  222. }
  223. .infos {
  224. padding: 20px 14px;
  225. .item {
  226. line-height: 28px;
  227. display: flex;
  228. justify-content: space-between;
  229. color: #666666;
  230. font-size: 16px
  231. }
  232. .hint {
  233. color: rgba(238, 49, 56, 100);
  234. margin-top: 16px;
  235. font-size: 14px
  236. }
  237. }
  238. }
  239. </style>