123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <view class="searchPage-wrap">
-
- <u-navbar :is-back="false" :border-bottom="false" id="navbar">
- <view class="slot-wrap">
- <u-search class="left-icon" :focus="true" shape="square" placeholder="请输入门店名称搜索" v-model="keyword" action-text="取消" @change="change" @search="search" @custom="custom"></u-search>
- </view>
- </u-navbar>
-
- <view class="listData-con">
- <view class="listData-item" v-for="(item, index) in list" :key="index" @click="goPage(item)">
- <view class="listData-item-l">
- <u-icon class="listData-item-l-icon" name="mendian" custom-prefix="xd-icon" size="40" color="#888"></u-icon>
- <text class="listData-item-l-name">{{item.name}}</text>
- </view>
- <view class="listData-item-r">
- <u-icon class="listData-item-r-icon" name="icon-xian-11" custom-prefix="xd-icon" size="24" color="#2b85e4"></u-icon>
- </view>
- </view>
- <u-empty :text="noDataText" img-width="120" v-if="list.length == 0 && status != 'loading'" :margin-top="400" mode="list"></u-empty>
- </view>
- </view>
- </template>
- <script>
- import { clzConfirm } from '@/libs/tools.js'
- import { findStoreList,findStoreVsDevice } from '@/api/store.js'
- import { queryCurrentTaskUsing } from '@/api/task.js'
- export default{
- data(){
- return{
- keyword: '',
- list: [],
- noDataText: '暂无数据',
- status: 'loading',
- }
- },
- methods: {
-
- custom(val){
-
- uni.navigateBack()
- },
-
- change(val){
-
- this.$u.debounce(this.getStoreList, 500)
- },
-
- search(val){
- this.getStoreList()
- },
- getStoreList(){
- this.status = 'loading'
- findStoreList({ name: this.keyword }).then(res => {
- if(res.status == 200){
- this.list = res.data
- this.noDataText = '暂无数据'
- }else{
- this.list = []
- this.noDataText = res.message
- }
- this.status = 'loadmore'
- })
- },
-
- goPage(item){
-
- findStoreVsDevice({storeCode:item.code}).then(res=>{
- if(res.data.length){
-
- this.$u.vuex('vuex_storeVideoList',res.data)
-
- this.queryHasTaskUsing(item)
- }else{
- uni.showToast({
- icon: 'none',
- title: '当前门店没有绑定设备,暂时不能视频巡店'
- })
- }
- })
- },
-
-
- queryHasTaskUsing(item){
- queryCurrentTaskUsing({ storeId: item.id, type: 'VIDEO_INSPECTION' }).then(res => {
- if(res.status == 200){
- if(res.data){
- clzConfirm({
- title: '提示',
- content: '有进行中的巡店任务,是否继续?',
- confirmText: '继续巡店',
- cancelText: '重新开始',
- buttons: ['继续巡店','重新开始'],
- success: function (result) {
- if (result.confirm || result.index==0) {
- uni.redirectTo({
- url: '/pages/shopTour/shopTour?storeId=' + item.id + '&taskId='+ res.data + '&restart=0&types=video'
- })
- }else if(result.cancel || result.index==1){
- uni.redirectTo({
- url: '/pages/shopTour/shopTour?storeId=' + item.id + '&taskId='+ res.data + '&restart=1&types=video'
- })
- }
- }
- })
- }else{
- uni.redirectTo({
- url: '/pages/shopTour/shopTour?storeId=' + item.id + '&types=video'
- })
- }
- }else{
- uni.showToast({icon: 'none', title: res.message})
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background-color: #f8f8f8;
- height: calc(100vh - 44px);
- }
- .searchPage-wrap{
- padding: 0 30upx;
- /* 自定义导航栏样式 */
- .slot-wrap {
- display: flex;
- align-items: center;
- /* 如果您想让slot内容占满整个导航栏的宽度 */
- flex: 1;
- /* 如果您想让slot内容与导航栏左右有空隙 */
- padding: 0 30rpx;
- font-size: 28upx;
- .left-icon {
- flex-grow: 1;
- font-size: 32upx;
- margin-right: 10upx;
- text-align: center;
- }
- .right-icon {
- padding-left: 50upx;
- }
- .uni-icons {
- margin-right: 10upx;
- }
- }
- .listData-con{
- .listData-item{
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20upx 0;
- border-bottom: 1upx dashed #f8f8f8;
- &:active{
- opacity: 0.5;
- }
- &-l{
- flex-grow: 1;
- padding-right: 10upx;
- position: relative;
- padding-left: 50upx;
- &-icon{
- vertical-align: sub;
- padding-right: 8upx;
- position: absolute;
- left: 0;
- top: -4upx;
- }
- }
- &-r{
- flex-shrink: 0;
- }
- }
- }
- }
- </style>
|