index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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" @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: true
  69. },
  70. {
  71. id: 'DJZX',
  72. icon: 'dianjian',
  73. color: '#ff8b3e',
  74. name: '点检中心',
  75. url: '/pages/spotCheckCenter/spotChecking',
  76. target: 'page',
  77. auth: true
  78. },
  79. {
  80. id: 'XCXD',
  81. icon: 'xianchangjiancha',
  82. color: '#00aa7f',
  83. name: '现场巡店',
  84. url: '/pages/siteInspection/siteInspection',
  85. target: 'page',
  86. auth: true
  87. },
  88. {
  89. id: 'XDJL',
  90. icon: 'tubiaokuwenjian-gengxin-',
  91. color: '#55aaff',
  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. viewToDo(item){
  175. uni.navigateTo({
  176. url: "/pages/toDoList/backlogDetail?id="+item.id
  177. })
  178. },
  179. }
  180. };
  181. </script>
  182. <style lang="scss">
  183. .content {
  184. .top-ad-swiper {
  185. height: 340upx;
  186. }
  187. .swiper-item-imgse {
  188. width: 750upx;
  189. height: 340upx;
  190. }
  191. .panel-box {
  192. .panel-title {
  193. display: flex;
  194. align-items: center;
  195. padding:20upx 25upx;
  196. border-bottom: 2upx solid #eee;
  197. .texts {
  198. font-size: 28upx;
  199. flex-grow: 1;
  200. padding-left: 15upx;
  201. }
  202. .btns {
  203. font-size: 24upx;
  204. color: #999;
  205. }
  206. }
  207. .panel-body {
  208. padding: 20upx 0;
  209. .nodata {
  210. text-align: center;
  211. font-size: 24upx;
  212. width: 100%;
  213. color: #999999;
  214. padding: 30upx 0;
  215. }
  216. }
  217. }
  218. .order-list {
  219. >div {
  220. display: flex;
  221. align-items: center;
  222. font-size: 30upx;
  223. padding: 15upx 0;
  224. span {
  225. flex-grow: 1;
  226. text-align: center;
  227. color: #666;
  228. width: 33.3%;
  229. }
  230. span.PENDING{
  231. color: #ff736e;
  232. }
  233. span.EXPIRED{
  234. color: #999;
  235. }
  236. span.FINISHED{
  237. color: #bbec82;
  238. }
  239. }
  240. }
  241. }
  242. </style>