card-order.vue 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214
  1. <template>
  2. <view class="container cashier">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading="true"
  4. :loadingType="5" />
  5. <template v-else>
  6. <cu-custom :navbar-data="nvabarData" @navigateBack="hanldNavigateBack"></cu-custom>
  7. <view class="container-cash clearfix" :style="{ marginTop: CustomBar + 'px' }">
  8. <view class="container-wrapper">
  9. <view class="pay-content">
  10. <view class="pay-top">
  11. <view class="pay-paid">
  12. <text class="txt-m">待付金额</text>
  13. <text class="txt-b"><text class="small">¥</text>{{ obligation | NumFormat }}</text>
  14. </view>
  15. <view class="pay-payd">
  16. <view class="pay-paids">
  17. <text class="txt-m">应付总额</text>
  18. <text class="txt-b">¥{{ payableAmount | NumFormat }}</text>
  19. </view>
  20. <view class="pay-paids">
  21. <text class="txt-m">已支付金额</text>
  22. <text class="txt-b">¥{{ receiptAmount | NumFormat }}</text>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="pay-bot">
  27. <view class="bot-title"><text>本次支付金额</text></view>
  28. <view class="bot-input">
  29. <text>¥</text>
  30. <input class="input" type="digit" v-model="payAmount" @focus="focusInput"
  31. @blur="blurInput" placeholder="输入金额不能大于待付金额" placeholder-class="placeholder" />
  32. </view>
  33. <view class="bot-resid">
  34. <text class="bot-resid-le">应付剩余¥{{ balanceAmount | NumFormat }}</text>
  35. <text class="bot-resid-ri" @click="hanldeShowPopup(0)">支付记录 <text
  36. class="iconfont icon-xiayibu"></text>
  37. </text>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="pay-checked">
  42. <template v-if="!isBigReaFlag">
  43. <template v-if="showQuickpayMode">
  44. <view class="pay-card-main" v-if="cardsList.length > 0">
  45. <view class="pay-item-cell" @click="tabClick(3)">
  46. <view class="item-icon">
  47. <image :src="
  48. 'https://static.caimei365.com/app/img/pay/icon_' +
  49. defaultCards.bankCode +
  50. '_@2x.png'
  51. "></image>
  52. </view>
  53. <view class="item-texts">{{ defaultCards.bankName }}(
  54. {{ defaultCards.quickPayBankNumber | bankNumeberFilter }} )
  55. </view>
  56. <view class="item-checked">
  57. <text class="iconfont"
  58. :class="[tabCurrentIndex === 3 ? 'icon-yixuanze3' : 'icon-weixuanze']"></text>
  59. </view>
  60. </view>
  61. <view class="pay-item-cell add" @click="hanldeShowPopup(1)">
  62. <view class="item-texts add"><text>查看全部银行卡 / 添加新卡支付</text></view>
  63. <view class="item-checked"> <text class="iconfont icon-xiayibu"></text> </view>
  64. </view>
  65. </view>
  66. <view class="pay-item" @click="handleAddCard(2)" v-else>
  67. <view class="pay-item-cell">
  68. <view class="item-texts add"><text>添加银行卡快捷付款</text></view>
  69. <view class="item-checked"> <text class="iconfont icon-xiayibu"></text> </view>
  70. </view>
  71. </view>
  72. </template>
  73. <!-- <view class="pay-item" @click="tabClick(0)" v-if="showWeChatPayMode">
  74. <view class="pay-item-cell">
  75. <view class="item-icon"><text class="iconfont icon-weixinzhifu"></text></view>
  76. <view class="item-texts"><text>微信支付</text></view>
  77. <view class="item-checked">
  78. <text
  79. class="iconfont"
  80. :class="[tabCurrentIndex === 0 ? 'icon-yixuanze3' : 'icon-weixuanze']"
  81. ></text>
  82. </view>
  83. </view>
  84. </view> -->
  85. <view class="pay-item" @click="tabClick(1)" v-if="showB2BpayMode">
  86. <view class="pay-item-cell">
  87. <view class="item-icon"><text class="iconfont icon-qiyewangyinzhifu"></text></view>
  88. <view class="item-texts"><text>企业网银支付</text></view>
  89. <view class="item-checked">
  90. <text class="iconfont"
  91. :class="[tabCurrentIndex === 1 ? 'icon-yixuanze3' : 'icon-weixuanze']"></text>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="pay-item" @click="tabClick(2)">
  96. <view class="pay-item-cell">
  97. <view class="item-icon"><text class="iconfont icon-gerenwangyinzhifu"></text></view>
  98. <view class="item-texts"><text>个人网银支付</text></view>
  99. <view class="item-checked">
  100. <text class="iconfont"
  101. :class="[tabCurrentIndex === 2 ? 'icon-yixuanze3' : 'icon-weixuanze']"></text>
  102. </view>
  103. </view>
  104. </view>
  105. </template>
  106. <view class="pay-item" @click="tabClick(4)">
  107. <view class="pay-item-cell">
  108. <view class="item-icon"><text class="iconfont icon-daewangyinzhuanzhang"></text></view>
  109. <view class="item-texts"><text>银联转账支付</text></view>
  110. <view class="item-checked">
  111. <text class="iconfont"
  112. :class="[isBigReaFlag || tabCurrentIndex === 4 ? 'icon-yixuanze3' : 'icon-weixuanze']"></text>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <view class="pay-statustext">
  118. <view class="pay-statustext-inner">
  119. <view class="pay-icon"> <text class="iconfont icon-gantanhao-yuankuang"></text> </view>
  120. <view class="pay-text">
  121. <view>使用任何一种线上支付方式支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。</view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. <view class="pay-button" :style="{ paddingBottom: isIphoneX ? '68rpx' : '24rpx' }">
  127. <view class="btn" @click.stop="buttonSubMit" :class="isSubLoding ? 'disabled' : ''"
  128. :style="{ background: btnColor }">{{
  129. buttonText
  130. }}</view>
  131. </view>
  132. </view>
  133. </template>
  134. <!-- 支付链接弹窗 -->
  135. <view class="alert spec" v-if="isShowTip">
  136. <!-- 选择支付弹窗说明 -->
  137. <view class="freight-alert" @tap="hideTips">
  138. <view class="content">
  139. <view class="title">
  140. <text>支付链接</text> <text class="iconfont icon-iconfontguanbi" @click.stop="hideTips"></text>
  141. </view>
  142. <view class="text-content">
  143. <view class="text">请复制以下链接,并发送至电脑端,在浏览器访问该链接并选择银行尽快完成支付</view>
  144. <view class="text-p">{{ payHttpUrl }}</view>
  145. <view class="text-b">链接有效期为72小时</view>
  146. </view>
  147. <view class="text-button" @click.stop="clipboard(payHttpUrl)">复制链接</view>
  148. </view>
  149. </view>
  150. </view>
  151. <!--大额转账弹窗 -->
  152. <tui-modal :show="bigPaymodal" :padding="'30rpx 30rpx'" @cancel="hideMobel" :custom="true" fadeIn>
  153. <view class="tui-modal-custom">
  154. <view class="tui-prompt-title">
  155. 银联转账信息
  156. <text class="iconfont icon-iconfontguanbi" @click.stop="hideMobel"></text>
  157. </view>
  158. <view class="tui-prompt-text">
  159. <view class="tui-prompt-tips">注:请使用手机银行app或者网银等转账方式选择转账付款,填写以下信息进行银联转账。(付款成功后系统稍后会更新订单信息)</view>
  160. <view class="tui-prompt-item">
  161. <text class="text">收款账户名:</text>
  162. {{ bigPayInfo.receiverName }}
  163. </view>
  164. <view class="tui-prompt-item">
  165. <text class="text">收款账号:</text>
  166. {{ bigPayInfo.bankNumber }}
  167. </view>
  168. <view class="tui-prompt-item">
  169. <text class="text">收款机构:</text>
  170. 广州合利宝支付科技有限公司/
  171. {{ bigPayInfo.bankName }}
  172. </view>
  173. </view>
  174. <view class="tui-prompt-flex">
  175. <view class="btn btn-confirm" @click="copyClipboard">
  176. <text class="iconfont icon-fuzhi_o"></text>
  177. 复制账号信息
  178. </view>
  179. </view>
  180. </view>
  181. </tui-modal>
  182. <!-- 支付记录 -->
  183. <cm-record :show="popupShow" :list="discernReceipt" v-if="popupShow" />
  184. <!-- 选择快捷支付银行 -->
  185. <cm-cards :show="popupShow1" :list="cardsList" @handleChoiceaCards="handleChoiceaCards"
  186. @addCards="handleAddCard" v-if="popupShow1" />
  187. <!-- 弹窗提示 -->
  188. <tui-modal :show="modal" @click="handleClick" :content="contentModalText" :button="modalButton" color="#333"
  189. :size="32" shape="circle" :maskClosable="false">
  190. </tui-modal>
  191. </view>
  192. </template>
  193. <script>
  194. import authorize from '@/common/config/authorize.js'
  195. import thorui from '@/components/clipboard/clipboard.thorui.js'
  196. import payMixins from '@/mixins/payMixins.js'
  197. import cardMixins from './mixins/cardMixins.js'
  198. import cmCards from './components/cm-cards-popup'
  199. import cmRecord from './components/cm-record-popup'
  200. export default {
  201. mixins: [payMixins, cardMixins],
  202. components: {
  203. cmRecord,
  204. cmCards
  205. },
  206. data() {
  207. return {
  208. skeletonShow: true,
  209. orderId: 0,
  210. shopOrderId: 0,
  211. shopOrderInfo: {},
  212. payType: '',
  213. realPay: 0, //应付金额
  214. payableAmount: 0, // 应付总额
  215. receiptAmount: 0, // 已付金额
  216. obligation: 0, //待付金额
  217. balanceAmount: 0,
  218. payAmount: 0,
  219. isBigReaFlag: false, // 判断是否使用过银联转账
  220. bigPayInfo: { // 银联转账信息
  221. bankName: '', // 收款网点
  222. bankNumber: '', // 收款账号
  223. receiverName: '' // 收款账户名
  224. },
  225. nvabarData: {
  226. //顶部自定义导航
  227. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  228. showSearch: 0,
  229. title: '收银台', // 导航栏 中间的标题
  230. haveBack: true,
  231. textLeft: this.$store.state.isIphone
  232. },
  233. idCardList: [],
  234. isIphoneX: this.$store.state.isIphoneX,
  235. CustomBar: this.CustomBar, // 顶部导航栏高度
  236. isShowTip: false,
  237. discernReceipt: [],
  238. showDigitKeyboard: false,
  239. payHttpUrl: '',
  240. mbOrderId: 0, // 支付记录订单Id
  241. modal: false,
  242. bigPaymodal: false,
  243. contentModalText: '本次支付金额已超出微信支付限额,请输入小于20万的金额。', //操作文字提示语句
  244. modalButton: [{
  245. text: '知道了',
  246. customStyle: {
  247. color: '#fff',
  248. bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)'
  249. },
  250. plain: false
  251. }],
  252. quickParams: {
  253. userId: 0, //机构UserId
  254. quickPayBankNumber: '', //快捷支付用户银行卡号/信用卡号
  255. quickPayMobile: '', //快捷支付银行卡绑定手机号
  256. quickPayBankExpireTime: '', //快捷支付信用卡过期时间,只包含年月,格式yy-MM
  257. quickPayUserName: '', //快捷支付用户姓名
  258. idCard: '', //身份证号
  259. cvvCode: '', //信用卡安全码
  260. quickPayFlag: 1,
  261. payAmount: 0,
  262. shopOrderId: 0
  263. },
  264. isSubLoding: false
  265. }
  266. },
  267. onLoad(option) {
  268. this.initData(option)
  269. },
  270. filters: {
  271. NumFormat(value) {
  272. if (!value) return '0.00'
  273. /*原来用的是Number(value).toFixed(0),这样取整时有问题,例如0.51取整之后为1,感谢Nils指正*/
  274. /*后来改成了 Number(value)|0,但是输入超过十一位就为负数了,具体见评论 */
  275. var intPart = Number(value) - (Number(value) % 1) //获取整数部分(这里是windy93的方法)
  276. var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') //将整数部分逢三一断
  277. var floatPart = '.00' //预定义小数部分
  278. var value2Array = value.toString().split('.')
  279. //=2表示数据有小数位
  280. if (value2Array.length == 2) {
  281. floatPart = value2Array[1].toString() //拿到小数部分
  282. if (floatPart.length == 1) {
  283. //补0,实际上用不着
  284. return intPartFormat + '.' + floatPart + '0'
  285. } else {
  286. return intPartFormat + '.' + floatPart
  287. }
  288. } else {
  289. return intPartFormat + floatPart
  290. }
  291. }
  292. },
  293. methods: {
  294. initData(e) {
  295. this.shopOrderId = e.shopOrderId
  296. this.GetPayOrderInfo()
  297. this.GetUserClubBanks()
  298. },
  299. async GetPayOrderInfo() {
  300. //初始化支付信息
  301. try {
  302. const { data } = await this.PayService.PayOrderCheckoutShoporders({ shopOrderId: this
  303. .shopOrderId })
  304. this.discernReceipt = data.discernReceipt // 支付记录
  305. this.shopOrderInfo = data.shopOrder // 子订单
  306. this.obligation = data.shopOrder.obligation // 待付金额
  307. this.orderId = data.shopOrder.orderId // 主订单Id
  308. this.receiptAmount = data.shopOrder.receiptAmount // 已付金额
  309. this.payableAmount = data.shopOrder.realPay // 应付金额
  310. this.payAmount = this.toFixedFn(this.obligation) // 自定义金额
  311. this.balanceAmount = this.obligation - this.payAmount // 计算剩余支付金额
  312. // 支付方式配置
  313. this.checkPayMode(data.onlinePayWays, data.weChatFlag)
  314. if (data.bankInfo) {
  315. this.bigPayInfo.bankNumber = data.bankInfo.bankNumber
  316. this.bigPayInfo.receiverName = data.bankInfo.receiverName
  317. this.bigPayInfo.bankName = data.bankInfo.bankName
  318. this.tabCurrentIndex = 4
  319. this.isBigReaFlag = true
  320. }
  321. setTimeout(() => {
  322. this.skeletonShow = false
  323. }, 500)
  324. } catch (error) {
  325. console.log(error)
  326. }
  327. },
  328. async GetUserClubBanks() {
  329. //获取列表
  330. try {
  331. const user = await this.$api.getStorage()
  332. const res = await this.UserService.userClubBanks({ userId: user.userId })
  333. this.cardsList = res.data
  334. this.defaultCards = this.cardsList[0]
  335. this.quickParams.userId = user.userId
  336. this.quickParams.shopOrderId = Number(this.shopOrderId)
  337. this.quickParams.quickPayBankNumber = this.defaultCards.quickPayBankNumber
  338. this.quickParams.quickPayMobile = this.defaultCards.quickPayMobile
  339. this.quickParams.quickPayBankExpireTime = this.defaultCards.quickPayBankExpireTime ? this
  340. .defaultCards.quickPayBankExpireTime : ''
  341. this.quickParams.quickPayUserName = this.defaultCards.quickPayUserName
  342. this.quickParams.idCard = this.defaultCards.idCard
  343. this.quickParams.cvvCode = this.defaultCards.cvvCode ? this.defaultCards.cvvCode : ''
  344. } catch (error) {
  345. console.log(error)
  346. }
  347. },
  348. handleAddCard(index) {
  349. //跳转添加卡号支付
  350. //quickPayFlag 1普通订单 ,payAmount 支付金额,单位元,shopOrderId 子订单Id
  351. const data = {
  352. payData: {
  353. quickPayFlag: 1,
  354. payAmount: this.payAmount,
  355. shopOrderId: Number(this.shopOrderId)
  356. },
  357. orderId: this.orderId
  358. }
  359. this.$api.navigateTo(`/pages/user/pay/card-comfirm?type=${index}&data=${JSON.stringify(data)}`)
  360. },
  361. buttonSubMit() {
  362. if (this.isSubLoding) { return }
  363. switch (this.tabCurrentIndex) {
  364. case 0: // 微信支付
  365. this.handleUmTrackEvent('Um_Event_ConfirmWechatPay', '微信支付')
  366. this.MiniWxPayFor()
  367. break
  368. case 1: // 企业网银
  369. this.payType = '1'
  370. this.handleUmTrackEvent('Um_Event_ConfirmEbankPay', '企业网银')
  371. this.handlePayOrderPayLink()
  372. break
  373. case 2: // 个人网银
  374. this.payType = '2'
  375. this.handleUmTrackEvent('Um_Event_ConfirmAbankPay', '个人网银')
  376. this.handlePayOrderPayLink()
  377. break
  378. case 3: // 快捷支付
  379. this.handleUmTrackEvent('Um_Event_ConfirmAbankPay', '快捷支付')
  380. if (!this.quickParams.quickPayBankNumber) {
  381. this.$util.msg('请先添加快捷支付银行卡', 2000)
  382. return
  383. }
  384. this.orderPayQuickPay()
  385. break
  386. case 4: // 银联转账支付
  387. this.payType = '2'
  388. this.handleUmTrackEvent('Um_Event_ConfirmAbankPay', '银联转账支付')
  389. this.handlePayOrderBigPay()
  390. break
  391. }
  392. this.isSubLoding = true
  393. },
  394. handleUmTrackEvent(UmName, UmPageName) {
  395. // 友盟埋点收集
  396. if (process.env.NODE_ENV != 'development') {
  397. this.$uma.trackEvent(UmName, {
  398. Um_Key_PageName: UmPageName,
  399. Um_Key_SourcePage: '线上支付',
  400. Um_Key_PayName: `${this.buttonText}`,
  401. Um_Key_PayOrderID: `${this.shopOrderId}`
  402. })
  403. }
  404. },
  405. async orderPayQuickPay() {
  406. //快捷支付
  407. try {
  408. this.quickParams.payAmount = this.payAmount
  409. console.log('payAmount', this.quickParams.payAmount)
  410. const res = await this.PayService.orderPayQuickPay(this.quickParams)
  411. const data = {
  412. params: this.quickParams,
  413. payData: res.data,
  414. orderId: this.orderId,
  415. payAmount: this.payAmount
  416. }
  417. this.isSubLoding = false
  418. this.$api.navigateTo(
  419. `/pages/user/pay/card-comfirm-sub?type=3&data=${JSON.stringify(data)}`
  420. )
  421. } catch (error) {
  422. this.$util.msg(error.msg, 2000)
  423. this.isSubLoding = false
  424. }
  425. },
  426. async handlePayOrderPayLink() {
  427. // 企业网银 个人网银
  428. if (this.payAmount == 0) {
  429. this.$util.msg('请输入本次支付的金额', 2000)
  430. return
  431. }
  432. if (this.payAmount <= 10) {
  433. this.$util.msg('网银支付的金额必须大于¥10.00', 2000)
  434. return
  435. }
  436. if (this.payType == '1') {
  437. if (this.payAmount != this.obligation) {
  438. this.contentModalText = '企业网银支付每次收取的手续费较高,建议一次性全额付款。'
  439. this.modal = true
  440. return
  441. }
  442. }
  443. try {
  444. const linkParams = {
  445. unpaidAmount: this.payAmount,
  446. shopOrderId: this.shopOrderId,
  447. payType: this.payType
  448. }
  449. const res = await this.PayService.PayOrderPayLink(linkParams)
  450. this.payHttpUrl = res.data
  451. this.isSubLoding = false
  452. this.isShowTip = true
  453. console.log('isShowTip', this.isShowTip)
  454. } catch (error) {
  455. console.log(error)
  456. this.isSubLoding = false
  457. }
  458. },
  459. async handlePayOrderBigPay() { // 银联转账支付
  460. if (this.payAmount * 1 === 0) {
  461. this.$util.msg('请输入本次支付的金额', 2000)
  462. return
  463. }
  464. if (this.payAmount * 1 !== this.obligation) {
  465. this.contentModalText = '银联转账支付每次收取的手续费较高,请一次性全额付款。'
  466. this.modal = true
  467. return
  468. }
  469. if (this.isBigReaFlag) {
  470. this.bigPaymodal = true
  471. this.isSubLoding = false
  472. } else {
  473. this.PayOrderLarge()
  474. }
  475. },
  476. // 调用获取银联转账账号
  477. async PayOrderLarge() {
  478. try {
  479. const user = await this.$api.getStorage()
  480. const params = {
  481. payType: 'LARGE',
  482. payAmount: this.payAmount,
  483. shopOrderId: this.shopOrderId,
  484. orderId: this.orderId,
  485. userId: user.userId,
  486. }
  487. const { data } = await this.PayService.PayOrderLarge(params)
  488. this.bigPayInfo.bankNumber = data.rt9_largePaymentNo
  489. this.bigPayInfo.receiverName = data.rt10_receiverName
  490. this.bigPayInfo.bankName = data.rt11_bankName
  491. this.bigPaymodal = true
  492. console.log('PayInfo', this.bigPayInfo)
  493. this.isSubLoding = false
  494. } catch (error) {
  495. console.log(error)
  496. this.isSubLoding = false
  497. }
  498. },
  499. async MiniWxPayFor() {
  500. // 微信支付
  501. if (this.payAmount > 200000) {
  502. this.modal = true
  503. return
  504. }
  505. if (this.payAmount == 0) {
  506. this.$util.msg('请输入本次支付的金额', 2000)
  507. return
  508. }
  509. if (this.payAmount * 100 < 2) {
  510. this.$util.msg('本次支付的金额必须大于¥0.02', 2000)
  511. return
  512. }
  513. // 获取微信code
  514. const wechatCode = await authorize.getCode('weixin')
  515. const params = {
  516. payAmount: this.payAmount,
  517. payType: 'XCX',
  518. code: wechatCode,
  519. shopOrderId: this.shopOrderId
  520. }
  521. this.weChatMiniOrderWxPay(params)
  522. this.isSubLoding = false
  523. },
  524. // 校验银联转账回调
  525. async handleBigPayClick() {
  526. try {
  527. const { data } = await this.PayService.PayOrderFindOrderStatus({ mbOrderId: this.mbOrderId })
  528. const linkData = {
  529. payAmount: this.payAmount,
  530. orderId: this.orderId,
  531. type: data.status === '1' ? 'success' : 'error'
  532. }
  533. if (data.status === '1') {
  534. this.$api.navigateTo(
  535. `/pages/user/order/order-success?data=${JSON.stringify({ data: linkData })}`)
  536. } else {
  537. this.$api.navigateTo(
  538. `/pages/user/order/order-success-tips?data=${JSON.stringify({ data: linkData })}`)
  539. }
  540. } catch (error) {
  541. console.log(error)
  542. }
  543. },
  544. // 关闭银联转账信息弹窗
  545. hideMobel() {
  546. this.bigPaymodal = false
  547. this.isSubLoding = false
  548. },
  549. handleClick() {
  550. this.modal = false
  551. this.isSubLoding = false
  552. },
  553. confirmEvent(value) {
  554. //点击自定义键盘完成的回调函数
  555. this.chechValue(value)
  556. this.showDigitKeyboard = false
  557. },
  558. blurInput(e) {
  559. this.chechValue(e.detail.value)
  560. },
  561. focusInput() {
  562. // this.showDigitKeyboard = true
  563. },
  564. hideKeyboard() {
  565. this.showDigitKeyboard = false
  566. },
  567. chechValue(value) {
  568. let patern = /\d+\.\d+/g
  569. if (value && value.split('.').length > 2) {
  570. value = patern.exec(value)
  571. }
  572. if (value == '' || value < 0) {
  573. this.payAmount = this.quickParams.payAmount = ''
  574. this.balanceAmount = this.obligation
  575. } else if (value > this.obligation) {
  576. this.payAmount = this.quickParams.payAmount = this.toFixedFn(this.obligation)
  577. this.balanceAmount = this.toFixedFn(this.obligation - this.payAmount)
  578. } else {
  579. this.payAmount = this.quickParams.payAmount = this.toFixedFn(value)
  580. this.balanceAmount = this.toFixedFn(this.obligation - this.payAmount)
  581. }
  582. },
  583. hanldNavigateBack() {
  584. //页面返回
  585. uni.navigateBack({
  586. delta: 1
  587. })
  588. },
  589. hideTips() {
  590. //隐藏弹窗
  591. this.isShowTip = false
  592. },
  593. toFixedFn(text) {
  594. //处理小数点后两位数
  595. return Number(text).toFixed(2)
  596. },
  597. copyClipboard() {
  598. //复制账号
  599. const data =
  600. `收款账户名:${this.bigPayInfo.receiverName}\n收款账号:${this.bigPayInfo.bankNumber}\n收款机构:广州合利宝支付科技有限公司(${ this.bigPayInfo.bankName })`
  601. thorui.getClipboardData(data, res => {
  602. if (res) {
  603. this.$util.msg('已复制', 2000)
  604. } else {
  605. this.$util.msg('复制失败', 2000)
  606. }
  607. })
  608. },
  609. clipboard(data) {
  610. //复制链接
  611. console.log('data', data)
  612. thorui.getClipboardData(data, res => {
  613. if (res) {
  614. this.isShowTip = false
  615. this.$util.msg('已复制', 2000)
  616. // 友盟埋点收集复制网银链接
  617. if (process.env.NODE_ENV != 'development') {
  618. this.$uma.trackEvent('Um_Event_CopyUnionPay', {
  619. Um_Key_PageName: '网银支付',
  620. Um_Key_SourcePage: '线上支付',
  621. Um_Key_PayName: `${this.buttonText}`,
  622. Um_Key_PayOrderID: `${this.shopOrderId}`
  623. })
  624. }
  625. } else {
  626. this.$util.msg('复制失败', 2000)
  627. }
  628. })
  629. },
  630. discard() {
  631. //丢弃
  632. }
  633. },
  634. onShow() {}
  635. }
  636. </script>
  637. <style lang="scss">
  638. page {
  639. height: auto !important;
  640. background-color: #ffffff;
  641. }
  642. .container-cash {
  643. width: 100%;
  644. .container-wrapper {
  645. width: 100%;
  646. margin: 0 auto;
  647. .pay-content {
  648. width: 100%;
  649. height: 420rpx;
  650. box-sizing: border-box;
  651. padding: 64rpx 35rpx 0 35rpx;
  652. background: url(https://img.caimei365.com/group1/M00/03/BD/Cmis218elN6AY6VeAAqw4n3n4nw186.png) no-repeat;
  653. background-size: cover;
  654. float: left;
  655. position: relative;
  656. .pay-top {
  657. width: 100%;
  658. height: auto;
  659. float: left;
  660. margin-bottom: 44rpx;
  661. .pay-paid {
  662. width: 100%;
  663. height: auto;
  664. margin-bottom: 38rpx;
  665. text {
  666. line-height: 48rpx;
  667. text-align: left;
  668. color: #ffffff;
  669. width: 100%;
  670. }
  671. .txt-m {
  672. font-size: $font-size-26;
  673. opacity: 0.7;
  674. display: inline-block;
  675. }
  676. .txt-b {
  677. font-size: $font-size-48;
  678. display: inline-block;
  679. .small {
  680. font-size: $font-size-32;
  681. }
  682. }
  683. }
  684. .pay-payd {
  685. width: 100%;
  686. height: auto;
  687. .pay-paids {
  688. height: auto;
  689. float: left;
  690. margin-right: 48rpx;
  691. text {
  692. line-height: 48rpx;
  693. text-align: left;
  694. color: #ffffff;
  695. }
  696. .txt-m {
  697. width: 100%;
  698. display: inline-block;
  699. font-size: $font-size-26;
  700. opacity: 0.7;
  701. }
  702. .txt-b {
  703. width: 100%;
  704. display: inline-block;
  705. font-size: $font-size-32;
  706. }
  707. }
  708. }
  709. }
  710. .pay-bot {
  711. width: 680rpx;
  712. height: 240rpx;
  713. padding: 24rpx;
  714. box-sizing: border-box;
  715. background: #ffffff;
  716. border-radius: 28rpx;
  717. box-shadow: 0 2px 6px rgba(255, 77, 0, 0.17);
  718. position: absolute;
  719. bottom: -150rpx;
  720. left: 35rpx;
  721. .bot-title {
  722. line-height: 36rpx;
  723. font-size: $font-size-26;
  724. color: #666666;
  725. }
  726. .bot-input {
  727. width: 100%;
  728. height: 66rpx;
  729. margin: 15rpx 0;
  730. border-bottom: 1px solid #ebebeb;
  731. line-height: 66rpx;
  732. font-size: $font-size-32;
  733. color: $text-color;
  734. text {
  735. display: block;
  736. float: left;
  737. }
  738. .input {
  739. font-size: $font-size-40;
  740. width: 500rpx;
  741. height: 66rpx;
  742. padding: 0 10rpx;
  743. line-height: 66rpx;
  744. float: left;
  745. .none {
  746. color: $text-color;
  747. opacity: 0.3;
  748. }
  749. .text {
  750. color: $text-color;
  751. }
  752. }
  753. .placeholder {
  754. font-size: $font-size-26;
  755. }
  756. }
  757. .bot-resid {
  758. line-height: 36rpx;
  759. font-size: $font-size-26;
  760. margin-top: 24rpx;
  761. .bot-resid-le {
  762. display: inline-block;
  763. float: left;
  764. color: $color-system;
  765. }
  766. .bot-resid-ri {
  767. display: inline-block;
  768. float: right;
  769. color: #1890f9;
  770. .iconfont {
  771. font-size: 32rpx;
  772. }
  773. }
  774. }
  775. }
  776. }
  777. .pay-checked {
  778. width: 100%;
  779. height: auto;
  780. float: left;
  781. box-sizing: border-box;
  782. padding: 0 0 32rpx 0;
  783. border-top: 1px solid #e1e1e1;
  784. margin-top: 180rpx;
  785. .pay-card-main {
  786. width: 100%;
  787. height: auto;
  788. float: left;
  789. border-top: 12px solid #f7f7f7;
  790. border-bottom: 12px solid #f7f7f7;
  791. box-sizing: border-box;
  792. padding: 0 32rpx;
  793. .pay-item-cell {
  794. height: 100rpx;
  795. box-sizing: border-box;
  796. padding: 26rpx 0;
  797. background-color: #ffffff;
  798. border-bottom: 1px solid #e1e1e1;
  799. &.add {
  800. border-bottom: none;
  801. padding-left: 66rpx;
  802. }
  803. .item-icon {
  804. width: 48rpx;
  805. height: 48rpx;
  806. margin-right: 20rpx;
  807. float: left;
  808. image {
  809. width: 48rpx;
  810. height: 48rpx;
  811. display: block;
  812. }
  813. }
  814. .item-texts {
  815. line-height: 48rpx;
  816. font-size: $font-size-28;
  817. color: $text-color;
  818. float: left;
  819. &.add {
  820. font-weight: bold;
  821. }
  822. }
  823. .item-checked {
  824. width: 48rpx;
  825. height: 48rpx;
  826. float: right;
  827. text-align: center;
  828. line-height: 48rpx;
  829. font-size: $font-size-40;
  830. color: #ffffff;
  831. .icon-weixuanze {
  832. color: #b2b2b2;
  833. }
  834. .icon-yixuanze3 {
  835. color: #ff5b00;
  836. }
  837. .icon-xiayibu {
  838. color: #b2b2b2;
  839. }
  840. }
  841. }
  842. }
  843. .pay-item {
  844. width: 100%;
  845. height: auto;
  846. box-sizing: border-box;
  847. float: left;
  848. padding: 0 32rpx;
  849. .pay-item-cell {
  850. height: 100rpx;
  851. box-sizing: border-box;
  852. padding: 26rpx 0;
  853. background-color: #ffffff;
  854. border-bottom: 1px solid #e1e1e1;
  855. .item-icon {
  856. width: 48rpx;
  857. height: 48rpx;
  858. float: left;
  859. text-align: center;
  860. line-height: 48rpx;
  861. margin-right: 20rpx;
  862. .iconfont {
  863. font-size: 48rpx;
  864. }
  865. .icon-weixinzhifu {
  866. color: #0abc64;
  867. }
  868. .icon-gerenwangyinzhifu {
  869. color: #16afe8;
  870. }
  871. .icon-qiyewangyinzhifu {
  872. color: #007acc;
  873. }
  874. .icon-daewangyinzhuanzhang {
  875. color: #004889;
  876. font-size: $font-size-38;
  877. }
  878. }
  879. .item-texts {
  880. line-height: 48rpx;
  881. font-size: $font-size-28;
  882. color: $text-color;
  883. float: left;
  884. &.add {
  885. font-weight: bold;
  886. }
  887. }
  888. .item-checked {
  889. width: 48rpx;
  890. height: 48rpx;
  891. float: right;
  892. text-align: center;
  893. line-height: 48rpx;
  894. font-size: $font-size-40;
  895. color: #ffffff;
  896. .icon-weixuanze {
  897. color: #b2b2b2;
  898. }
  899. .icon-yixuanze3 {
  900. color: #ff5b00;
  901. }
  902. .icon-xiayibu {
  903. color: #b2b2b2;
  904. }
  905. }
  906. }
  907. }
  908. }
  909. .pay-statustext {
  910. width: 100%;
  911. height: auto;
  912. float: left;
  913. margin-top: 40rpx;
  914. padding-bottom: 160rpx;
  915. .pay-statustext-inner {
  916. width: 662rpx;
  917. height: 80rpx;
  918. margin: 0 auto;
  919. border: 1px solid #cccccc;
  920. padding: 20rpx;
  921. border-radius: 8rpx;
  922. .pay-icon {
  923. width: 62rpx;
  924. height: 100%;
  925. float: left;
  926. text-align: center;
  927. .iconfont {
  928. color: #999999;
  929. font-size: $font-size-36;
  930. line-height: 20rpx;
  931. }
  932. }
  933. .pay-text {
  934. width: 560rpx;
  935. height: 100%;
  936. float: left;
  937. line-height: 40rpx;
  938. font-size: $font-size-24;
  939. color: #999999;
  940. text-align: justify;
  941. }
  942. }
  943. }
  944. }
  945. .pay-button {
  946. width: 600rpx;
  947. background-color: #ffffff;
  948. position: fixed;
  949. height: 88rpx;
  950. padding: 24rpx 75rpx 0 75rpx;
  951. bottom: 0;
  952. .btn {
  953. width: 100%;
  954. height: 88rpx;
  955. border-radius: 44rpx;
  956. font-size: $font-size-28;
  957. line-height: 88rpx;
  958. color: #ffffff;
  959. margin: 0 auto;
  960. text-align: center;
  961. background: $btn-confirm;
  962. &.disabled {
  963. background: #e1e1e1 !important;
  964. }
  965. }
  966. }
  967. }
  968. .freight-alert {
  969. width: 100%;
  970. height: 100%;
  971. background: rgba(0, 0, 0, 0.5);
  972. position: fixed;
  973. top: 0;
  974. left: 0;
  975. z-index: 8888;
  976. transition: all 0.4s;
  977. &.none {
  978. display: none;
  979. }
  980. &.show {
  981. display: block;
  982. }
  983. .content {
  984. width: 422rpx;
  985. height: 434rpx;
  986. position: absolute;
  987. background: $bg-color;
  988. left: 0;
  989. right: 0;
  990. bottom: 0;
  991. top: 0;
  992. margin: auto;
  993. padding: 20rpx 32rpx;
  994. border-radius: 12rpx;
  995. .title {
  996. width: 100%;
  997. height: 68rpx;
  998. line-height: 68rpx;
  999. font-size: $font-size-28;
  1000. color: $text-color;
  1001. text-align: center;
  1002. position: relative;
  1003. .icon-iconfontguanbi {
  1004. width: 68rpx;
  1005. height: 68rpx;
  1006. text-align: center;
  1007. line-height: 68rpx;
  1008. position: absolute;
  1009. right: 0;
  1010. top: 0;
  1011. font-size: $font-size-36;
  1012. color: #999999;
  1013. }
  1014. }
  1015. .text-content {
  1016. width: 100%;
  1017. height: auto;
  1018. .text {
  1019. padding: 20rpx 0 0 0;
  1020. line-height: 44rpx;
  1021. font-size: $font-size-26;
  1022. color: #666666;
  1023. text-align: justify;
  1024. }
  1025. .text-p {
  1026. width: 100%;
  1027. line-height: 44rpx;
  1028. font-size: $font-size-26;
  1029. color: $color-system;
  1030. text-align: left;
  1031. text-overflow: ellipsis;
  1032. display: -webkit-box;
  1033. word-break: break-all;
  1034. -webkit-box-orient: vertical;
  1035. -webkit-line-clamp: 1;
  1036. overflow: hidden;
  1037. }
  1038. .text-b {
  1039. line-height: 44rpx;
  1040. font-size: $font-size-24;
  1041. color: #999999;
  1042. text-align: left;
  1043. }
  1044. }
  1045. .text-button {
  1046. width: 100%;
  1047. height: 88rpx;
  1048. line-height: 88rpx;
  1049. background: $btn-confirm;
  1050. font-size: $font-size-28;
  1051. border-radius: 44rpx;
  1052. color: #ffffff;
  1053. text-align: center;
  1054. margin-top: 20rpx;
  1055. }
  1056. }
  1057. }
  1058. .tui-prompt-title {
  1059. width: 100%;
  1060. height: 44rpx;
  1061. line-height: 44rpx;
  1062. padding: 10rpx 0;
  1063. text-align: center;
  1064. color: #333333;
  1065. font-weight: 600;
  1066. position: relative;
  1067. .icon-iconfontguanbi {
  1068. width: 68rpx;
  1069. height: 68rpx;
  1070. text-align: center;
  1071. line-height: 68rpx;
  1072. position: absolute;
  1073. right: 0;
  1074. top: 0;
  1075. font-size: $font-size-36;
  1076. color: #999999;
  1077. }
  1078. }
  1079. .tui-prompt-text {
  1080. padding-top: 20rpx;
  1081. .tui-prompt-tips {
  1082. width: 100%;
  1083. line-height: 36rpx;
  1084. font-size: $font-size-26;
  1085. color: #ff5b00;
  1086. text-align: justify;
  1087. margin-bottom: 30rpx;
  1088. }
  1089. .tui-prompt-item {
  1090. width: 100%;
  1091. line-height: 60rpx;
  1092. color: #333333;
  1093. font-size: $font-size-28;
  1094. position: relative;
  1095. .text {
  1096. font-weight: bold;
  1097. }
  1098. }
  1099. }
  1100. .tui-prompt-flex {
  1101. width: 100%;
  1102. height: auto;
  1103. margin-top: 40rpx;
  1104. box-sizing: border-box;
  1105. display: flex;
  1106. justify-content: center;
  1107. align-items: center;
  1108. .btn {
  1109. padding: 0 44rpx;
  1110. line-height: 66rpx;
  1111. font-size: $font-size-26;
  1112. text-align: center;
  1113. color: #ffffff;
  1114. border-radius: 40rpx;
  1115. box-sizing: border-box;
  1116. margin-left: 12rpx;
  1117. &.btn-cancel {
  1118. background: #ffffff;
  1119. color: #333333;
  1120. border: 1px solid #979797;
  1121. }
  1122. &.btn-confirm {
  1123. background: #ffffff;
  1124. color: #333333;
  1125. border: 1px solid #979797;
  1126. }
  1127. }
  1128. }
  1129. </style>