This commit is contained in:
duan 2024-10-16 09:55:12 +08:00
commit 7089021581
37 changed files with 1000 additions and 521 deletions

View File

@ -4,16 +4,13 @@
"version" : "0.0",
"configurations" : [
{
"app-plus" :
{
"app-plus" : {
"launchtype" : "local"
},
"default" :
{
"default" : {
"launchtype" : "local"
},
"mp-weixin" :
{
"mp-weixin" : {
"launchtype" : "local"
},
"type" : "uniCloud"

View File

@ -390,3 +390,6 @@ text {
// .u-font-32{
// font-size: 16px;
// }
.line-th{
text-decoration: line-through;
}

View File

@ -13,7 +13,7 @@ const model = {
// 返回: promise对象 当提示消失后调用 resolve()
showToast: (title, duration = 1.5, extObject) => {
return new Promise((resolve, reject) => {
uni.showToast(Object.assign({ title: title, icon: 'none', mask: true, duration: (duration * 1000) }, extObject))
uni.showToast(Object.assign({ title: title, icon: 'none', mask: false, duration: (duration * 1000) }, extObject))
setTimeout(resolve, (duration * 1000));
})
},

View File

@ -57,7 +57,8 @@
let currentPage = ref(props.page === 0 ? 1 : props.page)
function returnMaxPage() {
return Math.ceil(props.totalElements / props.size)
const result=Math.ceil(props.totalElements / props.size)
return (result-1<=0?1:result-1)
}
let maxPage=ref(returnMaxPage())
const pagesData = computed(() => {

View File

@ -78,7 +78,7 @@ function commonsProcess(showLoading, httpReqCallback){
// http响应码不正确
if(statusCode != 200){
isShowErrorToast = true
infoBox.showErrorToast('服务器异常')
infoBox.showToast('服务器异常')
return Promise.reject(bodyData) // 跳转到catch函数
}
@ -105,14 +105,11 @@ function commonsProcess(showLoading, httpReqCallback){
return Promise.resolve({ bizData: bodyData.data, code: bodyData.code })
}).catch( res => {
reqFinishFunc(); // 请求完毕的动作
// 如果没有提示错误, 那么此处提示 异常。
if(!isShowErrorToast){
infoBox.showErrorToast(`请求网络异常`)
infoBox.showToast(`请求网络异常`)
}
return Promise.reject(res)
}).finally(() => { // finally 是 then结束后再执行, 此处不适用。 需要在请求完成后立马调用: reqFinishFunc()

View File

@ -88,7 +88,7 @@ function commonsProcess(showLoading, httpReqCallback) {
// http响应码不正确
if (statusCode != 200 && statusCode != 204 && statusCode != 201) {
isShowErrorToast = true
infoBox.showErrorToast(data.message || '服务器异常')
infoBox.showToast(data.message || '服务器异常')
return Promise.reject(bodyData) // 跳转到catch函数
}

View File

@ -71,13 +71,13 @@
"amap" : {
"__platform__" : [ "ios", "android" ],
"appkey_ios" : "0b9be2631525ee5e218ac26d333f215c",
"appkey_android" : "39854b629c421d511a0697f2ae3b18f6"
"appkey_android" : "9d1e62050f8558a082f7aa3ad5bb3c68"
}
},
"maps" : {
"amap" : {
"appkey_ios" : "0b9be2631525ee5e218ac26d333f215c",
"appkey_android" : "39854b629c421d511a0697f2ae3b18f6"
"appkey_android" : "9d1e62050f8558a082f7aa3ad5bb3c68"
}
},
"ad" : {},
@ -223,6 +223,15 @@
}
}
}
},
"sdkConfigs" : {
"maps" : {
"amap" : {
"key" : "6033c97e67bf2e9ceac306e1a3fa35f8",
"securityJsCode" : "0547b69252ef0ed14e11f5c4ac152f07",
"serviceHost" : ""
}
}
}
},
"mp-alipay" : {

View File

@ -143,7 +143,10 @@
page: 0,
size: 999,
categoryId: '',
name: ''
name: '',
createdAt: [],
id: "",
sort: "createdAt,desc"
},
category: '',
categoryList: [], //

View File

@ -1508,6 +1508,13 @@
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
}
}
}else{
//
if (newval === 'sku') {
skuList.list = []
} else {
skuList.list=$goodsData.skuList
}
}
})

View File

@ -1,62 +1,53 @@
<template>
<view class="page">
<view class="box">
<view class="block border-top-0">
<uni-forms ref="nameFormRef" :model="specifications" :rules="rules" :label-width="350"
label-position="top" validateTrigger="blur">
<uni-forms-item label="模版名称" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="specifications.name" placeholder="模版名称,如:衣服" />
</uni-forms-item>
</uni-forms>
</view>
<view v-for="(item,index) in specifications.list" :key="index">
<uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur"
:ref="setFormRef(index)" :border="true" label-position="top" label-width="350">
<view class="block">
<view class="border-top-0">
<uni-forms-item label="规格组名" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.name" placeholder="规格组名" />
v-model="item.name" placeholder="规格组名,如:尺码" />
</uni-forms-item>
</view>
<!-- <uni-forms-item label="最少可选" required name="MinOptional" >
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.MinOptional" type="number" placeholder="填写最小数量" />
</uni-forms-item>
<uni-forms-item label="最大可选" required name="MaxOptional" >
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.MaxOptional" type="number" placeholder="填写最大数量" />
</uni-forms-item> -->
<uni-forms-item label="选项值">
<uni-forms-item label="规格值">
<view class="option">
<view class="u-flex">
<view class="u-flex-1">名称</view>
<view class="u-flex-1 u-p-l-60">加价</view>
</view>
<view class="u-m-t-32">
<view class="u-flex option-item"
v-for="(option,optionIndex) in item.options"
:key="optionIndex"
>
<view class="">
<view class="u-flex option-item" v-for="(option,optionIndex) in item.options"
:key="optionIndex">
<view class="u-flex-1">
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'optionName']"
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'name']"
:ref="setFormInputRef(index,optionIndex)"
:rules="[{'required': true,errorMessage: '必填'}]"
label-width="0" label="" required :showRequired="false"
>
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionName"
:rules="[{'required': true,errorMessage: '必填'}]" label-width="0"
label="" required :showRequired="false">
<uni-easyinput
v-model="specifications.list[index].options[optionIndex].name"
@input="inpuChange(index,optionIndex)"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
placeholder="选项名" />
placeholder="请输入规格值,如:S、M" />
</uni-forms-item>
</view>
<view class="u-p-l-60 u-flex-1 u-flex">
<uni-forms-item :key="optionIndex"
:rules="[{'required': true,errorMessage: '必填'}]"
:ref="setFormInputRef(index,optionIndex)"
:name="['options',optionIndex,'optionPrice']" label-width="0" label="" required :showRequired="false"
>
<view class=" u-flex">
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice"
<uni-forms-item :key="optionIndex" label-width="0" label=""
:showRequired="false">
<view class="u-flex">
<!-- <uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice"
@input="inpuChange(index,optionIndex)"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
type="digit" placeholder="填写价格" />
type="digit" placeholder="填写价格" /> -->
<view class="icon icon-reduce u-m-l-38"
@click="delOption(index,optionIndex)">
@ -106,10 +97,14 @@
<script setup>
import go from '@/commons/utils/go.js';
import {
$productSpec
} from '@/http/yskApi/goods.js'
import {
onLoad,
onReady
onReady,
} from '@dcloudio/uni-app';
import infoBox from '@/commons/utils/infoBox.js'
import {
onMounted,
reactive,
@ -117,6 +112,7 @@
ref,
onBeforeMount
} from 'vue';
const nameFormRef = ref(null)
//
const placeholderStyle = ref('font-size:28rpx;')
//
@ -143,12 +139,6 @@
errorMessage: '必填'
}]
},
optionName: {
rules: [{
required: true,
errorMessage: '必填'
}]
},
optionPrice: {
rules: [{
required: true,
@ -160,7 +150,7 @@
//
const specificationsOptionsBasicData = {
optionName: '',
name: '',
optionPrice: '0.00'
}
@ -172,8 +162,8 @@
//
const specificationsBasicData = {
name: '',
MinOptional: 1,
MaxOptional: 1,
// MinOptional: 1,
// MaxOptional: 1,
options: []
}
@ -189,6 +179,7 @@
}
//
const specifications = reactive({
name: '',
list: [returnSpecificationsOptionsBasicData()]
})
@ -236,6 +227,7 @@
}
// option input
const refFormInput = ref([])
function setFormInputRef(index, index1) {
const newIndex = index * 10000 + index1
return (el) => {
@ -258,55 +250,98 @@
let emitName=''
function triggerEvent (emitName,data){
if(emitName){
uni.$emit(emitName,data)
}
const option = {
type: 'add',
id: undefined
}
onLoad(opt => {
const arr=uni.getStorageSync('guige')
if(arr.length){
specifications.list=arr
console.log(arr);
}
console.log(opt);
if(opt&&JSON.stringify(opt)!=='{}'&&opt.emitName){
emitName=opt.emitName
if (opt && JSON.stringify(opt) !== '{}' && opt.type) {
option.type = opt.type
const data = uni.getStorageSync('spec')
uni.removeStorageSync('spec')
if(data){
specifications.name = data.name
specifications.id = data.id
specifications.list = data.specList.map(v => {
return {
...v,
options: v.value.map(v => {
return {
name: v
}
})
}
})
}
}
uni.setNavigationBarTitle({
title:emitName?'编辑规格模版':'添加规格模版'
title: option.type === 'edit' ? '编辑规格模版' : '添加规格模版'
})
})
function emitspecificationsSave(){
// emitspecificationsSave
// guigeEdit
uni.removeStorageSync('guige')
triggerEvent(emitName,specifications.list)
}
function returnPromise(index,prosise){
function returnPromise(prosise, index) {
return new Promise((resolve, reject) => {
prosise.then(res => {
console.log(res);
resolve({sucees:true})
resolve({
sucees: true
})
}).catch(err => {
console.log(err);
resolve({sucees:false})
resolve({
sucees: false
})
})
})
}
let timer = null
function settimeoutBack(time) {
clearTimeout(timer)
timer = setTimeout(() => {
uni.navigateBack()
}, time)
}
async function save() {
let isAllPassForm = 0
const nameFormRes = await returnPromise(nameFormRef.value.validate())
console.log(nameFormRes);
if (!nameFormRes.sucees) {
isAllPassForm -= 1
}
for (let i in specifications.list) {
const res=await returnPromise(i,formRefs.value[i].validate())
const res = await returnPromise(formRefs.value[i].validate(), i)
isAllPassForm += res.sucees ? 1 : 0
}
//
if (isAllPassForm === specifications.list.length) {
console.log('pass');
emitspecificationsSave()
go.back()
const data = {
name: specifications.name,
id:specifications.id,
specList: specifications.list.map(v => {
return {
...v,
value: v.options.map(v => v.name),
options: undefined
}
})
}
if (option.type === 'add') {
return $productSpec.add(data).then(res => {
infoBox.showSuccessToast('添加成功')
settimeoutBack(1500)
})
}
$productSpec.update(data).then(res => {
infoBox.showSuccessToast('修改成功')
settimeoutBack(1500)
})
}
}

View File

@ -124,6 +124,7 @@
<view class="save-btn-box">
<button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button>
<view class="u-m-t-20">
<button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow">
<view class="u-flex u-row-center">
<view class="u-m-r-6">批量修改</view>
@ -131,6 +132,8 @@
</view>
</button>
</view>
</view>
</view>
<view class="bottom" ref="bottom"></view>

View File

@ -8,6 +8,7 @@
</view>
</view>
<view class="u-m-t-36">
<scroll-view scroll-y="true" style="max-height: 70vh;">
<view class="u-m-b-24" v-for="(item,index) in list" :key="index">
<view>{{item.text}}</view>
<view class="u-m-t-24">
@ -18,6 +19,8 @@
</up-input>
</view>
</view>
</scroll-view>
<view class="u-m-t-60">
<my-button type="primary" shape="circle" @tap="save">

View File

@ -10,18 +10,20 @@
<view class="u-m-t-48">
<view class="u-flex u-row-between border-bottom u-p-b-30">
<view>当前状态</view>
<view class="u-flex">
<view class="u-flex u-relative">
<up-radio-group v-model="isGrounding" placement="row" @change="isGroundingChange">
<up-radio :customStyle="{marginRight: '10px'}" v-for="(item, index) in status.list"
:key="index" :label="item.label" :name="item.name">
</up-radio>
</up-radio-group>
<view class="u-absolute position-all" @click="hasShangXiajia(true)" v-if="!canShangXiaJia"></view>
</view>
</view>
<view class=" u-flex u-row-between u-m-t-30">
<view class=" u-flex u-row-between u-m-t-30 u-relative">
<view>售罄</view>
<up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
<view class="u-absolute position-all" @click="hasShouQing(true)" v-if="!canShouQing"></view>
</view>
</view>
</view>
@ -44,6 +46,7 @@
$updateProductStatus,$updateProductData,
$tbProskuConV2
} from '@/http/yskApi/goods.js'
import {hasPermission} from '@/commons/utils/hasPermission.js'
import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({
show: {
@ -98,7 +101,8 @@
}
function open() {
hasShangXiajia()
hasShouQing()
}
function save() {
@ -114,7 +118,19 @@
}])
}
let canShangXiaJia=ref(false)
async function hasShangXiajia(tips=false){
canShangXiaJia.value=await hasPermission({text:'允许上下架商品',tips})
}
let canShouQing=ref(false)
async function hasShouQing(tips=false){
canShouQing.value=await hasPermission({text:'允许售罄商品',tips})
}
async function isGroundingChange(e) {
if(!canShangXiaJia.value){
return
}
await upDateGoods({
key:'grounding',
value: e
@ -124,6 +140,9 @@
}
async function isPauseSaleChange(e) {
if(!canShouQing.value){
return
}
console.log(e);
await upDateGoods({
key:'pauseSale',

View File

@ -41,11 +41,11 @@
<view class="goods-list u-p-30">
<template v-if="pageData.goodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick"
@edit="toGoodsDetail"
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow"
@changeClick="goodsChangeClick" @edit="toGoodsDetail" @editStock="changeStockShow"
@guigeClick="editGuigeShow" @baosun="baosunShow" @radioClick="goodsRadioClick" :index="index"
:data="item" @del="goodsDel" :showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-goods>
</view>
</template>
<template v-if="pageData.hasAjax&&!pageData.goodsList.length">
@ -150,7 +150,9 @@
watch
} from 'vue';
import go from '@/commons/utils/go.js';
import {hasPermission} from '@/commons/utils/hasPermission.js';
import {
hasPermission
} from '@/commons/utils/hasPermission.js';
import myGoods from './components/goods.vue'
import myControl from './components/control.vue'
import myCategory from './components/category.vue'
@ -191,9 +193,12 @@
query: {
page: 0,
size: 10,
createdAt: [],
id: "",
categoryId: '',
name: '',
isPauseSale: '',
sort: "createdAt,desc",
isGrounding: ''
},
category: '',
@ -393,6 +398,7 @@
pageData.totalElements = res.totalElements
})
}
function watchEmitInit() {
uni.$off('update:productIndex')
uni.$on('update:productIndex', (data) => {
@ -425,6 +431,7 @@
pageData.reportData = pageData.goodsList[index]
reportDamage.value.open();
}
function returnGoodsStockData() {
return reactive({
sort: 0,

View File

@ -49,6 +49,7 @@ import { reactive, ref } from 'vue';
emits('del',props.index)
}
function edit(){
uni.$emit('edit:spec',props.data)
uni.setStorageSync('spec',props.data)
go.to('PAGES_PRODUCT_GUIGE_ADD', {
type: 'edit'

View File

@ -1,5 +1,5 @@
<template>
<view class="item color-fff border-r-12" :class="[data.status]" @click="toOrderDetail">
<view class="item color-fff border-r-12" :class="[computedClass]" @click="toOrderDetail">
<view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}">
<view class="u-flex u-row-between">
<view class="u-font-32">{{data.name}}</view>
@ -18,10 +18,11 @@
<view class="u-flex u-flex-col u-row-center u-col-center bg-fff bottom">
<template v-if="data.status!='using'">
<view class=" u-font-32" :style="{color:returnStutasColor(data.status)}">
{{returnStutasText(data.status)}}~</view>
{{returnStutasText(data.status)}}~
</view>
</template>
<view class=" w-full u-p-l-16 u-p-r-16 u-p-t-16 u-font-24">
<template v-if="data.status=='using'">
<template v-if="data.status=='using'&& data.orderId">
<view class="color-666 u-text-left u-p-b-20 border-bottom">
<view class=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text>
</view>
@ -38,7 +39,7 @@
<template v-else>
<view class="u-flex u-row-center u-m-t-16">
<template v-if="data.tableId">
<template v-if="data.status=='idle' ">
<template v-if="data.status=='idle'||(data.status=='using'&&!data.orderId) ">
<my-button color="#333" :width="150" :height="56" type="default" @click="diancan">
选择
</my-button>
@ -81,16 +82,28 @@
const emits = defineEmits(['more', 'update'])
function returnStutasText(key) {
key = returnIsUseing(key)
const item = status[key]
return item ? item.label : ''
}
const computedClass = computed(() => {
const key = returnIsUseing(props.data.status)
return key
})
function returnIsUseing(key) {
// return key = key == 'using' ? (props.data.orderId ? key : 'idle') : key
return key
}
function returnStutasColor(key) {
// if(key=='using'){
// return 'rgb(250,85,85)'
// }else{
// return ''
// }
key = returnIsUseing(key)
const item = status[key]
return item ? item.type : ''
}
@ -139,7 +152,7 @@
}
function toOrderDetail() {
if (props.data.status == 'using') {
if (props.data.status == 'using' && props.data.orderId) {
const {
tableId,
name,
@ -148,6 +161,12 @@
areaId,
orderId
} = props.data
if (!orderId) {
return uni.showToast({
icon: 'none',
title: '台桌未返回订单id'
})
}
go.to('PAGES_ORDER_DETAIL', {
tableId,
name,

View File

@ -4,19 +4,16 @@
<view class="u-flex u-flex-1 u-row-between">
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showsTimesToggle">
<text class="u-m-r-12">{{times.list[times.active]}}</text>
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill"
mode="">
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" mode="">
</image>
</view>
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showstatusToggle">
<text class="u-m-r-12"
:class="{'color-main':status.active!=0}">{{status.list[status.active].label }}</text>
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill"
mode="">
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" mode="">
</image>
</view>
</view>
<view style="width: 164rpx;"></view>
<view class="search-box">
<view class="search-btn u-flex" @tap="showSearch" :style="{width:search.show?'694rpx':'164rpx'}">
@ -129,6 +126,9 @@
//
// refTableShow()
if (index == 0) {
if (!item.orderId) {
return infoBox.showToast('该桌台暂无要结账的订单!')
}
return
}
if (index == 1) {
@ -181,9 +181,10 @@
function searchConfirm() {
hideSearch()
tables.list = tables.originList.filter((v) =>
v.name.includes(search.keyword.trim())
);
filterTableList()
// tables.list = tables.originList.filter((v) =>
// v.name.includes(search.keyword.trim())
// );
}
function hideSearch() {
@ -337,8 +338,8 @@
content
} = await $table.get(query)
tables.hasAjax = true
tables.list = content
tables.originList = content
filterTableList()
}
const areaMap = ref({})
async function getArea() {
@ -353,7 +354,6 @@
prve[cur.id] = cur.name
return prve
}, {})
console.log(areaMap);
}
watch(() => tables.area.sel, (newval) => {
console.log(newval);
@ -362,13 +362,23 @@
})
watch(() => status.active, (newval) => {
query.page = 0
if (newval === 0) {
return tables.list = tables.originList
}
tables.list = tables.originList.filter((v) => {
return v.status == status.list[status.active].key
});
// if (newval === 0) {
// return tables.list = tables.originList
// }
// tables.list = tables.originList.filter((v) => {
// return v.status == status.list[status.active].key
// });
filterTableList()
})
function filterTableList() {
tables.list = tables.originList.filter((v) => {
console.log(status.list[status.active].key);
return (status.active == 0 ? true : v.status == status.list[status.active].key) && (
v.name.includes(search.keyword.trim())
)
});
}
watch(() => times.active, (newval) => {
setTimer()
})

View File

@ -62,7 +62,7 @@
<view class="u-m-t-24 u-flex u-row-between">
<view></view>
<view class="u-flex">
<view class="btn-default btn">查看订单</view>
<view class="btn-default btn" @click="toOrder">查看订单</view>
<view class="btn-primary btn u-m-l-38" @click="moreOperate">更多操作</view>
</view>
</view>
@ -106,6 +106,12 @@
function toYue(){
go.to('PAGES_RECHARGE_INDEX',{id:''})
}
function toOrder(){
go.to('PAGES_ORDER_INDEX',{
userId:props.data.id||'',
type:'user'
})
}
function remark(){
console.log(props.index);

View File

@ -1246,6 +1246,20 @@
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"pageId": "PAGES_ORDER_PAY",
"path": "pay-order/pay-order",
"style": {
"navigationBarTitleText": "结账"
}
},
{
"pageId": "PAGES_ORDER_TUIKUAN",
"path": "tuikuan/tuikuan",
"style": {
"navigationBarTitleText": "退款"
}
}
]

View File

@ -28,10 +28,10 @@
<view class="label">门店详细地址</view>
<view class="right"><view>{{ vdata.shopInfo.address }}</view><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
</view>
<view class="page-cell">
<!-- <view class="page-cell">
<view class="label">堂食功能</view>
<view class="right"><up-switch v-model="vdata.dineIn" size="20" activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view>
</view>
</view> -->
<view class="page-cell">
<view class="label">允许打包</view>
<view class="right"><up-switch v-model="vdata.takeout" size="20"activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view>
@ -42,7 +42,7 @@
</view>
<view class="page-cell">
<view class="label">桌位费<view v-if="vdata.isTableFee" class="tableFee" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'tableFee',value: vdata.shopInfo.tableFee})">{{vdata.shopInfo.tableFee}}</view></view>
<view class="label">桌位费<view v-if="!vdata.isTableFee" class="tableFee" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'tableFee',value: vdata.shopInfo.tableFee})">{{vdata.shopInfo.tableFee}}</view></view>
<view class="right">
<view>
<up-checkbox-group><up-checkbox label="免桌位费" v-model:checked="vdata.isTableFee" activeColor="#0FC161" shape="circle" @change="isTableFeeChange"> </up-checkbox></up-checkbox-group>
@ -117,11 +117,15 @@ import storageManage from '@/commons/utils/storageManage.js'
import go from '@/commons/utils/go.js'
import infoBox from '@/commons/utils/infoBox.js'
import { $uploadFile } from '@/http/yskApi/file.js'
import { forIn } from 'lodash';
const uploadImg = ref()
const phone = ref(null)
const vdata = reactive({
shopInfo: {},
shopInfo: {
status: 2,
isUseVip: 0,
},
extendList: [],
registerTypeList: [
{name: "先付费", value: "munchies"},
@ -141,6 +145,7 @@ const vdata = reactive({
})
onMounted(() => {
shopExtend();
})
onShow(() => {
@ -159,6 +164,8 @@ let refreshData = (e) => {
let params = {
id : vdata.shopInfo.id,
}
params[e.name] = e.value
vdata.type = e.name;
vdata.inputValue = e.value;
updateShopInfo(params,'input')
}
@ -212,18 +219,7 @@ let radioChange = (n) => {
let updateShopInfo = (params,type) => {
editShopInfo(params).then((res) => {
if (type && type == "input") {
console.log(vdata.type)
switch ( vdata.type ){
case "shopName":
vdata.shopInfo.shopName = vdata.inputValue;
break;
case "phone":
vdata.shopInfo.phone = vdata.inputValue;
break;
case "tableFee":
vdata.shopInfo.tableFee = vdata.inputValue;
break;
}
vdata.shopInfo[vdata.type] = vdata.inputValue;
}
})
}
@ -312,7 +308,7 @@ let switchChange = ( type ) => {
id : vdata.shopInfo.id,
}
switch ( type ){
case "isUseVip":
case "address":
params.lng = vdata.shopInfo.lng;
params.lat = vdata.shopInfo.lat;
params.address = vdata.shopInfo.address;
@ -348,15 +344,26 @@ let switchChange = ( type ) => {
*/
let showMap = () => {
//
// return test();
// &&
uni.chooseLocation().then((res) => {
console.log(res);
//
uni.chooseLocation({
// type: 'wgs84',
success: function (res) {
vdata.shopInfo.lng = res.longitude.toFixed(6); // IOS 12
vdata.shopInfo.lat = res.latitude.toFixed(6);
vdata.shopInfo.address = res.name;
switchChange('address')
});
},
fail: function(err) {
uni.showToast({
title:err,
icon:'error'
})
}
})
}
@ -379,6 +386,8 @@ let showMap = () => {
color: #333333;
display: flex;
align-items: center;
flex-shrink: 0;
margin-right: 20rpx;
.tableFee {
width: 186rpx;
height: 54rpx;

View File

@ -9,7 +9,7 @@
</view>
<view class="bom">
<view @click="saveImage">下载收款码</view>
<view>下载收款码样式</view>
<!-- <view>下载收款码样式</view> -->
</view>
</view>

View File

@ -4,7 +4,7 @@
<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"
:focus="true" v-model="searchValue">
v-model="searchValue">
</uni-search-bar>
</view>
<!-- <view class="u-flex">
@ -45,6 +45,9 @@
</view>
</view>
</view>
<template v-if="tables.list.length<=0">
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
</template>
</view>
@ -142,10 +145,13 @@
content
} = await $table.get(query)
tables.hasAjax = true
content = content.filter(v => v.status != 'closed')
content = content.filter(v =>{
// return v.status == 'idle'||(v.status=='using')
return v.status == 'idle'
})
console.log(content );
tables.list = content
tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
console.log(tables.selIndex );
tables.originList = content
}
async function getArea() {
@ -166,6 +172,10 @@
}
watch(() => area.sel, (newval) => {
if(!newval){
tables.list = tables.originList
return
}
tables.list = tables.originList.filter(v => v.areaId == newval.id)
})
let option = {}

View File

@ -2,7 +2,7 @@
<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" :focus="true"
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search"
v-model="query.name">
</uni-search-bar>
</view>
@ -16,7 +16,8 @@
<my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio>
</view>
<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 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>
@ -37,7 +38,8 @@
</view>
</view>
</view>
<my-radio @change="chooseUser(index,item)" v-model="item.checked" :size="18" border-color="#d1d1d1"></my-radio>
<my-radio @change="chooseUser(index,item)" v-model="item.checked" :size="18"
border-color="#d1d1d1"></my-radio>
</view>
</view>
@ -48,7 +50,9 @@
<script setup>
import * as Api from '@/http/yskApi/shop-user.js'
import {onLoad} from '@dcloudio/uni-app'
import {
onLoad
} from '@dcloudio/uni-app'
import {
reactive,
ref
@ -65,9 +69,14 @@
function chooseUser(index, item) {
if (index === undefined || item === undefined) {
nouser.value = true
return emitChooser({id:''})
}
else{
return emitChooser({
id: '',
headImg: '',
telephone: '',
amount: '0.00',
totalScore: '0.00'
})
} else {
list[index].checked = true
emitChooser(item)
}
@ -80,12 +89,18 @@
})
const list = reactive([])
async function getUser() {
const {content}=await Api.queryAllShopUser(query)
const {
content
} = await Api.queryAllShopUser(query)
for (let i in content) {
list.push({...content[i],checked:false})
list.push({
...content[i],
checked: false
})
}
console.log(list);
}
function search() {
query.page = 0
list.length = 0
@ -97,10 +112,10 @@
</script>
<style lang="scss" scoped>
.scale7 {
transform: scale(0.7);
}
.search {
padding-right: 28rpx;
@ -117,10 +132,13 @@
.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;
@ -128,12 +146,14 @@
height: 84rpx;
background-color: #eee;
overflow: hidden;
.img {
width: 84rpx;
height: 84rpx;
}
}
}
.item:not(:first-child) {
border-top: 1px solid #E5E5E5;
}

View File

@ -48,6 +48,7 @@
function changeCauses(item) {
let prve=form.remark?',':''
form.remark +=prve+item.name
console.log(form.remark);
}
const causes = reactive([{

View File

@ -1,12 +1,18 @@
<template>
<view class="page-gray color-333 u-font-28">
<template v-if="true">
<view class="block">
<view>桌位号</view>
<view class="font-bold u-font-40 u-m-t-20">
{{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">选择用户</view>
<view class="u-flex" v-else>
<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>
@ -22,7 +28,20 @@
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<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">
@ -44,7 +63,7 @@
</view>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</view>
</view> -->
</view>
@ -84,7 +103,7 @@
<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||''}}</view>
<view class="color-333">{{userNumbers.defaultCateIndex*1+1+'人'}}</view>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</picker>
@ -221,7 +240,7 @@
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
<my-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></my-remark>
<one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
</view>
@ -240,10 +259,9 @@
computed,
watch
} from 'vue';
import myButton from '@/components/my-components/my-button'
import modelDiscount from './components/discount'
import giveFood from './components/give-food'
import myRemark from './components/remark'
import oneRemark from './components/remark'
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
import go from '@/commons/utils/go.js';
import {
@ -276,7 +294,9 @@
modelData.data = goods.list[index]
modelData.selIndex = index
const model = models.get(key)
model && model.open({remark:modelData.data.note})
model && model.open({
remark: modelData.data.note||''
})
}
function formatPrice(n) {
@ -288,9 +308,10 @@
//
const userNumbers = reactive({
list: new Array(100).fill(1).map((v, index) => {
return index === 0 ? '无' : index + '人'
// return index === 0 ? '' : index + ''
return (index+1)+ '人'
}),
defaultCateIndex: 1,
defaultCateIndex: 0,
})
watch(() => userNumbers.defaultCateIndex, (newval) => {
console.log(newval);
@ -305,15 +326,16 @@
const res = await Api.$choseCount({
masterId: option.masterId,
tableId: table.value.tableId,
num: userNumbers.defaultCateIndex,
num: userNumbers.defaultCateIndex+1,
})
Object.assign($seatFee, res)
userNumbers.defaultCateIndex = res.totalNumber
userNumbers.defaultCateIndex = res.totalNumber-1
}
}
function userNumberChange(e) {
console.log(e);
userNumbers.defaultCateIndex = e.detail.value
}
@ -398,11 +420,11 @@
//
watch(() => table.value, (newval, oldval) => {
if (newval && oldval) {
Api.$choseTable({
orderId: 4462,
oldTableId: oldval.tableId,
newTableId: newval.tableId,
})
// Api.$choseTable({
// orderId: 4462,
// oldTableId: oldval.tableId,
// newTableId: newval.tableId,
// })
}
})
@ -464,7 +486,7 @@
}
goods.list = getNowCart(records)
if (seatFee && seatFee.totalNumber) {
userNumbers.defaultCateIndex = seatFee.totalNumber || 1
userNumbers.defaultCateIndex = seatFee.totalNumber-1 || 0
Object.assign($seatFee, seatFee)
}
@ -496,7 +518,7 @@
await Api.$choseCount({
masterId: option.masterId,
tableId: table.value.tableId,
num: userNumbers.defaultCateIndex,
num: userNumbers.defaultCateIndex+1,
})
}
// updateChoseCount()
@ -506,13 +528,22 @@
if ($shop.value.registerType == 'munchies') {
//
return go.to('PAGES_ORDER_PAY', {
orderId: res.id
})
orderId: res.id,
isNowPay:true
},'redirect'
)
} else {
//
if (option.isCreateOrderToDetail) {
go.to('PAGES_ORDER_DETAIL', {
id: res.id
},'redirect')
} else {
uni.navigateBack({
delta: 2
})
}
// return go.to('PAGES_ORDER_DETAIL', {
// id: res.id
// })
@ -543,8 +574,13 @@
cart.note = e.remark
}
function init() {
async function init() {
await getTbShopInfo()
await getCart()
console.log($seatFee);
if (!$seatFee.totalNumber) {
updateChoseCount()
}
}
onLoad((opt) => {
@ -558,8 +594,7 @@
}
}
init()
getCart()
getTbShopInfo()
// updateChoseCount()
})
@ -578,6 +613,9 @@
uni.setStorageSync("useType", useType);
}
const tableId = useType == 'takeout' ? undefined : table.value.tableId;
if(!goods.list.length){
return
}
const res = await Api.$changeUseType({
useType,
tableId,

View File

@ -76,6 +76,9 @@
return []
}
},
isCreateOrderToDetail:{
type:Boolean,default:false
},
user:{
type: Object,
default: () => {
@ -123,7 +126,7 @@
const {tableId,name,maxCapacity,status,type}=props.table
go.to('PAGES_CONFIRM_ORDER',{
masterId:props.masterId,type,
tableId,name,maxCapacity,status
tableId,name,maxCapacity,status,isCreateOrderToDetail:props.isCreateOrderToDetail
})
}

View File

@ -1,6 +1,6 @@
<template>
<view class="u-relative u-flex item">
<image lazy-load class="img" :src="data.coverImg" mode=""></image>
<image lazy-load class="img" :src="data.coverImg" mode="" :style="computedImgStyle()"></image>
<view class="info u-flex u-row-between u-col-top u-flex-col" @tap="emitEvent('add')">
<view>
<view>{{data.name}}</view>
@ -50,6 +50,13 @@
watch
} from 'vue';
const props = defineProps({
img:{
type:Object,
default:{
width:'250rpx',
height:'272rpx'
}
},
index: {
type: Number,
},
@ -67,6 +74,14 @@
}
}
})
function computedImgStyle(){
return {
width:props.img.width,
height:props.img.height
}
}
//
function isGoods(){
return props.data.hasOwnProperty('id')
@ -118,8 +133,8 @@
}
.item {
width: 250rpx;
height: 272rpx;
// width: 250rpx;
// height: 272rpx;
background: #F9B798;
border-radius: 8rpx 8rpx 8rpx 8rpx;
overflow: hidden;

View File

@ -35,19 +35,18 @@
<view class="search u-flex u-col-center ">
<view class="u-flex-1">
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
@clear="clearSearch"
v-model="searchValue">
@clear="clearSearch" v-model="searchValue">
</uni-search-bar>
</view>
<view class="u-flex">
<view class="u-flex" @click="scanCode">
<image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image>
</view>
</view>
</view>
<template v-if="!isSearch">
<view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="data.scrollTop"
:scroll-into-view="data.itemId">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view"
:scroll-top="data.scrollTop" :scroll-into-view="data.itemId">
<view v-for="(item,index) in data.tabbar" :key="index" class="u-tab-item"
:class="[data.current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
<text class="u-line-1">{{item.name}}</text>
@ -67,7 +66,8 @@
<view style="height: 24px;"></view>
</template>
</view>
<view class="class-item" :id="'item' + index" v-for="(item , index) in data.tabbar" :key="index">
<view class="class-item" :id="'item' + index" v-for="(item , index) in data.tabbar"
:key="index">
<view class="item-title">
<text>{{item.name}}</text>
</view>
@ -92,13 +92,27 @@
</template>
<template v-else>
<view class="u-menu-wrap">
11
<scroll-view class=" u-flex-1" scroll-y scroll-with-animation>
<view class="u-p-l-30 u-p-r-30">
<view class="u-font-28 color-666 ">搜索</view>
<view class="u-flex u-m-t-20 u-flex-wrap u-row-between">
<view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex">
<goods-item :img="{width:'330rpx',height:'330rpx'}" @chooseGuige="chooseGuige($event,goodsItem.index)"
@add="goodsUpdate($event,goodsItem.index,true)" @reduce="goodsUpdate($event,index,false)"
:index="goodsItem.goodsIndex" :data="goodsItem"></goods-item>
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<view class="bottom w-full">
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
:data="cars" @clear="onClearCart"></my-car>
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser"
:masterId="data.masterId" :table="data.table" :data="cars" @clear="onClearCart"></my-car>
</view>
<!-- 选择规格 -->
@ -113,7 +127,9 @@
<script setup>
import _ from 'lodash';
import * as Api from '@/http/yskApi/Instead.js'
import {$table} from '@/http/yskApi/table.js'
import {
$table
} from '@/http/yskApi/table.js'
import {
$tbShopCategory
} from '@/http/yskApi/goods.js'
@ -134,7 +150,8 @@
computed,
reactive,
ref,
nextTick,getCurrentInstance ,
nextTick,
getCurrentInstance,
watch
} from 'vue';
import myCar from './components/car'
@ -198,6 +215,18 @@
}
function scanCode() {
//
console.log('scanCode');
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
}
@ -354,12 +383,15 @@
//
async function getTableInfo() {
const res=await $table.get({qrcode:data.table.tableId})
const res = await $table.get({
qrcode: data.table.tableId
})
console.log(res);
if (res && res.content[0]) {
// data.table=res.content[0]
}
}
let $originGoods = []
async function init() {
const shopInfo = await tbShopInfo()
$shop.value = shopInfo
@ -384,6 +416,7 @@
}
return isShow;
});
$originGoods=goods
if (!data.table.tableId) {
//
setTabBar(category, goods, [])
@ -424,13 +457,40 @@
let searchValue = ref('')
let isSearch = ref(false)
function search() {
// isSearch.value=true
console.log(searchValue.value);
console.log(data.tabbar );
let searchResult = ref([])
function returnSearchGoods() {
const newval = searchValue.value
let arr = []
let goods=[]
for(let i in data.tabbar){
const goodsArr=data.tabbar[i].foods||[]
for(let k in goodsArr){
goods.push({
...goodsArr[k],
index:i,
goodsIndex:k
})
}
}
if (newval == "") {
arr = goods;
} else {
arr = goods.filter((v) =>
v.name.includes(newval.trim())
);
}
return arr
}
function search() {
isSearch.value = true
searchResult.value = returnSearchGoods()
console.log(searchResult.value);
}
function clearSearch() {
// isSearch.value=false
isSearch.value = false
}
function chooseUser() {
@ -609,7 +669,9 @@
function chooseGuige(foodsindex, index) {
if (!canAddGoods()) {
return infoBox.showToast('清先选择桌台')
return infoBox.showToast('清先选择桌台',0.5).then(res=>{
chooseTable()
})
}
const $goods = data.tabbar[index].foods[foodsindex]
guigeModelData.title = $goods.name
@ -650,6 +712,7 @@
productId,
skuId
})
infoBox.showToast('添加成功')
cars.push({
...cartGoods,
specSnap: sku.specSnap
@ -712,7 +775,9 @@
}
async function goodsUpdate(foodsindex, index, isAdd) {
if (!canAddGoods()) {
return infoBox.showToast('清先选择桌台')
return infoBox.showToast('请先选择桌台',0.5).then(res=>{
chooseTable()
})
}
const $goods = data.tabbar[index].foods[foodsindex]
if ($goods.isDan) {
@ -754,6 +819,7 @@
productId,
skuId
})
infoBox.showToast('添加成功')
$goods.chooseNumber = num
cars.push(cartGoods)
}
@ -913,16 +979,33 @@
init()
})
onBeforeUnmount(() => {})
function watchUpdate() {
uni.$off('update:createOrderIndex')
uni.$on('update:createOrderIndex', () => {
// data.table = {
// tableId: ""
// }
cars.length = 0
console.log('update:createOrderIndex');
init()
})
}
onShow(() => {
// watchChooseuser()
watchChooseTable()
watchUpdate()
})
let isCreateOrderToDetail = ref(false)
onLoad((opt) => {
console.log(opt)
Object.assign(data.table, opt)
if (opt.useType) {
uni.setStorageSync('useType', opt.useType)
}
if (JSON.stringify(opt) == '{}') {
isCreateOrderToDetail.value = true
}
// if (!opt.tableId) {
// infoBox.showErrorToast('')
// return setTimeout(() => {

View File

@ -80,12 +80,15 @@
ref
} from 'vue';
import {
onLoad
onLoad,
onBackPress
} from '@dcloudio/uni-app'
import * as Api from '@/http/yskApi/Instead.js'
import infoBox from '@/commons/utils/infoBox.js'
import editDiscount from '/pagesCreateOrder/components/edit-discount.vue'
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
import {
queryAllShopUser
} from '@/http/yskApi/shop-user.js'
const pays = reactive({
list: ['扫码收款', '二维码收款'],
selIndex: 0,
@ -94,7 +97,11 @@
selIndex: 0
}
})
let option = opt
onBackPress(()=>{
console.log('-------------------');
console.log('onBackPress');
})
const models = new Map();
function setModel(el) {
@ -122,8 +129,10 @@
infoBox.showToast('支付成功')
setTimeout(() => {
// uni.$emit('orderDetail:update')
uni.$emit('update:createOrderIndex')
console.log('update:createOrderIndex');
uni.navigateBack({
delta: 2
delta: 1
})
}, 500)
}
@ -182,10 +191,13 @@
}
})
onLoad((opt) => {
option = opt
console.log(opt);
Object.assign(order, opt)
if (order.userId) {
queryAllShopUser({id:opt.userId}).then(res=>{
queryAllShopUser({
id: opt.userId
}).then(res => {
user.value = res.content[0] || opt
})
}

View File

@ -2,18 +2,30 @@
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between">
<view class="font-bold">附加费</view>
<template v-if="orderInfo.status=='unpaid'">
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
</template>
<template v-if="orderInfo.status=='closed'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
</template>
</view>
<template v-if="data.status!='return'">
<view class="u-flex u-row-between u-m-t-20">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view>{{data.number}}</view>
<view>{{data.totalAmount}}</view>
</view>
</template>
<template v-else>
<view class="u-flex u-row-between u-m-t-20 color-999">
<view class="u-flex">
<view class="line-th ">{{data.name||'餐位费'}}</view>
<view class="tag yitui u-m-l-10">已退</view>
</view>
<view class="line-th">x{{data.number}}</view>
<view class="line-th">{{data.totalAmount}}</view>
</view>
</template>
</view>
</template>
@ -49,4 +61,13 @@
</script>
<style lang="scss" scoped>
.tag {
padding: 0 6rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.yitui {
background-color: rgb(188, 188, 188);
color: #fff;
}
}
</style>

View File

@ -1,8 +1,8 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
<view class="u-font-32 font-bold">
<view class="u-font-32 color-999">
<text></text>
<text class="color-main font-bold"> {{goodsNumber}}</text>
<text class="color-333 "> {{goodsNumber}}</text>
<text>份菜品</text>
</view>
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
@ -22,7 +22,8 @@
<view class="tui" v-if="item.status=='return'">
已退
</view>
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}
</view>
</view>
<view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view>
</view>
@ -42,31 +43,37 @@
<template v-if="orderInfo.status=='unpaid'">
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</my-button>
<my-button :width="168" :height="60" plain shape="circle"
@tap="tuicai(item,index)">退菜</my-button>
</view>
</template>
<template v-if="orderInfo.status=='closed'">
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
<my-button :width="168" :height="60" plain shape="circle" @tap="tuikuan(item,index)">退款</my-button>
<my-button :width="168" :height="60" plain shape="circle"
@tap="tuikuan(item,index)">退款</my-button>
</view>
</template>
</view>
</view>
<view class="bg-gray u-p-20 u-m-t-20">
<view class="bg-gray u-p-20 u-m-t-20" v-if="orderInfo.remark">
<view>备注</view>
<view class="u-m-t-10">{{orderInfo.remark}}</view>
</view>
</view>
<view class="u-m-t-40">
<view class="u-flex u-row-between border-bottom u-p-b-20">
<view class="u-m-t-32">
<view class="u-flex u-row-between border-top u-p-t-32">
<view>
<template v-if="orderInfo.status=='unpaid'">
<view class="tag no-pay">
未支付
</view>
</template>
<template v-if="orderInfo.status=='refund'">
<view class="tag refund">
退款成功
</view>
</template>
</view>
<view>
@ -75,11 +82,31 @@
</view>
</view>
<template v-if="orderInfo.status=='refund'">
<view class="u-flex u-row-between u-m-t-32">
<view>退款金额</view>
<view class="color-999">
<text class="">{{orderInfo.originAmount}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32">
<view>退款原因</view>
<view class="color-999">
<text class="">{{orderInfo.refundRemark||''}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32 u-p-b-24 border-bottom">
<view></view>
<view class="">
<text class="">退款成功</text>
</view>
</view>
</template>
<view class="u-flex u-row-between u-m-t-20">
<view></view>
<view>
<text>总计</text>
<text class="font-bold u-font-32">{{seatFee*1+allPrice*1}}</text>
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1) }}</text>
</view>
</view>
<view class="u-m-t-30">
@ -95,12 +122,22 @@
} from 'vue';
import color from '@/commons/color.js'
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function to2(n){
if(!n){
return 0
}
return n.toFixed(2)
}
function tuicai(item, index) {
emits('tuicai', item, index)
}
function tuikuan(item, index) {
emits('tuikuan', item, index)
}
function printOrder() {
emits('printOrder')
}
@ -114,17 +151,29 @@
default: () => []
},
seatFee: {
type:[String,Number],
default:0
type: Object,
default: () => {}
}
})
const seatFeePrice = computed(() => {
if (!props.seatFee.totalAmount) {
return 0
}
const n = props.seatFee.totalAmount * (props.seatFee.status == 'return' ? 0 : 1)
return n.toFixed(2)
})
const allPrice = computed(() => {
return props.data.reduce((prve, cur) => {
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.isGift !== "true" && v.status !== "return").reduce((a,
b) => {
return a + (b.salePrice || b.price) * (b.number || b.num)
}, 0)
return prve + curTotal
}, 0).toFixed(2)
}, 0)
return goodsPrice.toFixed(2)
})
const goodsNumber = computed(() => {
@ -137,30 +186,42 @@
}, 0)
return result
})
</script>
<style lang="scss" scoped>
.img {
width: 70rpx;
height: 70rpx;
width: 152rpx;
height: 152rpx;
}
.border-top {
border-color: #F6F6F6;
}
.border-bottom {
border-color: rgb(240, 240, 240);
// border-color: rgb(240, 240, 240);
border-color: #F6F6F6;
}
.line-th {
text-decoration: line-through;
}
.tag {
padding: 2rpx 8rpx;
border-radius: 8rpx;
.tag {
padding: 4rpx 8rpx 2rpx 10rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.no-pay {
background-color: rgb(170, 170, 170);
color: #fff;
}
&.refund{
background-color: #FCE7E7;
padding: 8rpx 20rpx 6rpx 22rpx;
color: #EB4F4F;
}
}
.tui {
background-color: rgb(239, 239, 239);
border-radius: 4rpx;
@ -169,5 +230,4 @@
padding: 0 4rpx;
font-size: 20rpx;
}
</style>

View File

@ -20,10 +20,10 @@
<view>支付方式</view>
<view>{{data.payType||''}}</view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<!-- <view class="u-flex u-row-between u-m-t-20">
<view>预约时间</view>
<view></view>
</view>
</view> -->
<view class="u-flex u-row-between u-m-t-20">
<view>下单时间</view>
<view><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
@ -32,10 +32,10 @@
<view>订单编号</view>
<view>{{data.orderNo}}</view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<!-- <view class="u-flex u-row-between u-m-t-20">
<view>商家备注</view>
<my-button plain shape="circle" :width="160" :height="60">编辑</my-button>
</view>
</view> -->
</view>
</template>

View File

@ -1,8 +1,9 @@
<template>
<view class="u-font-28 default-box-padding u-relative bg-fff border-r-12 u-overflow-hide">
<template v-if="orderInfo.status=='unpaid'">
<view class="change u-absolute my-bg-main color-fff left-top" @click="chooseUser">切换</view>
<view class="change u-absolute color-fff left-top" @click="chooseUser">切换</view>
</template>
<template v-if="user.id">
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
<view class="u-flex">
<up-avatar :size="30" :src="user.headImg"></up-avatar>
@ -12,6 +13,18 @@
<my-button @click="toOrder" :height="60" plain shape="circle">他的订单</my-button>
</view>
</view>
</template>
<template v-else>
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
<view class="u-flex">
<up-avatar :size="30" :src="user.headImg"></up-avatar>
<view class="color-666 u-m-l-30">{{'服务员下单'}}</view>
</view>
<view>
<my-button @click="toOrder" :height="60" plain shape="circle">他的订单</my-button>
</view>
</view>
</template>
<view class="u-flex u-m-t-20 u-row-between">
<view class="">
<view class="font-bold">{{user.amount}}</view>
@ -66,8 +79,9 @@
<style lang="scss" scoped>
.change {
padding: 4rpx 16rpx;
border-radius: 0 0 16rpx 0;
padding: 2rpx 22rpx 4rpx 14rpx;
border-radius: 18rpx 0rpx 18rpx 0rpx;
background: linear-gradient( 139deg, #74B0FF 0%, #318AFE 100%);
z-index: 2;
}
</style>

View File

@ -2,17 +2,17 @@
<view class="min-page bg-gray u-font-28 u-p-30">
<user-vue :orderInfo="orderDetail.info" :user="user"></user-vue>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<text class="color-666">桌位号</text>
<text class="font-bold">{{orderDetail.info.tableName}}</text>
<text class="">桌位号</text>
<text class="">{{orderDetail.info.tableName}}</text>
</view>
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount" @tuicai="onTuiCai"></goods-list>
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
<template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
:data="orderDetail.seatFee"></extra-vue>
</template>
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
<step-vue></step-vue>
<!-- <step-vue></step-vue> -->
<view style="height: 200rpx;"></view>
<view class="u-fixed bottom bg-fff ">
<view class="u-flex u-abso">
@ -88,24 +88,23 @@
id,
productId,
productSkuId,
productName,
productSkuName,
name,
cartId,
num,
priceAmount,
price
number,
totalAmount,
salePrice
} = seatFee
go.to('PAGES_ORDER_TUIKUAN', {
id,
cartId,
orderId:orderDetail.info.id,
id:seatFee.id,
productId,
productSkuId,
productName,
num,
productName:name,
num:number,
number: 0,
productSkuName: productSkuName || '',
priceAmount,
price
productSkuName: '',
priceAmount:totalAmount,
price:salePrice
})
}
@ -120,8 +119,8 @@
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
tableId: orderDetail.info.tableId,
})
tuicai.selGoods.status = 'return'
tuicai.show = false
init()
}
@ -254,7 +253,6 @@
for (let i in res.detailList) {
const goods = res.detailList[i]
if (goods.productName != '客座费') {
console.log(goods);
if (goodsMap.hasOwnProperty(goods.placeNum)) {
goodsMap[goods.placeNum].push(goods)
} else {
@ -263,11 +261,12 @@
}
}
orderDetail.seatFee = {
name: '餐位费',
orderDetail.seatFee = res.seatInfo|| {
name: '客座费',
number: res.seatCount,
totalNumber: res.seatCount,
totalAmount: res.seatAmount
totalAmount: res.seatAmount,
status:''
}
orderDetail.goodsList = Object.entries(goodsMap).map(([key, value]) => ({
info: value,

View File

@ -54,18 +54,17 @@
userId:''
}
})
console.log(order.data);
function clearQueryUser(){
order.setQuery('userId','')
}
function pageChange(e){
order.setVal('page',e)
order.setQuery('page',e)
console.log(e);
console.log(order.data.page);
init()
}
console.log(order.list);
watch(()=>order.data.query.createdAt,(newval)=>{
init()
})
@ -73,7 +72,8 @@
init()
})
async function init() {
const {content,totalElements}=await Api.tbOrderInfoData({...order.data.query,page:order.data.page})
console.log(order.data.query);
const {content,totalElements}=await Api.tbOrderInfoData(order.data.query)
uni.stopPullDownRefresh()
order.setVal('list',content)
console.log(order.data.list);

View File

@ -28,7 +28,7 @@
v-if="discount.price&&discount.currentPrice!=order.amount">
<view>服务员改价</view>
<view class=" u-flex u-col-center">
<text style="color: rgb(255, 95, 46);">-{{order.amount- discount.currentPrice}}</text>
<text style="color: rgb(255, 95, 46);">-{{to2(order.amount- discount.currentPrice)}}</text>
</view>
</view>
</view>
@ -37,8 +37,8 @@
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
<template v-if="pays.selIndex==0">
<view class="list">
<view class="item" @click="changePayType(index,item)" v-for="(item,index) in pays.payTypes.list"
:key="index">
<view class="item" @click="changePayType(index,item)"
v-for="(item,index) in pays.payTypes.list" :key="index">
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
<view class="u-flex">
<image class="icon" :src="item.icon" mode=""></image>
@ -60,12 +60,10 @@
<my-button @click="payOrderClick">确认付款</my-button>
</view>
</template>
<template v-else>
<view class="">
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
<template v-if="pays.selIndex==1">
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信/支付宝扫码</view>
<view class="u-flex u-row-center u-m-t-40">
<up-qrcode :size="140" :val="payCodeUrl"></up-qrcode>
</view>
<up-qrcode cid="code" :size="140" :val="payCodeUrl"></up-qrcode>
</view>
</template>
</view>
@ -114,25 +112,46 @@
onBeforeUnmount
} from 'vue';
import {
onLoad
onLoad,
onBackPress
} from '@dcloudio/uni-app'
import * as Api from '@/http/yskApi/Instead.js'
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
import {
queryAllShopUser
} from '@/http/yskApi/shop-user.js'
import * as orderApi from '@/http/yskApi/order.js'
import infoBox from '@/commons/utils/infoBox.js'
import editDiscount from '@/components/my-components/edit-discount.vue'
let option = {isNowPay:false}
let payFinish=ref(false)
onBackPress(() => {
console.log('onBackPress');
uni.$emit('update:createOrderIndex')
// if (option.isNowPay&&!payFinish.value) {
// infoBox.showToast('')
// return true
// }
// return false
})
let payStatus = ref(null) //loading success
let timer = null
let user=ref({amount:0});
let user = ref({
amount: 0
});
function clear() {
clearInterval(timer)
timer = null
}
function to2(n) {
if (!n) {
return ''
}
return n.toFixed(2)
}
const pays = reactive({
list: ['扫码收款', '二维码收款'],
selIndex: 0,
@ -142,6 +161,31 @@
}
})
function chooseUser() {
go.to('PAGES_CHOOSE_USER')
}
//
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()
})
}
watch(() => pays.selIndex, (newval) => {
clearInterval(timer)
if (newval) {
@ -179,6 +223,7 @@
function editDiscountConfirm(form) {
console.log(form);
Object.assign(discount, form)
getPayUrl()
}
async function getPayType() {
const payTypeList = await Api.$getPayType()
@ -196,8 +241,10 @@
infoBox.showToast('支付成功')
setTimeout(() => {
// uni.$emit('orderDetail:update')
payFinish.value=true
uni.$emit('update:createOrderIndex')
uni.navigateBack({
delta: 2
delta: 1
})
}, 500)
}
@ -270,22 +317,31 @@
async function init() {
const res = await orderApi.tbOrderInfoDetail(order.orderId)
Object.assign(order, res)
}
onLoad(async(opt) => {
orderApi.$getOrderPayUrl({
orderId: opt.orderId
}).then(res => {
payCodeUrl.value = res
})
console.log(opt);
Object.assign(order, opt)
const payTypeList = await Api.$getPayType()
pays.payTypes.list = payTypeList
if (order.userId) {
queryAllShopUser({id:opt.userId}).then(res=>{
queryAllShopUser({
id: order.userId
}).then(res => {
user.value = res.content[0] || opt
})
}
getPayUrl()
}
function getPayUrl() {
orderApi.$getOrderPayUrl({
orderId: order.id,
payAmount: discount.currentPrice ? discount.currentPrice : order.amount
}).then(res => {
payCodeUrl.value = res
})
}
onLoad(async (opt) => {
console.log(opt);
option = opt
Object.assign(order, opt)
const payTypeList = await Api.$getPayType()
pays.payTypes.list = payTypeList
init()
})

View File

@ -160,9 +160,13 @@
return infoBox.showToast('退款商品数量不能为0')
}
const selTag=tuikuan.list[tuikuan.sel]
const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}`
if (!noteResult) {
return infoBox.showToast('请输入或选择退款原因!')
}
await $returnOrder({
"orderId": option.orderId,
"note":`${selTag?selTag:''}${note.value?(','+note.value):''}` ,
"note":noteResult,
"orderDetails":orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
return {
id:v.id,