order-payment.vue 14 KB

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