feat:加入一天一次的限购
This commit is contained in:
1 parent
d4d3e20ab3
commit
01bb4e446a
5 files changed
+94
-115
No files matched your search
Vendored
+1
-1
@@ -87,7 +87,7 @@
|
||||
"source.fixAll.stylelint": "explicit"
|
||||
},
|
||||
"[vue]": {
|
||||
"editor.defaultFormatter": "octref.vetur"
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"i18n-ally.localesPaths": ["src/locales"],
|
||||
"i18n-ally.keystyle": "nested",
|
||||
|
||||
@@ -26,6 +26,7 @@ export interface Sku {
|
||||
salesCount?: number // 商品销量
|
||||
cabinetChannel?: string // 货道或柜门编号
|
||||
cabinetType?: string // 通道类型
|
||||
purchaseBizType?:string
|
||||
}
|
||||
|
||||
export interface GiveCouponTemplate {
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<!-- 数据字典 Select 选择器 -->
|
||||
<template>
|
||||
<el-select v-if="selectType === 'select'" class="w-1/1" v-bind="attrs">
|
||||
<el-select v-if="selectType === 'select'" class="w-1/1" v-bind="mergedAttrs">
|
||||
<el-option
|
||||
v-for="(dict, index) in getDictOptions"
|
||||
v-for="(dict, index) in options"
|
||||
:key="index"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-radio-group v-if="selectType === 'radio'" class="w-1/1" v-bind="attrs">
|
||||
<el-radio v-for="(dict, index) in getDictOptions" :key="index" :value="dict.value">
|
||||
<el-radio-group v-if="selectType === 'radio'" class="w-1/1" v-bind="mergedAttrs">
|
||||
<el-radio v-for="(dict, index) in options" :key="index" :value="dict.value">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
<el-checkbox-group v-if="selectType === 'checkbox'" class="w-1/1" v-bind="attrs">
|
||||
<el-checkbox-group v-if="selectType === 'checkbox'" class="w-1/1" v-bind="mergedAttrs">
|
||||
<el-checkbox
|
||||
v-for="(dict, index) in getDictOptions"
|
||||
v-for="(dict, index) in options"
|
||||
:key="index"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
@@ -29,6 +29,9 @@ import { getBoolDictOptions, getIntDictOptions, getStrDictOptions } from '@/util
|
||||
defineOptions({ name: 'DictSelect' })
|
||||
|
||||
const attrs = useAttrs()
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const options = ref<any>([])
|
||||
|
||||
// 接受父组件参数
|
||||
interface Props {
|
||||
@@ -36,6 +39,8 @@ interface Props {
|
||||
valueType?: 'str' | 'int' | 'bool' // 字典值类型
|
||||
selectType?: 'select' | 'radio' | 'checkbox' // 选择器类型,下拉框 select、多选框 checkbox、单选框 radio
|
||||
formCreateInject?: any
|
||||
defaultValue?: any
|
||||
modelValue?: any
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -43,17 +48,46 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
selectType: 'select'
|
||||
})
|
||||
|
||||
// 获得字典配置
|
||||
const getDictOptions = computed(() => {
|
||||
|
||||
// 计算当前值,如果没有 modelValue 且有默认值,则使用默认值
|
||||
const currentValue = computed({
|
||||
get() {
|
||||
return props.modelValue !== undefined ? props.modelValue : (props.defaultValue !== undefined ? props.defaultValue : attrs.modelValue)
|
||||
},
|
||||
set(value) {
|
||||
emit('update:modelValue', value)
|
||||
}
|
||||
})
|
||||
|
||||
// 合并 attrs,使用计算出的当前值
|
||||
const mergedAttrs = computed(() => {
|
||||
const { modelValue, 'onUpdate:modelValue': _, ...restAttrs } = attrs
|
||||
return {
|
||||
...restAttrs,
|
||||
modelValue: currentValue.value,
|
||||
'onUpdate:modelValue': (value: any) => {
|
||||
currentValue.value = value
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 初始化默认值
|
||||
onMounted(() => {
|
||||
switch (props.valueType) {
|
||||
case 'str':
|
||||
return getStrDictOptions(props.dictType)
|
||||
options.value = getStrDictOptions(props.dictType)
|
||||
break;
|
||||
case 'int':
|
||||
return getIntDictOptions(props.dictType)
|
||||
options.value = getIntDictOptions(props.dictType)
|
||||
break;
|
||||
case 'bool':
|
||||
return getBoolDictOptions(props.dictType)
|
||||
options.value = getBoolDictOptions(props.dictType)
|
||||
break;
|
||||
default:
|
||||
return []
|
||||
options.value = []
|
||||
}
|
||||
if ((props.modelValue === undefined || props.modelValue === null || props.modelValue === '') && props.defaultValue !== undefined) {
|
||||
emit('update:modelValue', props.defaultValue)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -171,6 +171,7 @@ export enum DICT_TYPE {
|
||||
|
||||
// ========== MALL - 商品模块 ==========
|
||||
PRODUCT_SPU_STATUS = 'product_spu_status', //商品状态
|
||||
PRODUCT_SKU_PURCHASE_BIZ_TYPE = 'product_sku_purchase_biz_type', // 商品SKU的采购业务类型
|
||||
|
||||
// ========== MALL - 交易模块 ==========
|
||||
EXPRESS_CHARGE_MODE = 'trade_delivery_express_charge_mode', //快递的计费方式
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
<template>
|
||||
<!-- 情况一:添加/修改 -->
|
||||
<el-table
|
||||
v-if="!isDetail && !isActivityComponent"
|
||||
:data="isBatch ? skuList : formData!.skus!"
|
||||
border
|
||||
class="tabNumWidth"
|
||||
max-height="500"
|
||||
size="small"
|
||||
>
|
||||
v-if="!isDetail && !isActivityComponent" :data="isBatch ? skuList : formData!.skus!" border
|
||||
class="tabNumWidth" max-height="500" size="small">
|
||||
<el-table-column align="center" label="图片" min-width="65">
|
||||
<template #default="{ row }">
|
||||
<UploadImg v-model="row.picUrl" height="50px" width="50px" />
|
||||
@@ -16,12 +11,8 @@
|
||||
<template v-if="formData!.specType && !isBatch">
|
||||
<!-- 根据商品属性动态添加 -->
|
||||
<el-table-column
|
||||
v-for="(item, index) in tableHeaders"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
align="center"
|
||||
min-width="120"
|
||||
>
|
||||
v-for="(item, index) in tableHeaders" :key="index" :label="item.label" align="center"
|
||||
min-width="120">
|
||||
<template #default="{ row }">
|
||||
<span style="font-weight: bold; color: #40aaff">
|
||||
{{ row.properties?.[index]?.valueName }}
|
||||
@@ -47,37 +38,22 @@
|
||||
<el-table-column align="center" label="销售价" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.price"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="w-100%"
|
||||
controls-position="right"
|
||||
/>
|
||||
v-model="row.price" :min="0" :precision="2" :step="0.1" class="w-100%"
|
||||
controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="市场价" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.marketPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="w-100%"
|
||||
controls-position="right"
|
||||
/>
|
||||
v-model="row.marketPrice" :min="0" :precision="2" :step="0.1" class="w-100%"
|
||||
controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="成本价" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.costPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="w-100%"
|
||||
controls-position="right"
|
||||
/>
|
||||
v-model="row.costPrice" :min="0" :precision="2" :step="0.1" class="w-100%"
|
||||
controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="库存" min-width="168">
|
||||
@@ -88,50 +64,37 @@
|
||||
<el-table-column align="center" label="重量(kg)" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.weight"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="w-100%"
|
||||
controls-position="right"
|
||||
/>
|
||||
v-model="row.weight" :min="0" :precision="2" :step="0.1" class="w-100%"
|
||||
controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="体积(m^3)" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.volume"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="w-100%"
|
||||
controls-position="right"
|
||||
/>
|
||||
v-model="row.volume" :min="0" :precision="2" :step="0.1" class="w-100%"
|
||||
controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="限购" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<dict-select
|
||||
v-model="row.purchaseBizType" :dict-type="DICT_TYPE.PRODUCT_SKU_PURCHASE_BIZ_TYPE"
|
||||
default-value="0" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-if="formData!.subCommissionType">
|
||||
<el-table-column align="center" label="一级返佣(元)" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.firstBrokeragePrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="w-100%"
|
||||
controls-position="right"
|
||||
/>
|
||||
v-model="row.firstBrokeragePrice" :min="0" :precision="2" :step="0.1" class="w-100%"
|
||||
controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="二级返佣(元)" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.secondBrokeragePrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="w-100%"
|
||||
controls-position="right"
|
||||
/>
|
||||
v-model="row.secondBrokeragePrice" :min="0" :precision="2" :step="0.1" class="w-100%"
|
||||
controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
@@ -147,35 +110,19 @@
|
||||
|
||||
<!-- 情况二:详情 -->
|
||||
<el-table
|
||||
v-if="isDetail"
|
||||
ref="activitySkuListRef"
|
||||
:data="formData!.skus!"
|
||||
border
|
||||
max-height="500"
|
||||
size="small"
|
||||
style="width: 99%"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
v-if="isDetail" ref="activitySkuListRef" :data="formData!.skus!" border max-height="500" size="small"
|
||||
style="width: 99%" @selection-change="handleSelectionChange">
|
||||
<el-table-column v-if="isComponent" type="selection" width="45" />
|
||||
<el-table-column align="center" label="图片" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<el-image
|
||||
v-if="row.picUrl"
|
||||
:src="row.picUrl"
|
||||
class="h-50px w-50px"
|
||||
@click="imagePreview(row.picUrl)"
|
||||
/>
|
||||
<el-image v-if="row.picUrl" :src="row.picUrl" class="h-50px w-50px" @click="imagePreview(row.picUrl)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-if="formData!.specType && !isBatch">
|
||||
<!-- 根据商品属性动态添加 -->
|
||||
<el-table-column
|
||||
v-for="(item, index) in tableHeaders"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
align="center"
|
||||
min-width="80"
|
||||
>
|
||||
v-for="(item, index) in tableHeaders" :key="index" :label="item.label" align="center"
|
||||
min-width="80">
|
||||
<template #default="{ row }">
|
||||
<span style="font-weight: bold; color: #40aaff">
|
||||
{{ row.properties?.[index]?.valueName }}
|
||||
@@ -228,6 +175,13 @@
|
||||
{{ row.volume }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="限购" min-width="168">
|
||||
<template #default="{ row }">
|
||||
<dict-select
|
||||
v-model="row.purchaseBizType" :dict-type="DICT_TYPE.PRODUCT_SKU_PURCHASE_BIZ_TYPE"
|
||||
default-value="0" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-if="formData!.subCommissionType">
|
||||
<el-table-column align="center" label="一级返佣(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
@@ -243,14 +197,7 @@
|
||||
</el-table>
|
||||
|
||||
<!-- 情况三:作为活动组件 -->
|
||||
<el-table
|
||||
v-if="isActivityComponent"
|
||||
:data="formData!.skus!"
|
||||
border
|
||||
max-height="500"
|
||||
size="small"
|
||||
style="width: 99%"
|
||||
>
|
||||
<el-table v-if="isActivityComponent" :data="formData!.skus!" border max-height="500" size="small" style="width: 99%">
|
||||
<el-table-column v-if="isComponent" type="selection" width="45" />
|
||||
<el-table-column align="center" label="图片" min-width="80">
|
||||
<template #default="{ row }">
|
||||
@@ -260,12 +207,8 @@
|
||||
<template v-if="formData!.specType">
|
||||
<!-- 根据商品属性动态添加 -->
|
||||
<el-table-column
|
||||
v-for="(item, index) in tableHeaders"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
align="center"
|
||||
min-width="80"
|
||||
>
|
||||
v-for="(item, index) in tableHeaders" :key="index" :label="item.label" align="center"
|
||||
min-width="80">
|
||||
<template #default="{ row }">
|
||||
<span style="font-weight: bold; color: #40aaff">
|
||||
{{ row.properties?.[index]?.valueName }}
|
||||
@@ -313,6 +256,7 @@
|
||||
</el-table>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { PropType, Ref } from 'vue'
|
||||
import { copyValueToTarget, formatToFraction } from '@/utils'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
@@ -330,7 +274,7 @@ const message = useMessage() // 消息弹窗
|
||||
const props = defineProps({
|
||||
propFormData: {
|
||||
type: Object as PropType<Spu>,
|
||||
default: () => {}
|
||||
default: () => { }
|
||||
},
|
||||
propertyList: {
|
||||
type: Array as PropType<PropertyAndValues[]>,
|
||||
@@ -399,10 +343,8 @@ const tableHeaders = ref<{ prop: string; label: string }[]>([]) // 多属性表
|
||||
/**
|
||||
* 保存时,每个商品规格的表单要校验下。例如说,销售金额最低是 0.01 这种。
|
||||
*/
|
||||
const validateSku = () => {
|
||||
const validateSku = () => {
|
||||
validateProperty()
|
||||
console.log(props?.ruleConfig,"props?.ruleConfig");
|
||||
|
||||
let warningInfo = '请检查商品各行相关属性配置,'
|
||||
let validate = true // 默认通过
|
||||
for (const sku of formData.value!.skus!) {
|
||||
@@ -567,7 +509,8 @@ watch(
|
||||
weight: 0,
|
||||
volume: 0,
|
||||
firstBrokeragePrice: 0,
|
||||
secondBrokeragePrice: 0
|
||||
secondBrokeragePrice: 0,
|
||||
purchaseBizType: "0",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user