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

231 lines
5.1 KiB

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