geRenHuiFeiJiaoJiao.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="container">
  3. <view class="info-box">
  4. <view class="info-item-box flex">
  5. <view class="label">
  6. 用户名
  7. </view>
  8. <view class="text">
  9. {{ info.username }}
  10. </view>
  11. </view>
  12. <view class="info-item-box flex">
  13. <view class="label">
  14. 支付项目
  15. </view>
  16. <view class="text">
  17. {{ info.payProject }}
  18. </view>
  19. </view>
  20. <view class="info-item-box flex">
  21. <view class="label">
  22. 类型
  23. </view>
  24. <view class="text">
  25. {{ info.type }}
  26. </view>
  27. </view>
  28. <view class="info-item-box flex">
  29. <view class="label">
  30. 年份
  31. </view>
  32. <view class="text">
  33. {{ info.year }}年
  34. </view>
  35. </view>
  36. <view class="info-item-box flex">
  37. <view class="label">
  38. 金额
  39. </view>
  40. <view class="text">
  41. {{ info.price }}元
  42. </view>
  43. </view>
  44. <view class="info-item-box flex">
  45. <view class="label">
  46. 会籍有效期
  47. </view>
  48. <view class="text">
  49. {{ info.periodOfValidity }}
  50. </view>
  51. </view>
  52. <view class="info-item-box row">
  53. <view class="label">
  54. 描述:
  55. </view>
  56. <view class="text" v-html="info.remark"></view>
  57. </view>
  58. </view>
  59. <view class="bottom-box">
  60. <u-button type="error" shape="circle" @click="onSubmit">支付</u-button>
  61. </view>
  62. </view>
  63. </template>
  64. <script setup>
  65. import { ref } from 'vue'
  66. import { onLoad } from '@dcloudio/uni-app'
  67. import { useAuthStore } from '@/store/authStore'
  68. import { personPayment } from '@/api/cost.js'
  69. import { msgError, msgSuccess } from '../../utils/common'
  70. const authStore = useAuthStore()
  71. const openid = ref('')
  72. // 用户信息
  73. const user = ref({
  74. userIcon: '1',
  75. name: '某某某',
  76. corpName: '广州市xx地产有限公司',
  77. corpRegNo: '123xxxx'
  78. })
  79. const info = ref({
  80. username: '某某某',
  81. payProject: '2024年度个人会费',
  82. type: '个人会费',
  83. year: 2024,
  84. price: 200,
  85. periodOfValidity: '2024.05.1-2025.4.30',
  86. remark: '根据《协会章程》规定,个人会费200元/年/人,会员会籍为每年5月1日至4月30日。<br/>个人会员可享受以下会员服务:<br/>1、免费使用网络教育培训系统【系统已上线121个视频课程77本电子书,涵盖:政策法规、职业素养、商务礼仪、客户服务销售技能、市场营销、团队管理、办公软件等多个知识领域】<br/>2、优先优惠参加协会组织的公开培训课<br/>更多优惠请关注协会微信号【gzreavip】'
  87. })
  88. function onSubmit() {
  89. const form = {
  90. title: info.value.payProject,
  91. year: info.value.year,
  92. amount: info.value.price,
  93. desc: info.value.payProject,
  94. openid: openid.value
  95. }
  96. personPayment(form).then(res => {
  97. if (res && res.message === 'success') {
  98. const params = res.data
  99. wx.requestPayment({
  100. timeStamp: params.timeStamp,
  101. nonceStr: params.nonceStr,
  102. package: params.package,
  103. signType: params.signType,
  104. paySign: params.paySign,
  105. success (res) {
  106. msgSuccess('支付成功')
  107. uni.navigateBack()
  108. },
  109. fail (res) {
  110. // console.log('支付失败', res)
  111. const errMsg = res.errMsg
  112. if (errMsg.indexOf('fail cancel')) {
  113. msgError('已取消支付')
  114. }
  115. }
  116. })
  117. } else {
  118. msgError(res.message)
  119. uni.navigateBack()
  120. }
  121. })
  122. }
  123. onLoad((load) => {
  124. user.value = authStore.userInfo
  125. openid.value = uni.getStorageSync('openid')
  126. info.value = {
  127. username: user.value.name,
  128. payProject: `${load.year}年度个人会费`,
  129. type: '个人会费',
  130. year: Number(load.year),
  131. price: Number(load.duePrice),
  132. periodOfValidity: `${Number(load.year)}.05.1-${Number(load.year) + 1}.4.30`,
  133. remark: '根据《协会章程》规定,个人会费200元/年/人,会员会籍为每年5月1日至4月30日。<br/>个人会员可享受以下会员服务:<br/>1、免费使用网络教育培训系统【系统已上线121个视频课程77本电子书,涵盖:政策法规、职业素养、商务礼仪、客户服务销售技能、市场营销、团队管理、办公软件等多个知识领域】<br/>2、优先优惠参加协会组织的公开培训课<br/>更多优惠请关注协会微信号【gzreavip】'
  134. }
  135. })
  136. </script>
  137. <style lang="scss" scoped>
  138. .container {
  139. height: 100vh;
  140. width: 100vw;
  141. background-color: $uni-bg-color;
  142. padding: 20rpx;
  143. .info-box {
  144. padding: 30rpx;
  145. background-color: $uni-bg-color-grey;
  146. border-radius: $uni-card-border-radius;
  147. .info-item-box {
  148. font-size: $uni-title-font-size-2;
  149. border-bottom: 1rpx solid #E6E6E6;
  150. height: 82rpx;
  151. .label {
  152. font-weight: bold;
  153. }
  154. }
  155. .flex {
  156. display: flex;
  157. align-items: center;
  158. .label {
  159. width: 30%;
  160. }
  161. .text {
  162. width: 70%;
  163. }
  164. }
  165. .row {
  166. .label {
  167. line-height: 62rpx;
  168. }
  169. .text {
  170. line-height: 42rpx;
  171. font-size: $uni-title-font-size-3;
  172. font-weight: bold;
  173. }
  174. }
  175. }
  176. .bottom-box {
  177. padding: 20rpx;
  178. position: absolute;
  179. bottom: 50rpx;
  180. width: 95%;
  181. }
  182. }
  183. </style>