对接原系统
This commit is contained in:
+3
-3
@@ -1,9 +1,9 @@
|
||||
VITE_APP_NAME=后台管理系统
|
||||
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
||||
VITE_SERVER_URL=https://server.gxwebsoft.com/api
|
||||
VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
|
||||
#VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
|
||||
VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||
|
||||
#VITE_SERVER_URL=http://127.0.0.1:9090/api
|
||||
#VITE_API_URL=http://127.0.0.1:9001/api
|
||||
#VITE_THINK_URL=http://127.0.0.1:9099/api
|
||||
#VITE_API_URL=http://127.0.0.1:9099/api
|
||||
VITE_THINK_URL=http://127.0.0.1:9099/api
|
||||
|
||||
Generated
+18
-1
@@ -39,7 +39,8 @@
|
||||
"qrcode": "^1.5.3",
|
||||
"socket.io-client": "^4.7.2",
|
||||
"vue": "3.4.21",
|
||||
"vue-i18n": "9.13.1"
|
||||
"vue-i18n": "9.13.1",
|
||||
"x2js": "^3.4.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dcloudio/types": "3.4.12",
|
||||
@@ -4966,6 +4967,14 @@
|
||||
"@xtuc/long": "4.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@xmldom/xmldom": {
|
||||
"version": "0.8.10",
|
||||
"resolved": "https://registry.npmmirror.com/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
|
||||
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@xtuc/ieee754": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
|
||||
@@ -12677,6 +12686,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/x2js": {
|
||||
"version": "3.4.4",
|
||||
"resolved": "https://registry.npmmirror.com/x2js/-/x2js-3.4.4.tgz",
|
||||
"integrity": "sha512-yG/ThaBCgnsa3aoMPAe7QwDpcyU4D70hjXC4Y1lZSfD/Tgd0MpE19FnZZRAjekryw0c8cffpOt9zsPEiqktO6Q==",
|
||||
"dependencies": {
|
||||
"@xmldom/xmldom": "^0.8.3"
|
||||
}
|
||||
},
|
||||
"node_modules/xhr": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/xhr/-/xhr-2.6.0.tgz",
|
||||
|
||||
+2
-1
@@ -72,7 +72,8 @@
|
||||
"qrcode": "^1.5.3",
|
||||
"socket.io-client": "^4.7.2",
|
||||
"vue": "3.4.21",
|
||||
"vue-i18n": "9.13.1"
|
||||
"vue-i18n": "9.13.1",
|
||||
"x2js": "^3.4.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dcloudio/types": "3.4.12",
|
||||
|
||||
@@ -35,6 +35,17 @@ export async function listThinkField(params?: ThinkFieldParam) {
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function listThinkFieldWithTimeList(params?: ThinkFieldParam) {
|
||||
const res = await request.post<ApiResult<ThinkField[]>>(
|
||||
THINK_API_URL + '/think/think-field/withTimeList',
|
||||
params
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ThinkSite, ThinkSiteParam } from './model';
|
||||
import { THINK_API_URL } from '@/config/setting';
|
||||
import type {ApiResult, PageResult} from '@/api';
|
||||
import type {ThinkSite, ThinkSiteParam} from './model';
|
||||
import {THINK_API_URL} from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
@@ -104,3 +104,13 @@ export async function getThinkSite(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function getThinkSiteWithDistance(id: number, params?: ThinkSiteParam) {
|
||||
const res = await request.post<ApiResult<ThinkSite>>(
|
||||
THINK_API_URL + '/think/think-site/' + id, params
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
+60
-54
@@ -1,30 +1,30 @@
|
||||
{
|
||||
"name" : "广西体育中心",
|
||||
"appid" : "__UNI__4E11CD0",
|
||||
"description" : "广西体育中心",
|
||||
"versionName" : "1.0.2",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
"name": "广西体育中心",
|
||||
"appid": "__UNI__4E11CD0",
|
||||
"description": "广西体育中心",
|
||||
"versionName": "1.0.2",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {
|
||||
"Push" : {}
|
||||
"modules": {
|
||||
"Push": {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
"distribute": {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"android": {
|
||||
"permissions": [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
@@ -43,54 +43,60 @@
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {},
|
||||
"ios": {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {
|
||||
"push" : {
|
||||
"unipush" : {
|
||||
"version" : "2",
|
||||
"offline" : true,
|
||||
"hms" : {},
|
||||
"oppo" : {},
|
||||
"vivo" : {},
|
||||
"mi" : {},
|
||||
"meizu" : {},
|
||||
"fcm" : {}
|
||||
"sdkConfigs": {
|
||||
"push": {
|
||||
"unipush": {
|
||||
"version": "2",
|
||||
"offline": true,
|
||||
"hms": {},
|
||||
"oppo": {},
|
||||
"vivo": {},
|
||||
"mi": {},
|
||||
"meizu": {},
|
||||
"fcm": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
"quickapp": {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wxd38cc38c54fa7370",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"postcss" : false,
|
||||
"minified" : true
|
||||
"mp-weixin": {
|
||||
"appid": "wxd38cc38c54fa7370",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"postcss": false,
|
||||
"minified": true
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"lazyCodeLoading" : "requiredComponents"
|
||||
"usingComponents": true,
|
||||
"lazyCodeLoading": "requiredComponents",
|
||||
"permission": {
|
||||
"scope.userLocation": {
|
||||
"desc": "场馆定位"
|
||||
}
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
"requiredPrivateInfos" : [ "chooseLocation", "getLocation" ]
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"vueVersion" : "3",
|
||||
"h5" : {
|
||||
"router" : {
|
||||
"mode" : "hash",
|
||||
"base" : ""
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion": "3",
|
||||
"h5": {
|
||||
"router": {
|
||||
"mode": "hash",
|
||||
"base": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+156
-165
@@ -1,20 +1,13 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- deBug信息 -->
|
||||
<view v-if="merchant" class="web-debug web-text-success" style="display: none;">
|
||||
场馆ID:{{ merchant.merchantId }} 场馆编号:{{ merchant.merchantCode }} 场馆名称:{{ merchant.merchantName }}
|
||||
日期:{{ dateTime }}
|
||||
星期:{{ week }}
|
||||
订单总金额:{{ totalPrice }}
|
||||
类型:{{ type }}
|
||||
场地信息:{{ orderInfo }}
|
||||
</view>
|
||||
<!-- <view class="merchant-name">{{ merchant.merchantName }}</view> -->
|
||||
<uv-sticky bg-color="white">
|
||||
<view class="merchant-name">{{ merchant.name }}</view>
|
||||
<uv-tabs :list="next7day" :itemStyle="{height: '58px'}" :activeStyle="{ color: '#2ba91c'}" lineColor="#2ba91c"
|
||||
:inactiveStyle="{ color: '#808080' }" @change="onDateTime"></uv-tabs>
|
||||
</uv-sticky>
|
||||
<view class="uni-padding-wrap uni-common-mt">
|
||||
<uni-segmented-control :current="current" :values="items" activeColor="#2ba91c" inActiveColor="#ff0000"
|
||||
@clickItem="onType" />
|
||||
@clickItem="onType"/>
|
||||
</view>
|
||||
<!-- 状态说明 -->
|
||||
<view class="uni-badge-wrap">
|
||||
@@ -36,22 +29,20 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 场地列表 -->
|
||||
<!-- <uv-empty mode="data" v-if="periodList.length == 0"
|
||||
icon="https://cdn.uviewui.com/uview/empty/data.png"></uv-empty> -->
|
||||
<view class="checkout-body web-text-primary" v-if="periodList.length > 0">
|
||||
<template v-for="(item,index) in periodList" :key="index">
|
||||
<view class="period-item">
|
||||
<view class="period">{{ item.timePeriod }}</view>
|
||||
<view class="field-list">
|
||||
<template v-for="(field,index2) in item.fieldList" :key="index2">
|
||||
<view class="field"
|
||||
:class="isActive(field)"
|
||||
@click="onField(field,item)">
|
||||
<text class="field-name">{{ field.fieldName }}</text>
|
||||
<text class="price">{{ item.price }}元</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<!-- <view class="field-list">-->
|
||||
<!-- <template v-for="(field,index2) in item.fieldList" :key="index2">-->
|
||||
<!-- <view class="field"-->
|
||||
<!-- :class="isActive(field)"-->
|
||||
<!-- @click="onField(field,item)">-->
|
||||
<!-- <text class="field-name">{{ field.fieldName }}</text>-->
|
||||
<!-- <text class="price">{{ item.price }}元</text>-->
|
||||
<!-- </view>-->
|
||||
<!-- </template>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
</template>
|
||||
<!-- 排版样式备份 -->
|
||||
@@ -110,27 +101,31 @@
|
||||
</uni-popup>
|
||||
|
||||
<!-- 登录组件 -->
|
||||
<ws-login ref="login" :logo="logo" @done="reload" />
|
||||
<ws-login ref="login" :logo="logo" @done="reload"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as Api from '@/api/layout';
|
||||
import * as MerchantApi from '@/api/shop/merchant';
|
||||
import * as FieldApi from '@/api/booking/field';
|
||||
import * as PeriodApi from '@/api/booking/period';
|
||||
import {
|
||||
import * as Api from '@/api/layout';
|
||||
import * as MerchantApi from '@/api/shop/merchant';
|
||||
import * as FieldApi from '@/api/booking/field';
|
||||
import * as PeriodApi from '@/api/booking/period';
|
||||
import {
|
||||
storeToRefs
|
||||
} from 'pinia';
|
||||
import {
|
||||
} from 'pinia';
|
||||
import {
|
||||
useCarStore
|
||||
} from '@/store/modules/car';
|
||||
import {
|
||||
} from '@/store/modules/car';
|
||||
import {
|
||||
getWeek,
|
||||
getKey
|
||||
} from '@/utils/common';
|
||||
} from '@/utils/common';
|
||||
import {getThinkSite} from "@/api/think/thinkSite";
|
||||
import {listThinkSiteTime} from "@/api/think/thinkSiteTime";
|
||||
import dayjs from "dayjs";
|
||||
import {listThinkField, listThinkFieldWithTimeList} from "@/api/think/thinkField";
|
||||
|
||||
const carStore = useCarStore();
|
||||
const {
|
||||
const carStore = useCarStore();
|
||||
const {
|
||||
orderInfo,
|
||||
totalPrice,
|
||||
carNum,
|
||||
@@ -138,10 +133,10 @@
|
||||
type,
|
||||
dateTime,
|
||||
childrenPrice
|
||||
} = storeToRefs(carStore)
|
||||
} = storeToRefs(carStore)
|
||||
|
||||
|
||||
export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 场馆ID
|
||||
@@ -180,7 +175,8 @@
|
||||
// 是否同意协议
|
||||
disabled: false,
|
||||
// 购物车信息
|
||||
showCarInfo: false
|
||||
showCarInfo: false,
|
||||
timeList: []
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
@@ -201,7 +197,7 @@
|
||||
totalPrice = totalPrice + d.price
|
||||
})
|
||||
carStore.totalPrice = totalPrice
|
||||
console.log('totalPrice: ',totalPrice);
|
||||
console.log('totalPrice: ', totalPrice);
|
||||
return totalPrice;
|
||||
},
|
||||
carNum() {
|
||||
@@ -210,66 +206,87 @@
|
||||
},
|
||||
methods: {
|
||||
async reload() {
|
||||
const app = this
|
||||
|
||||
// 请求数据
|
||||
uni.showLoading({
|
||||
title: '数据读取中.'
|
||||
})
|
||||
Promise.all([app.getServerTime(), app.getNext7day(), app.getMerchant()]).then(res => {
|
||||
const serverTime = res[0];
|
||||
const next7day = res[1];
|
||||
const merchant = res[2];
|
||||
app.serverTime = serverTime;
|
||||
app.next7day = next7day;
|
||||
app.merchant = merchant;
|
||||
|
||||
// 修改标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: merchant.merchantName
|
||||
})
|
||||
// 保存场馆信息
|
||||
carStore.setMerchant(merchant)
|
||||
|
||||
// 加载预定日期
|
||||
app.next7day = next7day.map((d, i) => {
|
||||
if (!app.dateTime && i === 0) {
|
||||
app.dateTime = d.dateTime
|
||||
app.week = d.week
|
||||
carStore.dateTime = d.dateTime
|
||||
}
|
||||
d.name = getWeek(d.week);
|
||||
d.value = d.date;
|
||||
return d
|
||||
})
|
||||
// 加载时段列表
|
||||
app.getBookingPeriod();
|
||||
// 加载场地列表
|
||||
// app.getBookingField();
|
||||
// 关闭加载状态
|
||||
}).catch(() => {
|
||||
uni.showToast({
|
||||
title: '请检查您的网络.',
|
||||
icon: 'none'
|
||||
})
|
||||
this.setDateList()
|
||||
await this.getMerchant()
|
||||
await this.getTimeList()
|
||||
await this.getFieldList()
|
||||
uni.hideLoading()
|
||||
// Promise.all([app.getServerTime(), app.getNext7day(), app.getMerchant()]).then(res => {
|
||||
// const serverTime = res[0];
|
||||
// const next7day = res[1];
|
||||
// const merchant = res[2];
|
||||
// app.serverTime = serverTime;
|
||||
// app.next7day = next7day;
|
||||
// app.merchant = merchant;
|
||||
//
|
||||
// // 修改标题
|
||||
// uni.setNavigationBarTitle({
|
||||
// title: merchant.merchantName
|
||||
// })
|
||||
// // 保存场馆信息
|
||||
// carStore.setMerchant(merchant)
|
||||
//
|
||||
// // 加载预定日期
|
||||
// app.next7day = next7day.map((d, i) => {
|
||||
// if (!app.dateTime && i === 0) {
|
||||
// app.dateTime = d.dateTime
|
||||
// app.week = d.week
|
||||
// carStore.dateTime = d.dateTime
|
||||
// }
|
||||
// d.name = getWeek(d.week);
|
||||
// d.value = d.date;
|
||||
// return d
|
||||
// })
|
||||
// // 加载时段列表
|
||||
// app.getBookingPeriod();
|
||||
// // 加载场地列表
|
||||
// // app.getBookingField();
|
||||
// // 关闭加载状态
|
||||
// }).catch(() => {
|
||||
// uni.showToast({
|
||||
// title: '请检查您的网络.',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// uni.hideLoading()
|
||||
// })
|
||||
},
|
||||
setDateList() {
|
||||
this.next7day = []
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const day = dayjs().add(i, 'day')
|
||||
this.next7day.push({
|
||||
week: day.format('d') === '0' ? '7' : day.format('d'),
|
||||
dateTime: day.format('YYYY-MM-DD'),
|
||||
name: getWeek(day.format('d')),
|
||||
value: day.format('MM月DD日')
|
||||
})
|
||||
}
|
||||
this.dateTime = dayjs().format('YYYY-MM-DD')
|
||||
this.week = dayjs().format('d') === '0' ? '7' : dayjs().format('d')
|
||||
},
|
||||
async getTimeList() {
|
||||
this.timeList = await listThinkSiteTime({sid: this.merchantId})
|
||||
this.makeTimeList()
|
||||
},
|
||||
makeTimeList() {
|
||||
this.periodList = []
|
||||
this.timeList.forEach(item => {
|
||||
const weekList = JSON.parse(item.week)
|
||||
if (weekList.includes(this.week) && dayjs().isBefore(dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]))) this.periodList.push(item)
|
||||
})
|
||||
|
||||
},
|
||||
onDisabled() {
|
||||
this.disabled = !this.disabled;
|
||||
},
|
||||
onDateTime(e) {
|
||||
console.log('e: ', e);
|
||||
const {
|
||||
serverTime
|
||||
} = this
|
||||
this.week = e.week
|
||||
this.dateTime = e.dateTime
|
||||
carStore.dateTime = e.dateTime
|
||||
carStore.orderInfo = []
|
||||
this.selection = []
|
||||
this.reload()
|
||||
this.makeTimeList()
|
||||
this.getFieldList()
|
||||
},
|
||||
onType(e) {
|
||||
const index = e.currentIndex
|
||||
@@ -283,41 +300,30 @@
|
||||
}
|
||||
this.reload()
|
||||
},
|
||||
getMerchant() {
|
||||
return new Promise((resolve, reject) => {
|
||||
MerchantApi.getMerchant(this.merchantId).then(result => {
|
||||
resolve(result)
|
||||
}).catch(reject)
|
||||
})
|
||||
async getMerchant() {
|
||||
this.merchant = await getThinkSite(this.merchantId)
|
||||
},
|
||||
getServerTime() {
|
||||
return new Promise((resolve, reject) => {
|
||||
Api.getServerTime()
|
||||
.then(result => {
|
||||
resolve(result)
|
||||
async getFieldList(){
|
||||
if (!this.periodList.length) {
|
||||
uni.showToast({
|
||||
title: '暂无可预订场地',
|
||||
icon: 'none'
|
||||
})
|
||||
.catch(reject)
|
||||
}
|
||||
const periodVoList = []
|
||||
this.periodList.forEach(item => {
|
||||
const timestamp = dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]).unix()
|
||||
periodVoList.push({
|
||||
timestamp,
|
||||
period: item.timePeriod
|
||||
})
|
||||
})
|
||||
const res = await listThinkFieldWithTimeList({
|
||||
sid: this.merchantId,
|
||||
periodVoList
|
||||
})
|
||||
console.log(res)
|
||||
},
|
||||
getNext7day() {
|
||||
return new Promise((resolve, reject) => {
|
||||
Api.getNext7day()
|
||||
.then(result => {
|
||||
resolve(result)
|
||||
})
|
||||
.catch(reject)
|
||||
})
|
||||
},
|
||||
// getBookingField() {
|
||||
// FieldApi.listField({
|
||||
// merchantId: this.merchantId,
|
||||
// isStatus: 1,
|
||||
// isHalf: this.isHalf,
|
||||
// dateTime: `${this.dateTime}`
|
||||
// }).then(list => {
|
||||
// this.fieldList = list;
|
||||
// })
|
||||
// },
|
||||
getBookingPeriod() {
|
||||
const {
|
||||
serverTime,
|
||||
@@ -330,7 +336,7 @@
|
||||
let startTime;
|
||||
startTime = serverTime.today == this.dateTime ? String(hours) + String(minutes) : undefined
|
||||
// 游泳馆当前21:30前都可以预定
|
||||
if(merchantId === '3028' && Number(startTime) < 2130){
|
||||
if (merchantId === '3028' && Number(startTime) < 2130) {
|
||||
startTime = undefined
|
||||
}
|
||||
|
||||
@@ -351,7 +357,7 @@
|
||||
icon: 'none'
|
||||
})
|
||||
uni.hideLoading()
|
||||
if(err.message === '您还有未支付订单,请先支付'){
|
||||
if (err.message === '您还有未支付订单,请先支付') {
|
||||
setTimeout(() => {
|
||||
return uni.switchTab({
|
||||
url: '/pages/order/order'
|
||||
@@ -373,30 +379,13 @@
|
||||
closeCarInfo() {
|
||||
this.$refs.popup.close()
|
||||
},
|
||||
onMap() {
|
||||
uni.getLocation({
|
||||
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
|
||||
success: function(res) {
|
||||
console.log('返回可以用于uni.openLocation的经纬度: ', res);
|
||||
const latitude = this.merchant.latitude;
|
||||
const longitude = this.merchant.longitude;
|
||||
uni.openLocation({
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
success: function() {
|
||||
console.log('success');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onField(item, period) {
|
||||
// 已被预定
|
||||
if(item.sold){
|
||||
if (item.sold) {
|
||||
return
|
||||
}
|
||||
const app = this
|
||||
const { merchant } = this
|
||||
const {merchant} = this
|
||||
// 时段
|
||||
// const p = this.periodList[i]
|
||||
// 场地
|
||||
@@ -461,13 +450,13 @@
|
||||
comments: `${this.dateTime} (${getWeek(this.week)}) ${item.timePeriod}`,
|
||||
})
|
||||
console.log(app.selection);
|
||||
console.log('period: ',period);
|
||||
console.log('period: ', period);
|
||||
// 是否支持儿童票
|
||||
console.log('item.isChildren: ',item.isChildren);
|
||||
if(item.isChildren === 1){
|
||||
console.log('item.isChildren2: ',item.isChildren);
|
||||
console.log('item.isChildren: ', item.isChildren);
|
||||
if (item.isChildren === 1) {
|
||||
console.log('item.isChildren2: ', item.isChildren);
|
||||
carStore.childrenPrice = period.childrenPrice
|
||||
}else{
|
||||
} else {
|
||||
carStore.childrenPrice = 0
|
||||
}
|
||||
carStore.orderInfo = app.selection
|
||||
@@ -478,7 +467,7 @@
|
||||
|
||||
}
|
||||
},
|
||||
getStratTime(value){
|
||||
getStratTime(value) {
|
||||
const split = value.split('-')
|
||||
const timeText = split[0].replace(' ', '')
|
||||
const startTime = new Date(`${this.dateTime} ${timeText}:00`).getTime()
|
||||
@@ -487,8 +476,8 @@
|
||||
|
||||
isActive(item) {
|
||||
const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${item.fieldId}`))
|
||||
if(item.sold){
|
||||
if(item.isHalf === 1){
|
||||
if (item.sold) {
|
||||
if (item.isHalf === 1) {
|
||||
return 'web-bg-warning'
|
||||
}
|
||||
return 'web-bg-info'
|
||||
@@ -525,29 +514,30 @@
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
page {
|
||||
background-size: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #f0f2f5;
|
||||
width: 750rpx;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.container {}
|
||||
.container {
|
||||
}
|
||||
|
||||
|
||||
.merchant-name {
|
||||
.merchant-name {
|
||||
padding: 30rpx;
|
||||
font-weight: 500;
|
||||
font-size: 42rpx;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.checkout-car {
|
||||
.checkout-car {
|
||||
width: 700rpx;
|
||||
left: 25rpx;
|
||||
position: fixed;
|
||||
@@ -571,24 +561,25 @@
|
||||
color: #ebcf00;
|
||||
align-items: center;
|
||||
|
||||
.save-btn {}
|
||||
.save-btn {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.popup-car-info {
|
||||
.popup-car-info {
|
||||
margin-bottom: 100px;
|
||||
padding: 20rpx;
|
||||
background-color: #ffffff;
|
||||
width: 660rpx;
|
||||
margin: 150rpx auto;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-padding-wrap {
|
||||
.uni-padding-wrap {
|
||||
width: 180rpx;
|
||||
margin: 20rpx auto;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-badge-wrap {
|
||||
.uni-badge-wrap {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
@@ -606,9 +597,9 @@
|
||||
padding-left: 8rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checkout-body {
|
||||
.checkout-body {
|
||||
padding: 24rpx;
|
||||
|
||||
.period-item {
|
||||
@@ -691,9 +682,9 @@
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.xieyi {
|
||||
.xieyi {
|
||||
margin: 30rpx auto;
|
||||
padding: 20rpx 30rpx;
|
||||
|
||||
@@ -704,5 +695,5 @@
|
||||
color: #0f80ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -16,12 +16,15 @@
|
||||
</uv-cell>
|
||||
<uv-cell title="场馆地址" :label="merchant.address" :cellStyle="{padding: '10px 5px'}">
|
||||
</uv-cell>
|
||||
<uv-cell title="场馆位置" :label="`距离【${merchant.merchantName}】3.8公里·约7分钟`" isLink :cellStyle="{padding: '10px 5px'}" @click="mapTo(merchant)">
|
||||
<uv-cell title="场馆位置" v-if="merchant"
|
||||
:label="`距离【${merchant.name}】${merchant.distance}公里·约${merchant.duration}分钟`" isLink
|
||||
:cellStyle="{padding: '10px 5px'}" @click="mapTo(merchant)">
|
||||
<template v-slot:right-icon>
|
||||
<uv-icon size="50rpx" name="map-fill" color="#5ac725" style="color: #ff0000;"></uv-icon>
|
||||
</template>
|
||||
</uv-cell>
|
||||
<uv-cell title="服务前台电话" :label="merchant.phone" :border="false" :cellStyle="{padding: '10px 5px'}" @click="callPhone(merchant.phone)">
|
||||
<uv-cell title="服务前台电话" :label="merchant.tel" :border="false" :cellStyle="{padding: '10px 5px'}"
|
||||
@click="callPhone(merchant.phone)">
|
||||
|
||||
</uv-cell>
|
||||
</uv-cell-group>
|
||||
@@ -40,7 +43,8 @@
|
||||
<view class="text" @click="onDisabled">
|
||||
<text>我已阅读并同意</text>
|
||||
<text class="link"
|
||||
@click.stop="navTo('/package/article/detail?articleId=503')">《订票协议》</text>
|
||||
@click.stop="navTo('/package/article/detail?articleId=503')">《订票协议》
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -77,20 +81,21 @@
|
||||
</view>
|
||||
</uni-popup>
|
||||
<!-- 登录组件 -->
|
||||
<ws-login ref="login" :logo="logo" @done="reload" />
|
||||
<ws-login ref="login" :logo="logo" @done="reload"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
storeToRefs
|
||||
} from 'pinia';
|
||||
import * as MerchantApi from '@/api/shop/merchant';
|
||||
import {
|
||||
import {
|
||||
useCarStore
|
||||
} from '@/store/modules/car';
|
||||
const carStore = useCarStore();
|
||||
} from '@/store/modules/car';
|
||||
import {getThinkSite, getThinkSiteWithDistance} from "@/api/think/thinkSite";
|
||||
import {getLocationAction} from "@/utils";
|
||||
import request from "@/utils/request";
|
||||
import X2js from 'x2js';
|
||||
|
||||
export default {
|
||||
const carStore = useCarStore();
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: 0,
|
||||
@@ -99,13 +104,18 @@
|
||||
// 场馆相册
|
||||
photo: [],
|
||||
isLogin: false,
|
||||
disabled: true
|
||||
disabled: true,
|
||||
lat: null,
|
||||
lng: null,
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
async onLoad(option) {
|
||||
this.id = option.id
|
||||
carStore.merchantId = option.id
|
||||
this.reload();
|
||||
const {longitude, latitude} = await getLocationAction()
|
||||
this.lat = latitude
|
||||
this.lng = longitude
|
||||
await this.reload();
|
||||
},
|
||||
onShow() {
|
||||
// 登录状态
|
||||
@@ -121,25 +131,37 @@
|
||||
Promise.all([app.getMerchant()]).then(res => {
|
||||
const merchant = res[0];
|
||||
app.merchant = merchant;
|
||||
this.merchant.distance = 0
|
||||
this.merchant.minute = 0
|
||||
|
||||
// 修改标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: merchant.merchantName
|
||||
})
|
||||
// uni.setNavigationBarTitle({
|
||||
// title: merchant.merchantName
|
||||
// })
|
||||
// 加载场馆相册
|
||||
if (merchant.files) {
|
||||
app.photo = JSON.parse(merchant.files)
|
||||
}
|
||||
// if (merchant.files) {
|
||||
// app.photo = JSON.parse(merchant.files)
|
||||
// }
|
||||
app.photo = [merchant.thumb]
|
||||
// 更新购物车状态
|
||||
carStore.setMerchant(merchant)
|
||||
carStore.merchantId = merchant.merchantId
|
||||
carStore.merchantName = merchant.merchantName
|
||||
carStore.merchantCode = merchant.merchantCode
|
||||
this.getDuration()
|
||||
})
|
||||
},
|
||||
async getDuration() {
|
||||
let url = `http://api.tianditu.gov.cn/drive?postStr={"orig":"${this.lng},${this.lat}","dest":"${this.merchant.lng},${this.merchant.lat}","style":"0"}&type=search&tk=71f234f251d4cb1feeb3c293a0f21709`
|
||||
const res = await request.get(url)
|
||||
const x2js = new X2js();
|
||||
const {result} = x2js.xml2js(res.data)
|
||||
this.merchant.distance = result.distance
|
||||
this.merchant.duration = (parseInt(result.duration) / 60).toFixed(1)
|
||||
},
|
||||
getMerchant() {
|
||||
return new Promise((resolve, reject) => {
|
||||
MerchantApi.getMerchant(this.id).then(result => {
|
||||
getThinkSite(this.id).then(result => {
|
||||
resolve(result)
|
||||
}).catch(reject)
|
||||
})
|
||||
@@ -152,13 +174,10 @@
|
||||
url
|
||||
})
|
||||
},
|
||||
mapTo(item){
|
||||
console.log('item: ',item.lngAndLat);
|
||||
const arr = item.lngAndLat.split(',');
|
||||
console.log('arr: ',arr);
|
||||
mapTo(item) {
|
||||
uni.openLocation({
|
||||
latitude: parseFloat(arr[1]),
|
||||
longitude: parseFloat(arr[0]),
|
||||
latitude: parseFloat(item.lat),
|
||||
longitude: parseFloat(item.lng),
|
||||
success: function () {
|
||||
console.log('success');
|
||||
}
|
||||
@@ -179,14 +198,14 @@
|
||||
onMap() {
|
||||
uni.getLocation({
|
||||
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
|
||||
success: function(res) {
|
||||
success: function (res) {
|
||||
console.log('返回可以用于uni.openLocation的经纬度: ', res);
|
||||
const latitude = this.merchant.latitude;
|
||||
const longitude = this.merchant.longitude;
|
||||
const latitude = this.merchant.lat;
|
||||
const longitude = this.merchant.lng;
|
||||
uni.openLocation({
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
success: function() {
|
||||
success: function () {
|
||||
console.log('success');
|
||||
}
|
||||
});
|
||||
@@ -206,36 +225,37 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
page {
|
||||
background-size: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #f0f2f5;
|
||||
width: 750rpx;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.container {}
|
||||
.container {
|
||||
}
|
||||
|
||||
.merchant-name {
|
||||
.merchant-name {
|
||||
padding: 30rpx;
|
||||
font-weight: 500;
|
||||
font-size: 42rpx;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
.save-btn {
|
||||
width: 700rpx;
|
||||
left: 25rpx;
|
||||
height: 80rpx;
|
||||
position: fixed;
|
||||
bottom: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.booking-tel {
|
||||
.booking-tel {
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
top: 270px;
|
||||
@@ -249,9 +269,9 @@
|
||||
justify-content: center;
|
||||
color: #ffffff;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-booking-tel {
|
||||
.popup-booking-tel {
|
||||
background-color: #ffffff;
|
||||
width: 560rpx;
|
||||
min-height: 400rpx;
|
||||
@@ -272,19 +292,21 @@
|
||||
.desc {
|
||||
line-height: 2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.popup-close {
|
||||
.popup-close {
|
||||
display: flex;
|
||||
margin-top: 24rpx;
|
||||
justify-content: center;
|
||||
}
|
||||
.booking-content{
|
||||
}
|
||||
|
||||
.booking-content {
|
||||
padding: 10px;
|
||||
font-size: 30rpx;
|
||||
line-height: 1.5rem;
|
||||
}
|
||||
.xieyi {
|
||||
}
|
||||
|
||||
.xieyi {
|
||||
margin-bottom: 80rpx;
|
||||
padding: 0 30rpx;
|
||||
|
||||
@@ -295,5 +317,5 @@
|
||||
color: #0f80ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+16
-40
@@ -3,7 +3,8 @@
|
||||
<!-- #ifndef APP-NVUE || MP-TOUTIAO -->
|
||||
<block v-if="ads.length > 0" v-for="(ad,index) in ads" :key="index">
|
||||
<view class="uv-demo-block" style="width: 698rpx; margin: auto">
|
||||
<uv-swiper :list="JSON.parse(ad.images)" :height="180" bgColor="transparent" indicatorMode="dot" indicator circular
|
||||
<uv-swiper :list="JSON.parse(ad.images)" :height="180" bgColor="transparent" indicatorMode="dot" indicator
|
||||
circular
|
||||
:autoplay="false"
|
||||
radius="5" @click="onSlide"></uv-swiper>
|
||||
</view>
|
||||
@@ -67,12 +68,12 @@
|
||||
<!-- 商户列表 -->
|
||||
<view class="card-title web-text-heading">场地预定</view>
|
||||
<view class="card-body">
|
||||
<block v-if="merchant.length > 0">
|
||||
<block v-if="siteList.length > 0">
|
||||
<uni-grid :column="3" borderColor="transparent" :highlight="true" @change="change">
|
||||
<uni-grid-item v-for="(item, index) in merchant" :index="index" :key="index">
|
||||
<uni-grid-item v-for="(item, index) in siteList" :index="index" :key="index">
|
||||
<view class="merchant-card" style="display: flex; flex-direction: column">
|
||||
<image :src="item.image" mode="widthFix" class="merchant-image"/>
|
||||
<text class="merchant-name">{{ item.merchantName }}</text>
|
||||
<image :src="item.thumb" mode="widthFix" class="merchant-image"/>
|
||||
<text class="merchant-name">{{ item.name }}</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
</uni-grid>
|
||||
@@ -108,7 +109,8 @@ import {updateUsers} from '@/api/shop/users';
|
||||
import {useMpStore} from "@/store/modules/mp";
|
||||
import Layout from "@/components/layout.vue";
|
||||
import * as MenuIcons from '@/api/menu-icons.ts';
|
||||
import { openUrl } from '@/utils/common';
|
||||
import {openUrl} from '@/utils/common';
|
||||
import {listThinkSite} from "@/api/think/thinkSite";
|
||||
|
||||
const mpStore = useMpStore();
|
||||
|
||||
@@ -140,25 +142,8 @@ export default {
|
||||
// 骨架屏
|
||||
hideTools: true,
|
||||
mp_menu_display_method: 0,
|
||||
baseList: [
|
||||
{
|
||||
name: 'photo',
|
||||
title: '李白'
|
||||
},
|
||||
{
|
||||
name: 'lock',
|
||||
title: '韩信'
|
||||
},
|
||||
{
|
||||
name: 'star',
|
||||
title: '刘备'
|
||||
},
|
||||
{
|
||||
name: 'star',
|
||||
title: '元芳'
|
||||
}
|
||||
],
|
||||
openid: null
|
||||
openid: null,
|
||||
siteList: []
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
@@ -180,16 +165,6 @@ export default {
|
||||
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
|
||||
app.isLogin = true;
|
||||
if (!uni.getStorageSync('openid')) {
|
||||
// 获取用户副表信息
|
||||
// UserApi.getByPhone({
|
||||
// phone: info.userInfo.phone
|
||||
// }).then((data) => {
|
||||
// if (data) {
|
||||
// app.userInfo.ouid = data.uid;
|
||||
// uni.setStorageSync('ouid', data.uid);
|
||||
// app.userInfo = Object.assign({}, app.userInfo, data);
|
||||
// }
|
||||
// });
|
||||
// 更新openid
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.login({
|
||||
@@ -271,9 +246,9 @@ export default {
|
||||
}
|
||||
|
||||
// 请求数据
|
||||
Promise.all([app.getMerchantList(), app.getItemList()]).then((res) => {
|
||||
Promise.all([app.getMerchantList(), this.getSiteList()]).then((res) => {
|
||||
app.merchant = res[0];
|
||||
app.itemList = res[1];
|
||||
// app.itemList = res[1];
|
||||
});
|
||||
},
|
||||
getSiteInfo() {
|
||||
@@ -286,7 +261,8 @@ export default {
|
||||
.catch(reject);
|
||||
});
|
||||
},
|
||||
listAdList() {
|
||||
async getSiteList() {
|
||||
this.siteList = await listThinkSite()
|
||||
},
|
||||
pageGoods() {
|
||||
const app = this;
|
||||
@@ -323,7 +299,7 @@ export default {
|
||||
},
|
||||
change(e) {
|
||||
const {index} = e.detail;
|
||||
const id = this.merchant[index].merchantId;
|
||||
const id = this.siteList[index].id;
|
||||
this.openUrl(`/package/booking/index?id=${id}`);
|
||||
},
|
||||
onNavigation(e) {
|
||||
@@ -355,7 +331,7 @@ export default {
|
||||
this.ad279 = this.getAdImageUrl(ads.find(d => d.adId === 279));
|
||||
},
|
||||
getAdImageUrl(item) {
|
||||
if(!item){
|
||||
if (!item) {
|
||||
return [];
|
||||
}
|
||||
const json = JSON.parse(item.images);
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<view class="userid">
|
||||
<view class="text">{{ data.mobile }}</view>
|
||||
</view>
|
||||
<view class="flex flex-col justify-center items-center" @click="scan">
|
||||
<uv-icon name="scan" size="58rpx" label="提货扫码" label-pos="bottom" label-size="24rpx" space="0"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nickname-box" v-else>
|
||||
<view class="nickname">点击登录</view>
|
||||
@@ -179,6 +182,14 @@ export default {
|
||||
// console.log(1, e)
|
||||
this.form.username = value;
|
||||
uni.setStorageSync('username', value)
|
||||
},
|
||||
scan() {
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
console.log(res.result)
|
||||
uni.navigateTo({url: `/package/goods/orderDetailForSelfTake?id=${res.result}`})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
export const getLocationAction = (save = true) => {
|
||||
return new Promise(resolve => {
|
||||
const res = getLocation()
|
||||
if (res.latitude) resolve(res)
|
||||
else {
|
||||
uni.authorize({
|
||||
scope: 'scope.userLocation',
|
||||
success: () => {
|
||||
uni.getLocation({
|
||||
isHighAccuracy: true,
|
||||
success: ({longitude, latitude}) => {
|
||||
if (save) setLocation({longitude, latitude})
|
||||
resolve({longitude, latitude})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
console.log(err)
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '为了更好的提供服务,请开启定位服务',
|
||||
success: ({confirm}) => {
|
||||
if (confirm) uni.openSetting()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getLocation = () => {
|
||||
return {
|
||||
latitude: uni.getStorageSync("latitude"),
|
||||
longitude: uni.getStorageSync("longitude")
|
||||
}
|
||||
}
|
||||
|
||||
export const setLocation = ({latitude, longitude}) => {
|
||||
uni.setStorageSync("latitude", latitude)
|
||||
uni.setStorageSync("longitude", longitude)
|
||||
}
|
||||
Reference in New Issue
Block a user