From c5e4f174c273c51725934d113808105836596676 Mon Sep 17 00:00:00 2001 From: itgaojian163 Date: Fri, 18 Jul 2025 12:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=97=E9=A4=90=E5=8C=85=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 4 +- net/api/invoiceApi.js | 6 + net/api/userApi.js | 5 + .../createProjectInfo/createProjectInfo.js | 10 +- .../createProjectInfo/createProjectInfo.wxml | 11 +- .../createProjectInfo/createProjectInfo.wxss | 20 +- .../minePackageRecord/minePackageRecord.js | 156 +++++++++++++++ .../minePackageRecord/minePackageRecord.json | 7 + .../minePackageRecord/minePackageRecord.wxml | 53 +++++ .../minePackageRecord/minePackageRecord.wxss | 113 +++++++++++ .../minePackageRecordDetail.js | 121 ++++++++++++ .../minePackageRecordDetail.json | 7 + .../minePackageRecordDetail.wxml | 43 ++++ .../minePackageRecordDetail.wxss | 183 ++++++++++++++++++ pages/mine/mineIndex/mine.js | 53 ++--- utils/comm.wxs | 41 +++- 16 files changed, 794 insertions(+), 39 deletions(-) create mode 100644 pages/mine/mineAccount/minePackageRecord/minePackageRecord.js create mode 100644 pages/mine/mineAccount/minePackageRecord/minePackageRecord.json create mode 100644 pages/mine/mineAccount/minePackageRecord/minePackageRecord.wxml create mode 100644 pages/mine/mineAccount/minePackageRecord/minePackageRecord.wxss create mode 100644 pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.js create mode 100644 pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.json create mode 100644 pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.wxml create mode 100644 pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.wxss diff --git a/app.json b/app.json index acb55aa..3ea5e03 100644 --- a/app.json +++ b/app.json @@ -37,7 +37,9 @@ "pages/shop/betrayGoodsDetail/betrayGoodsDetail", "pages/shop/saveAssigneeInfo/saveAssigneeInfo", "pages/shop/reportReplenish/reportReplenish", - "pages/shop/replenishDetail/replenishDetail" + "pages/shop/replenishDetail/replenishDetail", + "pages/mine/mineAccount/minePackageRecord/minePackageRecord", + "pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail" ], "window": { "navigationBarTextStyle": "black", diff --git a/net/api/invoiceApi.js b/net/api/invoiceApi.js index f3c55f0..b90dc28 100644 --- a/net/api/invoiceApi.js +++ b/net/api/invoiceApi.js @@ -15,6 +15,7 @@ const apiPath = { updateInvoiceRecord: '/api/invoicerecharge/update/{invoiceRechargeId}', //修改开票申请 cancelInvoiceRecord: '/api/invoicerecharge/cancel/{invoiceRechargeId}', //取消开票申请 dicByPId: '/api/data/listbyparentid/{pId}', //数据字典 + minePackageUseDetail: '/app/packageorderitem/listpagerelease/{id}' } class InvoiceApi { @@ -72,6 +73,11 @@ class InvoiceApi { const path = apiPath.updateInvoiceRecord.replace('{invoiceRechargeId}', id) return request(path, 'PUT', data, projectName) } + //套餐包使用详情 + static doGetMinePackageUseDetail(id, data) { + const path = apiPath.minePackageUseDetail.replace('{id}', id) + return request(path, "GET", data, projectName) + } } export default InvoiceApi; \ No newline at end of file diff --git a/net/api/userApi.js b/net/api/userApi.js index fdca3ef..bde0ad6 100644 --- a/net/api/userApi.js +++ b/net/api/userApi.js @@ -23,6 +23,7 @@ const apiPath = { mineMsgNotice: '/api/user-msg/listpage-simple/self', //获取消息通知 readMsgNotice: '/api/user-msg/update-read/self', //标记读取消息 deleteMsgNotice: '/api/user-msg/remove/self/{ids}', //删除消息通知 + minePackageRecord: '/api/proj/servicepkg/packageorder/listpage/self', //我充值的套餐包列表 } class UserService { static doLogin(data) { @@ -101,6 +102,10 @@ class UserService { const path = apiPath.deleteMsgNotice.replace('{ids}', id) return request(path, 'DELETE') } + //我的套餐包列表 + static doGetMinePackageRecord(data) { + return request(apiPath.minePackageRecord, "GET", data) + } } export default UserService; \ No newline at end of file diff --git a/pages/copyright/createProjectInfo/createProjectInfo.js b/pages/copyright/createProjectInfo/createProjectInfo.js index 90f135c..de0c4f5 100644 --- a/pages/copyright/createProjectInfo/createProjectInfo.js +++ b/pages/copyright/createProjectInfo/createProjectInfo.js @@ -273,8 +273,16 @@ Page({ }, //监听项目名称 inputProjectName(e) { + let value = e.detail.value; + if (value.indexOf("'") !== -1) { + value = value.replace(/'/g, ''); + this.setData({ + errorHint: '项目名称中不能存在英文单引号', + showError: true + }) + } this.setData({ - projectName: e.detail.value + projectName: value }) }, //选中联系人 diff --git a/pages/copyright/createProjectInfo/createProjectInfo.wxml b/pages/copyright/createProjectInfo/createProjectInfo.wxml index 70c816e..639466e 100644 --- a/pages/copyright/createProjectInfo/createProjectInfo.wxml +++ b/pages/copyright/createProjectInfo/createProjectInfo.wxml @@ -75,7 +75,7 @@ {{selectPackage.packageName?selectPackage.packageName:'请选择套餐包'}} - 取消 + 取消 @@ -83,7 +83,7 @@ {{selectCoupons.couponId? selectCoupons.coupon.title : '请选择优惠券'}} - 取消 + 取消 @@ -200,10 +200,13 @@ 剩余{{item.packageTotalSurplusCount}}件 {{item.packageInfoAppDTO.packageName}} - {{item.packageInfoAppDTO.packageDescription}} + + {{item.packageInfoAppDTO.packageDescription}} + {{tools.getRemainingDays(item.packageExpireTime)}}后到期 + - + diff --git a/pages/copyright/createProjectInfo/createProjectInfo.wxss b/pages/copyright/createProjectInfo/createProjectInfo.wxss index 795df29..f0a8a10 100644 --- a/pages/copyright/createProjectInfo/createProjectInfo.wxss +++ b/pages/copyright/createProjectInfo/createProjectInfo.wxss @@ -378,11 +378,23 @@ } .ticket-desc { - font-size: 12px; + display: flex; + flex-direction: row; + justify-content: space-between; + margin-top: 10rpx; +} + +.ticket-desc-txt { + font-size: 18rpx; color: var(--text-brown-color); - margin-top: 10px; - font-weight: 400; - min-height: 12px; + flex: 1; +} + +.ticket-desc-down { + font-size: 18rpx; + color: var(--text-brown-color); + flex: 1; + text-align: right; } diff --git a/pages/mine/mineAccount/minePackageRecord/minePackageRecord.js b/pages/mine/mineAccount/minePackageRecord/minePackageRecord.js new file mode 100644 index 0000000..4210b95 --- /dev/null +++ b/pages/mine/mineAccount/minePackageRecord/minePackageRecord.js @@ -0,0 +1,156 @@ +// pages/mine/mineAccount/mineOrder/mineOrder.js +import UserApi from '../../../../net/api/userApi' +import ProApi from '../../../../net/api/projectApi' +Page({ + + /** + * 页面的初始数据 + */ + data: { + packageList: [], //联系人列表 + pageData: { + page: 1, + rows: 10, + }, //检索参数 + loadingState: 'loading', //加载状态 + listRefreshTrig: false, //list刷新状态 + isLoadMore: false, //加载更多的状态 + hasMore: true, //是否有更多数据 + showError: false, + errorHint: '', + allPrice: 0, + materialPrice: 0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + wx.setNavigationBarTitle({ + title: '套餐包', + }) + wx.setNavigationBarColor({ + frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000 + backgroundColor: '#F0F0F0', // 传递的颜色值,仅支持十六进制颜色 + animation: { // 可选项 + duration: 500, + timingFunc: 'easeIn' + } + }) + this.doGetPrice() + this.doRefreshList() + }, + //创建 + goCreate(e) { + const _self = this + const item = e.currentTarget.dataset.item + if (item.packageTotalSurplusCount > 0) { + const price = item.packageInfoAppDTO.packageType == "MATERIAL" ? _self.data.materialPrice : _self.data.allPrice + wx.redirectTo({ + url: '/pages/copyright/createProjectInfo/createProjectInfo?type=' + item.packageInfoAppDTO.packageType + '&price=' + price + '&isUrgent=false&pId=' + item.packageInfoId, + }) + } else { + this.setData({ + errorHint: '该套餐包已无剩余次数', + showError: true + }) + } + }, + //详情 + goDetail(e) { + const item = e.currentTarget.dataset.item + wx.navigateTo({ + url: '/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail?id=' + item.modifier + '&oId=' + item.packageOrderId + }) + }, + doGetPrice() { + wx.showLoading({ + title: '加载中...', + }) + const _self = this + ProApi.doGetPrice() + .then(res => { + wx.hideLoading() + console.log(res) + res.projTypes.forEach(el => { + if (el.type == 'ALL') { + _self.setData({ + allPrice: el.price + }) + } else if (el.type == 'MATERIAL') { + _self.setData({ + materialPrice: el.price + }) + } + }); + _self.setData({ + urgent: res.additional.urgent, //加急办理 + }) + }, err => { + wx.hideLoading() + wx.showToast({ + title: '数据有误,请刷新页面', + icon: 'error' + }) + }) + }, + //刷新列表 + doRefreshList() { + console.log('正在刷新...') + const _self = this + _self.setData({ + listRefreshTrig: true, + loadingState: 'loading', + hasMore: true, + 'pageData.page': 1, + isLoadMore: false + }) + _self.doGetMinePackageList(true) + }, + //加载更多 + doLoadMore() { + //判断是否正在加载中 与是否存在更多数据 + const _self = this + if (_self.data.isLoadMore || !_self.data.hasMore) { + return + } + _self.setData({ + isLoadMore: true, + 'pageData.page': ++_self.data.pageData.page, + 'pageData.keywords': _self.data.keywords + }) + _self.doGetMinePackageList(false) + }, + //获取我的联系人列表 isRefresh false 加载更多 true 刷新 + doGetMinePackageList(isRefresh) { + const _self = this + _self.setData({ + packageList: isRefresh ? [] : _self.data.packageList, + loadingState: isRefresh ? 'loading' : '' + }) + UserApi.doGetMinePackageRecord(_self.data.pageData) + .then(res => { + console.log(res) + var status = 'success' + status = res.rows && res.rows.length > 0 ? 'success' : 'empty' + _self.setData({ + loadingState: isRefresh ? status : '', + packageList: _self.data.packageList.concat(res.rows), + listRefreshTrig: false, + isLoadMore: false + }) + _self.setData({ + hasMore: _self.data.packageList.length < res.total + }) + }) + .catch(err => { + _self.setData({ + loadingState: 'error', + listRefreshTrig: false, + isLoadMore: false, + hasMore: true + }) + }) + }, + +}) \ No newline at end of file diff --git a/pages/mine/mineAccount/minePackageRecord/minePackageRecord.json b/pages/mine/mineAccount/minePackageRecord/minePackageRecord.json new file mode 100644 index 0000000..af46fac --- /dev/null +++ b/pages/mine/mineAccount/minePackageRecord/minePackageRecord.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "mp-loading": "weui-miniprogram/loading/loading", + "container-loading": "/components/container-loading/container-loading", + "mp-toptips": "weui-miniprogram/toptips/toptips" + } +} \ No newline at end of file diff --git a/pages/mine/mineAccount/minePackageRecord/minePackageRecord.wxml b/pages/mine/mineAccount/minePackageRecord/minePackageRecord.wxml new file mode 100644 index 0000000..938556a --- /dev/null +++ b/pages/mine/mineAccount/minePackageRecord/minePackageRecord.wxml @@ -0,0 +1,53 @@ + + + + + + + + + + + {{item.packageName}} + {{item.packageInfoAppDTO.packageType=='MATERIAL'?'写材料':'全托管'}} + + + + + + 有效期至:{{item.packageExpireTime}} + + + + + + 剩余次数: + {{item.packageTotalSurplusCount}} + 总次数: + {{item.packageTotalCount}} + + + 下单时间: + {{item.gmtCreate}} + + + + + + 立即使用 + 查看详情 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/mineAccount/minePackageRecord/minePackageRecord.wxss b/pages/mine/mineAccount/minePackageRecord/minePackageRecord.wxss new file mode 100644 index 0000000..c86ee33 --- /dev/null +++ b/pages/mine/mineAccount/minePackageRecord/minePackageRecord.wxss @@ -0,0 +1,113 @@ +.content-container { + height: 93vh; +} + + +.order-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.order-item { + display: flex; + flex-direction: column; + border-radius: 10px; + width: 94vw; +} + + + + +/* 内容区域 */ +.package-content { + display: flex; + flex-direction: column; + background-color: #fff; + border-radius: 12rpx; + box-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.02); + width: 95%; + padding: 16rpx; +} + +/* 标题和标签 */ +.package-header { + display: flex; + justify-content: space-between; + align-items: center; +} + +.package-title { + font-size: 28rpx; + font-weight: bold; + color: #333; +} + +.package-tag { + background-color: #f0f9ff; + color: #0084ff; + font-size: 24rpx; + border-radius: 32rpx; + padding: 0rpx 20rpx; +} + +/* 价格和有效期 */ +.package-info { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 10rpx; +} + +.package-price { + font-size: 32rpx; + font-weight: bold; + color: var(--red-color); +} + +.package-validity { + font-size: 24rpx; + color: #999; +} + +/* 次数信息 */ +.package-counts { + display: flex; + flex-direction: row; + justify-content: space-between; + margin-top: 10rpx; +} + +.counts-label { + font-size: 24rpx; + color: #999; +} + +.counts-value { + font-size: 24rpx; + color: #333; +} + +/* 操作按钮 */ +.package-actions { + display: flex; + flex-direction: row; + justify-content: space-between; + margin-top: 20rpx; +} + +.action-button { + padding: 8rpx 24rpx; + font-size: 24rpx; + line-height: 40rpx; + flex: 1; + text-align: center; + background-color: var(--gray-color-light); +} + + + +.weui-half-screen-dialog__bd { + padding-bottom: 40rpx; +} \ No newline at end of file diff --git a/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.js b/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.js new file mode 100644 index 0000000..7fde42b --- /dev/null +++ b/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.js @@ -0,0 +1,121 @@ +// pages/mine/mineAccount/mineOrder/mineOrder.js +import UserApi from '../../../../net/api/userApi' +import ProApi from '../../../../net/api/projectApi' +import InvoiceApi from '../../../../net/api/invoiceApi' +Page({ + + /** + * 页面的初始数据 + */ + data: { + packageList: [], //套餐包使用详情列表 + pageData: { + page: 1, + rows: 10, + packageOrderId: 0 + }, //检索参数 + loadingState: 'loading', //加载状态 + listRefreshTrig: false, //list刷新状态 + isLoadMore: false, //加载更多的状态 + hasMore: true, //是否有更多数据 + showError: false, + errorHint: '', + allPrice: 0, + materialPrice: 0, + id: '', + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + wx.setNavigationBarTitle({ + title: '详情', + }) + wx.setNavigationBarColor({ + frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000 + backgroundColor: '#F0F0F0', // 传递的颜色值,仅支持十六进制颜色 + animation: { // 可选项 + duration: 500, + timingFunc: 'easeIn' + } + }) + const id = options.id + const orderId = options.oId + if (id !== undefined && id !== '' && orderId !== undefined && orderId !== '') { + this.setData({ + id: id, + 'pageData.packageOrderId': orderId + }) + this.doRefreshList() + } else { + wx.showToast({ + title: '数据有误,请稍后重试', + icon: 'error' + }) + setTimeout(() => { + wx.navigateBack() + }, 1000); + } + + }, + + //刷新列表 + doRefreshList() { + console.log('正在刷新...') + const _self = this + _self.setData({ + listRefreshTrig: true, + loadingState: 'loading', + hasMore: true, + 'pageData.page': 1, + isLoadMore: false + }) + _self.doGetMinePackageList(true) + }, + //加载更多 + doLoadMore() { + //判断是否正在加载中 与是否存在更多数据 + const _self = this + if (_self.data.isLoadMore || !_self.data.hasMore) { + return + } + _self.setData({ + isLoadMore: true, + 'pageData.page': ++_self.data.pageData.page, + }) + _self.doGetMinePackageList(false) + }, + //获取我的联系人列表 isRefresh false 加载更多 true 刷新 + doGetMinePackageList(isRefresh) { + const _self = this + _self.setData({ + packageList: isRefresh ? [] : _self.data.packageList, + loadingState: isRefresh ? 'loading' : '' + }) + InvoiceApi.doGetMinePackageUseDetail(_self.data.id, _self.data.pageData) + .then(res => { + console.log(res) + var status = 'success' + status = res.rows && res.rows.length > 0 ? 'success' : 'empty' + _self.setData({ + loadingState: isRefresh ? status : '', + packageList: _self.data.packageList.concat(res.rows), + listRefreshTrig: false, + isLoadMore: false + }) + _self.setData({ + hasMore: _self.data.packageList.length < res.total + }) + }) + .catch(err => { + _self.setData({ + loadingState: 'error', + listRefreshTrig: false, + isLoadMore: false, + hasMore: true + }) + }) + }, + +}) \ No newline at end of file diff --git a/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.json b/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.json new file mode 100644 index 0000000..d0e66b8 --- /dev/null +++ b/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "mp-loading": "weui-miniprogram/loading/loading", + "container-loading": "/components/container-loading/container-loading", + "mp-toptips": "weui-miniprogram/toptips/toptips" + } +} \ No newline at end of file diff --git a/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.wxml b/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.wxml new file mode 100644 index 0000000..5185ddd --- /dev/null +++ b/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.wxml @@ -0,0 +1,43 @@ + + + + + + + + + + + {{item.orderTitle}} + {{item.mode=='1'?'退回':'使用'}} + + + {{item.description}} + + + + + 剩余数量: + {{item.itemCount}} + 使用数量: + {{item.itemUseCount}} + + + 创建时间: + {{item.gmtCreate}} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.wxss b/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.wxss new file mode 100644 index 0000000..4cfe0b7 --- /dev/null +++ b/pages/mine/mineAccount/minePackageRecordDetail/minePackageRecordDetail.wxss @@ -0,0 +1,183 @@ +.ic-user { + background-image: url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB0PSIxNzQzOTg4MzkwNjkwIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjM0MDkiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTUxMiAxMDI0QzIyOS4yMDUzMzMgMTAyNCAwIDc5NC43OTQ2NjcgMCA1MTJTMjI5LjIwNTMzMyAwIDUxMiAwczUxMiAyMjkuMjA1MzMzIDUxMiA1MTItMjI5LjIwNTMzMyA1MTItNTEyIDUxMnogbTAtNDk2LjQ2OTMzM2ExNzAuNjY2NjY3IDE3MC42NjY2NjcgMCAxIDAgMC0zNDEuMzMzMzM0IDE3MC42NjY2NjcgMTcwLjY2NjY2NyAwIDAgMCAwIDM0MS4zMzMzMzR6IG0yNjMuNzY1MzMzIDI2My43MjI2NjZhMjYzLjc2NTMzMyAyNjMuNzY1MzMzIDAgMSAwLTUyNy41MzA2NjYgMGg1MjcuNTMwNjY2eiIgcC1pZD0iMzQxMCIgZmlsbD0iIzEyOTZkYiI+PC9wYXRoPjwvc3ZnPg=='); + background-size: cover; + background-repeat: no-repeat; +} + + +.search-box { + position: fixed; + top: 0; + left: 0; + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + align-self: center; + width: 96vw; +} + +.search-container { + position: relative; + align-self: center; + border-radius: 5px; + background-color: var(--white-color); + font-family: -regular; + margin: 10px 15px; + padding: 5px; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + flex: 1; +} + +.search-input { + box-sizing: border-box; + color: var(--text-color); + font-size: 14px; + text-align: center; + flex: 1; +} + +.search-input::after { + content: ''; + position: absolute; + left: 10px; + top: 50%; + transform: translateY(-50%); + width: 20px; + height: 20px; + margin-top: -1px; + background-size: cover; + background-image: url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSI2NCA2NCA4OTYgODk2IiB3aWR0aD0iMTQiIGhlaWdodD0iMTkiIHN0eWxlPSIiIGZpbHRlcj0ibm9uZSI+CiAgICAKICAgIDxnPgogICAgPHBhdGggZD0iTTkwOS42IDg1NC41TDY0OS45IDU5NC44QzY5MC4yIDU0Mi43IDcxMiA0NzkgNzEyIDQxMmMwLTgwLjItMzEuMy0xNTUuNC04Ny45LTIxMi4xLTU2LjYtNTYuNy0xMzItODcuOS0yMTIuMS04Ny45cy0xNTUuNSAzMS4zLTIxMi4xIDg3LjlDMTQzLjIgMjU2LjUgMTEyIDMzMS44IDExMiA0MTJjMCA4MC4xIDMxLjMgMTU1LjUgODcuOSAyMTIuMUMyNTYuNSA2ODAuOCAzMzEuOCA3MTIgNDEyIDcxMmM2NyAwIDEzMC42LTIxLjggMTgyLjctNjJsMjU5LjcgMjU5LjZhOC4yIDguMiAwIDAgMCAxMS42IDBsNDMuNi00My41YTguMiA4LjIgMCAwIDAgMC0xMS42ek01NzAuNCA1NzAuNEM1MjggNjEyLjcgNDcxLjggNjM2IDQxMiA2MzZzLTExNi0yMy4zLTE1OC40LTY1LjZDMjExLjMgNTI4IDE4OCA0NzEuOCAxODggNDEyczIzLjMtMTE2LjEgNjUuNi0xNTguNEMyOTYgMjExLjMgMzUyLjIgMTg4IDQxMiAxODhzMTE2LjEgMjMuMiAxNTguNCA2NS42UzYzNiAzNTIuMiA2MzYgNDEycy0yMy4zIDExNi4xLTY1LjYgMTU4LjR6IiBmaWxsPSJyZ2JhKDIwNCwyMDQsMjA0LDEpIj48L3BhdGg+CiAgICA8L2c+CiAgPC9zdmc+'); +} + +.add-btn { + border-radius: 4px; + background-color: var(--btn-green-color); + color: rgba(255, 255, 255, 1); + font-size: 14px; + text-align: center; + text-align: center; + font-family: PingFangSC-regular; + padding: 5px 10px; +} + +.add-btn:active { + background-color: var(--btn-green-color-active); +} + +.content-container { + height: 93vh; +} + + +.order-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.order-item { + display: flex; + flex-direction: column; + border-radius: 10px; + width: 94vw; +} + + + + +/* 内容区域 */ +.package-content { + display: flex; + flex-direction: column; + background-color: #fff; + border-radius: 12rpx; + box-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.02); + width: 95%; + padding: 16rpx; +} + +/* 标题和标签 */ +.package-header { + display: flex; + justify-content: space-between; + align-items: center; +} + +.package-title { + font-size: 28rpx; + font-weight: bold; + color: #333; +} + +.package-tag { + background-color: #f0f9ff; + color: #0084ff; + font-size: 24rpx; + border-radius: 32rpx; + padding: 0rpx 20rpx; +} + +/* 价格和有效期 */ +.package-info { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 10rpx; +} + +.package-price { + font-size: 32rpx; + font-weight: bold; + color: var(--red-color); +} + +.package-validity { + font-size: 24rpx; + color: #999; +} + +/* 次数信息 */ +.package-counts { + display: flex; + flex-direction: row; + justify-content: space-between; + margin-top: 10rpx; +} + +.counts-label { + font-size: 24rpx; + color: #999; +} + +.counts-value { + font-size: 24rpx; + color: #333; +} + +/* 操作按钮 */ +.package-actions { + display: flex; + flex-direction: row; + justify-content: space-between; + margin-top: 20rpx; +} + +.action-button { + padding: 8rpx 24rpx; + font-size: 24rpx; + line-height: 40rpx; + flex: 1; + text-align: center; + background-color: var(--gray-color-light); +} + + + +.weui-half-screen-dialog__bd { + padding-bottom: 40rpx; +} \ No newline at end of file diff --git a/pages/mine/mineIndex/mine.js b/pages/mine/mineIndex/mine.js index 0f91971..b7b4317 100644 --- a/pages/mine/mineIndex/mine.js +++ b/pages/mine/mineIndex/mine.js @@ -117,32 +117,35 @@ Page({ } }) }, - //跳转创建项目页面 + //跳转套餐包购买记录 openCreate(e) { - //计算价格 - const _self = this - const type = e.currentTarget.dataset.type - if (type == 'ALL') { - if (_self.data.allCount > 0) { - _self.doGetPackage(type) - } else { - //提示充值 - _self.setData({ - errorHint: '您的账户当前无套餐包,为正常使用请及时充值。', - showError: true - }) - } - } else { - if (_self.data.materialCount > 0) { - _self.doGetPackage(type) - } else { - //提示充值 - _self.setData({ - errorHint: '您的账户当前无套餐包,为正常使用请及时充值。', - showError: true - }) - } - } + wx.navigateTo({ + url: '/pages/mine/mineAccount/minePackageRecord/minePackageRecord', + }) + // //计算价格 + // const _self = this + // const type = e.currentTarget.dataset.type + // if (type == 'ALL') { + // if (_self.data.allCount > 0) { + // _self.doGetPackage(type) + // } else { + // //提示充值 + // _self.setData({ + // errorHint: '您的账户当前无套餐包,为正常使用请及时充值。', + // showError: true + // }) + // } + // } else { + // if (_self.data.materialCount > 0) { + // _self.doGetPackage(type) + // } else { + // //提示充值 + // _self.setData({ + // errorHint: '您的账户当前无套餐包,为正常使用请及时充值。', + // showError: true + // }) + // } + // } }, //获取套餐包详情 doGetPackage(type) { diff --git a/utils/comm.wxs b/utils/comm.wxs index 2cf3d21..722ca1c 100644 --- a/utils/comm.wxs +++ b/utils/comm.wxs @@ -444,15 +444,47 @@ var phoneNum = function (str, startLength, endLength, replaceStr) { var isImg = function (filename) { var input = filename.trim(); var hasDot = input.indexOf('.') !== -1; - var extension = hasDot - ? input.substring(input.lastIndexOf('.') + 1).toLowerCase() - : input.toLowerCase(); + var extension = hasDot ? + input.substring(input.lastIndexOf('.') + 1).toLowerCase() : + input.toLowerCase(); var imageExtensions = [ 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'ico', 'tiff', 'tif' ]; return imageExtensions.indexOf(extension) !== -1; }; +//计算剩余天数 +var getRemainingTime = function (targetTime) { + if (!targetTime) return '0小时' + + var now = getDate().getTime() + var targetDate = getDate( + parseInt(targetTime.slice(0, 4)), + parseInt(targetTime.slice(5, 7)) - 1, + parseInt(targetTime.slice(8, 10)), + parseInt(targetTime.slice(11, 13)), + parseInt(targetTime.slice(14, 16)), + parseInt(targetTime.slice(17, 19)) + ) + + var targetTimestamp = targetDate.getTime() + var diff = targetTimestamp - now + + if (diff <= 0) return '0小时' + + // 计算总剩余小时 + var totalHours = Math.ceil(diff / (60 * 60 * 1000)) + + // 如果超过24小时,显示天和小时 + if (totalHours >= 24) { + var days = Math.floor(totalHours / 24) + var hours = totalHours % 24 + return days + '天' + hours + '小时' + } + + // 不足24小时,只显示小时 + return totalHours + '小时' +} module.exports = { isEmpty: isEmpty, status: status, @@ -480,5 +512,6 @@ module.exports = { goodsOrderStatus: goodsOrderStatus, goodsOrderColor: goodsOrderColor, goodsStatus: goodsStatus, - isImg: isImg + isImg: isImg, + getRemainingDays: getRemainingTime }; \ No newline at end of file