Commit 56eee374 by zhangzhen

完善订单界面

parent 4cd335da
...@@ -188,7 +188,6 @@ export default { ...@@ -188,7 +188,6 @@ export default {
} }
}, },
scrollTop(val) { scrollTop(val) {
console.log(val,909090)
this.pageScroll({ this.pageScroll({
scrollTop: val scrollTop: val
}); });
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
onNavToHome(val){ onNavToHome(val){
uni.setStorageSync("storeId",val.id) uni.setStorageSync("storeId",val.id)
uni.switchTab({ uni.switchTab({
url:`/pages/index/index` url:`/pages/index/index?storeId=${val.id}`
}) })
}, },
onPreview(item) { onPreview(item) {
......
...@@ -2,8 +2,8 @@ const CONFIG = { ...@@ -2,8 +2,8 @@ const CONFIG = {
// 开发环境配置 // 开发环境配置
development: { development: {
assetsPath: '/static', // 静态资源路径 assetsPath: '/static', // 静态资源路径
baseUrl: 'http://10.106.30.136:8883/front', // 后台接口请求地址 baseUrl: 'http://10.106.30.135:8883/front', // 后台接口请求地址
hostUrl: 'http://10.106.30.136:8882', // H5地址(前端运行地址) hostUrl: 'http://10.106.30.135:8882', // H5地址(前端运行地址)
// baseUrl: 'http://192.168.43.242:8883/front', // 后台接口请求地址 // baseUrl: 'http://192.168.43.242:8883/front', // 后台接口请求地址
// hostUrl: 'http://192.168.43.242:8882', // H5地址(前端运行地址) // hostUrl: 'http://192.168.43.242:8882', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址 websocketUrl: '', // websocket服务端地址
......
<template> <template>
<view class="home" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd"> <view class="home" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd">
<f-navbar title="凑角" :isShowTransparentTitle="false" :isShowLeft="false" fontColor="#ffffff" bgColor="#e40583" <f-navbar title="凑角" :isShowTransparentTitle="false" :isShowLeft="false" fontColor="#ffffff" :fontSize="46" bgColor="#e40583"
:scrollTop="scrollTop" navbarType='5'></f-navbar> :scrollTop="scrollTop" navbarType='5'></f-navbar>
<scroll-view class="scroll-view" scroll-y="true" @scroll="onScroll"> <scroll-view class="scroll-view" scroll-y="true" @scroll="onScroll">
<view class="content-box"> <view class="content-box">
...@@ -84,9 +84,9 @@ ...@@ -84,9 +84,9 @@
</view> </view>
<view class="flex-1 flex-between"> <view class="flex-1 flex-between">
<view class="flex-row room-type"> <view class="flex-row room-type">
<text>房间套餐</text> <text>优惠套餐:</text>
<view v-for="(item,i) in options" :key="i" class="item"> <view v-for="(item,i) in item.packList" :key="i" class="item">
<text>{{item.label}}</text> <text>{{item.name}}</text>
</view> </view>
</view> </view>
<view class="confirm" @tap="onNavToOrder(item)"> <view class="confirm" @tap="onNavToOrder(item)">
...@@ -123,6 +123,7 @@ ...@@ -123,6 +123,7 @@
return { return {
scrollTop: 0, scrollTop: 0,
storeId: '', storeId: '',
storeList:[],
storeInfo: {}, storeInfo: {},
statusBarHeight: this.statusBarHeight, statusBarHeight: this.statusBarHeight,
hostUrl: config.hostUrl, hostUrl: config.hostUrl,
...@@ -170,14 +171,31 @@ ...@@ -170,14 +171,31 @@
} }
}, },
onShow() { onShow() {
if (uni.getStorageSync("storeId")) { if (uni.getStorageSync("storeId") && this.storeList.length) {
this.storeId = uni.getStorageSync("storeId") this.storeId = uni.getStorageSync("storeId")
let obj = this.storeList.filter(item => item.id === this.storeId)[0]
console.log(obj,909090)
if (obj.roomVoList.length) {
this.storeInfo = {
...obj,
roomVoList: obj.roomVoList.map(item => {
return {
...item,
images: item.images ? item.images
.split(",").map(val => this.hostUrl + val) : []
}
})
}
this.$forceUpdate();
} }
console.log(this.storeInfo, 9999)
}else{
uni.showLoading({ uni.showLoading({
title: "加载中" title: "加载中"
}) })
this.onLoading() this.onLoading()
}
}, },
onReachBottom() { onReachBottom() {
if (this.status == 'loadmore') { if (this.status == 'loadmore') {
...@@ -190,11 +208,10 @@ ...@@ -190,11 +208,10 @@
}, },
onLoad(option) { onLoad(option) {
console.log(option, 909090) console.log(option, 909090)
}, },
methods: { methods: {
onScroll(e){ onScroll(e){
console.log(e,90909090) this.scrollTop = e.target.scrollTop;
}, },
onLoading() { onLoading() {
this.onGetListStore() this.onGetListStore()
...@@ -207,6 +224,7 @@ ...@@ -207,6 +224,7 @@
}).then(res => { }).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data.code == 200 && res.data.data.length) { if (res.data.code == 200 && res.data.data.length) {
this.storeList = res.data.data;
let obj = {} let obj = {}
if (this.storeId) { if (this.storeId) {
obj = res.data.data.filter(item => item.id === this.storeId)[0] obj = res.data.data.filter(item => item.id === this.storeId)[0]
...@@ -226,7 +244,6 @@ ...@@ -226,7 +244,6 @@
} }
} }
console.log(this.storeInfo, 9999)
} }
}) })
}, },
...@@ -300,13 +317,21 @@ ...@@ -300,13 +317,21 @@
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.home { .home {
width: 100vw;
height: 100vh;
overflow-x: hidden;
}
.scroll-view{
position: relative;
width: 100vw;
height: 100%;
.content-box{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 100vw; width: 100%;
overflow-x: hidden;
} }
}
.header-content { .header-content {
display: flex; display: flex;
justify-content: center; justify-content: center;
...@@ -320,15 +345,6 @@ ...@@ -320,15 +345,6 @@
margin-top: -16upx; margin-top: -16upx;
} }
} }
.scroll-view{
width: 100vw;
.content-box{
display: flex;
flex-direction: column;
width: 100%;
}
}
.store-nav { .store-nav {
position: relative; position: relative;
display: flex; display: flex;
...@@ -602,8 +618,8 @@ ...@@ -602,8 +618,8 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 90rpx;
height: 44rpx; height: 44rpx;
padding: 0 8upx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 11rpx 11rpx 11rpx 11rpx; border-radius: 11rpx 11rpx 11rpx 11rpx;
border: 2rpx solid #130F26; border: 2rpx solid #130F26;
......
<template> <template>
<view class="coupon-list-box"> <view class="coupon-list-box">
<view v-for="(item,index) in list" :key="index" class="coupon-item"> <view v-for="(item,index) in list" :key="index" class="coupon-item" :class="{active: current === index}"
@tap="onSelect(item,index)">
<view class="part-left"> <view class="part-left">
<image :src="item.useStatus==1? '../../static/coupon_icon.png':'../../static/coupon_icon_gray.png'" mode="widthFix"></image> <image :src="item.isAvailable === 0? '../../static/coupon_icon.png':'../../static/coupon_icon_gray.png'"
mode="widthFix"></image>
</view> </view>
<view class="part-right"> <view class="part-right">
<view class="coupon-name"> <view class="coupon-name">
<text class="text-title text-lg text-bold">{{item.name}}</text> <text class="text-title text-lg text-bold">{{item.name}}</text>
<text class="text-lg" :class="item.useStatus==1?'text-pink':'text-gray'">{{item.useStatus==1?'待使用':'已使用'}}</text> <text class="text-lg"
:class="item.isAvailable === 0?'text-pink':'text-gray'">{{item.useStatus==0?'可使用':'无法使用'}}</text>
</view> </view>
<view class="flex-row margin-top"> <view class="flex-row margin-top">
<text class="">使用说明:</text> <text class="">使用说明:</text>
...@@ -29,152 +32,159 @@ ...@@ -29,152 +32,159 @@
<text class="text-gray">有效期限:</text> <text class="text-gray">有效期限:</text>
<text class="text-gray">{{item.startDate}}{{item.endDate}}</text> <text class="text-gray">{{item.startDate}}{{item.endDate}}</text>
</view> </view>
<view v-if="item.isAvailable !== 0" class="coupon-name margin-top">
<text class="text-gray">不可用原因:</text>
<text class="text-gray">{{item.reason}}</text>
</view> </view>
</view> </view>
<view v-if="list.length == 0" class="empty-box">
<!-- 列表数量为0时 -->
<u-empty text="暂无门店数据" textColor='#C1C1C1' width="60"
:icon="storeListBlankImage">
</u-empty>
</view>
<!-- 当数据没有更多时 -->
<view v-if="list.length" style="padding: 12px 6% 0;">
<u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText"
:loadmore-text="loadmoreText" :nomore-text="nomoreText" />
</view> </view>
<view class="box-content">
<button class="cu-btn round bg-gray " @tap="onCancle">返回</button>
<button class="cu-btn round bg-pink " @tap="onConfirm">选择</button>
</view>
</view> </view>
</template> </template>
<script> <script>
import indexConfig from "@/config/index.config"; import indexConfig from "@/config/index.config";
import FixedHeader from "@/components/fixedHeader/index"; import FixedHeader from "@/components/fixedHeader/index";
import {getCouponList} from "@/api/coupon" import {
getUseCoupon
} from "@/api/coupon"
export default { export default {
data() { data() {
return { return {
status: 'nomore ',
loadingText: '努力加载中',
loadmoreText: '上划加载',
nomoreText: '已展示全部门店',
scrollTop: 0, scrollTop: 0,
current: '', current: undefined,
hostUrl: indexConfig.hostUrl, hostUrl: indexConfig.hostUrl,
statusBarHeight: this.statusBarHeight, statusBarHeight: this.statusBarHeight,
titleBarHeight: this.titleBarHeight, titleBarHeight: this.titleBarHeight,
list: [ list: [{
{ couponId: "111",
couponId:"111", couponCode: "111",
couponCode:"111", name: "任意房型8小时通用券",
name:"任意房型8小时通用券", roomType: "标准",
roomType:"标准", couponTimeStart: "00:00",
couponTimeStart:"00:00", couponTimeEnd: "08:00",
couponTimeEnd:"08:00", couponType: "满减券(2)",
couponType:"满减券(2)", maxDuration: 8,
maxDuration:8, duration: 8,
duration:8, minPrice: 200,
minPrice:200, subPrice: 62,
subPrice:62, sourceType: "领取(1)",
sourceType:"领取(1)", platformType: 1,
platformType:1, startDate: "2023-10-23",
startDate:"2023-10-23", endDate: "2023-11-23",
endDate:"2023-11-23", useStatus: 1,
useStatus:1, useDate: ""
useDate:""
}, },
{ {
couponId:"2222", couponId: "2222",
couponCode:"2222", couponCode: "2222",
name:"任意房型4小时通用券", name: "任意房型4小时通用券",
roomType:"标准", roomType: "标准",
couponTimeStart:"", couponTimeStart: "",
couponTimeEnd:"", couponTimeEnd: "",
couponType:"满减券(2)", couponType: "满减券(2)",
maxDuration:4, maxDuration: 4,
duration:4, duration: 4,
minPrice:100, minPrice: 100,
subPrice:22, subPrice: 22,
sourceType:"领取(1)", sourceType: "领取(1)",
platformType:2, platformType: 2,
startDate:"2023-10-23", startDate: "2023-10-23",
endDate:"2023-11-23", endDate: "2023-11-23",
useStatus:1, useStatus: 1,
useDate:"" useDate: ""
}, },
{ {
couponId:"8888", couponId: "8888",
couponCode:"8888", couponCode: "8888",
name:"任意房型8小时通用券", name: "任意房型8小时通用券",
roomType:"标准", roomType: "标准",
couponTimeStart:"", couponTimeStart: "",
couponTimeEnd:"", couponTimeEnd: "",
couponType:"满减券(2)", couponType: "满减券(2)",
maxDuration:8, maxDuration: 8,
duration:8, duration: 8,
minPrice:200, minPrice: 200,
subPrice:62, subPrice: 62,
sourceType:"领取(1)", sourceType: "领取(1)",
platformType:2, platformType: 2,
startDate:"2023-10-23", startDate: "2023-10-23",
endDate:"2023-11-23", endDate: "2023-11-23",
useStatus:2, useStatus: 2,
useDate:"" useDate: ""
} }
], ],
height: 120, height: 120,
queryParams: { queryParams: {
pageSize: 2, storeId: '',
pageNum: 1, roomId: '',
useStatus: '', orderMode: '',
preStartDate: '',
preEndDate: ''
}, },
eventChannel:null, eventChannel: null,
tipText:"", tipText: "",
show:false, show: false,
eventChannel: null,
selectId: ''
}; };
}, },
components: { components: {
'fixed-header': FixedHeader 'fixed-header': FixedHeader
}, },
onReachBottom() {
if(this.status=='loadmore'){
this.queryParams.pageNum+=1;
this.onLoading();
}
},
onLoad() { onLoad() {
this.onLoading(); this.eventChannel = this.getOpenerEventChannel();
// eventChannel.emit('acceptDataFromOpenedPage', {data: 'data from test page'});
this.eventChannel.on('sendData', (data) => {
this.selectId = data.selectId
this.onLoading(data);
})
}, },
methods: { methods: {
onLoading(){ onLoading(d) {
getCouponList(this.queryParams).then(res=>{ console.log(d, 90909)
console.log(res,909090909) getUseCoupon(d).then(res => {
if(res.data.code === 200 ){ console.log(res.data.data, "优惠券")
this.list = res.data.rows if (res.statusCode == 200) {
this.total = res.data.total if (res.data && res.data.data.length) {
this.list = res.data.data.sort((a, b) => b.subPrice - a.subPrice);
if (this.list.length < this.total) { this.current = this.list.findIndex(item=>item.id === this.selectId)
this.status = 'loadmore';
} else {
this.status = 'nomore'
} }
} }
}) })
},
onSelect(item, i) {
if (item.isAvailable !== 0 || this.current === i) return
this.current = i
},
onCancle() {
uni.navigateBack()
},
onConfirm() {
this.eventChannel.emit('getSelectData', {
couponId: this.list[this.current].id
});
this.onCancle();
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.coupon-list-box{ .coupon-list-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 100%; width: 100%;
.coupon-item{ padding-bottom: 140upx;
.coupon-item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
width: 92%; width: 92%;
...@@ -182,43 +192,68 @@ ...@@ -182,43 +192,68 @@
background-color: #ffffff; background-color: #ffffff;
margin: 12upx 0; margin: 12upx 0;
padding: 30upx 20upx; padding: 30upx 20upx;
.part-left{
.part-left {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 160upx; width: 160upx;
margin-right: 20upx; margin-right: 20upx;
image{
image {
display: block; display: block;
width: 100%; width: 100%;
max-height:140upx ; max-height: 140upx;
} }
} }
.part-right{
.part-right {
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
.coupon-name{
.coupon-name {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.des{
.des {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.flex-row{
.flex-row {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
} }
} }
} }
.margin-top {
margin-top: 12upx;
}
} }
.active {
box-shadow: 0 0 10upx #ff55ff;
} }
.empty-box{ }
.box-content {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
height: 120upx;
display: flex; display: flex;
justify-content: center; justify-content: space-between;
align-items: center; align-items: center;
min-height: 400upx; background-color: #ffffff;
.cu-btn {
width: 40%;
margin: 0 5%;
}
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment