浏览代码

edit

tags/2.2.4
shark 6 年前
父节点
当前提交
3f675a4d77
共有 15 个文件被更改,包括 279 次插入280 次删除
  1. +5
    -115
      app.js
  2. 二进制
      assets/img/pass0.png
  3. 二进制
      assets/img/pass1.png
  4. +1
    -0
      components/coupons/index.wxml
  5. +18
    -4
      components/coupons/index.wxss
  6. +6
    -2
      config/config.js
  7. +1
    -1
      pages/coupon/detail/index.wxml
  8. +26
    -18
      pages/couponorder/detail/index.js
  9. +2
    -2
      pages/index/coupons/index.js
  10. +125
    -34
      pages/index/index.js
  11. +39
    -28
      pages/order/detail/index.js
  12. +2
    -1
      pages/order/index/index.wxml
  13. +50
    -71
      pages/orderquanma/index.js
  14. +2
    -2
      pages/rushToBuy/index.wxss
  15. +2
    -2
      project.config.json

+ 5
- 115
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,
// 支持智慧停车, 用户名下有车


二进制
assets/img/pass0.png 查看文件

之前 之后
宽度: 200  |  高度: 200  |  大小: 12 KiB 宽度: 200  |  高度: 176  |  大小: 15 KiB

二进制
assets/img/pass1.png 查看文件

之前 之后
宽度: 200  |  高度: 200  |  大小: 14 KiB 宽度: 200  |  高度: 176  |  大小: 20 KiB

+ 1
- 0
components/coupons/index.wxml 查看文件

@@ -15,6 +15,7 @@
<view class="coupons-info-manjian" wx:elif="{{data.type == 2||data.type == 3||data.type==4||data.type==5}}">
仅限本店使用
</view>
<view class="coupons-info-manjian1">{{data.merchantName}}</view>
</view>
</view>
<view class="coupons-btn">


+ 18
- 4
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 {


+ 6
- 2
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,


+ 1
- 1
pages/coupon/detail/index.wxml 查看文件

@@ -45,6 +45,6 @@
<view class="buy-view app-border-top">
<button bindtap='orderFunc' class='buy' wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0}}">立即支付</button>
<button bindtap='orderFunc' class='buy' wx:elif="{{data.salePriceStr==0&&data.remainInventory!=0}}">免费领取</button>
<button class='buy' wx:elif="{{data.remainInventory==0}}" style="background:#999;color: #fff;">免费领取</button>
<button class='buy' wx:elif="{{data.remainInventory==0}}" style="background:#999;color: #fff;">已售罄</button>
</view>
</view>

+ 26
- 18
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
});
}
}


+ 2
- 2
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
};


+ 125
- 34
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;


+ 39
- 28
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() {},

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


+ 2
- 1
pages/order/index/index.wxml 查看文件

@@ -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 查看文件

@@ -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);
}
})
});

+ 2
- 2
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;


+ 2
- 2
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": {


正在加载...
取消
保存