Merge branch 'test' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into dwb
This commit is contained in:
commit
7089021581
|
|
@ -4,19 +4,16 @@
|
|||
"version" : "0.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"app-plus" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
"app-plus" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
},
|
||||
{
|
||||
"playground" : "custom",
|
||||
|
|
|
|||
|
|
@ -389,4 +389,7 @@ text {
|
|||
// }
|
||||
// .u-font-32{
|
||||
// font-size: 16px;
|
||||
// }
|
||||
// }
|
||||
.line-th{
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ const model = {
|
|||
// 返回: promise对象, 当提示消失后调用 resolve()
|
||||
showToast: (title, duration = 1.5, extObject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.showToast(Object.assign({ title: title, icon: 'none', mask: true, duration: (duration * 1000) }, extObject))
|
||||
uni.showToast(Object.assign({ title: title, icon: 'none', mask: false, duration: (duration * 1000) }, extObject))
|
||||
setTimeout(resolve, (duration * 1000));
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@
|
|||
let currentPage = ref(props.page === 0 ? 1 : props.page)
|
||||
|
||||
function returnMaxPage() {
|
||||
return Math.ceil(props.totalElements / props.size)
|
||||
const result=Math.ceil(props.totalElements / props.size)
|
||||
return (result-1<=0?1:result-1)
|
||||
}
|
||||
let maxPage=ref(returnMaxPage())
|
||||
const pagesData = computed(() => {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ function commonsProcess(showLoading, httpReqCallback){
|
|||
// http响应码不正确
|
||||
if(statusCode != 200){
|
||||
isShowErrorToast = true
|
||||
infoBox.showErrorToast('服务器异常')
|
||||
infoBox.showToast('服务器异常')
|
||||
return Promise.reject(bodyData) // 跳转到catch函数
|
||||
}
|
||||
|
||||
|
|
@ -105,14 +105,11 @@ function commonsProcess(showLoading, httpReqCallback){
|
|||
return Promise.resolve({ bizData: bodyData.data, code: bodyData.code })
|
||||
|
||||
}).catch( res => {
|
||||
|
||||
reqFinishFunc(); // 请求完毕的动作
|
||||
|
||||
// 如果没有提示错误, 那么此处提示 异常。
|
||||
if(!isShowErrorToast){
|
||||
infoBox.showErrorToast(`请求网络异常`)
|
||||
infoBox.showToast(`请求网络异常`)
|
||||
}
|
||||
|
||||
return Promise.reject(res)
|
||||
|
||||
}).finally(() => { // finally 是 then结束后再执行, 此处不适用。 需要在请求完成后立马调用: reqFinishFunc()
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ function commonsProcess(showLoading, httpReqCallback) {
|
|||
// http响应码不正确
|
||||
if (statusCode != 200 && statusCode != 204 && statusCode != 201) {
|
||||
isShowErrorToast = true
|
||||
infoBox.showErrorToast(data.message || '服务器异常')
|
||||
infoBox.showToast(data.message || '服务器异常')
|
||||
return Promise.reject(bodyData) // 跳转到catch函数
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,13 +71,13 @@
|
|||
"amap" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appkey_ios" : "0b9be2631525ee5e218ac26d333f215c",
|
||||
"appkey_android" : "39854b629c421d511a0697f2ae3b18f6"
|
||||
"appkey_android" : "9d1e62050f8558a082f7aa3ad5bb3c68"
|
||||
}
|
||||
},
|
||||
"maps" : {
|
||||
"amap" : {
|
||||
"appkey_ios" : "0b9be2631525ee5e218ac26d333f215c",
|
||||
"appkey_android" : "39854b629c421d511a0697f2ae3b18f6"
|
||||
"appkey_android" : "9d1e62050f8558a082f7aa3ad5bb3c68"
|
||||
}
|
||||
},
|
||||
"ad" : {},
|
||||
|
|
@ -223,6 +223,15 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sdkConfigs" : {
|
||||
"maps" : {
|
||||
"amap" : {
|
||||
"key" : "6033c97e67bf2e9ceac306e1a3fa35f8",
|
||||
"securityJsCode" : "0547b69252ef0ed14e11f5c4ac152f07",
|
||||
"serviceHost" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-alipay" : {
|
||||
|
|
|
|||
|
|
@ -143,7 +143,10 @@
|
|||
page: 0,
|
||||
size: 999,
|
||||
categoryId: '',
|
||||
name: ''
|
||||
name: '',
|
||||
createdAt: [],
|
||||
id: "",
|
||||
sort: "createdAt,desc"
|
||||
},
|
||||
category: '',
|
||||
categoryList: [], //分类列表
|
||||
|
|
|
|||
|
|
@ -1508,6 +1508,13 @@
|
|||
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//编辑
|
||||
if (newval === 'sku') {
|
||||
skuList.list = []
|
||||
} else {
|
||||
skuList.list=$goodsData.skuList
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,62 +1,53 @@
|
|||
<template>
|
||||
<view class="page">
|
||||
<view class="box">
|
||||
<view class="block border-top-0">
|
||||
<uni-forms ref="nameFormRef" :model="specifications" :rules="rules" :label-width="350"
|
||||
label-position="top" validateTrigger="blur">
|
||||
<uni-forms-item label="模版名称" required name="name">
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="specifications.name" placeholder="模版名称,如:衣服" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view v-for="(item,index) in specifications.list" :key="index">
|
||||
<uni-forms :model="item" :rules="rules" err-show-type="undertext" validateTrigger="blur"
|
||||
:ref="setFormRef(index)" :border="true" label-position="top" label-width="350">
|
||||
|
||||
<view class="block">
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="规格组名" required name="name" >
|
||||
<uni-forms-item label="规格组名" required name="name">
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="item.name" placeholder="规格组名" />
|
||||
v-model="item.name" placeholder="规格组名,如:尺码" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<!-- <uni-forms-item label="最少可选" required name="MinOptional" >
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="item.MinOptional" type="number" placeholder="填写最小数量" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="最大可选" required name="MaxOptional" >
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="item.MaxOptional" type="number" placeholder="填写最大数量" />
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="选项值">
|
||||
<uni-forms-item label="规格值">
|
||||
<view class="option">
|
||||
<view class="u-flex">
|
||||
<view class="u-flex-1">名称</view>
|
||||
<view class="u-flex-1 u-p-l-60">加价</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-flex option-item"
|
||||
|
||||
v-for="(option,optionIndex) in item.options"
|
||||
:key="optionIndex"
|
||||
>
|
||||
<view class="">
|
||||
<view class="u-flex option-item" v-for="(option,optionIndex) in item.options"
|
||||
:key="optionIndex">
|
||||
<view class="u-flex-1">
|
||||
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'optionName']"
|
||||
:ref="setFormInputRef(index,optionIndex)"
|
||||
:rules="[{'required': true,errorMessage: '必填'}]"
|
||||
label-width="0" label="" required :showRequired="false"
|
||||
>
|
||||
<uni-easyinput v-model="specifications.list[index].options[optionIndex].optionName"
|
||||
@input="inpuChange(index,optionIndex)"
|
||||
|
||||
<uni-forms-item :key="optionIndex" :name="['options',optionIndex,'name']"
|
||||
:ref="setFormInputRef(index,optionIndex)"
|
||||
:rules="[{'required': true,errorMessage: '必填'}]" label-width="0"
|
||||
label="" required :showRequired="false">
|
||||
<uni-easyinput
|
||||
v-model="specifications.list[index].options[optionIndex].name"
|
||||
@input="inpuChange(index,optionIndex)"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
placeholder="选项名" />
|
||||
placeholder="请输入规格值,如:S、M" />
|
||||
</uni-forms-item>
|
||||
|
||||
</view>
|
||||
<view class="u-p-l-60 u-flex-1 u-flex">
|
||||
<uni-forms-item :key="optionIndex"
|
||||
:rules="[{'required': true,errorMessage: '必填'}]"
|
||||
:ref="setFormInputRef(index,optionIndex)"
|
||||
:name="['options',optionIndex,'optionPrice']" label-width="0" label="" required :showRequired="false"
|
||||
>
|
||||
<view class=" u-flex">
|
||||
<uni-forms-item :key="optionIndex" label-width="0" label=""
|
||||
:showRequired="false">
|
||||
<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)"
|
||||
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
type="digit" placeholder="填写价格" />
|
||||
type="digit" placeholder="填写价格" /> -->
|
||||
|
||||
<view class="icon icon-reduce u-m-l-38"
|
||||
@click="delOption(index,optionIndex)">
|
||||
|
|
@ -79,7 +70,7 @@
|
|||
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
|
||||
|
||||
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
|
||||
<view class="icon icon-reduce u-m-r-22 ">
|
||||
|
||||
|
|
@ -106,10 +97,14 @@
|
|||
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
$productSpec
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import {
|
||||
onLoad,
|
||||
onReady
|
||||
onReady,
|
||||
} from '@dcloudio/uni-app';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
|
|
@ -117,8 +112,9 @@
|
|||
ref,
|
||||
onBeforeMount
|
||||
} from 'vue';
|
||||
const nameFormRef = ref(null)
|
||||
// 表单样式
|
||||
const placeholderStyle = ref('font-size:28rpx;')
|
||||
const placeholderStyle = ref('font-size:28rpx;')
|
||||
//表单边框
|
||||
const inputBorder = ref(false)
|
||||
const form = ref(null)
|
||||
|
|
@ -143,12 +139,6 @@
|
|||
errorMessage: '必填'
|
||||
}]
|
||||
},
|
||||
optionName: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '必填'
|
||||
}]
|
||||
},
|
||||
optionPrice: {
|
||||
rules: [{
|
||||
required: true,
|
||||
|
|
@ -157,10 +147,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 构造规格的选项值的基础数据
|
||||
const specificationsOptionsBasicData = {
|
||||
optionName: '',
|
||||
name: '',
|
||||
optionPrice: '0.00'
|
||||
}
|
||||
|
||||
|
|
@ -172,8 +162,8 @@
|
|||
// 构造规格的基础数据
|
||||
const specificationsBasicData = {
|
||||
name: '',
|
||||
MinOptional: 1,
|
||||
MaxOptional: 1,
|
||||
// MinOptional: 1,
|
||||
// MaxOptional: 1,
|
||||
options: []
|
||||
}
|
||||
|
||||
|
|
@ -189,6 +179,7 @@
|
|||
}
|
||||
// 规格列表
|
||||
const specifications = reactive({
|
||||
name: '',
|
||||
list: [returnSpecificationsOptionsBasicData()]
|
||||
})
|
||||
|
||||
|
|
@ -235,7 +226,8 @@
|
|||
};
|
||||
}
|
||||
// 绑定option input元素
|
||||
const refFormInput=ref([])
|
||||
const refFormInput = ref([])
|
||||
|
||||
function setFormInputRef(index, index1) {
|
||||
const newIndex = index * 10000 + index1
|
||||
return (el) => {
|
||||
|
|
@ -252,61 +244,104 @@
|
|||
console.log(refFormInput.value[newIndex]);
|
||||
refFormInput.value[newIndex].onFieldChange()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let emitName=''
|
||||
function triggerEvent (emitName,data){
|
||||
if(emitName){
|
||||
uni.$emit(emitName,data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const option = {
|
||||
type: 'add',
|
||||
id: undefined
|
||||
}
|
||||
onLoad(opt=>{
|
||||
const arr=uni.getStorageSync('guige')
|
||||
if(arr.length){
|
||||
specifications.list=arr
|
||||
console.log(arr);
|
||||
}
|
||||
onLoad(opt => {
|
||||
console.log(opt);
|
||||
if(opt&&JSON.stringify(opt)!=='{}'&&opt.emitName){
|
||||
emitName=opt.emitName
|
||||
if (opt && JSON.stringify(opt) !== '{}' && opt.type) {
|
||||
option.type = opt.type
|
||||
const data = uni.getStorageSync('spec')
|
||||
uni.removeStorageSync('spec')
|
||||
if(data){
|
||||
specifications.name = data.name
|
||||
specifications.id = data.id
|
||||
specifications.list = data.specList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
options: v.value.map(v => {
|
||||
return {
|
||||
name: v
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
uni.setNavigationBarTitle({
|
||||
title:emitName?'编辑规格模版':'添加规格模版'
|
||||
title: option.type === 'edit' ? '编辑规格模版' : '添加规格模版'
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
function emitspecificationsSave(){
|
||||
// emitspecificationsSave 触发规格保存事件将数据给到添加商品页面
|
||||
// guigeEdit 触发规格保存事件将数据给到添加规格页面
|
||||
uni.removeStorageSync('guige')
|
||||
triggerEvent(emitName,specifications.list)
|
||||
}
|
||||
function returnPromise(index,prosise){
|
||||
return new Promise((resolve,reject)=>{
|
||||
prosise.then(res=>{
|
||||
|
||||
function returnPromise(prosise, index) {
|
||||
return new Promise((resolve, reject) => {
|
||||
prosise.then(res => {
|
||||
console.log(res);
|
||||
resolve({sucees:true})
|
||||
}).catch(err=>{
|
||||
resolve({
|
||||
sucees: true
|
||||
})
|
||||
}).catch(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) {
|
||||
const res=await returnPromise(i,formRefs.value[i].validate())
|
||||
isAllPassForm+=res.sucees?1:0
|
||||
const res = await returnPromise(formRefs.value[i].validate(), i)
|
||||
isAllPassForm += res.sucees ? 1 : 0
|
||||
}
|
||||
//判断验证是否通过
|
||||
if(isAllPassForm===specifications.list.length){
|
||||
if (isAllPassForm === specifications.list.length) {
|
||||
console.log('pass');
|
||||
emitspecificationsSave()
|
||||
go.back()
|
||||
const data = {
|
||||
name: specifications.name,
|
||||
id:specifications.id,
|
||||
specList: specifications.list.map(v => {
|
||||
return {
|
||||
...v,
|
||||
value: v.options.map(v => v.name),
|
||||
options: undefined
|
||||
}
|
||||
})
|
||||
}
|
||||
if (option.type === 'add') {
|
||||
return $productSpec.add(data).then(res => {
|
||||
infoBox.showSuccessToast('添加成功')
|
||||
settimeoutBack(1500)
|
||||
})
|
||||
}
|
||||
|
||||
$productSpec.update(data).then(res => {
|
||||
infoBox.showSuccessToast('修改成功')
|
||||
settimeoutBack(1500)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,12 +124,15 @@
|
|||
|
||||
<view class="save-btn-box">
|
||||
<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-flex u-row-center">
|
||||
<view class="u-m-r-6">批量修改</view>
|
||||
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
|
||||
</view>
|
||||
</button>
|
||||
<view class="u-m-t-20">
|
||||
<button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow">
|
||||
<view class="u-flex u-row-center">
|
||||
<view class="u-m-r-6">批量修改</view>
|
||||
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom" ref="bottom"></view>
|
||||
|
|
|
|||
|
|
@ -8,16 +8,19 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-36">
|
||||
<view class="u-m-b-24" v-for="(item,index) in list" :key="index">
|
||||
<view>{{item.text}}:</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-input v-model="item.value">
|
||||
<template #suffix>
|
||||
<up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button>
|
||||
</template>
|
||||
</up-input>
|
||||
<scroll-view scroll-y="true" style="max-height: 70vh;">
|
||||
<view class="u-m-b-24" v-for="(item,index) in list" :key="index">
|
||||
<view>{{item.text}}:</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-input v-model="item.value">
|
||||
<template #suffix>
|
||||
<up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
|
|
|
|||
|
|
@ -10,18 +10,20 @@
|
|||
<view class="u-m-t-48">
|
||||
<view class="u-flex u-row-between border-bottom u-p-b-30">
|
||||
<view>当前状态</view>
|
||||
<view class="u-flex">
|
||||
<view class="u-flex u-relative">
|
||||
<up-radio-group v-model="isGrounding" placement="row" @change="isGroundingChange">
|
||||
<up-radio :customStyle="{marginRight: '10px'}" v-for="(item, index) in status.list"
|
||||
:key="index" :label="item.label" :name="item.name">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
<view class="u-absolute position-all" @click="hasShangXiajia(true)" v-if="!canShangXiaJia"></view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class=" u-flex u-row-between u-m-t-30">
|
||||
<view class=" u-flex u-row-between u-m-t-30 u-relative">
|
||||
<view>售罄</view>
|
||||
<up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
|
||||
<view class="u-absolute position-all" @click="hasShouQing(true)" v-if="!canShouQing"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -44,6 +46,7 @@
|
|||
$updateProductStatus,$updateProductData,
|
||||
$tbProskuConV2
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
|
|
@ -98,7 +101,8 @@
|
|||
}
|
||||
|
||||
function open() {
|
||||
|
||||
hasShangXiajia()
|
||||
hasShouQing()
|
||||
}
|
||||
|
||||
function save() {
|
||||
|
|
@ -113,8 +117,20 @@
|
|||
...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) {
|
||||
if(!canShangXiaJia.value){
|
||||
return
|
||||
}
|
||||
await upDateGoods({
|
||||
key:'grounding',
|
||||
value: e
|
||||
|
|
@ -124,6 +140,9 @@
|
|||
}
|
||||
|
||||
async function isPauseSaleChange(e) {
|
||||
if(!canShouQing.value){
|
||||
return
|
||||
}
|
||||
console.log(e);
|
||||
await upDateGoods({
|
||||
key:'pauseSale',
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@
|
|||
<view class="goods-list u-p-30">
|
||||
<template v-if="pageData.goodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick"
|
||||
@edit="toGoodsDetail"
|
||||
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
|
||||
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow"
|
||||
@changeClick="goodsChangeClick" @edit="toGoodsDetail" @editStock="changeStockShow"
|
||||
@guigeClick="editGuigeShow" @baosun="baosunShow" @radioClick="goodsRadioClick" :index="index"
|
||||
:data="item" @del="goodsDel" :showChecked="showChecked"
|
||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="pageData.hasAjax&&!pageData.goodsList.length">
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
<my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
</template>
|
||||
|
||||
|
||||
<view style="height: 100rpx;"></view>
|
||||
</view>
|
||||
|
||||
|
|
@ -150,7 +150,9 @@
|
|||
watch
|
||||
} from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
import myGoods from './components/goods.vue'
|
||||
import myControl from './components/control.vue'
|
||||
import myCategory from './components/category.vue'
|
||||
|
|
@ -191,10 +193,13 @@
|
|||
query: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
createdAt: [],
|
||||
id: "",
|
||||
categoryId: '',
|
||||
name: '',
|
||||
isPauseSale:'',
|
||||
isGrounding:''
|
||||
isPauseSale: '',
|
||||
sort: "createdAt,desc",
|
||||
isGrounding: ''
|
||||
},
|
||||
category: '',
|
||||
categoryList: [], //分类列表
|
||||
|
|
@ -288,8 +293,8 @@
|
|||
|
||||
// 修改库存弹窗展示
|
||||
async function changeStockShow(index) {
|
||||
const res= await hasPermission('允许修改商品库存')
|
||||
if(!res){
|
||||
const res = await hasPermission('允许修改商品库存')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
pageData.selGoodsIndex = index
|
||||
|
|
@ -393,9 +398,10 @@
|
|||
pageData.totalElements = res.totalElements
|
||||
})
|
||||
}
|
||||
function watchEmitInit(){
|
||||
|
||||
function watchEmitInit() {
|
||||
uni.$off('update:productIndex')
|
||||
uni.$on('update:productIndex',(data)=>{
|
||||
uni.$on('update:productIndex', (data) => {
|
||||
getGoodsList()
|
||||
})
|
||||
}
|
||||
|
|
@ -425,6 +431,7 @@
|
|||
pageData.reportData = pageData.goodsList[index]
|
||||
reportDamage.value.open();
|
||||
}
|
||||
|
||||
function returnGoodsStockData() {
|
||||
return reactive({
|
||||
sort: 0,
|
||||
|
|
@ -472,7 +479,7 @@
|
|||
Object.assign(goodsStockData, goods)
|
||||
goodsStockModel.value.open()
|
||||
}
|
||||
|
||||
|
||||
//删除商品
|
||||
function goodsDel(index) {
|
||||
const goods = pageData.goodsList[index]
|
||||
|
|
@ -492,15 +499,15 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resetQuery(){
|
||||
pageData.totalElements=0;
|
||||
pageData.query.page=0;
|
||||
|
||||
function resetQuery() {
|
||||
pageData.totalElements = 0;
|
||||
pageData.query.page = 0;
|
||||
}
|
||||
|
||||
async function toGoodsDetail(id){
|
||||
const res= await hasPermission('允许修改商品')
|
||||
if(!res){
|
||||
|
||||
async function toGoodsDetail(id) {
|
||||
const res = await hasPermission('允许修改商品')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
go.to('PAGES_PRODUCT_ADD', {
|
||||
|
|
@ -508,30 +515,30 @@
|
|||
productId: id
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index;
|
||||
resetQuery()
|
||||
console.log(index);
|
||||
if(index==0){
|
||||
pageData.query.isPauseSale=''
|
||||
pageData.query.isGrounding=''
|
||||
return
|
||||
if (index == 0) {
|
||||
pageData.query.isPauseSale = ''
|
||||
pageData.query.isGrounding = ''
|
||||
return
|
||||
}
|
||||
if(index==1){
|
||||
pageData.query.isPauseSale=1
|
||||
pageData.query.isGrounding=''
|
||||
return
|
||||
if (index == 1) {
|
||||
pageData.query.isPauseSale = 1
|
||||
pageData.query.isGrounding = ''
|
||||
return
|
||||
}
|
||||
if(index==2){
|
||||
pageData.query.isPauseSale=''
|
||||
pageData.query.isGrounding=1
|
||||
return
|
||||
if (index == 2) {
|
||||
pageData.query.isPauseSale = ''
|
||||
pageData.query.isGrounding = 1
|
||||
return
|
||||
}
|
||||
if(index==3){
|
||||
pageData.query.isPauseSale=''
|
||||
pageData.query.isGrounding=0
|
||||
return
|
||||
if (index == 3) {
|
||||
pageData.query.isPauseSale = ''
|
||||
pageData.query.isGrounding = 0
|
||||
return
|
||||
}
|
||||
}
|
||||
let test = ref(false)
|
||||
|
|
@ -539,7 +546,7 @@
|
|||
function tabsChange(i) {
|
||||
console.log(i);
|
||||
pageData.showGoodsDetail = i ? true : false
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import { reactive, ref } from 'vue';
|
|||
emits('del',props.index)
|
||||
}
|
||||
function edit(){
|
||||
uni.$emit('edit:spec',props.data)
|
||||
uni.setStorageSync('spec',props.data)
|
||||
go.to('PAGES_PRODUCT_GUIGE_ADD', {
|
||||
type: 'edit'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<view class="item color-fff border-r-12" :class="[data.status]" @click="toOrderDetail">
|
||||
<view class="item color-fff border-r-12" :class="[computedClass]" @click="toOrderDetail">
|
||||
<view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="u-font-32">{{data.name}}</view>
|
||||
|
|
@ -18,10 +18,11 @@
|
|||
<view class="u-flex u-flex-col u-row-center u-col-center bg-fff bottom">
|
||||
<template v-if="data.status!='using'">
|
||||
<view class=" u-font-32" :style="{color:returnStutasColor(data.status)}">
|
||||
{{returnStutasText(data.status)}}~</view>
|
||||
{{returnStutasText(data.status)}}~
|
||||
</view>
|
||||
</template>
|
||||
<view class=" w-full u-p-l-16 u-p-r-16 u-p-t-16 u-font-24">
|
||||
<template v-if="data.status=='using'">
|
||||
<template v-if="data.status=='using'&& data.orderId">
|
||||
<view class="color-666 u-text-left u-p-b-20 border-bottom">
|
||||
<view class=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}件</text>
|
||||
</view>
|
||||
|
|
@ -38,7 +39,7 @@
|
|||
<template v-else>
|
||||
<view class="u-flex u-row-center u-m-t-16">
|
||||
<template v-if="data.tableId">
|
||||
<template v-if="data.status=='idle' ">
|
||||
<template v-if="data.status=='idle'||(data.status=='using'&&!data.orderId) ">
|
||||
<my-button color="#333" :width="150" :height="56" type="default" @click="diancan">
|
||||
选择
|
||||
</my-button>
|
||||
|
|
@ -78,19 +79,31 @@
|
|||
} from '@/http/yskApi/table.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const status = $status
|
||||
const emits = defineEmits(['more','update'])
|
||||
const emits = defineEmits(['more', 'update'])
|
||||
|
||||
function returnStutasText(key) {
|
||||
key = returnIsUseing(key)
|
||||
const item = status[key]
|
||||
return item ? item.label : ''
|
||||
}
|
||||
|
||||
const computedClass = computed(() => {
|
||||
const key = returnIsUseing(props.data.status)
|
||||
return key
|
||||
})
|
||||
|
||||
function returnIsUseing(key) {
|
||||
// return key = key == 'using' ? (props.data.orderId ? key : 'idle') : key
|
||||
return key
|
||||
}
|
||||
|
||||
function returnStutasColor(key) {
|
||||
// if(key=='using'){
|
||||
// return 'rgb(250,85,85)'
|
||||
// }else{
|
||||
// return ''
|
||||
// }
|
||||
key = returnIsUseing(key)
|
||||
const item = status[key]
|
||||
return item ? item.type : ''
|
||||
}
|
||||
|
|
@ -126,10 +139,10 @@
|
|||
function more() {
|
||||
emits('more')
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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', {
|
||||
tableId: props.data.tableId,
|
||||
name: props.data.name,
|
||||
|
|
@ -139,7 +152,7 @@
|
|||
}
|
||||
|
||||
function toOrderDetail() {
|
||||
if (props.data.status == 'using') {
|
||||
if (props.data.status == 'using' && props.data.orderId) {
|
||||
const {
|
||||
tableId,
|
||||
name,
|
||||
|
|
@ -148,19 +161,25 @@
|
|||
areaId,
|
||||
orderId
|
||||
} = props.data
|
||||
if (!orderId) {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '台桌未返回订单id'
|
||||
})
|
||||
}
|
||||
go.to('PAGES_ORDER_DETAIL', {
|
||||
tableId,
|
||||
name,
|
||||
status,
|
||||
amount,
|
||||
areaId,
|
||||
id:orderId
|
||||
id: orderId
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function qingtai() {
|
||||
const item=props.data
|
||||
const item = props.data
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要清台:' + props.data.name + '?',
|
||||
|
|
@ -170,7 +189,7 @@
|
|||
...item,
|
||||
status: "idle",
|
||||
qrcode: item.tableId,
|
||||
}).then(res=>{
|
||||
}).then(res => {
|
||||
infoBox.showToast('清台成功')
|
||||
emits('update')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4,19 +4,16 @@
|
|||
<view class="u-flex u-flex-1 u-row-between">
|
||||
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showsTimesToggle">
|
||||
<text class="u-m-r-12">{{times.list[times.active]}}秒</text>
|
||||
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill"
|
||||
mode="">
|
||||
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" mode="">
|
||||
</image>
|
||||
</view>
|
||||
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showstatusToggle">
|
||||
<text class="u-m-r-12"
|
||||
:class="{'color-main':status.active!=0}">{{status.list[status.active].label }}</text>
|
||||
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill"
|
||||
mode="">
|
||||
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" mode="">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="width: 164rpx;"></view>
|
||||
<view class="search-box">
|
||||
<view class="search-btn u-flex" @tap="showSearch" :style="{width:search.show?'694rpx':'164rpx'}">
|
||||
|
|
@ -112,7 +109,7 @@
|
|||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const refMoreSheet = ref(null)
|
||||
const actionSheet = reactive({
|
||||
list: ['结账', '清台','增减菜','换台','打印订单','历史订单'],
|
||||
list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单'],
|
||||
title: '',
|
||||
selTable: ''
|
||||
})
|
||||
|
|
@ -122,33 +119,36 @@
|
|||
actionSheet.selTable = table
|
||||
refMoreSheet.value.open()
|
||||
}
|
||||
|
||||
|
||||
async function actionSheetClick(index) {
|
||||
console.log(index);
|
||||
const item=actionSheet.selTable
|
||||
const item = actionSheet.selTable
|
||||
//编辑
|
||||
// refTableShow()
|
||||
if (index == 0) {
|
||||
if (!item.orderId) {
|
||||
return infoBox.showToast('该桌台暂无要结账的订单!')
|
||||
}
|
||||
return
|
||||
}
|
||||
if (index == 1) {
|
||||
//清台
|
||||
return uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要清台:' + item.name + '?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
$table.update({
|
||||
...item,
|
||||
status: "idle",
|
||||
qrcode: item.tableId,
|
||||
}).then(res=>{
|
||||
infoBox.showToast('清台成功')
|
||||
tableUpdate()
|
||||
})
|
||||
}
|
||||
title: '提示',
|
||||
content: '确定要清台:' + item.name + '?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
$table.update({
|
||||
...item,
|
||||
status: "idle",
|
||||
qrcode: item.tableId,
|
||||
}).then(res => {
|
||||
infoBox.showToast('清台成功')
|
||||
tableUpdate()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (index == 2) {
|
||||
return
|
||||
|
|
@ -158,8 +158,8 @@
|
|||
}
|
||||
if (index == 4) {
|
||||
//打印订单
|
||||
const res=await $fun.printOrder(actionSheet.selTable.tableId)
|
||||
return
|
||||
const res = await $fun.printOrder(actionSheet.selTable.tableId)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -181,9 +181,10 @@
|
|||
|
||||
function searchConfirm() {
|
||||
hideSearch()
|
||||
tables.list = tables.originList.filter((v) =>
|
||||
v.name.includes(search.keyword.trim())
|
||||
);
|
||||
filterTableList()
|
||||
// tables.list = tables.originList.filter((v) =>
|
||||
// v.name.includes(search.keyword.trim())
|
||||
// );
|
||||
}
|
||||
|
||||
function hideSearch() {
|
||||
|
|
@ -337,8 +338,8 @@
|
|||
content
|
||||
} = await $table.get(query)
|
||||
tables.hasAjax = true
|
||||
tables.list = content
|
||||
tables.originList = content
|
||||
filterTableList()
|
||||
}
|
||||
const areaMap = ref({})
|
||||
async function getArea() {
|
||||
|
|
@ -353,7 +354,6 @@
|
|||
prve[cur.id] = cur.name
|
||||
return prve
|
||||
}, {})
|
||||
console.log(areaMap);
|
||||
}
|
||||
watch(() => tables.area.sel, (newval) => {
|
||||
console.log(newval);
|
||||
|
|
@ -362,13 +362,23 @@
|
|||
})
|
||||
watch(() => status.active, (newval) => {
|
||||
query.page = 0
|
||||
if (newval === 0) {
|
||||
return tables.list = tables.originList
|
||||
}
|
||||
tables.list = tables.originList.filter((v) => {
|
||||
return v.status == status.list[status.active].key
|
||||
});
|
||||
// if (newval === 0) {
|
||||
// return tables.list = tables.originList
|
||||
// }
|
||||
// tables.list = tables.originList.filter((v) => {
|
||||
// return v.status == status.list[status.active].key
|
||||
// });
|
||||
filterTableList()
|
||||
})
|
||||
|
||||
function filterTableList() {
|
||||
tables.list = tables.originList.filter((v) => {
|
||||
console.log(status.list[status.active].key);
|
||||
return (status.active == 0 ? true : v.status == status.list[status.active].key) && (
|
||||
v.name.includes(search.keyword.trim())
|
||||
)
|
||||
});
|
||||
}
|
||||
watch(() => times.active, (newval) => {
|
||||
setTimer()
|
||||
})
|
||||
|
|
@ -395,7 +405,7 @@
|
|||
watch(() => times.active, (newval) => {
|
||||
setTimer()
|
||||
})
|
||||
onBeforeUnmount(()=>{
|
||||
onBeforeUnmount(() => {
|
||||
console.log('table page onBeforeUnmount');
|
||||
clearInterval(timer)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
<view class="u-m-t-24 u-flex u-row-between">
|
||||
<view></view>
|
||||
<view class="u-flex">
|
||||
<view class="btn-default btn">查看订单</view>
|
||||
<view class="btn-default btn" @click="toOrder">查看订单</view>
|
||||
<view class="btn-primary btn u-m-l-38" @click="moreOperate">更多操作</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -106,6 +106,12 @@
|
|||
function toYue(){
|
||||
go.to('PAGES_RECHARGE_INDEX',{id:''})
|
||||
}
|
||||
function toOrder(){
|
||||
go.to('PAGES_ORDER_INDEX',{
|
||||
userId:props.data.id||'',
|
||||
type:'user'
|
||||
})
|
||||
}
|
||||
|
||||
function remark(){
|
||||
console.log(props.index);
|
||||
|
|
|
|||
14
pages.json
14
pages.json
|
|
@ -1246,6 +1246,20 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "订单详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_ORDER_PAY",
|
||||
"path": "pay-order/pay-order",
|
||||
"style": {
|
||||
"navigationBarTitleText": "结账"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_ORDER_TUIKUAN",
|
||||
"path": "tuikuan/tuikuan",
|
||||
"style": {
|
||||
"navigationBarTitleText": "退款"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@
|
|||
<view class="label">门店详细地址</view>
|
||||
<view class="right"><view>{{ vdata.shopInfo.address }}</view><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
|
||||
</view>
|
||||
<view class="page-cell">
|
||||
<!-- <view class="page-cell">
|
||||
<view class="label">堂食功能</view>
|
||||
<view class="right"><up-switch v-model="vdata.dineIn" size="20" activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="page-cell">
|
||||
<view class="label">允许打包</view>
|
||||
<view class="right"><up-switch v-model="vdata.takeout" size="20"activeColor="#0FC161" @change="switchChange('eatModel')"></up-switch></view>
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</view>
|
||||
|
||||
<view class="page-cell">
|
||||
<view class="label">桌位费<view v-if="vdata.isTableFee" class="tableFee" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'tableFee',value: vdata.shopInfo.tableFee})">{{vdata.shopInfo.tableFee}}</view></view>
|
||||
<view class="label">桌位费<view v-if="!vdata.isTableFee" class="tableFee" @tap="go.to('PAGES_SHOP_EDITVAL',{name:'tableFee',value: vdata.shopInfo.tableFee})">{{vdata.shopInfo.tableFee}}</view></view>
|
||||
<view class="right">
|
||||
<view>
|
||||
<up-checkbox-group><up-checkbox label="免桌位费" v-model:checked="vdata.isTableFee" activeColor="#0FC161" shape="circle" @change="isTableFeeChange"> </up-checkbox></up-checkbox-group>
|
||||
|
|
@ -117,11 +117,15 @@ import storageManage from '@/commons/utils/storageManage.js'
|
|||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import { $uploadFile } from '@/http/yskApi/file.js'
|
||||
import { forIn } from 'lodash';
|
||||
|
||||
const uploadImg = ref()
|
||||
const phone = ref(null)
|
||||
const vdata = reactive({
|
||||
shopInfo: {},
|
||||
shopInfo: {
|
||||
status: 2,
|
||||
isUseVip: 0,
|
||||
},
|
||||
extendList: [],
|
||||
registerTypeList: [
|
||||
{name: "先付费", value: "munchies"},
|
||||
|
|
@ -141,6 +145,7 @@ const vdata = reactive({
|
|||
})
|
||||
onMounted(() => {
|
||||
shopExtend();
|
||||
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
|
|
@ -159,6 +164,8 @@ let refreshData = (e) => {
|
|||
let params = {
|
||||
id : vdata.shopInfo.id,
|
||||
}
|
||||
params[e.name] = e.value
|
||||
vdata.type = e.name;
|
||||
vdata.inputValue = e.value;
|
||||
updateShopInfo(params,'input')
|
||||
}
|
||||
|
|
@ -212,18 +219,7 @@ let radioChange = (n) => {
|
|||
let updateShopInfo = (params,type) => {
|
||||
editShopInfo(params).then((res) => {
|
||||
if (type && type == "input") {
|
||||
console.log(vdata.type)
|
||||
switch ( vdata.type ){
|
||||
case "shopName":
|
||||
vdata.shopInfo.shopName = vdata.inputValue;
|
||||
break;
|
||||
case "phone":
|
||||
vdata.shopInfo.phone = vdata.inputValue;
|
||||
break;
|
||||
case "tableFee":
|
||||
vdata.shopInfo.tableFee = vdata.inputValue;
|
||||
break;
|
||||
}
|
||||
vdata.shopInfo[vdata.type] = vdata.inputValue;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -312,7 +308,7 @@ let switchChange = ( type ) => {
|
|||
id : vdata.shopInfo.id,
|
||||
}
|
||||
switch ( type ){
|
||||
case "isUseVip":
|
||||
case "address":
|
||||
params.lng = vdata.shopInfo.lng;
|
||||
params.lat = vdata.shopInfo.lat;
|
||||
params.address = vdata.shopInfo.address;
|
||||
|
|
@ -348,15 +344,26 @@ let switchChange = ( type ) => {
|
|||
*/
|
||||
let showMap = () => {
|
||||
// 本地 测试选择
|
||||
// return test();
|
||||
// 打开地图 && 获取省市县
|
||||
uni.chooseLocation().then((res) => {
|
||||
console.log(res);
|
||||
vdata.shopInfo.lng = res.longitude.toFixed(6); // IOS 小程序中: 经纬度12位。
|
||||
vdata.shopInfo.lat = res.latitude.toFixed(6);
|
||||
vdata.shopInfo.address = res.name;
|
||||
switchChange('address')
|
||||
});
|
||||
// 打开地图
|
||||
|
||||
uni.chooseLocation({
|
||||
// type: 'wgs84',
|
||||
success: function (res) {
|
||||
|
||||
vdata.shopInfo.lng = res.longitude.toFixed(6); // IOS 小程序中: 经纬度12位。
|
||||
vdata.shopInfo.lat = res.latitude.toFixed(6);
|
||||
vdata.shopInfo.address = res.name;
|
||||
switchChange('address')
|
||||
},
|
||||
fail: function(err) {
|
||||
uni.showToast({
|
||||
title:err,
|
||||
icon:'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -379,6 +386,8 @@ let showMap = () => {
|
|||
color: #333333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
.tableFee {
|
||||
width: 186rpx;
|
||||
height: 54rpx;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
</view>
|
||||
<view class="bom">
|
||||
<view @click="saveImage">下载收款码</view>
|
||||
<view>下载收款码样式</view>
|
||||
<!-- <view>下载收款码样式</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<view class="search bg-fff u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="输入桌号" @confirm="search"
|
||||
:focus="true" v-model="searchValue">
|
||||
v-model="searchValue">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
<!-- <view class="u-flex">
|
||||
|
|
@ -45,6 +45,9 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="tables.list.length<=0">
|
||||
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
||||
|
|
@ -142,10 +145,13 @@
|
|||
content
|
||||
} = await $table.get(query)
|
||||
tables.hasAjax = true
|
||||
content = content.filter(v => v.status != 'closed')
|
||||
content = content.filter(v =>{
|
||||
// return v.status == 'idle'||(v.status=='using')
|
||||
return v.status == 'idle'
|
||||
})
|
||||
console.log(content );
|
||||
tables.list = content
|
||||
tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
|
||||
console.log(tables.selIndex );
|
||||
tables.originList = content
|
||||
}
|
||||
async function getArea() {
|
||||
|
|
@ -166,6 +172,10 @@
|
|||
}
|
||||
|
||||
watch(() => area.sel, (newval) => {
|
||||
if(!newval){
|
||||
tables.list = tables.originList
|
||||
return
|
||||
}
|
||||
tables.list = tables.originList.filter(v => v.areaId == newval.id)
|
||||
})
|
||||
let option = {}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<view class="page-gray u-font-28">
|
||||
<view class="search bg-fff u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search" :focus="true"
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search"
|
||||
v-model="query.name">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
|
|
@ -16,7 +16,8 @@
|
|||
<my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio>
|
||||
</view>
|
||||
<view class="u-m-t-32 bg-fff box bg-fff">
|
||||
<view class="u-flex item u-row-between" v-for="(item,index) in list" :key="index" @tap="chooseUser(index,item)">
|
||||
<view class="u-flex item u-row-between" v-for="(item,index) in list" :key="index"
|
||||
@tap="chooseUser(index,item)">
|
||||
<view class="u-flex">
|
||||
<view class="headimg u-flex u-row-center u-col-center">
|
||||
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
|
||||
|
|
@ -37,70 +38,84 @@
|
|||
</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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as Api from '@/http/yskApi/shop-user.js'
|
||||
import {onLoad} from '@dcloudio/uni-app'
|
||||
import * as Api from '@/http/yskApi/shop-user.js'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
let nouser = ref(false)
|
||||
|
||||
function emitChooser(data){
|
||||
uni.$emit('choose-user',data)
|
||||
setTimeout(()=>{
|
||||
|
||||
function emitChooser(data) {
|
||||
uni.$emit('choose-user', data)
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
},100)
|
||||
}, 100)
|
||||
}
|
||||
|
||||
function chooseUser(index,item){
|
||||
if(index===undefined||item===undefined){
|
||||
nouser.value=true
|
||||
return emitChooser({id:''})
|
||||
}
|
||||
else{
|
||||
list[index].checked=true
|
||||
|
||||
function chooseUser(index, item) {
|
||||
if (index === undefined || item === undefined) {
|
||||
nouser.value = true
|
||||
return emitChooser({
|
||||
id: '',
|
||||
headImg: '',
|
||||
telephone: '',
|
||||
amount: '0.00',
|
||||
totalScore: '0.00'
|
||||
})
|
||||
} else {
|
||||
list[index].checked = true
|
||||
emitChooser(item)
|
||||
}
|
||||
}
|
||||
|
||||
const query=reactive({
|
||||
page:0,
|
||||
name:'',
|
||||
size:300
|
||||
|
||||
const query = reactive({
|
||||
page: 0,
|
||||
name: '',
|
||||
size: 300
|
||||
})
|
||||
const list=reactive([])
|
||||
async function getUser(){
|
||||
const {content}=await Api.queryAllShopUser(query)
|
||||
for(let i in content){
|
||||
list.push({...content[i],checked:false})
|
||||
const list = reactive([])
|
||||
async function getUser() {
|
||||
const {
|
||||
content
|
||||
} = await Api.queryAllShopUser(query)
|
||||
for (let i in content) {
|
||||
list.push({
|
||||
...content[i],
|
||||
checked: false
|
||||
})
|
||||
}
|
||||
console.log(list);
|
||||
}
|
||||
function search(){
|
||||
query.page=0
|
||||
list.length=0
|
||||
|
||||
function search() {
|
||||
query.page = 0
|
||||
list.length = 0
|
||||
getUser()
|
||||
}
|
||||
onLoad(()=>{
|
||||
onLoad(() => {
|
||||
getUser()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.scale7{
|
||||
.scale7 {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
.search {
|
||||
padding-right: 28rpx;
|
||||
|
||||
|
|
@ -113,32 +128,37 @@
|
|||
|
||||
.list {
|
||||
padding: 32rpx 24rpx;
|
||||
|
||||
|
||||
.no-choose {
|
||||
padding: 36rpx 30rpx 36rpx 24rpx;
|
||||
}
|
||||
.box{
|
||||
|
||||
.box {
|
||||
padding: 32rpx 30rpx 78rpx 24rpx;
|
||||
.item{
|
||||
|
||||
.item {
|
||||
padding: 24rpx 0;
|
||||
.headimg{
|
||||
|
||||
.headimg {
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
font-size: 0;
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
background-color: #eee;
|
||||
overflow: hidden;
|
||||
.img{
|
||||
|
||||
.img {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item:not(:first-child){
|
||||
|
||||
.item:not(:first-child) {
|
||||
border-top: 1px solid #E5E5E5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
|
|
@ -48,6 +48,7 @@
|
|||
function changeCauses(item) {
|
||||
let prve=form.remark?',':''
|
||||
form.remark +=prve+item.name
|
||||
console.log(form.remark);
|
||||
}
|
||||
|
||||
const causes = reactive([{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
<template>
|
||||
<view class="page-gray color-333 u-font-28">
|
||||
<template v-if="true">
|
||||
<view class="block">
|
||||
<view>桌位号</view>
|
||||
<view class="font-bold u-font-40 u-m-t-20">
|
||||
{{table.name||''}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="block">
|
||||
<view class="u-p-b-24 u-m-b-24 border-bottom">
|
||||
<view>选择用户</view>
|
||||
<view class="u-m-t-24 u-flex u-row-between " @tap="chooseUser">
|
||||
<view v-if="!user">选择用户</view>
|
||||
<view class="u-flex" v-else>
|
||||
<view v-if="!user||!user.id">选择用户</view>
|
||||
<view class="u-flex" v-if="user&&user.id">
|
||||
<up-avatar :src="user.headImg" shape="square" :size="30"></up-avatar>
|
||||
<!-- <view class="headeimg">
|
||||
<image class="img" :src="user.headImg" mode=""></image>
|
||||
|
|
@ -22,7 +28,20 @@
|
|||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-p-b-24 u-m-b-24 border-bottom">
|
||||
<view class=" ">
|
||||
<view>就餐类型</view>
|
||||
<view class="u-m-t-24 u-flex ">
|
||||
<view class="u-flex color-666">
|
||||
<up-radio-group :disabled="option.type=='add'" v-model="eatTypes.active" placement="row">
|
||||
<up-radio :customStyle="{marginRight: '30px'}" v-for="(item, index) in eatTypes.list"
|
||||
:key="index" :label="item.name" :name="item.value">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="u-p-b-24 u-m-b-24 border-bottom">
|
||||
<view>就餐类型</view>
|
||||
<view class="u-m-t-24 u-flex ">
|
||||
<view class="u-flex color-666">
|
||||
|
|
@ -44,7 +63,7 @@
|
|||
</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
|
||||
|
|
@ -84,7 +103,7 @@
|
|||
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex"
|
||||
:range="userNumbers.list">
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
<view class="color-333">{{userNumbers.defaultCateIndex||''}}</view>
|
||||
<view class="color-333">{{userNumbers.defaultCateIndex*1+1+'人'}}</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
|
|
@ -97,7 +116,7 @@
|
|||
<view class="u-p-b-24 ">
|
||||
<view class="font-bold">订单备注</view>
|
||||
<view class="u-m-t-32 u-flex ">
|
||||
<uni-easyinput type="textarea" v-model="note" placeholder="请输入备注"></uni-easyinput>
|
||||
<uni-easyinput type="textarea" v-model="note" placeholder="请输入备注"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -181,7 +200,7 @@
|
|||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 border-bottom">
|
||||
<view>
|
||||
<text v-if="eatTypes.active=='takeout'">包装费</text>
|
||||
|
|
@ -221,7 +240,7 @@
|
|||
|
||||
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
|
||||
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
|
||||
<my-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></my-remark>
|
||||
<one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
|
||||
</view>
|
||||
|
||||
|
|
@ -240,10 +259,9 @@
|
|||
computed,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myButton from '@/components/my-components/my-button'
|
||||
import modelDiscount from './components/discount'
|
||||
import giveFood from './components/give-food'
|
||||
import myRemark from './components/remark'
|
||||
import oneRemark from './components/remark'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
|
|
@ -273,10 +291,12 @@
|
|||
}
|
||||
|
||||
function showModel(key, index) {
|
||||
modelData.data =goods.list[index]
|
||||
modelData.selIndex =index
|
||||
modelData.data = goods.list[index]
|
||||
modelData.selIndex = index
|
||||
const model = models.get(key)
|
||||
model && model.open({remark:modelData.data.note})
|
||||
model && model.open({
|
||||
remark: modelData.data.note||''
|
||||
})
|
||||
}
|
||||
|
||||
function formatPrice(n) {
|
||||
|
|
@ -288,9 +308,10 @@
|
|||
//用餐人数
|
||||
const userNumbers = reactive({
|
||||
list: new Array(100).fill(1).map((v, index) => {
|
||||
return index === 0 ? '无' : index + '人'
|
||||
// return index === 0 ? '无' : index + '人'
|
||||
return (index+1)+ '人'
|
||||
}),
|
||||
defaultCateIndex: 1,
|
||||
defaultCateIndex: 0,
|
||||
})
|
||||
watch(() => userNumbers.defaultCateIndex, (newval) => {
|
||||
console.log(newval);
|
||||
|
|
@ -305,15 +326,16 @@
|
|||
const res = await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: table.value.tableId,
|
||||
num: userNumbers.defaultCateIndex,
|
||||
num: userNumbers.defaultCateIndex+1,
|
||||
})
|
||||
Object.assign($seatFee, res)
|
||||
userNumbers.defaultCateIndex = res.totalNumber
|
||||
userNumbers.defaultCateIndex = res.totalNumber-1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function userNumberChange(e) {
|
||||
console.log(e);
|
||||
userNumbers.defaultCateIndex = e.detail.value
|
||||
}
|
||||
|
||||
|
|
@ -398,11 +420,11 @@
|
|||
//监听桌台改变
|
||||
watch(() => table.value, (newval, oldval) => {
|
||||
if (newval && oldval) {
|
||||
Api.$choseTable({
|
||||
orderId: 4462,
|
||||
oldTableId: oldval.tableId,
|
||||
newTableId: newval.tableId,
|
||||
})
|
||||
// Api.$choseTable({
|
||||
// orderId: 4462,
|
||||
// oldTableId: oldval.tableId,
|
||||
// newTableId: newval.tableId,
|
||||
// })
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -464,7 +486,7 @@
|
|||
}
|
||||
goods.list = getNowCart(records)
|
||||
if (seatFee && seatFee.totalNumber) {
|
||||
userNumbers.defaultCateIndex = seatFee.totalNumber || 1
|
||||
userNumbers.defaultCateIndex = seatFee.totalNumber-1 || 0
|
||||
Object.assign($seatFee, seatFee)
|
||||
}
|
||||
|
||||
|
|
@ -496,7 +518,7 @@
|
|||
await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: table.value.tableId,
|
||||
num: userNumbers.defaultCateIndex,
|
||||
num: userNumbers.defaultCateIndex+1,
|
||||
})
|
||||
}
|
||||
// updateChoseCount()
|
||||
|
|
@ -506,13 +528,22 @@
|
|||
if ($shop.value.registerType == 'munchies') {
|
||||
//先付
|
||||
return go.to('PAGES_ORDER_PAY', {
|
||||
orderId: res.id
|
||||
})
|
||||
orderId: res.id,
|
||||
isNowPay:true
|
||||
},'redirect'
|
||||
)
|
||||
} else {
|
||||
//后付
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
if (option.isCreateOrderToDetail) {
|
||||
go.to('PAGES_ORDER_DETAIL', {
|
||||
id: res.id
|
||||
},'redirect')
|
||||
} else {
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
}
|
||||
|
||||
// return go.to('PAGES_ORDER_DETAIL', {
|
||||
// id: res.id
|
||||
// })
|
||||
|
|
@ -531,7 +562,7 @@
|
|||
|
||||
//单品备注确认
|
||||
async function goodsOneRemarkConfirm(e) {
|
||||
const cart=goods.list[modelData.selIndex]
|
||||
const cart = goods.list[modelData.selIndex]
|
||||
await Api.$updateCart({
|
||||
cartId: cart.id,
|
||||
productId: cart.productId,
|
||||
|
|
@ -540,11 +571,16 @@
|
|||
note: e.remark,
|
||||
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) => {
|
||||
|
|
@ -558,8 +594,7 @@
|
|||
}
|
||||
}
|
||||
init()
|
||||
getCart()
|
||||
getTbShopInfo()
|
||||
|
||||
// updateChoseCount()
|
||||
})
|
||||
|
||||
|
|
@ -578,6 +613,9 @@
|
|||
uni.setStorageSync("useType", useType);
|
||||
}
|
||||
const tableId = useType == 'takeout' ? undefined : table.value.tableId;
|
||||
if(!goods.list.length){
|
||||
return
|
||||
}
|
||||
const res = await Api.$changeUseType({
|
||||
useType,
|
||||
tableId,
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@
|
|||
return []
|
||||
}
|
||||
},
|
||||
isCreateOrderToDetail:{
|
||||
type:Boolean,default:false
|
||||
},
|
||||
user:{
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
|
@ -123,7 +126,7 @@
|
|||
const {tableId,name,maxCapacity,status,type}=props.table
|
||||
go.to('PAGES_CONFIRM_ORDER',{
|
||||
masterId:props.masterId,type,
|
||||
tableId,name,maxCapacity,status
|
||||
tableId,name,maxCapacity,status,isCreateOrderToDetail:props.isCreateOrderToDetail
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<view class="u-relative u-flex item">
|
||||
<image lazy-load class="img" :src="data.coverImg" mode=""></image>
|
||||
<image lazy-load class="img" :src="data.coverImg" mode="" :style="computedImgStyle()"></image>
|
||||
<view class="info u-flex u-row-between u-col-top u-flex-col" @tap="emitEvent('add')">
|
||||
<view>
|
||||
<view>{{data.name}}</view>
|
||||
|
|
@ -50,6 +50,13 @@
|
|||
watch
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
img:{
|
||||
type:Object,
|
||||
default:{
|
||||
width:'250rpx',
|
||||
height:'272rpx'
|
||||
}
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
},
|
||||
|
|
@ -67,6 +74,14 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
function computedImgStyle(){
|
||||
return {
|
||||
width:props.img.width,
|
||||
height:props.img.height
|
||||
}
|
||||
}
|
||||
|
||||
//判断是否是菜品
|
||||
function isGoods(){
|
||||
return props.data.hasOwnProperty('id')
|
||||
|
|
@ -118,8 +133,8 @@
|
|||
}
|
||||
|
||||
.item {
|
||||
width: 250rpx;
|
||||
height: 272rpx;
|
||||
// width: 250rpx;
|
||||
// height: 272rpx;
|
||||
background: #F9B798;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
overflow: hidden;
|
||||
|
|
|
|||
|
|
@ -35,19 +35,18 @@
|
|||
<view class="search u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
|
||||
@clear="clearSearch"
|
||||
v-model="searchValue">
|
||||
@clear="clearSearch" v-model="searchValue">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="u-flex" @click="scanCode">
|
||||
<image src="/pagesCreateOrder/static/images/icon-saoma.svg" class="icon-saoma" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="!isSearch">
|
||||
<view class="u-menu-wrap">
|
||||
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="data.scrollTop"
|
||||
:scroll-into-view="data.itemId">
|
||||
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view"
|
||||
:scroll-top="data.scrollTop" :scroll-into-view="data.itemId">
|
||||
<view v-for="(item,index) in data.tabbar" :key="index" class="u-tab-item"
|
||||
:class="[data.current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
|
||||
<text class="u-line-1">{{item.name}}</text>
|
||||
|
|
@ -58,7 +57,7 @@
|
|||
<view class="page-view u-p-l-24">
|
||||
<view class="list-tight-top">
|
||||
<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>
|
||||
<view class="u-m-t-24 color-main">临时菜</view>
|
||||
</view>
|
||||
|
|
@ -67,7 +66,8 @@
|
|||
<view style="height: 24px;"></view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="class-item" :id="'item' + index" v-for="(item , index) in data.tabbar" :key="index">
|
||||
<view class="class-item" :id="'item' + index" v-for="(item , index) in data.tabbar"
|
||||
:key="index">
|
||||
<view class="item-title">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
<goods-item @chooseGuige="chooseGuige($event,index)"
|
||||
@add="goodsUpdate($event,index,true)" @reduce="goodsUpdate($event,index,false)"
|
||||
:index="goodsIndex" :data="goodsItem"></goods-item>
|
||||
|
||||
|
||||
</view>
|
||||
<!-- <template v-if="item.name==='附加费'">
|
||||
<view class="addCai" @tap="surchargeShow">
|
||||
|
|
@ -92,13 +92,27 @@
|
|||
</template>
|
||||
<template v-else>
|
||||
<view class="u-menu-wrap">
|
||||
11
|
||||
<scroll-view class=" u-flex-1" scroll-y scroll-with-animation>
|
||||
<view class="u-p-l-30 u-p-r-30">
|
||||
<view class="u-font-28 color-666 ">搜索</view>
|
||||
<view class="u-flex u-m-t-20 u-flex-wrap u-row-between">
|
||||
<view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex">
|
||||
<goods-item :img="{width:'330rpx',height:'330rpx'}" @chooseGuige="chooseGuige($event,goodsItem.index)"
|
||||
@add="goodsUpdate($event,goodsItem.index,true)" @reduce="goodsUpdate($event,index,false)"
|
||||
:index="goodsItem.goodsIndex" :data="goodsItem"></goods-item>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<view class="bottom w-full">
|
||||
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
|
||||
:data="cars" @clear="onClearCart"></my-car>
|
||||
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser"
|
||||
:masterId="data.masterId" :table="data.table" :data="cars" @clear="onClearCart"></my-car>
|
||||
</view>
|
||||
|
||||
<!-- 选择规格 -->
|
||||
|
|
@ -113,7 +127,9 @@
|
|||
<script setup>
|
||||
import _ from 'lodash';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {$table} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
$table
|
||||
} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
$tbShopCategory
|
||||
} from '@/http/yskApi/goods.js'
|
||||
|
|
@ -134,7 +150,8 @@
|
|||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
nextTick,getCurrentInstance ,
|
||||
nextTick,
|
||||
getCurrentInstance,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myCar from './components/car'
|
||||
|
|
@ -151,15 +168,15 @@
|
|||
} from '@/http/yskApi/user.js'
|
||||
const instance = getCurrentInstance();
|
||||
//临时菜
|
||||
const lingshi=reactive({
|
||||
show:false
|
||||
const lingshi = reactive({
|
||||
show: false
|
||||
})
|
||||
//附加费
|
||||
const extraFee=reactive({
|
||||
show:false
|
||||
const extraFee = reactive({
|
||||
show: false
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
const cars = reactive([])
|
||||
const data = reactive({
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
|
|
@ -185,21 +202,33 @@
|
|||
},
|
||||
|
||||
})
|
||||
|
||||
|
||||
// 获取账号信息
|
||||
let $shop=ref({})
|
||||
let $shop = ref({})
|
||||
async function getTbShopInfo() {
|
||||
const res = await tbShopInfo()
|
||||
$shop.value = res
|
||||
const useType=data.table.status=='using'?data.table.useType:$returnUseType(res)
|
||||
uni.setStorageSync('useType',useType)
|
||||
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(res)
|
||||
uni.setStorageSync('useType', useType)
|
||||
console.log(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) {
|
||||
const goodsCategoryMap = goods.reduce((prve, cur) => {
|
||||
|
|
@ -287,7 +316,7 @@
|
|||
}
|
||||
//加入购物车
|
||||
function addCart(par) {
|
||||
if(!data.table.tableId){
|
||||
if (!data.table.tableId) {
|
||||
return infoBox.showToast('请先选择桌台!')
|
||||
}
|
||||
const submitPar = {
|
||||
|
|
@ -353,18 +382,21 @@
|
|||
|
||||
|
||||
//获取桌台信息
|
||||
async function getTableInfo(){
|
||||
const res=await $table.get({qrcode:data.table.tableId})
|
||||
async function getTableInfo() {
|
||||
const res = await $table.get({
|
||||
qrcode: data.table.tableId
|
||||
})
|
||||
console.log(res);
|
||||
if(res&&res.content[0]){
|
||||
if (res && res.content[0]) {
|
||||
// data.table=res.content[0]
|
||||
}
|
||||
}
|
||||
let $originGoods = []
|
||||
async function init() {
|
||||
const shopInfo = await tbShopInfo()
|
||||
$shop.value = shopInfo
|
||||
const useType=data.table.status=='using'?data.table.useType:$returnUseType(shopInfo)
|
||||
uni.setStorageSync('useType',useType)
|
||||
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(shopInfo)
|
||||
uni.setStorageSync('useType', useType)
|
||||
console.log(shopInfo);
|
||||
getTableInfo()
|
||||
const categoryRes = await getCategory()
|
||||
|
|
@ -384,10 +416,11 @@
|
|||
}
|
||||
return isShow;
|
||||
});
|
||||
if(!data.table.tableId){
|
||||
$originGoods=goods
|
||||
if (!data.table.tableId) {
|
||||
//无桌台
|
||||
setTabBar(category, goods, [])
|
||||
return
|
||||
return
|
||||
}
|
||||
const {
|
||||
masterId
|
||||
|
|
@ -423,16 +456,43 @@
|
|||
|
||||
|
||||
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() {
|
||||
// isSearch.value=true
|
||||
console.log(searchValue.value);
|
||||
console.log(data.tabbar );
|
||||
isSearch.value = true
|
||||
searchResult.value = returnSearchGoods()
|
||||
console.log(searchResult.value);
|
||||
}
|
||||
function clearSearch(){
|
||||
// isSearch.value=false
|
||||
|
||||
function clearSearch() {
|
||||
isSearch.value = false
|
||||
}
|
||||
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
}
|
||||
|
|
@ -608,8 +668,10 @@
|
|||
}
|
||||
|
||||
function chooseGuige(foodsindex, index) {
|
||||
if(!canAddGoods()){
|
||||
return infoBox.showToast('清先选择桌台')
|
||||
if (!canAddGoods()) {
|
||||
return infoBox.showToast('清先选择桌台',0.5).then(res=>{
|
||||
chooseTable()
|
||||
})
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
guigeModelData.title = $goods.name
|
||||
|
|
@ -650,6 +712,7 @@
|
|||
productId,
|
||||
skuId
|
||||
})
|
||||
infoBox.showToast('添加成功')
|
||||
cars.push({
|
||||
...cartGoods,
|
||||
specSnap: sku.specSnap
|
||||
|
|
@ -706,13 +769,15 @@
|
|||
carGoods
|
||||
} : false
|
||||
}
|
||||
|
||||
function canAddGoods(){
|
||||
|
||||
function canAddGoods() {
|
||||
return data.table.tableId
|
||||
}
|
||||
async function goodsUpdate(foodsindex, index, isAdd) {
|
||||
if(!canAddGoods()){
|
||||
return infoBox.showToast('清先选择桌台')
|
||||
if (!canAddGoods()) {
|
||||
return infoBox.showToast('请先选择桌台',0.5).then(res=>{
|
||||
chooseTable()
|
||||
})
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
if ($goods.isDan) {
|
||||
|
|
@ -754,6 +819,7 @@
|
|||
productId,
|
||||
skuId
|
||||
})
|
||||
infoBox.showToast('添加成功')
|
||||
$goods.chooseNumber = num
|
||||
cars.push(cartGoods)
|
||||
}
|
||||
|
|
@ -763,10 +829,10 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
onReady(() => {
|
||||
getElRect('list-tight-top').then(res=>{
|
||||
data.topZhanwei=res.height
|
||||
getElRect('list-tight-top').then(res => {
|
||||
data.topZhanwei = res.height
|
||||
})
|
||||
getMenuItemTop()
|
||||
})
|
||||
|
|
@ -801,7 +867,7 @@
|
|||
return;
|
||||
}
|
||||
console.log(res);
|
||||
if(dataVal){
|
||||
if (dataVal) {
|
||||
data[dataVal] = res.height;
|
||||
}
|
||||
resolve(res);
|
||||
|
|
@ -908,20 +974,37 @@
|
|||
setUser()
|
||||
})
|
||||
}
|
||||
watch(()=>data.table.tableId,(newval)=>{
|
||||
watch(() => data.table.tableId, (newval) => {
|
||||
console.log(newval);
|
||||
init()
|
||||
})
|
||||
onBeforeUnmount(() => {})
|
||||
|
||||
function watchUpdate() {
|
||||
uni.$off('update:createOrderIndex')
|
||||
uni.$on('update:createOrderIndex', () => {
|
||||
// data.table = {
|
||||
// tableId: ""
|
||||
// }
|
||||
cars.length = 0
|
||||
console.log('update:createOrderIndex');
|
||||
init()
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
// watchChooseuser()
|
||||
watchChooseTable()
|
||||
watchUpdate()
|
||||
})
|
||||
let isCreateOrderToDetail = ref(false)
|
||||
onLoad((opt) => {
|
||||
console.log(opt)
|
||||
Object.assign(data.table, opt)
|
||||
if(opt.useType){
|
||||
uni.setStorageSync('useType',opt.useType)
|
||||
if (opt.useType) {
|
||||
uni.setStorageSync('useType', opt.useType)
|
||||
}
|
||||
if (JSON.stringify(opt) == '{}') {
|
||||
isCreateOrderToDetail.value = true
|
||||
}
|
||||
// if (!opt.tableId) {
|
||||
// infoBox.showErrorToast('暂不支持不选择桌台下载,请从桌台点餐')
|
||||
|
|
|
|||
|
|
@ -80,12 +80,15 @@
|
|||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad
|
||||
onLoad,
|
||||
onBackPress
|
||||
} from '@dcloudio/uni-app'
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import editDiscount from '/pagesCreateOrder/components/edit-discount.vue'
|
||||
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
|
||||
import {
|
||||
queryAllShopUser
|
||||
} from '@/http/yskApi/shop-user.js'
|
||||
const pays = reactive({
|
||||
list: ['扫码收款', '二维码收款'],
|
||||
selIndex: 0,
|
||||
|
|
@ -94,7 +97,11 @@
|
|||
selIndex: 0
|
||||
}
|
||||
})
|
||||
|
||||
let option = opt
|
||||
onBackPress(()=>{
|
||||
console.log('-------------------');
|
||||
console.log('onBackPress');
|
||||
})
|
||||
const models = new Map();
|
||||
|
||||
function setModel(el) {
|
||||
|
|
@ -107,8 +114,8 @@
|
|||
const model = models.get(key)
|
||||
model && model.open()
|
||||
}
|
||||
|
||||
let user=ref({})
|
||||
|
||||
let user = ref({})
|
||||
async function getPayType() {
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList
|
||||
|
|
@ -122,8 +129,10 @@
|
|||
infoBox.showToast('支付成功')
|
||||
setTimeout(() => {
|
||||
// uni.$emit('orderDetail:update')
|
||||
uni.$emit('update:createOrderIndex')
|
||||
console.log('update:createOrderIndex');
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
delta: 1
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
|
|
@ -182,11 +191,14 @@
|
|||
}
|
||||
})
|
||||
onLoad((opt) => {
|
||||
option = opt
|
||||
console.log(opt);
|
||||
Object.assign(order, opt)
|
||||
if(order.userId){
|
||||
queryAllShopUser({id:opt.userId}).then(res=>{
|
||||
user.value=res.content[0]||opt
|
||||
if (order.userId) {
|
||||
queryAllShopUser({
|
||||
id: opt.userId
|
||||
}).then(res => {
|
||||
user.value = res.content[0] || opt
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,18 +2,30 @@
|
|||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="font-bold">附加费</view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='closed'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||
</template>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>{{data.name||'餐位费'}}</view>
|
||||
<view>x{{data.number}}</view>
|
||||
<view>¥{{data.number}}</view>
|
||||
</view>
|
||||
<template v-if="data.status!='return'">
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>{{data.name||'餐位费'}}</view>
|
||||
<view>x{{data.number}}</view>
|
||||
<view>¥{{data.totalAmount}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="u-flex u-row-between u-m-t-20 color-999">
|
||||
<view class="u-flex">
|
||||
<view class="line-th ">{{data.name||'餐位费'}}</view>
|
||||
<view class="tag yitui u-m-l-10">已退</view>
|
||||
</view>
|
||||
<view class="line-th">x{{data.number}}</view>
|
||||
<view class="line-th">¥{{data.totalAmount}}</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -49,4 +61,13 @@
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tag {
|
||||
padding: 0 6rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
&.yitui {
|
||||
background-color: rgb(188, 188, 188);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
|
||||
<view class="u-font-32 font-bold">
|
||||
<view class="u-font-32 color-999">
|
||||
<text>共</text>
|
||||
<text class="color-main font-bold"> {{goodsNumber}}</text>
|
||||
<text class="color-333 "> {{goodsNumber}}</text>
|
||||
<text>份菜品</text>
|
||||
</view>
|
||||
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
|
||||
|
|
@ -16,23 +16,24 @@
|
|||
</view>
|
||||
<view class="u-p-l-30 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
|
||||
|
||||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="item.status=='return'">
|
||||
已退
|
||||
</view>
|
||||
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
|
||||
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view>
|
||||
</view>
|
||||
<view class="u-text-right">
|
||||
<template v-if="item.status=='return'">
|
||||
<view >¥0.00</view>
|
||||
<view class="line-th color-666 u-font-24">¥{{item.salePrice||item.price}}</view>
|
||||
<view>¥0.00</view>
|
||||
<view class="line-th color-666 u-font-24">¥{{item.salePrice||item.price}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view >¥{{item.salePrice||item.price}}</view>
|
||||
<view>¥{{item.salePrice||item.price}}</view>
|
||||
</template>
|
||||
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
|
||||
</view>
|
||||
|
|
@ -42,44 +43,70 @@
|
|||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
|
||||
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
||||
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</my-button>
|
||||
<my-button :width="168" :height="60" plain shape="circle"
|
||||
@tap="tuicai(item,index)">退菜</my-button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='closed'">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
|
||||
<my-button :width="168" :height="60" plain shape="circle" @tap="tuikuan(item,index)">退款</my-button>
|
||||
<my-button :width="168" :height="60" plain shape="circle"
|
||||
@tap="tuikuan(item,index)">退款</my-button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-gray u-p-20 u-m-t-20">
|
||||
<view class="bg-gray u-p-20 u-m-t-20" v-if="orderInfo.remark">
|
||||
<view>备注</view>
|
||||
<view class="u-m-t-10">{{orderInfo.remark}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-40">
|
||||
<view class="u-flex u-row-between border-bottom u-p-b-20">
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-flex u-row-between border-top u-p-t-32">
|
||||
<view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view class="tag no-pay">
|
||||
未支付
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template v-if="orderInfo.status=='refund'">
|
||||
<view class="tag refund">
|
||||
退款成功
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
||||
<view>
|
||||
<text>小计¥</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<template v-if="orderInfo.status=='refund'">
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<view>退款金额</view>
|
||||
<view class="color-999">
|
||||
<text class="">{{orderInfo.originAmount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<view>退款原因</view>
|
||||
<view class="color-999">
|
||||
<text class="">{{orderInfo.refundRemark||''}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32 u-p-b-24 border-bottom">
|
||||
<view></view>
|
||||
<view class="">
|
||||
<text class="">退款成功</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view></view>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{seatFee*1+allPrice*1}}</text>
|
||||
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-30">
|
||||
|
|
@ -94,18 +121,28 @@
|
|||
computed
|
||||
} from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
const emits=defineEmits(['tuicai','tuikuan','printOrder'])
|
||||
function tuicai(item,index){
|
||||
emits('tuicai',item,index)
|
||||
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
||||
|
||||
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')
|
||||
}
|
||||
const props = defineProps({
|
||||
orderInfo:{
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
|
|
@ -113,55 +150,79 @@
|
|||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
seatFee:{
|
||||
type:[String,Number],
|
||||
default:0
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
return props.data.reduce((prve, cur) => {
|
||||
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{
|
||||
return a+(b.salePrice||b.price) * (b.number||b.num)
|
||||
},0)
|
||||
return prve + curTotal
|
||||
}, 0).toFixed(2)
|
||||
|
||||
const seatFeePrice = computed(() => {
|
||||
if (!props.seatFee.totalAmount) {
|
||||
return 0
|
||||
}
|
||||
const n = props.seatFee.totalAmount * (props.seatFee.status == 'return' ? 0 : 1)
|
||||
return n.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
const allPrice = computed(() => {
|
||||
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(() => {
|
||||
let result = 0
|
||||
result = props.data.reduce((a, b) => {
|
||||
const bTotal = b.info.reduce((prve, cur) => {
|
||||
return prve + (cur.number||cur.num) * 1;
|
||||
return prve + (cur.number || cur.num) * 1;
|
||||
}, 0);
|
||||
return a + bTotal
|
||||
}, 0)
|
||||
return result
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
width: 152rpx;
|
||||
height: 152rpx;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-color: #F6F6F6;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-color: rgb(240, 240, 240);
|
||||
// border-color: rgb(240, 240, 240);
|
||||
border-color: #F6F6F6;
|
||||
}
|
||||
.line-th{
|
||||
|
||||
.line-th {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.tag {
|
||||
padding: 2rpx 8rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.tag {
|
||||
padding: 4rpx 8rpx 2rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
&.no-pay {
|
||||
background-color: rgb(170, 170, 170);
|
||||
color: #fff;
|
||||
}
|
||||
&.refund{
|
||||
background-color: #FCE7E7;
|
||||
padding: 8rpx 20rpx 6rpx 22rpx;
|
||||
color: #EB4F4F;
|
||||
}
|
||||
}
|
||||
.tui{
|
||||
|
||||
.tui {
|
||||
background-color: rgb(239, 239, 239);
|
||||
border-radius: 4rpx;
|
||||
margin-right: 6rpx;
|
||||
|
|
@ -169,5 +230,4 @@
|
|||
padding: 0 4rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -20,10 +20,10 @@
|
|||
<view>支付方式</view>
|
||||
<view>{{data.payType||''}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<!-- <view class="u-flex u-row-between u-m-t-20">
|
||||
<view>预约时间</view>
|
||||
<view></view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>下单时间</view>
|
||||
<view><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
|
||||
|
|
@ -32,10 +32,10 @@
|
|||
<view>订单编号</view>
|
||||
<view>{{data.orderNo}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<!-- <view class="u-flex u-row-between u-m-t-20">
|
||||
<view>商家备注</view>
|
||||
<my-button plain shape="circle" :width="160" :height="60">编辑</my-button>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,30 @@
|
|||
<template>
|
||||
<view class="u-font-28 default-box-padding u-relative bg-fff border-r-12 u-overflow-hide">
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view class="change u-absolute my-bg-main color-fff left-top" @click="chooseUser">切换</view>
|
||||
<view class="change u-absolute color-fff left-top" @click="chooseUser">切换</view>
|
||||
</template>
|
||||
<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">{{user.telephone||'未绑定手机号'}}</view>
|
||||
<template v-if="user.id">
|
||||
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
|
||||
<view class="u-flex">
|
||||
<up-avatar :size="30" :src="user.headImg"></up-avatar>
|
||||
<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>
|
||||
<my-button @click="toOrder" :height="60" plain shape="circle">他的订单</my-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
|
||||
<view class="u-flex">
|
||||
<up-avatar :size="30" :src="user.headImg"></up-avatar>
|
||||
<view class="color-666 u-m-l-30">{{'服务员下单'}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<my-button @click="toOrder" :height="60" plain shape="circle">他的订单</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex u-m-t-20 u-row-between">
|
||||
<view class="">
|
||||
<view class="font-bold">{{user.amount}}</view>
|
||||
|
|
@ -66,8 +79,9 @@
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.change {
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 0 0 16rpx 0;
|
||||
padding: 2rpx 22rpx 4rpx 14rpx;
|
||||
border-radius: 18rpx 0rpx 18rpx 0rpx;
|
||||
background: linear-gradient( 139deg, #74B0FF 0%, #318AFE 100%);
|
||||
z-index: 2;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -2,17 +2,17 @@
|
|||
<view class="min-page bg-gray u-font-28 u-p-30">
|
||||
<user-vue :orderInfo="orderDetail.info" :user="user"></user-vue>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<text class="color-666">桌位号:</text>
|
||||
<text class="font-bold">{{orderDetail.info.tableName}}</text>
|
||||
<text class="">桌位号:</text>
|
||||
<text class="">{{orderDetail.info.tableName}}</text>
|
||||
</view>
|
||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
|
||||
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount" @tuicai="onTuiCai"></goods-list>
|
||||
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
|
||||
<template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
|
||||
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
|
||||
:data="orderDetail.seatFee"></extra-vue>
|
||||
</template>
|
||||
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
|
||||
<step-vue></step-vue>
|
||||
<!-- <step-vue></step-vue> -->
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="u-fixed bottom bg-fff ">
|
||||
<view class="u-flex u-abso">
|
||||
|
|
@ -88,24 +88,23 @@
|
|||
id,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
productSkuName,
|
||||
name,
|
||||
cartId,
|
||||
num,
|
||||
priceAmount,
|
||||
price
|
||||
number,
|
||||
totalAmount,
|
||||
salePrice
|
||||
} = seatFee
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
id,
|
||||
cartId,
|
||||
orderId:orderDetail.info.id,
|
||||
id:seatFee.id,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
num,
|
||||
productName:name,
|
||||
num:number,
|
||||
number: 0,
|
||||
productSkuName: productSkuName || '',
|
||||
priceAmount,
|
||||
price
|
||||
productSkuName: '',
|
||||
priceAmount:totalAmount,
|
||||
price:salePrice
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -120,8 +119,8 @@
|
|||
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
|
||||
tableId: orderDetail.info.tableId,
|
||||
})
|
||||
tuicai.selGoods.status = 'return'
|
||||
tuicai.show = false
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -254,7 +253,6 @@
|
|||
for (let i in res.detailList) {
|
||||
const goods = res.detailList[i]
|
||||
if (goods.productName != '客座费') {
|
||||
console.log(goods);
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum].push(goods)
|
||||
} else {
|
||||
|
|
@ -263,11 +261,12 @@
|
|||
}
|
||||
|
||||
}
|
||||
orderDetail.seatFee = {
|
||||
name: '餐位费',
|
||||
orderDetail.seatFee = res.seatInfo|| {
|
||||
name: '客座费',
|
||||
number: res.seatCount,
|
||||
totalNumber: res.seatCount,
|
||||
totalAmount: res.seatAmount
|
||||
totalAmount: res.seatAmount,
|
||||
status:''
|
||||
}
|
||||
orderDetail.goodsList = Object.entries(goodsMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
|
|
|
|||
|
|
@ -54,18 +54,17 @@
|
|||
userId:''
|
||||
}
|
||||
})
|
||||
console.log(order.data);
|
||||
function clearQueryUser(){
|
||||
order.setQuery('userId','')
|
||||
}
|
||||
function pageChange(e){
|
||||
order.setVal('page',e)
|
||||
order.setQuery('page',e)
|
||||
console.log(e);
|
||||
console.log(order.data.page);
|
||||
init()
|
||||
}
|
||||
|
||||
console.log(order.list);
|
||||
|
||||
watch(()=>order.data.query.createdAt,(newval)=>{
|
||||
init()
|
||||
})
|
||||
|
|
@ -73,7 +72,8 @@
|
|||
init()
|
||||
})
|
||||
async function init() {
|
||||
const {content,totalElements}=await Api.tbOrderInfoData({...order.data.query,page:order.data.page})
|
||||
console.log(order.data.query);
|
||||
const {content,totalElements}=await Api.tbOrderInfoData(order.data.query)
|
||||
uni.stopPullDownRefresh()
|
||||
order.setVal('list',content)
|
||||
console.log(order.data.list);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
v-if="discount.price&&discount.currentPrice!=order.amount">
|
||||
<view>服务员改价</view>
|
||||
<view class=" u-flex u-col-center">
|
||||
<text style="color: rgb(255, 95, 46);">-¥{{order.amount- discount.currentPrice}}</text>
|
||||
<text style="color: rgb(255, 95, 46);">-¥{{to2(order.amount- discount.currentPrice)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -37,8 +37,8 @@
|
|||
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
||||
<template v-if="pays.selIndex==0">
|
||||
<view class="list">
|
||||
<view class="item" @click="changePayType(index,item)" v-for="(item,index) in pays.payTypes.list"
|
||||
:key="index">
|
||||
<view class="item" @click="changePayType(index,item)"
|
||||
v-for="(item,index) in pays.payTypes.list" :key="index">
|
||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
||||
<view class="u-flex">
|
||||
<image class="icon" :src="item.icon" mode=""></image>
|
||||
|
|
@ -60,12 +60,10 @@
|
|||
<my-button @click="payOrderClick">确认付款</my-button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="">
|
||||
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
|
||||
<view class="u-flex u-row-center u-m-t-40 ">
|
||||
<up-qrcode :size="140" :val="payCodeUrl"></up-qrcode>
|
||||
</view>
|
||||
<template v-if="pays.selIndex==1">
|
||||
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信/支付宝扫码</view>
|
||||
<view class="u-flex u-row-center u-m-t-40">
|
||||
<up-qrcode cid="code" :size="140" :val="payCodeUrl"></up-qrcode>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
|
@ -114,25 +112,46 @@
|
|||
onBeforeUnmount
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad
|
||||
onLoad,
|
||||
onBackPress
|
||||
} from '@dcloudio/uni-app'
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
|
||||
import {
|
||||
queryAllShopUser
|
||||
} from '@/http/yskApi/shop-user.js'
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import editDiscount from '@/components/my-components/edit-discount.vue'
|
||||
|
||||
let option = {isNowPay:false}
|
||||
let payFinish=ref(false)
|
||||
onBackPress(() => {
|
||||
console.log('onBackPress');
|
||||
uni.$emit('update:createOrderIndex')
|
||||
// if (option.isNowPay&&!payFinish.value) {
|
||||
// infoBox.showToast('先付费模式,请先结算订单')
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
})
|
||||
let payStatus = ref(null) //loading success
|
||||
|
||||
let timer = null
|
||||
|
||||
let user=ref({amount:0});
|
||||
|
||||
let user = ref({
|
||||
amount: 0
|
||||
});
|
||||
|
||||
function clear() {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
|
||||
function to2(n) {
|
||||
if (!n) {
|
||||
return ''
|
||||
}
|
||||
return n.toFixed(2)
|
||||
}
|
||||
const pays = reactive({
|
||||
list: ['扫码收款', '二维码收款'],
|
||||
selIndex: 0,
|
||||
|
|
@ -141,14 +160,39 @@
|
|||
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) => {
|
||||
clearInterval(timer)
|
||||
if (newval) {
|
||||
timer = setInterval(() => {
|
||||
orderApi.tbOrderInfoDetail(order.orderId).then(res => {
|
||||
order.status=res.status
|
||||
if(res.status=='closed'){
|
||||
order.status = res.status
|
||||
if (res.status == 'closed') {
|
||||
paySuccess()
|
||||
}
|
||||
})
|
||||
|
|
@ -179,14 +223,15 @@
|
|||
function editDiscountConfirm(form) {
|
||||
console.log(form);
|
||||
Object.assign(discount, form)
|
||||
getPayUrl()
|
||||
}
|
||||
async function getPayType() {
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList
|
||||
}
|
||||
|
||||
function changePayType(i,item) {
|
||||
if(item.payType=='vipPay'&&user.value.amount*1<order.amount*1){
|
||||
function changePayType(i, item) {
|
||||
if (item.payType == 'vipPay' && user.value.amount * 1 < order.amount * 1) {
|
||||
return infoBox.showToast('余额不足')
|
||||
}
|
||||
pays.payTypes.selIndex = i
|
||||
|
|
@ -196,16 +241,18 @@
|
|||
infoBox.showToast('支付成功')
|
||||
setTimeout(() => {
|
||||
// uni.$emit('orderDetail:update')
|
||||
payFinish.value=true
|
||||
uni.$emit('update:createOrderIndex')
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
delta: 1
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
|
||||
function payOrderClick(){
|
||||
|
||||
function payOrderClick() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
console.log(payType);
|
||||
if(payType=='scanCode'||payType=='deposit'){
|
||||
if (payType == 'scanCode' || payType == 'deposit') {
|
||||
return saomaPay()
|
||||
}
|
||||
payOrder()
|
||||
|
|
@ -270,22 +317,31 @@
|
|||
async function init() {
|
||||
const res = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||
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({
|
||||
orderId: opt.orderId
|
||||
orderId: order.id,
|
||||
payAmount: discount.currentPrice ? discount.currentPrice : order.amount
|
||||
}).then(res => {
|
||||
payCodeUrl.value = res
|
||||
})
|
||||
}
|
||||
onLoad(async (opt) => {
|
||||
console.log(opt);
|
||||
option = opt
|
||||
Object.assign(order, opt)
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList
|
||||
if(order.userId){
|
||||
queryAllShopUser({id:opt.userId}).then(res=>{
|
||||
user.value=res.content[0]||opt
|
||||
})
|
||||
}
|
||||
|
||||
init()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -160,9 +160,13 @@
|
|||
return infoBox.showToast('退款商品数量不能为0!')
|
||||
}
|
||||
const selTag=tuikuan.list[tuikuan.sel]
|
||||
const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}`
|
||||
if (!noteResult) {
|
||||
return infoBox.showToast('请输入或选择退款原因!')
|
||||
}
|
||||
await $returnOrder({
|
||||
"orderId": option.orderId,
|
||||
"note":`${selTag?selTag:''}${note.value?(','+note.value):''}` ,
|
||||
"note":noteResult,
|
||||
"orderDetails":orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
||||
return {
|
||||
id:v.id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue