问诊开方支持购物车

master
gongfuxiang 2025-02-06 17:44:53 +08:00
parent fb4264d4a2
commit 8f5e74f691
4 changed files with 121 additions and 22 deletions

View File

@ -275,7 +275,7 @@
</scroll-view>
</block>
<!-- 选择门店弹 -->
<!-- 选择门店弹 -->
<component-popup :propShow="plugins_realstore_choice_status" propPosition="bottom" @onclose="realstore_choice_close_event">
<view class="padding-horizontal-main padding-top-main bg-white">
<view class="oh tc">
@ -306,11 +306,36 @@
</view>
</view>
</block>
<block v-else>
<view class="cr-grey tc padding-top-xl padding-bottom-xxxl">{{ $t('cart.cart.h63814') }}</view>
<block v-else>
<component-no-data :propMsg="$t('cart.cart.h63814')"></component-no-data>
</block>
</view>
</view>
</component-popup>
<!-- 互联网医院问诊下单弹窗 -->
<component-popup :propShow="plugins_hospital_prescription_status" propPosition="bottom" @onclose="hospital_prescription_close_event">
<view class="padding-horizontal-main padding-top-main bg-white">
<view class="oh tc">
<text class="text-size">{{ (plugins_hospital_prescription_data || null) != null ? (plugins_hospital_prescription_data.title || '') : '' }}</text>
<view class="fr" @tap.stop="hospital_prescription_close_event">
<iconfont name="icon-close-o" size="28rpx" color="#999"></iconfont>
</view>
</view>
<view class="padding-vertical-main">
<block v-if="(plugins_hospital_prescription_data || null) != null && plugins_hospital_prescription_data.choice_data.length > 0">
<block v-for="(item, index) in plugins_hospital_prescription_data.choice_data">
<view class="padding-vertical-xxl pr">
<text>{{item.name}}</text>
<button type="default" size="mini" class="bg-main br-main cr-white round text-size-xs pa top-xxxxxl right-0" :data-index="index" @tap="hospital_prescription_confirm_event">{{item.btn_text}}</button>
</view>
</block>
</block>
<block v-else>
<component-no-data></component-no-data>
</block>
</view>
</view>
</component-popup>
<!-- 门店购物车 -->
@ -405,7 +430,10 @@
is_cart_show_discount: 0,
scroll_style: '',
//
bottom_fixed_style: ''
bottom_fixed_style: '',
//
plugins_hospital_prescription_data: null,
plugins_hospital_prescription_status: false
};
},
@ -1025,13 +1053,20 @@
}
},
//
buy_data_params() {
//
// appoint_goods_ids idid
buy_data_params(appoint_goods_ids = null) {
// id
var temp_appoint_goods_ids = [];
if((appoint_goods_ids || null) != null) {
temp_appoint_goods_ids = appoint_goods_ids.split(',').map(function(v){return parseInt(v);});
}
//
var selected_count = 0;
var ids = [];
var temp_data_list = this.data_list || [];
for (var i in temp_data_list) {
if ((temp_data_list[i]['is_error'] || 0) == 0 && (temp_data_list[i]['selected'] || false) == true) {
if ((temp_data_list[i]['is_error'] || 0) == 0 && (temp_data_list[i]['selected'] || false) == true && (temp_appoint_goods_ids.length == 0 || temp_appoint_goods_ids.indexOf(parseInt(temp_data_list[i]['goods_id'])) != -1)) {
ids.push(temp_data_list[i]['id']);
selected_count++;
}
@ -1065,14 +1100,84 @@
//
buy_submit_event(e) {
//
var data = this.buy_data_params();
if (data === false) {
var buy_data = this.buy_data_params();
if (buy_data === false) {
app.globalData.showToast(this.$t('cart.cart.3sy0mp'));
return false;
}
//
var is_goods_is_prescription = parseInt(app.globalData.get_config('plugins_base.hospital.data.is_goods_is_prescription', 0));
if(is_goods_is_prescription == 1) {
this.plugins_hospital_prescription_handle(buy_data);
return false;
}
//
app.globalData.url_open('/pages/buy/buy?data=' + encodeURIComponent(base64.encode(JSON.stringify(data))));
//
this.to_buy_handle(buy_data);
},
//
plugins_hospital_prescription_handle(buy_data) {
uni.showLoading({
title: this.$t('common.processing_in_text'),
});
uni.request({
url: app.globalData.get_request_url('savecheck', 'prescription', 'hospital'),
method: 'POST',
data: buy_data,
dataType: 'json',
success: (res) => {
uni.hideLoading();
if (res.data.code == 0) {
var data = res.data.data;
if((data.choice_data || null) != null && data.choice_data.length > 0) {
this.setData({
plugins_hospital_prescription_data: data,
plugins_hospital_prescription_status: true
});
} else {
this.to_buy_handle(buy_data);
}
} else {
if (app.globalData.is_login_check(res.data)) {
this.to_buy_handle(buy_data);
} else {
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
}
}
},
fail: () => {
uni.hideLoading();
app.globalData.showToast(this.$t('common.internet_error_tips'));
},
});
},
//
hospital_prescription_confirm_event(e) {
var index = e.currentTarget.dataset.index || 0;
var data = this.plugins_hospital_prescription_data.choice_data[index];
var buy_data = this.buy_data_params(data.goods_ids);
//
if(data.type == 'prescription') {
this.to_buy_handle(buy_data, '/pages/plugins/hospital/prescription/prescription');
} else {
//
this.to_buy_handle(buy_data);
}
},
//
hospital_prescription_close_event(e) {
this.setData({
plugins_hospital_prescription_status: false
});
},
//
to_buy_handle(buy_data, pages = '/pages/buy/buy') {
app.globalData.url_open(pages+'?data=' + encodeURIComponent(base64.encode(JSON.stringify(buy_data))));
},
//

View File

@ -1,11 +1,8 @@
<template>
<view :class="theme_view">
<view class="page-bottom-fixed padding-main">
<view v-if="patient_tips != null" class="cr-yellow margin-bottom">
<view class="dis-inline-block va-m margin-right-xs">
<iconfont name="icon-sigh-o" size="28rpx" color="#f6c133"></iconfont>
</view>
<text class="va-m">{{patient_tips}}</text>
<view v-if="patient_tips != null" class="margin-bottom">
<uni-notice-bar background-color="" :text="patient_tips" />
</view>
<view v-if="(data_list || null) != null && data_list.length > 0" class="bg-white padding-horizontal-main border-radius-main">
<block v-for="(item, index) in data_list" :key="index">

View File

@ -2,11 +2,8 @@
<view :class="theme_view">
<block v-if="data_list_loding_status == 3">
<view class="page-bottom-fixed padding-main">
<view v-if="patient_tips != null" class="cr-yellow margin-bottom">
<view class="dis-inline-block va-m margin-right-xs">
<iconfont name="icon-sigh-o" size="28rpx" color="#f6c133"></iconfont>
</view>
<text class="va-m">{{patient_tips}}</text>
<view v-if="patient_tips != null" class="margin-bottom">
<uni-notice-bar background-color="" :text="patient_tips" />
</view>
<form @submit="form_submit" class="form-container">
<view class="oh border-radius-main tr">

View File

@ -21,7 +21,7 @@
<view class="padding-main">
<view>
<text class="fw-b va-m">用药人</text>
<view class="dis-inline-block va-m margin-left-sm" @tap="popup_patient_tips_event">
<view v-if="(patient_tips || null) != null" class="dis-inline-block va-m margin-left-sm" @tap="popup_patient_tips_event">
<iconfont name="icon-sigh-o" size="28rpx" color="#999"></iconfont>
</view>
</view>