对接原系统

This commit is contained in:
2024-10-19 10:36:41 +08:00
parent 6161d9c1d3
commit 0fc032aa8e
12 changed files with 6122 additions and 4249 deletions
+11
View File
@@ -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));
}
/**
* 添加
*/
+70 -60
View File
@@ -1,106 +1,116 @@
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';
/**
* 分页查询
*/
export async function pageThinkSite(params: ThinkSiteParam) {
const res = await request.get<ApiResult<PageResult<ThinkSite>>>(
THINK_API_URL + '/think/think-site/page',
{
params
const res = await request.get<ApiResult<PageResult<ThinkSite>>>(
THINK_API_URL + '/think/think-site/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.data.message));
}
/**
* 查询列表
*/
export async function listThinkSite(params?: ThinkSiteParam) {
const res = await request.get<ApiResult<ThinkSite[]>>(
THINK_API_URL + '/think/think-site',
{
params
const res = await request.get<ApiResult<ThinkSite[]>>(
THINK_API_URL + '/think/think-site',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.data.message));
}
/**
* 添加
*/
export async function addThinkSite(data: ThinkSite) {
const res = await request.post<ApiResult<unknown>>(
THINK_API_URL + '/think/think-site',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.post<ApiResult<unknown>>(
THINK_API_URL + '/think/think-site',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改
*/
export async function updateThinkSite(data: ThinkSite) {
const res = await request.put<ApiResult<unknown>>(
THINK_API_URL + '/think/think-site',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.put<ApiResult<unknown>>(
THINK_API_URL + '/think/think-site',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除
*/
export async function removeThinkSite(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
THINK_API_URL + '/think/think-site/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.delete<ApiResult<unknown>>(
THINK_API_URL + '/think/think-site/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除
*/
export async function removeBatchThinkSite(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
THINK_API_URL + '/think/think-site/batch',
{
data
const res = await request.delete<ApiResult<unknown>>(
THINK_API_URL + '/think/think-site/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询
*/
export async function getThinkSite(id: number) {
const res = await request.get<ApiResult<ThinkSite>>(
THINK_API_URL + '/think/think-site/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<ThinkSite>>(
THINK_API_URL + '/think/think-site/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
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));
}
+98 -92
View File
@@ -1,96 +1,102 @@
{
"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
},
/* 模块配置 */
"modules" : {
"Push" : {}
},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"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\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios" : {},
/* SDK配置 */
"sdkConfigs" : {
"push" : {
"unipush" : {
"version" : "2",
"offline" : true,
"hms" : {},
"oppo" : {},
"vivo" : {},
"mi" : {},
"meizu" : {},
"fcm" : {}
}
}
}
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "wxd38cc38c54fa7370",
"setting" : {
"urlCheck" : false,
"postcss" : false,
"minified" : true
},
"usingComponents" : true,
"lazyCodeLoading" : "requiredComponents"
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3",
"h5" : {
"router" : {
"mode" : "hash",
"base" : ""
"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
},
/* 模块配置 */
"modules": {
"Push": {}
},
/* 应用发布信息 */
"distribute": {
/* android打包配置 */
"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\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios": {},
/* SDK配置 */
"sdkConfigs": {
"push": {
"unipush": {
"version": "2",
"offline": true,
"hms": {},
"oppo": {},
"vivo": {},
"mi": {},
"meizu": {},
"fcm": {}
}
}
}
}
},
/* 快应用特有相关 */
"quickapp": {},
/* 小程序特有相关 */
"mp-weixin": {
"appid": "wxd38cc38c54fa7370",
"setting": {
"urlCheck": false,
"postcss": false,
"minified": true
},
"usingComponents": true,
"lazyCodeLoading": "requiredComponents",
"permission": {
"scope.userLocation": {
"desc": "场馆定位"
}
},
"requiredPrivateInfos" : [ "chooseLocation", "getLocation" ]
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"vueVersion": "3",
"h5": {
"router": {
"mode": "hash",
"base": ""
}
}
}
File diff suppressed because it is too large Load Diff
+292 -270
View File
@@ -1,299 +1,321 @@
<template>
<view class="container">
<view class="uv-demo-block">
<uv-swiper :list="photo" indicator indicatorMode="line" circular height="200" radius="0"></uv-swiper>
</view>
<!-- <view class="merchant-name">{{ merchant.merchantName }}</view> -->
<uni-card :title="merchant.merchantName" :border="false" :is-shadow="false" :padding="0">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<uv-cell title="营业时间" :label="merchant.businessTime" :cellStyle="{padding: '10px 5px'}">
<!-- <template v-slot:label>
<view class="web-text-secondary">{{ merchant.businessTime }}</view>
</template>
<template v-slot:right-icon>
<text class="web-text-success"></text>
</template> -->
</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)">
<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)">
<view class="container">
<view class="uv-demo-block">
<uv-swiper :list="photo" indicator indicatorMode="line" circular height="200" radius="0"></uv-swiper>
</view>
<!-- <view class="merchant-name">{{ merchant.merchantName }}</view> -->
<uni-card :title="merchant.merchantName" :border="false" :is-shadow="false" :padding="0">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<uv-cell title="营业时间" :label="merchant.businessTime" :cellStyle="{padding: '10px 5px'}">
<!-- <template v-slot:label>
<view class="web-text-secondary">{{ merchant.businessTime }}</view>
</template>
<template v-slot:right-icon>
<text class="web-text-success"></text>
</template> -->
</uv-cell>
<uv-cell title="场馆地址" :label="merchant.address" :cellStyle="{padding: '10px 5px'}">
</uv-cell>
<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.tel" :border="false" :cellStyle="{padding: '10px 5px'}"
@click="callPhone(merchant.phone)">
</uv-cell>
</uv-cell-group>
</uni-card>
</uv-cell>
</uv-cell-group>
</uni-card>
<uni-card title="场地介绍" :is-shadow="false" :border="false" :padding="0">
<view class="web-text-heading booking-content">
<view v-html="merchant.content"></view>
</view>
</uni-card>
<uni-card title="场地介绍" :is-shadow="false" :border="false" :padding="0">
<view class="web-text-heading booking-content">
<view v-html="merchant.content"></view>
</view>
</uni-card>
<view class="xieyi web-cell web-text-secondary web-cell-align-top">
<view class="web-cell web-cell-content web-cell-align-top">
<uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons>
<uni-icons type="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons>
<view class="text" @click="onDisabled">
<text>我已阅读并同意</text>
<text class="link"
@click.stop="navTo('/package/article/detail?articleId=503')">《订票协议》</text>
</view>
</view>
</view>
<view class="save-btn">
<uv-button
:customStyle="{background: 'linear-gradient(to right, #ccff66, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="预定场地" @click="save"></uv-button>
</view>
<view class="xieyi web-cell web-text-secondary web-cell-align-top">
<view class="web-cell web-cell-content web-cell-align-top">
<uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons>
<uni-icons type="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons>
<view class="text" @click="onDisabled">
<text>我已阅读并同意</text>
<text class="link"
@click.stop="navTo('/package/article/detail?articleId=503')">《订票协议》
</text>
</view>
</view>
</view>
<view class="save-btn">
<uv-button
:customStyle="{background: 'linear-gradient(to right, #ccff66, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="预定场地" @click="save"></uv-button>
</view>
</view>
<uv-gap height="50"></uv-gap>
</view>
<uv-gap height="50"></uv-gap>
<view class="booking-tel" @click="openBookingTel">活动订场</view>
<!-- 活动订场弹窗 -->
<uni-popup ref="popup" type="center">
<view class="popup-booking-tel">
<text class="title">场馆热线</text>
<text class="desc">主体育场、足球训练场:0771-4953380</text>
<text class="desc">体育馆、综合训练馆、网球馆:0771-4953380</text>
<text class="desc">游泳跳水馆:0771-4736008</text>
<view class="booking-tel" @click="openBookingTel">活动订场</view>
<!-- 活动订场弹窗 -->
<uni-popup ref="popup" type="center">
<view class="popup-booking-tel">
<text class="title">场馆热线</text>
<text class="desc">主体育场、足球训练场:0771-4953380</text>
<text class="desc">体育馆、综合训练馆、网球馆:0771-4953380</text>
<text class="desc">游泳跳水馆:0771-4736008</text>
<text class="title">参观接待</text>
<text class="desc">预约电话:0771-4736955</text>
<text class="desc">传真号码:0771-4736955</text>
<text class="title">参观接待</text>
<text class="desc">预约电话:0771-4736955</text>
<text class="desc">传真号码:0771-4736955</text>
<text class="title">大型活动订场</text>
<text class="desc">预约电话:0771-4736970、0771-4736994</text>
<text class="title">大型活动订场</text>
<text class="desc">预约电话:0771-4736970、0771-4736994</text>
<text class="title">威拓普健身馆</text>
<text class="desc">联系电话:0771-5588699</text>
</view>
<view class="web-cell popup-close" @click="closeBookingTel">
<uv-icon name="close-circle" color="#ffffff" size="30"></uv-icon>
</view>
</uni-popup>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
<text class="title">威拓普健身馆</text>
<text class="desc">联系电话:0771-5588699</text>
</view>
<view class="web-cell popup-close" @click="closeBookingTel">
<uv-icon name="close-circle" color="#ffffff" size="30"></uv-icon>
</view>
</uni-popup>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</template>
<script>
import {
storeToRefs
} from 'pinia';
import * as MerchantApi from '@/api/shop/merchant';
import {
useCarStore
} from '@/store/modules/car';
const carStore = useCarStore();
import {
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 {
data() {
return {
id: 0,
// 场馆信息
merchant: {},
// 场馆相册
photo: [],
isLogin: false,
disabled: true
}
},
onLoad(option) {
this.id = option.id
carStore.merchantId = option.id
this.reload();
},
onShow() {
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
}
},
methods: {
async reload() {
const app = this
const carStore = useCarStore();
// 请求数据
Promise.all([app.getMerchant()]).then(res => {
const merchant = res[0];
app.merchant = merchant;
export default {
data() {
return {
id: 0,
// 场馆信息
merchant: {},
// 场馆相册
photo: [],
isLogin: false,
disabled: true,
lat: null,
lng: null,
}
},
async onLoad(option) {
this.id = option.id
carStore.merchantId = option.id
const {longitude, latitude} = await getLocationAction()
this.lat = latitude
this.lng = longitude
await this.reload();
},
onShow() {
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
}
},
methods: {
async reload() {
const app = this
// 修改标题
uni.setNavigationBarTitle({
title: merchant.merchantName
})
// 加载场馆相册
if (merchant.files) {
app.photo = JSON.parse(merchant.files)
}
// 更新购物车状态
carStore.setMerchant(merchant)
carStore.merchantId = merchant.merchantId
carStore.merchantName = merchant.merchantName
carStore.merchantCode = merchant.merchantCode
})
},
getMerchant() {
return new Promise((resolve, reject) => {
MerchantApi.getMerchant(this.id).then(result => {
resolve(result)
}).catch(reject)
})
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
uni.navigateTo({
url
})
},
mapTo(item){
console.log('item: ',item.lngAndLat);
const arr = item.lngAndLat.split(',');
console.log('arr: ',arr);
uni.openLocation({
latitude: parseFloat(arr[1]),
longitude: parseFloat(arr[0]),
success: function () {
console.log('success');
}
});
},
openBookingTel() {
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
this.$refs.popup.open('center')
},
closeBookingTel() {
this.$refs.popup.close()
},
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
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');
}
});
}
});
},
save() {
if (!this.disabled) {
uni.showToast({
title: '请先阅读并同意订票协议',
icon: 'none'
})
return false
}
uni.navigateTo({
url: '/package/booking/checkout?id=' + this.id
})
}
}
}
// 请求数据
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
// })
// 加载场馆相册
// 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) => {
getThinkSite(this.id).then(result => {
resolve(result)
}).catch(reject)
})
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
uni.navigateTo({
url
})
},
mapTo(item) {
uni.openLocation({
latitude: parseFloat(item.lat),
longitude: parseFloat(item.lng),
success: function () {
console.log('success');
}
});
},
openBookingTel() {
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
this.$refs.popup.open('center')
},
closeBookingTel() {
this.$refs.popup.close()
},
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
onMap() {
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success: function (res) {
console.log('返回可以用于uni.openLocation的经纬度: ', res);
const latitude = this.merchant.lat;
const longitude = this.merchant.lng;
uni.openLocation({
latitude: latitude,
longitude: longitude,
success: function () {
console.log('success');
}
});
}
});
},
save() {
if (!this.disabled) {
uni.showToast({
title: '请先阅读并同意订票协议',
icon: 'none'
})
return false
}
uni.navigateTo({
url: '/package/booking/checkout?id=' + this.id
})
}
}
}
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
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 {
padding: 30rpx;
font-weight: 500;
font-size: 42rpx;
background-color: #ffffff;
}
.merchant-name {
padding: 30rpx;
font-weight: 500;
font-size: 42rpx;
background-color: #ffffff;
}
.save-btn {
width: 700rpx;
left: 25rpx;
height: 80rpx;
position: fixed;
bottom: 30rpx;
}
.save-btn {
width: 700rpx;
left: 25rpx;
height: 80rpx;
position: fixed;
bottom: 30rpx;
}
.booking-tel {
position: fixed;
z-index: 1;
top: 270px;
right: 0;
width: 80px;
height: 38px;
border-radius: 50px 0 0 50px;
background: linear-gradient(to right, #ccff66, #008e04);
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
font-size: 13px;
}
.booking-tel {
position: fixed;
z-index: 1;
top: 270px;
right: 0;
width: 80px;
height: 38px;
border-radius: 50px 0 0 50px;
background: linear-gradient(to right, #ccff66, #008e04);
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
font-size: 13px;
}
.popup-booking-tel {
background-color: #ffffff;
width: 560rpx;
min-height: 400rpx;
border-radius: 20rpx;
margin: auto;
padding: 20px;
z-index: 9999;
display: flex;
flex-direction: column;
.popup-booking-tel {
background-color: #ffffff;
width: 560rpx;
min-height: 400rpx;
border-radius: 20rpx;
margin: auto;
padding: 20px;
z-index: 9999;
display: flex;
flex-direction: column;
.title {
font-weight: bold;
font-size: 38rpx;
text-align: center;
padding: 10px 0;
}
.title {
font-weight: bold;
font-size: 38rpx;
text-align: center;
padding: 10px 0;
}
.desc {
line-height: 2rem;
}
}
.desc {
line-height: 2rem;
}
}
.popup-close {
display: flex;
margin-top: 24rpx;
justify-content: center;
}
.booking-content{
padding: 10px;
font-size: 30rpx;
line-height: 1.5rem;
}
.xieyi {
margin-bottom: 80rpx;
padding: 0 30rpx;
.popup-close {
display: flex;
margin-top: 24rpx;
justify-content: center;
}
.text {
margin-left: 5rpx;
.booking-content {
padding: 10px;
font-size: 30rpx;
line-height: 1.5rem;
}
.link {
color: #0f80ff;
}
}
}
.xieyi {
margin-bottom: 80rpx;
padding: 0 30rpx;
.text {
margin-left: 5rpx;
.link {
color: #0f80ff;
}
}
}
</style>
+34 -58
View File
@@ -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>
@@ -39,8 +40,8 @@
<uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">
<uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">
<view
class="grid-item-box"
style="
class="grid-item-box"
style="
background-color: #ffffff;
margin: 10rpx;
border-radius: 10rpx;
@@ -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,41 +246,42 @@ 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() {
const app = this;
return new Promise((resolve, reject) => {
Api.getSiteInfo()
.then((result) => {
resolve(result);
})
.catch(reject);
.then((result) => {
resolve(result);
})
.catch(reject);
});
},
listAdList() {
async getSiteList() {
this.siteList = await listThinkSite()
},
pageGoods() {
const app = this;
return new Promise((resolve, reject) => {
GoodsApi.pageGoods({})
.then((result) => {
resolve(result.list);
})
.catch(reject);
.then((result) => {
resolve(result.list);
})
.catch(reject);
});
},
getMerchantList() {
const app = this;
return new Promise((resolve, reject) => {
MerchantApi.listMerchant({})
.then((result) => {
resolve(result);
})
.catch(reject);
.then((result) => {
resolve(result);
})
.catch(reject);
});
},
navTo(item) {
@@ -315,15 +291,15 @@ export default {
const app = this;
return new Promise((resolve, reject) => {
ItemApi.listItem({})
.then((result) => {
resolve(result);
})
.catch(reject);
.then((result) => {
resolve(result);
})
.catch(reject);
});
},
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}`})
}
})
}
}
};
+42
View File
@@ -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)
}