Commit 7fe0bfe8 by zhangzhen

功能完善

parent 9a599823
...@@ -35,4 +35,10 @@ export const getStarOrder=()=>{ ...@@ -35,4 +35,10 @@ export const getStarOrder=()=>{
export const cleanList=(data)=>{ export const cleanList=(data)=>{
let url=`/cleanRecords/myCleanList` let url=`/cleanRecords/myCleanList`
return http.get(url,data) return http.get(url,data)
} }
\ No newline at end of file
//领取全部的待保洁的任务
export const getAllByStoreId=(data)=>{
let url=`/cleanRecords/startCleanByStore`
return http.get(url,data)
}
...@@ -36,3 +36,8 @@ export const deviceCtrlAuth=()=>{ ...@@ -36,3 +36,8 @@ export const deviceCtrlAuth=()=>{
let url=`/store/storeListByConsumer` let url=`/store/storeListByConsumer`
return http.get(url) return http.get(url)
} }
export const getListByIds=(data)=>{
let url=`/store/queryByStoreIds`
return http.post(url,data)
}
\ No newline at end of file
...@@ -23,4 +23,9 @@ ...@@ -23,4 +23,9 @@
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
}
.flex-row-center{
display: flex;
flex-direction: row;
align-items: center;
} }
\ No newline at end of file
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</view> </view>
</view> </view>
<view v-for="(item,index) in list" :key="index" class="card-box"> <view v-for="(item,index) in list" :key="index" class="card-box card-box-item">
<view class="store-info"> <view class="store-info">
...@@ -38,8 +38,12 @@ ...@@ -38,8 +38,12 @@
</view> </view>
<view class="flex-col part-right"> <view class="flex-col part-right">
<view class="flex-between"> <view class="flex-between">
<text class="text-black text-bold text-xl">{{item.name}}</text> <text class="text-black text-bold text-lg">{{item.name}}</text>
<image :src="assetsPath+'/map_icon.png'" mode="widthFix" @tap="onNavLocation(item)"></image> <view class="flex-row-center">
<button v-if="item.cleanOrderNum" class="cu-btn bg-pink sm margin-right-sm" @tap="onGetAllByStoreId(item)">一键领取</button>
<image :src="assetsPath+'/map_icon.png'" mode="widthFix" @tap="onNavLocation(item)"></image>
</view>
</view> </view>
<view class="flex-row"> <view class="flex-row">
<image :src="assetsPath+'/location_icon.png'" mode="widthFix"></image> <image :src="assetsPath+'/location_icon.png'" mode="widthFix"></image>
...@@ -93,7 +97,7 @@ ...@@ -93,7 +97,7 @@
</template> </template>
<script> <script>
import {getListStore,getStarOrder} from "@/api/cleanRoom.js"; import {getListStore,getStarOrder,getAllByStoreId } from "@/api/cleanRoom.js";
import config from "@/config/index.config" import config from "@/config/index.config"
import { import {
getDictItem getDictItem
...@@ -189,8 +193,15 @@ import moment from "@/common/moment"; ...@@ -189,8 +193,15 @@ import moment from "@/common/moment";
if(res.data.code ===200){ if(res.data.code ===200){
let list =res.data.data&&res.data.data.length? res.data.data:[]; let list =res.data.data&&res.data.data.length? res.data.data:[];
this.list = list.map(item=>{ this.list = list.map(item=>{
let cleanOrderNum = 0
item.roolList.forEach(room=>{
if(room.recordsStatus===0){
cleanOrderNum+=1
}
})
return { return {
...item, ...item,
cleanOrderNum:cleanOrderNum,
roolList: item.roolList && item.roolList.length ? item.roolList.map(val=>{ roolList: item.roolList && item.roolList.length ? item.roolList.map(val=>{
return { return {
...val, ...val,
...@@ -247,11 +258,31 @@ import moment from "@/common/moment"; ...@@ -247,11 +258,31 @@ import moment from "@/common/moment";
url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+val.recordsId url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+val.recordsId
}) })
} }
},
onGetAllByStoreId(val){
uni.showLoading("领取中...")
getAllByStoreId({
storeId: val.id
}).then(res=>{
uni.hideLoading()
if(res.data.code ==200){
uni.showToast({
icon:"none",
title:"操作成功"
})
this.onLoading();
}
console.log(res,9999)
})
} }
} }
} }
</script> </script>
<style>
page{
background: #f1f1f1;
}
</style>
<style lang="scss"> <style lang="scss">
.clean-manage{ .clean-manage{
display: flex; display: flex;
...@@ -265,6 +296,13 @@ import moment from "@/common/moment"; ...@@ -265,6 +296,13 @@ import moment from "@/common/moment";
width: 94%; width: 94%;
margin-top: 10upx; margin-top: 10upx;
} }
.card-box-item{
width: 100%;
background-color: #ffffff;
padding: 20upx 3%;
border-radius: 4upx;
margin-top: 24upx;
}
.title-box{ .title-box{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
......
...@@ -14,17 +14,17 @@ ...@@ -14,17 +14,17 @@
<view class="title">房间名称:</view> <view class="title">房间名称:</view>
<text class="text-bold">{{orderInfo.roomName}}</text> <text class="text-bold">{{orderInfo.roomName}}</text>
</view> </view>
<!-- <view class="cu-form-group"> <!-- <view class="cu-form-group">
<view class="title">房间号</view> <view class="title">房间号</view>
<text>111</text> <text>111</text>
</view> --> </view> -->
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">保洁状态:</view> <view class="title">保洁状态:</view>
<text class="text-bold">{{cleanStatusEnum[orderInfo.status]}}</text> <text class="text-bold">{{cleanStatusEnum[orderInfo.status]}}</text>
</view> </view>
<view class="cu-bar bg-white margin-top"> <view class="cu-bar bg-white margin-top">
<view class="action"> <view class="action">
开始拍照上传 开始拍照上传
...@@ -33,20 +33,23 @@ ...@@ -33,20 +33,23 @@
{{orderInfo.startImage? orderInfo.startImage.length:'0'}}/4 {{orderInfo.startImage? orderInfo.startImage.length:'0'}}/4
</view> </view>
</view> </view>
<view v-if="orderInfo.startImage" class="cu-form-group"> <view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub"> <view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in orderInfo.startImage" :key="index" @tap="ViewImage('start',item)"> <view class="bg-img" v-for="(item,index) in orderInfo.startImage" :key="index"
<image :src="item" mode="aspectFill"></image> @tap="ViewImage('start',item)">
<view v-if="orderInfo.status === 0 " class="cu-tag bg-red" @tap.stop="DelImg('start',index)" :data-index="index"> <image :src="item" mode="aspectFill"></image>
<view v-if="orderInfo.status === 0 " class="cu-tag bg-red" @tap.stop="DelImg('start',index)"
:data-index="index">
<text class='cuIcon-close'></text> <text class='cuIcon-close'></text>
</view> </view>
</view> </view>
<view v-if="orderInfo.status === 0 && imgList.length<4" class="solids" @tap="onChooseImage"> <view v-if="orderInfo.status<=1 && orderInfo.startImage.length<4" class="solids"
@tap="onChooseImage('startImage')">
<text class='cuIcon-cameraadd'></text> <text class='cuIcon-cameraadd'></text>
</view> </view>
</view> </view>
</view> </view>
<view v-if="orderInfo.status>=1" class="cu-bar bg-white margin-top"> <view v-if="orderInfo.status>=1" class="cu-bar bg-white margin-top">
<view class="action"> <view class="action">
结束拍照上传 结束拍照上传
...@@ -55,64 +58,79 @@ ...@@ -55,64 +58,79 @@
{{orderInfo.endImage?orderInfo.endImage.length:'0'}}/4 {{orderInfo.endImage?orderInfo.endImage.length:'0'}}/4
</view> </view>
</view> </view>
<view v-if="orderInfo.status>=1" class="cu-form-group"> <view v-if="orderInfo.status>=1" class="cu-form-group">
<view class="grid col-4 grid-square flex-sub"> <view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in orderInfo.endImage" :key="index" @tap="ViewImage('end',item)" > <view class="bg-img" v-for="(item,index) in orderInfo.endImage" :key="index"
<image :src="item" mode="aspectFill"></image> @tap="ViewImage('end',item)">
<view v-if="orderInfo.status == 1" class="cu-tag bg-red" @tap.stop="DelImg('end',index)" :data-index="index"> <image :src="item" mode="aspectFill"></image>
<view v-if="orderInfo.status == 1" class="cu-tag bg-red" @tap.stop="DelImg('end',index)"
:data-index="index">
<text class='cuIcon-close'></text> <text class='cuIcon-close'></text>
</view> </view>
</view> </view>
<view v-if="orderInfo.status == 1 && imgList.length<4 " class="solids" @tap="onChooseImage"> <view v-if="orderInfo.status == 1 && imgList.length<4 " class="solids"
@tap="onChooseImage('endImage')">
<text class='cuIcon-cameraadd'></text> <text class='cuIcon-cameraadd'></text>
</view> </view>
</view> </view>
</view> </view>
<view class="cu-form-group align-start"> <view class="cu-form-group align-start">
<view class="title">备注描述</view> <view class="title">备注描述</view>
<textarea maxlength="-1" :disabled="modalName!=null" @input="textareaBInput" v-model="remark" placeholder="请输入描述"></textarea> <textarea maxlength="-1" :disabled="modalName!=null" @input="textareaBInput" v-model="remark"
placeholder="请输入描述"></textarea>
</view> </view>
</form> </form>
</view> </view>
<view v-if="orderInfo.status !='2' " class="confirm-box"> <view v-if="orderInfo.status !='2' " class="confirm-box">
<view class="confirm-btn"> <view class="confirm-btn">
<button class="cu-btn block bg-blue margin-tb-sm lg" type="" @tap="onOrderConfirm">提交并{{orderInfo.status==1?'完成':'开始'}}保洁</button> <button class="cu-btn block bg-blue margin-tb-sm lg" type=""
@tap="onOrderConfirm">提交并{{orderInfo.status==1?'完成':'开始'}}保洁</button>
</view> </view>
<view class="open-door-btn"> <view class="open-door-btn">
<button class="cu-btn block margin-tb-sm lg" type="" :class="openDoorStatus?'bg-gray':'bg-pink'" @tap="onOpenDoorByCleaner">开门</button> <button class="cu-btn block margin-tb-sm lg" type="" :class="openDoorStatus?'bg-gray':'bg-pink'"
@tap="onOpenDoorByCleaner">开门</button>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import {getInfoById,openDoorByCleaner,startClean,endClean} from "@/api/cleanRoom.js"; import {
import {getDictItem} from "@/utils/tools.js" getInfoById,
import {uploadFile} from "@/api/index.js" openDoorByCleaner,
startClean,
endClean
} from "@/api/cleanRoom.js";
import {
getDictItem
} from "@/utils/tools.js"
import {
uploadFile
} from "@/api/index.js"
export default { export default {
data() { data() {
return { return {
imgList:[], imgList: [],
orderInfo:{}, orderInfo: {},
cleanStatusEnum:{}, cleanStatusEnum: {},
orderId:'', orderId: '',
openDoor:false, openDoor: false,
openDoorStatus:false openDoorStatus: false
}; };
}, },
onLoad(option) { onLoad(option) {
this.orderId = option.id; this.orderId = option.id;
this.onGetDicts() this.onGetDicts()
}, },
methods:{ methods: {
onGetDicts() { onGetDicts() {
let dicts = [] let dicts = []
if (uni.getStorageSync('dicts')) { if (uni.getStorageSync('dicts')) {
...@@ -124,62 +142,68 @@ ...@@ -124,62 +142,68 @@
dicts = res.data.data; dicts = res.data.data;
uni.setStorageSync('dicts', JSON.stringify(res.data.data)) uni.setStorageSync('dicts', JSON.stringify(res.data.data))
this.cleanStatusEnum = getDictItem(dicts, "clean_records_status"); this.cleanStatusEnum = getDictItem(dicts, "clean_records_status");
console.log(this.cleanStatusEnum,909090) console.log(this.cleanStatusEnum, 909090)
this.onLoading() this.onLoading()
}) })
} }
}, },
onLoading(){ onLoading() {
this.imgList = [] this.imgList = []
getInfoById(this.orderId).then(res=>{ getInfoById(this.orderId).then(res => {
if(res.data.code === 200){ if (res.data.code === 200) {
this.orderInfo = { this.orderInfo = {
...res.data.data, ...res.data.data,
startImage:res.data.data.startImage? res.data.data.startImage.split(','):[], startImage: res.data.data.startImage ? res.data.data.startImage.split(',') : [],
endImage: res.data.data.endImage? res.data.data.endImage.split(','):[], endImage: res.data.data.endImage ? res.data.data.endImage.split(',') : [],
} }
} }
}) })
}, },
onChooseImage() { onChooseImage(imgStatus) {
uni.chooseImage({ uni.chooseImage({
count: 4, //默认9 count: 4, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //仅拍照 sourceType: ['album', 'camera'], //仅拍照
success: (res) => { success: (res) => {
console.log(res,"文件") console.log(res, "文件")
// if (this.imgList.length != 0) { // if (this.imgList.length != 0) {
// this.imgList = this.imgList.concat(res.tempFilePaths) // this.imgList = this.imgList.concat(res.tempFilePaths)
// } else { // } else {
// this.imgList = res.tempFilePaths // this.imgList = res.tempFilePaths
// } // }
uni.showLoading({ uni.showLoading({
title:'加载中...' title: '加载中...'
})
uploadFile({
url:res.tempFilePaths[0]
}).then(result=>{
uni.hideLoading()
if(result.data){
let data = JSON.parse(result.data);
if(this.orderInfo.status>=1){
this.orderInfo.endImage.push(data.url)
}else{
this.orderInfo.startImage.push(data.url)
}
}
}) })
this.onUploadFile(res.tempFilePaths, 0, imgStatus)
} }
}); });
}, },
ViewImage(val,url) {
onUploadFile(list = [], index = 0, imgStatus) {
if (index >= list.length) {
uni.hideLoading()
return;
}
uploadFile({
url: list[index]
}).then(result => {
if (result.data) {
let data = JSON.parse(result.data);
this.orderInfo[imgStatus].push(data.url)
this.onUploadFile(list, index + 1, imgStatus)
}
})
},
ViewImage(val, url) {
uni.previewImage({ uni.previewImage({
urls: val=='start'? this.orderInfo.startImage: this.orderInfo.endImage, urls: val == 'start' ? this.orderInfo.startImage : this.orderInfo.endImage,
current: url current: url
}); });
}, },
DelImg(val,i) { DelImg(val, i) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要删除吗?', content: '确定要删除吗?',
...@@ -187,12 +211,12 @@ ...@@ -187,12 +211,12 @@
confirmText: '确定', confirmText: '确定',
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
if(val == 'start'){ if (val == 'start') {
this.orderInfo.startImage.splice(i, 1) this.orderInfo.startImage.splice(i, 1)
}else{ } else {
this.orderInfo.endImage.splice(i, 1) this.orderInfo.endImage.splice(i, 1)
} }
} }
} }
}) })
...@@ -200,102 +224,104 @@ ...@@ -200,102 +224,104 @@
textareaBInput(e) { textareaBInput(e) {
this.textareaBValue = e.detail.value this.textareaBValue = e.detail.value
}, },
onOpenDoorByCleaner(){ onOpenDoorByCleaner() {
if(this.openDoorStatus){ if (this.openDoorStatus) {
uni.showToast({ uni.showToast({
icon:"none", icon: "none",
title:"请勿频繁进行开门操作" title: "请勿频繁进行开门操作"
}) })
return return
} }
uni.showLoading({ uni.showLoading({
title:"开门中..." title: "开门中..."
}) })
this.openDoorStatus = true; this.openDoorStatus = true;
openDoorByCleaner({ openDoorByCleaner({
roomId: this.orderInfo.roomId roomId: this.orderInfo.roomId
}).then(res=>{ }).then(res => {
console.log() console.log()
if(res.data.code == 200){ if (res.data.code == 200) {
this.openDoor = true; this.openDoor = true;
uni.showToast({ uni.showToast({
icon:'success', icon: 'success',
title:'开门成功' title: '开门成功'
}) })
} else { } else {
uni.showToast({ uni.showToast({
icon:'success', icon: 'success',
title:res.data.msg title: res.data.msg
}) })
} }
setTimeout(()=>{ setTimeout(() => {
this.openDoorStatus = false; this.openDoorStatus = false;
},5000) }, 5000)
}) })
}, },
onOrderConfirm(){ onOrderConfirm() {
// if(this.orderInfo.status === 0 && !this.openDoor){ // if(this.orderInfo.status === 0 && !this.openDoor){
// uni.showToast({ // uni.showToast({
// icon:'none', // icon:'none',
// title:'提交前请先开门' // title:'提交前请先开门'
// }) // })
// } // }
if (!this.orderInfo.startImage.length) {
uni.showToast({
icon: 'none',
title: '请上传至少一张开始保洁图片'
})
return
}
if(this.orderInfo.status ==1){ if(this.orderInfo.status ==1){
if(!this.orderInfo.endImage.length){ if (!this.orderInfo.endImage.length) {
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'请上传至少一张图片' title: '请上传至少一张完成保洁图片'
})
return
}
}else{
if(!this.orderInfo.startImage.length){
uni.showToast({
icon:'none',
title:'请上传至少一张图片'
}) })
return return
} }
} }
if(this.orderInfo.status == '1'){ if (this.orderInfo.status == '1') {
endClean({ endClean({
id:this.orderInfo.id, storeId: this.orderInfo.storeId,
id: this.orderInfo.id,
startImage: this.orderInfo.startImage.join(),
endImage: this.orderInfo.endImage.join(), endImage: this.orderInfo.endImage.join(),
remark: this.remark remark: this.remark
}).then(res=>{ }).then(res => {
if(res.data.code == 200){ if (res.data.code == 200) {
uni.showToast({ uni.showToast({
icon:'success', icon: 'success',
title:'提交成功' title: '提交成功'
}) })
this.onLoading() this.onLoading()
}else{ } else {
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:res.data.msg title: res.data.msg
}) })
} }
}) })
}else{ } else {
startClean({ startClean({
id:this.orderInfo.id, storeId: this.orderInfo.storeId,
id: this.orderInfo.id,
startImage: this.orderInfo.startImage.join(), startImage: this.orderInfo.startImage.join(),
remark: this.remark remark: this.remark
}).then(res=>{ }).then(res => {
if(res.data.code == 200){ if (res.data.code == 200) {
uni.showToast({ uni.showToast({
icon:'success', icon: 'success',
title:'提交成功' title: '提交成功'
}) })
uni.navigateBack() uni.navigateBack()
}else{ } else {
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:res.data.msg title: res.data.msg
}) })
} }
}) })
...@@ -306,38 +332,43 @@ ...@@ -306,38 +332,43 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.clean-order-info{ .clean-order-info {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 100%; width: 100%;
.card-box{
width: 94%; .card-box {
border-radius: 24upx; width: 94%;
overflow: hidden; border-radius: 24upx;
padding-bottom: 120upx; overflow: hidden;
padding-bottom: 120upx;
}
} }
}
.confirm-box{ .confirm-box {
position: fixed; position: fixed;
left: 0; left: 0;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
padding: 24upx 0; padding: 24upx 0;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
background-color: #ffffff; background-color: #ffffff;
z-index: 999; z-index: 999;
.confirm-btn{
width: 76%; .confirm-btn {
padding: 0 30upx; width: 76%;
padding: 0 30upx;
}
.open-door-btn {
width: 24%;
padding: 0 30upx 0 0;
}
} }
.open-door-btn{
width: 24%; .cu-form-group .title {
padding: 0 30upx 0 0; width: 280upx;
} }
} </style>
.cu-form-group .title{ \ No newline at end of file
width: 280upx;
}
</style>
<template> <template>
<view class="coupon-list-box"> <view class="coupon-list-box">
<scroll-view scroll-x class="bg-white nav"> <scroll-view scroll-x class="bg-white nav">
<view class="flex text-center"> <view class="flex text-center">
<view class="cu-item flex-sub" :class="index==statusIndex?'text-orange cur':''" <view class="cu-item flex-sub" :class="index==statusIndex?'text-orange cur':''"
v-for="(item,index) in statusList" :key="index" @tap="tabSelect(index)"> v-for="(item,index) in statusList" :key="index" @tap="tabSelect(index)">
<text>{{item.label}}</text> <text>{{item.label}}</text>
</view>
</view> </view>
</view> </scroll-view>
</scroll-view>
<view v-for="(item,index) in list" :key="index" class="coupon-item"> <view v-for="(item,index) in list" :key="index" class="coupon-item">
<view class="part-left"> <view class="flex-row part-top-content">
<image :src="item.useStatus==0? assetsPath+'/coupon_icon.png':assetsPath+'/coupon_icon_gray.png'" mode="widthFix"></image> <view class="flex-col part-left" :class="item.useStatus ===0? 'pink':'gray'">
</view> <image :src="item.useStatus==0? assetsPath+'/coupon_icon.png':assetsPath+'/coupon_icon_gray.png'"
<view class="part-right"> mode="widthFix"></image>
<view class="coupon-name"> <text v-if="item.useStatus ===2">{{item.endDate}}过期</text>
<text class="text-title text-lg text-bold" style="width: 64%;">{{item.name}}</text> <text v-else-if="item.useStatus ===0" class="text-white">{{item.surplusDays>=0 ? item.surplusDays+'天后':item.endDate}}过期</text>
<text class="text-lg" :class="item.useStatus==0?'text-pink':'text-gray'">{{item.useStatus==0?'待使用':'已使用'}}</text> <text v-else class="text-white">{{statusEnum[item.useStatus]}}</text>
</view> </view>
<view class="part-right">
<view class="flex-row margin-top"> <view class="flex-1 coupon-name">
<text class="">来源:</text> <text class="text-title text-bold">{{item.name}}</text>
<text>{{couponSourceEnum[item.sourceType]}}</text> <text class=""
:class="item.useStatus==0?'text-pink':'text-gray'">{{statusEnum[item.useStatus]}}</text>
</view>
<view class="flex-1 flex-row text-gray">
<text class="">来源:</text>
<text>{{couponSourceEnum[item.sourceType]}} {{item.platformType!==1? '('+platformEnum[item.platformType]+')' : ''}}</text>
</view>
<view v-if="item.couponType == 4" class="flex-1 flex-row text-gray ">
<text class="">使用说明:</text>
<text>{{item.remark || ''}}</text>
</view>
<view v-else class="flex-1 flex-row text-gray ">
<text class="">使用说明:</text>
<text class="">{{item.minPrice}}元,优惠{{item.subPrice}}</text>
</view>
<view v-if="item.couponTimeStart && item.couponTimeEnd" class="flex-1 des text-gray ">
<view class="flex-row">
<text class="">可用时段:</text>
<text class="">{{item.couponTimeStart}}-{{item.couponTimeEnd}}</text>
</view>
<!-- <text class="">{{platformEnum[item.platformType]}}</text> -->
</view>
<view v-else class="flex-1 des text-gray">
<text class="">全天通用</text>
<text>{{platformEnum[item.platformType]}}</text>
</view>
</view> </view>
<view v-if="item.couponType == 4" class="flex-row margin-top"> </view>
<text class="">使用说明:</text> <view v-if="item.useStatus===0 && item.platformType!==1" class="flex-row-center part-bottom-store">
<text>{{item.remark || ''}}</text> <view class="flex-1">
<text>适用门店:{{item.storeNameList[0]}}等门店适用</text>
</view> </view>
<view v-else class="flex-row margin-top"> <view class="">
<text class="">使用说明:</text> <button class="cu-btn bg-pink sm" @tap="onGetListByIds(item)">查看</button>
<text class="">{{item.minPrice}}元,优惠{{item.subPrice}}</text>
</view> </view>
<view v-if="item.couponTimeStart && item.couponTimeEnd" class="des margin-top"> </view>
<view class="flex-row"> <view v-else-if="item.useStatus===0 && !item.storeIds" class="flex-between part-bottom-store">
<text class="">可用时段:</text> <view class="">
<text class="">{{item.couponTimeStart}}-{{item.couponTimeEnd}}</text> <text>适用门店:全门店通用</text>
</view>
<text>{{platformEnum[item.platformType]}}</text>
</view> </view>
<view v-else class="des margin-top"> <view class="">
<text class="">全天通用</text>
<text>{{platformEnum[item.platformType]}}</text>
</view> </view>
<view class="coupon-name margin-top"> </view>
<text class="text-gray">有效期限:</text> <view v-else-if="item.useStatus===1&&item.storeName" class="flex-between part-bottom-store">
<text class="text-gray">{{item.startDate}}{{item.endDate}}</text> <view class="">
<text>使用门店:{{item.storeName}}</text>
</view>
<view class="">
</view> </view>
</view> </view>
</view> </view>
<view v-if="list.length == 0" class="empty-box"> <view v-if="list.length == 0" class="empty-box">
<!-- 列表数量为0时 --> <!-- 列表数量为0时 -->
<u-empty text="暂无数据" textColor='#C1C1C1' width="120" <u-empty text="暂无数据" textColor='#C1C1C1' width="120" :icon="listBlankImage">
:icon="listBlankImage">
</u-empty> </u-empty>
</view> </view>
<!-- 当数据没有更多时 --> <!-- 当数据没有更多时 -->
...@@ -60,19 +84,52 @@ ...@@ -60,19 +84,52 @@
<u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText" <u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText"
:loadmore-text="loadmoreText" :nomore-text="nomoreText" /> :loadmore-text="loadmoreText" :nomore-text="nomoreText" />
</view> </view>
<uni-popup ref="popupStoreList" type="center">
<view class="flex-col pop-store-list">
<!-- <image style="width: 699upx;" :src="assetsPath +'/pop_bg.png'" mode="widthFix"></image> -->
<view class="flex-col absolute">
<view class="content-box">
<view class="flex-row title margin-left-lg">
<text style="color: #512C19;" class="text-xl text-bold">适用门店:</text>
</view>
<view class="close-box text-xxl margin-right" @tap="onStoreClose()">
<text class="cuIcon-roundclosefill" style="color: #bf9e62;"></text>
</view>
</view>
<!-- 展示所有房间列表 -->
<view class="store-box">
<StoreList style="width: 100%;" v-model="popStoreList" @change="onStoreChage"></StoreList>
</view>
</view>
</view>
</uni-popup>
</view> </view>
</template> </template>
<script> <script>
import {dictList} from "@/api/index.js"; import moment from "@/common/moment.js"
import {getDictItem} from "@/utils/tools.js" import {
dictList
} from "@/api/index.js";
import {
getDictItem
} from "@/utils/tools.js"
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 {
getCouponList
} from "@/api/coupon"
import {
getListByIds
} from "@/api/store.js"
import StoreList from "@/components/storeList/popStoreList"
export default { export default {
components: {
StoreList
},
data() { data() {
return { return {
status: 'nomore ', status: 'nomore ',
...@@ -92,15 +149,14 @@ ...@@ -92,15 +149,14 @@
pageNum: 1, pageNum: 1,
useStatus: '0', useStatus: '0',
}, },
eventChannel:null, eventChannel: null,
tipText:"", tipText: "",
show:false, show: false,
listBlankImage:indexConfig.assetsPath+'/no_data_icon.png', listBlankImage: indexConfig.assetsPath + '/no_data_icon.png',
statusIndex: 0, statusIndex: 0,
platformEnum:{}, platformEnum: {},
couponSourceEnum:{}, couponSourceEnum: {},
statusList: [ statusList: [{
{
label: "待使用", label: "待使用",
value: "0", value: "0",
}, },
...@@ -112,18 +168,24 @@ ...@@ -112,18 +168,24 @@
label: "已过期", label: "已过期",
value: "2", value: "2",
}, },
] ],
statusEnum: {
'0': "待使用",
'1': "已使用",
'2': "已过期",
},
popStoreList:[]
}; };
}, },
components: { components: {
'fixed-header': FixedHeader 'fixed-header': FixedHeader
}, },
onReachBottom() { onReachBottom() {
if(this.status=='loadmore'){ if (this.status == 'loadmore') {
this.queryParams.pageNum+=1; this.queryParams.pageNum += 1;
this.onLoading(); this.onLoading();
} }
}, },
onLoad() { onLoad() {
this.onGetDicts(); this.onGetDicts();
...@@ -136,9 +198,9 @@ ...@@ -136,9 +198,9 @@
if (dictStr) { if (dictStr) {
let dicts = JSON.parse(dictStr) let dicts = JSON.parse(dictStr)
this.platformEnum = getDictItem(dicts, "consumer_coupon_platform_type"); this.platformEnum = getDictItem(dicts, "consumer_coupon_platform_type");
this.couponSourceEnum = getDictItem(dicts, "consumer_coupon_source_type"); this.couponSourceEnum = getDictItem(dicts, "consumer_coupon_source_type");
this.$forceUpdate() this.$forceUpdate()
} }
dictList().then(res => { dictList().then(res => {
dicts = res.data.data; dicts = res.data.data;
...@@ -148,15 +210,26 @@ ...@@ -148,15 +210,26 @@
this.$forceUpdate() this.$forceUpdate()
}) })
}, },
onLoading(){ onLoading() {
getCouponList(this.queryParams).then(res=>{ getCouponList(this.queryParams).then(res => {
if(res.data.code === 200 ){ if (res.data.code === 200) {
if(this.queryParams.pageNum == 1){ let list = res.data.rows.map(item=>{
this.list = res.data.rows let endTime = moment(item.endDate).valueOf();
} else{ let nowTime = moment().valueOf();
this.list = [...this.list,...res.data.rows] let surplusDays = parseInt(moment.duration(endTime-nowTime).asDays())
return {
...item,
storeIds: item.storeIds? item.storeIds.split(','):'',
surplusDays: surplusDays<=30? surplusDays:-10000
}
})
if (this.queryParams.pageNum == 1) {
this.list = list
} else {
this.list = [...list, ...res.data.rows]
} }
console.log(this.list,9999)
this.total = res.data.total this.total = res.data.total
if (this.list.length < this.total) { if (this.list.length < this.total) {
this.status = 'loadmore'; this.status = 'loadmore';
...@@ -166,6 +239,37 @@ ...@@ -166,6 +239,37 @@
} }
}) })
}, },
onStoreClose() {
this.$refs.popupStoreList.close()
},
onGetListByIds(item){
getListByIds({
longitude: uni.getStorageSync('longitude'),
latitude: uni.getStorageSync('latitude'),
storeIds: item.storeIds
}).then(res=>{
console.log(res,99999999999)
if(res.data.code ==200){
this.popStoreList = res.data.data.map(item=>{
return {
...item,
images: item.images ? item.images.split(",").map(val => this.hostUrl +
val) : []
}
});
this.$refs.popupStoreList.open()
}
})
},
onStoreChage(val){
console.log(val,9999)
uni.setStorageSync("storeId", val);
setTimeout(() => {
uni.switchTab({
url:"/pages/index/index"
})
}, 200)
},
tabSelect(i) { tabSelect(i) {
this.statusIndex = i; this.statusIndex = i;
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
...@@ -178,68 +282,162 @@ ...@@ -178,68 +282,162 @@
</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%;
padding-top: 100upx; padding-top: 100upx;
.nav{
position: fixed; .nav {
top: 0; position: fixed;
left: 0; top: 0;
height: 90upx; left: 0;
z-index: 999; height: 90upx;
} z-index: 999;
.coupon-item{
display: flex; text {
flex-direction: row; font-size: 32upx;
width: 94%; }
border-radius: 24upx;
background-color: #ffffff; .text-orange {
margin: 12upx 0; color: #f3447e;
padding: 30upx 20upx; font-weight: 600;
box-shadow: 0 0 12upx rgba(255, 0, 127, 0.23); }
.part-left{ }
display: flex;
justify-content: center; .coupon-item {
align-items: center; display: flex;
width: 160upx; flex-direction: column;
margin-right: 20upx; width: 94%;
image{ border-radius: 10upx;
display: block; background-color: #ffffff;
width: 100%; margin: 12upx 0;
max-height:140upx ; padding: 20upx 0;
} // border-top: 1px solid #CCD1DB;
} // border-bottom: 1px solid #CCD1DB;
.part-right{ box-shadow: 0 0 12upx rgba(0, 0, 0, 0.23);
display: flex;
flex: 1; .part-top-content{
flex-direction: column; padding: 0 26upx 20upx;
.coupon-name{ }
display: flex; .part-bottom-store {
justify-content: space-between; display: flex;
} align-items: center;
.des{ margin-top: 16upx;
display: flex; border-top: 1px dashed #e5e5e5;
justify-content: space-between; padding: 20upx 26upx 0;
align-items: center; }
.flex-row{
display: flex; .part-left {
flex-direction: row; display: flex;
align-items: center; justify-content: center;
} align-items: center;
} width: 240upx;
.margin-top{ height: 180upx;
margin-top: 12upx; margin-right: 20upx;
} // background: linear-gradient(120deg, rgba(224,57,151,0.8), rgba(255,55,93,0.8));
} border-radius: 8rpx;
}
} image {
.empty-box{ display: block;
display: flex; width: 86%;
justify-content: center; max-height: 120upx;
align-items: center; margin: 12upx 0;
min-height: 400upx; }
}
</style> .text-white {
margin-bottom: 12upx;
}
}
.pink{
box-shadow: 0 0 6upx rgba(224, 57, 151, 0.6);
.text-white {
color: #e03997;
}
}
.gray{
box-shadow: 0 0 6upx rgba(0, 0, 0, 0.23);
.text-white{
color: #666666;
}
}
.part-right {
display: flex;
flex: 1;
flex-direction: column;
.text-gray {
color: #8c8c8c;
}
.coupon-name {
display: flex;
justify-content: space-between;
.text-title{
font-size: 28upx;
width: 280upx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.des {
display: flex;
justify-content: space-between;
align-items: center;
.flex-row {
display: flex;
flex-direction: row;
align-items: center;
}
}
.margin-top {
margin-top: 8upx;
}
}
}
}
.empty-box {
display: flex;
justify-content: center;
align-items: center;
min-height: 400upx;
}
.pop-store-list {
position: relative;
display: flex;
flex-direction: column;
width: 92vw;
height: 74vh;
background-color: #ffffff;
border-radius: 20upx;
box-shadow: 0 6upx 16upx rgba(255, 0, 255, 0.34);
padding-bottom: 20upx;
overflow: hidden;
.content-box {
display: flex;
justify-content: space-between;
align-items: center;
height: 9%;
padding-top: 1%;
.close-box {}
}
.store-box {
display: flex;
flex: 1;
width: 100%;
overflow-y: auto;
padding: 0 2% 3%;
}
}
</style>
\ No newline at end of file
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
<view class="flex-between price use-coupon-box"> <view class="flex-between price use-coupon-box">
<text <text
class="text-black text-left">{{useCouponList[selectCouponIndex].couponType==2? '团购券':'优惠券'}}</text> class="text-black text-left">{{useCouponList[selectCouponIndex].couponType==2? '团购券':'优惠券'}}</text>
<view class="flex-row" @tap="onNavToSelectCoupon"> <view class="flex-1 flex-row" @tap="onNavToSelectCoupon">
<text class="" :class="useCouponList.length?'text-pink':'text-gray'"> <text class="" :class="useCouponList.length?'text-pink':'text-gray'">
{{ useCouponList.length && selectCouponIndex>=0? useCouponList[selectCouponIndex].name: couponList.length? '请选择':'暂无可用'}}</text> {{ useCouponList.length && selectCouponIndex>=0? useCouponList[selectCouponIndex].name: couponList.length? '请选择':'暂无可用'}}</text>
<text class="cuIcon-right " :class="useCouponList.length?'text-pink':'text-gray'"></text> <text class="cuIcon-right " :class="useCouponList.length?'text-pink':'text-gray'"></text>
...@@ -2092,7 +2092,11 @@ ...@@ -2092,7 +2092,11 @@
.use-coupon-box { .use-coupon-box {
.flex-row { .flex-row {
max-width: 70%; display: flex;
justify-content: space-between;
align-items: center;
// max-width: 70%;
margin-left: 12upx;
} }
} }
......
...@@ -34,7 +34,13 @@ ...@@ -34,7 +34,13 @@
</view> </view>
<view class="part-left"> <view class="part-left">
<view class="select-btn" :class="{active: selectId === item.id }"> <view class="surplus-days">
<view v-if="item.surplusDays>=0" class="flex-row-center">
<text class="cuIcon-countdown text-red"></text>
<text class="text-red">{{item.surplusDays}}天后过期</text>
</view>
</view>
<view class="select-btn margin-top-sm" :class="{active: selectId === item.id }">
<radio-group v-if="item.isAvailable != 1" class="radio-group" > <radio-group v-if="item.isAvailable != 1" class="radio-group" >
<radio class='brown' :class="selectId === item.id?'checked':''" :checked="selectId === item.id?true:false" color="#AF7117"></radio> <radio class='brown' :class="selectId === item.id?'checked':''" :checked="selectId === item.id?true:false" color="#AF7117"></radio>
</radio-group> </radio-group>
...@@ -62,6 +68,7 @@ ...@@ -62,6 +68,7 @@
</template> </template>
<script> <script>
import moment from "@/common/moment.js"
import {dictList} from "@/api/index.js"; import {dictList} from "@/api/index.js";
import {getDictItem} from "@/utils/tools.js" import {getDictItem} from "@/utils/tools.js"
import config from "@/config/index.config" import config from "@/config/index.config"
...@@ -131,9 +138,14 @@ ...@@ -131,9 +138,14 @@
if (res.statusCode == 200) { if (res.statusCode == 200) {
if (res.data && res.data.data.length) { if (res.data && res.data.data.length) {
let list = res.data.data.map(item=> { let list = res.data.data.map(item=> {
let endTime = moment(item.endDate).valueOf();
let nowTime = moment().valueOf();
let surplusDays = parseInt(moment.duration(endTime-nowTime).asDays())
return { return {
...item, ...item,
subPrice: item.subPrice || 0 subPrice: item.subPrice || 0,
surplusDays: surplusDays<=30? surplusDays:-10000
} }
}) })
...@@ -210,7 +222,10 @@ ...@@ -210,7 +222,10 @@
} }
.part-left { .part-left {
display: flex; display: flex;
flex-direction: row; flex-direction: column;
.surplus-days{
height: 40upx;
}
.select-btn{ .select-btn{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
...@@ -265,9 +280,9 @@ ...@@ -265,9 +280,9 @@
filter: grayscale(100%); filter: grayscale(100%);
.select-btn{ .select-btn{
background: #ffffff!important; background: #ffffff!important;
height: 32px !important; height: 26px !important;
border-radius: 16px !important; border-radius: 16px !important;
padding: 12upx 24upx !important; padding: 0 12upx !important;
text{ text{
color: #929292 !important; color: #929292 !important;
} }
......
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