videoShopTour.vue 4.8 KB

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