123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <template>
- <view class='content'>
- <view>
- <view></view>
- <view>
- <mescroll-uni :up="upOption" :down="downOption" ref="mescrollRef" @init="mescrollInit"
- @up="upCallback" @down="downCallback" height="1400">
- <view style='flex-wrap: wrap;' class="flex">
- <view v-for='item in homestayList' class="homestayWrap">
- <view>
- <image @click='previewImg(item)' width="172" height="172" :src="item.homestayImage" mode='aspectFill'></image>
- </view>
- <view>{{item.title}}</view>
- <view>{{item.price}}</view>
- <view class='flex'>
- <view class='merchants_default_button_text' @click='edit(item)'>编辑</view>
- <view class='merchants_caution_button_text' @click='del(item)'>删除</view>
- <view class='merchants_default_button_text' @click='refresh(item)'>刷新</view>
- <view class='merchants_default_button_text' @click='hitTheSheif(item)'>上架</view>
- </view>
- </view>
- </view>
-
- </mescroll-uni>
- </view>
- </view>
- <view style='margin:20rpx;' class='flex justify-space-between'>
- <view class='merchants_button'>一键刷新</view>
- <view @click='add' class='merchants_button'>添加民宿</view>
- </view>
- <u-modal :show="isDel" content='确定删除民宿信息?' @confirm="$u.debounce(confirmDel, 500)" showCancelButton
- @cancel="isDel=false" @close="isDel=false" closeOnClickOverlay></u-modal>
- </view>
- </template>
- <script>
- var that
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin],
- data() {
- return {
- homestayList:[],
- mescroll:null,
- isDel:false,
- currectData:{},
- downOption: {
- auto: false,
- textColor: '#bbb'
- },
- upOption: {
- page: {
- size: 10 // 每页数据的数量,默认10
- },
- auto: false,
- noMoreSize: 1,
- textNoMore: '没有更多了~',
- textColor: '#bbb'
- },
- }
- },
- onLoad() {
- that = this
- },
- onShow(){
- this.mescroll.resetUpScroll()
- },
- methods: {
- previewImg(item){
- uni.previewImage({
- current: 0,
- urls: [item.dishImage],
- loop:true,
- })
- },
- add(){
- uni.navigateTo({
- url:'/pageA/enter/myHomestay/add'
- })
- },
- edit(item){
- uni.navigateTo({
- url:'/pageA/enter/myHomestay/edit?id='+item.id
- })
- },
- del(item){
- this.currectData = item
- this.isDel = true
- },
- confirmDel(){
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- that.$request.baseRequest('admin.tourism.homestayDetailInfo', 'delete',{
- id:this.currectD
- }, failres => {
- uni.showToast({
- icon: "none",
- title: failres.errmsg,
- duration: 3000
- });
- uni.hideLoading()
- }).then(res => {
- this.isDel = false
- uni.showToast({
- icon: "success",
- title: '删除民宿成功',
- duration: 2000
- });
- })
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- downCallback() {
- // if (uni.getStorageSync("userInfo").phone) {
- this.mescroll.resetUpScroll()
- // } else {
- // that.mescroll.endBySize(0, 0)
- // this.showAuthorizePhone = true
- // }
-
- },
- getList(page){
- return new Promise((resolve, reject) => {
- that.$request.baseRequest('admin.tourism.homestayDetailInfo', 'list', {
- page: page.num,
- limit: page.size,
- // searchContent: this.searchVal,
- // classify: this.typeName
- }, failres => {
- uni.showToast({
- icon: "none",
- title: failres.errmsg,
- duration: 3000
- });
- uni.hideLoading()
- }).then(res => {
- resolve(res)
- })
- })
-
- },
- async upCallback(page) {
- console.log(11111)
- // if (uni.getStorageSync("userInfo").id) {
- uni.showLoading({
- title: '数据加载中'
- })
-
- var finddata=await that.getList(page)
- if (page.num == 1) that.homestayList = [];
- that.curPageLen = finddata.data.items.length;
- that.homestayList = finddata.data.items
- that.totalPage = finddata.data.total;
- uni.hideLoading()
- that.$nextTick(() => {
- that.mescroll.endBySize(that.curPageLen, that.totalPage)
- });
-
- // }
- },
- }
- }
- </script>
- <style lang='scss' scoped>
- .homestayWrap{
- width:50%;
- background:#fff;
- padding:10rpx;
- margin:10rpx;
- }
- </style>
|