罗世杰修改ShopList和SearchList的api

This commit is contained in:
LuoShijie
2023-11-18 18:07:01 +08:00
parent f3cec1461e
commit fbb6b00cba
7 changed files with 78 additions and 93 deletions

View File

@@ -30,23 +30,16 @@
components: { components: {
DropDownItem DropDownItem
}, },
props: {
postlist: {
type: Array,
default () {
return [
['全部', '餐饮美食', '百货超市', '美容美发'],
['区域1', '区域2', '区域3', '区域4'],
['100m2', '200m2', '300m2'],
['附近的', '最新发布的', '其他']
]
}
}
},
data() { data() {
return { return {
title: ['行业', '区域', '面积', '筛选'], title: ['行业', '区域', '面积', '筛选'],
activeIndex: -1, activeIndex: -1,
postlist: [
['全部', '餐饮美食', '百货超市', '美容美发'],
['区域1', '区域2', '区域3', '区域4'],
['小于50m²', '50-200m²', '200-600m²', '600-800m²', '800-1000m²', '1000m²以上'],
['附近的', '最新发布的', '其他']
]
}; };
}, },
computed: { computed: {
@@ -56,7 +49,7 @@
}, },
created() { created() {
this.postlist[0]=JSON.parse(uni.getStorageSync('classList')) this.postlist[0]=JSON.parse(uni.getStorageSync('classList'))
// this.postlist[1]=JSON.parse(uni.getStorageSync('regionList')) this.postlist[1]=JSON.parse(uni.getStorageSync('regionList'))
}, },
methods: { methods: {
changeActiveIndex(index) { changeActiveIndex(index) {

View File

@@ -13,13 +13,18 @@
<script> <script>
/** /**
* @property {Array} shopInfoList 对象数组,(不带图片)需要展示商铺列表 * @property {Number} showStyle 展示商铺的样式类型(0为首页默认)
* @property {Boolean} isEdit 是否显示编辑和删除
* @property {Number} listType 获取列表类型传递参数部分
* @property {Object} customQuery 自定义查询参数
*/ */
export default { export default {
name:"SearchShopList", name:"SearchShopList",
data() { data() {
return { return {
pageSize: 5,
pageNum: 1,
shopInfoList: []
}; };
}, },
props: { props: {
@@ -35,38 +40,22 @@
return false return false
} }
}, },
shopInfoList: { listType:{
type: Array, type: Number,
default() { default(){
return [ return 2
{ }
searchid: 1, },
title: '寻找旺铺,200平米左右寻找旺铺,200平米左右寻找旺铺,200平米左右寻找旺铺,200平米左右', customQuery:{
price: 5000, type: Object,
date: '2023-11-02', default(){
phoneNum: 13348946108, return {}
pos: '锦江区',
category: '餐饮美食',
uname: 'A先生',
sqr: 500,
yjtzText: "423万元"
},
{
searchid: 2,
title: '寻找旺铺,200平米左右寻找旺铺,200平米左右寻找旺铺,200平米左右寻找旺铺,200平米左右',
price: 7000,
date: '2023-11-02',
phoneNum: 13348946108,
pos: '锦江区',
category: '餐饮美食',
uname: '王先生',
sqr: 200,
yjtzText: "423万元"
}
]
} }
} }
}, },
created() {
this.getList()
},
methods: { methods: {
handleDel(shopid){ handleDel(shopid){
console.log("删除了商铺", shopid); console.log("删除了商铺", shopid);
@@ -74,6 +63,19 @@
// 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.customQuery
})
console.log(query, 'query');
this.$api.getShopList(query).then(res => {
console.log(this.shopInfoList);
this.shopInfoList = res.data.data
})
} }
} }
} }

View File

@@ -5,42 +5,42 @@
</view> </view>
<view class="list-container"> <view class="list-container">
<view class="text-area"> <view class="text-area">
<text>{{shopInfo.title}}</text> <text>{{shopInfo.tt}}</text>
<view class="style2" v-if="showStyle === 1"> <view class="style2" v-if="showStyle === 1">
<view class="rent-and-cost"> <view class="rent-and-cost">
<text>租金{{shopInfo.price}}/</text> <text>租金{{shopInfo.zujin}}/</text>
<text v-if="showStyle==1">预计投资{{shopInfo.yjtzText}}</text> <text v-if="showStyle==1">预计投资{{shopInfo.zhuanrangfei}}</text>
</view> </view>
<view class="cart-and-pos"> <view class="cart-and-pos">
<view> <view>
<view> <view>
<u-image src="/static/shoplist/sy_icon_lbhy.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbhy.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_lbhdw.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbhdw.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.pos}}</text> <text>{{shopInfo.area1}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="style3" v-if="showStyle === 2"> <view class="style3" v-if="showStyle === 2">
<view class="cjsj">成交时间{{shopInfo.date}}</view> <view class="cjsj">成交时间{{$u.timeFormat(shopInfo.deal_time,'yyyy-mm-dd')}}</view>
<view class="cart-and-pos"> <view class="cart-and-pos">
<view> <view>
<view> <view>
<u-image src="/static/cjal/al_icon_flh.png" width="12px" height="15px"></u-image> <u-image src="/static/cjal/al_icon_flh.png" width="12px" height="15px"></u-image>
</view> </view>
<text :class="{style3: showStyle === 2}">{{shopInfo.category}}</text> <text :class="{style3: showStyle === 2}">{{shopInfo.trade1}}</text>
</view> </view>
<view> <view>
<view> <view>
<u-image src="/static/cjal/al_icon_dwh.png" width="12px" height="15px"></u-image> <u-image src="/static/cjal/al_icon_dwh.png" width="12px" height="15px"></u-image>
</view> </view>
<text :class="{style3: showStyle === 2}">{{shopInfo.pos}}</text> <text :class="{style3: showStyle === 2}">{{shopInfo.area1}}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -51,21 +51,21 @@
<u-image v-if="showStyle === 2" src="/static/cjal/al_icon_pm.png" width="12px" height="15px"></u-image> <u-image v-if="showStyle === 2" src="/static/cjal/al_icon_pm.png" width="12px" height="15px"></u-image>
<u-image v-else src="/static/shoplist/sy_icon_lbpm.png" width="12px" height="15px"></u-image> <u-image v-else src="/static/shoplist/sy_icon_lbpm.png" width="12px" height="15px"></u-image>
</view> </view>
<text :class="{style3: showStyle === 2}">{{shopInfo.sqr}}m2</text> <text :class="{style3: showStyle === 2}">{{shopInfo.mianji}}m2</text>
</view> </view>
<view> <view>
<view> <view>
<u-image v-if="showStyle === 2" src="/static/cjal/al_icon_mch.png" width="12px" height="15px"></u-image> <u-image v-if="showStyle === 2" src="/static/cjal/al_icon_mch.png" width="12px" height="15px"></u-image>
<u-image v-else src="/static/shoplist/sy_icon_lbxm.png" width="12px" height="15px"></u-image> <u-image v-else src="/static/shoplist/sy_icon_lbxm.png" width="12px" height="15px"></u-image>
</view> </view>
<text :class="{style3: showStyle === 2}">{{shopInfo.uname}}</text> <text :class="{style3: showStyle === 2}">{{shopInfo.lianxiren}}</text>
</view> </view>
<view style="flex:2"> <view style="flex:2">
<view> <view>
<u-image v-if="showStyle === 2" src="/static/cjal/al_icon_sjh.png" width="12px" height="15px"></u-image> <u-image v-if="showStyle === 2" src="/static/cjal/al_icon_sjh.png" width="12px" height="15px"></u-image>
<u-image v-else src="/static/shoplist/sy_icon_lblxr.png" width="12px" height="15px"></u-image> <u-image v-else src="/static/shoplist/sy_icon_lblxr.png" width="12px" height="15px"></u-image>
</view> </view>
<text :class="{style3: showStyle === 2}">{{shopInfo.phoneNum}}</text> <text :class="{style3: showStyle === 2}">{{shopInfo.mobile}}</text>
</view> </view>
</view> </view>
@@ -74,28 +74,28 @@
<view> <view>
<u-image src="/static/shoplist/sy_icon_lbhy.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbhy.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_lbhdw.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbhdw.png" width="12px" height="15px"></u-image>
</view> </view>
<text>{{shopInfo.pos}}</text> <text>{{shopInfo.area1}}</text>
</view> </view>
<view style="flex:2"> <view style="flex:2">
<view> <view>
<u-image src="/static/shoplist/sy_icon_lbrq.png" width="12px" height="15px"></u-image> <u-image src="/static/shoplist/sy_icon_lbrq.png" width="12px" height="15px"></u-image>
</view> </view>
<text>发布日期{{shopInfo.date}}</text> <text>发布日期{{$u.timeFormat(shopInfo.pub_time,'yyyy-mm-dd')}}</text>
</view> </view>
</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.searchid)"> <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.searchid)"> <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>
@@ -113,14 +113,7 @@
type:Object, type:Object,
default(){ default(){
return { return {
title: '寻找旺铺,200平米左右寻找旺铺,200平米左右寻找旺铺,200平米左右寻找旺铺,200平米左右',
price: 5000,
date: '2023-11-02',
phoneNum: 13348946108,
pos: '锦江区',
category: '餐饮美食',
uname: '王先生',
sqr: 200
} }
} }
}, },
@@ -151,6 +144,7 @@
handleEdit(searchid) { handleEdit(searchid) {
// TODO 完成页面跳转 // TODO 完成页面跳转
console.log("点击了编辑ID为",searchid); console.log("点击了编辑ID为",searchid);
}, },
handleDel(searchid) { handleDel(searchid) {
this.$emit('delItem', searchid) this.$emit('delItem', searchid)

View File

@@ -19,12 +19,18 @@
* @property {Number} showStyle 展示商铺的样式类型(0为首页默认) * @property {Number} showStyle 展示商铺的样式类型(0为首页默认)
* @property {Boolean} isADshow 是否显示推广广告 * @property {Boolean} isADshow 是否显示推广广告
* @property {Boolean} isEdit 是否显示编辑和删除 * @property {Boolean} isEdit 是否显示编辑和删除
* @property {String} adlinkPath 推广广告跳转链接
* @property {Number} listType 获取列表类型传递参数部分
* @property {Object} customQuery 自定义查询参数
*/ */
export default { export default {
name:"ShowShopList", name:"ShowShopList",
data() { data() {
return { return {
pageSize: 5,
pageNum: 1,
shopInfoList: []
}; };
}, },
props: { props: {
@@ -52,32 +58,22 @@
return false return false
} }
}, },
//获取列表类型传递参数部分 // //获取列表类型传递参数部分
listType:{ listType:{
type: Number, type: Number,
default() { default() {
return 1 return 1
} }
}, },
pageSize: { customQuery:{
type: Number, type: Object,
default() { default() {
return 5 return {}
} }
}, }
pageNum: {
type: Number,
default() {
return 1
}
},
}, },
data() {
return {
shopInfoList: []
}
},
methods: { methods: {
handleDel(shopid){ handleDel(shopid){
console.log("删除了商铺", shopid); console.log("删除了商铺", shopid);
@@ -90,15 +86,15 @@
const query = this.$u.queryParams({ const query = this.$u.queryParams({
type: this.listType, type: this.listType,
pageSize: this.pageSize, pageSize: this.pageSize,
pageNum: this.pageNum pageNum: this.pageNum,
...this.customQuery
}) })
console.log("query",query);
this.$api.getShopList(query).then(res => { this.$api.getShopList(query).then(res => {
console.log("shoplist",res.data.data);
this.shopInfoList = res.data.data this.shopInfoList = res.data.data
this.shopInfoList.forEach(item=>{ this.shopInfoList.forEach(item=>{
item.pics =this.$api.imgUrl + item.pics item.pics =this.$api.imgUrl + item.pics
}); });
console.log("shoplist",res.data.data);
}) })
} }

View File

@@ -30,7 +30,7 @@
</view> </view>
<view class="rent-and-date"> <view class="rent-and-date">
<text>租金{{shopInfo.zujin}}/</text> <text>租金{{shopInfo.zujin}}/</text>
<text v-if="showStyle == 0">发布日期{{$u.timeFormat(shopInfo.create_time,'yyyy-mm-dd')}}</text> <text v-if="showStyle == 0">发布日期{{$u.timeFormat(shopInfo.pub_time,'yyyy-mm-dd')}}</text>
<text v-if="showStyle == 1">转让费{{shopInfo.zhuanrangfei}}</text> <text v-if="showStyle == 1">转让费{{shopInfo.zhuanrangfei}}</text>
<!-- bug --> <!-- bug -->
</view> </view>
@@ -72,7 +72,7 @@
> >
<view> <view>
<text>已将该店推给</text> <text>已将该店推给</text>
<text style="color:#ce3b3b;margin: 0 4px;"> {{shopInfo.promotionNum}} </text> <text style="color:#ce3b3b;margin: 0 4px;"> {{shopInfo.num}} </text>
<text> 位潜在客户</text> <text> 位潜在客户</text>
</view> </view>
<text style="color:#ce3b3b">我也要推广>></text> <text style="color:#ce3b3b">我也要推广>></text>

View File

@@ -15,7 +15,7 @@
<DropDown></DropDown> <DropDown></DropDown>
</view> </view>
<view class="marginLR10"> <view class="marginLR10">
<ShowShopList :showStyle="2" :adlinkPath = "adlinkPath"/> <ShowShopList :showStyle="2" :adlinkPath = "adlinkPath" :listType="3"/>
</view> </view>
</view> </view>
</template> </template>

View File

@@ -15,7 +15,7 @@
<DropDown></DropDown> <DropDown></DropDown>
</view> </view>
<view class="marginLR10"> <view class="marginLR10">
<ShowShopList :showStyle="2" :adlinkPath="adlinkPath"/> <ShowShopList :showStyle="2" :adlinkPath="adlinkPath" :listType="4"/>
</view> </view>
</view> </view>
</template> </template>