Commit e3b5b235 by zhangzhen

功能完善

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