增加临时菜页面
This commit is contained in:
parent
704fee1e2d
commit
3935ec7960
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="min-page bg-gray u-p-30">
|
<view class="min-page bg-gray u-p-30 u-font-28">
|
||||||
<view class="u-font-24">
|
<view class="u-font-24">
|
||||||
<text class="color-red">*</text>
|
<text class="color-red">*</text>
|
||||||
<text class="color-999">将临时菜添加至购物车,不会影响总商品库</text>
|
<text class="color-999">将临时菜添加至购物车,不会影响总商品库</text>
|
||||||
|
|
@ -14,20 +14,20 @@
|
||||||
<text class="color-red">*</text>
|
<text class="color-red">*</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<view class="border-bottom u-p-t-10 u-p-b-10">
|
<view class="border-bottom ">
|
||||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.name"
|
<uni-easyinput :inputBorder="false" paddingNone v-model="form.name"
|
||||||
placeholder="填写菜品名称"></uni-easyinput>
|
placeholder="填写菜品名称"></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item required label="" name="category">
|
<uni-forms-item required label="" name="category">
|
||||||
<template #label>
|
<template #label>
|
||||||
<view class="u-text-left u-m-t-24">
|
<view class="u-text-left ">
|
||||||
<text class="color-333">菜品分类</text>
|
<text class="color-333">菜品分类</text>
|
||||||
<text class="color-red">*</text>
|
<text class="color-red">*</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<picker @change="categoryChange" :value="categoryCurrent" range-key="name" :range="category">
|
<picker @change="categoryChange" :value="categoryCurrent" range-key="name" :range="category">
|
||||||
<view class="u-m-t-14 u-p-t-10 u-flex u-row-between border-bottom u-p-b-10 u-relative ">
|
<view class=" u-flex u-row-between border-bottom u-relative ">
|
||||||
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
||||||
<!-- <view>
|
<!-- <view>
|
||||||
<text class="" v-if="form.category!==''">{{category[form.category].name}}</text>
|
<text class="" v-if="form.category!==''">{{category[form.category].name}}</text>
|
||||||
|
|
@ -46,25 +46,25 @@
|
||||||
|
|
||||||
<uni-forms-item required label="" name="price">
|
<uni-forms-item required label="" name="price">
|
||||||
<template #label>
|
<template #label>
|
||||||
<view class="u-m-t-24 u-text-left">
|
<view class=" u-text-left">
|
||||||
<text class="color-333">价格(元)</text>
|
<text class="color-333">价格(元)</text>
|
||||||
<text class="color-red">*</text>
|
<text class="color-red">*</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<view class="border-bottom u-p-t-10 u-p-b-10">
|
<view class="border-bottom ">
|
||||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.price" placeholder="输入价格"
|
<uni-easyinput :inputBorder="false" paddingNone v-model="form.price" placeholder="输入价格"
|
||||||
type="digit"></uni-easyinput>
|
type="digit"></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item required label="" name="unit">
|
<uni-forms-item required label="" name="unit">
|
||||||
<template #label>
|
<template #label>
|
||||||
<view class="u-text-left u-m-t-24">
|
<view class="u-text-left ">
|
||||||
<text class="color-333">单位</text>
|
<text class="color-333">单位</text>
|
||||||
<text class="color-red">*</text>
|
<text class="color-red">*</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<picker @change="unitChange" :value="units.current" range-key="name" :range="units.list">
|
<picker @change="unitChange" :value="units.current" range-key="name" :range="units.list">
|
||||||
<view class="u-m-t-14 u-p-t-10 u-flex u-row-between border-bottom u-p-b-10 u-relative ">
|
<view class=" u-flex u-row-between border-bottom u-relative ">
|
||||||
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
||||||
<view class="u-flex-1">
|
<view class="u-flex-1">
|
||||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.unit"
|
<uni-easyinput :inputBorder="false" paddingNone v-model="form.unit"
|
||||||
|
|
@ -78,19 +78,31 @@
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item required label="" name="price">
|
<uni-forms-item required label="" name="price">
|
||||||
<template #label>
|
<template #label>
|
||||||
<view class="u-m-t-24 u-text-left">
|
<view class=" u-text-left">
|
||||||
<text class="color-333">下单数量</text>
|
<text class="color-333">下单数量</text>
|
||||||
<text class="color-red">*</text>
|
<text class="color-red">*</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<view class="border-bottom u-p-t-10 u-p-b-10">
|
<view class="border-bottom ">
|
||||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.number" placeholder="填写数量"
|
<uni-easyinput :inputBorder="false" paddingNone v-model="form.number" placeholder="填写数量"
|
||||||
type="digit"></uni-easyinput>
|
type="digit"></uni-easyinput>
|
||||||
</view>
|
</view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
<uni-forms-item required label="" name="note">
|
||||||
|
<template #label>
|
||||||
|
<view class=" u-text-left">
|
||||||
|
<text class="color-333">备注</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<view class="border u-m-t-16">
|
||||||
|
<uni-easyinput :inputBorder="false" paddingNone v-model="form.note" placeholder="请输入自定义备注"
|
||||||
|
type="textarea"></uni-easyinput>
|
||||||
|
</view>
|
||||||
|
</uni-forms-item>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view style="height: 200rpx;"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="fixed-b">
|
<view class="fixed-b">
|
||||||
|
|
@ -99,40 +111,23 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import myButton from '../../components/my-components/my-button';
|
import {
|
||||||
|
returnAllCategory
|
||||||
|
} from '@/pageProduct/util.js'
|
||||||
|
import {
|
||||||
|
$tbShopCategory,
|
||||||
|
$tbShopUnit
|
||||||
|
} from '@/http/yskApi/goods.js'
|
||||||
import {
|
import {
|
||||||
reactive,
|
reactive,
|
||||||
|
onMounted,
|
||||||
ref
|
ref
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
const units = reactive({
|
const units = reactive({
|
||||||
list: [{
|
list: [],
|
||||||
name: '件',
|
current: ''
|
||||||
value: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '杯',
|
|
||||||
value: 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '个',
|
|
||||||
value: 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
current:''
|
|
||||||
})
|
})
|
||||||
const category = reactive([{
|
let category = reactive([])
|
||||||
name: '分类1',
|
|
||||||
value: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '分类2',
|
|
||||||
value: 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '分类3',
|
|
||||||
value: 3
|
|
||||||
}
|
|
||||||
])
|
|
||||||
let categoryCurrent = ref('')
|
let categoryCurrent = ref('')
|
||||||
|
|
||||||
function categoryChange(e) {
|
function categoryChange(e) {
|
||||||
|
|
@ -140,7 +135,8 @@
|
||||||
categoryCurrent.value = e.detail.value
|
categoryCurrent.value = e.detail.value
|
||||||
form.category = category[e.detail.value].name
|
form.category = category[e.detail.value].name
|
||||||
}
|
}
|
||||||
function unitChange(e){
|
|
||||||
|
function unitChange(e) {
|
||||||
units.current = e.detail.value
|
units.current = e.detail.value
|
||||||
form.unit = units.list[e.detail.value].name
|
form.unit = units.list[e.detail.value].name
|
||||||
}
|
}
|
||||||
|
|
@ -149,9 +145,9 @@
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
category: '',
|
category: '',
|
||||||
price: 0,
|
price: '',
|
||||||
unit:'',
|
unit: '',
|
||||||
number:0
|
number: ''
|
||||||
})
|
})
|
||||||
// 校验规则
|
// 校验规则
|
||||||
const rules = {
|
const rules = {
|
||||||
|
|
@ -194,9 +190,43 @@
|
||||||
console.log(err);
|
console.log(err);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//获取单位数据
|
||||||
|
async function getTbShopUnit() {
|
||||||
|
const res = await $tbShopUnit({
|
||||||
|
page: 0,
|
||||||
|
size: 200,
|
||||||
|
sort: "id"
|
||||||
|
})
|
||||||
|
units.list = res.content.map(v => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
value: v.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function getCategory(){
|
||||||
|
const res=await $tbShopCategory({
|
||||||
|
page: 0,
|
||||||
|
size: 600
|
||||||
|
})
|
||||||
|
const arr=returnAllCategory(res.content).map(v=>{
|
||||||
|
return {...v,value:v.id}
|
||||||
|
})
|
||||||
|
category.length=arr.length
|
||||||
|
category = reactive(arr)
|
||||||
|
}
|
||||||
|
async function init() {
|
||||||
|
getTbShopUnit()
|
||||||
|
getCategory()
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
init()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.u-text-left {}
|
||||||
|
|
||||||
.form {
|
.form {
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
|
@ -205,6 +235,13 @@
|
||||||
// background-color: transparent;
|
// background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.border {
|
||||||
|
border: 1px solid #F4F4F4;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
padding-left: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
::v-deep.uni-forms-item {
|
::v-deep.uni-forms-item {
|
||||||
align-items: inherit;
|
align-items: inherit;
|
||||||
}
|
}
|
||||||
|
|
@ -213,6 +250,16 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::v-deep .uni-easyinput__content-input {
|
||||||
|
height: inherit;
|
||||||
|
padding-top: 16rpx;
|
||||||
|
padding-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .uni-forms-item:not(:first-child) {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.fixed-b {
|
.fixed-b {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 100rpx;
|
left: 100rpx;
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@
|
||||||
xiadanClick()
|
xiadanClick()
|
||||||
//临时菜
|
//临时菜
|
||||||
const lingshi = reactive({
|
const lingshi = reactive({
|
||||||
show: false
|
show: true
|
||||||
})
|
})
|
||||||
//附加费
|
//附加费
|
||||||
const extraFee = reactive({
|
const extraFee = reactive({
|
||||||
|
|
@ -1129,7 +1129,7 @@
|
||||||
}
|
}
|
||||||
if (e.detail.scrollTop == 0) {
|
if (e.detail.scrollTop == 0) {
|
||||||
isTabClickOver = true
|
isTabClickOver = true
|
||||||
return swichMenu(0)
|
// return swichMenu(0)
|
||||||
}
|
}
|
||||||
setTimeout(() => { // 节流
|
setTimeout(() => { // 节流
|
||||||
data.timer = null;
|
data.timer = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue