index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <scroll-view :scroll-y="sysScroll" style="height: 100%">
  3. <view class="flex-col justify-start page">
  4. <cu-custom isBack="true" bgColor="#000000"><view slot="content" style="color: #FFFFFF">共享用户</view></cu-custom>
  5. <scroll-view scroll-x class="nav" style="background-color: #1e1ef7e3">
  6. <view class="flex text-center text-white">
  7. <view class="cu-item flex-sub" :class="2===tabCur?'text-orange cur':''" @tap="tabSelect(2)" data-id="2">推送亲友列表</view>
  8. <view class="cu-item flex-sub" :class="1===tabCur?'text-orange cur':''" @tap="tabSelect(1)" data-id="1">可看亲友列表</view>
  9. </view>
  10. </scroll-view>
  11. <view style="height: 100%">
  12. <view v-if="2===tabCur" :style="tableData.length === 0 || tableData.length < 4 ? 'height:100%':''" class="flex-col justify-start section">
  13. <view class="flex-col section_2 space-y-421">
  14. <view class="flex-col">
  15. <text class="self-start font_1 text_2">共享用户</text>
  16. <view class="flex-col group_3 space-y-10">
  17. <view class="flex-row justify-between items-center section_6" v-for="(item, index) in tableData" :key="index">
  18. <view class="flex-row">
  19. <image v-if="item.face === null || item.face === ''" class="image_6" src="http://wdklmall.oss-cn-shenzhen.aliyuncs.com/mallgoods/goods/7F70B5FF967F44BC97BD7CD8786A70B4.png"/>
  20. <image v-else class="image_6" :src="item.face"/>
  21. <view class="flex-col items-start group_4 space-y-10">
  22. <text class="font_1 text_3">{{ item.nickname }}</text>
  23. <text class="text_5">{{ item.mobile }}</text>
  24. <text class="text_6 text_7">{{ formatTime(item.create_time) }}</text>
  25. <view style="margin-left: -90upx" class="text-white">
  26. <switch :checked="item.bool_sms" color="#1E09DE" style="transform:scale(0.7)" @change="changeBoosSms" :data-id="item.id" />
  27. <text class="font_2">短信提醒</text>
  28. <switch :checked="item.bool_voice" color="#1E09DE" style="transform:scale(0.7)" @change="changeBoosVoice" :data-id="item.id"/>
  29. <text class="font_2">电话语音</text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="flex-col justify-start items-center text-wrapper" @click="deleteById(item.id)"><text class="text_4">删除</text></view>
  34. </view>
  35. <!-- <button style="width: 100%;margin-top: 10upx" class="flex-row justify-center items-center section_7 space-x-10" open-type="share" @click="clickTz(0)">-->
  36. <!-- <image class="image_7" src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/649415135a7e3f0310661c1e/649415b654fe0000116ae544/16874414496441492308.png"/>-->
  37. <!-- <text class="text_8">添加推送亲友</text>-->
  38. <!-- </button>-->
  39. <view class="flex-row justify-center items-center section_7 space-x-10" @click="modalName ='DialogModal'">
  40. <image class="image_7" src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/649415135a7e3f0310661c1e/649415b654fe0000116ae544/16874414496441492308.png"/>
  41. <text class="text_8">添加推送亲友</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view v-else :style="tableData.length === 0 || tableData.length < 4 ? 'height:100%':''" class="flex-col justify-start section">
  48. <view class="flex-col section_2 space-y-421">
  49. <view class="flex-col">
  50. <text class="self-start font_1 text_2">共享用户</text>
  51. <view class="flex-col group_3 space-y-10">
  52. <view class="flex-row justify-between items-center section_6" v-for="(item, index) in tableData" :key="index">
  53. <view class="flex-row">
  54. <image v-if="item.face === null || item.face === ''" class="image_6" src="http://wdklmall.oss-cn-shenzhen.aliyuncs.com/mallgoods/goods/7F70B5FF967F44BC97BD7CD8786A70B4.png"/>
  55. <image v-else class="image_6" :src="item.face"/>
  56. <view class="flex-col items-start group_4 space-y-10">
  57. <text class="font_1 text_3">{{ item.nickname }}</text>
  58. <text class="text_5">{{ item.mobile }}</text>
  59. <text class="text_6 text_7">{{ formatTime(item.create_time) }}</text>
  60. </view>
  61. </view>
  62. <view class="flex-col justify-start">
  63. <view class="text-wrapper2 bg-button margin-bottom">
  64. <text class="text_4" @click="lookReport(item.union_id, item.friend_id)">查看</text>
  65. </view>
  66. <view class="text-wrapper2 bg-button2 margin-top-xl">
  67. <text class="text_4" @click="deleteById(item.id)">取消</text>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="flex-row justify-center items-center section_7 space-x-10" @click="modalName ='DialogModal'">
  72. <image class="image_7" src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/649415135a7e3f0310661c1e/649415b654fe0000116ae544/16874414496441492308.png"/>
  73. <text class="text_8">新增可看亲友</text>
  74. </view>
  75. <!-- <button style="width: 100%;margin-top: 10upx" class="flex-row justify-center items-center section_7 space-x-10" open-type="share" @click="clickTz(1)">-->
  76. <!-- <image class="image_7" src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/649415135a7e3f0310661c1e/649415b654fe0000116ae544/16874414496441492308.png"/>-->
  77. <!-- <text class="text_8">新增可看亲友</text>-->
  78. <!-- </button>-->
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="cu-modal" :class="modalName ==='DialogModal'?'show':''">
  85. <view class="cu-dialog">
  86. <view class="cu-bar bg-white justify-end">
  87. <view style="color: black" class="content">{{ tabCur === 2 ? '添加推送亲友' : '申请查看亲友'}}</view>
  88. <view class="action" @tap="hideModal">
  89. <text class="cuIcon-close text-red"></text>
  90. </view>
  91. </view>
  92. <view v-if="tabCur !== 2" class="padding-xl">
  93. <input @focus="onfoucs" @blur="onblur" v-model="searchPhone" placeholder="请输入对方手机号" name="input" />
  94. </view>
  95. <view v-else class="padding-xl text-sm">
  96. <!-- <text class="text-red text-df">提示:</text><br/>-->
  97. <text><text class="text-df">绑定自己:</text>自己的电话可以接到报警短信和<text class="text-red">075533318520</text>打来的报警电话</text><br/>
  98. <text><text class="text-df">微信分享:</text>朋友的电话可以接到报警短信和<text class="text-red">075533318520</text>打来的报警电话</text>
  99. </view>
  100. <view class="cu-bar bg-white justify-end">
  101. <view v-if="tabCur ===2" class="action">
  102. <button class="cu-btn line-green text-green" @tap="hideModal">取消</button>
  103. <button class="cu-btn bg-blue margin-left" @tap="addLookOwn">绑定自己</button>
  104. <button class="cu-btn bg-green margin-left" open-type="share" @click="clickTz(0)"><text class="cuIcon-weixin"></text>微信分享</button>
  105. </view>
  106. <view v-else class="action">
  107. <button class="cu-btn line-green text-green" @tap="hideModal">取消</button>
  108. <button class="cu-btn bg-blue margin-left" @tap="addLook">申请查看</button>
  109. <!-- <button class="cu-btn bg-green margin-left" open-type="share" @click="clickTz(0)"><text class="cuIcon-weixin"></text>微信分享</button>-->
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </scroll-view>
  116. </template>
  117. <script>
  118. import Storage from '@/utils/storage'
  119. import { unixToDate } from '@/ui-utils/Foundation'
  120. import * as API_vitalSignsLook from '@/api/vitalSignsLook'
  121. export default {
  122. data() {
  123. return {
  124. page_size: 20,
  125. page_no: 1,
  126. tableData: [],
  127. finishedLoad: false,
  128. uid: '',
  129. modalName: false,
  130. searchPhone: '',
  131. tabCur: 2,
  132. title: '添加推送亲友',
  133. bottomVal: '',
  134. sysScroll: true
  135. }
  136. },
  137. onShow() {
  138. this.uid = Storage.getItem('uid')
  139. if (this.uid) {
  140. this.sx()
  141. this.userInfo = Storage.getItem('userInfo')
  142. }
  143. },
  144. onPullDownRefresh() {
  145. this.sx()
  146. },
  147. onReachBottom() {
  148. if (!this.finishedLoad) {
  149. this.page_no += 1;
  150. this.GET_MemberList()
  151. }
  152. },
  153. methods: {
  154. onfoucs() {
  155. this.sysScroll = false
  156. },
  157. onblur() {
  158. this.sysScroll = true
  159. },
  160. sx() {
  161. this.page_no = 1
  162. this.finishedLoad = false
  163. this.tableData = []
  164. this.GET_MemberList()
  165. },
  166. /** 加载用户列表 */
  167. GET_MemberList() {
  168. const params = {
  169. page_no: this.page_no,
  170. page_size: this.page_size,
  171. }
  172. if (this.tabCur === 1) {
  173. params.fixedCondition = ' ccll.status=1 and ccll.member_id=' + this.uid + ' and ccll.friend_id = em.member_id'
  174. } else if (this.tabCur === 2) {
  175. params.fixedCondition = ' ccll.status=1 and ccll.friend_id=' + this.uid + ' and ccll.member_id = em.member_id'
  176. }
  177. let _this = this
  178. API_vitalSignsLook.getList(params).then(res => {
  179. console.log('res====', res)
  180. if (res.data.length > 0) {
  181. _this.tableData.push(...res.data);
  182. } else {
  183. _this.finishedLoad = true;
  184. }
  185. }).catch(() => {
  186. _this.loading = false
  187. })
  188. },
  189. back() {
  190. uni.navigateBack()
  191. },
  192. formatTime(value) {
  193. return unixToDate(value, '')
  194. },
  195. deleteById(id) {
  196. let _this = this
  197. uni.showModal({
  198. title: '警告',
  199. content: this.tabCur === 2 ? '删除操作后该亲友将不再接收预警消息,是否删除?' : '取消后不能再查看该用户睡眠报告,是否取消?',
  200. success: function (res) {
  201. if (res.confirm) {
  202. API_vitalSignsLook.deleteLogLook(id).then(
  203. res => {
  204. _this.sx()
  205. uni.showToast({
  206. title: '已删除!'
  207. })
  208. }
  209. )
  210. }
  211. }
  212. })
  213. },
  214. hideModal(e) {
  215. this.modalName = null
  216. },
  217. addLook() {
  218. if (this.searchPhone === '') {
  219. uni.showModal({
  220. content: '请输入对方手机号',
  221. showCancel: false
  222. })
  223. return
  224. }
  225. let params = {
  226. member_id: this.uid,
  227. type: 1,
  228. add_member_id: this.uid,
  229. status: 1,
  230. phone: this.searchPhone
  231. }
  232. const _this = this
  233. API_vitalSignsLook.addByMobile(params).then(res => {
  234. if (!res.success) {
  235. uni.showModal({
  236. content: res.message,
  237. showCancel: false
  238. })
  239. } else {
  240. uni.showToast({
  241. title: '操作成功',
  242. icon: 'none'
  243. })
  244. _this.modalName = null
  245. _this.searchPhone = ''
  246. _this.sx()
  247. }
  248. })
  249. },
  250. addLookOwn() {
  251. let index = this.tableData.findIndex( t => t.member_id === this.uid)
  252. if (index !== -1) {
  253. uni.showModal({
  254. content: '您已经绑定自己了',
  255. showCancel: false
  256. })
  257. return
  258. }
  259. let params = {
  260. memberId: this.uid,
  261. type: 0,
  262. bool_sms: 1,
  263. bool_voice: 1
  264. }
  265. API_vitalSignsLook.addByShare(params).then(res => {
  266. uni.showToast({
  267. title: '操作成功',
  268. icon: 'none'
  269. })
  270. this.modalName = null
  271. this.searchPhone = ''
  272. this.sx()
  273. })
  274. },
  275. tabSelect(type) {
  276. this.tabCur = type
  277. this.sx()
  278. },
  279. changeBoosSms(e) {
  280. console.log('e==', e)
  281. const data = {
  282. bool_sms: e.detail.value
  283. }
  284. this.API_update(data, e.currentTarget.dataset.id)
  285. },
  286. changeBoosVoice(e) {
  287. console.log('e==', e)
  288. const data = {
  289. bool_voice: e.detail.value
  290. }
  291. this.API_update(data, e.currentTarget.dataset.id)
  292. },
  293. async API_update(data, id) {
  294. console.log(data, id)
  295. await API_vitalSignsLook.editLogLook(data, id)
  296. },
  297. clickTz(type) {
  298. this.modalName = false
  299. this.lx = type
  300. },
  301. lookReport(unionId, uid) {
  302. uni.navigateTo({
  303. url: '/pages/log/report/friendRealTime?unionId=' + unionId + '&uid=' + uid
  304. })
  305. }
  306. },
  307. onShareAppMessage(e) {
  308. wx.showShareMenu({withShareTicket: true})
  309. let path = '/pages/tabBar/home?type=VITAL_SHARE&no='+this.uid+'&lx='+this.lx
  310. let title = ''
  311. if (this.lx === 0) {
  312. title = '你的亲友'+this.userInfo.nickname+'邀请您查看他的体征数据,互帮互爱,呵护健康!'
  313. } else {
  314. title = '你的亲友'+this.userInfo.nickname+'推荐你使用守护之影小程序,构筑自己的关爱互联圈,从此健康更有保障!'
  315. }
  316. let _this = this
  317. return {
  318. title: title,
  319. path: path,
  320. success: res => { // 转发成功 则关闭弹框 可获取转发信息
  321. _this.isShow = false
  322. }
  323. }
  324. }
  325. }
  326. </script>
  327. <style lang="scss" scoped>
  328. .page {
  329. //background-color: #000000;
  330. width: 100%;
  331. overflow-y: auto;
  332. overflow-x: hidden;
  333. height: 100%;
  334. background-image: url("http://wdklmall.oss-cn-shenzhen.aliyuncs.com/mallgoods/goods/2E8800F59CE14717A09884B811B3C608.png");
  335. background-size: cover ;
  336. background-attachment: fixed ;
  337. background-position: center center;
  338. .section {
  339. background-image: linear-gradient(180deg, rgba(86, 86, 217, 0.95) 0%, #1dbff79c 100%);
  340. padding-bottom: 50upx;
  341. .section_2 {
  342. .font_1 {
  343. font-size: 1.13rem;
  344. font-family: PingFangSC;
  345. line-height: 1.06rem;
  346. color: #ffffff;
  347. }
  348. .text_2 {
  349. margin-left: 1.25rem;
  350. margin-top: 1.38rem;
  351. }
  352. .group_3 {
  353. margin-top: 0.88rem;
  354. padding: 0 1.25rem;
  355. .section_6 {
  356. padding: 0.94rem 0 0.94rem 0.94rem;
  357. background-color: #ffffff33;
  358. border-radius: 1rem;
  359. .image_6 {
  360. border-radius: 50%;
  361. width: 4rem;
  362. height: 4rem;
  363. }
  364. .group_4 {
  365. margin: 0.25rem 0 0.25rem 1.25rem;
  366. .text_3 {
  367. line-height: 1.03rem;
  368. }
  369. .text_5 {
  370. color: #ffffff;
  371. font-size: 0.88rem;
  372. font-family: PingFangSC;
  373. line-height: 0.63rem;
  374. }
  375. .text_7 {
  376. color: #ffffff;
  377. font-size: 0.63rem;
  378. font-family: PingFangSC;
  379. line-height: 0.47rem;
  380. }
  381. }
  382. .text-wrapper {
  383. padding: 0.25rem 0;
  384. background-image: linear-gradient(90deg, #2c3ff2 0%, #1e09de 100%);
  385. border-radius: 6.25rem 0px 0px 6.25rem;
  386. width: 2.75rem;
  387. height: 1.50rem;
  388. text-align: center;
  389. }
  390. .text-wrapper2 {
  391. border-radius: 6.25rem 0px 0px 6.25rem;
  392. width: 2.75rem;
  393. height: 1.50rem;
  394. text-align: center;
  395. }
  396. .bg-button {
  397. background-image: linear-gradient(90deg, #2c3ff2 0%, #1e09de 100%);
  398. }
  399. .bg-button2 {
  400. background-image: linear-gradient(90deg, #339ce2 0%, #077bba 100%);
  401. }
  402. }
  403. .section_7 {
  404. padding: 2.13rem 0;
  405. background-color: #ffffff33;
  406. border-radius: 1rem;
  407. .image_7 {
  408. width: 1.5rem;
  409. height: 1.5rem;
  410. }
  411. .text_8 {
  412. color: #ffffff;
  413. font-size: 1.5rem;
  414. font-family: PingFangSC;
  415. line-height: 1.41rem;
  416. }
  417. }
  418. .space-x-10 {
  419. & > view:not(:first-child),
  420. & > text:not(:first-child),
  421. & > image:not(:first-child) {
  422. margin-left: 0.63rem;
  423. }
  424. }
  425. }
  426. .space-y-10 {
  427. & > view:not(:first-child),
  428. & > text:not(:first-child),
  429. & > image:not(:first-child) {
  430. margin-top: 0.63rem;
  431. }
  432. }
  433. .text_6 {
  434. opacity: 0.5;
  435. }
  436. }
  437. .space-y-421 {
  438. & > view:not(:first-child),
  439. & > text:not(:first-child),
  440. & > image:not(:first-child) {
  441. margin-top: 5rem;
  442. }
  443. }
  444. }
  445. .text_4 {
  446. color: #ffffff;
  447. font-size: 0.75rem;
  448. font-family: PingFangSC;
  449. //line-height: 0.69rem;
  450. padding-bottom: 0.25rem;
  451. }
  452. }
  453. </style>