From cc82b6cd32ab9e23171591915f5257c2e75871f4 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 12 二月 2026 18:20:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 mini-program/pagesA/pages/order/order.vue |  495 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 453 insertions(+), 42 deletions(-)

diff --git a/mini-program/pagesA/pages/order/order.vue b/mini-program/pagesA/pages/order/order.vue
index 9db8856..4c3c1b2 100644
--- a/mini-program/pagesA/pages/order/order.vue
+++ b/mini-program/pagesA/pages/order/order.vue
@@ -1,60 +1,443 @@
 <template>
 	<view class="box">
 		<view class="cate">
-			<view @click="i = index" :class="i === index ? 'cate-item active' : 'cate-item'" v-for="(item, index) in list" :key="index">
-				{{item}}
-				<view class="cate-item-xiab" v-if="i === index"></view>
+			<view @click="changeRow(item)" :class="active === index ? 'cate-item active' : 'cate-item'" v-for="(item, index) in cate" :key="index">
+				{{item.name}}
+				<view class="cate-item-xiab" v-if="active === index"></view>
 			</view>
 		</view>
 		<view class="list">
-			<view class="list-item" v-for="(item, index) in 5" :key="index">
-				<view class="a">
+			<view class="list-item" v-for="(item, index) in dataList" :key="index">
+				<view class="a"  @click="jumpOrderDetail(item.id)">
 					<view class="a-left">
-						<view class="a-left-tips">鑷彁</view>
-						<text>榧庡厓鍐滄満涓�鍙风粡閿�鍟�</text>
+						<view :class="'a-left-tips '+(item.receiveType==1?'shop-top-tips-a':'shop-top-tips-b')">{{item.receiveType==1?'鑷彁':'閰嶉��'}}</view>
+						<text>璁㈠崟鍙凤細{{item.code}}</text>
 					</view>
-					<view class="a-right">寰呬粯娆撅細</view>
+					<text v-if="item.status ==0" class="a-right">寰呮敮浠�</text>
+					<text  v-if="item.status ==1" class="a-right">{{item.receiveType==1?'寰呰嚜鎻�':'寰呭彂璐�'}}</text>
+					<text  v-if="item.status ==2" class="a-right">寰呮敹璐�</text>
+					<text  v-if="item.status ==3" class="a-right grey">浜ゆ槗瀹屾垚</text>
+					<text  v-if="item.status ==4" class="a-right grey">宸插彇娑�</text>
+					<text  v-if="item.status ==6" class="a-right grey">宸查��娆�</text>
 				</view>
-				<view class="b">
-					<view class="b-item">
+				<view class="b"  @click="jumpOrderDetail(item.id)">
+					<view class="b-item" v-for="(item1, index1) in (item.goodsorderDetailList||[])"  >
 						<view class="b-item-image">
-							<image src="/static/logo.png" mode="widthFix"></image>
+							<image :src="item1.imgurl||'/static/static/default2.png'" mode="widthFix"></image>
 						</view>
-						<view class="b-item-title">涓仈鑹剧瀹介娇 閫傜敤闆锋矁/涓仈/涔呬繚鐢�</view>
+						<view class="b-item-title">{{item1.name||''}}</view>
 						<view class="b-item-jia">
-							<text>楼499.00</text>
-							<text>x1</text>
+							<text>楼{{(item1.price||0).toFixed(2)}}</text>
+							<text>x{{item1.goodsNum||0}}</text>
 						</view>
 					</view>
 				</view>
 				<view class="c">
 					<view class="c-label">
-						<view class="c-label-title">闇�浠樻锛�</view>
+						<view class="c-label-title">瀹炰粯娆撅細</view>
 						<view class="c-label-price">
-							<text>998</text>
-							<text>.00</text>
+							<text>{{(item.price||0).toFixed(2)}}</text>
+							<text></text>
 						</view>
 					</view>
-					<view class="c-btns">
-						<view class="c-btns-item blue">鑱旂郴瀹㈡埛</view>
-						<view class="c-btns-item bluebg">鑷彁鏍搁攢</view>
+					<view class="c-btns" v-if="userType ==1">
+						<view class="c-btns-item blue" @click="contactPhone(item)">鑱旂郴瀹㈡埛</view>
+						<view class="c-btns-item bg" v-if="item.status==1 && item.receiveType==1" @click="hexiaoOrder(item)">鑷彁鏍搁攢</view>
+					</view>
+					<view class="c-btns" v-if="userType !=1"> 
+						<view class="c-btns-item grey" @click="cancelOrder(item)" v-if="item.status==0 || item.status==1">鍙栨秷璁㈠崟</view> 
+						<view class="c-btns-item grey" @click="deleteOrder(item)" v-if="item.status==4">鍒犻櫎璁㈠崟</view> 
+						<view class="c-btns-item blue" @click="openQrcode(item)"  v-if="item.status==1 && item.receiveType==1">鑷彁鐮�</view>
+						<view class="c-btns-item blue" @click="payOrder(item)" v-if="item.status==0">鍘绘敮浠�</view> 
+						<view class="c-btns-item blue" @click="doneOrder(item)" v-if="item.status==2">纭鏀惰揣</view>
 					</view>
 				</view>
-				<view class="d">
-					璁㈠崟澶囨敞锛�11鏈�22鏃ユ潵鎷�
+				<view class="d" v-if="item.memberInfo"  @click="jumpOrderDetail(item.id)">
+					璁㈠崟澶囨敞锛歿{item.memberInfo||''}}
 				</view>
 			</view>
+			<view v-if="!hasNext" class="nomore">宸插姞杞藉叏閮�</view>
 		</view>
+		<u-popup :show="showPhone" round="15" mode="bottom" :safeAreaInsetBottom="true"  @close="contactPhone()" :closeable="true" :closeOnClickOverlay="true">
+			<view class="phone">
+				<view class="phone-head">
+					<view></view>
+					<text>鑱旂郴瀹㈡埛</text> 
+				</view>
+				<!-- <view class="phone-item">
+					<view>
+						<image style="width: 36rpx;height: 36rpx" src="/static/icon/ic_kefu.png" mode="widthFix"></image>
+						<button open-type="contact" plain="true" bindcontact="handleContact">鍦ㄧ嚎瀹㈡湇</button>
+					</view>
+					 <view class="line" v-if="serverPhone && serverPhone.length"></view>
+				</view> -->
+				 <view class="phone-item" >
+				 	<view>
+						<image src="/static/icon/ic_call@2x.png" mode="widthFix" @click="contactPhoneDo()" ></image>
+						<text>{{linkItem.linkname||''}} </text> 
+						<text style="margin-left: 10px;"> {{linkItem.linkphone||''}}</text> 
+					</view> 
+				 </view>  
+				 <view style="width: 100%; height: 30rpx;"></view>
+				<!-- <view class="phone-botton"  @click="contactPhone()" >鍏抽棴</view> -->
+			</view>
+		</u-popup>
+		<!-- 纭鏀惰揣 -->
+		<u-popup :show="showDone" round="15" :safeAreaInsetBottom="false" mode="center">
+			<view class="tc">
+				<view class="tc-contemt">
+					<view class="tc-contemt-title">纭鏀惰揣鎻愰啋</view>
+					<view class="tc-contemt-nr">
+						鎮ㄧ‘璁ゅ凡缁忔敹鍒板晢鍝佷簡鍚楋紵
+					</view>
+				</view>
+				<view class="tc-btn">
+					<view class="tc-btn-item" @click="showDone = false;currentOrder=null;">鍙栨秷</view>
+					<view class="tc-btn-item" style="color: #004096;" @click="doneOrderDo()">纭鏀惰揣</view>
+				</view>
+			</view>
+		</u-popup>
+		<!-- 鍙栨秷璁㈠崟 -->
+		<u-popup :show="showCancel" round="15" :safeAreaInsetBottom="false" mode="center">
+			<view class="tc">
+				<view class="tc-contemt">
+					<view class="tc-contemt-title">纭畾鍙栨秷鎻愰啋</view>
+					<view class="tc-contemt-nr">
+						鎮ㄧ‘璁ゅ彇娑堣璁㈠崟鍚楋紵
+					</view>
+				</view>
+				<view class="tc-btn">
+					<view class="tc-btn-item" @click="showCancel = false;currentOrder=null;">鎴戝啀鎯虫兂</view>
+					<view class="tc-btn-item" style="color: red;" @click="cancelOrderDo">纭鍙栨秷</view>
+				</view>
+			</view>
+		</u-popup>
+		<!-- 鍒犻櫎璁㈠崟 -->
+		<u-popup :show="showDelete" round="15" :safeAreaInsetBottom="false" mode="center">
+			<view class="tc">
+				<view class="tc-contemt">
+					<view class="tc-contemt-title">纭鍒犻櫎鎻愰啋</view>
+					<view class="tc-contemt-nr">
+						鎮ㄧ‘璁ゅ垹闄よ璁㈠崟鍚楋紵
+					</view>
+				</view>
+				<view class="tc-btn">
+					<view class="tc-btn-item" @click="showDelete = false;currentOrder=null;">鎴戝啀鎯虫兂</view>
+					<view class="tc-btn-item" style="color: red;" @click="deleteOrderDo">纭鍒犻櫎</view>
+				</view>
+			</view>
+		</u-popup>
+		<u-popup :show="showQrcode" round="15" @close="openQrcode()"   :safeAreaInsetBottom="false" mode="bottom"  :closeable="true" :closeOnClickOverlay="false">
+			<view class="tc" style="width: 100%;">
+				<view class="tc-contemt">
+					<view class="tc-contemt-title" style="text-align: center;">鑷彁鐮�</view>
+					<view class="tc-contemt-nr" style="border: 1rpx solid #f2f2f2;width: 150px;height: 150px;">
+						<image style="border: 1rpx solid #f2f2f2;width: 150px;height: 150px;" v-if="currentOrder && currentOrder.qrCodeBase64" :src="currentOrder.qrCodeBase64"  model="widthFix" ></image>
+					</view>
+					 <view class="tc-contemt-title" style="text-align: center;">{{currentOrder.exchangeCode|| ''}}</view>
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
 <script>
+	import { mapState } from 'vuex'
+	import QRCode from 'qrcode';
 	export default {
+		computed: {
+			...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
+		},
 		data() {
 			return {
-				i: 0,
-				list: ['鍏ㄩ儴', '寰呮敮浠�', '寰呰嚜鎻�']
+				i: '',
+				currentOrder:null,
+				showDone:false,
+				showCancel:false,
+				showDelete:false,
+				showQrcode:false,
+				showPay:false,
+				showPhone:false,
+				loading:false,
+				active:0,
+				currentPage:1,
+				total:0,
+				hasNext:true,
+				userType:null,
+				dataList:[],
+				shop:{}, 
+				linkItem:{},
+				cate:[],
+				cate1: [
+					{ name: '鍏ㄩ儴', id: '' ,index:0},
+					{ name: '寰呮敮浠�', id: 0 ,index:1},
+					{ name: '寰呭彂璐�/鑷彁', id: 1,index:2 }
+				],
+				cate0: [
+					{ name: '鍏ㄩ儴', id: '' ,index:0},
+					{ name: '寰呮敮浠�', id: 0 ,index:1},
+					{ name: '寰呭彂璐�/鑷彁', id: 1,index:2 },
+					{ name: '寰呮敹璐�', id: 2 ,index:3},
+				]
 			};
+		},
+		onLoad(options) {
+			console.log(options )
+			this.active = 0
+			this.cate =[]
+			this.userType = Number(options.userType)
+			if(this.userType == 1){
+				this.shop  ={}
+				this.checkShopLogin()
+				this.shop = this.shopInfo || {}
+			    this.cate =this.cate1;
+			}else{
+				 this.cate =this.cate0;
+			}
+			if (options.status) {
+				this.active =  Number(options.status)
+				this.i = this.cate[this.active].id
+			}
+			this.getFirstPageData()
+			var that =this
+			uni.$on('updateOrder',function(data){
+				console.log('鐩戝惉鍒颁簨浠舵潵鑷� update 锛屾惡甯﹀弬鏁� msg 涓猴細' ,data);
+				if(data.delete == 1){
+					//鍒犻櫎璁㈠崟锛屽己鍒跺埛鏂版暟鎹�
+					that.getFirstPageData()
+				}else if(data.info!=null && data.info.orderId!=null){
+					  console.log('鐩戝惉鍒颁簨浠舵潵鑷� update 01锛�' ,data);
+					that.dataList.forEach((item,index)=>{
+						if(item.id==data.info.orderId){
+							 console.log('鐩戝惉鍒颁簨浠舵潵鑷� update 02锛�' ,data);
+							item.status = data.info.orderStatus
+						}
+					}) 
+				}
+				
+			 })
+		},
+		onShow() {
+			this.showDone=false
+			this.showCancel=false
+			this.showDelete=false
+			this.showQrcode=false
+			this.showPay=false
+			this.showPhone=false
+			this.loading=false,
+			this.currentOrder=null
+		},
+		onReachBottom(){
+			this.getDataList();
+		},
+		methods: {
+			async openQrcode(item){
+				this.currentOrder = null
+				var that =this
+				if(!this.showQrcode){
+					this.currentOrder = item
+					if(this.currentOrder.qrCodeBase64 == undefined && this.currentOrder.qrCodeBase64==null){
+						try {
+							const ocanvas = uni.createOffscreenCanvas({ type: "2d" });
+							const qrCodeBase64 = await QRCode.toDataURL(ocanvas,this.currentOrder.exchangeCode, {
+								scale: 1, // 浜岀淮鐮佺殑缂╂斁姣斾緥锛屽彲浠ユ牴鎹渶瑕佽皟鏁�
+								width: 150, // 浜岀淮鐮佺殑瀹藉害锛屽彲浠ユ牴鎹渶瑕佽皟鏁�
+								margin: 1 // 浜岀淮鐮佸懆鍥寸殑绌虹櫧杈硅窛锛屽彲浠ユ牴鎹渶瑕佽皟鏁�
+							}); 
+							this.currentOrder.qrCodeBase64 =qrCodeBase64
+							that.showQrcode = true
+						} catch (err) {
+							uni.showToast({
+								title:'鐢熸垚鑷彁鐮佸け璐�',
+								icon:'error'
+							})
+						}
+					}else{
+						that.showQrcode = true
+					}
+				}else{
+					this.showQrcode = false
+				}
+			},
+			hexiaoOrder(item){
+				uni.navigateTo({
+					url:'/pagesA/pages/write-off-a/write-off-a?id='+item.id
+				})
+			},
+			cancelOrder(item){
+				this.currentOrder = null
+				this.showCancel = !this.showCancel
+				if(this.showCancel){
+					this.currentOrder = item
+				}
+			},
+			deleteOrder(item){
+				this.currentOrder = null
+				this.showDelete = !this.showDelete
+				if(this.showDelete){
+					this.currentOrder = item
+				}
+			},
+			
+			payOrder(item){
+			},
+			doneOrder(item){
+				this.currentOrder = null
+				this.showDone = !this.showDone
+				if(this.showDone){
+					this.currentOrder = item
+				}
+			},
+			async  doneOrderDo(){
+				if(this.userType == 1 || this.currentOrder==null || this.currentOrder.id == null) {
+					return
+				}
+				var that =this
+				let res = await this.$u.api.affirmOrder({ orderId: this.currentOrder.id  });
+				if (res.code === 200 ) { 
+					//淇敼璁㈠崟鐘舵��
+					this.dataList.forEach(item=>{
+						if(item.id==this.currentOrder.id){
+							item.status =3
+						}
+					}) 
+					this.doneOrder()
+				}else{
+					/* uni.showToast({
+						title:res.message||'纭畾鏀惰揣澶辫触锛�',
+						icon:'error'
+					}) */
+				}
+			},
+			async cancelOrderDo(){
+				if(this.userType == 1 || this.currentOrder==null || this.currentOrder.id == null) {
+					return
+				}
+					var that =this
+				let res = await that.$u.api.cancelOrder({ orderId: this.currentOrder.id  });
+				if (res.code === 200 ) { 
+					//淇敼璁㈠崟鐘舵��
+					this.dataList.forEach(item=>{
+						if(item.id==this.currentOrder.id){
+							item.status = 4
+						}
+					}) 
+					this.cancelOrder()
+				}else{
+					/* uni.showToast({
+						title:res.message||'鍙栨秷璁㈠崟澶辫触锛�',
+						icon:'error'
+					}) */
+				}
+			},
+			async deleteOrderDo(){
+				if(this.userType == 1 || this.currentOrder==null || this.currentOrder.id == null) {
+					return
+				}
+				var that =this
+				let res = await that.$u.api.delOrder({ orderId: this.currentOrder.id  });
+				if (res.code === 200 ) { 
+					//淇敼璁㈠崟鐘舵��
+					/* var tindex = -1;
+					this.dataList.forEach((item,index)=>{
+						if(item.id==this.currentOrder.id){
+							tindex = index
+						}
+					}) 
+					if(tindex>=0){
+						this.dataList.splice(tindex,1)
+					} */
+					this.getFirstPageData()
+				}else{
+					/* uni.showToast({
+						title:res.message||'鍒犻櫎璁㈠崟澶辫触锛�',
+						icon:'error'
+					}) */
+				}
+			},
+			contactPhone(item){
+				 this.showPhone = !this.showPhone
+				 this.linkItem = item ||{}
+				 console.log("==================================",this.showPhone)
+			},
+			contactPhoneDo(){ 
+				if(this.linkItem.linkphone !=null && this.linkItem.linkphone!=''){
+					uni.makePhoneCall({
+					   phoneNumber: this.linkItem.linkphone  
+					})
+				}
+			},
+			changeRow( item) {
+				 this.active=item.index
+				 this.i = item.id
+				this.getFirstPageData()
+			},
+			getFirstPageData(){
+				this.currentPage = 0
+				this.hasNext=true
+				this.total=0
+				this.dataList=[]
+				this.getDataList()
+			},
+			async getDataList(){
+					if(this.loading || !this.hasNext){
+						return
+					}
+					this.loading=true
+					this.currentPage =   this.currentPage+1
+					if(this.currentPage == 1){
+						this.hasNext =true
+						this.dataList=[]
+					}
+					var that =this 
+					let res ={};
+					if(this.userType == 1){
+						res = await that.$u.api.shopOrderPage({
+								capacity:10,
+								model: {
+									receiveType: 1, 
+									status: this.i
+								},
+								page:this.currentPage
+							});
+					}else{
+						res = await that.$u.api.orderPage({
+								capacity:10,
+								model: {
+									receiveType: 1, 
+									status: this.i
+								},
+								page:this.currentPage
+							});
+					}
+					console.log(res)
+					if (res.code === 200 ) { 
+						if ( res.data && res.data.page ===this.currentPage) { 
+							res.data.records = res.data.records||[]
+							 that.dataList.push(...res.data.records)
+							 that.total=res.data.total
+							 if( this.currentPage >= res.data.pageCount||0){
+								 that.hasNext=false
+							 }else{
+								 that.hasNext=true
+							 }
+						}
+					} 
+					this.loading=false
+			},
+			jumpOrderDetail(id){
+				uni.navigateTo({
+					url: '/pagesA/pages/order-details/order-details?userType='+this.userType+'&id='+id
+				})
+			}, 
+			checkShopLogin(){
+				var that =this
+				if( this.shopInfo ==null || this.shopInfo.id==null ||  this.shopToken==null || this.shopToken==''){
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				} 
+			}
 		}
 	}
 </script>
@@ -69,6 +452,7 @@
 		.list {
 			width: 100%;
 			padding: 22rpx 30rpx;
+			padding-bottom: 60rpx;
 			box-sizing: border-box;
 			.list-item {
 				width: 100%;
@@ -91,13 +475,20 @@
 						.a-left-tips {
 							padding: 0 6rpx;
 							height: 40rpx;
-							line-height: 40rpx;
-							background: #00B775;
+							line-height: 40rpx; 
 							border-radius: 8rpx;
 							font-weight: 400;
 							font-size: 22rpx;
 							color: #FFFFFF;
 							margin-right: 16rpx;
+						}
+						.shop-top-tips-a {
+							background: #00B775; 
+							border: 1rpx solid #00B775;
+						}
+						.shop-top-tips-b {
+							background: #004096;
+							border: 1rpx solid #004096;
 						}
 						text {
 							font-weight: 400;
@@ -110,10 +501,25 @@
 						font-size: 26rpx;
 						color: #E4001D;
 					}
+					.grey{
+						color: #999999 !important;
+					}
+				}
+				.d{
+					width: 100%;
+					padding:20rpx 20rpx;
+					margin-top: 22rpx;
+					background: #F8F9FB;
+					border-radius: 8rpx;
+					font-weight: 400;
+					font-size: 26rpx;
+					color: #666666;
+					line-height: 36rpx;
+					text-align: left;
+					font-style: normal;
 				}
 				.b {
 					width: 100%;
-					height: 136rpx;
 					display: flex;
 					flex-direction: column;
 					margin-top: 22rpx;
@@ -145,6 +551,10 @@
 							font-size: 30rpx;
 							color: #222222;
 							margin-right: 30rpx;
+							display: -webkit-box;
+							-webkit-line-clamp: 2; /* 闄愬埗鏂囨湰涓�2琛� */
+							-webkit-box-orient: vertical;
+							overflow: hidden;
 						}
 						.b-item-jia {
 							flex-shrink: 0;
@@ -211,9 +621,21 @@
 							border: 1rpx solid #004096;
 							color: #004096 !important;
 						}
-						.bluebg {
-							background: #004096 !important;
+						.grey {
+							border: 1rpx solid #666666;
+							color: #666666 !important;
+						}
+						.bg{
+							background: #004096;
+							border-radius: 34rpx;
+							border: 1rpx solid #004096;
+							font-family: PingFangSC, PingFang SC;
+							font-weight: 400;
+							font-size: 28rpx;
 							color: #FFFFFF !important;
+							line-height: 40rpx;
+							text-align: center;
+							font-style: normal;
 						}
 						.c-btns-item {
 							padding: 0 24rpx;
@@ -223,27 +645,16 @@
 							align-items: center;
 							justify-content: center;
 							border-radius: 34rpx;
-							border: 1rpx solid #B2B2B2;
+							// border: 1rpx solid #B2B2B2;
 							font-weight: 400;
 							font-size: 28rpx;
-							color: #666666;
+							// color: #666666;
 							margin-right: 20rpx;
 							&:last-child {
 								margin: 0 !important;
 							}
 						}
 					}
-				}
-				.d {
-					width: 100%;
-					padding: 20rpx;
-					box-sizing: border-box;
-					background: #F8F9FB;
-					border-radius: 8rpx;
-					font-weight: 400;
-					font-size: 26rpx;
-					color: #666666;
-					margin-top: 24rpx;
 				}
 			}
 		}

--
Gitblit v1.9.3