exchangeDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <view class="exchangeDetail">
  3. <!-- 自定义导航栏 -->
  4. <u-navbar :leftText='title' fixed safeAreaInsetTop :placeholder='true' :bgColor="bgColor" @leftClick='back'>
  5. </u-navbar>
  6. <!-- 兑换状态 -->
  7. <view class="detailCard" v-if="productType == 2 ">
  8. <image src="/static/icon/success.png"></image>
  9. <text>奖品兑换成功</text>
  10. </view>
  11. <view class="detailCard" v-if="productType == 1 ">
  12. <image src="/static/icon/success.png"></image>
  13. <text>商品兑换成功</text>
  14. <text>-{{integral}}积分</text>
  15. </view>
  16. <!-- 按钮 -->
  17. <view class="btn">
  18. <view class="back" @click="goBack">
  19. <text>返回首页</text>
  20. </view>
  21. <view class="checkout" @click="goOrderDetail">
  22. <text>查看订单</text>
  23. </view>
  24. </view>
  25. <!-- 加入会员 -->
  26. <view class="bottomCard">
  27. <!-- 广告图 -->
  28. <view class="home-banner">
  29. <view class="home-banner-img" v-if="in_page==3 && type == 1"
  30. @click="goOtherPage(jump_type,jump_config)">
  31. <image style="width: 100%; height: 492rpx;border-radius: 12rpx 12rpx 0 0;" :src="advData.img" mode="">
  32. </image>
  33. </view>
  34. <view class="home-banner-img" v-if="in_page==3 && type == 2">
  35. <image class="banner-img" v-if="!isOpenVideo" @click="openVideoPlay"
  36. style="width: 100%; height: 492rpx; border-radius: 12rpx 12rpx 0 0;" :src="videoCoverImg" mode=""></image>
  37. <video class="baner-video" id="myVideo" ref="myVideo"
  38. style="width: 100%; height: 492rpx;border-radius: 12rpx 12rpx 0 0;" :src="videoSrc" controls
  39. :enable-progress-gesture="false">
  40. </video>
  41. </view>
  42. </view>
  43. <view class="content" @click="goJoin">
  44. <text>立即加入IHG会员</text>
  45. <image src="/static/icon/right.png"></image>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. //跳转h5,小程序,其他页面
  55. jump_type_vip: '',
  56. jump_config_vip: {},
  57. //加入会员广告配置
  58. advise: '',
  59. //自定义导航栏
  60. bgColor: '#f9f9f9',
  61. title: '兑换详情',
  62. //积分商品1奖品2兑换
  63. productType: '',
  64. //积分
  65. integral: '',
  66. admin: '',
  67. isOpenVideo: false,
  68. jump_type: '',
  69. jump_config: '',
  70. advData: '',
  71. advertis: '',
  72. in_page: '',
  73. type: '',
  74. videoCoverImg: '',
  75. videoSrc: ''
  76. }
  77. },
  78. onReady: function(res) {
  79. this.videoContext = uni.createVideoContext('myVideo')
  80. },
  81. onLoad(o) {
  82. this.getAdvertis()
  83. this.admin = this.$store.getters.userInfo
  84. if (o.productType == 1) {
  85. this.productType = o.productType
  86. this.integral = o.integral
  87. }else if(o.productType == 2){
  88. this.productType = o.productType
  89. }
  90. this.advise = this.$store.getters.allset.add_member
  91. this.jump_type_vip = this.advise.value.exchange_jump_type
  92. if (this.jump_type_vip == 1) {
  93. this.jump_config_vip = this.advise.value.exchange_h5_url
  94. } else if (this.jump_type_vip == 2) {
  95. this.jump_config_vip.appid = this.advise.value.exchange_appid
  96. this.jump_config_vip.path = this.advise.value.exchange_path
  97. } else if (this.jump_type_vip == 3) {
  98. this.jump_config_vip = this.advise.value.exchange_other_path
  99. }
  100. },
  101. onUnload() {
  102. this.back()
  103. },
  104. methods: {
  105. //返回上一级
  106. back() {
  107. if(this.productType == 1){
  108. uni.$emit('refreshData')
  109. uni.navigateBack({
  110. delta: 2,
  111. })
  112. }else if(this.productType == 2){
  113. uni.$emit('refreshPrizeData')
  114. uni.navigateBack({
  115. delta: 1,
  116. })
  117. }
  118. },
  119. //广告图
  120. getAdvertis() {
  121. this.$api.document.allSet().then(res => {
  122. this.advertis = res.data.advertises.filter(item => {
  123. return item.in_page == 3
  124. })
  125. this.advData = this.advertis[0];
  126. console.log(this.advData.img, '------>this.advData');
  127. if (this.advertis[0].type == 1) {
  128. this.in_page = 3
  129. this.type = 1
  130. this.jump_type = this.advData.jump_type
  131. this.jump_config = this.advData.jump_config
  132. } else if (this.advertis[0].type == 2) {
  133. this.in_page = 3
  134. this.type = 2
  135. this.videoCoverImg = this.advertis[0].video_cover
  136. this.videoSrc = this.advertis[0].video
  137. }
  138. })
  139. },
  140. //点击视频封面图片,播放视频
  141. openVideoPlay() {
  142. this.isOpenVideo = !this.isOpenVideo
  143. this.videoContext.play()
  144. },
  145. //跳转方法
  146. jumpHAppID(id, urls) {
  147. if (id == 1) {
  148. const url = urls; // 跳转的外链
  149. const navtitle = 'H5'; // 这个标题是你自己可以设置的
  150. uni.navigateTo({
  151. // 跳转到webview页面
  152. url: `/pages/webview/webview?url=${url}&nav=${navtitle}`,
  153. success: () => {
  154. console.log('成功')
  155. },
  156. fail: (e) => {
  157. console.log(e, "失败")
  158. }
  159. });
  160. } else if (id == 2) {
  161. let obj = JSON.parse(urls);
  162. wx.navigateToMiniProgram({
  163. appId: `${obj.appid}`, //appid
  164. path: `${obj.path}`, //path
  165. extraData: { //参数
  166. foo: 'bar'
  167. },
  168. // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  169. success(res) {
  170. console.log('成功')
  171. // 打开成功
  172. },
  173. fail(e) {
  174. console.log(e, '失败')
  175. }
  176. })
  177. } else if (id == 3) {
  178. uni.redirectTo({
  179. url: urls,
  180. fail: (err) => {
  181. uni.reLaunch({
  182. url: urls
  183. })
  184. }
  185. })
  186. }
  187. },
  188. //点击图片跳转
  189. goOtherPage(id, url) {
  190. this.jumpHAppID(id, url)
  191. },
  192. // 返回首页
  193. goBack() {
  194. uni.reLaunch({
  195. url: '/pages/index/index'
  196. })
  197. },
  198. // 跳转订单详情
  199. goOrderDetail() {
  200. uni.navigateTo({
  201. url: '/pages/my/myorders/orders'
  202. })
  203. },
  204. //获取当前页面路径
  205. getPageUrl() {
  206. const pages = getCurrentPages();
  207. console.log(pages, '--------->pages')
  208. if (pages.length == 1) {
  209. const currentPage = pages[0];
  210. let pageUrl = `/${currentPage.route}`;
  211. return pageUrl
  212. console.log('当前页面url:', pageUrl);
  213. } else {
  214. const currentPage = pages[pages.length - 1];
  215. let pageUrl = `/${currentPage.route}`;
  216. return pageUrl
  217. console.log('当前页面url:', pageUrl);
  218. }
  219. },
  220. // 跳转其他小程序
  221. jumpHAppIDVip(id, urls) {
  222. if (id == 1) {
  223. const url = urls; // 跳转的外链
  224. const navtitle = 'H5'; // 这个标题是你自己可以设置的
  225. uni.navigateTo({
  226. // 跳转到webview页面
  227. url: `/pages/webview/webview?url=${url}&nav=${navtitle}`,
  228. success: () => {
  229. console.log('成功')
  230. },
  231. fail: (e) => {
  232. console.log(e, "失败")
  233. }
  234. });
  235. } else if (id == 2) {
  236. let _this = this
  237. let obj = urls;
  238. console.log(obj, '----->obj');
  239. wx.navigateToMiniProgram({
  240. appId: `${obj.appid}`, //appid
  241. path: `${obj.path}`, //path
  242. extraData: { //参数
  243. foo: 'bar'
  244. },
  245. // envVersion: 'develop', //开发版develop 开发版 trial 体验版 release 正式版
  246. success(res) {
  247. let page = _this.getPageUrl()
  248. let user_id = ''
  249. if (_this.admin != null) {
  250. user_id = _this.admin.id
  251. } else {
  252. user_id = 0
  253. }
  254. _this.$api.my.userMemberAdd({
  255. user_id,
  256. page,
  257. }).then(res => {
  258. console.log(res.data);
  259. })
  260. // 打开成功
  261. },
  262. fail(e) {
  263. console.log(e, '失败')
  264. }
  265. })
  266. } else if (id == 3) {
  267. uni.redirectTo({
  268. url: urls,
  269. fail: (err) => {
  270. uni.reLaunch({
  271. url: urls
  272. })
  273. }
  274. })
  275. }
  276. },
  277. // 跳转其他小程序
  278. goJoin() {
  279. let _this = this
  280. this.jumpHAppIDVip(this.jump_type_vip, this.jump_config_vip)
  281. },
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped>
  286. $pageColor:#F9F9F9;
  287. $bgColor:#FFFFFF;
  288. @mixin flexlayout {
  289. display: flex;
  290. align-items: center;
  291. justify-content: center;
  292. }
  293. .exchangeDetail {
  294. height: 100%;
  295. background: $pageColor;
  296. }
  297. .detailCard {
  298. width: 750rpx;
  299. height: 446rpx;
  300. display: flex;
  301. flex-direction: column;
  302. justify-content: center;
  303. align-items: center;
  304. image {
  305. width: 120rpx;
  306. height: 120rpx;
  307. margin-bottom: 48rpx;
  308. }
  309. text {
  310. display: block;
  311. font-size: 32rpx;
  312. font-family: PingFangSC-Medium, PingFang SC;
  313. font-weight: 500;
  314. color: #080F18;
  315. }
  316. }
  317. .btn {
  318. width: 750rpx;
  319. height: 76rpx;
  320. display: flex;
  321. justify-content: space-between;
  322. align-items: center;
  323. padding: 0 32rpx;
  324. .back {
  325. width: 332rpx;
  326. height: 76rpx;
  327. background: #F5F5F5;
  328. border-radius: 8rpx;
  329. @include flexlayout() text {
  330. font-size: 30rpx;
  331. font-family: PingFang-SC-Bold, PingFang-SC;
  332. font-weight: bold;
  333. color: #FF6301;
  334. }
  335. }
  336. .checkout {
  337. width: 332rpx;
  338. height: 76rpx;
  339. background: linear-gradient(270deg, #FF6200 0%, #FF9342 100%);
  340. border-radius: 8rpx;
  341. @include flexlayout() text {
  342. font-size: 30rpx;
  343. font-family: PingFang-SC-Bold, PingFang-SC;
  344. font-weight: bold;
  345. color: #FFFFFF;
  346. }
  347. }
  348. }
  349. .bottomCard {
  350. width: 690rpx;
  351. height: 584rpx;
  352. background: #FFFFFF;
  353. box-shadow: 0px 8rpx 16rpx 0px rgba(220, 222, 229, 0.71);
  354. border-radius: 20rpx;
  355. background: $bgColor;
  356. margin-left: 30rpx;
  357. margin-top: 64rpx;
  358. position: relative;
  359. image {
  360. width: 690rpx;
  361. height: 492rpx;
  362. }
  363. .content {
  364. width: 690rpx;
  365. height: 92rpx;
  366. position: absolute;
  367. bottom: 0;
  368. margin-top: -9rpx;;
  369. @include flexlayout();
  370. image {
  371. width: 12rpx;
  372. height: 20rpx;
  373. margin-left: 8rpx;
  374. }
  375. text {
  376. font-size: 30rpx;
  377. font-family: PingFang-SC-Medium, PingFang-SC;
  378. font-weight: 500;
  379. color: #333333;
  380. text-shadow: 0px 8rpx 16rpx rgba(220, 222, 229, 0.71);
  381. }
  382. }
  383. }
  384. .home-banner {
  385. // height: 640rpx;
  386. // padding: 0 30rpx;
  387. // padding-top: 64rpx;
  388. .home-banner-img {
  389. position: relative;
  390. width: 100%;
  391. // height: 100%;
  392. .baner-video {
  393. position: absolute;
  394. top: 0;
  395. left: 0;
  396. }
  397. .banner-img {
  398. position: absolute;
  399. top: 0;
  400. left: 0;
  401. z-index: 9;
  402. }
  403. .img-clean {
  404. position: absolute;
  405. right: 28rpx;
  406. top: 30rpx;
  407. z-index: 99;
  408. }
  409. .img-IHg {
  410. width: 84rpx;
  411. height: 84rpx;
  412. background-color: #fff;
  413. box-shadow: 0px 8rpx 24rpx 0px rgba(220, 222, 229, 0.4);
  414. border-radius: 50%;
  415. display: flex;
  416. align-items: center;
  417. justify-content: center;
  418. position: fixed;
  419. top: 1030rpx;
  420. right: 30rpx;
  421. z-index: 99;
  422. }
  423. }
  424. }
  425. </style>