detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <!-- 活动详情 -->
  2. <template>
  3. <view class="loading_text" v-if="loading">加载中...</view>
  4. <view v-else>
  5. <swiper indicator-color='#b2b2b2' indicator-active-color="#f5f5f5 " indicator-dots="true" circular
  6. class="swiper_banner" autoplay>
  7. <swiper-item :key="index" v-for="(item, index) in (data.detail_photos||data.profile_photos)">
  8. <image style="width: 100%;height: 100%;" :src="item" class="banner"></image>
  9. </swiper-item>
  10. </swiper>
  11. <view style="position: relative;">
  12. <view style="position: absolute;top: 20upx;right: 0;">
  13. <button :data-key="1" open-type="share" class="share_style">
  14. <image style="width: 42upx;height: 36upx;" src="/static/share_orange.png"></image>
  15. <view style="color: #ff663d;margin-left: 16upx;width: 80upx;">分享</view>
  16. </button>
  17. </view>
  18. <view style="padding:70upx 0 30upx;" class="main_width">
  19. <view class="page_title">{{data.title}}</view>
  20. <view style="margin-top: 0upx;" class="page_title_price">{{data.price}}元{{sys_role==1?'起':''}}</view>
  21. <view v-if="sys_role==0" class="box_line main_text_view people">
  22. <view>
  23. <image class="mini_icon" src="../../static/people.png"></image>
  24. <text class="mini_text">{{data.total}}人</text>
  25. </view>
  26. <image style="margin-left: 40upx;width: 2upx;height: 24upx;margin-top: 4upx;"
  27. src="../../static/line.png"></image>
  28. <view style="margin-left: 40upx;">
  29. <image style="height: 28upx;" class="mini_icon" src="../../static/pos_grey.png"></image>
  30. <text class="mini_text">距离我约{{(Number(data.distance)/1000).toFixed(1)}}km</text>
  31. </view>
  32. </view>
  33. <view style="margin-top: 15upx;" class="page_title2">{{sys_role==0?'活动':'服务'}}介绍</view>
  34. <view v-if="sys_role==0">
  35. <rich-text :nodes="data.biz_desc"></rich-text>
  36. </view>
  37. <image style="width: 100%;margin-top: 10upx;" v-if="data.profile_photo" mode="widthFix" :src="data.profile_photo"></image>
  38. <view v-else class="main_text">{{data.content}}</view>
  39. </view>
  40. </view>
  41. <view class="line_grey"></view>
  42. <view v-if="sys_role==0" style="padding:10upx 0 40upx;" class="main_width">
  43. <view class="page_title2">活动时间</view>
  44. <view style="margin-top: 0upx;" class="box_line main_text_view">
  45. <view>
  46. <image class="mini_icon" src="../../static/clock_grey.png"></image>
  47. <text class="mini_text">{{data.begin_datetime}}</text>~<text style="margin-left: 0upx;"
  48. class="mini_text">{{data.finish_datetime}}</text>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="line_grey"></view>
  53. <view style="padding: 10upx 0 20upx;" class="main_width">
  54. <view class="page_title2">机构信息</view>
  55. <view style="margin-top: 20upx;display: flex;flex-direction: row;justify-content: space-between;">
  56. <view class="main_text">联系人:{{data.linker_name}}</view>
  57. </view>
  58. <view v-if="sys_role==1" style="margin-top: 10upx;" class="main_text">地址:{{data.company_addr}}</view>
  59. <view style="margin-top: 10upx;" class="main_text">{{data.company_name}}</view>
  60. </view>
  61. <view class="line_grey"></view>
  62. <view v-if="sys_role==0" style="padding: 10upx 0 0upx;" class="main_width">
  63. <view class="page_title2">商家地址</view>
  64. <view style="" class="main_text">{{data.activity_addr1}}</view>
  65. </view>
  66. <view v-if="sys_role==0&&!loading" style="margin-top: 10upx;">
  67. <mapBox :dataSource="positionData"></mapBox>
  68. </view>
  69. <view style="padding: 20upx 0 50upx" class="main_width">
  70. <view class="page_title2">备注</view>
  71. <view class="main_text">
  72. <rich-text :nodes="data.biz_remark||data.remark"></rich-text>
  73. </view>
  74. <view v-if="show_code==1||type==1" style="width: 50%;margin-left: 25%;margin-top: 20upx;">
  75. <image @click="save_pic" style="width: 100%;" mode="widthFix" :src="data.group_qrurl"></image>
  76. <view style="text-align: center;color: #666666;margin-top: 15upx;">请加群了解具体事项</view>
  77. </view>
  78. </view>
  79. <view style="height: 120upx;"></view>
  80. <view v-if="sys_role==0" class="bot_fixed">
  81. <block v-if="IS_TOURIST==1">
  82. <view @click="open_sign_modal()" class="bot_fixed_con"
  83. :style="'width: 100%;background-color: '+(type==0?'#81d8d0':'#a1d37a')+';'">
  84. <image style="width: 38upx;height: 42upx;"
  85. :src="'../../static/single.png'"></image>
  86. <view class="text">{{type==0?'报名':'已报名'}}</view>
  87. </view>
  88. </block>
  89. <block v-else>
  90. <view @click="open_sign_modal()" class="bot_fixed_con"
  91. :style="'width: 50%;background-color: '+(type==0?'#81d8d0':'#a1d37a')+';'">
  92. <image style="width: 38upx;height: 42upx;"
  93. :src="'../../static/'+(type==0? 'single':'has_singed')+'.png'"></image>
  94. <view class="text">{{type==0?'报名':'已报名'}}</view>
  95. </view>
  96. <view @click="toChat" class="bot_fixed_con" style="width: 25%;background-color: #00ab92;">
  97. <image style="width: 42upx;height: 44upx;" src="../../static/msg.png"></image>
  98. </view>
  99. <view @click="makeCall" class="bot_fixed_con" style="width: 25%;background-color: #ff663d;">
  100. <image style="width: 39upx;height: 43upx;" src="../../static/call.png"></image>
  101. </view>
  102. </block>
  103. </view>
  104. <view v-else class="bot_fixed">
  105. <view @click="makeCall" class="bot_fixed_con" style="width: 100%;background-color: #ff663d;">
  106. <image style="width: 39upx;height: 43upx;" src="../../static/call.png"></image>
  107. </view>
  108. </view>
  109. <uni-popup ref="popup" :mask-click="false">
  110. <view style="overflow: hidden;" class="modal_box">
  111. <image @click="save_pic" style="width: 80%;margin-left: 10%;margin-top: 20upx;" mode="widthFix"
  112. :src="data.group_qrurl">
  113. </image>
  114. <view style="text-align: center;color: #666666;margin-top: 15upx;">请加群了解具体事项</view>
  115. <view style="display: flex;justify-content: center;" class="modal_btn">
  116. <view @click="close_modal" class="modal_btn_cancel">关闭</view>
  117. </view>
  118. </view>
  119. </uni-popup>
  120. <!-- 报名遮罩 -->
  121. <uni-popup ref="popup_sign" :mask-click="false">
  122. <view class="modal_box">
  123. <view style="color: #313131;text-align: center;font-size: 38upx;line-height: 90upx;">确认报名</view>
  124. <view class="mention">
  125. <view v-if="!user_info.true_name">您还没有实名认证,<navigator url="/pages/personal/authentication">去实名认证
  126. </navigator>
  127. </view>
  128. </view>
  129. <view class="modal_btn">
  130. <view @click="close_sign_modal" class="modal_btn_cancel">取消</view>
  131. <view @click="sign" class="modal_btn_confirm">报名并支付{{data.price}}元</view>
  132. </view>
  133. </view>
  134. </uni-popup>
  135. </view>
  136. </template>
  137. <script>
  138. import commonData from '../../commonData.js'
  139. import commonFun from '../../commonFun.js'
  140. import trailerStars from '../../components/starts/index.vue'
  141. import share from '../../components/share/index.vue'
  142. import mapBox from '../../components/mapBox/index.vue'
  143. export default {
  144. data() {
  145. return {
  146. IS_TOURIST: uni.getStorageSync('IS_TOURIST'), //获取游客模式
  147. sys_role: commonData.sys_role,
  148. type: 0, //0是未报名,1是已报名
  149. id: '',
  150. data: {},
  151. positionData: {},
  152. serverUrlImg3: this.serverUrl + 'show/complaint.png',
  153. show_code: 0,
  154. loading: true,
  155. user_info: {},
  156. }
  157. },
  158. onShareAppMessage() {
  159. return {
  160. title: this.data.title,
  161. path: '/pages/activity/detail?id=' + this.id
  162. }
  163. },
  164. methods: {
  165. // 保存图片
  166. save_pic() { //保存图片
  167. uni.downloadFile({
  168. url: this.data.group_qrurl,
  169. success: (res) => {
  170. if (res.statusCode === 200) {
  171. uni.saveImageToPhotosAlbum({
  172. filePath: res.tempFilePath,
  173. success: function() {
  174. uni.showToast({
  175. title: "保存成功",
  176. icon: "none"
  177. });
  178. },
  179. fail: function() {
  180. uni.showToast({
  181. title: "保存失败,请稍后重试",
  182. icon: "none"
  183. });
  184. }
  185. });
  186. }
  187. },
  188. fail(e) {
  189. uni.showToast({
  190. title: "保存失败,请稍后重试," + JSON.stringify(e),
  191. icon: "none"
  192. });
  193. console.log('失败')
  194. console.log(e)
  195. }
  196. })
  197. },
  198. // 获取个人信息
  199. get_info() {
  200. commonFun.get_user_info(res => {
  201. if (res.status) {
  202. this.user_info = res.data.Result
  203. console.log('活动详情页获取个人信息')
  204. console.log(this.user_info)
  205. }
  206. })
  207. },
  208. toChat() {
  209. uni.setStorageSync('targetUser', {
  210. name: this.data.cbu_login_name,
  211. avatar: 'https://api.kuailaiyou.top/prjcenter/prjKLY/fileroot/images/front/logo.png',
  212. })
  213. uni.navigateTo({
  214. url: '/pages/message/chat?to=userlogin_' + this.data.cbu_login_name + '1'
  215. })
  216. },
  217. // 拨号
  218. makeCall(phoneNumber) {
  219. uni.makePhoneCall({
  220. phoneNumber: this.data.linker_phone
  221. });
  222. },
  223. // 打开报名窗口
  224. open_sign_modal() {
  225. if (this.IS_TOURIST == 1) {
  226. uni.showModal({
  227. title: '请登录后报名!',
  228. confirmText: '去登录',
  229. success: (res) => {
  230. if (res.confirm) {
  231. uni.navigateTo({
  232. url: '../login/index?need_back=1'
  233. })
  234. }
  235. }
  236. })
  237. return
  238. }
  239. if (this.type == 1) {
  240. return
  241. }
  242. this.$refs.popup_sign.open('top')
  243. },
  244. // 关闭报名窗口
  245. close_sign_modal() {
  246. this.$refs.popup_sign.close('top')
  247. },
  248. // 关闭窗口
  249. close_modal() {
  250. this.$refs.popup.close('top')
  251. },
  252. // 报名
  253. sign() {
  254. if (this.type == 1) {
  255. return
  256. }
  257. uni.showModal({
  258. content: '确认支付?',
  259. success: (res) => {
  260. if (res.confirm) {
  261. uni.showLoading({
  262. title: '加载中...',
  263. mask: true
  264. })
  265. uni.login({
  266. success: res => {
  267. let params = {
  268. bizCatalog: 'MActivityEntity',
  269. handleMode: 'enroll',
  270. activityId: this.data.id,
  271. minaCode: res.code,
  272. }
  273. console.log('活动报名处理请求参数')
  274. console.log(params)
  275. commonFun.requestUrl(
  276. '&WsAjaxBiz=Worker&WsAjaxAction=entityDataHandle',
  277. params,
  278. res => {
  279. console.log('paySettle处理获取参数')
  280. console.log(res)
  281. if (res.status) {
  282. if (res.data.Result.payResult) {
  283. uni.showModal({
  284. content: '报名成功',
  285. showCancel: false
  286. })
  287. this.close_sign_modal()
  288. setTimeout(() => {
  289. this.$refs.popup.open('top')
  290. this.show_code = 1
  291. }, 300)
  292. uni.hideLoading()
  293. return
  294. }
  295. let prePayInfo = res.data.Result
  296. .prePayInfo
  297. console.log('prePayInfo')
  298. console.log(prePayInfo)
  299. uni.requestPayment({
  300. ...prePayInfo,
  301. success: (res2) => {
  302. uni.showModal({
  303. title: '支付成功',
  304. showCancel: false,
  305. success: res => {
  306. uni.showModal({
  307. content: '报名成功',
  308. showCancel: false
  309. })
  310. this.close_sign_modal()
  311. setTimeout
  312. (() => {
  313. this.$refs
  314. .popup
  315. .open(
  316. 'top'
  317. )
  318. this.show_code =
  319. 1
  320. },
  321. 300
  322. )
  323. }
  324. })
  325. },
  326. fail: function(res2) {
  327. if (res2.errMsg
  328. .indexOf(
  329. 'cancel'
  330. ) == -1
  331. ) {
  332. uni.showModal({
  333. title: '支付失败',
  334. content: JSON
  335. .stringify(
  336. res2
  337. ),
  338. showCancel: false,
  339. })
  340. }
  341. }
  342. });
  343. }
  344. uni.hideLoading()
  345. })
  346. }
  347. })
  348. }
  349. }
  350. })
  351. },
  352. // 获取数据
  353. get_data() {
  354. this.get_info()
  355. this.loading = true
  356. let url = '&WsAjaxBiz=' + (this.IS_TOURIST == 1 ? 'Public' : this.sys_role == 1 ? 'Trader' :
  357. 'Worker') +
  358. '&WsAjaxAction=entityDataHandle'
  359. console.log('活动详情请求URL:' + url)
  360. commonFun.requestUrl(url, {
  361. bizCatalog: this.sys_role == 0 ? 'MActivityEntity' : 'TraServiceEntity',
  362. handleMode: 'fetch',
  363. bizId: this.id,
  364. nowLngLat: '117.68898010253906,39.0351862510659',
  365. }, res => {
  366. this.data = res.data.Result
  367. this.type = this.data.enrolled || 0
  368. console.log('活动/服务页获取详情')
  369. console.log(this.data)
  370. this.positionData = {
  371. work_addr: this.data.activity_addr1,
  372. work_addr_lng: this.data.addr_lng,
  373. work_addr_lat: this.data.addr_lat,
  374. }
  375. console.log(this.positionData)
  376. this.loading = false
  377. })
  378. },
  379. changeScore(e) {
  380. console.log(e)
  381. },
  382. },
  383. onLoad(e) {
  384. if (e.id) {
  385. this.id = e.id
  386. }
  387. if (this.sys_role == 1) {
  388. uni.setNavigationBarTitle({
  389. title: '服务详情'
  390. })
  391. }
  392. },
  393. onShow() {
  394. setTimeout(() => {
  395. this.get_data()
  396. }, 1000)
  397. this.IS_TOURIST = uni.getStorageSync('IS_TOURIST') == '' ? 1 : uni.getStorageSync('IS_TOURIST')
  398. },
  399. onPullDownRefresh() {
  400. this.get_data();
  401. },
  402. onReachBottom() {
  403. },
  404. components: {
  405. trailerStars,
  406. share,
  407. mapBox,
  408. },
  409. }
  410. </script>
  411. <style>
  412. .people {
  413. line-height: 30upx;
  414. margin-top: 30upx;
  415. }
  416. .swiper_banner {
  417. width: 750upx;
  418. height: 780upx;
  419. }
  420. .banner {
  421. width: 100%;
  422. height: 100%;
  423. }
  424. .box_line {
  425. display: flex;
  426. flex-direction: row;
  427. height: 32upx;
  428. }
  429. .mini_icon {
  430. width: 24upx;
  431. height: 24upx;
  432. }
  433. .mini_text {
  434. margin-left: 20upx;
  435. }
  436. .mention {
  437. width: 90%;
  438. margin-left: 5%;
  439. color: #9c9c9c;
  440. }
  441. .mention view {
  442. padding-bottom: 20upx;
  443. display: flex;
  444. }
  445. </style>