activeApplication.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <div class="activeApplication">
  3. <div class="appFirstBox">
  4. <img :src="url" class="firstImg"/>
  5. <div class="appTitle">
  6. <span class="titleName">{{ form.activityName }}</span>
  7. <span class="titleType">{{ form.statusName }}</span>
  8. </div>
  9. <div @tap.stop="clickColl()" class="joinBox">
  10. <span class="joinName">{{ form.registrationNumbers }}人参加</span>
  11. <span class="shoucang"><img :src="form.collectorsStatus==='2' ? heartSel : heart" class="scImg"/> 收藏</span>
  12. </div>
  13. <div class="contactBox">
  14. <span class="contackLeft">
  15. <span style="color: #666666;font-size: 28rpx">联系电话:</span>
  16. <span style="color: #18172A;font-size: 36rpx;font-weight: 600">{{ form.activityPhone }}</span>
  17. </span>
  18. <img src="https://www.idea-sf.com/gardenProduct/image/phoneIcon.png" class="phoneIcon" @tap="call">
  19. </div>
  20. </div>
  21. <div class="appSecondBox">
  22. <div class="secondBoxItem">
  23. <span class="secondBoxTitle">活动举办</span>
  24. <span class="secondBoxInfo">{{ form.activitiesNotice }}</span>
  25. </div>
  26. <div class="secondBoxItem">
  27. <span class="secondBoxTitle">活动内容</span>
  28. <span class="secondBoxInfo">{{ form.activityContent }}</span>
  29. </div>
  30. <div class="secondBoxItem">
  31. <span class="secondBoxTitle">活动时间</span>
  32. <span class="secondBoxInfo">{{ form.activityStartTime }} ~ {{ form.activityEndTime }}</span>
  33. </div>
  34. <div class="secondBoxItem">
  35. <span class="secondBoxTitle">活动地址</span>
  36. <span class="secondBoxInfo dhInfo">
  37. <span>{{ formattedAddress }}</span>
  38. <img src="./image/dhIcon.png" class="dhIcon" @tap="getLocal">
  39. </span>
  40. </div>
  41. <div class="secondBoxItem">
  42. <span class="secondBoxTitle">报名条件</span>
  43. <span class="secondBoxInfo">
  44. {{ form.registrationConditions }}
  45. </span>
  46. </div>
  47. <div class="secondBoxItem">
  48. <span class="secondBoxTitle">报名时间</span>
  49. <span class="secondBoxInfo">
  50. {{ form.registrationStartTime }} ~ {{ form.registrationEndTime }}
  51. </span>
  52. </div>
  53. <div class="secondBoxItem">
  54. <span class="secondBoxTitle">活动参与</span>
  55. <span class="secondBoxInfo">
  56. {{ form.activityQuota }}
  57. </span>
  58. </div>
  59. </div>
  60. <button v-if="!registrationFlag" class="bmBtn" @tap="toApplication">我要报名</button>
  61. <button v-if="registrationFlag" class="bmBtn2" @tap="toApplication">已报名</button>
  62. </div>
  63. </template>
  64. <script>
  65. import {getHomeCommunityActivityById, getByCodes, isRegistration, getUserLocalStorageInfo, homeActivityClickCollect} from "../../../js_sdk/http";
  66. export default {
  67. name: "activeApplication",
  68. data() {
  69. return {
  70. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  71. dc_key: ['activity_stat'],
  72. heartSel: "https://www.idea-sf.com/gardenProduct/image/heartSel.png",
  73. heart: "https://www.idea-sf.com/gardenProduct/image/heart.png",
  74. isColl: true,
  75. form: {},
  76. dic_SelectList: [],
  77. statusList: [],
  78. activityId: '',
  79. registrationFlag: false,
  80. url: ''
  81. }
  82. },
  83. created() {
  84. this.getByCodes()
  85. },
  86. onLoad(options) {
  87. this.activityId = options.activityId
  88. this.url = options.url
  89. this.getById()
  90. },
  91. computed: {
  92. formattedAddress() {
  93. // 检查两个地址字段是否都存在值
  94. const hasAddress = this.form.activityAddress && this.form.activityAddress.trim() !== '';
  95. const hasDetail = this.form.activityAddressDetail && this.form.activityAddressDetail.trim() !== '';
  96. // 根据是否存在值来拼接地址
  97. if (hasAddress && hasDetail) {
  98. return `${this.form.activityAddress} - ${this.form.activityAddressDetail}`;
  99. } else if (hasAddress) {
  100. return this.form.activityAddress;
  101. } else if (hasDetail) {
  102. return this.form.activityAddressDetail;
  103. } else {
  104. return ''; // 或者返回其他默认值
  105. }
  106. }
  107. },
  108. methods: {
  109. call(){
  110. uni.makePhoneCall({
  111. phoneNumber: this.form.activityPhone, // 电话号码
  112. success: function () {
  113. console.log('拨打电话成功');
  114. },
  115. fail: function () {
  116. console.log('拨打电话失败');
  117. }
  118. });
  119. },
  120. getLocal(){
  121. const _this = this
  122. uni.openLocation({
  123. latitude: Number(_this.form.latitude),
  124. longitude: Number(_this.form.longitude),
  125. success: function () {
  126. console.log('success');
  127. }
  128. });
  129. // uni.getLocation({
  130. // type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  131. // success: function (res) {
  132. // const latitude = res.latitude;
  133. // const longitude = res.longitude;
  134. //
  135. // }
  136. // });
  137. },
  138. getById(){
  139. const data = {
  140. id : this.activityId,
  141. createdBy: getUserLocalStorageInfo().userId,
  142. }
  143. getHomeCommunityActivityById(data).then(res => {
  144. if (res.errno === 0) {
  145. this.form = res.data
  146. this.statusList.forEach(item => {
  147. if (this.form.status == item.value) {
  148. this.form.statusName = item.label
  149. }
  150. })
  151. const data = {
  152. activityId: this.activityId,
  153. companyId: getUserLocalStorageInfo().userId
  154. }
  155. isRegistration(data).then(res => {
  156. if (res.errno === 0) {
  157. this.registrationFlag = res.data
  158. }
  159. })
  160. }
  161. })
  162. },
  163. async getByCodes() {
  164. let data = await getByCodes(JSON.stringify(this.dc_key));
  165. this.dic_SelectList = this.$common.handleDicList(data);
  166. this.statusList = this.dic_SelectList.activity_stat
  167. console.log('this.statusList', this.statusList)
  168. },
  169. clickColl() {
  170. if (this.form.collectorsStatus==='2'){
  171. this.form.collectorsStatus='1'
  172. }else{
  173. this.form.collectorsStatus='2'
  174. }
  175. homeActivityClickCollect({
  176. id: this.activityId,
  177. createdBy: getUserLocalStorageInfo().userId,
  178. collectorsStatus: this.form.collectorsStatus
  179. }).then(res => {
  180. });
  181. },
  182. toApplication() {
  183. uni.navigateTo({
  184. url: '/pages/subPackages/parkActivity/applicationInfo?activityId=' + this.form.id + "&registrationFlag=" + this.registrationFlag
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss">
  191. .activeApplication {
  192. padding-bottom: 120rpx;
  193. .appFirstBox {
  194. margin: 24rpx 0;
  195. padding: 24rpx 32rpx;
  196. background: white;
  197. display: flex;
  198. flex-direction: column;
  199. .firstImg {
  200. width: 686rpx;
  201. height: 300rpx;
  202. }
  203. .appTitle {
  204. display: flex;
  205. align-items: center;
  206. margin: 24rpx 0;
  207. .titleName {
  208. font-size: 32rpx;
  209. color: rgba(24, 23, 42, 1);
  210. }
  211. .titleType {
  212. background: rgba(3, 101, 249, 0.20);
  213. font-size: 28rpx;
  214. color: rgba(3, 101, 249, 1);
  215. width: 112rpx;
  216. height: 48rpx;
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. border-radius: 2px 2px 2px 2px;
  221. }
  222. }
  223. .joinBox {
  224. display: flex;
  225. justify-content: space-between;
  226. align-items: center;
  227. padding-bottom: 24rpx;
  228. .joinName {
  229. font-size: 28rpx;
  230. color: rgba(136, 136, 136, 1);
  231. }
  232. .shoucang {
  233. display: flex;
  234. align-items: center;
  235. font-size: 28rpx;
  236. color: rgba(24, 23, 42, 1);
  237. .scImg {
  238. width: 32rpx;
  239. height: 28rpx;
  240. margin-right: 8rpx;
  241. }
  242. }
  243. }
  244. .contactBox {
  245. display: flex;
  246. align-items: center;
  247. justify-content: space-between;
  248. padding: 24rpx 0;
  249. border-top: 1px solid #E6E6E6;
  250. .contackLeft {
  251. display: flex;
  252. align-items: center;
  253. }
  254. .phoneIcon {
  255. width: 64rpx;
  256. height: 64rpx;
  257. }
  258. }
  259. }
  260. .appSecondBox {
  261. padding: 32rpx;
  262. background: white;
  263. .secondBoxItem {
  264. display: flex;
  265. flex-direction: column;
  266. margin-bottom: 48rpx;
  267. .secondBoxTitle {
  268. color: #222222;
  269. font-size: 32rpx;
  270. font-weight: 600;
  271. margin-bottom: 16rpx;
  272. }
  273. .secondBoxInfo {
  274. font-size: 28rpx;
  275. color: #666666;
  276. line-height: 40rpx;
  277. }
  278. .dhInfo {
  279. display: flex;
  280. justify-content: space-between;
  281. .dhIcon {
  282. width: 36rpx;
  283. height: 36rpx;
  284. padding-left: 20rpx;
  285. border-left: 1px solid #E6E6E6;
  286. }
  287. }
  288. }
  289. }
  290. .bmBtn {
  291. width: 654rpx;
  292. height: 96rpx;
  293. display: flex;
  294. align-items: center;
  295. justify-content: center;
  296. color: white;
  297. background: #0365F9;
  298. border-radius: 8rpx;
  299. margin: 48rpx 48rpx 0rpx 48rpx;
  300. }
  301. .bmBtn2 {
  302. width: 654rpx;
  303. height: 96rpx;
  304. display: flex;
  305. align-items: center;
  306. justify-content: center;
  307. color: white;
  308. background: #9f9e9e;
  309. border-radius: 8rpx;
  310. margin: 48rpx 48rpx 0rpx 48rpx;
  311. }
  312. }
  313. </style>