117 lines
3.5 KiB
JavaScript
117 lines
3.5 KiB
JavaScript
import { req } from '@/common/js/index.js';
|
|
import { unwrapClinicRes } from '@/api/clinicAdmin.js';
|
|
|
|
const STORE_PREFIX = '/newApi/platform-admin-store';
|
|
const CONFIG_PREFIX = '/newApi/platform-admin-salesperson-store-config';
|
|
|
|
function platformRequest(options) {
|
|
return req.request({
|
|
...options,
|
|
header: {
|
|
...(options.header || {}),
|
|
_platformAdmin: '1',
|
|
},
|
|
}).then((res) => {
|
|
const data = unwrapClinicRes(res);
|
|
const ok = res && (res.code === 0 || (res.errcode != null && Number(res.errcode) !== -1));
|
|
return { res, data, ok };
|
|
});
|
|
}
|
|
|
|
export function getPlatformStoreList(params) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/list`, method: 'GET', data: params });
|
|
}
|
|
|
|
export function getPlatformStoreDetail(id) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/detail`, method: 'GET', data: { id } });
|
|
}
|
|
|
|
export function updatePlatformStore(data) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/update`, method: 'POST', data });
|
|
}
|
|
|
|
export function deletePlatformStore(id) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/delete`, method: 'POST', data: { id } });
|
|
}
|
|
|
|
export function openStorePcWindows(id) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/open-pc-windows`, method: 'POST', data: { id } });
|
|
}
|
|
|
|
export function openStoreQrCode(id) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/open-qr-code`, method: 'POST', data: { id } });
|
|
}
|
|
|
|
export function updateStoreShippingFree(id) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/update-shipping-free`, method: 'POST', data: { id } });
|
|
}
|
|
|
|
export function updateStoreSubscribeStatus(id) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/update-subscribe-status`, method: 'POST', data: { id } });
|
|
}
|
|
|
|
export function updateStoreSeeRate(id) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/update-see-rate`, method: 'POST', data: { id } });
|
|
}
|
|
|
|
export function updateStoreAllowInsurance(id) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/update-allow-insurance-category`, method: 'POST', data: { id } });
|
|
}
|
|
|
|
export function updateStoreClinicType(id, clinicType) {
|
|
return platformRequest({
|
|
url: `${STORE_PREFIX}/update-clinic-type`,
|
|
method: 'POST',
|
|
data: { id, clinic_type: clinicType },
|
|
});
|
|
}
|
|
|
|
export function toggleSalespersonSeePrice(storeId) {
|
|
return platformRequest({
|
|
url: `${CONFIG_PREFIX}/toggle-see-price`,
|
|
method: 'POST',
|
|
data: { store_id: storeId },
|
|
});
|
|
}
|
|
|
|
export function getStoreDrugsByType(storeId, type) {
|
|
return platformRequest({
|
|
url: `${STORE_PREFIX}/get-store-drugs-by-type`,
|
|
method: 'GET',
|
|
data: { store_id: storeId, type },
|
|
});
|
|
}
|
|
|
|
export function updateStoreDrugPrices(data) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/update-store-drug-prices`, method: 'POST', data });
|
|
}
|
|
|
|
export function getDoctorOption(storeId) {
|
|
return platformRequest({
|
|
url: `${STORE_PREFIX}/doctor-option`,
|
|
method: 'GET',
|
|
data: storeId ? { store_id: storeId } : {},
|
|
});
|
|
}
|
|
|
|
export function getInternetMedicalStoreOption() {
|
|
return platformRequest({ url: `${STORE_PREFIX}/internet-medical-store-option`, method: 'GET' });
|
|
}
|
|
|
|
export function bindOnlineConsultation(data) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/bind-online-consultation`, method: 'POST', data });
|
|
}
|
|
|
|
export function updateStoreExternalField(data) {
|
|
return platformRequest({ url: `${STORE_PREFIX}/update-store-external-field`, method: 'POST', data });
|
|
}
|
|
|
|
export const DRUG_TYPE_OPTIONS = [
|
|
{ label: '中药', value: 1 },
|
|
{ label: '西药', value: 2 },
|
|
{ label: '保健食品', value: 3 },
|
|
{ label: '产品服务包', value: 5 },
|
|
{ label: '非药品', value: 6 },
|
|
{ label: '医疗器械', value: 7 },
|
|
];
|