first
222
pagesCreateOrder/add-temp-cuisine/add-temp-cuisine.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<view class="min-page bg-gray u-p-30">
|
||||
<view class="u-font-24">
|
||||
<text class="color-red">*</text>
|
||||
<text class="color-999">将临时菜添加至购物车,不会影响总商品库</text>
|
||||
</view>
|
||||
<view class="form">
|
||||
<uni-forms ref="refform" label-position="top" :model="form" label-align="left" label-width="300"
|
||||
:rules="rules">
|
||||
<uni-forms-item required label="" name="name">
|
||||
<template #label>
|
||||
<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">
|
||||
<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">
|
||||
<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="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
||||
<!-- <view>
|
||||
<text class="" v-if="form.category!==''">{{category[form.category].name}}</text>
|
||||
<text class="color-999 " v-else>选择分类</text>
|
||||
</view> -->
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.category"
|
||||
placeholder="选择分类"></uni-easyinput>
|
||||
</view>
|
||||
<uni-icons type="right" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item required label="" name="price">
|
||||
<template #label>
|
||||
<view class="u-m-t-24 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">
|
||||
<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">
|
||||
<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="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.unit"
|
||||
placeholder="选择单位"></uni-easyinput>
|
||||
</view>
|
||||
<uni-icons type="right" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
|
||||
</uni-forms-item>
|
||||
<uni-forms-item required label="" name="price">
|
||||
<template #label>
|
||||
<view class="u-m-t-24 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">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.number" placeholder="填写数量"
|
||||
type="digit"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="fixed-b">
|
||||
<my-button shape="circle" @tap="submit">加入购物车</my-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import myButton from '../../components/my-components/my-button';
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
const units = reactive({
|
||||
list: [{
|
||||
name: '件',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
name: '杯',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
name: '个',
|
||||
value: 3
|
||||
}
|
||||
],
|
||||
current:''
|
||||
})
|
||||
const category = reactive([{
|
||||
name: '分类1',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
name: '分类2',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
name: '分类3',
|
||||
value: 3
|
||||
}
|
||||
])
|
||||
let categoryCurrent = ref('')
|
||||
|
||||
function categoryChange(e) {
|
||||
console.log(e);
|
||||
categoryCurrent.value = e.detail.value
|
||||
form.category = category[e.detail.value].name
|
||||
}
|
||||
function unitChange(e){
|
||||
units.current = e.detail.value
|
||||
form.unit = units.list[e.detail.value].name
|
||||
}
|
||||
|
||||
const refform = ref(null)
|
||||
const form = reactive({
|
||||
name: '',
|
||||
category: '',
|
||||
price: 0,
|
||||
unit:'',
|
||||
number:0
|
||||
})
|
||||
// 校验规则
|
||||
const rules = {
|
||||
name: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '菜品名称不能为空'
|
||||
}]
|
||||
},
|
||||
category: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请选择菜品分类'
|
||||
}]
|
||||
},
|
||||
price: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入价格'
|
||||
}]
|
||||
},
|
||||
unit: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请选择单位'
|
||||
}]
|
||||
},
|
||||
price: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请填写下单数量'
|
||||
}]
|
||||
},
|
||||
}
|
||||
|
||||
function submit() {
|
||||
refform.value.validate(res => {
|
||||
console.log(res)
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.form {
|
||||
margin-top: 32rpx;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 24rpx 32rpx 24rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
// background-color: transparent;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item {
|
||||
align-items: inherit;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item__error {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.fixed-b {
|
||||
position: fixed;
|
||||
left: 100rpx;
|
||||
right: 100rpx;
|
||||
bottom: 100rpx;
|
||||
}
|
||||
</style>
|
||||
297
pagesCreateOrder/choose-table/choose-table.vue
Normal file
@@ -0,0 +1,297 @@
|
||||
<template>
|
||||
<view class="page-gray">
|
||||
<view class="bg-fff">
|
||||
<view class="search bg-fff u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="输入桌号" @confirm="search"
|
||||
v-model="searchValue">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
<!-- <view class="u-flex">
|
||||
<image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image>
|
||||
</view> -->
|
||||
</view>
|
||||
<view>
|
||||
<picker @change="areaChange" range-key="name" :value="area.defaultCateIndex" :range="area.list">
|
||||
<view class="u-flex u-row-between area">
|
||||
<view class="color-333">桌台类型:<text v-if="area.sel">{{area.sel.name}}</text> <text
|
||||
v-else>全部</text> </view>
|
||||
<uni-icons type="right"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list ">
|
||||
<view class="">
|
||||
<template v-if="tables.list.length">
|
||||
<view class=" bg-fff box bg-fff">
|
||||
<view class="u-flex item u-row-between" v-for="(item,index) in tables.list" :key="index"
|
||||
@tap="chooseTable(index,item)">
|
||||
<view class="u-flex">
|
||||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view>{{item.name}}</view>
|
||||
<view class="line"></view>
|
||||
<view>{{''}}</view>
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-12">
|
||||
<text
|
||||
:style="{color:returnStutasColor(item.status)}">{{returnStutasText(item.status)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="my-radio u-font-28 u-flex color-333">
|
||||
<view class="circle u-flex u-row-center" :class="{active:index==tables.selIndex}">
|
||||
<uni-icons type="checkmarkempty" :size="16" color="#fff"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<template v-if="tables.list.length<=0">
|
||||
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
$table,
|
||||
$tableArea
|
||||
} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
$status
|
||||
} from '@/commons/table-status.js'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
let nouser = ref(false)
|
||||
|
||||
function returnStutasText(key) {
|
||||
const item = $status[key]
|
||||
return item ? item.label : ''
|
||||
}
|
||||
|
||||
function returnStutasColor(key) {
|
||||
// if(key=='using'){
|
||||
// return 'rgb(250,85,85)'
|
||||
// }else{
|
||||
// return ''
|
||||
// }
|
||||
const item = $status[key]
|
||||
return item ? item.type : ''
|
||||
}
|
||||
|
||||
function emitChooeTable(data) {
|
||||
uni.$emit('choose-table', data)
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 100)
|
||||
}
|
||||
let searchValue = ref('')
|
||||
|
||||
function search() {
|
||||
query.page=1
|
||||
getTable()
|
||||
}
|
||||
|
||||
function chooseTable(index, item) {
|
||||
if (item.status == 'closed') {
|
||||
return uni.showToast({
|
||||
title: '该桌台已关闭!',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
if (index === undefined || item === undefined) {
|
||||
nouser.value = true
|
||||
return emitChooeTable()
|
||||
} else {
|
||||
tables.selIndex = index
|
||||
emitChooeTable(item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//分类
|
||||
const area = reactive({
|
||||
list: [{
|
||||
name: '全部'
|
||||
}],
|
||||
defaultCateIndex: 0,
|
||||
sel: ''
|
||||
})
|
||||
|
||||
function areaChange(e) {
|
||||
area.defaultCateIndex = e.detail.value
|
||||
area.sel = area.list[e.detail.value]
|
||||
query.page=1
|
||||
getTable()
|
||||
}
|
||||
const query = {
|
||||
page: 1,
|
||||
size: 10,
|
||||
areaId: 0,
|
||||
totalElements:0
|
||||
}
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
console.log(page);
|
||||
query.page = page
|
||||
getTable()
|
||||
}
|
||||
const tables = reactive({
|
||||
hasAjax: false,
|
||||
selIndex: -1,
|
||||
originList: [],
|
||||
list: []
|
||||
})
|
||||
async function getTable() {
|
||||
// let state=status.list[status.active].key
|
||||
// state=state?(state=='all'?'':state):''
|
||||
const areaId=area.list[area.defaultCateIndex].id||''
|
||||
let {
|
||||
content,total
|
||||
} = await $table.get({...query,areaId,name:searchValue.value,state:'idle'})
|
||||
query.totalElements=total||0;
|
||||
tables.hasAjax = true;
|
||||
console.log(content);
|
||||
tables.list = content
|
||||
tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
|
||||
tables.originList = content
|
||||
}
|
||||
async function getArea() {
|
||||
const {
|
||||
content
|
||||
} = await $tableArea.get({
|
||||
page: 0,
|
||||
size: 300
|
||||
})
|
||||
content.unshift({
|
||||
name: '全部'
|
||||
})
|
||||
area.list = content.map(v => {
|
||||
return {
|
||||
...v,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
watch(() => area.sel, (newval) => {
|
||||
getTable()
|
||||
})
|
||||
let option = {}
|
||||
onLoad(opt => {
|
||||
Object.assign(option, opt)
|
||||
console.log(option);
|
||||
getTable()
|
||||
getArea()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.line {
|
||||
width: 1px;
|
||||
height: 20rpx;
|
||||
background-color: #E5E5E5;
|
||||
margin-left: 8rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.my-radio {
|
||||
|
||||
.circle {
|
||||
background: #FFFFFF;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
|
||||
&.active {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
border: 1px solid #707070;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
|
||||
&.square {
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.area {
|
||||
padding: 2px 28rpx 24rpx 28rpx;
|
||||
}
|
||||
|
||||
.scale7 {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
::v-deep .uni-searchbar {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.search {
|
||||
padding: 20rpx 28rpx 20rpx 28rpx;
|
||||
|
||||
.icon-saoma {
|
||||
margin-left: 20rpx;
|
||||
width: 34rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 32rpx 24rpx;
|
||||
|
||||
.no-choose {
|
||||
padding: 36rpx 30rpx 36rpx 24rpx;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding: 32rpx 30rpx 32rpx 24rpx;
|
||||
|
||||
.item {
|
||||
padding: 24rpx 0;
|
||||
|
||||
.headimg {
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
overflow: hidden;
|
||||
font-size: 0;
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
|
||||
.img {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item:not(:first-child) {
|
||||
border-top: 1px solid #E5E5E5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
194
pagesCreateOrder/choose-user/choose-user.vue
Normal file
@@ -0,0 +1,194 @@
|
||||
<template>
|
||||
<view class="page-gray u-font-28">
|
||||
<view class="search bg-fff u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search" @clear="search"
|
||||
v-model="query.name">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="list ">
|
||||
<view class="bg-fff u-row-between u-flex no-choose border-r-12" @tap="chooseUser">
|
||||
<view>不选择用户</view>
|
||||
<my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio>
|
||||
</view>
|
||||
<template v-if="list.length>0">
|
||||
<view class="u-m-t-32 bg-fff box bg-fff">
|
||||
<view class="u-flex item u-row-between" v-for="(item,index) in list" :key="index"
|
||||
@tap="chooseUser(index,item)">
|
||||
<view class="u-flex">
|
||||
<view class="headimg u-flex u-row-center u-col-center">
|
||||
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
|
||||
</view>
|
||||
<view class="u-m-l-32">
|
||||
<view class="u-flex">
|
||||
<view>{{item.nickName}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-12 ">手机号:{{item.telephone}}</view>
|
||||
<view class=" u-font-24 u-m-t-12 u-flex">
|
||||
<text class="color-999" v-if="!item.isVip">非会员</text>
|
||||
<text class="color-main" v-else>会员</text>
|
||||
<view class="u-m-l-30 u-flex">
|
||||
<text class="">余额:</text>
|
||||
<text class="color-main">{{item.amount}}</text>
|
||||
</view>
|
||||
<view class="u-m-l-30 u-flex">
|
||||
<text class="">积分:</text>
|
||||
<text class="color-main">{{item.accountPoints}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<my-radio @change="chooseUser(index,item)" v-model="item.checked" :size="18"
|
||||
border-color="#d1d1d1"></my-radio>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<template v-if="hasAjax&&list.length<=0">
|
||||
<my-img-empty tips="未找到相关用户"></my-img-empty>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as Api from '@/http/yskApi/shop-user.js'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
reactive,
|
||||
onBeforeMount,
|
||||
ref
|
||||
} from 'vue';
|
||||
let nouser = ref(false)
|
||||
let timer = null
|
||||
|
||||
function emitChooser(data) {
|
||||
uni.$emit('choose-user', data)
|
||||
timer = setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 100)
|
||||
}
|
||||
onBeforeMount(() => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
|
||||
function chooseUser(index, item) {
|
||||
if (index === undefined || item === undefined) {
|
||||
nouser.value = true
|
||||
return emitChooser({
|
||||
id: '',
|
||||
headImg: '',
|
||||
telephone: '',
|
||||
amount: '0.00',
|
||||
accountPoints: '0.00'
|
||||
})
|
||||
} else {
|
||||
list[index].checked = true
|
||||
emitChooser(item)
|
||||
}
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
name: '',
|
||||
totalElements: 0,
|
||||
size: 10,
|
||||
isVip: 1
|
||||
})
|
||||
const list = reactive([])
|
||||
let hasAjax = ref(false)
|
||||
async function getUser() {
|
||||
const {
|
||||
content,
|
||||
totalElements
|
||||
} = await Api.queryAllShopUser(query)
|
||||
hasAjax.value = true
|
||||
list.length = content.length
|
||||
for (let i in content) {
|
||||
list[i] = {
|
||||
...content[i],
|
||||
checked: false
|
||||
}
|
||||
}
|
||||
query.totalElements = totalElements
|
||||
console.log(list);
|
||||
}
|
||||
|
||||
function pageChange(e) {
|
||||
query.page = e
|
||||
getUser()
|
||||
}
|
||||
|
||||
function search() {
|
||||
query.page = 1
|
||||
getUser()
|
||||
}
|
||||
onLoad(() => {
|
||||
getUser()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scale7 {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
.search {
|
||||
padding-right: 28rpx;
|
||||
|
||||
.icon-saoma {
|
||||
margin-left: 20rpx;
|
||||
width: 34rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 32rpx 24rpx;
|
||||
|
||||
.no-choose {
|
||||
padding: 36rpx 30rpx 36rpx 24rpx;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding: 32rpx 30rpx 78rpx 24rpx;
|
||||
|
||||
.item {
|
||||
padding: 24rpx 0;
|
||||
|
||||
.headimg {
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
font-size: 0;
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
background-color: #eee;
|
||||
overflow: hidden;
|
||||
|
||||
.img {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item:not(:first-child) {
|
||||
border-top: 1px solid #E5E5E5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
203
pagesCreateOrder/components/edit-discount.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||
<template #desc>
|
||||
<view class="u-text-left u-p-30 color-666">
|
||||
<view class="u-m-t-32 u-flex ">
|
||||
<view>应付金额</view>
|
||||
<view class="u-m-l-32">
|
||||
{{form.price}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-40 u-flex ">
|
||||
<view>实收金额</view>
|
||||
<view class="u-m-l-32 border-bottom u-flex-1">
|
||||
<uni-easyinput style="digit" @input="currentPriceInput" @change="currentPriceChange" paddingNone :inputBorder="false"
|
||||
v-model="form.currentPrice"
|
||||
placeholder="输入实际金额"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-54 u-flex ">
|
||||
<view>优惠折扣</view>
|
||||
<view class="u-m-l-32 u-flex-1 u-flex border-bottom">
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput @input="discountInput" @change="discountChange" style="digit" paddingNone :inputBorder="false"
|
||||
v-model="form.discount"
|
||||
placeholder="输入折扣"></uni-easyinput>
|
||||
</view>
|
||||
<view class="u-font-32 color-333">%</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template #btn>
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" >修改</my-button>
|
||||
<view class="">
|
||||
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</my-model>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
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'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
discount:{
|
||||
type: [Number,String],
|
||||
default:100
|
||||
},
|
||||
price: {
|
||||
type: [Number,String],
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
function currentPriceInput(newval){
|
||||
form.discount=(newval*100/form.price).toFixed()
|
||||
}
|
||||
function discountInput(newval){
|
||||
form.currentPrice=(form.price*newval/100).toFixed(2)
|
||||
}
|
||||
function currentPriceChange(newval){
|
||||
if(newval<0){
|
||||
form.currentPrice=0
|
||||
form.discount=100
|
||||
return infoBox.showToast('实收金额不能小于0')
|
||||
}
|
||||
if(newval>props.price){
|
||||
form.currentPrice=props.price
|
||||
form.discount=0
|
||||
return infoBox.showToast('实收金额不能大于应付金额')
|
||||
}
|
||||
}
|
||||
function discountChange(newval){
|
||||
if(newval<0){
|
||||
form.currentPrice=props.price
|
||||
form.discount=0
|
||||
return infoBox.showToast('优惠折扣不能小于0')
|
||||
}
|
||||
if(newval>100){
|
||||
form.discount=100
|
||||
form.currentPrice=0
|
||||
return infoBox.showToast('优惠折扣不能大于100')
|
||||
}
|
||||
}
|
||||
|
||||
const $form = {
|
||||
price:props.price,
|
||||
currentPrice: props.price,
|
||||
discount: 100
|
||||
}
|
||||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
})
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
})
|
||||
}
|
||||
|
||||
const model = ref(null)
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
form.price=props.price
|
||||
form.currentPrice=props.price
|
||||
form.discount=props.discount
|
||||
}
|
||||
|
||||
function close() {
|
||||
model.value.close()
|
||||
}
|
||||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
console.log(form);
|
||||
emits('confirm',{...form,currentPrice:Number(form.currentPrice).toFixed(2)})
|
||||
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>
|
||||
258
pagesCreateOrder/confirm-order/components/discount.vue
Normal file
@@ -0,0 +1,258 @@
|
||||
<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>
|
||||
<view class="u-m-t-24 border discount u-relative u-flex input-box">
|
||||
<view class="u-flex-1">
|
||||
<input @input="discountInput" v-model="form.discount" type="digit"
|
||||
placeholder-class="placeholder-class" placeholder="打八折请输入80" />
|
||||
|
||||
</view>
|
||||
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
|
||||
<view>%</view>
|
||||
</view>
|
||||
<view class="color-999 u-p-l-48 u-p-r-48 bg1 u-absolute u-flex u-row-center u-col-center">
|
||||
<view>%</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-24">
|
||||
<view class="u-flex" v-for="(item,index) in discounts" :key="index">
|
||||
<button @tap="setForm('discount',item)" class="tag u-m-r-20"
|
||||
hover-class="hover-class">{{item}}%</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>
|
||||
<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" />
|
||||
|
||||
</view>
|
||||
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
|
||||
<view>元</view>
|
||||
</view>
|
||||
<view class="color-999 u-p-l-48 u-p-r-48 bg1 u-absolute u-flex u-row-center u-col-center">
|
||||
<view>元</view>
|
||||
</view>
|
||||
</view>
|
||||
</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-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,
|
||||
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],
|
||||
default: 0
|
||||
},
|
||||
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 = {
|
||||
discountMoney: '',
|
||||
discount: '',
|
||||
name: '',
|
||||
price: ''
|
||||
}
|
||||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
form.currentPrice=newval
|
||||
})
|
||||
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 {
|
||||
discount,discountMoney
|
||||
} = form
|
||||
if (current.value===0&& discount==='') {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入有效折扣!'
|
||||
})
|
||||
}
|
||||
if (current.value===1&& discountMoney==='') {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入有效减免价格!'
|
||||
})
|
||||
}
|
||||
close()
|
||||
emits('confirm', form)
|
||||
}
|
||||
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>
|
||||
197
pagesCreateOrder/confirm-order/components/give-food.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<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>
|
||||
170
pagesCreateOrder/confirm-order/components/remark.vue
Normal file
@@ -0,0 +1,170 @@
|
||||
<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="textarea" v-model="form.remark" placeholder="自定义内容"></uni-easyinput>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-24">
|
||||
<view class="u-flex u-flex-wrap u-m-r-20 u-m-b-20 lh34" v-for="(item,index) in causes" :key="index">
|
||||
<button @tap="changeCauses(item)" class="tag ">{{item.name}}</button>
|
||||
</view>
|
||||
</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: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function changeCauses(item) {
|
||||
let prve=form.remark?',':''
|
||||
form.remark +=prve+item.name
|
||||
console.log(form.remark);
|
||||
}
|
||||
|
||||
const causes = reactive([{
|
||||
name: '免葱',
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
name: '免香菜',
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
name: '不要辣',
|
||||
checked: false
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
function setForm(key, val) {
|
||||
form[key] = val
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const $form = {
|
||||
remark:''
|
||||
}
|
||||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
|
||||
function resetForm() {
|
||||
Object.assign(form, {
|
||||
...$form
|
||||
})
|
||||
}
|
||||
|
||||
const model = ref(null)
|
||||
|
||||
function open(data) {
|
||||
Object.assign(form,data)
|
||||
model.value.open()
|
||||
}
|
||||
|
||||
function close() {
|
||||
model.value.close()
|
||||
}
|
||||
const emits = defineEmits(['confirm'])
|
||||
|
||||
function confirm() {
|
||||
const {remark
|
||||
} = form
|
||||
emits('confirm', {
|
||||
remark
|
||||
})
|
||||
console.log(remark);
|
||||
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>
|
||||
854
pagesCreateOrder/confirm-order/confirm-order.vue
Normal file
@@ -0,0 +1,854 @@
|
||||
<template>
|
||||
<view class="page-gray color-333 u-font-28">
|
||||
<template v-if="true">
|
||||
<view class="block u-p-t-32 u-p-b-32" v-if="table&&table.tableId">
|
||||
<view>桌位号</view>
|
||||
<view class="font-bold u-font-32 u-m-t-16">
|
||||
{{table.name||''}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="block">
|
||||
<view class="u-p-b-24 u-m-b-24 border-bottom">
|
||||
<view>选择用户</view>
|
||||
<view class="u-m-t-24 u-flex u-row-between " @tap="chooseUser">
|
||||
<view v-if="!user||!user.id">选择用户</view>
|
||||
<view class="u-flex" v-if="user&&user.id">
|
||||
<up-avatar :src="user.headImg" shape="square" :size="30"></up-avatar>
|
||||
<!-- <view class="headeimg">
|
||||
<image class="img" :src="user.headImg" mode=""></image>
|
||||
</view> -->
|
||||
<view class="u-m-l-20">
|
||||
<!-- <view class="color-main u-font-24 no-wrap">{{user.isVip?'会员':'' }}</view> -->
|
||||
<view class="">{{user.nickName}}</view>
|
||||
</view>
|
||||
<view class="u-font-24 u-m-l-30 u-text-center"><text>余额:</text><text
|
||||
class="color-main">{{user.amount}}</text>
|
||||
</view>
|
||||
<view class="u-font-24 u-m-l-30 u-text-center"><text>积分:</text><text
|
||||
class="color-main">{{user.accountPoints}}</text></view>
|
||||
</view>
|
||||
<uni-icons type="right" color="#999" size="20" bold></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class=" ">
|
||||
<view>就餐类型</view>
|
||||
<view class="u-m-t-24 u-flex ">
|
||||
<view class="u-flex color-666">
|
||||
<up-radio-group :disabled="option.type=='add'" v-model="eatTypes.active" placement="row">
|
||||
<up-radio :customStyle="{marginRight: '30px'}" v-for="(item, index) in eatTypes.list"
|
||||
:key="index" :label="item.name" :name="item.value">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="u-p-b-24 u-m-b-24 border-bottom">
|
||||
<view>就餐类型</view>
|
||||
<view class="u-m-t-24 u-flex ">
|
||||
<view class="u-flex color-666">
|
||||
<up-radio-group :disabled="option.type=='add'" v-model="eatTypes.active" placement="row">
|
||||
<up-radio :customStyle="{marginRight: '30px'}" v-for="(item, index) in eatTypes.list"
|
||||
:key="index" :label="item.name" :name="item.value">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class=" " @tap="chooseTable">
|
||||
<view>选择桌码</view>
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
<view>
|
||||
<text v-if="table">{{table.name}}</text>
|
||||
<text v-else>不选择桌台</text>
|
||||
</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
|
||||
<template v-if="user&&user.id">
|
||||
<view class="block">
|
||||
<view class="">
|
||||
<view class="u-flex border-bottom u-p-b-24 ">
|
||||
<up-avatar :src="user.headImg" shape="square" :size="60"></up-avatar>
|
||||
<!-- <image class="headeimg" src="@/static/uni.png" mode=""></image> -->
|
||||
<view class="u-m-l-32">
|
||||
<view class="">{{user.nickName}}</view>
|
||||
<view class="color-main u-font-24">{{user.isVip?'会员':'' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-24 u-row-between u-font-24 color-999">
|
||||
<view class="u-flex">
|
||||
<view>余额</view>
|
||||
<view class="color-333 u-m-l-10"> {{user.amount}}</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view>积分</view>
|
||||
<view class="color-333 u-m-l-10"> {{user.accountPoints}}</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="u-text-center">订单数量</view>
|
||||
<view class="color-333 u-m-l-10">{{user.orderNumber||0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="!$shop.isTableFee">
|
||||
<!-- 不免餐位费 -->
|
||||
<view class="block">
|
||||
<view class=" ">
|
||||
<view>用餐人数(人)</view>
|
||||
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex"
|
||||
:range="userNumbers.list">
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
<view class="color-333">{{userNumbers.defaultCateIndex*1+1+'人'}}</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<view class="block">
|
||||
<view class="u-p-b-24 ">
|
||||
<view class="font-bold">订单备注</view>
|
||||
<view class="u-m-t-32 u-flex ">
|
||||
<uni-easyinput type="textarea" v-model="note" placeholder="请输入备注"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="block u-m-b-0">
|
||||
<view class="u-flex">
|
||||
<view>共</view>
|
||||
<view class="fen font-bold">{{goodsNumber}}</view>
|
||||
<view>份菜品</view>
|
||||
</view>
|
||||
|
||||
<view class="goods u-m-t-32">
|
||||
<view class="item u-m-b-48" @click="changeGoodsSel(index)" v-for="(item,index) in goods.list"
|
||||
:key="index">
|
||||
<view class="u-flex u-row-between ">
|
||||
<view class="u-flex">
|
||||
<image class="img" :src="item.coverImg" mode=""></image>
|
||||
<view class="u-m-l-32">
|
||||
<view class="u-flex">
|
||||
<view class="u-flex u-m-r-20" v-if="item.isWait">
|
||||
<uni-tag text="等叫"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex" v-if="item.isGift">
|
||||
<uni-tag text="赠送"
|
||||
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
|
||||
</uni-tag>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-flex" v-if="item.isPack">
|
||||
<uni-tag
|
||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||
size="small" text="打包" inverted type="success" />
|
||||
</view>
|
||||
<view>
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-font-24 color-999 u-m-t-10">{{item.specSnap||' '}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class=" u-relative">
|
||||
<template v-if="item.isGift">
|
||||
<text class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
||||
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||
<text class="font-bold">¥0</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="isVip&&item.memberPrice&&item.memberPrice*1!=item.salePrice*1">
|
||||
<text
|
||||
class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
||||
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||
<text class="font-bold">¥{{formatPrice(item.memberPrice*item.number) }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="font-bold">
|
||||
<text>¥</text>
|
||||
<text class="">{{formatPrice(item.salePrice*item.number) }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</template>
|
||||
</view>
|
||||
<view class="color-999 u-text-right u-font-24 u-m-t-12">×{{item.number}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="item.note">
|
||||
<view class="u-p-20 bg-gray u-m-t-16">
|
||||
{{item.note}}
|
||||
</view>
|
||||
</template>
|
||||
<scroll-view class="u-m-t-32" scroll-x="true" v-if="index==goods.sel">
|
||||
<view class=" u-flex no-wrap ">
|
||||
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
|
||||
<button class="tag" hover-class="hover-class" @tap="showModel('discount')">单品打折</button>
|
||||
</view> -->
|
||||
<view class="u-flex u-m-r-20 ">
|
||||
<!-- <button class="tag" hover-class="hover-class" @tap="showModel('giveFood')">赠菜</button> -->
|
||||
<button class="tag" hover-class="hover-class"
|
||||
@tap="toggleGoodsItemKey(item,index,'isGift')">{{item.isGift?'取消赠送':'赠送'}}</button>
|
||||
</view>
|
||||
<view class="u-flex u-m-r-20 ">
|
||||
<button class="tag" hover-class="hover-class"
|
||||
@tap="toggleGoodsItemKey(item,index,'isPack')">{{item.isPack?'取消打包':'打包'}}</button>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
|
||||
<button class="tag" hover-class="hover-class"
|
||||
@tap="toggleWait(item)">{{item.isWait?'取消等叫':'等叫'}}</button>
|
||||
</view> -->
|
||||
<view class="u-flex u-m-r-20 ">
|
||||
<button class="tag" hover-class="hover-class"
|
||||
@tap="showModel('remark',index)">单品备注</button>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom">
|
||||
<template v-if="$seatFee&&$seatFee.totalAmount">
|
||||
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 ">
|
||||
<view>
|
||||
<text>桌位费</text>
|
||||
</view>
|
||||
<view>¥{{$seatFee.totalAmount||'0.00'}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="$packFee>0">
|
||||
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 ">
|
||||
<view>
|
||||
<text>打包费</text>
|
||||
</view>
|
||||
<view>¥{{$packFee||'0.00'}}</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="u-flex u-row-between u-m-t-38">
|
||||
<!-- <template v-if="$shop.registerType=='munchies'">
|
||||
<view class="color-main" @tap="showModel('editMoney')">修改</view>
|
||||
</template> -->
|
||||
<view class="u-flex">
|
||||
<view class="u-flex price" v-if="youhui*1>0">
|
||||
<view class="">优惠金额</view>
|
||||
<view class="font-bold u-font-32">¥{{formatPrice(youhui) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex price u-m-l-32">
|
||||
<view class="">实收金额</view>
|
||||
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<view :style="{height:bottomHeight+'px'}"></view>
|
||||
<view class="safe-bottom fixed">
|
||||
<!-- <view class="u-m-b-48">
|
||||
<label class="radio">
|
||||
<radio value="" class="scale7" /><text>打印预结算</text>
|
||||
</label>
|
||||
</view> -->
|
||||
|
||||
<view class="btn ">
|
||||
<my-button shape="circle" @click="createOrder">
|
||||
<view class="font-bold u-font-32">
|
||||
{{($shop.registerType=='munchies'||eatTypes.active=='takeout')?'结算': '下单'}}
|
||||
</view>
|
||||
</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
|
||||
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
|
||||
<one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
ref,
|
||||
onBeforeUnmount,
|
||||
reactive,
|
||||
computed,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
getSafeBottomHeight
|
||||
} from '@/commons/utils/safe-bottom.js'
|
||||
import modelDiscount from './components/discount'
|
||||
import giveFood from './components/give-food'
|
||||
import oneRemark from './components/remark'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
returnBoolean
|
||||
} from '@/commons/utils/format.js';
|
||||
import color from '@/commons/color.js';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import $storageManage from '@/commons/utils/storageManage.js'
|
||||
import {
|
||||
tbShopInfo
|
||||
} from '@/http/yskApi/user.js'
|
||||
import {
|
||||
getNowCart
|
||||
} from '@/pagesCreateOrder/util.js'
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
const models = new Map();
|
||||
const modelData = reactive({
|
||||
data: {},
|
||||
selIndex: -1
|
||||
})
|
||||
//备注
|
||||
let note = ref('')
|
||||
|
||||
function setModel(el) {
|
||||
if (el && el.$attrs['name']) {
|
||||
models.set(el.$attrs['name'], el);
|
||||
}
|
||||
}
|
||||
|
||||
function showModel(key, index) {
|
||||
modelData.data = goods.list[index]
|
||||
modelData.selIndex = index
|
||||
const model = models.get(key)
|
||||
model && model.open({
|
||||
remark: modelData.data.note || ''
|
||||
})
|
||||
}
|
||||
|
||||
function formatPrice(n) {
|
||||
return Number(n).toFixed(2)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//用餐人数
|
||||
const userNumbers = reactive({
|
||||
list: new Array(100).fill(1).map((v, index) => {
|
||||
// return index === 0 ? '无' : index + '人'
|
||||
return (index + 1) + '人'
|
||||
}),
|
||||
defaultCateIndex: 0,
|
||||
})
|
||||
watch(() => userNumbers.defaultCateIndex, (newval) => {
|
||||
updateChoseCount()
|
||||
})
|
||||
|
||||
//更新就餐人数
|
||||
async function updateChoseCount() {
|
||||
console.log($shop.value);
|
||||
const maxCapacity = table.value.tableId ? (table.value.maxCapacity || 0) : 100
|
||||
if (table.value.tableId && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) {
|
||||
uni.showToast({
|
||||
title: '当前台桌最大人数为: ' + maxCapacity
|
||||
})
|
||||
userNumbers.defaultCateIndex = maxCapacity - 1
|
||||
return
|
||||
}
|
||||
if (!$shop.value.isTableFee && table.value.tableId) {
|
||||
//不免餐位费
|
||||
const res = await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: table.value.tableId || '',
|
||||
num: userNumbers.defaultCateIndex * 1 + 1,
|
||||
})
|
||||
Object.assign($seatFee, res)
|
||||
userNumbers.defaultCateIndex = res.totalNumber - 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function userNumberChange(e) {
|
||||
console.log(e);
|
||||
userNumbers.defaultCateIndex = e.detail.value
|
||||
}
|
||||
|
||||
const form = reactive({})
|
||||
//切换商品状态
|
||||
async function toggleGoodsItemKey(item, index, key) {
|
||||
const {
|
||||
productId,
|
||||
skuId,
|
||||
id,
|
||||
number,
|
||||
isPack,
|
||||
isGift
|
||||
} = item
|
||||
const par = {
|
||||
cartId: id,
|
||||
isPack,
|
||||
isGift,
|
||||
masterId: option.masterId,
|
||||
tableId: table.value.tableId || '',
|
||||
productId,
|
||||
num: number,
|
||||
skuId
|
||||
}
|
||||
par[key] = !item[key]
|
||||
const res = await Api.$updateCart(par)
|
||||
goods.list[index][key] = returnBoolean(res[key])
|
||||
if (key == 'isPack') {
|
||||
getCart()
|
||||
}
|
||||
}
|
||||
//等叫
|
||||
function toggleWait(item) {
|
||||
item.isWait = !item.isWait
|
||||
}
|
||||
|
||||
|
||||
|
||||
const eatTypes = reactive({
|
||||
list: [{
|
||||
name: "堂食",
|
||||
value: "dine-in",
|
||||
},
|
||||
{
|
||||
name: "自取",
|
||||
value: "takeout",
|
||||
}
|
||||
],
|
||||
active: 'dine-in'
|
||||
})
|
||||
|
||||
const $packFee = computed(() => {
|
||||
return goods.list.reduce((prve, cur) => {
|
||||
return prve + cur.packFee
|
||||
}, 0).toFixed(2)
|
||||
})
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
}
|
||||
|
||||
function chooseTable() {
|
||||
go.to('PAGES_CHOOSE_TABLE', {
|
||||
...table.value
|
||||
})
|
||||
}
|
||||
const option = reactive({
|
||||
masterId: '',
|
||||
tableId: ""
|
||||
})
|
||||
// 监听选择用户事件
|
||||
let user = ref(null)
|
||||
//更新选择用户
|
||||
function setUser(par) {
|
||||
console.log(option);
|
||||
const submitPar = {
|
||||
masterId: option.masterId,
|
||||
tableId: table.value.tableId || "",
|
||||
vipUserId: user.value.id ? user.value.id : '',
|
||||
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
||||
}
|
||||
Object.assign(submitPar, par)
|
||||
return Api.$setUser(submitPar)
|
||||
}
|
||||
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
console.log(data);
|
||||
user.value = data
|
||||
setUser()
|
||||
})
|
||||
}
|
||||
let table = ref(null)
|
||||
//监听桌台改变
|
||||
watch(() => table.value, (newval, oldval) => {
|
||||
if (newval && oldval) {
|
||||
// Api.$choseTable({
|
||||
// orderId: 4462,
|
||||
// oldTableId: oldval.tableId,
|
||||
// newTableId: newval.tableId,
|
||||
// })
|
||||
}
|
||||
})
|
||||
|
||||
function watchChooseTable() {
|
||||
uni.$off('choose-table')
|
||||
uni.$on('choose-table', (data) => {
|
||||
table.value = data
|
||||
console.log(table.value);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const goods = reactive({
|
||||
list: [],
|
||||
sel: 0
|
||||
})
|
||||
const goodsNumber = computed(() => {
|
||||
const result = goods.list.reduce((prve, cur) => {
|
||||
return prve + cur.number
|
||||
}, 0)
|
||||
return result
|
||||
})
|
||||
//餐位费
|
||||
const $seatFee = reactive({
|
||||
totalNumber: 0,
|
||||
totalAmount: 0,
|
||||
})
|
||||
const isVip=computed(()=>{
|
||||
return $shop.value.isMemberPrice&& user.value&&user.value.id&&user.value.isVip
|
||||
})
|
||||
const goodsPrice = computed(() => {
|
||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
const memberPrice=cur.memberPrice?cur.memberPrice:cur.salePrice
|
||||
const tPrice = (isVip.value? memberPrice:cur.salePrice) * cur.number
|
||||
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||
return prve + (cur.isGift ? 0 : tPrice) + tpackFee
|
||||
}, 0)
|
||||
return (goodsTotalPrice || 0).toFixed(2)
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
console.log(goodsPrice.value);
|
||||
const n = goodsPrice.value * 1 + $seatFee.totalAmount
|
||||
return n.toFixed(2)
|
||||
// const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
// return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
||||
// }, 0)
|
||||
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
||||
})
|
||||
const youhui=computed(()=>{
|
||||
if(user.value&&user.value.id&&user.value.isVip){
|
||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
const tPrice = cur.salePrice * cur.number
|
||||
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||
return prve + tPrice + tpackFee
|
||||
}, 0)
|
||||
return goodsTotalPrice-allPrice.value
|
||||
}else{
|
||||
return 0
|
||||
}
|
||||
return goodsTotalPrice
|
||||
})
|
||||
|
||||
function setGoodsItem(key, val) {
|
||||
item[key] = val
|
||||
}
|
||||
|
||||
function changeGoodsSel(index) {
|
||||
goods.sel = index
|
||||
}
|
||||
//获取购物车数据
|
||||
async function getCart(par = {
|
||||
page: 0,
|
||||
size: 300,
|
||||
masterId: option.masterId,
|
||||
tableId: table.value.tableId || ''
|
||||
}) {
|
||||
const {
|
||||
records,
|
||||
seatFee
|
||||
} = await Api.getCart(par)
|
||||
let useType=''
|
||||
if (seatFee && seatFee.useType) {
|
||||
useType=seatFee.useType
|
||||
$storageManage.useType(useType)
|
||||
}else{
|
||||
useType=records[0].info[0].useType
|
||||
$storageManage.useType(useType)
|
||||
}
|
||||
console.log(useType);
|
||||
eatTypes.active =useType == 'takeout' ? useType : useType.replace(
|
||||
/-after|-before/g, '');
|
||||
goods.list = getNowCart(records)
|
||||
if (seatFee && seatFee.totalNumber) {
|
||||
userNumbers.defaultCateIndex = seatFee.totalNumber - 1 || 0
|
||||
Object.assign($seatFee, seatFee)
|
||||
} else {
|
||||
$seatFee.totalAmount = 0
|
||||
}
|
||||
console.log(userNumbers.defaultCateIndex);
|
||||
}
|
||||
|
||||
let $shop = ref({
|
||||
registerType: ''
|
||||
})
|
||||
// 获取账号信息
|
||||
async function getTbShopInfo() {
|
||||
const res = await tbShopInfo()
|
||||
$shop.value = res
|
||||
console.log(res);
|
||||
return res
|
||||
}
|
||||
|
||||
// 创建订单
|
||||
async function createOrder(par = {
|
||||
masterId: option.masterId,
|
||||
vipUserId: user.value ? user.value.id : '',
|
||||
note: note.value,
|
||||
postPay: true,
|
||||
orderId: '',
|
||||
tableId: table.value.tableId || ''
|
||||
}) {
|
||||
if (!$shop.value.isTableFee) {
|
||||
//不免餐位费
|
||||
await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: table.value.tableId || "",
|
||||
num: userNumbers.defaultCateIndex + 1,
|
||||
})
|
||||
}
|
||||
if ($shop.value.registerType == 'munchies' || eatTypes.active == 'takeout') {
|
||||
const canJiesuan = await hasPermission('允许收款')
|
||||
if (!canJiesuan) {
|
||||
return
|
||||
}
|
||||
}
|
||||
// updateChoseCount()
|
||||
const res = await Api.$createOrder(par)
|
||||
uni.$emit('update:createOrderIndex')
|
||||
console.log($shop.value);
|
||||
console.log(res);
|
||||
if ($shop.value.registerType == 'munchies' || eatTypes.active == 'takeout') {
|
||||
//先付
|
||||
return go.to('PAGES_ORDER_PAY', {
|
||||
orderId: res.id,
|
||||
isNowPay: true
|
||||
}, 'redirect')
|
||||
} else {
|
||||
//后付
|
||||
console.log(option.isCreateOrderToDetail);
|
||||
if (option.isCreateOrderToDetail != '0') {
|
||||
console.log('PAGES_ORDER_DETAIL');
|
||||
go.to('PAGES_ORDER_DETAIL', {
|
||||
id: res.id
|
||||
}, 'redirect')
|
||||
} else {
|
||||
console.log('back');
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
}
|
||||
|
||||
// return go.to('PAGES_ORDER_DETAIL', {
|
||||
// id: res.id
|
||||
// })
|
||||
}
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'none'
|
||||
})
|
||||
// setTimeout(() => {
|
||||
// uni.$emit('orderDetail:update')
|
||||
// uni.navigateBack({
|
||||
// delta: 2
|
||||
// })
|
||||
// }, 500)
|
||||
}
|
||||
|
||||
//单品备注确认
|
||||
async function goodsOneRemarkConfirm(e) {
|
||||
const cart = goods.list[modelData.selIndex]
|
||||
await Api.$updateCart({
|
||||
cartId: cart.id,
|
||||
productId: cart.productId,
|
||||
skuId: cart.skuId,
|
||||
tableId: option.tableId || "",
|
||||
note: e.remark,
|
||||
num: cart.number // 0会删除此商品
|
||||
})
|
||||
cart.note = e.remark
|
||||
}
|
||||
|
||||
async function init() {
|
||||
await getTbShopInfo()
|
||||
await getCart()
|
||||
console.log($seatFee);
|
||||
if (!$seatFee.totalNumber) {
|
||||
updateChoseCount()
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt)
|
||||
console.log(opt);
|
||||
if (opt) {
|
||||
table.value = {
|
||||
...option,
|
||||
tableId: opt.tableId || '',
|
||||
name: opt.name
|
||||
}
|
||||
userNumbers.list = new Array(opt.maxCapacity ? opt.maxCapacity * 1 : 100).fill(1).map((v, index) => {
|
||||
return (index + 1) + '人'
|
||||
})
|
||||
// console.log(userNumbers.list);
|
||||
}
|
||||
init()
|
||||
|
||||
// updateChoseCount()
|
||||
})
|
||||
let bottomHeight = ref(100)
|
||||
onReady(() => {
|
||||
getSafeBottomHeight('safe-bottom').then(res => {
|
||||
console.log(res);
|
||||
bottomHeight.value = res
|
||||
})
|
||||
})
|
||||
|
||||
async function changeUseType() {
|
||||
const {
|
||||
registerType
|
||||
} = $shop.value
|
||||
//munchies 先付 restaurant 后付
|
||||
const isPayAfter = registerType == "munchies" ? false : true;
|
||||
let useType = "takeout";
|
||||
if (eatTypes.active == "takeout") {
|
||||
uni.setStorageSync("useType", "takeout");
|
||||
} else {
|
||||
//堂食
|
||||
useType = `dine-in-${isPayAfter? "after" : "before"}`;
|
||||
uni.setStorageSync("useType", useType);
|
||||
}
|
||||
const tableId = useType == 'takeout' ? undefined : table.value.tableId;
|
||||
if (!goods.list.length) {
|
||||
return
|
||||
}
|
||||
const res = await Api.$changeUseType({
|
||||
useType,
|
||||
tableId: tableId || '',
|
||||
cartIds: goods.list.map((v) => v.id),
|
||||
})
|
||||
getCart()
|
||||
return res
|
||||
}
|
||||
watch(() => eatTypes.active, (newval) => {
|
||||
changeUseType()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
})
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
watchChooseTable()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.fen {
|
||||
color: #FF9F2E;
|
||||
}
|
||||
|
||||
.page-gray {
|
||||
padding: 32rpx 28rpx 0 28rpx;
|
||||
}
|
||||
|
||||
.headeimg {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
}
|
||||
|
||||
.block {
|
||||
background-color: #fff;
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 18rpx;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.textarea {
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
padding: 32rpx 0 32rpx 24rpx;
|
||||
border: 1px solid #999999;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.goods {
|
||||
// padding-bottom: 30rpx;
|
||||
border-bottom: 1px dashed #E5E5E5;
|
||||
|
||||
.item {
|
||||
.img {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.headeimg {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
background-color: #eee;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #EB4F4F;
|
||||
}
|
||||
|
||||
.opacity0 {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.fixed {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.safe-bottom {
|
||||
padding: 34rpx 28rpx;
|
||||
background-color: #fff;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 10;
|
||||
|
||||
.btn {
|
||||
padding: 0 88rpx 56rpx 88rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tag {
|
||||
background-color: #fff;
|
||||
border: 1px solid #E5E5E5;
|
||||
line-height: inherit;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
|
||||
.hover-class {
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
</style>
|
||||
536
pagesCreateOrder/index/components/car.vue
Normal file
@@ -0,0 +1,536 @@
|
||||
<template>
|
||||
<view class="mask" @tap="hideGoods" v-if="switchGoods">
|
||||
|
||||
</view>
|
||||
<view class="fixed goods-box u-flex u-flex-col" :class="{active:switchGoods}" @tap.stop="nullFun">
|
||||
<view class="u-row-between top u-flex">
|
||||
<view class="u-flex">
|
||||
<view>
|
||||
<up-icon name="shopping-cart-fill" size="20" color="rgb(102,102,102)"></up-icon>
|
||||
</view>
|
||||
<view class="u-m-l-10">
|
||||
已选菜品({{goodsNumber}})
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex" @click="setModalShow('clear',true)">
|
||||
<view>
|
||||
<up-icon name="trash-fill" size="20" color="rgb(102,102,102)"></up-icon>
|
||||
</view>
|
||||
<view class="u-m-l-10">
|
||||
清空点餐
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view>合计:</view>
|
||||
<view class="u-m-l-10 color-red font-bold allPrice">{{allPrice}}</view>
|
||||
<view class="">元</view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" class=" u-flex-1 ">
|
||||
<view class=" ">
|
||||
<view class="color-333item border-bottom u-p-l-20 u-p-r-20 u-p-b-10 u-p-t-20 u-flex u-row-center u-row-between"
|
||||
v-for="(item,index) in data" :key="index">
|
||||
<view class="u-flex u-col-top">
|
||||
<view class="u-p-r-20">
|
||||
{{index+1}}
|
||||
</view>
|
||||
<view class="">
|
||||
<view>{{item.name}}</view>
|
||||
<view class="u-m-t-10 u-font-24 color-666">{{item.specSnap||''}}</view>
|
||||
<view class="u-flex u-m-t-14">
|
||||
<up-icon name="edit-pen" @click="showModel('remark',index)" color="#333" size="16"></up-icon>
|
||||
<view class="color-666 u-font-24">
|
||||
{{item.note}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex">
|
||||
<view class="font-bold red u-m-r-32">¥{{formatPrice(item.salePrice*item.number) }}</view>
|
||||
<view class="u-flex" @tap="updateNumber(false,index,item)">
|
||||
<image src="/pagesCreateOrder/static/images/icon-reduce-black.svg" class="icon" mode="">
|
||||
</image>
|
||||
</view>
|
||||
<view class="u-p-l-30 u-p-r-30 color-333" style="">
|
||||
{{item.number}}
|
||||
</view>
|
||||
<view class="u-flex" @tap="updateNumber(true,index,item)">
|
||||
<image src="/pagesCreateOrder/static/images/icon-add-black.svg" class="icon" mode="">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<my-empty v-if="!data.length" text="暂未有添加商品"></my-empty>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
<view class="u-row-between bottom u-flex">
|
||||
<view class="u-flex" @click="hideGoods">
|
||||
<view>
|
||||
<up-icon name="arrow-left" size="14" color="#333"></up-icon>
|
||||
</view>
|
||||
<view class="u-m-l-10">
|
||||
返回
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex luodan" @click="toConfimOrder">
|
||||
<view>落单</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="car u-flex u-row-between u-col-bottom u-relative" @touchmove.stop.prevent="moveHandle"
|
||||
:style="{transform: 'translateY(' + offset.y + 'px)'}" @touchstart="touchstart"
|
||||
@touchmove="touchmove" @touchend="touchend">
|
||||
<view class="u-absolute goods bg-fff">
|
||||
<view
|
||||
class="u-p-t-32 color-666 border-bottom bg-fff u-absolute total u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between">
|
||||
<view>已添加{{goodsNumber}}件商品</view>
|
||||
<view class="color-666" @tap="setModalShow('clear',true)">
|
||||
<uni-icons color="#666" type="trash"></uni-icons>
|
||||
<text class="u-m-l-10">清空</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="icon-car-box" @tap="toggleGoods">
|
||||
<image src="/pagesCreateOrder/static/images/icon-car.svg" class="icon-car" />
|
||||
<view class="dot">{{goodsNumber}}</view>
|
||||
</view>
|
||||
<!-- <view class="price font-bold u-flex">
|
||||
<view>¥</view>
|
||||
<view>{{allPrice}}</view>
|
||||
</view> -->
|
||||
<!-- <my-button shape="circle" height="80" width="220" @tap="toConfimOrder">
|
||||
<text class="u-font-32 font-bold">{{table.type=='add'?'确认加菜':'去下单'}} </text>
|
||||
</my-button> -->
|
||||
|
||||
|
||||
</view>
|
||||
<up-modal title="提示" content="是否清空全部已添加的商品?" :show="modal.clear" showCancelButton closeOnClickOverlay
|
||||
@confirm="confirmModelConfirm" @cancel="setModalShow('clear',false)" @close="setModalShow('clear',false)"
|
||||
width="300px"></up-modal>
|
||||
<one-remark width="400px" @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import oneRemark from '/pagesCreateOrder/confirm-order/components/remark'
|
||||
import {
|
||||
formatPrice
|
||||
} from '@/commons/utils/format.js';
|
||||
import {
|
||||
getElRect
|
||||
} from '@/commons/utils/safe-bottom.js'
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
onMounted,
|
||||
reactive,
|
||||
watch
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
sysInfo:{
|
||||
type: Object,
|
||||
default:()=>{
|
||||
return {
|
||||
windowWidth: 0,
|
||||
windowHeight: 0,
|
||||
statusBarHeight:0
|
||||
}
|
||||
}
|
||||
},
|
||||
instance: {
|
||||
type: Object,
|
||||
default: {
|
||||
|
||||
}
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
isCreateOrderToDetail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
user: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
id: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
tableId: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
masterId: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
const edmits = defineEmits(['clear', 'updateNumber', 'updateSafeBottom','updateCart'])
|
||||
const modal = reactive({
|
||||
key: '',
|
||||
clear: false
|
||||
})
|
||||
|
||||
const models = new Map();
|
||||
const modelData = reactive({
|
||||
data: {},
|
||||
selIndex: -1
|
||||
})
|
||||
//备注
|
||||
let note = ref('')
|
||||
|
||||
function setModel(el) {
|
||||
if (el && el.$attrs['name']) {
|
||||
models.set(el.$attrs['name'], el);
|
||||
}
|
||||
}
|
||||
|
||||
function showModel(key, index) {
|
||||
modelData.data = props.data[index]
|
||||
modelData.selIndex = index
|
||||
const model = models.get(key)
|
||||
model && model.open({
|
||||
remark: modelData.data.note||''
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function confirmModelConfirm() {
|
||||
if (modal.key == 'clear') {
|
||||
clear()
|
||||
}
|
||||
}
|
||||
|
||||
//单品备注确认
|
||||
async function goodsOneRemarkConfirm(e) {
|
||||
const cart = props.data[modelData.selIndex]
|
||||
await Api.$updateCart({
|
||||
cartId: cart.id,
|
||||
productId: cart.productId,
|
||||
skuId: cart.skuId,
|
||||
tableId: props.table.tableId,
|
||||
note: e.remark,
|
||||
num: cart.number // 0会删除此商品
|
||||
})
|
||||
edmits('updateCart')
|
||||
}
|
||||
|
||||
function setModalShow(key = 'show', show = true) {
|
||||
if (key == 'clear' && show && props.data.length <= 0) {
|
||||
return infoBox.showToast('购物车是空的!')
|
||||
}
|
||||
modal.key = key
|
||||
modal[key] = show
|
||||
console.log(modal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function nullFun() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// mask
|
||||
let switchGoods = ref(false)
|
||||
|
||||
function hideGoods() {
|
||||
switchGoods.value = false
|
||||
}
|
||||
|
||||
function showGoods() {
|
||||
switchGoods.value = true
|
||||
}
|
||||
|
||||
function toggleGoods() {
|
||||
switchGoods.value = !switchGoods.value
|
||||
}
|
||||
|
||||
function toConfimOrder() {
|
||||
console.log(props.user);
|
||||
if (props.data.length <= 0) {
|
||||
return infoBox.showToast('还没有选择商品')
|
||||
}
|
||||
const {
|
||||
tableId,
|
||||
name,
|
||||
maxCapacity,
|
||||
status,
|
||||
type
|
||||
} = props.table
|
||||
if (props.table.tableId == '') {
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
masterId: props.masterId,
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
})
|
||||
}else{
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
masterId: props.masterId,
|
||||
type,
|
||||
tableId,
|
||||
name,
|
||||
maxCapacity,
|
||||
status,
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
})
|
||||
}
|
||||
hideGoods()
|
||||
}
|
||||
|
||||
const allPrice = computed(() => {
|
||||
return props.data.reduce((prve, cur) => {
|
||||
return prve + cur.salePrice * cur.number
|
||||
}, 0).toFixed(2)
|
||||
})
|
||||
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0
|
||||
result = props.data.reduce((prve, cur) => {
|
||||
return prve + cur.number
|
||||
}, 0)
|
||||
return result >= 99 ? 99 : result
|
||||
})
|
||||
|
||||
function updateNumber(isAdd, index, goods) {
|
||||
const step = isAdd ? 1 : -1
|
||||
const newval = goods.number + step
|
||||
const par = {
|
||||
num: newval,
|
||||
index: index,
|
||||
goods: goods
|
||||
}
|
||||
edmits('updateNumber', par)
|
||||
}
|
||||
|
||||
|
||||
const offset = ref({
|
||||
x: 0,
|
||||
y: (props.sysInfo.windowHeight-70-40)/2
|
||||
})
|
||||
const startPoint = ref({
|
||||
x: 0,
|
||||
y: 0
|
||||
})
|
||||
watch(()=>props.sysInfo.windowHeight,(newval)=>{
|
||||
console.log('---------');
|
||||
console.log(newval);
|
||||
offset.value.y=(newval-70-40)/2
|
||||
})
|
||||
function touchstart(event) {
|
||||
startPoint.value = {
|
||||
x: event.touches[0].clientX,
|
||||
y: event.touches[0].clientY
|
||||
};
|
||||
}
|
||||
|
||||
function touchmove(event) {
|
||||
const currentPoint = {
|
||||
x: event.touches[0].clientX,
|
||||
y: event.touches[0].clientY
|
||||
};
|
||||
const delta = {
|
||||
x: currentPoint.x - startPoint.value.x,
|
||||
y: currentPoint.y - startPoint.value.y
|
||||
};
|
||||
const minY=props.sysInfo.statusBarHeight||0 ,maxY=props.sysInfo.windowHeight-70-40;
|
||||
let newY=offset.value.y + delta.y
|
||||
if(newY>maxY){
|
||||
newY=maxY
|
||||
}
|
||||
if(newY<minY){
|
||||
newY=minY
|
||||
}
|
||||
offset.value = {
|
||||
// x: offset.value.x + delta.x,
|
||||
y: newY
|
||||
};
|
||||
startPoint.value = currentPoint;
|
||||
}
|
||||
|
||||
function moveHandle() {
|
||||
return false
|
||||
}
|
||||
|
||||
function touchend(e) {
|
||||
// 触摸结束时,重置起始坐标
|
||||
}
|
||||
|
||||
function clear() {
|
||||
setModalShow('clear', false)
|
||||
edmits('clear')
|
||||
hideGoods()
|
||||
}
|
||||
onMounted(() => {
|
||||
getElRect('car', props.instance).then(res => {
|
||||
console.log(res);
|
||||
edmits('updateSafeBottom', res)
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$car-size: 70px;
|
||||
$car-top: -16rpx;
|
||||
|
||||
.luodan {
|
||||
background-color: $my-main-color;
|
||||
padding: 10px 30px;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.allPrice {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.goods-box {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 80px;
|
||||
bottom: 80px;
|
||||
left: 30%;
|
||||
right: 0;
|
||||
background-color: #fff;
|
||||
border-radius: 12px 0 0 12px;
|
||||
overflow: hidden;
|
||||
transition: all .2s ease-in-out;
|
||||
transform: translateX(100%);
|
||||
z-index: 10;
|
||||
&.active {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.top {
|
||||
width: 100%;
|
||||
color: rgb(102, 102, 102);
|
||||
font-size: 16px;
|
||||
background-color: rgb(233, 233, 238);
|
||||
padding: 14px 20px;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
padding: 14px 20px;
|
||||
border-top: 1px solid #eee;
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin fixedAll {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.total {
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx
|
||||
}
|
||||
|
||||
.mask {
|
||||
@include fixedAll;
|
||||
background: rgba(51, 51, 51, 0.5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.goods {
|
||||
position: fixed;
|
||||
width: 50vh;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
transition: all .2s ease-in-out;
|
||||
overflow: hidden;
|
||||
z-index: 3;
|
||||
|
||||
.item {
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
// border-bottom: 1px solid #E5E5E5;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
// border-top: 1px solid #E5E5E5;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #EB4F4F;
|
||||
}
|
||||
|
||||
.car {
|
||||
position: fixed;
|
||||
right: 20px;
|
||||
top: 40px;
|
||||
// top: 50%;
|
||||
// transform: translateY(-50%);
|
||||
|
||||
.icon-car-box {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: $car-size;
|
||||
height: $car-size;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
|
||||
.dot {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
background: #EB4F4F;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 20rpx;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #EB4F4F;
|
||||
margin-left: calc(38rpx + $car-size);
|
||||
transform: translateY(calc($car-top / 2));
|
||||
}
|
||||
|
||||
.icon-car {
|
||||
width: $car-size;
|
||||
height: $car-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
230
pagesCreateOrder/index/components/cart-goods-item.vue
Normal file
@@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<view class="u-relative u-flex item box-shadow " @tap="emitEvent('showDetail')">
|
||||
<view class="img">
|
||||
<image lazy-load :src="data.coverImg" mode="aspectFill"></image>
|
||||
</view>
|
||||
<!-- <image lazy-load class="img" :src="data.coverImg" mode="" ></image> -->
|
||||
<view class="info u-flex u-flex-col u-row-right " >
|
||||
<view class="u-flex w-full u-row-right u-p-r-20 u-p-b-16 u-flex-1 u-flex-col">
|
||||
<template v-if="!isSellout">
|
||||
<template v-if="data.typeEnum=='sku'">
|
||||
<view class="u-flex u-row-right w-full">
|
||||
<view class="u-flex">
|
||||
<button class="btn" hover-class="btn-hover-class" @tap.stop="emitEvent('chooseGuige')">选规格</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="u-flex w-full u-row-right ">
|
||||
<view class="u-flex icon-btn">
|
||||
<template v-if="data.chooseNumber">
|
||||
<view class="u-flex" @tap.stop="emitEvent('reduce')">
|
||||
<image src="/pagesCreateOrder/static/images/icon-reduce.svg" class="icon" mode="">
|
||||
</image>
|
||||
</view>
|
||||
<view class="u-font-32 ">
|
||||
{{data.chooseNumber}}
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex" @tap.stop="emitEvent('add')">
|
||||
<image src="/pagesCreateOrder/static/images/icon-add.svg" class="icon" mode="">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class=" u-m-t-16 u-row-center u-col-center">
|
||||
已售罄
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="bg-fff u-p-20 w-full">
|
||||
<view class="u-flex u-row-between u-font-16">
|
||||
<view>{{data.name}}</view>
|
||||
<view class=" font-bold u-m-t-16">
|
||||
¥{{data.lowPrice}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
toRef,
|
||||
toRefs,
|
||||
watch
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
img: {
|
||||
type: Object,
|
||||
default: {
|
||||
width: '250rpx',
|
||||
height: '272rpx'
|
||||
}
|
||||
},
|
||||
windowWidth: {
|
||||
//px
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
windowHeight: {
|
||||
//px
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
layout: {
|
||||
type: String,
|
||||
default: 'default'
|
||||
},
|
||||
index: {
|
||||
type: [Number, String],
|
||||
},
|
||||
isSeatFee: {
|
||||
//是否为餐位费
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
chooseNumber: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
gap: {
|
||||
//px
|
||||
type: Number,
|
||||
default: 20
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.windowWidth, (newval) => {
|
||||
console.log(newval);
|
||||
})
|
||||
|
||||
const computedImgStyle = computed(() => {
|
||||
const stylobj = {
|
||||
width: props.img.width,
|
||||
height: props.img.height
|
||||
}
|
||||
if (props.layout == 'default') {
|
||||
stylobj.width = (props.windowWidth - props.gap * 3) / 2 + 'px'
|
||||
stylobj.height = (props.windowHeight - props.gap * 2 - 40) / 2 + 'px'
|
||||
console.log(stylobj);
|
||||
return stylobj
|
||||
}
|
||||
return stylobj
|
||||
})
|
||||
// function computedImgStyle() {
|
||||
// return {
|
||||
// width: props.img.width,
|
||||
// height: props.img.height
|
||||
// }
|
||||
// }
|
||||
|
||||
//判断是否是菜品
|
||||
function isGoods() {
|
||||
return props.data.hasOwnProperty('id')
|
||||
}
|
||||
|
||||
//判断商品是否售尽
|
||||
const isSellout = computed(() => {
|
||||
const item = props.data
|
||||
if(!isGoods()){
|
||||
return false
|
||||
}
|
||||
return (
|
||||
item.isPauseSale ||
|
||||
(item.typeEnum !== "sku" && item.isStock==1&& item.stockNumber <= 0)
|
||||
);
|
||||
})
|
||||
|
||||
|
||||
const emits = defineEmits(['add', 'reduce', 'chooseGuige','showDetail'])
|
||||
|
||||
function emitEvent(emitName) {
|
||||
if (isGoods()) {
|
||||
emits(emitName, props.index)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.icon {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: #EB4F4F;
|
||||
border-radius: 100rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
padding: 0 50rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-hover-class {
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
.item {
|
||||
// width: 250rpx;
|
||||
// height: 272rpx;
|
||||
background: #F9B798;
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
&.default {
|
||||
.img {}
|
||||
}
|
||||
|
||||
.img {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
object-fit: contain;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
// background: rgba(37, 22, 15, 0.5);
|
||||
border-radius: 0 0 12px 12px;
|
||||
overflow: hidden;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
249
pagesCreateOrder/index/components/guige.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<my-model ref="model" borderRadius="12" :title="title" width="50vw">
|
||||
<template #desc>
|
||||
<scroll-view scroll-y="true" style="height: 50vh;" class="u-p-30 guigeModel">
|
||||
<view class="u-m-b-40" v-for="(item,index) in skus" :key="index">
|
||||
<view class="u-text-left">
|
||||
<view class="color-333">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-20 u-flex-wrap">
|
||||
<view class="item" @tap="chooseSkd(index,skd)"
|
||||
:class="{active:item.sel===skd.name,disabled:skd.disabled}"
|
||||
v-for="(skd,skdIndex) in item.values" :key="skdIndex">
|
||||
{{skd.name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
<template #btn>
|
||||
<view class="u-p-30 border-top ">
|
||||
<view class="u-flex u-p-b-30 u-row-between">
|
||||
<view class="price">
|
||||
<template v-if="goods&&goods.isGrounding">
|
||||
<text>¥</text>
|
||||
<text>{{to2(goods.salePrice*number) }}</text>
|
||||
</template>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="u-flex" @tap="reduce">
|
||||
<image src="/pagesCreateOrder/static/images/icon-reduce-black.svg" class="icon" mode="">
|
||||
</image>
|
||||
</view>
|
||||
<view class="u-m-l-30 u-m-r-30 color-333">
|
||||
{{number}}
|
||||
</view>
|
||||
<view class="u-flex" @tap="add">
|
||||
<image src="/pagesCreateOrder/static/images/icon-add-black.svg" class="icon" mode="">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="close" type="cancel" v-if="isDisabled">
|
||||
<view class="color-999">已下架/售罄</view>
|
||||
</my-button>
|
||||
<my-button @tap="confirm" v-else>添加</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</my-model>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import util from '../util.js';
|
||||
import infobox from '@/commons/utils/infoBox.js'
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
const props = defineProps({
|
||||
goodsData: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
skuMap: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
skus: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
defaultIndex: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function to2(number) {
|
||||
return Number(number).toFixed(2)
|
||||
}
|
||||
|
||||
|
||||
|
||||
const selSku = computed(() => {
|
||||
return props.skus.reduce((prve, cur) => {
|
||||
prve.push(cur.sel)
|
||||
return prve
|
||||
}, []).join()
|
||||
})
|
||||
|
||||
|
||||
const goods = computed(() => {
|
||||
return props.skuMap[selSku.value]
|
||||
})
|
||||
watch(() => goods.value, (newval) => {
|
||||
console.log(props.goodsData.isStock);
|
||||
number.value = newval.suit || 1
|
||||
})
|
||||
|
||||
|
||||
const isCanBuy=computed(()=>{
|
||||
if(!goods.value) {
|
||||
return false
|
||||
}
|
||||
console.log(util.isCanBuy({
|
||||
...goods.value,
|
||||
isStock: props.goodsData.isStock
|
||||
}));
|
||||
return util.isCanBuy({
|
||||
...goods.value,
|
||||
isStock: props.goodsData.isStock
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//全部规格是否都无法使用
|
||||
const isAllDisabled = computed(() => {
|
||||
console.log(props.skus);
|
||||
return props.skus.reduce((prve, cur) => {
|
||||
return prve && cur.values.filter(v => v.disabled).length === cur.values.length
|
||||
}, true)
|
||||
})
|
||||
|
||||
const emits = defineEmits(['confirm', 'updateSku'])
|
||||
let number = ref(1)
|
||||
|
||||
|
||||
function chooseSkd(skusIndex, skd) {
|
||||
const {
|
||||
name,
|
||||
disabled
|
||||
} = skd
|
||||
if (disabled) {
|
||||
return
|
||||
}
|
||||
if (props.skus[skusIndex].sel != name) {
|
||||
emits('updateSku', skusIndex, name)
|
||||
}
|
||||
}
|
||||
const defaultIndex = reactive(new Array(props.skus.length).fill(''))
|
||||
for (let i in props.defaultIndex) {
|
||||
defaultIndex[i] = props.defaultIndex[i]
|
||||
}
|
||||
const activeArr = defaultIndex
|
||||
|
||||
|
||||
const model = ref(null)
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
}
|
||||
|
||||
function close() {
|
||||
model.value.close()
|
||||
}
|
||||
|
||||
const isDisabled=computed(()=>{
|
||||
return isAllDisabled.value || !isCanBuy.value
|
||||
})
|
||||
|
||||
function reduce() {
|
||||
if (isDisabled.value) {
|
||||
return
|
||||
}
|
||||
const suit = goods.value.suit || 1
|
||||
const newval = number.value - 1
|
||||
if (newval < suit) {
|
||||
return infobox.showToast(suit + '个起售')
|
||||
}
|
||||
number.value = newval <= 1 ? 1 : newval
|
||||
}
|
||||
|
||||
function add() {
|
||||
if (isDisabled.value) {
|
||||
return
|
||||
}
|
||||
const newval = number.value + 1
|
||||
number.value = newval
|
||||
}
|
||||
|
||||
|
||||
|
||||
function confirm() {
|
||||
close()
|
||||
if (isDisabled.value) {
|
||||
return
|
||||
}
|
||||
emits('confirm', goods.value, number.value)
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.border-top {}
|
||||
|
||||
.icon {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.guigeModel {
|
||||
.item {
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
padding: 4rpx 28rpx;
|
||||
border: 1px solid #E5E5E5;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
transition: all .2s ease-in-out;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: #ccc;
|
||||
border-color: #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #EB4F4F;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #E5E5E5;
|
||||
}
|
||||
</style>
|
||||
133
pagesCreateOrder/index/components/pop-goods-detail.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="12">
|
||||
|
||||
<view class="bg-fff box u-font-28 w-full u-relative">
|
||||
<view class="u-absolute close">
|
||||
<u-icon name="close" size="20" @click="close"></u-icon>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" class="scroll-box" >
|
||||
<template v-if="data.images.length>1">
|
||||
<swiper class="scroll-box" :indicator-dots="true" :autoplay="false" :interval="3000" :duration="300">
|
||||
<swiper-item v-for="(item,index) in data.images" :key="index">
|
||||
<view class="swiper-item">
|
||||
<!-- <image class="coverImg w-full" @click="prveImg(data.images,item)" :src="item" mode="widthFix"></image> -->
|
||||
<image class="coverImg w-full" :src="item" mode="widthFix"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="u-flex u-row-center">
|
||||
<!-- <image class="coverImg w-full" @click="prveImg([data.coverImg],data.coverImg) " :src="data.coverImg" mode="widthFix"></image> -->
|
||||
<image class="coverImg w-full" :src="data.coverImg" mode="widthFix"></image>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="u-p-20">
|
||||
<view class="u-font-16 font-bold">{{data.name}}</view>
|
||||
<view class="u-m-t-12 color-666">
|
||||
<rich-text :nodes="data.shortTitle"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
nextTick
|
||||
} from 'vue';
|
||||
import {prveImg} from '@/commons/utils/prveImg.js'
|
||||
const refForm = ref(null)
|
||||
let searchVal = ref('')
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
goods: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
images: []
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
let data = ref(props.goods)
|
||||
const emits = defineEmits(['update:show', 'search'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = {
|
||||
...props.goods,
|
||||
images: typeof props.goods.images === 'string' ? JSON.parse(props.goods.images) : props.goods
|
||||
.images
|
||||
}
|
||||
}
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
|
||||
function search() {
|
||||
emits('search', searchVal.value)
|
||||
close()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.coverImg {
|
||||
// width: calc(100vw - 80px);
|
||||
}
|
||||
|
||||
.box {
|
||||
width: calc(100vw - 80px);
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.scroll-box {
|
||||
height: calc(100vh - var(--status-bar-height) - 20px);
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 14px;
|
||||
top: 14px;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: 0 0 2px #eee;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
74
pagesCreateOrder/index/components/pop-search.vue
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="top" :round="0">
|
||||
<view class="u-p-32 box u-font-28">
|
||||
<up-search v-model="searchVal" @search="search" @clear="search" @click="search"></up-search>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
nextTick
|
||||
} from 'vue';
|
||||
|
||||
const refForm = ref(null)
|
||||
let searchVal=ref('')
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
let data = ref(props.goods)
|
||||
const emits = defineEmits(['update:show', 'search'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = {
|
||||
...props.goods
|
||||
}
|
||||
}
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
function search(){
|
||||
emits('search',searchVal.value)
|
||||
close()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
155
pagesCreateOrder/index/components/skeleton.vue
Normal file
@@ -0,0 +1,155 @@
|
||||
<template>
|
||||
<view class="all-page position-all bg-gray u-flex u-flex-col" @click="skeletonClick">
|
||||
<view class="u-flex category u-flex-row">
|
||||
<view class="category-item u-flex u-flex-row skeletion " v-for="(item,index) in 14" :key="index">
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-flex u-flex-row bottom">
|
||||
<view class="left skeletion u-flex-1"></view>
|
||||
<view class="right skeletion u-flex-1"></view>
|
||||
</view>
|
||||
<view class="car">
|
||||
<view class="icon-car-box" >
|
||||
<image src="/pagesCreateOrder/static/images/icon-car.svg" class="icon-car" />
|
||||
<view class="dot">0</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import myCar from './car'
|
||||
const emits=defineEmits(['skeletonClick'])
|
||||
function skeletonClick(){
|
||||
emits('skeletonClick')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$categoryLen: 10;
|
||||
|
||||
.gap-20 {
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.all-page {
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
@keyframes skeleton {
|
||||
0% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
|
||||
100% {
|
||||
background-position: 0 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.skeletion {
|
||||
background: linear-gradient(90deg, #F1F2F4 25%, #e6e6e6 37%, #F1F2F4 50%);
|
||||
background-size: 400% 100%;
|
||||
border-radius: 3px;
|
||||
animation: skeleton 1.8s ease infinite;
|
||||
}
|
||||
|
||||
.left {
|
||||
background-color: #F1F2F4;
|
||||
width: 400px;
|
||||
border-radius: 12px;
|
||||
height: calc(100vh - 84px);
|
||||
flex: 1;
|
||||
// height: calc(100vh - 64px);
|
||||
}
|
||||
|
||||
.right {
|
||||
border-radius: 12px;
|
||||
height: calc(100vh - 84px);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.category {
|
||||
background-color: #fff;
|
||||
padding-bottom: 10px;
|
||||
/* #ifdef H5 */
|
||||
padding-top: 10px;
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
padding-top: calc(var(--status-bar-height));
|
||||
/* #endif */
|
||||
.category-item {
|
||||
width: calc(100vw / 14);
|
||||
height: 24px;
|
||||
margin-right: 10px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// background-color: red;
|
||||
padding: 20px 20px 20px 20px;
|
||||
gap: 20px;
|
||||
box-sizing: border-box;
|
||||
.left{
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
}
|
||||
.right{
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
$car-size: 70px;
|
||||
$car-top: -16rpx;
|
||||
.car {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
// top: 50%;
|
||||
// transform: translateY(-50%);
|
||||
|
||||
.icon-car-box {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: $car-size;
|
||||
height: $car-size;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
|
||||
.dot {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
background: #EB4F4F;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 20rpx;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #EB4F4F;
|
||||
margin-left: calc(38rpx + $car-size);
|
||||
transform: translateY(calc($car-top / 2));
|
||||
}
|
||||
|
||||
.icon-car {
|
||||
width: $car-size;
|
||||
height: $car-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
109
pagesCreateOrder/index/components/surcharge.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||
<template #desc>
|
||||
<view class="u-text-left u-p-30 ">
|
||||
<view>
|
||||
<view>名称</view>
|
||||
<view class="u-m-t-24 border u-flex input-box">
|
||||
<input v-model="form.name" type="text" placeholder-class="placeholder-class"
|
||||
placeholder="请输入名称" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view>价格</view>
|
||||
<view class="u-m-t-24 border u-flex input-box">
|
||||
<input v-model="form.price" type="digit" placeholder-class="placeholder-class"
|
||||
placeholder="请输入价格" />
|
||||
</view>
|
||||
</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,
|
||||
ref
|
||||
} from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
})
|
||||
|
||||
const $form = {
|
||||
name: '',
|
||||
price: ''
|
||||
}
|
||||
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 {
|
||||
name,
|
||||
price
|
||||
} = form
|
||||
if (!name) {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入附加费名称'
|
||||
})
|
||||
}
|
||||
close()
|
||||
emits('confirm',{
|
||||
name,
|
||||
price
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.border {
|
||||
border: 1px solid #E5E5E5;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.input-box {
|
||||
padding: 22rpx 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.placeholder-class {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
</style>
|
||||
90
pagesCreateOrder/index/components/swiper-page.nvue
Normal file
@@ -0,0 +1,90 @@
|
||||
<template>
|
||||
<view class="uni-swiper-page">
|
||||
<list ref="list" class="list" :offset-accuracy="5" :bounce="true" isSwiperList="true" :show-scrollbar="false">
|
||||
<cell v-for="(item, index) in dataList" :key="item.id" :ref="'item'+index" @click="onclick">
|
||||
<view class="list-item">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</cell>
|
||||
<cell class="loading"></cell>
|
||||
</list>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
pid: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
},
|
||||
parentId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scrollable: true,
|
||||
dataList: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
for (var i = 1; i <= 32; i++) {
|
||||
this.dataList.push({
|
||||
id: i,
|
||||
name: i
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setScrollRef(height) {
|
||||
if (this.$refs['list'].setSpecialEffects) {
|
||||
this.$refs['list'].setSpecialEffects({
|
||||
id: this.parentId,
|
||||
headerHeight: height
|
||||
});
|
||||
}
|
||||
},
|
||||
onclick(e) {
|
||||
console.log("onclick");
|
||||
},
|
||||
loadData() {
|
||||
// 首次激活时被调用
|
||||
},
|
||||
clear() {
|
||||
// 释放数据时被调用,参考 swiper-list 缓存配置
|
||||
this.dataList.length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.uni-swiper-page {
|
||||
flex: 1;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.list {
|
||||
flex: 1;
|
||||
background-color: #ebebeb;
|
||||
}
|
||||
|
||||
.list-item {
|
||||
margin-left: 12px;
|
||||
margin-right: 12px;
|
||||
margin-top: 12px;
|
||||
padding: 20px;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.loading {
|
||||
height: 20px;
|
||||
}
|
||||
</style>
|
||||
1535
pagesCreateOrder/index/index - 副本.vue
Normal file
1564
pagesCreateOrder/index/index-back.vue
Normal file
1740
pagesCreateOrder/index/index.vue
Normal file
175
pagesCreateOrder/index/util.js
Normal file
@@ -0,0 +1,175 @@
|
||||
import {
|
||||
$productCategory,
|
||||
$layoutpage
|
||||
} from '@/http/yskApi/pad.js'
|
||||
|
||||
//根据布局返回商品列表
|
||||
export function returnSelCategotyGoods(arr, size) {
|
||||
// 检查size是否为正整数
|
||||
if (size <= 0) {
|
||||
throw new Error('Size must be a positive integer.');
|
||||
}
|
||||
|
||||
// 计算数组的长度,并确保size不会超过数组长度
|
||||
const length = arr.length;
|
||||
size = Math.min(size, length);
|
||||
|
||||
// 创建一个新数组来存储结果
|
||||
const groups = [];
|
||||
|
||||
// 循环遍历原始数组,每size个元素分为一组
|
||||
for (let i = 0; i < length; i += size) {
|
||||
groups.push(arr.slice(i, i + size)); // 使用slice方法获取子数组
|
||||
}
|
||||
|
||||
return groups; // 返回新的数组
|
||||
}
|
||||
//根据店铺信息返回是否是后付款
|
||||
export function $trturnPayAfter(shop) {
|
||||
//munchies 先付 restaurant 后付
|
||||
const payAfter = shop.registerType == "munchies" ? false : true;
|
||||
return payAfter
|
||||
}
|
||||
//根据店铺信息返回就餐类型
|
||||
export function $returnUseType(shop, useType) {
|
||||
//是否是后付款
|
||||
const payAfter = $trturnPayAfter(shop)
|
||||
let result = "takeout";
|
||||
if (useType == "takeout") {
|
||||
result = 'takeout'
|
||||
} else {
|
||||
//堂食
|
||||
result = `dine-in-${payAfter ? "after" : "before"}`;
|
||||
}
|
||||
return result
|
||||
}
|
||||
//判断商品是否可以下单
|
||||
export function isCanBuy(goods, isStock) {
|
||||
return goods.isGrounding && goods.isPauseSale == 0 && (isStock ? goods.stockNumber > 0 : true);
|
||||
}
|
||||
|
||||
|
||||
// 一个数组是否包含另外一个数组全部元素
|
||||
function arrayContainsAll(arr1, arr2) {
|
||||
for (let i = 0; i < arr2.length; i++) {
|
||||
if (!arr1.includes(arr2[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//n项 n-1项组合,生成全部结果
|
||||
function generateCombinations(arr, k) {
|
||||
let result = [];
|
||||
|
||||
function helper(index, current) {
|
||||
if (current.length === k) {
|
||||
result.push(current.slice()); // 使用slice()来避免直接修改原始数组
|
||||
} else {
|
||||
for (let i = index; i < arr.length; i++) {
|
||||
current.push(arr[i]); // 将当前元素添加到组合中
|
||||
helper(i + 1, current); // 递归调用,索引增加以避免重复选择相同的元素
|
||||
current.pop(); // 回溯,移除当前元素以便尝试其他组合
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
helper(0, []); // 从索引0开始,初始空数组作为起点
|
||||
return result;
|
||||
}
|
||||
|
||||
export function returnReverseVal(val, isReturnString = true) {
|
||||
const isBol = typeof val === "boolean";
|
||||
const isString = typeof val === "string";
|
||||
let reverseNewval = "";
|
||||
if (isBol) {
|
||||
reverseNewval = !val;
|
||||
}
|
||||
if (isString) {
|
||||
reverseNewval = val === "true" ? "false" : "true";
|
||||
}
|
||||
return reverseNewval;
|
||||
}
|
||||
|
||||
export function returnPrveId(par) {
|
||||
const obj = {
|
||||
prveData: [],
|
||||
nowData: [],
|
||||
nextData: [],
|
||||
page: 0
|
||||
}
|
||||
Object.assign(obj, par)
|
||||
if (par.page == 0 || par.nowData.length <= 1) {
|
||||
const prveIndex = obj.prveData.length - 1 <= 0 ? 0 : obj.prveData.length - 1
|
||||
return obj.prveData[prveIndex] ? obj.prveData[prveIndex].id : undefined
|
||||
}
|
||||
return obj.nowData[par.page - 1] ? obj.nowData[par.page - 1].id : undefined
|
||||
|
||||
}
|
||||
export function returnNowId(par) {
|
||||
const obj = {
|
||||
prveData: [],
|
||||
nowData: [],
|
||||
nextData: [],
|
||||
page: 0
|
||||
}
|
||||
Object.assign(obj, par)
|
||||
if (!par.nowData[par.page]) {
|
||||
return undefined
|
||||
}
|
||||
return obj.nowData[par.page] ? obj.nowData[par.page].id : undefined
|
||||
}
|
||||
export function returnNextId(par) {
|
||||
const obj = {
|
||||
prveData: [],
|
||||
nowData: [],
|
||||
nextData: [],
|
||||
page: 0
|
||||
}
|
||||
Object.assign(obj, par)
|
||||
if (par.page >= par.nowData.length - 1 || par.nowData.length <= 1) {
|
||||
const nextIndex = obj.nextData.length - 1 <= 0 ? 0 : obj.nextData.length - 1
|
||||
return obj.nextData[nextIndex] ? obj.nextData[nextIndex].id : undefined
|
||||
}
|
||||
return obj.nextData[par.page + 1] ? obj.nextData[par.page + 1].id : undefined
|
||||
}
|
||||
|
||||
|
||||
export async function returnLayoutPage(id) {
|
||||
if (!id) {
|
||||
return {
|
||||
content: [],
|
||||
totalElements: 0
|
||||
}
|
||||
}
|
||||
return $layoutpage({
|
||||
page: 1,
|
||||
size: 999,
|
||||
productCategoryId: id,
|
||||
padLayoutId: ''
|
||||
})
|
||||
}
|
||||
export async function returnCategoryLayoutGoods(id,category) {
|
||||
if (!id) {
|
||||
return {
|
||||
productList: [],
|
||||
padLayoutCode: "single",
|
||||
productCategoryId:category?category.id:''
|
||||
}
|
||||
}
|
||||
return $productCategory(id)
|
||||
}
|
||||
|
||||
export default {
|
||||
isCanBuy,
|
||||
returnNowId,
|
||||
returnCategoryLayoutGoods,
|
||||
returnLayoutPage,
|
||||
returnPrveId,
|
||||
returnNextId,
|
||||
arrayContainsAll,
|
||||
generateCombinations,
|
||||
returnReverseVal,
|
||||
$returnUseType
|
||||
}
|
||||
1
pagesCreateOrder/static/images/icon-add-black.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><defs><style>.a{fill:#333;}.b{fill:#fff;}</style></defs><circle class="a" cx="10" cy="10" r="10"/><rect class="b" width="12" height="2" rx="1" transform="translate(4 10)"/><rect class="b" width="12" height="2" rx="1" transform="translate(11 5) rotate(90)"/></svg>
|
||||
|
After Width: | Height: | Size: 346 B |
1
pagesCreateOrder/static/images/icon-add.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.a{fill:#eb4f4f;}.b{fill:#fff;}</style></defs><circle class="a" cx="12" cy="12" r="12"/><rect class="b" width="12" height="2" rx="1" transform="translate(6 11)"/><rect class="b" width="12" height="2" rx="1" transform="translate(13 6) rotate(90)"/></svg>
|
||||
|
After Width: | Height: | Size: 349 B |
1
pagesCreateOrder/static/images/icon-car.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><defs><style>.a{fill:#333;}.b{fill:#fff;}</style></defs><g transform="translate(-20 -720)"><circle class="a" cx="24" cy="24" r="24" transform="translate(20 720)"/><g transform="translate(-90.089 607.626)"><path class="b" d="M147.12,144.087H126.754a1.818,1.818,0,0,1-1.846-1.6l-1.169-18.028a2.611,2.611,0,0,0-1.477-2.215l-1.846-.8a.948.948,0,0,0-1.231.492.9.9,0,0,0,.492,1.231l1.784.8a.757.757,0,0,1,.431.677L123,142.672a3.686,3.686,0,0,0,3.692,3.323H147.12a.946.946,0,0,0,.923-.923A1,1,0,0,0,147.12,144.087Z" transform="translate(0 0)"/><path class="b" d="M335.566,240.984a2.979,2.979,0,0,0-2.215-.984H314.523a.923.923,0,1,0,0,1.846h18.828a.992.992,0,0,1,.8.369,1.47,1.47,0,0,1,.308.861l-1.477,8.122v.062a1.119,1.119,0,0,1-1.046.984l-16.182,1.231a1,1,0,0,0-.861.984.935.935,0,0,0,.923.861h.062L332,254.09a2.9,2.9,0,0,0,2.707-2.584l1.477-8.183v-.062A2.579,2.579,0,0,0,335.566,240.984Z" transform="translate(-187.031 -114.064)"/><path class="b" d="M251.754,802.154m-2.154,0A2.154,2.154,0,1,0,251.754,800,2.153,2.153,0,0,0,249.6,802.154Z" transform="translate(-125.492 -652.529)"/><path class="b" d="M699.753,802.154m-2.154,0A2.154,2.154,0,1,0,699.753,800,2.153,2.153,0,0,0,697.6,802.154Z" transform="translate(-556.264 -652.529)"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
pagesCreateOrder/static/images/icon-reduce-black.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><defs><style>.a{fill:#fff;stroke:#333;}.b{fill:#333;}.c{stroke:none;}.d{fill:none;}</style></defs><g class="a"><circle class="c" cx="10" cy="10" r="10"/><circle class="d" cx="10" cy="10" r="9.5"/></g><rect class="b" width="12" height="2" rx="1" transform="translate(4 10)"/></svg>
|
||||
|
After Width: | Height: | Size: 363 B |
1
pagesCreateOrder/static/images/icon-reduce.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.a{fill:#fff;stroke:#eb4f4f;}.b{fill:#eb4f4f;}.c{stroke:none;}.d{fill:none;}</style></defs><g class="a"><circle class="c" cx="12" cy="12" r="12"/><circle class="d" cx="12" cy="12" r="11.5"/></g><rect class="b" width="12" height="2" rx="1" transform="translate(6 11)"/></svg>
|
||||
|
After Width: | Height: | Size: 370 B |
1
pagesCreateOrder/static/images/icon-saoma.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="17.196" height="15.968" viewBox="0 0 17.196 15.968"><defs><style>.a{fill:#318afe;}</style></defs><g transform="translate(0 0)"><path class="a" d="M80.571,481.147H64.6a.614.614,0,0,1,0-1.228H80.571a.614.614,0,0,1,0,1.228Z" transform="translate(-63.989 -472.551)"/><path class="a" d="M612.2,645.591h-3.687a.614.614,0,0,1,0-1.228H612.2a.613.613,0,0,0,.614-.614v-3.07a.614.614,0,0,1,1.228,0v3.07A1.842,1.842,0,0,1,612.2,645.591Z" transform="translate(-597.46 -629.623)"/><path class="a" d="M100.9,645.591h-3.07a1.843,1.843,0,0,1-1.842-1.842v-3.07a.614.614,0,1,1,1.228,0v3.07a.615.615,0,0,0,.614.614h3.07a.614.614,0,1,1,0,1.228Z" transform="translate(-95.37 -629.623)"/><path class="a" d="M96.6,101.51a.613.613,0,0,1-.614-.614v-3.07a1.843,1.843,0,0,1,1.842-1.842h3.07a.614.614,0,1,1,0,1.228h-3.07a.617.617,0,0,0-.614.614v3.07A.613.613,0,0,1,96.6,101.51Z" transform="translate(-95.37 -95.983)"/><path class="a" d="M613.428,101.51a.613.613,0,0,1-.614-.614v-3.07a.615.615,0,0,0-.614-.614h-3.687a.614.614,0,0,1,0-1.228H612.2a1.843,1.843,0,0,1,1.842,1.842v3.07A.608.608,0,0,1,613.428,101.51Z" transform="translate(-597.46 -95.984)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
1
pagesCreateOrder/static/images/icon-table.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1731404998618" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4334" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M601.251232 478.583936v265.297249c69.807902 3.124154 164.845419 21.191648 164.845418 74.29203 0 59.089793-117.884874 74.812893-187.414437 74.812892v0.056282c-69.631894 0-187.469696-15.779382-187.469695-74.869174 0-53.100382 95.018074-71.14741 164.845419-74.29203V478.546074c-181.711552-3.571339-358.418113-49.881061-358.418113-135.50416 0-89.177042 191.665251-135.876644 381.042389-135.876644 189.385325 0 381.041366 46.699602 381.041366 135.876644 0 85.642542-176.73419 131.969661-358.472347 135.542022z" fill="#FDE6BE" p-id="4335"></path><path d="M518.343987 432.535157v294.767444c78.553077 3.479241 185.459922 23.554462 185.459922 82.554204 0 65.657372-132.620483 83.10986-210.857359 83.10986v0.075724c-78.339206 0-210.903407-17.528212-210.903407-83.185584 0-58.999742 106.898659-79.056544 185.451735-82.554204V432.479899C263.065929 428.536077 64.274374 377.071961 64.274374 281.923928c0-99.05604 215.619826-150.965294 428.672176-150.965294S921.618727 182.867888 921.618727 281.923928c0.001023 95.148034-198.836581 146.647965-403.27474 150.611229z m-185.934736 379.852284a331.228867 331.228867 0 0 0 160.538323 29.655414 285.387819 285.387819 0 0 0 158.38938-32.242332 286.478663 286.478663 0 0 0-158.38938-32.076556v-0.056282c-100.740402 0.001023-154.853857 24.505114-160.538323 34.719756z m160.538323-630.395504v-0.055258c-230.680846 0.055259-377.767809 59.277058-377.76781 100.060927s147.039891 99.874685 377.76781 99.874685 377.767809-59.202357 377.767809-99.949387c0-40.709167-147.151431-99.930967-377.767809-99.930967z m0 137.123031c-79.576383 0-144.090722-16.651238-144.090723-37.192064 0-20.522406 64.514339-37.173644 144.090723-37.173644s144.099932 16.651238 144.099932 37.173644c0 20.540825-64.524572 37.192064-144.099932 37.192064z" fill="#FAAD28" p-id="4336"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
36
pagesCreateOrder/util.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import {
|
||||
returnBoolean
|
||||
} from '@/commons/utils/format.js';
|
||||
// 返回购物车未下单的数据
|
||||
export function getNowCart(records) {
|
||||
const nowCart = records.find(v => v.placeNum == 0)
|
||||
const Cart = nowCart ? nowCart.info : []
|
||||
const goodsMap = {}
|
||||
const arr = []
|
||||
for (let i in Cart) {
|
||||
const item=Cart[i]
|
||||
const key = item.productId + '_' + item.skuId
|
||||
if (goodsMap.hasOwnProperty(key)) {
|
||||
const index = goodsMap[key]
|
||||
arr[index].number = arr[index].number * 1 + item.number
|
||||
arr[index].totalNumber = arr[index].totalNumber * 1 + item.totalNumber
|
||||
arr[index].totalAmount = arr[index].totalAmount * 1 + item.totalAmount
|
||||
arr[index].packFee = arr[index].packFee * 1 + item.packFee
|
||||
} else {
|
||||
arr.push({
|
||||
...item,
|
||||
isPack: returnBoolean(item.isPack),
|
||||
isGift: returnBoolean(item.isGift)
|
||||
})
|
||||
goodsMap[key] = arr.length - 1;
|
||||
}
|
||||
}
|
||||
// const result = Cart.map(item => {
|
||||
// return {
|
||||
// ...item,
|
||||
// isPack: returnBoolean(item.isPack),
|
||||
// isGift: returnBoolean(item.isGift)
|
||||
// }
|
||||
// })
|
||||
return arr
|
||||
}
|
||||