用户积分修改,修改分销员筛选,修改超级会员订单列表检索

This commit is contained in:
2026-01-13 14:52:10 +08:00
parent 63896046a8
commit 0990e08201
11 changed files with 2416 additions and 2014 deletions

View File

@@ -0,0 +1,222 @@
<template>
<view>
<view class="box" @click.stop="openPopup">
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue||list.length==0">请选择用户</text>
<text class="u-font-28 color-333 u-p-r-16 u-line-1" v-else :style="{
maxWidth: maxWidth+'rpx'
}">{{returnLabel()}}</text>
<view class="icon ">
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
</view>
</view>
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
<view class="u-p-30">
<view class="font-bold color-333 u-font-32">选择用户</view>
<view class="u-m-t-24">
<up-search v-model="query.key" @clear="search" @custom="search" @search="search"></up-search>
</view>
<scroll-view scroll-with-animation :scroll-into-view="selId" class="scroll-view u-m-t-30"
scroll-y="true" style="max-height :60vh;" @scrolltolower="scrolltolower">
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.id" @click="itemClick(item)"
:id="'item_'+item.id" :class="{active:selItem&&selItem.id==item.id}">
<view class="checkbox">
<up-icon name="checkbox-mark" color="#fff"></up-icon>
</view>
<view class="u-flex-1">{{item.nickName}}/{{item.phone}}</view>
</view>
<template v-if="search.key!==''">
<up-empty v-if="list.length==0" text="未搜到相关用户"></up-empty>
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
</template>
<template v-else>
<up-empty v-if="list.length==0" text="暂无用户"></up-empty>
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
</template>
</scroll-view>
<view class="u-flex gap-20 u-m-t-30">
<view class="u-flex-1">
<my-button type="default" @click="close">取消</my-button>
</view>
<view class="u-flex-1">
<my-button type="primary" @click="submit">确定</my-button>
</view>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import {
computed,
onMounted,
reactive,
ref,
watch
} from 'vue';
import {
getShopUser
} from '@/http/api/market/index.js';
const customStyle = ref({
marginRight: '20px'
});
const show = ref(false);
let modelValue = defineModel('modelValue', {
default: '',
});
const props = defineProps({
maxWidth: {
default: 240
}
})
const selId = ref('')
function returnLabel() {
const findItem = list.value.find(v => v.id == modelValue.value)
if (findItem) {
return findItem.nickName + (findItem.phone ? ('/' + findItem.phone) : '')
}
return ''
}
const selItem = ref(null)
function itemClick(item) {
selItem.value = item
}
function returnShopName(id) {
const item = list.value.find((v) => v.id == id);
return item?.shopName || '';
}
function close() {
show.value = false;
}
const emits = defineEmits(['change'])
function submit() {
if (!selItem.value) {
return uni.showToast({
title: '请选择用户'
})
}
if (modelValue.value != selItem.value.id) {
modelValue.value=selItem.value.id
emits('change')
}else{
modelValue.value=selItem.value.id
}
show.value = false;
}
const list = ref([]);
function openPopup() {
selId.value = 'item_' + modelValue.value
init()
show.value = true;
}
const isEnd = ref(false)
const query = reactive({
page: 1,
size: 10,
key: ''
})
function search() {
isEnd.value = false
query.page = 1
selItem.value = null
init()
}
async function init() {
const res = await getShopUser(query);
if (res) {
isEnd.value = query.page >= res.totalPage * 1
if (query.page == 1) {
list.value = res.records
} else {
list.value.push(...res.records)
}
}
}
function scrolltolower() {
if (!isEnd.value) {
query.page++
init()
}
}
</script>
<style lang="scss">
.box {
border-radius: 8upx;
display: flex;
flex-direction: row;
align-items: top;
flex-wrap: wrap;
padding: 10rpx 24rpx;
border: 2rpx solid #e5e5e5;
position: relative;
.icon {
position: absolute;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
}
}
.shop-item {
padding: 4rpx 8rpx 4rpx 16rpx;
border-radius: 4rpx;
border: 2rpx solid #f0f0f0;
background-color: #f5f5f5;
margin-bottom: 16rpx;
margin-left: 16rpx;
}
.scroll-view {
.item {
border: 1px solid #eee;
padding: 20rpx;
border-radius: 12rpx;
&.active {
border-color: $my-main-color;
}
}
}
.checkbox {
margin-right: 10rpx;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
border-radius: 6rpx;
border: 1px solid #999;
}
.item {
&.active {
.checkbox {
background-color: $my-main-color;
border-color: $my-main-color;
}
}
}
</style>

View File

@@ -189,3 +189,12 @@ export function shopUserFlow(data) {
data data
}); });
} }
export function getShopUser(data) {
return request({
url: `account/admin/shopUser`,
method: 'get',
data
});
}

17
http/api/market/points.js Normal file
View File

@@ -0,0 +1,17 @@
import http from '@/http/http.js'
const request = http.request
const MARKET_URL = 'market'
const ORDER_URL = 'order'
/**
* 积分:配置:新增/更新
* @param {Object} data
*/
export function pointsConfig(data) {
return request({
url: MARKET_URL+`/admin/points/config`,
method: "GET",
data
})
}

View File

@@ -14,7 +14,7 @@ import storageManage from '@/commons/utils/storageManage.js'
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { reject } from 'lodash'; import { reject } from 'lodash';
let baseUrl = appConfig.returnBaseUrl({apiType:'php'}); let baseUrl = appConfig.returnBaseUrl({apiType:'java'});
const loadingShowTime = 200 const loadingShowTime = 200
function getHeader(){ function getHeader(){

View File

@@ -0,0 +1,219 @@
<template>
<view>
<view class="box" @click.stop="openPopup">
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue||list.length==0">请选择用户</text>
<text class="u-font-28 color-333 u-p-r-16 u-line-1" v-else :style="{
maxWidth: maxWidth+'rpx'
}">{{returnLabel()}}</text>
<view class="icon ">
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
</view>
</view>
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
<view class="u-p-30">
<view class="font-bold color-333 u-font-32">选择用户</view>
<view class="u-m-t-24">
<up-search v-model="query.key" @clear="search" @custom="search" @search="search"></up-search>
</view>
<scroll-view scroll-with-animation :scroll-into-view="selId" class="scroll-view u-m-t-30"
scroll-y="true" style="max-height :60vh;" @scrolltolower="scrolltolower">
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.id" @click="itemClick(item)"
:id="'item_'+item.id" :class="{active:selItem&&selItem.id==item.id}">
<view class="checkbox">
<up-icon name="checkbox-mark" color="#fff"></up-icon>
</view>
<view class="u-flex-1">{{item.nickName}}/{{item.phone}}</view>
</view>
<template v-if="search.key!==''">
<up-empty v-if="list.length==0" text="未搜到相关用户"></up-empty>
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
</template>
<template v-else>
<up-empty v-if="list.length==0" text="暂无用户"></up-empty>
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
</template>
</scroll-view>
<view class="u-flex gap-20 u-m-t-30">
<view class="u-flex-1">
<my-button type="default" @click="close">取消</my-button>
</view>
<view class="u-flex-1">
<my-button type="primary" @click="submit">确定</my-button>
</view>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import {
computed,
onMounted,
reactive,
ref,
watch
} from 'vue';
import {
getShopUser
} from '@/http/api/market/index.js';
const customStyle = ref({
marginRight: '20px'
});
const show = ref(false);
let modelValue = defineModel('modelValue', {
default: '',
});
const props=defineProps({
maxWidth:{
default:240
}
})
const selId = ref('')
function returnLabel() {
const findItem = list.value.find(v => v.id == modelValue.value)
if(findItem){
return findItem.nickName+(findItem.phone?('/'+findItem.phone):'')
}
return ''
}
const selItem=ref(null)
function itemClick(item) {
selItem.value=item
}
function returnShopName(id) {
const item = list.value.find((v) => v.id == id);
return item?.shopName || '';
}
function close() {
show.value = false;
}
const emits=defineEmits(['change'])
function submit() {
if(!selItem.value){
return uni.showToast({
title:'请选择用户'
})
}
modelValue.value = selItem.value.id
if(modelValue.value!=selItem.value.id){
emits('change')
}
show.value = false;
}
const list = ref([]);
function openPopup() {
selId.value = 'item_' + modelValue.value
init()
show.value = true;
}
const isEnd = ref(false)
const query = reactive({
page: 1,
size: 10,
key: ''
})
function search() {
isEnd.value = false
query.page = 1
selItem.value=null
init()
}
async function init() {
const res = await getShopUser(query);
if (res) {
isEnd.value = query.page >= res.totalPage * 1
if (query.page == 1) {
list.value = res.records
} else {
list.value.push(...res.records)
}
}
}
function scrolltolower() {
if (!isEnd.value) {
query.page++
init()
}
}
</script>
<style lang="scss">
.box {
border-radius: 8upx;
display: flex;
flex-direction: row;
align-items: top;
flex-wrap: wrap;
padding: 10rpx 24rpx;
border: 2rpx solid #e5e5e5;
position: relative;
.icon {
position: absolute;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
}
}
.shop-item {
padding: 4rpx 8rpx 4rpx 16rpx;
border-radius: 4rpx;
border: 2rpx solid #f0f0f0;
background-color: #f5f5f5;
margin-bottom: 16rpx;
margin-left: 16rpx;
}
.scroll-view {
.item {
border: 1px solid #eee;
padding: 20rpx;
border-radius: 12rpx;
&.active {
border-color: $my-main-color;
}
}
}
.checkbox {
margin-right: 10rpx;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
border-radius: 6rpx;
border: 1px solid #999;
}
.item {
&.active {
.checkbox {
background-color: $my-main-color;
border-color: $my-main-color;
}
}
}
</style>

View File

@@ -1,34 +1,25 @@
<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/distribution.png"></image>
style="width: 60rpx; height: 60rpx" <view class="u-flex-1 u-flex u-p-l-24">
src="/pageMarket/static/images/distribution.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 class="u-font-28 u-flex-1 u-p-r-4"> </view>
<view class="color-333 font-bold">分销</view> </view>
<view class="color-666 u-m-t-4 u-font-24" <up-switch v-model="distributionStore.config.isEnable" size="18" :active-value="1"
>用户成为业务员可促进消费 :inactive-value="0"></up-switch>
</view> </view>
</view> </view>
<up-switch <my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
v-model="distributionStore.config.isEnable" <view v-if="active == 1 || active == 2" class="u-flex u-row-between u-m-t-32" style="gap: 58rpx">
size="18" <view class="u-flex-1">
:active-value="1" <fenXiaoUserSelect v-model="userId" @change="getList()" />
:inactive-value="0" </view>
></up-switch> <!-- <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
</view>
</view>
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
<view
v-if="active == 1 || active == 2"
class="u-flex u-row-between u-m-t-32"
style="gap: 58rpx"
>
<view class="u-flex-1 filter-box" style="border-radius: 100rpx">
<up-icon name="search" size="18"></up-icon> <up-icon name="search" size="18"></up-icon>
<input <input
class="u-m-l-10 u-font-28" class="u-m-l-10 u-font-28"
@@ -39,476 +30,439 @@
@blur="keyWordBlur" @blur="keyWordBlur"
/> />
<up-icon v-if="keyWord" name="close" size="14" @click="clearKeyWord"></up-icon> <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">
class="u-flex-1 u-font-28 filter-box u-flex u-row-between" <template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
@click="showTimeArea = true" <text class="u-font-20">
> {{ userComponentQuery.startTime }} -
<template {{ userComponentQuery.endTime }}
v-if="userComponentQuery.startTime && userComponentQuery.endTime" </text>
> <view @click.stop="clearTime">
<text class="u-font-20"> <up-icon name="close" size="14"></up-icon>
{{ userComponentQuery.startTime }} - </view>
{{ userComponentQuery.endTime }} </template>
</text> <template v-else>
<view @click.stop="clearTime"> <text class="color-999">请选择日期范围</text>
<up-icon name="close" size="14"></up-icon> <up-icon name="arrow-right" size="12"></up-icon>
</view> </template>
</template> </view>
<template v-else> </view>
<text class="color-999">请选择日期范围</text> <view v-if="active == 3" class="u-flex u-row-between u-m-t-32" style="gap: 30rpx">
<up-icon name="arrow-right" size="12"></up-icon> <view class="u-font-28 filter-box u-flex u-row-between" @click="showActions = true">
</template> <template v-if="selActions && selActions.value">
</view> <text class="u-font-28 u-m-r-10">{{ selActions.name }} </text>
</view> </template>
<view <template v-else>
v-if="active == 3" <text class="color-999 u-m-r-10">全部</text>
class="u-flex u-row-between u-m-t-32" </template>
style="gap: 30rpx" <up-icon name="arrow-down" size="12"></up-icon>
> </view>
<view <view class="u-flex-1">
class="u-font-28 filter-box u-flex u-row-between" <fenXiaoUserSelect v-model="userId" :maxWidth="200" @change="getList()" />
@click="showActions = true" </view>
> <!-- <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
<template v-if="selActions && selActions.value"> <up-icon name="search" size="18"></up-icon>
<text class="u-font-28 u-m-r-10">{{ selActions.name }} </text> <input class="u-m-l-10 u-font-28" type="text" placeholder-class="color-999 u-font-28"
</template> placeholder="分销员昵称/手机号" v-model="keyWord" @blur="keyWordBlur" />
<template v-else> </view> -->
<text class="color-999 u-m-r-10">全部</text> <view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true">
</template> <template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
<up-icon name="arrow-down" size="12"></up-icon> <text class="u-font-20">
</view> {{ userComponentQuery.startTime }} -
<view class="u-flex-1 filter-box" style="border-radius: 100rpx"> {{ userComponentQuery.endTime }}
<up-icon name="search" size="18"></up-icon> </text>
<input <view @click.stop="clearTime">
class="u-m-l-10 u-font-28" <up-icon name="close" size="14"></up-icon>
type="text" </view>
placeholder-class="color-999 u-font-28" </template>
placeholder="分销员昵称/手机号" <template v-else>
v-model="keyWord" <text class="color-999">请选择日期</text>
@blur="keyWordBlur" <up-icon name="arrow-right" size="12"></up-icon>
/> </template>
</view> </view>
<view </view>
class="u-flex-1 u-font-28 filter-box u-flex u-row-between" <view v-if="active == 2" class="u-flex u-p-l-32 u-p-r-32 u-m-t-32">
@click="showTimeArea = true" <view class="u-flex-1 u-text-center">
> <view class="u-font-32 color-main font-bold">{{
<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 class="u-flex-1 u-text-center">
<view class="u-font-32 color-main font-bold">{{
listRes.totalCount listRes.totalCount
}}</view> }}</view>
<view class="u-font-24 color-666 u-m-t-16">支付开通人数</view> <view class="u-font-24 color-666 u-m-t-16">支付开通人数</view>
</view> </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.totalAmount listRes.totalAmount
}}</view> }}</view>
<view class="u-font-24 color-666 u-m-t-16">已支付金额</view> <view class="u-font-24 color-666 u-m-t-16">已支付金额</view>
</view> </view>
</view> </view>
<view v-if="active == 3" class="u-flex u-m-t-32"> <view v-if="active == 3" class="u-flex 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.successAmount listRes.successAmount
}}</view> }}</view>
<view class="u-font-24 color-666 u-m-t-16">已入账金额</view> <view class="u-font-24 color-666 u-m-t-16">已入账金额</view>
</view> </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 listRes.pendingAmount || 0
}}</view> }}</view>
<view class="u-font-24 color-666 u-m-t-16">待入账金额</view> <view class="u-font-24 color-666 u-m-t-16">待入账金额</view>
</view> </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.balanceAmount listRes.balanceAmount
}}</view> }}</view>
<view class="u-font-24 color-666 u-m-t-16"> <view class="u-font-24 color-666 u-m-t-16">
<text>运营余额</text> <text>运营余额</text>
<text class="color-main" @click="go.to('PAGES_PAY')" <text class="color-main" @click="go.to('PAGES_PAY')">充值{{ ">" }}</text>
>充值{{ ">" }}</text </view>
> </view>
</view> </view>
</view> </view>
</view> </up-sticky>
</view> <configVue v-if="active == 0"></configVue>
</up-sticky> <fenxiaoUserListVue v-if="active == 1" :list="list" :isEnd="isEnd" @refresh="refresh"></fenxiaoUserListVue>
<configVue v-if="active == 0"></configVue>
<fenxiaoUserListVue
v-if="active == 1"
:list="list"
:isEnd="isEnd"
@refresh="refresh"
></fenxiaoUserListVue>
<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="选择门店">
@refresh="refresh" </shopSelActionSheetVue>
></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">
:show="showTimeArea" </dateAreaSel>
:minYear="2022"
@close="showTimeArea = false"
@confirm="confirmTimeArea"
></dateAreaSel>
<!-- 分销明细状态 --> <!-- 分销明细状态 -->
<up-action-sheet <up-action-sheet :show="showActions" :actions="actions" @select="handleSelect" @close="showActions = false"
:show="showActions" cancel-text="取消"></up-action-sheet>
:actions="actions" </view>
@select="handleSelect"
@close="showActions = false"
cancel-text="取消"
></up-action-sheet>
</view>
</template> </template>
<script setup> <script setup>
import { import {
onLoad, onLoad,
onReady, onReady,
onShow, onShow,
onPageScroll, onPageScroll,
onReachBottom, onReachBottom,
onBackPress, onBackPress,
} from "@dcloudio/uni-app"; } from "@dcloudio/uni-app";
import go from "@/commons/utils/go.js"; import go from "@/commons/utils/go.js";
import { ref, onMounted, watch, provide } from "vue"; import {
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js"; ref,
import * as distributionApi from "@/http/api/market/distribution.js"; onMounted,
import configVue from "./components/config.vue"; watch,
import shopSelActionSheetVue from "@/pageMarket/components/shop-sel-action-sheet.vue"; provide
import dateAreaSel from "@/components/date-range-picker/date-range-picker.vue"; } from "vue";
import fenxiaoUserListVue from "./components/fenxiao-user-list.vue"; import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
import openListVue from "./components/open-list.vue"; import * as distributionApi from "@/http/api/market/distribution.js";
import fenxiaoMingxiVue from "./components/fenxiao-mingxi.vue"; import fenXiaoUserSelect from './components/fenxiao-user-select.vue'
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 fenxiaoUserListVue from "./components/fenxiao-user-list.vue";
import openListVue from "./components/open-list.vue";
import fenxiaoMingxiVue from "./components/fenxiao-mingxi.vue";
import { useDistributionStore } from "@/store/market.js"; import {
import { reactive } from "vue"; useDistributionStore
} from "@/store/market.js";
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() {
keyWord.value = "";
userComponentQuery.user = "";
}
function clearTime() {
userComponentQuery.startTime = "";
userComponentQuery.endTime = "";
}
const selActions = ref("");
const showActions = ref(false);
function handleSelect(e) {
selActions.value = e;
}
const distributionStore = useDistributionStore();
distributionStore.getConfig();
provide("distributionStore", distributionStore);
provide("distributionApi", distributionApi);
const showTimeArea = ref(false);
function confirmTimeArea(e) {
console.log(e);
userComponentQuery.startTime = e[0];
userComponentQuery.endTime = e[1];
}
const tabs = [
{
label: "基础设置",
value: "basic",
},
{
label: "分销员",
value: "user",
},
{
label: "开通记录",
value: "recoders",
},
{
label: "分销明细",
value: "details",
},
];
const keyWord = ref(""); const userId = ref('')
function keyWordBlur() {
userComponentQuery.user = keyWord.value;
}
const userComponentQuery = reactive({
user: "",
startTime: "",
endTime: "",
});
const form = ref({ function clearKeyWord() {
isEnable: 0, keyWord.value = "";
}); userComponentQuery.user = "";
}
const list = ref([]); function clearTime() {
const pageNum = ref(1); userComponentQuery.startTime = "";
const isEnd = ref(false); userComponentQuery.endTime = "";
const selShop = ref({ }
shopId: "", const selActions = ref("");
shopName: "", const showActions = ref(false);
});
const searchText = ref("");
function search() { function handleSelect(e) {
pageNum.value = 1; selActions.value = e;
getList(); }
}
function chooseShop(e) { const distributionStore = useDistributionStore();
selShop.value = e; distributionStore.getConfig();
} provide("distributionStore", distributionStore);
provide("distributionApi", distributionApi);
const showTimeArea = ref(false);
watch( function confirmTimeArea(e) {
() => selShop.value.shopId, console.log(e);
(newval) => { userComponentQuery.startTime = e[0];
pageNum.value = 1; userComponentQuery.endTime = e[1];
getList(); }
} const tabs = [{
); label: "基础设置",
value: "basic",
},
{
label: "分销员",
value: "user",
},
{
label: "开通记录",
value: "recoders",
},
{
label: "分销明细",
value: "details",
},
];
watch( const keyWord = ref("");
() => userComponentQuery,
(newval) => {
isEnd.value = false;
pageNum.value = 1;
getList(); function keyWordBlur() {
}, userComponentQuery.user = keyWord.value;
{ }
deep: true, const userComponentQuery = reactive({
} user: "",
); startTime: "",
endTime: "",
});
function refresh() { const form = ref({
isEnd.value = false; isEnable: 0,
pageNum.value = 1; });
getList();
}
const listRes = ref({}); const list = ref([]);
async function getList() { const pageNum = ref(1);
let res = null; const isEnd = ref(false);
if (active.value == 1) { const selShop = ref({
//分销员列表 shopId: "",
res = await distributionApi.distributionUser({ shopName: "",
page: pageNum.value, });
size: 10, const searchText = ref("");
user: userComponentQuery.user,
startTime: userComponentQuery.startTime
? userComponentQuery.startTime + " 00:00:00"
: "",
endTime: userComponentQuery.endTime
? userComponentQuery.endTime + " 23:59:59"
: "",
});
}
if (active.value == 2) {
//开通记录
res = await distributionApi.openFlow({
page: pageNum.value,
size: 10,
key: userComponentQuery.user,
startTime: userComponentQuery.startTime
? userComponentQuery.startTime + " 00:00:00"
: "",
endTime: userComponentQuery.endTime
? userComponentQuery.endTime + " 23:59:59"
: "",
});
}
if (active.value == 3) {
//分销明细
res = await distributionApi.distributionFlow({
page: pageNum.value,
size: 10,
key: userComponentQuery.user,
status: selActions.value?.value || "",
startTime: userComponentQuery.startTime
? userComponentQuery.startTime + " 00:00:00"
: "",
endTime: userComponentQuery.endTime
? userComponentQuery.endTime + " 23:59:59"
: "",
});
}
if (res) {
listRes.value = res;
if (pageNum.value == 1) {
list.value = res.records || [];
} else {
list.value = [...list.value, ...(res.records || [])];
}
isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false;
console.log(isEnd.value);
}
}
// 显示选择门店弹窗 function search() {
const showShopSelActionSheet = ref(false); pageNum.value = 1;
getList();
}
function showShopSelActionSheetFun() { function chooseShop(e) {
showShopSelActionSheet.value = true; selShop.value = e;
} }
const active = ref(0);
watch(
() => active.value,
(newval) => {
userComponentQuery.startTime = "";
userComponentQuery.endTime = "";
keyWord.value = "";
console.log(newval);
pageNum.value = 1;
getList();
}
);
watch(
() => active.value,
(newval) => {
refresh(); watch(
} () => selShop.value.shopId,
); (newval) => {
watch( pageNum.value = 1;
() => selActions.value, getList();
() => { }
refresh(); );
}
); watch(
onReachBottom(() => { () => userComponentQuery,
if (!isEnd.value) { (newval) => {
pageNum.value++; isEnd.value = false;
getList(); pageNum.value = 1;
}
}); getList();
watch( }, {
() => distributionStore.config.isEnable, deep: true,
() => { }
distributionStore.editConfig(); );
}
); function refresh() {
onShow(() => { isEnd.value = false;
pageNum.value = 1; pageNum.value = 1;
getList(); getList();
}); }
const listRes = ref({});
async function getList() {
let res = null;
if (active.value == 1) {
//分销员列表
res = await distributionApi.distributionUser({
page: pageNum.value,
size: 10,
user: userComponentQuery.user,
id:userId.value,
startTime: userComponentQuery.startTime ?
userComponentQuery.startTime + " 00:00:00" : "",
endTime: userComponentQuery.endTime ?
userComponentQuery.endTime + " 23:59:59" : "",
});
}
if (active.value == 2) {
//开通记录
res = await distributionApi.openFlow({
page: pageNum.value,
size: 10,
id:userId.value,
key: userComponentQuery.user,
startTime: userComponentQuery.startTime ?
userComponentQuery.startTime + " 00:00:00" : "",
endTime: userComponentQuery.endTime ?
userComponentQuery.endTime + " 23:59:59" : "",
});
}
if (active.value == 3) {
//分销明细
res = await distributionApi.distributionFlow({
page: pageNum.value,
size: 10,
id:userId.value,
key: userComponentQuery.user,
status: selActions.value?.value || "",
startTime: userComponentQuery.startTime ?
userComponentQuery.startTime + " 00:00:00" : "",
endTime: userComponentQuery.endTime ?
userComponentQuery.endTime + " 23:59:59" : "",
});
}
if (res) {
listRes.value = res;
if (pageNum.value == 1) {
list.value = res.records || [];
} else {
list.value = [...list.value, ...(res.records || [])];
}
isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false;
console.log(isEnd.value);
}
}
// 显示选择门店弹窗
const showShopSelActionSheet = ref(false);
function showShopSelActionSheetFun() {
showShopSelActionSheet.value = true;
}
const active = ref(0);
watch(
() => active.value,
(newval) => {
userComponentQuery.startTime = "";
userComponentQuery.endTime = "";
keyWord.value = "";
userId.value="";
console.log(newval);
pageNum.value = 1;
getList();
}
);
watch(
() => active.value,
(newval) => {
refresh();
}
);
watch(
() => selActions.value,
() => {
refresh();
}
);
onReachBottom(() => {
if (!isEnd.value) {
pageNum.value++;
getList();
}
});
watch(
() => distributionStore.config.isEnable,
() => {
distributionStore.editConfig();
}
);
onShow(() => {
pageNum.value = 1;
getList();
});
</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 {
display: flex; .filter-box {
padding: 8rpx 24rpx; display: flex;
align-items: center; padding: 8rpx 24rpx;
border-radius: 8rpx; align-items: center;
border: 2rpx solid #d9d9d9; border-radius: 8rpx;
background: #f7f7f7; border: 2rpx solid #d9d9d9;
min-height: 62rpx; background: #f7f7f7;
box-sizing: border-box; min-height: 62rpx;
} box-sizing: border-box;
}
</style> </style>

View File

@@ -14,10 +14,13 @@
</view> </view>
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs> <my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
<view v-if="active == 2" class="u-flex u-row-between u-m-t-32" style="gap: 58rpx"> <view v-if="active == 2" class="u-flex u-row-between u-m-t-32" style="gap: 58rpx">
<view class="u-flex-1 filter-box" style="border-radius: 100rpx"> <!-- <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
<up-icon name="search" size="18"></up-icon> <up-icon name="search" size="18"></up-icon>
<input class="u-m-l-10 u-font-28" type="text" placeholder-class="color-999 u-font-28" placeholder="搜索关键词" v-model="keyWord" @blur="keyWordBlur" /> <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-icon v-if="keyWord" name="close" size="14" @click="clearKeyWord"></up-icon> <up-icon v-if="keyWord" name="close" size="14" @click="clearKeyWord"></up-icon>
</view> -->
<view class="u-flex-1">
<my-user-select v-model="userId" @change="search()" ></my-user-select>
</view> </view>
<view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true"> <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"> <template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
@@ -215,6 +218,7 @@ function refresh() {
} }
const listRes = ref({}); const listRes = ref({});
const userId=ref('')
async function getList() { async function getList() {
let res = null; let res = null;
if (active.value == 1) { if (active.value == 1) {
@@ -232,7 +236,8 @@ async function getList() {
res = await memberApi.orderList({ res = await memberApi.orderList({
page: pageNum.value, page: pageNum.value,
size: 10, size: 10,
key: userComponentQuery.user, // key: userComponentQuery.user,
key: userId.value,
startTime: userComponentQuery.startTime ? userComponentQuery.startTime + ' 00:00:00' : '', startTime: userComponentQuery.startTime ? userComponentQuery.startTime + ' 00:00:00' : '',
endTime: userComponentQuery.endTime ? userComponentQuery.endTime + ' 23:59:59' : '' endTime: userComponentQuery.endTime ? userComponentQuery.endTime + ' 23:59:59' : ''
}); });
@@ -264,6 +269,7 @@ watch(
userComponentQuery.startTime = ''; userComponentQuery.startTime = '';
userComponentQuery.endTime = ''; userComponentQuery.endTime = '';
keyWord.value = ''; keyWord.value = '';
userId.value=''
refresh(); refresh();
} }
); );

View File

@@ -37,7 +37,7 @@
</view> </view>
<view class="u-m-l-30 u-flex"> <view class="u-m-l-30 u-flex">
<text class="">积分</text> <text class="">积分</text>
<text class="color-main">{{item.accountPoints}}</text> <text class="color-main">{{item.pointBalance||0}}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -113,7 +113,7 @@
headImg: '', headImg: '',
telephone: '', telephone: '',
amount: '0.00', amount: '0.00',
accountPoints: '0.00' pointBalance: '0.00'
}) })
} else { } else {
list[index].checked = true list[index].checked = true

View File

@@ -32,7 +32,7 @@
<view class="u-font-24 u-m-l-30 u-text-center"> <view class="u-font-24 u-m-l-30 u-text-center">
<text>积分</text> <text>积分</text>
<text class="color-main">{{ <text class="color-main">{{
pageData.user.accountPoints pageData.user.pointBalance||0
}}</text> }}</text>
</view> </view>
</view> </view>
@@ -88,7 +88,7 @@
<view class="u-flex"> <view class="u-flex">
<view>积分</view> <view>积分</view>
<view class="color-333 u-m-l-10">{{ <view class="color-333 u-m-l-10">{{
pageData.user.accountPoints pageData.user.pointBalance||0
}}</view> }}</view>
</view> </view>
<view class="u-flex"> <view class="u-flex">
@@ -935,14 +935,15 @@ function watchChooseuser() {
if (pageData.user.id == data.id) { if (pageData.user.id == data.id) {
return; return;
} }
if (data.id) { pageData.user = data;
const res = await shopUserDetail({ // if (data.id) {
userId: data.userId, // const res = await shopUserDetail({
}); // userId: data.userId,
pageData.user = res; // });
} else { // pageData.user = res;
pageData.user = data; // } else {
} // pageData.user = data;
// }
// 更新购物车和历史订单数据 // 更新购物车和历史订单数据
uodateCartAndHistory(); uodateCartAndHistory();
}); });

View File

@@ -2,20 +2,18 @@
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm"> <my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
<template #desc> <template #desc>
<view class="u-text-left u-p-30 color-666 u-font-28"> <view class="u-text-left u-p-30 color-666 u-font-28">
<view class="u-m-t-32 u-flex "> <view class="u-m-t-32 u-flex">
<view class="" v-if="accountPoints.calcRes.usable"> <view class="" v-if="pointDeductionRule.enableRewards">
<text class="color-red">*</text> <text class="color-red">*</text>
<text class="" <text class=""
v-if="accountPoints.calcRes.equivalentPoints">100积分等于{{to2(accountPoints.calcRes.equivalentPoints*100)}},</text> v-if="pointDeductionRule.equivalentPoints">{{ pointDeductionRule.equivalentPoints }}积分等于1,</text>
<text> <text>
最大抵扣积分{{accountPoints.calcRes.maxUsablePoints}} 最大抵扣积分{{ maxCanUsePoints }}
</text>
<text>,
最小抵扣积分0
</text> </text>
<text>, 最小抵扣积分0 </text>
</view> </view>
</view> </view>
<view class="u-m-t-40 u-flex "> <view class="u-m-t-40 u-flex">
<view>积分</view> <view>积分</view>
<view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1"> <view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1">
<uni-easyinput type="number" @input="pointsInput" @change="pointsChange" paddingNone <uni-easyinput type="number" @input="pointsInput" @change="pointsChange" paddingNone
@@ -38,93 +36,103 @@
</template> </template>
<script setup> <script setup>
import { reactive, nextTick, ref, watch } from 'vue'; import {
import myModel from '@/components/my-components/my-model.vue' reactive,
import myButton from '@/components/my-components/my-button.vue' nextTick,
import myTabs from '@/components/my-components/my-tabs.vue' ref,
import infoBox from '@/commons/utils/infoBox.js' watch
} from "vue";
import myModel from "@/components/my-components/my-model.vue";
import myButton from "@/components/my-components/my-button.vue";
import myTabs from "@/components/my-components/my-tabs.vue";
import infoBox from "@/commons/utils/infoBox.js";
const props = defineProps({ const props = defineProps({
title: { title: {
type: String, type: String,
default: '积分抵扣' default: "积分抵扣",
}, },
accountPoints:{ maxCanUsePoints: {
type:Object, type: Number,
default:()=>{ default: 0
},
pointDeductionRule: {
type: Object,
default: () => {
return { return {
calcRes:{ enableRewards: false,
usable: false, unusableReason: "",
unusableReason: '', minDeductionPoints: 0,
minDeductionPoints: 0, maxUsablePoints: 0,
maxUsablePoints: 0 };
} },
}
}
}, },
price: { price: {
type: [Number, String], type: [Number, String],
default: 0 default: 0,
} },
}) });
function to2(n) { function to2(n) {
if (!n) { if (!n) {
return '' return "";
} }
return n.toFixed(2) return n.toFixed(2);
} }
function pointsInput(e){ function pointsInput(e) {
setTimeout(()=>{ setTimeout(() => {
form.points=Math.floor(e) form.points = Math.floor(e);
},100) }, 100);
} }
function pointsChange(newval) { function pointsChange(newval) {
form.points=Math.floor(newval) form.points = Math.floor(newval);
if (newval < 0) { if (newval < 0) {
form.points = 0 form.points = 0;
return infoBox.showToast('积分抵扣不能小于0') return infoBox.showToast("积分抵扣不能小于0");
} }
if (newval > props.accountPoints.calcRes.maxUsablePoints) { if (newval > props.maxCanUsePoints) {
form.points = props.price form.points = props.price;
return infoBox.showToast('积分抵扣不能大于'+props.accountPoints.calcRes.maxUsablePoints) return infoBox.showToast(
"积分抵扣不能大于" + props.maxCanUsePoints
);
} }
} }
const form = reactive({ const form = reactive({
points: props.price, points: props.price,
}) });
watch(() => props.price, (newval) => { watch(
form.points = newval () => props.price,
}) (newval) => {
form.points = newval;
}
);
function resetForm() { function resetForm() {
form.points=0 form.points = 0;
} }
const model = ref(null) const model = ref(null);
function open() { function open() {
model.value.open() model.value.open();
form.points = props.price form.points = props.price;
} }
function close() { function close() {
model.value.close() model.value.close();
} }
const emits = defineEmits(['confirm']) const emits = defineEmits(["confirm"]);
function confirm() { function confirm() {
emits('confirm',Math.floor(form.points) ) emits("confirm", Math.floor(form.points));
close() close();
} }
defineExpose({ defineExpose({
open, open,
close close,
}) });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -140,7 +148,7 @@
.tag { .tag {
background-color: #fff; background-color: #fff;
border: 1px solid #E5E5E5; border: 1px solid #e5e5e5;
line-height: inherit; line-height: inherit;
font-size: 24rpx; font-size: 24rpx;
color: #666666; color: #666666;
@@ -148,13 +156,13 @@
border-radius: 8rpx; border-radius: 8rpx;
&.active { &.active {
border-color: #E6F0FF; border-color: #e6f0ff;
color: $my-main-color; color: $my-main-color;
} }
} }
.hover-class { .hover-class {
background-color: #E5E5E5; background-color: #e5e5e5;
} }
.discount { .discount {
@@ -166,7 +174,7 @@
} }
.bg1 { .bg1 {
background: #F7F7FA; background: #f7f7fa;
} }
.tab { .tab {
@@ -174,7 +182,7 @@
} }
.border { .border {
border: 1px solid #E5E5E5; border: 1px solid #e5e5e5;
border-radius: 4rpx; border-radius: 4rpx;
} }

File diff suppressed because it is too large Load Diff