称重,默认选择营业时间

This commit is contained in:
魏啾
2024-12-06 15:49:15 +08:00
parent 38b640e82b
commit 3616caac21
6 changed files with 60 additions and 43 deletions

View File

@@ -12,14 +12,15 @@
<view class="block"> <view class="block">
<view class="border-top-0 typeEnum"> <view class="border-top-0 typeEnum">
<uni-forms-item label="商品类型" required showRequired> <uni-forms-item label="商品类型" required showRequired>
<up-radio-group v-model="FormData.type" placement="row"> <up-radio-group v-model="FormData.type" placement="row"
@change="changeFormDatatype">
<up-radio v-for="(item, index) in pageData.types" :key="index" <up-radio v-for="(item, index) in pageData.types" :key="index"
:label="item.name" :name="item.value"> :label="item.name" :name="item.value">
</up-radio> </up-radio>
</up-radio-group> </up-radio-group>
</uni-forms-item> </uni-forms-item>
</view> </view>
<view class="" v-if="FormData.type!='package'"> <view class="" v-if="FormData.type!='package' && FormData.type!='weigh'">
<uni-forms-item label="商品规格" required showRequired> <uni-forms-item label="商品规格" required showRequired>
<up-radio-group v-model="FormData.typeEnum" placement="row"> <up-radio-group v-model="FormData.typeEnum" placement="row">
<up-radio :custom-style="{marginRight:'30px'}" <up-radio :custom-style="{marginRight:'30px'}"
@@ -515,12 +516,12 @@
<view class="block u-p-t-32 u-p-b-32"> <view class="block u-p-t-32 u-p-b-32">
<view class="font-bold"> <view class="font-bold">
<text class="color-red">*</text> <text class="color-red">*</text>
<text>重量</text> <text>单位</text>
</view> </view>
<view class=" u-m-t-16"> <view class=" u-m-t-16">
<up-input v-model="FormData.weight"> <up-input v-model="FormData.weight">
<template #suffix> <template #suffix>
<view class="bg-gray">千克</view> <view class="bg-gray">{{activeinHouseList}}</view>
</template> </template>
</up-input> </up-input>
<view class="u-m-t-16 color-999 u-font-24">用于快递或配送运费计重</view> <view class="u-m-t-16 color-999 u-font-24">用于快递或配送运费计重</view>
@@ -543,8 +544,7 @@
<view class="border-top-0"> <view class="border-top-0">
<view class="u-flex u-row-between u-p-b-24 u-p-t-20"> <view class="u-flex u-row-between u-p-b-24 u-p-t-20">
<view class="label-title">是否允许临时改价</view> <view class="label-title">是否允许临时改价</view>
<my-switch <my-switch v-model="FormData.isTempPrice"></my-switch>
v-model="FormData.isTempPrice"></my-switch>
</view> </view>
</view> </view>
<view class="u-p-t-24 u-p-b-24 border-top u-flex u-row-between"> <view class="u-p-t-24 u-p-b-24 border-top u-flex u-row-between">
@@ -577,14 +577,16 @@
<view> <view>
<uni-forms-item label=""> <uni-forms-item label="">
<view class="u-flex u-row-between" @tap="toTimerPage"> <view class="u-flex u-row-between" @tap="toTimerPage">
<view> <view style="display: flex;">
<text class="color-red">*</text>
<view class="label-title">定时上下架</view> <view class="label-title">定时上下架</view>
</view> </view>
<view class="u-flex u-font-24"> <view class="u-flex u-font-24">
<view> <view>
<view class="color-666">{{returnTimerDayText()}}</view> <view class="color-666">{{returnTimerDayText()}}</view>
<view class="color-666 u-m-t-4" v-if="FormData.days"> <view class="color-666 u-m-t-4" v-if="FormData.days">
{{returnTimerTimeText()}}</view> {{returnTimerTimeText()}}
</view>
</view> </view>
<uni-icons type="right"></uni-icons> <uni-icons type="right"></uni-icons>
</view> </view>
@@ -916,7 +918,7 @@
function proGroupVoAddGoods(index, arr) { function proGroupVoAddGoods(index, arr) {
proGroupVoIndex = index proGroupVoIndex = index
if(!FormData.proGroupVo){ if (!FormData.proGroupVo) {
initDefaultProGroupVo() initDefaultProGroupVo()
} }
if (FormData.groupType == 0) { if (FormData.groupType == 0) {
@@ -1230,13 +1232,13 @@
//表单边框 //表单边框
const inputBorder = ref(false) const inputBorder = ref(false)
const FormData = reactive({ const FormData = reactive({
days: '', days: "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
startTime: '', endTime: "23:59",
endTime: '', startTime: "00:00",
//每日销量上限, //每日销量上限,
dayLimit: 0, dayLimit: 0,
singleOrderLimit:0, singleOrderLimit: 0,
singlePeopleLimit:0, singlePeopleLimit: 0,
type: 'normal', type: 'normal',
showType: ['table'], showType: ['table'],
specsInfoName: '', specsInfoName: '',
@@ -1364,7 +1366,7 @@
res.specsInfoName = specsInfoName res.specsInfoName = specsInfoName
$goodsData = res $goodsData = res
skuList.list = res.skuList skuList.list = res.skuList
res.showType=res.showType.split(',') res.showType = res.showType.split(',')
Object.assign(FormData, res) Object.assign(FormData, res)
//多规格 //多规格
if (res.typeEnum === 'sku') { if (res.typeEnum === 'sku') {
@@ -1572,6 +1574,12 @@
getTbShopUnit() getTbShopUnit()
getTbProductSpec() getTbProductSpec()
}) })
const changeFormDatatype = (e) => {
console.log(e)
console.log(FormData)
// 当是称重商品时 默认是单规格
FormData.typeEnum = 'normal'
}
onShow(() => { onShow(() => {
// if (option.type === 'edit') { // if (option.type === 'edit') {
@@ -1685,7 +1693,7 @@
} }
} }
if (type == 'package') { if (type == 'package') {
if (groupType == 0&& FormData.proGroupVo[0].goods.length<=0) { if (groupType == 0 && FormData.proGroupVo[0].goods.length <= 0) {
// 固定套餐 // 固定套餐
return infoBox.showToast('套餐组合至少需要包含一种商品,请添加商品') return infoBox.showToast('套餐组合至少需要包含一种商品,请添加商品')
} }
@@ -1718,7 +1726,7 @@
} }
const submitData = { const submitData = {
...FormData, ...FormData,
showType:FormData.showType.join(','), showType: FormData.showType.join(','),
proGroupVo: type != 'package' ? '' : FormData.proGroupVo, proGroupVo: type != 'package' ? '' : FormData.proGroupVo,
images: images, images: images,
coverImg: images[0] || '', coverImg: images[0] || '',
@@ -1767,7 +1775,6 @@
return result.replace(/.$/, "") return result.replace(/.$/, "")
} }
}) })
/** /**
* 监听规格保存,拿到数据 * 监听规格保存,拿到数据
*/ */
@@ -1931,14 +1938,14 @@
watch(() => FormData.type, (newval) => { watch(() => FormData.type, (newval) => {
if (option.type == 'edit') { if (option.type == 'edit') {
if (newval == $goodsData.type) { if (newval == $goodsData.type) {
if($goodsData.proGroupVo){ if ($goodsData.proGroupVo) {
FormData.proGroupVo = $goodsData.proGroupVo||[] FormData.proGroupVo = $goodsData.proGroupVo || []
}else{ } else {
initDefaultProGroupVo() initDefaultProGroupVo()
} }
} }
if(FormData.groupType==null){ if (FormData.groupType == null) {
FormData.groupType=0 FormData.groupType = 0
} }
} else { } else {
if (newval == 'package') { if (newval == 'package') {
@@ -2005,11 +2012,22 @@
disabledChangeCategory.value = !res disabledChangeCategory.value = !res
} }
} }
const activeinHouseList = computed(() => {
try {
return pageData.units.filter((item) => {
if (item.id == FormData.unitId) {
return item.name
}
})[0].name
} catch (error) {
//TODO handle the exception
}
});
/** /**
* 权限end * 权限end
*/ */
watch(() => pageData.types, (newval) => { watch(() => pageData.types, (newval) => {
Forms.value.setRules(rules) Forms.value.setRules(rules)
}) })
@@ -2020,6 +2038,7 @@
onReady(() => { onReady(() => {
Forms.value && Forms.value.setRules(rules) Forms.value && Forms.value.setRules(rules)
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearTimeout(timer) clearTimeout(timer)
}) })
@@ -2133,7 +2152,8 @@
flex-wrap: nowrap; flex-wrap: nowrap;
justify-content: space-between; justify-content: space-between;
} }
::v-deep .typeEnum .u-checkbox-group--row{
::v-deep .typeEnum .u-checkbox-group--row {
flex-wrap: nowrap; flex-wrap: nowrap;
justify-content: space-between; justify-content: space-between;
} }

View File

@@ -36,7 +36,7 @@
</image> </image>
</view> </view>
<view class="u-m-l-30 u-m-r-30 color-333"> <view class="u-m-l-30 u-m-r-30 color-333">
{{item.number}} {{(item.number).toFixed(2)}}
</view> </view>
<view class="u-flex" @tap="updateNumber(true,index,item)"> <view class="u-flex" @tap="updateNumber(true,index,item)">
<image src="/pagesCreateOrder/static/images/icon-add-black.svg" class="icon" mode=""> <image src="/pagesCreateOrder/static/images/icon-add-black.svg" class="icon" mode="">

View File

@@ -28,7 +28,7 @@
</view> </view>
<template v-if="data.chooseNumber"> <template v-if="data.chooseNumber">
<view class="u-font-32"> <view class="u-font-32">
{{data.chooseNumber}} {{(data.chooseNumber).toFixed(2)}}
</view> </view>
<view class="u-flex" @tap.stop="emitEvent('reduce')"> <view class="u-flex" @tap.stop="emitEvent('reduce')">
<image src="/pagesCreateOrder/static/images/icon-reduce.svg" class="icon" mode=""> <image src="/pagesCreateOrder/static/images/icon-reduce.svg" class="icon" mode="">

View File

@@ -91,11 +91,11 @@
if (currentInput.value === '') { if (currentInput.value === '') {
uni.showToast({ uni.showToast({
title: '请输入', title: '请输入',
icon:'none' icon: 'none'
}) })
return false; return false;
} }
emit('weighgoodsUpdate', form.foodsindex, form.index, true, '', currentInput.value) emit('weighgoodsUpdate', form.foodsindex, form.index, true, undefined, currentInput.value)
overlayshow.value = false overlayshow.value = false
} }
//显示 //显示
@@ -108,7 +108,6 @@
index, index,
goods goods
}) })
console.log(form)
overlayshow.value = true overlayshow.value = true
} }
defineExpose({ defineExpose({

View File

@@ -862,7 +862,6 @@
// 称重 // 称重
const refweighitem = ref(null) const refweighitem = ref(null)
const tapweigh = (foodsindex, index) => { const tapweigh = (foodsindex, index) => {
console.log(foodsindex, index)
const goods = data.tabbar[index].foods[foodsindex] const goods = data.tabbar[index].foods[foodsindex]
refweighitem.value.open(foodsindex, index, goods) refweighitem.value.open(foodsindex, index, goods)
} }
@@ -990,7 +989,6 @@
} }
function searchGoodsUpdate(goodsItem, goodsIndex, isAdd) { function searchGoodsUpdate(goodsItem, goodsIndex, isAdd) {
console.log(goodsItem.goodsIndex, goodsItem.index, isAdd, goodsIndex, 111111)
goodsUpdate(goodsItem.goodsIndex, goodsItem.index, isAdd, goodsIndex) goodsUpdate(goodsItem.goodsIndex, goodsItem.index, isAdd, goodsIndex)
} }
@@ -1015,10 +1013,6 @@
const productId = $goods.id const productId = $goods.id
const skuId = $goods.specList[0].id const skuId = $goods.specList[0].id
let suit = $goods.specList[0].suit || 1 let suit = $goods.specList[0].suit || 1
// 不影响之前的代码 称重suit单独处理
if ($goods.type == 'weigh' && showCurrentInput) {
suit = showCurrentInput
}
if (goodsInCarIndex !== -1) { if (goodsInCarIndex !== -1) {
//更新 //更新
const carGoods = cars[goodsInCarIndex] const carGoods = cars[goodsInCarIndex]
@@ -1050,6 +1044,10 @@
$goods.chooseNumber = number $goods.chooseNumber = number
setSearchGoods(searchGoodsIndex, number) setSearchGoods(searchGoodsIndex, number)
} else { } else {
// 不影响之前的代码 称重suit单独处理
if ($goods.type == 'weigh' && showCurrentInput) {
suit = showCurrentInput
}
// 套餐和单规格 // 套餐和单规格
if ($goods.groupType != 1) { if ($goods.groupType != 1) {
//增加 //增加
@@ -1060,7 +1058,7 @@
skuId skuId
}) })
infoBox.showToast('添加成功') infoBox.showToast('添加成功')
$goods.chooseNumber = num $goods.chooseNumber = Number(num)
cars.push(cartGoods) cars.push(cartGoods)
} }
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="constant"> <view class="constant">
<view class="constantitem" @click="overlayshow = true"> <view class="constantitem" @click="object_id =null,overlayshow = true">
<view>扫码核销</view> <view>扫码核销</view>
<view> <view>
<up-icon name="arrow-right" color="#909399" size="20"></up-icon> <up-icon name="arrow-right" color="#909399" size="20"></up-icon>