dever 4 年 前
コミット
0cef12edcb

+ 1 - 2
pages/dream/func/cate.vue

@@ -90,8 +90,7 @@ export default {
 			}
 		}, 
 		go : function(index, page_id, num) {
-			index = parseInt(index) + parseInt(num);
-			console.info(index);
+			index = parseInt(index) + parseInt(num);
 			if (this.page_id != page_id) {
 				var self = this;
 				this.Dever.post('app/collection/?l=api.getCodeByPage', {code:this.Dever.config.code,page_id:page_id,index:index}, function(t) {

+ 7 - 7
pages/dream/func/my.vue

@@ -28,7 +28,7 @@
 				</view>
 				<view class="scroll-wrapper">
 					<view class="margin-bottom">
-						<view class="cu-list menu-avatar" v-if="activeTab == 2">
+						<view class="cu-list menu-avatar" v-if="activeTab == 1">
 							<view class="cu-item " v-for="(v, k) in fetch.order" :key="k">
 								<view class="cu-avatar radius lg" :style="{backgroundImage:'url('+v.pic+')'}"></view>
 								<view class="content">
@@ -38,13 +38,13 @@
 								<view class="action">
 									<view class="text-grey text-xs">{{v.price}}</view>
 									<view class="cu-tag round bg-red sm" v-if="v.status == 1">{{v.status_name}}</view>
-									<view class="cu-tag round bg-blue sm" v-if="v.status == 2">{{v.status_name}}</view>
+									<view class="cu-tag round bg-blue sm" v-if="v.status == 2 || v.status > 3">{{v.status_name}}</view>
 									<view class="cu-tag round bg-black sm" v-if="v.status == 3">{{v.status_name}}</view>
 								</view>
 							</view>
 						</view>
 						
-						<view class="cu-list menu-avatar" v-if="activeTab == 1">
+						<view class="cu-list menu-avatar" v-if="activeTab == 2">
 							<view class="cu-item" v-for="(v, k) in fetch.chat" :key="k" @click="goChat(v.uid, v.user.username)">
 								<view class="cu-avatar round lg" :style="{backgroundImage:'url('+v.user.avatar+')'}">
 									<view class="cu-tag badge" style="display:none;">99+</view>
@@ -133,7 +133,7 @@ export default {
 			},
 			activeTab : 0,
 			cate : [
-				'信息', '交流', '买过'
+				'信息', '买过', '关系'
 			],
 			openAvatar : false
 		}
@@ -157,7 +157,7 @@ export default {
 			this.handleTab(this.activeTab, 2);
 		},
 		getOrder : function(page) {
-			this.Dever.page([page,'order'], this, 'app/user/?l=api.goods_order', {code:this.Dever.config.code, noloading:1});
+			this.Dever.page([page,'order'], this, 'app/user/?l=api.my_goods_order', {code:this.Dever.config.code, noloading:1});
 		},
 		getCommunity : function(page) {
 			this.Dever.page([page,'chat'], this, 'app/user/?l=api.community', {code:this.Dever.config.code, noloading:1});
@@ -170,9 +170,9 @@ export default {
 			if (!t) {
 				t = 1;
 			}
-			if (k == 2) {
+			if (k == 1) {
 				this.getOrder(t);
-			} else if(k == 1) {
+			} else if(k == 2) {
 				this.getCommunity(t);
 			}
 		},

+ 10 - 4
pages/dream/view.vue

@@ -159,13 +159,13 @@ export default{
 		this.controlHandle();
 	},
 	methods:{
-		// 触底刷新
+		// 页面触底刷新
 		bottomCall: function() {
 			if (this.bottom && this.bottom[this.swiper.index]) {
 				this.bottom[this.swiper.index].getData(2);
 			}
 		},
-		// 触底刷新
+		// drawer触底刷新
 		bottomFunc : function() {
 			if (this.drawer.show && this.drawer.item[this.drawer.show].show == true) {
 				this.$refs[this.drawer.show][0].getInfo(2);
@@ -174,9 +174,15 @@ export default{
 		record : function() {
 			if (!this.login) {
 				return;
-			}
+			}
+			var self = this;
 			var content_id = this.fetch.items[this.swiper.index].id;
-			this.Dever.post('app/user/?l=api.record', {noloading:1, code:this.Dever.config.code, index: this.swiper.index, content_id: content_id});
+			this.Dever.post('app/user/?l=api.record', {noloading:1, code:this.Dever.config.code, index: this.swiper.index, content_id: content_id}, function(t) {
+				self.Dever.config.code = t.code;
+				if (self.Dever.source == 'h5') {
+					
+				}
+			});
 		},
 		
 		controlHandle : function() {

+ 17 - 13
pages/dream/view/moment.vue

@@ -4,7 +4,7 @@
 		<view class="home-pic" :style="style">
 			<view class="home-pic-base">
 				<view class="top-pic">
-					<image class="header" :src="item.logo" @tap="test"></image>
+					<image class="header" :src="item.logo"></image>
 				</view>
 				<view class="top-name">{{item.name}}</view>
 			</view>
@@ -12,7 +12,7 @@
 
 		<view style="padding-bottom: 140rpx;">
 			<view class="moments__post" v-for="(v,k) in fetch.info" :key="k">
-				<momentItem :item="v" :key="v.server_time"></momentItem>
+				<momentItem :item="v" :user="fetch.user" :key="v.server_time"></momentItem>
 			</view>
 		</view>
 
@@ -37,14 +37,18 @@
 	export default {
 		name: "moment",
 		props: {
-			control : {
-				type : Object,
-				value : null
-			},
-			item : {
-				type    : Object,
-				value	: null
-			},
+			control : {
+				type : Object,
+				value : null
+			},
+			bottom : {
+				type : Object,
+				value : null
+			},
+			item : {
+				type    : Object,
+				value	: null
+			},
 			index : 0
 		},
 		components: {
@@ -63,10 +67,10 @@
 				showComment : false,
 			}
 		},
-		mounted() {
+		mounted() {
+			this.bottom[this.index] = this;
 			this.type_id = this.item.id;
 			this.style = 'background:url("'+this.item.pic+'");background-size: contain;';
-			console.info(this.item);
 			this.getData(1);
 
 		},
@@ -75,7 +79,7 @@
 		},
 		methods: {
 			getData : function(page) {
-				this.Dever.page([page, 'info'], this, 'app/community/?l=api.moment', {type:this.type,type_id:this.type_id});
+				this.Dever.page([page, 'info'], this, 'app/community/?l=api.moment', {type:this.type,type_id:this.type_id,code:this.Dever.config.code,noloading:1});
 			},
 			showModal : function() {
 				this.showComment = true;

+ 45 - 27
pages/dream/view/momentItem.vue

@@ -5,7 +5,7 @@
 		</view>
 		
 		<view class="post_right">
-			<text class="post-username"><text v-if="item.user.author" style="margin-right:10rpx;color: #00B3FF;">[{{item.user.author}}]</text>{{item.user.username}}</text>
+			<text class="post-username"><text v-if="item.user.author" style="margin-right:10rpx;color: #00B3FF;">[{{item.user.author}}]</text>{{item.user.username}}</text><text v-if="item.user.title" style="margin-left:10rpx">({{item.user.title}})</text>
 			<view class="paragraph">{{item.content}}</view>
 			<!-- 相册 -->
 			<view class="thumbnails" v-if="item.pic.length > 0 && item.pic[0]">
@@ -15,8 +15,8 @@
 			</view>
 			<!-- 资料条 -->
 			<view class="toolbar">
-				<view class="timestamp">{{item.cdate_string}}</view>
-				<view class="like" @tap="updateUp(item)">
+				<view class="timestamp">{{item.cdate_string}}<text @click="deleteItem" v-if="item.me == 1">[{{item.del}}]</text></view>
+				<view class="like" @tap="updateUp()">
 					<image :src="item.is_up ? '../../static/moment/like.png' : '../../static/moment/islike.png'" style="width: 30px;"></image>
 				</view>
 				<view class="comment" @tap="updateComment(item.id)">
@@ -25,9 +25,10 @@
 			</view>
 			<!-- 赞/评论区 -->
 			<view class="post-footer">
-				<view class="footer_content">
+				<view class="footer_content" v-if="item.up_list_total > 0">
 					<image class="liked" src="@/static/moment/liked.png"></image>
-					<text class="nickname" v-for="(v, k) in item.up_list" :key="k">{{v.username}}</text>
+					<text class="nickname" v-for="(v, k) in item.up_list.user" :key="k">{{v.username}}</text>
+					<text class="nickname" v-if="item.up_list.total > 0">还有{{item.up_list.total}}人点赞</text>
 				</view>
 				<view v-if="item.child.length" class="footer_content" v-for="(v, k) in item.child" :key="k" @tap="reply()">
 					<text class="comment-nickname">{{v.user.username}}: </text>
@@ -51,6 +52,9 @@
 		props: {
 			item: {
 				type: Object
+			},
+			user: {
+				type: Object
 			},
 		},
 		components: {
@@ -118,34 +122,48 @@
 					}
 					self.hideModal();
 				});
+			},
+			deleteItem : function() {
+				var self = this;
+				if (this.item.me == 2) {
+					this.Dever.alert('无法删除');
+					return;
+				}
+				var text = '删除';
+				var del = '恢复';
+				var del_state = 1;
+				if (self.item.del_state == 1) {
+					text = '恢复';
+					del = '删除';
+					del_state = 2;
+				}
+				this.Dever.confirm('确认'+text+'这条动态?', function() {
+					self.Dever.post('app/community/?l=api.delMoment', {moment_id:self.item.id,state:self.item.del_state}, function(t) {
+						self.item.del = del;
+						self.item.del_state = del_state;
+					});
+				})
 			},
-			updateUp : function(item) {
+			updateUp : function() {
 				var self = this;
-				if (item.is_oppose) {
+				if (this.item.is_oppose) {
 					return;
 				}
-				if (item.is_up) {
-					item.num_up--;
-					item.is_up = false;
+				if (this.item.is_up) {
+					this.item.num_up--;
+					this.item.is_up = false;
+					delete this.item.up_list.user['user_' + this.user.id];
+					this.item.up_list_total -= 1;
 				} else {
-					item.num_up++;
-					item.is_up = true;
+					this.item.num_up++;
+					this.item.is_up = true;
+					this.item.up_list.user['user_' + this.user.id] = {};
+					this.item.up_list.user['user_' + this.user.id]['id'] = this.user.id;
+					this.item.up_list.user['user_' + this.user.id]['username'] = this.user.username;
+					this.item.up_list.user['user_' + this.user.id]['author'] = this.user.author;
+					this.item.up_list_total += 1;
 				}
-				self.Dever.post('app/community/?l=api.up', {id:item.id,type:this.type,noloading:1});
-			},
-			updateOppose : function(item) {
-				var self = this;
-				if (item.is_up) {
-					return;
-				}
-				if (item.is_oppose) {
-					item.num_oppose--;
-					item.is_oppose = false;
-				} else {
-					item.num_oppose++;
-					item.is_oppose = true;
-				}
-				self.Dever.post('app/community/?l=api.oppose', {id:item.id,type:this.type,noloading:1});
+				self.Dever.post('app/community/?l=api.up', {id:this.item.id,type:this.type,noloading:1});
 			},
 			updateComment : function (type_id, to_id, to_uid) {
 				this.type = this.type;

+ 42 - 30
pages/dream/view/product.vue

@@ -33,35 +33,33 @@
 				:margin="10" @change="navChange"></graceNavBar>
 			</view>
 			<!-- 详情 请根据项目情况自行改进 可以使用 富文本-->
-			<view class="grace-product-padding" :hidden="active != 0">
+			<view class="grace-product-padding" v-if="active == 0">
 				<dever-content :item="item.goods.content_array" :pics="item.goods.content_pic" :skeleton="false"></dever-content>
 			</view>
 			<!-- 评论区 -->
-			<view class="grace-comments grace-product-padding" :hidden="active != 2">
-				<view class="grace-comments-items" v-for="(v, k) in fetch.info" :key="k">
-					<image  :src="v.user.avatar" class="grace-comments-face"></image>
-					<view class="grace-comments-body">
-						<view class="grace-comments-header">
-							<text class="grace-comments-header-text">{{v.user.username}}</text>
-							<text class="grace-comments-info-text">{{v.cdate_string}}</text>
-						</view>
-						<text class="grace-comments-content">{{v.content}}</text>
-						<view class="grace-comments-imgs" v-if="v.pic">
-							<view class="grace-comments-image" v-for="(v1, k1) in v.pic" :key="k1">
-								<image :src="v1" mode="widthFix" class="grace-comments-img" @click="Dever.viewPic(v.pic, v1)" style="height:auto"></image>
-							</view>
-						</view>
-					</view>
-				</view>
+			<view class="cu-list menu-avatar" v-if="active == 1">
+				<view class="cu-item " v-for="(v, k) in fetch.order" :key="k">
+					<view class="cu-avatar radius lg" :style="{backgroundImage:'url('+v.user.avatar+')'}"></view>
+					<view class="content">
+						<view class="text-pink"><view class="text-cut"><text v-if="v.user.author" style="margin-right:10rpx;color: #00B3FF;">[{{v.user.author}}]</text>{{v.user.username}}</view><text v-if="v.user.title" style="margin-left:10rpx">({{v.user.title}})</text></view>
+						<view class="text-gray text-sm flex"> <view class="text-cut">{{v.date}}</view></view>
+					</view>
+					<view class="action">
+						<view class="text-grey text-xs">{{v.price}}</view>
+						<view class="cu-tag round bg-red sm" v-if="v.status == 1">{{v.status_name}}</view>
+						<view class="cu-tag round bg-blue sm" v-if="v.status == 2 || v.status > 3">{{v.status_name}}</view>
+						<view class="cu-tag round bg-black sm" v-if="v.status == 3">{{v.status_name}}</view>
+					</view>
+				</view>
 			</view>
 			
 			<!-- 评论区 -->
-			<view class="grace-comments grace-product-padding" :hidden="active != 1">
+			<view class="grace-comments grace-product-padding" v-if="active == 2">
 				<view class="grace-comments-items" v-for="(v, k) in fetch.info" :key="k">
 					<image  :src="v.user.avatar" class="grace-comments-face"></image>
 					<view class="grace-comments-body">
 						<view class="grace-comments-header">
-							<text class="grace-comments-header-text">{{v.user.username}}</text>
+							<text class="grace-comments-header-text"><text v-if="v.user.author" style="margin-right:10rpx;color: #00B3FF;">[{{v.user.author}}]</text>{{v.user.username}}<text v-if="v.user.title" style="margin-left:10rpx">({{v.user.title}})</text></text>
 							<text class="grace-comments-info-text">{{v.cdate_string}}</text>
 						</view>
 						<text class="grace-comments-content">{{v.content}}</text>
@@ -129,11 +127,16 @@
 						<block v-for="(v, k) in item.goods.sell_attr" :key="k" v-if="item.goods.price_type == 2">
 							<view class="grace-title grace-margin-top">{{v.name}}</view>
 							<view><graceSelectTags selectedColor="#FF0036" :items="v.option_sku" type="radio" @change="change"></graceSelectTags></view>
+						</block>
+						<block v-if="kuNum > 0">
+							<view class="grace-margin-top"><text class="grace-title">购买数量</text></view>
+							<view style="margin-bottom: 40rpx;">
+								<graceNumberBox :minNum="1" :maxNum="kuNum" :value="buyNum" v-on:change="buyNumChange"></graceNumberBox>
+							</view>
+						</block>
+						<block else>
+							<view class="grace-margin-top"><text class="grace-title">已售空</text></view>
 						</block>
-						<view class="grace-margin-top"><text class="grace-title">购买数量</text></view>
-						<view style="margin-bottom: 40rpx;">
-							<graceNumberBox :minNum="1" :maxNum="kuNum" :value="buyNum" v-on:change="buyNumChange"></graceNumberBox>
-						</view>
 					</scroll-view>
 					<view class="grace-product-attr-btn">
 						<button type="warn" style="background-color:#FF0036;" class="grace-button grace-border-radius" formType="submit">立即购买</button>
@@ -218,7 +221,7 @@ export default {
 			api : 'app/community/?l=api.addComment',
 			key : 'content/product',
 			// 切换导航
-			navItems : ['商品详情', '单列表', '最新评价'],
+			navItems : ['商品详情', '单列表', '最新评价'],
 			active:0,
 			// 购买选择属性层展示
 			attrIsShow : false,
@@ -228,7 +231,7 @@ export default {
 			attrSelect : {},
 			payPrice : 0,
 			buyNum : 1,
-			kuNum : 9999,
+			kuNum : 0,
 			showComment : false,
 			fetch : {
 				info : [],
@@ -323,17 +326,21 @@ export default {
 		getData : function(page) {
 			if (this.active == 0) {
 				return;
+			}
+			if (this.active == 1) {
+				//跟单列表
+				this.Dever.page([page, 'order'], this, 'app/user/?l=api.goods_order', {info_id:this.item.goods.id, code:this.Dever.config.code});
+			} else {
+				//评价列表
+				this.Dever.page([page, 'info'], this, 'app/community/?l=api.comment', {type:this.key,type_id:this.item.goods.id,user:true, code:this.Dever.config.code});
 			}
-			this.Dever.page([page, 'info'], this, 'app/community/?l=api.comment', {type:this.key,type_id:this.item.goods.id,user:true});
+			
 		},
 		// 导航切换
 		navChange : function(e){
 			this.active = e;
-			if (e == 1) {
+			if (e == 1 || e == 2) {
 				// 获取下单列表
-				//this.getData(1);
-			}
-			if (e == 2) {
 				this.getData(1);
 			}
 		},
@@ -404,6 +411,11 @@ export default {
 				}
 				var store = this.fetch.store[this.store_relation[this.store_index]].id;
 				data.store_id = store;
+			}
+			
+			if (this.kuNum <= 0) {
+				this.Dever.alert('商品已售空');
+				return;
 			}
 
 			//如果想关闭属性