12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { couponDetail } from '../../api/other';
- import {BASE_URL} from '../../utils/request';
- Page({
- data: {
- baseUrl:BASE_URL,
- codeType: 'qr',
- status:0,
- id:'',
- couponInfo:{}
- },
- goPage(){
- wx.navigateTo({
- url: '/pages/storeIcon/storeIcon'
- })
- },
- onLoad(options) {
- this.setData({
- status:options.status,
- id:options.id
- })
- },
- onReady(){
- this.getcouponDetail();
- },
- async getcouponDetail(){
- const res = await couponDetail(this.data.id);
- if(res.code == 200){
- let item = {
- ...res.data,
- verify_status_text:res.data.verify_status == 0?'未核销':res.data.verify_status == 1?'已核销':'已过期'
- }
- this.setData({
- couponInfo:item
- })
- }else{
- wx.showToast({
- title: res.message || '请求失败',
- icon: 'none',
- duration: 2000
- });
- }
- console.log(res)
- },
- toggleCode() {
- this.setData({
- codeType: this.data.codeType === 'qr' ? 'bar' : 'qr'
- });
- },
- onChange(){
- this.getcouponDetail();
- }
- })
|