称重,默认选择营业时间

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;
}