diff --git a/components/AssistantConsultationShell.vue b/components/AssistantConsultationShell.vue
index 214ed4f..49a8532 100644
--- a/components/AssistantConsultationShell.vue
+++ b/components/AssistantConsultationShell.vue
@@ -1,7 +1,7 @@
-
-
+
@@ -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;
}
diff --git a/request/api/api.js b/request/api/api.js
index d043d70..45a418f 100644
--- a/request/api/api.js
+++ b/request/api/api.js
@@ -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)
}
// 医生列表
diff --git a/request/api/request.js b/request/api/request.js
index dcedba5..30f1f5a 100644
--- a/request/api/request.js
+++ b/request/api/request.js
@@ -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;
}
}
diff --git a/subPackages/chat/chat.vue b/subPackages/chat/chat.vue
index 6735802..2bc937d 100644
--- a/subPackages/chat/chat.vue
+++ b/subPackages/chat/chat.vue
@@ -116,17 +116,25 @@
-
+
-
+
@@ -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
+ },
+ headerTitle: '',
+ tabIndex: 0,
+ tabChanging: false,
+ tabList: [
+ { name: '诊所' },
+ { name: '药店' }
+ ],
}
},
- onLoad() {
- // this.getStore();
- },
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);
}
+ uni.showToast({
+ title: '切换成功',
+ duration: 2000,
+ icon: 'success'
+ });
+ uni.switchTab({ url: '/pages/home/home' });
+ return;
+ }
+
+ storeChange({
+ method: 'post',
+ data: { store_id: storeId }
}).then((res) => {
- if (res.data.errcode == 0) {
- uni.setStorageSync('store_id', e)
- uni.setStorageSync('stores_id', e)
+ 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"
+ 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' });
}
- })
-
- this.getStore();
+ });
},
-
- // 门店列表
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']
- uni.setNavigationBarTitle({
- title: this.headerTitle,
- success() {
- console.log(3333);
- }
- });
- uni.setNavigationBarColor({
- frontColor: '#000000', //前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000
- })
+ 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,
+ });
+ uni.setNavigationBarColor({
+ 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 @@
\ No newline at end of file
+
diff --git a/subPackages/my/record-pay.vue b/subPackages/my/record-pay.vue
index b386cdb..3e76f28 100644
--- a/subPackages/my/record-pay.vue
+++ b/subPackages/my/record-pay.vue
@@ -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
+ })
})
}
diff --git a/subPackages/product/product.vue b/subPackages/product/product.vue
index dc06224..d69eb1e 100644
--- a/subPackages/product/product.vue
+++ b/subPackages/product/product.vue
@@ -39,7 +39,11 @@
-
+