浏览代码

企业服务接口对接;
空数据展示样式;

Sinea 1 年之前
父节点
当前提交
2ef13d755f
共有 7 个文件被更改,包括 160 次插入132 次删除
  1. 2 1
      api/index.js
  2. 13 0
      api/product.js
  3. 111 89
      pages/index/product/category.vue
  4. 8 16
      pages/index/product/index.vue
  5. 22 22
      pages/self/enterprise/components/BaseInfo.vue
  6. 1 0
      static/svg/bags.svg
  7. 3 4
      utils/util.js

+ 2 - 1
api/index.js

@@ -1,11 +1,12 @@
 const baseRequest = async (url, method, data = {}, loading = true) => {
 	let header = {}
+	url = url.indexOf('https://') > -1 ? url : 'https://xnh.xazhima.com/prod-api/wap/business/weixin' + url
 	return new Promise((reslove, reject) => {
 		loading && uni.showLoading({
 			title: '加载中'
 		})
 		uni.request({
-			url: 'https://xnh.xazhima.com/prod-api/wap/business/weixin' + url,
+			url,
 			method: method || 'GET',
 			header: header,
 			timeout: 10000,

+ 13 - 0
api/product.js

@@ -0,0 +1,13 @@
+import request from '@/api'
+
+const openid = uni.getStorageSync('openid')
+const url = 'https://xnh.xazhima.com/prod-api/wap/finance/product'
+
+const productService = {
+	// 获取产品分类表
+	getCategoryList: () => request.get(url + '/category'),
+	// 获取分类下产品列表
+	getProductList: params => request.get(url + '/list', params)
+}
+
+export default productService

+ 111 - 89
pages/index/product/category.vue

@@ -1,95 +1,86 @@
 <template>
 	<view class="page-wrap">
 		<scroll-view scroll-y class="nav-panel">
-			<view :class="{ item: true, active: navActive === item.value }" @click="navActive = item.value" v-for="(item, index) in navList" :key="index">
-				{{ item.label }}
+			<view :class="{ item: true, active: navActive === index }" @click="navActive = index" v-for="(item, index) in navList" :key="index">
+				{{ item.categoryName }}
 			</view>
 		</scroll-view>
 		<view class="product-panel">
-			<view class="item">
-				<view class="box">记账报税(年度)</view>
-				<view class="name">记账报税(年度)</view>
-				<view class="desc">记账+报税记账+报税记账+报税记账+报税记账+报税记账+报税记账+报税记账+报税记账+报税</view>
+			<view class="item" v-for="(item, index) in productList" :key="index" @click="handleOpenDetail(item.id)">
+				<view class="box">{{ item.name }}</view>
+				<view class="name">{{ item.name }}</view>
+				<view class="desc">{{ item.title }}</view>
 				<view class="tags">
-					<view class="tag">下单送礼品</view>
-					<view class="tag">返券</view>
+					<view class="tag" v-for="(tag, tagIndex) in item.tags" :key="tagIndex">{{ filterDict(tag, tagList) }}</view>
 				</view>
-				<view class="price" data-text="年">3600</view>
+				<view class="price">{{ item.salePrice }}</view>
 			</view>
-			<view class="item">
-				<view class="box">记账报税(年度)</view>
-				<view class="name">记账报税(年度)</view>
-				<view class="desc">记账+报税</view>
-				<view class="tags">
-					<view class="tag">下单送礼品</view>
-					<view class="tag">返券</view>
-				</view>
-				<view class="price" data-text="年">3600</view>
-			</view>
-			<view class="item">
-				<view class="box">记账报税(年度)</view>
-				<view class="name">记账报税(年度)</view>
-				<view class="desc">记账+报税</view>
-				<view class="tags">
-					<view class="tag">下单送礼品</view>
-					<view class="tag">返券</view>
-				</view>
-				<view class="price" data-text="年">3600</view>
+			<view class="abnor-panel" v-if="!productList.length">
+				<image class="icon" src="../../../static/svg/bags.svg"></image>
+				暂无数据
 			</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 {
-			navActive: 1,
-			navList: [
-				{
-					label: '记账报税',
-					value: 1
-				},
-				{
-					label: '税控托管',
-					value: 2
-				},
-				{
-					label: '社保代缴',
-					value: 3
-				},
-				{
-					label: '出口退税',
-					value: 4
-				},
-				{
-					label: '财税代办',
-					value: 5
-				},
-				{
-					label: '工商代办',
-					value: 6
-				},
-				{
-					label: '银行代办',
-					value: 7
-				},
-				{
-					label: '资质·许可',
-					value: 8
-				},
-				{
-					label: '法律咨询',
-					value: 9
-				},
-				{
-					label: '超值套餐',
-					value: 10
-				}
-			]
+			navActive: 0,
+			navList: [],
+			productList: [],
+			tagList: []
 		};
 	},
-	methods: {}
+	watch: {
+		navActive() {
+			this.getProductList();
+		}
+	},
+	onLoad() {
+		this.getCategoryList();
+		this.getTagConfig();
+	},
+	methods: {
+		// 获取分类列表
+		async getCategoryList() {
+			const { data } = await productService.getCategoryList();
+			this.navList = data;
+			this.getProductList();
+		},
+		// 获取产品列表
+		async getProductList() {
+			const { navActive, navList } = this;
+			const { categoryName } = navList[navActive];
+			const { rows } = await productService.getProductList({
+				categoryOne: categoryName,
+				categoryTwo: categoryName
+			});
+			this.productList = rows.map((item) => {
+				return {
+					...item,
+					tags: item.label ? item.label.split(',') : []
+				};
+			});
+		},
+		// 获取标签配置
+		async getTagConfig() {
+			const { rows } = await systemService.getDict('fin_product_tag');
+			this.tagList = rows;
+		},
+		// 打开商品详情
+		handleOpenDetail(id) {
+			uni.navigateTo({
+				url: 'index?id=' + id
+			});
+		},
+		// 引用方法需要手动注入,否则报错
+		filterDict
+	}
 };
 </script>
 
@@ -97,6 +88,7 @@ export default {
 .page-wrap {
 	padding-left: 164.84rpx;
 }
+
 .nav-panel {
 	position: fixed;
 	left: 0;
@@ -104,7 +96,8 @@ export default {
 	bottom: 0;
 	width: 164.84rpx;
 	background: #f2f2f2;
-	.item{
+
+	.item {
 		white-space: nowrap;
 		overflow: hidden;
 		text-overflow: ellipsis;
@@ -114,24 +107,28 @@ export default {
 		font-size: 24.73rpx;
 		color: #333;
 	}
-	.active{
+
+	.active {
 		color: #00bcd2;
 		background: #fff;
 	}
 }
-.product-panel{
-	.item{
+
+.product-panel {
+	.item {
 		height: 192.31rpx;
 		background: #fff;
 		position: relative;
 		padding: 13.74rpx 20.6rpx 0 199.18rpx;
 		box-sizing: border-box;
 		border-bottom: 1rpx solid #e0e0e0;
-		&:last-child{
+
+		&:last-child {
 			border: none;
 		}
 	}
-	.box{
+
+	.box {
 		width: 157.97rpx;
 		height: 157.97rpx;
 		position: absolute;
@@ -148,46 +145,53 @@ export default {
 		padding: 0 13.74rpx;
 		box-sizing: border-box;
 	}
-	.name{
+
+	.name {
 		font-size: 27.47rpx;
 		white-space: nowrap;
 		overflow: hidden;
 		text-overflow: ellipsis;
 	}
-	.desc{
+
+	.desc {
 		font-size: 24.73rpx;
 		color: #999;
 		display: -webkit-box;
 		overflow: hidden;
 		text-overflow: ellipsis;
-		-webkit-line-clamp: 2; 
+		-webkit-line-clamp: 2;
 		-webkit-box-orient: vertical;
 		max-height: 82.42rpx;
 		word-break: break-all;
 	}
-	.tags{
+
+	.tags {
 		overflow: hidden;
-		.tag{
+
+		.tag {
 			float: left;
 			font-size: 21.98rpx;
-			color: #F97631;
+			color: #f97631;
 			padding: 2.75rpx 13.74rpx;
-			border: 1rpx solid #F97631;
+			border: 1rpx solid #f97631;
 			margin: 13.74rpx 13.74rpx 0 0;
 		}
 	}
-	.price{
+
+	.price {
 		font-size: 41.21rpx;
-		color: #F97631;
+		color: #f97631;
 		position: absolute;
 		right: 20.6rpx;
 		bottom: 20.6rpx;
 		line-height: 1;
-		&:before{
+
+		&:before {
 			content: '¥';
 			font-size: 24.73rpx;
 		}
-		&::after{
+
+		&::after {
 			content: attr(data-text);
 			font-size: 21.98rpx;
 			color: #999;
@@ -196,4 +200,22 @@ export default {
 		}
 	}
 }
+.abnor-panel {
+	position: fixed;
+	left: 50%;
+	top: 50%;
+	transform: translate(-50%, -50%);
+	margin-left: 82.42rpx;
+	display: flex;
+	flex-direction: column;
+	white-space: nowrap;
+	align-items: center;
+	font-size: 27.47rpx;
+	color: #999;
+	.icon {
+		width: 137.36rpx;
+		height: 137.36rpx;
+		margin-bottom: 41.21rpx;
+	}
+}
 </style>

+ 8 - 16
pages/index/product/index.vue

@@ -1,22 +1,14 @@
 <template>
-	<view>
-		
-	</view>
+	<view>123</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
+export default {
+	data() {
+		return {};
+	},
+	methods: {}
+};
 </script>
 
-<style>
-
-</style>
+<style></style>

+ 22 - 22
pages/self/enterprise/components/BaseInfo.vue

@@ -7,72 +7,72 @@
 		</view>
 		<view class="row">
 			<view class="label">企业全称</view>
-			<input class="text" type="text" placeholder="必填" placeholder-class="gray" v-model="form.customerName" maxlength="40"/>
+			<input class="text" type="text" placeholder="必填" placeholder-class="gray" v-model="form.customerName" maxlength="40" />
 		</view>
 		<view class="row">
 			<view class="label">企业简称</view>
-			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.customerTitle" maxlength="30"/>
+			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.customerTitle" maxlength="30" />
 		</view>
 		<view class="row">
 			<view class="label">统一信用代码</view>
-			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.customerUsci" maxlength="18"/>
+			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.customerUsci" maxlength="18" />
 		</view>
 		<view class="row">
 			<view class="label">注册资本</view>
-			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.capital" maxlength="12"/>
+			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.capital" maxlength="12" />
 		</view>
 		<view class="row no-border">
 			<view class="label">注册地址</view>
-			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.address" maxlength="40"/>
+			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.address" maxlength="40" />
 		</view>
 		<view class="space"></view>
 		<picker :range="companyTypeList" range-key="dictLabel" @change="onCompanyTypePickerChange">
 			<view class="row">
 				<view class="label">企业类型</view>
-				<view :class="{text: true, gray: !form.companyType}">{{ form.companyType ? filterDict(form.companyType, companyTypeList) : '请选择' }}</view>
+				<view :class="{ text: true, gray: !form.companyType }">{{ form.companyType ? filterDict(form.companyType, companyTypeList) : '请选择' }}</view>
 				<image class="arrow" src="@/static/svg/arrow.svg"></image>
 			</view>
 		</picker>
 		<picker :range="companyTaxList" range-key="dictLabel" @change="onCompanyTaxPickerChange">
 			<view class="row">
 				<view class="label">纳税性质</view>
-				<view :class="{text: true, gray: !form.tax}">{{ form.tax ? filterDict(form.tax, companyTaxList) : '请选择' }}</view>
+				<view :class="{ text: true, gray: !form.tax }">{{ form.tax ? filterDict(form.tax, companyTaxList) : '请选择' }}</view>
 				<image class="arrow" src="@/static/svg/arrow.svg"></image>
 			</view>
 		</picker>
 		<picker mode="region" @change="onRegionPickerChange">
 			<view class="row">
 				<view class="label">所属地区</view>
-				<view :class="{text: true, gray: !form.region}">{{ form.region || '请选择' }}</view>
+				<view :class="{ text: true, gray: !form.region }">{{ form.region || '请选择' }}</view>
 				<image class="arrow" src="@/static/svg/arrow.svg"></image>
 			</view>
 		</picker>
 		<picker :range="companyIndustryList" range-key="dictLabel" @change="onCompanyIndustryPickerChange">
 			<view class="row">
 				<view class="label">所属行业</view>
-				<view :class="{text: true, gray: !form.industry}">{{ form.industry ? filterDict(form.industry, companyIndustryList) : '请选择' }}</view>
+				<view :class="{ text: true, gray: !form.industry }">{{ form.industry ? filterDict(form.industry, companyIndustryList) : '请选择' }}</view>
 				<image class="arrow" src="@/static/svg/arrow.svg"></image>
 			</view>
 		</picker>
 		<picker :range="companySizeList" range-key="dictLabel" @change="onCompanySizePickerChange">
 			<view class="row">
 				<view class="label">人员规模</view>
-				<view :class="{text: true, gray: !form.staffSize}">{{ form.staffSize ? filterDict(form.staffSize, companySizeList) : '请选择' }}</view>
+				<view :class="{ text: true, gray: !form.staffSize }">{{ form.staffSize ? filterDict(form.staffSize, companySizeList) : '请选择' }}</view>
 				<image class="arrow" src="@/static/svg/arrow.svg"></image>
 			</view>
 		</picker>
 		<view class="space"></view>
 		<view class="row">
 			<view class="label">联系人</view>
-			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.contact" maxlength="20"/>
+			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.contact" maxlength="20" />
 		</view>
 		<view class="row">
 			<view class="label">联系电话</view>
-			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.tel" maxlength="11"/>
+			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.tel" maxlength="11" />
 		</view>
 		<view class="row">
 			<view class="label">电子件接收邮箱</view>
-			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.email" maxlength="20"/>
+			<input class="text" type="text" placeholder="选填" placeholder-class="gray" v-model="form.email" maxlength="20" />
 		</view>
 	</view>
 </template>
@@ -103,28 +103,28 @@ export default {
 			companyTypeList: [],
 			companyTaxList: [],
 			companyIndustryList: [],
-			companySizeList: [],
+			companySizeList: []
 		};
 	},
 	created() {
 		this.getOptionsConfig();
 	},
-	mounted(){
-		if(this.enterpriseId) this.getEnterpriseInfo()
+	mounted() {
+		if (this.enterpriseId) this.getEnterpriseInfo();
 	},
 	beforeDestroy() {
 		this.updateEnterpriseInfo();
 	},
 	methods: {
 		// 获取企业资料
-		async getEnterpriseInfo(){
-			console.log('获取企业资料')
+		async getEnterpriseInfo() {
+			console.log('获取企业资料');
 		},
 		// 修改企业资料
 		async updateEnterpriseInfo() {
-			if(!this.form.customerName) return
+			if (!this.form.customerName) return;
 			await enterpriseService.addEnterprise(this.form);
-			uni.$emit('onUpdateEnterprise')
+			uni.$emit('onUpdateEnterprise');
 		},
 		// 获取选项配置
 		async getOptionsConfig() {
@@ -203,8 +203,8 @@ export default {
 			height: 82.42rpx;
 			border-radius: 50%;
 		}
-		
-		/deep/.gray{
+
+		/deep/.gray {
 			color: #ccc;
 		}
 	}

文件差异内容过多而无法显示
+ 1 - 0
static/svg/bags.svg


+ 3 - 4
utils/util.js

@@ -1,7 +1,6 @@
 // 字典枚举列表查询
 export function filterDict(callValue, enumDict) {
-	console.log(callValue, enumDict)
-  let filterData = {};
-  if (Array.isArray(enumDict)) filterData = enumDict.find((item) => item.dictValue === callValue);
-  return filterData ? filterData.dictLabel : "--";
+	let filterData = {};
+	if (Array.isArray(enumDict)) filterData = enumDict.find((item) => item.dictValue === callValue);
+	return filterData ? filterData.dictLabel : "--";
 }