页面UI更新
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="consultation-container safe-area-inset-bottom">
|
||||
<view class="consultation-header">
|
||||
<view class="header-back" @click="$emit('back')">
|
||||
<view class="header-back" @click="handleHeaderBack">
|
||||
<text class="iconfont icon-arrow-left"></text>
|
||||
</view>
|
||||
<view class="header-title">{{ headerTitle }}</view>
|
||||
@@ -19,24 +19,25 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-popup
|
||||
v-model="agreementPopupVisible"
|
||||
:safe-area-inset-bottom="true"
|
||||
mode="bottom"
|
||||
height="88%"
|
||||
border-radius="20"
|
||||
:closeable="true"
|
||||
z-index="20000"
|
||||
<page-container
|
||||
:show="agreementPopupVisible"
|
||||
position="bottom"
|
||||
round
|
||||
overlay
|
||||
custom-style="height:88%;"
|
||||
@clickoverlay="closeAgreement"
|
||||
@afterleave="closeAgreement"
|
||||
>
|
||||
<view class="agreement-popup">
|
||||
<view class="agreement-header">
|
||||
<text class="agreement-title">{{ currentAgreementName || '协议详情' }}</text>
|
||||
<view class="agreement-close" @click="closeAgreement">×</view>
|
||||
</view>
|
||||
<view class="agreement-content">
|
||||
<scroll-view scroll-y class="agreement-content" :show-scrollbar="true">
|
||||
<u-parse :html="agreementContent"></u-parse>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</page-container>
|
||||
|
||||
<scroll-view class="messages-scroll" scroll-y="true" :scroll-into-view="scrollIntoView" scroll-with-animation>
|
||||
<view class="messages-container">
|
||||
@@ -235,6 +236,16 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleHeaderBack() {
|
||||
if (this.showAgreement) {
|
||||
this.closeAgreement();
|
||||
return;
|
||||
}
|
||||
this.$emit('back');
|
||||
},
|
||||
closeAgreement() {
|
||||
this.$emit('update:showAgreement', false);
|
||||
},
|
||||
answerButtonClass(answer, index) {
|
||||
const answers = this.currentQuestionAnswers
|
||||
const totalAnswers = answers.length
|
||||
@@ -517,12 +528,24 @@ export default {
|
||||
}
|
||||
|
||||
.agreement-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 30rpx 50rpx 20rpx;
|
||||
border-bottom: 1rpx solid #e5e7eb;
|
||||
background: #fff;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.agreement-close {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 40rpx;
|
||||
color: #64748b;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.agreement-title {
|
||||
@@ -530,12 +553,15 @@ export default {
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
line-height: 1.5;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.agreement-content {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
min-height: 200rpx;
|
||||
padding: 30rpx 50rpx 40rpx;
|
||||
overflow-y: auto;
|
||||
min-height: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
import http from './request'
|
||||
import { get } from './http'
|
||||
|
||||
/** 将 xk-api 的 code/result 格式转为旧版 errcode/data,兼容现有页面 */
|
||||
function normalizeXkApiResponse(res) {
|
||||
if (res && res.data && (res.data.code === 0 || res.data.code === '0')) {
|
||||
res.data.errcode = 0;
|
||||
res.data.data = res.data.result;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// 登录 授权 其他手机号授权
|
||||
export async function getsLogin(params) {
|
||||
let data = await http('/oldApi/v1/user/login', params)
|
||||
@@ -34,20 +43,20 @@ export async function getAgreem(params) {
|
||||
|
||||
// 首页 门店 门店切换
|
||||
export async function storeChange(params) {
|
||||
let data = await http('/oldApi/v1/store/store-change', params)
|
||||
return data
|
||||
let data = await http('/xkApi/store/store-change', params)
|
||||
return normalizeXkApiResponse(data)
|
||||
}
|
||||
|
||||
// 首页 门店 用户所有门店
|
||||
export async function storeList(params) {
|
||||
let data = await http('/oldApi/v1/store/list', params)
|
||||
return data
|
||||
let data = await http('/xkApi/store/list', params)
|
||||
return normalizeXkApiResponse(data)
|
||||
}
|
||||
|
||||
// 首页 门店 门店信息
|
||||
export async function storeInfo(params) {
|
||||
let data = await http('/oldApi/v1/store/info', params)
|
||||
return data
|
||||
let data = await http('/xkApi/store/info', params)
|
||||
return normalizeXkApiResponse(data)
|
||||
}
|
||||
|
||||
// 医生列表
|
||||
|
||||
@@ -141,6 +141,12 @@ function request(url, params, method = 0) {
|
||||
} else if (url.indexOf('/xkApi/platform/qualifications') !== -1) {
|
||||
url = url.replace('/xkApi/platform/qualifications', '/guest/guest-platform/qualifications');
|
||||
baseURL = envUrls.xkApi;
|
||||
} else if (url.indexOf('/xkApi/store/info') !== -1) {
|
||||
url = url.replace('/xkApi/store/info', '/guest/guest-home/store-info');
|
||||
baseURL = envUrls.xkApi;
|
||||
} else if (url.indexOf('/xkApi/store/list') !== -1) {
|
||||
url = url.replace('/xkApi/store/list', '/guest/guest-home/store-list');
|
||||
baseURL = envUrls.xkApi;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,17 +116,25 @@
|
||||
</scroll-view>
|
||||
|
||||
<!-- 协议抽屉 -->
|
||||
<u-popup v-model="showAgreement" :safe-area-inset-bottom="true" mode="bottom" height="88%" border-radius="20"
|
||||
:closeable="true" z-index="20000">
|
||||
<page-container
|
||||
:show="showAgreement"
|
||||
position="bottom"
|
||||
round
|
||||
overlay
|
||||
custom-style="height:88%;"
|
||||
@clickoverlay="closeAgreement"
|
||||
@afterleave="closeAgreement"
|
||||
>
|
||||
<view class="agreement-popup">
|
||||
<view class="agreement-header">
|
||||
<text class="agreement-title">{{ currentAgreementName || '协议详情' }}</text>
|
||||
<view class="agreement-close" @click="closeAgreement">×</view>
|
||||
</view>
|
||||
<view class="agreement-content">
|
||||
<scroll-view scroll-y class="agreement-content" :show-scrollbar="true">
|
||||
<u-parse :html="agreementContent"></u-parse>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</page-container>
|
||||
|
||||
<!-- ================= 底部输入与工具栏 (重构优化版) ================= -->
|
||||
<view class="chat-footer safe-area-inset-bottom" :style="{ bottom: keyboardHeight + 'px' }">
|
||||
@@ -327,9 +335,12 @@ export default {
|
||||
},
|
||||
|
||||
onBackPress() {
|
||||
// 拦截物理返回键,跳转到首页
|
||||
if (this.showAgreement) {
|
||||
this.closeAgreement();
|
||||
return true;
|
||||
}
|
||||
this.handleBack();
|
||||
return true; // 阻止默认返回行为
|
||||
return true;
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
@@ -553,6 +564,10 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
closeAgreement() {
|
||||
this.showAgreement = false;
|
||||
},
|
||||
|
||||
// === 音频播放逻辑 ===
|
||||
playAudio(msg) {
|
||||
const audioUrl = getParsedContent(msg.message_type, msg.message_content);
|
||||
@@ -1054,6 +1069,10 @@ export default {
|
||||
|
||||
// 处理返回操作(自定义返回逻辑)
|
||||
handleBack() {
|
||||
if (this.showAgreement) {
|
||||
this.closeAgreement();
|
||||
return false;
|
||||
}
|
||||
// 跳转到首页(tabBar页面需要使用switchTab)
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index',
|
||||
@@ -1267,12 +1286,24 @@ $bg-white: #ffffff;
|
||||
}
|
||||
|
||||
.agreement-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 30rpx 50rpx 20rpx;
|
||||
border-bottom: 1rpx solid #e5e7eb;
|
||||
background: #fff;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.agreement-close {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 40rpx;
|
||||
color: #64748b;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.agreement-title {
|
||||
@@ -1280,12 +1311,15 @@ $bg-white: #ffffff;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
line-height: 1.5;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.agreement-content {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
min-height: 200rpx;
|
||||
padding: 30rpx 50rpx 40rpx;
|
||||
overflow-y: auto;
|
||||
min-height: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -343,6 +343,13 @@ export default {
|
||||
uni.showToast({ title: '缺少商品信息', icon: 'none' });
|
||||
}
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.mode === 'clinic_post_register' && this.showPostRegisterAgreement) {
|
||||
this.showPostRegisterAgreement = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
methods: {
|
||||
postRegisterScrollToBottom() {
|
||||
this.postRegisterScrollIntoView = 'bottom-anchor';
|
||||
@@ -497,6 +504,10 @@ export default {
|
||||
}
|
||||
},
|
||||
handlePostRegisterBack() {
|
||||
if (this.showPostRegisterAgreement) {
|
||||
this.showPostRegisterAgreement = false;
|
||||
return;
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定返回首页吗?未完成确认将无法同步给医生。',
|
||||
|
||||
@@ -542,7 +542,6 @@ export default {
|
||||
let that = this
|
||||
if (this.flag) {
|
||||
this.flag = false
|
||||
// 获取支付配置
|
||||
getPayConfig({
|
||||
method: "post",
|
||||
data: {
|
||||
@@ -585,30 +584,20 @@ export default {
|
||||
}, 300)
|
||||
},
|
||||
fail: function(err) {
|
||||
that.flag = false
|
||||
that.flag = true
|
||||
console.log('fail:' + JSON.stringify(err));
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
title: err.errMsg && err.errMsg.indexOf('cancel') !== -1 ? '支付已取消' : '支付失败',
|
||||
duration: 1500,
|
||||
mask: false,
|
||||
icon: 'error'
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
if (res.data.msg) {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
duration: 1500,
|
||||
mask: false,
|
||||
icon: 'error'
|
||||
})
|
||||
return
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
that.flag = true
|
||||
this.$refs.uToast.show({
|
||||
title: res.data.msg,
|
||||
type: 'default',
|
||||
@@ -616,6 +605,15 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
}).catch((err) => {
|
||||
console.error('getPayConfig error:', err);
|
||||
uni.hideLoading();
|
||||
that.flag = true
|
||||
uni.showToast({
|
||||
title: '获取支付配置失败',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,51 +6,91 @@
|
||||
<view class="store">
|
||||
<view class="name">
|
||||
<text>当前门店</text>
|
||||
{{infoList.store.name}}
|
||||
{{ infoList.store && infoList.store.name }}
|
||||
<u-tag
|
||||
v-if="infoList.store"
|
||||
:text="getStoreTypeLabel(infoList.store.type)"
|
||||
:type="getStoreTypeTag(infoList.store.type)"
|
||||
size="mini"
|
||||
class="type-tag"
|
||||
/>
|
||||
</view>
|
||||
<view class="info" v-if="infoList.store">
|
||||
<text class="iconfont icon-icon-"></text>
|
||||
营业时间 :
|
||||
{{infoList.store.start_time }}-{{infoList.store.end_time }}
|
||||
{{ infoList.store.start_time }}-{{ infoList.store.end_time }}
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="info" v-if="infoList.store">
|
||||
<text class="iconfont icon-tel"></text>
|
||||
联系电话:
|
||||
{{infoList.store.mobile}}
|
||||
{{ infoList.store.mobile }}
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="info" v-if="infoList.store">
|
||||
<text class="iconfont icon-shouhuodizhi"></text>
|
||||
地址 :
|
||||
{{infoList.store.position}}
|
||||
{{ infoList.store.position }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 其他门店 -->
|
||||
<view class="list">
|
||||
<view class="title">
|
||||
其他门店
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 空页 -->
|
||||
<view class="empty" v-if="storeinfo.length<=0">
|
||||
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/empty/orders.png" mode="aspectFit"></image>
|
||||
<text>暂无门店信息</text>
|
||||
<view class="tabs-wrap">
|
||||
<u-tabs
|
||||
:list="tabList"
|
||||
:is-scroll="false"
|
||||
:current="tabIndex"
|
||||
@change="onTabChange"
|
||||
></u-tabs>
|
||||
</view>
|
||||
|
||||
<swiper
|
||||
class="store-swiper"
|
||||
:current="tabIndex"
|
||||
@change="onSwiperChange"
|
||||
>
|
||||
<swiper-item v-for="(tab, tabIdx) in tabList" :key="tabIdx">
|
||||
<scroll-view scroll-y class="store-scroll">
|
||||
<view class="empty" v-if="getFilteredStores(tabIdx).length <= 0">
|
||||
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/empty/orders.png" mode="aspectFit"></image>
|
||||
<text>暂无{{ tab.name }}信息</text>
|
||||
</view>
|
||||
|
||||
<view class="item" @click="toChang(item.store.id)" v-for="(item,index) in storeinfo" :key="item.id">
|
||||
<view class="name">
|
||||
{{item.store.name}}
|
||||
</view>
|
||||
<view class="timer" v-if="item.store">
|
||||
营业时间:{{item.store.start_time }}-{{item.store.end_time }}
|
||||
</view>
|
||||
<view class="timer">地址:{{item.store.position}}</view>
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="{ 'item-current': isCurrentStore(item.store.id) }"
|
||||
@click="onStoreItemClick(item)"
|
||||
v-for="item in getFilteredStores(tabIdx)"
|
||||
:key="item.id"
|
||||
>
|
||||
<view class="name">
|
||||
{{ item.store.name }}
|
||||
<u-tag
|
||||
v-if="isCurrentStore(item.store.id)"
|
||||
text="当前"
|
||||
type="info"
|
||||
size="mini"
|
||||
class="type-tag"
|
||||
/>
|
||||
<u-tag
|
||||
:text="getStoreTypeLabel(item.store.type)"
|
||||
:type="getStoreTypeTag(item.store.type)"
|
||||
size="mini"
|
||||
class="type-tag"
|
||||
/>
|
||||
</view>
|
||||
<view class="timer" v-if="item.store">
|
||||
营业时间:{{ item.store.start_time }}-{{ item.store.end_time }}
|
||||
</view>
|
||||
<view class="timer">地址:{{ item.store.position }}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -60,131 +100,175 @@
|
||||
storeInfo,
|
||||
storeList
|
||||
} from '../../request/api/api'
|
||||
import { isGuestMode } from '@/common/utils/auth.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isshow: false,
|
||||
storeinfo: [],
|
||||
infoList: [],
|
||||
headerTitle: "", // 标题
|
||||
infoList: {
|
||||
store: null
|
||||
},
|
||||
headerTitle: '',
|
||||
tabIndex: 0,
|
||||
tabChanging: false,
|
||||
tabList: [
|
||||
{ name: '诊所' },
|
||||
{ name: '药店' }
|
||||
],
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// this.getStore();
|
||||
},
|
||||
created() {
|
||||
this.getStore();
|
||||
this.getInfo();
|
||||
},
|
||||
onReady() {
|
||||
this.getStore();
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.headerTitle,
|
||||
success() {
|
||||
console.log('success');
|
||||
}
|
||||
});
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: '#000000', //前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000
|
||||
frontColor: '#000000',
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 切换门店
|
||||
toChang(e) {
|
||||
// console.log(e, 'id');
|
||||
storeChange({
|
||||
method: "post",
|
||||
data: {
|
||||
store_id: e
|
||||
parseApiData(res) {
|
||||
if (res.data.code === 0 || res.data.code === '0') {
|
||||
return res.data.result;
|
||||
}
|
||||
if (res.data.errcode === 0 || res.data.errcode === '0') {
|
||||
return res.data.data;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
isApiSuccess(res) {
|
||||
return (res.data.code === 0 || res.data.code === '0')
|
||||
|| (res.data.errcode === 0 || res.data.errcode === '0');
|
||||
},
|
||||
getStoreTypeLabel(type) {
|
||||
return (type === 1 || type === '1') ? '药店' : '诊所';
|
||||
},
|
||||
getStoreTypeTag(type) {
|
||||
return (type === 1 || type === '1') ? 'success' : 'primary';
|
||||
},
|
||||
getFilteredStores(tabIdx) {
|
||||
return this.storeinfo.filter((item) => {
|
||||
if (!item.store) return false;
|
||||
const storeType = item.store.type;
|
||||
return tabIdx === 1
|
||||
? (storeType === 1 || storeType === '1')
|
||||
: (storeType === 0 || storeType === '0');
|
||||
});
|
||||
},
|
||||
isCurrentStore(storeId) {
|
||||
const currentStoreId = this.infoList.store && this.infoList.store.id;
|
||||
return currentStoreId && storeId === currentStoreId;
|
||||
},
|
||||
onStoreItemClick(item) {
|
||||
if (!item.store) return;
|
||||
if (this.isCurrentStore(item.store.id)) {
|
||||
uni.showToast({
|
||||
title: '当前已经在这个门店了',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.toChang(item.store.id, item.store.type);
|
||||
},
|
||||
setDefaultTabByStoreType(type) {
|
||||
this.tabIndex = (type === 1 || type === '1') ? 1 : 0;
|
||||
},
|
||||
onTabChange(index) {
|
||||
if (this.tabChanging) return;
|
||||
this.tabChanging = true;
|
||||
this.tabIndex = index;
|
||||
this.$nextTick(() => {
|
||||
this.tabChanging = false;
|
||||
});
|
||||
},
|
||||
onSwiperChange(e) {
|
||||
if (this.tabChanging) return;
|
||||
this.tabChanging = true;
|
||||
this.tabIndex = e.detail.current;
|
||||
this.$nextTick(() => {
|
||||
this.tabChanging = false;
|
||||
});
|
||||
},
|
||||
toChang(storeId, storeType) {
|
||||
const token = uni.getStorageSync('token');
|
||||
if (!token || isGuestMode()) {
|
||||
uni.setStorageSync('store_id', storeId);
|
||||
uni.setStorageSync('stores_id', storeId);
|
||||
if (storeType !== undefined && storeType !== null) {
|
||||
uni.setStorageSync('store_type', storeType);
|
||||
}
|
||||
uni.showToast({
|
||||
title: '切换成功',
|
||||
duration: 2000,
|
||||
icon: 'success'
|
||||
});
|
||||
uni.switchTab({ url: '/pages/home/home' });
|
||||
return;
|
||||
}
|
||||
|
||||
storeChange({
|
||||
method: 'post',
|
||||
data: { store_id: storeId }
|
||||
}).then((res) => {
|
||||
if (res.data.errcode == 0) {
|
||||
uni.setStorageSync('store_id', e)
|
||||
uni.setStorageSync('stores_id', e)
|
||||
if (this.isApiSuccess(res)) {
|
||||
const data = this.parseApiData(res);
|
||||
uni.setStorageSync('store_id', storeId);
|
||||
uni.setStorageSync('stores_id', storeId);
|
||||
const type = data && data.store ? data.store.type : storeType;
|
||||
if (type !== undefined && type !== null) {
|
||||
uni.setStorageSync('store_type', type);
|
||||
}
|
||||
uni.showToast({
|
||||
title: '切换成功',
|
||||
duration: 2000,
|
||||
icon: "success"
|
||||
icon: 'success'
|
||||
});
|
||||
// uni.removeStorageSync('stores_id')
|
||||
// setTimeout(() => {
|
||||
// uni.switchTab({
|
||||
// url: '/pages/home/home'
|
||||
// })
|
||||
// }, 2000)
|
||||
|
||||
uni.switchTab({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
uni.switchTab({ url: '/pages/home/home' });
|
||||
}
|
||||
})
|
||||
|
||||
this.getStore();
|
||||
});
|
||||
},
|
||||
|
||||
// 门店列表
|
||||
getStore() {
|
||||
storeList({
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data: {
|
||||
store_id: 11001
|
||||
store_id: uni.getStorageSync('store_id') || '11001'
|
||||
}
|
||||
}).then((res) => {
|
||||
// console.log(res, 'list');
|
||||
if (res.data.errcode == 0) {
|
||||
this.storeinfo = res.data.data.list
|
||||
if (this.isApiSuccess(res)) {
|
||||
const data = this.parseApiData(res);
|
||||
if (data && data.list) {
|
||||
this.storeinfo = data.list;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
// 门店信息
|
||||
getInfo() {
|
||||
storeInfo({
|
||||
method: "post",
|
||||
method: 'post',
|
||||
data: {
|
||||
store_id: uni.getStorageSync('store_id') || '11001',
|
||||
}
|
||||
}).then((res) => {
|
||||
// console.log(res, 'info');
|
||||
if (res.data.errcode == 0) {
|
||||
this.infoList = res.data.data
|
||||
this.headerTitle = this.infoList.store['name']
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.headerTitle,
|
||||
success() {
|
||||
console.log(3333);
|
||||
}
|
||||
});
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: '#000000', //前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000
|
||||
})
|
||||
if (this.isApiSuccess(res)) {
|
||||
const data = this.parseApiData(res);
|
||||
if (data && data.store) {
|
||||
this.infoList = data;
|
||||
this.headerTitle = data.store.name;
|
||||
this.setDefaultTabByStoreType(data.store.type);
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.headerTitle,
|
||||
});
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: '#000000',
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// this.getStore();
|
||||
},
|
||||
onShow() {
|
||||
// this.getStore();
|
||||
},
|
||||
onUnload() {
|
||||
// uni.removeStorageSync('store_id')
|
||||
},
|
||||
filters: {
|
||||
//过滤器 用于格式化时间
|
||||
dateFormat: function(value) {
|
||||
var date = new Date(value * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
|
||||
var year = date.getFullYear();
|
||||
var month = ("0" + (date.getMonth() + 1)).slice(-2);
|
||||
var sdate = ("0" + date.getDate()).slice(-2);
|
||||
var hour = ("0" + date.getHours()).slice(-2);
|
||||
var minute = ("0" + date.getMinutes()).slice(-2);
|
||||
var second = ("0" + date.getSeconds()).slice(-2);
|
||||
// 拼接
|
||||
var result = hour + ":" + minute //+ ":" + second;
|
||||
// 返回
|
||||
return result;
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -193,30 +277,38 @@
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
width: 750rpx;
|
||||
max-height: 100%;
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
background: #F5F5F5;
|
||||
box-sizing: border-box;
|
||||
|
||||
.card {
|
||||
width: 750rpx;
|
||||
height: 310rpx;
|
||||
min-height: 310rpx;
|
||||
background: #FFFFFF;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 40rpx 20rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
image {
|
||||
width: 172rpx;
|
||||
height: 188rpx;
|
||||
vertical-align: middle;
|
||||
margin-right: 36rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.store {
|
||||
flex: 1;
|
||||
font-family: PingFang SC-Regular, PingFang SC;
|
||||
|
||||
.name {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
@@ -227,6 +319,10 @@
|
||||
color: #666666;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.type-tag {
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
@@ -240,31 +336,72 @@
|
||||
color: #4175EE;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.list {
|
||||
width: 750rpx;
|
||||
padding: 34rpx;
|
||||
margin: 30rpx auto;
|
||||
margin: 30rpx auto 0;
|
||||
border-radius: 20rpx;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
.tabs-wrap {
|
||||
background: #FFFFFF;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
margin-top: 20rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.store-swiper {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
min-height: 400rpx;
|
||||
}
|
||||
|
||||
.store-scroll {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.item {
|
||||
width: 688rpx;
|
||||
font-family: PingFang SC-Bold, PingFang SC;
|
||||
padding: 20rpx 32rpx;
|
||||
background: #FFFFFF;
|
||||
margin: 40rpx auto 20rpx;
|
||||
margin: 20rpx auto;
|
||||
border-radius: 20rpx;
|
||||
|
||||
&.item-current {
|
||||
background: #FFFFFF;
|
||||
|
||||
.name {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.timer {
|
||||
color: #AAAAAA;
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
margin-top: 8rpx;
|
||||
|
||||
.type-tag {
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.timer {
|
||||
@@ -282,6 +419,7 @@
|
||||
color: #232323;
|
||||
border-bottom: 1rpx solid #DDDDDD;
|
||||
padding: 0 0 20rpx 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.empty {
|
||||
@@ -309,4 +447,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -604,7 +604,6 @@
|
||||
let that = this
|
||||
if (this.flag) {
|
||||
this.flag = false
|
||||
// 获取支付配置
|
||||
getPayConfig({
|
||||
method: "post",
|
||||
data: {
|
||||
@@ -647,30 +646,20 @@
|
||||
}, 300)
|
||||
},
|
||||
fail: function(err) {
|
||||
that.flag = false
|
||||
that.flag = true
|
||||
console.log('fail:' + JSON.stringify(err));
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
title: err.errMsg && err.errMsg.indexOf('cancel') !== -1 ? '支付已取消' : '支付失败',
|
||||
duration: 1500,
|
||||
mask: false,
|
||||
icon: 'error'
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
if (res.data.msg) {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
duration: 1500,
|
||||
mask: false,
|
||||
icon: 'error'
|
||||
})
|
||||
return
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
that.flag = true
|
||||
this.$refs.uToast.show({
|
||||
title: res.data.msg,
|
||||
type: 'default',
|
||||
@@ -678,6 +667,15 @@
|
||||
})
|
||||
}
|
||||
|
||||
}).catch((err) => {
|
||||
console.error('getPayConfig error:', err);
|
||||
uni.hideLoading();
|
||||
that.flag = true
|
||||
uni.showToast({
|
||||
title: '获取支付配置失败',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,11 @@
|
||||
</view>
|
||||
|
||||
<!-- 3. 主体内容区:左侧分类 + 右侧商品 -->
|
||||
<view class="main-content">
|
||||
<view
|
||||
class="main-content"
|
||||
@touchstart="onZoneTouchStart"
|
||||
@touchend="onZoneTouchEnd"
|
||||
>
|
||||
<!-- 左侧分类栏 -->
|
||||
<view class="category-sidebar">
|
||||
<scroll-view scroll-y class="category-scroll">
|
||||
@@ -185,6 +189,7 @@ export default {
|
||||
homeZones: [],
|
||||
selectedZoneIndex: 0,
|
||||
selectedZoneType: 'otc',
|
||||
zoneTouch: { startX: 0, startY: 0 },
|
||||
|
||||
// 分类相关
|
||||
categoryList: [],
|
||||
@@ -296,10 +301,25 @@ export default {
|
||||
this.selectedZoneIndex = index;
|
||||
this.selectedZoneType = this.homeZones[index]?.type || 'otc';
|
||||
this.selectedCategoryId = 0;
|
||||
// 重新获取分类和商品
|
||||
this.getCategoryList();
|
||||
},
|
||||
|
||||
onZoneTouchStart(e) {
|
||||
const touch = e.touches[0] || e.changedTouches[0];
|
||||
if (!touch) return;
|
||||
this.zoneTouch.startX = touch.clientX;
|
||||
this.zoneTouch.startY = touch.clientY;
|
||||
},
|
||||
|
||||
onZoneTouchEnd(e) {
|
||||
const dx = e.changedTouches[0].clientX - this.zoneTouch.startX;
|
||||
const dy = e.changedTouches[0].clientY - this.zoneTouch.startY;
|
||||
if (Math.abs(dx) < 60 || Math.abs(dx) < Math.abs(dy)) return;
|
||||
const next = dx < 0 ? this.selectedZoneIndex + 1 : this.selectedZoneIndex - 1;
|
||||
if (next < 0 || next >= this.homeZones.length) return;
|
||||
this.onZoneChange(next);
|
||||
},
|
||||
|
||||
// 分类选择
|
||||
selectCategory(categoryId) {
|
||||
this.selectedCategoryId = categoryId;
|
||||
|
||||
@@ -196,6 +196,13 @@ export default {
|
||||
this.loadAssistantConfig()
|
||||
this.loadAgreementInfo()
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.showAgreement) {
|
||||
this.showAgreement = false
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
methods: {
|
||||
// 加载转诊详情(获取药品信息)
|
||||
async loadTransferDetail() {
|
||||
@@ -448,6 +455,10 @@ export default {
|
||||
},
|
||||
// 返回
|
||||
handleBack() {
|
||||
if (this.showAgreement) {
|
||||
this.showAgreement = false
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要退出咨询吗?未完成的回答将不会保存。',
|
||||
|
||||
Reference in New Issue
Block a user