兼兼街公众号代码
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.

281 lines
6.0 KiB

  1. <template>
  2. <view class="buy-course">
  3. <view class="course-box ">
  4. <view class="course-box-item flex">
  5. <u--image :showLoading="true" :src="dataInfo.photo" width="281rpx" height="178rpx"></u--image>
  6. <view class="box-right">
  7. <view class="active-title">{{dataInfo.title}}</view>
  8. <view class="active-time">
  9. <!-- <u-icon size="40" name="https://cdn.uviewui.com/uview/example/button.png"></u-icon> -->
  10. <text>{{dataInfo.activityTime}}</text>
  11. </view>
  12. <view class="active-add">
  13. <text>{{dataInfo.place}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="from-box">
  19. <view class="from-title">填写报名人信息</view>
  20. <u--form
  21. labelPosition="left"
  22. :model="userInfo"
  23. ref="form1"
  24. labelWidth="80"
  25. :labelStyle="formLabelStyle"
  26. >
  27. <u-form-item
  28. label="姓名:"
  29. borderBottom
  30. ref="item1"
  31. >
  32. <u--input
  33. v-model="userInfo.name"
  34. border="none"
  35. placeholder="请输入姓名"
  36. ></u--input>
  37. </u-form-item>
  38. <u-form-item
  39. label="联系电话:"
  40. borderBottom
  41. ref="item1"
  42. >
  43. <u--input
  44. v-model="userInfo.phone"
  45. border="none"
  46. placeholder="请输入手机号码"
  47. type="number"
  48. ></u--input>
  49. </u-form-item>
  50. <u-form-item
  51. label="公司名称:"
  52. borderBottom
  53. ref="item1"
  54. >
  55. <u--input
  56. v-model="userInfo.companyName"
  57. border="none"
  58. placeholder="请输入公司名称"
  59. ></u--input>
  60. </u-form-item>
  61. <u-form-item
  62. label="公司职务"
  63. borderBottom
  64. ref="item1"
  65. >
  66. <u--input
  67. v-model="userInfo.companyPost"
  68. border="none"
  69. placeholder="请输入所在公司职务名称"
  70. ></u--input>
  71. </u-form-item>
  72. </u--form>
  73. </view>
  74. <view class="pay-box">
  75. <view class="pay-price flex align-center justify-between">
  76. <view class="pay-price-tip">费用</view>
  77. <view>
  78. <text class="unit"></text>
  79. <text>{{dataInfo.money}}</text>
  80. </view>
  81. </view>
  82. <view class="pay-type flex flex-column align-center">
  83. <image src="../../static/img/pay-success.png" mode=""></image>
  84. <view>支付成功</view>
  85. </view>
  86. </view>
  87. </view>
  88. </template>
  89. <script>
  90. export default{
  91. data(){
  92. return{
  93. chooseType: 0,
  94. dataInfo: {},
  95. userInfo:{
  96. name:'',
  97. companyName:'',
  98. phone:'',
  99. companyPost:''
  100. },
  101. formLabelStyle:{
  102. color: '#707070',
  103. fontSize: '30rpx'
  104. },
  105. baomingStyle: {
  106. fontSize:"30rpx",
  107. fontWeight:"700",
  108. height: "100rpx"
  109. },
  110. payList: [
  111. {
  112. id:0,
  113. src:require('@/static/img/wechat-icon.png')
  114. },
  115. // {
  116. // id:1,
  117. // src:require('@/static/img/alipy-icon.png')
  118. // }
  119. ]
  120. }
  121. },
  122. onLoad(e) {
  123. this.getactivityFindById('1584923974407417857')
  124. },
  125. // 隐藏微信h5的标题栏
  126. onReady() {
  127. this.$com.displayNav()
  128. },
  129. methods:{
  130. choosePay(item){
  131. this.chooseType = item.id;
  132. },
  133. // apply(){
  134. // uni.redirectTo({
  135. // url:'/pages/home/pay-success'
  136. // })
  137. // },
  138. apply(){//添加报名信息
  139. let params = {
  140. activityId:'1565169118319157250',
  141. payType:this.chooseType,
  142. ...this.userInfo,
  143. }
  144. this.$api('saveEnroll',params)
  145. .then(res=>{
  146. if(res.code == 200){
  147. this.wxPay(res.result)
  148. }
  149. })
  150. },
  151. wxPay(id){
  152. this.$api('recharge',{id})
  153. .then(res=>{
  154. this.$jweixin.invoke(
  155. "getBrandWCPayRequest", {
  156. appId: res.result.appId, //公众号名称,由商户传入
  157. timeStamp: res.result.timeStamp, //时间戳,自1970年以来的秒数
  158. nonceStr: res.result.nonceStr, //随机串
  159. package: res.result.packageValue, //这个package是比较坑的他的格式必须是 prepay_id=wx22104854834640694c34f15a1066605800,是必须!!!!!!!!!!!!!!
  160. signType: res.result.signType, //微信签名方式
  161. paySign: res.result.paySign,//微信签名
  162. },
  163. function(res) {
  164. if (res.err_msg == "get_brand_wcpay_request:ok") {
  165. uni.showToast({
  166. title: '支付成功',
  167. icon: 'none',
  168. duration: 1500
  169. })
  170. // 使用以上方式判断前端返回,微信团队郑重提示:
  171. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  172. }
  173. }
  174. );
  175. })
  176. },
  177. getactivityFindById(id){
  178. uni.showLoading()
  179. this.$api('activityFindById',{id})
  180. .then(res=>{
  181. uni.hideLoading()
  182. if(res.code == 200){
  183. this.dataInfo = res.result;
  184. }
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .buy-course {
  192. .course-box {
  193. padding: 0 26rpx;
  194. .course-box-item {
  195. background: #ffffff;
  196. border-radius: 12rpx;
  197. box-shadow: 0px 3rpx 6rpx 0px rgba(0,0,0,0.16);
  198. padding: 33rpx 13rpx;
  199. .box-right {
  200. margin-left: 16rpx;
  201. .active-title {
  202. font-size: 30rpx;
  203. color: #000;
  204. line-height: 40rpx;
  205. overflow: hidden;
  206. display: -webkit-box;
  207. -webkit-box-orient: vertical;
  208. -webkit-line-clamp: 2;
  209. }
  210. .active-time {
  211. color: #707070;
  212. font-size: 26rpx;
  213. margin: 10rpx 0 14rpx 0;
  214. }
  215. .active-add {
  216. color: #707070;
  217. font-size: 26rpx;
  218. }
  219. }
  220. }
  221. }
  222. .from-box {
  223. padding: 0 26rpx;
  224. .from-title {
  225. font-size: 30rpx;
  226. color: #000;
  227. margin-top: 35rpx;
  228. margin-bottom: 15rpx;
  229. }
  230. }
  231. .pay-box {
  232. border-top: 20rpx solid #F5F5F5;
  233. padding: 0 26rpx;
  234. .pay-price {
  235. color: #D33D3E;
  236. font-size: 40rpx;
  237. font-weight: 700;
  238. padding: 47rpx 0 20rpx 0;
  239. border-bottom: 1px solid #E6E6E6;
  240. .pay-price-tip {
  241. color: #000000;
  242. font-size: 30rpx;
  243. font-weight: 400;
  244. }
  245. .unit {
  246. font-size: 30rpx;
  247. font-weight: 400;
  248. }
  249. }
  250. .pay-type {
  251. color: #20D76D;
  252. font-size: 30rpx;
  253. padding-top: 40rpx;
  254. image {
  255. width: 165rpx;
  256. height: 165rpx;
  257. margin-bottom: 42rpx;
  258. }
  259. }
  260. }
  261. }
  262. </style>