order-payment.vue 14 KB

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