Commit 6567f99e by lixiaomin

修改bug

parent d936250a
...@@ -17,23 +17,20 @@ ...@@ -17,23 +17,20 @@
<el-table v-loading="loading" :data="spuList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="spuList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="商品名称" align="center" prop="name" /> <el-table-column label="商品名称" align="center" prop="name" />
<el-table-column label="制作时长" align="center" prop="takeTime" /> <el-table-column label="缩略图" align="center" prop="">
<el-table-column label="折扣价" align="center" prop="discount" /> <template slot-scope="scope">
<el-table-column label="原价" align="center" prop="price" /> <div class="image-tmp">
<!-- <el-table-column label="标签" align="center" prop="label" /> --> <el-image style="width: 100px; height: 100px" :src="getPicsList(scope.row.pics)" :preview-src-list="getPicsBigList(scope.row.pics)">
<el-table-column label="简介" align="center" prop="desc" /> <div slot="error" class="image-slot"></div>
<el-table-column label="备注" align="center" prop="remarks" /> </el-image>
<!-- <el-table-column </div>
label="上架时间"
align="center"
prop="shelfTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.shelfTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column label="状态" align="center" prop="status" /> <el-table-column label="商品分类" align="center" prop="categoryName"/>
<el-table-column label="售价" align="center" prop="price" />
<el-table-column label="折扣价" align="center" prop="discount" />
<el-table-column label="总销量" align="center" prop="salesVolume" />
<el-table-column label="上架时间" align="center" prop="shelfat" />
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" /> :limit.sync="queryParams.pageSize" @pagination="getList" />
...@@ -84,6 +81,16 @@ export default { ...@@ -84,6 +81,16 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
getPicsList(str){
let picObj = JSON.parse(str);
return picObj.thumbnail
},
getPicsBigList(str){
let list=[];
let picObj = JSON.parse(str);
list.push(picObj.thumbnail)
return list;
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
......
...@@ -161,11 +161,11 @@ export default { ...@@ -161,11 +161,11 @@ export default {
} }
}; };
var validateDiscount = (rule, value, callback) => { var validateDiscount = (rule, value, callback) => {
let regular = /^[+]{0,1}([1-9]+)$|^[+]{0,1}(\d+\.\d{2})$/ //正数(保留2位小数) var regular=/(^[+]{0,1}([1-9]+)$)|(^[+]{0,1}([1-9]+)[\.]{1}[0-9]{1,2}$)/; //正数(保留2位小数)
if (value == undefined || value === '') { if (value == undefined || value === '') {
callback(new Error('不能为空')); callback(new Error('不能为空'));
}else if(!regular.test(value)){ }else if(!regular.test(value)){
callback(new Error('请输入大于0的正数,保留2位小数')); callback(new Error('请输入大于0的正数,最多保留2位小数'));
}else if(this.form.price){ }else if(this.form.price){
if(value >= this.form.price){ if(value >= this.form.price){
callback(new Error('折扣价不能大于等于原价')); callback(new Error('折扣价不能大于等于原价'));
...@@ -176,12 +176,13 @@ export default { ...@@ -176,12 +176,13 @@ export default {
callback(); callback();
} }
}; };
var validatePrice = (rule, value, callback) => { var validatePrice = (rule, value, callback) => {
let regular = /^[+]{0,1}([1-9]+)$|^[+]{0,1}(\d+\.\d{2})$/ //正数(保留2位小数) //let regular = /(^[+]{0,1}([1-9]+)$)|(^[+]{0,1}(\d+\.\d{1,2})$)/ //正数(保留2位小数)
var regular=/(^[+]{0,1}([1-9]+)$)|(^[+]{0,1}([1-9]+)[\.]{1}[0-9]{1,2}$)/; //正数 ,小数可有可无,最多2位
if (value == undefined || value === '') { if (value == undefined || value === '') {
callback(new Error('不能为空')); callback(new Error('不能为空'));
}else if(!regular.test(value)){ }else if(!regular.test(value)){
callback(new Error('请输入大于0的正数,保留2位小数')); callback(new Error('请输入大于0的正数,最多保留2位小数'));
}else if(this.form.discount){ }else if(this.form.discount){
if(value<=this.form.discount){ if(value<=this.form.discount){
callback(new Error('原价不能小于等于折扣价')); callback(new Error('原价不能小于等于折扣价'));
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<el-button type="primary" @click="putShop">确 定</el-button> <el-button type="primary" @click="putShop">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="架" :visible.sync="dialogVisible2" width="30%"> <el-dialog title="架" :visible.sync="dialogVisible2" width="30%">
本商品已在店铺中上架,下架商品会在店铺中同时下架,是否确认下架? 本商品已在店铺中上架,下架商品会在店铺中同时下架,是否确认下架?
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible2 = false">取 消</el-button> <el-button @click="dialogVisible2 = false">取 消</el-button>
......
...@@ -190,7 +190,7 @@ export default { ...@@ -190,7 +190,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除编码为' + row.code + '的数据项?') .confirm('本商品已在店铺中上架,删除商品会在店铺中下架,是否确认删除?')
.then(function () { .then(function () {
return delSpu(ids); return delSpu(ids);
}) })
......
...@@ -33,11 +33,27 @@ ...@@ -33,11 +33,27 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="编码" align="center" prop="code" /> <el-table-column label="缩略图" align="center" prop="" width="150">
<template slot-scope="scope">
<div class="image-tmp">
<el-image style="width: 100px; height: 100px" :src="getPicsList(scope.row.pics)" :preview-src-list="getPicsBigList(scope.row.pics)">
<div slot="error" class="image-slot"></div>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column label="折扣价" align="center" prop="discount" /> <el-table-column label="折扣价" align="center" prop="discount" />
<el-table-column label="原价" align="center" prop="price" /> <el-table-column label="总销量" align="center" prop="salesVolume" />
<el-table-column label="销售总量" align="center" prop="salesVolume" /> <el-table-column label="上架时间" align="center" prop="shelfat" width="150" />
<el-table-column label="状态" align="center" prop="status" /> <el-table-column label="状态" align="center" prop="state" width="150">
<!-- <template slot-scope="scope">
<span v-if="scope.row.state == 1">已创建</span>
<span v-if="scope.row.state == 2">已完成编程</span>
<span v-if="scope.row.state == 3">已上架</span>
<span v-if="scope.row.state == 4">已下架</span>
<span v-if="scope.row.state == 5">已删除</span>
</template> -->
</el-table-column>
<el-table-column label="排序" align="center"> <el-table-column label="排序" align="center">
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
...@@ -84,6 +100,16 @@ export default { ...@@ -84,6 +100,16 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
getPicsList(str){
let picObj = JSON.parse(str);
return picObj.thumbnail
},
getPicsBigList(str){
let list=[];
let picObj = JSON.parse(str);
list.push(picObj.thumbnail)
return list;
},
addRecommend(data) { addRecommend(data) {
this.$refs.addRecommend.openModal(data) this.$refs.addRecommend.openModal(data)
}, },
......
<template> <template>
<!-- 添加或修改店铺对话框 --> <!-- 添加或修改店铺对话框 -->
<el-dialog title="店铺设置" :visible.sync="open" width="900px" append-to-body > <el-dialog title="店铺设置" :visible.sync="open" width="1200px" append-to-body >
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="店铺信息" name="first"> <el-tab-pane label="店铺信息" name="first">
<AddShop :shopId="shopId" @setShopId="setShopId" @closeDialog="closeHandle"/> <AddShop :shopId="shopId" @setShopId="setShopId" @closeDialog="closeHandle"/>
...@@ -55,13 +55,17 @@ export default { ...@@ -55,13 +55,17 @@ export default {
}, },
methods: { methods: {
setShopId(id) { this.shopId = id }, setShopId(id) { this.shopId = id },
handleClick(tab, event) { }, handleClick(tab, event) {
},
/** 新增按钮操作 */ /** 新增按钮操作 */
openModal(shopId) { openModal(shopId) {
this.setShopId(shopId) this.activeName='first';
this.setShopId(shopId);
this.open = true; this.open = true;
}, },
closeHandle () { closeHandle () {
this.activeName='first';
this.open = false // 控制取消和X按钮,关闭弹窗 this.open = false // 控制取消和X按钮,关闭弹窗
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment