feat(积分):积分管理
This commit is contained in:
parent
d5e3d34e0f
commit
5f257aaa63
3
.env
3
.env
|
@ -18,3 +18,6 @@ MALL_STATIC_URL = https://file.sheepjs.com
|
|||
|
||||
# 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启)
|
||||
MALL_MPLIVE_ON = 0
|
||||
|
||||
# APP 下载地址
|
||||
MALL_APP_DOWNLOAD_PATH = ''
|
|
@ -147,7 +147,8 @@
|
|||
{
|
||||
"path": "point/loglist",
|
||||
"style": {
|
||||
"navigationBarTitleText": "历史积分"
|
||||
"navigationBarTitleText": "历史积分",
|
||||
"enablePullDownRefresh": true
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<pb-layout navbar="inner" tabbar="/pages/index/index" :bgStyle="bgStyle">
|
||||
<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>
|
||||
|
||||
<view class="detail flex flex-column justify-center gap-10">
|
||||
|
@ -9,6 +10,10 @@
|
|||
<view class="description ss-font-26">{{ merchantInfo?.contactPhone }}</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="title ss-font-24 ss-m-b-20">
|
||||
|
@ -19,7 +24,7 @@
|
|||
<view class="unit self-start">¥</view>
|
||||
<view class="sincome ss-font-60">{{ state.statistic.todayPaymentAmount || 0 }}</view>
|
||||
</view>
|
||||
<button class="right-btn ss-reset-button">查看详情</button>
|
||||
<!-- <button class="right-btn ss-reset-button">查看详情</button> -->
|
||||
</view>
|
||||
<view class="des ss-m-t-20">
|
||||
总销售额 {{ state.statistic.totalSalesAmount }} 元 | 成功退款 {{ state.statistic.refundCount }} 笔 |
|
||||
|
@ -110,6 +115,14 @@ async function getStatistic() {
|
|||
state.value.more[3].value = res.data.deliveryOrderCount
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Ankkaya
|
||||
* @description 核销
|
||||
* @param {Type} -
|
||||
* @returns {Type}
|
||||
*/
|
||||
function checkVerifi() {}
|
||||
|
||||
onShow(() => {
|
||||
getStatistic()
|
||||
})
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
<template>
|
||||
<pb-layout navbar="inner" tabbar="/pages/index/my" :bgStyle="bgStyle">
|
||||
<view class="my-module ss-p-x-30">
|
||||
<view class="user-info flex align-center">
|
||||
<image class="avatar" :src="userInfo.avatar || '/static/default_avatar.png'" mode="aspectFill"></image>
|
||||
<view class="user-info flex align-center justify-between">
|
||||
<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="name ss-font-26">{{ userInfo.nickname }}</view>
|
||||
<view class="description ss-font-26">{{ userInfo.mobile }}</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="title ss-font-24 ss-m-b-20"> 账户余额 </view>
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
<template>
|
||||
<pb-layout navbar="inner" iconColor="#fff" class="buy-point-wrap" leftIcon="leftIcon" color="#fff" title="购买积分"
|
||||
:bgStyle="bgStyle">
|
||||
<pb-layout
|
||||
navbar="inner"
|
||||
iconColor="#fff"
|
||||
class="buy-point-wrap"
|
||||
leftIcon="leftIcon"
|
||||
color="#fff"
|
||||
title="购买积分"
|
||||
:bgStyle="bgStyle"
|
||||
>
|
||||
<view class="title ss-m-t-80">
|
||||
<view class="main">购买商城积分</view>
|
||||
<view class="sub ss-flex ss-row-center ss-m-t-55"><text style="color: #F3D3BF;"
|
||||
class="cicon-safe"></text>订单多多·出单多多<text style="color: #F3D3BF;" class="cicon-safe"></text></view>
|
||||
<view class="sub ss-flex ss-row-center ss-m-t-55"
|
||||
><text style="color: #f3d3bf" class="cicon-safe"></text>订单多多·出单多多<text
|
||||
style="color: #f3d3bf"
|
||||
class="cicon-safe"
|
||||
></text
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<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 }">
|
||||
<label class="radio ss-flex" @tap="onChange">
|
||||
<radio :checked="state.agreeStatus" color="rgba(243, 192, 156, 1)" style="transform: scale(0.8)"
|
||||
@tap.stop="onChange" />
|
||||
<radio
|
||||
: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="tcp-text" @tap.stop="onProtocol('积分须知')"> 《积分须知》 </view>
|
||||
</view>
|
||||
</label>
|
||||
</view>
|
||||
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
|
@ -44,16 +58,14 @@ const bgStyle = {
|
|||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
height: '100%',
|
||||
}
|
||||
|
||||
function onProtocol(title) {
|
||||
|
||||
}
|
||||
function onProtocol(title) {}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.buy-point-wrap {
|
||||
|
||||
.title {
|
||||
.main {
|
||||
font-size: 80rpx;
|
||||
|
@ -77,7 +89,7 @@ function onProtocol(title) {
|
|||
}
|
||||
|
||||
.title::before {
|
||||
content: "";
|
||||
content: '';
|
||||
display: block;
|
||||
width: 80px;
|
||||
position: relative;
|
||||
|
@ -87,7 +99,7 @@ function onProtocol(title) {
|
|||
}
|
||||
|
||||
.title::after {
|
||||
content: "";
|
||||
content: '';
|
||||
display: block;
|
||||
width: 80px;
|
||||
position: relative;
|
||||
|
@ -107,7 +119,6 @@ function onProtocol(title) {
|
|||
}
|
||||
|
||||
.combo {
|
||||
|
||||
.draw-btn {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
|
@ -125,14 +136,12 @@ function onProtocol(title) {
|
|||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #e7b493;
|
||||
border: 1px solid #E7B493;
|
||||
border: 1px solid #e7b493;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.agreement-box {
|
||||
|
||||
width: 100%;
|
||||
|
||||
.protocol-check {
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
<template>
|
||||
<pb-layout navbar="inner" iconColor="#fff" class="loglist-point-wrap" leftIcon="leftIcon" color="#fff" title="分发积分"
|
||||
:bgStyle="bgStyle">
|
||||
<pb-layout
|
||||
navbar="inner"
|
||||
iconColor="#fff"
|
||||
class="loglist-point-wrap"
|
||||
leftIcon="leftIcon"
|
||||
color="#fff"
|
||||
title="历史积分"
|
||||
:bgStyle="bgStyle"
|
||||
>
|
||||
<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-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="label">积分</view>
|
||||
<view class="date">{{ item.date }}</view>
|
||||
|
@ -18,8 +30,11 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus"
|
||||
:content-text="{ contentdown: '上拉加载更多' }" />
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{ contentdown: '上拉加载更多' }"
|
||||
/>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
|
@ -27,12 +42,13 @@
|
|||
import { ref } from 'vue'
|
||||
import { resetPagination } from '@/peach/utils'
|
||||
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
|
||||
import PointApi from '@/peach/api/pay/point'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: '/static/point.png',
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff'
|
||||
backgroundColor: '#fff',
|
||||
height: '100%',
|
||||
}
|
||||
|
||||
const state = ref({
|
||||
|
@ -42,13 +58,13 @@ const state = ref({
|
|||
{
|
||||
last: 50000,
|
||||
date: '2022-05-30',
|
||||
income: '+1000'
|
||||
income: '+1000',
|
||||
},
|
||||
{
|
||||
last: 50000,
|
||||
date: '2022-05-30',
|
||||
income: '-1000'
|
||||
}
|
||||
income: '-1000',
|
||||
},
|
||||
],
|
||||
total: 2,
|
||||
pageNo: 1,
|
||||
|
@ -57,7 +73,14 @@ const state = ref({
|
|||
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() {
|
||||
|
@ -81,20 +104,18 @@ onPullDownRefresh(() => {
|
|||
uni.stopPullDownRefresh()
|
||||
}, 800)
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.loglist-point-wrap {
|
||||
.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;
|
||||
padding-bottom: 30rpx;
|
||||
|
||||
.top,
|
||||
.bottom {
|
||||
color: #E7B493;
|
||||
color: #e7b493;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,37 +1,74 @@
|
|||
<template>
|
||||
<pb-layout navbar="inner" iconColor="#fff" class="share-point-wrap" leftIcon="leftIcon" color="#fff" title="分发积分"
|
||||
:bgStyle="bgStyle">
|
||||
<pb-layout
|
||||
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="main">分发积分</view>
|
||||
<view class="sub ss-flex ss-row-center ss-m-t-55"><text style="color: #F3D3BF;"
|
||||
class="cicon-safe"></text>订单多多·出单多多<text style="color: #F3D3BF;" class="cicon-safe"></text></view>
|
||||
<view class="sub ss-flex ss-row-center ss-m-t-55"
|
||||
><text style="color: #f3d3bf" class="cicon-safe"></text>订单多多·出单多多<text
|
||||
style="color: #f3d3bf"
|
||||
class="cicon-safe"
|
||||
></text
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<view class="user-search">
|
||||
<view class="search">
|
||||
<uni-easyinput :styles="{ backgroundColor: 'transparent', color: '#E7B493' }" placeholderStyle="color: #E7B493;"
|
||||
:clearable="false" :inputBorder="false" type="number" trim="all" suffixIcon="search" placeholder="请输入用户名" />
|
||||
<uni-easyinput
|
||||
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 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">
|
||||
<image style="width: 48rpx; height: 48rpx;" src="/static/default_avatar.png" />
|
||||
<view class="nickname">哈哈哈</view>
|
||||
<image
|
||||
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 class="input-point">
|
||||
<uni-easyinput :styles="{ backgroundColor: 'transparent', color: '#E7B493' }"
|
||||
:placeholderStyle="placeholderStyle" :clearable="false" :inputBorder="false" type="number" trim="all"
|
||||
placeholder="请输入积分额度" />
|
||||
<uni-easyinput
|
||||
:styles="{ backgroundColor: 'transparent', color: '#E7B493' }"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
v-model="item.point"
|
||||
:clearable="false"
|
||||
:inputBorder="false"
|
||||
@input="inputPointFunc(item)"
|
||||
type="number"
|
||||
trim="all"
|
||||
placeholder="请输入积分额度"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="ss-p-x-30 bottom">
|
||||
<button class="ss-reset-button share-btn" @tap="confirmShare">确定</button>
|
||||
</view>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import PointApi from '@/peach/api/pay/point'
|
||||
import UserUtil from '@/peach/api/member/user'
|
||||
import peach from '@/peach'
|
||||
|
||||
const placeholderStyle = ref('color: #E7B493')
|
||||
|
@ -40,10 +77,21 @@ const resultHeight = computed(() => {
|
|||
return `calc(100vh - 728rpx)`
|
||||
})
|
||||
|
||||
|
||||
const state = ref({
|
||||
inputData: '',
|
||||
userList: [],
|
||||
isShaking: false,
|
||||
agreeStatus: false,
|
||||
userParams: {
|
||||
mobile: '',
|
||||
nickname: '',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
pointParams: {
|
||||
memberId: '',
|
||||
point: '',
|
||||
},
|
||||
})
|
||||
|
||||
const bgStyle = {
|
||||
|
@ -51,16 +99,75 @@ const bgStyle = {
|
|||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.share-point-wrap {
|
||||
|
||||
.title {
|
||||
.main {
|
||||
font-size: 80rpx;
|
||||
|
@ -82,12 +189,12 @@ function onProtocol(title) {
|
|||
margin: 50rpx 40rpx 0;
|
||||
|
||||
.search {
|
||||
border: 1px solid #E7B493;
|
||||
border: 1px solid #e7b493;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
||||
:deep(.uniui-search) {
|
||||
color: #E7B493 !important;
|
||||
color: #e7b493 !important;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
|
@ -96,17 +203,16 @@ function onProtocol(title) {
|
|||
}
|
||||
|
||||
.result {
|
||||
|
||||
.user {
|
||||
margin-top: 20px;
|
||||
border: 1px solid #E7B493;
|
||||
border: 1px solid #e7b493;
|
||||
border-radius: 30px;
|
||||
padding: 0 40rpx;
|
||||
|
||||
.user-info {
|
||||
.nickname {
|
||||
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>
|
|
@ -63,10 +63,10 @@
|
|||
import { computed, reactive } from 'vue'
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
|
||||
import peach from '@/peach'
|
||||
import dayjs from 'dayjs'
|
||||
import _ from 'lodash'
|
||||
import PayWalletApi from '@/peach/api/pay/wallet'
|
||||
import { fen2yuan } from '@/peach/hooks/useGoods'
|
||||
import dayjs from 'dayjs'
|
||||
import PayWalletApi from '@/peach/api/pay/wallet'
|
||||
import { resetPagination } from '@/peach/utils'
|
||||
|
||||
const bgStyle = {
|
||||
|
|
|
@ -24,6 +24,23 @@ const UserUtil = {
|
|||
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
|
||||
|
|
|
@ -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
|
|
@ -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>
|
|
@ -673,7 +673,34 @@ export function copyText(text) {
|
|||
// #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 {
|
||||
debounce,
|
||||
range,
|
||||
getPx,
|
||||
sleep,
|
||||
|
|
|
@ -1,6 +1,42 @@
|
|||
import share from './share'
|
||||
import android from './provider/android'
|
||||
|
||||
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
|
||||
|
@ -68,6 +104,7 @@ const _platform = {
|
|||
navBar,
|
||||
capsule,
|
||||
checkNetwork,
|
||||
checkUpdate,
|
||||
}
|
||||
|
||||
export default _platform
|
||||
|
|
|
@ -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,
|
||||
}
|
|
@ -1,11 +1,24 @@
|
|||
<template>
|
||||
<pb-fixed :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-fixed
|
||||
: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 />
|
||||
|
||||
<view class="ui-navbar-box">
|
||||
<view class="ui-bar ss-p-x-20" :class="state.isDark ? 'text-white' : 'text-black'"
|
||||
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]">
|
||||
<view
|
||||
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 class="icon-button icon-button-left ss-flex ss-row-center" @tap="onClickLeft">
|
||||
<text class="sicon-back" v-if="hasHistory" />
|
||||
|
@ -19,6 +32,12 @@
|
|||
<slot name="center">
|
||||
<view :style="{ color: themeColor }" class="center navbar-title">{{ title }}</view>
|
||||
</slot>
|
||||
|
||||
<!-- #ifndef MP -->
|
||||
<view v-if="props.right" style="color: #fff" @tap="rightTap">
|
||||
{{ props.right }}
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<view :style="[state.capsuleStyle]"></view>
|
||||
<!-- #endif -->
|
||||
|
@ -44,7 +63,7 @@
|
|||
* @param {Boolean} stopBack = false - 是否禁用返回
|
||||
* @param {Boolean} placeholder = true - 是否开启占位
|
||||
* @param {Object} bgStyles = {} - 背景样式
|
||||
*
|
||||
* @param {Boolean} right - 右侧显示内容
|
||||
*/
|
||||
|
||||
import { computed, reactive, onBeforeMount, ref } from 'vue'
|
||||
|
@ -84,7 +103,7 @@ const props = defineProps({
|
|||
|
||||
iconColor: {
|
||||
type: String,
|
||||
default: '#000'
|
||||
default: '#000',
|
||||
},
|
||||
|
||||
title: {
|
||||
|
@ -130,7 +149,11 @@ const props = defineProps({
|
|||
},
|
||||
bgStyles: {
|
||||
type: Object,
|
||||
default() { },
|
||||
default() {},
|
||||
},
|
||||
right: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -165,6 +188,10 @@ function onClickRight() {
|
|||
showMenuTools()
|
||||
}
|
||||
|
||||
function rightTap() {
|
||||
peach.$router.go('/pages/user/point/loglist')
|
||||
}
|
||||
|
||||
// 初始化
|
||||
const init = () => {
|
||||
// #ifdef MP-ALIPAY
|
||||
|
@ -196,17 +223,17 @@ const init = () => {
|
|||
|
||||
.sicon-back {
|
||||
font-size: 32rpx;
|
||||
color: v-bind(iconColor)
|
||||
color: v-bind(iconColor);
|
||||
}
|
||||
|
||||
.sicon-home {
|
||||
font-size: 32rpx;
|
||||
color: v-bind(iconColor)
|
||||
color: v-bind(iconColor);
|
||||
}
|
||||
|
||||
.sicon-more {
|
||||
font-size: 32rpx;
|
||||
color: v-bind(iconColor)
|
||||
color: v-bind(iconColor);
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
|
@ -343,7 +370,6 @@ const init = () => {
|
|||
}
|
||||
|
||||
&.isFristPage {
|
||||
|
||||
.capsule-back,
|
||||
&::after {
|
||||
display: none;
|
||||
|
|
|
@ -2,12 +2,27 @@
|
|||
<view class="page-app" :class="['theme-' + sys.mode, 'main-' + sys.theme, 'font-' + sys.fontSize]">
|
||||
<view class="page-main" :style="[bgMain]">
|
||||
<!-- 顶部导航栏-情况1:默认通用顶部导航栏 -->
|
||||
<pb-navbar v-if="navbar === 'normal'" :title="title" :leftIcon="leftIcon" statusBar :color="color" :tools="tools"
|
||||
:opacityBgUi="opacityBgUi" @search="(e) => emits('search', e)" :defaultSearch="defaultSearch" />
|
||||
<pb-navbar
|
||||
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]">
|
||||
<!-- 顶部导航栏-情况2:沉浸式头部 -->
|
||||
<pb-inner-navbar v-if="navbar === 'inner'" :iconColor="iconColor" :color="color" :title="title"
|
||||
:leftIcon="leftIcon" />
|
||||
<pb-inner-navbar
|
||||
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>
|
||||
|
||||
<!-- 页面内容插槽 -->
|
||||
|
@ -24,7 +39,7 @@
|
|||
<!-- 全局分享弹窗 -->
|
||||
<!-- <p-share-modal :shareInfo="shareInfo" /> -->
|
||||
<!-- 全局快捷入口 -->
|
||||
<!-- <p-menu-tools /> -->
|
||||
<p-menu-tools />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -109,8 +124,12 @@ const props = defineProps({
|
|||
},
|
||||
iconColor: {
|
||||
type: String,
|
||||
default: '#000'
|
||||
}
|
||||
default: '#000',
|
||||
},
|
||||
right: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
})
|
||||
const emits = defineEmits(['search'])
|
||||
|
||||
|
@ -135,7 +154,7 @@ const bgMain = computed(() => {
|
|||
background: `${props.bgStyle.backgroundColor} url(${peach.$url.static(
|
||||
props.bgStyle.backgroundImage,
|
||||
props.bgStyle.imageType
|
||||
)}) no-repeat top center / 100% auto`,
|
||||
)}) no-repeat top center / 100% ${props.bgStyle.height || 'auto'}`,
|
||||
}
|
||||
}
|
||||
return {}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
Loading…
Reference in New Issue