第一次提交
This commit is contained in:
400
pages/bookShop/bookShopIndex.vue
Normal file
400
pages/bookShop/bookShopIndex.vue
Normal file
@@ -0,0 +1,400 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<view class="shopHeader">
|
||||
<!-- 顶部导航栏 -->
|
||||
<z-nav-bar title="健康超市"></z-nav-bar>
|
||||
<!-- 搜索 -->
|
||||
<!-- <view class="search" @click="goSearch()">
|
||||
<u-search placeholder="请输入需4545要的商品" v-model="keyword" :show-action="false"></u-search>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- 主盒子 -->
|
||||
<view class="indexBox">
|
||||
<!-- 轮播图 -->
|
||||
<view class="swiper_box">
|
||||
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
|
||||
<swiper-item v-for="(item,index) in swiperlist" :key="index">
|
||||
<view class="swiper-item">
|
||||
<image :src="item.image" mode="widthFix " class="swiperImg"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- 分类 -->
|
||||
<view class="head_line">
|
||||
<b></b>
|
||||
<text>商品分类</text>
|
||||
</view>
|
||||
<view class="classfy">
|
||||
<view v-for="(item,index) in gridArr" :key="index" @click='toClassify(item.catId,index)'>
|
||||
<!-- <u-icon v-if="item.icon" :name="item.icon" :size="46"></u-icon> -->
|
||||
<image :src="item.icon"></image>
|
||||
<text class="grid-text">{{item.name}}</text>
|
||||
</view>
|
||||
<br clear="both">
|
||||
</view>
|
||||
<!-- 商品展示 -->
|
||||
<view class="head_line">
|
||||
<b></b>
|
||||
<text>限时秒杀</text>
|
||||
<i @click="onShopMore('Sale')">查看更多 ></i>
|
||||
</view>
|
||||
<!-- 限时秒杀 -->
|
||||
<view class="limited">
|
||||
<view class="limitedSymbol">
|
||||
<image src="../../static/icon/shopping_xsh.png"></image>
|
||||
</view>
|
||||
<view class="limitedScrollBox">
|
||||
<u-scroll-list indicatorActiveColor="#27b386">
|
||||
<view class="limitedItem" v-for="(item,index) in seckillList" :key="index"
|
||||
@click="goDetail(item.prodInfo.productId)">
|
||||
<image :src="item.prodInfo.productImages" mode=""></image>
|
||||
<text class="biaoti">{{item.prodInfo.productName}}</text>
|
||||
<text class="xian">¥{{item.seckillPrice}}</text>
|
||||
<text class="yuan">¥{{item.prodInfo.price}}</text>
|
||||
</view>
|
||||
</u-scroll-list>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品展示 -->
|
||||
<view class="head_line">
|
||||
<b></b>
|
||||
<text>精选商品</text>
|
||||
<i @click="onShopMore('Hot')">查看更多 ></i>
|
||||
</view>
|
||||
<view class="goods">
|
||||
<view class="goodsItem" v-for="(item,index) in goodsList" :key="item.productId"
|
||||
@click="goDetail(item.productId)">
|
||||
<image :src="item.productImages" mode="" class="goodsImg"></image>
|
||||
<view class="goodsContent">
|
||||
<view class="goodsName">
|
||||
{{item.productName}}
|
||||
</view>
|
||||
<view class="goodsPrice">
|
||||
¥{{item.price}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<br clear="both">
|
||||
</view>
|
||||
<view style="height: 30rpx;"></view>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<music-play :playData="playData"></music-play>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import musicPlay from '@/components/music.vue'
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData:{},
|
||||
keyword: '', // 搜索索引值
|
||||
// 轮播图数据
|
||||
swiperlist: [{
|
||||
image: '../../static/icon/home_ban_1.jpg',
|
||||
},
|
||||
{
|
||||
image: '../../static/icon//home_ban_2.jpg',
|
||||
},
|
||||
{
|
||||
image: '../../static/icon//home_ban_3.jpg',
|
||||
}
|
||||
],
|
||||
totalCount: 4,
|
||||
pageSize: 1,
|
||||
totalPage: 4,
|
||||
currPage: 1,
|
||||
limit: 4,
|
||||
page: 1,
|
||||
istop: 1, // 是否是精选商品
|
||||
// 秒杀列表
|
||||
seckillList: [],
|
||||
// 商品列表
|
||||
goodsList: [],
|
||||
// 分类数据
|
||||
gridArr: [{
|
||||
icon: "list-dot",
|
||||
name: '更多'
|
||||
}],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
components: {
|
||||
musicPlay
|
||||
},
|
||||
onLoad() {
|
||||
// 获取分类
|
||||
this.$http
|
||||
.post('book/shopcategory/getOneLevel')
|
||||
.then(res => {
|
||||
// 用一个空数组去接分类数据
|
||||
let arr = []
|
||||
if (res.list.length >= 5) {
|
||||
for (let i in res.list) {
|
||||
if (i < 5) {
|
||||
arr.push({
|
||||
icon: "../../static/icon/shop_bar_" + (Number(i) + Number(1)) + ".png",
|
||||
name: res.list[i].name,
|
||||
catId: res.list[i].catId
|
||||
})
|
||||
}
|
||||
}
|
||||
arr.push({
|
||||
icon: "../../static/icon/shop_bar_more.png",
|
||||
name: '更多'
|
||||
})
|
||||
this.gridArr = arr
|
||||
}
|
||||
})
|
||||
|
||||
// 获取限时秒杀
|
||||
this.$http
|
||||
.get(`book/shopseckill/getSeckillProd`)
|
||||
.then(res => {
|
||||
this.seckillList = res.list
|
||||
console.log(this.seckillList)
|
||||
})
|
||||
|
||||
// 获取精选商品
|
||||
this.$http
|
||||
.post(`book/shopproduct/appGetList?limit=${this.limit}&page=${this.page}&istop=${this.istop}`)
|
||||
.then(
|
||||
res => {
|
||||
this.goodsList = res.page.list
|
||||
})
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 跳转详情页
|
||||
goDetail(id) {
|
||||
uni.navigateTo({
|
||||
url: './commodityDetail?id=' + id
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转分类页
|
||||
toClassify(catId, index) {
|
||||
if (catId) {
|
||||
uni.navigateTo({
|
||||
url: `./classify?type=${index}`
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: './classifyAll'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 跳转搜索页
|
||||
goSearch() {
|
||||
uni.navigateTo({
|
||||
url: './commoditySearch'
|
||||
})
|
||||
},
|
||||
|
||||
// 列表跳页
|
||||
onShopMore(e) {
|
||||
uni.navigateTo({
|
||||
url: './bookShopType?type=' + e
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.shopHeader {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.search {
|
||||
padding: 10rpx;
|
||||
background-color: #fff;
|
||||
margin: 10rpx 0;
|
||||
|
||||
}
|
||||
|
||||
.swiper_box {
|
||||
margin-top: 20rpx;
|
||||
padding: 0 20rpx;
|
||||
|
||||
.swiper-item {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 20rpx;
|
||||
|
||||
.swiperImg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.classfy {
|
||||
margin: 0 10rpx;
|
||||
border-radius: 30rpx;
|
||||
|
||||
view {
|
||||
float: left;
|
||||
width: 16.6%;
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.grid-text {
|
||||
font-size: 25rpx;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.head_line {
|
||||
margin: 30rpx 0 30rpx 0;
|
||||
padding: 10rpx;
|
||||
|
||||
b {
|
||||
display: inline-block;
|
||||
width: 12rpx;
|
||||
height: 40rpx;
|
||||
background-color: #54a966;
|
||||
vertical-align: bottom;
|
||||
margin: 0 20rpx 0 0;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
i {
|
||||
float: right;
|
||||
font-style: normal;
|
||||
color: #8b8a91;
|
||||
font-size: 24rpx;
|
||||
margin: 15rpx 35rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.limited {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
padding: 20rpx 10rpx 10rpx 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
margin-top: 10rpx;
|
||||
|
||||
.limitedSymbol {
|
||||
width: 22%;
|
||||
height: 300rpx;
|
||||
border-right: 1px solid #eee;
|
||||
vertical-align: middle;
|
||||
|
||||
image {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin: 45px auto 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
.limitedScrollBox {
|
||||
width: 76%;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.limitedItem {
|
||||
width: 200rpx;
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 150upx;
|
||||
height: 200upx;
|
||||
margin: 15rpx auto 20rpx auto;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 20rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.biaoti {
|
||||
font-size: 30rpx;
|
||||
margin: 10rpx 0 10rpx 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.xian {
|
||||
font-size: 32rpx;
|
||||
color: #bf0c0c;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.yuan {
|
||||
text-decoration: line-through;
|
||||
color: #c1c1c1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.goods {
|
||||
width: 100%;
|
||||
|
||||
|
||||
.goodsItem {
|
||||
display: inline-block;
|
||||
width: 46%;
|
||||
border-radius: 20rpx;
|
||||
padding: 25rpx 25rpx 20rpx 25rpx;
|
||||
margin: 0 20rpx 20rpx 20rpx;
|
||||
background-color: #fff;
|
||||
border: 1px solid #eee;
|
||||
|
||||
.goodsImg {
|
||||
width: 98%;
|
||||
height: 380rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.goodsContent {
|
||||
|
||||
.goodsName {
|
||||
margin-top: 10rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.goodsPrice {
|
||||
font-size: 30rpx;
|
||||
margin: 5rpx 0 0 3rpx;
|
||||
color: #bf0c0c;
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.goodsItem:nth-child(2n) {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
330
pages/bookShop/bookShopType.vue
Normal file
330
pages/bookShop/bookShopType.vue
Normal file
@@ -0,0 +1,330 @@
|
||||
<template>
|
||||
<view>
|
||||
<z-nav-bar :title="title"></z-nav-bar>
|
||||
|
||||
<view class="shop_list">
|
||||
<view class="sl_tioa" v-for="(item,index) in shopList" @click="onShopJump(item)">
|
||||
<image :src="item.productImages"></image>
|
||||
<view class="sl_cont">
|
||||
<view class="sl_tit">
|
||||
<text class="bok_name">
|
||||
{{item.productName}}
|
||||
<span v-if="item.productStock==0" style="color: #aaa;font-size:26rpx;">(无货)</span>
|
||||
</text>
|
||||
</view>
|
||||
<view class="sl_ric">
|
||||
¥{{item.price}}
|
||||
</view>
|
||||
<view class="sl_del" v-if="shopScreen.type == 'Sale'">
|
||||
¥{{item.oldprice}}
|
||||
</view>
|
||||
<view class="sl_gou" v-if="item.productStock>0" @click.stop="addShopCar(item)">
|
||||
<u-icon name="shopping-cart" :size="26" color="#eba00b"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<br clear="both">
|
||||
</view>
|
||||
<view style="height: 1px;"></view>
|
||||
</view>
|
||||
|
||||
|
||||
<view>
|
||||
<view v-if="status==0" style="text-align: center;">
|
||||
<u-loading-icon style="display: inline-block;"></u-loading-icon>
|
||||
<font style='vertical-align: super;margin-left: 10px;font-size: 26rpx;color: #909399;'>努力加载中</font>
|
||||
</view>
|
||||
<view v-if="status==1">
|
||||
<u-divider text="全部加载完成"></u-divider>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="padding-bottom: 20rpx;">
|
||||
<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top>
|
||||
</view>
|
||||
<music-play :playData="playData"></music-play>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import musicPlay from '@/components/music.vue'
|
||||
import $http from '@/config/requestConfig.js';
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData:{},
|
||||
scrollTop: 0,
|
||||
status: 3,
|
||||
shopScreen: {
|
||||
type: '',
|
||||
page: 1, //当前页码数
|
||||
limit: 5, //单页数据数量
|
||||
},
|
||||
productInfo: {},
|
||||
totalPage: 0,
|
||||
totalCount: 0,
|
||||
shopList: [],
|
||||
bgiStyle: {
|
||||
background: '#2ab58833'
|
||||
},
|
||||
iconStyle: {
|
||||
fontSize: '40rpx',
|
||||
fontWeight: 'bold',
|
||||
color: '#54a966',
|
||||
},
|
||||
urList: '',
|
||||
title: '',
|
||||
}
|
||||
},
|
||||
|
||||
// 返回顶部
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onReachBottom() {
|
||||
this.status = 0
|
||||
if (this.shopScreen.page < this.totalPage) {
|
||||
this.shopScreen.page = this.shopScreen.page + 1
|
||||
setTimeout(() => {
|
||||
if (this.shopScreen.type == 'Hot') {
|
||||
this.$http
|
||||
.post(this.urList + '?page=' + this.shopScreen.page + '&limit=' + this.shopScreen
|
||||
.limit)
|
||||
.then(res => {
|
||||
this.totalPage = res.page.totalPage
|
||||
this.totalCount = res.page.totalCount
|
||||
for (let i in res.page.list) {
|
||||
this.shopList.push(res.page.list[i])
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
this.status = 1
|
||||
}
|
||||
},
|
||||
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
this.shopScreen.type = e.type
|
||||
if (this.shopScreen.type == 'Sale') {
|
||||
this.urList = 'book/shopseckill/getSeckillProd'
|
||||
this.title = '限时秒杀'
|
||||
} else if (this.shopScreen.type == 'Hot') {
|
||||
this.urList = 'book/shopproduct/appGetList'
|
||||
this.title = '精选商品'
|
||||
}
|
||||
|
||||
this.getData();
|
||||
},
|
||||
//页面显示
|
||||
onShow() {
|
||||
// this.getData();
|
||||
},
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.getData()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
components: {
|
||||
musicPlay
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
// 获取列表数据
|
||||
getData() {
|
||||
console.log(this.urList)
|
||||
this.shopList = []
|
||||
if (this.shopScreen.type == 'Hot') {
|
||||
this.$http
|
||||
.post(this.urList + '?page=' + this.shopScreen.page + '&limit=' + this.shopScreen.limit)
|
||||
.then(res => {
|
||||
this.shopList = res.page.list
|
||||
this.totalPage = res.page.totalPage
|
||||
this.status = 3
|
||||
});
|
||||
} else if (this.shopScreen.type == 'Sale') {
|
||||
this.$http
|
||||
.get(this.urList)
|
||||
.then(res => {
|
||||
let arr = []
|
||||
for (let i in res.list) {
|
||||
arr.push({
|
||||
productImages: res.list[i].prodInfo.productImages,
|
||||
productName: res.list[i].prodInfo.productName,
|
||||
price: res.list[i].seckillPrice,
|
||||
oldprice: res.list[i].prodInfo.price,
|
||||
productId: res.list[i].prodInfo.productId,
|
||||
})
|
||||
}
|
||||
this.shopList = arr
|
||||
this.status = 3
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 加入购物车
|
||||
addShopCar(e) {
|
||||
this.$http
|
||||
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
|
||||
.then(res => {
|
||||
this.cartList = res.cartList
|
||||
// 统计商品信息
|
||||
let data = {
|
||||
"userId": this.userInfo.id,
|
||||
"productId": e.productId,
|
||||
"productAmount": 1,
|
||||
"price": e.price
|
||||
}
|
||||
console.log(e)
|
||||
// 判断列表是否为空
|
||||
if (this.cartList.length > 0) {
|
||||
let flag = ''
|
||||
let shagnpin = {}
|
||||
// 循环购物车列表
|
||||
flag = this.cartList.some((item, index) => {
|
||||
if (item.productId == data.productId) {
|
||||
shagnpin = item
|
||||
shagnpin.productAmount = item.productAmount + 1
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (flag) {
|
||||
// 已在购物车中添加
|
||||
$http.request({
|
||||
url: "book/ordercart/update",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: shagnpin,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 加入购物车
|
||||
$http.request({
|
||||
url: "book/ordercart/save",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 购物车列表为空时直接加入购物车
|
||||
$http.request({
|
||||
url: "book/ordercart/save",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 商品内容跳转
|
||||
onShopJump(e) {
|
||||
uni.navigateTo({
|
||||
url: './commodityDetail?id=' + e.productId
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
|
||||
|
||||
|
||||
|
||||
.shop_list {
|
||||
margin: 30rpx;
|
||||
|
||||
.sl_tioa {
|
||||
box-shadow: 0 0px 10px 1px #d3d1d133;
|
||||
background-color: #fff;
|
||||
padding: 25rpx;
|
||||
margin: 0 0 20rpx 0;
|
||||
border-radius: 15rpx;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 160upx;
|
||||
height: 240upx;
|
||||
float: left;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.sl_cont {
|
||||
float: left;
|
||||
|
||||
|
||||
.sl_tit {
|
||||
max-width: 420rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.sl_ric {
|
||||
color: #bf0c0c;
|
||||
font-weight: bold;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
.sl_del {
|
||||
text-decoration: line-through;
|
||||
color: #c1c1c1;
|
||||
font-size: 30rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.sl_gou {
|
||||
background-color: #fbf6ec;
|
||||
border-radius: 50rpx;
|
||||
padding: 5rpx;
|
||||
position: absolute;
|
||||
right: 50rpx;
|
||||
bottom: 40rpx;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
455
pages/bookShop/classify.vue
Normal file
455
pages/bookShop/classify.vue
Normal file
@@ -0,0 +1,455 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<z-nav-bar title="健康超市"></z-nav-bar>
|
||||
<!-- 一级分类 -->
|
||||
<view class="oneBox">
|
||||
<view class="oneLevel">
|
||||
<u-tabs :scrollable="false" :current="current" lineWidth="42" :inactiveStyle="{fontSize:'32rpx'}"
|
||||
:list="oneLevel" @click="getTowLevel" lineColor="#54a966"
|
||||
:activeStyle="{color: '#303133',fontWeight: 'bold', transform: 'scale(1.01)'}"></u-tabs>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="search_box" @click="onPageJump('../peanut/searchFor')">
|
||||
<text class="icon_search"></text>
|
||||
<text class="prompt">搜索...</text>
|
||||
</view> -->
|
||||
|
||||
<!-- 二级分类、商品 -->
|
||||
<view class="twoBox" style="">
|
||||
<!-- <u-sticky> -->
|
||||
<u-tabs v-if="utabs" :list="towLevel" :current = "0" :inactiveStyle="{fontSize:'28rpx'}" lineWidth="40" @click="getCategoryList"
|
||||
:activeStyle="{transform: 'scale(1.01)'}"></u-tabs>
|
||||
<!-- </u-sticky> -->
|
||||
</view>
|
||||
<view class="classfyBody">
|
||||
<!-- 二级分类、商品 -->
|
||||
<view class="towLevel" v-if="towLevel.length > 0">
|
||||
<view class="towLevelContent" v-if="commodityList && commodityList.length > 0">
|
||||
<view class="commodityItem" v-for="(item,index) in commodityList" :key="index"
|
||||
@click.stop="toDetail(item.productId)">
|
||||
<view class="box">
|
||||
<image :src="item.productImages" mode=""></image>
|
||||
<view class="commodityContent">
|
||||
<view class="commodityTitle">
|
||||
{{item.productName}}
|
||||
<span v-if="item.productStock==0" style="color: #aaa;font-size:26rpx;">(暂无库存)</span>
|
||||
</view>
|
||||
<view class="commodityPrice">
|
||||
<text class="price" v-if="item.price">¥
|
||||
<b style="font-size: 40rpx;">{{item.price}}</b>
|
||||
<span class="priceTag" v-if="item.activityPrice">原价:¥{{item.activityPrice}}</span>
|
||||
</text>
|
||||
<text class="SoldNumber" v-if="item.sumSales">已售<span>{{item.sumSales}}</span>件</text>
|
||||
<!-- <text class="icon" @click.stop="addShopCar(item)" v-if="item.productStock">
|
||||
<u-icon name="shopping-cart" :size="26" color="#eba00b"></u-icon>
|
||||
</text> -->
|
||||
<view class="publierInfo" v-if="item.author && item.publisher">
|
||||
<span class="c999 f24">{{item.author}}著</span><span class="c999 f24">/ {{item.publisher}}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else style="text-align: center;font-size: 30rpx;color: #888;margin: 20rpx 0 0 0;flex: 1;">
|
||||
暂无商品
|
||||
</view>
|
||||
</view>
|
||||
<view v-else style="text-align: center;font-size:30rpx;color: #888;margin: 50rpx 0 0 0;">
|
||||
暂无分类
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<u-back-top :scroll-top="scrollTop" bottom="60" :customStyle='bgiStyle' :iconStyle="iconStyle"></u-back-top>
|
||||
</view>
|
||||
<music-play :playData="playData"></music-play>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import musicPlay from '@/components/music.vue'
|
||||
import $http from '@/config/requestConfig.js';
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData:{},
|
||||
highlight: '', // 高亮下标
|
||||
current: 0,
|
||||
twocurrent:0,
|
||||
oneLevel: [],
|
||||
towLevel: [],
|
||||
commodityList: [] ,// 商品列表
|
||||
utabs:false,
|
||||
bgiStyle: {
|
||||
background: '#2ab58833'
|
||||
},
|
||||
iconStyle: {
|
||||
fontSize: '40rpx',
|
||||
fontWeight: 'bold',
|
||||
color: '#54a966',
|
||||
},
|
||||
scrollTop: 0,
|
||||
}
|
||||
},
|
||||
// contentButtonClick(e) {
|
||||
// console.log(e)
|
||||
// },
|
||||
// onLoad(e) {
|
||||
// //获取一级分类
|
||||
// this.$http
|
||||
// .post('book/shopcategory/getOneLevel')
|
||||
// .then(res => {
|
||||
// this.oneLevel = res.list
|
||||
// this.current = e.type
|
||||
// this.getTowLevel(this.oneLevel[e.type])
|
||||
// })
|
||||
// },
|
||||
//页面显示
|
||||
onShow() {
|
||||
this.getOneLevel()
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
mounted () {
|
||||
setTimeout(() => { // 解决vant-tab组件官方问题:底部条位置错误
|
||||
this.utabs = true
|
||||
}, 200)
|
||||
},
|
||||
components: {
|
||||
musicPlay
|
||||
},
|
||||
methods: {
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
// 跳转
|
||||
onPageJump(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
// 获取一级分类
|
||||
getOneLevel() {
|
||||
this.$http
|
||||
.post('book/shopcategory/getOneLevel')
|
||||
.then(res => {
|
||||
//console.log(res,'一级分类')
|
||||
this.oneLevel = res.list
|
||||
// this.current = e.type
|
||||
this.getTowLevel(this.oneLevel[0])
|
||||
})
|
||||
},
|
||||
// 点击一级分类
|
||||
getTowLevel(e) {
|
||||
this.utabs = false
|
||||
// this.twocurrent = 0;
|
||||
uni.showLoading()
|
||||
this.$http
|
||||
.post(`book/shopcategory/getTwoLevel?catId=${e.catId}`)
|
||||
.then(res => {
|
||||
//console.log(res,'二级分类')
|
||||
this.towLevel = res.list
|
||||
if (this.towLevel == '') {
|
||||
this.commodityList = []
|
||||
} else {
|
||||
let newo = {
|
||||
catId:0,
|
||||
name:'全部',
|
||||
parentCid:e.catId
|
||||
}
|
||||
this.towLevel.splice(0,0,newo)
|
||||
// this.getCategoryList(res.list[0])
|
||||
// console.log(this.towLevel, 'towLevel')
|
||||
this.getCategoryList(res.list[0])
|
||||
}
|
||||
uni.hideLoading()
|
||||
this.utabs = true
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
},
|
||||
|
||||
// 点击二级分类
|
||||
getCategoryList(e) {
|
||||
// console.log(e)
|
||||
// return false
|
||||
// this.highlight = index
|
||||
this.$http
|
||||
.post('book/shopproduct/appGetCategoryList', {
|
||||
'catId': e.catId
|
||||
})
|
||||
.then(res => {
|
||||
// console.log(res,'二级分类')
|
||||
this.commodityList = res.list
|
||||
})
|
||||
},
|
||||
// 加入购物车
|
||||
addShopCar(e) {
|
||||
this.$http
|
||||
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
|
||||
.then(res => {
|
||||
// 获得用户的购物车列表信息
|
||||
this.cartList = res.cartList
|
||||
// 统计商品信息
|
||||
let data = {
|
||||
"userId": this.userInfo.id,
|
||||
"productId": e.productId,
|
||||
"productAmount": 1,
|
||||
"price": e.price
|
||||
}
|
||||
// 判断列表是否为空
|
||||
if (this.cartList.length > 0) {
|
||||
let flag = ''
|
||||
let shagnpin = {}
|
||||
// 循环购物车列表
|
||||
flag = this.cartList.some((item, index) => {
|
||||
if (item.productId == data.productId) {
|
||||
shagnpin = item
|
||||
shagnpin.productAmount = item.productAmount + 1
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (flag) {
|
||||
// 已在购物车中添加
|
||||
$http.request({
|
||||
url: "book/ordercart/update",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: shagnpin,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 加入购物车
|
||||
$http.request({
|
||||
url: "book/ordercart/save",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
// 购物车列表为空时直接加入购物车
|
||||
$http.request({
|
||||
url: "book/ordercart/save",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: '加入购物车成功',
|
||||
duration: 1000,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 商品内容跳转
|
||||
toDetail(id) {
|
||||
uni.navigateTo({
|
||||
url: `./commodityDetail?id=${id}`
|
||||
})
|
||||
}
|
||||
},
|
||||
onPullDownRefresh(){
|
||||
// console.log('refresh');
|
||||
this.commodityList = []
|
||||
this.getOneLevel()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.publierInfo {
|
||||
display: inline-block;
|
||||
background-color: #f1f1f1;
|
||||
flex-direction: row;
|
||||
border-radius: 10px;
|
||||
vertical-align: middle;
|
||||
padding: 0 12rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
|
||||
.c999 {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.f24 {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.search_box {
|
||||
width: 90%;
|
||||
height: 64upx;
|
||||
background-color: #fff;
|
||||
border-radius: 32upx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0upx 40upx;
|
||||
position: relative;
|
||||
margin: 30rpx 0 15rpx -46%;
|
||||
left: 50%;
|
||||
box-shadow: 0 0px 10px 1px #54a96633;
|
||||
|
||||
.prompt {
|
||||
color: #cccccc;
|
||||
|
||||
}
|
||||
|
||||
.icon_search {
|
||||
background-image: url('@/static/icon/map_ic_search.png');
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
width: 29upx;
|
||||
height: 28upx;
|
||||
margin-right: 20upx;
|
||||
}
|
||||
}
|
||||
|
||||
.oneBox {
|
||||
margin: 10rpx auto;
|
||||
|
||||
.oneLevel {}
|
||||
}
|
||||
|
||||
.twoBox {
|
||||
width: 95%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.classfyBody {
|
||||
margin: 5rpx auto;
|
||||
// width: 100%;
|
||||
height: 100%;
|
||||
|
||||
|
||||
|
||||
.towLevel {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
||||
.towLevelTitle {
|
||||
width: 28%;
|
||||
height: auto;
|
||||
text-align: center;
|
||||
|
||||
.titleItem {
|
||||
font-size: 35rpx;
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #fff;
|
||||
border-left: solid 10rpx #eba00b;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.towLevelContent {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 10rpx 20rpx;
|
||||
width: 100%;
|
||||
align-items: stretch;
|
||||
// align-content:center;
|
||||
align-content:start;
|
||||
.commodityItem {
|
||||
width: 50%;
|
||||
// background-color: #fff;
|
||||
padding: 10rpx;
|
||||
|
||||
.box {
|
||||
background-color: #fff;
|
||||
padding: 10rpx;
|
||||
border-radius: 20rpx !important;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0px 10px 1px #54a96633;
|
||||
}
|
||||
|
||||
.commodityTitle {
|
||||
font-size: 32rpx;
|
||||
margin: 20rpx 0 10rpx 0;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
border-radius: 10rpx;
|
||||
height: 300rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.commodityContent {
|
||||
flex: 1;
|
||||
font-size: 16px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.commodityPrice {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
margin: 0 0 3rpx 0;
|
||||
|
||||
.price {
|
||||
vertical-align: middle;
|
||||
color: #ffa200;
|
||||
|
||||
.priceTag {
|
||||
flex-direction: row;
|
||||
color: #999;
|
||||
display: inline-block;
|
||||
zoom: .8;
|
||||
margin-left: 6rpx;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.SoldNumber {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
float: right;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.icon {
|
||||
background-color: #fbf6ec;
|
||||
border-radius: 50rpx;
|
||||
padding: 5rpx;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: -20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
78
pages/bookShop/classifyAll.vue
Normal file
78
pages/bookShop/classifyAll.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<view>
|
||||
<z-nav-bar title="全部分类"></z-nav-bar>
|
||||
<view class="oneLevel">
|
||||
<view class="oneItem" v-for="(item,index) in oneLevel" @click="getTowLevel(index)">
|
||||
<image :src="item.icon"></image>
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<music-play :playData="playData"></music-play>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import musicPlay from '@/components/music.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData:{},
|
||||
oneLevel: [],
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.$http
|
||||
.post('book/shopcategory/getOneLevel')
|
||||
.then(res => {
|
||||
let arr = []
|
||||
for (let i in res.list) {
|
||||
arr.push({
|
||||
icon: "../../static/icon/shop_bar_" + (Number(i) + Number(1)) + ".png",
|
||||
name: res.list[i].name,
|
||||
catId: res.list[i].catId
|
||||
})
|
||||
}
|
||||
this.oneLevel = arr
|
||||
})
|
||||
},
|
||||
components: {
|
||||
musicPlay
|
||||
},
|
||||
methods: {
|
||||
// 点击分类跳转
|
||||
getTowLevel(e) {
|
||||
uni.navigateTo({
|
||||
url: `./classify?type=${e}`
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.oneLevel {
|
||||
|
||||
margin: 10rpx 0 0 0;
|
||||
|
||||
|
||||
.oneItem {
|
||||
display: inline-block;
|
||||
width: 20%;
|
||||
text-align: center;
|
||||
margin: 30rpx 0 0 0;
|
||||
|
||||
image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
1301
pages/bookShop/commodityDetail.vue
Normal file
1301
pages/bookShop/commodityDetail.vue
Normal file
File diff suppressed because it is too large
Load Diff
284
pages/bookShop/commoditySearch.vue
Normal file
284
pages/bookShop/commoditySearch.vue
Normal file
@@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<view>
|
||||
<z-nav-bar>
|
||||
<u-search :clearabled="true" bgColor="#fff" borderColor="#54a966" focus v-model="bookScreen.bookName"
|
||||
@custom='souBook' @clear="clear"></u-search>
|
||||
</z-nav-bar>
|
||||
<view class="sear_ch" v-if="this.show==0">
|
||||
<view class="sear_ch_tit">
|
||||
历史搜索
|
||||
</view>
|
||||
<view class="sear_ch_tag">
|
||||
<text v-for="item in historyList" @click="serkeyWord(item)">{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sear_class" v-if="this.show==1">
|
||||
<view class="sc_xuan">
|
||||
<view class="sc_con" v-for="(item,index) in classFen" @click="FenBook(item)"
|
||||
:class="bookScreen.type == item.id ? 'sc_con sc_con_style' : 'sc_con'">{{item.sort}}</view>
|
||||
</view>
|
||||
<view class="sc_xuan">
|
||||
<view class="sc_con" v-for="(item,index) in classMian" @click="MianBook(item)"
|
||||
:class="bookScreen.is_charge == item.id ? 'sc_con sc_con_style' : 'sc_con'">{{item.sort}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sear_list" v-if="this.show==1">
|
||||
<view class="bl_tioa" v-for="(item,index) in bookList" @click="onBookJump(item)">
|
||||
|
||||
</view>
|
||||
<view style="height: 1px;"></view>
|
||||
<view>
|
||||
<view v-if="status==0" style="text-align: center;">
|
||||
<u-loading-icon style="display: inline-block;"></u-loading-icon>
|
||||
<font style='vertical-align: super;margin-left: 10px;font-size: 26rpx;color: #909399;'>努力加载中</font>
|
||||
</view>
|
||||
<view v-if="status==1">
|
||||
<u-divider text="全部加载完成"></u-divider>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view v-if="this.show==1&&this.bookList==''">
|
||||
<u-divider text="暂无数据"></u-divider>
|
||||
</view>
|
||||
<view style="padding-bottom: 20rpx;">
|
||||
<u-back-top :scroll-top="scrollTop"></u-back-top>
|
||||
</view>
|
||||
</view>
|
||||
<music-play :playData="playData"></music-play>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import musicPlay from '@/components/music.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData:{},
|
||||
scrollTop: 0,
|
||||
totalPage: 0,
|
||||
status: 3,
|
||||
show: 0,
|
||||
bookList: [],
|
||||
historyList: [],
|
||||
bookScreen: {
|
||||
authorName: '', //作者
|
||||
publisherName: '', //出版社
|
||||
type: '', //电子书类型
|
||||
bookName: '', //关键词
|
||||
is_charge: 1, //是否收费(0收费1免费)
|
||||
state: 1,
|
||||
page: 1, //当前页码数
|
||||
limit: 10, //单页数据数量
|
||||
},
|
||||
classFen: [{
|
||||
sort: '全部',
|
||||
id: ''
|
||||
}, {
|
||||
sort: '医学',
|
||||
id: 1
|
||||
}, {
|
||||
sort: '国学',
|
||||
id: 2
|
||||
}, {
|
||||
sort: '文学',
|
||||
id: 3
|
||||
}, {
|
||||
sort: '古籍',
|
||||
id: 4
|
||||
}],
|
||||
classMian: [{
|
||||
sort: '免费',
|
||||
id: 1
|
||||
}, {
|
||||
sort: 'VIP',
|
||||
id: 0
|
||||
}],
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
// 返回顶部
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onReachBottom() {
|
||||
this.status = 0
|
||||
if (this.bookScreen.page < this.totalPage) {
|
||||
this.bookScreen.page = this.bookScreen.page + 1
|
||||
setTimeout(() => {
|
||||
this.$http
|
||||
.post('book/book/list', this.bookScreen)
|
||||
.then(res => {
|
||||
this.totalPage = res.page.totalPage
|
||||
for (let i in res.page.list) {
|
||||
this.bookList.push(res.page.list[i])
|
||||
}
|
||||
});
|
||||
}, 1000)
|
||||
} else {
|
||||
this.status = 1
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
|
||||
},
|
||||
//页面显示
|
||||
onShow() {
|
||||
this.getHistory()
|
||||
},
|
||||
components: {
|
||||
musicPlay
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
// 获取缓存
|
||||
getHistory() {
|
||||
this.historyList = uni.getStorageSync('hisRecords')
|
||||
if (this.historyList.length > 10) {
|
||||
this.historyList.splice(10, this.historyList.length)
|
||||
uni.setStorageSync('hisRecords', this.historyList);
|
||||
}
|
||||
},
|
||||
|
||||
// 获取列表数据
|
||||
getData() {
|
||||
this.$http
|
||||
.post('book/book/list', this.bookScreen)
|
||||
.then(res => {
|
||||
this.bookList = res.page.list
|
||||
this.totalPage = res.page.totalPage
|
||||
this.status = 3
|
||||
this.show = 1
|
||||
});
|
||||
},
|
||||
|
||||
// 清空
|
||||
clear() {
|
||||
this.show = 0
|
||||
this.getHistory()
|
||||
},
|
||||
|
||||
// 搜索
|
||||
souBook() {
|
||||
if (this.bookScreen.bookName == '') {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入关键字'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.getData();
|
||||
|
||||
let ArryList = []
|
||||
if (uni.getStorageSync('hisRecords') == '') {
|
||||
ArryList.push(this.bookScreen.bookName)
|
||||
uni.setStorageSync('hisRecords', ArryList);
|
||||
} else {
|
||||
let value = uni.getStorageSync('hisRecords')
|
||||
value.unshift(this.bookScreen.bookName)
|
||||
uni.setStorageSync('hisRecords', value);
|
||||
}
|
||||
},
|
||||
|
||||
// 点击历史搜索
|
||||
serkeyWord(e) {
|
||||
this.bookScreen.bookName = e
|
||||
this.getData();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
|
||||
.sear_ch {
|
||||
margin: 50rpx 40rpx 0 40rpx;
|
||||
|
||||
.sear_ch_tit {
|
||||
font-weight: bold;
|
||||
font-size: 30rpx;
|
||||
margin: 40rpx 0 0 0;
|
||||
}
|
||||
|
||||
.sear_ch_tag {
|
||||
margin: 20rpx 0 0 0;
|
||||
|
||||
text {
|
||||
background-color: #eee;
|
||||
font-size: 24rpx;
|
||||
border-radius: 50rpx;
|
||||
display: inline-block;
|
||||
margin: 0 30rpx 20rpx 0;
|
||||
padding: 10rpx 25rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sear_class {
|
||||
margin: 20rpx 30rpx 60rpx 30rpx;
|
||||
|
||||
.sc_xuan {
|
||||
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.sc_con {
|
||||
display: inline-block;
|
||||
font-size: 28rpx;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 6rpx 12rpx;
|
||||
}
|
||||
|
||||
.sc_con_style {
|
||||
color: #27b386;
|
||||
background-color: #2ab58833;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sear_list {
|
||||
margin: 50rpx 30rpx 0 30rpx;
|
||||
|
||||
.bl_tioa {
|
||||
box-shadow: 0 0px 10px 1px #d3d1d133;
|
||||
background-color: #fff;
|
||||
position: relative;
|
||||
padding: 0 25upx 10upx 220upx;
|
||||
margin: 0 0 60rpx 0;
|
||||
border-radius: 15rpx;
|
||||
min-height: 250rpx;
|
||||
|
||||
view {
|
||||
|
||||
text {
|
||||
color: #9b9b9b;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.bok_name {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
position: absolute;
|
||||
left: 30upx;
|
||||
top: -20upx;
|
||||
width: 160upx;
|
||||
height: 240upx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
263
pages/bookShop/deliverDetail.vue
Normal file
263
pages/bookShop/deliverDetail.vue
Normal file
@@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<view class="header">
|
||||
<!-- 顶部导航栏 -->
|
||||
<z-nav-bar title="物流详情"></z-nav-bar>
|
||||
</view>
|
||||
<view class="" style="margin-bottom: 20rpx; font-size: 28rpx;">
|
||||
<view class="kuaidiItem">运单号: {{expressOrderSn}}
|
||||
<u-tag @click="copyData(expressOrderSn)" class="copyCode" text="复制" plain type="success" /></view>
|
||||
</view>
|
||||
<view v-if="deliverDetails.length > 0">
|
||||
<!-- <u-tabs active-color="#2979ff" inactive-color="#606266" bar-height="6" bar-width="40"
|
||||
name="name" :list="deliverList" :is-scroll="false" :current="current" @change="tabchange"></u-tabs> -->
|
||||
<view class="deliverCntent">
|
||||
<view class="">
|
||||
|
||||
<view v-for="(item, index) in deliverDetails" :class="['item',index == 0 ? 'first':'' ]">
|
||||
<view class="flexbox">
|
||||
<view class="img_icon "></view>
|
||||
<view class="wuliu">
|
||||
<view class="time">{{item.acceptTime}}</view>
|
||||
<view class="content">{{item.acceptStation}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="quesheng" v-else>
|
||||
<u-divider text="- 暂无物流信息 -"></u-divider>
|
||||
</view>
|
||||
<music-play :playData="playData"></music-play>
|
||||
<public-module></public-module>
|
||||
<!-- <u-loading color="red" :show="loading"></u-loading> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import musicPlay from '@/components/music.vue'
|
||||
import $http from '@/config/requestConfig.js';
|
||||
// import Loading from '../../'
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
import loginVue from '../user/login.vue';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData:{},
|
||||
loading: false,
|
||||
orderId: null,
|
||||
deliverDetails: [],
|
||||
express:{}, // 面单
|
||||
consignee:{}, // 收件人信息
|
||||
expressOrderSn:'', // 运单号
|
||||
// expressCompanyCode:'', //快递编码
|
||||
// expressCompanyName:'' ,// 快递公司
|
||||
orderSn : '',
|
||||
current: 0,
|
||||
deliverList: [],
|
||||
deliverDetailsLength: null,
|
||||
orderContet:{},
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.expressOrderSn = e.expressOrderSn
|
||||
// this.expressCompanyCode = e.expressCompanyCode
|
||||
// this.expressCompanyName = e.expressCompanyName
|
||||
//this.express = e.express
|
||||
//this.consignee = e.consignee
|
||||
console.log(e,'传入的参数')
|
||||
this.orderSn = e.orderSn
|
||||
},
|
||||
onShow() {
|
||||
this.getOrderList()
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
components:{
|
||||
musicPlay
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 获取订单列表
|
||||
getOrderList() {
|
||||
console.log('this.orderType',this.orderType)
|
||||
this.$http
|
||||
// .get(`book/buyOrder/getOrderInfo?orderId=${this.orderID}`)
|
||||
.get(`/book/buyOrder/orderDetail?orderSn=${this.orderSn}`)
|
||||
.then(res => {
|
||||
console.log('订单详情',res)
|
||||
var seconds = res.result.timestamp + 30 * 60 + 2 // 过期时间
|
||||
var nowSeconds = Math.floor(new Date().getTime() / 1000);
|
||||
res.result.overTime = seconds - nowSeconds
|
||||
|
||||
this.orderContet = res.result
|
||||
//this.userRecordid = res.userRecordid
|
||||
this.productIDs = res.result.goodsList.map(item => {
|
||||
return item.buyOrderProductId
|
||||
})
|
||||
// console.log(this.orderContet,'this.orderContet')
|
||||
if (this.orderContet.orderStatus == 0) {
|
||||
this.titleStat = '待支付'
|
||||
} else if (this.orderContet.orderStatus == 1) {
|
||||
this.titleStat = '待发货'
|
||||
} else if (this.orderContet.orderStatus == 2) {
|
||||
this.titleStat = '待收货'
|
||||
} else if (this.orderContet.orderStatus == 3) {
|
||||
this.titleStat = '已完成'
|
||||
}
|
||||
|
||||
|
||||
if(parseInt(this.orderContet.orderStatus) >= 2){
|
||||
this.getdeliverDetails()
|
||||
// 查询快递信息
|
||||
// this.getSheetInfo()
|
||||
}
|
||||
console.log(this.orderContet,'订单详情')
|
||||
})
|
||||
},
|
||||
|
||||
// 复制到剪切板
|
||||
copyData(data){
|
||||
uni.setClipboardData({
|
||||
data,
|
||||
success: function () {
|
||||
console.log('success');
|
||||
}
|
||||
});
|
||||
},
|
||||
tabchange(item) {
|
||||
console.log(item)
|
||||
this.current = item.index
|
||||
},
|
||||
// 获取物流
|
||||
getdeliverDetails() {
|
||||
this.deliverList = []
|
||||
// var strLength = this.orderContet.consignee.consigneeMobile.length
|
||||
// var subMobile = this.orderContet.consignee.consigneeMobile.substring(strLength-4,strLength)
|
||||
// this.expressOrderSn = 'SF1504651506851'
|
||||
// this.expressCompanyCode = 'SF'
|
||||
// subMobile = '9277'
|
||||
uni.showLoading()
|
||||
this.$http
|
||||
//.post(`/book/buyOrder/queryFMS?orderId=${this.orderId}`)
|
||||
.get(`/book/buyOrder/searchExpress?expressOrderSn=${this.expressOrderSn}`)
|
||||
.then(res => {
|
||||
console.log(res, '物流信息')
|
||||
if (res && res.code === 0) {
|
||||
uni.hideLoading()
|
||||
// this.deliverDetails = res.result.traces
|
||||
console.log(res.express.traces,'物流信息')
|
||||
if(res.express.traces.length > 0){
|
||||
this.deliverDetails = res.express.traces.reverse()
|
||||
}else{
|
||||
this.deliverDetails = []
|
||||
}
|
||||
|
||||
}
|
||||
}).catch(e => {
|
||||
uni.hideLoading()
|
||||
console.log(e,'e')
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.item:first-child::before {
|
||||
background-color: #6fca78 !important
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.quesheng{text-align: center; margin-top: 20px;
|
||||
image{ width: 150rpx; height: 170rpx; display: block; margin: 10px auto;
|
||||
}
|
||||
text{
|
||||
color: #888;
|
||||
}
|
||||
}
|
||||
.copyCode{display: inline-block; margin-left: 20rpx; }
|
||||
.u-tabs {
|
||||
background: #fff
|
||||
}
|
||||
|
||||
.xiangqing {
|
||||
overflow: hidden;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.kuaidiItem {
|
||||
padding: 10px;
|
||||
color: #666
|
||||
}
|
||||
|
||||
.deliverCntent {
|
||||
.img_icon {
|
||||
border-left: 2px solid #eee;
|
||||
}
|
||||
line-height:20px;
|
||||
padding: 32rpx;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
border-top: 1px solid #eee;
|
||||
font-size: 28rpx;
|
||||
color:#777;
|
||||
.item {
|
||||
padding-left: 10px;
|
||||
position: relative;
|
||||
}
|
||||
.item:before {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 100%;
|
||||
background: #eee;
|
||||
left: 6px;
|
||||
top: 0;
|
||||
content: "";
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.time {
|
||||
color: #888;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 5px
|
||||
}
|
||||
.first{
|
||||
color: #55aa7f;
|
||||
}
|
||||
.content {
|
||||
padding-bottom: 14px;
|
||||
}
|
||||
}
|
||||
.flexbox {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.img_icon {
|
||||
padding-right: 30rpx;
|
||||
}
|
||||
|
||||
.moreBtnF {
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
background-color: rgba(255, 255, 255, .9);
|
||||
}
|
||||
</style>
|
||||
22
pages/bookShop/deliverLIst.vue
Normal file
22
pages/bookShop/deliverLIst.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
快递列表页面
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
1047
pages/bookShop/orderLCont.vue
Normal file
1047
pages/bookShop/orderLCont.vue
Normal file
File diff suppressed because it is too large
Load Diff
848
pages/bookShop/orderList.vue
Normal file
848
pages/bookShop/orderList.vue
Normal file
@@ -0,0 +1,848 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<view class="header">
|
||||
<!-- 顶部导航栏 -->
|
||||
<z-nav-bar backState="2000" title="我的订单"></z-nav-bar>
|
||||
<view class="ordersTabs">
|
||||
<view v-for="(item,index) in ordersTabs" @click="ordersTabCLi(item.value)" :key="index"
|
||||
:class="ordersListTab==item.value?'ordersdefine ordStyle':'ordersdefine'">
|
||||
{{item.name}}
|
||||
<view class="ordersnum" v-if="item.value == 0 && map[item.value] > 0">{{map[item.value]}}</view>
|
||||
<view class="ordersnum" v-if="item.value == 1 && map[item.value] > 0">{{map[item.value]}}</view>
|
||||
<view class="ordersnum" v-if="item.value == 2 && map[item.value] > 0">{{map[item.value]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 站位 -->
|
||||
<view class="ordersTabs" style="z-index:0;position:unset;">
|
||||
<view class="ordersdefine">1</view>
|
||||
</view>
|
||||
<!-- <view v-if="ordersListTab == 1"> -->
|
||||
<view>
|
||||
<view v-if="newList.length > 0">
|
||||
<view class="orderInfo" v-for="(item,index) in newList" :key="index">
|
||||
<view class="mainContent">
|
||||
<view class="item" @click.stop="toDetail(item)">
|
||||
<view class="orderstatus" v-show="item.orderStatus == 0">未付款</view>
|
||||
<view class="orderstatus" v-show="item.orderStatus == 1">待发货</view>
|
||||
<view class="orderstatus" v-show="item.orderStatus == 2">已发货</view>
|
||||
<view class="orderstatus" v-show="item.orderStatus == 3">交易成功</view>
|
||||
<view class="orderstatus" v-show="item.orderStatus == 4">交易失败</view>
|
||||
<view class="orderstatus" v-show="item.orderStatus == 5">过期</view>
|
||||
<view v-for="(item1,index1) in item.productList" :key="index1" class="bookinfolist">
|
||||
<image class="feng" v-if="item1.product.productImages" :src="item1.product.productImages" mode="aspectFill"></image>
|
||||
<!-- <view class="description" v-html="item.content">
|
||||
</view> -->
|
||||
<view class="btns flexbox">
|
||||
<span class="booknameleft">{{item1.product.productName}}</span>
|
||||
<span class="right flexbox opbtns">
|
||||
¥{{item1.product.price}}
|
||||
</span>
|
||||
</view>
|
||||
<view class="btns flexbox" style="margin-top:10rpx;padding-bottom: 72rpx;">
|
||||
<span class="left" style="color: #C0C4CC;"></span>
|
||||
<span class="right flexbox opbtns" style="color: #C0C4CC;">
|
||||
×{{item1.quantity}}
|
||||
</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btns flexbox" style="margin-top:10rpx;">
|
||||
<span class="left" style="color: #C0C4CC;"></span>
|
||||
<span class="right flexbox opbtns">
|
||||
<view style="color: #000;font-size:30rpx;font-weight:700;">实付款</view>
|
||||
<view style="color: #000;font-size:30rpx;font-weight:700;">{{' ¥' + item.realMoney}}</view>
|
||||
</span>
|
||||
</view>
|
||||
<view class="btns flexbox" style="margin-top:10rpx;">
|
||||
<span class="left" style="color: #C0C4CC;" @click.stop="toDetail(item)">订单详情</span>
|
||||
<span class="right flexbox opbtns">
|
||||
<view class="orderstatusbtn" v-if="item.orderStatus == 0" @click.stop="canceOrder(item)">取消订单</view>
|
||||
<view class="orderstatusbtn" v-if="item.orderStatus == 0" @click.stop="goPay(item)">付款</view>
|
||||
<view class="orderstatusbtn" v-if="item.orderStatus == 1">催发货</view>
|
||||
<view class="orderstatusbtn" v-if="item.orderStatus == 2" @click.stop="seeExpressDetail(item)">查看物流</view>
|
||||
<view class="orderstatusbtn" v-if="item.orderStatus == 2" @click.stop="OverOrder(item)">确认收货</view>
|
||||
<view class="orderstatusbtn" v-if="item.orderStatus == 3">申请售后</view>
|
||||
<view class="orderstatusbtn" v-if="item.orderStatus == 3 && userRecordid == null" @click.stop="pingji(item.productId)">评价</view>
|
||||
<!-- <view class="orderstatusbtn" v-if="item.orderStatus == 3 && userRecordid != null" @click.stop="showZhuiping(item.productId)">追评</view> -->
|
||||
</span>
|
||||
</view>
|
||||
<view style="border-bottom:2rpx solid #e9e9e9;height:50rpx;" v-if="index<item.length-1"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="status==0" style="text-align: center;">
|
||||
<u-loading-icon style="display: inline-block;"></u-loading-icon>
|
||||
<font style='vertical-align: super;margin-left: 10px;font-size: 26rpx;color: #909399;'>努力加载中</font>
|
||||
</view>
|
||||
<view v-if="status==1" style="padding-bottom: 20rpx;">
|
||||
<u-divider v-if="newList.length > 0" text="全部加载完成"></u-divider>
|
||||
<u-divider v-else text="暂无订单"></u-divider>
|
||||
</view>
|
||||
|
||||
<!-- 对话框 -->
|
||||
<u-popup :show="pingjiaShow" :round="10" @close="closePingjia">
|
||||
<view class="tanchu" >
|
||||
<view class="dp_title" v-if="pjType != 'zhuiping'">添加评价</view>
|
||||
<view class="dp_title" v-else>添加追评</view>
|
||||
|
||||
<view style="max-height: 1000rpx;overflow-y: scroll;">
|
||||
<uni-forms :modelValue="Pform">
|
||||
<!-- 评价图片 -->
|
||||
<!-- end -->
|
||||
<!-- <uni-forms-item name="comment" label-width="0">
|
||||
<uni-easyinput type="textarea" v-model="Pform.comment" placeholder="请输入您的商品评价" />
|
||||
</uni-forms-item> -->
|
||||
</uni-forms>
|
||||
<!-- <u-button type="success" @click="submitPJ">提交评价</u-button> -->
|
||||
<!-- 提交 -->
|
||||
<view class="padding-bottom-sm flex padding-lr-sm" style="border-bottom: 1px solid #EEEEEE;">
|
||||
|
||||
<view class="mb30" v-if="pjType != 'zhuiping'">
|
||||
<span :class="['star',Pform.star>=1 ? 'starLight': 'starGray']" @click="getStar(1)"></span>
|
||||
<span :class="['star',Pform.star>=2 ? 'starLight': 'starGray']" @click="getStar(2)"></span>
|
||||
<span :class="['star',Pform.star>=3 ? 'starLight': 'starGray']" @click="getStar(3)"></span>
|
||||
<span :class="['star',Pform.star>=4 ? 'starLight': 'starGray']" @click="getStar(4)"></span>
|
||||
<span :class="['star',Pform.star>=5 ? 'starLight': 'starGray']" @click="getStar(5)"></span>
|
||||
</view>
|
||||
<view class="mb30" v-if="pjType != 'zhuiping'">
|
||||
<!-- <uni-file-picker :auto-upload="false" ref="files" @delete="deleteImg" limit="5" @success="upSuccess" @select="select" v-model="Pform.img" fileMediatype="image" :image-styles="imageStyles"/> -->
|
||||
<u-upload :fileList="Pform.img" @afterRead="afterRead" @delete="deletePic" multiple :maxCount="4"
|
||||
width="80" height="80" :previewFullImage="true">
|
||||
</u-upload>
|
||||
</view>
|
||||
<view class="flex-sub flexbox">
|
||||
<i @click="showEmj()" :class="emojiIcon" ></i>
|
||||
<!-- <input type="text" @focus="InputFocus" @blur="InputBlur" v-model="message" @input="textareaBInput" placeholder-style="font-size:24rpx;color:#aaaaaa;" placeholder="请输入您要发送的内容"></input> -->
|
||||
<textarea class="textarea" v-model="Pform.comment" @focus="InputFocus" @blur="InputBlur" @input="textareaBInput" placeholder-style="font-size:24rpx;color:#aaaaaa;" placeholder="请输入您要发送的内容"></textarea>
|
||||
</view>
|
||||
<view class="">
|
||||
<!-- <button class="cu-btn bg-gradual-blue shadow-blur">发送</button> -->
|
||||
<u-button type="success" @click="submitPJ" v-if="pjType != 'zhuiping'">提交评价</u-button>
|
||||
<u-button type="success" @click="zhuiping" v-else>提交追评</u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="position: relative;">
|
||||
<emotion @emotion="handleEmj" :height="220" v-if="isShowEmj" :windowWidth="windowWidth"></emotion>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<z-navigation></z-navigation>
|
||||
<music-play :playData="playData"></music-play>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import $http from '@/config/requestConfig.js';
|
||||
import emotion from '@/bkhumor-emojiplus/components/bkhumor-emojiplus/bkhumor-emojiplus.vue';
|
||||
import musicPlay from '@/components/music.vue'
|
||||
import {
|
||||
setPay,
|
||||
setPayAssign,setWXPay
|
||||
} from '@/config/utils';
|
||||
import { data } from 'jquery';
|
||||
import {
|
||||
mapState, mapMutations
|
||||
} from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// loadingNow : false,
|
||||
playData:{},
|
||||
emojiIcon:'cuIcon-emoji',
|
||||
windowWidth:0,
|
||||
bookid:null,
|
||||
booklistpage: 1,
|
||||
productList:[],
|
||||
productInfo:{},
|
||||
emoji:[],
|
||||
Files:[],
|
||||
page:1,
|
||||
pageSize:10,
|
||||
total:0,
|
||||
status:3,
|
||||
shupingList:[],
|
||||
bfaid:null,
|
||||
ordersTabs: [{
|
||||
name: '全部',
|
||||
value: null
|
||||
}, {
|
||||
name: '待付款',
|
||||
value: 0
|
||||
}, {
|
||||
name: '待发货',
|
||||
value: 1
|
||||
}, {
|
||||
name: '待收货',
|
||||
value: 2
|
||||
}, {
|
||||
name: '已完成',
|
||||
value: 3
|
||||
}],
|
||||
ordersListTab: 1,
|
||||
newestpage: 1,
|
||||
// hotestpage: 1,
|
||||
// booksetpage: 1,
|
||||
newList:[],
|
||||
// hotList:[],
|
||||
// bookList:[],
|
||||
map: {},
|
||||
userRecordid:null, // 用户的评价状态
|
||||
pingjiaShow:false, //添加评价
|
||||
Pform:{ // 评价表单
|
||||
star:0,
|
||||
comment:'',
|
||||
img:[],
|
||||
html:''
|
||||
},
|
||||
isShowEmj: false,
|
||||
pjType:'',
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
console.log('下拉刷新了')
|
||||
uni.stopPullDownRefresh();
|
||||
|
||||
this.newestpage = 1
|
||||
// this.hotestpage = 1
|
||||
// this.booksetpage = 1
|
||||
this.newList = []
|
||||
// this.hotList = []
|
||||
// this.bookList = []
|
||||
this.getBookList(this.ordersListTab, false)
|
||||
|
||||
},
|
||||
onReachBottom() {
|
||||
this.newestpage++
|
||||
// this.hotestpage++
|
||||
// this.booksetpage++
|
||||
this.getBookList(this.ordersListTab, false)
|
||||
},
|
||||
onLoad(e) {
|
||||
this.windowWidth = uni.getSystemInfoSync().windowWidth;
|
||||
console.log(e,'onload111')
|
||||
// this.bookid = e.bookid
|
||||
this.getBookList(1, false)
|
||||
},
|
||||
computed:{
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['setLoadingShow']),
|
||||
// 切换tab状态
|
||||
ordersTabCLi(e) {
|
||||
this.ordersListTab = e
|
||||
this.newestpage = 1
|
||||
// this.hotestpage = 1
|
||||
// this.booksetpage = 1
|
||||
this.newList = []
|
||||
// this.hotList = []
|
||||
// this.bookList = []
|
||||
this.getBookList(this.ordersListTab, false)
|
||||
},
|
||||
// 查看本书更多书评
|
||||
toMore(val){
|
||||
console.log(val,'val')
|
||||
uni.navigateTo({
|
||||
url: '../comments/comments?bookid='+val.id,
|
||||
});
|
||||
},
|
||||
// 订单详情
|
||||
toDetail(val){
|
||||
console.log(val,'val')
|
||||
// uni.navigateTo({
|
||||
// url:'../bookShop/commentsDetail?bookid='+val.bookid+'&bfa_id='+val.id
|
||||
// })
|
||||
uni.navigateTo({
|
||||
url: './orderLCont?orderId=' + val.orderId + '&orderType=' + val.orderStatus + '&orderSn=' + val.orderSn
|
||||
});
|
||||
},
|
||||
getBookList(flag, refreshflag){
|
||||
// 根据tab不同,获取最新书评、最热书评、书集列表
|
||||
// uni.showLoading({
|
||||
// title: '加载中'
|
||||
// });
|
||||
|
||||
// 顶部红点数量
|
||||
$http.request({
|
||||
url: "book/buyOrder/getUserOrderStatusNum",
|
||||
method: "POST",
|
||||
data: {
|
||||
"userId": this.userInfo.id
|
||||
},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
this.map = res.map
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
|
||||
var params = {
|
||||
"userId": this.userInfo.id,
|
||||
"orderStatus":flag,//传null为全部,订单状态 0-未付款 1-待发货 2-已发货 3-交易成功 4-交易失败 5-过期
|
||||
"limit": 10,
|
||||
"page": this.newestpage
|
||||
}
|
||||
$http.request({
|
||||
url: "book/buyOrder/getUserOrderList",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: params,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
console.log(res, '内容获取成功')
|
||||
if (res.code == 0 && res.page && res.page.records.length > 0) {
|
||||
this.newList = this.newList.concat(res.page.records)
|
||||
} else { //
|
||||
|
||||
}
|
||||
if(res.page.records.length != 10){
|
||||
this.status = 1
|
||||
} else {
|
||||
this.status = 0
|
||||
}
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
},
|
||||
// 支付
|
||||
goPay(payItem) {
|
||||
console.log(payItem,'订单数据')
|
||||
if(payItem.paymentMethod == 2){
|
||||
console.log('阿里支付')
|
||||
setPay({
|
||||
typePay: 'alipay',
|
||||
subject: 'order',
|
||||
totalAmount: payItem.realMoney,
|
||||
type: 2,
|
||||
relevanceoid: payItem.orderSn,
|
||||
customerId: this.userInfo.id,
|
||||
}, res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}
|
||||
this.getOrderList()
|
||||
})
|
||||
} else if(payItem.paymentMethod == 1){
|
||||
console.log('微信支付')
|
||||
// console.log(this.isAndorid)
|
||||
if(this.isAndorid == false){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '很抱歉,苹果系统暂不支持微信支付',
|
||||
showCancel:false
|
||||
})
|
||||
return false
|
||||
}else{
|
||||
let data1={
|
||||
orderSn:payItem.orderSn,
|
||||
buyOrderId: null,
|
||||
totalAmount: payItem.realMoney
|
||||
}
|
||||
console.log(data1,'data1')
|
||||
setWXPay(data1,res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
console.log(res)
|
||||
if(res.data.errMsg.indexOf('User canceled') != -1){
|
||||
uni.showToast({
|
||||
title: "用户取消支付",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}else if(payItem.paymentMethod == 3){
|
||||
// 苹果充值
|
||||
console.log('苹果二次支付')
|
||||
if(this.isAndorid){
|
||||
uni.showModal({
|
||||
title:'提示',
|
||||
showCancel:false,
|
||||
content:'很抱歉,当前订单属于苹果系统内购订单,安卓系统无法完成支付操作,您可切换到苹果系统进行支付,也可以取消该订单,并重新下单'
|
||||
})
|
||||
}else{
|
||||
this.iphonepay(payItem)
|
||||
}
|
||||
}
|
||||
},
|
||||
// 取消订单
|
||||
canceOrder(item) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要取消订单吗?',
|
||||
confirmText: "取消订单",
|
||||
cancelText: "考虑一下",
|
||||
confirmColor: '#c96713',
|
||||
cancelColor: '#555',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
this.$http
|
||||
.get('/book/buyOrder/cancelOrder?orderSn=' + item.orderSn)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '取消订单成功'
|
||||
})
|
||||
// uni.switchTab({
|
||||
// url: './orderList'
|
||||
// });
|
||||
|
||||
this.newestpage = 1
|
||||
this.newList = []
|
||||
this.getBookList(this.ordersListTab, false)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// canceOrder(item) {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '确定要取消订单吗?',
|
||||
// confirmText: "取消订单",
|
||||
// cancelText: "考虑一下",
|
||||
// confirmColor: '#c96713',
|
||||
// cancelColor: '#555',
|
||||
// success: res => {
|
||||
// if (res.confirm) {
|
||||
// uni.showLoading()
|
||||
// $http.request({
|
||||
// url: "book/buyOrder/cancelOrder",
|
||||
// method: "GET", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
// data,
|
||||
// header: { //默认 无 说明:请求头
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// }).then(res => {
|
||||
// if (res.code == 0) {
|
||||
// uni.hideLoading()
|
||||
// uni.showToast({
|
||||
// title: '订单已取消',
|
||||
// icon: 'success',
|
||||
// duration: 1000
|
||||
// })
|
||||
// this.getBookList(this.ordersListTab, false)
|
||||
// }
|
||||
// })
|
||||
// } else if (res.cancel) {}
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
// 查看物流
|
||||
seeExpressDetail(item){
|
||||
// console.log(item, this.sheetList.length)
|
||||
// if(this.sheetList.length > 1){
|
||||
// this.sheetListShow = true
|
||||
// }else if(this.sheetList.length == 1){
|
||||
// 直接展示详情
|
||||
uni.navigateTo({
|
||||
url: "./deliverDetail?orderSn=" + item.orderSn + "&expressOrderSn=" + item.expressList[0].expressOrderSn
|
||||
})
|
||||
// }
|
||||
},
|
||||
// 确认收货
|
||||
OverOrder(item) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认收货?',
|
||||
success: res => {
|
||||
let data = {
|
||||
orderId: item.orderId,
|
||||
orderStatus: '3'
|
||||
}
|
||||
if (res.confirm) {
|
||||
uni.showLoading()
|
||||
$http.request({
|
||||
url: "book/buyOrder/update",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '收货成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
this.newestpage = 1
|
||||
this.newList = []
|
||||
this.getBookList(this.ordersListTab, false)
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {}
|
||||
}
|
||||
});
|
||||
},
|
||||
closePingjia(){
|
||||
this.pingjiaShow = false
|
||||
this.Pform.comment = ''
|
||||
this.Pform.html = ''
|
||||
this.emoji = []
|
||||
},
|
||||
// 提交评价
|
||||
submitPJ(){
|
||||
if(this.Pform.comment != ''){
|
||||
|
||||
let data={
|
||||
'userid':this.userInfo.id,
|
||||
'orderSn': this.orderSn,
|
||||
'bookid': this.productID,
|
||||
// 'content': this.Pform.html,
|
||||
'content': this.Pform.comment,
|
||||
'starLevel':this.Pform.star,
|
||||
'images':this.Pform.img,
|
||||
// 'emoji':this.emoji // 表情数组
|
||||
}
|
||||
// console.log(data,'data')
|
||||
$http.request({
|
||||
url: "buy/record/UserRecordcomment",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title:'评价成功!',
|
||||
icon:'success'
|
||||
})
|
||||
|
||||
this.pingjiaShow = false
|
||||
this.Pform.comment = ''
|
||||
this.Pform.html = ''
|
||||
this.emoji = []
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack({
|
||||
delta:1
|
||||
})
|
||||
},2000)
|
||||
}
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:'请先输入您的评价内容 !',
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
// 添加评价
|
||||
pingji(id){
|
||||
console.log(id)
|
||||
this.pjType = ''
|
||||
this.productID = id
|
||||
this.pingjiaShow = true
|
||||
},
|
||||
getStar(i){
|
||||
this.Pform.star = i
|
||||
},
|
||||
InputBlur(e){
|
||||
|
||||
},
|
||||
InputFocus(e){
|
||||
this.isShowEmj = false;
|
||||
this.emojiIcon = 'cuIcon-emoji';
|
||||
this.$emit('foc')
|
||||
},
|
||||
textareaBInput(e) {
|
||||
console.log(e,'e')
|
||||
this.Pform.comment = e.detail.value
|
||||
/// this.Pform.html = e.detail.value
|
||||
},
|
||||
showEmj() {
|
||||
let bool = !this.isShowEmj;
|
||||
if(bool) {
|
||||
this.emojiIcon = 'cuIcon-keyboard';
|
||||
} else {
|
||||
this.emojiIcon = 'cuIcon-emoji';
|
||||
}
|
||||
|
||||
this.isShowEmj = bool;
|
||||
this.$emit('show')
|
||||
},
|
||||
deletePic() {
|
||||
let that = this
|
||||
that.Pform.img.splice(0, 1)
|
||||
//console.log(that.Pform.img)
|
||||
},
|
||||
afterRead(e) {
|
||||
//console.log(e)
|
||||
let that = this
|
||||
for (var i=0; i< e.file.length; i++) {
|
||||
//console.log(i,e.file[i].url)
|
||||
uni.uploadFile({
|
||||
url: this.$baseUrl + 'oss/fileoss',
|
||||
filePath: e.file[i].url,
|
||||
//files:e.file,
|
||||
name: 'file',
|
||||
formData: {},
|
||||
success: (res) => {
|
||||
that.Pform.img.push({
|
||||
url: JSON.parse(res.data).url
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 获得输入的表情数组
|
||||
handleEmj(i) {
|
||||
console.log(i,'i---------');
|
||||
this.inputValue = i
|
||||
// console.log(this.inputValue);
|
||||
if(i.emotioni == '[em_98]') {
|
||||
//匹配最后一个表情符号并删除11。
|
||||
this.Pform.comment = this.Pform.comment.replace(/(\[[^\]]+\]|[\s\S])$/, '');
|
||||
if(this.emoji.length > 0){
|
||||
this.emoji = this.emoji.slice(0,-1)
|
||||
}
|
||||
} else {
|
||||
this.emoji.push({'tag' : i.emotion, 'name':i.emotioni})
|
||||
// console.log(this.emoji,'this.emoji')
|
||||
this.Pform.comment += i.emotioni;
|
||||
/// this.Pform.html += i.emotion
|
||||
}
|
||||
},
|
||||
},
|
||||
components:{
|
||||
musicPlay,
|
||||
emotion
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// @import '@/style/mixin.scss';
|
||||
.ordersTabs {
|
||||
// margin: 70rpx 0 0 0;
|
||||
width: 730rpx;
|
||||
// padding: 0 3% 3% 3%;
|
||||
position: fixed;
|
||||
// top: 80rpx;
|
||||
background-color: #f7faf9;
|
||||
z-index: 100;
|
||||
|
||||
.ordersdefine {
|
||||
display: inline-block;
|
||||
padding: 20rpx 0 20rpx 0;
|
||||
// margin: 40rpx 0 15rpx 0;
|
||||
width:140rpx;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
position: relative;
|
||||
.ordersnum{
|
||||
position: absolute;
|
||||
top: 8rpx;
|
||||
right: 0rpx;
|
||||
background-color: red;
|
||||
// border:1rpx solid #a3a3a3;
|
||||
border-radius: 40rpx;
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
}
|
||||
|
||||
.ordStyle {
|
||||
// border-bottom: 4rpx solid #54a966;
|
||||
// color: #54a966;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.orderstatusbtn{
|
||||
color: #000;
|
||||
border:1px solid #999;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 10rpx;
|
||||
margin-left:20rpx;
|
||||
width:140rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
.flexbox{display: flex;}
|
||||
.container{padding: 0 10px;}
|
||||
.star{display: inline-block; width: 20px; height: 20px; margin-right: 10rpx;}
|
||||
.starGray{ background : url(../../static/icon/star_greey.png) no-repeat; background-size: contain; }
|
||||
.starLight{ background : url(../../static/icon/star_light.png) no-repeat; background-size: contain;}
|
||||
.cuIcon-emoji {
|
||||
background : url(../../static/biaoqing.png) no-repeat; background-size: contain; display: block; margin-right: 20rpx;
|
||||
width: 30px; }
|
||||
.cuIcon-keyboard{background : url(../../static/biaoqing.png) no-repeat; background-size: contain; display: block;
|
||||
width: 30px; }
|
||||
.tanchu {
|
||||
padding: 40rpx 30rpx 40rpx 30rpx;
|
||||
position: relative;
|
||||
|
||||
|
||||
.dp_title {
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.dp_add {
|
||||
position: absolute;
|
||||
top: 40rpx;
|
||||
right: 30rpx;
|
||||
font-size: 22rpx;
|
||||
background-color: #fd6004;
|
||||
color: #fff;
|
||||
border-radius: 10rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
|
||||
.u-icon {
|
||||
display: inline-block;
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
}}
|
||||
|
||||
.quesheng{text-align: center; margin-top: 100rpx; color: #8b8a91; padding-bottom: 20rpx; padding-top: 20rpx;}
|
||||
.gengduoshuping{text-align: right; color: #0044ff; padding-bottom: 20rpx; padding-top: 20rpx;}
|
||||
.orderInfo{
|
||||
justify-content: space-between;
|
||||
// margin-bottom: 15px;
|
||||
background-color: #fff;
|
||||
padding:20rpx;
|
||||
border: 1px splid #999;
|
||||
box-sizing: border-box;
|
||||
// padding-bottom: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
.bookinfolist{
|
||||
height: 180rpx;
|
||||
}
|
||||
}
|
||||
.mainContent{
|
||||
background-color: #fff;
|
||||
.item{
|
||||
// padding: 10px;
|
||||
// margin-bottom: 30rpx;
|
||||
// border: 1px solid #999;
|
||||
box-sizing: border-box;
|
||||
// padding-bottom: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
// margin-bottom: 20rpx;
|
||||
}
|
||||
.feng{
|
||||
margin:0rpx 20rpx 0 0;
|
||||
height: 160rpx;
|
||||
width: 140rpx;
|
||||
float:left;
|
||||
border-radius: 20rpx;
|
||||
border:1rpx solid #e9e9e9;
|
||||
}
|
||||
.orderstatus{font-size: 30rpx; color: red; text-align: right;padding-bottom: 10rpx;}
|
||||
/deep/.description{
|
||||
overflow: hidden;
|
||||
color: #666;
|
||||
text-overflow: -o-ellipsis-lastline;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 5;
|
||||
line-clamp: 5;
|
||||
-webkit-box-orient: vertical;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 20rpx;
|
||||
margin-top:10rpx;
|
||||
height: 172rpx;
|
||||
img{
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
.btns{
|
||||
font-size: 28rpx;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.booknameleft{
|
||||
width: 372rpx;
|
||||
color: #000000;
|
||||
}
|
||||
.left{
|
||||
width: 300rpx;
|
||||
color: #a1a1a1;
|
||||
}
|
||||
.right{
|
||||
width: 350rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
.gzicon{
|
||||
margin:0 0 0 20rpx;
|
||||
height: 40rpx;
|
||||
width: 40rpx;
|
||||
// float:left;
|
||||
// border-radius: 20rpx;
|
||||
// border:1rpx solid #e9e9e9;
|
||||
}
|
||||
.opbtns{
|
||||
.pingjia{margin-left: 10px;}
|
||||
}
|
||||
}
|
||||
}
|
||||
.mb30{margin-bottom: 30rpx; overflow: hidden;}
|
||||
|
||||
.mytabs {
|
||||
// background: url('@/static/icon/bgtushu.png') no-repeat left top;
|
||||
height: 80rpx;
|
||||
// margin-bottom: 30rpx;
|
||||
|
||||
.item {
|
||||
border-radius: 10rpx;
|
||||
background-color: #c6ead0;
|
||||
width: 48%;
|
||||
// margin: 0 10rpx;
|
||||
text-align: center;
|
||||
color: #3c7f56;
|
||||
font-size: 36rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
.item.active {
|
||||
background-color: #3c7f56;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.item1 {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
1099
pages/bookShop/settlement.vue
Normal file
1099
pages/bookShop/settlement.vue
Normal file
File diff suppressed because it is too large
Load Diff
1080
pages/bookShop/settlementBook.vue
Normal file
1080
pages/bookShop/settlementBook.vue
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user