feat(积分):积分管理

This commit is contained in:
Ankkaya 2024-06-17 18:16:46 +08:00
parent d5e3d34e0f
commit 5f257aaa63
17 changed files with 1295 additions and 757 deletions

3
.env
View File

@ -18,3 +18,6 @@ MALL_STATIC_URL = https://file.sheepjs.com
# 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启) # 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启)
MALL_MPLIVE_ON = 0 MALL_MPLIVE_ON = 0
# APP 下载地址
MALL_APP_DOWNLOAD_PATH = ''

View File

@ -147,7 +147,8 @@
{ {
"path": "point/loglist", "path": "point/loglist",
"style": { "style": {
"navigationBarTitleText": "历史积分" "navigationBarTitleText": "历史积分",
"enablePullDownRefresh": true
}, },
"meta": { "meta": {
"auth": true "auth": true

View File

@ -1,7 +1,8 @@
<template> <template>
<pb-layout navbar="inner" tabbar="/pages/index/index" :bgStyle="bgStyle"> <pb-layout navbar="inner" tabbar="/pages/index/index" :bgStyle="bgStyle">
<view class="dashboard-module ss-p-x-30"> <view class="dashboard-module ss-p-x-30">
<view class="merchant-info flex align-center"> <view class="merchant-info flex align-center justify-between">
<view class="flex align-center ss-gap-10">
<image class="logo" :src="merchantInfo?.logo" mode="aspectFill"></image> <image class="logo" :src="merchantInfo?.logo" mode="aspectFill"></image>
<view class="detail flex flex-column justify-center gap-10"> <view class="detail flex flex-column justify-center gap-10">
@ -9,6 +10,10 @@
<view class="description ss-font-26">{{ merchantInfo?.contactPhone }}</view> <view class="description ss-font-26">{{ merchantInfo?.contactPhone }}</view>
</view> </view>
</view> </view>
<view @tap="checkVerifi">
<text style="color: #fff; font-size: 32px" class="cicon-scan"></text>
</view>
</view>
<view class="statistic ss-m-t-24"> <view class="statistic ss-m-t-24">
<view class="title ss-font-24 ss-m-b-20"> <view class="title ss-font-24 ss-m-b-20">
@ -19,7 +24,7 @@
<view class="unit self-start"></view> <view class="unit self-start"></view>
<view class="sincome ss-font-60">{{ state.statistic.todayPaymentAmount || 0 }}</view> <view class="sincome ss-font-60">{{ state.statistic.todayPaymentAmount || 0 }}</view>
</view> </view>
<button class="right-btn ss-reset-button">查看详情</button> <!-- <button class="right-btn ss-reset-button">查看详情</button> -->
</view> </view>
<view class="des ss-m-t-20"> <view class="des ss-m-t-20">
总销售额 {{ state.statistic.totalSalesAmount }} | 成功退款 {{ state.statistic.refundCount }} | 总销售额 {{ state.statistic.totalSalesAmount }} | 成功退款 {{ state.statistic.refundCount }} |
@ -110,6 +115,14 @@ async function getStatistic() {
state.value.more[3].value = res.data.deliveryOrderCount state.value.more[3].value = res.data.deliveryOrderCount
} }
/**
* @author Ankkaya
* @description 核销
* @param {Type} -
* @returns {Type}
*/
function checkVerifi() {}
onShow(() => { onShow(() => {
getStatistic() getStatistic()
}) })

View File

@ -1,14 +1,23 @@
<template> <template>
<pb-layout navbar="inner" tabbar="/pages/index/my" :bgStyle="bgStyle"> <pb-layout navbar="inner" tabbar="/pages/index/my" :bgStyle="bgStyle">
<view class="my-module ss-p-x-30"> <view class="my-module ss-p-x-30">
<view class="user-info flex align-center"> <view class="user-info flex align-center justify-between">
<image class="avatar" :src="userInfo.avatar || '/static/default_avatar.png'" mode="aspectFill"></image> <view class="flex align-center ss-gap-10">
<image
class="avatar"
:src="userInfo.avatar || '/static/default_avatar.png'"
mode="aspectFill"
></image>
<view class="detail flex flex-column justify-center gap-10"> <view class="detail flex flex-column justify-center gap-10">
<view class="name ss-font-26">{{ userInfo.nickname }}</view> <view class="name ss-font-26">{{ userInfo.nickname }}</view>
<view class="description ss-font-26">{{ userInfo.mobile }}</view> <view class="description ss-font-26">{{ userInfo.mobile }}</view>
</view> </view>
</view> </view>
<view>
<text style="color: #fff; font-size: 20px" class="cicon-settings-o"></text>
</view>
</view>
<view class="statistic ss-m-t-24"> <view class="statistic ss-m-t-24">
<view class="title ss-font-24 ss-m-b-20"> 账户余额 </view> <view class="title ss-font-24 ss-m-b-20"> 账户余额 </view>

View File

@ -1,10 +1,21 @@
<template> <template>
<pb-layout navbar="inner" iconColor="#fff" class="buy-point-wrap" leftIcon="leftIcon" color="#fff" title="购买积分" <pb-layout
:bgStyle="bgStyle"> navbar="inner"
iconColor="#fff"
class="buy-point-wrap"
leftIcon="leftIcon"
color="#fff"
title="购买积分"
:bgStyle="bgStyle"
>
<view class="title ss-m-t-80"> <view class="title ss-m-t-80">
<view class="main">购买商城积分</view> <view class="main">购买商城积分</view>
<view class="sub ss-flex ss-row-center ss-m-t-55"><text style="color: #F3D3BF;" <view class="sub ss-flex ss-row-center ss-m-t-55"
class="cicon-safe"></text>订单多多·出单多多<text style="color: #F3D3BF;" class="cicon-safe"></text></view> ><text style="color: #f3d3bf" class="cicon-safe"></text>订单多多·出单多多<text
style="color: #f3d3bf"
class="cicon-safe"
></text
></view>
</view> </view>
<view class="middle ss-m-t-150 ss-flex-col ss-row-center ss-col-center ss-gap-40"> <view class="middle ss-m-t-150 ss-flex-col ss-row-center ss-col-center ss-gap-40">
@ -19,15 +30,18 @@
<view class="agreement-box ss-flex ss-row-center" :class="{ shake: state.isShaking }"> <view class="agreement-box ss-flex ss-row-center" :class="{ shake: state.isShaking }">
<label class="radio ss-flex" @tap="onChange"> <label class="radio ss-flex" @tap="onChange">
<radio :checked="state.agreeStatus" color="rgba(243, 192, 156, 1)" style="transform: scale(0.8)" <radio
@tap.stop="onChange" /> :checked="state.agreeStatus"
color="rgba(243, 192, 156, 1)"
style="transform: scale(0.8)"
@tap.stop="onChange"
/>
<view class="agreement-text ss-flex ss-m-l-8"> <view class="agreement-text ss-flex ss-m-l-8">
我已阅读并遵守 我已阅读并遵守
<view class="tcp-text" @tap.stop="onProtocol('积分须知')"> 积分须知 </view> <view class="tcp-text" @tap.stop="onProtocol('积分须知')"> 积分须知 </view>
</view> </view>
</label> </label>
</view> </view>
</pb-layout> </pb-layout>
</template> </template>
@ -44,16 +58,14 @@ const bgStyle = {
imageType: 'local', imageType: 'local',
backgroundColor: '#fff', backgroundColor: '#fff',
description: '', description: '',
height: '100%',
} }
function onProtocol(title) { function onProtocol(title) {}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.buy-point-wrap { .buy-point-wrap {
.title { .title {
.main { .main {
font-size: 80rpx; font-size: 80rpx;
@ -77,7 +89,7 @@ function onProtocol(title) {
} }
.title::before { .title::before {
content: ""; content: '';
display: block; display: block;
width: 80px; width: 80px;
position: relative; position: relative;
@ -87,7 +99,7 @@ function onProtocol(title) {
} }
.title::after { .title::after {
content: ""; content: '';
display: block; display: block;
width: 80px; width: 80px;
position: relative; position: relative;
@ -107,7 +119,6 @@ function onProtocol(title) {
} }
.combo { .combo {
.draw-btn { .draw-btn {
height: 82rpx; height: 82rpx;
line-height: normal; line-height: normal;
@ -125,14 +136,12 @@ function onProtocol(title) {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
color: #e7b493; color: #e7b493;
border: 1px solid #E7B493; border: 1px solid #e7b493;
margin-top: 20px; margin-top: 20px;
} }
} }
.agreement-box { .agreement-box {
width: 100%; width: 100%;
.protocol-check { .protocol-check {

View File

@ -1,11 +1,23 @@
<template> <template>
<pb-layout navbar="inner" iconColor="#fff" class="loglist-point-wrap" leftIcon="leftIcon" color="#fff" title="分发积分" <pb-layout
:bgStyle="bgStyle"> navbar="inner"
iconColor="#fff"
class="loglist-point-wrap"
leftIcon="leftIcon"
color="#fff"
title="历史积分"
:bgStyle="bgStyle"
>
<view> <view>
<p-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无记录" bgColor="transparent" /> <p-empty
v-if="state.pagination.total === 0"
icon="/static/order-empty.png"
text="暂无记录"
bgColor="transparent"
/>
<view v-if="state.pagination.total > 0"> <view v-if="state.pagination.total > 0">
<view v-for="item in state.pagination.list" class=" log-point-item ss-font-26"> <view v-for="item in state.pagination.list" class="log-point-item ss-font-26">
<view class="top ss-flex ss-row-between ss-m-b-20"> <view class="top ss-flex ss-row-between ss-m-b-20">
<view class="label">积分</view> <view class="label">积分</view>
<view class="date">{{ item.date }}</view> <view class="date">{{ item.date }}</view>
@ -18,8 +30,11 @@
</view> </view>
</view> </view>
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" <uni-load-more
:content-text="{ contentdown: '上拉加载更多' }" /> v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{ contentdown: '上拉加载更多' }"
/>
</pb-layout> </pb-layout>
</template> </template>
@ -27,12 +42,13 @@
import { ref } from 'vue' import { ref } from 'vue'
import { resetPagination } from '@/peach/utils' import { resetPagination } from '@/peach/utils'
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import PointApi from '@/peach/api/pay/point'
const bgStyle = { const bgStyle = {
backgroundImage: '/static/point.png', backgroundImage: '/static/point.png',
imageType: 'local', imageType: 'local',
backgroundColor: '#fff' backgroundColor: '#fff',
height: '100%',
} }
const state = ref({ const state = ref({
@ -42,13 +58,13 @@ const state = ref({
{ {
last: 50000, last: 50000,
date: '2022-05-30', date: '2022-05-30',
income: '+1000' income: '+1000',
}, },
{ {
last: 50000, last: 50000,
date: '2022-05-30', date: '2022-05-30',
income: '-1000' income: '-1000',
} },
], ],
total: 2, total: 2,
pageNo: 1, pageNo: 1,
@ -57,7 +73,14 @@ const state = ref({
loadStatus: '', loadStatus: '',
}) })
function getLogList() { } async function getLogList() {
let { data } = await PointApi.getPointList({
pageNo: state.value.pagination.pageNo,
pageSize: state.value.pagination.pageSize,
})
state.value.total = data.total
state.value.list = data.list
}
// //
function loadMore() { function loadMore() {
@ -81,20 +104,18 @@ onPullDownRefresh(() => {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, 800) }, 800)
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.loglist-point-wrap { .loglist-point-wrap {
.log-point-item { .log-point-item {
border-bottom: 1px solid rgba(231, 180, 147, .2); border-bottom: 1px solid rgba(231, 180, 147, 0.2);
margin: 30rpx 40rpx; margin: 30rpx 40rpx;
padding-bottom: 30rpx; padding-bottom: 30rpx;
.top, .top,
.bottom { .bottom {
color: #E7B493; color: #e7b493;
} }
} }

View File

@ -1,37 +1,74 @@
<template> <template>
<pb-layout navbar="inner" iconColor="#fff" class="share-point-wrap" leftIcon="leftIcon" color="#fff" title="分发积分" <pb-layout
:bgStyle="bgStyle"> navbar="inner"
iconColor="#fff"
class="share-point-wrap"
leftIcon="leftIcon"
color="#fff"
title="分发积分"
right="历史积分"
:bgStyle="bgStyle"
>
<view class="title ss-m-t-80"> <view class="title ss-m-t-80">
<view class="main">分发积分</view> <view class="main">分发积分</view>
<view class="sub ss-flex ss-row-center ss-m-t-55"><text style="color: #F3D3BF;" <view class="sub ss-flex ss-row-center ss-m-t-55"
class="cicon-safe"></text>订单多多·出单多多<text style="color: #F3D3BF;" class="cicon-safe"></text></view> ><text style="color: #f3d3bf" class="cicon-safe"></text>订单多多·出单多多<text
style="color: #f3d3bf"
class="cicon-safe"
></text
></view>
</view> </view>
<view class="user-search"> <view class="user-search">
<view class="search"> <view class="search">
<uni-easyinput :styles="{ backgroundColor: 'transparent', color: '#E7B493' }" placeholderStyle="color: #E7B493;" <uni-easyinput
:clearable="false" :inputBorder="false" type="number" trim="all" suffixIcon="search" placeholder="请输入用户名" /> v-model="state.inputData"
:styles="{ backgroundColor: 'transparent', color: '#E7B493' }"
placeholderStyle="color: #E7B493;"
@input="inputUserFunc"
:clearable="false"
:inputBorder="false"
trim="all"
suffixIcon="search"
placeholder="请输入用户名/手机号"
/>
</view> </view>
<view class="result" :style="{ height: resultHeight, overflow: 'auto' }"> <view class="result" :style="{ height: resultHeight, overflow: 'auto' }">
<view v-for="item in 10" class="user ss-flex ss-row-between ss-col-center"> <view v-for="item in state.userList" class="user ss-flex ss-row-between ss-col-center">
<view class="user-info ss-flex ss-col-center ss-gap-20"> <view class="user-info ss-flex ss-col-center ss-gap-20">
<image style="width: 48rpx; height: 48rpx;" src="/static/default_avatar.png" /> <image
<view class="nickname">哈哈哈</view> style="width: 48rpx; height: 48rpx; border-radius: 50%"
:src="item.avatar ? item.avatar : '/static/default_avatar.png'"
/>
<view class="nickname">{{ item.nickname }}</view>
</view> </view>
<view class="input-point"> <view class="input-point">
<uni-easyinput :styles="{ backgroundColor: 'transparent', color: '#E7B493' }" <uni-easyinput
:placeholderStyle="placeholderStyle" :clearable="false" :inputBorder="false" type="number" trim="all" :styles="{ backgroundColor: 'transparent', color: '#E7B493' }"
placeholder="请输入积分额度" /> :placeholderStyle="placeholderStyle"
v-model="item.point"
:clearable="false"
:inputBorder="false"
@input="inputPointFunc(item)"
type="number"
trim="all"
placeholder="请输入积分额度"
/>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="ss-p-x-30 bottom">
<button class="ss-reset-button share-btn" @tap="confirmShare">确定</button>
</view>
</pb-layout> </pb-layout>
</template> </template>
<script setup> <script setup>
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import PointApi from '@/peach/api/pay/point'
import UserUtil from '@/peach/api/member/user'
import peach from '@/peach' import peach from '@/peach'
const placeholderStyle = ref('color: #E7B493') const placeholderStyle = ref('color: #E7B493')
@ -40,10 +77,21 @@ const resultHeight = computed(() => {
return `calc(100vh - 728rpx)` return `calc(100vh - 728rpx)`
}) })
const state = ref({ const state = ref({
inputData: '',
userList: [],
isShaking: false, isShaking: false,
agreeStatus: false, agreeStatus: false,
userParams: {
mobile: '',
nickname: '',
pageNo: 1,
pageSize: 10,
},
pointParams: {
memberId: '',
point: '',
},
}) })
const bgStyle = { const bgStyle = {
@ -51,16 +99,75 @@ const bgStyle = {
imageType: 'local', imageType: 'local',
backgroundColor: '#fff', backgroundColor: '#fff',
description: '', description: '',
height: '100%',
} }
function onProtocol(title) { let timer
function inputUserFunc() {
clearTimeout(timer)
timer = setTimeout(() => {
getUserList()
}, 1000)
} }
async function confirmShare() {
if (!state.value.pointParams.memberId) {
peach.$helper.toast('请选择要赠送的用户')
return
}
if (!state.value.pointParams.point) {
peach.$helper.toast('请输入要赠送的积分')
return
}
await PointApi.sendPoint(state.value.pointParams)
uni.showToast({
title: '赠送成功',
icon: 'none',
success: () => {
state.value.inputData = ''
getUserList()
},
})
}
function inputPointFunc(data) {
state.value.userList.forEach((item) => {
if (data.id !== item.id) item.point = ''
})
state.value.pointParams.memberId = data.id
state.value.pointParams.point = data.point
}
async function getUserList() {
// userParams
state.value.userParams = {
mobile: '',
nickname: '',
pageNo: 1,
pageSize: 10,
}
// inputData
// string
if (/^\d+$/.test(state.value.inputData)) {
state.value.userParams.mobile = state.value.inputData
} else {
state.value.userParams.nickname = state.value.inputData
}
let { data } = await UserUtil.getUserList(state.value.userParams)
data.list.forEach((item) => {
item.point = ''
})
state.value.userList = data.list
}
function onProtocol(title) {}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.share-point-wrap { .share-point-wrap {
.title { .title {
.main { .main {
font-size: 80rpx; font-size: 80rpx;
@ -82,12 +189,12 @@ function onProtocol(title) {
margin: 50rpx 40rpx 0; margin: 50rpx 40rpx 0;
.search { .search {
border: 1px solid #E7B493; border: 1px solid #e7b493;
border-radius: 30px; border-radius: 30px;
} }
:deep(.uniui-search) { :deep(.uniui-search) {
color: #E7B493 !important; color: #e7b493 !important;
padding-right: 10px; padding-right: 10px;
} }
@ -96,17 +203,16 @@ function onProtocol(title) {
} }
.result { .result {
.user { .user {
margin-top: 20px; margin-top: 20px;
border: 1px solid #E7B493; border: 1px solid #e7b493;
border-radius: 30px; border-radius: 30px;
padding: 0 40rpx; padding: 0 40rpx;
.user-info { .user-info {
.nickname { .nickname {
font-size: 26rpx; font-size: 26rpx;
color: #E7B493; color: #e7b493;
} }
} }
@ -117,8 +223,21 @@ function onProtocol(title) {
} }
} }
} }
} }
.bottom {
position: absolute;
bottom: 20px;
width: calc(100% - 60rpx);
.share-btn {
height: 82rpx;
line-height: normal;
background: linear-gradient(-90deg, rgba(230, 179, 147, 1), rgba(250, 232, 218, 1));
border-radius: 28rpx;
font-size: 26rpx;
font-weight: 500;
}
}
} }
</style> </style>

View File

@ -63,10 +63,10 @@
import { computed, reactive } from 'vue' import { computed, reactive } from 'vue'
import { onLoad, onReachBottom } from '@dcloudio/uni-app' import { onLoad, onReachBottom } from '@dcloudio/uni-app'
import peach from '@/peach' import peach from '@/peach'
import dayjs from 'dayjs'
import _ from 'lodash' import _ from 'lodash'
import PayWalletApi from '@/peach/api/pay/wallet'
import { fen2yuan } from '@/peach/hooks/useGoods' import { fen2yuan } from '@/peach/hooks/useGoods'
import dayjs from 'dayjs'
import PayWalletApi from '@/peach/api/pay/wallet'
import { resetPagination } from '@/peach/utils' import { resetPagination } from '@/peach/utils'
const bgStyle = { const bgStyle = {

View File

@ -24,6 +24,23 @@ const UserUtil = {
method: 'GET', method: 'GET',
}) })
}, },
/**
* @author Ankkaya
* @description 用户列表
* @param {String} mobile - 手机号
* @param {String} nickname - 用户昵称
* @param {Number} pageNo - 页码
* @param {Number} pageSize - 每页条数
* @returns {Type}
*/
getUserList: (data) => {
return request({
url: '/particulars/point/page-member',
method: 'GET',
params: data,
})
},
} }
export default UserUtil export default UserUtil

28
peach/api/pay/point.js Normal file
View File

@ -0,0 +1,28 @@
import request from '@/peach/request'
const PointApi = {
/**
* @author Ankkaya
* @description 分发积分
* @param {String} memberId - 用户 id
* @param {Number} point - 积分
* @returns {Type}
*/
sendPoint: (data) => {
return request({
url: '/particulars/point/send-member',
method: 'post',
data,
})
},
getPointList: (data) => {
return request({
url: '/particulars/point/page-record',
method: 'get',
params: data,
})
},
}
export default PointApi

View File

@ -0,0 +1,114 @@
<!-- 全局 - 快捷入口 -->
<template>
<uni-popup
ref="popupRef"
type="top"
borderRadius="0 0 20px 20px"
backgroundColor="#F0F0F0"
@close="closeMenuTools"
@maskClick="closeMenuTools"
>
<pb-status-bar />
<view class="tools-wrap ss-m-x-30 ss-m-b-16">
<view class="title ss-m-b-34 ss-p-t-20">快捷菜单</view>
<view class="container-list ss-flex ss-flex-wrap">
<view class="list-item ss-m-b-24" v-for="item in list" :key="item.title">
<view class="ss-flex-col ss-col-center">
<button
class="ss-reset-button list-image ss-flex ss-row-center ss-col-center"
@tap="onClick(item)"
>
<image v-if="show" :src="peach.$url.static(item.icon, 'local')" class="list-icon" />
</button>
<view class="list-title ss-m-t-20">{{ item.title }}</view>
</view>
</view>
</view>
</view>
</uni-popup>
</template>
<script setup>
import { ref, watch, computed } from 'vue'
import peach from '@/peach'
import { closeMenuTools } from '@/peach/hooks/useModal'
const popupRef = ref()
const show = computed(() => peach.$store('modal').menu)
watch(show, (newVal) => {
if (newVal) {
popupRef.value.open()
} else {
popupRef.value.close()
}
})
function onClick(item) {
closeMenuTools()
if (item.url) peach.$router.redirect(item.url)
}
const list = [
{
url: '/pages/user/point/share',
icon: '/static/dispensecent.png',
title: '分发积分',
},
{
url: '/pages/user/point/buy',
icon: '/static/buycent.png',
title: '购买积分',
},
{
url: '/pages/user/wallet/withdraw',
icon: '/static/withdraw.png',
title: '余额提现',
},
]
</script>
<style lang="scss" scoped>
.tools-wrap {
// background: #F0F0F0;
// box-shadow: 0px 0px 28rpx 7rpx rgba(0, 0, 0, 0.13);
// opacity: 0.98;
// border-radius: 0 0 20rpx 20rpx;
.title {
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.list-item {
width: calc(25vw - 20rpx);
.list-image {
width: 104rpx;
height: 104rpx;
border-radius: 52rpx;
background: var(--ui-BG);
.list-icon {
width: 54rpx;
height: 54rpx;
}
}
.list-title {
font-size: 26rpx;
font-weight: 500;
color: #333333;
}
}
}
.uni-popup {
top: 0 !important;
}
:deep(.button-hover) {
background: #fafafa !important;
}
</style>

View File

@ -673,7 +673,34 @@ export function copyText(text) {
// #endif // #endif
} }
/**
* @desc 函数防抖
* @param func 目标函数
* @param wait 延迟执行毫秒数
* @param immediate true - 立即执行 false - 延迟执行
*/
export const debounce = function (func, wait = 1000, immediate = true) {
let timer
return function () {
let context = this,
args = arguments
if (timer) clearTimeout(timer)
if (immediate) {
let callNow = !timer
timer = setTimeout(() => {
timer = null
}, wait)
if (callNow) func.apply(context, args)
} else {
timer = setTimeout(() => {
func.apply(context, args)
}, wait)
}
}
}
export default { export default {
debounce,
range, range,
getPx, getPx,
sleep, sleep,

View File

@ -1,6 +1,42 @@
import share from './share' import share from './share'
import android from './provider/android'
const device = uni.getSystemInfoSync() const device = uni.getSystemInfoSync()
const os = device.platform
let name = ''
let provider = ''
let platform = ''
let isWechatInstalled = true
// #ifdef APP-PLUS
name = 'App'
platform = 'openPlatform'
// 检查微信客户端是否安装,否则 AppleStore 会因此拒绝上架
if (os === 'ios') {
provider = 'ios'
isWechatInstalled = plus.ios.import('WXApi').isWXapiInstalled()
} else {
provider = 'android'
}
// #endif
function useProvider() {
if (provider === 'android') {
return android
}
}
/**
* @author Ankkaya
* @description 检查更新
* @param {Type} -
* @returns {Type}
*/
function checkUpdate() {
useProvider().checkUpdate()
}
/** /**
* @author Ankkaya * @author Ankkaya
@ -68,6 +104,7 @@ const _platform = {
navBar, navBar,
capsule, capsule,
checkNetwork, checkNetwork,
checkUpdate,
} }
export default _platform export default _platform

View File

@ -0,0 +1,95 @@
const device = uni.getSystemInfoSync()
/**
* @author Ankkaya
* @description 检查更新
* @param {String} newVersion - 最新版本
* @returns {Type}
*/
function checkUpdate(newVersion) {
plus.runtime.getProperty(plus.runtime.appid, (wgtInfo) => {
if (String(device.platform).toLowerCase() === 'android') {
console.log(wgtInfo)
if (wgtInfo.version !== newVersion) {
uni.showModal({
title: '温馨提示',
content: '发现新版本APP您是否要升级体验?',
cancelText: '暂时忽略',
confirmText: '立即升级',
success: (action) => {
if (action.confirm) {
// 下载 app
downLoadApp()
} else {
// 忽略
}
},
})
}
}
})
}
function downLoadApp() {
let percent = 0
let downnUrl = import.meta.env.MALL_APP_DOWNLOAD_PATH
let dtask = plus.downloader.createDownload(downnUrl, {}, (d, status) => {
if (status == 200) {
let path = d.filename
plus.runtime.install(path, {}, () => {})
} else {
uni.showToast({
title: '下载失败',
icon: 'none',
})
}
})
try {
dtask.start()
let showLoading = plus.nativeUI.showWaiting('正在下载...')
dtask.addEventListener('statechanged', (download, status) => {
switch (download.state) {
case 1:
showLoading.setTitle('正在下载...')
break
case 2:
showLoading.setTitle('已连接到服务器')
break
case 3:
percent = parseInt((parseFloat(download.downloadedSize) / parseFloat(download.totalSize)) * 100)
showLoading.setTitle(`正在下载` + percent + '%')
break
case 4:
plus.nativeUI.closeWaiting()
break
}
})
} catch (e) {
plus.nativeUI.closeWaiting()
uni.showToast({
title: '更新失败!',
icon: 'none',
})
}
}
/**
* @author Ankkaya
* @description 本地版本
* @param {Type} -
* @returns {Type}
*/
function getVersion() {
let version = ''
plus.runtime.getProperty(plus.runtime.appid, (wgtInfo) => {
version = wgtInfo.version
})
return version
}
export default {
checkUpdate,
downLoadApp,
getVersion,
}

View File

@ -1,11 +1,24 @@
<template> <template>
<pb-fixed :noFixed="props.noFixed" :alway="props.alway" :bgStyles="props.bgStyles" :val="0" :index="props.zIndex" <pb-fixed
noNav :bg="props.bg" :ui="props.ui" :opacity="props.opacity" :placeholder="props.placeholder"> :noFixed="props.noFixed"
:alway="props.alway"
:bgStyles="props.bgStyles"
:val="0"
:index="props.zIndex"
noNav
:bg="props.bg"
:ui="props.ui"
:opacity="props.opacity"
:placeholder="props.placeholder"
>
<pb-status-bar /> <pb-status-bar />
<view class="ui-navbar-box"> <view class="ui-navbar-box">
<view class="ui-bar ss-p-x-20" :class="state.isDark ? 'text-white' : 'text-black'" <view
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"> class="ui-bar ss-p-x-20"
:class="state.isDark ? 'text-white' : 'text-black'"
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
>
<view v-if="leftIcon" class="icon-box ss-flex"> <view v-if="leftIcon" class="icon-box ss-flex">
<view class="icon-button icon-button-left ss-flex ss-row-center" @tap="onClickLeft"> <view class="icon-button icon-button-left ss-flex ss-row-center" @tap="onClickLeft">
<text class="sicon-back" v-if="hasHistory" /> <text class="sicon-back" v-if="hasHistory" />
@ -19,6 +32,12 @@
<slot name="center"> <slot name="center">
<view :style="{ color: themeColor }" class="center navbar-title">{{ title }}</view> <view :style="{ color: themeColor }" class="center navbar-title">{{ title }}</view>
</slot> </slot>
<!-- #ifndef MP -->
<view v-if="props.right" style="color: #fff" @tap="rightTap">
{{ props.right }}
</view>
<!-- #endif -->
<!-- #ifdef MP --> <!-- #ifdef MP -->
<view :style="[state.capsuleStyle]"></view> <view :style="[state.capsuleStyle]"></view>
<!-- #endif --> <!-- #endif -->
@ -44,7 +63,7 @@
* @param {Boolean} stopBack = false - 是否禁用返回 * @param {Boolean} stopBack = false - 是否禁用返回
* @param {Boolean} placeholder = true - 是否开启占位 * @param {Boolean} placeholder = true - 是否开启占位
* @param {Object} bgStyles = {} - 背景样式 * @param {Object} bgStyles = {} - 背景样式
* * @param {Boolean} right - 右侧显示内容
*/ */
import { computed, reactive, onBeforeMount, ref } from 'vue' import { computed, reactive, onBeforeMount, ref } from 'vue'
@ -84,7 +103,7 @@ const props = defineProps({
iconColor: { iconColor: {
type: String, type: String,
default: '#000' default: '#000',
}, },
title: { title: {
@ -130,7 +149,11 @@ const props = defineProps({
}, },
bgStyles: { bgStyles: {
type: Object, type: Object,
default() { }, default() {},
},
right: {
type: String,
default: null,
}, },
}) })
@ -165,6 +188,10 @@ function onClickRight() {
showMenuTools() showMenuTools()
} }
function rightTap() {
peach.$router.go('/pages/user/point/loglist')
}
// //
const init = () => { const init = () => {
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
@ -196,17 +223,17 @@ const init = () => {
.sicon-back { .sicon-back {
font-size: 32rpx; font-size: 32rpx;
color: v-bind(iconColor) color: v-bind(iconColor);
} }
.sicon-home { .sicon-home {
font-size: 32rpx; font-size: 32rpx;
color: v-bind(iconColor) color: v-bind(iconColor);
} }
.sicon-more { .sicon-more {
font-size: 32rpx; font-size: 32rpx;
color: v-bind(iconColor) color: v-bind(iconColor);
} }
.icon-button { .icon-button {
@ -343,7 +370,6 @@ const init = () => {
} }
&.isFristPage { &.isFristPage {
.capsule-back, .capsule-back,
&::after { &::after {
display: none; display: none;

View File

@ -2,12 +2,27 @@
<view class="page-app" :class="['theme-' + sys.mode, 'main-' + sys.theme, 'font-' + sys.fontSize]"> <view class="page-app" :class="['theme-' + sys.mode, 'main-' + sys.theme, 'font-' + sys.fontSize]">
<view class="page-main" :style="[bgMain]"> <view class="page-main" :style="[bgMain]">
<!-- 顶部导航栏-情况1默认通用顶部导航栏 --> <!-- 顶部导航栏-情况1默认通用顶部导航栏 -->
<pb-navbar v-if="navbar === 'normal'" :title="title" :leftIcon="leftIcon" statusBar :color="color" :tools="tools" <pb-navbar
:opacityBgUi="opacityBgUi" @search="(e) => emits('search', e)" :defaultSearch="defaultSearch" /> v-if="navbar === 'normal'"
:title="title"
:leftIcon="leftIcon"
statusBar
:color="color"
:tools="tools"
:opacityBgUi="opacityBgUi"
@search="(e) => emits('search', e)"
:defaultSearch="defaultSearch"
/>
<view class="page-body" :style="[bgBody]"> <view class="page-body" :style="[bgBody]">
<!-- 顶部导航栏-情况2沉浸式头部 --> <!-- 顶部导航栏-情况2沉浸式头部 -->
<pb-inner-navbar v-if="navbar === 'inner'" :iconColor="iconColor" :color="color" :title="title" <pb-inner-navbar
:leftIcon="leftIcon" /> v-if="navbar === 'inner'"
:iconColor="iconColor"
:color="color"
:right="props.right"
:title="title"
:leftIcon="leftIcon"
/>
<view v-if="navbar === 'inner'" :style="[{ paddingTop: peach.$platform.navBar + 'px' }]"></view> <view v-if="navbar === 'inner'" :style="[{ paddingTop: peach.$platform.navBar + 'px' }]"></view>
<!-- 页面内容插槽 --> <!-- 页面内容插槽 -->
@ -24,7 +39,7 @@
<!-- 全局分享弹窗 --> <!-- 全局分享弹窗 -->
<!-- <p-share-modal :shareInfo="shareInfo" /> --> <!-- <p-share-modal :shareInfo="shareInfo" /> -->
<!-- 全局快捷入口 --> <!-- 全局快捷入口 -->
<!-- <p-menu-tools /> --> <p-menu-tools />
</view> </view>
</view> </view>
</template> </template>
@ -109,8 +124,12 @@ const props = defineProps({
}, },
iconColor: { iconColor: {
type: String, type: String,
default: '#000' default: '#000',
} },
right: {
type: String,
default: null,
},
}) })
const emits = defineEmits(['search']) const emits = defineEmits(['search'])
@ -135,7 +154,7 @@ const bgMain = computed(() => {
background: `${props.bgStyle.backgroundColor} url(${peach.$url.static( background: `${props.bgStyle.backgroundColor} url(${peach.$url.static(
props.bgStyle.backgroundImage, props.bgStyle.backgroundImage,
props.bgStyle.imageType props.bgStyle.imageType
)}) no-repeat top center / 100% auto`, )}) no-repeat top center / 100% ${props.bgStyle.height || 'auto'}`,
} }
} }
return {} return {}

BIN
static/point.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB