diff --git a/api/shop.js b/api/shop.js index 2a44968..1ecd7be 100644 --- a/api/shop.js +++ b/api/shop.js @@ -10,6 +10,7 @@ export default { const data = {}; return request.post('/api/merchant/order',{merchant_product_id,order_amount}) }, + orderList:()=>request.get('/api/merchant-pay'), calculatePrice:(merchant_product_id)=>request.post('/api/merchant/order/calculate-price',{merchant_product_id}), merchantPay:(merchant_id,amount)=>request.post('/api/merchant-pay',{merchant_id,amount}) } \ No newline at end of file diff --git a/api/user.js b/api/user.js index 8bcf321..1c011f1 100644 --- a/api/user.js +++ b/api/user.js @@ -23,7 +23,21 @@ export default { pre:(data)=>request.post('/api/order/pre-order',data), real:(data)=>request.post('/api/order',data), list:()=>request.get('/api/order/user/list'), - merchantList:()=>request.get('/api/merchant/order/user') + merchantList:()=>request.get('/api/merchant/order/user'), + merchantDetail:(order_id)=>request.get(`/api/merchant/order/${order_id}`), + detail:(orderid)=>request.get(`/api/order/${orderid}`) + }, + coupon:{ + status:{ + unused:'UNUSED',used:'USED',expired:'EXPIRED' + }, + list:(status)=>request.get('/api/coupon/user/list',status?{status}:{}) + }, + point:{ + list:()=>request.get('/api/point/records') + }, + friend:{ + list:()=>request.get('/api/user/referrals') }, createPayment(order_id,order_type){ return request.post('/api/wechat/create-payment',{order_id,order_type}); diff --git a/app.js b/app.js index 334bf99..8e86360 100644 --- a/app.js +++ b/app.js @@ -2,25 +2,12 @@ import userApi from './api/user'; import commonApi from './api/common'; App({ onLaunch() { - // 展示本地存储能力 - const logs = wx.getStorageSync('logs') || [] - logs.unshift(Date.now()) - wx.setStorageSync('logs', logs) - - // 登录 - wx.login({ - success: res => { - // 发送 res.code 到后台换取 openId, sessionKey, unionId - } - }) wx.getStorage({ key:'accessToken', success:(res)=>{ this.globalData.accessToken = res.data; if(res.data){ - userApi.info().then((data)=>{ - this.globalData.userInfo = data; - }); + this.getUserInfo(); } } }) @@ -30,6 +17,17 @@ App({ url: '/pages/login/login', }) }, + async getUserInfo(){ + if(this.globalData.userInfoGetTime&& + this.globalData.userInfo&& + new Date()-this.globalData.userInfoGetTime<1000*60*5){ + return this.globalData.userInfo; + } + const data = await userApi.info(); + this.globalData.userInfo = data; + this.globalData.userInfoGetTime = new Date(); + return data; + }, globalData: { userInfo: null, accessToken:null, diff --git a/app.wxss b/app.wxss index 6960084..6a726f1 100644 --- a/app.wxss +++ b/app.wxss @@ -163,6 +163,9 @@ page-container .content{ .money-promation{ color:#FF8400; } +.money-yellow{ + color:var(--main-color); +} .money-blue{ color:#1A4DEB; } @@ -270,11 +273,11 @@ page-container .content{ width:100%; position: absolute; bottom:0; - background-color: #1A4DEB; + background-color:var(--main-color); transition-duration: .4s; } .tab-bar .current .item{ - color: #000; + color: var(--main-color); } .tab-bar .current .item::before{ opacity: 1; @@ -289,6 +292,9 @@ navigator button{ text-align: center; padding:60rpx 0 30rpx 0; } +.list-empty .icon{ + width:132rpx;height:132rpx; +} .list-empty .title{ font-size: 30rpx; font-weight: 500; diff --git a/assets/icon/shop/coupon-empty@2x.png b/assets/icon/shop/coupon-empty@2x.png new file mode 100644 index 0000000..2e237c5 Binary files /dev/null and b/assets/icon/shop/coupon-empty@2x.png differ diff --git a/assets/icon/shop/point-empty@2x.png b/assets/icon/shop/point-empty@2x.png new file mode 100644 index 0000000..a4369df Binary files /dev/null and b/assets/icon/shop/point-empty@2x.png differ diff --git a/assets/icon/shop/promation@2x.png b/assets/icon/shop/promation@2x.png new file mode 100644 index 0000000..f816073 Binary files /dev/null and b/assets/icon/shop/promation@2x.png differ diff --git a/pages/my/coupon/index.js b/pages/my/coupon/index.js index 926414c..be1de4d 100644 --- a/pages/my/coupon/index.js +++ b/pages/my/coupon/index.js @@ -1,23 +1,34 @@ -// pages/my/coupon/index.js +import userApi from '../../../api/user'; + Page({ /** * 页面的初始数据 */ data: { - tabIndex:0 - + tabIndex:0, + list:[] }, changeTab(event){ const tabIndex = event.currentTarget.dataset.index; this.setData({tabIndex}) + this.loadList(); }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { + this.loadList(); + }, + loadList(){ + const status = [userApi.coupon.status.unused,userApi.coupon.status.used,userApi.coupon.status.expired]; + userApi.coupon.list(status[this.data.tabIndex]).then((data)=>{ + this.setData({ + list:data + }); + }) }, /** diff --git a/pages/my/coupon/index.wxml b/pages/my/coupon/index.wxml index 1f0395d..7a22483 100644 --- a/pages/my/coupon/index.wxml +++ b/pages/my/coupon/index.wxml @@ -10,12 +10,17 @@ - - + + - 平台奖励跑腿券 - 有效期至2025.03.06 + {{item.coupon_name}} + 有效期至 {{item.expire_time}} - 3.0 + {{item.coupon_amount}} + + + + + 暂无跑腿券 \ No newline at end of file diff --git a/pages/my/coupon/index.wxss b/pages/my/coupon/index.wxss index 62229da..3fc7bfe 100644 --- a/pages/my/coupon/index.wxss +++ b/pages/my/coupon/index.wxss @@ -38,4 +38,24 @@ .coupon-list .item::before{ right:-12rpx; left:auto; +} + +.coupon-list .item.used .name{ + color: #888888; +} +.coupon-list .item.used .money{ + color: #888888; +} + +.list-empty{ + padding-top:400rpx; +} +.list-empty .icon{ + width:132rpx;height:132rpx; +} + +.list-empty .title{ + color: rgba(136, 136, 136, 0.6); + font-size: 30rpx; + margin-top:20rpx; } \ No newline at end of file diff --git a/pages/my/firend/index.js b/pages/my/firend/index.js index ee36b8b..b3e6c48 100644 --- a/pages/my/firend/index.js +++ b/pages/my/firend/index.js @@ -1,18 +1,23 @@ -// pages/my/firend/index.js +import userApi from '../../../api/user'; + Page({ /** * 页面的初始数据 */ data: { - + list:[] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + userApi.friend.list().then((data)=>{ + this.setData({ + list:data + }) + }) }, /** diff --git a/pages/my/firend/index.wxml b/pages/my/firend/index.wxml index 6a9c5fe..7d0552e 100644 --- a/pages/my/firend/index.wxml +++ b/pages/my/firend/index.wxml @@ -1,5 +1,5 @@ - - + + 跑腿订单返现 134****6777 @@ -9,4 +9,7 @@ 2023.04.06 17:00 + + + 暂无邻友 \ No newline at end of file diff --git a/pages/my/firend/index.wxss b/pages/my/firend/index.wxss index f554de7..59a56ae 100644 --- a/pages/my/firend/index.wxss +++ b/pages/my/firend/index.wxss @@ -25,5 +25,5 @@ font-size: 34rpx; } .firend-list .item .status{ - color:#1A4DEB; + color:var(--main-color) } \ No newline at end of file diff --git a/pages/my/index/index.js b/pages/my/index/index.js index ebbb5ac..a297244 100644 --- a/pages/my/index/index.js +++ b/pages/my/index/index.js @@ -1,11 +1,12 @@ -// pages/my/index/index.js +const app = getApp(); + Page({ /** * 页面的初始数据 */ data: { - + userInfo:{} }, goToCouponList(){ @@ -23,7 +24,11 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - + app.getUserInfo().then((data)=>{ + this.setData({ + userInfo:data + }); + }) }, /** diff --git a/pages/my/index/index.wxml b/pages/my/index/index.wxml index b1a6c2b..558984c 100644 --- a/pages/my/index/index.wxml +++ b/pages/my/index/index.wxml @@ -1,7 +1,7 @@