issueInvoice.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. // uni.previewImage({
  168. // indicator:"number",
  169. // urls:[
  170. // "http://oss.xiaoxinda.com/smart/mobileBanner/2022/5/28/8ecb861b-e701-446c-b813-9452c2cfc771/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20220528094050.png"
  171. // ,"http://oss.xiaoxinda.com/smart/mobileBanner/2022/5/28/de95e339-b72a-4753-b2da-13f0ab233322/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20220528094058.png"
  172. // ],
  173. // longPressActions:true
  174. // })
  175. if(this.selectObj.id){
  176. this.show = true;
  177. }
  178. else{
  179. uni.showToast({
  180. title:"请选择发票"
  181. })
  182. }
  183. }
  184. }
  185. };
  186. </script>
  187. <style lang="scss">
  188. page {
  189. background-color: #fff;
  190. }
  191. .explain {
  192. position: absolute;
  193. right: 16px;
  194. color: rgba(51, 51, 51, 100);
  195. font-size: 12px
  196. }
  197. .invioice-info {
  198. padding: 20px 16px;
  199. .title {
  200. font-size: 16px;
  201. color: #101010;
  202. margin-bottom: 16px;
  203. }
  204. }
  205. /deep/.u-cell__value {
  206. text-align: left;
  207. margin-left: 41px;
  208. font-size: 16px
  209. }
  210. /deep/.u-cell {
  211. padding: 16px 0;
  212. }
  213. .submit {
  214. width: 91.4%;
  215. margin: 12px auto;
  216. position: fixed;
  217. bottom: 0;
  218. left: 0;
  219. right: 0;
  220. }
  221. // 弹窗
  222. .modal {
  223. background-color: #101010;
  224. .title {
  225. line-height: 20px;
  226. padding: 18px 52px;
  227. background-image: linear-gradient(rgb(0, 217, 115), #00A457);
  228. color: #fff;
  229. text-align: center;
  230. }
  231. .infos {
  232. padding: 20px 14px;
  233. .item {
  234. line-height: 28px;
  235. display: flex;
  236. justify-content: space-between;
  237. color: #666666;
  238. font-size: 16px
  239. }
  240. .hint {
  241. color: rgba(238, 49, 56, 100);
  242. margin-top: 16px;
  243. font-size: 14px
  244. }
  245. }
  246. }
  247. </style>