zs 2 年之前
父節點
當前提交
46f2de1889
共有 1 個文件被更改,包括 39 次插入26 次删除
  1. 39 26
      pagesHome/order/appraise.vue

+ 39 - 26
pagesHome/order/appraise.vue

@@ -38,14 +38,18 @@
 								<view class="other1"><text>{{item.reply[0].content||'暂无'}}</text></view>
 								<view class="other2">规格:{{item.goodsSpec.name}}</view>
 								<view class="other2" v-for="(itm, indexx) in item.reply" :key="indexx">
-									<view :class="[item.customer._id!=user._id?'reply_2':'reply']">
-										<text>用户评论:{{itm.content||'暂无'}}</text>
-										<text v-if="itm.reply">商家回复:{{itm.reply||'暂无'}}</text>
+									<view class="other2_1">
+										<view :class="[item.customer._id!=user._id?'reply_2':'reply']">
+											<text>用户评论:{{itm.content||'暂无'}}</text>
+											<text v-if="itm.reply">商家回复:{{itm.reply||'暂无'}}</text>
+										</view>
+										<view v-if="item.customer._id==user._id" @tap="toReply(item,indexx)">回复</view>
 									</view>
-									<view v-if="item.customer._id==user._id" @tap="toReply(item)">回复</view>
+									<uni-easyinput
+										v-if="reply.reply&&reply.customer._id==user._id&&reply._id==item._id&&reply.index==indexx"
+										class="input" maxlength=-1 type="textarea" @change="confirm"
+										placeholder="回复商家" />
 								</view>
-								<uni-easyinput v-if="reply.reply" class="input" maxlength=-1 type="textarea"
-									@change="confirm" placeholder="回复商家" />
 							</view>
 						</view>
 					</view>
@@ -106,30 +110,36 @@
 		methods: {
 			async confirm(e) {
 				const that = this;
-				let reply = that.reply
-				let obj = {
-					content: e,
-					time: moment().format('YYYY-MM-DD HH:mm:ss')
-				}
-				reply.reply.push(obj)
-				const arr = await that.$api(`/goodsRate/${that.reply._id}`, 'POST', reply)
-				if (arr.errcode == '0') {
-					uni.showToast({
-						title: `回复成功`,
-						icon: 'success',
-					});
-					that.$set(that, `reply`, {});
+				if (e) {
+					let reply = that.reply
+					let obj = {
+						content: e,
+						time: moment().format('YYYY-MM-DD HH:mm:ss')
+					}
+					reply.reply.push(obj)
+					const arr = await that.$api(`/goodsRate/${that.reply._id}`, 'POST', reply)
+					if (arr.errcode == '0') {
+						uni.showToast({
+							title: `回复成功`,
+							icon: 'success',
+						});
+						that.$set(that, `reply`, {});
+					} else {
+						uni.showToast({
+							title: arr.errmsg,
+							icon: 'none',
+						})
+					}
 				} else {
-					uni.showToast({
-						title: arr.errmsg,
-						icon: 'none',
-					})
+					that.$set(that, `reply`, {});
 				}
+
 			},
 			// 回复
-			toReply(e) {
+			toReply(e, index) {
 				const that = this;
 				that.$set(that, `reply`, e);
+				that.$set(that.reply, `index`, index);
 			},
 			// 放大
 			toLarge(e, index) {
@@ -347,12 +357,15 @@
 					}
 
 					.other2 {
-						display: flex;
-						justify-content: space-between;
 						font-size: var(--font12Size);
 						color: var(--f85Color);
 						margin: 2vw 0 0 0;
 
+						.other2_1 {
+							display: flex;
+							justify-content: space-between;
+						}
+
 						.reply {
 							display: flex;
 							flex-direction: column;