ljc 5 yıl önce
ebeveyn
işleme
2e396d92f8
2 değiştirilmiş dosya ile 12 ekleme ve 26 silme
  1. +11
    -25
      laomenkuang_project/pages/receiveTicket/receiveTicket.js
  2. +1
    -1
      laomenkuang_project/pages/receiveTicket/receiveTicket.wxml

+ 11
- 25
laomenkuang_project/pages/receiveTicket/receiveTicket.js Dosyayı Görüntüle

ticketUser:[],//优惠券信息 ticketUser:[],//优惠券信息
titleWord:"", titleWord:"",
presentId:"",//接受的id presentId:"",//接受的id
ticketNum:0,
}, },


/** /**
app.globalData.present_id = options.shareId; app.globalData.present_id = options.shareId;
this.data.presentId = options.shareId; this.data.presentId = options.shareId;
app.globalData.number = options.number; app.globalData.number = options.number;
this.setData({
ticketNum: options.number
})
this.getTicketUser(options.shareId, options.number); this.getTicketUser(options.shareId, options.number);
// wx.showToast({
// title: options.number,
// duration:2000
// wx.showModal({
// title: "options.shareId=" + options.shareId + "&options.number=" + options.number,
// content: '',
// }) // })
}, },


getTicketUser: function (id,number) {//获取优惠券信息 getTicketUser: function (id,number) {//获取优惠券信息
app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentstate', { present_id: id, present_num: number }, e => {
app.wxRequest(app.globalData.httpUrl + 'couponbuy/presentvisit', { present_id: id, present_num: number }, e => {
console.log(e) console.log(e)
if (e.code == 201) { if (e.code == 201) {
this.setData({ this.setData({
onShareAppMessage: function () { onShareAppMessage: function () {


}, },
// "p1583395285z86"
// "p1583474312b94"
getTicketFn:function(){//点击领取优惠券 getTicketFn:function(){//点击领取优惠券
var id = this.data.presentId; var id = this.data.presentId;
app.wxRequest(app.globalData.httpUrl + 'couponbuy/receive', { present_id: id }, e => {
app.wxRequest(app.globalData.httpUrl + 'couponbuy/receivepresen', { present_id: id }, e => {
console.log(e) console.log(e)
if (e.code == 200) { if (e.code == 200) {
wx.showToast({ wx.showToast({
url: '/pages/index/index' url: '/pages/index/index'
}) })
},500) },500)
} else if (e.code == -201) {//用户未注册
console.log(e.message)
} else if (e.code == -202) {//没有相应赠品记录
console.log(e.message)
}else if (e.code == -203){//无法领取自己的优惠券
console.log(e.message)
wx.showToast({
title: '领取失败',
duration: 500
})
} else if (e.code == -204) {//赠送优惠券已领取
console.log(e.message)
} else if (e.code == -205) {//优惠券已失效
console.log(e.message)
wx.showToast({
title: '优惠券已失效',
duration: 500
})
}
}
}, this,"POST") }, this,"POST")
}, },
backIndex:function(){//优惠券已被领取,点击确定返回首页 backIndex:function(){//优惠券已被领取,点击确定返回首页

+ 1
- 1
laomenkuang_project/pages/receiveTicket/receiveTicket.wxml Dosyayı Görüntüle

<view class="userPhone">{{ticketUser.user_phone}}</view> <view class="userPhone">{{ticketUser.user_phone}}</view>
<view class="giveTo">赠送给您</view> <view class="giveTo">赠送给您</view>
<view class="giveNum"> <view class="giveNum">
<text class="textNum">{{ticketUser.count}}</text>
<text class="textNum">{{ticketNum}}</text>
<text class="text">张</text> <text class="text">张</text>
</view> </view>
<view class="ticketType">{{ticketUser.coupon_type}}</view> <view class="ticketType">{{ticketUser.coupon_type}}</view>

Yükleniyor…
İptal
Kaydet