daiJiaoDanWeiChaXunJieGuo.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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.name }}
  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 { dept, deptPayment } from '@/api/cost.js'
  68. import { msgError } from '../../utils/common'
  69. import { useAuthStore } from '@/store/authStore'
  70. const authStore = useAuthStore()
  71. const openid = ref('')
  72. const info = ref({
  73. name: '某某某机构', // 机构名称
  74. payProject: '2024年度普通会员单位会费', // 支付项目
  75. type: '普通会员单位会费', // 类型
  76. year: '2024', // 年份
  77. price: '1000', // 金额
  78. periodOfValidity: '2024.1.1-2024.12.31',
  79. userIds: null,
  80. remark: '根据《协会章程》规定,会费标准如下:<br/>1、副会长单位:50000元/年;<br/>2、常务理事及理事单位:10000元/年;<br/>3、普通会员单位:1000元/年;单位会员会籍为每年1月1日至12月31日。<br/>会员可享受以下权利:<br/>1、协会的选举权、被选举权和表决权;<br/>2、优先参加协会组织开展的各类活动;<br/>3、获得协会服务的优先权;<br/>4、对协会工作的批评建议权和监督权;<br/>5、请求协会维护合法权益;<br/>6、入会自愿、退会自由。'
  81. })
  82. const params = ref({
  83. timeStamp: '',
  84. nonceStr: '',
  85. package: '',
  86. signType: '',
  87. paySign: '',
  88. })
  89. function onSubmit() {
  90. wx.requestPayment({
  91. timeStamp: params.value.timeStamp,
  92. nonceStr: params.value.nonceStr,
  93. package: params.value.package,
  94. signType: params.value.signType,
  95. paySign: params.value.paySign,
  96. success (res) {
  97. msgSuccess('支付成功')
  98. uni.navigateBack()
  99. },
  100. fail (res) {
  101. // console.log('支付失败', res)
  102. const errMsg = res.errMsg
  103. if (errMsg.indexOf('fail cancel')) {
  104. msgError('已取消支付')
  105. }
  106. }
  107. })
  108. }
  109. onLoad((load) => {
  110. const name = load.name
  111. const year = load.year
  112. const number = load.number
  113. const price = load.price
  114. const type = Number(price) > 10000 ? '副会长单位' : Number(price) > 1000 ? '常务理事及理事单位' : '普通会员单位'
  115. const userId = load.userId
  116. openid.value = uni.getStorageSync('openid')
  117. info.value = {
  118. name: name, // 机构名称
  119. payProject: `${year}年度${type}会费`, // 支付项目
  120. type: `${type}会费`, // 类型
  121. year, // 年份
  122. price, // 金额
  123. periodOfValidity: `${year}.1.1-${year}.12.31`,
  124. userId,
  125. remark: '根据《协会章程》规定,会费标准如下:<br/>1、副会长单位:50000元/年;<br/>2、常务理事及理事单位:10000元/年;<br/>3、普通会员单位:1000元/年;单位会员会籍为每年1月1日至12月31日。<br/>会员可享受以下权利:<br/>1、协会的选举权、被选举权和表决权;<br/>2、优先参加协会组织开展的各类活动;<br/>3、获得协会服务的优先权;<br/>4、对协会工作的批评建议权和监督权;<br/>5、请求协会维护合法权益;<br/>6、入会自愿、退会自由。'
  126. }
  127. const form = {
  128. title: `${info.value.payProject}代缴`,
  129. year: info.value.year,
  130. amount: info.value.price,
  131. desc: `${info.value.payProject}代缴`,
  132. userId: info.value.userId,
  133. openid: openid.value
  134. }
  135. deptPayment(form).then(res => {
  136. if (res && res.message === 'success') {
  137. params.value = res.data
  138. console.log('支付参数', params.value)
  139. } else {
  140. msgError(res.message)
  141. uni.navigateBack()
  142. }
  143. })
  144. })
  145. </script>
  146. <style lang="scss" scoped>
  147. .container {
  148. height: 100vh;
  149. width: 100vw;
  150. background-color: $uni-bg-color;
  151. padding: 20rpx;
  152. .info-box {
  153. padding: 30rpx;
  154. background-color: $uni-bg-color-grey;
  155. border-radius: $uni-card-border-radius;
  156. .info-item-box {
  157. font-size: $uni-title-font-size-2;
  158. border-bottom: 1rpx solid #E6E6E6;
  159. height: 82rpx;
  160. .label {
  161. font-weight: bold;
  162. }
  163. }
  164. .flex {
  165. display: flex;
  166. align-items: center;
  167. .label {
  168. width: 30%;
  169. }
  170. .text {
  171. width: 70%;
  172. }
  173. }
  174. .row {
  175. .label {
  176. line-height: 62rpx;
  177. }
  178. .text {
  179. line-height: 42rpx;
  180. font-size: $uni-title-font-size-3;
  181. font-weight: bold;
  182. }
  183. }
  184. }
  185. .bottom-box {
  186. padding: 20rpx;
  187. position: absolute;
  188. bottom: 50rpx;
  189. width: 95%;
  190. }
  191. }
  192. </style>