diff --git a/app.json b/app.json index 6b77afa..dadf560 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,9 @@ { "pages": [ "pages/index/index/index", + "pages/user/comment/comment", + "pages/giftpack/evaluategift/evaluategift", + "pages/giftpack/newvipgift/newvipgift", "pages/giftpack/payment/payment", "pages/giftpack/buygiftpack/giftpackbuy", "pages/giftpack/giftpacklist/giftpacklist", @@ -21,7 +24,6 @@ "pages/user/address_list/address_list", "pages/user/userinfo/userinfo", "pages/user/account/account", - "pages/user/comment/comment", "pages/user/return_goods_list/return_goods_list", "pages/user/userinfo_edit/userinfo_edit", "pages/user/collect_list/collect_list", @@ -81,7 +83,9 @@ "pages/user/my_service/tment_eval", "pages/user/my_service/tment_order_list", "pages/user/my_service/beauty_deta", - "pages/user/labels/labels" + "pages/user/labels/labels", + "pages/user/view_comment/view_comment", + "pages/giftpack/birthdaygift/birthdaygift" ], "permission": { "scope.userLocation": { diff --git a/pages/user/add_comment/add_comment.js b/pages/user/add_comment/add_comment.js index ba233b8..2d02b6b 100644 --- a/pages/user/add_comment/add_comment.js +++ b/pages/user/add_comment/add_comment.js @@ -8,7 +8,6 @@ Page({ resourceUrl: a.resourceUrl, iurl: a.imghost, defaultPhoto: a.resourceUrl + "/static/images/camera.png", - uploadPath: [], //上传后文件路径 maxWord: 0, is_anonymous: !1, @@ -20,7 +19,9 @@ Page({ isLongPress: !1, userinfo: null, imgs: [], //本地文件再上传时的路径 - lenMore:0 + lenMore:0, + goods_id: "", //商品id + order_id: "", //订单id }, onLoad: async function (a) { var th = this; @@ -35,6 +36,10 @@ Page({ console.log(e); th.setData({userinfo: e}) }) + th.setData({ + goods_id: a.goods_id, + order_id: a.order_id + }) }, keyUpChangeNum: function (t) { this.setData({ @@ -79,7 +84,7 @@ Page({ }); }); }, - submitComment: function () { + submitComment: function (i) { var a = this; if (!a.data.service_rank || !a.data.goods_rank || !a.data.deliver_rank) return getApp().my_warnning("请先打分",0,a); @@ -111,9 +116,15 @@ Page({ e.post("/api/weshop/comment/savecomment", { data:p_data, success: function (a) { + if(a.data.code==0){ wx.setStorageSync("user:comment:update", !0), t.showSuccess("评论成功", function () { - wx.navigateBack(); + // wx.navigateBack(); + var url = i.currentTarget.dataset.url; + getApp().goto(url); }); + }else{ + getApp().my_warnning(a.data.msg,0,a); + } } }); //}); diff --git a/pages/user/add_comment/add_comment.wxml b/pages/user/add_comment/add_comment.wxml index e4f7f9f..71d1232 100644 --- a/pages/user/add_comment/add_comment.wxml +++ b/pages/user/add_comment/add_comment.wxml @@ -106,7 +106,7 @@ - 提交评价 + 提交评价 diff --git a/pages/user/comment/comment.js b/pages/user/comment/comment.js index cb15337..87eadde 100644 --- a/pages/user/comment/comment.js +++ b/pages/user/comment/comment.js @@ -124,10 +124,11 @@ Page({ //图片失败,默认图片 bind_bnerr2: function(e) { + var th = this; var _errImg = e.currentTarget.dataset.errorimg; var _errObj = {}; _errObj[_errImg] = os.imghost + "/public/images/default_goods_image_240.gif"; - //this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + th.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; }, //预览图片 previewImg: function(e) { diff --git a/pages/user/comment/comment.wxml b/pages/user/comment/comment.wxml index 8e578e2..4e77fe1 100644 --- a/pages/user/comment/comment.wxml +++ b/pages/user/comment/comment.wxml @@ -7,21 +7,21 @@ - - - - - - 当前暂无评价 - - - 去首页逛逛 - + + + + + + 当前暂无评价 + + + 去首页逛逛 + + - - - + + @@ -66,16 +66,15 @@ 评价: - + {{item.content.length>0?item.content:'此用户没有填写评论'}} - - - + + + @@ -106,12 +105,19 @@ - - 查看订单 - - - 去评价 - + + + 查看订单 + + + + 查看评价 + + + + 去评价 + + diff --git a/pages/user/comment/comment.wxss b/pages/user/comment/comment.wxss index cd0a6ca..3ca00d8 100644 --- a/pages/user/comment/comment.wxss +++ b/pages/user/comment/comment.wxss @@ -36,6 +36,7 @@ .border_bottom { border-bottom: 3rpx solid rgb(245, 245, 245); } + /* 无评价 */ .noCollection image { @@ -122,14 +123,17 @@ height: 39rpx; border-radius: 9rpx; } -.commodity_evaluate .commodity_To_evaluate view{ + +.commodity_evaluate .commodity_To_evaluate view { height: 39rpx; line-height: 39rpx; } -.commodity_evaluate .comment_go{ - margin-top: 10rpx; - background-color: rgb(211, 28, 52); + +.commodity_evaluate .comment_go { + margin-left: 20rpx; + background-color: rgb(211, 28, 52); color: rgb(255, 255, 255); + border: 2rpx solid rgb(211, 28, 52); } .Commodity_spec { @@ -141,26 +145,30 @@ } .Commodity_spec view { - height: 28rpx; - align-items: center; + height: 28rpx; + align-items: center; } .Commodity_evaluation .Comment_content { color: rgb(153, 153, 153); letter-spacing: 1rpx; } -.Commodity_evaluation .starss{ - height: 58rpx; - /* // line-height: 58rpx; */ - align-items: center; + +.Commodity_evaluation .starss { + height: 58rpx; + /* // line-height: 58rpx; */ + align-items: center; } -.Commodity_evaluation .commen{ + +.Commodity_evaluation .commen { height: 58rpx; line-height: 58rpx; } -.Commodity_evaluation .starss .stars{ + +.Commodity_evaluation .starss .stars { line-height: 58rpx; } + .Commodity_evaluation .starss .stars image { width: 29rpx; height: 26rpx; @@ -173,17 +181,35 @@ margin-right: 8rpx; margin-top: 18rpx; border-radius: 6rpx; - border: 3rpx solid rgb(245, 245, 245); + border: 2rpx solid rgb(245, 245, 245); + margin-left: 15rpx; } -.commodity_evaluate .View_evaluation{ - border:2rpx solid rgb(179, 179, 179); - color:rgb(0, 0, 0); + +.commodity_evaluate .View_evaluation { + border: 2rpx solid rgb(179, 179, 179); + color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); } -.comment_addtime{ + +.comment_addtime { height: 50rpx; } -.title_width{ width: 146rpx; text-align:center } -.shop-font{ color: rgb(153, 153, 153);} -.reply{ margin-top: 10rpx} -.get_bottom{ text-align: center; color: #999; margin-bottom: 20rpx} \ No newline at end of file + +.title_width { + width: 146rpx; + text-align: center; +} + +.shop-font { + color: rgb(153, 153, 153); +} + +.reply { + margin-top: 10rpx; +} + +.get_bottom { + text-align: center; + color: #999; + margin-bottom: 20rpx; +} diff --git a/pages/user/view_comment/view_comment.js b/pages/user/view_comment/view_comment.js new file mode 100644 index 0000000..4e3ecbe --- /dev/null +++ b/pages/user/view_comment/view_comment.js @@ -0,0 +1,124 @@ +var i = require("../../../utils/util.js"), +ut = i; +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +Page({ + + /** + * 页面的初始数据 + */ + data: { + url: a.url, + iurl: a.imghost, + comment: [], //用户单个评价的内容 + goods_id: "", //商品id + order_id: "", //订单id + is_act: 0, //是否开启活动 + actId:"",//活动id + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var th = this; + th.setData({ + goods_id: options.goods_id, + order_id: options.order_id + }) + th.query_comment(); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + query_comment: function() { + var th = this; + wx.showLoading({ + title: '加载中' + }) + var url = "/api/weshop/comment/list"; + getApp().request.promiseGet(url, { + data: { + store_id: a.stoid, + userId: d.user_id, + goods_id: th.data.goods_id, + order_id: th.data.order_id + } + }).then(res => { + wx.hideLoading(); + if (res.data.code == 0) { + var data = res.data.data.pageData; + if (data[0].img) data[0].img = ut.unserialize(data[0].img); + if (data[0].weapp_img) data[0].weapp_img = JSON.parse(data[0].weapp_img); + th.setData({ + comment: data + }) + th.judge_act(); //判断是否开启评价有礼 + } else { + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); + } + }) + }, + //评价有礼判断 + judge_act: function() { + var th = this; + var url = "/api/weshop/marketing/comment/act/judge"; + getApp().request.promiseGet(url, { + data: { + orderGoodsId: th.data.goods_id, + orderNumber: th.data.order_id, + orderType: 1, + storeId: a.stoid, + userId: d.user_id + } + }).then(res => { + if (res.data.code == 0) { + var id = res.data.data.id; + th.setData({ + is_act: 1, + actId:id + }) + } else { + + } + }) + }, + //预览图片 + previewImg: function (e) { + var th = this; + var index = e.currentTarget.dataset.index; + var sindex = e.currentTarget.dataset.sindex; + var imgArr = th.data.comment; + var image = imgArr[0].weapp_img; + var imagename = ""; + var iurl = th.data.iurl; + if (image!=""){ + image = imgArr[0].weapp_img[index]; + wx.previewImage({ + current: iurl+image, + //当前图片地址 + urls: imgArr[0].weapp_img, //所有要预览的图片的地址集合 数组形式 + }) + }else{ + image = imgArr[0].img[index]; + wx.previewImage({ + current: iurl+image, + //当前图片地址 + urls: imgArr[0].img, //所有要预览的图片的地址集合 数组形式 + }) + } + }, + goto: function(e) { + var th = this; + var url = e.currentTarget.dataset.url; + getApp().goto(url); + } + +}) \ No newline at end of file diff --git a/pages/user/view_comment/view_comment.json b/pages/user/view_comment/view_comment.json new file mode 100644 index 0000000..eacc6fa --- /dev/null +++ b/pages/user/view_comment/view_comment.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "查看评价", + "usingComponents": { + "warn": "/components/long_warn/long_warn", + "my_confirm": "/components/my_confirm/my_confirm" + } +} \ No newline at end of file diff --git a/pages/user/view_comment/view_comment.wxml b/pages/user/view_comment/view_comment.wxml new file mode 100644 index 0000000..fc1a0ed --- /dev/null +++ b/pages/user/view_comment/view_comment.wxml @@ -0,0 +1,105 @@ + + + + + + + + + {{item.goods_name}} + + + + + + {{item.goods_price}} + + + + + x + {{item.goods_num}} + + + + + + + + + + + + {{item.content}} + + + + + + + + + + + + + + + + + + + + + + + + 宝贝评分 + + + + + + 描述相符 + + + + + + + + + 物流服务 + + + + + + + + 服务态度 + + + + + + + + + + + + + + + + 评价其他 + + + 点击领取礼品 + + + + + + \ No newline at end of file diff --git a/pages/user/view_comment/view_comment.wxss b/pages/user/view_comment/view_comment.wxss new file mode 100644 index 0000000..ed974d5 --- /dev/null +++ b/pages/user/view_comment/view_comment.wxss @@ -0,0 +1,170 @@ +page{ + overflow-x: hidden; +} +/* 商品详情和评价 */ +.commoditymax{ + overflow-x: hidden; +} +.commodity { + border-top: 6rpx solid rgb(245, 245, 245); + border-bottom: 6rpx solid rgb(245, 245, 245); + padding: 0rpx 30rpx; + padding-bottom:10rpx; +} + +.commodity .information { + height: 286rpx; +} + +.commodity .information image { + width: 186rpx; + height: 186rpx; +} + +.information .goods_name { + width: 480rpx; + margin-left: 25rpx; + height: 186rpx; +} + +.information .goods_name .ellipsis-2 { + line-height: 40rpx; + height: 80rpx; +} + +.information .goods_name .jc_sb { + margin-top: 60rpx; + color: rgb(212, 28, 52); + margin-right: 7rpx; +} + +.information .goods_name .jc_sb .fs32 { + line-height: 40rpx; +} + +.information .goods_name .jc_sb .sum { + margin-right: 5rpx; +} + +.balin { + align-items: baseline; +} + +.addComment { + width: 690rpx; + padding: 32rpx 0rpx 21rpx 0rpx; +} + +.addComment textarea { + padding: 0rpx 18rpx; + max-height: 100rpx; + width: 654rpx; +} + +.addComment .addimages { + padding: 0rpx 18rpx; + margin-top: 20rpx; + align-items: flex-end; + width: 652rpx; + margin-bottom: 15rpx; +} +.comment{ + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; +} +.addComment .addimages .images { + height: 140rpx; +} + +.addComment .addimages .images .rel { + width: 140rpx; + height: 100%; + overflow: visible; + margin-right: 15rpx; +} + +.addComment .addimages .images image .abs { + width: 30rpx; + height: 30rpx; + top: -7rpx; + right: -7rpx; +} + +.addComment .addimage { + width: 139rpx; + height: 139rpx; + border: 2rpx dashed rgb(196, 196, 196); + font-size: 16rpx; + margin-left: 6rpx; +} + +.addComment .addimage image { + width: 60rpx; + height: 58rpx; +} + +.Grade { + width: 100%; + height: 310rpx; + border-bottom: 6rpx solid rgb(245, 245, 245); + padding-left: 45rpx; +} + +.Grade .title { + width: 100%; + height: 105rpx; +} + +.Grade .title .column { + height: 30rpx; + border-left: 6rpx solid rgb(211, 27, 58); + margin-right: 12rpx; +} + +.Grade .score-item { + height: 55rpx; + line-height: 55rpx; +} + +.Grade .score-item .stars { + margin-left: 83rpx; +} +.Grade .score-item .stars view{ + width: 60rpx; + height: 55rpx; +} + +.Grade .score-item .stars image { + width: 35rpx; + height: 35rpx; +} +.Whether { + padding:0rpx 31rpx; +} +.Whether .flex-right-vertical { + height: 67rpx; +} + +.Whether .flex-right-vertical .radio { + margin-right: 15rpx; +} + +.Whether .Submission { + margin: 40rpx 0 40rpx 0; +} + +.Whether .white { + width: 364rpx; + height: 58rpx; + background-color: rgb(212, 28, 52); + border-radius: 40rpx; + line-height: 58rpx; +} +.Whether .receive{ + background-color: rgb(255, 176, 63); +} + +