商品详情页面 2.0
parent
49e12e5f3a
commit
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'
|
||||
})
|
||||
}
|
|
@ -80,17 +80,17 @@ export const constantRoutes = [
|
|||
redirect: 'product-detail',
|
||||
children: [
|
||||
{
|
||||
path: 'product-detail',
|
||||
component: () => import('@/views/product/shop/index'),
|
||||
path: 'product-detail/:detailId(\\d+)',
|
||||
component: () => import('@/views/product/info/detail/index'),
|
||||
name: 'ShopProduct',
|
||||
meta: {title: '商品详情', icon: 'dashboard', affix: true}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/gb',
|
||||
component: detail
|
||||
},
|
||||
// {
|
||||
// path: '/gb',
|
||||
// component: detail
|
||||
// },
|
||||
{
|
||||
path: '/user',
|
||||
component: Layout,
|
||||
|
|
|
@ -92,47 +92,57 @@
|
|||
:label="value" :key="value" :value="value" border>{{value}}</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model="form.num" :min="1" :max="10" label="描述文字"></el-input-number>
|
||||
<el-input-number v-model="form.num" :min="1" :max="10" label="描述文字" ></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" >加入购物车</el-button>
|
||||
<el-button>立即购买</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
总价格{{num}}
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 50px">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span style="">商品详情</span>
|
||||
</div>
|
||||
<el-descriptions title="分组1" :column="1">
|
||||
<el-descriptions-item label="用户名">kooriookami</el-descriptions-item>
|
||||
<el-descriptions-item label="手机号">18100000000</el-descriptions-item>
|
||||
<el-descriptions-item label="居住地">苏州市</el-descriptions-item>
|
||||
<el-descriptions-item label="联系地址">江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions title="其他属性" :column="1">
|
||||
<el-descriptions-item label="用户名">kooriookami</el-descriptions-item>
|
||||
<el-descriptions-item label="手机号">18100000000</el-descriptions-item>
|
||||
<el-descriptions-item label="居住地">苏州市</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">
|
||||
<el-tag size="small">学校</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系地址">江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions v-for="item in receivedShop.attributeGroupList" :title="attributeGroup.groupName" :column="1" >
|
||||
<el-descriptions-item v-for="attribute in item.attributeList" :label="attribute.name">
|
||||
{{attributeMap[attribute.id]}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
|
||||
<el-descriptions v-if=" receivedShop.attributeInfoList.length !==0"
|
||||
title="其他属性" :column="1" >
|
||||
<el-descriptions-item v-for="attributeInfo in receivedShop.attributeInfoList"
|
||||
:label="attributeInfo.name">
|
||||
{{attributeMap[attributeInfo.id]}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions v-if=" receivedShop.attributeInfoList.length !==0"
|
||||
title="其他属性" :column="1" >
|
||||
<el-descriptions-item v-for="attributeInfo in receivedShop.attributeInfoList"
|
||||
:label="attributeInfo.name">
|
||||
{{attributeMap[attributeInfo.id]}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
|
||||
<editor v-model="editorValue" :read-only="true"></editor>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getInfo} from "@/api/product/info";
|
||||
import {getDetailInfo} from "@/api/product/info";
|
||||
|
||||
export default {
|
||||
name: "Detailindex",
|
||||
name: "productDetail",
|
||||
data() {
|
||||
return {
|
||||
breadcrumbList: [
|
||||
|
@ -149,29 +159,51 @@ export default {
|
|||
price: 0
|
||||
},
|
||||
shopData: {},
|
||||
receivedShop: {},
|
||||
receivedShop: {
|
||||
projectInfo: {
|
||||
name: ""
|
||||
},
|
||||
brandInfo: {
|
||||
nam: ""
|
||||
},
|
||||
attributeInfoList: []
|
||||
},
|
||||
num: 1,
|
||||
editorValue: "阿萨德刚",
|
||||
attributeMap: [],
|
||||
// 商品轮播图
|
||||
Products: [],
|
||||
checkSkuInfo: {
|
||||
price : 0.00
|
||||
},
|
||||
price: 0.00,
|
||||
attributeGroup: [],
|
||||
deadline2 : Date.now() + 1 * 10000 // 10小时 * 60分钟/小时 * 60秒/分钟 * 1000毫秒/秒
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
this.parseShopFromRoute();
|
||||
const detailId=this.$route.params && this.$route.params.detailId
|
||||
this.initProjectDetailInfo(detailId)
|
||||
// this.parseShopFromRoute();
|
||||
// 设置定时器
|
||||
const timerId = setTimeout(() => {
|
||||
// 时间到了,调用 hilarity 函数
|
||||
this.hilarity();
|
||||
clearTimeout(timerId);
|
||||
}, this.deadline2 - Date.now());
|
||||
|
||||
|
||||
},
|
||||
watch: {
|
||||
'form.num':{
|
||||
handler:"updateNum",
|
||||
immediate:true
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
updateNum() {
|
||||
this.num = this.price * this.form.num
|
||||
console.log("qqqqq",this.num)
|
||||
},
|
||||
hilarity() {
|
||||
this.$notify({
|
||||
title: "提示",
|
||||
|
@ -186,6 +218,7 @@ export default {
|
|||
this.form['rule'+index] = rule
|
||||
})
|
||||
this.selectRuleSku()
|
||||
|
||||
},
|
||||
selectRuleSku(){
|
||||
let ruleSize =this.receivedShop.ruleAttrAddModelList.length
|
||||
|
@ -199,24 +232,52 @@ export default {
|
|||
}
|
||||
this.checkSkuInfo= this.receivedShop.projectSkuInfoList.find(skuInfo => skuInfo.sku === sku)
|
||||
console.log("sdf",this.checkSkuInfo)
|
||||
console.log("ppp",this.checkSkuInfo.price)
|
||||
this.price = this.checkSkuInfo.price
|
||||
this.updateNum()
|
||||
},
|
||||
parseShopFromRoute() {
|
||||
// 尝试解析shop查询参
|
||||
this.receivedShop = this.$route.query.shop;
|
||||
// 确保receivedShop和data属性都存在,并且data下有name属性
|
||||
console.log("hhhh ",this.receivedShop); // 打印店铺名称
|
||||
// 图片轮播图
|
||||
let ccc = this.receivedShop.projectInfo.carouselImages.split(',')
|
||||
this.Products.push(...ccc)
|
||||
|
||||
let ruleAttrLength = this.receivedShop.ruleAttrAddModelList.length;
|
||||
console.log("hieng",ruleAttrLength)
|
||||
for (let index = 0 ;index < ruleAttrLength ;index++){
|
||||
this.form["rule"+index] = null
|
||||
}
|
||||
this.initSku()
|
||||
initProjectDetailInfo(detailId){
|
||||
getDetailInfo(detailId).then(response => {
|
||||
this.receivedShop = response.data
|
||||
console.log("商品",this.receivedShop)
|
||||
let ccc = this.receivedShop.projectInfo.carouselImages.split(',')
|
||||
this.Products.push(...ccc)
|
||||
this.receivedShop.productAttributeInfoList.map(productAttributeInfo => {
|
||||
let key =productAttributeInfo.attributeId;
|
||||
this.attributeMap[key] = productAttributeInfo["value"]
|
||||
})
|
||||
|
||||
let ruleAttrLength = this.receivedShop.ruleAttrAddModelList.length;
|
||||
console.log("hieng",ruleAttrLength)
|
||||
for (let index = 0 ;index < ruleAttrLength ;index++){
|
||||
this.form["rule"+index] = null
|
||||
}
|
||||
console.log("shjo",this.receivedShop.ruleAttrAddModelList)
|
||||
this.initSku()
|
||||
})
|
||||
},
|
||||
//商品列表
|
||||
// parseShopFromRoute() {
|
||||
// // 尝试解析shop查询参
|
||||
// this.receivedShop = this.$route.query.shop;
|
||||
// // 确保receivedShop和data属性都存在,并且data下有name属性
|
||||
// console.log("hhhh ",this.receivedShop); // 打印店铺名称
|
||||
// // 图片轮播图
|
||||
// let ccc = this.receivedShop.projectInfo.carouselImages.split(',')
|
||||
// this.Products.push(...ccc)
|
||||
// this.receivedShop.productAttributeInfoList.map(productAttributeInfo => {
|
||||
// let key =productAttributeInfo.attributeId;
|
||||
// this.attributeMap[key] = productAttributeInfo["value"]
|
||||
// })
|
||||
//
|
||||
// let ruleAttrLength = this.receivedShop.ruleAttrAddModelList.length;
|
||||
// console.log("hieng",ruleAttrLength)
|
||||
// for (let index = 0 ;index < ruleAttrLength ;index++){
|
||||
// this.form["rule"+index] = null
|
||||
// }
|
||||
// console.log("shjo",this.receivedShop.ruleAttrAddModelList)
|
||||
// this.initSku()
|
||||
// },
|
||||
},
|
||||
beforeDestroy() {
|
||||
}
|
||||
|
|
|
@ -115,6 +115,9 @@
|
|||
<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 class="link-type" @click="toProjectDetail(scope.row.id)">
|
||||
商品詳情
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
@ -555,8 +558,8 @@ export default {
|
|||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -564,6 +567,10 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
toProjectDetail(detailId){
|
||||
let url = `${window.location.origin}/product-detail/${detailId}`;
|
||||
window.open(url)
|
||||
},
|
||||
oneSetting(){
|
||||
this.skuList.forEach(skuInfo => {
|
||||
console.log(skuInfo)
|
||||
|
@ -573,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++) {
|
||||
|
@ -784,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