代码合并冲突解决
This commit is contained in:
commit
3f860e4733
|
|
@ -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>
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -1,157 +1,130 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<up-radio-group v-model="useType" placement="row">
|
<up-radio-group v-model="useType" placement="row">
|
||||||
<up-radio
|
<up-radio v-for="item in useTypeList" :key="item.value" :name="item.value" :label="item.label" :customStyle="customStyle"></up-radio>
|
||||||
v-for="item in useTypeList"
|
</up-radio-group>
|
||||||
:key="item.value"
|
<view class="box" v-if="useType == 'part'" @click.stop="openPopup">
|
||||||
:name="item.value"
|
<text class="u-font-28 color-999 u-p-r-16" v-if="selShops.length == 0">请选择</text>
|
||||||
:label="item.label"
|
<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">
|
||||||
></up-radio>
|
<text>{{ returnShopName(item) }}</text>
|
||||||
</up-radio-group>
|
<view @click.stop="delShop(index)">
|
||||||
<view class="box" v-if="useType == 'part'" @click.stop="openPopup">
|
<up-icon name="close" size="14" @click="delShop(index)" color="#999"></up-icon>
|
||||||
<text class="u-font-28 color-999 u-p-r-16">请选择</text>
|
</view>
|
||||||
<view
|
</view>
|
||||||
class="u-font-24 shop-item u-flex u-p-r-20 u-col-center u-p-r-16"
|
<view class="icon">
|
||||||
v-for="(item, index) in selShops"
|
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||||
:key="item.shopId"
|
</view>
|
||||||
>
|
</view>
|
||||||
<text>{{ returnShopName(item) }}</text>
|
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||||
<view @click.stop="delShop(index)">
|
<view class="u-p-30">
|
||||||
<up-icon
|
<view class="font-bold color-333 u-font-32">选择门店</view>
|
||||||
name="close"
|
<scroll-view class="scroll-view u-m-t-30" scroll-y="true" max-height="40vh">
|
||||||
size="14"
|
<view class="u-m-b-10" v-for="item in list" :key="item.shopId">
|
||||||
@click="delShop(index)"
|
<up-checkbox usedAlone :name="item.shopId" :label="item.shopName" v-model:checked="item.checked"></up-checkbox>
|
||||||
color="#999"
|
</view>
|
||||||
></up-icon>
|
</scroll-view>
|
||||||
</view>
|
<view class="u-flex gap-20 u-m-t-30">
|
||||||
</view>
|
<view class="u-flex-1">
|
||||||
<view class="icon">
|
<my-button type="default" @click="close">取消</my-button>
|
||||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
</view>
|
||||||
</view>
|
<view class="u-flex-1">
|
||||||
</view>
|
<my-button type="primary" @click="submit">确定</my-button>
|
||||||
|
</view>
|
||||||
<up-popup
|
</view>
|
||||||
:show="show"
|
</view>
|
||||||
placement="bottom"
|
</up-popup>
|
||||||
round="18rpx"
|
</view>
|
||||||
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>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref, watch } from "vue";
|
import { onMounted, reactive, ref, watch } from 'vue';
|
||||||
import { getShopList } from "@/http/api/shop.js";
|
import { getShopList } from '@/http/api/shop.js';
|
||||||
|
|
||||||
|
const customStyle = ref({
|
||||||
|
marginRight: '20px'
|
||||||
|
});
|
||||||
|
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const selShops = defineModel("selShops", {
|
const selShops = defineModel('selShops', {
|
||||||
default: () => [],
|
default: () => [],
|
||||||
type: Array,
|
type: Array
|
||||||
});
|
});
|
||||||
const useType = defineModel("useType", {
|
const useType = defineModel('useType', {
|
||||||
default: () => "all",
|
default: () => 'all',
|
||||||
type: String,
|
type: String
|
||||||
});
|
});
|
||||||
const useTypeList = [
|
const useTypeList = [
|
||||||
{
|
{
|
||||||
value: "all",
|
value: 'all',
|
||||||
label: "全部门店",
|
label: '全部门店'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "part",
|
value: 'part',
|
||||||
label: "指定门店可用",
|
label: '指定门店可用'
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
function returnShopName(shopId) {
|
function returnShopName(shopId) {
|
||||||
const item = list.value.find((v) => v.shopId == shopId);
|
const item = list.value.find((v) => v.shopId == shopId);
|
||||||
return item?.shopName || "";
|
return item?.shopName || '';
|
||||||
}
|
}
|
||||||
function close() {
|
function close() {
|
||||||
show.value = false;
|
show.value = false;
|
||||||
}
|
}
|
||||||
function submit() {
|
function submit() {
|
||||||
selShops.value = list.value
|
selShops.value = list.value.filter((item) => item.checked).map((v) => v.shopId);
|
||||||
.filter((item) => item.checked)
|
show.value = false;
|
||||||
.map((v) => v.shopId);
|
|
||||||
show.value = false;
|
|
||||||
}
|
}
|
||||||
function delShop(index) {
|
function delShop(index) {
|
||||||
selShops.value.splice(index, 1);
|
selShops.value.splice(index, 1);
|
||||||
}
|
}
|
||||||
const list = ref([]);
|
const list = ref([]);
|
||||||
|
|
||||||
function openPopup() {
|
function openPopup() {
|
||||||
show.value = true;
|
show.value = true;
|
||||||
list.value = list.value.map((item) => ({
|
list.value = list.value.map((item) => ({
|
||||||
shopId: item.shopId,
|
shopId: item.shopId,
|
||||||
shopName: item.shopName,
|
shopName: item.shopName,
|
||||||
checked: selShops.value.includes(item.shopId),
|
checked: selShops.value.includes(item.shopId)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
async function init() {
|
async function init() {
|
||||||
const res = await getShopList();
|
const res = await getShopList();
|
||||||
console.log("selShops.value", selShops.value);
|
console.log('selShops.value', selShops.value);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
list.value = res.map((item) => ({
|
list.value = res.map((item) => ({
|
||||||
shopId: item.shopId,
|
shopId: item.shopId,
|
||||||
shopName: item.shopName,
|
shopName: item.shopName,
|
||||||
checked: selShops.value.includes(item.shopId),
|
checked: selShops.value.includes(item.shopId)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(init);
|
onMounted(init);
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.box {
|
.box {
|
||||||
margin-top: 16rpx;
|
border-radius: 8upx;
|
||||||
display: flex;
|
margin-top: 16rpx;
|
||||||
flex-direction: row;
|
display: flex;
|
||||||
align-items: top;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
align-items: top;
|
||||||
padding: 10rpx 24rpx;
|
flex-wrap: wrap;
|
||||||
border: 2rpx solid #e5e5e5;
|
padding: 10rpx 24rpx;
|
||||||
position: relative;
|
border: 2rpx solid #e5e5e5;
|
||||||
.icon {
|
position: relative;
|
||||||
position: absolute;
|
.icon {
|
||||||
top: 50%;
|
position: absolute;
|
||||||
right: 24rpx;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
right: 24rpx;
|
||||||
}
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.shop-item {
|
.shop-item {
|
||||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||||
border-radius: 4rpx;
|
border-radius: 4rpx;
|
||||||
border: 2rpx solid #f0f0f0;
|
border: 2rpx solid #f0f0f0;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
margin-left: 16rpx;
|
margin-left: 16rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="fixed-btn" id="fixedBtn">
|
<view class="fixed-wrap" :style="{ '--num': showCancel ? '63px' : '0px' }">
|
||||||
<div class="btn">
|
<view class="fixed-btn" id="targetRef">
|
||||||
<u-button type="primary" :shape="shape" size="large">添加</u-button>
|
<div class="btn">
|
||||||
</div>
|
<u-button type="primary" :shape="shape" size="large" @click="emits('confirm')">{{ confirmText }}</u-button>
|
||||||
<div class="btn" v-if="showCancel">
|
</div>
|
||||||
<u-button shape="circle" size="large">取消</u-button>
|
<div class="btn" v-if="showCancel">
|
||||||
</div>
|
<u-button :shape="shape" size="large" @click="emits('cancel')">取消</u-button>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick } from 'vue';
|
import { ref, onMounted, nextTick, getCurrentInstance } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
confirmText: {
|
confirmText: {
|
||||||
|
|
@ -27,38 +29,27 @@ const props = defineProps({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emits = defineEmits(['load']);
|
const emits = defineEmits(['confirm', 'cancel']);
|
||||||
|
|
||||||
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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.fixed-btn {
|
.fixed-wrap {
|
||||||
|
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
height: var(--height);
|
||||||
bottom: 0;
|
.fixed-btn {
|
||||||
left: 0;
|
width: 100%;
|
||||||
display: flex;
|
height: var(--height);
|
||||||
gap: 20upx;
|
position: fixed;
|
||||||
flex-direction: column;
|
bottom: 0;
|
||||||
padding: 20upx 28upx calc(40upx + env(safe-area-inset-bottom) / 2) 20upx;
|
left: 0;
|
||||||
background-color: #fff;
|
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
||||||
.btn {
|
background-color: #fff;
|
||||||
flex: 1;
|
.btn {
|
||||||
|
&:first-child {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<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="list">
|
||||||
<view class="item" v-for="item in tableData.list" :key="item.id">
|
<view class="item" v-for="item in tableData.list" :key="item.id">
|
||||||
<view class="head">
|
<view class="head">
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-loadmore :status="tableData.status"></u-loadmore>
|
<u-loadmore :status="tableData.status"></u-loadmore>
|
||||||
<FooterBtn />
|
<my-footer-btn @confirm="go.to('PAGES_LIMIT_DISCOUNT_ADD')"></my-footer-btn>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -42,12 +42,7 @@ import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
import HeaderCard from '../components/HeaderCard.vue';
|
import HeaderCard from '../components/HeaderCard.vue';
|
||||||
import FooterBtn from '../components/FooterBtn.vue';
|
import FooterBtn from '../components/FooterBtn.vue';
|
||||||
import { limitTimeDiscountPage } from '@/http/api/market/index.js';
|
import { limitTimeDiscountPage } from '@/http/api/market/index.js';
|
||||||
|
import go from '@/commons/utils/go.js';
|
||||||
// 标题的高度
|
|
||||||
const headHeight = ref(0);
|
|
||||||
function headLoad(e) {
|
|
||||||
headHeight.value = e.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除限时折扣
|
// 删除限时折扣
|
||||||
function delHandle(item) {
|
function delHandle(item) {
|
||||||
|
|
|
||||||
|
|
@ -636,7 +636,13 @@
|
||||||
"pageId": "PAGES_MARKET_DISTRIBUTION_INDEX",
|
"pageId": "PAGES_MARKET_DISTRIBUTION_INDEX",
|
||||||
"path": "distribution/index",
|
"path": "distribution/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "分销"
|
"navigationBarTitleText": "分销"}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_LIMIT_DISCOUNT_ADD",
|
||||||
|
"path": "limitDiscount/add",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加限时折扣"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue