index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <view class="top-cont">
  3. <view class="content">
  4. <view class="user-info">
  5. <view class="left">
  6. <view class="name-phone">
  7. <view class="name" v-if="user != null">{{ user.nickName }}</view>
  8. <view class="phone" v-if="user != null">{{ $parsePhone(user.phonenumber) }}</view>
  9. </view>
  10. </view>
  11. <view class="msg-box" v-if="user != null">
  12. {{ user.deptName }}
  13. </view>
  14. </view>
  15. <!-- 常用工具 -->
  16. <view class="used-tools">
  17. <view class="title">常用工具</view>
  18. <view class="tools-list">
  19. <view class="item" @click="navTo('/pages/company/couponList?isShare=1&couponType=5')">
  20. <image src="/static/images/icon_company_3.png" mode=""></image>
  21. <text class="text">私域疗法券</text>
  22. </view>
  23. <view class="item" @click="navTo('/pages/company/couponList?isShare=1&couponType=2')">
  24. <image src="/static/images/icon_company_3.png" mode=""></image>
  25. <text class="text">中药免单券</text>
  26. </view>
  27. <view class="item" @click="navTo('/pages/company/couponList?isShare=1&couponType=4')">
  28. <image src="/static/images/icon_company_3.png" mode=""></image>
  29. <text class="text">中药打折券</text>
  30. </view>
  31. <view class="item" @click="navTo('/pages/company/packageList')">
  32. <image src="/static/images/icon_company_3.png" mode=""></image>
  33. <text class="text">疗法</text>
  34. </view>
  35. <view class="item" @click="navTo('/pages/store/inquirySelectType?companyId=' + companyId + '&companyUserId=' + companyUserId + '&isShare=1')">
  36. <image src="/static/images/icon_company_3.png" mode=""></image>
  37. <text class="text">会诊</text>
  38. </view>
  39. <view class="item" @click="navTo('/pages/store/inquirySelect?inquiryType=3&companyId=' + companyId + '&companyUserId=' + companyUserId + '&isShare=1')">
  40. <image src="/static/images/icon_company_3.png" mode=""></image>
  41. <text class="text">按方开药</text>
  42. </view>
  43. <view class="item" @click="navTo('/pages/company/packageOrderList')">
  44. <image src="/static/images/icon_company_3.png" mode=""></image>
  45. <text class="text">疗法订单</text>
  46. </view>
  47. <view class="item" @click="navTo('/pages/company/inquiryOrderList')">
  48. <image src="/static/images/icon_company_3.png" mode=""></image>
  49. <text class="text">问诊订单</text>
  50. </view>
  51. <view class="item" @click="navTo('/pages/company/storeOrderList')">
  52. <image src="/static/images/icon_company_3.png" mode=""></image>
  53. <text class="text">处方订单</text>
  54. </view>
  55. <view class="item" @click="doShare('问诊')">
  56. <image src="/static/images/icon_company_3.png" mode=""></image>
  57. <text class="text">问诊分享</text>
  58. <button class="share-btn" open-type="share"></button>
  59. </view>
  60. <view class="item" @click="doShare('健康档案')">
  61. <image src="/static/image/my/my_order_icon.png" mode=""></image>
  62. <text class="text">健康档案分享</text>
  63. <button class="share-btn" open-type="share"></button>
  64. </view>
  65. <view class="item" @click="navTo('/pages/company/bindInfo')">
  66. <image src="/static/image/my/my_order_icon.png" mode=""></image>
  67. <text class="text">公司码</text>
  68. <button class="share-btn" open-type="share"></button>
  69. </view>
  70. <view class="item" v-if="showManageCts" @click="navTo('/pages/ai/index')">
  71. <image src="/static/images/icon_company_3.png" mode=""></image>
  72. <text class="text">智能客服</text>
  73. <button class="share-btn" open-type="share"></button>
  74. </view>
  75. <view class="item" v-if="showManageCts" @click="navTo('/pages/company/voice')">
  76. <image src="/static/images/icon_company_3.png" mode=""></image>
  77. <text class="text">声音采集</text>
  78. </view>
  79. <view class="item" v-if="showManageCts" @click="navTo('/pages/company/voiceList')">
  80. <image src="/static/images/icon_company_3.png" mode=""></image>
  81. <text class="text">声音录制</text>
  82. </view>
  83. <view class="item" @click="navTo(`/pages/doctor/doctorList?companyId=${companyId}&companyUserId=${companyUserId}&isShare=1`)">
  84. <image src="/static/images/icon_company_3.png" mode=""></image>
  85. <text class="text">预约挂号</text>
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 退出登录按钮 -->
  90. <view class="logout" :style="{ opacity: isLoading ? 0.6 : 1 }" @click="logout">{{ isLoading ? '退出中...' : '退出登录' }}</view>
  91. </view>
  92. <!-- 分享弹窗 -->
  93. <u-popup :show="showShare" @close="showShare = false">
  94. <share-box :shareItem="shareItem" :showCopy="false" @closeShare="showShare = false"></share-box>
  95. </u-popup>
  96. </view>
  97. </template>
  98. <script>
  99. import { getUserInfo, getQrImg, companyJpushLoginout } from '@/api/companyUser';
  100. import IMSDK from 'openim-uniapp-polyfill';
  101. import { callingModule, meetingModule } from '@/pages_im/util/imCommon';
  102. export default {
  103. data() {
  104. return {
  105. companyId: null,
  106. companyUserId: null,
  107. user: null,
  108. showShare: false,
  109. showManageCts: false,
  110. showRemove: false,
  111. shareItem: { imageUrl: '', title: '', path: '', isMini: true },
  112. isLoading: false
  113. };
  114. },
  115. onLoad() {
  116. // #ifdef APP-PLUS
  117. let that = this;
  118. if (this.$isIos()) {
  119. this.showManageCts = uni.getStorageSync('showIOSPay');
  120. return;
  121. }
  122. if (this.$isAgreePrivacy()) {
  123. plus.runtime.getProperty(plus.runtime.appid, function (widgetinfo) {
  124. let platform = uni.getSystemInfoSync().platform;
  125. let srcData = JSON.parse(uni.getStorageSync('aVersion'));
  126. let data = srcData.data;
  127. let version = widgetinfo.versionCode; //app本地版本
  128. let serverVersion = data.versionCode; //升级包版本
  129. if (version == serverVersion) {
  130. that.showManageCts = uni.getStorageSync('showManageCts');
  131. } else {
  132. that.showManageCts = true;
  133. }
  134. });
  135. }
  136. // #endif
  137. },
  138. onShow() {
  139. this.companyId = uni.getStorageSync('companyId');
  140. this.companyUserId = uni.getStorageSync('companyUserId');
  141. this.getUserInfo();
  142. },
  143. onShareAppMessage(res) {
  144. return {
  145. title: '问诊',
  146. path: '/pages/TUIKit/TUIPages/TUIConversation/index',
  147. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  148. };
  149. },
  150. methods: {
  151. doShare(type) {
  152. // #ifdef APP-PLUS
  153. if (type == '问诊') {
  154. this.shareItem.title = '问诊';
  155. this.shareItem.imageUrl = 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png';
  156. this.shareItem.compressImage = 1;
  157. this.shareItem.isMini = true;
  158. this.shareItem.path = '/pages/TUIKit/TUIPages/TUIConversation/index';
  159. let cdn = uni.getStorageSync('h5Path');
  160. this.shareItem.url = cdn + this.shareItem.path;
  161. this.showShare = true;
  162. } else if (type == '健康档案') {
  163. this.shareItem.title = '健康档案';
  164. this.shareItem.imageUrl = 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png';
  165. this.shareItem.compressImage = 1;
  166. this.shareItem.isMini = true;
  167. this.shareItem.path = '/pages_user/healthRecords/index';
  168. let cdn = uni.getStorageSync('h5Path');
  169. this.shareItem.url = cdn + '/pages/user/healthRecords/index';
  170. this.showShare = true;
  171. }
  172. // #endif
  173. },
  174. navTo(url) {
  175. uni.navigateTo({
  176. url: url
  177. });
  178. },
  179. getUserInfo() {
  180. var data = {};
  181. getUserInfo(data).then(
  182. (res) => {
  183. if (res.code == 200) {
  184. this.user = res.data;
  185. } else {
  186. uni.setStorageSync('CompanyUserToken', null);
  187. uni.showToast({
  188. icon: 'none',
  189. title: res.msg
  190. });
  191. uni.navigateBack({
  192. delta: -1
  193. });
  194. }
  195. },
  196. (rej) => {}
  197. );
  198. },
  199. async logout() {
  200. if (this.isLoading) return;
  201. uni.showModal({
  202. title: '提示',
  203. content: '确认退出登录吗?',
  204. showCancel: true,
  205. cancelText: '取消',
  206. confirmText: '确定',
  207. success: async (res) => {
  208. if (res.confirm) {
  209. this.isLoading = true;
  210. uni.showLoading({title: '退出中..',mask: true});
  211. // #ifdef APP-PLUS
  212. try {
  213. await companyJpushLoginout();
  214. } catch (e) {
  215. console.error('JPush logout failed', e);
  216. }
  217. // #endif
  218. uni.removeStorageSync('CompanyUserToken');
  219. uni.removeStorageSync('companyUser');
  220. uni.removeStorageSync('companyId');
  221. uni.removeStorageSync('companyUserId');
  222. IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid())
  223. .then(() => {
  224. callingModule?.endCall();
  225. meetingModule?.endCall();
  226. uni.removeStorage({key: 'IMToken'});
  227. uni.removeStorage({key: 'IMUserID'});
  228. uni.removeStorage({key: 'IMHasLogin'});
  229. setTimeout(() => {
  230. uni.$emit('refreshIM');
  231. }, 500);
  232. })
  233. .catch((err) => console.log(err))
  234. .finally(() => {
  235. uni.hideLoading();
  236. this.isLoading = false;
  237. uni.$emit('refreshIMMenu');
  238. uni.redirectTo({
  239. url: '/pages/company/login'
  240. });
  241. });
  242. }
  243. }
  244. });
  245. },
  246. // 跳转页面
  247. navgetTo(url) {
  248. this.$isLogin().then((res) => {
  249. if (res) {
  250. uni.navigateTo({
  251. url: url
  252. });
  253. }
  254. });
  255. }
  256. }
  257. };
  258. </script>
  259. <style lang="scss">
  260. .content {
  261. padding: 20upx;
  262. .user-info {
  263. padding: 30upx;
  264. display: flex;
  265. align-items: center;
  266. justify-content: space-between;
  267. .left {
  268. position: relative;
  269. display: flex;
  270. .head-img {
  271. width: 120upx;
  272. height: 120upx;
  273. border-radius: 50%;
  274. overflow: hidden;
  275. margin-right: 30upx;
  276. border: 4upx solid #ffffff;
  277. box-shadow: 0px 5px 15px 2px rgba(0, 0, 0, 0.1);
  278. image {
  279. width: 100%;
  280. height: 100%;
  281. }
  282. }
  283. .name-phone {
  284. padding-top: 15upx;
  285. .name {
  286. font-size: 36upx;
  287. font-family: PingFang SC;
  288. font-weight: bold;
  289. color: #111111;
  290. line-height: 1;
  291. }
  292. .phone {
  293. font-size: 28upx;
  294. font-family: PingFang SC;
  295. font-weight: 500;
  296. color: #666666;
  297. line-height: 1;
  298. margin-top: 30upx;
  299. }
  300. }
  301. }
  302. .msg-box {
  303. padding: 10rpx 20upx;
  304. font-size: 28upx;
  305. font-family: PingFang SC;
  306. font-weight: 500;
  307. color: #ffffff;
  308. border-radius: 8rpx;
  309. background-color: #FF5030;
  310. }
  311. }
  312. .used-tools {
  313. box-sizing: border-box;
  314. background: #ffffff;
  315. border-radius: 16upx;
  316. padding: 40upx 30upx;
  317. .title {
  318. font-size: 32upx;
  319. font-family: PingFang SC;
  320. font-weight: bold;
  321. color: #222222;
  322. line-height: 1;
  323. }
  324. .tools-list {
  325. margin-top: 50upx;
  326. display: flex;
  327. flex-wrap: wrap;
  328. width: 100%;
  329. .item {
  330. box-sizing: border-box;
  331. width: 25%;
  332. display: flex;
  333. flex-direction: column;
  334. align-items: center;
  335. justify-content: center;
  336. margin-bottom: 50upx;
  337. position: relative;
  338. image {
  339. width: 44upx;
  340. height: 44upx;
  341. }
  342. .text {
  343. font-size: 24upx;
  344. font-family: PingFang SC;
  345. font-weight: 500;
  346. color: #111111;
  347. line-height: 1;
  348. margin-top: 20upx;
  349. }
  350. .share-btn {
  351. display: inline-block;
  352. position: absolute;
  353. top: 0;
  354. left: 0;
  355. width: 100%;
  356. height: 100%;
  357. opacity: 0;
  358. }
  359. }
  360. }
  361. }
  362. .logout {
  363. height: 80upx;
  364. line-height: 80upx;
  365. text-align: center;
  366. font-size: 26upx;
  367. font-family: PingFang SC;
  368. font-weight: 500;
  369. color: #666666;
  370. background: #ffffff;
  371. border-radius: 16upx;
  372. margin-top: 20upx;
  373. }
  374. }
  375. </style>