diff --git a/app.js b/app.js
index 5062bfd..ab79f94 100644
--- a/app.js
+++ b/app.js
@@ -5,140 +5,30 @@ App({
onLaunch: function(options) {
var that = this;
that.globalData.sceneAddress = options.scene;
- that.getLocation();
- that.userLogin();
},
/**
* 获取地址位置信息
*/
getLocation: function() {
+ var that = this
wx.getLocation({
type: "wgs84",
success: function(res) {
+ that.globalData.locationInfo = res
console.log("getLocation", res);
},
fail: error => {
console.log(error);
}
});
- },
- /**
- * 用户登录
- */
- userLogin: function() {
- var that = this;
- // 登录
- wx.login({
- success: ({ code }) => {
- Http.post({
- url: config.api.login,
- data: {
- appId: config.weapp.AppId,
- code: code,
- sceneAddress: that.globalData.sceneAddress
- }
- })
- .then(res => {
- console.log("userlogin", res);
- that.globalData.token = res.data.token;
- Http.setToken(res.data.token);
- that.checkUserCarStatus();
- that.getUserInfo();
- if (that.couponChannelListCallback) {
- that.couponChannelListCallback(that.globalData.token);
- }
- if (that.couponListCallback) {
- that.couponListCallback(that.globalData.token);
- }
- if (that.businessListCallback) {
- that.businessListCallback(that.globalData.token);
- }
- return Http.post({
- url: config.api.checkUserStatus,
- data: {}
- });
- })
- .then(res => {
- console.log("checkUserStatus", res);
- })
- .catch(err => {
- console.log("checkUserStatus:err", err);
- if (err.code == 11004) {
- // 用户昵称未授权
- wx.redirectTo({
- url: "../getuserinfo/index"
- });
- }
- });
- }
- });
- },
- /**
- * 获取用户信息
- */
- getUserInfo: function() {
- // 获取用户信息
- wx.getSetting({
- success: res => {
- console.log("getSetting", res);
- if (res.authSetting["scope.userInfo"]) {
- // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
- wx.getUserInfo({
- success: res => {
- // 可以将 res 发送给后台解码出 unionId
- console.log("getUserInfo", res);
- }
- });
- }
- }
- });
- },
-
- /**
- * 检查用户是否有车
- */
- checkUserCarStatus: function() {
- var that = this;
- Http.get({
- url: config.api.userCarCount,
- data: {}
- }).then(res => {
- if (res.data > 0) {
- // 用户名下有车
- that.globalData.phone = res.data.phone;
- that.globalData.supportCar = true;
- // 共同登录
- that.userCarLogin();
- }
- });
- },
- /**
- * car共同登录
- */
- userCarLogin: function() {
- var that = this;
- if (!that.globalData.carLogin) {
- // 共同登录
- Http.post({
- url: config.api.carInit,
- data: {
- phone: that.globalData.phone
- }
- }).then(res => {
- that.globalData.carLogin = true;
- that.globalData.parkVendor = res.data.vendor;
- if (res.data.token != "undefined") {
- that.globalData.etcpToken = res.data.token;
- console.log("etcpToken", that.globalData.etcpToken);
- }
- });
- }
- },
+ },
globalData: {
// token
token: null,
// 渠道
sceneAddress: null,
+ // location info
+ locationInfo: null,
// 二维码参数
scene: null,
// 支持智慧停车, 用户名下有车
diff --git a/assets/img/pass0.png b/assets/img/pass0.png
index 109c748..4b16412 100644
Binary files a/assets/img/pass0.png and b/assets/img/pass0.png differ
diff --git a/assets/img/pass1.png b/assets/img/pass1.png
index fc131a2..f91a4f0 100644
Binary files a/assets/img/pass1.png and b/assets/img/pass1.png differ
diff --git a/components/coupons/index.wxml b/components/coupons/index.wxml
index bf2d09f..5cdca5d 100644
--- a/components/coupons/index.wxml
+++ b/components/coupons/index.wxml
@@ -15,6 +15,7 @@
仅限本店使用
+ {{data.merchantName}}
diff --git a/components/coupons/index.wxss b/components/coupons/index.wxss
index 271e333..e251da6 100644
--- a/components/coupons/index.wxss
+++ b/components/coupons/index.wxss
@@ -44,7 +44,7 @@
}
.coupons-info-price {
- padding: 32rpx 0 0;
+ padding: 16rpx 0 0;
}
.i {
@@ -56,7 +56,7 @@
display: inline-block;
font-size: 36rpx;
color: #f96563;
- line-height: 50rpx;
+ line-height: 27rpx;
font-weight: 600;
}
@@ -115,10 +115,11 @@
width: 138rpx !important;
line-height: 50rpx !important;
}
+
.coupons-btn-gms {
- background: #999!important;
+ background: #999 !important;
border-radius: 10rpx !important;
- opacity: .6;
+ opacity: 0.6;
margin: 0 !important;
padding: 0 !important;
font-family: PingFangSC-Semibold;
@@ -129,6 +130,7 @@
width: 138rpx !important;
line-height: 50rpx !important;
}
+
.subtitle {
font-size: 24rpx;
color: #6f6f6f;
@@ -149,6 +151,18 @@
display: inline-block;
}
+.coupons-info-manjian1 {
+ color: #ccc !important;
+ font-weight: normal;
+ font-size: 20rpx;
+ line-height: 20rpx;
+ display: inline-block;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ width: 300rpx;
+}
+
/**上拉加载更多**/
.userinfo {
diff --git a/config/config.js b/config/config.js
index 5e5a995..98a0aac 100755
--- a/config/config.js
+++ b/config/config.js
@@ -123,11 +123,15 @@ var config = {
* 和login页面
* 页面的图标
*/
- marketicon:'/mall/getAppIcon'
+ marketicon:'/mall/getAppIcon',
+ /**
+ * 检查核销的状态
+ */
+ getStatus:"/couponOrder/getStatus"
},
weapp: {
- AppId: "wx8eb8275b78db4ede"
+ AppId: "wxb11603577a84a86d"
},
ErrorCode: {
NICK_NOT_AUTH: 11004,
diff --git a/pages/coupon/detail/index.wxml b/pages/coupon/detail/index.wxml
index f9888a0..0f34c02 100644
--- a/pages/coupon/detail/index.wxml
+++ b/pages/coupon/detail/index.wxml
@@ -45,6 +45,6 @@
-
+
\ No newline at end of file
diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js
index 45fa3ed..153f578 100644
--- a/pages/couponorder/detail/index.js
+++ b/pages/couponorder/detail/index.js
@@ -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
});
}
}
diff --git a/pages/index/coupons/index.js b/pages/index/coupons/index.js
index 4b53e61..1f281a8 100644
--- a/pages/index/coupons/index.js
+++ b/pages/index/coupons/index.js
@@ -76,13 +76,13 @@ Component({
if (key == 0) {
var param = {
pageNum: pageNum,
- pageSize: 16,
+ pageSize: 6,
targetAd: 1
};
} else {
var param = {
pageNum: pageNum,
- pageSize: 16,
+ pageSize: 6,
business: key,
targetAd: 1
};
diff --git a/pages/index/index.js b/pages/index/index.js
index 0322c2e..db85539 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -20,54 +20,145 @@ Page({
onLoad: function(options) {
var that = this;
var scene = decodeURIComponent(options.scene);
+ app.getLocation();
},
- onShow:function(){
- let that = this;
- if (app.globalData.token && app.globalData.token != null) {
- } else {
- wx.login({
- success: ({ code }) => {
- console.log(code);
- Http.post({
+ onShow: function() {
+ this.userLogin()
+ },
+
+ onGetCode: function(e) {
+ //子组件传递给父组件的值
+ this.setData({
+ code: e.detail.val,
+ page: e.detail.pageNum
+ });
+ },
+
+ /**
+ * 用户登录
+ */
+ userLogin: function() {
+ var that = this;
+ // 登录
+ wx.login({
+ success: ({
+ code
+ }) => {
+ var usrdata = {
+ appId: config.weapp.AppId,
+ code: code,
+ sceneAddress: app.globalData.sceneAddress,
+ }
+ if (app.globalData.locationInfo) {
+ usrdata = {
+ appId: config.weapp.AppId,
+ code: code,
+ sceneAddress: app.globalData.sceneAddress,
+ latitude: '' + app.globalData.locationInfo.latitude,
+ longitude: '' + app.globalData.locationInfo.longitude,
+ }
+ }
+ Http.post({
url: config.api.login,
- data: {
- appId: config.weapp.AppId,
- code: code,
- sceneAddress: app.globalData.sceneAddress
- }
- }).then(res => {
- //banner渲染
+ data: usrdata
+ })
+ .then(res => {
+ console.log("userlogin:app", res);
app.globalData.token = res.data.token;
Http.setToken(res.data.token);
- if (res.code == 200) {
- Http.get({
- url: config.api.bannerlist,
- data: {
- pageNum: 1,
- pageSize: 5
- }
- }).then(res => {
- that.setData({
- list: res.data.list
- });
+ that.checkUserCarStatus();
+ that.getUserInfo();
+ if (app.couponChannelListCallback) {
+ app.couponChannelListCallback(app.globalData.token);
+ }
+ if (app.couponListCallback) {
+ app.couponListCallback(app.globalData.token);
+ }
+ if (app.businessListCallback) {
+ app.businessListCallback(app.globalData.token);
+ }
+ return Http.post({
+ url: config.api.checkUserStatus,
+ data: {}
+ });
+ })
+ .then(res => {
+ console.log("checkUserStatus:res", res);
+ })
+ .catch(err => {
+ console.log("checkUserStatus:err", err);
+ if (err.code == 11004) {
+ // 用户昵称未授权
+ wx.redirectTo({
+ url: "/pages/getuserinfo/index"
});
}
});
+ }
+ });
+ },
+
+ /**
+ * 检查用户是否有车
+ */
+ checkUserCarStatus: function() {
+ var that = this;
+ Http.get({
+ url: config.api.userCarCount,
+ data: {}
+ }).then(res => {
+ if (res.data > 0) {
+ // 用户名下有车
+ app.globalData.phone = res.data.phone;
+ app.globalData.supportCar = true;
+ // 共同登录
+ that.userCarLogin();
+ }
+ });
+ },
+ /**
+ * car共同登录
+ */
+ userCarLogin: function() {
+ var that = this;
+ if (!app.globalData.carLogin) {
+ // 共同登录
+ Http.post({
+ url: config.api.carInit,
+ data: {
+ phone: app.globalData.phone
+ }
+ }).then(res => {
+ app.globalData.carLogin = true;
+ app.globalData.parkVendor = res.data.vendor;
+ if (res.data.token != "undefined") {
+ app.globalData.etcpToken = res.data.token;
+ console.log("etcpToken", app.globalData.etcpToken);
}
});
}
},
-
- onGetCode: function(e) {
- //子组件传递给父组件的值
- this.setData({
- code: e.detail.val,
- page: e.detail.pageNum
+ /**
+ * 获取用户信息
+ */
+ getUserInfo: function() {
+ // 获取用户信息
+ wx.getSetting({
+ success: res => {
+ console.log("getSetting", res);
+ if (res.authSetting["scope.userInfo"]) {
+ // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
+ wx.getUserInfo({
+ success: res => {
+ // 可以将 res 发送给后台解码出 unionId
+ console.log("getUserInfo", res);
+ }
+ });
+ }
+ }
});
},
-
-
//下拉加载更多
onReachBottom: function() {
let that = this;
diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js
index d172b34..5316b27 100644
--- a/pages/order/detail/index.js
+++ b/pages/order/detail/index.js
@@ -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() {},
-
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
diff --git a/pages/order/index/index.wxml b/pages/order/index/index.wxml
index a7495f2..313090e 100644
--- a/pages/order/index/index.wxml
+++ b/pages/order/index/index.wxml
@@ -12,7 +12,8 @@
{{item.title}}
待付款
- 已付款
+ 免费领取
+ 已付款
已过期
{{item.subTitle}}
diff --git a/pages/orderquanma/index.js b/pages/orderquanma/index.js
index bd233f7..3bce14b 100644
--- a/pages/orderquanma/index.js
+++ b/pages/orderquanma/index.js
@@ -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);
}
-})
\ No newline at end of file
+});
diff --git a/pages/rushToBuy/index.wxss b/pages/rushToBuy/index.wxss
index b113b34..b6461c6 100644
--- a/pages/rushToBuy/index.wxss
+++ b/pages/rushToBuy/index.wxss
@@ -136,8 +136,8 @@
position: absolute;
top: 34rpx;
bottom: 0;
- right: 20rpx;
- width: 114rpx;
+ right: 0rpx;
+ width: 138rpx;
height: 50rpx;
line-height: 50rpx;
text-align: center;
diff --git a/project.config.json b/project.config.json
index a31ddee..e71147c 100644
--- a/project.config.json
+++ b/project.config.json
@@ -12,8 +12,8 @@
},
"compileType": "miniprogram",
"libVersion": "2.2.4",
- "appid": "wx8eb8275b78db4ede",
- "projectname": "%E5%AF%8C%E8%8C%82%E6%94%AF%E4%BB%98%E6%B5%8B%E8%AF%95",
+ "appid": "wxb11603577a84a86d",
+ "projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2%E6%B5%8B%E8%AF%95",
"isGameTourist": false,
"condition": {
"search": {