HINOTOR 2 years ago
parent fb1c686b84
commit 7fdd9ab31f

@ -18,11 +18,10 @@
<div class="rentTime">
<div style="margin-left: -300px;font-weight: 700;margin-top: 30px">选择配置</div>
<el-radio-group size="medium" v-model="totalDay" @change="chooseDay">
<el-radio-button label="黑色"></el-radio-button>
<el-radio-button label="白色"></el-radio-button>
<el-radio-button label="粉色"></el-radio-button>
<el-radio-button label="灰色"></el-radio-button>
<el-radio-button label="蓝色"></el-radio-button>
<el-radio-button label="雅川青"></el-radio-button>
<el-radio-button label="白沙银"></el-radio-button>
<el-radio-button label="南糯紫"></el-radio-button>
<el-radio-button label="雅丹黑"></el-radio-button>
</el-radio-group>
</div>
<div class="rentPrice">
@ -34,9 +33,10 @@
<div class="total">
<div style="margin-left: -300px;font-weight: 700;margin-top: 30px">总计</div>
<div class="totalPrice">
<span class="totalPrice">¥{{totalPrice}}</span>
<span class="totalPrice">¥{{this.detail.goodsPrice}}</span>
</div>
</div>
<el-button type="primary" style="margin-top: 10px" @click="addGoodsInCart(1)" icon="el-icon-shopping-cart-1">加入购物车</el-button>
</el-main>
</el-container>
</div>
@ -45,6 +45,7 @@
<script>
import {goodsDetail} from '@/api/categoryAndGoods'
import {addOrder,addOrderItem} from "@/api/orderAndOrderItems"
import {addCart} from "@/api/cart";
export default {
name: "head",
data(){
@ -99,6 +100,25 @@ name: "head",
getImgUrl(imgId){
return this.$store.state.baseUrl+"/img/"+imgId+".jpg"
},
async addGoodsInCart(goodsId){
try{
await addCart({
"goodsId":goodsId
}).then((data)=>{
console.log(data);
this.openSuccess()
})
}catch (e) {
console.log(e)
}
},
openSuccess() {
this.$message({
message: '恭喜你,添加成功!',
type: 'success'
});
},
async rent(){
if(this.$store.state.isLogin){
try{
@ -138,7 +158,8 @@ name: "head",
}else {
alert("请先登录!")
}
}
},
},
//

@ -3,7 +3,7 @@
<el-card class="carousel-card" shadow="hover">
<el-carousel indicator-position="outside" height="700px">
<el-carousel-item v-for="item in carouselList" v-bind:key="item.configId">
<img :src="getImgUrl(item.goodsCoverImg)" style="height: auto" @click="toSearch(item.configName)">
<img :src="getImgUrl(3)" style="width: 100%;height: auto" @click="toDetail(1)">
</el-carousel-item>
</el-carousel>
</el-card>
@ -44,6 +44,14 @@ name: "carousel",
getImgUrl(imgId){
return this.$store.state.baseUrl+"/img/"+imgId+".jpg"
},
toDetail(key){
this.$store.commit("commitDetailGoodsId",key)
this.$router.push({
name:'detail',
query:{
t: Date.now(),
}})
}
},
data(){
@ -61,7 +69,6 @@ name: "carousel",
beforeRouteUpdate(){
this.getIndexList()
}
}
</script>

@ -2,15 +2,15 @@
<div class="home-discount">
<span class="discount-title">今日优惠Discount</span>
<div class="discount-card-div">
<el-card class="discount-card" style="margin-right: 100px" v-for="item in discountList" v-bind:key="item.configId" shadow="hover">
<img :src="getImgUrl(item.goodsCoverImg)" style="width: 100%;height: auto" @click="toSearch(item.configName)">
<el-card class="discount-card" style="margin-right: 100px" shadow="hover">
<img :src="getImgUrl(11)" style="width: 100%;height: auto" @click="toDetail(11)">
</el-card>
</div>
</div>
</template>
<script>
import {indexList} from "@/api";
import {indexList} from "@/api/index";
export default {
name: "discount",
@ -29,7 +29,7 @@ export default {
async getIndexList(){
try{
await indexList({
"indexType":2
"indexType":3
}).then((data)=>{
this.discountList=data
console.log(this.discountList)
@ -44,7 +44,14 @@ export default {
getImgUrl(imgId){
return this.$store.state.baseUrl+"/img/"+imgId+".jpg"
},
toDetail(key){
this.$store.commit("commitDetailGoodsId",key)
this.$router.push({
name:'detail',
query:{
t: Date.now(),
}})
}
},
data(){
return{
@ -74,14 +81,6 @@ div.discount-card-div{
justify-content: center;
padding-left: 80px;
}
.discount-card{
width: 600px;
height: 350px;
/*display: flex;*/
/*flex-direction: row;*/
/*justify-content: center;*/
margin: 0 auto;
}
span.discount-title{
font-weight: 700;

@ -1,22 +1,11 @@
<template>
<div class="home-recommend">
<span class="recommend-title">为您推荐Recommend</span>
<div class="home-recommend-body">
<div class="recommend-card-div">
<el-card class="recommend-card" style="width: 100%;height: auto" shadow="hover">
<div class="recommend-row" style="width: 100%;height:auto">
<el-carousel :interval="3000" type="card" class="recommend-row-carousel">
<el-carousel-item v-for="item in recommendList" v-bind:key="item.configId">
<img class="recommend-row-item-img" :src="getImgUrl(item.goodsCoverImg)" @click="toSearch(item.configName)">
</el-carousel-item>
</el-carousel>
</div>
</el-card>
</div>
<div class="recommend-card-div">
<el-card class="recommend-card" style="margin-right: 100px" shadow="hover">
<img :src="getImgUrl(6)" style="width: 100%;height: auto" @click="toSearch(item.configName)">
</el-card>
</div>
</div>
</template>
@ -76,49 +65,15 @@ name: "recommend",
</script>
<style scoped>
div.home-recommend-body{
div.recommend-card-div{
display: flex;
flex-direction: row;
justify-content: center;
}
div.recommend-card-div{
width: 91%;
height: auto;
padding-left: 80px;
}
span.recommend-title{
font-weight: 700;
color: #111111;
font-size: 37px;
}
.recommend-row{
display: flex;
flex-direction: row;
justify-content: center;
margin-top: 30px;
padding: 20px;
}
.recommend-row-item{
/*display: flex;*/
/*flex-direction: column;*/
/*justify-content: center;*/
/*width: 600px;*/
/*height: 400px;*/
/*margin-left: 30px;*/
padding: 0;
}
img.recommend-row-item-img{
width: 100%;
height: 300px;
border-radius: 5px;
}
.recommend-row-carousel{
width: 100%;
}
</style>
<style>
.recommend-row-item{
/*padding: 30px;*/
}
</style>

@ -29,23 +29,6 @@
</td>
<td>
<el-input-number v-model="item.goodsCount" :min="1" :max="100" label="物品数量" @change="calSingleTotalPrice(item)"></el-input-number></td>
<td>
<el-date-picker
v-model="item.createTime"
type="date"
placeholder="选择租赁起始日期"
@change="calTotalDay(item)">
</el-date-picker>
</td>
<td>
<el-date-picker
v-model="item.endTime"
type="date"
placeholder="选择租赁结束日期"
@change="calTotalDay(item)"
>
</el-date-picker>
</td>
<td>
<el-dialog
title="删除"
@ -70,7 +53,7 @@
</span>
</div>
<div class="createOrder">
<el-button type="success" class="createOrderButton" @click="addOrder"></el-button>
<el-button type="success" class="createOrderButton" @click="openSuccess"></el-button>
</div>
</el-card>
@ -162,10 +145,10 @@ name: "cart",
},
//
calSingleTotalPrice(item){
item.singleTotalPrice=item.price*item.goodsCount*item.totalDay
item.TotalPrice=item.goodsPrice*item.goodsCount
this.calTotalPrice()
console.log(item.totalDay)
console.log(item.singleTotalPrice);
console.log(item.TotalPrice);
},
//
calTotalDay(item){

@ -1,6 +1,6 @@
//一些全局状态量
const state={
baseUrl: "http://localhost:8088",
baseUrl: "http://localhost:8080",
searchKey:"",
detailGoodsId:"",
editEntrustId:"",

@ -1,6 +1,6 @@
import axios from 'axios'
axios.defaults.baseURL = 'http://localhost:8088'//后端地址
axios.defaults.baseURL = 'http://localhost:8080'//后端地址
axios.defaults.withCredentials = true
axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest'
axios.defaults.headers['authToken'] = localStorage.getItem('token') || '' //每次请求都使用token,登录后由shiro发布的sessionId

Loading…
Cancel
Save