罗世杰:商铺列表数据绑定

This commit is contained in:
LuoShijie
2023-11-17 22:36:02 +08:00
parent 007445f1d8
commit 022da2f0d0
3 changed files with 92 additions and 30 deletions

View File

@@ -52,11 +52,32 @@
return false return false
} }
}, },
//获取列表类型传递参数部分
listType:{
type: Number,
default() {
return 1
}
},
pageSize: {
type: Number,
default() {
return 5
}
},
pageNum: {
type: Number,
default() {
return 1
}
},
shopInfoList: { shopInfoList: {
type: Array, type: Array,
default() { default() {
return [ return [
{ {
id: 1,
type: 1,
shopid: 1, shopid: 1,
imageUrl: 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg', imageUrl: 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg',
title: '琴行铺面转让', title: '琴行铺面转让',
@@ -72,19 +93,41 @@
phoneNum: 13348946108, phoneNum: 13348946108,
}, },
{ {
shopid: 2, "id": "1",
imageUrl: 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg', "pic": "3",
title: '琴行铺面转让', "tt": "333",
promotionNum: 23, "type": "0",
price: 5000, "adress": "",
date: '2023-11-02', "trade1": "啊",
pos: '锦江区', "trade2": "餐馆",
exactPos: '锦江区-汇源南路366号', "btype1": "",
sqr: 200, "btype2": "",
zrfText: "转让费20000万", "area1": "青羊区",
category: '餐饮美食', "area2": "",
uname: "王先生", "mianji": "33",
phoneNum: 13348946108, "zhuanrangfei": "44",
"zujin": "44",
"hits": "0",
"58url": "",
"personurl": "",
"kw": "",
"remark": "",
"content": "44vv",
"pics": "",
"user_level_id": "1",
"lianxiren": "3333",
"mobile": "44444",
"status": "1",
"shangpulx": "1",
"zhuangtai": "1",
"lng": "2222.00000000",
"lat": "3333.00000000",
"pub_time": "0",
"create_time": "1699973131",
"update_time": "1699973131",
"delete_time": "0",
"userid": "1",
"success": "2"
} }
] ]
} }
@@ -97,7 +140,21 @@
// TODO不能直接修改 // TODO不能直接修改
// if(delindex !== -1) this.shopInfoList = this.shopInfoList.slice(delindex,1) // if(delindex !== -1) this.shopInfoList = this.shopInfoList.slice(delindex,1)
// console.log(this.shopInfoList); // console.log(this.shopInfoList);
},
getList() {
const query = this.$u.queryParams({
type: this.listType,
pageSize: this.pageSize,
pageNum: this.pageNum
})
this.$api.getShopList(query).then(res => {
console.log("shoplist",res.data.data);
})
} }
},
created() {
this.getList()
} }
} }
</script> </script>

View File

@@ -2,7 +2,7 @@
<view class="list-border"> <view class="list-border">
<view class="list-container" @click="enterDetail()"> <view class="list-container" @click="enterDetail()">
<view class="shop-list-img" > <view class="shop-list-img" >
<u-image width="80px" height="80px" :src="shopInfo.imageUrl" radius="8px"></u-image> <u-image width="80px" height="80px" :src="shopInfo.pics" radius="8px"></u-image>
</view> </view>
<view class="text-area"> <view class="text-area">
<text style="font-weight: 500;">{{shopInfo.title}}</text> <text style="font-weight: 500;">{{shopInfo.title}}</text>
@@ -11,13 +11,13 @@
<view> <view>
<u-image src="/static/shoplist/sy_icon_lbdw.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbdw.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.pos}}</text> <text>{{shopInfo.area1}}</text>
</view> </view>
<view> <view>
<view> <view>
<u-image src="/static/shoplist/sy_icon_lbpm.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbpm.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.sqr}}m2</text> <text>{{shopInfo.mianji}}m2</text>
</view> </view>
</view> </view>
<view v-else class="pos-and-sqr pos-only" > <view v-else class="pos-and-sqr pos-only" >
@@ -25,13 +25,13 @@
<view> <view>
<u-image src="/static/shoplist/dp_icon_hhhdw.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/dp_icon_hhhdw.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.exactPos}}</text> <text>{{shopInfo.area2}}</text>
</view> </view>
</view> </view>
<view class="rent-and-date"> <view class="rent-and-date">
<text>租金{{shopInfo.price}}/</text> <text>租金{{shopInfo.zujin}}/</text>
<text v-if="showStyle == 0">发布日期{{shopInfo.date}}</text> <text v-if="showStyle == 0">发布日期{{shopInfo.create_time}}</text>
<text v-if="showStyle == 1">{{shopInfo.zrfText}}</text> <text v-if="showStyle == 1">转让费{{shopInfo.zhuanrangfei}}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -41,25 +41,25 @@
<view> <view>
<u-image src="/static/shoplist/sy_icon_lbpm.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbpm.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.sqr}}m2</text> <text>{{shopInfo.mianji}}m2</text>
</view> </view>
<view> <view>
<view> <view>
<u-image src="/static/shoplist/sy_icon_lblhy.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lblhy.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.category}}</text> <text>{{shopInfo.trade1}}</text>
</view> </view>
<view> <view>
<view> <view>
<u-image src="/static/shoplist/sy_icon_lbxm.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbxm.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.uname}}</text> <text>{{shopInfo.lianxiren}}</text>
</view> </view>
<view> <view>
<view> <view>
<u-image src="/static/shoplist/sy_icon_lblxr.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lblxr.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.phoneNum}}</text> <text>{{shopInfo.mobile}}</text>
</view> </view>
</view> </view>
@@ -78,11 +78,11 @@
</view> </view>
<view v-if="isEdit" class="del-and-edit bottom-common"> <view v-if="isEdit" class="del-and-edit bottom-common">
<view class="edit" @click="handleEdit(shopInfo.shopid)"> <view class="edit" @click="handleEdit(shopInfo.id)">
<u-image src="/static/shoplist/dp_icon_pj.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/dp_icon_pj.png" width="12px" height="15px"></u-image>
<text>编辑</text> <text>编辑</text>
</view> </view>
<view class="del" @click="handleDel(shopInfo.shopid)"> <view class="del" @click="handleDel(shopInfo.id)">
<u-image src="/static/shoplist/dp_icon_sc.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/dp_icon_sc.png" width="12px" height="15px"></u-image>
<text>删除</text> <text>删除</text>
</view> </view>
@@ -158,8 +158,14 @@
this.$emit('delItem', shopid) this.$emit('delItem', shopid)
}, },
enterDetail(){ enterDetail(){
// console.log("进入详情页面");
const query=this.$u.queryParams({
id: this.shopInfo.id,
type: this.shopInfo.type
})
// console.log("query",query);
uni.navigateTo({ uni.navigateTo({
url: '/pages/detail/detail' url: '/pages/detail/detail' + `${query}`
}) })
}, },
handleAD(){ handleAD(){

View File

@@ -248,9 +248,8 @@ const apiService = {
}) })
}, },
//获取商铺列表 //获取商铺列表
getShopList(data){ getShopList(query){
const type = data.type const url = `/shop/alllist${query}`
const url = `shop/alllist/?type=${type}`
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
resolve(service.get(url)) resolve(service.get(url))
}) })