| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <template>
- <view>
- <z-navbar title="搜索" back></z-navbar>
- <view class="search_top flex-n fac fjc">
- <view class="search_top_in flex-n fac">
- <view class="search_top_icon ml-35 mr-20 iconfont iconjuxing5"></view>
- <z-input class="flex-1 mr-35" placeholder="请输入关键字" align="left" v-model="searchText"></z-input>
- </view>
- </view>
- <scroll-view scroll-y class="search_content">
- <view v-if="once" class="flex-w fac">
- <checkbox-group class="mt-20" @change="checkboxAllChange">
- <label class="ml-20" style="font-size: 28rpx;">
- <checkbox value="checkedall" :checked="checkedAll" color="#2d8cf0"
- style="transform:scale(0.7)" />全部
- </label>
- </checkbox-group>
- <checkbox-group class="mt-20" @change="checkboxChange">
- <label v-for="(item,index) in houseTypeList" :key="index" class="ml-20" style="font-size: 28rpx;">
- <checkbox :value="item.houseTypeId" :checked="item.checked" color="#2d8cf0"
- style="transform:scale(0.7)" />{{item.houseTypeName}}
- </label>
- </checkbox-group>
- <z-button class="mt-80" @click="backSearch">确定筛选</z-button>
- </view>
- <view class="search_nocontent" v-if="!once&&list.length==0">
- <image class="search_nocontent_img" mode="widthFix" src="../../static/nocontent.png"></image>
- <view class="search_nocontent_notext">未搜索到相关结果</view>
- </view>
- <view v-else>
- <template v-if="type==0">
- <z-cell arrow v-for="(item,index) in list" :key="index" @click.native="gotoRemind(item.id)">
- <view class="search_item">
- <view class="flex-n fac">
- <view>{{item.customName}}</view>
- <view class="ml-36">{{item.phone}}</view>
- <view class="ml-36">{{item.wantDate}}</view>
- </view>
- <view class="flex-n fac">
- <view class="nowarp">{{item.wantHouseContent}}</view>
- </view>
- </view>
- </z-cell>
- </template>
- <template v-else-if="type==1">
- <z-cell arrow v-for="(item,index) in list" :key="index" @click.native="gotoOrder(item.id)">
- <view class="search_item">
- <view class="flex-n fac">
- <view>{{item.orderDate}}</view>
- <view class="ml-36">{{item.activityBeginTime}}-{{item.activityEndTime}}</view>
- </view>
- <view class="flex-n fac">
- <view class="nowarp">{{item.customName}}</view>
- <view class="ml-20 nowarp">{{item.houseName}}</view>
- <view class="ml-20 line-1">{{item.packageName}}{{item.paycontent}}</view>
- </view>
- </view>
- </z-cell>
- </template>
- <template v-else>
- <z-cell arrow v-for="(item,index) in list" :key="index" @click.native="gotoSettlement(item.id)">
- <view class="search_item">
- <view class="flex-n fac">
- <view>{{item.orderDate}}</view>
- <view class="ml-36">{{item.activityBeginTime}}-{{item.activityEndTime}}</view>
- </view>
- <view class="flex-n fac">
- <view class="nowarp">{{item.customName}}</view>
- <view class="ml-20 nowarp">{{item.houseName}}</view>
- <view class="ml-20 line-1">{{item.packageName}}{{item.paycontent}}</view>
- </view>
- </view>
- </z-cell>
- </template>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- const app = getApp({
- allowDefault: true
- });
- export default {
- data() {
- return {
- searchText: '',
- searchType: 0,
- nodata: false,
- type: 0, //0咨询提醒,1预定提醒,2预定查询
- list: [],
- houseTypeList: [],
- checkedAll: false,
- checkedList: [],
- once: true, //第一次进入
- }
- },
- onLoad(option) {
- this.type = option.type;
- this.gethouseTypeList();
- },
- watch: {
- searchText(newval, oldval) {
- this.once = false;
- if (this.type == 0) {
- this.searchRemind(newval);
- } else if (this.type == 1 || this.type == 2) {
- this.searchOrder(newval);
- this.searchType = 0;
- } else {
- this.searchOrder(newval);
- this.searchType = 1;
- }
- }
- },
- methods: {
- backSearch() {
- if (this.type == 1) {
- var pages = getCurrentPages();
- var prevPage = pages[pages.length - 2]; //上一个页面
- prevPage.$vm.backState = false;
- prevPage.$vm.tabInfo(); //重点$vm
- }
- uni.setStorage({
- key: 'searchField',
- data: this.checkedList
- })
- uni.navigateBack({
- delta: 1
- })
- },
- gethouseTypeList() {
- this.$axios.get("app/house/houseTypeListByStoreId/" + uni.getStorageSync('storeId')).then(res => {
- console.log('场地类型', res)
- this.houseTypeList = res.data.list;
- // if(this.$root.getStorage('checkedCities')){
- // this.checkedList= this.$root.getStorage('checkedCities');
- // }
- uni.getStorage({
- key: 'searchField',
- success: (res) => {
- console.log(res.data)
- this.checkedList = res.data;
- for (var j in this.checkedList) {
- for (var i in this.houseTypeList) {
- var item = this.houseTypeList[i];
- if (item.houseTypeId == this.checkedList[j])
- this.$set(item, 'checked', true)
- }
- }
- }
- })
- }).catch(err => {
- console.log(err)
- })
- },
- checkboxAllChange: function(e) {
- console.log(e.detail.value.length)
- if (e.detail.value.length > 0) {
- for (var i in this.houseTypeList) {
- var item = this.houseTypeList[i];
- this.$set(item, 'checked', true)
- }
- this.checkedAll = true;
- } else {
- for (var i in this.houseTypeList) {
- var item = this.houseTypeList[i];
- this.$set(item, 'checked', false)
- }
- console.log(this.houseTypeList)
- this.checkedAll = false;
- }
- },
- checkboxChange: function(e) {
- this.checkedList = e.detail.value;
- var items = this.houseTypeList,
- values = e.detail.value;
- for (var i = 0, lenI = items.length; i < lenI; ++i) {
- const item = items[i]
- if (values.includes(item.houseTypeId)) {
- this.$set(item, 'checked', true)
- } else {
- this.$set(item, 'checked', false)
- }
- }
- if (e.detail.value.length == this.houseTypeList.length) {
- this.checkedAll = true;
- } else {
- this.checkedAll = false;
- }
- console.log(e.detail.value)
- },
- searchRemind(searchText) {
- this.$axios.post('app/preUserAsk/getFindAskList', {
- "searchText": searchText,
- "storeId": uni.getStorageSync('storeId')
- }).then(res => {
- console.log(res)
- this.list = res.data.list;
- for (var i in this.list) {
- var wantHouseContent = '';
- for (var j in this.list[i].wantHouse) {
- wantHouseContent += this.list[i].wantHouse[j].houseName + '、';
- }
- if (wantHouseContent.length > 0) {
- wantHouseContent = wantHouseContent.substring(0, wantHouseContent.length - 1);
- }
- this.list[i].wantHouseContent = wantHouseContent;
- }
- }).catch(err => {
- console.log(err)
- })
- },
- searchOrder(searchText) {
- this.$axios.post('app/order/findOrderList', {
- "searchText": searchText,
- "storeId": uni.getStorageSync('storeId'),
- "searchType": this.searchType
- }).then(res => {
- console.log(res)
- this.list = res.data.list;
- for (var i in this.list) {
- var paycontent = '';
- if (this.list[i].mainPayType == '03') {
- paycontent += '包场地'
- if (this.list[i].payTypes.length > 1) {
- paycontent += '('
- }
- }
- for (var j in this.list[i].payTypes) {
- if (this.list[i].payTypes[j].payTypeCode == '01') {
- paycontent += (this.list[i].payTypes[j].orderCount || 0) + '人、'
- }
- if (this.list[i].payTypes[j].payTypeCode == '02') {
- paycontent += (this.list[i].payTypes[j].orderCount || 0) + '桌、'
- }
- }
- if (paycontent.length > 0) {
- paycontent = paycontent.substring(0, paycontent.length - 1);
- }
- if (this.list[i].mainPayType == '03' && this.list[i].payTypes.length > 1) {
- paycontent += ')'
- }
- this.list[i].paycontent = paycontent.length > 0 ? ('[' + paycontent + ']') : ''
- }
- }).catch(err => {
- console.log(err)
- })
- },
- gotoRemind(id) {
- uni.navigateTo({
- url: '../remind/detail/index?id=' + id
- })
- },
- gotoOrder(id) {
- uni.navigateTo({
- url: '../book/detail/index?id=' + id
- })
- },
- gotoSettlement(id) {
-
- uni.navigateTo({
- url: '../settlement/detail/index?type=' + this.searchType + '&id=' + id
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .search_top {
- height: 130rpx;
- background: #FAFBFF;
- .search_top_in {
- width: 690rpx;
- height: 84rpx;
- background: #E7E8EA;
- border-radius: 4rpx;
- .search_top_icon {
- width: 34rpx;
- height: 34rpx;
- color: #333333;
- }
- }
- }
- .search_content {
- height: calc(100vh - 214rpx - var(--status-bar-height));
- background: white;
- .search_nocontent {
- text-align: center;
- .search_nocontent_img {
- width: 448rpx;
- margin-top: 304rpx;
- }
- .search_nocontent_notext {
- color: #999999;
- font-size: 30rpx;
- margin-top: 65rpx;
- }
- }
- .search_item {
- font-size: 28rpx;
- color: #333333;
- text-align: left !important;
- width: 656rpx;
- padding: 20rpx 0;
- }
- }
- </style>
|