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

497 lines
11 KiB

2 months ago
2 weeks ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 week ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 week ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
1 week ago
1 month ago
1 week ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
2 months ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 week ago
2 weeks ago
1 week ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
  1. <template>
  2. <view>
  3. <view class="head-box"></view>
  4. <uv-navbar autoBack 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="travelDetails.travel.image
  8. && travelDetails.travel.image.split(',')"
  9. keyName="image"
  10. height="406rpx" radius="30rpx"
  11. bgColor="transparent" indicator
  12. indicatorMode="dot"></uv-swiper>
  13. <!-- <image class="image-box" :src="travelDetails.travel.image" mode="aspectFill"></image> -->
  14. <view class="msg-box">
  15. <view class="msg-box-title">{{travelDetails.travel.title}}</view>
  16. <view class="msg-box-time">开始时间{{travelDetails.travel.startTime}}</view>
  17. <view class="lingdui-box">
  18. <image class="use-img" :src="travelDetails.adminUserInfo.headImage" mode=""></image>
  19. <view class="lingdui-msg">
  20. <view class="lingdui-msg-name">
  21. <view>{{travelDetails.adminUserInfo.nickName}}</view>
  22. <view class="name-tip">领队</view>
  23. </view>
  24. <view>
  25. <uv-rate :count="count"
  26. disabled
  27. v-model="travelDetails.adminUser.num" size="23" activeColor="#FFA200"></uv-rate>
  28. </view>
  29. </view>
  30. <view class="add-wx" @click="$refs.ewmpopup.open()">添加微信</view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="iconImages">
  35. <uv-parse :content="travelDetails.travel.iconImage"></uv-parse>
  36. </view>
  37. <view class="lv-miaoshu">
  38. <view class="title-box">旅行描述</view>
  39. <view class="value-box">
  40. <view class="tabs-box">
  41. <uv-tabs :list="list" @click="tabsClick" lineColor="#FE5E5E" :activeStyle="{color:'#FE5E5E',fontSize:'29rpx',fontWeight: 'bold'}" :inactiveStyle="{color:'#D6D6D6',fontSize:'29rpx',fontWeight: 'bold'}"></uv-tabs>
  42. </view>
  43. <view class="lv-msg-box">
  44. <uv-parse :content="content"></uv-parse>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="bottom-box">
  50. <view class="price-box">
  51. <view class="peice-val"><text></text>{{travelDetails.travel.price}}</view>
  52. <view>报名费用</view>
  53. </view>
  54. <view class="caozuo-box">
  55. <view class="caozuo-item border-r"
  56. @click="collect"
  57. v-if="!isCollect">
  58. <image src="./static/shoucang-icon.png"
  59. mode=""></image>
  60. <text>收藏</text>
  61. </view>
  62. <view class="caozuo-item border-r isCollect"
  63. @click="collect"
  64. style=""
  65. v-else>
  66. <text>已收藏</text>
  67. </view>
  68. <button type="primary" style="background-color: transparent;height: 100rpx;font-size: 20rpx;padding: 0;" open-type="share" >
  69. <view class="caozuo-item">
  70. <image src="./static/zhuanfa-icon.png" mode=""></image>
  71. <text style="line-height: initial;">转发</text>
  72. </view>
  73. </button>
  74. </view>
  75. <view class="btn-box"
  76. v-if="travelDetails.travel.state == 0"
  77. @click="toBaoming">立即报名</view>
  78. <view class="btn-box-2"
  79. v-if="travelDetails.travel.state == 1"
  80. >已结束</view>
  81. </view>
  82. <uv-popup ref="ewmpopup" mode="center" round="30rpx">
  83. <view class="pop-cont">
  84. <uv-image :src="travelDetails.adminUser.img" width="380rpx" height="380rpx"></uv-image>
  85. </view>
  86. </uv-popup>
  87. </view>
  88. </template>
  89. <script>
  90. export default{
  91. data() {
  92. return {
  93. travelDetails: {
  94. travel : {},
  95. },
  96. bgColor:'transparent',
  97. count:5,
  98. value:3,
  99. content:'',
  100. current:0,
  101. list:[
  102. {
  103. name:'介绍',
  104. key:'js'
  105. },
  106. {
  107. name:'路线',
  108. key:'lx'
  109. },
  110. {
  111. name:'费用',
  112. key:'fy'
  113. },
  114. {
  115. name:'须知',
  116. key:'xz'
  117. },
  118. {
  119. name:'代理',
  120. key:'dl'
  121. },
  122. ],
  123. travelId:'',
  124. isCollect : false,
  125. }
  126. },
  127. onShareAppMessage(res) {
  128. console.log(res)
  129. if (res.from === 'button') {
  130. // 来自详情页页面内分享按
  131. return {
  132. title:this.travelDetails.travel.title,
  133. path: `/pages_order/lvyou-detail?travelId=${this.travelId}`,
  134. imageUrl: this.travelDetails.travel.image,
  135. success: function(res) {
  136. // 转发成功
  137. console.log('转发成功')
  138. },
  139. fail: function(res) {
  140. // 转发失败
  141. }
  142. };
  143. }
  144. // 设置转发的参数
  145. return {
  146. title:this.travelDetails.title,
  147. path: `/pages_order/lvyou-detail?travelId=${this.travelId}`,
  148. imageUrl: this.travelDetails.travel.image,
  149. success: function(res) {
  150. console.log(res, '发生过是');
  151. if (res.errMsg == 'shareAppMessage:ok') {
  152. console.log("成功", res)
  153. }
  154. },
  155. fail: function(res) {
  156. console.log("失败", res)
  157. }
  158. }
  159. },
  160. onPageScroll(e) {
  161. if(e.scrollTop > 50) {
  162. this.bgColor = '#49070c'
  163. }else{
  164. this.bgColor = 'transparent'
  165. }
  166. },
  167. onLoad({travelId}) {
  168. this.travelId = travelId
  169. this.travelInfo(travelId)
  170. if(this.isLogin){
  171. this.$store.commit('getUserInfo')
  172. }
  173. },
  174. methods:{
  175. toBaoming() {
  176. if(!this.userInfo.nickName ||
  177. !this.userInfo.headImage ||
  178. !this.userInfo.phone ||
  179. !this.userInfo.sex){
  180. uni.showToast({
  181. title: '请您先完善必要信息',
  182. icon: 'none'
  183. })
  184. setTimeout(uni.navigateTo, 800, {
  185. url: '/pages_login/wxUserInfo'
  186. })
  187. return
  188. }
  189. this.$api('createOrder',{
  190. id : this.travelId,
  191. typePrice : 1,
  192. type : 1
  193. }, res=>{
  194. if(res.code === 200) {
  195. uni.navigateTo({
  196. url: '/pages_order/payOrder?id=' + res.result.id
  197. })
  198. // uni.requestPaymentWxPay(res)
  199. // .then(res => {
  200. // uni.showToast({
  201. // title: '下单成功',
  202. // icon: 'none'
  203. // })
  204. // setTimeout(uni.switchTab, 800, {
  205. // url: '/pages/index/cart'
  206. // })
  207. // }).catch(n => {
  208. // })
  209. }
  210. })
  211. },
  212. collect(){
  213. this.$api('collect', {
  214. id : this.travelId,
  215. type : 1,
  216. }, res => {
  217. this.travelInfo(this.travelId)
  218. if(res.code == 200){
  219. uni.showToast({
  220. title: res.message,
  221. icon: 'none'
  222. })
  223. }
  224. })
  225. },
  226. tabsClick(val) {
  227. this.current = val.index
  228. this.content = this.travelDetails.travel[this.list[this.current].key]
  229. },
  230. travelInfo(travelId) {
  231. let data = {travelId}
  232. if(uni.getStorageSync('token')){
  233. data.token = uni.getStorageSync('token')
  234. }
  235. this.$api('travelInfo', data, res=> {
  236. if(res.code==200) {
  237. this.travelDetails = res.result
  238. this.isCollect = res.result.collect
  239. this.content = res.result.travel[this.list[this.current].key]
  240. }
  241. })
  242. }
  243. }
  244. }
  245. </script>
  246. <style lang="scss">
  247. page {
  248. background-color: #060504;
  249. }
  250. </style>
  251. <style lang="scss" scoped>
  252. .pop-cont {
  253. border-radius: 30rpx;
  254. padding: 10rpx;
  255. }
  256. .head-box {
  257. background: url('@/static/image/nav-bg.png') no-repeat;
  258. background-size: 100% 100%;
  259. width: 100%;
  260. height: 534rpx;
  261. top: 0;
  262. position: absolute;
  263. z-index: -1;
  264. }
  265. .content {
  266. margin-top: 40rpx;
  267. padding: 0 30rpx 170rpx;
  268. padding-top: calc(var(--status-bar-height) + 110rpx);
  269. .content-head {
  270. position: relative;
  271. .image-box {
  272. width: 100%;
  273. border-radius: 20rpx 20rpx 0 0;
  274. height: 546rpx;
  275. }
  276. .msg-box {
  277. background: #1B1713;
  278. border-radius: 27rpx 27rpx 67rpx 67rpx;
  279. position: absolute;
  280. top: 429rpx;
  281. left: 0;
  282. right: 0;
  283. padding-top: 38rpx;
  284. .msg-box-title {
  285. font-weight: 500;
  286. font-size: 32rpx;
  287. color: #FFFFFF;
  288. margin-bottom: 40rpx;
  289. padding-left: 38rpx;
  290. }
  291. .msg-box-time {
  292. font-weight: 400;
  293. font-size: 27rpx;
  294. color: #999999;
  295. padding-left: 38rpx;
  296. }
  297. .lingdui-box {
  298. margin-top: 43rpx;
  299. height: 130rpx;
  300. background: #26201A;
  301. border-radius: 60rpx;
  302. display: flex;
  303. align-items: center;
  304. padding: 0 40rpx;
  305. .use-img {
  306. width: 86rpx;
  307. height: 86rpx;
  308. border-radius: 50%;
  309. }
  310. .lingdui-msg {
  311. flex: 1;
  312. margin-left: 24rpx;
  313. .lingdui-msg-name {
  314. font-weight: 500;
  315. font-size: 29rpx;
  316. color: #E6E6E6;
  317. display: flex;
  318. align-items: center;
  319. margin-bottom: 11rpx;
  320. .name-tip {
  321. padding: 0 20rpx;
  322. height: 27rpx;
  323. background: #3C2D17;
  324. border-radius: 0rpx 12rpx 12rpx 12rpx;
  325. font-weight: 500;
  326. font-size: 19rpx;
  327. color: #FFA200;
  328. line-height: 27rpx;
  329. margin-left: 14rpx;
  330. }
  331. }
  332. }
  333. .add-wx {
  334. width: 172rpx;
  335. height: 51rpx;
  336. background: #3C2D17;
  337. border-radius: 23rpx 23rpx 23rpx 23rpx;
  338. text-align: center;
  339. line-height: 51rpx;
  340. font-weight: 400;
  341. font-size: 25rpx;
  342. color: #FF8A00;
  343. }
  344. }
  345. }
  346. }
  347. .title-box {
  348. font-weight: 500;
  349. font-size: 33rpx;
  350. color: #E6E6E6;
  351. text-align: center;
  352. position: relative;
  353. &::after {
  354. content: "";
  355. position: absolute;
  356. top: 50%;
  357. left: 0;
  358. transform: translate(0,-50%);
  359. width: 100%;
  360. height: 12rpx;
  361. background: url(@/static/image/home/title-line.png) no-repeat;
  362. background-size: 100% 100%;
  363. }
  364. }
  365. .iconImages{
  366. margin-top: 400rpx;
  367. padding: 20rpx;
  368. }
  369. .lv-miaoshu {
  370. margin-top: 20rpx;
  371. .value-box {
  372. background: #1B1713;
  373. border-radius: 27rpx;
  374. margin-top: 35rpx;
  375. .tabs-box {
  376. border-bottom: 1px solid #2D241B;
  377. }
  378. .lv-msg-box {
  379. padding: 20rpx 40rpx;
  380. font-weight: 400;
  381. font-size: 27rpx;
  382. color: #E6E6E6;
  383. line-height: 41rpx;
  384. }
  385. }
  386. }
  387. }
  388. .bottom-box {
  389. position: fixed;
  390. bottom: 0;
  391. left: 0;
  392. right: 0;
  393. height: 150rpx;
  394. background-color: #1B1713;
  395. display: flex;
  396. align-items: center;
  397. padding: 0 40rpx;
  398. .price-box {
  399. font-weight: 400;
  400. font-size: 25rpx;
  401. color: #999999;
  402. flex: 1;
  403. .peice-val {
  404. font-weight: 500;
  405. font-size: 40rpx;
  406. color: #FF3535;
  407. margin-bottom: 15rpx;
  408. text {
  409. font-size: 26rpx;
  410. }
  411. }
  412. }
  413. .caozuo-box {
  414. display: flex;
  415. align-items: center;
  416. .caozuo-item {
  417. font-weight: 400;
  418. font-size: 20rpx;
  419. color: #999999;
  420. padding: 0 35rpx;
  421. text-align: center;
  422. height: 100rpx;
  423. display: flex;
  424. flex-direction: column;
  425. align-items: center;
  426. image {
  427. width: 48rpx;
  428. height: 48rpx;
  429. margin-bottom: 10rpx;
  430. }
  431. }
  432. .border-r {
  433. position: relative;
  434. // border-right: 1px solid #4A3E32;
  435. &::after {
  436. content: "";
  437. width: 2rpx;
  438. height: 47rpx;
  439. position: absolute;
  440. right: 0;
  441. top: 50%;
  442. transform: translate(0,-50%);
  443. background-color: #4A3E32;
  444. }
  445. }
  446. .isCollect{
  447. color: #f40;
  448. font-size: 28rpx;
  449. height: 100%;
  450. display: flex;
  451. align-items: center;
  452. }
  453. }
  454. .btn-box {
  455. width: 252rpx;
  456. height: 74rpx;
  457. font-weight: 500;
  458. font-size: 32rpx;
  459. color: #FFFFFF;
  460. text-align: center;
  461. line-height: 74rpx;
  462. background: url(@/static/image/home/hdqd-btn.png) no-repeat;
  463. background-size: 100% 100%;
  464. }
  465. .btn-box-2 {
  466. width: 252rpx;
  467. height: 74rpx;
  468. font-weight: 500;
  469. font-size: 32rpx;
  470. text-align: center;
  471. line-height: 74rpx;
  472. background-size: 100% 100%;
  473. background: #333;
  474. color: #999;
  475. border-radius: 45rpx;
  476. margin-bottom: 13rpx;
  477. }
  478. }
  479. </style>