Kaynağa Gözat

实物商品回收

DELL 3 yıl önce
ebeveyn
işleme
faf21aaaf5

+ 92 - 0
packageGoods/recovery/detail.vue

@@ -0,0 +1,92 @@
+<template>
+	<view>
+		<view class="item">
+			<view class="item-one">兑换成功</view>
+			<view class="item-two">商品已成功兑换,当前盲豆余额:{{coinNum}}</view>
+			<button class="item-three" @click="toCore()">去商城看看</button>
+			<button class="item-four" @click="toPrize()">进入仓库</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import $http from '@/utils/request.js'
+	export default {
+		data() {
+			return {
+				coinNum:'',
+			}
+		},
+		onShow() {
+			this.getBean()
+		},
+		methods: {
+			getBean() {
+				uni.showLoading({
+					title: '加载中'
+				});
+				$http.post('/api/v1/mp/user/mine/init', {}).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						this.coinNum = res.data.coinNum
+					}
+				}).catch(() => {
+					uni.hideLoading();
+				})
+			},
+			toCore() {
+				uni.switchTab({
+					url: '/pages/core/index'
+				})
+			},
+			toPrize() {
+				uni.navigateBack({
+					delta:2,
+					url: '/packagePrize/prize/index'
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.item {
+		text-align: center;
+
+		&-one {
+			margin-top: 450rpx;
+			color: #F9822C;
+			font-size: 40rpx;
+			line-height: 60rpx;
+		}
+
+		&-two {
+			margin-top: 32rpx;
+			color: #333;
+			font-size: 26rpx;
+			font-weight: 500;
+		}
+
+		&-three {
+			margin-top: 78rpx;
+			width: 540rpx;
+			height: 84rpx;
+			line-height: 78rpx;
+			background-color: #F9822C;
+			border: 2rpx solid #F9822C;
+			color: #fff;
+			font-size: 34rpx;
+		}
+
+		&-four {
+			margin-top: 34rpx;
+			width: 536rpx;
+			height: 80rpx;
+			line-height: 74rpx;
+			background-color: #fff;
+			border: 2rpx solid #bbb;
+			font-size: 34rpx;
+			color: #333;
+		}
+	}
+</style>

+ 257 - 0
packageGoods/recovery/index.vue

@@ -0,0 +1,257 @@
+<template>
+	<view>
+		<u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="兑换"></u-navbar>
+		<view class="settlement">
+			<!-- 商品 -->
+			<view class="settlement-goods" style="background-color: #fff">
+				<view class="settlement-goods-item">
+					<image :src="list.picUrl" mode="aspectFit"></image>
+					<view class="info">
+						<view class="info-title ells">{{ list.title }}</view>
+						<view class="info-num flex">
+							<view class="info-num-sku ells-one">规格:{{ list.properties || '-' }}</view>
+							<view class="info-num-goods">剩余数量:{{ list.goodsNum }}</view>
+						</view>
+					</view>
+				</view>
+				<view class="flex numbtn">
+					<view class="type"></view>
+					<view class="btn" @click="toRecovery">兑换数量:<view style="display: inline-block;">
+							<u-number-box input-width="25" disabledInput :max="list.goodsNum" button-size="26" color="#999999" bg-color="#F5F6F8"
+								v-model="value" @change="valChange"></u-number-box>
+						</view>
+					</view>
+				</view>
+			</view>
+			<view class="settlement-tip">
+				<view>1. 不喜欢的商品可回收兑换为盲豆<br>2. 盲豆可用于在平台商城中兑换商品<br>3. 盲豆的所属解释权归平台所有,有疑问请联系客服</view>
+			</view>
+		</view>
+		<view class="footer-fixed">
+			<view class="content">
+				<view class="content-btn flex">
+					<view class="content-btn-left">
+						<view class="money">
+							<text>总价:</text>
+							<text class="value">{{ list.returnCoin }}盲豆</text>
+						</view>
+					</view>
+					<view class="content-btn-right">
+						<text class="save" @click="save">确定兑换</text>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import env from '../../config/env.js'
+	import $http from '@/utils/request.js'
+	export default {
+		data() {
+			return {
+				list: [],
+				value: '',
+				recovery: {},
+			}
+		},
+		onLoad(opthios) {
+			if(opthios){
+				this.value = opthios.num
+				this.recovery = {
+					goodsId: opthios.goodsId,
+					num: opthios.num,
+					properties: opthios.properties,
+					skuId: opthios.skuId=="null"?null:opthios.skuId,
+					storageId: opthios.storageId,
+				}
+				this.getDetail()
+			}
+		},
+		onShow() {
+			this.getDetail()
+		},
+		methods: {
+			getDetail() {
+				uni.showLoading({
+					title: '加载中'
+				});
+				$http.post('/api/v1/mp/user/prize/recovery/settle', this.recovery).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						res.data.picUrl = env.filePublic + res.data.picUrl.split(',')[0] + '?imageView2/2/w/170'
+						this.list = res.data
+					}
+				}).catch(() => {
+					uni.hideLoading();
+				})
+			},
+			valChange(e) {
+				this.recovery.num = e.value
+				this.getDetail()
+			},
+			//确定兑
+			save() {
+				uni.showLoading({
+					title: '加载中'
+				});
+				$http.post('/api/v1/mp/user/prize/recovery/submit',{}).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						this.toRecoveryDetail()
+					}else {
+						
+					}
+				}).catch(() => {
+					uni.hideLoading();
+				})
+			},
+			
+			toRecoveryDetail() {
+				uni.navigateTo({
+					url: '/packageGoods/recovery/detail'
+				})
+			}
+			
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.settlement {
+		margin: 34rpx;
+		padding-bottom: 100rpx;
+
+		// 商品
+		&-goods {
+			margin-bottom: 34rpx;
+			background-color: #fff;
+			border-radius: 22rpx;
+			box-shadow: 0px 0px 8px 0px rgba(26, 35, 113, 0.08);
+
+			// 商品列表
+			&-item {
+				display: flex;
+				padding: 34rpx 32rpx 34rpx 22rpx;
+
+				image {
+					width: 176rpx;
+					height: 176rpx;
+					border-radius: 12rpx;
+					margin-right: 22rpx;
+				}
+
+				.info {
+					display: flex;
+					flex-direction: column;
+					justify-content: space-between;
+					flex: 1;
+					padding: 8rpx 0;
+
+					&-title {
+						font-size: 30rpx;
+						font-weight: bold;
+						line-height: 40rpx;
+					}
+
+					&-num {
+						justify-content: space-between;
+
+						&-sku {
+							flex: 1;
+							color: #666666;
+							font-size: 26rpx;
+						}
+
+						&-goods {
+							color: #666666;
+							font-size: 26rpx;
+						}
+					}
+				}
+			}
+		}
+		// 留言、运费
+		&-tip {
+			font-size: 26rpx;
+			margin-bottom: 34rpx;
+			background-color: #EEEEEE;
+			padding: 34rpx;
+			border-radius: 22rpx;
+			color: #666666;
+		
+		}
+
+		.numbtn {
+			margin: 0 50rpx;
+			border-top: #E5E5E5 2rpx solid;
+			justify-content: space-between;
+			color: #333333;
+			font-size: 30rpx;
+			font-weight: 500;
+			line-height: 100rpx;
+		}
+	}
+
+	.footer-fixed {
+		position: fixed;
+		bottom: var(--window-bottom);
+		left: 0;
+		right: 0;
+		z-index: 11;
+		box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
+		background: #fff;
+		// 设置ios刘海屏底部横线安全区域
+		padding-bottom: constant(safe-area-inset-bottom);
+		padding-bottom: env(safe-area-inset-bottom);
+
+		.content {
+			padding: 20rpx 0;
+			font-size: 30rpx;
+
+			// 不发货提示
+			&-not {
+				justify-content: flex-start;
+				font-size: 30rpx;
+				color: #F9832E;
+				margin: 0 0 30rpx;
+				padding: 0 40rpx 24rpx;
+				border-bottom: 1px solid #eee;
+			}
+
+			// 提交按钮
+			&-btn {
+				justify-content: space-between;
+				padding: 0 40rpx;
+
+				&-left {
+					.value {
+						color: #FF4208;
+					}
+				}
+
+				&-right {
+					display: flex;
+					align-items: center;
+					justify-content: flex-end;
+
+					.save {
+						width: 210rpx;
+						height: 82rpx;
+						line-height: 82rpx;
+						background: #F9822C;
+						border-radius: 40rpx;
+						text-align: center;
+						color: #fff;
+					}
+
+					.not {
+						background-color: #6c6c6c;
+					}
+				}
+
+			}
+		}
+	}
+</style>

+ 7 - 1
packagePrize/prize/index.vue

@@ -59,7 +59,7 @@
 					<!-- 来源 -->
 					<view class="prize-goods-list-item__btn flex">
 						<view class="type">来自:{{ item.inType && item.inType.desc }}</view>
-						<view class="btn">兑换盲豆</view>
+						<view class="btn" @click="toRecovery(item)" v-if="item.inType.value == '1' || item.inType.value == '2'">兑换盲豆</view>
 					</view>
 				</view>
 			</view>
@@ -220,6 +220,12 @@
 					url: '/pages/user/index'
 				})
 			},
+			
+			toRecovery(item) {
+				uni.navigateTo({
+					url: `/packageGoods/recovery/index?goodsId=${ item.goodsId}&num=${ item.goodsNum }&storageId=${ item.storageId }&properties=${item.properties }&skuId=${ item.skuId }`
+				})
+			},
 
 			pageList() {
 				this.pageNum = 1

+ 6 - 0
pages.json

@@ -55,6 +55,12 @@
 				},
 				{
 					"path": "ticket/index"
+				},
+				{
+					"path": "recovery/index"
+				},
+				{
+					"path": "recovery/detail"
 				}
 			]
 		},