Browse Source

Merge branch 'master' of http://git.cc-lotus.info/pointToNetwork/point-app

guhongwei 2 years ago
parent
commit
802af462b7

+ 8 - 0
pagesHome/market/search.vue

@@ -300,6 +300,14 @@
 					}
 
 				}
+
+				.screenList {
+					width: 17vw;
+					display: inline-block;
+					white-space: nowrap;
+					overflow: hidden;
+					text-overflow: ellipsis;
+				}
 			}
 
 			.two_2 {

+ 16 - 12
pagesHome/order/appraise.vue

@@ -13,7 +13,7 @@
 				</view>
 			</view>
 			<view class="two">
-				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+				<scroll-view scroll-y="true" class="scroll-view">
 					<view class="list-scroll-view">
 						<view class="list" v-for="(item, index) in list" :key="index">
 							<image v-if="item.customer.icon&&item.customer.icon.length>0" class="image"
@@ -63,22 +63,22 @@
 				user: {},
 				btnlist: [{
 						name: '全部好评',
-						total: '0',
+						total: 0,
 						code: '0'
 					},
 					{
 						name: '好评',
-						total: '0',
+						total: 0,
 						code: '1'
 					},
 					{
 						name: '中评',
-						total: '0',
+						total: 0,
 						code: '2'
 					},
 					{
 						name: '差评',
-						total: '0',
+						total: 0,
 						code: '3'
 					}
 				],
@@ -93,6 +93,8 @@
 				thr: [],
 				// 回复数据
 				reply: {},
+				// 列表
+				code: ''
 			};
 		},
 		onLoad: function(e) {
@@ -139,8 +141,9 @@
 			// 选择
 			toSelect(e) {
 				const that = this;
+				that.$set(that, `code`, e.code);
 				if (e.code == '0') {
-					that.clearPage();
+					// that.clearPage();
 					that.search()
 				} else if (e.code == '1') {
 					that.$set(that, `list`, that.one);
@@ -179,18 +182,22 @@
 					that.$set(that, `info`, res.data)
 				}
 				let info = {
-					skip: that.skip,
-					limit: that.limit,
+					// skip: that.skip,
+					// limit: that.limit,
 					goods: that.id
 				}
 				res = await that.$api(`/goodsRate`, `GET`, {
 					...info,
 				})
 				if (res.errcode == '0') {
-					let list = [...that.list, ...res.data]
+					// let list = [...that.list, ...res.data]
+					let list = res.data;
 					for (let val of list) {
 						val.customer.phone = val.customer.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
 					}
+					that.$set(that, `list`, list)
+					that.$set(that, `total`, res.total)
+					that.$set(that.btnlist[0], `total`, res.total)
 					let one = list.filter(item => item.goods_score == 5);
 					that.$set(that, `one`, one)
 					that.$set(that.btnlist[1], `total`, one.length);
@@ -200,9 +207,6 @@
 					let thr = list.filter(item => item.goods_score <= 2)
 					that.$set(that, `thr`, thr)
 					that.$set(that.btnlist[3], `total`, thr.length);
-					that.$set(that, `list`, list)
-					that.$set(that, `total`, res.total)
-					that.$set(that.btnlist[0], `total`, res.total)
 				} else {
 					uni.showToast({
 						title: res.errmsg,

+ 1 - 1
pagesHome/order/detail.vue

@@ -221,7 +221,7 @@
 				// 计数器
 				num: 1,
 				// 评论数
-				comment: '',
+				comment: 0,
 			};
 		},
 		onLoad: async function(e) {

+ 4 - 1
pagesHome/order/order.vue

@@ -301,7 +301,10 @@
 											}
 										},
 										fail(e) {
-											console.log('in fail');
+											uni.showToast({
+												title: `支付失败`,
+												icon: 'none'
+											})
 											uni.hideLoading();
 											uni.reLaunch({
 												url: `/pagesMy/order/index?status=${'0'}`

+ 2 - 1
pagesMy/order/after.vue

@@ -45,7 +45,8 @@
 										</view>
 									</view>
 									<view class="btn">
-										<button type="default" size="mini" @tap.stop="toCancel(item)">取消售后</button>
+										<button v-if="item.status=='0'||item.status=='1'" type="default" size="mini"
+											@tap.stop="toCancel(item)">取消售后</button>
 										<button v-if="item.type!='0'" type="default" size="mini"
 											@tap.stop="toRevise(item)">维护信息</button>
 									</view>

+ 65 - 27
pagesMy/order/appraise.vue

@@ -10,13 +10,13 @@
 						<upload :list="file" name="file" :count="6" @uplSuc="uplSuc" @uplDel="uplDel"></upload>
 					</uni-forms-item>
 					<uni-forms-item label="商品评分" name="goods_score">
-						<uni-rate size="18" v-model="form.goods_score" />
+						<uni-rate :readonly="readonly" size="18" v-model="form.goods_score" />
 					</uni-forms-item>
 					<uni-forms-item label="发货评分" name="transport_score">
-						<uni-rate size="18" v-model="form.transport_score" />
+						<uni-rate :readonly="readonly" size="18" v-model="form.transport_score" />
 					</uni-forms-item>
 					<uni-forms-item label="店铺评分" name="shop_score">
-						<uni-rate size="18" v-model="form.shop_score" />
+						<uni-rate :readonly="readonly" size="18" v-model="form.shop_score" />
 					</uni-forms-item>
 				</uni-forms>
 				<view class="btn">
@@ -37,6 +37,8 @@
 		data() {
 			return {
 				id: '',
+				// 追加
+				rate_id: '',
 				user: {},
 				form: {},
 				info: {},
@@ -55,11 +57,13 @@
 						}]
 					}
 				},
+				readonly: false,
 			};
 		},
 		onLoad: function(e) {
 			const that = this;
 			that.$set(that, `id`, e.id || '');
+			that.$set(that, `rate_id`, e.rate_id || '');
 			// 监听用户是否登录
 			that.watchLogin();
 		},
@@ -80,30 +84,56 @@
 			async onSubmit(ref) {
 				const that = this;
 				that.$refs[ref].validate().then(async params => {
-					let reply = [{
-						file: that.file,
-						content: params.content,
-						time: moment().format('YYYY-MM-DD HH:mm:ss')
-					}];
-					params.reply = reply;
-					params.customer = that.user?._id;
-					params.shop = that.info?.goods[0]?.shop;
-					params.goods = that.info?.goods[0]?.goods[0]?.goods?._id;
-					params.goodsSpec = that.info?.goods[0]?.goods[0]?._id;
-					const arr = await that.$api(`/goodsRate`, 'POST', params);
-					if (arr.errcode == '0') {
-						uni.showToast({
-							title: `评论成功`,
-							icon: 'success',
-						});
-						uni.navigateBack({
-							detail: 1
-						})
+					if (that.rate_id) {
+						let reply = that.form;
+						let obj = {
+							file: that.file,
+							content: params.content,
+							time: moment().format('YYYY-MM-DD HH:mm:ss')
+						}
+						reply.reply.push(obj)
+						const arr = await that.$api(`/goodsRate/${that.rate_id}`, 'POST', reply)
+						if (arr.errcode == '0') {
+							uni.showToast({
+								title: `追加成功`,
+								icon: 'success',
+							});
+							uni.navigateBack({
+								detail: 1
+							})
+						} else {
+							uni.showToast({
+								title: arr.errmsg,
+								icon: 'none',
+							})
+						}
 					} else {
-						uni.showToast({
-							title: arr.errmsg,
-							icon: 'none',
-						})
+						let reply = [{
+							file: that.file,
+							content: params.content,
+							time: moment().format('YYYY-MM-DD HH:mm:ss')
+						}];
+						params.orderDetail = that.id
+						params.reply = reply;
+						params.customer = that.user?._id;
+						params.shop = that.info?.goods[0]?.shop;
+						params.goods = that.info?.goods[0]?.goods[0]?.goods?._id;
+						params.goodsSpec = that.info?.goods[0]?.goods[0]?._id;
+						const arr = await that.$api(`/goodsRate`, 'POST', params);
+						if (arr.errcode == '0') {
+							uni.showToast({
+								title: `评论成功`,
+								icon: 'success',
+							});
+							uni.navigateBack({
+								detail: 1
+							})
+						} else {
+							uni.showToast({
+								title: arr.errmsg,
+								icon: 'none',
+							})
+						}
 					}
 				})
 			},
@@ -128,13 +158,21 @@
 			async search() {
 				const that = this;
 				let user = that.user;
+				let res;
 				if (that.id) {
-					let res = await that.$api(`/orderDetail/${that.id}`);
+					res = await that.$api(`/orderDetail/${that.id}`);
 					if (res.errcode == '0') {
 						that.$set(that, `info`, res.data.order);
 						uni.hideLoading();
 					}
 				}
+				if (that.rate_id) {
+					res = await that.$api(`/goodsRate/${that.rate_id}`);
+					if (res.errcode == '0') {
+						that.$set(that, `form`, res.data);
+						that.$set(that, `readonly`, true)
+					}
+				}
 			},
 		}
 	}

+ 26 - 11
pagesMy/order/index.vue

@@ -64,8 +64,10 @@
 											@tap.stop="toConfirm(item)">确认收货</button>
 										<button v-if="item.status!='0'" type="default" size="mini"
 											@tap.stop="toAfter(item)">申请售后</button>
-										<button v-if="item.status=='3'" type="default" size="mini"
+										<button v-if="item.status=='3'&&!item.rate" type="default" size="mini"
 											@tap.stop="toAppraise(item)">立即评价</button>
+										<button v-if="item.status=='3'&&item.rate" type="default" size="mini"
+											@tap.stop="toAppraise(item)">追加评价</button>
 									</view>
 								</view>
 								<view class="list_2 list_3" v-for="(item,index) in list" :key="index"
@@ -85,9 +87,7 @@
 										<view class="goods_2">
 											<view class="market">
 												<view class="url">
-													<image class="image"
-														:src="tag.goods.file&&tag.goods.file.length>0?tag.goods.file[0].url:''"
-														mode=""></image>
+													<image class="image" :src="tag.url" mode=""></image>
 												</view>
 												<view class="goodsname">
 													{{tag.goods.name}}
@@ -111,7 +111,7 @@
 									</view>
 									<view class="other">
 										<text>共{{item.buy_num_total||0}}件商品</text>
-										<text>总价¥{{item.total_detail.goods_total}}</text>
+										<text>总价¥{{item.real_pay}}</text>
 									</view>
 									<view class="btn">
 										<button v-if="item.status=='2'||item.status=='3'" type="default" size="mini"
@@ -124,8 +124,10 @@
 											@tap.stop="toConfirm(item)">确认收货</button>
 										<button v-if="item.status!='0'" type="default" size="mini"
 											@tap.stop="toAfter(item)">申请售后</button>
-										<button v-if="item.status=='3'" type="default" size="mini"
+										<button v-if="item.status=='3'&&!item.rate" type="default" size="mini"
 											@tap.stop="toAppraise(item)">立即评价</button>
+										<button v-if="item.status=='3'&&item.rate" type="default" size="mini"
+											@tap.stop="toAppraise(item)">追加评价</button>
 									</view>
 								</view>
 							</view>
@@ -190,7 +192,11 @@
 			// 监听用户是否登录
 			that.watchLogin();
 		},
-		onShow: function() {},
+		onShow: function() {
+			const that = this;
+			that.clearPage();
+			that.search();
+		},
 		methods: {
 			// 监听用户是否登录
 			watchLogin() {
@@ -334,7 +340,10 @@
 									that.search();
 								},
 								fail(e) {
-									console.log('in fail');
+									uni.showToast({
+										title: `支付失败`,
+										icon: 'none'
+									})
 									uni.hideLoading();
 									that.clearPage();
 									that.search();
@@ -410,9 +419,15 @@
 			},
 			// 立即评价
 			toAppraise(e) {
-				uni.navigateTo({
-					url: `/pagesMy/order/appraise?id=${e._id}`
-				})
+				if(e.rate){
+					uni.navigateTo({
+						url: `/pagesMy/order/appraise?id=${e._id}&rate_id=${e.rate}`
+					})
+				}else{
+					uni.navigateTo({
+						url: `/pagesMy/order/appraise?id=${e._id}`
+					})
+				}
 			},
 			// 选择选项卡
 			tabsChange(e) {

+ 0 - 1
pagesMy/order/service.vue

@@ -175,7 +175,6 @@
 				const that = this;
 				let data = that.goodsList[e.detail.value];
 				if (data) {
-					console.log(data);
 					that.$set(that, `info`, data);
 					that.$set(that.form, `goods_id`, data._id);
 					that.$set(that.form, `goods_name`, data.name);