|
@@ -76,6 +76,7 @@
|
|
|
<script src=//cdn.jsdelivr.net/npm/vant@2.8.2/lib/vant.min.js></script>
|
|
|
<script src=//cdn.jsdelivr.net/npm/zepto@1.2.0/dist/zepto.min.js></script>
|
|
|
<!--E-当前页面的资源-->
|
|
|
+ <script src='{{Msg "seo" "cdn"}}/big-member/js/utils.js?v={{Msg "seo" "version"}}'></script>
|
|
|
<script src='{{Msg "seo" "cdn"}}/frontRouter/wx/coupon/js/coupon-template.js?v={{Msg "seo" "version"}}'></script>
|
|
|
<script>
|
|
|
|
|
@@ -83,74 +84,13 @@
|
|
|
delimiters: ['${', '}'],
|
|
|
el: '#selectCoupon',
|
|
|
data: {
|
|
|
- allCouponData:[
|
|
|
- {
|
|
|
- lotteryId: '001',
|
|
|
- lotteryAttribute: '满减券',
|
|
|
- lotteryBeginDate: '2020.12.01',
|
|
|
- lotteryEndDate: '2020.12.31',
|
|
|
- products: [
|
|
|
- {
|
|
|
- name: "招标解读文档",
|
|
|
- url: "/bid/pc/page/bidfile_landpage",
|
|
|
- describe: "招标文件解读介绍内容"
|
|
|
- },
|
|
|
- {
|
|
|
- name: "大会员",
|
|
|
- url: "/big/page/index",
|
|
|
- describe: "大会员介绍内容"
|
|
|
- }
|
|
|
- ],
|
|
|
- available: true,
|
|
|
- full: 100,
|
|
|
- reduce: 10,
|
|
|
- instructions: '使用说明',
|
|
|
- userLotteryId: '465c',
|
|
|
- isOpen: false
|
|
|
- },
|
|
|
- {
|
|
|
- lotteryId: '001',
|
|
|
- lotteryAttribute: '折扣券',
|
|
|
- lotteryBeginDate: '2020.12.01',
|
|
|
- lotteryEndDate: '2020.12.31',
|
|
|
- products: [
|
|
|
- {
|
|
|
- name: "超级订阅",
|
|
|
- url: "/front/subscribe.html",
|
|
|
- describe: "超级订阅介绍内容"
|
|
|
- },
|
|
|
- {
|
|
|
- name: "数据导出",
|
|
|
- url: "/front/dataExport/toSieve",
|
|
|
- describe: "数据导出介绍内容"
|
|
|
- },
|
|
|
- ,
|
|
|
- {
|
|
|
- name: "大会员7天试用",
|
|
|
- url: "/big/page/index",
|
|
|
- describe: "大会员试用介绍内容"
|
|
|
- }],
|
|
|
- available: false,
|
|
|
- full: 100,
|
|
|
- reduce: 10,
|
|
|
- instructions: '使用说明',
|
|
|
- userLotteryId: '465c',
|
|
|
- isOpen: false
|
|
|
- }
|
|
|
- ],
|
|
|
- activeId: '',
|
|
|
usableCoupon: [], // 可用优惠券
|
|
|
- disabledCoupon: [] // 不可用优惠券
|
|
|
+ disabledCoupon: [], // 不可用优惠券
|
|
|
+ selectCoupon: {}
|
|
|
},
|
|
|
computed: {
|
|
|
confirmDisabled: function () {
|
|
|
- return !this.activeId
|
|
|
- }
|
|
|
- },
|
|
|
- created () {
|
|
|
- var session = sessionStorage.getItem('$select-coupon-id')
|
|
|
- if(session) {
|
|
|
- this.activeId = session
|
|
|
+ return !(Object.keys(this.selectCoupon).length > 0)
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -161,24 +101,48 @@
|
|
|
var _this= this;
|
|
|
var arr1 = []
|
|
|
var arr2 = []
|
|
|
- this.allCouponData.forEach(function(v) {
|
|
|
- v.isOpen = false
|
|
|
- if(v.available) {
|
|
|
- arr1.push(v)
|
|
|
- } else {
|
|
|
- arr2.push(v)
|
|
|
+ var checkedId = utils.getParam('checkedId')
|
|
|
+ $.ajax({
|
|
|
+ type:'POST',
|
|
|
+ url:'/jyCoupon/showCoupons',
|
|
|
+ data:{
|
|
|
+ pId: utils.getParam('pId'),
|
|
|
+ price: parseInt(utils.getParam('price')*100)
|
|
|
+ },
|
|
|
+ success:function(res) {
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ res.data.forEach(function(v) {
|
|
|
+ v.isOpen = false;
|
|
|
+ v.isChecked = false;
|
|
|
+ v.lotteryBeginDate = v.lotteryBeginDate.replace(/\-/g,'.')
|
|
|
+ v.lotteryEndDate = v.lotteryEndDate.replace(/\-/g,'.')
|
|
|
+ if (v.available) {
|
|
|
+ if(v.userLotteryId == checkedId) {
|
|
|
+ v.isChecked = true
|
|
|
+ _this.selectCoupon = v
|
|
|
+ }
|
|
|
+ arr1.push(v)
|
|
|
+ } else {
|
|
|
+ arr2.push(v)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ _this.usableCoupon = arr1;
|
|
|
+ _this.disabledCoupon = arr2;
|
|
|
+ } else {
|
|
|
+ console.log('没有优惠券')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function(err) {
|
|
|
+ console.log(err)
|
|
|
}
|
|
|
})
|
|
|
- _this.usableCoupon = arr1;
|
|
|
- _this.disabledCoupon = arr2
|
|
|
- console.log(this.usableCoupon,this.disabledCoupon)
|
|
|
},
|
|
|
- parentFn: function (id) {
|
|
|
- console.log('父组件接收:' + id)
|
|
|
- this.activeId = id
|
|
|
+ parentFn: function (obj) {
|
|
|
+ // console.log('父组件接收:' + JSON.stringify(obj))
|
|
|
+ this.selectCoupon = obj
|
|
|
},
|
|
|
saveCouponFn: function () {
|
|
|
- sessionStorage.setItem('$select-coupon-id', this.activeId)
|
|
|
+ sessionStorage.setItem('$select-coupon', JSON.stringify(this.selectCoupon))
|
|
|
history.back()
|
|
|
}
|
|
|
}
|