hwb0 3 سال پیش
والد
کامیت
a6d61e2320
8فایلهای تغییر یافته به همراه72 افزوده شده و 30 حذف شده
  1. 5 3
      pages/choice/index.vue
  2. 2 1
      pages/core/index.vue
  3. 22 11
      pages/order/detail.vue
  4. 20 7
      pages/order/index.vue
  5. 11 2
      pages/order/settlement.vue
  6. 1 1
      pages/prize/coupon.vue
  7. 1 1
      pages/prize/detail.vue
  8. 10 4
      pages/prize/index.vue

+ 5 - 3
pages/choice/index.vue

@@ -50,10 +50,12 @@
 				$http.post('/api/v1/mp/user/ticket/queryHitPrizeList', data).then(res => {
 					uni.hideLoading();
 					if (res.code == 0) {
-						res.data.forEach(item => {
-							item.picUrl = env.filePublic + item.picUrl
+						res.data.prizeList.forEach(item => {
+							let picUrlArr = item.picUrl.split(',')
+							item.picUrl = env.filePublic + picUrlArr[0]
 						})
-						this.prizeList = res.data
+						this.prizeList = res.data.prizeList
+						this.ticketId = res.data.ticketId
 						this.total = res.data.length
 					}
 				}).catch(() => {

+ 2 - 1
pages/core/index.vue

@@ -59,7 +59,8 @@
 						uni.hideLoading();
 						if (res.code == 0) {
 							res.rows.forEach(item => {
-								item.picUrl = env.filePublic + item.picUrl
+								let picUrlArr = item.picUrl.split(',')
+								item.picUrl = env.filePublic + picUrlArr[0]
 							})
 							this.total = res.total
 							this.list = this.list.concat(res.rows)

+ 22 - 11
pages/order/detail.vue

@@ -116,7 +116,8 @@
 					this.info = res.data
 					this.status = JSON.parse(res.data.status)
 					res.data.items.forEach(item => {
-						item.picUrl = env.filePublic + item.picUrl
+						let picUrlArr = item.picUrl.split(',')
+						item.picUrl = env.filePublic + picUrlArr[0]
 					})
 					this.list = res.data.items
 				}).catch(() => {
@@ -125,17 +126,24 @@
 			},
 
 			cancelOrder() {
-				return
-				$http.post('/api/v1/mp/user/deliver/order/cancel', {
-					orderId: this.orderId
-				}).then(res => {
-					if (res.code == 0) {
-						uni.$u.toast('订单取消成功');
-						setTimeout(() => {
-							uni.navigateBack({
-								delta: 1
+				uni.showModal({
+					title: '提示',
+					content: '您确认要取消订单吗?',
+					success(res) {
+						if (res.confirm) {
+							$http.post('/api/v1/mp/user/deliver/order/cancel', {
+								orderId: this.orderId
+							}).then(res => {
+								if (res.code == 0) {
+									uni.$u.toast('订单取消成功');
+									setTimeout(() => {
+										uni.navigateBack({
+											delta: 1
+										})
+									}, 500)
+								}
 							})
-						}, 500)
+						}
 					}
 				})
 			},
@@ -144,11 +152,13 @@
 				let _this = this
 				let payIng = false
 				if (payIng) return
+				uni.showLoading();
 				$http.post('/api/v1/mp/user/deliver/order/pay', {
 					orderId: _this.info.orderId,
 					payType: 2
 				}).then(ele => {
 					payIng = true
+					uni.hideLoading();
 					if (ele.code == 0) {
 						uni.requestPayment({
 							timeStamp: ele.data.timeStamp,
@@ -179,6 +189,7 @@
 				}).catch(() => {
 					payIng = false
 					uni.$u.toast('支付失败!');
+					uni.hideLoading();
 				})
 			},
 		}

+ 20 - 7
pages/order/index.vue

@@ -108,7 +108,8 @@
 						res.rows.forEach(item => {
 							let items = item.items
 							items.forEach(item => {
-								item.picUrl = env.filePublic + item.picUrl
+								let picUrlArr = item.picUrl.split(',')
+								item.picUrl = env.filePublic + picUrlArr[0]
 							})
 							item.status = JSON.parse(item.status)
 						})
@@ -128,12 +129,21 @@
 			},
 
 			cancelOrder(id) {
-				$http.post('/api/v1/mp/user/deliver/order/cancel', {
-					orderId: id
-				}).then(res => {
-					if (res.code == 0) {
-						uni.$u.toast('订单取消成功');
-						this.pageList()
+				let _this = this
+				uni.showModal({
+					title: '提示',
+					content: '您确认要取消订单吗?',
+					success(res) {
+						if (res.confirm) {
+							$http.post('/api/v1/mp/user/deliver/order/cancel', {
+								orderId: id
+							}).then(res => {
+								if (res.code == 0) {
+									uni.$u.toast('订单取消成功');
+									_this.pageList()
+								}
+							})
+						}
 					}
 				})
 			},
@@ -142,10 +152,12 @@
 				let _this = this
 				let payIng = false
 				if (payIng) return
+				uni.showLoading();
 				$http.post('/api/v1/mp/user/deliver/order/pay', {
 					orderId: item.orderId,
 					payType: 2
 				}).then(ele => {
+					uni.hideLoading();
 					payIng = true
 					if (ele.code == 0) {
 						uni.requestPayment({
@@ -173,6 +185,7 @@
 				}).catch(() => {
 					payIng = false
 					uni.$u.toast('支付失败!');
+					uni.hideLoading();
 				})
 			},
 

+ 11 - 2
pages/order/settlement.vue

@@ -129,8 +129,10 @@
 				let _this = this
 				let payIng = false
 				if (payIng) return
+				uni.showLoading();
 				$http.post('/api/v1/mp/user/deliver/order/submit', {}).then(res => {
 					payIng = true
+					uni.hideLoading();
 					if (res.code == 0) {
 						if (res.data.needPay == 1) {
 							$http.post('/api/v1/mp/user/deliver/order/pay', {
@@ -158,6 +160,11 @@
 										},
 										fail() {
 											payIng = false
+											setTimeout(()=>{
+												uni.redirectTo({
+													url: `/pages/order/index`
+												})
+											},500)
 										}
 									})
 								} else {
@@ -176,7 +183,7 @@
 							})
 							setTimeout(()=>{
 								uni.redirectTo({
-									url: `/pages/order/index?back=1`
+									url: `/pages/order/index`
 								})
 							},500)
 						}
@@ -187,6 +194,7 @@
 				}).catch(() => {
 					payIng = false
 					uni.$u.toast('提交失败!');
+					uni.hideLoading();
 				})
 			},
 
@@ -202,7 +210,8 @@
 						this.info = res.data
 						this.addr = res.data.addr
 						res.data.prizeList.forEach(item => {
-							item.picUrl = env.filePublic + item.picUrl
+							let picUrlArr = item.picUrl.split(',')
+							item.picUrl = env.filePublic + picUrlArr[0]
 						})
 						this.list = res.data.prizeList
 					}

+ 1 - 1
pages/prize/coupon.vue

@@ -22,7 +22,7 @@
 						<view class="flex desc">
 							<view class="title">200元代金券</view>
 							<view class="txt">使用期限:2022.03.02-2022.04.01</view>
-							<view class="txt">用范围:星巴克xxx店</view>
+							<view class="txt">使用范围:星巴克xxx店</view>
 						</view>
 						<view class="flex btn">
 							<view class="amt"><text>¥</text>100</view>

+ 1 - 1
pages/prize/detail.vue

@@ -8,7 +8,7 @@
 					<view class="flex desc">
 						<view class="title">{{ info.title }}</view>
 						<view class="txt">使用期限:{{ $parseTime(info.validStart, '{y}.{m}.{d}') }}-{{ $parseTime(info.validEnd, '{y}.{m}.{d}') }}</view>
-						<view class="txt">用范围:{{ info.useAreaDesc }}</view>
+						<view class="txt">使用范围:{{ info.useAreaDesc }}</view>
 					</view>
 					<view class="flex btn">
 						<view class="amt"><text>¥</text>{{ info.discount / 100 }}</view>

+ 10 - 4
pages/prize/index.vue

@@ -32,7 +32,7 @@
 					</view>
 				</view>
 			</view>
-			<view class="flex empty" v-if="!list.length">
+			<view class="flex empty" v-if="!list.length && !loading">
 				<u-empty text="数据为空" mode="order" />
 			</view>
 		</view>
@@ -45,7 +45,7 @@
 						<view class="flex desc">
 							<view class="title">{{ item.title }}</view>
 							<view class="txt">使用期限:{{ $parseTime(item.validStart, '{y}.{m}.{d}') }}-{{ $parseTime(item.validEnd, '{y}.{m}.{d}') }}</view>
-							<view class="txt">用范围:{{ item.useAreaDesc }}</view>
+							<view class="txt">使用范围:{{ item.useAreaDesc }}</view>
 						</view>
 						<view class="flex btn">
 							<view class="amt"><text>¥</text>{{ item.discount / 100 }}</view>
@@ -54,7 +54,7 @@
 					</view>
 				</navigator>
 			</view>
-			<view class="flex empty" v-if="!list.length">
+			<view class="flex empty" v-if="!list.length && !loading">
 				<u-empty text="数据为空" mode="order" />
 			</view>
 		</view>
@@ -85,6 +85,7 @@
 	export default {
 		data() {
 			return {
+				loading: false,
 				stateArr: [{
 					name: '实物商品'
 				}, {
@@ -111,20 +112,25 @@
 				uni.showLoading({
 					title: '加载中'
 				});
+				this.loading = true
 				$http.post(`${ url }?pageNum=${_this.pageNum}&pageSize=20`, data).then(res => {
 					uni.hideLoading();
+					this.loading = false
 					if (res.code == 0) {
 						res.rows.forEach(item => {
-							item.picUrl = env.filePublic + item.picUrl
+							let picUrlArr = item.picUrl.split(',')
+							item.picUrl = env.filePublic + picUrlArr[0]
 							if (_this.state == 0) {
 								item.checked = false
 							}
 						})
 						_this.total = res.total
 						_this.list = _this.list.concat(res.rows)
+						console.log(_this.list);
 					}
 				}).catch(() => {
 					uni.hideLoading();
+					this.loading = false
 				})
 			},