二维码画板
This commit is contained in:
42
src/views/shop/goodsInfo/drawGoodsQrcode.vue
Normal file
42
src/views/shop/goodsInfo/drawGoodsQrcode.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div v-if="fontReady">
|
||||
<v-stage :config="content" v-if="content" @mousedown="handleStageMouseDown">
|
||||
<v-layer>
|
||||
<v-rect v-if="content.background.type === 'color'" :config="content.background">
|
||||
</v-rect>
|
||||
<v-image v-if="content.background.type === 'image' && imageBgConfig" :config="imageBgConfig"></v-image>
|
||||
</v-layer>
|
||||
<v-layer>
|
||||
<template v-for="(item, key) in content.blocks">
|
||||
<v-text v-if="item.type === 'text'" :config="item"
|
||||
@dragmove="onMove($event, item)"
|
||||
@mousedown="handleStageMouseDown($event, item)"
|
||||
@transform="handleTransformEnd"
|
||||
@transformend="handleTransformEnd"></v-text>
|
||||
<v-image v-else-if="item.type === 'image'" :config="item"
|
||||
@dragmove="onMove($event, item)"
|
||||
@mousedown="handleStageMouseDown($event, item)"
|
||||
@transform="handleTransformEnd"
|
||||
@transformend="handleTransformEnd"></v-image>
|
||||
<v-image v-else-if="item.type === 'qrcode'" :config="item"
|
||||
@dragmove="onMove($event, item)"
|
||||
@mousedown="handleStageMouseDown($event, item)"
|
||||
@transform="handleTransformEnd"
|
||||
@transformend="handleTransformEnd"></v-image>
|
||||
|
||||
</template>
|
||||
|
||||
<v-transformer ref="transformer"/>
|
||||
</v-layer>
|
||||
</v-stage>
|
||||
</div>
|
||||
<div v-else>资源加载中...</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -39,7 +39,8 @@
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['shop:goodsInfo:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -49,7 +50,8 @@
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['shop:goodsInfo:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -59,7 +61,8 @@
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['shop:goodsInfo:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -68,7 +71,8 @@
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['shop:goodsInfo:export']"
|
||||
>导出</el-button>
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -94,13 +98,15 @@
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['shop:goodsInfo:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['shop:goodsInfo:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -117,12 +123,16 @@
|
||||
<el-dialog :title="title" v-model="open" width="700px" append-to-body draggable>
|
||||
<el-form ref="goodsInfoRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="12"><el-form-item label="编码" prop="goodsNo">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="编码" prop="goodsNo">
|
||||
<el-input v-model="form.goodsNo" placeholder="请输入编码"/>
|
||||
</el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="名称" prop="goodsName">
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="名称" prop="goodsName">
|
||||
<el-input v-model="form.goodsName" placeholder="请输入名称"/>
|
||||
</el-form-item></el-col>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="产地" prop="goodsPlace">
|
||||
<!-- <el-input v-model="form.goodsPlace" placeholder="请输入产地" />-->
|
||||
@ -267,23 +277,20 @@ const checkGoodsStock = (rules,value,callback)=>{
|
||||
}
|
||||
//商品价格规则校验
|
||||
const checkGoodsPrice = (rules, value, callback) => {
|
||||
console.log()
|
||||
if (value !== '' && value !== null) {
|
||||
if (value < 0) {
|
||||
callback(new Error('商品价格不能为负数'))
|
||||
} else {
|
||||
if(value.indexOf(".") !==0) {
|
||||
if (!/^(([^0][0-9]+|0)\.([0-9])$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]{1,3})$)|^(([1-9]+)$)/.test(value)) {
|
||||
//首位为小数点
|
||||
if (value.substr(0, 1) === '.') {
|
||||
callback(new Error('商品价格输入格式不正确'))
|
||||
} else if (!/^(([^0][0-9]+|0)\.([0-9])$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]{1,3})$)|^(([1-9]+)$)/.test(value)) {
|
||||
callback(new Error('商品价格最多保留三位小数'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}else {
|
||||
if(value.substr(0,1) === '.'){
|
||||
callback(new Error('商品价格输入格式不正确'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
callback(new Error('商品价格不能为空'))
|
||||
}
|
||||
@ -291,8 +298,10 @@ const checkGoodsPrice = (rules,value,callback)=>{
|
||||
|
||||
const options = regionDataPlus
|
||||
const GoodsOptions = [
|
||||
{value: 'kg',
|
||||
label: '千克'},
|
||||
{
|
||||
value: 'kg',
|
||||
label: '千克'
|
||||
},
|
||||
{
|
||||
value: '袋',
|
||||
label: '袋'
|
||||
@ -518,7 +527,8 @@ function handleDelete(row) {
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
|
Reference in New Issue
Block a user