index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="content">
  3. <!-- 轮播图 -->
  4. <swiper class="top-ad-swiper" :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">
  19. <div class="panel-title">
  20. <span class="texts">待办单</span>
  21. <span 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">
  28. <span>{{item.createDate.split(' ')[0]}}</span>
  29. <span>{{item.sourceTypeDictValue}}</span>
  30. <span>{{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: true
  69. },
  70. {
  71. id: 'DJZX',
  72. icon: 'dianjian',
  73. color: '#ff5500',
  74. name: '点检中心',
  75. url: '/pages/spotCheckCenter/spotChecking',
  76. target: 'page',
  77. auth: true
  78. },
  79. {
  80. id: 'XCXD',
  81. icon: 'xianchangjiancha',
  82. color: '#00aa00',
  83. name: '现场巡店',
  84. url: '/pages/siteInspection/siteInspection',
  85. target: 'page',
  86. auth: true
  87. },
  88. {
  89. id: 'XDJL',
  90. icon: 'tubiaokuwenjian-gengxin-',
  91. color: '#d0527e',
  92. name: '巡店记录',
  93. url: '/pages/shopTourRecord/shopTourRecord',
  94. target: 'page',
  95. auth: true
  96. }
  97. ],
  98. };
  99. },
  100. onLoad() {
  101. this.getBanner('HOME_TOP')
  102. this.gettoDoData()
  103. // 获取周
  104. this.getLookUpList('WEEK', 'vuex_weeks');
  105. // 获取点检任务状态
  106. this.getLookUpList('POINT_TASK_STATUS', 'vuex_spotCheckStatus')
  107. },
  108. methods: {
  109. // 或某一项字典列表,参数code
  110. getLookUpList(code, vuexKey) {
  111. getLookUpDatas({
  112. type: code
  113. }).then(res => {
  114. if (res.status == 200) {
  115. this.$store.state[vuexKey] = res.data || [];
  116. }
  117. });
  118. },
  119. openVideo() {
  120. uni.navigateTo({
  121. url: "/pages/shopTour/shopTour"
  122. })
  123. },
  124. // 消息提示
  125. showTotast(title) {
  126. uni.showToast({
  127. icon: 'none',
  128. title: title
  129. })
  130. },
  131. // 获取顶部与中部轮播图片
  132. getBanner() {
  133. bannerList({
  134. position: 'HOME_TOP',
  135. bannerType: 'app'
  136. }).then(res => {
  137. if (res.status == 200) {
  138. this.imageTopList = res.data || []
  139. }
  140. })
  141. },
  142. // 获取待办单
  143. gettoDoData() {
  144. let _this = this
  145. let toDoData = {
  146. pageNo: 1,
  147. pageSize: 10,
  148. endDate: moment().format('YYYY-MM-DD'),
  149. beginDate: moment().subtract(7, 'days').format('YYYY-MM-DD')
  150. }
  151. getBackLogList(toDoData).then(res => {
  152. console.log(res)
  153. if (res.status == 200) {
  154. let data = res.data.list
  155. if (data.length) {
  156. _this.toDoData = data.slice(0, 10)
  157. } else {
  158. _this.toDoData = []
  159. _this.notoDoDataText = '暂无数据'
  160. }
  161. } else {
  162. this.showTotast(res.message ? res.message : '网络似乎出错了,请稍后再试')
  163. this.notoDoDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  164. }
  165. })
  166. },
  167. // 更多待办
  168. toDoList() {
  169. uni.navigateTo({
  170. url: '/pages/toDoList/toDoList'
  171. })
  172. }
  173. }
  174. };
  175. </script>
  176. <style lang="scss">
  177. .content {
  178. .top-ad-swiper {
  179. height: 340upx;
  180. }
  181. .swiper-item-imgse {
  182. width: 750upx;
  183. height: 340upx;
  184. }
  185. .panel-box {
  186. .panel-title {
  187. display: flex;
  188. align-items: center;
  189. padding: 20upx 15upx;
  190. border-bottom: 2upx solid #eee;
  191. .texts {
  192. font-size: 28upx;
  193. flex-grow: 1;
  194. padding-left: 15upx;
  195. background: url(/static/pt.png) no-repeat left center;
  196. background-size: auto 80%;
  197. }
  198. .btns {
  199. font-size: 24upx;
  200. color: #999;
  201. }
  202. }
  203. .panel-body {
  204. padding: 20upx 0;
  205. .nodata {
  206. text-align: center;
  207. font-size: 24upx;
  208. width: 100%;
  209. color: #999999;
  210. padding: 30upx 0;
  211. }
  212. }
  213. }
  214. .order-list {
  215. >div {
  216. display: flex;
  217. align-items: center;
  218. font-size: 30upx;
  219. padding: 14upx 0;
  220. span {
  221. flex-grow: 1;
  222. text-align: center;
  223. color: #666;
  224. width: 33.3%;
  225. }
  226. span.daiJs {
  227. color: #ff0000;
  228. }
  229. span.daiWg {
  230. color: #ffaa00;
  231. }
  232. span.yiJs {
  233. color: #5fbe00;
  234. }
  235. }
  236. }
  237. }
  238. </style>