This commit is contained in:
YeMingfei666 2024-10-16 14:24:21 +08:00
commit 2b85d19453
63 changed files with 1492 additions and 1480 deletions

View File

@ -392,4 +392,8 @@ text {
// }
.line-th{
text-decoration: line-through;
}
//覆盖u-view-plus 颜色
.u-primary-light {
color: $my-main-color;
}

View File

@ -7,9 +7,10 @@
* @param {Boolean} returnIsArea - 是否返回值符合范围区间默认为false
* @returns {number} - 返回格式化后的价格如果超出范围则返回最小值或最大值
*/
export const formatPrice = (price,min=-Infinity, max = 100000000,returnIsArea=false ) => {
export const formatPrice = (price,min=-Infinity, max = 100000000,returnIsArea=false,isRerturnNullString=false) => {
if(price === undefined || price === null||price===''){
return 0
return isRerturnNullString?'':0
}
// 将价格转换为浮点数并保留两位小数
const newval = parseFloat((Math.floor(price * 100) / 100).toFixed(2))

View File

@ -0,0 +1,26 @@
import {
getCurrentInstance,
} from 'vue';
export function getElRect(elClass, dataVal) {
const instance = getCurrentInstance();
return new Promise((resolve, reject) => {
const query = uni.createSelectorQuery().in(instance.proxy);
query.select('.' + elClass).fields({
size: true
}, res => {
// 如果节点尚未生成res值为null循环调用执行
if (!res) {
setTimeout(() => {
getElRect(elClass);
}, 10);
return;
}
resolve(res);
}).exec();
})
}
export async function getSafeBottomHeight(className, height = 16) {
const bottomEle = await getElRect(className)
return bottomEle.height + height
}

View File

@ -18,24 +18,26 @@ const appCache = {
const model = {
setLogin(res){
const user=res.user.user
uni.setStorageSync('logoutHandle',false)
uni.setStorageSync('shopId', res.shopId)
uni.setStorageSync('shopName',res.shopName)
uni.setStorageSync('logo',res.logo)
uni.setStorageSync('loginType',res.loginType)
uni.setStorageSync('shopUserId',res.user.user.id)
uni.setStorageSync('shopUserId',user.id)
if(res.loginType=='staff'){
uni.setStorageSync('merchantName',user.createBy||user.updateBy)
}
},
// 退出清空所有的缓存数据。 (不包含 环境相关)
cleanByLogout: () => {
// 1. 清空app级别缓存。
Object.keys(appCache).forEach(k => appCache[k] = null)
const merchantName=uni.getStorageSync('merchantName')
let envName = model.env() // 获取到当前的环境变量
uni.clearStorageSync() // 清除所有的缓存信息
uni.setStorageSync('merchantName',merchantName)
model.env(envName) // 重置env
},
// 获取和放置token

View File

@ -10,7 +10,7 @@
</view>
<view class="u-m-t-40 u-flex ">
<view>实收金额</view>
<view class="u-m-l-32 border-bottom u-flex-1">
<view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1">
<uni-easyinput style="digit" @input="currentPriceInput" @change="currentPriceChange" paddingNone :inputBorder="false"
v-model="form.currentPrice"
placeholder="输入实际金额"></uni-easyinput>
@ -18,7 +18,7 @@
</view>
<view class="u-m-t-54 u-flex ">
<view>优惠折扣</view>
<view class="u-m-l-32 u-flex-1 u-flex border-bottom">
<view class="u-m-l-32 u-flex-1 u-flex border u-p-l-10 u-p-r-10">
<view class="u-flex-1">
<uni-easyinput @input="discountInput" @change="discountChange" style="digit" paddingNone :inputBorder="false"
v-model="form.discount"
@ -33,7 +33,7 @@
<template #btn>
<view class="u-p-30">
<view class="u-m-t-10">
<my-button @tap="confirm" shape="circle" >修改</my-button>
<my-button @tap="confirm" shape="circle" fontWeight="700" >修改</my-button>
<view class="">
<my-button @tap="close" type="cancel" bgColor="#fff" >取消</my-button>
</view>
@ -146,7 +146,12 @@
})
</script>
<style lang="scss">
<style lang="scss" scoped>
.border{
border-radius: 8rpx;
overflow: hidden;
border-color: #999;
}
.lh34 {
line-height: 34rpx;
}

View File

@ -57,6 +57,10 @@ import { computed } from 'vue';
type:[String,Number],
default:'28'
},
fontWeight:{
type:[String,Number],
default:'500'
},
showShadow:{
type:Boolean,
default:false
@ -92,6 +96,7 @@ import { computed } from 'vue';
${props.width>=0?('width:'+props.width+'rpx;'):''}
${props.plain?('background-color:transparent;'):''}
font-size:${props.fontSize}rpx;
font-weight:${props.fontWeight};
${props.color?('color:'+props.color+';'):''}
${props.bgColor?('background-color:'+props.bgColor+';'):''}
${props.bgColor?('border-color:'+props.bgColor+';'):''}
@ -105,7 +110,8 @@ import { computed } from 'vue';
margin: auto;
}
.shadow{
box-shadow: 0 0 10px #aaa;
// box-shadow: 0 0 10px #aaa;
box-shadow: 0 20rpx 60rpx -20rpx rgba(0,84,210,0.5);
}
.btn {
font-size: 28rpx;

View File

@ -58,7 +58,7 @@
function returnMaxPage() {
const result=Math.ceil(props.totalElements / props.size)
return (result-1<=0?1:result-1)
return result
}
let maxPage=ref(returnMaxPage())
const pagesData = computed(() => {
@ -90,7 +90,9 @@
}
setCurrentPage(newPage)
}
watch(()=>props.page,(newval)=>{
currentPage.value =newval
})
watch(() => currentPage.value, (newval) => {
emits('change', newval)
emits('update:page', newval)

View File

@ -84,7 +84,7 @@
.bg {
background: #E6F0FF;
padding: 4rpx 10rpx;
padding: 7rpx 10rpx;
}
.border-r-16 {
@ -124,7 +124,7 @@
}
.item {
padding: 8rpx 0;
padding: 9rpx 0;
transition: all .2s ease-in-out;
position: relative;
background-color: transparent;
@ -138,6 +138,7 @@
border-radius: 8rpx;
// background-color: $my-main-color;
color: #fff;
font-weight: bold;
}
}
</style>

View File

@ -130,7 +130,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wxcf0fe8cdba153fd6",
"appid" : "wxcbff1cfb27c1066c",
"setting" : {
"urlCheck" : false,
"minified" : true,

View File

@ -3,6 +3,7 @@
"clipboard": "^2.0.11",
"dayjs": "^1.11.13",
"gm-crypto": "^0.1.8",
"immutable": "^4.3.7",
"js-base64": "^3.7.2",
"jsencrypt": "^3.3.2",
"lodash": "^4.17.21",

View File

@ -1,5 +1,5 @@
<template>
<view class="page">
<view class="page min-page">
<view class="box">
<view>
<uni-forms :model="category" :rules="rules" err-show-type="toast" ref="form"
@ -649,8 +649,9 @@
infoBox.showToast(option.type === 'edit' ? '修改成功' : '添加成功')
timer = setTimeout(() => {
clearTimeout(timer)
uni.$emit('update:pageCategoryIndex')
go.back()
}, 1500);
}, 500);
// const res = await form.value.validate().then(res => {
// go.back()
// })

View File

@ -25,20 +25,18 @@
<view class="u-m-t-24 u-flex u-row-between">
<view >
<template v-if="data.childrenList.length">
<!-- <template v-if="data.childrenList.length">
<view class="u-flex color-999 u-flex u-col-center" @tap="useTypeClick">
<text class="u-font-24">{{computedUserType}} </text>
<view class="u-flex">
<uni-icons type="right" color="#999"></uni-icons>
</view>
</view>
</template>
<template v-else>
</template> -->
<view class="u-flex">
<view class="u-m-r-18 color-999">开关</view>
<my-switch v-model="isShow" @change="isShowChange"></my-switch>
</view>
</template>
</view>
<view class="u-flex no-wrap">
@ -54,6 +52,7 @@
import {
computed,
ref,
watch,
watchEffect
} from 'vue';
import mySwitch from '@/components/my-components/my-switch.vue'
@ -71,7 +70,9 @@
data: {
type: Object,
default: () => {
return {}
return {
isShow:true
}
}
},
showChecked: {
@ -79,8 +80,10 @@
default: false
}
})
let isShow=ref(props.data.isShow)
watch(()=>props.data.isShow,(newval)=>{
isShow.value=newval
})
function isShowChange(){
console.log(isShow.value);
emits('isShowChange',{...props.data,isShow:isShow.value})

View File

@ -12,8 +12,8 @@
:showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-category>
</view>
<view class="u-m-t-44">
<my-pagination :size="pageData.query.size" :totalElements="pageData.totalElements" @change="pageChange"></my-pagination>
<view class="u-m-t-44" v-if="pageData.list.length>0">
<my-pagination :page="pageData.query.page+1" :size="pageData.query.size" :totalElements="pageData.totalElements" @change="pageChange"></my-pagination>
<view style="height: 200rpx;"></view>
</view>
</view>
@ -96,14 +96,10 @@
import {
reactive, ref, watch
} from 'vue';
import {onShow} from '@dcloudio/uni-app'
import {onShow,onLoad} from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js';
import myCategory from './components/category.vue'
import infoBox from "@/commons/utils/infoBox.js"
import myPagination from '@/components/my-components/my-pagination.vue'
import myModel from "@/components/my-components/my-model.vue"
import myButton from "@/components/my-components/my-button.vue"
import mySwitch from "@/components/my-components/my-switch.vue"
import {$productCategory} from '@/http/yskApi/goods.js'
@ -162,9 +158,18 @@
})
pageData.totalElements=res.totalElements
}
onShow(()=>{
onLoad(()=>{
init()
})
function watchEvent(){
uni.$off('update:pageCategoryIndex')
uni.$on('update:pageCategoryIndex',(data)=>{
init()
})
}
onShow(()=>{
watchEvent()
})
function toAddCategory(){
go.to('PAGES_CATEGORY_EDIT',{type:'add'})
}
@ -302,6 +307,9 @@
const islast=pageData.list.length===1
$productCategory.del([pageData.list[index].id]).then(res=>{
infoBox.showToast('删除成功')
if(islast&&pageData.query.page>=1){
pageData.query.page-=1
}
// if(islast&&pageData.query.page>=1){
// pageData.query.page--
// }

View File

@ -32,7 +32,7 @@
<text class="u-m-r-24">{{data.name}}</text>
</view>
<view class="u-font-32">
<text v-if="data.typeEnum=='单规格'">¥</text>
<text v-if="data.typeEnum=='单规格'||data.typeEnum=='normal'">¥</text>
<text>{{data.lowPrice}}</text>
</view>
</view>

View File

@ -14,12 +14,13 @@
</view>
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
:placeholder="pageData.search.placeholder" v-model="pageData.query.name"
@clear="searchFunc"
@confirm="searchFunc">
<template #prefixIcon>
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
</template>
</uni-easyinput>
<button type="text" @click="searchFunc()">搜索</button>
<button type="text" @click="searchFunc">搜索</button>
</view>
</view>
<view class="u-flex states1 u-row-between u-font-28">
@ -36,13 +37,12 @@
<view class="goods-list u-p-30">
<template v-if="pageData.bindGoodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.bindGoodsList" :key="index">
<my-goods isBind @radioClick="goodsRadioClick" :index="index"
:data="item" @del="goodsDel" :showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-goods>
<my-goods isBind @radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
</view>
</template>
<template v-if="pageData.hasAjax&&!pageData.bindGoodsList.length">
<my-img-empty tips="暂无绑定商品"></my-img-empty>
<my-img-empty :tips="isSearch?'未搜索到相关绑定商品':'暂无绑定商品' "></my-img-empty>
</template>
<view style="height: 100rpx;"></view>
</view>
@ -52,9 +52,9 @@
<view class="bg-fff border-r-18 u-p-t-16 u-p-b-16 box-shadow">
<template v-if="pageData.goodsList.length">
<view class="" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods @goodsClick="goodsClick"
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
<my-goods @goodsClick="goodsClick" @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">
@ -117,9 +117,11 @@
upGroupSort,
tbProductGroupPost
} from "@/http/yskApi/shop.js"
import {hasPermission} from '@/commons/utils/hasPermission.js';
import {
hasPermission
} from '@/commons/utils/hasPermission.js';
import {
returnAllCategory
} from '@/pageProduct/util.js'
@ -154,17 +156,7 @@
categoryName: '',
hasAjax: false
})
watch(() => pageData.query.categoryId, (newval) => {
getGoodsList()
})
watch(()=>pageData.stateCurrent,(newval)=>{
if(newval){
setGoodsList()
}else{
init()
}
})
function isGroundingChange(e) {
const {
@ -191,27 +183,33 @@
console.log(e);
pageData.goodsList[e].checked = !pageData.goodsList[e].checked
}
function setCategory(category) {
pageData.query.categoryId = category.id
console.log(pageData.query.categoryId );
pageData.categoryName = category.name
}
let $goodsList=[]
function setGoodsList(){
pageData.goodsList = $goodsList.filter(v=>!pageData.bindGoodsList.find(bindGoods=>bindGoods.id==v.id))
let $goodsList = []
function setGoodsList() {
pageData.goodsList = $goodsList.filter(v => {
return !pageData.bindGoodsList.find(bindGoods => bindGoods.id == v.id)
})
}
function getGoodsList() {
$tbProductV2(pageData.query).then(res => {
pageData.hasAjax = true
pageData.totalElements = res.totalElements
$goodsList=res.content.map(v=>{
$goodsList = res.content.map(v => {
return {
...v,checked:false
...v,
checked: false
}
})
setGoodsList()
})
}
onShow(() => {
@ -219,21 +217,16 @@
})
async function getGroupBindGoods() {
const res = await productListGet(option.id)
pageData.bindGoodsList = res
pageData.bindGoodsList = res.filter(v=>{
return pageData.query.categoryId===''?true:(v.categoryId==pageData.query.categoryId)&&(v.name.includes(pageData.query.name))
})
}
const option = reactive({})
async function init() {
const res = await productListGet(option.id)
pageData.bindGoodsList = res
await getGroupBindGoods()
getGoodsList()
}
onLoad((opt) => {
tbProductGroupGet({
page: 0,
size: 999,
sort: 'id',
shopId: uni.getStorageSync('shopId')
})
Object.assign(option, opt)
init()
// $tbShopCategory({
@ -263,28 +256,30 @@
}
async function save() {
const res=await hasPermission('允许修改分组')
if(!res){
const res = await hasPermission('允许修改分组')
if (!res) {
return
}
console.log(pageData.goodsList);
await tbProductGroupPut({
...option,
shopId:uni.getStorageSync('shopId'),
productIds:[...pageData.bindGoodsList.map(v=>v.id),...pageData.goodsList.filter(v=>v.checked).map(v=>v.id)]
shopId: uni.getStorageSync('shopId'),
productIds: [...pageData.bindGoodsList.map(v => v.id), ...pageData.goodsList.filter(v => v.checked)
.map(v => v.id)
]
})
pageData.stateCurrent=0
pageData.stateCurrent = 0
}
function updateGroup(){
function updateGroup() {
}
//
async function goodsDel(index) {
const res=await hasPermission('允许修改分组')
if(!res){
const res = await hasPermission('允许修改分组')
if (!res) {
return
}
const goods = pageData.bindGoodsList[index]
@ -296,8 +291,8 @@
pageData.bindGoodsList.splice(index, 1)
tbProductGroupPut({
...option,
shopId:uni.getStorageSync('shopId'),
productIds:pageData.bindGoodsList.map(v=>v.id)
shopId: uni.getStorageSync('shopId'),
productIds: pageData.bindGoodsList.map(v => v.id)
})
} else if (res.cancel) {}
}
@ -307,6 +302,7 @@
function statesTableClick(index) {
pageData.stateCurrent = index
console.log(pageData.stateCurrent);
}
@ -341,10 +337,20 @@
function isHasChekdGoods() {
return getChechkedGoodsList().length ? true : false
}
function searchFunc() {
let isSearch=ref(false)
async function searchFunc() {
isSearch.value=true
console.log('searchFunc');
getGoodsList()
if (pageData.stateCurrent) {
getGoodsList()
} else {
const res = await productListGet(option.id)
pageData.bindGoodsList = res.filter(v=>{
return v.name.includes(pageData.query.name)&&(pageData.query.categoryId===''?true:v.categoryId==pageData.query.categoryId)
})
}
}
let showChecked = ref(false)
@ -407,6 +413,21 @@
pageData.category = cate
getGoodsList()
}
watch(() => pageData.query.categoryId, (newval) => {
if(pageData.stateCurrent==1){
getGoodsList()
}else{
getGroupBindGoods()
}
})
watch(() => pageData.stateCurrent, (newval) => {
if (newval==1) {
getGoodsList()
} else {
getGroupBindGoods()
}
})
</script>
<style scoped>
page {

View File

@ -7,8 +7,8 @@
<view class="block">
<view class="">
<uni-forms-item label="分类名称" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="category.name" placeholder="输入分类名称" />
<uni-easyinput paddingNone :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="category.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<template v-if="option.type=='edit'">
@ -17,7 +17,7 @@
v-model="category.sort" type="number" placeholder="排序越小越靠前" />
</uni-forms-item>
</template>
<uni-forms-item label="">
<view class="u-flex u-row-between u-col-center">
<view class="label-title">分组状态</view>
@ -26,6 +26,35 @@
</view>
</view>
</uni-forms-item>
<uni-forms-item label="">
<view class="u-flex u-row-between u-col-center">
<view class="label-title">售卖时间管控</view>
<view class="u-flex">
<my-switch v-model="category.useTime"></my-switch>
</view>
</view>
<view v-if="category.useTime" class="u-flex u-row-between u-col-center u-m-t-30 u-p-b-12">
<view class="u-flex timesel" @click="changeTime('start')">
<up-icon name="clock" size="14"></up-icon>
<view class="u-m-l-20">
<text v-if="!category.saleStartTime" class="color-999">起始时间</text>
<text v-else>{{category.saleStartTime}}</text>
</view>
</view>
<view class="u-p-l-30 u-p-r-30"></view>
<view class="u-flex timesel" @click="changeTime('end')">
<up-icon name="clock" size="14"></up-icon>
<view class="u-m-l-20">
<text v-if="!category.saleEndTime" class="color-999">结束时间</text>
<text>{{category.saleEndTime}}</text>
</view>
</view>
</view>
</uni-forms-item>
<uni-forms-item label="分组排序" required name="name">
<uni-number-box :value="category.sort" />
</uni-forms-item>
</view>
</uni-forms>
</view>
@ -36,6 +65,9 @@
</view>
</view>
<view class="bottom" ref="bottom"></view>
<up-datetime-picker @cancel="timeCancel" @confirm="timeConfirm" :show="time.show" v-model="time.val" mode="time"></up-datetime-picker>
</view>
</template>
@ -90,6 +122,7 @@
}
//
const placeholderStyle = ref('font-size:28rpx;')
//
@ -122,6 +155,31 @@
}
};
}
const time=reactive({
show:false,
val:'',
key:''
})
function timeCancel(){
time.show=false
}
function timeConfirm(e){
console.log(e);
if(time.key=='start'){
category.saleStartTime=e.value
}else{
category.saleEndTime=e.value
}
time.val=''
time.show=false
}
function changeTime(key) {
time.key=key;
time.show=true;
}
function toTimer(timer, index) {
console.log(timer);
@ -184,6 +242,8 @@
productIds: [],
saleTime: [],
useTime: 0,
saleEndTime:'',
saleStartTime:'',
shopId: uni.getStorageSync('shopId')
}
const categoryChild = ref({
@ -549,6 +609,13 @@
background: #F9F9F9;
}
.timesel {
border: 1px solid #eee;
border-radius: 10rpx;
padding: 10rpx 20rpx;
flex: 1;
}
.option-item {
margin-bottom: 34rpx;
}

View File

@ -16,8 +16,8 @@
</view>
</view>
<view class="u-m-t-24 u-p-l-54 ">
<view class="u-flex-1 u-flex">
<view class="color-666">分组名</view>
<view class="u-flex-1 u-flex u-col-top">
<view class="color-666 no-wrap">分组名</view>
<view class="color-333 u-m-l-60">{{data.name}}</view>
<view class="u-flex u-m-l-16 " @click="editName">
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>

View File

@ -0,0 +1,183 @@
<template>
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9">
<view class="u-p-32 box u-font-28">
<view class="u-flex u-relative u-row-center">
<view class="u-font-32">编辑</view>
<view class="u-absolute close">
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
</view>
</view>
<view class="u-m-t-36">
<view class="u-flex u-row-between">
<view class="">
售卖时间管控
</view>
<my-switch v-model="category.useTime"></my-switch>
</view>
<view v-if="category.useTime" class="u-flex u-row-between u-col-center u-m-t-30 u-p-b-12">
<view class="u-flex timesel" @click="changeTime('start')">
<up-icon name="clock" size="14"></up-icon>
<view class="u-m-l-20">
<text v-if="!category.saleStartTime" class="color-999">起始时间</text>
<text v-else>{{category.saleStartTime}}</text>
</view>
</view>
<view class="u-p-l-30 u-p-r-30"></view>
<view class="u-flex timesel" @click="changeTime('end')">
<up-icon name="clock" size="14"></up-icon>
<view class="u-m-l-20">
<text v-if="!category.saleEndTime" class="color-999">结束时间</text>
<text>{{category.saleEndTime}}</text>
</view>
</view>
</view>
<view class="u-m-t-38">
<view class="u-m-b-32">
</view>
<view class="u-m-t-60">
<my-button type="primary" shape="circle" @tap="save">
<view class="u-font-32">
保存
</view>
</my-button>
</view>
</view>
</view>
<up-datetime-picker @cancel="timeCancel" @confirm="timeConfirm" :show="time.show" v-model="time.val" mode="time"></up-datetime-picker>
</view>
</up-popup>
</template>
<script setup>
import {
reactive,
ref,
watch,
onMounted,
computed
} from 'vue';
import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({
show: {
type: Boolean,
default: false
},
item: {
type: Object,
default: () => {
name: ''
}
}
})
const category =reactive({
useTime: 0,
saleEndTime:'',
saleStartTime:'',
})
const time=reactive({
show:false,
val:'',
key:''
})
function timeCancel(){
time.show=false
}
function timeConfirm(e){
console.log(e);
if(time.key=='start'){
category.saleStartTime=e.value
}else{
category.saleEndTime=e.value
}
time.val=''
time.show=false
}
function changeTime(key) {
time.key=key;
time.val=key=='start'?category.saleStartTime:category.saleEndTime
time.show=true;
}
function changeShowRecoders(show) {
recoders.show = show
}
const data = ref(props.item)
const emits = defineEmits(['update:show', 'save'])
const form = reactive({
note: ''
})
let popShow = ref(props.show)
let name = ref('')
watch(() => props.item.name, (newval) => {
name.value = newval
})
watch(() => props.show, (newval) => {
popShow.value = newval
if (newval) {
data.value = props.item
console.log(props.item);
Object.assign(category,props.item)
console.log(props.item);
}
})
const isSku = computed(() => {
// return data.value.typeEnum == ''
return false
})
watch(() => popShow.value, (newval) => {
emits('update:show', newval)
})
function close() {
popShow.value = false
}
function open() {
}
function save() {
if(category.useTime){
if(!category.saleStartTime){
return infoBox.showToast('请选择起始时间')
}
if(!category.saleEndTime){
return infoBox.showToast('请选择结束时间')
}
}
emits('save', {
...data.value,...category
})
}
</script>
<style lang="scss" scoped>
.box {
width: 600rpx;
border-radius: 18rpx 18rpx 18rpx 18rpx;
box-sizing: border-box;
}
.timesel {
border: 1px solid #eee;
border-radius: 10rpx;
padding: 10rpx 20rpx;
flex: 1;
}
.close {
position: absolute;
right: 0;
}
.number {
color: #EE4646;
}
</style>

View File

@ -9,8 +9,8 @@
@isShowChange="isSHowChange" :index="index" :data="item" :showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-category>
</view>
<view class="u-m-t-44">
<my-pagination :size="pageData.query.size" :totalElements="pageData.totalElements"
<view class="u-m-t-44" v-if="pageData.list.length>0">
<my-pagination :page="pageData.query.page+1" :size="pageData.query.size" :totalElements="pageData.totalElements"
@change="pageChange"></my-pagination>
<view style="height: 200rpx;"></view>
</view>
@ -25,6 +25,7 @@
<edit-sort @save="updataGroup" :item="popup.selData" v-model:show="popup.sort.show"></edit-sort>
<edit-name @save="updataGroup" :item="popup.selData" v-model:show="popup.name.show"></edit-name>
<edit-time @save="updataGroup" :item="popup.selData" v-model:show="popup.time.show"></edit-time>
<up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list"
:show="actions.show"></up-action-sheet>
@ -44,6 +45,7 @@
import infoBox from "@/commons/utils/infoBox.js"
import editSort from './components/edit-sort.vue';
import editName from './components/edit-name.vue';
import editTime from './components/edit-time.vue';
import {
tbProductGroupGet,
tbProductGroupDelete,
@ -66,7 +68,13 @@
name: '管理商品',
color: '#333',
fontSize: '16'
}],
},
{
name: '售卖时间',
color: '#333',
fontSize: '16'
}
],
show: false,
})
@ -82,6 +90,9 @@
})
}
if (e.name == '售卖时间') {
return popupShow(actions.selIndex, 'time', true)
}
}
function actionsHide() {
@ -106,6 +117,9 @@
},
name:{
show: false
},
time:{
show: false
}
})
@ -119,6 +133,7 @@
const res = await $productCategory.update(e)
popup.sort.show = false;
popup.name.show = false;
popup.time.show = false;
pageData.list[popup.selIndex] = e
infoBox.showToast('更新成功')
}
@ -312,6 +327,9 @@
const islast = pageData.list.length === 1
$productCategory.del([pageData.list[index].id]).then(res => {
infoBox.showToast('删除成功')
if(islast&&pageData.query.page>=1){
pageData.query.page-=1
}
// if(islast&&pageData.query.page>=1){
// pageData.query.page--
// }

View File

@ -1228,7 +1228,7 @@
}
if (type === 'stockTips') {
modelProps = {
desc: '先保存商品基础信息',
desc: '先保存商品基础信息',
showIcon: false
}
model.value.open()

View File

@ -47,17 +47,18 @@
</view>
<template v-if="FormData.typeEnum!='group'">
<view class="u-relative">
<uni-forms-item label="所属分类" required showRequired name="categoryId">
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
<uni-forms-item label="所属分类" required showRequired name="categoryId">
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
placeholder="请选择分类" popup-title="请选择分类" :localdata="pageData.category"
v-model="FormData.categoryId">
</uni-data-picker>
</uni-forms-item>
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)" v-if="option.type=='edit'&&disabledChangeCategory">
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)"
v-if="option.type=='edit'&&disabledChangeCategory">
</view>
</view>
</template>
@ -129,7 +130,7 @@
:key="index">
<view class="u-flex-1 u-text-left">{{item.specSnap}}</view>
<view class="u-flex-1">{{item.salePrice}}</view>
<view class="u-flex-1">{{item.stockNumber}}</view>
<view class="u-flex-1">{{item.stockNumber||0}}</view>
</view>
</view>
@ -216,7 +217,7 @@
<!-- <view class="u-m-t-32 u-font-32 u-m-l-10 u-m-b-32">规格属性</view> -->
<view class="block" v-for="(sku,index) in skuList.list" :key="index">
<view class="border-top-0">
<uni-forms-item label="售价">
<uni-forms-item label="售价" required showRequired>
<uni-easyinput :paddingNone="inputPaddingNone"
@blur="priceFormat(sku,'salePrice')" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="sku.salePrice" type="digit"
@ -241,7 +242,7 @@
:inputBorder="inputBorder" v-model="sku.originPrice" type="digit"
placeholder="请输入原价(元)" />
</uni-forms-item> -->
<uni-forms-item label="起售数量">
<uni-forms-item label="起售数量" required showRequired>
<uni-easyinput @blur="priceFormat(sku,'suit')" :paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="sku.suit" type="digit" placeholder="请输入起售数量" />
@ -256,7 +257,7 @@
<uni-easyinput :paddingNone="inputPaddingNone"
@blur="priceFormat(sku,'firstShared')" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="sku.firstShared" type="digit"
placeholder="请输入起售数量" />
placeholder="请输入分销金额" />
</uni-forms-item>
<uni-forms-item label="商品条码">
<uni-easyinput disabled :paddingNone="inputPaddingNone"
@ -417,12 +418,17 @@
<view class="color-999 u-m-t-16 u-font-24">关闭则不计算出入库数据</view>
</uni-forms-item>
<template v-if="FormData.isStock">
<uni-forms-item label="库存数量">
<uni-easyinput :paddingNone="inputPaddingNone"
:disabled="disabledStock"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.stockNumber" type="digit" placeholder="请输入库存数量" />
</uni-forms-item>
<view class="u-relative">
<uni-forms-item label="库存数量">
<uni-easyinput
@blur="priceFormat(FormData,'stockNumber')"
:paddingNone="inputPaddingNone" :disabled="disabledStock"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="FormData.stockNumber" type="digit" placeholder="请输入库存数量" />
</uni-forms-item>
<view class="u-absolute position-all" v-if="disabledStock" @click="canEditGoodsStock(true)">
</view>
</view>
</template>
<uni-forms-item label="">
@ -588,10 +594,10 @@
if (!res) {
return
}
await upDateGoods({
key: 'pauseSale',
value: FormData.isPauseSale ? 0 : 1
})
// await upDateGoods({
// key: 'pauseSale',
// value: FormData.isPauseSale ? 0 : 1
// })
FormData.isPauseSale = FormData.isPauseSale ? 0 : 1
}
@ -604,10 +610,10 @@
if (!res) {
return
}
await upDateGoods({
key: 'grounding',
value: FormData.isGrounding ? 0 : 1
})
// await upDateGoods({
// key: 'grounding',
// value: FormData.isGrounding ? 0 : 1
// })
FormData.isGrounding = FormData.isGrounding ? 0 : 1
}
@ -857,8 +863,9 @@
title: '删除成功'
})
setTimeout(() => {
uni.$emit('del:productIndex', option.productId)
go.back()
}, 1000)
}, 500)
})
}
@ -877,7 +884,7 @@
}
if (type === 'stockTips') {
modelProps = {
desc: '先保存商品基础信息',
desc: '先保存商品基础信息',
showIcon: false
}
model.value.open()
@ -1092,10 +1099,10 @@
}
}
}
res.skuList = (res.skuList.length ? res.skuList : [])
$goodsData = res
console.log(res);
skuList.list = res.skuList
Object.assign(FormData, res)
skuList.list = res.skuList || []
//
if (res.typeEnum === 'sku') {
const selectSpec = JSON.parse(res.selectSpec)
@ -1139,8 +1146,12 @@
}),
specList: [],
}
} else {
//
}
})
}
@ -1321,14 +1332,25 @@
return infoBox.showToast('请上传商品图片')
}
const skuSnap = []
let submitSkuList = FormData.specificationsGroup ? skuList.list : [{
...$defaultSku,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
}];
if (typeEnum == 'normal') {
submitSkuList = skuList.list;
let submitSkuList = skuList.list || []
if (option.type == 'edit') {
submitSkuList = submitSkuList.map(v => {
return {
...v,
productId: FormData.id,
shopId: uni.getStorageSync('shopId')
}
})
}
console.log(submitSkuList);
// if(typeEnum!=$goodsData.typeEnum){
// if(typeEnum=='normal'){
// submitSkuList = skuList.list;
// }else{
// submitSkuList = skuList.list;
// }
// }else{
// submitSkuList = skuList.list;
// }
if (FormData.specificationsGroup) {
for (let i of FormData.specificationsGroup.selectSpec) {
if (i.selectSpecResult.length) {
@ -1340,22 +1362,41 @@
}
}
console.log(FormData.specificationsGroup);
const selectSpec = FormData.typeEnum != 'sku' ? '' : JSON.stringify(FormData.specificationsGroup
.selectSpec.map(spe => {
return {
...spe,
value: spe.value.map(v => {
return typeof v === 'string' ? v : v.text || v.value
})
}
}))
const selectSpec = FormData.typeEnum != 'sku' ? '[]' : JSON.stringify((FormData.specificationsGroup
.selectSpec || []).map(spe => {
return {
...spe,
value: spe.value.map(v => {
return typeof v === 'string' ? v : v.text || v.value
})
}
}))
const lowPrice = submitSkuList[0] ? submitSkuList[0].salePrice : FormData.salePrice
// const lowPrice = submitSkuList[0] ? submitSkuList[0].salePrice : FormData.salePrice
const suit = submitSkuList[0] ? submitSkuList[0].suit : 0
const stockNumber = FormData.stockNumber
if (typeEnum == 'normal') {
if (lowPrice === '') {
return infoBox.showToast('请输入售价')
}
if (lowPrice === '') {
return infoBox.showToast('请输入售价')
}
if (suit <= 0) {
return infoBox.showToast('起售数量不能小于0')
}
if(stockNumber===''){
return infoBox.showToast('请输入库存数量!')
}
}
const submitData = {
...FormData,
images: images,
coverImg: images[0] || '',
skuList: submitSkuList,
specInfo: JSON.stringify(submitSkuList),
lowPrice: submitSkuList[0].salePrice,
lowPrice,
specificationsGroup: undefined,
selectSpec,
skuSnap: JSON.stringify(skuSnap)
@ -1402,6 +1443,7 @@
uni.$off('emitspecificationsSave')
uni.$on('emitspecificationsSave', function(data) {
FormData.specificationsGroup = data
FormData.specId = data.specId
skuList.list = data.result.map(v => {
return {
...v.skus,
@ -1432,6 +1474,7 @@
uni.setStorageSync('guige', FormData.specificationsGroup)
go.to('PAGES_PRODUCT_GUIGE_CHOOSE', {
emitName: 'emitspecificationsSave',
type:option.type,
productId: option.productId
})
// go.to('PAGES_PRODUCT_GUIGE_ADD', {
@ -1499,35 +1542,51 @@
watch(() => FormData.typeEnum, (newval) => {
if (option.type === 'add') {
if (newval === 'sku') {
skuList.list = []
if (option.type == 'edit') {
FormData.specId = newval == 'normal' ? '' : ($goodsData.specId || '')
if (newval == $goodsData.typeEnum) {
skuList.list = $goodsData.skuList
} else {
skuList.list[0] = {
...$defaultSku,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
if (newval == 'normal') {
skuList.list = [{
...$defaultSku,
productId: FormData.id,
shopId: uni.getStorageSync('shopId'),
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
}]
} else {
skuList.list = []
}
}
}else{
//
if (newval === 'sku') {
skuList.list = []
} else {
FormData.specId = ''
if (newval == 'normal') {
skuList.list = [{
...$defaultSku,
shopId: uni.getStorageSync('shopId'),
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
}]
} else {
skuList.list=$goodsData.skuList
skuList.list = []
}
}
})
/**
* 权限start
*/
//
let disabledStock=ref(false)
async function canEditGoodsStock() {
let disabledStock = ref(false)
async function canEditGoodsStock(tips = false) {
console.log(tips);
if (option.type === 'edit') {
const res=await hasPermission({text:'允许修改商品库存',tips:false})
disabledStock.value=!res
const res = await hasPermission({
text: '允许修改商品库存',
tips: tips
})
disabledStock.value = !res
}
}
watch(() => FormData.isStock, (newval) => {
@ -1536,18 +1595,21 @@
}
})
//
let disabledChangeCategory=ref(false)
async function canEditGoodsCategory(tips=false) {
let disabledChangeCategory = ref(false)
async function canEditGoodsCategory(tips = false) {
if (option.type === 'edit') {
const res=await hasPermission({text:'允许修改分类',tips})
disabledChangeCategory.value=!res
const res = await hasPermission({
text: '允许修改分类',
tips
})
disabledChangeCategory.value = !res
}
}
/**
* 权限end
*/
watch(() => pageData.types, (newval) => {
Forms.value.setRules(rules)
})

View File

@ -1,8 +1,11 @@
<template>
<view class="u-relative choose-haocai">
<view class="input u-flex" @click="toggle" >
<!-- <view class="input u-flex" @click="toggle" >
<up-input @blur="blur" @change="filterHaocaiList" border="none" v-model="text" placeholder="请选择"></up-input>
<up-icon :size="10" name="arrow-down-fill"></up-icon>
</view> -->
<view class="input u-flex" >
<up-input @blur="blur" disabled="true" @change="filterHaocaiList" border="none" v-model="text" placeholder="请选择"></up-input>
</view>
<view class="u-absolute" v-if="popShow">
<scroll-view scroll-y="true" class="scroll">

View File

@ -135,9 +135,9 @@
<view class="default-box-padding bg-fff border-r-18 u-flex u-row-between u-m-t-32">
<view>当某个耗材的使用库存不足时商品自动
售罄</view>
<view class="u-flex u-p-l-32">
<!-- <view class="u-flex u-p-l-32">
<up-switch :size="20"></up-switch>
</view>
</view> -->
</view>
<view class="bottom">
<my-button type="primary" shape="circle" @click="save">保存</my-button>

View File

@ -39,7 +39,7 @@
</uni-forms-item>
</view>
<view class=" u-flex">
<view class=" u-flex" v-if="item.options.length>1">
<uni-forms-item :key="optionIndex" label-width="0" label=""
:showRequired="false">
<view class="u-flex">
@ -70,13 +70,15 @@
</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 ">
<template v-if="specifications.list.length>1">
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
<view class="icon icon-reduce u-m-r-22 ">
</view>
<view class="color-red">删除规格组</view>
</view>
<view class="color-red">删除规格组</view>
</view>
</template>
</view>
</uni-forms>
</view>
@ -192,6 +194,9 @@
}
//
function delSpecificationsGroup(index) {
if(specifications.list.length<=1){
return
}
specifications.list.splice(index, 1)
}
//
@ -200,6 +205,9 @@
}
//
function delOption(index, optionIndex) {
if(specifications.list[index].options.length<=1){
return
}
specifications.list[index].options.splice(optionIndex, 1)
}
//

View File

@ -15,11 +15,11 @@
</view>
<view class="">
<view class="u-m-t-32" v-for="(item,index) in FormData.selectSpec" :key="index">
<view class="font-bold">
{{item.name}}
</view>
<view class="u-m-t-24">
<uni-data-checkbox @change="createResult" multiple :selectedColor="color.ColorMain"
v-model="item.selectSpecResult" :localdata="item.value"></uni-data-checkbox>
@ -29,22 +29,15 @@
</view>
</view>
</view>
<!-- <view class="block u-m-b-32 u-p-30">
<view class="font-bold">批量修改</view>
<view class="u-flex fast-edit u-flex-wrap gap-20 u-m-t-12">
<view class="color-main item u-flex u-row-center u-col-center" v-for="(item,index) in fastEdit.list" :key="index">
<view class="u-flex u-col-center">
<view class="u-m-r-12">{{item.text}}</view>
<up-icon size="16" :color="color.ColorMain" name="edit-pen"></up-icon>
</view>
</view>
</view>
</view> -->
<view>
<view class="block u-m-b-32" v-for="(item,index) in FormData.result" :key="index">
</uni-forms>
<view>
<view class="block u-m-b-32" v-for="(item,index) in FormData.result" :key="index">
<uni-forms :model="item.skus" :rules="rules" :ref="setFormRef(index)" err-show-type="undertext"
validateTrigger="blur" :border="true" :label-width="130">
<view class="">
<view class="u-m-t-16" v-for="(val,key) in item.names" :key="key">
<text class="font-bold u-m-r-12">
@ -54,21 +47,19 @@
</view>
</view>
<view class="u-m-t-24">
<view label="">
<view label="">
<view class="font-bold">
图片
</view>
</view>
<view class="u-m-t-24">
<my-upload-file @change="changeResultCover($event,index)" :limit="1" :ref="setRefFile(index)" :images="item.coverImg"></my-upload-file>
</view>
<!-- <uni-file-picker v-model="FormData.images" file-mediatype="image" mode="grid"
:limit="10" @progress="FileUploadprogress" @success="FileUploadsuccess"
@fail="FileUploadail" @select="FileUploadselect" /> -->
<my-upload-file @change="changeResultCover($event,index)" :limit="1"
:ref="setRefFile(index)" :images="item.coverImg"></my-upload-file>
</view>
</view>
</view>
<view class="skus u-m-t-32">
<view class="">
<uni-forms-item label="售价" required>
<uni-forms-item label="售价" required name="salePrice">
<uni-easyinput @blur="priceFormat(item.skus,'salePrice')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="item.skus.salePrice" type="digit"
@ -76,35 +67,41 @@
</uni-forms-item>
</view>
<uni-forms-item label="会员价(元)" required>
<uni-forms-item label="会员价(元)" required name="memberPrice">
<uni-easyinput @blur="priceFormat(item.skus,'memberPrice')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="item.skus.memberPrice" type="digit"
placeholder="请输入会员价(元)" />
</uni-forms-item>
<uni-forms-item label="成本价(元)" required>
<uni-forms-item label="成本价(元)" required name="costPrice">
<uni-easyinput @blur="priceFormat(item.skus,'costPrice')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="item.skus.costPrice" type="digit"
placeholder="请输入成本价(元)" />
</uni-forms-item>
<uni-forms-item label="原价(元)" required>
<uni-forms-item label="原价(元)" required name="originPrice">
<uni-easyinput @blur="priceFormat(item.skus,'originPrice')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="item.skus.originPrice" type="digit"
placeholder="请输入原价(元)" />
</uni-forms-item>
<uni-forms-item label="起售数量" required>
<uni-forms-item label="起售数量" required name="suit">
<uni-easyinput @blur="priceFormat(item.skus,'suit')" :paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.skus.suit" type="digit" placeholder="请输入起售数量" />
</uni-forms-item>
<uni-forms-item label="库存数量" required>
<uni-easyinput @blur="priceFormat(item.skus,'stockNumber')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="item.skus.stockNumber" type="digit"
placeholder="请输入库存数量" />
</uni-forms-item>
<!-- <view class="u-relative">
<uni-forms-item label="库存数量" required>
<uni-easyinput :disabled="disabledStock"
@blur="priceFormat(item.skus,'stockNumber')" :paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.skus.stockNumber" type="digit" placeholder="请输入库存数量" />
</uni-forms-item>
<view class="u-absolute position-all" v-if="disabledStock"
@click="canEditGoodsStock(true)">
</view>
</view> -->
<uni-forms-item label="分销金额" required>
<uni-easyinput @blur="priceFormat(item.skus,'firstShared')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
@ -116,10 +113,11 @@
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.skus.barCode" placeholder="请输入商品条码" />
</uni-forms-item>
</view>
</view>
</uni-forms>
</view>
</uni-forms>
</view>
</view>
<view class="save-btn-box">
@ -132,20 +130,45 @@
</view>
</button>
</view>
</view>
</view>
<view class="bottom" ref="bottom"></view>
<pop-fast-edit @update="updateSkuKey" v-model:show="fastEdit.show"></pop-fast-edit>
<pop-fast-edit @update="updateSkuKey" v-model:show="fastEdit.show"></pop-fast-edit>
</view>
</template>
<script setup>
import myUploadFile from '@/components/my-components/my-upload-file'
import {
formatPrice
} from "@/commons/utils/format.js";
import popFastEdit from "./components/fast-edit.vue"
import infoBox from '@/commons/utils/infoBox.js'
import dayjs from "dayjs";
import go from '@/commons/utils/go.js';
import color from '@/commons/color.js';
import {
$defaultSku
} from '../goodsData.js'
import {
$productSpec
} from '@/http/yskApi/goods.js';
import {
onLoad,
onReady,
onShow
} from '@dcloudio/uni-app';
import {
onMounted,
reactive,
nextTick,
ref,
onBeforeMount,
watch
} from 'vue';
import {
hasPermission
} from '@/commons/utils/hasPermission.js';
const refFiles = ref([]);
//
function setRefFile(index) {
@ -156,33 +179,60 @@
}
};
}
const fastEdit=reactive({
show:false,
list:[
{text:'会员价',key:'memberPrice',value:''},
{text:'成本价',key:'costPrice',value:''},
{text:'原价',key:'originPrice',value:''},
{text:'起售数量',key:'suit',value:''},
{text:'库存数量',key:'stockNumber',value:''},
{text:'分销金额',key:'firstShared',value:''}
const fastEdit = reactive({
show: false,
list: [{
text: '会员价',
key: 'memberPrice',
value: ''
},
{
text: '成本价',
key: 'costPrice',
value: ''
},
{
text: '原价',
key: 'originPrice',
value: ''
},
{
text: '起售数量',
key: 'suit',
value: ''
},
{
text: '库存数量',
key: 'stockNumber',
value: ''
},
{
text: '分销金额',
key: 'firstShared',
value: ''
}
],
sel:''
sel: ''
})
function fastEditShow(){
fastEdit.show=true
function fastEditShow() {
fastEdit.show = true
}
//
let option={}
let option = {}
//number
function priceFormat(item, key) {
nextTick(() => {
const min = 0;
const max = 100000000;
let min = 0;
let max = 100000000;
console.log(item[key]);
if (key == 'suit') {
min = 1
}
const newval = formatPrice(item[key], min, max, true)
if (typeof newval !== 'number') {
item[key] = newval.value
@ -196,44 +246,24 @@
})
}
import dayjs from "dayjs";
import go from '@/commons/utils/go.js';
import color from '@/commons/color.js';
import {
$defaultSku
} from '../goodsData.js'
import {
$productSpec
} from '@/http/yskApi/goods.js';
import {
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
onMounted,
reactive,
nextTick,
ref,
onBeforeMount,
watch
} from 'vue';
function updateSkuKey(arr){
for(let i in FormData.result){
const sku=FormData.result[i].skus
for(let k in arr){
const item=arr[k]
if(sku.hasOwnProperty(item.key)){
sku[item.key]=item.value
function updateSkuKey(arr) {
for (let i in FormData.result) {
const sku = FormData.result[i].skus
for (let k in arr) {
const item = arr[k]
if (sku.hasOwnProperty(item.key)) {
sku[item.key] = item.value
}
}
}
}
const inputPaddingNone = ref(true)
const form = ref(null)
const originSpecMap={}
const originSpecMap = {}
const FormData = reactive({
specId: '',
specItem: '',
@ -241,11 +271,20 @@
selectSpec: [],
})
//
function changeResultCover(val,index) {
FormData.result[index].coverImg=val
function changeResultCover(val, index) {
FormData.result[index].coverImg = val
console.log(FormData.result[index]);
}
const formRefs = ref([]);
//
function setFormRef(index) {
formRefs.value[index] = null;
return (el) => {
if (el) {
formRefs.value[index] = el;
}
};
}
watch(() => FormData.specId, (newval) => {
FormData.result = []
})
@ -276,21 +315,21 @@
};
const defaultSku = reactive({
...$defaultSku,
shopId:uni.getStorageSync('shopId'),
coverImg:'',
productId:option.productId,
shopId: uni.getStorageSync('shopId'),
coverImg: '',
productId: option.productId,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
})
function returnDefaultSku(){
const randomNumber=Math.floor(Math.random()*1000)
function returnDefaultSku() {
const randomNumber = Math.floor(Math.random() * 1000)
return {
...defaultSku,
productId:option.productId,
productId: option.productId,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()-randomNumber}`
}
}
function createResult() {
let arr = []
for (let k of FormData.selectSpec) {
@ -305,20 +344,20 @@
FormData.result = spes.filter(v => {
return !Array.isArray(v)
}).map(v => {
const specSnap=returnSpecSnap(v)
const data= originSpecMap[specSnap]
const skus=returnDefaultSku()
const newdata={
const specSnap = returnSpecSnap(v)
const data = originSpecMap[specSnap]
const skus = returnDefaultSku()
const newdata = {
names: v,
specSnap,
skus
}
return data||newdata
return data || newdata
})
console.log(FormData.result);
}
function specIdChange(e) {
console.log(e);
@ -356,11 +395,44 @@
//
const rules = {
optionPrice: {
salePrice: {
rules: [{
required: true,
errorMessage: '必填'
}]
},
memberPrice: {
rules: [{
required: true,
errorMessage: '必填'
}]
},
costPrice: {
rules: [{
required: true,
errorMessage: '必填'
}]
},
originPrice: {
rules: [{
required: true,
errorMessage: '必填'
}]
},
suit: {
rules: [{
required: true,
errorMessage: '必填'
},
{
validateFunction: function(rule, value, data, callback) {
if (value < 1) {
callback('起售数量至少为1个')
}
return true
}
}
]
}
}
@ -388,27 +460,43 @@
uni.$emit(emitName, data)
}
}
//name
function returnSpecSnap(names){
const specSnap=Object.keys(names).reduce((prve,cur)=>{
return prve+names[cur]+','
},'')
return specSnap.substring(0,specSnap.length-1)
function returnSpecSnap(names) {
const specSnap = Object.keys(names).reduce((prve, cur) => {
return prve + names[cur] + ','
}, '')
return specSnap.substring(0, specSnap.length - 1)
}
//
let disabledStock = ref(false)
async function canEditGoodsStock(tips = false) {
console.log(tips);
if (option.type === 'edit') {
const res = await hasPermission({
text: '允许修改商品库存',
tips: tips
})
disabledStock.value = !res
}
}
onShow(() => {
canEditGoodsStock()
})
onLoad(opt => {
Object.assign(option, opt)
getTbProductSpec()
const obj = uni.getStorageSync('guige')
if (obj&&JSON.stringify(obj) !== '{}') {
if (obj && JSON.stringify(obj) !== '{}') {
console.log(obj.selectSpec);
option.productId=opt.productId
option.productId = opt.productId
Object.assign(FormData, obj)
for(let i of obj.result){
const key=returnSpecSnap(i.names)
originSpecMap[key]=i
for (let i of obj.result) {
const key = returnSpecSnap(i.names)
originSpecMap[key] = i
}
nextTick(() => {
FormData.result = obj.result
@ -433,12 +521,14 @@
function returnPromise(prosise) {
return new Promise((resolve, reject) => {
prosise.then(res => {
console.log(res);
resolve({
sucees: true
})
}).catch(err => {
console.log(err);
if(err.length>=1){
infoBox.showToast(err[0].errorMessage)
}
resolve({
sucees: false
})
@ -446,14 +536,21 @@
})
}
async function save() {
let isAllPassForm = 0
const res = await returnPromise(form.value.validate())
//
if (res.sucees) {
console.log('pass');
console.log(FormData);
emitspecificationsSave()
if (!FormData.result.length) {
return infoBox.showToast('请先选择规格!')
}
let isAllPassForm = 0
for (let i in FormData.result) {
const res = await returnPromise(formRefs.value[i].validate(), i)
isAllPassForm += res.sucees ? 1 : 0
}
if (isAllPassForm < FormData.result.length) {
return
}
//
console.log('pass');
console.log(FormData);
emitspecificationsSave()
}
</script>
@ -591,12 +688,14 @@
border-radius: 12rpx;
font-size: 28rpx;
}
.edit-btn{
.edit-btn {
background-color: #fff;
color: #333;
border-radius: 12rpx;
font-size: 28rpx;
}
.btn-hover-class {
opacity: .6;
}
@ -607,18 +706,21 @@
padding-left: 42rpx;
border-radius: 14rpx 14rpx 14rpx 14rpx;
}
.fast-edit{
.item{
.fast-edit {
.item {
color: #333;
border: 1px solid #bbb;
padding: 4rpx 10rpx 8rpx 10rpx;
border-radius: 10rpx;
min-width: 186rpx;
&.active{
&.active {
color: $my-main-color;
}
}
}
::v-deep .uni-input-placeholder {
font-size: 28rpx;
}

View File

@ -28,16 +28,17 @@ export const $types = [{
// 商品默认sku
export const $defaultSku = {
salePrice: 0,
memberPrice: 0,
costPrice: 0,
originPrice: 0,
stockNumber: 0,
firstShared: 0,
suit: 0,
salePrice: '',
memberPrice: '',
costPrice: '',
originPrice: '',
// stockNumber: '',
firstShared: '',
suit: 1,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`,
}
// 库存记录筛选类型
export const $invoicingType = [{
text: '全部',

View File

@ -8,47 +8,22 @@
</view>
</view>
<view class="u-m-t-48">
<view>商品名称</view>
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
<view class="u-m-t-38">
<template v-if="!isSku">
<view class="u-m-b-32">
<view class="u-flex u-row-between">
<view>{{data.name}}</view>
<view class="u-font-24">
<text>变动金额</text>
<text class="number">{{data.lowPrice-data._lowPrice}}</text>
</view>
</view>
<view class="u-m-t-16">
<up-input v-model="data.lowPrice">
<template #suffix>
<view></view>
</template>
</up-input>
</view>
</view>
<view class="u-m-b-32">
<view class="u-flex u-row-between">
<view>备注</view>
</view>
<view class="u-m-t-16">
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
</view>
</view>
</template>
<template v-else>
<scroll-view scroll-y="true" style="max-height: 50vh;">
<view class="u-m-b-32" v-for="(item,index) in data.skuList" :key="index">
<up-form labelPosition="left" :model="data" :rules="rules" ref="refForm">
<view>商品名称</view>
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
<view class="u-m-t-38">
<template v-if="!isSku">
<view class="u-m-b-32">
<view class="u-flex u-row-between">
<view>{{item.name}}</view>
<view>{{data.name}}</view>
<view class="u-font-24">
<text>变动金额</text>
<text class="number">{{item.lowPrice-item._lowPrice}}</text>
<text class="number">{{data.lowPrice*1-data._lowPrice*1}}</text>
</view>
</view>
<view class="u-m-t-16">
<up-input v-model="item.lowPrice">
<up-input v-model="data.lowPrice" type="number"
@change="priceFormat(data,'lowPrice',$event)">
<template #suffix>
<view></view>
</template>
@ -63,17 +38,46 @@
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
</view>
</view>
</scroll-view>
</template>
</template>
<template v-else>
<scroll-view scroll-y="true" style="max-height: 50vh;">
<view class="u-m-b-32" v-for="(item,index) in data.skuList" :key="index">
<view class="u-flex u-row-between">
<view>{{item.name}}</view>
<view class="u-font-24">
<text>变动金额</text>
<text class="number">{{item.lowPrice-item._lowPrice}}</text>
</view>
</view>
<view class="u-m-t-16">
<up-input @change="priceFormat(item,'lowPrice',$event)" v-model="item.lowPrice"
type="number">
<template #suffix>
<view></view>
</template>
</up-input>
</view>
</view>
<view class="u-m-b-32">
<view class="u-flex u-row-between">
<view>备注</view>
</view>
<view class="u-m-t-16">
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
</view>
</view>
</scroll-view>
</template>
<view class="u-m-t-60">
<my-button type="primary" shape="circle" @tap="save">
<view class="u-font-32">
保存
</view>
</my-button>
<view class="u-m-t-60">
<my-button type="primary" shape="circle" @tap="save">
<view class="u-font-32">
保存
</view>
</my-button>
</view>
</view>
</view>
</up-form>
</view>
</view>
</up-popup>
@ -84,13 +88,39 @@
computed,
reactive,
ref,
watch
watch,
nextTick
} from 'vue';
import {
returnSkuSnap,
returnTypeEnum,
returnCategory
} from '@/pageProduct/util.js'
import {
formatPrice
} from "@/commons/utils/format.js";
import {
TRUE
} from 'sass';
function priceFormat(item, key, val) {
let min = 0;
let max = 100000000;
const returnNewVal = formatPrice(val, min, max, true)
const newval = typeof returnNewVal !== 'number' ? returnNewVal.value : returnNewVal
if (typeof returnNewVal !== 'number') {
uni.showToast({
title: `请输入${min}${max}范围内的数字`,
icon: 'none'
})
}
setTimeout(() => {
item[key] = newval
}, 100)
}
const refForm = ref(null)
const props = defineProps({
show: {
type: Boolean,
@ -104,14 +134,30 @@
type: Object,
default: () => {
return {
lowPrice:0,
lowPrice: 0,
skuList: []
}
}
}
})
const data = ref(props.goods)
let data = ref(props.goods)
const rules = {
'lowPrice': [{
type: 'Number',
min: 0,
required: true,
message: '价格不能小于0',
trigger: ['blur', 'change']
},
{
validator: (rule, value, callback) => {
return true
},
message: ''
}
]
}
const emits = defineEmits(['update:show', 'save'])
const form = reactive({
note: ''
@ -120,11 +166,13 @@
watch(() => props.show, (newval) => {
popShow.value = newval
if (newval) {
data.value = props.goods
data.value = {
...props.goods
}
}
})
const isSku=computed(()=>{
return data.value.typeEnum=='多规格'
const isSku = computed(() => {
return data.value.typeEnum == '多规格'
})
watch(() => popShow.value, (newval) => {
emits('update:show', newval)
@ -137,11 +185,21 @@
function open() {
}
function save() {
emits('save', {
...data.value,
})
refForm.value.validate().then(valid => {
if (valid) {
emits('save', {
...data.value,
})
} else {
console.log(err);
}
}).catch(() => {
//
});
}
// function save() {

View File

@ -8,6 +8,7 @@
</view>
</view>
<view class="u-m-t-48">
<up-form labelPosition="left" :model="data" :rules="rules" ref="refForm" errorType="toast">
<view>商品名称</view>
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
<view class="u-m-t-38">
@ -21,11 +22,14 @@
</view>
</view>
<view class="u-m-t-16">
<up-input v-model="data.stockNumber">
<template #suffix>
<view>{{data.unitName||''}}</view>
</template>
</up-input>
<up-form-item prop="stockNumber">
<up-input v-model="data.stockNumber" type="number">
<template #suffix>
<view>{{data.unitName||''}}</view>
</template>
</up-input>
</up-form-item>
</view>
</view>
<view class="u-m-b-32">
@ -99,6 +103,7 @@
</view>
</view>
</up-form>
</view>
</view>
</up-popup>
@ -120,6 +125,7 @@
import {
$tbShopUnit,$getProductStockDetail
} from '@/http/yskApi/goods.js'
const refForm = ref(null)
const props = defineProps({
show: {
type: Boolean,
@ -136,7 +142,15 @@
}
}
})
const rules =reactive({
'stockNumber': [{
type: 'number',
required: true,
message: '请填写库存',
trigger: ['blur', 'change']
}
]
})
function toRecodes(){
}
function changeShowRecoders(show) {
@ -189,15 +203,24 @@
function close() {
popShow.value = false
form.note=''
}
function open() {
}
function save() {
emits('save', {
...data.value,
})
refForm.value.validate().then(valid => {
if (valid) {
emits('save', {
...data.value,
})
} else {
console.log(err);
}
}).catch(() => {
//
});
}
// function save() {
// const skuSnap = returnSkuSnap(data.value)

View File

@ -46,7 +46,7 @@
</view>
<view class="u-m-t-24">
<template v-if="data.skuList.length>=2">
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top">
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top" :style="skuStyle">
<view class="u-font-24 info-p-l u-m-t-6">规格</view>
<view class="skd" v-for="(item,index) in data.skuList" :key="index"
@click="guigeClick(index)">
@ -63,6 +63,18 @@
</view>
</view>
<template v-if="skuIsNotOne">
<view class="u-flex u-row-center">
<view class="u-flex u-flex-y-center" @click="toggleIsShowSkuAll" >
<view class="u-font-28 u-m-r-10 u-m-t-10 color-666">{{isShowSkuAll?'收起':'展开'}}</view>
<view class="u-flex u-flex-y-center">
<up-icon :size="14" name="arrow-down" v-if="!isShowSkuAll"></up-icon>
<up-icon :size="14" name="arrow-up" v-else></up-icon>
</view>
</view>
</view>
</template>
</template>
<template v-else>
<view style="height: 44rpx;">
@ -90,7 +102,7 @@
<my-switch disabled v-model="isPauseSale" :openDisabledClass="false" @click="isPauseSaleChange"></my-switch>
</view>
<view class="u-flex u-m-l-30">
<view class="u-m-r-18 color-999">{{data.isGrounding?'下架产品':'上架产品' }}</view>
<view class="u-m-r-18 color-999">上架产品</view>
<my-switch disabled v-model="isGrounding" :openDisabledClass="false" @click="isGroundingChange"></my-switch>
</view>
</view>
@ -109,6 +121,7 @@
<script setup>
import {
computed,
ref,
watch,
watchEffect
@ -145,8 +158,36 @@
default: false
}
})
let isShowSkuAll=ref(false)
const skuStyle=computed(()=>{
if(isShowSkuAll.value){
return ''
}else{
return 'height: 30px;overflow: hidden'
}
})
const skuIsNotOne=computed(()=>{
let isOne=true;
let width=0;
const fontSize=12;
const gap=5;
const boxWith=40;
const max=247;
for(let i in props.data.skuList){
const sku=props.data.skuList[i]
width+=(fontSize*sku.name.length+boxWith+gap)
if(width>max){
isOne=false
break;
}
}
return !isOne
})
function toggleIsShowSkuAll(){
isShowSkuAll.value=!isShowSkuAll.value
}
async function upDateGoods(par) {
const res = await $updateProductData([{

View File

@ -13,7 +13,9 @@
<up-icon name="arrow-down" size="16"></up-icon>
</view>
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
trim="all"
:placeholder="pageData.search.placeholder" v-model="pageData.query.name"
@clear="searchFunc"
@confirm="searchFunc">
<template #prefixIcon>
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
@ -52,7 +54,7 @@
<my-img-empty tips="未找到相关商品"></my-img-empty>
</template>
<template v-if="pageData.goodsList.length">
<my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size"
<my-pagination :page="pageData.query.page+1" :totalElements="pageData.totalElements" :size="pageData.query.size"
@change="pageChange"></my-pagination>
</template>
@ -286,6 +288,7 @@
})
}
const res = await $updateProductData(goodsArr)
infoBox.showToast('修改成功')
popup.price.show = false
getGoodsList()
}
@ -342,6 +345,7 @@
value: goods.stockNumber
}]
const res = await $updateProductData(goodsArr)
infoBox.showToast('修改成功')
popup.stock.show = false
getGoodsList()
}
@ -401,9 +405,17 @@
function watchEmitInit() {
uni.$off('update:productIndex')
uni.$off('del:productIndex')
uni.$on('update:productIndex', (data) => {
getGoodsList()
})
uni.$on('del:productIndex', (productId) => {
if(pageData.goodsList.length<=1){
pageData.query.page-=1
}
getGoodsList()
})
}
onShow(() => {
// getGoodsList()

View File

@ -137,6 +137,12 @@
onMounted(() => {})
function more() {
if(props.data.status=='closed'){
return uni.showToast({
icon:'none',
title:'桌台关闭中!'
})
}
emits('more')
}

View File

@ -94,6 +94,7 @@
onPullDownRefresh
} from '@dcloudio/uni-app';
import color from '@/commons/color';
import go from '@/commons/utils/go.js';
import myMask from '@/components/my-components/my-mask'
import addTable from './components/add-table'
import myActionSheet from '@/components/my-components/my-action-sheet';
@ -119,7 +120,16 @@
actionSheet.selTable = table
refMoreSheet.value.open()
}
function toPay(item) {
go.to('PAGES_ORDER_PAY', {
tableId: item.tableId,
tableName: item.name,
masterId: item.masterId,
orderId: item.orderId,
discount: 1,
userId:item.userId
})
}
async function actionSheetClick(index) {
console.log(index);
const item = actionSheet.selTable
@ -129,7 +139,7 @@
if (!item.orderId) {
return infoBox.showToast('该桌台暂无要结账的订单!')
}
return
return toPay(item)
}
if (index == 1) {
//
@ -151,16 +161,17 @@
})
}
if (index == 2) {
return
return infoBox.showToast('待开放,请敬请期待!')
}
if (index == 3) {
return
return infoBox.showToast('待开放,请敬请期待!')
}
if (index == 4) {
//
const res = await $fun.printOrder(actionSheet.selTable.tableId)
return
}
infoBox.showToast('待开放,请敬请期待!')
}

View File

@ -41,7 +41,7 @@
</view>
</view>
</view>
<view class="u-flex-1 u-text-center">
<!-- <view class="u-flex-1 u-text-center">
<view class="font-bold color-000 pr-16">0</view>
<view class="u-flex u-row-center">
<view class="color-999">优惠券</view>
@ -55,7 +55,7 @@
<view class="u-flex u-row-center">
<view class="color-999">已消费</view>
</view>
</view>
</view> -->
</view>

View File

@ -1,11 +1,11 @@
<template>
<view class="safe-page">
<view class="bg-fff u-p-l-30 u-p-r-30 ">
<!-- <view class="bg-fff u-p-l-30 u-p-r-30 ">
<view class="myTabs u-m-t-20">
<my-tabs :list="tabsList" @change="tabsChange"></my-tabs>
</view>
</view>
</view> -->
<!-- 用户列表 -->
<template v-if="tabsCurrent===0">

View File

@ -1025,22 +1025,7 @@
"style": {
"navigationBarTitleText": "添加临时菜"
}
},
{
"pageId": "PAGES_CRESATE_ORDER_DETAIL",
"path": "order-detail/order-detail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"pageId": "PAGES_CRESATE_ORDER_PAY",
"path": "pay-order/pay-order",
"style": {
"navigationBarTitleText": "结账"
}
}
]
},
{

View File

@ -120,11 +120,11 @@
icon: '/static/indexImg/icon-line-up.svg',
pageUrl: 'PAGES_LINE_UP'
},
{
title: '成员管理',
icon: '/static/indexImg/icon-staff.svg',
pageUrl: 'PAGES_USER'
},
// {
// title: '',
// icon: '/static/indexImg/icon-staff.svg',
// pageUrl: 'PAGES_USER'
// },
{
title: '设置中心',
icon: '/static/indexImg/icon-cashier.svg',
@ -221,7 +221,11 @@
{
title: '退出登录',
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg',
pageUrl: 'PAGES_LOGIN'
pageUrl: 'PAGES_LOGIN',
clickFunc:()=>{
storageManage.cleanByLogout()
go.to('PAGES_LOGIN',{},'redirect')
}
}
];

View File

@ -145,7 +145,8 @@
import {
ref,
reactive,
onMounted
onMounted,
watch
} from 'vue';
import {
$loginByPwd,
@ -339,9 +340,15 @@
})
// #endif
}
watch(()=>accountType.sel,(newval)=>{
if(newval==1){
vdata.formData.merchantName=uni.getStorageSync('merchantName')||''
}else{
vdata.formData.username=''
}
})
//
async function loginFinishFunc(loginBizData) {
// token
storageManage.setLogin(loginBizData)
storageManage.token(loginBizData.token)

View File

@ -356,10 +356,11 @@ let showMap = () => {
switchChange('address')
},
fail: function(err) {
uni.showToast({
title:err,
icon:'error'
})
console.log(err);
// uni.showToast({
// title:err,
// icon:'error'
// })
}
})

View File

@ -85,7 +85,8 @@
const query = reactive({
page: 0,
name: '',
size: 300
size: 300,
isVip:1
})
const list = reactive([])
async function getUser() {

View File

@ -1,9 +1,9 @@
<template>
<view class="page-gray color-333 u-font-28">
<template v-if="true">
<view class="block">
<view class="block u-p-t-32 u-p-b-32">
<view>桌位号</view>
<view class="font-bold u-font-40 u-m-t-20">
<view class="font-bold u-font-32 u-m-t-16">
{{table.name||''}}
</view>
</view>
@ -122,7 +122,7 @@
</view>
<view class="block">
<view class="block u-m-b-0">
<view class="u-flex">
<view></view>
<view class="fen font-bold">{{goodsNumber}}</view>
@ -130,9 +130,9 @@
</view>
<view class="goods u-m-t-32">
<view class="item u-m-b-40" @click="changeGoodsSel(index)" v-for="(item,index) in goods.list"
<view class="item u-p-b-32" @click="changeGoodsSel(index)" v-for="(item,index) in goods.list"
:key="index">
<view class="u-flex u-row-between">
<view class="u-flex u-row-between ">
<view class="u-flex">
<image class="img" :src="item.coverImg" mode=""></image>
<view class="u-m-l-32">
@ -173,17 +173,17 @@
{{item.note}}
</view>
</template>
<scroll-view scroll-x="true" v-if="index==goods.sel">
<view class="u-m-t-32 u-flex no-wrap u-p-b-12">
<scroll-view class="u-m-t-32" scroll-x="true" v-if="index==goods.sel">
<view class=" u-flex no-wrap ">
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
<button class="tag" hover-class="hover-class" @tap="showModel('discount')">单品打折</button>
</view> -->
<view class="u-flex u-m-r-20 u-m-b-20">
<view class="u-flex u-m-r-20 ">
<!-- <button class="tag" hover-class="hover-class" @tap="showModel('giveFood')">赠菜</button> -->
<button class="tag" hover-class="hover-class"
@tap="toggleGoodsItemKey(item,index,'isGift')">{{item.isGift?'取消赠送':'赠送'}}</button>
</view>
<view class="u-flex u-m-r-20 u-m-b-20">
<view class="u-flex u-m-r-20 " >
<button class="tag" hover-class="hover-class"
@tap="toggleGoodsItemKey(item,index,'isPack')">{{item.isPack?'取消打包':'打包'}}</button>
</view>
@ -191,28 +191,40 @@
<button class="tag" hover-class="hover-class"
@tap="toggleWait(item)">{{item.isWait?'取消等叫':'等叫'}}</button>
</view> -->
<view class="u-flex u-m-r-20 u-m-b-20">
<view class="u-flex u-m-r-20 ">
<button class="tag" hover-class="hover-class"
@tap="showModel('remark',index)">单品备注</button>
</view>
</view>
</scroll-view>
<view class="border-top u-m-t-48 " v-if="index==goods.sel"></view>
</view>
</view>
<view class="border-bottom">
<template v-if="$seatFee&&$seatFee.totalAmount">
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 ">
<view>
<text >桌位费</text>
</view>
<view>{{$seatFee.totalAmount||'0.00'}}</view>
</view>
</template>
<template v-if="$packFee>0">
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 ">
<view>
<text >打包费</text>
</view>
<view>{{$packFee||'0.00'}}</view>
</view>
</template>
</view>
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 border-bottom">
<view>
<text v-if="eatTypes.active=='takeout'">包装费</text>
<text v-else>桌位费</text>
</view>
<view>{{$seatFee.totalAmount||'0.00'}}</view>
</view>
<view class="u-flex u-row-right u-m-t-38">
<template v-if="$shop.registerType=='munchies'">
<!-- <template v-if="$shop.registerType=='munchies'">
<view class="color-main" @tap="showModel('editMoney')">修改</view>
</template>
</template> -->
<view class="u-flex price u-m-l-32">
<view class="">实收金额</view>
<view class="font-bold u-font-32">{{formatPrice(allPrice) }}</view>
@ -222,7 +234,7 @@
</view>
<view style="height: 300rpx;"></view>
<view :style="{height:bottomHeight+'px'}"></view>
<view class="safe-bottom fixed">
<!-- <view class="u-m-b-48">
<label class="radio">
@ -232,7 +244,9 @@
<view class="btn ">
<my-button shape="circle" @click="createOrder">
{{$shop.registerType=='munchies'?'结算': '下单'}}
<view class="font-bold u-font-32">
{{$shop.registerType=='munchies'?'结算': '下单'}}
</view>
</my-button>
</view>
@ -250,6 +264,7 @@
<script setup>
import {
onLoad,
onReady,
onShow
} from '@dcloudio/uni-app'
import {
@ -259,6 +274,7 @@
computed,
watch
} from 'vue';
import {getSafeBottomHeight} from '@/commons/utils/safe-bottom.js'
import modelDiscount from './components/discount'
import giveFood from './components/give-food'
import oneRemark from './components/remark'
@ -346,9 +362,12 @@
productId,
skuId,
id,
number
number,
isPack,isGift
} = item
const par = {
isPack,
isGift,
masterId: option.masterId,
tableId: table.value.tableId,
productId,
@ -358,6 +377,9 @@
par[key] = !item[key]
const res = await Api.addCart(par)
goods.list[index][key] = returnBoolean(res[key])
if(key=='isPack'){
getCart()
}
}
//
function toggleWait(item) {
@ -378,7 +400,12 @@
],
active: 'dine-in'
})
const $packFee=computed(()=>{
return goods.list.reduce((prve,cur)=>{
return prve+cur.packFee
},0).toFixed(2)
})
function chooseUser() {
go.to('PAGES_CHOOSE_USER')
@ -453,11 +480,23 @@
totalNumber: 0,
totalAmount: 0,
})
const allPrice = computed(() => {
const goodsPrice = computed(() => {
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
const tPrice=cur.salePrice * cur.number
console.log(cur.isPack);
const tpackFee=cur.isPack? cur.packFee*1:0
return prve +(cur.isGift?0:tPrice) +tpackFee
}, 0)
return (goodsTotalPrice + $seatFee.totalAmount || 0).toFixed(2)
return (goodsTotalPrice|| 0).toFixed(2)
})
const allPrice = computed(() => {
console.log(goodsPrice.value);
const n=goodsPrice.value*1 + $seatFee.totalAmount
return n.toFixed(2)
// const goodsTotalPrice = goods.list.reduce((prve, cur) => {
// return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
// }, 0)
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
})
function setGoodsItem(key, val) {
@ -488,6 +527,8 @@
if (seatFee && seatFee.totalNumber) {
userNumbers.defaultCateIndex = seatFee.totalNumber-1 || 0
Object.assign($seatFee, seatFee)
}else{
$seatFee.totalAmount=0
}
console.log(goods.list);
@ -523,6 +564,7 @@
}
// updateChoseCount()
const res = await Api.$createOrder(par)
uni.$emit('update:createOrderIndex')
console.log($shop.value);
console.log(res);
if ($shop.value.registerType == 'munchies') {
@ -534,11 +576,14 @@
)
} else {
//
if (option.isCreateOrderToDetail) {
console.log(option.isCreateOrderToDetail);
if (option.isCreateOrderToDetail!='0') {
console.log('PAGES_ORDER_DETAIL');
go.to('PAGES_ORDER_DETAIL', {
id: res.id
},'redirect')
} else {
console.log('back');
uni.navigateBack({
delta: 2
})
@ -584,9 +629,8 @@
}
onLoad((opt) => {
console.log('opt');
console.log(opt);
Object.assign(option, opt)
console.log(option,);
if (opt) {
table.value = {
tableId: opt.tableId,
@ -597,6 +641,13 @@
// updateChoseCount()
})
let bottomHeight=ref(100)
onReady(()=>{
getSafeBottomHeight('safe-bottom').then(res=>{
console.log(res);
bottomHeight.value=res
})
})
async function changeUseType() {
const {
@ -621,6 +672,7 @@
tableId,
cartIds: goods.list.map((v) => v.id),
})
getCart()
return res
}
watch(() => eatTypes.active, (newval) => {
@ -641,7 +693,7 @@
}
.page-gray {
padding: 32rpx 28rpx;
padding: 32rpx 28rpx 0 28rpx;
}
.headeimg {
@ -656,7 +708,6 @@
border-radius: 18rpx;
margin-bottom: 32rpx;
}
.textarea {
border-radius: 12rpx 12rpx 12rpx 12rpx;
padding: 32rpx 0 32rpx 24rpx;

View File

@ -55,7 +55,9 @@
<view></view>
<view>{{allPrice}}</view>
</view>
<my-button shape="circle" height="80" width="220" @tap="toConfimOrder">{{table.type=='add'?'确认加菜':'去下单'}} </my-button>
<my-button shape="circle" height="80" width="220" @tap="toConfimOrder">
<text class="u-font-32 font-bold">{{table.type=='add'?'确认加菜':'去下单'}} </text>
</my-button>
</view>
</template>
@ -126,7 +128,7 @@
const {tableId,name,maxCapacity,status,type}=props.table
go.to('PAGES_CONFIRM_ORDER',{
masterId:props.masterId,type,
tableId,name,maxCapacity,status,isCreateOrderToDetail:props.isCreateOrderToDetail
tableId,name,maxCapacity,status,isCreateOrderToDetail:props.isCreateOrderToDetail?1:0
})
}

View File

@ -58,7 +58,7 @@
}
},
index: {
type: Number,
type: [Number,String],
},
isSeatFee:{
//

View File

@ -8,8 +8,8 @@
</view>
<view class="u-flex u-m-t-20 u-flex-wrap">
<view class="item" @tap="chooseSkd(index,skd)"
:class="{active:item.sel===skd.name,disabled:skd.disabled}" v-for="(skd,skdIndex) in item.values"
:key="skdIndex">
:class="{active:item.sel===skd.name,disabled:skd.disabled}"
v-for="(skd,skdIndex) in item.values" :key="skdIndex">
{{skd.name}}
</view>
</view>
@ -19,7 +19,7 @@
<template #btn>
<view class="u-p-30 border-top ">
<view class="u-flex u-p-b-30 u-row-between">
<view class="price" >
<view class="price">
<template v-if="goods&&goods.isGrounding">
<text></text>
<text>{{to2(goods.salePrice*number) }}</text>
@ -40,7 +40,9 @@
</view>
</view>
<view class="u-m-t-10">
<my-button @tap="close" type="cancel" v-if="isAllDisabled||!goods.isGrounding"><view class="color-999">已下架/售罄</view></my-button>
<my-button @tap="close" type="cancel" v-if="isDisabled">
<view class="color-999">已下架/售罄</view>
</my-button>
<my-button @tap="confirm" v-else>添加</my-button>
</view>
</view>
@ -52,11 +54,18 @@
import {
computed,
reactive,
ref
ref,
watch
} from 'vue';
import util from '../util.js';
import infobox from '@/commons/utils/infoBox.js'
import myModel from '@/components/my-components/my-model.vue'
import myButton from '@/components/my-components/my-button.vue'
const props = defineProps({
goodsData: {
type: Object,
default: () => {}
},
title: {
type: String,
default: ''
@ -80,49 +89,72 @@
}
}
})
function to2(number){
function to2(number) {
return Number(number).toFixed(2)
}
const selSku=computed(()=>{
return props.skus.reduce((prve,cur)=>{
const selSku = computed(() => {
return props.skus.reduce((prve, cur) => {
prve.push(cur.sel)
return prve
},[]).join()
}, []).join()
})
const goods=computed(()=>{
const goods = computed(() => {
return props.skuMap[selSku.value]
})
//使
const isAllDisabled=computed(()=>{
console.log(props.skus);
return props.skus.reduce((prve,cur)=>{
return prve&&cur.values.filter(v=>v.disabled).length===cur.values.length
},true)
watch(() => goods.value, (newval) => {
console.log(props.goodsData.isStock);
number.value = newval.suit || 1
})
const emits = defineEmits(['confirm','updateSku'])
const isCanBuy=computed(()=>{
if(!goods.value) {
return false
}
console.log(util.isCanBuy({
...goods.value,
isStock: props.goodsData.isStock
}));
return util.isCanBuy({
...goods.value,
isStock: props.goodsData.isStock
})
})
//使
const isAllDisabled = computed(() => {
console.log(props.skus);
return props.skus.reduce((prve, cur) => {
return prve && cur.values.filter(v => v.disabled).length === cur.values.length
}, true)
})
const emits = defineEmits(['confirm', 'updateSku'])
let number = ref(1)
function chooseSkd(skusIndex, skd) {
const {name,disabled}=skd
if(disabled){
const {
name,
disabled
} = skd
if (disabled) {
return
}
if(props.skus[skusIndex].sel!=name){
emits('updateSku',skusIndex,name)
if (props.skus[skusIndex].sel != name) {
emits('updateSku', skusIndex, name)
}
}
const defaultIndex=reactive(new Array(props.skus.length).fill(''))
for(let i in props.defaultIndex){
defaultIndex[i]=props.defaultIndex[i]
const defaultIndex = reactive(new Array(props.skus.length).fill(''))
for (let i in props.defaultIndex) {
defaultIndex[i] = props.defaultIndex[i]
}
const activeArr = defaultIndex
@ -137,33 +169,39 @@
function close() {
model.value.close()
}
const isDisabled=computed(()=>{
return isAllDisabled.value || !isCanBuy.value
})
function reduce() {
if(isDisabled()){
if (isDisabled.value) {
return
}
const suit = goods.value.suit || 1
const newval = number.value - 1
if (newval < suit) {
return infobox.showToast(suit + '个起售')
}
number.value = newval <= 1 ? 1 : newval
}
function add() {
if(isDisabled()){
if (isDisabled.value) {
return
}
const newval = number.value + 1
number.value = newval
}
function isDisabled(){
return isAllDisabled.value
}
function confirm() {
close()
if(isDisabled()){
if (isDisabled.value) {
return
}
emits('confirm',goods.value,number.value)
emits('confirm', goods.value, number.value)
}
defineExpose({
open,
@ -194,7 +232,8 @@
border-color: $my-main-color;
color: $my-main-color;
}
&.disabled{
&.disabled {
color: #ccc;
border-color: #eee;
}

View File

@ -2,17 +2,20 @@
<view class="u-wrap">
<view class="top bg-fff w-full">
<view class="u-flex u-row-between choose-user" @tap="chooseTable">
<view>
<view v-if="!data.table.tableId">选择桌台</view>
<view class="u-flex" v-else>
<view class="u-m-l-20">{{data.table.name}}</view>
<template v-if="option.type!='add'">
<view class="u-flex u-row-between choose-user" @tap="chooseTable">
<view>
<view v-if="!data.table.tableId">选择桌台</view>
<view class="u-flex" v-else>
<view class="u-m-l-20">{{data.table.name}}</view>
</view>
</view>
<view class="u-flex">
<uni-icons type="right" size="20" color="#999"></uni-icons>
</view>
</view>
<view class="u-flex">
<uni-icons type="right" size="20" color="#999"></uni-icons>
</view>
</view>
</template>
<!-- <view class="u-flex u-row-between choose-user" @tap="chooseUser">
<view>
<view v-if="!data.vipUser.id">选择用户</view>
@ -68,7 +71,7 @@
</view>
<view class="class-item" :id="'item' + index" v-for="(item , index) in data.tabbar"
:key="index">
<view class="item-title">
<view class="item-title" :class="{active:data.current == index}">
<text>{{item.name}}</text>
</view>
<view class="item-container">
@ -97,14 +100,17 @@
<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>
<goods-item :img="{width:'330rpx',height:'330rpx'}"
@chooseGuige="chooseGuige(goodsItem.goodsIndex,goodsItem.index)"
@add="searchGoodsUpdate(goodsItem,goodsIndex,true)"
@reduce="searchGoodsUpdate(goodsItem,goodsIndex,false)" :index="goodsItem.goodsIndex"
:data="goodsItem"></goods-item>
</view>
</view>
<my-img-empty v-if="!searchResult.length" tips="未搜索到相关商品"></my-img-empty>
</view>
</scroll-view>
</view>
@ -117,6 +123,7 @@
<!-- 选择规格 -->
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel"
:goodsData="selGoods"
:title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
:skus="guigeModelData.chooseGoods.skus"></guige-model>
<!-- 添加附加费 -->
@ -293,13 +300,14 @@
return Api.getGoodsLists(par)
}
//
function getCart(par = {
async function getCart(par = {
page: 0,
size: 300,
masterId: data.masterId,
tableId: data.table.tableId
}) {
return Api.getCart(par)
const res = await Api.getCart(par)
return res
}
//
function getMasterId() {
@ -374,8 +382,8 @@
await clearCart()
cars.length = 0
for (let i in data.tabbar) {
for (let k in data.tabbar[i].fgoods) {
data.tabbar[i].fgoods[k].chooseNumber = 0
for (let k in data.tabbar[i].foods) {
data.tabbar[i].foods[k].chooseNumber = 0
}
}
}
@ -392,6 +400,7 @@
}
}
let $originGoods = []
let $category = []
async function init() {
const shopInfo = await tbShopInfo()
$shop.value = shopInfo
@ -407,7 +416,7 @@
});
return [...prve, ...cur.childrenList];
}, []);
console.log(category);
$category = category
const goodsRes = await getGoods()
const goods = goodsRes.records.filter((v) => {
let isShow = true;
@ -416,7 +425,7 @@
}
return isShow;
});
$originGoods=goods
$originGoods = goods
if (!data.table.tableId) {
//
setTabBar(category, goods, [])
@ -462,14 +471,14 @@
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){
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
index: i,
goodsIndex: k
})
}
}
@ -484,6 +493,10 @@
}
function search() {
if(searchValue.value===''){
isSearch.value = false
return
}
isSearch.value = true
searchResult.value = returnSearchGoods()
console.log(searchResult.value);
@ -666,14 +679,17 @@
}
}
}
let selGoods=ref({})
function chooseGuige(foodsindex, index) {
if (!canAddGoods()) {
return infoBox.showToast('清先选择桌台',0.5).then(res=>{
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
chooseTable()
})
}
const $goods = data.tabbar[index].foods[foodsindex]
selGoods.value=$goods
guigeModelData.title = $goods.name
const specList = $goods.specList;
const tagSnap = JSON.parse($goods.skuResult.tagSnap)
@ -736,7 +752,9 @@
const cartId = goods.id
const tabbarIndex = data.tabbar.findIndex(v => v.id == categoryId)
const $goods = data.tabbar[tabbarIndex].foods.find(v => v.id == productId)
if (num === 0) {
const $sku = $goods.specList.find(v => v.id == skuId)
if (num === 0 || num < $sku.suit) {
//
await removeCartGoods({
cartId
@ -773,9 +791,18 @@
function canAddGoods() {
return data.table.tableId
}
async function goodsUpdate(foodsindex, index, isAdd) {
function searchGoodsUpdate(goodsItem,goodsIndex, isAdd) {
goodsUpdate(goodsItem.goodsIndex, goodsItem.index, isAdd,goodsIndex)
}
function setSearchGoods(index,chooseNumber){
if(index!==undefined){
searchResult.value[index].chooseNumber=chooseNumber
}
}
async function goodsUpdate(foodsindex, index, isAdd,searchGoodsIndex) {
if (!canAddGoods()) {
return infoBox.showToast('请先选择桌台',0.5).then(res=>{
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
chooseTable()
})
}
@ -787,16 +814,18 @@
});
const productId = $goods.id
const skuId = $goods.specList[0].id
const suit = $goods.specList[0].suit || 1
if (goodsInCarIndex !== -1) {
//
const carGoods = cars[goodsInCarIndex]
const cartId = carGoods.id
const step = isAdd ? 1 : -1
const num = carGoods.number * 1 + step
if (num === 0) {
if (num === 0 || num < suit) {
//
cars.splice(goodsInCarIndex, 1)
$goods.chooseNumber = 0
setSearchGoods(searchGoodsIndex,0)
return await removeCartGoods({
cartId
})
@ -811,9 +840,10 @@
})
carGoods.number = number
$goods.chooseNumber = number
setSearchGoods(searchGoodsIndex,number)
} else {
//
const num = 1
const num = suit
const cartGoods = await addCart({
num,
productId,
@ -974,14 +1004,27 @@
setUser()
})
}
watch(() => data.table.tableId, (newval) => {
console.log(newval);
init()
watch(() => data.table.tableId, (newval, oldval) => {
onSelTable()
})
async function onSelTable() {
const {
masterId
} = await getMasterId()
data.masterId = masterId
const cartRes = await getCart()
cars.length = 0
const cartArr = getNowCart(cartRes.records)
for (let i in cartArr) {
cars.push(cartArr[i])
}
setTabBar($category, $originGoods, cars)
}
onBeforeUnmount(() => {})
function watchUpdate() {
uni.$off('update:createOrderIndex')
uni.$off('get:table')
uni.$on('update:createOrderIndex', () => {
// data.table = {
// tableId: ""
@ -990,6 +1033,20 @@
console.log('update:createOrderIndex');
init()
})
uni.$on('get:table', () => {
console.log('get:table');
if (data.table.tableId) {
$table.get({
qrcode: data.table.tableId
}).then(res => {
if (res.content[0] && res.content[0].status != 'idle') {
data.table = {
tableId: ''
}
}
})
}
})
}
onShow(() => {
// watchChooseuser()
@ -997,12 +1054,19 @@
watchUpdate()
})
let isCreateOrderToDetail = ref(false)
let option = {
type: ''
}
onLoad((opt) => {
console.log(opt)
option = opt
Object.assign(data.table, opt)
if (opt.useType) {
uni.setStorageSync('useType', opt.useType)
}
uni.setNavigationBarTitle({
title: (opt && opt.type == 'add') ? '顾客加菜' : '代客下单'
})
if (JSON.stringify(opt) == '{}') {
isCreateOrderToDetail.value = true
}
@ -1100,7 +1164,7 @@
.u-tab-item-active {
position: relative;
color: #000;
color: $my-main-color;
font-size: 30rpx;
font-weight: 600;
background: #fff;
@ -1109,7 +1173,7 @@
.u-tab-item-active::before {
content: "";
position: absolute;
border-left: 4px solid $u-primary;
border-left: 4px solid $my-main-color;
left: 0;
top: 0;
bottom: 0;
@ -1143,7 +1207,10 @@
justify-content: center;
align-items: center;
}
::v-deep .uni-searchbar{
padding-top: 12px!important;
padding-bottom: 16px!important;
}
.right-box {
width: 572rpx;
// background-color: rgb(250, 250, 250);
@ -1166,8 +1233,10 @@
.item-title {
font-size: 26rpx;
color: $u-main-color;
font-weight: bold;
&.active{
color: $my-main-color;
}
}
.item-menu-name {

View File

@ -1,36 +0,0 @@
<template>
<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>
<my-button plain shape="circle" :width="160" :height="56">退菜</my-button>
</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>
</view>
</template>
<script setup>
const props = defineProps({
data: {
type: Object,
default: () => {}
},
table:{
type: Object,
default: () => {}
}
})
const statusMap={
unpaid:'未支付'
}
function returnStatus(status){
return statusMap[status]||''
}
</script>
<style lang="scss" scoped>
</style>

View File

@ -1,144 +0,0 @@
<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">
<text></text>
<text class="color-main font-bold"> {{goodsNumber}}</text>
<text>份菜品</text>
</view>
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
<view class="u-font-32"> {{ order.placeNum }}次下单
</view>
<view class="u-m-t-20 list">
<view class="item u-m-b-20" v-for="(item,index) in order.info" :key="index">
<view class="u-flex u-col-top">
<view>
<image class="img" :src="item.coverImg" mode=""></image>
</view>
<view class="u-p-l-30 u-flex-1">
<view class="u-flex u-row-between u-col-top">
<view class="u-flex">
<view class="tui" v-if="item.status=='return'">
已退
</view>
<view :class="{'line-th':item.status=='return'}">{{item.name}}</view>
</view>
<view class="u-text-right">
<view>{{item.salePrice}}</view>
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">{{item.salePrice}}</view>
<view class="u-m-t-10 u-font-24">X{{item.number}}</view>
</view>
</view>
</view>
</view>
<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>
</view>
</view>
</view>
<view class="bg-gray u-p-20 u-m-t-20">
<view>备注</view>
<view class="u-m-t-10"></view>
</view>
</view>
<view class="u-m-t-40">
<view class="u-flex u-row-between border-bottom u-p-b-20">
<view class="tag no-pay">
未支付
</view>
<view>
<text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text>
</view>
</view>
<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>
</view>
</view>
<view class="u-m-t-30">
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view>
</view>
</view>
</template>
<script setup>
import {
computed
} from 'vue';
import color from '@/commons/color.js'
const emits=defineEmits(['tuicai'])
function tuicai(item,index){
emits('tuicai',item,index)
}
const props = defineProps({
data: {
type: Array,
default: () => []
},
seatFee:{
type:[String,Number],
default:0
}
})
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.number
},0)
return prve + curTotal
}, 0).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 * 1;
}, 0);
return a + bTotal
}, 0)
return result
})
function printOrder(){
}
</script>
<style lang="scss" scoped>
.img {
width: 70rpx;
height: 70rpx;
}
.border-bottom {
border-color: rgb(240, 240, 240);
}
.line-th{
text-decoration: line-through;
}
.tag {
padding: 2rpx 8rpx;
border-radius: 8rpx;
&.no-pay {
background-color: rgb(170, 170, 170);
color: #fff;
}
}
.tui{
background-color: rgb(239, 239, 239);
border-radius: 4rpx;
margin-right: 6rpx;
color: #666;
padding: 0 4rpx;
font-size: 20rpx;
}
</style>

View File

@ -1,66 +0,0 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between">
<view>订单状态</view>
<view>{{returnStatus(data.status)}}</view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>订单类型</view>
<view>堂食</view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>桌位号</view>
<view>{{table.name}}</view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>就餐人数</view>
<view>{{seatFee.totalNumber}}</view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>支付方式</view>
<view></view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<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>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>订单编号</view>
<view>{{data.orderNo}}</view>
</view>
<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>
</template>
<script setup>
import orderEnum from '@/commons/orderEnum.js'
const props = defineProps({
data: {
type: Object,
default: () => {}
},
table:{
type: Object,
default: () => {}
},
seatFee:{
type: Object,
default: () => {totalNumber:0}
}
})
function returnStatus(status){
const item=orderEnum.status.find(v=>v.key==status)
return item?item.label:''
}
</script>
<style lang="scss" scoped>
</style>

View File

@ -1,26 +0,0 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<up-steps :dot="true" current="0" direction="column">
<up-steps-item title="2024-09-02 09:19" :itemStyle="itemStyle" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
</up-steps-item>
<up-steps-item title="2024-09-02 09:19" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
</up-steps-item>
</up-steps>
</view>
</template>
<script setup>
import {
reactive
} from 'vue';
import color from '@/commons/color.js'
const itemStyle = reactive({
color: 'rgb(255,0,0)'
})
</script>
<style>
</style>

View File

@ -1,100 +0,0 @@
<template>
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
<template #desc>
<view class="u-p-30 u-text-left">
<view>
{{data.name}}
</view>
<view class="u-flex u-m-t-32">
<up-number-box :buttonSize="44" :inputWidth="220" v-model="number"></up-number-box>
</view>
<view class="u-m-t-32">
<view class="u-font-24">
<text class="color-999">退菜理由</text>
<text class="color-red">*</text>
</view>
<view class="u-flex u-flex-wrap u-m-t-24">
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
<up-tag @click="changeTagSel(item)" :text="item.label" plain v-if="item.checked"> </up-tag>
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#999" :text="item.label" plain v-else> </up-tag>
</view>
</view>
<view class="u-m-t-24">
<up-input placeholder="备注"></up-input>
</view>
</view>
</view>
</template>
<template #btn>
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-30">
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
<view class="u-m-t-10">
<my-button @tap="toggleModelShow" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
</view>
</view>
</template>
</my-model>
</template>
<script setup>
import {
ref,
watch
} from 'vue';
const props = defineProps({
data: {
type: Object,
default: () => {}
},
show: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['update:show','confirm'])
let model = ref(null)
let modelShow = ref(props.show)
let number = ref(1)
const tags=ref([{label:"点错",checked:false},{label:"不想要了",checked:false} ,{label:"食材不足",checked:false} ,{label:"等待时间过长",checked:false}])
function changeTagSel(item){
item.checked=!item.checked
}
watch(() => props.show, (newval) => {
modelShow.value = newval
})
watch(() => modelShow.value, (newval) => {
emits('update:show', newval)
if (newval) {
open()
} else {
close()
}
})
function toggleModelShow(show){
modelShow.value=show?true:false
}
function onModelClose() {
modelShow.value = false
}
function onModelOpen() {
modelShow.value = true
}
function open() {
model.value.open()
}
function close() {
model.value.close()
}
function confirm(){
emits('confirm')
}
</script>
<style>
</style>

View File

@ -1,40 +0,0 @@
<template>
<view class="u-font-28 default-box-padding u-relative bg-fff border-r-12 u-overflow-hide">
<view class="change u-absolute my-bg-main color-fff left-top" >切换</view>
<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"></up-avatar>
<view class="color-666 u-m-l-30">未绑定手机号</view>
</view>
<view>
<my-button :height="60" plain shape="circle">他的订单</my-button>
</view>
</view>
<view class="u-flex u-m-t-20 u-row-between">
<view class="">
<view class="font-bold">0.00</view>
<view class="color-666 u-m-t-10">余额</view>
</view>
<view class="">
<view class="font-bold">0.00</view>
<view class="color-666 u-m-t-10">积分</view>
</view>
<view class="">
<view class="font-bold">0.00</view>
<view class="color-666 u-m-t-10">已消费</view>
</view>
</view>
</view>
</template>
<script>
</script>
<style lang="scss" scoped>
.change{
padding: 4rpx 16rpx;
border-radius: 0 0 16rpx 0;
z-index: 2;
}
</style>

View File

@ -1,156 +0,0 @@
<template>
<view class="min-page bg-gray u-font-28 u-p-30">
<user-vue></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">{{options.name}}</text>
</view>
<goods-list :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount"
@tuicai="onTuiCai"></goods-list>
<extra-vue :data="orderDetail.seatFee"></extra-vue>
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
<step-vue></step-vue>
<view style="height: 200rpx;"></view>
<view class="u-fixed bottom bg-fff ">
<view class="u-flex u-abso">
<view class="u-flex-1">
<my-button @tap="diancan" color="#fff" bgColor="rgb(57,53,52)" borderRadius="100rpx 0 0 100rpx"
shape="circle" plain type="primary">加菜</my-button>
</view>
<view class="u-flex-1">
<my-button @tap="toPay" borderRadius="0 100rpx 100rpx 0" shape="circle"
type="primary">结账</my-button>
</view>
</view>
</view>
<tuicai-vue @confirm="tuicaiConfirm" v-model:show="tuicai.show" :data="tuicai.selGoods"></tuicai-vue>
</view>
</template>
<script setup>
import * as Api from '@/http/yskApi/Instead.js'
import userVue from './components/user.vue';
import orderVue from './components/order.vue';
import goodsList from './components/list.vue';
import stepVue from './components/step.vue';
import extraVue from './components/extra.vue';
import tuicaiVue from './components/tuicai.vue';
import go from '@/commons/utils/go.js'
import {
onLoad,
onShow,
onHide
} from '@dcloudio/uni-app';
import {
reactive
} from 'vue';
import OrderDetail from './page.js'
const tuicai = reactive({
show: false,
selGoods: ''
})
function onTuiCai(goods, index) {
tuicai.show = true
tuicai.selGoods = goods
}
async function tuicaiConfirm() {
const res=await Api.$returnCart({
cartId: tuicai.selGoods.id,
tableId:options.tableId,
})
tuicai.selGoods.status='return'
tuicai.show = false
}
const uiPage = new OrderDetail()
setTimeout(() => {
uiPage.setVal('user', {
name: 1
})
}, 1500)
function diancan() {
go.to('PAGES_CREATE_ORDER', {
tableId: options.tableId,
tableName: options.name,
type: 'add'
})
}
function toPay() {
go.to('PAGES_CRESATE_ORDER_PAY', {
tableId: options.tableId,
tableName: options.name,
masterId: options.masterId,
orderId: orderDetail.info.id,
discount: 1
})
}
const orderDetail = reactive({
goodsList: [],
info: {},
seatFee: {
totalAmount: 0
}
})
const options = reactive({})
async function init() {
const {
masterId
} = await Api.$getMasterId(options)
console.log(masterId);
options.masterId = masterId
const {
records,
seatFee
} = await Api.getCart({
...options,
masterId
})
orderDetail.goodsList = records
orderDetail.seatFee = seatFee
const info = await Api.$createOrder({
masterId,
vipUserId: '',
tableId: options.tableId,
note: '',
postPay: true,
orderld: ''
})
orderDetail.info = info
}
function watchEmit() {
uni.$off('orderDetail:update')
uni.$once('orderDetail:update', (newval) => {
console.log(newval);
init()
})
}
onShow(() => {
watchEmit()
})
onLoad((opt) => {
Object.assign(options, opt)
console.log(options);
init()
})
</script>
<style lang="scss" scoped>
.bottom {
bottom: 0;
left: 0;
right: 0;
height: 68rpx;
.u-abso {
bottom: 84rpx;
left: 28rpx;
right: 28rpx;
}
}
</style>

View File

@ -1,23 +0,0 @@
import {
reactive, ref
} from 'vue';
function isSameType(a, b) {
return a instanceof b === true || b instanceof a === true;
}
class OrderDetail {
constructor(data) {
const user ={}
const table = {}
const goodsList =[]
const orderInfo = {}
this.data=reactive({
user,table,goodsList,orderInfo
})
Object.assign(this, data)
}
setVal(key,val){
this.data[key]=val
}
}
export default OrderDetail

View File

@ -1,288 +0,0 @@
<template>
<view class="bg-gray min-page u-p-30 u-font-28">
<view class="u-p-t-60 u-p-b-60 u-text-center">
<view class="u-font-32 ">
<text class="price-fuhao"></text>
<text class="font-bold price">{{order.amount}}</text>
</view>
<view class="u-m-t-10 color-999 old-price">
<text class=""></text>
<text class=" ">{{order.amount}}</text>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="showModel('editMoney',true)">修改</view>
</view>
</view>
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 u-m-t-30">
<view class="u-flex border-bottom-dashed u-row-between u-p-b-30">
<view>优惠券</view>
<view class="color-999 u-flex u-col-center">
<text>选择优惠券</text>
<view class="u-flex u-col-center">
<uni-icons type="right"></uni-icons>
</view>
</view>
</view>
</view>
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
<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)" 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>
<text class="u-m-l-10">{{item.payName}}</text>
</view>
<view class="u-flex color-999 u-font-24">
<!-- <view class="u-m-r-20">
<text>余额</text>
<text>0.00</text>
</view> -->
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
</my-radio>
</view>
</view>
</view>
</view>
<view class="u-m-t-60 u-p-b-30">
<my-button @click="payOrder">确认付款</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">
<image style="width: 300rpx;height: 300rpx;" src="@/static/logo.png" mode=""></image>
</view>
</view>
</template>
</view>
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 ">
</view>
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
</view>
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount>
</view>
</template>
<script setup>
import {
reactive,
onMounted,
watch,
ref
} from 'vue';
import {
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'
const pays = reactive({
list: ['扫码收款', '二维码收款'],
selIndex: 0,
payTypes: {
list: [],
selIndex: 0
}
})
let option = opt
onBackPress(()=>{
console.log('-------------------');
console.log('onBackPress');
})
const models = new Map();
function setModel(el) {
if (el && el.$attrs['name']) {
models.set(el.$attrs['name'], el);
}
}
function showModel(key) {
const model = models.get(key)
model && model.open()
}
let user = ref({})
async function getPayType() {
const payTypeList = await Api.$getPayType()
pays.payTypes.list = payTypeList
}
function changePayType(i) {
pays.payTypes.selIndex = i
}
//
function paySuccess() {
infoBox.showToast('支付成功')
setTimeout(() => {
// uni.$emit('orderDetail:update')
uni.$emit('update:createOrderIndex')
console.log('update:createOrderIndex');
uni.navigateBack({
delta: 1
})
}, 500)
}
async function payOrder(code) {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
console.log({
tableId: order.tableId,
masterId: order.masterId,
orderId: order.id || order.orderId,
payType,
vipUserId: order.userId,
discount: 1,
code: code
});
await Api.$payOrder({
tableId: order.tableId,
masterId: order.masterId,
orderId: order.id || order.orderId,
payType,
vipUserId: order.userId,
code: code
})
paySuccess()
}
onMounted(() => {
getPayType()
})
const order = reactive({
amount: 0
})
function saomaPay() {
const item = pays.payTypes.list[pays.payTypes.selIndex]
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
payOrder(res.result)
}
});
}
watch(() => pays.payTypes.selIndex, (newval) => {
const item = pays.payTypes.list[newval]
if (item.payType == "vipPay") {
return
}
if (item.payType == "deposit") {
//
return saomaPay('deposit')
}
if (item.payType == "scanCode") {
//
return saomaPay('scanCode')
}
})
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
})
}
})
</script>
<style lang="scss" scoped>
.box-shadow {
box-shadow: 0 0 5px #eee;
}
.icon {
width: 40rpx;
height: 40rpx;
}
.border-bottom-dashed {
border-bottom: 1px dashed #bbb;
}
.border-bottom {
border-color: rgb(240, 240, 240);
}
.list {
.item:last-child {
.border-bottom {
border-bottom: none;
}
}
}
.old-price {
text-decoration: line-through;
}
.price-fuhao {
font-size: 24px;
}
.price {
font-size: 32px;
}
$dotSize: 20rpx;
$position: calc($dotSize / (-2));
.card {
position: relative;
&::after,
&:before {
content: '';
display: block;
position: absolute;
background-color: #F9F9F9;
width: $dotSize;
height: $dotSize;
box-shadow: 0 0 5px #eee;
border-radius: 50%;
}
&.top {
&::after {
right: $position;
bottom: $position;
}
&:before {
left: $position;
bottom: $position;
}
}
&.bottom {
&::after {
right: $position;
top: $position;
}
&:before {
left: $position;
top: $position;
}
}
}
</style>

View File

@ -5,12 +5,32 @@ import {
export function getNowCart(records) {
const nowCart = records.find(v => v.placeNum == 0)
const Cart = nowCart ? nowCart.info : []
const result = Cart.map(item => {
return {
...item,
isPack: returnBoolean(item.isPack),
isGift: returnBoolean(item.isGift)
const goodsMap = {}
const arr = []
for (let i in Cart) {
const item=Cart[i]
const key = item.productId + '_' + item.skuId
if (goodsMap.hasOwnProperty(key)) {
const index = goodsMap[key]
arr[index].number = arr[index].number * 1 + item.number
arr[index].totalNumber = arr[index].totalNumber * 1 + item.totalNumber
arr[index].totalAmount = arr[index].totalAmount * 1 + item.totalAmount
arr[index].packFee = arr[index].packFee * 1 + item.packFee
} else {
arr.push({
...item,
isPack: returnBoolean(item.isPack),
isGift: returnBoolean(item.isGift)
})
goodsMap[key] = arr.length - 1;
}
})
return result
}
// const result = Cart.map(item => {
// return {
// ...item,
// isPack: returnBoolean(item.isPack),
// isGift: returnBoolean(item.isGift)
// }
// })
return arr
}

View File

@ -1,6 +1,6 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
<view class="u-font-32 color-999">
<view class="default-box-padding bg-fff border-r-24 u-m-t-32" v-if="data.length">
<view class="u-font-32 color-999 border-bottom u-p-b-24">
<text></text>
<text class="color-333 "> {{goodsNumber}}</text>
<text>份菜品</text>
@ -8,7 +8,7 @@
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
<view class="u-font-32"> {{ order.placeNum }}次下单
</view>
<view class="u-m-t-20 list">
<view class="u-m-t-24 list">
<view class="item u-m-b-20" v-for="(item,index) in order.info" :key="index">
<view class="u-flex u-col-top">
<view>
@ -30,12 +30,12 @@
<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 class="line-th color-666 ">{{item.salePrice||item.price}}</view>
</template>
<template v-else>
<view>{{item.salePrice||item.price}}</view>
</template>
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
<view class="u-m-t-10 color-999 u-font-24">X{{item.number||item.num}}</view>
</view>
</view>
</view>
@ -86,7 +86,7 @@
<view class="u-flex u-row-between u-m-t-32">
<view>退款金额</view>
<view class="color-999">
<text class="">{{orderInfo.originAmount}}</text>
<text class="">{{orderInfo.refundAmount}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32">
@ -192,12 +192,15 @@
.img {
width: 152rpx;
height: 152rpx;
border-radius: 6px;
}
.border-top {
border-color: #F6F6F6;
}
.border-r-24{
border-radius: 24rpx;
}
.border-bottom {
// border-color: rgb(240, 240, 240);
border-color: #F6F6F6;

View File

@ -12,7 +12,7 @@
<view>桌位号</view>
<view>{{table.name||data.tableName}}</view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view class="u-flex u-row-between u-m-t-20" v-if="seatFee.number">
<view>就餐人数</view>
<view>{{seatFee.number||''}}</view>
</view>
@ -26,7 +26,7 @@
</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>
<view><up-text v-if="data.createdAt" mode="date" format="yyyy-mm-dd hh:MM:ss" :text="data.createdAt"></up-text></view>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>订单编号</view>

View File

@ -3,7 +3,7 @@
<template #desc>
<view class="u-p-30 u-text-left">
<view>
{{data.name}}
{{data.productName}}
</view>
<view class="u-flex u-m-t-32">
<up-number-box :buttonSize="44" :inputWidth="220" v-model="number"></up-number-box>
@ -15,8 +15,8 @@
</view>
<view class="u-flex u-flex-wrap u-m-t-24">
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
<up-tag @click="changeTagSel(item)" :text="item.label" plain v-if="item.checked"> </up-tag>
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#999" :text="item.label" plain v-else> </up-tag>
<up-tag @click="changeTagSel(item)" :text="item.label" plain borderColor="#E6FOFF" color="#318AFE" v-if="item.checked"> </up-tag>
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#666" :text="item.label" plain v-else> </up-tag>
</view>
</view>
<view class="u-m-t-24">
@ -96,5 +96,8 @@
}
</script>
<style>
<style lang="scss" scoped>
::v-deep .u-border{
border-width: 1px!important;
}
</style>

View File

@ -25,18 +25,18 @@
</view>
</view>
</template>
<view class="u-flex u-m-t-20 u-row-between">
<view class="u-flex u-m-t-20 u-row-between u-font-28">
<view class="">
<view class="font-bold">{{user.amount}}</view>
<view class="color-666 u-m-t-10">余额</view>
<view class="font-bold ">{{user.amount}}</view>
<view class="color-666 u-m-t-10 u-font-24">余额</view>
</view>
<view class="">
<view class="font-bold">{{user.totalScore}}</view>
<view class="color-666 u-m-t-10">积分</view>
<view class="color-666 u-m-t-10 u-font-24">积分</view>
</view>
<view class="">
<view class="font-bold">0.00</view>
<view class="color-666 u-m-t-10">已消费</view>
<view class="color-666 u-m-t-10 u-font-24">已消费</view>
</view>
</view>
</view>

View File

@ -1,7 +1,7 @@
<template>
<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">
<view class="default-box-padding bg-fff border-r-12 u-m-t-32">
<text class="">桌位号</text>
<text class="">{{orderDetail.info.tableName}}</text>
</view>
@ -16,17 +16,24 @@
<view style="height: 200rpx;"></view>
<view class="u-fixed bottom bg-fff ">
<view class="u-flex u-abso">
<template v-if="orderDetail.info.status=='unpaid'">
<template v-if="orderDetail.info.useType=='takeout'">
<view class="u-flex-1">
<my-button @tap="diancan" color="#fff" bgColor="rgb(57,53,52)" borderRadius="100rpx 0 0 100rpx"
shape="circle" plain type="primary">加菜</my-button>
</view>
<view class="u-flex-1">
<my-button @tap="toPay" borderRadius="0 100rpx 100rpx 0" shape="circle"
<my-button @tap="toPay" borderRadius="100rpx" shape="circle"
type="primary">结账</my-button>
</view>
</template>
<template v-else>
<template v-if="orderDetail.info.status=='unpaid'">
<view class="u-flex-1">
<my-button @tap="diancan" color="#fff" bgColor="rgb(57,53,52)" borderRadius="100rpx 0 0 100rpx" fontWeight="700" fontSize="32"
shape="circle" plain type="primary">加菜</my-button>
</view>
<view class="u-flex-1">
<my-button @tap="toPay" borderRadius="0 100rpx 100rpx 0" shape="circle" fontWeight="700" fontSize="32"
type="primary">结账</my-button>
</view>
</template>
</template>
</view>
</view>

View File

@ -10,7 +10,7 @@
</view>
<view class="u-m-t-2 bg-fff u-col-center u-flex u-p-l-28 u-p-r-28 u-p-t-30 u-row-between">
<view class="status-item " @click="changeStatusSel(index)" :class="{active:statusData.sel==index}"
<view class="status-item " @click="changeStatusSel(item.value)" :class="{active:statusData.sel==item.value}"
v-for="(item,index) in statusData.list" :key="index">
{{item.label}}
</view>
@ -56,14 +56,14 @@
<view style="height: 20rpx;"></view>
<view class="u-p-30 all-list u-flex u-flex-wrap gap-20">
<view class="all-list-item" :class="{active:statusItemIndex==statusData.allListSel}"
@click="changeAllListSel(statusItemIndex)"
@click="changeAllListSel(statusItemIndex,statusItem)"
v-for="(statusItem,statusItemIndex) in statusData.allList" :key="statusItemIndex">
{{statusItem.label}}
</view>
</view>
<view class="u-flex u-p-t-30 u-p-b-30 u-p-l-20 u-p-r-20 gap-20">
<up-button @click="moreShowHide">取消</up-button>
<up-button type="primary" @click="moreShowHide">确定</up-button>
<up-button type="primary" @click="statusConfirm">确定</up-button>
</view>
</up-popup>
@ -80,7 +80,7 @@
watch
} from 'vue';
const emits = defineEmits(['update:time', 'update:status','clearUser'])
const emits = defineEmits(['update:time', 'update:status','clearUser','updateStatus'])
function userShowClose() {
userShow.value = false
@ -138,6 +138,7 @@
}
watch(() => timeData.sel, (newval) => {
const data = timeData.list[newval]
if (newval != -1) {
emits('update:time', [data.start, data.end])
@ -153,23 +154,27 @@
value: ''
},
{
label: '待完成',
value: ''
},
{
label: '待退款',
value: ''
},
{
label: '未支付',
label: '待支付',
value: 'unpaid'
},
// {
// label: '',
// value: ''
// },
{
label: '已完成',
value: 'closed'
},
// {
// label: '',
// value: 'unpaid'
// },
{
label: '已退款',
value: ''
value: 'refund'
}
],
sel: 0
sel: ''
})
function moreShowHide() {
@ -182,6 +187,7 @@
function changeStatusSel(i) {
statusData.sel = i
emits('updateStatus', i)
}
function datePickerConfirm(e) {
@ -189,8 +195,15 @@
emits('update:time', [e.start, e.end])
}
function changeAllListSel(i) {
function changeAllListSel(i,item) {
statusData.allListSel = i
console.log(i);
}
function statusConfirm(){
const status=statusData.allList[statusData.allListSel].key
statusData.sel=status
emits('updateStatus',status)
moreShowHide()
}
</script>

View File

@ -4,10 +4,12 @@
<view class="search bg-fff u-p-t-32 u-p-l-28 u-p-r-28 u-p-b-32">
<up-search v-bind="search" v-model="search.val"></up-search>
</view>
<filter-vue @clearUser="clearQueryUser" v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
<filter-vue @clearUser="clearQueryUser" @updateStatus="updateQuery('status',$event)" v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
</view>
<order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list>
<my-pagination @change="pageChange" :totalElements="order.data.total"></my-pagination>
<template v-if="order.data.list.length>0">
<my-pagination @change="pageChange" :totalElements="order.data.total"></my-pagination>
</template>
<view style="height: 100rpx;"></view>
</view>
</template>
@ -26,7 +28,7 @@
import {
reactive, ref, watch
} from 'vue';
import {getTodayTimestamps} from '@/commons/utils/dayjs-time.js';
const search = reactive({
val: '',
placeholder: '搜索单号/昵称/姓名/手机号码/商品名称',
@ -39,14 +41,15 @@
}
})
const today = getTodayTimestamps();
const order=new LIST({
list: [],
query: {
createdAt: [],
createdAt: [today.start,today.end],
id: "",
orderNo: "",
orderType: "0",
page: 0,
page: 1,
pageSize: 10,
payType: "",
productName: "",
@ -65,15 +68,21 @@
console.log(order.data.page);
init()
}
function updateQuery(key,e){
order.setQuery(key,e)
}
watch(()=>order.data.query.createdAt,(newval)=>{
init()
})
watch(()=>order.data.query.status,(newval)=>{
init()
})
watch(()=>order.data.query.userId,(newval)=>{
init()
})
async function init() {
console.log(order.data.query);
const {content,totalElements}=await Api.tbOrderInfoData(order.data.query)
const {content,totalElements}=await Api.tbOrderInfoData({...order.data.query,page:order.data.query.page-1})
uni.stopPullDownRefresh()
order.setVal('list',content)
console.log(order.data.list);

View File

@ -13,7 +13,7 @@
<view @click="showModel('editMoney',true)">修改</view>
</view>
</view>
<view class="content bg-fff box-shadow border-r-12">
<view class="content bg-fff border-r-12">
<view class=" u-p-t-30 u-p-l-26 u-p-r-26 card top u-m-t-30">
<view class="u-flex u-p-l-24 u-p-r-24 border-bottom-dashed u-row-between u-p-b-30">
<view>优惠券</view>
@ -126,7 +126,7 @@
let payFinish=ref(false)
onBackPress(() => {
console.log('onBackPress');
uni.$emit('update:createOrderIndex')
// uni.$emit('update:createOrderIndex')
// if (option.isNowPay&&!payFinish.value) {
// infoBox.showToast('')
// return true
@ -242,7 +242,7 @@
setTimeout(() => {
// uni.$emit('orderDetail:update')
payFinish.value=true
uni.$emit('update:createOrderIndex')
uni.$emit('get:table')
uni.navigateBack({
delta: 1
})

View File

@ -387,6 +387,7 @@ class SchemaValidator extends RuleValidator {
}
async validateUpdate(data, allData) {
console.log(allData);
let result = this._checkFieldInSchema(data)
if (!result) {
result = await this.invokeValidateUpdate(data, false, allData)