videoShopTour.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="videoShopTour-wrap">
  3. <!-- 搜索方式 -->
  4. <u-grid :col="2" class="search-type-con" hover-class="none">
  5. <u-grid-item class="search-module" @click="goSearch">
  6. <u-icon class="search-icon" name="xundianguanli" custom-prefix="xd-icon" size="80" color="#2b85e4"></u-icon>
  7. <view class="search-txt">按门店名称查询</view>
  8. </u-grid-item>
  9. <u-grid-item class="search-module" @click="goOrgSearch">
  10. <u-icon class="search-icon" name="zuzhijigou" custom-prefix="xd-icon" size="80" color="#19be6b"></u-icon>
  11. <view class="search-txt">按组织机构查询</view>
  12. </u-grid-item>
  13. </u-grid>
  14. <!-- 门店列表 -->
  15. <view class="list-con">
  16. <view class="list-tit">门店列表</view>
  17. <!-- 列表数据 -->
  18. <scroll-view class="listData-con" scroll-y>
  19. <view class="listData-item" v-for="(item, index) in list" :key="item.id" @click="goPage(item)">
  20. <view class="listData-item-l">
  21. <u-icon class="listData-item-l-icon" name="mendian" custom-prefix="xd-icon" size="40" color="#888"></u-icon>
  22. <text class="listData-item-l-name">{{item.name}}</text>
  23. </view>
  24. <view class="listData-item-r">
  25. <u-icon class="listData-item-r-icon" name="icon-xian-11" custom-prefix="xd-icon" size="24" color="#2b85e4"></u-icon>
  26. </view>
  27. </view>
  28. <u-empty :text="noDataText" img-width="120" v-if="list.length == 0 && status != 'loading'" :margin-top="220" style="padding-bottom: 120px;" mode="list"></u-empty>
  29. </scroll-view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import { clzConfirm } from '@/libs/tools.js'
  35. import { findStoreList } from '@/api/store.js'
  36. import { queryCurrentTaskUsing } from '@/api/task.js'
  37. export default{
  38. data(){
  39. return{
  40. noDataText: '暂无数据', // 数据异常提示
  41. status: 'loadmore', // 加载中状态
  42. list: [], // 数据列表
  43. }
  44. },
  45. onLoad() {
  46. this.init()
  47. },
  48. methods: {
  49. // 初始
  50. init(){
  51. this.status = 'loading'
  52. // 获取门店列表
  53. findStoreList({}).then(res => {
  54. console.log(res)
  55. if(res.status == 200){
  56. this.list = res.data || []
  57. this.noDataText = '暂无数据' // 有列表数据时不显示,因此只用默认设置为无数据时所需显示的'暂无数据'即可
  58. }else{
  59. this.list = []
  60. this.noDataText = res.message
  61. }
  62. this.status = 'loadmore'
  63. })
  64. },
  65. // 按门店名称查询
  66. goSearch(){
  67. uni.navigateTo({
  68. url: '/pages/searchPage/searchPage'
  69. })
  70. },
  71. // 按组织机构查询
  72. goOrgSearch(){
  73. uni.navigateTo({
  74. url: '/pages/organization/organization'
  75. })
  76. },
  77. // 开始巡店
  78. goPage(item){
  79. // 校验是否有历史巡店记录
  80. queryCurrentTaskUsing({ storeId: item.id, type:"VIDEO_INSPECTION" }).then(res => {
  81. if(res.status == 200){
  82. if(res.data){ // 为true有历史巡店记录
  83. clzConfirm({
  84. title: '提示',
  85. content: '有进行中的巡店任务,是否继续?',
  86. confirmText: '继续巡店',
  87. cancelText: '重新开始',
  88. buttons: ['继续巡店','重新开始'],
  89. success: function (result) {
  90. console.log(result.index)
  91. if (result.confirm || result.index==0) { // 继续巡店
  92. uni.navigateTo({
  93. url: '/pages/shopTour/shopTour?storeId=' + item.id + '&taskId='+ res.data + '&restart=0&types=video'
  94. })
  95. }else if(result.cancel || result.index==1){ // 重新开始
  96. uni.navigateTo({
  97. url: '/pages/shopTour/shopTour?storeId=' + item.id + '&taskId='+ res.data + '&restart=1&types=video'
  98. })
  99. }
  100. }
  101. })
  102. }else{
  103. uni.navigateTo({
  104. url: '/pages/shopTour/shopTour?storeId=' + item.id + '&types=video'
  105. })
  106. }
  107. }else{
  108. uni.showToast({icon: 'none', title: res.message})
  109. }
  110. })
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. page {
  117. background-color: #f8f8f8;
  118. height: calc(100vh - 44px);
  119. }
  120. .videoShopTour-wrap{
  121. height: 100%;
  122. // 搜索方式
  123. .search-type-con{
  124. .search-module{
  125. .search-txt{
  126. font-size: 26upx;
  127. padding-top: 6upx;
  128. }
  129. }
  130. }
  131. // 门店列表
  132. .list-con{
  133. margin-top: 10upx;
  134. .list-tit{
  135. padding: 20upx 30upx;
  136. border-bottom: 1upx solid #f8f8f8;
  137. }
  138. .listData-con{
  139. padding: 0 30upx;
  140. height: calc(100vh - 165px);
  141. box-sizing: border-box;
  142. .listData-item{
  143. display: flex;
  144. justify-content: space-between;
  145. align-items: center;
  146. padding: 25upx 15upx;
  147. border-bottom: 1px solid #F8F8F8;
  148. background-color: #fff;
  149. &-l{
  150. flex-grow: 1;
  151. padding-right: 10upx;
  152. position: relative;
  153. padding-left: 50upx;
  154. &-icon{
  155. vertical-align: sub;
  156. padding-right: 8upx;
  157. position: absolute;
  158. left: 0;
  159. top: -4upx;
  160. }
  161. }
  162. &-r{
  163. flex-shrink: 0;
  164. }
  165. }
  166. }
  167. }
  168. }
  169. </style>