shish 2 ay önce
ebeveyn
işleme
ed6607e5dc

+ 4 - 1
ghsApp/src/api/order/index.js

@@ -288,4 +288,7 @@ export const getScanPayList = data => https.get("/scan-pay/list", data);
 
 export const modifyAddress = data => {
 	return https.post('/order/modify-address', data)
-}
+}
+
+//获取订单花材的筛数明细
+export const getTree = data => https.get("/order-tree/get-tree", data);

+ 1 - 0
ghsApp/src/pages.json

@@ -104,6 +104,7 @@
 			"root": "pagesOrder",
 			"pages": [
 				{"path": "detail","style": {"navigationBarTitleText": "订单详情", "enablePullDownRefresh": true}},
+				{"path": "tree","style": {"navigationBarTitleText": "数量", "enablePullDownRefresh": true}},
 				{"path": "showOrder","style": {"navigationBarTitleText": "订单", "enablePullDownRefresh": true}},
 				{"path": "info","style": {"navigationBarTitleText": "订单详情", "enablePullDownRefresh": true}},
 				{"path": "arrival","style": {"navigationBarTitleText": "确认发货"}},

+ 8 - 2
ghsApp/src/pagesOrder/detail.vue

@@ -302,10 +302,10 @@
 									<text class="item-count" v-else>-</text>
 								</view>
 							</view>
-							<view class="dish-tag-row" v-if="detailInfo.shopBusiness == 2">
+							<view class="dish-tag-row" v-if="detailInfo.shopBusiness == 2" @click="goTree(s)">
 								<text class="dish-num" v-if="Number(s.dishNum)>0">{{ s.dishNum }}筛</text>
 								<text class="dish-num" v-else>-</text>
-								<button class="admin-button-com middle dish-print-btn" @click.stop="">打印</button>
+								<button class="admin-button-com middle dish-print-btn" @click.stop="printTree(s)">打印</button>
 							</view>
 						</view>
 					</view>
@@ -757,6 +757,12 @@ export default {
 			// 如果不是当年,显示年月日时间 (从位置2开始截取14个字符: YYYY-MM-DD HH:)
 			return dateStr.substr(2, 14)
 		},
+		goTree(item){
+			this.$util.pageTo({url: '/pagesOrder/tree?orderSn='+this.detailInfo.orderSn+'&productId='+item.productId})
+		},
+		printTree(item){
+			console.log(item,'printTree')
+		},
 		toggleFinanceInfo() {
 			this.showFinanceInfo = !this.showFinanceInfo
 		},

+ 124 - 0
ghsApp/src/pagesOrder/tree.vue

@@ -0,0 +1,124 @@
+<template>
+	<view class="tree-page">
+		<view class="tree-empty" v-if="loading">加载中...</view>
+		<view class="tree-empty" v-else-if="!rows.length">{{ emptyText }}</view>
+		<view class="tree-row" v-else v-for="(row, rowIndex) in rows" :key="rowIndex">
+			<text class="row-index">第{{ rowIndex + 1 }}筛</text>
+			<view class="num-list">
+				<text class="num-item" v-for="(num, numIndex) in row" :key="numIndex">{{ num }}</text>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+import { getTree } from "@/api/order"
+export default {
+	name: "tree",
+	components: {},
+	mixins: [],
+	data() {
+		return {
+			option: {},
+			rows: [],
+			loading: false,
+			emptyText: "暂无数据"
+        }
+    },
+	onLoad(option){
+		this.option = option || {}
+		this.init()
+    },
+    methods: {
+        init(){
+            let orderSn = this.option.orderSn||''
+            let productId = this.option.productId||0
+			this.loading = true
+			this.emptyText = "暂无数据"
+            getTree({ orderSn, productId }).then(res=>{
+                if(res.code == 1){
+                    let list = (res.data && res.data.list) || []
+					this.rows = this.formatRows(list)
+					if (!this.rows.length) {
+						this.emptyText = "暂无数量数据"
+					}
+				} else {
+					this.rows = []
+					this.emptyText = res.msg || "获取数据失败"
+                }
+            }).catch(() => {
+				this.rows = []
+				this.emptyText = "获取数据失败"
+			}).finally(() => {
+				this.loading = false
+            })
+        },
+		formatRows(list) {
+			let nums = []
+			list.forEach(item => {
+				if (Array.isArray(item)) {
+					item.forEach(child => {
+						if (child && child.num !== undefined) {
+							nums.push(child.num)
+						} else if (typeof child === "number" || typeof child === "string") {
+							nums.push(child)
+						}
+					})
+				} else if (item && item.num !== undefined) {
+					nums.push(item.num)
+				}
+			})
+
+			let rows = []
+			for (let i = 0; i < nums.length; i += 5) {
+				rows.push(nums.slice(i, i + 5))
+			}
+			return rows
+		}
+    }
+}
+</script>
+<style lang="scss" scoped>
+.tree-page {
+	padding: 24upx;
+}
+
+.tree-row {
+	display: flex;
+	align-items: center;
+	margin-top: 20upx;
+
+	&:first-child {
+		margin-top: 0;
+	}
+}
+
+.tree-empty {
+	padding-top: 120upx;
+	text-align: center;
+	color: #999;
+	font-size: 32upx;
+}
+
+.row-index {
+	width: 120upx;
+	color: #3385FF;
+	font-size: 32upx;
+}
+
+.num-list {
+	flex: 1;
+	display: flex;
+	align-items: center;
+}
+
+.num-item {
+	min-width: 80upx;
+	margin-left: 16upx;
+	font-size: 34upx;
+	color: #333;
+
+	&:first-child {
+		margin-left: 0;
+	}
+}
+</style>