Browse Source

确定调拨、取消调拨、分页、提交调拨

qianduan 1 year ago
parent
commit
1ba48a6be1

+ 7 - 2
pages.json

@@ -42,8 +42,7 @@
 		{
 			"path": "pages/information/index",
 			"style": {
-				"navigationBarTitleText": "消息中心",
-				"enablePullDownRefresh": false
+				"navigationStyle": "custom"
 			}
 		},
 		{
@@ -59,6 +58,12 @@
 			}
 		},
 		{
+			"path": "pages/information/transferRecord",
+			"style": {
+				"navigationStyle": "custom"
+			}
+		},
+		{
 			"path": "pages/order/index",
 			"style": {
 				"navigationBarTitleText": "订单",

+ 9 - 2
pages/indexRouter.vue

@@ -4,7 +4,7 @@
 		<Home :dataList="dataList" :genreTitle="genreTitle" ref="home" v-if="nowchos === 0"></Home>
 		<!-- isorders == 0 同时userType == 3 送气员 -->
 		<Order v-else-if="nowchos === 1 && isorders == 0 && userType == 3"></Order>
-		<Information v-else-if="steelCylinder(isorders,userType)"></Information>
+		<Information ref="cylinder" v-else-if="steelCylinder(isorders,userType)"></Information>
 		<Mine :token="token" :userInfo="userInfo" v-else-if="getType(isorders,userType)"></Mine>
 		<view class="bottomboxs">
 			<x-navbottom :nowchos='nowchos' @botomchos='botomchos'></x-navbottom>
@@ -120,7 +120,14 @@
 				genreTitle: '',
 			}
 		},
-		onLoad() {
+		onReachBottom() {
+			this.$refs.cylinder.bottomingEvent()
+		},
+		onLoad(value) {
+			console.log(value, 333)
+			if (value.page) {
+				this.nowchos = value.page
+			}
 			var userInfo = this.$cache.getCache('userInfo')
 			if (userInfo.provUser) {
 				if (userInfo.provUser.isorders == 0 && userInfo.provUser.userType == 3) {

+ 4 - 1
pages/information/cylinder.vue

@@ -20,7 +20,7 @@
 					<view class="title_subhead">连续扫码增加</view>
 				</view>
 			</view>
-			<view>
+			<view v-if="codeList.length > 0">
 				<view class="space_between card_code_trac" v-for="(item,index) in codeList" :key="index">
 					<view style="display: flex;align-items: center;">
 						<view class="item_current">{{index + 1}}</view>
@@ -29,6 +29,9 @@
 					<view class="item_title1 title_red" @click="delCode(index)">删除</view>
 				</view>
 			</view>
+			<view style="margin-top: 20%;" v-else>
+				<u-empty mode="list" text="请先扫描添加钢瓶编号"></u-empty>
+			</view>
 		</view>
 		<view style="width: 100%;height: 120rpx;"></view>
 		<view class="card_btn">

+ 70 - 17
pages/information/index.vue

@@ -1,21 +1,25 @@
 <template>
 	<!-- 我的钢瓶 -->
-	<view class="card_information">
-		<view class="head_mine_title">我的钢瓶</view>
-		<view style="width: 100%;">
-			<u-tabs :list="bottleList" lineWidth="40" :scrollable="false" @click="bottleClick"></u-tabs>
+	<view>
+		<view class="head_sticky">
+			<view class="head_mine_title">我的钢瓶</view>
+			<view style="width: 100%;">
+				<u-tabs :list="bottleList" lineWidth="40" :scrollable="false" @click="bottleClick"></u-tabs>
+			</view>
 		</view>
+		<!-- 在这里放置可滚动的内容 -->
 		<view style="width: 100%;" v-if="list.length > 0">
 			<view class="card_dinay" v-for="(item,index) in list" :key="index">
 				<view style="display: flex;align-items: center;">
 					<view class="item_current">{{index + 1}}</view>
 					<view class="item_title1">{{item.inner_code}}</view>
 				</view>
-				<view class="iconfont icon-yehuaqiping icon_cylinder"></view>
+				<view class="iconfont icon-yehuaqiping icon_cylinder" :style="{color:getColor()}"></view>
 			</view>
+			<view style="width: 100%;height: 150rpx;"></view>
 		</view>
 		<view class="empty_information" v-else>
-			<u-empty mode="message"></u-empty>
+			<u-empty mode="list" text="暂无钢瓶"></u-empty>
 		</view>
 		<view class="card_button_bottom">
 			<view class="bottom_btn_flex">
@@ -41,30 +45,66 @@
 					name: '不合格瓶区'
 				}],
 				current: 1,
+				Pagination: {
+					PageIndex: 1,
+					PageSize: 20,
+					Total: 0,
+				},
+				loadingMore: true,
 			}
 		},
 		mounted() {
 			uni.$on('refresh', () => {
+				this.list = []
+				this.Pagination.PageIndex = 1
 				this.getList()
 			})
 			this.getList()
 		},
 		methods: {
+			// 触底事件
+			bottomingEvent() {
+				if (!this.loadingMore) {
+					this.getList()
+				}
+			},
 			bottleClick(value) {
 				this.current = value.index + 1
+				this.Pagination.PageIndex = 1
 				this.list = []
 				this.getList()
 			},
 			// 获取列表
 			getList() {
+				this.loadingMore = true;
 				this.$api.get('/api/gas-cylinder-status', {
+					page: this.Pagination.PageIndex,
+					pageSize: this.Pagination.PageSize,
 					status: this.current,
 				}).then(res => {
 					if (res.code == 200) {
-						this.list = res.data.list
+						const data = res.data.list
+						if (this.loadingMore == true && data) {
+							this.list = this.list.concat(data);
+						}
+						if (data.length < this.Pagination.PageSize) {
+							this.loadingMore = true
+						} else {
+							this.loadingMore = false
+							this.Pagination.PageIndex++
+						}
 					}
 				})
 			},
+			getColor() {
+				if (this.current == 1) {
+					return '#19be6b'
+				} else if (this.current == 2) {
+					return '#ff9900'
+				} else if (this.current == 3) {
+					return '#fa3534'
+				}
+			},
 			// 添加钢瓶
 			addCylinder() {
 				uni.navigateTo({
@@ -83,15 +123,22 @@
 
 <style lang="scss" scoped>
 	.head_mine_title {
-		margin: 20rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		padding-top: 20rpx;
+		font-size: 36rpx;
+		font-weight: 600;
 	}
 
-	.card_information {
+	.head_sticky {
+		position: -webkit-sticky;
+		position: sticky;
+		top: 0;
+		/* 设置吸顶的位置 */
+		background: #fff;
+		z-index: 1000;
 		padding-top: var(--status-bar-height);
-		margin: 0rpx 20rpx;
-		display: flex;
-		flex-direction: column;
-		align-items: center;
 	}
 
 	.card_dinay {
@@ -105,7 +152,7 @@
 	}
 
 	.item_current {
-		width: 40rpx;
+		min-width: 40rpx;
 		color: #82848a;
 	}
 
@@ -118,19 +165,21 @@
 	}
 
 	.card_button_bottom {
-		position: absolute;
+		position: fixed;
 		bottom: 20rpx;
 		left: 0;
 		right: 0;
 		background-color: #fff;
-		margin-bottom: 100rpx;
+		height: 120rpx;
+		margin-bottom: 80rpx;
 		padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
 		padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
 		display: flex;
-		align-items: center;
+		align-items: flex-start;
 	}
 
 	.bottom_btn_flex {
+		margin-top: 20rpx;
 		flex: 1;
 		display: flex;
 		align-items: center;
@@ -144,4 +193,8 @@
 		color: #fff;
 		border-radius: 10rpx;
 	}
+
+	.empty_information {
+		margin-top: 30%;
+	}
 </style>

+ 64 - 7
pages/information/transfer.vue

@@ -35,11 +35,11 @@
 					</view>
 				</view>
 			</view>
-			<view style="width: 100%;">
+			<view style="width: 100%;" v-if="list.length > 0">
 				<u-checkbox-group v-model="checked">
 					<view style="width: 100%;display: flex;flex-direction: column;">
 						<view class="card_dinay" v-for="(item,index) in list" :key="index">
-							<u-checkbox :name="item.id"></u-checkbox>
+							<u-checkbox :name="item.inner_code"></u-checkbox>
 							<view style="display: flex;align-items: center;margin-left: 20rpx;">
 								<view class="item_current">{{index + 1}}</view>
 								<view class="item_title1">{{item.inner_code}}</view>
@@ -48,6 +48,9 @@
 					</view>
 				</u-checkbox-group>
 			</view>
+			<view style="margin-top: 20%;" v-else>
+				<u-empty mode="list" text="暂无钢瓶"></u-empty>
+			</view>
 		</view>
 		<view style="width: 100%;height: 120rpx;"></view>
 		<view class="card_btn">
@@ -92,7 +95,21 @@
 				}, {
 					id: '25',
 					title: '送气员重瓶出库'
-				}]
+				}, {
+					id: 'Unqualified',
+					title: '回收不合格钢瓶'
+				}],
+				Pagination: {
+					PageIndex: 1,
+					PageSize: 20,
+					Total: 0,
+				},
+				loadingMore: true,
+			}
+		},
+		onReachBottom() {
+			if (!this.loadingMore) {
+				this.getList()
 			}
 		},
 		onLoad(value) {
@@ -104,17 +121,55 @@
 		methods: {
 			// 获取列表
 			getList() {
+				this.loadingMore = true
 				this.$api.get('/api/gas-cylinder-status', {
+					page: this.Pagination.PageIndex,
+					pageSize: this.Pagination.PageSize,
 					status: this.current,
 				}).then(res => {
 					if (res.code == 200) {
-						this.list = res.data.list
+						const data = res.data.list
+						if (this.loadingMore == true && data) {
+							this.list = this.list.concat(data);
+						}
+						if (data.length < this.Pagination.PageSize) {
+							this.loadingMore = true
+						} else {
+							this.loadingMore = false
+							this.Pagination.PageIndex++
+						}
 					}
 				})
 			},
 			// 调拨提交
 			submit() {
-
+				if (this.assignerData.length > 0) {
+					if (this.checked.length > 0) {
+						this.$api.post('/api/gas-cylinder-allot', {
+							optType: this.assignerData[0],
+							acceptUserId: Number(this.assignerData[1]),
+							acceptCompanyId: Number(this.assignerData[3]),
+							innerCodeList: this.checked,
+							gasCylinderStatus: this.current,
+						}).then(res => {
+							if (res.code == 200) {
+								this.loadingMore = true
+								this.Pagination.PageIndex = 1
+								this.list = []
+								this.getList()
+								this.checked = []
+								uni.$u.toast(res.msg)
+							} else {
+								uni.$u.toast(res.data.msg)
+							}
+							this.$forceUpdate()
+						})
+					} else {
+						uni.$u.toast('请先选择调拨钢瓶')
+					}
+				} else {
+					uni.$u.toast('请先扫描调拨码')
+				}
 			},
 			// 扫一扫
 			allotSweep() {
@@ -173,15 +228,17 @@
 				const result = this.list.slice(0, value)
 				this.checked = []
 				result.forEach(item => {
-					this.checked.push(item.id)
+					this.checked.push(item.inner_code)
 				})
+				this.$forceUpdate()
 			},
 			// 全选
 			checkAll() {
 				this.checked = []
 				this.list.forEach(item => {
-					this.checked.push(item.id)
+					this.checked.push(item.inner_code)
 				})
+				this.$forceUpdate()
 			}
 		}
 	}

+ 191 - 0
pages/information/transferRecord.vue

@@ -0,0 +1,191 @@
+<template>
+	<!-- 调拨记录 -->
+	<view>
+		<u-navbar title="调拨记录" autoBack placeholder></u-navbar>
+		<view style="padding-bottom: 30rpx;" v-if="list.length > 0">
+			<view class="transfer_card_item" v-for="(item,index) in list" :key="index">
+				<view class="title_status" :style="{color:getColor(item.status)}">{{ getstatus(item.status) }}</view>
+				<view class="item_title_record1">
+					<span>调拨人:</span>
+					{{item.allotUser.nickName}}
+				</view>
+				<view class="item_title_record">
+					<span>接收人:</span>
+					{{item.acceptUser.nickName}}
+				</view>
+				<view class="item_title_record">
+					<span>调拨时间:</span>
+					{{item.createdAt}}
+				</view>
+				<view class="item_title_record">
+					<span>钢瓶编号:</span>
+					<span class="examine_title" @click="clickToView(item)">点击查看</span>
+				</view>
+			</view>
+		</view>
+		<view style="margin-top: 40%;" v-else>
+			<u-empty mode="list" text="暂无调拨记录"></u-empty>
+		</view>
+		<u-popup :show="innerCodeShow" round="10" @close="close">
+			<view>
+				<view class="headlinetitle">钢瓶编号</view>
+				<view class="card_inner_item" v-for="(item,index) in innerCodeData" :key="index">
+					<view class="title_index_item">{{index + 1}}</view>
+					<view>{{item}}</view>
+				</view>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				list: [],
+				Pagination: {
+					PageIndex: 1,
+					PageSize: 20,
+					Total: 0,
+				},
+				loadingMore: true,
+				innerCodeShow: false,
+				innerCodeData: []
+			}
+		},
+		onReachBottom() {
+			if (!this.loadingMore) {
+				this.getList()
+			}
+		},
+		mounted() {
+			this.getList()
+		},
+		methods: {
+			getList() {
+				this.loadingMore = true
+				this.$api.get('/api/gas-cylinder-allot', {
+					page: this.Pagination.PageIndex,
+					pageSize: this.Pagination.PageSize,
+				}).then(res => {
+					if (res.code == 200) {
+						const data = res.data.list
+						if (this.loadingMore == true && data) {
+							this.list = this.list.concat(data);
+						}
+						if (data.length < this.Pagination.PageSize) {
+							this.loadingMore = true
+						} else {
+							this.loadingMore = false
+							this.Pagination.PageIndex++
+						}
+					}
+				})
+			},
+			// 点击查看
+			clickToView(value) {
+				this.innerCodeShow = true
+				this.innerCodeData = value.innerCodeList
+			},
+			getstatus(value) {
+				if (value == 1) {
+					return '调拨中'
+				} else if (value == 2) {
+					return '调拨完成'
+				} else if (value == 3) {
+					return '取消调拨'
+				} else if (value == 4) {
+					return '超时取消'
+				}
+			},
+			getColor(value) {
+				if (value == 1) {
+					return '#3c9cff'
+				} else if (value == 2) {
+					return '#5ac725'
+				} else if (value == 3) {
+					return '#909399'
+				} else if (value == 4) {
+					return '#909399'
+				}
+			},
+			close() {
+				this.innerCodeShow = false
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	page {
+		background-color: #f4f4f5;
+	}
+
+	.transfer_card_item {
+		position: relative;
+		background-color: #fff;
+		margin: 30rpx;
+		padding: 30rpx;
+		border-radius: 10rpx;
+	}
+
+	.title_status {
+		position: absolute;
+		right: 20rpx;
+		top: 20rpx;
+		display: flex;
+		justify-content: flex-end;
+		font-size: 28rpx;
+	}
+
+	.item_title_record1 {
+		font-size: 30rpx;
+
+		span {
+			font-size: 28rpx;
+			color: #909399;
+		}
+
+		.examine_title {
+			cursor: pointer;
+			color: #2979ff;
+		}
+	}
+
+	.item_title_record {
+		font-size: 30rpx;
+		margin-top: 10rpx;
+
+		span {
+			font-size: 28rpx;
+			color: #909399;
+		}
+
+		.examine_title {
+			cursor: pointer;
+			color: #2979ff;
+		}
+	}
+
+	.title_index_item {
+		color: #909399;
+		margin-right: 20rpx;
+	}
+
+	.headlinetitle {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		padding: 20rpx;
+		font-size: 34rpx;
+		font-weight: 600;
+		border-bottom: 1rpx solid #d7d7d7;
+	}
+
+	.card_inner_item {
+		display: flex;
+		align-items: center;
+		padding: 30rpx;
+		border-bottom: 1rpx solid #d7d7d7;
+	}
+</style>

+ 0 - 1
pages/mine/erweima.vue

@@ -27,7 +27,6 @@
 		mounted() {
 			var userInfo = this.$cache.getCache('userInfo')
 			this.userInfo = userInfo
-			console.log(userInfo,776)
 			const qr = new UQRCode();
 			qr.data = '二维码内容';
 			qr.size = 200;

+ 143 - 8
pages/order/cannibalize.vue

@@ -1,9 +1,36 @@
 <template>
 	<view>
 		<u-navbar :title="headTile" autoBack placeholder></u-navbar>
-		<view class="card_erweima_af">
-			<canvas id="qrcode" canvas-id="qrcode" style="width: 140px;height:140px;" />
-			<view class="title_balize">调拨码</view>
+		<view class="card_cannibalize">
+			<view class="card_erweima_af">
+				<canvas id="qrcode" canvas-id="qrcode" style="width: 140px;height:140px;" />
+				<view class="title_balize">调拨码</view>
+			</view>
+			<view v-if="transferFlag">
+				<view class="subheading_title">调拨人</view>
+				<view style="display: flex;align-items: center;">
+					<image class="mine_image" src="../../static/portrait.png" mode=""></image>
+					<view class="card_user_title">
+						<view class="mine_phone" v-if="transferList.allotUser">{{transferList.allotUser.nickName}}
+						</view>
+						<view class="mine_phone" v-if="transferList.allotCompany">{{transferList.allotCompany.name}}
+						</view>
+					</view>
+				</view>
+				<view class="subheading_title1">钢瓶编号</view>
+				<view class="card_innercode" v-for="(item1,index1) in transferList.innerCodeList" :key="index1">
+					<view style="color: #82848a;">{{ index1 + 1 }}</view>
+					<view class="title_innerCode">{{ item1 }}</view>
+				</view>
+			</view>
+		</view>
+		<view class="btn_cannibalize" v-if="transferFlag">
+			<view style="flex: 1;">
+				<u-button style="width: 80%;" type="error" @click="cancelAllocation">取消</u-button>
+			</view>
+			<view style="flex: 1;">
+				<u-button style="width: 80%;" type="primary" @click="submit">确定</u-button>
+			</view>
 		</view>
 	</view>
 </template>
@@ -15,6 +42,8 @@
 			return {
 				orderId: '',
 				headTile: '',
+				transferList: {},
+				transferFlag: false,
 			}
 		},
 		onLoad(value) {
@@ -34,9 +63,57 @@
 			const ctx = uni.createCanvasContext('qrcode', this);
 			qr.canvasContext = ctx;
 			qr.drawCanvas();
+
+			this.getallot()
 		},
 		methods: {
-
+			getallot() {
+				this.$api.get('/api/gas-cylinder-allot/opt-type/' + this.orderId).then(res => {
+					if (res.code == 200) {
+						this.transferFlag = true
+						this.transferList = res.data
+					} else {
+						setTimeout(() => {
+							this.getallot()
+						}, 60000);
+					}
+				})
+			},
+			// 取消调拨
+			cancelAllocation() {
+				this.$api.post('/api/gas-cylinder-allot/cancel', {
+					id: this.transferList.id,
+				}).then(res => {
+					if (res.code == 200) {
+						this.transferFlag = false
+						this.transferList = {}
+						uni.$u.toast(res.msg)
+					}
+				})
+			},
+			// 确定调拨钢瓶
+			submit() {
+				this.$api.post('/api/gas-cylinder-allot/submit', {
+					id: this.transferList.id,
+					optType: this.transferList.optType,
+					allotUserId: this.transferList.allotUserId,
+					acceptUserId: this.transferList.acceptUserId,
+					allotCompanyId: this.transferList.allotCompanyId,
+					acceptCompanyId: this.transferList.acceptCompanyId,
+					innerCodeList: this.transferList.innerCodeList,
+				}).then(res => {
+					if (res.code == 200) {
+						this.transferFlag = false
+						this.transferList = {}
+						uni.$u.toast(res.msg)
+						setTimeout(() => {
+							uni.redirectTo({
+								url: '/pages/indexRouter?page=1'
+							});
+						}, 1500)
+					}
+				})
+			}
 		}
 	}
 </script>
@@ -46,20 +123,78 @@
 		background-color: #f4f4f5;
 	}
 
-	.card_erweima_af {
+	.card_cannibalize {
 		display: flex;
-		align-items: center;
-		justify-content: center;
-		margin: 30rpx;
 		flex-direction: column;
 		background-color: #fff;
+		margin: 30rpx;
 		padding: 30rpx;
 		border-radius: 10rpx;
 	}
 
+	.card_erweima_af {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		flex-direction: column;
+	}
+
 	.title_balize {
 		font-size: 40rpx;
 		margin-top: 10rpx;
 		font-weight: 600;
 	}
+
+	.mine_image {
+		width: 100rpx;
+		height: 100rpx;
+		border-radius: 50%;
+	}
+
+	.card_user_title {
+		display: flex;
+		flex-direction: column;
+		align-items: flex-start;
+	}
+
+	.mine_phone {
+		margin-left: 20rpx;
+		font-size: 30rpx;
+	}
+
+	.card_innercode {
+		display: flex;
+		padding: 20rpx;
+		border-bottom: 1rpx solid #d7d7d7;
+	}
+
+	.subheading_title {
+		font-size: 34rpx;
+		font-weight: 600;
+		margin: 20rpx 0rpx;
+	}
+
+	.subheading_title1 {
+		font-size: 34rpx;
+		font-weight: 600;
+		margin-top: 20rpx;
+		padding-bottom: 20rpx;
+		border-bottom: 1rpx solid #d7d7d7;
+	}
+
+	.title_innerCode {
+		font-size: 30rpx;
+		margin-left: 10rpx;
+	}
+
+	.btn_cannibalize {
+		position: fixed;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		background-color: #fff;
+		display: flex;
+		align-items: center;
+		padding: 20rpx 0rpx;
+	}
 </style>

+ 16 - 1
pages/order/cylinderTransfer.vue

@@ -2,7 +2,7 @@
 	<view>
 		<u-navbar title="钢瓶调拨" autoBack placeholder></u-navbar>
 		<view style="width: 100%;">
-			<view class="transfer_cardil">
+			<view class="transfer_cardil" @click="transferRecord">
 				<view class="title_eeeeiul">调拨记录</view>
 				<u-icon name="file-text" size="30"></u-icon>
 			</view>
@@ -26,6 +26,9 @@
 				}, {
 					id: '016',
 					title: '确认重瓶到达气站'
+				}, {
+					id: 'Unqualified',
+					title: '回收不合格钢瓶'
 				}],
 				// 司机
 				dataList2: [{
@@ -37,6 +40,9 @@
 				}, {
 					id: '033',
 					title: '确认重瓶从门店出库'
+				}, {
+					id: 'Unqualified',
+					title: '回收不合格钢瓶'
 				}],
 				// 门店
 				dataList3: [{
@@ -48,6 +54,9 @@
 				}, {
 					id: '21',
 					title: '门店回收空瓶'
+				}, {
+					id: 'Unqualified',
+					title: '回收不合格钢瓶'
 				}],
 				// 送气员
 				dataList4: [{
@@ -82,6 +91,12 @@
 				uni.navigateTo({
 					url: '/pages/order/cannibalize?type=' + value.id + '&title=' + value.title
 				});
+			},
+			// 调拨记录
+			transferRecord() {
+				uni.navigateTo({
+					url: '/pages/information/transferRecord'
+				});
 			}
 		}
 	}

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/app-plus/app-config-service.js


File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/app-plus/app-service.js


File diff suppressed because it is too large
+ 85 - 68
unpackage/dist/dev/app-plus/app-view.js


Some files were not shown because too many files changed in this diff