代码合并冲突解决

This commit is contained in:
2025-11-19 11:31:09 +08:00
9 changed files with 529 additions and 170 deletions

View File

@@ -1,16 +1,18 @@
<template>
<view class="fixed-btn" id="fixedBtn">
<div class="btn">
<u-button type="primary" :shape="shape" size="large">添加</u-button>
</div>
<div class="btn" v-if="showCancel">
<u-button shape="circle" size="large">取消</u-button>
</div>
<view class="fixed-wrap" :style="{ '--num': showCancel ? '63px' : '0px' }">
<view class="fixed-btn" id="targetRef">
<div class="btn">
<u-button type="primary" :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>
<script setup>
import { ref, onMounted, nextTick } from 'vue';
import { ref, onMounted, nextTick, getCurrentInstance } from 'vue';
const props = defineProps({
confirmText: {
@@ -27,38 +29,27 @@ const props = defineProps({
}
});
const emits = defineEmits(['load']);
function load() {
const query = uni.createSelectorQuery().in(this);
query
.selectComponent('#fixedBtn') // 若用ref需注意ref是字符串时这里用#ref值ref是变量时需其他方式
.boundingClientRect((data) => {
console.log('组件内元素高度:', data?.height);
})
.exec();
}
onMounted(() => {
nextTick(() => {
load();
});
});
const emits = defineEmits(['confirm', 'cancel']);
</script>
<style scoped lang="scss">
.fixed-btn {
.fixed-wrap {
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
width: 100%;
position: fixed;
bottom: 0;
left: 0;
display: flex;
gap: 20upx;
flex-direction: column;
padding: 20upx 28upx calc(40upx + env(safe-area-inset-bottom) / 2) 20upx;
background-color: #fff;
.btn {
flex: 1;
height: var(--height);
.fixed-btn {
width: 100%;
height: var(--height);
position: fixed;
bottom: 0;
left: 0;
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
background-color: #fff;
.btn {
&:first-child {
margin-bottom: 14px;
}
}
}
}
</style>

View File

@@ -0,0 +1,85 @@
<template>
<view class="container">
<u-form label-position="top" labelWidth="100" :model="form" :rules="rules" ref="formRef">
<view class="card">
<u-form-item label="活动名称" prop="title">
<u-input placeholder="请输入活动名称" v-model="form.title" border="bottom" :customStyle="inputStyle"></u-input>
</u-form-item>
<u-form-item label="可用门店" prop="useShops">
<my-shop-select-w v-model:useType="form.useShopType" v-model:selShops="form.useShops"></my-shop-select-w>
</u-form-item>
</view>
<view class="card">
<u-form-item label="活动日期" prop="validStartTime"></u-form-item>
</view>
</u-form>
<my-footer-btn confirmText="保存" @confirm="submitHandle"></my-footer-btn>
</view>
</template>
<script setup>
import { ref } from 'vue';
import FooterBtn from '../components/FooterBtn.vue';
const inputStyle = ref({
paddingLeft: 0
});
const formRef = ref(null);
const form = ref({
id: '',
shopId: '',
title: '', // 活动名称
useShopType: 'only', // only-仅本店 all全部 /custom 指定
useShops: '', // 可用门店
validStartTime: '', // 有效期开始时间
validEndTime: '', // 有效期结束时间
useDays: '', // 周一,周二,周三,周四,周五,周六,周日
useTimeType: '', // all-全时段custom-指定时段
useStartTime: '', // 可用开始时间
useEndTime: '', // 可用结束时间
useType: '', // 堂食 dine-in 外带 take-out 外卖 take-away 配送 post
discountRate: '', // 折扣% 范围1-99
sort: '', // 数字越小级别越高
discountPriority: '', // 折扣优先级 限时折扣优先limit-time/会员价优先vip-price
foodType: '', // 1全部 2部分
foods: '', // 参与商品
status: '' // 1未开始2进行中3已结束 -1当前时间不可用
});
const rules = ref({
title: {
type: 'string',
required: true,
message: '请输入活动名称',
trigger: ['blur']
}
});
function submitHandle() {
formRef.value
.validate()
.then((res) => {
console.log('通过了', res);
})
.catch((err) => {});
}
</script>
<style>
page {
background-color: #f7f7f7;
}
</style>
<style scoped lang="scss">
.container {
padding: 28upx;
}
.card {
background-color: #fff;
border-radius: 20upx;
padding: 0 28upx 14upx;
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<view class="container">
<HeaderCard :options="{ name: '限时折扣', intro: '批量设置商品折扣', icon: 'xszk' }" @load="headLoad" />
<my-header-card :options="{ name: '限时折扣', intro: '批量设置商品折扣', icon: 'xszk' }"></my-header-card>
<view class="list">
<view class="item" v-for="item in tableData.list" :key="item.id">
<view class="head">
@@ -32,7 +32,7 @@
</view>
</view>
<u-loadmore :status="tableData.status"></u-loadmore>
<FooterBtn />
<my-footer-btn @confirm="go.to('PAGES_LIMIT_DISCOUNT_ADD')"></my-footer-btn>
</view>
</template>
@@ -42,12 +42,7 @@ import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import HeaderCard from '../components/HeaderCard.vue';
import FooterBtn from '../components/FooterBtn.vue';
import { limitTimeDiscountPage } from '@/http/api/market/index.js';
// 标题的高度
const headHeight = ref(0);
function headLoad(e) {
headHeight.value = e.height;
}
import go from '@/commons/utils/go.js';
// 删除限时折扣
function delHandle(item) {