index.vue 13 KB

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