geRenHuiFeiJiaoJiao.vue 5.0 KB

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