doc.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  5. :up="upOption">
  6. <u-swipe-action>
  7. <view class="form-swipe mb20" v-for="(item,index) in dataList" :key="index">
  8. <u-swipe-action-item :options="options" @click="cancel(item,index)" :name="index"
  9. :ref="'swipeAction' + index">
  10. <view class="item" @click="showDetail(item)">
  11. <view class="user-info">
  12. <view class="user-top">
  13. <view class="user-left">
  14. <image :src="item.avatar==null?maleurl:item.avatar" class="w112 h112"></image>
  15. <view class="ml32">
  16. <view class="name">{{item.username!==null?item.username:'微信用户'}}</view>
  17. <view class="age-box" :style="{'background-color':item.sex==0?'#EBF8FF':'#FCF0E7'}">
  18. <u-icon :color="item.sex==0?'#008FD3':'#FF5030'" :name="item.sex==0?'man':'woman'"></u-icon>
  19. <view class="age">{{utils.getAge(item.birthdate)}}岁</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="user-phone">{{utils.parsePhone(item.phone)}}</view>
  24. </view>
  25. <view class="user-bottom">
  26. <view class="btn" @click.stop="toBuy(item)">购买信息</view>
  27. <view class="btn" @click.stop="toUser(item)">基本信息</view>
  28. <view class="btn" @click.stop="toDoc(item)">健康档案</view>
  29. </view>
  30. </view>
  31. </view>
  32. </u-swipe-action-item>
  33. </view>
  34. </u-swipe-action>
  35. <view class="h150"></view>
  36. </mescroll-body>
  37. <!-- <view v-if="docs.length == 0" class="no-data-box" @click="getMyDocList()">
  38. <image src="https://user.test.ylrztop.com/images/empty_icon.png" mode="aspectFit"></image>
  39. <view class="empty-title">暂无数据</view>
  40. </view> -->
  41. </view>
  42. <view class="btn-box">
  43. <view class="sub-btn" @click="addDoc">
  44. <image src="/static/images/health/nav_add_icon24.png" class="w48 h48"></image>
  45. <text>创建用户信息</text>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import {getInfoList,deleteInfo} from '@/api/health.js'
  52. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  53. export default {
  54. mixins: [MescrollMixin],
  55. data() {
  56. return {
  57. famaleurl:"/static/images/health/female_profile.png",
  58. maleurl:"/static/images/health/my_heads.png",
  59. dataList:[
  60. // {userName:'西航宇',sex:1,birthday:'1990-01-01',phone:'16666666666'},
  61. // {userName:'蓝西',sex:2,birthday:'1990-06-01',phone:'1888888888'},
  62. // {userName:'西航宇',sex:1,birthday:'1993-01-01',phone:'16666666666'},
  63. // {userName:'蓝西',sex:2,birthday:'1994-06-01',phone:'1888888888'},
  64. // {userName:'蓝西',sex:2,birthday:'1994-06-01',phone:'1888888888'}
  65. ],
  66. options: [{
  67. text: '删除',
  68. style: {
  69. backgroundColor: '#FF5030'
  70. }
  71. }],
  72. mescroll: null,
  73. // 上拉加载的配置
  74. upOption: {
  75. onScroll: true,
  76. use: true, // 是否启用上拉加载; 默认true
  77. page: {
  78. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  79. size: 10 // 每页数据的数量,默认10
  80. },
  81. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  82. empty: {
  83. icon: 'https://user.test.ylrztop.com/images/empty_icon.png',
  84. tip: '暂无数据'
  85. }
  86. },
  87. }
  88. },
  89. onLoad(options) {
  90. this.companyId=options.companyId;
  91. this.companyUserId=options.companyUserId;
  92. uni.$on('refreshDoc', () => {
  93. this.mescroll.resetUpScroll()
  94. // this.getMyDocList()
  95. })
  96. },
  97. methods: {
  98. navgetTo(url){
  99. uni.navigateTo({
  100. url: url
  101. })
  102. },
  103. toBuy(item){
  104. uni.navigateTo({
  105. url: '/pages_company/buyOrder?userId='+item.userId+'&companyUserId='+this.companyUserId
  106. })
  107. },
  108. toUser(item){
  109. uni.navigateTo({
  110. url: '/pages_company/addUser?type=edit&userId='+item.userId+'&companyUserId='+this.companyUserId
  111. })
  112. },
  113. toDoc(item){
  114. uni.navigateTo({
  115. url: '/pages_company/addDoc?userId='+item.userId+'&companyUserId='+this.companyUserId
  116. })
  117. },
  118. showDetail(item){
  119. uni.navigateTo({
  120. url: '/pages_company/clientDetail?userId='+item.userId+"&companyUserId="+this.companyUserId
  121. })
  122. },
  123. editDoc(item){
  124. uni.navigateTo({
  125. url: './addDoc?type=edit&docId='+item.docId
  126. })
  127. },
  128. cancel(item, index) {
  129. var that = this;
  130. let test = 'swipeAction' + index
  131. uni.showModal({
  132. title: '提示',
  133. content: '确定删除用户信息吗',
  134. success: function(res) {
  135. if (res.confirm) {
  136. var data = {
  137. userId:item.userId
  138. };
  139. deleteInfo(data).then(res => {
  140. if (res.code == 200) {
  141. uni.showToast({
  142. icon: 'success',
  143. title: '操作成功',
  144. });
  145. that.$refs[test][0].closeHandler()
  146. that.mescroll.resetUpScroll()
  147. } else {
  148. uni.showToast({
  149. icon: 'none',
  150. title: res.msg,
  151. });
  152. }
  153. });
  154. } else if (res.cancel) {
  155. that.$refs[test][0].closeHandler()
  156. }
  157. }
  158. });
  159. },
  160. mescrollInit(mescroll) {
  161. this.mescroll = mescroll;
  162. },
  163. /*下拉刷新的回调 */
  164. downCallback(mescroll) {
  165. mescroll.resetUpScroll()
  166. },
  167. upCallback(page) {
  168. //联网加载数据
  169. var that = this;
  170. var data = {
  171. // companyUserId:this.companyUserId,
  172. pageNum: page.num,
  173. pageSize: page.size
  174. };
  175. getInfoList(data).then(res => {
  176. if (res.code == 200) {
  177. //设置列表数据
  178. if (page.num == 1) {
  179. that.dataList = res.data.list;
  180. } else {
  181. that.dataList = that.dataList.concat(res.data.list);
  182. }
  183. that.mescroll.endBySize(res.data.list.length, res.data.total);
  184. } else {
  185. uni.showToast({
  186. icon: 'none',
  187. title: "请求失败",
  188. });
  189. that.dataList = null;
  190. that.mescroll.endErr();
  191. }
  192. });
  193. },
  194. addDoc() {
  195. uni.navigateTo({
  196. url: '/pages_company/addUser?type=add&companyId='+this.companyId+"&companyUserId="+this.companyUserId
  197. })
  198. }
  199. }
  200. }
  201. </script>
  202. <style lang="scss">
  203. page{
  204. height: 100%;
  205. }
  206. .content{
  207. height: 100%;
  208. display: flex;
  209. // flex-direction: column;
  210. // justify-content: space-between;
  211. .inner{
  212. flex: 1;
  213. padding: 20upx 20upx 160upx;
  214. .item{
  215. background: #FFFFFF;
  216. border-radius: 20upx;
  217. margin-bottom: 20upx;
  218. // padding: 40upx 30upx;
  219. padding: 32rpx;
  220. &:last-child{
  221. margin-bottom: 0;
  222. }
  223. .user-info{
  224. .user-top{
  225. display: flex;
  226. align-items: flex-start;
  227. justify-content: space-between;
  228. border-bottom: 1px solid #ECECEC;
  229. padding-bottom: 40rpx;
  230. .user-left{
  231. display: flex;
  232. align-items: center;
  233. justify-content: flex-start;
  234. image{
  235. border-radius: 50%;
  236. }
  237. .name{
  238. font-family: PingFang SC;
  239. font-weight: 500;
  240. font-size: 36rpx;
  241. color: #222426;
  242. text-align: left;
  243. }
  244. .age-box{
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. border-radius: 24rpx 24rpx 24rpx 24rpx;
  249. margin-top: 16rpx;
  250. width: 114rpx;
  251. height: 40rpx;
  252. .age{
  253. font-weight: 400;
  254. font-size: 22rpx;
  255. color: #626468;
  256. line-height: 22rpx;
  257. text-align: left;
  258. }
  259. }
  260. }
  261. .user-phone{
  262. font-family: PingFang SC;
  263. font-weight: 500;
  264. font-size: 28rpx;
  265. color: #222426;
  266. text-align: right;
  267. }
  268. }
  269. .user-bottom{
  270. display: flex;
  271. align-items: center;
  272. justify-content: flex-end;
  273. padding-top: 20rpx;
  274. .btn{
  275. width: 176rpx;
  276. height: 60rpx;
  277. border-radius: 30rpx 30rpx 30rpx 30rpx;
  278. border: 1rpx solid #B2B2B2;
  279. font-size: 24rpx;
  280. color: #222426;
  281. line-height: 60rpx;
  282. text-align: center;
  283. margin-left:16rpx ;
  284. &:last-child{
  285. border: 1rpx solid #008FD3;
  286. color: #008FD3;
  287. }
  288. }
  289. }
  290. .gray-tag{
  291. height: 46upx;
  292. line-height: 46upx;
  293. padding: 0 16upx;
  294. font-size: 24upx;
  295. font-family: PingFang SC;
  296. font-weight: 500;
  297. color: #333333;
  298. background: #F7F7F7;
  299. border-radius: 8upx;
  300. margin-right: 10upx;
  301. }
  302. .blue-tag{
  303. height: 46upx;
  304. line-height: 46upx;
  305. padding: 0 16upx;
  306. font-size: 24upx;
  307. font-family: PingFang SC;
  308. font-weight: bold;
  309. color: #4BC9B1;
  310. background: #E2F6F2;
  311. border-radius: 8upx;
  312. }
  313. }
  314. .stage-box{
  315. white-space: nowrap;
  316. overflow: hidden;
  317. text-overflow: ellipsis;
  318. margin-top: 34upx;
  319. .stage{
  320. font-size: 26upx;
  321. font-family: PingFang SC;
  322. font-weight: 500;
  323. color: #111111;
  324. line-height: 1;
  325. }
  326. .stage-text{
  327. font-size: 26upx;
  328. font-family: PingFang SC;
  329. font-weight: 500;
  330. color: #666666;
  331. line-height: 1;
  332. }
  333. }
  334. .progress-box{
  335. margin-top: 18upx;
  336. }
  337. .period{
  338. font-size: 28upx;
  339. font-family: PingFang SC;
  340. font-weight: 500;
  341. color: #999999;
  342. line-height: 1;
  343. margin-top: 40upx;
  344. }
  345. }
  346. }
  347. .btn-box{
  348. z-index: 9999;
  349. width: 100%;
  350. padding: 30upx;
  351. position: fixed;
  352. bottom: 0;
  353. left: 0;
  354. box-sizing: border-box;
  355. // background: #FFFFFF;
  356. .sub-btn{
  357. width: 100%;
  358. height: 88upx;
  359. line-height: 88upx;
  360. text-align: center;
  361. font-size: 30upx;
  362. font-family: PingFang SC;
  363. font-weight: bold;
  364. color: #FFFFFF;
  365. background: #008FD3;
  366. border-radius: 44upx;
  367. display: flex;
  368. align-items: center;
  369. justify-content: center;
  370. image{
  371. margin-right: 16rpx;
  372. }
  373. }
  374. }
  375. }
  376. </style>