sellerInvoice.vue 16 KB

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