index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="content">
  3. <!-- 轮播图 -->
  4. <swiper class="top-ad-swiper" v-if="$hasPermissions('M_homeBanner_mobile')" :indicator-dots="false" :autoplay="true" :interval="5000" :duration="600" :circular="true">
  5. <swiper-item v-for="(item,index) in imageTopList" :key="index">
  6. <div class="swiper-item uni-bg-red">
  7. <!-- <image class="swiper-item-imgse" :fade-show='true' :src="item.photo"></image> -->
  8. <u-image mode="scaleToFill" width="750upx" height="400upx" :src="item.photoPath"></u-image>
  9. </div>
  10. </swiper-item>
  11. </swiper>
  12. <!-- 导航按钮 -->
  13. <div class="nav-items">
  14. <iconItemsList :list="navList"></iconItemsList>
  15. </div>
  16. <u-gap height="10" bg-color="#f8f8f8"></u-gap>
  17. <!-- 待办单 -->
  18. <div class="panel-box" v-if="$hasPermissions('M_homeTodoList_mobile')">
  19. <div class="panel-title">
  20. <span class="texts">待办单</span>
  21. <span v-if="$hasPermissions('M_todoList_mobile')" class="btns" @click="toDoList">更多
  22. <u-icon name="icon-xian-11" custom-prefix="xd-icon" size="24" color="#4eacfe"></u-icon>
  23. </span>
  24. </div>
  25. <div class="panel-body">
  26. <div class="order-list">
  27. <div v-for="item in toDoData" :key="item.id" @click="viewToDo(item)">
  28. <span>{{item.createDate.split(' ')[0]}}</span>
  29. <span>{{item.sourceTypeDictValue}}</span>
  30. <span :class="item.status">{{item.statusDictValue}}</span>
  31. </div>
  32. </div>
  33. <div class="nodata" v-if="toDoData.length==0">{{notoDoDataText}}</div>
  34. </div>
  35. </div>
  36. </view>
  37. </template>
  38. <script>
  39. import iconItemsList from '@/components/icon-items-list/icon-items-list.vue'
  40. import {
  41. bannerList
  42. } from "@/api/banner.js"
  43. import {
  44. getBackLogList
  45. } from '@/api/backLog'
  46. import {
  47. getLookUpDatas
  48. } from "@/api/data.js"
  49. import moment from 'moment'
  50. export default {
  51. components: {
  52. iconItemsList
  53. },
  54. data() {
  55. return {
  56. // 顶部轮播图片
  57. imageTopList: [],
  58. notoDoDataText: '数据加载中,请稍后...',
  59. toDoData: [],
  60. // 快捷导航
  61. navList: [{
  62. id: 'SPXD',
  63. icon: 'xundian',
  64. color: '#00aaff',
  65. name: '视频巡店',
  66. url: '/pages/videoShopTour/videoShopTour',
  67. target: 'page',
  68. auth: this.$hasPermissions("M_videoTour_mobile")
  69. },
  70. {
  71. id: 'DJZX',
  72. icon: 'dianjian',
  73. color: '#ff8b3e',
  74. name: '点检中心',
  75. url: '/pages/spotCheckCenter/spotChecking',
  76. target: 'page',
  77. auth: this.$hasPermissions("M_spotCheck_list_mobile")
  78. },
  79. {
  80. id: 'XCXD',
  81. icon: 'xianchangqiandao',
  82. color: '#00aa7f',
  83. name: '现场巡店',
  84. url: '/pages/siteInspection/siteInspection',
  85. target: 'page',
  86. auth: this.$hasPermissions("M_siteInspection_mobile")
  87. },
  88. {
  89. id: 'XDJL',
  90. icon: 'tubiaokuwenjian-gengxin-',
  91. color: '#55aaff',
  92. name: '巡店记录',
  93. url: '/pages/shopTourRecord/shopTourRecord',
  94. target: 'page',
  95. auth: this.$hasPermissions("M_shopTourRecord_mobile")
  96. }
  97. ],
  98. };
  99. },
  100. onLoad() {
  101. // 获取周
  102. this.getLookUpList('WEEK', 'vuex_weeks');
  103. // 获取点检任务状态
  104. this.getLookUpList('POINT_TASK_STATUS', 'vuex_spotCheckStatus')
  105. // 获取巡店任务状态
  106. this.getLookUpList('TASK_STATUS','vuex_taskStatus')
  107. },
  108. onShow() {
  109. if(this.$hasPermissions('M_homeBanner_mobile')){
  110. this.getBanner('HOME_TOP')
  111. }
  112. if(this.$hasPermissions('M_homeTodoList_mobile')){
  113. this.gettoDoData()
  114. }
  115. },
  116. methods: {
  117. // 或某一项字典列表,参数code
  118. getLookUpList(code, vuexKey) {
  119. getLookUpDatas({
  120. type: code
  121. }).then(res => {
  122. if (res.status == 200) {
  123. this.$store.state[vuexKey] = res.data || [];
  124. }
  125. });
  126. },
  127. openVideo() {
  128. uni.navigateTo({
  129. url: "/pages/shopTour/shopTour"
  130. })
  131. },
  132. // 消息提示
  133. showTotast(title) {
  134. uni.showToast({
  135. icon: 'none',
  136. title: title
  137. })
  138. },
  139. // 获取顶部与中部轮播图片
  140. getBanner() {
  141. bannerList({
  142. position: 'HOME_TOP',
  143. bannerType: 'app'
  144. }).then(res => {
  145. if (res.status == 200) {
  146. this.imageTopList = res.data || []
  147. }
  148. })
  149. },
  150. // 获取待办单
  151. gettoDoData() {
  152. let _this = this
  153. let toDoData = {
  154. pageNo: 1,
  155. pageSize: 10,
  156. queryLabel: 'ALL',
  157. // endDate: moment().format('YYYY-MM-DD'),
  158. // beginDate: moment().subtract(7, 'days').format('YYYY-MM-DD')
  159. }
  160. getBackLogList(toDoData).then(res => {
  161. console.log(res)
  162. if (res.status == 200) {
  163. let data = res.data.list
  164. if (data.length) {
  165. _this.toDoData = data.slice(0, 10)
  166. } else {
  167. _this.toDoData = []
  168. _this.notoDoDataText = '暂无数据'
  169. }
  170. } else {
  171. this.showTotast(res.message ? res.message : '网络似乎出错了,请稍后再试')
  172. this.notoDoDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  173. }
  174. })
  175. },
  176. // 更多待办
  177. toDoList() {
  178. uni.navigateTo({
  179. url: '/pages/toDoList/toDoList'
  180. })
  181. },
  182. // 详细页
  183. viewToDo(item){
  184. uni.navigateTo({
  185. url: "/pages/toDoList/backlogDetail?id="+item.id
  186. })
  187. },
  188. }
  189. };
  190. </script>
  191. <style lang="scss">
  192. .content {
  193. .top-ad-swiper {
  194. height: 340upx;
  195. }
  196. .swiper-item-imgse {
  197. width: 750upx;
  198. height: 340upx;
  199. }
  200. .panel-box {
  201. .panel-title {
  202. display: flex;
  203. align-items: center;
  204. padding:20upx 25upx;
  205. border-bottom: 2upx solid #eee;
  206. .texts {
  207. font-size: 28upx;
  208. flex-grow: 1;
  209. padding-left: 15upx;
  210. }
  211. .btns {
  212. font-size: 24upx;
  213. color: #999;
  214. }
  215. }
  216. .panel-body {
  217. padding: 20upx 0;
  218. .nodata {
  219. text-align: center;
  220. font-size: 24upx;
  221. width: 100%;
  222. color: #999999;
  223. padding: 30upx 0;
  224. }
  225. }
  226. }
  227. .order-list {
  228. >div {
  229. display: flex;
  230. align-items: center;
  231. font-size: 30upx;
  232. padding: 15upx 40upx;
  233. justify-content: space-evenly;
  234. span {
  235. flex-grow: 1;
  236. color: #666;
  237. width: 30.3%;
  238. &:last-child{
  239. width: 10%;
  240. }
  241. }
  242. span.CHECK_PENDING{
  243. color: #ffaa00;
  244. }
  245. span.PENDING{
  246. color: #ff736e;
  247. }
  248. span.EXPIRED{
  249. color: #999;
  250. }
  251. span.FINISHED{
  252. color: #10c71e;
  253. }
  254. }
  255. }
  256. }
  257. </style>