修改霸王餐页面,增加私域引流,消费返现,满减活动页面

This commit is contained in:
2025-10-15 14:18:39 +08:00
parent 2da4b7e8ee
commit 7f90be6644
29 changed files with 2519 additions and 145 deletions

View File

@@ -358,6 +358,18 @@ text {
left: 0;
right: 0;
}
.fixed-bottom{
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 30rpx;
padding-bottom: env(safe-area-inset-bottom);
/* #ifdef H5 */
padding-bottom: 28rpx;
/* #endif */
}
.lh30 {
line-height: 30px;
}

View File

@@ -0,0 +1,29 @@
<template>
<view>
<view style="height: 180rpx"></view>
<view class="fixed-bottom u-flex gap-20">
<view class="u-flex-1">
<my-button type="primary" @click="save" shape="circle">
保存
</my-button>
</view>
<view class="u-flex-1">
<my-button bgColor="#fff" type="default" @click="cancel" shape="circle">
取消
</my-button>
</view>
</view>
</view>
</template>
<script setup>
const emit= defineEmits(["save", "cancel"]);
function save() {
emit("save");
}
function cancel() {
emit("cancel");
}
</script>

View File

@@ -0,0 +1,44 @@
<template>
<view>
<up-checkbox-group
v-model="useType"
placement="row"
shape="square"
size="28rpx"
>
<up-checkbox
:customStyle="{ marginRight: '16rpx' }"
v-for="item in dinetyps"
:key="item.value"
:name="item.value"
:label="item.label"
></up-checkbox>
</up-checkbox-group>
</view>
</template>
<script setup>
// 可使用类型dine堂食/pickup自取/deliv配送/express快递
const dinetyps = [
{
value: "dine-in",
label: "堂食",
},
{
value: "take-out",
label: "自取",
},
{
value: "post",
label: "配送",
},
{
value: "take-away",
label: "快递",
},
];
const useType = defineModel({
default: () => [],
type: Array,
});
</script>

View File

@@ -0,0 +1,157 @@
<template>
<view>
<up-radio-group v-model="useType" placement="row">
<up-radio
v-for="item in useTypeList"
:key="item.value"
:name="item.value"
:label="item.label"
></up-radio>
</up-radio-group>
<view class="box" v-if="useType == 'part'" @click.stop="openPopup">
<text class="u-font-28 color-999 u-p-r-16">请选择</text>
<view
class="u-font-24 shop-item u-flex u-p-r-20 u-col-center u-p-r-16"
v-for="(item, index) in selShops"
:key="item.shopId"
>
<text>{{ returnShopName(item) }}</text>
<view @click.stop="delShop(index)">
<up-icon
name="close"
size="14"
@click="delShop(index)"
color="#999"
></up-icon>
</view>
</view>
<view class="icon">
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
</view>
</view>
<up-popup
:show="show"
placement="bottom"
round="18rpx"
closeOnClickOverlay
@close="close"
>
<view class="u-p-30">
<view class="font-bold color-333 u-font-32">选择门店</view>
<scroll-view
class="scroll-view u-m-t-30"
scroll-y="true"
max-height="40vh"
>
<view class="u-m-b-10" v-for="item in list" :key="item.shopId">
<up-checkbox
usedAlone
:name="item.shopId"
:label="item.shopName"
v-model:checked="item.checked"
></up-checkbox>
</view>
</scroll-view>
<view class="u-flex gap-20 u-m-t-30">
<view class="u-flex-1">
<my-button type="default" @click="close">取消</my-button>
</view>
<view class="u-flex-1">
<my-button type="primary" @click="submit">确定</my-button>
</view>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import { onMounted, reactive, ref, watch } from "vue";
import { getShopList } from "@/http/api/shop.js";
const show = ref(false);
const selShops = defineModel("selShops", {
default: () => [],
type: Array,
});
const useType = defineModel("useType", {
default: () => "all",
type: String,
});
const useTypeList = [
{
value: "all",
label: "全部门店",
},
{
value: "part",
label: "指定门店可用",
},
];
function returnShopName(shopId) {
const item = list.value.find((v) => v.shopId == shopId);
return item?.shopName || "";
}
function close() {
show.value = false;
}
function submit() {
selShops.value = list.value
.filter((item) => item.checked)
.map((v) => v.shopId);
show.value = false;
}
function delShop(index) {
selShops.value.splice(index, 1);
}
const list = ref([]);
function openPopup() {
show.value = true;
list.value = list.value.map((item) => ({
shopId: item.shopId,
shopName: item.shopName,
checked: selShops.value.includes(item.shopId),
}));
}
async function init() {
const res = await getShopList();
console.log("selShops.value", selShops.value);
if (res) {
list.value = res.map((item) => ({
shopId: item.shopId,
shopName: item.shopName,
checked: selShops.value.includes(item.shopId),
}));
}
}
onMounted(init);
</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>

View File

@@ -1,7 +1,7 @@
export default {
'JEEPAY_BASE_URL': 'http://192.168.1.31/', // 请求URL生产环境
'JEEPAY_BASE_URL_H5': 'http://192.168.1.31/',
'JEEPAY_BASE_URL_WSS': 'ws://192.168.1.31:2348' ,// sockets
'JEEPAY_BASE_URL': 'http://192.168.1.42/', // 请求URL生产环境
'JEEPAY_BASE_URL_H5': 'http://192.168.1.42/',
'JEEPAY_BASE_URL_WSS': 'ws://192.168.1.42:2348' ,// sockets
// 'JEEPAY_BASE_URL': 'https://cashier.sxczgkj.com/', // 请求URL生产环境
// 'JEEPAY_BASE_URL_H5': 'https://cashier.sxczgkj.com/',
// 'JEEPAY_BASE_URL_WSS': 'wss://czgeatws.sxczgkj.com/wss' // sockets

View File

@@ -0,0 +1,32 @@
import http from "@/http/http.js";
const request = http.request;
const urlType = "market";
export function getList(data) {
return request({
url: `${urlType}/admin/consumeCashback/record`,
method: "GET",
data: {
...data,
},
});
}
export function getConfig(data) {
return request({
url: `${urlType}/admin/consumeCashback`,
method: "GET",
data: {
...data,
},
});
}
export function update(data) {
return request({
url: `${urlType}/admin/consumeCashback`,
method: "POST",
data: {
...data,
},
});
}

View File

@@ -0,0 +1,40 @@
import http from '@/http/http.js'
const request = http.request
const urlType='market'
export function getList(data) {
return request({
url: `${urlType}/admin/discountActivity/page`,
method: "GET",
data: {
...data
}
})
}
export function add(data) {
return request({
url: `${urlType}/admin/discountActivity`,
method: "POST",
data: {
...data
}
})
}
export function update(data) {
return request({
url: `${urlType}/admin/discountActivity`,
method: "PUT",
data: {
...data
}
})
}
export function del(id) {
return request({
url: `${urlType}/admin/discountActivity?id=`+id,
method: "DELETE",
})
}

View File

@@ -0,0 +1,24 @@
import http from '@/http/http.js'
const request = http.request
const urlType='market'
export function getConfig(data) {
return request({
url: `${urlType}/admin/drainageConfig`,
method: "GET",
data: {
...data
}
})
}
export function update(data) {
return request({
url: `${urlType}/admin/drainageConfig`,
method: "POST",
data: {
...data
}
})
}

View File

@@ -56,3 +56,17 @@ export function editShopExtend(data, urlType = 'account') {
}
})
}
/**
* 获取门店列表
* @returns
*/
export function getShopList(data, urlType = 'account') {
return request({
url: `${urlType}/admin/shopInfo/branchList`,
method: "GET",
data: {
...data
}
})
}

View File

@@ -15,7 +15,7 @@ import infoBox from "@/commons/utils/infoBox.js"
import go from '@/commons/utils/go.js';
import { reject } from 'lodash';
// 设置node环境
envConfig.changeEnv(storageManage.env('production'))
envConfig.changeEnv(storageManage.env('development'))
// 测试服
// #ifdef H5

View File

@@ -24,6 +24,11 @@ const app = new Vue({
})
app.$mount()
// #endif
// #ifdef VUE3

View File

@@ -1,36 +1,51 @@
<template>
<view class="boxconstant">
<view class="boxconstantbox"
style="border-radius: 18px 18px 0 0;padding:32rpx 24rpx;border-bottom: 2rpx solid #E5E5E5;">
<view class="boxconstantbox_one">
充值设置
</view>
<view class="boxconstantbox_tow">
<text>用户消费结账时成功充值</text>
<input class="text" type="number" :min='2' v-model="form.rechargeTimes" @change="rechargeTimesInput"/>
<text>倍的金额本单即可享受免单</text>
</view>
</view>
<view class="boxconstantbox" style="border-radius: 0 0 18px 18px;">
<view class="boxconstantbox_one">
充值门槛
</view>
<view class="boxconstantbox_tow">
<text>订单支付金额需满</text>
<input class="text" type="digit" v-model="form.rechargeThreshold" @change="form.rechargeThreshold = $utils.isMoney(form.rechargeThreshold)"></input>
<!-- <input class="text" type="digit" v-model="form.rechargeThreshold" @input="form.rechargeThreshold = 2"></input> -->
<!-- <input class="text" type="digit" v-model.lazy="form.rechargeThreshold" @input="form.rechargeThreshold = $utils.debounce($utils.isMoney(form.rechargeThreshold))"></input> -->
<!-- <input class="text" type="digit" v-model="form.rechargeThreshold" @input="form.rechargeThreshold = $utils.isMoney(form.rechargeThreshold)"></input> -->
<text> 才能使用</text>
</view>
</view>
<view class="oneboxconstant">
<view class="oneboxconstant_one">
功能启用
<view class="boxconstant min-page">
<view class="bg-fff u-flex u-m-b-32 top">
<image style="width: 60rpx;height:60rpx;" src="/pageBwc/static/images/bwc.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">设置充值消费的N倍当前订单立即免单</view>
</view>
<up-switch v-model="form.enable" size="18"></up-switch>
</view>
</view>
<view class="boxconstantbox"
>
<view class="boxconstantbox_one">
充值设置
</view>
<view class="u-flex u-m-t-32">
<input class="number-box" type="number" :min='2' v-model="form.rechargeTimes" @blur="rechargeTimesInput" />
<view class="bei"></view>
</view>
<view class="color-666 u-font-28 u-m-t-16">
用户消费结账时成功充值订单金额的X倍即可享受免单
</view>
<view class="u-m-t-20 u-m-b-20">
<up-line class=""></up-line>
</view>
<view class="boxconstantbox_one">
充值门槛
</view>
<view class="u-flex u-m-t-32">
<input class="number-box" type="number" v-model="form.rechargeThreshold" @blur="rechargeThresholdInput" />
<view class="bei"></view>
</view>
<view class="color-666 u-font-28 u-m-t-16">
订单的支付金额满足X元才能使用
</view>
</view>
<view class="boxconstantbox"
>
<view class="boxconstantbox_one">
可用门店
</view>
<view class="u-m-t-16">
<my-shop-select @shop-select="shopSelect" v-model:selShops="form.shopIdList" v-model:useType="form.useShopType"></my-shop-select>
</view>
</view>
<!-- <view class="boxconstantbox"
style="margin-top:24rpx; padding:32rpx 24rpx; border-radius: 0 0 18px 18px;">
<view class="boxconstantbox_one" style="margin-bottom: 15rpx;">
充值说明
@@ -38,75 +53,149 @@
<view>
<up-textarea v-model="form.rechargeDesc" placeholder="请输入内容"></up-textarea>
</view>
</view> -->
<view class="boxconstantbox">
<view class="boxconstantbox_one">
可使用类型
</view>
<view class="save" @click="editFreeDing">
保存
<view class="u-m-t-16">
<my-dine-types v-model="form.useType"></my-dine-types>
</view>
</view>
<view class="boxconstantbox ">
<view class="u-flex u-col-center u-row-between">
<view>
<view class="color-333 u-font-32 font-bold">与优惠券同享</view>
<view class="color-666 u-font-24 u-m-t-4">不能和优惠券同时使用</view>
</view>
<up-switch v-model="form.withCoupon" size="18"></up-switch>
</view>
<view class="u-flex u-col-center u-row-between u-m-t-24">
<view>
<view class="color-333 u-font-32 font-bold">与积分抵扣同享</view>
<view class="color-666 u-font-24 u-m-t-4">开启后可与积分抵扣同时使用</view>
</view>
<up-switch v-model="form.withPoints" size="18"></up-switch>
</view>
</view>
<my-bottom-btn-group @cancel="cancel" @save="editFreeDing"></my-bottom-btn-group>
</view>
</template>
<script setup>
import { onShow ,onLoad} from '@dcloudio/uni-app';
import { reactive, ref, watch } from 'vue';
import { onShow, onLoad } from "@dcloudio/uni-app";
import { reactive, ref, watch } from "vue";
import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js'
const form = reactive({
import { getFreeDing, updateFreeDing } from "@/http/api/freeDing.js";
const form = reactive({
rechargeTimes: 2,
rechargeThreshold: '',
rechargeThreshold: "",
enable: false,
rechargeDesc: '',
});
onLoad(()=>{
rechargeDesc: "",
useShopType: "all",
useType: [],
shopIdList: [],
withCoupon: false,
withPoints: false,
});
onLoad(() => {
// uni.$utils.inputReg.bind()()
})
onShow(() => {
getlist()
})
/**
});
onShow(() => {
getlist();
});
/**
* 获取配置信息
*/
const getlist = async () => {
let res = await getFreeDing()
Object.assign(form, res)
}
const getlist = async () => {
let res = await getFreeDing();
res.shopIdList = res.shopIdList || [];
Object.assign(form, res);
};
let rechargeTimesInput = (e) => {
if( uni.$utils.isNumber(e.detail.value) == '' || uni.$utils.isNumber(e.detail.value) < 2 ){
let rechargeTimesInput = (e) => {
console.log(e);
if (e.detail.value == "" || e.detail.value < 2) {
form.rechargeTimes = 2;
uni.showToast({
title: "请输入大于等于2的整数",
icon: "none",
});
return;
}
form.rechargeTimes = uni.$utils.isNumber(e.detail.value)
};
function rechargeThresholdInput(e){
if (e.detail.value == "" || e.detail.value <= 0.01) {
form.rechargeThreshold = 0.01;
uni.showToast({
title: "请输入大于0的数字",
icon: "none",
});
return;
}
/**
}
/**
* 修改配置信息
*/
const editFreeDing = async () => {
let res = await updateFreeDing(form)
const editFreeDing = async () => {
if (!form.rechargeTimes) {
uni.showToast({
title: '保存成功'
})
Object.assign(form, res)
setTimeout(() => {
uni.navigateBack()
}, 1500)
title: "请输入充值设置",
icon: "none",
});
return;
}
if (!form.rechargeThreshold) {
uni.showToast({
title: "请输入充值门槛",
icon: "none",
});
return;
}
if (form.useShopType != "all" && !form.shopIdList.length) {
uni.showToast({
title: "请选择可用门店",
icon: "none",
});
return;
}
if (form.useType.length == 0) {
uni.showToast({
title: "请选择可使用类型",
icon: "none",
});
return;
}
let res = await updateFreeDing(form);
uni.showToast({
title: "保存成功",
});
Object.assign(form, res);
setTimeout(() => {
// uni.navigateBack();
}, 1500);
};
function cancel() {
uni.navigateBack();
}
</script>
<style lang="scss" scoped>
page {
background: #F9F9F9;
}
.boxconstant {
.boxconstant {
background: #f7f7f7;
padding: 32rpx 28rpx;
.boxconstantbox {
padding: 32rpx 24rpx;
border-radius: 16rpx;
margin-top: 32rpx;
width: 100%;
background: #FFFFFF;
background: #ffffff;
.boxconstantbox_one {
font-family: Source Han Sans CN, Source Han Sans CN;
@@ -126,15 +215,15 @@
// flex-wrap: wrap;
// align-content: flex-start;
.text {
display:inline-flex;
display: inline-flex;
text-align: center;
margin: 0 12rpx;
width: 118rpx;
height: 48rpx;
line-height: 48rpx;
background: #FFFFFF;
background: #ffffff;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #E5E5E5;
border: 2rpx solid #e5e5e5;
}
}
}
@@ -142,7 +231,7 @@
.oneboxconstant {
margin-top: 32rpx;
width: 100%;
background: #FFFFFF;
background: #ffffff;
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
justify-content: space-between;
@@ -156,21 +245,48 @@
font-size: 28rpx;
color: #333333;
}
}
.save {
margin: 100rpx auto 50rpx auto;
width: 530rpx;
height: 80rpx;
background: #318AFE;
background: #318afe;
border-radius: 56rpx 56rpx 56rpx 56rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
color: #ffffff;
line-height: 80rpx;
text-align: center;
}
}
}
.top {
padding: 24rpx 20rpx 28rpx 28rpx;
}
.number-box {
width: 260rpx;
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: 70rpx;
line-height: 70rpx;
}
.bei {
display: flex;
padding: 0 38rpx;
height: 70rpx;
line-height: 70rpx;
align-items: center;
border-radius: 0 6rpx 6rpx 0;
border: 2rpx solid #d9d9d9;
background: #f7f7fa;
font-size: 28rpx;
color: #999999;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,49 @@
<template>
<view>
<up-action-sheet
:round="14"
:actions="list"
:title="title"
:show="show"
closeOnClickAction
cancelText="取消"
@close="close"
@select="sheetSelect"
></up-action-sheet>
</view>
</template>
<script setup >
import { ref, reactive, onMounted } from "vue";
import { getShopList } from "@/http/api/shop.js";
const props = defineProps({
title: {
type: String,
default: "请选择",
},
});
const list = ref([]);
const show=defineModel({
name: "show",
default: false,
})
function close() {
show.value = false;
}
const emit=defineEmits(["choose"]);
function sheetSelect(e) {
console.log(e);
emit("choose", e);
}
onMounted(() => {
getShopList().then((res) => {
list.value = res.map((v) => ({
...v,
value: v.shopId,
name: v.shopName,
}));
});
});
</script>

View File

@@ -0,0 +1,331 @@
<template>
<view class="box">
<view class="bg-fff container u-flex u-m-b-32 top">
<image
style="width: 60rpx; height: 60rpx"
src="/pageMarket/static/images/cost.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="form.isEnable"
size="18"
:active-value="1"
:inactive-value="0"
></up-switch>
</view>
</view>
<view class="u-m-t-32 container">
<view class="u-flex u-row-between u-m-b-16">
<text class="font-bold color-333">可用门店</text>
</view>
<my-shop-select
v-model:selShops="form.shopIdList"
v-model:useType="form.useType"
></my-shop-select>
</view>
<view class="u-m-t-32 container">
<view class="u-flex u-row-between">
<text class="font-bold color-333 u-m-b-16">适用用户</text>
</view>
<userTypes v-model="form.applicableUser"></userTypes>
</view>
<view class="u-m-t-32 container">
<view class="u-flex u-row-between">
<text class="font-bold color-333">返现类型</text>
</view>
<view class="u-m-t-16">
<up-radio-group v-model="form.cashbackType" placement="row">
<up-radio
v-for="item in cashbackTypes"
:key="item.value"
:name="item.value"
:label="item.label"
>
<template #label>
<text>
{{ item.label }}
</text>
</template>
</up-radio>
</up-radio-group>
</view>
<view class="u-flex u-row-between u-m-t-32">
<text class="font-bold color-333">阶梯设置</text>
</view>
<view
class="u-m-t-32 u-flex u-row-between gap-40"
v-for="(item, index) in form.cashbackStepList"
:key="index"
>
<view class="u-flex u-col-top">
<view class="no-wrap u-m-r-16 u-m-t-14">{{ returnName(index) }}</view>
<view class="u-flex-1">
<view class="u-flex">
<text class="u-m-r-24"> 返现门槛</text>
<input
class="my-input"
type="digit"
v-model="item.amount"
placeholder=""
/>
<text class="text-tips text-tips1"></text>
</view>
<view class="u-flex u-m-t-24">
<text class="u-m-r-24"> 返现比例</text>
<input
class="my-input"
type="number"
v-model="item.cashbackAmount"
@blur="inputBlur($event, index)"
:max="form.cashbackType === 'percentage' ? 100 : 999999"
placeholder=""
/>
<text class="text-tips text-tips1">{{ returnUnit }} </text>
<text class="color-red u-m-l-10" @click="deleteThreshold(index)"
>删除</text
>
</view>
</view>
</view>
</view>
<button class="add u-m-t-32" @click="addcashbackStepList">添加</button>
</view>
<my-bottom-btn-group @save="save" @cancel="cancel"></my-bottom-btn-group>
</view>
</template>
<script setup>
import { reactive, computed, onMounted } from "vue";
import userTypes from "./user-types.vue";
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
import {
onLoad,
onReady,
onShow,
onPageScroll,
onReachBottom,
onBackPress,
} from "@dcloudio/uni-app";
//返现类型
const cashbackTypes = [
{
value: "percentage",
label: "按比例返现",
},
{
value: "fix",
label: "固定金额",
},
];
const form = reactive({
isEnable: 0,
cashbackStepList: [],
shopIdList: [],
useType: "all",
applicableUser: "all",
cashbackType: "percentage",
});
function addcashbackStepList() {
form.cashbackStepList.push({
amount: 0,
cashbackAmount: 0,
});
}
function inputBlur(e, index) {
const value = e.detail.value;
if (form.cashbackType === "percentage") {
if (e.detail.value >= 100) {
form.cashbackStepList[index].cashbackAmount = 100;
} else if (e.detail.value < 0) {
form.cashbackStepList[index].cashbackAmount = 0;
} else {
form.cashbackStepList[index].cashbackAmount =e.detail.value;
}
} else {
if (e.detail.value < 0) {
form.cashbackStepList[index].cashbackAmount = 0;
} else if(e.detail.value > form.cashbackStepList[index].amount) {
form.cashbackStepList[index].cashbackAmount = form.cashbackStepList[index].amount;
} else {
form.cashbackStepList[index].cashbackAmount =e.detail.value;
}
}
}
async function save() {
console.log(form);
const submitData = {
...form,
};
const res = await consumeCashbackApi.update(submitData);
uni.showToast({
title: "更新成功",
icon: "none",
duration: 2000,
success: function () {},
});
}
function cancel() {
uni.navigateBack();
}
function deleteThreshold(index) {
form.cashbackStepList.splice(index, 1);
}
function setForm(data) {
data.cashbackStepList=data.cashbackStepList||[]
Object.assign(form, data);
console.log(form);
}
const returnUnit = computed(() => {
return form.cashbackType === "percentage" ? "%" : "元";
});
const numChineseMap = {
0: "零",
1: "一",
2: "二",
3: "三",
4: "四",
5: "五",
6: "六",
7: "七",
8: "八",
9: "九",
10: "十",
100: "百",
1000: "千",
};
// 辅助函数:将数字转换为中文数字
function numberToChinese(n) {
if (n < 10) {
return numChineseMap[n];
}
// 处理10-99
if (n < 100) {
const ten = Math.floor(n / 10);
const unit = n % 10;
if (ten === 1) {
return unit === 0 ? "十" : `${numChineseMap[unit]}`;
} else {
return unit === 0
? `${numChineseMap[ten]}`
: `${numChineseMap[ten]}${numChineseMap[unit]}`;
}
}
// 处理100-999
if (n < 1000) {
const hundred = Math.floor(n / 100);
const remainder = n % 100;
if (remainder === 0) {
return `${numChineseMap[hundred]}`;
} else {
return `${numChineseMap[hundred]}${
remainder < 10 ? "零" : ""
}${numberToChinese(remainder)}`;
}
}
// 处理1000-9999
if (n < 10000) {
const thousand = Math.floor(n / 1000);
const remainder = n % 1000;
if (remainder === 0) {
return `${numChineseMap[thousand]}`;
} else {
return `${numChineseMap[thousand]}${
remainder < 100 ? "零" : ""
}${numberToChinese(remainder)}`;
}
}
// 更大的数字可以继续扩展(如万、亿等),这里以千为单位示例
return n.toString(); // 超过范围时返回数字本身(可根据需求扩展)
}
// 主函数:根据索引返回对应的组名
function returnName(index) {
const groupNumber = index + 1; // 索引从0开始组号从1开始
const chineseNumber = numberToChinese(groupNumber);
return `${chineseNumber}`;
}
async function getData() {
const res = await consumeCashbackApi.getConfig();
if (res) {
setForm(res);
}
}
onMounted(() => {
getData();
});
</script>
<style lang="scss" scoped>
page {
background: #f7f7f7;
}
.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;
}
</style>

View 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>

View File

@@ -0,0 +1,213 @@
<template>
<view class="min-page">
<up-sticky>
<view class="bg-fff top">
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
<view class="u-flex u-m-t-40" v-if="active == 1">
<view class="u-flex color-333" @click="showShopSelActionSheetFun">
<text class="u-line-1" style="max-width: 300rpx;">{{selShop.shopName || "全部门店"}}</text>
<up-icon name="arrow-down-fill" size="12" color="#333"></up-icon>
</view>
<view class="u-flex-1 u-p-l-16">
<up-search bgColor="#F9F9F9" height="60rpx" :showAction="false" placeholder="搜索订单号"
@search="search" @clear="search" v-model="searchText"></up-search>
</view>
</view>
</view>
</up-sticky>
<configVue v-if="active == 0"></configVue>
<view class="list u-font-28" v-if="active == 1">
<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-999 u-font-24">
<view> 关联订单:{{ item.orderNo }} </view>
<view class="u-m-t-14">
<text class="color-333 font-bold"> {{ item.shopName }}</text>
<text class="color-666 u-font-24">{{ item.createTime }}</text>
</view>
</view>
<text class="color-999 u-font-24"> ID:{{ item.id }} </text>
</view>
<view class="u-m-t-22">
<u-line></u-line>
</view>
<view class="color-333 u-flex u-row-between u-font-28" style="margin-top: 52rpx">
<view>
<view class="color-666">用户昵称</view>
<view class="color-333 u-m-t-24 u-line-1">{{ item.nickName }}</view>
</view>
<view class="u-flex u-text-center">
<view>
<view class="color-666">返现金额</view>
<view class="color-333 u-m-t-24">{{ item.cashbackAmount ||0 }}</view>
</view>
<view style="margin-left: 54rpx;">
<view class="color-666">支付金额</view>
<view class="color-333 u-m-t-24">{{ item.amount || 0 }}</view>
</view>
</view>
</view>
<view style="height: 32rpx;"></view>
</view>
<view class="u-p-30">
<up-loadmore :status="isEnd ? 'nomore' : 'loading'"></up-loadmore>
</view>
</view>
<!-- 选择门店 -->
<shopSelActionSheetVue @choose="chooseShop" v-model="showShopSelActionSheet" title="选择门店">
</shopSelActionSheetVue>
</view>
</template>
<script setup>
import {
onLoad,
onReady,
onShow,
onPageScroll,
onReachBottom,
onBackPress,
} from "@dcloudio/uni-app";
import {
ref,
onMounted,
watch
} from "vue";
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
import configVue from './components/config.vue'
import shopSelActionSheetVue from '@/pageMarket/components/shop-sel-action-sheet.vue'
const tabs = [{
label: "基本设置",
value: "basic"
},
{
label: "返现明细",
value: "recoders"
},
];
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();
})
async function getList() {
const res = await consumeCashbackApi.getList({
pageNum: pageNum.value,
pageSize: 10,
shopId: selShop.value.shopId,
key: searchText.value,
});
if (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) => {
console.log(newval);
pageNum.value = 1;
getList();
}
);
onReachBottom(() => {
if (!isEnd.value) {
pageNum.value++;
getList();
}
});
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;
}
</style>

View File

@@ -0,0 +1,349 @@
<template>
<view class="box min-page">
<view class="container ">
<view class="u-flex u-row-between">
<text class="font-bold color-333">满减优惠</text>
<button class="add" @click="addThresholds">添加</button>
</view>
<view
class="u-m-t-32 u-flex u-row-between gap-40"
v-for="(item, index) in form.thresholds"
:key="index"
>
<view class="u-flex u-flex-1">
<text class="text-tips"></text>
<input
class="my-input"
type="number"
v-model="item.fullAmount"
@blur="checkFullAmount(index)"
placeholder=""
/>
<text class="text-tips text-tips1"></text>
</view>
<view class="u-flex u-flex-1">
<text class="text-tips"></text>
<input
class="my-input"
type="number"
v-model="item.discountAmount"
@blur="checkDiscountAmount(index)"
placeholder=""
/>
<text class="text-tips text-tips1"></text>
</view>
<text class="color-red" @click="deleteThreshold(index)">删除</text>
</view>
</view>
<view class="container" style="padding-left: 0; padding-right: 0">
<view class="x-padding">
<view class="u-flex u-row-between u-m-b-32">
<text class="font-bold color-333">活动日期</text>
</view>
<timeArea
v-model:startDate="form.validStartTime"
v-model:endDate="form.validEndTime"
></timeArea>
</view>
<view class="u-m-t-32">
<up-line ></up-line>
</view>
<view class="u-m-t-32 x-padding">
<view class="u-flex u-row-between">
<text class="font-bold color-333 u-m-b-32">可用周期</text>
</view>
<weekSel v-model="form.useDays"></weekSel>
</view>
</view>
<view class="u-m-t-32 container">
<view class="u-flex u-row-between">
<text class="font-bold color-333 u-m-b-32">指定时间段</text>
</view>
<hourSel
v-model:useTimeType="form.useTimeType"
v-model:startValue="form.useStartTime"
v-model:endValue="form.useEndTime"
></hourSel>
</view>
<view class="u-m-t-32 container">
<view class="u-flex u-row-between">
<text class="font-bold color-333 u-m-b-32">可使用类型</text>
</view>
<my-dine-types v-model="form.useType"></my-dine-types>
</view>
<view class="u-m-t-32 container">
<view class="u-flex u-row-between">
<text class="font-bold color-333 u-m-r-38">排序值</text>
<up-input type="number" v-model="form.sort" placeholder="默认值0" />
</view>
<view class="u-m-t-16 color-red u-font-24"
>数值越大排序越靠前重复时段下按照排序值最高的活动减免</view
>
</view>
<view class="container">
<view class="u-flex u-col-center u-row-between">
<view>
<view class="color-333 u-font-28 font-bold">与优惠券同享</view>
<view class="color-666 u-font-24 u-m-t-16">不能和优惠券同时使用</view>
</view>
<up-switch
:activeValue="1"
:inactiveValue="0"
v-model="form.couponShare"
size="18"
></up-switch>
</view>
<view class="u-flex u-m-t-32 u-col-center u-row-between">
<view>
<view class="color-333 u-font-28 font-bold">与限时折扣同享</view>
<view class="color-666 u-font-24 u-m-t-16"
>开启后计算门槛时将会按照折扣价计算</view
>
</view>
<up-switch
:activeValue="1"
:inactiveValue="0"
v-model="form.discountShare"
size="18"
></up-switch>
</view>
<view class="u-flex u-m-t-32 u-col-center u-row-between">
<view>
<view class="color-333 u-font-28 font-bold"
>与会员价/会员折扣同享</view
>
<view class="color-666 u-font-24 u-m-t-16"
>开启后计算门槛时将会按照会员价/会员折扣价计算</view
>
</view>
<up-switch
:activeValue="1"
:inactiveValue="0"
v-model="form.vipPriceShare"
size="18"
></up-switch>
</view>
<view class="u-flex u-m-t-32 u-col-center u-row-between">
<view>
<view class="color-333 u-font-28 font-bold">与积分 抵扣同享</view>
<view class="color-666 u-font-24 u-m-t-16"
>开启后可和积分抵扣同时使用</view
>
</view>
<up-switch
:activeValue="1"
:inactiveValue="0"
v-model="form.pointsShare"
size="18"
></up-switch>
</view>
</view>
<bottomBtnGroup @save="save" @cancel="cancel"></bottomBtnGroup>
</view>
</template>
<script setup>
import timeArea from "./components/time-area.vue";
import weekSel from "./components/week-sel.vue";
import hourSel from "./components/hour-area.vue";
import bottomBtnGroup from "./components/bottom-btn-group.vue";
import { reactive } from "vue";
import * as discountActivityApi from "@/http/api/market/discountActivity.js";
import {
onLoad,
onReady,
onShow,
onPageScroll,
onReachBottom,
onBackPress,
} from "@dcloudio/uni-app";
const form = reactive({
thresholds: [],
validStartTime: "",
validEndTime: "",
useDays: ['周一','周二','周三','周四','周五','周六','周日'],
useTimeType: "all",
useStartTime: "",
useEndTime: "",
useType: [],
sort: 0,
couponShare: 0,
discountShare: 0,
vipPriceShare: 0,
pointsShare: 0,
});
function addThresholds() {
form.thresholds.push({
fullAmount: 0,
discountAmount: 0,
});
}
function checkFullAmount(index){
if(form.thresholds[index].fullAmount<=0){
form.thresholds[index].fullAmount = 0;
}
console.log(form.thresholds[index].fullAmount);
}
function checkDiscountAmount(index){
const { fullAmount, discountAmount } = form.thresholds[index];
if(discountAmount<=0){
form.thresholds[index].discountAmount = 0;
}
if(discountAmount>=fullAmount){
form.thresholds[index].discountAmount = fullAmount;
}
}
async function save() {
console.log(form);
const submitData = {
...form,
useDays: form.useDays.join(","),
useType: form.useType.join(","),
validStartTime:form.validStartTime,
validEndTime:form.validEndTime
// validStartTime:'',
// validEndTime:'',
};
if(!submitData.thresholds.length){
uni.showToast({
title: "请添加门槛",
icon: "none",
duration: 2000,
});
return
}
if(!submitData.useDays.length){
uni.showToast({
title: "请选择可使用的周几",
icon: "none",
duration: 2000,
});
return
}
if(!submitData.useTimeType){
uni.showToast({
title: "请选择可使用的时间类型",
icon: "none",
duration: 2000,
});
return
}
if(!submitData.validStartTime || !submitData.validEndTime){
uni.showToast({
title: "请选择活动日期",
icon: "none",
duration: 2000,
});
return
}
if(submitData.useTimeType!='all'){
if(!submitData.useStartTime || !submitData.useEndTime){
uni.showToast({
title: "请选择可使用的时间",
icon: "none",
duration: 2000,
});
return
}
}
const res = !form.id
? await discountActivityApi.add(submitData)
:await discountActivityApi.update(submitData);
uni.showToast({
title: submitData.id ? "更新成功" : "添加成功",
icon: "none",
duration: 2000,
success: function () {
setTimeout(() => {
uni.navigateBack();
}, 2000);
},
});
}
function cancel() {
uni.navigateBack();
}
function deleteThreshold(index) {
form.thresholds.splice(index, 1);
}
function setForm(data) {
data.useDays = data.useDays.split(",");
data.useType = data.useType.split(",");
data.validStartTime = data.validStartTime.split(" ")[0];
data.validEndTime = data.validEndTime.split(" ")[0];
Object.assign(form, data);
console.log(form);
}
onLoad((opt) => {
if(!opt.id){
return
}
const data = uni.getStorageSync("discountActivity");
if (data) {
setForm(data);
}
});
</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-left: none;
border-right: none;
flex: 1;
text-align: center;
padding: 0 2px;
font-size: 14px;
}
.box {
padding: 32rpx 28rpx 0 28rpx;
font-size: 28rpx;
background: #f7f7f7;
}
.container {
background: #fff;
padding: 32rpx 24rpx;
margin-top: 32rpx;
border-radius: 16rpx;
overflow: hidden;
}
.add {
padding: 0 32rpx;
border-radius: 60rpx;
background: #318afe;
color: #ffffff;
font-size: 28rpx;
line-height: 56rpx;
margin: 0;
}
.color-red {
color: #ff2f2f;
}
</style>

View File

@@ -0,0 +1,29 @@
<template>
<view>
<view style="height: 180rpx"></view>
<view class="fixed-bottom u-flex gap-20">
<view class="u-flex-1">
<my-button type="primary" @click="save" shape="circle">
保存
</my-button>
</view>
<view class="u-flex-1">
<my-button bgColor="#fff" type="default" @click="cancel" shape="circle">
取消
</my-button>
</view>
</view>
</view>
</template>
<script setup>
const emit= defineEmits(["save", "cancel"]);
function save() {
emit("save");
}
function cancel() {
emit("cancel");
}
</script>

View File

@@ -0,0 +1,111 @@
<template>
<view >
<up-radio-group v-model="useTimeType" placement="row">
<up-radio
v-for="item in useTimeTypeList"
:key="item.value"
:value="item.value"
:name="item.value"
:label="item.label"
></up-radio>
</up-radio-group>
<view class="u-flex u-m-t-30 box" v-if="useTimeType=='custom'">
<view class="u-flex u-flex-1">
<view class="item " @click="pirckerShow(startValue, 'startValue')">
<text class="u-m-r-12" v-if="!startValue">开始时间</text>
<text class="u-m-r-12" v-else>{{ startValue }}</text>
</view>
<view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx;"></view>
<view class="item " @click="pirckerShow(endValue, 'endValue')">
<text class="u-m-r-12" v-if="!endValue">结束时间</text>
<text class="u-m-r-12" v-else>{{ endValue }}</text>
</view>
</view>
<up-icon name="clock"></up-icon>
</view>
<up-datetime-picker
:show="show"
v-model="value1"
closeOnClickOverlay
@close="close"
@cancel="close"
@confirm="confirm"
mode="time"
></up-datetime-picker>
</view>
</template>
<script setup>
import { computed, ref } from "vue";
const useTimeType = defineModel("useTimeType", {
type: String,
default: "all",
});
const useTimeTypeList = [
{
value: "all",
label: "全时段可用",
},
{
value: "custom",
label: "指定时间段可用",
},
];
import dayjs from "dayjs";
const startValue = defineModel("startValue", {
type: String,
default: "",
});
const endValue = defineModel("endValue", {
type: String,
default: "",
});
function close() {
show.value = false;
}
const value1 = ref('');
const show = ref(false);
const nowKey = ref("");
function pirckerShow(date, key) {
nowKey.value = key;
show.value = true;
value1.value = date||''
}
function confirm(e) {
console.log(e);
if (nowKey.value == "startValue") {
startValue.value=e.value
} else if (nowKey.value == "endValue") {
endValue.value = e.value;
}
value1.value = e.value;
show.value = false;
}
</script>
<style lang="scss" scoped>
.item {
font-size: 28rpx;
color: #666;
line-height: 48rpx;
padding: 0 12rpx;
display: flex;
}
.box{
border: 2rpx solid #dddfe6;
padding: 16rpx 30rpx;
box-sizing: border-box;
width: 564rpx;
border-radius: 4rpx;
overflow: hidden;
}
</style>

View File

@@ -0,0 +1,79 @@
<template>
<view>
<view class="u-flex">
<view class="item" @click="pirckerShow(startDate, 'startDate')">
<text class="u-m-r-12" v-if="!startDate">请选择日期范围</text>
<text class="u-m-r-12" v-else>{{ startDate }}</text>
<up-icon name="arrow-down" size="14"></up-icon>
</view>
<view class="u-m-l-8 u-m-r-8"></view>
<view class="item" @click="pirckerShow(endDate, 'endDate')">
<text class="u-m-r-12" v-if="!endDate">请选择日期范围</text>
<text class="u-m-r-12" v-else>{{ endDate }}</text>
<up-icon name="arrow-down" size="14"></up-icon>
</view>
</view>
<up-datetime-picker
:show="show"
v-model="value1"
closeOnClickOverlay
@close="close"
@cancel="close"
@confirm="confirm"
mode="date"
></up-datetime-picker>
</view>
</template>
<script setup>
import { computed, ref } from "vue";
import dayjs from "dayjs";
const startDate = defineModel("startDate", {
type: String,
default: "",
});
const endDate = defineModel("endDate", {
type: String,
default: "",
});
const minDate = ref(0);
const maxDate = ref(dayjs().add(80, "year").valueOf());
function close() {
show.value = false;
}
const value1 = ref(Date.now());
const show = ref(false);
const nowKey = ref("");
function pirckerShow(date, key) {
nowKey.value = key;
console.log(date);
show.value = true;
}
function confirm(e) {
console.log(e);
if (nowKey.value == "startDate") {
startDate.value = dayjs(e.value).format("YYYY-MM-DD");
} else if (nowKey.value == "endDate") {
endDate.value = dayjs(e.value).format("YYYY-MM-DD");
}
value1.value = e.value
show.value = false;
}
</script>
<style lang="scss" scoped>
.item {
font-size: 28rpx;
color: #666;
line-height: 64rpx;
border: 2rpx solid #dddfe6;
padding: 0 12rpx;
display: flex;
}
</style>

View File

@@ -0,0 +1,57 @@
<template>
<view>
<up-checkbox-group v-model="selectedWeek" :options="week">
<up-checkbox
:customStyle="customStyle"
v-for="item in week"
:key="item.value"
:value="item.value"
:name="item.value"
:label="item.value"
>{{ item.name }}</up-checkbox>
</up-checkbox-group>
</view>
</template>
<script setup>
import { ref } from "vue";
const customStyle={
marginRight: '40rpx',
marginBottom: '16rpx',
}
const selectedWeek=defineModel({
type: Array,
default: () => [],
});
const week = ref([
{
name: "周一",
value:"周一",
},
{
name: "周二",
value:"周二",
},
{
name: "周三",
value:"周三",
},
{
name: "周四",
value:"周四",
},
{
name: "周五",
value:"周五",
},
{
name: "周六",
value:"周六",
},
{
name: "周日",
value:"周日",
},
]);
</script>

View File

@@ -0,0 +1,197 @@
<template>
<view class="box min-page">
<view class="top">
<my-button type="primary" height="72" @click="toAdd"
>添加满减活动</my-button
>
</view>
<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-999 u-font-24">
<text> ID:{{ item.id }} </text>
<text class="u-m-l-24"> 优先级:{{ item.sort }} </text>
</view>
<view class="tag success">进行中</view>
</view>
<view class="coor-333 font-bold u-m-t-16"
>活动日期{{ returnActivityDate(item) }}</view
>
<view class="u-font-24 color-666 u-m-t-16 u-flex u-row-between">
<text class="no-wrap"> {{ returnActivityWeek(item) }}</text>
<text class="no-wrap"> {{ returnCanUseTime(item) }}</text>
</view>
<view class="u-m-t-26">
<u-line ></u-line>
</view>
<view class="color-333 u-m-t-24">
<view>活动内容</view>
<view>{{ returnActivityContent(item) }}</view>
</view>
<view class="u-flex u-row-right u-m-t-26" style="gap: 16rpx">
<button class="my-btn edit-btn" @click="toEdit(item)">编辑</button>
<button
class="my-btn delete-btn"
@click="deleteDiscountActivity(item)"
>
删除
</button>
</view>
</view>
<view class="u-p-30">
<up-loadmore :status="isEnd ? 'nomore' : 'loading'"></up-loadmore>
</view>
</view>
</view>
</template>
<script setup>
import {
onLoad,
onReady,
onShow,
onPageScroll,
onReachBottom,
onBackPress,
} from "@dcloudio/uni-app";
import { ref, onMounted } from "vue";
import * as discountActivityApi from "@/http/api/market/discountActivity.js";
import { is } from "immutable";
const list = ref([]);
const pageNum = ref(1);
const isEnd = ref(false);
async function getList() {
const res = await discountActivityApi.getList({
pageNum: pageNum.value,
pageSize: 10,
});
if (res) {
if( pageNum.value==1){
list.value = res.records || [];
}else{
list.value = [...list.value, ...res.records || []];
}
isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false;
console.log(isEnd.value);
}
}
function returnActivityDate(item) {
return `${item.validStartTime.split(" ")[0]}${
item.validEndTime.split(" ")[0]
}`;
}
function returnActivityWeek(item) {
if (!item.useDays.length) {
return "每天都不可用";
}
return "每" + item.useDays.replaceAll(",", "、");
}
function returnCanUseTime(item) {
if (item.useTimeType != "all") {
return `${item.useStartTime}${item.useEndTime}`;
} else {
return "全天可用";
}
}
function returnActivityContent(item) {
return item.thresholds
.map((cur) => {
return `${cur.fullAmount}${cur.discountAmount}`;
}, "")
.join("、");
}
function toAdd() {
clearDiscountActivity();
uni.navigateTo({
url: "/pageMarket/discountActivity/add",
});
}
function clearDiscountActivity() {
uni.removeStorageSync("discountActivity");
}
function toEdit(item) {
uni.setStorageSync("discountActivity", { ...item });
uni.navigateTo({
url: "/pageMarket/discountActivity/add?id=" + item.id,
});
}
function deleteDiscountActivity(item) {
uni.showModal({
title: "确认删除",
content: `是否确认删除?`,
success: async (res) => {
console.log(res);
if (res.confirm) {
const res = await discountActivityApi.del(item.id);
uni.showToast({
title: "删除成功",
icon: "none",
duration: 2000,
success: function () {
getList();
},
});
}
},
});
}
onReachBottom(() => {
if (!isEnd.value) {
pageNum.value++;
getList();
}
});
onShow(() => {
pageNum.value = 1;
getList();
});
</script>
<style lang="scss" scoped>
.box {
padding: 0 30rpx;
background: #f7f7f7;
}
.top {
margin-top: 18rpx;
}
.list {
.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;
}
</style>

View File

@@ -0,0 +1,366 @@
<template>
<view class="boxconstant min-page">
<view class="bg-fff u-flex u-m-b-32 top">
<image
style="width: 60rpx; height: 60rpx"
src="/pageMarket/static/images/cost.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="form.isEnable"
size="18"
:active-value="1"
:inactive-value="0"
></up-switch>
</view>
</view>
<view class="boxconstantbox">
<view class="boxconstantbox_one"> 可使用类型 </view>
<view class="u-m-t-16">
<my-dine-types v-model="form.useType"></my-dine-types>
</view>
</view>
<view class="boxconstantbox" style="padding: 32rpx 0">
<view class="u-flex u-row-between x-padding">
<view class="boxconstantbox_one"> 群二维码</view>
<button class="upload" @click="uploadImage">上传</button>
</view>
<view class="u-m-t-24 u-flex u-row-center">
<view class="code" @click="uploadImage">
<up-icon
name="plus"
v-if="!form.qrCode"
size="20"
color="#999"
></up-icon>
<image
v-else
style="width: 260rpx; height: 260rpx"
:src="form.qrCode"
mode="scaleToFill"
/>
</view>
</view>
<view class="u-m-t-32">
<up-line ></up-line>
</view>
<view class="u-m-t-32 u-font-28 x-padding">
<view class="boxconstantbox_one u-m-b-24"> 模块标题 </view>
<up-input
placeholderClass="u-font-28"
v-model="form.title"
:maxlength="20"
placeholder="请输入模块标题"
></up-input>
</view>
<view class="u-m-t-32">
<up-line ></up-line>
</view>
<view class="u-m-t-32 u-font-28 x-padding">
<view class="boxconstantbox_one u-m-b-24"> 模块提示语</view>
<up-input
placeholderClass="u-font-28"
v-model="form.note"
:maxlength="20"
placeholder="请输入模块提示语"
></up-input>
</view>
<view class="u-m-t-32">
<up-line ></up-line>
</view>
<view class="u-m-t-32 u-font-28 x-padding">
<view class="boxconstantbox_one u-m-b-24"> 模块内容</view>
<up-textarea
type="textarea"
:maxlength="50"
placeholderClass="u-font-28"
v-model="form.content"
placeholder="请输入模块内容"
></up-textarea>
</view>
<view class="u-m-t-32">
<up-line ></up-line>
</view>
<view class="x-padding u-m-t-32">
<button class="preview" @click="showPreview = true">预览</button>
</view>
</view>
<up-popup
:show="showPreview"
mode="center"
round="16rpx"
closeOnClickOverlay
@close="showPreview = false"
:safeAreaInsetBottom="false"
>
<view class="preview-box">
<view class="u-flex" style="align-items: stretch">
<view
class="u-flex-1 u-p-r-24 u-flex u-flex-col"
style="align-items: start; justify-content: space-between"
>
<view>
<view class="u-font-28 font-bold color-333">{{
form.title
}}</view>
<view class="u-m-t-16 u-font-24 color-666">{{
form.content
}}</view>
</view>
<view class="color-999 u-font-24 u-m-t-16">{{ form.note }}</view>
</view>
<image
:src="form.qrCode"
style="width: 240rpx; height: 240rpx"
mode="scaleToFill"
></image>
</view>
</view>
</up-popup>
<my-bottom-btn-group
@cancel="cancel"
@save="editFreeDing"
></my-bottom-btn-group>
</view>
</template>
<script setup>
import { onShow, onLoad } from "@dcloudio/uni-app";
import { reactive, ref, watch } from "vue";
import { uploadFile } from "@/http/api/index.js";
import { getConfig, update } from "@/http/api/market/drainageConfig.js";
const showPreview = ref(false);
const form = reactive({
content: "",
isEnable: 0,
note: "长按识别,微信内扫一扫加好友",
qrCode: "",
title: "扫码进取,优惠多多",
useType: [],
});
onLoad(() => {
// uni.$utils.inputReg.bind()()
});
onShow(() => {
getlist();
});
/**
* 获取配置信息
*/
const getlist = async () => {
let res = await getConfig();
res.useType = res.useType || [];
res.note=res.note||"长按识别,微信内扫一扫加好友"
res.title=res.title||"扫码进取,优惠多多"
Object.assign(form, res);
};
/**
* 修改配置信息
*/
const editFreeDing = async () => {
if(form.useType.length == 0){
return uni.showToast({
icon: "none",
title: "请选择可使用类型",
});
}
if (!form.qrCode) {
return uni.showToast({
icon: "none",
title: "请上传群二维码",
});
}
if (!form.title) {
return uni.showToast({
icon: "none",
title: "请输入模块标题",
});
}
let res = await update(form);
uni.showToast({
title: "保存成功",
});
Object.assign(form, res);
setTimeout(() => {
uni.navigateBack();
}, 1500);
};
function uploadImage() {
uni.chooseImage({
count: 1,
success: (res) => {
console.log(res);
uploadFile(res.tempFiles[0]).then((res) => {
if (res) {
form.qrCode = res;
} else {
uni.showToast({
icon: "none",
title: "上传失败",
});
}
});
},
});
}
function cancel() {
uni.navigateBack();
}
</script>
<style lang="scss" scoped>
.x-padding {
padding-left: 28rpx;
padding-right: 28rpx;
}
.boxconstant {
padding: 32rpx 28rpx;
background: #f7f7f7;
.boxconstantbox {
padding: 32rpx 24rpx;
border-radius: 16rpx;
margin-top: 32rpx;
width: 100%;
background: #ffffff;
.boxconstantbox_one {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.boxconstantbox_tow {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
// display: flex;
// justify-content: flex-start;
// align-items: center;
// flex-wrap: wrap;
// align-content: flex-start;
.text {
display: inline-flex;
text-align: center;
margin: 0 12rpx;
width: 118rpx;
height: 48rpx;
line-height: 48rpx;
background: #ffffff;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #e5e5e5;
}
}
}
.oneboxconstant {
margin-top: 32rpx;
width: 100%;
background: #ffffff;
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
padding: 32rpx 24rpx;
.oneboxconstant_one {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
.save {
margin: 100rpx auto 50rpx auto;
width: 530rpx;
height: 80rpx;
background: #318afe;
border-radius: 56rpx 56rpx 56rpx 56rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #ffffff;
line-height: 80rpx;
text-align: center;
}
}
.top {
padding: 24rpx 20rpx 28rpx 28rpx;
}
.number-box {
width: 260rpx;
font-size: 28rpx;
padding: 10rpx 26rpx;
border-radius: 6rpx 0 0 6rpx;
border-top: 2rpx solid #d9d9d9;
border-bottom: 2rpx solid #d9d9d9;
border-left: 2rpx solid #d9d9d9;
background: #fff;
}
.bei {
display: flex;
padding: 10rpx 38rpx;
align-items: center;
border-radius: 0 6rpx 6rpx 0;
border: 2rpx solid #d9d9d9;
background: #f7f7fa;
font-size: 28rpx;
color: #999999;
}
.upload {
padding: 8rpx 32rpx;
border-radius: 60rpx;
background: $my-main-color;
font-size: 28rpx;
color: #ffffff;
line-height: 40rpx;
margin: 0;
}
.code {
display: flex;
width: 264rpx;
height: 264rpx;
padding: 108rpx;
justify-content: center;
align-items: center;
gap: 20rpx;
border: 3rpx dashed #d9d9d9;
background: #fff;
padding: 2rpx;
}
.preview {
padding: 8rpx 32rpx;
border-radius: 12rpx;
background: $my-main-color;
color: #ffffff;
font-size: 28rpx;
font-weight: 400;
line-height: 40rpx;
}
.preview-box {
width: 700rpx;
padding: 32rpx 28rpx;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

View File

@@ -590,6 +590,39 @@
"navigationBarTitleText": "查看明细"
}
}]
},
{
"root": "pageMarket",
"pages": [{
"pageId": "PAGES_MARKET_DISCOUNT_ACTIVITY",
"path": "discountActivity/index",
"style": {
"navigationBarTitleText": "满减活动"
}
},
{
"pageId": "PAGES_MARKET_DISCOUNT_ACTIVITY_ADD",
"path": "discountActivity/add",
"style": {
"navigationBarTitleText": "满减活动"
}
},
{
"pageId": "PAGES_MARKET_DRAINAGE_CONFIG",
"path": "drainageConfig/index",
"style": {
"navigationBarTitleText": "私域引流"
}
},
{
"pageId": "PAGES_MARKET_CONSUME_CASHBACK",
"path": "consumeCashback/index",
"style": {
"navigationBarTitleText": "消费返现"
}
}
]
}
],

View File

@@ -63,7 +63,24 @@
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_ORDER_INDEX'
},
{
title: '满减活动',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_MARKET_DISCOUNT_ACTIVITY'
},
{
title: '私域引流',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_MARKET_DRAINAGE_CONFIG'
},
{
title: '消费返现',
icon: '/static/indexImg/icon-order.svg',
pageUrl: 'PAGES_MARKET_CONSUME_CASHBACK'
},
];
console.log(menusStore.adminPages);
const computedMenus = computed(() => {
const arr = menusStore.adminPages.filter(v => {
return navList.find(navItem => navItem.title == v.title)

View File

@@ -153,8 +153,8 @@
})
// #ifdef H5
vdata.formData.username = '17792050546'
vdata.formData.pwd = 'qwer1234'
vdata.formData.username = ''
vdata.formData.pwd = ''
// #endif
// #ifdef MP-WEIXIN
// vdata.formData.username = '15699991111'

View File

@@ -9,7 +9,7 @@ export default defineConfig({
proxy: {
'/api': {
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
target: 'http://192.168.1.31/', // 目标服务器地址
target: 'http://192.168.1.42/', // 目标服务器地址
changeOrigin: true, // 是否更改请求源
rewrite: path => path.replace(/^\/api/, '')
}