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

228 lines
5.0 KiB

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