sellerInvoice.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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-chakangengduo"></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="#191919"/>
  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="20">
  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="20">
  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="10">
  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="19"
  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="#E15616"></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="#E15616"/>
  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('clubInfo').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('clubInfo').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. margin-top: 24rpx;
  302. .invoice-title{
  303. width: 702rpx;
  304. padding: 0 24rpx;
  305. height: 88rpx;
  306. line-height: 88rpx;
  307. position: relative;
  308. font-size: $font-size-28;
  309. font-weight: bold;
  310. border-bottom: 1px solid #EBEBEB;
  311. .text{
  312. font-size: $font-size-28;
  313. color: $text-color;
  314. font-weight: bold;
  315. }
  316. .invoice-right{
  317. float: right;
  318. color: #2A81FF;
  319. .text-l{
  320. margin-right: 40rpx;
  321. }
  322. .iconfont{
  323. width: 50rpx;
  324. height: 88rpx;
  325. line-height: 88rpx;
  326. color: #999999;
  327. display: block;
  328. position: absolute;
  329. right: 0;
  330. top: 0;
  331. }
  332. }
  333. }
  334. .invoice-text{
  335. width: 702rpx;
  336. padding: 0 24rpx;
  337. font-size: $font-size-24;
  338. color: #666666;
  339. line-height: 60rpx;
  340. }
  341. .invoice-ltitle{
  342. width: 100%;
  343. line-height: 60rpx;
  344. height: 60rpx;
  345. font-size: $font-size-28;
  346. color: #333333;
  347. }
  348. .invoice-radio{
  349. width: 100%;
  350. height: 88rpx;
  351. line-height: 88rpx;
  352. display: flex;
  353. border-bottom: 1px solid #EBEBEB;
  354. .row-group{
  355. flex:1;
  356. display: flex;
  357. }
  358. .row-input{
  359. flex: 1;
  360. height: 88rpx;
  361. line-height: 88rpx;
  362. }
  363. .row-radio{
  364. float: left;
  365. transform: scale(0.6);
  366. }
  367. .row-text{
  368. font-size: $font-size-24;
  369. color: $text-color;
  370. }
  371. }
  372. .invoice-main{
  373. width: 100%;
  374. height: auto;
  375. margin-top: 30rpx;
  376. &.from{
  377. padding-bottom: 40rpx;
  378. }
  379. .invoice-none{
  380. line-height: 60rpx;
  381. height: 60rpx;
  382. font-size: $font-size-24;
  383. color: #666666;
  384. text-align: center;
  385. }
  386. .invoice-from{
  387. width: 662rpx;
  388. height: 40rpx;
  389. padding: 20rpx;
  390. line-height: 40rpx;
  391. align-items: flex-start;
  392. font-size: $font-size-28;
  393. color: $text-color;
  394. // background: #F7F7F7;
  395. // border-radius: 14rpx;
  396. margin-bottom: 20rpx;
  397. border-bottom: 2rpx solid #e1e1e1;
  398. .label{
  399. height: 40rpx;
  400. line-height: 40rpx;
  401. float: left;
  402. }
  403. .form-input{
  404. height: 40rpx;
  405. line-height: 40rpx;
  406. flex-grow: 1;
  407. padding-left: 20rpx;
  408. }
  409. }
  410. .invoice-group{
  411. width: 100%;
  412. height: 88rpx;
  413. display: flex;
  414. border-bottom: 1px solid #EBEBEB;
  415. &.tit{
  416. margin-bottom: 30rpx;
  417. }
  418. &.from{
  419. margin-bottom: 30rpx;
  420. border-bottom: 1px solid #FFFFFF;
  421. flex-direction: row;
  422. display: block;
  423. .group-from{
  424. flex: 1;
  425. height: 40rpx;
  426. padding: 20rpx;
  427. line-height: 40rpx;
  428. align-items: flex-start;
  429. font-size: $font-size-24;
  430. color: $text-color;
  431. background: #F7F7F7;
  432. border-radius: 14rpx;
  433. margin-bottom: 20rpx;
  434. .form-input{
  435. height: 40rpx;
  436. line-height: 40rpx;
  437. flex-grow: 1;
  438. }
  439. }
  440. }
  441. .row-group{
  442. line-height: 88rpx;
  443. flex: 1;
  444. .text{
  445. font-size: $font-size-24;
  446. color: $text-color;
  447. line-height: 88rpx;
  448. float: left;
  449. }
  450. .row-radio{
  451. float: right;
  452. transform: scale(0.8);
  453. border-radius: 50%;
  454. }
  455. &.radio{
  456. display: flex;
  457. .row-input{
  458. flex: 1;
  459. height: 88rpx;
  460. line-height: 88rpx;
  461. }
  462. .row-radio{
  463. float: left;
  464. transform: scale(0.6);
  465. }
  466. .row-text{
  467. font-size: $font-size-24;
  468. color: $text-color;
  469. }
  470. }
  471. }
  472. }
  473. }
  474. }
  475. /* 加入购物模态层*/
  476. @keyframes showPopup {
  477. 0% {
  478. opacity: 0;
  479. }
  480. 100% {
  481. opacity: 1;
  482. }
  483. }
  484. @keyframes hidePopup {
  485. 0% {
  486. opacity: 1;
  487. }
  488. 100% {
  489. opacity: 0;
  490. }
  491. }
  492. @keyframes showLayer {
  493. 0% {
  494. transform: translateY(0);
  495. }
  496. 100% {
  497. transform: translateY(-100%);
  498. }
  499. }
  500. @keyframes hideLayer {
  501. 0% {
  502. transform: translateY(-100%);
  503. }
  504. 100% {
  505. transform: translateY(0);
  506. }
  507. }
  508. @keyframes showAmnation {
  509. 0% {
  510. top: -12rpx;
  511. opacity: 0;
  512. }
  513. 50% {
  514. top: -60rpx;
  515. opacity: 1;
  516. }
  517. 100% {
  518. top: -100rpx;
  519. opacity: 0;
  520. }
  521. }
  522. @keyframes hideAmnation {
  523. 0% {
  524. top: -100rpx;
  525. opacity: 0;
  526. }
  527. 100% {
  528. top: -12rpx;
  529. opacity: 0;
  530. }
  531. }
  532. .popup {
  533. position: fixed;
  534. top: 0;
  535. width: 100%;
  536. height: 100%;
  537. z-index: 999;
  538. display: none;
  539. .mask{
  540. position: fixed;
  541. top: 0;
  542. width: 100%;
  543. height: 100%;
  544. z-index: 21;
  545. background-color: rgba(0, 0, 0, 0.6);
  546. }
  547. .layer {
  548. position: absolute;
  549. z-index: 22;
  550. bottom: -1010rpx;
  551. width: 702rpx;
  552. padding: 24rpx 24rpx 65rpx 24rpx;
  553. height: 920rpx;
  554. border-radius: 20rpx 20rpx 0 0;
  555. background-color: #fff;
  556. display: flex;
  557. flex-wrap: wrap;
  558. align-content: space-between;
  559. .content {
  560. width: 100%;
  561. }
  562. .btn {
  563. width: 100%;
  564. height: 88rpx;
  565. display: flex;
  566. .button {
  567. width: 702rpx;
  568. height: 88rpx;
  569. color: #fff;
  570. display: flex;
  571. align-items: center;
  572. justify-content: center;
  573. font-size: $font-size-28;
  574. border-radius: 44rpx;
  575. background: $btn-confirm;
  576. }
  577. }
  578. }
  579. &.show {
  580. display: block;
  581. .mask{
  582. animation: showPopup 0.2s linear both;
  583. }
  584. .layer {
  585. animation: showLayer 0.2s linear both;
  586. }
  587. }
  588. &.hide {
  589. display: block;
  590. .mask{
  591. animation: hidePopup 0.2s linear both;
  592. }
  593. .layer {
  594. animation: hideLayer 0.2s linear both;
  595. }
  596. }
  597. &.none {
  598. display: none;
  599. }
  600. &.service {
  601. .row {
  602. margin: 30upx 0;
  603. .title {
  604. font-size: 30upx;
  605. margin: 10upx 0;
  606. }
  607. .description {
  608. font-size: 28upx;
  609. color: #999;
  610. }
  611. }
  612. }
  613. .layer-smimg{
  614. width: 114rpx;
  615. height: 114rpx;
  616. float: left;
  617. border-radius: 10rpx;
  618. margin-right: 24rpx;
  619. image{
  620. width: 114rpx;
  621. height: 114rpx;
  622. border-radius: 10rpx;
  623. }
  624. }
  625. .layer-nunbox{
  626. justify-content: space-between;
  627. align-items: center;
  628. width: 536rpx;
  629. height: 88rpx;
  630. padding: 13rpx 0 0 0;
  631. float: left;
  632. .layer-nunbox-t{
  633. width: 100%;
  634. height:44rpx;
  635. position:relative;
  636. display: flex;
  637. .layer-nunbox-text{
  638. line-height: 44rpx;
  639. font-size: $font-size-28;
  640. }
  641. .number-box{
  642. display: flex;
  643. justify-content: center;
  644. align-items: center;
  645. .iconfont{
  646. font-size: $font-size-32;
  647. padding:0 18rpx;
  648. font-size: $text-color;
  649. }
  650. .btn-input{
  651. width: 62rpx;
  652. height: 48rpx;
  653. line-height: 48rpx;
  654. background: #F8F8F8;
  655. border-radius: 4rpx;
  656. text-align: center;
  657. font-size: $font-size-28;
  658. }
  659. }
  660. .product-step{
  661. position: absolute;
  662. left: 45rpx;
  663. bottom: 0;
  664. height: 44rpx;
  665. background: #FFFFFF;
  666. }
  667. }
  668. .layer-nunbox-b{
  669. width: 100%;
  670. height:44rpx;
  671. margin-top: 13rpx;
  672. }
  673. .text{
  674. line-height: 44rpx;
  675. font-size: $font-size-28;
  676. .p{
  677. color: #FF2A2A;
  678. }
  679. .p:first-child{
  680. margin-left: 30rpx;
  681. }
  682. .p.sm{
  683. font-size: $font-size-24;
  684. }
  685. }
  686. }
  687. }
  688. .placeholder{
  689. color: #b2b2b2;
  690. }
  691. </style>