| @@ -123,7 +123,11 @@ var config = { | |||||
| * 和login页面 | * 和login页面 | ||||
| * 页面的图标 | * 页面的图标 | ||||
| */ | */ | ||||
| marketicon:'/mall/getAppIcon' | |||||
| marketicon:'/mall/getAppIcon', | |||||
| /** | |||||
| * 检查核销的状态 | |||||
| */ | |||||
| getStatus:"/couponOrder/getStatus" | |||||
| }, | }, | ||||
| weapp: { | weapp: { | ||||
| @@ -9,7 +9,13 @@ Page({ | |||||
| data: {}, | data: {}, | ||||
| createDate: "", | createDate: "", | ||||
| expiredTime: "", | expiredTime: "", | ||||
| updateDate:'' | |||||
| updateDate: "", | |||||
| //存储计时器 | |||||
| setInter: "" | |||||
| }, | |||||
| onUnload: function() { | |||||
| let that = this; | |||||
| clearInterval(that.data.setInter); | |||||
| }, | }, | ||||
| onLoad: function(options) { | onLoad: function(options) { | ||||
| console.log(options); | console.log(options); | ||||
| @@ -23,32 +29,34 @@ Page({ | |||||
| options.quancode != null && | options.quancode != null && | ||||
| (options.quancode != "" && options.quancode) != undefined | (options.quancode != "" && options.quancode) != undefined | ||||
| ) { | ) { | ||||
| Http.get({ | |||||
| url: config.api.couponOrderDetail, | |||||
| data: { | |||||
| couponOrderId: options.quancode | |||||
| } | |||||
| }).then(res => { | |||||
| console.log(res); | |||||
| that.setData({ | |||||
| data: res.data | |||||
| that.data.setInter = setInterval(function(){ | |||||
| Http.get({ | |||||
| url: config.api.couponOrderDetail, | |||||
| data: { | |||||
| couponOrderId: options.quancode | |||||
| } | |||||
| }).then(res => { | |||||
| console.log(res); | |||||
| that.setData({ | |||||
| data: res.data | |||||
| }); | |||||
| that.setData({ | |||||
| expiredTime: util.fmtDate(that.data.data.expiredTime), | |||||
| updateDate: util.fmtDate(that.data.data.updateDate), | |||||
| createDate: util.fmtDate(that.data.data.createDate) | |||||
| }); | |||||
| }); | }); | ||||
| that.setData({ | |||||
| expiredTime: util.fmtDate(that.data.data.expiredTime), | |||||
| updateDate: util.fmtDate(that.data.data.updateDate), | |||||
| createDate: util.fmtDate(that.data.data.createDate) | |||||
| }); | |||||
| }); | |||||
| }, 200); | |||||
| } | } | ||||
| util.barcode("barcode", options.quancode, 510, 100); | util.barcode("barcode", options.quancode, 510, 100); | ||||
| util.qrcode("qrcode", options.quancode,350, 350); | |||||
| util.qrcode("qrcode", options.quancode, 350, 350); | |||||
| }, | }, | ||||
| phone: function() { | phone: function() { | ||||
| let that = this; | let that = this; | ||||
| console.log(that.data); | console.log(that.data); | ||||
| if (that.data.data.merchantLinkPhone) { | if (that.data.data.merchantLinkPhone) { | ||||
| wx.makePhoneCall({ | wx.makePhoneCall({ | ||||
| phoneNumber: that.data.data.merchantLinkPhone | |||||
| phoneNumber: that.data.data.merchantLinkPhone | |||||
| }); | }); | ||||
| } | } | ||||
| } | } | ||||
| @@ -10,7 +10,10 @@ Page({ | |||||
| showModalStatus: false, | showModalStatus: false, | ||||
| flag: 0, | flag: 0, | ||||
| order: null, | order: null, | ||||
| orderId: null | |||||
| orderId: null, | |||||
| //存储计时器 | |||||
| setInter: "", | |||||
| mystatus:'' | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -19,36 +22,51 @@ Page({ | |||||
| */ | */ | ||||
| powerDrawer: function(e) { | powerDrawer: function(e) { | ||||
| let that = this; | |||||
| // couponOrderStatus | // couponOrderStatus | ||||
| // 0 未使用 | // 0 未使用 | ||||
| // 1 已使用 | // 1 已使用 | ||||
| // 2 已过期 | // 2 已过期 | ||||
| // 3 已经退款 | // 3 已经退款 | ||||
| console.log(e); | console.log(e); | ||||
| wx.navigateTo({ | |||||
| url: `/pages/orderquanma/index?quancode=${ | |||||
| e.currentTarget.dataset.quancode | |||||
| }&title=${e.currentTarget.dataset.title}&subtitle=${ | |||||
| e.currentTarget.dataset.subtitle | |||||
| }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | |||||
| e.currentTarget.dataset.couponorderstatus | |||||
| }` | |||||
| }); | |||||
| console.log(e.currentTarget.dataset.quancode); | |||||
| console.log(e.currentTarget.dataset.couponorderstatus); | |||||
| if (that.data.mystatus == null || that.data.mystatus == undefined) { | |||||
| wx.navigateTo({ | |||||
| url: `/pages/orderquanma/index?quancode=${ | |||||
| e.currentTarget.dataset.quancode | |||||
| }&title=${e.currentTarget.dataset.title}&subtitle=${ | |||||
| e.currentTarget.dataset.subtitle | |||||
| }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | |||||
| e.currentTarget.dataset.couponorderstatus | |||||
| }` | |||||
| }); | |||||
| console.log(e.currentTarget.dataset.couponorderstatus); | |||||
| } else { | |||||
| wx.navigateTo({ | |||||
| url: `/pages/orderquanma/index?quancode=${ | |||||
| e.currentTarget.dataset.quancode | |||||
| }&title=${e.currentTarget.dataset.title}&subtitle=${ | |||||
| e.currentTarget.dataset.subtitle | |||||
| }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | |||||
| that.data.mystatus | |||||
| }` | |||||
| }); | |||||
| } | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
| */ | */ | ||||
| onLoad: function(options) { | onLoad: function(options) { | ||||
| let that = this; | let that = this; | ||||
| console.log(options.orderId); | |||||
| console.log(options.flag + "我是付款的标识"); | |||||
| this.setData({ | this.setData({ | ||||
| orderId: options.orderId | orderId: options.orderId | ||||
| }); | }); | ||||
| wx.showLoading({ | |||||
| title: "加载中" | |||||
| }); | |||||
| setTimeout(function() { | |||||
| wx.hideLoading(); | |||||
| }, 500); | |||||
| // that.data.setInter = setInterval(function() { | |||||
| Http.get({ | Http.get({ | ||||
| url: config.api.orderDetail, | url: config.api.orderDetail, | ||||
| @@ -64,12 +82,13 @@ Page({ | |||||
| //createDate 创建时间 | //createDate 创建时间 | ||||
| var createDate = util.fmtDate(res.data.createDate); | var createDate = util.fmtDate(res.data.createDate); | ||||
| console.log(createDate); | console.log(createDate); | ||||
| that.setData({ | that.setData({ | ||||
| createDate: createDate | createDate: createDate | ||||
| }); | }); | ||||
| }); | }); | ||||
| // }, 100); | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -193,23 +212,15 @@ Page({ | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
| */ | */ | ||||
| onReady: function() {}, | |||||
| /** | |||||
| * 生命周期函数--监听页面显示 | |||||
| */ | |||||
| onShow: function(options) {}, | |||||
| onShow: function() { | |||||
| console.log(this.data.mystatus) | |||||
| }, | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面隐藏 | * 生命周期函数--监听页面隐藏 | ||||
| */ | */ | ||||
| onHide: function() {}, | onHide: function() {}, | ||||
| /** | |||||
| * 生命周期函数--监听页面卸载 | |||||
| */ | |||||
| onUnload: function() {}, | |||||
| /** | /** | ||||
| * 页面相关事件处理函数--监听用户下拉动作 | * 页面相关事件处理函数--监听用户下拉动作 | ||||
| */ | */ | ||||
| @@ -12,7 +12,8 @@ | |||||
| <view> | <view> | ||||
| <text>{{item.title}}</text> | <text>{{item.title}}</text> | ||||
| <text wx:if="{{item.orderStatus==0}}">待付款</text> | <text wx:if="{{item.orderStatus==0}}">待付款</text> | ||||
| <text wx:if="{{item.orderStatus==1}}">已付款</text> | |||||
| <text wx:if="{{item.orderStatus==1&&item.salePrice==0}}">免费领取</text> | |||||
| <text wx:if="{{item.orderStatus==1&&item.salePrice!=0}}">已付款</text> | |||||
| <text wx:if="{{item.orderStatus==2}}">已过期</text> | <text wx:if="{{item.orderStatus==2}}">已过期</text> | ||||
| </view> | </view> | ||||
| <view>{{item.subTitle}}</view> | <view>{{item.subTitle}}</view> | ||||
| @@ -1,78 +1,57 @@ | |||||
| let util = require("../../utils/util"); | let util = require("../../utils/util"); | ||||
| let Http = require("../../utils/HttpBasics"); | |||||
| let config = require("../../config/config.js"); | |||||
| Page({ | Page({ | ||||
| /** | |||||
| * 页面的初始数据 | |||||
| */ | |||||
| data: { | data: { | ||||
| code:'' | |||||
| code: "", | |||||
| //存储计时器 | |||||
| setInter: "" | |||||
| }, | }, | ||||
| /** | |||||
| * 生命周期函数--监听页面加载 | |||||
| */ | |||||
| onLoad: function (options) { | |||||
| console.log(options.quancode); | |||||
| console.log(options); | |||||
| console.log(options.subtitle); | |||||
| onLoad: function(options) { | |||||
| let that = this; | |||||
| util.barcode("barcode", options.quancode, 500, 100); | util.barcode("barcode", options.quancode, 500, 100); | ||||
| util.qrcode("qrcode", options.quancode, 350, 350); | util.qrcode("qrcode", options.quancode, 350, 350); | ||||
| this.setData({ | |||||
| code:options.quancode, | |||||
| title:options.title, | |||||
| subtitle:options.subtitle, | |||||
| remark:options.remark, | |||||
| couponorderstatus:options.couponorderstatus | |||||
| }) | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面初次渲染完成 | |||||
| */ | |||||
| onReady: function () { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面显示 | |||||
| */ | |||||
| onShow: function () { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面隐藏 | |||||
| */ | |||||
| onHide: function () { | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面卸载 | |||||
| */ | |||||
| onUnload: function () { | |||||
| }, | |||||
| /** | |||||
| * 页面相关事件处理函数--监听用户下拉动作 | |||||
| */ | |||||
| onPullDownRefresh: function () { | |||||
| }, | |||||
| /** | |||||
| * 页面上拉触底事件的处理函数 | |||||
| */ | |||||
| onReachBottom: function () { | |||||
| }, | |||||
| /** | |||||
| * 用户点击右上角分享 | |||||
| */ | |||||
| onShareAppMessage: function () { | |||||
| that.setData({ | |||||
| code: options.quancode, | |||||
| title: options.title, | |||||
| subtitle: options.subtitle, | |||||
| remark: options.remark, | |||||
| couponorderstatus: options.couponorderstatus | |||||
| }); | |||||
| that.data.setInter = setInterval(function() { | |||||
| if (that.data.couponorderstatus == 0) { | |||||
| Http.get({ | |||||
| url: config.api.getStatus, | |||||
| data: { | |||||
| couponOrderId: options.quancode | |||||
| } | |||||
| }).then(res => { | |||||
| console.log(res); | |||||
| that.setData({ | |||||
| couponorderstatus: res.data.CouponOrderStatus | |||||
| }); | |||||
| /** | |||||
| * 动态改变上一级页面的核销状态 | |||||
| */ | |||||
| var pages = getCurrentPages(); | |||||
| var currPage = pages[pages.length - 1]; //当前页面 | |||||
| var prevPage = pages[pages.length - 2]; //上一个页面 | |||||
| //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | |||||
| prevPage.setData({ | |||||
| mystatus:res.data.CouponOrderStatus | |||||
| }); | |||||
| }); | |||||
| } | |||||
| }, 2000); | |||||
| /** | |||||
| * couponorderstatus | |||||
| * 0 没有核销 | |||||
| * 1 已经核销成功 | |||||
| */ | |||||
| }, | |||||
| onUnload: function() { | |||||
| let that = this; | |||||
| clearInterval(that.data.setInter); | |||||
| } | } | ||||
| }) | |||||
| }); | |||||