推广小程序前端代码
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.

658 lines
17 KiB

6 months ago
6 months ago
4 months ago
6 months ago
6 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
5 months ago
6 months ago
6 months ago
4 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
4 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
3 months ago
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
  1. <template>
  2. <view>
  3. <view class="head-box"></view>
  4. <uv-navbar autoBack :title="$t('pages_order.huodong_detail.title')" leftIconColor="#fff" :bgColor="bgColor" height="100rpx" :titleStyle="{color:'#fff'}"></uv-navbar><!-- -->
  5. <view class="content">
  6. <view class="content-head">
  7. <uv-swiper :list="imageArr"
  8. keyName="image"
  9. height="406rpx" radius="30rpx"
  10. bgColor="transparent" indicator
  11. indicatorMode="dot"></uv-swiper>
  12. <!-- <image class="image-box" :src="imageArr" mode="aspectFill"></image> -->
  13. <view class="msg-box">
  14. <view class="msg-box-title">{{$ot(activityDetails, 'active', 'title')}}</view>
  15. <view class="msg-box-time">{{$t('pages_order.huodong_detail.start_time')}}{{activityDetails.startTime}}</view><!-- 开始时间 -->
  16. <view class="msg-box-address">
  17. <view class="msg-box-address-text">{{$t('pages_order.huodong_detail.activity_address')}}{{$ot(activityDetails, 'active', 'address')}}</view><!-- 活动地址 -->
  18. <view class="address-icon" @click="daohang">
  19. <image src="@/static/image/home/address-icon-2.png" mode="aspectFill"></image>
  20. <view>{{$t('pages_order.huodong_detail.navigation')}}</view><!-- 导航 -->
  21. </view>
  22. </view>
  23. <view class="lingdui-box">
  24. <image class="use-img" :src="adminUserInfo.headImage" mode="aspectFill"></image>
  25. <view class="lingdui-msg">
  26. <view class="lingdui-msg-name">
  27. <view>{{adminUserInfo.nickName}}</view>
  28. <view class="name-tip">{{$t('pages_order.huodong_detail.organizer')}}</view><!-- 主理人 -->
  29. </view>
  30. <view>
  31. <uv-rate :count="count"
  32. disabled
  33. v-model="numValue" size="23" activeColor="#FFA200"></uv-rate>
  34. </view>
  35. </view>
  36. <view class="add-wx" @click="$refs.ewmpopup.open();">{{$t('pages_order.huodong_detail.add_wechat')}}</view><!-- 添加微信 -->
  37. </view>
  38. </view>
  39. </view>
  40. <view class="lv-miaoshu">
  41. <view class="title-box">{{$t('pages_order.huodong_detail.activity_description')}}</view><!-- 活动描述 -->
  42. <view class="value-box">
  43. <view class="uv-content lv-msg-box">
  44. <uv-parse :content="$ot(activityDetails, 'active', 'details')"></uv-parse>
  45. </view>
  46. </view>
  47. <!-- <view class="value-box">
  48. <view class="lv-msg-box">
  49. 当金黄的落叶轻柔地铺满了小城的每个角落我们知道最温柔的季节已悄然而至在这个收获的季节里我们诚挚邀请您加入我们的秋日私旅
  50. </view>
  51. </view> -->
  52. <view class="title-box">{{$t('pages_order.huodong_detail.precautions')}}</view><!-- 注意事项 -->
  53. <view class="value-box">
  54. <view class="lv-msg-box">
  55. <uv-parse :content="$ot(activityDetails, 'active', 'precautions')"></uv-parse>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="bottom-box">
  61. <view class="price-box">
  62. <view class="peice-val"><text></text>{{activityDetails.price}}</view>
  63. <view>{{$t('pages_order.huodong_detail.registration_fee')}}</view><!-- 报名费用 -->
  64. </view>
  65. <view class="caozuo-box">
  66. <view class="caozuo-item border-r"
  67. @click="collect"
  68. v-if="!isCollect">
  69. <image src="./static/shoucang-icon.png"
  70. mode=""></image>
  71. <text>{{$t('pages_order.huodong_detail.collect')}}</text><!-- 收藏 -->
  72. </view>
  73. <view class="caozuo-item border-r isCollect"
  74. @click="collect"
  75. style=""
  76. v-else>
  77. <text>{{$t('pages_order.huodong_detail.collected')}}</text><!-- 已收藏 -->
  78. </view>
  79. <button type="primary" style="background-color: transparent;height: 100rpx;font-size: 20rpx;padding: 0;" open-type="share" >
  80. <view class="caozuo-item">
  81. <image src="./static/zhuanfa-icon.png" mode=""></image>
  82. <text style="line-height: initial;">{{$t('pages_order.huodong_detail.forward')}}</text><!-- 转发 -->
  83. </view>
  84. </button>
  85. </view>
  86. <!-- <view class="btn-box" @click="toBaoming">立即报名</view> -->
  87. <!-- <view class="btn-box end-btn">已结束</view> -->
  88. <view class="btn-box"
  89. v-if="activityDetails.state == 0"
  90. @click="toBaoming">{{$t('pages_order.huodong_detail.sign_up_now')}}</view><!-- 立即报名 -->
  91. <view class="btn-box-2"
  92. v-if="activityDetails.state == 1"
  93. >{{$t('pages_order.huodong_detail.ended')}}</view><!-- 已结束 -->
  94. </view>
  95. <uv-popup ref="popup" mode="bottom" bgColor="">
  96. <view class="popup-cont">
  97. <view class="popup-title">
  98. <view></view>
  99. <view>{{$t('pages_order.huodong_detail.select_activity_status')}}</view><!-- 选择活动状态 -->
  100. <uv-icon name="close" color="#fff" @click="$refs.popup.close();"></uv-icon>
  101. </view>
  102. <view class="popup-list">
  103. <view class="list-item"
  104. v-for="(item,i) in typeList" :key="i"
  105. @click="chooseClick(item,i)">
  106. <view class="item-l" :class="chooseIndex == i ? 'chooose-class' : ''">
  107. <view>{{item.name}}</view>
  108. <view class="item-l-val">{{item.price}}</view>
  109. </view>
  110. <uv-icon name="checkmark" color="#FF5858" v-if="chooseIndex == i"></uv-icon>
  111. </view>
  112. </view>
  113. <view class="confirm-box">
  114. <uv-button @click="confirmClick(chooseIndex)" :text="$t('pages_order.huodong_detail.confirm')" color="#381615" shape="circle" :customStyle="btnCustomStyle"></uv-button><!-- -->
  115. </view>
  116. </view>
  117. </uv-popup>
  118. <uv-popup ref="ewmpopup" mode="center" round="30rpx">
  119. <view class="pop-cont">
  120. <uv-image :src="ewmImg" width="380rpx" height="380rpx"></uv-image>
  121. </view>
  122. </uv-popup>
  123. </view>
  124. </template>
  125. <script>
  126. export default{
  127. data() {
  128. return {
  129. activityDetails:{},
  130. adminUserInfo:{},
  131. btnCustomStyle:{
  132. color:'#FF5858'
  133. },
  134. chooseIndex:0,
  135. bgColor:'transparent',
  136. count:5,
  137. numValue:0,
  138. ewmImg:'',
  139. typeList:[
  140. // {
  141. // name:'早鸟票',
  142. // price: 0
  143. // },
  144. // {
  145. // name:'单人票',
  146. // price: 0
  147. // },
  148. // {
  149. // name:'尊享票',
  150. // price: 0
  151. // }
  152. ],
  153. activityId:'',
  154. isCollect : false,
  155. }
  156. },
  157. computed:{
  158. imageArr() {
  159. return this.activityDetails.image
  160. && this.activityDetails.image.split(',')
  161. }
  162. },
  163. onShareAppMessage(res) {
  164. console.log(res)
  165. if (res.from === 'button') {
  166. // 来自详情页页面内分享按
  167. return {
  168. title: this.$ot(this.activityDetails, 'active', 'title'),
  169. path: `/pages_order/huodong-detail?activityId=${this.activityId}`,
  170. imageUrl: this.imageArr[0],
  171. success: function(res) {
  172. // 转发成功
  173. console.log('转发成功')
  174. },
  175. fail: function(res) {
  176. // 转发失败
  177. }
  178. };
  179. }
  180. // 设置转发的参数
  181. return {
  182. title: this.$ot(this.activityDetails, 'active', 'title'),
  183. path: `/pages_order/huodong-detail?activityId=${this.activityId}`,
  184. imageUrl: this.imageArr[0],
  185. success: function(res) {
  186. console.log(res, '发生过是');
  187. if (res.errMsg == 'shareAppMessage:ok') {
  188. console.log("成功", res)
  189. }
  190. },
  191. fail: function(res) {
  192. console.log("失败", res)
  193. }
  194. }
  195. },
  196. onPageScroll(e) {
  197. if(e.scrollTop > 50) {
  198. this.bgColor = '#49070c'
  199. }else{
  200. this.bgColor = 'transparent'
  201. }
  202. },
  203. onLoad({activityId}) {
  204. this.activityId = activityId
  205. this.activityInfo(activityId)
  206. if(this.isLogin){
  207. this.$store.commit('getUserInfo')
  208. }
  209. },
  210. methods:{
  211. daohang() {
  212. uni.openLocation({
  213. latitude: Number(this.activityDetails.latitude),
  214. longitude: Number(this.activityDetails.longitude),
  215. name: this.$ot(this.activityDetails, 'active', 'title'),
  216. address: this.$ot(this.activityDetails, 'active', 'address'),
  217. success: function () {
  218. console.log('success');
  219. },
  220. fail:(error)=> {
  221. console.log('error',error);
  222. }
  223. });
  224. },
  225. activityInfo(activityId) {
  226. let data = {activityId}
  227. if(uni.getStorageSync('token')){
  228. data.token = uni.getStorageSync('token')
  229. }
  230. this.$api('activityInfo', data,res=> {
  231. if(res.code==200) {
  232. let adminUser = res.result.adminUser || {}
  233. this.activityDetails = res.result.activityInfo
  234. this.numValue = adminUser.num
  235. this.ewmImg = adminUser.img
  236. this.adminUserInfo = res.result.adminUserInfo
  237. this.isCollect = res.result.collect
  238. this.typeList = []
  239. if(res.result.activityInfo.birdPrice){
  240. this.typeList.push({
  241. price : res.result.activityInfo.birdPrice,
  242. name : this.$t('pages_order.huodong_detail.early_bird'), // 早鸟票
  243. type : 0,
  244. })
  245. }
  246. if(res.result.activityInfo.personPrice){
  247. this.typeList.push({
  248. price : res.result.activityInfo.personPrice,
  249. name : this.$t('pages_order.huodong_detail.single_ticket'), // 单人票
  250. type : 1,
  251. })
  252. }
  253. if(res.result.activityInfo.expensivePrice){
  254. this.typeList.push({
  255. price : res.result.activityInfo.expensivePrice,
  256. name : this.$t('pages_order.huodong_detail.premium_ticket'), // 尊享票
  257. type : 2,
  258. })
  259. }
  260. // this.typeList[0].price = res.result.activityInfo.birdPrice;
  261. // this.typeList[1].price = res.result.activityInfo.personPrice;
  262. // this.typeList[2].price = res.result.activityInfo.expensivePrice;
  263. }
  264. })
  265. },
  266. toBaoming() {
  267. this.$refs.popup.open();
  268. },
  269. chooseClick(item,i) {
  270. this.chooseIndex = i
  271. },
  272. collect(){
  273. this.$api('collect', {
  274. id : this.activityId,
  275. type : 0,
  276. }, res => {
  277. this.activityInfo(this.activityId)
  278. if(res.code == 200){
  279. uni.showToast({
  280. title: res.message,
  281. icon: 'none'
  282. })
  283. }
  284. })
  285. },
  286. confirmClick(typePrice) {
  287. console.log(this.userInfo);
  288. if(!this.userInfo.nickName ||
  289. !this.userInfo.headImage ||
  290. !this.userInfo.phone ||
  291. !this.userInfo.sex){
  292. uni.showToast({
  293. title: this.$t('pages_order.huodong_detail.complete_info_required'), // 请您先完善必要信息
  294. icon: 'none'
  295. })
  296. setTimeout(uni.navigateTo, 800, {
  297. url: '/pages_login/wxUserInfo'
  298. })
  299. return
  300. }
  301. this.$api('createOrder',{
  302. id:this.activityId,
  303. typePrice: this.typeList[typePrice].type,
  304. type:0
  305. },res=>{
  306. if(res.code === 200) {
  307. uni.navigateTo({
  308. url: '/pages_order/payOrder?id=' + res.result.id
  309. })
  310. // uni.requestPaymentWxPay(res)
  311. // .then(res => {
  312. // uni.showToast({
  313. // title: '下单成功',
  314. // icon: 'none'
  315. // })
  316. // setTimeout(uni.switchTab, 800, {
  317. // url: '/pages/index/cart'
  318. // })
  319. // }).catch(n => {
  320. // // setTimeout(uni.switchTab, 800, {
  321. // // url: '/pages/index/cart'
  322. // // })
  323. // })
  324. }
  325. })
  326. }
  327. }
  328. }
  329. </script>
  330. <style lang="scss">
  331. page {
  332. background-color: #060504;
  333. }
  334. </style>
  335. <style lang="scss" scoped>
  336. .pop-cont {
  337. border-radius: 30rpx;
  338. padding: 10rpx;
  339. }
  340. .head-box {
  341. background: url('@/static/image/nav-bg.png') no-repeat;
  342. background-size: 100% 100%;
  343. width: 100%;
  344. height: 534rpx;
  345. position: absolute;
  346. z-index: -1;
  347. top: 0;
  348. }
  349. .content {
  350. margin-top: 40rpx;
  351. padding: 0 30rpx 170rpx;
  352. padding-top: calc(var(--status-bar-height) + 130rpx);
  353. .content-head {
  354. position: relative;
  355. .image-box {
  356. width: 100%;
  357. height: 546rpx;
  358. border-radius: 12rpx;
  359. }
  360. .msg-box {
  361. background: #1B1713;
  362. border-radius: 27rpx 27rpx 67rpx 67rpx;
  363. position: absolute;
  364. top: 429rpx;
  365. left: 0;
  366. right: 0;
  367. padding-top: 38rpx;
  368. .msg-box-title {
  369. font-weight: 500;
  370. font-size: 32rpx;
  371. color: #FFFFFF;
  372. margin-bottom: 40rpx;
  373. padding-left: 38rpx;
  374. }
  375. .msg-box-time {
  376. font-weight: 400;
  377. font-size: 27rpx;
  378. color: #999999;
  379. padding-left: 38rpx;
  380. }
  381. .msg-box-address {
  382. font-weight: 400;
  383. font-size: 27rpx;
  384. color: #999999;
  385. padding-left: 38rpx;
  386. padding-right: 30rpx;
  387. margin-top: 24rpx;
  388. display: flex;
  389. justify-content: space-between;
  390. &-text {
  391. flex: 1;
  392. }
  393. .address-icon {
  394. font-weight: 400;
  395. font-size: 23rpx;
  396. color: #999999;
  397. display: flex;
  398. image {
  399. width: 25rpx;
  400. height: 27rpx;
  401. margin-right: 8rpx;
  402. }
  403. }
  404. }
  405. .lingdui-box {
  406. margin-top: 43rpx;
  407. height: 130rpx;
  408. background: #26201A;
  409. border-radius: 60rpx;
  410. display: flex;
  411. align-items: center;
  412. padding: 0 40rpx;
  413. .use-img {
  414. width: 86rpx;
  415. height: 86rpx;
  416. border-radius: 50%;
  417. }
  418. .lingdui-msg {
  419. flex: 1;
  420. margin-left: 24rpx;
  421. .lingdui-msg-name {
  422. font-weight: 500;
  423. font-size: 29rpx;
  424. color: #E6E6E6;
  425. display: flex;
  426. align-items: center;
  427. margin-bottom: 11rpx;
  428. .name-tip {
  429. padding: 0 20rpx;
  430. height: 27rpx;
  431. background: #3C2D17;
  432. border-radius: 0rpx 12rpx 12rpx 12rpx;
  433. font-weight: 500;
  434. font-size: 19rpx;
  435. color: #FFA200;
  436. line-height: 27rpx;
  437. margin-left: 14rpx;
  438. }
  439. }
  440. }
  441. .add-wx {
  442. width: 172rpx;
  443. height: 51rpx;
  444. background: #3C2D17;
  445. border-radius: 23rpx 23rpx 23rpx 23rpx;
  446. text-align: center;
  447. line-height: 51rpx;
  448. font-weight: 400;
  449. font-size: 25rpx;
  450. color: #FF8A00;
  451. }
  452. }
  453. }
  454. }
  455. .title-box {
  456. font-weight: 500;
  457. font-size: 33rpx;
  458. color: #E6E6E6;
  459. text-align: center;
  460. position: relative;
  461. &::after {
  462. content: "";
  463. position: absolute;
  464. top: 50%;
  465. left: 0;
  466. transform: translate(0,-50%);
  467. width: 100%;
  468. height: 12rpx;
  469. background: url(@/static/image/home/title-line.png) no-repeat;
  470. background-size: 100% 100%;
  471. }
  472. }
  473. .lv-miaoshu {
  474. margin-top: 480rpx;
  475. .value-box {
  476. background: #1B1713;
  477. border-radius: 27rpx;
  478. margin-top: 35rpx;
  479. margin-bottom: 52rpx;
  480. .tabs-box {
  481. border-bottom: 1px solid #2D241B;
  482. }
  483. .lv-msg-box {
  484. padding: 20rpx 40rpx;
  485. font-weight: 400;
  486. font-size: 27rpx;
  487. color: #fff;
  488. line-height: 41rpx;
  489. }
  490. }
  491. }
  492. }
  493. .bottom-box {
  494. position: fixed;
  495. bottom: 0;
  496. left: 0;
  497. right: 0;
  498. height: 150rpx;
  499. background-color: #1B1713;
  500. display: flex;
  501. align-items: center;
  502. padding: 0 40rpx;
  503. .price-box {
  504. font-weight: 400;
  505. font-size: 25rpx;
  506. color: #999999;
  507. flex: 1;
  508. .peice-val {
  509. font-weight: 500;
  510. font-size: 40rpx;
  511. color: #FF3535;
  512. margin-bottom: 15rpx;
  513. text {
  514. font-size: 26rpx;
  515. }
  516. }
  517. }
  518. .caozuo-box {
  519. display: flex;
  520. align-items: center;
  521. .caozuo-item {
  522. font-weight: 400;
  523. font-size: 20rpx;
  524. color: #999999;
  525. padding: 0 35rpx;
  526. text-align: center;
  527. height: 100rpx;
  528. display: flex;
  529. flex-direction: column;
  530. align-items: center;
  531. image {
  532. width: 48rpx;
  533. height: 48rpx;
  534. margin-bottom: 10rpx;
  535. }
  536. }
  537. .border-r {
  538. position: relative;
  539. // border-right: 1px solid #4A3E32;
  540. &::after {
  541. content: "";
  542. width: 2rpx;
  543. height: 47rpx;
  544. position: absolute;
  545. right: 0;
  546. top: 50%;
  547. transform: translate(0,-50%);
  548. background-color: #4A3E32;
  549. }
  550. }
  551. .isCollect{
  552. color: #f40;
  553. font-size: 28rpx;
  554. height: 100%;
  555. display: flex;
  556. align-items: center;
  557. }
  558. }
  559. .btn-box {
  560. width: 252rpx;
  561. height: 74rpx;
  562. font-weight: 500;
  563. font-size: 32rpx;
  564. color: #FFFFFF;
  565. text-align: center;
  566. line-height: 74rpx;
  567. background: url(@/static/image/home/hdqd-btn.png) no-repeat;
  568. background-size: 100% 100%;
  569. }
  570. .btn-box-2 {
  571. width: 252rpx;
  572. height: 74rpx;
  573. font-weight: 500;
  574. font-size: 32rpx;
  575. text-align: center;
  576. line-height: 74rpx;
  577. background-size: 100% 100%;
  578. background: #333;
  579. color: #999;
  580. border-radius: 45rpx;
  581. margin-bottom: 13rpx;
  582. }
  583. .end-btn {
  584. background: #666666;
  585. border-radius: 37rpx 37rpx 37rpx 37rpx;
  586. }
  587. }
  588. .popup-cont {
  589. width: 95%;
  590. margin: 0 auto;
  591. background-image: linear-gradient(to top, #000000, #331212);
  592. height:662rpx;
  593. border-radius: 33rpx 33rpx 0 0;
  594. .popup-title {
  595. display: flex;
  596. align-items: center;
  597. justify-content: space-between;
  598. padding: 54rpx 52rpx;
  599. font-weight: 500;
  600. font-size: 29rpx;
  601. color: #999999;
  602. }
  603. .popup-list {
  604. padding: 0 50rpx;
  605. .list-item {
  606. display: flex;
  607. justify-content: space-between;
  608. align-items: center;
  609. height: 110rpx;
  610. border-bottom: 1px solid #3F3535;
  611. .item-l {
  612. font-weight: 500;
  613. font-size: 29rpx;
  614. color: #CCCCCC;
  615. display: flex;
  616. align-items: center;
  617. .item-l-val {
  618. margin-left: 40rpx;
  619. }
  620. }
  621. .chooose-class {
  622. color: #FF5858;
  623. }
  624. }
  625. }
  626. .confirm-box {
  627. padding: 0 50rpx;
  628. margin-top: 30rpx;
  629. .confirm-btn-box {
  630. }
  631. }
  632. }
  633. </style>