微信

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="mainPage" v-if="show">
  3. <div class="residue">
  4. <i class="iconfont icon-gantanhao"></i>
  5. <span>仅剩{{data.TotalCount - data.UsedCount}}张券可以领取!</span>
  6. </div>
  7. <div class="logo">
  8. <img :src="logo" alt="">
  9. </div>
  10. <div class="banner" v-if="!video">
  11. <img :src="data.Images[0].CardImageUrl" alt="" width="100%" height="100%" v-if="$route.query.type === 'card'">
  12. <img :src="data.Images[0].CouponImageUrl" alt="" width="100%" height="100%" v-else>
  13. </div>
  14. <div class="content">
  15. <div class="title" v-if="$route.query.type === 'card'">{{data.CardName}}</div>
  16. <div class="title" v-else>{{data.CouponName}}</div>
  17. <div class="video" v-if='video'>
  18. <video :src="data.VideoUrl" width="100%" height="100%"></video>
  19. </div>
  20. <div class="text">
  21. <div>
  22. <i class="icon-shuoming iconfont"></i>
  23. <span>卡券使用说明</span>
  24. </div>
  25. <pre v-if="$route.query.type === 'card'">{{data.Share.CardUseInstruction}}</pre>
  26. <pre v-else>{{data.Share.UseInstruction}}</pre>
  27. </div>
  28. <div class="text">
  29. <div>
  30. <i class="icon-kaquan iconfont"></i>
  31. <span>卡券有效期</span>
  32. </div>
  33. <pre>有效期至{{toolClass.dateFormat(data.EndDate)}},请在有效期结束前使用, 过期作废;</pre>
  34. </div>
  35. <div class="text">
  36. <div>
  37. <i class="icon-dingwei iconfont"></i>
  38. <span>服务网点</span>
  39. </div>
  40. <pre>{{data.address}}</pre>
  41. </div>
  42. <div class="submit" v-if="button" @click="receive">确认领取</div>
  43. <div class="submit" v-else>点击右上角分享给客户</div>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import wxsdk from '../../../util/share'
  49. import logo from '../../../common/icon/logoTop.png'
  50. import { createNamespacedHelpers } from 'vuex'
  51. const { mapState: mapShareState, mapActions: mapShareActions } = createNamespacedHelpers('share')
  52. const { mapState: mapAppState, mapActions: mapAppActions } = createNamespacedHelpers('app')
  53. export default {
  54. data () {
  55. return {
  56. logo,
  57. video: true,
  58. button: true,
  59. show: false,
  60. data: {}
  61. }
  62. },
  63. computed: {
  64. ...mapShareState({
  65. cardShare: x => x.cardShare,
  66. couponShare: x => x.couponShare
  67. }),
  68. ...mapAppState({
  69. caseList: x => x.CaseList
  70. })
  71. },
  72. created () {
  73. if (this.$route.params) {
  74. let that = this
  75. Object.keys(this.$route.params).forEach(function (key) {
  76. that.$route.query[key] = that.$route.params[key]
  77. })
  78. }
  79. if (this.$route.query.sharetype === 'share') {
  80. this.button = false
  81. }
  82. this.getCaseList().then(() => {
  83. this.init()
  84. })
  85. },
  86. methods: {
  87. ...mapShareActions(['getCardShare', 'getCouponShare', 'setChannelCardShare', 'setChannelCouponShare']),
  88. ...mapAppActions(['getCaseList']),
  89. init () {
  90. if (this.$route.query.type === 'card') {
  91. this.getCardShare({ id: this.$route.query.id }).then(() => {
  92. this.data = this.cardShare.Card
  93. this.data.address = this.caseList.filter(x => x.CaseId === this.data.CaseId)[0].CaseAddress
  94. if (!this.data.VideoUrl) {
  95. this.video = false
  96. }
  97. this.show = true
  98. this.sdk(this.data.Share.CardShareInfo)
  99. })
  100. } else {
  101. this.getCouponShare({ id: this.$route.query.id }).then(() => {
  102. this.data = this.couponShare.coupon
  103. this.data.address = this.caseList.filter(x => x.CaseId === this.data.CaseId)[0].CaseAddress
  104. if (!this.data.VideoUrl) {
  105. this.video = false
  106. }
  107. this.show = true
  108. this.sdk(this.data.Share.CouponShareInfo)
  109. })
  110. }
  111. },
  112. receive () {
  113. if (this.$route.query.type === 'card') {
  114. this.setChannelCardShare({ id: this.$route.query.id }).then(() => {
  115. this.$router.push({ name: 'receiveResults', query: { type: 'success' } })
  116. }).catch((err) => {
  117. this.$router.push({ name: 'receiveResults', query: { type: 'fail' } })
  118. console.log(err)
  119. })
  120. } else {
  121. this.setChannelCouponShare({ id: this.$route.query.id }).then(() => {
  122. this.$router.push({ name: 'receiveResults', query: { type: 'success' } })
  123. }).catch((err) => {
  124. this.$router.push({ name: 'receiveResults', query: { type: 'fail' } })
  125. console.log(err)
  126. })
  127. }
  128. },
  129. sdk (info) {
  130. let logo = this.data.Images[0].CouponImageUrl ? this.data.Images[0].CouponImageUrl : this.data.Images[0].CardImageUrl
  131. wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
  132. title: '领取卡券',
  133. desc: info,
  134. link: `${window.location.origin}${window.location.pathname}#/receiveChannelShared/${this.$route.query.id}/${this.$route.query.type}/receive`,
  135. thu_image: `${window.location.origin}${window.location.pathname}${logo}`
  136. })
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. @import 'page.scss';
  143. </style>