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,19 +4,16 @@
"version" : "0.0", "version" : "0.0",
"configurations" : [ "configurations" : [
{ {
"app-plus" : "app-plus" : {
{ "launchtype" : "local"
"launchtype" : "local" },
}, "default" : {
"default" : "launchtype" : "local"
{ },
"launchtype" : "local" "mp-weixin" : {
}, "launchtype" : "local"
"mp-weixin" : },
{ "type" : "uniCloud"
"launchtype" : "local"
},
"type" : "uniCloud"
}, },
{ {
"playground" : "custom", "playground" : "custom",

View File

@ -389,4 +389,7 @@ text {
// } // }
// .u-font-32{ // .u-font-32{
// font-size: 16px; // font-size: 16px;
// } // }
.line-th{
text-decoration: line-through;
}

View File

@ -13,7 +13,7 @@ const model = {
// 返回: promise对象 当提示消失后调用 resolve() // 返回: promise对象 当提示消失后调用 resolve()
showToast: (title, duration = 1.5, extObject) => { showToast: (title, duration = 1.5, extObject) => {
return new Promise((resolve, reject) => { 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)); setTimeout(resolve, (duration * 1000));
}) })
}, },

View File

@ -57,7 +57,8 @@
let currentPage = ref(props.page === 0 ? 1 : props.page) let currentPage = ref(props.page === 0 ? 1 : props.page)
function returnMaxPage() { 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()) let maxPage=ref(returnMaxPage())
const pagesData = computed(() => { const pagesData = computed(() => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,62 +1,53 @@
<template> <template>
<view class="page"> <view class="page">
<view class="box"> <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"> <view v-for="(item,index) in specifications.list" :key="index">
<uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur" <uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur"
:ref="setFormRef(index)" :border="true" label-position="top" label-width="350"> :ref="setFormRef(index)" :border="true" label-position="top" label-width="350">
<view class="block"> <view class="block">
<view class="border-top-0"> <view class="border-top-0">
<uni-forms-item label="规格组名" required name="name" > <uni-forms-item label="规格组名" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder" <uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.name" placeholder="规格组名" /> v-model="item.name" placeholder="规格组名,如:尺码" />
</uni-forms-item> </uni-forms-item>
</view> </view>
<!-- <uni-forms-item label="最少可选" required name="MinOptional" > <uni-forms-item label="规格值">
<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="选项值">
<view class="option"> <view class="option">
<view class="u-flex"> <view class="">
<view class="u-flex-1">名称</view> <view class="u-flex option-item" v-for="(option,optionIndex) in item.options"
<view class="u-flex-1 u-p-l-60">加价</view> :key="optionIndex">
</view>
<view class="u-m-t-32">
<view class="u-flex option-item"
v-for="(option,optionIndex) in item.options"
:key="optionIndex"
>
<view class="u-flex-1"> <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)" :ref="setFormInputRef(index,optionIndex)"
:rules="[{'required': true,errorMessage: '必填'}]" :rules="[{'required': true,errorMessage: '必填'}]" label-width="0"
label-width="0" label="" required :showRequired="false" label="" required :showRequired="false">
> <uni-easyinput
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionName" v-model="specifications.list[index].options[optionIndex].name"
@input="inpuChange(index,optionIndex)" @input="inpuChange(index,optionIndex)"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
placeholder="选项名" /> placeholder="请输入规格值,如:S、M" />
</uni-forms-item> </uni-forms-item>
</view> </view>
<view class="u-p-l-60 u-flex-1 u-flex"> <view class=" u-flex">
<uni-forms-item :key="optionIndex" <uni-forms-item :key="optionIndex" label-width="0" label=""
:rules="[{'required': true,errorMessage: '必填'}]" :showRequired="false">
:ref="setFormInputRef(index,optionIndex)"
:name="['options',optionIndex,'optionPrice']" label-width="0" label="" required :showRequired="false"
>
<view class="u-flex"> <view class="u-flex">
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice" <!-- <uni-easyinput v-model="specifications.list[index].options[optionIndex].optionPrice"
@input="inpuChange(index,optionIndex)" @input="inpuChange(index,optionIndex)"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder" :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
type="digit" placeholder="填写价格" /> type="digit" placeholder="填写价格" /> -->
<view class="icon icon-reduce u-m-l-38" <view class="icon icon-reduce u-m-l-38"
@click="delOption(index,optionIndex)"> @click="delOption(index,optionIndex)">
@ -79,7 +70,7 @@
</view> </view>
</uni-forms-item> </uni-forms-item>
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)"> <view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
<view class="icon icon-reduce u-m-r-22 "> <view class="icon icon-reduce u-m-r-22 ">
@ -106,10 +97,14 @@
<script setup> <script setup>
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import {
$productSpec
} from '@/http/yskApi/goods.js'
import { import {
onLoad, onLoad,
onReady onReady,
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
import infoBox from '@/commons/utils/infoBox.js'
import { import {
onMounted, onMounted,
reactive, reactive,
@ -117,8 +112,9 @@
ref, ref,
onBeforeMount onBeforeMount
} from 'vue'; } from 'vue';
const nameFormRef = ref(null)
// //
const placeholderStyle = ref('font-size:28rpx;') const placeholderStyle = ref('font-size:28rpx;')
// //
const inputBorder = ref(false) const inputBorder = ref(false)
const form = ref(null) const form = ref(null)
@ -143,12 +139,6 @@
errorMessage: '必填' errorMessage: '必填'
}] }]
}, },
optionName: {
rules: [{
required: true,
errorMessage: '必填'
}]
},
optionPrice: { optionPrice: {
rules: [{ rules: [{
required: true, required: true,
@ -157,10 +147,10 @@
} }
} }
// //
const specificationsOptionsBasicData = { const specificationsOptionsBasicData = {
optionName: '', name: '',
optionPrice: '0.00' optionPrice: '0.00'
} }
@ -172,8 +162,8 @@
// //
const specificationsBasicData = { const specificationsBasicData = {
name: '', name: '',
MinOptional: 1, // MinOptional: 1,
MaxOptional: 1, // MaxOptional: 1,
options: [] options: []
} }
@ -189,6 +179,7 @@
} }
// //
const specifications = reactive({ const specifications = reactive({
name: '',
list: [returnSpecificationsOptionsBasicData()] list: [returnSpecificationsOptionsBasicData()]
}) })
@ -235,7 +226,8 @@
}; };
} }
// option input // option input
const refFormInput=ref([]) const refFormInput = ref([])
function setFormInputRef(index, index1) { function setFormInputRef(index, index1) {
const newIndex = index * 10000 + index1 const newIndex = index * 10000 + index1
return (el) => { return (el) => {
@ -252,61 +244,104 @@
console.log(refFormInput.value[newIndex]); console.log(refFormInput.value[newIndex]);
refFormInput.value[newIndex].onFieldChange() refFormInput.value[newIndex].onFieldChange()
} }
let emitName=''
function triggerEvent (emitName,data){
if(emitName){
uni.$emit(emitName,data) const option = {
} type: 'add',
id: undefined
} }
onLoad(opt=>{ onLoad(opt => {
const arr=uni.getStorageSync('guige')
if(arr.length){
specifications.list=arr
console.log(arr);
}
console.log(opt); console.log(opt);
if(opt&&JSON.stringify(opt)!=='{}'&&opt.emitName){ if (opt && JSON.stringify(opt) !== '{}' && opt.type) {
emitName=opt.emitName 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({ uni.setNavigationBarTitle({
title:emitName?'编辑规格模版':'添加规格模版' title: option.type === 'edit' ? '编辑规格模版' : '添加规格模版'
}) })
}) })
function emitspecificationsSave(){
// emitspecificationsSave function returnPromise(prosise, index) {
// guigeEdit return new Promise((resolve, reject) => {
uni.removeStorageSync('guige') prosise.then(res => {
triggerEvent(emitName,specifications.list)
}
function returnPromise(index,prosise){
return new Promise((resolve,reject)=>{
prosise.then(res=>{
console.log(res); console.log(res);
resolve({sucees:true}) resolve({
}).catch(err=>{ sucees: true
})
}).catch(err => {
console.log(err); console.log(err);
resolve({sucees:false}) resolve({
sucees: false
})
}) })
}) })
} }
async function save() {
let isAllPassForm=0 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) { 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 isAllPassForm += res.sucees ? 1 : 0
} }
// //
if(isAllPassForm===specifications.list.length){ if (isAllPassForm === specifications.list.length) {
console.log('pass'); console.log('pass');
emitspecificationsSave() const data = {
go.back() 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,12 +124,15 @@
<view class="save-btn-box"> <view class="save-btn-box">
<button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button> <button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button>
<button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow"> <view class="u-m-t-20">
<view class="u-flex u-row-center"> <button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow">
<view class="u-m-r-6">批量修改</view> <view class="u-flex u-row-center">
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon> <view class="u-m-r-6">批量修改</view>
</view> <up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
</button> </view>
</button>
</view>
</view> </view>
</view> </view>
<view class="bottom" ref="bottom"></view> <view class="bottom" ref="bottom"></view>

View File

@ -8,16 +8,19 @@
</view> </view>
</view> </view>
<view class="u-m-t-36"> <view class="u-m-t-36">
<view class="u-m-b-24" v-for="(item,index) in list" :key="index"> <scroll-view scroll-y="true" style="max-height: 70vh;">
<view>{{item.text}}</view> <view class="u-m-b-24" v-for="(item,index) in list" :key="index">
<view class="u-m-t-24"> <view>{{item.text}}</view>
<up-input v-model="item.value"> <view class="u-m-t-24">
<template #suffix> <up-input v-model="item.value">
<up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button> <template #suffix>
</template> <up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button>
</up-input> </template>
</up-input>
</view>
</view> </view>
</view> </scroll-view>
<view class="u-m-t-60"> <view class="u-m-t-60">
<my-button type="primary" shape="circle" @tap="save"> <my-button type="primary" shape="circle" @tap="save">

View File

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

View File

@ -41,11 +41,11 @@
<view class="goods-list u-p-30"> <view class="goods-list u-p-30">
<template v-if="pageData.goodsList.length"> <template v-if="pageData.goodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index"> <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" <my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow"
@edit="toGoodsDetail" @changeClick="goodsChangeClick" @edit="toGoodsDetail" @editStock="changeStockShow"
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow" @guigeClick="editGuigeShow" @baosun="baosunShow" @radioClick="goodsRadioClick" :index="index"
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel" :data="item" @del="goodsDel" :showChecked="showChecked"
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods> :showDetail="pageData.showGoodsDetail"></my-goods>
</view> </view>
</template> </template>
<template v-if="pageData.hasAjax&&!pageData.goodsList.length"> <template v-if="pageData.hasAjax&&!pageData.goodsList.length">
@ -55,7 +55,7 @@
<my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size" <my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size"
@change="pageChange"></my-pagination> @change="pageChange"></my-pagination>
</template> </template>
<view style="height: 100rpx;"></view> <view style="height: 100rpx;"></view>
</view> </view>
@ -150,7 +150,9 @@
watch watch
} from 'vue'; } from 'vue';
import go from '@/commons/utils/go.js'; 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 myGoods from './components/goods.vue'
import myControl from './components/control.vue' import myControl from './components/control.vue'
import myCategory from './components/category.vue' import myCategory from './components/category.vue'
@ -191,10 +193,13 @@
query: { query: {
page: 0, page: 0,
size: 10, size: 10,
createdAt: [],
id: "",
categoryId: '', categoryId: '',
name: '', name: '',
isPauseSale:'', isPauseSale: '',
isGrounding:'' sort: "createdAt,desc",
isGrounding: ''
}, },
category: '', category: '',
categoryList: [], // categoryList: [], //
@ -288,8 +293,8 @@
// //
async function changeStockShow(index) { async function changeStockShow(index) {
const res= await hasPermission('允许修改商品库存') const res = await hasPermission('允许修改商品库存')
if(!res){ if (!res) {
return return
} }
pageData.selGoodsIndex = index pageData.selGoodsIndex = index
@ -393,9 +398,10 @@
pageData.totalElements = res.totalElements pageData.totalElements = res.totalElements
}) })
} }
function watchEmitInit(){
function watchEmitInit() {
uni.$off('update:productIndex') uni.$off('update:productIndex')
uni.$on('update:productIndex',(data)=>{ uni.$on('update:productIndex', (data) => {
getGoodsList() getGoodsList()
}) })
} }
@ -425,6 +431,7 @@
pageData.reportData = pageData.goodsList[index] pageData.reportData = pageData.goodsList[index]
reportDamage.value.open(); reportDamage.value.open();
} }
function returnGoodsStockData() { function returnGoodsStockData() {
return reactive({ return reactive({
sort: 0, sort: 0,
@ -472,7 +479,7 @@
Object.assign(goodsStockData, goods) Object.assign(goodsStockData, goods)
goodsStockModel.value.open() goodsStockModel.value.open()
} }
// //
function goodsDel(index) { function goodsDel(index) {
const goods = pageData.goodsList[index] const goods = pageData.goodsList[index]
@ -492,15 +499,15 @@
} }
}); });
} }
function resetQuery(){ function resetQuery() {
pageData.totalElements=0; pageData.totalElements = 0;
pageData.query.page=0; pageData.query.page = 0;
} }
async function toGoodsDetail(id){ async function toGoodsDetail(id) {
const res= await hasPermission('允许修改商品') const res = await hasPermission('允许修改商品')
if(!res){ if (!res) {
return return
} }
go.to('PAGES_PRODUCT_ADD', { go.to('PAGES_PRODUCT_ADD', {
@ -508,30 +515,30 @@
productId: id productId: id
}) })
} }
function statesTableClick(index) { function statesTableClick(index) {
pageData.stateCurrent = index; pageData.stateCurrent = index;
resetQuery() resetQuery()
console.log(index); console.log(index);
if(index==0){ if (index == 0) {
pageData.query.isPauseSale='' pageData.query.isPauseSale = ''
pageData.query.isGrounding='' pageData.query.isGrounding = ''
return return
} }
if(index==1){ if (index == 1) {
pageData.query.isPauseSale=1 pageData.query.isPauseSale = 1
pageData.query.isGrounding='' pageData.query.isGrounding = ''
return return
} }
if(index==2){ if (index == 2) {
pageData.query.isPauseSale='' pageData.query.isPauseSale = ''
pageData.query.isGrounding=1 pageData.query.isGrounding = 1
return return
} }
if(index==3){ if (index == 3) {
pageData.query.isPauseSale='' pageData.query.isPauseSale = ''
pageData.query.isGrounding=0 pageData.query.isGrounding = 0
return return
} }
} }
let test = ref(false) let test = ref(false)
@ -539,7 +546,7 @@
function tabsChange(i) { function tabsChange(i) {
console.log(i); console.log(i);
pageData.showGoodsDetail = i ? true : false pageData.showGoodsDetail = i ? true : false
} }

View File

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

View File

@ -1,5 +1,5 @@
<template> <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="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="u-font-32">{{data.name}}</view> <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"> <view class="u-flex u-flex-col u-row-center u-col-center bg-fff bottom">
<template v-if="data.status!='using'"> <template v-if="data.status!='using'">
<view class=" u-font-32" :style="{color:returnStutasColor(data.status)}"> <view class=" u-font-32" :style="{color:returnStutasColor(data.status)}">
{{returnStutasText(data.status)}}~</view> {{returnStutasText(data.status)}}~
</view>
</template> </template>
<view class=" w-full u-p-l-16 u-p-r-16 u-p-t-16 u-font-24"> <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="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 class=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text>
</view> </view>
@ -38,7 +39,7 @@
<template v-else> <template v-else>
<view class="u-flex u-row-center u-m-t-16"> <view class="u-flex u-row-center u-m-t-16">
<template v-if="data.tableId"> <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 color="#333" :width="150" :height="56" type="default" @click="diancan">
选择 选择
</my-button> </my-button>
@ -78,19 +79,31 @@
} from '@/http/yskApi/table.js' } from '@/http/yskApi/table.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const status = $status const status = $status
const emits = defineEmits(['more','update']) const emits = defineEmits(['more', 'update'])
function returnStutasText(key) { function returnStutasText(key) {
key = returnIsUseing(key)
const item = status[key] const item = status[key]
return item ? item.label : '' 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) { function returnStutasColor(key) {
// if(key=='using'){ // if(key=='using'){
// return 'rgb(250,85,85)' // return 'rgb(250,85,85)'
// }else{ // }else{
// return '' // return ''
// } // }
key = returnIsUseing(key)
const item = status[key] const item = status[key]
return item ? item.type : '' return item ? item.type : ''
} }
@ -126,10 +139,10 @@
function more() { function more() {
emits('more') emits('more')
} }
function diancan() { function diancan() {
const useType=props.status=='using'?props.data.useType:undefined const useType = props.status == 'using' ? props.data.useType : undefined
go.to('PAGES_CREATE_ORDER', { go.to('PAGES_CREATE_ORDER', {
tableId: props.data.tableId, tableId: props.data.tableId,
name: props.data.name, name: props.data.name,
@ -139,7 +152,7 @@
} }
function toOrderDetail() { function toOrderDetail() {
if (props.data.status == 'using') { if (props.data.status == 'using' && props.data.orderId) {
const { const {
tableId, tableId,
name, name,
@ -148,19 +161,25 @@
areaId, areaId,
orderId orderId
} = props.data } = props.data
if (!orderId) {
return uni.showToast({
icon: 'none',
title: '台桌未返回订单id'
})
}
go.to('PAGES_ORDER_DETAIL', { go.to('PAGES_ORDER_DETAIL', {
tableId, tableId,
name, name,
status, status,
amount, amount,
areaId, areaId,
id:orderId id: orderId
}) })
} }
} }
function qingtai() { function qingtai() {
const item=props.data const item = props.data
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要清台:' + props.data.name + '', content: '确定要清台:' + props.data.name + '',
@ -170,7 +189,7 @@
...item, ...item,
status: "idle", status: "idle",
qrcode: item.tableId, qrcode: item.tableId,
}).then(res=>{ }).then(res => {
infoBox.showToast('清台成功') infoBox.showToast('清台成功')
emits('update') emits('update')
}) })

View File

@ -4,19 +4,16 @@
<view class="u-flex u-flex-1 u-row-between"> <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"> <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> <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" <image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" mode="">
mode="">
</image> </image>
</view> </view>
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showstatusToggle"> <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" <text class="u-m-r-12"
:class="{'color-main':status.active!=0}">{{status.list[status.active].label }}</text> :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" <image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" mode="">
mode="">
</image> </image>
</view> </view>
</view> </view>
<view style="width: 164rpx;"></view> <view style="width: 164rpx;"></view>
<view class="search-box"> <view class="search-box">
<view class="search-btn u-flex" @tap="showSearch" :style="{width:search.show?'694rpx':'164rpx'}"> <view class="search-btn u-flex" @tap="showSearch" :style="{width:search.show?'694rpx':'164rpx'}">
@ -112,7 +109,7 @@
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const refMoreSheet = ref(null) const refMoreSheet = ref(null)
const actionSheet = reactive({ const actionSheet = reactive({
list: ['结账', '清台','增减菜','换台','打印订单','历史订单'], list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单'],
title: '', title: '',
selTable: '' selTable: ''
}) })
@ -122,33 +119,36 @@
actionSheet.selTable = table actionSheet.selTable = table
refMoreSheet.value.open() refMoreSheet.value.open()
} }
async function actionSheetClick(index) { async function actionSheetClick(index) {
console.log(index); console.log(index);
const item=actionSheet.selTable const item = actionSheet.selTable
// //
// refTableShow() // refTableShow()
if (index == 0) { if (index == 0) {
if (!item.orderId) {
return infoBox.showToast('该桌台暂无要结账的订单!')
}
return return
} }
if (index == 1) { if (index == 1) {
// //
return uni.showModal({ return uni.showModal({
title: '提示', title: '提示',
content: '确定要清台:' + item.name + '', content: '确定要清台:' + item.name + '',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
$table.update({ $table.update({
...item, ...item,
status: "idle", status: "idle",
qrcode: item.tableId, qrcode: item.tableId,
}).then(res=>{ }).then(res => {
infoBox.showToast('清台成功') infoBox.showToast('清台成功')
tableUpdate() tableUpdate()
}) })
}
} }
}) }
})
} }
if (index == 2) { if (index == 2) {
return return
@ -158,8 +158,8 @@
} }
if (index == 4) { if (index == 4) {
// //
const res=await $fun.printOrder(actionSheet.selTable.tableId) const res = await $fun.printOrder(actionSheet.selTable.tableId)
return return
} }
} }
@ -181,9 +181,10 @@
function searchConfirm() { function searchConfirm() {
hideSearch() hideSearch()
tables.list = tables.originList.filter((v) => filterTableList()
v.name.includes(search.keyword.trim()) // tables.list = tables.originList.filter((v) =>
); // v.name.includes(search.keyword.trim())
// );
} }
function hideSearch() { function hideSearch() {
@ -337,8 +338,8 @@
content content
} = await $table.get(query) } = await $table.get(query)
tables.hasAjax = true tables.hasAjax = true
tables.list = content
tables.originList = content tables.originList = content
filterTableList()
} }
const areaMap = ref({}) const areaMap = ref({})
async function getArea() { async function getArea() {
@ -353,7 +354,6 @@
prve[cur.id] = cur.name prve[cur.id] = cur.name
return prve return prve
}, {}) }, {})
console.log(areaMap);
} }
watch(() => tables.area.sel, (newval) => { watch(() => tables.area.sel, (newval) => {
console.log(newval); console.log(newval);
@ -362,13 +362,23 @@
}) })
watch(() => status.active, (newval) => { watch(() => status.active, (newval) => {
query.page = 0 query.page = 0
if (newval === 0) { // if (newval === 0) {
return tables.list = tables.originList // return tables.list = tables.originList
} // }
tables.list = tables.originList.filter((v) => { // tables.list = tables.originList.filter((v) => {
return v.status == status.list[status.active].key // 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) => { watch(() => times.active, (newval) => {
setTimer() setTimer()
}) })
@ -395,7 +405,7 @@
watch(() => times.active, (newval) => { watch(() => times.active, (newval) => {
setTimer() setTimer()
}) })
onBeforeUnmount(()=>{ onBeforeUnmount(() => {
console.log('table page onBeforeUnmount'); console.log('table page onBeforeUnmount');
clearInterval(timer) clearInterval(timer)
}) })

View File

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

View File

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

View File

@ -9,7 +9,7 @@
</view> </view>
<view class="bom"> <view class="bom">
<view @click="saveImage">下载收款码</view> <view @click="saveImage">下载收款码</view>
<view>下载收款码样式</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="search bg-fff u-flex u-col-center ">
<view class="u-flex-1"> <view class="u-flex-1">
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="输入桌号" @confirm="search" <uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="输入桌号" @confirm="search"
:focus="true" v-model="searchValue"> v-model="searchValue">
</uni-search-bar> </uni-search-bar>
</view> </view>
<!-- <view class="u-flex"> <!-- <view class="u-flex">
@ -45,6 +45,9 @@
</view> </view>
</view> </view>
</view> </view>
<template v-if="tables.list.length<=0">
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
</template>
</view> </view>
@ -142,10 +145,13 @@
content content
} = await $table.get(query) } = await $table.get(query)
tables.hasAjax = true 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.list = content
tables.selIndex = content.findIndex(v => v.tableId == option.tableId) tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
console.log(tables.selIndex );
tables.originList = content tables.originList = content
} }
async function getArea() { async function getArea() {
@ -166,6 +172,10 @@
} }
watch(() => area.sel, (newval) => { watch(() => area.sel, (newval) => {
if(!newval){
tables.list = tables.originList
return
}
tables.list = tables.originList.filter(v => v.areaId == newval.id) tables.list = tables.originList.filter(v => v.areaId == newval.id)
}) })
let option = {} let option = {}

View File

@ -2,7 +2,7 @@
<view class="page-gray u-font-28"> <view class="page-gray u-font-28">
<view class="search bg-fff u-flex u-col-center "> <view class="search bg-fff u-flex u-col-center ">
<view class="u-flex-1"> <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"> v-model="query.name">
</uni-search-bar> </uni-search-bar>
</view> </view>
@ -16,7 +16,8 @@
<my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio> <my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio>
</view> </view>
<view class="u-m-t-32 bg-fff box bg-fff"> <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="u-flex">
<view class="headimg u-flex u-row-center u-col-center"> <view class="headimg u-flex u-row-center u-col-center">
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image> <image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
@ -37,70 +38,84 @@
</view> </view>
</view> </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>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import * as Api from '@/http/yskApi/shop-user.js' import * as Api from '@/http/yskApi/shop-user.js'
import {onLoad} from '@dcloudio/uni-app' import {
onLoad
} from '@dcloudio/uni-app'
import { import {
reactive, reactive,
ref ref
} from 'vue'; } from 'vue';
let nouser = ref(false) let nouser = ref(false)
function emitChooser(data){ function emitChooser(data) {
uni.$emit('choose-user',data) uni.$emit('choose-user', data)
setTimeout(()=>{ setTimeout(() => {
uni.navigateBack() uni.navigateBack()
},100) }, 100)
} }
function chooseUser(index,item){ function chooseUser(index, item) {
if(index===undefined||item===undefined){ if (index === undefined || item === undefined) {
nouser.value=true nouser.value = true
return emitChooser({id:''}) return emitChooser({
} id: '',
else{ headImg: '',
list[index].checked=true telephone: '',
amount: '0.00',
totalScore: '0.00'
})
} else {
list[index].checked = true
emitChooser(item) emitChooser(item)
} }
} }
const query=reactive({ const query = reactive({
page:0, page: 0,
name:'', name: '',
size:300 size: 300
}) })
const list=reactive([]) const list = reactive([])
async function getUser(){ async function getUser() {
const {content}=await Api.queryAllShopUser(query) const {
for(let i in content){ content
list.push({...content[i],checked:false}) } = await Api.queryAllShopUser(query)
for (let i in content) {
list.push({
...content[i],
checked: false
})
} }
console.log(list); console.log(list);
} }
function search(){
query.page=0 function search() {
list.length=0 query.page = 0
list.length = 0
getUser() getUser()
} }
onLoad(()=>{ onLoad(() => {
getUser() getUser()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.scale7 {
.scale7{
transform: scale(0.7); transform: scale(0.7);
} }
.search { .search {
padding-right: 28rpx; padding-right: 28rpx;
@ -113,32 +128,37 @@
.list { .list {
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
.no-choose { .no-choose {
padding: 36rpx 30rpx 36rpx 24rpx; padding: 36rpx 30rpx 36rpx 24rpx;
} }
.box{
.box {
padding: 32rpx 30rpx 78rpx 24rpx; padding: 32rpx 30rpx 78rpx 24rpx;
.item{
.item {
padding: 24rpx 0; padding: 24rpx 0;
.headimg{
.headimg {
border-radius: 12rpx 12rpx 12rpx 12rpx; border-radius: 12rpx 12rpx 12rpx 12rpx;
font-size: 0; font-size: 0;
width: 84rpx; width: 84rpx;
height: 84rpx; height: 84rpx;
background-color: #eee; background-color: #eee;
overflow: hidden; overflow: hidden;
.img{
.img {
width: 84rpx; width: 84rpx;
height: 84rpx; height: 84rpx;
} }
} }
} }
.item:not(:first-child){
.item:not(:first-child) {
border-top: 1px solid #E5E5E5; border-top: 1px solid #E5E5E5;
} }
} }
} }
</style> </style>

View File

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

View File

@ -1,12 +1,18 @@
<template> <template>
<view class="page-gray color-333 u-font-28"> <view class="page-gray color-333 u-font-28">
<template v-if="true"> <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="block">
<view class="u-p-b-24 u-m-b-24 border-bottom"> <view class="u-p-b-24 u-m-b-24 border-bottom">
<view>选择用户</view> <view>选择用户</view>
<view class="u-m-t-24 u-flex u-row-between " @tap="chooseUser"> <view class="u-m-t-24 u-flex u-row-between " @tap="chooseUser">
<view v-if="!user">选择用户</view> <view v-if="!user||!user.id">选择用户</view>
<view class="u-flex" v-else> <view class="u-flex" v-if="user&&user.id">
<up-avatar :src="user.headImg" shape="square" :size="30"></up-avatar> <up-avatar :src="user.headImg" shape="square" :size="30"></up-avatar>
<!-- <view class="headeimg"> <!-- <view class="headeimg">
<image class="img" :src="user.headImg" mode=""></image> <image class="img" :src="user.headImg" mode=""></image>
@ -22,7 +28,20 @@
<uni-icons type="right" color="#999" size="16"></uni-icons> <uni-icons type="right" color="#999" size="16"></uni-icons>
</view> </view>
</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>就餐类型</view>
<view class="u-m-t-24 u-flex "> <view class="u-m-t-24 u-flex ">
<view class="u-flex color-666"> <view class="u-flex color-666">
@ -44,7 +63,7 @@
</view> </view>
<uni-icons type="right" color="#999" size="16"></uni-icons> <uni-icons type="right" color="#999" size="16"></uni-icons>
</view> </view>
</view> </view> -->
</view> </view>
@ -84,7 +103,7 @@
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex" <picker @change="userNumberChange" :value="userNumbers.defaultCateIndex"
:range="userNumbers.list"> :range="userNumbers.list">
<view class="u-m-t-24 u-flex u-row-between "> <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> <uni-icons type="right" color="#999" size="16"></uni-icons>
</view> </view>
</picker> </picker>
@ -97,7 +116,7 @@
<view class="u-p-b-24 "> <view class="u-p-b-24 ">
<view class="font-bold">订单备注</view> <view class="font-bold">订单备注</view>
<view class="u-m-t-32 u-flex "> <view class="u-m-t-32 u-flex ">
<uni-easyinput type="textarea" v-model="note" placeholder="请输入备注"></uni-easyinput> <uni-easyinput type="textarea" v-model="note" placeholder="请输入备注"></uni-easyinput>
</view> </view>
</view> </view>
@ -181,7 +200,7 @@
</view> </view>
</view> </view>
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 border-bottom"> <view class="u-flex u-row-between u-m-t-18 u-p-b-34 border-bottom">
<view> <view>
<text v-if="eatTypes.active=='takeout'">包装费</text> <text v-if="eatTypes.active=='takeout'">包装费</text>
@ -221,7 +240,7 @@
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount> <model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food> <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> <edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
</view> </view>
@ -240,10 +259,9 @@
computed, computed,
watch watch
} from 'vue'; } from 'vue';
import myButton from '@/components/my-components/my-button'
import modelDiscount from './components/discount' import modelDiscount from './components/discount'
import giveFood from './components/give-food' 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 editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { import {
@ -273,10 +291,12 @@
} }
function showModel(key, index) { function showModel(key, index) {
modelData.data =goods.list[index] modelData.data = goods.list[index]
modelData.selIndex =index modelData.selIndex = index
const model = models.get(key) const model = models.get(key)
model && model.open({remark:modelData.data.note}) model && model.open({
remark: modelData.data.note||''
})
} }
function formatPrice(n) { function formatPrice(n) {
@ -288,9 +308,10 @@
// //
const userNumbers = reactive({ const userNumbers = reactive({
list: new Array(100).fill(1).map((v, index) => { 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) => { watch(() => userNumbers.defaultCateIndex, (newval) => {
console.log(newval); console.log(newval);
@ -305,15 +326,16 @@
const res = await Api.$choseCount({ const res = await Api.$choseCount({
masterId: option.masterId, masterId: option.masterId,
tableId: table.value.tableId, tableId: table.value.tableId,
num: userNumbers.defaultCateIndex, num: userNumbers.defaultCateIndex+1,
}) })
Object.assign($seatFee, res) Object.assign($seatFee, res)
userNumbers.defaultCateIndex = res.totalNumber userNumbers.defaultCateIndex = res.totalNumber-1
} }
} }
function userNumberChange(e) { function userNumberChange(e) {
console.log(e);
userNumbers.defaultCateIndex = e.detail.value userNumbers.defaultCateIndex = e.detail.value
} }
@ -398,11 +420,11 @@
// //
watch(() => table.value, (newval, oldval) => { watch(() => table.value, (newval, oldval) => {
if (newval && oldval) { if (newval && oldval) {
Api.$choseTable({ // Api.$choseTable({
orderId: 4462, // orderId: 4462,
oldTableId: oldval.tableId, // oldTableId: oldval.tableId,
newTableId: newval.tableId, // newTableId: newval.tableId,
}) // })
} }
}) })
@ -464,7 +486,7 @@
} }
goods.list = getNowCart(records) goods.list = getNowCart(records)
if (seatFee && seatFee.totalNumber) { if (seatFee && seatFee.totalNumber) {
userNumbers.defaultCateIndex = seatFee.totalNumber || 1 userNumbers.defaultCateIndex = seatFee.totalNumber-1 || 0
Object.assign($seatFee, seatFee) Object.assign($seatFee, seatFee)
} }
@ -496,7 +518,7 @@
await Api.$choseCount({ await Api.$choseCount({
masterId: option.masterId, masterId: option.masterId,
tableId: table.value.tableId, tableId: table.value.tableId,
num: userNumbers.defaultCateIndex, num: userNumbers.defaultCateIndex+1,
}) })
} }
// updateChoseCount() // updateChoseCount()
@ -506,13 +528,22 @@
if ($shop.value.registerType == 'munchies') { if ($shop.value.registerType == 'munchies') {
// //
return go.to('PAGES_ORDER_PAY', { return go.to('PAGES_ORDER_PAY', {
orderId: res.id orderId: res.id,
}) isNowPay:true
},'redirect'
)
} else { } else {
// //
uni.navigateBack({ if (option.isCreateOrderToDetail) {
delta: 2 go.to('PAGES_ORDER_DETAIL', {
}) id: res.id
},'redirect')
} else {
uni.navigateBack({
delta: 2
})
}
// return go.to('PAGES_ORDER_DETAIL', { // return go.to('PAGES_ORDER_DETAIL', {
// id: res.id // id: res.id
// }) // })
@ -531,7 +562,7 @@
// //
async function goodsOneRemarkConfirm(e) { async function goodsOneRemarkConfirm(e) {
const cart=goods.list[modelData.selIndex] const cart = goods.list[modelData.selIndex]
await Api.$updateCart({ await Api.$updateCart({
cartId: cart.id, cartId: cart.id,
productId: cart.productId, productId: cart.productId,
@ -540,11 +571,16 @@
note: e.remark, note: e.remark,
num: cart.number // 0 num: cart.number // 0
}) })
cart.note= e.remark cart.note = e.remark
} }
function init() { async function init() {
await getTbShopInfo()
await getCart()
console.log($seatFee);
if (!$seatFee.totalNumber) {
updateChoseCount()
}
} }
onLoad((opt) => { onLoad((opt) => {
@ -558,8 +594,7 @@
} }
} }
init() init()
getCart()
getTbShopInfo()
// updateChoseCount() // updateChoseCount()
}) })
@ -578,6 +613,9 @@
uni.setStorageSync("useType", useType); uni.setStorageSync("useType", useType);
} }
const tableId = useType == 'takeout' ? undefined : table.value.tableId; const tableId = useType == 'takeout' ? undefined : table.value.tableId;
if(!goods.list.length){
return
}
const res = await Api.$changeUseType({ const res = await Api.$changeUseType({
useType, useType,
tableId, tableId,

View File

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

View File

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

View File

@ -35,19 +35,18 @@
<view class="search u-flex u-col-center "> <view class="search u-flex u-col-center ">
<view class="u-flex-1"> <view class="u-flex-1">
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search" <uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
@clear="clearSearch" @clear="clearSearch" v-model="searchValue">
v-model="searchValue">
</uni-search-bar> </uni-search-bar>
</view> </view>
<view class="u-flex"> <view class="u-flex" @click="scanCode">
<image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image> <image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image>
</view> </view>
</view> </view>
</view> </view>
<template v-if="!isSearch"> <template v-if="!isSearch">
<view class="u-menu-wrap"> <view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="data.scrollTop" <scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view"
:scroll-into-view="data.itemId"> :scroll-top="data.scrollTop" :scroll-into-view="data.itemId">
<view v-for="(item,index) in data.tabbar" :key="index" class="u-tab-item" <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)"> :class="[data.current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
<text class="u-line-1">{{item.name}}</text> <text class="u-line-1">{{item.name}}</text>
@ -58,7 +57,7 @@
<view class="page-view u-p-l-24"> <view class="page-view u-p-l-24">
<view class="list-tight-top"> <view class="list-tight-top">
<template v-if="lingshi.show"> <template v-if="lingshi.show">
<view id="lingshi" class="lingshi" @tap="toLinshi" > <view id="lingshi" class="lingshi" @tap="toLinshi">
<uni-icons type="plus-filled" size="24" :color="color.ColorMain"></uni-icons> <uni-icons type="plus-filled" size="24" :color="color.ColorMain"></uni-icons>
<view class="u-m-t-24 color-main">临时菜</view> <view class="u-m-t-24 color-main">临时菜</view>
</view> </view>
@ -67,7 +66,8 @@
<view style="height: 24px;"></view> <view style="height: 24px;"></view>
</template> </template>
</view> </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"> <view class="item-title">
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
@ -76,7 +76,7 @@
<goods-item @chooseGuige="chooseGuige($event,index)" <goods-item @chooseGuige="chooseGuige($event,index)"
@add="goodsUpdate($event,index,true)" @reduce="goodsUpdate($event,index,false)" @add="goodsUpdate($event,index,true)" @reduce="goodsUpdate($event,index,false)"
:index="goodsIndex" :data="goodsItem"></goods-item> :index="goodsIndex" :data="goodsItem"></goods-item>
</view> </view>
<!-- <template v-if="item.name==='附加费'"> <!-- <template v-if="item.name==='附加费'">
<view class="addCai" @tap="surchargeShow"> <view class="addCai" @tap="surchargeShow">
@ -92,13 +92,27 @@
</template> </template>
<template v-else> <template v-else>
<view class="u-menu-wrap"> <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> </view>
</template> </template>
<view class="bottom w-full"> <view class="bottom w-full">
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table" <my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser"
:data="cars" @clear="onClearCart"></my-car> :masterId="data.masterId" :table="data.table" :data="cars" @clear="onClearCart"></my-car>
</view> </view>
<!-- 选择规格 --> <!-- 选择规格 -->
@ -113,7 +127,9 @@
<script setup> <script setup>
import _ from 'lodash'; import _ from 'lodash';
import * as Api from '@/http/yskApi/Instead.js' import * as Api from '@/http/yskApi/Instead.js'
import {$table} from '@/http/yskApi/table.js' import {
$table
} from '@/http/yskApi/table.js'
import { import {
$tbShopCategory $tbShopCategory
} from '@/http/yskApi/goods.js' } from '@/http/yskApi/goods.js'
@ -134,7 +150,8 @@
computed, computed,
reactive, reactive,
ref, ref,
nextTick,getCurrentInstance , nextTick,
getCurrentInstance,
watch watch
} from 'vue'; } from 'vue';
import myCar from './components/car' import myCar from './components/car'
@ -151,15 +168,15 @@
} from '@/http/yskApi/user.js' } from '@/http/yskApi/user.js'
const instance = getCurrentInstance(); const instance = getCurrentInstance();
// //
const lingshi=reactive({ const lingshi = reactive({
show:false show: false
}) })
// //
const extraFee=reactive({ const extraFee = reactive({
show:false show: false
}) })
const cars = reactive([]) const cars = reactive([])
const data = reactive({ const data = reactive({
scrollTop: 0, //tab scrollTop: 0, //tab
@ -185,21 +202,33 @@
}, },
}) })
// //
let $shop=ref({}) let $shop = ref({})
async function getTbShopInfo() { async function getTbShopInfo() {
const res = await tbShopInfo() const res = await tbShopInfo()
$shop.value = res $shop.value = res
const useType=data.table.status=='using'?data.table.useType:$returnUseType(res) const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(res)
uni.setStorageSync('useType',useType) uni.setStorageSync('useType', useType)
console.log(res); console.log(res);
return res return res
} }
function scanCode() {
//
console.log('scanCode');
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
}
function setTabBar(category, goods, cars) { function setTabBar(category, goods, cars) {
const goodsCategoryMap = goods.reduce((prve, cur) => { const goodsCategoryMap = goods.reduce((prve, cur) => {
@ -287,7 +316,7 @@
} }
// //
function addCart(par) { function addCart(par) {
if(!data.table.tableId){ if (!data.table.tableId) {
return infoBox.showToast('请先选择桌台!') return infoBox.showToast('请先选择桌台!')
} }
const submitPar = { const submitPar = {
@ -353,18 +382,21 @@
// //
async function getTableInfo(){ async function getTableInfo() {
const res=await $table.get({qrcode:data.table.tableId}) const res = await $table.get({
qrcode: data.table.tableId
})
console.log(res); console.log(res);
if(res&&res.content[0]){ if (res && res.content[0]) {
// data.table=res.content[0] // data.table=res.content[0]
} }
} }
let $originGoods = []
async function init() { async function init() {
const shopInfo = await tbShopInfo() const shopInfo = await tbShopInfo()
$shop.value = shopInfo $shop.value = shopInfo
const useType=data.table.status=='using'?data.table.useType:$returnUseType(shopInfo) const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(shopInfo)
uni.setStorageSync('useType',useType) uni.setStorageSync('useType', useType)
console.log(shopInfo); console.log(shopInfo);
getTableInfo() getTableInfo()
const categoryRes = await getCategory() const categoryRes = await getCategory()
@ -384,10 +416,11 @@
} }
return isShow; return isShow;
}); });
if(!data.table.tableId){ $originGoods=goods
if (!data.table.tableId) {
// //
setTabBar(category, goods, []) setTabBar(category, goods, [])
return return
} }
const { const {
masterId masterId
@ -423,16 +456,43 @@
let searchValue = ref('') let searchValue = ref('')
let isSearch=ref(false) let isSearch = ref(false)
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() { function search() {
// isSearch.value=true isSearch.value = true
console.log(searchValue.value); searchResult.value = returnSearchGoods()
console.log(data.tabbar ); console.log(searchResult.value);
} }
function clearSearch(){
// isSearch.value=false function clearSearch() {
isSearch.value = false
} }
function chooseUser() { function chooseUser() {
go.to('PAGES_CHOOSE_USER') go.to('PAGES_CHOOSE_USER')
} }
@ -608,8 +668,10 @@
} }
function chooseGuige(foodsindex, index) { function chooseGuige(foodsindex, index) {
if(!canAddGoods()){ if (!canAddGoods()) {
return infoBox.showToast('清先选择桌台') return infoBox.showToast('清先选择桌台',0.5).then(res=>{
chooseTable()
})
} }
const $goods = data.tabbar[index].foods[foodsindex] const $goods = data.tabbar[index].foods[foodsindex]
guigeModelData.title = $goods.name guigeModelData.title = $goods.name
@ -650,6 +712,7 @@
productId, productId,
skuId skuId
}) })
infoBox.showToast('添加成功')
cars.push({ cars.push({
...cartGoods, ...cartGoods,
specSnap: sku.specSnap specSnap: sku.specSnap
@ -706,13 +769,15 @@
carGoods carGoods
} : false } : false
} }
function canAddGoods(){ function canAddGoods() {
return data.table.tableId return data.table.tableId
} }
async function goodsUpdate(foodsindex, index, isAdd) { async function goodsUpdate(foodsindex, index, isAdd) {
if(!canAddGoods()){ if (!canAddGoods()) {
return infoBox.showToast('清先选择桌台') return infoBox.showToast('请先选择桌台',0.5).then(res=>{
chooseTable()
})
} }
const $goods = data.tabbar[index].foods[foodsindex] const $goods = data.tabbar[index].foods[foodsindex]
if ($goods.isDan) { if ($goods.isDan) {
@ -754,6 +819,7 @@
productId, productId,
skuId skuId
}) })
infoBox.showToast('添加成功')
$goods.chooseNumber = num $goods.chooseNumber = num
cars.push(cartGoods) cars.push(cartGoods)
} }
@ -763,10 +829,10 @@
} }
onReady(() => { onReady(() => {
getElRect('list-tight-top').then(res=>{ getElRect('list-tight-top').then(res => {
data.topZhanwei=res.height data.topZhanwei = res.height
}) })
getMenuItemTop() getMenuItemTop()
}) })
@ -801,7 +867,7 @@
return; return;
} }
console.log(res); console.log(res);
if(dataVal){ if (dataVal) {
data[dataVal] = res.height; data[dataVal] = res.height;
} }
resolve(res); resolve(res);
@ -908,20 +974,37 @@
setUser() setUser()
}) })
} }
watch(()=>data.table.tableId,(newval)=>{ watch(() => data.table.tableId, (newval) => {
console.log(newval); console.log(newval);
init() init()
}) })
onBeforeUnmount(() => {}) onBeforeUnmount(() => {})
function watchUpdate() {
uni.$off('update:createOrderIndex')
uni.$on('update:createOrderIndex', () => {
// data.table = {
// tableId: ""
// }
cars.length = 0
console.log('update:createOrderIndex');
init()
})
}
onShow(() => { onShow(() => {
// watchChooseuser() // watchChooseuser()
watchChooseTable() watchChooseTable()
watchUpdate()
}) })
let isCreateOrderToDetail = ref(false)
onLoad((opt) => { onLoad((opt) => {
console.log(opt) console.log(opt)
Object.assign(data.table, opt) Object.assign(data.table, opt)
if(opt.useType){ if (opt.useType) {
uni.setStorageSync('useType',opt.useType) uni.setStorageSync('useType', opt.useType)
}
if (JSON.stringify(opt) == '{}') {
isCreateOrderToDetail.value = true
} }
// if (!opt.tableId) { // if (!opt.tableId) {
// infoBox.showErrorToast('') // infoBox.showErrorToast('')

View File

@ -80,12 +80,15 @@
ref ref
} from 'vue'; } from 'vue';
import { import {
onLoad onLoad,
onBackPress
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import * as Api from '@/http/yskApi/Instead.js' import * as Api from '@/http/yskApi/Instead.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
import editDiscount from '/pagesCreateOrder/components/edit-discount.vue' 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({ const pays = reactive({
list: ['扫码收款', '二维码收款'], list: ['扫码收款', '二维码收款'],
selIndex: 0, selIndex: 0,
@ -94,7 +97,11 @@
selIndex: 0 selIndex: 0
} }
}) })
let option = opt
onBackPress(()=>{
console.log('-------------------');
console.log('onBackPress');
})
const models = new Map(); const models = new Map();
function setModel(el) { function setModel(el) {
@ -107,8 +114,8 @@
const model = models.get(key) const model = models.get(key)
model && model.open() model && model.open()
} }
let user=ref({}) let user = ref({})
async function getPayType() { async function getPayType() {
const payTypeList = await Api.$getPayType() const payTypeList = await Api.$getPayType()
pays.payTypes.list = payTypeList pays.payTypes.list = payTypeList
@ -122,8 +129,10 @@
infoBox.showToast('支付成功') infoBox.showToast('支付成功')
setTimeout(() => { setTimeout(() => {
// uni.$emit('orderDetail:update') // uni.$emit('orderDetail:update')
uni.$emit('update:createOrderIndex')
console.log('update:createOrderIndex');
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 1
}) })
}, 500) }, 500)
} }
@ -182,11 +191,14 @@
} }
}) })
onLoad((opt) => { onLoad((opt) => {
option = opt
console.log(opt); console.log(opt);
Object.assign(order, opt) Object.assign(order, opt)
if(order.userId){ if (order.userId) {
queryAllShopUser({id:opt.userId}).then(res=>{ queryAllShopUser({
user.value=res.content[0]||opt 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="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold">附加费</view> <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> <my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
</template> </template>
<template v-if="orderInfo.status=='closed'"> <template v-if="orderInfo.status=='closed'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button> <my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
</template> </template>
</view> </view>
<view class="u-flex u-row-between u-m-t-20"> <template v-if="data.status!='return'">
<view>{{data.name||'餐位费'}}</view> <view class="u-flex u-row-between u-m-t-20">
<view>x{{data.number}}</view> <view>{{data.name||'餐位费'}}</view>
<view>{{data.number}}</view> <view>x{{data.number}}</view>
</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> </view>
</template> </template>
@ -49,4 +61,13 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.tag {
padding: 0 6rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.yitui {
background-color: rgb(188, 188, 188);
color: #fff;
}
}
</style> </style>

View File

@ -1,8 +1,8 @@
<template> <template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length"> <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></text>
<text class="color-main font-bold"> {{goodsNumber}}</text> <text class="color-333 "> {{goodsNumber}}</text>
<text>份菜品</text> <text>份菜品</text>
</view> </view>
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex"> <view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
@ -16,23 +16,24 @@
</view> </view>
<view class="u-p-l-30 u-flex-1"> <view class="u-p-l-30 u-flex-1">
<view class="u-flex u-row-between u-col-top"> <view class="u-flex u-row-between u-col-top">
<view class=""> <view class="">
<view class="u-flex"> <view class="u-flex">
<view class="tui" v-if="item.status=='return'"> <view class="tui" v-if="item.status=='return'">
已退 已退
</view> </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>
<view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view> <view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view>
</view> </view>
<view class="u-text-right"> <view class="u-text-right">
<template v-if="item.status=='return'"> <template v-if="item.status=='return'">
<view >0.00</view> <view>0.00</view>
<view class="line-th color-666 u-font-24">{{item.salePrice||item.price}}</view> <view class="line-th color-666 u-font-24">{{item.salePrice||item.price}}</view>
</template> </template>
<template v-else> <template v-else>
<view >{{item.salePrice||item.price}}</view> <view>{{item.salePrice||item.price}}</view>
</template> </template>
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view> <view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
</view> </view>
@ -42,44 +43,70 @@
<template v-if="orderInfo.status=='unpaid'"> <template v-if="orderInfo.status=='unpaid'">
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'"> <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 :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> </view>
</template> </template>
<template v-if="orderInfo.status=='closed'"> <template v-if="orderInfo.status=='closed'">
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'"> <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> </view>
</template> </template>
</view> </view>
</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>备注</view>
<view class="u-m-t-10">{{orderInfo.remark}}</view> <view class="u-m-t-10">{{orderInfo.remark}}</view>
</view> </view>
</view> </view>
<view class="u-m-t-40"> <view class="u-m-t-32">
<view class="u-flex u-row-between border-bottom u-p-b-20"> <view class="u-flex u-row-between border-top u-p-t-32">
<view> <view>
<template v-if="orderInfo.status=='unpaid'"> <template v-if="orderInfo.status=='unpaid'">
<view class="tag no-pay"> <view class="tag no-pay">
未支付 未支付
</view> </view>
</template> </template>
<template v-if="orderInfo.status=='refund'">
<view class="tag refund">
退款成功
</view>
</template>
</view> </view>
<view> <view>
<text>小计</text> <text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text> <text class="font-bold u-font-32">{{allPrice}}</text>
</view> </view>
</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 class="u-flex u-row-between u-m-t-20">
<view></view> <view></view>
<view> <view>
<text>总计</text> <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> </view>
<view class="u-m-t-30"> <view class="u-m-t-30">
@ -94,18 +121,28 @@
computed computed
} from 'vue'; } from 'vue';
import color from '@/commons/color.js' import color from '@/commons/color.js'
const emits=defineEmits(['tuicai','tuikuan','printOrder']) const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function tuicai(item,index){
emits('tuicai',item,index) function to2(n){
if(!n){
return 0
}
return n.toFixed(2)
} }
function tuikuan(item,index){
emits('tuikuan',item,index) function tuicai(item, index) {
emits('tuicai', item, index)
} }
function printOrder(){
function tuikuan(item, index) {
emits('tuikuan', item, index)
}
function printOrder() {
emits('printOrder') emits('printOrder')
} }
const props = defineProps({ const props = defineProps({
orderInfo:{ orderInfo: {
type: Object, type: Object,
default: () => {} default: () => {}
}, },
@ -113,55 +150,79 @@
type: Array, type: Array,
default: () => [] default: () => []
}, },
seatFee:{ seatFee: {
type:[String,Number], type: Object,
default:0 default: () => {}
} }
}) })
const allPrice = computed(() => {
return props.data.reduce((prve, cur) => { const seatFeePrice = computed(() => {
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{ if (!props.seatFee.totalAmount) {
return a+(b.salePrice||b.price) * (b.number||b.num) return 0
},0) }
return prve + curTotal const n = props.seatFee.totalAmount * (props.seatFee.status == 'return' ? 0 : 1)
}, 0).toFixed(2) return n.toFixed(2)
}) })
const allPrice = computed(() => {
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)
return goodsPrice.toFixed(2)
})
const goodsNumber = computed(() => { const goodsNumber = computed(() => {
let result = 0 let result = 0
result = props.data.reduce((a, b) => { result = props.data.reduce((a, b) => {
const bTotal = b.info.reduce((prve, cur) => { const bTotal = b.info.reduce((prve, cur) => {
return prve + (cur.number||cur.num) * 1; return prve + (cur.number || cur.num) * 1;
}, 0); }, 0);
return a + bTotal return a + bTotal
}, 0) }, 0)
return result return result
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.img { .img {
width: 70rpx; width: 152rpx;
height: 70rpx; height: 152rpx;
}
.border-top {
border-color: #F6F6F6;
} }
.border-bottom { .border-bottom {
border-color: rgb(240, 240, 240); // border-color: rgb(240, 240, 240);
border-color: #F6F6F6;
} }
.line-th{
.line-th {
text-decoration: line-through; 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 { &.no-pay {
background-color: rgb(170, 170, 170); background-color: rgb(170, 170, 170);
color: #fff; color: #fff;
} }
&.refund{
background-color: #FCE7E7;
padding: 8rpx 20rpx 6rpx 22rpx;
color: #EB4F4F;
}
} }
.tui{
.tui {
background-color: rgb(239, 239, 239); background-color: rgb(239, 239, 239);
border-radius: 4rpx; border-radius: 4rpx;
margin-right: 6rpx; margin-right: 6rpx;
@ -169,5 +230,4 @@
padding: 0 4rpx; padding: 0 4rpx;
font-size: 20rpx; font-size: 20rpx;
} }
</style> </style>

View File

@ -20,10 +20,10 @@
<view>支付方式</view> <view>支付方式</view>
<view>{{data.payType||''}}</view> <view>{{data.payType||''}}</view>
</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></view>
</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><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view> <view><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
@ -32,10 +32,10 @@
<view>订单编号</view> <view>订单编号</view>
<view>{{data.orderNo}}</view> <view>{{data.orderNo}}</view>
</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>
<my-button plain shape="circle" :width="160" :height="60">编辑</my-button> <my-button plain shape="circle" :width="160" :height="60">编辑</my-button>
</view> </view> -->
</view> </view>
</template> </template>

View File

@ -1,17 +1,30 @@
<template> <template>
<view class="u-font-28 default-box-padding u-relative bg-fff border-r-12 u-overflow-hide"> <view class="u-font-28 default-box-padding u-relative bg-fff border-r-12 u-overflow-hide">
<template v-if="orderInfo.status=='unpaid'"> <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>
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20"> <template v-if="user.id">
<view class="u-flex"> <view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
<up-avatar :size="30" :src="user.headImg"></up-avatar> <view class="u-flex">
<view class="color-666 u-m-l-30">{{user.telephone||'未绑定手机号'}}</view> <up-avatar :size="30" :src="user.headImg"></up-avatar>
<view class="color-666 u-m-l-30">{{user.telephone||'未绑定手机号'}}</view>
</view>
<view>
<my-button @click="toOrder" :height="60" plain shape="circle">他的订单</my-button>
</view>
</view> </view>
<view> </template>
<my-button @click="toOrder" :height="60" plain shape="circle">他的订单</my-button> <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> </view>
</view> </template>
<view class="u-flex u-m-t-20 u-row-between"> <view class="u-flex u-m-t-20 u-row-between">
<view class=""> <view class="">
<view class="font-bold">{{user.amount}}</view> <view class="font-bold">{{user.amount}}</view>
@ -66,8 +79,9 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.change { .change {
padding: 4rpx 16rpx; padding: 2rpx 22rpx 4rpx 14rpx;
border-radius: 0 0 16rpx 0; border-radius: 18rpx 0rpx 18rpx 0rpx;
background: linear-gradient( 139deg, #74B0FF 0%, #318AFE 100%);
z-index: 2; z-index: 2;
} }
</style> </style>

View File

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

View File

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

View File

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

View File

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