洛阳学员端
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.

223 lines
4.9 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 months ago
8 months ago
10 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
10 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 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="getStudentByPayment()">确认支付</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. const {data: res} = await course_info({trainingApplyId: this.trainingApplyId})
  76. this.amount = res.amount
  77. this.schoolName = res.schoolName
  78. },
  79. // 1,下订单
  80. async getStudentByPayment(type) {
  81. console.log('来到了这没有')
  82. const {
  83. data: res
  84. } = await pre_create({
  85. trainingApplyId: this.trainingApplyId
  86. })
  87. console.log('创建的订单信息')
  88. console.log(res)
  89. this.param_sign(res.orderNo)
  90. },
  91. // 2,加密数据
  92. async param_sign(outOrderNo) {
  93. let obj = {
  94. outOrderNo,
  95. timestamp: Date.now()
  96. }
  97. console.log(JSON.stringify(obj))
  98. const {data: res} = await param_sign({jsonParam:JSON.stringify(obj)})
  99. console.log('加密后的数据')
  100. console.log(res.encodeData)
  101. this.getYSBLink(res.encodeData, outOrderNo)
  102. },
  103. // 3,生成h5链接 这个商户号与生产地址应该由后端传来的,会变
  104. async getYSBLink(encodeData, outTradeNo) {
  105. if(!encodeData) return this.$u.toast('没有获取到支付信息')
  106. const channelNo = 'QD202404083509';
  107. //common普通的h5平台,如果当前的运行环境为微信小程序则platform的值为pay_miniPro
  108. const platform = 'common';
  109. //易收宝H5的前端页面地址,不同的环境详见第四章第4节
  110. // 测试地址
  111. // const preUrl = 'https://ft1wbs.zyebank.cn/cem_ysb_ft2/index.html'
  112. const preUrl = 'https://u8wbs.zyebank.cn/cem_ysb_u8/index.html'
  113. // 生产地址
  114. // const preUrl = 'https://zmcht.zybank.com.cn/cem_ysb/index.html';
  115. const distinctId = this.userId //惟一标识
  116. const payLink = `${preUrl}?encodeData=${encodeData}#/checkStandPre?platform=${platform}&channelNo=${channelNo}&checkStand_v3=true&distinctId=${distinctId}`;
  117. console.log('第三方收银台')
  118. console.log(payLink)
  119. this.$store.commit('updateWebVeiwUrl', payLink)
  120. this.$goPage('/pages/indexEntry/enroll/payment/payh5?outTradeNo='+ outTradeNo)
  121. },
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .pageBg {
  127. overflow: hidden;
  128. }
  129. .card {
  130. width: 100%;
  131. margin: 50rpx 0;
  132. padding: 40rpx 20rpx;
  133. .orderInfo {
  134. text-align: center;
  135. .schoolName {
  136. font-size: 28rpx;
  137. color: #ccc;
  138. padding: 40rpx 0 20rpx 0;
  139. }
  140. .price {
  141. font-size: 72rpx;
  142. font-weight: 600;
  143. text.uint {
  144. font-size: 44rpx;
  145. font-weight: 600;
  146. }
  147. }
  148. .num {
  149. font-size: 24rpx;
  150. color: #ADADAD;
  151. }
  152. }
  153. .li {
  154. display: flex;
  155. height: 88rpx;
  156. line-height: 88rpx;
  157. &.border {
  158. border-bottom: 1px solid #F6F7FA;
  159. }
  160. .lab {
  161. color: #ccc;
  162. width: 230rpx;
  163. }
  164. .val {
  165. font-weight: 500;
  166. flex: 1;
  167. text-align: right;
  168. }
  169. }
  170. }
  171. .pay {
  172. .h2 {
  173. font-size: 32rpx;
  174. font-weight: 500;
  175. margin-bottom: 24rpx;
  176. }
  177. .row {
  178. display: flex;
  179. justify-content: space-between;
  180. align-items: center;
  181. height: 88rpx;
  182. &.border {
  183. border-bottom: 1px solid #F6F7FA;
  184. }
  185. .wxIcon {
  186. width: 40rpx;
  187. height: 40rpx;
  188. }
  189. .text {
  190. margin-left: 20rpx;
  191. flex: 1;
  192. text-align: left;
  193. font-size: 28rpx;
  194. color: #333;
  195. }
  196. .icon {
  197. width: 40rpx;
  198. height: 40rpx;
  199. }
  200. }
  201. }
  202. </style>