sellerInvoice.vue 15 KB

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