sellerInvoice.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template name="invoice">
  2. <view class="invoice-template">
  3. <!-- 发票信息 -->
  4. <view class="invoice-title" @tap.stop="hanldOperationConfim">
  5. <text class="text">发票信息</text>
  6. <view class="invoice-right">
  7. <text class="text-l">{{invoiceText}}</text>
  8. <text class="iconfont icon-xiayibu"></text>
  9. </view>
  10. </view>
  11. <!-- <view class="invoice-text">
  12. <text>{{invoiceText}}</text>
  13. </view> -->
  14. <!--底部选择模态层弹窗组件 -->
  15. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="choiceaInvoiceConfim">
  16. <!-- 遮罩层 -->
  17. <view class="mask"></view>
  18. <view class="layer" @tap.stop="discard">
  19. <view class="content clearfix">
  20. <view class="invoice-ltitle">发票类型</view>
  21. <view class="invoice-radio">
  22. <radio-group class="row-group" @change="radioChange">
  23. <label class="row-input" v-for="(item, index) in invoiceTypeList" :key="item.value">
  24. <radio class="row-radio" :value="item.value" :checked="index === current" color="#FF5B00"/>
  25. <view class="row-text">{{item.name}}</view>
  26. </label>
  27. </radio-group>
  28. </view>
  29. <view class="invoice-main from" v-if="invoiceType == '2'">
  30. <view class="invoice-from">
  31. <view class="label">单位名称:</view>
  32. <input class="form-input" type="text" v-model="invoiceData.invoiceTitle" placeholder="请填写单位信息(必填)" placeholder-class="placeholder" maxlength="24">
  33. </view>
  34. <view class="invoice-from">
  35. <view class="label">纳税人识别号:</view>
  36. <input class="form-input" type="text" v-model="invoiceData.corporationTaxNum" placeholder="请填写纳税人识别号(必填)" placeholder-class="placeholder" maxlength="24">
  37. </view>
  38. <view class="invoice-from">
  39. <view class="label">注册地址:</view>
  40. <input class="form-input" type="text" v-model="invoiceData.registeredAddress" placeholder="请填写单位注册地址(必填)" placeholder-class="placeholder" maxlength="100">
  41. </view>
  42. <view class="invoice-from">
  43. <view class="label">注册电话:</view>
  44. <input class="form-input" type="text" v-model="invoiceData.registeredPhone" placeholder="请填写注册电话(必填)" placeholder-class="placeholder" maxlength="15">
  45. </view>
  46. <view class="invoice-from">
  47. <view class="label">开户银行:</view>
  48. <input class="form-input" type="text" v-model="invoiceData.openBank" placeholder="请填写开户银行(必填)" placeholder-class="placeholder" maxlength="30">
  49. </view>
  50. <view class="invoice-from">
  51. <view class="label">银行账号:</view>
  52. <input class="form-input"
  53. type="text"
  54. v-model="invoiceData.bankAccountNo"
  55. placeholder="请填写银行账号(必填)"
  56. maxlength="30"
  57. placeholder-class="placeholder">
  58. </view>
  59. </view>
  60. <view class="invoice-main" v-if="invoiceType == '3'">
  61. <view class="invoice-ltitle">发票内容</view>
  62. <view class="invoice-group tit">
  63. <checkbox-group class="row-group" @change="checkboxChange">
  64. <view class="text">商品明细</view>
  65. <checkbox class="row-radio" value="明细" :checked="inventoryChecked" color="#FF5B00"></checkbox>
  66. </checkbox-group>
  67. </view>
  68. <view class="invoice-ltitle">发票抬头</view>
  69. <view class="invoice-group tit">
  70. <radio-group class="row-group radio" @change="radioChangeTitle">
  71. <label class="row-input" v-for="(item, index) in invoiceTitleList" :key="item.value">
  72. <radio class="row-radio" :value="item.value" :checked="index === titleCurrent" color="#FF5B00"/>
  73. <view class="row-text">{{item.name}}</view>
  74. </label>
  75. </radio-group>
  76. </view>
  77. <view class="invoice-group from">
  78. <view class="group-from" v-if="peopleInvoiceData.invoiceTitleType == '0'">
  79. <input class="form-input" type="text" v-model="peopleInvoiceData.invoiceTitle" placeholder="请填写个人抬头" placeholder-class="placeholder" maxlength="20">
  80. </view>
  81. <view class="group-from" v-if="peopleInvoiceData.invoiceTitleType == '1'">
  82. <input class="form-input" type="text" v-model="peopleInvoiceData.invoiceTitle" placeholder="请填写公司抬头" placeholder-class="placeholder" maxlength="20">
  83. </view>
  84. <view class="group-from" v-if="peopleInvoiceData.invoiceTitleType == '1'">
  85. <input class="form-input" type="text" v-model="peopleInvoiceData.corporationTaxNum" placeholder="请填写纳税人识别号" placeholder-class="placeholder" maxlength="20">
  86. </view>
  87. </view>
  88. </view>
  89. <view class="invoice-main" v-if="invoiceType == '1'">
  90. <view class="invoice-none">不开具发票信息</view>
  91. </view>
  92. </view>
  93. <view class="btn">
  94. <view class="button add" @click="choiceaInvoiceConfim">完成</view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. export default{
  102. name:'invoice',
  103. data() {
  104. return{
  105. invoiceText:'不要发票',
  106. specClass: '',//规格弹窗css类,控制开关动画
  107. invoiceType:'1',//发票类型
  108. current:0,
  109. titleCurrent:0,
  110. inventoryChecked:false,
  111. invoiceTypeList:[
  112. {value:'1',name:'不要发票'},
  113. {value:'2',name:'增值税发票'},
  114. ],
  115. invoiceTitleList:[
  116. {value:'0',name:'个人'},
  117. {value:'1',name:'公司'},
  118. ],
  119. peopleInvoiceData:{
  120. invoiceTitle:'',
  121. invoiceContent:'',
  122. corporationTaxNum:'',
  123. invoiceTitleType:'0'//发票抬头类型 1企业 0个人
  124. },
  125. invoiceData:{
  126. invoiceTitle:'', //单位名称
  127. corporationTaxNum:'',//纳税人识别号
  128. registeredAddress: '',//单位地址
  129. registeredPhone:'', //注册电话
  130. openBank:'', //开户银行
  131. bankAccountNo: '' ,//银行账号
  132. },
  133. }
  134. },
  135. created(){
  136. // this.initData(this.invoiceDatas)
  137. },
  138. computed: {
  139. },
  140. methods:{
  141. getUseFindInvoice(){//获取发票信息
  142. this.$api.getComStorage('orderUserInfo').then((resolve) =>{
  143. this.OrderService.GetFindInvoice({userId:resolve.userId}).then(response =>{
  144. if(response.data == null){
  145. this.invoiceData = Object.assign(this.invoiceData,'',{type:0})
  146. }else{
  147. this.invoiceData = response.data
  148. }
  149. })
  150. })
  151. },
  152. updateInvoiceFn(){//保存发票信息
  153. this.$api.getComStorage('orderUserInfo').then((resolve) =>{
  154. let params =Object.assign(this.invoiceData,'',{userId:resolve.userId})
  155. this.OrderService.UpdateInvoice(params).then(response =>{})
  156. })
  157. },
  158. choiceaInvoiceConfim(){
  159. switch(this.invoiceType){
  160. case '1':
  161. this.choiceaInvoiceThree()
  162. this.invoiceText = '不要发票'
  163. break
  164. // case '2':
  165. // this.choiceaInvoiceTwo()
  166. // this.invoiceText = this.peopleInvoiceData.invoiceTitle
  167. // break;
  168. case '2':
  169. this.choiceaInvoiceFirst()
  170. this.invoiceText = this.invoiceData.invoiceTitle
  171. break
  172. default:
  173. this.choiceaInvoiceThree()
  174. this.invoiceText = '不要发票'
  175. }
  176. },
  177. choiceaInvoiceFirst(){//增值税发票
  178. if(this.invoiceData.invoiceTitle == ''){
  179. this.$util.msg('请输入单位名称',2000)
  180. return
  181. }
  182. if(this.invoiceData.corporationTaxNum == ''){
  183. this.$util.msg('请输入纳税人识别号',2000)
  184. return
  185. }
  186. if(this.invoiceData.registeredAddress == ''){
  187. this.$util.msg('请输入单位地址',2000)
  188. return
  189. }
  190. if(this.invoiceData.registeredPhone == ''){
  191. this.$util.msg('请输入注册电话',2000)
  192. return
  193. }
  194. if(this.invoiceData.openBank == ''){
  195. this.$util.msg('请输入开户银行',2000)
  196. return
  197. }
  198. if(this.invoiceData.bankAccountNo == ''){
  199. this.$util.msg('请输入银行账号',2000)
  200. return
  201. }
  202. this.updateInvoiceFn()
  203. this.$emit('handleChoiceaInvoice',Object.assign(this.invoiceData,'',{type:2}))
  204. this.hideSpec()
  205. },
  206. choiceaInvoiceTwo(){//普通发票
  207. switch(this.peopleInvoiceData.invoiceTitleType){
  208. case '0':
  209. if(this.peopleInvoiceData.invoiceContent == ''){
  210. this.$util.msg('请选择商品明细',2000)
  211. return
  212. }
  213. if(this.peopleInvoiceData.invoiceTitle == ''){
  214. this.$util.msg('请输入个人抬头',2000)
  215. return
  216. }
  217. break
  218. case '1':
  219. if(this.peopleInvoiceData.invoiceContent == ''){
  220. this.$util.msg('请选择商品明细',2000)
  221. return
  222. }
  223. if(this.peopleInvoiceData.invoiceTitle == ''){
  224. this.$util.msg('请输入公司抬头',2000)
  225. return
  226. }
  227. if(this.peopleInvoiceData.corporationTaxNum == ''){
  228. this.$util.msg('请输入纳税人识别号',2000)
  229. return
  230. }
  231. break
  232. }
  233. this.$emit('handleChoiceaInvoice',Object.assign(this.peopleInvoiceData,'',{type:1}))
  234. this.hideSpec()
  235. },
  236. choiceaInvoiceThree(){//不要发票
  237. this.invoiceData = {}
  238. this.$emit('handleChoiceaInvoice',Object.assign(this.invoiceData,'',{type:0}))
  239. this.hideSpec()
  240. },
  241. hideSpec() {//关闭弹窗
  242. this.specClass = 'hide'
  243. setTimeout(() => {
  244. this.specClass = 'none'
  245. }, 200)
  246. },
  247. hanldOperationConfim(){//显示发票弹窗
  248. this.specClass = 'show'
  249. },
  250. radioChange(e) {
  251. this.invoiceType = e.target.value
  252. for (let i = 0; i < this.invoiceTypeList.length; i++) {
  253. if (this.invoiceTypeList[i].value === this.invoiceType) {
  254. this.current = i
  255. break
  256. }
  257. }
  258. switch(this.invoiceType){
  259. case '2':
  260. this.getUseFindInvoice()
  261. break
  262. }
  263. },
  264. radioChangeTitle(e) {
  265. this.peopleInvoiceData.invoiceTitleType = e.target.value
  266. for (let i = 0; i < this.invoiceTitleList.length; i++) {
  267. if (this.invoiceTitleList[i].value === this.peopleInvoiceData.invoiceTitleType) {
  268. this.titleCurrent = i
  269. break
  270. }
  271. }
  272. switch(this.peopleInvoiceData.invoiceTitleType){
  273. case '1':
  274. this.inventoryChecked = false
  275. this.peopleInvoiceData.invoiceTitle = ''
  276. this.peopleInvoiceData.invoiceContent = ''
  277. break
  278. }
  279. },
  280. checkboxChange(e){
  281. this.inventoryChecked = !this.inventoryChecked
  282. this.peopleInvoiceData.invoiceContent = e.detail.value[0]
  283. },
  284. inputBankNum(val) {
  285. if (/\S{5}/.test(val)) {
  286. this.invoiceData.bankAccountNo = val.replace(/\s/g, '').replace(/(.{4})/g, '$1 ')
  287. }
  288. },
  289. discard(){
  290. //丢弃
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="scss">
  296. .invoice-template{
  297. width: 100%;
  298. height: auto;
  299. background: #FFFFFF;
  300. float: left;
  301. .invoice-title{
  302. width: 702rpx;
  303. padding: 0 24rpx;
  304. height: 88rpx;
  305. line-height: 88rpx;
  306. position: relative;
  307. font-size: $font-size-28;
  308. font-weight: bold;
  309. border-bottom: 1px solid #EBEBEB;
  310. .text{
  311. font-size: $font-size-28;
  312. color: $text-color;
  313. font-weight: bold;
  314. }
  315. .invoice-right{
  316. float: right;
  317. color: #2A81FF;
  318. .text-l{
  319. margin-right: 40rpx;
  320. }
  321. .iconfont{
  322. width: 50rpx;
  323. height: 88rpx;
  324. line-height: 88rpx;
  325. color: #999999;
  326. display: block;
  327. position: absolute;
  328. right: 0;
  329. top: 0;
  330. }
  331. }
  332. }
  333. .invoice-text{
  334. width: 702rpx;
  335. padding: 0 24rpx;
  336. font-size: $font-size-24;
  337. color: #666666;
  338. line-height: 60rpx;
  339. }
  340. .invoice-ltitle{
  341. width: 100%;
  342. line-height: 60rpx;
  343. height: 60rpx;
  344. font-size: $font-size-28;
  345. color: #333333;
  346. }
  347. .invoice-radio{
  348. width: 100%;
  349. height: 88rpx;
  350. line-height: 88rpx;
  351. display: flex;
  352. border-bottom: 1px solid #EBEBEB;
  353. .row-group{
  354. flex:1;
  355. display: flex;
  356. }
  357. .row-input{
  358. flex: 1;
  359. height: 88rpx;
  360. line-height: 88rpx;
  361. }
  362. .row-radio{
  363. float: left;
  364. transform: scale(0.6);
  365. }
  366. .row-text{
  367. font-size: $font-size-24;
  368. color: $text-color;
  369. }
  370. }
  371. .invoice-main{
  372. width: 100%;
  373. height: auto;
  374. margin-top: 30rpx;
  375. &.from{
  376. padding-bottom: 40rpx;
  377. }
  378. .invoice-none{
  379. line-height: 60rpx;
  380. height: 60rpx;
  381. font-size: $font-size-24;
  382. color: #666666;
  383. text-align: center;
  384. }
  385. .invoice-from{
  386. width: 662rpx;
  387. height: 40rpx;
  388. padding: 20rpx;
  389. line-height: 40rpx;
  390. align-items: flex-start;
  391. font-size: $font-size-28;
  392. color: $text-color;
  393. // background: #F7F7F7;
  394. // border-radius: 14rpx;
  395. margin-bottom: 20rpx;
  396. border-bottom: 2rpx solid #e1e1e1;
  397. .label{
  398. height: 40rpx;
  399. line-height: 40rpx;
  400. float: left;
  401. }
  402. .form-input{
  403. height: 40rpx;
  404. line-height: 40rpx;
  405. flex-grow: 1;
  406. padding-left: 20rpx;
  407. }
  408. }
  409. .invoice-group{
  410. width: 100%;
  411. height: 88rpx;
  412. display: flex;
  413. border-bottom: 1px solid #EBEBEB;
  414. &.tit{
  415. margin-bottom: 30rpx;
  416. }
  417. &.from{
  418. margin-bottom: 30rpx;
  419. border-bottom: 1px solid #FFFFFF;
  420. flex-direction: row;
  421. display: block;
  422. .group-from{
  423. flex: 1;
  424. height: 40rpx;
  425. padding: 20rpx;
  426. line-height: 40rpx;
  427. align-items: flex-start;
  428. font-size: $font-size-24;
  429. color: $text-color;
  430. background: #F7F7F7;
  431. border-radius: 14rpx;
  432. margin-bottom: 20rpx;
  433. .form-input{
  434. height: 40rpx;
  435. line-height: 40rpx;
  436. flex-grow: 1;
  437. }
  438. }
  439. }
  440. .row-group{
  441. line-height: 88rpx;
  442. flex: 1;
  443. .text{
  444. font-size: $font-size-24;
  445. color: $text-color;
  446. line-height: 88rpx;
  447. float: left;
  448. }
  449. .row-radio{
  450. float: right;
  451. transform: scale(0.8);
  452. border-radius: 50%;
  453. }
  454. &.radio{
  455. display: flex;
  456. .row-input{
  457. flex: 1;
  458. height: 88rpx;
  459. line-height: 88rpx;
  460. }
  461. .row-radio{
  462. float: left;
  463. transform: scale(0.6);
  464. }
  465. .row-text{
  466. font-size: $font-size-24;
  467. color: $text-color;
  468. }
  469. }
  470. }
  471. }
  472. }
  473. }
  474. /* 加入购物模态层*/
  475. @keyframes showPopup {
  476. 0% {
  477. opacity: 0;
  478. }
  479. 100% {
  480. opacity: 1;
  481. }
  482. }
  483. @keyframes hidePopup {
  484. 0% {
  485. opacity: 1;
  486. }
  487. 100% {
  488. opacity: 0;
  489. }
  490. }
  491. @keyframes showLayer {
  492. 0% {
  493. transform: translateY(0);
  494. }
  495. 100% {
  496. transform: translateY(-100%);
  497. }
  498. }
  499. @keyframes hideLayer {
  500. 0% {
  501. transform: translateY(-100%);
  502. }
  503. 100% {
  504. transform: translateY(0);
  505. }
  506. }
  507. @keyframes showAmnation {
  508. 0% {
  509. top: -12rpx;
  510. opacity: 0;
  511. }
  512. 50% {
  513. top: -60rpx;
  514. opacity: 1;
  515. }
  516. 100% {
  517. top: -100rpx;
  518. opacity: 0;
  519. }
  520. }
  521. @keyframes hideAmnation {
  522. 0% {
  523. top: -100rpx;
  524. opacity: 0;
  525. }
  526. 100% {
  527. top: -12rpx;
  528. opacity: 0;
  529. }
  530. }
  531. .popup {
  532. position: fixed;
  533. top: 0;
  534. width: 100%;
  535. height: 100%;
  536. z-index: 999;
  537. display: none;
  538. .mask{
  539. position: fixed;
  540. top: 0;
  541. width: 100%;
  542. height: 100%;
  543. z-index: 21;
  544. background-color: rgba(0, 0, 0, 0.6);
  545. }
  546. .layer {
  547. position: absolute;
  548. z-index: 22;
  549. bottom: -1010rpx;
  550. width: 702rpx;
  551. padding: 24rpx 24rpx 65rpx 24rpx;
  552. height: 920rpx;
  553. border-radius: 20rpx 20rpx 0 0;
  554. background-color: #fff;
  555. display: flex;
  556. flex-wrap: wrap;
  557. align-content: space-between;
  558. .content {
  559. width: 100%;
  560. }
  561. .btn {
  562. width: 100%;
  563. height: 88rpx;
  564. display: flex;
  565. .button {
  566. width: 702rpx;
  567. height: 88rpx;
  568. color: #fff;
  569. display: flex;
  570. align-items: center;
  571. justify-content: center;
  572. font-size: $font-size-28;
  573. border-radius: 44rpx;
  574. background: $btn-confirm;
  575. }
  576. }
  577. }
  578. &.show {
  579. display: block;
  580. .mask{
  581. animation: showPopup 0.2s linear both;
  582. }
  583. .layer {
  584. animation: showLayer 0.2s linear both;
  585. }
  586. }
  587. &.hide {
  588. display: block;
  589. .mask{
  590. animation: hidePopup 0.2s linear both;
  591. }
  592. .layer {
  593. animation: hideLayer 0.2s linear both;
  594. }
  595. }
  596. &.none {
  597. display: none;
  598. }
  599. &.service {
  600. .row {
  601. margin: 30upx 0;
  602. .title {
  603. font-size: 30upx;
  604. margin: 10upx 0;
  605. }
  606. .description {
  607. font-size: 28upx;
  608. color: #999;
  609. }
  610. }
  611. }
  612. .layer-smimg{
  613. width: 114rpx;
  614. height: 114rpx;
  615. float: left;
  616. border-radius: 10rpx;
  617. margin-right: 24rpx;
  618. image{
  619. width: 114rpx;
  620. height: 114rpx;
  621. border-radius: 10rpx;
  622. }
  623. }
  624. .layer-nunbox{
  625. justify-content: space-between;
  626. align-items: center;
  627. width: 536rpx;
  628. height: 88rpx;
  629. padding: 13rpx 0 0 0;
  630. float: left;
  631. .layer-nunbox-t{
  632. width: 100%;
  633. height:44rpx;
  634. position:relative;
  635. display: flex;
  636. .layer-nunbox-text{
  637. line-height: 44rpx;
  638. font-size: $font-size-28;
  639. }
  640. .number-box{
  641. display: flex;
  642. justify-content: center;
  643. align-items: center;
  644. .iconfont{
  645. font-size: $font-size-32;
  646. padding:0 18rpx;
  647. font-size: $text-color;
  648. }
  649. .btn-input{
  650. width: 62rpx;
  651. height: 48rpx;
  652. line-height: 48rpx;
  653. background: #F8F8F8;
  654. border-radius: 4rpx;
  655. text-align: center;
  656. font-size: $font-size-28;
  657. }
  658. }
  659. .product-step{
  660. position: absolute;
  661. left: 45rpx;
  662. bottom: 0;
  663. height: 44rpx;
  664. background: #FFFFFF;
  665. }
  666. }
  667. .layer-nunbox-b{
  668. width: 100%;
  669. height:44rpx;
  670. margin-top: 13rpx;
  671. }
  672. .text{
  673. line-height: 44rpx;
  674. font-size: $font-size-28;
  675. .p{
  676. color: #FF2A2A;
  677. }
  678. .p:first-child{
  679. margin-left: 30rpx;
  680. }
  681. .p.sm{
  682. font-size: $font-size-24;
  683. }
  684. }
  685. }
  686. }
  687. .placeholder{
  688. color: #b2b2b2;
  689. }
  690. </style>