Jelajahi Sumber

feat: 我的账户-财富/寄售/赠送

DaMowang 3 tahun lalu
induk
melakukan
5105135c01

+ 20 - 0
src/pages.json

@@ -60,6 +60,26 @@
 				"navigationBarTitleText": "购买协议"
 			}
 		},
+
+		{
+			"path": "pages/account/wealth",
+			"style":{
+				"navigationBarTitleText": "财富"
+			}
+		},
+		{
+			"path": "pages/account/consignment",
+			"style":{
+				"navigationBarTitleText": "寄售"
+			}
+		},
+		{
+			"path": "pages/account/giveAsPresent",
+			"style":{
+				"navigationBarTitleText": "赠送"
+			}
+		},
+
 		{
 			"path": "pages/accountDetails/running",
 			"style":{

+ 331 - 0
src/pages/account/consignment.vue

@@ -0,0 +1,331 @@
+<template>
+	<view class="container">
+		<!-- 顶部导航 -->
+		<view class="Tab_con flex_r flex_ac flex_jb">
+			<view class="tab_list flex_r flex_ac" :class="current == item.status ? 'active' : ''" v-for="(item,index) in TabList" :key="index" @tap="SetCurrent(item.status)">{{item.title}}</view>
+		</view>
+		<!-- 顶部导航-end -->
+		
+		<!-- 寄售列表 -->
+		<view class="con">
+			<view class="goods flex_c" v-for="(item,index) in goods" :key="index" @tap="navToSpeedUp(item,index)">
+				<view class="flex_r">
+					<image class="goods_img" :src="item.ojsImg" mode=""></image>
+					<view class="goods_info flex_c flex_jc">
+						<view class="goods_name ellipsis">{{item.ojsName}}</view>
+						<view class="period">寄售数量:{{item.ojsCount}}套</view>
+					</view>
+					<view class="goods_status flex_grow flex_r flex_je" :class="item.ojsType == 1 ? 'g_color' : item.ojsType == 2 ? 'y_color' : 'r_color'">
+						{{item.ojsType == 1 ? '寄售中' : item.ojsType == 2 ? '寄售成功' : '寄售失败'}}
+					</view>
+				</view>
+				<view class="goods_time">{{item.ojsTime}}</view>
+			</view>
+		</view>
+		<!-- 寄售列表-end -->
+		<not-goods v-if="haveGoods" textStr="暂无寄售信息"></not-goods>
+		
+		<!-- 兑换弹窗 -->
+		<uni-popup type="center" ref="conversion">
+			<view class="const_con">
+				<image class="closePopup" src="/static/f_close.png" mode="" @tap="closePopup"></image>
+				<view class="const_head flex_r flex_ac flex_jc y_color">寄售失败</view>
+				<view class="const_info flex_r flex_ac flex_jc">
+					<view class="frist_list flex_c">
+						<view class="flex_r flex_ac" @tap="setPayWay(0)">
+							<image class="frist_img" :src="pay_way == 0 ? '/static/xuanzhong_icon.png' : '/static/weixuanzhong_icon.png'" mode=""></image>
+							<view class="frist_text">再次寄售</view>
+						</view>
+					</view>
+					<view class="frist_list flex_c">
+						<view class="flex_r flex_ac" @tap="setPayWay(1)">
+							<image class="frist_img" :src="pay_way == 1 ? '/static/xuanzhong_icon.png' : '/static/weixuanzhong_icon.png'" mode=""></image>
+							<view class="frist_text">发货邮寄</view>
+						</view>
+					</view>
+				</view>
+				<!-- 收货地址 -->
+				<view class="address" v-if="pay_way == 1">
+					<block v-if="DefaultAddress != ''">
+						<view class="add_head flex_r flex_ac flex_jb">
+							<view class="user_info flex_r flex_ac">
+								<view class="user_name">{{DefaultAddress.name}}</view>
+								<view class="user_phone">{{DefaultAddress.mobile}}</view>
+							</view>
+							<view class="set_address flex_r flex_ac" @tap="chooseWXaddress">
+								<image class="set_img" src="/static/setAddress.png" mode=""></image>
+								<view class="set_text">修改</view>
+							</view>
+						</view>
+						<view class="add_name mar_t20">{{DefaultAddress.province}}{{DefaultAddress.city}}{{DefaultAddress.county}}{{DefaultAddress.address}}</view>
+					</block>
+					<block v-else>
+						<view class="add_address flex_c flex_ac flex_jc" @tap="chooseWXaddress">
+							<image class="add_icon" src="/static/add.png" mode=""></image>
+							<view class="add_text">添加收货地址</view>
+						</view>
+					</block>
+				</view>
+				<!-- 收货地址-end -->
+				<view class="conversion flex_r flex_ac flex_jc" @tap="SetConsign(pay_way)">确认</view>
+			</view>
+		</uni-popup>
+		<!-- 兑换弹窗-end -->
+	</view>
+</template>
+
+<script>
+let page = 1;
+let app=getApp();
+var appEv = app.$vm.$options;
+// let reqApi = new ReqApi();
+// import { ReqApi } from "@/utils/reqTools.js";
+import { get, post, u_post } from "@/request/api.js";
+import notGoods from '@/components/not-goods/index.vue'
+import uniPopup from '@/components/uni-popup/uni-popup.vue'
+	export default {
+		components:{
+			notGoods,
+			uniPopup
+		},
+		data() {
+			return {
+				current:2,
+				TabList:[
+					{title:'寄售中',status:2},
+					{title:'寄售成功',status:3},
+					{title:'寄售失败',status:4},
+					{title:'全部',status:1}
+				],
+				goods:[],
+				haveGoods: false, // 是否有商品
+				selectIndex:'',
+				isShow:false ,// 是否显示地址
+				DefaultAddress:'' ,// 地址
+				pay_way:0 // 操作-0:再次寄售;1:收货
+			};
+		},
+		onLoad:function(){
+			this.loadAddress()
+		},
+		onShow:function(options){
+			page = 1;
+			this.goods = []
+			this.loadData()
+		},
+		methods:{
+			tabsChange:function(index){
+				this.current = index
+			},
+			loadData:function(){
+				let that = this;
+				let data = {
+					status:this.current,
+					page:page
+				}
+                u_post("ShuZiTeaYW/ojs/goodsLists",data).then(res => {
+                    if(res.status == 200){
+                        let obj = res.ojsList
+                        if(obj.length>0){
+                            for(var i in obj){
+                                that.goods.push(obj[i])
+                            }
+                        }else{
+                            if(page == 1){
+                                that.haveGoods = true
+                                page = -1
+                            }else{
+                                page = -1
+                                appEv.errTips('暂无更多')
+                            }
+                        }
+                    }else{
+                        if(page == 1){
+                            that.haveGoods = true
+                            page = -1
+                        }else{
+                            page = -1
+                            appEv.errTips('暂无更多')
+                        }
+                    }
+                })
+			},
+			// 修改
+			SetCurrent:function(i){
+				this.current = i;
+				this.haveGoods = false;
+				page = 1;
+				this.goods = []
+				this.loadData()
+			},
+			// 修改操作方式
+			setPayWay:function(i){
+				this.pay_way = i;
+			},
+			// 跳转加速
+			navToSpeedUp:function(item,index){
+				if(item.ojsType != 3){
+					uni.navigateTo({
+						url:'/pages/speed-up/index?id=' + item.ojsId
+					})
+				}else if(item.ojsType == 3){
+					this.selectIndex = index
+					this.$refs.conversion.open()
+				}
+			},
+			// 关闭立即兑换弹窗
+			closePopup:function(){
+				this.$refs.conversion.close()
+			},
+			// 点击操作失败事件
+			SetConsign:function(i){
+				let that = this;
+				let data = {
+					ojsId:this.goods[this.selectIndex].ojsId,
+					type:i + 1
+				}
+				if(i == 1){
+					if(this.DefaultAddress.id&&this.DefaultAddress.id!=''){
+						data = {
+							...data,
+							addressId:this.DefaultAddress.id
+						}
+					}else{
+						data = {
+							...data,
+							province:this.DefaultAddress.province,
+							city:this.DefaultAddress.city,
+							county:this.DefaultAddress.county,
+							address:this.DefaultAddress.address,
+							name:this.DefaultAddress.name,
+							mobile:this.DefaultAddress.mobile
+						}
+					}
+				}
+				u_post("ojs/updateOjsType",data).then(res => {
+                    if(res.status == 200){
+                        appEv.errTips(res.msg)
+                        that.$refs.conversion.close()
+                        page = 1;
+                        that.haveGoods = false;
+                        that.goods = []
+                        that.loadData()
+                    }else{
+                        appEv.errTips(res.msg)
+                    }
+                })
+			},
+			// 获取用户地址
+			loadAddress:function(){
+				let that = this;
+                u_post("ShuZiTeaYW/shop/userDefaultAddress").then(res => {
+                    if(res.status == 200){
+                        that.DefaultAddress = res.date
+                    }
+                })
+			},
+			chooseWXaddress:function() {
+				var that = this;
+				uni.chooseAddress({
+					success: function (res) {
+						let default_address = {
+							city: res.cityName,
+							county: res.countyName,
+							address: res.detailInfo,
+							zipCode: res.postalCode,
+							province: res.provinceName,
+							mobile: res.telNumber,
+							name: res.userName
+						};
+						that.DefaultAddress = default_address;
+					},
+					fail: function (res) {
+						console.log(res);
+						if (res.errMsg == "chooseAddress:fail auth deny" || res.errMsg == "chooseAddress:fail:auth denied") {
+							that.flag = false;
+						}
+					}
+				})
+			},
+		},
+		onShareAppMessage: function () {
+		    var path = '/pages/consign-list/index?agentId=1';
+		    if (app.globalData.systemUserInfo && app.globalData.systemUserInfo.userId) {
+		        path = '/pages/consign-list/index?agentId='+ app.globalData.systemUserInfo.userId;
+		    }
+		    		
+		    var title = `茶,让生活更美好!`;
+		    return {
+		        title: title,
+		        path: path
+		    }
+		},
+		/**
+		 * 页面上拉触底事件的处理函数
+		 */
+		onReachBottom: function () {
+			if (page != -1) {
+				var that = this;
+				setTimeout(function () {
+					++page;
+					that.loadData();
+				}, 800);
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+// 页面配置
+page{background: #F4F4F4;}
+// 页面配置-end
+
+// 顶部列表
+.tab_list{height: 100%;box-sizing: border-box;font-size: 30rpx;color:#808080;}
+.Tab_con{width: 100%;height: 92rpx;background: #fff;padding:0 30rpx;box-sizing: border-box;}
+
+.active{color: #1BBD89;border-bottom: 6rpx solid #1BBD89;}
+// 顶部列表-end
+
+// 寄售列表
+.goods_info{width: 270rpx;overflow: hidden;}
+.period{font-size: 26rpx;color:#5D5C5C;margin-top: 24rpx;}
+.goods_status{font-size: 30rpx;font-family: "SourceHanSansCN-Medium";}
+.goods_time{font-size: 22rpx;color: #808080;line-height: 1;margin-top: 20rpx;}
+.con{width: 100%;overflow: hidden;padding:30rpx 30rpx 0;box-sizing: border-box;}
+.goods_img{width: 218rpx;height: 152rpx;margin-right: 36rpx;border-radius: 8rpx;}
+.goods_name{width: 100%;overflow: hidden;font-size: 32rpx;color: #373636;font-family: "SourceHanSansCN-Medium";}
+.goods{width: 100%;overflow: hidden;padding:24rpx 20rpx;box-sizing: border-box;background: #fff;border-radius: 12rpx;margin-bottom: 30rpx;}
+// 寄售列表-end
+
+// 状态颜色
+.g_color{color: #1BBD89 !important;}
+.y_color{color: #FD9F33 !important;}
+.r_color{color: #EC421A !important;}
+// 状态颜色-end
+
+
+// 兑换弹窗
+.frist_list{width: 50%;overflow: hidden;}
+.frist_text{font-size: 28rpx;color:#302F2F;}
+.frist_img{width: 35rpx;height: 35rpx;margin-right: 32rpx;}
+.frist_info{width: 100%;overflow: hidden;align-items: initial;}
+.closePopup{width: 42rpx;height: 42rpx;position: absolute;right: 0;top: -65rpx;}
+.const_info{width: 100%;overflow: hidden;padding:30rpx 50rpx;box-sizing: border-box;}
+.const_con{width: 689rpx;border-radius: 10rpx;background: #fff;position: relative;padding-bottom: 20rpx;}
+.const_head{width: 100%;height: 97rpx;border-bottom:3rpx solid rgba(0,0,0,.15);font-size: 40rpx;color:#1BBD89;font-family: "SourceHanSansCN-Medium";}
+.conversion{width: 269rpx;height: 68rpx;background: #1BBE8A;font-family: "SourceHanSansCN-Medium";color:#fff;font-size: 32rpx;border-radius: 34rpx;margin: 40rpx auto 0;}
+// 兑换弹窗-end
+
+// 收货地址
+.user_phone{font-size: 26rpx;color:#222;}
+.set_text{font-size: 24rpx;color:#868686;}
+.set_img{width: 24rpx;height: 24rpx;margin-right: 9rpx;}
+.add_address{width: 100%;overflow: hidden;height: 109rpx;}
+.add_icon{width: 60rpx;height: 60rpx;margin-bottom: 12rpx;}
+.user_name{font-size:32rpx;color:#000;margin-right: 46rpx;}
+.add_name{width: 448rpx;overflow: hidden;font-size: 24rpx;color:#868686;}
+.add_text{font-size: 24rpx;color:#868686;font-family: "SourceHanSansCN-Normal";}
+.address{width: 100%;overflow: hidden;padding:28rpx;box-sizing: border-box;background: #fff;border-radius: 12rpx;background: #f4f4f4;}
+// 收货地址-end
+</style>

+ 129 - 0
src/pages/account/giveAsPresent.vue

@@ -0,0 +1,129 @@
+<template>
+	<view class="container">
+		<!-- 顶部 -->
+		<view class="head flex_r flex_ac flex_jb">
+			<input class="head_input" type="text" v-model="id" placeholder="输入对方账号" />
+			<view class="hea_text">积分赠送</view>
+		</view>
+		<!-- 顶部-end -->
+		
+		<!-- 赠送 -->
+		<view class="give">
+			<view class="give_option flex_r flex_ac"><text class="flex_r flex_ac">赠送数量</text>
+				<input type="text" v-model="give_num" placeholder="自定义赠送数量" placeholder-style="color:#989898;" />
+			</view>
+			<view class="give_con flex_r flex_ac flex_wrap">
+				<view class="give_list flex_c flex_ac" v-for="(item,index) in list" :key="index" @tap="setCurren(item.integralType)">
+					<view class="give_label flex_r flex_ac flex_jc" :class="curren == item.integralType ? 'actice' : ''" @tap="setCurren(item.integralType)">{{item.integralName}}</view>
+					<view class="give_number flex_r flex_ac flex_jc">{{curren == item.integralType ? '剩余(' + surplus + ')' : ''}}</view>
+				</view>
+			</view>
+		</view>
+		<!-- 赠送-end -->
+		
+		<!-- 确定赠送 -->
+		<view class="btn flex_r flex_ac flex_jc" @tap="giveIntegral">确定</view>
+		<!-- 确定赠送-end -->
+	</view>
+</template>
+
+<script>
+let page = 1;
+let app=getApp();
+var appEv = app.$vm.$options;
+// let reqApi = new ReqApi();
+// import { ReqApi } from "@/utils/reqTools.js";
+import { get, post, u_post } from "@/request/api.js";
+	export default {
+		data() {
+			return {
+				id:'',
+				give_num:'',
+				curren:1,
+				surplus:0,
+				list:[]
+			};
+		},
+		onLoad:function(){
+			this.loadData()
+		},
+		methods:{
+			// 获取用户积分
+			loadData:function(){
+				let that = this;
+                post("ShuZiTeaIntegral/integral/getGiveIntegral").then(res => {
+                    if(res.status == 200){
+                        that.list = res.data
+                        // that.curren = list[0].integralType
+                        that.giveUserIntegral()
+                    }
+                })
+			},
+			giveUserIntegral:function(){
+				let that = this;
+				let data = {
+					type:this.curren
+				}
+                u_post("ShuZiTeaIntegral/integral/giveUserIntegral",data).then(res => {
+                    if(res.status == 200){
+                        that.surplus = res.integral
+                    }
+                })
+			},
+			setCurren:function(e){
+				this.surplus = 0;
+				this.curren = e;
+				this.giveUserIntegral();
+			},
+			// 赠送
+			giveIntegral:function(){
+				let that = this;
+				let data = {
+					type:this.curren,
+					giveIntegral:this.give_num,
+					userAccount:this.id
+				}
+                u_post("ShuZiTeaIntegral/integral/giveIntegral",data).then(res => {
+                    if(res.status == 200){
+                        that.give_num = 0;
+                        that.surplus = res.integral
+                        that.giveUserIntegral()
+                        appEv.errTips(res.msg)
+                    }else{
+                        appEv.errTips(res.msg)
+                    }
+                })
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+// 页面配置
+.container{border-top:16rpx solid #f4f4f4;}
+// 页面配置-end
+
+// 顶部
+.hea_text{font-size: 32rpx;color:#404040;font-family: "SourceHanSansCN-Medium";}
+.head_input{width: 500rpx;height: 64rpx;background: #EBEBEB;padding: 0 40rpx;box-sizing: border-box;}
+.head{width: 100%;height: 147rpx;padding: 40rpx 30rpx;box-sizing: border-box;border-bottom: 3rpx solid #f4f4f4;}
+// 顶部-end
+
+// 赠送
+.give_con{width: 100%;}
+.give_option{height: 88rpx;}
+.give_list:nth-child(3n){margin-right: 0;}
+.give_list{width:calc((100% - 60rpx) / 3);margin-right: 30rpx;}
+.give{width: 100%;overflow: hidden;padding:0 30rpx;box-sizing: border-box;}
+.give_option text{font-size: 26rpx;color:#404040;font-family: "SourceHanSansCN-Medium";height: 100%;}
+.give_number{font-size: 24rpx;color:#17BB87;font-family: "SourceHanSansCN-Medium";height: 58rpx;width: 100%;}
+.give_option input{margin-left: 20rpx;font-size: 34rpx;font-family: "SourceHanSansCN-Bold";font-weight: bold;color:#17BB87;height: 100%;}
+.give_label{width: 100%;height: 70rpx;background: #EFEFEF;color:#7D7D7D;font-family: "SourceHanSansCN-Medium";font-size: 28rpx;border-radius: 4rpx;}
+
+.actice{background: #18BB87;box-shadow: 0px 10rpx 16rpx 0px rgba(23, 187, 135, 0.6);color:#fff;}
+// 赠送-end
+
+// 赠送按钮
+.btn{width: 369rpx;height: 72rpx;border-radius: 8rpx;color:#fff;background: #18BB87;font-size: 38rpx;font-family: "SourceHanSansCN-Medium";margin: 170rpx auto 0;}
+// 赠送按钮-end
+</style>

+ 98 - 0
src/pages/account/wealth.vue

@@ -0,0 +1,98 @@
+<template>
+	<view class="container">
+		<!-- 财富列表 -->
+		<view class="con flex_r flex_ac mar_t16">
+			<view class="list flex_c flex_ac" @click="goFund">
+				<view class="list_name">余额</view>
+				<view class="list_text flex_r flex_ae"><text>¥</text>{{details.commission}}</view>
+			</view>
+			<view class="list flex_c flex_ac" @click="goAccMoney">
+				<view class="list_name">拼团金</view>
+				<view class="list_text flex_r flex_ae"><text>¥</text>{{details.spellMoney}}</view>
+			</view>
+			<view class="list flex_c flex_ac">
+				<!-- <view class="list_name">拼豆</view>
+				<view class="list_text flex_r flex_ae"><text>¥</text>{{details.bean}}</view> -->
+			</view>
+		</view>
+		
+		<view class="con flex_r flex_ac flex_jb mar_t16">
+			<view class="list flex_c flex_ac"  @click="goDetail(1,'茶宝')">
+				<view class="list_name">茶宝</view>
+				<view class="list_text flex_r flex_ae">{{details.integral}}</view>
+			</view>
+			<view class="list flex_c flex_ac"  @click="goDetail(2,'消费积分')">
+				<view class="list_name">消费积分</view>
+				<view class="list_text flex_r flex_ae">{{details.xfIntegral}}</view>
+			</view>
+			<view class="list flex_c flex_ac"  @click="goDetail(3,'批发积分')">
+				<view class="list_name">批发积分</view>
+				<view class="list_text flex_r flex_ae">{{details.pfIntegral}}</view>
+			</view>
+		</view>
+		
+		
+	</view>
+</template>
+
+<script>
+let page = 1;
+let app=getApp();
+var appEv = app.$vm.$options;
+// let reqApi = new ReqApi();
+// import { ReqApi } from "@/utils/reqTools.js";
+import { get, post, u_post } from "@/request/api.js";
+	export default {
+		data() {
+			return {
+				details:{}
+			};
+		},
+		onLoad:function(){
+			this.loadData()
+		},
+		methods:{
+			loadData:function(){
+				let that = this;
+                u_post("ShuZiTeaYW/my/wealth").then(res => {
+                    if(res.status == 200){
+                        that.details = res
+                    }
+                })
+			},
+			goDetail:function(integralType,pageName){
+				uni.navigateTo({
+					url:'/pages/wealth-detail/index?integralType='+integralType+'&pageName=' + pageName
+				})
+			},
+			goAccMoney:function(){
+				uni.navigateTo({
+					url:'/pages/acc-money-list/index'
+				})
+			},
+			goFund:function(){
+				uni.navigateTo({
+					url:'/pages/fund-list/index'
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+// 页面配置
+page{background-color: #F4F4F4;}
+// 页面配置-end
+
+// 财富列表
+.list2{margin-bottom: 40rpx;width: 180rpx;}
+.list{width: calc(100% / 3);}
+.list_name{font-size: 26rpx;color:#404040;margin-bottom: 30rpx;}
+.con{width: 100%;overflow: hidden;padding:40rpx;box-sizing: border-box;background: #fff;}
+.con2{width: 100%;overflow: hidden;padding:40rpx 40rpx 0;box-sizing: border-box;background: #fff;}
+.list_name2{font-size: 26rpx;color:#3F3F3F;font-family: "SourceHanSansCN-Medium";margin-bottom: 30rpx;}
+.list_text{font-size: 30rpx;color: #1BBD89;font-family: "SourceHanSansCN-Medium";font-weight: 500;line-height: 1;}
+.list_text2{font-size: 30rpx;color: #FD9F33;font-family: "SourceHanSansCN-Medium";font-weight: 500;line-height: 1;}
+.list_text text{font-size: 22rpx;color: #1BBD89;font-family: "SourceHanSansCN-Medium";font-weight: 500;line-height: 1;}
+// 财富列表-end
+</style>

+ 3 - 3
src/pages/my/index.vue

@@ -140,7 +140,7 @@
           </navigator>
           <navigator
             class="fun_list flex_c flex_ac"
-            url="/pages/wealth/index"
+            url="/pages/account/wealth"
             hover-class="none"
           >
             <image class="fun_img" src="/static/my/wealth.png" mode=""></image>
@@ -148,7 +148,7 @@
           </navigator>
           <navigator
             class="fun_list flex_c flex_ac"
-            url="/pages/consign-list/index"
+            url="/pages/account/consignment"
             hover-class="none"
           >
             <image class="fun_img" src="/static/my/consign.png" mode=""></image>
@@ -156,7 +156,7 @@
           </navigator>
           <navigator
             class="fun_list flex_c flex_ac"
-            url="/pages/give/index"
+            url="/pages/account/giveAsPresent"
             hover-class="none"
           >
             <image class="fun_img" src="/static/my/give.png" mode=""></image>