代码合并冲突解决

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

View File

@ -0,0 +1,55 @@
<template>
<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, getCurrentInstance } from 'vue';
const props = defineProps({
confirmText: {
type: String,
default: '添加'
},
showCancel: {
type: Boolean,
default: false
},
shape: {
type: String,
default: 'squre' // squre circle
}
});
const emits = defineEmits(['confirm', 'cancel']);
</script>
<style scoped lang="scss">
.fixed-wrap {
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
width: 100%;
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,98 @@
<template>
<view class="item-doc" :style="{ height: headHeight + 'px' }">
<view class="item" :style="{ height: headHeight + 'px' }">
<view class="left">
<image :src="`/static/applocation/${options.icon}.png`" mode="aspectFit" class="icon"></image>
<view class="info">
<view class="title">
<text class="t">{{ options.name }}</text>
</view>
<view class="intro">
<text class="t">{{ options.intro }}</text>
</view>
</view>
</view>
<view class="right" v-if="showSwitch">
<u-switch :active-value="1" :inactive-value="0" v-model="isOpen" @change="defineEmits(['update:isOpen'])"></u-switch>
</view>
</view>
</view>
</template>
<script setup>
import { ref, onMounted, nextTick } from 'vue';
const props = defineProps({
options: {
type: Object,
default: {
name: '标题',
intro: '说明',
icon: 'xszk'
}
},
showSwitch: {
type: Boolean,
default: false
}
});
const headHeight = ref(70);
const isOpen = defineModel('isOpen', {
type: [Boolean, String, Number],
default: 0
});
const emits = defineEmits(['load']);
onMounted(() => {
nextTick(() => {
emits('load', { height: headHeight.value });
});
});
</script>
<style scoped lang="scss">
.item-doc {
width: 100%;
}
.item {
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 99;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
padding: 20upx 28upx;
.left {
display: flex;
.icon {
$size: 80upx;
width: $size;
height: $size;
flex-shrink: 0;
}
.info {
display: flex;
padding-left: 20upx;
flex-direction: column;
.title {
.t {
font-size: 28upx;
font-weight: bold;
}
}
.intro {
.t {
font-size: 28upx;
color: #999;
}
}
}
}
}
</style>

View File

@ -0,0 +1,134 @@
<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" :customStyle="customStyle"></up-radio>
</up-radio-group>
<view class="box" v-if="useType == 'custom'" @click.stop="openPopup">
<text class="u-font-28 color-999 u-p-r-16" v-if="selShops.length == 0">请选择</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 customStyle = ref({
marginRight: '15px'
});
const show = ref(false);
const selShops = defineModel('selShops', {
default: () => [],
type: [Array, String]
});
const useType = defineModel('useType', {
default: () => 'only',
type: String
});
const useTypeList = [
{
value: 'only',
label: '仅本店'
},
{
value: 'all',
label: '全部门店'
},
{
value: 'custom',
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 {
border-radius: 8upx;
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,56 +1,26 @@
<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 v-for="item in useTypeList" :key="item.value" :name="item.value" :label="item.label" :customStyle="customStyle"></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 class="u-font-28 color-999 u-p-r-16" v-if="selShops.length == 0">请选择</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>
<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"
>
<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"
>
<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>
<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">
@ -66,40 +36,42 @@
</view>
</template>
<script setup>
import { onMounted, reactive, ref, watch } from "vue";
import { getShopList } from "@/http/api/shop.js";
import { onMounted, reactive, ref, watch } from 'vue';
import { getShopList } from '@/http/api/shop.js';
const customStyle = ref({
marginRight: '20px'
});
const show = ref(false);
const selShops = defineModel("selShops", {
const selShops = defineModel('selShops', {
default: () => [],
type: Array,
type: Array
});
const useType = defineModel("useType", {
default: () => "all",
type: String,
const useType = defineModel('useType', {
default: () => 'all',
type: String
});
const useTypeList = [
{
value: "all",
label: "全部门店",
value: 'all',
label: '全部门店'
},
{
value: "part",
label: "指定门店可用",
},
value: 'part',
label: '指定门店可用'
}
];
function returnShopName(shopId) {
const item = list.value.find((v) => v.shopId == shopId);
return item?.shopName || "";
return item?.shopName || '';
}
function close() {
show.value = false;
}
function submit() {
selShops.value = list.value
.filter((item) => item.checked)
.map((v) => v.shopId);
selShops.value = list.value.filter((item) => item.checked).map((v) => v.shopId);
show.value = false;
}
function delShop(index) {
@ -112,18 +84,18 @@ function openPopup() {
list.value = list.value.map((item) => ({
shopId: item.shopId,
shopName: item.shopName,
checked: selShops.value.includes(item.shopId),
checked: selShops.value.includes(item.shopId)
}));
}
async function init() {
const res = await getShopList();
console.log("selShops.value", selShops.value);
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),
checked: selShops.value.includes(item.shopId)
}));
}
}
@ -131,6 +103,7 @@ onMounted(init);
</script>
<style lang="scss">
.box {
border-radius: 8upx;
margin-top: 16rpx;
display: flex;
flex-direction: row;

View File

@ -0,0 +1,22 @@
<template>
<u-radio-group v-model="modelValue" @change="defineEmits(['update:modelValue'])">
<u-radio label="仅本店" name="only" :customStyle="customStyle"></u-radio>
<u-radio label="全部" name="all" :customStyle="customStyle"></u-radio>
<u-radio label="指定" name="custom" :customStyle="customStyle"></u-radio>
</u-radio-group>
</template>
<script setup>
import { ref } from 'vue';
const customStyle = ref({
marginRight: '20px'
});
const modelValue = defineModel('modelValue', {
type: String,
default: 'only'
});
</script>
<style></style>

View File

@ -1,16 +1,18 @@
<template>
<view class="fixed-btn" id="fixedBtn">
<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">添加</u-button>
<u-button type="primary" :shape="shape" size="large" @click="emits('confirm')">{{ confirmText }}</u-button>
</div>
<div class="btn" v-if="showCancel">
<u-button shape="circle" size="large">取消</u-button>
<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') // refref#refref
.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%;
height: var(--height);
.fixed-btn {
width: 100%;
height: var(--height);
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;
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
background-color: #fff;
.btn {
flex: 1;
&: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: '' // 123 -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) {

View File

@ -636,7 +636,13 @@
"pageId": "PAGES_MARKET_DISTRIBUTION_INDEX",
"path": "distribution/index",
"style": {
"navigationBarTitleText": "分销"
"navigationBarTitleText": "分销"}
},
{
"pageId": "PAGES_LIMIT_DISCOUNT_ADD",
"path": "limitDiscount/add",
"style": {
"navigationBarTitleText": "添加限时折扣"
}
}
]