From 83e3bc95b7879bef973fb6f6c023c36f24c5ad26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=87?= Date: Fri, 28 Mar 2025 19:59:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/order.js | 8 +- api/user.js | 7 ++ app.js | 17 +++ app.json | 8 +- app.wxss | 7 +- package-lock.json | 7 ++ package.json | 1 + pages/browser/index.js | 75 ++++++++++++ pages/browser/index.json | 3 + pages/browser/index.wxml | 1 + pages/browser/index.wxss | 1 + pages/index/index/index.js | 34 +++++- pages/index/index/index.wxml | 6 +- pages/index/verification/index.js | 127 +++++++++++++++++++++ pages/index/verification/index.json | 5 + pages/index/verification/index.wxml | 91 +++++++++++++++ pages/index/verification/index.wxss | 171 ++++++++++++++++++++++++++++ pages/order/list/index.js | 22 +++- pages/order/list/index.wxml | 33 +++--- pages/order/list/index.wxss | 10 +- pages/product/list/index.js | 47 +++++++- pages/product/list/index.wxml | 43 ++----- pages/product/list/index.wxss | 11 +- pages/user/income/detail/index.js | 77 +++++++++++++ pages/user/income/detail/index.json | 4 + pages/user/income/detail/index.wxml | 22 ++++ pages/user/income/detail/index.wxss | 45 ++++++++ pages/user/income/list/index.js | 113 ++++++++++++++++++ pages/user/income/list/index.json | 6 + pages/user/income/list/index.wxml | 17 +++ pages/user/income/list/index.wxss | 25 ++++ pages/user/index/index.js | 35 +++++- pages/user/index/index.wxml | 18 +-- pages/user/index/index.wxss | 6 +- pages/user/password/index.js | 3 +- project.config.json | 9 +- 36 files changed, 1028 insertions(+), 87 deletions(-) create mode 100644 pages/browser/index.js create mode 100644 pages/browser/index.json create mode 100644 pages/browser/index.wxml create mode 100644 pages/browser/index.wxss create mode 100644 pages/index/verification/index.js create mode 100644 pages/index/verification/index.json create mode 100644 pages/index/verification/index.wxml create mode 100644 pages/index/verification/index.wxss create mode 100644 pages/user/income/detail/index.js create mode 100644 pages/user/income/detail/index.json create mode 100644 pages/user/income/detail/index.wxml create mode 100644 pages/user/income/detail/index.wxss create mode 100644 pages/user/income/list/index.js create mode 100644 pages/user/income/list/index.json create mode 100644 pages/user/income/list/index.wxml create mode 100644 pages/user/income/list/index.wxss diff --git a/api/order.js b/api/order.js index 2b74638..cec6548 100644 --- a/api/order.js +++ b/api/order.js @@ -17,7 +17,8 @@ export default { product:{ typeKV:{ 'SELF_OPERATED':'自营','MERCHANT':'商家' - } + }, + list:(params)=>request.get(`/api/merchant/product/list`,params) }, list:(params)=>request.get('/api/merchant/order/merchant',params), @@ -25,6 +26,9 @@ export default { accept:(order_id)=>request.put(`/api/merchant/order/${order_id}/accept`), complete:(order_id)=>request.put(`/api/merchant/order/${order_id}/complete`), - summary:()=>request.get('/api/merchant/order/merchant/summary') + queryVerifyCode:(verify_code)=>request.get(`/api/merchant/order/merchant/scan_query_order/${verify_code}`), + verify:(verify_code)=>request.post('/api/merchant/order/merchant/verify_order',{verify_code}), + + cancel:(order_id)=>request.put(`/api/merchant/order/${order_id}/user/cancel`) } \ No newline at end of file diff --git a/api/user.js b/api/user.js index 9e076ba..54db8cb 100644 --- a/api/user.js +++ b/api/user.js @@ -5,5 +5,12 @@ export default { MALE:'先生',FEMALE:'女士' }, login:(phone,password)=>request.post('/api/user/password-login',{phone,password,role:'deliveryman'}), + + info:()=>request.get('/api/user/info'), + verifyCode:(phone)=>request.post('/api/user/send-code',{phone}), + summary:()=>request.get('/api/merchant/order/merchant/summary'), + incomeList:(data)=>request.get('/api/account/details',data), + + modifyPassword:(phone,new_password,verify_code)=>request.post('/api/user/change-password',{phone,new_password,verify_code}), } \ No newline at end of file diff --git a/app.js b/app.js index 2d88890..d3703d1 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,9 @@ import commonApi from './api/common'; +import userApi from './api/user'; const token = wx.getStorageSync('accessToken'); App({ + verifyCodeWaitingTime:60, onLaunch() { // 展示本地存储能力 const logs = wx.getStorageSync('logs') || [] @@ -25,6 +27,21 @@ App({ } return this.globalData.appConfig; }, + forceGetUserInfo(){ + this.globalData.userInfoGetTime = null; + return this.getUserInfo(); + }, + 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:token diff --git a/app.json b/app.json index 7fd1b1f..36a80f2 100644 --- a/app.json +++ b/app.json @@ -1,11 +1,15 @@ { "pages": [ - "pages/order/list/index", "pages/index/index/index", + "pages/order/list/index", "pages/user/index/index", "pages/user/login/index", "pages/user/password/index", - "pages/product/list/index" + "pages/product/list/index", + "pages/user/income/list/index", + "pages/index/verification/index", + "pages/user/income/detail/index", + "pages/browser/index" ], "window": { "navigationBarTextStyle": "black", diff --git a/app.wxss b/app.wxss index 61e55f6..1d8df14 100644 --- a/app.wxss +++ b/app.wxss @@ -42,12 +42,17 @@ button[type=primary]{ background-color:var(--main-color); color:var(--main-font-color); } +/* button[type=primary]:active{ + background-color:var(--main-color); + color:var(--main-font-color); +} */ button[disabled]{ opacity: .7; } button[type=primary]:not([disabled]).button-hover{ - background-color: var(--main-hover-color); + background-color:var(--main-color); color:var(--main-font-color); + opacity: .8; } button[plain]{ diff --git a/package-lock.json b/package-lock.json index e1e1388..95c95d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@beefast-wxmp/list-view": "^0.0.1", + "@beefast-wxmp/modal-view": "^0.1.7", "@beefast-wxmp/nav-bar": "^0.0.1", "@beefast-wxmp/swipe-button": "^0.0.3" } @@ -20,6 +21,12 @@ "integrity": "sha512-XoTaXRqy8EuuHECGS2zFzAeDKoGDtC56VdahnVYTAcDLNo3fceQuXI2KhOSvjnn4Jbkt1UDch7IEuF9Eekf9eg==", "license": "ISC" }, + "node_modules/@beefast-wxmp/modal-view": { + "version": "0.1.7", + "resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/modal-view/-/@beefast-wxmp/modal-view-0.1.7.tgz", + "integrity": "sha512-lw7gdhxSfCdNW7sD9FuFgaFUih8+yf8TSJ2gX7ZUnnMEK6RIL6QxAEEj6LUJ+SHE6QuBegPb4ucrfAFVAd8s8A==", + "license": "ISC" + }, "node_modules/@beefast-wxmp/nav-bar": { "version": "0.0.1", "resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/nav-bar/-/@beefast-wxmp/nav-bar-0.0.1.tgz", diff --git a/package.json b/package.json index e07aff4..d5a2cc4 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@beefast-wxmp/list-view": "^0.0.1", + "@beefast-wxmp/modal-view": "^0.1.7", "@beefast-wxmp/nav-bar": "^0.0.1", "@beefast-wxmp/swipe-button": "^0.0.3" } diff --git a/pages/browser/index.js b/pages/browser/index.js new file mode 100644 index 0000000..dd5b56d --- /dev/null +++ b/pages/browser/index.js @@ -0,0 +1,75 @@ +// pages/browser/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + webUrl:'' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let url = decodeURIComponent(options.url); + if(url.indexOf('?')>-1){ + url = `${url}&random=${Math.random()}` + }else{ + url = `${url}?random=${Math.random()}` + } + console.log(url); + this.setData({ + webUrl:decodeURIComponent(options.url) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/browser/index.json b/pages/browser/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/browser/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/browser/index.wxml b/pages/browser/index.wxml new file mode 100644 index 0000000..87168c3 --- /dev/null +++ b/pages/browser/index.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pages/browser/index.wxss b/pages/browser/index.wxss new file mode 100644 index 0000000..e10bd99 --- /dev/null +++ b/pages/browser/index.wxss @@ -0,0 +1 @@ +/* pages/browser/index.wxss */ \ No newline at end of file diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 2f7aabb..44da0f3 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -1,4 +1,7 @@ -// pages/index/index/index.js +import userApi from '../../../api/user'; +import orderApi from '../../../api/order'; + + Page({ /** @@ -12,7 +15,36 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { + userApi.summary() + }, + scanQRCode(){ + wx.scanCode({ + onlyFromCamera:true, + scanType:'qrCode', + success:(res)=>{ + if(res.scanType=='QR_CODE'){ + orderApi.queryVerifyCode(res.result).then((data)=>{ + if(data.order){ + wx.navigateTo({ + url: `/pages/index/verification/index?code=${res.result}`, + success(){ + //传 code 供测试用,因为热更新下面的数据就没有了 + const pages = getCurrentPages(); + const currentPage = pages[pages.length-1]; + currentPage.setOrder(data); + } + }) + } + }) + }else{ + wx.showToast({ + icon:'none', + title: '核销码错误' + }) + } + } + }) }, /** diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index fc8c7fc..4ffeb47 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -3,17 +3,17 @@ 商品管理 - + 扫一扫 - + 累计收益 (元) 88 - + 订单笔数 12 diff --git a/pages/index/verification/index.js b/pages/index/verification/index.js new file mode 100644 index 0000000..1404d5b --- /dev/null +++ b/pages/index/verification/index.js @@ -0,0 +1,127 @@ +import orderApi from '../../../api/order'; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + verifyCode:'', + orderDetail:{}, + refresherTriggered:true, + + orderStatus:orderApi.status, + orderStatusKV:orderApi.statusKV, + + isShowVerify:false, + isShowRefund:false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + verifyCode:options.code + }) + const { miniProgram } = wx.getAccountInfoSync(); + const envVersion = miniProgram.envVersion; + if(envVersion=='develop'){ + this.getOrderDetail(); + } + }, + getOrderDetail(){ + orderApi.queryVerifyCode(this.data.verifyCode).then((data)=>{ + this.setData({ + orderDetail:data, + refresherTriggered:false + }) + }) + }, + + setOrder(order){ + this.setData({ + orderDetail:order + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + }, + showVerifdy(){ + this.setData({ + isShowVerify:true + }) + }, + verify(){ + orderApi.verify(this.data.verifyCode).then((data)=>{ + wx.navigateBack({ + success(){ + wx.showToast({ + title: '核销成功' + }); + } + }) + }) + }, + + showRefund(){ + this.setData({ + isShowRefund:true + }) + }, + refund(){ + orderApi.cancel(this.data.orderDetail.order.order_id).then(()=>{ + wx.navigateBack({ + success(){ + wx.showToast({ + title: '退单成功' + }); + } + }) + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/index/verification/index.json b/pages/index/verification/index.json new file mode 100644 index 0000000..a0e194e --- /dev/null +++ b/pages/index/verification/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "modal-view":"/miniprogram_npm/@beefast-wxmp/modal-view" + } +} \ No newline at end of file diff --git a/pages/index/verification/index.wxml b/pages/index/verification/index.wxml new file mode 100644 index 0000000..f10cca4 --- /dev/null +++ b/pages/index/verification/index.wxml @@ -0,0 +1,91 @@ + + + {{orderStatusKV[orderDetail.order.status]}} + + + 自提点 + + + + + + + {{orderDetail.merchant.address}} + + + + 送货地址 + + + {{orderDetail.address.community_name}} + {{orderDetail.address.address_detail}} + + + {{orderDetail.address.name}} {{genderKV[orderDetail.address.gender]}} {{orderDetail.address.phone}} + + + + + 供货方 + + + + + {{orderDetail.merchant.name}} + {{orderDetail.merchant.address}} + + + + + + 商品信息 + + + + + + {{orderDetail.product.name}} + x {{orderDetail.order.qty}} + + {{orderDetail.product.product_price}} + + + + + + 订单信息 + + + 订单编号 + {{orderDetail.order.order_id}} + + 复制 + + + + 下单时间 + {{orderDetail.order.create_time}} + + + 订单金额 + {{orderDetail.order.order_amount}} + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/index/verification/index.wxss b/pages/index/verification/index.wxss new file mode 100644 index 0000000..1ca89e5 --- /dev/null +++ b/pages/index/verification/index.wxss @@ -0,0 +1,171 @@ + +.order-status{ + margin:50rpx 20rpx; + display: flex; + align-items: center; + font-size: 40rpx; + font-weight: 600; + color:var(--main-color); +} +.order-status.COMPLETED,.order-status.CANCELLED{ + color:var(--main-font-color); +} +.order-status::before{ + content: ""; + display: block; + width:10rpx;height:44rpx; + margin-right:24rpx; + border-radius: 6rpx; + background-color:var(--main-color); +} +.order-status.COMPLETED::before,.order-status.CANCELLED::before{ + background-color:var(--main-font-color); +} + +.page-container .title{ + font-weight: 600; + font-size:32rpx; + display: flex; + align-items: center; + justify-content: space-between; +} +.page-container .title .time{ + font-size: 30rpx; +} +.page-container .title .yellow{ + color:#FF8C12; +} +.page-container .spliter{ + margin:24rpx 0; +} +.address-self{ + padding:46rpx 40rpx; +} +.address-self .address{ + color:#555; + line-height: 1.4; +} + +.address .text1{ + font-size: 34rpx; + font-weight: 500; + padding-top:16rpx; +} +.address .text2{ + font-size:32rpx; + color:#888888; + margin-top:28rpx; +} +/* 商家 */ +.merchant .info{ + display: flex; + align-items: center; + padding-top:16rpx; +} +.merchant .avatar{ + width:84rpx;height:84rpx; + border-radius: 50%; +} +.merchant .center{ + margin-left:20rpx; + flex:1; + overflow: hidden; + white-space: nowrap; +} +.merchant .name{ + font-weight: 500; + text-overflow: ellipsis; + overflow: hidden; +} +.merchant .address{ + font-size: 26rpx; + color: #555; + text-overflow: ellipsis; + overflow: hidden; + margin-top:20rpx; +} +.merchant .icon-phone{ + width:36rpx;height:36rpx; + align-self: flex-start; + padding:4rpx; +} + +.product .info{ + display: flex; +} +.product .avatar{ + width:150rpx;height:150rpx; + border-radius: 12rpx; +} +.product .center{ + flex:1; + margin-left:20rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + height: 130rpx; + padding:10rpx 0; +} +.product .c-top{ + display:flex; + justify-content: space-between; +} +.product .c-top .qty{ + font-size: 36rpx; + color: #888; +} + + +.order-info .kv{ + display: flex; + align-items: center; + height:58rpx; +} +.order-info .kv .key{ + color: #888888; +} +.order-info .kv .value{ + font-size: 32rpx; + margin-left:30rpx; + flex:1; +} +.order-info .kv .copy-area{ + padding:10rpx; +} +.order-info .kv .copy{ + font-size: 24rpx; + border-radius: 8rpx; + border: 0.3px solid rgba(153, 153, 153, 0.5); + color: #222222; + line-height: 36rpx; + padding:0 14rpx; +} +.order-info .money{ + font-size: 36rpx; +} + + + +.bottom-bar-v2{ + text-align: right; + display: flex; + gap: 30rpx; +} +.bottom-bar-v2 .btn-verify{ + flex:1; +} +.bottom-bar-v2 .btn{ + /* line-height: 72rpx; */ + font-weight: normal; + border-radius: 18rpx; + padding:20rpx 40rpx; +} +.bottom-bar-v2 .button1{ + color: #555555; + border: 1rpx solid rgba(153, 153, 153, 0.5); + font-size: 32rpx; +} +.bottom-bar-v2 .button2{ + font-size: 32rpx; + margin-left:30rpx; +} \ No newline at end of file diff --git a/pages/order/list/index.js b/pages/order/list/index.js index 0f84450..6ed1c4c 100644 --- a/pages/order/list/index.js +++ b/pages/order/list/index.js @@ -150,13 +150,23 @@ Page({ this.setData({ [`list[${index}].receiving`]:true }) - orderApi.accept(item.order.order_id).then((data)=>{ - wx.showToast({ - icon:'success', - title: '接单成功', + if(item.product.delivery_time_type==this.data.deliveryTimeType.scheduled){ + orderApi.complete(item.order.order_id).then((data)=>{ + wx.showToast({ + icon:'success', + title: '自提成功', + }) + this.refreshList(); }) - this.refreshList(); - }) + }else{ + orderApi.accept(item.order.order_id).then((data)=>{ + wx.showToast({ + icon:'success', + title: '接单成功', + }) + this.refreshList(); + }) + } }, //我已送达 diff --git a/pages/order/list/index.wxml b/pages/order/list/index.wxml index 04256f0..d08eff9 100644 --- a/pages/order/list/index.wxml +++ b/pages/order/list/index.wxml @@ -1,28 +1,29 @@ - - - {{item}} + + + + {{item}} + + + + + {{item.value}}(0) + - - - - {{item.value}}(0) + + + - - - - - + class="item item{{index}} {{item.order.status==orderStatus.completed?'no-btns':''}}"> {{productTypeKV[item.product.operation_type]}} diff --git a/pages/order/list/index.wxss b/pages/order/list/index.wxss index 67a67b1..e213657 100644 --- a/pages/order/list/index.wxss +++ b/pages/order/list/index.wxss @@ -36,7 +36,8 @@ .top-bar{ display: flex; justify-content: space-around; - padding:40rpx 0; + padding:24rpx 0; + margin:16rpx; } .top-bar .item{ font-size: 28rpx; @@ -48,7 +49,7 @@ } .search{ - margin:0 16rpx; + margin:16rpx; background-color: #fff; padding:10rpx 10rpx 10rpx 40rpx; display: flex; @@ -78,9 +79,8 @@ padding:20rpx; position: relative; } -.package-list .item:first-child{ +.package-list .item0{ margin-top:0; - background-color: red; } .package-list .item .item-head{ display: flex; @@ -111,7 +111,7 @@ bottom:250rpx; } .package-list .item.no-btns::before{ - bottom:100rpx; + bottom:145rpx; } .package-list .item .name{ font-size: 40rpx; diff --git a/pages/product/list/index.js b/pages/product/list/index.js index bcb7dc5..1e3370d 100644 --- a/pages/product/list/index.js +++ b/pages/product/list/index.js @@ -1,17 +1,60 @@ -// pages/product/list/index.js +import orderApi from '../../../api/order'; +const app = getApp(); + Page({ /** * 页面的初始数据 */ data: { - + list:[], + pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}, + deliveryTimeType:orderApi.deliveryTimeType, + deliveryTimeTypeKV:orderApi.deliveryTimeTypeKV }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { + app.getUserInfo().then((data)=>{ + this.userInfo = data; + this.loadList(); + }) + }, + + loadList(){ + if(this.data.pager.loading||this.data.pager.loadAll){ + return; + } + this.setData({ + "pager.loading":true + }); + let params = { + skip:this.data.pager.pageIndex*this.data.pager.limit, + limit:this.data.pager.limit, + user_id:this.userInfo.userid + } + orderApi.product.list(params).then((data)=>{ + if(this.data.pager.pageIndex==0){ + this.data.list = data.items; + }else{ + this.data.list = this.data.list.concat(data.items); + } + this.data.pager.loading = false; + this.data.pager.pageIndex++; + this.data.pager.refreshTrigger = false; + if(data.items.length - + + - + - 家庭私厨烤串【鲜货】 - 及时达丨配送 - 9.9 + {{item.name}} + + {{item.delivery_time_type_name}}丨{{item.delivery_type_name}} + + {{item.product_price}} @@ -18,7 +23,7 @@ 累计收益(元) - 1/4 + {{item.sold_total}}/{{item.qty}} 已售出/库存量 @@ -26,28 +31,4 @@ - - - - - 家庭私厨烤串【鲜货】 - 及时达丨配送 - 9.9 - - - - - 0.0 - 累计销售额 (元) - - - 0.0 - 累计收益(元) - - - 1/4 - 已售出/库存量 - - - \ No newline at end of file diff --git a/pages/product/list/index.wxss b/pages/product/list/index.wxss index 0bad7ae..3f55dd0 100644 --- a/pages/product/list/index.wxss +++ b/pages/product/list/index.wxss @@ -1,3 +1,6 @@ +.product-list{ + height: 100vh; +} .product-list .item{ background-color: #fff; margin:20rpx; @@ -29,11 +32,13 @@ display: flex; flex-direction: column; justify-content: space-between; - height: 140rpx; + gap: 18rpx; + min-height: 140rpx; } .product-list .item .name{ font-weight: 500; font-size: 32rpx; + line-height: 40rpx; } .product-list .item .tags{ color:#555; @@ -70,4 +75,8 @@ padding:18rpx 52rpx; line-height: 1; margin:0; +} +.actions .button.button-hover{ + background-color: #000!important; + color:#fff!important; } \ No newline at end of file diff --git a/pages/user/income/detail/index.js b/pages/user/income/detail/index.js new file mode 100644 index 0000000..631a101 --- /dev/null +++ b/pages/user/income/detail/index.js @@ -0,0 +1,77 @@ +// pages/user/income/detail/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + detail:{} + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + setDetail(detail){ + this.setData({detail}) + }, + copyOrderId(){ + wx.setClipboardData({ + data:this.data.detail.transaction_id, + }) + }, + back(){ + wx.navigateBack(); + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/user/income/detail/index.json b/pages/user/income/detail/index.json new file mode 100644 index 0000000..3da54f4 --- /dev/null +++ b/pages/user/income/detail/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "收益详情" +} \ No newline at end of file diff --git a/pages/user/income/detail/index.wxml b/pages/user/income/detail/index.wxml new file mode 100644 index 0000000..e91520c --- /dev/null +++ b/pages/user/income/detail/index.wxml @@ -0,0 +1,22 @@ + + + {{detail.description}} + {{detail.amount}} + + + + + 交易单号 + {{detail.transaction_id}} + + 复制 + + + + 入账时间 + {{detail.create_time}} + + + + + \ No newline at end of file diff --git a/pages/user/income/detail/index.wxss b/pages/user/income/detail/index.wxss new file mode 100644 index 0000000..7f36fe7 --- /dev/null +++ b/pages/user/income/detail/index.wxss @@ -0,0 +1,45 @@ +.order-detail{ + background-color: #fff; + margin:20rpx 0; +} +.order-detail .head{ + text-align: center; + padding:70rpx 0; +} +.order-detail .name{ + font-size: 32rpx; +} +.order-detail .money{ + font-size: 70rpx; + margin-top:32rpx; + text-align: center; +} +.order-detail .tags{ + padding:20rpx; +} +.order-detail .tag{ + color: #222; +} +.order-detail .spliter{ + margin:0 30rpx; +} + +.order-detail .info{ + padding:4rpx 10rpx 36rpx 30rpx; +} +.order-detail .info .item{ + display: flex; + align-items: center; + margin-top:12rpx; +} +.order-detail .info .item .key{ + color: #888; +} +.order-detail .info .item .value{ + flex: 1; + margin-left:30rpx; +} + +.btn-back{ + margin:30rpx!important; +} \ No newline at end of file diff --git a/pages/user/income/list/index.js b/pages/user/income/list/index.js new file mode 100644 index 0000000..780dd81 --- /dev/null +++ b/pages/user/income/list/index.js @@ -0,0 +1,113 @@ +import userApi from '../../../../api/user'; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + list:[], + scrollViewHeight:0, + pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false} + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + const windowInfo = wx.getWindowInfo(); + this.setData({ + scrollViewHeight:windowInfo.windowHeight + }); + this.loadList(); + }, + refreshList(){ + this.data.pager.pageIndex = 0; + this.data.pager.loadAll = false; + this.setData({ + pager:this.data.pager + }); + this.loadList(); + }, + loadList(){ + if(this.data.pager.loading||this.data.pager.loadAll){ + return; + } + this.data.pager.loading = true; + this.setData({ + pager:this.data.pager + }); + userApi.incomeList({ + skip:this.data.pager.pageIndex*this.data.pager.limit, + limit:this.data.pager.limit + }).then((data)=>{ + this.data.pager.loading = false; + this.data.pager.loadAll = true; + this.data.pager.refreshTrigger = false; + this.setData({ + list:data.items, + pager:this.data.pager + }) + }) + }, + + navToDetail(event){ + const item = event.currentTarget.dataset.item; + wx.navigateTo({ + url: '/pages/user/income/detail/index', + success:()=>{ + const pages = getCurrentPages(); + const currentPage = pages[pages.length-1]; + currentPage.setDetail(item); + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/user/income/list/index.json b/pages/user/income/list/index.json new file mode 100644 index 0000000..0f1ba39 --- /dev/null +++ b/pages/user/income/list/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "list-view":"/miniprogram_npm/@beefast-wxmp/list-view" + }, + "navigationBarTitleText": "交易明细" +} \ No newline at end of file diff --git a/pages/user/income/list/index.wxml b/pages/user/income/list/index.wxml new file mode 100644 index 0000000..49cb5bb --- /dev/null +++ b/pages/user/income/list/index.wxml @@ -0,0 +1,17 @@ + + + + {{item.description}} + {{item.create_time}} + + {{item.amount}} + + + + 暂无记录 + + \ No newline at end of file diff --git a/pages/user/income/list/index.wxss b/pages/user/income/list/index.wxss new file mode 100644 index 0000000..a7ea3a1 --- /dev/null +++ b/pages/user/income/list/index.wxss @@ -0,0 +1,25 @@ +.income-list{ + margin: 0 20rpx; + height:100vh; +} +.income-list .item{ + background-color: #ffffff; + display: flex; + padding:40rpx 30rpx; + margin:20rpx 0; + border-radius: 18rpx; +} +.income-list .item:first-child{ + margin-top:0; +} +.income-list .item .content{ + flex:1; + +} +.income-list .item .title{ + font-size: 32rpx; +} +.income-list .item .sub-title{ + margin-top:32rpx; + color: #888888; +} diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 4555781..12be7b9 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -1,20 +1,47 @@ -// pages/user/index/index.js +const app = getApp(); + Page({ /** * 页面的初始数据 */ data: { - + userInfo:{}, + appConfig:{} }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + app.getUserInfo().then((data)=>{ + this.setData({ + userInfo:data + }) + }) + app.getAppConfig().then((data)=>{ + this.setData({ + appConfig:data + }) + }) + }, + navToAgreement(){ + wx.navigateTo({ + url: `/pages/browser/index?url=${encodeURIComponent(this.data.appConfig.url_user_agreement)}`, + }) + }, + logout(){ + wx.removeStorage({ + key: 'accessToken', + success(){ + app.globalData.accessToken = ''; + app.globalData.userInfo = {}; + wx.reLaunch({ + url: '/pages/user/login/index', + }) + } + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index 54d1636..c43eefa 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -1,20 +1,20 @@ - - 仙人模斗 + + {{userInfo.nickname||userInfo.auth_name}} - - + - + 修改密码 - - + + 用户协议 @@ -22,4 +22,4 @@ 语音播报 - \ No newline at end of file + \ No newline at end of file diff --git a/pages/user/index/index.wxss b/pages/user/index/index.wxss index ee6a202..60c4078 100644 --- a/pages/user/index/index.wxss +++ b/pages/user/index/index.wxss @@ -30,8 +30,12 @@ .actions .item{ padding:0 50rpx; text-align: center; + background-color: transparent; + font-weight: normal; + font-size: 30rpx; + margin:0; } -.actions .icon{ +.actions ._icon{ width:56rpx;height:56rpx; } .actions .text{ diff --git a/pages/user/password/index.js b/pages/user/password/index.js index 95da082..9b5e70c 100644 --- a/pages/user/password/index.js +++ b/pages/user/password/index.js @@ -1,5 +1,6 @@ const app = getApp(); import userApi from '../../../api/user'; +import {validateForm} from '../../../utils/util'; Page({ verifyCodeTimer:null, @@ -83,7 +84,7 @@ Page({ }, save(){ if(this.data.modifyLoading)return; - const valid = app.validateForm(this.validator,this); + const valid = validateForm(this.validator,this); if(valid.length==0){ if(this.data.password==this.data.rePassword){ this.setData({ diff --git a/project.config.json b/project.config.json index 90d677f..e42c1e5 100644 --- a/project.config.json +++ b/project.config.json @@ -13,7 +13,13 @@ "minified": true, "enhance": true, "showShadowRootInWxmlPanel": true, - "packNpmRelationList": [], + "packNpmManually": true, + "packNpmRelationList": [ + { + "packageJsonPath": "./package.json", + "miniprogramNpmDistDir": "./" + } + ], "babelSetting": { "ignore": [], "disablePlugins": [], @@ -22,7 +28,6 @@ "compileWorklet": false, "uglifyFileName": false, "uploadWithSourceMap": true, - "packNpmManually": true, "minifyWXSS": true, "minifyWXML": true, "localPlugins": false,