diff --git a/pages/index/index.vue b/pages/index/index.vue index e767b2c..20531f1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -64,7 +64,7 @@ 待消费 - + {{shopData.refundCount == undefined?0:shopData.refundCount}} @@ -72,7 +72,7 @@ 待退款/售后 - + {{shopData.pendingBadReviewCount == undefined?0:shopData.pendingBadReviewCount}} @@ -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: diff --git a/pages/login/login.vue b/pages/login/login.vue index c8b264c..c8433cc 100644 --- a/pages/login/login.vue +++ b/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) diff --git a/pages/shop/shopEvaluate.vue b/pages/shop/shopEvaluate.vue index 9d4a669..c1723ba 100644 --- a/pages/shop/shopEvaluate.vue +++ b/pages/shop/shopEvaluate.vue @@ -45,7 +45,7 @@ {{item.createByName}} - {{item.createTime}} + {{item.createTime | formatTime}} @@ -59,7 +59,7 @@ {{item.remark}} - + @@ -68,6 +68,7 @@ {{item1.createByName}} : {{ item1.remark }} + 展开 @@ -75,6 +76,39 @@ + + + 回复 + + + + + + + + + + + + + + + + + + + + + 确认 + + + 取消 + + + + @@ -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 {}) + }, + 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; + } \ No newline at end of file