order-payment.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <template>
  2. <view class="container cashier" :style="{paddingTop:CustomBar+'px'}">
  3. <cu-custom :navbar-data='nvabarData' @navigateBack="hanldNavigateBack"></cu-custom>
  4. <view class="container-cash clearfix" v-if="invoiceStatus">
  5. <view class="pay-bring-title">{{payBringTitle}}</view>
  6. <view class="container-wrapper">
  7. <view class="pay-content">
  8. <view class="pay-p"><text>待付金额</text></view>
  9. <view class="pay-money">
  10. <text class="pay-sm">¥</text>
  11. <text class="pay-bg">{{payableAmount | NumFormat}}</text>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="pay-bring-wrapper clearfix">
  16. <view class="pay-bring-content">
  17. <view class="text-v title">转账信息</view>
  18. <view class="text-v">开户行:中信银行(深圳泰然支行)</view>
  19. <view class="text-v">银行卡号:{{bankNumber}}</view>
  20. <view class="text-v">户名:周仁声</view>
  21. <view class="text-v">订单标识:{{payOrderId}} <text class="clipboard" @click.stop="clipboard(payOrderId)">复制</text></view>
  22. <view class="text-v title">特别注意</view>
  23. <view class="text-v bg-color">请在转账备注中填写上述订单标识,方便财务快速审核,提高发货速度</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="container-cash clearfix" v-else>
  28. <view class="container-wrapper">
  29. <view class="pay-content">
  30. <view class="pay-p"><text>待付金额</text></view>
  31. <view class="pay-money">
  32. <text class="pay-sm">¥</text>
  33. <text class="pay-bg">{{payableAmount | NumFormat}}</text>
  34. </view>
  35. </view>
  36. <view class="pay-check">
  37. <view class="check-title"><view class="text">选择支付方式</view></view>
  38. <view class="pay-checked">
  39. <view class="pay-item" :class="{ 'current' : tabCurrentIndex === 0}" @click="tabClick(0)" >
  40. <view class="item-l">
  41. <view class="item-icon"><text class="iconfont icon-weixinzhifu"></text></view>
  42. <view class="item-texts"><text>微信支付</text></view>
  43. </view>
  44. <view class="item-r">
  45. <text class="iconfont icon-gougou"></text>
  46. </view>
  47. </view>
  48. <view class="pay-item" :class="{ 'current' : tabCurrentIndex === 1}" @click="tabClick(1)" >
  49. <view class="item-l">
  50. <view class="item-icon"><text class="iconfont icon-yinlianzhifu"></text></view>
  51. <view class="item-text">
  52. <view class="txt-p">企业网银支付</view>
  53. <view class="txt-t">需要在电脑端汇款</view>
  54. </view>
  55. </view>
  56. <view class="item-r">
  57. <text class="iconfont icon-gougou"></text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="pay-button">
  64. <view class="btn" @click.stop="goOrderCash" :style="{'background':btnColor}">{{buttonText}}</view>
  65. </view>
  66. <view class="pay-statustext">
  67. <view class="pay-statustext-inner">
  68. <view class="pay-icon">
  69. <text class="iconfont icon-gantanhao-yuankuang"></text>
  70. </view>
  71. <view class="pay-text">
  72. <text>{{payStatusText}}</text>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="pay-bring clearfix" :style="{paddingBottom:isIphoneX ? '68rpx' : '24rpx'}" @click.stop="showTips" v-if="isReceiptStatus">
  77. <view class="pay-bring-line"><text class="line"></text></view>
  78. <view class="pay-bring-content" v-if="!isShowTip">
  79. <view class="text bg-color">查看转账信息</view>
  80. <view class="text">除了以上两种支付方式</view>
  81. <view class="text">您还可以通过线下转账的方式付款</view>
  82. </view>
  83. <view class="pay-bring-content" v-else>
  84. <view class="text-v title">转账信息</view>
  85. <view class="text-v">开户行:中信银行(深圳泰然支行)</view>
  86. <view class="text-v">银行卡号:{{bankNumber}}</view>
  87. <view class="text-v">户名:周仁声</view>
  88. <view class="text-v">订单标识:{{payOrderId}} <text class="clipboard" @click.stop="clipboard(payOrderId)">复制</text></view>
  89. <view class="text-v title">特别注意</view>
  90. <view class="text-v bg-color">请在转账备注中填写上述订单标识,方便财务快速审核,提高发货速度</view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. const thorui = require("@/components/clipboard/clipboard.thorui.js")
  98. export default{
  99. data(){
  100. return{
  101. orderID:'',
  102. payableAmount:0,
  103. emptyWrapperH: '',
  104. bankNumber:'6217 6803 0362 0897',
  105. payOrderId:'',
  106. nvabarData: { //顶部自定义导航
  107. showCapsule:1, // 是否显示左上角图标 1表示显示 0表示不显示,
  108. showSearch: 0,
  109. title: '选择支付方式', // 导航栏 中间的标题
  110. haveBack:false,
  111. haveHome:true,
  112. textLeft:this.$store.state.isIphone
  113. },
  114. isIphoneX:this.$store.state.isIphoneX,
  115. CustomBar:this.CustomBar,// 顶部导航栏高度
  116. tabCurrentIndex:0,
  117. isShowTip:false,
  118. isReceiptStatus:false,
  119. buttonText:'使用微信支付',
  120. btnColor:'#09BB07',
  121. receiptStatus:'',
  122. invoiceStatus:false,
  123. optionType:'',
  124. onlinePayFlag:'',
  125. payBringTitle:'本次交易暂不支持线上支付,请使用线下转账方式付款',
  126. payStatusText:'使用微信和企业网银支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。若着急发货,可以选择使用线下转账进行付款。'
  127. }
  128. },
  129. onLoad(option) {
  130. this.initData(option)
  131. },
  132. filters: {
  133. NumFormat(value) {
  134. if(!value) return '0.00';
  135. /*原来用的是Number(value).toFixed(0),这样取整时有问题,例如0.51取整之后为1,感谢Nils指正*/
  136. /*后来改成了 Number(value)|0,但是输入超过十一位就为负数了,具体见评论 */
  137. var intPart = Number(value) - Number(value)%1; //获取整数部分(这里是windy93的方法)
  138. var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); //将整数部分逢三一断
  139. var floatPart = ".00"; //预定义小数部分
  140. var value2Array = value.toString().split(".");
  141. //=2表示数据有小数位
  142. if(value2Array.length == 2) {
  143. floatPart = value2Array[1].toString(); //拿到小数部分
  144. if(floatPart.length == 1) { //补0,实际上用不着
  145. return intPartFormat + "." + floatPart + '0';
  146. } else {
  147. return intPartFormat + "." + floatPart;
  148. }
  149. } else {
  150. return intPartFormat + floatPart;
  151. }
  152. }
  153. },
  154. methods:{
  155. initData(e){
  156. this.orderID = e.orderID;
  157. this.payOrderId ='#'+e.orderID+'#';
  158. this.optionType = e.type;
  159. switch(e.type){
  160. case 'confirm':
  161. this.nvabarData.haveBack = false
  162. this.nvabarData.haveHome = true
  163. this.nvabarData.title = '支付'
  164. this.PayOrderCheckoutCounter(this.orderID)
  165. break;
  166. case 'payfirm':
  167. this.nvabarData.haveBack = true
  168. this.nvabarData.haveHome = false
  169. this.nvabarData.title = '选择支付方式'
  170. this.PayOrderCheckoutCounter(this.orderID)
  171. break;
  172. case 'onlinePay':
  173. this.invoiceStatus = true
  174. this.nvabarData.haveBack = true
  175. this.nvabarData.haveHome = false
  176. this.nvabarData.title = '付款提示'
  177. this.payableAmount = e.Amount
  178. // this.PayOrderCheckoutCounter(this.orderID)
  179. this.payBringTitle = '您已通过线下转账的方式支付了订单部分款项,剩余款项依然需要使用线下转账方式,给您带来的不便敬请谅解'
  180. break;
  181. }
  182. },
  183. PayOrderCheckoutCounter(orderId){
  184. this.PayService.PayOrderCheckoutCounter({orderId:orderId}).then(response =>{
  185. let data = response.data.order
  186. this.payableAmount = data.payableAmount - data.receiptAmount //待付金额
  187. this.receiptStatus = data.receiptStatus
  188. this.onlinePayFlag = data.onlinePayFlag
  189. //判断线上线下显示
  190. if(this.optionType == 'onlinePay'){
  191. this.invoiceStatus = true
  192. }else{
  193. this.invoiceStatus = data.invoiceStatus
  194. }
  195. if(data.receiptAmount>0){
  196. this.payStatusText = '使用微信和企业网银支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。'
  197. this.isReceiptStatus = false
  198. }else{
  199. this.payStatusText = '使用微信和企业网银支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。若着急发货,可以选择使用线下转账进行付款。'
  200. this.isReceiptStatus = true
  201. }
  202. }).catch(error =>{
  203. this.$util.msg(error.msg,2000)
  204. })
  205. },
  206. goOrderCash(){
  207. if(this.invoiceStatus){
  208. this.$util.modal('','本次交易暂不支持线上支付开票,请使用线下转账的方式付款','知道了','',false,() =>{})
  209. this.payStatusText = '使用微信和企业网银支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。若着急发货,可以选择使用线下转账进行付款。'
  210. this.isReceiptStatus = true
  211. }else{
  212. switch(this.tabCurrentIndex){
  213. case 0:
  214. this.$api.navigateTo(`/pages/user/order/order-pay?type=0&orderID=${this.orderID}`)
  215. break;
  216. case 1:
  217. this.$api.navigateTo(`/pages/user/order/order-pay?type=1&orderID=${this.orderID}`)
  218. break;
  219. }
  220. }
  221. },
  222. tabClick(index) {//tab切换
  223. this.tabCurrentIndex = index;
  224. switch(index){
  225. case 0:
  226. this.btnColor="#09BB07"
  227. this.buttonText='使用微信支付';
  228. break;
  229. case 1:
  230. this.btnColor="#034582"
  231. this.buttonText='使用网银支付';
  232. break;
  233. }
  234. },
  235. hanldNavigateBack(){//页面返回
  236. uni.navigateBack({
  237. delta: 1
  238. });
  239. },
  240. showTips(){
  241. this.isShowTip=!this.isShowTip
  242. },
  243. clipboard(data) {
  244. thorui.getClipboardData(data, (res) => {
  245. if (res) {
  246. this.$util.msg("复制成功",2000,true,'success');
  247. } else {
  248. this.$util.msg("复制失败",2000,true,'none');
  249. }
  250. })
  251. },
  252. },
  253. onShow() {
  254. }
  255. }
  256. </script>
  257. <style lang="scss">
  258. page{
  259. height: auto !important;
  260. background-color: #FFFFFF;
  261. }
  262. .container-cash{
  263. width: 100%;
  264. .pay-bring-title{
  265. box-sizing: border-box;
  266. width: 100%;
  267. min-height: 96rpx;
  268. padding: 20rpx 24rpx;
  269. line-height: 48rpx;
  270. text-align: left;
  271. font-size: $font-size-24;
  272. background:rgba(255,234,221,1);
  273. color: $color-system;
  274. }
  275. .container-wrapper{
  276. width:662rpx;
  277. margin: 0 auto;
  278. .pay-title{
  279. font-size: $font-size-32;
  280. line-height: 44rpx;
  281. text-align: center;
  282. color: #2A86FF;
  283. margin: 40rpx 0 0 0;
  284. width: 100%;
  285. float: left;
  286. }
  287. .pay-content{
  288. width: 574rpx;
  289. height: 136rpx;
  290. padding: 52rpx 44rpx;
  291. background: url(https://img.caimei365.com/group1/M00/03/BD/Cmis218ekFyAHoAzAALhR3oBpDI049.png) no-repeat;
  292. background-size: cover;
  293. float: left;
  294. margin-top: 40rpx;
  295. margin-bottom: 40rpx;
  296. .pay-p{
  297. font-size: $font-size-26;
  298. color: #FFFFFF;
  299. line-height: 36rpx;
  300. }
  301. .pay-money{
  302. color: #FFFFFF;
  303. line-height: 84rpx;
  304. font-weight: bold;
  305. .pay-sm{
  306. font-size: $font-size-26;
  307. }
  308. .pay-bg{
  309. font-size: 50rpx;
  310. }
  311. }
  312. }
  313. .pay-check{
  314. width: 100%;
  315. height: auto;
  316. float: left;
  317. .check-title{
  318. width: 622rpx;
  319. height: 40rpx;
  320. line-height: 40rpx;
  321. padding: 0 20rpx;
  322. margin-top: 24rpx;
  323. .text{
  324. font-size: $font-size-28;
  325. color: $text-color;
  326. text-align: left;
  327. float: left;
  328. }
  329. .icon{
  330. width: 40rpx;
  331. height: 40rpx;
  332. border-radius: 50%;
  333. line-height: 40rpx;
  334. text-align: center;
  335. color: #FFFFFF;
  336. font-size: $font-size-24;
  337. background: radial-gradient(circle,rgba(225,86,22,1) 0%,rgba(255,170,0,1) 67%,rgba(249,185,156,1) 100%);
  338. float: right;
  339. }
  340. }
  341. .pay-checked{
  342. width: 100%;
  343. height: auto;
  344. .pay-item{
  345. width: 618rpx;
  346. height: 96rpx;
  347. border: 2px solid #F5F5F5;
  348. border-radius: 30rpx;
  349. padding: 20rpx;
  350. margin: 24rpx 0;
  351. display: flex;
  352. background-color: #FFFFFF;
  353. &.current{
  354. border-color:$color-system;
  355. .item-r{
  356. .icon-gougou{
  357. color: $color-system;
  358. }
  359. }
  360. }
  361. .item-l{
  362. flex: 8;
  363. .item-icon{
  364. width: 96rpx;
  365. height: 96rpx;
  366. float: left;
  367. text-align: center;
  368. line-height: 96rpx;
  369. margin-right: 20rpx;
  370. .iconfont{
  371. font-size:88rpx;
  372. }
  373. .icon-weixinzhifu{
  374. color: #09BB07;
  375. }
  376. .icon-yinlianzhifu{
  377. color: #034582;
  378. }
  379. }
  380. .item-texts{
  381. line-height: 96rpx;
  382. font-size:$font-size-26;
  383. color: $text-color;
  384. }
  385. .item-text{
  386. line-height: 48rpx;
  387. font-size:$font-size-26;
  388. .txt-p{
  389. color: $text-color;
  390. }
  391. .txt-t{
  392. color: #999999;
  393. }
  394. }
  395. }
  396. .item-r{
  397. flex: 2;
  398. text-align: right;
  399. line-height: 96rpx;
  400. .icon-gougou{
  401. font-size: 66rpx;
  402. color: #FFFFFF;
  403. }
  404. }
  405. }
  406. }
  407. }
  408. }
  409. .pay-button{
  410. width: 100%;
  411. float: left;
  412. margin-top:30rpx;
  413. .btn{
  414. width: 662rpx;
  415. height: 88rpx;
  416. border-radius: 14rpx;
  417. font-size: $font-size-28;
  418. line-height: 88rpx;
  419. color: #FFFFFF;
  420. margin: 0 auto;
  421. text-align: center;
  422. background:$btn-confirm;
  423. }
  424. }
  425. .pay-statustext{
  426. width: 100%;
  427. height: 120rpx;
  428. float: left;
  429. margin-top:40rpx;
  430. .pay-statustext-inner{
  431. width: 662rpx;
  432. height: 100%;
  433. margin: 0 auto;
  434. .pay-icon{
  435. width: 62rpx;
  436. height: 100%;
  437. float: left;
  438. text-align: center;
  439. .iconfont{
  440. color: #FF2A2A;
  441. font-size:$font-size-36;
  442. line-height: 20rpx;
  443. }
  444. }
  445. .pay-text{
  446. width: 560rpx;
  447. height: 100%;
  448. float: left;
  449. line-height: 40rpx;
  450. font-size: $font-size-26;
  451. color: #FF2A2A;
  452. text-align: justify;
  453. }
  454. }
  455. }
  456. .pay-bring{
  457. width: 100%;
  458. min-height: 190rpx;
  459. padding: 24rpx 0;
  460. background-color: #FFFFFF;
  461. box-shadow:0px 3px 6px rgba(0,0,0,0.16);
  462. position: fixed;
  463. bottom: 0;
  464. left: 0;
  465. border-radius: 30rpx 30rpx 0 0;
  466. display: flex;
  467. align-items: center;
  468. flex-direction: column;
  469. .pay-bring-line{
  470. display: flex;
  471. align-items: center;
  472. .line{
  473. display: inline-block;
  474. width: 48rpx;
  475. height: 2px;
  476. background-color: #707070;
  477. }
  478. }
  479. .pay-bring-content{
  480. width: 654rpx;
  481. height: auto;
  482. padding: 0 24rpx;
  483. .text{
  484. font-size: $font-size-24;
  485. color: #666;
  486. line-height: 44rpx;
  487. text-align: center;
  488. &.bg-color{
  489. color: $color-system;
  490. line-height: 88rpx;
  491. }
  492. }
  493. .text-v{
  494. font-size: $font-size-28;
  495. color: #999;
  496. line-height: 70rpx;
  497. text-align: left;
  498. &.title{
  499. font-size: $font-size-26;
  500. color: #666666;
  501. }
  502. &.bg-color{
  503. line-height: 44rpx;
  504. color: $color-system;
  505. }
  506. .clipboard{
  507. width: 84rpx;
  508. height: 36rpx;
  509. background:linear-gradient(34deg,rgba(255,41,41,1) 0%,rgba(255,109,27,1) 100%);
  510. text-align: center;
  511. font-size: $font-size-24;
  512. color: #FFFFFF;
  513. border-radius: 4rpx;
  514. line-height: 36rpx;
  515. display: inline-block;
  516. margin-left: 10rpx;
  517. }
  518. }
  519. }
  520. }
  521. .pay-bring-wrapper{
  522. width: 100%;
  523. padding: 24rpx 0;
  524. background-color: #FFFFFF;
  525. display: flex;
  526. align-items: center;
  527. flex-direction: column;
  528. .pay-bring-content{
  529. width: 654rpx;
  530. height: auto;
  531. padding: 0 24rpx;
  532. .text{
  533. font-size: $font-size-24;
  534. color: #666;
  535. line-height: 44rpx;
  536. text-align: center;
  537. &.bg-color{
  538. color: $color-system;
  539. line-height: 88rpx;
  540. }
  541. }
  542. .text-v{
  543. font-size: $font-size-28;
  544. color: #999;
  545. line-height: 70rpx;
  546. text-align: left;
  547. &.title{
  548. font-size: $font-size-28;
  549. color: #666666;
  550. }
  551. &.bg-color{
  552. line-height: 44rpx;
  553. color: $color-system;
  554. }
  555. .clipboard{
  556. width: 84rpx;
  557. height: 36rpx;
  558. background:linear-gradient(34deg,rgba(255,41,41,1) 0%,rgba(255,109,27,1) 100%);
  559. text-align: center;
  560. font-size: $font-size-24;
  561. color: #FFFFFF;
  562. border-radius: 4rpx;
  563. line-height: 36rpx;
  564. display: inline-block;
  565. margin-left: 10rpx;
  566. }
  567. }
  568. }
  569. }
  570. }
  571. .freight-alert{
  572. width: 100%;
  573. height: 100%;
  574. background: rgba(0,0,0,.5);
  575. position: fixed;
  576. top: 0;
  577. left: 0;
  578. z-index: 8888;
  579. transition: all 0.4s;
  580. &.none{
  581. display: none;
  582. }
  583. &.show{
  584. display: block;
  585. }
  586. .content{
  587. width: 422rpx;
  588. height:434rpx;
  589. position: absolute;
  590. background: $bg-color;
  591. left: 0;
  592. right: 0;
  593. bottom: 0;
  594. top: 0;
  595. margin: auto;
  596. padding: 20rpx 32rpx;
  597. border-radius: 12rpx;
  598. .title{
  599. width: 100%;
  600. height: 68rpx;
  601. line-height: 68rpx;
  602. font-size: $font-size-28;
  603. color: $text-color;
  604. text-align: center;
  605. position: relative;
  606. .icon-iconfontguanbi{
  607. width: 68rpx;
  608. height: 68rpx;
  609. text-align: center;
  610. line-height: 68rpx;
  611. position: absolute;
  612. right: 0;
  613. top: 0;
  614. font-size: $font-size-36;
  615. color: #999999;
  616. }
  617. }
  618. .text-content{
  619. width: 100%;
  620. height: auto;
  621. .text{
  622. padding: 20rpx 0;
  623. line-height: 44rpx;
  624. font-size: $font-size-26;
  625. color:#666666;
  626. text-align: justify;
  627. }
  628. .text-p{
  629. line-height: 44rpx;
  630. font-size: $font-size-26;
  631. color:$color-system;
  632. text-align: left;
  633. }
  634. }
  635. }
  636. }
  637. </style>