Merge branch 'ymf' of https://newgitea.sxczgkj.cn/czg_team/cashier_app into new_gyq
@@ -40,7 +40,7 @@ $v-b-color-ed: #ededed;
|
|||||||
|
|
||||||
//common.scss 分包页面以及组件里所用的颜色
|
//common.scss 分包页面以及组件里所用的颜色
|
||||||
$my-main-color:#318AFE;
|
$my-main-color:#318AFE;
|
||||||
$my-red-color:#F02C45;
|
$my-red-color:#FE4F1E;
|
||||||
|
|
||||||
//my-components
|
//my-components
|
||||||
$u-main-color: #303133;
|
$u-main-color: #303133;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
|
|
||||||
// 点击事件
|
// 点击事件
|
||||||
async function clickFunc(nav) {
|
async function clickFunc(nav) {
|
||||||
if (nav.pageUrl == "PAGES_SALES_SUMMARY") {
|
if (nav.pageUrl == "PAGES_DATA_SUMMARY") {
|
||||||
let res = await hasPermission('允许查看经营数据')
|
let res = await hasPermission('允许查看经营数据')
|
||||||
if (!res) return
|
if (!res) return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,201 +1,223 @@
|
|||||||
<template>
|
<template>
|
||||||
<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">
|
<view class="u-text-left u-p-30 color-666">
|
||||||
<view class="u-m-t-32 u-flex ">
|
<view class="u-m-t-32 u-flex">
|
||||||
<view>应付金额</view>
|
<view>应付金额</view>
|
||||||
<view class="u-m-l-32">
|
<view class="u-m-l-32">
|
||||||
{{form.price}}
|
{{ form.price }}
|
||||||
</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="currentPriceInput" @change="currentPriceChange" paddingNone :inputBorder="false"
|
<uni-easyinput
|
||||||
v-model="form.currentPrice"
|
type="number"
|
||||||
placeholder="输入实际金额"></uni-easyinput>
|
@input="currentPriceInput"
|
||||||
</view>
|
@change="currentPriceChange"
|
||||||
</view>
|
paddingNone
|
||||||
<view class="u-m-t-54 u-flex ">
|
:inputBorder="false"
|
||||||
<view>优惠折扣</view>
|
v-model="form.currentPrice"
|
||||||
<view class="u-m-l-32 u-flex-1 u-flex border u-p-l-10 u-p-r-10">
|
placeholder="输入实际金额"
|
||||||
<view class="u-flex-1">
|
></uni-easyinput>
|
||||||
<uni-easyinput type="number" @input="discountInput" @change="discountChange" paddingNone :inputBorder="false"
|
</view>
|
||||||
v-model="form.discount"
|
</view>
|
||||||
placeholder="输入折扣"></uni-easyinput>
|
<view class="u-m-t-54 u-flex">
|
||||||
</view>
|
<view>优惠折扣</view>
|
||||||
<view class="u-font-32 color-333">%</view>
|
<view class="u-m-l-32 u-flex-1 u-flex border u-p-l-10 u-p-r-10">
|
||||||
</view>
|
<view class="u-flex-1">
|
||||||
|
<uni-easyinput
|
||||||
</view>
|
type="number"
|
||||||
</view>
|
@input="discountInput"
|
||||||
</template>
|
@change="discountChange"
|
||||||
<template #btn>
|
paddingNone
|
||||||
<view class="u-p-30">
|
:inputBorder="false"
|
||||||
<view class="u-m-t-10">
|
v-model="form.discount"
|
||||||
<my-button @tap="confirm" shape="circle" fontWeight="700" >修改</my-button>
|
placeholder="输入折扣"
|
||||||
<view class="">
|
></uni-easyinput>
|
||||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
</view>
|
||||||
</view>
|
<view class="u-font-32 color-333">%</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</view>
|
||||||
</my-model>
|
</template>
|
||||||
|
<template #btn>
|
||||||
|
<view class="u-p-30">
|
||||||
|
<view class="u-m-t-10">
|
||||||
|
<my-button @tap="confirm" shape="circle" fontWeight="700"
|
||||||
|
>修改</my-button
|
||||||
|
>
|
||||||
|
<view class="">
|
||||||
|
<my-button @tap="close" type="cancel" bgColor="#fff"
|
||||||
|
>取消</my-button
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</my-model>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, nextTick, ref,watch } from 'vue';
|
import { reactive, nextTick, ref, watch } from "vue";
|
||||||
import myModel from '@/components/my-components/my-model.vue'
|
import myModel from "@/components/my-components/my-model.vue";
|
||||||
import myButton from '@/components/my-components/my-button.vue'
|
import myButton from "@/components/my-components/my-button.vue";
|
||||||
import infoBox from '@/commons/utils/infoBox.js'
|
import infoBox from "@/commons/utils/infoBox.js";
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: "",
|
||||||
},
|
},
|
||||||
discount:{
|
discount: {
|
||||||
type: [Number,String],
|
type: [Number, String],
|
||||||
default:100
|
default: 100,
|
||||||
},
|
},
|
||||||
price: {
|
price: {
|
||||||
type: [Number,String],
|
type: [Number, String],
|
||||||
default: 0
|
default: 0,
|
||||||
},
|
},
|
||||||
|
});
|
||||||
})
|
function currentPriceInput(newval) {
|
||||||
function currentPriceInput(newval){
|
form.discount = ((newval * 100) / form.price).toFixed(2);
|
||||||
form.discount = (newval*100/form.price).toFixed(2)
|
}
|
||||||
}
|
function discountInput(newval) {
|
||||||
function discountInput(newval){
|
const currentPrice = uni.$utils.isMoney((form.price * newval) / 100) * 1;
|
||||||
form.currentPrice= uni.$utils.isMoney(form.price*newval/100).toFixed(2)
|
form.currentPrice = currentPrice.toFixed(2);
|
||||||
}
|
}
|
||||||
function currentPriceChange(newval){
|
function currentPriceChange(newval) {
|
||||||
if(newval<0){
|
if (newval < 0) {
|
||||||
form.currentPrice = '0.00'
|
form.currentPrice = "0.00";
|
||||||
form.discount=100
|
form.discount = 100;
|
||||||
return infoBox.showToast('实收金额不能小于0')
|
return infoBox.showToast("实收金额不能小于0");
|
||||||
}
|
}
|
||||||
console.log(props.price)
|
console.log(props.price);
|
||||||
console.log(newval)
|
console.log(newval);
|
||||||
if(newval > props.price){
|
if (newval > props.price) {
|
||||||
form.currentPrice = (uni.$utils.isMoney(props.price)*1).toFixed(2)
|
const currentPrice = uni.$utils.isMoney(props.price * 1);
|
||||||
form.discount=0
|
form.currentPrice = currentPrice.toFixed(2);
|
||||||
return infoBox.showToast('实收金额不能大于应付金额')
|
form.discount = 0;
|
||||||
}
|
return infoBox.showToast("实收金额不能大于应付金额");
|
||||||
}
|
}
|
||||||
function discountChange(newval){
|
}
|
||||||
if(newval<0){
|
function discountChange(newval) {
|
||||||
form.currentPrice=props.price
|
if (newval < 0) {
|
||||||
form.discount=0
|
form.currentPrice = props.price;
|
||||||
return infoBox.showToast('优惠折扣不能小于0')
|
form.discount = 0;
|
||||||
}
|
return infoBox.showToast("优惠折扣不能小于0");
|
||||||
if(newval>100){
|
}
|
||||||
form.discount=100
|
if (newval > 100) {
|
||||||
form.currentPrice=0
|
form.discount = 100;
|
||||||
return infoBox.showToast('优惠折扣不能大于100')
|
form.currentPrice = 0;
|
||||||
}
|
return infoBox.showToast("优惠折扣不能大于100");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const $form = {
|
|
||||||
price: props.price,
|
|
||||||
currentPrice: props.price,
|
|
||||||
discount: 100
|
|
||||||
}
|
|
||||||
const form = reactive({
|
|
||||||
...$form
|
|
||||||
})
|
|
||||||
watch(()=>props.price,(newval)=>{
|
|
||||||
form.price = (newval*1).toFixed(2)
|
|
||||||
form.currentPrice=newval
|
|
||||||
})
|
|
||||||
function resetForm() {
|
|
||||||
Object.assign(form, {
|
|
||||||
...$form
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const model = ref(null)
|
const $form = {
|
||||||
|
price: props.price,
|
||||||
|
currentPrice: props.price,
|
||||||
|
discount: 100,
|
||||||
|
};
|
||||||
|
const form = reactive({
|
||||||
|
...$form,
|
||||||
|
});
|
||||||
|
watch(
|
||||||
|
() => props.price,
|
||||||
|
(newval) => {
|
||||||
|
form.price = (newval * 1).toFixed(2);
|
||||||
|
form.currentPrice = newval;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
function resetForm() {
|
||||||
|
Object.assign(form, {
|
||||||
|
...$form,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function open() {
|
const model = ref(null);
|
||||||
model.value.open()
|
|
||||||
form.price= (props.price*1).toFixed(2)
|
|
||||||
form.discount=props.discount
|
|
||||||
form.currentPrice=(props.discount*props.price/100).toFixed(2)
|
|
||||||
console.log(form)
|
|
||||||
}
|
|
||||||
|
|
||||||
function close() {
|
function open() {
|
||||||
model.value.close()
|
model.value.open();
|
||||||
}
|
form.price = (props.price * 1).toFixed(2);
|
||||||
const emits = defineEmits(['confirm'])
|
form.discount = props.discount;
|
||||||
|
form.currentPrice = ((props.discount * props.price) / 100).toFixed(2);
|
||||||
|
console.log(form);
|
||||||
|
}
|
||||||
|
|
||||||
function confirm() {
|
function close() {
|
||||||
emits('confirm',{...form,currentPrice:Number(form.currentPrice).toFixed(2)})
|
model.value.close();
|
||||||
close()
|
}
|
||||||
}
|
const emits = defineEmits(["confirm"]);
|
||||||
defineExpose({
|
|
||||||
open,
|
function confirm() {
|
||||||
close
|
emits("confirm", {
|
||||||
})
|
...form,
|
||||||
|
currentPrice: Number(form.currentPrice).toFixed(2),
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
open,
|
||||||
|
close,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.border{
|
.border {
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-color: #999;
|
border-color: #999;
|
||||||
}
|
}
|
||||||
.lh34 {
|
.lh34 {
|
||||||
line-height: 34rpx;
|
line-height: 34rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.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;
|
||||||
padding: 6rpx 20rpx;
|
padding: 6rpx 20rpx;
|
||||||
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 {
|
||||||
.u-absolute {
|
.u-absolute {
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg1 {
|
.bg1 {
|
||||||
background: #F7F7FA;
|
background: #f7f7fa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
padding: 0 80rpx;
|
padding: 0 80rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.border {
|
.border {
|
||||||
border: 1px solid #E5E5E5;
|
border: 1px solid #e5e5e5;
|
||||||
border-radius: 4rpx;
|
border-radius: 4rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-box {
|
.input-box {
|
||||||
padding: 22rpx 32rpx;
|
padding: 22rpx 32rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder-class {
|
.placeholder-class {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view v-if="isShow">
|
||||||
<view class="zhanwei" :class="[direction == 'column' ? 'zhanwei1' : '']"></view>
|
<view class="zhanwei" :class="[direction == 'column' ? 'zhanwei1' : '']"></view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
@@ -21,9 +21,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed } from "vue";
|
||||||
const emit = defineEmits(["save", "cancel"]);
|
const emit = defineEmits(["save", "cancel"]);
|
||||||
|
import { isMainShop } from "@/store/account.js";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
isOpenPermission: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
//方向 row横向布局 column 纵向布局
|
//方向 row横向布局 column 纵向布局
|
||||||
direction: {
|
direction: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -31,6 +37,14 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const isShow = computed(() => {
|
||||||
|
if (props.isOpenPermission) {
|
||||||
|
return isMainShop();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
emit("save");
|
emit("save");
|
||||||
}
|
}
|
||||||
|
|||||||
597
components/my-components/my-date-pickerview copy.vue
Normal file
@@ -0,0 +1,597 @@
|
|||||||
|
<template>
|
||||||
|
<view class="mask" v-if="show" @tap="close">
|
||||||
|
<view class="box" @tap.stop="nullFunction">
|
||||||
|
<view
|
||||||
|
class="u-flex u-relative u-row-center u-p-30 top"
|
||||||
|
v-if="props.isArea"
|
||||||
|
>
|
||||||
|
<view class="font-bold u-font-32">{{ props.title }}</view>
|
||||||
|
<view class="close" @tap="close">
|
||||||
|
<uni-icons type="closeempty" size="24"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="u-p-30 u-flex u-flex-wrap gap-20 fastTime"
|
||||||
|
v-if="props.isArea"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="item"
|
||||||
|
v-for="(item, index) in fastTime"
|
||||||
|
:key="index"
|
||||||
|
@tap="changeTime(item)"
|
||||||
|
>
|
||||||
|
{{ item.label }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<picker-view
|
||||||
|
:immediate-change="true"
|
||||||
|
@pickend="pickend"
|
||||||
|
:value="value"
|
||||||
|
@change="bindChange"
|
||||||
|
class="picker-view"
|
||||||
|
>
|
||||||
|
<template v-if="props.mode === 'all' || props.mode === 'date'">
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in years" :key="index"
|
||||||
|
>{{ item }}年</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in months" :key="index"
|
||||||
|
>{{ item }}月</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in days" :key="index"
|
||||||
|
>{{ item }}日</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
</template>
|
||||||
|
<template v-if="props.mode === 'all' || props.mode === 'time'">
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in hours" :key="index"
|
||||||
|
>{{ item }}时</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in minutes" :key="index"
|
||||||
|
>{{ item }}分</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in seconds" :key="index"
|
||||||
|
>{{ item }}秒</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
</template>
|
||||||
|
</picker-view>
|
||||||
|
<template v-if="props.isArea">
|
||||||
|
<view class="u-text-center color-999">至</view>
|
||||||
|
<picker-view
|
||||||
|
:immediate-change="true"
|
||||||
|
:value="value1"
|
||||||
|
@pickend="pickend1"
|
||||||
|
@change="bindChange1"
|
||||||
|
class="picker-view"
|
||||||
|
>
|
||||||
|
<template v-if="props.mode === 'all' || props.mode === 'date'">
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in years" :key="index"
|
||||||
|
>{{ item }}年</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in months" :key="index"
|
||||||
|
>{{ item }}月</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in days1" :key="index"
|
||||||
|
>{{ item }}日</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
</template>
|
||||||
|
<template v-if="props.mode === 'all' || props.mode === 'time'">
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in hours" :key="index"
|
||||||
|
>{{ item }}时</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in minutes" :key="index"
|
||||||
|
>{{ item }}分</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in seconds" :key="index"
|
||||||
|
>{{ item }}秒</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
</template>
|
||||||
|
</picker-view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 占位 -->
|
||||||
|
<view style="height: 80px"></view>
|
||||||
|
<template v-if="props.isArea">
|
||||||
|
<view class="fixed_b">
|
||||||
|
<my-button shape="circle" @tap="confirm">确定</my-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="fixed_b u-flex u-row-center">
|
||||||
|
<view class="u-m-r-16">
|
||||||
|
<my-button type="cancel" @tap="close" width="240">
|
||||||
|
<view class="color-999">取消</view>
|
||||||
|
</my-button>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-l-16">
|
||||||
|
<button @tap="confirm">确定</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, nextTick, ref } from "vue";
|
||||||
|
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
const $time = {
|
||||||
|
// 获取今天的开始和结束时间
|
||||||
|
getTodayTimestamps() {
|
||||||
|
const start = dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const end = dayjs().endOf("day").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { start, end, label: "今日" };
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取昨天的开始和结束时间
|
||||||
|
getYesterdayTimestamps() {
|
||||||
|
const start = dayjs()
|
||||||
|
.subtract(1, "day")
|
||||||
|
.startOf("day")
|
||||||
|
.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const end = dayjs()
|
||||||
|
.subtract(1, "day")
|
||||||
|
.endOf("day")
|
||||||
|
.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { start, end, label: "昨日" };
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取本周的开始和结束时间
|
||||||
|
getThisWeekTimestamps() {
|
||||||
|
const start = dayjs().startOf("week").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const end = dayjs().endOf("week").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { start, end, label: "本周" };
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取本月的开始和结束时间
|
||||||
|
getThisMonthTimestamps() {
|
||||||
|
const start = dayjs().startOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const end = dayjs().endOf("month").format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { start, end, label: "本月" };
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取上个月的开始和结束时间
|
||||||
|
getThisLastMonthTimestamps() {
|
||||||
|
const start = dayjs()
|
||||||
|
.subtract(1, "month")
|
||||||
|
.startOf("month")
|
||||||
|
.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
const end = dayjs()
|
||||||
|
.subtract(1, "month")
|
||||||
|
.endOf("month")
|
||||||
|
.format("YYYY-MM-DD HH:mm:ss");
|
||||||
|
return { start, end, label: "上月" };
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
selTime: {
|
||||||
|
type: [String, Number],
|
||||||
|
},
|
||||||
|
defaultIndex: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultTime: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: "筛选日期时间",
|
||||||
|
},
|
||||||
|
isArea: {
|
||||||
|
//是否选中范围时间
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
mode: {
|
||||||
|
//all date time
|
||||||
|
type: String,
|
||||||
|
default: "time",
|
||||||
|
},
|
||||||
|
yearsLen: {
|
||||||
|
type: Number,
|
||||||
|
default: 30,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const $nowDate = new Date();
|
||||||
|
const nowDate = {
|
||||||
|
year: $nowDate.getFullYear(),
|
||||||
|
month: $nowDate.getMonth() + 1,
|
||||||
|
day: $nowDate.getDate(),
|
||||||
|
hours: $nowDate.getHours(),
|
||||||
|
minutes: $nowDate.getMinutes(),
|
||||||
|
seconds: $nowDate.getSeconds(),
|
||||||
|
};
|
||||||
|
const yearsLen = props.yearsLen;
|
||||||
|
|
||||||
|
function returnYears() {
|
||||||
|
if (props.isArea) {
|
||||||
|
return new Array(yearsLen)
|
||||||
|
.fill(1)
|
||||||
|
.map((v, index) => {
|
||||||
|
return nowDate.year - index;
|
||||||
|
})
|
||||||
|
.reverse();
|
||||||
|
} else {
|
||||||
|
return new Array(yearsLen).fill(1).map((v, index) => {
|
||||||
|
return nowDate.year - Math.floor(yearsLen / 2) + index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const years = returnYears();
|
||||||
|
|
||||||
|
const months = new Array(12).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
});
|
||||||
|
const days = ref(
|
||||||
|
new Array(getMonthArea($nowDate, "end").getDate()).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const days1 = ref(
|
||||||
|
new Array(getMonthArea($nowDate, "end").getDate()).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const hours = new Array(24).fill(1).map((v, index) => {
|
||||||
|
return index;
|
||||||
|
});
|
||||||
|
const minutes = new Array(60).fill(1).map((v, index) => {
|
||||||
|
return index;
|
||||||
|
});
|
||||||
|
const seconds = new Array(60).fill(1).map((v, index) => {
|
||||||
|
return index;
|
||||||
|
});
|
||||||
|
// const fastTime = reactive([{
|
||||||
|
// title: '今日',
|
||||||
|
// key: 'now'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '昨日',
|
||||||
|
// key: 'prve'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '本月',
|
||||||
|
// key: 'nowMonth'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '上月',
|
||||||
|
// key: 'prveMonth'
|
||||||
|
// }
|
||||||
|
// ])
|
||||||
|
const today = $time.getTodayTimestamps();
|
||||||
|
const yesterday = $time.getYesterdayTimestamps();
|
||||||
|
const thisMonth = $time.getThisMonthTimestamps();
|
||||||
|
const thisLastMonth = $time.getThisLastMonthTimestamps();
|
||||||
|
const fastTime = reactive([today, yesterday, thisMonth, thisLastMonth]);
|
||||||
|
|
||||||
|
function setPrveDay() {}
|
||||||
|
|
||||||
|
function setNowMoneth() {}
|
||||||
|
|
||||||
|
function setprveMoneth() {}
|
||||||
|
|
||||||
|
function setDay(start, end) {
|
||||||
|
value.value = [start.year, start.month, start.day, 0, 0, 0];
|
||||||
|
value1.value = [end.year, end.month, end.day, 23, 59, 59];
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeTime(e) {
|
||||||
|
console.log(e);
|
||||||
|
const start = e.start;
|
||||||
|
const end = e.end;
|
||||||
|
emits("confirm", {
|
||||||
|
text: `${start}——${end}`,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
let value = ref([]);
|
||||||
|
let value1 = ref([]);
|
||||||
|
initValue();
|
||||||
|
|
||||||
|
function returnFindIndex(arr) {
|
||||||
|
const yearIndex = years.findIndex((v) => v == arr[0]);
|
||||||
|
const monthIndex = arr[1];
|
||||||
|
const dayIndex = arr[2] - 1;
|
||||||
|
const hIndex = arr[3];
|
||||||
|
const mIndex = arr[4];
|
||||||
|
const sIndex = arr[5];
|
||||||
|
return [yearIndex, monthIndex, dayIndex, hIndex, mIndex, sIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
function initValue() {
|
||||||
|
if (props.defaultTime.length && !props.isArea) {
|
||||||
|
value.value = returnFindIndex(props.defaultTime);
|
||||||
|
} else {
|
||||||
|
const yearIndex = years.findIndex((v) => v == nowDate.year);
|
||||||
|
value.value = [yearIndex, nowDate.month - 1, nowDate.day - 1, 0, 0, 0];
|
||||||
|
value1.value = [yearIndex, nowDate.month - 1, nowDate.day - 1, 23, 59, 59];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let show = ref(false);
|
||||||
|
const emits = defineEmits("close", "open", "confirm");
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
show.value = !show.value;
|
||||||
|
if (show.value) {
|
||||||
|
open();
|
||||||
|
} else {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
show.value = false;
|
||||||
|
// emits('close', false)
|
||||||
|
}
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
if (typeof props.selTime === "number") {
|
||||||
|
const d = new Date(props.selTime);
|
||||||
|
value.value[0] = years.findIndex((v) => v === d.getFullYear());
|
||||||
|
value.value[1] = months.findIndex((v) => v === d.getMonth()) + 1;
|
||||||
|
value.value[2] = days.value.findIndex((v) => v === d.getDate());
|
||||||
|
}
|
||||||
|
show.value = true;
|
||||||
|
// emits('open', true)
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnDateString(arr, isObj) {
|
||||||
|
const year = years[arr[0]];
|
||||||
|
const month = arr[1] + 1;
|
||||||
|
const day = arr[2] + 1;
|
||||||
|
const hour = ("0" + (arr[3] || 0)).slice(-2);
|
||||||
|
const min = ("0" + (arr[4] || 0)).slice(-2);
|
||||||
|
const sen = ("0" + (arr[5] || 0)).slice(-2);
|
||||||
|
if (isObj) {
|
||||||
|
return new Date(year, month, day, hour, min, sen);
|
||||||
|
}
|
||||||
|
return `${year}-${month}-${day} ${hour}:${min}:${sen}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirm(e) {
|
||||||
|
const start = returnDateString(value.value);
|
||||||
|
const end = returnDateString(value1.value);
|
||||||
|
if (!props.isArea) {
|
||||||
|
emits("confirm", start);
|
||||||
|
} else {
|
||||||
|
emits("confirm", {
|
||||||
|
text: `${start}——${end}`,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnMonthStart(arr) {
|
||||||
|
return new Date(years[arr[0]], months[arr[1]] - 1, 1).getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnMonthEnd(arr) {
|
||||||
|
return new Date(years[arr[0]], months[arr[1]], 0).getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
//防抖
|
||||||
|
function debounce(fn, wait) {
|
||||||
|
let timeout = null;
|
||||||
|
return function () {
|
||||||
|
let context = this;
|
||||||
|
let args = arguments;
|
||||||
|
if (timeout) clearTimeout(timeout);
|
||||||
|
let callNow = !timeout;
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
timeout = null;
|
||||||
|
}, wait);
|
||||||
|
if (callNow) fn.apply(context, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} isDays1 //是否是结束时间选择
|
||||||
|
* @param {Object} arr
|
||||||
|
*/
|
||||||
|
function changeDays(isDays1, arr) {
|
||||||
|
const end = returnMonthEnd(arr);
|
||||||
|
if (end) {
|
||||||
|
if (isDays1) {
|
||||||
|
days1.value = new Array(end).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
days.value = new Array(end).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindChange(e) {
|
||||||
|
const startTotal = returnDateString(e.detail.value, true).getTime();
|
||||||
|
const endTotal = returnDateString(value1.value, true).getTime();
|
||||||
|
value.value = e.detail.value;
|
||||||
|
setTimeout(() => {
|
||||||
|
if (props.isArea) {
|
||||||
|
value.value = startTotal > endTotal ? value1.value : e.detail.value;
|
||||||
|
}
|
||||||
|
debounce(changeDays(false, value.value), 100);
|
||||||
|
}, 10);
|
||||||
|
// nextTick(() => {
|
||||||
|
// if (props.isArea) {
|
||||||
|
// value.value = startTotal > endTotal ? value1.value : e.detail.value
|
||||||
|
// }
|
||||||
|
// console.log(value.value);
|
||||||
|
// debounce(changeDays(false, value.value), 100)
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindChange1(e) {
|
||||||
|
const startTotal = returnDateString(value.value, true).getTime();
|
||||||
|
const endTotal = returnDateString(e.detail.value, true).getTime();
|
||||||
|
value1.value = e.detail.value;
|
||||||
|
nextTick(() => {
|
||||||
|
if (props.isArea) {
|
||||||
|
value1.value = endTotal < startTotal ? value.value : e.detail.value;
|
||||||
|
}
|
||||||
|
debounce(changeDays(true, value1.value), 100);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDayDate(date = new Date(), type) {
|
||||||
|
const now = date;
|
||||||
|
if (type === "start") {
|
||||||
|
const startOfDay = new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth(),
|
||||||
|
now.getDate()
|
||||||
|
);
|
||||||
|
return startOfDay;
|
||||||
|
}
|
||||||
|
if (type === "end") {
|
||||||
|
const endOfDay = new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth(),
|
||||||
|
now.getDate(),
|
||||||
|
23,
|
||||||
|
59,
|
||||||
|
59,
|
||||||
|
999
|
||||||
|
);
|
||||||
|
return endOfDay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMonthArea(date = new Date(), type) {
|
||||||
|
let now = date;
|
||||||
|
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||||
|
let currentMonthEnd = new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth() + 1,
|
||||||
|
0,
|
||||||
|
23,
|
||||||
|
59,
|
||||||
|
59,
|
||||||
|
999
|
||||||
|
);
|
||||||
|
if (type === "start") {
|
||||||
|
return currentMonthStart;
|
||||||
|
}
|
||||||
|
if (type === "end") {
|
||||||
|
return currentMonthEnd;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
start: currentMonthStart,
|
||||||
|
end: currentMonthEnd,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function nullFunction() {}
|
||||||
|
|
||||||
|
function pickend(e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pickend1(e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
close,
|
||||||
|
open,
|
||||||
|
confirm,
|
||||||
|
toggle,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.fastTime {
|
||||||
|
.item {
|
||||||
|
background-color: rgb(247, 247, 247);
|
||||||
|
padding: 6rpx 40rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
right: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mask {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
background-color: rgba(51, 51, 51, 0.5);
|
||||||
|
|
||||||
|
.item {
|
||||||
|
line-height: 34px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
position: absolute;
|
||||||
|
background-color: #fff;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
border-radius: 16rpx 16rpx 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed_b {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
padding: 30rpx;
|
||||||
|
z-index: 100;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-view {
|
||||||
|
width: 750rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,56 +1,78 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="fixed-wrap" :style="{ '--num': showCancel ? '63px' : '0px' }">
|
<view
|
||||||
<view class="fixed-btn" id="targetRef">
|
class="fixed-wrap"
|
||||||
<div class="btn">
|
:style="{ '--num': showCancel ? '63px' : '0px' }"
|
||||||
<u-button type="primary" :shape="shape" size="large" @click="emits('confirm')">{{ confirmText }}</u-button>
|
v-if="isShow"
|
||||||
</div>
|
>
|
||||||
<div class="btn" v-if="showCancel">
|
<view class="fixed-btn" id="targetRef">
|
||||||
<u-button :shape="shape" size="large" @click="emits('cancel')">取消</u-button>
|
<div class="btn">
|
||||||
</div>
|
<u-button
|
||||||
</view>
|
type="primary"
|
||||||
</view>
|
:shape="shape"
|
||||||
|
size="large"
|
||||||
|
@click="emits('confirm')"
|
||||||
|
>{{ confirmText }}</u-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="btn" v-if="showCancel">
|
||||||
|
<u-button :shape="shape" size="large" @click="emits('cancel')"
|
||||||
|
>取消</u-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick, getCurrentInstance } from 'vue';
|
import { ref, onMounted, nextTick, getCurrentInstance } from "vue";
|
||||||
|
import { isMainShop } from "@/store/account.js";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
confirmText: {
|
isOpenPermission: {
|
||||||
type: String,
|
type: Boolean,
|
||||||
default: '保存'
|
default: true,
|
||||||
},
|
},
|
||||||
showCancel: {
|
confirmText: {
|
||||||
type: Boolean,
|
type: String,
|
||||||
default: false
|
default: "保存",
|
||||||
},
|
},
|
||||||
shape: {
|
showCancel: {
|
||||||
type: String,
|
type: Boolean,
|
||||||
default: 'circle' // squre circle
|
default: false,
|
||||||
}
|
},
|
||||||
|
shape: {
|
||||||
|
type: String,
|
||||||
|
default: "circle", // squre circle
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
const isShow = computed(() => {
|
||||||
const emits = defineEmits(['confirm', 'cancel']);
|
if (props.isOpenPermission) {
|
||||||
|
return isMainShop();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
const emits = defineEmits(["confirm", "cancel"]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.fixed-wrap {
|
.fixed-wrap {
|
||||||
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
.fixed-btn {
|
.fixed-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
.btn {
|
.btn {
|
||||||
&:first-child {
|
&:first-child {
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,113 +1,125 @@
|
|||||||
<template>
|
<template>
|
||||||
<up-upload :fileList="images" @afterRead="afterRead" @delete="deletePic" :multiple="multiple" :width="width"
|
<up-upload
|
||||||
:height="height" :maxCount="maxCount"></up-upload>
|
:fileList="images"
|
||||||
|
@afterRead="afterRead"
|
||||||
|
@delete="deletePic"
|
||||||
|
:multiple="multiple"
|
||||||
|
:width="width"
|
||||||
|
:height="height"
|
||||||
|
:maxCount="maxCount"
|
||||||
|
>
|
||||||
|
<template #default v-if="$slots.default">
|
||||||
|
<slot></slot>
|
||||||
|
</template>
|
||||||
|
</up-upload>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from "vue";
|
||||||
import { uploadFile } from '@/http/api/index.js'
|
import { uploadFile } from "@/http/api/index.js";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => [],
|
||||||
},
|
},
|
||||||
width: {
|
width: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: 60
|
default: 60,
|
||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: 60
|
default: 60,
|
||||||
},
|
},
|
||||||
maxCount: {
|
maxCount: {
|
||||||
type: [Number],
|
type: [Number],
|
||||||
default: 10
|
default: 10,
|
||||||
},
|
},
|
||||||
multiple: {
|
multiple: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true,
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
|
const emits = defineEmits(["update:modelValue"]);
|
||||||
|
const images = ref(props.modelValue);
|
||||||
|
|
||||||
const emits = defineEmits(['update:modelValue'])
|
function uploadfile(par) {
|
||||||
const images = ref(props.modelValue)
|
let file = null;
|
||||||
|
// #ifdef H5
|
||||||
|
file = par.file;
|
||||||
|
// #endif
|
||||||
function uploadfile(par){
|
// #ifndef H5
|
||||||
let file=null;
|
file = par;
|
||||||
// #ifdef H5
|
// #endif
|
||||||
file= par.file
|
return uploadFile(file);
|
||||||
// #endif
|
}
|
||||||
// #ifndef H5
|
|
||||||
file= par
|
|
||||||
// #endif
|
|
||||||
return uploadFile(file)
|
|
||||||
}
|
|
||||||
|
|
||||||
function afterRead(e) {
|
|
||||||
console.log(e);
|
|
||||||
if (Array.isArray(e.file)) {
|
|
||||||
for (let i in e.file) {
|
|
||||||
const file = e.file[i]
|
|
||||||
console.log(file);
|
|
||||||
uploadfile(file).then(res => {
|
|
||||||
console.log(res);
|
|
||||||
images.value.push({
|
|
||||||
url: e.file[i].url,
|
|
||||||
serveUrl: res
|
|
||||||
})
|
|
||||||
}).catch(res => {
|
|
||||||
console.log(res);
|
|
||||||
if (res.errMsg) {
|
|
||||||
images.value.splice(i, 1)
|
|
||||||
uni.showToast({
|
|
||||||
title: '图片大小超出限制',
|
|
||||||
icon: 'error'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
function afterRead(e) {
|
||||||
}
|
console.log(e);
|
||||||
}else{
|
if (Array.isArray(e.file)) {
|
||||||
const i=0
|
for (let i in e.file) {
|
||||||
uploadfile(e.file).then(res => {
|
const file = e.file[i];
|
||||||
console.log(res);
|
console.log(file);
|
||||||
images.value.push({
|
uploadfile(file)
|
||||||
url: e.file.url,
|
.then((res) => {
|
||||||
serveUrl: res
|
console.log(res);
|
||||||
})
|
images.value.push({
|
||||||
}).catch(res => {
|
url: e.file[i].url,
|
||||||
console.log(res);
|
serveUrl: res,
|
||||||
if (res.errMsg) {
|
});
|
||||||
images.value.splice(i, 1)
|
})
|
||||||
uni.showToast({
|
.catch((res) => {
|
||||||
title: '图片大小超出限制',
|
console.log(res);
|
||||||
icon: 'error'
|
if (res.errMsg) {
|
||||||
})
|
images.value.splice(i, 1);
|
||||||
}
|
uni.showToast({
|
||||||
|
title: "图片大小超出限制",
|
||||||
})
|
icon: "error",
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const i = 0;
|
||||||
|
uploadfile(e.file)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
images.value.push({
|
||||||
|
url: e.file.url,
|
||||||
|
serveUrl: res,
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((res) => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.errMsg) {
|
||||||
|
images.value.splice(i, 1);
|
||||||
|
uni.showToast({
|
||||||
|
title: "图片大小超出限制",
|
||||||
|
icon: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
function deletePic(e) {
|
||||||
|
const { index } = e;
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
function deletePic(e) {
|
watch(
|
||||||
const {
|
() => images.value,
|
||||||
index
|
(newval) => {
|
||||||
} = e
|
emits("update:modelValue", newval);
|
||||||
images.value.splice(index, 1)
|
}
|
||||||
}
|
);
|
||||||
|
watch(
|
||||||
watch(() => images.value, (newval) => {
|
() => props.modelValue,
|
||||||
emits('update:modelValue', newval)
|
(newval) => {
|
||||||
})
|
images.value = newval;
|
||||||
watch(() => props.modelValue, (newval) => {
|
}
|
||||||
images.value = newval
|
);
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
</style>
|
|
||||||
|
|||||||
89
components/my-components/my-upload-img.vue
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<template>
|
||||||
|
<view class="upload-file" @click="chooseImage">
|
||||||
|
<slot v-if="$slots.default"></slot>
|
||||||
|
<view class="icon" v-if="!modelValue"> + </view>
|
||||||
|
<image class="img" v-else :src="modelValue"></image>
|
||||||
|
|
||||||
|
<view class="close" @click.stop="()=>{}" v-if="modelValue">
|
||||||
|
<up-icon name="close-circle" color="#333" size="14" @click="clearImg" ></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { uploadFile } from "@/http/api/index.js";
|
||||||
|
|
||||||
|
import { reactive, ref, watch } from "vue";
|
||||||
|
|
||||||
|
const modelValue = defineModel({
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
function chooseImage() {
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 1, //默认9
|
||||||
|
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
||||||
|
sourceType: ["album", "camera "],
|
||||||
|
success: async function (res) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: "上传中",
|
||||||
|
});
|
||||||
|
console.log(res);
|
||||||
|
const fileRes = await uploadFile(res.tempFiles[0]);
|
||||||
|
uni.hideLoading();
|
||||||
|
if (fileRes) {
|
||||||
|
modelValue.value = fileRes;
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "上传失败",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearImg(){
|
||||||
|
modelValue.value=""
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.upload-file {
|
||||||
|
$size: 128rpx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
position: relative;
|
||||||
|
.close{
|
||||||
|
position: absolute;
|
||||||
|
right: -10rpx;
|
||||||
|
top: -10rpx;
|
||||||
|
}
|
||||||
|
.img {
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
border: 4rpx solid #999;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #999;
|
||||||
|
font-size: 32rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
33
data/index.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import dayjs from "dayjs";
|
||||||
|
export const timeList = [
|
||||||
|
{
|
||||||
|
label: "今天",
|
||||||
|
value: "today",
|
||||||
|
beginDate: dayjs().format("YYYY-MM-DD"),
|
||||||
|
endDate: dayjs().format("YYYY-MM-DD"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "昨天",
|
||||||
|
value: "yesterday",
|
||||||
|
beginDate: dayjs().subtract(1, "day").format("YYYY-MM-DD"),
|
||||||
|
endDate: dayjs().subtract(1, "day").format("YYYY-MM-DD"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "本周",
|
||||||
|
value: "this_week",
|
||||||
|
beginDate: dayjs().startOf("week").format("YYYY-MM-DD"),
|
||||||
|
endDate: dayjs().endOf("week").format("YYYY-MM-DD"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "本月",
|
||||||
|
value: "this_month",
|
||||||
|
beginDate: dayjs().startOf("month").format("YYYY-MM-DD"),
|
||||||
|
endDate: dayjs().endOf("month").format("YYYY-MM-DD"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "自定义",
|
||||||
|
value: "custom",
|
||||||
|
beginDate: "",
|
||||||
|
endDate: "",
|
||||||
|
},
|
||||||
|
];
|
||||||
13
http/api/account/tableOrderStatistic.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import http from "@/http/http.js";
|
||||||
|
const request = http.request;
|
||||||
|
const urlType = "account";
|
||||||
|
|
||||||
|
export function tableOrderStatistic(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/tableOrderStatistic`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
67
http/api/market/member.js
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import http from '@/http/http.js'
|
||||||
|
const request = http.request
|
||||||
|
const urlType='market'
|
||||||
|
|
||||||
|
export function getConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/member`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function editConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/member`,
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function levelList(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/member/level/list`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function orderList(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/member/order`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function levelAdd(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/member/level`,
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function levelEdit(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/member/level`,
|
||||||
|
method: "PUT",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function levelDel(id) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/member/level/${id}`,
|
||||||
|
method: "DELETE",
|
||||||
|
})
|
||||||
|
}
|
||||||
33
http/api/order/summary.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import http from "@/http/http.js";
|
||||||
|
const request = http.request;
|
||||||
|
const urlType = "order";
|
||||||
|
|
||||||
|
export function tableSummaryList(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/table/summary/list`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function saleSummaryPage(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/sale/summary/page`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function saleSummaryCount(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/sale/summary/count`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -15,8 +15,8 @@ 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";
|
||||||
// 设置node环境
|
// 设置node环境
|
||||||
// envConfig.changeEnv(storageManage.env('production'))
|
// envConfig.changeEnv(storageManage.env('production')) //正式
|
||||||
envConfig.changeEnv(storageManage.env("development"));
|
envConfig.changeEnv(storageManage.env("development")); //测试
|
||||||
|
|
||||||
// 测试服
|
// 测试服
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
|
|||||||
3
main.js
@@ -10,6 +10,9 @@ import * as Pinia from 'pinia';
|
|||||||
import {
|
import {
|
||||||
createUnistorage
|
createUnistorage
|
||||||
} from "pinia-plugin-unistorage";
|
} from "pinia-plugin-unistorage";
|
||||||
|
|
||||||
|
uni.$utils=utils
|
||||||
|
|
||||||
// 设置node环境
|
// 设置node环境
|
||||||
envConfig.changeEnv(storageManage.env())
|
envConfig.changeEnv(storageManage.env())
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,11 @@
|
|||||||
<view class="color-333 font-bold">霸王餐</view>
|
<view class="color-333 font-bold">霸王餐</view>
|
||||||
<view class="color-666 u-m-t-4 u-font-24">设置充值消费的N倍,当前订单立即免单</view>
|
<view class="color-666 u-m-t-4 u-font-24">设置充值消费的N倍,当前订单立即免单</view>
|
||||||
</view>
|
</view>
|
||||||
<up-switch v-model="form.enable" size="18"></up-switch>
|
<up-switch v-model="form.enable" size="18"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
:disabled="isMainShop()?false:true"
|
||||||
|
></up-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox"
|
<view class="boxconstantbox"
|
||||||
@@ -80,7 +84,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<my-bottom-btn-group @cancel="cancel" @save="editFreeDing"></my-bottom-btn-group>
|
<my-bottom-btn-group @cancel="cancel" @save="editFreeDing" isOpenPermission></my-bottom-btn-group>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@@ -89,7 +93,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||||
import { reactive, ref, watch } from "vue";
|
import { reactive, ref, watch } from "vue";
|
||||||
|
import { isMainShop } from "@/store/account";
|
||||||
import { getFreeDing, updateFreeDing } from "@/http/api/freeDing.js";
|
import { getFreeDing, updateFreeDing } from "@/http/api/freeDing.js";
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
rechargeTimes: 2,
|
rechargeTimes: 2,
|
||||||
|
|||||||
3
pageChat/index.vue
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<view></view>
|
||||||
|
</template>
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<up-switch
|
<up-switch
|
||||||
v-model="form.isEnable"
|
v-model="form.isEnable"
|
||||||
|
:disabled="isMainShop()?false:true"
|
||||||
size="18"
|
size="18"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0"
|
:inactive-value="0"
|
||||||
@@ -99,7 +100,7 @@
|
|||||||
|
|
||||||
<button class="add u-m-t-32" @click="addcashbackStepList">添加</button>
|
<button class="add u-m-t-32" @click="addcashbackStepList">添加</button>
|
||||||
</view>
|
</view>
|
||||||
<my-bottom-btn-group @save="save" @cancel="cancel"></my-bottom-btn-group>
|
<my-bottom-btn-group @save="save" isOpenPermission @cancel="cancel"></my-bottom-btn-group>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -107,6 +108,7 @@
|
|||||||
import { reactive, computed, onMounted } from "vue";
|
import { reactive, computed, onMounted } from "vue";
|
||||||
import userTypes from "./user-types.vue";
|
import userTypes from "./user-types.vue";
|
||||||
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
||||||
|
import { isMainShop } from "@/store/account";
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onReady,
|
onReady,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex-1 u-p-l-16">
|
<view class="u-flex-1 u-p-l-16">
|
||||||
<up-search bgColor="#F9F9F9" height="60rpx" :showAction="false" placeholder="搜索订单号"
|
<up-search bgColor="#F9F9F9" height="60rpx" :showAction="false" placeholder="搜索订单号"
|
||||||
|
|
||||||
@search="search" @clear="search" v-model="searchText"></up-search>
|
@search="search" @clear="search" v-model="searchText"></up-search>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
<view class="color-999 u-font-24">
|
<view class="color-999 u-font-24">
|
||||||
<view> 关联订单:{{ item.orderNo }} </view>
|
<view> 关联订单:{{ item.orderNo }} </view>
|
||||||
<view class="u-m-t-14">
|
<view class="u-m-t-14">
|
||||||
<text class="color-333 font-bold"> {{ item.shopName }}</text>
|
<text class="color-333 font-bold u-m-r-20"> {{ item.shopName }}</text>
|
||||||
<text class="color-666 u-font-24">{{ item.createTime }}</text>
|
<text class="color-666 u-font-24">{{ item.createTime }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -33,8 +34,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="color-333 u-flex u-row-between u-font-28" style="margin-top: 52rpx">
|
<view class="color-333 u-flex u-row-between u-font-28" style="margin-top: 52rpx">
|
||||||
<view>
|
<view>
|
||||||
<view class="color-666">用户昵称</view>
|
<view class="color-666">{{ item.nickName }}</view>
|
||||||
<view class="color-333 u-m-t-24 u-line-1">{{ item.nickName }}</view>
|
<view class="color-333 u-m-t-24 u-line-1">{{ item.phone }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-text-center">
|
<view class="u-flex u-text-center">
|
||||||
<view>
|
<view>
|
||||||
@@ -69,6 +70,7 @@
|
|||||||
onReachBottom,
|
onReachBottom,
|
||||||
onBackPress,
|
onBackPress,
|
||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
|
import { isMainShop } from "@/store/account.js";
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
onMounted,
|
onMounted,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
<view class="u-p-b-24"></view>
|
<view class="u-p-b-24"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-p-t-48 u-p-b-48 u-p-l-60 u-p-r-60">
|
<view class="u-p-t-48 u-p-b-48 u-p-l-60 u-p-r-60">
|
||||||
<my-button type="primary" shape="circle" @click="save">保存</my-button>
|
<my-button type="primary" shape="circle" @click="save" v-if="isMainShop()">保存</my-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bg-fff default-box-radius">
|
<view class="bg-fff default-box-radius">
|
||||||
@@ -131,7 +131,7 @@ import {
|
|||||||
import couponStatus from "./components/status.vue";
|
import couponStatus from "./components/status.vue";
|
||||||
import CouponList from "@/pageMarket/components/coupon-list.vue";
|
import CouponList from "@/pageMarket/components/coupon-list.vue";
|
||||||
import DateTimePicker from "@/pageMarket/components/date-time-picker.vue";
|
import DateTimePicker from "@/pageMarket/components/date-time-picker.vue";
|
||||||
|
import {isMainShop} from "@/store/account.js";
|
||||||
import Modal from "@/pageMarket/components/modal.vue";
|
import Modal from "@/pageMarket/components/modal.vue";
|
||||||
import * as couponRedemptionApi from "@/http/api/market/couponRedemption.js";
|
import * as couponRedemptionApi from "@/http/api/market/couponRedemption.js";
|
||||||
import { saveFileFromTemp } from "@/utils/downloadFile.js";
|
import { saveFileFromTemp } from "@/utils/downloadFile.js";
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<up-switch
|
<up-switch
|
||||||
v-model="accountInfoStore.shopInfo.isProductSuggest"
|
v-model="accountInfoStore.shopInfo.isProductSuggest"
|
||||||
|
:disabled="isMainShop()?false:true"
|
||||||
|
|
||||||
size="18"
|
size="18"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0"
|
:inactive-value="0"
|
||||||
@@ -68,12 +70,14 @@
|
|||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="height: 100rpx"></view>
|
<template v-if="isMainShop()">
|
||||||
<view class="fixed-bottom">
|
<view style="height: 100rpx"></view>
|
||||||
<my-button @click="go.to('PAGES_MARKET_COUPON_EXCHANGE_CODE_ADD')"
|
<view class="fixed-bottom">
|
||||||
>添加兑换码</my-button
|
<my-button @click="go.to('PAGES_MARKET_COUPON_EXCHANGE_CODE_ADD')"
|
||||||
>
|
>添加兑换码</my-button
|
||||||
</view>
|
>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
v-model="modalData.show"
|
v-model="modalData.show"
|
||||||
@@ -116,13 +120,14 @@ import Modal from "@/pageMarket/components/modal.vue";
|
|||||||
import * as couponRedemptionApi from "@/http/api/market/couponRedemption.js";
|
import * as couponRedemptionApi from "@/http/api/market/couponRedemption.js";
|
||||||
import { useAccountInfoStore } from "@/store/account.js";
|
import { useAccountInfoStore } from "@/store/account.js";
|
||||||
import go from "@/commons/utils/go.js";
|
import go from "@/commons/utils/go.js";
|
||||||
|
import { isMainShop } from "@/store/account.js";
|
||||||
const accountInfoStore = useAccountInfoStore();
|
const accountInfoStore = useAccountInfoStore();
|
||||||
import { ref, reactive, onMounted, computed, watch } from "vue";
|
import { ref, reactive, onMounted, computed, watch } from "vue";
|
||||||
const loadFinish = ref(false);
|
const loadFinish = ref(false);
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
isEnable: 0,
|
isEnable: 0,
|
||||||
useType: "all",
|
useType: "all",
|
||||||
shopIdList:[]
|
shopIdList: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const actions = [
|
const actions = [
|
||||||
@@ -223,7 +228,7 @@ const handleConfirm = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
couponRedemptionApi.enable({
|
couponRedemptionApi.enable({
|
||||||
shopIdList: form.shopIdList||[],
|
shopIdList: form.shopIdList || [],
|
||||||
useType: form.useType,
|
useType: form.useType,
|
||||||
isEnable: form.isEnable,
|
isEnable: form.isEnable,
|
||||||
});
|
});
|
||||||
@@ -261,6 +266,7 @@ function getShopInfo() {
|
|||||||
watch(
|
watch(
|
||||||
() => accountInfoStore.shopInfo.isProductSuggest,
|
() => accountInfoStore.shopInfo.isProductSuggest,
|
||||||
(newVal, oldVal) => {
|
(newVal, oldVal) => {
|
||||||
|
if(!isMainShop()) return;
|
||||||
if (!loadFinish.value) return;
|
if (!loadFinish.value) return;
|
||||||
accountInfoStore.editShopInfo({
|
accountInfoStore.editShopInfo({
|
||||||
isProductSuggest: newVal,
|
isProductSuggest: newVal,
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
class="number-box"
|
class="number-box"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
placeholder-class="color-999 u-font-28"
|
placeholder-class="color-999 u-font-28"
|
||||||
type="number"
|
type="digit"
|
||||||
|
|
||||||
v-model="form.payAmount"
|
v-model="form.payAmount"
|
||||||
/>
|
/>
|
||||||
@@ -264,7 +264,10 @@ function setForm(data) {
|
|||||||
console.log(form);
|
console.log(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {});
|
onMounted(() => {
|
||||||
|
setForm(distributionStore.config);
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -57,6 +57,9 @@
|
|||||||
<view class="u-m-t-16 u-p-b-8">
|
<view class="u-m-t-16 u-p-b-8">
|
||||||
<view class="u-flex u-m-t-16">
|
<view class="u-flex u-m-t-16">
|
||||||
<input
|
<input
|
||||||
|
:disabled="index==0?true:false"
|
||||||
|
:class="{'disabled':index==0?true:false}"
|
||||||
|
|
||||||
class="number-box"
|
class="number-box"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
placeholder-class="color-999 u-font-28"
|
placeholder-class="color-999 u-font-28"
|
||||||
@@ -76,6 +79,8 @@
|
|||||||
<view class="u-flex u-m-t-16">
|
<view class="u-flex u-m-t-16">
|
||||||
<input
|
<input
|
||||||
class="number-box"
|
class="number-box"
|
||||||
|
:disabled="index==0?true:false"
|
||||||
|
:class="{'disabled':index==0?true:false}"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
placeholder-class="color-999 u-font-28"
|
placeholder-class="color-999 u-font-28"
|
||||||
type="digit"
|
type="digit"
|
||||||
@@ -271,7 +276,13 @@ function cancel(){
|
|||||||
}
|
}
|
||||||
onLoad(()=>{
|
onLoad(()=>{
|
||||||
showDetailListSwitch.value=distributionStore.config.levelConfigList.map(()=>true)
|
showDetailListSwitch.value=distributionStore.config.levelConfigList.map(()=>true)
|
||||||
form.levelConfigList=[...distributionStore.config.levelConfigList||[]]
|
const levelConfigList=[...distributionStore.config.levelConfigList||[]]
|
||||||
|
form.levelConfigList=levelConfigList.length?levelConfigList:[
|
||||||
|
{ name:'',
|
||||||
|
levelOneCommission:'',
|
||||||
|
inviteCount:0,
|
||||||
|
costAmount:0}
|
||||||
|
]
|
||||||
form.upgradeType=distributionStore.config.upgradeType
|
form.upgradeType=distributionStore.config.upgradeType
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -303,6 +314,10 @@ $height: 70rpx;
|
|||||||
height: $height;
|
height: $height;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
line-height: $height;
|
line-height: $height;
|
||||||
|
&.disabled{
|
||||||
|
background-color: #f7f7fa;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.unit {
|
.unit {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</text>
|
</text>
|
||||||
<text class="t">折扣:{{ item.discountRate }}%</text>
|
<text class="t">折扣:{{ item.discountRate }}%</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="footer">
|
<view class="footer" v-if="isMainShop()">
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
||||||
</view>
|
</view>
|
||||||
@@ -49,7 +49,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";
|
||||||
// 去编辑
|
// 去编辑
|
||||||
function editorHandle(item) {
|
function editorHandle(item) {
|
||||||
uni.setStorageSync('limitDiscountObj', item);
|
uni.setStorageSync('limitDiscountObj', item);
|
||||||
|
|||||||
@@ -157,7 +157,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import Modal from "@/pageMarket/components/modal.vue";
|
import Modal from "@/pageMarket/components/modal.vue";
|
||||||
|
|
||||||
import { ref, reactive, computed, watch, onMounted } from "vue";
|
import { ref, reactive, computed, watch, onMounted ,nextTick} from "vue";
|
||||||
import { useNewUserDiscountStore } from "@/store/market.js";
|
import { useNewUserDiscountStore } from "@/store/market.js";
|
||||||
|
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
@@ -190,7 +190,7 @@ function addItem() {
|
|||||||
}
|
}
|
||||||
function editItem(index) {
|
function editItem(index) {
|
||||||
modalData.index = index;
|
modalData.index = index;
|
||||||
modalData.form = form.randomDiscountList[index];
|
modalData.form = {...form.randomDiscountList[index]}
|
||||||
modalData.show = true;
|
modalData.show = true;
|
||||||
modalData.key = "edit";
|
modalData.key = "edit";
|
||||||
modalData.title = "编辑方案";
|
modalData.title = "编辑方案";
|
||||||
@@ -299,7 +299,10 @@ async function init() {
|
|||||||
};
|
};
|
||||||
console.log(data);
|
console.log(data);
|
||||||
Object.assign(form, data);
|
Object.assign(form, data);
|
||||||
isLoading.value = false;
|
nextTick(() => {
|
||||||
|
isLoading.value = false;
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -230,7 +230,6 @@ onReachBottom(() => {
|
|||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
|
||||||
getShopInfo();
|
getShopInfo();
|
||||||
});
|
});
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="u-p-t-48 u-p-b-48 u-p-l-60 u-p-r-60">
|
<view class="u-p-t-48 u-p-b-48 u-p-l-60 u-p-r-60" v-if="isMainShop()">
|
||||||
<my-button type="primary" shape="circle" @click="save">保存</my-button>
|
<my-button type="primary" shape="circle" @click="save">保存</my-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ import {
|
|||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
import couponStatus from "./components/status.vue";
|
import couponStatus from "./components/status.vue";
|
||||||
import CouponList from "@/pageMarket/components/coupon-list.vue";
|
import CouponList from "@/pageMarket/components/coupon-list.vue";
|
||||||
|
import {isMainShop} from "@/store/account.js";
|
||||||
import Modal from "@/pageMarket/components/modal.vue";
|
import Modal from "@/pageMarket/components/modal.vue";
|
||||||
import * as rechargeRedemptionApi from "@/http/api/market/rechargeRedemption.js";
|
import * as rechargeRedemptionApi from "@/http/api/market/rechargeRedemption.js";
|
||||||
import { saveFileFromTemp } from "@/utils/downloadFile.js";
|
import { saveFileFromTemp } from "@/utils/downloadFile.js";
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<up-switch
|
<up-switch
|
||||||
v-model="accountInfoStore.shopInfo.isProductSuggest"
|
v-model="accountInfoStore.shopInfo.isProductSuggest"
|
||||||
size="18"
|
size="18"
|
||||||
|
:disabled="isMainShop()?false:true"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0"
|
:inactive-value="0"
|
||||||
></up-switch>
|
></up-switch>
|
||||||
@@ -81,12 +82,15 @@
|
|||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="height: 100rpx"></view>
|
<template v-if="isMainShop()">
|
||||||
|
<view style="height: 100rpx"></view>
|
||||||
<view class="fixed-bottom">
|
<view class="fixed-bottom">
|
||||||
<my-button @click="go.to('PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD')"
|
<my-button @click="go.to('PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD')"
|
||||||
>添加兑换码</my-button
|
>添加兑换码</my-button
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
v-model="modalData.show"
|
v-model="modalData.show"
|
||||||
@@ -129,6 +133,7 @@ import Modal from "@/pageMarket/components/modal.vue";
|
|||||||
import * as rechargeRedemptionApi from "@/http/api/market/rechargeRedemption.js";
|
import * as rechargeRedemptionApi from "@/http/api/market/rechargeRedemption.js";
|
||||||
import { useAccountInfoStore } from "@/store/account.js";
|
import { useAccountInfoStore } from "@/store/account.js";
|
||||||
import go from "@/commons/utils/go.js";
|
import go from "@/commons/utils/go.js";
|
||||||
|
import {isMainShop} from "@/store/account.js";
|
||||||
const accountInfoStore = useAccountInfoStore();
|
const accountInfoStore = useAccountInfoStore();
|
||||||
import { ref, reactive, onMounted, computed, watch } from "vue";
|
import { ref, reactive, onMounted, computed, watch } from "vue";
|
||||||
const loadFinish = ref(false);
|
const loadFinish = ref(false);
|
||||||
@@ -274,6 +279,7 @@ function getShopInfo() {
|
|||||||
watch(
|
watch(
|
||||||
() => accountInfoStore.shopInfo.isProductSuggest,
|
() => accountInfoStore.shopInfo.isProductSuggest,
|
||||||
(newVal, oldVal) => {
|
(newVal, oldVal) => {
|
||||||
|
if(!isMainShop()) return;
|
||||||
if (!loadFinish.value) return;
|
if (!loadFinish.value) return;
|
||||||
accountInfoStore.editShopInfo({
|
accountInfoStore.editShopInfo({
|
||||||
isProductSuggest: newVal,
|
isProductSuggest: newVal,
|
||||||
|
|||||||
BIN
pageMarket/static/images/member.png
Normal file
|
After Width: | Height: | Size: 936 B |
287
pageMarket/superVip/add-plans.vue
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
<template>
|
||||||
|
<view class="min-page u-font-28 color-333">
|
||||||
|
<view class="container">
|
||||||
|
<view class="">
|
||||||
|
<view class="font-bold u-m-b-16">周期名称</view>
|
||||||
|
<up-input
|
||||||
|
v-model="form.name"
|
||||||
|
placeholder="请输入周期名称"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></up-input>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="font-bold u-m-b-16">周期价格</view>
|
||||||
|
<view class="u-flex">
|
||||||
|
<input class="number-box" type="digit" v-model="form.price" />
|
||||||
|
<view class="unit">元</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="font-bold u-m-b-16">周期时间</view>
|
||||||
|
<view class="u-flex" style="gap: 24rpx; align-items: stretch">
|
||||||
|
<up-input type="digit" v-model="form.circleTime"></up-input>
|
||||||
|
<view class="times">
|
||||||
|
<up-select
|
||||||
|
v-model:current="form.circleUnit"
|
||||||
|
showOptionsLabel
|
||||||
|
label="单位"
|
||||||
|
keyName="value"
|
||||||
|
labelName="label"
|
||||||
|
:options="times"
|
||||||
|
@select="selectItem"
|
||||||
|
></up-select>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="font-bold u-m-b-16">赠送成长值</view>
|
||||||
|
<up-input
|
||||||
|
type="number"
|
||||||
|
v-model="form.reward"
|
||||||
|
placeholder="赠送成长值"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></up-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="container">
|
||||||
|
<view class="font-bold u-m-b-16">赠送优惠券</view>
|
||||||
|
<CouponList v-model="form.couponList"></CouponList>
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="u-flex gap-20" @click="addCoupon()">
|
||||||
|
<up-icon name="plus-circle-fill" color="#318AFE" size="16"></up-icon>
|
||||||
|
<text class="">添加</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<my-bottom-btn-group @save="save" @cancel="cancel"></my-bottom-btn-group>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow,
|
||||||
|
onPageScroll,
|
||||||
|
onReachBottom,
|
||||||
|
onBackPress,
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
|
import CouponList from "./components/coupon-list.vue";
|
||||||
|
import { ref, onMounted, watch, reactive, computed } from "vue";
|
||||||
|
import { useSuperVipStore } from "@/store/market.js";
|
||||||
|
import { add } from "lodash";
|
||||||
|
const times = [
|
||||||
|
{
|
||||||
|
label: "年",
|
||||||
|
value: "年",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "月",
|
||||||
|
value: "月",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "周",
|
||||||
|
value: "周",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "天",
|
||||||
|
value: "天",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const placeholderStyle = {
|
||||||
|
"font-size": "28rpx",
|
||||||
|
};
|
||||||
|
const superVipStore = useSuperVipStore();
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
name: "",
|
||||||
|
price: 0,
|
||||||
|
reward: 0,
|
||||||
|
couponList: [], // 存储已选择的优惠券
|
||||||
|
circleTime: 1, // 会员周期
|
||||||
|
circleUnit: "月", // 会员周期单位
|
||||||
|
});
|
||||||
|
function addCoupon() {
|
||||||
|
form.couponList.push({
|
||||||
|
coupon: { id: null },
|
||||||
|
num: "",
|
||||||
|
title: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const showDetailListSwitch = ref([true]);
|
||||||
|
|
||||||
|
//判断输入每一项是否为空
|
||||||
|
function checkInput() {
|
||||||
|
for (let item of form.couponList) {
|
||||||
|
if (!item.coupon.id) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请选择优惠券",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!item.num) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请输入优惠券数量",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
async function save() {
|
||||||
|
const isPas = checkInput();
|
||||||
|
if (!isPas) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!form.name) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请输入周期名称",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!form.price) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请输入周期价格",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!form.circleTime) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请输入周期时间",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optiopns.type == "edit") {
|
||||||
|
superVipStore.editPlan(optiopns.index, form);
|
||||||
|
} else {
|
||||||
|
superVipStore.addPlan(form);
|
||||||
|
}
|
||||||
|
const res = await superVipStore.editConfig();
|
||||||
|
if (res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "保存成功",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: "保存失败",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
function cancel() {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const optiopns = reactive({});
|
||||||
|
onLoad((opt) => {
|
||||||
|
Object.assign(optiopns, opt);
|
||||||
|
if (opt.type === "edit" && opt.index !== undefined && opt.index !== null) {
|
||||||
|
const item = superVipStore.config.configList[opt.index];
|
||||||
|
Object.assign(form, item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.min-page {
|
||||||
|
background: #f7f7f7;
|
||||||
|
padding: 56rpx 28rpx;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
background: #fff;
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
.x-padding {
|
||||||
|
padding: 0 24rpx;
|
||||||
|
}
|
||||||
|
$height: 70rpx;
|
||||||
|
.number-box {
|
||||||
|
font-size: 28rpx;
|
||||||
|
padding: 0 26rpx;
|
||||||
|
border-radius: 6rpx 0 0 6rpx;
|
||||||
|
border-top: 2rpx solid #d9d9d9;
|
||||||
|
border-bottom: 2rpx solid #d9d9d9;
|
||||||
|
border-left: 2rpx solid #d9d9d9;
|
||||||
|
background: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: $height;
|
||||||
|
flex: 1;
|
||||||
|
line-height: $height;
|
||||||
|
&.disabled {
|
||||||
|
background-color: #f7f7fa;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.unit {
|
||||||
|
display: flex;
|
||||||
|
padding: 0 38rpx;
|
||||||
|
height: $height;
|
||||||
|
line-height: $height;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 0 6rpx 6rpx 0;
|
||||||
|
border: 2rpx solid #d9d9d9;
|
||||||
|
background: #f7f7fa;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-btn {
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-btn {
|
||||||
|
background: #e6f0ff;
|
||||||
|
color: $my-main-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-btn {
|
||||||
|
background: #ffe7e6;
|
||||||
|
color: #ff1c1c;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #333;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.first {
|
||||||
|
border-bottom: 2rpx solid #e5e5e5;
|
||||||
|
}
|
||||||
|
.arrow {
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
&.rotate {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.times {
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
display: flex;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
:deep(.times .u-select) {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
336
pageMarket/superVip/components/config.vue
Normal file
@@ -0,0 +1,336 @@
|
|||||||
|
<template>
|
||||||
|
<view class="box">
|
||||||
|
<view class="u-m-t-32 container" style="padding-left: 0; padding-right: 0">
|
||||||
|
<view class="x-padding">
|
||||||
|
<view class="u-flex u-row-between custome">
|
||||||
|
<text class="font-bold color-333">提交生日/姓名</text>
|
||||||
|
<up-radio-group v-model="form.isSubmitInfo" placement="row">
|
||||||
|
<up-radio :key="1" :name="1">
|
||||||
|
<template #label>
|
||||||
|
<text> 是 </text>
|
||||||
|
</template>
|
||||||
|
</up-radio>
|
||||||
|
<up-radio :key="0" :name="0">
|
||||||
|
<template #label>
|
||||||
|
<text> 否 </text>
|
||||||
|
</template>
|
||||||
|
</up-radio>
|
||||||
|
</up-radio-group>
|
||||||
|
</view>
|
||||||
|
<view class="color-999 u-font-24 u-m-t-10"
|
||||||
|
>*成为会员前需提交生日、姓名、性别信息</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-32 container" style="padding-left: 0; padding-right: 0">
|
||||||
|
<view class="x-padding">
|
||||||
|
<view class="u-flex u-row-between custome">
|
||||||
|
<text class="font-bold color-333">会员开通方式</text>
|
||||||
|
<up-radio-group v-model="form.openType" placement="row">
|
||||||
|
<up-radio key="PAY" name="PAY">
|
||||||
|
<template #label>
|
||||||
|
<text> 购买开通 </text>
|
||||||
|
</template>
|
||||||
|
</up-radio>
|
||||||
|
<up-radio key="CONDITION" name="CONDITION">
|
||||||
|
<template #label>
|
||||||
|
<text> 条件开通 </text>
|
||||||
|
</template>
|
||||||
|
</up-radio>
|
||||||
|
</up-radio-group>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-24">
|
||||||
|
<up-line></up-line>
|
||||||
|
</view>
|
||||||
|
<template v-if="form.openType == 'PAY'">
|
||||||
|
<view
|
||||||
|
class="u-flex u-row-between u-p-t-26"
|
||||||
|
@click="go.to('PAGES_MARKET_SUPER_VIP_VIP_PLANS')"
|
||||||
|
>
|
||||||
|
<text class="font-bold color-333">会员周期列表</text>
|
||||||
|
<view class="u-flex">
|
||||||
|
<text class="u-font-24 color-main">去设置</text>
|
||||||
|
<up-icon name="arrow-right" color="#318AFE"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-if="form.openType == 'CONDITION'">
|
||||||
|
<view class="u-flex u-row-between u-col-baseline u-m-t-32">
|
||||||
|
<text class="font-bold color-333">成为会员条件</text>
|
||||||
|
<view class="u-flex-1 u-p-l-32">
|
||||||
|
<view v-for="(item, index) in conditionLists" :key="index">
|
||||||
|
<up-checkbox usedAlone v-model:checked="item.checked">
|
||||||
|
<template #label>
|
||||||
|
<view> {{ item.label }} </view>
|
||||||
|
</template>
|
||||||
|
</up-checkbox>
|
||||||
|
<view class="u-m-t-24 u-m-b-24">
|
||||||
|
<up-number-box
|
||||||
|
:inputWidth="100"
|
||||||
|
:decimalLength="item.precision || 0"
|
||||||
|
v-if="item.label != '绑定手机号' && item.checked"
|
||||||
|
v-model="item.value"
|
||||||
|
:step="item.step"
|
||||||
|
:min="item.min || 0"
|
||||||
|
></up-number-box>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 container">
|
||||||
|
<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="font-bold color-333 u-m-b-16">规则说明</view>
|
||||||
|
<up-textarea
|
||||||
|
v-model="form.remark"
|
||||||
|
placeholder="请输入规则说明"
|
||||||
|
></up-textarea>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-32 container">
|
||||||
|
<view class="font-bold color-333">获取成长值升级</view>
|
||||||
|
<view class="u-m-t-6 color-999 u-font-24"
|
||||||
|
>*两个条件必选有一条是大于0的数值</view
|
||||||
|
>
|
||||||
|
<view class="u-flex u-m-t-26 gap-20">
|
||||||
|
<text>每消费1元获得成长值</text>
|
||||||
|
<up-number-box
|
||||||
|
v-model="form.costReward"
|
||||||
|
inputWidth="80"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
></up-number-box>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-26 gap-20">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, computed, onMounted, ref, inject, watch } from "vue";
|
||||||
|
import userTypes from "./user-types.vue";
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow,
|
||||||
|
onPageScroll,
|
||||||
|
onReachBottom,
|
||||||
|
onBackPress,
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
|
import go from "@/commons/utils/go.js";
|
||||||
|
|
||||||
|
const conditionLists = ref([
|
||||||
|
{ label: "绑定手机号", checked: false, code: "BIND_PHONE" },
|
||||||
|
{
|
||||||
|
label: "订单达成指定次数",
|
||||||
|
checked: false,
|
||||||
|
value: "",
|
||||||
|
code: "ORDER",
|
||||||
|
step: 1,
|
||||||
|
stepStrictly: true,
|
||||||
|
min: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "消费达到指定金额",
|
||||||
|
checked: false,
|
||||||
|
value: "",
|
||||||
|
code: "COST_AMOUNT",
|
||||||
|
precision: 2,
|
||||||
|
min: 0.01,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "充值达到指定金额",
|
||||||
|
checked: false,
|
||||||
|
value: "",
|
||||||
|
code: "RECHARGE_AMOUNT",
|
||||||
|
precision: 2,
|
||||||
|
min: 0.01,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const superVipStore = inject("superVipStore");
|
||||||
|
|
||||||
|
//分销奖励次数
|
||||||
|
const isLimitCount = ref(0);
|
||||||
|
const isLimitCounts = [
|
||||||
|
{
|
||||||
|
value: 0,
|
||||||
|
label: "限制",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: "不限制",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
//开通方式
|
||||||
|
const opentypes = [
|
||||||
|
{
|
||||||
|
value: "auto",
|
||||||
|
label: "自动开通",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "manual",
|
||||||
|
label: "手动开通",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "pay",
|
||||||
|
label: "付费开通",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const form = reactive({
|
||||||
|
isSubmitInfo: 1,
|
||||||
|
openType: "PAY",
|
||||||
|
configList: [],
|
||||||
|
memberPriceShopType: "ALL",
|
||||||
|
remark: "",
|
||||||
|
costReward: 0,
|
||||||
|
rechargeReward: 0,
|
||||||
|
memberPriceShopIdList: [],
|
||||||
|
isMemberPrice: 1,
|
||||||
|
isOpen: 0,
|
||||||
|
});
|
||||||
|
watch(
|
||||||
|
() => isLimitCount.value,
|
||||||
|
(newval) => {
|
||||||
|
if (newval) {
|
||||||
|
form.rewardCount = -1;
|
||||||
|
} else {
|
||||||
|
form.rewardCount = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
console.log(form);
|
||||||
|
const submitData = {
|
||||||
|
...form,
|
||||||
|
};
|
||||||
|
const res = await superVipStore.editConfig(submitData);
|
||||||
|
uni.showToast({
|
||||||
|
title: "更新成功",
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function cancel() {
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
() => superVipStore.config,
|
||||||
|
(newval) => {
|
||||||
|
setForm(newval);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function setForm(data) {
|
||||||
|
if (data.rewardCount == -1) {
|
||||||
|
isLimitCount.value = 1;
|
||||||
|
}
|
||||||
|
Object.assign(form, data);
|
||||||
|
console.log(form);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setForm(superVipStore.config);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.x-padding {
|
||||||
|
padding: 0 24rpx;
|
||||||
|
}
|
||||||
|
.text-tips {
|
||||||
|
color: #999999;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 0 28rpx;
|
||||||
|
border-radius: 6rpx 0 0 6rpx;
|
||||||
|
border: 2rpx solid #d9d9d9;
|
||||||
|
background-color: #f7f7fa;
|
||||||
|
line-height: 60rpx;
|
||||||
|
}
|
||||||
|
.text-tips1 {
|
||||||
|
border-radius: 0 6rpx 6rpx 0;
|
||||||
|
}
|
||||||
|
.gap-40 {
|
||||||
|
gap: 40rpx;
|
||||||
|
}
|
||||||
|
.my-input {
|
||||||
|
border: 2rpx solid #d9d9d9;
|
||||||
|
height: 60rpx;
|
||||||
|
border-right: none;
|
||||||
|
width: 240rpx;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0 2px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.box {
|
||||||
|
padding: 0 28rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
background: #fff;
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.add {
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background: #318afe;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 56rpx;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.color-red {
|
||||||
|
color: #ff2f2f;
|
||||||
|
}
|
||||||
|
$height: 70rpx;
|
||||||
|
.number-box {
|
||||||
|
font-size: 28rpx;
|
||||||
|
padding: 0 26rpx;
|
||||||
|
border-radius: 6rpx 0 0 6rpx;
|
||||||
|
border-top: 2rpx solid #d9d9d9;
|
||||||
|
border-bottom: 2rpx solid #d9d9d9;
|
||||||
|
border-left: 2rpx solid #d9d9d9;
|
||||||
|
background: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: $height;
|
||||||
|
flex: 1;
|
||||||
|
line-height: $height;
|
||||||
|
}
|
||||||
|
.unit {
|
||||||
|
display: flex;
|
||||||
|
padding: 0 38rpx;
|
||||||
|
height: $height;
|
||||||
|
line-height: $height;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 0 6rpx 6rpx 0;
|
||||||
|
border: 2rpx solid #d9d9d9;
|
||||||
|
background: #f7f7fa;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
:deep(.custome .u-radio-group) {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
110
pageMarket/superVip/components/coupon-list.vue
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view
|
||||||
|
class="u-flex u-row-between u-m-b-24"
|
||||||
|
style="gap: 40rpx"
|
||||||
|
v-for="(item, index) in modelValue"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="choose-coupon u-flex-1 u-flex u-row-between"
|
||||||
|
@click="showCoupon(item, index)"
|
||||||
|
>
|
||||||
|
<template v-if="item.coupon.title">
|
||||||
|
<text>{{ item.coupon.title }}</text>
|
||||||
|
<view class="u-flex" @click.stop="clearCoupon(index)">
|
||||||
|
<up-icon name="close" size="14"></up-icon>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<text class="color-999">选择赠送券</text>
|
||||||
|
<up-icon name="arrow-down" size="14"></up-icon>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1 u-flex">
|
||||||
|
<view class="u-flex-1 input-number-box u-flex">
|
||||||
|
<input
|
||||||
|
class="u-flex-1 input"
|
||||||
|
type="number"
|
||||||
|
v-model="item.num"
|
||||||
|
placeholder=""
|
||||||
|
placeholder-class="color-999 u-font-28"
|
||||||
|
/>
|
||||||
|
<text class="no-wrap color-999 number">数量</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-l-20">
|
||||||
|
<up-icon
|
||||||
|
name="minus-circle-fill"
|
||||||
|
color="#EB4F4F"
|
||||||
|
size="18"
|
||||||
|
@click="removeCoupon(index)"
|
||||||
|
></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<chooseCoupon
|
||||||
|
v-model="chooseCouponData.couponId"
|
||||||
|
v-model:show="chooseCouponData.show"
|
||||||
|
@confirm="confirmCoupon"
|
||||||
|
:list="couponList"
|
||||||
|
></chooseCoupon>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, onMounted } from "vue";
|
||||||
|
import chooseCoupon from "@/pageMarket/components/choose-coupon.vue";
|
||||||
|
import { couponPage } from "@/http/api/market/index.js";
|
||||||
|
|
||||||
|
const chooseCouponData = reactive({
|
||||||
|
couponId: "",
|
||||||
|
show: false,
|
||||||
|
index: -1,
|
||||||
|
item: null,
|
||||||
|
});
|
||||||
|
const modelValue = defineModel({
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
});
|
||||||
|
|
||||||
|
function clearCoupon(index) {
|
||||||
|
modelValue.value[index].coupon = { id: null };
|
||||||
|
}
|
||||||
|
const couponList = ref([]);
|
||||||
|
function showCoupon(item, index) {
|
||||||
|
chooseCouponData.couponId = item ? item.id : "";
|
||||||
|
chooseCouponData.show = true;
|
||||||
|
chooseCouponData.index = index;
|
||||||
|
chooseCouponData.item = item;
|
||||||
|
}
|
||||||
|
function confirmCoupon(e) {
|
||||||
|
modelValue.value[chooseCouponData.index].coupon = e
|
||||||
|
}
|
||||||
|
function removeCoupon(index) {
|
||||||
|
modelValue.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
couponPage({ size: 999 }).then((res) => {
|
||||||
|
couponList.value = res.records;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.choose-coupon {
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
}
|
||||||
|
.input-number-box {
|
||||||
|
border-radius: 8rpx;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
.input {
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.number {
|
||||||
|
background-color: #f7f7fa;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
197
pageMarket/superVip/components/fenxiao-mingxi.vue
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
<template>
|
||||||
|
<view class="list u-font-28">
|
||||||
|
<view class="u-m-t-32 item" v-for="item in list" :key="item.id">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="color-666 u-font-24 u-flex">
|
||||||
|
<text class="no-wrap"> 关联订单:</text>
|
||||||
|
<text> {{ item.orderNo }} </text>
|
||||||
|
</view>
|
||||||
|
<view class="status" :class="[item.status]">
|
||||||
|
{{ returnStatus(item.status) }}</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-16">
|
||||||
|
<view>
|
||||||
|
<view class="color-333 u-font-28 u-flex u-line-1">
|
||||||
|
<text class="font-bold"> 分销员 </text>
|
||||||
|
<text class="color-666 u-font-24 u-m-l-28">
|
||||||
|
{{ item.nickName }}
|
||||||
|
</text>
|
||||||
|
<text class="color-666 u-font-24 u-m-l-10"> {{ item.phone }} </text>
|
||||||
|
</view>
|
||||||
|
<view class="color-333 u-font-28 u-flex u-m-t-16 u-line-1">
|
||||||
|
<text class="font-bold"> 下级用户 </text>
|
||||||
|
<text class="color-666 u-font-24 u-m-l-28">
|
||||||
|
{{ item.sourceNickName }}
|
||||||
|
</text>
|
||||||
|
<text class="color-666 u-font-24 u-m-l-10"> {{ item.sourcePhone }} </text>
|
||||||
|
</view>
|
||||||
|
<view class="color-333 u-font-28 u-flex u-m-t-16 u-line-1">
|
||||||
|
<text class="font-bold"> 创建时间 </text>
|
||||||
|
<text class="color-666 u-font-24 u-m-l-28">
|
||||||
|
{{ item.sourceNickName }}
|
||||||
|
</text>
|
||||||
|
<text class="color-666 u-font-24 u-m-l-10"> {{ item.createTime }} </text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view
|
||||||
|
class="text-center color-main font-bold"
|
||||||
|
:class="[ item.status == 'refund' ? 'color-red' : '']"
|
||||||
|
>{{ item.rewardAmount }}</view
|
||||||
|
>
|
||||||
|
<view class="color-66 u-font-24">{{
|
||||||
|
item.level == 1 ? "直接分成" : "间接分成"
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-p-30">
|
||||||
|
<up-loadmore :status="isEnd ? 'nomore' : 'loading'"></up-loadmore>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
watch,
|
||||||
|
toRaw,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
inject,
|
||||||
|
} from "vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
isEnd: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const statusMap = {
|
||||||
|
success: "已入账",
|
||||||
|
refund: "已退款",
|
||||||
|
pending: "待入账",
|
||||||
|
};
|
||||||
|
function returnStatus(status) {
|
||||||
|
return status in statusMap ? statusMap[status] : status;
|
||||||
|
}
|
||||||
|
|
||||||
|
const $actions = [
|
||||||
|
{
|
||||||
|
name: "更改分销组",
|
||||||
|
value: "change-group",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "重置分销组",
|
||||||
|
value: "reset-group",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "恢复分销员",
|
||||||
|
value: "back-fenxiao",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "取消分销员",
|
||||||
|
value: "cancel-fenxiao",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const actions = ref($actions);
|
||||||
|
|
||||||
|
const emits = defineEmits(["refresh"]);
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.list {
|
||||||
|
padding: 0 30rpx;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 8rpx 22rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background-color: #edfff0;
|
||||||
|
color: #5bbc6d;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.end {
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-btn {
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.money {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
padding: 16rpx 28rpx;
|
||||||
|
}
|
||||||
|
.more {
|
||||||
|
display: flex;
|
||||||
|
height: 56rpx;
|
||||||
|
padding: 8rpx 28rpx;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 28rpx;
|
||||||
|
border: 2rpx solid $my-main-color;
|
||||||
|
color: $my-main-color;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(env(safe-area-inset-bottom) + 30rpx);
|
||||||
|
left: 30rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
}
|
||||||
|
.status {
|
||||||
|
display: flex;
|
||||||
|
padding: 8rpx 18rpx;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
border-radius: 0 0 8rpx 8rpx;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
&.success {
|
||||||
|
color: rgba(123, 209, 54, 1);
|
||||||
|
border-color: rgba(123, 209, 54, 1);
|
||||||
|
background-color: rgba(123, 209, 54, 0.12);
|
||||||
|
}
|
||||||
|
&.refund {
|
||||||
|
border-color: rgba(249, 50, 40, 1);
|
||||||
|
background-color: rgba(209, 64, 54, 0.12);
|
||||||
|
color: rgba(255, 47, 47, 1);
|
||||||
|
}
|
||||||
|
&.pending {
|
||||||
|
border-color: rgba(153, 153, 153, 1);
|
||||||
|
background-color: rgba(153, 153, 153, 0.12);
|
||||||
|
color: rgba(153, 153, 153, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.color-red {
|
||||||
|
color: #ff2f2f;
|
||||||
|
}
|
||||||
|
.text-center{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
258
pageMarket/superVip/components/open-list.vue
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
<template>
|
||||||
|
<view class="list u-font-28">
|
||||||
|
<view class="u-m-t-32 item" v-for="item in list" :key="item.id">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="color-666 u-font-24 u-flex">
|
||||||
|
<text class="no-wrap"> 订单号:</text>
|
||||||
|
<text> {{ item.orderNo }} </text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-flex u-row-between">
|
||||||
|
<view class="color-333 u-font-28">
|
||||||
|
<view>
|
||||||
|
<text> {{ item.nickName }} </text>
|
||||||
|
<text> {{ item.phone }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-8 color-999 u-font-24">
|
||||||
|
<view>{{ item.createTime }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="text-center">
|
||||||
|
<view class="color-red u-font-32 font-700">
|
||||||
|
{{ item.amount }}
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-2 color-999 u-font-24">
|
||||||
|
<view>{{ item.circleTime }}个{{ item.circleUnit }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-p-30">
|
||||||
|
<up-loadmore :status="isEnd ? 'nomore' : 'loading'"></up-loadmore>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<up-action-sheet
|
||||||
|
:show="showActions"
|
||||||
|
:actions="actions"
|
||||||
|
@select="handleSelect"
|
||||||
|
@close="showActions = false"
|
||||||
|
cancel-text="取消"
|
||||||
|
></up-action-sheet>
|
||||||
|
<Modal
|
||||||
|
v-model="modalData.show"
|
||||||
|
:title="modalData.title"
|
||||||
|
@confirm="handleConfirm"
|
||||||
|
>
|
||||||
|
<view class="u-p-48" v-if="modalData.key == 'change-group'">
|
||||||
|
<view class="u-m-r-36 u-m-b-24">分销组</view>
|
||||||
|
<up-radio-group v-model="group" placement="row" place="row">
|
||||||
|
<up-radio
|
||||||
|
v-for="item in distributionStore.config.levelConfigList"
|
||||||
|
:key="item.id"
|
||||||
|
:name="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
<text>
|
||||||
|
{{ item.name }}
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
</up-radio>
|
||||||
|
</up-radio-group>
|
||||||
|
</view>
|
||||||
|
<view class="u-p-48 u-flex" v-if="modalData.key == 'reset-group'">
|
||||||
|
<up-icon name="info-circle" color="#FF2F2F" size="20"></up-icon>
|
||||||
|
<view class="u-font-32 color-333 u-m-l-20"
|
||||||
|
>是否确认重置分销组 重置后将会按照用户的实际数据匹配分销组</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
<view class="u-p-48 u-flex" v-if="modalData.key == 'cancel-group'">
|
||||||
|
<up-icon name="info-circle" color="#FF2F2F" size="20"></up-icon>
|
||||||
|
<view class="u-font-32 color-333 u-m-l-20">是否确认取消分销员</view>
|
||||||
|
</view>
|
||||||
|
</Modal>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
watch,
|
||||||
|
toRaw,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
inject,
|
||||||
|
} from "vue";
|
||||||
|
import go from "@/commons/utils/go.js";
|
||||||
|
|
||||||
|
import Modal from "@/pageMarket/components/modal.vue";
|
||||||
|
const props = defineProps({
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
isEnd: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
//选中的分销组
|
||||||
|
const group = ref("");
|
||||||
|
|
||||||
|
const distributionStore = inject("distributionStore");
|
||||||
|
const distributionApi = inject("distributionApi");
|
||||||
|
const modalData = reactive({
|
||||||
|
show: false,
|
||||||
|
title: "",
|
||||||
|
key: "",
|
||||||
|
data: null,
|
||||||
|
});
|
||||||
|
const showActions = ref(false);
|
||||||
|
const $actions = [
|
||||||
|
{
|
||||||
|
name: "更改分销组",
|
||||||
|
value: "change-group",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "重置分销组",
|
||||||
|
value: "reset-group",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "恢复分销员",
|
||||||
|
value: "back-fenxiao",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "取消分销员",
|
||||||
|
value: "cancel-fenxiao",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const actions = ref($actions);
|
||||||
|
function moreShow(item) {
|
||||||
|
modalData.data = item;
|
||||||
|
group.value = item.distributionLevelId;
|
||||||
|
if (item.isAssignLevel == 0) {
|
||||||
|
actions.value = $actions.filter((item) => item.value !== "reset-group");
|
||||||
|
} else {
|
||||||
|
actions.value = $actions.filter((item) => item.value !== "change-group");
|
||||||
|
}
|
||||||
|
if (item.status == 1) {
|
||||||
|
actions.value = actions.value.filter(
|
||||||
|
(item) => item.value !== "back-fenxiao"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (item.status == 9) {
|
||||||
|
actions.value = actions.value.filter(
|
||||||
|
(item) => item.value !== "cancel-fenxiao"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
showActions.value = true;
|
||||||
|
}
|
||||||
|
function handleSelect(item) {
|
||||||
|
console.log(item);
|
||||||
|
modalData.title = item.name;
|
||||||
|
modalData.key = item.value;
|
||||||
|
|
||||||
|
showActions.value = false;
|
||||||
|
modalData.show = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const emits = defineEmits(["refresh"]);
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
if (modalData.key == "reset-group") {
|
||||||
|
await distributionApi.resetLevel({
|
||||||
|
id: modalData.data.id,
|
||||||
|
shopId: uni.getSystemInfoSync("shopInfo").id || "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (modalData.key == "change-group") {
|
||||||
|
const level = distributionStore.config.levelConfigList.find(
|
||||||
|
(item) => item.id == group.value
|
||||||
|
);
|
||||||
|
await distributionApi.editDistributionUser({
|
||||||
|
id: modalData.data.id,
|
||||||
|
isAssignLevel: 1,
|
||||||
|
distributionLevelId: group.value,
|
||||||
|
distributionLevelName: level.name,
|
||||||
|
});
|
||||||
|
emits("refresh");
|
||||||
|
}
|
||||||
|
if (modalData.key == "cancel-fenxiao") {
|
||||||
|
await distributionApi.editDistributionUser({
|
||||||
|
id: modalData.data.id,
|
||||||
|
status: 9,
|
||||||
|
});
|
||||||
|
emits("refresh");
|
||||||
|
}
|
||||||
|
if (modalData.key == "back-fenxiao") {
|
||||||
|
await distributionApi.editDistributionUser({
|
||||||
|
id: modalData.data.id,
|
||||||
|
status: 1,
|
||||||
|
});
|
||||||
|
emits("refresh");
|
||||||
|
}
|
||||||
|
group.value = "";
|
||||||
|
modalData.show = false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.list {
|
||||||
|
padding: 0 30rpx;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 8rpx 22rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background-color: #edfff0;
|
||||||
|
color: #5bbc6d;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.end {
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-btn {
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.money {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
padding: 16rpx 28rpx;
|
||||||
|
}
|
||||||
|
.more {
|
||||||
|
display: flex;
|
||||||
|
height: 56rpx;
|
||||||
|
padding: 8rpx 28rpx;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 28rpx;
|
||||||
|
border: 2rpx solid $my-main-color;
|
||||||
|
color: $my-main-color;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(env(safe-area-inset-bottom) + 30rpx);
|
||||||
|
left: 30rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
70
pageMarket/superVip/components/user-types.vue
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<up-radio-group v-model="userType" placement="row">
|
||||||
|
<up-radio
|
||||||
|
v-for="item in userTypeList"
|
||||||
|
:key="item.value"
|
||||||
|
:name="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
<text>
|
||||||
|
{{ item.label }}
|
||||||
|
</text>
|
||||||
|
<text v-if="item.desc" class="color-666 u-font-24">
|
||||||
|
{{ item.desc }}
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
</up-radio>
|
||||||
|
</up-radio-group>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, reactive, ref, watch } from "vue";
|
||||||
|
|
||||||
|
const userType = defineModel({
|
||||||
|
default: () => "all",
|
||||||
|
type: String,
|
||||||
|
});
|
||||||
|
const userTypeList = [
|
||||||
|
{
|
||||||
|
value: "all",
|
||||||
|
label: "全部用户",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "new",
|
||||||
|
label: "仅限新用户",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "vip",
|
||||||
|
label: "仅会员",
|
||||||
|
desc:'(分店需开启超级会员可用)'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.box {
|
||||||
|
margin-top: 16rpx;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
172
pageMarket/superVip/components/vip-lv-list.vue
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
<template>
|
||||||
|
<view class="list u-font-28 color-333">
|
||||||
|
<view class="u-m-t-32 item" v-for="(item, index) in list" :key="item.id">
|
||||||
|
<view class="color-000 font-bold u-font-32">
|
||||||
|
<view> {{ item.name }} </view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-flex">
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<text class="color-666">所需成长值:</text>
|
||||||
|
<text>{{ item.experienceValue || 0 }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<text class="color-666">会员折扣:</text>
|
||||||
|
<text>{{ item.discount || 100 }}%</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-32 u-flex u-row-right gap-20">
|
||||||
|
<view class="del" @click="delItem(item)" v-if="index != 0">删除</view>
|
||||||
|
<view class="edit" @click="editItem(item)">编辑</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-p-30">
|
||||||
|
<up-loadmore :status="isEnd ? 'nomore' : 'loading'"></up-loadmore>
|
||||||
|
</view>
|
||||||
|
<view style="height: 100rpx"></view>
|
||||||
|
<view class="bottom">
|
||||||
|
<my-button @click="go.to('PAGES_MARKET_SUPER_VIP_LV_ADD')">
|
||||||
|
<view class="u-flex">
|
||||||
|
<text>+ 添加会员等级</text>
|
||||||
|
</view>
|
||||||
|
</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
watch,
|
||||||
|
toRaw,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
inject,
|
||||||
|
} from "vue";
|
||||||
|
import go from "@/commons/utils/go.js";
|
||||||
|
const memberApi=inject('memberApi')
|
||||||
|
const props = defineProps({
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
isEnd: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function delItem(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "确定删除该会员等级吗?",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
memberApi.levelDel(item.id).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "删除成功",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
emits("refresh");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function editItem(item) {
|
||||||
|
go.to("PAGES_MARKET_SUPER_VIP_LV_ADD", {
|
||||||
|
id: item.id,
|
||||||
|
type: "edit",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const emits = defineEmits(["refresh"]);
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.list {
|
||||||
|
padding: 0 30rpx;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 8rpx 22rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background-color: #edfff0;
|
||||||
|
color: #5bbc6d;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.end {
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-btn {
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.money {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
padding: 16rpx 28rpx;
|
||||||
|
}
|
||||||
|
.more {
|
||||||
|
display: flex;
|
||||||
|
height: 56rpx;
|
||||||
|
padding: 8rpx 28rpx;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 28rpx;
|
||||||
|
border: 2rpx solid $my-main-color;
|
||||||
|
color: $my-main-color;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
display: flex;
|
||||||
|
height: 56rpx;
|
||||||
|
padding: 8rpx 28rpx;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 28rpx;
|
||||||
|
border: 2rpx solid #f7f7fa;
|
||||||
|
color: #999;
|
||||||
|
background: #f7f7fa;
|
||||||
|
}
|
||||||
|
.edit {
|
||||||
|
display: flex;
|
||||||
|
height: 56rpx;
|
||||||
|
padding: 8rpx 28rpx;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 28rpx;
|
||||||
|
border: 2rpx solid $my-main-color;
|
||||||
|
|
||||||
|
color: #fff;
|
||||||
|
background: $my-main-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(env(safe-area-inset-bottom) + 30rpx);
|
||||||
|
left: 30rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
447
pageMarket/superVip/index.vue
Normal file
@@ -0,0 +1,447 @@
|
|||||||
|
<template>
|
||||||
|
<view class="min-page u-font-28">
|
||||||
|
<up-sticky>
|
||||||
|
<view class="bg-fff top">
|
||||||
|
<view class="bg-fff container u-flex u-m-b-48">
|
||||||
|
<image
|
||||||
|
style="width: 60rpx; height: 60rpx"
|
||||||
|
src="/pageMarket/static/images/member.png"
|
||||||
|
></image>
|
||||||
|
<view class="u-flex-1 u-flex u-p-l-24">
|
||||||
|
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||||
|
<view class="color-333 font-bold">超级会员</view>
|
||||||
|
<view class="color-666 u-m-t-4 u-font-24">用户会员管理设置 </view>
|
||||||
|
</view>
|
||||||
|
<up-switch
|
||||||
|
v-model="superVipStore.config.isOpen"
|
||||||
|
size="18"
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
|
></up-switch>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<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 class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
|
<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 class="u-flex-1 u-text-center">
|
||||||
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
|
listRes.totalRow
|
||||||
|
}}</view>
|
||||||
|
<view class="u-font-24 color-666 u-m-t-16">订单数</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1 u-text-center">
|
||||||
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
|
listRes.totalAmount
|
||||||
|
}}</view>
|
||||||
|
<view class="u-font-24 color-666 u-m-t-16">订单金额(元)</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="active == 3" class="u-flex u-m-t-32">
|
||||||
|
<view class="u-flex-1 u-text-center">
|
||||||
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
|
listRes.successAmount
|
||||||
|
}}</view>
|
||||||
|
<view class="u-font-24 color-666 u-m-t-16">已入账金额(元)</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1 u-text-center">
|
||||||
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
|
listRes.pendingAmount || 0
|
||||||
|
}}</view>
|
||||||
|
<view class="u-font-24 color-666 u-m-t-16">待入账金额(元)</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1 u-text-center">
|
||||||
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
|
listRes.balanceAmount
|
||||||
|
}}</view>
|
||||||
|
<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
|
||||||
|
v-if="active == 2"
|
||||||
|
:list="list"
|
||||||
|
:isEnd="isEnd"
|
||||||
|
@refresh="refresh"
|
||||||
|
></openListVue>
|
||||||
|
<fenxiaoMingxiVue
|
||||||
|
v-if="active == 3"
|
||||||
|
:list="list"
|
||||||
|
:isEnd="isEnd"
|
||||||
|
@refresh="refresh"
|
||||||
|
></fenxiaoMingxiVue>
|
||||||
|
<!-- 选择门店 -->
|
||||||
|
<shopSelActionSheetVue
|
||||||
|
@choose="chooseShop"
|
||||||
|
v-model="showShopSelActionSheet"
|
||||||
|
title="选择门店"
|
||||||
|
>
|
||||||
|
</shopSelActionSheetVue>
|
||||||
|
|
||||||
|
<dateAreaSel
|
||||||
|
:show="showTimeArea"
|
||||||
|
:minYear="2022"
|
||||||
|
@close="showTimeArea = false"
|
||||||
|
@confirm="confirmTimeArea"
|
||||||
|
></dateAreaSel>
|
||||||
|
|
||||||
|
<!-- 分销明细状态 -->
|
||||||
|
<up-action-sheet
|
||||||
|
:show="showActions"
|
||||||
|
:actions="actions"
|
||||||
|
@select="handleSelect"
|
||||||
|
@close="showActions = false"
|
||||||
|
cancel-text="取消"
|
||||||
|
></up-action-sheet>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow,
|
||||||
|
onPageScroll,
|
||||||
|
onReachBottom,
|
||||||
|
onBackPress,
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
|
import go from "@/commons/utils/go.js";
|
||||||
|
import { ref, onMounted, watch, provide } from "vue";
|
||||||
|
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
||||||
|
import * as memberApi from "@/http/api/market/member.js";
|
||||||
|
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 { reactive } from "vue";
|
||||||
|
|
||||||
|
const actions = [
|
||||||
|
{
|
||||||
|
name: "全部",
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "已入账",
|
||||||
|
value: "success",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "待入账",
|
||||||
|
value: "pending",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "已退款",
|
||||||
|
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 superVipStore = useSuperVipStore();
|
||||||
|
superVipStore.getConfig();
|
||||||
|
provide("superVipStore", superVipStore);
|
||||||
|
provide("memberApi", memberApi);
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const keyWord = ref("");
|
||||||
|
function keyWordBlur() {
|
||||||
|
userComponentQuery.user = keyWord.value;
|
||||||
|
}
|
||||||
|
const userComponentQuery = reactive({
|
||||||
|
user: "",
|
||||||
|
startTime: "",
|
||||||
|
endTime: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
const form = ref({
|
||||||
|
isOpen: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const list = ref([]);
|
||||||
|
const pageNum = ref(1);
|
||||||
|
const isEnd = ref(false);
|
||||||
|
const selShop = ref({
|
||||||
|
shopId: "",
|
||||||
|
shopName: "",
|
||||||
|
});
|
||||||
|
const searchText = ref("");
|
||||||
|
|
||||||
|
function search() {
|
||||||
|
pageNum.value = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function chooseShop(e) {
|
||||||
|
selShop.value = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => selShop.value.shopId,
|
||||||
|
(newval) => {
|
||||||
|
pageNum.value = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => userComponentQuery,
|
||||||
|
(newval) => {
|
||||||
|
isEnd.value = false;
|
||||||
|
pageNum.value = 1;
|
||||||
|
|
||||||
|
getList();
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
isEnd.value = false;
|
||||||
|
pageNum.value = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const listRes = ref({});
|
||||||
|
async function getList() {
|
||||||
|
let res = null;
|
||||||
|
if (active.value == 1) {
|
||||||
|
//会员等级列表
|
||||||
|
res = await memberApi.levelList();
|
||||||
|
if (res) {
|
||||||
|
list.value = res || [];
|
||||||
|
isEnd.value = true;
|
||||||
|
superVipStore.setVipLevelList(res || []);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (active.value == 2) {
|
||||||
|
//购买会员订单记录
|
||||||
|
res = await memberApi.orderList({
|
||||||
|
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 (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 = "";
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
watch(
|
||||||
|
() => selActions.value,
|
||||||
|
() => {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
onReachBottom(() => {
|
||||||
|
if (!isEnd.value) {
|
||||||
|
pageNum.value++;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
watch(
|
||||||
|
() => superVipStore.config.isOpen,
|
||||||
|
() => {
|
||||||
|
superVipStore.editConfig().then((res) => {
|
||||||
|
if (res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "更新成功",
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
onShow(() => {
|
||||||
|
pageNum.value = 1;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.min-page {
|
||||||
|
background: #f7f7f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list {
|
||||||
|
padding: 0 30rpx;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 8rpx 22rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background-color: #edfff0;
|
||||||
|
color: #5bbc6d;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.end {
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-btn {
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-btn {
|
||||||
|
background: #e6f0ff;
|
||||||
|
color: $my-main-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-btn {
|
||||||
|
background: #ffe7e6;
|
||||||
|
color: #ff1c1c;
|
||||||
|
}
|
||||||
|
.filter-box {
|
||||||
|
display: flex;
|
||||||
|
padding: 8rpx 24rpx;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
border: 2rpx solid #d9d9d9;
|
||||||
|
background: #f7f7f7;
|
||||||
|
min-height: 62rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
366
pageMarket/superVip/level-list.vue
Normal file
@@ -0,0 +1,366 @@
|
|||||||
|
<template>
|
||||||
|
<view class="min-page u-font-28">
|
||||||
|
<view class="container first">
|
||||||
|
<view class="title">升级条件</view>
|
||||||
|
<view class="u-m-t-16">
|
||||||
|
<up-radio-group v-model="form.upgradeType" placement="row">
|
||||||
|
<up-radio
|
||||||
|
v-for="item in distributionStore.upgradeTypes"
|
||||||
|
:key="item.value"
|
||||||
|
:name="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
<text>
|
||||||
|
{{ item.label }}
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
</up-radio>
|
||||||
|
</up-radio-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="container" v-for="(item,index) in form.levelConfigList">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<text class="font-bold color-333 u-font-32">{{index+1}}级:{{ item.name }}</text>
|
||||||
|
<view class="u-flex" @click="toggle(index)">
|
||||||
|
<text class="color-main u-m-r-14">展开</text>
|
||||||
|
<view class="u-flex arrow" :class="[!showDetailListSwitch[index]?'rotate' : '']">
|
||||||
|
<up-icon name="arrow-down" color="#318AFE" ></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="showDetailListSwitch[index]">
|
||||||
|
<view class="u-m-t-60">
|
||||||
|
<view class="title">名称</view>
|
||||||
|
<view class="u-p-t-16 u-p-b-24">
|
||||||
|
<input placeholder="请输入名称" placeholder-class="color-999 u-font-28" v-model="item.name" @input="checkName($event, index)"></input>
|
||||||
|
</view>
|
||||||
|
<up-line></up-line>
|
||||||
|
<view class="title u-m-t-24">分成比例</view>
|
||||||
|
<view class="u-m-t-16 u-p-b-24">
|
||||||
|
<view class="u-flex u-m-t-16">
|
||||||
|
<input
|
||||||
|
class="number-box"
|
||||||
|
placeholder="请输入"
|
||||||
|
placeholder-class="color-999 u-font-28"
|
||||||
|
type="digit"
|
||||||
|
@input="checkNumberCommission($event,index)"
|
||||||
|
v-model="item.levelOneCommission"
|
||||||
|
/>
|
||||||
|
<view class="unit">%</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="form.upgradeType!='not_upgrade'">
|
||||||
|
<up-line></up-line>
|
||||||
|
<template v-if="form.upgradeType!='cost'">
|
||||||
|
<view class="title u-m-t-24">有效人数</view>
|
||||||
|
<view class="u-m-t-16 u-p-b-8">
|
||||||
|
<view class="u-flex u-m-t-16">
|
||||||
|
<input
|
||||||
|
:disabled="index==0?true:false"
|
||||||
|
:class="{'disabled':index==0?true:false}"
|
||||||
|
|
||||||
|
class="number-box"
|
||||||
|
placeholder="请输入"
|
||||||
|
placeholder-class="color-999 u-font-28"
|
||||||
|
type="number"
|
||||||
|
v-model="item.inviteCount"
|
||||||
|
/>
|
||||||
|
<view class="unit">人</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="color-999 u-font-24">有效人数:被邀请人在店铺消费过,即有一笔订单完成</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="title u-m-t-24">消费金额达</view>
|
||||||
|
<view class="u-m-t-16 u-p-b-8">
|
||||||
|
<view class="u-flex u-m-t-16">
|
||||||
|
<input
|
||||||
|
class="number-box"
|
||||||
|
:disabled="index==0?true:false"
|
||||||
|
:class="{'disabled':index==0?true:false}"
|
||||||
|
placeholder="请输入"
|
||||||
|
placeholder-class="color-999 u-font-28"
|
||||||
|
type="digit"
|
||||||
|
v-model="item.costAmount"
|
||||||
|
/>
|
||||||
|
<view class="unit">元</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="color-999 u-font-24">消费金额:分销员和被邀请人在店铺订单消费总金额(不包含退款)</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<view class="u-m-t-24 u-flex u-row-right" style="gap: 40rpx;">
|
||||||
|
<view class="u-flex" v-if="index==0||index==form.levelConfigList.length-1" @click="addLevelConfig">
|
||||||
|
<up-icon name="plus-circle-fill" color="#318AFE" ></up-icon>
|
||||||
|
<text class="u-m-l-16">{{index==0? '添加':'继续添加'}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex" @click="remove(index)" v-if="index!=0">
|
||||||
|
<up-icon name="minus-circle-fill" color="#EB4F4F" ></up-icon>
|
||||||
|
<text class="u-m-l-16">删除</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<my-bottom-btn-group @save="save" @cancel="cancel"></my-bottom-btn-group>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow,
|
||||||
|
onPageScroll,
|
||||||
|
onReachBottom,
|
||||||
|
onBackPress,
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
|
|
||||||
|
import { ref, onMounted, watch, reactive , computed} from "vue";
|
||||||
|
import { useDistributionStore } from "@/store/market.js";
|
||||||
|
|
||||||
|
const distributionStore = useDistributionStore();
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
upgradeType: "",
|
||||||
|
levelConfigList:[]
|
||||||
|
});
|
||||||
|
|
||||||
|
const showDetailListSwitch=ref([true])
|
||||||
|
|
||||||
|
function toggle(index) {
|
||||||
|
showDetailListSwitch.value[index] = !showDetailListSwitch.value[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
//现在全部的分成比例总和
|
||||||
|
const allCommission=()=>{
|
||||||
|
let sum=0
|
||||||
|
for(let item of form.levelConfigList){
|
||||||
|
sum+=parseFloat(item.levelOneCommission)
|
||||||
|
}
|
||||||
|
return sum
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let timer=null
|
||||||
|
//全部的分成比例加起来不能超过100%
|
||||||
|
function checkNumberCommission(e,index){
|
||||||
|
const value=e.detail.value
|
||||||
|
clearInterval(timer)
|
||||||
|
|
||||||
|
if(value>100){
|
||||||
|
uni.showToast({
|
||||||
|
title:'分成比例不能超过100',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
timer= setTimeout(()=>{
|
||||||
|
form.levelConfigList[index].levelOneCommission=''
|
||||||
|
},30)
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
//输入最多两位小数,两位小数点后的去除掉不让输入
|
||||||
|
if(value.indexOf('.')!=-1){
|
||||||
|
const arr=value.split('.')
|
||||||
|
if(arr[1].length>2){
|
||||||
|
timer= setTimeout(()=>{
|
||||||
|
form.levelConfigList[index].levelOneCommission=arr[0]+'.'+arr[1].substring(0,2)
|
||||||
|
},30)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkName(e,index){
|
||||||
|
const value=e.detail.value
|
||||||
|
if(value.length>10){
|
||||||
|
uni.showToast({
|
||||||
|
title:'名称最多10个字符',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
timer= setTimeout(()=>{
|
||||||
|
form.levelConfigList[index].name=value.substring(0,10)
|
||||||
|
|
||||||
|
},30)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function remove(index){
|
||||||
|
form.levelConfigList.splice(index,1)
|
||||||
|
showDetailListSwitch.value.splice(index,1)
|
||||||
|
}
|
||||||
|
function addLevelConfig(){
|
||||||
|
form.levelConfigList.push({
|
||||||
|
name:'',
|
||||||
|
levelOneCommission:'',
|
||||||
|
inviteCount:'',
|
||||||
|
costAmount:''
|
||||||
|
})
|
||||||
|
showDetailListSwitch.value.push(true)
|
||||||
|
}
|
||||||
|
//判断输入每一项是否为空
|
||||||
|
function checkInput(){
|
||||||
|
for(let item of form.levelConfigList){
|
||||||
|
if(!item.name){
|
||||||
|
uni.showToast({
|
||||||
|
title:'请输入名称',
|
||||||
|
icon:'none'
|
||||||
|
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if(!item.levelOneCommission){
|
||||||
|
uni.showToast({
|
||||||
|
title:'请输入分成比例',
|
||||||
|
icon:'none'
|
||||||
|
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if(form.upgradeType==='not_upgrade'){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if(form.upgradeType==='cost'){
|
||||||
|
if(item.costAmount===''||item.costAmount===null){
|
||||||
|
uni.showToast({
|
||||||
|
title:'请输入消费金额',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(item.inviteCount===''||item.inviteCount===null){
|
||||||
|
uni.showToast({
|
||||||
|
title:'请输入有效人数',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
async function save(){
|
||||||
|
const isPas=checkInput()
|
||||||
|
if(!isPas){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await distributionStore.editConfig(form)
|
||||||
|
uni.showToast({
|
||||||
|
title:'保存成功',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta:1
|
||||||
|
})
|
||||||
|
}, 1500);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
function cancel(){
|
||||||
|
uni.navigateBack({
|
||||||
|
delta:1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onLoad(()=>{
|
||||||
|
showDetailListSwitch.value=distributionStore.config.levelConfigList.map(()=>true)
|
||||||
|
const levelConfigList=[...distributionStore.config.levelConfigList||[]]
|
||||||
|
form.levelConfigList=levelConfigList.length?levelConfigList:[
|
||||||
|
{ name:'',
|
||||||
|
levelOneCommission:'',
|
||||||
|
inviteCount:0,
|
||||||
|
costAmount:0}
|
||||||
|
]
|
||||||
|
form.upgradeType=distributionStore.config.upgradeType
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.min-page {
|
||||||
|
background: #f7f7f7;
|
||||||
|
padding: 56rpx 28rpx;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
background: #fff;
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.x-padding {
|
||||||
|
padding: 0 24rpx;
|
||||||
|
}
|
||||||
|
$height: 70rpx;
|
||||||
|
.number-box {
|
||||||
|
font-size: 28rpx;
|
||||||
|
padding: 0 26rpx;
|
||||||
|
border-radius: 6rpx 0 0 6rpx;
|
||||||
|
border-top: 2rpx solid #d9d9d9;
|
||||||
|
border-bottom: 2rpx solid #d9d9d9;
|
||||||
|
border-left: 2rpx solid #d9d9d9;
|
||||||
|
background: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: $height;
|
||||||
|
flex: 1;
|
||||||
|
line-height: $height;
|
||||||
|
&.disabled{
|
||||||
|
background-color: #f7f7fa;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.unit {
|
||||||
|
display: flex;
|
||||||
|
padding: 0 38rpx;
|
||||||
|
height: $height;
|
||||||
|
line-height: $height;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 0 6rpx 6rpx 0;
|
||||||
|
border: 2rpx solid #d9d9d9;
|
||||||
|
background: #f7f7fa;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-btn {
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-btn {
|
||||||
|
background: #e6f0ff;
|
||||||
|
color: $my-main-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-btn {
|
||||||
|
background: #ffe7e6;
|
||||||
|
color: #ff1c1c;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #333;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.first {
|
||||||
|
border-bottom: 2rpx solid #e5e5e5;
|
||||||
|
}
|
||||||
|
.arrow{
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
&.rotate{
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
363
pageMarket/superVip/vip-lv-add.vue
Normal file
@@ -0,0 +1,363 @@
|
|||||||
|
<template>
|
||||||
|
<view class="min-page u-font-28 color-333">
|
||||||
|
<view class="container">
|
||||||
|
<view class="border-bottom u-p-b-16">
|
||||||
|
<view class="font-bold u-m-b-16">会员标题</view>
|
||||||
|
<input
|
||||||
|
v-model="form.name"
|
||||||
|
placeholder="请输入会员标题"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="border-bottom u-p-b-16 u-m-t-16">
|
||||||
|
<view class="font-bold u-m-b-16">会员折扣(%)</view>
|
||||||
|
<input
|
||||||
|
v-model="form.discount"
|
||||||
|
placeholder="请输入会员折扣"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-16">
|
||||||
|
<view class="font-bold u-m-b-16">所需会员值</view>
|
||||||
|
<input
|
||||||
|
v-model="form.experienceValue"
|
||||||
|
:disabled="optiopns.index == 0 ? true : false"
|
||||||
|
placeholder="请输入所需会员值"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="container u-flex u-row-between">
|
||||||
|
<view class="font-bold">等级标识</view>
|
||||||
|
<view class="u-flex upload-box">
|
||||||
|
<my-upload-img v-model="form.logo"></my-upload-img>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="container">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="">
|
||||||
|
<view class="font-bold">消费送积分</view>
|
||||||
|
<view class="color-999 u-font-24 u-m-t-2">每消费X元赠送1积分</view>
|
||||||
|
</view>
|
||||||
|
<up-switch
|
||||||
|
:size="20"
|
||||||
|
v-model="form.isCostRewardPoints"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
></up-switch>
|
||||||
|
</view>
|
||||||
|
<view class="bg-gray u-m-t-16" style="padding: 24rpx 72rpx" v-if="form.isCostRewardPoints">
|
||||||
|
<view class="u-flex">
|
||||||
|
<input
|
||||||
|
class="number-box"
|
||||||
|
type="digit"
|
||||||
|
v-model="form.costRewardPoints"
|
||||||
|
/>
|
||||||
|
<view class="unit">元</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="container">
|
||||||
|
<view class="">
|
||||||
|
<view class="font-bold u-m-b-16">等级说明</view>
|
||||||
|
<up-textarea
|
||||||
|
v-model="form.remark"
|
||||||
|
placeholder="请输入等级说明"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="container">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="font-bold u-m-b-16">自动发放</view>
|
||||||
|
<up-switch
|
||||||
|
:size="20"
|
||||||
|
v-model="form.isCycleReward"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
></up-switch>
|
||||||
|
</view>
|
||||||
|
<template v-if="form.isCycleReward">
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="font-bold u-m-b-16">周期时间</view>
|
||||||
|
<view class="u-flex" style="gap: 24rpx; align-items: stretch">
|
||||||
|
<up-input type="digit" v-model="form.cycleTime"></up-input>
|
||||||
|
<view class="times">
|
||||||
|
<up-select
|
||||||
|
v-model:current="form.cycleUnit"
|
||||||
|
showOptionsLabel
|
||||||
|
label="单位"
|
||||||
|
keyName="value"
|
||||||
|
labelName="label"
|
||||||
|
:options="times"
|
||||||
|
@select="selectItem"
|
||||||
|
></up-select>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="font-bold u-m-b-16">赠送积分</view>
|
||||||
|
<up-input
|
||||||
|
type="number"
|
||||||
|
v-model="form.cycleRewardPoints"
|
||||||
|
placeholder="赠送成长值"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
></up-input>
|
||||||
|
</view>
|
||||||
|
<view class="font-bold u-m-b-16 u-m-t-32">赠送优惠券</view>
|
||||||
|
<CouponList v-model="form.cycleRewardCouponList"></CouponList>
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="u-flex gap-20" @click="addCoupon()">
|
||||||
|
<up-icon name="plus-circle-fill" color="#318AFE" size="16"></up-icon>
|
||||||
|
<text class="">添加</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<my-bottom-btn-group @save="save" @cancel="cancel"></my-bottom-btn-group>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow,
|
||||||
|
onPageScroll,
|
||||||
|
onReachBottom,
|
||||||
|
onBackPress,
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
|
import CouponList from "./components/coupon-list.vue";
|
||||||
|
import { ref, onMounted, watch, reactive, computed } from "vue";
|
||||||
|
import { useSuperVipStore } from "@/store/market.js";
|
||||||
|
import * as memberApi from "@/http/api/market/member.js";
|
||||||
|
import { options } from "../../../cashier_wx/uni_modules/uview-plus/components/u-markdown/marked.esm";
|
||||||
|
|
||||||
|
const times = [
|
||||||
|
{
|
||||||
|
label: "年",
|
||||||
|
value: "年",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "月",
|
||||||
|
value: "月",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "周",
|
||||||
|
value: "周",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "天",
|
||||||
|
value: "天",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const placeholderStyle = {
|
||||||
|
"font-size": "28rpx",
|
||||||
|
};
|
||||||
|
const superVipStore = useSuperVipStore();
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
name: "",
|
||||||
|
experienceValue: 0,
|
||||||
|
discount: 100,
|
||||||
|
logo: '',
|
||||||
|
costRewardPoints: 1,
|
||||||
|
isCostRewardPoints: 0,
|
||||||
|
isCycleReward: 0,
|
||||||
|
cycleTime: 1,
|
||||||
|
cycleUnit: "月",
|
||||||
|
cycleRewardPoints: 1,
|
||||||
|
cycleRewardCouponList: [],
|
||||||
|
remark: "",
|
||||||
|
});
|
||||||
|
function addCoupon() {
|
||||||
|
form.couponList.push({
|
||||||
|
coupon: { id: null },
|
||||||
|
num: "",
|
||||||
|
title: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const showDetailListSwitch = ref([true]);
|
||||||
|
|
||||||
|
//判断输入每一项是否为空
|
||||||
|
function checkInput() {
|
||||||
|
for (let item of form.cycleRewardCouponList) {
|
||||||
|
if (!item.coupon.id) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请选择优惠券",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!item.num) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请输入优惠券数量",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
async function save() {
|
||||||
|
const isPas = checkInput();
|
||||||
|
if (!isPas) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!form.name) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请输入会员标题",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!form.discount) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请输入会员折扣",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!form.experienceValue && optiopns.index != 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请输入所需成长值",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const submitForm = {
|
||||||
|
...form,
|
||||||
|
};
|
||||||
|
const res =
|
||||||
|
optiopns.type == "edit"
|
||||||
|
? await memberApi.levelEdit(submitForm)
|
||||||
|
: await memberApi.levelAdd(submitForm);
|
||||||
|
if (res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "保存成功",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "保存失败",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
function cancel() {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const optiopns = reactive({});
|
||||||
|
onLoad((opt) => {
|
||||||
|
Object.assign(optiopns, opt);
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: opt.type !== "edit" ? "添加会员等级" : "编辑会员等级",
|
||||||
|
});
|
||||||
|
if (opt.type === "edit" && opt.id !== undefined && opt.id !== null) {
|
||||||
|
const index = superVipStore.vipLevelList.findIndex(
|
||||||
|
(item) => item.id == opt.id
|
||||||
|
);
|
||||||
|
optiopns.index = index;
|
||||||
|
const item = superVipStore.vipLevelList.find((item) => item.id == opt.id);
|
||||||
|
Object.assign(form, item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.min-page {
|
||||||
|
background: #f7f7f7;
|
||||||
|
padding: 56rpx 28rpx;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
background: #fff;
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
.x-padding {
|
||||||
|
padding: 0 24rpx;
|
||||||
|
}
|
||||||
|
$height: 70rpx;
|
||||||
|
.number-box {
|
||||||
|
font-size: 28rpx;
|
||||||
|
padding: 0 26rpx;
|
||||||
|
border-radius: 6rpx 0 0 6rpx;
|
||||||
|
border-top: 2rpx solid #d9d9d9;
|
||||||
|
border-bottom: 2rpx solid #d9d9d9;
|
||||||
|
border-left: 2rpx solid #d9d9d9;
|
||||||
|
background: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: $height;
|
||||||
|
flex: 1;
|
||||||
|
line-height: $height;
|
||||||
|
&.disabled {
|
||||||
|
background-color: #f7f7fa;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.unit {
|
||||||
|
display: flex;
|
||||||
|
padding: 0 38rpx;
|
||||||
|
height: $height;
|
||||||
|
line-height: $height;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 0 6rpx 6rpx 0;
|
||||||
|
border: 2rpx solid #d9d9d9;
|
||||||
|
background: #f7f7fa;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-btn {
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-btn {
|
||||||
|
background: #e6f0ff;
|
||||||
|
color: $my-main-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-btn {
|
||||||
|
background: #ffe7e6;
|
||||||
|
color: #ff1c1c;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #333;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.first {
|
||||||
|
border-bottom: 2rpx solid #e5e5e5;
|
||||||
|
}
|
||||||
|
.arrow {
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
&.rotate {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.times {
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
display: flex;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
:deep(.times .u-select) {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
140
pageMarket/superVip/vip-plans.vue
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
<template>
|
||||||
|
<view class="min-page bg-f7 u-font-28">
|
||||||
|
<view class="default-box-padding">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in superVipStore.config.configList"
|
||||||
|
class="u-m-b-56 default-box-radius bg-fff default-box-padding"
|
||||||
|
>
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<text class="u-font-32 font-bold color-000">{{ item.name }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-22 color-666 u-font-32 u-flex">
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<view>
|
||||||
|
<text class="color-666">价格:</text>
|
||||||
|
<text>{{item.price}}元</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-20">
|
||||||
|
<text class="color-666">周期:</text>
|
||||||
|
<text> {{item.circleTime}}个{{ item.circleUnit }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<view>
|
||||||
|
<text class="color-666">赠送成长值:</text>
|
||||||
|
<text>{{item.reward}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-20">
|
||||||
|
<text class="color-666">赠送优惠券:</text>
|
||||||
|
<text> {{returnCouponAllNum(item)}}张</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-right gap-20 u-m-t-32">
|
||||||
|
<view class="btn del" @click="handleDelete(index)">删除</view>
|
||||||
|
<view class="btn edit" @click="handleEdit(item,index)">编辑</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="height: 100rpx"></view>
|
||||||
|
<view class="fixed-bottom">
|
||||||
|
<my-button @click="go.to('PAGES_MARKET_SUPER_VIP_ADD_PLAN')">
|
||||||
|
<view class="u-flex">
|
||||||
|
<up-icon name="plus" color="#fff" size="12"></up-icon>
|
||||||
|
<text class="u-m-l-10">添加方案</text>
|
||||||
|
</view>
|
||||||
|
</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow,
|
||||||
|
onPageScroll,
|
||||||
|
onReachBottom,
|
||||||
|
onBackPress,
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
|
import { useSuperVipStore } from "@/store/market.js";
|
||||||
|
import go from "@/commons/utils/go.js";
|
||||||
|
const superVipStore = useSuperVipStore();
|
||||||
|
import { ref, reactive, onMounted } from "vue";
|
||||||
|
|
||||||
|
function handleDelete(index) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "确认删除吗?",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
superVipStore.config.configList.splice(index, 1);
|
||||||
|
superVipStore.editConfig().then(res=>{
|
||||||
|
if(res){
|
||||||
|
uni.showToast({
|
||||||
|
title: "删除成功",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnCouponAllNum(item){
|
||||||
|
return (item.couponList||[]).reduce((pre,cur)=>pre+cur.num,0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(item,index) {
|
||||||
|
uni.setStorageSync("suggestItem", item);
|
||||||
|
go.to("PAGES_MARKET_SUPER_VIP_ADD_PLAN", {
|
||||||
|
type: "edit",
|
||||||
|
index: index,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.status {
|
||||||
|
padding: 8rpx 18rpx;
|
||||||
|
border: 2rpx solid transparent;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
&.status1 {
|
||||||
|
background-color: rgba(123, 209, 54, 0.12);
|
||||||
|
border-color: rgba(123, 209, 54, 1);
|
||||||
|
color: #7bd136;
|
||||||
|
}
|
||||||
|
&.status0 {
|
||||||
|
border-color: rgba(153, 153, 153, 1);
|
||||||
|
background-color: rgba(153, 153, 153, 0.12);
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
padding: 8rpx 42rpx;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
&.del {
|
||||||
|
background-color: #f7f7fa;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
&.edit {
|
||||||
|
background-color: $my-main-color;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.fixed-bottom {
|
||||||
|
left: 70rpx;
|
||||||
|
right: 70rpx;
|
||||||
|
}
|
||||||
|
.time {
|
||||||
|
margin-left: 30rpx;
|
||||||
|
padding: 4rpx 20rpx;
|
||||||
|
border: 1px solid $my-main-color;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
color: $my-main-color;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
{{ returnSendStr.join('、') }}
|
{{ returnSendStr.join('、') }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-right u-m-t-32 gap-20">
|
<view class="u-flex u-row-right u-m-t-32 gap-20" v-if="isCanEdit">
|
||||||
<view class="" style="width: 140rpx">
|
<view class="" style="width: 140rpx;">
|
||||||
<my-button plain height="56" type="cancel" shape="circle" @tap="del">删除</my-button>
|
<my-button plain height="56" type="cancel" shape="circle" @tap="del">删除</my-button>
|
||||||
</view>
|
</view>
|
||||||
<view class="" style="width: 140rpx">
|
<view class="" style="width: 140rpx">
|
||||||
@@ -25,9 +25,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import myButton from '@/components/my-components/my-button.vue';
|
import myButton from '@/components/my-components/my-button.vue'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
index: {
|
index: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -36,10 +35,14 @@ const props = defineProps({
|
|||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
isCanEdit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
const emits = defineEmits(['del']);
|
const emits = defineEmits(['del']);
|
||||||
function del() {
|
function del() {
|
||||||
emits('del', {
|
emits('del', {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<view class="u-p-30">
|
<view class="u-p-30">
|
||||||
<view class="u-m-b-32" v-for="(item, index) in rechargeLists" :key="index">
|
<view class="u-m-b-32" v-for="(item, index) in rechargeLists" :key="index">
|
||||||
<recharge-item @del="rechargeItemDel" :index="index" :data="item"></recharge-item>
|
<recharge-item @del="rechargeItemDel" :index="index" :data="item" :isCanEdit="isCanEdit"></recharge-item>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
<my-switch v-model="mustBindPhone"></my-switch>
|
<my-switch v-model="mustBindPhone"></my-switch>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="u-m-t-60" style="padding: 80rpx">
|
<view class="u-m-t-60" style="padding: 80rpx" v-if="isCanEdit">
|
||||||
<my-button showShadow shape="circle" @click="rechargeSetting">保存</my-button>
|
<my-button showShadow shape="circle" @click="rechargeSetting">保存</my-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -92,8 +92,13 @@ import rechargeItem from './components/recharge-item.vue';
|
|||||||
import rechargeRecord from './components/rechargeRerord.vue';
|
import rechargeRecord from './components/rechargeRerord.vue';
|
||||||
import $util from '@/commons/utils/getDateArea.js';
|
import $util from '@/commons/utils/getDateArea.js';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import { shopRechargePost, shopRechargeGet, shopUserFlow } from '@/http/api/market/index.js';
|
import { shopRechargePost, shopRechargeGet } from '@/http/api/market/index.js';
|
||||||
import { onShow } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
import { isMainShop } from "@/store/account.js";
|
||||||
|
|
||||||
|
const isCanEdit=computed(()=>{
|
||||||
|
return isMainShop()
|
||||||
|
})
|
||||||
|
|
||||||
const model = ref(null);
|
const model = ref(null);
|
||||||
const modelData = reactive({
|
const modelData = reactive({
|
||||||
|
|||||||
@@ -1,30 +1,40 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="mask" v-if="show" @tap="close">
|
<view class="mask" v-if="show" @tap="close">
|
||||||
<view class="box" @tap.stop="nullFunction">
|
<view class="box" @tap.stop="nullFunction">
|
||||||
<view class="u-flex u-relative u-row-center u-p-30 top">
|
<view class="u-flex u-relative u-row-center u-p-30 top">
|
||||||
<view class="font-bold u-font-32">筛选日期时间</view>
|
<view class="font-bold u-font-32">筛选日期时间</view>
|
||||||
<view class="close" @tap="close">
|
<view class="close" @tap="close">
|
||||||
<uni-icons type="closeempty" size="24"></uni-icons>
|
<uni-icons type="closeempty" size="24"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
<!-- <view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime">
|
||||||
<!-- <view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime">
|
|
||||||
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item.key)">
|
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item.key)">
|
||||||
{{item.title}}
|
{{item.title}}
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<picker-view :immediate-change="true" @pickend="pickend" :value="value" @change="bindChange"
|
<picker-view
|
||||||
class="picker-view">
|
:immediate-change="true"
|
||||||
<picker-view-column>
|
@pickend="pickend"
|
||||||
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
:value="value"
|
||||||
</picker-view-column>
|
@change="bindChange"
|
||||||
<picker-view-column>
|
class="picker-view"
|
||||||
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
>
|
||||||
</picker-view-column>
|
<picker-view-column>
|
||||||
<picker-view-column>
|
<view class="item" v-for="(item, index) in years" :key="index"
|
||||||
<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
|
>{{ item }}年</view
|
||||||
</picker-view-column>
|
>
|
||||||
<!-- <picker-view-column>
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in months" :key="index"
|
||||||
|
>{{ item }}月</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in days" :key="index"
|
||||||
|
>{{ item }}日</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<!-- <picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
@@ -33,20 +43,31 @@
|
|||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||||
</picker-view-column> -->
|
</picker-view-column> -->
|
||||||
</picker-view>
|
</picker-view>
|
||||||
<view class="u-text-center color-999">至</view>
|
<view class="u-text-center color-999">至</view>
|
||||||
<picker-view :immediate-change="true" :value="value1" @pickend="pickend1" @change="bindChange1"
|
<picker-view
|
||||||
class="picker-view">
|
:immediate-change="true"
|
||||||
<picker-view-column>
|
:value="value1"
|
||||||
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
@pickend="pickend1"
|
||||||
</picker-view-column>
|
@change="bindChange1"
|
||||||
<picker-view-column>
|
class="picker-view"
|
||||||
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
>
|
||||||
</picker-view-column>
|
<picker-view-column>
|
||||||
<picker-view-column>
|
<view class="item" v-for="(item, index) in years" :key="index"
|
||||||
<view class="item" v-for="(item,index) in days1" :key="index">{{item}}日</view>
|
>{{ item }}年</view
|
||||||
</picker-view-column>
|
>
|
||||||
<!-- <picker-view-column>
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in months" :key="index"
|
||||||
|
>{{ item }}月</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in days1" :key="index"
|
||||||
|
>{{ item }}日</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<!-- <picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
@@ -55,394 +76,402 @@
|
|||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||||
</picker-view-column> -->
|
</picker-view-column> -->
|
||||||
</picker-view>
|
</picker-view>
|
||||||
|
|
||||||
<!-- 站位 -->
|
|
||||||
<view style="height: 80px;"></view>
|
|
||||||
<view class="fixed_b">
|
|
||||||
<my-button shape="circle" @tap="confirm">确定</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
<!-- 站位 -->
|
||||||
|
<view style="height: 80px"></view>
|
||||||
|
<view class="fixed_b">
|
||||||
|
<my-button shape="circle" @tap="confirm">确定</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import myButton from "@/components/my-components/my-button.vue"
|
import dayjs from "dayjs";
|
||||||
import {
|
import myButton from "@/components/my-components/my-button.vue";
|
||||||
reactive,
|
import { reactive, ref } from "vue";
|
||||||
ref
|
const $nowDate = new Date();
|
||||||
} from 'vue';
|
const nowDate = {
|
||||||
const $nowDate = new Date()
|
year: $nowDate.getFullYear(),
|
||||||
const nowDate = {
|
month: $nowDate.getMonth() + 1,
|
||||||
year: $nowDate.getFullYear(),
|
day: $nowDate.getDate(),
|
||||||
month: $nowDate.getMonth() + 1,
|
hours: $nowDate.getHours(),
|
||||||
day: $nowDate.getDate(),
|
minutes: $nowDate.getMinutes(),
|
||||||
hours: $nowDate.getHours(),
|
seconds: $nowDate.getSeconds(),
|
||||||
minutes: $nowDate.getMinutes(),
|
};
|
||||||
seconds: $nowDate.getSeconds()
|
const yearsLen = 30;
|
||||||
}
|
const years = new Array(yearsLen)
|
||||||
const yearsLen = 30
|
.fill(1)
|
||||||
const years = new Array(yearsLen).fill(1).map((v, index) => {
|
.map((v, index) => {
|
||||||
return nowDate.year - index
|
return nowDate.year - index;
|
||||||
}).reverse()
|
})
|
||||||
const months = new Array(12).fill(1).map((v, index) => {
|
.reverse();
|
||||||
return index + 1
|
const months = new Array(12).fill(1).map((v, index) => {
|
||||||
})
|
return index + 1;
|
||||||
const days = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
});
|
||||||
return index + 1
|
const days = ref(
|
||||||
}))
|
new Array(getMonthArea($nowDate, "end").getDate()).fill(1).map((v, index) => {
|
||||||
const days1 = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
return index + 1;
|
||||||
return index + 1
|
})
|
||||||
}))
|
);
|
||||||
const hours = new Array(24).fill(1).map((v, index) => {
|
const days1 = ref(
|
||||||
return index
|
new Array(getMonthArea($nowDate, "end").getDate()).fill(1).map((v, index) => {
|
||||||
})
|
return index + 1;
|
||||||
const minutes = new Array(60).fill(1).map((v, index) => {
|
})
|
||||||
return index
|
);
|
||||||
})
|
const hours = new Array(24).fill(1).map((v, index) => {
|
||||||
const seconds = new Array(60).fill(1).map((v, index) => {
|
return index;
|
||||||
return index
|
});
|
||||||
})
|
const minutes = new Array(60).fill(1).map((v, index) => {
|
||||||
const fastTime = reactive([{
|
return index;
|
||||||
title: '今日',
|
});
|
||||||
key: 'now'
|
const seconds = new Array(60).fill(1).map((v, index) => {
|
||||||
},
|
return index;
|
||||||
{
|
});
|
||||||
title: '昨日',
|
const fastTime = reactive([
|
||||||
key: 'prve'
|
{
|
||||||
},
|
title: "今日",
|
||||||
{
|
key: "now",
|
||||||
title: '本月',
|
},
|
||||||
key: 'nowMonth'
|
{
|
||||||
},
|
title: "昨日",
|
||||||
{
|
key: "prve",
|
||||||
title: '上月',
|
},
|
||||||
key: 'prveMonth'
|
{
|
||||||
}
|
title: "本月",
|
||||||
])
|
key: "nowMonth",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "上月",
|
||||||
|
key: "prveMonth",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
function setPrveDay() {}
|
||||||
|
|
||||||
|
function setNowMoneth() {}
|
||||||
|
|
||||||
function setPrveDay() {
|
function setprveMoneth() {}
|
||||||
|
|
||||||
}
|
function setDay(start, end) {
|
||||||
|
value.value = [start.year, start.month, start.day, 0, 0, 0];
|
||||||
|
value1.value = [end.year, end.month, end.day, 23, 59, 59];
|
||||||
|
}
|
||||||
|
|
||||||
function setNowMoneth() {
|
function changeTime(key) {
|
||||||
|
const yearIndex = years.findIndex((v) => v == nowDate.year);
|
||||||
|
const prveyearIndex = years.findIndex((v) => v == nowDate.year) - 1;
|
||||||
|
const nowMonthIndex = nowDate.month - 1;
|
||||||
|
const nowDayIndex = nowDate.day - 1;
|
||||||
|
const dataMap = {
|
||||||
|
now: function () {
|
||||||
|
return {
|
||||||
|
start: {
|
||||||
|
year: yearIndex,
|
||||||
|
month: nowMonthIndex,
|
||||||
|
day: nowDayIndex,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
year: yearIndex,
|
||||||
|
month: nowMonthIndex,
|
||||||
|
day: nowDayIndex,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
prve: function () {
|
||||||
|
const oneDay = 1000 * 60 * 60 * 24;
|
||||||
|
const date = new Date(
|
||||||
|
new Date(nowDate.year, nowDate.month, nowDate.day, 0, 0, 0).getTime() -
|
||||||
|
oneDay
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
start: {
|
||||||
|
year: years.findIndex((v) => v == date.getFullYear()),
|
||||||
|
month: date.getMonth() - 1 < 0 ? 11 : date.getMonth() - 1,
|
||||||
|
day: date.getDate() - 1,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
year: years.findIndex((v) => v == date.getFullYear()),
|
||||||
|
month: date.getMonth() - 1 < 0 ? 11 : date.getMonth() - 1,
|
||||||
|
day: date.getDate() - 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
nowMonth: function () {
|
||||||
|
return {
|
||||||
|
start: {
|
||||||
|
year: yearIndex,
|
||||||
|
month: nowMonthIndex,
|
||||||
|
day: 0,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
year: yearIndex,
|
||||||
|
month: nowMonthIndex,
|
||||||
|
day: new Date(nowDate.year, nowDate.month, 0).getDate() - 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
prveMonth: function () {
|
||||||
|
const oneDay = 1000 * 60 * 60 * 24;
|
||||||
|
const date = new Date(
|
||||||
|
new Date(nowDate.year, nowDate.month - 1, 0, 0, 0).getTime() - oneDay
|
||||||
|
);
|
||||||
|
console.log(date.getMonth());
|
||||||
|
return {
|
||||||
|
start: {
|
||||||
|
year: years.findIndex((v) => v == date.getFullYear()),
|
||||||
|
month: date.getMonth(),
|
||||||
|
day: 0,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
year: years.findIndex((v) => v == date.getFullYear()),
|
||||||
|
month: date.getMonth(),
|
||||||
|
day: date.getDate(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const data = dataMap[key]();
|
||||||
|
setDay(data.start, data.end);
|
||||||
|
changeDays(false, value.value);
|
||||||
|
changeDays(true, value1.value);
|
||||||
|
|
||||||
}
|
console.log(value1.value);
|
||||||
|
const start = returnDateString(value.value);
|
||||||
|
const end = returnDateString(value1.value);
|
||||||
|
|
||||||
function setprveMoneth() {
|
emits("confirm", {
|
||||||
|
text: `${start}——${end}`,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
let value = ref([
|
||||||
|
years.length - 1,
|
||||||
|
nowDate.month - 1,
|
||||||
|
nowDate.day - 1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
]);
|
||||||
|
let value1 = ref([
|
||||||
|
years.length - 1,
|
||||||
|
nowDate.month - 1,
|
||||||
|
nowDate.day - 1,
|
||||||
|
23,
|
||||||
|
59,
|
||||||
|
59,
|
||||||
|
]);
|
||||||
|
|
||||||
}
|
let show = ref(false);
|
||||||
|
const emits = defineEmits("close", "open", "confirm");
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
show.value = !show.value;
|
||||||
|
if (show.value) {
|
||||||
|
emits("open", true);
|
||||||
|
} else {
|
||||||
|
emits("close", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setDay(start, end) {
|
function close() {
|
||||||
value.value = [
|
show.value = false;
|
||||||
start.year,
|
emits("close", false);
|
||||||
start.month,
|
}
|
||||||
start.day,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
value1.value = [
|
|
||||||
end.year,
|
|
||||||
end.month,
|
|
||||||
end.day,
|
|
||||||
23,
|
|
||||||
59,
|
|
||||||
59,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeTime(key) {
|
function open() {
|
||||||
const yearIndex = years.findIndex(v => v == nowDate.year)
|
show.value = true;
|
||||||
const prveyearIndex = years.findIndex(v => v == nowDate.year) - 1
|
emits("open", true);
|
||||||
const nowMonthIndex = nowDate.month - 1
|
}
|
||||||
const nowDayIndex = nowDate.day - 1
|
|
||||||
const dataMap = {
|
|
||||||
now: function() {
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year: yearIndex,
|
|
||||||
month: nowMonthIndex,
|
|
||||||
day: nowDayIndex
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year: yearIndex,
|
|
||||||
month: nowMonthIndex,
|
|
||||||
day: nowDayIndex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
prve: function() {
|
|
||||||
const oneDay=1000*60*60*24
|
|
||||||
const date=new Date(new Date(nowDate.year,nowDate.month,nowDate.day,0,0,0).getTime()-oneDay)
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year:years.findIndex(v=>v==date.getFullYear()),
|
|
||||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
|
||||||
day: date.getDate()-1
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year:years.findIndex(v=>v==date.getFullYear()),
|
|
||||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
|
||||||
day: date.getDate()-1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nowMonth: function() {
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year:yearIndex,
|
|
||||||
month:nowMonthIndex,
|
|
||||||
day: 0
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year:yearIndex,
|
|
||||||
month:nowMonthIndex,
|
|
||||||
day:new Date(nowDate.year, nowDate.month , 0).getDate() - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
prveMonth: function() {
|
|
||||||
const oneDay=1000*60*60*24
|
|
||||||
const date=new Date(new Date(nowDate.year, nowDate.month-1,0,0,0).getTime()-oneDay)
|
|
||||||
console.log(date.getMonth());
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year:years.findIndex(v=>v==date.getFullYear()),
|
|
||||||
month:date.getMonth(),
|
|
||||||
day: 0
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year:years.findIndex(v=>v==date.getFullYear()),
|
|
||||||
month:date.getMonth(),
|
|
||||||
day: date.getDate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const data = dataMap[key]()
|
|
||||||
setDay(data.start, data.end)
|
|
||||||
changeDays(false,value.value)
|
|
||||||
changeDays(true,value1.value)
|
|
||||||
|
|
||||||
console.log(value1.value);
|
|
||||||
const start = returnDateString(value.value)
|
|
||||||
const end = returnDateString(value1.value)
|
|
||||||
|
|
||||||
emits('confirm', {
|
|
||||||
text: `${start}——${end}`,
|
|
||||||
start,
|
|
||||||
end
|
|
||||||
})
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
let value = ref([
|
|
||||||
years.length - 1,
|
|
||||||
nowDate.month - 1,
|
|
||||||
nowDate.day - 1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
])
|
|
||||||
let value1 = ref([
|
|
||||||
years.length - 1,
|
|
||||||
nowDate.month - 1,
|
|
||||||
nowDate.day - 1,
|
|
||||||
23,
|
|
||||||
59,
|
|
||||||
59,
|
|
||||||
])
|
|
||||||
|
|
||||||
let show = ref(false)
|
function returnDateString(arr) {
|
||||||
const emits = defineEmits('close', 'open', 'confirm')
|
const year = years[arr[0]];
|
||||||
|
const month = ("0" + (arr[1] + 1)).slice(-2);
|
||||||
|
const day = ("0" + (arr[2] + 1)).slice(-2);
|
||||||
|
const hour = ("0" + arr[3]).slice(-2);
|
||||||
|
const min = ("0" + arr[4]).slice(-2);
|
||||||
|
const sen = ("0" + arr[5]).slice(-2);
|
||||||
|
|
||||||
function toggle() {
|
return `${year}-${month}-${day} ${hour}:${min}:${sen}`;
|
||||||
show.value = !show.value
|
}
|
||||||
if (show.value) {
|
|
||||||
emits('open', true)
|
|
||||||
} else {
|
|
||||||
emits('close', false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function close() {
|
function confirm(e) {
|
||||||
show.value = false
|
const start = returnDateString(value.value);
|
||||||
emits('close', false)
|
const end = returnDateString(value1.value);
|
||||||
}
|
console.log(start);
|
||||||
|
console.log(end);
|
||||||
|
//如果结尾时间小于开始时间
|
||||||
|
if (new Date(start).getTime() > new Date(end).getTime()) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: "结束时间不能小于开始时间",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
emits("confirm", {
|
||||||
|
text: `${start}——${end}`,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
function open() {
|
function returnMonthStart(arr) {
|
||||||
show.value = true
|
return new Date(years[arr[0]], months[arr[1]] - 1, 1).getDate();
|
||||||
emits('open', true)
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function returnDateString(arr) {
|
function returnMonthEnd(arr) {
|
||||||
const year = years[arr[0]]
|
return new Date(years[arr[0]], months[arr[1]], 0).getDate();
|
||||||
const month = arr[1] + 1
|
}
|
||||||
const day = arr[2] + 1
|
|
||||||
const hour = ('0' + arr[3]).slice(-2)
|
|
||||||
const min = ('0' + arr[4]).slice(-2)
|
|
||||||
const sen = ('0' + arr[5]).slice(-2)
|
|
||||||
return `${year}-${month}-${day} ${hour}:${min}:${sen}`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function changeDays(isDays1, arr) {
|
||||||
|
const end = returnMonthEnd(arr);
|
||||||
|
if (end) {
|
||||||
|
if (isDays1) {
|
||||||
|
days1.value = new Array(end).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
days.value = new Array(end).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function confirm(e) {
|
function bindChange(e) {
|
||||||
const start = returnDateString(value.value)
|
value.value = e.detail.value;
|
||||||
const end = returnDateString(value1.value)
|
changeDays(false, e.detail.value);
|
||||||
console.log(start);
|
}
|
||||||
console.log(end);
|
|
||||||
emits('confirm', {
|
|
||||||
text: `${start}——${end}`,
|
|
||||||
start,
|
|
||||||
end
|
|
||||||
})
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
|
|
||||||
function returnMonthStart(arr) {
|
function bindChange1(e) {
|
||||||
return new Date(years[arr[0]], months[arr[1]] - 1, 1).getDate();
|
value1.value = e.detail.value;
|
||||||
}
|
changeDays(true, e.detail.value);
|
||||||
|
}
|
||||||
|
|
||||||
function returnMonthEnd(arr) {
|
function getDayDate(date = new Date(), type) {
|
||||||
return new Date(years[arr[0]], months[arr[1]], 0).getDate();
|
const now = date;
|
||||||
}
|
if (type === "start") {
|
||||||
|
const startOfDay = new Date(
|
||||||
function changeDays(isDays1,arr){
|
now.getFullYear(),
|
||||||
const end = returnMonthEnd(arr)
|
now.getMonth(),
|
||||||
if (end) {
|
now.getDate()
|
||||||
if(isDays1){
|
);
|
||||||
days1.value= new Array(end).fill(1).map((v,
|
return startOfDay;
|
||||||
index) => {
|
}
|
||||||
return index + 1
|
if (type === "end") {
|
||||||
})
|
const endOfDay = new Date(
|
||||||
}else{
|
now.getFullYear(),
|
||||||
days.value= new Array(end).fill(1).map((v,
|
now.getMonth(),
|
||||||
index) => {
|
now.getDate(),
|
||||||
return index + 1
|
23,
|
||||||
})
|
59,
|
||||||
}
|
59,
|
||||||
|
999
|
||||||
}
|
);
|
||||||
}
|
return endOfDay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChange(e) {
|
function getMonthArea(date = new Date(), type) {
|
||||||
value.value = e.detail.value
|
let now = date;
|
||||||
changeDays(false, e.detail.value)
|
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||||
}
|
let currentMonthEnd = new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth() + 1,
|
||||||
|
0,
|
||||||
|
23,
|
||||||
|
59,
|
||||||
|
59,
|
||||||
|
999
|
||||||
|
);
|
||||||
|
if (type === "start") {
|
||||||
|
return currentMonthStart;
|
||||||
|
}
|
||||||
|
if (type === "end") {
|
||||||
|
return currentMonthEnd;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
start: currentMonthStart,
|
||||||
|
end: currentMonthEnd,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function bindChange1(e) {
|
function nullFunction() {}
|
||||||
value1.value = e.detail.value
|
|
||||||
changeDays(true, e.detail.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDayDate(date = new Date(), type) {
|
function pickend(e) {
|
||||||
const now = date
|
console.log(e);
|
||||||
if (type === 'start') {
|
}
|
||||||
const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
||||||
return startOfDay
|
|
||||||
}
|
|
||||||
if (type === 'end') {
|
|
||||||
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
|
||||||
return endOfDay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMonthArea(date = new Date(), type) {
|
function pickend1(e) {
|
||||||
let now = date
|
console.log(e);
|
||||||
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
}
|
||||||
let currentMonthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
defineExpose({
|
||||||
if (type === 'start') {
|
close,
|
||||||
return currentMonthStart
|
open,
|
||||||
}
|
confirm,
|
||||||
if (type === 'end') {
|
toggle,
|
||||||
return currentMonthEnd;
|
});
|
||||||
}
|
|
||||||
return {
|
|
||||||
start: currentMonthStart,
|
|
||||||
end: currentMonthEnd
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function nullFunction() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function pickend(e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pickend1(e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
defineExpose({
|
|
||||||
close,
|
|
||||||
open,
|
|
||||||
confirm,
|
|
||||||
toggle
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.fastTime {
|
.fastTime {
|
||||||
.item {
|
.item {
|
||||||
background-color: rgb(247, 247, 247);
|
background-color: rgb(247, 247, 247);
|
||||||
padding: 6rpx 40rpx;
|
padding: 6rpx 40rpx;
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
border-bottom: 1px solid #eee;
|
border-bottom: 1px solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close {
|
.close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
right: 30rpx;
|
right: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mask {
|
.mask {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
background-color: rgba(0, 0, 0, .7);
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
border-radius: 16rpx 16rpx 0 0;
|
border-radius: 16rpx 16rpx 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed_b {
|
.fixed_b {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.picker-view {
|
.picker-view {
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
height: 300rpx;
|
height: 300rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
line-height: 34px;
|
line-height: 34px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,426 +1,421 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="time-wrapper">
|
<view class="time-wrapper">
|
||||||
<view v-for="(v, i) in timeList" :key="i" class="timelistbox">
|
<view v-for="(v, i) in timeList" :key="i" class="timelistbox">
|
||||||
<view class="time-item" @tap="changeTime(v.value)" :class="{ 'time-selected':v.value==selected }">
|
<view
|
||||||
{{v.label}}
|
class="time-item"
|
||||||
</view>
|
@tap="changeTime(v.value)"
|
||||||
<view class="xian" v-if="v.value==selected "> </view>
|
:class="[v.value == selected ? 'time-selected' : '']"
|
||||||
</view>
|
>
|
||||||
</view>
|
{{ v.label }}
|
||||||
|
</view>
|
||||||
|
<view class="xian" v-if="v.value == selected"> </view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="pageSalesSummaryContent">
|
<view class="pageSalesSummaryContent">
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class=""> 实收金额(元) </view>
|
<view class=""> 实收金额(元) </view>
|
||||||
<view class=""> {{list.saleAmount?list.saleAmount:0}} </view>
|
<view class=""> {{ list.payAmount ? list.payAmount : 0 }} </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class=""> 优惠金额(元) </view>
|
<view class=""> 优惠金额(元) </view>
|
||||||
<view class=""> {{list.discountAmount?list.discountAmount:0}} </view>
|
<view class="">
|
||||||
</view>
|
{{ list.discountAmount ? list.discountAmount : 0 }}
|
||||||
<view class="">
|
</view>
|
||||||
<view class=""> 客单价(元) </view>
|
</view>
|
||||||
<view class=""> {{list.customerUnitPrice?list.customerUnitPrice:0}} </view>
|
<view class="">
|
||||||
</view>
|
<view class=""> 客单价(元) </view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class=""> 会员消费(元) </view>
|
{{ list.avgPayAmount ? list.avgPayAmount : 0 }}
|
||||||
<view class=""> {{list.memberPayAmount?list.memberPayAmount:0}} </view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class=""> 新增会员(人) </view>
|
<view class=""> 会员消费(元) </view>
|
||||||
<view class=""> {{list.newMemberCount?list.newMemberCount:0}} </view>
|
<view class="">
|
||||||
</view>
|
{{ list.memberPayAmount ? list.memberPayAmount : 0 }}
|
||||||
<view class="">
|
</view>
|
||||||
<view class=""> 翻台率(%) </view>
|
</view>
|
||||||
<view class=""> {{list.tableTurnoverRate?list.tableTurnoverRate:0}} </view>
|
<view class="">
|
||||||
</view>
|
<view class=""> 新增会员(人) </view>
|
||||||
</view>
|
<view class="">
|
||||||
<view class="table-scroll">
|
{{ list.newMemberCount ? list.newMemberCount : 0 }}
|
||||||
<template>
|
</view>
|
||||||
<view class="color-333 u-font-28 bg-gray default-box-padding" style="padding-top:80px;">
|
</view>
|
||||||
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
<view class="">
|
||||||
<view class="bg-fff border-r-12 u-flex no-wrap u-col-top">
|
<view class=""> 翻台率(%) </view>
|
||||||
<view class="constantbox">
|
<view class="">
|
||||||
<view class="constantboxitem">
|
{{ list.turnoverRate ? list.turnoverRate : 0 }}
|
||||||
<view class="head">商品名称</view>
|
</view>
|
||||||
<view class="head">总数量</view>
|
</view>
|
||||||
<view class="head">金额</view>
|
</view>
|
||||||
</view>
|
<view class="table-scroll">
|
||||||
<view class="constantboxitem" v-for="(item,index) in tableList" :key="index"
|
<view class="color-333 u-font-28 bg-gray default-box-padding">
|
||||||
@click="toDetail(item)">
|
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
||||||
<view class="head" style="padding-left: 16rpx;">
|
<view class="bg-fff border-r-12 u-flex no-wrap u-col-top">
|
||||||
<image v-if="index==0" src="../pageTable/index/images/1.png"
|
<view class="constantbox">
|
||||||
style="width: 22rpx;height: 30rpx;" mode=""></image>
|
<view class="constantboxitem">
|
||||||
<image v-else-if="index==1" src="../pageTable/index/images/2.png"
|
<view class="head">商品名称</view>
|
||||||
style="width: 22rpx;height: 30rpx;" mode=""></image>
|
<view class="head">总数量</view>
|
||||||
<image v-else-if="index==2" src="../pageTable/index/images/3.png"
|
<view class="head">金额</view>
|
||||||
style="width: 22rpx;height: 30rpx;" mode=""></image>
|
</view>
|
||||||
{{item.productName}}
|
<view
|
||||||
</view>
|
class="constantboxitem"
|
||||||
<view class="head">{{item.number}}</view>
|
v-for="(item, index) in tableList"
|
||||||
<view class="head">{{item.amount || '无'}}</view>
|
:key="index"
|
||||||
</view>
|
@click="toDetail(item)"
|
||||||
</view>
|
>
|
||||||
</view>
|
<view class="head" style="padding-left: 16rpx">
|
||||||
</scroll-view>
|
<image
|
||||||
</view>
|
v-if="index == 0"
|
||||||
</template>
|
src="../pageTable/index/images/1.png"
|
||||||
</view>
|
style="width: 22rpx; height: 30rpx"
|
||||||
<view class="bottombtn" @tap="toUrl">
|
mode=""
|
||||||
更多 <uni-icons type="right" size="16"></uni-icons>
|
></image>
|
||||||
</view>
|
<image
|
||||||
<datePickerview @confirm="datePickerConfirm" ref="datePicker"></datePickerview>
|
v-else-if="index == 1"
|
||||||
|
src="../pageTable/index/images/2.png"
|
||||||
|
style="width: 22rpx; height: 30rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
v-else-if="index == 2"
|
||||||
|
src="../pageTable/index/images/3.png"
|
||||||
|
style="width: 22rpx; height: 30rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
{{ item.productName }}
|
||||||
|
</view>
|
||||||
|
<view class="head">{{ item.saleCount || 0 }}</view>
|
||||||
|
<view class="head">{{ item.saleAmount || 0 }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bottombtn" @tap="toUrl">
|
||||||
|
更多 <uni-icons type="right" size="16"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<datePickerview
|
||||||
|
@close="datePickerClose"
|
||||||
|
|
||||||
|
@confirm="datePickerConfirm"
|
||||||
|
ref="datePicker"
|
||||||
|
></datePickerview>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from "vue";
|
||||||
import datePickerview from './components/my-date-pickerview.vue'
|
import datePickerview from "./components/my-date-pickerview.vue";
|
||||||
import dayjs from 'dayjs' //时间格式库
|
import dayjs from "dayjs"; //时间格式库
|
||||||
import go from '@/commons/utils/go.js'
|
import go from "@/commons/utils/go.js";
|
||||||
import { getTrade, productSaleDate } from '@/http/api/summary.js'
|
import { getTrade } from "@/http/api/summary.js";
|
||||||
|
import { saleSummaryPage } from "@/http/api/order/summary.js";
|
||||||
const datePicker=ref()
|
import { timeList } from "@/data/index.js";
|
||||||
const timeList = [{
|
|
||||||
label: '今天',
|
|
||||||
value: 'today'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '昨天',
|
|
||||||
value: 'yesterday'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '本周',
|
|
||||||
value: 'circumference'
|
|
||||||
}, {
|
|
||||||
label: '本月',
|
|
||||||
value: 'moon'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '自定义',
|
|
||||||
value: 'custom'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
let selected = ref('today')
|
|
||||||
let list = ref({})
|
|
||||||
let tableList = ref([])
|
|
||||||
let day = ref(1)
|
|
||||||
onMounted(() => {
|
|
||||||
getlist()
|
|
||||||
gettableData()
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取营业数据
|
|
||||||
* @param {Object} start
|
|
||||||
* @param {Object} end
|
|
||||||
*/
|
|
||||||
function getlist(start, end) {
|
|
||||||
let startTime, endTime;
|
|
||||||
if (selected.value == 'today') {
|
|
||||||
startTime = dayjs().format('YYYY-MM-DD') + ' 00:00:00'
|
|
||||||
endTime = dayjs().format('YYYY-MM-DD') + ' 23:59:59'
|
|
||||||
} else if (selected.value == 'yesterday') {
|
|
||||||
startTime = formatTime() + ' 00:00:00'
|
|
||||||
endTime = formatTime() + ' 23:59:59'
|
|
||||||
} else if (selected.value == 'circumference') {
|
|
||||||
var now = new Date();
|
|
||||||
var nowTime = now.getTime();
|
|
||||||
var day = now.getDay();
|
|
||||||
var oneDayTime = 24 * 60 * 60 * 1000;
|
|
||||||
//显示周一
|
|
||||||
var MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
||||||
//显示周日
|
|
||||||
var SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
||||||
startTime = dayjs(MondayTime).format('YYYY-MM-DD 00:00:00')
|
|
||||||
endTime = dayjs(SundayTime).format('YYYY-MM-DD 23:59:59')
|
|
||||||
} else if (selected.value == 'moon') {
|
|
||||||
startTime = dayjs().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
|
|
||||||
endTime = dayjs().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
|
|
||||||
} else if (selected.value == 'custom') {
|
|
||||||
let s = start.substring(0, start.indexOf(' '))
|
|
||||||
let e = end.substring(0, end.indexOf(' '))
|
|
||||||
startTime = s + ' 00:00:00'
|
|
||||||
endTime = e + ' 23:59:59'
|
|
||||||
}
|
|
||||||
getTrade({
|
|
||||||
beginDate: startTime,
|
|
||||||
endDate: endTime,
|
|
||||||
}).then((res) => {
|
|
||||||
list.value = res
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取销售数据
|
|
||||||
*/
|
|
||||||
function gettableData() {
|
|
||||||
if (selected.value == 'today') {
|
|
||||||
day.value = 1
|
|
||||||
} else if (selected.value == 'yesterday') {
|
|
||||||
day.value = 1
|
|
||||||
} else if (selected.value == 'circumference') {
|
|
||||||
day.value = 7
|
|
||||||
} else if (selected.value == 'moon') {
|
|
||||||
day.value = 30
|
|
||||||
} else if (selected.value == 'custom') {
|
|
||||||
day.value = 30
|
|
||||||
}
|
|
||||||
productSaleDate({
|
|
||||||
day: day.value,
|
|
||||||
page: 1,
|
|
||||||
size: 5
|
|
||||||
}).then((res) => {
|
|
||||||
tableList.value = res.records
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前时间
|
|
||||||
*/
|
|
||||||
function getdate() {
|
|
||||||
const dt = new Date();
|
|
||||||
const y = dt.getFullYear();
|
|
||||||
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
|
||||||
const d = (dt.getDate() + "").padStart(2, "0");
|
|
||||||
const hh = (dt.getHours() + "").padStart(2, "0");
|
|
||||||
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
|
||||||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
|
||||||
return `${y}-${m}-${d}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取昨天时间
|
|
||||||
*/
|
|
||||||
const formatTime = () => {
|
|
||||||
let strDate = getdate()
|
|
||||||
let dateFormat = new Date(strDate);
|
|
||||||
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
|
||||||
dateFormat = new Date(dateFormat);
|
|
||||||
let y = dateFormat.getFullYear()
|
|
||||||
let m = (dateFormat.getMonth() + 1).toString().padStart(2, '0')
|
|
||||||
let d = dateFormat.getDate().toString().padStart(2, '0')
|
|
||||||
return `${y}-${m}-${d}`
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间切换
|
|
||||||
* @param {Object} e
|
|
||||||
*/
|
|
||||||
function changeTime(e) {
|
|
||||||
selected.value = e
|
|
||||||
if (e == 'custom') {
|
|
||||||
datePicker.value.toggle()
|
|
||||||
} else {
|
|
||||||
getlist()
|
|
||||||
gettableData()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义确认
|
|
||||||
* @param {Object} e
|
|
||||||
*/
|
|
||||||
function datePickerConfirm(e) {
|
|
||||||
console.log(e)
|
|
||||||
getlist(e.start, e.end)
|
|
||||||
gettableData()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更多
|
|
||||||
*/
|
|
||||||
function toUrl() {
|
|
||||||
go.to('PAGES_PRODUCT_SALES_RANKING', {
|
|
||||||
day: day.value
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function resetDatePicker() {
|
||||||
|
datePickerData.value.beginDate = "";
|
||||||
|
datePickerData.value.endDate = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function datePickerClose() {
|
||||||
|
console.log("datePickerClose");
|
||||||
|
if (!datePickerData.value.beginDate && !datePickerData.value.endDate) {
|
||||||
|
selected.value = oldSelected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const datePicker = ref();
|
||||||
|
|
||||||
|
let selected = ref("today");
|
||||||
|
let oldSelected = selected.value;
|
||||||
|
|
||||||
|
let list = ref({});
|
||||||
|
let tableList = ref([]);
|
||||||
|
let day = ref(1);
|
||||||
|
onMounted(() => {
|
||||||
|
getData();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取营业数据
|
||||||
|
* @param {Object} beginDate
|
||||||
|
* @param {Object} endDate
|
||||||
|
*/
|
||||||
|
function getlist(beginDate, endDate) {
|
||||||
|
getTrade({
|
||||||
|
beginDate,
|
||||||
|
endDate,
|
||||||
|
rangeType: selected.value,
|
||||||
|
}).then((res) => {
|
||||||
|
list.value = res;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取销售数据
|
||||||
|
* @param {Object} beginDate
|
||||||
|
* @param {Object} endDate
|
||||||
|
*/
|
||||||
|
function gettableData(beginDate, endDate) {
|
||||||
|
saleSummaryPage({
|
||||||
|
beginDate,
|
||||||
|
endDate,
|
||||||
|
rangeType: selected.value,
|
||||||
|
}).then((res) => {
|
||||||
|
tableList.value = (res || []).slice(0, 5);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间切换
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
function changeTime(e) {
|
||||||
|
selected.value = e;
|
||||||
|
resetDatePicker();
|
||||||
|
|
||||||
|
if (e == "custom") {
|
||||||
|
datePicker.value.toggle();
|
||||||
|
} else {
|
||||||
|
oldSelected = e;
|
||||||
|
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const datePickerData = ref({
|
||||||
|
beginDate: "",
|
||||||
|
endDate: "",
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 自定义确认
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
function datePickerConfirm(e) {
|
||||||
|
datePickerData.value.beginDate = e.start;
|
||||||
|
datePickerData.value.endDate = e.end;
|
||||||
|
getData(e.start, e.end);
|
||||||
|
}
|
||||||
|
function getData(start, end) {
|
||||||
|
let beginDate, endDate;
|
||||||
|
if (selected.value == "custom") {
|
||||||
|
beginDate = start.substring(0, start.indexOf(" "));
|
||||||
|
endDate = end.substring(0, end.indexOf(" "));
|
||||||
|
} else {
|
||||||
|
beginDate = timeList.find((item) => item.value == selected.value).beginDate;
|
||||||
|
endDate = timeList.find((item) => item.value == selected.value).endDate;
|
||||||
|
}
|
||||||
|
getlist(beginDate, endDate);
|
||||||
|
gettableData(beginDate, endDate);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 更多
|
||||||
|
*/
|
||||||
|
function toUrl() {
|
||||||
|
let beginDate, endDate;
|
||||||
|
if (selected.value == "custom") {
|
||||||
|
beginDate = datePickerData.value.beginDate.substring(
|
||||||
|
0,
|
||||||
|
datePickerData.value.beginDate.indexOf(" ")
|
||||||
|
);
|
||||||
|
endDate = datePickerData.value.endDate.substring(
|
||||||
|
0,
|
||||||
|
datePickerData.value.endDate.indexOf(" ")
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
beginDate = timeList.find((item) => item.value == selected.value).beginDate;
|
||||||
|
endDate = timeList.find((item) => item.value == selected.value).endDate;
|
||||||
|
}
|
||||||
|
go.to("PAGES_PRODUCT_SALES_RANKING", {
|
||||||
|
beginDate,
|
||||||
|
endDate,
|
||||||
|
rangeType: selected.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.fixed-top {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
.fixed-top {
|
.bottom {
|
||||||
padding: 32rpx 28rpx;
|
background-color: transparent;
|
||||||
z-index: 100;
|
bottom: 84rpx;
|
||||||
}
|
left: 28rpx;
|
||||||
|
right: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.bottom {
|
.table {
|
||||||
background-color: transparent;
|
border-radius: 12rpx 12rpx 0rpx 0rpx;
|
||||||
bottom: 84rpx;
|
overflow: hidden;
|
||||||
left: 28rpx;
|
font-size: 24rpx;
|
||||||
right: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table {
|
.constantbox {
|
||||||
border-radius: 12rpx 12rpx 0rpx 0rpx;
|
.constantboxitem {
|
||||||
overflow: hidden;
|
display: flex;
|
||||||
font-size: 24rpx;
|
|
||||||
|
|
||||||
.constantbox {
|
.head {
|
||||||
.constantboxitem {
|
width: 220rpx;
|
||||||
display: flex;
|
padding: 32rpx 24rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333333;
|
||||||
|
overflow: hidden; //超出的文本隐藏
|
||||||
|
text-overflow: ellipsis; //溢出用省略号显示
|
||||||
|
white-space: nowrap; //溢出不换行
|
||||||
|
}
|
||||||
|
|
||||||
.head {
|
.head:nth-child(4) {
|
||||||
width: 220rpx;
|
width: 300rpx;
|
||||||
padding: 32rpx 24rpx;
|
}
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #333333;
|
|
||||||
overflow: hidden; //超出的文本隐藏
|
|
||||||
text-overflow: ellipsis; //溢出用省略号显示
|
|
||||||
white-space: nowrap; //溢出不换行
|
|
||||||
}
|
|
||||||
|
|
||||||
.head:nth-child(4) {
|
.head:nth-child(5) {
|
||||||
width: 300rpx;
|
width: 300rpx;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.head:nth-child(5) {
|
.constantboxitem:nth-child(even) {
|
||||||
width: 300rpx;
|
background: #fff;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.constantboxitem:nth-child(even) {
|
.constantboxitem:nth-child(odd) {
|
||||||
background: #fff;
|
background: #f7f6fb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.constantboxitem:nth-child(odd) {
|
.constantboxitem:nth-child(1) {
|
||||||
background: #F7F6FB;
|
background: #aebad2;
|
||||||
}
|
color: #fff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.constantboxitem:nth-child(1) {
|
.item:nth-of-type(2n + 1) {
|
||||||
background: #AEBAD2;
|
background-color: rgb(249, 249, 249);
|
||||||
color: #fff;
|
}
|
||||||
font-size: 24rpx;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.item:nth-of-type(2n+1) {
|
|
||||||
background-color: rgb(249, 249, 249);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.time-wrapper {
|
.time-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
padding-bottom: 16rpx;
|
padding-bottom: 16rpx;
|
||||||
padding-top: 16rpx;
|
padding-top: 16rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
|
||||||
.timelistbox {
|
.timelistbox {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.time-item {
|
.time-item {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-bottom: 10rpx;
|
padding-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xian {
|
.xian {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 3rpx;
|
height: 3rpx;
|
||||||
background-color: #318AFE;
|
background-color: #318afe;
|
||||||
// position: absolute;
|
// position: absolute;
|
||||||
// left: 16rpx;
|
// left: 16rpx;
|
||||||
// bottom: 0;
|
// bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-selected {
|
.time-selected {
|
||||||
color: #318afe;
|
color: #318afe;
|
||||||
font-size: 32rpx !important;
|
font-size: 32rpx !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pageSalesSummaryContent {
|
.pageSalesSummaryContent {
|
||||||
height: 320rpx;
|
height: 320rpx;
|
||||||
margin: 20rpx 28rpx;
|
margin: 20rpx 28rpx;
|
||||||
background-image: url('./svg/bgimg.svg');
|
background-image: url("./svg/bgimg.svg");
|
||||||
background-size: 694rpx 320rpx;
|
background-size: 694rpx 320rpx;
|
||||||
padding: 48rpx 28rpx;
|
padding: 48rpx 28rpx;
|
||||||
.df;
|
.df;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
>view {
|
> view {
|
||||||
padding-right: 52rpx;
|
padding-right: 52rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表格
|
// 表格
|
||||||
.table-scroll {
|
.table-scroll {
|
||||||
// width: calc(100% - 5px);
|
// width: calc(100% - 5px);
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin: 32rpx 28rpx;
|
margin: 32rpx 28rpx;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
border-radius: 30rpx 30rpx 0 0;
|
border-radius: 30rpx 30rpx 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
.table-scroll .table {
|
||||||
|
table-layout: fixed;
|
||||||
|
// width: calc(100% - 10rpx);
|
||||||
|
}
|
||||||
|
|
||||||
.table-scroll .table {
|
.table-scroll .thead {
|
||||||
table-layout: fixed;
|
display: table-row;
|
||||||
// width: calc(100% - 10rpx);
|
background-color: bisque;
|
||||||
}
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.table-scroll .thead {
|
.table-scroll .tbody {
|
||||||
display: table-row;
|
overflow-y: scroll;
|
||||||
background-color: bisque;
|
overflow-x: hidden;
|
||||||
font-size: 24rpx;
|
display: block;
|
||||||
}
|
// width: 1040rpx;
|
||||||
|
width: 100%;
|
||||||
|
// width: calc(100% );
|
||||||
|
}
|
||||||
|
|
||||||
.table-scroll .tbody {
|
// .table-scroll th,
|
||||||
overflow-y: scroll;
|
// td {
|
||||||
overflow-x: hidden;
|
// height: 82rpx;
|
||||||
display: block;
|
// overflow: hidden;
|
||||||
// width: 1040rpx;
|
// text-overflow: ellipsis;
|
||||||
width: 100%;
|
// width: 250rpx;
|
||||||
// width: calc(100% );
|
// // border: 0.7rpx solid red;
|
||||||
}
|
// border: 0.7rpx solid rgba(126, 155, 212, 0.27);
|
||||||
|
// }
|
||||||
|
|
||||||
// .table-scroll th,
|
.bottombtn {
|
||||||
// td {
|
width: 694rpx;
|
||||||
// height: 82rpx;
|
height: 56rpx;
|
||||||
// overflow: hidden;
|
line-height: 56rpx;
|
||||||
// text-overflow: ellipsis;
|
text-align: center;
|
||||||
// width: 250rpx;
|
margin: 0rpx auto;
|
||||||
// // border: 0.7rpx solid red;
|
background: #f1f1f1;
|
||||||
// border: 0.7rpx solid rgba(126, 155, 212, 0.27);
|
font-size: 24rpx;
|
||||||
// }
|
border-radius: 0rpx 0rpx 28rpx 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.bottombtn {
|
.df() {
|
||||||
width: 694rpx;
|
display: flex;
|
||||||
height: 56rpx;
|
align-items: center;
|
||||||
line-height: 56rpx;
|
}
|
||||||
text-align: center;
|
|
||||||
margin: 0rpx auto;
|
|
||||||
background: #F1F1F1;
|
|
||||||
font-size: 24rpx;
|
|
||||||
border-radius: 0rpx 0rpx 28rpx 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.df() {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
.min-page{
|
.min-page {
|
||||||
height: 20vh;
|
height: 20vh;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,153 +1,156 @@
|
|||||||
<template>
|
<template>
|
||||||
<template>
|
<view class="color-333 u-font-28 bg-gray default-box-padding">
|
||||||
<view class="color-333 u-font-28 bg-gray default-box-padding" >
|
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
||||||
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
<view class="bg-fff border-r-12 u-flex no-wrap u-col-top">
|
||||||
<view class="bg-fff border-r-12 u-flex no-wrap u-col-top">
|
<view class="constantbox">
|
||||||
<view class="constantbox">
|
<view class="constantboxitem">
|
||||||
<view class="constantboxitem">
|
<view class="head">商品名称</view>
|
||||||
<view class="head">商品名称</view>
|
<view class="head">总数量</view>
|
||||||
<view class="head">总数量</view>
|
<view class="head">金额</view>
|
||||||
<view class="head">金额</view>
|
</view>
|
||||||
</view>
|
<view
|
||||||
<view class="constantboxitem" v-for="(item,index) in tableList" :key="index"
|
class="constantboxitem"
|
||||||
@click="toDetail(item)">
|
v-for="(item, index) in tableList"
|
||||||
<view class="head">{{item.productName}}</view>
|
:key="index"
|
||||||
<view class="head">{{item.number}}</view>
|
@click="toDetail(item)"
|
||||||
<view class="head">{{item.amount || '无'}}</view>
|
>
|
||||||
</view>
|
<view class="head">{{ item.productName }}</view>
|
||||||
</view>
|
<view class="head">{{ item.saleCount || 0 }}</view>
|
||||||
</view>
|
<view class="head">{{ item.saleAmount || 0 }}</view>
|
||||||
</scroll-view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import { productSaleDate } from '@/http/api/summary.js'
|
import { onMounted, reactive, ref } from "vue";
|
||||||
|
import { saleSummaryPage } from "@/http/api/order/summary.js";
|
||||||
let tableList = ref([])
|
|
||||||
let props = defineProps({
|
let tableList = ref([]);
|
||||||
day: {
|
let props = defineProps({
|
||||||
type: Number
|
day: {
|
||||||
}
|
type: Number,
|
||||||
})
|
},
|
||||||
|
});
|
||||||
onMounted(() => {
|
const options = reactive({
|
||||||
gettableData()
|
beginDate: "",
|
||||||
})
|
endDate: "",
|
||||||
|
rangeType: "",
|
||||||
/**
|
});
|
||||||
* 获取销售数据
|
onLoad((opt) => {
|
||||||
*/
|
console.log(opt);
|
||||||
function gettableData() {
|
Object.assign(options, opt);
|
||||||
productSaleDate({
|
gettableData();
|
||||||
day: props.day,
|
});
|
||||||
page: 1,
|
|
||||||
size: 50
|
/**
|
||||||
}).then((res) => {
|
* 获取销售数据
|
||||||
tableList.value = res.records
|
*/
|
||||||
})
|
function gettableData() {
|
||||||
}
|
saleSummaryPage(options).then((res) => {
|
||||||
|
tableList.value = res || [];
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.table-scroll {
|
.table-scroll {
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin: 32rpx 28rpx;
|
margin: 32rpx 28rpx;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
border-radius: 30rpx 30rpx 0 0;
|
border-radius: 30rpx 30rpx 0 0;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
.table-scroll table {
|
||||||
.table-scroll table {
|
table-layout: fixed;
|
||||||
table-layout: fixed;
|
}
|
||||||
}
|
|
||||||
|
.table-scroll thead {
|
||||||
.table-scroll thead {
|
display: table-row;
|
||||||
display: table-row;
|
background-color: bisque;
|
||||||
background-color: bisque;
|
font-size: 24rpx;
|
||||||
font-size: 24rpx;
|
}
|
||||||
}
|
|
||||||
|
.table-scroll tbody {
|
||||||
.table-scroll tbody {
|
overflow-y: scroll;
|
||||||
overflow-y: scroll;
|
overflow-x: hidden;
|
||||||
overflow-x: hidden;
|
display: block;
|
||||||
display: block;
|
width: 100%;
|
||||||
width: 100%;
|
}
|
||||||
}
|
|
||||||
|
.table-scroll th,
|
||||||
.table-scroll th,
|
td {
|
||||||
td {
|
height: 82rpx;
|
||||||
height: 82rpx;
|
overflow: hidden;
|
||||||
overflow: hidden;
|
text-overflow: ellipsis;
|
||||||
text-overflow: ellipsis;
|
width: 250rpx;
|
||||||
width: 250rpx;
|
border: 0.7rpx solid rgba(126, 155, 212, 0.27);
|
||||||
border: 0.7rpx solid rgba(126, 155, 212, 0.27);
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.fixed-top {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
.fixed-top {
|
.bottom {
|
||||||
padding: 32rpx 28rpx;
|
background-color: transparent;
|
||||||
z-index: 100;
|
bottom: 84rpx;
|
||||||
}
|
left: 28rpx;
|
||||||
|
right: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.bottom {
|
.table {
|
||||||
background-color: transparent;
|
border-radius: 12rpx 12rpx 0rpx 0rpx;
|
||||||
bottom: 84rpx;
|
overflow: hidden;
|
||||||
left: 28rpx;
|
font-size: 24rpx;
|
||||||
right: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table {
|
.constantbox {
|
||||||
border-radius: 12rpx 12rpx 0rpx 0rpx;
|
.constantboxitem {
|
||||||
overflow: hidden;
|
display: flex;
|
||||||
font-size: 24rpx;
|
|
||||||
|
|
||||||
.constantbox {
|
.head {
|
||||||
.constantboxitem {
|
width: 220rpx;
|
||||||
display: flex;
|
padding: 32rpx 24rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333333;
|
||||||
|
overflow: hidden; //超出的文本隐藏
|
||||||
|
text-overflow: ellipsis; //溢出用省略号显示
|
||||||
|
white-space: nowrap; //溢出不换行
|
||||||
|
}
|
||||||
|
|
||||||
.head {
|
.head:nth-child(4) {
|
||||||
width: 220rpx;
|
width: 300rpx;
|
||||||
padding: 32rpx 24rpx;
|
}
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #333333;
|
|
||||||
overflow: hidden; //超出的文本隐藏
|
|
||||||
text-overflow: ellipsis; //溢出用省略号显示
|
|
||||||
white-space: nowrap; //溢出不换行
|
|
||||||
}
|
|
||||||
|
|
||||||
.head:nth-child(4) {
|
.head:nth-child(5) {
|
||||||
width: 300rpx;
|
width: 300rpx;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.head:nth-child(5) {
|
.constantboxitem:nth-child(even) {
|
||||||
width: 300rpx;
|
background: #fff;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.constantboxitem:nth-child(even) {
|
.constantboxitem:nth-child(odd) {
|
||||||
background: #fff;
|
background: #f7f6fb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.constantboxitem:nth-child(odd) {
|
.constantboxitem:nth-child(1) {
|
||||||
background: #F7F6FB;
|
background: #aebad2;
|
||||||
}
|
color: #fff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.constantboxitem:nth-child(1) {
|
.item:nth-of-type(2n + 1) {
|
||||||
background: #AEBAD2;
|
background-color: rgb(249, 249, 249);
|
||||||
color: #fff;
|
}
|
||||||
font-size: 24rpx;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.item:nth-of-type(2n+1) {
|
|
||||||
background-color: rgb(249, 249, 249);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
411
pageSalesSummary/sales.vue
Normal file
@@ -0,0 +1,411 @@
|
|||||||
|
<template>
|
||||||
|
<view class="time-wrapper">
|
||||||
|
<view v-for="(v, i) in timeList" :key="i" class="timelistbox">
|
||||||
|
<view
|
||||||
|
class="time-item"
|
||||||
|
@tap="changeTime(v.value)"
|
||||||
|
:class="[v.value == selected ? 'time-selected' : '']"
|
||||||
|
>
|
||||||
|
{{ v.label }}
|
||||||
|
</view>
|
||||||
|
<view class="xian" v-if="v.value == selected"> </view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="pageSalesSummaryContent">
|
||||||
|
<view class="">
|
||||||
|
<view class="">总金额(元) </view>
|
||||||
|
<view class=""> {{ list.totalAmount ? list.totalAmount : 0 }} </view>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<view class=""> 退款金额(元) </view>
|
||||||
|
<view class="">
|
||||||
|
{{ list.refundAmount ? list.refundAmount : 0 }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<view class=""> 总数量 </view>
|
||||||
|
<view class="">
|
||||||
|
{{ list.saleCount ? list.saleCount : 0 }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<view class=""> 退单量 </view>
|
||||||
|
<view class="">
|
||||||
|
{{ list.refundCount ? list.refundCount : 0 }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="table-scroll">
|
||||||
|
<view class="color-333 u-font-28 bg-gray default-box-padding">
|
||||||
|
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
||||||
|
<view class="bg-fff border-r-12 u-flex no-wrap u-col-top">
|
||||||
|
<view class="constantbox">
|
||||||
|
<view class="constantboxitem">
|
||||||
|
<view class="head">商品名称</view>
|
||||||
|
<view class="head">总数量</view>
|
||||||
|
<view class="head">金额</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="constantboxitem"
|
||||||
|
v-for="(item, index) in tableList"
|
||||||
|
:key="index"
|
||||||
|
@click="toDetail(item)"
|
||||||
|
>
|
||||||
|
<view class="head" style="padding-left: 16rpx">
|
||||||
|
<image
|
||||||
|
v-if="index == 0"
|
||||||
|
src="../pageTable/index/images/1.png"
|
||||||
|
style="width: 22rpx; height: 30rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
v-else-if="index == 1"
|
||||||
|
src="../pageTable/index/images/2.png"
|
||||||
|
style="width: 22rpx; height: 30rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
v-else-if="index == 2"
|
||||||
|
src="../pageTable/index/images/3.png"
|
||||||
|
style="width: 22rpx; height: 30rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
{{ item.productName }}
|
||||||
|
</view>
|
||||||
|
<view class="head">{{ item.saleCount || 0 }}</view>
|
||||||
|
<view class="head">{{ item.saleAmount || 0 }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bottombtn" @tap="toUrl">
|
||||||
|
更多 <uni-icons type="right" size="16"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<datePickerview
|
||||||
|
@close="datePickerClose"
|
||||||
|
@confirm="datePickerConfirm"
|
||||||
|
ref="datePicker"
|
||||||
|
></datePickerview>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from "vue";
|
||||||
|
import datePickerview from "./components/my-date-pickerview.vue";
|
||||||
|
import dayjs from "dayjs"; //时间格式库
|
||||||
|
import go from "@/commons/utils/go.js";
|
||||||
|
import { saleSummaryPage, saleSummaryCount } from "@/http/api/order/summary.js";
|
||||||
|
import { timeList } from "@/data/index.js";
|
||||||
|
|
||||||
|
function datePickerClose() {
|
||||||
|
console.log("datePickerClose");
|
||||||
|
if (!datePickerData.value.beginDate && !datePickerData.value.endDate) {
|
||||||
|
selected.value = oldSelected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const datePicker = ref();
|
||||||
|
|
||||||
|
let selected = ref("today");
|
||||||
|
let oldSelected = selected.value;
|
||||||
|
|
||||||
|
let list = ref({});
|
||||||
|
let tableList = ref([]);
|
||||||
|
let day = ref(1);
|
||||||
|
onMounted(() => {
|
||||||
|
getData();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取营业数据
|
||||||
|
* @param {Object} beginDate
|
||||||
|
* @param {Object} endDate
|
||||||
|
*/
|
||||||
|
function getlist(beginDate, endDate) {
|
||||||
|
saleSummaryCount({
|
||||||
|
beginDate,
|
||||||
|
endDate,
|
||||||
|
rangeType: selected.value,
|
||||||
|
}).then((res) => {
|
||||||
|
list.value = res || {
|
||||||
|
refundAmount: 0,
|
||||||
|
refundCount: 0,
|
||||||
|
saleCount: 0,
|
||||||
|
totalAmount: 0,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取销售数据
|
||||||
|
* @param {Object} beginDate
|
||||||
|
* @param {Object} endDate
|
||||||
|
*/
|
||||||
|
function gettableData(beginDate, endDate) {
|
||||||
|
saleSummaryPage({
|
||||||
|
beginDate,
|
||||||
|
endDate,
|
||||||
|
rangeType: selected.value,
|
||||||
|
}).then((res) => {
|
||||||
|
tableList.value = (res || []).slice(0, 5);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetDatePicker() {
|
||||||
|
datePickerData.value.beginDate = "";
|
||||||
|
datePickerData.value.endDate = "";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 时间切换
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
function changeTime(e) {
|
||||||
|
selected.value = e;
|
||||||
|
resetDatePicker();
|
||||||
|
if (e == "custom") {
|
||||||
|
datePicker.value.toggle();
|
||||||
|
} else {
|
||||||
|
oldSelected = e;
|
||||||
|
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const datePickerData = ref({
|
||||||
|
beginDate: "",
|
||||||
|
endDate: "",
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 自定义确认
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
function datePickerConfirm(e) {
|
||||||
|
datePickerData.value.beginDate = e.start;
|
||||||
|
datePickerData.value.endDate = e.end;
|
||||||
|
getData(e.start, e.end);
|
||||||
|
}
|
||||||
|
function getData(start, end) {
|
||||||
|
let beginDate, endDate;
|
||||||
|
if (selected.value == "custom") {
|
||||||
|
beginDate = start.substring(0, start.indexOf(" "));
|
||||||
|
endDate = end.substring(0, end.indexOf(" "));
|
||||||
|
} else {
|
||||||
|
beginDate = timeList.find((item) => item.value == selected.value).beginDate;
|
||||||
|
endDate = timeList.find((item) => item.value == selected.value).endDate;
|
||||||
|
}
|
||||||
|
getlist(beginDate, endDate);
|
||||||
|
gettableData(beginDate, endDate);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 更多
|
||||||
|
*/
|
||||||
|
function toUrl() {
|
||||||
|
let beginDate, endDate;
|
||||||
|
if (selected.value == "custom") {
|
||||||
|
beginDate = datePickerData.value.beginDate.substring(
|
||||||
|
0,
|
||||||
|
datePickerData.value.beginDate.indexOf(" ")
|
||||||
|
);
|
||||||
|
endDate = datePickerData.value.endDate.substring(
|
||||||
|
0,
|
||||||
|
datePickerData.value.endDate.indexOf(" ")
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
beginDate = timeList.find((item) => item.value == selected.value).beginDate;
|
||||||
|
endDate = timeList.find((item) => item.value == selected.value).endDate;
|
||||||
|
}
|
||||||
|
go.to("PAGES_PRODUCT_SALES_RANKING", {
|
||||||
|
beginDate,
|
||||||
|
endDate,
|
||||||
|
rangeType: selected.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background: #f6f6f6;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.fixed-top {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
background-color: transparent;
|
||||||
|
bottom: 84rpx;
|
||||||
|
left: 28rpx;
|
||||||
|
right: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
border-radius: 12rpx 12rpx 0rpx 0rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 24rpx;
|
||||||
|
|
||||||
|
.constantbox {
|
||||||
|
.constantboxitem {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.head {
|
||||||
|
width: 220rpx;
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333333;
|
||||||
|
overflow: hidden; //超出的文本隐藏
|
||||||
|
text-overflow: ellipsis; //溢出用省略号显示
|
||||||
|
white-space: nowrap; //溢出不换行
|
||||||
|
}
|
||||||
|
|
||||||
|
.head:nth-child(4) {
|
||||||
|
width: 300rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.head:nth-child(5) {
|
||||||
|
width: 300rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.constantboxitem:nth-child(even) {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.constantboxitem:nth-child(odd) {
|
||||||
|
background: #f7f6fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.constantboxitem:nth-child(1) {
|
||||||
|
background: #aebad2;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item:nth-of-type(2n + 1) {
|
||||||
|
background-color: rgb(249, 249, 249);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.time-wrapper {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
padding-bottom: 16rpx;
|
||||||
|
padding-top: 16rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.timelistbox {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.time-item {
|
||||||
|
font-size: 28rpx;
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xian {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 3rpx;
|
||||||
|
background-color: #318afe;
|
||||||
|
// position: absolute;
|
||||||
|
// left: 16rpx;
|
||||||
|
// bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-selected {
|
||||||
|
color: #318afe;
|
||||||
|
font-size: 32rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageSalesSummaryContent {
|
||||||
|
height: 320rpx;
|
||||||
|
margin: 20rpx 28rpx;
|
||||||
|
background-image: url("./svg/bgimg.svg");
|
||||||
|
background-size: 694rpx 320rpx;
|
||||||
|
padding: 48rpx 28rpx;
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
> view {
|
||||||
|
width: 50%;
|
||||||
|
padding-right: 52rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格
|
||||||
|
.table-scroll {
|
||||||
|
// width: calc(100% - 5px);
|
||||||
|
overflow-x: scroll;
|
||||||
|
white-space: nowrap;
|
||||||
|
margin: 32rpx 28rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
border-radius: 30rpx 30rpx 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-scroll .table {
|
||||||
|
table-layout: fixed;
|
||||||
|
// width: calc(100% - 10rpx);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-scroll .thead {
|
||||||
|
display: table-row;
|
||||||
|
background-color: bisque;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-scroll .tbody {
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
display: block;
|
||||||
|
// width: 1040rpx;
|
||||||
|
width: 100%;
|
||||||
|
// width: calc(100% );
|
||||||
|
}
|
||||||
|
|
||||||
|
// .table-scroll th,
|
||||||
|
// td {
|
||||||
|
// height: 82rpx;
|
||||||
|
// overflow: hidden;
|
||||||
|
// text-overflow: ellipsis;
|
||||||
|
// width: 250rpx;
|
||||||
|
// // border: 0.7rpx solid red;
|
||||||
|
// border: 0.7rpx solid rgba(126, 155, 212, 0.27);
|
||||||
|
// }
|
||||||
|
|
||||||
|
.bottombtn {
|
||||||
|
width: 694rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
line-height: 56rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0rpx auto;
|
||||||
|
background: #f1f1f1;
|
||||||
|
font-size: 24rpx;
|
||||||
|
border-radius: 0rpx 0rpx 28rpx 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.df() {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style>
|
||||||
|
.min-page {
|
||||||
|
height: 20vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
346
pageSalesSummary/table.vue
Normal file
@@ -0,0 +1,346 @@
|
|||||||
|
<template>
|
||||||
|
<view class="time-wrapper">
|
||||||
|
<view v-for="(v, i) in timeList" :key="i" class="timelistbox">
|
||||||
|
<view
|
||||||
|
class="time-item"
|
||||||
|
@tap="changeTime(v.value)"
|
||||||
|
:class="[v.value == selected ? 'time-selected' : '']"
|
||||||
|
>
|
||||||
|
{{ v.label }}
|
||||||
|
</view>
|
||||||
|
<view class="xian" v-if="v.value == selected"> </view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="table-scroll">
|
||||||
|
<view class="color-333 u-font-28 bg-gray">
|
||||||
|
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
||||||
|
<view class="bg-fff border-r-12 u-flex no-wrap u-col-top">
|
||||||
|
<view class="constantbox">
|
||||||
|
<view class="constantboxitem">
|
||||||
|
<view class="head">区域名称</view>
|
||||||
|
<view class="head">台桌号</view>
|
||||||
|
<view class="head">订单数量</view>
|
||||||
|
<view class="head">订单金额</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="constantboxitem"
|
||||||
|
v-for="(item, index) in tableList"
|
||||||
|
:key="index"
|
||||||
|
@click="toDetail(item)"
|
||||||
|
>
|
||||||
|
<view class="head" style="padding-left: 16rpx">
|
||||||
|
<image
|
||||||
|
v-if="index == 0"
|
||||||
|
src="../pageTable/index/images/1.png"
|
||||||
|
style="width: 22rpx; height: 30rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
v-else-if="index == 1"
|
||||||
|
src="../pageTable/index/images/2.png"
|
||||||
|
style="width: 22rpx; height: 30rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
v-else-if="index == 2"
|
||||||
|
src="../pageTable/index/images/3.png"
|
||||||
|
style="width: 22rpx; height: 30rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
{{ item.areaName }}
|
||||||
|
</view>
|
||||||
|
<view class="head">{{ item.tableName || "" }}</view>
|
||||||
|
<view class="head">{{ item.orderCount || 0 }}</view>
|
||||||
|
<view class="head">{{ item.orderAmount || 0 }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style="height: 80rpx;"></view>
|
||||||
|
<!-- <view class="bottombtn" @tap="toUrl">
|
||||||
|
更多 <uni-icons type="right" size="16"></uni-icons>
|
||||||
|
</view> -->
|
||||||
|
<datePickerview
|
||||||
|
@confirm="datePickerConfirm"
|
||||||
|
ref="datePicker"
|
||||||
|
></datePickerview>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref } from "vue";
|
||||||
|
import datePickerview from "./components/my-date-pickerview.vue";
|
||||||
|
import dayjs from "dayjs"; //时间格式库
|
||||||
|
import go from "@/commons/utils/go.js";
|
||||||
|
import { getTrade, productSaleDate } from "@/http/api/summary.js";
|
||||||
|
import { timeList } from "@/data/index.js";
|
||||||
|
import { tableSummaryList } from "@/http/api/order/summary.js";
|
||||||
|
|
||||||
|
const datePicker = ref();
|
||||||
|
|
||||||
|
let selected = ref("today");
|
||||||
|
let list = ref({});
|
||||||
|
let tableList = ref([]);
|
||||||
|
let day = ref(1);
|
||||||
|
onMounted(() => {
|
||||||
|
gettableData();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取销售数据
|
||||||
|
*/
|
||||||
|
function gettableData(start, end) {
|
||||||
|
let beginDate, endDate;
|
||||||
|
if (selected.value == "custom") {
|
||||||
|
beginDate = start.substring(0, start.indexOf(" "));
|
||||||
|
endDate = end.substring(0, end.indexOf(" "));
|
||||||
|
} else {
|
||||||
|
beginDate = timeList.find((item) => item.value == selected.value).beginDate;
|
||||||
|
endDate = timeList.find((item) => item.value == selected.value).endDate;
|
||||||
|
}
|
||||||
|
tableSummaryList({
|
||||||
|
beginDate: beginDate,
|
||||||
|
endDate: endDate,
|
||||||
|
rangeType: selected.value,
|
||||||
|
}).then((res) => {
|
||||||
|
tableList.value = res || [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前时间
|
||||||
|
*/
|
||||||
|
function getdate() {
|
||||||
|
const dt = new Date();
|
||||||
|
const y = dt.getFullYear();
|
||||||
|
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
||||||
|
const d = (dt.getDate() + "").padStart(2, "0");
|
||||||
|
const hh = (dt.getHours() + "").padStart(2, "0");
|
||||||
|
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
||||||
|
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||||
|
return `${y}-${m}-${d}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间切换
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
function changeTime(e) {
|
||||||
|
selected.value = e;
|
||||||
|
if (e == "custom") {
|
||||||
|
datePicker.value.toggle();
|
||||||
|
} else {
|
||||||
|
gettableData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义确认
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
function datePickerConfirm(e) {
|
||||||
|
console.log(e);
|
||||||
|
gettableData(e.start, e.end);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更多
|
||||||
|
*/
|
||||||
|
function toUrl() {
|
||||||
|
go.to("PAGES_PRODUCT_SALES_RANKING", {
|
||||||
|
day: day.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background: #f6f6f6;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.fixed-top {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
background-color: transparent;
|
||||||
|
bottom: 84rpx;
|
||||||
|
left: 28rpx;
|
||||||
|
right: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
border-radius: 12rpx 12rpx 0rpx 0rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 24rpx;
|
||||||
|
|
||||||
|
.constantbox {
|
||||||
|
.constantboxitem {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.head {
|
||||||
|
width: 220rpx;
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333333;
|
||||||
|
overflow: hidden; //超出的文本隐藏
|
||||||
|
text-overflow: ellipsis; //溢出用省略号显示
|
||||||
|
white-space: nowrap; //溢出不换行
|
||||||
|
}
|
||||||
|
|
||||||
|
.head:nth-child(4) {
|
||||||
|
width: 300rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.head:nth-child(5) {
|
||||||
|
width: 300rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.constantboxitem:nth-child(even) {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.constantboxitem:nth-child(odd) {
|
||||||
|
background: #f7f6fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.constantboxitem:nth-child(1) {
|
||||||
|
background: #aebad2;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item:nth-of-type(2n + 1) {
|
||||||
|
background-color: rgb(249, 249, 249);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.time-wrapper {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
padding-bottom: 16rpx;
|
||||||
|
padding-top: 16rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.timelistbox {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.time-item {
|
||||||
|
font-size: 28rpx;
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.xian {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 3rpx;
|
||||||
|
background-color: #318afe;
|
||||||
|
// position: absolute;
|
||||||
|
// left: 16rpx;
|
||||||
|
// bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-selected {
|
||||||
|
color: #318afe;
|
||||||
|
font-size: 32rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageSalesSummaryContent {
|
||||||
|
height: 320rpx;
|
||||||
|
margin: 20rpx 28rpx;
|
||||||
|
background-image: url("./svg/bgimg.svg");
|
||||||
|
background-size: 694rpx 320rpx;
|
||||||
|
padding: 48rpx 28rpx;
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
> view {
|
||||||
|
padding-right: 52rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格
|
||||||
|
.table-scroll {
|
||||||
|
// width: calc(100% - 5px);
|
||||||
|
overflow-x: scroll;
|
||||||
|
white-space: nowrap;
|
||||||
|
margin: 32rpx 28rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
border-radius: 30rpx 30rpx 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-scroll .table {
|
||||||
|
table-layout: fixed;
|
||||||
|
// width: calc(100% - 10rpx);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-scroll .thead {
|
||||||
|
display: table-row;
|
||||||
|
background-color: bisque;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-scroll .tbody {
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
display: block;
|
||||||
|
// width: 1040rpx;
|
||||||
|
width: 100%;
|
||||||
|
// width: calc(100% );
|
||||||
|
}
|
||||||
|
|
||||||
|
// .table-scroll th,
|
||||||
|
// td {
|
||||||
|
// height: 82rpx;
|
||||||
|
// overflow: hidden;
|
||||||
|
// text-overflow: ellipsis;
|
||||||
|
// width: 250rpx;
|
||||||
|
// // border: 0.7rpx solid red;
|
||||||
|
// border: 0.7rpx solid rgba(126, 155, 212, 0.27);
|
||||||
|
// }
|
||||||
|
|
||||||
|
.bottombtn {
|
||||||
|
width: 694rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
line-height: 56rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0rpx auto;
|
||||||
|
background: #f1f1f1;
|
||||||
|
font-size: 24rpx;
|
||||||
|
border-radius: 0rpx 0rpx 28rpx 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.df() {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style>
|
||||||
|
.min-page {
|
||||||
|
height: 20vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
53
pages.json
@@ -390,18 +390,35 @@
|
|||||||
{
|
{
|
||||||
"root": "pageSalesSummary",
|
"root": "pageSalesSummary",
|
||||||
"pages": [{
|
"pages": [{
|
||||||
"pageId": "PAGES_SALES_SUMMARY",
|
"pageId": "PAGES_DATA_SUMMARY",
|
||||||
"path": "index",
|
"path": "index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "销售汇总"
|
"navigationBarTitleText": "数据统计"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_SALES_SUMMARY",
|
||||||
|
"path": "sales",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "销量统计"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
"pageId": "PAGES_PRODUCT_SALES_RANKING",
|
"pageId": "PAGES_PRODUCT_SALES_RANKING",
|
||||||
"path": "productSalesRanking",
|
"path": "productSalesRanking",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "商品销售排行"
|
"navigationBarTitleText": "商品销售排行"
|
||||||
}
|
}
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_TABLE_SALES_RANKING",
|
||||||
|
"path": "table",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "桌台统计"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"root": "pageLineUp",
|
"root": "pageLineUp",
|
||||||
@@ -756,6 +773,34 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "充值兑换码详情"
|
"navigationBarTitleText": "充值兑换码详情"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_SUPER_VIP",
|
||||||
|
"path": "superVip/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "超级会员"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_SUPER_VIP_ADD_PLAN",
|
||||||
|
"path": "superVip/add-plans",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加方案"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_SUPER_VIP_VIP_PLANS",
|
||||||
|
"path": "superVip/vip-plans",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "会员周期列表"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_SUPER_VIP_LV_ADD",
|
||||||
|
"path": "superVip/vip-lv-add",
|
||||||
|
"style": {
|
||||||
|
// "navigationBarTitleText": "添加会员等级"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const menuList = ref([
|
|||||||
{
|
{
|
||||||
title: '超级会员',
|
title: '超级会员',
|
||||||
icon: '',
|
icon: '',
|
||||||
pageUrl: 'PAGES_ORDER_INDEX',
|
pageUrl: 'PAGES_MARKET_SUPER_VIP',
|
||||||
intro: '用户会员管理设置'
|
intro: '用户会员管理设置'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,302 +1,294 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="index-header" @tap="go.to('PAGES_STAT')">
|
<view class="index-header" @tap="go.to('PAGES_STAT')">
|
||||||
<view class="index-selected">
|
<view class="index-selected">
|
||||||
<view class="index-time">
|
<view class="index-time">
|
||||||
<block v-for="v in timeList" :key="v.value">
|
<block v-for="v in timeList" :key="v.value">
|
||||||
<view class="time-item flex-center" :class="{ 'time-active': vdata.timeSelected == v.value }"
|
<view
|
||||||
@tap.stop="changeTimeFunc(v.value)">
|
class="time-item flex-center"
|
||||||
{{ v.title }}
|
:class="{ 'time-active': vdata.timeSelected == v.value }"
|
||||||
</view>
|
@tap.stop="changeTimeFunc(v.value)"
|
||||||
</block>
|
>
|
||||||
</view>
|
{{ v.title }}
|
||||||
<view class="index-scan flex-center" @click.stop="scanFunc">
|
</view>
|
||||||
<image src="/static/iconImg/icon-scan-index.svg" mode="scaleToFill" />
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="index-scan flex-center" @click.stop="scanFunc">
|
||||||
<view class="receipts-money">
|
<image src="/static/iconImg/icon-scan-index.svg" mode="scaleToFill" />
|
||||||
<text class="money-title">成交金额 (元)</text>
|
</view>
|
||||||
<view class="money-num">{{ list?list.sale.incomeAmountAll:0}}</view>
|
</view>
|
||||||
</view>
|
<view class="receipts-money">
|
||||||
<view class="money-list">
|
<text class="money-title">成交金额 (元)</text>
|
||||||
<view class="money-item">
|
<view class="money-num">{{ list ? list.sale.incomeAmountAll : 0 }}</view>
|
||||||
<text class="money-title">消费笔数</text>
|
</view>
|
||||||
<view class="money-num">{{ list?list.vip.useNum:0 }}</view>
|
<view class="money-list">
|
||||||
</view>
|
<view class="money-item">
|
||||||
<view class="money-item">
|
<text class="money-title">消费笔数</text>
|
||||||
<text class="money-title">退款金额 (元)</text>
|
<view class="money-num">{{ list ? list.vip.useNum : 0 }}</view>
|
||||||
<view class="money-num">{{ list?list.sale.outAmount:0}}</view>
|
</view>
|
||||||
</view>
|
<view class="money-item">
|
||||||
<view class="money-item">
|
<text class="money-title">退款金额 (元)</text>
|
||||||
<text class="money-title">消费金额</text>
|
<view class="money-num">{{ list ? list.sale.outAmount : 0 }}</view>
|
||||||
<view class="money-num">{{ list?list.vip.useAmount:0 }}</view>
|
</view>
|
||||||
</view>
|
<view class="money-item">
|
||||||
</view>
|
<text class="money-title">消费金额</text>
|
||||||
<view class="money-list" v-if="vdata.memberIsShow">
|
<view class="money-num">{{ list ? list.vip.useAmount : 0 }}</view>
|
||||||
<view class="money-item">
|
</view>
|
||||||
<text class="money-title">会员充值(元)</text>
|
</view>
|
||||||
<view class="money-num">{{ cal.cert2Dollar(memberData.payAmount) }}</view>
|
<view class="money-list" v-if="vdata.memberIsShow">
|
||||||
</view>
|
<view class="money-item">
|
||||||
<view class="money-item">
|
<text class="money-title">会员充值(元)</text>
|
||||||
<text class="money-title">会员消费(元)</text>
|
<view class="money-num">{{
|
||||||
<view class="money-num">{{ cal.cert2Dollar(Math.abs(memberData.changeAmount)) }}</view>
|
cal.cert2Dollar(memberData.payAmount)
|
||||||
</view>
|
}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="money-item">
|
||||||
|
<text class="money-title">会员消费(元)</text>
|
||||||
|
<view class="money-num">{{
|
||||||
|
cal.cert2Dollar(Math.abs(memberData.changeAmount))
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="money-item">
|
<view class="money-item">
|
||||||
<text class="money-title">会员消费笔数</text>
|
<text class="money-title">会员消费笔数</text>
|
||||||
<view class="money-num">{{ memberData.changeCount }}</view>
|
<view class="money-num">{{ memberData.changeCount }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<!-- <text class="money-title">展开全部</text> -->
|
<!-- <text class="money-title">展开全部</text> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive, onMounted } from "vue";
|
||||||
|
|
||||||
import cal from '@/commons/utils/cal.js';
|
import cal from "@/commons/utils/cal.js";
|
||||||
import go from '@/commons/utils/go.js';
|
import go from "@/commons/utils/go.js";
|
||||||
import ent from '@/commons/utils/ent.js';
|
import ent from "@/commons/utils/ent.js";
|
||||||
import unionScan from '@/commons/utils/unionScan.js';
|
import unionScan from "@/commons/utils/unionScan.js";
|
||||||
import storageManage from '@/commons/utils/storageManage.js';
|
import storageManage from "@/commons/utils/storageManage.js";
|
||||||
import dayjs from 'dayjs' //时间格式库
|
import dayjs from "dayjs"; //时间格式库
|
||||||
|
import { timeList } from '@/data/index.js'
|
||||||
|
|
||||||
import { getTrade } from '@/http/api/summary.js'
|
import { getTrade } from "@/http/api/summary.js";
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
vdata.memberIsShow = ent.has('ENT_MCH_MEMBER') && storageManage.userInfo().isHasMemberEnt;
|
vdata.memberIsShow =
|
||||||
if (ent.has('ENT_MCH_MEMBER') && storageManage.userInfo().isHasMemberEnt) {
|
ent.has("ENT_MCH_MEMBER") && storageManage.userInfo().isHasMemberEnt;
|
||||||
getMemberData();
|
if (ent.has("ENT_MCH_MEMBER") && storageManage.userInfo().isHasMemberEnt) {
|
||||||
}
|
getMemberData();
|
||||||
getList()
|
}
|
||||||
});
|
getList();
|
||||||
const emits = defineEmits(['click']);
|
});
|
||||||
const timeList = [{
|
const emits = defineEmits(["click"]);
|
||||||
title: '今天',
|
let list = ref();
|
||||||
value: 'today'
|
const vdata = reactive({
|
||||||
},
|
timeSelected: "today", // 当前时间选择器的
|
||||||
{
|
payAmount: -1, // 实收金额
|
||||||
title: '昨天',
|
payCount: -1, // 交易笔数
|
||||||
value: 'yesterday'
|
refundAmount: -1, // 退款金额
|
||||||
},
|
refundCount: -1, // 退款笔数
|
||||||
{
|
memberIsShow: false, //是否开启会员模块
|
||||||
title: '近7天',
|
});
|
||||||
value: 'circumference'
|
const memberData = reactive({});
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '近30天',
|
|
||||||
value: 'moon'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
let list = ref()
|
|
||||||
const vdata = reactive({
|
|
||||||
timeSelected: 'today', // 当前时间选择器的
|
|
||||||
payAmount: -1, // 实收金额
|
|
||||||
payCount: -1, // 交易笔数
|
|
||||||
refundAmount: -1, // 退款金额
|
|
||||||
refundCount: -1, // 退款笔数
|
|
||||||
memberIsShow: false //是否开启会员模块
|
|
||||||
});
|
|
||||||
const memberData = reactive({});
|
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
let startTime, endTime;
|
let startTime, endTime;
|
||||||
if (vdata.timeSelected == 'today') {
|
if (vdata.timeSelected == "today") {
|
||||||
startTime = dayjs().format('YYYY-MM-DD') + ' 00:00:00'
|
startTime = dayjs().format("YYYY-MM-DD") + " 00:00:00";
|
||||||
endTime = dayjs().format('YYYY-MM-DD') + ' 23:59:59'
|
endTime = dayjs().format("YYYY-MM-DD") + " 23:59:59";
|
||||||
} else if (vdata.timeSelected == 'yesterday') {
|
} else if (vdata.timeSelected == "yesterday") {
|
||||||
startTime = formatTime() + ' 00:00:00'
|
startTime = formatTime() + " 00:00:00";
|
||||||
endTime = formatTime() + ' 23:59:59'
|
endTime = formatTime() + " 23:59:59";
|
||||||
} else if (vdata.timeSelected == 'circumference') {
|
} else if (vdata.timeSelected == "circumference") {
|
||||||
startTime = dayjs().add(-7, 'day').format('YYYY-MM-DD 00:00:00')
|
startTime = dayjs().add(-7, "day").format("YYYY-MM-DD 00:00:00");
|
||||||
endTime = dayjs().format('YYYY-MM-DD 23:59:59')
|
endTime = dayjs().format("YYYY-MM-DD 23:59:59");
|
||||||
} else if (vdata.timeSelected == 'moon') {
|
} else if (vdata.timeSelected == "moon") {
|
||||||
startTime = dayjs().add(-30, 'day').format('YYYY-MM-DD 00:00:00')
|
startTime = dayjs().add(-30, "day").format("YYYY-MM-DD 00:00:00");
|
||||||
endTime = dayjs().format('YYYY-MM-DD 23:59:59')
|
endTime = dayjs().format("YYYY-MM-DD 23:59:59");
|
||||||
} else if (vdata.timeSelected == 'custom') {
|
} else if (vdata.timeSelected == "custom") {
|
||||||
startTime = start
|
startTime = start;
|
||||||
endTime = end
|
endTime = end;
|
||||||
}
|
}
|
||||||
getTrade({
|
getTrade({
|
||||||
shopId: uni.getStorageSync('shopId'),
|
shopId: uni.getStorageSync("shopId"),
|
||||||
startTime,
|
startTime,
|
||||||
endTime,
|
endTime,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
list.value = res
|
list.value = res;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
// 切换 时间卡片
|
// 切换 时间卡片
|
||||||
function changeTimeFunc(val) {
|
function changeTimeFunc(val) {
|
||||||
vdata.timeSelected = val;
|
vdata.timeSelected = val;
|
||||||
getList()
|
getList();
|
||||||
// refData();
|
// refData();
|
||||||
// if (vdata.memberIsShow) {
|
// if (vdata.memberIsShow) {
|
||||||
// getMemberData();
|
// getMemberData();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
// 根据选择请求数据
|
// 根据选择请求数据
|
||||||
function refData() {
|
function refData() {
|
||||||
// 获取 统计数据
|
// 获取 统计数据
|
||||||
// $indexStatistics(vdata.timeSelected).then(({
|
// $indexStatistics(vdata.timeSelected).then(({
|
||||||
// bizData
|
// bizData
|
||||||
// }) => {
|
// }) => {
|
||||||
// vdata.payAmount = bizData.totalSuccAmt;
|
// vdata.payAmount = bizData.totalSuccAmt;
|
||||||
// vdata.payCount = bizData.totalSuccNum;
|
// vdata.payCount = bizData.totalSuccNum;
|
||||||
// vdata.refundAmount = bizData.totalRefundAmt;
|
// vdata.refundAmount = bizData.totalRefundAmt;
|
||||||
// vdata.refundCount = bizData.totalRefundNum;
|
// vdata.refundCount = bizData.totalRefundNum;
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 扫码动作
|
// 扫码动作
|
||||||
function scanFunc() {
|
function scanFunc() {
|
||||||
unionScan.scan(true).then((res) => {
|
unionScan.scan(true).then((res) => {
|
||||||
// 登录类型
|
// 登录类型
|
||||||
if (res.type == unionScan.QR_TYPE_LOGIN) {
|
if (res.type == unionScan.QR_TYPE_LOGIN) {
|
||||||
return go.to('PAGES_SCAN_LOGIN', {
|
return go.to("PAGES_SCAN_LOGIN", {
|
||||||
qrcodeNo: res.originQrVal
|
qrcodeNo: res.originQrVal,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 二维码
|
// 二维码
|
||||||
if (res.type == unionScan.QR_TYPE_QRC) {
|
if (res.type == unionScan.QR_TYPE_QRC) {
|
||||||
return go.to('PAGES_APP_CODE_BIND', {
|
return go.to("PAGES_APP_CODE_BIND", {
|
||||||
qrcId: res.bizValue
|
qrcId: res.bizValue,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 获取当前时间
|
// 获取当前时间
|
||||||
function getdate() {
|
function getdate() {
|
||||||
const dt = new Date();
|
const dt = new Date();
|
||||||
const y = dt.getFullYear();
|
const y = dt.getFullYear();
|
||||||
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
||||||
const d = (dt.getDate() + "").padStart(2, "0");
|
const d = (dt.getDate() + "").padStart(2, "0");
|
||||||
const hh = (dt.getHours() + "").padStart(2, "0");
|
const hh = (dt.getHours() + "").padStart(2, "0");
|
||||||
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
||||||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||||
return `${y}-${m}-${d}`;
|
return `${y}-${m}-${d}`;
|
||||||
}
|
}
|
||||||
// 获取昨天时间
|
// 获取昨天时间
|
||||||
const formatTime = () => {
|
const formatTime = () => {
|
||||||
let strDate = getdate()
|
let strDate = getdate();
|
||||||
let dateFormat = new Date(strDate);
|
let dateFormat = new Date(strDate);
|
||||||
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
||||||
dateFormat = new Date(dateFormat);
|
dateFormat = new Date(dateFormat);
|
||||||
let y = dateFormat.getFullYear()
|
let y = dateFormat.getFullYear();
|
||||||
let m = (dateFormat.getMonth() + 1).toString().padStart(2, '0')
|
let m = (dateFormat.getMonth() + 1).toString().padStart(2, "0");
|
||||||
let d = dateFormat.getDate().toString().padStart(2, '0')
|
let d = dateFormat.getDate().toString().padStart(2, "0");
|
||||||
return `${y}-${m}-${d}`
|
return `${y}-${m}-${d}`;
|
||||||
}
|
};
|
||||||
const getMemberData = () => {
|
const getMemberData = () => {
|
||||||
// $memberInfoCount({
|
// $memberInfoCount({
|
||||||
// queryDateRange: vdata.timeSelected
|
// queryDateRange: vdata.timeSelected
|
||||||
// }).then(({
|
// }).then(({
|
||||||
// bizData
|
// bizData
|
||||||
// }) => {
|
// }) => {
|
||||||
// Object.assign(memberData, bizData);
|
// Object.assign(memberData, bizData);
|
||||||
// });
|
// });
|
||||||
};
|
};
|
||||||
defineExpose({
|
defineExpose({
|
||||||
refData
|
refData,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.index-header {
|
.index-header {
|
||||||
width: 680rpx;
|
width: 680rpx;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
transform: translateY(30rpx);
|
transform: translateY(30rpx);
|
||||||
margin-bottom: 25rpx;
|
margin-bottom: 25rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: $J-b-r32;
|
border-radius: $J-b-r32;
|
||||||
background: $jeepay-bg-primary;
|
background: $jeepay-bg-primary;
|
||||||
backdrop-filter: blur(20rpx);
|
backdrop-filter: blur(20rpx);
|
||||||
box-shadow: 0 50rpx 70rpx -60rpx rgba(0, 65, 164, 0.5);
|
box-shadow: 0 50rpx 70rpx -60rpx rgba(0, 65, 164, 0.5);
|
||||||
|
|
||||||
.index-selected {
|
.index-selected {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.index-time {
|
.index-time {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 490rpx;
|
width: 490rpx;
|
||||||
height: 90rpx;
|
height: 90rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 10rpx;
|
padding: 10rpx;
|
||||||
background-color: rgba($color: #fff, $alpha: 0.1);
|
background-color: rgba($color: #fff, $alpha: 0.1);
|
||||||
|
|
||||||
.time-item {
|
.time-item {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
// width: 120rpx;
|
// width: 120rpx;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: rgba(255, 255, 255, 0.75);
|
color: rgba(255, 255, 255, 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-active {
|
.time-active {
|
||||||
background-color: $J-bg-ff;
|
background-color: $J-bg-ff;
|
||||||
color: $J-color-t21;
|
color: $J-color-t21;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.index-scan {
|
.index-scan {
|
||||||
width: 110rpx;
|
width: 110rpx;
|
||||||
height: 110rpx;
|
height: 110rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
background-color: rgba($color: #fff, $alpha: 0.1);
|
background-color: rgba($color: #fff, $alpha: 0.1);
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 41rpx;
|
width: 41rpx;
|
||||||
height: 35rpx;
|
height: 35rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.receipts-money {
|
.receipts-money {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 30rpx 0;
|
margin: 30rpx 0;
|
||||||
color: $J-color-tff;
|
color: $J-color-tff;
|
||||||
|
|
||||||
.money-num {
|
.money-num {
|
||||||
font-size: 70rpx;
|
font-size: 70rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.money-list {
|
.money-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0 72rpx;
|
padding: 0 72rpx;
|
||||||
margin-bottom: 50rpx;
|
margin-bottom: 50rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: $J-color-tff;
|
color: $J-color-tff;
|
||||||
|
|
||||||
.money-item {
|
.money-item {
|
||||||
.money-num {
|
.money-num {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.money-title {
|
.money-title {
|
||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: $J-color-tSff;
|
color: $J-color-tSff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-money {
|
.quick-money {
|
||||||
height: 110rpx;
|
height: 110rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
color: $J-color-t29;
|
color: $J-color-t29;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,30 +1,40 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="mask" v-if="show" @tap="close">
|
<view class="mask" v-if="show" @tap="close">
|
||||||
<view class="box" @tap.stop="nullFunction">
|
<view class="box" @tap.stop="nullFunction">
|
||||||
<view class="u-flex u-relative u-row-center u-p-30 top">
|
<view class="u-flex u-relative u-row-center u-p-30 top">
|
||||||
<view class="font-bold u-font-32">筛选日期时间</view>
|
<view class="font-bold u-font-32">筛选日期时间</view>
|
||||||
<view class="close" @tap="close">
|
<view class="close" @tap="close">
|
||||||
<uni-icons type="closeempty" size="24"></uni-icons>
|
<uni-icons type="closeempty" size="24"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
<!-- <view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime">
|
||||||
<!-- <view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime">
|
|
||||||
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item.key)">
|
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item.key)">
|
||||||
{{item.title}}
|
{{item.title}}
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<picker-view :immediate-change="true" @pickend="pickend" :value="value" @change="bindChange"
|
<picker-view
|
||||||
class="picker-view">
|
:immediate-change="true"
|
||||||
<picker-view-column>
|
@pickend="pickend"
|
||||||
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
:value="value"
|
||||||
</picker-view-column>
|
@change="bindChange"
|
||||||
<picker-view-column>
|
class="picker-view"
|
||||||
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
>
|
||||||
</picker-view-column>
|
<picker-view-column>
|
||||||
<picker-view-column>
|
<view class="item" v-for="(item, index) in years" :key="index"
|
||||||
<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
|
>{{ item }}年</view
|
||||||
</picker-view-column>
|
>
|
||||||
<!-- <picker-view-column>
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in months" :key="index"
|
||||||
|
>{{ item }}月</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in days" :key="index"
|
||||||
|
>{{ item }}日</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<!-- <picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
@@ -33,20 +43,31 @@
|
|||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||||
</picker-view-column> -->
|
</picker-view-column> -->
|
||||||
</picker-view>
|
</picker-view>
|
||||||
<view class="u-text-center color-999">至</view>
|
<view class="u-text-center color-999">至</view>
|
||||||
<picker-view :immediate-change="true" :value="value1" @pickend="pickend1" @change="bindChange1"
|
<picker-view
|
||||||
class="picker-view">
|
:immediate-change="true"
|
||||||
<picker-view-column>
|
:value="value1"
|
||||||
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
@pickend="pickend1"
|
||||||
</picker-view-column>
|
@change="bindChange1"
|
||||||
<picker-view-column>
|
class="picker-view"
|
||||||
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
>
|
||||||
</picker-view-column>
|
<picker-view-column>
|
||||||
<picker-view-column>
|
<view class="item" v-for="(item, index) in years" :key="index"
|
||||||
<view class="item" v-for="(item,index) in days1" :key="index">{{item}}日</view>
|
>{{ item }}年</view
|
||||||
</picker-view-column>
|
>
|
||||||
<!-- <picker-view-column>
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in months" :key="index"
|
||||||
|
>{{ item }}月</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="item" v-for="(item, index) in days1" :key="index"
|
||||||
|
>{{ item }}日</view
|
||||||
|
>
|
||||||
|
</picker-view-column>
|
||||||
|
<!-- <picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||||
</picker-view-column>
|
</picker-view-column>
|
||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
@@ -55,394 +76,403 @@
|
|||||||
<picker-view-column>
|
<picker-view-column>
|
||||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||||
</picker-view-column> -->
|
</picker-view-column> -->
|
||||||
</picker-view>
|
</picker-view>
|
||||||
|
|
||||||
<!-- 站位 -->
|
|
||||||
<view style="height: 80px;"></view>
|
|
||||||
<view class="fixed_b">
|
|
||||||
<my-button shape="circle" @tap="confirm">确定</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
<!-- 站位 -->
|
||||||
|
<view style="height: 80px"></view>
|
||||||
|
<view class="fixed_b">
|
||||||
|
<my-button shape="circle" @tap="confirm">确定</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import myButton from "@/components/my-components/my-button.vue"
|
import myButton from "@/components/my-components/my-button.vue";
|
||||||
import {
|
import { reactive, ref } from "vue";
|
||||||
reactive,
|
const $nowDate = new Date();
|
||||||
ref
|
const nowDate = {
|
||||||
} from 'vue';
|
year: $nowDate.getFullYear(),
|
||||||
const $nowDate = new Date()
|
month: $nowDate.getMonth() + 1,
|
||||||
const nowDate = {
|
day: $nowDate.getDate(),
|
||||||
year: $nowDate.getFullYear(),
|
hours: $nowDate.getHours(),
|
||||||
month: $nowDate.getMonth() + 1,
|
minutes: $nowDate.getMinutes(),
|
||||||
day: $nowDate.getDate(),
|
seconds: $nowDate.getSeconds(),
|
||||||
hours: $nowDate.getHours(),
|
};
|
||||||
minutes: $nowDate.getMinutes(),
|
const yearsLen = 30;
|
||||||
seconds: $nowDate.getSeconds()
|
const years = new Array(yearsLen)
|
||||||
}
|
.fill(1)
|
||||||
const yearsLen = 30
|
.map((v, index) => {
|
||||||
const years = new Array(yearsLen).fill(1).map((v, index) => {
|
return nowDate.year - index;
|
||||||
return nowDate.year - index
|
})
|
||||||
}).reverse()
|
.reverse();
|
||||||
const months = new Array(12).fill(1).map((v, index) => {
|
const months = new Array(12).fill(1).map((v, index) => {
|
||||||
return index + 1
|
return index + 1;
|
||||||
})
|
});
|
||||||
const days = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
const days = ref(
|
||||||
return index + 1
|
new Array(getMonthArea($nowDate, "end").getDate()).fill(1).map((v, index) => {
|
||||||
}))
|
return index + 1;
|
||||||
const days1 = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
})
|
||||||
return index + 1
|
);
|
||||||
}))
|
const days1 = ref(
|
||||||
const hours = new Array(24).fill(1).map((v, index) => {
|
new Array(getMonthArea($nowDate, "end").getDate()).fill(1).map((v, index) => {
|
||||||
return index
|
return index + 1;
|
||||||
})
|
})
|
||||||
const minutes = new Array(60).fill(1).map((v, index) => {
|
);
|
||||||
return index
|
const hours = new Array(24).fill(1).map((v, index) => {
|
||||||
})
|
return index;
|
||||||
const seconds = new Array(60).fill(1).map((v, index) => {
|
});
|
||||||
return index
|
const minutes = new Array(60).fill(1).map((v, index) => {
|
||||||
})
|
return index;
|
||||||
const fastTime = reactive([{
|
});
|
||||||
title: '今日',
|
const seconds = new Array(60).fill(1).map((v, index) => {
|
||||||
key: 'now'
|
return index;
|
||||||
},
|
});
|
||||||
{
|
const fastTime = reactive([
|
||||||
title: '昨日',
|
{
|
||||||
key: 'prve'
|
title: "今日",
|
||||||
},
|
key: "now",
|
||||||
{
|
},
|
||||||
title: '本月',
|
{
|
||||||
key: 'nowMonth'
|
title: "昨日",
|
||||||
},
|
key: "prve",
|
||||||
{
|
},
|
||||||
title: '上月',
|
{
|
||||||
key: 'prveMonth'
|
title: "本月",
|
||||||
}
|
key: "nowMonth",
|
||||||
])
|
},
|
||||||
|
{
|
||||||
|
title: "上月",
|
||||||
|
key: "prveMonth",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
function setPrveDay() {}
|
||||||
|
|
||||||
|
function setNowMoneth() {}
|
||||||
|
|
||||||
function setPrveDay() {
|
function setprveMoneth() {}
|
||||||
|
|
||||||
}
|
function setDay(start, end) {
|
||||||
|
value.value = [start.year, start.month, start.day, 0, 0, 0];
|
||||||
|
value1.value = [end.year, end.month, end.day, 23, 59, 59];
|
||||||
|
}
|
||||||
|
|
||||||
function setNowMoneth() {
|
function changeTime(key) {
|
||||||
|
const yearIndex = years.findIndex((v) => v == nowDate.year);
|
||||||
|
const prveyearIndex = years.findIndex((v) => v == nowDate.year) - 1;
|
||||||
|
const nowMonthIndex = nowDate.month - 1;
|
||||||
|
const nowDayIndex = nowDate.day - 1;
|
||||||
|
const dataMap = {
|
||||||
|
now: function () {
|
||||||
|
return {
|
||||||
|
start: {
|
||||||
|
year: yearIndex,
|
||||||
|
month: nowMonthIndex,
|
||||||
|
day: nowDayIndex,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
year: yearIndex,
|
||||||
|
month: nowMonthIndex,
|
||||||
|
day: nowDayIndex,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
prve: function () {
|
||||||
|
const oneDay = 1000 * 60 * 60 * 24;
|
||||||
|
const date = new Date(
|
||||||
|
new Date(nowDate.year, nowDate.month, nowDate.day, 0, 0, 0).getTime() -
|
||||||
|
oneDay
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
start: {
|
||||||
|
year: years.findIndex((v) => v == date.getFullYear()),
|
||||||
|
month: date.getMonth() - 1 < 0 ? 11 : date.getMonth() - 1,
|
||||||
|
day: date.getDate() - 1,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
year: years.findIndex((v) => v == date.getFullYear()),
|
||||||
|
month: date.getMonth() - 1 < 0 ? 11 : date.getMonth() - 1,
|
||||||
|
day: date.getDate() - 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
nowMonth: function () {
|
||||||
|
return {
|
||||||
|
start: {
|
||||||
|
year: yearIndex,
|
||||||
|
month: nowMonthIndex,
|
||||||
|
day: 0,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
year: yearIndex,
|
||||||
|
month: nowMonthIndex,
|
||||||
|
day: new Date(nowDate.year, nowDate.month, 0).getDate() - 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
prveMonth: function () {
|
||||||
|
const oneDay = 1000 * 60 * 60 * 24;
|
||||||
|
const date = new Date(
|
||||||
|
new Date(nowDate.year, nowDate.month - 1, 0, 0, 0).getTime() - oneDay
|
||||||
|
);
|
||||||
|
console.log(date.getMonth());
|
||||||
|
return {
|
||||||
|
start: {
|
||||||
|
year: years.findIndex((v) => v == date.getFullYear()),
|
||||||
|
month: date.getMonth(),
|
||||||
|
day: 0,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
year: years.findIndex((v) => v == date.getFullYear()),
|
||||||
|
month: date.getMonth(),
|
||||||
|
day: date.getDate(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const data = dataMap[key]();
|
||||||
|
setDay(data.start, data.end);
|
||||||
|
changeDays(false, value.value);
|
||||||
|
changeDays(true, value1.value);
|
||||||
|
|
||||||
}
|
console.log(value1.value);
|
||||||
|
const start = returnDateString(value.value);
|
||||||
|
const end = returnDateString(value1.value);
|
||||||
|
|
||||||
function setprveMoneth() {
|
emits("confirm", {
|
||||||
|
text: `${start}——${end}`,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
let value = ref([
|
||||||
|
years.length - 1,
|
||||||
|
nowDate.month - 1,
|
||||||
|
nowDate.day - 1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
]);
|
||||||
|
let value1 = ref([
|
||||||
|
years.length - 1,
|
||||||
|
nowDate.month - 1,
|
||||||
|
nowDate.day - 1,
|
||||||
|
23,
|
||||||
|
59,
|
||||||
|
59,
|
||||||
|
]);
|
||||||
|
|
||||||
}
|
let show = ref(false);
|
||||||
|
const emits = defineEmits("close", "open", "confirm");
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
show.value = !show.value;
|
||||||
|
if (show.value) {
|
||||||
|
emits("open", true);
|
||||||
|
} else {
|
||||||
|
emits("close", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setDay(start, end) {
|
function close() {
|
||||||
value.value = [
|
show.value = false;
|
||||||
start.year,
|
emits("close", false);
|
||||||
start.month,
|
}
|
||||||
start.day,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
]
|
|
||||||
value1.value = [
|
|
||||||
end.year,
|
|
||||||
end.month,
|
|
||||||
end.day,
|
|
||||||
23,
|
|
||||||
59,
|
|
||||||
59,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeTime(key) {
|
function open() {
|
||||||
const yearIndex = years.findIndex(v => v == nowDate.year)
|
show.value = true;
|
||||||
const prveyearIndex = years.findIndex(v => v == nowDate.year) - 1
|
emits("open", true);
|
||||||
const nowMonthIndex = nowDate.month - 1
|
}
|
||||||
const nowDayIndex = nowDate.day - 1
|
|
||||||
const dataMap = {
|
|
||||||
now: function() {
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year: yearIndex,
|
|
||||||
month: nowMonthIndex,
|
|
||||||
day: nowDayIndex
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year: yearIndex,
|
|
||||||
month: nowMonthIndex,
|
|
||||||
day: nowDayIndex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
prve: function() {
|
|
||||||
const oneDay=1000*60*60*24
|
|
||||||
const date=new Date(new Date(nowDate.year,nowDate.month,nowDate.day,0,0,0).getTime()-oneDay)
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year:years.findIndex(v=>v==date.getFullYear()),
|
|
||||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
|
||||||
day: date.getDate()-1
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year:years.findIndex(v=>v==date.getFullYear()),
|
|
||||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
|
||||||
day: date.getDate()-1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nowMonth: function() {
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year:yearIndex,
|
|
||||||
month:nowMonthIndex,
|
|
||||||
day: 0
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year:yearIndex,
|
|
||||||
month:nowMonthIndex,
|
|
||||||
day:new Date(nowDate.year, nowDate.month , 0).getDate() - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
prveMonth: function() {
|
|
||||||
const oneDay=1000*60*60*24
|
|
||||||
const date=new Date(new Date(nowDate.year, nowDate.month-1,0,0,0).getTime()-oneDay)
|
|
||||||
console.log(date.getMonth());
|
|
||||||
return {
|
|
||||||
start: {
|
|
||||||
year:years.findIndex(v=>v==date.getFullYear()),
|
|
||||||
month:date.getMonth(),
|
|
||||||
day: 0
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
year:years.findIndex(v=>v==date.getFullYear()),
|
|
||||||
month:date.getMonth(),
|
|
||||||
day: date.getDate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const data = dataMap[key]()
|
|
||||||
setDay(data.start, data.end)
|
|
||||||
changeDays(false,value.value)
|
|
||||||
changeDays(true,value1.value)
|
|
||||||
|
|
||||||
console.log(value1.value);
|
|
||||||
const start = returnDateString(value.value)
|
|
||||||
const end = returnDateString(value1.value)
|
|
||||||
|
|
||||||
emits('confirm', {
|
|
||||||
text: `${start}——${end}`,
|
|
||||||
start,
|
|
||||||
end
|
|
||||||
})
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
let value = ref([
|
|
||||||
years.length - 1,
|
|
||||||
nowDate.month - 1,
|
|
||||||
nowDate.day - 1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
])
|
|
||||||
let value1 = ref([
|
|
||||||
years.length - 1,
|
|
||||||
nowDate.month - 1,
|
|
||||||
nowDate.day - 1,
|
|
||||||
23,
|
|
||||||
59,
|
|
||||||
59,
|
|
||||||
])
|
|
||||||
|
|
||||||
let show = ref(false)
|
function returnDateString(arr) {
|
||||||
const emits = defineEmits('close', 'open', 'confirm')
|
const year = years[arr[0]];
|
||||||
|
const month = ("0" + (arr[1] + 1)).slice(-2);
|
||||||
|
const day = ("0" + (arr[2] + 1)).slice(-2);
|
||||||
|
const hour = ("0" + arr[3]).slice(-2);
|
||||||
|
const min = ("0" + arr[4]).slice(-2);
|
||||||
|
const sen = ("0" + arr[5]).slice(-2);
|
||||||
|
|
||||||
function toggle() {
|
return `${year}-${month}-${day} ${hour}:${min}:${sen}`;
|
||||||
show.value = !show.value
|
}
|
||||||
if (show.value) {
|
|
||||||
emits('open', true)
|
|
||||||
} else {
|
|
||||||
emits('close', false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function close() {
|
function confirm(e) {
|
||||||
show.value = false
|
const start = returnDateString(value.value);
|
||||||
emits('close', false)
|
const end = returnDateString(value1.value);
|
||||||
}
|
console.log(start);
|
||||||
|
console.log(end);
|
||||||
|
//如果结尾时间小于开始时间
|
||||||
|
if (new Date(start).getTime() > new Date(end).getTime()) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: "结束时间不能小于开始时间",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log(start);
|
||||||
|
console.log(end);
|
||||||
|
emits("confirm", {
|
||||||
|
text: `${start}——${end}`,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
function open() {
|
function returnMonthStart(arr) {
|
||||||
show.value = true
|
return new Date(years[arr[0]], months[arr[1]] - 1, 1).getDate();
|
||||||
emits('open', true)
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function returnDateString(arr) {
|
function returnMonthEnd(arr) {
|
||||||
const year = years[arr[0]]
|
return new Date(years[arr[0]], months[arr[1]], 0).getDate();
|
||||||
const month = arr[1] + 1
|
}
|
||||||
const day = arr[2] + 1
|
|
||||||
const hour = ('0' + arr[3]).slice(-2)
|
|
||||||
const min = ('0' + arr[4]).slice(-2)
|
|
||||||
const sen = ('0' + arr[5]).slice(-2)
|
|
||||||
return `${year}-${month}-${day} ${hour}:${min}:${sen}`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function changeDays(isDays1, arr) {
|
||||||
|
const end = returnMonthEnd(arr);
|
||||||
|
if (end) {
|
||||||
|
if (isDays1) {
|
||||||
|
days1.value = new Array(end).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
days.value = new Array(end).fill(1).map((v, index) => {
|
||||||
|
return index + 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function confirm(e) {
|
function bindChange(e) {
|
||||||
const start = returnDateString(value.value)
|
value.value = e.detail.value;
|
||||||
const end = returnDateString(value1.value)
|
changeDays(false, e.detail.value);
|
||||||
console.log(start);
|
}
|
||||||
console.log(end);
|
|
||||||
emits('confirm', {
|
|
||||||
text: `${start}——${end}`,
|
|
||||||
start,
|
|
||||||
end
|
|
||||||
})
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
|
|
||||||
function returnMonthStart(arr) {
|
function bindChange1(e) {
|
||||||
return new Date(years[arr[0]], months[arr[1]] - 1, 1).getDate();
|
value1.value = e.detail.value;
|
||||||
}
|
changeDays(true, e.detail.value);
|
||||||
|
}
|
||||||
|
|
||||||
function returnMonthEnd(arr) {
|
function getDayDate(date = new Date(), type) {
|
||||||
return new Date(years[arr[0]], months[arr[1]], 0).getDate();
|
const now = date;
|
||||||
}
|
if (type === "start") {
|
||||||
|
const startOfDay = new Date(
|
||||||
function changeDays(isDays1,arr){
|
now.getFullYear(),
|
||||||
const end = returnMonthEnd(arr)
|
now.getMonth(),
|
||||||
if (end) {
|
now.getDate()
|
||||||
if(isDays1){
|
);
|
||||||
days1.value= new Array(end).fill(1).map((v,
|
return startOfDay;
|
||||||
index) => {
|
}
|
||||||
return index + 1
|
if (type === "end") {
|
||||||
})
|
const endOfDay = new Date(
|
||||||
}else{
|
now.getFullYear(),
|
||||||
days.value= new Array(end).fill(1).map((v,
|
now.getMonth(),
|
||||||
index) => {
|
now.getDate(),
|
||||||
return index + 1
|
23,
|
||||||
})
|
59,
|
||||||
}
|
59,
|
||||||
|
999
|
||||||
}
|
);
|
||||||
}
|
return endOfDay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function bindChange(e) {
|
function getMonthArea(date = new Date(), type) {
|
||||||
value.value = e.detail.value
|
let now = date;
|
||||||
changeDays(false, e.detail.value)
|
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||||
}
|
let currentMonthEnd = new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth() + 1,
|
||||||
|
0,
|
||||||
|
23,
|
||||||
|
59,
|
||||||
|
59,
|
||||||
|
999
|
||||||
|
);
|
||||||
|
if (type === "start") {
|
||||||
|
return currentMonthStart;
|
||||||
|
}
|
||||||
|
if (type === "end") {
|
||||||
|
return currentMonthEnd;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
start: currentMonthStart,
|
||||||
|
end: currentMonthEnd,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function bindChange1(e) {
|
function nullFunction() {}
|
||||||
value1.value = e.detail.value
|
|
||||||
changeDays(true, e.detail.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDayDate(date = new Date(), type) {
|
function pickend(e) {
|
||||||
const now = date
|
console.log(e);
|
||||||
if (type === 'start') {
|
}
|
||||||
const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
||||||
return startOfDay
|
|
||||||
}
|
|
||||||
if (type === 'end') {
|
|
||||||
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
|
||||||
return endOfDay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMonthArea(date = new Date(), type) {
|
function pickend1(e) {
|
||||||
let now = date
|
console.log(e);
|
||||||
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
}
|
||||||
let currentMonthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
defineExpose({
|
||||||
if (type === 'start') {
|
close,
|
||||||
return currentMonthStart
|
open,
|
||||||
}
|
confirm,
|
||||||
if (type === 'end') {
|
toggle,
|
||||||
return currentMonthEnd;
|
});
|
||||||
}
|
|
||||||
return {
|
|
||||||
start: currentMonthStart,
|
|
||||||
end: currentMonthEnd
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function nullFunction() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function pickend(e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pickend1(e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
defineExpose({
|
|
||||||
close,
|
|
||||||
open,
|
|
||||||
confirm,
|
|
||||||
toggle
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.fastTime {
|
.fastTime {
|
||||||
.item {
|
.item {
|
||||||
background-color: rgb(247, 247, 247);
|
background-color: rgb(247, 247, 247);
|
||||||
padding: 6rpx 40rpx;
|
padding: 6rpx 40rpx;
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
border-bottom: 1px solid #eee;
|
border-bottom: 1px solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close {
|
.close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
right: 30rpx;
|
right: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mask {
|
.mask {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
background-color: rgba(0, 0, 0, .7);
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
.box {
|
.box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
border-radius: 16rpx 16rpx 0 0;
|
border-radius: 16rpx 16rpx 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed_b {
|
.fixed_b {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.picker-view {
|
.picker-view {
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
height: 300rpx;
|
height: 300rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
line-height: 34px;
|
line-height: 34px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,59 +1,82 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="statistics">
|
<view class="statistics">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
<text>数据统计</text>
|
<text>数据统计</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="statisticsBox">
|
<view class="statisticsBox">
|
||||||
<view class="time-wrapper u-m-l-10 u-m-r-10">
|
<view class="time-wrapper u-m-l-10 u-m-r-10">
|
||||||
<view v-for="(v, i) in timeList" :key="i" class="timelistbox">
|
<view v-for="(v, i) in timeList" :key="i" class="timelistbox">
|
||||||
<view class="time-item" @tap="changeTime(v.value,i)" :class="{ 'time-selected':v.value==selected }">
|
<view
|
||||||
{{v.label}}
|
class="time-item"
|
||||||
</view>
|
@tap="changeTime(v.value, i)"
|
||||||
<!-- <view class="xian" v-if="v.value==selected "> </view> -->
|
:class="[v.value == selected ? 'time-selected' : '']"
|
||||||
</view>
|
>
|
||||||
</view>
|
{{ v.label }}
|
||||||
<view class="time_bootom_line">
|
</view>
|
||||||
<view class="block" :style="{
|
<!-- <view class="xian" v-if="v.value==selected "> </view> -->
|
||||||
transform:'translateX('+comBlockX+'rpx) rotate(45deg) '
|
</view>
|
||||||
}"></view>
|
</view>
|
||||||
</view>
|
<view class="time_bootom_line">
|
||||||
<view class="bottom"></view>
|
<view
|
||||||
<div class="u-flex u-row-between u-font-28 color-333 ">
|
class="block"
|
||||||
<div class=" u-flex-1 ">
|
:style="{
|
||||||
|
transform: 'translateX(' + comBlockX + 'rpx) rotate(45deg) ',
|
||||||
|
}"
|
||||||
|
></view>
|
||||||
|
</view>
|
||||||
|
<view class="bottom"></view>
|
||||||
|
<div class="u-flex u-row-between u-font-28 color-333">
|
||||||
|
<div class="u-flex-1">
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="">营业额</view>
|
||||||
|
<view class="u-m-t-16">
|
||||||
|
<up-text
|
||||||
|
bold
|
||||||
|
color="#318AFE"
|
||||||
|
size="20"
|
||||||
|
mode="price"
|
||||||
|
:text="yingyeE"
|
||||||
|
></up-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-20">
|
||||||
|
<view class="">退款</view>
|
||||||
|
<view class="u-m-t-14">
|
||||||
|
<up-text
|
||||||
|
color="#333"
|
||||||
|
size="14"
|
||||||
|
bold
|
||||||
|
mode="price"
|
||||||
|
:text="refundAmount"
|
||||||
|
></up-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</div>
|
||||||
|
<view class="line"></view>
|
||||||
|
<view class="payList u-flex-1 u-p-l-40">
|
||||||
|
<view
|
||||||
|
class="li w-full u-flex u-row-between u-font-24 color-333"
|
||||||
|
v-for="(item, index) in list"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<view class="u-flex">
|
||||||
|
<view
|
||||||
|
:style="returnColorStyle(item, index)"
|
||||||
|
class="circle"
|
||||||
|
></view>
|
||||||
|
<view class="u-m-l-8">
|
||||||
|
{{ item.payType }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="u-m-t-32">
|
<view style="text-align: center" class="u-m-t-6">
|
||||||
<view class="">营业额</view>
|
{{ item.payAmount }}
|
||||||
<view class="u-m-t-16">
|
</view>
|
||||||
<up-text bold color="#318AFE" size="20" mode="price" :text="yingyeE"></up-text>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</div>
|
||||||
<view class="u-m-t-20">
|
|
||||||
<view class="">退款</view>
|
|
||||||
<view class="u-m-t-14">
|
|
||||||
<up-text color="#333" size="14" bold mode="price" :text="refundCount"></up-text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</div>
|
|
||||||
<view class="line"></view>
|
|
||||||
<view class="payList u-flex-1 u-p-l-40">
|
|
||||||
<view class="li w-full u-flex u-row-between u-font-24 color-333" v-for="(item,index) in list"
|
|
||||||
:key="index">
|
|
||||||
<view class="u-flex">
|
|
||||||
<view :style="returnColorStyle(item,index)" class="circle"></view>
|
|
||||||
<view class="u-m-l-8">
|
|
||||||
{{item.payType}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view style="text-align: center;" class="u-m-t-6">
|
<!-- <view class="u-m-t-8 u-flex u-row-center u-font-24 u-col-center color-666">
|
||||||
{{item.payAmount}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <view class="u-m-t-8 u-flex u-row-center u-font-24 u-col-center color-666">
|
|
||||||
<view class="u-flex" @click="toggleShowAll">
|
<view class="u-flex" @click="toggleShowAll">
|
||||||
<view>{{!showAll?'展开全部':'收起全部' }}</view>
|
<view>{{!showAll?'展开全部':'收起全部' }}</view>
|
||||||
<view class="u-flex u-col-center u-m-t-4 tranistion-2" :class="{rotate:showAll}">
|
<view class="u-flex u-col-center u-m-t-4 tranistion-2" :class="{rotate:showAll}">
|
||||||
@@ -61,355 +84,316 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<datePickerview @confirm="datePickerConfirm" ref="datePicker" style="z-index: 999;"></datePickerview>
|
<datePickerview
|
||||||
|
@confirm="datePickerConfirm"
|
||||||
|
ref="datePicker"
|
||||||
|
style="z-index: 999"
|
||||||
|
></datePickerview>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { ref, reactive, computed } from "vue";
|
||||||
ref,
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
reactive,
|
import { timeList } from "@/data/index.js";
|
||||||
computed
|
import dayjs from "dayjs"; //时间格式库
|
||||||
} from 'vue';
|
import datePickerview from "./my-date-pickerview.vue";
|
||||||
import {
|
|
||||||
onShow
|
|
||||||
} from '@dcloudio/uni-app';
|
|
||||||
|
|
||||||
import dayjs from 'dayjs' //时间格式库
|
import { getTrade } from "@/http/api/summary.js";
|
||||||
import datePickerview from './my-date-pickerview.vue'
|
|
||||||
|
|
||||||
import {
|
let selected = ref("today");
|
||||||
getTrade
|
let showAll = ref(false);
|
||||||
} from '@/http/api/summary.js'
|
let list = ref();
|
||||||
|
const pageData = reactive({
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
payType: "微信小程序",
|
||||||
|
key: "wechatPayAmount",
|
||||||
|
payAmount: 0,
|
||||||
|
bgcolor: "#5AA25F",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
payType: "支付宝小程序",
|
||||||
|
key: "aliPayAmount",
|
||||||
|
payAmount: 0,
|
||||||
|
bgcolor: "#31ACFE",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
payType: "主扫收款",
|
||||||
|
key: "backScanPayAmount",
|
||||||
|
payAmount: 0,
|
||||||
|
bgcolor: "#FF5C6D",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
payType: "现金",
|
||||||
|
key: "cashPayAmount",
|
||||||
|
payAmount: 0,
|
||||||
|
bgcolor: "#FC843F",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
payType: "充值",
|
||||||
|
key: "rechargeAmount",
|
||||||
|
payAmount: 0,
|
||||||
|
bgcolor: "#9090FF",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
payType: "挂账",
|
||||||
|
key: "creditPayAmount",
|
||||||
|
payAmount: 0,
|
||||||
|
bgcolor: "#7BA7A4",
|
||||||
|
},
|
||||||
|
// {payType: '收款码收款', key:'', payAmount: 0,bgcolor:'#5AA25F'},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
let selected = ref('today')
|
function returnColorStyle(item) {
|
||||||
let showAll = ref(false);
|
return {
|
||||||
let list = ref()
|
backgroundColor: item.bgcolor,
|
||||||
const pageData = reactive({
|
};
|
||||||
list: [{
|
}
|
||||||
payType: '微信小程序',
|
|
||||||
key: 'wechatPayAmount',
|
|
||||||
payAmount: 0,
|
|
||||||
bgcolor: '#5AA25F'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
payType: '支付宝小程序',
|
|
||||||
key: 'aliPayAmount',
|
|
||||||
payAmount: 0,
|
|
||||||
bgcolor: '#31ACFE'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
payType: '主扫收款',
|
|
||||||
key: 'scanPayAmount',
|
|
||||||
payAmount: 0,
|
|
||||||
bgcolor: '#FF5C6D'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
payType: '现金',
|
|
||||||
key: 'cashPayAmount',
|
|
||||||
payAmount: 0,
|
|
||||||
bgcolor: '#FC843F'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
payType: '充值',
|
|
||||||
key: 'rechargeAmount',
|
|
||||||
payAmount: 0,
|
|
||||||
bgcolor: '#9090FF'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
payType: '挂账',
|
|
||||||
key: 'creditPayAmount',
|
|
||||||
payAmount: 0,
|
|
||||||
bgcolor: '#7BA7A4'
|
|
||||||
},
|
|
||||||
// {payType: '收款码收款', key:'', payAmount: 0,bgcolor:'#5AA25F'},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
function returnColorStyle(item) {
|
function toggleShowAll() {
|
||||||
return {
|
showAll.value = !showAll.value;
|
||||||
backgroundColor: item.bgcolor
|
setList();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function toggleShowAll() {
|
function setList() {
|
||||||
showAll.value = !showAll.value
|
// list.value = showAll.value ? pageData.list : pageData.list.slice(0, 4)
|
||||||
setList()
|
list.value = pageData.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setList() {
|
const emit = defineEmits(["totalRevenue"]);
|
||||||
// list.value = showAll.value ? pageData.list : pageData.list.slice(0, 4)
|
|
||||||
list.value = pageData.list
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const timeSleIndex = ref(0);
|
||||||
|
|
||||||
const emit = defineEmits(['totalRevenue'])
|
const datePicker = ref();
|
||||||
const timeList = [{
|
onShow((options) => {
|
||||||
label: '今天',
|
let iToken = uni.getStorageSync("iToken").tokenValue;
|
||||||
value: 'today'
|
if (iToken) {
|
||||||
},
|
getlist();
|
||||||
{
|
} else {
|
||||||
label: '昨天',
|
uni.redirectTo({
|
||||||
value: 'yesterday'
|
url: "/pages/login/index",
|
||||||
},
|
});
|
||||||
{
|
}
|
||||||
label: '本周',
|
});
|
||||||
value: 'circumference'
|
|
||||||
}, {
|
|
||||||
label: '本月',
|
|
||||||
value: 'moon'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '自定义',
|
|
||||||
value: 'custom'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
const datePicker = ref()
|
|
||||||
onShow((options) => {
|
|
||||||
let iToken = uni.getStorageSync('iToken').tokenValue
|
|
||||||
if (iToken) {
|
|
||||||
getlist()
|
|
||||||
} else {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pages/login/index'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const yingyeE = ref(0)
|
const yingyeE = ref(0);
|
||||||
const refundCount = ref(0)
|
const refundAmount = ref(0);
|
||||||
/**
|
/**
|
||||||
* 获取统计数据
|
* 获取统计数据
|
||||||
* @param {Object} start
|
* @param {Object} start
|
||||||
* @param {Object} end
|
* @param {Object} end
|
||||||
*/
|
*/
|
||||||
function getlist(start, end) {
|
function getlist(start, end) {
|
||||||
let startTime, endTime;
|
let beginDate, endDate;
|
||||||
if (selected.value == 'today') {
|
const rangeType = timeList[timeSleIndex.value].value;
|
||||||
startTime = dayjs().format('YYYY-MM-DD') + ' 00:00:00'
|
if(rangeType == "custom"){
|
||||||
endTime = dayjs().format('YYYY-MM-DD') + ' 23:59:59'
|
beginDate = start.split(" ")[0];
|
||||||
} else if (selected.value == 'yesterday') {
|
endDate = end.split(" ")[0];
|
||||||
startTime = formatTime() + ' 00:00:00'
|
}else{
|
||||||
endTime = formatTime() + ' 23:59:59'
|
beginDate = timeList[timeSleIndex.value].beginDate;
|
||||||
} else if (selected.value == 'circumference') {
|
endDate = timeList[timeSleIndex.value].endDate;
|
||||||
var now = new Date();
|
}
|
||||||
var nowTime = now.getTime();
|
getTrade({
|
||||||
var day = now.getDay();
|
beginDate: beginDate,
|
||||||
var oneDayTime = 24 * 60 * 60 * 1000;
|
endDate: endDate,
|
||||||
//显示周一
|
shopId: uni.getStorageSync("shopId"),
|
||||||
var MondayTime = nowTime - (day - 1) * oneDayTime;
|
rangeType: rangeType,
|
||||||
//显示周日
|
}).then((res) => {
|
||||||
var SundayTime = nowTime + (7 - day) * oneDayTime;
|
refundAmount.value = res.refundAmount;
|
||||||
startTime = dayjs(MondayTime).format('YYYY-MM-DD 00:00:00')
|
for (var key in res) {
|
||||||
endTime = dayjs(SundayTime).format('YYYY-MM-DD 23:59:59')
|
pageData.list.map((item) => {
|
||||||
} else if (selected.value == 'moon') {
|
if (item.key == key) {
|
||||||
startTime = dayjs().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
|
item.payAmount = res[key];
|
||||||
endTime = dayjs().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
|
}
|
||||||
} else if (selected.value == 'custom') {
|
});
|
||||||
let s = start.substring(0, start.indexOf(' '))
|
}
|
||||||
let e = end.substring(0, end.indexOf(' '))
|
setList();
|
||||||
startTime = s + ' 00:00:00'
|
let incomeAmountAll = 0;
|
||||||
endTime = e + ' 23:59:59'
|
pageData.list.map((item) => {
|
||||||
}
|
incomeAmountAll += item.payAmount || 0;
|
||||||
getTrade({
|
});
|
||||||
beginDate: startTime,
|
|
||||||
endDate: endTime,
|
|
||||||
}).then((res) => {
|
|
||||||
refundCount.value = res.refundCount
|
|
||||||
for (var key in res) {
|
|
||||||
pageData.list.map(item => {
|
|
||||||
if (item.key == key) {
|
|
||||||
item.payAmount = res[key]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
setList()
|
|
||||||
let incomeAmountAll = 0;
|
|
||||||
pageData.list.map(item => {
|
|
||||||
incomeAmountAll += (item.payAmount || 0)
|
|
||||||
})
|
|
||||||
|
|
||||||
yingyeE.value = incomeAmountAll
|
yingyeE.value = incomeAmountAll;
|
||||||
emit('totalRevenue', incomeAmountAll)
|
emit("totalRevenue", incomeAmountAll);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期筛选确认
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
function datePickerConfirm(e) {
|
||||||
|
getlist(e.start, e.end);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
// 获取当前时间
|
||||||
* 日期筛选确认
|
function getdate() {
|
||||||
* @param {Object} e
|
const dt = new Date();
|
||||||
*/
|
const y = dt.getFullYear();
|
||||||
function datePickerConfirm(e) {
|
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
||||||
getlist(e.start, e.end)
|
const d = (dt.getDate() + "").padStart(2, "0");
|
||||||
}
|
const hh = (dt.getHours() + "").padStart(2, "0");
|
||||||
|
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
||||||
|
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||||
|
return `${y}-${m}-${d}`;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前时间
|
// 获取昨天时间
|
||||||
function getdate() {
|
const formatTime = () => {
|
||||||
const dt = new Date();
|
let strDate = getdate();
|
||||||
const y = dt.getFullYear();
|
let dateFormat = new Date(strDate);
|
||||||
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
||||||
const d = (dt.getDate() + "").padStart(2, "0");
|
dateFormat = new Date(dateFormat);
|
||||||
const hh = (dt.getHours() + "").padStart(2, "0");
|
let y = dateFormat.getFullYear();
|
||||||
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
let m = (dateFormat.getMonth() + 1).toString().padStart(2, "0");
|
||||||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
let d = dateFormat.getDate().toString().padStart(2, "0");
|
||||||
return `${y}-${m}-${d}`;
|
return `${y}-${m}-${d}`;
|
||||||
}
|
};
|
||||||
|
|
||||||
// 获取昨天时间
|
function changeTime(e, index) {
|
||||||
const formatTime = () => {
|
selected.value = e;
|
||||||
let strDate = getdate()
|
timeSleIndex.value = index;
|
||||||
let dateFormat = new Date(strDate);
|
if (e == "custom") {
|
||||||
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
datePicker.value.toggle();
|
||||||
dateFormat = new Date(dateFormat);
|
} else {
|
||||||
let y = dateFormat.getFullYear()
|
getlist();
|
||||||
let m = (dateFormat.getMonth() + 1).toString().padStart(2, '0')
|
}
|
||||||
let d = dateFormat.getDate().toString().padStart(2, '0')
|
}
|
||||||
return `${y}-${m}-${d}`
|
|
||||||
}
|
|
||||||
|
|
||||||
const timeSleIndex = ref(0)
|
const xArr = [0, 134, 262, 390, 532];
|
||||||
|
const comBlockX = computed(() => {
|
||||||
function changeTime(e, index) {
|
return xArr[timeSleIndex.value];
|
||||||
selected.value = e
|
});
|
||||||
timeSleIndex.value = index
|
|
||||||
if (e == 'custom') {
|
|
||||||
datePicker.value.toggle()
|
|
||||||
} else {
|
|
||||||
getlist()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const xArr=[0,134,262,390,532]
|
|
||||||
const comBlockX = computed(() => {
|
|
||||||
return xArr[ timeSleIndex.value]
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
ul,
|
ul,
|
||||||
li {
|
li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rotate {
|
.rotate {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.statistics {
|
.statistics {
|
||||||
padding: 0 28rpx;
|
padding: 0 28rpx;
|
||||||
margin-top: 50rpx;
|
margin-top: 50rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 170rpx;
|
width: 170rpx;
|
||||||
left: 18rpx;
|
left: 18rpx;
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
line-height: 50rpx;
|
line-height: 50rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: linear-gradient(109deg, #70B9FF 0%, #629FFA 100%);
|
background: linear-gradient(109deg, #70b9ff 0%, #629ffa 100%);
|
||||||
border-radius: 12rpx 12rpx 12rpx 0rpx;
|
border-radius: 12rpx 12rpx 12rpx 0rpx;
|
||||||
top: -16px;
|
top: -16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statisticsBox {
|
.statisticsBox {
|
||||||
width: 694rpx;
|
width: 694rpx;
|
||||||
background: #FFFFFF;
|
background: #ffffff;
|
||||||
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
||||||
padding: 48rpx 32rpx 32rpx;
|
padding: 48rpx 32rpx 32rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin-top: 54rpx;
|
margin-top: 54rpx;
|
||||||
|
|
||||||
.bottom {}
|
.bottom {
|
||||||
|
}
|
||||||
|
|
||||||
.time-wrapper {
|
.time-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.timelistbox {
|
.timelistbox {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.time-item {
|
.time-item {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-bottom: 10rpx;
|
padding-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xian {
|
.xian {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 3rpx;
|
height: 3rpx;
|
||||||
background-color: #318AFE;
|
background-color: #318afe;
|
||||||
// position: absolute;
|
// position: absolute;
|
||||||
// left: 16rpx;
|
// left: 16rpx;
|
||||||
// bottom: 0;
|
// bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-selected {
|
.time-selected {
|
||||||
color: #318afe;
|
color: #318afe;
|
||||||
font-size: 32rpx !important;
|
font-size: 32rpx !important;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
width: 0rpx;
|
width: 0rpx;
|
||||||
height: 170rpx;
|
height: 170rpx;
|
||||||
border: 2rpx solid #EEE8E8;
|
border: 2rpx solid #eee8e8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.payList {
|
.payList {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
.li {
|
.li {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-top: 12rpx;
|
margin-top: 12rpx;
|
||||||
|
|
||||||
>view {
|
> view {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.circle {
|
.circle {
|
||||||
width: 8rpx;
|
width: 8rpx;
|
||||||
height: 8rpx;
|
height: 8rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time_bootom_line {
|
.time_bootom_line {
|
||||||
height: 16rpx;
|
height: 16rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-bottom: 1px solid #629FFA;
|
border-bottom: 1px solid #629ffa;
|
||||||
|
|
||||||
.block {
|
.block {
|
||||||
width: 18rpx;
|
width: 18rpx;
|
||||||
height: 18rpx;
|
height: 18rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border-top: 0.5rpx solid #629FFA;
|
border-top: 0.5rpx solid #629ffa;
|
||||||
border-left: 0.5rpx solid #629FFA;
|
border-left: 0.5rpx solid #629ffa;
|
||||||
left: 30rpx;
|
left: 30rpx;
|
||||||
top: 6rpx;
|
top: 6rpx;
|
||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
transform-origin: center;
|
transform-origin: center;
|
||||||
transition: all .2s linear;
|
transition: all 0.2s linear;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -273,9 +273,11 @@
|
|||||||
*/
|
*/
|
||||||
async function loginFinishFunc(loginBizData) {
|
async function loginFinishFunc(loginBizData) {
|
||||||
// 保存 token
|
// 保存 token
|
||||||
|
console.log('loginBizData',loginBizData)
|
||||||
storageManage.setLogin(loginBizData)
|
storageManage.setLogin(loginBizData)
|
||||||
storageManage.token(loginBizData.tokenInfo)
|
storageManage.token(loginBizData.tokenInfo)
|
||||||
uni.setStorageSync("promission",loginBizData.promissionList)
|
uni.setStorageSync("promission",loginBizData.promissionList)
|
||||||
|
uni.setStorageSync("shopId",loginBizData.shopInfo.id)
|
||||||
|
|
||||||
// var time1 = new Date();
|
// var time1 = new Date();
|
||||||
// var time2 = new Date(loginBizData.expireDate);
|
// var time2 = new Date(loginBizData.expireDate);
|
||||||
|
|||||||
@@ -241,7 +241,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.u-tab-view {
|
.u-tab-view {
|
||||||
width: 200rpx;
|
width: 240rpx;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 900 B |
|
Before Width: | Height: | Size: 957 B |
|
Before Width: | Height: | Size: 805 B |
|
Before Width: | Height: | Size: 943 B |
|
Before Width: | Height: | Size: 895 B |
|
Before Width: | Height: | Size: 947 B |
|
Before Width: | Height: | Size: 945 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 813 B |
|
Before Width: | Height: | Size: 1018 B |
|
Before Width: | Height: | Size: 857 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 962 B |
|
Before Width: | Height: | Size: 930 B |
|
Before Width: | Height: | Size: 930 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 792 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 777 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 857 B |
|
Before Width: | Height: | Size: 896 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 857 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 774 B |
|
Before Width: | Height: | Size: 935 B |
|
Before Width: | Height: | Size: 918 B |
@@ -1,20 +0,0 @@
|
|||||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 670 500" class="design-iconfont">
|
|
||||||
<g clip-path="url(#zbq1vo5r5__clip0_142_2589)">
|
|
||||||
<rect width="670" height="500" rx="32" fill="url(#zbq1vo5r5__paint0_linear_142_2589)"/>
|
|
||||||
<path d="M191 107.157C216.139 131.509 254.181 168.36 289.432 202.507C308.031 220.523 343.338 228.752 368.772 198.151C423.849 131.881 448.302 82.9113 522.711 -68" stroke="url(#zbq1vo5r5__paint1_linear_142_2589)" stroke-opacity=".16" stroke-width="70" stroke-linecap="round"/>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="zbq1vo5r5__paint0_linear_142_2589" x1="335" y1="0" x2="335" y2="500" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop stop-color="#EBFFF8"/>
|
|
||||||
<stop offset=".512714" stop-color="#FAFFFD"/>
|
|
||||||
<stop offset="1" stop-color="#fff"/>
|
|
||||||
</linearGradient>
|
|
||||||
<linearGradient id="zbq1vo5r5__paint1_linear_142_2589" x1="356.856" y1="-68" x2="356.856" y2="218.589" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop stop-color="#00C087"/>
|
|
||||||
<stop offset="1" stop-color="#00C087" stop-opacity=".5"/>
|
|
||||||
</linearGradient>
|
|
||||||
<clipPath id="zbq1vo5r5__clip0_142_2589">
|
|
||||||
<rect width="670" height="500" rx="32" fill="#fff"/>
|
|
||||||
</clipPath>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32"><defs><style>.a{fill:#80bcff;}.b{clip-path:url(#a);}.c{clip-path:url(#b);}.d{fill:#197dff;}.e{fill:#4c99fe;}</style><clipPath id="a"><rect class="a" width="32" height="32" transform="translate(41 962)"/></clipPath><clipPath id="b"><rect class="a" width="32" height="32" transform="translate(338 862)"/></clipPath></defs><g class="b" transform="translate(-41 -962)"><g class="c" transform="translate(-297 100)"><path class="d" d="M27.706,22.243h0V19.407a1.449,1.449,0,0,0-.824-1.483c-1.848-.857-2.472-1.605-2.472-2.965s.577-2.054,2.472-2.966l.038-.023c.341.822,1.073,1.335,2.613,1.832a1.449,1.449,0,0,1,1,1.371l.542,4.415A2.362,2.362,0,0,1,28.89,22.1l-1.183.145Zm0-13.526V6.061a2.36,2.36,0,0,0-2.472-2.224H.521A2.756,2.756,0,0,0,0,3.886a2.6,2.6,0,0,1,1.649-.854L26.18.021A2.775,2.775,0,0,1,26.518,0,2.323,2.323,0,0,1,28.9,1.927l.542,4.416a1.374,1.374,0,0,1-.636,1.572,9.66,9.66,0,0,0-1.1.8Z" transform="translate(338.913 865.612)"/><path class="e" d="M93.989,182.151a1.367,1.367,0,0,0,.824-1.483V176.22A2.358,2.358,0,0,0,92.341,174H67.627a2.357,2.357,0,0,0-2.471,2.224v4.448a1.326,1.326,0,0,0,.824,1.483c1.125.472,2.471,1.425,2.471,2.966a2.936,2.936,0,0,1-2.422,2.962,1.668,1.668,0,0,0-.872,1.486v4.448a2.358,2.358,0,0,0,2.471,2.225H92.341a2.358,2.358,0,0,0,2.471-2.225v-4.448a1.45,1.45,0,0,0-.824-1.483c-1.8-.835-2.471-1.578-2.471-2.965s.629-2.079,2.471-2.966Zm-9.062,2.6a.393.393,0,0,1-.412.371H80.808V186.6h3.707a.393.393,0,0,1,.412.371v.741a.393.393,0,0,1-.412.371H80.808v2.6a.393.393,0,0,1-.412.371h-.824a.393.393,0,0,1-.412-.371v-2.6H75.453a.393.393,0,0,1-.412-.371v-.741a.393.393,0,0,1,.412-.371H79.16v-1.483H75.453a.393.393,0,0,1-.412-.371V184a.393.393,0,0,1,.412-.371h3.119l-3.386-3.274a.361.361,0,0,1,0-.516l.524-.516a.375.375,0,0,1,.524,0l3.745,3.622,3.744-3.62a.378.378,0,0,1,.528,0l.528.52a.364.364,0,0,1,0,.52L81.4,183.634h3.11a.393.393,0,0,1,.412.371v.742Zm0,0" transform="translate(273.002 694.855)"/></g></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 32 KiB |
BIN
static/uni.png
|
Before Width: | Height: | Size: 4.1 KiB |
@@ -2,6 +2,18 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import * as shopApi from "@/http/api/shop.js";
|
import * as shopApi from "@/http/api/shop.js";
|
||||||
|
|
||||||
|
//判断是否是主店
|
||||||
|
export const isMainShop = (shopId) => {
|
||||||
|
const shopInfo=uni.getStorageSync("shopInfo");
|
||||||
|
if(shopInfo.isHeadShop){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if(shopInfo.shopType=='only'){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// 分销
|
// 分销
|
||||||
export const useAccountInfoStore = defineStore("accountInfo", {
|
export const useAccountInfoStore = defineStore("accountInfo", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
|||||||
17
store/chat.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { defineStore } from "pinia";
|
||||||
|
// import * as shopApi from "@/http/api/shop.js";
|
||||||
|
|
||||||
|
// 聊天
|
||||||
|
export const useChatStore = defineStore("chat", {
|
||||||
|
state: () => {
|
||||||
|
return {
|
||||||
|
chatList: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
sendMessage(message) {
|
||||||
|
this.chatList.push(message);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||||
|
});
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import * as distributionApi from "@/http/api/market/distribution.js";
|
import * as distributionApi from "@/http/api/market/distribution.js";
|
||||||
import * as consumeDiscountApi from "@/http/api/market/consumeDiscount.js";
|
import * as consumeDiscountApi from "@/http/api/market/consumeDiscount.js";
|
||||||
|
import * as memberApi from "@/http/api/market/member.js";
|
||||||
|
|
||||||
export const upgradeTypes = [
|
export const upgradeTypes = [
|
||||||
{
|
{
|
||||||
@@ -57,7 +58,6 @@ export const useDistributionStore = defineStore("distribution", {
|
|||||||
export const useNewUserDiscountStore = defineStore("newUserDiscount", {
|
export const useNewUserDiscountStore = defineStore("newUserDiscount", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
//分销配置
|
|
||||||
config: {
|
config: {
|
||||||
isEnable: 0,
|
isEnable: 0,
|
||||||
},
|
},
|
||||||
@@ -70,15 +70,56 @@ export const useNewUserDiscountStore = defineStore("newUserDiscount", {
|
|||||||
return this.config;
|
return this.config;
|
||||||
},
|
},
|
||||||
async editConfig(data, isAutoResrefresh = true) {
|
async editConfig(data, isAutoResrefresh = true) {
|
||||||
|
if (data.discountType === "FIXED") {
|
||||||
|
data.randomDiscountList = [];
|
||||||
|
}
|
||||||
const res = await consumeDiscountApi.editConfig({
|
const res = await consumeDiscountApi.editConfig({
|
||||||
...this.config,
|
...this.config,
|
||||||
...data,
|
...data,
|
||||||
});
|
});
|
||||||
if (isAutoResrefresh) {
|
if (isAutoResrefresh) {
|
||||||
this.getConfig();
|
setTimeout(() => {
|
||||||
|
this.getConfig();
|
||||||
|
}, 1500);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//超级会员
|
||||||
|
export const useSuperVipStore = defineStore("superVip", {
|
||||||
|
state: () => {
|
||||||
|
return {
|
||||||
|
config: {
|
||||||
|
isOpen: 0,
|
||||||
|
configList:[]
|
||||||
|
},
|
||||||
|
vipLevelList:[]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
setVipLevelList(list){
|
||||||
|
this.vipLevelList = list||[];
|
||||||
|
},
|
||||||
|
editPlan(index,plan){
|
||||||
|
this.config.configList[index] = plan;
|
||||||
|
},
|
||||||
|
addPlan(plan){
|
||||||
|
this.config.configList.push(plan);
|
||||||
|
},
|
||||||
|
async getConfig() {
|
||||||
|
const data = await memberApi.getConfig();
|
||||||
|
data.memberPriceShopType = data.memberPriceShopType.toLowerCase();
|
||||||
|
this.config = data;
|
||||||
|
return this.config;
|
||||||
|
},
|
||||||
|
async editConfig(data) {
|
||||||
|
const res = await memberApi.editConfig({ ...this.config,memberPriceShopType:this.config.memberPriceShopType.toUpperCase(), ...data });
|
||||||
|
this.getConfig();
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||||
|
});
|
||||||
|
|||||||