完成新客立减功能
This commit is contained in:
parent
3f9f3ea25c
commit
8fa21b3404
|
|
@ -365,7 +365,7 @@ text {
|
||||||
right: 0;
|
right: 0;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
z-index: 999;
|
||||||
/* #ifdef H5 */
|
/* #ifdef H5 */
|
||||||
padding-bottom: 28rpx;
|
padding-bottom: 28rpx;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
|
|
@ -427,4 +427,51 @@ text {
|
||||||
}
|
}
|
||||||
.bg-f7{
|
.bg-f7{
|
||||||
background-color: #F7F7F7;
|
background-color: #F7F7F7;
|
||||||
}
|
}
|
||||||
|
.default-box-padding{
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
}
|
||||||
|
.default-box-radius{
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
.default-box-x-padding{
|
||||||
|
padding-left: 28rpx;
|
||||||
|
padding-right: 28rpx;
|
||||||
|
}
|
||||||
|
.default-box-y-padding{
|
||||||
|
padding-top: 32rpx;
|
||||||
|
padding-bottom: 32rpx;
|
||||||
|
}
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
.u-col-baseline{
|
||||||
|
align-items: baseline;
|
||||||
|
}
|
||||||
|
.text-right{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view style="height: 180rpx"></view>
|
<view class="zhanwei" :class="[direction == 'column' ? 'zhanwei1' : '']"></view>
|
||||||
|
|
||||||
<view class="fixed-bottom u-flex gap-20">
|
<view
|
||||||
|
class="fixed-bottom u-flex gap-20"
|
||||||
|
:class="[direction == 'column' ? 'u-flex-column' : '']"
|
||||||
|
>
|
||||||
<view class="u-flex-1">
|
<view class="u-flex-1">
|
||||||
<my-button type="primary" @click="save" shape="circle">
|
<my-button type="primary" @click="save" shape="circle">
|
||||||
保存
|
保存
|
||||||
</my-button>
|
</my-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -18,7 +21,15 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
const emit= defineEmits(["save", "cancel"]);
|
const emit = defineEmits(["save", "cancel"]);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
//方向 row横向布局 column 纵向布局
|
||||||
|
direction: {
|
||||||
|
type: String,
|
||||||
|
default: "row",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
emit("save");
|
emit("save");
|
||||||
|
|
@ -27,3 +38,12 @@ function cancel() {
|
||||||
emit("cancel");
|
emit("cancel");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.zhanwei {
|
||||||
|
height: 180rpx;
|
||||||
|
}
|
||||||
|
.zhanwei1{
|
||||||
|
height: 240rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,57 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<up-checkbox-group v-model="useType" placement="row" shape="square" size="28rpx">
|
<up-checkbox-group
|
||||||
<up-checkbox v-for="item in dinetyps" :key="item.value" :name="item.value" :label="item.label" :customStyle="customStyle"></up-checkbox>
|
v-model="useType"
|
||||||
</up-checkbox-group>
|
placement="row"
|
||||||
</view>
|
shape="square"
|
||||||
|
size="28rpx"
|
||||||
|
>
|
||||||
|
<up-checkbox
|
||||||
|
v-for="item in dinetyps"
|
||||||
|
:key="item.value"
|
||||||
|
:name="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:customStyle="radioCustomStyle"
|
||||||
|
></up-checkbox>
|
||||||
|
</up-checkbox-group>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
|
||||||
const customStyle = ref({
|
|
||||||
marginRight: '15px'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 可使用类型:dine堂食/pickup自取/deliv配送/express快递
|
// 可使用类型:dine堂食/pickup自取/deliv配送/express快递
|
||||||
const dinetyps = [
|
const dinetyps = [
|
||||||
{
|
{
|
||||||
value: 'dine-in',
|
value: "dine-in",
|
||||||
label: '堂食'
|
label: "堂食",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'take-out',
|
value: "take-out",
|
||||||
label: '自取'
|
label: "自取",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'post',
|
value: "post",
|
||||||
label: '配送'
|
label: "配送",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'take-away',
|
value: "take-away",
|
||||||
label: '快递'
|
label: "快递",
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
radioCustomStyle: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return { marginRight: "15px" };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const useType = defineModel({
|
const useType = defineModel({
|
||||||
default: () => [],
|
default: () => [],
|
||||||
type: Array
|
type: Array,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
<view>
|
<view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="item" @click="pirckerShow(startDate, 'startDate')">
|
<view class="item" @click="pirckerShow(startDate, 'startDate')">
|
||||||
<text class="u-m-r-12" v-if="!startDate">请选择日期范围</text>
|
<text class="u-m-r-12" v-if="!startDate">{{ startText }}</text>
|
||||||
<text class="u-m-r-12" v-else>{{ startDate }}</text>
|
<text class="u-m-r-12" v-else>{{ startDate }}</text>
|
||||||
<up-icon name="arrow-down" size="14"></up-icon>
|
<up-icon name="arrow-down" size="14"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-l-8 u-m-r-8">—</view>
|
<view class="u-m-l-8 u-m-r-8">—</view>
|
||||||
<view class="item" @click="pirckerShow(endDate, 'endDate')">
|
<view class="item" @click="pirckerShow(endDate, 'endDate')">
|
||||||
<text class="u-m-r-12" v-if="!endDate">请选择日期范围</text>
|
<text class="u-m-r-12" v-if="!endDate">{{ endText }}</text>
|
||||||
<text class="u-m-r-12" v-else>{{ endDate }}</text>
|
<text class="u-m-r-12" v-else>{{ endDate }}</text>
|
||||||
<up-icon name="arrow-down" size="14"></up-icon>
|
<up-icon name="arrow-down" size="14"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -29,6 +29,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
const props=defineProps({
|
||||||
|
startText: {
|
||||||
|
type: String,
|
||||||
|
default: "请选择开始时间",
|
||||||
|
},
|
||||||
|
endText: {
|
||||||
|
type: String,
|
||||||
|
default: "请选择结束时间",
|
||||||
|
},
|
||||||
|
});
|
||||||
const startDate = defineModel("startDate", {
|
const startDate = defineModel("startDate", {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import http from "@/http/http.js";
|
import http from "@/http/http.js";
|
||||||
const request = http.request;
|
const request = http.request;
|
||||||
const urlType = "market";
|
const marketUrl = "market";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新客立减
|
* 新客立减
|
||||||
|
|
@ -15,3 +15,24 @@ export function getDiscountByUserId(params) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getConfig(params) {
|
||||||
|
return request({
|
||||||
|
url: marketUrl + `/admin/consumeDiscount`,
|
||||||
|
method: "get",
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function editConfig(params) {
|
||||||
|
return request({
|
||||||
|
url: marketUrl + `/admin/consumeDiscount`,
|
||||||
|
method: "POST",
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,8 @@ function confirm(){
|
||||||
.btn{
|
.btn{
|
||||||
flex:1;
|
flex:1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 34rpx 20rpx;
|
padding: 18rpx 60rpx;
|
||||||
border-radius: 4rpx;
|
border-radius: 100rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
border: 2rpx solid transparent;
|
border: 2rpx solid transparent;
|
||||||
&.success{
|
&.success{
|
||||||
|
|
|
||||||
|
|
@ -86,14 +86,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-32">
|
|
||||||
<my-pagination
|
|
||||||
:page="query.page"
|
|
||||||
:totalElements="query.totalElements"
|
|
||||||
:size="query.size"
|
|
||||||
@change="pageChange"
|
|
||||||
></my-pagination>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-if="hasAjax && list.length <= 0">
|
<template v-if="hasAjax && list.length <= 0">
|
||||||
<my-img-empty tips="未找到相关用户"></my-img-empty>
|
<my-img-empty tips="未找到相关用户"></my-img-empty>
|
||||||
|
|
|
||||||
|
|
@ -124,10 +124,9 @@ let timer=null
|
||||||
//全部的分成比例加起来不能超过100%
|
//全部的分成比例加起来不能超过100%
|
||||||
function checkNumberCommission(e,index){
|
function checkNumberCommission(e,index){
|
||||||
const value=e.detail.value
|
const value=e.detail.value
|
||||||
const total=allCommission()
|
if(value>100){
|
||||||
if(total>100){
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'分成比例加起来不能超过100%',
|
title:'分成比例不能超过100',
|
||||||
icon:'none'
|
icon:'none'
|
||||||
})
|
})
|
||||||
form.levelConfigList[index].levelOneCommission=''
|
form.levelConfigList[index].levelOneCommission=''
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,302 @@
|
||||||
|
<template>
|
||||||
|
<view class="min-page bg-f7 u-p-t-30 u-font-28">
|
||||||
|
<up-sticky>
|
||||||
|
<view class="bg-fff u-flex default-box-padding">
|
||||||
|
<image
|
||||||
|
style="width: 60rpx; height: 60rpx"
|
||||||
|
src="/pageMarket/static/images/new-user-discount.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="newUserDiscountStore.config.isEnable"
|
||||||
|
size="18"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
></up-switch>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-sticky>
|
||||||
|
<view class="default-box-padding">
|
||||||
|
<view
|
||||||
|
class="bg-fff default-box-radius default-box-padding u-flex u-row-between"
|
||||||
|
>
|
||||||
|
<text class="color-000 font-bold">活动时间</text>
|
||||||
|
<my-time-area
|
||||||
|
startText="开始时间"
|
||||||
|
endText="结束时间"
|
||||||
|
v-model:startDate="form.startTime"
|
||||||
|
v-model:endDate="form.endTime"
|
||||||
|
></my-time-area>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="default-box-radius bg-fff u-m-t-32 default-box-y-padding">
|
||||||
|
<view
|
||||||
|
class="u-flex u-p-b-16 default-box-x-padding"
|
||||||
|
style="align-items: baseline"
|
||||||
|
>
|
||||||
|
<view class="font-bold">减免方式</view>
|
||||||
|
<view class="u-m-l-32">
|
||||||
|
<up-radio-group v-model="form.discountType">
|
||||||
|
<up-radio key="FIXED" name="FIXED" label="固定金额"
|
||||||
|
>固定金额</up-radio
|
||||||
|
>
|
||||||
|
<up-radio key="RANDOM" name="RANDOM" label="随机立减"
|
||||||
|
>随机立减</up-radio
|
||||||
|
>
|
||||||
|
</up-radio-group>
|
||||||
|
<view class="u-flex u-m-t-16" v-if="form.discountType === 'FIXED'">
|
||||||
|
<input
|
||||||
|
class="number-box"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
placeholder-class="color-999 u-font-28"
|
||||||
|
type="number"
|
||||||
|
v-model="form.payAmount"
|
||||||
|
/>
|
||||||
|
<view class="unit">元</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<up-line></up-line>
|
||||||
|
<view
|
||||||
|
class="u-flex default-box-x-padding default-box-y-padding"
|
||||||
|
v-if="form.discountType === 'RANDOM'"
|
||||||
|
>
|
||||||
|
<view class="font-bold u-m-r-14">减免方式</view>
|
||||||
|
<my-button height="60rpx" @click="addItem">添加方案</my-button>
|
||||||
|
<text class="color-red u-font-24 u-m-l-14"
|
||||||
|
>所有概率相加必须等于100%</text
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
<view class="table">
|
||||||
|
<view
|
||||||
|
class="header u-flex u-row-between color-666 default-box-x-padding u-p-t-48 u-p-b-48 bg-f7"
|
||||||
|
>
|
||||||
|
<view class="">减免金额(元)</view>
|
||||||
|
<view class="">概率(%)</view>
|
||||||
|
<view class="">操作</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="tr color-666 u-flex u-row-between default-box-x-padding u-p-t-48 u-p-b-48"
|
||||||
|
v-for="(item, index) in form.randomDiscountList"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<view class="" style="min-width: 200rpx">{{ item.amount }}</view>
|
||||||
|
<view class="">{{ item.probability }}</view>
|
||||||
|
<view class="u-flex gap-20">
|
||||||
|
<text class="color-main" @click="editItem(index)">编辑</text>
|
||||||
|
<text class="color-red" @click="deleteItem(index)">删除</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex default-box-x-padding u-col-baseline u-m-t-32">
|
||||||
|
<text class="font-bold no-wrap">可使用类型</text>
|
||||||
|
<view class="u-m-l-42">
|
||||||
|
<my-dine-types
|
||||||
|
v-model="form.useTypeList"
|
||||||
|
:radioCustomStyle="{ marginRight: '10rpx' }"
|
||||||
|
></my-dine-types>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<my-bottom-btn-group
|
||||||
|
@cancel="cancel"
|
||||||
|
@save="save"
|
||||||
|
direction="column"
|
||||||
|
></my-bottom-btn-group>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
v-model="modalData.show"
|
||||||
|
:title="modalData.title"
|
||||||
|
@confirm="handleConfirm"
|
||||||
|
>
|
||||||
|
<view class="u-p-l-38 u-p-r-38 u-p-t-40 u-p-b-40">
|
||||||
|
<view class="u-flex" style="gap: 50rpx">
|
||||||
|
<text class="u-font-32" style="min-width: 128rpx">减免金额</text>
|
||||||
|
<view class="u-flex u-m-t-16">
|
||||||
|
<input
|
||||||
|
class="number-box"
|
||||||
|
placeholder="减免金额"
|
||||||
|
placeholder-class="color-999 u-font-28"
|
||||||
|
type="digit"
|
||||||
|
v-model="modalData.form.amount"
|
||||||
|
/>
|
||||||
|
<view class="unit">元</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-40 u-col-baseline" style="gap: 50rpx">
|
||||||
|
<text class="u-font-32 text-right" style="min-width: 128rpx"
|
||||||
|
>概率</text
|
||||||
|
>
|
||||||
|
<view>
|
||||||
|
<view class="u-flex u-m-t-16">
|
||||||
|
<input
|
||||||
|
class="number-box"
|
||||||
|
placeholder="概率"
|
||||||
|
placeholder-class="color-999 u-font-28"
|
||||||
|
type="digit"
|
||||||
|
v-model="modalData.form.probability"
|
||||||
|
/>
|
||||||
|
<view class="unit">%</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-18 color-666 u-font-28"
|
||||||
|
>所有概率相加必须等于100%</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Modal>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import Modal from "@/pageMarket/components/modal.vue";
|
||||||
|
|
||||||
|
import { ref, reactive, computed, watch, onMounted } from "vue";
|
||||||
|
import { useNewUserDiscountStore } from "@/store/market.js";
|
||||||
|
const newUserDiscountStore = useNewUserDiscountStore();
|
||||||
|
|
||||||
|
const modalData = reactive({
|
||||||
|
show: false,
|
||||||
|
title: "",
|
||||||
|
key: "",
|
||||||
|
index: -1,
|
||||||
|
form: {
|
||||||
|
amount: "",
|
||||||
|
probability: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function resetModalData() {
|
||||||
|
modalData.index = -1;
|
||||||
|
modalData.form = {
|
||||||
|
amount: "",
|
||||||
|
probability: "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function addItem() {
|
||||||
|
resetModalData();
|
||||||
|
modalData.show = true;
|
||||||
|
modalData.key = "add";
|
||||||
|
modalData.title = "添加方案";
|
||||||
|
}
|
||||||
|
function editItem(index) {
|
||||||
|
modalData.index = index;
|
||||||
|
modalData.form = form.randomDiscountList[index];
|
||||||
|
modalData.show = true;
|
||||||
|
modalData.key = "edit";
|
||||||
|
modalData.title = "编辑方案";
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleConfirm() {
|
||||||
|
if (modalData.form.amount == "") {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请填写减免金额",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (modalData.form.probability == "") {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请填写概率",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
modalData.show = false;
|
||||||
|
if (modalData.key == "add") {
|
||||||
|
form.randomDiscountList.push(modalData.form);
|
||||||
|
} else if (modalData.key == "edit") {
|
||||||
|
form.randomDiscountList[modalData.index] = modalData.form;
|
||||||
|
}
|
||||||
|
resetModalData();
|
||||||
|
}
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
startTime: "",
|
||||||
|
endTime: "",
|
||||||
|
discountType: "FIXED",
|
||||||
|
useTypeList: [],
|
||||||
|
randomDiscountList: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
function cancel() {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function deleteItem(index) {
|
||||||
|
form.randomDiscountList.splice(index, 1);
|
||||||
|
}
|
||||||
|
function save() {
|
||||||
|
if (form.useTypeList.length == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请选择可使用类型",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
newUserDiscountStore
|
||||||
|
.editConfig(
|
||||||
|
{
|
||||||
|
...form,
|
||||||
|
startTime: form.startTime ? form.startTime + " 00:00:00" : "",
|
||||||
|
endTime: form.endTime ? form.endTime + " 23:59:59" : "",
|
||||||
|
},
|
||||||
|
false
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
if (res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "保存成功",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => newUserDiscountStore.config.isEnable,
|
||||||
|
(newVal) => {
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
const res = await newUserDiscountStore.getConfig();
|
||||||
|
const data = {
|
||||||
|
...res,
|
||||||
|
startTime: res.startTime ? res.startTime.split(" ")[0] : "",
|
||||||
|
endTime: res.endTime ? res.endTime.split(" ")[0] : "",
|
||||||
|
useTypeList: res.useTypeList || [],
|
||||||
|
randomDiscountList: res.randomDiscountList || [],
|
||||||
|
};
|
||||||
|
console.log(data);
|
||||||
|
Object.assign(form, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
init();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.tr {
|
||||||
|
border-bottom: 1px solid #f7f7f7;
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:deep(.fixed-bottom) {
|
||||||
|
left: 110rpx;
|
||||||
|
right: 110rpx;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
19
pages.json
19
pages.json
|
|
@ -679,6 +679,25 @@
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "运营余额"
|
"navigationBarTitleText": "运营余额"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_NEW_USER_DISCOUNT",
|
||||||
|
"path": "newUserDiscount/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "新客立减"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ const menuList = ref([
|
||||||
{
|
{
|
||||||
title: '新客立减',
|
title: '新客立减',
|
||||||
icon: '',
|
icon: '',
|
||||||
pageUrl: 'PAGES_ORDER_INDEX',
|
pageUrl: 'PAGES_MARKET_NEW_USER_DISCOUNT',
|
||||||
intro: '首单下单减免金额'
|
intro: '首单下单减免金额'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// stores/counter.js
|
// stores/counter.js
|
||||||
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";
|
||||||
|
|
||||||
export const upgradeTypes = [
|
export const upgradeTypes = [
|
||||||
{
|
{
|
||||||
|
|
@ -51,3 +52,30 @@ export const useDistributionStore = defineStore("distribution", {
|
||||||
},
|
},
|
||||||
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//新客立减
|
||||||
|
export const useNewUserDiscountStore = defineStore("newUserDiscount", {
|
||||||
|
state: () => {
|
||||||
|
return {
|
||||||
|
//分销配置
|
||||||
|
config: {
|
||||||
|
isEnable: 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
async getConfig() {
|
||||||
|
const data = await consumeDiscountApi.getConfig();
|
||||||
|
this.config = data;
|
||||||
|
return this.config;
|
||||||
|
},
|
||||||
|
async editConfig(data,isAutoResrefresh = true) {
|
||||||
|
const res = await consumeDiscountApi.editConfig({ ...this.config, ...data });
|
||||||
|
if(isAutoResrefresh){
|
||||||
|
this.getConfig();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue