洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
5.0 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
7 months ago
10 months ago
7 months ago
10 months ago
10 months ago
7 months ago
7 months ago
10 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
10 months ago
10 months ago
7 months ago
10 months ago
10 months ago
7 months ago
10 months ago
7 months ago
10 months ago
10 months ago
7 months ago
10 months ago
7 months ago
10 months ago
10 months ago
10 months ago
7 months ago
10 months ago
10 months ago
7 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="pad">
  4. <view class="card">
  5. <view class="orderInfo">
  6. <view class="schoolName">{{schoolName}}</view>
  7. <view class="price">
  8. <text class="uint" v-if="amount"></text>{{ $u.utils.priceTo(amount) }}
  9. </view>
  10. <!-- <view class="num">交易单号65465879312</view> -->
  11. </view>
  12. <!-- <view class="li border">
  13. amount
  14. <view class="val"> {{info.a}}</view>
  15. </view> -->
  16. <!-- <view class="li">
  17. <view class="lab">订单编号</view>
  18. <view class="val">{{info.a}}</view>
  19. </view> -->
  20. </view>
  21. </view>
  22. <view class="footerBtn pad">
  23. <view class="btnBg" @click="$u.debounce(getStudentByPayment, 1000)">确认支付</view>
  24. <!-- <view class="btnBg" @click="paySubmit">确认支付</view> -->
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. getStudentByPayment, pre_create, param_sign,course_info
  32. } from '@/config/api.js'
  33. export default {
  34. data() {
  35. return {
  36. trainingApplyId: '',
  37. info: {
  38. a: '待对接'
  39. },
  40. schoolName: '',
  41. amount: '0',
  42. }
  43. },
  44. onLoad(options) {
  45. if (options.trainingApplyId) {
  46. this.trainingApplyId = options.trainingApplyId
  47. }
  48. // this.getYSBLink()
  49. this.course_infoFn()
  50. this.initWx()
  51. },
  52. onPullDownRefresh() {
  53. // this.getStudentByPayment()
  54. },
  55. methods: {
  56. // 初始化微信分享方法
  57. initWx() {
  58. // #ifdef APP-PLUS
  59. plus.share.getServices((s) => {
  60. var shares = {};
  61. for (var i = 0; i < s.length; i++) {
  62. var t = s[i];
  63. console.log("...........", t);
  64. shares[t.id] = t;
  65. }
  66. var sweixin = shares['weixin'];
  67. this.sweixin = sweixin
  68. }, function(e) {
  69. console.log("获取分享服务列表失败:" + e.message);
  70. });
  71. // #endif
  72. },
  73. // 获取订单信息
  74. async course_infoFn() {
  75. console.log('获取订单信息')
  76. console.log(this.trainingApplyId)
  77. const {data: res} = await course_info({trainingApplyId: this.trainingApplyId})
  78. this.amount = res.amount
  79. this.schoolName = res.schoolName
  80. },
  81. // 1,下订单
  82. async getStudentByPayment(type) {
  83. console.log('来到了这没有')
  84. const {
  85. data: res
  86. } = await pre_create({
  87. trainingApplyId: this.trainingApplyId
  88. })
  89. console.log('创建的订单信息')
  90. console.log(res)
  91. this.param_sign(res.orderNo)
  92. },
  93. // 2,加密数据
  94. async param_sign(outOrderNo) {
  95. let obj = {
  96. outOrderNo,
  97. timestamp: Date.now()
  98. }
  99. console.log(JSON.stringify(obj))
  100. const {data: res} = await param_sign({jsonParam:JSON.stringify(obj)})
  101. console.log('加密后的数据')
  102. console.log(res.encodeData)
  103. this.getYSBLink(res.encodeData, outOrderNo)
  104. },
  105. // 3,生成h5链接 这个商户号与生产地址应该由后端传来的,会变
  106. async getYSBLink(encodeData, outTradeNo) {
  107. if(!encodeData) return this.$u.toast('没有获取到支付信息')
  108. const channelNo = 'QD202404083509';
  109. //common普通的h5平台,如果当前的运行环境为微信小程序则platform的值为pay_miniPro
  110. const platform = 'common';
  111. //易收宝H5的前端页面地址,不同的环境详见第四章第4节
  112. // 测试地址
  113. // const preUrl = 'https://ft1wbs.zyebank.cn/cem_ysb_ft2/index.html'
  114. const preUrl = 'https://u8wbs.zyebank.cn/cem_ysb_u8/index.html'
  115. // 生产地址
  116. // const preUrl = 'https://zmcht.zybank.com.cn/cem_ysb/index.html';
  117. const distinctId = this.userId //惟一标识
  118. const payLink = `${preUrl}?encodeData=${encodeData}#/checkStandPre?platform=${platform}&channelNo=${channelNo}&checkStand_v3=true&distinctId=${distinctId}`;
  119. console.log('第三方收银台')
  120. console.log(payLink)
  121. this.$store.commit('updateWebVeiwUrl', payLink)
  122. this.$goPage('/pages/indexEntry/enroll/payment/payh5?outTradeNo='+ outTradeNo)
  123. },
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .pageBg {
  129. overflow: hidden;
  130. }
  131. .card {
  132. width: 100%;
  133. margin: 50rpx 0;
  134. padding: 40rpx 20rpx;
  135. .orderInfo {
  136. text-align: center;
  137. .schoolName {
  138. font-size: 28rpx;
  139. color: #ccc;
  140. padding: 40rpx 0 20rpx 0;
  141. }
  142. .price {
  143. font-size: 72rpx;
  144. font-weight: 600;
  145. text.uint {
  146. font-size: 44rpx;
  147. font-weight: 600;
  148. }
  149. }
  150. .num {
  151. font-size: 24rpx;
  152. color: #ADADAD;
  153. }
  154. }
  155. .li {
  156. display: flex;
  157. height: 88rpx;
  158. line-height: 88rpx;
  159. &.border {
  160. border-bottom: 1px solid #F6F7FA;
  161. }
  162. .lab {
  163. color: #ccc;
  164. width: 230rpx;
  165. }
  166. .val {
  167. font-weight: 500;
  168. flex: 1;
  169. text-align: right;
  170. }
  171. }
  172. }
  173. .pay {
  174. .h2 {
  175. font-size: 32rpx;
  176. font-weight: 500;
  177. margin-bottom: 24rpx;
  178. }
  179. .row {
  180. display: flex;
  181. justify-content: space-between;
  182. align-items: center;
  183. height: 88rpx;
  184. &.border {
  185. border-bottom: 1px solid #F6F7FA;
  186. }
  187. .wxIcon {
  188. width: 40rpx;
  189. height: 40rpx;
  190. }
  191. .text {
  192. margin-left: 20rpx;
  193. flex: 1;
  194. text-align: left;
  195. font-size: 28rpx;
  196. color: #333;
  197. }
  198. .icon {
  199. width: 40rpx;
  200. height: 40rpx;
  201. }
  202. }
  203. }
  204. </style>