页面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>
|
||||
</scroll-view>
|
||||
</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>
|
||||
</scroll-view>
|
||||
</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
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,21 @@
|
||||
|
||||
<!-- 头部 -->
|
||||
<view class="head">
|
||||
<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
|
||||
<u-tabs :list="list" :is-scroll="false" :current="current" @change="onTabChange"></u-tabs>
|
||||
</view>
|
||||
|
||||
<swiper class="order-swiper" :current="current" @change="onSwiperChange">
|
||||
<swiper-item v-for="(tab, tabIdx) in list" :key="tabIdx">
|
||||
<!-- 适配局部下拉刷新 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="order-scroll"
|
||||
@scrolltolower="onOrderScrollToLower"
|
||||
refresher-enabled="true"
|
||||
:refresher-triggered="isRefreshing"
|
||||
@refresherrefresh="onRefresherRefresh"
|
||||
>
|
||||
<block v-if="current === tabIdx">
|
||||
<!-- 空页 orderList.length==0 -->
|
||||
<view class="empty" v-if="orderList.length==0">
|
||||
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/empty/orders.png" mode="aspectFit"></image>
|
||||
@@ -22,85 +34,103 @@
|
||||
|
||||
<!-- 药品列表 -->
|
||||
<view class="list" v-for="(item,index) in orderList" :key="item.id" @click="next(item.id)">
|
||||
<!-- 卡片 -->
|
||||
|
||||
<!-- 卡片头部:改为门店位置 + 状态 -->
|
||||
<view class="yard">
|
||||
<view class="yard_name">
|
||||
订单编号:{{item.order_no}}
|
||||
<view class="yard_name new_store_header">
|
||||
<text class="iconfont icon-mendian"></text>
|
||||
<!-- 还原原有渲染字段 -->
|
||||
<text class="store_txt">{{item.store.name}}</text>
|
||||
<u-tag
|
||||
:text="item.prescription_type==1?'中药饮片':item.prescription_type==3?'保健食品':item.prescription_type==2?'西(中成)药':item.prescription_type==5?'产品服务包':item.prescription_type==7?'医疗器械':''"
|
||||
:type="item.prescription_type==1?'success':item.prescription_type==3?'warning':'primary'"
|
||||
size="mini"
|
||||
style="margin-left: 16rpx; flex-shrink: 0;"
|
||||
v-if="item.prescription_type"
|
||||
/>
|
||||
</view>
|
||||
<text>{{item.status_string}}</text>
|
||||
<text class="status_txt">{{item.status_string}}</text>
|
||||
</view>
|
||||
|
||||
<!-- <view class="yard">
|
||||
<view class="yard_name">
|
||||
您的处方已流转,由{{item.order_no}}发货
|
||||
<!-- 订单编号降级 -->
|
||||
<view class="order_no_box">
|
||||
订单编号:{{item.order_no}}
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
|
||||
<!-- 药品信息 -->
|
||||
<!-- 中药-颗粒 -->
|
||||
<view class="item_info" v-if="item.prescription_type==1||item.prescription_type==3">
|
||||
<view class="new_store">
|
||||
<text class="iconfont icon-mendian"></text>{{item.store.name}}
|
||||
<u-tag :text="item.prescription_type==1&&'中药饮片'||item.prescription_type==3&&'保健食品'"
|
||||
:type="item.prescription_type==1&&'success'||item.prescription_type==3&&'warning'||item.prescription.prescription_type==2&&'primary'"
|
||||
size="mini" style="margin-left: 20rpx;" />
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="zy_">
|
||||
<view class="zy_it" v-for="it in (item.items)" :key="it.id">
|
||||
<!-- 改用原生 v-show 保证安全渲染折叠 -->
|
||||
<view class="zy_it" v-for="(it, idx) in item.items" :key="it.id" v-show="item._expanded || idx < 6">
|
||||
<view class="zy_its">
|
||||
{{it.drug_name}}
|
||||
<text>x{{it.number}}</text>
|
||||
<text class="zy_drug_name">{{it.drug_name}}</text>
|
||||
<text class="zy_drug_num">x{{it.number}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 展开按钮 -->
|
||||
<view class="expand_box" v-if="item.items && item.items.length > 6" @click.stop="toggleExpand(item)">
|
||||
<text>{{ item._expanded ? '收起药品' : `展开其余 ${item.items.length - 6} 种药品` }}</text>
|
||||
<u-icon :name="item._expanded ? 'arrow-up' : 'arrow-down'" size="24" color="#999"></u-icon>
|
||||
</view>
|
||||
|
||||
<view class="it_price">
|
||||
<text class="num">共计:{{item.number}}件</text>
|
||||
<view class="price">
|
||||
总价:¥{{item.total_pay_price}}
|
||||
</view>
|
||||
<text class="num">共计:{{item.number}}件</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 西药 -->
|
||||
<view class="item_info" v-if="item.prescription_type==2||item.prescription_type==5||item.prescription_type==7">
|
||||
<view class="new_store">
|
||||
<text class="iconfont icon-mendian"></text>
|
||||
<text style="width: 70%;overflow-x: hidden">{{item.store.name}}</text>
|
||||
<u-tag :text="item.prescription_type == 2? '西(中成)药': item.prescription_type == 5? '产品服务包': '医疗器械'" :type="(item.prescription_type==2||item.prescription_type==5||item.prescription_type==7)&&'primary'" size="mini"
|
||||
style="margin-left: 20rpx;" />
|
||||
</view>
|
||||
<view class="info" v-for="it in (item.items).slice(0,3)" :key="it.id">
|
||||
<!-- 改用原生 v-show 保证规格和数据安全渲染 -->
|
||||
<view class="info" v-for="(it, idx) in item.items" :key="it.id" v-show="item._expanded || idx < 2">
|
||||
<view class="xy_">
|
||||
<image :src="it.drug_image || 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/mine/zy_mr.jpg'" mode=""></image>
|
||||
<image :src="it.drug_image || 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/mine/zy_mr.jpg'" mode="aspectFill"></image>
|
||||
<view class="infos">
|
||||
<view class="name">{{it.drug_name}}
|
||||
<view class="name">
|
||||
<text class="xy_drug_name">{{it.drug_name}}</text>
|
||||
<view class="">
|
||||
<text v-if="it.price">¥{{it.price}}</text>
|
||||
<text class="xy_price" v-if="it.price">¥{{it.price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="_specit">
|
||||
<text>{{it.drug.function || ''}}</text>
|
||||
<!-- 抛弃三元表达式,使用 v-if 防小程序编译 BUG -->
|
||||
<text class="xy_func" v-if="it.drug && it.drug.function">{{ it.drug.function }}</text>
|
||||
<text class="xy_func" v-else></text>
|
||||
<view class="number_specit">
|
||||
<text>{{it.drug.specification || ''}}</text>
|
||||
<text>x{{it.number}}</text>
|
||||
<!-- 最原生、最安全的取值方式,确保多商品列表下规格渲染不会被吞 -->
|
||||
<text class="xy_spec" v-if="it.drug && it.drug.specification">{{ it.drug.specification }}1</text>
|
||||
<text v-else></text>
|
||||
<text class="xy_num">x{{it.number}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="it_price">
|
||||
<view class="price">
|
||||
总价:¥{{item.total_pay_price}}
|
||||
</view>
|
||||
<text class="num">共计:{{item.number}}件</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<!-- 展开按钮 -->
|
||||
<view class="expand_box" v-if="item.items && item.items.length > 2" @click.stop="toggleExpand(item)">
|
||||
<text>{{ item._expanded ? '收起药品' : `展开其余 ${item.items.length - 2} 种药品` }}</text>
|
||||
<u-icon :name="item._expanded ? 'arrow-up' : 'arrow-down'" size="24" color="#999"></u-icon>
|
||||
</view>
|
||||
|
||||
<view class="it_price">
|
||||
<text class="num">共计:{{item.number}}件</text>
|
||||
<view class="price">
|
||||
总价:¥{{item.total_pay_price}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 按钮区完全保留你原有的判断逻辑 -->
|
||||
<view class="choose_btn">
|
||||
<view class="order_info active" v-if="item.status==1 && item.is_pay==1 && item.forbiddenRefund==0"
|
||||
@tap.stop="toCancel(item.id,item.status,refundType)">
|
||||
@@ -134,31 +164,36 @@
|
||||
<view class="order_info" v-else-if="item.status>=4&& item.is_pay==1&&item.status<=5 && item.prescription_type==2">
|
||||
{{item.status==5&&'退款中' || item.status==4&&'已退款' }}
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="order_info active" v-else-if="(item.status===2||item.status===6||item.status===7) && item.is_pay==1 && item.cancel_status==0 && item.delivery_method === 0" @tap.stop="toDevilty(item.id)">
|
||||
查看物流
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-loadmore :status="status" v-if="orderList.length!=0" />
|
||||
<u-loadmore :status="loadMoreStatus" v-if="orderList.length!=0" margin-top="30" margin-bottom="30" />
|
||||
</block>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<u-back-top :scroll-top="scrollTop"></u-back-top>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
import {
|
||||
confirmAccept,
|
||||
getCancle,
|
||||
getOrdlist,
|
||||
getPayConfig,
|
||||
postRefundBased
|
||||
} from '../../../request/api/api';
|
||||
} from '../../../request/api/api';
|
||||
|
||||
export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
status: 'nomore',
|
||||
isRefreshing: false, // 局部下拉刷新状态控制
|
||||
loadMoreStatus: 'nomore',
|
||||
tabChanging: false,
|
||||
list: [{
|
||||
name: '全部'
|
||||
},
|
||||
@@ -205,6 +240,19 @@
|
||||
this.scrollTop = e.scrollTop;
|
||||
},
|
||||
methods: {
|
||||
// scroll-view 专用下拉刷新响应
|
||||
onRefresherRefresh() {
|
||||
this.isRefreshing = true;
|
||||
this.page = 1;
|
||||
this.orderList = [];
|
||||
this.getList(() => {
|
||||
this.isRefreshing = false;
|
||||
});
|
||||
},
|
||||
// 修复小程序中模板内联 $set 导致状态无法折叠回去的兼容性方法
|
||||
toggleExpand(item) {
|
||||
this.$set(item, '_expanded', !item._expanded);
|
||||
},
|
||||
// 数量
|
||||
// getnum(obj) {
|
||||
// let list = obj
|
||||
@@ -214,6 +262,22 @@
|
||||
// })
|
||||
// return num
|
||||
// },
|
||||
onTabChange(index) {
|
||||
if (this.tabChanging) return;
|
||||
this.tabChanging = true;
|
||||
this.change(index);
|
||||
this.$nextTick(() => {
|
||||
this.tabChanging = false;
|
||||
});
|
||||
},
|
||||
onSwiperChange(e) {
|
||||
if (this.tabChanging) return;
|
||||
this.tabChanging = true;
|
||||
this.change(e.detail.current);
|
||||
this.$nextTick(() => {
|
||||
this.tabChanging = false;
|
||||
});
|
||||
},
|
||||
// 点击切换
|
||||
change(index) {
|
||||
// console.log(index);
|
||||
@@ -253,8 +317,8 @@
|
||||
})
|
||||
|
||||
},
|
||||
// 列表
|
||||
getList() {
|
||||
// 列表 (增加 callback 供局部下拉刷新调用)
|
||||
getList(callback) {
|
||||
let list = {
|
||||
keyword: this.keyword,
|
||||
store_id: uni.getStorageSync('store_id') || '11001',
|
||||
@@ -277,6 +341,9 @@
|
||||
}
|
||||
console.log(this.orderList, 'lb-lb');
|
||||
}
|
||||
if (typeof callback === 'function') callback();
|
||||
}).catch(() => {
|
||||
if (typeof callback === 'function') callback();
|
||||
})
|
||||
},
|
||||
|
||||
@@ -470,11 +537,11 @@
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
},
|
||||
// 触底触发
|
||||
onReachBottom() {
|
||||
// if (this.pageSize >= this.totalPage) return
|
||||
onOrderScrollToLower() {
|
||||
this.onReachBottomLoadMore();
|
||||
},
|
||||
onReachBottomLoadMore() {
|
||||
if (this.page < this.last) {
|
||||
this.page += 1
|
||||
uni.showToast({
|
||||
@@ -484,11 +551,14 @@
|
||||
icon: 'loading'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// console.log(1111);
|
||||
// this.orderList = []
|
||||
this.getList()
|
||||
}, 700)
|
||||
}
|
||||
}
|
||||
},
|
||||
// 触底触发
|
||||
onReachBottom() {
|
||||
this.onReachBottomLoadMore();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// console.log("触发了下拉刷新")
|
||||
@@ -510,16 +580,18 @@
|
||||
mounted() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
.container {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
max-height: 100%;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #F8FAFC;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
box-sizing: border-box;
|
||||
|
||||
.search {
|
||||
width: 750rpx;
|
||||
@@ -552,86 +624,111 @@
|
||||
.head {
|
||||
width: 750rpx;
|
||||
height: 80rpx;
|
||||
position: sticky;
|
||||
top: var(--window-top);
|
||||
flex-shrink: 0;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.order-swiper {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.order-scroll {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 以下为卡片优化后的新UI样式 */
|
||||
.list {
|
||||
width: 710rpx;
|
||||
margin: 10rpx auto;
|
||||
width: 702rpx;
|
||||
margin: 24rpx auto;
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx;
|
||||
padding: 22rpx 32rpx;
|
||||
border-radius: 24rpx;
|
||||
padding: 28rpx 32rpx;
|
||||
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.03); /* 增加微柔和阴影,去AI感 */
|
||||
box-sizing: border-box;
|
||||
|
||||
.yard {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
.yard_name {
|
||||
font-size: 24rpx;
|
||||
font-family: PingFang SC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #232323;
|
||||
|
||||
.iconfont {
|
||||
color: #232323;
|
||||
font-size: 22rpx;
|
||||
margin-left: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
text {
|
||||
color: #5F71FE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.new_store {
|
||||
.new_store_header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
.iconfont {
|
||||
margin-right: 6rpx;
|
||||
color: #666666;
|
||||
font-size: 34rpx;
|
||||
vertical-align: middle;
|
||||
color: #333333;
|
||||
font-size: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.store_txt {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 65%;
|
||||
}
|
||||
}
|
||||
|
||||
.status_txt {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #5F71FE;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.order_no_box {
|
||||
font-size: 24rpx;
|
||||
color: #9E9FA6;
|
||||
padding-bottom: 24rpx;
|
||||
border-bottom: 1rpx dashed #F0F0F0; /* 虚线分割更有质感 */
|
||||
}
|
||||
|
||||
.item_info {
|
||||
margin: 12rpx 0 30rpx 0;
|
||||
margin: 24rpx 0 0 0;
|
||||
|
||||
.info {
|
||||
font-size: 32rpx;
|
||||
font-family: PingFang SC-Bold, PingFang SC;
|
||||
color: #232323;
|
||||
margin-top: 10rpx;
|
||||
|
||||
.zy_ {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin: 0 -10rpx;
|
||||
|
||||
.zy_it {
|
||||
width: 33%;
|
||||
margin: 6rpx 0;
|
||||
width: 33.33%;
|
||||
padding: 10rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.zy_its {
|
||||
padding-right: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 28rpx;
|
||||
font-weight: 550;
|
||||
color: #333333;
|
||||
|
||||
text {
|
||||
.zy_drug_name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
.zy_drug_num {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
margin-left: 24rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -639,58 +736,98 @@
|
||||
|
||||
.xy_ {
|
||||
display: flex;
|
||||
// align-items: center;
|
||||
margin: 32rpx 0;
|
||||
margin: 24rpx 0;
|
||||
align-items: stretch;
|
||||
|
||||
image {
|
||||
width: 128rpx;
|
||||
height: 148rpx;
|
||||
border-radius: 20rpx;
|
||||
vertical-align: middle;
|
||||
margin-right: 40rpx;
|
||||
background: #FFFddd;
|
||||
width: 136rpx;
|
||||
height: 136rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-right: 24rpx;
|
||||
background: #F8FAFC;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.infos {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
overflow: hidden;
|
||||
|
||||
.name {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
|
||||
.xy_drug_name {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
line-height: 40rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
}
|
||||
.xy_price {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
margin-left: 20rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
._specit {
|
||||
font-size: 24rpx;
|
||||
color: #9E9FA6;
|
||||
|
||||
text {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
text-overflow: ellipsis;
|
||||
.xy_func {
|
||||
color: #999999;
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
|
||||
.number_specit {
|
||||
margin-top: 6rpx;
|
||||
flex: 1;
|
||||
margin-top: 8rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.xy_spec {
|
||||
color: #666666;
|
||||
background: #F5F7FA;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.xy_num {
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
font-weight: bold;
|
||||
line-height: 28rpx;
|
||||
margin: 0 0 12rpx 0;
|
||||
.expand_box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
padding: 16rpx 0;
|
||||
margin: 16rpx 0;
|
||||
background: #FAFAFA;
|
||||
border-radius: 12rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
|
||||
text {
|
||||
font-size: 25rpx;
|
||||
font-weight: 400;
|
||||
color: #9E9FA6;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
margin-right: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,53 +835,55 @@
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
margin-top: 24rpx;
|
||||
padding-top: 20rpx;
|
||||
|
||||
.num {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 32rpx;
|
||||
font-family: PingFang SC-Bold, PingFang SC;
|
||||
font-weight: bold;
|
||||
color: #FF5050;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #AAAAAA;
|
||||
line-height: 20rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.choose_btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 32rpx;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.order_info {
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC-Regular, PingFang SC;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #9E9FA6;
|
||||
padding: 10rpx 28rpx;
|
||||
border: 2rpx solid #9E9FA6;
|
||||
color: #666666;
|
||||
padding: 12rpx 32rpx;
|
||||
border: 2rpx solid #E5E5E5;
|
||||
border-radius: 64rpx;
|
||||
margin: 0 10rpx;
|
||||
margin-left: 16rpx;
|
||||
margin-bottom: 10rpx;
|
||||
background: #FFFFFF;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.color_red {
|
||||
color: #FF5050;
|
||||
border: 2rpx solid #FF5050;
|
||||
background: #FFF5F5;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: #5F71FE;
|
||||
border: 2rpx solid #5F71FE;
|
||||
background: #F4F5FF; /* 淡化主色调背景,提升质感 */
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -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="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}}
|
||||
{{ 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 }}
|
||||
营业时间:{{ item.store.start_time }}-{{ item.store.end_time }}
|
||||
</view>
|
||||
<view class="timer">地址:{{item.store.position}}</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
|
||||
},
|
||||
onLoad() {
|
||||
// this.getStore();
|
||||
headerTitle: '',
|
||||
tabIndex: 0,
|
||||
tabChanging: false,
|
||||
tabList: [
|
||||
{ name: '诊所' },
|
||||
{ name: '药店' }
|
||||
],
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.data.errcode == 0) {
|
||||
uni.setStorageSync('store_id', e)
|
||||
uni.setStorageSync('stores_id', e)
|
||||
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' });
|
||||
return;
|
||||
}
|
||||
})
|
||||
|
||||
this.getStore();
|
||||
storeChange({
|
||||
method: 'post',
|
||||
data: { store_id: storeId }
|
||||
}).then((res) => {
|
||||
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'
|
||||
});
|
||||
uni.switchTab({ url: '/pages/home/home' });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 门店列表
|
||||
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']
|
||||
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,
|
||||
success() {
|
||||
console.log(3333);
|
||||
}
|
||||
});
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: '#000000', //前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000
|
||||
})
|
||||
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 {
|
||||
|
||||
@@ -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