sellerInvoice.vue 16 KB

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