Compare commits
2 Commits
75dfd973ba
...
0fd6bb2b39
Author | SHA1 | Date |
---|---|---|
|
0fd6bb2b39 | |
|
59913537a6 |
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询【请填写功能名称】列表
|
||||
export function listShoppingcard(query) {
|
||||
return request({
|
||||
url: '/product/shoppingcard/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询【请填写功能名称】详细
|
||||
export function getShoppingcard(id) {
|
||||
return request({
|
||||
url: '/product/shoppingcard/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增【请填写功能名称】
|
||||
export function addShoppingcard(data) {
|
||||
return request({
|
||||
url: '/product/shoppingcard',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改【请填写功能名称】
|
||||
export function updateShoppingcard(data) {
|
||||
return request({
|
||||
url: '/product/shoppingcard/'+data.id,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除【请填写功能名称】
|
||||
export function delShoppingcard(id) {
|
||||
return request({
|
||||
url: '/product/shoppingcard/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询购物车列表
|
||||
export function listInfo(query) {
|
||||
return request({
|
||||
url: '/shopCart/info/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询购物车详细
|
||||
export function getInfo(id) {
|
||||
return request({
|
||||
url: '/shopCart/info/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增购物车
|
||||
export function addInfo(data) {
|
||||
return request({
|
||||
url: '/shopCart/info',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改购物车
|
||||
export function updateInfo(data) {
|
||||
return request({
|
||||
url: '/shopCart/info/'+data.id,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除购物车
|
||||
export function delInfo(id) {
|
||||
return request({
|
||||
url: '/shopCart/info/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -558,8 +558,8 @@ export default {
|
|||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -580,22 +580,21 @@ export default {
|
|||
})
|
||||
},
|
||||
changeRule(ruleId){
|
||||
console.log("ruleId",ruleId)
|
||||
this.titleList = []
|
||||
let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id === ruleId);
|
||||
|
||||
let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id == ruleId);
|
||||
console.log("ruleInfo",ruleInfo)
|
||||
const {ruleAttrList} = ruleInfo;
|
||||
|
||||
console.log(ruleInfo)
|
||||
console.log(ruleAttrList)
|
||||
let skuTotal = 1;
|
||||
for (let ruleAttrListKey in ruleAttrList) {
|
||||
let ruleAttrInfo = ruleAttrList[ruleAttrListKey];
|
||||
this.titleList.push({
|
||||
"label":ruleAttrInfo.name,
|
||||
"prop":"prop"+ruleAttrListKey
|
||||
})
|
||||
skuTotal = skuTotal * ruleAttrInfo.valueList.length;
|
||||
}
|
||||
for (let ruleAttrListKey of Object.keys(ruleAttrList)) {
|
||||
let ruleAttrInfo = ruleAttrList[ruleAttrListKey];
|
||||
this.titleList.push({
|
||||
"label": ruleAttrInfo.name,
|
||||
"prop": "prop" + ruleAttrListKey
|
||||
});
|
||||
skuTotal *= ruleAttrInfo.valueList.length;
|
||||
}
|
||||
this.titleList.push(...this.templateTitleList) ;
|
||||
this.skuList = [];
|
||||
for (let i = 0; i < skuTotal; i++) {
|
||||
|
@ -791,7 +790,7 @@ export default {
|
|||
this.oneSettingForm = response.data.projectSkuInfos
|
||||
this.categoryOptionValue = [Number(response.data.mianType),Number(response.data.parentType),Number(response.data.type)]
|
||||
this.changeRule(response.data.ruleId)
|
||||
console.log("sku",this.skuList)
|
||||
console.log("sku",this.changeRule)
|
||||
console.log("skuu",response.data.projectSkuInfos)
|
||||
for (var i = 0; i < this.skuList.length; i++) {
|
||||
this.$set(this.skuList[i], 'image', response.data.projectSkuInfos[i].image);
|
||||
|
|
|
@ -0,0 +1,392 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="登录人的id" prop="uiserId">
|
||||
<el-input
|
||||
v-model="queryParams.uiserId"
|
||||
placeholder="请输入登录人的id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品id" prop="projectId">
|
||||
<el-input
|
||||
v-model="queryParams.projectId"
|
||||
placeholder="请输入商品id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input
|
||||
v-model="queryParams.quantity"
|
||||
placeholder="请输入数量"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input
|
||||
v-model="queryParams.price"
|
||||
placeholder="请输入价格"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createdAt">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.createdAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="修改时间" prop="updatedAt">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.updatedAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择修改时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否选中" prop="selected">
|
||||
<el-input
|
||||
v-model="queryParams.selected"
|
||||
placeholder="请输入是否选中"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品属性id" prop="attributeId">
|
||||
<el-input
|
||||
v-model="queryParams.attributeId"
|
||||
placeholder="请输入商品属性id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="小计金额" prop="subtotal">
|
||||
<el-input
|
||||
v-model="queryParams.subtotal"
|
||||
placeholder="请输入小计金额"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="queryParams.remarks"
|
||||
placeholder="请输入备注"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['product:shoppingcard:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['product:shoppingcard:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['product:shoppingcard:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['product:shoppingcard:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="shoppingcardList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="购物车主键" align="center" prop="id" />
|
||||
<el-table-column label="登录人的id" align="center" prop="uiserId" />
|
||||
<el-table-column label="商品id" align="center" prop="projectId" />
|
||||
<el-table-column label="数量" align="center" prop="quantity" />
|
||||
<el-table-column label="价格" align="center" prop="price" />
|
||||
<el-table-column label="创建时间" align="center" prop="createdAt" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="修改时间" align="center" prop="updatedAt" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态(0,未提交,1已提交)" align="center" prop="status" />
|
||||
<el-table-column label="是否选中" align="center" prop="selected" />
|
||||
<el-table-column label="商品属性id" align="center" prop="attributeId" />
|
||||
<el-table-column label="小计金额" align="center" prop="subtotal" />
|
||||
<el-table-column label="备注" align="center" prop="remarks" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['product:shoppingcard:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['product:shoppingcard:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改【请填写功能名称】对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="登录人的id" prop="uiserId">
|
||||
<el-input v-model="form.uiserId" placeholder="请输入登录人的id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品id" prop="projectId">
|
||||
<el-input v-model="form.projectId" placeholder="请输入商品id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入价格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createdAt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.createdAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="修改时间" prop="updatedAt">
|
||||
<el-date-picker clearable
|
||||
v-model="form.updatedAt"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择修改时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否选中" prop="selected">
|
||||
<el-input v-model="form.selected" placeholder="请输入是否选中" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品属性id" prop="attributeId">
|
||||
<el-input v-model="form.attributeId" placeholder="请输入商品属性id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="小计金额" prop="subtotal">
|
||||
<el-input v-model="form.subtotal" placeholder="请输入小计金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="form.remarks" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listShoppingcard, getShoppingcard, delShoppingcard, addShoppingcard, updateShoppingcard } from "@/api/product/shoppingcard";
|
||||
|
||||
export default {
|
||||
name: "Shoppingcard",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 【请填写功能名称】表格数据
|
||||
shoppingcardList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
uiserId: null,
|
||||
projectId: null,
|
||||
quantity: null,
|
||||
price: null,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
status: null,
|
||||
selected: null,
|
||||
attributeId: null,
|
||||
subtotal: null,
|
||||
remarks: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询【请填写功能名称】列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listShoppingcard(this.queryParams).then(response => {
|
||||
this.shoppingcardList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
uiserId: null,
|
||||
projectId: null,
|
||||
quantity: null,
|
||||
price: null,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
status: null,
|
||||
selected: null,
|
||||
attributeId: null,
|
||||
subtotal: null,
|
||||
remarks: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加【请填写功能名称】";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getShoppingcard(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改【请填写功能名称】";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateShoppingcard(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addShoppingcard(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delShoppingcard(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('product/shoppingcard/export', {
|
||||
...this.queryParams
|
||||
}, `shoppingcard_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,331 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="商品" prop="projectId">
|
||||
<el-input
|
||||
v-model="queryParams.projectId"
|
||||
placeholder="请输入商品"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="sku" prop="projectSku">
|
||||
<el-input
|
||||
v-model="queryParams.projectSku"
|
||||
placeholder="请输入sku"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户" prop="userId">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入用户"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="num">
|
||||
<el-input
|
||||
v-model="queryParams.num"
|
||||
placeholder="请输入数量"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否选中" prop="isSelected">
|
||||
<el-input
|
||||
v-model="queryParams.isSelected"
|
||||
placeholder="请输入是否选中"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['shopCart:info:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['shopCart:info:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['shopCart:info:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['shopCart:info:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键" align="center" prop="id" />
|
||||
<el-table-column label="商品" align="center" prop="projectId" />
|
||||
<el-table-column label="sku" align="center" prop="projectSku" />
|
||||
<el-table-column label="用户" align="center" prop="userId" />
|
||||
<el-table-column label="数量" align="center" prop="num" />
|
||||
<el-table-column label="是否选中" align="center" prop="isSelected" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['shopCart:info:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['shopCart:info:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改购物车对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="商品" prop="projectId">
|
||||
<el-input v-model="form.projectId" placeholder="请输入商品" />
|
||||
</el-form-item>
|
||||
<el-form-item label="sku" prop="projectSku">
|
||||
<el-input v-model="form.projectSku" placeholder="请输入sku" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="num">
|
||||
<el-input v-model="form.num" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否选中" prop="isSelected">
|
||||
<el-input v-model="form.isSelected" placeholder="请输入是否选中" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/shopCart/info";
|
||||
|
||||
export default {
|
||||
name: "Info",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 购物车表格数据
|
||||
infoList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: null,
|
||||
projectSku: null,
|
||||
userId: null,
|
||||
num: null,
|
||||
isSelected: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
projectId: [
|
||||
{ required: true, message: "商品不能为空", trigger: "blur" }
|
||||
],
|
||||
projectSku: [
|
||||
{ required: true, message: "sku不能为空", trigger: "blur" }
|
||||
],
|
||||
userId: [
|
||||
{ required: true, message: "用户不能为空", trigger: "blur" }
|
||||
],
|
||||
num: [
|
||||
{ required: true, message: "数量不能为空", trigger: "blur" }
|
||||
],
|
||||
isSelected: [
|
||||
{ required: true, message: "是否选中不能为空", trigger: "blur" }
|
||||
],
|
||||
createBy: [
|
||||
{ required: true, message: "创建人不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询购物车列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listInfo(this.queryParams).then(response => {
|
||||
this.infoList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
projectId: null,
|
||||
projectSku: null,
|
||||
userId: null,
|
||||
num: null,
|
||||
isSelected: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加购物车";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getInfo(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改购物车";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除购物车编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delInfo(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('shopCart/info/export', {
|
||||
...this.queryParams
|
||||
}, `info_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue