商品分类页面结算支持问诊开方
parent
b786fa0ce9
commit
d78b04f2f7
37
App.vue
37
App.vue
|
|
@ -7,10 +7,10 @@
|
|||
data: {
|
||||
// 基础配置
|
||||
// 数据接口请求地址
|
||||
request_url:'https://d1.shopxo.vip/',
|
||||
request_url:'http://shopxo.com/',
|
||||
|
||||
// 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/)
|
||||
static_url:'https://d1.shopxo.vip/',
|
||||
static_url:'http://shopxo.com/',
|
||||
|
||||
// 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立)
|
||||
system_type: 'default',
|
||||
|
|
@ -2472,6 +2472,39 @@
|
|||
return this.get_config('currency_symbol') || this.data.currency_symbol;
|
||||
},
|
||||
|
||||
// 购物车结算数据参数
|
||||
// appoint_goods_ids 指定结算商品id,多个id逗号分割)
|
||||
buy_cart_data_params(data, 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 ids = [];
|
||||
if ((data || null) != null) {
|
||||
for (var i in data) {
|
||||
if (data[i]['is_error'] == 0 && (temp_appoint_goods_ids.length == 0 || temp_appoint_goods_ids.indexOf(parseInt(data[i]['goods_id'])) != -1)) {
|
||||
ids.push(data[i]['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ids.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 结算参数
|
||||
return {
|
||||
buy_type: 'cart',
|
||||
ids: ids.join(','),
|
||||
};
|
||||
},
|
||||
|
||||
// 进入购买
|
||||
to_buy_handle(buy_data, pages = '/pages/buy/buy') {
|
||||
this.url_open(pages+'?data=' + encodeURIComponent(base64.encode(JSON.stringify(buy_data))));
|
||||
},
|
||||
|
||||
// 位置权限校验
|
||||
get_location_check(type, object, method) {
|
||||
// #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
## v6.7.1(2025-09-26)
|
||||
1. 多商户导航事件优化
|
||||
2. 商品详情左上角返回图标丢失修复
|
||||
3. 智能工具箱商品评价id丢失修复
|
||||
4. 表单新增编辑
|
||||
5. 商品分类页面结算支持问诊开方
|
||||
|
||||
|
||||
## v6.7.0(2025-09-26)
|
||||
1. 新增商品对比
|
||||
2. 修改优惠劵处理逻辑、领取错误修复
|
||||
|
|
|
|||
|
|
@ -1027,7 +1027,7 @@
|
|||
|
||||
// 预下单处理
|
||||
pre_order_handle() {
|
||||
var data = this.buy_data_params();
|
||||
var data = this.buy_cart_data_params();
|
||||
if (data !== false) {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'buy'),
|
||||
|
|
@ -1063,23 +1063,16 @@
|
|||
|
||||
// 结算数据参数
|
||||
// appoint_goods_ids 指定结算商品id,多个id逗号分割)
|
||||
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 = [];
|
||||
buy_cart_data_params(appoint_goods_ids = null) {
|
||||
var data_list = [];
|
||||
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 && (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++;
|
||||
if ((temp_data_list[i]['selected'] || false) == true) {
|
||||
data_list.push(temp_data_list[i]);
|
||||
}
|
||||
}
|
||||
if (selected_count <= 0) {
|
||||
var data = app.globalData.buy_cart_data_params(data_list, appoint_goods_ids);
|
||||
if(data === false) {
|
||||
this.setData({
|
||||
preferential_price: 0,
|
||||
increase_price: 0,
|
||||
|
|
@ -1088,19 +1081,13 @@
|
|||
total_num: 0,
|
||||
discount_detail_list: [],
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// 结算参数
|
||||
var data = {
|
||||
buy_type: 'cart',
|
||||
ids: ids.join(','),
|
||||
};
|
||||
// 是否门店模式
|
||||
if (this.cart_type_value == 'realstore' && (this.plugins_realstore_info || null) != null) {
|
||||
var type_data = this.$refs.realstore_cart.buy_use_type_data();
|
||||
data['buy_use_type_data_index'] = type_data.data_index;
|
||||
data['realstore_id'] = this.plugins_realstore_info.id;
|
||||
} else {
|
||||
// 是否门店模式
|
||||
if (this.cart_type_value == 'realstore' && (this.plugins_realstore_info || null) != null) {
|
||||
var type_data = this.$refs.realstore_cart.buy_use_type_data();
|
||||
data['buy_use_type_data_index'] = type_data.data_index;
|
||||
data['realstore_id'] = this.plugins_realstore_info.id;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
|
@ -1108,7 +1095,7 @@
|
|||
// 结算
|
||||
buy_submit_event(e) {
|
||||
// 结算参数
|
||||
var buy_data = this.buy_data_params();
|
||||
var buy_data = this.buy_cart_data_params();
|
||||
if (buy_data === false) {
|
||||
app.globalData.showToast(this.$t('cart.cart.3sy0mp'));
|
||||
return false;
|
||||
|
|
@ -1122,7 +1109,7 @@
|
|||
}
|
||||
|
||||
// 进入结算页面
|
||||
this.to_buy_handle(buy_data);
|
||||
app.globalData.to_buy_handle(buy_data);
|
||||
},
|
||||
|
||||
// 互联网医院处方问诊
|
||||
|
|
@ -1145,11 +1132,11 @@
|
|||
plugins_hospital_prescription_status: true
|
||||
});
|
||||
} else {
|
||||
this.to_buy_handle(buy_data);
|
||||
app.globalData.to_buy_handle(buy_data);
|
||||
}
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
this.to_buy_handle(buy_data);
|
||||
app.globalData.to_buy_handle(buy_data);
|
||||
} else {
|
||||
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
|
||||
}
|
||||
|
|
@ -1166,13 +1153,13 @@
|
|||
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);
|
||||
var buy_data = this.buy_cart_data_params(data.goods_ids);
|
||||
// 问诊开方
|
||||
if(data.type == 'prescription') {
|
||||
this.to_buy_handle(buy_data, '/pages/plugins/hospital/prescription/prescription');
|
||||
app.globalData.to_buy_handle(buy_data, '/pages/plugins/hospital/prescription/prescription');
|
||||
} else {
|
||||
// 普通结算
|
||||
this.to_buy_handle(buy_data);
|
||||
app.globalData.to_buy_handle(buy_data);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -1183,11 +1170,6 @@
|
|||
});
|
||||
},
|
||||
|
||||
// 进入购买
|
||||
to_buy_handle(buy_data, pages = '/pages/buy/buy') {
|
||||
app.globalData.url_open(pages+'?data=' + encodeURIComponent(base64.encode(JSON.stringify(buy_data))));
|
||||
},
|
||||
|
||||
// 展示型事件
|
||||
exhibition_submit_event(e) {
|
||||
app.globalData.call_tel(this.common_app_customer_service_tel);
|
||||
|
|
|
|||
|
|
@ -360,6 +360,31 @@
|
|||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 互联网医院问诊下单弹窗 -->
|
||||
<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-line" 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" :key="index">
|
||||
<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>
|
||||
|
||||
<!-- 公共 -->
|
||||
<component-common ref="common" @onFooterHeight="footer_height_value_event" :propIsFooterSeat="false"></component-common>
|
||||
|
|
@ -457,6 +482,9 @@
|
|||
botton_nav_style: '',
|
||||
cart_content_style: '',
|
||||
footer_height_value: 0,
|
||||
// 互联网医院问诊数据
|
||||
plugins_hospital_prescription_data: null,
|
||||
plugins_hospital_prescription_status: false
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -1308,33 +1336,95 @@
|
|||
});
|
||||
},
|
||||
|
||||
// 购物车结算数据参数
|
||||
// appoint_goods_ids 指定结算商品id,多个id逗号分割)
|
||||
buy_cart_data_params(appoint_goods_ids = null) {
|
||||
if ((this.cart || null) != null) {
|
||||
return app.globalData.buy_cart_data_params(this.cart.data || [], appoint_goods_ids);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
// 购物车结算
|
||||
buy_submit_event(e) {
|
||||
if (!app.globalData.is_single_page_check()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 获取购物车数据
|
||||
var ids = [];
|
||||
if ((this.cart || null) != null) {
|
||||
var temp_data = this.cart.data || [];
|
||||
for (var i in temp_data) {
|
||||
if (temp_data[i]['is_error'] == 0) {
|
||||
ids.push(temp_data[i]['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ids.length <= 0) {
|
||||
// 结算参数
|
||||
var buy_data = this.buy_cart_data_params();
|
||||
if (buy_data === false) {
|
||||
app.globalData.showToast(this.$t('goods-category.goods-category.5pj8ip'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// 进入订单确认页面
|
||||
var data = {
|
||||
buy_type: 'cart',
|
||||
ids: ids.join(','),
|
||||
};
|
||||
app.globalData.url_open('/pages/buy/buy?data=' + encodeURIComponent(base64.encode(JSON.stringify(data))));
|
||||
// 是否开启了互联网医院处方问诊
|
||||
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.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 {
|
||||
app.globalData.to_buy_handle(buy_data);
|
||||
}
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.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_cart_data_params(data.goods_ids);
|
||||
// 问诊开方
|
||||
if(data.type == 'prescription') {
|
||||
app.globalData.to_buy_handle(buy_data, '/pages/plugins/hospital/prescription/prescription');
|
||||
} else {
|
||||
// 普通结算
|
||||
app.globalData.to_buy_handle(buy_data);
|
||||
}
|
||||
},
|
||||
|
||||
// 互联网医院问诊弹窗关闭
|
||||
hospital_prescription_close_event(e) {
|
||||
this.setData({
|
||||
plugins_hospital_prescription_status: false
|
||||
});
|
||||
},
|
||||
|
||||
// 计算搜索框的高度
|
||||
|
|
|
|||
Loading…
Reference in New Issue