index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="content">
  3. <!-- 轮播图 -->
  4. <swiper class="top-ad-swiper" v-show="$hasPermissions('M_homeBanner_mobile')&&imageTopList.length" :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. console.log('onshow')
  110. if(this.$hasPermissions('M_homeBanner_mobile')){
  111. this.getBanner('HOME_TOP')
  112. }
  113. if(this.$hasPermissions('M_homeTodoList_mobile')){
  114. this.gettoDoData()
  115. }
  116. },
  117. methods: {
  118. // 或某一项字典列表,参数code
  119. getLookUpList(code, vuexKey) {
  120. getLookUpDatas({
  121. type: code
  122. }).then(res => {
  123. if (res.status == 200) {
  124. this.$store.state[vuexKey] = res.data || [];
  125. }
  126. });
  127. },
  128. openVideo() {
  129. uni.navigateTo({
  130. url: "/pages/shopTour/shopTour"
  131. })
  132. },
  133. // 消息提示
  134. showTotast(title) {
  135. uni.showToast({
  136. icon: 'none',
  137. title: title
  138. })
  139. },
  140. // 获取顶部与中部轮播图片
  141. getBanner() {
  142. bannerList({
  143. position: 'HOME_TOP',
  144. bannerType: 'app'
  145. }).then(res => {
  146. console.log(res)
  147. if (res.status == 200) {
  148. this.imageTopList = res.data || []
  149. }
  150. })
  151. },
  152. // 获取待办单
  153. gettoDoData() {
  154. let _this = this
  155. let toDoData = {
  156. pageNo: 1,
  157. pageSize: 10,
  158. queryLabel: 'ALL',
  159. // endDate: moment().format('YYYY-MM-DD'),
  160. // beginDate: moment().subtract(7, 'days').format('YYYY-MM-DD')
  161. }
  162. getBackLogList(toDoData).then(res => {
  163. console.log(res)
  164. if (res.status == 200) {
  165. let data = res.data.list
  166. if (data.length) {
  167. _this.toDoData = data.slice(0, 10)
  168. } else {
  169. _this.toDoData = []
  170. _this.notoDoDataText = '暂无数据'
  171. }
  172. } else {
  173. this.showTotast(res.message ? res.message : '网络似乎出错了,请稍后再试')
  174. this.notoDoDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  175. }
  176. })
  177. },
  178. // 更多待办
  179. toDoList() {
  180. uni.navigateTo({
  181. url: '/pages/toDoList/toDoList'
  182. })
  183. },
  184. // 详细页
  185. viewToDo(item){
  186. uni.navigateTo({
  187. url: "/pages/toDoList/backlogDetail?id="+item.id
  188. })
  189. },
  190. }
  191. };
  192. </script>
  193. <style lang="scss">
  194. .content {
  195. .top-ad-swiper {
  196. height: 340upx;
  197. }
  198. .swiper-item-imgse {
  199. width: 750upx;
  200. height: 340upx;
  201. }
  202. .panel-box {
  203. .panel-title {
  204. display: flex;
  205. align-items: center;
  206. padding:20upx 25upx;
  207. border-bottom: 2upx solid #eee;
  208. .texts {
  209. font-size: 28upx;
  210. flex-grow: 1;
  211. padding-left: 15upx;
  212. }
  213. .btns {
  214. font-size: 24upx;
  215. color: #999;
  216. }
  217. }
  218. .panel-body {
  219. padding: 20upx 0;
  220. .nodata {
  221. text-align: center;
  222. font-size: 24upx;
  223. width: 100%;
  224. color: #999999;
  225. padding: 30upx 0;
  226. }
  227. }
  228. }
  229. .order-list {
  230. >div {
  231. display: flex;
  232. align-items: center;
  233. font-size: 30upx;
  234. padding: 15upx 40upx;
  235. justify-content: space-evenly;
  236. span {
  237. flex-grow: 1;
  238. color: #666;
  239. width: 30.3%;
  240. &:last-child{
  241. width: 10%;
  242. }
  243. }
  244. span.CHECK_PENDING{
  245. color: #ffaa00;
  246. }
  247. span.PENDING{
  248. color: #ff736e;
  249. }
  250. span.EXPIRED{
  251. color: #999;
  252. }
  253. span.FINISHED{
  254. color: #10c71e;
  255. }
  256. }
  257. }
  258. }
  259. </style>