完成商品分类、商品详情展示
This commit is contained in:
parent
155713faae
commit
6a891ae24b
|
@ -3,10 +3,8 @@
|
|||
<image class="cover-image" mode="aspectFill" :src="data.icon" @click="clickItem(data.id)"></image>
|
||||
<view class="item-box" @click="clickItem(data.id)">
|
||||
<view class="title limit-line clamp-1">{{ data.name }}</view>
|
||||
<view class="text-box">
|
||||
{{ "已服务113256次" }}
|
||||
</view>
|
||||
<view class="price">¥158元起</view>
|
||||
<view class="text-box"> 已服务{{ data.times }}次 </view>
|
||||
<view class="price">¥ {{ data.price }}元</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
|
|
@ -25,12 +25,55 @@ export default {
|
|||
auth: true,
|
||||
}
|
||||
},
|
||||
project: {
|
||||
project: {
|
||||
url: "/project/applyinfo",
|
||||
},
|
||||
projectList: {
|
||||
url: "/project/alllist",
|
||||
},
|
||||
business: {
|
||||
url: "/project/applyinfob",
|
||||
},
|
||||
businessList: {
|
||||
url: "/project/alllistb",
|
||||
},
|
||||
afterMarket: {
|
||||
url: "/project/applyguarantee"
|
||||
},
|
||||
afterMarketList: {
|
||||
url: "/project/allguaranteelist"
|
||||
},
|
||||
distribution: {
|
||||
config: {
|
||||
url: "/index/getdistributionmoney"
|
||||
},
|
||||
carType: {
|
||||
url: "/index/getallcar"
|
||||
},
|
||||
submit: {
|
||||
url: "/project/distribution"
|
||||
},
|
||||
pay: {
|
||||
url: "/wxpay/payorderd"
|
||||
}
|
||||
}
|
||||
},
|
||||
service: {
|
||||
aftermarket: {
|
||||
url: "/index/category2",
|
||||
},
|
||||
hotCate: {
|
||||
url: "/index/hotcategory",
|
||||
},
|
||||
cate: {
|
||||
url: "/index/category1",
|
||||
},
|
||||
list: {
|
||||
url: "/index/getcategorybyid"
|
||||
},
|
||||
goodsDetail: {
|
||||
url: "/index/goodsinfobyid",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -60,34 +60,65 @@ export default {
|
|||
x: x - this.$utils.rpx2px(20),
|
||||
y: y - this.$utils.rpx2px(40),
|
||||
};
|
||||
this.$request({
|
||||
api: "service.cate",
|
||||
})
|
||||
.then((response) => {
|
||||
response.data.forEach((item) => {
|
||||
let child = [];
|
||||
item.child.forEach((v) => {
|
||||
child.push({
|
||||
id: v.id,
|
||||
name: v.name,
|
||||
icon: v.more,
|
||||
});
|
||||
});
|
||||
this.data.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icon: item.more,
|
||||
child: child,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {});
|
||||
// 加载分类
|
||||
this.loadHot();
|
||||
this.loadCate();
|
||||
},
|
||||
onShow() {},
|
||||
onReady() {},
|
||||
onReachBottom() {},
|
||||
onPullDownRefresh() {},
|
||||
methods: {
|
||||
/**
|
||||
* 热门推荐
|
||||
*/
|
||||
loadHot() {
|
||||
this.$request({
|
||||
api: "service.hotCate",
|
||||
}).then((response) => {
|
||||
let child = [];
|
||||
response.data.forEach((item) => {
|
||||
child.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icon: item.more,
|
||||
});
|
||||
});
|
||||
this.data.push({
|
||||
id: 0,
|
||||
name: "热门推荐",
|
||||
icon: "",
|
||||
child: child,
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
loadCate() {
|
||||
this.$request({
|
||||
api: "service.cate",
|
||||
})
|
||||
.then((response) => {
|
||||
response.data.forEach((item) => {
|
||||
let child = [];
|
||||
item.child.forEach((v) => {
|
||||
child.push({
|
||||
id: v.id,
|
||||
name: v.name,
|
||||
icon: v.more,
|
||||
});
|
||||
});
|
||||
this.data.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icon: item.more,
|
||||
child: child,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {});
|
||||
},
|
||||
clickItem(id) {
|
||||
this.$utils.toPage("/pages/service/list?id=" + id);
|
||||
},
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<text class="text">空调安装</text>
|
||||
</view>
|
||||
<view class="text-box">
|
||||
<text class="text">已服务812121次</text>
|
||||
<text class="text">已服务{{ detail.times }}次</text>
|
||||
</view>
|
||||
<view class="share-icon" @click="share">
|
||||
<text class="iconfont icon-fenxiang"></text>
|
||||
|
@ -63,7 +63,7 @@
|
|||
</swiper>
|
||||
<view class="common-bottom-components" v-if="tabIndex == 0" :style="{ bottom: config.safeAreaInsets.bottom + 'px' }">
|
||||
<view class="price">
|
||||
<text class="text">¥306.00</text>
|
||||
<text class="text">¥{{ detail.price }}</text>
|
||||
</view>
|
||||
<view class="btn-group">
|
||||
<view class="cart">
|
||||
|
@ -90,15 +90,13 @@ export default {
|
|||
currentBanner: 1,
|
||||
bottom: 0,
|
||||
pageTitle: "服务详情",
|
||||
id: 0,
|
||||
detail: {
|
||||
title: "服务标题",
|
||||
images: [
|
||||
require("@/static/temp/cate/5.png"),
|
||||
require("@/static/temp/cate/5.png"),
|
||||
require("@/static/temp/cate/5.png"),
|
||||
],
|
||||
content:
|
||||
"<p>这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容</p>",
|
||||
title: "",
|
||||
times: 0,
|
||||
images: [],
|
||||
content: "",
|
||||
price: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
@ -110,16 +108,40 @@ export default {
|
|||
config: (state) => state.system.config,
|
||||
}),
|
||||
},
|
||||
onLoad() {
|
||||
this.$nextTick(() => {
|
||||
this.setTabHeight();
|
||||
});
|
||||
onLoad(e) {
|
||||
if (e.id) {
|
||||
this.id = e.id;
|
||||
} else {
|
||||
this.$utils.toast("参数错误");
|
||||
return;
|
||||
}
|
||||
|
||||
this.getDetail();
|
||||
},
|
||||
onShow() {},
|
||||
onReady() {},
|
||||
onReachBottom() {},
|
||||
onPullDownRefresh() {},
|
||||
methods: {
|
||||
getDetail() {
|
||||
this.$request({
|
||||
api: "service.goodsDetail",
|
||||
data: {
|
||||
id: this.id,
|
||||
},
|
||||
}).then((response) => {
|
||||
this.detail = {
|
||||
title: response.data.goods.post_title,
|
||||
times: response.data.goods.post_hits,
|
||||
images: response.data.goods.image,
|
||||
content: response.data.goods.post_content,
|
||||
price: response.data.goods.money,
|
||||
};
|
||||
this.$nextTick(() => {
|
||||
this.setTabHeight();
|
||||
});
|
||||
});
|
||||
},
|
||||
share() {
|
||||
uni.showToast({
|
||||
title: "分享",
|
||||
|
|
|
@ -49,12 +49,43 @@ export default {
|
|||
this.$utils.toast("参数错误");
|
||||
return;
|
||||
}
|
||||
this.loadList();
|
||||
},
|
||||
onShow() {},
|
||||
onReady() {},
|
||||
onReachBottom() {},
|
||||
onPullDownRefresh() {},
|
||||
methods: {
|
||||
/**
|
||||
* 加载列表
|
||||
*/
|
||||
loadList() {
|
||||
this.$request({
|
||||
api: "service.list",
|
||||
query: "id=" + this.cateId,
|
||||
})
|
||||
.then((response) => {
|
||||
response.data.forEach((item) => {
|
||||
let goods = [];
|
||||
item.goods.forEach((v) => {
|
||||
goods.push({
|
||||
id: v.id,
|
||||
name: v.post_title,
|
||||
times: v.post_hits,
|
||||
icon: v.thumbnail,
|
||||
price: v.money,
|
||||
});
|
||||
});
|
||||
this.data.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icon: item.more,
|
||||
child: goods,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {});
|
||||
},
|
||||
createOrder() {
|
||||
this.$utils.toPage("/pages/order/create");
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue