tianyi 1 month ago
parent
commit
555fb95b8d
  1. 39
      pages/index/index.vue
  2. 8
      pages/login/login.vue
  3. 189
      pages/shop/shopEvaluate.vue

39
pages/index/index.vue

@ -64,7 +64,7 @@
待消费
</view>
</view>
<view class="order33" @tap="changeIndex(1,11)">
<view class="order33" @tap="goDetail('tui',11)">
<view class="order44">
{{shopData.refundCount == undefined?0:shopData.refundCount}}
</view>
@ -72,7 +72,7 @@
待退款/售后
</view>
</view>
<view class="order33" @tap="goDetail('pj')">
<view class="order33" @tap="goDetail('pj','cha')">
<view class="order44">
{{shopData.pendingBadReviewCount == undefined?0:shopData.pendingBadReviewCount}}
</view>
@ -249,7 +249,10 @@
this.areaList = res.result
this.$refs.areaPopup.open()
} else {
this.tui.toast(res.message)
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
@ -264,7 +267,10 @@
this.shop.shopIcon = uni.getStorageSync('shopIcon')
this.businessStatus = res.result.status
} else {
this.tui.toast(res.message)
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
@ -343,9 +349,14 @@
case 'pj':
let item = {
shopScore:uni.getStorageSync('shopScore'),
id:uni.getStorageSync('id')
id:uni.getStorageSync('shopId')
}
url = '/pages/shop/shopEvaluate'
url = '/pages/shop/shopEvaluate?item=' + JSON.stringify(item) + '&isMerchant=1&isCha=' + (index =='cha'?1:0)
break;
case 'tui':
uni.navigateTo({
url: '/pages/shop/shopReturnOrder?type=shop'
})
break;
case 'hx':
this.scanCodeAdd()
@ -378,7 +389,10 @@
}
}
} else {
that.tui.toast(res.message)
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
@ -406,7 +420,10 @@
icon: 'none'
})
} else {
that.tui.toast(res.message)
uni.showToast({
title: res.message,
icon: 'none'
})
}
uni.hideLoading()
}).catch((res) => {})
@ -416,7 +433,10 @@
} else {
that.tui.toast('未查询到此订单信息,请核实!')
uni.showToast({
title: '未查询到此订单信息,请核实!',
icon: 'none'
})
}
}
},
@ -438,6 +458,7 @@
this.indexInit()
break;
case 1:
that.$refs.deLivery.init(type)
break;
case 2:

8
pages/login/login.vue

@ -70,6 +70,7 @@
components: {},
data() {
return {
shopList:[],
captchaId:'',
wayValue:0,
captchaImg:'',
@ -320,7 +321,7 @@
that.NB.sendRequest('/auth/chooseShop', {
shopId: item.shop.id,
deviceId:res1.deviceId
}, false, 'POST', 'application/x-www-form-urlencoded').then(res => {
}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
uni.setStorageSync('type',item.type)
uni.setStorageSync('warehouseKeeperFlag',item.warehouseKeeperFlag)
@ -330,6 +331,7 @@
uni.setStorageSync('shopIcon',res.result.shopIcon)
uni.setStorageSync('shopAddress',res.result.shopAddress)
uni.setStorageSync('shopRemark',res.result.remark)
uni.setStorageSync('shopScore',item.shop.shopScore)
uni.setStorageSync("shopOwnerPhone", item.shopOwnerPhone)
uni.setStorageSync('schoolShop',res.result.shop)
uni.setStorageSync('schoolShop',res.result.shop)
@ -393,10 +395,8 @@
mask: true
});
that.NB.sendRequest(url, data, false, 'POST', 'application/x-www-form-urlencoded').then(res => {
that.NB.sendRequest(url, data, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code !== 200) return
console.log('shopList',res.result.shopList)
console.log('shopList.shop',res.result.shopList[0].shop)
uni.setStorageSync("hiver_token", res.result.accessToken)
uni.setStorageSync("wayValue", this.wayValue)
uni.setStorageSync("nickname", res.result.user.nickname)

189
pages/shop/shopEvaluate.vue

@ -45,7 +45,7 @@
{{item.createByName}}
</view>
<view class="eval-time">
{{item.createTime}}
{{item.createTime | formatTime}}
</view>
</view>
</view>
@ -59,7 +59,7 @@
<view class="eval-text">
{{item.remark}}
</view>
<view class="eval-img">
<view class="eval-img" v-if="item.picture">
<img @tap="largeImg" :src="item.picture" alt="">
</view>
<view class="reply-card" :class="{'expanded': isExpanded}" v-for="(item1,index1) in item.comments" :key="index1">
@ -68,6 +68,7 @@
<!-- 回复内容区域动态类控制展开/折叠 -->
<view class="reply-content" :class="{ collapsed: !isExpanded, expanded: isExpanded }">
<text>{{item1.createByName}} : {{ item1.remark }}</text>
<img :src="item1.picture" alt="" class="upload-img" style="margin-top: 10px;border-radius: 10px;">
</view>
<view class="reply-expand-btn" @click="toggleReply">
<text v-if="!isExpanded">展开</text>
@ -75,6 +76,39 @@
</view>
</view>
</view>
<view class="" v-if="isMerchant == 1">
<view @tap="changeStatus(index)" class="reply-card" v-if="!item.isReply" style="text-align: right;padding-right: 10px;color: #00BFFF;">
回复
</view>
<view class="" v-else>
<view class="" style="background: #f5f5f5;border-radius: 10px;border: 1px solid #777;margin-top: 10px;">
<view class="eval-num" style="border: none;">
<textarea name="" v-model="replyText" id="" cols="30" rows="10" placeholder="有什么想说的吗?可以写下来,提交给我们" style="width: 100%;font-size: 28rpx;padding: 30rpx;height: 200rpx;"></textarea>
</view>
<view class="eval-num" style="border: none;padding: 0 30rpx;display: flex;margin-bottom: 10px;">
<view class="upload-img" @tap="pictureAdd()"
style="background: #eee;text-align: center;line-height: 160rpx;">
<uni-icons type="camera" size="28" color="#777"></uni-icons>
</view>
<view style="flex: 1;display: flex;">
<view v-if="replyPicture !=''"
:key="index" style="width: 160rpx;height: 160rpx;margin-left: 20rpx;">
<img :src="replyPicture" alt="" class="upload-img">
</view>
</view>
</view>
</view>
<!-- <textarea type="text" v-model="replyText" placeholder="要说什么写下来吧" style="background: #eee;border-radius: 10px;height: 100px;margin: 10px 0;padding: 10px;" /> -->
<view class="" style="display: flex;flex-direction: row-reverse;padding-right: 10px;margin-top: 10px;">
<view @tap="submit(index)" class="" style="margin-left: 20px;color: #00BFFF;">
确认
</view>
<view class="" @tap="changeStatus(index)">
取消
</view>
</view>
</view>
</view>
</view>
</view>
</view>
@ -91,7 +125,11 @@
export default {
data() {
return {
replyText:'',
isMerchant:0,
replyPicture:"",
isExpanded: false,
isPintuan: true,
bigImg: '',
shopItem:{},
pageNum:1,
@ -122,11 +160,43 @@
},
components: {
},
filters:{
formatTime(value) {
const date = new Date(value);
//
const year = date.getFullYear();
// (getMonth 0-11 +1)0
const month = String(date.getMonth() + 1).padStart(2, '0');
// (getDate)0
const day = String(date.getDate()).padStart(2, '0');
// (getHours)0
const hour = String(date.getHours()).padStart(2, '0');
// (getMinutes)0
const minute = String(date.getMinutes()).padStart(2, '0');
// (getSeconds)0
const second = String(date.getSeconds()).padStart(2, '0');
// -- ::
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
}
},
onLoad(option) {
this.shopItem = JSON.parse(uni.getStorageSync('area')).shop
console.log('shop',this.shopItem)
this.getshopComments(this.shopItem.shopId)
this.isMerchant = option.isMerchant
this.shopItem = JSON.parse(option.item)
if(option.isCha == 1){ //
this.searchForm.score = 1
this.searchForm.hasAnswer= 0
this.menuList[0].checked = false
this.menuList[2].checked = true
}
this.getshopComments(this.shopItem.id)
},
onShow() {
@ -135,20 +205,57 @@
getshopComments(id){
let that = this
this.searchForm.shopId = id
this.NB.sendRequest("/app/comment/getCommentList", this.searchForm, false, 'POST', 'application/json').then((res) => {
that.NB.sendRequest("/app/comment/getCommentList", this.searchForm, false, 'post', 'application/json').then((res) => {
if (res.code == 200) {
if (that.pageNum == 1) {
that.shopComments = res.result.records
} else {
that.shopComments = [...that.shopComments, ...res.result.records]
}
for(let i=0;i<that.shopComments.length;i++){
that.shopComments[i].isReply=false
}
that.$forceUpdate()
if(this.searchAll){
that.menuList[0].num = res.result.total
}
} else {
that.tui.toast(res.message)
return
uni.showToast({
title: res.message,
icon:'none'
});
}
uni.hideLoading()
}).catch((res) => {})
},
submit(v){
let that = this;
let data = [{ //
parentId:this.shopComments[v].id,
leve:1,
remark:this.replyText,
picture:this.replyPicture,
createBy:this.shopComments[v].shopId,
createByName:'商家',
createByIcon:'https://ooo.0o0.ooo/2019/04/28/5cc5a71a6e3b6.png',
orderId:this.shopComments[v].orderId,
shopId:this.shopComments[v].shopId,
}]
that.NB.sendRequest("/app/comment/save", data, false, 'post', 'application/json').then((res) => {
if (res.code == 200) {
uni.showToast({
title: "评论成功",
icon: 'none'
})
setTimeout(res => {
this.back()
}, 1000)
} else {
uni.showToast({
title: res.message,
icon:'none'
});
}
uni.hideLoading()
}).catch((res) => {})
@ -156,6 +263,10 @@
toggleReply() {
this.isExpanded = !this.isExpanded;
},
changeStatus(v){
this.shopComments[v].isReply = !this.shopComments[v].isReply
this.$forceUpdate()
},
checkTab(index) {
for (let i = 0; i < this.menuList.length; i++) {
if (i == index) {
@ -178,6 +289,55 @@
}
this.getshopComments(this.shopItem.id)
},
pictureAdd() {
let that = this
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['camera', 'album'],
success(res) {
uni.showLoading({
title: '加载中...',
mask: true
})
for (let i = 0; i < res.tempFiles.length; i++) {
that.upLoadFile(res.tempFiles[i].tempFilePath)
}
}
})
},
async upLoadFile(path) {
let that = this;
let hiver_token = uni.getStorageSync("hiver_token")
await uni.uploadFile({
url: that.tui.interfaceUrl() + '/upload/file',
filePath: path,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': hiver_token
},
formData: {},
success: (uploadFileRes) => {
let pathData = JSON.parse(uploadFileRes.data)
this.replyPicture = pathData.result
that.$forceUpdate()
},
fail: (err) => {
uni.hideLoading();
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
})
}
});
await setTimeout(res => {
uni.hideLoading();
}, 1000)
},
//
largeImg(img) {
this.bigImg = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/00b1f011787c4549bbea650d95a4eb39.png'
@ -395,7 +555,7 @@
font-size: 26rpx;
color: #555;
padding: 12rpx;
transition: all 0.2s;
transition: all 1s;
height: 70rpx;
flex: 1;
}
@ -412,7 +572,7 @@
/* 展开状态:固定高度100px,可滚动 */
.reply-content.expanded {
display: block;
height: 200rpx;
height: auto;
/* 固定高度100px */
overflow-y: auto;
/* 内容超长时滚动 */
@ -420,6 +580,7 @@
-webkit-line-clamp: unset;
-webkit-box-orient: unset;
text-overflow: clip;
padding-bottom: 10px;
}
/* 滚动条美化(可选) */
@ -431,4 +592,12 @@
background-color: #ccc;
border-radius: 20rpx;
}
.eval-num{
padding-bottom: 30rpx;
border-bottom: 1px solid #eee;
}
.upload-img {
width: 160rpx;
height: 160rpx;
}
</style>
Loading…
Cancel
Save