index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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.photo"></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 { bannerList } from "@/api/banner.js"
  41. import { getBackLogList } from '@/api/backLog'
  42. import { getLookUpDatas } from "@/api/data.js"
  43. import moment from 'moment'
  44. export default {
  45. components: {
  46. iconItemsList
  47. },
  48. data() {
  49. return {
  50. // 顶部轮播图片
  51. imageTopList:[],
  52. notoDoDataText: '数据加载中,请稍后...',
  53. toDoData: [],
  54. // 快捷导航
  55. navList: [
  56. {
  57. id: 'SPXD',
  58. icon: 'xundian',
  59. color: '#00aaff',
  60. name: '视频巡店',
  61. url: '/pages/videoShopTour/videoShopTour',
  62. target: 'page',
  63. auth: true
  64. },
  65. {
  66. id: 'DJZX',
  67. icon: 'dianjian',
  68. color: '#ff5500',
  69. name: '点检中心',
  70. url:'/pages/spotCheckCenter/spotChecking',
  71. target: 'page',
  72. auth: true
  73. },
  74. {
  75. id: 'XCXD',
  76. icon: 'xianchangjiancha',
  77. color: '#00aa00',
  78. name: '现场巡店',
  79. url:'/pages/siteInspection/siteInspection',
  80. target: 'page',
  81. auth: true
  82. },
  83. {
  84. id: 'XDJL',
  85. icon: 'tubiaokuwenjian-gengxin-',
  86. color: '#d0527e',
  87. name: '巡店记录',
  88. url:'/pages/shopTourRecord/shopTourRecord',
  89. target: 'page',
  90. auth: true
  91. }
  92. ],
  93. };
  94. },
  95. onLoad() {
  96. this.getBanner('HOME_TOP')
  97. this.gettoDoData()
  98. // 获取周
  99. this.getLookUpList('WEEK', 'vuex_weeks');
  100. // 获取点检任务状态
  101. this.getLookUpList('POINT_TASK_STATUS','vuex_spotCheckStatus')
  102. // 获取巡店任务状态
  103. this.getLookUpList('TASK_STATUS','vuex_taskStatus')
  104. },
  105. methods: {
  106. // 或某一项字典列表,参数code
  107. getLookUpList(code, vuexKey) {
  108. getLookUpDatas({ type: code }).then(res => {
  109. if (res.status == 200) {
  110. this.$store.state[vuexKey] = res.data || [];
  111. }
  112. });
  113. },
  114. openVideo() {
  115. uni.navigateTo({
  116. url:"/pages/shopTour/shopTour"
  117. })
  118. },
  119. // 消息提示
  120. showTotast(title){
  121. uni.showToast({
  122. icon: 'none',
  123. title:title
  124. })
  125. },
  126. // 获取顶部与中部轮播图片
  127. getBanner(position){
  128. bannerList({
  129. position: position,
  130. status : '1',
  131. bannerType: 'App'
  132. }).then(res=>{
  133. if(res.status == 200){
  134. if(position == 'HOME_TOP'){
  135. this.imageTopList=res.data
  136. }
  137. }
  138. }).catch(err=>{
  139. console.log('数据获取失败')
  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>