197 lines
3.4 KiB
Vue
197 lines
3.4 KiB
Vue
<template>
|
|
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
|
<template #desc>
|
|
<view class="u-text-left u-p-30 ">
|
|
<view style="transform: scale(1.5);transform-origin:left;">
|
|
<uni-number-box :min="1" :max="1" :value="form.number" @change="changeValue" :width="300" />
|
|
</view>
|
|
<view class="u-m-t-48">
|
|
<view class="u-font-24">
|
|
<text class="color-999">赠菜原因</text>
|
|
<text class="color-red">*</text>
|
|
</view>
|
|
<view class="u-flex u-m-t-24">
|
|
<view class="u-flex" v-for="(item,index) in causes" :key="index">
|
|
<button @tap="changeCauses(item)" class="tag u-m-r-20"
|
|
:class="{active:item.checked}">{{item.name}}</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="u-m-t-32 u-flex ">
|
|
<uni-easyinput type="textarea" v-model="value" placeholder="自定义内容"></uni-easyinput>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
<template #btn>
|
|
<view class="u-p-30">
|
|
<view class="u-m-t-10">
|
|
<my-button @tap="confirm" shape="circle" showShadow>确认</my-button>
|
|
<my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</my-model>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
reactive,
|
|
nextTick,
|
|
ref
|
|
} from 'vue';
|
|
import myModel from '@/components/my-components/my-model.vue'
|
|
import myButton from '@/components/my-components/my-button.vue'
|
|
import myTabs from '@/components/my-components/my-tabs.vue'
|
|
const props = defineProps({
|
|
title: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
data: {
|
|
type: Array,
|
|
default: []
|
|
}
|
|
})
|
|
|
|
function changeCauses(item) {
|
|
item.checked = !item.checked
|
|
}
|
|
|
|
const discounts = [95, 90, 85, 80]
|
|
const causes = reactive([{
|
|
name: '顾客投诉质量问题',
|
|
checked: false
|
|
},
|
|
{
|
|
name: '友情打折',
|
|
checked: false
|
|
},
|
|
{
|
|
name: '临时活动',
|
|
checked: false
|
|
}
|
|
])
|
|
|
|
function discountInput(e) {
|
|
if (e.detail.value >= 100) {
|
|
nextTick(() => {
|
|
form.discount = 100
|
|
})
|
|
}
|
|
}
|
|
function discountMoneyInput(e) {
|
|
const max=100
|
|
if (e.detail.value >= max) {
|
|
nextTick(() => {
|
|
form.discountMoney = 100
|
|
})
|
|
}
|
|
}
|
|
|
|
function setForm(key, val) {
|
|
form[key] = val
|
|
}
|
|
|
|
|
|
const tabs = ['打折', '减免']
|
|
let current = ref(0)
|
|
|
|
function tabsChange(i) {
|
|
console.log(i);
|
|
current.value = i
|
|
}
|
|
|
|
const $form = {
|
|
number:1
|
|
}
|
|
function changeValue(e){
|
|
form.number=e
|
|
}
|
|
const form = reactive({
|
|
...$form
|
|
})
|
|
|
|
function resetForm() {
|
|
Object.assign(form, {
|
|
...$form
|
|
})
|
|
}
|
|
|
|
const model = ref(null)
|
|
|
|
function open() {
|
|
model.value.open()
|
|
}
|
|
|
|
function close() {
|
|
model.value.close()
|
|
}
|
|
const emits = defineEmits(['confirm'])
|
|
|
|
function confirm() {
|
|
const {number
|
|
} = form
|
|
close()
|
|
emits('confirm', {
|
|
name,
|
|
price
|
|
})
|
|
}
|
|
defineExpose({
|
|
open,
|
|
close
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.tag {
|
|
background-color: #fff;
|
|
border: 1px solid #E5E5E5;
|
|
line-height: inherit;
|
|
font-size: 24rpx;
|
|
color: #666666;
|
|
padding: 6rpx 20rpx;
|
|
border-radius: 8rpx;
|
|
|
|
&.active {
|
|
border-color: #E6F0FF;
|
|
color: $my-main-color;
|
|
}
|
|
}
|
|
|
|
.hover-class {
|
|
background-color: #E5E5E5;
|
|
}
|
|
|
|
.discount {
|
|
.u-absolute {
|
|
top: 0;
|
|
bottom: 0;
|
|
right: 0;
|
|
}
|
|
}
|
|
|
|
.bg1 {
|
|
background: #F7F7FA;
|
|
}
|
|
|
|
.tab {
|
|
padding: 0 80rpx;
|
|
}
|
|
|
|
.border {
|
|
border: 1px solid #E5E5E5;
|
|
border-radius: 4rpx;
|
|
}
|
|
|
|
.input-box {
|
|
padding: 22rpx 32rpx;
|
|
font-size: 28rpx;
|
|
color: #666;
|
|
}
|
|
|
|
.placeholder-class {
|
|
font-size: 28rpx;
|
|
}
|
|
</style> |