123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <div class="mainPage">
- <div class="residue">
- <i class="iconfont icon-gantanhao"></i>
- <span>仅剩{{data.TotalCount - data.UsedCount}}张券可以领取!</span>
- </div>
- <div class="logo">
- <img :src="logo" alt="">
- </div>
- <div class="banner" v-if="!video">
- <img :src="data.CoverUrl" alt="" width="100%" height="100%">
- </div>
- <div class="content">
- <div class="title">{{data.CardName}}</div>
- <div class="video" v-if='video'>
- <video :src="data.VideoUrl" width="100%" height="100%"></video>
- </div>
- <div class="text">
- <div>
- <i class="icon-shuoming iconfont"></i>
- <span>卡券使用说明</span>
- </div>
- <pre>{{data.Share.CardUseInstruction}}</pre>
- </div>
- <div class="text">
- <div>
- <i class="icon-kaquan iconfont"></i>
- <span>卡券有效期</span>
- </div>
- <pre>有效期至{{toolClass.dateFormat(data.EndDate)}},请在有效期结束前使用, 过期作废;</pre>
- </div>
- <div class="text">
- <div>
- <i class="icon-dingwei iconfont"></i>
- <span>服务网点</span>
- </div>
- <pre>{{data.address}}</pre>
- </div>
- <div class="submit" v-if="button" @click="receive">确认领取</div>
- <div class="submit" v-else>点击右上角分享给客户</div>
- </div>
- </div>
- </template>
-
- <script>
- import wxsdk from '../../../util/share'
- import logo from '../../../common/icon/logoTop.png'
- import { createNamespacedHelpers } from 'vuex'
- const { mapState: mapShareState, mapActions: mapShareActions } = createNamespacedHelpers('share')
- const { mapState: mapAppState, mapActions: mapAppActions } = createNamespacedHelpers('app')
-
- export default {
- data () {
- return {
- logo,
- video: true,
- button: true,
- data: {
- Share: {}
- }
- }
- },
- computed: {
- ...mapShareState({
- cardShare: x => x.cardShare,
- couponShare: x => x.couponShare
- }),
- ...mapAppState({
- caseList: x => x.CaseList
- })
- },
- created () {
- if (this.$route.params) {
- let that = this
- Object.keys(this.$route.params).forEach(function (key) {
- that.$route.query[key] = that.$route.params[key]
- })
- }
-
-
- if (this.$route.query.shareType === 'share') {
- this.button = false
- }
- this.getCaseList().then(() => {
- this.init()
- })
- },
- methods: {
- ...mapShareActions(['getCardShare', 'getCouponShare', 'setChannelCardShare', 'setChannelCouponShare']),
- ...mapAppActions(['getCaseList']),
- init () {
- if (this.$route.query.type === 'card') {
- this.getCardShare({ id: this.$route.query.id }).then(() => {
- this.data = this.cardShare.Card
- this.data.address = this.caseList.filter(x => x.CaseId === this.data.CaseId)[0].CaseAddress
- if (!this.data.VideoUrl) {
- this.video = false
- }
- this.sdk()
- })
- } else {
- this.getCouponShare({ id: this.$route.query.id }).then(() => {
- this.data = this.cardShare.Card
- this.data.address = this.caseList.filter(x => x.CaseId === this.data.CaseId)[0].CaseAddress
- if (!this.data.VideoUrl) {
- this.video = false
- }
- this.sdk()
- })
- }
- },
- receive () {
- if (this.$route.query.type === 'card') {
- this.setChannelCardShare({ id: this.$route.query.id }).then(() => {
- this.$router.push({ name: 'receiveResults', query: { type: 'success' } })
- }).catch((err) => {
- this.$router.push({ name: 'receiveResults', query: { type: 'fail' } })
- console.log(err)
- })
- } else {
- this.setChannelCouponShare({ id: this.$route.query.id }).then(() => {
- this.$router.push({ name: 'receiveResults', query: { type: 'success' } })
- }).catch((err) => {
- this.$router.push({ name: 'receiveResults', query: { type: 'fail' } })
- console.log(err)
- })
- }
- },
- random () {
- let rnd = ''
- for (let i = 0; i < 5; i++) {
- rnd += Math.floor(Math.random() * 10)
- }
- let timestamp = new Date().valueOf()
- return `${rnd}${timestamp}`
- },
- sdk () {
- let logo = this.logo.substring(2, this.logo.length)
- wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
- title: '领取卡券',
- desc: this.data.Share.CardShareInfo,
- link: `${window.location.origin}${window.location.pathname}#/receiveShared/${this.$route.query.id}/${this.$route.query.salesid}/${this.$route.query.type}/receive`,
- thu_image: `${window.location.origin}${window.location.pathname}${logo}`
- })
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- @import 'page.scss';
- </style>
|