增加临时菜页面
This commit is contained in:
parent
704fee1e2d
commit
3935ec7960
|
|
@ -1,5 +1,5 @@
|
|||
<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">
|
||||
<text class="color-red">*</text>
|
||||
<text class="color-999">将临时菜添加至购物车,不会影响总商品库</text>
|
||||
|
|
@ -14,20 +14,20 @@
|
|||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</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"
|
||||
placeholder="填写菜品名称"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item required label="" name="category">
|
||||
<template #label>
|
||||
<view class="u-text-left u-m-t-24">
|
||||
<view class="u-text-left ">
|
||||
<text class="color-333">菜品分类</text>
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</template>
|
||||
<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>
|
||||
<text class="" v-if="form.category!==''">{{category[form.category].name}}</text>
|
||||
|
|
@ -46,25 +46,25 @@
|
|||
|
||||
<uni-forms-item required label="" name="price">
|
||||
<template #label>
|
||||
<view class="u-m-t-24 u-text-left">
|
||||
<view class=" u-text-left">
|
||||
<text class="color-333">价格(元)</text>
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</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="输入价格"
|
||||
type="digit"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item required label="" name="unit">
|
||||
<template #label>
|
||||
<view class="u-text-left u-m-t-24">
|
||||
<view class="u-text-left ">
|
||||
<text class="color-333">单位</text>
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</template>
|
||||
<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="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.unit"
|
||||
|
|
@ -78,19 +78,31 @@
|
|||
</uni-forms-item>
|
||||
<uni-forms-item required label="" name="price">
|
||||
<template #label>
|
||||
<view class="u-m-t-24 u-text-left">
|
||||
<view class=" u-text-left">
|
||||
<text class="color-333">下单数量</text>
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</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="填写数量"
|
||||
type="digit"></uni-easyinput>
|
||||
</view>
|
||||
</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>
|
||||
</view>
|
||||
|
||||
<view style="height: 200rpx;"></view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-b">
|
||||
|
|
@ -99,40 +111,23 @@
|
|||
</template>
|
||||
|
||||
<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 {
|
||||
reactive,
|
||||
onMounted,
|
||||
ref
|
||||
} from 'vue';
|
||||
const units = reactive({
|
||||
list: [{
|
||||
name: '件',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
name: '杯',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
name: '个',
|
||||
value: 3
|
||||
}
|
||||
],
|
||||
current:''
|
||||
list: [],
|
||||
current: ''
|
||||
})
|
||||
const category = reactive([{
|
||||
name: '分类1',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
name: '分类2',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
name: '分类3',
|
||||
value: 3
|
||||
}
|
||||
])
|
||||
let category = reactive([])
|
||||
let categoryCurrent = ref('')
|
||||
|
||||
function categoryChange(e) {
|
||||
|
|
@ -140,7 +135,8 @@
|
|||
categoryCurrent.value = e.detail.value
|
||||
form.category = category[e.detail.value].name
|
||||
}
|
||||
function unitChange(e){
|
||||
|
||||
function unitChange(e) {
|
||||
units.current = e.detail.value
|
||||
form.unit = units.list[e.detail.value].name
|
||||
}
|
||||
|
|
@ -149,9 +145,9 @@
|
|||
const form = reactive({
|
||||
name: '',
|
||||
category: '',
|
||||
price: 0,
|
||||
unit:'',
|
||||
number:0
|
||||
price: '',
|
||||
unit: '',
|
||||
number: ''
|
||||
})
|
||||
// 校验规则
|
||||
const rules = {
|
||||
|
|
@ -194,9 +190,43 @@
|
|||
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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-text-left {}
|
||||
|
||||
.form {
|
||||
margin-top: 32rpx;
|
||||
background-color: #fff;
|
||||
|
|
@ -205,6 +235,13 @@
|
|||
// background-color: transparent;
|
||||
}
|
||||
|
||||
.border {
|
||||
border: 1px solid #F4F4F4;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
padding-left: 24rpx;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item {
|
||||
align-items: inherit;
|
||||
}
|
||||
|
|
@ -213,6 +250,16 @@
|
|||
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 {
|
||||
position: fixed;
|
||||
left: 100rpx;
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@
|
|||
xiadanClick()
|
||||
//临时菜
|
||||
const lingshi = reactive({
|
||||
show: false
|
||||
show: true
|
||||
})
|
||||
//附加费
|
||||
const extraFee = reactive({
|
||||
|
|
@ -1129,7 +1129,7 @@
|
|||
}
|
||||
if (e.detail.scrollTop == 0) {
|
||||
isTabClickOver = true
|
||||
return swichMenu(0)
|
||||
// return swichMenu(0)
|
||||
}
|
||||
setTimeout(() => { // 节流
|
||||
data.timer = null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue