coupon_detail.js 951 Bytes
import util from '../../utils/util';
import App from '../../utils/api';
Page({
	data:{
		statuslist:{
			0:{
				status:'待使用'
			},
			1:{
				status:'已核销'
			},
		}
	},
	onLoad(opt){
		this.opt=opt;
		this.getdetail();
	},
	getdetail(){
		App.Activity.ActivityListByOpenid({aid:this.opt.aid}).then((json)=>{
			console.log(json);
			if(json.ret==200){
				this.setData({
					couponinfo:json.data[0]
				})
				if(!this.data.couponinfo.qrcode){
					this.getcode();
				}
				
			}
		})
	},
	clickSeller(){
	  let seller_tel=this.data.couponinfo.seller_tel||this.data.couponinfo.phone
	  if(typeof seller_tel=='string'){
	    seller_tel=seller_tel.split(',')
	  }
	  this.selectComponent('#as').show({
	    seller_tel:seller_tel,
	  });
	},
	getcode(){
		App.Activity.UseCreateQrcode({aid:this.opt.aid}).then((json)=>{
			console.log(json)
			if(json.ret==200){
				this.setData({
					'couponinfo.qrcode':json.data
				})
			}
		})
	}
})