update
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||
<template #desc>
|
||||
<view class="u-m-t-48 tab">
|
||||
<my-tabs :list="tabs" @change="tabsChange"></my-tabs>
|
||||
</view>
|
||||
<view class="u-text-left u-p-30 ">
|
||||
<template v-if="!current">
|
||||
<view>
|
||||
@@ -33,8 +30,7 @@
|
||||
<view class="u-m-t-24 border discount u-relative u-flex input-box">
|
||||
<view class="u-flex-1">
|
||||
<input @input="discountMoneyInput" v-model="form.discountMoney" type="digit"
|
||||
placeholder-class="placeholder-class" placeholder="减8.55元请输入8.55" />
|
||||
|
||||
placeholder-class="placeholder-class" placeholder="请输入最终优惠金额" />
|
||||
</view>
|
||||
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
|
||||
<view>元</view>
|
||||
@@ -46,19 +42,22 @@
|
||||
</view>
|
||||
</template>
|
||||
<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-font-24">
|
||||
<text class="color-999">当前单品价格:{{price}}</text>
|
||||
</view>
|
||||
<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"
|
||||
<button @tap="changeCauses(item,index)" 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>
|
||||
<uni-easyinput type="textarea" v-model="form.note" placeholder="自定义内容"></uni-easyinput>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -67,7 +66,10 @@
|
||||
<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 style="height: 20rpx;">
|
||||
|
||||
</view>
|
||||
<!-- <my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -75,18 +77,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { reactive, nextTick, ref, watch } 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({
|
||||
price: {
|
||||
type: [Number,String],
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
title: {
|
||||
@@ -99,12 +96,6 @@
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
function changeCauses(item) {
|
||||
item.checked = !item.checked
|
||||
}
|
||||
|
||||
const discounts = [95, 90, 85, 80]
|
||||
const causes = reactive([{
|
||||
name: '顾客投诉质量问题',
|
||||
@@ -120,6 +111,11 @@
|
||||
}
|
||||
])
|
||||
|
||||
function changeCauses(item, index) {
|
||||
item.checked = !item.checked
|
||||
form.notes = causes
|
||||
}
|
||||
|
||||
function discountInput(e) {
|
||||
if (e.detail.value >= 100) {
|
||||
nextTick(() => {
|
||||
@@ -127,8 +123,9 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function discountMoneyInput(e) {
|
||||
const max=100
|
||||
const max = 100
|
||||
if (e.detail.value >= max) {
|
||||
nextTick(() => {
|
||||
form.discountMoney = 100
|
||||
@@ -142,7 +139,7 @@
|
||||
|
||||
|
||||
const tabs = ['打折', '减免']
|
||||
let current = ref(0)
|
||||
let current = ref(1)
|
||||
|
||||
function tabsChange(i) {
|
||||
console.log(i);
|
||||
@@ -158,11 +155,11 @@
|
||||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
watch(() => props.price, (newval) => {
|
||||
form.price = newval
|
||||
form.currentPrice = newval
|
||||
})
|
||||
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
@@ -182,22 +179,23 @@
|
||||
|
||||
function confirm() {
|
||||
const {
|
||||
discount,discountMoney
|
||||
discount,
|
||||
discountMoney
|
||||
} = form
|
||||
if (current.value===0&& discount==='') {
|
||||
if (current.value === 0 && discount === '') {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入有效折扣!'
|
||||
})
|
||||
}
|
||||
if (current.value===1&& discountMoney==='') {
|
||||
if (current.value === 1 && discountMoney === '') {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入有效减免价格!'
|
||||
})
|
||||
}
|
||||
close()
|
||||
emits('confirm', form)
|
||||
close()
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
|
||||
131
pagesCreateOrder/confirm-order/components/pack-number.vue
Normal file
131
pagesCreateOrder/confirm-order/components/pack-number.vue
Normal file
@@ -0,0 +1,131 @@
|
||||
<template>
|
||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||
<template #desc>
|
||||
<view class="u-text-left u-p-l-30 u-p-r-30 u-p-t-30 ">
|
||||
<view class="u-m-t-32 u-flex ">
|
||||
<uni-easyinput type="number" v-model="form.pack_number" placeholder="打包数量"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template #btn>
|
||||
<view class="u-p-l-30 u-p-r-30 u-m-t-28 u-p-b-30">
|
||||
<view class="">
|
||||
<my-button @tap="confirm" shape="circle" fontWeight="700">确认</my-button>
|
||||
<view class="u-m-t-10">
|
||||
<my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</my-model>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, nextTick, ref } from 'vue';
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
const $form = {
|
||||
pack_number: 1
|
||||
}
|
||||
const form = reactive({
|
||||
number: null,
|
||||
...$form
|
||||
})
|
||||
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
})
|
||||
}
|
||||
|
||||
const model = ref(null)
|
||||
|
||||
function open(data) {
|
||||
console.log(data)
|
||||
form.number = data.number
|
||||
model.value.open()
|
||||
}
|
||||
|
||||
function close() {
|
||||
model.value.close()
|
||||
}
|
||||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
const { pack_number } = form
|
||||
if( pack_number > form.number){
|
||||
uni.showToast({
|
||||
title: '打包数量不能大于菜品数量',
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
}
|
||||
emits('confirm', pack_number)
|
||||
close()
|
||||
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.lh34{
|
||||
line-height: 34rpx;
|
||||
}
|
||||
.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>
|
||||
@@ -99,8 +99,7 @@
|
||||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
const {remark
|
||||
} = form
|
||||
const { remark } = form
|
||||
emits('confirm', {
|
||||
remark
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user