123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- Component({
-
-
-
-
- properties: {
- source: {
- type: String,
- value: ''
- },
- item: {
- type: Object,
- value: {}
- },
- couponStatus: {
- type: Number,
- value: 0
- },
- checkStatus: {
- type: Boolean,
- value: false
- }
- },
-
- data: {
- showRuleText: false,
- marks: {
-
- 1: '抵扣券',
- 2: '满减券',
- 3: '全额减免券',
- 4: '项目卡券'
- }
- },
-
- attached: function () {
- let { item } = this.data
-
- this.setData({
- 'item.coupon_type':
- item.coupon_type == undefined ? item.type : item.coupon_type
- })
- },
-
-
-
-
-
-
-
-
-
- methods: {
-
- clickItem: function (e) {
- let { source } = this.data
- if (source == 'checkbox') {
- this.check(e)
- }
- },
-
- clickRuleText: function () {
- this.setData({
- showRuleText: !this.data.showRuleText
- })
- },
-
- check: function (e) {
-
- if(this.data.item.couponSource=='goods'){
- if (this.data.item.coupon_type == 2) {
- if(this.data.item.allow_time!=1){
- wx.showToast({
- title: '抱歉,优惠券没到使用日期',
- icon: 'none'
- })
- return
- }
- let full_price = this.data.item.full_price
- let price = this.data.item.showMoneyGood
- if (Number(price) < Number(full_price)) {
- wx.showToast({
- title: '订单不满足优惠条件',
- icon: 'none'
- })
- return
- }
- }
- }
- if (this.data.couponStatus != 0) {
- return
- }
- let checkStatus = !this.data.checkStatus
- this.setData(
- {
- checkStatus: checkStatus
- },
- this.triggerEvent('check', {
- id: e.currentTarget.dataset.id,
- checkStatus: checkStatus
- })
- )
- }
- }
- })
|