1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import { couponDetail } from '../../api/other';
- Page({
- data: {
- codeType: 'qr',
- status:0,
- id:'',
- couponInfo:{}
- },
- goPage(){
- wx.switchTab({
- url: '/pages/store/store'
- })
- },
- 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'
- });
- }
- })
|