sellerInvoice.vue 15 KB

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