sellerInvoice.vue 17 KB

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