浏览代码

订单列表接口;通用过滤方法封装;产品分类右侧区域滚动;

sinea17 1 年之前
父节点
当前提交
0da94819c1
共有 10 个文件被更改,包括 127 次插入97 次删除
  1. 18 1
      App.vue
  2. 5 0
      api/enterprise.js
  3. 13 0
      api/order.js
  4. 0 1
      api/product.js
  5. 14 17
      pages.json
  6. 7 21
      pages/index/product/category.vue
  7. 2 1
      pages/self/enterprise/components/BaseInfo.vue
  8. 54 56
      pages/self/order/index.vue
  9. 8 0
      utils/filter.js
  10. 6 0
      utils/util.js

+ 18 - 1
App.vue

@@ -67,7 +67,7 @@ export default {
 				success: (res) => {
 					console.log(res);
 					if (res.data.code === 200) {
-						uni.setStorageSync('openid', res.data.data.openid)
+						uni.setStorageSync('openid', res.data.data.openid);
 						getApp().globalData.open_id = res.data.data.openid;
 						getApp().globalData.session_key = res.data.data.session_key;
 						that.$isResolve();
@@ -103,6 +103,23 @@ page {
 button::after {
 	display: none;
 }
+.c-abnor {
+	position: fixed;
+	left: 50%;
+	top: 50%;
+	transform: translate(-50%, -50%);
+	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;
+	}
+}
 * {
 	touch-action: none;
 }

+ 5 - 0
api/enterprise.js

@@ -12,6 +12,11 @@ const enterpriseService = {
 	getEnterpriseList: (pageSize = 100) => request.get('/company/list', {
 		pageSize,
 		openid
+	}),
+	// 获取绑定企业详细信息
+	getEnterpriseDetail: (customer_id) => request.post('/company/info', {
+		customer_id,
+		openid
 	})
 }
 

+ 13 - 0
api/order.js

@@ -0,0 +1,13 @@
+import request from '@/api'
+
+const openid = uni.getStorageSync('openid')
+
+const orderService = {
+	// 获取我的订单列表
+	getOrderList: status => request.post('/order/list', {
+		status,
+		openid
+	})
+}
+
+export default orderService

+ 0 - 1
api/product.js

@@ -1,6 +1,5 @@
 import request from '@/api'
 
-const openid = uni.getStorageSync('openid')
 const url = 'https://xnh.xazhima.com/prod-api/wap/finance/product'
 
 const productService = {

+ 14 - 17
pages.json

@@ -142,7 +142,8 @@
 		{
 			"path": "pages/self/order/index",
 			"style": {
-				"navigationBarTitleText": "我的订单"
+				"navigationBarTitleText": "我的订单",
+				"enablePullDownRefresh": true
 			}
 		},
 		{
@@ -257,31 +258,27 @@
 			}
 		},
 		{
-			"path" : "pages/BBS/index",
-			"style" : 
-			{
-				"navigationBarTitleText" : "社区活动"
+			"path": "pages/BBS/index",
+			"style": {
+				"navigationBarTitleText": "社区活动"
 			}
 		},
 		{
-			"path" : "pages/BBS/activity",
-			"style" : 
-			{
-				"navigationBarTitleText" : "社区活动"
+			"path": "pages/BBS/activity",
+			"style": {
+				"navigationBarTitleText": "社区活动"
 			}
 		},
 		{
-			"path" : "pages/index/product/index",
-			"style" : 
-			{
-				"navigationBarTitleText" : "服务详情"
+			"path": "pages/index/product/index",
+			"style": {
+				"navigationBarTitleText": "服务详情"
 			}
 		},
 		{
-			"path" : "pages/index/product/category",
-			"style" : 
-			{
-				"navigationBarTitleText" : "企业服务"
+			"path": "pages/index/product/category",
+			"style": {
+				"navigationBarTitleText": "企业服务"
 			}
 		}
 	],

+ 7 - 21
pages/index/product/category.vue

@@ -5,7 +5,7 @@
 				{{ item.categoryName }}
 			</view>
 		</scroll-view>
-		<view class="product-panel">
+		<scroll-view scroll-y class="product-panel">
 			<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>
@@ -15,11 +15,11 @@
 				</view>
 				<view class="price">{{ item.salePrice }}</view>
 			</view>
-			<view class="abnor-panel" v-if="!productList.length">
-				<image class="icon" src="../../../static/svg/bags.svg"></image>
+			<view class="c-abnor" v-if="!productList.length">
+				<image class="icon" src="@/static/svg/bags.svg"></image>
 				暂无数据
 			</view>
-		</view>
+		</scroll-view>
 	</view>
 </template>
 
@@ -115,6 +115,7 @@ export default {
 }
 
 .product-panel {
+	height: 100vh;
 	.item {
 		height: 192.31rpx;
 		background: #fff;
@@ -200,22 +201,7 @@ export default {
 		}
 	}
 }
-.abnor-panel {
-	position: fixed;
-	left: 50%;
-	top: 50%;
-	transform: translate(-50%, -50%);
+.c-abnor {
 	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>
+</style>

+ 2 - 1
pages/self/enterprise/components/BaseInfo.vue

@@ -118,7 +118,8 @@ export default {
 	methods: {
 		// 获取企业资料
 		async getEnterpriseInfo() {
-			console.log('获取企业资料');
+			const data = await enterpriseService.getEnterpriseDetail(this.enterpriseId);
+			console.log(data);
 		},
 		// 修改企业资料
 		async updateEnterpriseInfo() {

+ 54 - 56
pages/self/order/index.vue

@@ -1,79 +1,77 @@
 <template>
 	<view class="page-wrap">
 		<view class="tabs-panel">
-			<view :class="{ item: true, active: tabActive === item.value }" v-for="(item, index) in tabList" :key="index"
-				@click="tabActive = item.value">
-				{{ item.label }}
+			<view :class="{ item: true, active: tabActive === item }" v-for="(item, index) in tabList" :key="index" @click="tabActive = item">
+				{{ item }}
 			</view>
 		</view>
 		<view class="order-panel">
-			<view class="item" @click="handleOpenOrderDetail">
+			<view class="item" v-for="(item, index) in orderList" :key="index" @click="handleOpenOrderDetail(item.orderId)">
 				<view class="head">
 					<image class="icon" src="../../../static/svg/temp.svg" mode="aspectFill"></image>
 					<view class="business">财税</view>
-					<view class="state">待审核</view>
+					<view class="state">{{ item.status || '--' }}</view>
 				</view>
 				<view class="content">
-					<view class="name">记账报税套餐(年度)</view>
-					<view class="text">订单号:10735</view>
-					<view class="text">天津超易达胜科技发展有限公司</view>
-					<view class="text">2023-10 至 2024-09</view>
-					<view class="money">¥3600.00</view>
-					<view class="sub">新签申请</view>
+					<view class="name">{{ item.productName }}</view>
+					<view class="text">订单号:{{ item.orderCode || '--' }}</view>
+					<view class="text">{{ item.company.companyName || '--' }}</view>
+					<view class="text">
+						{{ item.contractServiceStart ? item.contractServiceStart.slice(0, 7) : '--' }} 至 {{ item.contractServiceEnd ? item.contractServiceEnd.slice(0, 7) : '--' }}
+					</view>
+					<view class="money">¥{{ numberfilter(item.amount) }}</view>
+					<view class="sub">{{ item.signingTypeName || '' }}</view>
 				</view>
 			</view>
-			<view class="item">
-				<view class="head">
-					<image class="icon" src="../../../static/svg/temp.svg" mode="aspectFill"></image>
-					<view class="business">财税</view>
-					<view class="state">生效中</view>
-				</view>
-				<view class="content">
-					<view class="name">记账报税套餐(年度)</view>
-					<view class="text">订单号:10735</view>
-					<view class="text">天津超易达胜科技发展有限公司</view>
-					<view class="text">2023-10 至 2024-09</view>
-					<view class="money">¥3600.00</view>
-				</view>
+			<view class="c-abnor" v-if="!orderList.length">
+				<image class="icon" src="@/static/svg/bags.svg"></image>
+				暂无数据
 			</view>
 		</view>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				tabActive: 1,
-				tabList: [{
-						label: '全部订单',
-						value: 1
-					},
-					{
-						label: '未生效',
-						value: 2
-					},
-					{
-						label: '未生效',
-						value: 3
-					},
-					{
-						label: '已完成',
-						value: 4
-					}
-				]
-			};
-		},
-		methods: {
-			handleOpenOrderDetail() {
-				uni.navigateTo({
-					url: 'detail'
-				});
-			}
+import orderService from '@/api/order.js';
+import { numberfilter } from '@/utils/filter';
+export default {
+	data() {
+		return {
+			tabActive: '全部订单',
+			tabList: ['全部订单', '未生效', '生效中', '已完成'],
+			orderList: []
+		};
+	},
+	watch: {
+		tabActive() {
+			this.getOrderList();
 		}
-	};
+	},
+	onLoad() {
+		this.getOrderList();
+	},
+	onPullDownRefresh() {
+		this.getOrderList();
+	},
+	methods: {
+		// 获取订单列表
+		async getOrderList() {
+			const { tabActive } = this;
+			const { rows } = await orderService.getOrderList(tabActive === '全部订单' ? '' : tabActive);
+			this.orderList = rows;
+			uni.pageScrollTo({ scrollTop: 0 });
+			uni.stopPullDownRefresh();
+		},
+		handleOpenOrderDetail() {
+			uni.navigateTo({
+				url: 'detail'
+			});
+		},
+		numberfilter
+	}
+};
 </script>
 
 <style lang="scss" scoped>
-	@import 'index.scss';
-</style>
+@import 'index.scss';
+</style>

+ 8 - 0
utils/filter.js

@@ -0,0 +1,8 @@
+import {
+	isType
+} from "@/utils/util";
+
+// 数字过滤保留2位小数
+export function numberfilter(callValue) {
+	return isType(callValue) == 'number' ? callValue.toFixed(2) : '--'
+}

+ 6 - 0
utils/util.js

@@ -1,3 +1,9 @@
+// 判断数据类型
+export function isType(val) {
+	if (val === null) return "null";
+	if (typeof val !== "object") return typeof val;
+	else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase();
+}
 // 字典枚举列表查询
 export function filterDict(callValue, enumDict) {
 	let filterData = {};