From 18008b4393c9ed22ad48b51f6db34e3c394155ae Mon Sep 17 00:00:00 2001 From: yvan.ni <765199919@qq.com> Date: Wed, 25 Sep 2019 17:18:40 +0800 Subject: [PATCH] 我的评价 列表 --- pages/user/comment/comment.js | 254 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------- pages/user/comment/comment.wxml | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------- pages/user/comment/comment.wxss | 215 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- 3 files changed, 414 insertions(+), 195 deletions(-) diff --git a/pages/user/comment/comment.js b/pages/user/comment/comment.js index c0c857c..b7dac5c 100644 --- a/pages/user/comment/comment.js +++ b/pages/user/comment/comment.js @@ -1,117 +1,161 @@ +var ut= require("../../../utils/util.js"); var t = function(t) { return t && t.__esModule ? t : { - default: t + default: t }; -}(require("../../../utils/LoadMore.js")), e = getApp(), rq = e.request, a = new t.default(), - s = require("../../../utils/util.js"), oo = e.globalData, os = e.globalData.setting; + }(require("../../../utils/LoadMore.js")), + e = getApp(), + rq = e.request, + a = new t.default(), + s = require("../../../utils/util.js"), + oo = e.globalData, + os = e.globalData.setting; Page({ - data: { - url: e.globalData.setting.url, - resourceUrl: e.globalData.setting.imghost, - iurl: e.globalData.setting.imghost, - categories: [ { - name: "全部评价", - status: 2 - }, { - name: "待评价", - status: 0 - }, { - name: "已评价", - status: 1 - } ], - activeStatus: 0, - comments: null, - currentPage: 1 - }, - onLoad: function(t) { - var e = void 0 === t.status ? this.data.activeStatus : t.status; - a.init(this, "", "comments"), this.requestComments(e); - }, - onShow: function() { - wx.getStorageSync("user:comment:update") && (wx.setStorageSync("user:comment:update", !1), - this.resetData(), this.requestComments(this.data.activeStatus)); - }, - changeTab: function(t) { - this.resetData(), this.requestComments(t.currentTarget.dataset.status); - }, - requestComments: function(t) { - var e = this, th=e,n = os.url + "/api/weshop/comment/list?page=" + e.data.currentPage; - console.log('requestComments'); - console.log(n); - console.log(t); - this.setData({ - activeStatus: t - }); - if(t==2){ - a.request(n, function (t) { - e.data.currentPage++; - var da = th.data.comments; - da.forEach(function(em,ind){ - rq.get("/api/weshop/goods/get/" + os.stoid + "/" + em.goods_id, { - success: function (tt) { - var gd = tt.data.data.original_img; - da[ind]['original_img'] = gd; - th.setData({ comments: da, }) - }, - }); - }) - - - }, null, { store_id: os.stoid, user_id: oo.user_id }), - wx.stopPullDownRefresh(); - }else{ - a.request(n, function(t) { - e.data.currentPage++; - var da = th.data.comments; - da.forEach(function (em, ind) { - rq.get("/api/weshop/goods/get/" + os.stoid + "/" + em.goods_id, { - success: function (tt) { - var gd = tt.data.data.original_img; - da[ind]['original_img'] = gd; - th.setData({ comments: da, }) - }, - }); - }); - - }, null, {is_comment:t, store_id: os.stoid,user_id: oo.user_id }), - wx.stopPullDownRefresh(); - } + data: { + url: e.globalData.setting.url, + resourceUrl: e.globalData.setting.imghost, + iurl: e.globalData.setting.imghost, + categories: [{ + name: "全部评价", + status: 2 + }, { + name: "待评价", + status: 0 + }, { + name: "已评价", + status: 1 + }], + activeStatus: 0, + comments: null, + currentPage: 1, + isloaded:0, + }, + onLoad: function(t) { + var e = void 0 === t.status ? this.data.activeStatus : t.status; + a.init(this, "", "comments"), this.requestComments(e); + }, + onShow: function() { + wx.getStorageSync("user:comment:update") && (wx.setStorageSync("user:comment:update", !1), + this.resetData(), this.requestComments(this.data.activeStatus)); + }, + changeTab: function(t) { + var e = this; + if (this.data.activeStatus==t.currentTarget.dataset.status) + return false; + this.resetData(), this.requestComments(t.currentTarget.dataset.status); + }, + requestComments: function(t) { + var e = this, + th = e, + n = os.url + "/api/weshop/comment/list?page=" + e.data.currentPage; + this.setData({ + activeStatus: t + }); + if (t == 2) { + a.request(n, function(t) { + + console.log("111111111111111111111111111111111111111"); + console.log(t); - }, - onReachBottom: function() { - a.canloadMore() && this.requestComments(this.data.activeStatus); - }, - onPullDownRefresh: function(t) { - this.resetData(), this.requestComments(this.data.activeStatus); - }, - resetData: function() { - this.data.comments = null, this.data.currentPage = 1, a.resetConfig(); - }, - /*-----评论-----*/ - comment: function(t) { - for (var e = t.currentTarget.dataset.recid, a = this.data.comments, s = 0; s < a.length && a[s].rec_id != e; s++) ; - if (!(s >= a.length)) { + e.data.currentPage++; + var da = th.data.comments; + da.forEach(function(em, ind) { + + if (em.img != undefined && em.img != null && ut.isString(em.img)) + da[ind].img = ut.unserialize(em.img); + var str = da[ind].weapp_img; + if (str != "" && ut.isString(str)) da[ind].weapp_img = JSON.parse(str); + + }) + + th.setData({ + comments: da, isloaded: 1, + }) + + + }, null, { + store_id: os.stoid, + user_id: oo.user_id + }), + wx.stopPullDownRefresh(); + } else { + a.request(n, function(t) { + + console.log("222222222222222222222222222222"); + e.data.currentPage++; + var da = th.data.comments; + + da.forEach(function(em, ind) { + + if (em.img != undefined && em.img != null && ut.isString(em.img)) + da[ind].img = ut.unserialize(em.img); + var str = da[ind].weapp_img; + if (str != "" && ut.isString(str)) da[ind].weapp_img = JSON.parse(str); + + + }); - console.log("comment"); - console.log(a[s]); + th.setData({ + comments: da, isloaded:1, + }) - var n = "?order_id=" + a[s].order_id; - n += "&goods_id=" + a[s].goods_id, n += "&goods_name=" + a[s].goods_name, n += "&price=" + a[s].goods_price, - n += "&img=" + a[s].original_img, - wx.navigateTo({ - url: "/pages/user/add_comment/add_comment" + n - }); - } - }, + }, null, { + is_comment: t, + store_id: os.stoid, + user_id: oo.user_id + }), + wx.stopPullDownRefresh(); + } + + }, + onReachBottom: function() { + a.canloadMore() && this.requestComments(this.data.activeStatus); + }, + + + onPullDownRefresh: function(t) { + this.resetData(), this.requestComments(this.data.activeStatus); + }, + resetData: function() { + this.data.comments = null, this.data.currentPage = 1, a.resetConfig(); + }, + /*-----评论-----*/ + comment: function(t) { + for (var e = t.currentTarget.dataset.recid, a = this.data.comments, s = 0; s < a.length && a[s].rec_id != e; s++); + if (!(s >= a.length)) { + var n = "?order_id=" + a[s].order_id; + n += "&goods_id=" + a[s].goods_id, n += "&goods_name=" + a[s].goods_name, n += "&price=" + a[s].goods_price, + n += "&img=" + a[s].original_img, + wx.navigateTo({ + url: "/pages/user/add_comment/add_comment" + n + }); + } + }, - //图片失败,默认图片 - bind_bnerr2: function (e) { - var _errImg = e.target.dataset.errorimg; - var _errObj = {}; - _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - } + //图片失败,默认图片 + bind_bnerr2: function(e) { + var _errImg = e.currentTarget.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = os.imghost+ "/public/images/default_goods_image_240.gif"; + //this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + //预览图片 + previewImg: function (e) { + console.log(e.currentTarget.dataset.index); + var index = e.currentTarget.dataset.index; + var imgArr = this.data.imgArr; + wx.previewImage({ + current: imgArr[index], //当前图片地址 + urls: imgArr, //所有要预览的图片的地址集合 数组形式 + }) + }, + //跳到首页 + goto: function (ee) { + wx.switchTab({ + url: '/pages/index/index/index', + }) + }, }); \ No newline at end of file diff --git a/pages/user/comment/comment.wxml b/pages/user/comment/comment.wxml index 2d97ab8..270cd12 100644 --- a/pages/user/comment/comment.wxml +++ b/pages/user/comment/comment.wxml @@ -1,39 +1,115 @@ + - - - - {{item.name}} + + + {{item.name}} + + + + + + + + + 当前暂无评价 + + + 去首页逛逛 + + + + + + + + + + + 订单编号:{{item.order_sn}} + + {{item.comment_id>0?'已评价':'待评价'}} + + + + + + + + + + + + + + {{item.goods_name}} + + + {{item.goods_color+item.goods_spec.length>-1?item.goods_color+item.goods_spec:'规格1'}} + + + + + + + + {{filter.toFix(item.goods_price,2)}} + + x{{item.goods_num}} + - - - - - - - - - {{item.goods_name}} - {{item.spec_key_name}} - 购买时间:{{item.order_add_time}} - - - - - - - 没有找到相关的记录 - 去逛逛 - - + + + + + + \ No newline at end of file diff --git a/pages/user/comment/comment.wxss b/pages/user/comment/comment.wxss index 1f02621..86b41e6 100644 --- a/pages/user/comment/comment.wxss +++ b/pages/user/comment/comment.wxss @@ -1,87 +1,186 @@ +.padding { + padding: 0rpx 27rpx; +} + +.container { + background-color: rgb(255, 255, 255); +} + .type-navbar { - white-space: nowrap; - display: flex; - width: 100%; - height: 80rpx; - background-color: #fff; + white-space: nowrap; + display: flex; + height: 80rpx; + background-color: #fff; + border-top: 2rpx solid rgb(221, 221, 221); + justify-content: space-between; + color: rgb(51, 51, 51); } .type-box { - width: 33.3333333333%; - box-sizing: border-box; - font-size: 32rpx; - line-height: 76rpx; - padding: 0 20rpx; - text-align: center; - display: inline-block; - overflow: hidden; + box-sizing: border-box; + line-height: 76rpx; + text-align: center; + display: inline-block; + overflow: hidden; } .type-navbar-item { - border-bottom: 4rpx solid #fff; + border-bottom: 4rpx solid #fff; } .type-item-on { - border-bottom: 4rpx solid #e64340; + /* width: 146rpx; */ + border-bottom: 7rpx solid #e64340; +} + +.border_bottom { + border-bottom: 3rpx solid rgb(245, 245, 245); +} +/* 无评价 */ + +.noCollection image { + width: 329rpx; + height: 229rpx; + margin-top: 202rpx; +} + +.noCollection .xc-ash { + margin-top: 10rpx; + font-weight: 600px; +} + +.noCollection navigator { + margin-top: 60rpx; + border-radius: 40rpx; +} + +.noCollection navigator view { + width: 247rpx; + height: 56rpx; + background-color: rgb(255, 72, 72); + border-radius: 40rpx; +} + +/* 待评价栏 */ + +.Commodity_number { + height: 70rpx; + border-top: 13rpx solid rgb(245, 245, 245); +} + +/* 文字基线对齐 */ + +.baseline { + display: flex; + align-items: baseline; +} + +/* 单个商品框架 */ + +.detail_commodity { + height: 231rpx; +} + +.detail_commodity image { + width: 185rpx; + height: 185rpx; } -.goods-container { - /*--margin: 20rpx 0;--*/ - margin-top: 20rpx; - background-color: #fff; +.detail_commodity .goods_name { + width: 485rpx; + /* height: 75rpx; */ + line-height: 37rpx; } -.goods-box { - - position: relative; - padding: 20rpx 30rpx 0; - font-size: 28rpx; - clear: both; +.Commodity_content { + height: 185rpx; + margin-left: 21rpx; } -.goods-img { - float: left; - height: 100rpx; - width: 100rpx; +.Commodity_content .Commodity_goods { + height: 150rpx; } -.goods-desc { - float: left; - width: 570rpx; - margin-left: 20rpx; +.Commodity_content .Commodity_money { + font-size: 16rpx; } -.goods-name { - height: 44rpx; - line-height: 44rpx; - overflow: hidden; +/* 商品评价按钮框架 */ + +.commodity_evaluate { + height: 110rpx; + padding-top: 15rpx; } -.buy-time { - margin-top: 20rpx; - font-size: 26rpx; - color: #b3b3b3; +.commodity_evaluate .commodity_smy .commodity_money { + margin-left: 29rpx; + letter-spacing: 1rpx; } -.comment-button { - font-size: 30rpx; - color: #f23030; - float: right; - padding: 8rpx 10rpx; - border: 1rpx #f23030 solid; - margin-bottom: 20rpx; +.commodity_evaluate .commodity_To_evaluate { + width: 128rpx; + height: 39rpx; + border-radius: 9rpx; +} +.commodity_evaluate .commodity_To_evaluate view{ + height: 39rpx; + line-height: 39rpx; +} +.commodity_evaluate .comment_go{ + margin-top: 10rpx; + background-color: rgb(211, 28, 52); + color: rgb(255, 255, 255); } -.change-order { - color: #c2c2c2; - border: 1rpx #c2c2c2 solid; +.Commodity_spec { + width: 106rpx; + background-color: rgb(236, 236, 236); + border-radius: 7rpx; + font-size: 18rpx; + margin-top: 10rpx; } -.button-icon { height: 26rpx; width: 26rpx;} -.start_c{ - height: 42rpx; width: 230rpx; - top: 6rpx; position: relative; +.Commodity_spec view { + height: 28rpx; + align-items: center; +} + +.Commodity_evaluation .Comment_content { + text-indent: 2em; + color: rgb(153, 153, 153); + letter-spacing: 1rpx; +} +.Commodity_evaluation .starss{ + height: 58rpx; + /* // line-height: 58rpx; */ + align-items: center; +} +.Commodity_evaluation .commen{ + height: 58rpx; + line-height: 58rpx; +} +.Commodity_evaluation .starss .stars{ + line-height: 58rpx; +} +.Commodity_evaluation .starss .stars image { + width: 29rpx; + height: 26rpx; + margin-right: 5rpx; +} + +.Commodity_evaluation .Comment_images image { + width: 93rpx; + height: 93rpx; + margin-right: 8rpx; + margin-top: 18rpx; + border-radius: 4rpx; +} +.commodity_evaluate .View_evaluation{ + border:2rpx solid rgb(179, 179, 179); + color:rgb(0, 0, 0); + background-color: rgb(255, 255, 255); +} +.comment_addtime{ + height: 50rpx; } -.clear{clear: both; border-top: 1rpx solid #eee; font-size: 30rpx; padding-left: 30rpx} -.clear view{margin-bottom: 10rpx;} -.clear .fview{margin-top: 10rpx;} \ No newline at end of file +.title_width{ width: 146rpx; text-align:center } \ No newline at end of file -- libgit2 0.21.4