套餐包使用详情

This commit is contained in:
itgaojian163 2025-07-18 12:06:02 +08:00
parent 8749a8f704
commit c5e4f174c2
16 changed files with 794 additions and 39 deletions

View File

@ -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",

View File

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

View File

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

View File

@ -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
})
},
//选中联系人

View File

@ -75,7 +75,7 @@
<view class="select-content" style="align-items: center;padding: 15rpx;">
<text class="value {{!tools.isEmpty(selectPackage) ? 'v-select':'v-normal'}}" style="flex: 1;" bind:tap="doShowPackage">{{selectPackage.packageName?selectPackage.packageName:'请选择套餐包'}}</text>
<view class="icon-arrow-solid"></view>
<text wx:if="{{!tools.isEmpty(selectPackage)}}" class="link" bind:tap="clearSelectPackageOrCoupons">取消</text>
<text wx:if="{{!tools.isEmpty(selectPackage)}}" class="link ml-20" bind:tap="clearSelectPackageOrCoupons">取消</text>
</view>
</view>
<view wx:if="{{canSelCoupons}}" class="item">
@ -83,7 +83,7 @@
<view class="select-content" style="align-items: center;padding: 15rpx;">
<text bindtap="doShowCoupons" class="value {{!tools.isEmpty(selectCoupons)? 'v-select':'v-normal'}}">{{selectCoupons.couponId? selectCoupons.coupon.title : '请选择优惠券'}}</text>
<view class="icon-arrow-solid"></view>
<text class="link" wx:if="{{!tools.isEmpty(selectCoupons)}}" bind:tap="clearSelectPackageOrCoupons">取消</text>
<text class="link ml-20" wx:if="{{!tools.isEmpty(selectCoupons)}}" bind:tap="clearSelectPackageOrCoupons">取消</text>
</view>
</view>
</view>
@ -200,10 +200,13 @@
<view>剩余{{item.packageTotalSurplusCount}}件</view>
</view>
<view class="ticket-content">{{item.packageInfoAppDTO.packageName}}</view>
<view class="ticket-desc">{{item.packageInfoAppDTO.packageDescription}}</view>
<view class="ticket-desc">
<view class="ticket-desc-txt">{{item.packageInfoAppDTO.packageDescription}}</view>
<view class="ticket-desc-down">{{tools.getRemainingDays(item.packageExpireTime)}}后到期</view>
</view>
</view>
<view class="r-tickets">
<radio class="custom-radio" style="margin-left: 5px;" checked="{{tempPackage.packageAccountItem==item.packageAccountItem}}"></radio>
<radio class="custom-radio" style="margin-left: 5px;" checked="{{tempPackage.packageAccountItem==item.packageAccountItem}}"></radio>
</view>
</view>
</block>

View File

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

View File

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

View File

@ -0,0 +1,7 @@
{
"usingComponents": {
"mp-loading": "weui-miniprogram/loading/loading",
"container-loading": "/components/container-loading/container-loading",
"mp-toptips": "weui-miniprogram/toptips/toptips"
}
}

View File

@ -0,0 +1,53 @@
<view class="page-container">
<view class="content-container">
<container-loading loadingState="{{loadingState}}" style="height: 90vh;" bindrefresh="doRefreshList">
<scroll-view scroll-y="{{true}}" style="height: 90vh;padding-bottom: 40px;" bindrefresherrefresh="doRefreshList" refresher-enabled refresher-triggered="{{listRefreshTrig}}" bindscrolltolower="doLoadMore" lower-threshold='30'>
<view class="order-box">
<block wx:for="{{packageList}}" wx:key="index">
<!-- 列表条目组件 -->
<view class="package-content">
<!-- 标题和标签 -->
<view class="package-header">
<text class="package-title">{{item.packageName}}</text>
<text class="package-tag">{{item.packageInfoAppDTO.packageType=='MATERIAL'?'写材料':'全托管'}}</text>
</view>
<!-- 价格和有效期 -->
<view class="package-info">
<rich-text class="package-price" nodes="{{tools.moneyTxt(12,item.packageTotalMoney/100)}}"></rich-text>
<text class="package-validity">有效期至:{{item.packageExpireTime}}</text>
</view>
<!-- 次数信息 -->
<view class="package-counts">
<view class="package-counts-item">
<text class="counts-label">剩余次数:</text>
<text class="counts-value mr-10">{{item.packageTotalSurplusCount}}</text>
<text class="counts-label">总次数:</text>
<text class="counts-value">{{item.packageTotalCount}}</text>
</view>
<view class="package-counts-item">
<text class="counts-label">下单时间:</text>
<text class="counts-label">{{item.gmtCreate}}</text>
</view>
</view>
<!-- 操作按钮 -->
<view class="package-actions">
<view class="action-button mr-10" data-item="{{item}}" bind:tap="goCreate">立即使用</view>
<view class="action-button" data-item="{{item}}" bind:tap="goDetail">查看详情</view>
</view>
</view>
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
</view>
</view>
</scroll-view>
</container-loading>
</view>
</view>
<mp-toptips msg="{{errorHint}}" type="error" show="{{showError}}"></mp-toptips>
<mp-toptips msg="{{successHint}}" delay="2000" type="success" show="{{showSuccess}}"></mp-toptips>
<wxs src="../../../../utils/comm.wxs" module="tools"></wxs>

View File

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

View File

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

View File

@ -0,0 +1,7 @@
{
"usingComponents": {
"mp-loading": "weui-miniprogram/loading/loading",
"container-loading": "/components/container-loading/container-loading",
"mp-toptips": "weui-miniprogram/toptips/toptips"
}
}

View File

@ -0,0 +1,43 @@
<view class="page-container">
<view class="content-container">
<container-loading loadingState="{{loadingState}}" style="height: 90vh;" bindrefresh="doRefreshList">
<scroll-view scroll-y="{{true}}" style="height: 90vh;padding-bottom: 40px;" bindrefresherrefresh="doRefreshList" refresher-enabled refresher-triggered="{{listRefreshTrig}}" bindscrolltolower="doLoadMore" lower-threshold='30'>
<view class="order-box">
<block wx:for="{{packageList}}" wx:key="index">
<!-- 列表条目组件 -->
<view class="package-content">
<!-- 标题和标签 -->
<view class="package-header">
<text class="package-title">{{item.orderTitle}}</text>
<text class="package-tag">{{item.mode=='1'?'退回':'使用'}}</text>
</view>
<view class="package-counts">
<view class="counts-label">{{item.description}}</view>
</view>
<!-- 次数信息 -->
<view class="package-counts">
<view class="package-counts-item">
<text class="counts-label">剩余数量:</text>
<text class="counts-value mr-10">{{item.itemCount}}</text>
<text class="counts-label">使用数量:</text>
<text class="counts-value">{{item.itemUseCount}}</text>
</view>
<view class="package-counts-item">
<text class="counts-label">创建时间:</text>
<text class="counts-label">{{item.gmtCreate}}</text>
</view>
</view>
</view>
</block>
<mp-loading show="{{isLoadMore}}" type="circle"></mp-loading>
<view wx:if="{{!hasMore}}" class="no-more">
<view class="no-more-dot"></view>
</view>
</view>
</scroll-view>
</container-loading>
</view>
</view>
<mp-toptips msg="{{errorHint}}" type="error" show="{{showError}}"></mp-toptips>
<mp-toptips msg="{{successHint}}" delay="2000" type="success" show="{{showSuccess}}"></mp-toptips>
<wxs src="../../../../utils/comm.wxs" module="tools"></wxs>

View File

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

View File

@ -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) {

View File

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