uniapp 工作常用整理

1.線上ajax操作

//查詢當前訂單是否送券
            getCoupons(orderId){
                request({
                    url: inter.getConsumerCouponStatus,
                    data: {
                        orderId: orderId
                    },
                    callback: (res) => {
                        if(res.CODE==-1){
                            uni.showToast({
                                title: res.MESSAGE,
                                icon: false
                            });
                            return false;
                        }

                        if(!res.RESULT.hasConsumerCoupon){ // true 用戶獲取了優惠券
                            uni.showToast({
                                title: '本次消費已獲贈消費券',
                                icon: 'none',
                                mask: true,
                                duration: 1500
                            });
                        }

                        setTimeout(() => {
                            uni.reLaunch({
                                url: '/pages/home/home'
                            })
                        }, 2000)
                    }
                })

            }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章