activeApplication.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. },
  90. onShow() {
  91. this.getById()
  92. },
  93. computed: {
  94. formattedAddress() {
  95. // 检查两个地址字段是否都存在值
  96. const hasAddress = this.form.activityAddress && this.form.activityAddress.trim() !== '';
  97. const hasDetail = this.form.activityAddressDetail && this.form.activityAddressDetail.trim() !== '';
  98. // 根据是否存在值来拼接地址
  99. if (hasAddress && hasDetail) {
  100. return `${this.form.activityAddress} - ${this.form.activityAddressDetail}`;
  101. } else if (hasAddress) {
  102. return this.form.activityAddress;
  103. } else if (hasDetail) {
  104. return this.form.activityAddressDetail;
  105. } else {
  106. return ''; // 或者返回其他默认值
  107. }
  108. }
  109. },
  110. methods: {
  111. call(){
  112. uni.makePhoneCall({
  113. phoneNumber: this.form.activityPhone, // 电话号码
  114. success: function () {
  115. console.log('拨打电话成功');
  116. },
  117. fail: function () {
  118. console.log('拨打电话失败');
  119. }
  120. });
  121. },
  122. getLocal(){
  123. const _this = this
  124. uni.openLocation({
  125. latitude: Number(_this.form.latitude),
  126. longitude: Number(_this.form.longitude),
  127. success: function () {
  128. console.log('success');
  129. }
  130. });
  131. // uni.getLocation({
  132. // type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  133. // success: function (res) {
  134. // const latitude = res.latitude;
  135. // const longitude = res.longitude;
  136. //
  137. // }
  138. // });
  139. },
  140. getById(){
  141. const data = {
  142. id : this.activityId,
  143. createdBy: getUserLocalStorageInfo().userId,
  144. }
  145. getHomeCommunityActivityById(data).then(res => {
  146. if (res.errno === 0) {
  147. this.form = res.data
  148. this.statusList.forEach(item => {
  149. if (this.form.status == item.value) {
  150. this.form.statusName = item.label
  151. }
  152. })
  153. const data = {
  154. activityId: this.activityId,
  155. companyId: getUserLocalStorageInfo().userId
  156. }
  157. isRegistration(data).then(res => {
  158. if (res.errno === 0) {
  159. this.registrationFlag = res.data
  160. }
  161. })
  162. }
  163. })
  164. },
  165. async getByCodes() {
  166. let data = await getByCodes(JSON.stringify(this.dc_key));
  167. this.dic_SelectList = this.$common.handleDicList(data);
  168. this.statusList = this.dic_SelectList.activity_stat
  169. console.log('this.statusList', this.statusList)
  170. },
  171. clickColl() {
  172. if (this.form.collectorsStatus==='2'){
  173. this.form.collectorsStatus='1'
  174. }else{
  175. this.form.collectorsStatus='2'
  176. }
  177. homeActivityClickCollect({
  178. id: this.activityId,
  179. createdBy: getUserLocalStorageInfo().userId,
  180. collectorsStatus: this.form.collectorsStatus
  181. }).then(res => {
  182. });
  183. },
  184. toApplication() {
  185. uni.navigateTo({
  186. url: '/pages/subPackages/parkActivity/applicationInfo?activityId=' + this.form.id + "&registrationFlag=" + this.registrationFlag
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss">
  193. .activeApplication {
  194. padding-bottom: 120rpx;
  195. .appFirstBox {
  196. margin: 24rpx 0;
  197. padding: 24rpx 32rpx;
  198. background: white;
  199. display: flex;
  200. flex-direction: column;
  201. .firstImg {
  202. width: 686rpx;
  203. height: 300rpx;
  204. }
  205. .appTitle {
  206. display: flex;
  207. align-items: center;
  208. margin: 24rpx 0;
  209. .titleName {
  210. font-size: 32rpx;
  211. color: rgba(24, 23, 42, 1);
  212. }
  213. .titleType {
  214. background: rgba(3, 101, 249, 0.20);
  215. font-size: 28rpx;
  216. color: rgba(3, 101, 249, 1);
  217. width: 112rpx;
  218. height: 48rpx;
  219. display: flex;
  220. align-items: center;
  221. justify-content: center;
  222. border-radius: 2px 2px 2px 2px;
  223. }
  224. }
  225. .joinBox {
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: center;
  229. padding-bottom: 24rpx;
  230. .joinName {
  231. font-size: 28rpx;
  232. color: rgba(136, 136, 136, 1);
  233. }
  234. .shoucang {
  235. display: flex;
  236. align-items: center;
  237. font-size: 28rpx;
  238. color: rgba(24, 23, 42, 1);
  239. .scImg {
  240. width: 32rpx;
  241. height: 28rpx;
  242. margin-right: 8rpx;
  243. }
  244. }
  245. }
  246. .contactBox {
  247. display: flex;
  248. align-items: center;
  249. justify-content: space-between;
  250. padding: 24rpx 0;
  251. border-top: 1px solid #E6E6E6;
  252. .contackLeft {
  253. display: flex;
  254. align-items: center;
  255. }
  256. .phoneIcon {
  257. width: 64rpx;
  258. height: 64rpx;
  259. }
  260. }
  261. }
  262. .appSecondBox {
  263. padding: 32rpx;
  264. background: white;
  265. .secondBoxItem {
  266. display: flex;
  267. flex-direction: column;
  268. margin-bottom: 48rpx;
  269. .secondBoxTitle {
  270. color: #222222;
  271. font-size: 32rpx;
  272. font-weight: 600;
  273. margin-bottom: 16rpx;
  274. }
  275. .secondBoxInfo {
  276. font-size: 28rpx;
  277. color: #666666;
  278. line-height: 40rpx;
  279. }
  280. .dhInfo {
  281. display: flex;
  282. justify-content: space-between;
  283. .dhIcon {
  284. width: 36rpx;
  285. height: 36rpx;
  286. padding-left: 20rpx;
  287. border-left: 1px solid #E6E6E6;
  288. }
  289. }
  290. }
  291. }
  292. .bmBtn {
  293. width: 654rpx;
  294. height: 96rpx;
  295. display: flex;
  296. align-items: center;
  297. justify-content: center;
  298. color: white;
  299. background: #0365F9;
  300. border-radius: 8rpx;
  301. margin: 48rpx 48rpx 0rpx 48rpx;
  302. }
  303. .bmBtn2 {
  304. width: 654rpx;
  305. height: 96rpx;
  306. display: flex;
  307. align-items: center;
  308. justify-content: center;
  309. color: white;
  310. background: #9f9e9e;
  311. border-radius: 8rpx;
  312. margin: 48rpx 48rpx 0rpx 48rpx;
  313. }
  314. }
  315. </style>