Commit e3b5b235 by zhangzhen

功能完善

parent b5d8ace9
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import {
dictList
} from "@/api/index.js"
export default { export default {
onLaunch: function(e) { onLaunch: function(e) {
...@@ -17,18 +14,17 @@ ...@@ -17,18 +14,17 @@
updateManager.applyUpdate() updateManager.applyUpdate()
}) })
dictList().then(res => { // Vue.prototype.dicts = [];
console.log(res, "获取字典")
Vue.prototype.dicts = res.data.data; // if(uni.getStorageSync('dicts')){
Vue.prototype.getDictItem = (dictType) => { // Vue.prototype.dicts = JSON.parse(uni.getStorageSync('dicts'))
let arr = Vue.prototype.dicts.filter(item => item.dictType === dictType) // } else {
let obj={}; // dictList().then(res => {
arr[0].dictDatas.forEach(val => { // console.log(res, "获取字典")
obj[val.dictValue] = val.dictLabel // Vue.prototype.dicts = res.data.data;
}) // uni.setStorageSync('dicts',JSON.stringify(res.data.data))
return obj // })
} // }
})
uni.getSystemInfo({ uni.getSystemInfo({
success: (e) => { success: (e) => {
......
...@@ -25,3 +25,8 @@ export const openDoorByCleaner=(data)=>{ ...@@ -25,3 +25,8 @@ export const openDoorByCleaner=(data)=>{
let url=`/room/open/door` let url=`/room/open/door`
return http.post(url,data) return http.post(url,data)
} }
// 获取进行中的保洁订单
export const getStarOrder=()=>{
let url=`/cleanRecords/getByCleanerId`
return http.get(url)
}
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
</template> </template>
<script> <script>
import {
getDictItem
} from "@/utils/tools.js"
export default { export default {
name: "storeList", name: "storeList",
props: { props: {
...@@ -45,11 +49,7 @@ ...@@ -45,11 +49,7 @@
data() { data() {
return { return {
list: [], list: [],
storeTypeEnum:{ storeTypeEnum:{},
"1":"标准店",
"2":"形象店",
"3":"旗舰店",
},
}; };
}, },
watch: { watch: {
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
} }
}, },
mounted() { mounted() {
this.storeTypeEnum = this.getDictItem("store_type"); let dicts = JSON.parse(uni.getStorageSync('dicts'))
this.storeTypeEnum = getDictItem(dicts,"store_type");
}, },
methods: { methods: {
onLoading() { onLoading() {
......
const CONFIG = { const CONFIG = {
// 开发环境配置 // 开发环境配置
development: { development: {
assetsPath: 'http://192.168.43.242:8211/static', // 静态资源路径 assetsPath: 'http://10.24.5.119:8211/static', // 静态资源路径
baseUrl: 'http://192.168.43.21:8883/front-api', // 后台接口请求地址 baseUrl: 'http://10.106.30.135:8883/front-api', // 后台接口请求地址
hostUrl: 'http://192.168.43.21:8882', // H5地址(前端运行地址) hostUrl: 'http://10.106.30.135:8882', // H5地址(前端运行地址)
// baseUrl: 'http://192.168.1.189:8883/front', // 后台接口请求地址 // baseUrl: 'http://192.168.1.189:8883/front', // 后台接口请求地址
// hostUrl: 'http://192.168.1.189:8882', // H5地址(前端运行地址) // hostUrl: 'http://192.168.1.189:8882', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址 websocketUrl: '', // websocket服务端地址
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</template> </template>
<script> <script>
import {getListStore} from "@/api/cleanRoom.js"; import {getListStore,getStarOrder} from "@/api/cleanRoom.js";
import config from "@/config/index.config" import config from "@/config/index.config"
export default { export default {
...@@ -92,9 +92,12 @@ ...@@ -92,9 +92,12 @@
}) })
}, },
onNavToInfo(){ onNavToInfo(){
uni.navigateTo({ getStarOrder().then(res=>{
url:"/pages/cleanOrderInfo/cleanOrderInfo" console.log(res,"查询保洁中的订单")
}) })
// uni.navigateTo({
// url:"/pages/cleanOrderInfo/cleanOrderInfo"
// })
}, },
onNavLocation(val){ onNavLocation(val){
uni.openLocation({ uni.openLocation({
......
<template> <template>
<view class="home" @touchstart="onTouchStart" @touchend="onTouchEnd"> <view class="home" @touchstart="onTouchStart" @touchend="onTouchEnd">
<f-navbar title="凑角" :isShowTransparentTitle="false" :isShowLeft="false" fontColor="#ffffff" :fontSize="46" <f-navbar title="凑角" :isShowTransparentTitle="false" :isShowLeft="false" fontColor="#ffffff" :fontSize="46"
bgColor="#e40583" :scrollTop="scrollTop" navbarType='5'></f-navbar> bgColor="#e40583" :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">
<view class="header-content" <view class="header-content"
:style="{height: statusBarHeight + 210+'px',paddingTop:statusBarHeight+'px' }"> :style="{height: statusBarHeight + 210+'px',paddingTop:statusBarHeight+'px' }">
...@@ -46,13 +46,15 @@ ...@@ -46,13 +46,15 @@
<view class="title"> <view class="title">
<text class="text-title">房间预览</text> <text class="text-title">房间预览</text>
</view> </view>
<view v-for="(item,index) in storeInfo.roomVoList" :key="index" class="list-item-box" @tap="onNavToOrder(item)"> <view v-for="(item,index) in storeInfo.roomVoList" :key="index" class="list-item-box"
@tap="onNavToOrder(item)">
<view class="relative part-top"> <view class="relative part-top">
<image class="room-img" :src="item.images[0]" mode="scaleToFill"></image> <image class="room-img" :src="item.images[0]" mode="scaleToFill"></image>
<view class="absolute part-top-content"> <view class="absolute part-top-content">
<view class="flex-between"> <view class="flex-between">
<view></view> <view></view>
<image :src="assetsPath +'/nav_to_icon.png'" mode="widthFix" @tap.stop="onNavToInfo(item)"> <image :src="assetsPath +'/nav_to_icon.png'" mode="widthFix"
@tap.stop="onNavToInfo(item)">
</image> </image>
</view> </view>
</view> </view>
...@@ -78,7 +80,7 @@ ...@@ -78,7 +80,7 @@
<text>{{val.name}}</text> <text>{{val.name}}</text>
</view> </view>
</view> </view>
<view class="confirm" > <view class="confirm">
<text class="cuIcon-add text-white text-lg"></text> <text class="cuIcon-add text-white text-lg"></text>
</view> </view>
</view> </view>
...@@ -93,10 +95,18 @@ ...@@ -93,10 +95,18 @@
<script> <script>
import fNavbar from '@/components/module/f-navbar/f-navbar'; import fNavbar from '@/components/module/f-navbar/f-navbar';
import {login} from "@/api/index.js"; import {
import {getListStore} from "@/api/store"; login,
dictList
} from "@/api/index.js";
import {
getListStore
} from "@/api/store";
import config from "@/config/index.config" import config from "@/config/index.config"
import ToolBox from "@/components/toolBox/toolBox" import ToolBox from "@/components/toolBox/toolBox"
import {
getDictItem
} from "@/utils/tools.js"
export default { export default {
components: { components: {
...@@ -111,7 +121,7 @@ ...@@ -111,7 +121,7 @@
storeInfo: {}, storeInfo: {},
statusBarHeight: this.statusBarHeight, statusBarHeight: this.statusBarHeight,
hostUrl: config.hostUrl, hostUrl: config.hostUrl,
assetsPath:config.assetsPath, assetsPath: config.assetsPath,
latitude: uni.getStorageSync("latitude") || "", latitude: uni.getStorageSync("latitude") || "",
longitude: uni.getStorageSync("longitude") || "", longitude: uni.getStorageSync("longitude") || "",
queryParams: { queryParams: {
...@@ -127,15 +137,15 @@ ...@@ -127,15 +137,15 @@
}, },
{ {
value: "2", value: "2",
url: this.assetsPath +"/vector.png" url: this.assetsPath + "/vector.png"
}, },
{ {
value: "3", value: "3",
url: this.assetsPath +"/artwork.png" url: this.assetsPath + "/artwork.png"
}, },
{ {
value: "4", value: "4",
url: this.assetsPath +"/power.png" url: this.assetsPath + "/power.png"
}, },
], ],
options: [{ options: [{
...@@ -151,7 +161,7 @@ ...@@ -151,7 +161,7 @@
label: "8小时" label: "8小时"
} }
], ],
facilitieList:{}, facilitieList: {},
show: true, show: true,
timer: null timer: null
} }
...@@ -189,14 +199,27 @@ ...@@ -189,14 +199,27 @@
}, },
onLoad(option) { onLoad(option) {
console.log(option, 909090) console.log(option, 909090)
}, this.onGetDicts()
mounted() {
this.facilitieList = this.getDictItem && this.getDictItem("indoor_facilities");
console.log(this.facilitieList)
}, },
methods: { methods: {
onGetDicts() {
let dicts = []
if (uni.getStorageSync('dicts')) {
dicts = JSON.parse(uni.getStorageSync('dicts'))
this.facilitieList = getDictItem(dicts, "indoor_facilities");
this.onLoading()
} else {
dictList().then(res => {
console.log(res, "获取字典")
dicts = res.data.data;
uni.setStorageSync('dicts', JSON.stringify(res.data.data))
this.facilitieList = getDictItem(dicts, "indoor_facilities");
this.onLoading()
})
}
},
onLoading() { onLoading() {
uni.showLoading({ uni.showLoading({
title: "加载中..." title: "加载中..."
...@@ -225,7 +248,7 @@ ...@@ -225,7 +248,7 @@
}, },
complete: () => { complete: () => {
uni.removeStorage({ uni.removeStorage({
key:'storeId' key: 'storeId'
}) })
this.onGetListStore() this.onGetListStore()
} }
...@@ -247,13 +270,13 @@ ...@@ -247,13 +270,13 @@
roomVoList: obj.roomVoList.map(item => { roomVoList: obj.roomVoList.map(item => {
return { return {
...item, ...item,
facilities: item.facilities? item.facilities.split(","):[], facilities: item.facilities ? item.facilities.split(",") : [],
images: item.images ? item.images images: item.images ? item.images
.split(",").map(val => this.hostUrl + val) : [] .split(",").map(val => this.hostUrl + val) : []
} }
}) })
} }
console.log(this.storeInfo,909090) console.log(this.storeInfo, 909090)
} }
}) })
...@@ -676,7 +699,8 @@ ...@@ -676,7 +699,8 @@
} }
} }
} }
.facilitie-box{
.facilitie-box {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 12upx 20upx; padding: 12upx 20upx;
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
<text class="text-title text-lg">{{roomInfo.price}}元/小时</text> <text class="text-title text-lg">{{roomInfo.price}}元/小时</text>
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="flex-between price"> <view class="flex-between price use-coupon-box">
<text class="text-title text-lg">优惠券</text> <text class="text-title text-lg">优惠券</text>
<view class="flex-row" @tap="onNavToSelectCoupon"> <view class="flex-row" @tap="onNavToSelectCoupon">
<text class="text-lg" :class="useCouponList.length?'text-pink':'text-gray'"> <text class="text-lg" :class="useCouponList.length?'text-pink':'text-gray'">
...@@ -162,6 +162,7 @@ ...@@ -162,6 +162,7 @@
</view> </view>
</view> </view>
<view class=""> <view class="">
<button class="cu-btn bg-pink round lg margin-right" @tap="onNavToCheckedCoupon">团购验券</button>
<button class="cu-btn bg-pink round lg" @tap="onOrderConfirm">预约</button> <button class="cu-btn bg-pink round lg" @tap="onOrderConfirm">预约</button>
</view> </view>
</view> </view>
...@@ -737,6 +738,11 @@ ...@@ -737,6 +738,11 @@
title: "功能暂未开发" title: "功能暂未开发"
}) })
}, },
onNavToCheckedCoupon(){
uni.navigateTo({
url:"/pages/couponCheck/couponCheck"
})
},
// 将时间转换成完整日期 // 将时间转换成完整日期
onSetDateTime(startTime, endTime) { onSetDateTime(startTime, endTime) {
let obj = { let obj = {
...@@ -1048,6 +1054,11 @@ ...@@ -1048,6 +1054,11 @@
} }
} }
.use-coupon-box{
.flex-row{
max-width: 70%;
}
}
.line { .line {
width: 94%; width: 94%;
border-top: 2upx solid rgba(255, 170, 255, 0.8); border-top: 2upx solid rgba(255, 170, 255, 0.8);
......
export const wxScanCode = () => { export const wxScanCode = () => {
uni.scanCode({ uni.scanCode({
scanType: ["barCode", "qrCode"], scanType: ["barCode", "qrCode"],
success: (res) => { success: (res) => {
if (res.errMsg == "scanCode:ok") { if (res.errMsg == "scanCode:ok") {
} }
} }
}) })
...@@ -16,7 +15,7 @@ export const getLocation = () => { ...@@ -16,7 +15,7 @@ export const getLocation = () => {
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
complete: (res) => { complete: (res) => {
console.log(res,"获取位置") console.log(res, "获取位置")
if (res.errMsg == "getLocation:ok") { if (res.errMsg == "getLocation:ok") {
resolve(res) resolve(res)
} else { } else {
...@@ -115,13 +114,14 @@ export const getTabbarHeight = function() { ...@@ -115,13 +114,14 @@ export const getTabbarHeight = function() {
} }
export const space=(lat1, lng1, lat2, lng2)=>{ export const space = (lat1, lng1, lat2, lng2) => {
// console.log(lat1, lng1, lat2, lng2) // console.log(lat1, lng1, lat2, lng2)
var radLat1 = lat1 * Math.PI / 180.0; var radLat1 = lat1 * Math.PI / 180.0;
var radLat2 = lat2 * Math.PI / 180.0; var radLat2 = lat2 * Math.PI / 180.0;
var a = radLat1 - radLat2; var a = radLat1 - radLat2;
var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0; var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(
Math
.sin(b / 2), 2))); .sin(b / 2), 2)));
s = s * 6378.137; s = s * 6378.137;
s = Math.round(s * 10000) / 10; s = Math.round(s * 10000) / 10;
...@@ -130,14 +130,32 @@ export const space=(lat1, lng1, lat2, lng2)=>{ ...@@ -130,14 +130,32 @@ export const space=(lat1, lng1, lat2, lng2)=>{
// 将秒总数转化为几小时几分几秒 // 将秒总数转化为几小时几分几秒
export function secondFormat(second) { export function secondFormat(second) {
if(second>0){ if (second > 0) {
let hour = 0,min = 0,s = 0; let hour = 0,
hour = parseInt((second/60/60)); min = 0,
min = (parseInt(second/60))%60 s = 0;
s = (second-hour*3600)-(min*60) hour = parseInt((second / 60 / 60));
min = (parseInt(second / 60)) % 60
s = (second - hour * 3600) - (min * 60)
return `${ hour>0? hour+'小时':''}${ min>0? min+'分':''}${s}秒` return `${ hour>0? hour+'小时':''}${ min>0? min+'分':''}${s}秒`
}else{ } else {
return "—" return "—"
} }
}
// 将字典转化成键值对对象
export function getDictItem(dicts, dictType) {
let obj = {};
if (dicts && dicts.length) {
let arr = dicts.filter(item => item.dictType === dictType)
if(arr && arr.length){
arr[0].dictDatas.forEach(val => {
obj[val.dictValue] = val.dictLabel
})
}
}else{
obj = ''
}
return obj
} }
\ 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