sellerInvoice.vue 18 KB

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