Explorar el Código

[核销状态][修改]:核销完成以后的状态的通知

tags/2.2.4
meo hace 6 años
padre
commit
b1411a3dca
Se han modificado 5 ficheros con 122 adiciones y 119 borrados
  1. +5
    -1
      config/config.js
  2. +26
    -18
      pages/couponorder/detail/index.js
  3. +39
    -28
      pages/order/detail/index.js
  4. +2
    -1
      pages/order/index/index.wxml
  5. +50
    -71
      pages/orderquanma/index.js

+ 5
- 1
config/config.js Ver fichero

@@ -123,7 +123,11 @@ var config = {
* 和login页面
* 页面的图标
*/
marketicon:'/mall/getAppIcon'
marketicon:'/mall/getAppIcon',
/**
* 检查核销的状态
*/
getStatus:"/couponOrder/getStatus"
},

weapp: {


+ 26
- 18
pages/couponorder/detail/index.js Ver fichero

@@ -9,7 +9,13 @@ Page({
data: {},
createDate: "",
expiredTime: "",
updateDate:''
updateDate: "",
//存储计时器
setInter: ""
},
onUnload: function() {
let that = this;
clearInterval(that.data.setInter);
},
onLoad: function(options) {
console.log(options);
@@ -23,32 +29,34 @@ Page({
options.quancode != null &&
(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.qrcode("qrcode", options.quancode,350, 350);
util.qrcode("qrcode", options.quancode, 350, 350);
},
phone: function() {
let that = this;
console.log(that.data);
if (that.data.data.merchantLinkPhone) {
wx.makePhoneCall({
phoneNumber: that.data.data.merchantLinkPhone
phoneNumber: that.data.data.merchantLinkPhone
});
}
}


+ 39
- 28
pages/order/detail/index.js Ver fichero

@@ -10,7 +10,10 @@ Page({
showModalStatus: false,
flag: 0,
order: null,
orderId: null
orderId: null,
//存储计时器
setInter: "",
mystatus:''
},

/**
@@ -19,36 +22,51 @@ Page({
*/

powerDrawer: function(e) {
let that = this;
// couponOrderStatus
// 0 未使用
// 1 已使用
// 2 已过期
// 3 已经退款
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) {
let that = this;
console.log(options.orderId);
console.log(options.flag + "我是付款的标识");

this.setData({
orderId: options.orderId
});
wx.showLoading({
title: "加载中"
});
setTimeout(function() {
wx.hideLoading();
}, 500);
// that.data.setInter = setInterval(function() {

Http.get({
url: config.api.orderDetail,
@@ -64,12 +82,13 @@ Page({

//createDate 创建时间
var createDate = util.fmtDate(res.data.createDate);

console.log(createDate);
that.setData({
createDate: createDate
});
});

// }, 100);
},

/**
@@ -193,23 +212,15 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},

/**
* 生命周期函数--监听页面显示
*/
onShow: function(options) {},
onShow: function() {
console.log(this.data.mystatus)
},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/


+ 2
- 1
pages/order/index/index.wxml Ver fichero

@@ -12,7 +12,8 @@
<view>
<text>{{item.title}}</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>
</view>
<view>{{item.subTitle}}</view>


+ 50
- 71
pages/orderquanma/index.js Ver fichero

@@ -1,78 +1,57 @@
let util = require("../../utils/util");
let Http = require("../../utils/HttpBasics");
let config = require("../../config/config.js");
Page({

/**
* 页面的初始数据
*/
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.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);
}
})
});

Cargando…
Cancelar
Guardar