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

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