var _request = require('../../../../utils/request.js') var rid; var pid; Page({ data: { order: {}, express: '', total:0, lvList:[     '/images/star_a_l.png',     '/images/star_a_r.png',     '/images/star_a_l.png',     '/images/star_a_r.png', '/images/star_a_l.png',     '/images/star_a_r.png', '/images/star_a_l.png',     '/images/star_a_r.png', '/images/star_a_l.png',     '/images/star_a_r.png'   ],//星星个数   lvListActive1: '/images/star_a_l.png',//选中的   lvListActive2:'/images/star_d_l.png',//未选中的 lvListActive3: '/images/star_a_r.png',//选中的   lvListActive4:'/images/star_d_r.png',//未选中的 star_txt:'非常好', commtxt:'商品不错,物流快,好评', commlv:9 }, onLoad: function (options) { rid = options.id; pid = options.pid; this.getProjectDetail() }, getProjectDetail () { var that = this var url = "v1/product/" + pid; var params = {} var success = function (val) { console.log('data',val.data) that.setData({ order: val.data, }); } _request.$get(url, params, success) }, confirmPopup () { var that = this wx.showModal({ title: '提示', content: '是否确认收货?', success: function(res) { if (res.confirm) { that.confirmOrder() } else if (res.cancel) { } } }) }, CancelPopup () { var that = this wx.showModal({ title: '提示', content: '确定取消该订单?', success: function(res) { if (res.confirm) { that.CancelOrder() } else if (res.cancel) { } } }) }, confirmOrder: function () { var id = this.data.order.order_id var that = this var url = 'v1/order/' + id + '/confirm' var params = { } var success = function (res) { getApp().globalData.order = true wx.navigateBack() } _request.$put(url, params, success) }, CancelOrder: function () { var id = this.data.order.order_id var that = this var url = 'v1/order/' + id + '/cancel' var params = { } var success = function (res) { getApp().globalData.order = true wx.navigateBack() } _request.$put(url, params, success) }, formatOrder: function () { var id = this.data.order.express_order_no var result = '' for (var i = 0; i < id.length; i++) { if (i%4 === 0 && i !== 0) { result = result + ' ' } result = result + id[i] } this.setData({ express: result }) }, copeOrder: function () { var that = this var id = this.data.order.express_order_no wx.setClipboardData({ data: id, success: function(res) { wx.showToast({ title: '已成功复制到剪贴板', icon: 'none', duration: 2000 }) } }) }, onShareAppMessage: function (val) { return _request.share({ sc: 'xcx_user_order' }) }, evaluateLv(e){ console.log(e); var that = this; var idx = e.currentTarget.dataset.index; var lvList = that.data.lvList; console.log('idx',idx); var star_txt = ''; if(idx == 9) star_txt = '非常好'; if(idx == 8) star_txt = '满意'; if(idx == 7) star_txt = '满意'; if(idx == 6) star_txt = '一般'; if(idx == 5) star_txt = '一般'; if(idx == 4) star_txt = '差'; if(idx == 3) star_txt = '差'; if(idx == 2) star_txt = '非常差'; if(idx == 1) star_txt = '非常差'; if(idx == 0) star_txt = '非常差'; lvList.forEach((item,index) => { console.log('index',index); if(index <= idx){ if(index % 2 === 0){ lvList[index] = that.data.lvListActive1; }else{ lvList[index] = that.data.lvListActive3; } }else{ if(index % 2 === 0){ lvList[index] = that.data.lvListActive2; }else{ lvList[index] = that.data.lvListActive4; }     }   }) that.setData({ lvList: lvList, star_txt:star_txt, commlv:idx }) }, bindcomm: function (e) { this.setData({ commtxt: e.detail.value }) }, sendComment() { var that = this var url = 'v1/order_detail/'+ rid +'/commend'; var score = (this.data.commlv + 1) * 10 /2; var params = { detail:this.data.commtxt, score:score } var success = function (res) { wx.showToast({ title: '添加评论成功', icon: 'none', duration: 2000 }) setTimeout(function(){wx.navigateBack({ changed: true })},1500) } _request.$put(url, params, success) }, })