daiJiaoDanWeiChaXunJieGuo.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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>
  53. <view class="info-item-box row" style="padding: 20rpx;">
  54. <view class="label">
  55. 描述:
  56. </view>
  57. <view class="text" v-html="info.remark"></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. giver: "",
  82. giverPhone: ""
  83. })
  84. const params = ref({
  85. timeStamp: '',
  86. nonceStr: '',
  87. package: '',
  88. signType: '',
  89. paySign: '',
  90. })
  91. function onSubmit() {
  92. // 支付写了,但是没有测试
  93. const {giver, giverPhone} = info.value
  94. const form = {
  95. title: `${info.value.payProject}代缴`,
  96. year: info.value.year,
  97. amount: info.value.price,
  98. desc: `${info.value.payProject}代缴`,
  99. userId: info.value.userId,
  100. openid: openid.value,
  101. giver,
  102. giverPhone
  103. }
  104. // console.log(form)
  105. deptPayment(form).then(res => {
  106. if (res && res.code === 0) {
  107. params.value = res.data
  108. wx.requestPayment({
  109. timeStamp: params.value.timeStamp,
  110. nonceStr: params.value.nonceStr,
  111. package: params.value.package,
  112. signType: params.value.signType,
  113. paySign: params.value.paySign,
  114. success (res) {
  115. msgSuccess('支付成功')
  116. uni.navigateBack()
  117. },
  118. fail (res) {
  119. // console.log('支付失败', res)
  120. const errMsg = res.errMsg
  121. if (errMsg.indexOf('fail cancel')) {
  122. msgError('已取消支付')
  123. }
  124. }
  125. })
  126. } else {
  127. msgError(res.message)
  128. uni.navigateBack()
  129. }
  130. })
  131. }
  132. onLoad((load) => {
  133. const name = load.name
  134. const year = load.year
  135. const number = load.number
  136. const price = load.price
  137. const type = Number(price) > 10000 ? '副会长单位' : Number(price) > 1000 ? '常务理事及理事单位' : '普通会员单位'
  138. const userId = load.userId
  139. openid.value = uni.getStorageSync('openid')
  140. const giver = load.giver
  141. const giverPhone = load.giverPhone
  142. info.value = {
  143. name: name, // 机构名称
  144. payProject: `${year}年度${type}会费`, // 支付项目
  145. type: `${type}会费`, // 类型
  146. year, // 年份
  147. price, // 金额
  148. periodOfValidity: `${year}.1.1-${year}.12.31`,
  149. userId,
  150. 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、入会自愿、退会自由。',
  151. giver,
  152. giverPhone
  153. }
  154. // console.log(info.value)
  155. })
  156. </script>
  157. <style lang="scss" scoped>
  158. .container {
  159. height: 100vh;
  160. width: 100vw;
  161. background-color: $uni-bg-color;
  162. padding: 20rpx;
  163. .info-box {
  164. padding: 30rpx;
  165. background-color: $uni-bg-color-grey;
  166. border-radius: $uni-card-border-radius;
  167. .info-item-box {
  168. font-size: $uni-title-font-size-2;
  169. border-bottom: 1rpx solid #E6E6E6;
  170. height: 82rpx;
  171. .label {
  172. font-weight: bold;
  173. }
  174. }
  175. .flex {
  176. display: flex;
  177. align-items: center;
  178. .label {
  179. width: 30%;
  180. }
  181. .text {
  182. width: 70%;
  183. }
  184. }
  185. .row {
  186. .label {
  187. line-height: 62rpx;
  188. }
  189. .text {
  190. line-height: 42rpx;
  191. font-size: $uni-title-font-size-3;
  192. font-weight: bold;
  193. }
  194. }
  195. }
  196. .bottom-box {
  197. padding: 20rpx;
  198. position: absolute;
  199. bottom: 50rpx;
  200. width: 95%;
  201. }
  202. }
  203. </style>