From 550332d9634ac7ef485e3bfd0e1e4806e94c8c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Mon, 1 Jun 2026 11:06:52 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E5=A4=8D=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=9A=84bug=EF=BC=8C=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=AF=8A=E6=89=80|=E8=8D=AF=E5=BA=97?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E8=80=8C=E4=B8=8D=E6=98=AF=E6=80=BB=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/utils/drug.js | 30 ++++++++ pages/home/home.vue | 2 +- request/api/api.js | 4 +- request/api/request.js | 8 ++ subPackages/follow-up/medication-info.vue | 4 + subPackages/my/my-drug/drug-info.vue | 33 +++++++-- subPackages/my/my-drug/drug-list.vue | 50 ++++++------- subPackages/my/record-pay.vue | 10 ++- subPackages/product/symptoms.vue | 90 +++++++++++++++++++---- subPackages/shop/shop-cate.vue | 11 +-- 10 files changed, 179 insertions(+), 63 deletions(-) create mode 100644 common/utils/drug.js diff --git a/common/utils/drug.js b/common/utils/drug.js new file mode 100644 index 0000000..fec148b --- /dev/null +++ b/common/utils/drug.js @@ -0,0 +1,30 @@ +export function isWesternRxDrug(drug) { + return drug && drug.type == 2 && (drug.is_otc === 0 || drug.is_otc === '0'); +} + +export function isHealthFood(drug) { + return drug && (drug.type == 3 || drug.category_type === 'health_food'); +} + +export function canShowFunction(drug, prescriptionApproved) { + if (isHealthFood(drug)) return false; + if (isWesternRxDrug(drug)) return !!prescriptionApproved; + return true; +} + +export function canShowUsage(drug, prescriptionApproved) { + if (isHealthFood(drug)) return false; + if (isWesternRxDrug(drug)) return !!prescriptionApproved; + return drug && drug.type != 3; +} + +export function canShowInstruction(drug, prescriptionApproved) { + if (isWesternRxDrug(drug)) return !!prescriptionApproved; + return true; +} + +export function isPrescriptionApprovedStatus(data) { + if (!data) return false; + const ps = data.prescription_status ?? data.status; + return data.status === true || ps === 1 || ps === '1' || ps === 3 || ps === '3' || ps === 4 || ps === '4'; +} diff --git a/pages/home/home.vue b/pages/home/home.vue index 2e4f0c9..ddb609d 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -164,7 +164,7 @@ ¥ - {{ item.price || (item.drug && item.drug.drugStoreDrug ? item.drug.drugStoreDrug.price : '0.00') }} + {{ item.price || '0.00' }} diff --git a/request/api/api.js b/request/api/api.js index 45a418f..3251b31 100644 --- a/request/api/api.js +++ b/request/api/api.js @@ -371,8 +371,8 @@ export async function articleInfo(params) { // v1/product-order/list export async function getOrdlist(params) { - let data = await http('/oldApi/v1/product-order/list', params) - return data + let data = await http('/xkApi/product-order/list', params) + return normalizeXkApiResponse(data) } // v1/product-order/list diff --git a/request/api/request.js b/request/api/request.js index 30f1f5a..fcc9786 100644 --- a/request/api/request.js +++ b/request/api/request.js @@ -234,7 +234,15 @@ function request(url, params, method = 0) { // 加密 if (params != null) { + if (!params.data) { + params.data = {}; + } params.data = getRes(params.data, false); + const isProductApi = url.indexOf('/product/') !== -1; + if (isProductApi && !params.data.store_id) { + const localStoreId = uni.getStorageSync('store_id'); + params.data.store_id = localStoreId || getGuestStoreId(); + } // 如果是guest模式,设置store_id(优先使用用户传入或本地存储的值) if (isGuestRequest && params.data) { // 优先使用用户传入的 store_id diff --git a/subPackages/follow-up/medication-info.vue b/subPackages/follow-up/medication-info.vue index 36478d8..489ff76 100644 --- a/subPackages/follow-up/medication-info.vue +++ b/subPackages/follow-up/medication-info.vue @@ -251,6 +251,10 @@ export default { return ['是', '否']; }, productPrice() { + const rel = this.productDetail.drug_store_relations; + if (rel && rel.price) { + return parseFloat(rel.price); + } if (this.productDetail.drug_store_drug && this.productDetail.drug_store_drug.price) { return parseFloat(this.productDetail.drug_store_drug.price); } diff --git a/subPackages/my/my-drug/drug-info.vue b/subPackages/my/my-drug/drug-info.vue index c4207b9..2e3c5b5 100644 --- a/subPackages/my/my-drug/drug-info.vue +++ b/subPackages/my/my-drug/drug-info.vue @@ -70,7 +70,7 @@ - + @@ -80,13 +80,13 @@ {{ item.drug.specification }} - {{ item.drug.function }} + {{ item.drug.function }} - + {{ item.drug.usage }} - + 查看说明书 @@ -185,6 +185,7 @@ import { import { getOrderTextApi } from '../../../request/api/product' // 导入订单相关接口 import { getPrescriptionStatusApi } from '../../../request/api/order' +import { canShowFunction, canShowUsage, canShowInstruction, isPrescriptionApprovedStatus } from '@/common/utils/drug' export default { data() { @@ -265,6 +266,27 @@ export default { this.getOrderText(); }, methods: { + canShowFunction, + canShowUsage, + canShowInstruction, + goDrugDetail(item) { + const drugId = item.drug_id || (item.drug && item.drug.id); + if (!drugId) return; + const orderStoreId = (this.orderInfo.ProductOrder && this.orderInfo.ProductOrder.store_id) + || uni.getStorageSync('store_id') + || '11001'; + const q = [ + `id=${encodeURIComponent(drugId)}`, + `store_id=${encodeURIComponent(orderStoreId)}`, + `order_id=${encodeURIComponent(this.order_id || '')}`, + `drug_name=${encodeURIComponent(item.drug_name || '')}`, + `image=${encodeURIComponent(item.drug_image || '')}`, + `price=${encodeURIComponent(item.price || '')}`, + ].join('&'); + uni.navigateTo({ + url: `/subPackages/product/symptoms?${q}`, + }); + }, // 获取订单提示文本 getOrderText() { getOrderTextApi().then((res) => { @@ -628,8 +650,7 @@ export default { }).then((res) => { if (res.data && (res.data.code == 0 || res.data.errcode == 0)) { const data = res.data.data || res.data.result || {}; - const ps = data.prescription_status ?? data.status; - this.prescriptionStatus = data.status === true || ps === 1 || ps === '1' || ps === 3 || ps === '3' || ps === 4 || ps === '4'; + this.prescriptionStatus = isPrescriptionApprovedStatus(data); } else { this.prescriptionStatus = false; } diff --git a/subPackages/my/my-drug/drug-list.vue b/subPackages/my/my-drug/drug-list.vue index 8f62937..d3b5f68 100644 --- a/subPackages/my/my-drug/drug-list.vue +++ b/subPackages/my/my-drug/drug-list.vue @@ -11,7 +11,7 @@ - + @@ -25,7 +25,7 @@ :refresher-triggered="isRefreshing" @refresherrefresh="onRefresherRefresh" > - + @@ -103,11 +103,11 @@ - {{ it.drug.function }} + {{ it.drug.function }} - {{ it.drug.specification }}1 + {{ it.drug.specification }} x{{it.number}} @@ -147,10 +147,6 @@ 签收 - - 取消 - 已取消 @@ -167,6 +163,11 @@ 查看物流 + + + + + @@ -187,6 +188,7 @@ import { getPayConfig, postRefundBased } from '../../../request/api/api'; +import { canShowFunction } from '@/common/utils/drug'; export default { data() { @@ -207,6 +209,12 @@ export default { }, { name: '已完成' + }, + { + name: '退款' + }, + { + name: '已取消' } ], keyword: "", @@ -231,7 +239,8 @@ export default { }, onLoad(e) { this.order_id = e.id - this.change(e.index); + const tabIndex = parseInt(e.index, 10); + this.change(Number.isNaN(tabIndex) ? 0 : tabIndex); }, computed: { @@ -240,6 +249,7 @@ export default { this.scrollTop = e.scrollTop; }, methods: { + canShowFunction, // scroll-view 专用下拉刷新响应 onRefresherRefresh() { this.isRefreshing = true; @@ -280,24 +290,10 @@ export default { }, // 点击切换 change(index) { - // console.log(index); - this.current = index; - if (this.current == 0) { - this.status = '' - } - if (this.current == 1) { - // unpaid未支付 wait_send代发货 wait_accept已发货 finished已完成 - this.status = 'unpaid' - } - if (this.current == 2) { - this.status = 'wait_send' - } - if (this.current == 3) { - this.status = 'wait_accept' - } - if (this.current == 4) { - this.status = 'finished' - } + const tabIndex = Number(index) || 0; + this.current = tabIndex; + const statusMap = ['', 'unpaid', 'wait_send', 'wait_accept', 'finished', 'refund', 'cancel']; + this.status = statusMap[tabIndex] ?? ''; this.orderList = [] this.page = 1 this.getList() diff --git a/subPackages/my/record-pay.vue b/subPackages/my/record-pay.vue index 3e76f28..45bb7a9 100644 --- a/subPackages/my/record-pay.vue +++ b/subPackages/my/record-pay.vue @@ -97,12 +97,12 @@ {{item.content.drug_name}}{{item.content.specification}} - + {{item.content.usage}} 查看说明书 @@ -206,6 +206,7 @@ // 导入 getOrderTextApi 接口方法 import { getOrderTextApi } from '../../request/api/product' import { getPrescriptionStatusApi } from '../../request/api/order' + import { canShowUsage, canShowInstruction, isPrescriptionApprovedStatus } from '@/common/utils/drug' export default { data() { @@ -287,6 +288,8 @@ }, methods: { + canShowUsage, + canShowInstruction, // 获取订单提示文本 getOrderText() { getOrderTextApi().then((res) => { @@ -518,8 +521,7 @@ }).then((res) => { if (res.data && (res.data.code == 0 || res.data.errcode == 0)) { const data = res.data.data || res.data.result || {} - const ps = data.prescription_status ?? data.status - this.prescriptionStatus = data.status === true || ps === 1 || ps === '1' || ps === 3 || ps === '3' || ps === 4 || ps === '4' + this.prescriptionStatus = isPrescriptionApprovedStatus(data) } else { this.prescriptionStatus = false } diff --git a/subPackages/product/symptoms.vue b/subPackages/product/symptoms.vue index 000503d..67c4d38 100644 --- a/subPackages/product/symptoms.vue +++ b/subPackages/product/symptoms.vue @@ -94,7 +94,7 @@ - + 用法用量 @@ -104,8 +104,8 @@ - - + + 说明书 @@ -146,7 +146,7 @@ - + @@ -243,8 +243,9 @@