sellerInvoice.vue 15 KB

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