list.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class="message-list-page">
  3. <!-- <view class="top-time-box white-wrap">昨天 21:00</view> -->
  4. <view class="list">
  5. <view class="message-item flex" v-for="item in list" :key="item.Id">
  6. <image :src="avatar" mode="aspectFill" style="width: 88rpx;height: 88rpx;"></image>
  7. <view class="message-content">
  8. <view style="color:#666;font-size: 12px;">审批小助手</view>
  9. <view class="message-card white-wrap" @click="handleGoDetail(item)">
  10. <view class="type">{{item.ApprovalInfo.Type}}</view>
  11. <view class="title">{{item.CompanyName}}</view>
  12. <view v-if="item.MessageType===3">
  13. <view class="info">{{item.Content}}</view>
  14. <view class="info">修改时间:{{item.CreateTime|formatTime}}</view>
  15. </view>
  16. <view v-else>
  17. <view class="info">申请销售:{{item.ApprovalInfo.ApplyName}}</view>
  18. <view class="info" v-if="item.statusName==='待审批'">提交时间:{{item.ApprovalInfo.ApplyTime|formatTime}}</view>
  19. <view class="info" v-else>审批时间:{{item.ApprovalInfo.ApprovalTime|formatTime}}</view>
  20. </view>
  21. <image :src="item.statusImg" mode="aspectFill" class="status-img"></image>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {apiMessageList} from '@/api/message.js'
  30. export default {
  31. filters:{
  32. formatTime(e){
  33. return e.replace(/-/g,'.')
  34. }
  35. },
  36. data() {
  37. return {
  38. type: null, //类型对应的数字: 1客户(custome)、2合同(contract)、3用印(seal)
  39. typeName:null,//类型对应的英文 客户(custome)、合同(contract)、用印(seal)
  40. page: 1, //页码
  41. list: [],
  42. finished: false, //是否列表为最后一页
  43. avatar:'',// 头像
  44. }
  45. },
  46. onLoad(options) {
  47. this.initPage(options.type)
  48. this.getList()
  49. },
  50. onPullDownRefresh() {
  51. this.page=1
  52. this.finished=false
  53. this.list=[]
  54. this.getList()
  55. setTimeout(()=>{
  56. uni.stopPullDownRefresh()
  57. },1500)
  58. },
  59. onReachBottom() {
  60. if(this.finished) return
  61. this.page++
  62. this.getList()
  63. },
  64. methods: {
  65. handleGoDetail(e){
  66. if(this.typeName==='custome'){
  67. uni.navigateTo({
  68. url:'/pages-approve/custome/detail?id='+e.CompanyApprovalId
  69. })
  70. }
  71. if(this.typeName==='contract'){
  72. uni.navigateTo({
  73. url:`/pages-approve/contract/detail?ContractApprovalId=0&ContractId=0&ContractApprovalRecordId=${e.CompanyApprovalId}`
  74. })
  75. }
  76. if(this.typeName==='seal'){
  77. uni.navigateTo({
  78. url:`/pages-approve/seal/detail?ContractApprovalId=0&ContractApprovalRecordId=${e.CompanyApprovalId}`
  79. })
  80. }
  81. },
  82. //获取列表数据
  83. async getList() {
  84. const res = await apiMessageList({
  85. SourceType: this.type,
  86. CurrentIndex: this.page
  87. })
  88. if (res.code === 200) {
  89. if(!res.data.List){
  90. this.finished=true
  91. }else{
  92. let arr=res.data.List.map(item=>{
  93. let statusImg='',statusName='';
  94. switch(item.ApprovalStatus){
  95. case 1:
  96. statusImg=require('../static/icon-2.png')
  97. statusName='待审批'
  98. break;
  99. case 2:
  100. statusImg=require('../static/icon-3.png')
  101. statusName='已审批'
  102. break;
  103. case 3:
  104. statusImg=require('../static/icon-4.png')
  105. statusName='已驳回'
  106. break
  107. }
  108. return {
  109. statusImg:statusImg,
  110. statusName:statusName,
  111. ...item
  112. }
  113. })
  114. this.list = [...this.list, ...arr]
  115. }
  116. }
  117. },
  118. // 初始化界面
  119. initPage(type) {
  120. this.typeName=type
  121. let navBarTitle = ''
  122. const _this = this
  123. switch (type) {
  124. case '1':
  125. navBarTitle = '客户待审批'
  126. _this.type = 1
  127. _this.avatar=require('../../static/icon-1.png')
  128. break;
  129. case '2':
  130. navBarTitle = '合同待审批'
  131. _this.type = 2
  132. _this.avatar=require('../../static/icon-2.png')
  133. break;
  134. case '3':
  135. navBarTitle = '用印待审批'
  136. _this.type = 3
  137. _this.avatar=require('../../static/icon-3.png')
  138. break;
  139. }
  140. uni.setNavigationBarTitle({
  141. title: navBarTitle
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss">
  148. .message-list-page {
  149. padding: 20rpx;
  150. }
  151. .top-time-box{
  152. margin-left: auto;
  153. margin-right: auto;
  154. width: 200rpx;
  155. height: 50rpx;
  156. line-height: 50rpx;
  157. font-size: 12px;
  158. text-align: center;
  159. border-radius: 25rpx;
  160. }
  161. .list{
  162. padding: 0 36rpx 0 19rpx;
  163. .message-item{
  164. margin-top: 60rpx;
  165. }
  166. .message-content{
  167. margin-left: 20rpx;
  168. flex: 1;
  169. }
  170. .message-card{
  171. margin-top: 20rpx;
  172. padding: 20rpx;
  173. border: 1px solid #EFEFEF;
  174. box-shadow: 0px 3rpx 12rpx rgba(175, 175, 175, 0.08);
  175. border-radius: 6px;
  176. position: relative;
  177. .type{
  178. color: #FFB005;
  179. font-weight: bold;
  180. &::before{
  181. content: '';
  182. display: inline-block;
  183. width: 28rpx;
  184. height: 28rpx;
  185. background-image: url(../static/icon-1.png);
  186. background-size: cover;
  187. margin-right: 20rpx;
  188. position: relative;
  189. top: 4rpx;
  190. }
  191. }
  192. .title{
  193. font-size: 16px;
  194. font-weight: bold;
  195. margin-top: 20rpx;
  196. }
  197. .info{
  198. margin-top: 20rpx;
  199. }
  200. .status-img{
  201. position: absolute;
  202. top: 0;
  203. right: 0;
  204. width: 145rpx;
  205. height: 145rpx;
  206. }
  207. }
  208. }
  209. </style>