称重,默认选择营业时间

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="border-top-0 typeEnum">
<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"
:label="item.name" :name="item.value">
</up-radio>
</up-radio-group>
</uni-forms-item>
</view>
<view class="" v-if="FormData.type!='package'">
<view class="" v-if="FormData.type!='package' && FormData.type!='weigh'">
<uni-forms-item label="商品规格" required showRequired>
<up-radio-group v-model="FormData.typeEnum" placement="row">
<up-radio :custom-style="{marginRight:'30px'}"
@ -68,12 +69,12 @@
</uni-forms-item>
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)"
v-if="option.type=='edit'&&disabledChangeCategory">
</view>
</view>
<view class="">
<uni-forms-item label="单位" required showRequired name="units">
<uni-data-picker :clear-icon="false" @change="unitIdChange"
:map="{text:'name',value:'id'}" placeholder="请选择单位" popup-title="请选择单位"
:localdata="pageData.units" v-model="FormData.unitId">
@ -90,7 +91,7 @@
</uni-data-picker>
</uni-forms-item>
</view> -->
<view class="border-top" v-if="FormData.proGroupVo">
<view class=""
v-if=" (FormData.groupType==1&&FormData.proGroupVo.length)||(FormData.groupType==0&&FormData.proGroupVo.length&&FormData.proGroupVo[0].goods.length) ">
@ -515,12 +516,12 @@
<view class="block u-p-t-32 u-p-b-32">
<view class="font-bold">
<text class="color-red">*</text>
<text>重量</text>
<text>单位</text>
</view>
<view class=" u-m-t-16">
<up-input v-model="FormData.weight">
<template #suffix>
<view class="bg-gray">千克</view>
<view class="bg-gray">{{activeinHouseList}}</view>
</template>
</up-input>
<view class="u-m-t-16 color-999 u-font-24">用于快递或配送运费计重</view>
@ -543,8 +544,7 @@
<view class="border-top-0">
<view class="u-flex u-row-between u-p-b-24 u-p-t-20">
<view class="label-title">是否允许临时改价</view>
<my-switch
v-model="FormData.isTempPrice"></my-switch>
<my-switch v-model="FormData.isTempPrice"></my-switch>
</view>
</view>
<view class="u-p-t-24 u-p-b-24 border-top u-flex u-row-between">
@ -577,14 +577,16 @@
<view>
<uni-forms-item label="">
<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>
<view class="u-flex u-font-24">
<view>
<view class="color-666">{{returnTimerDayText()}}</view>
<view class="color-666 u-m-t-4" v-if="FormData.days">
{{returnTimerTimeText()}}</view>
{{returnTimerTimeText()}}
</view>
</view>
<uni-icons type="right"></uni-icons>
</view>
@ -701,8 +703,8 @@
<choose-guige ref="refChooseGuige" @confirm="refChooseGuigeConfirm"></choose-guige>
<!-- 更多操作 -->
<my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
</view>
@ -916,7 +918,7 @@
function proGroupVoAddGoods(index, arr) {
proGroupVoIndex = index
if(!FormData.proGroupVo){
if (!FormData.proGroupVo) {
initDefaultProGroupVo()
}
if (FormData.groupType == 0) {
@ -1230,13 +1232,13 @@
//
const inputBorder = ref(false)
const FormData = reactive({
days: '',
startTime: '',
endTime: '',
days: "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
endTime: "23:59",
startTime: "00:00",
//
dayLimit: 0,
singleOrderLimit:0,
singlePeopleLimit:0,
singleOrderLimit: 0,
singlePeopleLimit: 0,
type: 'normal',
showType: ['table'],
specsInfoName: '',
@ -1364,7 +1366,7 @@
res.specsInfoName = specsInfoName
$goodsData = res
skuList.list = res.skuList
res.showType=res.showType.split(',')
res.showType = res.showType.split(',')
Object.assign(FormData, res)
//
if (res.typeEnum === 'sku') {
@ -1572,6 +1574,12 @@
getTbShopUnit()
getTbProductSpec()
})
const changeFormDatatype = (e) => {
console.log(e)
console.log(FormData)
//
FormData.typeEnum = 'normal'
}
onShow(() => {
// if (option.type === 'edit') {
@ -1685,7 +1693,7 @@
}
}
if (type == 'package') {
if (groupType == 0&& FormData.proGroupVo[0].goods.length<=0) {
if (groupType == 0 && FormData.proGroupVo[0].goods.length <= 0) {
//
return infoBox.showToast('套餐组合至少需要包含一种商品,请添加商品')
}
@ -1718,7 +1726,7 @@
}
const submitData = {
...FormData,
showType:FormData.showType.join(','),
showType: FormData.showType.join(','),
proGroupVo: type != 'package' ? '' : FormData.proGroupVo,
images: images,
coverImg: images[0] || '',
@ -1767,7 +1775,6 @@
return result.replace(/.$/, "")
}
})
/**
* 监听规格保存,拿到数据
*/
@ -1931,14 +1938,14 @@
watch(() => FormData.type, (newval) => {
if (option.type == 'edit') {
if (newval == $goodsData.type) {
if($goodsData.proGroupVo){
FormData.proGroupVo = $goodsData.proGroupVo||[]
}else{
if ($goodsData.proGroupVo) {
FormData.proGroupVo = $goodsData.proGroupVo || []
} else {
initDefaultProGroupVo()
}
}
if(FormData.groupType==null){
FormData.groupType=0
if (FormData.groupType == null) {
FormData.groupType = 0
}
} else {
if (newval == 'package') {
@ -2005,11 +2012,22 @@
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
*/
watch(() => pageData.types, (newval) => {
Forms.value.setRules(rules)
})
@ -2020,6 +2038,7 @@
onReady(() => {
Forms.value && Forms.value.setRules(rules)
})
onBeforeUnmount(() => {
clearTimeout(timer)
})
@ -2133,7 +2152,8 @@
flex-wrap: nowrap;
justify-content: space-between;
}
::v-deep .typeEnum .u-checkbox-group--row{
::v-deep .typeEnum .u-checkbox-group--row {
flex-wrap: nowrap;
justify-content: space-between;
}

View File

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

View File

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

View File

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

View File

@ -862,7 +862,6 @@
//
const refweighitem = ref(null)
const tapweigh = (foodsindex, index) => {
console.log(foodsindex, index)
const goods = data.tabbar[index].foods[foodsindex]
refweighitem.value.open(foodsindex, index, goods)
}
@ -990,7 +989,6 @@
}
function searchGoodsUpdate(goodsItem, goodsIndex, isAdd) {
console.log(goodsItem.goodsIndex, goodsItem.index, isAdd, goodsIndex, 111111)
goodsUpdate(goodsItem.goodsIndex, goodsItem.index, isAdd, goodsIndex)
}
@ -1015,10 +1013,6 @@
const productId = $goods.id
const skuId = $goods.specList[0].id
let suit = $goods.specList[0].suit || 1
// suit
if ($goods.type == 'weigh' && showCurrentInput) {
suit = showCurrentInput
}
if (goodsInCarIndex !== -1) {
//
const carGoods = cars[goodsInCarIndex]
@ -1050,6 +1044,10 @@
$goods.chooseNumber = number
setSearchGoods(searchGoodsIndex, number)
} else {
// suit
if ($goods.type == 'weigh' && showCurrentInput) {
suit = showCurrentInput
}
//
if ($goods.groupType != 1) {
//
@ -1060,7 +1058,7 @@
skuId
})
infoBox.showToast('添加成功')
$goods.chooseNumber = num
$goods.chooseNumber = Number(num)
cars.push(cartGoods)
}
}

View File

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