优化营销中心霸王餐/超级会员分店限时

This commit is contained in:
gyq
2025-12-05 16:00:51 +08:00
parent b5719c3d0c
commit 6355534a15
6 changed files with 566 additions and 634 deletions

View File

@@ -65,7 +65,7 @@
</view> </view>
</view> </view>
<my-bottom-btn-group @cancel="cancel" @save="editFreeDing" isOpenPermission></my-bottom-btn-group> <my-bottom-btn-group @cancel="cancel" @save="editFreeDing" isOpenPermission></my-bottom-btn-group>
<my-marketing-mask name="霸王餐" v-if="isMarketShow(form)"></my-marketing-mask> <my-marketing-mask name="霸王餐" v-if="isMarketShow(configInfo, 'shopIdList', 'enable')"></my-marketing-mask>
</view> </view>
</template> </template>
@@ -74,6 +74,9 @@ import { onShow, onLoad } from '@dcloudio/uni-app';
import { reactive, ref, watch } from 'vue'; import { reactive, ref, watch } from 'vue';
import { isMainShop, isMarketShow } from '@/store/account'; import { isMainShop, isMarketShow } from '@/store/account';
import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js'; import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js';
const configInfo = ref({});
const form = reactive({ const form = reactive({
rechargeTimes: 2, rechargeTimes: 2,
rechargeThreshold: '', rechargeThreshold: '',
@@ -96,6 +99,7 @@ onShow(() => {
*/ */
const getlist = async () => { const getlist = async () => {
let res = await getFreeDing(); let res = await getFreeDing();
configInfo.value = res;
res.shopIdList = res.shopIdList || []; res.shopIdList = res.shopIdList || [];
Object.assign(form, res); Object.assign(form, res);
}; };

View File

@@ -78,7 +78,7 @@
@select="selectStatus" @select="selectStatus"
:show="showAction" :show="showAction"
></u-action-sheet> ></u-action-sheet>
<my-marketing-mask name="充值兑换码" v-if="isMarketShow(form)"></my-marketing-mask> <my-marketing-mask name="兑换码" v-if="isMarketShow(form)"></my-marketing-mask>
</view> </view>
</template> </template>

View File

@@ -1,6 +1,8 @@
<template> <template>
<view class="container"> <view class="container">
<my-header-card :options="{ name: '限时折扣', intro: '批量设置商品折扣', icon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/bc360b13e5734821a2de2f0494b72a8b.png' }"></my-header-card> <my-header-card
:options="{ name: '限时折扣', intro: '批量设置商品折扣', icon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/bc360b13e5734821a2de2f0494b72a8b.png' }"
></my-header-card>
<view class="list"> <view class="list">
<view class="item" v-for="item in tableData.list" :key="item.id"> <view class="item" v-for="item in tableData.list" :key="item.id">
<view class="head"> <view class="head">
@@ -49,7 +51,7 @@ import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import { limitTimeDiscountPage, limitTimeDiscountDel } from '@/http/api/market/index.js'; import { limitTimeDiscountPage, limitTimeDiscountDel } from '@/http/api/market/index.js';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { convertTimeFormat } from '@/utils/index.js'; import { convertTimeFormat } from '@/utils/index.js';
import {isMainShop} from "@/store/account.js"; import { isMainShop, isMarketShow } from '@/store/account.js';
// 去编辑 // 去编辑
function editorHandle(item) { function editorHandle(item) {
uni.setStorageSync('limitDiscountObj', item); uni.setStorageSync('limitDiscountObj', item);

View File

@@ -1,354 +1,329 @@
<template> <template>
<view class="box"> <view class="box">
<view class="u-m-t-32 container" style="padding-left: 0; padding-right: 0"> <view class="u-m-t-32 container" style="padding-left: 0; padding-right: 0">
<view class="x-padding"> <view class="x-padding">
<view class="u-flex u-row-between custome"> <view class="u-flex u-row-between custome">
<text class="font-bold color-333">提交生日/姓名</text> <text class="font-bold color-333">提交生日/姓名</text>
<up-radio-group v-model="form.isSubmitInfo" placement="row"> <up-radio-group v-model="form.isSubmitInfo" placement="row">
<up-radio :key="1" :name="1"> <up-radio :key="1" :name="1" :customStyle="radioStyle">
<template #label> <template #label>
<text> </text> <text></text>
</template> </template>
</up-radio> </up-radio>
<up-radio :key="0" :name="0"> <up-radio :key="0" :name="0" :customStyle="radioStyle">
<template #label> <template #label>
<text> </text> <text></text>
</template> </template>
</up-radio> </up-radio>
</up-radio-group> </up-radio-group>
</view> </view>
<view class="color-999 u-font-24 u-m-t-10" <view class="color-999 u-font-24 u-m-t-10">*成为会员前需提交生日姓名性别信息</view>
>*成为会员前需提交生日姓名性别信息</view </view>
> </view>
</view>
</view>
<view class="u-m-t-32 container" style="padding-left: 0; padding-right: 0"> <view class="u-m-t-32 container" style="padding-left: 0; padding-right: 0">
<view class="x-padding"> <view class="x-padding">
<view class="u-flex u-row-between custome"> <view class="u-flex u-row-between custome">
<text class="font-bold color-333">会员开通方式</text> <text class="font-bold color-333">会员开通方式</text>
<up-radio-group v-model="form.openType" placement="row"> <up-radio-group v-model="form.openType" placement="row">
<up-radio key="PAY" name="PAY"> <up-radio key="PAY" name="PAY" :customStyle="radioStyle">
<template #label> <template #label>
<text> 购买开通 </text> <text>购买开通</text>
</template> </template>
</up-radio> </up-radio>
<up-radio key="CONDITION" name="CONDITION"> <up-radio key="CONDITION" name="CONDITION" :customStyle="radioStyle">
<template #label> <template #label>
<text> 条件开通 </text> <text>条件开通</text>
</template> </template>
</up-radio> </up-radio>
</up-radio-group> </up-radio-group>
</view> </view>
<view class="u-m-t-24"> <view class="u-m-t-24">
<up-line></up-line> <up-line></up-line>
</view> </view>
<template v-if="form.openType == 'PAY'"> <template v-if="form.openType == 'PAY'">
<view <view class="u-flex u-row-between u-p-t-26" @click="go.to('PAGES_MARKET_SUPER_VIP_VIP_PLANS')">
class="u-flex u-row-between u-p-t-26" <text class="font-bold color-333">会员周期列表</text>
@click="go.to('PAGES_MARKET_SUPER_VIP_VIP_PLANS')" <view class="u-flex">
> <text class="u-font-24 color-main">去设置</text>
<text class="font-bold color-333">会员周期列表</text> <up-icon name="arrow-right" color="#318AFE"></up-icon>
<view class="u-flex"> </view>
<text class="u-font-24 color-main">去设置</text> </view>
<up-icon name="arrow-right" color="#318AFE"></up-icon> </template>
</view> <template v-if="form.openType == 'CONDITION'">
</view> <view class="u-flex u-row-between u-col-baseline u-m-t-32">
</template> <text class="font-bold color-333">成为会员条件</text>
<template v-if="form.openType == 'CONDITION'"> <view class="u-flex-1 u-p-l-32">
<view class="u-flex u-row-between u-col-baseline u-m-t-32"> <view v-for="(item, index) in conditionLists" :key="index">
<text class="font-bold color-333">成为会员条件</text> <up-checkbox usedAlone v-model:checked="item.checked">
<view class="u-flex-1 u-p-l-32"> <template #label>
<view v-for="(item, index) in conditionLists" :key="index"> <view>{{ item.label }}</view>
<up-checkbox usedAlone v-model:checked="item.checked"> </template>
<template #label> </up-checkbox>
<view> {{ item.label }} </view> <view class="u-m-t-24 u-m-b-24">
</template> <up-number-box
</up-checkbox> :inputWidth="100"
<view class="u-m-t-24 u-m-b-24"> :decimalLength="item.precision || 0"
<up-number-box v-if="item.label != '绑定手机号' && item.checked"
:inputWidth="100" v-model="item.value"
:decimalLength="item.precision || 0" :step="item.step"
v-if="item.label != '绑定手机号' && item.checked" :min="item.min || 0"
v-model="item.value" ></up-number-box>
:step="item.step" </view>
:min="item.min || 0" </view>
></up-number-box> </view>
</view> </view>
</view> </template>
</view> </view>
</view> </view>
</template> <view class="u-m-t-32 container">
</view> <view class="font-bold color-333 u-m-b-16">可用门店</view>
</view> <my-shop-select @shop-select="shopSelect" v-model:selShops="form.memberPriceShopIdList" v-model:useType="form.memberPriceShopType"></my-shop-select>
<view class="u-m-t-32 container"> </view>
<view class="font-bold color-333 u-m-b-16">可用门店</view>
<my-shop-select
@shop-select="shopSelect"
v-model:selShops="form.memberPriceShopIdList"
v-model:useType="form.memberPriceShopType"
></my-shop-select>
</view>
<view class="u-m-t-32 container"> <view class="u-m-t-32 container">
<view class="font-bold color-333 u-m-b-16">规则说明</view> <view class="font-bold color-333 u-m-b-16">规则说明</view>
<up-textarea <up-textarea v-model="form.remark" placeholder="请输入规则说明"></up-textarea>
v-model="form.remark" </view>
placeholder="请输入规则说明"
></up-textarea>
</view>
<view class="u-m-t-32 container"> <view class="u-m-t-32 container">
<view class="font-bold color-333">获取成长值升级</view> <view class="font-bold color-333">获取成长值升级</view>
<view class="u-m-t-6 color-999 u-font-24" <view class="u-m-t-6 color-999 u-font-24">*两个条件必选有一条是大于0的数值</view>
>*两个条件必选有一条是大于0的数值</view <view class="u-flex u-m-t-26 gap-20">
> <text>每消费1元获得成长值</text>
<view class="u-flex u-m-t-26 gap-20"> <up-number-box v-model="form.costReward" inputWidth="80" placeholder="请输入内容"></up-number-box>
<text>每消费1元获得成长值</text> </view>
<up-number-box <view class="u-flex u-m-t-26 gap-20">
v-model="form.costReward" <text>每充值1元获得成长值</text>
inputWidth="80" <up-number-box v-model="form.rechargeReward" inputWidth="80" placeholder="请输入内容"></up-number-box>
placeholder="请输入内容" </view>
></up-number-box> </view>
</view> <my-bottom-btn-group @save="save" @cancel="cancel"></my-bottom-btn-group>
<view class="u-flex u-m-t-26 gap-20"> </view>
<text>每充值1元获得成长值</text>
<up-number-box
v-model="form.rechargeReward"
inputWidth="80"
placeholder="请输入内容"
></up-number-box>
</view>
</view>
<my-bottom-btn-group @save="save" @cancel="cancel"></my-bottom-btn-group>
</view>
</template> </template>
<script setup> <script setup>
import { reactive, computed, onMounted, ref, inject, watch } from "vue"; import { reactive, computed, onMounted, ref, inject, watch } from 'vue';
import userTypes from "./user-types.vue"; import userTypes from './user-types.vue';
import { import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
onLoad, import go from '@/commons/utils/go.js';
onReady,
onShow, const radioStyle = ref({
onPageScroll, marginLeft: '14px'
onReachBottom, });
onBackPress,
} from "@dcloudio/uni-app";
import go from "@/commons/utils/go.js";
const conditionLists = ref([ const conditionLists = ref([
{ label: "绑定手机号", checked: false, code: "BIND_PHONE" }, { label: '绑定手机号', checked: false, code: 'BIND_PHONE' },
{ {
label: "订单达成指定次数", label: '订单达成指定次数',
checked: false, checked: false,
value: "", value: '',
code: "ORDER", code: 'ORDER',
step: 1, step: 1,
stepStrictly: true, stepStrictly: true,
min: 1, min: 1
}, },
{ {
label: "消费达到指定金额", label: '消费达到指定金额',
checked: false, checked: false,
value: "", value: '',
code: "COST_AMOUNT", code: 'COST_AMOUNT',
precision: 2, precision: 2,
min: 0.01, min: 0.01
}, },
{ {
label: "充值达到指定金额", label: '充值达到指定金额',
checked: false, checked: false,
value: "", value: '',
code: "RECHARGE_AMOUNT", code: 'RECHARGE_AMOUNT',
precision: 2, precision: 2,
min: 0.01, min: 0.01
}, }
]); ]);
const superVipStore = inject("superVipStore"); const superVipStore = inject('superVipStore');
//分销奖励次数 //分销奖励次数
const isLimitCount = ref(0); const isLimitCount = ref(0);
const isLimitCounts = [ const isLimitCounts = [
{ {
value: 0, value: 0,
label: "限制", label: '限制'
}, },
{ {
value: 1, value: 1,
label: "不限制", label: '不限制'
}, }
]; ];
//开通方式 //开通方式
const opentypes = [ const opentypes = [
{ {
value: "auto", value: 'auto',
label: "自动开通", label: '自动开通'
}, },
{ {
value: "manual", value: 'manual',
label: "手动开通", label: '手动开通'
}, },
{ {
value: "pay", value: 'pay',
label: "付费开通", label: '付费开通'
}, }
]; ];
const form = reactive({ const form = reactive({
isSubmitInfo: 1, isSubmitInfo: 1,
openType: "PAY", openType: 'PAY',
configList: [], configList: [],
memberPriceShopType: "ALL", memberPriceShopType: 'ALL',
remark: "", remark: '',
costReward: 0, costReward: 0,
rechargeReward: 0, rechargeReward: 0,
memberPriceShopIdList: [], memberPriceShopIdList: [],
isMemberPrice: 1, isMemberPrice: 1,
isOpen: 0, isOpen: 0
}); });
watch( watch(
() => isLimitCount.value, () => isLimitCount.value,
(newval) => { (newval) => {
if (newval) { if (newval) {
form.rewardCount = -1; form.rewardCount = -1;
} else { } else {
form.rewardCount = ""; form.rewardCount = '';
} }
} }
); );
async function save() { async function save() {
console.log(form); console.log(form);
const submitData = { const submitData = {
...form, ...form,
conditionList: conditionLists.value conditionList: conditionLists.value
.filter((v) => v.checked) .filter((v) => v.checked)
.map((v) => ({ .map((v) => ({
code: v.code, code: v.code,
value: v.value, value: v.value
})), }))
}; };
const res = await superVipStore.editConfig(submitData); const res = await superVipStore.editConfig(submitData);
uni.showToast({ uni.showToast({
title: "更新成功", title: '更新成功',
icon: "none", icon: 'none',
duration: 2000, duration: 2000
}); });
} }
function cancel() { function cancel() {
uni.navigateBack(); uni.navigateBack();
} }
watch( watch(
() => superVipStore.config, () => superVipStore.config,
(newval) => { (newval) => {
setForm(newval); setForm(newval);
} }
); );
function setForm(data) { function setForm(data) {
if (data.rewardCount == -1) { if (data.rewardCount == -1) {
isLimitCount.value = 1; isLimitCount.value = 1;
} }
console.log(data); console.log(data);
conditionLists.value = conditionLists.value.map((v) => { conditionLists.value = conditionLists.value.map((v) => {
const findItem = data.conditionList.find((cond) => cond.code == v.code); const findItem = data.conditionList.find((cond) => cond.code == v.code);
if (findItem) { if (findItem) {
v.value = findItem.value; v.value = findItem.value;
v.checked = true; v.checked = true;
} else { } else {
v.checked = false; v.checked = false;
} }
return v; return v;
}); });
Object.assign(form, data); Object.assign(form, data);
console.log(form); console.log(form);
} }
onMounted(() => { onMounted(() => {
setForm(superVipStore.config); setForm(superVipStore.config);
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.x-padding { .x-padding {
padding: 0 24rpx; padding: 0 24rpx;
} }
.text-tips { .text-tips {
color: #999999; color: #999999;
font-size: 14px; font-size: 14px;
padding: 0 28rpx; padding: 0 28rpx;
border-radius: 6rpx 0 0 6rpx; border-radius: 6rpx 0 0 6rpx;
border: 2rpx solid #d9d9d9; border: 2rpx solid #d9d9d9;
background-color: #f7f7fa; background-color: #f7f7fa;
line-height: 60rpx; line-height: 60rpx;
} }
.text-tips1 { .text-tips1 {
border-radius: 0 6rpx 6rpx 0; border-radius: 0 6rpx 6rpx 0;
} }
.gap-40 { .gap-40 {
gap: 40rpx; gap: 40rpx;
} }
.my-input { .my-input {
border: 2rpx solid #d9d9d9; border: 2rpx solid #d9d9d9;
height: 60rpx; height: 60rpx;
border-right: none; border-right: none;
width: 240rpx; width: 240rpx;
text-align: center; text-align: center;
padding: 0 2px; padding: 0 2px;
font-size: 14px; font-size: 14px;
} }
.box { .box {
padding: 0 28rpx; padding: 0 28rpx;
font-size: 28rpx; font-size: 28rpx;
} }
.container { .container {
background: #fff; background: #fff;
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
margin-top: 32rpx; margin-top: 32rpx;
border-radius: 16rpx; border-radius: 16rpx;
overflow: hidden; overflow: hidden;
} }
.add { .add {
padding: 8rpx 32rpx; padding: 8rpx 32rpx;
border-radius: 12rpx; border-radius: 12rpx;
background: #318afe; background: #318afe;
color: #ffffff; color: #ffffff;
font-size: 28rpx; font-size: 28rpx;
line-height: 56rpx; line-height: 56rpx;
margin: 0; margin: 0;
} }
.color-red { .color-red {
color: #ff2f2f; color: #ff2f2f;
} }
$height: 70rpx; $height: 70rpx;
.number-box { .number-box {
font-size: 28rpx; font-size: 28rpx;
padding: 0 26rpx; padding: 0 26rpx;
border-radius: 6rpx 0 0 6rpx; border-radius: 6rpx 0 0 6rpx;
border-top: 2rpx solid #d9d9d9; border-top: 2rpx solid #d9d9d9;
border-bottom: 2rpx solid #d9d9d9; border-bottom: 2rpx solid #d9d9d9;
border-left: 2rpx solid #d9d9d9; border-left: 2rpx solid #d9d9d9;
background: #fff; background: #fff;
box-sizing: border-box; box-sizing: border-box;
height: $height; height: $height;
flex: 1; flex: 1;
line-height: $height; line-height: $height;
} }
.unit { .unit {
display: flex; display: flex;
padding: 0 38rpx; padding: 0 38rpx;
height: $height; height: $height;
line-height: $height; line-height: $height;
align-items: center; align-items: center;
border-radius: 0 6rpx 6rpx 0; border-radius: 0 6rpx 6rpx 0;
border: 2rpx solid #d9d9d9; border: 2rpx solid #d9d9d9;
background: #f7f7fa; background: #f7f7fa;
font-size: 28rpx; font-size: 28rpx;
color: #999999; color: #999999;
} }
:deep(.custome .u-radio-group) { :deep(.custome .u-radio-group) {
justify-content: flex-end; justify-content: flex-end;
} }
</style> </style>

View File

@@ -1,447 +1,372 @@
<template> <template>
<view class="min-page u-font-28"> <view class="min-page u-font-28">
<up-sticky> <up-sticky>
<view class="bg-fff top"> <view class="bg-fff top">
<view class="bg-fff container u-flex u-m-b-48"> <view class="bg-fff container u-flex u-m-b-48">
<image <image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/member.png"></image>
style="width: 60rpx; height: 60rpx" <view class="u-flex-1 u-flex u-p-l-24">
src="/pageMarket/static/images/member.png" <view class="u-font-28 u-flex-1 u-p-r-4">
></image> <view class="color-333 font-bold">超级会员</view>
<view class="u-flex-1 u-flex u-p-l-24"> <view class="color-666 u-m-t-4 u-font-24">用户会员管理设置</view>
<view class="u-font-28 u-flex-1 u-p-r-4"> </view>
<view class="color-333 font-bold">超级会员</view> <up-switch v-model="superVipStore.config.isOpen" size="18" active-value="1" inactive-value="0" :disabled="isMainShop() ? false : true"></up-switch>
<view class="color-666 u-m-t-4 u-font-24">用户会员管理设置 </view> </view>
</view> </view>
<up-switch <my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
v-model="superVipStore.config.isOpen" <view v-if="active == 2" class="u-flex u-row-between u-m-t-32" style="gap: 58rpx">
size="18" <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
active-value="1" <up-icon name="search" size="18"></up-icon>
inactive-value="0" <input class="u-m-l-10 u-font-28" type="text" placeholder-class="color-999 u-font-28" placeholder="搜索关键词" v-model="keyWord" @blur="keyWordBlur" />
></up-switch> <up-icon v-if="keyWord" name="close" size="14" @click="clearKeyWord"></up-icon>
</view> </view>
</view> <view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true">
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs> <template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
<view <text class="u-font-20">
v-if="active == 2" {{ userComponentQuery.startTime }} -
class="u-flex u-row-between u-m-t-32" {{ userComponentQuery.endTime }}
style="gap: 58rpx" </text>
> <view @click.stop="clearTime">
<view class="u-flex-1 filter-box" style="border-radius: 100rpx"> <up-icon name="close" size="14"></up-icon>
<up-icon name="search" size="18"></up-icon> </view>
<input </template>
class="u-m-l-10 u-font-28" <template v-else>
type="text" <text class="color-999">请选择日期范围</text>
placeholder-class="color-999 u-font-28" <up-icon name="arrow-right" size="12"></up-icon>
placeholder="搜索关键词" </template>
v-model="keyWord" </view>
@blur="keyWordBlur" </view>
/>
<up-icon
v-if="keyWord"
name="close"
size="14"
@click="clearKeyWord"
></up-icon>
</view>
<view
class="u-flex-1 u-font-28 filter-box u-flex u-row-between"
@click="showTimeArea = true"
>
<template
v-if="userComponentQuery.startTime && userComponentQuery.endTime"
>
<text class="u-font-20">
{{ userComponentQuery.startTime }} -
{{ userComponentQuery.endTime }}
</text>
<view @click.stop="clearTime">
<up-icon name="close" size="14"></up-icon>
</view>
</template>
<template v-else>
<text class="color-999">请选择日期范围</text>
<up-icon name="arrow-right" size="12"></up-icon>
</template>
</view>
</view>
<view v-if="active == 2" class="u-flex u-p-l-32 u-p-r-32 u-m-t-32"> <view v-if="active == 2" class="u-flex u-p-l-32 u-p-r-32 u-m-t-32">
<view class="u-flex-1 u-text-center"> <view class="u-flex-1 u-text-center">
<view class="u-font-32 color-main font-bold">{{ <view class="u-font-32 color-main font-bold">{{ listRes.totalRow }}</view>
listRes.totalRow <view class="u-font-24 color-666 u-m-t-16">订单数</view>
}}</view> </view>
<view class="u-font-24 color-666 u-m-t-16">订单数</view> <view class="u-flex-1 u-text-center">
</view> <view class="u-font-32 color-main font-bold">{{ listRes.totalAmount }}</view>
<view class="u-flex-1 u-text-center"> <view class="u-font-24 color-666 u-m-t-16">订单金额</view>
<view class="u-font-32 color-main font-bold">{{ </view>
listRes.totalAmount </view>
}}</view> <view v-if="active == 3" class="u-flex u-m-t-32">
<view class="u-font-24 color-666 u-m-t-16">订单金额</view> <view class="u-flex-1 u-text-center">
</view> <view class="u-font-32 color-main font-bold">{{ listRes.successAmount }}</view>
</view> <view class="u-font-24 color-666 u-m-t-16">已入账金额</view>
<view v-if="active == 3" class="u-flex u-m-t-32"> </view>
<view class="u-flex-1 u-text-center"> <view class="u-flex-1 u-text-center">
<view class="u-font-32 color-main font-bold">{{ <view class="u-font-32 color-main font-bold">{{ listRes.pendingAmount || 0 }}</view>
listRes.successAmount <view class="u-font-24 color-666 u-m-t-16">待入账金额</view>
}}</view> </view>
<view class="u-font-24 color-666 u-m-t-16">已入账金额</view> <view class="u-flex-1 u-text-center">
</view> <view class="u-font-32 color-main font-bold">{{ listRes.balanceAmount }}</view>
<view class="u-flex-1 u-text-center"> <view class="u-font-24 color-666 u-m-t-16">
<view class="u-font-32 color-main font-bold">{{ <text>运营余额</text>
listRes.pendingAmount || 0 <text class="color-main" @click="go.to('PAGES_PAY')">充值{{ '>' }}</text>
}}</view> </view>
<view class="u-font-24 color-666 u-m-t-16">待入账金额</view> </view>
</view> </view>
<view class="u-flex-1 u-text-center"> </view>
<view class="u-font-32 color-main font-bold">{{ </up-sticky>
listRes.balanceAmount <configVue v-if="active == 0"></configVue>
}}</view> <vipLvList v-if="active == 1" :list="list" :isEnd="isEnd" @refresh="refresh"></vipLvList>
<view class="u-font-24 color-666 u-m-t-16">
<text>运营余额</text>
<text class="color-main" @click="go.to('PAGES_PAY')"
>充值{{ ">" }}</text
>
</view>
</view>
</view>
</view>
</up-sticky>
<configVue v-if="active == 0"></configVue>
<vipLvList
v-if="active == 1"
:list="list"
:isEnd="isEnd"
@refresh="refresh"
></vipLvList>
<openListVue <openListVue v-if="active == 2" :list="list" :isEnd="isEnd" @refresh="refresh"></openListVue>
v-if="active == 2" <fenxiaoMingxiVue v-if="active == 3" :list="list" :isEnd="isEnd" @refresh="refresh"></fenxiaoMingxiVue>
:list="list" <!-- 选择门店 -->
:isEnd="isEnd" <shopSelActionSheetVue @choose="chooseShop" v-model="showShopSelActionSheet" title="选择门店"></shopSelActionSheetVue>
@refresh="refresh"
></openListVue>
<fenxiaoMingxiVue
v-if="active == 3"
:list="list"
:isEnd="isEnd"
@refresh="refresh"
></fenxiaoMingxiVue>
<!-- 选择门店 -->
<shopSelActionSheetVue
@choose="chooseShop"
v-model="showShopSelActionSheet"
title="选择门店"
>
</shopSelActionSheetVue>
<dateAreaSel <dateAreaSel :show="showTimeArea" :minYear="2022" @close="showTimeArea = false" @confirm="confirmTimeArea"></dateAreaSel>
:show="showTimeArea"
:minYear="2022"
@close="showTimeArea = false"
@confirm="confirmTimeArea"
></dateAreaSel>
<!-- 分销明细状态 --> <!-- 分销明细状态 -->
<up-action-sheet <up-action-sheet :show="showActions" :actions="actions" @select="handleSelect" @close="showActions = false" cancel-text="取消"></up-action-sheet>
:show="showActions"
:actions="actions" <my-marketing-mask name="超级会员" v-if="isMarketShow(configInfo, 'memberPriceShopIdList', 'isOpen')"></my-marketing-mask>
@select="handleSelect" </view>
@close="showActions = false"
cancel-text="取消"
></up-action-sheet>
</view>
</template> </template>
<script setup> <script setup>
import { import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
onLoad, import go from '@/commons/utils/go.js';
onReady, import { ref, onMounted, watch, provide } from 'vue';
onShow, import * as consumeCashbackApi from '@/http/api/market/consumeCashback.js';
onPageScroll, import * as memberApi from '@/http/api/market/member.js';
onReachBottom, import configVue from './components/config.vue';
onBackPress, import shopSelActionSheetVue from '@/pageMarket/components/shop-sel-action-sheet.vue';
} from "@dcloudio/uni-app"; import dateAreaSel from '@/components/date-range-picker/date-range-picker.vue';
import go from "@/commons/utils/go.js"; import vipLvList from './components/vip-lv-list.vue';
import { ref, onMounted, watch, provide } from "vue"; import openListVue from './components/open-list.vue';
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js"; import fenxiaoMingxiVue from './components/fenxiao-mingxi.vue';
import * as memberApi from "@/http/api/market/member.js"; import { isMainShop, isMarketShow } from '@/store/account';
import configVue from "./components/config.vue";
import shopSelActionSheetVue from "@/pageMarket/components/shop-sel-action-sheet.vue";
import dateAreaSel from "@/components/date-range-picker/date-range-picker.vue";
import vipLvList from "./components/vip-lv-list.vue";
import openListVue from "./components/open-list.vue";
import fenxiaoMingxiVue from "./components/fenxiao-mingxi.vue";
import { useSuperVipStore } from "@/store/market.js"; import { useSuperVipStore } from '@/store/market.js';
import { reactive } from "vue"; import { reactive } from 'vue';
const actions = [ const actions = [
{ {
name: "全部", name: '全部',
value: "", value: ''
}, },
{ {
name: "已入账", name: '已入账',
value: "success", value: 'success'
}, },
{ {
name: "待入账", name: '待入账',
value: "pending", value: 'pending'
}, },
{ {
name: "已退款", name: '已退款',
value: "refund", value: 'refund'
}, }
]; ];
function clearKeyWord() { function clearKeyWord() {
keyWord.value = ""; keyWord.value = '';
userComponentQuery.user = ""; userComponentQuery.user = '';
} }
function clearTime() { function clearTime() {
userComponentQuery.startTime = ""; userComponentQuery.startTime = '';
userComponentQuery.endTime = ""; userComponentQuery.endTime = '';
} }
const selActions = ref(""); const selActions = ref('');
const showActions = ref(false); const showActions = ref(false);
function handleSelect(e) { function handleSelect(e) {
selActions.value = e; selActions.value = e;
} }
const superVipStore = useSuperVipStore(); const superVipStore = useSuperVipStore();
superVipStore.getConfig(); superVipStore.getConfig();
provide("superVipStore", superVipStore); provide('superVipStore', superVipStore);
provide("memberApi", memberApi); provide('memberApi', memberApi);
const showTimeArea = ref(false); const showTimeArea = ref(false);
function confirmTimeArea(e) { function confirmTimeArea(e) {
console.log(e); console.log(e);
userComponentQuery.startTime = e[0]; userComponentQuery.startTime = e[0];
userComponentQuery.endTime = e[1]; userComponentQuery.endTime = e[1];
} }
const tabs = [ const tabs = [
{ {
label: "会员基础设置", label: '会员基础设置',
value: "basic", value: 'basic'
}, },
{ {
label: "会员等级设置", label: '会员等级设置',
value: "user", value: 'user'
}, },
{ {
label: "购买会员订单", label: '购买会员订单',
value: "recoders", value: 'recoders'
}, }
]; ];
const keyWord = ref(""); const keyWord = ref('');
function keyWordBlur() { function keyWordBlur() {
userComponentQuery.user = keyWord.value; userComponentQuery.user = keyWord.value;
} }
const userComponentQuery = reactive({ const userComponentQuery = reactive({
user: "", user: '',
startTime: "", startTime: '',
endTime: "", endTime: ''
}); });
const form = ref({ const form = ref({
isOpen: 0, isOpen: 0
}); });
const list = ref([]); const list = ref([]);
const pageNum = ref(1); const pageNum = ref(1);
const isEnd = ref(false); const isEnd = ref(false);
const selShop = ref({ const selShop = ref({
shopId: "", shopId: '',
shopName: "", shopName: ''
}); });
const searchText = ref(""); const searchText = ref('');
function search() { function search() {
pageNum.value = 1; pageNum.value = 1;
getList(); getList();
} }
function chooseShop(e) { function chooseShop(e) {
selShop.value = e; selShop.value = e;
} }
watch( watch(
() => selShop.value.shopId, () => selShop.value.shopId,
(newval) => { (newval) => {
pageNum.value = 1; pageNum.value = 1;
getList(); getList();
} }
); );
watch( watch(
() => userComponentQuery, () => userComponentQuery,
(newval) => { (newval) => {
isEnd.value = false; isEnd.value = false;
pageNum.value = 1; pageNum.value = 1;
getList(); getList();
}, },
{ {
deep: true, deep: true
} }
); );
function refresh() { function refresh() {
isEnd.value = false; isEnd.value = false;
pageNum.value = 1; pageNum.value = 1;
getList(); getList();
} }
const listRes = ref({}); const listRes = ref({});
async function getList() { async function getList() {
let res = null; let res = null;
if (active.value == 1) { if (active.value == 1) {
//会员等级列表 //会员等级列表
res = await memberApi.levelList(); res = await memberApi.levelList();
if (res) { if (res) {
list.value = res || []; list.value = res || [];
isEnd.value = true; isEnd.value = true;
superVipStore.setVipLevelList(res || []); superVipStore.setVipLevelList(res || []);
} }
return; return;
} }
if (active.value == 2) { if (active.value == 2) {
//购买会员订单记录 //购买会员订单记录
res = await memberApi.orderList({ res = await memberApi.orderList({
page: pageNum.value, page: pageNum.value,
size: 10, size: 10,
key: userComponentQuery.user, key: userComponentQuery.user,
startTime: userComponentQuery.startTime startTime: userComponentQuery.startTime ? userComponentQuery.startTime + ' 00:00:00' : '',
? userComponentQuery.startTime + " 00:00:00" endTime: userComponentQuery.endTime ? userComponentQuery.endTime + ' 23:59:59' : ''
: "", });
endTime: userComponentQuery.endTime }
? userComponentQuery.endTime + " 23:59:59"
: "",
});
}
if (res) { if (res) {
listRes.value = res; listRes.value = res;
if (pageNum.value == 1) { if (pageNum.value == 1) {
list.value = res.records || []; list.value = res.records || [];
} else { } else {
list.value = [...list.value, ...(res.records || [])]; list.value = [...list.value, ...(res.records || [])];
} }
isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false; isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false;
console.log(isEnd.value); console.log(isEnd.value);
} }
} }
// 显示选择门店弹窗 // 显示选择门店弹窗
const showShopSelActionSheet = ref(false); const showShopSelActionSheet = ref(false);
function showShopSelActionSheetFun() { function showShopSelActionSheetFun() {
showShopSelActionSheet.value = true; showShopSelActionSheet.value = true;
} }
const active = ref(0); const active = ref(0);
watch( watch(
() => active.value, () => active.value,
(newval) => { (newval) => {
userComponentQuery.startTime = ""; userComponentQuery.startTime = '';
userComponentQuery.endTime = ""; userComponentQuery.endTime = '';
keyWord.value = ""; keyWord.value = '';
refresh(); refresh();
} }
); );
watch( watch(
() => selActions.value, () => selActions.value,
() => { () => {
refresh(); refresh();
} }
); );
onReachBottom(() => { onReachBottom(() => {
if (!isEnd.value) { if (!isEnd.value) {
pageNum.value++; pageNum.value++;
getList(); getList();
} }
}); });
watch( watch(
() => superVipStore.config.isOpen, () => superVipStore.config.isOpen,
() => { () => {
superVipStore.editConfig().then((res) => { superVipStore.editConfig().then((res) => {
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: "更新成功", title: '更新成功',
icon: "none", icon: 'none',
duration: 2000, duration: 2000
}); });
} }
}); });
} }
); );
onShow(() => { onShow(() => {
pageNum.value = 1; pageNum.value = 1;
getList(); getList();
});
const configInfo = ref({});
onLoad(async () => {
configInfo.value = await memberApi.getConfig();
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.min-page { .min-page {
background: #f7f7f7; background: #f7f7f7;
} }
.box { .box {
} }
.top { .top {
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
} }
.list { .list {
padding: 0 30rpx; padding: 0 30rpx;
.item { .item {
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
border-radius: 14rpx; border-radius: 14rpx;
background-color: #fff; background-color: #fff;
overflow: hidden; overflow: hidden;
} }
} }
.tag { .tag {
border-radius: 12rpx; border-radius: 12rpx;
padding: 8rpx 22rpx; padding: 8rpx 22rpx;
font-size: 28rpx; font-size: 28rpx;
&.success { &.success {
background-color: #edfff0; background-color: #edfff0;
color: #5bbc6d; color: #5bbc6d;
} }
&.end { &.end {
background-color: #f7f7f7; background-color: #f7f7f7;
color: #999; color: #999;
} }
} }
.my-btn { .my-btn {
font-size: 28rpx; font-size: 28rpx;
line-height: 36rpx; line-height: 36rpx;
padding: 8rpx 32rpx; padding: 8rpx 32rpx;
border-radius: 12rpx; border-radius: 12rpx;
margin: 0; margin: 0;
} }
.edit-btn { .edit-btn {
background: #e6f0ff; background: #e6f0ff;
color: $my-main-color; color: $my-main-color;
} }
.delete-btn { .delete-btn {
background: #ffe7e6; background: #ffe7e6;
color: #ff1c1c; color: #ff1c1c;
} }
.filter-box { .filter-box {
display: flex; display: flex;
padding: 8rpx 24rpx; padding: 8rpx 24rpx;
align-items: center; align-items: center;
border-radius: 8rpx; border-radius: 8rpx;
border: 2rpx solid #d9d9d9; border: 2rpx solid #d9d9d9;
background: #f7f7f7; background: #f7f7f7;
min-height: 62rpx; min-height: 62rpx;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>

View File

@@ -16,25 +16,51 @@ export const isMainShop = (shopId) => {
return false return false
} }
/**
* 判断值是否为 非null + 非空对象(纯对象)
* @param {any} obj 要检测的值
* @returns {boolean} true=非空对象false=否则
*/
function isNonEmptyObject(obj) {
// 第一步:排除 null/undefined
if (obj === null || obj === undefined) {
return false;
}
// 第二步:排除非纯对象(数组、函数、日期等)
if (Object.prototype.toString.call(obj) !== '[object Object]') {
return false;
}
// 第三步:判断是否为空对象(无自有可枚举属性)
for (const key in obj) {
// 只检测自有属性(排除原型链属性)
if (Object.prototype.hasOwnProperty.call(obj, key)) {
return true;
}
}
return false;
}
/** /**
* 主店在配置该功能时未选择分店 * 主店在配置该功能时未选择分店
* 判断分店是否显示活动信息 * 判断分店是否显示活动信息
* @param {Object} activit * @param {Object} activit
* 活动信息 * 活动信息
*/ */
export function isMarketShow(activit = null, key = 'shopIdList') { export function isMarketShow(activit = null, key = 'shopIdList', isEnableKey = 'isEnable') {
console.log('isMarketShow===', activit); console.log('isMarketShow.activit===', activit);
if (activit == null || !activit.id) return false if (!isNonEmptyObject(activit)) return false
let flag = false let flag = false
const shopInfo = uni.getStorageSync("shopInfo"); const shopInfo = uni.getStorageSync("shopInfo");
if (!shopInfo.isHeadShop && (!activit[key].some(item => item == shopInfo.id) || !activit.isEnable)) { if (!shopInfo.isHeadShop && (!activit[key].some(item => item == shopInfo.id) || !activit[isEnableKey])) {
flag = true flag = true
} else { } else {
flag = false flag = false
} }
console.log('isMarketShow===', flag); console.log('isMarketShow.flag===', flag);
return flag return flag
} }