This commit is contained in:
魏啾
2024-10-17 09:43:02 +08:00
70 changed files with 1546 additions and 1530 deletions

View File

@@ -16,7 +16,7 @@
"type" : "uniCloud" "type" : "uniCloud"
}, },
{ {
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
} }
] ]

View File

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

View File

@@ -7,9 +7,10 @@
* @param {Boolean} returnIsArea - 是否返回值符合范围区间默认为false。 * @param {Boolean} returnIsArea - 是否返回值符合范围区间默认为false。
* @returns {number} - 返回格式化后的价格,如果超出范围则返回最小值或最大值。 * @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===''){ if(price === undefined || price === null||price===''){
return 0 return isRerturnNullString?'':0
} }
// 将价格转换为浮点数并保留两位小数 // 将价格转换为浮点数并保留两位小数
const newval = parseFloat((Math.floor(price * 100) / 100).toFixed(2)) 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 = { const model = {
setLogin(res){ setLogin(res){
const user=res.user.user
uni.setStorageSync('logoutHandle',false) uni.setStorageSync('logoutHandle',false)
uni.setStorageSync('shopId', res.shopId) uni.setStorageSync('shopId', res.shopId)
uni.setStorageSync('shopName',res.shopName) uni.setStorageSync('shopName',res.shopName)
uni.setStorageSync('logo',res.logo) uni.setStorageSync('logo',res.logo)
uni.setStorageSync('loginType',res.loginType) 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: () => { cleanByLogout: () => {
// 1. 清空app级别缓存。 // 1. 清空app级别缓存。
Object.keys(appCache).forEach(k => appCache[k] = null) Object.keys(appCache).forEach(k => appCache[k] = null)
const merchantName=uni.getStorageSync('merchantName')
let envName = model.env() // 获取到当前的环境变量 let envName = model.env() // 获取到当前的环境变量
uni.clearStorageSync() // 清除所有的缓存信息 uni.clearStorageSync() // 清除所有的缓存信息
uni.setStorageSync('merchantName',merchantName)
model.env(envName) // 重置env model.env(envName) // 重置env
}, },
// 获取和放置token // 获取和放置token

View File

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

View File

@@ -57,6 +57,10 @@ import { computed } from 'vue';
type:[String,Number], type:[String,Number],
default:'28' default:'28'
}, },
fontWeight:{
type:[String,Number],
default:'500'
},
showShadow:{ showShadow:{
type:Boolean, type:Boolean,
default:false default:false
@@ -92,6 +96,7 @@ import { computed } from 'vue';
${props.width>=0?('width:'+props.width+'rpx;'):''} ${props.width>=0?('width:'+props.width+'rpx;'):''}
${props.plain?('background-color:transparent;'):''} ${props.plain?('background-color:transparent;'):''}
font-size:${props.fontSize}rpx; font-size:${props.fontSize}rpx;
font-weight:${props.fontWeight};
${props.color?('color:'+props.color+';'):''} ${props.color?('color:'+props.color+';'):''}
${props.bgColor?('background-color:'+props.bgColor+';'):''} ${props.bgColor?('background-color:'+props.bgColor+';'):''}
${props.bgColor?('border-color:'+props.bgColor+';'):''} ${props.bgColor?('border-color:'+props.bgColor+';'):''}
@@ -105,7 +110,8 @@ import { computed } from 'vue';
margin: auto; margin: auto;
} }
.shadow{ .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 { .btn {
font-size: 28rpx; font-size: 28rpx;

View File

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

View File

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

View File

@@ -179,16 +179,16 @@ export function gettbConsInfoFlow(params) {
/** /**
* 分组查询获取耗材流水信息 * 分组查询获取耗材流水信息
*/ */
export function viewConInfoFlow(data) { // export function viewConInfoFlow(data) {
return request({ // return request({
url: "/api/viewConInfoFlow", // url: "/api/viewConInfoFlow",
method: "get", // method: "get",
params: { // params: {
shopId: uni.getStorageSync("shopId"), // shopId: uni.getStorageSync("shopId"),
...data // ...data
} // }
}); // });
} // }
/** /**
* 查询耗材单位列表 * 查询耗材单位列表

View File

@@ -259,7 +259,7 @@ export function tbPlussShopStaff(data) {
// 耗材列表 // 耗材列表
export function viewConInfoFlowget(data) { export function viewConInfoFlowget(data) {
return request({ return request({
url: `/api/viewConInfoFlow/get`, url: `/api/tbConsInfo/allAndPro`,
method: 'post', method: 'post',
data data
}); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,8 +7,8 @@
<view class="block"> <view class="block">
<view class=""> <view class="">
<uni-forms-item label="分类名称" required name="name"> <uni-forms-item label="分类名称" required name="name">
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder" <uni-easyinput paddingNone :placeholderStyle="placeholderStyle"
v-model="category.name" placeholder="输入分类名称" /> :inputBorder="inputBorder" v-model="category.name" placeholder="输入分类名称" />
</uni-forms-item> </uni-forms-item>
</view> </view>
<template v-if="option.type=='edit'"> <template v-if="option.type=='edit'">
@@ -17,7 +17,7 @@
v-model="category.sort" type="number" placeholder="排序越小越靠前" /> v-model="category.sort" type="number" placeholder="排序越小越靠前" />
</uni-forms-item> </uni-forms-item>
</template> </template>
<uni-forms-item label=""> <uni-forms-item label="">
<view class="u-flex u-row-between u-col-center"> <view class="u-flex u-row-between u-col-center">
<view class="label-title">分组状态</view> <view class="label-title">分组状态</view>
@@ -26,6 +26,35 @@
</view> </view>
</view> </view>
</uni-forms-item> </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> </view>
</uni-forms> </uni-forms>
</view> </view>
@@ -36,6 +65,9 @@
</view> </view>
</view> </view>
<view class="bottom" ref="bottom"></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> </view>
</template> </template>
@@ -90,6 +122,7 @@
} }
// 表单样式 // 表单样式
const placeholderStyle = ref('font-size:28rpx;') 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) { function toTimer(timer, index) {
console.log(timer); console.log(timer);
@@ -184,6 +242,8 @@
productIds: [], productIds: [],
saleTime: [], saleTime: [],
useTime: 0, useTime: 0,
saleEndTime:'',
saleStartTime:'',
shopId: uni.getStorageSync('shopId') shopId: uni.getStorageSync('shopId')
} }
const categoryChild = ref({ const categoryChild = ref({
@@ -549,6 +609,13 @@
background: #F9F9F9; background: #F9F9F9;
} }
.timesel {
border: 1px solid #eee;
border-radius: 10rpx;
padding: 10rpx 20rpx;
flex: 1;
}
.option-item { .option-item {
margin-bottom: 34rpx; margin-bottom: 34rpx;
} }

View File

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

View File

@@ -1,6 +1,7 @@
<template> <template>
<view class="page-gray color-333 u-font-28"> <view class="page-gray color-333 u-font-28">
<view class="block"> <view class="block">
<!-- <up-popup :show="show" @close="close" @open="open"> -->
<picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType" <picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
:list="brandt.list"></picker-item> :list="brandt.list"></picker-item>
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType" <picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
@@ -113,42 +114,42 @@
<view class="u-m-t-16"> <view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')"> <radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')">
<label class="radio u-m-r-60"> <label class="radio u-m-r-60">
<radio value="normal" :checked="form.printMethod == '1'" class="scale7" /> <radio value="all" :checked="form.printMethod == '1'" class="scale7" />
<text>普通出菜</text> <text>打印全部</text>
</label> </label>
<label class="radio u-m-r-60"> <label class="radio u-m-r-60">
<radio value="one" :checked="form.printMethod == '2'" class="scale7" /> <radio value="one" :checked="form.printMethod == '2'" class="scale7" />
<text>一菜一品</text> <text>仅打印制作单[厨房]</text>
</label> </label>
<label class="radio u-m-r-60"> <label class="radio u-m-r-60">
<radio value="callTicket" :checked="form.printMethod == '2'" class="scale7" /> <radio value="normal" :checked="form.printMethod == '2'" class="scale7" />
<text>排队取号</text> <text>仅打印结账单[前台]</text>
</label> </label>
</radio-group> </radio-group>
</view> </view>
</view> </view>
<!-- <view class="u-p-b-24 u-m-b-24 border-bottom"> <view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">打印类型</view> <view class="title">打印类型</view>
<view class="u-m-t-16" style="display: flex;"> <view class="u-m-t-16" style="display: flex;">
<up-checkbox-group v-model="form.printType"> <up-checkbox-group v-model="form.printType">
<up-checkbox :customStyle="{marginBottom: '8px'}" label="确认退款单" name="1" <up-checkbox :customStyle="{marginBottom: '8px'}" label="确认退款单" name="refund"
style="margin-right: 40rpx;font-size: 28rpx;"> style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox> </up-checkbox>
<up-checkbox :customStyle="{marginBottom: '8px'}" label="交班单" name="2" <up-checkbox :customStyle="{marginBottom: '8px'}" label="交班单" name="handover"
style="margin-right: 40rpx;font-size: 28rpx;"> style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox> </up-checkbox>
<up-checkbox :customStyle="{marginBottom: '8px'}" label="排队取号" name="3" <up-checkbox :customStyle="{marginBottom: '8px'}" label="排队取号" name="queue"
style="margin-right: 40rpx;font-size: 28rpx;"> style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox> </up-checkbox>
</up-checkbox-group> </up-checkbox-group>
</view> </view>
</view> --> </view>
<view class="u-p-b-24 u-m-b-24 border-bottom"> <!-- <view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">打印单据</view> <view class="title">打印单据</view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printReceipt')"> <radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printReceipt')">
@@ -165,7 +166,7 @@
</label> </label>
</radio-group> </radio-group>
</view> </view>
</view> </view> -->
<view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom"> <view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom">
<view class="title">打印机状态</view> <view class="title">打印机状态</view>
@@ -215,11 +216,9 @@
} from '@/pagePrinter/devices.js' } from '@/pagePrinter/devices.js'
import { import {
onLoad, onLoad,
onShow
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import { import {
ref, ref,
onBeforeUnmount,
reactive, reactive,
computed, computed,
watch, watch,
@@ -294,14 +293,11 @@
}) })
} }
}) })
partList.value = arr partList.value = arr
} }
function sizeChange(e, name) { function sizeChange(e, name) {
form[name] = e.detail.value form[name] = e.detail.value
} }
//打印份数 //打印份数
const printerNums = reactive({ const printerNums = reactive({
list: new Array(4).fill(1).map((v, index) => { list: new Array(4).fill(1).map((v, index) => {
@@ -316,7 +312,6 @@
const feets = ref([0, 1, 2, 3, 4, 5, 8].map(v => { const feets = ref([0, 1, 2, 3, 4, 5, 8].map(v => {
return v + '行' return v + '行'
})) }))
let form = reactive({ let form = reactive({
sort: "0", sort: "0",
status: 0, status: 0,
@@ -348,13 +343,11 @@
...form ...form
}) })
} }
go.to('/pagePrinter/index/index') go.to('/pagePrinter/index/index')
} }
// watch(() => form.config.model, (newval) => { // watch(() => form.config.model, (newval) => {
// console.log(newval); // console.log(newval);
// }) // })
// const option = reactive({}) // const option = reactive({})
async function getdetails() { async function getdetails() {
const res = await Api.printerd(userId.value) const res = await Api.printerd(userId.value)
@@ -365,6 +358,7 @@
}) })
res.selectcheckbox = arrs res.selectcheckbox = arrs
form = Object.assign(form, res) form = Object.assign(form, res)
form.printType = JSON.parse(form.printType)
} }
onLoad((options) => { onLoad((options) => {
if (options.id) { if (options.id) {
@@ -376,10 +370,6 @@
} }
// Object.assign(option, opt) // Object.assign(option, opt)
}) })
onBeforeUnmount(() => {
})
onShow(() => {})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -1,6 +1,13 @@
<template> <template>
<view class="u-p-b-24 u-m-b-24 border-bottom"> <view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title font-bold"> <text v-if="required" style="color: red;">*</text>{{title}}</view> <view class="title font-bold"> <text v-if="required" style="color: red;">*</text>{{title}}</view>
<!-- <up-popup customStyle="overflow: hidden;" @change="change" :value="value" :range="list" range-key="name" round="20" mode="bottom">
<view class="u-m-t-16 u-flex u-row-between ">
<view class="color-333" v-if="selText">{{selText}}</view>
<view class="color-999" v-else>请选择</view>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</up-popup> -->
<picker @change="change" range-key="name" :value="value" :range="list"> <picker @change="change" range-key="name" :value="value" :range="list">
<view class="u-m-t-16 u-flex u-row-between "> <view class="u-m-t-16 u-flex u-row-between ">
<view class="color-333" v-if="selText">{{selText}}</view> <view class="color-333" v-if="selText">{{selText}}</view>
@@ -29,15 +36,19 @@
modelValue: { modelValue: {
type: String, type: String,
}, },
required:{ required: {
type:Boolean type: Boolean
} }
}) })
const index = ref(props.modelValue) const index = ref(props.modelValue)
const emits = defineEmits(['update:modelValue'], ) const emits = defineEmits(['update:modelValue'], )
const selText = computed(() => { const selText = computed(() => {
const item = props.list.filter(ele => ele.value == props.modelValue)[0] const item = props.list.filter(ele => ele.value == props.modelValue)[0]
return item.name if (item) {
return item.name
} else {
return ''
}
}) })
watch(() => index.value, (newval) => { watch(() => index.value, (newval) => {

View File

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

View File

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

View File

@@ -1,8 +1,11 @@
<template> <template>
<view class="u-relative choose-haocai"> <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-input @blur="blur" @change="filterHaocaiList" border="none" v-model="text" placeholder="请选择"></up-input>
<up-icon :size="10" name="arrow-down-fill"></up-icon> <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>
<view class="u-absolute" v-if="popShow"> <view class="u-absolute" v-if="popShow">
<scroll-view scroll-y="true" class="scroll"> <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 class="default-box-padding bg-fff border-r-18 u-flex u-row-between u-m-t-32">
<view>当某个耗材的使用库存不足时商品自动 <view>当某个耗材的使用库存不足时商品自动
售罄</view> 售罄</view>
<view class="u-flex u-p-l-32"> <!-- <view class="u-flex u-p-l-32">
<up-switch :size="20"></up-switch> <up-switch :size="20"></up-switch>
</view> </view> -->
</view> </view>
<view class="bottom"> <view class="bottom">
<my-button type="primary" shape="circle" @click="save">保存</my-button> <my-button type="primary" shape="circle" @click="save">保存</my-button>

View File

@@ -39,7 +39,7 @@
</uni-forms-item> </uni-forms-item>
</view> </view>
<view class=" u-flex"> <view class=" u-flex" v-if="item.options.length>1">
<uni-forms-item :key="optionIndex" label-width="0" label="" <uni-forms-item :key="optionIndex" label-width="0" label=""
:showRequired="false"> :showRequired="false">
<view class="u-flex"> <view class="u-flex">
@@ -70,13 +70,15 @@
</view> </view>
</uni-forms-item> </uni-forms-item>
<template v-if="specifications.list.length>1">
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)"> <view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
<view class="icon icon-reduce u-m-r-22 "> <view class="icon icon-reduce u-m-r-22 ">
</view>
<view class="color-red">删除规格组</view>
</view> </view>
<view class="color-red">删除规格组</view> </template>
</view>
</view> </view>
</uni-forms> </uni-forms>
</view> </view>
@@ -192,6 +194,9 @@
} }
//删除规格组 //删除规格组
function delSpecificationsGroup(index) { function delSpecificationsGroup(index) {
if(specifications.list.length<=1){
return
}
specifications.list.splice(index, 1) specifications.list.splice(index, 1)
} }
// 向指定索引的规格组添加规格项 // 向指定索引的规格组添加规格项
@@ -200,6 +205,9 @@
} }
// 删除指定索引的规格组添加规格项 // 删除指定索引的规格组添加规格项
function delOption(index, optionIndex) { function delOption(index, optionIndex) {
if(specifications.list[index].options.length<=1){
return
}
specifications.list[index].options.splice(optionIndex, 1) specifications.list[index].options.splice(optionIndex, 1)
} }
//页面滚动到最底部 //页面滚动到最底部

View File

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

View File

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

View File

@@ -8,47 +8,22 @@
</view> </view>
</view> </view>
<view class="u-m-t-48"> <view class="u-m-t-48">
<view>商品名称</view> <up-form labelPosition="left" :model="data" :rules="rules" ref="refForm">
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view> <view>商品名称</view>
<view class="u-m-t-38"> <view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
<template v-if="!isSku"> <view class="u-m-t-38">
<view class="u-m-b-32"> <template v-if="!isSku">
<view class="u-flex u-row-between"> <view class="u-m-b-32">
<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">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view>{{item.name}}</view> <view>{{data.name}}</view>
<view class="u-font-24"> <view class="u-font-24">
<text>变动金额</text> <text>变动金额</text>
<text class="number">{{item.lowPrice-item._lowPrice}}</text> <text class="number">{{data.lowPrice*1-data._lowPrice*1}}</text>
</view> </view>
</view> </view>
<view class="u-m-t-16"> <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> <template #suffix>
<view></view> <view></view>
</template> </template>
@@ -63,17 +38,46 @@
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea> <up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
</view> </view>
</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"> <view class="u-m-t-60">
<my-button type="primary" shape="circle" @tap="save"> <my-button type="primary" shape="circle" @tap="save">
<view class="u-font-32"> <view class="u-font-32">
保存 保存
</view> </view>
</my-button> </my-button>
</view>
</view> </view>
</view> </up-form>
</view> </view>
</view> </view>
</up-popup> </up-popup>
@@ -84,13 +88,39 @@
computed, computed,
reactive, reactive,
ref, ref,
watch watch,
nextTick
} from 'vue'; } from 'vue';
import { import {
returnSkuSnap, returnSkuSnap,
returnTypeEnum, returnTypeEnum,
returnCategory returnCategory
} from '@/pageProduct/util.js' } 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({ const props = defineProps({
show: { show: {
type: Boolean, type: Boolean,
@@ -104,14 +134,30 @@
type: Object, type: Object,
default: () => { default: () => {
return { return {
lowPrice:0, lowPrice: 0,
skuList: [] 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 emits = defineEmits(['update:show', 'save'])
const form = reactive({ const form = reactive({
note: '' note: ''
@@ -120,11 +166,13 @@
watch(() => props.show, (newval) => { watch(() => props.show, (newval) => {
popShow.value = newval popShow.value = newval
if (newval) { if (newval) {
data.value = props.goods data.value = {
...props.goods
}
} }
}) })
const isSku=computed(()=>{ const isSku = computed(() => {
return data.value.typeEnum=='多规格' return data.value.typeEnum == '多规格'
}) })
watch(() => popShow.value, (newval) => { watch(() => popShow.value, (newval) => {
emits('update:show', newval) emits('update:show', newval)
@@ -137,11 +185,21 @@
function open() { function open() {
} }
function save() { function save() {
emits('save', { refForm.value.validate().then(valid => {
...data.value, if (valid) {
}) emits('save', {
...data.value,
})
} else {
console.log(err);
}
}).catch(() => {
// 处理验证错误
});
} }
// function save() { // function save() {

View File

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

View File

@@ -46,7 +46,7 @@
</view> </view>
<view class="u-m-t-24"> <view class="u-m-t-24">
<template v-if="data.skuList.length>=2"> <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="u-font-24 info-p-l u-m-t-6">规格</view>
<view class="skd" v-for="(item,index) in data.skuList" :key="index" <view class="skd" v-for="(item,index) in data.skuList" :key="index"
@click="guigeClick(index)"> @click="guigeClick(index)">
@@ -63,6 +63,18 @@
</view> </view>
</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>
<template v-else> <template v-else>
<view style="height: 44rpx;"> <view style="height: 44rpx;">
@@ -90,7 +102,7 @@
<my-switch disabled v-model="isPauseSale" :openDisabledClass="false" @click="isPauseSaleChange"></my-switch> <my-switch disabled v-model="isPauseSale" :openDisabledClass="false" @click="isPauseSaleChange"></my-switch>
</view> </view>
<view class="u-flex u-m-l-30"> <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> <my-switch disabled v-model="isGrounding" :openDisabledClass="false" @click="isGroundingChange"></my-switch>
</view> </view>
</view> </view>
@@ -109,6 +121,7 @@
<script setup> <script setup>
import { import {
computed,
ref, ref,
watch, watch,
watchEffect watchEffect
@@ -145,8 +158,36 @@
default: false 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) { async function upDateGoods(par) {
const res = await $updateProductData([{ const res = await $updateProductData([{

View File

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

View File

@@ -232,12 +232,13 @@
justify-content: space-around; justify-content: space-around;
background-color: #fff; background-color: #fff;
padding-bottom: 20rpx; padding-bottom: 20rpx;
padding-top: 16rpx;
.timelistbox { .timelistbox {
position: relative; position: relative;
.time-item { .time-item {
width: 90rpx; font-size: 28rpx;
text-align: center; text-align: center;
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
@@ -245,20 +246,20 @@
.xian { .xian {
width: 40rpx; width: 40rpx;
height: 3rpx; height: 3rpx;
background-color: #459DFF; background-color: #318AFE;
position: absolute; position: absolute;
left: 26rpx; left: 16rpx;
bottom: 0; bottom: 0;
} }
} }
.time-selected { .time-selected {
color: #459DFF; color: #318afe;
font-size: 32rpx!important;
} }
} }
.pageSalesSummaryContent { .pageSalesSummaryContent {
width: 694rpx;
height: 320rpx; height: 320rpx;
margin: 20rpx 28rpx; margin: 20rpx 28rpx;
background-image: url('./svg/bgimg.svg'); background-image: url('./svg/bgimg.svg');
@@ -281,7 +282,7 @@
// width: calc(100% - 5px); // width: calc(100% - 5px);
overflow-x: scroll; overflow-x: scroll;
white-space: nowrap; white-space: nowrap;
margin: 0 28rpx; margin: 32rpx 28rpx;
margin-right: 30rpx; margin-right: 30rpx;
border-radius: 30rpx 30rpx 0 0; border-radius: 30rpx 30rpx 0 0;
@@ -295,7 +296,8 @@
.table-scroll thead { .table-scroll thead {
display: table-row; display: table-row;
background-color: bisque; background-color: bisque;
font-size: 24rpx;
height: 82rpx;
} }
.table-scroll tbody { .table-scroll tbody {
@@ -312,7 +314,7 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
min-width: 250rpx; min-width: 250rpx;
border: 2rpx solid #7E9BD4; border: 1.2rpx solid #7E9BD4;
} }
.bottombtn { .bottombtn {
@@ -322,6 +324,7 @@
text-align: center; text-align: center;
margin: 0rpx auto; margin: 0rpx auto;
background: #F1F1F1; background: #F1F1F1;
font-size: 24rpx;
border-radius: 0rpx 0rpx 28rpx 28rpx; border-radius: 0rpx 0rpx 28rpx 28rpx;
} }

View File

@@ -11,7 +11,7 @@
</view> </view>
</view> </view>
<view class=""> <view class="">
<view class=""> <view style="display: flex;justify-content: center;align-items: center;">
<span style="font-size: 28rpx;color: #999999;">是否启用用</span> <span style="font-size: 28rpx;color: #999999;">是否启用用</span>
<up-switch :activeValue="1" :inactiveValue="0" v-model="item.status" size="18" <up-switch :activeValue="1" :inactiveValue="0" v-model="item.status" size="18"
@change="switch2Change($event,item)"></up-switch> @change="switch2Change($event,item)"></up-switch>
@@ -121,12 +121,12 @@
.liststyle { .liststyle {
>li { >li {
width: 694rpx; // width: 694rpx;
height: 192rpx; height: 192rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx; border-radius: 10rpx 10rpx 10rpx 10rpx;
padding: 0 16rpx; padding: 0 16rpx;
margin: 32rpx auto; margin: 32rpx 16rpx;
>view { >view {
display: flex; display: flex;

View File

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

View File

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

View File

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

View File

@@ -1,11 +1,11 @@
<template> <template>
<view class="safe-page"> <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"> <view class="myTabs u-m-t-20">
<my-tabs :list="tabsList" @change="tabsChange"></my-tabs> <my-tabs :list="tabsList" @change="tabsChange"></my-tabs>
</view> </view>
</view> </view> -->
<!-- 用户列表 --> <!-- 用户列表 -->
<template v-if="tabsCurrent===0"> <template v-if="tabsCurrent===0">

View File

@@ -1025,22 +1025,7 @@
"style": { "style": {
"navigationBarTitleText": "添加临时菜" "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', icon: '/static/indexImg/icon-line-up.svg',
pageUrl: 'PAGES_LINE_UP' pageUrl: 'PAGES_LINE_UP'
}, },
{ // {
title: '成员管理', // title: '成员管理',
icon: '/static/indexImg/icon-staff.svg', // icon: '/static/indexImg/icon-staff.svg',
pageUrl: 'PAGES_USER' // pageUrl: 'PAGES_USER'
}, // },
{ {
title: '设置中心', title: '设置中心',
icon: '/static/indexImg/icon-cashier.svg', icon: '/static/indexImg/icon-cashier.svg',
@@ -221,7 +221,11 @@
{ {
title: '退出登录', title: '退出登录',
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg', 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 { import {
ref, ref,
reactive, reactive,
onMounted onMounted,
watch
} from 'vue'; } from 'vue';
import { import {
$loginByPwd, $loginByPwd,
@@ -339,9 +340,15 @@
}) })
// #endif // #endif
} }
watch(()=>accountType.sel,(newval)=>{
if(newval==1){
vdata.formData.merchantName=uni.getStorageSync('merchantName')||''
}else{
vdata.formData.username=''
}
})
// 封装登录成功后的操作 // 封装登录成功后的操作
async function loginFinishFunc(loginBizData) { async function loginFinishFunc(loginBizData) {
// 保存 token // 保存 token
storageManage.setLogin(loginBizData) storageManage.setLogin(loginBizData)
storageManage.token(loginBizData.token) storageManage.token(loginBizData.token)

View File

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

View File

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

View File

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

View File

@@ -55,7 +55,9 @@
<view></view> <view></view>
<view>{{allPrice}}</view> <view>{{allPrice}}</view>
</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> </view>
</template> </template>
@@ -126,7 +128,7 @@
const {tableId,name,maxCapacity,status,type}=props.table const {tableId,name,maxCapacity,status,type}=props.table
go.to('PAGES_CONFIRM_ORDER',{ go.to('PAGES_CONFIRM_ORDER',{
masterId:props.masterId,type, masterId:props.masterId,type,
tableId,name,maxCapacity,status,isCreateOrderToDetail:props.isCreateOrderToDetail tableId,name,maxCapacity,status,isCreateOrderToDetail:props.isCreateOrderToDetail?1:0
}) })
} }

View File

@@ -58,7 +58,7 @@
} }
}, },
index: { index: {
type: Number, type: [Number,String],
}, },
isSeatFee:{ isSeatFee:{
//是否为餐位费 //是否为餐位费

View File

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

View File

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

View File

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

View File

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

View File

@@ -25,18 +25,18 @@
</view> </view>
</view> </view>
</template> </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="">
<view class="font-bold">{{user.amount}}</view> <view class="font-bold ">{{user.amount}}</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 class=""> <view class="">
<view class="font-bold">{{user.totalScore}}</view> <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>
<view class=""> <view class="">
<view class="font-bold">0.00</view> <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>
</view> </view>

View File

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

View File

@@ -10,7 +10,7 @@
</view> </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="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"> v-for="(item,index) in statusData.list" :key="index">
{{item.label}} {{item.label}}
</view> </view>
@@ -56,14 +56,14 @@
<view style="height: 20rpx;"></view> <view style="height: 20rpx;"></view>
<view class="u-p-30 all-list u-flex u-flex-wrap gap-20"> <view class="u-p-30 all-list u-flex u-flex-wrap gap-20">
<view class="all-list-item" :class="{active:statusItemIndex==statusData.allListSel}" <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"> v-for="(statusItem,statusItemIndex) in statusData.allList" :key="statusItemIndex">
{{statusItem.label}} {{statusItem.label}}
</view> </view>
</view> </view>
<view class="u-flex u-p-t-30 u-p-b-30 u-p-l-20 u-p-r-20 gap-20"> <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 @click="moreShowHide">取消</up-button>
<up-button type="primary" @click="moreShowHide">确定</up-button> <up-button type="primary" @click="statusConfirm">确定</up-button>
</view> </view>
</up-popup> </up-popup>
@@ -80,7 +80,7 @@
watch watch
} from 'vue'; } from 'vue';
const emits = defineEmits(['update:time', 'update:status','clearUser']) const emits = defineEmits(['update:time', 'update:status','clearUser','updateStatus'])
function userShowClose() { function userShowClose() {
userShow.value = false userShow.value = false
@@ -138,6 +138,7 @@
} }
watch(() => timeData.sel, (newval) => { watch(() => timeData.sel, (newval) => {
const data = timeData.list[newval] const data = timeData.list[newval]
if (newval != -1) { if (newval != -1) {
emits('update:time', [data.start, data.end]) emits('update:time', [data.start, data.end])
@@ -153,23 +154,27 @@
value: '' value: ''
}, },
{ {
label: '待完成', label: '待支付',
value: ''
},
{
label: '待退款',
value: ''
},
{
label: '未支付',
value: 'unpaid' value: 'unpaid'
}, },
// {
// label: '待完成',
// value: ''
// },
{
label: '已完成',
value: 'closed'
},
// {
// label: '未支付',
// value: 'unpaid'
// },
{ {
label: '已退款', label: '已退款',
value: '' value: 'refund'
} }
], ],
sel: 0 sel: ''
}) })
function moreShowHide() { function moreShowHide() {
@@ -182,6 +187,7 @@
function changeStatusSel(i) { function changeStatusSel(i) {
statusData.sel = i statusData.sel = i
emits('updateStatus', i)
} }
function datePickerConfirm(e) { function datePickerConfirm(e) {
@@ -189,8 +195,15 @@
emits('update:time', [e.start, e.end]) emits('update:time', [e.start, e.end])
} }
function changeAllListSel(i) { function changeAllListSel(i,item) {
statusData.allListSel = i statusData.allListSel = i
console.log(i);
}
function statusConfirm(){
const status=statusData.allList[statusData.allListSel].key
statusData.sel=status
emits('updateStatus',status)
moreShowHide()
} }
</script> </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"> <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> <up-search v-bind="search" v-model="search.val"></up-search>
</view> </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> </view>
<order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list> <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 style="height: 100rpx;"></view>
</view> </view>
</template> </template>
@@ -26,7 +28,7 @@
import { import {
reactive, ref, watch reactive, ref, watch
} from 'vue'; } from 'vue';
import {getTodayTimestamps} from '@/commons/utils/dayjs-time.js';
const search = reactive({ const search = reactive({
val: '', val: '',
placeholder: '搜索单号/昵称/姓名/手机号码/商品名称', placeholder: '搜索单号/昵称/姓名/手机号码/商品名称',
@@ -39,14 +41,15 @@
} }
}) })
const today = getTodayTimestamps();
const order=new LIST({ const order=new LIST({
list: [], list: [],
query: { query: {
createdAt: [], createdAt: [today.start,today.end],
id: "", id: "",
orderNo: "", orderNo: "",
orderType: "0", orderType: "0",
page: 0, page: 1,
pageSize: 10, pageSize: 10,
payType: "", payType: "",
productName: "", productName: "",
@@ -65,15 +68,21 @@
console.log(order.data.page); console.log(order.data.page);
init() init()
} }
function updateQuery(key,e){
order.setQuery(key,e)
}
watch(()=>order.data.query.createdAt,(newval)=>{ watch(()=>order.data.query.createdAt,(newval)=>{
init() init()
}) })
watch(()=>order.data.query.status,(newval)=>{
init()
})
watch(()=>order.data.query.userId,(newval)=>{ watch(()=>order.data.query.userId,(newval)=>{
init() init()
}) })
async function init() { async function init() {
console.log(order.data.query); 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() uni.stopPullDownRefresh()
order.setVal('list',content) order.setVal('list',content)
console.log(order.data.list); console.log(order.data.list);

View File

@@ -13,7 +13,7 @@
<view @click="showModel('editMoney',true)">修改</view> <view @click="showModel('editMoney',true)">修改</view>
</view> </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-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 class="u-flex u-p-l-24 u-p-r-24 border-bottom-dashed u-row-between u-p-b-30">
<view>优惠券</view> <view>优惠券</view>
@@ -126,7 +126,7 @@
let payFinish=ref(false) let payFinish=ref(false)
onBackPress(() => { onBackPress(() => {
console.log('onBackPress'); console.log('onBackPress');
uni.$emit('update:createOrderIndex') // uni.$emit('update:createOrderIndex')
// if (option.isNowPay&&!payFinish.value) { // if (option.isNowPay&&!payFinish.value) {
// infoBox.showToast('先付费模式,请先结算订单') // infoBox.showToast('先付费模式,请先结算订单')
// return true // return true
@@ -242,7 +242,7 @@
setTimeout(() => { setTimeout(() => {
// uni.$emit('orderDetail:update') // uni.$emit('orderDetail:update')
payFinish.value=true payFinish.value=true
uni.$emit('update:createOrderIndex') uni.$emit('get:table')
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })

View File

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