Commit 7fe0bfe8 by zhangzhen

功能完善

parent 9a599823
...@@ -36,3 +36,9 @@ export const cleanList=(data)=>{ ...@@ -36,3 +36,9 @@ export const cleanList=(data)=>{
let url=`/cleanRecords/myCleanList` let url=`/cleanRecords/myCleanList`
return http.get(url,data) return http.get(url,data)
} }
//领取全部的待保洁的任务
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
...@@ -24,3 +24,8 @@ ...@@ -24,3 +24,8 @@
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,9 +38,13 @@ ...@@ -38,9 +38,13 @@
</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>
<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> <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>
<view class=""> <view class="">
...@@ -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;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<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> -->
...@@ -33,15 +33,18 @@ ...@@ -33,15 +33,18 @@
{{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"
@tap="ViewImage('start',item)">
<image :src="item" mode="aspectFill"></image> <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"> <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>
...@@ -58,13 +61,16 @@ ...@@ -58,13 +61,16 @@
<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"
@tap="ViewImage('end',item)">
<image :src="item" mode="aspectFill"></image> <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"> <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>
...@@ -72,7 +78,8 @@ ...@@ -72,7 +78,8 @@
<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>
...@@ -80,11 +87,13 @@ ...@@ -80,11 +87,13 @@
<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>
...@@ -93,26 +102,35 @@ ...@@ -93,26 +102,35 @@
</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({ this.onUploadFile(res.tempFilePaths, 0, imgStatus)
url:res.tempFilePaths[0] }
}).then(result=>{ });
},
onUploadFile(list = [], index = 0, imgStatus) {
if (index >= list.length) {
uni.hideLoading() uni.hideLoading()
if(result.data){ return;
let data = JSON.parse(result.data);
if(this.orderInfo.status>=1){
this.orderInfo.endImage.push(data.url)
}else{
this.orderInfo.startImage.push(data.url)
} }
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) {
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,9 +211,9 @@ ...@@ -187,9 +211,9 @@
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.status ==1){ if (!this.orderInfo.startImage.length) {
if(!this.orderInfo.endImage.length){
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'请上传至少一张图片' title: '请上传至少一张开始保洁图片'
}) })
return return
} }
}else{ if(this.orderInfo.status ==1){
if(!this.orderInfo.startImage.length){ if (!this.orderInfo.endImage.length) {
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'请上传至少一张图片' 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,19 +332,21 @@ ...@@ -306,19 +332,21 @@
</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{
.card-box {
width: 94%; width: 94%;
border-radius: 24upx; border-radius: 24upx;
overflow: hidden; overflow: hidden;
padding-bottom: 120upx; padding-bottom: 120upx;
} }
} }
.confirm-box{
.confirm-box {
position: fixed; position: fixed;
left: 0; left: 0;
bottom: 0; bottom: 0;
...@@ -328,16 +356,19 @@ ...@@ -328,16 +356,19 @@
flex-direction: row; flex-direction: row;
background-color: #ffffff; background-color: #ffffff;
z-index: 999; z-index: 999;
.confirm-btn{
.confirm-btn {
width: 76%; width: 76%;
padding: 0 30upx; padding: 0 30upx;
} }
.open-door-btn{
.open-door-btn {
width: 24%; width: 24%;
padding: 0 30upx 0 0; padding: 0 30upx 0 0;
} }
} }
.cu-form-group .title{
.cu-form-group .title {
width: 280upx; width: 280upx;
} }
</style> </style>
\ No newline at end of file
...@@ -10,49 +10,73 @@ ...@@ -10,49 +10,73 @@
</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'">
<image :src="item.useStatus==0? assetsPath+'/coupon_icon.png':assetsPath+'/coupon_icon_gray.png'"
mode="widthFix"></image>
<text v-if="item.useStatus ===2">{{item.endDate}}过期</text>
<text v-else-if="item.useStatus ===0" class="text-white">{{item.surplusDays>=0 ? item.surplusDays+'天后':item.endDate}}过期</text>
<text v-else class="text-white">{{statusEnum[item.useStatus]}}</text>
</view> </view>
<view class="part-right"> <view class="part-right">
<view class="coupon-name"> <view class="flex-1 coupon-name">
<text class="text-title text-lg text-bold" style="width: 64%;">{{item.name}}</text> <text class="text-title text-bold">{{item.name}}</text>
<text class="text-lg" :class="item.useStatus==0?'text-pink':'text-gray'">{{item.useStatus==0?'待使用':'已使用'}}</text> <text class=""
:class="item.useStatus==0?'text-pink':'text-gray'">{{statusEnum[item.useStatus]}}</text>
</view> </view>
<view class="flex-row margin-top"> <view class="flex-1 flex-row text-gray">
<text class="">来源:</text> <text class="">来源:</text>
<text>{{couponSourceEnum[item.sourceType]}}</text> <text>{{couponSourceEnum[item.sourceType]}} {{item.platformType!==1? '('+platformEnum[item.platformType]+')' : ''}}</text>
</view> </view>
<view v-if="item.couponType == 4" class="flex-row margin-top"> <view v-if="item.couponType == 4" class="flex-1 flex-row text-gray ">
<text class="">使用说明:</text> <text class="">使用说明:</text>
<text>{{item.remark || ''}}</text> <text>{{item.remark || ''}}</text>
</view> </view>
<view v-else class="flex-row margin-top"> <view v-else class="flex-1 flex-row text-gray ">
<text class="">使用说明:</text> <text class="">使用说明:</text>
<text class="">{{item.minPrice}}元,优惠{{item.subPrice}}</text> <text class="">{{item.minPrice}}元,优惠{{item.subPrice}}</text>
</view> </view>
<view v-if="item.couponTimeStart && item.couponTimeEnd" class="des margin-top"> <view v-if="item.couponTimeStart && item.couponTimeEnd" class="flex-1 des text-gray ">
<view class="flex-row"> <view class="flex-row">
<text class="">可用时段:</text> <text class="">可用时段:</text>
<text class="">{{item.couponTimeStart}}-{{item.couponTimeEnd}}</text> <text class="">{{item.couponTimeStart}}-{{item.couponTimeEnd}}</text>
</view> </view>
<text>{{platformEnum[item.platformType]}}</text> <!-- <text class="">{{platformEnum[item.platformType]}}</text> -->
</view> </view>
<view v-else class="des margin-top"> <view v-else class="flex-1 des text-gray">
<text class="">全天通用</text> <text class="">全天通用</text>
<text>{{platformEnum[item.platformType]}}</text> <text>{{platformEnum[item.platformType]}}</text>
</view> </view>
<view class="coupon-name margin-top"> </view>
<text class="text-gray">有效期限:</text> </view>
<text class="text-gray">{{item.startDate}}{{item.endDate}}</text> <view v-if="item.useStatus===0 && item.platformType!==1" class="flex-row-center part-bottom-store">
<view class="flex-1">
<text>适用门店:{{item.storeNameList[0]}}等门店适用</text>
</view>
<view class="">
<button class="cu-btn bg-pink sm" @tap="onGetListByIds(item)">查看</button>
</view>
</view>
<view v-else-if="item.useStatus===0 && !item.storeIds" class="flex-between part-bottom-store">
<view class="">
<text>适用门店:全门店通用</text>
</view>
<view class="">
</view>
</view>
<view v-else-if="item.useStatus===1&&item.storeName" class="flex-between part-bottom-store">
<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>
<!-- 当数据没有更多时 --> <!-- 当数据没有更多时 -->
...@@ -61,18 +85,51 @@ ...@@ -61,18 +85,51 @@
: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,15 +168,21 @@ ...@@ -112,15 +168,21 @@
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();
} }
...@@ -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{
.nav {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
height: 90upx; height: 90upx;
z-index: 999; z-index: 999;
text {
font-size: 32upx;
} }
.coupon-item{
.text-orange {
color: #f3447e;
font-weight: 600;
}
}
.coupon-item {
display: flex; display: flex;
flex-direction: row; flex-direction: column;
width: 94%; width: 94%;
border-radius: 24upx; border-radius: 10upx;
background-color: #ffffff; background-color: #ffffff;
margin: 12upx 0; margin: 12upx 0;
padding: 30upx 20upx; padding: 20upx 0;
box-shadow: 0 0 12upx rgba(255, 0, 127, 0.23); // border-top: 1px solid #CCD1DB;
.part-left{ // border-bottom: 1px solid #CCD1DB;
box-shadow: 0 0 12upx rgba(0, 0, 0, 0.23);
.part-top-content{
padding: 0 26upx 20upx;
}
.part-bottom-store {
display: flex;
align-items: center;
margin-top: 16upx;
border-top: 1px dashed #e5e5e5;
padding: 20upx 26upx 0;
}
.part-left {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 160upx; width: 240upx;
height: 180upx;
margin-right: 20upx; margin-right: 20upx;
image{ // background: linear-gradient(120deg, rgba(224,57,151,0.8), rgba(255,55,93,0.8));
border-radius: 8rpx;
image {
display: block; display: block;
width: 100%; width: 86%;
max-height:140upx ; max-height: 120upx;
margin: 12upx 0;
} }
.text-white {
margin-bottom: 12upx;
} }
.part-right{ }
.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; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
.coupon-name{
.text-gray {
color: #8c8c8c;
}
.coupon-name {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.text-title{
font-size: 28upx;
width: 280upx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
} }
.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; .margin-top {
margin-top: 8upx;
} }
} }
} }
} }
.empty-box{
.empty-box {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-height: 400upx; 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> </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