Przeglądaj źródła

商品详情页面;商品详情接口交互;

Sinea 1 rok temu
rodzic
commit
f9e9084868

+ 8 - 0
api/bill.js

@@ -0,0 +1,8 @@
+import request from '@/api'
+
+const billService = {
+	// 获取我的账单列表
+	getBillList: params => request.post('/bill/list', params)
+}
+
+export default billService

+ 5 - 1
api/product.js

@@ -6,7 +6,11 @@ const productService = {
 	// 获取产品分类表
 	getCategoryList: () => request.get(url + '/category'),
 	// 获取分类下产品列表
-	getProductList: params => request.get(url + '/list', params)
+	getProductList: params => request.get(url + '/list', params),
+	// 获取产品详情
+	getProductDetail: productId => request.getPath(url + '/{productId}', {}, {
+		productId
+	})
 }
 
 export default productService

+ 204 - 0
pages/index/product/index.scss

@@ -0,0 +1,204 @@
+.page-wrap {
+	padding-bottom: 41.21rpx;
+}
+.swiper-panel {
+	width: 100%;
+	height: 390.11rpx;
+	.img {
+		width: 100%;
+		height: 100%;
+	}
+}
+.product-panel {
+	background: #fff;
+	padding: 27.47rpx 27.47rpx 68.68rpx;
+	position: relative;
+	.name {
+		font-size: 32.97rpx;
+		word-break: break-all;
+	}
+	.desc {
+		font-size: 27.47rpx;
+		color: #999;
+		word-break: break-all;
+		margin-top: 6.87rpx;
+	}
+	.tags {
+		overflow: hidden;
+		margin-bottom: -41.21rpx;
+		padding-right: 178.57rpx;
+
+		.tag {
+			float: left;
+			font-size: 21.98rpx;
+			color: #f97631;
+			padding: 2.75rpx 13.74rpx;
+			border: 1rpx solid #f97631;
+			margin: 13.74rpx 13.74rpx 0 0;
+		}
+	}
+	.price {
+		font-size: 41.21rpx;
+		color: #f97631;
+		position: absolute;
+		right: 27.47rpx;
+		bottom: 27.47rpx;
+		line-height: 1;
+
+		&:before {
+			content: '¥';
+			font-size: 24.73rpx;
+		}
+
+		&::after {
+			content: attr(data-text);
+			font-size: 21.98rpx;
+			color: #999;
+			margin-left: 4.12rpx;
+			vertical-align: middle;
+		}
+	}
+}
+.nav-panel {
+	margin-top: 13.74rpx;
+	background: #fff;
+	.item {
+		padding: 13.74rpx 27.47rpx;
+		border-bottom: 1rpx solid #e0e0e0;
+		display: flex;
+		align-items: center;
+		&:last-child {
+			border: none;
+		}
+	}
+	.label {
+		flex: 1;
+		font-size: 27.47rpx;
+		word-break: break-all;
+	}
+	.text {
+		font-size: 24.73rpx;
+		color: #999;
+		margin: 0 13.74rpx;
+	}
+	.icon {
+		width: 54.95rpx;
+		height: 54.95rpx;
+	}
+}
+.info-panel {
+	background: #fff;
+	margin-top: 13.74rpx;
+	&.collapse {
+		.content {
+			max-height: 192.31rpx;
+		}
+		.collapse-btn::after {
+			content: '展开更多 ∨';
+		}
+	}
+	.title {
+		height: 82.42rpx;
+		padding: 0 27.47rpx;
+		font-size: 27.47rpx;
+		line-height: 82.42rpx;
+		border-bottom: 1rpx solid #e0e0e0;
+		box-sizing: border-box;
+	}
+	.content {
+		max-height: none;
+		word-break: break-all;
+		overflow: hidden;
+		.explain-img {
+			width: 100%;
+			height: 2587.91rpx;
+		}
+		.p {
+			font-size: 27.47rpx;
+			line-height: 38.46rpx;
+			color: #333;
+			margin: 20.6rpx 27.47rpx;
+		}
+		.b {
+			color: #0384d6;
+		}
+	}
+	.collapse-btn {
+		height: 82.42rpx;
+		font-size: 24.73rpx;
+		color: #999;
+		line-height: 82.42rpx;
+		text-align: center;
+		border-top: 1rpx solid #e0e0e0;
+		&::after {
+			content: '收起 ∧';
+		}
+	}
+}
+.recommend-scorll {
+	height: 260.99rpx;
+	.recommend-list {
+		display: flex;
+		padding: 27.47rpx 13.74rpx 0 27.47rpx;
+	}
+	.item {
+		margin-right: 13.74rpx;
+	}
+	.img {
+		width: 192.31rpx;
+		height: 164.84rpx;
+		display: block;
+	}
+	.name {
+		font-size: 24.73rpx;
+		text-align: center;
+		white-space: nowrap;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		padding: 0 13.74rpx;
+		margin-top: 13.74rpx;
+	}
+}
+.foot-panel {
+	height: 96.15rpx;
+	.foot-wrap {
+		position: fixed;
+		left: 0;
+		right: 0;
+		bottom: 0;
+		height: 96.15rpx;
+		background: #f7f7f7;
+		display: flex;
+		align-items: center;
+	}
+	.share-btn {
+		height: 75.55rpx;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		font-size: 24.73rpx;
+		color: #333;
+		line-height: 1;
+		padding: 0;
+		margin: 0 78.3rpx;
+		.icon {
+			width: 38.46rpx;
+			height: 38.46rpx;
+			margin-bottom: 8.24rpx;
+		}
+	}
+	.btn {
+		width: 219.78rpx;
+		height: 68.68rpx;
+		line-height: 68.68rpx;
+		background: #f97631;
+		border-radius: 8.24rpx;
+		font-size: 27.47rpx;
+		color: #fff;
+		margin: 0 13.74rpx 0 0;
+		&-1 {
+			color: #000;
+			background: #f9c421;
+		}
+	}
+}

+ 125 - 4
pages/index/product/index.vue

@@ -1,14 +1,135 @@
 <template>
-	<view>123</view>
+	<view class="page-wrap">
+		<swiper class="swiper-panel" circular indicator-dots indicator-color="#fff" indicator-active-color="#00bcd2">
+			<swiper-item>
+				<image class="img" src="@/static/img_banner_1.jpg" mode="aspectFill"></image>
+			</swiper-item>
+			<swiper-item>
+				<image class="img" src="@/static/img_banner_2.jpg" mode="aspectFill"></image>
+			</swiper-item>
+		</swiper>
+		<view class="product-panel">
+			<view class="name">{{ productInfo.name }}</view>
+			<view class="desc">{{ productInfo.title }}</view>
+			<view class="tags">
+				<view class="tag" v-for="(tag, tagIndex) in tags" :key="tagIndex">{{ filterDict(tag, tagList) }}</view>
+			</view>
+			<view class="price">{{ productInfo.salePrice }}</view>
+		</view>
+		<view class="nav-panel">
+			<view class="item" @click="handleOpenLocation">
+				<view class="label">{{ productInfo.address }}</view>
+				<view class="text">导航</view>
+				<image class="icon" src="@/static/icon_pointer.png"></image>
+			</view>
+			<view class="item" @click="handleCallPhone">
+				<view class="label">24小时服务电话</view>
+				<view class="text">电话</view>
+				<image class="icon" src="@/static/icon_tel.png"></image>
+			</view>
+		</view>
+		<view :class="{ 'info-panel': true, collapse: isCollapseExplain }">
+			<view class="title">服务说明</view>
+			<view class="content">
+				<image class="explain-img" src="@/static/img_product_detail.jpg"></image>
+			</view>
+			<view class="collapse-btn" @click="isCollapseExplain = !isCollapseExplain"></view>
+		</view>
+		<view :class="{ 'info-panel': true, collapse: isCollapseTips }">
+			<view class="title">温馨提示</view>
+			<view class="content">
+				<view class="p">
+					我们的每款产品都是一次性收费,保证无二次收费。标注的产品价格,可能会因更新不及时,与实际价格有差异,具体请参见
+					<text class="b">《鑫恩华价格发布规范》</text>
+					。
+				</view>
+				<view class="p">如果您有不同需求,请在下单之前联系客服,再次衷心感谢新老客户们一直以来对我集团的支持,我们将竭诚为您服务,您的满意是我们最大的追求!</view>
+			</view>
+			<view class="collapse-btn" @click="isCollapseTips = !isCollapseTips"></view>
+		</view>
+		<view class="info-panel">
+			<view class="title">相关推荐</view>
+			<view class="content">
+				<scroll-view class="recommend-scorll" scroll-x>
+					<view class="recommend-list">
+						<view class="item" v-for="(item, index) in [1, 2, 3, 4, 5, 6]" :key="index">
+							<image class="img" src="@/static/img_banner_1.jpg" mode="aspectFill"></image>
+							<view class="name">公章刻印</view>
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+		</view>
+		<view class="foot-panel">
+			<view class="foot-wrap">
+				<button class="share-btn">
+					<image class="icon" src="@/static/svg/user_nav_4.svg"></image>
+					分享海报
+				</button>
+				<button class="btn btn-1">电话咨询</button>
+				<button class="btn">下单购买</button>
+			</view>
+		</view>
+	</view>
 </template>
 
 <script>
+import productService from '@/api/product.js';
+import systemService from '@/api/system.js';
+import { filterDict } from '@/utils/util.js';
 export default {
 	data() {
-		return {};
+		return {
+			productId: '',
+			productInfo: '',
+			tags: [],
+			tagList: '',
+			isCollapseExplain: true,
+			isCollapseTips: true
+		};
 	},
-	methods: {}
+	onLoad(option) {
+		this.productId = option.id;
+		this.getProductDetail();
+		this.getTagConfig();
+	},
+	methods: {
+		// 获取商品详情
+		async getProductDetail() {
+			const { data } = await productService.getProductDetail(this.productId);
+			this.productInfo = data;
+			this.tags = data.label ? data.label.split(',') : [];
+		},
+		// 获取标签配置
+		async getTagConfig() {
+			const { rows } = await systemService.getDict('fin_product_tag');
+			this.tagList = rows;
+		},
+		handleCallPhone() {
+			if (!this.productInfo.telephone) return;
+			uni.makePhoneCall({
+				phoneNumber: this.productInfo.telephone
+			});
+		},
+		handleOpenLocation(){
+		// let {coordinate} = this.productInfo
+		// 	uni.openLocation({
+		// 				latitude: latitude,
+		// 				longitude: longitude,
+		// 				success: function () {
+		// 					console.log('success');
+		// 				}
+		// 			});
+		// 		if (!this.productInfo.coordinate) return;
+		// 		uni.makePhoneCall({
+		// 			phoneNumber: this.productInfo.telephone
+		// 		});
+		}
+		filterDict
+	}
 };
 </script>
 
-<style></style>
+<style lang="scss" scoped>
+@import 'index.scss';
+</style>

+ 9 - 3
pages/self/bill/index.vue

@@ -34,18 +34,24 @@
 </template>
 
 <script>
+import billService from '@/api/bill.js';
 export default {
 	data() {
-		return {
-		};
+		return {};
+	},
+	onLoad() {
+		this.getBillList();
 	},
 	methods: {
+		async getBillList() {
+			const data = await billService.getBillList();
+		},
 		handleOpenFilter() {
 			uni.navigateTo({
 				url: 'filter'
 			});
 		},
-		handleOpenDetail(){
+		handleOpenDetail() {
 			uni.navigateTo({
 				url: 'detail'
 			});

BIN
static/icon_pointer.png


BIN
static/img_product_detail.jpg